dsh-workbench-tasks 5.2.26 → 5.2.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +1316 -581
- package/lib/index.js +2 -2
- package/lib/task/read/task-query.js +64 -0
- package/lib/task/read/task-search-schema.js +4 -1
- package/lib/task/write/task-operations.js +3 -0
- package/lib/tasks.js +3 -3
- package/package.json +3 -3
package/lib/client.js
CHANGED
|
@@ -186,145 +186,335 @@ var require_filter_checklist = __commonJS({
|
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
188
|
|
|
189
|
-
// packages/addons/
|
|
190
|
-
var
|
|
191
|
-
"packages/addons/
|
|
189
|
+
// packages/addons/lib/tag-filter.cjs
|
|
190
|
+
var require_tag_filter = __commonJS({
|
|
191
|
+
"packages/addons/lib/tag-filter.cjs"(exports2, module2) {
|
|
192
|
+
"use strict";
|
|
192
193
|
var React = require("react");
|
|
193
194
|
var h = React.createElement;
|
|
194
195
|
var FilterChecklist = require_filter_checklist();
|
|
195
|
-
module2.exports = function
|
|
196
|
-
var
|
|
197
|
-
var
|
|
198
|
-
var
|
|
199
|
-
var
|
|
200
|
-
var
|
|
201
|
-
var
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
var optsS = React.useState({ tags: [], total: 0, pageNumber: 0, hasMore: false });
|
|
208
|
-
var opts = optsS[0], setOpts = optsS[1];
|
|
209
|
-
var loadingS = React.useState(false);
|
|
210
|
-
var loading = loadingS[0], setLoading = loadingS[1];
|
|
211
|
-
var namesS = React.useState({});
|
|
212
|
-
var names = namesS[0], setNames = namesS[1];
|
|
213
|
-
var load = React.useCallback(function(text, pageNumber, append) {
|
|
214
|
-
setLoading(true);
|
|
215
|
-
return api.call("tasks.tagOptions", { text: text || "", pageNumber, pageSize: 20 }).then(function(r) {
|
|
216
|
-
setLoading(false);
|
|
217
|
-
if (!r || !r.ok) return;
|
|
218
|
-
var out = r.result || {};
|
|
219
|
-
setOpts(function(prev) {
|
|
220
|
-
var tags = append ? (prev.tags || []).concat(out.tags || []) : out.tags || [];
|
|
221
|
-
return { tags, total: out.total || 0, pageNumber: out.pageNumber || pageNumber, hasMore: !!out.hasMore };
|
|
222
|
-
});
|
|
223
|
-
setNames(function(prev) {
|
|
224
|
-
var next = Object.assign({}, prev);
|
|
225
|
-
(out.tags || []).forEach(function(x) {
|
|
226
|
-
next[String(x.id)] = x.name;
|
|
227
|
-
});
|
|
228
|
-
return next;
|
|
229
|
-
});
|
|
230
|
-
}).catch(function() {
|
|
231
|
-
setLoading(false);
|
|
232
|
-
});
|
|
233
|
-
}, [api]);
|
|
234
|
-
React.useEffect(function() {
|
|
235
|
-
if (!open) return;
|
|
236
|
-
var timer = setTimeout(function() {
|
|
237
|
-
load(query, 1, false);
|
|
238
|
-
}, query ? 200 : 0);
|
|
239
|
-
return function() {
|
|
240
|
-
clearTimeout(timer);
|
|
241
|
-
};
|
|
242
|
-
}, [open, query, load, props.reloadKey]);
|
|
243
|
-
React.useEffect(function() {
|
|
244
|
-
if (!open) return void 0;
|
|
245
|
-
function onKey(e) {
|
|
246
|
-
if (e.key === "Escape") setOpen(false);
|
|
247
|
-
}
|
|
248
|
-
document.addEventListener("keydown", onKey);
|
|
249
|
-
return function() {
|
|
250
|
-
document.removeEventListener("keydown", onKey);
|
|
196
|
+
module2.exports = function createTagFilter(options) {
|
|
197
|
+
var conf = options || {};
|
|
198
|
+
var classes = conf.classes || {};
|
|
199
|
+
var pageSize = conf.pageSize || 20;
|
|
200
|
+
var debounce = conf.debounce === void 0 ? 200 : conf.debounce;
|
|
201
|
+
var dedupe = conf.dedupe !== false;
|
|
202
|
+
var mapPage = conf.mapPage || function(out, pageNumber) {
|
|
203
|
+
return {
|
|
204
|
+
rows: out.records || [],
|
|
205
|
+
total: out.total || 0,
|
|
206
|
+
page: out.current || pageNumber,
|
|
207
|
+
hasMore: !!out.hasNext
|
|
251
208
|
};
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}).catch(function() {
|
|
209
|
+
};
|
|
210
|
+
var items = conf.items || function(rows) {
|
|
211
|
+
return rows.map(function(x) {
|
|
212
|
+
return { id: x.id, name: x.name };
|
|
257
213
|
});
|
|
258
|
-
}
|
|
259
|
-
function
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
open
|
|
214
|
+
};
|
|
215
|
+
var text = conf.text || function() {
|
|
216
|
+
return {};
|
|
217
|
+
};
|
|
218
|
+
var icon = conf.icon || function() {
|
|
219
|
+
return null;
|
|
220
|
+
};
|
|
221
|
+
var caret = conf.caret === void 0 ? "\u25BE" : conf.caret;
|
|
222
|
+
var enabled = conf.enabled || function() {
|
|
223
|
+
return true;
|
|
224
|
+
};
|
|
225
|
+
var renderSelected = conf.renderSelected || null;
|
|
226
|
+
return function TagFilter(props) {
|
|
227
|
+
var api = props.api;
|
|
228
|
+
var ids = props.ids || [];
|
|
229
|
+
var onChange = props.onChange || function() {
|
|
230
|
+
};
|
|
231
|
+
var t = text(props);
|
|
232
|
+
var availS = React.useState(true);
|
|
233
|
+
var openS = React.useState(false);
|
|
234
|
+
var open = openS[0];
|
|
235
|
+
var setOpen = openS[1];
|
|
236
|
+
var queryS = React.useState("");
|
|
237
|
+
var query = queryS[0];
|
|
238
|
+
var setQuery = queryS[1];
|
|
239
|
+
var rowsS = React.useState([]);
|
|
240
|
+
var rows = rowsS[0];
|
|
241
|
+
var setRows = rowsS[1];
|
|
242
|
+
var totalS = React.useState(0);
|
|
243
|
+
var total = totalS[0];
|
|
244
|
+
var setTotal = totalS[1];
|
|
245
|
+
var pageS = React.useState(0);
|
|
246
|
+
var page = pageS[0];
|
|
247
|
+
var setPage = pageS[1];
|
|
248
|
+
var hasMoreS = React.useState(false);
|
|
249
|
+
var hasMore = hasMoreS[0];
|
|
250
|
+
var setHasMore = hasMoreS[1];
|
|
251
|
+
var loadingS = React.useState(false);
|
|
252
|
+
var loading = loadingS[0];
|
|
253
|
+
var setLoading = loadingS[1];
|
|
254
|
+
var namesS = React.useState({});
|
|
255
|
+
var names = namesS[0];
|
|
256
|
+
var setNames = namesS[1];
|
|
257
|
+
var seq = React.useRef(0);
|
|
258
|
+
var load = React.useCallback(
|
|
259
|
+
function(q, pageNumber, append) {
|
|
260
|
+
var mine = ++seq.current;
|
|
261
|
+
setLoading(true);
|
|
262
|
+
return api.call(conf.action, { text: q || "", pageNumber, pageSize }).then(function(r) {
|
|
263
|
+
if (mine !== seq.current) return;
|
|
264
|
+
setLoading(false);
|
|
265
|
+
if (!r || !r.ok) return;
|
|
266
|
+
var next = mapPage(r.result || {}, pageNumber);
|
|
267
|
+
setRows(function(prev) {
|
|
268
|
+
if (!append) return next.rows;
|
|
269
|
+
if (!dedupe) return prev.concat(next.rows);
|
|
270
|
+
var seen = {};
|
|
271
|
+
var out = [];
|
|
272
|
+
prev.concat(next.rows).forEach(function(x) {
|
|
273
|
+
var key = String(x.id);
|
|
274
|
+
if (seen[key]) return;
|
|
275
|
+
seen[key] = true;
|
|
276
|
+
out.push(x);
|
|
277
|
+
});
|
|
278
|
+
return out;
|
|
279
|
+
});
|
|
280
|
+
setTotal(next.total);
|
|
281
|
+
setPage(next.page);
|
|
282
|
+
setHasMore(next.hasMore);
|
|
283
|
+
setNames(function(prev) {
|
|
284
|
+
var map = Object.assign({}, prev);
|
|
285
|
+
next.rows.forEach(function(x) {
|
|
286
|
+
map[String(x.id)] = x.name;
|
|
287
|
+
});
|
|
288
|
+
return map;
|
|
289
|
+
});
|
|
290
|
+
}).catch(function() {
|
|
291
|
+
if (mine === seq.current) setLoading(false);
|
|
292
|
+
});
|
|
293
|
+
},
|
|
294
|
+
[api]
|
|
295
|
+
);
|
|
296
|
+
React.useEffect(
|
|
297
|
+
function() {
|
|
298
|
+
if (!open) return void 0;
|
|
299
|
+
var timer = setTimeout(
|
|
300
|
+
function() {
|
|
301
|
+
load(query, 1, false);
|
|
302
|
+
},
|
|
303
|
+
query ? debounce : 0
|
|
304
|
+
);
|
|
305
|
+
return function() {
|
|
306
|
+
clearTimeout(timer);
|
|
307
|
+
};
|
|
308
|
+
},
|
|
309
|
+
[open, query, load, props.reloadKey]
|
|
310
|
+
);
|
|
311
|
+
React.useEffect(
|
|
312
|
+
function() {
|
|
313
|
+
if (!conf.probe) return;
|
|
314
|
+
api.call(conf.probe.action || conf.action, conf.probe.args || {}).then(function(r) {
|
|
315
|
+
if (r && r.ok) availS[1](!!(conf.probe.available && conf.probe.available(r.result)));
|
|
316
|
+
}).catch(function() {
|
|
317
|
+
});
|
|
318
|
+
},
|
|
319
|
+
[api]
|
|
320
|
+
);
|
|
321
|
+
React.useEffect(
|
|
322
|
+
function() {
|
|
323
|
+
if (!open || !ids.length || !conf.names) return;
|
|
324
|
+
var wanted = ids.filter(function(id) {
|
|
325
|
+
return !names[String(id)];
|
|
326
|
+
});
|
|
327
|
+
if (!wanted.length) return;
|
|
328
|
+
var args = conf.names.args ? conf.names.args(wanted) : { ids: wanted };
|
|
329
|
+
api.call(conf.names.action, args).then(function(r) {
|
|
330
|
+
if (!r || !r.ok) return;
|
|
331
|
+
var map = {};
|
|
332
|
+
(r.result && r.result.records || []).forEach(function(x) {
|
|
333
|
+
map[String(x.id)] = x.name;
|
|
334
|
+
});
|
|
335
|
+
if (!Object.keys(map).length) return;
|
|
336
|
+
setNames(function(prev) {
|
|
337
|
+
return Object.assign({}, prev, map);
|
|
338
|
+
});
|
|
339
|
+
}).catch(function() {
|
|
340
|
+
});
|
|
341
|
+
},
|
|
342
|
+
[open, ids.join(",")]
|
|
343
|
+
);
|
|
344
|
+
React.useEffect(
|
|
345
|
+
function() {
|
|
346
|
+
if (!open) return void 0;
|
|
347
|
+
function onKey(e) {
|
|
348
|
+
if (e.key === "Escape") setOpen(false);
|
|
349
|
+
}
|
|
350
|
+
document.addEventListener("keydown", onKey);
|
|
351
|
+
return function() {
|
|
352
|
+
document.removeEventListener("keydown", onKey);
|
|
353
|
+
};
|
|
354
|
+
},
|
|
355
|
+
[open]
|
|
356
|
+
);
|
|
357
|
+
function toggle(id) {
|
|
358
|
+
var key = String(id);
|
|
359
|
+
var next = ids.slice();
|
|
360
|
+
var i = next.indexOf(key);
|
|
361
|
+
if (i >= 0) next.splice(i, 1);
|
|
362
|
+
else next.push(key);
|
|
363
|
+
onChange(next);
|
|
364
|
+
}
|
|
365
|
+
if (!enabled(props)) return null;
|
|
366
|
+
var caretNode = typeof caret === "function" ? caret(props, t) : caret;
|
|
367
|
+
var selectedNode = renderSelected ? renderSelected({ ids, names, toggle, text: t, classes, h }) : null;
|
|
368
|
+
return h(
|
|
279
369
|
"div",
|
|
280
|
-
{ className:
|
|
281
|
-
h(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
} },
|
|
292
|
-
h("span", { className: "wbt-tagnm" }, names[String(id)] || "#" + id),
|
|
293
|
-
h("span", { className: "wbt-tagx" }, "\xD7")
|
|
294
|
-
);
|
|
295
|
-
}))
|
|
296
|
-
) : null,
|
|
297
|
-
items: opts.tags.map(function(x) {
|
|
298
|
-
return { id: x.id, name: x.name, meta: x.total };
|
|
299
|
-
}),
|
|
300
|
-
selected: ids,
|
|
301
|
-
onToggle: toggle,
|
|
302
|
-
query,
|
|
303
|
-
onQuery: setQuery,
|
|
304
|
-
title: t.allTags,
|
|
305
|
-
total: opts.total,
|
|
306
|
-
clearText: t.clear,
|
|
307
|
-
onClear: function() {
|
|
308
|
-
onChange([]);
|
|
309
|
-
setQuery("");
|
|
370
|
+
{ className: classes.root },
|
|
371
|
+
h(
|
|
372
|
+
"button",
|
|
373
|
+
{
|
|
374
|
+
type: "button",
|
|
375
|
+
className: classes.btn + (ids.length ? " " + (classes.btnOn || "on") : ""),
|
|
376
|
+
"aria-expanded": open ? "true" : "false",
|
|
377
|
+
onClick: function(e) {
|
|
378
|
+
if (conf.stopPropagation) e.stopPropagation();
|
|
379
|
+
setOpen(!open);
|
|
380
|
+
}
|
|
310
381
|
},
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
382
|
+
icon(props, "tag", 13),
|
|
383
|
+
t.label + (ids.length ? " \xB7 " + ids.length : ""),
|
|
384
|
+
caretNode
|
|
385
|
+
),
|
|
386
|
+
open ? h(
|
|
387
|
+
"div",
|
|
388
|
+
{
|
|
389
|
+
className: classes.menu,
|
|
390
|
+
role: conf.menuRole,
|
|
391
|
+
style: conf.menuStyle,
|
|
392
|
+
onClick: conf.stopPropagation ? function(e) {
|
|
393
|
+
e.stopPropagation();
|
|
394
|
+
} : void 0
|
|
316
395
|
},
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
396
|
+
h(FilterChecklist, {
|
|
397
|
+
beforeHead: selectedNode,
|
|
398
|
+
items: items(rows),
|
|
399
|
+
selected: ids,
|
|
400
|
+
onToggle: toggle,
|
|
401
|
+
query,
|
|
402
|
+
onQuery: setQuery,
|
|
403
|
+
title: t.all,
|
|
404
|
+
total,
|
|
405
|
+
selectedText: t.selected,
|
|
406
|
+
clearText: t.clear,
|
|
407
|
+
onClear: function() {
|
|
408
|
+
onChange([]);
|
|
409
|
+
setQuery("");
|
|
410
|
+
},
|
|
411
|
+
searchPlaceholder: t.searchPlaceholder,
|
|
412
|
+
loading,
|
|
413
|
+
hasMore,
|
|
414
|
+
onLoadMore: function() {
|
|
415
|
+
load(query, (page || 1) + 1, true);
|
|
416
|
+
},
|
|
417
|
+
emptyText: t.empty,
|
|
418
|
+
noMatchText: t.noMatch,
|
|
419
|
+
loadingText: t.loading,
|
|
420
|
+
noMoreText: t.noMore
|
|
421
|
+
})
|
|
422
|
+
) : null
|
|
423
|
+
);
|
|
424
|
+
};
|
|
324
425
|
};
|
|
325
426
|
}
|
|
326
427
|
});
|
|
327
428
|
|
|
429
|
+
// packages/addons/tasks/client/ui/tagfilter.cjs
|
|
430
|
+
var require_tagfilter = __commonJS({
|
|
431
|
+
"packages/addons/tasks/client/ui/tagfilter.cjs"(exports2, module2) {
|
|
432
|
+
var React = require("react");
|
|
433
|
+
var h = React.createElement;
|
|
434
|
+
var createTagFilter = require_tag_filter();
|
|
435
|
+
module2.exports = createTagFilter({
|
|
436
|
+
action: "tasks.tagOptions",
|
|
437
|
+
// 标签是 tasks 的可选子插件:探针确认后端是否启用标签域。
|
|
438
|
+
probe: {
|
|
439
|
+
action: "tasks.tagOptions",
|
|
440
|
+
args: { pageSize: 1 },
|
|
441
|
+
available: function(out) {
|
|
442
|
+
return !!(out && out.available);
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
classes: { root: "wbt-tagfilter", btn: "wbt-btn ghost", btnOn: "on", menu: "wbt-tagmenu" },
|
|
446
|
+
menuRole: "menu",
|
|
447
|
+
dedupe: false,
|
|
448
|
+
text: function(props) {
|
|
449
|
+
var t = props.t || {};
|
|
450
|
+
return {
|
|
451
|
+
label: t.tagFilter,
|
|
452
|
+
selected: t.tagSelected,
|
|
453
|
+
all: t.allTags,
|
|
454
|
+
clear: t.clear,
|
|
455
|
+
searchPlaceholder: t.tagSearchPlaceholder,
|
|
456
|
+
empty: t.noTags,
|
|
457
|
+
noMatch: t.tagNoMatch,
|
|
458
|
+
loading: t.loadingMore,
|
|
459
|
+
noMore: t.noMore,
|
|
460
|
+
remove: t.tagRemove
|
|
461
|
+
};
|
|
462
|
+
},
|
|
463
|
+
icon: function(props, name, size) {
|
|
464
|
+
return h(props.Icon, { name, size });
|
|
465
|
+
},
|
|
466
|
+
caret: function(props) {
|
|
467
|
+
return h(props.Icon, { name: "down", size: 12 });
|
|
468
|
+
},
|
|
469
|
+
items: function(rows) {
|
|
470
|
+
return rows.map(function(x) {
|
|
471
|
+
return { id: x.id, name: x.name, meta: x.total };
|
|
472
|
+
});
|
|
473
|
+
},
|
|
474
|
+
mapPage: function(out, pageNumber) {
|
|
475
|
+
return {
|
|
476
|
+
rows: out.tags || [],
|
|
477
|
+
total: out.total || 0,
|
|
478
|
+
page: out.pageNumber || pageNumber,
|
|
479
|
+
hasMore: !!out.hasMore
|
|
480
|
+
};
|
|
481
|
+
},
|
|
482
|
+
renderSelected: function(ctx) {
|
|
483
|
+
if (!ctx.ids.length) return null;
|
|
484
|
+
return h(
|
|
485
|
+
"div",
|
|
486
|
+
{ className: "wbt-tagsel" },
|
|
487
|
+
h(
|
|
488
|
+
"div",
|
|
489
|
+
{ className: "wbt-tagmenu-head" },
|
|
490
|
+
h("span", null, ctx.text.selected + " " + ctx.ids.length),
|
|
491
|
+
h("span", { className: "wbt-grow" })
|
|
492
|
+
),
|
|
493
|
+
h(
|
|
494
|
+
"div",
|
|
495
|
+
{ className: "wbt-tagsel-list" },
|
|
496
|
+
ctx.ids.map(function(id) {
|
|
497
|
+
return h(
|
|
498
|
+
"button",
|
|
499
|
+
{
|
|
500
|
+
key: id,
|
|
501
|
+
className: "wbt-tagselitem",
|
|
502
|
+
title: ctx.text.remove,
|
|
503
|
+
onClick: function() {
|
|
504
|
+
ctx.toggle(id);
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
h("span", { className: "wbt-tagnm" }, ctx.names[String(id)] || "#" + id),
|
|
508
|
+
h("span", { className: "wbt-tagx" }, "\xD7")
|
|
509
|
+
);
|
|
510
|
+
})
|
|
511
|
+
)
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
|
|
328
518
|
// packages/addons/tasks/client/ui/workspacefilter.cjs
|
|
329
519
|
var require_workspacefilter = __commonJS({
|
|
330
520
|
"packages/addons/tasks/client/ui/workspacefilter.cjs"(exports2, module2) {
|
|
@@ -931,93 +1121,10 @@ var require_date_picker_styles = __commonJS({
|
|
|
931
1121
|
}
|
|
932
1122
|
});
|
|
933
1123
|
|
|
934
|
-
// packages/addons/
|
|
935
|
-
var
|
|
936
|
-
"packages/addons/
|
|
937
|
-
|
|
938
|
-
return !(hidden && hidden[key]);
|
|
939
|
-
}
|
|
940
|
-
function visibleSeries(series, hidden) {
|
|
941
|
-
return (series || []).filter(function(s) {
|
|
942
|
-
return s && isVisible(hidden, s.key);
|
|
943
|
-
});
|
|
944
|
-
}
|
|
945
|
-
function rangeMax(data, series, hidden) {
|
|
946
|
-
if (!data || !data.length) return 1;
|
|
947
|
-
var list = visibleSeries(series, hidden);
|
|
948
|
-
var max = 1;
|
|
949
|
-
(data || []).forEach(function(d) {
|
|
950
|
-
list.forEach(function(s) {
|
|
951
|
-
max = Math.max(max, Number(d[s.key] || 0));
|
|
952
|
-
});
|
|
953
|
-
});
|
|
954
|
-
return Math.ceil(max * 1.15) || 1;
|
|
955
|
-
}
|
|
956
|
-
function toggle(hidden, series, key) {
|
|
957
|
-
var next = Object.assign({}, hidden);
|
|
958
|
-
if (isVisible(hidden, key)) {
|
|
959
|
-
if (visibleSeries(series, hidden).length <= 1) return { hidden, blocked: true };
|
|
960
|
-
next[key] = true;
|
|
961
|
-
} else {
|
|
962
|
-
delete next[key];
|
|
963
|
-
}
|
|
964
|
-
return { hidden: next, blocked: false };
|
|
965
|
-
}
|
|
966
|
-
function indexAt(ratio, length) {
|
|
967
|
-
if (!length) return 0;
|
|
968
|
-
var i = Math.round(Number(ratio) * (length - 1));
|
|
969
|
-
if (!isFinite(i)) return 0;
|
|
970
|
-
return Math.min(length - 1, Math.max(0, i));
|
|
971
|
-
}
|
|
972
|
-
function moveIndex(index, delta, length) {
|
|
973
|
-
if (!length) return 0;
|
|
974
|
-
if (index === null || index === void 0 || index < 0) return delta > 0 ? 0 : length - 1;
|
|
975
|
-
return Math.min(length - 1, Math.max(0, index + delta));
|
|
976
|
-
}
|
|
977
|
-
function tipAnchor(ratio, plotLeftPct, plotWidthPct) {
|
|
978
|
-
var r = Math.min(1, Math.max(0, Number(ratio) || 0));
|
|
979
|
-
var left = plotLeftPct + r * plotWidthPct;
|
|
980
|
-
var flip = left > 72 ? "right" : left < 18 ? "left" : "center";
|
|
981
|
-
return { left: Math.round(left * 100) / 100, flip };
|
|
982
|
-
}
|
|
983
|
-
function tipTransform(flip) {
|
|
984
|
-
if (flip === "right") return "translateX(-100%)";
|
|
985
|
-
if (flip === "left") return "translateX(0)";
|
|
986
|
-
return "translateX(-50%)";
|
|
987
|
-
}
|
|
988
|
-
function tipRows(data, series, hidden, index) {
|
|
989
|
-
var row = (data || [])[index];
|
|
990
|
-
if (!row) return [];
|
|
991
|
-
return visibleSeries(series, hidden).map(function(s) {
|
|
992
|
-
return { key: s.key, label: s.label, color: s.color, value: Number(row[s.key] || 0) };
|
|
993
|
-
});
|
|
994
|
-
}
|
|
995
|
-
function summaryText(data, series, hidden, sep) {
|
|
996
|
-
var list = visibleSeries(series, hidden);
|
|
997
|
-
return list.map(function(s) {
|
|
998
|
-
return s.label + " " + (data || []).reduce(function(n, d) {
|
|
999
|
-
return n + Number(d[s.key] || 0);
|
|
1000
|
-
}, 0);
|
|
1001
|
-
}).join(sep || "\uFF0C");
|
|
1002
|
-
}
|
|
1003
|
-
module2.exports = {
|
|
1004
|
-
isVisible,
|
|
1005
|
-
visibleSeries,
|
|
1006
|
-
rangeMax,
|
|
1007
|
-
toggle,
|
|
1008
|
-
indexAt,
|
|
1009
|
-
moveIndex,
|
|
1010
|
-
tipAnchor,
|
|
1011
|
-
tipTransform,
|
|
1012
|
-
tipRows,
|
|
1013
|
-
summaryText
|
|
1014
|
-
};
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
|
|
1018
|
-
// packages/addons/tasks/client/stats/charts.cjs
|
|
1019
|
-
var require_charts = __commonJS({
|
|
1020
|
-
"packages/addons/tasks/client/stats/charts.cjs"(exports2, module2) {
|
|
1124
|
+
// packages/addons/lib/stats-charts.cjs
|
|
1125
|
+
var require_stats_charts = __commonJS({
|
|
1126
|
+
"packages/addons/lib/stats-charts.cjs"(exports2, module2) {
|
|
1127
|
+
"use strict";
|
|
1021
1128
|
var React = require("react");
|
|
1022
1129
|
var h = React.createElement;
|
|
1023
1130
|
var DP = require_date_picker();
|
|
@@ -1029,11 +1136,9 @@ var require_charts = __commonJS({
|
|
|
1029
1136
|
"var(--dsw-alias-state-done-primary, #7c5cff)",
|
|
1030
1137
|
"var(--dsw-alias-state-idle-primary, #8f959e)"
|
|
1031
1138
|
];
|
|
1032
|
-
|
|
1033
|
-
function css(prefix) {
|
|
1139
|
+
function css(prefix, extra) {
|
|
1034
1140
|
return [
|
|
1035
|
-
".@-
|
|
1036
|
-
".@-stats{display:flex;flex-direction:column;gap:18px;padding:4px 2px 24px;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1141
|
+
".@-stats{display:flex;flex-direction:column;gap:14px;padding:4px 2px 24px;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1037
1142
|
".@-stoolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
1038
1143
|
".@-seg{display:inline-flex;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:9px;overflow:hidden;background:var(--dsw-alias-bg-layer-1,#fff)}",
|
|
1039
1144
|
".@-seg button{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#646a73);font-size:12px;padding:6px 10px;cursor:pointer;white-space:nowrap}",
|
|
@@ -1045,46 +1150,27 @@ var require_charts = __commonJS({
|
|
|
1045
1150
|
".@-clear{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-tertiary,#8f959e);font-size:14px;line-height:1;padding:2px 4px;cursor:pointer;border-radius:4px}",
|
|
1046
1151
|
".@-clear:hover{color:var(--dsw-alias-state-error-primary,#d9534f);background:var(--dsw-alias-bg-skeleton,#f2f3f5)}",
|
|
1047
1152
|
".@-hint{font-size:11px;color:var(--dsw-alias-state-error-primary,#d9534f);white-space:nowrap}",
|
|
1048
|
-
".@-ghost{appearance:none;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-secondary,#646a73);border-radius:8px;font-size:12px;padding:6px 10px;cursor:pointer}",
|
|
1153
|
+
".@-ghost{appearance:none;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-secondary,#646a73);border-radius:8px;font-size:12px;padding:6px 10px;cursor:pointer;display:inline-flex;align-items:center;gap:5px;font-family:inherit}",
|
|
1154
|
+
".@-ghost:disabled{opacity:.6;cursor:progress}",
|
|
1155
|
+
".@-ico{display:block;flex:none}",
|
|
1156
|
+
".@-kpi-l .@-ico{opacity:.7}",
|
|
1049
1157
|
".@-ghost:hover{border-color:var(--dsw-alias-brand-primary,#4f6ef7);color:var(--dsw-alias-brand-primary,#4f6ef7)}",
|
|
1050
1158
|
".@-muted{color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
|
|
1051
|
-
// 难度分布的口径切换:轻量 tablist,视觉上与页首时间范围分段保持一致。
|
|
1052
|
-
".@-dims{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:0 0 8px}",
|
|
1053
|
-
".@-dims button{appearance:none;border:1px solid transparent;background:transparent;color:inherit;font:inherit;font-size:11.5px;padding:3px 8px;border-radius:6px;cursor:pointer;opacity:.7;white-space:nowrap}",
|
|
1054
|
-
".@-dims button:hover{background:var(--dsw-alias-bg-skeleton,#f2f3f5);opacity:1}",
|
|
1055
|
-
".@-dims button[aria-selected=true]{border-color:var(--dsw-alias-border-l2,#e5e6eb);background:var(--dsw-alias-bg-skeleton,#f2f3f5);font-weight:600;opacity:1}",
|
|
1056
|
-
".@-dims button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
1057
1159
|
".@-sgrid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:12px}",
|
|
1058
|
-
// 分区容器:把 12 栅格切成「一眼看清 → 结构 → 风险 → 排行 → 明细」几段,
|
|
1059
|
-
// 每段自己一条标题带,卡片之间仍按 span 排;段与段之间用更大的间距制造阅读停顿。
|
|
1060
|
-
".@-sect{grid-column:span 12;display:flex;flex-direction:column;gap:8px;min-width:0}",
|
|
1061
|
-
".@-sect-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;padding:2px 2px 0}",
|
|
1062
|
-
".@-sect-title{margin:0;font-size:13px;font-weight:650;letter-spacing:.2px;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1063
|
-
".@-sect-note{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
|
|
1064
|
-
".@-sect-body{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:12px;min-width:0}",
|
|
1065
1160
|
".@-scard{grid-column:span 6;min-width:0;background:var(--dsw-alias-bg-layer-1,#fff);border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:12px;padding:14px 16px}",
|
|
1066
1161
|
".@-span-3{grid-column:span 3}.@-span-4{grid-column:span 4}.@-span-6{grid-column:span 6}.@-span-8{grid-column:span 8}.@-span-12{grid-column:span 12}",
|
|
1067
1162
|
".@-chead{display:flex;align-items:baseline;gap:8px;margin-bottom:10px;flex-wrap:wrap}",
|
|
1068
1163
|
".@-ctitle{font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1069
1164
|
".@-cnote{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
|
|
1070
|
-
".@-kpis{grid-column:span 12;display:grid;grid-template-columns:repeat(
|
|
1071
|
-
// 核心指标与次级指标分两行:核心 4 张给足字号,次级 4 张收紧,避免 8 张 KPI 抢同一层的视觉重量。
|
|
1072
|
-
".@-kpis-main{grid-template-columns:repeat(4,minmax(0,1fr))}",
|
|
1073
|
-
".@-kpis-sub{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}",
|
|
1074
|
-
".@-kpi-lg{padding:14px 16px}",
|
|
1075
|
-
".@-kpi-lg .@-kpi-v{font-size:30px}",
|
|
1076
|
-
".@-kpi-sm{padding:9px 12px}",
|
|
1077
|
-
".@-kpi-sm .@-kpi-l{font-size:11.5px}",
|
|
1078
|
-
".@-kpi-sm .@-kpi-v{font-size:19px}",
|
|
1079
|
-
".@-kpi-sm .@-kpi-h{font-size:10.5px;margin-top:1px}",
|
|
1165
|
+
".@-kpis{grid-column:span 12;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}",
|
|
1080
1166
|
".@-kpi{background:var(--dsw-alias-bg-layer-1,#fff);border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:12px;padding:12px 14px;min-width:0}",
|
|
1081
1167
|
".@-kpi-l{font-size:12px;color:var(--dsw-alias-label-tertiary,#8f959e);display:flex;align-items:center;gap:6px}",
|
|
1082
1168
|
".@-kpi-v{font-size:26px;line-height:1.25;font-weight:650;margin-top:4px;font-variant-numeric:tabular-nums}",
|
|
1083
1169
|
".@-kpi-u{font-size:12px;font-weight:400;color:var(--dsw-alias-label-tertiary,#8f959e);margin-left:3px}",
|
|
1084
1170
|
".@-kpi-h{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e);margin-top:3px}",
|
|
1085
|
-
".@-kpi.@-
|
|
1086
|
-
".@-kpi.@-
|
|
1087
|
-
".@-kpi.@-
|
|
1171
|
+
".@-kpi.@-danger .@-kpi-v{color:var(--dsw-alias-state-error-primary,#d9534f)}",
|
|
1172
|
+
".@-kpi.@-warn .@-kpi-v{color:var(--dsw-alias-state-warn-primary,#d99100)}",
|
|
1173
|
+
".@-kpi.@-ok .@-kpi-v{color:var(--dsw-alias-state-success-primary,#2f9e6e)}",
|
|
1088
1174
|
".@-donut{display:flex;align-items:center;gap:16px;flex-wrap:wrap}",
|
|
1089
1175
|
".@-donut svg{flex:0 0 auto}",
|
|
1090
1176
|
".@-legend{display:flex;flex-direction:column;gap:7px;min-width:120px;flex:1}",
|
|
@@ -1107,27 +1193,16 @@ var require_charts = __commonJS({
|
|
|
1107
1193
|
".@-hbar-v{font-size:11px;color:var(--dsw-alias-label-secondary,#646a73);font-variant-numeric:tabular-nums}",
|
|
1108
1194
|
".@-hbar-f{width:100%;max-width:44px;border-radius:5px 5px 0 0;background:var(--dsw-alias-state-business-primary,#4f6ef7);min-height:2px}",
|
|
1109
1195
|
".@-hbar-l{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}",
|
|
1110
|
-
".@-hbar-link{cursor:pointer;border-radius:6px;padding-top:2px}",
|
|
1111
|
-
".@-hbar-link:hover{background:var(--dsw-alias-bg-skeleton,#f2f3f5)}",
|
|
1112
|
-
".@-hbar-link:hover .@-hbar-l,.@-hbar-link:focus-visible .@-hbar-l{color:var(--dsw-alias-brand-primary,#4f6ef7)}",
|
|
1113
|
-
".@-hbar-link:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
1114
1196
|
".@-trend{width:100%;height:auto;display:block}",
|
|
1115
1197
|
".@-tlegend{display:flex;gap:14px;flex-wrap:wrap;margin-top:6px;font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
|
|
1116
1198
|
".@-trend-wrap{position:relative}",
|
|
1117
|
-
".@-trend-
|
|
1118
|
-
".@-trend-
|
|
1119
|
-
".@-trend-
|
|
1120
|
-
".@-
|
|
1121
|
-
".@-
|
|
1122
|
-
".@-
|
|
1123
|
-
".@-
|
|
1124
|
-
".@-tlegend-item{display:inline-flex;align-items:center;gap:5px;appearance:none;border:0;background:none;padding:2px 0;font:inherit;font-size:11px;color:inherit;cursor:pointer;border-radius:4px}",
|
|
1125
|
-
".@-tlegend-item:hover:not(:disabled){color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1126
|
-
".@-tlegend-item[aria-pressed=false]{opacity:.45}",
|
|
1127
|
-
".@-tlegend-item[aria-pressed=false] .@-dot{background:transparent;border:1px solid currentColor}",
|
|
1128
|
-
".@-tlegend-item:disabled{cursor:default}",
|
|
1129
|
-
".@-tlegend-item:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
1130
|
-
".@-dot-off{width:8px;height:8px;border-radius:50%;border:1px solid;flex:0 0 auto}",
|
|
1199
|
+
".@-trend-hit{fill:transparent}",
|
|
1200
|
+
".@-trend-slot{fill:transparent;cursor:crosshair}",
|
|
1201
|
+
".@-trend-cross{stroke:var(--dsw-alias-border-l2,#e5e6eb);stroke-width:1;stroke-dasharray:3 3}",
|
|
1202
|
+
".@-tlegend{display:flex;gap:10px;flex-wrap:wrap;margin-top:6px;font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
|
|
1203
|
+
".@-tleg-item{appearance:none;border:0;background:transparent;color:inherit;font:inherit;display:inline-flex;align-items:center;gap:5px;padding:2px 4px;border-radius:5px;cursor:pointer}",
|
|
1204
|
+
".@-tleg-item.off{opacity:.45;text-decoration:line-through}",
|
|
1205
|
+
".@-tleg-item:hover{background:var(--dsw-alias-bg-skeleton,#f2f3f5)}",
|
|
1131
1206
|
".@-table-scroll{max-width:100%;overflow-x:auto}.@-table{width:100%;border-collapse:collapse;font-size:12px}",
|
|
1132
1207
|
".@-table th{text-align:left;font-weight:500;color:var(--dsw-alias-label-tertiary,#8f959e);padding:6px 8px;border-bottom:1px solid var(--dsw-alias-border-l2,#e5e6eb);white-space:nowrap}",
|
|
1133
1208
|
".@-table td{padding:7px 8px;border-bottom:1px solid var(--dsw-alias-border-l1,#f2f3f5);color:var(--dsw-alias-label-secondary,#646a73);vertical-align:top}",
|
|
@@ -1135,21 +1210,22 @@ var require_charts = __commonJS({
|
|
|
1135
1210
|
".@-table th.@-num,.@-table td.@-num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}",
|
|
1136
1211
|
".@-empty{padding:26px 8px;text-align:center;color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
|
|
1137
1212
|
".@-err{display:flex;align-items:center;gap:10px;background:color-mix(in srgb,var(--dsw-alias-state-error-primary,#d9534f) 8%,transparent);border:1px solid color-mix(in srgb,var(--dsw-alias-state-error-primary,#d9534f) 30%,transparent);color:var(--dsw-alias-state-error-primary,#d9534f);border-radius:10px;padding:10px 12px;font-size:12px}",
|
|
1138
|
-
".@-
|
|
1213
|
+
".@-warn{grid-column:span 12;border:1px dashed var(--dsw-alias-state-warn-primary,#d99100);border-radius:10px;padding:9px 12px;font-size:12px;color:var(--dsw-alias-state-warn-primary,#d99100);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#d99100) 6%,transparent)}",
|
|
1139
1214
|
".@-sk{height:14px;border-radius:6px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);margin:7px 0;animation:@-pulse 1.2s ease-in-out infinite}",
|
|
1140
1215
|
"@keyframes @-pulse{0%,100%{opacity:.55}50%{opacity:1}}",
|
|
1141
|
-
"@media (max-width:900px){.@-scard{grid-column:span 12}.@-span-3,.@-span-4,.@-span-6,.@-span-8{grid-column:span 12}.@-kpis
|
|
1142
|
-
"@media (max-width:600px){.@-stats{padding-bottom:16px
|
|
1143
|
-
"@media (prefers-reduced-motion:reduce){.@-sk{animation:none}}"
|
|
1144
|
-
|
|
1145
|
-
].join("\n").replace(/@-/g, prefix + "-");
|
|
1216
|
+
"@media (max-width:900px){.@-scard{grid-column:span 12}.@-span-3,.@-span-4,.@-span-6,.@-span-8{grid-column:span 12}.@-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}",
|
|
1217
|
+
"@media (max-width:600px){.@-stats{padding-bottom:16px}.@-hist{height:130px}.@-kpi-v{font-size:22px}}",
|
|
1218
|
+
"@media (prefers-reduced-motion:reduce){.@-sk{animation:none}}"
|
|
1219
|
+
].concat(extra || []).concat([require_date_picker_styles()(prefix)]).join("\n").replace(/@-/g, prefix + "-");
|
|
1146
1220
|
}
|
|
1147
|
-
function
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1221
|
+
function primitives(prefix, options) {
|
|
1222
|
+
var opts = options || {};
|
|
1223
|
+
var ICONS = opts.icons || {};
|
|
1224
|
+
var showNote = !!opts.showNote;
|
|
1225
|
+
function ico(name, size) {
|
|
1226
|
+
var C = ICONS[name];
|
|
1227
|
+
if (!C) return null;
|
|
1228
|
+
return h(C, { size: size || 13, strokeWidth: 2, "aria-hidden": "true", className: prefix + "-ico" });
|
|
1153
1229
|
}
|
|
1154
1230
|
function num(lang, n) {
|
|
1155
1231
|
var v = Number(n);
|
|
@@ -1195,32 +1271,12 @@ var require_charts = __commonJS({
|
|
|
1195
1271
|
props.children
|
|
1196
1272
|
);
|
|
1197
1273
|
}
|
|
1198
|
-
function Section(props) {
|
|
1199
|
-
var body = props.children || [];
|
|
1200
|
-
var list = Array.isArray(body) ? body.filter(function(n) {
|
|
1201
|
-
return n !== null && n !== void 0 && n !== false;
|
|
1202
|
-
}) : body;
|
|
1203
|
-
if (Array.isArray(list) && !list.length) return null;
|
|
1204
|
-
return h(
|
|
1205
|
-
"section",
|
|
1206
|
-
{ className: prefix + "-sect", "aria-label": props.title },
|
|
1207
|
-
h(
|
|
1208
|
-
"div",
|
|
1209
|
-
{ className: prefix + "-sect-head" },
|
|
1210
|
-
h("h2", { className: prefix + "-sect-title" }, props.title),
|
|
1211
|
-
props.note ? h("span", { className: prefix + "-sect-note" }, props.note) : null,
|
|
1212
|
-
props.right ? h("span", { className: prefix + "-sect-note", style: { marginLeft: "auto" } }, props.right) : null
|
|
1213
|
-
),
|
|
1214
|
-
h("div", { className: prefix + "-sect-body" }, list)
|
|
1215
|
-
);
|
|
1216
|
-
}
|
|
1217
1274
|
function Kpi(props) {
|
|
1218
|
-
var tone = props.tone ? " " + prefix + "-
|
|
1219
|
-
var size = props.size === "lg" || props.size === "sm" ? " " + prefix + "-kpi-" + props.size : "";
|
|
1275
|
+
var tone = props.tone ? " " + prefix + "-" + props.tone : "";
|
|
1220
1276
|
return h(
|
|
1221
1277
|
"div",
|
|
1222
|
-
{ className: prefix + "-kpi" +
|
|
1223
|
-
h("div", { className: prefix + "-kpi-l" }, props.label),
|
|
1278
|
+
{ className: prefix + "-kpi" + tone },
|
|
1279
|
+
h("div", { className: prefix + "-kpi-l" }, ico(props.icon, 13), props.label),
|
|
1224
1280
|
h(
|
|
1225
1281
|
"div",
|
|
1226
1282
|
{ className: prefix + "-kpi-v" },
|
|
@@ -1263,66 +1319,690 @@ var require_charts = __commonJS({
|
|
|
1263
1319
|
strokeDashoffset: -offset,
|
|
1264
1320
|
transform: "rotate(-90 " + size / 2 + " " + size / 2 + ")",
|
|
1265
1321
|
strokeLinecap: "butt"
|
|
1266
|
-
}, h("title", null, d.label + "\uFF1A" + d.count));
|
|
1322
|
+
}, h("title", null, d.label + "\uFF1A" + d.count + (showNote && d.note ? "\uFF08" + d.note + "\uFF09" : "")));
|
|
1267
1323
|
offset += len;
|
|
1268
1324
|
return seg;
|
|
1269
1325
|
}) : null,
|
|
1270
1326
|
h("text", { x: size / 2, y: size / 2 - 2, textAnchor: "middle", fill: "var(--dsw-alias-label-primary,#1f2329)", fontSize: 24, fontWeight: 650 }, num(props.lang, total)),
|
|
1271
1327
|
h("text", { x: size / 2, y: size / 2 + 18, textAnchor: "middle", fill: "var(--dsw-alias-label-tertiary,#8f959e)", fontSize: 11 }, props.centerLabel || "")
|
|
1272
1328
|
),
|
|
1273
|
-
h("div", { className: prefix + "-legend" }, (props.data || []).map(function(d, i) {
|
|
1274
|
-
return h(
|
|
1275
|
-
"div",
|
|
1276
|
-
{ key: d.key || d.label || i, className: prefix + "-leg" },
|
|
1277
|
-
h("span", { className: prefix + "-dot", style: { background: d.color || COLORS[i % COLORS.length] } }),
|
|
1278
|
-
h("span", null, d.label),
|
|
1279
|
-
h("b", null, num(props.lang, d.count))
|
|
1280
|
-
);
|
|
1281
|
-
}))
|
|
1329
|
+
h("div", { className: prefix + "-legend" }, (props.data || []).map(function(d, i) {
|
|
1330
|
+
return h(
|
|
1331
|
+
"div",
|
|
1332
|
+
{ key: d.key || d.label || i, className: prefix + "-leg" },
|
|
1333
|
+
h("span", { className: prefix + "-dot", style: { background: d.color || COLORS[i % COLORS.length] } }),
|
|
1334
|
+
h("span", null, d.label, showNote && d.note ? h("i", { className: prefix + "-leg-note" }, "\xB7 " + d.note) : null),
|
|
1335
|
+
h("b", null, num(props.lang, d.count))
|
|
1336
|
+
);
|
|
1337
|
+
}))
|
|
1338
|
+
);
|
|
1339
|
+
}
|
|
1340
|
+
function BarList(props) {
|
|
1341
|
+
var data = props.data || [];
|
|
1342
|
+
var max = Number(props.max || 0) || data.reduce(function(m, d) {
|
|
1343
|
+
return Math.max(m, Number(d.value || 0));
|
|
1344
|
+
}, 0) || 1;
|
|
1345
|
+
return h("div", { className: prefix + "-bars" }, data.map(function(d, i) {
|
|
1346
|
+
var v = Number(d.value || 0);
|
|
1347
|
+
return h(
|
|
1348
|
+
"div",
|
|
1349
|
+
{ key: d.key || d.label || i, className: prefix + "-bar" },
|
|
1350
|
+
h("span", { className: prefix + "-bar-l", title: d.title || d.label }, d.label),
|
|
1351
|
+
h("span", { className: prefix + "-bar-t" }, h("span", { className: prefix + "-bar-f", style: { width: Math.max(2, v / max * 100) + "%", background: d.color || props.color || COLORS[0] } })),
|
|
1352
|
+
h("span", { className: prefix + "-bar-v" }, props.format ? props.format(v) : num(props.lang, v))
|
|
1353
|
+
);
|
|
1354
|
+
}));
|
|
1355
|
+
}
|
|
1356
|
+
function StackedRows(props) {
|
|
1357
|
+
var rows = props.rows || [];
|
|
1358
|
+
var keys = props.keys || [];
|
|
1359
|
+
return h("div", { className: prefix + "-stack" }, rows.map(function(row, ri) {
|
|
1360
|
+
var total = Number(row.total || 0) || 1;
|
|
1361
|
+
return h(
|
|
1362
|
+
"div",
|
|
1363
|
+
{ key: row.key || ri },
|
|
1364
|
+
h("div", { className: prefix + "-srow-l" }, h("span", null, row.label), h("b", null, num(props.lang, row.total))),
|
|
1365
|
+
h("div", { className: prefix + "-strack" }, keys.map(function(k, i) {
|
|
1366
|
+
var v = Number(row.parts && row.parts[k.key] || 0);
|
|
1367
|
+
if (v <= 0) return null;
|
|
1368
|
+
return h("span", {
|
|
1369
|
+
key: k.key,
|
|
1370
|
+
className: prefix + "-seg-f",
|
|
1371
|
+
title: k.label + " " + v,
|
|
1372
|
+
style: { width: v / total * 100 + "%", background: k.color || COLORS[i % COLORS.length] }
|
|
1373
|
+
});
|
|
1374
|
+
}))
|
|
1375
|
+
);
|
|
1376
|
+
}));
|
|
1377
|
+
}
|
|
1378
|
+
function useWidth() {
|
|
1379
|
+
if (typeof React.useRef !== "function" || typeof React.useEffect !== "function") return [null, 0];
|
|
1380
|
+
var state = React.useState(0);
|
|
1381
|
+
var ref = React.useRef(null);
|
|
1382
|
+
var setWidth = state[1];
|
|
1383
|
+
var useIso = React.useLayoutEffect || React.useEffect;
|
|
1384
|
+
useIso(function() {
|
|
1385
|
+
var node = ref.current;
|
|
1386
|
+
if (!node) return void 0;
|
|
1387
|
+
function read() {
|
|
1388
|
+
var w = node.clientWidth || 0;
|
|
1389
|
+
if (w > 0) setWidth(w);
|
|
1390
|
+
}
|
|
1391
|
+
read();
|
|
1392
|
+
if (typeof ResizeObserver === "undefined") return void 0;
|
|
1393
|
+
var ro = new ResizeObserver(read);
|
|
1394
|
+
ro.observe(node);
|
|
1395
|
+
return function() {
|
|
1396
|
+
ro.disconnect();
|
|
1397
|
+
};
|
|
1398
|
+
}, []);
|
|
1399
|
+
return [ref, state[0]];
|
|
1400
|
+
}
|
|
1401
|
+
function Trend(props) {
|
|
1402
|
+
var data = props.data || [];
|
|
1403
|
+
var series = props.series || [];
|
|
1404
|
+
var lang = props.lang;
|
|
1405
|
+
var fmt = typeof props.format === "function" ? props.format : function(v) {
|
|
1406
|
+
return num(lang, v);
|
|
1407
|
+
};
|
|
1408
|
+
var visible = props.visible || null;
|
|
1409
|
+
var shown = series.filter(function(s) {
|
|
1410
|
+
return !visible || visible[s.key] !== false;
|
|
1411
|
+
});
|
|
1412
|
+
if (!data.length) return h("div", { className: prefix + "-empty" }, props.emptyText || "\u6682\u65E0\u6570\u636E");
|
|
1413
|
+
var size = useWidth();
|
|
1414
|
+
var width = Math.max(260, size[1] || props.width || 640);
|
|
1415
|
+
var height = props.height || 200;
|
|
1416
|
+
var left = props.left || 60, right = 12, top = 14, bottom = 26;
|
|
1417
|
+
var pw = width - left - right, ph = height - top - bottom;
|
|
1418
|
+
var max = 0;
|
|
1419
|
+
data.forEach(function(d) {
|
|
1420
|
+
shown.forEach(function(s) {
|
|
1421
|
+
max = Math.max(max, Math.abs(Number(d[s.key] || 0)));
|
|
1422
|
+
});
|
|
1423
|
+
});
|
|
1424
|
+
var raw = Math.max(max, 1) / 4;
|
|
1425
|
+
var exp = Math.pow(10, Math.floor(Math.log(raw) / Math.LN10));
|
|
1426
|
+
var norm = raw / exp;
|
|
1427
|
+
var mult = norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 2.5 ? 2.5 : norm <= 5 ? 5 : 10;
|
|
1428
|
+
var step = mult * exp;
|
|
1429
|
+
var axisMax = step * 4;
|
|
1430
|
+
function x(i2) {
|
|
1431
|
+
return left + (data.length <= 1 ? pw / 2 : i2 / (data.length - 1) * pw);
|
|
1432
|
+
}
|
|
1433
|
+
function y(v) {
|
|
1434
|
+
return top + ph - Math.max(0, Number(v) || 0) / axisMax * ph;
|
|
1435
|
+
}
|
|
1436
|
+
var active = typeof props.active === "number" ? props.active : null;
|
|
1437
|
+
var band = data.length > 1 ? pw / (data.length - 1) : pw;
|
|
1438
|
+
var labelIdx = [];
|
|
1439
|
+
var labelStep = Math.max(1, Math.ceil(data.length / 8));
|
|
1440
|
+
for (var i = 0; i < data.length; i += labelStep) labelIdx.push(i);
|
|
1441
|
+
if (labelIdx[labelIdx.length - 1] !== data.length - 1) labelIdx.push(data.length - 1);
|
|
1442
|
+
var aria = props.aria || shown.map(function(s) {
|
|
1443
|
+
return s.label + " " + data.reduce(function(n, d) {
|
|
1444
|
+
return n + Number(d[s.key] || 0);
|
|
1445
|
+
}, 0);
|
|
1446
|
+
}).join("\uFF0C");
|
|
1447
|
+
var ticks = [];
|
|
1448
|
+
for (var t = 0; t <= 4; t++) ticks.push(step * t);
|
|
1449
|
+
var children = [];
|
|
1450
|
+
if (typeof props.onHover === "function") {
|
|
1451
|
+
children.push(h("rect", {
|
|
1452
|
+
key: "hit-area",
|
|
1453
|
+
x: left,
|
|
1454
|
+
y: top,
|
|
1455
|
+
width: pw,
|
|
1456
|
+
height: ph,
|
|
1457
|
+
className: prefix + "-trend-hit",
|
|
1458
|
+
onMouseLeave: function() {
|
|
1459
|
+
props.onHover(null);
|
|
1460
|
+
}
|
|
1461
|
+
}));
|
|
1462
|
+
data.forEach(function(d, di) {
|
|
1463
|
+
children.push(h("rect", {
|
|
1464
|
+
key: "hit" + di,
|
|
1465
|
+
x: x(di) - band / 2,
|
|
1466
|
+
y: top,
|
|
1467
|
+
width: band,
|
|
1468
|
+
height: ph,
|
|
1469
|
+
className: prefix + "-trend-slot",
|
|
1470
|
+
onMouseEnter: function() {
|
|
1471
|
+
props.onHover(di);
|
|
1472
|
+
}
|
|
1473
|
+
}));
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
ticks.forEach(function(v, ti) {
|
|
1477
|
+
children.push(h(
|
|
1478
|
+
"g",
|
|
1479
|
+
{ key: "t" + ti },
|
|
1480
|
+
h("line", { x1: left, x2: width - right, y1: y(v), y2: y(v), stroke: "var(--dsw-alias-border-l1,#f2f3f5)", strokeWidth: 1 }),
|
|
1481
|
+
h("text", { x: left - 8, y: y(v) + 3, textAnchor: "end", fontSize: 11, fill: "var(--dsw-alias-label-tertiary,#8f959e)" }, fmt(v))
|
|
1482
|
+
));
|
|
1483
|
+
});
|
|
1484
|
+
if (active !== null && data[active]) {
|
|
1485
|
+
children.push(h("line", {
|
|
1486
|
+
key: "cross",
|
|
1487
|
+
x1: x(active),
|
|
1488
|
+
y1: top,
|
|
1489
|
+
x2: x(active),
|
|
1490
|
+
y2: top + ph,
|
|
1491
|
+
className: prefix + "-trend-cross"
|
|
1492
|
+
}));
|
|
1493
|
+
}
|
|
1494
|
+
shown.forEach(function(s, si) {
|
|
1495
|
+
var color = s.color || COLORS[series.indexOf(s) % COLORS.length];
|
|
1496
|
+
var pts = data.map(function(d, di) {
|
|
1497
|
+
return x(di) + "," + y(d[s.key]);
|
|
1498
|
+
}).join(" ");
|
|
1499
|
+
if (data.length > 1) {
|
|
1500
|
+
children.push(h("polyline", {
|
|
1501
|
+
key: "line" + s.key,
|
|
1502
|
+
points: pts,
|
|
1503
|
+
fill: "none",
|
|
1504
|
+
stroke: color,
|
|
1505
|
+
strokeWidth: 2,
|
|
1506
|
+
strokeLinejoin: "round",
|
|
1507
|
+
strokeLinecap: "round",
|
|
1508
|
+
// className 供插件用自有色调样式挂靠,也方便测试按系列归类
|
|
1509
|
+
className: prefix + "-trend-line" + (s.className ? " " + s.className : "")
|
|
1510
|
+
}));
|
|
1511
|
+
}
|
|
1512
|
+
data.forEach(function(d, di) {
|
|
1513
|
+
children.push(h("circle", {
|
|
1514
|
+
key: "dot" + s.key + di,
|
|
1515
|
+
cx: x(di),
|
|
1516
|
+
cy: y(d[s.key]),
|
|
1517
|
+
fill: color,
|
|
1518
|
+
r: di === active ? 5 : 3,
|
|
1519
|
+
className: prefix + "-trend-dot" + (di === active ? " is-hot" : "")
|
|
1520
|
+
}, h("title", null, labelOf(d, di) + " \xB7 " + s.label + " " + fmt(d[s.key]) + (props.note ? " \xB7 " + props.note(d) : ""))));
|
|
1521
|
+
});
|
|
1522
|
+
});
|
|
1523
|
+
function labelOf(d, di) {
|
|
1524
|
+
if (typeof props.label === "function") return props.label(d, di);
|
|
1525
|
+
return String(d.bucket === void 0 ? di + 1 : d.bucket).slice(5);
|
|
1526
|
+
}
|
|
1527
|
+
labelIdx.forEach(function(di) {
|
|
1528
|
+
children.push(h("text", { key: "x" + di, x: x(di), y: height - 8, textAnchor: "middle", fontSize: 11, fill: "var(--dsw-alias-label-tertiary,#8f959e)" }, labelOf(data[di], di)));
|
|
1529
|
+
});
|
|
1530
|
+
var legend = props.showLegend === false ? null : h("div", { className: prefix + "-tlegend" }, series.map(function(s, si) {
|
|
1531
|
+
var off = !!(visible && visible[s.key] === false);
|
|
1532
|
+
var color = s.color || COLORS[si % COLORS.length];
|
|
1533
|
+
var inner = [h("span", { key: "d", className: prefix + "-dot", style: { background: color } }), s.label];
|
|
1534
|
+
if (typeof props.onToggle !== "function") {
|
|
1535
|
+
return h("span", { key: s.key, className: prefix + "-tleg-item" + (off ? " off" : "") }, inner);
|
|
1536
|
+
}
|
|
1537
|
+
return h("button", {
|
|
1538
|
+
key: s.key,
|
|
1539
|
+
type: "button",
|
|
1540
|
+
className: prefix + "-tleg-item" + (off ? " off" : ""),
|
|
1541
|
+
"aria-pressed": !off,
|
|
1542
|
+
title: (off ? "\u663E\u793A" : "\u9690\u85CF") + s.label,
|
|
1543
|
+
onClick: function() {
|
|
1544
|
+
props.onToggle(s.key);
|
|
1545
|
+
}
|
|
1546
|
+
}, inner);
|
|
1547
|
+
}));
|
|
1548
|
+
return h(
|
|
1549
|
+
"div",
|
|
1550
|
+
{ className: prefix + "-trend-wrap", ref: size[0] },
|
|
1551
|
+
h("svg", { className: prefix + "-trend", viewBox: "0 0 " + width + " " + height, width, height, role: "img", "aria-label": aria }, children),
|
|
1552
|
+
legend
|
|
1553
|
+
);
|
|
1554
|
+
}
|
|
1555
|
+
function Histogram(props) {
|
|
1556
|
+
var data = props.data || [];
|
|
1557
|
+
var max = data.reduce(function(m, d) {
|
|
1558
|
+
return Math.max(m, Number(d.count || 0));
|
|
1559
|
+
}, 0) || 1;
|
|
1560
|
+
return h(
|
|
1561
|
+
"div",
|
|
1562
|
+
{ className: prefix + "-hist", role: "img", "aria-label": props.aria || data.map(function(d) {
|
|
1563
|
+
return d.label + " " + d.count;
|
|
1564
|
+
}).join("\uFF0C") },
|
|
1565
|
+
data.map(function(d, i) {
|
|
1566
|
+
return h(
|
|
1567
|
+
"div",
|
|
1568
|
+
{ key: d.key || d.label || i, className: prefix + "-hbar", title: d.label + "\uFF1A" + d.count },
|
|
1569
|
+
h("span", { className: prefix + "-hbar-v" }, num(props.lang, d.count)),
|
|
1570
|
+
h("span", { className: prefix + "-hbar-f", style: { height: Math.max(2, Number(d.count || 0) / max * 100) + "%", background: d.color || props.color || COLORS[0] } }),
|
|
1571
|
+
h("span", { className: prefix + "-hbar-l" }, d.label)
|
|
1572
|
+
);
|
|
1573
|
+
})
|
|
1574
|
+
);
|
|
1575
|
+
}
|
|
1576
|
+
function DataTable(props) {
|
|
1577
|
+
var cols = props.columns || [];
|
|
1578
|
+
var rows = props.rows || [];
|
|
1579
|
+
if (!rows.length) return h("div", { className: prefix + "-empty" }, props.empty || "\u6682\u65E0\u6570\u636E");
|
|
1580
|
+
return h("div", { className: prefix + "-table-scroll", tabIndex: 0, role: "region", "aria-label": props.lang === "en" ? "Data table" : "\u6570\u636E\u8868\u683C" }, h(
|
|
1581
|
+
"table",
|
|
1582
|
+
{ className: prefix + "-table" },
|
|
1583
|
+
h("thead", null, h("tr", null, cols.map(function(c) {
|
|
1584
|
+
return h("th", { key: c.key, className: c.num ? prefix + "-num" : "" }, c.label);
|
|
1585
|
+
}))),
|
|
1586
|
+
h("tbody", null, rows.map(function(row, ri) {
|
|
1587
|
+
return h("tr", { key: row.id || row.key || ri }, cols.map(function(c) {
|
|
1588
|
+
return h("td", { key: c.key, className: c.num ? prefix + "-num" : "" }, c.render ? c.render(row) : row[c.key]);
|
|
1589
|
+
}));
|
|
1590
|
+
}))
|
|
1591
|
+
));
|
|
1592
|
+
}
|
|
1593
|
+
function RangeSwitch(props) {
|
|
1594
|
+
var custom = props.custom || null;
|
|
1595
|
+
var from = custom && custom.from ? custom.from : "";
|
|
1596
|
+
var to = custom && custom.to ? custom.to : "";
|
|
1597
|
+
function setDate(key, value) {
|
|
1598
|
+
if (typeof props.onCustomChange !== "function") return;
|
|
1599
|
+
var next = { from, to };
|
|
1600
|
+
next[key] = value;
|
|
1601
|
+
props.onCustomChange(next);
|
|
1602
|
+
}
|
|
1603
|
+
return h(
|
|
1604
|
+
"div",
|
|
1605
|
+
{ className: prefix + "-stoolbar" },
|
|
1606
|
+
h("div", { className: prefix + "-seg", role: "group", "aria-label": props.aria || "\u65F6\u95F4\u8303\u56F4" }, (props.options || []).map(function(o) {
|
|
1607
|
+
return h("button", {
|
|
1608
|
+
key: o.key,
|
|
1609
|
+
type: "button",
|
|
1610
|
+
className: o.key === props.value ? prefix + "-on" : "",
|
|
1611
|
+
"aria-pressed": !!props.value && o.key === props.value,
|
|
1612
|
+
onClick: function() {
|
|
1613
|
+
props.onChange(o.key);
|
|
1614
|
+
}
|
|
1615
|
+
}, o.label);
|
|
1616
|
+
})),
|
|
1617
|
+
h(
|
|
1618
|
+
"div",
|
|
1619
|
+
{ className: prefix + "-range", role: "group", "aria-label": props.customAria || "\u81EA\u5B9A\u4E49\u65E5\u671F\u8303\u56F4" },
|
|
1620
|
+
h(DP.RangePicker, {
|
|
1621
|
+
React,
|
|
1622
|
+
h,
|
|
1623
|
+
prefix,
|
|
1624
|
+
lang: props.lang,
|
|
1625
|
+
label: props.customAria || "\u81EA\u5B9A\u4E49\u65E5\u671F\u8303\u56F4",
|
|
1626
|
+
value: { from, to },
|
|
1627
|
+
max: props.today || void 0,
|
|
1628
|
+
clearable: false,
|
|
1629
|
+
onChange: function(next) {
|
|
1630
|
+
if (typeof props.onCustomChange !== "function") return;
|
|
1631
|
+
props.onCustomChange({ from: next.from, to: next.to });
|
|
1632
|
+
}
|
|
1633
|
+
}),
|
|
1634
|
+
from || to ? h("button", {
|
|
1635
|
+
type: "button",
|
|
1636
|
+
className: prefix + "-clear",
|
|
1637
|
+
"aria-label": props.clearLabel || "\u6E05\u9664\u81EA\u5B9A\u4E49\u8303\u56F4",
|
|
1638
|
+
title: props.clearLabel || "\u6E05\u9664\u81EA\u5B9A\u4E49\u8303\u56F4",
|
|
1639
|
+
onClick: function() {
|
|
1640
|
+
if (props.onCustomClear) props.onCustomClear();
|
|
1641
|
+
}
|
|
1642
|
+
}, "\xD7") : null
|
|
1643
|
+
),
|
|
1644
|
+
props.customHint ? h("span", { className: prefix + "-hint", role: "status" }, props.customHint) : null,
|
|
1645
|
+
h("button", { type: "button", className: prefix + "-ghost", disabled: !!props.loading, onClick: props.onRefresh }, ico("refresh", 13), props.refreshLabel || "\u5237\u65B0"),
|
|
1646
|
+
h("span", { className: prefix + "-muted" }, props.generatedAt ? (props.timeLabel || "\u622A\u81F3") + " " + timeText(props.generatedAt) : ""),
|
|
1647
|
+
props.right ? h("span", { style: { marginLeft: "auto" } }, props.right) : null
|
|
1648
|
+
);
|
|
1649
|
+
}
|
|
1650
|
+
function Empty(props) {
|
|
1651
|
+
return h("div", { className: prefix + "-empty" }, props.text || "\u6682\u65E0\u6570\u636E");
|
|
1652
|
+
}
|
|
1653
|
+
function Skeleton() {
|
|
1654
|
+
return h(
|
|
1655
|
+
"div",
|
|
1656
|
+
{ className: prefix + "-sgrid" },
|
|
1657
|
+
h("div", { className: prefix + "-kpis" }, [0, 1, 2, 3].map(function(i) {
|
|
1658
|
+
return h(
|
|
1659
|
+
"div",
|
|
1660
|
+
{ key: i, className: prefix + "-kpi" },
|
|
1661
|
+
h("div", { className: prefix + "-sk", style: { width: "40%" } }),
|
|
1662
|
+
h("div", { className: prefix + "-sk", style: { width: "65%", height: 26 } })
|
|
1663
|
+
);
|
|
1664
|
+
})),
|
|
1665
|
+
[0, 1].map(function(i) {
|
|
1666
|
+
return h(
|
|
1667
|
+
"div",
|
|
1668
|
+
{ key: "c" + i, className: prefix + "-scard " + prefix + "-span-6" },
|
|
1669
|
+
h("div", { className: prefix + "-sk", style: { width: "30%" } }),
|
|
1670
|
+
h("div", { className: prefix + "-sk", style: { height: 120 } })
|
|
1671
|
+
);
|
|
1672
|
+
})
|
|
1673
|
+
);
|
|
1674
|
+
}
|
|
1675
|
+
function ErrorBar(props) {
|
|
1676
|
+
return h(
|
|
1677
|
+
"div",
|
|
1678
|
+
{ className: prefix + "-err", role: "alert" },
|
|
1679
|
+
h("span", null, props.message),
|
|
1680
|
+
props.onRetry ? h("button", { type: "button", className: prefix + "-ghost", onClick: props.onRetry }, props.retryLabel || "\u91CD\u8BD5") : null
|
|
1681
|
+
);
|
|
1682
|
+
}
|
|
1683
|
+
function Warnings(props) {
|
|
1684
|
+
var items = props.items || [];
|
|
1685
|
+
if (!items.length) return null;
|
|
1686
|
+
return h("div", { className: prefix + "-warn", role: "status" }, items.map(function(w) {
|
|
1687
|
+
return w.message;
|
|
1688
|
+
}).join("\uFF1B"));
|
|
1689
|
+
}
|
|
1690
|
+
return {
|
|
1691
|
+
Card,
|
|
1692
|
+
Kpi,
|
|
1693
|
+
Donut,
|
|
1694
|
+
BarList,
|
|
1695
|
+
StackedRows,
|
|
1696
|
+
Trend,
|
|
1697
|
+
Histogram,
|
|
1698
|
+
DataTable,
|
|
1699
|
+
RangeSwitch,
|
|
1700
|
+
Empty,
|
|
1701
|
+
Skeleton,
|
|
1702
|
+
ErrorBar,
|
|
1703
|
+
Warnings,
|
|
1704
|
+
num,
|
|
1705
|
+
pct,
|
|
1706
|
+
timeText,
|
|
1707
|
+
dateText,
|
|
1708
|
+
colors: COLORS,
|
|
1709
|
+
useWidth
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
function makeCharts(prefix, options) {
|
|
1713
|
+
var opts = options || {};
|
|
1714
|
+
if (typeof document !== "undefined" && !document.getElementById(prefix + "-charts-css")) {
|
|
1715
|
+
var el = document.createElement("style");
|
|
1716
|
+
el.id = prefix + "-charts-css";
|
|
1717
|
+
el.textContent = css(prefix, opts.styles);
|
|
1718
|
+
document.head.appendChild(el);
|
|
1719
|
+
}
|
|
1720
|
+
return primitives(prefix, opts);
|
|
1721
|
+
}
|
|
1722
|
+
module2.exports = { makeCharts, primitives, css, colors: COLORS };
|
|
1723
|
+
}
|
|
1724
|
+
});
|
|
1725
|
+
|
|
1726
|
+
// packages/addons/tasks/client/stats/trend-interaction.cjs
|
|
1727
|
+
var require_trend_interaction = __commonJS({
|
|
1728
|
+
"packages/addons/tasks/client/stats/trend-interaction.cjs"(exports2, module2) {
|
|
1729
|
+
function isVisible(hidden, key) {
|
|
1730
|
+
return !(hidden && hidden[key]);
|
|
1731
|
+
}
|
|
1732
|
+
function visibleSeries(series, hidden) {
|
|
1733
|
+
return (series || []).filter(function(s) {
|
|
1734
|
+
return s && isVisible(hidden, s.key);
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
function rangeMax(data, series, hidden) {
|
|
1738
|
+
if (!data || !data.length) return 1;
|
|
1739
|
+
var list = visibleSeries(series, hidden);
|
|
1740
|
+
var max = 1;
|
|
1741
|
+
(data || []).forEach(function(d) {
|
|
1742
|
+
list.forEach(function(s) {
|
|
1743
|
+
max = Math.max(max, Number(d[s.key] || 0));
|
|
1744
|
+
});
|
|
1745
|
+
});
|
|
1746
|
+
return Math.ceil(max * 1.15) || 1;
|
|
1747
|
+
}
|
|
1748
|
+
function toggle(hidden, series, key) {
|
|
1749
|
+
var next = Object.assign({}, hidden);
|
|
1750
|
+
if (isVisible(hidden, key)) {
|
|
1751
|
+
if (visibleSeries(series, hidden).length <= 1) return { hidden, blocked: true };
|
|
1752
|
+
next[key] = true;
|
|
1753
|
+
} else {
|
|
1754
|
+
delete next[key];
|
|
1755
|
+
}
|
|
1756
|
+
return { hidden: next, blocked: false };
|
|
1757
|
+
}
|
|
1758
|
+
function indexAt(ratio, length) {
|
|
1759
|
+
if (!length) return 0;
|
|
1760
|
+
var i = Math.round(Number(ratio) * (length - 1));
|
|
1761
|
+
if (!isFinite(i)) return 0;
|
|
1762
|
+
return Math.min(length - 1, Math.max(0, i));
|
|
1763
|
+
}
|
|
1764
|
+
function moveIndex(index, delta, length) {
|
|
1765
|
+
if (!length) return 0;
|
|
1766
|
+
if (index === null || index === void 0 || index < 0) return delta > 0 ? 0 : length - 1;
|
|
1767
|
+
return Math.min(length - 1, Math.max(0, index + delta));
|
|
1768
|
+
}
|
|
1769
|
+
function tipAnchor(ratio, plotLeftPct, plotWidthPct) {
|
|
1770
|
+
var r = Math.min(1, Math.max(0, Number(ratio) || 0));
|
|
1771
|
+
var left = plotLeftPct + r * plotWidthPct;
|
|
1772
|
+
var flip = left > 72 ? "right" : left < 18 ? "left" : "center";
|
|
1773
|
+
return { left: Math.round(left * 100) / 100, flip };
|
|
1774
|
+
}
|
|
1775
|
+
function tipTransform(flip) {
|
|
1776
|
+
if (flip === "right") return "translateX(-100%)";
|
|
1777
|
+
if (flip === "left") return "translateX(0)";
|
|
1778
|
+
return "translateX(-50%)";
|
|
1779
|
+
}
|
|
1780
|
+
function tipRows(data, series, hidden, index) {
|
|
1781
|
+
var row = (data || [])[index];
|
|
1782
|
+
if (!row) return [];
|
|
1783
|
+
return visibleSeries(series, hidden).map(function(s) {
|
|
1784
|
+
return { key: s.key, label: s.label, color: s.color, value: Number(row[s.key] || 0) };
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
function summaryText(data, series, hidden, sep) {
|
|
1788
|
+
var list = visibleSeries(series, hidden);
|
|
1789
|
+
return list.map(function(s) {
|
|
1790
|
+
return s.label + " " + (data || []).reduce(function(n, d) {
|
|
1791
|
+
return n + Number(d[s.key] || 0);
|
|
1792
|
+
}, 0);
|
|
1793
|
+
}).join(sep || "\uFF0C");
|
|
1794
|
+
}
|
|
1795
|
+
module2.exports = {
|
|
1796
|
+
isVisible,
|
|
1797
|
+
visibleSeries,
|
|
1798
|
+
rangeMax,
|
|
1799
|
+
toggle,
|
|
1800
|
+
indexAt,
|
|
1801
|
+
moveIndex,
|
|
1802
|
+
tipAnchor,
|
|
1803
|
+
tipTransform,
|
|
1804
|
+
tipRows,
|
|
1805
|
+
summaryText
|
|
1806
|
+
};
|
|
1807
|
+
}
|
|
1808
|
+
});
|
|
1809
|
+
|
|
1810
|
+
// packages/addons/tasks/client/stats/charts.cjs
|
|
1811
|
+
var require_charts = __commonJS({
|
|
1812
|
+
"packages/addons/tasks/client/stats/charts.cjs"(exports2, module2) {
|
|
1813
|
+
var React = require("react");
|
|
1814
|
+
var h = React.createElement;
|
|
1815
|
+
var DP = require_date_picker();
|
|
1816
|
+
var LIB = require_stats_charts();
|
|
1817
|
+
var COLORS = [
|
|
1818
|
+
"var(--dsw-alias-state-business-primary, #4f6ef7)",
|
|
1819
|
+
"var(--dsw-alias-state-success-primary, #2f9e6e)",
|
|
1820
|
+
"var(--dsw-alias-state-warn-primary, #d99100)",
|
|
1821
|
+
"var(--dsw-alias-state-error-primary, #d9534f)",
|
|
1822
|
+
"var(--dsw-alias-state-done-primary, #7c5cff)",
|
|
1823
|
+
"var(--dsw-alias-state-idle-primary, #8f959e)"
|
|
1824
|
+
];
|
|
1825
|
+
var STATUS_COLORS = { "0": COLORS[0], "1": COLORS[3], "2": COLORS[1], "4": COLORS[2] };
|
|
1826
|
+
function css(prefix) {
|
|
1827
|
+
return [
|
|
1828
|
+
".@-table-link{border:0;padding:0;background:none;font:inherit;color:var(--dsw-alias-brand-primary,#4f6ef7);text-align:left;cursor:pointer}.@-table-link:hover{text-decoration:underline}.@-table-link:focus-visible{outline:2px solid currentColor;outline-offset:3px}.@-recent-difficulty{white-space:nowrap}.@-recent-reason{opacity:.65}",
|
|
1829
|
+
".@-stats{display:flex;flex-direction:column;gap:18px;padding:4px 2px 24px;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1830
|
+
".@-stoolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
1831
|
+
".@-seg{display:inline-flex;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:9px;overflow:hidden;background:var(--dsw-alias-bg-layer-1,#fff)}",
|
|
1832
|
+
".@-seg button{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#646a73);font-size:12px;padding:6px 10px;cursor:pointer;white-space:nowrap}",
|
|
1833
|
+
".@-seg button.@-on{background:var(--dsw-alias-brand-primary,#4f6ef7);color:var(--dsw-alias-label-primary-inverted,#fff)}",
|
|
1834
|
+
".@-range{display:inline-flex;align-items:center;gap:4px}",
|
|
1835
|
+
".@-date{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#646a73);font-family:inherit;font-size:12px;padding:4px 2px;width:116px;outline:none}",
|
|
1836
|
+
".@-date::-webkit-calendar-picker-indicator{opacity:.55;cursor:pointer}",
|
|
1837
|
+
".@-dash{color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
|
|
1838
|
+
".@-clear{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-tertiary,#8f959e);font-size:14px;line-height:1;padding:2px 4px;cursor:pointer;border-radius:4px}",
|
|
1839
|
+
".@-clear:hover{color:var(--dsw-alias-state-error-primary,#d9534f);background:var(--dsw-alias-bg-skeleton,#f2f3f5)}",
|
|
1840
|
+
".@-hint{font-size:11px;color:var(--dsw-alias-state-error-primary,#d9534f);white-space:nowrap}",
|
|
1841
|
+
".@-ghost{appearance:none;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-secondary,#646a73);border-radius:8px;font-size:12px;padding:6px 10px;cursor:pointer}",
|
|
1842
|
+
".@-ghost:hover{border-color:var(--dsw-alias-brand-primary,#4f6ef7);color:var(--dsw-alias-brand-primary,#4f6ef7)}",
|
|
1843
|
+
".@-muted{color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
|
|
1844
|
+
// 难度分布的口径切换:轻量 tablist,视觉上与页首时间范围分段保持一致。
|
|
1845
|
+
".@-dims{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:0 0 8px}",
|
|
1846
|
+
".@-dims button{appearance:none;border:1px solid transparent;background:transparent;color:inherit;font:inherit;font-size:11.5px;padding:3px 8px;border-radius:6px;cursor:pointer;opacity:.7;white-space:nowrap}",
|
|
1847
|
+
".@-dims button:hover{background:var(--dsw-alias-bg-skeleton,#f2f3f5);opacity:1}",
|
|
1848
|
+
".@-dims button[aria-selected=true]{border-color:var(--dsw-alias-border-l2,#e5e6eb);background:var(--dsw-alias-bg-skeleton,#f2f3f5);font-weight:600;opacity:1}",
|
|
1849
|
+
".@-dims button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
1850
|
+
".@-sgrid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:12px}",
|
|
1851
|
+
// 分区容器:把 12 栅格切成「一眼看清 → 结构 → 风险 → 排行 → 明细」几段,
|
|
1852
|
+
// 每段自己一条标题带,卡片之间仍按 span 排;段与段之间用更大的间距制造阅读停顿。
|
|
1853
|
+
".@-sect{grid-column:span 12;display:flex;flex-direction:column;gap:8px;min-width:0}",
|
|
1854
|
+
".@-sect-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;padding:2px 2px 0}",
|
|
1855
|
+
".@-sect-title{margin:0;font-size:13px;font-weight:650;letter-spacing:.2px;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1856
|
+
".@-sect-note{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
|
|
1857
|
+
".@-sect-body{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:12px;min-width:0}",
|
|
1858
|
+
".@-scard{grid-column:span 6;min-width:0;background:var(--dsw-alias-bg-layer-1,#fff);border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:12px;padding:14px 16px}",
|
|
1859
|
+
".@-span-3{grid-column:span 3}.@-span-4{grid-column:span 4}.@-span-6{grid-column:span 6}.@-span-8{grid-column:span 8}.@-span-12{grid-column:span 12}",
|
|
1860
|
+
".@-chead{display:flex;align-items:baseline;gap:8px;margin-bottom:10px;flex-wrap:wrap}",
|
|
1861
|
+
".@-ctitle{font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1862
|
+
".@-cnote{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
|
|
1863
|
+
".@-kpis{grid-column:span 12;display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px}",
|
|
1864
|
+
// 核心指标与次级指标分两行:核心 4 张给足字号,次级 4 张收紧,避免 8 张 KPI 抢同一层的视觉重量。
|
|
1865
|
+
".@-kpis-main{grid-template-columns:repeat(4,minmax(0,1fr))}",
|
|
1866
|
+
".@-kpis-sub{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}",
|
|
1867
|
+
".@-kpi-lg{padding:14px 16px}",
|
|
1868
|
+
".@-kpi-lg .@-kpi-v{font-size:30px}",
|
|
1869
|
+
".@-kpi-sm{padding:9px 12px}",
|
|
1870
|
+
".@-kpi-sm .@-kpi-l{font-size:11.5px}",
|
|
1871
|
+
".@-kpi-sm .@-kpi-v{font-size:19px}",
|
|
1872
|
+
".@-kpi-sm .@-kpi-h{font-size:10.5px;margin-top:1px}",
|
|
1873
|
+
".@-kpi{background:var(--dsw-alias-bg-layer-1,#fff);border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:12px;padding:12px 14px;min-width:0}",
|
|
1874
|
+
".@-kpi-l{font-size:12px;color:var(--dsw-alias-label-tertiary,#8f959e);display:flex;align-items:center;gap:6px}",
|
|
1875
|
+
".@-kpi-v{font-size:26px;line-height:1.25;font-weight:650;margin-top:4px;font-variant-numeric:tabular-nums}",
|
|
1876
|
+
".@-kpi-u{font-size:12px;font-weight:400;color:var(--dsw-alias-label-tertiary,#8f959e);margin-left:3px}",
|
|
1877
|
+
".@-kpi-h{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e);margin-top:3px}",
|
|
1878
|
+
".@-kpi.@-kpi-tone-danger .@-kpi-v{color:var(--dsw-alias-state-error-primary,#d9534f)}",
|
|
1879
|
+
".@-kpi.@-kpi-tone-warn .@-kpi-v{color:var(--dsw-alias-state-warn-primary,#d99100)}",
|
|
1880
|
+
".@-kpi.@-kpi-tone-ok .@-kpi-v{color:var(--dsw-alias-state-success-primary,#2f9e6e)}",
|
|
1881
|
+
".@-donut{display:flex;align-items:center;gap:16px;flex-wrap:wrap}",
|
|
1882
|
+
".@-donut svg{flex:0 0 auto}",
|
|
1883
|
+
".@-legend{display:flex;flex-direction:column;gap:7px;min-width:120px;flex:1}",
|
|
1884
|
+
".@-leg{display:flex;align-items:center;gap:7px;font-size:12px;color:var(--dsw-alias-label-secondary,#646a73)}",
|
|
1885
|
+
".@-dot{width:8px;height:8px;border-radius:50%;flex:0 0 auto}",
|
|
1886
|
+
".@-leg b{margin-left:auto;font-weight:600;color:var(--dsw-alias-label-primary,#1f2329);font-variant-numeric:tabular-nums}",
|
|
1887
|
+
".@-bars{display:flex;flex-direction:column;gap:9px}",
|
|
1888
|
+
".@-bar{display:grid;grid-template-columns:minmax(72px,1.2fr) 3fr auto;gap:8px;align-items:center;font-size:12px}",
|
|
1889
|
+
".@-bar-l{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary,#646a73)}",
|
|
1890
|
+
".@-bar-t{display:block;height:8px;border-radius:6px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);overflow:hidden}",
|
|
1891
|
+
".@-bar-f{display:block;height:100%;border-radius:6px;background:var(--dsw-alias-state-business-primary,#4f6ef7);min-width:2px}",
|
|
1892
|
+
".@-bar-v{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary,#1f2329);font-weight:600;min-width:34px;text-align:right}",
|
|
1893
|
+
".@-stack{display:flex;flex-direction:column;gap:10px}",
|
|
1894
|
+
".@-srow-l{font-size:12px;color:var(--dsw-alias-label-secondary,#646a73);margin-bottom:4px;display:flex}",
|
|
1895
|
+
".@-srow-l b{margin-left:auto;color:var(--dsw-alias-label-primary,#1f2329);font-variant-numeric:tabular-nums}",
|
|
1896
|
+
".@-strack{display:flex;height:10px;border-radius:6px;overflow:hidden;background:var(--dsw-alias-bg-skeleton,#f2f3f5)}",
|
|
1897
|
+
".@-seg-f{height:100%}",
|
|
1898
|
+
".@-hist{display:flex;align-items:flex-end;gap:8px;height:150px;padding-top:16px}",
|
|
1899
|
+
".@-hbar{flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:5px;min-width:0;height:100%}",
|
|
1900
|
+
".@-hbar-v{font-size:11px;color:var(--dsw-alias-label-secondary,#646a73);font-variant-numeric:tabular-nums}",
|
|
1901
|
+
".@-hbar-f{width:100%;max-width:44px;border-radius:5px 5px 0 0;background:var(--dsw-alias-state-business-primary,#4f6ef7);min-height:2px}",
|
|
1902
|
+
".@-hbar-l{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}",
|
|
1903
|
+
".@-hbar-link{cursor:pointer;border-radius:6px;padding-top:2px}",
|
|
1904
|
+
".@-hbar-link:hover{background:var(--dsw-alias-bg-skeleton,#f2f3f5)}",
|
|
1905
|
+
".@-hbar-link:hover .@-hbar-l,.@-hbar-link:focus-visible .@-hbar-l{color:var(--dsw-alias-brand-primary,#4f6ef7)}",
|
|
1906
|
+
".@-hbar-link:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
1907
|
+
".@-trend{width:100%;height:auto;display:block}",
|
|
1908
|
+
".@-tlegend{display:flex;gap:14px;flex-wrap:wrap;margin-top:6px;font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
|
|
1909
|
+
".@-trend-wrap{position:relative}",
|
|
1910
|
+
".@-trend-box{position:relative;border-radius:10px}",
|
|
1911
|
+
".@-trend-box:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
1912
|
+
".@-trend-tip{position:absolute;top:4px;z-index:3;pointer-events:none;display:flex;flex-direction:column;gap:2px;min-width:104px;padding:6px 8px;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:8px;background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 6px 20px color-mix(in srgb,var(--dsw-alias-label-primary,#1f2329) 16%,transparent);font-size:11px;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1913
|
+
".@-tip-day{font-size:11.5px;margin-bottom:2px}",
|
|
1914
|
+
".@-tip-row{display:flex;align-items:center;gap:6px;white-space:nowrap}",
|
|
1915
|
+
".@-tip-name{color:var(--dsw-alias-label-secondary,#646a73)}",
|
|
1916
|
+
".@-tip-row b{margin-left:auto;font-variant-numeric:tabular-nums}",
|
|
1917
|
+
".@-tlegend-item{display:inline-flex;align-items:center;gap:5px;appearance:none;border:0;background:none;padding:2px 0;font:inherit;font-size:11px;color:inherit;cursor:pointer;border-radius:4px}",
|
|
1918
|
+
".@-tlegend-item:hover:not(:disabled){color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1919
|
+
".@-tlegend-item[aria-pressed=false]{opacity:.45}",
|
|
1920
|
+
".@-tlegend-item[aria-pressed=false] .@-dot{background:transparent;border:1px solid currentColor}",
|
|
1921
|
+
".@-tlegend-item:disabled{cursor:default}",
|
|
1922
|
+
".@-tlegend-item:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
1923
|
+
".@-dot-off{width:8px;height:8px;border-radius:50%;border:1px solid;flex:0 0 auto}",
|
|
1924
|
+
".@-table-scroll{max-width:100%;overflow-x:auto}.@-table{width:100%;border-collapse:collapse;font-size:12px}",
|
|
1925
|
+
".@-table th{text-align:left;font-weight:500;color:var(--dsw-alias-label-tertiary,#8f959e);padding:6px 8px;border-bottom:1px solid var(--dsw-alias-border-l2,#e5e6eb);white-space:nowrap}",
|
|
1926
|
+
".@-table td{padding:7px 8px;border-bottom:1px solid var(--dsw-alias-border-l1,#f2f3f5);color:var(--dsw-alias-label-secondary,#646a73);vertical-align:top}",
|
|
1927
|
+
".@-table tr:last-child td{border-bottom:0}",
|
|
1928
|
+
".@-table th.@-num,.@-table td.@-num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}",
|
|
1929
|
+
".@-empty{padding:26px 8px;text-align:center;color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
|
|
1930
|
+
".@-err{display:flex;align-items:center;gap:10px;background:color-mix(in srgb,var(--dsw-alias-state-error-primary,#d9534f) 8%,transparent);border:1px solid color-mix(in srgb,var(--dsw-alias-state-error-primary,#d9534f) 30%,transparent);color:var(--dsw-alias-state-error-primary,#d9534f);border-radius:10px;padding:10px 12px;font-size:12px}",
|
|
1931
|
+
".@-warnbar{grid-column:span 12;border:1px dashed var(--dsw-alias-state-warn-primary,#d99100);border-radius:10px;padding:9px 12px;font-size:12px;color:var(--dsw-alias-state-warn-primary,#d99100);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#d99100) 6%,transparent)}",
|
|
1932
|
+
".@-sk{height:14px;border-radius:6px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);margin:7px 0;animation:@-pulse 1.2s ease-in-out infinite}",
|
|
1933
|
+
"@keyframes @-pulse{0%,100%{opacity:.55}50%{opacity:1}}",
|
|
1934
|
+
"@media (max-width:900px){.@-scard{grid-column:span 12}.@-span-3,.@-span-4,.@-span-6,.@-span-8{grid-column:span 12}.@-kpis,.@-kpis-main,.@-kpis-sub{grid-template-columns:repeat(2,minmax(0,1fr))}}",
|
|
1935
|
+
"@media (max-width:600px){.@-stats{padding-bottom:16px;gap:14px}.@-hist{height:130px}.@-kpi-v{font-size:22px}.@-kpi-lg .@-kpi-v{font-size:24px}.@-kpi-sm .@-kpi-v{font-size:18px}}",
|
|
1936
|
+
"@media (prefers-reduced-motion:reduce){.@-sk{animation:none}}",
|
|
1937
|
+
require_date_picker_styles()(prefix)
|
|
1938
|
+
].join("\n").replace(/@-/g, prefix + "-");
|
|
1939
|
+
}
|
|
1940
|
+
function makeCharts(prefix) {
|
|
1941
|
+
if (typeof document !== "undefined" && !document.getElementById(prefix + "-charts-css")) {
|
|
1942
|
+
var el = document.createElement("style");
|
|
1943
|
+
el.id = prefix + "-charts-css";
|
|
1944
|
+
el.textContent = css(prefix);
|
|
1945
|
+
document.head.appendChild(el);
|
|
1946
|
+
}
|
|
1947
|
+
var base = LIB.primitives(prefix);
|
|
1948
|
+
var num = base.num, pct = base.pct, timeText = base.timeText, dateText = base.dateText;
|
|
1949
|
+
var Donut = base.Donut, BarList = base.BarList, StackedRows = base.StackedRows;
|
|
1950
|
+
var ErrorBar = base.ErrorBar, Empty = base.Empty, Skeleton = base.Skeleton;
|
|
1951
|
+
function Card(props) {
|
|
1952
|
+
var cls = prefix + "-scard" + (props.span ? " " + prefix + "-span-" + props.span : "");
|
|
1953
|
+
return h(
|
|
1954
|
+
"section",
|
|
1955
|
+
{ className: cls },
|
|
1956
|
+
props.title || props.right ? h(
|
|
1957
|
+
"div",
|
|
1958
|
+
{ className: prefix + "-chead" },
|
|
1959
|
+
h("span", { className: prefix + "-ctitle" }, props.title),
|
|
1960
|
+
props.note ? h("span", { className: prefix + "-cnote" }, props.note) : null,
|
|
1961
|
+
props.right ? h("span", { style: { marginLeft: "auto" } }, props.right) : null
|
|
1962
|
+
) : null,
|
|
1963
|
+
props.children
|
|
1964
|
+
);
|
|
1965
|
+
}
|
|
1966
|
+
function Section(props) {
|
|
1967
|
+
var body = props.children || [];
|
|
1968
|
+
var list = Array.isArray(body) ? body.filter(function(n) {
|
|
1969
|
+
return n !== null && n !== void 0 && n !== false;
|
|
1970
|
+
}) : body;
|
|
1971
|
+
if (Array.isArray(list) && !list.length) return null;
|
|
1972
|
+
return h(
|
|
1973
|
+
"section",
|
|
1974
|
+
{ className: prefix + "-sect", "aria-label": props.title },
|
|
1975
|
+
h(
|
|
1976
|
+
"div",
|
|
1977
|
+
{ className: prefix + "-sect-head" },
|
|
1978
|
+
h("h2", { className: prefix + "-sect-title" }, props.title),
|
|
1979
|
+
props.note ? h("span", { className: prefix + "-sect-note" }, props.note) : null,
|
|
1980
|
+
props.right ? h("span", { className: prefix + "-sect-note", style: { marginLeft: "auto" } }, props.right) : null
|
|
1981
|
+
),
|
|
1982
|
+
h("div", { className: prefix + "-sect-body" }, list)
|
|
1282
1983
|
);
|
|
1283
1984
|
}
|
|
1284
|
-
function
|
|
1285
|
-
var
|
|
1286
|
-
var
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
"div",
|
|
1293
|
-
{ key: d.key || d.label || i, className: prefix + "-bar" },
|
|
1294
|
-
h("span", { className: prefix + "-bar-l", title: d.title || d.label }, d.label),
|
|
1295
|
-
h("span", { className: prefix + "-bar-t" }, h("span", { className: prefix + "-bar-f", style: { width: Math.max(2, v / max * 100) + "%", background: d.color || props.color || COLORS[0] } })),
|
|
1296
|
-
h("span", { className: prefix + "-bar-v" }, props.format ? props.format(v) : num(props.lang, v))
|
|
1297
|
-
);
|
|
1298
|
-
}));
|
|
1299
|
-
}
|
|
1300
|
-
function StackedRows(props) {
|
|
1301
|
-
var rows = props.rows || [];
|
|
1302
|
-
var keys = props.keys || [];
|
|
1303
|
-
return h("div", { className: prefix + "-stack" }, rows.map(function(row, ri) {
|
|
1304
|
-
var total = Number(row.total || 0) || 1;
|
|
1305
|
-
return h(
|
|
1985
|
+
function Kpi(props) {
|
|
1986
|
+
var tone = props.tone ? " " + prefix + "-kpi-tone-" + props.tone : "";
|
|
1987
|
+
var size = props.size === "lg" || props.size === "sm" ? " " + prefix + "-kpi-" + props.size : "";
|
|
1988
|
+
return h(
|
|
1989
|
+
"div",
|
|
1990
|
+
{ className: prefix + "-kpi" + size + tone },
|
|
1991
|
+
h("div", { className: prefix + "-kpi-l" }, props.label),
|
|
1992
|
+
h(
|
|
1306
1993
|
"div",
|
|
1307
|
-
{
|
|
1308
|
-
|
|
1309
|
-
h("
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
key: k.key,
|
|
1314
|
-
className: prefix + "-seg-f",
|
|
1315
|
-
title: k.label + " " + v,
|
|
1316
|
-
style: { width: v / total * 100 + "%", background: k.color || COLORS[i % COLORS.length] }
|
|
1317
|
-
});
|
|
1318
|
-
}))
|
|
1319
|
-
);
|
|
1320
|
-
}));
|
|
1994
|
+
{ className: prefix + "-kpi-v" },
|
|
1995
|
+
props.value === null || props.value === void 0 ? "\u2014" : typeof props.value === "number" ? num(props.lang, props.value) : props.value,
|
|
1996
|
+
props.unit ? h("span", { className: prefix + "-kpi-u" }, props.unit) : null
|
|
1997
|
+
),
|
|
1998
|
+
props.hint ? h("div", { className: prefix + "-kpi-h" }, props.hint) : null
|
|
1999
|
+
);
|
|
1321
2000
|
}
|
|
1322
2001
|
function Trend(props) {
|
|
1323
2002
|
var data = props.data || [];
|
|
1324
2003
|
var series = props.series || [];
|
|
1325
|
-
var
|
|
2004
|
+
var size = base.useWidth();
|
|
2005
|
+
var width = Math.max(260, size[1] || 640);
|
|
1326
2006
|
var height = props.height || 200;
|
|
1327
2007
|
var left = 30, right = 10, top = 12, bottom = 24;
|
|
1328
2008
|
var pw = width - left - right, ph = height - top - bottom;
|
|
@@ -1375,7 +2055,7 @@ var require_charts = __commonJS({
|
|
|
1375
2055
|
) : null;
|
|
1376
2056
|
return h(
|
|
1377
2057
|
"div",
|
|
1378
|
-
{ className: prefix + "-trend-wrap" },
|
|
2058
|
+
{ className: prefix + "-trend-wrap", ref: size[0] },
|
|
1379
2059
|
h(
|
|
1380
2060
|
"div",
|
|
1381
2061
|
{
|
|
@@ -1400,13 +2080,13 @@ var require_charts = __commonJS({
|
|
|
1400
2080
|
},
|
|
1401
2081
|
h(
|
|
1402
2082
|
"svg",
|
|
1403
|
-
{ className: prefix + "-trend", viewBox: "0 0 " + width + " " + height, "aria-hidden": "true" },
|
|
2083
|
+
{ className: prefix + "-trend", viewBox: "0 0 " + width + " " + height, width, height, "aria-hidden": "true" },
|
|
1404
2084
|
ticks.map(function(v, i2) {
|
|
1405
2085
|
return h(
|
|
1406
2086
|
"g",
|
|
1407
2087
|
{ key: "t" + i2 },
|
|
1408
2088
|
h("line", { x1: left, x2: width - right, y1: y(v), y2: y(v), stroke: "var(--dsw-alias-border-l1,#f2f3f5)", strokeWidth: 1 }),
|
|
1409
|
-
h("text", { x: left -
|
|
2089
|
+
h("text", { x: left - 6, y: y(v) + 3, textAnchor: "end", fontSize: 11, fill: "var(--dsw-alias-label-tertiary,#8f959e)" }, num(props.lang, v))
|
|
1410
2090
|
);
|
|
1411
2091
|
}),
|
|
1412
2092
|
activeRow ? h("line", {
|
|
@@ -1600,39 +2280,6 @@ var require_charts = __commonJS({
|
|
|
1600
2280
|
function Missing(props) {
|
|
1601
2281
|
return h("div", { className: prefix + "-empty " + prefix + "-missing", role: "status" }, props.text || "\u6682\u65E0\u6570\u636E");
|
|
1602
2282
|
}
|
|
1603
|
-
function Empty(props) {
|
|
1604
|
-
return h("div", { className: prefix + "-empty" }, props.text || "\u6682\u65E0\u6570\u636E");
|
|
1605
|
-
}
|
|
1606
|
-
function Skeleton() {
|
|
1607
|
-
return h(
|
|
1608
|
-
"div",
|
|
1609
|
-
{ className: prefix + "-sgrid" },
|
|
1610
|
-
h("div", { className: prefix + "-kpis" }, [0, 1, 2, 3].map(function(i) {
|
|
1611
|
-
return h(
|
|
1612
|
-
"div",
|
|
1613
|
-
{ key: i, className: prefix + "-kpi" },
|
|
1614
|
-
h("div", { className: prefix + "-sk", style: { width: "40%" } }),
|
|
1615
|
-
h("div", { className: prefix + "-sk", style: { width: "65%", height: 26 } })
|
|
1616
|
-
);
|
|
1617
|
-
})),
|
|
1618
|
-
[0, 1].map(function(i) {
|
|
1619
|
-
return h(
|
|
1620
|
-
"div",
|
|
1621
|
-
{ key: "c" + i, className: prefix + "-scard " + prefix + "-span-6" },
|
|
1622
|
-
h("div", { className: prefix + "-sk", style: { width: "30%" } }),
|
|
1623
|
-
h("div", { className: prefix + "-sk", style: { height: 120 } })
|
|
1624
|
-
);
|
|
1625
|
-
})
|
|
1626
|
-
);
|
|
1627
|
-
}
|
|
1628
|
-
function ErrorBar(props) {
|
|
1629
|
-
return h(
|
|
1630
|
-
"div",
|
|
1631
|
-
{ className: prefix + "-err", role: "alert" },
|
|
1632
|
-
h("span", null, props.message),
|
|
1633
|
-
props.onRetry ? h("button", { type: "button", className: prefix + "-ghost", onClick: props.onRetry }, props.retryLabel || "\u91CD\u8BD5") : null
|
|
1634
|
-
);
|
|
1635
|
-
}
|
|
1636
2283
|
function Warnings(props) {
|
|
1637
2284
|
var items = props.items || [];
|
|
1638
2285
|
if (!items.length) return null;
|
|
@@ -2323,8 +2970,8 @@ var require_heatmap_model = __commonJS({
|
|
|
2323
2970
|
var TYPES = FILTER_TYPES.concat(["target"]);
|
|
2324
2971
|
var LEVELS = [{ min: 1, max: 1, label: "1" }, { min: 2, max: 3, label: "2\u20133" }, { min: 4, max: 6, label: "4\u20136" }, { min: 7, max: null, label: "7+" }];
|
|
2325
2972
|
var COPY = {
|
|
2326
|
-
zh: { title: "\u5E74\u5EA6\u6D3B\u52A8", previous: "\u4E0A\u4E00\u5E74", next: "\u4E0B\u4E00\u5E74", done: "\u5B8C\u6210", publish: "\u53D1\u5E03", shutdown: "\u5173\u95ED", claimed: "\u63A5\u53D6", target: "\u76EE\u6807", empty: { done: "\u672C\u5E74\u5EA6\u6CA1\u6709\u5B8C\u6210\u8BB0\u5F55", publish: "\u672C\u5E74\u5EA6\u6CA1\u6709\u53D1\u5E03\u8BB0\u5F55", shutdown: "\u672C\u5E74\u5EA6\u6CA1\u6709\u5173\u95ED\u8BB0\u5F55", claimed: "\u672C\u5E74\u5EA6\u6CA1\u6709\u63A5\u53D6\u8BB0\u5F55", target: "\u672C\u5E74\u5EA6\u6CA1\u6709\u76EE\u6807\u8BA1\u5212" }, loading: "\u6B63\u5728\u52A0\u8F7D\u5E74\u5EA6\u6D3B\u52A8", error: "\u5E74\u5EA6\u6D3B\u52A8\u52A0\u8F7D\u5931\u8D25", retry: "\u91CD\u8BD5", future: "\u672A\u6765\u65E5\u671F", none: "\u65E0\u6D3B\u52A8", clear: "\u6E05\u9664\u6D3B\u52A8\u7B5B\u9009", filter: "\u6D3B\u52A8\u7B5B\u9009", total: "\u6D3B\u52A8\u603B\u6570", dailyCount: "\u6BCF\u65E5\u6B21\u6570", weekdays: ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u65E5"], claimedNote: "\u5DF2\u63A5\u53D6/\u5DF2\u5B8C\u6210\u4EFB\u52A1\uFF1B\u5386\u53F2\u4EFB\u52A1\u672A\u8BB0\u5F55\u63A5\u53D6\u65F6\u95F4\uFF0C\u6309\u53D1\u5E03\u65E5\u671F\u8BA1", targetNote: "\u6309\u76EE\u6807\u8BA1\u5212\u65E5\u671F\u7EDF\u8BA1\uFF0C\u5C5E\u4E8E\u8BA1\u5212\u53E3\u5F84\uFF0C\u4E0D\u8BA1\u5165\u6D3B\u52A8\u603B\u6570", targetTotal: "\u76EE\u6807\u603B\u6570" },
|
|
2327
|
-
en: { title: "Annual task activity", previous: "Previous year", next: "Next year", done: "Done", publish: "Published", shutdown: "Closed", claimed: "Claimed", target: "Target", empty: { done: "No completed tasks this year", publish: "No published tasks this year", shutdown: "No closed tasks this year", claimed: "No claimed tasks this year", target: "No target dates this year" }, loading: "Loading annual activity", error: "Could not load annual activity", retry: "Retry", future: "Future date", none: "No activity", clear: "Clear activity filter", filter: "Activity filter", total: "Total events", dailyCount: "Daily count", weekdays: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], claimedNote: "claimed or completed tasks; historical tasks without a claim time use the publish date", targetNote: "counted by target plan date; planning scope, not included in total events", targetTotal: "Planned" }
|
|
2973
|
+
zh: { title: "\u5E74\u5EA6\u6D3B\u52A8", previous: "\u4E0A\u4E00\u5E74", next: "\u4E0B\u4E00\u5E74", done: "\u5B8C\u6210", publish: "\u53D1\u5E03", shutdown: "\u5173\u95ED", claimed: "\u63A5\u53D6", target: "\u76EE\u6807", empty: { done: "\u672C\u5E74\u5EA6\u6CA1\u6709\u5B8C\u6210\u8BB0\u5F55", publish: "\u672C\u5E74\u5EA6\u6CA1\u6709\u53D1\u5E03\u8BB0\u5F55", shutdown: "\u672C\u5E74\u5EA6\u6CA1\u6709\u5173\u95ED\u8BB0\u5F55", claimed: "\u672C\u5E74\u5EA6\u6CA1\u6709\u63A5\u53D6\u8BB0\u5F55", target: "\u672C\u5E74\u5EA6\u6CA1\u6709\u76EE\u6807\u8BA1\u5212" }, loading: "\u6B63\u5728\u52A0\u8F7D\u5E74\u5EA6\u6D3B\u52A8", error: "\u5E74\u5EA6\u6D3B\u52A8\u52A0\u8F7D\u5931\u8D25", retry: "\u91CD\u8BD5", future: "\u672A\u6765\u65E5\u671F", none: "\u65E0\u6D3B\u52A8", nonePlan: "\u65E0\u8BA1\u5212", clear: "\u6E05\u9664\u6D3B\u52A8\u7B5B\u9009", filter: "\u6D3B\u52A8\u7B5B\u9009", total: "\u6D3B\u52A8\u603B\u6570", dailyCount: "\u6BCF\u65E5\u6B21\u6570", weekdays: ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u65E5"], claimedNote: "\u5DF2\u63A5\u53D6/\u5DF2\u5B8C\u6210\u4EFB\u52A1\uFF1B\u5386\u53F2\u4EFB\u52A1\u672A\u8BB0\u5F55\u63A5\u53D6\u65F6\u95F4\uFF0C\u6309\u53D1\u5E03\u65E5\u671F\u8BA1", targetNote: "\u6309\u76EE\u6807\u8BA1\u5212\u65E5\u671F\u7EDF\u8BA1\uFF0C\u5C5E\u4E8E\u8BA1\u5212\u53E3\u5F84\uFF0C\u4E0D\u8BA1\u5165\u6D3B\u52A8\u603B\u6570", targetTotal: "\u76EE\u6807\u603B\u6570" },
|
|
2974
|
+
en: { title: "Annual task activity", previous: "Previous year", next: "Next year", done: "Done", publish: "Published", shutdown: "Closed", claimed: "Claimed", target: "Target", empty: { done: "No completed tasks this year", publish: "No published tasks this year", shutdown: "No closed tasks this year", claimed: "No claimed tasks this year", target: "No target dates this year" }, loading: "Loading annual activity", error: "Could not load annual activity", retry: "Retry", future: "Future date", none: "No activity", nonePlan: "No plan", clear: "Clear activity filter", filter: "Activity filter", total: "Total events", dailyCount: "Daily count", weekdays: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], claimedNote: "claimed or completed tasks; historical tasks without a claim time use the publish date", targetNote: "counted by target plan date; planning scope, not included in total events", targetTotal: "Planned" }
|
|
2328
2975
|
};
|
|
2329
2976
|
function localDay(d) {
|
|
2330
2977
|
return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0");
|
|
@@ -2351,6 +2998,12 @@ var require_heatmap_model = __commonJS({
|
|
|
2351
2998
|
function count(day, type) {
|
|
2352
2999
|
return Number(day[type]) || 0;
|
|
2353
3000
|
}
|
|
3001
|
+
function suppressFuture(type) {
|
|
3002
|
+
return FILTER_TYPES.indexOf(type) >= 0;
|
|
3003
|
+
}
|
|
3004
|
+
function isFuture(date, today, type) {
|
|
3005
|
+
return !!suppressFuture(type) && date > today;
|
|
3006
|
+
}
|
|
2354
3007
|
function background(day, type) {
|
|
2355
3008
|
return count(day, type) ? "var(--hm-" + type + "-" + level(count(day, type)) + ")" : "var(--hm-empty)";
|
|
2356
3009
|
}
|
|
@@ -2361,7 +3014,7 @@ var require_heatmap_model = __commonJS({
|
|
|
2361
3014
|
if (!params || !/^\d{4}-\d{2}-\d{2}$/.test(params.activityDate || "")) return null;
|
|
2362
3015
|
return { activityDate: params.activityDate, activityType: FILTER_TYPES.indexOf(params.activityType) >= 0 ? params.activityType : "done" };
|
|
2363
3016
|
}
|
|
2364
|
-
module2.exports = { TYPES, FILTER_TYPES, LEVELS, COPY, legendLabel, localDay, calendar, level, count, background, label, activityParams };
|
|
3017
|
+
module2.exports = { TYPES, FILTER_TYPES, LEVELS, COPY, legendLabel, localDay, calendar, level, count, suppressFuture, isFuture, background, label, activityParams };
|
|
2365
3018
|
}
|
|
2366
3019
|
});
|
|
2367
3020
|
|
|
@@ -2542,10 +3195,10 @@ var require_heatmap = __commonJS({
|
|
|
2542
3195
|
return h("span", { key: d.date, style: { gridColumn: d.column } }, new Date(Date.UTC(year, d.month, 1)).toLocaleString(lang === "en" ? "en-US" : "zh-CN", { month: "short", timeZone: "UTC" }));
|
|
2543
3196
|
})),
|
|
2544
3197
|
h("div", { className: "wbt-hm-grid" }, geometry.days.map(function(d) {
|
|
2545
|
-
var day = byDate[d.date] || {}, future = d.date
|
|
3198
|
+
var day = byDate[d.date] || {}, future = model.isFuture(d.date, today, type), n = future ? 0 : model.count(day, type), enabled = !future && n > 0;
|
|
2546
3199
|
var clickable = enabled && type !== "target";
|
|
2547
3200
|
var text = !future && n > 0 ? n >= 100 ? "99+" : String(n) : "";
|
|
2548
|
-
var title = model.label(d.date, day, t, type) + (future ? " \xB7 " + t.future : !n ? " \xB7 " + t.none : "");
|
|
3201
|
+
var title = model.label(d.date, day, t, type) + (future ? " \xB7 " + t.future : !n ? " \xB7 " + (type === "target" ? t.nonePlan : t.none) : "");
|
|
2549
3202
|
return h("button", {
|
|
2550
3203
|
key: d.date,
|
|
2551
3204
|
type: "button",
|
|
@@ -5759,6 +6412,42 @@ var require_copy = __commonJS({
|
|
|
5759
6412
|
}
|
|
5760
6413
|
});
|
|
5761
6414
|
|
|
6415
|
+
// packages/addons/lib/icons.cjs
|
|
6416
|
+
var require_icons = __commonJS({
|
|
6417
|
+
"packages/addons/lib/icons.cjs"(exports2, module2) {
|
|
6418
|
+
"use strict";
|
|
6419
|
+
var h = require("react").createElement;
|
|
6420
|
+
function create(prefix, glyphs, options) {
|
|
6421
|
+
var opts = options || {};
|
|
6422
|
+
var ICONS = Object.assign({}, glyphs);
|
|
6423
|
+
function Icon2(props) {
|
|
6424
|
+
var C = ICONS[props.name] || (opts.fallback ? ICONS[opts.fallback] : null);
|
|
6425
|
+
if (!C) return null;
|
|
6426
|
+
var size = typeof opts.sizeOf === "function" ? opts.sizeOf(props) : props.size || 14;
|
|
6427
|
+
var cls = prefix + "-svg" + (opts.classNameAppend && props.className ? " " + props.className : "");
|
|
6428
|
+
var attrs = {
|
|
6429
|
+
size,
|
|
6430
|
+
strokeWidth: props.strokeWidth || 2,
|
|
6431
|
+
"aria-hidden": "true",
|
|
6432
|
+
className: cls
|
|
6433
|
+
};
|
|
6434
|
+
if (opts.focusable) attrs.focusable = false;
|
|
6435
|
+
return h(C, attrs);
|
|
6436
|
+
}
|
|
6437
|
+
var set = { ICONS, Icon: Icon2 };
|
|
6438
|
+
if (opts.tabIcon) {
|
|
6439
|
+
set.tabIcon = function(name) {
|
|
6440
|
+
return function TabIcon() {
|
|
6441
|
+
return h(Icon2, { name, size: 14 });
|
|
6442
|
+
};
|
|
6443
|
+
};
|
|
6444
|
+
}
|
|
6445
|
+
return set;
|
|
6446
|
+
}
|
|
6447
|
+
module2.exports = { create };
|
|
6448
|
+
}
|
|
6449
|
+
});
|
|
6450
|
+
|
|
5762
6451
|
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs
|
|
5763
6452
|
var toKebabCase;
|
|
5764
6453
|
var init_toKebabCase = __esm({
|
|
@@ -6924,52 +7613,147 @@ var init_refresh_cw = __esm({
|
|
|
6924
7613
|
});
|
|
6925
7614
|
|
|
6926
7615
|
// packages/addons/tasks/client/ui/icons.cjs
|
|
6927
|
-
var
|
|
7616
|
+
var require_icons2 = __commonJS({
|
|
6928
7617
|
"packages/addons/tasks/client/ui/icons.cjs"(exports2, module2) {
|
|
6929
7618
|
"use strict";
|
|
6930
|
-
var
|
|
6931
|
-
var
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
7619
|
+
var icons = require_icons();
|
|
7620
|
+
var set = icons.create("wbt", {
|
|
7621
|
+
filter: (init_sliders_horizontal(), __toCommonJS(sliders_horizontal_exports)).default,
|
|
7622
|
+
chart: (init_chart_column(), __toCommonJS(chart_column_exports)).default,
|
|
7623
|
+
settings: (init_settings(), __toCommonJS(settings_exports)).default,
|
|
7624
|
+
database: (init_database(), __toCommonJS(database_exports)).default,
|
|
7625
|
+
calendar: (init_calendar_days(), __toCommonJS(calendar_days_exports)).default,
|
|
6937
7626
|
"code-2": (init_code_xml(), __toCommonJS(code_xml_exports)).default,
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
7627
|
+
terminal: (init_terminal(), __toCommonJS(terminal_exports)).default,
|
|
7628
|
+
pilcrow: (init_pilcrow(), __toCommonJS(pilcrow_exports)).default,
|
|
7629
|
+
plus: (init_plus(), __toCommonJS(plus_exports)).default,
|
|
7630
|
+
minus: (init_minus(), __toCommonJS(minus_exports)).default,
|
|
7631
|
+
check: (init_check(), __toCommonJS(check_exports)).default,
|
|
7632
|
+
stop: (init_square(), __toCommonJS(square_exports)).default,
|
|
7633
|
+
restart: (init_rotate_ccw(), __toCommonJS(rotate_ccw_exports)).default,
|
|
7634
|
+
timeline: (init_list_tree(), __toCommonJS(list_tree_exports)).default,
|
|
7635
|
+
tree: (init_folder_tree(), __toCommonJS(folder_tree_exports)).default,
|
|
7636
|
+
search: (init_search(), __toCommonJS(search_exports)).default,
|
|
7637
|
+
grid: (init_layout_grid(), __toCommonJS(layout_grid_exports)).default,
|
|
7638
|
+
list: (init_list(), __toCommonJS(list_exports)).default,
|
|
7639
|
+
select: (init_square_check_big(), __toCommonJS(square_check_big_exports)).default,
|
|
7640
|
+
left: (init_chevron_left(), __toCommonJS(chevron_left_exports)).default,
|
|
7641
|
+
right: (init_chevron_right(), __toCommonJS(chevron_right_exports)).default,
|
|
7642
|
+
folder: (init_folder(), __toCommonJS(folder_exports)).default,
|
|
7643
|
+
folderOpen: (init_folder_open(), __toCommonJS(folder_open_exports)).default,
|
|
7644
|
+
table: (init_table_2(), __toCommonJS(table_2_exports)).default,
|
|
7645
|
+
house: (init_house(), __toCommonJS(house_exports)).default,
|
|
7646
|
+
folderPlus: (init_folder_plus(), __toCommonJS(folder_plus_exports)).default,
|
|
7647
|
+
filePlus: (init_file_plus(), __toCommonJS(file_plus_exports)).default,
|
|
7648
|
+
pencil: (init_pencil(), __toCommonJS(pencil_exports)).default,
|
|
7649
|
+
trash: (init_trash_2(), __toCommonJS(trash_2_exports)).default,
|
|
7650
|
+
close: (init_x(), __toCommonJS(x_exports)).default,
|
|
7651
|
+
down: (init_chevron_down(), __toCommonJS(chevron_down_exports)).default,
|
|
7652
|
+
tag: (init_tag(), __toCommonJS(tag_exports)).default,
|
|
7653
|
+
clock: (init_clock(), __toCommonJS(clock_exports)).default,
|
|
7654
|
+
refresh: (init_refresh_cw(), __toCommonJS(refresh_cw_exports)).default
|
|
7655
|
+
}, {});
|
|
7656
|
+
module2.exports = { ICONS: set.ICONS, Icon: set.Icon };
|
|
7657
|
+
}
|
|
7658
|
+
});
|
|
7659
|
+
|
|
7660
|
+
// packages/addons/lib/overlay.cjs
|
|
7661
|
+
var require_overlay = __commonJS({
|
|
7662
|
+
"packages/addons/lib/overlay.cjs"(exports2, module2) {
|
|
7663
|
+
"use strict";
|
|
7664
|
+
var defaultReact = require("react");
|
|
7665
|
+
var FOCUSABLE = "button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href]";
|
|
7666
|
+
module2.exports = function createOverlay(options) {
|
|
7667
|
+
var opts = options || {};
|
|
7668
|
+
var React = opts.React || defaultReact;
|
|
7669
|
+
var h = React.createElement;
|
|
7670
|
+
var tag = opts.tag || "section";
|
|
7671
|
+
var maskClass = opts.maskClass;
|
|
7672
|
+
var dialogClass = opts.dialogClass;
|
|
7673
|
+
var dialogClassOf = opts.dialogClassOf || function() {
|
|
7674
|
+
return "";
|
|
7675
|
+
};
|
|
7676
|
+
var ariaLabelOf = opts.ariaLabelOf || function(props) {
|
|
7677
|
+
return props["aria-label"] || props.title;
|
|
7678
|
+
};
|
|
7679
|
+
var ariaLabelledByOf = opts.ariaLabelledByOf || function() {
|
|
7680
|
+
return null;
|
|
7681
|
+
};
|
|
7682
|
+
var header = opts.header || null;
|
|
7683
|
+
var closeOnEscape = opts.closeOnEscape || function() {
|
|
7684
|
+
return true;
|
|
7685
|
+
};
|
|
7686
|
+
var closeOnMask = opts.closeOnMask || function() {
|
|
7687
|
+
return true;
|
|
7688
|
+
};
|
|
7689
|
+
var extraKeyDown = opts.onKeyDown || null;
|
|
7690
|
+
var autoFocusDialog = opts.autoFocusDialog !== false;
|
|
7691
|
+
var focusableSelector = opts.focusableSelector || FOCUSABLE;
|
|
7692
|
+
function Modal(props) {
|
|
7693
|
+
var ref = React.useRef(null);
|
|
7694
|
+
React.useEffect(function() {
|
|
7695
|
+
var previous = typeof document !== "undefined" ? document.activeElement : null;
|
|
7696
|
+
var focusIt = props.autoFocus !== void 0 ? props.autoFocus : autoFocusDialog;
|
|
7697
|
+
if (focusIt && ref.current) ref.current.focus();
|
|
7698
|
+
return function() {
|
|
7699
|
+
if (previous && previous.isConnected) previous.focus();
|
|
7700
|
+
};
|
|
7701
|
+
}, []);
|
|
7702
|
+
function onKeyDown(e) {
|
|
7703
|
+
if (extraKeyDown && extraKeyDown(e, props, ref)) return;
|
|
7704
|
+
if (e.key === "Escape") {
|
|
7705
|
+
if (!(props.closeOnEscape !== void 0 ? props.closeOnEscape : closeOnEscape(props))) return;
|
|
7706
|
+
e.preventDefault();
|
|
7707
|
+
e.stopPropagation();
|
|
7708
|
+
if (props.onClose) props.onClose();
|
|
7709
|
+
return;
|
|
7710
|
+
}
|
|
7711
|
+
if (e.key !== "Tab" || !ref.current) return;
|
|
7712
|
+
var els = ref.current.querySelectorAll(focusableSelector);
|
|
7713
|
+
if (!els.length) {
|
|
7714
|
+
e.preventDefault();
|
|
7715
|
+
return;
|
|
7716
|
+
}
|
|
7717
|
+
var first = els[0];
|
|
7718
|
+
var last = els[els.length - 1];
|
|
7719
|
+
if (e.shiftKey && (document.activeElement === first || document.activeElement === ref.current)) {
|
|
7720
|
+
e.preventDefault();
|
|
7721
|
+
last.focus();
|
|
7722
|
+
}
|
|
7723
|
+
if (!e.shiftKey && document.activeElement === last) {
|
|
7724
|
+
e.preventDefault();
|
|
7725
|
+
first.focus();
|
|
7726
|
+
}
|
|
7727
|
+
}
|
|
7728
|
+
var labelledBy = ariaLabelledByOf(props);
|
|
7729
|
+
return h(
|
|
7730
|
+
"div",
|
|
7731
|
+
{
|
|
7732
|
+
className: maskClass,
|
|
7733
|
+
onMouseDown: function(e) {
|
|
7734
|
+
var allowed = props.closeOnMask !== void 0 ? props.closeOnMask : closeOnMask(props);
|
|
7735
|
+
if (e.target === e.currentTarget && props.onClose && allowed) props.onClose();
|
|
7736
|
+
}
|
|
7737
|
+
},
|
|
7738
|
+
h(
|
|
7739
|
+
tag,
|
|
7740
|
+
{
|
|
7741
|
+
className: dialogClass + dialogClassOf(props),
|
|
7742
|
+
role: "dialog",
|
|
7743
|
+
"aria-modal": true,
|
|
7744
|
+
"aria-label": labelledBy ? null : ariaLabelOf(props),
|
|
7745
|
+
"aria-labelledby": labelledBy || null,
|
|
7746
|
+
ref,
|
|
7747
|
+
tabIndex: -1,
|
|
7748
|
+
onKeyDown
|
|
7749
|
+
},
|
|
7750
|
+
header ? header(props) : null,
|
|
7751
|
+
props.children
|
|
7752
|
+
)
|
|
7753
|
+
);
|
|
7754
|
+
}
|
|
7755
|
+
return Modal;
|
|
6966
7756
|
};
|
|
6967
|
-
function Icon2(props) {
|
|
6968
|
-
var C = ICONS[props.name];
|
|
6969
|
-
if (!C) return null;
|
|
6970
|
-
return h(C, { size: props.size || 14, strokeWidth: 2, "aria-hidden": "true", className: "wbt-svg" });
|
|
6971
|
-
}
|
|
6972
|
-
module2.exports = { ICONS, Icon: Icon2 };
|
|
6973
7757
|
}
|
|
6974
7758
|
});
|
|
6975
7759
|
|
|
@@ -6979,6 +7763,16 @@ var require_workspace_view = __commonJS({
|
|
|
6979
7763
|
"use strict";
|
|
6980
7764
|
module2.exports = function(deps) {
|
|
6981
7765
|
var React = deps.React, h = React.createElement;
|
|
7766
|
+
var createOverlay = deps.createOverlay;
|
|
7767
|
+
var FormOverlay = createOverlay({
|
|
7768
|
+
React,
|
|
7769
|
+
maskClass: "wbt-modal-mask",
|
|
7770
|
+
dialogClass: "wbt-modal",
|
|
7771
|
+
ariaLabelOf: function(props) {
|
|
7772
|
+
return props.mode === "edit" ? props.t.formEdit : props.t.formCreate;
|
|
7773
|
+
},
|
|
7774
|
+
closeOnMask: false
|
|
7775
|
+
});
|
|
6982
7776
|
var Icon2 = typeof deps.Icon === "function" ? deps.Icon : null;
|
|
6983
7777
|
function icon(name, size) {
|
|
6984
7778
|
return Icon2 ? h(Icon2, { name, size: size || 13 }) : null;
|
|
@@ -7154,27 +7948,23 @@ var require_workspace_view = __commonJS({
|
|
|
7154
7948
|
});
|
|
7155
7949
|
}
|
|
7156
7950
|
return h(
|
|
7157
|
-
|
|
7158
|
-
{
|
|
7951
|
+
FormOverlay,
|
|
7952
|
+
{ t, mode: props.mode, onClose: props.onCancel, closeOnMask: false },
|
|
7953
|
+
h("div", { className: "wbt-modal-head" }, h("h3", null, props.mode === "edit" ? t.formEdit : t.formCreate)),
|
|
7159
7954
|
h(
|
|
7160
7955
|
"div",
|
|
7161
|
-
{ className: "wbt-
|
|
7162
|
-
h("
|
|
7163
|
-
h(
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
h(
|
|
7173
|
-
"div",
|
|
7174
|
-
{ className: "wbt-modal-foot" },
|
|
7175
|
-
h("button", { className: "wbt-btn primary", type: "button", disabled: busy, onClick: submit }, t.save),
|
|
7176
|
-
h("button", { className: "wbt-btn ghost", type: "button", onClick: props.onCancel }, t.cancel)
|
|
7177
|
-
)
|
|
7956
|
+
{ className: "wbt-ws-fields" },
|
|
7957
|
+
h("input", { className: "wbt-input", value: draft.title, placeholder: t.fTitle, "aria-label": t.fTitle, onChange: field("title") }),
|
|
7958
|
+
h("input", { className: "wbt-input", value: draft.name, placeholder: t.fName, "aria-label": t.fName, onChange: field("name") }),
|
|
7959
|
+
h("input", { className: "wbt-input", value: draft.dir, placeholder: t.fDir, "aria-label": t.fDir, onChange: field("dir") }),
|
|
7960
|
+
h("textarea", { className: "wbt-input", value: draft.description, placeholder: t.fDesc, "aria-label": t.fDesc, onChange: field("description") })
|
|
7961
|
+
),
|
|
7962
|
+
err ? h("div", { className: "wbt-err", role: "alert" }, err) : null,
|
|
7963
|
+
h(
|
|
7964
|
+
"div",
|
|
7965
|
+
{ className: "wbt-modal-foot" },
|
|
7966
|
+
h("button", { className: "wbt-btn primary", type: "button", disabled: busy, onClick: submit }, t.save),
|
|
7967
|
+
h("button", { className: "wbt-btn ghost", type: "button", onClick: props.onCancel }, t.cancel)
|
|
7178
7968
|
)
|
|
7179
7969
|
);
|
|
7180
7970
|
}
|
|
@@ -8481,12 +9271,23 @@ var require_timeline_copy = __commonJS({
|
|
|
8481
9271
|
var require_timeline_controls = __commonJS({
|
|
8482
9272
|
"packages/addons/tasks/client/timeline/timeline-controls.cjs"(exports2, module2) {
|
|
8483
9273
|
"use strict";
|
|
9274
|
+
var createOverlay = require_overlay();
|
|
8484
9275
|
function result(r) {
|
|
8485
9276
|
if (!r || !r.ok) throw Error(r && r.error || "\u8BF7\u6C42\u5931\u8D25");
|
|
8486
9277
|
return r.result;
|
|
8487
9278
|
}
|
|
8488
9279
|
module2.exports = function(React) {
|
|
8489
9280
|
var h = React.createElement;
|
|
9281
|
+
var EditorOverlay = createOverlay({
|
|
9282
|
+
maskClass: "wbt-modal-mask",
|
|
9283
|
+
dialogClass: "wbt-modal",
|
|
9284
|
+
ariaLabelOf: function(p) {
|
|
9285
|
+
var tr = require_timeline_copy()(p.t);
|
|
9286
|
+
return p.item ? tr("\u7F16\u8F91\u65F6\u95F4\u7EBF") : tr("\u65B0\u5EFA\u65F6\u95F4\u7EBF");
|
|
9287
|
+
},
|
|
9288
|
+
// 表单弹窗点遮罩容易误关,保持原有行为:只有 Esc 与取消按钮关闭。
|
|
9289
|
+
closeOnMask: false
|
|
9290
|
+
});
|
|
8490
9291
|
function Picker(p) {
|
|
8491
9292
|
var tr = require_timeline_copy()(p.t);
|
|
8492
9293
|
var ds = React.useState({ records: [], total: 0 }), data = ds[0], setData = ds[1];
|
|
@@ -8626,14 +9427,9 @@ var require_timeline_controls = __commonJS({
|
|
|
8626
9427
|
setBusy(false);
|
|
8627
9428
|
});
|
|
8628
9429
|
}
|
|
8629
|
-
return h(
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
p.onClose();
|
|
8633
|
-
}
|
|
8634
|
-
} }, h(
|
|
8635
|
-
"div",
|
|
8636
|
-
{ className: "wbt-modal", role: "dialog", "aria-modal": true, "aria-label": item ? tr("\u7F16\u8F91\u65F6\u95F4\u7EBF") : tr("\u65B0\u5EFA\u65F6\u95F4\u7EBF") },
|
|
9430
|
+
return h(
|
|
9431
|
+
EditorOverlay,
|
|
9432
|
+
{ onClose: p.onClose, closeOnEscape: !busy, closeOnMask: false, autoFocus: false },
|
|
8637
9433
|
h("div", { className: "wbt-modal-head" }, h("h3", null, item ? tr("\u7F16\u8F91\u65F6\u95F4\u7EBF") : tr("\u65B0\u5EFA\u65F6\u95F4\u7EBF"))),
|
|
8638
9434
|
h("label", { className: "wbt-field" }, tr("\u65F6\u95F4\u7EBF\u6807\u9898"), h("input", { className: "wbt-input", autoFocus: true, value: title, placeholder: tr("\u672A\u547D\u540D\u65F6\u95F4\u7EBF"), onChange: function(e) {
|
|
8639
9435
|
setTitle(e.target.value);
|
|
@@ -8643,7 +9439,7 @@ var require_timeline_controls = __commonJS({
|
|
|
8643
9439
|
} })),
|
|
8644
9440
|
error ? h("p", { role: "alert", className: "wbt-err" }, error) : null,
|
|
8645
9441
|
h("div", { className: "wbt-modal-foot" }, h("button", { className: "wbt-btn", disabled: busy, onClick: p.onClose }, tr("\u53D6\u6D88")), h("button", { className: "wbt-btn primary", disabled: busy, onClick: save }, busy ? tr("\u4FDD\u5B58\u4E2D\u2026") : tr("\u4FDD\u5B58\u65F6\u95F4\u7EBF")))
|
|
8646
|
-
)
|
|
9442
|
+
);
|
|
8647
9443
|
}
|
|
8648
9444
|
return { Picker, Editor, result };
|
|
8649
9445
|
};
|
|
@@ -9508,6 +10304,7 @@ var require_timeline_styles = __commonJS({
|
|
|
9508
10304
|
".wbt-timeline-option:focus-visible,.wbt-timeline-view button:focus-visible,.wbt-timeline-modal button:focus-visible{outline:2px solid var(--wbt-accent);outline-offset:2px}.wbt-timeline-option input[type=checkbox],.wbt-timeline-single input{appearance:auto;width:15px;height:15px;flex:none;accent-color:var(--wbt-accent)}",
|
|
9509
10305
|
".wbt-timeline-pager{justify-content:space-between;font-size:12px;margin-top:12px}.wbt-timeline-right h3,.wbt-timeline-summary h4{font-size:15px;font-weight:600;margin:0 0 8px;overflow-wrap:anywhere}.wbt-timeline-eyebrow{font-size:11.5px;opacity:.55;margin-bottom:4px;overflow-wrap:anywhere}",
|
|
9510
10306
|
".wbt-timeline-summary{min-width:0}.wbt-timeline-desc{max-height:64px;overflow:hidden;margin:0 0 8px;white-space:pre-wrap;overflow-wrap:anywhere}.wbt-timeline-actions{margin:8px 0}.wbt-timeline-actions>.wbt-act-del{margin-left:auto}",
|
|
10307
|
+
".wbt-timeline-right>.wbt-timeline-members{min-height:0;max-height:65vh;overflow-y:auto;overscroll-behavior-y:contain;scrollbar-gutter:stable}",
|
|
9511
10308
|
// Scoped reset defeats ordinary host button surfaces without touching unrelated task controls.
|
|
9512
10309
|
":is(.wbt-timeline-view,.wbt-timeline-modal) button:is(.wbt-timeline-member,.wbt-timeline-remove,.wbt-timeline-id){appearance:none;background:transparent;background-image:none;color:inherit;border:0;box-shadow:none;border-radius:var(--wb-radius-sm,6px);font:inherit;cursor:pointer;min-width:0;min-height:0;width:auto;margin:0}",
|
|
9513
10310
|
":is(.wbt-timeline-view,.wbt-timeline-modal) .wbt-timeline-id{display:inline-flex;align-items:center;gap:4px;padding:4px;max-width:180px}.wbt-timeline-id code{font-size:11.5px;opacity:.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
@@ -10324,7 +11121,7 @@ var require_task_filter_model = __commonJS({
|
|
|
10324
11121
|
// packages/addons/tasks/client/views/task-filter-panel.cjs
|
|
10325
11122
|
var require_task_filter_panel = __commonJS({
|
|
10326
11123
|
"packages/addons/tasks/client/views/task-filter-panel.cjs"(exports2, module2) {
|
|
10327
|
-
var Icon2 =
|
|
11124
|
+
var Icon2 = require_icons2().Icon;
|
|
10328
11125
|
var model = require_task_filter_model();
|
|
10329
11126
|
var DateFilter = require_date_filter().DateFilter;
|
|
10330
11127
|
var WorkspaceFilter = require_workspacefilter();
|
|
@@ -10584,64 +11381,30 @@ var require_selection_bar = __commonJS({
|
|
|
10584
11381
|
var require_task_preview = __commonJS({
|
|
10585
11382
|
"packages/addons/tasks/client/modals/task-preview.cjs"(exports2, module2) {
|
|
10586
11383
|
"use strict";
|
|
11384
|
+
var createOverlay = require_overlay();
|
|
10587
11385
|
module2.exports = function createTaskPreview(React, TaskItem) {
|
|
10588
11386
|
var h = React.createElement;
|
|
11387
|
+
var Overlay = createOverlay({
|
|
11388
|
+
maskClass: "wbt-modal-mask",
|
|
11389
|
+
dialogClass: "wbt-modal wide wbt-preview",
|
|
11390
|
+
ariaLabelledByOf: function() {
|
|
11391
|
+
return "wbt-preview-title";
|
|
11392
|
+
},
|
|
11393
|
+
// 关闭按钮自己带 autoFocus,外壳不要抢首焦点。
|
|
11394
|
+
autoFocusDialog: false
|
|
11395
|
+
});
|
|
10589
11396
|
function TaskPreview(props) {
|
|
10590
11397
|
var t = props.t, task = props.task;
|
|
10591
|
-
var titleId = "wbt-preview-title";
|
|
10592
|
-
function onKey(e) {
|
|
10593
|
-
if (e.key === "Escape") {
|
|
10594
|
-
e.preventDefault();
|
|
10595
|
-
e.stopPropagation();
|
|
10596
|
-
props.onClose();
|
|
10597
|
-
return;
|
|
10598
|
-
}
|
|
10599
|
-
if (e.key !== "Tab") return;
|
|
10600
|
-
var mask = e.currentTarget;
|
|
10601
|
-
var box = mask && mask.querySelector ? mask.querySelector('[role="dialog"]') : null;
|
|
10602
|
-
if (!box) return;
|
|
10603
|
-
var nodes = Array.from(box.querySelectorAll('button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href],[tabindex="0"]')).filter(function(node) {
|
|
10604
|
-
return node.getClientRects().length > 0;
|
|
10605
|
-
});
|
|
10606
|
-
var first = nodes[0], last = nodes[nodes.length - 1];
|
|
10607
|
-
if (!first) {
|
|
10608
|
-
e.preventDefault();
|
|
10609
|
-
if (box.focus) box.focus();
|
|
10610
|
-
} else if (e.shiftKey && (document.activeElement === first || document.activeElement === box)) {
|
|
10611
|
-
e.preventDefault();
|
|
10612
|
-
last.focus();
|
|
10613
|
-
} else if (!e.shiftKey && document.activeElement === last) {
|
|
10614
|
-
e.preventDefault();
|
|
10615
|
-
first.focus();
|
|
10616
|
-
}
|
|
10617
|
-
}
|
|
10618
11398
|
return h(
|
|
10619
|
-
|
|
10620
|
-
{
|
|
10621
|
-
className: "wbt-modal-mask",
|
|
10622
|
-
onKeyDownCapture: onKey,
|
|
10623
|
-
onMouseDown: function(e) {
|
|
10624
|
-
if (e.target === e.currentTarget) props.onClose();
|
|
10625
|
-
}
|
|
10626
|
-
},
|
|
11399
|
+
Overlay,
|
|
11400
|
+
{ onClose: props.onClose, autoFocus: false },
|
|
10627
11401
|
h(
|
|
10628
11402
|
"div",
|
|
10629
|
-
{
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
"aria-labelledby": titleId,
|
|
10635
|
-
"aria-label": t.previewLabel
|
|
10636
|
-
},
|
|
10637
|
-
h(
|
|
10638
|
-
"div",
|
|
10639
|
-
{ className: "wbt-modal-head wbt-preview-head" },
|
|
10640
|
-
h("h3", { id: titleId }, String(task.title || "").trim() || t.previewUntitled),
|
|
10641
|
-
h("button", { type: "button", className: "wbt-icon", title: t.close, "aria-label": t.close, autoFocus: true, onClick: props.onClose }, "\xD7")
|
|
10642
|
-
),
|
|
10643
|
-
h("div", { className: "wbt-preview-body" }, h(TaskItem, props.cardProps))
|
|
10644
|
-
)
|
|
11403
|
+
{ className: "wbt-modal-head wbt-preview-head" },
|
|
11404
|
+
h("h3", { id: "wbt-preview-title" }, String(task.title || "").trim() || t.previewUntitled),
|
|
11405
|
+
h("button", { type: "button", className: "wbt-icon", title: t.close, "aria-label": t.close, autoFocus: true, onClick: props.onClose }, "\xD7")
|
|
11406
|
+
),
|
|
11407
|
+
h("div", { className: "wbt-preview-body" }, h(TaskItem, props.cardProps))
|
|
10645
11408
|
);
|
|
10646
11409
|
}
|
|
10647
11410
|
return TaskPreview;
|
|
@@ -11618,8 +12381,17 @@ var require_tasks_view = __commonJS({
|
|
|
11618
12381
|
var require_timeline_add_members = __commonJS({
|
|
11619
12382
|
"packages/addons/tasks/client/timeline/timeline-add-members.cjs"(exports2, module2) {
|
|
11620
12383
|
"use strict";
|
|
12384
|
+
var createOverlay = require_overlay();
|
|
11621
12385
|
module2.exports = function(React) {
|
|
11622
12386
|
var h = React.createElement, result = require_timeline_controls()(React).result;
|
|
12387
|
+
var Overlay = createOverlay({
|
|
12388
|
+
maskClass: "wbt-modal-mask",
|
|
12389
|
+
dialogClass: "wbt-modal",
|
|
12390
|
+
ariaLabelOf: function(props) {
|
|
12391
|
+
return require_timeline_copy()(props.t)("\u6DFB\u52A0\u5DF2\u6709\u4EFB\u52A1");
|
|
12392
|
+
},
|
|
12393
|
+
closeOnMask: false
|
|
12394
|
+
});
|
|
11623
12395
|
return function AddMembers(p) {
|
|
11624
12396
|
var tr = require_timeline_copy()(p.t);
|
|
11625
12397
|
var qs = React.useState(""), query = qs[0], setQuery = qs[1];
|
|
@@ -11648,9 +12420,9 @@ var require_timeline_add_members = __commonJS({
|
|
|
11648
12420
|
setBusy(false);
|
|
11649
12421
|
});
|
|
11650
12422
|
}
|
|
11651
|
-
return h(
|
|
11652
|
-
|
|
11653
|
-
{
|
|
12423
|
+
return h(
|
|
12424
|
+
Overlay,
|
|
12425
|
+
{ onClose: p.onClose, closeOnEscape: !busy, closeOnMask: false },
|
|
11654
12426
|
h("h3", null, tr("\u6DFB\u52A0\u5DF2\u6709\u4EFB\u52A1")),
|
|
11655
12427
|
h("p", null, tr("\u9009\u4E2D\u7684\u4EFB\u52A1\u5C06\u5173\u8054\u5230\u6B64\u65F6\u95F4\u7EBF\uFF1B\u539F\u6709\u5173\u8054\u4F1A\u88AB\u66FF\u6362\u3002")),
|
|
11656
12428
|
h("input", { className: "wbt-input", "aria-label": tr("\u641C\u7D22\u5DF2\u6709\u4EFB\u52A1"), value: query, onChange: function(e) {
|
|
@@ -11671,7 +12443,7 @@ var require_timeline_add_members = __commonJS({
|
|
|
11671
12443
|
} }, tr("\u4E0B\u4E00\u9875"))),
|
|
11672
12444
|
error ? h("p", { role: "alert" }, error) : null,
|
|
11673
12445
|
h("div", { className: "wbt-modal-foot" }, h("button", { className: "wbt-btn", disabled: busy, onClick: p.onClose }, tr("\u53D6\u6D88")), h("button", { className: "wbt-btn primary", disabled: busy || !selected.length, onClick: submit }, tr("\u5173\u8054\u4EFB\u52A1 (") + selected.length + ")"))
|
|
11674
|
-
)
|
|
12446
|
+
);
|
|
11675
12447
|
};
|
|
11676
12448
|
};
|
|
11677
12449
|
}
|
|
@@ -11681,14 +12453,24 @@ var require_timeline_add_members = __commonJS({
|
|
|
11681
12453
|
var require_timeline_merge = __commonJS({
|
|
11682
12454
|
"packages/addons/tasks/client/timeline/timeline-merge.cjs"(exports2, module2) {
|
|
11683
12455
|
"use strict";
|
|
12456
|
+
var createOverlay = require_overlay();
|
|
11684
12457
|
module2.exports = function(React) {
|
|
11685
12458
|
var h = React.createElement;
|
|
12459
|
+
var Overlay = createOverlay({
|
|
12460
|
+
maskClass: "wbt-modal-mask",
|
|
12461
|
+
dialogClass: "wbt-modal",
|
|
12462
|
+
ariaLabelOf: function(p) {
|
|
12463
|
+
return p.t.timelineMerge;
|
|
12464
|
+
},
|
|
12465
|
+
// 合并是不可逆操作,点遮罩不关闭;保存中 Esc 也不关闭。
|
|
12466
|
+
closeOnMask: false
|
|
12467
|
+
});
|
|
11686
12468
|
return function Merge(props) {
|
|
11687
12469
|
var t = props.t, targetS = React.useState(props.items[0].timelineKey), target = targetS[0], setTarget = targetS[1];
|
|
11688
12470
|
var previewS = React.useState(null), preview = previewS[0], setPreview = previewS[1];
|
|
11689
12471
|
var busyS = React.useState(false), busy = busyS[0], setBusy = busyS[1];
|
|
11690
12472
|
var errorS = React.useState(""), error = errorS[0], setError = errorS[1];
|
|
11691
|
-
var pending = React.useRef(false)
|
|
12473
|
+
var pending = React.useRef(false);
|
|
11692
12474
|
function submit(dryRun) {
|
|
11693
12475
|
if (pending.current || !dryRun && preview === null) return;
|
|
11694
12476
|
pending.current = true;
|
|
@@ -11708,26 +12490,9 @@ var require_timeline_merge = __commonJS({
|
|
|
11708
12490
|
setBusy(false);
|
|
11709
12491
|
});
|
|
11710
12492
|
}
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
props.onClose();
|
|
11715
|
-
}
|
|
11716
|
-
if (e.key !== "Tab") return;
|
|
11717
|
-
var nodes = panel.current.querySelectorAll("button:not(:disabled),select:not(:disabled)");
|
|
11718
|
-
var first = nodes[0], last = nodes[nodes.length - 1];
|
|
11719
|
-
if (e.shiftKey && document.activeElement === first) {
|
|
11720
|
-
e.preventDefault();
|
|
11721
|
-
last.focus();
|
|
11722
|
-
}
|
|
11723
|
-
if (!e.shiftKey && document.activeElement === last) {
|
|
11724
|
-
e.preventDefault();
|
|
11725
|
-
first.focus();
|
|
11726
|
-
}
|
|
11727
|
-
}
|
|
11728
|
-
return h("div", { className: "wbt-modal-mask" }, h(
|
|
11729
|
-
"div",
|
|
11730
|
-
{ ref: panel, className: "wbt-modal", role: "dialog", "aria-modal": true, "aria-label": t.timelineMerge, onKeyDown: keys },
|
|
12493
|
+
return h(
|
|
12494
|
+
Overlay,
|
|
12495
|
+
{ onClose: props.onClose, closeOnEscape: !busy, closeOnMask: false, autoFocus: false },
|
|
11731
12496
|
h("h3", null, t.timelineMerge),
|
|
11732
12497
|
h("p", null, t.timelineMergeHint),
|
|
11733
12498
|
h(
|
|
@@ -11751,7 +12516,7 @@ var require_timeline_merge = __commonJS({
|
|
|
11751
12516
|
submit(preview === null);
|
|
11752
12517
|
} }, busy ? t.loading : preview === null ? t.timelinePreview : t.timelineConfirm)
|
|
11753
12518
|
)
|
|
11754
|
-
)
|
|
12519
|
+
);
|
|
11755
12520
|
};
|
|
11756
12521
|
};
|
|
11757
12522
|
}
|
|
@@ -11802,8 +12567,7 @@ var require_timeline_view = __commonJS({
|
|
|
11802
12567
|
var busyS = React.useState(true), busy = busyS[0], setBusy = busyS[1];
|
|
11803
12568
|
var errorS = React.useState(""), error = errorS[0], setError = errorS[1];
|
|
11804
12569
|
var activeS = React.useState(null), active = activeS[0], setActive = activeS[1];
|
|
11805
|
-
var
|
|
11806
|
-
var membersS = React.useState({ records: [], total: 0 }), members = membersS[0], setMembers = membersS[1];
|
|
12570
|
+
var membersS = React.useState(null), loaded = membersS[0], setMembers = membersS[1];
|
|
11807
12571
|
var memberBusyS = React.useState(false), memberBusy = memberBusyS[0], setMemberBusy = memberBusyS[1];
|
|
11808
12572
|
var memberErrorS = React.useState(""), memberError = memberErrorS[0], setMemberError = memberErrorS[1];
|
|
11809
12573
|
var refreshS = React.useState(0), refresh = refreshS[0], setRefresh = refreshS[1];
|
|
@@ -11815,6 +12579,7 @@ var require_timeline_view = __commonJS({
|
|
|
11815
12579
|
var listRef = React.useRef(null), mergeButton = React.useRef(null), detailTrigger = React.useRef(null);
|
|
11816
12580
|
var createdRef = React.useRef(null);
|
|
11817
12581
|
var activeKey = active && active.timelineKey;
|
|
12582
|
+
var members = loaded && loaded.key === activeKey ? loaded.rows : [];
|
|
11818
12583
|
var heading = splitTitle(active && active.title);
|
|
11819
12584
|
var editorS = React.useState(null), editor = editorS[0], setEditor = editorS[1];
|
|
11820
12585
|
var addS = React.useState(false), adding = addS[0], setAdding = addS[1];
|
|
@@ -11859,24 +12624,20 @@ var require_timeline_view = __commonJS({
|
|
|
11859
12624
|
cancelled = true;
|
|
11860
12625
|
};
|
|
11861
12626
|
}, [api, query, single, page, refresh]);
|
|
11862
|
-
React.useEffect(function() {
|
|
11863
|
-
setMemberPage(1);
|
|
11864
|
-
}, [activeKey]);
|
|
11865
12627
|
React.useEffect(function() {
|
|
11866
12628
|
var cancelled = false;
|
|
11867
12629
|
setMemberError("");
|
|
11868
|
-
setMembers(
|
|
12630
|
+
setMembers(null);
|
|
11869
12631
|
if (!activeKey) {
|
|
11870
12632
|
setMemberBusy(false);
|
|
11871
12633
|
return;
|
|
11872
12634
|
}
|
|
11873
12635
|
setMemberBusy(true);
|
|
11874
|
-
api.call("tasks.timeline", { timelineKey: activeKey
|
|
11875
|
-
if (cancelled)
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
if (memberPage > 1 && !next.records.length) setMemberPage(Math.max(1, Math.ceil(next.total / 20)));
|
|
12636
|
+
api.call("tasks.timeline", { timelineKey: activeKey }).then(result).then(function(rows) {
|
|
12637
|
+
if (!cancelled) {
|
|
12638
|
+
setMembers({ key: activeKey, rows });
|
|
12639
|
+
setMemberBusy(false);
|
|
12640
|
+
}
|
|
11880
12641
|
}).catch(function(e) {
|
|
11881
12642
|
if (!cancelled) {
|
|
11882
12643
|
setMemberBusy(false);
|
|
@@ -11886,7 +12647,7 @@ var require_timeline_view = __commonJS({
|
|
|
11886
12647
|
return function() {
|
|
11887
12648
|
cancelled = true;
|
|
11888
12649
|
};
|
|
11889
|
-
}, [api, activeKey,
|
|
12650
|
+
}, [api, activeKey, refresh]);
|
|
11890
12651
|
React.useEffect(function() {
|
|
11891
12652
|
if (!editTask && !createState) return;
|
|
11892
12653
|
var cancelled = false;
|
|
@@ -11915,7 +12676,6 @@ var require_timeline_view = __commonJS({
|
|
|
11915
12676
|
function choose(item, toggle) {
|
|
11916
12677
|
if (busy) return;
|
|
11917
12678
|
setActive(item);
|
|
11918
|
-
setMemberPage(1);
|
|
11919
12679
|
if (toggle && item.taskCount > 0) setSelected(function(old) {
|
|
11920
12680
|
return old.some(function(x) {
|
|
11921
12681
|
return x.timelineKey === item.timelineKey;
|
|
@@ -12129,7 +12889,7 @@ var require_timeline_view = __commonJS({
|
|
|
12129
12889
|
) : null,
|
|
12130
12890
|
memberError ? h("p", { role: "alert", className: "wbt-err" }, t.error + memberError) : null,
|
|
12131
12891
|
memberBusy ? h("p", { role: "status" }, t.loading) : h(MemberRows, {
|
|
12132
|
-
rows: members
|
|
12892
|
+
rows: members,
|
|
12133
12893
|
lang,
|
|
12134
12894
|
disabled: writing,
|
|
12135
12895
|
onOpen: function(task, e) {
|
|
@@ -12148,8 +12908,8 @@ var require_timeline_view = __commonJS({
|
|
|
12148
12908
|
});
|
|
12149
12909
|
}
|
|
12150
12910
|
}),
|
|
12151
|
-
!memberBusy && !memberError && !members.
|
|
12152
|
-
active ? h("div", { className: "wbt-timeline-member-footer" }, h("span", null, t.timelineOrder), h(
|
|
12911
|
+
!memberBusy && !memberError && !members.length ? h("p", { className: "wbt-empty" }, active ? tr("\u6682\u65E0\u53EF\u663E\u793A\u6210\u5458") : t.timelineEmpty) : null,
|
|
12912
|
+
active ? h("div", { className: "wbt-timeline-member-footer" }, h("span", null, t.timelineOrder), loaded && loaded.key === activeKey ? h("span", null, t.total + " " + members.length) : null) : null
|
|
12153
12913
|
)
|
|
12154
12914
|
),
|
|
12155
12915
|
editor ? h(controls.Editor, { api, t, item: editor.timelineKey ? editor : null, onClose: function() {
|
|
@@ -12297,32 +13057,6 @@ var require_timeline_view = __commonJS({
|
|
|
12297
13057
|
}
|
|
12298
13058
|
});
|
|
12299
13059
|
|
|
12300
|
-
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list-checks.mjs
|
|
12301
|
-
var list_checks_exports = {};
|
|
12302
|
-
__export(list_checks_exports, {
|
|
12303
|
-
__iconData: () => __iconData35,
|
|
12304
|
-
default: () => ListChecks
|
|
12305
|
-
});
|
|
12306
|
-
var __iconData35, ListChecks;
|
|
12307
|
-
var init_list_checks = __esm({
|
|
12308
|
-
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list-checks.mjs"() {
|
|
12309
|
-
init_createLucideIcon();
|
|
12310
|
-
__iconData35 = {
|
|
12311
|
-
name: "list-checks",
|
|
12312
|
-
size: 24,
|
|
12313
|
-
node: [
|
|
12314
|
-
["path", { d: "M13 5h8", key: "a7qcls" }],
|
|
12315
|
-
["path", { d: "M13 12h8", key: "h98zly" }],
|
|
12316
|
-
["path", { d: "M13 19h8", key: "c3s6r1" }],
|
|
12317
|
-
["path", { d: "m3 17 2 2 4-4", key: "1jhpwq" }],
|
|
12318
|
-
["path", { d: "m3 7 2 2 4-4", key: "1obspn" }]
|
|
12319
|
-
]
|
|
12320
|
-
};
|
|
12321
|
-
__iconData35.node;
|
|
12322
|
-
ListChecks = createLucideIcon(__iconData35);
|
|
12323
|
-
}
|
|
12324
|
-
});
|
|
12325
|
-
|
|
12326
13060
|
// packages/addons/tasks/client/client.src.cjs
|
|
12327
13061
|
(function() {
|
|
12328
13062
|
"use strict";
|
|
@@ -12357,8 +13091,9 @@ var init_list_checks = __esm({
|
|
|
12357
13091
|
"3": { zh: "\u5DF2\u91CD\u542F", en: "Restarted", cls: "restarted" },
|
|
12358
13092
|
"4": { zh: "\u5DF2\u63A5\u53D6", en: "Claimed", cls: "claimed" }
|
|
12359
13093
|
};
|
|
12360
|
-
var icons =
|
|
12361
|
-
var
|
|
13094
|
+
var icons = require_icons2(), ICONS = icons.ICONS, Icon2 = icons.Icon;
|
|
13095
|
+
var createOverlay = require_overlay();
|
|
13096
|
+
var workspaceView = require_workspace_view()({ React, Icon: Icon2, createOverlay });
|
|
12362
13097
|
var commandsView = require_commands()({
|
|
12363
13098
|
React,
|
|
12364
13099
|
Icon: Icon2,
|
|
@@ -12795,8 +13530,8 @@ var init_list_checks = __esm({
|
|
|
12795
13530
|
var TimelineView = require_timeline_view()({ React, COPY, injectCss, statusInfo, configView, CFG_FALLBACK, TaskItem, EditModal, DoneModal, TimelineModal, CreateModal });
|
|
12796
13531
|
host.registerAddon({
|
|
12797
13532
|
id: "wb-addon-tasks",
|
|
12798
|
-
version: "5.2.
|
|
12799
|
-
icon:
|
|
13533
|
+
version: "5.2.31",
|
|
13534
|
+
icon: ICONS["list-checks"],
|
|
12800
13535
|
views: [
|
|
12801
13536
|
{ id: "stats", icon: tabIcon("chart"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: statsView.TasksStatsView, keepAlive: true },
|
|
12802
13537
|
{ id: "tasks", icon: tabIcon("list"), title: { zh: "\u8BB0\u5F55", en: "Records" }, component: TasksView },
|