dsh-workbench-vault 0.0.0-stage → 0.3.5
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/LICENSE +21 -0
- package/README.md +26 -2
- package/cordis.patch.yml +6 -0
- package/lib/client.js +4559 -0
- package/lib/db/db.js +401 -0
- package/lib/domain/actions-sets.js +271 -0
- package/lib/domain/actions.js +511 -0
- package/lib/domain/groups.js +301 -0
- package/lib/domain/migrate.js +128 -0
- package/lib/domain/secret-input.js +33 -0
- package/lib/domain/sets.js +303 -0
- package/lib/domain/vault.js +589 -0
- package/lib/index.js +164 -0
- package/lib/infra/crypto.js +79 -0
- package/package.json +116 -4
package/lib/client.js
ADDED
|
@@ -0,0 +1,4559 @@
|
|
|
1
|
+
// 由 scripts/build-addon-clients.mjs 生成;请修改对应 client/client.src.cjs 后重新构建。
|
|
2
|
+
window.__ModuleLoader__ = window.__ModuleLoader__ || { modules: {}, load: function (m) { this.modules[m.id] = m.factory; } };
|
|
3
|
+
window.__ModuleLoader__.load({
|
|
4
|
+
id: "dsh-workbench-vault",
|
|
5
|
+
factory: function (require) {
|
|
6
|
+
var module = { exports: {} };
|
|
7
|
+
var exports = module.exports;
|
|
8
|
+
"use strict";
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __esm = (fn, res, err) => function __init() {
|
|
14
|
+
if (err) throw err[0];
|
|
15
|
+
try {
|
|
16
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw err = [e], e;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
22
|
+
try {
|
|
23
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
24
|
+
} catch (e) {
|
|
25
|
+
throw mod = 0, e;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var __export = (target, all) => {
|
|
29
|
+
for (var name in all)
|
|
30
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
31
|
+
};
|
|
32
|
+
var __copyProps = (to, from, except, desc) => {
|
|
33
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
34
|
+
for (let key of __getOwnPropNames(from))
|
|
35
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
36
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
37
|
+
}
|
|
38
|
+
return to;
|
|
39
|
+
};
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
+
|
|
42
|
+
// packages/addons/lib/filter-checklist-styles.cjs
|
|
43
|
+
var require_filter_checklist_styles = __commonJS({
|
|
44
|
+
"packages/addons/lib/filter-checklist-styles.cjs"(exports2, module2) {
|
|
45
|
+
"use strict";
|
|
46
|
+
module2.exports = [
|
|
47
|
+
".wbck{display:flex;flex-direction:column;min-width:0}",
|
|
48
|
+
".wbck-search{padding:0 0 6px}",
|
|
49
|
+
".wbck-input{width:100%;box-sizing:border-box;font:inherit;font-size:12.5px;padding:6px 9px;border:1px solid var(--wb-border);border-radius:8px;background:var(--wb-surface);color:inherit}",
|
|
50
|
+
".wbck-input:focus-visible{outline:2px solid var(--wb-accent);outline-offset:1px}",
|
|
51
|
+
".wbck-input:disabled{opacity:.6;cursor:not-allowed}",
|
|
52
|
+
".wbck-head{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--wb-muted);padding:2px 4px 7px}",
|
|
53
|
+
".wbck-grow{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
54
|
+
".wbck-sel{flex:none;color:var(--wb-accent)}",
|
|
55
|
+
".wbck-clear{appearance:none;flex:none;border:0;background:transparent;color:inherit;border-radius:4px;margin:0;padding:3px 5px;font:inherit;font-size:11.5px;line-height:1;cursor:pointer;opacity:.75}",
|
|
56
|
+
".wbck-clear:hover:enabled{opacity:1;background:color-mix(in srgb, currentColor 8%, transparent)}",
|
|
57
|
+
".wbck-clear:focus-visible{outline:2px solid var(--wb-accent);outline-offset:1px}",
|
|
58
|
+
".wbck-clear:disabled{opacity:.4;cursor:not-allowed}",
|
|
59
|
+
".wbck-list{max-height:220px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--wb-border);border-radius:10px;padding:2px}",
|
|
60
|
+
".wbck-opt{display:flex;align-items:center;gap:7px;padding:6px;border-radius:6px;font-size:12.5px;cursor:pointer}",
|
|
61
|
+
".wbck-opt:hover{background:color-mix(in srgb, currentColor 7%, transparent)}",
|
|
62
|
+
".wbck-opt.is-on{background:color-mix(in srgb, var(--wb-accent) 10%, transparent)}",
|
|
63
|
+
".wbck-opt input{margin:0;flex:none;accent-color:var(--wb-accent)}",
|
|
64
|
+
".wbck-nm{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
65
|
+
".wbck-meta{margin-left:auto;flex:none;font-size:11.5px;color:var(--wb-muted)}",
|
|
66
|
+
".wbck-note{font-size:12px;color:var(--wb-muted);padding:8px 6px}",
|
|
67
|
+
".wbck-more{font-size:11px;color:var(--wb-muted);text-align:center;padding:6px 0 2px;opacity:.8}",
|
|
68
|
+
"@media (max-width:760px){.wbck-list{max-height:200px}}"
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// packages/addons/vault/client/ui/styles.cjs
|
|
74
|
+
var require_styles = __commonJS({
|
|
75
|
+
"packages/addons/vault/client/ui/styles.cjs"(exports2, module2) {
|
|
76
|
+
"use strict";
|
|
77
|
+
module2.exports = [
|
|
78
|
+
".wbv{display:flex;flex-direction:column;gap:14px;font-size:13px;min-height:100%;padding:2px}",
|
|
79
|
+
".wbv h2{font-size:17px;margin:0}.wbv h3{font-size:14px;margin:0}",
|
|
80
|
+
".wbv-muted{opacity:.62}.wbv-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}",
|
|
81
|
+
".wbv-grow{flex:1}.wbv-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}",
|
|
82
|
+
".wbv-card{border:1px solid var(--wb-border);border-radius:10px;padding:12px;background:var(--wb-card)}",
|
|
83
|
+
".wbv-card h3{margin-bottom:6px}.wbv-kpi{font-size:22px;font-weight:650;line-height:1.2}",
|
|
84
|
+
".wbv-btn{border:1px solid var(--wb-border);background:var(--wb-card);color:inherit;border-radius:7px;padding:5px 10px;cursor:pointer;font-size:12px;line-height:1.4}",
|
|
85
|
+
".wbv-btn:hover{border-color:var(--wb-accent)}.wbv-btn:disabled{opacity:.45;cursor:not-allowed}",
|
|
86
|
+
".wbv-btn.primary{background:var(--wb-accent);border-color:var(--wb-accent);color:var(--wb-on-accent,inherit)}",
|
|
87
|
+
".wbv-btn.danger{color:var(--wb-danger);border-color:color-mix(in srgb,var(--wb-danger) 45%,transparent)}",
|
|
88
|
+
".wbv-btn.ghost{background:transparent;border-color:transparent;color:var(--wb-accent);padding:2px 4px}",
|
|
89
|
+
".wbv-field{display:flex;flex-direction:column;gap:4px;min-width:180px;flex:1}",
|
|
90
|
+
".wbv-label{font-size:11px;font-weight:600;opacity:.75}.wbv-hint{font-size:11px;opacity:.55}",
|
|
91
|
+
".wbv input,.wbv select,.wbv textarea{border:1px solid var(--wb-border);border-radius:7px;padding:6px 8px;font:inherit;background:var(--wb-surface);color:inherit;width:100%;box-sizing:border-box}",
|
|
92
|
+
".wbv input[type=checkbox]{width:auto}",
|
|
93
|
+
".wbv textarea{min-height:70px;resize:vertical}",
|
|
94
|
+
".wbv-notice{border-radius:8px;padding:8px 10px;font-size:12px;border:1px solid var(--wb-border);background:color-mix(in srgb,var(--wb-accent) 8%,transparent);color:inherit}",
|
|
95
|
+
".wbv-notice.error{border-color:color-mix(in srgb,var(--wb-danger) 45%,transparent);background:color-mix(in srgb,var(--wb-danger) 10%,transparent);color:var(--wb-danger)}",
|
|
96
|
+
".wbv-notice.ok{border-color:color-mix(in srgb,var(--wb-ok) 45%,transparent);background:color-mix(in srgb,var(--wb-ok) 10%,transparent);color:var(--wb-ok)}",
|
|
97
|
+
".wbv-empty{padding:22px;text-align:center;opacity:.55;border:1px dashed var(--wb-border);border-radius:10px}",
|
|
98
|
+
".wbv-table{width:100%;border-collapse:collapse;font-size:12px}",
|
|
99
|
+
".wbv-table th,.wbv-table td{text-align:left;padding:7px 8px;border-bottom:1px solid var(--wb-line);vertical-align:top}",
|
|
100
|
+
".wbv-table th{font-weight:600;opacity:.65;white-space:nowrap}.wbv-table code{font-size:11px;opacity:.8}",
|
|
101
|
+
".wbv-table tbody tr:hover{background:color-mix(in srgb,var(--wb-muted) 8%,transparent)}",
|
|
102
|
+
".wbv-pill{display:inline-block;border-radius:999px;padding:1px 8px;font-size:11px;background:color-mix(in srgb,var(--wb-muted) 14%,transparent);color:inherit}",
|
|
103
|
+
".wbv-pill.ok{background:color-mix(in srgb,var(--wb-ok) 16%,transparent);color:var(--wb-ok)}",
|
|
104
|
+
".wbv-pill.warn{background:color-mix(in srgb,var(--wb-warn) 18%,transparent);color:var(--wb-warn)}",
|
|
105
|
+
".wbv-pill.bad{background:color-mix(in srgb,var(--wb-danger) 16%,transparent);color:var(--wb-danger)}",
|
|
106
|
+
".wbv-tabs{display:flex;gap:6px;flex-wrap:wrap}.wbv-tab{border:none;background:transparent;padding:4px 8px;border-radius:6px;cursor:pointer;font-size:12px}",
|
|
107
|
+
".wbv-tab.on{background:color-mix(in srgb,var(--wb-accent) 12%,transparent);color:var(--wb-accent);font-weight:600}",
|
|
108
|
+
".wbv-secret{font-family:ui-monospace,Menlo,Consolas,monospace;background:var(--wb-surface);border:1px solid var(--wb-border);border-radius:6px;padding:6px 8px;word-break:break-all}",
|
|
109
|
+
".wbv-inline{display:flex;gap:6px;align-items:center;flex-wrap:wrap}",
|
|
110
|
+
".wbv-modal{position:fixed;inset:0;background:color-mix(in srgb,var(--wb-muted) 45%,transparent);display:flex;align-items:center;justify-content:center;z-index:50;padding:18px}",
|
|
111
|
+
".wbv-modal-box{background:var(--wb-card);border:1px solid var(--wb-border);border-radius:12px;padding:16px;width:min(520px,100%);max-height:88vh;overflow:auto;display:flex;flex-direction:column;gap:10px;box-shadow:0 12px 40px color-mix(in srgb,var(--wb-muted) 30%,transparent)}",
|
|
112
|
+
".wbv-code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:11px;white-space:pre-wrap;word-break:break-word;background:var(--wb-surface);border:1px solid var(--wb-border);border-radius:8px;padding:10px;max-height:320px;overflow:auto}",
|
|
113
|
+
".wbv-split{display:grid;grid-template-columns:minmax(260px,1fr) minmax(320px,1.6fr);gap:12px;align-items:start}",
|
|
114
|
+
".wbv-list{display:flex;flex-direction:column;gap:6px}",
|
|
115
|
+
".wbv-item{border:1px solid var(--wb-border);border-radius:10px;padding:9px 10px;background:var(--wb-card);cursor:pointer}",
|
|
116
|
+
".wbv-item:hover{border-color:var(--wb-accent)}",
|
|
117
|
+
".wbv-item.on{border-color:var(--wb-accent);box-shadow:inset 3px 0 0 var(--wb-accent)}",
|
|
118
|
+
".wbv-item-top{display:flex;gap:8px;align-items:center}",
|
|
119
|
+
".wbv-dot{width:10px;height:10px;border-radius:999px;flex:none;background:var(--wb-accent)}",
|
|
120
|
+
".wbv-chips{display:flex;gap:6px;flex-wrap:wrap}",
|
|
121
|
+
".wbv-chip{display:inline-flex;gap:6px;align-items:center;border:1px solid var(--wb-border);border-radius:999px;padding:2px 8px;font-size:11px;background:var(--wb-surface)}",
|
|
122
|
+
".wbv-check{display:flex;gap:6px;align-items:center;padding:3px 0;font-size:12px}",
|
|
123
|
+
".wbv-scroll{max-height:220px;overflow:auto;border:1px solid var(--wb-border);border-radius:8px;padding:8px}",
|
|
124
|
+
"@media (max-width:820px){.wbv-split{grid-template-columns:1fr}}",
|
|
125
|
+
".wbv-search{flex:0 0 220px;width:220px}",
|
|
126
|
+
".wbv-row>input:not([type=checkbox]),.wbv-row>select{width:auto;flex:0 1 220px;min-width:120px}",
|
|
127
|
+
".wbv-sub{font-size:12px;opacity:.65;margin-top:2px}",
|
|
128
|
+
".wbv-table tbody tr:hover{background:color-mix(in srgb,var(--wb-accent) 6%,transparent)}",
|
|
129
|
+
".wbv-table td{vertical-align:top}",
|
|
130
|
+
".wbv-empty-card{border:1px dashed var(--wb-border);border-radius:10px;padding:28px 16px;display:flex;flex-direction:column;gap:8px;align-items:center;text-align:center;background:var(--wb-card)}",
|
|
131
|
+
".wbv-empty-title{font-size:14px;font-weight:600}",
|
|
132
|
+
".wbv-check-list{display:flex;flex-wrap:wrap;gap:6px 14px;margin:4px 0}",
|
|
133
|
+
".wbv-check{display:inline-flex;align-items:center;gap:6px;font-size:12px;cursor:pointer}",
|
|
134
|
+
".wbv-dot{width:8px;height:8px;border-radius:50%;display:inline-block;flex:none}",
|
|
135
|
+
".wbv-secret-field{position:relative;display:flex;align-items:center;min-width:0}",
|
|
136
|
+
".wbv-secret-field input{flex:1 1 auto;min-width:0;padding-right:34px}",
|
|
137
|
+
".wbv-eye{position:absolute;right:4px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:6px;padding:4px;color:var(--wb-muted);cursor:pointer}",
|
|
138
|
+
".wbv-eye:hover{color:var(--wb-accent);background:color-mix(in srgb, var(--wb-accent) 12%, transparent)}",
|
|
139
|
+
".wbv-eye:focus-visible{outline:2px solid var(--wb-accent);outline-offset:1px}"
|
|
140
|
+
].concat(require_filter_checklist_styles());
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs
|
|
145
|
+
var toKebabCase;
|
|
146
|
+
var init_toKebabCase = __esm({
|
|
147
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs"() {
|
|
148
|
+
toKebabCase = (string) => string?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs
|
|
153
|
+
function toLucideIconData(iconName, iconNode, aliases = []) {
|
|
154
|
+
if (iconNode == null) {
|
|
155
|
+
throw new Error("[lucide]: iconNode is required when icon name is used");
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
name: toKebabCase(iconName),
|
|
159
|
+
size: 24,
|
|
160
|
+
node: iconNode,
|
|
161
|
+
...aliases.length > 0 ? { aliases } : {}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
var init_toLucideIconData = __esm({
|
|
165
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs"() {
|
|
166
|
+
init_toKebabCase();
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs
|
|
171
|
+
var toCamelCase;
|
|
172
|
+
var init_toCamelCase = __esm({
|
|
173
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs"() {
|
|
174
|
+
toCamelCase = (string) => {
|
|
175
|
+
let out = "";
|
|
176
|
+
let upperNext = false;
|
|
177
|
+
for (const ch of string) {
|
|
178
|
+
if (ch === "-" || ch === "_" || ch <= " ") {
|
|
179
|
+
upperNext = out.length > 0;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (out.length === 0) {
|
|
183
|
+
out += ch.toLowerCase();
|
|
184
|
+
} else {
|
|
185
|
+
out += upperNext ? ch.toUpperCase() : ch;
|
|
186
|
+
}
|
|
187
|
+
upperNext = false;
|
|
188
|
+
}
|
|
189
|
+
return out;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs
|
|
195
|
+
var toPascalCase;
|
|
196
|
+
var init_toPascalCase = __esm({
|
|
197
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs"() {
|
|
198
|
+
init_toCamelCase();
|
|
199
|
+
toPascalCase = (string) => {
|
|
200
|
+
const camelCase = toCamelCase(string);
|
|
201
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
|
|
207
|
+
var mergeClasses;
|
|
208
|
+
var init_mergeClasses = __esm({
|
|
209
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs"() {
|
|
210
|
+
mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
211
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
212
|
+
}).join(" ").trim();
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.mjs
|
|
217
|
+
var defaultAttributes;
|
|
218
|
+
var init_defaultAttributes = __esm({
|
|
219
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.mjs"() {
|
|
220
|
+
defaultAttributes = {
|
|
221
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
222
|
+
width: 24,
|
|
223
|
+
height: 24,
|
|
224
|
+
viewBox: "0 0 24 24",
|
|
225
|
+
fill: "none",
|
|
226
|
+
stroke: "currentColor",
|
|
227
|
+
"stroke-width": 2,
|
|
228
|
+
"stroke-linecap": "round",
|
|
229
|
+
"stroke-linejoin": "round"
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs
|
|
235
|
+
function isDefined(value) {
|
|
236
|
+
return value !== null && value !== void 0;
|
|
237
|
+
}
|
|
238
|
+
function buildLucideIconNode(icon, params = {}) {
|
|
239
|
+
const attributeNames = params.attributeNames ?? {};
|
|
240
|
+
const getAttributeName = (attributeName) => attributeNames[attributeName] ?? attributeName;
|
|
241
|
+
const viewBoxWidth = icon.size ?? icon.width ?? defaultAttributes["width"];
|
|
242
|
+
const viewBoxHeight = icon.size ?? icon.height ?? defaultAttributes["height"];
|
|
243
|
+
const aliasClassNames = icon.aliases?.filter((alias) => typeof alias === "string" && alias.trim() !== "").map((alias) => `lucide-${alias}`) ?? [];
|
|
244
|
+
const iconClassNames = [...icon.name ? [`lucide-${icon.name}`] : [], ...aliasClassNames];
|
|
245
|
+
const classNamesFromClassName = params.className?.split(" ").filter(Boolean) ?? [];
|
|
246
|
+
const className = params.includeDefaultClasses === false ? mergeClasses(...classNamesFromClassName) : mergeClasses("lucide", ...iconClassNames, ...classNamesFromClassName);
|
|
247
|
+
const calculatedStrokeWidth = params.absoluteStrokeWidth ? Number(params.strokeWidth ?? defaultAttributes["stroke-width"]) * Number(icon.size ?? icon.width ?? defaultAttributes["width"]) / Number(params.size ?? params.width ?? defaultAttributes["width"]) : params.strokeWidth ?? defaultAttributes["stroke-width"];
|
|
248
|
+
const attributes = {
|
|
249
|
+
...Object.entries(defaultAttributes).reduce((attrs, [attrName, value]) => {
|
|
250
|
+
attrs[getAttributeName(attrName)] = value;
|
|
251
|
+
return attrs;
|
|
252
|
+
}, {}),
|
|
253
|
+
..."color" in params && params.color && {
|
|
254
|
+
[getAttributeName("stroke")]: params.color
|
|
255
|
+
},
|
|
256
|
+
..."size" in params && isDefined(params.size) && {
|
|
257
|
+
[getAttributeName("width")]: params.size,
|
|
258
|
+
[getAttributeName("height")]: params.size
|
|
259
|
+
},
|
|
260
|
+
..."width" in params && isDefined(params.width) && {
|
|
261
|
+
[getAttributeName("width")]: params.width
|
|
262
|
+
},
|
|
263
|
+
..."height" in params && isDefined(params.height) && {
|
|
264
|
+
[getAttributeName("height")]: params.height
|
|
265
|
+
},
|
|
266
|
+
[getAttributeName("stroke-width")]: calculatedStrokeWidth,
|
|
267
|
+
...className && {
|
|
268
|
+
[getAttributeName("class")]: className
|
|
269
|
+
},
|
|
270
|
+
[getAttributeName("viewBox")]: `0 0 ${viewBoxWidth} ${viewBoxHeight}`,
|
|
271
|
+
...params.hasA11yProp === false ? {
|
|
272
|
+
[getAttributeName("aria-hidden")]: "true"
|
|
273
|
+
} : {},
|
|
274
|
+
..."attributes" in params && params.attributes
|
|
275
|
+
};
|
|
276
|
+
return [
|
|
277
|
+
"svg",
|
|
278
|
+
attributes,
|
|
279
|
+
icon.node.map((child) => {
|
|
280
|
+
const [name, attrs, children] = child;
|
|
281
|
+
const nextAttrs = params.nonScalingStroke ? { [getAttributeName("vector-effect")]: "non-scaling-stroke", ...attrs } : attrs;
|
|
282
|
+
return children ? [name, nextAttrs, children] : [name, nextAttrs];
|
|
283
|
+
})
|
|
284
|
+
];
|
|
285
|
+
}
|
|
286
|
+
var init_buildLucideIconNode = __esm({
|
|
287
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs"() {
|
|
288
|
+
init_defaultAttributes();
|
|
289
|
+
init_mergeClasses();
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs
|
|
294
|
+
function buildLucideIconForReact(icon, params = {}) {
|
|
295
|
+
return buildLucideIconNode(icon, {
|
|
296
|
+
...params,
|
|
297
|
+
attributeNames: {
|
|
298
|
+
...params.attributeNames,
|
|
299
|
+
class: "className",
|
|
300
|
+
"stroke-width": "strokeWidth",
|
|
301
|
+
"stroke-linecap": "strokeLinecap",
|
|
302
|
+
"stroke-linejoin": "strokeLinejoin",
|
|
303
|
+
"vector-effect": "vectorEffect"
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
var init_buildLucideIconForReact = __esm({
|
|
308
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs"() {
|
|
309
|
+
init_buildLucideIconNode();
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs
|
|
314
|
+
var hasA11yProp;
|
|
315
|
+
var init_hasA11yProp = __esm({
|
|
316
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs"() {
|
|
317
|
+
hasA11yProp = (props) => {
|
|
318
|
+
for (const prop in props) {
|
|
319
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return false;
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/context.mjs
|
|
329
|
+
var import_react, LucideContext, useLucideContext;
|
|
330
|
+
var init_context = __esm({
|
|
331
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/context.mjs"() {
|
|
332
|
+
"use strict";
|
|
333
|
+
"use client";
|
|
334
|
+
import_react = require("react");
|
|
335
|
+
LucideContext = (0, import_react.createContext)({});
|
|
336
|
+
useLucideContext = () => (0, import_react.useContext)(LucideContext);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/Icon.mjs
|
|
341
|
+
var import_react2, Icon;
|
|
342
|
+
var init_Icon = __esm({
|
|
343
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/Icon.mjs"() {
|
|
344
|
+
"use strict";
|
|
345
|
+
"use client";
|
|
346
|
+
import_react2 = require("react");
|
|
347
|
+
init_mergeClasses();
|
|
348
|
+
init_buildLucideIconForReact();
|
|
349
|
+
init_hasA11yProp();
|
|
350
|
+
init_context();
|
|
351
|
+
Icon = (0, import_react2.forwardRef)(
|
|
352
|
+
({
|
|
353
|
+
color,
|
|
354
|
+
size,
|
|
355
|
+
width,
|
|
356
|
+
height,
|
|
357
|
+
strokeWidth,
|
|
358
|
+
absoluteStrokeWidth,
|
|
359
|
+
nonScalingStroke,
|
|
360
|
+
className = "",
|
|
361
|
+
children,
|
|
362
|
+
iconNode = [],
|
|
363
|
+
icon = {
|
|
364
|
+
node: iconNode,
|
|
365
|
+
aliases: [],
|
|
366
|
+
size: 24
|
|
367
|
+
},
|
|
368
|
+
...rest
|
|
369
|
+
}, ref) => {
|
|
370
|
+
const {
|
|
371
|
+
size: contextSize = 24,
|
|
372
|
+
strokeWidth: contextStrokeWidth = 2,
|
|
373
|
+
absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
|
|
374
|
+
nonScalingStroke: contextNonScalingStroke = false,
|
|
375
|
+
color: contextColor = "currentColor",
|
|
376
|
+
className: contextClass = ""
|
|
377
|
+
} = useLucideContext() ?? {};
|
|
378
|
+
const hasAccessibleProp = Boolean(children) || hasA11yProp(rest);
|
|
379
|
+
const [name, svgAttributes, builtIconNode = []] = buildLucideIconForReact(icon, {
|
|
380
|
+
color: color ?? contextColor,
|
|
381
|
+
width: width ?? size ?? contextSize,
|
|
382
|
+
height: height ?? size ?? contextSize,
|
|
383
|
+
strokeWidth: strokeWidth ?? contextStrokeWidth,
|
|
384
|
+
absoluteStrokeWidth: absoluteStrokeWidth ?? contextAbsoluteStrokeWidth,
|
|
385
|
+
nonScalingStroke: nonScalingStroke ?? contextNonScalingStroke,
|
|
386
|
+
className: mergeClasses(contextClass, className),
|
|
387
|
+
hasA11yProp: hasAccessibleProp,
|
|
388
|
+
attributes: rest
|
|
389
|
+
});
|
|
390
|
+
return (0, import_react2.createElement)(
|
|
391
|
+
name,
|
|
392
|
+
{
|
|
393
|
+
ref,
|
|
394
|
+
...svgAttributes
|
|
395
|
+
},
|
|
396
|
+
[
|
|
397
|
+
...builtIconNode.map(([tag, attrs]) => (0, import_react2.createElement)(tag, attrs)),
|
|
398
|
+
...Array.isArray(children) ? children : [children]
|
|
399
|
+
]
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.mjs
|
|
407
|
+
function createLucideIcon(iconDataOrName, iconNode = [], aliases = []) {
|
|
408
|
+
const iconData = typeof iconDataOrName === "string" ? toLucideIconData(iconDataOrName, iconNode, aliases) : iconDataOrName;
|
|
409
|
+
const Component = (0, import_react3.forwardRef)(
|
|
410
|
+
({ className, ...props }, ref) => (0, import_react3.createElement)(Icon, {
|
|
411
|
+
ref,
|
|
412
|
+
icon: iconData,
|
|
413
|
+
className,
|
|
414
|
+
...props
|
|
415
|
+
})
|
|
416
|
+
);
|
|
417
|
+
if (iconData.name) {
|
|
418
|
+
Component.displayName = toPascalCase(iconData.name);
|
|
419
|
+
}
|
|
420
|
+
return Component;
|
|
421
|
+
}
|
|
422
|
+
var import_react3;
|
|
423
|
+
var init_createLucideIcon = __esm({
|
|
424
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.mjs"() {
|
|
425
|
+
import_react3 = require("react");
|
|
426
|
+
init_toLucideIconData();
|
|
427
|
+
init_toPascalCase();
|
|
428
|
+
init_Icon();
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/shield.mjs
|
|
433
|
+
var shield_exports = {};
|
|
434
|
+
__export(shield_exports, {
|
|
435
|
+
__iconData: () => __iconData,
|
|
436
|
+
default: () => Shield
|
|
437
|
+
});
|
|
438
|
+
var __iconData, Shield;
|
|
439
|
+
var init_shield = __esm({
|
|
440
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/shield.mjs"() {
|
|
441
|
+
init_createLucideIcon();
|
|
442
|
+
__iconData = {
|
|
443
|
+
name: "shield",
|
|
444
|
+
size: 24,
|
|
445
|
+
node: [
|
|
446
|
+
[
|
|
447
|
+
"path",
|
|
448
|
+
{
|
|
449
|
+
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
450
|
+
key: "oel41y"
|
|
451
|
+
}
|
|
452
|
+
]
|
|
453
|
+
]
|
|
454
|
+
};
|
|
455
|
+
__iconData.node;
|
|
456
|
+
Shield = createLucideIcon(__iconData);
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/key-round.mjs
|
|
461
|
+
var key_round_exports = {};
|
|
462
|
+
__export(key_round_exports, {
|
|
463
|
+
__iconData: () => __iconData2,
|
|
464
|
+
default: () => KeyRound
|
|
465
|
+
});
|
|
466
|
+
var __iconData2, KeyRound;
|
|
467
|
+
var init_key_round = __esm({
|
|
468
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/key-round.mjs"() {
|
|
469
|
+
init_createLucideIcon();
|
|
470
|
+
__iconData2 = {
|
|
471
|
+
name: "key-round",
|
|
472
|
+
size: 24,
|
|
473
|
+
node: [
|
|
474
|
+
[
|
|
475
|
+
"path",
|
|
476
|
+
{
|
|
477
|
+
d: "M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",
|
|
478
|
+
key: "1s6t7t"
|
|
479
|
+
}
|
|
480
|
+
],
|
|
481
|
+
["circle", { cx: "16.5", cy: "7.5", r: ".5", fill: "currentColor", key: "w0ekpg" }]
|
|
482
|
+
]
|
|
483
|
+
};
|
|
484
|
+
__iconData2.node;
|
|
485
|
+
KeyRound = createLucideIcon(__iconData2);
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/folder.mjs
|
|
490
|
+
var folder_exports = {};
|
|
491
|
+
__export(folder_exports, {
|
|
492
|
+
__iconData: () => __iconData3,
|
|
493
|
+
default: () => Folder
|
|
494
|
+
});
|
|
495
|
+
var __iconData3, Folder;
|
|
496
|
+
var init_folder = __esm({
|
|
497
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/folder.mjs"() {
|
|
498
|
+
init_createLucideIcon();
|
|
499
|
+
__iconData3 = {
|
|
500
|
+
name: "folder",
|
|
501
|
+
size: 24,
|
|
502
|
+
node: [
|
|
503
|
+
[
|
|
504
|
+
"path",
|
|
505
|
+
{
|
|
506
|
+
d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
|
|
507
|
+
key: "1kt360"
|
|
508
|
+
}
|
|
509
|
+
]
|
|
510
|
+
]
|
|
511
|
+
};
|
|
512
|
+
__iconData3.node;
|
|
513
|
+
Folder = createLucideIcon(__iconData3);
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/sliders-horizontal.mjs
|
|
518
|
+
var sliders_horizontal_exports = {};
|
|
519
|
+
__export(sliders_horizontal_exports, {
|
|
520
|
+
__iconData: () => __iconData4,
|
|
521
|
+
default: () => SlidersHorizontal
|
|
522
|
+
});
|
|
523
|
+
var __iconData4, SlidersHorizontal;
|
|
524
|
+
var init_sliders_horizontal = __esm({
|
|
525
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/sliders-horizontal.mjs"() {
|
|
526
|
+
init_createLucideIcon();
|
|
527
|
+
__iconData4 = {
|
|
528
|
+
name: "sliders-horizontal",
|
|
529
|
+
size: 24,
|
|
530
|
+
node: [
|
|
531
|
+
["path", { d: "M10 5H3", key: "1qgfaw" }],
|
|
532
|
+
["path", { d: "M12 19H3", key: "yhmn1j" }],
|
|
533
|
+
["path", { d: "M14 3v4", key: "1sua03" }],
|
|
534
|
+
["path", { d: "M16 17v4", key: "1q0r14" }],
|
|
535
|
+
["path", { d: "M21 12h-9", key: "1o4lsq" }],
|
|
536
|
+
["path", { d: "M21 19h-5", key: "1rlt1p" }],
|
|
537
|
+
["path", { d: "M21 5h-7", key: "1oszz2" }],
|
|
538
|
+
["path", { d: "M8 10v4", key: "tgpxqk" }],
|
|
539
|
+
["path", { d: "M8 12H3", key: "a7s4jb" }]
|
|
540
|
+
]
|
|
541
|
+
};
|
|
542
|
+
__iconData4.node;
|
|
543
|
+
SlidersHorizontal = createLucideIcon(__iconData4);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/database.mjs
|
|
548
|
+
var database_exports = {};
|
|
549
|
+
__export(database_exports, {
|
|
550
|
+
__iconData: () => __iconData5,
|
|
551
|
+
default: () => Database
|
|
552
|
+
});
|
|
553
|
+
var __iconData5, Database;
|
|
554
|
+
var init_database = __esm({
|
|
555
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/database.mjs"() {
|
|
556
|
+
init_createLucideIcon();
|
|
557
|
+
__iconData5 = {
|
|
558
|
+
name: "database",
|
|
559
|
+
size: 24,
|
|
560
|
+
node: [
|
|
561
|
+
["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
|
|
562
|
+
["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
|
|
563
|
+
["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
|
|
564
|
+
]
|
|
565
|
+
};
|
|
566
|
+
__iconData5.node;
|
|
567
|
+
Database = createLucideIcon(__iconData5);
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list.mjs
|
|
572
|
+
var list_exports = {};
|
|
573
|
+
__export(list_exports, {
|
|
574
|
+
__iconData: () => __iconData6,
|
|
575
|
+
default: () => List
|
|
576
|
+
});
|
|
577
|
+
var __iconData6, List;
|
|
578
|
+
var init_list = __esm({
|
|
579
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list.mjs"() {
|
|
580
|
+
init_createLucideIcon();
|
|
581
|
+
__iconData6 = {
|
|
582
|
+
name: "list",
|
|
583
|
+
size: 24,
|
|
584
|
+
node: [
|
|
585
|
+
["path", { d: "M3 5h.01", key: "18ugdj" }],
|
|
586
|
+
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
587
|
+
["path", { d: "M3 19h.01", key: "noohij" }],
|
|
588
|
+
["path", { d: "M8 5h13", key: "1pao27" }],
|
|
589
|
+
["path", { d: "M8 12h13", key: "1za7za" }],
|
|
590
|
+
["path", { d: "M8 19h13", key: "m83p4d" }]
|
|
591
|
+
]
|
|
592
|
+
};
|
|
593
|
+
__iconData6.node;
|
|
594
|
+
List = createLucideIcon(__iconData6);
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/layers.mjs
|
|
599
|
+
var layers_exports = {};
|
|
600
|
+
__export(layers_exports, {
|
|
601
|
+
__iconData: () => __iconData7,
|
|
602
|
+
default: () => Layers
|
|
603
|
+
});
|
|
604
|
+
var __iconData7, Layers;
|
|
605
|
+
var init_layers = __esm({
|
|
606
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/layers.mjs"() {
|
|
607
|
+
init_createLucideIcon();
|
|
608
|
+
__iconData7 = {
|
|
609
|
+
name: "layers",
|
|
610
|
+
size: 24,
|
|
611
|
+
node: [
|
|
612
|
+
[
|
|
613
|
+
"path",
|
|
614
|
+
{
|
|
615
|
+
d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
|
|
616
|
+
key: "zw3jo"
|
|
617
|
+
}
|
|
618
|
+
],
|
|
619
|
+
[
|
|
620
|
+
"path",
|
|
621
|
+
{
|
|
622
|
+
d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
|
|
623
|
+
key: "1wduqc"
|
|
624
|
+
}
|
|
625
|
+
],
|
|
626
|
+
[
|
|
627
|
+
"path",
|
|
628
|
+
{
|
|
629
|
+
d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
|
|
630
|
+
key: "kqbvx6"
|
|
631
|
+
}
|
|
632
|
+
]
|
|
633
|
+
],
|
|
634
|
+
aliases: ["layers-3"]
|
|
635
|
+
};
|
|
636
|
+
__iconData7.node;
|
|
637
|
+
Layers = createLucideIcon(__iconData7);
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/shield-check.mjs
|
|
642
|
+
var shield_check_exports = {};
|
|
643
|
+
__export(shield_check_exports, {
|
|
644
|
+
__iconData: () => __iconData8,
|
|
645
|
+
default: () => ShieldCheck
|
|
646
|
+
});
|
|
647
|
+
var __iconData8, ShieldCheck;
|
|
648
|
+
var init_shield_check = __esm({
|
|
649
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/shield-check.mjs"() {
|
|
650
|
+
init_createLucideIcon();
|
|
651
|
+
__iconData8 = {
|
|
652
|
+
name: "shield-check",
|
|
653
|
+
size: 24,
|
|
654
|
+
node: [
|
|
655
|
+
[
|
|
656
|
+
"path",
|
|
657
|
+
{
|
|
658
|
+
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
659
|
+
key: "oel41y"
|
|
660
|
+
}
|
|
661
|
+
],
|
|
662
|
+
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
663
|
+
]
|
|
664
|
+
};
|
|
665
|
+
__iconData8.node;
|
|
666
|
+
ShieldCheck = createLucideIcon(__iconData8);
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
// packages/addons/lib/client-common.cjs
|
|
671
|
+
var require_client_common = __commonJS({
|
|
672
|
+
"packages/addons/lib/client-common.cjs"(exports2, module2) {
|
|
673
|
+
"use strict";
|
|
674
|
+
module2.exports = function createCommon(prefix) {
|
|
675
|
+
var p = String(prefix || "wb");
|
|
676
|
+
function unwrap(r) {
|
|
677
|
+
if (r && r.ok === false) {
|
|
678
|
+
var error = new Error(r.error || r.message || "\u64CD\u4F5C\u5931\u8D25");
|
|
679
|
+
if (r.code !== void 0) error.code = r.code;
|
|
680
|
+
error.payload = r;
|
|
681
|
+
throw error;
|
|
682
|
+
}
|
|
683
|
+
return r && r.result !== void 0 ? r.result : r;
|
|
684
|
+
}
|
|
685
|
+
function call(api, action, args) {
|
|
686
|
+
return Promise.resolve(api.call(action, args || {})).then(unwrap);
|
|
687
|
+
}
|
|
688
|
+
function errText(e) {
|
|
689
|
+
if (!e) return "\u64CD\u4F5C\u5931\u8D25";
|
|
690
|
+
if (typeof e === "string") return e;
|
|
691
|
+
return e.message || e.error || String(e);
|
|
692
|
+
}
|
|
693
|
+
function fmtTime(ts, lang) {
|
|
694
|
+
if (!ts) return "\u2014";
|
|
695
|
+
try {
|
|
696
|
+
return new Date(ts).toLocaleString(lang === "en" ? "en-US" : "zh-CN", { hour12: false });
|
|
697
|
+
} catch (e) {
|
|
698
|
+
return String(ts);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
function Btn(props) {
|
|
702
|
+
var h = props.h;
|
|
703
|
+
return h(
|
|
704
|
+
"button",
|
|
705
|
+
{
|
|
706
|
+
type: props.type || "button",
|
|
707
|
+
className: p + "-btn" + (props.kind ? " " + props.kind : ""),
|
|
708
|
+
disabled: props.disabled,
|
|
709
|
+
onClick: props.onClick,
|
|
710
|
+
title: props.title
|
|
711
|
+
},
|
|
712
|
+
props.children
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
function Field(props) {
|
|
716
|
+
var h = props.h;
|
|
717
|
+
return h(
|
|
718
|
+
"label",
|
|
719
|
+
{ className: p + "-field" },
|
|
720
|
+
h("span", { className: p + "-label" }, props.label),
|
|
721
|
+
props.children,
|
|
722
|
+
props.hint ? h("span", { className: p + "-hint" }, props.hint) : null
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
function Notice(props) {
|
|
726
|
+
var h = props.h;
|
|
727
|
+
if (!props.text) return null;
|
|
728
|
+
return h("div", { className: p + "-notice " + (props.kind || "info") }, props.text);
|
|
729
|
+
}
|
|
730
|
+
function Empty(props) {
|
|
731
|
+
var h = props.h;
|
|
732
|
+
return h("div", { className: p + "-empty" }, props.text || "\u6682\u65E0\u6570\u636E");
|
|
733
|
+
}
|
|
734
|
+
function Pill(props) {
|
|
735
|
+
var h = props.h;
|
|
736
|
+
return h("span", { className: p + "-pill " + (props.kind || "") }, props.children);
|
|
737
|
+
}
|
|
738
|
+
function Json(props) {
|
|
739
|
+
var h = props.h;
|
|
740
|
+
var text;
|
|
741
|
+
try {
|
|
742
|
+
text = JSON.stringify(props.value, null, 2);
|
|
743
|
+
} catch (e) {
|
|
744
|
+
text = String(props.value);
|
|
745
|
+
}
|
|
746
|
+
return h("pre", { className: p + "-json" }, text);
|
|
747
|
+
}
|
|
748
|
+
function useLoad(React, api, action, args, deps) {
|
|
749
|
+
var s = React.useState({ loading: true, data: null, error: "" });
|
|
750
|
+
var tick = React.useState(0);
|
|
751
|
+
var refresh = function() {
|
|
752
|
+
tick[1](tick[0] + 1);
|
|
753
|
+
};
|
|
754
|
+
React.useEffect(
|
|
755
|
+
function() {
|
|
756
|
+
var alive = true;
|
|
757
|
+
s[1]({ loading: true, data: null, error: "" });
|
|
758
|
+
call(api, action, args).then(function(data) {
|
|
759
|
+
if (alive) s[1]({ loading: false, data, error: "" });
|
|
760
|
+
}).catch(function(e) {
|
|
761
|
+
if (alive) s[1]({ loading: false, data: null, error: errText(e) });
|
|
762
|
+
});
|
|
763
|
+
return function() {
|
|
764
|
+
alive = false;
|
|
765
|
+
};
|
|
766
|
+
},
|
|
767
|
+
(deps || []).concat([tick[0]])
|
|
768
|
+
);
|
|
769
|
+
return { loading: s[0].loading, data: s[0].data, error: s[0].error, refresh };
|
|
770
|
+
}
|
|
771
|
+
return {
|
|
772
|
+
unwrap,
|
|
773
|
+
call,
|
|
774
|
+
errText,
|
|
775
|
+
fmtTime,
|
|
776
|
+
Btn,
|
|
777
|
+
Field,
|
|
778
|
+
Notice,
|
|
779
|
+
Empty,
|
|
780
|
+
Pill,
|
|
781
|
+
Json,
|
|
782
|
+
useLoad
|
|
783
|
+
};
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
// packages/addons/vault/client/ui/common.cjs
|
|
789
|
+
var require_common = __commonJS({
|
|
790
|
+
"packages/addons/vault/client/ui/common.cjs"(exports2, module2) {
|
|
791
|
+
"use strict";
|
|
792
|
+
module2.exports = require_client_common()("wbv");
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
// packages/addons/vault/client/ui/ask-passphrase.cjs
|
|
797
|
+
var require_ask_passphrase = __commonJS({
|
|
798
|
+
"packages/addons/vault/client/ui/ask-passphrase.cjs"(exports2, module2) {
|
|
799
|
+
"use strict";
|
|
800
|
+
module2.exports = function AskPassphraseModal(props) {
|
|
801
|
+
var h = props.h, C = props.C;
|
|
802
|
+
return h(
|
|
803
|
+
"div",
|
|
804
|
+
{ className: "wbv-modal", onClick: function() {
|
|
805
|
+
if (!props.busy) props.onCancel();
|
|
806
|
+
} },
|
|
807
|
+
h(
|
|
808
|
+
"div",
|
|
809
|
+
{ className: "wbv-modal-box", onClick: function(e) {
|
|
810
|
+
e.stopPropagation();
|
|
811
|
+
} },
|
|
812
|
+
h("h3", null, props.title || "\u8F93\u5165\u4E3B\u53E3\u4EE4"),
|
|
813
|
+
props.hint ? h("p", { className: "wbv-sub" }, props.hint) : null,
|
|
814
|
+
h(
|
|
815
|
+
C.Field,
|
|
816
|
+
{ h, label: props.label || "\u4E3B\u53E3\u4EE4" },
|
|
817
|
+
h("input", {
|
|
818
|
+
type: "password",
|
|
819
|
+
autoFocus: true,
|
|
820
|
+
autoComplete: "current-password",
|
|
821
|
+
value: props.value,
|
|
822
|
+
disabled: props.busy,
|
|
823
|
+
onChange: function(e) {
|
|
824
|
+
props.onChange(e.target.value);
|
|
825
|
+
},
|
|
826
|
+
onKeyDown: function(e) {
|
|
827
|
+
if (e.key === "Enter" && props.value && !props.busy) props.onConfirm();
|
|
828
|
+
}
|
|
829
|
+
})
|
|
830
|
+
),
|
|
831
|
+
props.error ? h(C.Notice, { h, kind: "error", text: props.error }) : null,
|
|
832
|
+
h(
|
|
833
|
+
"div",
|
|
834
|
+
{ className: "wbv-row", style: { justifyContent: "flex-end" } },
|
|
835
|
+
h(C.Btn, { h, disabled: props.busy, onClick: props.onCancel }, "\u53D6\u6D88"),
|
|
836
|
+
h(C.Btn, { h, kind: "primary", disabled: props.busy || !props.value, onClick: props.onConfirm }, props.busy ? "\u5904\u7406\u4E2D\u2026" : "\u786E\u8BA4")
|
|
837
|
+
)
|
|
838
|
+
)
|
|
839
|
+
);
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
// packages/addons/vault/client/views/status.cjs
|
|
845
|
+
var require_status = __commonJS({
|
|
846
|
+
"packages/addons/vault/client/views/status.cjs"(exports2, module2) {
|
|
847
|
+
"use strict";
|
|
848
|
+
var C = require_common();
|
|
849
|
+
var AskPassphrase = require_ask_passphrase();
|
|
850
|
+
module2.exports = function StatusView(props) {
|
|
851
|
+
var h = props.h;
|
|
852
|
+
var api = props.api;
|
|
853
|
+
var lang = props.lang || "zh";
|
|
854
|
+
var React = props.React;
|
|
855
|
+
var st = React.useState({ loading: true, data: null, error: "" });
|
|
856
|
+
var status = st[0].data;
|
|
857
|
+
var error = st[0].error;
|
|
858
|
+
var busy = React.useState(false);
|
|
859
|
+
var pass = React.useState("");
|
|
860
|
+
var pass2 = React.useState("");
|
|
861
|
+
var mode = React.useState("A");
|
|
862
|
+
var msg = React.useState("");
|
|
863
|
+
var askS = React.useState(null);
|
|
864
|
+
var refreshTick = React.useState(0);
|
|
865
|
+
var refresh = function() {
|
|
866
|
+
refreshTick[1](refreshTick[0] + 1);
|
|
867
|
+
};
|
|
868
|
+
React.useEffect(function() {
|
|
869
|
+
var alive = true;
|
|
870
|
+
C.call(api, "vault.status").then(function(data) {
|
|
871
|
+
if (alive) st[1]({ loading: false, data, error: "" });
|
|
872
|
+
}).catch(function(e) {
|
|
873
|
+
if (alive) st[1]({ loading: false, data: null, error: C.errText(e) });
|
|
874
|
+
});
|
|
875
|
+
return function() {
|
|
876
|
+
alive = false;
|
|
877
|
+
};
|
|
878
|
+
}, [refreshTick[0]]);
|
|
879
|
+
function run(fn) {
|
|
880
|
+
busy[1](true);
|
|
881
|
+
msg[1]("");
|
|
882
|
+
return fn().then(function() {
|
|
883
|
+
pass[1]("");
|
|
884
|
+
pass2[1]("");
|
|
885
|
+
busy[1](false);
|
|
886
|
+
refresh();
|
|
887
|
+
}).catch(function(e) {
|
|
888
|
+
msg[1](C.errText(e));
|
|
889
|
+
busy[1](false);
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
if (st[0].loading) return h("div", { className: "wbv" }, h(C.Empty, { h, text: "\u6B63\u5728\u8BFB\u53D6\u4FDD\u9669\u7BB1\u72B6\u6001\u2026" }));
|
|
893
|
+
if (error) {
|
|
894
|
+
let confirmAsk2 = function() {
|
|
895
|
+
var a = askS[0];
|
|
896
|
+
if (!a || !a.value) return;
|
|
897
|
+
askS[1](Object.assign({}, a, { busy: true, error: "" }));
|
|
898
|
+
busy[1](true);
|
|
899
|
+
msg[1]("");
|
|
900
|
+
C.call(api, "vault.unlock", { passphrase: a.value }).then(function() {
|
|
901
|
+
return C.call(api, "vault.setUnlockMode", { mode: "A" });
|
|
902
|
+
}).then(function() {
|
|
903
|
+
askS[1](null);
|
|
904
|
+
busy[1](false);
|
|
905
|
+
refresh();
|
|
906
|
+
}).catch(function(e) {
|
|
907
|
+
askS[1](Object.assign({}, a, { busy: false, error: C.errText(e) }));
|
|
908
|
+
});
|
|
909
|
+
};
|
|
910
|
+
var modal = askS[0] ? h(AskPassphrase, {
|
|
911
|
+
h,
|
|
912
|
+
C,
|
|
913
|
+
title: "\u5207\u56DE A \u6A21\u5F0F",
|
|
914
|
+
hint: "\u5207\u6362\u540E\u4E0B\u6B21\u542F\u52A8\u9700\u8981\u91CD\u65B0\u89E3\u9501\uFF0C\u8BF7\u9A8C\u8BC1\u4E3B\u53E3\u4EE4\u3002",
|
|
915
|
+
value: askS[0].value,
|
|
916
|
+
busy: askS[0].busy,
|
|
917
|
+
error: askS[0].error,
|
|
918
|
+
onChange: function(v) {
|
|
919
|
+
askS[1](Object.assign({}, askS[0], { value: v }));
|
|
920
|
+
},
|
|
921
|
+
onCancel: function() {
|
|
922
|
+
if (!askS[0].busy) askS[1](null);
|
|
923
|
+
},
|
|
924
|
+
onConfirm: confirmAsk2
|
|
925
|
+
}) : null;
|
|
926
|
+
return h(
|
|
927
|
+
"div",
|
|
928
|
+
{ className: "wbv" },
|
|
929
|
+
h("h2", null, "\u51ED\u636E\u4FDD\u9669\u7BB1"),
|
|
930
|
+
h(C.Notice, { h, kind: "error", text: error }),
|
|
931
|
+
h(C.Btn, { h, onClick: refresh }, "\u91CD\u8BD5")
|
|
932
|
+
);
|
|
933
|
+
}
|
|
934
|
+
if (!status || !status.initialized) {
|
|
935
|
+
let confirmAsk2 = function() {
|
|
936
|
+
var a = askS[0];
|
|
937
|
+
if (!a || !a.value) return;
|
|
938
|
+
askS[1](Object.assign({}, a, { busy: true, error: "" }));
|
|
939
|
+
busy[1](true);
|
|
940
|
+
msg[1]("");
|
|
941
|
+
C.call(api, "vault.unlock", { passphrase: a.value }).then(function() {
|
|
942
|
+
return C.call(api, "vault.setUnlockMode", { mode: "A" });
|
|
943
|
+
}).then(function() {
|
|
944
|
+
askS[1](null);
|
|
945
|
+
busy[1](false);
|
|
946
|
+
refresh();
|
|
947
|
+
}).catch(function(e) {
|
|
948
|
+
askS[1](Object.assign({}, a, { busy: false, error: C.errText(e) }));
|
|
949
|
+
});
|
|
950
|
+
};
|
|
951
|
+
var modal = askS[0] ? h(AskPassphrase, {
|
|
952
|
+
h,
|
|
953
|
+
C,
|
|
954
|
+
title: "\u5207\u56DE A \u6A21\u5F0F",
|
|
955
|
+
hint: "\u5207\u6362\u540E\u4E0B\u6B21\u542F\u52A8\u9700\u8981\u91CD\u65B0\u89E3\u9501\uFF0C\u8BF7\u9A8C\u8BC1\u4E3B\u53E3\u4EE4\u3002",
|
|
956
|
+
value: askS[0].value,
|
|
957
|
+
busy: askS[0].busy,
|
|
958
|
+
error: askS[0].error,
|
|
959
|
+
onChange: function(v) {
|
|
960
|
+
askS[1](Object.assign({}, askS[0], { value: v }));
|
|
961
|
+
},
|
|
962
|
+
onCancel: function() {
|
|
963
|
+
if (!askS[0].busy) askS[1](null);
|
|
964
|
+
},
|
|
965
|
+
onConfirm: confirmAsk2
|
|
966
|
+
}) : null;
|
|
967
|
+
return h(
|
|
968
|
+
"div",
|
|
969
|
+
{ className: "wbv" },
|
|
970
|
+
h("h2", null, "\u521D\u59CB\u5316\u51ED\u636E\u4FDD\u9669\u7BB1"),
|
|
971
|
+
h("p", { className: "wbv-muted" }, "\u53E3\u4EE4\u53EA\u7528\u4E8E\u6D3E\u751F\u5BC6\u94A5\uFF0C\u4E0D\u4F1A\u843D\u5E93\uFF1B\u5FD8\u8BB0\u53E3\u4EE4\u65E0\u6CD5\u6062\u590D\u5DF2\u4FDD\u5B58\u7684\u51ED\u636E\u3002\u53E3\u4EE4\u5305\u88F9\u4E0E\u5BC6\u6587\u4F1A\u968F\u4E91\u540C\u6B65\u4E0A\u4F20\uFF0C\u4E91\u7AEF\u6CA1\u6709\u53E3\u4EE4\u89E3\u4E0D\u5F00\u3002"),
|
|
972
|
+
h(C.Notice, { h, kind: "info", text: "\u9ED8\u8BA4 A \u6A21\u5F0F\uFF1A\u6BCF\u6B21\u542F\u52A8\u540E\u9700\u8981\u91CD\u65B0\u89E3\u9501\u3002\u53EF\u7A0D\u540E\u5728\u8BBE\u7F6E\u91CC\u6539\u6210\u81EA\u52A8\u89E3\u9501\u3002" }),
|
|
973
|
+
h(
|
|
974
|
+
"div",
|
|
975
|
+
{ className: "wbv-card wbv-row" },
|
|
976
|
+
h(
|
|
977
|
+
C.Field,
|
|
978
|
+
{ h, label: "\u4E3B\u53E3\u4EE4\uFF08\u81F3\u5C11 12 \u4F4D\uFF09" },
|
|
979
|
+
h("input", { type: "password", value: pass[0], autoComplete: "new-password", onChange: function(e) {
|
|
980
|
+
pass[1](e.target.value);
|
|
981
|
+
} })
|
|
982
|
+
),
|
|
983
|
+
h(
|
|
984
|
+
C.Field,
|
|
985
|
+
{ h, label: "\u786E\u8BA4\u53E3\u4EE4" },
|
|
986
|
+
h("input", { type: "password", value: pass2[0], autoComplete: "new-password", onChange: function(e) {
|
|
987
|
+
pass2[1](e.target.value);
|
|
988
|
+
} })
|
|
989
|
+
),
|
|
990
|
+
h(
|
|
991
|
+
C.Field,
|
|
992
|
+
{ h, label: "\u89E3\u9501\u6A21\u5F0F" },
|
|
993
|
+
h(
|
|
994
|
+
"select",
|
|
995
|
+
{ value: mode[0], onChange: function(e) {
|
|
996
|
+
mode[1](e.target.value);
|
|
997
|
+
} },
|
|
998
|
+
h("option", { value: "A" }, "A \u5168\u9501\uFF08\u63A8\u8350\uFF09"),
|
|
999
|
+
h("option", { value: "B" }, "B \u81EA\u52A8\u89E3\u9501\uFF0C\u67E5\u770B\u51ED\u636E\u518D\u8F93\u53E3\u4EE4"),
|
|
1000
|
+
h("option", { value: "C" }, "C \u81EA\u52A8\u89E3\u9501\uFF0C\u67E5\u770B\u514D\u53E3\u4EE4\uFF08\u4E0D\u5EFA\u8BAE\uFF09")
|
|
1001
|
+
)
|
|
1002
|
+
)
|
|
1003
|
+
),
|
|
1004
|
+
h(C.Notice, { h, kind: "error", text: msg[0] }),
|
|
1005
|
+
h(
|
|
1006
|
+
"div",
|
|
1007
|
+
{ className: "wbv-row" },
|
|
1008
|
+
h(C.Btn, { h, kind: "primary", disabled: busy[0], onClick: function() {
|
|
1009
|
+
if (pass[0].length < 12) return msg[1]("\u53E3\u4EE4\u81F3\u5C11 12 \u4E2A\u5B57\u7B26");
|
|
1010
|
+
if (pass[0] !== pass2[0]) return msg[1]("\u4E24\u6B21\u8F93\u5165\u4E0D\u4E00\u81F4");
|
|
1011
|
+
run(function() {
|
|
1012
|
+
return C.call(api, "vault.setup", { passphrase: pass[0], mode: mode[0] });
|
|
1013
|
+
});
|
|
1014
|
+
} }, busy[0] ? "\u521D\u59CB\u5316\u4E2D\u2026" : "\u521B\u5EFA\u4FDD\u9669\u7BB1")
|
|
1015
|
+
)
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
if (status.locked) {
|
|
1019
|
+
let confirmAsk2 = function() {
|
|
1020
|
+
var a = askS[0];
|
|
1021
|
+
if (!a || !a.value) return;
|
|
1022
|
+
askS[1](Object.assign({}, a, { busy: true, error: "" }));
|
|
1023
|
+
busy[1](true);
|
|
1024
|
+
msg[1]("");
|
|
1025
|
+
C.call(api, "vault.unlock", { passphrase: a.value }).then(function() {
|
|
1026
|
+
return C.call(api, "vault.setUnlockMode", { mode: "A" });
|
|
1027
|
+
}).then(function() {
|
|
1028
|
+
askS[1](null);
|
|
1029
|
+
busy[1](false);
|
|
1030
|
+
refresh();
|
|
1031
|
+
}).catch(function(e) {
|
|
1032
|
+
askS[1](Object.assign({}, a, { busy: false, error: C.errText(e) }));
|
|
1033
|
+
});
|
|
1034
|
+
};
|
|
1035
|
+
var modal = askS[0] ? h(AskPassphrase, {
|
|
1036
|
+
h,
|
|
1037
|
+
C,
|
|
1038
|
+
title: "\u5207\u56DE A \u6A21\u5F0F",
|
|
1039
|
+
hint: "\u5207\u6362\u540E\u4E0B\u6B21\u542F\u52A8\u9700\u8981\u91CD\u65B0\u89E3\u9501\uFF0C\u8BF7\u9A8C\u8BC1\u4E3B\u53E3\u4EE4\u3002",
|
|
1040
|
+
value: askS[0].value,
|
|
1041
|
+
busy: askS[0].busy,
|
|
1042
|
+
error: askS[0].error,
|
|
1043
|
+
onChange: function(v) {
|
|
1044
|
+
askS[1](Object.assign({}, askS[0], { value: v }));
|
|
1045
|
+
},
|
|
1046
|
+
onCancel: function() {
|
|
1047
|
+
if (!askS[0].busy) askS[1](null);
|
|
1048
|
+
},
|
|
1049
|
+
onConfirm: confirmAsk2
|
|
1050
|
+
}) : null;
|
|
1051
|
+
return h(
|
|
1052
|
+
"div",
|
|
1053
|
+
{ className: "wbv" },
|
|
1054
|
+
h("h2", null, "\u4FDD\u9669\u7BB1\u5DF2\u9501\u5B9A"),
|
|
1055
|
+
h("p", { className: "wbv-muted" }, "\u8F93\u5165\u4E3B\u53E3\u4EE4\u89E3\u9501\u3002\u89E3\u9501\u72B6\u6001\u53EA\u4FDD\u5B58\u5728\u5F53\u524D\u8FDB\u7A0B\u5185\u5B58\uFF0C\u7A7A\u95F2\u8D85\u65F6\u4F1A\u81EA\u52A8\u9501\u5B9A\u3002"),
|
|
1056
|
+
h(
|
|
1057
|
+
"div",
|
|
1058
|
+
{ className: "wbv-card wbv-row" },
|
|
1059
|
+
h(
|
|
1060
|
+
C.Field,
|
|
1061
|
+
{ h, label: "\u4E3B\u53E3\u4EE4" },
|
|
1062
|
+
h("input", { type: "password", value: pass[0], autoComplete: "current-password", onChange: function(e) {
|
|
1063
|
+
pass[1](e.target.value);
|
|
1064
|
+
} })
|
|
1065
|
+
),
|
|
1066
|
+
h(C.Btn, { h, kind: "primary", disabled: busy[0], onClick: function() {
|
|
1067
|
+
if (!pass[0]) return msg[1]("\u8BF7\u8F93\u5165\u53E3\u4EE4");
|
|
1068
|
+
run(function() {
|
|
1069
|
+
return C.call(api, "vault.unlock", { passphrase: pass[0] });
|
|
1070
|
+
});
|
|
1071
|
+
} }, busy[0] ? "\u89E3\u9501\u4E2D\u2026" : "\u89E3\u9501")
|
|
1072
|
+
),
|
|
1073
|
+
h(C.Notice, { h, kind: "error", text: msg[0] }),
|
|
1074
|
+
h("p", { className: "wbv-muted" }, "\u6A21\u5F0F\uFF1A" + modeName(status.unlockMode) + "\uFF1B\u8FDE\u7EED\u5931\u8D25 5 \u6B21\u4F1A\u9501\u5B9A 5 \u5206\u949F\u3002")
|
|
1075
|
+
);
|
|
1076
|
+
}
|
|
1077
|
+
var modeText = modeName(status.unlockMode);
|
|
1078
|
+
function confirmAsk() {
|
|
1079
|
+
var a = askS[0];
|
|
1080
|
+
if (!a || !a.value) return;
|
|
1081
|
+
askS[1](Object.assign({}, a, { busy: true, error: "" }));
|
|
1082
|
+
busy[1](true);
|
|
1083
|
+
msg[1]("");
|
|
1084
|
+
C.call(api, "vault.unlock", { passphrase: a.value }).then(function() {
|
|
1085
|
+
return C.call(api, "vault.setUnlockMode", { mode: "A" });
|
|
1086
|
+
}).then(function() {
|
|
1087
|
+
askS[1](null);
|
|
1088
|
+
busy[1](false);
|
|
1089
|
+
refresh();
|
|
1090
|
+
}).catch(function(e) {
|
|
1091
|
+
askS[1](Object.assign({}, a, { busy: false, error: C.errText(e) }));
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
var modal = askS[0] ? h(AskPassphrase, {
|
|
1095
|
+
h,
|
|
1096
|
+
C,
|
|
1097
|
+
title: "\u5207\u56DE A \u6A21\u5F0F",
|
|
1098
|
+
hint: "\u5207\u6362\u540E\u4E0B\u6B21\u542F\u52A8\u9700\u8981\u91CD\u65B0\u89E3\u9501\uFF0C\u8BF7\u9A8C\u8BC1\u4E3B\u53E3\u4EE4\u3002",
|
|
1099
|
+
value: askS[0].value,
|
|
1100
|
+
busy: askS[0].busy,
|
|
1101
|
+
error: askS[0].error,
|
|
1102
|
+
onChange: function(v) {
|
|
1103
|
+
askS[1](Object.assign({}, askS[0], { value: v }));
|
|
1104
|
+
},
|
|
1105
|
+
onCancel: function() {
|
|
1106
|
+
if (!askS[0].busy) askS[1](null);
|
|
1107
|
+
},
|
|
1108
|
+
onConfirm: confirmAsk
|
|
1109
|
+
}) : null;
|
|
1110
|
+
return h(
|
|
1111
|
+
"div",
|
|
1112
|
+
{ className: "wbv" },
|
|
1113
|
+
h("div", { className: "wbv-row" }, h("h2", { className: "wbv-grow" }, "\u51ED\u636E\u4FDD\u9669\u7BB1"), h("span", { className: "wbv-pill ok" }, "\u5DF2\u89E3\u9501")),
|
|
1114
|
+
h(
|
|
1115
|
+
"div",
|
|
1116
|
+
{ className: "wbv-grid" },
|
|
1117
|
+
h("div", { className: "wbv-card" }, h("div", { className: "wbv-muted" }, "\u51ED\u636E\u6570\u91CF"), h("div", { className: "wbv-kpi" }, status.secretCount || 0)),
|
|
1118
|
+
h("div", { className: "wbv-card" }, h("div", { className: "wbv-muted" }, "\u5206\u7EC4\u6570\u91CF"), h("div", { className: "wbv-kpi" }, status.groupCount || 0)),
|
|
1119
|
+
h("div", { className: "wbv-card" }, h("div", { className: "wbv-muted" }, "\u89E3\u9501\u6A21\u5F0F"), h("div", { className: "wbv-kpi" }, status.unlockMode), h("div", { className: "wbv-muted" }, modeText)),
|
|
1120
|
+
h("div", { className: "wbv-card" }, h("div", { className: "wbv-muted" }, "\u4E0A\u6B21\u89E3\u9501"), h("div", null, C.fmtTime(status.lastUnlockAt, lang)))
|
|
1121
|
+
),
|
|
1122
|
+
h(C.Notice, { h, kind: "info", text: "agent \u53EA\u80FD\u770B\u5230\u540D\u79F0\u548C\u5907\u6CE8\uFF1B\u67E5\u770B\u660E\u6587\u5FC5\u987B\u7531\u4F60\u5728\u754C\u9762\u4E0A\u64CD\u4F5C\u3002" }),
|
|
1123
|
+
h(
|
|
1124
|
+
"div",
|
|
1125
|
+
{ className: "wbv-row" },
|
|
1126
|
+
h(C.Btn, { h, onClick: function() {
|
|
1127
|
+
run(function() {
|
|
1128
|
+
return C.call(api, "vault.lock");
|
|
1129
|
+
});
|
|
1130
|
+
} }, "\u7ACB\u5373\u9501\u5B9A"),
|
|
1131
|
+
h(C.Btn, { h, onClick: function() {
|
|
1132
|
+
askS[1]({ value: "", busy: false, error: "" });
|
|
1133
|
+
} }, "\u5207\u56DE A \u6A21\u5F0F")
|
|
1134
|
+
),
|
|
1135
|
+
h(C.Notice, { h, kind: "error", text: msg[0] }),
|
|
1136
|
+
modal
|
|
1137
|
+
);
|
|
1138
|
+
};
|
|
1139
|
+
function modeName(mode) {
|
|
1140
|
+
if (mode === "B") return "\u542F\u52A8\u81EA\u52A8\u89E3\u9501\uFF0C\u67E5\u770B\u51ED\u636E\u9700\u53E3\u4EE4";
|
|
1141
|
+
if (mode === "C") return "\u542F\u52A8\u81EA\u52A8\u89E3\u9501\uFF0C\u67E5\u770B\u514D\u53E3\u4EE4";
|
|
1142
|
+
return "\u5168\u9501\uFF1A\u6BCF\u6B21\u542F\u52A8\u9700\u89E3\u9501";
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1147
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/eye.mjs
|
|
1148
|
+
var eye_exports = {};
|
|
1149
|
+
__export(eye_exports, {
|
|
1150
|
+
__iconData: () => __iconData9,
|
|
1151
|
+
default: () => Eye
|
|
1152
|
+
});
|
|
1153
|
+
var __iconData9, Eye;
|
|
1154
|
+
var init_eye = __esm({
|
|
1155
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/eye.mjs"() {
|
|
1156
|
+
init_createLucideIcon();
|
|
1157
|
+
__iconData9 = {
|
|
1158
|
+
name: "eye",
|
|
1159
|
+
size: 24,
|
|
1160
|
+
node: [
|
|
1161
|
+
[
|
|
1162
|
+
"path",
|
|
1163
|
+
{
|
|
1164
|
+
d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
|
|
1165
|
+
key: "1nclc0"
|
|
1166
|
+
}
|
|
1167
|
+
],
|
|
1168
|
+
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
1169
|
+
]
|
|
1170
|
+
};
|
|
1171
|
+
__iconData9.node;
|
|
1172
|
+
Eye = createLucideIcon(__iconData9);
|
|
1173
|
+
}
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/eye-off.mjs
|
|
1177
|
+
var eye_off_exports = {};
|
|
1178
|
+
__export(eye_off_exports, {
|
|
1179
|
+
__iconData: () => __iconData10,
|
|
1180
|
+
default: () => EyeOff
|
|
1181
|
+
});
|
|
1182
|
+
var __iconData10, EyeOff;
|
|
1183
|
+
var init_eye_off = __esm({
|
|
1184
|
+
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/eye-off.mjs"() {
|
|
1185
|
+
init_createLucideIcon();
|
|
1186
|
+
__iconData10 = {
|
|
1187
|
+
name: "eye-off",
|
|
1188
|
+
size: 24,
|
|
1189
|
+
node: [
|
|
1190
|
+
[
|
|
1191
|
+
"path",
|
|
1192
|
+
{
|
|
1193
|
+
d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
|
|
1194
|
+
key: "ct8e1f"
|
|
1195
|
+
}
|
|
1196
|
+
],
|
|
1197
|
+
["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242", key: "151rxh" }],
|
|
1198
|
+
[
|
|
1199
|
+
"path",
|
|
1200
|
+
{
|
|
1201
|
+
d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
|
|
1202
|
+
key: "13bj9a"
|
|
1203
|
+
}
|
|
1204
|
+
],
|
|
1205
|
+
["path", { d: "m2 2 20 20", key: "1ooewy" }]
|
|
1206
|
+
]
|
|
1207
|
+
};
|
|
1208
|
+
__iconData10.node;
|
|
1209
|
+
EyeOff = createLucideIcon(__iconData10);
|
|
1210
|
+
}
|
|
1211
|
+
});
|
|
1212
|
+
|
|
1213
|
+
// packages/addons/vault/client/ui/secret-field.cjs
|
|
1214
|
+
var require_secret_field = __commonJS({
|
|
1215
|
+
"packages/addons/vault/client/ui/secret-field.cjs"(exports2, module2) {
|
|
1216
|
+
"use strict";
|
|
1217
|
+
var Eye2 = (init_eye(), __toCommonJS(eye_exports)).default;
|
|
1218
|
+
var EyeOff2 = (init_eye_off(), __toCommonJS(eye_off_exports)).default;
|
|
1219
|
+
function SecretField(props) {
|
|
1220
|
+
var h = props.h;
|
|
1221
|
+
var show = Boolean(props.show);
|
|
1222
|
+
var label = show ? "\u9690\u85CF\u660E\u6587" : "\u663E\u793A\u660E\u6587";
|
|
1223
|
+
var Ico = show ? EyeOff2 : Eye2;
|
|
1224
|
+
return h(
|
|
1225
|
+
"div",
|
|
1226
|
+
{ className: "wbv-secret-field" },
|
|
1227
|
+
h("input", {
|
|
1228
|
+
type: show ? "text" : "password",
|
|
1229
|
+
autoComplete: "new-password",
|
|
1230
|
+
spellCheck: false,
|
|
1231
|
+
value: props.value,
|
|
1232
|
+
placeholder: props.placeholder,
|
|
1233
|
+
onChange: function(e) {
|
|
1234
|
+
props.onChange(e.target.value);
|
|
1235
|
+
}
|
|
1236
|
+
}),
|
|
1237
|
+
h("button", {
|
|
1238
|
+
type: "button",
|
|
1239
|
+
className: "wbv-eye",
|
|
1240
|
+
title: label,
|
|
1241
|
+
"aria-label": label,
|
|
1242
|
+
"aria-pressed": show ? "true" : "false",
|
|
1243
|
+
onClick: function(e) {
|
|
1244
|
+
e.preventDefault();
|
|
1245
|
+
e.stopPropagation();
|
|
1246
|
+
props.onToggle();
|
|
1247
|
+
}
|
|
1248
|
+
}, h(Ico, { size: 15, strokeWidth: 2, "aria-hidden": "true" }))
|
|
1249
|
+
);
|
|
1250
|
+
}
|
|
1251
|
+
module2.exports = SecretField;
|
|
1252
|
+
}
|
|
1253
|
+
});
|
|
1254
|
+
|
|
1255
|
+
// packages/addons/vault/client/ui/kinds.cjs
|
|
1256
|
+
var require_kinds = __commonJS({
|
|
1257
|
+
"packages/addons/vault/client/ui/kinds.cjs"(exports2, module2) {
|
|
1258
|
+
"use strict";
|
|
1259
|
+
var KIND_LABEL = {
|
|
1260
|
+
password: "\u5BC6\u7801",
|
|
1261
|
+
phone: "\u624B\u673A\u53F7",
|
|
1262
|
+
id_card: "\u8EAB\u4EFD\u8BC1\u53F7",
|
|
1263
|
+
token: "Token",
|
|
1264
|
+
app_password: "\u5E94\u7528\u4E13\u7528\u5BC6\u7801",
|
|
1265
|
+
api_key: "API Key",
|
|
1266
|
+
other: "\u5176\u5B83"
|
|
1267
|
+
};
|
|
1268
|
+
var CREATABLE_KINDS = ["password", "phone", "id_card", "token", "app_password", "api_key", "other"];
|
|
1269
|
+
function kindOptions(current) {
|
|
1270
|
+
return current && CREATABLE_KINDS.indexOf(current) === -1 ? [current].concat(CREATABLE_KINDS) : CREATABLE_KINDS;
|
|
1271
|
+
}
|
|
1272
|
+
module2.exports = { KIND_LABEL, CREATABLE_KINDS, kindOptions };
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
// packages/addons/vault/client/views/secrets.cjs
|
|
1277
|
+
var require_secrets = __commonJS({
|
|
1278
|
+
"packages/addons/vault/client/views/secrets.cjs"(exports2, module2) {
|
|
1279
|
+
"use strict";
|
|
1280
|
+
var C = require_common();
|
|
1281
|
+
var AskPassphrase = require_ask_passphrase();
|
|
1282
|
+
var SecretField = require_secret_field();
|
|
1283
|
+
var K = require_kinds();
|
|
1284
|
+
var KIND_LABEL = K.KIND_LABEL;
|
|
1285
|
+
module2.exports = function SecretsView(props) {
|
|
1286
|
+
var h = props.h;
|
|
1287
|
+
var api = props.api;
|
|
1288
|
+
var lang = props.lang || "zh";
|
|
1289
|
+
var React = props.React;
|
|
1290
|
+
var listS = React.useState({ loading: true, rows: [], error: "" });
|
|
1291
|
+
var qS = React.useState("");
|
|
1292
|
+
var kindS = React.useState("");
|
|
1293
|
+
var statusS = React.useState(null);
|
|
1294
|
+
var setsS = React.useState([]);
|
|
1295
|
+
var formS = React.useState(emptyForm());
|
|
1296
|
+
var editingS = React.useState(false);
|
|
1297
|
+
var showSecretS = React.useState(false);
|
|
1298
|
+
var busyS = React.useState(false);
|
|
1299
|
+
var msgS = React.useState("");
|
|
1300
|
+
var revealS = React.useState(null);
|
|
1301
|
+
var askS = React.useState(null);
|
|
1302
|
+
var unlockS = React.useState(null);
|
|
1303
|
+
var rows = listS[0].rows;
|
|
1304
|
+
function load() {
|
|
1305
|
+
listS[1](function(old) {
|
|
1306
|
+
return Object.assign({}, old, { loading: true });
|
|
1307
|
+
});
|
|
1308
|
+
Promise.all([
|
|
1309
|
+
C.call(api, "vault.secretList", { q: qS[0], kind: kindS[0] || void 0 }),
|
|
1310
|
+
C.call(api, "vault.status").catch(function() {
|
|
1311
|
+
return null;
|
|
1312
|
+
}),
|
|
1313
|
+
C.call(api, "vault.setList", {}).catch(function() {
|
|
1314
|
+
return { items: [] };
|
|
1315
|
+
})
|
|
1316
|
+
]).then(function(r) {
|
|
1317
|
+
listS[1]({ loading: false, rows: r[0] && (r[0].items || r[0].secrets) || [], error: "" });
|
|
1318
|
+
statusS[1](r[1]);
|
|
1319
|
+
setsS[1](r[2] && r[2].items || []);
|
|
1320
|
+
}).catch(function(e) {
|
|
1321
|
+
listS[1]({ loading: false, rows: [], error: C.errText(e) });
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
React.useEffect(function() {
|
|
1325
|
+
load();
|
|
1326
|
+
}, []);
|
|
1327
|
+
function startCreate() {
|
|
1328
|
+
formS[1](emptyForm());
|
|
1329
|
+
showSecretS[1](false);
|
|
1330
|
+
editingS[1](true);
|
|
1331
|
+
msgS[1]("");
|
|
1332
|
+
}
|
|
1333
|
+
function startEdit(row) {
|
|
1334
|
+
showSecretS[1](false);
|
|
1335
|
+
var meta = {};
|
|
1336
|
+
try {
|
|
1337
|
+
meta = JSON.parse(row.meta || "{}");
|
|
1338
|
+
} catch (e) {
|
|
1339
|
+
meta = {};
|
|
1340
|
+
}
|
|
1341
|
+
formS[1]({
|
|
1342
|
+
id: row.id,
|
|
1343
|
+
name: row.name,
|
|
1344
|
+
kind: row.kind,
|
|
1345
|
+
secret: "",
|
|
1346
|
+
setIds: (row.setIds || []).slice(),
|
|
1347
|
+
note: noteOf(meta)
|
|
1348
|
+
});
|
|
1349
|
+
editingS[1](true);
|
|
1350
|
+
msgS[1]("");
|
|
1351
|
+
}
|
|
1352
|
+
function toggleSet(id) {
|
|
1353
|
+
var cur = formS[0].setIds || [];
|
|
1354
|
+
var next = cur.indexOf(id) >= 0 ? cur.filter(function(x) {
|
|
1355
|
+
return x !== id;
|
|
1356
|
+
}) : cur.concat([id]);
|
|
1357
|
+
formS[1](Object.assign({}, formS[0], { setIds: next }));
|
|
1358
|
+
}
|
|
1359
|
+
function isLockedText(text) {
|
|
1360
|
+
return /保险箱已锁定|请先解锁/.test(String(text || ""));
|
|
1361
|
+
}
|
|
1362
|
+
function askUnlock(hint) {
|
|
1363
|
+
unlockS[1]({ value: "", busy: false, error: hint || "" });
|
|
1364
|
+
}
|
|
1365
|
+
function confirmUnlock() {
|
|
1366
|
+
var u = unlockS[0];
|
|
1367
|
+
if (!u || !u.value) return;
|
|
1368
|
+
unlockS[1](Object.assign({}, u, { busy: true, error: "" }));
|
|
1369
|
+
C.call(api, "vault.unlock", { passphrase: u.value }).then(function() {
|
|
1370
|
+
unlockS[1](null);
|
|
1371
|
+
msgS[1]("");
|
|
1372
|
+
if (editingS[0]) save(true);
|
|
1373
|
+
else load();
|
|
1374
|
+
}).catch(function(e) {
|
|
1375
|
+
unlockS[1](Object.assign({}, u, { busy: false, error: C.errText(e) }));
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
function save(alreadyUnlocked) {
|
|
1379
|
+
var f = formS[0];
|
|
1380
|
+
if (!f.name.trim()) return msgS[1]("\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1381
|
+
if (!f.id && !f.secret) return msgS[1]("\u65B0\u589E\u51ED\u636E\u5FC5\u987B\u586B\u5199\u660E\u6587");
|
|
1382
|
+
if (!alreadyUnlocked && statusS[0] && statusS[0].locked) {
|
|
1383
|
+
msgS[1]("\u4FDD\u9669\u7BB1\u5DF2\u9501\u5B9A\uFF0C\u8BF7\u5148\u89E3\u9501\u518D\u4FDD\u5B58");
|
|
1384
|
+
askUnlock("\u4FDD\u9669\u7BB1\u5DF2\u9501\u5B9A\uFF0C\u8F93\u5165\u4E3B\u53E3\u4EE4\u540E\u4F1A\u81EA\u52A8\u7EE7\u7EED\u4FDD\u5B58\u3002");
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
busyS[1](true);
|
|
1388
|
+
msgS[1]("");
|
|
1389
|
+
var meta = {};
|
|
1390
|
+
var note = (f.note || "").trim();
|
|
1391
|
+
if (note) meta.note = note;
|
|
1392
|
+
var picked = f.setIds || [];
|
|
1393
|
+
var payload = {
|
|
1394
|
+
name: f.name.trim(),
|
|
1395
|
+
kind: f.kind,
|
|
1396
|
+
meta
|
|
1397
|
+
};
|
|
1398
|
+
if (f.secret) payload.secret = f.secret;
|
|
1399
|
+
if (f.id) payload.id = f.id;
|
|
1400
|
+
if (!f.id && picked.length) payload.setId = picked[0];
|
|
1401
|
+
var p = f.id ? C.call(api, "vault.secretUpdate", payload) : C.call(api, "vault.secretCreate", payload);
|
|
1402
|
+
p.then(function(r) {
|
|
1403
|
+
var createdId = r && r.id || f.id;
|
|
1404
|
+
return syncSets(createdId, f.setIds || [], f.id ? rowSetIds(f.id) : []).catch(function(e) {
|
|
1405
|
+
msgS[1]("\u51ED\u636E\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u96C6\u5408\u6302\u8F7D\u5931\u8D25\uFF1A" + C.errText(e));
|
|
1406
|
+
}).then(function() {
|
|
1407
|
+
busyS[1](false);
|
|
1408
|
+
editingS[1](false);
|
|
1409
|
+
showSecretS[1](false);
|
|
1410
|
+
formS[1](emptyForm());
|
|
1411
|
+
load();
|
|
1412
|
+
});
|
|
1413
|
+
}).catch(function(e) {
|
|
1414
|
+
busyS[1](false);
|
|
1415
|
+
var text = C.errText(e);
|
|
1416
|
+
msgS[1](text);
|
|
1417
|
+
load();
|
|
1418
|
+
if (isLockedText(text)) askUnlock("\u4FDD\u9669\u7BB1\u5DF2\u9501\u5B9A\uFF0C\u8F93\u5165\u4E3B\u53E3\u4EE4\u540E\u4F1A\u81EA\u52A8\u7EE7\u7EED\u4FDD\u5B58\u3002");
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
function rowSetIds(id) {
|
|
1422
|
+
for (var i = 0; i < rows.length; i += 1) if (rows[i].id === id) return (rows[i].setIds || []).slice();
|
|
1423
|
+
return [];
|
|
1424
|
+
}
|
|
1425
|
+
function syncSets(secretId, next, prev) {
|
|
1426
|
+
var added = next.filter(function(x) {
|
|
1427
|
+
return prev.indexOf(x) < 0;
|
|
1428
|
+
});
|
|
1429
|
+
var removed = prev.filter(function(x) {
|
|
1430
|
+
return next.indexOf(x) < 0;
|
|
1431
|
+
});
|
|
1432
|
+
var jobs = added.map(function(setId) {
|
|
1433
|
+
return C.call(api, "vault.setAttachSecret", { setId, secretId });
|
|
1434
|
+
}).concat(removed.map(function(setId) {
|
|
1435
|
+
return C.call(api, "vault.setDetachSecret", { setId, secretId });
|
|
1436
|
+
}));
|
|
1437
|
+
return Promise.all(jobs);
|
|
1438
|
+
}
|
|
1439
|
+
function del(row) {
|
|
1440
|
+
if (!window.confirm("\u5220\u9664\u51ED\u636E\u300C" + row.name + "\u300D\uFF1F\u7ED1\u5B9A\u5B83\u7684\u8FDE\u63A5\u5668\u4F1A\u5931\u6548\u3002")) return;
|
|
1441
|
+
busyS[1](true);
|
|
1442
|
+
msgS[1]("");
|
|
1443
|
+
C.call(api, "vault.secretDelete", { id: row.id }).then(function() {
|
|
1444
|
+
busyS[1](false);
|
|
1445
|
+
load();
|
|
1446
|
+
}).catch(function(e) {
|
|
1447
|
+
busyS[1](false);
|
|
1448
|
+
msgS[1](C.errText(e));
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
function reveal(row) {
|
|
1452
|
+
msgS[1]("");
|
|
1453
|
+
var mode = statusS[0] && statusS[0].unlockMode;
|
|
1454
|
+
if (mode === "B") {
|
|
1455
|
+
askS[1]({ row, value: "", busy: false, error: "" });
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1458
|
+
doReveal(row, void 0);
|
|
1459
|
+
}
|
|
1460
|
+
function doReveal(row, passphrase) {
|
|
1461
|
+
busyS[1](true);
|
|
1462
|
+
C.call(api, "vault.secretReveal", { id: row.id, passphrase }).then(function(r) {
|
|
1463
|
+
busyS[1](false);
|
|
1464
|
+
askS[1](null);
|
|
1465
|
+
revealS[1]({ name: row.name, secret: r.secret });
|
|
1466
|
+
}).catch(function(e) {
|
|
1467
|
+
busyS[1](false);
|
|
1468
|
+
if (askS[0]) askS[1](Object.assign({}, askS[0], { busy: false, error: C.errText(e) }));
|
|
1469
|
+
else msgS[1](C.errText(e));
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
function confirmPassphrase() {
|
|
1473
|
+
var a = askS[0];
|
|
1474
|
+
if (!a || !a.value) return;
|
|
1475
|
+
askS[1](Object.assign({}, a, { busy: true, error: "" }));
|
|
1476
|
+
doReveal(a.row, a.value);
|
|
1477
|
+
}
|
|
1478
|
+
var setIndex = {};
|
|
1479
|
+
setsS[0].forEach(function(s) {
|
|
1480
|
+
setIndex[s.id] = s.name;
|
|
1481
|
+
});
|
|
1482
|
+
return h(
|
|
1483
|
+
"div",
|
|
1484
|
+
{ className: "wbv" },
|
|
1485
|
+
h(
|
|
1486
|
+
"div",
|
|
1487
|
+
{ className: "wbv-row" },
|
|
1488
|
+
h("h2", { className: "wbv-grow" }, "\u51ED\u636E\u5E93"),
|
|
1489
|
+
h("input", {
|
|
1490
|
+
className: "wbv-search",
|
|
1491
|
+
placeholder: "\u641C\u7D22\u540D\u79F0\u3001\u5907\u6CE8\u6216\u96C6\u5408",
|
|
1492
|
+
value: qS[0],
|
|
1493
|
+
onChange: function(e) {
|
|
1494
|
+
qS[1](e.target.value);
|
|
1495
|
+
},
|
|
1496
|
+
onKeyDown: function(e) {
|
|
1497
|
+
if (e.key === "Enter") load();
|
|
1498
|
+
}
|
|
1499
|
+
}),
|
|
1500
|
+
h(
|
|
1501
|
+
"select",
|
|
1502
|
+
{
|
|
1503
|
+
value: kindS[0],
|
|
1504
|
+
onChange: function(e) {
|
|
1505
|
+
kindS[1](e.target.value);
|
|
1506
|
+
setTimeout(load, 0);
|
|
1507
|
+
}
|
|
1508
|
+
},
|
|
1509
|
+
h("option", { value: "" }, "\u5168\u90E8\u7C7B\u578B"),
|
|
1510
|
+
K.CREATABLE_KINDS.map(function(k) {
|
|
1511
|
+
return h("option", { key: k, value: k }, KIND_LABEL[k]);
|
|
1512
|
+
})
|
|
1513
|
+
),
|
|
1514
|
+
h(C.Btn, { h, onClick: load }, "\u5237\u65B0"),
|
|
1515
|
+
statusS[0] && statusS[0].locked ? h(C.Btn, { h, kind: "primary", onClick: function() {
|
|
1516
|
+
askUnlock("");
|
|
1517
|
+
} }, "\u89E3\u9501") : null,
|
|
1518
|
+
h(C.Btn, { h, kind: "primary", onClick: startCreate }, "\u65B0\u589E\u51ED\u636E")
|
|
1519
|
+
),
|
|
1520
|
+
h("p", { className: "wbv-muted" }, "\u51ED\u636E\u6309\u300C\u96C6\u5408\u300D\u7EC4\u7EC7\uFF1A\u4E00\u6761\u51ED\u636E\u53EF\u4EE5\u8FDB\u591A\u4E2A\u96C6\u5408\uFF0C\u4E00\u4E2A\u96C6\u5408\u53EF\u4EE5\u6302\u5230\u591A\u4E2A\u5206\u7EC4\u3002\u660E\u6587\u53EA\u5728\u672C\u673A\u89E3\u9501\u540E\u53EF\u89C1\u3002"),
|
|
1521
|
+
statusS[0] && statusS[0].locked ? h(C.Notice, { h, kind: "error", text: "\u4FDD\u9669\u7BB1\u5DF2\u9501\u5B9A\uFF08" + (statusS[0].unlockMode || "A") + " \u6A21\u5F0F\uFF09\uFF1A\u65B0\u589E\u3001\u7F16\u8F91\u548C\u67E5\u770B\u660E\u6587\u90FD\u9700\u8981\u5148\u89E3\u9501\u3002\u70B9\u53F3\u4E0A\u89D2\u300C\u89E3\u9501\u300D\uFF0C\u6216\u76F4\u63A5\u4FDD\u5B58\u65F6\u6309\u63D0\u793A\u89E3\u9501\u3002" }) : null,
|
|
1522
|
+
h(C.Notice, { h, kind: "error", text: listS[0].error || msgS[0] }),
|
|
1523
|
+
listS[0].loading ? h(C.Empty, { h, text: "\u8BFB\u53D6\u4E2D\u2026" }) : rows.length === 0 ? h(
|
|
1524
|
+
"div",
|
|
1525
|
+
{ className: "wbv-empty-card" },
|
|
1526
|
+
h("div", { className: "wbv-empty-title" }, qS[0] || kindS[0] ? "\u6CA1\u6709\u5339\u914D\u7684\u51ED\u636E" : "\u8FD8\u6CA1\u6709\u51ED\u636E"),
|
|
1527
|
+
h("div", { className: "wbv-muted" }, qS[0] || kindS[0] ? "\u6362\u4E2A\u5173\u952E\u8BCD\u6216\u7C7B\u578B\u8BD5\u8BD5\u3002" : "\u65B0\u589E\u4E00\u6761\u540E\uFF0C\u628A\u5B83\u52A0\u5165\u96C6\u5408\uFF1B\u7AD9\u70B9\u8D26\u53F7\u4F1A\u81EA\u52A8\u7528\u8D26\u53F7 id \u4F5C\u4E3A\u96C6\u5408\u540D\u3002"),
|
|
1528
|
+
h("div", { className: "wbv-row" }, h(C.Btn, { h, kind: "primary", onClick: startCreate }, "\u65B0\u589E\u51ED\u636E"))
|
|
1529
|
+
) : h(
|
|
1530
|
+
"table",
|
|
1531
|
+
{ className: "wbv-table" },
|
|
1532
|
+
h("thead", null, h("tr", null, ["\u540D\u79F0", "\u7C7B\u578B", "\u6240\u5C5E\u96C6\u5408", "\u5907\u6CE8", "\u6700\u8FD1\u4F7F\u7528", "\u64CD\u4F5C"].map(function(x) {
|
|
1533
|
+
return h("th", { key: x }, x);
|
|
1534
|
+
}))),
|
|
1535
|
+
h("tbody", null, rows.map(function(row) {
|
|
1536
|
+
var meta = {};
|
|
1537
|
+
try {
|
|
1538
|
+
meta = JSON.parse(row.meta || "{}");
|
|
1539
|
+
} catch (e) {
|
|
1540
|
+
meta = {};
|
|
1541
|
+
}
|
|
1542
|
+
var chips = (row.setIds || []).map(function(id) {
|
|
1543
|
+
return h("span", { key: id, className: "wbv-chip" }, setIndex[id] || id);
|
|
1544
|
+
});
|
|
1545
|
+
return h(
|
|
1546
|
+
"tr",
|
|
1547
|
+
{ key: row.id },
|
|
1548
|
+
h("td", null, h("strong", null, row.name), h("div", { className: "wbv-muted" }, row.id)),
|
|
1549
|
+
h("td", null, h("span", { className: "wbv-pill" }, KIND_LABEL[row.kind] || row.kind)),
|
|
1550
|
+
h("td", null, chips.length ? h("div", { className: "wbv-chips" }, chips) : h("span", { className: "wbv-muted" }, "\u672A\u52A0\u5165\u96C6\u5408")),
|
|
1551
|
+
h("td", null, noteOf(meta) || "\u2014"),
|
|
1552
|
+
h("td", null, C.fmtTime(row.lastUsedAt, lang)),
|
|
1553
|
+
h("td", null, h(
|
|
1554
|
+
"div",
|
|
1555
|
+
{ className: "wbv-inline" },
|
|
1556
|
+
h(C.Btn, { h, kind: "ghost", onClick: function() {
|
|
1557
|
+
reveal(row);
|
|
1558
|
+
} }, "\u67E5\u770B"),
|
|
1559
|
+
h(C.Btn, { h, kind: "ghost", onClick: function() {
|
|
1560
|
+
startEdit(row);
|
|
1561
|
+
} }, "\u7F16\u8F91"),
|
|
1562
|
+
h(C.Btn, { h, kind: "ghost", onClick: function() {
|
|
1563
|
+
del(row);
|
|
1564
|
+
} }, "\u5220\u9664")
|
|
1565
|
+
))
|
|
1566
|
+
);
|
|
1567
|
+
}))
|
|
1568
|
+
),
|
|
1569
|
+
editingS[0] ? h(
|
|
1570
|
+
"div",
|
|
1571
|
+
{ className: "wbv-modal", onClick: function() {
|
|
1572
|
+
editingS[1](false);
|
|
1573
|
+
showSecretS[1](false);
|
|
1574
|
+
} },
|
|
1575
|
+
h(
|
|
1576
|
+
"div",
|
|
1577
|
+
{ className: "wbv-modal-box", onClick: function(e) {
|
|
1578
|
+
e.stopPropagation();
|
|
1579
|
+
} },
|
|
1580
|
+
h("h3", null, formS[0].id ? "\u7F16\u8F91\u51ED\u636E" : "\u65B0\u589E\u51ED\u636E"),
|
|
1581
|
+
h(C.Field, { h, label: "\u540D\u79F0" }, h("input", { value: formS[0].name, onChange: function(e) {
|
|
1582
|
+
formS[1](Object.assign({}, formS[0], { name: e.target.value }));
|
|
1583
|
+
} })),
|
|
1584
|
+
h(
|
|
1585
|
+
C.Field,
|
|
1586
|
+
{ h, label: "\u7C7B\u578B" },
|
|
1587
|
+
h(
|
|
1588
|
+
"select",
|
|
1589
|
+
{ value: formS[0].kind, onChange: function(e) {
|
|
1590
|
+
formS[1](Object.assign({}, formS[0], { kind: e.target.value }));
|
|
1591
|
+
} },
|
|
1592
|
+
K.CREATABLE_KINDS.map(function(k) {
|
|
1593
|
+
return h("option", { key: k, value: k }, KIND_LABEL[k]);
|
|
1594
|
+
})
|
|
1595
|
+
)
|
|
1596
|
+
),
|
|
1597
|
+
h(
|
|
1598
|
+
C.Field,
|
|
1599
|
+
{ h, label: formS[0].id ? "\u65B0\u660E\u6587\uFF08\u7559\u7A7A\u4E0D\u8F6E\u6362\uFF09" : "\u660E\u6587" },
|
|
1600
|
+
h(SecretField, {
|
|
1601
|
+
h,
|
|
1602
|
+
show: showSecretS[0],
|
|
1603
|
+
value: formS[0].secret,
|
|
1604
|
+
placeholder: formS[0].id ? "\u4E0D\u4FEE\u6539\u8BF7\u7559\u7A7A" : "\u5BC6\u7801 / \u624B\u673A\u53F7 / \u8BC1\u4EF6\u53F7 / token",
|
|
1605
|
+
onChange: function(v) {
|
|
1606
|
+
formS[1](Object.assign({}, formS[0], { secret: v }));
|
|
1607
|
+
},
|
|
1608
|
+
onToggle: function() {
|
|
1609
|
+
showSecretS[1](!showSecretS[0]);
|
|
1610
|
+
}
|
|
1611
|
+
})
|
|
1612
|
+
),
|
|
1613
|
+
h(
|
|
1614
|
+
C.Field,
|
|
1615
|
+
{ h, label: "\u6240\u5C5E\u96C6\u5408\uFF08\u53EF\u591A\u9009\uFF09", hint: setsS[0].length ? "\u52FE\u9009\u540E\u4FDD\u5B58\u65F6\u540C\u6B65\u6302\u8F7D/\u6458\u9664" : "\u8FD8\u6CA1\u6709\u96C6\u5408\uFF0C\u53EF\u5148\u5728\u300C\u96C6\u5408\u300D\u9875\u65B0\u5EFA" },
|
|
1616
|
+
setsS[0].length ? h("div", { className: "wbv-check-list" }, setsS[0].map(function(s) {
|
|
1617
|
+
var on = (formS[0].setIds || []).indexOf(s.id) >= 0;
|
|
1618
|
+
return h(
|
|
1619
|
+
"label",
|
|
1620
|
+
{ key: s.id, className: "wbv-check" },
|
|
1621
|
+
h("input", { type: "checkbox", checked: on, onChange: function() {
|
|
1622
|
+
toggleSet(s.id);
|
|
1623
|
+
} }),
|
|
1624
|
+
h("span", { className: "wbv-dot", style: { background: s.color || "var(--wb-accent)" } }),
|
|
1625
|
+
h("span", null, s.name),
|
|
1626
|
+
h("span", { className: "wbv-muted" }, " \xB7 " + (s.secretCount || 0) + " \u6761")
|
|
1627
|
+
);
|
|
1628
|
+
})) : h("span", { className: "wbv-muted" }, "\u2014")
|
|
1629
|
+
),
|
|
1630
|
+
h(
|
|
1631
|
+
C.Field,
|
|
1632
|
+
{ h, label: "\u5907\u6CE8", hint: "\u975E\u654F\u611F\u4FE1\u606F\uFF08\u7528\u6237\u540D\u3001URL\u3001\u8FC7\u671F\u63D0\u9192\uFF09" },
|
|
1633
|
+
h("input", {
|
|
1634
|
+
value: formS[0].note || "",
|
|
1635
|
+
placeholder: "\u4F8B\u5982\uFF1A\u7528\u6237\u540D\u3001URL\u3001\u8FC7\u671F\u63D0\u9192",
|
|
1636
|
+
onChange: function(e) {
|
|
1637
|
+
formS[1](Object.assign({}, formS[0], { note: e.target.value }));
|
|
1638
|
+
}
|
|
1639
|
+
})
|
|
1640
|
+
),
|
|
1641
|
+
h(C.Notice, { h, kind: "error", text: msgS[0] }),
|
|
1642
|
+
h(
|
|
1643
|
+
"div",
|
|
1644
|
+
{ className: "wbv-row" },
|
|
1645
|
+
h("span", { className: "wbv-grow" }),
|
|
1646
|
+
h(C.Btn, { h, onClick: function() {
|
|
1647
|
+
editingS[1](false);
|
|
1648
|
+
showSecretS[1](false);
|
|
1649
|
+
} }, "\u53D6\u6D88"),
|
|
1650
|
+
h(C.Btn, { h, kind: "primary", disabled: busyS[0], onClick: function() {
|
|
1651
|
+
save(false);
|
|
1652
|
+
} }, busyS[0] ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58")
|
|
1653
|
+
)
|
|
1654
|
+
)
|
|
1655
|
+
) : null,
|
|
1656
|
+
unlockS[0] ? h(AskPassphrase, {
|
|
1657
|
+
h,
|
|
1658
|
+
C,
|
|
1659
|
+
title: "\u89E3\u9501\u4FDD\u9669\u7BB1",
|
|
1660
|
+
hint: "\u89E3\u9501\u72B6\u6001\u53EA\u4FDD\u5B58\u5728\u5F53\u524D\u8FDB\u7A0B\u5185\u5B58\uFF0C\u7A7A\u95F2\u8D85\u65F6\u4F1A\u81EA\u52A8\u9501\u5B9A\u3002",
|
|
1661
|
+
label: "\u4E3B\u53E3\u4EE4",
|
|
1662
|
+
value: unlockS[0].value,
|
|
1663
|
+
busy: unlockS[0].busy,
|
|
1664
|
+
error: unlockS[0].error,
|
|
1665
|
+
onChange: function(v) {
|
|
1666
|
+
unlockS[1](Object.assign({}, unlockS[0], { value: v }));
|
|
1667
|
+
},
|
|
1668
|
+
onCancel: function() {
|
|
1669
|
+
if (!unlockS[0].busy) unlockS[1](null);
|
|
1670
|
+
},
|
|
1671
|
+
onConfirm: confirmUnlock
|
|
1672
|
+
}) : null,
|
|
1673
|
+
askS[0] ? h(AskPassphrase, { h, C, title: "\u67E5\u770B\u51ED\u636E\u660E\u6587", hint: "\u5F53\u524D\u662F B \u6A21\u5F0F\uFF0C\u67E5\u770B\u660E\u6587\u9700\u8981\u518D\u6B21\u8F93\u5165\u4E3B\u53E3\u4EE4\u3002", label: "\u4E3B\u53E3\u4EE4\uFF08" + askS[0].row.name + "\uFF09", value: askS[0].value, busy: askS[0].busy, error: askS[0].error, onChange: function(v) {
|
|
1674
|
+
askS[1](Object.assign({}, askS[0], { value: v }));
|
|
1675
|
+
}, onCancel: function() {
|
|
1676
|
+
if (!askS[0].busy) askS[1](null);
|
|
1677
|
+
}, onConfirm: confirmPassphrase }) : null,
|
|
1678
|
+
revealS[0] ? h(
|
|
1679
|
+
"div",
|
|
1680
|
+
{ className: "wbv-modal", onClick: function() {
|
|
1681
|
+
revealS[1](null);
|
|
1682
|
+
} },
|
|
1683
|
+
h(
|
|
1684
|
+
"div",
|
|
1685
|
+
{ className: "wbv-modal-box", onClick: function(e) {
|
|
1686
|
+
e.stopPropagation();
|
|
1687
|
+
} },
|
|
1688
|
+
h("h3", null, "\u51ED\u636E\u660E\u6587 \xB7 " + revealS[0].name),
|
|
1689
|
+
h("div", { className: "wbv-secret" }, revealS[0].secret),
|
|
1690
|
+
h(
|
|
1691
|
+
"div",
|
|
1692
|
+
{ className: "wbv-row" },
|
|
1693
|
+
h(C.Btn, { h, onClick: function() {
|
|
1694
|
+
if (navigator.clipboard) navigator.clipboard.writeText(revealS[0].secret).then(function() {
|
|
1695
|
+
msgS[1]("\u5DF2\u590D\u5236");
|
|
1696
|
+
});
|
|
1697
|
+
} }, "\u590D\u5236"),
|
|
1698
|
+
h("span", { className: "wbv-grow" }),
|
|
1699
|
+
h(C.Btn, { h, onClick: function() {
|
|
1700
|
+
revealS[1](null);
|
|
1701
|
+
} }, "\u5173\u95ED")
|
|
1702
|
+
)
|
|
1703
|
+
)
|
|
1704
|
+
) : null
|
|
1705
|
+
);
|
|
1706
|
+
};
|
|
1707
|
+
function noteOf(meta) {
|
|
1708
|
+
if (!meta) return "";
|
|
1709
|
+
if (meta.note) return String(meta.note);
|
|
1710
|
+
return [meta.username, meta.url].filter(Boolean).join(" \xB7 ");
|
|
1711
|
+
}
|
|
1712
|
+
function emptyForm() {
|
|
1713
|
+
return { id: "", name: "", kind: "password", secret: "", setIds: [], note: "" };
|
|
1714
|
+
}
|
|
1715
|
+
module2.exports.noteOf = noteOf;
|
|
1716
|
+
}
|
|
1717
|
+
});
|
|
1718
|
+
|
|
1719
|
+
// packages/addons/vault/client/views/sets.cjs
|
|
1720
|
+
var require_sets = __commonJS({
|
|
1721
|
+
"packages/addons/vault/client/views/sets.cjs"(exports2, module2) {
|
|
1722
|
+
"use strict";
|
|
1723
|
+
var C = require_common();
|
|
1724
|
+
var K = require_kinds();
|
|
1725
|
+
module2.exports = function SetsView(props) {
|
|
1726
|
+
var h = props.h;
|
|
1727
|
+
var api = props.api;
|
|
1728
|
+
var lang = props.lang || "zh";
|
|
1729
|
+
var React = props.React;
|
|
1730
|
+
var listS = React.useState({ loading: true, items: [], error: "" });
|
|
1731
|
+
var secretsS = React.useState([]);
|
|
1732
|
+
var groupsS = React.useState([]);
|
|
1733
|
+
var activeS = React.useState(null);
|
|
1734
|
+
var detailS = React.useState({ setId: "", secrets: [], groups: [], error: "" });
|
|
1735
|
+
var qS = React.useState("");
|
|
1736
|
+
var msgS = React.useState("");
|
|
1737
|
+
var busyS = React.useState(false);
|
|
1738
|
+
var draftS = React.useState(null);
|
|
1739
|
+
var pickS = React.useState([]);
|
|
1740
|
+
function load() {
|
|
1741
|
+
listS[1](function(old) {
|
|
1742
|
+
return Object.assign({}, old, { loading: true });
|
|
1743
|
+
});
|
|
1744
|
+
Promise.all([
|
|
1745
|
+
C.call(api, "vault.setList", { q: qS[0] }),
|
|
1746
|
+
C.call(api, "vault.secretList", {}),
|
|
1747
|
+
C.call(api, "vault.groupList", {})
|
|
1748
|
+
]).then(function(r) {
|
|
1749
|
+
listS[1]({ loading: false, items: r[0] && r[0].items || [], error: "" });
|
|
1750
|
+
secretsS[1](r[1] && (r[1].items || r[1].secrets) || []);
|
|
1751
|
+
groupsS[1](r[2] && r[2].items || []);
|
|
1752
|
+
if (activeS[0]) return open(activeS[0]).then(null, function() {
|
|
1753
|
+
});
|
|
1754
|
+
}).catch(function(e) {
|
|
1755
|
+
listS[1]({ loading: false, items: [], error: C.errText(e) });
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
React.useEffect(function() {
|
|
1759
|
+
load();
|
|
1760
|
+
}, []);
|
|
1761
|
+
function secretName(id) {
|
|
1762
|
+
for (var i = 0; i < secretsS[0].length; i += 1) if (secretsS[0][i].id === id) return secretsS[0][i].name;
|
|
1763
|
+
return id;
|
|
1764
|
+
}
|
|
1765
|
+
function open(row) {
|
|
1766
|
+
activeS[1](row);
|
|
1767
|
+
detailS[1]({ setId: row.id, secrets: [], groups: [], error: "" });
|
|
1768
|
+
return C.call(api, "vault.setGet", { id: row.id }).then(function(r) {
|
|
1769
|
+
detailS[1]({ setId: row.id, secrets: r && r.secrets || [], groups: r && r.groupIds || [], error: "" });
|
|
1770
|
+
}).catch(function(e) {
|
|
1771
|
+
detailS[1]({ setId: row.id, secrets: [], groups: [], error: C.errText(e) });
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
function startCreate() {
|
|
1775
|
+
draftS[1]({ name: "", description: "", color: "" });
|
|
1776
|
+
msgS[1]("");
|
|
1777
|
+
}
|
|
1778
|
+
function startEdit(set) {
|
|
1779
|
+
draftS[1]({ id: set.id, name: set.name, description: set.description || "", color: set.color || "" });
|
|
1780
|
+
msgS[1]("");
|
|
1781
|
+
}
|
|
1782
|
+
function saveDraft() {
|
|
1783
|
+
var d = draftS[0];
|
|
1784
|
+
if (!d || !String(d.name || "").trim()) return msgS[1]("\u96C6\u5408\u540D\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1785
|
+
busyS[1](true);
|
|
1786
|
+
msgS[1]("");
|
|
1787
|
+
var body = { name: String(d.name).trim(), description: d.description || "", color: d.color || "" };
|
|
1788
|
+
var req = d.id ? C.call(api, "vault.setUpdate", Object.assign({ id: d.id }, body)) : C.call(api, "vault.setCreate", body);
|
|
1789
|
+
req.then(function() {
|
|
1790
|
+
busyS[1](false);
|
|
1791
|
+
draftS[1](null);
|
|
1792
|
+
load();
|
|
1793
|
+
}).catch(function(e) {
|
|
1794
|
+
busyS[1](false);
|
|
1795
|
+
msgS[1](C.errText(e));
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
function removeSet(set) {
|
|
1799
|
+
if (!window.confirm("\u5220\u9664\u96C6\u5408\u300C" + set.name + "\u300D\uFF1F\u53EA\u89E3\u9664\u5173\u8054\uFF0C\u51ED\u636E\u672C\u8EAB\u4FDD\u7559\u3002")) return;
|
|
1800
|
+
busyS[1](true);
|
|
1801
|
+
msgS[1]("");
|
|
1802
|
+
C.call(api, "vault.setDelete", { id: set.id }).then(function() {
|
|
1803
|
+
busyS[1](false);
|
|
1804
|
+
activeS[1](null);
|
|
1805
|
+
load();
|
|
1806
|
+
}).catch(function(e) {
|
|
1807
|
+
busyS[1](false);
|
|
1808
|
+
msgS[1](C.errText(e));
|
|
1809
|
+
});
|
|
1810
|
+
}
|
|
1811
|
+
function detach(secretId) {
|
|
1812
|
+
busyS[1](true);
|
|
1813
|
+
msgS[1]("");
|
|
1814
|
+
C.call(api, "vault.setDetachSecret", { setId: activeS[0].id, secretId }).then(function() {
|
|
1815
|
+
busyS[1](false);
|
|
1816
|
+
open(activeS[0]);
|
|
1817
|
+
load();
|
|
1818
|
+
}).catch(function(e) {
|
|
1819
|
+
busyS[1](false);
|
|
1820
|
+
msgS[1](C.errText(e));
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
function attachPicked() {
|
|
1824
|
+
if (!pickS[0].length) return;
|
|
1825
|
+
busyS[1](true);
|
|
1826
|
+
msgS[1]("");
|
|
1827
|
+
var jobs = pickS[0].map(function(secretId) {
|
|
1828
|
+
return C.call(api, "vault.setAttachSecret", { setId: activeS[0].id, secretId });
|
|
1829
|
+
});
|
|
1830
|
+
Promise.all(jobs).then(function() {
|
|
1831
|
+
busyS[1](false);
|
|
1832
|
+
pickS[1]([]);
|
|
1833
|
+
open(activeS[0]);
|
|
1834
|
+
load();
|
|
1835
|
+
}).catch(function(e) {
|
|
1836
|
+
busyS[1](false);
|
|
1837
|
+
msgS[1](C.errText(e));
|
|
1838
|
+
});
|
|
1839
|
+
}
|
|
1840
|
+
function toggleGroup(groupId, on) {
|
|
1841
|
+
busyS[1](true);
|
|
1842
|
+
msgS[1]("");
|
|
1843
|
+
var action = on ? "vault.groupAttachSet" : "vault.groupDetachSet";
|
|
1844
|
+
C.call(api, action, { groupId, setId: activeS[0].id }).then(function() {
|
|
1845
|
+
busyS[1](false);
|
|
1846
|
+
open(activeS[0]);
|
|
1847
|
+
load();
|
|
1848
|
+
}).catch(function(e) {
|
|
1849
|
+
busyS[1](false);
|
|
1850
|
+
msgS[1](C.errText(e));
|
|
1851
|
+
});
|
|
1852
|
+
}
|
|
1853
|
+
var items = listS[0].items.filter(function(set) {
|
|
1854
|
+
var q = qS[0].trim();
|
|
1855
|
+
if (!q) return true;
|
|
1856
|
+
return (set.name || "").indexOf(q) >= 0 || (set.description || "").indexOf(q) >= 0;
|
|
1857
|
+
});
|
|
1858
|
+
var detail = detailS[0];
|
|
1859
|
+
var inSet = {};
|
|
1860
|
+
detail.secrets.forEach(function(s) {
|
|
1861
|
+
inSet[s.id] = true;
|
|
1862
|
+
});
|
|
1863
|
+
var candidates = secretsS[0].filter(function(s) {
|
|
1864
|
+
return !inSet[s.id];
|
|
1865
|
+
});
|
|
1866
|
+
return h(
|
|
1867
|
+
"div",
|
|
1868
|
+
{ className: "wbv" },
|
|
1869
|
+
h(
|
|
1870
|
+
"div",
|
|
1871
|
+
{ className: "wbv-row" },
|
|
1872
|
+
h("h2", { className: "wbv-grow" }, "\u51ED\u636E\u96C6\u5408"),
|
|
1873
|
+
h("input", { style: { maxWidth: "200px" }, placeholder: "\u641C\u7D22\u96C6\u5408\u540D/\u63CF\u8FF0", value: qS[0], onChange: function(e) {
|
|
1874
|
+
qS[1](e.target.value);
|
|
1875
|
+
} }),
|
|
1876
|
+
h(C.Btn, { h, onClick: load }, "\u5237\u65B0"),
|
|
1877
|
+
h(C.Btn, { h, kind: "primary", onClick: startCreate }, "\u65B0\u5EFA\u96C6\u5408")
|
|
1878
|
+
),
|
|
1879
|
+
h("p", { className: "wbv-muted" }, "\u4E00\u4E2A\u96C6\u5408\u53EF\u4EE5\u6302\u5230\u591A\u4E2A\u5206\u7EC4\u3001\u88C5\u591A\u6761\u51ED\u636E\uFF1B\u5220\u9664\u96C6\u5408\u53EA\u65AD\u5173\u8054\uFF0C\u4E0D\u5220\u51ED\u636E\u3002"),
|
|
1880
|
+
h(C.Notice, { h, kind: "error", text: listS[0].error || msgS[0] }),
|
|
1881
|
+
h(
|
|
1882
|
+
"div",
|
|
1883
|
+
{ className: "wbv-split" },
|
|
1884
|
+
h(
|
|
1885
|
+
"div",
|
|
1886
|
+
{ className: "wbv-list" },
|
|
1887
|
+
listS[0].loading ? h(C.Empty, { h, text: "\u8BFB\u53D6\u96C6\u5408\u2026" }) : items.length === 0 ? h(
|
|
1888
|
+
"div",
|
|
1889
|
+
{ className: "wbv-card" },
|
|
1890
|
+
h("div", { className: "wbv-muted" }, qS[0] ? "\u6CA1\u6709\u5339\u914D\u7684\u96C6\u5408\u3002" : "\u8FD8\u6CA1\u6709\u96C6\u5408\u3002\u65B0\u5EFA\u4E00\u4E2A\u540E\uFF0C\u53EF\u4EE5\u628A\u51ED\u636E\u548C\u5206\u7EC4\u90FD\u6302\u8FDB\u6765\u3002"),
|
|
1891
|
+
h(
|
|
1892
|
+
"div",
|
|
1893
|
+
{ className: "wbv-row", style: { marginTop: "8px" } },
|
|
1894
|
+
h(C.Btn, { h, kind: "primary", onClick: startCreate }, "\u65B0\u5EFA\u96C6\u5408")
|
|
1895
|
+
)
|
|
1896
|
+
) : items.map(function(set) {
|
|
1897
|
+
var on = activeS[0] && activeS[0].id === set.id;
|
|
1898
|
+
return h(
|
|
1899
|
+
"div",
|
|
1900
|
+
{
|
|
1901
|
+
key: set.id,
|
|
1902
|
+
className: "wbv-item" + (on ? " on" : ""),
|
|
1903
|
+
onClick: function() {
|
|
1904
|
+
open(set);
|
|
1905
|
+
}
|
|
1906
|
+
},
|
|
1907
|
+
h(
|
|
1908
|
+
"div",
|
|
1909
|
+
{ className: "wbv-item-top" },
|
|
1910
|
+
h("span", { className: "wbv-dot", style: set.color ? { background: set.color } : null }),
|
|
1911
|
+
h("strong", null, set.name),
|
|
1912
|
+
h("span", { className: "wbv-grow" }),
|
|
1913
|
+
h("span", { className: "wbv-pill" }, (set.secretCount || 0) + " \u6761\u51ED\u636E")
|
|
1914
|
+
),
|
|
1915
|
+
h(
|
|
1916
|
+
"div",
|
|
1917
|
+
{ className: "wbv-muted", style: { fontSize: "11px", marginTop: "2px" } },
|
|
1918
|
+
(set.description || "\u2014") + " \xB7 " + (set.groupIds || []).length + " \u4E2A\u5206\u7EC4"
|
|
1919
|
+
)
|
|
1920
|
+
);
|
|
1921
|
+
})
|
|
1922
|
+
),
|
|
1923
|
+
h(
|
|
1924
|
+
"div",
|
|
1925
|
+
{ className: "wbv-card" },
|
|
1926
|
+
!activeS[0] ? h(C.Empty, { h, text: "\u5DE6\u4FA7\u9009\u4E00\u4E2A\u96C6\u5408\uFF0C\u67E5\u770B\u51ED\u636E\u4E0E\u5206\u7EC4\u3002" }) : h(
|
|
1927
|
+
React.Fragment,
|
|
1928
|
+
null,
|
|
1929
|
+
h(
|
|
1930
|
+
"div",
|
|
1931
|
+
{ className: "wbv-row" },
|
|
1932
|
+
h("h3", { className: "wbv-grow" }, activeS[0].name),
|
|
1933
|
+
h(C.Btn, { h, onClick: function() {
|
|
1934
|
+
startEdit(activeS[0]);
|
|
1935
|
+
} }, "\u7F16\u8F91"),
|
|
1936
|
+
h(C.Btn, { h, kind: "danger", onClick: function() {
|
|
1937
|
+
removeSet(activeS[0]);
|
|
1938
|
+
} }, "\u5220\u9664\u96C6\u5408")
|
|
1939
|
+
),
|
|
1940
|
+
detail.error ? h(C.Notice, { h, kind: "error", text: detail.error }) : null,
|
|
1941
|
+
h("div", { className: "wbv-label" }, "\u96C6\u5408\u5185\u51ED\u636E"),
|
|
1942
|
+
detail.secrets.length === 0 ? h("div", { className: "wbv-muted" }, "\u8FD8\u6CA1\u6709\u51ED\u636E\u3002") : h(
|
|
1943
|
+
"table",
|
|
1944
|
+
{ className: "wbv-table" },
|
|
1945
|
+
h("thead", null, h("tr", null, ["\u540D\u79F0", "\u7C7B\u578B", "\u66F4\u65B0\u65F6\u95F4", "\u64CD\u4F5C"].map(function(x) {
|
|
1946
|
+
return h("th", { key: x }, x);
|
|
1947
|
+
}))),
|
|
1948
|
+
h("tbody", null, detail.secrets.map(function(s) {
|
|
1949
|
+
return h(
|
|
1950
|
+
"tr",
|
|
1951
|
+
{ key: s.id },
|
|
1952
|
+
h("td", null, h("strong", null, s.name)),
|
|
1953
|
+
h("td", null, h("span", { className: "wbv-pill" }, K.KIND_LABEL[s.kind] || s.kind)),
|
|
1954
|
+
h("td", null, C.fmtTime(s.updatedAt, lang)),
|
|
1955
|
+
h("td", null, h(C.Btn, { h, kind: "ghost", onClick: function() {
|
|
1956
|
+
detach(s.id);
|
|
1957
|
+
} }, "\u79FB\u51FA"))
|
|
1958
|
+
);
|
|
1959
|
+
}))
|
|
1960
|
+
),
|
|
1961
|
+
h(
|
|
1962
|
+
"div",
|
|
1963
|
+
{ className: "wbv-row" },
|
|
1964
|
+
h(
|
|
1965
|
+
"select",
|
|
1966
|
+
{
|
|
1967
|
+
style: { maxWidth: "260px" },
|
|
1968
|
+
value: "",
|
|
1969
|
+
onChange: function(e) {
|
|
1970
|
+
var v = e.target.value;
|
|
1971
|
+
if (v) pickS[1](pickS[0].concat([v]));
|
|
1972
|
+
e.target.value = "";
|
|
1973
|
+
}
|
|
1974
|
+
},
|
|
1975
|
+
h("option", { value: "" }, candidates.length ? "\u9009\u62E9\u8981\u52A0\u5165\u7684\u51ED\u636E\u2026" : "\u6CA1\u6709\u53EF\u52A0\u5165\u7684\u51ED\u636E"),
|
|
1976
|
+
candidates.map(function(s) {
|
|
1977
|
+
return h("option", { key: s.id, value: s.id }, s.name + "\uFF08" + (K.KIND_LABEL[s.kind] || s.kind) + "\uFF09");
|
|
1978
|
+
})
|
|
1979
|
+
),
|
|
1980
|
+
pickS[0].length ? h("span", { className: "wbv-chips" }, pickS[0].map(function(id) {
|
|
1981
|
+
return h(
|
|
1982
|
+
"span",
|
|
1983
|
+
{ className: "wbv-chip", key: id },
|
|
1984
|
+
secretName(id),
|
|
1985
|
+
h("button", { className: "wbv-btn ghost", onClick: function() {
|
|
1986
|
+
pickS[1](pickS[0].filter(function(x) {
|
|
1987
|
+
return x !== id;
|
|
1988
|
+
}));
|
|
1989
|
+
} }, "\xD7")
|
|
1990
|
+
);
|
|
1991
|
+
})) : null,
|
|
1992
|
+
h("span", { className: "wbv-grow" }),
|
|
1993
|
+
h(C.Btn, { h, kind: "primary", disabled: !pickS[0].length || busyS[0], onClick: attachPicked }, "\u52A0\u5165 " + (pickS[0].length || ""))
|
|
1994
|
+
),
|
|
1995
|
+
h("div", { className: "wbv-label" }, "\u6302\u9760\u5206\u7EC4"),
|
|
1996
|
+
h(
|
|
1997
|
+
"div",
|
|
1998
|
+
{ className: "wbv-chips" },
|
|
1999
|
+
groupsS[0].length === 0 ? h("span", { className: "wbv-muted" }, "\u8FD8\u6CA1\u6709\u5206\u7EC4\u3002") : groupsS[0].map(function(g) {
|
|
2000
|
+
var on = detail.groups.indexOf(g.id) >= 0;
|
|
2001
|
+
return h(
|
|
2002
|
+
"label",
|
|
2003
|
+
{ key: g.id, className: "wbv-chip", style: { cursor: "pointer" } },
|
|
2004
|
+
h("input", { type: "checkbox", checked: on, disabled: busyS[0], onChange: function(e) {
|
|
2005
|
+
toggleGroup(g.id, e.target.checked);
|
|
2006
|
+
} }),
|
|
2007
|
+
g.name
|
|
2008
|
+
);
|
|
2009
|
+
})
|
|
2010
|
+
)
|
|
2011
|
+
),
|
|
2012
|
+
draftS[0] ? h(
|
|
2013
|
+
"div",
|
|
2014
|
+
{ className: "wbv-modal", onClick: function() {
|
|
2015
|
+
draftS[1](null);
|
|
2016
|
+
} },
|
|
2017
|
+
h(
|
|
2018
|
+
"div",
|
|
2019
|
+
{ className: "wbv-modal-box", onClick: function(e) {
|
|
2020
|
+
e.stopPropagation();
|
|
2021
|
+
} },
|
|
2022
|
+
h("h3", null, draftS[0].id ? "\u7F16\u8F91\u96C6\u5408" : "\u65B0\u5EFA\u96C6\u5408"),
|
|
2023
|
+
h(
|
|
2024
|
+
C.Field,
|
|
2025
|
+
{ h, label: "\u96C6\u5408\u540D" },
|
|
2026
|
+
h("input", { value: draftS[0].name, placeholder: "\u5982 acc_1 / \u5DE5\u4F5C\u90AE\u7BB1", onChange: function(e) {
|
|
2027
|
+
draftS[1](Object.assign({}, draftS[0], { name: e.target.value }));
|
|
2028
|
+
} })
|
|
2029
|
+
),
|
|
2030
|
+
h(
|
|
2031
|
+
C.Field,
|
|
2032
|
+
{ h, label: "\u63CF\u8FF0" },
|
|
2033
|
+
h("input", { value: draftS[0].description, placeholder: "\u53EF\u9009", onChange: function(e) {
|
|
2034
|
+
draftS[1](Object.assign({}, draftS[0], { description: e.target.value }));
|
|
2035
|
+
} })
|
|
2036
|
+
),
|
|
2037
|
+
h(
|
|
2038
|
+
C.Field,
|
|
2039
|
+
{ h, label: "\u989C\u8272\uFF08\u53EF\u9009\uFF0C\u4E3B\u9898 token \u540D\u6216\u8272\u503C\uFF09" },
|
|
2040
|
+
h("input", { value: draftS[0].color, placeholder: "\u5982 --wb-accent", onChange: function(e) {
|
|
2041
|
+
draftS[1](Object.assign({}, draftS[0], { color: e.target.value }));
|
|
2042
|
+
} })
|
|
2043
|
+
),
|
|
2044
|
+
h(C.Notice, { h, kind: "error", text: msgS[0] }),
|
|
2045
|
+
h(
|
|
2046
|
+
"div",
|
|
2047
|
+
{ className: "wbv-row" },
|
|
2048
|
+
h("span", { className: "wbv-grow" }),
|
|
2049
|
+
h(C.Btn, { h, onClick: function() {
|
|
2050
|
+
draftS[1](null);
|
|
2051
|
+
} }, "\u53D6\u6D88"),
|
|
2052
|
+
h(C.Btn, { h, kind: "primary", disabled: busyS[0], onClick: saveDraft }, busyS[0] ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58")
|
|
2053
|
+
)
|
|
2054
|
+
)
|
|
2055
|
+
) : null
|
|
2056
|
+
)
|
|
2057
|
+
)
|
|
2058
|
+
);
|
|
2059
|
+
};
|
|
2060
|
+
}
|
|
2061
|
+
});
|
|
2062
|
+
|
|
2063
|
+
// packages/addons/lib/filter-checklist.cjs
|
|
2064
|
+
var require_filter_checklist = __commonJS({
|
|
2065
|
+
"packages/addons/lib/filter-checklist.cjs"(exports2, module2) {
|
|
2066
|
+
"use strict";
|
|
2067
|
+
var React = require("react");
|
|
2068
|
+
var h = React.createElement;
|
|
2069
|
+
var NEAR = 24;
|
|
2070
|
+
function nearBottom(el, threshold) {
|
|
2071
|
+
if (!el) return false;
|
|
2072
|
+
var gap = Number(threshold);
|
|
2073
|
+
if (!isFinite(gap) || gap < 0) gap = NEAR;
|
|
2074
|
+
return el.scrollTop + el.clientHeight >= el.scrollHeight - gap;
|
|
2075
|
+
}
|
|
2076
|
+
function FilterChecklist(props) {
|
|
2077
|
+
var items = props.items || [];
|
|
2078
|
+
var selected = props.selected || [];
|
|
2079
|
+
var disabled = props.disabled === true;
|
|
2080
|
+
var loading = props.loading === true;
|
|
2081
|
+
var hasMore = props.hasMore === true;
|
|
2082
|
+
var query = props.query || "";
|
|
2083
|
+
var total = typeof props.total === "number" ? props.total : items.length;
|
|
2084
|
+
var title = props.title || "\u5168\u90E8";
|
|
2085
|
+
var selectedText = props.selectedText || "\u5DF2\u9009";
|
|
2086
|
+
var clearText = props.clearText || "\u6E05\u7A7A";
|
|
2087
|
+
var searchPlaceholder = props.searchPlaceholder || "\u641C\u7D22";
|
|
2088
|
+
var emptyText = props.emptyText || "\u6682\u65E0\u6570\u636E";
|
|
2089
|
+
var noMatchText = props.noMatchText || "\u6CA1\u6709\u5339\u914D\u9879";
|
|
2090
|
+
var loadingText = props.loadingText || "\u52A0\u8F7D\u4E2D\u2026";
|
|
2091
|
+
var noMoreText = typeof props.noMoreText === "string" ? props.noMoreText : "\u6CA1\u6709\u66F4\u591A";
|
|
2092
|
+
var onToggle = props.onToggle || function() {
|
|
2093
|
+
};
|
|
2094
|
+
var onQuery = props.onQuery || function() {
|
|
2095
|
+
};
|
|
2096
|
+
var onLoadMore = props.onLoadMore;
|
|
2097
|
+
var onClear = props.onClear || function() {
|
|
2098
|
+
};
|
|
2099
|
+
function toggle(id) {
|
|
2100
|
+
if (disabled) return;
|
|
2101
|
+
onToggle(id);
|
|
2102
|
+
}
|
|
2103
|
+
function scroll(e) {
|
|
2104
|
+
if (disabled || loading || !hasMore || !onLoadMore) return;
|
|
2105
|
+
if (nearBottom(e.currentTarget)) onLoadMore();
|
|
2106
|
+
}
|
|
2107
|
+
var head = h(
|
|
2108
|
+
"div",
|
|
2109
|
+
{ className: "wbck-head" },
|
|
2110
|
+
h("span", { className: "wbck-grow" }, title + (total ? " \xB7 " + total : "")),
|
|
2111
|
+
selected.length ? h("span", { className: "wbck-sel" }, selectedText + " " + selected.length) : null,
|
|
2112
|
+
selected.length || query ? h("button", {
|
|
2113
|
+
type: "button",
|
|
2114
|
+
className: "wbck-clear",
|
|
2115
|
+
title: clearText,
|
|
2116
|
+
disabled,
|
|
2117
|
+
onClick: function() {
|
|
2118
|
+
if (disabled) return;
|
|
2119
|
+
onClear();
|
|
2120
|
+
}
|
|
2121
|
+
}, clearText) : null
|
|
2122
|
+
);
|
|
2123
|
+
var body;
|
|
2124
|
+
if (!items.length) {
|
|
2125
|
+
body = h("div", { className: "wbck-note", role: "status" }, loading ? loadingText : query ? noMatchText : emptyText);
|
|
2126
|
+
} else {
|
|
2127
|
+
body = items.map(function(x) {
|
|
2128
|
+
var on = selected.indexOf(String(x.id)) >= 0;
|
|
2129
|
+
return h(
|
|
2130
|
+
"label",
|
|
2131
|
+
{ key: x.id, className: "wbck-opt" + (on ? " is-on" : "") },
|
|
2132
|
+
h("input", {
|
|
2133
|
+
type: "checkbox",
|
|
2134
|
+
checked: on,
|
|
2135
|
+
disabled,
|
|
2136
|
+
onChange: function() {
|
|
2137
|
+
toggle(x.id);
|
|
2138
|
+
}
|
|
2139
|
+
}),
|
|
2140
|
+
h("span", { className: "wbck-nm", title: x.name }, x.name),
|
|
2141
|
+
x.meta ? h("span", { className: "wbck-meta" }, x.meta) : null
|
|
2142
|
+
);
|
|
2143
|
+
});
|
|
2144
|
+
var more = loading ? loadingText : hasMore ? "" : noMoreText;
|
|
2145
|
+
if (more) body = body.concat([h("div", { key: "__more", className: "wbck-more", role: "status" }, more)]);
|
|
2146
|
+
}
|
|
2147
|
+
return h(
|
|
2148
|
+
"div",
|
|
2149
|
+
{ className: "wbck", "data-role": "checklist" },
|
|
2150
|
+
h(
|
|
2151
|
+
"div",
|
|
2152
|
+
{ className: "wbck-search" },
|
|
2153
|
+
h("input", {
|
|
2154
|
+
type: "search",
|
|
2155
|
+
autoFocus: props.autoFocus !== false,
|
|
2156
|
+
className: "wbck-input",
|
|
2157
|
+
placeholder: searchPlaceholder,
|
|
2158
|
+
"aria-label": searchPlaceholder,
|
|
2159
|
+
value: query,
|
|
2160
|
+
disabled,
|
|
2161
|
+
onChange: function(e) {
|
|
2162
|
+
onQuery(e.target.value);
|
|
2163
|
+
}
|
|
2164
|
+
})
|
|
2165
|
+
),
|
|
2166
|
+
props.beforeHead || null,
|
|
2167
|
+
head,
|
|
2168
|
+
h("div", {
|
|
2169
|
+
className: "wbck-list",
|
|
2170
|
+
onScroll: scroll,
|
|
2171
|
+
"aria-busy": loading ? "true" : "false"
|
|
2172
|
+
}, body)
|
|
2173
|
+
);
|
|
2174
|
+
}
|
|
2175
|
+
module2.exports = FilterChecklist;
|
|
2176
|
+
module2.exports.nearBottom = nearBottom;
|
|
2177
|
+
}
|
|
2178
|
+
});
|
|
2179
|
+
|
|
2180
|
+
// packages/addons/vault/client/views/groups.cjs
|
|
2181
|
+
var require_groups = __commonJS({
|
|
2182
|
+
"packages/addons/vault/client/views/groups.cjs"(exports2, module2) {
|
|
2183
|
+
"use strict";
|
|
2184
|
+
var C = require_common();
|
|
2185
|
+
var FilterChecklist = require_filter_checklist();
|
|
2186
|
+
module2.exports = function GroupsView(props) {
|
|
2187
|
+
var h = props.h;
|
|
2188
|
+
var api = props.api;
|
|
2189
|
+
var lang = props.lang || "zh";
|
|
2190
|
+
var React = props.React;
|
|
2191
|
+
var listS = React.useState({ loading: true, rows: [], error: "" });
|
|
2192
|
+
var msgS = React.useState("");
|
|
2193
|
+
var busyS = React.useState(false);
|
|
2194
|
+
var createS = React.useState(null);
|
|
2195
|
+
var openS = React.useState(null);
|
|
2196
|
+
var setsS = React.useState([]);
|
|
2197
|
+
var delS = React.useState(null);
|
|
2198
|
+
var pickS = React.useState({ q: "", rows: [], page: 1, loading: false });
|
|
2199
|
+
function load() {
|
|
2200
|
+
listS[1](function(old) {
|
|
2201
|
+
return Object.assign({}, old, { loading: true });
|
|
2202
|
+
});
|
|
2203
|
+
Promise.all([
|
|
2204
|
+
C.call(api, "vault.groupList"),
|
|
2205
|
+
C.call(api, "vault.setList", {}).catch(function() {
|
|
2206
|
+
return { items: [] };
|
|
2207
|
+
})
|
|
2208
|
+
]).then(function(r) {
|
|
2209
|
+
listS[1]({ loading: false, rows: r[0] && r[0].items || [], error: "" });
|
|
2210
|
+
setsS[1](r[1] && r[1].items || []);
|
|
2211
|
+
}).catch(function(e) {
|
|
2212
|
+
listS[1]({ loading: false, rows: [], error: C.errText(e) });
|
|
2213
|
+
});
|
|
2214
|
+
}
|
|
2215
|
+
React.useEffect(function() {
|
|
2216
|
+
load();
|
|
2217
|
+
}, []);
|
|
2218
|
+
function openCreate() {
|
|
2219
|
+
createS[1]({ name: "", description: "", setIds: [], error: "", busy: false });
|
|
2220
|
+
}
|
|
2221
|
+
function closeCreate() {
|
|
2222
|
+
if (createS[0] && createS[0].busy) return;
|
|
2223
|
+
createS[1](null);
|
|
2224
|
+
}
|
|
2225
|
+
function patchCreate(patch) {
|
|
2226
|
+
createS[1](function(old) {
|
|
2227
|
+
return old ? Object.assign({}, old, patch) : old;
|
|
2228
|
+
});
|
|
2229
|
+
}
|
|
2230
|
+
function toggleCreateSet(id) {
|
|
2231
|
+
var cur = createS[0] && createS[0].setIds || [];
|
|
2232
|
+
var next = cur.indexOf(id) >= 0 ? cur.filter(function(x) {
|
|
2233
|
+
return x !== id;
|
|
2234
|
+
}) : cur.concat([id]);
|
|
2235
|
+
patchCreate({ setIds: next });
|
|
2236
|
+
}
|
|
2237
|
+
var PICK_PAGE = 20;
|
|
2238
|
+
var pickOpen = Boolean(createS[0]);
|
|
2239
|
+
var pickQ = pickS[0].q;
|
|
2240
|
+
React.useEffect(function() {
|
|
2241
|
+
if (!pickOpen) return void 0;
|
|
2242
|
+
var alive = true;
|
|
2243
|
+
var timer = setTimeout(function() {
|
|
2244
|
+
pickS[1](function(old) {
|
|
2245
|
+
return Object.assign({}, old, { loading: true });
|
|
2246
|
+
});
|
|
2247
|
+
C.call(api, "vault.setList", pickQ ? { q: pickQ } : {}).then(function(r) {
|
|
2248
|
+
if (!alive) return;
|
|
2249
|
+
pickS[1]({ q: pickQ, rows: r && r.items || [], page: 1, loading: false });
|
|
2250
|
+
}).catch(function() {
|
|
2251
|
+
if (alive) pickS[1](function(old) {
|
|
2252
|
+
return Object.assign({}, old, { loading: false });
|
|
2253
|
+
});
|
|
2254
|
+
});
|
|
2255
|
+
}, pickQ ? 200 : 0);
|
|
2256
|
+
return function() {
|
|
2257
|
+
alive = false;
|
|
2258
|
+
clearTimeout(timer);
|
|
2259
|
+
};
|
|
2260
|
+
}, [pickOpen, pickQ]);
|
|
2261
|
+
function pickQuery(v) {
|
|
2262
|
+
pickS[1](function(old) {
|
|
2263
|
+
return Object.assign({}, old, { q: v, loading: true });
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2266
|
+
function pickMore() {
|
|
2267
|
+
pickS[1](function(old) {
|
|
2268
|
+
return old.page * PICK_PAGE >= old.rows.length ? old : Object.assign({}, old, { page: old.page + 1 });
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2271
|
+
function pickClear() {
|
|
2272
|
+
patchCreate({ setIds: [] });
|
|
2273
|
+
pickS[1](function(old) {
|
|
2274
|
+
return Object.assign({}, old, { q: "", page: 1 });
|
|
2275
|
+
});
|
|
2276
|
+
}
|
|
2277
|
+
function create() {
|
|
2278
|
+
var c = createS[0];
|
|
2279
|
+
if (!c) return;
|
|
2280
|
+
if (!c.name.trim()) return patchCreate({ error: "\u5206\u7EC4\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A" });
|
|
2281
|
+
patchCreate({ busy: true, error: "" });
|
|
2282
|
+
C.call(api, "vault.groupCreate", { name: c.name.trim(), description: c.description.trim() }).then(function(r) {
|
|
2283
|
+
var groupId = r && r.id;
|
|
2284
|
+
var picks = c.setIds || [];
|
|
2285
|
+
return Promise.all(picks.map(function(setId) {
|
|
2286
|
+
return C.call(api, "vault.groupAttachSet", { groupId, setId }).then(
|
|
2287
|
+
function() {
|
|
2288
|
+
return true;
|
|
2289
|
+
},
|
|
2290
|
+
function() {
|
|
2291
|
+
return false;
|
|
2292
|
+
}
|
|
2293
|
+
);
|
|
2294
|
+
})).then(function(results) {
|
|
2295
|
+
var failed = results.filter(function(ok) {
|
|
2296
|
+
return !ok;
|
|
2297
|
+
}).length;
|
|
2298
|
+
createS[1](null);
|
|
2299
|
+
msgS[1](failed ? "\u5206\u7EC4\u5DF2\u521B\u5EFA\uFF0C" + failed + " \u4E2A\u96C6\u5408\u6302\u8F7D\u5931\u8D25\uFF0C\u53EF\u5728\u300C\u67E5\u770B\u5173\u8054\u300D\u91CC\u8865\u6302" : "");
|
|
2300
|
+
load();
|
|
2301
|
+
});
|
|
2302
|
+
}).catch(function(e) {
|
|
2303
|
+
patchCreate({ busy: false, error: C.errText(e) });
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
var createOpen = Boolean(createS[0]);
|
|
2307
|
+
React.useEffect(function() {
|
|
2308
|
+
if (!createOpen) return void 0;
|
|
2309
|
+
function onKey(e) {
|
|
2310
|
+
if (e.key === "Escape") closeCreate();
|
|
2311
|
+
}
|
|
2312
|
+
window.addEventListener("keydown", onKey);
|
|
2313
|
+
return function() {
|
|
2314
|
+
window.removeEventListener("keydown", onKey);
|
|
2315
|
+
};
|
|
2316
|
+
}, [createOpen]);
|
|
2317
|
+
function remove(row) {
|
|
2318
|
+
delS[1]({ row, moveTo: "" });
|
|
2319
|
+
}
|
|
2320
|
+
function confirmRemove() {
|
|
2321
|
+
var d = delS[0];
|
|
2322
|
+
if (!d) return;
|
|
2323
|
+
busyS[1](true);
|
|
2324
|
+
msgS[1]("");
|
|
2325
|
+
C.call(api, "vault.groupDelete", { id: d.row.id, moveTo: d.moveTo || void 0 }).then(function() {
|
|
2326
|
+
busyS[1](false);
|
|
2327
|
+
delS[1](null);
|
|
2328
|
+
if (openS[0] && openS[0].group.id === d.row.id) openS[1](null);
|
|
2329
|
+
load();
|
|
2330
|
+
}).catch(function(e) {
|
|
2331
|
+
busyS[1](false);
|
|
2332
|
+
msgS[1](C.errText(e));
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
function open(row) {
|
|
2336
|
+
openS[1]({ group: row, items: [], loading: true, error: "" });
|
|
2337
|
+
C.call(api, "vault.subjectsOf", { groupId: row.id }).then(function(r) {
|
|
2338
|
+
openS[1]({ group: row, items: r && r.items || [], loading: false, error: "" });
|
|
2339
|
+
}).catch(function(e) {
|
|
2340
|
+
openS[1]({ group: row, items: [], loading: false, error: C.errText(e) });
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
function setsOfGroup(row) {
|
|
2344
|
+
return setsS[0].filter(function(set) {
|
|
2345
|
+
return (set.groupIds || []).indexOf(row.id) >= 0;
|
|
2346
|
+
});
|
|
2347
|
+
}
|
|
2348
|
+
function toggleSet(row, set) {
|
|
2349
|
+
var linked = (set.groupIds || []).indexOf(row.id) >= 0;
|
|
2350
|
+
busyS[1](true);
|
|
2351
|
+
msgS[1]("");
|
|
2352
|
+
var call = linked ? C.call(api, "vault.groupDetachSet", { groupId: row.id, setId: set.id }) : C.call(api, "vault.groupAttachSet", { groupId: row.id, setId: set.id });
|
|
2353
|
+
call.then(function() {
|
|
2354
|
+
busyS[1](false);
|
|
2355
|
+
setsS[1](function(old) {
|
|
2356
|
+
return old.map(function(item) {
|
|
2357
|
+
if (item.id !== set.id) return item;
|
|
2358
|
+
var ids = (item.groupIds || []).slice();
|
|
2359
|
+
var i = ids.indexOf(row.id);
|
|
2360
|
+
if (linked && i >= 0) ids.splice(i, 1);
|
|
2361
|
+
if (!linked && i < 0) ids.push(row.id);
|
|
2362
|
+
return Object.assign({}, item, { groupIds: ids });
|
|
2363
|
+
});
|
|
2364
|
+
});
|
|
2365
|
+
load();
|
|
2366
|
+
}).catch(function(e) {
|
|
2367
|
+
busyS[1](false);
|
|
2368
|
+
msgS[1](C.errText(e));
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2371
|
+
return h(
|
|
2372
|
+
"div",
|
|
2373
|
+
{ className: "wbv" },
|
|
2374
|
+
h(
|
|
2375
|
+
"div",
|
|
2376
|
+
{ className: "wbv-row" },
|
|
2377
|
+
h("h2", { className: "wbv-grow" }, "\u5206\u7EC4\u4E0E\u5173\u8054"),
|
|
2378
|
+
h(C.Btn, { h, onClick: load }, "\u5237\u65B0"),
|
|
2379
|
+
h(C.Btn, { h, kind: "primary", onClick: openCreate }, "\u65B0\u5EFA\u5206\u7EC4")
|
|
2380
|
+
),
|
|
2381
|
+
h(
|
|
2382
|
+
"p",
|
|
2383
|
+
{ className: "wbv-muted" },
|
|
2384
|
+
"\u4E1A\u52A1\u6A21\u5757\uFF08\u7AD9\u70B9\u3001\u8FDE\u63A5\u5668\u7B49\uFF09\u628A\u81EA\u5DF1\u7684\u5BF9\u8C61\u5173\u8054\u5230\u5206\u7EC4\uFF0C\u518D\u6309\u7EC4\u53D6\u7528\u7EC4\u5185\u51ED\u636E\uFF1B\u5173\u8054\u5F15\u7528\u4FDD\u5B58\u5728\u4FDD\u9669\u7BB1\uFF0C\u4E0D\u8981\u6C42\u6A21\u5757\u4F9D\u8D56 sites\u3002"
|
|
2385
|
+
),
|
|
2386
|
+
h(C.Notice, { h, kind: "error", text: listS[0].error || msgS[0] }),
|
|
2387
|
+
listS[0].loading ? h(C.Empty, { h, text: "\u8BFB\u53D6\u5206\u7EC4\u2026" }) : listS[0].rows.length === 0 ? h(
|
|
2388
|
+
"div",
|
|
2389
|
+
{ className: "wbv-empty-card" },
|
|
2390
|
+
h("div", { className: "wbv-empty-title" }, "\u8FD8\u6CA1\u6709\u5206\u7EC4"),
|
|
2391
|
+
h("div", { className: "wbv-muted" }, "\u5EFA\u4E00\u4E2A\u7EC4\uFF0C\u628A\u96C6\u5408\u6302\u8FDB\u6765\uFF0C\u518D\u628A\u6A21\u5757\u5BF9\u8C61\u5173\u8054\u5230\u7EC4\u3002"),
|
|
2392
|
+
h("div", { className: "wbv-row" }, h(C.Btn, { h, kind: "primary", onClick: openCreate }, "\u65B0\u5EFA\u5206\u7EC4"))
|
|
2393
|
+
) : h(
|
|
2394
|
+
"table",
|
|
2395
|
+
{ className: "wbv-table" },
|
|
2396
|
+
h("thead", null, h("tr", null, ["\u5206\u7EC4", "\u63CF\u8FF0", "\u96C6\u5408", "\u51ED\u636E", "\u5173\u8054\u5BF9\u8C61", "\u64CD\u4F5C"].map(function(x) {
|
|
2397
|
+
return h("th", { key: x }, x);
|
|
2398
|
+
}))),
|
|
2399
|
+
h("tbody", null, listS[0].rows.map(function(row) {
|
|
2400
|
+
return h(
|
|
2401
|
+
"tr",
|
|
2402
|
+
{ key: row.id },
|
|
2403
|
+
h("td", null, h("strong", null, row.name), h("div", { className: "wbv-muted" }, row.id)),
|
|
2404
|
+
h("td", null, row.description || "\u2014"),
|
|
2405
|
+
h("td", null, setsOfGroup(row).length ? h("div", { className: "wbv-chips" }, setsOfGroup(row).map(function(set) {
|
|
2406
|
+
return h("span", { key: set.id, className: "wbv-chip" }, set.name);
|
|
2407
|
+
})) : h("span", { className: "wbv-muted" }, "\u672A\u6302\u96C6\u5408")),
|
|
2408
|
+
h("td", null, row.secretCount || 0),
|
|
2409
|
+
h("td", null, row.bindingCount || 0),
|
|
2410
|
+
h("td", null, h(
|
|
2411
|
+
"div",
|
|
2412
|
+
{ className: "wbv-inline" },
|
|
2413
|
+
h(C.Btn, { h, kind: "ghost", onClick: function() {
|
|
2414
|
+
open(row);
|
|
2415
|
+
} }, "\u67E5\u770B\u5173\u8054"),
|
|
2416
|
+
h(C.Btn, { h, kind: "ghost", onClick: function() {
|
|
2417
|
+
remove(row);
|
|
2418
|
+
} }, "\u5220\u9664")
|
|
2419
|
+
))
|
|
2420
|
+
);
|
|
2421
|
+
}))
|
|
2422
|
+
),
|
|
2423
|
+
createS[0] ? h(
|
|
2424
|
+
"div",
|
|
2425
|
+
{ className: "wbv-modal", onClick: closeCreate },
|
|
2426
|
+
h(
|
|
2427
|
+
"div",
|
|
2428
|
+
{ className: "wbv-modal-box", onClick: function(e) {
|
|
2429
|
+
e.stopPropagation();
|
|
2430
|
+
} },
|
|
2431
|
+
h("h3", null, "\u65B0\u5EFA\u5206\u7EC4"),
|
|
2432
|
+
h(
|
|
2433
|
+
C.Field,
|
|
2434
|
+
{ h, label: "\u5206\u7EC4\u540D\u79F0" },
|
|
2435
|
+
h("input", {
|
|
2436
|
+
value: createS[0].name,
|
|
2437
|
+
placeholder: "\u5982 \u5C11\u6570\u6D3E / \u5DE5\u4F5C\u90AE\u7BB1",
|
|
2438
|
+
disabled: createS[0].busy,
|
|
2439
|
+
autoFocus: true,
|
|
2440
|
+
onChange: function(e) {
|
|
2441
|
+
patchCreate({ name: e.target.value });
|
|
2442
|
+
}
|
|
2443
|
+
})
|
|
2444
|
+
),
|
|
2445
|
+
h(
|
|
2446
|
+
C.Field,
|
|
2447
|
+
{ h, label: "\u63CF\u8FF0" },
|
|
2448
|
+
h("input", {
|
|
2449
|
+
value: createS[0].description,
|
|
2450
|
+
placeholder: "\u53EF\u9009",
|
|
2451
|
+
disabled: createS[0].busy,
|
|
2452
|
+
onChange: function(e) {
|
|
2453
|
+
patchCreate({ description: e.target.value });
|
|
2454
|
+
}
|
|
2455
|
+
})
|
|
2456
|
+
),
|
|
2457
|
+
h(
|
|
2458
|
+
C.Field,
|
|
2459
|
+
{ h, label: "\u96C6\u5408\uFF08\u53EF\u591A\u9009\uFF09", hint: "\u52FE\u9009\u7684\u96C6\u5408\u4F1A\u4E00\u5E76\u6302\u5230\u8FD9\u4E2A\u5206\u7EC4" },
|
|
2460
|
+
h(FilterChecklist, {
|
|
2461
|
+
items: pickS[0].rows.slice(0, pickS[0].page * PICK_PAGE).map(function(set) {
|
|
2462
|
+
return { id: set.id, name: set.name, meta: (set.secretCount || 0) + " \u6761" };
|
|
2463
|
+
}),
|
|
2464
|
+
selected: createS[0].setIds || [],
|
|
2465
|
+
onToggle: toggleCreateSet,
|
|
2466
|
+
query: pickS[0].q,
|
|
2467
|
+
onQuery: pickQuery,
|
|
2468
|
+
title: "\u5168\u90E8\u96C6\u5408",
|
|
2469
|
+
total: pickS[0].rows.length,
|
|
2470
|
+
selectedText: "\u5DF2\u9009",
|
|
2471
|
+
clearText: "\u6E05\u7A7A",
|
|
2472
|
+
onClear: pickClear,
|
|
2473
|
+
searchPlaceholder: "\u641C\u7D22\u96C6\u5408\u540D\u79F0\u6216\u63CF\u8FF0",
|
|
2474
|
+
loading: pickS[0].loading,
|
|
2475
|
+
hasMore: pickS[0].page * PICK_PAGE < pickS[0].rows.length,
|
|
2476
|
+
onLoadMore: pickMore,
|
|
2477
|
+
emptyText: "\u8FD8\u6CA1\u6709\u96C6\u5408\uFF0C\u53EF\u5148\u5EFA\u7EC4\uFF0C\u518D\u5230\u300C\u96C6\u5408\u300D\u9875\u65B0\u5EFA",
|
|
2478
|
+
noMatchText: "\u6CA1\u6709\u5339\u914D\u7684\u96C6\u5408",
|
|
2479
|
+
noMoreText: pickS[0].rows.length > PICK_PAGE ? "\u6CA1\u6709\u66F4\u591A" : "",
|
|
2480
|
+
loadingText: "\u52A0\u8F7D\u4E2D\u2026",
|
|
2481
|
+
disabled: createS[0].busy,
|
|
2482
|
+
autoFocus: false
|
|
2483
|
+
})
|
|
2484
|
+
),
|
|
2485
|
+
h(C.Notice, { h, kind: "error", text: createS[0].error }),
|
|
2486
|
+
h(
|
|
2487
|
+
"div",
|
|
2488
|
+
{ className: "wbv-row", style: { justifyContent: "flex-end" } },
|
|
2489
|
+
h(C.Btn, { h, disabled: createS[0].busy, onClick: closeCreate }, "\u53D6\u6D88"),
|
|
2490
|
+
h(C.Btn, { h, kind: "primary", disabled: createS[0].busy, onClick: create }, createS[0].busy ? "\u521B\u5EFA\u4E2D\u2026" : "\u521B\u5EFA")
|
|
2491
|
+
)
|
|
2492
|
+
)
|
|
2493
|
+
) : null,
|
|
2494
|
+
delS[0] ? h(
|
|
2495
|
+
"div",
|
|
2496
|
+
{ className: "wbv-modal", onClick: function() {
|
|
2497
|
+
if (!busyS[0]) delS[1](null);
|
|
2498
|
+
} },
|
|
2499
|
+
h(
|
|
2500
|
+
"div",
|
|
2501
|
+
{ className: "wbv-modal-box", onClick: function(e) {
|
|
2502
|
+
e.stopPropagation();
|
|
2503
|
+
} },
|
|
2504
|
+
h("h3", null, "\u5220\u9664\u5206\u7EC4\u300C" + delS[0].row.name + "\u300D\uFF1F"),
|
|
2505
|
+
h("p", { className: "wbv-sub" }, "\u53EA\u5220\u9664\u5206\u7EC4\u4E0E\u96C6\u5408\u3001\u5173\u8054\u5BF9\u8C61\u7684\u7ED1\u5B9A\uFF0C\u51ED\u636E\u4E0E\u96C6\u5408\u672C\u8EAB\u90FD\u4FDD\u7559\u3002"),
|
|
2506
|
+
h(
|
|
2507
|
+
C.Field,
|
|
2508
|
+
{ h, label: "\u7EC4\u5185\u96C6\u5408\u6539\u6302\u5230", hint: "\u7559\u7A7A\u8868\u793A\u4ECE\u6240\u6709\u5206\u7EC4\u79FB\u51FA\uFF08\u96C6\u5408\u4E0E\u51ED\u636E\u4E0D\u5220\uFF09" },
|
|
2509
|
+
h(
|
|
2510
|
+
"select",
|
|
2511
|
+
{ value: delS[0].moveTo, disabled: busyS[0], onChange: function(e) {
|
|
2512
|
+
delS[1]({ row: delS[0].row, moveTo: e.target.value });
|
|
2513
|
+
} },
|
|
2514
|
+
h("option", { value: "" }, "\u4E0D\u8F6C\u79FB\uFF08\u79FB\u51FA\u5206\u7EC4\uFF09"),
|
|
2515
|
+
listS[0].rows.filter(function(g) {
|
|
2516
|
+
return g.id !== delS[0].row.id;
|
|
2517
|
+
}).map(function(g) {
|
|
2518
|
+
return h("option", { key: g.id, value: g.id }, g.name);
|
|
2519
|
+
})
|
|
2520
|
+
)
|
|
2521
|
+
),
|
|
2522
|
+
h(
|
|
2523
|
+
"div",
|
|
2524
|
+
{ className: "wbv-row", style: { justifyContent: "flex-end" } },
|
|
2525
|
+
h(C.Btn, { h, disabled: busyS[0], onClick: function() {
|
|
2526
|
+
delS[1](null);
|
|
2527
|
+
} }, "\u53D6\u6D88"),
|
|
2528
|
+
h(C.Btn, { h, kind: "danger", disabled: busyS[0], onClick: confirmRemove }, busyS[0] ? "\u5220\u9664\u4E2D\u2026" : "\u786E\u8BA4\u5220\u9664")
|
|
2529
|
+
)
|
|
2530
|
+
)
|
|
2531
|
+
) : null,
|
|
2532
|
+
openS[0] ? h(
|
|
2533
|
+
"div",
|
|
2534
|
+
{ className: "wbv-modal", onClick: function() {
|
|
2535
|
+
openS[1](null);
|
|
2536
|
+
} },
|
|
2537
|
+
h(
|
|
2538
|
+
"div",
|
|
2539
|
+
{ className: "wbv-modal-box", onClick: function(e) {
|
|
2540
|
+
e.stopPropagation();
|
|
2541
|
+
} },
|
|
2542
|
+
h("h3", null, "\u300C" + openS[0].group.name + "\u300D\u7684\u5173\u8054\u5BF9\u8C61"),
|
|
2543
|
+
h("div", { className: "wbv-sub" }, "\u6302\u8F7D\u96C6\u5408\uFF08\u52FE\u9009\u5373\u6302\u8F7D\uFF0C\u53D6\u6D88\u5373\u6458\u9664\uFF0C\u53EA\u6539\u5173\u8054\u4E0D\u52A8\u51ED\u636E\uFF09"),
|
|
2544
|
+
h("div", { className: "wbv-check-list" }, setsS[0].length ? setsS[0].map(function(set) {
|
|
2545
|
+
var on = (set.groupIds || []).indexOf(openS[0].group.id) >= 0;
|
|
2546
|
+
return h(
|
|
2547
|
+
"label",
|
|
2548
|
+
{ key: set.id, className: "wbv-check" },
|
|
2549
|
+
h("input", { type: "checkbox", checked: on, disabled: busyS[0], onChange: function() {
|
|
2550
|
+
toggleSet(openS[0].group, set);
|
|
2551
|
+
} }),
|
|
2552
|
+
h("span", { className: "wbv-dot", style: { background: set.color || "var(--wb-accent)" } }),
|
|
2553
|
+
h("span", null, set.name),
|
|
2554
|
+
h("span", { className: "wbv-muted" }, " \xB7 " + (set.secretCount || 0) + " \u6761")
|
|
2555
|
+
);
|
|
2556
|
+
}) : h("span", { className: "wbv-muted" }, "\u8FD8\u6CA1\u6709\u96C6\u5408")),
|
|
2557
|
+
openS[0].loading ? h(C.Empty, { h, text: "\u8BFB\u53D6\u4E2D\u2026" }) : openS[0].error ? h(C.Notice, { h, kind: "error", text: openS[0].error }) : openS[0].items.length === 0 ? h(C.Empty, { h, text: "\u8FD8\u6CA1\u6709\u6A21\u5757\u5173\u8054\u5230\u8FD9\u4E2A\u5206\u7EC4\u3002" }) : h(
|
|
2558
|
+
"table",
|
|
2559
|
+
{ className: "wbv-table" },
|
|
2560
|
+
h("thead", null, h("tr", null, ["\u7C7B\u578B", "\u5BF9\u8C61 id", "\u6807\u9898"].map(function(x) {
|
|
2561
|
+
return h("th", { key: x }, x);
|
|
2562
|
+
}))),
|
|
2563
|
+
h("tbody", null, openS[0].items.map(function(item, i) {
|
|
2564
|
+
return h(
|
|
2565
|
+
"tr",
|
|
2566
|
+
{ key: i },
|
|
2567
|
+
h("td", null, item.subjectType),
|
|
2568
|
+
h("td", null, item.subjectId),
|
|
2569
|
+
h("td", null, item.title || "\u2014")
|
|
2570
|
+
);
|
|
2571
|
+
}))
|
|
2572
|
+
),
|
|
2573
|
+
h(
|
|
2574
|
+
"div",
|
|
2575
|
+
{ className: "wbv-row" },
|
|
2576
|
+
h("span", { className: "wbv-muted wbv-grow" }, "\u5173\u8054\u7531\u4E1A\u52A1\u6A21\u5757\u901A\u8FC7 vault.bind \u6CE8\u518C\uFF1B\u8FD9\u91CC\u53EA\u8BFB\u3002"),
|
|
2577
|
+
h(C.Btn, { h, onClick: function() {
|
|
2578
|
+
openS[1](null);
|
|
2579
|
+
} }, "\u5173\u95ED")
|
|
2580
|
+
)
|
|
2581
|
+
)
|
|
2582
|
+
) : null
|
|
2583
|
+
);
|
|
2584
|
+
};
|
|
2585
|
+
}
|
|
2586
|
+
});
|
|
2587
|
+
|
|
2588
|
+
// packages/addons/vault/client/views/config.cjs
|
|
2589
|
+
var require_config = __commonJS({
|
|
2590
|
+
"packages/addons/vault/client/views/config.cjs"(exports2, module2) {
|
|
2591
|
+
"use strict";
|
|
2592
|
+
var C = require_common();
|
|
2593
|
+
var AskPassphrase = require_ask_passphrase();
|
|
2594
|
+
var MODES = [
|
|
2595
|
+
{ id: "A", title: "A \u5168\u9501\uFF08\u63A8\u8350\uFF09", desc: "\u6BCF\u6B21 DSH \u542F\u52A8\u540E\u9700\u8981\u8F93\u5165\u4E3B\u53E3\u4EE4\uFF1B\u660E\u6587\u53EA\u5728\u5F53\u524D\u8FDB\u7A0B\u5185\u5B58\u3002" },
|
|
2596
|
+
{ id: "B", title: "B \u81EA\u52A8\u89E3\u9501\uFF0C\u67E5\u770B\u9700\u53E3\u4EE4", desc: "\u542F\u52A8\u65F6\u7528\u672C\u673A device key \u81EA\u52A8\u89E3\u9501\uFF1B\u6BCF\u6B21\u67E5\u770B/\u7F16\u8F91\u51ED\u636E\u518D\u8F93\u4E3B\u53E3\u4EE4\u3002" },
|
|
2597
|
+
{ id: "C", title: "C \u81EA\u52A8\u89E3\u9501\uFF0C\u67E5\u770B\u514D\u53E3\u4EE4", desc: "\u542F\u52A8\u81EA\u52A8\u89E3\u9501\uFF0C\u754C\u9762\u4E0A\u53EF\u76F4\u63A5\u67E5\u770B\u660E\u6587\uFF1B\u9002\u5408\u5355\u4EBA\u53D7\u63A7\u673A\u5668\u3002" }
|
|
2598
|
+
];
|
|
2599
|
+
module2.exports = function ConfigView(props) {
|
|
2600
|
+
var h = props.h;
|
|
2601
|
+
var api = props.api;
|
|
2602
|
+
var React = props.React;
|
|
2603
|
+
var st = React.useState(null);
|
|
2604
|
+
var mode = React.useState("A");
|
|
2605
|
+
var oldPass = React.useState("");
|
|
2606
|
+
var newPass = React.useState("");
|
|
2607
|
+
var msg = React.useState("");
|
|
2608
|
+
var busy = React.useState(false);
|
|
2609
|
+
var tick = React.useState(0);
|
|
2610
|
+
var askS = React.useState(null);
|
|
2611
|
+
React.useEffect(function() {
|
|
2612
|
+
C.call(api, "vault.status").then(function(s) {
|
|
2613
|
+
st[1](s);
|
|
2614
|
+
if (s && s.unlockMode) mode[1](s.unlockMode);
|
|
2615
|
+
}).catch(function(e) {
|
|
2616
|
+
msg[1](C.errText(e));
|
|
2617
|
+
});
|
|
2618
|
+
}, [tick[0]]);
|
|
2619
|
+
function run(p) {
|
|
2620
|
+
busy[1](true);
|
|
2621
|
+
msg[1]("");
|
|
2622
|
+
p.then(function() {
|
|
2623
|
+
busy[1](false);
|
|
2624
|
+
tick[1](tick[0] + 1);
|
|
2625
|
+
}).catch(function(e) {
|
|
2626
|
+
busy[1](false);
|
|
2627
|
+
msg[1](C.errText(e));
|
|
2628
|
+
});
|
|
2629
|
+
}
|
|
2630
|
+
function applyMode() {
|
|
2631
|
+
var target = mode[0];
|
|
2632
|
+
if (target === "B" || target === "C") {
|
|
2633
|
+
if (!st[0] || st[0].locked) {
|
|
2634
|
+
askS[1]({ kind: "mode", value: "", busy: false, error: "" });
|
|
2635
|
+
return;
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
run(C.call(api, "vault.setUnlockMode", { mode: target }));
|
|
2639
|
+
}
|
|
2640
|
+
function confirmAsk() {
|
|
2641
|
+
var a = askS[0];
|
|
2642
|
+
if (!a || !a.value) return;
|
|
2643
|
+
askS[1](Object.assign({}, a, { busy: true, error: "" }));
|
|
2644
|
+
var p = a.kind === "mode" ? C.call(api, "vault.setUnlockMode", { mode: mode[0], passphrase: a.value }) : C.call(api, "vault.rotateDeviceKey", { passphrase: a.value });
|
|
2645
|
+
p.then(function() {
|
|
2646
|
+
askS[1](null);
|
|
2647
|
+
busy[1](false);
|
|
2648
|
+
tick[1](tick[0] + 1);
|
|
2649
|
+
}).catch(function(e) {
|
|
2650
|
+
askS[1](Object.assign({}, a, { busy: false, error: C.errText(e) }));
|
|
2651
|
+
});
|
|
2652
|
+
}
|
|
2653
|
+
function changePass() {
|
|
2654
|
+
if (newPass[0].length < 10) return msg[1]("\u65B0\u53E3\u4EE4\u81F3\u5C11 10 \u4E2A\u5B57\u7B26");
|
|
2655
|
+
run(C.call(api, "vault.changePassphrase", { oldPassphrase: oldPass[0], newPassphrase: newPass[0] }));
|
|
2656
|
+
oldPass[1]("");
|
|
2657
|
+
newPass[1]("");
|
|
2658
|
+
}
|
|
2659
|
+
function rotate() {
|
|
2660
|
+
askS[1]({ kind: "rotate", value: "", busy: false, error: "" });
|
|
2661
|
+
}
|
|
2662
|
+
var status = st[0];
|
|
2663
|
+
var modal = askS[0] ? h(AskPassphrase, {
|
|
2664
|
+
h,
|
|
2665
|
+
C,
|
|
2666
|
+
title: askS[0].kind === "mode" ? "\u5207\u6362\u5230 " + mode[0] + " \u6A21\u5F0F" : "\u8F6E\u6362 device key",
|
|
2667
|
+
hint: askS[0].kind === "mode" ? "\u5207\u6362\u89E3\u9501\u6A21\u5F0F\u9700\u8981\u9A8C\u8BC1\u4E3B\u53E3\u4EE4\u3002" : "\u65E7 device key \u6587\u4EF6\u4F1A\u88AB\u8986\u76D6\uFF0C\u4E4B\u540E\u7528\u65B0 key \u81EA\u52A8\u89E3\u9501\u3002",
|
|
2668
|
+
value: askS[0].value,
|
|
2669
|
+
busy: askS[0].busy,
|
|
2670
|
+
error: askS[0].error,
|
|
2671
|
+
onChange: function(v) {
|
|
2672
|
+
askS[1](Object.assign({}, askS[0], { value: v }));
|
|
2673
|
+
},
|
|
2674
|
+
onCancel: function() {
|
|
2675
|
+
if (!askS[0].busy) askS[1](null);
|
|
2676
|
+
},
|
|
2677
|
+
onConfirm: confirmAsk
|
|
2678
|
+
}) : null;
|
|
2679
|
+
return h(
|
|
2680
|
+
"div",
|
|
2681
|
+
{ className: "wbv" },
|
|
2682
|
+
h("h2", null, "\u4FDD\u9669\u7BB1\u8BBE\u7F6E"),
|
|
2683
|
+
h(C.Notice, { h, kind: "error", text: msg[0] }),
|
|
2684
|
+
h(
|
|
2685
|
+
"div",
|
|
2686
|
+
{ className: "wbv-card" },
|
|
2687
|
+
h("h3", null, "\u89E3\u9501\u6A21\u5F0F"),
|
|
2688
|
+
MODES.map(function(m) {
|
|
2689
|
+
return h(
|
|
2690
|
+
"label",
|
|
2691
|
+
{ key: m.id, className: "wbv-row", style: { padding: "6px 0", alignItems: "flex-start", cursor: "pointer" } },
|
|
2692
|
+
h("input", { type: "radio", name: "vault-mode", checked: mode[0] === m.id, onChange: function() {
|
|
2693
|
+
mode[1](m.id);
|
|
2694
|
+
} }),
|
|
2695
|
+
h("span", null, h("strong", null, m.title), h("br"), h("span", { className: "wbv-muted" }, m.desc))
|
|
2696
|
+
);
|
|
2697
|
+
}),
|
|
2698
|
+
h(
|
|
2699
|
+
"div",
|
|
2700
|
+
{ className: "wbv-row" },
|
|
2701
|
+
h("span", { className: "wbv-muted" }, status ? "\u5F53\u524D\uFF1A" + status.unlockMode + (status.locked ? "\uFF08\u5DF2\u9501\u5B9A\uFF09" : "\uFF08\u5DF2\u89E3\u9501\uFF09") : ""),
|
|
2702
|
+
h("span", { className: "wbv-grow" }),
|
|
2703
|
+
h(C.Btn, { h, kind: "primary", disabled: busy[0], onClick: applyMode }, busy[0] ? "\u5E94\u7528\u4E2D\u2026" : "\u5E94\u7528\u6A21\u5F0F")
|
|
2704
|
+
)
|
|
2705
|
+
),
|
|
2706
|
+
h(
|
|
2707
|
+
"div",
|
|
2708
|
+
{ className: "wbv-card" },
|
|
2709
|
+
h("h3", null, "\u4FEE\u6539\u4E3B\u53E3\u4EE4"),
|
|
2710
|
+
h("p", { className: "wbv-muted" }, "\u53EA\u91CD\u5305 DEK\uFF0C\u4E0D\u4F1A\u91CD\u65B0\u52A0\u5BC6\u6240\u6709\u51ED\u636E\uFF1Bdevice key \u4E0D\u53D7\u5F71\u54CD\u3002"),
|
|
2711
|
+
h(
|
|
2712
|
+
"div",
|
|
2713
|
+
{ className: "wbv-row" },
|
|
2714
|
+
h(C.Field, { h, label: "\u5F53\u524D\u53E3\u4EE4" }, h("input", { type: "password", value: oldPass[0], onChange: function(e) {
|
|
2715
|
+
oldPass[1](e.target.value);
|
|
2716
|
+
} })),
|
|
2717
|
+
h(C.Field, { h, label: "\u65B0\u53E3\u4EE4\uFF08\u81F3\u5C11 10 \u4F4D\uFF09" }, h("input", { type: "password", value: newPass[0], onChange: function(e) {
|
|
2718
|
+
newPass[1](e.target.value);
|
|
2719
|
+
} }))
|
|
2720
|
+
),
|
|
2721
|
+
h(C.Btn, { h, disabled: busy[0], onClick: changePass }, "\u4FEE\u6539\u53E3\u4EE4")
|
|
2722
|
+
),
|
|
2723
|
+
h(
|
|
2724
|
+
"div",
|
|
2725
|
+
{ className: "wbv-card" },
|
|
2726
|
+
h("h3", null, "Device key"),
|
|
2727
|
+
h("p", { className: "wbv-muted" }, "B/C \u6A21\u5F0F\u7528\u6765\u5728\u542F\u52A8\u65F6\u81EA\u52A8\u89E3\u9501\u3002key \u6587\u4EF6\u4F4D\u4E8E $WB_HOME/vault-device.key\uFF0C\u6743\u9650 0600\uFF1B\u5220\u9664\u5B83\u7B49\u540C\u56DE\u5230\u9501\u5B9A\u72B6\u6001\u3002"),
|
|
2728
|
+
h(C.Btn, { h, disabled: busy[0] || !status || status.unlockMode === "A", onClick: rotate }, "\u8F6E\u6362 device key")
|
|
2729
|
+
),
|
|
2730
|
+
modal
|
|
2731
|
+
);
|
|
2732
|
+
};
|
|
2733
|
+
}
|
|
2734
|
+
});
|
|
2735
|
+
|
|
2736
|
+
// packages/addons/lib/legacy-data.cjs
|
|
2737
|
+
var require_legacy_data = __commonJS({
|
|
2738
|
+
"packages/addons/lib/legacy-data.cjs"(exports2, module2) {
|
|
2739
|
+
"use strict";
|
|
2740
|
+
function unwrap(r) {
|
|
2741
|
+
return r && r.result !== void 0 ? r.result : r;
|
|
2742
|
+
}
|
|
2743
|
+
function rowsOf(body) {
|
|
2744
|
+
if (!body) return [];
|
|
2745
|
+
if (Array.isArray(body)) return body;
|
|
2746
|
+
if (Array.isArray(body.rows)) return body.rows;
|
|
2747
|
+
if (Array.isArray(body.items)) return body.items;
|
|
2748
|
+
return [];
|
|
2749
|
+
}
|
|
2750
|
+
function textOf(value) {
|
|
2751
|
+
if (value === null || value === void 0) return "";
|
|
2752
|
+
return typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
2753
|
+
}
|
|
2754
|
+
function columnsOf(rows) {
|
|
2755
|
+
if (!rows.length) return [];
|
|
2756
|
+
return Object.keys(rows[0]).map(function(name) {
|
|
2757
|
+
return { name, type: "TEXT", system: false };
|
|
2758
|
+
});
|
|
2759
|
+
}
|
|
2760
|
+
function tableNames(body) {
|
|
2761
|
+
var list = body && Array.isArray(body.tables) ? body.tables : [];
|
|
2762
|
+
return list.map(function(t) {
|
|
2763
|
+
if (typeof t === "string") return { name: t };
|
|
2764
|
+
return { name: t.name, count: t.count, columns: t.columns };
|
|
2765
|
+
}).filter(function(t) {
|
|
2766
|
+
return t.name;
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2769
|
+
function compare(a, b) {
|
|
2770
|
+
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
2771
|
+
var sa = textOf(a), sb = textOf(b);
|
|
2772
|
+
var na = Number(sa), nb = Number(sb);
|
|
2773
|
+
if (sa !== "" && sb !== "" && Number.isFinite(na) && Number.isFinite(nb)) return na - nb;
|
|
2774
|
+
return sa.localeCompare(sb, "zh-CN");
|
|
2775
|
+
}
|
|
2776
|
+
module2.exports = function createLegacyData(domain, options) {
|
|
2777
|
+
options = options || {};
|
|
2778
|
+
var paged = options.paged !== false;
|
|
2779
|
+
var maxRows = Math.max(1, Number(options.maxRows) || 2e3);
|
|
2780
|
+
var pageLimit = Math.min(200, maxRows);
|
|
2781
|
+
function tablesLoader(api) {
|
|
2782
|
+
return api.call(domain + ".dataTables").then(function(r) {
|
|
2783
|
+
if (r && r.ok === false) throw new Error(r.error || "dataTables failed");
|
|
2784
|
+
var body = unwrap(r);
|
|
2785
|
+
return { tables: tableNames(body) };
|
|
2786
|
+
});
|
|
2787
|
+
}
|
|
2788
|
+
function fetchAll(api, table) {
|
|
2789
|
+
var rows = [];
|
|
2790
|
+
var offset = 0;
|
|
2791
|
+
function next() {
|
|
2792
|
+
var args = { table, limit: pageLimit };
|
|
2793
|
+
if (paged) args.offset = offset;
|
|
2794
|
+
return api.call(domain + ".dataQuery", args).then(function(r) {
|
|
2795
|
+
if (r && r.ok === false) throw new Error(r.error || "dataQuery failed");
|
|
2796
|
+
var batch = rowsOf(unwrap(r));
|
|
2797
|
+
rows = rows.concat(batch);
|
|
2798
|
+
if (!paged || batch.length < pageLimit || rows.length >= maxRows) return rows.slice(0, maxRows);
|
|
2799
|
+
offset += batch.length;
|
|
2800
|
+
return next();
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2803
|
+
return next();
|
|
2804
|
+
}
|
|
2805
|
+
function query(api, args) {
|
|
2806
|
+
return fetchAll(api, args.table).then(function(all) {
|
|
2807
|
+
var search = String(args.search || "").trim().toLowerCase();
|
|
2808
|
+
var filters = args.filters && typeof args.filters === "object" ? args.filters : {};
|
|
2809
|
+
var filterKeys = Object.keys(filters).slice(0, 20);
|
|
2810
|
+
var colNames = all.length ? Object.keys(all[0]) : [];
|
|
2811
|
+
var includeDeleted = args.includeDeleted === true;
|
|
2812
|
+
var rows = all.filter(function(row) {
|
|
2813
|
+
if (!includeDeleted && row.deleted_at) return false;
|
|
2814
|
+
if (search) {
|
|
2815
|
+
var hit = colNames.some(function(c) {
|
|
2816
|
+
return textOf(row[c]).toLowerCase().indexOf(search) >= 0;
|
|
2817
|
+
});
|
|
2818
|
+
if (!hit) return false;
|
|
2819
|
+
}
|
|
2820
|
+
return filterKeys.every(function(c) {
|
|
2821
|
+
return textOf(row[c]).toLowerCase().indexOf(textOf(filters[c]).toLowerCase()) >= 0;
|
|
2822
|
+
});
|
|
2823
|
+
});
|
|
2824
|
+
var sort = String(args.sort || "");
|
|
2825
|
+
var order = args.order === "asc" ? "asc" : "desc";
|
|
2826
|
+
if (sort && colNames.indexOf(sort) >= 0) {
|
|
2827
|
+
rows = rows.slice().sort(function(a, b) {
|
|
2828
|
+
var d = compare(a[sort], b[sort]);
|
|
2829
|
+
return order === "asc" ? d : -d;
|
|
2830
|
+
});
|
|
2831
|
+
}
|
|
2832
|
+
var pageSize = Math.max(1, Math.min(200, Number(args.pageSize) || 50));
|
|
2833
|
+
var total = rows.length;
|
|
2834
|
+
var pages = Math.max(1, Math.ceil(total / pageSize));
|
|
2835
|
+
var page = Math.max(1, Math.min(pages, Number(args.page) || 1));
|
|
2836
|
+
var start = (page - 1) * pageSize;
|
|
2837
|
+
var started = Date.now();
|
|
2838
|
+
return {
|
|
2839
|
+
table: args.table,
|
|
2840
|
+
columns: columnsOf(all),
|
|
2841
|
+
rows: rows.slice(start, start + pageSize),
|
|
2842
|
+
page,
|
|
2843
|
+
pageSize,
|
|
2844
|
+
pages,
|
|
2845
|
+
total,
|
|
2846
|
+
sort,
|
|
2847
|
+
order,
|
|
2848
|
+
search,
|
|
2849
|
+
filters,
|
|
2850
|
+
includeDeleted,
|
|
2851
|
+
queryMs: Math.max(0, Date.now() - started)
|
|
2852
|
+
};
|
|
2853
|
+
});
|
|
2854
|
+
}
|
|
2855
|
+
return { tablesLoader, query };
|
|
2856
|
+
};
|
|
2857
|
+
}
|
|
2858
|
+
});
|
|
2859
|
+
|
|
2860
|
+
// packages/addons/lib/data-copy.cjs
|
|
2861
|
+
var require_data_copy = __commonJS({
|
|
2862
|
+
"packages/addons/lib/data-copy.cjs"(exports2, module2) {
|
|
2863
|
+
"use strict";
|
|
2864
|
+
var COPY = {
|
|
2865
|
+
zh: {
|
|
2866
|
+
title: "\u6570\u636E",
|
|
2867
|
+
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",
|
|
2868
|
+
tables: "\u8868",
|
|
2869
|
+
rows: "\u884C",
|
|
2870
|
+
deleted: "\u5DF2\u5220\u9664",
|
|
2871
|
+
rowCount: "\u5171 {n} \u884C",
|
|
2872
|
+
deletedCount: "\u5176\u4E2D {n} \u884C\u5DF2\u5220\u9664",
|
|
2873
|
+
search: "\u641C\u7D22\u6240\u6709\u6587\u672C\u5217\u2026",
|
|
2874
|
+
pageSize: "\u6BCF\u9875",
|
|
2875
|
+
includeDeleted: "\u542B\u5DF2\u5220\u9664",
|
|
2876
|
+
showSystem: "\u7CFB\u7EDF\u5217",
|
|
2877
|
+
refresh: "\u5237\u65B0",
|
|
2878
|
+
loading: "\u8F7D\u5165\u4E2D\u2026",
|
|
2879
|
+
empty: "\u8FD9\u5F20\u8868\u8FD8\u6CA1\u6709\u6570\u636E",
|
|
2880
|
+
emptyTable: "\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u8868",
|
|
2881
|
+
loadFail: "\u6570\u636E\u670D\u52A1\u4E0D\u53EF\u7528\uFF08\u63D2\u4EF6\u7248\u672C\u8FC7\u65E7\uFF1F\uFF09",
|
|
2882
|
+
retry: "\u91CD\u8BD5",
|
|
2883
|
+
queryFail: "\u67E5\u8BE2\u5931\u8D25\uFF1A",
|
|
2884
|
+
noRows: "\u6CA1\u6709\u5339\u914D\u7684\u884C",
|
|
2885
|
+
prev: "\u4E0A\u4E00\u9875",
|
|
2886
|
+
next: "\u4E0B\u4E00\u9875",
|
|
2887
|
+
pageInfo: "\u7B2C {page} / {pages} \u9875",
|
|
2888
|
+
jump: "\u8DF3\u8F6C",
|
|
2889
|
+
total: "\u5171 {n} \u884C",
|
|
2890
|
+
copied: "\u5DF2\u590D\u5236",
|
|
2891
|
+
copy: "\u590D\u5236",
|
|
2892
|
+
close: "\u5173\u95ED",
|
|
2893
|
+
drawerTitle: "{column} \xB7 \u7B2C {row} \u884C",
|
|
2894
|
+
nullText: "NULL",
|
|
2895
|
+
emptyText: "\u7A7A",
|
|
2896
|
+
yes: "\u662F",
|
|
2897
|
+
no: "\u5426",
|
|
2898
|
+
json: "JSON",
|
|
2899
|
+
queryTime: "{n} ms",
|
|
2900
|
+
sortAsc: "\u5347\u5E8F",
|
|
2901
|
+
sortDesc: "\u964D\u5E8F",
|
|
2902
|
+
filterCol: "\u7B5B\u9009\u2026",
|
|
2903
|
+
filterClear: "\u6E05\u9664\u7B5B\u9009",
|
|
2904
|
+
index: "\u8868\u7D22\u5F15",
|
|
2905
|
+
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",
|
|
2906
|
+
idxName: "\u7D22\u5F15\u540D",
|
|
2907
|
+
idxColumns: "\u5217",
|
|
2908
|
+
idxType: "\u7C7B\u578B",
|
|
2909
|
+
idxSource: "\u6765\u6E90",
|
|
2910
|
+
idxUnique: "\u552F\u4E00",
|
|
2911
|
+
idxNormal: "\u666E\u901A",
|
|
2912
|
+
idxAuto: "\u81EA\u52A8",
|
|
2913
|
+
idxCreated: "\u663E\u5F0F\u521B\u5EFA",
|
|
2914
|
+
idxCount: "\u5171 {n} \u4E2A\u7D22\u5F15",
|
|
2915
|
+
idxNoExtra: "\u8BE5\u8868\u9664\u4E3B\u952E\u5916\u6CA1\u6709\u989D\u5916\u7D22\u5F15",
|
|
2916
|
+
idxRowsHelp: "\u6240\u5C5E\u8868\u603B\u884C\u6570\uFF08\u542B\u5DF2\u5220\u9664\u884C\uFF09\uFF0C\u4E0D\u662F\u7D22\u5F15\u6761\u76EE\u6570",
|
|
2917
|
+
idxTable: "\u8868",
|
|
2918
|
+
idxRows: "\u884C\u6570",
|
|
2919
|
+
idxCols: "\u5217\u6570",
|
|
2920
|
+
idxKey: "\u4E3B\u952E",
|
|
2921
|
+
idxIndexes: "\u7D22\u5F15",
|
|
2922
|
+
idxLastWrite: "\u6700\u8FD1\u5199\u5165",
|
|
2923
|
+
idxNone: "\u65E0",
|
|
2924
|
+
idxEmpty: "\u5F53\u524D\u8868\u6CA1\u6709\u53EF\u7528\u7684\u7D22\u5F15\u7EDF\u8BA1",
|
|
2925
|
+
idxTables: "\u8868",
|
|
2926
|
+
idxAt: "\u7EDF\u8BA1\u65F6\u95F4"
|
|
2927
|
+
},
|
|
2928
|
+
en: {
|
|
2929
|
+
title: "Data",
|
|
2930
|
+
subtitle: "Read-only view of this plugin's tables; system and deleted rows are hidden by default",
|
|
2931
|
+
tables: "Tables",
|
|
2932
|
+
rows: "rows",
|
|
2933
|
+
deleted: "deleted",
|
|
2934
|
+
rowCount: "{n} rows",
|
|
2935
|
+
deletedCount: "{n} deleted",
|
|
2936
|
+
search: "Search all text columns\u2026",
|
|
2937
|
+
pageSize: "Rows",
|
|
2938
|
+
includeDeleted: "Deleted",
|
|
2939
|
+
showSystem: "System",
|
|
2940
|
+
refresh: "Refresh",
|
|
2941
|
+
loading: "Loading\u2026",
|
|
2942
|
+
empty: "This table has no rows yet",
|
|
2943
|
+
emptyTable: "No tables to show",
|
|
2944
|
+
loadFail: "Data service unavailable (plugin too old?)",
|
|
2945
|
+
retry: "Retry",
|
|
2946
|
+
queryFail: "Query failed: ",
|
|
2947
|
+
noRows: "No matching rows",
|
|
2948
|
+
prev: "Previous",
|
|
2949
|
+
next: "Next",
|
|
2950
|
+
pageInfo: "Page {page} / {pages}",
|
|
2951
|
+
jump: "Jump",
|
|
2952
|
+
total: "{n} rows",
|
|
2953
|
+
copied: "Copied",
|
|
2954
|
+
copy: "Copy",
|
|
2955
|
+
close: "Close",
|
|
2956
|
+
drawerTitle: "{column} \xB7 row {row}",
|
|
2957
|
+
nullText: "NULL",
|
|
2958
|
+
emptyText: "empty",
|
|
2959
|
+
yes: "Yes",
|
|
2960
|
+
no: "No",
|
|
2961
|
+
json: "JSON",
|
|
2962
|
+
queryTime: "{n} ms",
|
|
2963
|
+
sortAsc: "ascending",
|
|
2964
|
+
sortDesc: "descending",
|
|
2965
|
+
filterCol: "Filter\u2026",
|
|
2966
|
+
filterClear: "Clear filter",
|
|
2967
|
+
index: "Table index",
|
|
2968
|
+
indexSub: "Indexes of the selected table (read-only); rows are the table total, not index entries",
|
|
2969
|
+
idxName: "Index name",
|
|
2970
|
+
idxColumns: "Columns",
|
|
2971
|
+
idxType: "Type",
|
|
2972
|
+
idxSource: "Source",
|
|
2973
|
+
idxUnique: "Unique",
|
|
2974
|
+
idxNormal: "Normal",
|
|
2975
|
+
idxAuto: "Automatic",
|
|
2976
|
+
idxCreated: "Explicit",
|
|
2977
|
+
idxCount: "{n} indexes",
|
|
2978
|
+
idxNoExtra: "This table has no indexes other than its primary key",
|
|
2979
|
+
idxRowsHelp: "Total table rows (including deleted rows), not index entries",
|
|
2980
|
+
idxTable: "Table",
|
|
2981
|
+
idxRows: "Rows",
|
|
2982
|
+
idxCols: "Cols",
|
|
2983
|
+
idxKey: "Primary key",
|
|
2984
|
+
idxIndexes: "Indexes",
|
|
2985
|
+
idxLastWrite: "Last write",
|
|
2986
|
+
idxNone: "\u2014",
|
|
2987
|
+
idxEmpty: "No index statistics available for this table",
|
|
2988
|
+
idxTables: "Tables",
|
|
2989
|
+
idxAt: "Generated"
|
|
2990
|
+
}
|
|
2991
|
+
};
|
|
2992
|
+
module2.exports = COPY;
|
|
2993
|
+
}
|
|
2994
|
+
});
|
|
2995
|
+
|
|
2996
|
+
// packages/addons/lib/visual-tokens.cjs
|
|
2997
|
+
var require_visual_tokens = __commonJS({
|
|
2998
|
+
"packages/addons/lib/visual-tokens.cjs"(exports2, module2) {
|
|
2999
|
+
module2.exports = `
|
|
3000
|
+
: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}
|
|
3001
|
+
.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}
|
|
3002
|
+
`;
|
|
3003
|
+
}
|
|
3004
|
+
});
|
|
3005
|
+
|
|
3006
|
+
// packages/addons/lib/data-style.cjs
|
|
3007
|
+
var require_data_style = __commonJS({
|
|
3008
|
+
"packages/addons/lib/data-style.cjs"(exports2, module2) {
|
|
3009
|
+
"use strict";
|
|
3010
|
+
module2.exports = function(DOMAIN, PREFIX) {
|
|
3011
|
+
var P = PREFIX + "-data";
|
|
3012
|
+
var CSS = [
|
|
3013
|
+
require_visual_tokens(),
|
|
3014
|
+
"." + P + "-search:has(.wbi-svg) input{padding-left:30px}." + P + "-search>.wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%)}",
|
|
3015
|
+
"." + P + "-btn{transition:background var(--wb-motion),border-color var(--wb-motion)}",
|
|
3016
|
+
"@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}}",
|
|
3017
|
+
"." + 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}",
|
|
3018
|
+
"." + 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)}",
|
|
3019
|
+
"." + 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)}",
|
|
3020
|
+
"." + 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}",
|
|
3021
|
+
"." + P + "-stab:hover{background:var(--cfg-hover)}",
|
|
3022
|
+
"." + P + "-stab:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
|
|
3023
|
+
"." + P + "-stab.on{background:color-mix(in oklab,currentColor 6%,transparent);border-color:var(--cfg-line)}",
|
|
3024
|
+
"." + 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)}",
|
|
3025
|
+
"." + P + "-stabname{display:flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;line-height:1.4;min-width:0}",
|
|
3026
|
+
"." + P + "-stabname span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
3027
|
+
"." + 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}",
|
|
3028
|
+
"." + 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}",
|
|
3029
|
+
"." + 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)}",
|
|
3030
|
+
"." + P + "-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}",
|
|
3031
|
+
"." + P + "-headmain{min-width:0;flex:1}",
|
|
3032
|
+
"." + P + "-head h2{margin:0;font-size:16px;font-weight:660;letter-spacing:.1px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
3033
|
+
"." + 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}",
|
|
3034
|
+
"." + P + "-sub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55;margin-top:4px}",
|
|
3035
|
+
"." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:2px 0 4px}",
|
|
3036
|
+
"." + P + "-search{position:relative;flex:1;min-width:180px;max-width:340px}",
|
|
3037
|
+
"." + 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}",
|
|
3038
|
+
"." + P + "-search input:hover{border-color:color-mix(in oklab,currentColor 28%,var(--cfg-line))}",
|
|
3039
|
+
"." + 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)}",
|
|
3040
|
+
"." + 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}",
|
|
3041
|
+
"." + 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)}",
|
|
3042
|
+
"." + P + "-switch{position:relative;display:inline-flex;align-items:center;gap:7px;cursor:pointer;font-size:12px;color:var(--cfg-muted);user-select:none;padding:4px 2px}",
|
|
3043
|
+
"." + P + "-switch input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}",
|
|
3044
|
+
"." + P + "-track{position:relative;width:34px;height:20px;border-radius:999px;background:color-mix(in oklab,currentColor 18%,transparent);transition:background .16s ease;flex:none}",
|
|
3045
|
+
"." + P + "-track::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-label-primary,currentColor);transition:transform .16s ease,background .16s ease}",
|
|
3046
|
+
"." + P + "-switch input:checked+." + P + "-track{background:var(--dsw-alias-brand-primary,currentColor)}",
|
|
3047
|
+
"." + P + "-switch input:checked+." + P + "-track::after{transform:translateX(14px);background:var(--dsw-alias-label-primary-inverted,var(--dsw-alias-bg-base))}",
|
|
3048
|
+
"." + P + "-switch input:focus-visible+." + P + "-track{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
|
|
3049
|
+
"." + 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}",
|
|
3050
|
+
"." + P + "-btn:hover{background:var(--cfg-hover);color:var(--dsw-alias-label-primary,inherit)}",
|
|
3051
|
+
"." + P + "-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
|
|
3052
|
+
"." + P + "-btn:disabled{opacity:.45;cursor:not-allowed}",
|
|
3053
|
+
"." + P + "-btn[aria-busy='true']{opacity:.6}",
|
|
3054
|
+
"." + 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)}",
|
|
3055
|
+
"." + P + "-table{border-collapse:separate;border-spacing:0;width:max-content;min-width:100%;font-size:12.5px}",
|
|
3056
|
+
"." + 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}",
|
|
3057
|
+
"." + 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}",
|
|
3058
|
+
"." + P + "-thbtn:hover{background:var(--cfg-hover)}",
|
|
3059
|
+
"." + P + "-thbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:-2px}",
|
|
3060
|
+
"." + P + "-coltype{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9.5px;font-weight:500;color:var(--cfg-faint);letter-spacing:.3px}",
|
|
3061
|
+
"." + P + "-sortmark{color:var(--dsw-alias-brand-primary,currentColor);font-size:10px}",
|
|
3062
|
+
"." + 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)}",
|
|
3063
|
+
"." + P + "-table thead ." + P + "-rownum{z-index:3}",
|
|
3064
|
+
"." + 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}",
|
|
3065
|
+
"." + P + "-table tbody tr:hover ." + P + "-cell{background:var(--cfg-hover)}",
|
|
3066
|
+
"." + 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)}",
|
|
3067
|
+
"." + P + "-cell.num{text-align:right;font-variant-numeric:tabular-nums}",
|
|
3068
|
+
"." + P + "-cell.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
|
|
3069
|
+
"." + P + "-cell.null{color:var(--cfg-faint);font-style:italic}",
|
|
3070
|
+
"." + P + "-cell.json .v{color:var(--dsw-alias-brand-primary,inherit)}",
|
|
3071
|
+
"." + P + "-tr.deleted ." + P + "-cell,." + P + "-tr.deleted ." + P + "-rownum{opacity:.55}",
|
|
3072
|
+
"." + P + "-tr.deleted ." + P + "-cell .v{text-decoration:line-through;text-decoration-color:color-mix(in oklab,currentColor 35%,transparent)}",
|
|
3073
|
+
"." + 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}",
|
|
3074
|
+
"." + P + "-foot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-top:2px;font-size:11.5px;color:var(--cfg-muted)}",
|
|
3075
|
+
"." + P + "-grow{flex:1}",
|
|
3076
|
+
"." + P + "-pageinfo{font-variant-numeric:tabular-nums}",
|
|
3077
|
+
"." + P + "-jump{width:56px;border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:7px;padding:4px 7px;font:inherit;font-size:11.5px;text-align:right;outline:none}",
|
|
3078
|
+
"." + P + "-jump:focus{border-color:var(--dsw-alias-brand-primary,currentColor)}",
|
|
3079
|
+
"." + 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)}",
|
|
3080
|
+
"." + 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}",
|
|
3081
|
+
"." + P + "-skwrap{display:flex;flex-direction:column;gap:1px;padding:2px}",
|
|
3082
|
+
"." + 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}",
|
|
3083
|
+
"@keyframes " + PREFIX + "-data-pulse{0%,100%{opacity:.6}50%{opacity:1}}",
|
|
3084
|
+
"." + 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)}",
|
|
3085
|
+
"." + P + "-mask{position:fixed;inset:0;z-index:30;background:color-mix(in oklab,currentColor 26%,transparent)}",
|
|
3086
|
+
"." + 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}",
|
|
3087
|
+
"." + P + "-drawer h3{margin:0;font-size:14px;font-weight:660;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
3088
|
+
"." + 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}",
|
|
3089
|
+
"." + P + "-drawerfoot{display:flex;gap:8px;justify-content:flex-end}",
|
|
3090
|
+
"." + 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}",
|
|
3091
|
+
"@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)}}",
|
|
3092
|
+
"@media (prefers-reduced-motion:reduce){." + P + " *,." + P + "-track,." + P + "-track::after,." + P + "-sk,." + P + "-drawer{transition:none;animation:none}}",
|
|
3093
|
+
"." + P + "-idxsub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55}",
|
|
3094
|
+
"." + P + "-idxsum{display:flex;gap:16px;flex-wrap:wrap;font-size:11.5px;color:var(--cfg-muted)}",
|
|
3095
|
+
"." + P + "-idxsum b{font-weight:660;color:var(--dsw-alias-label-primary,inherit);font-variant-numeric:tabular-nums}",
|
|
3096
|
+
"." + 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%}",
|
|
3097
|
+
"." + P + "-idxtags{display:flex;flex-wrap:wrap;gap:4px;max-width:280px}",
|
|
3098
|
+
"." + 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}",
|
|
3099
|
+
"." + P + "-idxchip.u{background:color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 15%,transparent);color:var(--dsw-alias-brand-primary,inherit)}",
|
|
3100
|
+
"." + P + "-idxnone{color:var(--cfg-faint)}",
|
|
3101
|
+
"." + P + "-frow th{padding:0 8px 6px;border-bottom:1px solid var(--cfg-line)}",
|
|
3102
|
+
"." + P + "-fcell{position:relative;display:block;min-width:96px}",
|
|
3103
|
+
"." + 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}",
|
|
3104
|
+
"." + P + "-finput:hover{background:color-mix(in oklab,currentColor 7%,transparent)}",
|
|
3105
|
+
"." + P + "-finput:focus{outline:none;border-color:var(--dsw-alias-brand-primary,currentColor);background:var(--cfg-surface)}",
|
|
3106
|
+
"." + 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}",
|
|
3107
|
+
"." + P + "-fclear:hover{color:inherit;background:var(--cfg-hover)}",
|
|
3108
|
+
"." + P + "-emptycell{padding:22px 12px;text-align:center;color:var(--cfg-muted)}",
|
|
3109
|
+
"." + P + " *{box-sizing:border-box}",
|
|
3110
|
+
"." + P + "-tabs{display:flex;gap:6px;border-bottom:1px solid var(--cfg-line);padding-bottom:9px}",
|
|
3111
|
+
"." + P + "-tabs [aria-selected=true]{background:var(--cfg-hover);color:inherit;font-weight:660}",
|
|
3112
|
+
"." + P + "-images{display:flex;gap:5px;align-items:center}",
|
|
3113
|
+
"." + P + "-images img{width:36px;height:36px;object-fit:cover;border-radius:5px}",
|
|
3114
|
+
"." + P + "-gallery{display:flex;flex-direction:column;gap:12px;overflow:auto;flex:1}",
|
|
3115
|
+
"." + P + "-gallery img{width:100%;height:auto;object-fit:contain;border-radius:8px}"
|
|
3116
|
+
].join("\n");
|
|
3117
|
+
if (DOMAIN === "storage") {
|
|
3118
|
+
var buttons = "." + P + " :is(button)";
|
|
3119
|
+
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}";
|
|
3120
|
+
}
|
|
3121
|
+
function injectCss() {
|
|
3122
|
+
if (typeof document === "undefined") return;
|
|
3123
|
+
var old = document.getElementById("wb-addon-" + DOMAIN + "-data-css");
|
|
3124
|
+
if (old) {
|
|
3125
|
+
old.textContent = CSS;
|
|
3126
|
+
return;
|
|
3127
|
+
}
|
|
3128
|
+
var style = document.createElement("style");
|
|
3129
|
+
style.id = "wb-addon-" + DOMAIN + "-data-css";
|
|
3130
|
+
style.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
|
|
3131
|
+
style.textContent = CSS;
|
|
3132
|
+
document.head.appendChild(style);
|
|
3133
|
+
}
|
|
3134
|
+
return injectCss;
|
|
3135
|
+
};
|
|
3136
|
+
}
|
|
3137
|
+
});
|
|
3138
|
+
|
|
3139
|
+
// packages/addons/lib/data-view.cjs
|
|
3140
|
+
var require_data_view = __commonJS({
|
|
3141
|
+
"packages/addons/lib/data-view.cjs"(exports2, module2) {
|
|
3142
|
+
"use strict";
|
|
3143
|
+
var React = require("react");
|
|
3144
|
+
var h = React.createElement;
|
|
3145
|
+
var COPY = require_data_copy();
|
|
3146
|
+
module2.exports = function createDataView(options) {
|
|
3147
|
+
var DOMAIN = options.domain;
|
|
3148
|
+
function icon(name) {
|
|
3149
|
+
return options.Icon ? h(options.Icon, { name }) : null;
|
|
3150
|
+
}
|
|
3151
|
+
var P = options.prefix + "-data";
|
|
3152
|
+
var configView = { useConfig: options.useConfig };
|
|
3153
|
+
var columnHooks = options.columns || {};
|
|
3154
|
+
var injectCss = require_data_style()(DOMAIN, options.prefix);
|
|
3155
|
+
var CFG_FALLBACK = {
|
|
3156
|
+
"data.pageSize": 50,
|
|
3157
|
+
"data.showSystemColumns": false,
|
|
3158
|
+
"data.includeDeleted": false
|
|
3159
|
+
};
|
|
3160
|
+
var PAGE_SIZES = [10, 25, 50, 100, 200];
|
|
3161
|
+
function unwrap(r) {
|
|
3162
|
+
return r && r.result !== void 0 ? r.result : r;
|
|
3163
|
+
}
|
|
3164
|
+
function fmt(template, vars) {
|
|
3165
|
+
return String(template).replace(/\{(\w+)\}/g, function(m, key) {
|
|
3166
|
+
return vars[key] === void 0 ? m : String(vars[key]);
|
|
3167
|
+
});
|
|
3168
|
+
}
|
|
3169
|
+
function pad2(n) {
|
|
3170
|
+
return n < 10 ? "0" + n : String(n);
|
|
3171
|
+
}
|
|
3172
|
+
function timeText(ms) {
|
|
3173
|
+
var d = new Date(Number(ms));
|
|
3174
|
+
if (!Number.isFinite(d.getTime())) return String(ms);
|
|
3175
|
+
return d.getFullYear() + "-" + pad2(d.getMonth() + 1) + "-" + pad2(d.getDate()) + " " + pad2(d.getHours()) + ":" + pad2(d.getMinutes());
|
|
3176
|
+
}
|
|
3177
|
+
function looksJson(value) {
|
|
3178
|
+
var text = String(value).trim();
|
|
3179
|
+
if (!text || text[0] !== "{" && text[0] !== "[") return false;
|
|
3180
|
+
try {
|
|
3181
|
+
JSON.parse(text);
|
|
3182
|
+
return true;
|
|
3183
|
+
} catch (e) {
|
|
3184
|
+
return false;
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
function rawText(value, col) {
|
|
3188
|
+
if (value === null || value === void 0) return "";
|
|
3189
|
+
return String(value);
|
|
3190
|
+
}
|
|
3191
|
+
function DataView(props) {
|
|
3192
|
+
var api = props.api;
|
|
3193
|
+
var lang = props.lang === "en" ? "en" : "zh";
|
|
3194
|
+
var t = Object.assign({}, COPY[lang], { indexSub: fmt(COPY[lang].indexSub, { tables: options.tables.join(" / "), domain: DOMAIN }) });
|
|
3195
|
+
var cfgWrap = configView.useConfig(api, CFG_FALLBACK);
|
|
3196
|
+
var cfg = cfgWrap.values;
|
|
3197
|
+
var tablesS = React.useState(null);
|
|
3198
|
+
var tables = tablesS[0], setTables = tablesS[1];
|
|
3199
|
+
var activeS = React.useState("");
|
|
3200
|
+
var active = activeS[0], setActive = activeS[1];
|
|
3201
|
+
var dataS = React.useState(null);
|
|
3202
|
+
var data = dataS[0], setData = dataS[1];
|
|
3203
|
+
var loadingS = React.useState(false);
|
|
3204
|
+
var loadingRows = loadingS[0], setLoadingRows = loadingS[1];
|
|
3205
|
+
var loadingTablesS = React.useState(true);
|
|
3206
|
+
var loadingTables = loadingTablesS[0], setLoadingTables = loadingTablesS[1];
|
|
3207
|
+
var errorS = React.useState("");
|
|
3208
|
+
var error = errorS[0], setError = errorS[1];
|
|
3209
|
+
var pageS = React.useState(1);
|
|
3210
|
+
var page = pageS[0], setPage = pageS[1];
|
|
3211
|
+
var sizeS = React.useState(0);
|
|
3212
|
+
var pageSize = sizeS[0], setPageSize = sizeS[1];
|
|
3213
|
+
var sortS = React.useState("");
|
|
3214
|
+
var sort = sortS[0], setSort = sortS[1];
|
|
3215
|
+
var orderS = React.useState("desc");
|
|
3216
|
+
var order = orderS[0], setOrder = orderS[1];
|
|
3217
|
+
var searchDraftS = React.useState("");
|
|
3218
|
+
var searchDraft = searchDraftS[0], setSearchDraft = searchDraftS[1];
|
|
3219
|
+
var searchS = React.useState("");
|
|
3220
|
+
var search = searchS[0], setSearch = searchS[1];
|
|
3221
|
+
var filterDraftS = React.useState({});
|
|
3222
|
+
var filterDraft = filterDraftS[0], setFilterDraft = filterDraftS[1];
|
|
3223
|
+
var filtersS = React.useState({});
|
|
3224
|
+
var filters = filtersS[0], setFilters = filtersS[1];
|
|
3225
|
+
var includeDeletedS = React.useState(null);
|
|
3226
|
+
var includeDeletedRaw = includeDeletedS[0], setIncludeDeleted = includeDeletedS[1];
|
|
3227
|
+
var showSystemS = React.useState(null);
|
|
3228
|
+
var showSystemRaw = showSystemS[0], setShowSystem = showSystemS[1];
|
|
3229
|
+
var drawerS = React.useState(null);
|
|
3230
|
+
var drawer = drawerS[0], setDrawer = drawerS[1];
|
|
3231
|
+
var toastS = React.useState("");
|
|
3232
|
+
var toast = toastS[0], setToast = toastS[1];
|
|
3233
|
+
var filtersKey = JSON.stringify(filters);
|
|
3234
|
+
var reqRef = React.useRef(0);
|
|
3235
|
+
var toastTimer = React.useRef(null);
|
|
3236
|
+
var refreshS = React.useState(0);
|
|
3237
|
+
function refresh() {
|
|
3238
|
+
loadTables();
|
|
3239
|
+
refreshS[1](function(n) {
|
|
3240
|
+
return n + 1;
|
|
3241
|
+
});
|
|
3242
|
+
}
|
|
3243
|
+
var indexReqRef = React.useRef(0);
|
|
3244
|
+
var indexS = React.useState(null);
|
|
3245
|
+
var index = indexS[0], setIndex = indexS[1];
|
|
3246
|
+
var indexBusyS = React.useState(false);
|
|
3247
|
+
var indexBusy = indexBusyS[0], setIndexBusy = indexBusyS[1];
|
|
3248
|
+
var cfgSize = Number(cfg["data.pageSize"]) || 50;
|
|
3249
|
+
var size = pageSize || (PAGE_SIZES.indexOf(cfgSize) >= 0 ? cfgSize : 50);
|
|
3250
|
+
var includeDeleted = includeDeletedRaw === null ? cfg["data.includeDeleted"] === true : includeDeletedRaw;
|
|
3251
|
+
var showSystem = showSystemRaw === null ? cfg["data.showSystemColumns"] === true : showSystemRaw;
|
|
3252
|
+
function say(text) {
|
|
3253
|
+
setToast(text);
|
|
3254
|
+
if (toastTimer.current) clearTimeout(toastTimer.current);
|
|
3255
|
+
toastTimer.current = setTimeout(function() {
|
|
3256
|
+
setToast("");
|
|
3257
|
+
}, 1600);
|
|
3258
|
+
}
|
|
3259
|
+
function loadTables() {
|
|
3260
|
+
setLoadingTables(true);
|
|
3261
|
+
Promise.resolve((options.tablesLoader || function(a) {
|
|
3262
|
+
return a.call(DOMAIN + ".dataTables");
|
|
3263
|
+
})(api)).then(function(r) {
|
|
3264
|
+
if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
|
|
3265
|
+
var body = unwrap(r);
|
|
3266
|
+
if (!body || !Array.isArray(body.tables)) throw new Error(t.loadFail);
|
|
3267
|
+
setTables(body.tables);
|
|
3268
|
+
setError("");
|
|
3269
|
+
if (!active && body.tables.length) setActive(body.tables[0].name);
|
|
3270
|
+
}).catch(function(e) {
|
|
3271
|
+
setError(String(e && e.message || e) || t.loadFail);
|
|
3272
|
+
}).then(function() {
|
|
3273
|
+
setLoadingTables(false);
|
|
3274
|
+
});
|
|
3275
|
+
}
|
|
3276
|
+
React.useEffect(function() {
|
|
3277
|
+
injectCss();
|
|
3278
|
+
loadTables();
|
|
3279
|
+
return function() {
|
|
3280
|
+
indexReqRef.current++;
|
|
3281
|
+
if (toastTimer.current) clearTimeout(toastTimer.current);
|
|
3282
|
+
};
|
|
3283
|
+
}, []);
|
|
3284
|
+
function selectTable(name) {
|
|
3285
|
+
if (name === active) return;
|
|
3286
|
+
reqRef.current++;
|
|
3287
|
+
setActive(name);
|
|
3288
|
+
setData(null);
|
|
3289
|
+
setDrawer(null);
|
|
3290
|
+
setError("");
|
|
3291
|
+
setLoadingRows(true);
|
|
3292
|
+
setPage(1);
|
|
3293
|
+
setSort("");
|
|
3294
|
+
setOrder("desc");
|
|
3295
|
+
setSearch("");
|
|
3296
|
+
setSearchDraft("");
|
|
3297
|
+
setFilterDraft({});
|
|
3298
|
+
setFilters({});
|
|
3299
|
+
}
|
|
3300
|
+
React.useEffect(function() {
|
|
3301
|
+
if (searchDraft === search) return void 0;
|
|
3302
|
+
var timer = setTimeout(function() {
|
|
3303
|
+
setSearch(searchDraft);
|
|
3304
|
+
setPage(1);
|
|
3305
|
+
}, 280);
|
|
3306
|
+
return function() {
|
|
3307
|
+
clearTimeout(timer);
|
|
3308
|
+
};
|
|
3309
|
+
}, [searchDraft]);
|
|
3310
|
+
React.useEffect(function() {
|
|
3311
|
+
if (JSON.stringify(filterDraft) === JSON.stringify(filters)) return void 0;
|
|
3312
|
+
var timer = setTimeout(function() {
|
|
3313
|
+
setFilters(filterDraft);
|
|
3314
|
+
setPage(1);
|
|
3315
|
+
}, 280);
|
|
3316
|
+
return function() {
|
|
3317
|
+
clearTimeout(timer);
|
|
3318
|
+
};
|
|
3319
|
+
}, [filterDraft]);
|
|
3320
|
+
React.useEffect(function() {
|
|
3321
|
+
if (!active || !cfgWrap.ready || index) return void 0;
|
|
3322
|
+
var req = ++reqRef.current;
|
|
3323
|
+
setLoadingRows(true);
|
|
3324
|
+
var args = { table: active, page, pageSize: size, order, includeDeleted };
|
|
3325
|
+
if (sort) args.sort = sort;
|
|
3326
|
+
if (search) args.search = search;
|
|
3327
|
+
if (Object.keys(filters).length) args.filters = filters;
|
|
3328
|
+
Promise.resolve((options.query || function(a, q) {
|
|
3329
|
+
return a.call(DOMAIN + ".dataQuery", q);
|
|
3330
|
+
})(api, args)).then(function(r) {
|
|
3331
|
+
if (req !== reqRef.current) return;
|
|
3332
|
+
if (r && r.ok === false) throw new Error(r && r.error || t.queryFail);
|
|
3333
|
+
var body = unwrap(r);
|
|
3334
|
+
if (!body) throw new Error(t.queryFail);
|
|
3335
|
+
setData(body);
|
|
3336
|
+
setError("");
|
|
3337
|
+
if (body.page !== page) setPage(body.page);
|
|
3338
|
+
}).catch(function(e) {
|
|
3339
|
+
if (req !== reqRef.current) return;
|
|
3340
|
+
setError(String(e && e.message || e) || t.queryFail);
|
|
3341
|
+
}).then(function() {
|
|
3342
|
+
if (req === reqRef.current) setLoadingRows(false);
|
|
3343
|
+
});
|
|
3344
|
+
return function() {
|
|
3345
|
+
reqRef.current++;
|
|
3346
|
+
};
|
|
3347
|
+
}, [active, page, size, sort, order, search, includeDeleted, cfgWrap.ready, filtersKey, refreshS[0], !!index]);
|
|
3348
|
+
React.useEffect(function() {
|
|
3349
|
+
if (!drawer) return void 0;
|
|
3350
|
+
function onKey(e) {
|
|
3351
|
+
if (e.key === "Escape") setDrawer(null);
|
|
3352
|
+
}
|
|
3353
|
+
document.addEventListener("keydown", onKey);
|
|
3354
|
+
return function() {
|
|
3355
|
+
document.removeEventListener("keydown", onKey);
|
|
3356
|
+
};
|
|
3357
|
+
}, [drawer]);
|
|
3358
|
+
var current = null;
|
|
3359
|
+
if (tables) {
|
|
3360
|
+
for (var i = 0; i < tables.length; i++) if (tables[i].name === active) current = tables[i];
|
|
3361
|
+
}
|
|
3362
|
+
function leaveIndex() {
|
|
3363
|
+
indexReqRef.current++;
|
|
3364
|
+
setIndex(null);
|
|
3365
|
+
setIndexBusy(false);
|
|
3366
|
+
setError("");
|
|
3367
|
+
}
|
|
3368
|
+
function loadIndex() {
|
|
3369
|
+
reqRef.current++;
|
|
3370
|
+
setError("");
|
|
3371
|
+
var req = ++indexReqRef.current;
|
|
3372
|
+
setIndex([]);
|
|
3373
|
+
setIndexBusy(true);
|
|
3374
|
+
Promise.resolve(api.call(DOMAIN + ".dataTables", { stats: true })).then(function(r) {
|
|
3375
|
+
if (req !== indexReqRef.current) return;
|
|
3376
|
+
if (r && r.ok === false) throw new Error(r.error || t.loadFail);
|
|
3377
|
+
var payload = unwrap(r) || {};
|
|
3378
|
+
var rows = (payload.tables || []).map(function(tb) {
|
|
3379
|
+
return { table: tb, stats: tb.stats || null };
|
|
3380
|
+
});
|
|
3381
|
+
setIndex(rows);
|
|
3382
|
+
setError("");
|
|
3383
|
+
setIndexBusy(false);
|
|
3384
|
+
}).catch(function(e) {
|
|
3385
|
+
if (req !== indexReqRef.current) return;
|
|
3386
|
+
setError(String(e.message || e));
|
|
3387
|
+
setIndex([]);
|
|
3388
|
+
setIndexBusy(false);
|
|
3389
|
+
});
|
|
3390
|
+
}
|
|
3391
|
+
function renderIndex() {
|
|
3392
|
+
var row = (index || []).filter(function(r) {
|
|
3393
|
+
return r.table.name === active;
|
|
3394
|
+
})[0];
|
|
3395
|
+
var tb = row ? row.table : current;
|
|
3396
|
+
var st = row && row.stats;
|
|
3397
|
+
var indexes = st ? st.indexes || [] : [];
|
|
3398
|
+
var hasExtra = indexes.some(function(ix) {
|
|
3399
|
+
return ix.origin !== "pk";
|
|
3400
|
+
});
|
|
3401
|
+
var count = st && st.rows !== void 0 ? st.rows : tb && tb.count;
|
|
3402
|
+
return h(
|
|
3403
|
+
"div",
|
|
3404
|
+
{ className: P + "-idx" },
|
|
3405
|
+
h(
|
|
3406
|
+
"div",
|
|
3407
|
+
{ className: P + "-head" },
|
|
3408
|
+
h(
|
|
3409
|
+
"div",
|
|
3410
|
+
{ className: P + "-headmain" },
|
|
3411
|
+
h("h2", null, icon("database"), tableLabel(tb), h("span", { className: P + "-code" }, active)),
|
|
3412
|
+
h("div", { className: P + "-idxsub" }, t.indexSub)
|
|
3413
|
+
),
|
|
3414
|
+
h("button", {
|
|
3415
|
+
type: "button",
|
|
3416
|
+
className: P + "-btn",
|
|
3417
|
+
"aria-label": t.refresh,
|
|
3418
|
+
title: t.refresh,
|
|
3419
|
+
"aria-busy": indexBusy ? "true" : "false",
|
|
3420
|
+
onClick: function() {
|
|
3421
|
+
loadIndex();
|
|
3422
|
+
}
|
|
3423
|
+
}, icon("refresh"), h("span", { className: P + "-btnlabel" }, t.refresh))
|
|
3424
|
+
),
|
|
3425
|
+
st ? h(
|
|
3426
|
+
"div",
|
|
3427
|
+
{ className: P + "-idxsum" },
|
|
3428
|
+
h("span", null, t.idxRows, " ", h("b", null, String(count))),
|
|
3429
|
+
h("span", null, t.idxCols, " ", h("b", null, String(st.columnCount === void 0 ? (tb.columns || []).length : st.columnCount))),
|
|
3430
|
+
h("span", null, fmt(t.idxCount, { n: indexes.length }))
|
|
3431
|
+
) : null,
|
|
3432
|
+
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(
|
|
3433
|
+
"div",
|
|
3434
|
+
{ className: P + "-tablewrap" },
|
|
3435
|
+
h(
|
|
3436
|
+
"table",
|
|
3437
|
+
{ className: P + "-table " + P + "-idxtable" },
|
|
3438
|
+
h("thead", null, h(
|
|
3439
|
+
"tr",
|
|
3440
|
+
null,
|
|
3441
|
+
[t.idxName, t.idxColumns, t.idxType, t.idxSource, t.idxRows].map(function(label) {
|
|
3442
|
+
return h("th", { scope: "col", key: label }, h("span", { className: P + "-thbtn" }, label));
|
|
3443
|
+
})
|
|
3444
|
+
)),
|
|
3445
|
+
h("tbody", null, indexes.map(function(ix) {
|
|
3446
|
+
return h(
|
|
3447
|
+
"tr",
|
|
3448
|
+
{ className: P + "-tr", key: ix.name },
|
|
3449
|
+
h("td", { className: P + "-cell mono" }, ix.name),
|
|
3450
|
+
h("td", { className: P + "-cell mono" }, (ix.columns || []).join(", ") || t.idxNone),
|
|
3451
|
+
h("td", { className: P + "-cell" }, ix.origin === "pk" ? t.idxKey : ix.unique ? t.idxUnique : t.idxNormal),
|
|
3452
|
+
h("td", { className: P + "-cell" }, /^sqlite_autoindex_/.test(ix.name) ? t.idxAuto : t.idxCreated),
|
|
3453
|
+
h("td", { className: P + "-cell num", title: t.idxRowsHelp }, String(count))
|
|
3454
|
+
);
|
|
3455
|
+
}))
|
|
3456
|
+
)
|
|
3457
|
+
)
|
|
3458
|
+
);
|
|
3459
|
+
}
|
|
3460
|
+
function tableLabel(tb) {
|
|
3461
|
+
if (!tb || !tb.label) return "";
|
|
3462
|
+
return lang === "en" ? tb.label.en || tb.label.zh : tb.label.zh || tb.label.en;
|
|
3463
|
+
}
|
|
3464
|
+
function colLabel(col) {
|
|
3465
|
+
if (!col.label) return col.name;
|
|
3466
|
+
return lang === "en" ? col.label.en || col.label.zh : col.label.zh || col.label.en;
|
|
3467
|
+
}
|
|
3468
|
+
function visibleColumns() {
|
|
3469
|
+
var cols = data && data.columns ? data.columns.map(function(col) {
|
|
3470
|
+
var hook = columnHooks[col.name];
|
|
3471
|
+
return hook && hook.kind ? Object.assign({}, col, { kind: hook.kind, type: hook.type || col.type }) : col;
|
|
3472
|
+
}) : [];
|
|
3473
|
+
return cols.filter(function(c) {
|
|
3474
|
+
return showSystem || !c.system;
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
3477
|
+
function toggleSort(name) {
|
|
3478
|
+
if (sort !== name) {
|
|
3479
|
+
setSort(name);
|
|
3480
|
+
setOrder("desc");
|
|
3481
|
+
return;
|
|
3482
|
+
}
|
|
3483
|
+
if (order === "desc") {
|
|
3484
|
+
setOrder("asc");
|
|
3485
|
+
return;
|
|
3486
|
+
}
|
|
3487
|
+
setSort("");
|
|
3488
|
+
setOrder("desc");
|
|
3489
|
+
}
|
|
3490
|
+
function ariaSort(name) {
|
|
3491
|
+
if (sort !== name) return "none";
|
|
3492
|
+
return order === "asc" ? "ascending" : "descending";
|
|
3493
|
+
}
|
|
3494
|
+
function copyCell(value) {
|
|
3495
|
+
var text = value === null || value === void 0 ? "" : String(value);
|
|
3496
|
+
try {
|
|
3497
|
+
if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(text);
|
|
3498
|
+
else {
|
|
3499
|
+
var ta = document.createElement("textarea");
|
|
3500
|
+
ta.value = text;
|
|
3501
|
+
ta.style.position = "fixed";
|
|
3502
|
+
ta.style.opacity = "0";
|
|
3503
|
+
document.body.appendChild(ta);
|
|
3504
|
+
ta.select();
|
|
3505
|
+
document.execCommand("copy");
|
|
3506
|
+
document.body.removeChild(ta);
|
|
3507
|
+
}
|
|
3508
|
+
say(t.copied);
|
|
3509
|
+
} catch (e) {
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
function cellText(col, value) {
|
|
3513
|
+
if (value === null || value === void 0) return null;
|
|
3514
|
+
if (col.kind === "bool") return value ? t.yes : t.no;
|
|
3515
|
+
if (col.kind === "timestamp") return timeText(value);
|
|
3516
|
+
return String(value);
|
|
3517
|
+
}
|
|
3518
|
+
function cellClass(col, value) {
|
|
3519
|
+
var cls = P + "-cell";
|
|
3520
|
+
if (value === null || value === void 0) return cls + " null";
|
|
3521
|
+
if (col.kind === "number") return cls + " num";
|
|
3522
|
+
if (col.kind === "id" || col.kind === "path") return cls + " mono";
|
|
3523
|
+
if (col.kind === "text" && looksJson(value)) return cls + " json";
|
|
3524
|
+
return cls;
|
|
3525
|
+
}
|
|
3526
|
+
function cellTitle(col, value) {
|
|
3527
|
+
if (value === null || value === void 0) return t.nullText;
|
|
3528
|
+
if (col.kind === "timestamp") return String(value);
|
|
3529
|
+
if (col.kind === "bool") return value ? "1" : "0";
|
|
3530
|
+
return String(value);
|
|
3531
|
+
}
|
|
3532
|
+
function renderCell(row, col) {
|
|
3533
|
+
var value = row[col.name];
|
|
3534
|
+
var hook = columnHooks[col.name];
|
|
3535
|
+
function openDetail() {
|
|
3536
|
+
setDrawer({ column: colLabel(col), name: col.name, row: (data.page - 1) * data.pageSize + row.__i + 1, value });
|
|
3537
|
+
}
|
|
3538
|
+
var text = cellText(col, value);
|
|
3539
|
+
var content;
|
|
3540
|
+
if (text === null) content = h("span", { className: "v" }, t.nullText);
|
|
3541
|
+
else if (text === "") content = h("span", { className: "v" }, '""');
|
|
3542
|
+
else content = h("span", { className: "v" }, text);
|
|
3543
|
+
if (hook && hook.render) content = hook.render({ value, row, col, lang, prefix: P, openDetail });
|
|
3544
|
+
return h("td", {
|
|
3545
|
+
key: col.name,
|
|
3546
|
+
className: cellClass(col, value),
|
|
3547
|
+
title: cellTitle(col, value),
|
|
3548
|
+
onClick: function() {
|
|
3549
|
+
copyCell(value);
|
|
3550
|
+
},
|
|
3551
|
+
onDoubleClick: openDetail
|
|
3552
|
+
}, content);
|
|
3553
|
+
}
|
|
3554
|
+
function activeFilterCount() {
|
|
3555
|
+
var n = 0;
|
|
3556
|
+
for (var k in filters) if (Object.prototype.hasOwnProperty.call(filters, k)) n++;
|
|
3557
|
+
return n;
|
|
3558
|
+
}
|
|
3559
|
+
function filterCell(col) {
|
|
3560
|
+
var val = filterDraft[col.name] === void 0 ? "" : filterDraft[col.name];
|
|
3561
|
+
return h(
|
|
3562
|
+
"th",
|
|
3563
|
+
{ key: col.name, scope: "col", className: P + "-fth" },
|
|
3564
|
+
h(
|
|
3565
|
+
"span",
|
|
3566
|
+
{ className: P + "-fcell" },
|
|
3567
|
+
h("input", {
|
|
3568
|
+
className: P + "-finput",
|
|
3569
|
+
type: "search",
|
|
3570
|
+
value: val,
|
|
3571
|
+
placeholder: t.filterCol,
|
|
3572
|
+
"aria-label": t.filterCol + " " + colLabel(col),
|
|
3573
|
+
title: colLabel(col) + " \xB7 " + t.filterCol,
|
|
3574
|
+
onChange: function(e) {
|
|
3575
|
+
var v = e.target.value;
|
|
3576
|
+
setFilterDraft(function(prev) {
|
|
3577
|
+
var next = Object.assign({}, prev);
|
|
3578
|
+
if (v) next[col.name] = v;
|
|
3579
|
+
else delete next[col.name];
|
|
3580
|
+
return next;
|
|
3581
|
+
});
|
|
3582
|
+
}
|
|
3583
|
+
}),
|
|
3584
|
+
val ? h("button", {
|
|
3585
|
+
type: "button",
|
|
3586
|
+
className: P + "-fclear",
|
|
3587
|
+
title: t.filterClear,
|
|
3588
|
+
"aria-label": t.filterClear + " " + colLabel(col),
|
|
3589
|
+
onClick: function() {
|
|
3590
|
+
setFilterDraft(function(prev) {
|
|
3591
|
+
var next = Object.assign({}, prev);
|
|
3592
|
+
delete next[col.name];
|
|
3593
|
+
return next;
|
|
3594
|
+
});
|
|
3595
|
+
}
|
|
3596
|
+
}, "\xD7") : null
|
|
3597
|
+
)
|
|
3598
|
+
);
|
|
3599
|
+
}
|
|
3600
|
+
function renderRows() {
|
|
3601
|
+
if (loadingRows && !data && options.Skeleton) return h(options.Skeleton, { lang, label: t.loading });
|
|
3602
|
+
if (loadingRows && !data) {
|
|
3603
|
+
return h(
|
|
3604
|
+
"div",
|
|
3605
|
+
{ className: P + "-skwrap", "aria-busy": "true" },
|
|
3606
|
+
h("span", { className: P + "-sr" }, t.loading),
|
|
3607
|
+
[0, 1, 2, 3, 4, 5, 6, 7].map(function(i2) {
|
|
3608
|
+
return h("div", { key: i2, className: P + "-sk" });
|
|
3609
|
+
})
|
|
3610
|
+
);
|
|
3611
|
+
}
|
|
3612
|
+
if (error) {
|
|
3613
|
+
return h(
|
|
3614
|
+
"div",
|
|
3615
|
+
{ className: P + "-err", role: "alert" },
|
|
3616
|
+
h("span", null, t.queryFail + error),
|
|
3617
|
+
h("button", { type: "button", className: P + "-btn", onClick: refresh }, t.retry)
|
|
3618
|
+
);
|
|
3619
|
+
}
|
|
3620
|
+
if (!data) return h("div", { className: P + "-empty" }, t.empty);
|
|
3621
|
+
var cols = visibleColumns();
|
|
3622
|
+
var rows = data.rows || [];
|
|
3623
|
+
var narrowing = !!search || activeFilterCount() > 0;
|
|
3624
|
+
return h(
|
|
3625
|
+
"div",
|
|
3626
|
+
{ className: P + "-tablewrap" },
|
|
3627
|
+
h(
|
|
3628
|
+
"table",
|
|
3629
|
+
{ className: P + "-table" },
|
|
3630
|
+
h(
|
|
3631
|
+
"thead",
|
|
3632
|
+
null,
|
|
3633
|
+
h(
|
|
3634
|
+
"tr",
|
|
3635
|
+
null,
|
|
3636
|
+
h("th", { className: P + "-rownum", scope: "col" }, "#"),
|
|
3637
|
+
cols.map(function(col) {
|
|
3638
|
+
return h(
|
|
3639
|
+
"th",
|
|
3640
|
+
{ key: col.name, scope: "col", "aria-sort": ariaSort(col.name) },
|
|
3641
|
+
h(
|
|
3642
|
+
"button",
|
|
3643
|
+
{
|
|
3644
|
+
type: "button",
|
|
3645
|
+
className: P + "-thbtn",
|
|
3646
|
+
title: colLabel(col) + " \xB7 " + col.type,
|
|
3647
|
+
onClick: function() {
|
|
3648
|
+
toggleSort(col.name);
|
|
3649
|
+
}
|
|
3650
|
+
},
|
|
3651
|
+
h("span", null, colLabel(col)),
|
|
3652
|
+
h("span", { className: P + "-coltype" }, String(col.type || "").toLowerCase()),
|
|
3653
|
+
sort === col.name ? h("span", { className: P + "-sortmark", "aria-hidden": "true" }, order === "asc" ? "\u25B2" : "\u25BC") : null
|
|
3654
|
+
)
|
|
3655
|
+
);
|
|
3656
|
+
})
|
|
3657
|
+
),
|
|
3658
|
+
h(
|
|
3659
|
+
"tr",
|
|
3660
|
+
{ className: P + "-frow" },
|
|
3661
|
+
h("th", { className: P + "-rownum", scope: "col" }, ""),
|
|
3662
|
+
cols.map(filterCell)
|
|
3663
|
+
)
|
|
3664
|
+
),
|
|
3665
|
+
h("tbody", null, rows.length ? rows.map(function(row, idx) {
|
|
3666
|
+
row.__i = idx;
|
|
3667
|
+
var deleted = row.deleted_at !== null && row.deleted_at !== void 0;
|
|
3668
|
+
return h(
|
|
3669
|
+
"tr",
|
|
3670
|
+
{ key: row.id || idx, className: P + "-tr" + (deleted ? " deleted" : "") },
|
|
3671
|
+
h("td", { className: P + "-rownum" }, (data.page - 1) * data.pageSize + idx + 1),
|
|
3672
|
+
cols.map(function(col) {
|
|
3673
|
+
var cell = renderCell(row, col);
|
|
3674
|
+
if (deleted && col.name === "id") {
|
|
3675
|
+
return React.cloneElement(cell, { key: col.name }, cell.props.children, h("span", { className: P + "-delbadge" }, t.deleted));
|
|
3676
|
+
}
|
|
3677
|
+
return cell;
|
|
3678
|
+
})
|
|
3679
|
+
);
|
|
3680
|
+
}) : h("tr", null, h("td", { className: P + "-emptycell", colSpan: cols.length + 1 }, narrowing ? t.noRows : t.empty)))
|
|
3681
|
+
)
|
|
3682
|
+
);
|
|
3683
|
+
}
|
|
3684
|
+
function renderFoot() {
|
|
3685
|
+
var pages = data ? data.pages : 1;
|
|
3686
|
+
var total = data ? data.total : 0;
|
|
3687
|
+
return h(
|
|
3688
|
+
"div",
|
|
3689
|
+
{ className: P + "-foot" },
|
|
3690
|
+
h("span", null, fmt(t.total, { n: total })),
|
|
3691
|
+
h("span", { className: P + "-grow" }),
|
|
3692
|
+
h("button", { type: "button", className: P + "-btn", disabled: !data || page <= 1, onClick: function() {
|
|
3693
|
+
setPage(Math.max(1, page - 1));
|
|
3694
|
+
} }, "\u2039 " + t.prev),
|
|
3695
|
+
h("span", { className: P + "-pageinfo" }, fmt(t.pageInfo, { page: data ? data.page : 1, pages })),
|
|
3696
|
+
h("button", { type: "button", className: P + "-btn", disabled: !data || page >= pages, onClick: function() {
|
|
3697
|
+
setPage(Math.min(pages, page + 1));
|
|
3698
|
+
} }, t.next + " \u203A"),
|
|
3699
|
+
h("input", {
|
|
3700
|
+
className: P + "-jump",
|
|
3701
|
+
type: "number",
|
|
3702
|
+
min: 1,
|
|
3703
|
+
max: pages,
|
|
3704
|
+
"aria-label": t.jump,
|
|
3705
|
+
onKeyDown: function(e) {
|
|
3706
|
+
if (e.key === "Enter") {
|
|
3707
|
+
var n = Math.floor(Number(e.target.value));
|
|
3708
|
+
if (n >= 1) setPage(Math.min(pages, n));
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
}),
|
|
3712
|
+
data && data.queryMs !== void 0 ? h("span", null, fmt(t.queryTime, { n: data.queryMs })) : null
|
|
3713
|
+
);
|
|
3714
|
+
}
|
|
3715
|
+
if (!tables && loadingTables && options.Skeleton) return h(options.Skeleton, { lang, label: t.loading });
|
|
3716
|
+
if (!tables && loadingTables) {
|
|
3717
|
+
return h("div", { className: P + "-skwrap", "aria-busy": "true" }, h("span", { className: P + "-sr" }, t.loading), [0, 1, 2, 3].map(function(i2) {
|
|
3718
|
+
return h("div", { key: i2, className: P + "-sk" });
|
|
3719
|
+
}));
|
|
3720
|
+
}
|
|
3721
|
+
if (!tables) {
|
|
3722
|
+
return h("div", { className: P + "-err", role: "alert" }, h("span", null, t.loadFail), h("button", { type: "button", className: P + "-btn", onClick: loadTables }, t.retry));
|
|
3723
|
+
}
|
|
3724
|
+
if (!tables.length) return h("div", { className: P + "-empty" }, t.emptyTable);
|
|
3725
|
+
return h(
|
|
3726
|
+
"div",
|
|
3727
|
+
{ className: P },
|
|
3728
|
+
h(
|
|
3729
|
+
"div",
|
|
3730
|
+
{ className: P + "-side" },
|
|
3731
|
+
h("div", { className: P + "-sidetitle" }, h("span", null, icon("table"), t.tables), h("span", null, String(tables.length))),
|
|
3732
|
+
tables.map(function(tb) {
|
|
3733
|
+
return h(
|
|
3734
|
+
"button",
|
|
3735
|
+
{
|
|
3736
|
+
key: tb.name,
|
|
3737
|
+
type: "button",
|
|
3738
|
+
className: P + "-stab" + (tb.name === active ? " on" : ""),
|
|
3739
|
+
"aria-pressed": tb.name === active,
|
|
3740
|
+
onClick: function() {
|
|
3741
|
+
selectTable(tb.name);
|
|
3742
|
+
}
|
|
3743
|
+
},
|
|
3744
|
+
h(
|
|
3745
|
+
"span",
|
|
3746
|
+
{ className: P + "-stabname" },
|
|
3747
|
+
h("span", null, tableLabel(tb)),
|
|
3748
|
+
h("span", { className: P + "-sidecount" }, tb.count === void 0 || tb.count === null ? "" : String(tb.count))
|
|
3749
|
+
),
|
|
3750
|
+
h("span", { className: P + "-sidetable" }, tb.name)
|
|
3751
|
+
);
|
|
3752
|
+
})
|
|
3753
|
+
),
|
|
3754
|
+
h(
|
|
3755
|
+
"div",
|
|
3756
|
+
{ className: P + "-main" },
|
|
3757
|
+
h(
|
|
3758
|
+
"div",
|
|
3759
|
+
{ className: P + "-tabs", role: "tablist", "aria-label": t.title },
|
|
3760
|
+
h("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !index, onClick: leaveIndex }, icon("list"), lang === "en" ? "Row data" : "\u884C\u6570\u636E"),
|
|
3761
|
+
h("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !!index, onClick: loadIndex }, icon("database"), t.index)
|
|
3762
|
+
),
|
|
3763
|
+
index && error ? h("div", { className: P + "-err", role: "alert" }, error) : null,
|
|
3764
|
+
index ? renderIndex() : [
|
|
3765
|
+
h(
|
|
3766
|
+
"div",
|
|
3767
|
+
{ className: P + "-head" },
|
|
3768
|
+
h(
|
|
3769
|
+
"div",
|
|
3770
|
+
{ className: P + "-headmain" },
|
|
3771
|
+
h("h2", null, icon("database"), tableLabel(current), h("span", { className: P + "-code" }, active)),
|
|
3772
|
+
h(
|
|
3773
|
+
"div",
|
|
3774
|
+
{ className: P + "-sub" },
|
|
3775
|
+
current && data && data.total !== void 0 ? fmt(t.rowCount, { n: data.total }) : "",
|
|
3776
|
+
current && current.deletedCount ? " \xB7 " + fmt(t.deletedCount, { n: current.deletedCount }) : "",
|
|
3777
|
+
" \xB7 " + t.subtitle
|
|
3778
|
+
)
|
|
3779
|
+
),
|
|
3780
|
+
h("button", {
|
|
3781
|
+
type: "button",
|
|
3782
|
+
className: P + "-btn",
|
|
3783
|
+
"aria-label": t.refresh,
|
|
3784
|
+
title: t.refresh,
|
|
3785
|
+
"aria-busy": loadingRows ? "true" : "false",
|
|
3786
|
+
onClick: refresh
|
|
3787
|
+
}, icon("refresh"), h("span", { className: P + "-btnlabel" }, t.refresh))
|
|
3788
|
+
),
|
|
3789
|
+
h(
|
|
3790
|
+
"div",
|
|
3791
|
+
{ className: P + "-toolbar" },
|
|
3792
|
+
h(
|
|
3793
|
+
"div",
|
|
3794
|
+
{ className: P + "-search" },
|
|
3795
|
+
icon("search"),
|
|
3796
|
+
h("input", {
|
|
3797
|
+
type: "search",
|
|
3798
|
+
value: searchDraft,
|
|
3799
|
+
placeholder: t.search,
|
|
3800
|
+
"aria-label": t.search,
|
|
3801
|
+
onChange: function(e) {
|
|
3802
|
+
setSearchDraft(e.target.value);
|
|
3803
|
+
}
|
|
3804
|
+
})
|
|
3805
|
+
),
|
|
3806
|
+
h(
|
|
3807
|
+
"label",
|
|
3808
|
+
{ className: P + "-switch" },
|
|
3809
|
+
h("input", { type: "checkbox", checked: includeDeleted, onChange: function(e) {
|
|
3810
|
+
setIncludeDeleted(e.target.checked);
|
|
3811
|
+
setPage(1);
|
|
3812
|
+
} }),
|
|
3813
|
+
h("span", { className: P + "-track" }),
|
|
3814
|
+
h("span", null, t.includeDeleted)
|
|
3815
|
+
),
|
|
3816
|
+
h(
|
|
3817
|
+
"label",
|
|
3818
|
+
{ className: P + "-switch" },
|
|
3819
|
+
h("input", { type: "checkbox", checked: showSystem, onChange: function(e) {
|
|
3820
|
+
setShowSystem(e.target.checked);
|
|
3821
|
+
} }),
|
|
3822
|
+
h("span", { className: P + "-track" }),
|
|
3823
|
+
h("span", null, t.showSystem)
|
|
3824
|
+
),
|
|
3825
|
+
h("span", { className: P + "-grow" }),
|
|
3826
|
+
h(
|
|
3827
|
+
"label",
|
|
3828
|
+
{ style: { display: "inline-flex", alignItems: "center", gap: "6px", fontSize: "11.5px", color: "var(--cfg-muted)" } },
|
|
3829
|
+
h("span", null, t.pageSize),
|
|
3830
|
+
h("select", {
|
|
3831
|
+
className: P + "-select",
|
|
3832
|
+
value: size,
|
|
3833
|
+
onChange: function(e) {
|
|
3834
|
+
setPageSize(Number(e.target.value));
|
|
3835
|
+
setPage(1);
|
|
3836
|
+
}
|
|
3837
|
+
}, PAGE_SIZES.map(function(n) {
|
|
3838
|
+
return h("option", { key: n, value: n }, String(n));
|
|
3839
|
+
}))
|
|
3840
|
+
)
|
|
3841
|
+
),
|
|
3842
|
+
renderRows(),
|
|
3843
|
+
renderFoot()
|
|
3844
|
+
]
|
|
3845
|
+
),
|
|
3846
|
+
drawer ? h(
|
|
3847
|
+
"div",
|
|
3848
|
+
null,
|
|
3849
|
+
h("div", { className: P + "-mask", onClick: function() {
|
|
3850
|
+
setDrawer(null);
|
|
3851
|
+
} }),
|
|
3852
|
+
h(
|
|
3853
|
+
"aside",
|
|
3854
|
+
{ className: P + "-drawer", role: "dialog", "aria-modal": "true", "aria-label": drawer.column },
|
|
3855
|
+
h("h3", null, fmt(t.drawerTitle, { column: drawer.column, row: drawer.row }), h("span", { className: P + "-code" }, drawer.name)),
|
|
3856
|
+
columnHooks[drawer.name] && columnHooks[drawer.name].detail ? columnHooks[drawer.name].detail({ value: drawer.value, lang, prefix: P }) : h("pre", null, drawerText(drawer.value)),
|
|
3857
|
+
h(
|
|
3858
|
+
"div",
|
|
3859
|
+
{ className: P + "-drawerfoot" },
|
|
3860
|
+
h("button", { type: "button", className: P + "-btn", onClick: function() {
|
|
3861
|
+
copyCell(drawer.value);
|
|
3862
|
+
} }, t.copy),
|
|
3863
|
+
h("button", { type: "button", className: P + "-btn", onClick: function() {
|
|
3864
|
+
setDrawer(null);
|
|
3865
|
+
} }, t.close)
|
|
3866
|
+
)
|
|
3867
|
+
)
|
|
3868
|
+
) : null,
|
|
3869
|
+
toast ? h("div", { className: P + "-toast", role: "status" }, toast) : null
|
|
3870
|
+
);
|
|
3871
|
+
}
|
|
3872
|
+
function drawerText(value) {
|
|
3873
|
+
if (value === null || value === void 0) return "NULL";
|
|
3874
|
+
if (typeof value === "string" && looksJson(value)) {
|
|
3875
|
+
try {
|
|
3876
|
+
return JSON.stringify(JSON.parse(value), null, 2);
|
|
3877
|
+
} catch (e) {
|
|
3878
|
+
return value;
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
if (typeof value === "object") {
|
|
3882
|
+
try {
|
|
3883
|
+
return JSON.stringify(value, null, 2);
|
|
3884
|
+
} catch (e) {
|
|
3885
|
+
return String(value);
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3888
|
+
return String(value);
|
|
3889
|
+
}
|
|
3890
|
+
return { DataView, DOMAIN };
|
|
3891
|
+
};
|
|
3892
|
+
}
|
|
3893
|
+
});
|
|
3894
|
+
|
|
3895
|
+
// packages/addons/vault/client/views/data.cjs
|
|
3896
|
+
var require_data = __commonJS({
|
|
3897
|
+
"packages/addons/vault/client/views/data.cjs"(exports2, module2) {
|
|
3898
|
+
"use strict";
|
|
3899
|
+
var legacy = require_legacy_data()("vault", { paged: true });
|
|
3900
|
+
module2.exports = require_data_view()({
|
|
3901
|
+
domain: "vault",
|
|
3902
|
+
prefix: "wbv",
|
|
3903
|
+
tables: ["vault_secret", "vault_group", "vault_set", "vault_group_set", "vault_set_secret", "vault_binding"],
|
|
3904
|
+
useConfig: function(api, fallback) {
|
|
3905
|
+
return { values: fallback, ready: true };
|
|
3906
|
+
},
|
|
3907
|
+
tablesLoader: legacy.tablesLoader,
|
|
3908
|
+
query: legacy.query
|
|
3909
|
+
}).DataView;
|
|
3910
|
+
}
|
|
3911
|
+
});
|
|
3912
|
+
|
|
3913
|
+
// packages/addons/lib/highlight.cjs
|
|
3914
|
+
var require_highlight = __commonJS({
|
|
3915
|
+
"packages/addons/lib/highlight.cjs"(exports2, module2) {
|
|
3916
|
+
"use strict";
|
|
3917
|
+
module2.exports = function(React) {
|
|
3918
|
+
var h = React.createElement;
|
|
3919
|
+
function sourceOf(keyword) {
|
|
3920
|
+
var pattern = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3921
|
+
return pattern.replace(/[a-zA-Z]/g, function(letter) {
|
|
3922
|
+
return "[" + letter.toLowerCase() + letter.toUpperCase() + "]";
|
|
3923
|
+
});
|
|
3924
|
+
}
|
|
3925
|
+
return function createHighlight(prefix) {
|
|
3926
|
+
var className = String(prefix || "wb") + "-hit";
|
|
3927
|
+
function hit(rawText, rawKeyword) {
|
|
3928
|
+
var text = rawText == null ? "" : String(rawText);
|
|
3929
|
+
var keyword = rawKeyword == null ? "" : String(rawKeyword);
|
|
3930
|
+
if (!keyword) return text;
|
|
3931
|
+
var matcher, match, end = 0, parts = [];
|
|
3932
|
+
try {
|
|
3933
|
+
matcher = new RegExp(sourceOf(keyword), "g");
|
|
3934
|
+
} catch (error) {
|
|
3935
|
+
return text;
|
|
3936
|
+
}
|
|
3937
|
+
while (match = matcher.exec(text)) {
|
|
3938
|
+
if (match.index > end) parts.push(text.slice(end, match.index));
|
|
3939
|
+
parts.push(h("mark", { className, key: match.index }, match[0]));
|
|
3940
|
+
end = match.index + match[0].length;
|
|
3941
|
+
if (!match[0]) matcher.lastIndex += 1;
|
|
3942
|
+
}
|
|
3943
|
+
if (!parts.length) return text;
|
|
3944
|
+
if (end < text.length) parts.push(text.slice(end));
|
|
3945
|
+
return parts;
|
|
3946
|
+
}
|
|
3947
|
+
function Highlight(props) {
|
|
3948
|
+
return hit(props.text, props.keyword);
|
|
3949
|
+
}
|
|
3950
|
+
Highlight.hit = hit;
|
|
3951
|
+
return Highlight;
|
|
3952
|
+
};
|
|
3953
|
+
};
|
|
3954
|
+
}
|
|
3955
|
+
});
|
|
3956
|
+
|
|
3957
|
+
// packages/addons/lib/action-schema-style.cjs
|
|
3958
|
+
var require_action_schema_style = __commonJS({
|
|
3959
|
+
"packages/addons/lib/action-schema-style.cjs"(exports2, module2) {
|
|
3960
|
+
"use strict";
|
|
3961
|
+
module2.exports = function(PREFIX, DOMAIN) {
|
|
3962
|
+
var P = PREFIX + "-as";
|
|
3963
|
+
var CSS = [
|
|
3964
|
+
"." + P + "{display:flex;flex-direction:column;gap:12px;width:100%;min-width:0;font-size:13px;color:inherit}",
|
|
3965
|
+
"." + P + "-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
3966
|
+
"." + P + "-title{font-size:15px;font-weight:660;margin:0}",
|
|
3967
|
+
"." + P + "-badge{display:inline-flex;align-items:center;gap:4px;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}",
|
|
3968
|
+
"." + P + "-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
|
|
3969
|
+
"." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
3970
|
+
"." + P + "-search{position:relative;flex:1 1 220px;min-width:0;display:flex;align-items:center}",
|
|
3971
|
+
"." + 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}",
|
|
3972
|
+
"." + P + "-search input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
3973
|
+
"." + P + "-search .wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
3974
|
+
"." + 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}",
|
|
3975
|
+
"." + P + " select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
3976
|
+
"." + P + "-list{display:flex;flex-direction:column;gap:8px}",
|
|
3977
|
+
"." + 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}",
|
|
3978
|
+
"." + P + "-cardhead{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
3979
|
+
"." + P + "-cardhead code{font-weight:640}",
|
|
3980
|
+
"." + P + "-desc{margin:0;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55;font-size:12.5px}",
|
|
3981
|
+
// 搜索命中:用品牌色透明度叠加而不是写死浅色,深浅主题都可读;继承文字颜色、不覆盖 ::selection。
|
|
3982
|
+
"." + 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}",
|
|
3983
|
+
"." + P + "-table{width:100%;border-collapse:collapse;font-size:12px;table-layout:auto}",
|
|
3984
|
+
"." + 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}",
|
|
3985
|
+
"." + P + "-table td{padding:4px 8px 4px 0;vertical-align:top;border-top:1px solid color-mix(in oklab,currentColor 8%,transparent);line-height:1.5}",
|
|
3986
|
+
"." + P + "-req{color:var(--dsw-alias-state-error-primary,#d9534f);font-weight:620}",
|
|
3987
|
+
"." + P + "-opt{color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
3988
|
+
"." + P + "-none{color:var(--dsw-alias-label-tertiary,inherit);font-size:12px}",
|
|
3989
|
+
"." + P + "-example{position:relative;display:flex;flex-direction:column;gap:4px}",
|
|
3990
|
+
"." + P + "-examplehead{display:flex;align-items:center;justify-content:space-between;gap:8px}",
|
|
3991
|
+
"." + 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}",
|
|
3992
|
+
"." + 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}",
|
|
3993
|
+
"." + P + "-copy:hover{background:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent))}",
|
|
3994
|
+
"." + P + "-copy:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
3995
|
+
"." + P + " details>summary{cursor:pointer;font-size:11.5px;color:var(--dsw-alias-label-secondary,inherit);width:max-content}",
|
|
3996
|
+
"." + P + " details>summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
3997
|
+
"." + P + "-empty{padding:24px;text-align:center;border:1px dashed var(--wb-border,#e3e5e9);border-radius:10px;color:var(--dsw-alias-label-tertiary,inherit)}",
|
|
3998
|
+
"." + 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}",
|
|
3999
|
+
"." + 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}",
|
|
4000
|
+
"@media(max-width:600px){." + P + "-table thead{display:none}." + P + "-table td{display:block;border-top:0;padding:2px 0}." + P + "-table tr{display:block;border-top:1px solid color-mix(in oklab,currentColor 8%,transparent);padding:4px 0}}"
|
|
4001
|
+
].join("\n");
|
|
4002
|
+
return function injectCss() {
|
|
4003
|
+
if (typeof document === "undefined") return;
|
|
4004
|
+
var id = "wb-addon-" + DOMAIN + "-actions-css";
|
|
4005
|
+
var old = document.getElementById(id);
|
|
4006
|
+
if (old) {
|
|
4007
|
+
old.textContent = CSS;
|
|
4008
|
+
return;
|
|
4009
|
+
}
|
|
4010
|
+
var style = document.createElement("style");
|
|
4011
|
+
style.id = id;
|
|
4012
|
+
style.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
|
|
4013
|
+
style.textContent = CSS;
|
|
4014
|
+
document.head.appendChild(style);
|
|
4015
|
+
};
|
|
4016
|
+
};
|
|
4017
|
+
}
|
|
4018
|
+
});
|
|
4019
|
+
|
|
4020
|
+
// packages/addons/lib/action-schema-view.cjs
|
|
4021
|
+
var require_action_schema_view = __commonJS({
|
|
4022
|
+
"packages/addons/lib/action-schema-view.cjs"(exports2, module2) {
|
|
4023
|
+
"use strict";
|
|
4024
|
+
var React = require("react");
|
|
4025
|
+
var createHighlight = require_highlight()(React);
|
|
4026
|
+
var h = React.createElement;
|
|
4027
|
+
var COPY = {
|
|
4028
|
+
zh: {
|
|
4029
|
+
title: "Action",
|
|
4030
|
+
hint: "\u8FD0\u884C\u65F6\u6CE8\u518C \xB7 \u53EA\u8BFB",
|
|
4031
|
+
domain: "\u57DF",
|
|
4032
|
+
versionLabel: "\u7248\u672C",
|
|
4033
|
+
shell: "\u5BBF\u4E3B",
|
|
4034
|
+
count: function(shown, total) {
|
|
4035
|
+
return shown + " / " + total + " \u4E2A action";
|
|
4036
|
+
},
|
|
4037
|
+
search: "\u641C\u7D22\u540D\u79F0\u3001\u63CF\u8FF0\u3001\u53C2\u6570\uFF08\u547D\u4E2D\u5904\u9AD8\u4EAE\uFF09",
|
|
4038
|
+
filterReq: "\u5FC5\u586B\u7B5B\u9009",
|
|
4039
|
+
all: "\u5168\u90E8",
|
|
4040
|
+
onlyRequired: "\u542B\u5FC5\u586B\u9879",
|
|
4041
|
+
onlyOptional: "\u65E0\u5FC5\u586B\u9879",
|
|
4042
|
+
filterType: "\u53C2\u6570\u7C7B\u578B",
|
|
4043
|
+
allTypes: "\u5168\u90E8\u7C7B\u578B",
|
|
4044
|
+
colName: "\u53C2\u6570",
|
|
4045
|
+
colType: "\u7C7B\u578B",
|
|
4046
|
+
colReq: "\u5FC5\u586B",
|
|
4047
|
+
colExtra: "\u9ED8\u8BA4 / \u679A\u4E3E / \u7EA6\u675F",
|
|
4048
|
+
colDesc: "\u8BF4\u660E",
|
|
4049
|
+
required: "\u5FC5\u586B",
|
|
4050
|
+
optional: "\u53EF\u9009",
|
|
4051
|
+
noParams: "\u65E0\u53C2\u6570",
|
|
4052
|
+
paramCount: function(n) {
|
|
4053
|
+
return n + " \u4E2A\u53C2\u6570";
|
|
4054
|
+
},
|
|
4055
|
+
examples: "\u793A\u4F8B",
|
|
4056
|
+
noExamples: "\u65E0\u793A\u4F8B",
|
|
4057
|
+
copy: "\u590D\u5236",
|
|
4058
|
+
copied: "\u5DF2\u590D\u5236",
|
|
4059
|
+
raw: "\u539F\u59CB JSON Schema",
|
|
4060
|
+
loading: "\u8F7D\u5165\u4E2D\u2026",
|
|
4061
|
+
loadFail: "\u8BFB\u53D6 action schema \u5931\u8D25",
|
|
4062
|
+
retry: "\u91CD\u8BD5",
|
|
4063
|
+
empty: "\u6CA1\u6709\u5339\u914D\u7684 action",
|
|
4064
|
+
emptyRegistry: "\u8BE5\u57DF\u6CA1\u6709\u6CE8\u518C action",
|
|
4065
|
+
envelope: "\u9ED8\u8BA4",
|
|
4066
|
+
enumLabel: "\u679A\u4E3E",
|
|
4067
|
+
range: "\u8303\u56F4",
|
|
4068
|
+
length: "\u957F\u5EA6",
|
|
4069
|
+
pattern: "\u6B63\u5219",
|
|
4070
|
+
format: "\u683C\u5F0F",
|
|
4071
|
+
items: "\u5143\u7D20\u6570"
|
|
4072
|
+
},
|
|
4073
|
+
en: {
|
|
4074
|
+
title: "Actions",
|
|
4075
|
+
hint: "runtime registry \xB7 read-only",
|
|
4076
|
+
domain: "Domain",
|
|
4077
|
+
versionLabel: "Version",
|
|
4078
|
+
shell: "Host",
|
|
4079
|
+
count: function(shown, total) {
|
|
4080
|
+
return shown + " / " + total + " actions";
|
|
4081
|
+
},
|
|
4082
|
+
search: "Search name, description, params (matches highlighted)",
|
|
4083
|
+
filterReq: "Required",
|
|
4084
|
+
all: "All",
|
|
4085
|
+
onlyRequired: "Has required",
|
|
4086
|
+
onlyOptional: "No required",
|
|
4087
|
+
filterType: "Param type",
|
|
4088
|
+
allTypes: "All types",
|
|
4089
|
+
colName: "Param",
|
|
4090
|
+
colType: "Type",
|
|
4091
|
+
colReq: "Required",
|
|
4092
|
+
colExtra: "Default / enum / constraints",
|
|
4093
|
+
colDesc: "Description",
|
|
4094
|
+
required: "required",
|
|
4095
|
+
optional: "optional",
|
|
4096
|
+
noParams: "No parameters",
|
|
4097
|
+
paramCount: function(n) {
|
|
4098
|
+
return n + " params";
|
|
4099
|
+
},
|
|
4100
|
+
examples: "Examples",
|
|
4101
|
+
noExamples: "No examples",
|
|
4102
|
+
copy: "Copy",
|
|
4103
|
+
copied: "Copied",
|
|
4104
|
+
raw: "Raw JSON Schema",
|
|
4105
|
+
loading: "Loading\u2026",
|
|
4106
|
+
loadFail: "Failed to read action schema",
|
|
4107
|
+
retry: "Retry",
|
|
4108
|
+
empty: "No matching action",
|
|
4109
|
+
emptyRegistry: "This domain has no registered action",
|
|
4110
|
+
envelope: "Default",
|
|
4111
|
+
enumLabel: "Enum",
|
|
4112
|
+
range: "Range",
|
|
4113
|
+
length: "Length",
|
|
4114
|
+
pattern: "Pattern",
|
|
4115
|
+
format: "Format",
|
|
4116
|
+
items: "Items"
|
|
4117
|
+
}
|
|
4118
|
+
};
|
|
4119
|
+
function typeLabel(schema) {
|
|
4120
|
+
if (!schema || typeof schema !== "object") return "";
|
|
4121
|
+
if (Array.isArray(schema.type)) return schema.type.join(" | ");
|
|
4122
|
+
if (typeof schema.type === "string") {
|
|
4123
|
+
if (schema.type === "array" && schema.items) {
|
|
4124
|
+
var inner = typeLabel(schema.items);
|
|
4125
|
+
return inner ? inner + "[]" : "array";
|
|
4126
|
+
}
|
|
4127
|
+
return schema.type;
|
|
4128
|
+
}
|
|
4129
|
+
if (Array.isArray(schema.oneOf)) return schema.oneOf.map(typeLabel).filter(Boolean).join(" | ");
|
|
4130
|
+
if (Array.isArray(schema.anyOf)) return schema.anyOf.map(typeLabel).filter(Boolean).join(" | ");
|
|
4131
|
+
return "";
|
|
4132
|
+
}
|
|
4133
|
+
function typeNames(schema) {
|
|
4134
|
+
var label = typeLabel(schema);
|
|
4135
|
+
if (!label) return [];
|
|
4136
|
+
return label.split("|").map(function(x) {
|
|
4137
|
+
return x.trim().replace(/\[\]$/, "");
|
|
4138
|
+
}).filter(Boolean);
|
|
4139
|
+
}
|
|
4140
|
+
function scalar(value) {
|
|
4141
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
4142
|
+
return String(value);
|
|
4143
|
+
}
|
|
4144
|
+
function extraText(schema, t) {
|
|
4145
|
+
if (!schema || typeof schema !== "object") return "";
|
|
4146
|
+
var parts = [];
|
|
4147
|
+
if (Object.prototype.hasOwnProperty.call(schema, "default")) {
|
|
4148
|
+
parts.push(t.envelope + " " + scalar(schema.default));
|
|
4149
|
+
}
|
|
4150
|
+
if (Array.isArray(schema.enum)) {
|
|
4151
|
+
parts.push(t.enumLabel + " " + schema.enum.map(scalar).join(" / "));
|
|
4152
|
+
}
|
|
4153
|
+
if (typeof schema.minimum === "number" || typeof schema.maximum === "number") {
|
|
4154
|
+
var lo = typeof schema.minimum === "number" ? schema.minimum : null;
|
|
4155
|
+
var hi = typeof schema.maximum === "number" ? schema.maximum : null;
|
|
4156
|
+
if (lo !== null && hi !== null) parts.push(t.range + " \u2265" + lo + " \u4E14 \u2264" + hi);
|
|
4157
|
+
else if (lo !== null) parts.push(t.range + " \u2265" + lo);
|
|
4158
|
+
else parts.push(t.range + " \u2264" + hi);
|
|
4159
|
+
}
|
|
4160
|
+
if (typeof schema.minLength === "number" || typeof schema.maxLength === "number") {
|
|
4161
|
+
parts.push(t.length + " " + (schema.minLength ?? 0) + "\u2013" + (schema.maxLength ?? "\u221E"));
|
|
4162
|
+
}
|
|
4163
|
+
if (typeof schema.minItems === "number" || typeof schema.maxItems === "number") {
|
|
4164
|
+
parts.push(t.items + " " + (schema.minItems ?? 0) + "\u2013" + (schema.maxItems ?? "\u221E"));
|
|
4165
|
+
}
|
|
4166
|
+
if (typeof schema.pattern === "string") parts.push(t.pattern + " " + schema.pattern);
|
|
4167
|
+
if (typeof schema.format === "string") parts.push(t.format + " " + schema.format);
|
|
4168
|
+
return parts.join(" \xB7 ");
|
|
4169
|
+
}
|
|
4170
|
+
function paramRows(action) {
|
|
4171
|
+
var input = action && action.input && typeof action.input === "object" ? action.input : {};
|
|
4172
|
+
var props = input.properties && typeof input.properties === "object" ? input.properties : {};
|
|
4173
|
+
var required = Array.isArray(input.required) ? input.required : [];
|
|
4174
|
+
return Object.keys(props).map(function(key) {
|
|
4175
|
+
var schema = props[key] && typeof props[key] === "object" ? props[key] : {};
|
|
4176
|
+
return {
|
|
4177
|
+
name: key,
|
|
4178
|
+
schema,
|
|
4179
|
+
type: typeLabel(schema),
|
|
4180
|
+
types: typeNames(schema),
|
|
4181
|
+
required: required.indexOf(key) >= 0,
|
|
4182
|
+
description: typeof schema.description === "string" ? schema.description : ""
|
|
4183
|
+
};
|
|
4184
|
+
});
|
|
4185
|
+
}
|
|
4186
|
+
module2.exports = function createActionSchemaView(options) {
|
|
4187
|
+
var raw = String(options.domain || "");
|
|
4188
|
+
var DOMAIN = raw.indexOf("wb-addon-") === 0 ? raw : "wb-addon-" + raw;
|
|
4189
|
+
var prefix = options.prefix;
|
|
4190
|
+
var P = prefix + "-as";
|
|
4191
|
+
var Icon2 = options.Icon || null;
|
|
4192
|
+
var injectCss = require_action_schema_style()(prefix, DOMAIN);
|
|
4193
|
+
var Highlight = createHighlight(P);
|
|
4194
|
+
function icon(name, size) {
|
|
4195
|
+
return Icon2 ? h(Icon2, { name, size: size || 14 }) : null;
|
|
4196
|
+
}
|
|
4197
|
+
function plainCopy(text) {
|
|
4198
|
+
if (typeof document === "undefined") return;
|
|
4199
|
+
var area = document.createElement("textarea");
|
|
4200
|
+
area.value = text;
|
|
4201
|
+
area.setAttribute("readonly", "readonly");
|
|
4202
|
+
area.style.position = "fixed";
|
|
4203
|
+
area.style.opacity = "0";
|
|
4204
|
+
document.body.appendChild(area);
|
|
4205
|
+
area.select();
|
|
4206
|
+
try {
|
|
4207
|
+
document.execCommand("copy");
|
|
4208
|
+
} catch (e) {
|
|
4209
|
+
}
|
|
4210
|
+
document.body.removeChild(area);
|
|
4211
|
+
}
|
|
4212
|
+
function ActionSchemaView(props) {
|
|
4213
|
+
var lang = props.lang === "en" ? "en" : "zh";
|
|
4214
|
+
var t = COPY[lang];
|
|
4215
|
+
var api = props.api;
|
|
4216
|
+
var snapState = React.useState(null);
|
|
4217
|
+
var snap = snapState[0], setSnap = snapState[1];
|
|
4218
|
+
var errState = React.useState("");
|
|
4219
|
+
var err = errState[0], setErr = errState[1];
|
|
4220
|
+
var loadingState = React.useState(true);
|
|
4221
|
+
var loading = loadingState[0], setLoading = loadingState[1];
|
|
4222
|
+
var reloadState = React.useState(0);
|
|
4223
|
+
var reload = reloadState[0], setReload = reloadState[1];
|
|
4224
|
+
var queryState = React.useState("");
|
|
4225
|
+
var query = queryState[0], setQuery = queryState[1];
|
|
4226
|
+
var reqState = React.useState("all");
|
|
4227
|
+
var reqMode = reqState[0], setReqMode = reqState[1];
|
|
4228
|
+
var typeState = React.useState("");
|
|
4229
|
+
var typePick = typeState[0], setTypePick = typeState[1];
|
|
4230
|
+
var toastState = React.useState("");
|
|
4231
|
+
var toast = toastState[0], setToast = toastState[1];
|
|
4232
|
+
React.useEffect(function() {
|
|
4233
|
+
injectCss();
|
|
4234
|
+
}, []);
|
|
4235
|
+
React.useEffect(function() {
|
|
4236
|
+
var alive = true;
|
|
4237
|
+
setLoading(true);
|
|
4238
|
+
setErr("");
|
|
4239
|
+
var pending;
|
|
4240
|
+
var actionName = DOMAIN.replace(/^wb-addon-/, "") + ".actionSchema";
|
|
4241
|
+
if (api && typeof api.call === "function") {
|
|
4242
|
+
pending = Promise.resolve(api.call(actionName)).then(function(r) {
|
|
4243
|
+
if (r && r.ok === false) return r;
|
|
4244
|
+
return r && r.result || r;
|
|
4245
|
+
});
|
|
4246
|
+
} else {
|
|
4247
|
+
pending = Promise.reject(new Error("no call api"));
|
|
4248
|
+
}
|
|
4249
|
+
Promise.resolve(pending).then(function(r) {
|
|
4250
|
+
if (!alive) return;
|
|
4251
|
+
if (!r || r.ok === false) {
|
|
4252
|
+
setSnap(null);
|
|
4253
|
+
setErr(String(r && (r.error || r.text) || t.loadFail));
|
|
4254
|
+
} else {
|
|
4255
|
+
setSnap(r);
|
|
4256
|
+
}
|
|
4257
|
+
setLoading(false);
|
|
4258
|
+
}, function(e) {
|
|
4259
|
+
if (!alive) return;
|
|
4260
|
+
setSnap(null);
|
|
4261
|
+
setErr(String(e && e.message || e || t.loadFail));
|
|
4262
|
+
setLoading(false);
|
|
4263
|
+
});
|
|
4264
|
+
return function() {
|
|
4265
|
+
alive = false;
|
|
4266
|
+
};
|
|
4267
|
+
}, [reload]);
|
|
4268
|
+
function copy(text) {
|
|
4269
|
+
var done = function() {
|
|
4270
|
+
setToast(t.copied);
|
|
4271
|
+
};
|
|
4272
|
+
if (typeof navigator !== "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText === "function") {
|
|
4273
|
+
navigator.clipboard.writeText(text).then(done, function() {
|
|
4274
|
+
plainCopy(text);
|
|
4275
|
+
done();
|
|
4276
|
+
});
|
|
4277
|
+
return;
|
|
4278
|
+
}
|
|
4279
|
+
plainCopy(text);
|
|
4280
|
+
done();
|
|
4281
|
+
}
|
|
4282
|
+
var all = snap && Array.isArray(snap.actions) ? snap.actions.filter(function(a) {
|
|
4283
|
+
return a && a.domain === DOMAIN;
|
|
4284
|
+
}) : [];
|
|
4285
|
+
var info = snap && Array.isArray(snap.domains) ? snap.domains.filter(function(d) {
|
|
4286
|
+
return d && d.id === DOMAIN;
|
|
4287
|
+
})[0] || null : null;
|
|
4288
|
+
var typeOptions = [];
|
|
4289
|
+
all.forEach(function(a) {
|
|
4290
|
+
paramRows(a).forEach(function(row) {
|
|
4291
|
+
row.types.forEach(function(name) {
|
|
4292
|
+
if (typeOptions.indexOf(name) < 0) typeOptions.push(name);
|
|
4293
|
+
});
|
|
4294
|
+
});
|
|
4295
|
+
});
|
|
4296
|
+
typeOptions.sort();
|
|
4297
|
+
var kw = String(query || "").trim();
|
|
4298
|
+
var q = kw.toLowerCase();
|
|
4299
|
+
var visible = all.filter(function(a) {
|
|
4300
|
+
var rows = paramRows(a);
|
|
4301
|
+
if (q) {
|
|
4302
|
+
var hay = [a.name || "", a.description || ""].concat(rows.map(function(row) {
|
|
4303
|
+
return row.name + " " + row.type + " " + row.description;
|
|
4304
|
+
})).join(" ").toLowerCase();
|
|
4305
|
+
if (hay.indexOf(q) < 0) return false;
|
|
4306
|
+
}
|
|
4307
|
+
var hasRequired = rows.some(function(row) {
|
|
4308
|
+
return row.required;
|
|
4309
|
+
});
|
|
4310
|
+
if (reqMode === "required" && !hasRequired) return false;
|
|
4311
|
+
if (reqMode === "optional" && hasRequired) return false;
|
|
4312
|
+
if (typePick && !rows.some(function(row) {
|
|
4313
|
+
return row.types.indexOf(typePick) >= 0;
|
|
4314
|
+
})) return false;
|
|
4315
|
+
return true;
|
|
4316
|
+
});
|
|
4317
|
+
function paramRow(row) {
|
|
4318
|
+
var extra = extraText(row.schema, t);
|
|
4319
|
+
return h(
|
|
4320
|
+
"tr",
|
|
4321
|
+
{ key: row.name },
|
|
4322
|
+
h("td", { className: P + "-mono" }, Highlight.hit(row.name, kw)),
|
|
4323
|
+
h("td", { className: P + "-mono" }, Highlight.hit(row.type, kw)),
|
|
4324
|
+
h("td", { className: row.required ? P + "-req" : P + "-opt" }, row.required ? t.required : t.optional),
|
|
4325
|
+
// extra(默认 / 枚举 / 约束)不在过滤 haystack 里,因此也不高亮,保持「显示即命中」口径。
|
|
4326
|
+
h("td", { className: P + "-mono" }, extra),
|
|
4327
|
+
h("td", null, Highlight.hit(row.description, kw))
|
|
4328
|
+
);
|
|
4329
|
+
}
|
|
4330
|
+
function card(action) {
|
|
4331
|
+
var rows = paramRows(action);
|
|
4332
|
+
var examples = Array.isArray(action.examples) ? action.examples : [];
|
|
4333
|
+
return h(
|
|
4334
|
+
"div",
|
|
4335
|
+
{ className: P + "-card", key: action.name },
|
|
4336
|
+
h(
|
|
4337
|
+
"div",
|
|
4338
|
+
{ className: P + "-cardhead" },
|
|
4339
|
+
h("code", { className: P + "-mono" }, Highlight.hit(action.name, kw)),
|
|
4340
|
+
// 域名在页头已展示一次,卡片内不再重复(所有条目必然同域,见 visible 过滤)。
|
|
4341
|
+
h("span", { className: P + "-badge" }, rows.length ? t.paramCount(rows.length) : t.noParams),
|
|
4342
|
+
rows.some(function(row) {
|
|
4343
|
+
return row.required;
|
|
4344
|
+
}) ? h("span", { className: P + "-badge " + P + "-req" }, t.required) : null
|
|
4345
|
+
),
|
|
4346
|
+
action.description ? h("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
|
|
4347
|
+
rows.length ? h(
|
|
4348
|
+
"table",
|
|
4349
|
+
{ className: P + "-table" },
|
|
4350
|
+
h("thead", null, h(
|
|
4351
|
+
"tr",
|
|
4352
|
+
null,
|
|
4353
|
+
h("th", null, t.colName),
|
|
4354
|
+
h("th", null, t.colType),
|
|
4355
|
+
h("th", null, t.colReq),
|
|
4356
|
+
h("th", null, t.colExtra),
|
|
4357
|
+
h("th", null, t.colDesc)
|
|
4358
|
+
)),
|
|
4359
|
+
h("tbody", null, rows.map(paramRow))
|
|
4360
|
+
) : h("div", { className: P + "-none" }, t.noParams),
|
|
4361
|
+
h(
|
|
4362
|
+
"div",
|
|
4363
|
+
{ className: P + "-example" },
|
|
4364
|
+
h(
|
|
4365
|
+
"div",
|
|
4366
|
+
{ className: P + "-examplehead" },
|
|
4367
|
+
h("span", { className: P + "-none" }, t.examples),
|
|
4368
|
+
examples.length ? h("button", {
|
|
4369
|
+
type: "button",
|
|
4370
|
+
className: P + "-copy",
|
|
4371
|
+
"data-copy-example": action.name,
|
|
4372
|
+
onClick: function() {
|
|
4373
|
+
copy(JSON.stringify(examples.length === 1 ? examples[0] : examples, null, 2));
|
|
4374
|
+
}
|
|
4375
|
+
}, t.copy) : null
|
|
4376
|
+
),
|
|
4377
|
+
examples.length ? examples.map(function(example, index) {
|
|
4378
|
+
return h("pre", { className: P + "-pre", key: index }, JSON.stringify(example, null, 2));
|
|
4379
|
+
}) : h("div", { className: P + "-none" }, t.noExamples)
|
|
4380
|
+
),
|
|
4381
|
+
h(
|
|
4382
|
+
"details",
|
|
4383
|
+
null,
|
|
4384
|
+
h("summary", null, t.raw),
|
|
4385
|
+
h("pre", { className: P + "-pre" }, JSON.stringify(action.input || {}, null, 2))
|
|
4386
|
+
)
|
|
4387
|
+
);
|
|
4388
|
+
}
|
|
4389
|
+
var body;
|
|
4390
|
+
if (loading) {
|
|
4391
|
+
body = h("div", { className: P + "-empty", role: "status" }, t.loading);
|
|
4392
|
+
} else if (err) {
|
|
4393
|
+
body = h(
|
|
4394
|
+
"div",
|
|
4395
|
+
{ className: P + "-error", role: "alert" },
|
|
4396
|
+
h("span", null, t.loadFail + "\uFF1A" + err),
|
|
4397
|
+
h("button", { type: "button", className: P + "-copy", onClick: function() {
|
|
4398
|
+
setReload(reload + 1);
|
|
4399
|
+
} }, t.retry)
|
|
4400
|
+
);
|
|
4401
|
+
} else if (!all.length) {
|
|
4402
|
+
body = h("div", { className: P + "-empty" }, t.emptyRegistry);
|
|
4403
|
+
} else if (!visible.length) {
|
|
4404
|
+
body = h("div", { className: P + "-empty" }, t.empty);
|
|
4405
|
+
} else {
|
|
4406
|
+
body = h("div", { className: P + "-list" }, visible.map(card));
|
|
4407
|
+
}
|
|
4408
|
+
return h(
|
|
4409
|
+
"div",
|
|
4410
|
+
{ className: P },
|
|
4411
|
+
h(
|
|
4412
|
+
"div",
|
|
4413
|
+
{ className: P + "-head" },
|
|
4414
|
+
h("h3", { className: P + "-title" }, t.title),
|
|
4415
|
+
h("span", { className: P + "-badge" }, t.domain + " " + DOMAIN),
|
|
4416
|
+
info && info.version ? h("span", { className: P + "-badge" }, t.versionLabel + " v" + info.version) : null,
|
|
4417
|
+
snap && snap.shellVersion ? h("span", { className: P + "-badge" }, t.shell + " v" + snap.shellVersion) : null,
|
|
4418
|
+
h("span", { className: P + "-badge" }, t.count(visible.length, all.length)),
|
|
4419
|
+
h("span", { className: P + "-none" }, t.hint)
|
|
4420
|
+
),
|
|
4421
|
+
snap ? h(
|
|
4422
|
+
"div",
|
|
4423
|
+
{ className: P + "-toolbar" },
|
|
4424
|
+
h(
|
|
4425
|
+
"label",
|
|
4426
|
+
{ className: P + "-search" },
|
|
4427
|
+
icon("search", 14),
|
|
4428
|
+
h("input", {
|
|
4429
|
+
type: "search",
|
|
4430
|
+
value: query,
|
|
4431
|
+
placeholder: t.search,
|
|
4432
|
+
"aria-label": t.search,
|
|
4433
|
+
onChange: function(e) {
|
|
4434
|
+
setQuery(e.target.value);
|
|
4435
|
+
}
|
|
4436
|
+
})
|
|
4437
|
+
),
|
|
4438
|
+
h(
|
|
4439
|
+
"label",
|
|
4440
|
+
{ className: P + "-none" },
|
|
4441
|
+
t.filterReq + " ",
|
|
4442
|
+
h(
|
|
4443
|
+
"select",
|
|
4444
|
+
{ value: reqMode, "aria-label": t.filterReq, onChange: function(e) {
|
|
4445
|
+
setReqMode(e.target.value);
|
|
4446
|
+
} },
|
|
4447
|
+
h("option", { value: "all" }, t.all),
|
|
4448
|
+
h("option", { value: "required" }, t.onlyRequired),
|
|
4449
|
+
h("option", { value: "optional" }, t.onlyOptional)
|
|
4450
|
+
)
|
|
4451
|
+
),
|
|
4452
|
+
h(
|
|
4453
|
+
"label",
|
|
4454
|
+
{ className: P + "-none" },
|
|
4455
|
+
t.filterType + " ",
|
|
4456
|
+
h(
|
|
4457
|
+
"select",
|
|
4458
|
+
{ value: typePick, "aria-label": t.filterType, onChange: function(e) {
|
|
4459
|
+
setTypePick(e.target.value);
|
|
4460
|
+
} },
|
|
4461
|
+
h("option", { value: "" }, t.allTypes),
|
|
4462
|
+
typeOptions.map(function(name) {
|
|
4463
|
+
return h("option", { value: name, key: name }, name);
|
|
4464
|
+
})
|
|
4465
|
+
)
|
|
4466
|
+
)
|
|
4467
|
+
) : null,
|
|
4468
|
+
body,
|
|
4469
|
+
toast ? h("div", { className: P + "-toast", role: "status" }, toast) : null
|
|
4470
|
+
);
|
|
4471
|
+
}
|
|
4472
|
+
return { ActionSchemaView, DOMAIN, typeLabel, paramRows };
|
|
4473
|
+
};
|
|
4474
|
+
}
|
|
4475
|
+
});
|
|
4476
|
+
|
|
4477
|
+
// packages/addons/vault/client/views/actions.cjs
|
|
4478
|
+
var require_actions = __commonJS({
|
|
4479
|
+
"packages/addons/vault/client/views/actions.cjs"(exports2, module2) {
|
|
4480
|
+
"use strict";
|
|
4481
|
+
module2.exports = require_action_schema_view()({
|
|
4482
|
+
domain: "wb-addon-vault",
|
|
4483
|
+
prefix: "wbv"
|
|
4484
|
+
}).ActionSchemaView;
|
|
4485
|
+
}
|
|
4486
|
+
});
|
|
4487
|
+
|
|
4488
|
+
// packages/addons/vault/client/client.src.cjs
|
|
4489
|
+
(function() {
|
|
4490
|
+
var root = typeof window !== "undefined" ? window : null;
|
|
4491
|
+
var host = root && root.__WB_HOST__;
|
|
4492
|
+
if (!host || !host.react) {
|
|
4493
|
+
if (typeof console !== "undefined") console.error("[dsh-workbench-vault] \u5BBF\u4E3B\u524D\u7AEF\u672A\u5C31\u7EEA\uFF0C\u65E0\u6CD5\u6CE8\u518C\u63D2\u4EF6\u754C\u9762");
|
|
4494
|
+
module.exports = { name: "dsh-workbench-vault", inject: [], apply: function() {
|
|
4495
|
+
} };
|
|
4496
|
+
return;
|
|
4497
|
+
}
|
|
4498
|
+
var React = host.react;
|
|
4499
|
+
var h = host.h;
|
|
4500
|
+
var CSS_ARR = require_styles();
|
|
4501
|
+
var CSS = Array.isArray(CSS_ARR) ? CSS_ARR.join("\n") : String(CSS_ARR || "");
|
|
4502
|
+
var ICONS = {
|
|
4503
|
+
shield: (init_shield(), __toCommonJS(shield_exports)).default,
|
|
4504
|
+
key: (init_key_round(), __toCommonJS(key_round_exports)).default,
|
|
4505
|
+
folder: (init_folder(), __toCommonJS(folder_exports)).default,
|
|
4506
|
+
sliders: (init_sliders_horizontal(), __toCommonJS(sliders_horizontal_exports)).default,
|
|
4507
|
+
database: (init_database(), __toCommonJS(database_exports)).default,
|
|
4508
|
+
list: (init_list(), __toCommonJS(list_exports)).default,
|
|
4509
|
+
layers: (init_layers(), __toCommonJS(layers_exports)).default
|
|
4510
|
+
};
|
|
4511
|
+
function Icon2(props) {
|
|
4512
|
+
var C = ICONS[props.name] || ICONS.shield;
|
|
4513
|
+
return h(C, { size: props.size || 14, strokeWidth: 2, "aria-hidden": "true", className: "wbg-svg" });
|
|
4514
|
+
}
|
|
4515
|
+
function tabIcon(name) {
|
|
4516
|
+
return function() {
|
|
4517
|
+
return h(Icon2, { name, size: 14 });
|
|
4518
|
+
};
|
|
4519
|
+
}
|
|
4520
|
+
function withProps(Inner, title) {
|
|
4521
|
+
return function Wrapped(props) {
|
|
4522
|
+
return h(Inner, {
|
|
4523
|
+
api: props.api,
|
|
4524
|
+
lang: props.lang === "en" ? "en" : "zh",
|
|
4525
|
+
h,
|
|
4526
|
+
React,
|
|
4527
|
+
title
|
|
4528
|
+
});
|
|
4529
|
+
};
|
|
4530
|
+
}
|
|
4531
|
+
function ensureStyles() {
|
|
4532
|
+
if (typeof document === "undefined" || !document.head) return;
|
|
4533
|
+
if (document.getElementById("wb-vault-style")) return;
|
|
4534
|
+
var style = document.createElement("style");
|
|
4535
|
+
style.id = "wb-vault-style";
|
|
4536
|
+
style.textContent = CSS;
|
|
4537
|
+
document.head.appendChild(style);
|
|
4538
|
+
}
|
|
4539
|
+
ensureStyles();
|
|
4540
|
+
host.registerAddon({
|
|
4541
|
+
id: "wb-addon-vault",
|
|
4542
|
+
version: "0.3.5",
|
|
4543
|
+
icon: (init_shield_check(), __toCommonJS(shield_check_exports)).default,
|
|
4544
|
+
views: [
|
|
4545
|
+
{ id: "status", icon: tabIcon("shield"), title: { zh: "\u4FDD\u9669\u7BB1", en: "Vault" }, component: withProps(require_status(), "\u4FDD\u9669\u7BB1") },
|
|
4546
|
+
{ id: "secrets", icon: tabIcon("key"), title: { zh: "\u51ED\u636E", en: "Secrets" }, component: withProps(require_secrets(), "\u51ED\u636E") },
|
|
4547
|
+
{ id: "sets", icon: tabIcon("layers"), title: { zh: "\u96C6\u5408", en: "Sets" }, component: withProps(require_sets(), "\u96C6\u5408") },
|
|
4548
|
+
{ id: "groups", icon: tabIcon("folder"), title: { zh: "\u5206\u7EC4\u4E0E\u5173\u8054", en: "Groups" }, component: withProps(require_groups(), "\u5206\u7EC4\u4E0E\u5173\u8054") },
|
|
4549
|
+
{ id: "config", icon: tabIcon("sliders"), title: { zh: "\u8BBE\u7F6E", en: "Settings" }, component: withProps(require_config(), "\u8BBE\u7F6E") },
|
|
4550
|
+
{ id: "data", icon: tabIcon("database"), title: { zh: "\u6570\u636E", en: "Data" }, component: withProps(require_data(), "\u6570\u636E") },
|
|
4551
|
+
{ id: "actions", icon: tabIcon("list"), title: { zh: "Action", en: "Actions" }, component: withProps(require_actions(), "Action") }
|
|
4552
|
+
]
|
|
4553
|
+
});
|
|
4554
|
+
module.exports = { name: "dsh-workbench-vault", inject: [], apply: function() {
|
|
4555
|
+
} };
|
|
4556
|
+
})();
|
|
4557
|
+
return module.exports;
|
|
4558
|
+
},
|
|
4559
|
+
});
|