feat: add settings schema
This commit is contained in:
@@ -6,6 +6,182 @@
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "@wailsio/runtime";
|
||||
|
||||
export class AppSettingDefinition {
|
||||
/**
|
||||
* Creates a new AppSettingDefinition instance.
|
||||
* @param {Partial<AppSettingDefinition>} [$$source = {}] - The source object to create the AppSettingDefinition.
|
||||
*/
|
||||
constructor($$source = {}) {
|
||||
if (!("key" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["key"] = "";
|
||||
}
|
||||
if (!("category" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["category"] = "";
|
||||
}
|
||||
if (!("label" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["label"] = "";
|
||||
}
|
||||
if (!("type" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["type"] = "";
|
||||
}
|
||||
if (!("defaultValue" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["defaultValue"] = "";
|
||||
}
|
||||
if (!("value" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["value"] = "";
|
||||
}
|
||||
if (!("description" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["description"] = "";
|
||||
}
|
||||
if (!("options" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {AppSettingOption[]}
|
||||
*/
|
||||
this["options"] = [];
|
||||
}
|
||||
if (!("readOnly" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {boolean}
|
||||
*/
|
||||
this["readOnly"] = false;
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new AppSettingDefinition instance from a string or object.
|
||||
* @param {any} [$$source = {}]
|
||||
* @returns {AppSettingDefinition}
|
||||
*/
|
||||
static createFrom($$source = {}) {
|
||||
const $$createField7_0 = $$createType1;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("options" in $$parsedSource) {
|
||||
$$parsedSource["options"] = $$createField7_0($$parsedSource["options"]);
|
||||
}
|
||||
return new AppSettingDefinition(/** @type {Partial<AppSettingDefinition>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
export class AppSettingGroup {
|
||||
/**
|
||||
* Creates a new AppSettingGroup instance.
|
||||
* @param {Partial<AppSettingGroup>} [$$source = {}] - The source object to create the AppSettingGroup.
|
||||
*/
|
||||
constructor($$source = {}) {
|
||||
if (!("category" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["category"] = "";
|
||||
}
|
||||
if (!("label" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["label"] = "";
|
||||
}
|
||||
if (!("description" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["description"] = "";
|
||||
}
|
||||
if (!("items" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {AppSettingDefinition[]}
|
||||
*/
|
||||
this["items"] = [];
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new AppSettingGroup instance from a string or object.
|
||||
* @param {any} [$$source = {}]
|
||||
* @returns {AppSettingGroup}
|
||||
*/
|
||||
static createFrom($$source = {}) {
|
||||
const $$createField3_0 = $$createType3;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("items" in $$parsedSource) {
|
||||
$$parsedSource["items"] = $$createField3_0($$parsedSource["items"]);
|
||||
}
|
||||
return new AppSettingGroup(/** @type {Partial<AppSettingGroup>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
export class AppSettingOption {
|
||||
/**
|
||||
* Creates a new AppSettingOption instance.
|
||||
* @param {Partial<AppSettingOption>} [$$source = {}] - The source object to create the AppSettingOption.
|
||||
*/
|
||||
constructor($$source = {}) {
|
||||
if (!("value" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["value"] = "";
|
||||
}
|
||||
if (!("label" in $$source)) {
|
||||
/**
|
||||
* @member
|
||||
* @type {string}
|
||||
*/
|
||||
this["label"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new AppSettingOption instance from a string or object.
|
||||
* @param {any} [$$source = {}]
|
||||
* @returns {AppSettingOption}
|
||||
*/
|
||||
static createFrom($$source = {}) {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new AppSettingOption(/** @type {Partial<AppSettingOption>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
export class AuthProviderOption {
|
||||
/**
|
||||
* Creates a new AuthProviderOption instance.
|
||||
@@ -176,3 +352,9 @@ export class Hotkey {
|
||||
return new Hotkey(/** @type {Partial<Hotkey>} */($$parsedSource));
|
||||
}
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = AppSettingOption.createFrom;
|
||||
const $$createType1 = $Create.Array($$createType0);
|
||||
const $$createType2 = AppSettingDefinition.createFrom;
|
||||
const $$createType3 = $Create.Array($$createType2);
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
// @ts-ignore: Unused imports
|
||||
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as models$0 from "../models/models.js";
|
||||
|
||||
/**
|
||||
* 根据key获取配置项
|
||||
* @param {string} key
|
||||
@@ -25,6 +29,18 @@ export function GetLanguage() {
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<models$0.AppSettingGroup[]> & { cancel(): void }}
|
||||
*/
|
||||
export function GetSettingsSchema() {
|
||||
let $resultPromise = /** @type {any} */($Call.ByID(2109450092));
|
||||
let $typingPromise = /** @type {any} */($resultPromise.then(($result) => {
|
||||
return $$createType1($result);
|
||||
}));
|
||||
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
||||
return $typingPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置或更新配置项
|
||||
* @param {string} key
|
||||
@@ -45,3 +61,7 @@ export function SetLanguage(lang) {
|
||||
let $resultPromise = /** @type {any} */($Call.ByID(538150432, lang));
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = models$0.AppSettingGroup.createFrom;
|
||||
const $$createType1 = $Create.Array($$createType0);
|
||||
|
||||
Reference in New Issue
Block a user