node-karin 1.3.4 → 1.3.6-pr.260.041eab9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.d.ts +1466 -817
- package/dist/index.js +485 -925
- package/package.json +1 -1
- package/dist/web/assets/favicon-BoqZd694.ico +0 -0
- package/dist/web/assets/index-Bpwek5mg.css +0 -7
- package/dist/web/assets/index-Bt2E67aR.js +0 -1
- package/dist/web/assets/index-fw2lmBGj.js +0 -437
- package/dist/web/assets/index-pxwQwvI8.js +0 -1
- package/dist/web/grid.svg +0 -6
- package/dist/web/index.html +0 -24
- package/dist/web/karin.png +0 -0
package/dist/index.js
CHANGED
|
@@ -10020,6 +10020,7 @@ var init_sandbox = __esm({
|
|
|
10020
10020
|
// src/server/api/plugins/config.ts
|
|
10021
10021
|
import fs21 from "node:fs";
|
|
10022
10022
|
import path15 from "node:path";
|
|
10023
|
+
import util3 from "node:util";
|
|
10023
10024
|
import { pathToFileURL } from "node:url";
|
|
10024
10025
|
var WEB_CONFIG_NAME, getConfigPath, loadConfig, getConfig, saveConfig, isConfigExist;
|
|
10025
10026
|
var init_config3 = __esm({
|
|
@@ -10067,7 +10068,9 @@ var init_config3 = __esm({
|
|
|
10067
10068
|
}
|
|
10068
10069
|
const list2 = [];
|
|
10069
10070
|
const { components: components2 } = await loadConfig(configPath2);
|
|
10070
|
-
components2()
|
|
10071
|
+
let result = components2();
|
|
10072
|
+
result = util3.types.isPromise(result) ? await result : result;
|
|
10073
|
+
result.forEach((item) => {
|
|
10071
10074
|
if (typeof (item == null ? void 0 : item.toJSON) === "function") {
|
|
10072
10075
|
list2.push(item.toJSON());
|
|
10073
10076
|
} else {
|
|
@@ -10119,6 +10122,47 @@ var init_admin2 = __esm({
|
|
|
10119
10122
|
}
|
|
10120
10123
|
});
|
|
10121
10124
|
|
|
10125
|
+
// src/server/api/plugins/cache.ts
|
|
10126
|
+
var CACHE_KEY, CACHE_EXPIRE, getPluginListCache, setPluginListCache, deletePluginListCache, paginatePlugins;
|
|
10127
|
+
var init_cache2 = __esm({
|
|
10128
|
+
"src/server/api/plugins/cache.ts"() {
|
|
10129
|
+
"use strict";
|
|
10130
|
+
init_esm_shims();
|
|
10131
|
+
init_index();
|
|
10132
|
+
CACHE_KEY = "karin:web:plugin:list";
|
|
10133
|
+
CACHE_EXPIRE = 300;
|
|
10134
|
+
getPluginListCache = async () => {
|
|
10135
|
+
try {
|
|
10136
|
+
const cached = await redis2.get(CACHE_KEY);
|
|
10137
|
+
if (!cached) return null;
|
|
10138
|
+
return JSON.parse(cached);
|
|
10139
|
+
} catch (error) {
|
|
10140
|
+
logger.error("\u83B7\u53D6\u63D2\u4EF6\u5217\u8868\u7F13\u5B58\u5931\u8D25:", error);
|
|
10141
|
+
return null;
|
|
10142
|
+
}
|
|
10143
|
+
};
|
|
10144
|
+
setPluginListCache = async (plugins) => {
|
|
10145
|
+
try {
|
|
10146
|
+
await redis2.setEx(CACHE_KEY, CACHE_EXPIRE, JSON.stringify(plugins));
|
|
10147
|
+
} catch (error) {
|
|
10148
|
+
logger.error("\u8BBE\u7F6E\u63D2\u4EF6\u5217\u8868\u7F13\u5B58\u5931\u8D25:", error);
|
|
10149
|
+
}
|
|
10150
|
+
};
|
|
10151
|
+
deletePluginListCache = async () => {
|
|
10152
|
+
try {
|
|
10153
|
+
await redis2.del(CACHE_KEY);
|
|
10154
|
+
} catch (error) {
|
|
10155
|
+
logger.error("\u5220\u9664\u63D2\u4EF6\u5217\u8868\u7F13\u5B58\u5931\u8D25:", error);
|
|
10156
|
+
}
|
|
10157
|
+
};
|
|
10158
|
+
paginatePlugins = (plugins, page, pageSize) => {
|
|
10159
|
+
const start3 = (page - 1) * pageSize;
|
|
10160
|
+
const end = start3 + pageSize;
|
|
10161
|
+
return plugins.slice(start3, end);
|
|
10162
|
+
};
|
|
10163
|
+
}
|
|
10164
|
+
});
|
|
10165
|
+
|
|
10122
10166
|
// src/server/api/plugins/install.ts
|
|
10123
10167
|
import { spawn } from "child_process";
|
|
10124
10168
|
import path16 from "path";
|
|
@@ -10218,6 +10262,7 @@ async function installPluginTask(task2, url) {
|
|
|
10218
10262
|
task2.logs.push("-------------------");
|
|
10219
10263
|
task2.logs.push("\u{1F389} \u5B89\u88C5\u5B8C\u6210!");
|
|
10220
10264
|
task2.status = "completed";
|
|
10265
|
+
await deletePluginListCache();
|
|
10221
10266
|
} catch (error) {
|
|
10222
10267
|
task2.status = "failed";
|
|
10223
10268
|
task2.error = error.message;
|
|
@@ -10258,6 +10303,7 @@ async function uninstallPluginTask(task2) {
|
|
|
10258
10303
|
task2.logs.push("\u{1F389} \u5378\u8F7D\u5B8C\u6210!");
|
|
10259
10304
|
task2.logs.push("\u26A0\uFE0F \u5EFA\u8BAE\u91CD\u542F Bot \u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
|
|
10260
10305
|
task2.status = "completed";
|
|
10306
|
+
await deletePluginListCache();
|
|
10261
10307
|
} catch (error) {
|
|
10262
10308
|
task2.status = "failed";
|
|
10263
10309
|
task2.error = error.message;
|
|
@@ -10281,6 +10327,7 @@ var init_install = __esm({
|
|
|
10281
10327
|
init_esm_shims();
|
|
10282
10328
|
init_router();
|
|
10283
10329
|
init_response();
|
|
10330
|
+
init_cache2();
|
|
10284
10331
|
taskQueue = /* @__PURE__ */ new Map();
|
|
10285
10332
|
installPlugin = async (req, res) => {
|
|
10286
10333
|
try {
|
|
@@ -11013,7 +11060,7 @@ var init_info2 = __esm({
|
|
|
11013
11060
|
|
|
11014
11061
|
// src/server/api/plugins/index.ts
|
|
11015
11062
|
import path18 from "node:path";
|
|
11016
|
-
var getOnlinePluginList, str, getPluginListRouter, getPluginApps, checkNodeKarinUpdate, getUpdatablePlugins, batchUpdatePlugins;
|
|
11063
|
+
var getFullPluginList, getOnlinePluginList, str, getPluginListRouter, getPluginApps, checkNodeKarinUpdate, getUpdatablePlugins, batchUpdatePlugins;
|
|
11017
11064
|
var init_plugins = __esm({
|
|
11018
11065
|
"src/server/api/plugins/index.ts"() {
|
|
11019
11066
|
"use strict";
|
|
@@ -11029,112 +11076,131 @@ var init_plugins = __esm({
|
|
|
11029
11076
|
init_response();
|
|
11030
11077
|
init_update();
|
|
11031
11078
|
init_info2();
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
|
|
11042
|
-
|
|
11043
|
-
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11078
|
-
|
|
11079
|
-
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
|
|
11083
|
-
pluginMap.set(info.name, {
|
|
11084
|
-
...info,
|
|
11085
|
-
installed: existingPlugin.installed,
|
|
11086
|
-
version: existingPlugin.installed ? existingPlugin.version : info.version,
|
|
11087
|
-
latestVersion: info.version,
|
|
11088
|
-
downloads: existingPlugin.downloads,
|
|
11089
|
-
size: existingPlugin.size,
|
|
11090
|
-
updated: existingPlugin.updated
|
|
11091
|
-
});
|
|
11092
|
-
return;
|
|
11093
|
-
}
|
|
11079
|
+
init_cache2();
|
|
11080
|
+
getFullPluginList = async () => {
|
|
11081
|
+
const [list2, createUrl, localPlugins] = await Promise.all([
|
|
11082
|
+
fetchPluginList(),
|
|
11083
|
+
testGithub(),
|
|
11084
|
+
getPlugins("all", true, true)
|
|
11085
|
+
]);
|
|
11086
|
+
const pluginMap = /* @__PURE__ */ new Map();
|
|
11087
|
+
await Promise.all(localPlugins.map(async (plugin) => {
|
|
11088
|
+
const { version, description, homepage, time: time2, license, author } = (plugin == null ? void 0 : plugin.pkgData) || {};
|
|
11089
|
+
pluginMap.set(plugin.name, {
|
|
11090
|
+
installed: true,
|
|
11091
|
+
version: str(version),
|
|
11092
|
+
type: plugin.type,
|
|
11093
|
+
name: plugin.name,
|
|
11094
|
+
description: str(description),
|
|
11095
|
+
home: str(homepage),
|
|
11096
|
+
time: str(time2),
|
|
11097
|
+
license: {
|
|
11098
|
+
name: str(license),
|
|
11099
|
+
url: ""
|
|
11100
|
+
},
|
|
11101
|
+
author: [
|
|
11102
|
+
{
|
|
11103
|
+
name: str(author),
|
|
11104
|
+
home: "",
|
|
11105
|
+
avatar: ""
|
|
11106
|
+
}
|
|
11107
|
+
],
|
|
11108
|
+
repo: [],
|
|
11109
|
+
downloads: 0,
|
|
11110
|
+
size: 0,
|
|
11111
|
+
updated: ""
|
|
11112
|
+
});
|
|
11113
|
+
}));
|
|
11114
|
+
await Promise.all(list2.plugins.map(async (plugin) => {
|
|
11115
|
+
let info = null;
|
|
11116
|
+
switch (plugin.type) {
|
|
11117
|
+
case "npm":
|
|
11118
|
+
info = await handleNpmPlugin(plugin);
|
|
11119
|
+
break;
|
|
11120
|
+
case "git":
|
|
11121
|
+
info = await handleGitPlugin(plugin, createUrl);
|
|
11122
|
+
break;
|
|
11123
|
+
case "app":
|
|
11124
|
+
info = await handleAppPlugin(plugin);
|
|
11125
|
+
break;
|
|
11126
|
+
}
|
|
11127
|
+
if (!info) return;
|
|
11128
|
+
const existingPlugin = pluginMap.get(info.name);
|
|
11129
|
+
if (existingPlugin) {
|
|
11094
11130
|
pluginMap.set(info.name, {
|
|
11095
11131
|
...info,
|
|
11132
|
+
installed: existingPlugin.installed,
|
|
11133
|
+
version: existingPlugin.installed ? existingPlugin.version : info.version,
|
|
11096
11134
|
latestVersion: info.version,
|
|
11097
|
-
downloads:
|
|
11098
|
-
size:
|
|
11099
|
-
updated:
|
|
11135
|
+
downloads: existingPlugin.downloads,
|
|
11136
|
+
size: existingPlugin.size,
|
|
11137
|
+
updated: existingPlugin.updated
|
|
11100
11138
|
});
|
|
11101
|
-
|
|
11102
|
-
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
11139
|
+
return;
|
|
11140
|
+
}
|
|
11141
|
+
pluginMap.set(info.name, {
|
|
11142
|
+
...info,
|
|
11143
|
+
latestVersion: info.version,
|
|
11144
|
+
downloads: 0,
|
|
11145
|
+
size: 0,
|
|
11146
|
+
updated: ""
|
|
11147
|
+
});
|
|
11148
|
+
}));
|
|
11149
|
+
await Promise.all(
|
|
11150
|
+
Array.from(pluginMap.values()).map(async (plugin) => {
|
|
11151
|
+
await Promise.all([
|
|
11152
|
+
// 并发处理作者头像
|
|
11153
|
+
Promise.all(
|
|
11154
|
+
plugin.author.map(async (item) => {
|
|
11155
|
+
item.avatar = getAuthorAvatar(item.home, item.avatar);
|
|
11156
|
+
})
|
|
11157
|
+
),
|
|
11158
|
+
// 并发获取插件信息
|
|
11159
|
+
(async () => {
|
|
11160
|
+
var _a;
|
|
11161
|
+
if (plugin.type === "npm") {
|
|
11162
|
+
const info = await getNpmInfo2(plugin.name);
|
|
11163
|
+
plugin.downloads = info.downloads;
|
|
11164
|
+
plugin.size = info.size;
|
|
11165
|
+
plugin.updated = info.updated;
|
|
11166
|
+
} else if (plugin.type === "git" && !plugin.installed) {
|
|
11167
|
+
const repoUrl = ((_a = plugin.repo[0]) == null ? void 0 : _a.url) || "";
|
|
11168
|
+
if (repoUrl) {
|
|
11169
|
+
const info = await getGitInfo2(repoUrl);
|
|
11116
11170
|
plugin.downloads = info.downloads;
|
|
11117
|
-
plugin.size = info.size;
|
|
11118
11171
|
plugin.updated = info.updated;
|
|
11119
|
-
} else if (plugin.type === "git" && !plugin.installed) {
|
|
11120
|
-
const repoUrl = ((_a = plugin.repo[0]) == null ? void 0 : _a.url) || "";
|
|
11121
|
-
if (repoUrl) {
|
|
11122
|
-
const info = await getGitInfo2(repoUrl);
|
|
11123
|
-
plugin.downloads = info.downloads;
|
|
11124
|
-
plugin.updated = info.updated;
|
|
11125
|
-
}
|
|
11126
11172
|
}
|
|
11127
|
-
}
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
)
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11173
|
+
}
|
|
11174
|
+
})()
|
|
11175
|
+
]);
|
|
11176
|
+
})
|
|
11177
|
+
);
|
|
11178
|
+
const result = Array.from(pluginMap.values());
|
|
11179
|
+
result.sort((a, b) => {
|
|
11180
|
+
if (a.installed && !b.installed) return -1;
|
|
11181
|
+
if (!a.installed && b.installed) return 1;
|
|
11182
|
+
return a.name.localeCompare(b.name);
|
|
11183
|
+
});
|
|
11184
|
+
return result;
|
|
11185
|
+
};
|
|
11186
|
+
getOnlinePluginList = async (req, res) => {
|
|
11187
|
+
try {
|
|
11188
|
+
const { page = 1, pageSize = 16, refresh = false } = req.body;
|
|
11189
|
+
let plugins = null;
|
|
11190
|
+
if (!refresh) {
|
|
11191
|
+
plugins = await getPluginListCache();
|
|
11192
|
+
}
|
|
11193
|
+
if (!plugins) {
|
|
11194
|
+
plugins = await getFullPluginList();
|
|
11195
|
+
await setPluginListCache(plugins);
|
|
11196
|
+
}
|
|
11197
|
+
const paginatedPlugins = paginatePlugins(plugins, page, pageSize);
|
|
11198
|
+
createSuccessResponse(res, {
|
|
11199
|
+
list: paginatedPlugins,
|
|
11200
|
+
total: plugins.length,
|
|
11201
|
+
page,
|
|
11202
|
+
pageSize
|
|
11136
11203
|
});
|
|
11137
|
-
createSuccessResponse(res, result);
|
|
11138
11204
|
} catch (error) {
|
|
11139
11205
|
createServerErrorResponse(res, error.message);
|
|
11140
11206
|
logger.error(error);
|
|
@@ -11587,7 +11653,7 @@ var init_watcher = __esm({
|
|
|
11587
11653
|
import fs25 from "node:fs";
|
|
11588
11654
|
import lodash7 from "lodash";
|
|
11589
11655
|
import path21 from "node:path";
|
|
11590
|
-
import
|
|
11656
|
+
import util4 from "node:util";
|
|
11591
11657
|
import schedule from "node-schedule";
|
|
11592
11658
|
var seq, LoaderPlugin;
|
|
11593
11659
|
var init_loader = __esm({
|
|
@@ -11790,7 +11856,7 @@ var init_loader = __esm({
|
|
|
11790
11856
|
try {
|
|
11791
11857
|
val.log(`[\u5B9A\u65F6\u4EFB\u52A1][${val.name}][${val.cron}]: \u5F00\u59CB\u6267\u884C`);
|
|
11792
11858
|
const result2 = val.fnc();
|
|
11793
|
-
if (
|
|
11859
|
+
if (util4.types.isPromise(result2)) await result2;
|
|
11794
11860
|
val.log(`[\u5B9A\u65F6\u4EFB\u52A1][${val.name}][${val.cron}]: \u6267\u884C\u5B8C\u6210`);
|
|
11795
11861
|
} catch (error) {
|
|
11796
11862
|
errorHandler.taskStart(val.name, val.name, error);
|
|
@@ -12822,7 +12888,7 @@ var init_db2 = __esm({
|
|
|
12822
12888
|
|
|
12823
12889
|
// src/adapter/render/admin/cache.ts
|
|
12824
12890
|
var index2, cache10, registerRender, unregisterRender, getRender, callRender, getRenderCount, getRenderList, renderHtml, renderMultiHtml, RenderCache, render2, Renderer;
|
|
12825
|
-
var
|
|
12891
|
+
var init_cache3 = __esm({
|
|
12826
12892
|
"src/adapter/render/admin/cache.ts"() {
|
|
12827
12893
|
"use strict";
|
|
12828
12894
|
init_esm_shims();
|
|
@@ -12955,7 +13021,7 @@ var init_http = __esm({
|
|
|
12955
13021
|
"src/adapter/render/connect/http.ts"() {
|
|
12956
13022
|
"use strict";
|
|
12957
13023
|
init_esm_shims();
|
|
12958
|
-
|
|
13024
|
+
init_cache3();
|
|
12959
13025
|
init_render();
|
|
12960
13026
|
createHttpRenderClient = () => {
|
|
12961
13027
|
const cfg = render();
|
|
@@ -13098,7 +13164,7 @@ var init_ws2 = __esm({
|
|
|
13098
13164
|
"use strict";
|
|
13099
13165
|
init_esm_shims();
|
|
13100
13166
|
init_template();
|
|
13101
|
-
|
|
13167
|
+
init_cache3();
|
|
13102
13168
|
init_static();
|
|
13103
13169
|
WebSocketRender = class {
|
|
13104
13170
|
/** websocket实例 */
|
|
@@ -13192,8 +13258,7 @@ var init_ws2 = __esm({
|
|
|
13192
13258
|
}
|
|
13193
13259
|
reject(new Error(`[sendApi] \u8BF7\u6C42\u9519\u8BEF:
|
|
13194
13260
|
action: ${action}
|
|
13195
|
-
params: ${str2}
|
|
13196
|
-
error: ${data2}}`));
|
|
13261
|
+
params: ${str2}`, { cause: data2 }));
|
|
13197
13262
|
});
|
|
13198
13263
|
});
|
|
13199
13264
|
}
|
|
@@ -13513,7 +13578,7 @@ var init_import = __esm({
|
|
|
13513
13578
|
});
|
|
13514
13579
|
|
|
13515
13580
|
// src/service/handler.ts
|
|
13516
|
-
import
|
|
13581
|
+
import util5 from "node:util";
|
|
13517
13582
|
var call, has, handler;
|
|
13518
13583
|
var init_handler2 = __esm({
|
|
13519
13584
|
"src/service/handler.ts"() {
|
|
@@ -13529,7 +13594,7 @@ var init_handler2 = __esm({
|
|
|
13529
13594
|
done = false;
|
|
13530
13595
|
};
|
|
13531
13596
|
const res = info.fnc(args, next);
|
|
13532
|
-
result =
|
|
13597
|
+
result = util5.types.isPromise(res) ? await res : res;
|
|
13533
13598
|
if (done) {
|
|
13534
13599
|
logger.mark(`[Handler][Done]: [${info.pkg.name}][${info.file.method}][${key}]`);
|
|
13535
13600
|
return result;
|
|
@@ -16182,7 +16247,7 @@ var init_render3 = __esm({
|
|
|
16182
16247
|
"src/core/karin/render.ts"() {
|
|
16183
16248
|
"use strict";
|
|
16184
16249
|
init_esm_shims();
|
|
16185
|
-
|
|
16250
|
+
init_cache3();
|
|
16186
16251
|
render3 = (options, multiPageOrId, id) => {
|
|
16187
16252
|
if (options === "opt") {
|
|
16188
16253
|
return callRender(multiPageOrId, id);
|
|
@@ -16546,684 +16611,248 @@ var init_types2 = __esm({
|
|
|
16546
16611
|
}
|
|
16547
16612
|
});
|
|
16548
16613
|
|
|
16549
|
-
// src/components/base.ts
|
|
16550
|
-
var Component;
|
|
16551
|
-
var init_base5 = __esm({
|
|
16552
|
-
"src/components/base.ts"() {
|
|
16553
|
-
"use strict";
|
|
16554
|
-
init_esm_shims();
|
|
16555
|
-
Component = class {
|
|
16556
|
-
_config;
|
|
16557
|
-
_componentType;
|
|
16558
|
-
constructor(componentType) {
|
|
16559
|
-
this._componentType = componentType;
|
|
16560
|
-
}
|
|
16561
|
-
/**
|
|
16562
|
-
* 转换为JSON字符串
|
|
16563
|
-
*/
|
|
16564
|
-
toString() {
|
|
16565
|
-
return JSON.stringify(this.toJSON());
|
|
16566
|
-
}
|
|
16567
|
-
/**
|
|
16568
|
-
* 转换为JSON对象
|
|
16569
|
-
*/
|
|
16570
|
-
toJSON() {
|
|
16571
|
-
return { componentType: this._componentType, ...this._config };
|
|
16572
|
-
}
|
|
16573
|
-
};
|
|
16574
|
-
}
|
|
16575
|
-
});
|
|
16576
|
-
|
|
16577
16614
|
// src/components/accordion.ts
|
|
16578
|
-
var
|
|
16615
|
+
var createAccordion, createAccordionPro, createAccordionItem, accordion, accordionPro, accordionItem;
|
|
16579
16616
|
var init_accordion = __esm({
|
|
16580
16617
|
"src/components/accordion.ts"() {
|
|
16581
16618
|
"use strict";
|
|
16582
16619
|
init_esm_shims();
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
*/
|
|
16594
|
-
title = (title) => {
|
|
16595
|
-
this._config.title = title;
|
|
16596
|
-
return this;
|
|
16597
|
-
};
|
|
16598
|
-
/**
|
|
16599
|
-
* 设置子组件
|
|
16600
|
-
* @param children - 子组件数组
|
|
16601
|
-
*/
|
|
16602
|
-
children = (children) => {
|
|
16603
|
-
const childrens = [];
|
|
16604
|
-
for (const child of children) {
|
|
16605
|
-
if (typeof (child == null ? void 0 : child.toJSON) === "function") {
|
|
16606
|
-
childrens.push(child.toJSON());
|
|
16607
|
-
continue;
|
|
16608
|
-
}
|
|
16609
|
-
if (typeof child === "object" && child !== null) {
|
|
16610
|
-
childrens.push(child);
|
|
16611
|
-
continue;
|
|
16612
|
-
}
|
|
16613
|
-
}
|
|
16614
|
-
this._config.children = childrens;
|
|
16615
|
-
return this;
|
|
16616
|
-
};
|
|
16617
|
-
/**
|
|
16618
|
-
* 设置样式变体
|
|
16619
|
-
* @param variant - 样式类型
|
|
16620
|
-
*/
|
|
16621
|
-
variant = (variant) => {
|
|
16622
|
-
this._config.variant = variant;
|
|
16623
|
-
return this;
|
|
16624
|
-
};
|
|
16625
|
-
/**
|
|
16626
|
-
* 设置选择模式
|
|
16627
|
-
* @param mode - 选择模式
|
|
16628
|
-
* - none: 无
|
|
16629
|
-
* - single: 单选
|
|
16630
|
-
* - multiple: 多选
|
|
16631
|
-
*/
|
|
16632
|
-
selectionMode = (mode) => {
|
|
16633
|
-
this._config.selectionMode = mode;
|
|
16634
|
-
return this;
|
|
16635
|
-
};
|
|
16636
|
-
/**
|
|
16637
|
-
* 设置选择行为
|
|
16638
|
-
* @param behavior - 选择行为
|
|
16639
|
-
* - toggle: 切换
|
|
16640
|
-
* - replace: 替换
|
|
16641
|
-
*/
|
|
16642
|
-
selectionBehavior = (behavior) => {
|
|
16643
|
-
this._config.selectionBehavior = behavior;
|
|
16644
|
-
return this;
|
|
16645
|
-
};
|
|
16646
|
-
/**
|
|
16647
|
-
* 设置是否紧凑模式
|
|
16648
|
-
* @param isCompact - 是否紧凑
|
|
16649
|
-
*/
|
|
16650
|
-
compact = (isCompact = true) => {
|
|
16651
|
-
this._config.isCompact = isCompact;
|
|
16652
|
-
return this;
|
|
16653
|
-
};
|
|
16654
|
-
/**
|
|
16655
|
-
* 设置是否禁用
|
|
16656
|
-
* @param isDisabled - 是否禁用
|
|
16657
|
-
*/
|
|
16658
|
-
disabled = (isDisabled = true) => {
|
|
16659
|
-
this._config.isDisabled = isDisabled;
|
|
16660
|
-
return this;
|
|
16661
|
-
};
|
|
16662
|
-
/**
|
|
16663
|
-
* 设置是否显示分隔线
|
|
16664
|
-
* @param show - 是否显示
|
|
16665
|
-
*/
|
|
16666
|
-
showDivider = (show = true) => {
|
|
16667
|
-
this._config.showDivider = show;
|
|
16668
|
-
return this;
|
|
16669
|
-
};
|
|
16670
|
-
/**
|
|
16671
|
-
* 设置是否隐藏指示器
|
|
16672
|
-
* @param hide - 是否隐藏
|
|
16673
|
-
*/
|
|
16674
|
-
hideIndicator = (hide = true) => {
|
|
16675
|
-
this._config.hideIndicator = hide;
|
|
16676
|
-
return this;
|
|
16677
|
-
};
|
|
16678
|
-
/**
|
|
16679
|
-
* 设置是否禁用动画
|
|
16680
|
-
* @param disable - 是否禁用
|
|
16681
|
-
*/
|
|
16682
|
-
disableAnimation = (disable = true) => {
|
|
16683
|
-
this._config.disableAnimation = disable;
|
|
16684
|
-
return this;
|
|
16685
|
-
};
|
|
16686
|
-
/**
|
|
16687
|
-
* 设置是否禁用指示器动画
|
|
16688
|
-
* @param disable - 是否禁用
|
|
16689
|
-
*/
|
|
16690
|
-
disableIndicatorAnimation = (disable = true) => {
|
|
16691
|
-
this._config.disableIndicatorAnimation = disable;
|
|
16692
|
-
return this;
|
|
16693
|
-
};
|
|
16694
|
-
/**
|
|
16695
|
-
* 设置是否不允许空选择
|
|
16696
|
-
* @param disallow - 是否不允许
|
|
16697
|
-
*/
|
|
16698
|
-
disallowEmptySelection = (disallow = true) => {
|
|
16699
|
-
this._config.disallowEmptySelection = disallow;
|
|
16700
|
-
return this;
|
|
16701
|
-
};
|
|
16702
|
-
/**
|
|
16703
|
-
* 设置是否保持内容挂载
|
|
16704
|
-
* @param keep - 是否保持
|
|
16705
|
-
*/
|
|
16706
|
-
keepContentMounted = (keep = true) => {
|
|
16707
|
-
this._config.keepContentMounted = keep;
|
|
16708
|
-
return this;
|
|
16709
|
-
};
|
|
16710
|
-
/**
|
|
16711
|
-
* 设置是否全宽
|
|
16712
|
-
* @param full - 是否全宽
|
|
16713
|
-
*/
|
|
16714
|
-
fullWidth = (full = true) => {
|
|
16715
|
-
this._config.fullWidth = full;
|
|
16716
|
-
return this;
|
|
16717
|
-
};
|
|
16718
|
-
/**
|
|
16719
|
-
* 设置禁用的键
|
|
16720
|
-
* @param keys - 禁用的键数组
|
|
16721
|
-
*/
|
|
16722
|
-
disabledKeys = (keys) => {
|
|
16723
|
-
this._config.disabledKeys = keys;
|
|
16724
|
-
return this;
|
|
16725
|
-
};
|
|
16726
|
-
/**
|
|
16727
|
-
* 设置选中项
|
|
16728
|
-
* @param keys - 选中的键数组
|
|
16729
|
-
*/
|
|
16730
|
-
selectedKeys = (keys) => {
|
|
16731
|
-
this._config.selectedKeys = keys;
|
|
16732
|
-
return this;
|
|
16733
|
-
};
|
|
16734
|
-
/**
|
|
16735
|
-
* 设置默认选中项
|
|
16736
|
-
* @param keys - 默认选中的键数组
|
|
16737
|
-
*/
|
|
16738
|
-
defaultSelectedKeys = (keys) => {
|
|
16739
|
-
this._config.defaultSelectedKeys = keys;
|
|
16740
|
-
return this;
|
|
16741
|
-
};
|
|
16742
|
-
/**
|
|
16743
|
-
* 自定义配置
|
|
16744
|
-
* @param options - 配置选项
|
|
16745
|
-
*/
|
|
16746
|
-
options = (options) => {
|
|
16747
|
-
this._config = { ...this._config, ...options };
|
|
16748
|
-
return this;
|
|
16749
|
-
};
|
|
16750
|
-
/**
|
|
16751
|
-
* 转换为JSON对象
|
|
16752
|
-
* @description 手风琴比较特殊 需要子组件也进行转换
|
|
16753
|
-
*/
|
|
16754
|
-
toJSON = () => {
|
|
16755
|
-
if (!this._config.children) this._config.children = [];
|
|
16756
|
-
return this._config;
|
|
16757
|
-
};
|
|
16758
|
-
};
|
|
16759
|
-
Accordion = class extends AccordionBase {
|
|
16760
|
-
constructor(key) {
|
|
16761
|
-
super(key, "accordion");
|
|
16762
|
-
}
|
|
16763
|
-
};
|
|
16764
|
-
AccordionPro = class extends AccordionBase {
|
|
16765
|
-
constructor(key) {
|
|
16766
|
-
super(key, "accordion-pro");
|
|
16767
|
-
}
|
|
16768
|
-
/**
|
|
16769
|
-
* 设置渲染数据
|
|
16770
|
-
* @param data - 渲染数据
|
|
16771
|
-
*/
|
|
16772
|
-
data = (data) => {
|
|
16773
|
-
this._config.data = data;
|
|
16774
|
-
return this;
|
|
16620
|
+
createAccordion = (key, config2) => ({
|
|
16621
|
+
key,
|
|
16622
|
+
...config2,
|
|
16623
|
+
componentType: "accordion"
|
|
16624
|
+
});
|
|
16625
|
+
createAccordionPro = (key, config2) => {
|
|
16626
|
+
const result = {
|
|
16627
|
+
key,
|
|
16628
|
+
...config2,
|
|
16629
|
+
componentType: "accordion-pro"
|
|
16775
16630
|
};
|
|
16631
|
+
console.log("createAccordionPro:", JSON.stringify(result));
|
|
16632
|
+
return result;
|
|
16776
16633
|
};
|
|
16777
|
-
|
|
16778
|
-
|
|
16779
|
-
|
|
16780
|
-
|
|
16781
|
-
|
|
16782
|
-
}
|
|
16783
|
-
/**
|
|
16784
|
-
* 设置子组件
|
|
16785
|
-
* @param children - 子组件数组
|
|
16786
|
-
*/
|
|
16787
|
-
children = (children) => {
|
|
16788
|
-
if (!Array.isArray(children)) children = [children];
|
|
16789
|
-
const childrens = [];
|
|
16790
|
-
children.forEach((child) => {
|
|
16791
|
-
if (typeof (child == null ? void 0 : child.toJSON) === "function") {
|
|
16792
|
-
childrens.push(child.toJSON());
|
|
16793
|
-
return;
|
|
16794
|
-
}
|
|
16795
|
-
if (typeof child === "object" && child !== null) {
|
|
16796
|
-
childrens.push(child);
|
|
16797
|
-
}
|
|
16798
|
-
});
|
|
16799
|
-
this._config.children = childrens;
|
|
16800
|
-
return this;
|
|
16801
|
-
};
|
|
16802
|
-
/**
|
|
16803
|
-
* 设置标题
|
|
16804
|
-
* @param title - 标题文本
|
|
16805
|
-
*/
|
|
16806
|
-
title = (title) => {
|
|
16807
|
-
this._config.title = title;
|
|
16808
|
-
return this;
|
|
16809
|
-
};
|
|
16810
|
-
/**
|
|
16811
|
-
* 设置副标题
|
|
16812
|
-
* @param subtitle - 副标题文本
|
|
16813
|
-
*/
|
|
16814
|
-
subtitle = (subtitle) => {
|
|
16815
|
-
this._config.subtitle = subtitle;
|
|
16816
|
-
return this;
|
|
16817
|
-
};
|
|
16818
|
-
/**
|
|
16819
|
-
* 设置是否显示指示器
|
|
16820
|
-
* @param hide - 是否隐藏
|
|
16821
|
-
*/
|
|
16822
|
-
hideIndicator = (hide = true) => {
|
|
16823
|
-
this._config.hideIndicator = hide;
|
|
16824
|
-
return this;
|
|
16825
|
-
};
|
|
16826
|
-
// /**
|
|
16827
|
-
// * 设置开始内容
|
|
16828
|
-
// * @param content - 开始内容组件
|
|
16829
|
-
// */
|
|
16830
|
-
// startContent = (content: Component) => {
|
|
16831
|
-
// this.config.startContent = content
|
|
16832
|
-
// return this
|
|
16833
|
-
// }
|
|
16834
|
-
// /**
|
|
16835
|
-
// * 设置结束内容
|
|
16836
|
-
// * @param content - 结束内容组件
|
|
16837
|
-
// */
|
|
16838
|
-
// endContent = (content: Component) => {
|
|
16839
|
-
// this.config.endContent = content
|
|
16840
|
-
// return this
|
|
16841
|
-
// }
|
|
16842
|
-
/**
|
|
16843
|
-
* 设置是否紧凑模式
|
|
16844
|
-
* @param isCompact - 是否紧凑
|
|
16845
|
-
*/
|
|
16846
|
-
compact = (isCompact = true) => {
|
|
16847
|
-
this._config.isCompact = isCompact;
|
|
16848
|
-
return this;
|
|
16849
|
-
};
|
|
16850
|
-
/**
|
|
16851
|
-
* 设置是否禁用
|
|
16852
|
-
* @param isDisabled - 是否禁用
|
|
16853
|
-
*/
|
|
16854
|
-
disabled = (isDisabled = true) => {
|
|
16855
|
-
this._config.isDisabled = isDisabled;
|
|
16856
|
-
return this;
|
|
16857
|
-
};
|
|
16858
|
-
/**
|
|
16859
|
-
* 设置是否保持内容挂载
|
|
16860
|
-
* @param keep - 是否保持
|
|
16861
|
-
*/
|
|
16862
|
-
keepContentMounted = (keep = true) => {
|
|
16863
|
-
this._config.keepContentMounted = keep;
|
|
16864
|
-
return this;
|
|
16865
|
-
};
|
|
16866
|
-
/**
|
|
16867
|
-
* 设置是否禁用动画
|
|
16868
|
-
* @param disable - 是否禁用
|
|
16869
|
-
*/
|
|
16870
|
-
disableAnimation = (disable = true) => {
|
|
16871
|
-
this._config.disableAnimation = disable;
|
|
16872
|
-
return this;
|
|
16873
|
-
};
|
|
16874
|
-
/**
|
|
16875
|
-
* 设置是否禁用指示器动画
|
|
16876
|
-
* @param disable - 是否禁用
|
|
16877
|
-
*/
|
|
16878
|
-
disableIndicatorAnimation = (disable = true) => {
|
|
16879
|
-
this._config.disableIndicatorAnimation = disable;
|
|
16880
|
-
return this;
|
|
16881
|
-
};
|
|
16882
|
-
// /**
|
|
16883
|
-
// * 设置标题组件
|
|
16884
|
-
// * @param component - 标题组件
|
|
16885
|
-
// */
|
|
16886
|
-
// headingComponent = (component: string) => {
|
|
16887
|
-
// this.config.headingComponent = component
|
|
16888
|
-
// return this
|
|
16889
|
-
// }
|
|
16890
|
-
/**
|
|
16891
|
-
* 自定义配置
|
|
16892
|
-
* @param options - 配置选项
|
|
16893
|
-
*/
|
|
16894
|
-
options = (options) => {
|
|
16895
|
-
this._config = { ...this._config, ...options };
|
|
16896
|
-
return this;
|
|
16897
|
-
};
|
|
16898
|
-
/**
|
|
16899
|
-
* 转换为JSON对象
|
|
16900
|
-
* @description 手风琴比较特殊 需要子组件也进行转换
|
|
16901
|
-
*/
|
|
16902
|
-
toJSON = () => {
|
|
16903
|
-
return this._config;
|
|
16634
|
+
createAccordionItem = (key, config2) => {
|
|
16635
|
+
const result = {
|
|
16636
|
+
key,
|
|
16637
|
+
...config2,
|
|
16638
|
+
componentType: "accordion-item"
|
|
16904
16639
|
};
|
|
16640
|
+
console.log("createAccordionItem:", JSON.stringify(result));
|
|
16641
|
+
return result;
|
|
16905
16642
|
};
|
|
16906
16643
|
accordion = {
|
|
16907
16644
|
/**
|
|
16908
16645
|
* 创建基础手风琴组件
|
|
16909
|
-
* @param key
|
|
16646
|
+
* @param key 唯一标识符
|
|
16647
|
+
* @param options 手风琴配置
|
|
16910
16648
|
*/
|
|
16911
|
-
create: (key) =>
|
|
16649
|
+
create: (key, options) => createAccordion(key, options),
|
|
16912
16650
|
/**
|
|
16913
16651
|
* 创建默认配置的手风琴组件
|
|
16914
|
-
* @param key
|
|
16915
|
-
*/
|
|
16916
|
-
default: (key) => {
|
|
16917
|
-
return new Accordion(key).title("\u6298\u53E0\u9762\u677F").variant("bordered").selectionMode("single").selectionBehavior("toggle").showDivider().fullWidth();
|
|
16918
|
-
},
|
|
16919
|
-
/**
|
|
16920
|
-
* 使用自定义配置创建手风琴组件
|
|
16921
|
-
* @param key - 唯一标识符
|
|
16922
|
-
* @param options - 配置选项
|
|
16652
|
+
* @param key 唯一标识符
|
|
16923
16653
|
*/
|
|
16924
|
-
|
|
16654
|
+
default: (key) => createAccordion(key, {
|
|
16655
|
+
title: "\u6298\u53E0\u9762\u677F",
|
|
16656
|
+
variant: "bordered",
|
|
16657
|
+
selectionMode: "single",
|
|
16658
|
+
selectionBehavior: "toggle",
|
|
16659
|
+
showDivider: true,
|
|
16660
|
+
fullWidth: true
|
|
16661
|
+
}),
|
|
16925
16662
|
/**
|
|
16926
16663
|
* 创建手风琴子项
|
|
16927
|
-
* @param key
|
|
16664
|
+
* @param key 唯一标识符
|
|
16665
|
+
* @param options 手风琴子项配置
|
|
16928
16666
|
*/
|
|
16929
|
-
createItem: (key) =>
|
|
16667
|
+
createItem: (key, options) => createAccordionItem(key, options)
|
|
16930
16668
|
};
|
|
16931
16669
|
accordionPro = {
|
|
16932
16670
|
/**
|
|
16933
|
-
*
|
|
16934
|
-
* @param key
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
/**
|
|
16938
|
-
* 创建默认配置的手风琴组件
|
|
16939
|
-
* @param key - 唯一标识符
|
|
16940
|
-
*/
|
|
16941
|
-
default: (key) => {
|
|
16942
|
-
return new AccordionPro(key).title("\u6298\u53E0\u9762\u677FPro").variant("bordered").selectionMode("single").selectionBehavior("toggle").showDivider().fullWidth();
|
|
16943
|
-
},
|
|
16944
|
-
/**
|
|
16945
|
-
* 使用自定义配置创建手风琴组件
|
|
16946
|
-
* @param key - 唯一标识符
|
|
16947
|
-
* @param options - 配置选项
|
|
16671
|
+
* 创建基础手风琴Pro组件
|
|
16672
|
+
* @param key 唯一标识符
|
|
16673
|
+
* @param data 渲染数据
|
|
16674
|
+
* @param options 手风琴Pro配置
|
|
16948
16675
|
*/
|
|
16949
|
-
|
|
16676
|
+
create: (key, data, options) => createAccordionPro(key, {
|
|
16677
|
+
...options,
|
|
16678
|
+
data
|
|
16679
|
+
})
|
|
16950
16680
|
};
|
|
16951
16681
|
accordionItem = {
|
|
16952
16682
|
/**
|
|
16953
16683
|
* 创建手风琴子项
|
|
16954
|
-
* @param key
|
|
16684
|
+
* @param key 唯一标识符
|
|
16685
|
+
* @param options 手风琴子项配置
|
|
16955
16686
|
*/
|
|
16956
|
-
create: (key) =>
|
|
16687
|
+
create: (key, options) => createAccordionItem(key, options),
|
|
16688
|
+
/**
|
|
16689
|
+
* 创建默认配置的手风琴子项
|
|
16690
|
+
* @param key 唯一标识符
|
|
16691
|
+
* @param title 标题
|
|
16692
|
+
* @param children 子组件
|
|
16693
|
+
*/
|
|
16694
|
+
default: (key, title, children) => createAccordionItem(key, {
|
|
16695
|
+
title,
|
|
16696
|
+
children,
|
|
16697
|
+
isCompact: false,
|
|
16698
|
+
hideIndicator: false,
|
|
16699
|
+
disableAnimation: false,
|
|
16700
|
+
disableIndicatorAnimation: false
|
|
16701
|
+
})
|
|
16957
16702
|
};
|
|
16958
16703
|
}
|
|
16959
16704
|
});
|
|
16960
16705
|
|
|
16961
|
-
// src/types/components/types.ts
|
|
16962
|
-
var init_types3 = __esm({
|
|
16963
|
-
"src/types/components/types.ts"() {
|
|
16964
|
-
"use strict";
|
|
16965
|
-
init_esm_shims();
|
|
16966
|
-
}
|
|
16967
|
-
});
|
|
16968
|
-
|
|
16969
|
-
// src/types/components/base.ts
|
|
16970
|
-
var init_base6 = __esm({
|
|
16971
|
-
"src/types/components/base.ts"() {
|
|
16972
|
-
"use strict";
|
|
16973
|
-
init_esm_shims();
|
|
16974
|
-
}
|
|
16975
|
-
});
|
|
16976
|
-
|
|
16977
|
-
// src/types/components/input.ts
|
|
16978
|
-
var init_input = __esm({
|
|
16979
|
-
"src/types/components/input.ts"() {
|
|
16980
|
-
"use strict";
|
|
16981
|
-
init_esm_shims();
|
|
16982
|
-
}
|
|
16983
|
-
});
|
|
16984
|
-
|
|
16985
|
-
// src/types/components/divider.ts
|
|
16986
|
-
var init_divider = __esm({
|
|
16987
|
-
"src/types/components/divider.ts"() {
|
|
16988
|
-
"use strict";
|
|
16989
|
-
init_esm_shims();
|
|
16990
|
-
}
|
|
16991
|
-
});
|
|
16992
|
-
|
|
16993
|
-
// src/types/components/switch.ts
|
|
16994
|
-
var init_switch = __esm({
|
|
16995
|
-
"src/types/components/switch.ts"() {
|
|
16996
|
-
"use strict";
|
|
16997
|
-
init_esm_shims();
|
|
16998
|
-
}
|
|
16999
|
-
});
|
|
17000
|
-
|
|
17001
|
-
// src/types/components/accordion.ts
|
|
17002
|
-
var init_accordion2 = __esm({
|
|
17003
|
-
"src/types/components/accordion.ts"() {
|
|
17004
|
-
"use strict";
|
|
17005
|
-
init_esm_shims();
|
|
17006
|
-
}
|
|
17007
|
-
});
|
|
17008
|
-
|
|
17009
|
-
// src/types/components/all.ts
|
|
17010
|
-
var init_all = __esm({
|
|
17011
|
-
"src/types/components/all.ts"() {
|
|
17012
|
-
"use strict";
|
|
17013
|
-
init_esm_shims();
|
|
17014
|
-
}
|
|
17015
|
-
});
|
|
17016
|
-
|
|
17017
|
-
// src/types/components/index.ts
|
|
17018
|
-
var init_components = __esm({
|
|
17019
|
-
"src/types/components/index.ts"() {
|
|
17020
|
-
"use strict";
|
|
17021
|
-
init_esm_shims();
|
|
17022
|
-
init_types3();
|
|
17023
|
-
init_base6();
|
|
17024
|
-
init_input();
|
|
17025
|
-
init_divider();
|
|
17026
|
-
init_switch();
|
|
17027
|
-
init_accordion2();
|
|
17028
|
-
init_all();
|
|
17029
|
-
}
|
|
17030
|
-
});
|
|
17031
|
-
|
|
17032
16706
|
// src/components/input.ts
|
|
17033
|
-
var
|
|
17034
|
-
var
|
|
16707
|
+
var createInput, input;
|
|
16708
|
+
var init_input = __esm({
|
|
17035
16709
|
"src/components/input.ts"() {
|
|
17036
16710
|
"use strict";
|
|
17037
16711
|
init_esm_shims();
|
|
17038
|
-
|
|
17039
|
-
|
|
17040
|
-
|
|
17041
|
-
|
|
17042
|
-
|
|
17043
|
-
|
|
17044
|
-
|
|
17045
|
-
|
|
17046
|
-
/**
|
|
17047
|
-
* 内部属性 仅在`options`中可手动设置,其他方法请不要调用
|
|
17048
|
-
*/
|
|
17049
|
-
_type(dataType) {
|
|
17050
|
-
const typeMap = {
|
|
17051
|
-
["string" /* STRING */]: "text",
|
|
17052
|
-
["number" /* NUMBER */]: "number",
|
|
17053
|
-
["boolean" /* BOOLEAN */]: "text",
|
|
17054
|
-
["date" /* DATE */]: "text",
|
|
17055
|
-
["time" /* TIME */]: "text",
|
|
17056
|
-
["datetime" /* DATETIME */]: "text",
|
|
17057
|
-
["email" /* EMAIL */]: "email",
|
|
17058
|
-
["url" /* URL */]: "url",
|
|
17059
|
-
["tel" /* TEL */]: "tel",
|
|
17060
|
-
["password" /* PASSWORD */]: "password",
|
|
17061
|
-
["color" /* COLOR */]: "text",
|
|
17062
|
-
["json" /* JSON */]: "text"
|
|
17063
|
-
};
|
|
17064
|
-
if (!typeMap[dataType]) return this;
|
|
17065
|
-
this._config.type = typeMap[dataType];
|
|
17066
|
-
return this;
|
|
17067
|
-
}
|
|
17068
|
-
/**
|
|
17069
|
-
* 设置标签
|
|
17070
|
-
*/
|
|
17071
|
-
label(label) {
|
|
17072
|
-
this._config.label = label;
|
|
17073
|
-
return this;
|
|
17074
|
-
}
|
|
17075
|
-
/**
|
|
17076
|
-
* 设置占位符
|
|
17077
|
-
*/
|
|
17078
|
-
placeholder(placeholder) {
|
|
17079
|
-
this._config.placeholder = placeholder;
|
|
17080
|
-
return this;
|
|
17081
|
-
}
|
|
17082
|
-
/**
|
|
17083
|
-
* 设置验证规则
|
|
17084
|
-
*/
|
|
17085
|
-
validate(rules) {
|
|
17086
|
-
if (!Array.isArray(rules)) rules = [rules];
|
|
17087
|
-
rules.forEach((rule) => {
|
|
17088
|
-
if (rule.regex && rule.regex instanceof RegExp) {
|
|
17089
|
-
rule.regex = rule.regex.toString();
|
|
17090
|
-
}
|
|
17091
|
-
});
|
|
17092
|
-
this._config.rules = rules;
|
|
17093
|
-
return this;
|
|
17094
|
-
}
|
|
17095
|
-
/**
|
|
17096
|
-
* 设置大小
|
|
17097
|
-
* @param size 大小
|
|
17098
|
-
* @returns 输入框构建器
|
|
17099
|
-
*/
|
|
17100
|
-
size(size) {
|
|
17101
|
-
this._config.size = size;
|
|
17102
|
-
return this;
|
|
17103
|
-
}
|
|
17104
|
-
/**
|
|
17105
|
-
* 设置颜色
|
|
17106
|
-
*/
|
|
17107
|
-
color(color) {
|
|
17108
|
-
this._config.color = color;
|
|
17109
|
-
return this;
|
|
17110
|
-
}
|
|
17111
|
-
/**
|
|
17112
|
-
* 设置是否必填
|
|
17113
|
-
*/
|
|
17114
|
-
required(required = true) {
|
|
17115
|
-
this._config.isRequired = required;
|
|
17116
|
-
return this;
|
|
17117
|
-
}
|
|
17118
|
-
/**
|
|
17119
|
-
* 设置清除按钮
|
|
17120
|
-
*/
|
|
17121
|
-
clearable(clearable = true) {
|
|
17122
|
-
this._config.isClearable = clearable;
|
|
17123
|
-
return this;
|
|
17124
|
-
}
|
|
17125
|
-
/**
|
|
17126
|
-
* 设置描述
|
|
17127
|
-
*/
|
|
17128
|
-
description(description) {
|
|
17129
|
-
this._config.description = description;
|
|
17130
|
-
return this;
|
|
17131
|
-
}
|
|
17132
|
-
/**
|
|
17133
|
-
* 自定义参数
|
|
17134
|
-
*/
|
|
17135
|
-
options(options) {
|
|
17136
|
-
this._config = options;
|
|
17137
|
-
return this;
|
|
17138
|
-
}
|
|
16712
|
+
createInput = (key, config2) => {
|
|
16713
|
+
const result = {
|
|
16714
|
+
key,
|
|
16715
|
+
type: "text",
|
|
16716
|
+
...config2,
|
|
16717
|
+
componentType: "input"
|
|
16718
|
+
};
|
|
16719
|
+
return result;
|
|
17139
16720
|
};
|
|
17140
16721
|
input = {
|
|
17141
16722
|
/**
|
|
17142
16723
|
* 创建基础输入框
|
|
17143
16724
|
* @param key 唯一标识符
|
|
16725
|
+
* @param options 输入框配置
|
|
17144
16726
|
*/
|
|
17145
|
-
create: (key) =>
|
|
16727
|
+
create: (key, options) => createInput(key, options),
|
|
17146
16728
|
/**
|
|
17147
|
-
*
|
|
16729
|
+
* 字符串输入框
|
|
17148
16730
|
* @param key 唯一标识符
|
|
17149
|
-
|
|
17150
|
-
|
|
17151
|
-
|
|
17152
|
-
|
|
17153
|
-
|
|
17154
|
-
|
|
17155
|
-
|
|
16731
|
+
* @param config 输入框配置
|
|
16732
|
+
*/
|
|
16733
|
+
string: (key, config2 = {}) => createInput(key, {
|
|
16734
|
+
type: "text",
|
|
16735
|
+
label: "\u5B57\u7B26\u4E32",
|
|
16736
|
+
placeholder: "\u8BF7\u8F93\u5165\u5B57\u7B26\u4E32",
|
|
16737
|
+
isRequired: true,
|
|
16738
|
+
isClearable: true,
|
|
16739
|
+
color: "primary",
|
|
16740
|
+
...config2
|
|
16741
|
+
}),
|
|
16742
|
+
/**
|
|
16743
|
+
* 数字输入框
|
|
17156
16744
|
* @param key 唯一标识符
|
|
17157
|
-
|
|
17158
|
-
|
|
17159
|
-
|
|
17160
|
-
|
|
16745
|
+
* @param config 输入框配置
|
|
16746
|
+
*/
|
|
16747
|
+
number: (key, config2 = {}) => createInput(key, {
|
|
16748
|
+
type: "number",
|
|
16749
|
+
label: "\u6570\u5B57",
|
|
16750
|
+
placeholder: "\u8BF7\u8F93\u5165\u6570\u5B57",
|
|
16751
|
+
isRequired: true,
|
|
16752
|
+
isClearable: true,
|
|
16753
|
+
color: "primary",
|
|
16754
|
+
rules: [
|
|
17161
16755
|
{
|
|
17162
16756
|
min: 0,
|
|
17163
16757
|
max: 100,
|
|
17164
16758
|
error: "\u6570\u5B57\u5E94\u57280-100\u4E4B\u95F4"
|
|
17165
16759
|
}
|
|
17166
|
-
]
|
|
17167
|
-
|
|
16760
|
+
],
|
|
16761
|
+
...config2
|
|
16762
|
+
}),
|
|
17168
16763
|
/**
|
|
17169
|
-
*
|
|
16764
|
+
* 布尔值输入框
|
|
17170
16765
|
* @param key 唯一标识符
|
|
17171
|
-
|
|
17172
|
-
|
|
17173
|
-
|
|
17174
|
-
|
|
16766
|
+
* @param config 输入框配置
|
|
16767
|
+
*/
|
|
16768
|
+
boolean: (key, config2 = {}) => createInput(key, {
|
|
16769
|
+
type: "text",
|
|
16770
|
+
label: "\u5E03\u5C14\u503C",
|
|
16771
|
+
placeholder: "\u8BF7\u8F93\u5165\u5E03\u5C14\u503C",
|
|
16772
|
+
isRequired: true,
|
|
16773
|
+
isClearable: true,
|
|
16774
|
+
color: "primary",
|
|
16775
|
+
rules: [
|
|
17175
16776
|
{
|
|
17176
16777
|
regex: /^(true|false)$/,
|
|
17177
16778
|
error: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u5E03\u5C14\u503C"
|
|
17178
16779
|
}
|
|
17179
|
-
]
|
|
17180
|
-
|
|
16780
|
+
],
|
|
16781
|
+
...config2
|
|
16782
|
+
}),
|
|
17181
16783
|
/**
|
|
17182
|
-
*
|
|
16784
|
+
* 日期输入框
|
|
17183
16785
|
* @param key 唯一标识符
|
|
17184
|
-
|
|
17185
|
-
|
|
17186
|
-
|
|
17187
|
-
|
|
16786
|
+
* @param config 输入框配置
|
|
16787
|
+
*/
|
|
16788
|
+
date: (key, config2 = {}) => createInput(key, {
|
|
16789
|
+
type: "text",
|
|
16790
|
+
label: "\u65E5\u671F",
|
|
16791
|
+
placeholder: "\u8BF7\u8F93\u5165\u65E5\u671F",
|
|
16792
|
+
isRequired: true,
|
|
16793
|
+
isClearable: true,
|
|
16794
|
+
color: "primary",
|
|
16795
|
+
rules: [
|
|
17188
16796
|
{
|
|
17189
16797
|
regex: /^\d{4}-\d{2}-\d{2}$/,
|
|
17190
16798
|
error: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u65E5\u671F\u683C\u5F0F"
|
|
17191
16799
|
}
|
|
17192
|
-
]
|
|
17193
|
-
|
|
16800
|
+
],
|
|
16801
|
+
...config2
|
|
16802
|
+
}),
|
|
17194
16803
|
/**
|
|
17195
|
-
*
|
|
16804
|
+
* 时间输入框
|
|
17196
16805
|
* @param key 唯一标识符
|
|
17197
|
-
|
|
17198
|
-
|
|
17199
|
-
|
|
17200
|
-
|
|
16806
|
+
* @param config 输入框配置
|
|
16807
|
+
*/
|
|
16808
|
+
time: (key, config2 = {}) => createInput(key, {
|
|
16809
|
+
type: "text",
|
|
16810
|
+
label: "\u65F6\u95F4",
|
|
16811
|
+
placeholder: "\u8BF7\u8F93\u5165\u65F6\u95F4",
|
|
16812
|
+
isRequired: true,
|
|
16813
|
+
isClearable: true,
|
|
16814
|
+
color: "primary",
|
|
16815
|
+
rules: [
|
|
17201
16816
|
{
|
|
17202
16817
|
regex: /^\d{2}:\d{2}:\d{2}$/,
|
|
17203
16818
|
error: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u65F6\u95F4\u683C\u5F0F"
|
|
17204
16819
|
}
|
|
17205
|
-
]
|
|
17206
|
-
|
|
16820
|
+
],
|
|
16821
|
+
...config2
|
|
16822
|
+
}),
|
|
17207
16823
|
/**
|
|
17208
|
-
*
|
|
16824
|
+
* 日期时间输入框
|
|
17209
16825
|
* @param key 唯一标识符
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
16826
|
+
* @param config 输入框配置
|
|
16827
|
+
*/
|
|
16828
|
+
datetime: (key, config2 = {}) => createInput(key, {
|
|
16829
|
+
type: "text",
|
|
16830
|
+
label: "\u65E5\u671F\u65F6\u95F4",
|
|
16831
|
+
placeholder: "\u8BF7\u8F93\u5165\u65E5\u671F\u65F6\u95F4",
|
|
16832
|
+
isRequired: true,
|
|
16833
|
+
isClearable: true,
|
|
16834
|
+
color: "primary",
|
|
16835
|
+
rules: [
|
|
17214
16836
|
{
|
|
17215
16837
|
regex: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/,
|
|
17216
16838
|
error: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u65E5\u671F\u65F6\u95F4\u683C\u5F0F"
|
|
17217
16839
|
}
|
|
17218
|
-
]
|
|
17219
|
-
|
|
16840
|
+
],
|
|
16841
|
+
...config2
|
|
16842
|
+
}),
|
|
17220
16843
|
/**
|
|
17221
|
-
*
|
|
16844
|
+
* 邮箱输入框
|
|
17222
16845
|
* @param key 唯一标识符
|
|
17223
|
-
|
|
17224
|
-
|
|
17225
|
-
|
|
17226
|
-
|
|
16846
|
+
* @param config 输入框配置
|
|
16847
|
+
*/
|
|
16848
|
+
email: (key, config2 = {}) => createInput(key, {
|
|
16849
|
+
type: "email",
|
|
16850
|
+
label: "\u90AE\u7BB1",
|
|
16851
|
+
placeholder: "\u8BF7\u8F93\u5165\u90AE\u7BB1",
|
|
16852
|
+
isRequired: true,
|
|
16853
|
+
isClearable: true,
|
|
16854
|
+
color: "primary",
|
|
16855
|
+
rules: [
|
|
17227
16856
|
{
|
|
17228
16857
|
regex: "^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",
|
|
17229
16858
|
error: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u5730\u5740"
|
|
@@ -17233,274 +16862,207 @@ var init_input2 = __esm({
|
|
|
17233
16862
|
maxLength: 50,
|
|
17234
16863
|
error: "\u90AE\u7BB1\u957F\u5EA6\u5E94\u57285-50\u4E2A\u5B57\u7B26\u4E4B\u95F4"
|
|
17235
16864
|
}
|
|
17236
|
-
]
|
|
17237
|
-
|
|
16865
|
+
],
|
|
16866
|
+
...config2
|
|
16867
|
+
}),
|
|
17238
16868
|
/**
|
|
17239
|
-
* URL
|
|
16869
|
+
* URL输入框
|
|
17240
16870
|
* @param key 唯一标识符
|
|
17241
|
-
|
|
17242
|
-
|
|
17243
|
-
|
|
17244
|
-
|
|
16871
|
+
* @param config 输入框配置
|
|
16872
|
+
*/
|
|
16873
|
+
url: (key, config2 = {}) => createInput(key, {
|
|
16874
|
+
type: "url",
|
|
16875
|
+
label: "URL",
|
|
16876
|
+
placeholder: "\u8BF7\u8F93\u5165URL",
|
|
16877
|
+
isRequired: true,
|
|
16878
|
+
isClearable: true,
|
|
16879
|
+
color: "primary",
|
|
16880
|
+
rules: [
|
|
17245
16881
|
{
|
|
17246
16882
|
regex: /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/,
|
|
17247
16883
|
error: "\u8BF7\u8F93\u5165\u6709\u6548\u7684URL\u5730\u5740"
|
|
17248
16884
|
}
|
|
17249
|
-
]
|
|
17250
|
-
|
|
16885
|
+
],
|
|
16886
|
+
...config2
|
|
16887
|
+
}),
|
|
17251
16888
|
/**
|
|
17252
|
-
*
|
|
16889
|
+
* 电话输入框
|
|
17253
16890
|
* @param key 唯一标识符
|
|
17254
|
-
|
|
17255
|
-
|
|
17256
|
-
|
|
17257
|
-
|
|
16891
|
+
* @param config 输入框配置
|
|
16892
|
+
*/
|
|
16893
|
+
tel: (key, config2 = {}) => createInput(key, {
|
|
16894
|
+
type: "tel",
|
|
16895
|
+
label: "\u7535\u8BDD",
|
|
16896
|
+
placeholder: "\u8BF7\u8F93\u5165\u7535\u8BDD",
|
|
16897
|
+
isRequired: true,
|
|
16898
|
+
isClearable: true,
|
|
16899
|
+
color: "primary",
|
|
16900
|
+
rules: [
|
|
17258
16901
|
{
|
|
17259
16902
|
regex: /^1[3-9]\d{9}$/,
|
|
17260
16903
|
error: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u624B\u673A\u53F7\u7801"
|
|
17261
16904
|
}
|
|
17262
|
-
]
|
|
17263
|
-
|
|
16905
|
+
],
|
|
16906
|
+
...config2
|
|
16907
|
+
}),
|
|
17264
16908
|
/**
|
|
17265
|
-
*
|
|
16909
|
+
* 密码输入框
|
|
17266
16910
|
* @param key 唯一标识符
|
|
17267
|
-
|
|
17268
|
-
|
|
17269
|
-
|
|
17270
|
-
|
|
17271
|
-
|
|
17272
|
-
|
|
17273
|
-
|
|
17274
|
-
|
|
16911
|
+
* @param config 输入框配置
|
|
16912
|
+
*/
|
|
16913
|
+
password: (key, config2 = {}) => createInput(key, {
|
|
16914
|
+
type: "password",
|
|
16915
|
+
label: "\u5BC6\u7801",
|
|
16916
|
+
placeholder: "\u8BF7\u8F93\u5165\u5BC6\u7801",
|
|
16917
|
+
isRequired: true,
|
|
16918
|
+
isClearable: true,
|
|
16919
|
+
color: "primary",
|
|
16920
|
+
rules: [
|
|
16921
|
+
{
|
|
16922
|
+
minLength: 1,
|
|
16923
|
+
error: "\u5BC6\u7801\u957F\u5EA6\u4E0D\u80FD\u5C0F\u4E8E1\u4F4D"
|
|
16924
|
+
}
|
|
16925
|
+
],
|
|
16926
|
+
...config2
|
|
16927
|
+
}),
|
|
17275
16928
|
/**
|
|
17276
|
-
*
|
|
16929
|
+
* 颜色输入框
|
|
17277
16930
|
* @param key 唯一标识符
|
|
17278
|
-
|
|
17279
|
-
|
|
17280
|
-
|
|
17281
|
-
|
|
16931
|
+
* @param config 输入框配置
|
|
16932
|
+
*/
|
|
16933
|
+
color: (key, config2 = {}) => createInput(key, {
|
|
16934
|
+
type: "text",
|
|
16935
|
+
label: "\u989C\u8272",
|
|
16936
|
+
placeholder: "\u8BF7\u8F93\u5165\u989C\u8272",
|
|
16937
|
+
isRequired: true,
|
|
16938
|
+
isClearable: true,
|
|
16939
|
+
color: "primary",
|
|
16940
|
+
rules: [
|
|
17282
16941
|
{
|
|
17283
16942
|
regex: /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/,
|
|
17284
16943
|
error: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u989C\u8272\u683C\u5F0F"
|
|
17285
16944
|
}
|
|
17286
|
-
]
|
|
17287
|
-
|
|
16945
|
+
],
|
|
16946
|
+
...config2
|
|
16947
|
+
}),
|
|
17288
16948
|
/**
|
|
17289
|
-
* JSON
|
|
16949
|
+
* JSON输入框
|
|
17290
16950
|
* @param key 唯一标识符
|
|
17291
|
-
|
|
17292
|
-
|
|
17293
|
-
|
|
17294
|
-
|
|
16951
|
+
* @param config 输入框配置
|
|
16952
|
+
*/
|
|
16953
|
+
json: (key, config2 = {}) => createInput(key, {
|
|
16954
|
+
type: "text",
|
|
16955
|
+
label: "JSON",
|
|
16956
|
+
placeholder: "\u8BF7\u8F93\u5165JSON",
|
|
16957
|
+
isRequired: true,
|
|
16958
|
+
isClearable: true,
|
|
16959
|
+
color: "primary",
|
|
16960
|
+
rules: [
|
|
17295
16961
|
{
|
|
17296
16962
|
regex: /^[^{}]*$/,
|
|
17297
16963
|
error: "\u8BF7\u8F93\u5165\u6709\u6548\u7684JSON\u683C\u5F0F"
|
|
17298
16964
|
}
|
|
17299
|
-
]
|
|
17300
|
-
|
|
17301
|
-
|
|
17302
|
-
* 自定义参数
|
|
17303
|
-
* @param key 键
|
|
17304
|
-
* @param options 参数
|
|
17305
|
-
* @returns 输入框构建器
|
|
17306
|
-
*/
|
|
17307
|
-
options: (key, options) => new Input(key).options(options)
|
|
16965
|
+
],
|
|
16966
|
+
...config2
|
|
16967
|
+
})
|
|
17308
16968
|
};
|
|
17309
16969
|
}
|
|
17310
16970
|
});
|
|
17311
16971
|
|
|
17312
16972
|
// src/components/switch.ts
|
|
17313
|
-
var
|
|
17314
|
-
var
|
|
16973
|
+
var createSwitch, switchComponent;
|
|
16974
|
+
var init_switch = __esm({
|
|
17315
16975
|
"src/components/switch.ts"() {
|
|
17316
16976
|
"use strict";
|
|
17317
16977
|
init_esm_shims();
|
|
17318
|
-
|
|
17319
|
-
|
|
17320
|
-
|
|
17321
|
-
|
|
17322
|
-
|
|
17323
|
-
this._config.key = key;
|
|
17324
|
-
}
|
|
17325
|
-
/**
|
|
17326
|
-
* 设置开始文本
|
|
17327
|
-
* @param text 开始文本
|
|
17328
|
-
*/
|
|
17329
|
-
startText = (text2) => {
|
|
17330
|
-
this._config.startText = text2;
|
|
17331
|
-
return this;
|
|
17332
|
-
};
|
|
17333
|
-
/**
|
|
17334
|
-
* 设置结束文本
|
|
17335
|
-
* @param text 结束文本
|
|
17336
|
-
*/
|
|
17337
|
-
endText = (text2) => {
|
|
17338
|
-
this._config.endText = text2;
|
|
17339
|
-
return this;
|
|
17340
|
-
};
|
|
17341
|
-
/**
|
|
17342
|
-
* 设置大小
|
|
17343
|
-
* @param size 大小
|
|
17344
|
-
*/
|
|
17345
|
-
size = (size) => {
|
|
17346
|
-
this._config.size = size;
|
|
17347
|
-
return this;
|
|
17348
|
-
};
|
|
17349
|
-
/**
|
|
17350
|
-
* 设置颜色
|
|
17351
|
-
* @param color 颜色
|
|
17352
|
-
*/
|
|
17353
|
-
color = (color) => {
|
|
17354
|
-
this._config.color = color;
|
|
17355
|
-
return this;
|
|
17356
|
-
};
|
|
17357
|
-
/**
|
|
17358
|
-
* 设置开关图标
|
|
17359
|
-
* @param icon 图标
|
|
17360
|
-
*/
|
|
17361
|
-
thumbIcon = (icon) => {
|
|
17362
|
-
this._config.thumbIcon = icon;
|
|
17363
|
-
return this;
|
|
17364
|
-
};
|
|
17365
|
-
/**
|
|
17366
|
-
* 设置开始内容图标
|
|
17367
|
-
* @param icon 图标
|
|
17368
|
-
*/
|
|
17369
|
-
startContent = (icon) => {
|
|
17370
|
-
this._config.startContent = icon;
|
|
17371
|
-
return this;
|
|
17372
|
-
};
|
|
17373
|
-
/**
|
|
17374
|
-
* 设置结束内容图标
|
|
17375
|
-
* @param icon 图标
|
|
17376
|
-
*/
|
|
17377
|
-
endContent = (icon) => {
|
|
17378
|
-
this._config.endContent = icon;
|
|
17379
|
-
return this;
|
|
17380
|
-
};
|
|
17381
|
-
/**
|
|
17382
|
-
* 设置是否被选中(只读)
|
|
17383
|
-
* @param selected 是否被选中
|
|
17384
|
-
*/
|
|
17385
|
-
selected = (selected = true) => {
|
|
17386
|
-
this._config.isSelected = selected;
|
|
17387
|
-
return this;
|
|
17388
|
-
};
|
|
17389
|
-
/**
|
|
17390
|
-
* 设置默认选中状态
|
|
17391
|
-
* @param selected 是否默认选中
|
|
17392
|
-
*/
|
|
17393
|
-
defaultSelected = (selected = true) => {
|
|
17394
|
-
this._config.defaultSelected = selected;
|
|
17395
|
-
return this;
|
|
17396
|
-
};
|
|
17397
|
-
/**
|
|
17398
|
-
* 设置是否只读
|
|
17399
|
-
* @param readonly 是否只读
|
|
17400
|
-
*/
|
|
17401
|
-
readonly = (readonly = true) => {
|
|
17402
|
-
this._config.isReadOnly = readonly;
|
|
17403
|
-
return this;
|
|
17404
|
-
};
|
|
17405
|
-
/**
|
|
17406
|
-
* 设置是否禁用
|
|
17407
|
-
* @param disabled 是否禁用
|
|
17408
|
-
*/
|
|
17409
|
-
disabled = (disabled = true) => {
|
|
17410
|
-
this._config.isDisabled = disabled;
|
|
17411
|
-
return this;
|
|
17412
|
-
};
|
|
17413
|
-
/**
|
|
17414
|
-
* 设置是否禁用动画
|
|
17415
|
-
* @param disable 是否禁用动画
|
|
17416
|
-
*/
|
|
17417
|
-
disableAnimation = (disable = true) => {
|
|
17418
|
-
this._config.disableAnimation = disable;
|
|
17419
|
-
return this;
|
|
17420
|
-
};
|
|
17421
|
-
/**
|
|
17422
|
-
* 自定义参数
|
|
17423
|
-
* @param options 参数
|
|
17424
|
-
*/
|
|
17425
|
-
options = (options) => {
|
|
17426
|
-
this._config = options;
|
|
17427
|
-
return this;
|
|
16978
|
+
createSwitch = (key, config2 = {}) => {
|
|
16979
|
+
const result = {
|
|
16980
|
+
key,
|
|
16981
|
+
...config2,
|
|
16982
|
+
componentType: "switch"
|
|
17428
16983
|
};
|
|
16984
|
+
console.log("createSwitch:", JSON.stringify(result));
|
|
16985
|
+
return result;
|
|
17429
16986
|
};
|
|
17430
16987
|
switchComponent = {
|
|
17431
16988
|
/**
|
|
17432
16989
|
* 创建基础开关
|
|
17433
16990
|
* @param key 唯一标识符
|
|
16991
|
+
* @param options 开关配置
|
|
17434
16992
|
*/
|
|
17435
|
-
create: (key) =>
|
|
16993
|
+
create: (key, options = {}) => createSwitch(key, options),
|
|
17436
16994
|
/**
|
|
17437
|
-
*
|
|
16995
|
+
* 自定义开关
|
|
17438
16996
|
* @param key 唯一标识符
|
|
17439
|
-
* @param
|
|
17440
|
-
*/
|
|
17441
|
-
options: (key,
|
|
16997
|
+
* @param config 开关配置
|
|
16998
|
+
*/
|
|
16999
|
+
options: (key, config2 = {}) => createSwitch(key, {
|
|
17000
|
+
startText: "\u5F00\u542F",
|
|
17001
|
+
endText: "\u5173\u95ED",
|
|
17002
|
+
size: "md",
|
|
17003
|
+
color: "primary",
|
|
17004
|
+
isSelected: false,
|
|
17005
|
+
defaultSelected: false,
|
|
17006
|
+
isReadOnly: false,
|
|
17007
|
+
isDisabled: false,
|
|
17008
|
+
disableAnimation: false,
|
|
17009
|
+
...config2
|
|
17010
|
+
})
|
|
17442
17011
|
};
|
|
17443
17012
|
}
|
|
17444
17013
|
});
|
|
17445
17014
|
|
|
17446
17015
|
// src/components/divider.ts
|
|
17447
|
-
var
|
|
17448
|
-
var
|
|
17016
|
+
var createDivider, divider;
|
|
17017
|
+
var init_divider = __esm({
|
|
17449
17018
|
"src/components/divider.ts"() {
|
|
17450
17019
|
"use strict";
|
|
17451
17020
|
init_esm_shims();
|
|
17452
|
-
|
|
17453
|
-
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
|
|
17457
|
-
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
transparent: false,
|
|
17461
|
-
orientation: "horizontal"
|
|
17462
|
-
};
|
|
17463
|
-
}
|
|
17021
|
+
createDivider = (key, config2) => ({
|
|
17022
|
+
key,
|
|
17023
|
+
componentType: "divider",
|
|
17024
|
+
transparent: false,
|
|
17025
|
+
orientation: "horizontal",
|
|
17026
|
+
...config2
|
|
17027
|
+
});
|
|
17028
|
+
divider = {
|
|
17464
17029
|
/**
|
|
17465
|
-
*
|
|
17466
|
-
* @param
|
|
17030
|
+
* 创建基础分隔线
|
|
17031
|
+
* @param key 唯一标识符
|
|
17032
|
+
* @param options 分隔线配置
|
|
17467
17033
|
*/
|
|
17468
|
-
|
|
17469
|
-
this._config.transparent = transparent;
|
|
17470
|
-
return this;
|
|
17471
|
-
}
|
|
17034
|
+
create: (key, options) => createDivider(key, options),
|
|
17472
17035
|
/**
|
|
17473
|
-
*
|
|
17474
|
-
* @param
|
|
17036
|
+
* 创建水平分隔线
|
|
17037
|
+
* @param key 唯一标识符
|
|
17038
|
+
* @param config 分隔线配置
|
|
17475
17039
|
*/
|
|
17476
|
-
|
|
17477
|
-
|
|
17478
|
-
|
|
17479
|
-
}
|
|
17040
|
+
horizontal: (key, config2 = {}) => createDivider(key, {
|
|
17041
|
+
orientation: "horizontal",
|
|
17042
|
+
...config2
|
|
17043
|
+
}),
|
|
17480
17044
|
/**
|
|
17481
|
-
*
|
|
17482
|
-
* @
|
|
17045
|
+
* 创建垂直分隔线
|
|
17046
|
+
* @param key 唯一标识符
|
|
17047
|
+
* @param config 分隔线配置
|
|
17483
17048
|
*/
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
|
|
17487
|
-
|
|
17488
|
-
return data._config;
|
|
17489
|
-
}
|
|
17049
|
+
vertical: (key, config2 = {}) => createDivider(key, {
|
|
17050
|
+
orientation: "vertical",
|
|
17051
|
+
...config2
|
|
17052
|
+
})
|
|
17490
17053
|
};
|
|
17491
|
-
divider = new Divider();
|
|
17492
17054
|
}
|
|
17493
17055
|
});
|
|
17494
17056
|
|
|
17495
17057
|
// src/components/all.ts
|
|
17496
17058
|
var components;
|
|
17497
|
-
var
|
|
17059
|
+
var init_all = __esm({
|
|
17498
17060
|
"src/components/all.ts"() {
|
|
17499
17061
|
"use strict";
|
|
17500
17062
|
init_esm_shims();
|
|
17501
|
-
|
|
17502
|
-
|
|
17503
|
-
|
|
17063
|
+
init_input();
|
|
17064
|
+
init_divider();
|
|
17065
|
+
init_switch();
|
|
17504
17066
|
init_accordion();
|
|
17505
17067
|
components = {
|
|
17506
17068
|
/** 分隔线 */
|
|
@@ -17520,15 +17082,15 @@ var init_all2 = __esm({
|
|
|
17520
17082
|
});
|
|
17521
17083
|
|
|
17522
17084
|
// src/components/index.ts
|
|
17523
|
-
var
|
|
17085
|
+
var init_components = __esm({
|
|
17524
17086
|
"src/components/index.ts"() {
|
|
17525
17087
|
"use strict";
|
|
17526
17088
|
init_esm_shims();
|
|
17527
17089
|
init_accordion();
|
|
17528
|
-
|
|
17529
|
-
|
|
17530
|
-
|
|
17531
|
-
|
|
17090
|
+
init_input();
|
|
17091
|
+
init_switch();
|
|
17092
|
+
init_divider();
|
|
17093
|
+
init_all();
|
|
17532
17094
|
}
|
|
17533
17095
|
});
|
|
17534
17096
|
|
|
@@ -17583,7 +17145,7 @@ var init_class2 = __esm({
|
|
|
17583
17145
|
import fs30 from "node:fs";
|
|
17584
17146
|
import path23 from "node:path";
|
|
17585
17147
|
var index3, botID, AdapterConsole, adapter3;
|
|
17586
|
-
var
|
|
17148
|
+
var init_input2 = __esm({
|
|
17587
17149
|
"src/adapter/input/index.ts"() {
|
|
17588
17150
|
"use strict";
|
|
17589
17151
|
init_esm_shims();
|
|
@@ -17732,7 +17294,7 @@ var init_adapter3 = __esm({
|
|
|
17732
17294
|
"src/adapter/index.ts"() {
|
|
17733
17295
|
"use strict";
|
|
17734
17296
|
init_esm_shims();
|
|
17735
|
-
|
|
17297
|
+
init_input2();
|
|
17736
17298
|
init_adapter2();
|
|
17737
17299
|
init_base();
|
|
17738
17300
|
init_render2();
|
|
@@ -17742,7 +17304,6 @@ var init_adapter3 = __esm({
|
|
|
17742
17304
|
// src/index.ts
|
|
17743
17305
|
var index_exports = {};
|
|
17744
17306
|
__export(index_exports, {
|
|
17745
|
-
AccordionItem: () => AccordionItem,
|
|
17746
17307
|
AdapterBase: () => AdapterBase,
|
|
17747
17308
|
BaseEvent: () => BaseEvent,
|
|
17748
17309
|
Bot: () => Bot,
|
|
@@ -18027,9 +17588,9 @@ var init_index = __esm({
|
|
|
18027
17588
|
init_server3();
|
|
18028
17589
|
init_onebot();
|
|
18029
17590
|
init_event2();
|
|
18030
|
-
|
|
17591
|
+
init_cache3();
|
|
18031
17592
|
init_types2();
|
|
18032
|
-
|
|
17593
|
+
init_components();
|
|
18033
17594
|
init_base();
|
|
18034
17595
|
init_list();
|
|
18035
17596
|
init_class2();
|
|
@@ -18053,7 +17614,6 @@ var init_index = __esm({
|
|
|
18053
17614
|
});
|
|
18054
17615
|
init_index();
|
|
18055
17616
|
export {
|
|
18056
|
-
AccordionItem,
|
|
18057
17617
|
AdapterBase,
|
|
18058
17618
|
BaseEvent,
|
|
18059
17619
|
Bot,
|