dsh-workbench-tasks 5.2.27 → 5.2.33
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 +1388 -635
- package/lib/index.js +3 -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,32 +1150,720 @@ 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
|
-
|
|
1072
|
-
".@-
|
|
1073
|
-
".@-
|
|
1165
|
+
".@-kpis{grid-column:span 12;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}",
|
|
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}",
|
|
1167
|
+
".@-kpi-l{font-size:12px;color:var(--dsw-alias-label-tertiary,#8f959e);display:flex;align-items:center;gap:6px}",
|
|
1168
|
+
".@-kpi-v{font-size:26px;line-height:1.25;font-weight:650;margin-top:4px;font-variant-numeric:tabular-nums}",
|
|
1169
|
+
".@-kpi-u{font-size:12px;font-weight:400;color:var(--dsw-alias-label-tertiary,#8f959e);margin-left:3px}",
|
|
1170
|
+
".@-kpi-h{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e);margin-top:3px}",
|
|
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)}",
|
|
1174
|
+
".@-donut{display:flex;align-items:center;gap:16px;flex-wrap:wrap}",
|
|
1175
|
+
".@-donut svg{flex:0 0 auto}",
|
|
1176
|
+
".@-legend{display:flex;flex-direction:column;gap:7px;min-width:120px;flex:1}",
|
|
1177
|
+
".@-leg{display:flex;align-items:center;gap:7px;font-size:12px;color:var(--dsw-alias-label-secondary,#646a73)}",
|
|
1178
|
+
".@-dot{width:8px;height:8px;border-radius:50%;flex:0 0 auto}",
|
|
1179
|
+
".@-leg b{margin-left:auto;font-weight:600;color:var(--dsw-alias-label-primary,#1f2329);font-variant-numeric:tabular-nums}",
|
|
1180
|
+
".@-bars{display:flex;flex-direction:column;gap:9px}",
|
|
1181
|
+
".@-bar{display:grid;grid-template-columns:minmax(72px,1.2fr) 3fr auto;gap:8px;align-items:center;font-size:12px}",
|
|
1182
|
+
".@-bar-l{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary,#646a73)}",
|
|
1183
|
+
".@-bar-t{display:block;height:8px;border-radius:6px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);overflow:hidden}",
|
|
1184
|
+
".@-bar-f{display:block;height:100%;border-radius:6px;background:var(--dsw-alias-state-business-primary,#4f6ef7);min-width:2px}",
|
|
1185
|
+
".@-bar-v{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary,#1f2329);font-weight:600;min-width:34px;text-align:right}",
|
|
1186
|
+
".@-stack{display:flex;flex-direction:column;gap:10px}",
|
|
1187
|
+
".@-srow-l{font-size:12px;color:var(--dsw-alias-label-secondary,#646a73);margin-bottom:4px;display:flex}",
|
|
1188
|
+
".@-srow-l b{margin-left:auto;color:var(--dsw-alias-label-primary,#1f2329);font-variant-numeric:tabular-nums}",
|
|
1189
|
+
".@-strack{display:flex;height:10px;border-radius:6px;overflow:hidden;background:var(--dsw-alias-bg-skeleton,#f2f3f5)}",
|
|
1190
|
+
".@-seg-f{height:100%}",
|
|
1191
|
+
".@-hist{display:flex;align-items:flex-end;gap:8px;height:150px;padding-top:16px}",
|
|
1192
|
+
".@-hbar{flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:5px;min-width:0;height:100%}",
|
|
1193
|
+
".@-hbar-v{font-size:11px;color:var(--dsw-alias-label-secondary,#646a73);font-variant-numeric:tabular-nums}",
|
|
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}",
|
|
1195
|
+
".@-hbar-l{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}",
|
|
1196
|
+
".@-trend{width:100%;height:auto;display:block}",
|
|
1197
|
+
".@-tlegend{display:flex;gap:14px;flex-wrap:wrap;margin-top:6px;font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
|
|
1198
|
+
".@-trend-wrap{position:relative}",
|
|
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)}",
|
|
1206
|
+
".@-table-scroll{max-width:100%;overflow-x:auto}.@-table{width:100%;border-collapse:collapse;font-size:12px}",
|
|
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}",
|
|
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}",
|
|
1209
|
+
".@-table tr:last-child td{border-bottom:0}",
|
|
1210
|
+
".@-table th.@-num,.@-table td.@-num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}",
|
|
1211
|
+
".@-empty{padding:26px 8px;text-align:center;color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
|
|
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}",
|
|
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)}",
|
|
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}",
|
|
1215
|
+
"@keyframes @-pulse{0%,100%{opacity:.55}50%{opacity:1}}",
|
|
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 + "-");
|
|
1220
|
+
}
|
|
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" });
|
|
1229
|
+
}
|
|
1230
|
+
function num(lang, n) {
|
|
1231
|
+
var v = Number(n);
|
|
1232
|
+
if (!isFinite(v)) return "\u2014";
|
|
1233
|
+
try {
|
|
1234
|
+
return new Intl.NumberFormat(lang === "en" ? "en-US" : "zh-CN").format(v);
|
|
1235
|
+
} catch (e) {
|
|
1236
|
+
return String(v);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
function pct(v, digits) {
|
|
1240
|
+
if (v === null || v === void 0 || !isFinite(Number(v))) return "\u2014";
|
|
1241
|
+
return (Number(v) * 100).toFixed(digits === void 0 ? 1 : digits) + "%";
|
|
1242
|
+
}
|
|
1243
|
+
function timeText(ms) {
|
|
1244
|
+
if (!ms) return "";
|
|
1245
|
+
var d = new Date(Number(ms));
|
|
1246
|
+
function p(n) {
|
|
1247
|
+
return String(n).padStart(2, "0");
|
|
1248
|
+
}
|
|
1249
|
+
return p(d.getHours()) + ":" + p(d.getMinutes()) + ":" + p(d.getSeconds());
|
|
1250
|
+
}
|
|
1251
|
+
function dateText(ms) {
|
|
1252
|
+
if (!ms) return "\u2014";
|
|
1253
|
+
var d = new Date(Number(ms));
|
|
1254
|
+
function p(n) {
|
|
1255
|
+
return String(n).padStart(2, "0");
|
|
1256
|
+
}
|
|
1257
|
+
return d.getFullYear() + "-" + p(d.getMonth() + 1) + "-" + p(d.getDate());
|
|
1258
|
+
}
|
|
1259
|
+
function Card(props) {
|
|
1260
|
+
var cls = prefix + "-scard" + (props.span ? " " + prefix + "-span-" + props.span : "");
|
|
1261
|
+
return h(
|
|
1262
|
+
"section",
|
|
1263
|
+
{ className: cls },
|
|
1264
|
+
props.title || props.right ? h(
|
|
1265
|
+
"div",
|
|
1266
|
+
{ className: prefix + "-chead" },
|
|
1267
|
+
h("span", { className: prefix + "-ctitle" }, props.title),
|
|
1268
|
+
props.note ? h("span", { className: prefix + "-cnote" }, props.note) : null,
|
|
1269
|
+
props.right ? h("span", { style: { marginLeft: "auto" } }, props.right) : null
|
|
1270
|
+
) : null,
|
|
1271
|
+
props.children
|
|
1272
|
+
);
|
|
1273
|
+
}
|
|
1274
|
+
function Kpi(props) {
|
|
1275
|
+
var tone = props.tone ? " " + prefix + "-" + props.tone : "";
|
|
1276
|
+
return h(
|
|
1277
|
+
"div",
|
|
1278
|
+
{ className: prefix + "-kpi" + tone },
|
|
1279
|
+
h("div", { className: prefix + "-kpi-l" }, ico(props.icon, 13), props.label),
|
|
1280
|
+
h(
|
|
1281
|
+
"div",
|
|
1282
|
+
{ className: prefix + "-kpi-v" },
|
|
1283
|
+
props.value === null || props.value === void 0 ? "\u2014" : typeof props.value === "number" ? num(props.lang, props.value) : props.value,
|
|
1284
|
+
props.unit ? h("span", { className: prefix + "-kpi-u" }, props.unit) : null
|
|
1285
|
+
),
|
|
1286
|
+
props.hint ? h("div", { className: prefix + "-kpi-h" }, props.hint) : null
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
function Donut(props) {
|
|
1290
|
+
var data = (props.data || []).filter(function(d) {
|
|
1291
|
+
return Number(d.count) > 0;
|
|
1292
|
+
});
|
|
1293
|
+
var total = Number(props.total || 0);
|
|
1294
|
+
var size = props.size || 168;
|
|
1295
|
+
var r = size / 2 - 16;
|
|
1296
|
+
var c = 2 * Math.PI * r;
|
|
1297
|
+
var offset = 0;
|
|
1298
|
+
var aria = props.aria || data.map(function(d) {
|
|
1299
|
+
return d.label + " " + d.count;
|
|
1300
|
+
}).join("\uFF0C");
|
|
1301
|
+
return h(
|
|
1302
|
+
"div",
|
|
1303
|
+
{ className: prefix + "-donut" },
|
|
1304
|
+
h(
|
|
1305
|
+
"svg",
|
|
1306
|
+
{ width: size, height: size, viewBox: "0 0 " + size + " " + size, role: "img", "aria-label": aria },
|
|
1307
|
+
h("circle", { cx: size / 2, cy: size / 2, r, fill: "none", stroke: "var(--dsw-alias-bg-skeleton,#f2f3f5)", strokeWidth: 18 }),
|
|
1308
|
+
total > 0 ? data.map(function(d, i) {
|
|
1309
|
+
var len = Number(d.count) / total * c;
|
|
1310
|
+
var seg = h("circle", {
|
|
1311
|
+
key: d.key || d.label || i,
|
|
1312
|
+
cx: size / 2,
|
|
1313
|
+
cy: size / 2,
|
|
1314
|
+
r,
|
|
1315
|
+
fill: "none",
|
|
1316
|
+
stroke: d.color || COLORS[i % COLORS.length],
|
|
1317
|
+
strokeWidth: 18,
|
|
1318
|
+
strokeDasharray: len + " " + (c - len),
|
|
1319
|
+
strokeDashoffset: -offset,
|
|
1320
|
+
transform: "rotate(-90 " + size / 2 + " " + size / 2 + ")",
|
|
1321
|
+
strokeLinecap: "butt"
|
|
1322
|
+
}, h("title", null, d.label + "\uFF1A" + d.count + (showNote && d.note ? "\uFF08" + d.note + "\uFF09" : "")));
|
|
1323
|
+
offset += len;
|
|
1324
|
+
return seg;
|
|
1325
|
+
}) : null,
|
|
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)),
|
|
1327
|
+
h("text", { x: size / 2, y: size / 2 + 18, textAnchor: "middle", fill: "var(--dsw-alias-label-tertiary,#8f959e)", fontSize: 11 }, props.centerLabel || "")
|
|
1328
|
+
),
|
|
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}",
|
|
1074
1867
|
".@-kpi-lg{padding:14px 16px}",
|
|
1075
1868
|
".@-kpi-lg .@-kpi-v{font-size:30px}",
|
|
1076
1869
|
".@-kpi-sm{padding:9px 12px}",
|
|
@@ -1151,35 +1944,10 @@ var require_charts = __commonJS({
|
|
|
1151
1944
|
el.textContent = css(prefix);
|
|
1152
1945
|
document.head.appendChild(el);
|
|
1153
1946
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
return new Intl.NumberFormat(lang === "en" ? "en-US" : "zh-CN").format(v);
|
|
1159
|
-
} catch (e) {
|
|
1160
|
-
return String(v);
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
function pct(v, digits) {
|
|
1164
|
-
if (v === null || v === void 0 || !isFinite(Number(v))) return "\u2014";
|
|
1165
|
-
return (Number(v) * 100).toFixed(digits === void 0 ? 1 : digits) + "%";
|
|
1166
|
-
}
|
|
1167
|
-
function timeText(ms) {
|
|
1168
|
-
if (!ms) return "";
|
|
1169
|
-
var d = new Date(Number(ms));
|
|
1170
|
-
function p(n) {
|
|
1171
|
-
return String(n).padStart(2, "0");
|
|
1172
|
-
}
|
|
1173
|
-
return p(d.getHours()) + ":" + p(d.getMinutes()) + ":" + p(d.getSeconds());
|
|
1174
|
-
}
|
|
1175
|
-
function dateText(ms) {
|
|
1176
|
-
if (!ms) return "\u2014";
|
|
1177
|
-
var d = new Date(Number(ms));
|
|
1178
|
-
function p(n) {
|
|
1179
|
-
return String(n).padStart(2, "0");
|
|
1180
|
-
}
|
|
1181
|
-
return d.getFullYear() + "-" + p(d.getMonth() + 1) + "-" + p(d.getDate());
|
|
1182
|
-
}
|
|
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;
|
|
1183
1951
|
function Card(props) {
|
|
1184
1952
|
var cls = prefix + "-scard" + (props.span ? " " + prefix + "-span-" + props.span : "");
|
|
1185
1953
|
return h(
|
|
@@ -1230,99 +1998,11 @@ var require_charts = __commonJS({
|
|
|
1230
1998
|
props.hint ? h("div", { className: prefix + "-kpi-h" }, props.hint) : null
|
|
1231
1999
|
);
|
|
1232
2000
|
}
|
|
1233
|
-
function Donut(props) {
|
|
1234
|
-
var data = (props.data || []).filter(function(d) {
|
|
1235
|
-
return Number(d.count) > 0;
|
|
1236
|
-
});
|
|
1237
|
-
var total = Number(props.total || 0);
|
|
1238
|
-
var size = props.size || 168;
|
|
1239
|
-
var r = size / 2 - 16;
|
|
1240
|
-
var c = 2 * Math.PI * r;
|
|
1241
|
-
var offset = 0;
|
|
1242
|
-
var aria = props.aria || data.map(function(d) {
|
|
1243
|
-
return d.label + " " + d.count;
|
|
1244
|
-
}).join("\uFF0C");
|
|
1245
|
-
return h(
|
|
1246
|
-
"div",
|
|
1247
|
-
{ className: prefix + "-donut" },
|
|
1248
|
-
h(
|
|
1249
|
-
"svg",
|
|
1250
|
-
{ width: size, height: size, viewBox: "0 0 " + size + " " + size, role: "img", "aria-label": aria },
|
|
1251
|
-
h("circle", { cx: size / 2, cy: size / 2, r, fill: "none", stroke: "var(--dsw-alias-bg-skeleton,#f2f3f5)", strokeWidth: 18 }),
|
|
1252
|
-
total > 0 ? data.map(function(d, i) {
|
|
1253
|
-
var len = Number(d.count) / total * c;
|
|
1254
|
-
var seg = h("circle", {
|
|
1255
|
-
key: d.key || d.label || i,
|
|
1256
|
-
cx: size / 2,
|
|
1257
|
-
cy: size / 2,
|
|
1258
|
-
r,
|
|
1259
|
-
fill: "none",
|
|
1260
|
-
stroke: d.color || COLORS[i % COLORS.length],
|
|
1261
|
-
strokeWidth: 18,
|
|
1262
|
-
strokeDasharray: len + " " + (c - len),
|
|
1263
|
-
strokeDashoffset: -offset,
|
|
1264
|
-
transform: "rotate(-90 " + size / 2 + " " + size / 2 + ")",
|
|
1265
|
-
strokeLinecap: "butt"
|
|
1266
|
-
}, h("title", null, d.label + "\uFF1A" + d.count));
|
|
1267
|
-
offset += len;
|
|
1268
|
-
return seg;
|
|
1269
|
-
}) : null,
|
|
1270
|
-
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
|
-
h("text", { x: size / 2, y: size / 2 + 18, textAnchor: "middle", fill: "var(--dsw-alias-label-tertiary,#8f959e)", fontSize: 11 }, props.centerLabel || "")
|
|
1272
|
-
),
|
|
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
|
-
}))
|
|
1282
|
-
);
|
|
1283
|
-
}
|
|
1284
|
-
function BarList(props) {
|
|
1285
|
-
var data = props.data || [];
|
|
1286
|
-
var max = Number(props.max || 0) || data.reduce(function(m, d) {
|
|
1287
|
-
return Math.max(m, Number(d.value || 0));
|
|
1288
|
-
}, 0) || 1;
|
|
1289
|
-
return h("div", { className: prefix + "-bars" }, data.map(function(d, i) {
|
|
1290
|
-
var v = Number(d.value || 0);
|
|
1291
|
-
return h(
|
|
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(
|
|
1306
|
-
"div",
|
|
1307
|
-
{ key: row.key || ri },
|
|
1308
|
-
h("div", { className: prefix + "-srow-l" }, h("span", null, row.label), h("b", null, num(props.lang, row.total))),
|
|
1309
|
-
h("div", { className: prefix + "-strack" }, keys.map(function(k, i) {
|
|
1310
|
-
var v = Number(row.parts && row.parts[k.key] || 0);
|
|
1311
|
-
if (v <= 0) return null;
|
|
1312
|
-
return h("span", {
|
|
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
|
-
}));
|
|
1321
|
-
}
|
|
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", {
|
|
@@ -1577,62 +2257,29 @@ var require_charts = __commonJS({
|
|
|
1577
2257
|
from || to ? h("button", {
|
|
1578
2258
|
type: "button",
|
|
1579
2259
|
className: prefix + "-clear",
|
|
1580
|
-
"aria-label": props.clearLabel || "\u6E05\u9664\u81EA\u5B9A\u4E49\u8303\u56F4",
|
|
1581
|
-
title: props.clearLabel || "\u6E05\u9664\u81EA\u5B9A\u4E49\u8303\u56F4",
|
|
1582
|
-
onClick: function() {
|
|
1583
|
-
if (props.onCustomClear) props.onCustomClear();
|
|
1584
|
-
}
|
|
1585
|
-
}, "\xD7") : null
|
|
1586
|
-
),
|
|
1587
|
-
props.customHint ? h("span", { className: prefix + "-hint", role: "status" }, props.customHint) : null
|
|
1588
|
-
);
|
|
1589
|
-
}
|
|
1590
|
-
function RangeSwitch(props) {
|
|
1591
|
-
return h(
|
|
1592
|
-
"div",
|
|
1593
|
-
{ className: prefix + "-stoolbar" },
|
|
1594
|
-
h(DateRangePicker, props),
|
|
1595
|
-
h("button", { type: "button", className: prefix + "-ghost", disabled: !!props.loading, onClick: props.onRefresh }, props.refreshLabel || "\u5237\u65B0"),
|
|
1596
|
-
h("span", { className: prefix + "-muted" }, props.generatedAt ? (props.timeLabel || "\u622A\u81F3") + " " + timeText(props.generatedAt) : ""),
|
|
1597
|
-
props.right ? h("span", { style: { marginLeft: "auto" } }, props.right) : null
|
|
1598
|
-
);
|
|
1599
|
-
}
|
|
1600
|
-
function Missing(props) {
|
|
1601
|
-
return h("div", { className: prefix + "-empty " + prefix + "-missing", role: "status" }, props.text || "\u6682\u65E0\u6570\u636E");
|
|
1602
|
-
}
|
|
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
|
-
})
|
|
2260
|
+
"aria-label": props.clearLabel || "\u6E05\u9664\u81EA\u5B9A\u4E49\u8303\u56F4",
|
|
2261
|
+
title: props.clearLabel || "\u6E05\u9664\u81EA\u5B9A\u4E49\u8303\u56F4",
|
|
2262
|
+
onClick: function() {
|
|
2263
|
+
if (props.onCustomClear) props.onCustomClear();
|
|
2264
|
+
}
|
|
2265
|
+
}, "\xD7") : null
|
|
2266
|
+
),
|
|
2267
|
+
props.customHint ? h("span", { className: prefix + "-hint", role: "status" }, props.customHint) : null
|
|
1626
2268
|
);
|
|
1627
2269
|
}
|
|
1628
|
-
function
|
|
2270
|
+
function RangeSwitch(props) {
|
|
1629
2271
|
return h(
|
|
1630
2272
|
"div",
|
|
1631
|
-
{ className: prefix + "-
|
|
1632
|
-
h(
|
|
1633
|
-
|
|
2273
|
+
{ className: prefix + "-stoolbar" },
|
|
2274
|
+
h(DateRangePicker, props),
|
|
2275
|
+
h("button", { type: "button", className: prefix + "-ghost", disabled: !!props.loading, onClick: props.onRefresh }, props.refreshLabel || "\u5237\u65B0"),
|
|
2276
|
+
h("span", { className: prefix + "-muted" }, props.generatedAt ? (props.timeLabel || "\u622A\u81F3") + " " + timeText(props.generatedAt) : ""),
|
|
2277
|
+
props.right ? h("span", { style: { marginLeft: "auto" } }, props.right) : null
|
|
1634
2278
|
);
|
|
1635
2279
|
}
|
|
2280
|
+
function Missing(props) {
|
|
2281
|
+
return h("div", { className: prefix + "-empty " + prefix + "-missing", role: "status" }, props.text || "\u6682\u65E0\u6570\u636E");
|
|
2282
|
+
}
|
|
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
|
}
|
|
@@ -8174,6 +8964,13 @@ var require_styles = __commonJS({
|
|
|
8174
8964
|
".wbt-form{display:grid;grid-template-columns:1fr 1fr;gap:9px}",
|
|
8175
8965
|
".wbt-field{display:flex;flex-direction:column;gap:4px;font-size:12px;min-width:0}",
|
|
8176
8966
|
".wbt-field.full{grid-column:1 / -1}",
|
|
8967
|
+
".wbt-create-tl{grid-column:1 / -1;display:flex;flex-direction:column;gap:6px;min-width:0;padding:9px 10px;border:1px solid var(--wbt-line);border-radius:10px;background:color-mix(in oklab,var(--wbt-accent) 4%,transparent);box-sizing:border-box}",
|
|
8968
|
+
".wbt-create-tl-head{display:flex;align-items:baseline;gap:8px;min-width:0;font-size:12px}",
|
|
8969
|
+
".wbt-create-tl-head>span:first-child{font-weight:600}",
|
|
8970
|
+
".wbt-create-tl-hint{font-size:11px;opacity:.55;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
8971
|
+
".wbt-create-tl .wbt-timeline-picker{display:flex;flex-direction:column;gap:6px;min-width:0}",
|
|
8972
|
+
".wbt-create-tl .wbt-picker-list{max-height:180px;scrollbar-gutter:stable}",
|
|
8973
|
+
".wbt-create-tl .wbt-timeline-pager{margin-top:4px;font-size:11.5px}",
|
|
8177
8974
|
".wbt-field>span{opacity:.62;font-size:11.5px}",
|
|
8178
8975
|
".wbt-modal-foot{display:flex;gap:8px;justify-content:flex-end;align-items:center;margin-top:2px}",
|
|
8179
8976
|
// 预览面板:只让内容区滚动,头部标题与右上角 × 固定不动(滚动壳限定在 .wbt-preview,不影响其它弹窗)。
|
|
@@ -8238,6 +9035,42 @@ var require_styles = __commonJS({
|
|
|
8238
9035
|
}
|
|
8239
9036
|
});
|
|
8240
9037
|
|
|
9038
|
+
// packages/addons/tasks/client/timeline/timeline-styles.cjs
|
|
9039
|
+
var require_timeline_styles = __commonJS({
|
|
9040
|
+
"packages/addons/tasks/client/timeline/timeline-styles.cjs"(exports2, module2) {
|
|
9041
|
+
"use strict";
|
|
9042
|
+
module2.exports = [
|
|
9043
|
+
".wbt-timeline-view{padding:0;color:inherit;box-sizing:border-box;overflow:auto}",
|
|
9044
|
+
".wbt-timeline-toolbar,.wbt-timeline-search,.wbt-timeline-pager,.wbt-timeline-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
9045
|
+
".wbt-timeline-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-bottom:12px}",
|
|
9046
|
+
".wbt-timeline-toolbar-main{display:flex;align-items:center;gap:8px;flex:1 1 320px;min-width:0;flex-wrap:wrap}",
|
|
9047
|
+
".wbt-timeline-toolbar-main .wbt-timeline-search{flex:1 1 220px;min-width:0}",
|
|
9048
|
+
".wbt-timeline-toolbar-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-left:auto}",
|
|
9049
|
+
".wbt-timeline-columns{display:grid;grid-template-columns:minmax(240px,32%) minmax(0,1fr);gap:12px;align-items:start}",
|
|
9050
|
+
".wbt-timeline-left,.wbt-timeline-right{min-width:0;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);padding:12px}",
|
|
9051
|
+
".wbt-timeline-single{display:flex;align-items:center;gap:8px;margin:0;font-size:13px;white-space:nowrap}.wbt-timeline-search input{min-width:0;flex:1}",
|
|
9052
|
+
".wbt-timeline-list{max-height:840px;overflow:auto;overscroll-behavior:contain}.wbt-timeline-left>.wbt-timeline-list,.wbt-timeline-left>.wbt-err{margin-top:2px}.wbt-timeline-view .wbt-timeline-option{position:relative;box-sizing:border-box;min-height:56px;padding:10px 12px;border:0;border-bottom:1px solid var(--wbt-line);border-radius:var(--wb-radius-sm,6px);display:flex;flex-direction:column;gap:4px;cursor:pointer;color:inherit;background:transparent;background-image:none}",
|
|
9053
|
+
".wbt-timeline-option-title{display:flex;gap:8px;align-items:center;min-width:0}.wbt-timeline-option-title strong{font-size:13px;font-weight:560;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.wbt-timeline-option>span{font-size:11.5px;opacity:.6;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}",
|
|
9054
|
+
".wbt-timeline-option>.wbt-timeline-excerpt{display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",
|
|
9055
|
+
".wbt-timeline-view .wbt-timeline-option.current{box-shadow:inset 3px 0 var(--wbt-accent),inset 0 0 0 1px var(--wbt-line);background:color-mix(in oklab,var(--wbt-accent) 8%,transparent);background-image:none}.wbt-timeline-view .wbt-timeline-option:hover{background:color-mix(in oklab,var(--wbt-accent) 12%,transparent)}",
|
|
9056
|
+
".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)}",
|
|
9057
|
+
".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}",
|
|
9058
|
+
".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}",
|
|
9059
|
+
".wbt-timeline-right>.wbt-timeline-members{min-height:0;max-height:65vh;overflow-y:auto;overscroll-behavior-y:contain;scrollbar-gutter:stable}",
|
|
9060
|
+
// Scoped reset defeats ordinary host button surfaces without touching unrelated task controls.
|
|
9061
|
+
":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}",
|
|
9062
|
+
":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}",
|
|
9063
|
+
":is(.wbt-timeline-view,.wbt-timeline-modal) .wbt-act-del{color:var(--dsw-alias-state-error-primary,var(--wbt-accent));background:transparent;border-color:var(--wbt-line)}",
|
|
9064
|
+
'.wbt-timeline-members{list-style:none;padding:0;margin:8px 0;min-width:0}.wbt-timeline-member-row{display:grid;grid-template-columns:92px 14px minmax(0,1fr) auto 28px;gap:8px;align-items:center;min-height:40px;position:relative;padding:0;margin:0}.wbt-timeline-date{font-size:11.5px;font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;opacity:.7}.wbt-timeline-node{align-self:stretch;position:relative}.wbt-timeline-node:before{content:"";position:absolute;width:1px;left:50%;top:0;bottom:0;background:var(--wbt-line)}.wbt-timeline-node:after{content:"";position:absolute;width:6px;height:6px;left:calc(50% - 2.5px);top:calc(50% - 3px);border-radius:50%;background:var(--wbt-accent)}',
|
|
9065
|
+
":is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-member{padding:8px 0;text-align:left;font-size:13px;line-height:1.5;overflow-wrap:anywhere;white-space:normal}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-member:hover{text-decoration:underline;text-underline-offset:3px}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-remove{display:flex;justify-content:center;align-items:center;width:28px;height:28px;padding:4px;opacity:.35}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-remove:is(:hover,:focus-visible){opacity:.9;background:var(--wbt-surface)}.wbt-timeline-member-row>.wbt-badge{white-space:nowrap;margin:0}.wbt-timeline-remove:disabled{cursor:default}",
|
|
9066
|
+
".wbt-timeline-member-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;border-top:1px solid var(--wbt-line);padding-top:8px}.wbt-timeline-member-footer>span{font-size:11.5px;opacity:.65}.wbt-timeline-member-footer .wbt-timeline-pager{margin:0}",
|
|
9067
|
+
".wbt-modal.wide.wbt-timeline-modal{display:flex;flex-direction:column;max-height:90vh;overflow:hidden}.wbt-timeline-modal-body{min-height:0;overflow:auto;flex:1;padding:12px}.wbt-timeline-member-section{min-width:0;margin-top:12px}.wbt-timeline-member-scroll{max-height:40vh;overflow:auto;overscroll-behavior:contain}.wbt-timeline-pick{border-top:1px solid var(--wbt-line);padding-top:12px;margin-top:12px}.wbt-timeline-empty{padding:12px 0}.wbt-picker-selected{font-size:12px;margin:6px 0;min-height:16px}.wbt-picker-list{max-height:220px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-sm,6px);padding:4px;background:var(--wbt-surface)}.wbt-picker-note{margin:6px;font-size:12px;opacity:.7}.wbt-picker-opt{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:6px 8px;border:0;border-radius:var(--wb-radius-sm,6px);background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}.wbt-picker-opt:hover,.wbt-picker-opt:focus-visible{background:color-mix(in oklab,var(--wbt-accent) 12%,transparent)}.wbt-picker-opt:focus-visible{outline:2px solid var(--wbt-accent);outline-offset:-2px}.wbt-picker-opt.selected{background:color-mix(in oklab,var(--wbt-accent) 16%,transparent);font-weight:600}.wbt-picker-opt-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wbt-picker-opt-count{font-size:11px;opacity:.6;white-space:nowrap}.wbt-timeline-confirm{padding:12px;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);margin:8px 0;line-height:1.6;background:var(--wbt-surface)}.wbt-timeline-confirm .wbt-btn{margin:8px 8px 0 0}",
|
|
9068
|
+
".wbt-timeline-desc.expanded{max-height:none}.wbt-timeline-selected{min-width:0;overflow-wrap:anywhere;flex:1}.wbt-modal-foot.wbt-timeline-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;flex:none}.wbt-timeline-modal .wbt-empty{padding:12px;margin:8px 0;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);background:var(--wbt-surface);line-height:1.6}",
|
|
9069
|
+
"@media(max-width:720px){.wbt-timeline-selected{flex:1 1 100%}.wbt-picker-list{max-height:180px}.wbt-timeline-columns{grid-template-columns:1fr}.wbt-timeline-toolbar-main{flex:1 1 100%}.wbt-timeline-toolbar-actions{flex:1 1 100%;justify-content:flex-end;margin-left:0}.wbt-timeline-list{max-height:320px}.wbt-timeline-toolbar{flex-wrap:wrap}.wbt-timeline-member-row{grid-template-columns:76px 8px minmax(0,1fr) auto 28px;gap:4px}.wbt-timeline-left,.wbt-timeline-right{padding:12px}.wbt-timeline-date{font-size:10.5px}.wbt-timeline-member-row>.wbt-badge{font-size:10.5px;padding:2px 4px}.wbt-timeline-actions>.wbt-act-del{margin-left:0}.wbt-timeline-id{max-width:140px}}"
|
|
9070
|
+
].join("\n");
|
|
9071
|
+
}
|
|
9072
|
+
});
|
|
9073
|
+
|
|
8241
9074
|
// packages/addons/tasks/client/ui/highlight.cjs
|
|
8242
9075
|
var require_highlight2 = __commonJS({
|
|
8243
9076
|
"packages/addons/tasks/client/ui/highlight.cjs"(exports2, module2) {
|
|
@@ -8481,12 +9314,23 @@ var require_timeline_copy = __commonJS({
|
|
|
8481
9314
|
var require_timeline_controls = __commonJS({
|
|
8482
9315
|
"packages/addons/tasks/client/timeline/timeline-controls.cjs"(exports2, module2) {
|
|
8483
9316
|
"use strict";
|
|
9317
|
+
var createOverlay = require_overlay();
|
|
8484
9318
|
function result(r) {
|
|
8485
9319
|
if (!r || !r.ok) throw Error(r && r.error || "\u8BF7\u6C42\u5931\u8D25");
|
|
8486
9320
|
return r.result;
|
|
8487
9321
|
}
|
|
8488
9322
|
module2.exports = function(React) {
|
|
8489
9323
|
var h = React.createElement;
|
|
9324
|
+
var EditorOverlay = createOverlay({
|
|
9325
|
+
maskClass: "wbt-modal-mask",
|
|
9326
|
+
dialogClass: "wbt-modal",
|
|
9327
|
+
ariaLabelOf: function(p) {
|
|
9328
|
+
var tr = require_timeline_copy()(p.t);
|
|
9329
|
+
return p.item ? tr("\u7F16\u8F91\u65F6\u95F4\u7EBF") : tr("\u65B0\u5EFA\u65F6\u95F4\u7EBF");
|
|
9330
|
+
},
|
|
9331
|
+
// 表单弹窗点遮罩容易误关,保持原有行为:只有 Esc 与取消按钮关闭。
|
|
9332
|
+
closeOnMask: false
|
|
9333
|
+
});
|
|
8490
9334
|
function Picker(p) {
|
|
8491
9335
|
var tr = require_timeline_copy()(p.t);
|
|
8492
9336
|
var ds = React.useState({ records: [], total: 0 }), data = ds[0], setData = ds[1];
|
|
@@ -8626,14 +9470,9 @@ var require_timeline_controls = __commonJS({
|
|
|
8626
9470
|
setBusy(false);
|
|
8627
9471
|
});
|
|
8628
9472
|
}
|
|
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") },
|
|
9473
|
+
return h(
|
|
9474
|
+
EditorOverlay,
|
|
9475
|
+
{ onClose: p.onClose, closeOnEscape: !busy, closeOnMask: false, autoFocus: false },
|
|
8637
9476
|
h("div", { className: "wbt-modal-head" }, h("h3", null, item ? tr("\u7F16\u8F91\u65F6\u95F4\u7EBF") : tr("\u65B0\u5EFA\u65F6\u95F4\u7EBF"))),
|
|
8638
9477
|
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
9478
|
setTitle(e.target.value);
|
|
@@ -8643,7 +9482,7 @@ var require_timeline_controls = __commonJS({
|
|
|
8643
9482
|
} })),
|
|
8644
9483
|
error ? h("p", { role: "alert", className: "wbt-err" }, error) : null,
|
|
8645
9484
|
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
|
-
)
|
|
9485
|
+
);
|
|
8647
9486
|
}
|
|
8648
9487
|
return { Picker, Editor, result };
|
|
8649
9488
|
};
|
|
@@ -9370,6 +10209,19 @@ var require_create_modal = __commonJS({
|
|
|
9370
10209
|
});
|
|
9371
10210
|
}
|
|
9372
10211
|
var title = source === "2" ? t.restartTitle : source === "1" ? tr("\u5411\u5DF2\u6709\u65F6\u95F4\u7EBF\u6DFB\u52A0\u4EFB\u52A1") : t.newTask;
|
|
10212
|
+
var timelineSection = source !== "2" ? h(
|
|
10213
|
+
"div",
|
|
10214
|
+
{ className: "wbt-create-tl full" },
|
|
10215
|
+
h(
|
|
10216
|
+
"div",
|
|
10217
|
+
{ className: "wbt-create-tl-head" },
|
|
10218
|
+
h("span", null, t.timeline),
|
|
10219
|
+
source === "1" ? h("span", { className: "wbt-create-tl-hint" }, tr("\u5411\u5DF2\u6709\u65F6\u95F4\u7EBF\u6DFB\u52A0\u4EFB\u52A1")) : null
|
|
10220
|
+
),
|
|
10221
|
+
h(TimelinePicker, { api: props.api, t, value: form.timelineId, onChange: function(value) {
|
|
10222
|
+
set("timelineId", value);
|
|
10223
|
+
}, disabled: isBusy })
|
|
10224
|
+
) : null;
|
|
9373
10225
|
return h(
|
|
9374
10226
|
"div",
|
|
9375
10227
|
{ className: "wbt-modal-mask", onKeyDownCapture: onModalKey, onMouseDown: function(e) {
|
|
@@ -9382,9 +10234,6 @@ var require_create_modal = __commonJS({
|
|
|
9382
10234
|
source === "2" ? h("div", { className: "wbt-mhint" }, t.restartPriorityHint) : null,
|
|
9383
10235
|
source !== "0" && origin ? h("div", { className: "wbt-mhint" }, "\u6765\u6E90\uFF1A" + (origin.title || origin.id) + (source === "2" ? tr(" \xB7 \u81EA\u52A8\u7EE7\u627F\u539F\u65F6\u95F4\u7EBF") : "")) : null,
|
|
9384
10236
|
source === "2" && !(origin && origin.timelineId) ? h("p", { className: "wbt-err", role: "alert" }, tr("\u8BF7\u5148\u624B\u52A8\u5EFA\u7ACB\u5E76\u5173\u8054\u65F6\u95F4\u7EBF\uFF0C\u518D\u91CD\u542F")) : null,
|
|
9385
|
-
source !== "2" ? h(TimelinePicker, { api: props.api, t, value: form.timelineId, onChange: function(value) {
|
|
9386
|
-
set("timelineId", value);
|
|
9387
|
-
}, disabled: isBusy }) : null,
|
|
9388
10237
|
h(
|
|
9389
10238
|
"div",
|
|
9390
10239
|
{ className: "wbt-form" },
|
|
@@ -9397,6 +10246,7 @@ var require_create_modal = __commonJS({
|
|
|
9397
10246
|
hostHasAddon("wb-addon-tags") ? h("label", { className: "wbt-field full" }, h("span", null, t.tags), h("input", { className: "wbt-input", value: form.tags, placeholder: t.tagPlaceholder, onChange: function(e) {
|
|
9398
10247
|
set("tags", e.target.value);
|
|
9399
10248
|
} })) : null,
|
|
10249
|
+
timelineSection,
|
|
9400
10250
|
h(WorkspaceSelect, { api: props.api, lang: props.lang, value: form.workspaceIds, onChange: function(ids) {
|
|
9401
10251
|
set("workspaceIds", ids);
|
|
9402
10252
|
} }),
|
|
@@ -9487,42 +10337,6 @@ var require_timeline_title = __commonJS({
|
|
|
9487
10337
|
}
|
|
9488
10338
|
});
|
|
9489
10339
|
|
|
9490
|
-
// packages/addons/tasks/client/timeline/timeline-styles.cjs
|
|
9491
|
-
var require_timeline_styles = __commonJS({
|
|
9492
|
-
"packages/addons/tasks/client/timeline/timeline-styles.cjs"(exports2, module2) {
|
|
9493
|
-
"use strict";
|
|
9494
|
-
module2.exports = [
|
|
9495
|
-
".wbt-timeline-view{padding:0;color:inherit;box-sizing:border-box;overflow:auto}",
|
|
9496
|
-
".wbt-timeline-toolbar,.wbt-timeline-search,.wbt-timeline-pager,.wbt-timeline-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
9497
|
-
".wbt-timeline-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-bottom:12px}",
|
|
9498
|
-
".wbt-timeline-toolbar-main{display:flex;align-items:center;gap:8px;flex:1 1 320px;min-width:0;flex-wrap:wrap}",
|
|
9499
|
-
".wbt-timeline-toolbar-main .wbt-timeline-search{flex:1 1 220px;min-width:0}",
|
|
9500
|
-
".wbt-timeline-toolbar-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-left:auto}",
|
|
9501
|
-
".wbt-timeline-columns{display:grid;grid-template-columns:minmax(240px,32%) minmax(0,1fr);gap:12px;align-items:start}",
|
|
9502
|
-
".wbt-timeline-left,.wbt-timeline-right{min-width:0;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);padding:12px}",
|
|
9503
|
-
".wbt-timeline-single{display:flex;align-items:center;gap:8px;margin:0;font-size:13px;white-space:nowrap}.wbt-timeline-search input{min-width:0;flex:1}",
|
|
9504
|
-
".wbt-timeline-list{max-height:840px;overflow:auto;overscroll-behavior:contain}.wbt-timeline-left>.wbt-timeline-list,.wbt-timeline-left>.wbt-err{margin-top:2px}.wbt-timeline-view .wbt-timeline-option{position:relative;box-sizing:border-box;min-height:56px;padding:10px 12px;border:0;border-bottom:1px solid var(--wbt-line);border-radius:var(--wb-radius-sm,6px);display:flex;flex-direction:column;gap:4px;cursor:pointer;color:inherit;background:transparent;background-image:none}",
|
|
9505
|
-
".wbt-timeline-option-title{display:flex;gap:8px;align-items:center;min-width:0}.wbt-timeline-option-title strong{font-size:13px;font-weight:560;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.wbt-timeline-option>span{font-size:11.5px;opacity:.6;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}",
|
|
9506
|
-
".wbt-timeline-option>.wbt-timeline-excerpt{display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",
|
|
9507
|
-
".wbt-timeline-view .wbt-timeline-option.current{box-shadow:inset 3px 0 var(--wbt-accent),inset 0 0 0 1px var(--wbt-line);background:color-mix(in oklab,var(--wbt-accent) 8%,transparent);background-image:none}.wbt-timeline-view .wbt-timeline-option:hover{background:color-mix(in oklab,var(--wbt-accent) 12%,transparent)}",
|
|
9508
|
-
".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
|
-
".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
|
-
".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}",
|
|
9511
|
-
".wbt-timeline-right>.wbt-timeline-members{min-height:0;max-height:65vh;overflow-y:auto;overscroll-behavior-y:contain;scrollbar-gutter:stable}",
|
|
9512
|
-
// Scoped reset defeats ordinary host button surfaces without touching unrelated task controls.
|
|
9513
|
-
":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}",
|
|
9514
|
-
":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}",
|
|
9515
|
-
":is(.wbt-timeline-view,.wbt-timeline-modal) .wbt-act-del{color:var(--dsw-alias-state-error-primary,var(--wbt-accent));background:transparent;border-color:var(--wbt-line)}",
|
|
9516
|
-
'.wbt-timeline-members{list-style:none;padding:0;margin:8px 0;min-width:0}.wbt-timeline-member-row{display:grid;grid-template-columns:92px 14px minmax(0,1fr) auto 28px;gap:8px;align-items:center;min-height:40px;position:relative;padding:0;margin:0}.wbt-timeline-date{font-size:11.5px;font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;opacity:.7}.wbt-timeline-node{align-self:stretch;position:relative}.wbt-timeline-node:before{content:"";position:absolute;width:1px;left:50%;top:0;bottom:0;background:var(--wbt-line)}.wbt-timeline-node:after{content:"";position:absolute;width:6px;height:6px;left:calc(50% - 2.5px);top:calc(50% - 3px);border-radius:50%;background:var(--wbt-accent)}',
|
|
9517
|
-
":is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-member{padding:8px 0;text-align:left;font-size:13px;line-height:1.5;overflow-wrap:anywhere;white-space:normal}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-member:hover{text-decoration:underline;text-underline-offset:3px}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-remove{display:flex;justify-content:center;align-items:center;width:28px;height:28px;padding:4px;opacity:.35}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-remove:is(:hover,:focus-visible){opacity:.9;background:var(--wbt-surface)}.wbt-timeline-member-row>.wbt-badge{white-space:nowrap;margin:0}.wbt-timeline-remove:disabled{cursor:default}",
|
|
9518
|
-
".wbt-timeline-member-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;border-top:1px solid var(--wbt-line);padding-top:8px}.wbt-timeline-member-footer>span{font-size:11.5px;opacity:.65}.wbt-timeline-member-footer .wbt-timeline-pager{margin:0}",
|
|
9519
|
-
".wbt-modal.wide.wbt-timeline-modal{display:flex;flex-direction:column;max-height:90vh;overflow:hidden}.wbt-timeline-modal-body{min-height:0;overflow:auto;flex:1;padding:12px}.wbt-timeline-member-section{min-width:0;margin-top:12px}.wbt-timeline-member-scroll{max-height:40vh;overflow:auto;overscroll-behavior:contain}.wbt-timeline-pick{border-top:1px solid var(--wbt-line);padding-top:12px;margin-top:12px}.wbt-timeline-empty{padding:12px 0}.wbt-picker-selected{font-size:12px;margin:6px 0;min-height:16px}.wbt-picker-list{max-height:220px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-sm,6px);padding:4px;background:var(--wbt-surface)}.wbt-picker-note{margin:6px;font-size:12px;opacity:.7}.wbt-picker-opt{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:6px 8px;border:0;border-radius:var(--wb-radius-sm,6px);background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}.wbt-picker-opt:hover,.wbt-picker-opt:focus-visible{background:color-mix(in oklab,var(--wbt-accent) 12%,transparent)}.wbt-picker-opt:focus-visible{outline:2px solid var(--wbt-accent);outline-offset:-2px}.wbt-picker-opt.selected{background:color-mix(in oklab,var(--wbt-accent) 16%,transparent);font-weight:600}.wbt-picker-opt-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wbt-picker-opt-count{font-size:11px;opacity:.6;white-space:nowrap}.wbt-timeline-confirm{padding:12px;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);margin:8px 0;line-height:1.6;background:var(--wbt-surface)}.wbt-timeline-confirm .wbt-btn{margin:8px 8px 0 0}",
|
|
9520
|
-
".wbt-timeline-desc.expanded{max-height:none}.wbt-timeline-selected{min-width:0;overflow-wrap:anywhere;flex:1}.wbt-modal-foot.wbt-timeline-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;flex:none}.wbt-timeline-modal .wbt-empty{padding:12px;margin:8px 0;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);background:var(--wbt-surface);line-height:1.6}",
|
|
9521
|
-
"@media(max-width:720px){.wbt-timeline-selected{flex:1 1 100%}.wbt-picker-list{max-height:180px}.wbt-timeline-columns{grid-template-columns:1fr}.wbt-timeline-toolbar-main{flex:1 1 100%}.wbt-timeline-toolbar-actions{flex:1 1 100%;justify-content:flex-end;margin-left:0}.wbt-timeline-list{max-height:320px}.wbt-timeline-toolbar{flex-wrap:wrap}.wbt-timeline-member-row{grid-template-columns:76px 8px minmax(0,1fr) auto 28px;gap:4px}.wbt-timeline-left,.wbt-timeline-right{padding:12px}.wbt-timeline-date{font-size:10.5px}.wbt-timeline-member-row>.wbt-badge{font-size:10.5px;padding:2px 4px}.wbt-timeline-actions>.wbt-act-del{margin-left:0}.wbt-timeline-id{max-width:140px}}"
|
|
9522
|
-
].join("\n");
|
|
9523
|
-
}
|
|
9524
|
-
});
|
|
9525
|
-
|
|
9526
10340
|
// packages/addons/tasks/client/timeline/timeline-members.cjs
|
|
9527
10341
|
var require_timeline_members = __commonJS({
|
|
9528
10342
|
"packages/addons/tasks/client/timeline/timeline-members.cjs"(exports2, module2) {
|
|
@@ -9545,7 +10359,6 @@ var require_task_timeline_modal = __commonJS({
|
|
|
9545
10359
|
var h = React.createElement, controls = require_timeline_controls()(React);
|
|
9546
10360
|
var MemberRows = require_timeline_member_rows()(React, statusInfo);
|
|
9547
10361
|
var splitTitle = require_timeline_title();
|
|
9548
|
-
var CSS = require_timeline_styles();
|
|
9549
10362
|
return function TaskTimelineModal(p) {
|
|
9550
10363
|
var tr = require_timeline_copy()(p.t), lang = p.t && p.t.timeline === "Timeline" ? "en" : "zh";
|
|
9551
10364
|
var ts = React.useState(p.task), task = ts[0], setTask = ts[1];
|
|
@@ -9717,7 +10530,6 @@ var require_task_timeline_modal = __commonJS({
|
|
|
9717
10530
|
return h(
|
|
9718
10531
|
"div",
|
|
9719
10532
|
{ className: "wbt-modal-mask", onKeyDown },
|
|
9720
|
-
h("style", null, CSS),
|
|
9721
10533
|
h(
|
|
9722
10534
|
"div",
|
|
9723
10535
|
{ ref: dialog, tabIndex: -1, className: "wbt-modal wide wbt-timeline-modal", role: "dialog", "aria-modal": true, "aria-label": tr("\u4EFB\u52A1\u65F6\u95F4\u7EBF") },
|
|
@@ -10325,7 +11137,7 @@ var require_task_filter_model = __commonJS({
|
|
|
10325
11137
|
// packages/addons/tasks/client/views/task-filter-panel.cjs
|
|
10326
11138
|
var require_task_filter_panel = __commonJS({
|
|
10327
11139
|
"packages/addons/tasks/client/views/task-filter-panel.cjs"(exports2, module2) {
|
|
10328
|
-
var Icon2 =
|
|
11140
|
+
var Icon2 = require_icons2().Icon;
|
|
10329
11141
|
var model = require_task_filter_model();
|
|
10330
11142
|
var DateFilter = require_date_filter().DateFilter;
|
|
10331
11143
|
var WorkspaceFilter = require_workspacefilter();
|
|
@@ -10585,64 +11397,30 @@ var require_selection_bar = __commonJS({
|
|
|
10585
11397
|
var require_task_preview = __commonJS({
|
|
10586
11398
|
"packages/addons/tasks/client/modals/task-preview.cjs"(exports2, module2) {
|
|
10587
11399
|
"use strict";
|
|
11400
|
+
var createOverlay = require_overlay();
|
|
10588
11401
|
module2.exports = function createTaskPreview(React, TaskItem) {
|
|
10589
11402
|
var h = React.createElement;
|
|
11403
|
+
var Overlay = createOverlay({
|
|
11404
|
+
maskClass: "wbt-modal-mask",
|
|
11405
|
+
dialogClass: "wbt-modal wide wbt-preview",
|
|
11406
|
+
ariaLabelledByOf: function() {
|
|
11407
|
+
return "wbt-preview-title";
|
|
11408
|
+
},
|
|
11409
|
+
// 关闭按钮自己带 autoFocus,外壳不要抢首焦点。
|
|
11410
|
+
autoFocusDialog: false
|
|
11411
|
+
});
|
|
10590
11412
|
function TaskPreview(props) {
|
|
10591
11413
|
var t = props.t, task = props.task;
|
|
10592
|
-
var titleId = "wbt-preview-title";
|
|
10593
|
-
function onKey(e) {
|
|
10594
|
-
if (e.key === "Escape") {
|
|
10595
|
-
e.preventDefault();
|
|
10596
|
-
e.stopPropagation();
|
|
10597
|
-
props.onClose();
|
|
10598
|
-
return;
|
|
10599
|
-
}
|
|
10600
|
-
if (e.key !== "Tab") return;
|
|
10601
|
-
var mask = e.currentTarget;
|
|
10602
|
-
var box = mask && mask.querySelector ? mask.querySelector('[role="dialog"]') : null;
|
|
10603
|
-
if (!box) return;
|
|
10604
|
-
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) {
|
|
10605
|
-
return node.getClientRects().length > 0;
|
|
10606
|
-
});
|
|
10607
|
-
var first = nodes[0], last = nodes[nodes.length - 1];
|
|
10608
|
-
if (!first) {
|
|
10609
|
-
e.preventDefault();
|
|
10610
|
-
if (box.focus) box.focus();
|
|
10611
|
-
} else if (e.shiftKey && (document.activeElement === first || document.activeElement === box)) {
|
|
10612
|
-
e.preventDefault();
|
|
10613
|
-
last.focus();
|
|
10614
|
-
} else if (!e.shiftKey && document.activeElement === last) {
|
|
10615
|
-
e.preventDefault();
|
|
10616
|
-
first.focus();
|
|
10617
|
-
}
|
|
10618
|
-
}
|
|
10619
11414
|
return h(
|
|
10620
|
-
|
|
10621
|
-
{
|
|
10622
|
-
className: "wbt-modal-mask",
|
|
10623
|
-
onKeyDownCapture: onKey,
|
|
10624
|
-
onMouseDown: function(e) {
|
|
10625
|
-
if (e.target === e.currentTarget) props.onClose();
|
|
10626
|
-
}
|
|
10627
|
-
},
|
|
11415
|
+
Overlay,
|
|
11416
|
+
{ onClose: props.onClose, autoFocus: false },
|
|
10628
11417
|
h(
|
|
10629
11418
|
"div",
|
|
10630
|
-
{
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
"aria-labelledby": titleId,
|
|
10636
|
-
"aria-label": t.previewLabel
|
|
10637
|
-
},
|
|
10638
|
-
h(
|
|
10639
|
-
"div",
|
|
10640
|
-
{ className: "wbt-modal-head wbt-preview-head" },
|
|
10641
|
-
h("h3", { id: titleId }, String(task.title || "").trim() || t.previewUntitled),
|
|
10642
|
-
h("button", { type: "button", className: "wbt-icon", title: t.close, "aria-label": t.close, autoFocus: true, onClick: props.onClose }, "\xD7")
|
|
10643
|
-
),
|
|
10644
|
-
h("div", { className: "wbt-preview-body" }, h(TaskItem, props.cardProps))
|
|
10645
|
-
)
|
|
11419
|
+
{ className: "wbt-modal-head wbt-preview-head" },
|
|
11420
|
+
h("h3", { id: "wbt-preview-title" }, String(task.title || "").trim() || t.previewUntitled),
|
|
11421
|
+
h("button", { type: "button", className: "wbt-icon", title: t.close, "aria-label": t.close, autoFocus: true, onClick: props.onClose }, "\xD7")
|
|
11422
|
+
),
|
|
11423
|
+
h("div", { className: "wbt-preview-body" }, h(TaskItem, props.cardProps))
|
|
10646
11424
|
);
|
|
10647
11425
|
}
|
|
10648
11426
|
return TaskPreview;
|
|
@@ -11619,8 +12397,17 @@ var require_tasks_view = __commonJS({
|
|
|
11619
12397
|
var require_timeline_add_members = __commonJS({
|
|
11620
12398
|
"packages/addons/tasks/client/timeline/timeline-add-members.cjs"(exports2, module2) {
|
|
11621
12399
|
"use strict";
|
|
12400
|
+
var createOverlay = require_overlay();
|
|
11622
12401
|
module2.exports = function(React) {
|
|
11623
12402
|
var h = React.createElement, result = require_timeline_controls()(React).result;
|
|
12403
|
+
var Overlay = createOverlay({
|
|
12404
|
+
maskClass: "wbt-modal-mask",
|
|
12405
|
+
dialogClass: "wbt-modal",
|
|
12406
|
+
ariaLabelOf: function(props) {
|
|
12407
|
+
return require_timeline_copy()(props.t)("\u6DFB\u52A0\u5DF2\u6709\u4EFB\u52A1");
|
|
12408
|
+
},
|
|
12409
|
+
closeOnMask: false
|
|
12410
|
+
});
|
|
11624
12411
|
return function AddMembers(p) {
|
|
11625
12412
|
var tr = require_timeline_copy()(p.t);
|
|
11626
12413
|
var qs = React.useState(""), query = qs[0], setQuery = qs[1];
|
|
@@ -11649,9 +12436,9 @@ var require_timeline_add_members = __commonJS({
|
|
|
11649
12436
|
setBusy(false);
|
|
11650
12437
|
});
|
|
11651
12438
|
}
|
|
11652
|
-
return h(
|
|
11653
|
-
|
|
11654
|
-
{
|
|
12439
|
+
return h(
|
|
12440
|
+
Overlay,
|
|
12441
|
+
{ onClose: p.onClose, closeOnEscape: !busy, closeOnMask: false },
|
|
11655
12442
|
h("h3", null, tr("\u6DFB\u52A0\u5DF2\u6709\u4EFB\u52A1")),
|
|
11656
12443
|
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")),
|
|
11657
12444
|
h("input", { className: "wbt-input", "aria-label": tr("\u641C\u7D22\u5DF2\u6709\u4EFB\u52A1"), value: query, onChange: function(e) {
|
|
@@ -11672,7 +12459,7 @@ var require_timeline_add_members = __commonJS({
|
|
|
11672
12459
|
} }, tr("\u4E0B\u4E00\u9875"))),
|
|
11673
12460
|
error ? h("p", { role: "alert" }, error) : null,
|
|
11674
12461
|
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 + ")"))
|
|
11675
|
-
)
|
|
12462
|
+
);
|
|
11676
12463
|
};
|
|
11677
12464
|
};
|
|
11678
12465
|
}
|
|
@@ -11682,14 +12469,24 @@ var require_timeline_add_members = __commonJS({
|
|
|
11682
12469
|
var require_timeline_merge = __commonJS({
|
|
11683
12470
|
"packages/addons/tasks/client/timeline/timeline-merge.cjs"(exports2, module2) {
|
|
11684
12471
|
"use strict";
|
|
12472
|
+
var createOverlay = require_overlay();
|
|
11685
12473
|
module2.exports = function(React) {
|
|
11686
12474
|
var h = React.createElement;
|
|
12475
|
+
var Overlay = createOverlay({
|
|
12476
|
+
maskClass: "wbt-modal-mask",
|
|
12477
|
+
dialogClass: "wbt-modal",
|
|
12478
|
+
ariaLabelOf: function(p) {
|
|
12479
|
+
return p.t.timelineMerge;
|
|
12480
|
+
},
|
|
12481
|
+
// 合并是不可逆操作,点遮罩不关闭;保存中 Esc 也不关闭。
|
|
12482
|
+
closeOnMask: false
|
|
12483
|
+
});
|
|
11687
12484
|
return function Merge(props) {
|
|
11688
12485
|
var t = props.t, targetS = React.useState(props.items[0].timelineKey), target = targetS[0], setTarget = targetS[1];
|
|
11689
12486
|
var previewS = React.useState(null), preview = previewS[0], setPreview = previewS[1];
|
|
11690
12487
|
var busyS = React.useState(false), busy = busyS[0], setBusy = busyS[1];
|
|
11691
12488
|
var errorS = React.useState(""), error = errorS[0], setError = errorS[1];
|
|
11692
|
-
var pending = React.useRef(false)
|
|
12489
|
+
var pending = React.useRef(false);
|
|
11693
12490
|
function submit(dryRun) {
|
|
11694
12491
|
if (pending.current || !dryRun && preview === null) return;
|
|
11695
12492
|
pending.current = true;
|
|
@@ -11709,26 +12506,9 @@ var require_timeline_merge = __commonJS({
|
|
|
11709
12506
|
setBusy(false);
|
|
11710
12507
|
});
|
|
11711
12508
|
}
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11715
|
-
props.onClose();
|
|
11716
|
-
}
|
|
11717
|
-
if (e.key !== "Tab") return;
|
|
11718
|
-
var nodes = panel.current.querySelectorAll("button:not(:disabled),select:not(:disabled)");
|
|
11719
|
-
var first = nodes[0], last = nodes[nodes.length - 1];
|
|
11720
|
-
if (e.shiftKey && document.activeElement === first) {
|
|
11721
|
-
e.preventDefault();
|
|
11722
|
-
last.focus();
|
|
11723
|
-
}
|
|
11724
|
-
if (!e.shiftKey && document.activeElement === last) {
|
|
11725
|
-
e.preventDefault();
|
|
11726
|
-
first.focus();
|
|
11727
|
-
}
|
|
11728
|
-
}
|
|
11729
|
-
return h("div", { className: "wbt-modal-mask" }, h(
|
|
11730
|
-
"div",
|
|
11731
|
-
{ ref: panel, className: "wbt-modal", role: "dialog", "aria-modal": true, "aria-label": t.timelineMerge, onKeyDown: keys },
|
|
12509
|
+
return h(
|
|
12510
|
+
Overlay,
|
|
12511
|
+
{ onClose: props.onClose, closeOnEscape: !busy, closeOnMask: false, autoFocus: false },
|
|
11732
12512
|
h("h3", null, t.timelineMerge),
|
|
11733
12513
|
h("p", null, t.timelineMergeHint),
|
|
11734
12514
|
h(
|
|
@@ -11752,7 +12532,7 @@ var require_timeline_merge = __commonJS({
|
|
|
11752
12532
|
submit(preview === null);
|
|
11753
12533
|
} }, busy ? t.loading : preview === null ? t.timelinePreview : t.timelineConfirm)
|
|
11754
12534
|
)
|
|
11755
|
-
)
|
|
12535
|
+
);
|
|
11756
12536
|
};
|
|
11757
12537
|
};
|
|
11758
12538
|
}
|
|
@@ -11766,7 +12546,6 @@ var require_timeline_view = __commonJS({
|
|
|
11766
12546
|
var React = deps.React, h = React.createElement, COPY = deps.COPY;
|
|
11767
12547
|
var controls = require_timeline_controls()(React), AddMembers = require_timeline_add_members()(React);
|
|
11768
12548
|
var Merge = require_timeline_merge()(React);
|
|
11769
|
-
var CSS = require_timeline_styles();
|
|
11770
12549
|
var MemberRows = require_timeline_member_rows()(React, deps.statusInfo);
|
|
11771
12550
|
var TaskPreview = require_task_preview()(React, deps.TaskItem);
|
|
11772
12551
|
var receipts = require_ownership();
|
|
@@ -11992,7 +12771,6 @@ var require_timeline_view = __commonJS({
|
|
|
11992
12771
|
return h(
|
|
11993
12772
|
"div",
|
|
11994
12773
|
{ className: "wbt-root wbt-timeline-view" },
|
|
11995
|
-
h("style", null, CSS),
|
|
11996
12774
|
h(
|
|
11997
12775
|
"div",
|
|
11998
12776
|
{ className: "wbt-timeline-toolbar" },
|
|
@@ -12293,32 +13071,6 @@ var require_timeline_view = __commonJS({
|
|
|
12293
13071
|
}
|
|
12294
13072
|
});
|
|
12295
13073
|
|
|
12296
|
-
// node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list-checks.mjs
|
|
12297
|
-
var list_checks_exports = {};
|
|
12298
|
-
__export(list_checks_exports, {
|
|
12299
|
-
__iconData: () => __iconData35,
|
|
12300
|
-
default: () => ListChecks
|
|
12301
|
-
});
|
|
12302
|
-
var __iconData35, ListChecks;
|
|
12303
|
-
var init_list_checks = __esm({
|
|
12304
|
-
"node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list-checks.mjs"() {
|
|
12305
|
-
init_createLucideIcon();
|
|
12306
|
-
__iconData35 = {
|
|
12307
|
-
name: "list-checks",
|
|
12308
|
-
size: 24,
|
|
12309
|
-
node: [
|
|
12310
|
-
["path", { d: "M13 5h8", key: "a7qcls" }],
|
|
12311
|
-
["path", { d: "M13 12h8", key: "h98zly" }],
|
|
12312
|
-
["path", { d: "M13 19h8", key: "c3s6r1" }],
|
|
12313
|
-
["path", { d: "m3 17 2 2 4-4", key: "1jhpwq" }],
|
|
12314
|
-
["path", { d: "m3 7 2 2 4-4", key: "1obspn" }]
|
|
12315
|
-
]
|
|
12316
|
-
};
|
|
12317
|
-
__iconData35.node;
|
|
12318
|
-
ListChecks = createLucideIcon(__iconData35);
|
|
12319
|
-
}
|
|
12320
|
-
});
|
|
12321
|
-
|
|
12322
13074
|
// packages/addons/tasks/client/client.src.cjs
|
|
12323
13075
|
(function() {
|
|
12324
13076
|
"use strict";
|
|
@@ -12353,8 +13105,9 @@ var init_list_checks = __esm({
|
|
|
12353
13105
|
"3": { zh: "\u5DF2\u91CD\u542F", en: "Restarted", cls: "restarted" },
|
|
12354
13106
|
"4": { zh: "\u5DF2\u63A5\u53D6", en: "Claimed", cls: "claimed" }
|
|
12355
13107
|
};
|
|
12356
|
-
var icons =
|
|
12357
|
-
var
|
|
13108
|
+
var icons = require_icons2(), ICONS = icons.ICONS, Icon2 = icons.Icon;
|
|
13109
|
+
var createOverlay = require_overlay();
|
|
13110
|
+
var workspaceView = require_workspace_view()({ React, Icon: Icon2, createOverlay });
|
|
12358
13111
|
var commandsView = require_commands()({
|
|
12359
13112
|
React,
|
|
12360
13113
|
Icon: Icon2,
|
|
@@ -12393,7 +13146,7 @@ var init_list_checks = __esm({
|
|
|
12393
13146
|
title: over ? "\u5DF2\u8D85\u8FC7\u8BA1\u5212\u5B8C\u6210\u65F6\u95F4" : "\u8DDD\u8BA1\u5212\u5B8C\u6210"
|
|
12394
13147
|
}, h(Icon2, { name: "clock", size: 11 }), h("span", { className: "wbt-cd-num" }, text));
|
|
12395
13148
|
}
|
|
12396
|
-
var CSS = require_styles();
|
|
13149
|
+
var CSS = require_styles() + "\n" + require_timeline_styles();
|
|
12397
13150
|
function injectCss() {
|
|
12398
13151
|
if (typeof document === "undefined") return;
|
|
12399
13152
|
var old = document.getElementById("wb-addon-tasks-v2-css");
|
|
@@ -12791,8 +13544,8 @@ var init_list_checks = __esm({
|
|
|
12791
13544
|
var TimelineView = require_timeline_view()({ React, COPY, injectCss, statusInfo, configView, CFG_FALLBACK, TaskItem, EditModal, DoneModal, TimelineModal, CreateModal });
|
|
12792
13545
|
host.registerAddon({
|
|
12793
13546
|
id: "wb-addon-tasks",
|
|
12794
|
-
version: "5.2.
|
|
12795
|
-
icon:
|
|
13547
|
+
version: "5.2.33",
|
|
13548
|
+
icon: ICONS["list-checks"],
|
|
12796
13549
|
views: [
|
|
12797
13550
|
{ id: "stats", icon: tabIcon("chart"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: statsView.TasksStatsView, keepAlive: true },
|
|
12798
13551
|
{ id: "tasks", icon: tabIcon("list"), title: { zh: "\u8BB0\u5F55", en: "Records" }, component: TasksView },
|