dsh-workbench-salary 0.4.12 → 0.4.14
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 +104 -1208
- package/lib/domain/actions.js +0 -21
- package/lib/domain/salary.js +1 -6
- package/lib/index.js +2 -1
- package/package.json +3 -6
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,1177 +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
4200
|
// packages/addons/lib/highlight.cjs
|
|
5374
4201
|
var require_highlight = __commonJS({
|
|
5375
4202
|
"packages/addons/lib/highlight.cjs"(exports2, module2) {
|
|
@@ -5414,6 +4241,80 @@ var require_highlight = __commonJS({
|
|
|
5414
4241
|
}
|
|
5415
4242
|
});
|
|
5416
4243
|
|
|
4244
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/chevron-right.mjs
|
|
4245
|
+
var chevron_right_exports = {};
|
|
4246
|
+
__export(chevron_right_exports, {
|
|
4247
|
+
__iconData: () => __iconData6,
|
|
4248
|
+
default: () => ChevronRight
|
|
4249
|
+
});
|
|
4250
|
+
var __iconData6, ChevronRight;
|
|
4251
|
+
var init_chevron_right = __esm({
|
|
4252
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/chevron-right.mjs"() {
|
|
4253
|
+
init_createLucideIcon();
|
|
4254
|
+
__iconData6 = {
|
|
4255
|
+
name: "chevron-right",
|
|
4256
|
+
size: 24,
|
|
4257
|
+
node: [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]]
|
|
4258
|
+
};
|
|
4259
|
+
__iconData6.node;
|
|
4260
|
+
ChevronRight = createLucideIcon(__iconData6);
|
|
4261
|
+
}
|
|
4262
|
+
});
|
|
4263
|
+
|
|
4264
|
+
// packages/addons/lib/disclosure-styles.cjs
|
|
4265
|
+
var require_disclosure_styles = __commonJS({
|
|
4266
|
+
"packages/addons/lib/disclosure-styles.cjs"(exports2, module2) {
|
|
4267
|
+
"use strict";
|
|
4268
|
+
module2.exports = [
|
|
4269
|
+
".wb-disc{min-width:0;border:0;padding:0;margin:0}",
|
|
4270
|
+
// 原生 details/summary 保留键盘与无障碍语义,这里只接管观感:去掉默认三角并铺满整行。
|
|
4271
|
+
".wb-disc>summary{display:flex;align-items:center;gap:6px;cursor:pointer;font-size:12.5px;font-weight:600;line-height:1.6;color:inherit;user-select:none;list-style:none;padding:2px 8px 2px 2px;margin:-2px -8px -2px -2px;border-radius:7px}",
|
|
4272
|
+
".wb-disc>summary::-webkit-details-marker{display:none}",
|
|
4273
|
+
'.wb-disc>summary::marker{content:""}',
|
|
4274
|
+
".wb-disc>summary:hover{background:color-mix(in oklab,currentColor 6%,transparent)}",
|
|
4275
|
+
".wb-disc>summary:focus-visible{outline:2px solid var(--wb-accent,var(--dsw-alias-brand-primary,Highlight));outline-offset:2px}",
|
|
4276
|
+
".wb-disc-chev{flex:0 0 auto;width:14px;height:14px;transition:transform 160ms ease}",
|
|
4277
|
+
".wb-disc[open]>summary .wb-disc-chev{transform:rotate(90deg)}",
|
|
4278
|
+
".wb-disc-title{min-width:0;overflow-wrap:anywhere}",
|
|
4279
|
+
".wb-disc-meta{font-weight:400;font-size:12px;color:var(--wb-muted,var(--dsw-alias-label-tertiary,GrayText))}",
|
|
4280
|
+
".wb-disc-body{margin-top:8px;min-width:0;animation:wb-disc-in 160ms ease}",
|
|
4281
|
+
"@keyframes wb-disc-in{from{opacity:0;transform:translateY(-2px)}to{opacity:1;transform:none}}",
|
|
4282
|
+
"@media(prefers-reduced-motion:reduce){.wb-disc-chev{transition:none}.wb-disc-body{animation:none}}"
|
|
4283
|
+
].join("\n");
|
|
4284
|
+
}
|
|
4285
|
+
});
|
|
4286
|
+
|
|
4287
|
+
// packages/addons/lib/disclosure.cjs
|
|
4288
|
+
var require_disclosure = __commonJS({
|
|
4289
|
+
"packages/addons/lib/disclosure.cjs"(exports2, module2) {
|
|
4290
|
+
"use strict";
|
|
4291
|
+
var ChevronRight2 = (init_chevron_right(), __toCommonJS(chevron_right_exports)).default;
|
|
4292
|
+
function createDisclosure(React) {
|
|
4293
|
+
var h = React.createElement;
|
|
4294
|
+
function Disclosure(props) {
|
|
4295
|
+
var attrs = Object.assign({ className: ("wb-disc " + (props.className || "")).trim() }, props.attrs || {});
|
|
4296
|
+
if (props.open !== void 0) attrs.open = !!props.open;
|
|
4297
|
+
else if (props.defaultOpen !== void 0) attrs.open = !!props.defaultOpen;
|
|
4298
|
+
if (props.onToggle) attrs.onToggle = props.onToggle;
|
|
4299
|
+
return h(
|
|
4300
|
+
"details",
|
|
4301
|
+
attrs,
|
|
4302
|
+
h(
|
|
4303
|
+
"summary",
|
|
4304
|
+
null,
|
|
4305
|
+
h(ChevronRight2, { className: "wb-disc-chev", "aria-hidden": true, focusable: false }),
|
|
4306
|
+
h("span", { className: "wb-disc-title" }, props.title),
|
|
4307
|
+
props.meta != null && props.meta !== "" ? h("span", { className: "wb-disc-meta" }, props.meta) : null
|
|
4308
|
+
),
|
|
4309
|
+
h("div", { className: "wb-disc-body" }, props.children)
|
|
4310
|
+
);
|
|
4311
|
+
}
|
|
4312
|
+
return { Disclosure, css: require_disclosure_styles() };
|
|
4313
|
+
}
|
|
4314
|
+
module2.exports = { createDisclosure, css: require_disclosure_styles() };
|
|
4315
|
+
}
|
|
4316
|
+
});
|
|
4317
|
+
|
|
5417
4318
|
// packages/addons/lib/action-schema-style.cjs
|
|
5418
4319
|
var require_action_schema_style = __commonJS({
|
|
5419
4320
|
"packages/addons/lib/action-schema-style.cjs"(exports2, module2) {
|
|
@@ -5463,12 +4364,8 @@ var require_action_schema_style = __commonJS({
|
|
|
5463
4364
|
"." + 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
4365
|
"." + P + "-copy:hover{background:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent))}",
|
|
5465
4366
|
"." + P + "-copy:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
5466
|
-
|
|
5467
|
-
"." + P + " details>summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
5468
|
-
// 参数折叠面板:折叠时只留一行「参数 · 必填 n」,展开后与表格之间留一点气口。
|
|
4367
|
+
// 折叠头观感已收口到共享控件 disclosure-styles.cjs(.wb-disc),这里不再重复定义 details>summary。
|
|
5469
4368
|
"." + P + "-params{min-width:0}",
|
|
5470
|
-
"." + P + "-params>summary{user-select:none;max-width:100%}",
|
|
5471
|
-
"." + P + "-params[open]>summary{margin-bottom:6px}",
|
|
5472
4369
|
"." + 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
4370
|
"." + 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
4371
|
"." + 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%}",
|
|
@@ -5478,7 +4375,7 @@ var require_action_schema_style = __commonJS({
|
|
|
5478
4375
|
// 中等宽度(521–760px)三个筛选项正好排成一行,避免第三项独占一行显得参差。
|
|
5479
4376
|
"@media(min-width:521px) and (max-width:760px){." + P + "-toolbar{grid-template-columns:repeat(3,minmax(0,1fr))}}",
|
|
5480
4377
|
"@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");
|
|
4378
|
+
].join("\n") + "\n" + require_disclosure_styles();
|
|
5482
4379
|
return function injectCss() {
|
|
5483
4380
|
if (typeof document === "undefined") return;
|
|
5484
4381
|
var id = "wb-addon-" + DOMAIN + "-actions-css";
|
|
@@ -5503,6 +4400,7 @@ var require_action_schema_view = __commonJS({
|
|
|
5503
4400
|
"use strict";
|
|
5504
4401
|
var React = require("react");
|
|
5505
4402
|
var createHighlight = require_highlight()(React);
|
|
4403
|
+
var Disclosure = require_disclosure().createDisclosure(React).Disclosure;
|
|
5506
4404
|
var h = React.createElement;
|
|
5507
4405
|
var COPY = {
|
|
5508
4406
|
zh: {
|
|
@@ -5987,10 +4885,12 @@ var require_action_schema_view = __commonJS({
|
|
|
5987
4885
|
),
|
|
5988
4886
|
action.description ? h("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
|
|
5989
4887
|
rows.length ? h(
|
|
5990
|
-
|
|
4888
|
+
Disclosure,
|
|
5991
4889
|
{
|
|
5992
4890
|
className: P + "-params",
|
|
5993
|
-
|
|
4891
|
+
title: t.params,
|
|
4892
|
+
meta: required ? t.requiredCount(required) : "",
|
|
4893
|
+
attrs: { "data-params-fold": action.name },
|
|
5994
4894
|
open,
|
|
5995
4895
|
// 原生 details 自带键盘与无障碍语义,这里只记下用户的开合;
|
|
5996
4896
|
// 筛选变化引起的程序性开合也会触发 toggle,记下的值与当次默认一致,随后由 resetFolds 清掉。
|
|
@@ -6004,7 +4904,6 @@ var require_action_schema_view = __commonJS({
|
|
|
6004
4904
|
});
|
|
6005
4905
|
}
|
|
6006
4906
|
},
|
|
6007
|
-
h("summary", null, t.params + (required ? " \xB7 " + t.requiredCount(required) : "")),
|
|
6008
4907
|
h(
|
|
6009
4908
|
"table",
|
|
6010
4909
|
{ className: P + "-table" },
|
|
@@ -6041,9 +4940,8 @@ var require_action_schema_view = __commonJS({
|
|
|
6041
4940
|
}) : h("div", { className: P + "-none" }, t.noExamples)
|
|
6042
4941
|
),
|
|
6043
4942
|
h(
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
h("summary", null, t.raw),
|
|
4943
|
+
Disclosure,
|
|
4944
|
+
{ title: t.raw },
|
|
6047
4945
|
h("pre", { className: P + "-pre" }, JSON.stringify(action.input || {}, null, 2))
|
|
6048
4946
|
)
|
|
6049
4947
|
);
|
|
@@ -6183,7 +5081,6 @@ var GLYPHS = require_icons2().ICONS;
|
|
|
6183
5081
|
var ICONS = {
|
|
6184
5082
|
records: GLYPHS["wallet"],
|
|
6185
5083
|
stats: GLYPHS["chart-column"],
|
|
6186
|
-
data: GLYPHS["database"],
|
|
6187
5084
|
actions: GLYPHS["list"]
|
|
6188
5085
|
};
|
|
6189
5086
|
function Icon2(props) {
|
|
@@ -6207,12 +5104,11 @@ var GLYPHS = require_icons2().ICONS;
|
|
|
6207
5104
|
ensureStyles();
|
|
6208
5105
|
host.registerAddon({
|
|
6209
5106
|
id: "wb-addon-salary",
|
|
6210
|
-
version: "0.4.
|
|
5107
|
+
version: "0.4.14",
|
|
6211
5108
|
icon: GLYPHS["wallet"],
|
|
6212
5109
|
views: [
|
|
6213
5110
|
{ id: "stats", icon: tabIcon("stats"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: withProps(require_stats(), "\u7EDF\u8BA1") },
|
|
6214
5111
|
{ 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
5112
|
{ id: "actions", icon: tabIcon("actions"), title: { zh: "Action", en: "Actions" }, component: withProps(require_actions(), "Action") }
|
|
6217
5113
|
]
|
|
6218
5114
|
});
|