dsh-workbench-salary 0.4.12 → 0.4.15
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/lib/client.js +22 -1994
- package/lib/domain/actions.js +0 -21
- package/lib/domain/salary.js +1 -6
- package/lib/index.js +2 -2
- package/package.json +4 -8
package/lib/client.js
CHANGED
|
@@ -1589,40 +1589,38 @@ var require_client_common = __commonJS({
|
|
|
1589
1589
|
}
|
|
1590
1590
|
function Btn(props) {
|
|
1591
1591
|
var h = props.h;
|
|
1592
|
-
return h(
|
|
1593
|
-
"button",
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
},
|
|
1601
|
-
props.children
|
|
1602
|
-
);
|
|
1592
|
+
return h("button", {
|
|
1593
|
+
type: props.type || "button",
|
|
1594
|
+
className: p + "-btn" + (props.kind ? " " + props.kind : ""),
|
|
1595
|
+
disabled: props.disabled,
|
|
1596
|
+
onClick: props.onClick,
|
|
1597
|
+
title: props.title,
|
|
1598
|
+
children: props.children
|
|
1599
|
+
});
|
|
1603
1600
|
}
|
|
1604
1601
|
function Field(props) {
|
|
1605
1602
|
var h = props.h;
|
|
1606
|
-
return h(
|
|
1607
|
-
"
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1603
|
+
return h("label", {
|
|
1604
|
+
className: p + "-field",
|
|
1605
|
+
children: [
|
|
1606
|
+
h("span", { key: "label", className: p + "-label", children: props.label }),
|
|
1607
|
+
props.children,
|
|
1608
|
+
props.hint ? h("span", { key: "hint", className: p + "-hint", children: props.hint }) : null
|
|
1609
|
+
]
|
|
1610
|
+
});
|
|
1613
1611
|
}
|
|
1614
1612
|
function Notice(props) {
|
|
1615
1613
|
var h = props.h;
|
|
1616
1614
|
if (!props.text) return null;
|
|
1617
|
-
return h("div", { className: p + "-notice " + (props.kind || "info")
|
|
1615
|
+
return h("div", { className: p + "-notice " + (props.kind || "info"), children: props.text });
|
|
1618
1616
|
}
|
|
1619
1617
|
function Empty(props) {
|
|
1620
1618
|
var h = props.h;
|
|
1621
|
-
return h("div", { className: p + "-empty"
|
|
1619
|
+
return h("div", { className: p + "-empty", children: props.text || "\u6682\u65E0\u6570\u636E" });
|
|
1622
1620
|
}
|
|
1623
1621
|
function Pill(props) {
|
|
1624
1622
|
var h = props.h;
|
|
1625
|
-
return h("span", { className: p + "-pill " + (props.kind || "")
|
|
1623
|
+
return h("span", { className: p + "-pill " + (props.kind || ""), children: props.children });
|
|
1626
1624
|
}
|
|
1627
1625
|
function Json(props) {
|
|
1628
1626
|
var h = props.h;
|
|
@@ -1632,7 +1630,7 @@ var require_client_common = __commonJS({
|
|
|
1632
1630
|
} catch (e) {
|
|
1633
1631
|
text = String(props.value);
|
|
1634
1632
|
}
|
|
1635
|
-
return h("pre", { className: p + "-json"
|
|
1633
|
+
return h("pre", { className: p + "-json", children: text });
|
|
1636
1634
|
}
|
|
1637
1635
|
function useLoad(React, api, action, args, deps) {
|
|
1638
1636
|
var s = React.useState({ loading: true, data: null, error: "" });
|
|
@@ -4199,1973 +4197,6 @@ var require_records = __commonJS({
|
|
|
4199
4197
|
}
|
|
4200
4198
|
});
|
|
4201
4199
|
|
|
4202
|
-
// packages/addons/lib/legacy-data.cjs
|
|
4203
|
-
var require_legacy_data = __commonJS({
|
|
4204
|
-
"packages/addons/lib/legacy-data.cjs"(exports2, module2) {
|
|
4205
|
-
"use strict";
|
|
4206
|
-
function unwrap(r) {
|
|
4207
|
-
return r && r.result !== void 0 ? r.result : r;
|
|
4208
|
-
}
|
|
4209
|
-
function rowsOf(body) {
|
|
4210
|
-
if (!body) return [];
|
|
4211
|
-
if (Array.isArray(body)) return body;
|
|
4212
|
-
if (Array.isArray(body.rows)) return body.rows;
|
|
4213
|
-
if (Array.isArray(body.items)) return body.items;
|
|
4214
|
-
return [];
|
|
4215
|
-
}
|
|
4216
|
-
function textOf(value) {
|
|
4217
|
-
if (value === null || value === void 0) return "";
|
|
4218
|
-
return typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
4219
|
-
}
|
|
4220
|
-
function columnsOf(rows) {
|
|
4221
|
-
if (!rows.length) return [];
|
|
4222
|
-
return Object.keys(rows[0]).map(function(name) {
|
|
4223
|
-
return { name, type: "TEXT", system: false };
|
|
4224
|
-
});
|
|
4225
|
-
}
|
|
4226
|
-
function tableNames(body) {
|
|
4227
|
-
var list = body && Array.isArray(body.tables) ? body.tables : [];
|
|
4228
|
-
return list.map(function(t) {
|
|
4229
|
-
if (typeof t === "string") return { name: t };
|
|
4230
|
-
return { name: t.name, count: t.count, columns: t.columns };
|
|
4231
|
-
}).filter(function(t) {
|
|
4232
|
-
return t.name;
|
|
4233
|
-
});
|
|
4234
|
-
}
|
|
4235
|
-
function compare(a, b) {
|
|
4236
|
-
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
4237
|
-
var sa = textOf(a), sb = textOf(b);
|
|
4238
|
-
var na = Number(sa), nb = Number(sb);
|
|
4239
|
-
if (sa !== "" && sb !== "" && Number.isFinite(na) && Number.isFinite(nb)) return na - nb;
|
|
4240
|
-
return sa.localeCompare(sb, "zh-CN");
|
|
4241
|
-
}
|
|
4242
|
-
module2.exports = function createLegacyData(domain, options) {
|
|
4243
|
-
options = options || {};
|
|
4244
|
-
var paged = options.paged !== false;
|
|
4245
|
-
var maxRows = Math.max(1, Number(options.maxRows) || 2e3);
|
|
4246
|
-
var pageLimit = Math.min(200, maxRows);
|
|
4247
|
-
function tablesLoader(api) {
|
|
4248
|
-
return api.call(domain + ".dataTables").then(function(r) {
|
|
4249
|
-
if (r && r.ok === false) throw new Error(r.error || "dataTables failed");
|
|
4250
|
-
var body = unwrap(r);
|
|
4251
|
-
return { tables: tableNames(body) };
|
|
4252
|
-
});
|
|
4253
|
-
}
|
|
4254
|
-
function fetchAll(api, table) {
|
|
4255
|
-
var rows = [];
|
|
4256
|
-
var offset = 0;
|
|
4257
|
-
function next() {
|
|
4258
|
-
var args = { table, limit: pageLimit };
|
|
4259
|
-
if (paged) args.offset = offset;
|
|
4260
|
-
return api.call(domain + ".dataQuery", args).then(function(r) {
|
|
4261
|
-
if (r && r.ok === false) throw new Error(r.error || "dataQuery failed");
|
|
4262
|
-
var batch = rowsOf(unwrap(r));
|
|
4263
|
-
rows = rows.concat(batch);
|
|
4264
|
-
if (!paged || batch.length < pageLimit || rows.length >= maxRows) return rows.slice(0, maxRows);
|
|
4265
|
-
offset += batch.length;
|
|
4266
|
-
return next();
|
|
4267
|
-
});
|
|
4268
|
-
}
|
|
4269
|
-
return next();
|
|
4270
|
-
}
|
|
4271
|
-
function query(api, args) {
|
|
4272
|
-
return fetchAll(api, args.table).then(function(all) {
|
|
4273
|
-
var search = String(args.search || "").trim().toLowerCase();
|
|
4274
|
-
var filters = args.filters && typeof args.filters === "object" ? args.filters : {};
|
|
4275
|
-
var filterKeys = Object.keys(filters).slice(0, 20);
|
|
4276
|
-
var colNames = all.length ? Object.keys(all[0]) : [];
|
|
4277
|
-
var includeDeleted = args.includeDeleted === true;
|
|
4278
|
-
var rows = all.filter(function(row) {
|
|
4279
|
-
if (!includeDeleted && row.deleted_at) return false;
|
|
4280
|
-
if (search) {
|
|
4281
|
-
var hit = colNames.some(function(c) {
|
|
4282
|
-
return textOf(row[c]).toLowerCase().indexOf(search) >= 0;
|
|
4283
|
-
});
|
|
4284
|
-
if (!hit) return false;
|
|
4285
|
-
}
|
|
4286
|
-
return filterKeys.every(function(c) {
|
|
4287
|
-
return textOf(row[c]).toLowerCase().indexOf(textOf(filters[c]).toLowerCase()) >= 0;
|
|
4288
|
-
});
|
|
4289
|
-
});
|
|
4290
|
-
var sort = String(args.sort || "");
|
|
4291
|
-
var order = args.order === "asc" ? "asc" : "desc";
|
|
4292
|
-
if (sort && colNames.indexOf(sort) >= 0) {
|
|
4293
|
-
rows = rows.slice().sort(function(a, b) {
|
|
4294
|
-
var d = compare(a[sort], b[sort]);
|
|
4295
|
-
return order === "asc" ? d : -d;
|
|
4296
|
-
});
|
|
4297
|
-
}
|
|
4298
|
-
var pageSize = Math.max(1, Math.min(200, Number(args.pageSize) || 50));
|
|
4299
|
-
var total = rows.length;
|
|
4300
|
-
var pages = Math.max(1, Math.ceil(total / pageSize));
|
|
4301
|
-
var page = Math.max(1, Math.min(pages, Number(args.page) || 1));
|
|
4302
|
-
var start = (page - 1) * pageSize;
|
|
4303
|
-
var started = Date.now();
|
|
4304
|
-
return {
|
|
4305
|
-
table: args.table,
|
|
4306
|
-
columns: columnsOf(all),
|
|
4307
|
-
rows: rows.slice(start, start + pageSize),
|
|
4308
|
-
page,
|
|
4309
|
-
pageSize,
|
|
4310
|
-
pages,
|
|
4311
|
-
total,
|
|
4312
|
-
sort,
|
|
4313
|
-
order,
|
|
4314
|
-
search,
|
|
4315
|
-
filters,
|
|
4316
|
-
includeDeleted,
|
|
4317
|
-
queryMs: Math.max(0, Date.now() - started)
|
|
4318
|
-
};
|
|
4319
|
-
});
|
|
4320
|
-
}
|
|
4321
|
-
return { tablesLoader, query };
|
|
4322
|
-
};
|
|
4323
|
-
}
|
|
4324
|
-
});
|
|
4325
|
-
|
|
4326
|
-
// packages/addons/lib/data-copy.cjs
|
|
4327
|
-
var require_data_copy = __commonJS({
|
|
4328
|
-
"packages/addons/lib/data-copy.cjs"(exports2, module2) {
|
|
4329
|
-
"use strict";
|
|
4330
|
-
var COPY = {
|
|
4331
|
-
zh: {
|
|
4332
|
-
title: "\u6570\u636E",
|
|
4333
|
-
subtitle: "\u53EA\u8BFB\u6D4F\u89C8\u672C\u63D2\u4EF6\u8D1F\u8D23\u7684\u8868\uFF1B\u7CFB\u7EDF\u5217\u4E0E\u5DF2\u5220\u9664\u884C\u9ED8\u8BA4\u9690\u85CF",
|
|
4334
|
-
tables: "\u8868",
|
|
4335
|
-
rows: "\u884C",
|
|
4336
|
-
deleted: "\u5DF2\u5220\u9664",
|
|
4337
|
-
rowCount: "\u5171 {n} \u884C",
|
|
4338
|
-
deletedCount: "\u5176\u4E2D {n} \u884C\u5DF2\u5220\u9664",
|
|
4339
|
-
search: "\u641C\u7D22\u6240\u6709\u6587\u672C\u5217\u2026",
|
|
4340
|
-
pageSize: "\u6BCF\u9875",
|
|
4341
|
-
includeDeleted: "\u542B\u5DF2\u5220\u9664",
|
|
4342
|
-
showSystem: "\u7CFB\u7EDF\u5217",
|
|
4343
|
-
refresh: "\u5237\u65B0",
|
|
4344
|
-
loading: "\u8F7D\u5165\u4E2D\u2026",
|
|
4345
|
-
empty: "\u8FD9\u5F20\u8868\u8FD8\u6CA1\u6709\u6570\u636E",
|
|
4346
|
-
emptyTable: "\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u8868",
|
|
4347
|
-
loadFail: "\u6570\u636E\u670D\u52A1\u4E0D\u53EF\u7528\uFF08\u63D2\u4EF6\u7248\u672C\u8FC7\u65E7\uFF1F\uFF09",
|
|
4348
|
-
retry: "\u91CD\u8BD5",
|
|
4349
|
-
queryFail: "\u67E5\u8BE2\u5931\u8D25\uFF1A",
|
|
4350
|
-
noRows: "\u6CA1\u6709\u5339\u914D\u7684\u884C",
|
|
4351
|
-
prev: "\u4E0A\u4E00\u9875",
|
|
4352
|
-
next: "\u4E0B\u4E00\u9875",
|
|
4353
|
-
pageInfo: "\u7B2C {page} / {pages} \u9875",
|
|
4354
|
-
jump: "\u8DF3\u8F6C",
|
|
4355
|
-
total: "\u5171 {n} \u884C",
|
|
4356
|
-
copied: "\u5DF2\u590D\u5236",
|
|
4357
|
-
copy: "\u590D\u5236",
|
|
4358
|
-
close: "\u5173\u95ED",
|
|
4359
|
-
drawerTitle: "{column} \xB7 \u7B2C {row} \u884C",
|
|
4360
|
-
nullText: "NULL",
|
|
4361
|
-
emptyText: "\u7A7A",
|
|
4362
|
-
yes: "\u662F",
|
|
4363
|
-
no: "\u5426",
|
|
4364
|
-
json: "JSON",
|
|
4365
|
-
queryTime: "{n} ms",
|
|
4366
|
-
sortAsc: "\u5347\u5E8F",
|
|
4367
|
-
sortDesc: "\u964D\u5E8F",
|
|
4368
|
-
filterCol: "\u7B5B\u9009\u2026",
|
|
4369
|
-
filterClear: "\u6E05\u9664\u7B5B\u9009",
|
|
4370
|
-
index: "\u8868\u7D22\u5F15",
|
|
4371
|
-
indexSub: "\u5F53\u524D\u9009\u4E2D\u8868\u7684\u7D22\u5F15\uFF08\u53EA\u8BFB\uFF09\uFF1B\u884C\u6570\u4E3A\u6240\u5C5E\u8868\u603B\u884C\u6570\uFF0C\u4E0D\u662F\u7D22\u5F15\u6761\u76EE\u6570",
|
|
4372
|
-
idxName: "\u7D22\u5F15\u540D",
|
|
4373
|
-
idxColumns: "\u5217",
|
|
4374
|
-
idxType: "\u7C7B\u578B",
|
|
4375
|
-
idxSource: "\u6765\u6E90",
|
|
4376
|
-
idxUnique: "\u552F\u4E00",
|
|
4377
|
-
idxNormal: "\u666E\u901A",
|
|
4378
|
-
idxAuto: "\u81EA\u52A8",
|
|
4379
|
-
idxCreated: "\u663E\u5F0F\u521B\u5EFA",
|
|
4380
|
-
idxCount: "\u5171 {n} \u4E2A\u7D22\u5F15",
|
|
4381
|
-
idxNoExtra: "\u8BE5\u8868\u9664\u4E3B\u952E\u5916\u6CA1\u6709\u989D\u5916\u7D22\u5F15",
|
|
4382
|
-
idxRowsHelp: "\u6240\u5C5E\u8868\u603B\u884C\u6570\uFF08\u542B\u5DF2\u5220\u9664\u884C\uFF09\uFF0C\u4E0D\u662F\u7D22\u5F15\u6761\u76EE\u6570",
|
|
4383
|
-
idxTable: "\u8868",
|
|
4384
|
-
idxRows: "\u884C\u6570",
|
|
4385
|
-
idxCols: "\u5217\u6570",
|
|
4386
|
-
idxKey: "\u4E3B\u952E",
|
|
4387
|
-
idxIndexes: "\u7D22\u5F15",
|
|
4388
|
-
idxLastWrite: "\u6700\u8FD1\u5199\u5165",
|
|
4389
|
-
idxNone: "\u65E0",
|
|
4390
|
-
idxEmpty: "\u5F53\u524D\u8868\u6CA1\u6709\u53EF\u7528\u7684\u7D22\u5F15\u7EDF\u8BA1",
|
|
4391
|
-
idxTables: "\u8868",
|
|
4392
|
-
idxAt: "\u7EDF\u8BA1\u65F6\u95F4"
|
|
4393
|
-
},
|
|
4394
|
-
en: {
|
|
4395
|
-
title: "Data",
|
|
4396
|
-
subtitle: "Read-only view of this plugin's tables; system and deleted rows are hidden by default",
|
|
4397
|
-
tables: "Tables",
|
|
4398
|
-
rows: "rows",
|
|
4399
|
-
deleted: "deleted",
|
|
4400
|
-
rowCount: "{n} rows",
|
|
4401
|
-
deletedCount: "{n} deleted",
|
|
4402
|
-
search: "Search all text columns\u2026",
|
|
4403
|
-
pageSize: "Rows",
|
|
4404
|
-
includeDeleted: "Deleted",
|
|
4405
|
-
showSystem: "System",
|
|
4406
|
-
refresh: "Refresh",
|
|
4407
|
-
loading: "Loading\u2026",
|
|
4408
|
-
empty: "This table has no rows yet",
|
|
4409
|
-
emptyTable: "No tables to show",
|
|
4410
|
-
loadFail: "Data service unavailable (plugin too old?)",
|
|
4411
|
-
retry: "Retry",
|
|
4412
|
-
queryFail: "Query failed: ",
|
|
4413
|
-
noRows: "No matching rows",
|
|
4414
|
-
prev: "Previous",
|
|
4415
|
-
next: "Next",
|
|
4416
|
-
pageInfo: "Page {page} / {pages}",
|
|
4417
|
-
jump: "Jump",
|
|
4418
|
-
total: "{n} rows",
|
|
4419
|
-
copied: "Copied",
|
|
4420
|
-
copy: "Copy",
|
|
4421
|
-
close: "Close",
|
|
4422
|
-
drawerTitle: "{column} \xB7 row {row}",
|
|
4423
|
-
nullText: "NULL",
|
|
4424
|
-
emptyText: "empty",
|
|
4425
|
-
yes: "Yes",
|
|
4426
|
-
no: "No",
|
|
4427
|
-
json: "JSON",
|
|
4428
|
-
queryTime: "{n} ms",
|
|
4429
|
-
sortAsc: "ascending",
|
|
4430
|
-
sortDesc: "descending",
|
|
4431
|
-
filterCol: "Filter\u2026",
|
|
4432
|
-
filterClear: "Clear filter",
|
|
4433
|
-
index: "Table index",
|
|
4434
|
-
indexSub: "Indexes of the selected table (read-only); rows are the table total, not index entries",
|
|
4435
|
-
idxName: "Index name",
|
|
4436
|
-
idxColumns: "Columns",
|
|
4437
|
-
idxType: "Type",
|
|
4438
|
-
idxSource: "Source",
|
|
4439
|
-
idxUnique: "Unique",
|
|
4440
|
-
idxNormal: "Normal",
|
|
4441
|
-
idxAuto: "Automatic",
|
|
4442
|
-
idxCreated: "Explicit",
|
|
4443
|
-
idxCount: "{n} indexes",
|
|
4444
|
-
idxNoExtra: "This table has no indexes other than its primary key",
|
|
4445
|
-
idxRowsHelp: "Total table rows (including deleted rows), not index entries",
|
|
4446
|
-
idxTable: "Table",
|
|
4447
|
-
idxRows: "Rows",
|
|
4448
|
-
idxCols: "Cols",
|
|
4449
|
-
idxKey: "Primary key",
|
|
4450
|
-
idxIndexes: "Indexes",
|
|
4451
|
-
idxLastWrite: "Last write",
|
|
4452
|
-
idxNone: "\u2014",
|
|
4453
|
-
idxEmpty: "No index statistics available for this table",
|
|
4454
|
-
idxTables: "Tables",
|
|
4455
|
-
idxAt: "Generated"
|
|
4456
|
-
}
|
|
4457
|
-
};
|
|
4458
|
-
module2.exports = COPY;
|
|
4459
|
-
}
|
|
4460
|
-
});
|
|
4461
|
-
|
|
4462
|
-
// packages/addons/lib/visual-tokens.cjs
|
|
4463
|
-
var require_visual_tokens = __commonJS({
|
|
4464
|
-
"packages/addons/lib/visual-tokens.cjs"(exports2, module2) {
|
|
4465
|
-
module2.exports = `
|
|
4466
|
-
:where(.wbt-root,.wbi-root,.wbi-cfg,.wbt-data,.wbs-data,.wbg-data,.wbi-data,.wb-desc){--wb-radius-sm:8px;--wb-radius-card:12px;--wb-space-sm:8px;--wb-space-md:14px;--wb-border:var(--dsw-alias-border-l2,color-mix(in oklab,currentColor 16%,transparent));--wb-description-bg:color-mix(in oklab,var(--dsw-alias-brand-primary,#5b7fd6) 7%,transparent);--wb-description-line:color-mix(in oklab,var(--dsw-alias-brand-primary,#5b7fd6) 34%,transparent);--wb-motion:140ms;--wb-btn-bg:transparent;--wb-btn-hover-bg:color-mix(in oklab,currentColor 6%,transparent);--wb-btn-active-bg:color-mix(in oklab,currentColor 11%,transparent);--wb-btn-primary-bg:var(--dsw-alias-brand-primary,#2563eb);--wb-btn-primary-fg:var(--dsw-alias-label-primary-inverted,#fff);--wb-btn-danger-fg:var(--dsw-alias-state-error-primary,#b91c1c);--wb-btn-size-sm:32px;--wb-btn-focus:2px solid var(--dsw-alias-brand-primary,#2563eb);--wb-btn-focus-offset:2px}
|
|
4467
|
-
.wb-desc{background:var(--wb-description-bg);border-left-color:var(--wb-description-line);border-radius:0 var(--wb-radius-sm) var(--wb-radius-sm) 0}
|
|
4468
|
-
`;
|
|
4469
|
-
}
|
|
4470
|
-
});
|
|
4471
|
-
|
|
4472
|
-
// packages/addons/lib/data-style.cjs
|
|
4473
|
-
var require_data_style = __commonJS({
|
|
4474
|
-
"packages/addons/lib/data-style.cjs"(exports2, module2) {
|
|
4475
|
-
"use strict";
|
|
4476
|
-
module2.exports = function(DOMAIN, PREFIX) {
|
|
4477
|
-
var P = PREFIX + "-data";
|
|
4478
|
-
var CSS = [
|
|
4479
|
-
require_visual_tokens(),
|
|
4480
|
-
"." + P + "-search:has(.wbi-svg) input{padding-left:30px}." + P + "-search>.wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%)}",
|
|
4481
|
-
"." + P + "-btn{transition:background var(--wb-motion),border-color var(--wb-motion)}",
|
|
4482
|
-
"@media(max-width:480px){." + P + "-head>." + P + "-btn:has(.wbi-svg){width:32px;height:32px;padding:0;justify-content:center}." + P + "-head>." + P + "-btn:has(.wbi-svg) ." + P + "-btnlabel{display:none}}",
|
|
4483
|
-
"." + P + "{--cfg-line:var(--wb-border);--cfg-surface:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));--cfg-muted:var(--dsw-alias-label-secondary,color-mix(in oklab,currentColor 62%,transparent));--cfg-faint:var(--dsw-alias-label-tertiary,color-mix(in oklab,currentColor 42%,transparent));--cfg-hover:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent));display:grid;grid-template-columns:216px minmax(0,1fr);gap:16px;width:100%;min-width:0;color:inherit;font-size:13px;align-items:start}",
|
|
4484
|
-
"." + P + "-side{position:sticky;top:12px;display:flex;flex-direction:column;gap:3px;border:1px solid var(--cfg-line);border-radius:var(--wb-radius-card);background:var(--cfg-surface);padding:8px;box-shadow:0 1px 2px color-mix(in oklab,currentColor 3%,transparent)}",
|
|
4485
|
-
"." + P + "-sidetitle{display:flex;align-items:center;justify-content:space-between;padding:6px 10px 8px;font-size:11px;font-weight:660;letter-spacing:.6px;text-transform:uppercase;color:var(--cfg-faint)}",
|
|
4486
|
-
"." + P + "-stab{display:flex;flex-direction:column;gap:3px;align-items:stretch;border:1px solid transparent;background:transparent;border-radius:9px;padding:8px 10px;font:inherit;color:inherit;text-align:left;cursor:pointer;position:relative;transition:background .12s ease,border-color .12s ease}",
|
|
4487
|
-
"." + P + "-stab:hover{background:var(--cfg-hover)}",
|
|
4488
|
-
"." + P + "-stab:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
|
|
4489
|
-
"." + P + "-stab.on{background:color-mix(in oklab,currentColor 6%,transparent);border-color:var(--cfg-line)}",
|
|
4490
|
-
"." + P + "-stab.on::before{content:'';position:absolute;left:-1px;top:9px;bottom:9px;width:2px;border-radius:2px;background:var(--dsw-alias-brand-primary,currentColor)}",
|
|
4491
|
-
"." + P + "-stabname{display:flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;line-height:1.4;min-width:0}",
|
|
4492
|
-
"." + P + "-stabname span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
4493
|
-
"." + P + "-sidetable{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10.5px;color:var(--cfg-muted);margin-top:3px;letter-spacing:.2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
4494
|
-
"." + P + "-sidecount{margin-left:auto;font-size:10.5px;font-variant-numeric:tabular-nums;color:var(--cfg-muted);background:color-mix(in oklab,currentColor 8%,transparent);border-radius:999px;padding:1px 7px;flex:none}",
|
|
4495
|
-
"." + P + "-main{display:flex;flex-direction:column;gap:10px;min-width:0;border:1px solid var(--cfg-line);border-radius:var(--wb-radius-card);background:var(--cfg-surface);padding:14px 16px 12px;box-shadow:0 1px 2px color-mix(in oklab,currentColor 3%,transparent)}",
|
|
4496
|
-
"." + P + "-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}",
|
|
4497
|
-
"." + P + "-headmain{min-width:0;flex:1}",
|
|
4498
|
-
"." + P + "-head h2{margin:0;font-size:16px;font-weight:660;letter-spacing:.1px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
4499
|
-
"." + P + "-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;font-weight:500;color:var(--cfg-muted);background:color-mix(in oklab,currentColor 6%,transparent);border-radius:6px;padding:2px 6px}",
|
|
4500
|
-
"." + P + "-sub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55;margin-top:4px}",
|
|
4501
|
-
"." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:2px 0 4px}",
|
|
4502
|
-
"." + P + "-search{position:relative;flex:1;min-width:180px;max-width:340px}",
|
|
4503
|
-
"." + P + "-search input{width:100%;border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:8px 11px;font:inherit;font-size:12.5px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}",
|
|
4504
|
-
"." + P + "-search input:hover{border-color:color-mix(in oklab,currentColor 28%,var(--cfg-line))}",
|
|
4505
|
-
"." + P + "-search input:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
|
|
4506
|
-
"." + P + "-select{border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:7px 10px;font:inherit;font-size:12px;outline:none}",
|
|
4507
|
-
"." + P + "-select:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
|
|
4508
|
-
"." + P + "-btn{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--cfg-line);background:transparent;color:var(--cfg-muted);border-radius:8px;padding:6px 10px;font:inherit;font-size:11.5px;cursor:pointer;white-space:nowrap;transition:background .12s ease,color .12s ease}",
|
|
4509
|
-
"." + P + "-btn:hover{background:var(--cfg-hover);color:var(--dsw-alias-label-primary,inherit)}",
|
|
4510
|
-
"." + P + "-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
|
|
4511
|
-
"." + P + "-btn:disabled{opacity:.45;cursor:not-allowed}",
|
|
4512
|
-
"." + P + "-btn[aria-busy='true']{opacity:.6}",
|
|
4513
|
-
"." + P + "-tablewrap{overflow:auto;max-height:calc(100vh - 300px);border:1px solid var(--cfg-line);border-radius:11px;background:var(--dsw-alias-bg-base,transparent)}",
|
|
4514
|
-
"." + P + "-table{border-collapse:separate;border-spacing:0;width:max-content;min-width:100%;font-size:12.5px}",
|
|
4515
|
-
"." + P + "-table th{position:sticky;top:0;z-index:2;background:var(--cfg-surface);border-bottom:1px solid var(--cfg-line);padding:0;text-align:left;font-weight:600;white-space:nowrap}",
|
|
4516
|
-
"." + P + "-thbtn{display:flex;align-items:baseline;gap:6px;width:100%;border:0;background:transparent;color:inherit;font:inherit;font-size:11.5px;font-weight:660;letter-spacing:.2px;padding:9px 12px;cursor:pointer;text-align:left;white-space:nowrap}",
|
|
4517
|
-
"." + P + "-thbtn:hover{background:var(--cfg-hover)}",
|
|
4518
|
-
"." + P + "-thbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:-2px}",
|
|
4519
|
-
"." + P + "-coltype{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9.5px;font-weight:500;color:var(--cfg-faint);letter-spacing:.3px}",
|
|
4520
|
-
"." + P + "-sortmark{color:var(--dsw-alias-brand-primary,currentColor);font-size:10px}",
|
|
4521
|
-
"." + P + "-rownum{position:sticky;left:0;z-index:1;background:var(--cfg-surface);color:var(--cfg-faint);text-align:right;font-variant-numeric:tabular-nums;font-size:10.5px;padding:0 8px;width:1%;white-space:nowrap;border-right:1px solid color-mix(in oklab,currentColor 7%,transparent)}",
|
|
4522
|
-
"." + P + "-table thead ." + P + "-rownum{z-index:3}",
|
|
4523
|
-
"." + P + "-cell{padding:7px 12px;border-bottom:1px solid color-mix(in oklab,currentColor 6%,transparent);max-width:340px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:default;vertical-align:top}",
|
|
4524
|
-
"." + P + "-table tbody tr:hover ." + P + "-cell{background:var(--cfg-hover)}",
|
|
4525
|
-
"." + P + "-table tbody tr:nth-child(even) ." + P + "-cell,." + P + "-table tbody tr:nth-child(even) ." + P + "-rownum{background:color-mix(in oklab,currentColor 2.5%,transparent)}",
|
|
4526
|
-
"." + P + "-cell.num{text-align:right;font-variant-numeric:tabular-nums}",
|
|
4527
|
-
"." + P + "-cell.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
|
|
4528
|
-
"." + P + "-cell.null{color:var(--cfg-faint);font-style:italic}",
|
|
4529
|
-
"." + P + "-cell.json .v{color:var(--dsw-alias-brand-primary,inherit)}",
|
|
4530
|
-
"." + P + "-tr.deleted ." + P + "-cell,." + P + "-tr.deleted ." + P + "-rownum{opacity:.55}",
|
|
4531
|
-
"." + P + "-tr.deleted ." + P + "-cell .v{text-decoration:line-through;text-decoration-color:color-mix(in oklab,currentColor 35%,transparent)}",
|
|
4532
|
-
"." + P + "-delbadge{display:inline-block;margin-left:6px;font-size:9.5px;line-height:1.5;padding:0 5px;border-radius:999px;background:color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 14%,transparent);color:var(--dsw-alias-state-error-primary,inherit);vertical-align:middle}",
|
|
4533
|
-
"." + P + "-foot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-top:2px;font-size:11.5px;color:var(--cfg-muted)}",
|
|
4534
|
-
"." + P + "-grow{flex:1}",
|
|
4535
|
-
"." + P + "-pageinfo{font-variant-numeric:tabular-nums}",
|
|
4536
|
-
"." + P + "-jump .wbctl-num-input{width:56px;padding:4px 7px;font-size:11.5px;text-align:right}",
|
|
4537
|
-
"." + P + "-jump .wbctl-num-hint{display:none}",
|
|
4538
|
-
"." + P + "-empty{border:1px dashed var(--cfg-line);border-radius:11px;padding:44px 16px;text-align:center;font-size:12.5px;color:var(--cfg-muted)}",
|
|
4539
|
-
"." + P + "-err{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 32%,var(--cfg-line));border-radius:10px;padding:9px 12px;color:var(--dsw-alias-state-error-primary,inherit);font-size:12px;line-height:1.5}",
|
|
4540
|
-
"." + P + "-skwrap{display:flex;flex-direction:column;gap:1px;padding:2px}",
|
|
4541
|
-
"." + P + "-sk{height:26px;border-radius:4px;background:var(--dsw-alias-bg-skeleton,color-mix(in oklab,currentColor 6%,transparent));animation:" + PREFIX + "-data-pulse 1.4s ease-in-out infinite}",
|
|
4542
|
-
"@keyframes " + PREFIX + "-data-pulse{0%,100%{opacity:.6}50%{opacity:1}}",
|
|
4543
|
-
"." + P + "-toast{position:fixed;left:50%;bottom:26px;transform:translateX(-50%);z-index:40;background:var(--dsw-alias-bg-layer-1,var(--cfg-surface));border:1px solid var(--cfg-line);border-radius:999px;padding:7px 14px;font-size:12px;color:var(--dsw-alias-label-primary,inherit);box-shadow:0 6px 24px color-mix(in oklab,currentColor 18%,transparent)}",
|
|
4544
|
-
"." + P + "-mask{position:fixed;inset:0;z-index:30;background:color-mix(in oklab,currentColor 26%,transparent)}",
|
|
4545
|
-
"." + P + "-drawer{position:fixed;top:0;right:0;bottom:0;z-index:31;width:min(520px,92vw);display:flex;flex-direction:column;gap:12px;background:var(--dsw-alias-bg-layer-1,var(--cfg-surface));border-left:1px solid var(--cfg-line);box-shadow:-8px 0 28px color-mix(in oklab,currentColor 16%,transparent);padding:18px 20px}",
|
|
4546
|
-
"." + P + "-drawer h3{margin:0;font-size:14px;font-weight:660;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
4547
|
-
"." + P + "-drawer pre{margin:0;flex:1;overflow:auto;border:1px solid var(--cfg-line);border-radius:10px;background:var(--dsw-alias-bg-base,transparent);padding:12px 14px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.65;white-space:pre-wrap;word-break:break-word}",
|
|
4548
|
-
"." + P + "-drawerfoot{display:flex;gap:8px;justify-content:flex-end}",
|
|
4549
|
-
"." + P + "-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}",
|
|
4550
|
-
"@media (max-width:900px){." + P + "{grid-template-columns:minmax(0,1fr)}." + P + "-side{position:static;flex-direction:row;flex-wrap:wrap;gap:6px;padding:6px}." + P + "-sidetitle{display:none}." + P + "-stab{padding:6px 10px;flex:none}." + P + "-sidecount{display:none}." + P + "-tablewrap{max-height:calc(100vh - 260px)}}",
|
|
4551
|
-
"@media (prefers-reduced-motion:reduce){." + P + " *,." + P + "-track,." + P + "-track::after,." + P + "-sk,." + P + "-drawer{transition:none;animation:none}}",
|
|
4552
|
-
"." + P + "-idxsub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55}",
|
|
4553
|
-
"." + P + "-idxsum{display:flex;gap:16px;flex-wrap:wrap;font-size:11.5px;color:var(--cfg-muted)}",
|
|
4554
|
-
"." + P + "-idxsum b{font-weight:660;color:var(--dsw-alias-label-primary,inherit);font-variant-numeric:tabular-nums}",
|
|
4555
|
-
"." + P + "-idxtable{width:100%;table-layout:fixed}." + P + "-idxtable ." + P + "-cell{white-space:normal;overflow-wrap:anywhere;max-width:none}." + P + "-idxtable th:first-child{width:30%}." + P + "-idxtable th:nth-child(2){width:28%}",
|
|
4556
|
-
"." + P + "-idxtags{display:flex;flex-wrap:wrap;gap:4px;max-width:280px}",
|
|
4557
|
-
"." + P + "-idxchip{display:inline-block;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;line-height:1.6;border-radius:999px;padding:0 7px;background:color-mix(in oklab,currentColor 7%,transparent);color:var(--cfg-muted);white-space:nowrap}",
|
|
4558
|
-
"." + P + "-idxchip.u{background:color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 15%,transparent);color:var(--dsw-alias-brand-primary,inherit)}",
|
|
4559
|
-
"." + P + "-idxnone{color:var(--cfg-faint)}",
|
|
4560
|
-
"." + P + "-frow th{padding:0 8px 6px;border-bottom:1px solid var(--cfg-line)}",
|
|
4561
|
-
"." + P + "-fcell{position:relative;display:block;min-width:96px}",
|
|
4562
|
-
"." + P + "-finput{width:100%;box-sizing:border-box;border:1px solid transparent;border-radius:6px;background:color-mix(in oklab,currentColor 4%,transparent);color:inherit;font:inherit;font-size:11.5px;padding:3px 18px 3px 6px;min-width:0}",
|
|
4563
|
-
"." + P + "-finput:hover{background:color-mix(in oklab,currentColor 7%,transparent)}",
|
|
4564
|
-
"." + P + "-finput:focus{outline:none;border-color:var(--dsw-alias-brand-primary,currentColor);background:var(--cfg-surface)}",
|
|
4565
|
-
"." + P + "-fclear{position:absolute;right:2px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:var(--cfg-muted);cursor:pointer;font-size:13px;line-height:1;padding:2px 4px;border-radius:4px}",
|
|
4566
|
-
"." + P + "-fclear:hover{color:inherit;background:var(--cfg-hover)}",
|
|
4567
|
-
"." + P + "-emptycell{padding:22px 12px;text-align:center;color:var(--cfg-muted)}",
|
|
4568
|
-
"." + P + " *{box-sizing:border-box}",
|
|
4569
|
-
"." + P + "-tabs{display:flex;gap:6px;border-bottom:1px solid var(--cfg-line);padding-bottom:9px}",
|
|
4570
|
-
"." + P + "-tabs [aria-selected=true]{background:var(--cfg-hover);color:inherit;font-weight:660}",
|
|
4571
|
-
"." + P + "-images{display:flex;gap:5px;align-items:center}",
|
|
4572
|
-
"." + P + "-images img{width:36px;height:36px;object-fit:cover;border-radius:5px}",
|
|
4573
|
-
"." + P + "-gallery{display:flex;flex-direction:column;gap:12px;overflow:auto;flex:1}",
|
|
4574
|
-
"." + P + "-gallery img{width:100%;height:auto;object-fit:contain;border-radius:8px}"
|
|
4575
|
-
].concat(require_switch().styles).concat(require_number_field().styles).join("\n");
|
|
4576
|
-
if (DOMAIN === "storage") {
|
|
4577
|
-
var buttons = "." + P + " :is(button)";
|
|
4578
|
-
CSS += buttons + "{border:none;background:var(--wb-btn-bg);min-height:var(--wb-btn-size-sm);min-width:var(--wb-btn-size-sm)}" + buttons + ":enabled:hover{background:var(--wb-btn-hover-bg)}" + buttons + ":enabled:active{background:var(--wb-btn-active-bg)}" + buttons + ":disabled{background:var(--wb-btn-bg);color:var(--cfg-muted)}" + buttons + ":focus-visible{outline:var(--wb-btn-focus);outline-offset:var(--wb-btn-focus-offset)}." + P + "-fcell:has(button) input{padding-right:34px}";
|
|
4579
|
-
}
|
|
4580
|
-
function injectCss() {
|
|
4581
|
-
if (typeof document === "undefined") return;
|
|
4582
|
-
var old = document.getElementById("wb-addon-" + DOMAIN + "-data-css");
|
|
4583
|
-
if (old) {
|
|
4584
|
-
old.textContent = CSS;
|
|
4585
|
-
return;
|
|
4586
|
-
}
|
|
4587
|
-
var style = document.createElement("style");
|
|
4588
|
-
style.id = "wb-addon-" + DOMAIN + "-data-css";
|
|
4589
|
-
style.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
|
|
4590
|
-
style.textContent = CSS;
|
|
4591
|
-
document.head.appendChild(style);
|
|
4592
|
-
}
|
|
4593
|
-
return injectCss;
|
|
4594
|
-
};
|
|
4595
|
-
}
|
|
4596
|
-
});
|
|
4597
|
-
|
|
4598
|
-
// packages/addons/lib/data-view.cjs
|
|
4599
|
-
var require_data_view = __commonJS({
|
|
4600
|
-
"packages/addons/lib/data-view.cjs"(exports2, module2) {
|
|
4601
|
-
"use strict";
|
|
4602
|
-
var React = require("react");
|
|
4603
|
-
var NF = require_number_field();
|
|
4604
|
-
var h = React.createElement;
|
|
4605
|
-
var COPY = require_data_copy();
|
|
4606
|
-
var SW = require_switch();
|
|
4607
|
-
module2.exports = function createDataView(options) {
|
|
4608
|
-
var DOMAIN = options.domain;
|
|
4609
|
-
function icon(name) {
|
|
4610
|
-
return options.Icon ? h(options.Icon, { name }) : null;
|
|
4611
|
-
}
|
|
4612
|
-
var P = options.prefix + "-data";
|
|
4613
|
-
var configView = { useConfig: options.useConfig };
|
|
4614
|
-
var columnHooks = options.columns || {};
|
|
4615
|
-
var injectCss = require_data_style()(DOMAIN, options.prefix);
|
|
4616
|
-
var CFG_FALLBACK = {
|
|
4617
|
-
"data.pageSize": 50,
|
|
4618
|
-
"data.showSystemColumns": false,
|
|
4619
|
-
"data.includeDeleted": false
|
|
4620
|
-
};
|
|
4621
|
-
var PAGE_SIZES = [10, 25, 50, 100, 200];
|
|
4622
|
-
function unwrap(r) {
|
|
4623
|
-
return r && r.result !== void 0 ? r.result : r;
|
|
4624
|
-
}
|
|
4625
|
-
function fmt(template, vars) {
|
|
4626
|
-
return String(template).replace(/\{(\w+)\}/g, function(m, key) {
|
|
4627
|
-
return vars[key] === void 0 ? m : String(vars[key]);
|
|
4628
|
-
});
|
|
4629
|
-
}
|
|
4630
|
-
function pad2(n) {
|
|
4631
|
-
return n < 10 ? "0" + n : String(n);
|
|
4632
|
-
}
|
|
4633
|
-
function timeText(ms) {
|
|
4634
|
-
var d = new Date(Number(ms));
|
|
4635
|
-
if (!Number.isFinite(d.getTime())) return String(ms);
|
|
4636
|
-
return d.getFullYear() + "-" + pad2(d.getMonth() + 1) + "-" + pad2(d.getDate()) + " " + pad2(d.getHours()) + ":" + pad2(d.getMinutes());
|
|
4637
|
-
}
|
|
4638
|
-
function looksJson(value) {
|
|
4639
|
-
var text = String(value).trim();
|
|
4640
|
-
if (!text || text[0] !== "{" && text[0] !== "[") return false;
|
|
4641
|
-
try {
|
|
4642
|
-
JSON.parse(text);
|
|
4643
|
-
return true;
|
|
4644
|
-
} catch (e) {
|
|
4645
|
-
return false;
|
|
4646
|
-
}
|
|
4647
|
-
}
|
|
4648
|
-
function rawText(value, col) {
|
|
4649
|
-
if (value === null || value === void 0) return "";
|
|
4650
|
-
return String(value);
|
|
4651
|
-
}
|
|
4652
|
-
function DataView(props) {
|
|
4653
|
-
var api = props.api;
|
|
4654
|
-
var lang = props.lang === "en" ? "en" : "zh";
|
|
4655
|
-
var t = Object.assign({}, COPY[lang], { indexSub: fmt(COPY[lang].indexSub, { tables: options.tables.join(" / "), domain: DOMAIN }) });
|
|
4656
|
-
var cfgWrap = configView.useConfig(api, CFG_FALLBACK);
|
|
4657
|
-
var cfg = cfgWrap.values;
|
|
4658
|
-
var tablesS = React.useState(null);
|
|
4659
|
-
var tables = tablesS[0], setTables = tablesS[1];
|
|
4660
|
-
var activeS = React.useState("");
|
|
4661
|
-
var active = activeS[0], setActive = activeS[1];
|
|
4662
|
-
var dataS = React.useState(null);
|
|
4663
|
-
var data = dataS[0], setData = dataS[1];
|
|
4664
|
-
var loadingS = React.useState(false);
|
|
4665
|
-
var loadingRows = loadingS[0], setLoadingRows = loadingS[1];
|
|
4666
|
-
var loadingTablesS = React.useState(true);
|
|
4667
|
-
var loadingTables = loadingTablesS[0], setLoadingTables = loadingTablesS[1];
|
|
4668
|
-
var errorS = React.useState("");
|
|
4669
|
-
var error = errorS[0], setError = errorS[1];
|
|
4670
|
-
var pageS = React.useState(1);
|
|
4671
|
-
var page = pageS[0], setPage = pageS[1];
|
|
4672
|
-
var sizeS = React.useState(0);
|
|
4673
|
-
var pageSize = sizeS[0], setPageSize = sizeS[1];
|
|
4674
|
-
var sortS = React.useState("");
|
|
4675
|
-
var sort = sortS[0], setSort = sortS[1];
|
|
4676
|
-
var orderS = React.useState("desc");
|
|
4677
|
-
var order = orderS[0], setOrder = orderS[1];
|
|
4678
|
-
var searchDraftS = React.useState("");
|
|
4679
|
-
var searchDraft = searchDraftS[0], setSearchDraft = searchDraftS[1];
|
|
4680
|
-
var searchS = React.useState("");
|
|
4681
|
-
var search = searchS[0], setSearch = searchS[1];
|
|
4682
|
-
var filterDraftS = React.useState({});
|
|
4683
|
-
var filterDraft = filterDraftS[0], setFilterDraft = filterDraftS[1];
|
|
4684
|
-
var filtersS = React.useState({});
|
|
4685
|
-
var filters = filtersS[0], setFilters = filtersS[1];
|
|
4686
|
-
var includeDeletedS = React.useState(null);
|
|
4687
|
-
var includeDeletedRaw = includeDeletedS[0], setIncludeDeleted = includeDeletedS[1];
|
|
4688
|
-
var showSystemS = React.useState(null);
|
|
4689
|
-
var showSystemRaw = showSystemS[0], setShowSystem = showSystemS[1];
|
|
4690
|
-
var drawerS = React.useState(null);
|
|
4691
|
-
var drawer = drawerS[0], setDrawer = drawerS[1];
|
|
4692
|
-
var toastS = React.useState("");
|
|
4693
|
-
var toast = toastS[0], setToast = toastS[1];
|
|
4694
|
-
var filtersKey = JSON.stringify(filters);
|
|
4695
|
-
var reqRef = React.useRef(0);
|
|
4696
|
-
var toastTimer = React.useRef(null);
|
|
4697
|
-
var refreshS = React.useState(0);
|
|
4698
|
-
function refresh() {
|
|
4699
|
-
loadTables();
|
|
4700
|
-
refreshS[1](function(n) {
|
|
4701
|
-
return n + 1;
|
|
4702
|
-
});
|
|
4703
|
-
}
|
|
4704
|
-
var indexReqRef = React.useRef(0);
|
|
4705
|
-
var indexS = React.useState(null);
|
|
4706
|
-
var index = indexS[0], setIndex = indexS[1];
|
|
4707
|
-
var indexBusyS = React.useState(false);
|
|
4708
|
-
var indexBusy = indexBusyS[0], setIndexBusy = indexBusyS[1];
|
|
4709
|
-
var cfgSize = Number(cfg["data.pageSize"]) || 50;
|
|
4710
|
-
var size = pageSize || (PAGE_SIZES.indexOf(cfgSize) >= 0 ? cfgSize : 50);
|
|
4711
|
-
var includeDeleted = includeDeletedRaw === null ? cfg["data.includeDeleted"] === true : includeDeletedRaw;
|
|
4712
|
-
var showSystem = showSystemRaw === null ? cfg["data.showSystemColumns"] === true : showSystemRaw;
|
|
4713
|
-
function say(text) {
|
|
4714
|
-
setToast(text);
|
|
4715
|
-
if (toastTimer.current) clearTimeout(toastTimer.current);
|
|
4716
|
-
toastTimer.current = setTimeout(function() {
|
|
4717
|
-
setToast("");
|
|
4718
|
-
}, 1600);
|
|
4719
|
-
}
|
|
4720
|
-
function loadTables() {
|
|
4721
|
-
setLoadingTables(true);
|
|
4722
|
-
Promise.resolve((options.tablesLoader || function(a) {
|
|
4723
|
-
return a.call(DOMAIN + ".dataTables");
|
|
4724
|
-
})(api)).then(function(r) {
|
|
4725
|
-
if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
|
|
4726
|
-
var body = unwrap(r);
|
|
4727
|
-
if (!body || !Array.isArray(body.tables)) throw new Error(t.loadFail);
|
|
4728
|
-
setTables(body.tables);
|
|
4729
|
-
setError("");
|
|
4730
|
-
if (!active && body.tables.length) setActive(body.tables[0].name);
|
|
4731
|
-
}).catch(function(e) {
|
|
4732
|
-
setError(String(e && e.message || e) || t.loadFail);
|
|
4733
|
-
}).then(function() {
|
|
4734
|
-
setLoadingTables(false);
|
|
4735
|
-
});
|
|
4736
|
-
}
|
|
4737
|
-
React.useEffect(function() {
|
|
4738
|
-
injectCss();
|
|
4739
|
-
loadTables();
|
|
4740
|
-
return function() {
|
|
4741
|
-
indexReqRef.current++;
|
|
4742
|
-
if (toastTimer.current) clearTimeout(toastTimer.current);
|
|
4743
|
-
};
|
|
4744
|
-
}, []);
|
|
4745
|
-
function selectTable(name) {
|
|
4746
|
-
if (name === active) return;
|
|
4747
|
-
reqRef.current++;
|
|
4748
|
-
setActive(name);
|
|
4749
|
-
setData(null);
|
|
4750
|
-
setDrawer(null);
|
|
4751
|
-
setError("");
|
|
4752
|
-
setLoadingRows(true);
|
|
4753
|
-
setPage(1);
|
|
4754
|
-
setSort("");
|
|
4755
|
-
setOrder("desc");
|
|
4756
|
-
setSearch("");
|
|
4757
|
-
setSearchDraft("");
|
|
4758
|
-
setFilterDraft({});
|
|
4759
|
-
setFilters({});
|
|
4760
|
-
}
|
|
4761
|
-
React.useEffect(function() {
|
|
4762
|
-
if (searchDraft === search) return void 0;
|
|
4763
|
-
var timer = setTimeout(function() {
|
|
4764
|
-
setSearch(searchDraft);
|
|
4765
|
-
setPage(1);
|
|
4766
|
-
}, 280);
|
|
4767
|
-
return function() {
|
|
4768
|
-
clearTimeout(timer);
|
|
4769
|
-
};
|
|
4770
|
-
}, [searchDraft]);
|
|
4771
|
-
React.useEffect(function() {
|
|
4772
|
-
if (JSON.stringify(filterDraft) === JSON.stringify(filters)) return void 0;
|
|
4773
|
-
var timer = setTimeout(function() {
|
|
4774
|
-
setFilters(filterDraft);
|
|
4775
|
-
setPage(1);
|
|
4776
|
-
}, 280);
|
|
4777
|
-
return function() {
|
|
4778
|
-
clearTimeout(timer);
|
|
4779
|
-
};
|
|
4780
|
-
}, [filterDraft]);
|
|
4781
|
-
React.useEffect(function() {
|
|
4782
|
-
if (!active || !cfgWrap.ready || index) return void 0;
|
|
4783
|
-
var req = ++reqRef.current;
|
|
4784
|
-
setLoadingRows(true);
|
|
4785
|
-
var args = { table: active, page, pageSize: size, order, includeDeleted };
|
|
4786
|
-
if (sort) args.sort = sort;
|
|
4787
|
-
if (search) args.search = search;
|
|
4788
|
-
if (Object.keys(filters).length) args.filters = filters;
|
|
4789
|
-
Promise.resolve((options.query || function(a, q) {
|
|
4790
|
-
return a.call(DOMAIN + ".dataQuery", q);
|
|
4791
|
-
})(api, args)).then(function(r) {
|
|
4792
|
-
if (req !== reqRef.current) return;
|
|
4793
|
-
if (r && r.ok === false) throw new Error(r && r.error || t.queryFail);
|
|
4794
|
-
var body = unwrap(r);
|
|
4795
|
-
if (!body) throw new Error(t.queryFail);
|
|
4796
|
-
setData(body);
|
|
4797
|
-
setError("");
|
|
4798
|
-
if (body.page !== page) setPage(body.page);
|
|
4799
|
-
}).catch(function(e) {
|
|
4800
|
-
if (req !== reqRef.current) return;
|
|
4801
|
-
setError(String(e && e.message || e) || t.queryFail);
|
|
4802
|
-
}).then(function() {
|
|
4803
|
-
if (req === reqRef.current) setLoadingRows(false);
|
|
4804
|
-
});
|
|
4805
|
-
return function() {
|
|
4806
|
-
reqRef.current++;
|
|
4807
|
-
};
|
|
4808
|
-
}, [active, page, size, sort, order, search, includeDeleted, cfgWrap.ready, filtersKey, refreshS[0], !!index]);
|
|
4809
|
-
React.useEffect(function() {
|
|
4810
|
-
if (!drawer) return void 0;
|
|
4811
|
-
function onKey(e) {
|
|
4812
|
-
if (e.key === "Escape") setDrawer(null);
|
|
4813
|
-
}
|
|
4814
|
-
document.addEventListener("keydown", onKey);
|
|
4815
|
-
return function() {
|
|
4816
|
-
document.removeEventListener("keydown", onKey);
|
|
4817
|
-
};
|
|
4818
|
-
}, [drawer]);
|
|
4819
|
-
var current = null;
|
|
4820
|
-
if (tables) {
|
|
4821
|
-
for (var i = 0; i < tables.length; i++) if (tables[i].name === active) current = tables[i];
|
|
4822
|
-
}
|
|
4823
|
-
function leaveIndex() {
|
|
4824
|
-
indexReqRef.current++;
|
|
4825
|
-
setIndex(null);
|
|
4826
|
-
setIndexBusy(false);
|
|
4827
|
-
setError("");
|
|
4828
|
-
}
|
|
4829
|
-
function loadIndex() {
|
|
4830
|
-
reqRef.current++;
|
|
4831
|
-
setError("");
|
|
4832
|
-
var req = ++indexReqRef.current;
|
|
4833
|
-
setIndex([]);
|
|
4834
|
-
setIndexBusy(true);
|
|
4835
|
-
Promise.resolve(api.call(DOMAIN + ".dataTables", { stats: true })).then(function(r) {
|
|
4836
|
-
if (req !== indexReqRef.current) return;
|
|
4837
|
-
if (r && r.ok === false) throw new Error(r.error || t.loadFail);
|
|
4838
|
-
var payload = unwrap(r) || {};
|
|
4839
|
-
var rows = (payload.tables || []).map(function(tb) {
|
|
4840
|
-
return { table: tb, stats: tb.stats || null };
|
|
4841
|
-
});
|
|
4842
|
-
setIndex(rows);
|
|
4843
|
-
setError("");
|
|
4844
|
-
setIndexBusy(false);
|
|
4845
|
-
}).catch(function(e) {
|
|
4846
|
-
if (req !== indexReqRef.current) return;
|
|
4847
|
-
setError(String(e.message || e));
|
|
4848
|
-
setIndex([]);
|
|
4849
|
-
setIndexBusy(false);
|
|
4850
|
-
});
|
|
4851
|
-
}
|
|
4852
|
-
function renderIndex() {
|
|
4853
|
-
var row = (index || []).filter(function(r) {
|
|
4854
|
-
return r.table.name === active;
|
|
4855
|
-
})[0];
|
|
4856
|
-
var tb = row ? row.table : current;
|
|
4857
|
-
var st = row && row.stats;
|
|
4858
|
-
var indexes = st ? st.indexes || [] : [];
|
|
4859
|
-
var hasExtra = indexes.some(function(ix) {
|
|
4860
|
-
return ix.origin !== "pk";
|
|
4861
|
-
});
|
|
4862
|
-
var count = st && st.rows !== void 0 ? st.rows : tb && tb.count;
|
|
4863
|
-
return h(
|
|
4864
|
-
"div",
|
|
4865
|
-
{ className: P + "-idx" },
|
|
4866
|
-
h(
|
|
4867
|
-
"div",
|
|
4868
|
-
{ className: P + "-head" },
|
|
4869
|
-
h(
|
|
4870
|
-
"div",
|
|
4871
|
-
{ className: P + "-headmain" },
|
|
4872
|
-
h("h2", null, icon("database"), tableLabel(tb), h("span", { className: P + "-code" }, active)),
|
|
4873
|
-
h("div", { className: P + "-idxsub" }, t.indexSub)
|
|
4874
|
-
),
|
|
4875
|
-
h("button", {
|
|
4876
|
-
type: "button",
|
|
4877
|
-
className: P + "-btn",
|
|
4878
|
-
"aria-label": t.refresh,
|
|
4879
|
-
title: t.refresh,
|
|
4880
|
-
"aria-busy": indexBusy ? "true" : "false",
|
|
4881
|
-
onClick: function() {
|
|
4882
|
-
loadIndex();
|
|
4883
|
-
}
|
|
4884
|
-
}, icon("refresh"), h("span", { className: P + "-btnlabel" }, t.refresh))
|
|
4885
|
-
),
|
|
4886
|
-
st ? h(
|
|
4887
|
-
"div",
|
|
4888
|
-
{ className: P + "-idxsum" },
|
|
4889
|
-
h("span", null, t.idxRows, " ", h("b", null, String(count))),
|
|
4890
|
-
h("span", null, t.idxCols, " ", h("b", null, String(st.columnCount === void 0 ? (tb.columns || []).length : st.columnCount))),
|
|
4891
|
-
h("span", null, fmt(t.idxCount, { n: indexes.length }))
|
|
4892
|
-
) : null,
|
|
4893
|
-
indexBusy ? options.Skeleton ? h(options.Skeleton, { lang, label: t.loading }) : h("div", { className: P + "-empty", role: "status", "aria-busy": "true" }, t.loading) : !st ? h("div", { className: P + "-empty" }, t.idxEmpty) : !hasExtra ? h("div", { className: P + "-empty" }, t.idxNoExtra) : h(
|
|
4894
|
-
"div",
|
|
4895
|
-
{ className: P + "-tablewrap" },
|
|
4896
|
-
h(
|
|
4897
|
-
"table",
|
|
4898
|
-
{ className: P + "-table " + P + "-idxtable" },
|
|
4899
|
-
h("thead", null, h(
|
|
4900
|
-
"tr",
|
|
4901
|
-
null,
|
|
4902
|
-
[t.idxName, t.idxColumns, t.idxType, t.idxSource, t.idxRows].map(function(label) {
|
|
4903
|
-
return h("th", { scope: "col", key: label }, h("span", { className: P + "-thbtn" }, label));
|
|
4904
|
-
})
|
|
4905
|
-
)),
|
|
4906
|
-
h("tbody", null, indexes.map(function(ix) {
|
|
4907
|
-
return h(
|
|
4908
|
-
"tr",
|
|
4909
|
-
{ className: P + "-tr", key: ix.name },
|
|
4910
|
-
h("td", { className: P + "-cell mono" }, ix.name),
|
|
4911
|
-
h("td", { className: P + "-cell mono" }, (ix.columns || []).join(", ") || t.idxNone),
|
|
4912
|
-
h("td", { className: P + "-cell" }, ix.origin === "pk" ? t.idxKey : ix.unique ? t.idxUnique : t.idxNormal),
|
|
4913
|
-
h("td", { className: P + "-cell" }, /^sqlite_autoindex_/.test(ix.name) ? t.idxAuto : t.idxCreated),
|
|
4914
|
-
h("td", { className: P + "-cell num", title: t.idxRowsHelp }, String(count))
|
|
4915
|
-
);
|
|
4916
|
-
}))
|
|
4917
|
-
)
|
|
4918
|
-
)
|
|
4919
|
-
);
|
|
4920
|
-
}
|
|
4921
|
-
function tableLabel(tb) {
|
|
4922
|
-
if (!tb || !tb.label) return "";
|
|
4923
|
-
return lang === "en" ? tb.label.en || tb.label.zh : tb.label.zh || tb.label.en;
|
|
4924
|
-
}
|
|
4925
|
-
function colLabel(col) {
|
|
4926
|
-
if (!col.label) return col.name;
|
|
4927
|
-
return lang === "en" ? col.label.en || col.label.zh : col.label.zh || col.label.en;
|
|
4928
|
-
}
|
|
4929
|
-
function visibleColumns() {
|
|
4930
|
-
var cols = data && data.columns ? data.columns.map(function(col) {
|
|
4931
|
-
var hook = columnHooks[col.name];
|
|
4932
|
-
return hook && hook.kind ? Object.assign({}, col, { kind: hook.kind, type: hook.type || col.type }) : col;
|
|
4933
|
-
}) : [];
|
|
4934
|
-
return cols.filter(function(c) {
|
|
4935
|
-
return showSystem || !c.system;
|
|
4936
|
-
});
|
|
4937
|
-
}
|
|
4938
|
-
function toggleSort(name) {
|
|
4939
|
-
if (sort !== name) {
|
|
4940
|
-
setSort(name);
|
|
4941
|
-
setOrder("desc");
|
|
4942
|
-
return;
|
|
4943
|
-
}
|
|
4944
|
-
if (order === "desc") {
|
|
4945
|
-
setOrder("asc");
|
|
4946
|
-
return;
|
|
4947
|
-
}
|
|
4948
|
-
setSort("");
|
|
4949
|
-
setOrder("desc");
|
|
4950
|
-
}
|
|
4951
|
-
function ariaSort(name) {
|
|
4952
|
-
if (sort !== name) return "none";
|
|
4953
|
-
return order === "asc" ? "ascending" : "descending";
|
|
4954
|
-
}
|
|
4955
|
-
function copyCell(value) {
|
|
4956
|
-
var text = value === null || value === void 0 ? "" : String(value);
|
|
4957
|
-
try {
|
|
4958
|
-
if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(text);
|
|
4959
|
-
else {
|
|
4960
|
-
var ta = document.createElement("textarea");
|
|
4961
|
-
ta.value = text;
|
|
4962
|
-
ta.style.position = "fixed";
|
|
4963
|
-
ta.style.opacity = "0";
|
|
4964
|
-
document.body.appendChild(ta);
|
|
4965
|
-
ta.select();
|
|
4966
|
-
document.execCommand("copy");
|
|
4967
|
-
document.body.removeChild(ta);
|
|
4968
|
-
}
|
|
4969
|
-
say(t.copied);
|
|
4970
|
-
} catch (e) {
|
|
4971
|
-
}
|
|
4972
|
-
}
|
|
4973
|
-
function cellText(col, value) {
|
|
4974
|
-
if (value === null || value === void 0) return null;
|
|
4975
|
-
if (col.kind === "bool") return value ? t.yes : t.no;
|
|
4976
|
-
if (col.kind === "timestamp") return timeText(value);
|
|
4977
|
-
return String(value);
|
|
4978
|
-
}
|
|
4979
|
-
function cellClass(col, value) {
|
|
4980
|
-
var cls = P + "-cell";
|
|
4981
|
-
if (value === null || value === void 0) return cls + " null";
|
|
4982
|
-
if (col.kind === "number") return cls + " num";
|
|
4983
|
-
if (col.kind === "id" || col.kind === "path") return cls + " mono";
|
|
4984
|
-
if (col.kind === "text" && looksJson(value)) return cls + " json";
|
|
4985
|
-
return cls;
|
|
4986
|
-
}
|
|
4987
|
-
function cellTitle(col, value) {
|
|
4988
|
-
if (value === null || value === void 0) return t.nullText;
|
|
4989
|
-
if (col.kind === "timestamp") return String(value);
|
|
4990
|
-
if (col.kind === "bool") return value ? "1" : "0";
|
|
4991
|
-
return String(value);
|
|
4992
|
-
}
|
|
4993
|
-
function renderCell(row, col) {
|
|
4994
|
-
var value = row[col.name];
|
|
4995
|
-
var hook = columnHooks[col.name];
|
|
4996
|
-
function openDetail() {
|
|
4997
|
-
setDrawer({ column: colLabel(col), name: col.name, row: (data.page - 1) * data.pageSize + row.__i + 1, value });
|
|
4998
|
-
}
|
|
4999
|
-
var text = cellText(col, value);
|
|
5000
|
-
var content;
|
|
5001
|
-
if (text === null) content = h("span", { className: "v" }, t.nullText);
|
|
5002
|
-
else if (text === "") content = h("span", { className: "v" }, '""');
|
|
5003
|
-
else content = h("span", { className: "v" }, text);
|
|
5004
|
-
if (hook && hook.render) content = hook.render({ value, row, col, lang, prefix: P, openDetail });
|
|
5005
|
-
return h("td", {
|
|
5006
|
-
key: col.name,
|
|
5007
|
-
className: cellClass(col, value),
|
|
5008
|
-
title: cellTitle(col, value),
|
|
5009
|
-
onClick: function() {
|
|
5010
|
-
copyCell(value);
|
|
5011
|
-
},
|
|
5012
|
-
onDoubleClick: openDetail
|
|
5013
|
-
}, content);
|
|
5014
|
-
}
|
|
5015
|
-
function activeFilterCount() {
|
|
5016
|
-
var n = 0;
|
|
5017
|
-
for (var k in filters) if (Object.prototype.hasOwnProperty.call(filters, k)) n++;
|
|
5018
|
-
return n;
|
|
5019
|
-
}
|
|
5020
|
-
function filterCell(col) {
|
|
5021
|
-
var val = filterDraft[col.name] === void 0 ? "" : filterDraft[col.name];
|
|
5022
|
-
return h(
|
|
5023
|
-
"th",
|
|
5024
|
-
{ key: col.name, scope: "col", className: P + "-fth" },
|
|
5025
|
-
h(
|
|
5026
|
-
"span",
|
|
5027
|
-
{ className: P + "-fcell" },
|
|
5028
|
-
h("input", {
|
|
5029
|
-
className: P + "-finput",
|
|
5030
|
-
type: "search",
|
|
5031
|
-
value: val,
|
|
5032
|
-
placeholder: t.filterCol,
|
|
5033
|
-
"aria-label": t.filterCol + " " + colLabel(col),
|
|
5034
|
-
title: colLabel(col) + " \xB7 " + t.filterCol,
|
|
5035
|
-
onChange: function(e) {
|
|
5036
|
-
var v = e.target.value;
|
|
5037
|
-
setFilterDraft(function(prev) {
|
|
5038
|
-
var next = Object.assign({}, prev);
|
|
5039
|
-
if (v) next[col.name] = v;
|
|
5040
|
-
else delete next[col.name];
|
|
5041
|
-
return next;
|
|
5042
|
-
});
|
|
5043
|
-
}
|
|
5044
|
-
}),
|
|
5045
|
-
val ? h("button", {
|
|
5046
|
-
type: "button",
|
|
5047
|
-
className: P + "-fclear",
|
|
5048
|
-
title: t.filterClear,
|
|
5049
|
-
"aria-label": t.filterClear + " " + colLabel(col),
|
|
5050
|
-
onClick: function() {
|
|
5051
|
-
setFilterDraft(function(prev) {
|
|
5052
|
-
var next = Object.assign({}, prev);
|
|
5053
|
-
delete next[col.name];
|
|
5054
|
-
return next;
|
|
5055
|
-
});
|
|
5056
|
-
}
|
|
5057
|
-
}, "\xD7") : null
|
|
5058
|
-
)
|
|
5059
|
-
);
|
|
5060
|
-
}
|
|
5061
|
-
function renderRows() {
|
|
5062
|
-
if (loadingRows && !data && options.Skeleton) return h(options.Skeleton, { lang, label: t.loading });
|
|
5063
|
-
if (loadingRows && !data) {
|
|
5064
|
-
return h(
|
|
5065
|
-
"div",
|
|
5066
|
-
{ className: P + "-skwrap", "aria-busy": "true" },
|
|
5067
|
-
h("span", { className: P + "-sr" }, t.loading),
|
|
5068
|
-
[0, 1, 2, 3, 4, 5, 6, 7].map(function(i2) {
|
|
5069
|
-
return h("div", { key: i2, className: P + "-sk" });
|
|
5070
|
-
})
|
|
5071
|
-
);
|
|
5072
|
-
}
|
|
5073
|
-
if (error) {
|
|
5074
|
-
return h(
|
|
5075
|
-
"div",
|
|
5076
|
-
{ className: P + "-err", role: "alert" },
|
|
5077
|
-
h("span", null, t.queryFail + error),
|
|
5078
|
-
h("button", { type: "button", className: P + "-btn", onClick: refresh }, t.retry)
|
|
5079
|
-
);
|
|
5080
|
-
}
|
|
5081
|
-
if (!data) return h("div", { className: P + "-empty" }, t.empty);
|
|
5082
|
-
var cols = visibleColumns();
|
|
5083
|
-
var rows = data.rows || [];
|
|
5084
|
-
var narrowing = !!search || activeFilterCount() > 0;
|
|
5085
|
-
return h(
|
|
5086
|
-
"div",
|
|
5087
|
-
{ className: P + "-tablewrap" },
|
|
5088
|
-
h(
|
|
5089
|
-
"table",
|
|
5090
|
-
{ className: P + "-table" },
|
|
5091
|
-
h(
|
|
5092
|
-
"thead",
|
|
5093
|
-
null,
|
|
5094
|
-
h(
|
|
5095
|
-
"tr",
|
|
5096
|
-
null,
|
|
5097
|
-
h("th", { className: P + "-rownum", scope: "col" }, "#"),
|
|
5098
|
-
cols.map(function(col) {
|
|
5099
|
-
return h(
|
|
5100
|
-
"th",
|
|
5101
|
-
{ key: col.name, scope: "col", "aria-sort": ariaSort(col.name) },
|
|
5102
|
-
h(
|
|
5103
|
-
"button",
|
|
5104
|
-
{
|
|
5105
|
-
type: "button",
|
|
5106
|
-
className: P + "-thbtn",
|
|
5107
|
-
title: colLabel(col) + " \xB7 " + col.type,
|
|
5108
|
-
onClick: function() {
|
|
5109
|
-
toggleSort(col.name);
|
|
5110
|
-
}
|
|
5111
|
-
},
|
|
5112
|
-
h("span", null, colLabel(col)),
|
|
5113
|
-
h("span", { className: P + "-coltype" }, String(col.type || "").toLowerCase()),
|
|
5114
|
-
sort === col.name ? h("span", { className: P + "-sortmark", "aria-hidden": "true" }, order === "asc" ? "\u25B2" : "\u25BC") : null
|
|
5115
|
-
)
|
|
5116
|
-
);
|
|
5117
|
-
})
|
|
5118
|
-
),
|
|
5119
|
-
h(
|
|
5120
|
-
"tr",
|
|
5121
|
-
{ className: P + "-frow" },
|
|
5122
|
-
h("th", { className: P + "-rownum", scope: "col" }, ""),
|
|
5123
|
-
cols.map(filterCell)
|
|
5124
|
-
)
|
|
5125
|
-
),
|
|
5126
|
-
h("tbody", null, rows.length ? rows.map(function(row, idx) {
|
|
5127
|
-
row.__i = idx;
|
|
5128
|
-
var deleted = row.deleted_at !== null && row.deleted_at !== void 0;
|
|
5129
|
-
return h(
|
|
5130
|
-
"tr",
|
|
5131
|
-
{ key: row.id || idx, className: P + "-tr" + (deleted ? " deleted" : "") },
|
|
5132
|
-
h("td", { className: P + "-rownum" }, (data.page - 1) * data.pageSize + idx + 1),
|
|
5133
|
-
cols.map(function(col) {
|
|
5134
|
-
var cell = renderCell(row, col);
|
|
5135
|
-
if (deleted && col.name === "id") {
|
|
5136
|
-
return React.cloneElement(cell, { key: col.name }, cell.props.children, h("span", { className: P + "-delbadge" }, t.deleted));
|
|
5137
|
-
}
|
|
5138
|
-
return cell;
|
|
5139
|
-
})
|
|
5140
|
-
);
|
|
5141
|
-
}) : h("tr", null, h("td", { className: P + "-emptycell", colSpan: cols.length + 1 }, narrowing ? t.noRows : t.empty)))
|
|
5142
|
-
)
|
|
5143
|
-
);
|
|
5144
|
-
}
|
|
5145
|
-
function renderFoot() {
|
|
5146
|
-
var pages = data ? data.pages : 1;
|
|
5147
|
-
var total = data ? data.total : 0;
|
|
5148
|
-
return h(
|
|
5149
|
-
"div",
|
|
5150
|
-
{ className: P + "-foot" },
|
|
5151
|
-
h("span", null, fmt(t.total, { n: total })),
|
|
5152
|
-
h("span", { className: P + "-grow" }),
|
|
5153
|
-
h("button", { type: "button", className: P + "-btn", disabled: !data || page <= 1, onClick: function() {
|
|
5154
|
-
setPage(Math.max(1, page - 1));
|
|
5155
|
-
} }, "\u2039 " + t.prev),
|
|
5156
|
-
h("span", { className: P + "-pageinfo" }, fmt(t.pageInfo, { page: data ? data.page : 1, pages })),
|
|
5157
|
-
h("button", { type: "button", className: P + "-btn", disabled: !data || page >= pages, onClick: function() {
|
|
5158
|
-
setPage(Math.min(pages, page + 1));
|
|
5159
|
-
} }, t.next + " \u203A"),
|
|
5160
|
-
h(NF.NumberField, {
|
|
5161
|
-
h,
|
|
5162
|
-
lang,
|
|
5163
|
-
className: P + "-jump",
|
|
5164
|
-
value: page,
|
|
5165
|
-
min: 1,
|
|
5166
|
-
max: pages,
|
|
5167
|
-
integer: true,
|
|
5168
|
-
ariaLabel: t.jump,
|
|
5169
|
-
hint: false,
|
|
5170
|
-
onCommit: function(next) {
|
|
5171
|
-
if (next !== null) setPage(next);
|
|
5172
|
-
}
|
|
5173
|
-
}),
|
|
5174
|
-
data && data.queryMs !== void 0 ? h("span", null, fmt(t.queryTime, { n: data.queryMs })) : null
|
|
5175
|
-
);
|
|
5176
|
-
}
|
|
5177
|
-
if (!tables && loadingTables && options.Skeleton) return h(options.Skeleton, { lang, label: t.loading });
|
|
5178
|
-
if (!tables && loadingTables) {
|
|
5179
|
-
return h("div", { className: P + "-skwrap", "aria-busy": "true" }, h("span", { className: P + "-sr" }, t.loading), [0, 1, 2, 3].map(function(i2) {
|
|
5180
|
-
return h("div", { key: i2, className: P + "-sk" });
|
|
5181
|
-
}));
|
|
5182
|
-
}
|
|
5183
|
-
if (!tables) {
|
|
5184
|
-
return h("div", { className: P + "-err", role: "alert" }, h("span", null, t.loadFail), h("button", { type: "button", className: P + "-btn", onClick: loadTables }, t.retry));
|
|
5185
|
-
}
|
|
5186
|
-
if (!tables.length) return h("div", { className: P + "-empty" }, t.emptyTable);
|
|
5187
|
-
return h(
|
|
5188
|
-
"div",
|
|
5189
|
-
{ className: P },
|
|
5190
|
-
h(
|
|
5191
|
-
"div",
|
|
5192
|
-
{ className: P + "-side" },
|
|
5193
|
-
h("div", { className: P + "-sidetitle" }, h("span", null, icon("table"), t.tables), h("span", null, String(tables.length))),
|
|
5194
|
-
tables.map(function(tb) {
|
|
5195
|
-
return h(
|
|
5196
|
-
"button",
|
|
5197
|
-
{
|
|
5198
|
-
key: tb.name,
|
|
5199
|
-
type: "button",
|
|
5200
|
-
className: P + "-stab" + (tb.name === active ? " on" : ""),
|
|
5201
|
-
"aria-pressed": tb.name === active,
|
|
5202
|
-
onClick: function() {
|
|
5203
|
-
selectTable(tb.name);
|
|
5204
|
-
}
|
|
5205
|
-
},
|
|
5206
|
-
h(
|
|
5207
|
-
"span",
|
|
5208
|
-
{ className: P + "-stabname" },
|
|
5209
|
-
h("span", null, tableLabel(tb)),
|
|
5210
|
-
h("span", { className: P + "-sidecount" }, tb.count === void 0 || tb.count === null ? "" : String(tb.count))
|
|
5211
|
-
),
|
|
5212
|
-
h("span", { className: P + "-sidetable" }, tb.name)
|
|
5213
|
-
);
|
|
5214
|
-
})
|
|
5215
|
-
),
|
|
5216
|
-
h(
|
|
5217
|
-
"div",
|
|
5218
|
-
{ className: P + "-main" },
|
|
5219
|
-
h(
|
|
5220
|
-
"div",
|
|
5221
|
-
{ className: P + "-tabs", role: "tablist", "aria-label": t.title },
|
|
5222
|
-
h("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !index, onClick: leaveIndex }, icon("list"), lang === "en" ? "Row data" : "\u884C\u6570\u636E"),
|
|
5223
|
-
h("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !!index, onClick: loadIndex }, icon("database"), t.index)
|
|
5224
|
-
),
|
|
5225
|
-
index && error ? h("div", { className: P + "-err", role: "alert" }, error) : null,
|
|
5226
|
-
index ? renderIndex() : [
|
|
5227
|
-
h(
|
|
5228
|
-
"div",
|
|
5229
|
-
{ className: P + "-head" },
|
|
5230
|
-
h(
|
|
5231
|
-
"div",
|
|
5232
|
-
{ className: P + "-headmain" },
|
|
5233
|
-
h("h2", null, icon("database"), tableLabel(current), h("span", { className: P + "-code" }, active)),
|
|
5234
|
-
h(
|
|
5235
|
-
"div",
|
|
5236
|
-
{ className: P + "-sub" },
|
|
5237
|
-
current && data && data.total !== void 0 ? fmt(t.rowCount, { n: data.total }) : "",
|
|
5238
|
-
current && current.deletedCount ? " \xB7 " + fmt(t.deletedCount, { n: current.deletedCount }) : "",
|
|
5239
|
-
" \xB7 " + t.subtitle
|
|
5240
|
-
)
|
|
5241
|
-
),
|
|
5242
|
-
h("button", {
|
|
5243
|
-
type: "button",
|
|
5244
|
-
className: P + "-btn",
|
|
5245
|
-
"aria-label": t.refresh,
|
|
5246
|
-
title: t.refresh,
|
|
5247
|
-
"aria-busy": loadingRows ? "true" : "false",
|
|
5248
|
-
onClick: refresh
|
|
5249
|
-
}, icon("refresh"), h("span", { className: P + "-btnlabel" }, t.refresh))
|
|
5250
|
-
),
|
|
5251
|
-
h(
|
|
5252
|
-
"div",
|
|
5253
|
-
{ className: P + "-toolbar" },
|
|
5254
|
-
h(
|
|
5255
|
-
"div",
|
|
5256
|
-
{ className: P + "-search" },
|
|
5257
|
-
icon("search"),
|
|
5258
|
-
h("input", {
|
|
5259
|
-
type: "search",
|
|
5260
|
-
value: searchDraft,
|
|
5261
|
-
placeholder: t.search,
|
|
5262
|
-
"aria-label": t.search,
|
|
5263
|
-
onChange: function(e) {
|
|
5264
|
-
setSearchDraft(e.target.value);
|
|
5265
|
-
}
|
|
5266
|
-
})
|
|
5267
|
-
),
|
|
5268
|
-
h(SW.Switch, {
|
|
5269
|
-
h,
|
|
5270
|
-
checked: includeDeleted,
|
|
5271
|
-
label: t.includeDeleted,
|
|
5272
|
-
onChange: function(next) {
|
|
5273
|
-
setIncludeDeleted(next);
|
|
5274
|
-
setPage(1);
|
|
5275
|
-
}
|
|
5276
|
-
}),
|
|
5277
|
-
h(SW.Switch, {
|
|
5278
|
-
h,
|
|
5279
|
-
checked: showSystem,
|
|
5280
|
-
label: t.showSystem,
|
|
5281
|
-
onChange: function(next) {
|
|
5282
|
-
setShowSystem(next);
|
|
5283
|
-
}
|
|
5284
|
-
}),
|
|
5285
|
-
h("span", { className: P + "-grow" }),
|
|
5286
|
-
h(
|
|
5287
|
-
"label",
|
|
5288
|
-
{ style: { display: "inline-flex", alignItems: "center", gap: "6px", fontSize: "11.5px", color: "var(--cfg-muted)" } },
|
|
5289
|
-
h("span", null, t.pageSize),
|
|
5290
|
-
h("select", {
|
|
5291
|
-
className: P + "-select",
|
|
5292
|
-
value: size,
|
|
5293
|
-
onChange: function(e) {
|
|
5294
|
-
setPageSize(Number(e.target.value));
|
|
5295
|
-
setPage(1);
|
|
5296
|
-
}
|
|
5297
|
-
}, PAGE_SIZES.map(function(n) {
|
|
5298
|
-
return h("option", { key: n, value: n }, String(n));
|
|
5299
|
-
}))
|
|
5300
|
-
)
|
|
5301
|
-
),
|
|
5302
|
-
renderRows(),
|
|
5303
|
-
renderFoot()
|
|
5304
|
-
]
|
|
5305
|
-
),
|
|
5306
|
-
drawer ? h(
|
|
5307
|
-
"div",
|
|
5308
|
-
null,
|
|
5309
|
-
h("div", { className: P + "-mask", onClick: function() {
|
|
5310
|
-
setDrawer(null);
|
|
5311
|
-
} }),
|
|
5312
|
-
h(
|
|
5313
|
-
"aside",
|
|
5314
|
-
{ className: P + "-drawer", role: "dialog", "aria-modal": "true", "aria-label": drawer.column },
|
|
5315
|
-
h("h3", null, fmt(t.drawerTitle, { column: drawer.column, row: drawer.row }), h("span", { className: P + "-code" }, drawer.name)),
|
|
5316
|
-
columnHooks[drawer.name] && columnHooks[drawer.name].detail ? columnHooks[drawer.name].detail({ value: drawer.value, lang, prefix: P }) : h("pre", null, drawerText(drawer.value)),
|
|
5317
|
-
h(
|
|
5318
|
-
"div",
|
|
5319
|
-
{ className: P + "-drawerfoot" },
|
|
5320
|
-
h("button", { type: "button", className: P + "-btn", onClick: function() {
|
|
5321
|
-
copyCell(drawer.value);
|
|
5322
|
-
} }, t.copy),
|
|
5323
|
-
h("button", { type: "button", className: P + "-btn", onClick: function() {
|
|
5324
|
-
setDrawer(null);
|
|
5325
|
-
} }, t.close)
|
|
5326
|
-
)
|
|
5327
|
-
)
|
|
5328
|
-
) : null,
|
|
5329
|
-
toast ? h("div", { className: P + "-toast", role: "status" }, toast) : null
|
|
5330
|
-
);
|
|
5331
|
-
}
|
|
5332
|
-
function drawerText(value) {
|
|
5333
|
-
if (value === null || value === void 0) return "NULL";
|
|
5334
|
-
if (typeof value === "string" && looksJson(value)) {
|
|
5335
|
-
try {
|
|
5336
|
-
return JSON.stringify(JSON.parse(value), null, 2);
|
|
5337
|
-
} catch (e) {
|
|
5338
|
-
return value;
|
|
5339
|
-
}
|
|
5340
|
-
}
|
|
5341
|
-
if (typeof value === "object") {
|
|
5342
|
-
try {
|
|
5343
|
-
return JSON.stringify(value, null, 2);
|
|
5344
|
-
} catch (e) {
|
|
5345
|
-
return String(value);
|
|
5346
|
-
}
|
|
5347
|
-
}
|
|
5348
|
-
return String(value);
|
|
5349
|
-
}
|
|
5350
|
-
return { DataView, DOMAIN };
|
|
5351
|
-
};
|
|
5352
|
-
}
|
|
5353
|
-
});
|
|
5354
|
-
|
|
5355
|
-
// packages/addons/salary/client/views/data.cjs
|
|
5356
|
-
var require_data = __commonJS({
|
|
5357
|
-
"packages/addons/salary/client/views/data.cjs"(exports2, module2) {
|
|
5358
|
-
"use strict";
|
|
5359
|
-
var legacy = require_legacy_data()("salary", { paged: false });
|
|
5360
|
-
module2.exports = require_data_view()({
|
|
5361
|
-
domain: "salary",
|
|
5362
|
-
prefix: "wbsal",
|
|
5363
|
-
tables: ["salary_record"],
|
|
5364
|
-
useConfig: function(api, fallback) {
|
|
5365
|
-
return { values: fallback, ready: true };
|
|
5366
|
-
},
|
|
5367
|
-
tablesLoader: legacy.tablesLoader,
|
|
5368
|
-
query: legacy.query
|
|
5369
|
-
}).DataView;
|
|
5370
|
-
}
|
|
5371
|
-
});
|
|
5372
|
-
|
|
5373
|
-
// packages/addons/lib/highlight.cjs
|
|
5374
|
-
var require_highlight = __commonJS({
|
|
5375
|
-
"packages/addons/lib/highlight.cjs"(exports2, module2) {
|
|
5376
|
-
"use strict";
|
|
5377
|
-
module2.exports = function(React) {
|
|
5378
|
-
var h = React.createElement;
|
|
5379
|
-
function sourceOf(keyword) {
|
|
5380
|
-
var pattern = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5381
|
-
return pattern.replace(/[a-zA-Z]/g, function(letter) {
|
|
5382
|
-
return "[" + letter.toLowerCase() + letter.toUpperCase() + "]";
|
|
5383
|
-
});
|
|
5384
|
-
}
|
|
5385
|
-
return function createHighlight(prefix) {
|
|
5386
|
-
var className = String(prefix || "wb") + "-hit";
|
|
5387
|
-
function hit(rawText, rawKeyword) {
|
|
5388
|
-
var text = rawText == null ? "" : String(rawText);
|
|
5389
|
-
var keyword = rawKeyword == null ? "" : String(rawKeyword);
|
|
5390
|
-
if (!keyword) return text;
|
|
5391
|
-
var matcher, match, end = 0, parts = [];
|
|
5392
|
-
try {
|
|
5393
|
-
matcher = new RegExp(sourceOf(keyword), "g");
|
|
5394
|
-
} catch (error) {
|
|
5395
|
-
return text;
|
|
5396
|
-
}
|
|
5397
|
-
while (match = matcher.exec(text)) {
|
|
5398
|
-
if (match.index > end) parts.push(text.slice(end, match.index));
|
|
5399
|
-
parts.push(h("mark", { className, key: match.index }, match[0]));
|
|
5400
|
-
end = match.index + match[0].length;
|
|
5401
|
-
if (!match[0]) matcher.lastIndex += 1;
|
|
5402
|
-
}
|
|
5403
|
-
if (!parts.length) return text;
|
|
5404
|
-
if (end < text.length) parts.push(text.slice(end));
|
|
5405
|
-
return parts;
|
|
5406
|
-
}
|
|
5407
|
-
function Highlight(props) {
|
|
5408
|
-
return hit(props.text, props.keyword);
|
|
5409
|
-
}
|
|
5410
|
-
Highlight.hit = hit;
|
|
5411
|
-
return Highlight;
|
|
5412
|
-
};
|
|
5413
|
-
};
|
|
5414
|
-
}
|
|
5415
|
-
});
|
|
5416
|
-
|
|
5417
|
-
// packages/addons/lib/action-schema-style.cjs
|
|
5418
|
-
var require_action_schema_style = __commonJS({
|
|
5419
|
-
"packages/addons/lib/action-schema-style.cjs"(exports2, module2) {
|
|
5420
|
-
"use strict";
|
|
5421
|
-
module2.exports = function(PREFIX, DOMAIN) {
|
|
5422
|
-
var P = PREFIX + "-as";
|
|
5423
|
-
var hairline = "1px solid color-mix(in oklab,currentColor 8%,transparent)";
|
|
5424
|
-
var CSS = [
|
|
5425
|
-
"." + P + "{display:flex;flex-direction:column;gap:12px;width:100%;min-width:0;font-size:13px;color:inherit}",
|
|
5426
|
-
"." + P + "-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
5427
|
-
"." + P + "-title{font-size:15px;font-weight:660;margin:0}",
|
|
5428
|
-
"." + P + "-badge{display:inline-flex;align-items:center;gap:4px;max-width:100%;border:1px solid var(--wb-border,#e3e5e9);border-radius:999px;padding:1px 8px;font-size:11px;color:var(--dsw-alias-label-secondary,currentColor);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}",
|
|
5429
|
-
"." + P + "-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
|
|
5430
|
-
"." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
5431
|
-
"." + P + "-search{position:relative;flex:1 1 220px;min-width:0;display:flex;align-items:center}",
|
|
5432
|
-
"." + P + "-search input{width:100%;border:1px solid var(--wb-border,#e3e5e9);border-radius:8px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));color:inherit;font:inherit;padding:6px 10px 6px 30px}",
|
|
5433
|
-
"." + P + "-search input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
5434
|
-
"." + P + "-search .wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
5435
|
-
"." + P + " select{border:1px solid var(--wb-border,#e3e5e9);border-radius:8px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));color:inherit;font:inherit;padding:6px 8px;max-width:100%}",
|
|
5436
|
-
"." + P + " select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
5437
|
-
"." + P + "-list{display:flex;flex-direction:column;gap:8px}",
|
|
5438
|
-
"." + P + "-card{border:1px solid var(--wb-border,#e3e5e9);border-radius:10px;padding:10px 12px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));display:flex;flex-direction:column;gap:8px;min-width:0}",
|
|
5439
|
-
"." + P + "-cardhead{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:8px}",
|
|
5440
|
-
"." + P + "-cardmeta{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0;min-height:24px}",
|
|
5441
|
-
"." + P + "-cardhead code{font-weight:640;overflow-wrap:anywhere;min-width:0}",
|
|
5442
|
-
"." + P + "-hintline{margin:0;color:var(--dsw-alias-label-tertiary,inherit);font-size:11.5px;line-height:1.5}",
|
|
5443
|
-
"." + P + "-origins{display:inline-flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end;min-width:0}",
|
|
5444
|
-
"." + P + "-origins-label{font-size:11px;color:var(--wb-muted);white-space:nowrap}",
|
|
5445
|
-
"." + P + "-origin{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;color:var(--wb-muted);cursor:pointer;user-select:none}",
|
|
5446
|
-
// 该 action 本身不支持的来源:整项置灰、不可点,示意「不是没开,是开不了」。
|
|
5447
|
-
"." + P + "-origin-off{opacity:.55;cursor:not-allowed}",
|
|
5448
|
-
"." + P + "-origin input[type=checkbox]{width:13px;height:13px;margin:0;accent-color:var(--wb-accent);cursor:inherit}",
|
|
5449
|
-
"." + P + "-origin input[type=checkbox]:focus-visible{outline:2px solid var(--wb-accent);outline-offset:2px}",
|
|
5450
|
-
"." + P + "-locked{border-color:var(--wb-warn,#b7791f);color:var(--wb-warn,#b7791f)}",
|
|
5451
|
-
"." + P + "-desc{margin:0;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55;font-size:12.5px;overflow-wrap:anywhere}",
|
|
5452
|
-
// 搜索命中:用品牌色透明度叠加而不是写死浅色,深浅主题都可读;继承文字颜色、不覆盖 ::selection。
|
|
5453
|
-
"." + P + " mark." + P + "-hit{background:color-mix(in oklab,var(--dsw-alias-brand-primary,#4f6ef7) 22%,transparent);color:inherit;border-radius:2px;padding:0;font:inherit;box-decoration-break:clone;-webkit-box-decoration-break:clone}",
|
|
5454
|
-
"." + P + "-table{width:100%;border-collapse:collapse;font-size:12px;table-layout:auto}",
|
|
5455
|
-
"." + P + "-table th{text-align:left;font-weight:620;font-size:11px;letter-spacing:.4px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary,inherit);padding:4px 8px 4px 0;white-space:nowrap}",
|
|
5456
|
-
"." + P + "-table td{padding:4px 8px 4px 0;vertical-align:top;border-top:" + hairline + ";line-height:1.5;overflow-wrap:anywhere}",
|
|
5457
|
-
"." + P + "-req{color:var(--dsw-alias-state-error-primary,#d9534f);font-weight:620}",
|
|
5458
|
-
"." + P + "-opt{color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
5459
|
-
"." + P + "-none{color:var(--dsw-alias-label-tertiary,inherit);font-size:12px}",
|
|
5460
|
-
"." + P + "-example{position:relative;display:flex;flex-direction:column;gap:4px;min-width:0}",
|
|
5461
|
-
"." + P + "-examplehead{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}",
|
|
5462
|
-
"." + P + "-pre{margin:0;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);color:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;line-height:1.5;overflow:auto;max-height:280px;white-space:pre-wrap;word-break:break-word}",
|
|
5463
|
-
"." + P + "-copy{border:1px solid var(--wb-border,#e3e5e9);border-radius:7px;background:transparent;color:inherit;font:inherit;font-size:11.5px;padding:2px 8px;cursor:pointer}",
|
|
5464
|
-
"." + P + "-copy:hover{background:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent))}",
|
|
5465
|
-
"." + P + "-copy:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
5466
|
-
"." + P + " details>summary{cursor:pointer;font-size:11.5px;color:var(--dsw-alias-label-secondary,inherit);width:max-content}",
|
|
5467
|
-
"." + P + " details>summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
5468
|
-
// 参数折叠面板:折叠时只留一行「参数 · 必填 n」,展开后与表格之间留一点气口。
|
|
5469
|
-
"." + P + "-params{min-width:0}",
|
|
5470
|
-
"." + P + "-params>summary{user-select:none;max-width:100%}",
|
|
5471
|
-
"." + P + "-params[open]>summary{margin-bottom:6px}",
|
|
5472
|
-
"." + P + "-empty{padding:24px;text-align:center;border:1px dashed var(--wb-border,#e3e5e9);border-radius:10px;color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
5473
|
-
"." + P + "-error{padding:12px;border:1px solid var(--dsw-alias-state-error-primary,#d9534f);border-radius:10px;color:var(--dsw-alias-state-error-primary,#d9534f);display:flex;gap:10px;align-items:center;flex-wrap:wrap;overflow-wrap:anywhere}",
|
|
5474
|
-
"." + P + "-toast{position:sticky;bottom:8px;align-self:flex-start;border-radius:999px;padding:3px 10px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);font-size:11.5px;max-width:100%}",
|
|
5475
|
-
// 窄屏:五列参数表压成一列会丢失列名、且 table 布局按最小内容宽度撑破容器,
|
|
5476
|
-
// 这里整体改成块级网格:每行 = 名称 / 类型 / 必填 + 约束行 + 说明行,行间用细线分隔。
|
|
5477
|
-
"@media(max-width:760px){." + P + "-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:end}." + P + "-search{grid-column:1/-1}." + P + "-toolbar>label{display:flex;flex-direction:column;align-items:stretch;gap:4px;min-width:0}." + P + "-toolbar select{width:100%;min-width:0}." + P + "-cardhead{grid-template-columns:minmax(0,1fr);row-gap:6px}." + P + "-origins{justify-content:flex-start}." + P + "-table{display:block}." + P + "-table thead{display:none}." + P + "-table tbody{display:block}." + P + '-table tr{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"name type need" "extra extra extra" "desc desc desc";column-gap:8px;padding:9px 0;border-top:' + hairline + "}." + P + "-table tr:first-child{border-top:0;padding-top:2px}." + P + "-table tr:last-child{padding-bottom:2px}." + P + "-table td{display:block;border:0;padding:0;min-width:0}." + P + "-table td:empty{display:none}." + P + "-pname{grid-area:name;font-weight:640}." + P + "-ptype{grid-area:type;justify-self:start;align-self:center;color:var(--dsw-alias-label-tertiary,inherit)}." + P + "-pneed{grid-area:need;justify-self:end;align-self:center;font-size:11px;line-height:1.6;white-space:nowrap}." + P + "-pextra{grid-area:extra;margin-top:3px;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55}." + P + "-pdesc{grid-area:desc;margin-top:3px;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55}}",
|
|
5478
|
-
// 中等宽度(521–760px)三个筛选项正好排成一行,避免第三项独占一行显得参差。
|
|
5479
|
-
"@media(min-width:521px) and (max-width:760px){." + P + "-toolbar{grid-template-columns:repeat(3,minmax(0,1fr))}}",
|
|
5480
|
-
"@media(max-width:420px){." + P + "-toolbar{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}." + P + "-card{padding:10px}." + P + "-table tr{padding:8px 0}}"
|
|
5481
|
-
].join("\n");
|
|
5482
|
-
return function injectCss() {
|
|
5483
|
-
if (typeof document === "undefined") return;
|
|
5484
|
-
var id = "wb-addon-" + DOMAIN + "-actions-css";
|
|
5485
|
-
var old = document.getElementById(id);
|
|
5486
|
-
if (old) {
|
|
5487
|
-
old.textContent = CSS;
|
|
5488
|
-
return;
|
|
5489
|
-
}
|
|
5490
|
-
var style = document.createElement("style");
|
|
5491
|
-
style.id = id;
|
|
5492
|
-
style.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
|
|
5493
|
-
style.textContent = CSS;
|
|
5494
|
-
document.head.appendChild(style);
|
|
5495
|
-
};
|
|
5496
|
-
};
|
|
5497
|
-
}
|
|
5498
|
-
});
|
|
5499
|
-
|
|
5500
|
-
// packages/addons/lib/action-schema-view.cjs
|
|
5501
|
-
var require_action_schema_view = __commonJS({
|
|
5502
|
-
"packages/addons/lib/action-schema-view.cjs"(exports2, module2) {
|
|
5503
|
-
"use strict";
|
|
5504
|
-
var React = require("react");
|
|
5505
|
-
var createHighlight = require_highlight()(React);
|
|
5506
|
-
var h = React.createElement;
|
|
5507
|
-
var COPY = {
|
|
5508
|
-
zh: {
|
|
5509
|
-
title: "Action",
|
|
5510
|
-
hint: "\u8FD0\u884C\u65F6\u6CE8\u518C \xB7 \u53EA\u8BFB",
|
|
5511
|
-
switchHint: "\u5141\u8BB8\u6765\u6E90\u843D\u672C\u673A\u3001\u5373\u6539\u5373\u751F\u6548\uFF1A\u52FE\u4E0A\u7684\u6765\u6E90\u624D\u80FD\u8C03\u7528\u8BE5 action\uFF0C\u5176\u4F59\u4F1A\u88AB ACTION_ORIGIN_DENIED \u62E6\u4E0B\u3002",
|
|
5512
|
-
hostHint: "\u5BBF\u4E3B action \u7684\u5141\u8BB8\u6765\u6E90\uFF1B\u6807\u300C\u6765\u6E90\u56FA\u5B9A\u300D\u7684\u4E0D\u53EF\u4FEE\u6539\u3002",
|
|
5513
|
-
originsLabel: "\u5141\u8BB8\u6765\u6E90",
|
|
5514
|
-
originUi: "\u754C\u9762",
|
|
5515
|
-
originPlugin: "\u63D2\u4EF6",
|
|
5516
|
-
originAgent: "agent",
|
|
5517
|
-
originSync: "\u540C\u6B65",
|
|
5518
|
-
originsSaving: "\u4FDD\u5B58\u4E2D\u2026",
|
|
5519
|
-
originsToast: "\u5DF2\u66F4\u65B0\u5141\u8BB8\u6765\u6E90",
|
|
5520
|
-
originsFail: "\u66F4\u65B0\u5141\u8BB8\u6765\u6E90\u5931\u8D25",
|
|
5521
|
-
originsEmpty: "\u81F3\u5C11\u8981\u4FDD\u7559\u4E00\u4E2A\u6765\u6E90",
|
|
5522
|
-
originsUnsupported: "\u8BE5 action \u672C\u8EAB\u4E0D\u652F\u6301\u8FD9\u4E2A\u6765\u6E90",
|
|
5523
|
-
originsPinned: "\u6765\u6E90\u56FA\u5B9A",
|
|
5524
|
-
originsPinnedHint: "\u8BE5 action \u7684\u5141\u8BB8\u6765\u6E90\u88AB\u56FA\u5B9A\uFF08\u5B89\u5168\u7EA6\u675F\uFF09\uFF0C\u4E0D\u80FD\u4FEE\u6539",
|
|
5525
|
-
domain: "\u57DF",
|
|
5526
|
-
versionLabel: "\u7248\u672C",
|
|
5527
|
-
shell: "\u5BBF\u4E3B",
|
|
5528
|
-
count: function(shown, total) {
|
|
5529
|
-
return shown + " / " + total + " \u4E2A action";
|
|
5530
|
-
},
|
|
5531
|
-
search: "\u641C\u7D22\u540D\u79F0\u3001\u63CF\u8FF0\u3001\u53C2\u6570\uFF08\u547D\u4E2D\u5904\u9AD8\u4EAE\uFF09",
|
|
5532
|
-
filterReq: "\u5FC5\u586B\u7B5B\u9009",
|
|
5533
|
-
all: "\u5168\u90E8",
|
|
5534
|
-
onlyRequired: "\u542B\u5FC5\u586B\u9879",
|
|
5535
|
-
onlyOptional: "\u65E0\u5FC5\u586B\u9879",
|
|
5536
|
-
filterType: "\u53C2\u6570\u7C7B\u578B",
|
|
5537
|
-
allTypes: "\u5168\u90E8\u7C7B\u578B",
|
|
5538
|
-
filterOrigin: "\u5141\u8BB8\u6765\u6E90",
|
|
5539
|
-
allOrigins: "\u5168\u90E8\u6765\u6E90",
|
|
5540
|
-
colName: "\u53C2\u6570",
|
|
5541
|
-
colType: "\u7C7B\u578B",
|
|
5542
|
-
colReq: "\u5FC5\u586B",
|
|
5543
|
-
colExtra: "\u9ED8\u8BA4 / \u679A\u4E3E / \u7EA6\u675F",
|
|
5544
|
-
colDesc: "\u8BF4\u660E",
|
|
5545
|
-
required: "\u5FC5\u586B",
|
|
5546
|
-
optional: "\u53EF\u9009",
|
|
5547
|
-
noParams: "\u65E0\u53C2\u6570",
|
|
5548
|
-
paramCount: function(n) {
|
|
5549
|
-
return n + " \u4E2A\u53C2\u6570";
|
|
5550
|
-
},
|
|
5551
|
-
params: "\u53C2\u6570",
|
|
5552
|
-
requiredCount: function(n) {
|
|
5553
|
-
return "\u5FC5\u586B " + n;
|
|
5554
|
-
},
|
|
5555
|
-
examples: "\u793A\u4F8B",
|
|
5556
|
-
noExamples: "\u65E0\u793A\u4F8B",
|
|
5557
|
-
copy: "\u590D\u5236",
|
|
5558
|
-
copied: "\u5DF2\u590D\u5236",
|
|
5559
|
-
raw: "\u539F\u59CB JSON Schema",
|
|
5560
|
-
loading: "\u8F7D\u5165\u4E2D\u2026",
|
|
5561
|
-
loadFail: "\u8BFB\u53D6 action schema \u5931\u8D25",
|
|
5562
|
-
retry: "\u91CD\u8BD5",
|
|
5563
|
-
empty: "\u6CA1\u6709\u5339\u914D\u7684 action",
|
|
5564
|
-
emptyRegistry: "\u8BE5\u57DF\u6CA1\u6709\u6CE8\u518C action",
|
|
5565
|
-
envelope: "\u9ED8\u8BA4",
|
|
5566
|
-
enumLabel: "\u679A\u4E3E",
|
|
5567
|
-
range: "\u8303\u56F4",
|
|
5568
|
-
length: "\u957F\u5EA6",
|
|
5569
|
-
pattern: "\u6B63\u5219",
|
|
5570
|
-
format: "\u683C\u5F0F",
|
|
5571
|
-
items: "\u5143\u7D20\u6570"
|
|
5572
|
-
},
|
|
5573
|
-
en: {
|
|
5574
|
-
title: "Actions",
|
|
5575
|
-
hint: "runtime registry \xB7 read-only",
|
|
5576
|
-
switchHint: "Allowed origins are stored locally and apply immediately: only checked origins may call the action; others get ACTION_ORIGIN_DENIED.",
|
|
5577
|
-
hostHint: "Allowed origins for host actions; items marked pinned cannot be changed.",
|
|
5578
|
-
originsLabel: "Origins",
|
|
5579
|
-
originUi: "UI",
|
|
5580
|
-
originPlugin: "Plugin",
|
|
5581
|
-
originAgent: "Agent",
|
|
5582
|
-
originSync: "Sync",
|
|
5583
|
-
originsSaving: "Saving\u2026",
|
|
5584
|
-
originsToast: "Allowed origins updated",
|
|
5585
|
-
originsFail: "Failed to update allowed origins",
|
|
5586
|
-
originsEmpty: "Keep at least one origin",
|
|
5587
|
-
originsUnsupported: "This action does not support this origin",
|
|
5588
|
-
originsPinned: "Pinned",
|
|
5589
|
-
originsPinnedHint: "Allowed origins are pinned for this action (security constraint) and cannot be changed",
|
|
5590
|
-
originsDefaultOn: "Allowed by default",
|
|
5591
|
-
originsDefaultOff: "Off by default, can be enabled",
|
|
5592
|
-
domain: "Domain",
|
|
5593
|
-
versionLabel: "Version",
|
|
5594
|
-
shell: "Host",
|
|
5595
|
-
count: function(shown, total) {
|
|
5596
|
-
return shown + " / " + total + " actions";
|
|
5597
|
-
},
|
|
5598
|
-
search: "Search name, description, params (matches highlighted)",
|
|
5599
|
-
filterReq: "Required",
|
|
5600
|
-
all: "All",
|
|
5601
|
-
onlyRequired: "Has required",
|
|
5602
|
-
onlyOptional: "No required",
|
|
5603
|
-
filterType: "Param type",
|
|
5604
|
-
allTypes: "All types",
|
|
5605
|
-
filterOrigin: "Origins",
|
|
5606
|
-
allOrigins: "All origins",
|
|
5607
|
-
colName: "Param",
|
|
5608
|
-
colType: "Type",
|
|
5609
|
-
colReq: "Required",
|
|
5610
|
-
colExtra: "Default / enum / constraints",
|
|
5611
|
-
colDesc: "Description",
|
|
5612
|
-
required: "required",
|
|
5613
|
-
optional: "optional",
|
|
5614
|
-
noParams: "No parameters",
|
|
5615
|
-
paramCount: function(n) {
|
|
5616
|
-
return n + " params";
|
|
5617
|
-
},
|
|
5618
|
-
params: "Parameters",
|
|
5619
|
-
requiredCount: function(n) {
|
|
5620
|
-
return n + " required";
|
|
5621
|
-
},
|
|
5622
|
-
examples: "Examples",
|
|
5623
|
-
noExamples: "No examples",
|
|
5624
|
-
copy: "Copy",
|
|
5625
|
-
copied: "Copied",
|
|
5626
|
-
raw: "Raw JSON Schema",
|
|
5627
|
-
loading: "Loading\u2026",
|
|
5628
|
-
loadFail: "Failed to read action schema",
|
|
5629
|
-
retry: "Retry",
|
|
5630
|
-
empty: "No matching action",
|
|
5631
|
-
emptyRegistry: "This domain has no registered action",
|
|
5632
|
-
envelope: "Default",
|
|
5633
|
-
enumLabel: "Enum",
|
|
5634
|
-
range: "Range",
|
|
5635
|
-
length: "Length",
|
|
5636
|
-
pattern: "Pattern",
|
|
5637
|
-
format: "Format",
|
|
5638
|
-
items: "Items"
|
|
5639
|
-
}
|
|
5640
|
-
};
|
|
5641
|
-
function typeLabel(schema) {
|
|
5642
|
-
if (!schema || typeof schema !== "object") return "";
|
|
5643
|
-
if (Array.isArray(schema.type)) return schema.type.join(" | ");
|
|
5644
|
-
if (typeof schema.type === "string") {
|
|
5645
|
-
if (schema.type === "array" && schema.items) {
|
|
5646
|
-
var inner = typeLabel(schema.items);
|
|
5647
|
-
return inner ? inner + "[]" : "array";
|
|
5648
|
-
}
|
|
5649
|
-
return schema.type;
|
|
5650
|
-
}
|
|
5651
|
-
if (Array.isArray(schema.oneOf)) return schema.oneOf.map(typeLabel).filter(Boolean).join(" | ");
|
|
5652
|
-
if (Array.isArray(schema.anyOf)) return schema.anyOf.map(typeLabel).filter(Boolean).join(" | ");
|
|
5653
|
-
return "";
|
|
5654
|
-
}
|
|
5655
|
-
function typeNames(schema) {
|
|
5656
|
-
var label = typeLabel(schema);
|
|
5657
|
-
if (!label) return [];
|
|
5658
|
-
return label.split("|").map(function(x) {
|
|
5659
|
-
return x.trim().replace(/\[\]$/, "");
|
|
5660
|
-
}).filter(Boolean);
|
|
5661
|
-
}
|
|
5662
|
-
function scalar(value) {
|
|
5663
|
-
if (typeof value === "string") return JSON.stringify(value);
|
|
5664
|
-
return String(value);
|
|
5665
|
-
}
|
|
5666
|
-
function extraText(schema, t) {
|
|
5667
|
-
if (!schema || typeof schema !== "object") return "";
|
|
5668
|
-
var parts = [];
|
|
5669
|
-
if (Object.prototype.hasOwnProperty.call(schema, "default")) {
|
|
5670
|
-
parts.push(t.envelope + " " + scalar(schema.default));
|
|
5671
|
-
}
|
|
5672
|
-
if (Array.isArray(schema.enum)) {
|
|
5673
|
-
parts.push(t.enumLabel + " " + schema.enum.map(scalar).join(" / "));
|
|
5674
|
-
}
|
|
5675
|
-
if (typeof schema.minimum === "number" || typeof schema.maximum === "number") {
|
|
5676
|
-
var lo = typeof schema.minimum === "number" ? schema.minimum : null;
|
|
5677
|
-
var hi = typeof schema.maximum === "number" ? schema.maximum : null;
|
|
5678
|
-
if (lo !== null && hi !== null) parts.push(t.range + " \u2265" + lo + " \u4E14 \u2264" + hi);
|
|
5679
|
-
else if (lo !== null) parts.push(t.range + " \u2265" + lo);
|
|
5680
|
-
else parts.push(t.range + " \u2264" + hi);
|
|
5681
|
-
}
|
|
5682
|
-
if (typeof schema.minLength === "number" || typeof schema.maxLength === "number") {
|
|
5683
|
-
parts.push(t.length + " " + (schema.minLength ?? 0) + "\u2013" + (schema.maxLength ?? "\u221E"));
|
|
5684
|
-
}
|
|
5685
|
-
if (typeof schema.minItems === "number" || typeof schema.maxItems === "number") {
|
|
5686
|
-
parts.push(t.items + " " + (schema.minItems ?? 0) + "\u2013" + (schema.maxItems ?? "\u221E"));
|
|
5687
|
-
}
|
|
5688
|
-
if (typeof schema.pattern === "string") parts.push(t.pattern + " " + schema.pattern);
|
|
5689
|
-
if (typeof schema.format === "string") parts.push(t.format + " " + schema.format);
|
|
5690
|
-
return parts.join(" \xB7 ");
|
|
5691
|
-
}
|
|
5692
|
-
function paramRows(action) {
|
|
5693
|
-
var input = action && action.input && typeof action.input === "object" ? action.input : {};
|
|
5694
|
-
var props = input.properties && typeof input.properties === "object" ? input.properties : {};
|
|
5695
|
-
var required = Array.isArray(input.required) ? input.required : [];
|
|
5696
|
-
return Object.keys(props).map(function(key) {
|
|
5697
|
-
var schema = props[key] && typeof props[key] === "object" ? props[key] : {};
|
|
5698
|
-
return {
|
|
5699
|
-
name: key,
|
|
5700
|
-
schema,
|
|
5701
|
-
type: typeLabel(schema),
|
|
5702
|
-
types: typeNames(schema),
|
|
5703
|
-
required: required.indexOf(key) >= 0,
|
|
5704
|
-
description: typeof schema.description === "string" ? schema.description : ""
|
|
5705
|
-
};
|
|
5706
|
-
});
|
|
5707
|
-
}
|
|
5708
|
-
module2.exports = function createActionSchemaView(options) {
|
|
5709
|
-
var raw = String(options.domain || "");
|
|
5710
|
-
var SOURCE = options.source === "actions.list" ? "actions.list" : "actionSchema";
|
|
5711
|
-
var DOMAIN = SOURCE === "actions.list" ? raw : raw.indexOf("wb-addon-") === 0 ? raw : "wb-addon-" + raw;
|
|
5712
|
-
var LIST_DOMAIN = options.listDomain ? String(options.listDomain) : DOMAIN;
|
|
5713
|
-
var prefix = options.prefix;
|
|
5714
|
-
var P = prefix + "-as";
|
|
5715
|
-
var Icon2 = options.Icon || null;
|
|
5716
|
-
var injectCss = require_action_schema_style()(prefix, DOMAIN);
|
|
5717
|
-
var Highlight = createHighlight(P);
|
|
5718
|
-
function icon(name, size) {
|
|
5719
|
-
return Icon2 ? h(Icon2, { name, size: size || 14 }) : null;
|
|
5720
|
-
}
|
|
5721
|
-
function plainCopy(text) {
|
|
5722
|
-
if (typeof document === "undefined") return;
|
|
5723
|
-
var area = document.createElement("textarea");
|
|
5724
|
-
area.value = text;
|
|
5725
|
-
area.setAttribute("readonly", "readonly");
|
|
5726
|
-
area.style.position = "fixed";
|
|
5727
|
-
area.style.opacity = "0";
|
|
5728
|
-
document.body.appendChild(area);
|
|
5729
|
-
area.select();
|
|
5730
|
-
try {
|
|
5731
|
-
document.execCommand("copy");
|
|
5732
|
-
} catch (e) {
|
|
5733
|
-
}
|
|
5734
|
-
document.body.removeChild(area);
|
|
5735
|
-
}
|
|
5736
|
-
function ActionSchemaView(props) {
|
|
5737
|
-
var lang = props.lang === "en" ? "en" : "zh";
|
|
5738
|
-
var t = COPY[lang];
|
|
5739
|
-
var api = props.api;
|
|
5740
|
-
var snapState = React.useState(null);
|
|
5741
|
-
var snap = snapState[0], setSnap = snapState[1];
|
|
5742
|
-
var errState = React.useState("");
|
|
5743
|
-
var err = errState[0], setErr = errState[1];
|
|
5744
|
-
var loadingState = React.useState(true);
|
|
5745
|
-
var loading = loadingState[0], setLoading = loadingState[1];
|
|
5746
|
-
var reloadState = React.useState(0);
|
|
5747
|
-
var reload = reloadState[0], setReload = reloadState[1];
|
|
5748
|
-
var queryState = React.useState("");
|
|
5749
|
-
var query = queryState[0], setQuery = queryState[1];
|
|
5750
|
-
var reqState = React.useState("all");
|
|
5751
|
-
var reqMode = reqState[0], setReqMode = reqState[1];
|
|
5752
|
-
var typeState = React.useState("");
|
|
5753
|
-
var typePick = typeState[0], setTypePick = typeState[1];
|
|
5754
|
-
var originFilterState = React.useState("");
|
|
5755
|
-
var originPick = originFilterState[0], setOriginPick = originFilterState[1];
|
|
5756
|
-
var toastState = React.useState("");
|
|
5757
|
-
var toast = toastState[0], setToast = toastState[1];
|
|
5758
|
-
var savingState = React.useState("");
|
|
5759
|
-
var saving = savingState[0], setSaving = savingState[1];
|
|
5760
|
-
var foldsState = React.useState({});
|
|
5761
|
-
var folds = foldsState[0], setFolds = foldsState[1];
|
|
5762
|
-
React.useEffect(function() {
|
|
5763
|
-
injectCss();
|
|
5764
|
-
}, []);
|
|
5765
|
-
React.useEffect(function() {
|
|
5766
|
-
var alive = true;
|
|
5767
|
-
setLoading(true);
|
|
5768
|
-
setErr("");
|
|
5769
|
-
var pending;
|
|
5770
|
-
var actionName = SOURCE === "actions.list" ? "actions.list" : DOMAIN.replace(/^wb-addon-/, "") + ".actionSchema";
|
|
5771
|
-
var callArgs = SOURCE === "actions.list" ? { detail: true, domain: LIST_DOMAIN } : void 0;
|
|
5772
|
-
if (api && typeof api.call === "function") {
|
|
5773
|
-
pending = Promise.resolve(api.call(actionName, callArgs)).then(function(r) {
|
|
5774
|
-
if (r && r.ok === false) return r;
|
|
5775
|
-
return r && r.result || r;
|
|
5776
|
-
});
|
|
5777
|
-
} else {
|
|
5778
|
-
pending = Promise.reject(new Error("no call api"));
|
|
5779
|
-
}
|
|
5780
|
-
Promise.resolve(pending).then(function(r) {
|
|
5781
|
-
if (!alive) return;
|
|
5782
|
-
if (!r || r.ok === false) {
|
|
5783
|
-
setSnap(null);
|
|
5784
|
-
setErr(String(r && (r.error || r.text) || t.loadFail));
|
|
5785
|
-
} else {
|
|
5786
|
-
setSnap(r);
|
|
5787
|
-
}
|
|
5788
|
-
setLoading(false);
|
|
5789
|
-
}, function(e) {
|
|
5790
|
-
if (!alive) return;
|
|
5791
|
-
setSnap(null);
|
|
5792
|
-
setErr(String(e && e.message || e || t.loadFail));
|
|
5793
|
-
setLoading(false);
|
|
5794
|
-
});
|
|
5795
|
-
return function() {
|
|
5796
|
-
alive = false;
|
|
5797
|
-
};
|
|
5798
|
-
}, [reload]);
|
|
5799
|
-
function copy(text) {
|
|
5800
|
-
var done = function() {
|
|
5801
|
-
setToast(t.copied);
|
|
5802
|
-
};
|
|
5803
|
-
if (typeof navigator !== "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText === "function") {
|
|
5804
|
-
navigator.clipboard.writeText(text).then(done, function() {
|
|
5805
|
-
plainCopy(text);
|
|
5806
|
-
done();
|
|
5807
|
-
});
|
|
5808
|
-
return;
|
|
5809
|
-
}
|
|
5810
|
-
plainCopy(text);
|
|
5811
|
-
done();
|
|
5812
|
-
}
|
|
5813
|
-
var ORIGINS = ["ui", "plugin", "agent", "sync"];
|
|
5814
|
-
var originText = { ui: t.originUi, plugin: t.originPlugin, agent: t.originAgent, sync: t.originSync };
|
|
5815
|
-
function setOrigins(action, origin) {
|
|
5816
|
-
var name = action.name;
|
|
5817
|
-
var current = Array.isArray(action.origins) ? action.origins.slice() : [];
|
|
5818
|
-
var index = current.indexOf(origin);
|
|
5819
|
-
var next = index >= 0 ? current.filter(function(o) {
|
|
5820
|
-
return o !== origin;
|
|
5821
|
-
}) : current.concat([origin]);
|
|
5822
|
-
if (next.length === 0) {
|
|
5823
|
-
setToast(t.originsEmpty);
|
|
5824
|
-
return;
|
|
5825
|
-
}
|
|
5826
|
-
next = ORIGINS.filter(function(o) {
|
|
5827
|
-
return next.indexOf(o) >= 0;
|
|
5828
|
-
});
|
|
5829
|
-
setSaving(name);
|
|
5830
|
-
setToast("");
|
|
5831
|
-
var fail = function(e) {
|
|
5832
|
-
setSaving("");
|
|
5833
|
-
setToast(t.originsFail + "\uFF1A" + String(e && e.message || e || ""));
|
|
5834
|
-
};
|
|
5835
|
-
var done = function(r) {
|
|
5836
|
-
setSaving("");
|
|
5837
|
-
var payload = r && typeof r === "object" && Object.prototype.hasOwnProperty.call(r, "result") ? r.result : r;
|
|
5838
|
-
if (r && r.ok === false) {
|
|
5839
|
-
setToast(t.originsFail + "\uFF1A" + String(r.error || r.text || ""));
|
|
5840
|
-
return;
|
|
5841
|
-
}
|
|
5842
|
-
var value = payload && Array.isArray(payload.origins) ? payload.origins : next;
|
|
5843
|
-
var source = payload && typeof payload.source === "string" ? payload.source : action.originsSource;
|
|
5844
|
-
setSnap(function(prev) {
|
|
5845
|
-
if (!prev || !Array.isArray(prev.actions)) return prev;
|
|
5846
|
-
return Object.assign({}, prev, {
|
|
5847
|
-
actions: prev.actions.map(function(a) {
|
|
5848
|
-
if (!a || a.name !== name) return a;
|
|
5849
|
-
return Object.assign({}, a, { origins: value, originsSource: source });
|
|
5850
|
-
})
|
|
5851
|
-
});
|
|
5852
|
-
});
|
|
5853
|
-
setToast(t.originsToast);
|
|
5854
|
-
};
|
|
5855
|
-
if (!api || typeof api.call !== "function") {
|
|
5856
|
-
fail(new Error("no call api"));
|
|
5857
|
-
return;
|
|
5858
|
-
}
|
|
5859
|
-
Promise.resolve(api.call("actions.setActionOrigins", { action: name, origins: next })).then(done, fail);
|
|
5860
|
-
}
|
|
5861
|
-
function paramsOpen(action) {
|
|
5862
|
-
if (Object.prototype.hasOwnProperty.call(folds, action.name)) return folds[action.name] === true;
|
|
5863
|
-
return Boolean(String(query || "").trim()) || reqMode !== "all" || Boolean(typePick);
|
|
5864
|
-
}
|
|
5865
|
-
function resetFolds() {
|
|
5866
|
-
setFolds(function(prev) {
|
|
5867
|
-
return Object.keys(prev).length ? {} : prev;
|
|
5868
|
-
});
|
|
5869
|
-
}
|
|
5870
|
-
var all = snap && Array.isArray(snap.actions) ? snap.actions.filter(function(a) {
|
|
5871
|
-
return a && a.domain === DOMAIN;
|
|
5872
|
-
}) : [];
|
|
5873
|
-
var info = snap && Array.isArray(snap.domains) ? snap.domains.filter(function(d) {
|
|
5874
|
-
return d && d.id === DOMAIN;
|
|
5875
|
-
})[0] || null : null;
|
|
5876
|
-
var typeOptions = [];
|
|
5877
|
-
all.forEach(function(a) {
|
|
5878
|
-
paramRows(a).forEach(function(row) {
|
|
5879
|
-
row.types.forEach(function(name) {
|
|
5880
|
-
if (typeOptions.indexOf(name) < 0) typeOptions.push(name);
|
|
5881
|
-
});
|
|
5882
|
-
});
|
|
5883
|
-
});
|
|
5884
|
-
typeOptions.sort();
|
|
5885
|
-
var kw = String(query || "").trim();
|
|
5886
|
-
var q = kw.toLowerCase();
|
|
5887
|
-
var visible = all.filter(function(a) {
|
|
5888
|
-
var rows = paramRows(a);
|
|
5889
|
-
if (q) {
|
|
5890
|
-
var hay = [a.name || "", a.description || ""].concat(rows.map(function(row) {
|
|
5891
|
-
return row.name + " " + row.type + " " + row.description;
|
|
5892
|
-
})).join(" ").toLowerCase();
|
|
5893
|
-
if (hay.indexOf(q) < 0) return false;
|
|
5894
|
-
}
|
|
5895
|
-
var hasRequired = rows.some(function(row) {
|
|
5896
|
-
return row.required;
|
|
5897
|
-
});
|
|
5898
|
-
if (reqMode === "required" && !hasRequired) return false;
|
|
5899
|
-
if (reqMode === "optional" && hasRequired) return false;
|
|
5900
|
-
if (typePick && !rows.some(function(row) {
|
|
5901
|
-
return row.types.indexOf(typePick) >= 0;
|
|
5902
|
-
})) return false;
|
|
5903
|
-
if (originPick && (!Array.isArray(a.origins) || a.origins.indexOf(originPick) < 0)) return false;
|
|
5904
|
-
return true;
|
|
5905
|
-
});
|
|
5906
|
-
function paramRow(row) {
|
|
5907
|
-
var extra = extraText(row.schema, t);
|
|
5908
|
-
return h(
|
|
5909
|
-
"tr",
|
|
5910
|
-
{ key: row.name },
|
|
5911
|
-
h("td", { className: P + "-mono " + P + "-pname" }, Highlight.hit(row.name, kw)),
|
|
5912
|
-
h("td", { className: P + "-mono " + P + "-ptype" }, Highlight.hit(row.type, kw)),
|
|
5913
|
-
h(
|
|
5914
|
-
"td",
|
|
5915
|
-
{ className: row.required ? P + "-req " + P + "-pneed" : P + "-opt " + P + "-pneed" },
|
|
5916
|
-
row.required ? t.required : t.optional
|
|
5917
|
-
),
|
|
5918
|
-
// extra(默认 / 枚举 / 约束)不在过滤 haystack 里,因此也不高亮,保持「显示即命中」口径。
|
|
5919
|
-
h("td", { className: P + "-mono " + P + "-pextra" }, extra),
|
|
5920
|
-
h("td", { className: P + "-pdesc" }, Highlight.hit(row.description, kw))
|
|
5921
|
-
);
|
|
5922
|
-
}
|
|
5923
|
-
function originsChips(action) {
|
|
5924
|
-
if (!Array.isArray(action.origins)) return null;
|
|
5925
|
-
if (action.originsSource === "invalid") {
|
|
5926
|
-
return h("span", { className: P + "-badge " + P + "-locked", title: t.originsPinnedHint, "data-origins-invalid": action.name }, t.originsPinned);
|
|
5927
|
-
}
|
|
5928
|
-
var busy = saving === action.name;
|
|
5929
|
-
var pinned = action.name === "actions.setActionOrigins";
|
|
5930
|
-
var supported = Array.isArray(action.originsDeclared) ? action.originsDeclared : action.origins;
|
|
5931
|
-
return h(
|
|
5932
|
-
"div",
|
|
5933
|
-
{ className: P + "-origins", "data-origins-row": action.name },
|
|
5934
|
-
h("span", { className: P + "-origins-label" }, t.originsLabel),
|
|
5935
|
-
ORIGINS.map(function(origin) {
|
|
5936
|
-
var on = action.origins.indexOf(origin) >= 0;
|
|
5937
|
-
var allowed = supported.indexOf(origin) >= 0;
|
|
5938
|
-
var preset = Array.isArray(action.originsDefault) ? action.originsDefault : supported;
|
|
5939
|
-
var byDefault = preset.indexOf(origin) >= 0;
|
|
5940
|
-
return h(
|
|
5941
|
-
"label",
|
|
5942
|
-
{
|
|
5943
|
-
key: origin,
|
|
5944
|
-
className: P + "-origin" + (allowed ? "" : " " + P + "-origin-off"),
|
|
5945
|
-
title: pinned ? t.originsPinnedHint : !allowed ? t.originsUnsupported : originText[origin] + " \xB7 " + action.name + " \xB7 " + (byDefault ? t.originsDefaultOn : t.originsDefaultOff)
|
|
5946
|
-
},
|
|
5947
|
-
h("input", {
|
|
5948
|
-
type: "checkbox",
|
|
5949
|
-
checked: on,
|
|
5950
|
-
disabled: busy || pinned || !allowed,
|
|
5951
|
-
"data-origin": origin,
|
|
5952
|
-
"data-origin-row": action.name,
|
|
5953
|
-
"data-origin-supported": allowed ? "1" : "0",
|
|
5954
|
-
onChange: function() {
|
|
5955
|
-
setOrigins(action, origin);
|
|
5956
|
-
}
|
|
5957
|
-
}),
|
|
5958
|
-
h("span", null, originText[origin])
|
|
5959
|
-
);
|
|
5960
|
-
}),
|
|
5961
|
-
busy ? h("span", { className: P + "-origins-label" }, t.originsSaving) : null
|
|
5962
|
-
);
|
|
5963
|
-
}
|
|
5964
|
-
function card(action) {
|
|
5965
|
-
var rows = paramRows(action);
|
|
5966
|
-
var required = rows.filter(function(row) {
|
|
5967
|
-
return row.required;
|
|
5968
|
-
}).length;
|
|
5969
|
-
var open = paramsOpen(action);
|
|
5970
|
-
var examples = Array.isArray(action.examples) ? action.examples : [];
|
|
5971
|
-
return h(
|
|
5972
|
-
"div",
|
|
5973
|
-
{ className: P + "-card", key: action.name },
|
|
5974
|
-
h(
|
|
5975
|
-
"div",
|
|
5976
|
-
{ className: P + "-cardhead" },
|
|
5977
|
-
h(
|
|
5978
|
-
"div",
|
|
5979
|
-
{ className: P + "-cardmeta" },
|
|
5980
|
-
h("code", { className: P + "-mono" }, Highlight.hit(action.name, kw)),
|
|
5981
|
-
h("span", { className: P + "-badge" }, rows.length ? t.paramCount(rows.length) : t.noParams),
|
|
5982
|
-
rows.some(function(row) {
|
|
5983
|
-
return row.required;
|
|
5984
|
-
}) ? h("span", { className: P + "-badge " + P + "-req" }, t.required) : null
|
|
5985
|
-
),
|
|
5986
|
-
originsChips(action)
|
|
5987
|
-
),
|
|
5988
|
-
action.description ? h("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
|
|
5989
|
-
rows.length ? h(
|
|
5990
|
-
"details",
|
|
5991
|
-
{
|
|
5992
|
-
className: P + "-params",
|
|
5993
|
-
"data-params-fold": action.name,
|
|
5994
|
-
open,
|
|
5995
|
-
// 原生 details 自带键盘与无障碍语义,这里只记下用户的开合;
|
|
5996
|
-
// 筛选变化引起的程序性开合也会触发 toggle,记下的值与当次默认一致,随后由 resetFolds 清掉。
|
|
5997
|
-
onToggle: function(e) {
|
|
5998
|
-
var next = !!(e && e.currentTarget && e.currentTarget.open);
|
|
5999
|
-
setFolds(function(prev) {
|
|
6000
|
-
if (prev[action.name] === next) return prev;
|
|
6001
|
-
var out = Object.assign({}, prev);
|
|
6002
|
-
out[action.name] = next;
|
|
6003
|
-
return out;
|
|
6004
|
-
});
|
|
6005
|
-
}
|
|
6006
|
-
},
|
|
6007
|
-
h("summary", null, t.params + (required ? " \xB7 " + t.requiredCount(required) : "")),
|
|
6008
|
-
h(
|
|
6009
|
-
"table",
|
|
6010
|
-
{ className: P + "-table" },
|
|
6011
|
-
h("thead", null, h(
|
|
6012
|
-
"tr",
|
|
6013
|
-
null,
|
|
6014
|
-
h("th", null, t.colName),
|
|
6015
|
-
h("th", null, t.colType),
|
|
6016
|
-
h("th", null, t.colReq),
|
|
6017
|
-
h("th", null, t.colExtra),
|
|
6018
|
-
h("th", null, t.colDesc)
|
|
6019
|
-
)),
|
|
6020
|
-
h("tbody", null, rows.map(paramRow))
|
|
6021
|
-
)
|
|
6022
|
-
) : h("div", { className: P + "-none" }, t.noParams),
|
|
6023
|
-
h(
|
|
6024
|
-
"div",
|
|
6025
|
-
{ className: P + "-example" },
|
|
6026
|
-
h(
|
|
6027
|
-
"div",
|
|
6028
|
-
{ className: P + "-examplehead" },
|
|
6029
|
-
h("span", { className: P + "-none" }, t.examples),
|
|
6030
|
-
examples.length ? h("button", {
|
|
6031
|
-
type: "button",
|
|
6032
|
-
className: P + "-copy",
|
|
6033
|
-
"data-copy-example": action.name,
|
|
6034
|
-
onClick: function() {
|
|
6035
|
-
copy(JSON.stringify(examples.length === 1 ? examples[0] : examples, null, 2));
|
|
6036
|
-
}
|
|
6037
|
-
}, t.copy) : null
|
|
6038
|
-
),
|
|
6039
|
-
examples.length ? examples.map(function(example, index) {
|
|
6040
|
-
return h("pre", { className: P + "-pre", key: index }, JSON.stringify(example, null, 2));
|
|
6041
|
-
}) : h("div", { className: P + "-none" }, t.noExamples)
|
|
6042
|
-
),
|
|
6043
|
-
h(
|
|
6044
|
-
"details",
|
|
6045
|
-
null,
|
|
6046
|
-
h("summary", null, t.raw),
|
|
6047
|
-
h("pre", { className: P + "-pre" }, JSON.stringify(action.input || {}, null, 2))
|
|
6048
|
-
)
|
|
6049
|
-
);
|
|
6050
|
-
}
|
|
6051
|
-
var body;
|
|
6052
|
-
if (loading) {
|
|
6053
|
-
body = h("div", { className: P + "-empty", role: "status" }, t.loading);
|
|
6054
|
-
} else if (err) {
|
|
6055
|
-
body = h(
|
|
6056
|
-
"div",
|
|
6057
|
-
{ className: P + "-error", role: "alert" },
|
|
6058
|
-
h("span", null, t.loadFail + "\uFF1A" + err),
|
|
6059
|
-
h("button", { type: "button", className: P + "-copy", onClick: function() {
|
|
6060
|
-
setReload(reload + 1);
|
|
6061
|
-
} }, t.retry)
|
|
6062
|
-
);
|
|
6063
|
-
} else if (!all.length) {
|
|
6064
|
-
body = h("div", { className: P + "-empty" }, t.emptyRegistry);
|
|
6065
|
-
} else if (!visible.length) {
|
|
6066
|
-
body = h("div", { className: P + "-empty" }, t.empty);
|
|
6067
|
-
} else {
|
|
6068
|
-
body = h("div", { className: P + "-list" }, visible.map(card));
|
|
6069
|
-
}
|
|
6070
|
-
return h(
|
|
6071
|
-
"div",
|
|
6072
|
-
{ className: P },
|
|
6073
|
-
h(
|
|
6074
|
-
"div",
|
|
6075
|
-
{ className: P + "-head" },
|
|
6076
|
-
h("h3", { className: P + "-title" }, t.title),
|
|
6077
|
-
h("span", { className: P + "-badge" }, t.domain + " " + DOMAIN),
|
|
6078
|
-
info && info.version ? h("span", { className: P + "-badge" }, t.versionLabel + " v" + info.version) : null,
|
|
6079
|
-
snap && snap.shellVersion ? h("span", { className: P + "-badge" }, t.shell + " v" + snap.shellVersion) : null,
|
|
6080
|
-
h("span", { className: P + "-badge" }, t.count(visible.length, all.length)),
|
|
6081
|
-
h("span", { className: P + "-none" }, t.hint)
|
|
6082
|
-
),
|
|
6083
|
-
h("p", { className: P + "-hintline" }, SOURCE === "actions.list" ? t.hostHint : t.switchHint),
|
|
6084
|
-
snap ? h(
|
|
6085
|
-
"div",
|
|
6086
|
-
{ className: P + "-toolbar" },
|
|
6087
|
-
h(
|
|
6088
|
-
"label",
|
|
6089
|
-
{ className: P + "-search" },
|
|
6090
|
-
icon("search", 14),
|
|
6091
|
-
h("input", {
|
|
6092
|
-
type: "search",
|
|
6093
|
-
value: query,
|
|
6094
|
-
placeholder: t.search,
|
|
6095
|
-
"aria-label": t.search,
|
|
6096
|
-
onChange: function(e) {
|
|
6097
|
-
setQuery(e.target.value);
|
|
6098
|
-
resetFolds();
|
|
6099
|
-
}
|
|
6100
|
-
})
|
|
6101
|
-
),
|
|
6102
|
-
h(
|
|
6103
|
-
"label",
|
|
6104
|
-
{ className: P + "-none" },
|
|
6105
|
-
t.filterReq + " ",
|
|
6106
|
-
h(
|
|
6107
|
-
"select",
|
|
6108
|
-
{ value: reqMode, "aria-label": t.filterReq, onChange: function(e) {
|
|
6109
|
-
setReqMode(e.target.value);
|
|
6110
|
-
resetFolds();
|
|
6111
|
-
} },
|
|
6112
|
-
h("option", { value: "all" }, t.all),
|
|
6113
|
-
h("option", { value: "required" }, t.onlyRequired),
|
|
6114
|
-
h("option", { value: "optional" }, t.onlyOptional)
|
|
6115
|
-
)
|
|
6116
|
-
),
|
|
6117
|
-
h(
|
|
6118
|
-
"label",
|
|
6119
|
-
{ className: P + "-none" },
|
|
6120
|
-
t.filterType + " ",
|
|
6121
|
-
h(
|
|
6122
|
-
"select",
|
|
6123
|
-
{ value: typePick, "aria-label": t.filterType, onChange: function(e) {
|
|
6124
|
-
setTypePick(e.target.value);
|
|
6125
|
-
resetFolds();
|
|
6126
|
-
} },
|
|
6127
|
-
h("option", { value: "" }, t.allTypes),
|
|
6128
|
-
typeOptions.map(function(name) {
|
|
6129
|
-
return h("option", { value: name, key: name }, name);
|
|
6130
|
-
})
|
|
6131
|
-
)
|
|
6132
|
-
),
|
|
6133
|
-
h(
|
|
6134
|
-
"label",
|
|
6135
|
-
{ className: P + "-none" },
|
|
6136
|
-
t.filterOrigin + " ",
|
|
6137
|
-
h(
|
|
6138
|
-
"select",
|
|
6139
|
-
{ value: originPick, "aria-label": t.filterOrigin, "data-origin-filter": "", onChange: function(e) {
|
|
6140
|
-
setOriginPick(e.target.value);
|
|
6141
|
-
} },
|
|
6142
|
-
h("option", { value: "" }, t.allOrigins),
|
|
6143
|
-
ORIGINS.map(function(origin) {
|
|
6144
|
-
return h("option", { value: origin, key: origin }, originText[origin]);
|
|
6145
|
-
})
|
|
6146
|
-
)
|
|
6147
|
-
)
|
|
6148
|
-
) : null,
|
|
6149
|
-
body,
|
|
6150
|
-
toast ? h("div", { className: P + "-toast", role: "status" }, toast) : null
|
|
6151
|
-
);
|
|
6152
|
-
}
|
|
6153
|
-
return { ActionSchemaView, DOMAIN, typeLabel, paramRows };
|
|
6154
|
-
};
|
|
6155
|
-
}
|
|
6156
|
-
});
|
|
6157
|
-
|
|
6158
|
-
// packages/addons/salary/client/views/actions.cjs
|
|
6159
|
-
var require_actions = __commonJS({
|
|
6160
|
-
"packages/addons/salary/client/views/actions.cjs"(exports2, module2) {
|
|
6161
|
-
"use strict";
|
|
6162
|
-
module2.exports = require_action_schema_view()({
|
|
6163
|
-
domain: "wb-addon-salary",
|
|
6164
|
-
prefix: "wbsal"
|
|
6165
|
-
}).ActionSchemaView;
|
|
6166
|
-
}
|
|
6167
|
-
});
|
|
6168
|
-
|
|
6169
4200
|
// packages/addons/salary/client/client.src.cjs
|
|
6170
4201
|
var GLYPHS = require_icons2().ICONS;
|
|
6171
4202
|
(function() {
|
|
@@ -6183,7 +4214,6 @@ var GLYPHS = require_icons2().ICONS;
|
|
|
6183
4214
|
var ICONS = {
|
|
6184
4215
|
records: GLYPHS["wallet"],
|
|
6185
4216
|
stats: GLYPHS["chart-column"],
|
|
6186
|
-
data: GLYPHS["database"],
|
|
6187
4217
|
actions: GLYPHS["list"]
|
|
6188
4218
|
};
|
|
6189
4219
|
function Icon2(props) {
|
|
@@ -6207,13 +4237,11 @@ var GLYPHS = require_icons2().ICONS;
|
|
|
6207
4237
|
ensureStyles();
|
|
6208
4238
|
host.registerAddon({
|
|
6209
4239
|
id: "wb-addon-salary",
|
|
6210
|
-
version: "0.4.
|
|
4240
|
+
version: "0.4.15",
|
|
6211
4241
|
icon: GLYPHS["wallet"],
|
|
6212
4242
|
views: [
|
|
6213
4243
|
{ id: "stats", icon: tabIcon("stats"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: withProps(require_stats(), "\u7EDF\u8BA1") },
|
|
6214
|
-
{ id: "records", icon: tabIcon("records"), title: { zh: "\u8BB0\u5F55", en: "Records" }, component: withProps(require_records(), "\u8BB0\u5F55") }
|
|
6215
|
-
{ id: "data", icon: tabIcon("data"), title: { zh: "\u6570\u636E", en: "Data" }, component: withProps(require_data(), "\u6570\u636E") },
|
|
6216
|
-
{ id: "actions", icon: tabIcon("actions"), title: { zh: "Action", en: "Actions" }, component: withProps(require_actions(), "Action") }
|
|
4244
|
+
{ id: "records", icon: tabIcon("records"), title: { zh: "\u8BB0\u5F55", en: "Records" }, component: withProps(require_records(), "\u8BB0\u5F55") }
|
|
6217
4245
|
]
|
|
6218
4246
|
});
|
|
6219
4247
|
module.exports = { name: "dsh-workbench-salary", inject: [], apply: function() {
|