dsh-workbench-tasks 5.2.20 → 5.2.26
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 +1281 -428
- package/lib/index.js +5 -1
- package/lib/infra/config.js +3 -2
- package/package.json +4 -4
package/lib/client.js
CHANGED
|
@@ -82,6 +82,8 @@ var require_filter_checklist = __commonJS({
|
|
|
82
82
|
var onLoadMore = props.onLoadMore;
|
|
83
83
|
var onClear = props.onClear || function() {
|
|
84
84
|
};
|
|
85
|
+
var single = props.mode === "single";
|
|
86
|
+
var onPick = typeof props.onPick === "function" ? props.onPick : onToggle;
|
|
85
87
|
function toggle(id) {
|
|
86
88
|
if (disabled) return;
|
|
87
89
|
onToggle(id);
|
|
@@ -94,8 +96,8 @@ var require_filter_checklist = __commonJS({
|
|
|
94
96
|
"div",
|
|
95
97
|
{ className: "wbck-head" },
|
|
96
98
|
h("span", { className: "wbck-grow" }, title + (total ? " \xB7 " + total : "")),
|
|
97
|
-
selected.length ? h("span", { className: "wbck-sel" }, selectedText + " " + selected.length) : null,
|
|
98
|
-
selected.length || query ? h("button", {
|
|
99
|
+
!single && selected.length ? h("span", { className: "wbck-sel" }, selectedText + " " + selected.length) : null,
|
|
100
|
+
!single && (selected.length || query) ? h("button", {
|
|
99
101
|
type: "button",
|
|
100
102
|
className: "wbck-clear",
|
|
101
103
|
title: clearText,
|
|
@@ -112,6 +114,25 @@ var require_filter_checklist = __commonJS({
|
|
|
112
114
|
} else {
|
|
113
115
|
body = items.map(function(x) {
|
|
114
116
|
var on = selected.indexOf(String(x.id)) >= 0;
|
|
117
|
+
if (single) {
|
|
118
|
+
return h(
|
|
119
|
+
"button",
|
|
120
|
+
{
|
|
121
|
+
key: x.id,
|
|
122
|
+
type: "button",
|
|
123
|
+
role: "radio",
|
|
124
|
+
"aria-checked": on ? "true" : "false",
|
|
125
|
+
className: "wbck-opt" + (on ? " is-on" : ""),
|
|
126
|
+
disabled,
|
|
127
|
+
onClick: function() {
|
|
128
|
+
if (disabled) return;
|
|
129
|
+
onPick(x.id);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
h("span", { className: "wbck-nm", title: x.name }, x.name),
|
|
133
|
+
x.meta ? h("span", { className: "wbck-meta" }, x.meta) : null
|
|
134
|
+
);
|
|
135
|
+
}
|
|
115
136
|
return h(
|
|
116
137
|
"label",
|
|
117
138
|
{ key: x.id, className: "wbck-opt" + (on ? " is-on" : "") },
|
|
@@ -154,6 +175,8 @@ var require_filter_checklist = __commonJS({
|
|
|
154
175
|
h("div", {
|
|
155
176
|
className: "wbck-list",
|
|
156
177
|
onScroll: scroll,
|
|
178
|
+
role: single ? "radiogroup" : void 0,
|
|
179
|
+
"aria-label": single ? props.groupLabel || searchPlaceholder : void 0,
|
|
157
180
|
"aria-busy": loading ? "true" : "false"
|
|
158
181
|
}, body)
|
|
159
182
|
);
|
|
@@ -447,11 +470,557 @@ var require_workspacefilter = __commonJS({
|
|
|
447
470
|
}
|
|
448
471
|
});
|
|
449
472
|
|
|
473
|
+
// packages/addons/lib/date-picker.cjs
|
|
474
|
+
var require_date_picker = __commonJS({
|
|
475
|
+
"packages/addons/lib/date-picker.cjs"(exports2, module2) {
|
|
476
|
+
"use strict";
|
|
477
|
+
var ReactDefault = require("react");
|
|
478
|
+
var MONTH_EN = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
479
|
+
function pad(n) {
|
|
480
|
+
return String(n).padStart(2, "0");
|
|
481
|
+
}
|
|
482
|
+
function todayISO() {
|
|
483
|
+
var d = /* @__PURE__ */ new Date();
|
|
484
|
+
return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
|
|
485
|
+
}
|
|
486
|
+
function validDate(value) {
|
|
487
|
+
if (!value) return false;
|
|
488
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return false;
|
|
489
|
+
var d = /* @__PURE__ */ new Date(value + "T00:00:00Z");
|
|
490
|
+
return isFinite(d.getTime()) && d.toISOString().slice(0, 10) === value && value.slice(0, 4) !== "0000";
|
|
491
|
+
}
|
|
492
|
+
function toUTC(iso) {
|
|
493
|
+
return /* @__PURE__ */ new Date(iso + "T00:00:00Z");
|
|
494
|
+
}
|
|
495
|
+
function shiftDate(iso, days) {
|
|
496
|
+
var d = toUTC(iso);
|
|
497
|
+
d.setUTCDate(d.getUTCDate() + days);
|
|
498
|
+
return d.toISOString().slice(0, 10);
|
|
499
|
+
}
|
|
500
|
+
function shiftMonth(month, delta) {
|
|
501
|
+
var d = toUTC(month + "-01");
|
|
502
|
+
d.setUTCMonth(d.getUTCMonth() + delta);
|
|
503
|
+
return d.toISOString().slice(0, 7);
|
|
504
|
+
}
|
|
505
|
+
function monthKey(iso) {
|
|
506
|
+
return (iso || todayISO()).slice(0, 7);
|
|
507
|
+
}
|
|
508
|
+
function monthLabel(month, en) {
|
|
509
|
+
return en ? month.slice(0, 4) + "-" + month.slice(5) : month.slice(0, 4) + "\u5E74" + Number(month.slice(5)) + "\u6708";
|
|
510
|
+
}
|
|
511
|
+
function daysInMonth(month) {
|
|
512
|
+
return new Date(Date.UTC(Number(month.slice(0, 4)), Number(month.slice(5)), 0)).getUTCDate();
|
|
513
|
+
}
|
|
514
|
+
function normalizeRange(value) {
|
|
515
|
+
var from = value && validDate(value.from) ? value.from : "";
|
|
516
|
+
var to = value && validDate(value.to) ? value.to : "";
|
|
517
|
+
if (from && to && from > to) return { from: to, to: from, swapped: true };
|
|
518
|
+
return { from, to, swapped: false };
|
|
519
|
+
}
|
|
520
|
+
function clampDay(iso, min, max) {
|
|
521
|
+
if (min && iso < min) return false;
|
|
522
|
+
if (max && iso > max) return false;
|
|
523
|
+
return true;
|
|
524
|
+
}
|
|
525
|
+
function ctx(props) {
|
|
526
|
+
var R = props && props.React || ReactDefault;
|
|
527
|
+
return { R, h: props && props.h || R.createElement };
|
|
528
|
+
}
|
|
529
|
+
function usePopover(R, open, setOpen, root) {
|
|
530
|
+
R.useEffect(function() {
|
|
531
|
+
if (!open) return void 0;
|
|
532
|
+
function onDoc(ev) {
|
|
533
|
+
if (root.current && !root.current.contains(ev.target)) setOpen(false);
|
|
534
|
+
}
|
|
535
|
+
function onKey(ev) {
|
|
536
|
+
if (ev.key === "Escape") setOpen(false);
|
|
537
|
+
}
|
|
538
|
+
if (typeof document !== "undefined" && typeof document.addEventListener === "function") {
|
|
539
|
+
document.addEventListener("mousedown", onDoc);
|
|
540
|
+
document.addEventListener("keydown", onKey);
|
|
541
|
+
return function() {
|
|
542
|
+
document.removeEventListener("mousedown", onDoc);
|
|
543
|
+
document.removeEventListener("keydown", onKey);
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
return void 0;
|
|
547
|
+
}, [open]);
|
|
548
|
+
}
|
|
549
|
+
function Calendar(props) {
|
|
550
|
+
var h = props.h, p = props.prefix, en = props.lang === "en";
|
|
551
|
+
var month = props.month, cells = [];
|
|
552
|
+
var offset = toUTC(month + "-01").getUTCDay();
|
|
553
|
+
var count = daysInMonth(month);
|
|
554
|
+
var i;
|
|
555
|
+
for (i = 0; i < offset; i++) cells.push(h("span", { key: "e" + i, "aria-hidden": "true" }));
|
|
556
|
+
for (i = 1; i <= count; i++) {
|
|
557
|
+
var day = month + "-" + pad(i);
|
|
558
|
+
var disabled = !clampDay(day, props.min, props.max);
|
|
559
|
+
var selected = props.isSelected ? props.isSelected(day) : false;
|
|
560
|
+
var between = props.isBetween ? props.isBetween(day) : false;
|
|
561
|
+
cells.push(h("button", {
|
|
562
|
+
key: day,
|
|
563
|
+
type: "button",
|
|
564
|
+
disabled,
|
|
565
|
+
"data-day": day,
|
|
566
|
+
"aria-label": day,
|
|
567
|
+
"aria-pressed": selected,
|
|
568
|
+
"aria-current": day === todayISO() ? "date" : void 0,
|
|
569
|
+
className: p + "-dp-day" + (selected ? " is-on" : "") + (between ? " is-between" : "") + (day === todayISO() ? " is-today" : ""),
|
|
570
|
+
onClick: props.onPick.bind(null, day),
|
|
571
|
+
onKeyDown: function(ev) {
|
|
572
|
+
var delta = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -7, ArrowDown: 7 }[ev.key];
|
|
573
|
+
if (!delta) return;
|
|
574
|
+
ev.preventDefault();
|
|
575
|
+
var next = shiftDate(ev.currentTarget.getAttribute("data-day"), delta);
|
|
576
|
+
if (clampDay(next, props.min, props.max)) props.onMove(monthKey(next), next);
|
|
577
|
+
}
|
|
578
|
+
}, i));
|
|
579
|
+
}
|
|
580
|
+
return h(
|
|
581
|
+
"div",
|
|
582
|
+
{ className: p + "-dp-cal", role: "group", "aria-label": en ? "Calendar" : "\u65E5\u5386" },
|
|
583
|
+
h(
|
|
584
|
+
"div",
|
|
585
|
+
{ className: p + "-dp-head" },
|
|
586
|
+
h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Previous month" : "\u4E0A\u4E2A\u6708", onClick: function() {
|
|
587
|
+
props.onMove(shiftMonth(month, -1), "");
|
|
588
|
+
} }, "\u2039"),
|
|
589
|
+
h("strong", { className: p + "-dp-title", "aria-live": "polite" }, monthLabel(month, en)),
|
|
590
|
+
h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Next month" : "\u4E0B\u4E2A\u6708", onClick: function() {
|
|
591
|
+
props.onMove(shiftMonth(month, 1), "");
|
|
592
|
+
} }, "\u203A")
|
|
593
|
+
),
|
|
594
|
+
h(
|
|
595
|
+
"div",
|
|
596
|
+
{ className: p + "-dp-weekdays", "aria-hidden": "true" },
|
|
597
|
+
(en ? ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] : ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"]).map(function(w) {
|
|
598
|
+
return h("span", { key: w }, w);
|
|
599
|
+
})
|
|
600
|
+
),
|
|
601
|
+
h("div", { className: p + "-dp-grid" }, cells)
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
function DatePicker(props) {
|
|
605
|
+
var c = ctx(props), R = c.R, h = c.h;
|
|
606
|
+
var p = props.prefix, en = props.lang === "en";
|
|
607
|
+
var value = validDate(props.value) ? props.value : "";
|
|
608
|
+
var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
|
|
609
|
+
var monthS = R.useState(monthKey(value || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
|
|
610
|
+
var root = R.useRef(null);
|
|
611
|
+
usePopover(R, open, setOpen, root);
|
|
612
|
+
function pick(day) {
|
|
613
|
+
if (props.onChange) props.onChange(day);
|
|
614
|
+
setOpen(false);
|
|
615
|
+
}
|
|
616
|
+
function toggle() {
|
|
617
|
+
setMonth(monthKey(validDate(props.value) ? props.value : props.max || todayISO()));
|
|
618
|
+
setOpen(!open);
|
|
619
|
+
}
|
|
620
|
+
return h(
|
|
621
|
+
"div",
|
|
622
|
+
{ className: p + "-dp" + (props.className ? " " + props.className : ""), ref: root },
|
|
623
|
+
h(
|
|
624
|
+
"div",
|
|
625
|
+
{ className: p + "-dp-field" },
|
|
626
|
+
h(
|
|
627
|
+
"button",
|
|
628
|
+
{
|
|
629
|
+
type: "button",
|
|
630
|
+
className: p + "-dp-trigger",
|
|
631
|
+
disabled: !!props.disabled,
|
|
632
|
+
"aria-haspopup": "dialog",
|
|
633
|
+
"aria-expanded": open,
|
|
634
|
+
"aria-label": (props.label ? props.label + ": " : "") + (value || props.placeholder || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F")),
|
|
635
|
+
onClick: toggle
|
|
636
|
+
},
|
|
637
|
+
h("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
|
|
638
|
+
h("span", { className: p + "-dp-value" + (value ? "" : " is-empty") }, value || props.placeholder || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F"))
|
|
639
|
+
),
|
|
640
|
+
value && !props.disabled && props.clearable !== false ? h("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear date" : "\u6E05\u9664\u65E5\u671F", onClick: function() {
|
|
641
|
+
if (props.onChange) props.onChange("");
|
|
642
|
+
} }, "\xD7") : null
|
|
643
|
+
),
|
|
644
|
+
open ? h(
|
|
645
|
+
"div",
|
|
646
|
+
{ className: p + "-dp-pop", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F") },
|
|
647
|
+
h(Calendar, { h, prefix: p, lang: props.lang, month, min: props.min, max: props.max, onMove: function(m) {
|
|
648
|
+
setMonth(m);
|
|
649
|
+
}, isSelected: function(d) {
|
|
650
|
+
return d === value;
|
|
651
|
+
}, onPick: pick }),
|
|
652
|
+
h(
|
|
653
|
+
"div",
|
|
654
|
+
{ className: p + "-dp-foot" },
|
|
655
|
+
h("button", { type: "button", className: p + "-dp-link", onClick: function() {
|
|
656
|
+
pick(todayISO());
|
|
657
|
+
} }, en ? "Today" : "\u4ECA\u5929"),
|
|
658
|
+
props.min || props.max ? h("span", { className: p + "-dp-hint" }, [props.min, props.max].filter(Boolean).join(" \u2014 ")) : null
|
|
659
|
+
)
|
|
660
|
+
) : null
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
function RangePicker(props) {
|
|
664
|
+
var c = ctx(props), R = c.R, h = c.h;
|
|
665
|
+
var p = props.prefix, en = props.lang === "en";
|
|
666
|
+
var range = normalizeRange(props.value);
|
|
667
|
+
var from = range.from, to = range.to;
|
|
668
|
+
var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
|
|
669
|
+
var startS = R.useState(""), start = startS[0], setStart = startS[1];
|
|
670
|
+
var monthS = R.useState(monthKey(from || to || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
|
|
671
|
+
var root = R.useRef(null);
|
|
672
|
+
usePopover(R, open, setOpen, root);
|
|
673
|
+
function apply(next) {
|
|
674
|
+
if (typeof props.onChange === "function") props.onChange(normalizeRange(next));
|
|
675
|
+
setStart("");
|
|
676
|
+
setOpen(false);
|
|
677
|
+
}
|
|
678
|
+
function pick(day) {
|
|
679
|
+
if (!start) {
|
|
680
|
+
setStart(day);
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
apply({ from: start, to: day });
|
|
684
|
+
}
|
|
685
|
+
function toggle() {
|
|
686
|
+
setStart("");
|
|
687
|
+
setMonth(monthKey(from || to || props.max || todayISO()));
|
|
688
|
+
setOpen(!open);
|
|
689
|
+
}
|
|
690
|
+
var summary = from && to ? from + " \u2014 " + to : from ? from + (en ? " onward" : " \u8D77") : to ? (en ? "Until " : "\u622A\u81F3 ") + to : props.placeholder || (en ? "Choose date range" : "\u9009\u62E9\u65E5\u671F\u8303\u56F4");
|
|
691
|
+
return h(
|
|
692
|
+
"div",
|
|
693
|
+
{ className: p + "-dr" + (props.className ? " " + props.className : ""), ref: root },
|
|
694
|
+
h(
|
|
695
|
+
"div",
|
|
696
|
+
{ className: p + "-dp-field" },
|
|
697
|
+
h(
|
|
698
|
+
"button",
|
|
699
|
+
{
|
|
700
|
+
type: "button",
|
|
701
|
+
className: p + "-dp-trigger",
|
|
702
|
+
"aria-haspopup": "dialog",
|
|
703
|
+
"aria-expanded": open,
|
|
704
|
+
"aria-label": (props.label || (en ? "Date range" : "\u65E5\u671F\u8303\u56F4")) + ": " + summary,
|
|
705
|
+
onClick: toggle
|
|
706
|
+
},
|
|
707
|
+
h("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
|
|
708
|
+
h("span", { className: p + "-dp-value" + (from || to ? "" : " is-empty") }, summary)
|
|
709
|
+
),
|
|
710
|
+
(from || to) && props.clearable !== false ? h("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear range" : "\u6E05\u9664\u8303\u56F4", onClick: function() {
|
|
711
|
+
apply({ from: "", to: "" });
|
|
712
|
+
} }, "\xD7") : null
|
|
713
|
+
),
|
|
714
|
+
open ? h(
|
|
715
|
+
"div",
|
|
716
|
+
{ className: p + "-dp-pop", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Date range" : "\u65E5\u671F\u8303\u56F4") },
|
|
717
|
+
h(Calendar, {
|
|
718
|
+
h,
|
|
719
|
+
prefix: p,
|
|
720
|
+
lang: props.lang,
|
|
721
|
+
month,
|
|
722
|
+
min: props.min,
|
|
723
|
+
max: props.max,
|
|
724
|
+
onMove: function(m) {
|
|
725
|
+
setMonth(m);
|
|
726
|
+
},
|
|
727
|
+
isSelected: function(d) {
|
|
728
|
+
return start ? d === start : d === from || d === to;
|
|
729
|
+
},
|
|
730
|
+
isBetween: function(d) {
|
|
731
|
+
return start ? start < d && d < (to || "") : !!(from && to && d > from && d < to);
|
|
732
|
+
},
|
|
733
|
+
onPick: pick
|
|
734
|
+
}),
|
|
735
|
+
h(
|
|
736
|
+
"p",
|
|
737
|
+
{ className: p + "-dp-hint", role: "status" },
|
|
738
|
+
start ? en ? "Start " + start + " \xB7 pick the end date" : "\u8D77\u59CB " + start + " \xB7 \u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F" : en ? "Pick start, then end date" : "\u5148\u9009\u5F00\u59CB\u65E5\u671F\uFF0C\u518D\u9009\u7ED3\u675F\u65E5\u671F"
|
|
739
|
+
),
|
|
740
|
+
start ? h(
|
|
741
|
+
"div",
|
|
742
|
+
{ className: p + "-dp-acts" },
|
|
743
|
+
h("button", { type: "button", className: p + "-dp-link", onClick: function() {
|
|
744
|
+
apply({ from: start, to: "" });
|
|
745
|
+
} }, en ? "Only start" : "\u4EC5\u8D77\u59CB\u65E5\u671F"),
|
|
746
|
+
h("button", { type: "button", className: p + "-dp-link", onClick: function() {
|
|
747
|
+
apply({ from: "", to: start });
|
|
748
|
+
} }, en ? "Only end" : "\u4EC5\u622A\u6B62\u65E5\u671F")
|
|
749
|
+
) : null,
|
|
750
|
+
h(
|
|
751
|
+
"div",
|
|
752
|
+
{ className: p + "-dp-foot" },
|
|
753
|
+
h("button", { type: "button", className: p + "-dp-link", onClick: function() {
|
|
754
|
+
setOpen(false);
|
|
755
|
+
setStart("");
|
|
756
|
+
} }, en ? "Cancel" : "\u53D6\u6D88")
|
|
757
|
+
)
|
|
758
|
+
) : null
|
|
759
|
+
);
|
|
760
|
+
}
|
|
761
|
+
function MonthPicker(props) {
|
|
762
|
+
var c = ctx(props), R = c.R, h = c.h;
|
|
763
|
+
var p = props.prefix, en = props.lang === "en";
|
|
764
|
+
var value = /^\d{4}-\d{2}$/.test(props.value || "") ? props.value : "";
|
|
765
|
+
var base = value || monthKey(props.max || todayISO());
|
|
766
|
+
var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
|
|
767
|
+
var yearS = R.useState(Number(base.slice(0, 4))), year = yearS[0], setYear = yearS[1];
|
|
768
|
+
var root = R.useRef(null);
|
|
769
|
+
usePopover(R, open, setOpen, root);
|
|
770
|
+
function pick(month) {
|
|
771
|
+
if (props.onChange) props.onChange(month);
|
|
772
|
+
setOpen(false);
|
|
773
|
+
}
|
|
774
|
+
var months = [];
|
|
775
|
+
for (var m = 1; m <= 12; m++) {
|
|
776
|
+
var key = year + "-" + pad(m);
|
|
777
|
+
months.push(h("button", {
|
|
778
|
+
key,
|
|
779
|
+
type: "button",
|
|
780
|
+
"data-month": key,
|
|
781
|
+
"aria-pressed": key === value,
|
|
782
|
+
className: p + "-dp-day" + (key === value ? " is-on" : "") + (key === monthKey(todayISO()) ? " is-today" : ""),
|
|
783
|
+
onClick: pick.bind(null, key)
|
|
784
|
+
}, en ? MONTH_EN[m - 1] : m + "\u6708"));
|
|
785
|
+
}
|
|
786
|
+
return h(
|
|
787
|
+
"div",
|
|
788
|
+
{ className: p + "-dp" + (props.className ? " " + props.className : ""), ref: root },
|
|
789
|
+
h(
|
|
790
|
+
"div",
|
|
791
|
+
{ className: p + "-dp-field" },
|
|
792
|
+
h(
|
|
793
|
+
"button",
|
|
794
|
+
{
|
|
795
|
+
type: "button",
|
|
796
|
+
className: p + "-dp-trigger",
|
|
797
|
+
"aria-haspopup": "dialog",
|
|
798
|
+
"aria-expanded": open,
|
|
799
|
+
"aria-label": (props.label || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD")) + ": " + (value ? monthLabel(value, en) : ""),
|
|
800
|
+
onClick: function() {
|
|
801
|
+
setYear(Number((value || base).slice(0, 4)));
|
|
802
|
+
setOpen(!open);
|
|
803
|
+
}
|
|
804
|
+
},
|
|
805
|
+
h("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
|
|
806
|
+
h("span", { className: p + "-dp-value" + (value ? "" : " is-empty") }, value ? monthLabel(value, en) : props.placeholder || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD"))
|
|
807
|
+
),
|
|
808
|
+
value && props.clearable !== false ? h("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear month" : "\u6E05\u9664\u6708\u4EFD", onClick: function() {
|
|
809
|
+
if (props.onChange) props.onChange("");
|
|
810
|
+
} }, "\xD7") : null
|
|
811
|
+
),
|
|
812
|
+
open ? h(
|
|
813
|
+
"div",
|
|
814
|
+
{ className: p + "-dp-pop is-months", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD") },
|
|
815
|
+
h(
|
|
816
|
+
"div",
|
|
817
|
+
{ className: p + "-dp-head" },
|
|
818
|
+
h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Previous year" : "\u4E0A\u4E00\u5E74", onClick: function() {
|
|
819
|
+
setYear(year - 1);
|
|
820
|
+
} }, "\u2039"),
|
|
821
|
+
h("strong", { className: p + "-dp-title", "aria-live": "polite" }, en ? String(year) : year + "\u5E74"),
|
|
822
|
+
h("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Next year" : "\u4E0B\u4E00\u5E74", onClick: function() {
|
|
823
|
+
setYear(year + 1);
|
|
824
|
+
} }, "\u203A")
|
|
825
|
+
),
|
|
826
|
+
h("div", { className: p + "-dp-months" }, months),
|
|
827
|
+
h(
|
|
828
|
+
"div",
|
|
829
|
+
{ className: p + "-dp-foot" },
|
|
830
|
+
h("button", { type: "button", className: p + "-dp-link", onClick: function() {
|
|
831
|
+
pick(monthKey(todayISO()));
|
|
832
|
+
} }, en ? "This month" : "\u672C\u6708"),
|
|
833
|
+
h("button", { type: "button", className: p + "-dp-link", onClick: function() {
|
|
834
|
+
setOpen(false);
|
|
835
|
+
} }, en ? "Cancel" : "\u53D6\u6D88")
|
|
836
|
+
)
|
|
837
|
+
) : null
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
function InlineCalendar(props) {
|
|
841
|
+
var c = ctx(props), R = c.R, h = c.h;
|
|
842
|
+
var p = props.prefix;
|
|
843
|
+
var value = validDate(props.value) ? props.value : "";
|
|
844
|
+
var monthS = R.useState(monthKey(props.month || value || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
|
|
845
|
+
return h(
|
|
846
|
+
"div",
|
|
847
|
+
{ className: p + "-dp is-inline" },
|
|
848
|
+
h(Calendar, {
|
|
849
|
+
h,
|
|
850
|
+
prefix: p,
|
|
851
|
+
lang: props.lang,
|
|
852
|
+
month,
|
|
853
|
+
min: props.min,
|
|
854
|
+
max: props.max,
|
|
855
|
+
onMove: function(m) {
|
|
856
|
+
setMonth(m);
|
|
857
|
+
if (props.onMonthChange) props.onMonthChange(m);
|
|
858
|
+
},
|
|
859
|
+
isSelected: function(d) {
|
|
860
|
+
return d === value;
|
|
861
|
+
},
|
|
862
|
+
isBetween: props.isBetween,
|
|
863
|
+
onPick: function(d) {
|
|
864
|
+
if (props.onChange) props.onChange(d);
|
|
865
|
+
}
|
|
866
|
+
}),
|
|
867
|
+
props.footer ? h("div", { className: p + "-dp-foot" }, props.footer) : null
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
module2.exports = {
|
|
871
|
+
DatePicker,
|
|
872
|
+
RangePicker,
|
|
873
|
+
MonthPicker,
|
|
874
|
+
InlineCalendar,
|
|
875
|
+
todayISO,
|
|
876
|
+
validDate,
|
|
877
|
+
shiftDate,
|
|
878
|
+
shiftMonth,
|
|
879
|
+
normalizeRange,
|
|
880
|
+
monthLabel,
|
|
881
|
+
daysInMonth
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
// packages/addons/lib/date-picker-styles.cjs
|
|
887
|
+
var require_date_picker_styles = __commonJS({
|
|
888
|
+
"packages/addons/lib/date-picker-styles.cjs"(exports2, module2) {
|
|
889
|
+
"use strict";
|
|
890
|
+
module2.exports = function datePickerStyles(prefix) {
|
|
891
|
+
var p = String(prefix || "wb");
|
|
892
|
+
return [
|
|
893
|
+
".{p}-dp,.{p}-dr{position:relative;min-width:0}",
|
|
894
|
+
".{p}-dp-field{display:flex;align-items:center;gap:6px;min-width:0}",
|
|
895
|
+
".{p}-dp-trigger{display:flex;align-items:center;gap:8px;min-width:0;width:100%;padding:8px 10px;border:1px solid var(--wb-border);border-radius:8px;background:var(--wb-surface);color:var(--wb-text,inherit);font:inherit;text-align:left;cursor:pointer;transition:border-color .15s,box-shadow .15s}",
|
|
896
|
+
".{p}-dp-trigger:hover{border-color:var(--wb-accent)}",
|
|
897
|
+
".{p}-dp-trigger:focus-visible{outline:2px solid var(--wb-accent);outline-offset:1px}",
|
|
898
|
+
".{p}-dp-trigger[disabled]{opacity:.55;cursor:not-allowed}",
|
|
899
|
+
".{p}-dp-glyph{width:13px;height:13px;flex:none;border:1.5px solid currentColor;border-radius:3px;position:relative;opacity:.72}",
|
|
900
|
+
'.{p}-dp-glyph::before{content:"";position:absolute;left:-1.5px;right:-1.5px;top:3px;border-top:1.5px solid currentColor}',
|
|
901
|
+
'.{p}-dp-glyph::after{content:"";position:absolute;left:3px;top:-3px;width:1.5px;height:3px;background:currentColor;box-shadow:4px 0 currentColor}',
|
|
902
|
+
".{p}-dp-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums}",
|
|
903
|
+
".{p}-dp-value.is-empty{color:var(--wb-muted)}",
|
|
904
|
+
".{p}-dp-clear{flex:none;width:22px;height:22px;padding:0;border:0;border-radius:50%;background:color-mix(in srgb,var(--wb-muted) 14%,transparent);color:var(--wb-muted);font:inherit;line-height:1;cursor:pointer}",
|
|
905
|
+
".{p}-dp-clear:hover{color:var(--wb-danger);background:color-mix(in srgb,var(--wb-danger) 16%,transparent)}",
|
|
906
|
+
".{p}-dp-pop{position:absolute;z-index:40;top:calc(100% + 6px);left:0;width:272px;padding:10px;border:1px solid var(--wb-border);border-radius:12px;background:var(--wb-card);box-shadow:0 16px 40px color-mix(in srgb,var(--wb-text,var(--wb-border)) 18%,transparent);animation:{p}-dp-in .14s ease-out}",
|
|
907
|
+
".{p}-dp-head{display:flex;align-items:center;gap:6px;margin-bottom:8px}",
|
|
908
|
+
".{p}-dp-title{flex:1;text-align:center;font-size:13px;font-weight:600;font-variant-numeric:tabular-nums}",
|
|
909
|
+
".{p}-dp-nav{width:26px;height:26px;padding:0;border:1px solid var(--wb-border);border-radius:7px;background:transparent;color:inherit;font:inherit;line-height:1;cursor:pointer}",
|
|
910
|
+
".{p}-dp-nav:hover{border-color:var(--wb-accent);color:var(--wb-accent)}",
|
|
911
|
+
".{p}-dp-weekdays,.{p}-dp-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px}",
|
|
912
|
+
".{p}-dp-weekdays{margin-bottom:4px;font-size:11px;color:var(--wb-muted);text-align:center}",
|
|
913
|
+
".{p}-dp-day{min-width:0;height:30px;padding:0;border:0;border-radius:7px;background:transparent;color:inherit;font:inherit;font-variant-numeric:tabular-nums;cursor:pointer}",
|
|
914
|
+
".{p}-dp-day:hover{background:color-mix(in srgb,var(--wb-accent) 12%,transparent)}",
|
|
915
|
+
".{p}-dp-day.is-between{background:color-mix(in srgb,var(--wb-accent) 16%,transparent);border-radius:0}",
|
|
916
|
+
".{p}-dp-day.is-today{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--wb-accent) 55%,transparent)}",
|
|
917
|
+
".{p}-dp-day.is-on{background:var(--wb-accent);color:var(--wb-on-accent,inherit);font-weight:600}",
|
|
918
|
+
".{p}-dp-day:disabled{opacity:.35;cursor:not-allowed}",
|
|
919
|
+
".{p}-dp-day:focus-visible{outline:2px solid var(--wb-accent);outline-offset:-2px}",
|
|
920
|
+
".{p}-dp-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px;padding-top:8px;border-top:1px solid var(--wb-line)}",
|
|
921
|
+
".{p}-dp-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}",
|
|
922
|
+
".{p}-dp-link{padding:4px 8px;border:0;border-radius:6px;background:color-mix(in srgb,var(--wb-muted) 12%,transparent);color:inherit;font:inherit;font-size:12px;cursor:pointer}",
|
|
923
|
+
".{p}-dp-link:hover{background:color-mix(in srgb,var(--wb-accent) 16%,transparent);color:var(--wb-accent)}",
|
|
924
|
+
".{p}-dp-hint{margin:6px 0 0;font-size:11px;color:var(--wb-muted)}",
|
|
925
|
+
".{p}-dp-pop.is-months{width:248px}",
|
|
926
|
+
".{p}-dp-months{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin-bottom:6px}",
|
|
927
|
+
".{p}-dp-months .{p}-dp-day{height:34px}",
|
|
928
|
+
"@keyframes {p}-dp-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}"
|
|
929
|
+
].join("\n").replace(/\{p\}/g, p);
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
|
|
934
|
+
// packages/addons/tasks/client/stats/trend-interaction.cjs
|
|
935
|
+
var require_trend_interaction = __commonJS({
|
|
936
|
+
"packages/addons/tasks/client/stats/trend-interaction.cjs"(exports2, module2) {
|
|
937
|
+
function isVisible(hidden, key) {
|
|
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
|
+
|
|
450
1018
|
// packages/addons/tasks/client/stats/charts.cjs
|
|
451
1019
|
var require_charts = __commonJS({
|
|
452
1020
|
"packages/addons/tasks/client/stats/charts.cjs"(exports2, module2) {
|
|
453
1021
|
var React = require("react");
|
|
454
1022
|
var h = React.createElement;
|
|
1023
|
+
var DP = require_date_picker();
|
|
455
1024
|
var COLORS = [
|
|
456
1025
|
"var(--dsw-alias-state-business-primary, #4f6ef7)",
|
|
457
1026
|
"var(--dsw-alias-state-success-primary, #2f9e6e)",
|
|
@@ -464,13 +1033,12 @@ var require_charts = __commonJS({
|
|
|
464
1033
|
function css(prefix) {
|
|
465
1034
|
return [
|
|
466
1035
|
".@-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}",
|
|
467
|
-
".@-stats{display:flex;flex-direction:column;gap:
|
|
1036
|
+
".@-stats{display:flex;flex-direction:column;gap:18px;padding:4px 2px 24px;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
468
1037
|
".@-stoolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
|
|
469
1038
|
".@-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)}",
|
|
470
1039
|
".@-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}",
|
|
471
1040
|
".@-seg button.@-on{background:var(--dsw-alias-brand-primary,#4f6ef7);color:var(--dsw-alias-label-primary-inverted,#fff)}",
|
|
472
|
-
".@-range{display:inline-flex;align-items:center;gap:4px
|
|
473
|
-
".@-range:focus-within{border-color:var(--dsw-alias-brand-primary,#4f6ef7)}",
|
|
1041
|
+
".@-range{display:inline-flex;align-items:center;gap:4px}",
|
|
474
1042
|
".@-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}",
|
|
475
1043
|
".@-date::-webkit-calendar-picker-indicator{opacity:.55;cursor:pointer}",
|
|
476
1044
|
".@-dash{color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
|
|
@@ -487,20 +1055,36 @@ var require_charts = __commonJS({
|
|
|
487
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}",
|
|
488
1056
|
".@-dims button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
489
1057
|
".@-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}",
|
|
490
1065
|
".@-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}",
|
|
491
1066
|
".@-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}",
|
|
492
1067
|
".@-chead{display:flex;align-items:baseline;gap:8px;margin-bottom:10px;flex-wrap:wrap}",
|
|
493
1068
|
".@-ctitle{font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
494
1069
|
".@-cnote{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
|
|
495
1070
|
".@-kpis{grid-column:span 12;display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px}",
|
|
1071
|
+
// 核心指标与次级指标分两行:核心 4 张给足字号,次级 4 张收紧,避免 8 张 KPI 抢同一层的视觉重量。
|
|
1072
|
+
".@-kpis-main{grid-template-columns:repeat(4,minmax(0,1fr))}",
|
|
1073
|
+
".@-kpis-sub{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}",
|
|
1074
|
+
".@-kpi-lg{padding:14px 16px}",
|
|
1075
|
+
".@-kpi-lg .@-kpi-v{font-size:30px}",
|
|
1076
|
+
".@-kpi-sm{padding:9px 12px}",
|
|
1077
|
+
".@-kpi-sm .@-kpi-l{font-size:11.5px}",
|
|
1078
|
+
".@-kpi-sm .@-kpi-v{font-size:19px}",
|
|
1079
|
+
".@-kpi-sm .@-kpi-h{font-size:10.5px;margin-top:1px}",
|
|
496
1080
|
".@-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}",
|
|
497
1081
|
".@-kpi-l{font-size:12px;color:var(--dsw-alias-label-tertiary,#8f959e);display:flex;align-items:center;gap:6px}",
|
|
498
1082
|
".@-kpi-v{font-size:26px;line-height:1.25;font-weight:650;margin-top:4px;font-variant-numeric:tabular-nums}",
|
|
499
1083
|
".@-kpi-u{font-size:12px;font-weight:400;color:var(--dsw-alias-label-tertiary,#8f959e);margin-left:3px}",
|
|
500
1084
|
".@-kpi-h{font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e);margin-top:3px}",
|
|
501
|
-
".@-kpi.@-danger .@-kpi-v{color:var(--dsw-alias-state-error-primary,#d9534f)}",
|
|
502
|
-
".@-kpi.@-warn .@-kpi-v{color:var(--dsw-alias-state-warn-primary,#d99100)}",
|
|
503
|
-
".@-kpi.@-ok .@-kpi-v{color:var(--dsw-alias-state-success-primary,#2f9e6e)}",
|
|
1085
|
+
".@-kpi.@-kpi-tone-danger .@-kpi-v{color:var(--dsw-alias-state-error-primary,#d9534f)}",
|
|
1086
|
+
".@-kpi.@-kpi-tone-warn .@-kpi-v{color:var(--dsw-alias-state-warn-primary,#d99100)}",
|
|
1087
|
+
".@-kpi.@-kpi-tone-ok .@-kpi-v{color:var(--dsw-alias-state-success-primary,#2f9e6e)}",
|
|
504
1088
|
".@-donut{display:flex;align-items:center;gap:16px;flex-wrap:wrap}",
|
|
505
1089
|
".@-donut svg{flex:0 0 auto}",
|
|
506
1090
|
".@-legend{display:flex;flex-direction:column;gap:7px;min-width:120px;flex:1}",
|
|
@@ -529,6 +1113,21 @@ var require_charts = __commonJS({
|
|
|
529
1113
|
".@-hbar-link:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
530
1114
|
".@-trend{width:100%;height:auto;display:block}",
|
|
531
1115
|
".@-tlegend{display:flex;gap:14px;flex-wrap:wrap;margin-top:6px;font-size:11px;color:var(--dsw-alias-label-tertiary,#8f959e)}",
|
|
1116
|
+
".@-trend-wrap{position:relative}",
|
|
1117
|
+
".@-trend-box{position:relative;border-radius:10px}",
|
|
1118
|
+
".@-trend-box:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
1119
|
+
".@-trend-tip{position:absolute;top:4px;z-index:3;pointer-events:none;display:flex;flex-direction:column;gap:2px;min-width:104px;padding:6px 8px;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:8px;background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 6px 20px color-mix(in srgb,var(--dsw-alias-label-primary,#1f2329) 16%,transparent);font-size:11px;color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1120
|
+
".@-tip-day{font-size:11.5px;margin-bottom:2px}",
|
|
1121
|
+
".@-tip-row{display:flex;align-items:center;gap:6px;white-space:nowrap}",
|
|
1122
|
+
".@-tip-name{color:var(--dsw-alias-label-secondary,#646a73)}",
|
|
1123
|
+
".@-tip-row b{margin-left:auto;font-variant-numeric:tabular-nums}",
|
|
1124
|
+
".@-tlegend-item{display:inline-flex;align-items:center;gap:5px;appearance:none;border:0;background:none;padding:2px 0;font:inherit;font-size:11px;color:inherit;cursor:pointer;border-radius:4px}",
|
|
1125
|
+
".@-tlegend-item:hover:not(:disabled){color:var(--dsw-alias-label-primary,#1f2329)}",
|
|
1126
|
+
".@-tlegend-item[aria-pressed=false]{opacity:.45}",
|
|
1127
|
+
".@-tlegend-item[aria-pressed=false] .@-dot{background:transparent;border:1px solid currentColor}",
|
|
1128
|
+
".@-tlegend-item:disabled{cursor:default}",
|
|
1129
|
+
".@-tlegend-item:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
|
|
1130
|
+
".@-dot-off{width:8px;height:8px;border-radius:50%;border:1px solid;flex:0 0 auto}",
|
|
532
1131
|
".@-table-scroll{max-width:100%;overflow-x:auto}.@-table{width:100%;border-collapse:collapse;font-size:12px}",
|
|
533
1132
|
".@-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}",
|
|
534
1133
|
".@-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}",
|
|
@@ -536,12 +1135,13 @@ var require_charts = __commonJS({
|
|
|
536
1135
|
".@-table th.@-num,.@-table td.@-num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}",
|
|
537
1136
|
".@-empty{padding:26px 8px;text-align:center;color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
|
|
538
1137
|
".@-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}",
|
|
539
|
-
".@-
|
|
1138
|
+
".@-warnbar{grid-column:span 12;border:1px dashed var(--dsw-alias-state-warn-primary,#d99100);border-radius:10px;padding:9px 12px;font-size:12px;color:var(--dsw-alias-state-warn-primary,#d99100);background:color-mix(in srgb,var(--dsw-alias-state-warn-primary,#d99100) 6%,transparent)}",
|
|
540
1139
|
".@-sk{height:14px;border-radius:6px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);margin:7px 0;animation:@-pulse 1.2s ease-in-out infinite}",
|
|
541
1140
|
"@keyframes @-pulse{0%,100%{opacity:.55}50%{opacity:1}}",
|
|
542
|
-
"@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))}}",
|
|
543
|
-
"@media (max-width:600px){.@-stats{padding-bottom:16px}.@-hist{height:130px}.@-kpi-v{font-size:22px}}",
|
|
544
|
-
"@media (prefers-reduced-motion:reduce){.@-sk{animation:none}}"
|
|
1141
|
+
"@media (max-width:900px){.@-scard{grid-column:span 12}.@-span-3,.@-span-4,.@-span-6,.@-span-8{grid-column:span 12}.@-kpis,.@-kpis-main,.@-kpis-sub{grid-template-columns:repeat(2,minmax(0,1fr))}}",
|
|
1142
|
+
"@media (max-width:600px){.@-stats{padding-bottom:16px;gap:14px}.@-hist{height:130px}.@-kpi-v{font-size:22px}.@-kpi-lg .@-kpi-v{font-size:24px}.@-kpi-sm .@-kpi-v{font-size:18px}}",
|
|
1143
|
+
"@media (prefers-reduced-motion:reduce){.@-sk{animation:none}}",
|
|
1144
|
+
require_date_picker_styles()(prefix)
|
|
545
1145
|
].join("\n").replace(/@-/g, prefix + "-");
|
|
546
1146
|
}
|
|
547
1147
|
function makeCharts(prefix) {
|
|
@@ -595,11 +1195,31 @@ var require_charts = __commonJS({
|
|
|
595
1195
|
props.children
|
|
596
1196
|
);
|
|
597
1197
|
}
|
|
1198
|
+
function Section(props) {
|
|
1199
|
+
var body = props.children || [];
|
|
1200
|
+
var list = Array.isArray(body) ? body.filter(function(n) {
|
|
1201
|
+
return n !== null && n !== void 0 && n !== false;
|
|
1202
|
+
}) : body;
|
|
1203
|
+
if (Array.isArray(list) && !list.length) return null;
|
|
1204
|
+
return h(
|
|
1205
|
+
"section",
|
|
1206
|
+
{ className: prefix + "-sect", "aria-label": props.title },
|
|
1207
|
+
h(
|
|
1208
|
+
"div",
|
|
1209
|
+
{ className: prefix + "-sect-head" },
|
|
1210
|
+
h("h2", { className: prefix + "-sect-title" }, props.title),
|
|
1211
|
+
props.note ? h("span", { className: prefix + "-sect-note" }, props.note) : null,
|
|
1212
|
+
props.right ? h("span", { className: prefix + "-sect-note", style: { marginLeft: "auto" } }, props.right) : null
|
|
1213
|
+
),
|
|
1214
|
+
h("div", { className: prefix + "-sect-body" }, list)
|
|
1215
|
+
);
|
|
1216
|
+
}
|
|
598
1217
|
function Kpi(props) {
|
|
599
|
-
var tone = props.tone ? " " + prefix + "-" + props.tone : "";
|
|
1218
|
+
var tone = props.tone ? " " + prefix + "-kpi-tone-" + props.tone : "";
|
|
1219
|
+
var size = props.size === "lg" || props.size === "sm" ? " " + prefix + "-kpi-" + props.size : "";
|
|
600
1220
|
return h(
|
|
601
1221
|
"div",
|
|
602
|
-
{ className: prefix + "-kpi" + tone },
|
|
1222
|
+
{ className: prefix + "-kpi" + size + tone },
|
|
603
1223
|
h("div", { className: prefix + "-kpi-l" }, props.label),
|
|
604
1224
|
h(
|
|
605
1225
|
"div",
|
|
@@ -706,13 +1326,13 @@ var require_charts = __commonJS({
|
|
|
706
1326
|
var height = props.height || 200;
|
|
707
1327
|
var left = 30, right = 10, top = 12, bottom = 24;
|
|
708
1328
|
var pw = width - left - right, ph = height - top - bottom;
|
|
709
|
-
var
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
max =
|
|
1329
|
+
var ix = require_trend_interaction();
|
|
1330
|
+
var hiddenS = React.useState({});
|
|
1331
|
+
var activeS = React.useState(null);
|
|
1332
|
+
var hidden = hiddenS[0];
|
|
1333
|
+
var active = activeS[0];
|
|
1334
|
+
var visible = ix.visibleSeries(series, hidden);
|
|
1335
|
+
var max = ix.rangeMax(data, series, hidden);
|
|
716
1336
|
function x(i2) {
|
|
717
1337
|
return left + (data.length <= 1 ? pw / 2 : i2 / (data.length - 1) * pw);
|
|
718
1338
|
}
|
|
@@ -727,53 +1347,135 @@ var require_charts = __commonJS({
|
|
|
727
1347
|
for (var i = 0; i < data.length; i += step) labelIdx.push(i);
|
|
728
1348
|
if (labelIdx[labelIdx.length - 1] !== data.length - 1) labelIdx.push(data.length - 1);
|
|
729
1349
|
}
|
|
730
|
-
var aria =
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
1350
|
+
var aria = ix.summaryText(data, series, hidden, "\uFF0C");
|
|
1351
|
+
var band = data.length > 1 ? pw / (data.length - 1) : pw;
|
|
1352
|
+
function bandBox(i2) {
|
|
1353
|
+
var bx = Math.max(left, x(i2) - band / 2);
|
|
1354
|
+
return { x: bx, width: Math.max(1, Math.min(width - right, x(i2) + band / 2) - bx) };
|
|
1355
|
+
}
|
|
1356
|
+
var tipLeftPct = left / width * 100, tipWidthPct = pw / width * 100;
|
|
1357
|
+
var activeRow = active !== null && data[active] ? data[active] : null;
|
|
1358
|
+
var anchor = activeRow ? ix.tipAnchor((x(active) - left) / pw, tipLeftPct, tipWidthPct) : null;
|
|
1359
|
+
var tip = activeRow ? h(
|
|
1360
|
+
"div",
|
|
1361
|
+
{
|
|
1362
|
+
className: prefix + "-trend-tip",
|
|
1363
|
+
style: { left: anchor.left + "%", transform: ix.tipTransform(anchor.flip) }
|
|
1364
|
+
},
|
|
1365
|
+
h("b", { className: prefix + "-tip-day" }, String(activeRow.bucket)),
|
|
1366
|
+
ix.tipRows(data, series, hidden, active).map(function(r) {
|
|
1367
|
+
return h(
|
|
1368
|
+
"span",
|
|
1369
|
+
{ key: r.key, className: prefix + "-tip-row" },
|
|
1370
|
+
h("span", { className: prefix + "-dot", style: { background: r.color } }),
|
|
1371
|
+
h("span", { className: prefix + "-tip-name" }, r.label),
|
|
1372
|
+
h("b", null, num(props.lang, r.value))
|
|
1373
|
+
);
|
|
1374
|
+
})
|
|
1375
|
+
) : null;
|
|
735
1376
|
return h(
|
|
736
1377
|
"div",
|
|
737
|
-
|
|
1378
|
+
{ className: prefix + "-trend-wrap" },
|
|
738
1379
|
h(
|
|
739
|
-
"
|
|
740
|
-
{
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
1380
|
+
"div",
|
|
1381
|
+
{
|
|
1382
|
+
className: prefix + "-trend-box",
|
|
1383
|
+
role: "group",
|
|
1384
|
+
tabIndex: 0,
|
|
1385
|
+
"aria-label": props.aria || aria,
|
|
1386
|
+
onMouseLeave: function() {
|
|
1387
|
+
activeS[1](null);
|
|
1388
|
+
},
|
|
1389
|
+
onBlur: function() {
|
|
1390
|
+
activeS[1](null);
|
|
1391
|
+
},
|
|
1392
|
+
onKeyDown: function(e) {
|
|
1393
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
1394
|
+
e.preventDefault();
|
|
1395
|
+
activeS[1](ix.moveIndex(active, e.key === "ArrowRight" ? 1 : -1, data.length));
|
|
1396
|
+
} else if (e.key === "Escape") {
|
|
1397
|
+
activeS[1](null);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
h(
|
|
1402
|
+
"svg",
|
|
1403
|
+
{ className: prefix + "-trend", viewBox: "0 0 " + width + " " + height, "aria-hidden": "true" },
|
|
1404
|
+
ticks.map(function(v, i2) {
|
|
1405
|
+
return h(
|
|
1406
|
+
"g",
|
|
1407
|
+
{ key: "t" + i2 },
|
|
1408
|
+
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 - 5, y: y(v) + 3, textAnchor: "end", fontSize: 9, fill: "var(--dsw-alias-label-tertiary,#8f959e)" }, num(props.lang, v))
|
|
1410
|
+
);
|
|
1411
|
+
}),
|
|
1412
|
+
activeRow ? h("line", {
|
|
1413
|
+
className: prefix + "-trend-guide",
|
|
1414
|
+
x1: x(active),
|
|
1415
|
+
x2: x(active),
|
|
1416
|
+
y1: top,
|
|
1417
|
+
y2: top + ph,
|
|
1418
|
+
stroke: "var(--dsw-alias-border-l2,#c9cdd4)",
|
|
1419
|
+
strokeWidth: 1,
|
|
1420
|
+
strokeDasharray: "3 3"
|
|
1421
|
+
}) : null,
|
|
1422
|
+
visible.map(function(s, si) {
|
|
1423
|
+
var pts = data.map(function(d, i2) {
|
|
1424
|
+
return x(i2) + "," + y(d[s.key]);
|
|
1425
|
+
}).join(" ");
|
|
1426
|
+
return h(
|
|
1427
|
+
"g",
|
|
1428
|
+
{ key: s.key },
|
|
1429
|
+
h("polyline", { points: pts, fill: "none", stroke: s.color || COLORS[si % COLORS.length], strokeWidth: 2, strokeLinejoin: "round", strokeLinecap: "round" }),
|
|
1430
|
+
data.map(function(d, i2) {
|
|
1431
|
+
if (data.length > 40 && i2 % 3 !== 0 && i2 !== active) return null;
|
|
1432
|
+
return h("circle", { key: i2, cx: x(i2), cy: y(d[s.key]), r: i2 === active ? 4 : 2.4, fill: s.color || COLORS[si % COLORS.length] });
|
|
1433
|
+
})
|
|
1434
|
+
);
|
|
1435
|
+
}),
|
|
1436
|
+
labelIdx.map(function(i2) {
|
|
1437
|
+
var textAnchor = i2 === data.length - 1 ? "end" : "middle";
|
|
1438
|
+
return h("text", { key: "x" + i2, x: x(i2), y: height - 6, textAnchor, fontSize: 9, fill: "var(--dsw-alias-label-tertiary,#8f959e)" }, String(data[i2].bucket).slice(5));
|
|
1439
|
+
}),
|
|
1440
|
+
data.map(function(d, i2) {
|
|
1441
|
+
var box = bandBox(i2);
|
|
1442
|
+
return h("rect", {
|
|
1443
|
+
key: "h" + i2,
|
|
1444
|
+
x: box.x,
|
|
1445
|
+
y: top,
|
|
1446
|
+
width: box.width,
|
|
1447
|
+
height: ph + 8,
|
|
1448
|
+
fill: "transparent",
|
|
1449
|
+
style: { cursor: "crosshair" },
|
|
1450
|
+
onMouseEnter: function() {
|
|
1451
|
+
activeS[1](i2);
|
|
1452
|
+
},
|
|
1453
|
+
onTouchStart: function() {
|
|
1454
|
+
activeS[1](i2);
|
|
1455
|
+
}
|
|
1456
|
+
});
|
|
1457
|
+
})
|
|
1458
|
+
),
|
|
1459
|
+
tip
|
|
771
1460
|
),
|
|
772
1461
|
h("div", { className: prefix + "-tlegend" }, series.map(function(s, i2) {
|
|
1462
|
+
var on = ix.isVisible(hidden, s.key);
|
|
1463
|
+
var last = on && ix.visibleSeries(series, hidden).length <= 1;
|
|
773
1464
|
return h(
|
|
774
|
-
"
|
|
775
|
-
{
|
|
776
|
-
|
|
1465
|
+
"button",
|
|
1466
|
+
{
|
|
1467
|
+
key: s.key,
|
|
1468
|
+
type: "button",
|
|
1469
|
+
className: prefix + "-tlegend-item",
|
|
1470
|
+
"aria-pressed": on ? "true" : "false",
|
|
1471
|
+
disabled: last,
|
|
1472
|
+
title: last ? props.lang === "en" ? "At least one series stays visible" : "\u81F3\u5C11\u8981\u4FDD\u7559\u4E00\u6761\u66F2\u7EBF" : void 0,
|
|
1473
|
+
onClick: function() {
|
|
1474
|
+
var r = ix.toggle(hidden, series, s.key);
|
|
1475
|
+
if (!r.blocked) hiddenS[1](r.hidden);
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
h("span", { className: prefix + "-dot" + (on ? "" : " " + prefix + "-dot-off"), style: on ? { background: s.color || COLORS[i2 % COLORS.length] } : { borderColor: s.color || COLORS[i2 % COLORS.length] } }),
|
|
777
1479
|
s.label
|
|
778
1480
|
);
|
|
779
1481
|
}))
|
|
@@ -841,16 +1543,6 @@ var require_charts = __commonJS({
|
|
|
841
1543
|
var custom = props.custom || null;
|
|
842
1544
|
var from = custom && custom.from ? custom.from : "";
|
|
843
1545
|
var to = custom && custom.to ? custom.to : "";
|
|
844
|
-
function setDate(key, value, input) {
|
|
845
|
-
if (input && input.validity && input.validity.badInput) {
|
|
846
|
-
if (props.onInvalidInput) props.onInvalidInput();
|
|
847
|
-
return;
|
|
848
|
-
}
|
|
849
|
-
if (typeof props.onCustomChange !== "function") return;
|
|
850
|
-
var next = { from, to };
|
|
851
|
-
next[key] = value;
|
|
852
|
-
props.onCustomChange(next);
|
|
853
|
-
}
|
|
854
1546
|
return h(
|
|
855
1547
|
"div",
|
|
856
1548
|
{ className: prefix + "-stoolbar" },
|
|
@@ -868,28 +1560,18 @@ var require_charts = __commonJS({
|
|
|
868
1560
|
h(
|
|
869
1561
|
"div",
|
|
870
1562
|
{ className: prefix + "-range", role: "group", "aria-label": props.customAria || "\u81EA\u5B9A\u4E49\u65E5\u671F\u8303\u56F4" },
|
|
871
|
-
h(
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
onChange: function(e) {
|
|
879
|
-
setDate("from", e.target.value, e.target);
|
|
880
|
-
}
|
|
881
|
-
}),
|
|
882
|
-
h("span", { className: prefix + "-dash", "aria-hidden": "true" }, "\u2013"),
|
|
883
|
-
h("input", {
|
|
884
|
-
type: "date",
|
|
885
|
-
className: prefix + "-date",
|
|
886
|
-
value: to,
|
|
887
|
-
min: from || void 0,
|
|
1563
|
+
h(DP.RangePicker, {
|
|
1564
|
+
React,
|
|
1565
|
+
h,
|
|
1566
|
+
prefix,
|
|
1567
|
+
lang: props.lang,
|
|
1568
|
+
label: props.customAria || "\u81EA\u5B9A\u4E49\u65E5\u671F\u8303\u56F4",
|
|
1569
|
+
value: { from, to },
|
|
888
1570
|
max: props.today || void 0,
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
1571
|
+
clearable: false,
|
|
1572
|
+
onChange: function(next) {
|
|
1573
|
+
if (typeof props.onCustomChange !== "function") return;
|
|
1574
|
+
props.onCustomChange({ from: next.from, to: next.to });
|
|
893
1575
|
}
|
|
894
1576
|
}),
|
|
895
1577
|
from || to ? h("button", {
|
|
@@ -954,11 +1636,12 @@ var require_charts = __commonJS({
|
|
|
954
1636
|
function Warnings(props) {
|
|
955
1637
|
var items = props.items || [];
|
|
956
1638
|
if (!items.length) return null;
|
|
957
|
-
return h("div", { className: prefix + "-
|
|
1639
|
+
return h("div", { className: prefix + "-warnbar", role: "status" }, items.map(function(w) {
|
|
958
1640
|
return w.message;
|
|
959
1641
|
}).join("\uFF1B"));
|
|
960
1642
|
}
|
|
961
1643
|
return {
|
|
1644
|
+
Section,
|
|
962
1645
|
Card,
|
|
963
1646
|
Kpi,
|
|
964
1647
|
Donut,
|
|
@@ -1687,6 +2370,8 @@ var require_heatmap_styles = __commonJS({
|
|
|
1687
2370
|
"packages/addons/tasks/client/stats/heatmap-styles.cjs"(exports2, module2) {
|
|
1688
2371
|
module2.exports = [
|
|
1689
2372
|
".wbt-heatmap{",
|
|
2373
|
+
// 作为统计页「活动与趋势」分区的一员时占满一行;脱离栅格容器时该声明无副作用。
|
|
2374
|
+
"grid-column:span 12;",
|
|
1690
2375
|
"--hm-gap:3px;",
|
|
1691
2376
|
"--hm-hue-done:var(--wb-ok,#18a058);",
|
|
1692
2377
|
"--hm-hue-publish:var(--wbt-accent,var(--wb-accent,#11a89b));",
|
|
@@ -1949,7 +2634,7 @@ var require_today = __commonJS({
|
|
|
1949
2634
|
zh: { title: "\u4ECA\u65E5", published: "\u4ECA\u65E5\u53D1\u5E03", claimed: "\u4ECA\u65E5\u63A5\u53D6", done: "\u4ECA\u65E5\u5B8C\u6210", shutdown: "\u4ECA\u65E5\u5173\u95ED", average: "\u5E73\u5747\u96BE\u5EA6", sample: "\u6837\u672C\u6570", noSample: "\u65E0\u6837\u672C", clock: "\u4EE5\u670D\u52A1\u7AEF\u5F53\u524D\u65F6\u95F4\u4E3A\u51C6" },
|
|
1950
2635
|
en: { title: "Today", published: "Published today", claimed: "Claimed today", done: "Completed today", shutdown: "Closed today", average: "Avg difficulty", sample: "samples", noSample: "No samples", clock: "Based on the server's current time" }
|
|
1951
2636
|
};
|
|
1952
|
-
var css = ".wbt-today{margin:12px 0}";
|
|
2637
|
+
var css = ".wbt-today{margin:12px 0;grid-column:span 12}";
|
|
1953
2638
|
function Today(props) {
|
|
1954
2639
|
var data = props.today;
|
|
1955
2640
|
if (!data || typeof data !== "object") return null;
|
|
@@ -2305,6 +2990,18 @@ var require_stats = __commonJS({
|
|
|
2305
2990
|
range90: "\u8FD1 90 \u5929",
|
|
2306
2991
|
range365: "\u8FD1 1 \u5E74",
|
|
2307
2992
|
rangeAll: "\u5168\u90E8",
|
|
2993
|
+
secToday: "\u4ECA\u65E5",
|
|
2994
|
+
secTodayNote: "\u670D\u52A1\u7AEF\u5F53\u65E5\u5FEB\u7167\uFF0C\u4E0D\u968F\u4E0A\u65B9\u65F6\u95F4\u8303\u56F4\u53D8\u5316",
|
|
2995
|
+
secHealth: "\u603B\u4F53\u5065\u5EB7\u5EA6",
|
|
2996
|
+
secHealthNote: "\u5B58\u91CF\u53E3\u5F84\uFF1B\u300C\u8303\u56F4\u5185\u300D\u4E24\u9879\u8DDF\u968F\u65F6\u95F4\u8303\u56F4",
|
|
2997
|
+
secActivity: "\u6D3B\u52A8\u4E0E\u8D8B\u52BF",
|
|
2998
|
+
secActivityNote: "\u4E8B\u4EF6\u8D8B\u52BF\u8DDF\u968F\u65F6\u95F4\u8303\u56F4\uFF0C\u5E74\u5EA6\u6D3B\u52A8\u8986\u76D6\u6574\u5E74",
|
|
2999
|
+
secDist: "\u5206\u5E03",
|
|
3000
|
+
secDistNote: "\u5F53\u524D\u5B58\u91CF\u7ED3\u6784\uFF0C\u70B9\u67F1\u5F62\u53EF\u4E0B\u94BB\u5230\u8BB0\u5F55\u9875",
|
|
3001
|
+
secRisk: "\u98CE\u9669",
|
|
3002
|
+
secRiskNote: "\u5F53\u524D\u5B58\u91CF\uFF1B\u8D26\u9F84\u4E0E\u6E05\u5355\u540C\u4E00\u53E3\u5F84",
|
|
3003
|
+
secRank: "\u6392\u884C",
|
|
3004
|
+
secRankNote: "\u6309\u4EFB\u52A1\u8868 / \u4EFB\u52A1\u7EC4 / \u5DE5\u4F5C\u533A\u805A\u5408",
|
|
2308
3005
|
refresh: "\u5237\u65B0",
|
|
2309
3006
|
asOf: "\u622A\u81F3",
|
|
2310
3007
|
retry: "\u91CD\u8BD5",
|
|
@@ -2328,8 +3025,6 @@ var require_stats = __commonJS({
|
|
|
2328
3025
|
inRange: "\u8303\u56F4\u5185",
|
|
2329
3026
|
ofTotal: "\u5360\u603B\u91CF",
|
|
2330
3027
|
ofActive: "\u5360\u5DF2\u5F00\u542F",
|
|
2331
|
-
trend: "\u65B0\u589E / \u5B8C\u6210 / \u5230\u671F\u8D8B\u52BF",
|
|
2332
|
-
trendNote: "\u6309\u81EA\u7136\u65E5 / \u5468 / \u6708\u5206\u6876",
|
|
2333
3028
|
eventTrend: "\u4E8B\u4EF6\u8D8B\u52BF",
|
|
2334
3029
|
eventTrendNote: "\u4E0E\u5E74\u5EA6\u6D3B\u52A8\u540C\u53E3\u5F84\uFF1B\u6309\u65E5 / \u5468 / \u6708\u5206\u6876\uFF0C\u76EE\u6807\u6309\u8BA1\u5212\u5B8C\u6210\u65E5\u671F\u7EDF\u8BA1",
|
|
2335
3030
|
publish: "\u53D1\u5E03",
|
|
@@ -2409,6 +3104,18 @@ var require_stats = __commonJS({
|
|
|
2409
3104
|
range90: "90 days",
|
|
2410
3105
|
range365: "1 year",
|
|
2411
3106
|
rangeAll: "All",
|
|
3107
|
+
secToday: "Today",
|
|
3108
|
+
secTodayNote: "Server-side snapshot for today; the range above does not affect it",
|
|
3109
|
+
secHealth: "Health",
|
|
3110
|
+
secHealthNote: "Current stock; the two in-range figures follow the range above",
|
|
3111
|
+
secActivity: "Activity & trend",
|
|
3112
|
+
secActivityNote: "The event trend follows the range; annual activity covers the whole year",
|
|
3113
|
+
secDist: "Distribution",
|
|
3114
|
+
secDistNote: "Current stock; click a bar to list matching tasks",
|
|
3115
|
+
secRisk: "Risk",
|
|
3116
|
+
secRiskNote: "Current stock; aging and the overdue list share one scope",
|
|
3117
|
+
secRank: "Rankings",
|
|
3118
|
+
secRankNote: "Grouped by task table / group / workspace",
|
|
2412
3119
|
refresh: "Refresh",
|
|
2413
3120
|
asOf: "As of",
|
|
2414
3121
|
retry: "Retry",
|
|
@@ -2432,8 +3139,6 @@ var require_stats = __commonJS({
|
|
|
2432
3139
|
inRange: "In range",
|
|
2433
3140
|
ofTotal: "of total",
|
|
2434
3141
|
ofActive: "of active",
|
|
2435
|
-
trend: "Created / done / due trend",
|
|
2436
|
-
trendNote: "Bucketed by day / week / month",
|
|
2437
3142
|
eventTrend: "Event trend",
|
|
2438
3143
|
eventTrendNote: "Same scope as annual activity; bucketed by day / week / month, target by planned date",
|
|
2439
3144
|
publish: "Published",
|
|
@@ -2672,57 +3377,68 @@ var require_stats = __commonJS({
|
|
|
2672
3377
|
return { key, label: t["range" + (key === "all" ? "All" : key.replace("d", ""))] };
|
|
2673
3378
|
});
|
|
2674
3379
|
var children = [];
|
|
3380
|
+
var totals = data ? data.totals || {} : {};
|
|
3381
|
+
var rates = data ? data.rates || {} : {};
|
|
3382
|
+
var b = data ? data.breakdowns || {} : {};
|
|
2675
3383
|
if (!data && loading) children.push(h(ch.Skeleton, { key: "sk" }));
|
|
2676
3384
|
if (!data && !loading && err) {
|
|
2677
3385
|
children.push(h(ch.Card, { key: "err", span: 12 }, h(ch.Empty, { text: t.loadFail })));
|
|
2678
3386
|
}
|
|
2679
3387
|
if (data) {
|
|
2680
|
-
var totals = data.totals || {};
|
|
2681
|
-
var rates = data.rates || {};
|
|
2682
|
-
var b = data.breakdowns || {};
|
|
2683
3388
|
children.push(h(
|
|
2684
|
-
|
|
2685
|
-
{ key: "
|
|
2686
|
-
h(
|
|
2687
|
-
h(ch.Kpi, { label: t.active, value: totals.active, hint: t.ofTotal + " " + ch.pct(totals.total ? totals.active / totals.total : 0), lang }),
|
|
2688
|
-
h(ch.Kpi, { label: t.overdue, value: totals.overdue, hint: t.ofActive + " " + ch.pct(rates.overdue), tone: totals.overdue > 0 ? "danger" : "", lang }),
|
|
2689
|
-
h(ch.Kpi, { label: t.completion, value: ch.pct(rates.completion), hint: totals.done + " / " + totals.total, tone: "ok", lang }),
|
|
2690
|
-
h(ch.Kpi, { label: t.dueToday, value: totals.dueToday, hint: t.current, tone: totals.dueToday > 0 ? "warn" : "", lang }),
|
|
2691
|
-
h(ch.Kpi, { label: t.dueNext7, value: totals.dueNext7, hint: t.current, lang }),
|
|
2692
|
-
h(ch.Kpi, { label: t.newInRange, value: totals.newInRange, hint: t.inRange, lang }),
|
|
2693
|
-
h(ch.Kpi, { label: t.avgCycle, value: rates.avgCycleDays === null || rates.avgCycleDays === void 0 ? "\u2014" : rates.avgCycleDays, unit: t.days, hint: t.inRange, lang })
|
|
3389
|
+
ch.Section,
|
|
3390
|
+
{ key: "today", title: t.secToday, note: t.secTodayNote },
|
|
3391
|
+
data.today ? h(Today, { today: data.today, lang }) : null
|
|
2694
3392
|
));
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
}
|
|
2698
|
-
|
|
3393
|
+
}
|
|
3394
|
+
if (data && totals.total === 0) {
|
|
3395
|
+
children.push(h(ch.Card, { key: "empty", span: 12 }, h(ch.Empty, { text: t.noData })));
|
|
3396
|
+
}
|
|
3397
|
+
if (data && totals.total > 0) {
|
|
3398
|
+
if (cfg["stats.showKpi"] !== false) {
|
|
3399
|
+
children.push(h(ch.Section, { key: "health", title: t.secHealth, note: t.secHealthNote }, [
|
|
3400
|
+
h(
|
|
3401
|
+
"div",
|
|
3402
|
+
{ key: "kpiMain", className: "wbt-kpis wbt-kpis-main" },
|
|
3403
|
+
h(ch.Kpi, { label: t.total, value: totals.total, hint: t.current, size: "lg", lang }),
|
|
3404
|
+
h(ch.Kpi, { label: t.active, value: totals.active, hint: t.ofTotal + " " + ch.pct(totals.total ? totals.active / totals.total : 0), size: "lg", lang }),
|
|
3405
|
+
h(ch.Kpi, { label: t.overdue, value: totals.overdue, hint: t.ofActive + " " + ch.pct(rates.overdue), tone: totals.overdue > 0 ? "danger" : "", size: "lg", lang }),
|
|
3406
|
+
h(ch.Kpi, { label: t.completion, value: ch.pct(rates.completion), hint: totals.done + " / " + totals.total, tone: "ok", size: "lg", lang })
|
|
3407
|
+
),
|
|
3408
|
+
h(
|
|
3409
|
+
"div",
|
|
3410
|
+
{ key: "kpiSub", className: "wbt-kpis wbt-kpis-sub" },
|
|
3411
|
+
h(ch.Kpi, { label: t.dueToday, value: totals.dueToday, hint: t.current, tone: totals.dueToday > 0 ? "warn" : "", size: "sm", lang }),
|
|
3412
|
+
h(ch.Kpi, { label: t.dueNext7, value: totals.dueNext7, hint: t.current, size: "sm", lang }),
|
|
3413
|
+
h(ch.Kpi, { label: t.newInRange, value: totals.newInRange, hint: t.inRange, size: "sm", lang }),
|
|
3414
|
+
h(ch.Kpi, { label: t.avgCycle, value: rates.avgCycleDays === null || rates.avgCycleDays === void 0 ? "\u2014" : rates.avgCycleDays, unit: t.days, hint: t.inRange, size: "sm", lang })
|
|
3415
|
+
)
|
|
3416
|
+
]));
|
|
3417
|
+
}
|
|
3418
|
+
var activity = [];
|
|
3419
|
+
if (sectionOn("eventTrend")) {
|
|
3420
|
+
activity.push(h(
|
|
2699
3421
|
ch.Card,
|
|
2700
3422
|
{ key: "eventTrend", span: 12, title: t.eventTrend, note: t.eventTrendNote },
|
|
2701
3423
|
h(ch.Trend, {
|
|
2702
3424
|
data: data.eventTrend || [],
|
|
2703
3425
|
lang,
|
|
3426
|
+
// 顺序按用户要求:发布 → 目标 → 接取 → 关闭 → 完成;
|
|
3427
|
+
// 颜色跟着含义走不跟着位置走(换序不换色),否则读者要重新认一遍颜色。
|
|
2704
3428
|
series: [
|
|
2705
3429
|
{ key: "publish", label: t.publish, color: ch.colors[0] },
|
|
2706
3430
|
{ key: "target", label: t.target, color: ch.colors[5] },
|
|
2707
|
-
{ key: "
|
|
3431
|
+
{ key: "claimed", label: t.evClaimed, color: ch.colors[2] },
|
|
2708
3432
|
{ key: "shutdown", label: t.evShutdown, color: ch.colors[3] },
|
|
2709
|
-
{ key: "
|
|
2710
|
-
]
|
|
2711
|
-
})
|
|
2712
|
-
));
|
|
2713
|
-
children.push(h(
|
|
2714
|
-
ch.Card,
|
|
2715
|
-
{ key: "trend", span: 8, title: t.trend, note: t.trendNote },
|
|
2716
|
-
h(ch.Trend, {
|
|
2717
|
-
data: data.trend || [],
|
|
2718
|
-
lang,
|
|
2719
|
-
series: [
|
|
2720
|
-
{ key: "created", label: t.created, color: ch.colors[0] },
|
|
2721
|
-
{ key: "done", label: t.done, color: ch.colors[1] },
|
|
2722
|
-
{ key: "due", label: t.due, color: ch.colors[2] }
|
|
3433
|
+
{ key: "done", label: t.done, color: ch.colors[1] }
|
|
2723
3434
|
]
|
|
2724
3435
|
})
|
|
2725
3436
|
));
|
|
3437
|
+
}
|
|
3438
|
+
activity.push(h(Heatmap, { key: "heatmap", api, lang, active: props.active, onNavigate: props.onNavigate }));
|
|
3439
|
+
children.push(h(ch.Section, { key: "activity", title: t.secActivity, note: t.secActivityNote }, activity));
|
|
3440
|
+
var dist = [];
|
|
3441
|
+
if (sectionOn("status")) {
|
|
2726
3442
|
var statusData = (b.status || []).filter(function(s) {
|
|
2727
3443
|
return Object.prototype.hasOwnProperty.call(ch.statusColors, s.key);
|
|
2728
3444
|
}).map(function(s) {
|
|
@@ -2731,7 +3447,7 @@ var require_stats = __commonJS({
|
|
|
2731
3447
|
var statusTotal = statusData.reduce(function(sum, s) {
|
|
2732
3448
|
return sum + Number(s.count || 0);
|
|
2733
3449
|
}, 0);
|
|
2734
|
-
|
|
3450
|
+
dist.push(h(
|
|
2735
3451
|
ch.Card,
|
|
2736
3452
|
{ key: "status", span: 4, title: t.status, note: t.statusNote },
|
|
2737
3453
|
h(ch.Donut, {
|
|
@@ -2744,20 +3460,24 @@ var require_stats = __commonJS({
|
|
|
2744
3460
|
}).join("; ")
|
|
2745
3461
|
})
|
|
2746
3462
|
));
|
|
2747
|
-
|
|
3463
|
+
}
|
|
3464
|
+
if (sectionOn("priority")) {
|
|
3465
|
+
dist.push(h(
|
|
2748
3466
|
ch.Card,
|
|
2749
|
-
{ key: "priority", span:
|
|
3467
|
+
{ key: "priority", span: 4, title: t.priority, note: t.priorityNote },
|
|
2750
3468
|
h(ch.Histogram, { data: visibleBins(b.priority), lang, color: ch.colors[0], onSelect: priorityPicker(props.onNavigate), selectHint: lang === "en" ? "click to list" : "\u70B9\u51FB\u67E5\u770B\u4EFB\u52A1" })
|
|
2751
3469
|
));
|
|
3470
|
+
}
|
|
3471
|
+
if (sectionOn("difficulty")) {
|
|
2752
3472
|
var missingBin = (b.difficulty || []).find(function(bin) {
|
|
2753
3473
|
return bin.key === "unset";
|
|
2754
3474
|
});
|
|
2755
3475
|
var dims = [["all", t.dimAll], ["done", t.dimDone], ["publish", t.dimPublish], ["claimed", t.dimClaimed], ["shutdown", t.dimShutdown]];
|
|
2756
3476
|
var rangeBox = data.range || {};
|
|
2757
3477
|
var diffNote = dimension === "all" ? t.difficultyNote : t.difficultyNoteRange.replace("{from}", String(rangeBox.from || "")).replace("{to}", String(rangeBox.to || ""));
|
|
2758
|
-
|
|
3478
|
+
dist.push(h(
|
|
2759
3479
|
ch.Card,
|
|
2760
|
-
{ key: "difficulty", span:
|
|
3480
|
+
{ key: "difficulty", span: 4, title: t.difficulty, note: diffNote },
|
|
2761
3481
|
h(
|
|
2762
3482
|
"div",
|
|
2763
3483
|
{ className: "wbt-dims", role: "tablist", "aria-label": t.difficultyDimension },
|
|
@@ -2787,12 +3507,18 @@ var require_stats = __commonJS({
|
|
|
2787
3507
|
} }, t.difficultyMissingLink) : null
|
|
2788
3508
|
)
|
|
2789
3509
|
));
|
|
2790
|
-
|
|
3510
|
+
}
|
|
3511
|
+
children.push(h(ch.Section, { key: "distribution", title: t.secDist, note: t.secDistNote }, dist));
|
|
3512
|
+
var risk = [];
|
|
3513
|
+
if (sectionOn("aging")) {
|
|
3514
|
+
risk.push(h(
|
|
2791
3515
|
ch.Card,
|
|
2792
3516
|
{ key: "aging", span: 6, title: t.aging, note: t.agingNote },
|
|
2793
3517
|
h(ch.Histogram, { data: data.aging || [], lang, color: ch.colors[2] })
|
|
2794
3518
|
));
|
|
2795
|
-
|
|
3519
|
+
}
|
|
3520
|
+
if (sectionOn("overdue")) {
|
|
3521
|
+
risk.push(h(
|
|
2796
3522
|
ch.Card,
|
|
2797
3523
|
{ key: "overdue", span: 6, title: t.overdueList, note: t.overdueNote },
|
|
2798
3524
|
h(ch.DataTable, listProps(data, "overdue", lang, {
|
|
@@ -2806,7 +3532,11 @@ var require_stats = __commonJS({
|
|
|
2806
3532
|
]
|
|
2807
3533
|
}))
|
|
2808
3534
|
));
|
|
2809
|
-
|
|
3535
|
+
}
|
|
3536
|
+
children.push(h(ch.Section, { key: "risk", title: t.secRisk, note: t.secRiskNote }, risk));
|
|
3537
|
+
var rank = [];
|
|
3538
|
+
if (sectionOn("tables")) {
|
|
3539
|
+
rank.push(h(
|
|
2810
3540
|
ch.Card,
|
|
2811
3541
|
{ key: "tables", span: 6, title: t.tables, note: t.tablesNote },
|
|
2812
3542
|
h(ch.DataTable, {
|
|
@@ -2823,7 +3553,9 @@ var require_stats = __commonJS({
|
|
|
2823
3553
|
]
|
|
2824
3554
|
})
|
|
2825
3555
|
));
|
|
2826
|
-
|
|
3556
|
+
}
|
|
3557
|
+
if (sectionOn("groups")) {
|
|
3558
|
+
rank.push(h(
|
|
2827
3559
|
ch.Card,
|
|
2828
3560
|
{ key: "groups", span: 6, title: t.groups, note: t.groupsNote },
|
|
2829
3561
|
h(ch.DataTable, {
|
|
@@ -2840,14 +3572,16 @@ var require_stats = __commonJS({
|
|
|
2840
3572
|
]
|
|
2841
3573
|
})
|
|
2842
3574
|
));
|
|
3575
|
+
}
|
|
3576
|
+
if (sectionOn("workspaces")) {
|
|
2843
3577
|
var wsRows = (data.rankings && data.rankings.workspaces || []).slice();
|
|
2844
3578
|
var noneRow = data.rankings && data.rankings.noWorkspace;
|
|
2845
3579
|
if (noneRow && (wsRows.length || noneRow.total > 0)) {
|
|
2846
3580
|
wsRows.push(Object.assign({}, noneRow, { title: t.noWorkspaceRow }));
|
|
2847
3581
|
}
|
|
2848
|
-
|
|
3582
|
+
rank.push(h(
|
|
2849
3583
|
ch.Card,
|
|
2850
|
-
{ key: "workspaces", span:
|
|
3584
|
+
{ key: "workspaces", span: 12, title: t.workspaces, note: t.workspacesNote },
|
|
2851
3585
|
h(ch.DataTable, {
|
|
2852
3586
|
rows: wsRows,
|
|
2853
3587
|
lang,
|
|
@@ -2863,7 +3597,12 @@ var require_stats = __commonJS({
|
|
|
2863
3597
|
]
|
|
2864
3598
|
})
|
|
2865
3599
|
));
|
|
3600
|
+
}
|
|
3601
|
+
children.push(h(ch.Section, { key: "rank", title: t.secRank, note: t.secRankNote }, rank));
|
|
3602
|
+
if (sectionOn("timeline")) {
|
|
2866
3603
|
children.push(h(TimelineSection, { key: "timeline", api, lang, active: props.active, ch }));
|
|
3604
|
+
}
|
|
3605
|
+
if (sectionOn("recent")) {
|
|
2867
3606
|
var recentCols = recentColumns(t, lang, props.onNavigate);
|
|
2868
3607
|
var recentTabs = [
|
|
2869
3608
|
["publish", t.recentTabPublish, "recentPublish", t.noRecentPublish],
|
|
@@ -2897,19 +3636,11 @@ var require_stats = __commonJS({
|
|
|
2897
3636
|
h(ch.DataTable, listProps(data, recentTab[2], lang, { lang, empty: recentTab[3], columns: recentCols }))
|
|
2898
3637
|
));
|
|
2899
3638
|
}
|
|
2900
|
-
children.push(h(ch.Warnings, { key: "warn", items: data.warnings || [] }));
|
|
2901
3639
|
}
|
|
2902
|
-
|
|
2903
|
-
var k = node && node.key;
|
|
2904
|
-
if (!k || k === "sk" || k === "err" || k === "warn" || k === "empty") return true;
|
|
2905
|
-
if (k === "kpi") return cfg["stats.showKpi"] !== false;
|
|
2906
|
-
return sectionOn(k);
|
|
2907
|
-
});
|
|
3640
|
+
if (data) children.push(h(ch.Warnings, { key: "warn", items: data.warnings || [] }));
|
|
2908
3641
|
return h(
|
|
2909
3642
|
"div",
|
|
2910
3643
|
{ className: "wbt-stats" },
|
|
2911
|
-
h(Today, { today: data && data.today, lang }),
|
|
2912
|
-
h(Heatmap, { api, lang, active: props.active, onNavigate: props.onNavigate }),
|
|
2913
3644
|
h(ch.RangeSwitch, {
|
|
2914
3645
|
options,
|
|
2915
3646
|
value: customFrom || customTo ? null : range,
|
|
@@ -4061,8 +4792,21 @@ var require_action_schema_style = __commonJS({
|
|
|
4061
4792
|
"." + P + " select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
|
|
4062
4793
|
"." + P + "-list{display:flex;flex-direction:column;gap:8px}",
|
|
4063
4794
|
"." + P + "-card{border:1px solid var(--wb-border,#e3e5e9);border-radius:10px;padding:10px 12px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));display:flex;flex-direction:column;gap:8px;min-width:0}",
|
|
4064
|
-
"." + P + "-cardhead{display:
|
|
4065
|
-
"." + P + "-
|
|
4795
|
+
"." + P + "-cardhead{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:8px}",
|
|
4796
|
+
"." + P + "-cardmeta{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0;min-height:24px}",
|
|
4797
|
+
"." + P + "-cardhead code{font-weight:640;overflow-wrap:anywhere;min-width:0}",
|
|
4798
|
+
"." + P + "-hintline{margin:0;color:var(--dsw-alias-label-tertiary,inherit);font-size:11.5px;line-height:1.5}",
|
|
4799
|
+
"." + P + "-toggle{display:inline-flex;align-items:center;gap:6px;min-height:24px;padding:0 2px;border:0;background:transparent;font:inherit;font-size:11.5px;color:var(--wb-muted);cursor:pointer}",
|
|
4800
|
+
"." + P + "-track{display:inline-flex;align-items:center;box-sizing:border-box;width:30px;height:18px;padding:2px;border:1px solid var(--wb-muted);border-radius:999px;background:var(--wb-surface);color:var(--wb-muted)}",
|
|
4801
|
+
"." + P + "-track::before{content:'';width:12px;height:12px;border-radius:50%;background:currentColor;transition:transform .15s ease}",
|
|
4802
|
+
"." + P + "-toggle[aria-checked=true] ." + P + "-track{background:var(--wb-accent);border-color:var(--wb-accent);color:var(--wb-card)}",
|
|
4803
|
+
"." + P + "-toggle[aria-checked=true] ." + P + "-track::before{transform:translateX(12px)}",
|
|
4804
|
+
"." + P + "-toggle:hover:not(:disabled) ." + P + "-track{outline:1px solid var(--wb-accent)}",
|
|
4805
|
+
"." + P + "-toggle:focus-visible{outline:2px solid var(--wb-accent);outline-offset:2px}",
|
|
4806
|
+
"." + P + "-toggle:disabled{opacity:.6;cursor:progress}",
|
|
4807
|
+
"@media(prefers-reduced-motion:reduce){." + P + "-track::before{transition:none}}",
|
|
4808
|
+
// 安全约束(不可放开):用警示色描边,和可切换的开关区分开。
|
|
4809
|
+
"." + P + "-locked{border-color:var(--wb-warn,#b7791f);color:var(--wb-warn,#b7791f)}",
|
|
4066
4810
|
"." + P + "-desc{margin:0;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55;font-size:12.5px}",
|
|
4067
4811
|
// 搜索命中:用品牌色透明度叠加而不是写死浅色,深浅主题都可读;继承文字颜色、不覆盖 ::selection。
|
|
4068
4812
|
"." + P + " mark." + P + "-hit{background:color-mix(in oklab,var(--dsw-alias-brand-primary,#4f6ef7) 22%,transparent);color:inherit;border-radius:2px;padding:0;font:inherit;box-decoration-break:clone;-webkit-box-decoration-break:clone}",
|
|
@@ -4114,6 +4858,15 @@ var require_action_schema_view = __commonJS({
|
|
|
4114
4858
|
zh: {
|
|
4115
4859
|
title: "Action",
|
|
4116
4860
|
hint: "\u8FD0\u884C\u65F6\u6CE8\u518C \xB7 \u53EA\u8BFB",
|
|
4861
|
+
switchHint: "agent \u5F00\u5173\u843D\u672C\u673A\u3001\u5373\u6539\u5373\u751F\u6548\uFF1B\u754C\u9762\u64CD\u4F5C\u4E0D\u53D7\u5F71\u54CD\u3002",
|
|
4862
|
+
hostHint: "\u5BBF\u4E3B action \u7684 agent \u5F00\u5173\uFF1B\u6807\u300C\u4EC5\u754C\u9762 \xB7 \u5B89\u5168\u7EA6\u675F\u300D\u7684\u4E0D\u53EF\u653E\u5F00\u3002",
|
|
4863
|
+
agentSwitch: "agent \u53EF\u7528",
|
|
4864
|
+
agentLocked: "\u4EC5\u754C\u9762 \xB7 \u5B89\u5168\u7EA6\u675F",
|
|
4865
|
+
agentLockedHint: "\u8BE5 action \u53EA\u80FD\u5728\u754C\u9762\u6267\u884C\uFF08\u5B89\u5168\u7EA6\u675F\uFF09\uFF0Cagent \u5F00\u5173\u4E0D\u53EF\u653E\u5F00",
|
|
4866
|
+
agentSaving: "\u4FDD\u5B58\u4E2D\u2026",
|
|
4867
|
+
agentOnToast: "\u5DF2\u5141\u8BB8 agent \u8C03\u7528",
|
|
4868
|
+
agentOffToast: "\u5DF2\u7981\u6B62 agent \u8C03\u7528",
|
|
4869
|
+
agentFail: "\u5207\u6362 agent \u5F00\u5173\u5931\u8D25",
|
|
4117
4870
|
domain: "\u57DF",
|
|
4118
4871
|
versionLabel: "\u7248\u672C",
|
|
4119
4872
|
shell: "\u5BBF\u4E3B",
|
|
@@ -4159,6 +4912,15 @@ var require_action_schema_view = __commonJS({
|
|
|
4159
4912
|
en: {
|
|
4160
4913
|
title: "Actions",
|
|
4161
4914
|
hint: "runtime registry \xB7 read-only",
|
|
4915
|
+
switchHint: "The agent switch is stored locally and applies immediately; UI actions are unaffected.",
|
|
4916
|
+
hostHint: "Agent switch for host actions; items marked UI-only (security) cannot be opened up.",
|
|
4917
|
+
agentSwitch: "Agent callable",
|
|
4918
|
+
agentLocked: "UI only \xB7 security",
|
|
4919
|
+
agentLockedHint: "This action can only run from the UI (security constraint); the agent switch cannot be opened",
|
|
4920
|
+
agentSaving: "Saving\u2026",
|
|
4921
|
+
agentOnToast: "Agent calls allowed",
|
|
4922
|
+
agentOffToast: "Agent calls blocked",
|
|
4923
|
+
agentFail: "Failed to change the agent switch",
|
|
4162
4924
|
domain: "Domain",
|
|
4163
4925
|
versionLabel: "Version",
|
|
4164
4926
|
shell: "Host",
|
|
@@ -4271,7 +5033,9 @@ var require_action_schema_view = __commonJS({
|
|
|
4271
5033
|
}
|
|
4272
5034
|
module2.exports = function createActionSchemaView(options) {
|
|
4273
5035
|
var raw = String(options.domain || "");
|
|
4274
|
-
var
|
|
5036
|
+
var SOURCE = options.source === "actions.list" ? "actions.list" : "actionSchema";
|
|
5037
|
+
var DOMAIN = SOURCE === "actions.list" ? raw : raw.indexOf("wb-addon-") === 0 ? raw : "wb-addon-" + raw;
|
|
5038
|
+
var LIST_DOMAIN = options.listDomain ? String(options.listDomain) : DOMAIN;
|
|
4275
5039
|
var prefix = options.prefix;
|
|
4276
5040
|
var P = prefix + "-as";
|
|
4277
5041
|
var Icon2 = options.Icon || null;
|
|
@@ -4315,6 +5079,8 @@ var require_action_schema_view = __commonJS({
|
|
|
4315
5079
|
var typePick = typeState[0], setTypePick = typeState[1];
|
|
4316
5080
|
var toastState = React.useState("");
|
|
4317
5081
|
var toast = toastState[0], setToast = toastState[1];
|
|
5082
|
+
var savingState = React.useState("");
|
|
5083
|
+
var saving = savingState[0], setSaving = savingState[1];
|
|
4318
5084
|
React.useEffect(function() {
|
|
4319
5085
|
injectCss();
|
|
4320
5086
|
}, []);
|
|
@@ -4323,9 +5089,10 @@ var require_action_schema_view = __commonJS({
|
|
|
4323
5089
|
setLoading(true);
|
|
4324
5090
|
setErr("");
|
|
4325
5091
|
var pending;
|
|
4326
|
-
var actionName = DOMAIN.replace(/^wb-addon-/, "") + ".actionSchema";
|
|
5092
|
+
var actionName = SOURCE === "actions.list" ? "actions.list" : DOMAIN.replace(/^wb-addon-/, "") + ".actionSchema";
|
|
5093
|
+
var callArgs = SOURCE === "actions.list" ? { detail: true, domain: LIST_DOMAIN } : void 0;
|
|
4327
5094
|
if (api && typeof api.call === "function") {
|
|
4328
|
-
pending = Promise.resolve(api.call(actionName)).then(function(r) {
|
|
5095
|
+
pending = Promise.resolve(api.call(actionName, callArgs)).then(function(r) {
|
|
4329
5096
|
if (r && r.ok === false) return r;
|
|
4330
5097
|
return r && r.result || r;
|
|
4331
5098
|
});
|
|
@@ -4365,6 +5132,39 @@ var require_action_schema_view = __commonJS({
|
|
|
4365
5132
|
plainCopy(text);
|
|
4366
5133
|
done();
|
|
4367
5134
|
}
|
|
5135
|
+
function setAgent(action, next) {
|
|
5136
|
+
var name = action.name;
|
|
5137
|
+
setSaving(name);
|
|
5138
|
+
setToast("");
|
|
5139
|
+
var fail = function(e) {
|
|
5140
|
+
setSaving("");
|
|
5141
|
+
setToast(t.agentFail + "\uFF1A" + String(e && e.message || e || ""));
|
|
5142
|
+
};
|
|
5143
|
+
var done = function(r) {
|
|
5144
|
+
setSaving("");
|
|
5145
|
+
var payload = r && typeof r === "object" && Object.prototype.hasOwnProperty.call(r, "result") ? r.result : r;
|
|
5146
|
+
if (r && r.ok === false) {
|
|
5147
|
+
setToast(t.agentFail + "\uFF1A" + String(r.error || r.text || ""));
|
|
5148
|
+
return;
|
|
5149
|
+
}
|
|
5150
|
+
var value = payload && typeof payload.agentEnabled === "boolean" ? payload.agentEnabled : next;
|
|
5151
|
+
setSnap(function(prev) {
|
|
5152
|
+
if (!prev || !Array.isArray(prev.actions)) return prev;
|
|
5153
|
+
return Object.assign({}, prev, {
|
|
5154
|
+
actions: prev.actions.map(function(a) {
|
|
5155
|
+
if (!a || a.name !== name) return a;
|
|
5156
|
+
return Object.assign({}, a, { agentEnabled: value });
|
|
5157
|
+
})
|
|
5158
|
+
});
|
|
5159
|
+
});
|
|
5160
|
+
setToast(value ? t.agentOnToast : t.agentOffToast);
|
|
5161
|
+
};
|
|
5162
|
+
if (!api || typeof api.call !== "function") {
|
|
5163
|
+
fail(new Error("no call api"));
|
|
5164
|
+
return;
|
|
5165
|
+
}
|
|
5166
|
+
Promise.resolve(api.call("actions.setAgentAccess", { action: name, agentEnabled: next })).then(done, fail);
|
|
5167
|
+
}
|
|
4368
5168
|
var all = snap && Array.isArray(snap.actions) ? snap.actions.filter(function(a) {
|
|
4369
5169
|
return a && a.domain === DOMAIN;
|
|
4370
5170
|
}) : [];
|
|
@@ -4413,6 +5213,35 @@ var require_action_schema_view = __commonJS({
|
|
|
4413
5213
|
h("td", null, Highlight.hit(row.description, kw))
|
|
4414
5214
|
);
|
|
4415
5215
|
}
|
|
5216
|
+
function agentSwitch(action) {
|
|
5217
|
+
if (action.agentLocked === true) {
|
|
5218
|
+
return h("span", {
|
|
5219
|
+
className: P + "-badge " + P + "-locked",
|
|
5220
|
+
title: t.agentLockedHint,
|
|
5221
|
+
"data-agent-locked": action.name
|
|
5222
|
+
}, t.agentLocked);
|
|
5223
|
+
}
|
|
5224
|
+
if (typeof action.agentEnabled !== "boolean") return null;
|
|
5225
|
+
var busy = saving === action.name;
|
|
5226
|
+
return h(
|
|
5227
|
+
"button",
|
|
5228
|
+
{
|
|
5229
|
+
className: P + "-toggle",
|
|
5230
|
+
"data-agent-row": action.name,
|
|
5231
|
+
type: "button",
|
|
5232
|
+
role: "switch",
|
|
5233
|
+
"aria-checked": action.agentEnabled,
|
|
5234
|
+
disabled: busy,
|
|
5235
|
+
"data-agent-toggle": action.name,
|
|
5236
|
+
"aria-label": t.agentSwitch + " \xB7 " + action.name,
|
|
5237
|
+
onClick: function() {
|
|
5238
|
+
setAgent(action, !action.agentEnabled);
|
|
5239
|
+
}
|
|
5240
|
+
},
|
|
5241
|
+
h("span", { className: P + "-track", "aria-hidden": true }),
|
|
5242
|
+
h("span", null, busy ? t.agentSaving : t.agentSwitch)
|
|
5243
|
+
);
|
|
5244
|
+
}
|
|
4416
5245
|
function card(action) {
|
|
4417
5246
|
var rows = paramRows(action);
|
|
4418
5247
|
var examples = Array.isArray(action.examples) ? action.examples : [];
|
|
@@ -4422,12 +5251,16 @@ var require_action_schema_view = __commonJS({
|
|
|
4422
5251
|
h(
|
|
4423
5252
|
"div",
|
|
4424
5253
|
{ className: P + "-cardhead" },
|
|
4425
|
-
h(
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
5254
|
+
h(
|
|
5255
|
+
"div",
|
|
5256
|
+
{ className: P + "-cardmeta" },
|
|
5257
|
+
h("code", { className: P + "-mono" }, Highlight.hit(action.name, kw)),
|
|
5258
|
+
h("span", { className: P + "-badge" }, rows.length ? t.paramCount(rows.length) : t.noParams),
|
|
5259
|
+
rows.some(function(row) {
|
|
5260
|
+
return row.required;
|
|
5261
|
+
}) ? h("span", { className: P + "-badge " + P + "-req" }, t.required) : null
|
|
5262
|
+
),
|
|
5263
|
+
agentSwitch(action)
|
|
4431
5264
|
),
|
|
4432
5265
|
action.description ? h("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
|
|
4433
5266
|
rows.length ? h(
|
|
@@ -4504,6 +5337,7 @@ var require_action_schema_view = __commonJS({
|
|
|
4504
5337
|
h("span", { className: P + "-badge" }, t.count(visible.length, all.length)),
|
|
4505
5338
|
h("span", { className: P + "-none" }, t.hint)
|
|
4506
5339
|
),
|
|
5340
|
+
h("p", { className: P + "-hintline" }, SOURCE === "actions.list" ? t.hostHint : t.switchHint),
|
|
4507
5341
|
snap ? h(
|
|
4508
5342
|
"div",
|
|
4509
5343
|
{ className: P + "-toolbar" },
|
|
@@ -7126,6 +7960,10 @@ var require_filter_checklist_styles = __commonJS({
|
|
|
7126
7960
|
".wbck-opt:hover{background:color-mix(in srgb, currentColor 7%, transparent)}",
|
|
7127
7961
|
".wbck-opt.is-on{background:color-mix(in srgb, var(--wb-accent) 10%, transparent)}",
|
|
7128
7962
|
".wbck-opt input{margin:0;flex:none;accent-color:var(--wb-accent)}",
|
|
7963
|
+
// 单选变体用 button 渲染(role="radio"),这里把浏览器默认按钮样式清掉,视觉与多选行一致。
|
|
7964
|
+
'.wbck-opt[role="radio"]{appearance:none;width:100%;box-sizing:border-box;border:0;background:transparent;color:inherit;font:inherit;text-align:left}',
|
|
7965
|
+
'.wbck-opt[role="radio"]:disabled{opacity:.55;cursor:not-allowed}',
|
|
7966
|
+
'.wbck-opt[role="radio"]:focus-visible{outline:2px solid var(--wb-accent);outline-offset:-2px}',
|
|
7129
7967
|
".wbck-nm{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
7130
7968
|
".wbck-meta{margin-left:auto;flex:none;font-size:11.5px;color:var(--wb-muted)}",
|
|
7131
7969
|
".wbck-note{font-size:12px;color:var(--wb-muted);padding:8px 6px}",
|
|
@@ -7155,7 +7993,6 @@ var require_styles = __commonJS({
|
|
|
7155
7993
|
".wbt-grow{flex:1;min-width:0}",
|
|
7156
7994
|
".wbt-btn{border:1px solid var(--wbt-line);background:var(--wbt-surface);color:inherit;border-radius:var(--wb-radius-sm);padding:6px 11px;font-size:12.5px;cursor:pointer;white-space:nowrap;line-height:1.3;display:inline-flex;align-items:center;gap:5px}",
|
|
7157
7995
|
".wbt-svg{display:block;flex:none}",
|
|
7158
|
-
".wbt-publication-filter{min-width:0;max-width:100%}",
|
|
7159
7996
|
".wbt-btn:hover{border-color:var(--wbt-accent)}",
|
|
7160
7997
|
".wbt-btn.primary{background:var(--wbt-accent);border-color:var(--wbt-accent);color:var(--dsw-alias-label-primary-inverted,#fff);font-weight:600}",
|
|
7161
7998
|
".wbt-btn.ghost{background:transparent}",
|
|
@@ -7172,7 +8009,6 @@ var require_styles = __commonJS({
|
|
|
7172
8009
|
".wbt-limit-row{display:flex;flex-direction:column;gap:4px;min-width:0}.wbt-limit-head{display:flex;align-items:baseline;gap:6px;flex-wrap:wrap;min-width:0}.wbt-limit-hint{margin:0;font-size:11.5px;line-height:1.6;opacity:.65;overflow-wrap:anywhere}.wbt-limit-head>strong{font-weight:560;font-size:12.5px;flex:none}.wbt-limit-fields{display:flex;align-items:center;gap:4px;min-width:0}.wbt-limit-fields input{flex:1 1 0;width:0;min-width:0;box-sizing:border-box;text-align:center;padding-left:6px;padding-right:6px}.wbt-limit-fields .wbt-limit-input{background-color:var(--wbt-surface);border:1px solid var(--wbt-line);border-radius:8px;padding:6px 4px;font-size:13px;color:inherit;font-variant-numeric:tabular-nums;-moz-appearance:textfield;appearance:textfield}.wbt-limit-fields .wbt-limit-input:focus{border-color:var(--wbt-accent);outline:none;box-shadow:0 0 0 3px color-mix(in oklab,var(--wbt-accent) 18%,transparent)}.wbt-limit-fields .wbt-limit-input::-webkit-outer-spin-button,.wbt-limit-fields .wbt-limit-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.wbt-limit-fields>span{flex:none;opacity:.55;font-size:11.5px}.wbt-limit-clear{flex:none;padding:2px 6px;line-height:1.2}.wbt-limit-unit{font-size:11px;opacity:.55;overflow-wrap:anywhere;min-width:0}",
|
|
7173
8010
|
".wbt-presets{gap:6px}.wbt-preset-list{display:flex;flex-wrap:wrap;gap:6px}.wbt-preset{padding:4px 9px;border:1px solid var(--wbt-line);border-radius:999px;background:var(--wbt-surface);color:inherit;font-size:12px;line-height:1.5;white-space:normal}.wbt-preset:hover{border-color:var(--wbt-accent)}.wbt-preset.active{background:var(--wbt-accent);border-color:var(--wbt-accent);color:#fff}.wbt-preset:focus-visible{outline:2px solid var(--wbt-accent);outline-offset:2px}.wbt-target-group{gap:8px}",
|
|
7174
8011
|
".wbt-status-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 8px}.wbt-status-grid .wbt-check{min-width:0;overflow-wrap:anywhere}.wbt-pathrow>.wbt-sum{flex:none;white-space:nowrap}",
|
|
7175
|
-
".wbt-publication-filter{width:100%}.wbt-range-entry{display:flex;gap:4px;align-items:center}.wbt-range-trigger{width:100%;min-width:0;text-align:left;white-space:normal}.wbt-range-trigger span{min-width:0;overflow-wrap:anywhere}.wbt-range-calendar{margin-top:8px;padding:6px;border:1px solid var(--wbt-line);border-radius:8px;background:var(--wbt-bg)}.wbt-range-month{display:flex;gap:4px;align-items:center;margin-bottom:8px}.wbt-range-month input{width:100%;min-width:0;padding:4px;border:1px solid var(--wbt-line);border-radius:4px;background:var(--wbt-bg);color:inherit}.wbt-range-month .wbt-btn{padding:4px 7px}.wbt-range-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;margin:8px 0}.wbt-range-weekday{text-align:center;font-size:11px;opacity:.7}.wbt-range-day{min-width:0;padding:6px 0;border:0;border-radius:4px;background:transparent;color:inherit;font:inherit;cursor:pointer}.wbt-range-day.between{background:color-mix(in srgb,var(--wbt-accent) 18%,transparent)}.wbt-range-day:hover{box-shadow:inset 0 0 0 1px var(--wbt-accent)}.wbt-range-day.selected{background:var(--wbt-accent);color:#fff}.wbt-range-day:focus-visible{outline:2px solid var(--wbt-accent);outline-offset:1px}.wbt-range-actions{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:6px}",
|
|
7176
8012
|
".wbt-nav{display:flex;flex-direction:column;gap:2px;flex:0 0 138px;width:138px;padding:3px 0;border-right:1px solid var(--wbt-line)}",
|
|
7177
8013
|
".wbt-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;border:1px solid var(--wbt-line);border-radius:10px;background:var(--wbt-surface);overflow:hidden}.wbt-list-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:10px;scrollbar-gutter:stable}.wbt-content>.wbt-pager{flex:none;margin:0;padding:8px 10px;border-top:1px solid var(--wbt-line)}",
|
|
7178
8014
|
".wbt-nav-sep{height:1px;background:var(--wbt-line);margin:5px 9px;opacity:.7}",
|
|
@@ -7340,6 +8176,15 @@ var require_styles = __commonJS({
|
|
|
7340
8176
|
".wbt-field.full{grid-column:1 / -1}",
|
|
7341
8177
|
".wbt-field>span{opacity:.62;font-size:11.5px}",
|
|
7342
8178
|
".wbt-modal-foot{display:flex;gap:8px;justify-content:flex-end;align-items:center;margin-top:2px}",
|
|
8179
|
+
// 预览面板:只让内容区滚动,头部标题与右上角 × 固定不动(滚动壳限定在 .wbt-preview,不影响其它弹窗)。
|
|
8180
|
+
".wbt-preview{overflow:hidden}",
|
|
8181
|
+
".wbt-preview-head{flex:none}",
|
|
8182
|
+
".wbt-preview-body{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding-right:2px;scrollbar-width:thin;scrollbar-color:color-mix(in oklab,var(--wbt-line) 85%,transparent) transparent}",
|
|
8183
|
+
".wbt-preview-body::-webkit-scrollbar{width:10px;height:10px}",
|
|
8184
|
+
".wbt-preview-body::-webkit-scrollbar-track{background:transparent}",
|
|
8185
|
+
".wbt-preview-body::-webkit-scrollbar-thumb{background-color:color-mix(in oklab,var(--wbt-line) 78%,transparent);border-radius:999px;border:3px solid transparent;background-clip:content-box}",
|
|
8186
|
+
".wbt-preview-body::-webkit-scrollbar-thumb:hover{background-color:color-mix(in oklab,var(--wbt-line) 100%,transparent)}",
|
|
8187
|
+
".wbt-preview-body::-webkit-scrollbar-corner{background:transparent}",
|
|
7343
8188
|
".wbt-timeline{display:flex;flex-direction:column;gap:0;margin:2px 0}",
|
|
7344
8189
|
".wbt-tl-item{display:flex;gap:9px;min-height:40px}",
|
|
7345
8190
|
".wbt-tl-rail{width:12px;display:flex;flex-direction:column;align-items:center;flex:none}",
|
|
@@ -7389,7 +8234,7 @@ var require_styles = __commonJS({
|
|
|
7389
8234
|
"@media (max-width:760px){.wbt-body{flex-direction:column;gap:8px}.wbt-nav{flex-direction:row;width:100%;flex:0 0 auto;overflow-x:auto;border-right:none;border-bottom:1px solid var(--wbt-line);padding:0 0 6px}.wbt-tab{width:auto;white-space:nowrap;padding:6px 9px}.wbt-tab.on{box-shadow:inset 0 -2px 0 var(--wbt-accent)}.wbt-nav-sep{width:1px;height:18px;flex:none;margin:auto 4px}.wbt-tree-slot{flex:0 0 auto;width:auto;margin-right:0}.wbt-pathrow .wbt-search{flex:1 1 160px;max-width:none}}",
|
|
7390
8235
|
"@media (max-width:760px){.wbt-filter-panel{width:100%;flex:0 0 auto;padding:8px;max-height:40%}.wbt-filter-toggle{display:inline-flex}.wbt-filter-panel:not(.expanded) .wbt-filter-content{display:none}.wbt-filter-panel.expanded .wbt-filter-content{padding-top:10px}.wbt-content{width:100%;box-sizing:border-box}}",
|
|
7391
8236
|
"@media (max-width:640px){.wbt-form{grid-template-columns:1fr}.wbt-drawer{width:94vw}.wbt-search{width:100%}.wbt-item{padding:9px}.wbt-ops{width:100%;justify-content:flex-end}}"
|
|
7392
|
-
].concat(require_filter_checklist_styles()).join("\n");
|
|
8237
|
+
].concat(require_filter_checklist_styles(), require_date_picker_styles()("wbt")).join("\n");
|
|
7393
8238
|
}
|
|
7394
8239
|
});
|
|
7395
8240
|
|
|
@@ -7581,6 +8426,7 @@ var require_timeline_copy = __commonJS({
|
|
|
7581
8426
|
"\u5C55\u5F00\u63CF\u8FF0": "Expand description",
|
|
7582
8427
|
"\u6536\u8D77\u63CF\u8FF0": "Collapse description",
|
|
7583
8428
|
"\u6309\u53D1\u5E03\u65F6\u95F4\u6B63\u5E8F\u6392\u5217": "Oldest publication first",
|
|
8429
|
+
"\u6309\u53D1\u5E03\u65F6\u95F4\u6B63\u5E8F\u6392\u5217\uFF0C\u70B9\u51FB\u4EFB\u52A1\u6253\u5F00\u9884\u89C8": "Oldest publication first. Click a task to open a preview.",
|
|
7584
8430
|
"\u65B0\u5EFA\u65F6\u95F4\u7EBF\u6216\u9009\u62E9\u5DF2\u6709\u65F6\u95F4\u7EBF\uFF0C\u5C06\u76F8\u5173\u4EFB\u52A1\u96C6\u4E2D\u67E5\u770B\u3002": "Create or choose a timeline to view related tasks together.",
|
|
7585
8431
|
"\u5176\u4ED6\u65F6\u95F4\u7EBF": "Other timelines",
|
|
7586
8432
|
"\u8BF7\u9009\u62E9\u5DF2\u6709\u65F6\u95F4\u7EBF\uFF1B\u65E0\u5339\u914D\u65F6\u53EF\u65B0\u5EFA": "Choose a timeline, or create one if there is no match",
|
|
@@ -8375,6 +9221,7 @@ var require_create_modal = __commonJS({
|
|
|
8375
9221
|
var WorkspaceSelect = require_workspace_select()(React).WorkspaceSelect;
|
|
8376
9222
|
var difficultyField = require_difficulty_field()(React);
|
|
8377
9223
|
var ownership = require_ownership(), fields = require_ownership_fields()(React);
|
|
9224
|
+
var DP = require_date_picker();
|
|
8378
9225
|
var allTables = deps.allTables, tagNames = deps.tagNames, splitTags = deps.splitTags;
|
|
8379
9226
|
var today = deps.today, addDays = deps.addDays, hostHasAddon = deps.hostHasAddon;
|
|
8380
9227
|
function CreateModal(props) {
|
|
@@ -8566,20 +9413,20 @@ var require_create_modal = __commonJS({
|
|
|
8566
9413
|
set("priority", e.target.value);
|
|
8567
9414
|
} })),
|
|
8568
9415
|
fields({ form, set, setMany, tree: props.tree, recommended: props.defaultTableId || origin && origin.tableId }),
|
|
8569
|
-
h("label", { className: "wbt-field" }, h("span", null, t.publishDate), h(
|
|
8570
|
-
set("publishDate",
|
|
9416
|
+
h("label", { className: "wbt-field" }, h("span", null, t.publishDate), h(DP.DatePicker, { React, h, prefix: "wbt", lang: props.lang, label: t.publishDate, value: form.publishDate, onChange: function(next) {
|
|
9417
|
+
set("publishDate", next);
|
|
8571
9418
|
} })),
|
|
8572
|
-
h("label", { className: "wbt-field" }, h("span", null, t.targetDate), h(
|
|
8573
|
-
set("targetDate",
|
|
9419
|
+
h("label", { className: "wbt-field" }, h("span", null, t.targetDate), h(DP.DatePicker, { React, h, prefix: "wbt", lang: props.lang, label: t.targetDate, value: form.targetDate, onChange: function(next) {
|
|
9420
|
+
set("targetDate", next);
|
|
8574
9421
|
} })),
|
|
8575
|
-
source !== "2" && form.status === "2" ? h("label", { className: "wbt-field" }, h("span", null, t.doneDate), h(
|
|
8576
|
-
set("doneDate",
|
|
9422
|
+
source !== "2" && form.status === "2" ? h("label", { className: "wbt-field" }, h("span", null, t.doneDate), h(DP.DatePicker, { React, h, prefix: "wbt", lang: props.lang, label: t.doneDate, value: form.doneDate, onChange: function(next) {
|
|
9423
|
+
set("doneDate", next);
|
|
8577
9424
|
} })) : null,
|
|
8578
9425
|
difficultyField(t, form.difficulty, function(value) {
|
|
8579
9426
|
set("difficulty", value);
|
|
8580
9427
|
}, "wbt-create-difficulty"),
|
|
8581
|
-
source !== "2" && form.status === "1" ? h("label", { className: "wbt-field" }, h("span", null, t.shutdownDate), h(
|
|
8582
|
-
set("shutdownDate",
|
|
9428
|
+
source !== "2" && form.status === "1" ? h("label", { className: "wbt-field" }, h("span", null, t.shutdownDate), h(DP.DatePicker, { React, h, prefix: "wbt", lang: props.lang, label: t.shutdownDate, value: form.shutdownDate, onChange: function(next) {
|
|
9429
|
+
set("shutdownDate", next);
|
|
8583
9430
|
} })) : null
|
|
8584
9431
|
),
|
|
8585
9432
|
priorityError ? h("div", { id: "wbt-create-priority-error", className: "wbt-err", role: "alert" }, priorityError) : null,
|
|
@@ -8747,6 +9594,11 @@ var require_task_timeline_modal = __commonJS({
|
|
|
8747
9594
|
cancelled = true;
|
|
8748
9595
|
};
|
|
8749
9596
|
}, [p.api, p.task.id, revision]);
|
|
9597
|
+
React.useEffect(function() {
|
|
9598
|
+
if (p.refreshKey) setRevision(function(n) {
|
|
9599
|
+
return n + 1;
|
|
9600
|
+
});
|
|
9601
|
+
}, [p.refreshKey]);
|
|
8750
9602
|
function change(action, args) {
|
|
8751
9603
|
if (busy || pending.current) return;
|
|
8752
9604
|
pending.current = true;
|
|
@@ -8846,7 +9698,7 @@ var require_task_timeline_modal = __commonJS({
|
|
|
8846
9698
|
h(
|
|
8847
9699
|
"div",
|
|
8848
9700
|
{ className: "wbt-timeline-pager" },
|
|
8849
|
-
h("span", null, tr("\u6309\u53D1\u5E03\u65F6\u95F4\u6B63\u5E8F\u6392\u5217")),
|
|
9701
|
+
h("span", null, tr("\u6309\u53D1\u5E03\u65F6\u95F4\u6B63\u5E8F\u6392\u5217\uFF0C\u70B9\u51FB\u4EFB\u52A1\u6253\u5F00\u9884\u89C8")),
|
|
8850
9702
|
h("button", { type: "button", className: "wbt-btn", disabled: busy || page <= 1, onClick: function() {
|
|
8851
9703
|
setPage(page - 1);
|
|
8852
9704
|
} }, tr("\u4E0A\u4E00\u9875")),
|
|
@@ -8918,6 +9770,7 @@ var require_edit_modal = __commonJS({
|
|
|
8918
9770
|
var difficultyField = require_difficulty_field()(React);
|
|
8919
9771
|
var WorkspaceSelect = require_workspace_select()(React).WorkspaceSelect;
|
|
8920
9772
|
var ownership = require_ownership(), fields = require_ownership_fields()(React);
|
|
9773
|
+
var DP = require_date_picker();
|
|
8921
9774
|
function EditModal(props) {
|
|
8922
9775
|
var t = props.t;
|
|
8923
9776
|
var task = props.task;
|
|
@@ -9062,8 +9915,8 @@ var require_edit_modal = __commonJS({
|
|
|
9062
9915
|
"label",
|
|
9063
9916
|
{ className: "wbt-field" },
|
|
9064
9917
|
h("span", null, t.targetDate),
|
|
9065
|
-
h(
|
|
9066
|
-
set("targetDate",
|
|
9918
|
+
h(DP.DatePicker, { React, h, prefix: "wbt", lang: props.lang, label: t.targetDate, value: form.targetDate, onChange: function(next) {
|
|
9919
|
+
set("targetDate", next);
|
|
9067
9920
|
} })
|
|
9068
9921
|
) : null,
|
|
9069
9922
|
canPriority ? h(
|
|
@@ -9163,164 +10016,52 @@ var require_batch_modal = __commonJS({
|
|
|
9163
10016
|
setBusy(false);
|
|
9164
10017
|
if (r && r.ok) props.onDone();
|
|
9165
10018
|
else setError(r && r.error || "failed");
|
|
9166
|
-
});
|
|
9167
|
-
}
|
|
9168
|
-
} }, isBusy ? "\u2026" : t.confirm)
|
|
9169
|
-
)
|
|
9170
|
-
)
|
|
9171
|
-
);
|
|
9172
|
-
}
|
|
9173
|
-
return BatchModal;
|
|
9174
|
-
};
|
|
9175
|
-
}
|
|
9176
|
-
});
|
|
9177
|
-
|
|
9178
|
-
// packages/addons/tasks/client/ui/date-filter.cjs
|
|
9179
|
-
var require_date_filter = __commonJS({
|
|
9180
|
-
"packages/addons/tasks/client/ui/date-filter.cjs"(exports2, module2) {
|
|
9181
|
-
var React = require("react");
|
|
9182
|
-
var h = React.createElement;
|
|
9183
|
-
var Icon2 = require_icons().Icon;
|
|
9184
|
-
function validDate(value) {
|
|
9185
|
-
if (!value) return true;
|
|
9186
|
-
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return false;
|
|
9187
|
-
var d = /* @__PURE__ */ new Date(value + "T00:00:00Z");
|
|
9188
|
-
return isFinite(d.getTime()) && d.toISOString().slice(0, 10) === value && value.slice(0, 4) !== "0000";
|
|
9189
|
-
}
|
|
9190
|
-
function normalize(value) {
|
|
9191
|
-
var from = value.from || "", to = value.to || "";
|
|
9192
|
-
if (!validDate(from) || !validDate(to)) return null;
|
|
9193
|
-
return from && to && from > to ? { from: to, to: from, swapped: true } : { from, to, swapped: false };
|
|
9194
|
-
}
|
|
9195
|
-
function today() {
|
|
9196
|
-
var d = /* @__PURE__ */ new Date();
|
|
9197
|
-
return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0");
|
|
9198
|
-
}
|
|
9199
|
-
function shift(date, days) {
|
|
9200
|
-
var d = /* @__PURE__ */ new Date(date + "T00:00:00Z");
|
|
9201
|
-
d.setUTCDate(d.getUTCDate() + days);
|
|
9202
|
-
return d.toISOString().slice(0, 10);
|
|
9203
|
-
}
|
|
9204
|
-
function DateFilter(props) {
|
|
9205
|
-
var en = props.lang === "en", value = props.value;
|
|
9206
|
-
var names = en ? { publish: "Publication", done: "Completion", shutdown: "Closure", target: "Target" } : { publish: "\u53D1\u5E03", done: "\u5B8C\u6210", shutdown: "\u5173\u95ED", target: "\u76EE\u6807" };
|
|
9207
|
-
var name = names[props.kind] || names.publish, title = name + (en ? " date range" : "\u65F6\u95F4\u8303\u56F4");
|
|
9208
|
-
var openS = React.useState(false), open = openS[0], setOpen = openS[1];
|
|
9209
|
-
var startS = React.useState(""), start = startS[0], setStart = startS[1];
|
|
9210
|
-
var monthS = React.useState((value.from || value.to || today()).slice(0, 7)), month = monthS[0], setMonth = monthS[1];
|
|
9211
|
-
var focusS = React.useState(""), focus = focusS[0], setFocus = focusS[1];
|
|
9212
|
-
var root = React.useRef(null), trigger = React.useRef(null), id = React.useId();
|
|
9213
|
-
React.useEffect(function() {
|
|
9214
|
-
if (open && focus && root.current) {
|
|
9215
|
-
var b = root.current.querySelector('[data-day="' + focus + '"]');
|
|
9216
|
-
if (b) b.focus();
|
|
9217
|
-
}
|
|
9218
|
-
}, [open, focus, month]);
|
|
9219
|
-
function close() {
|
|
9220
|
-
setOpen(false);
|
|
9221
|
-
setStart("");
|
|
9222
|
-
if (trigger.current) trigger.current.focus();
|
|
9223
|
-
}
|
|
9224
|
-
function apply(next) {
|
|
9225
|
-
var result = normalize(next);
|
|
9226
|
-
if (result) {
|
|
9227
|
-
props.onChange(result);
|
|
9228
|
-
close();
|
|
9229
|
-
}
|
|
9230
|
-
}
|
|
9231
|
-
function pick(day2) {
|
|
9232
|
-
if (!start) setStart(day2);
|
|
9233
|
-
else apply({ from: start, to: day2 });
|
|
9234
|
-
}
|
|
9235
|
-
function moveMonth(delta) {
|
|
9236
|
-
var d = /* @__PURE__ */ new Date(month + "-01T00:00:00Z");
|
|
9237
|
-
d.setUTCMonth(d.getUTCMonth() + delta);
|
|
9238
|
-
var next = d.toISOString().slice(0, 7);
|
|
9239
|
-
if (/^\d{4}-\d{2}$/.test(next) && next.slice(0, 4) !== "0000") setMonth(next);
|
|
10019
|
+
});
|
|
10020
|
+
}
|
|
10021
|
+
} }, isBusy ? "\u2026" : t.confirm)
|
|
10022
|
+
)
|
|
10023
|
+
)
|
|
10024
|
+
);
|
|
9240
10025
|
}
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
10026
|
+
return BatchModal;
|
|
10027
|
+
};
|
|
10028
|
+
}
|
|
10029
|
+
});
|
|
10030
|
+
|
|
10031
|
+
// packages/addons/tasks/client/ui/date-filter.cjs
|
|
10032
|
+
var require_date_filter = __commonJS({
|
|
10033
|
+
"packages/addons/tasks/client/ui/date-filter.cjs"(exports2, module2) {
|
|
10034
|
+
var React = require("react");
|
|
10035
|
+
var h = React.createElement;
|
|
10036
|
+
var DP = require_date_picker();
|
|
10037
|
+
var NAMES = {
|
|
10038
|
+
zh: { publish: "\u53D1\u5E03", done: "\u5B8C\u6210", shutdown: "\u5173\u95ED", target: "\u76EE\u6807" },
|
|
10039
|
+
en: { publish: "Publication", done: "Completion", shutdown: "Closure", target: "Target" }
|
|
10040
|
+
};
|
|
10041
|
+
function DateFilter(props) {
|
|
10042
|
+
var en = props.lang === "en";
|
|
10043
|
+
var names = en ? NAMES.en : NAMES.zh;
|
|
10044
|
+
var name = names[props.kind] || names.publish;
|
|
10045
|
+
return h(DP.RangePicker, {
|
|
10046
|
+
React,
|
|
10047
|
+
h,
|
|
10048
|
+
prefix: "wbt",
|
|
10049
|
+
lang: props.lang,
|
|
10050
|
+
label: name + (en ? " date range" : "\u65F6\u95F4\u8303\u56F4"),
|
|
10051
|
+
placeholder: en ? "Choose date range" : "\u9009\u62E9\u65E5\u671F\u8303\u56F4",
|
|
10052
|
+
value: props.value || { from: "", to: "" },
|
|
10053
|
+
onChange: function(next) {
|
|
10054
|
+
props.onChange({ from: next.from, to: next.to });
|
|
9250
10055
|
}
|
|
9251
|
-
}
|
|
9252
|
-
var first = month + "-01", offset = (/* @__PURE__ */ new Date(first + "T00:00:00Z")).getUTCDay();
|
|
9253
|
-
var count = new Date(Number(month.slice(0, 4)), Number(month.slice(5)), 0).getDate(), cells = [];
|
|
9254
|
-
for (var i = 0; i < offset; i++) cells.push(h("span", { key: "empty" + i, "aria-hidden": true }));
|
|
9255
|
-
for (var n = 1; n <= count; n++) {
|
|
9256
|
-
var day = month + "-" + String(n).padStart(2, "0"), endpoint = start ? day === start : day === value.from || day === value.to;
|
|
9257
|
-
var inside = !start && value.from && value.to && day > value.from && day < value.to;
|
|
9258
|
-
cells.push(h("button", {
|
|
9259
|
-
key: day,
|
|
9260
|
-
type: "button",
|
|
9261
|
-
"data-day": day,
|
|
9262
|
-
"aria-label": day,
|
|
9263
|
-
"aria-pressed": !!endpoint,
|
|
9264
|
-
"aria-current": day === today() ? "date" : void 0,
|
|
9265
|
-
className: "wbt-range-day" + (endpoint ? " selected" : "") + (inside ? " between" : ""),
|
|
9266
|
-
onClick: pick.bind(null, day),
|
|
9267
|
-
onKeyDown: function(d, e) {
|
|
9268
|
-
keyDay(e, d);
|
|
9269
|
-
}.bind(null, day)
|
|
9270
|
-
}, n));
|
|
9271
|
-
}
|
|
9272
|
-
var summary = value.from && value.to ? value.from + " \u2014 " + value.to : value.from ? value.from + (en ? " onward" : " \u8D77") : value.to ? (en ? "Until " : "\u622A\u81F3 ") + value.to : en ? "Choose date range" : "\u9009\u62E9\u65E5\u671F\u8303\u56F4";
|
|
9273
|
-
return h(
|
|
9274
|
-
"div",
|
|
9275
|
-
{ className: "wbt-publication-filter", ref: root, onKeyDown: function(e) {
|
|
9276
|
-
if (e.key === "Escape" && open) {
|
|
9277
|
-
e.stopPropagation();
|
|
9278
|
-
close();
|
|
9279
|
-
}
|
|
9280
|
-
} },
|
|
9281
|
-
h(
|
|
9282
|
-
"div",
|
|
9283
|
-
{ className: "wbt-range-entry" },
|
|
9284
|
-
h("button", { ref: trigger, type: "button", className: "wbt-btn wbt-range-trigger", "aria-label": title + ": " + summary, "aria-expanded": open, "aria-controls": id, onClick: function() {
|
|
9285
|
-
setStart("");
|
|
9286
|
-
setFocus("");
|
|
9287
|
-
setMonth((value.from || value.to || today()).slice(0, 7));
|
|
9288
|
-
setOpen(!open);
|
|
9289
|
-
} }, h(Icon2, { name: "calendar" }), h("span", null, summary)),
|
|
9290
|
-
value.from || value.to ? h("button", { type: "button", className: "wbt-date-clear", "aria-label": en ? "Clear time range" : "\u6E05\u9664\u65F6\u95F4\u8303\u56F4", onClick: function() {
|
|
9291
|
-
apply({ from: "", to: "" });
|
|
9292
|
-
} }, "\xD7") : null
|
|
9293
|
-
),
|
|
9294
|
-
open ? h(
|
|
9295
|
-
"div",
|
|
9296
|
-
{ id, className: "wbt-range-calendar", role: "group", "aria-label": title },
|
|
9297
|
-
h(
|
|
9298
|
-
"div",
|
|
9299
|
-
{ className: "wbt-range-month" },
|
|
9300
|
-
h("button", { type: "button", className: "wbt-btn ghost", "aria-label": en ? "Previous month" : "\u4E0A\u4E2A\u6708", onClick: function() {
|
|
9301
|
-
moveMonth(-1);
|
|
9302
|
-
} }, "\u2039"),
|
|
9303
|
-
h("input", { type: "month", value: month, min: "0001-01", max: "9999-12", "aria-label": en ? "Calendar month" : "\u65E5\u5386\u6708\u4EFD", onChange: function(e) {
|
|
9304
|
-
if (validDate(e.target.value + "-01")) setMonth(e.target.value);
|
|
9305
|
-
} }),
|
|
9306
|
-
h("button", { type: "button", className: "wbt-btn ghost", "aria-label": en ? "Next month" : "\u4E0B\u4E2A\u6708", onClick: function() {
|
|
9307
|
-
moveMonth(1);
|
|
9308
|
-
} }, "\u203A")
|
|
9309
|
-
),
|
|
9310
|
-
h("p", { className: "wbt-mhint", role: "status" }, start ? (en ? "Start: " : "\u8D77\u59CB\uFF1A") + start + (en ? " \xB7 Choose end date" : " \xB7 \u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F") : en ? "Choose start, then end date" : "\u5148\u9009\u5F00\u59CB\u65E5\u671F\uFF0C\u518D\u9009\u7ED3\u675F\u65E5\u671F"),
|
|
9311
|
-
h("div", { className: "wbt-range-grid" }, (en ? ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] : ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"]).map(function(x) {
|
|
9312
|
-
return h("span", { key: x, className: "wbt-range-weekday", "aria-hidden": true }, x);
|
|
9313
|
-
}), cells),
|
|
9314
|
-
start ? h("div", { className: "wbt-range-actions" }, h("button", { type: "button", className: "wbt-btn ghost", onClick: function() {
|
|
9315
|
-
apply({ from: start, to: "" });
|
|
9316
|
-
} }, en ? "From this date" : "\u4EC5\u8D77\u59CB\u65E5\u671F"), h("button", { type: "button", className: "wbt-btn ghost", onClick: function() {
|
|
9317
|
-
apply({ from: "", to: start });
|
|
9318
|
-
} }, en ? "Until this date" : "\u4EC5\u622A\u6B62\u65E5\u671F")) : null,
|
|
9319
|
-
h("button", { type: "button", className: "wbt-btn ghost", onClick: close }, en ? "Cancel" : "\u53D6\u6D88")
|
|
9320
|
-
) : null
|
|
9321
|
-
);
|
|
10056
|
+
});
|
|
9322
10057
|
}
|
|
9323
|
-
module2.exports = {
|
|
10058
|
+
module2.exports = {
|
|
10059
|
+
DateFilter,
|
|
10060
|
+
normalize: DP.normalizeRange,
|
|
10061
|
+
validDate: DP.validDate,
|
|
10062
|
+
today: DP.todayISO,
|
|
10063
|
+
shift: DP.shiftDate
|
|
10064
|
+
};
|
|
9324
10065
|
}
|
|
9325
10066
|
});
|
|
9326
10067
|
|
|
@@ -9839,12 +10580,82 @@ var require_selection_bar = __commonJS({
|
|
|
9839
10580
|
}
|
|
9840
10581
|
});
|
|
9841
10582
|
|
|
10583
|
+
// packages/addons/tasks/client/modals/task-preview.cjs
|
|
10584
|
+
var require_task_preview = __commonJS({
|
|
10585
|
+
"packages/addons/tasks/client/modals/task-preview.cjs"(exports2, module2) {
|
|
10586
|
+
"use strict";
|
|
10587
|
+
module2.exports = function createTaskPreview(React, TaskItem) {
|
|
10588
|
+
var h = React.createElement;
|
|
10589
|
+
function TaskPreview(props) {
|
|
10590
|
+
var t = props.t, task = props.task;
|
|
10591
|
+
var titleId = "wbt-preview-title";
|
|
10592
|
+
function onKey(e) {
|
|
10593
|
+
if (e.key === "Escape") {
|
|
10594
|
+
e.preventDefault();
|
|
10595
|
+
e.stopPropagation();
|
|
10596
|
+
props.onClose();
|
|
10597
|
+
return;
|
|
10598
|
+
}
|
|
10599
|
+
if (e.key !== "Tab") return;
|
|
10600
|
+
var mask = e.currentTarget;
|
|
10601
|
+
var box = mask && mask.querySelector ? mask.querySelector('[role="dialog"]') : null;
|
|
10602
|
+
if (!box) return;
|
|
10603
|
+
var nodes = Array.from(box.querySelectorAll('button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href],[tabindex="0"]')).filter(function(node) {
|
|
10604
|
+
return node.getClientRects().length > 0;
|
|
10605
|
+
});
|
|
10606
|
+
var first = nodes[0], last = nodes[nodes.length - 1];
|
|
10607
|
+
if (!first) {
|
|
10608
|
+
e.preventDefault();
|
|
10609
|
+
if (box.focus) box.focus();
|
|
10610
|
+
} else if (e.shiftKey && (document.activeElement === first || document.activeElement === box)) {
|
|
10611
|
+
e.preventDefault();
|
|
10612
|
+
last.focus();
|
|
10613
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
10614
|
+
e.preventDefault();
|
|
10615
|
+
first.focus();
|
|
10616
|
+
}
|
|
10617
|
+
}
|
|
10618
|
+
return h(
|
|
10619
|
+
"div",
|
|
10620
|
+
{
|
|
10621
|
+
className: "wbt-modal-mask",
|
|
10622
|
+
onKeyDownCapture: onKey,
|
|
10623
|
+
onMouseDown: function(e) {
|
|
10624
|
+
if (e.target === e.currentTarget) props.onClose();
|
|
10625
|
+
}
|
|
10626
|
+
},
|
|
10627
|
+
h(
|
|
10628
|
+
"div",
|
|
10629
|
+
{
|
|
10630
|
+
tabIndex: -1,
|
|
10631
|
+
className: "wbt-modal wide wbt-preview",
|
|
10632
|
+
role: "dialog",
|
|
10633
|
+
"aria-modal": "true",
|
|
10634
|
+
"aria-labelledby": titleId,
|
|
10635
|
+
"aria-label": t.previewLabel
|
|
10636
|
+
},
|
|
10637
|
+
h(
|
|
10638
|
+
"div",
|
|
10639
|
+
{ className: "wbt-modal-head wbt-preview-head" },
|
|
10640
|
+
h("h3", { id: titleId }, String(task.title || "").trim() || t.previewUntitled),
|
|
10641
|
+
h("button", { type: "button", className: "wbt-icon", title: t.close, "aria-label": t.close, autoFocus: true, onClick: props.onClose }, "\xD7")
|
|
10642
|
+
),
|
|
10643
|
+
h("div", { className: "wbt-preview-body" }, h(TaskItem, props.cardProps))
|
|
10644
|
+
)
|
|
10645
|
+
);
|
|
10646
|
+
}
|
|
10647
|
+
return TaskPreview;
|
|
10648
|
+
};
|
|
10649
|
+
}
|
|
10650
|
+
});
|
|
10651
|
+
|
|
9842
10652
|
// packages/addons/tasks/client/views/tasks-view.cjs
|
|
9843
10653
|
var require_tasks_view = __commonJS({
|
|
9844
10654
|
"packages/addons/tasks/client/views/tasks-view.cjs"(exports2, module2) {
|
|
9845
10655
|
module2.exports = function createTasksView(deps) {
|
|
9846
10656
|
var React = deps.React, configView = deps.configView, CFG_FALLBACK = deps.CFG_FALLBACK, COPY = deps.COPY, injectCss = deps.injectCss, allTables = deps.allTables, findFirstTable = deps.findFirstTable, treeWalk = deps.treeWalk, treeFlat = deps.treeFlat, cx = deps.cx, Icon2 = deps.Icon, TaskItem = deps.TaskItem, PathCrumbs = deps.PathCrumbs, TagFilter = deps.TagFilter, TreeNode = deps.TreeNode, CreateModal = deps.CreateModal, TimelineModal = deps.TimelineModal, NodeModal = deps.NodeModal, EditModal = deps.EditModal, DoneModal = deps.DoneModal, BatchModal = deps.BatchModal;
|
|
9847
10657
|
var h = React.createElement, filters = require_task_filter_model(), renderFilters = require_task_filter_panel(), claimBatch = require_claim_batch(), renderSelectionBar = require_selection_bar();
|
|
10658
|
+
var TaskPreview = require_task_preview()(React, TaskItem);
|
|
9848
10659
|
function TasksView(props) {
|
|
9849
10660
|
var lang = props.lang === "en" ? "en" : "zh";
|
|
9850
10661
|
var cfg = configView.useConfig(props.api, CFG_FALLBACK);
|
|
@@ -9943,6 +10754,11 @@ var require_tasks_view = __commonJS({
|
|
|
9943
10754
|
var doneTask = doneS[0], setDoneTask = doneS[1];
|
|
9944
10755
|
var editTaskS = React.useState(null);
|
|
9945
10756
|
var editTask = editTaskS[0], setEditTask = editTaskS[1];
|
|
10757
|
+
var timelinePreviewS = React.useState(null);
|
|
10758
|
+
var timelinePreview = timelinePreviewS[0], setTimelinePreview = timelinePreviewS[1];
|
|
10759
|
+
var timelineTrigger = React.useRef(null);
|
|
10760
|
+
var timelineReloadS = React.useState(0);
|
|
10761
|
+
var timelineReload = timelineReloadS[0], setTimelineReload = timelineReloadS[1];
|
|
9946
10762
|
var editS = React.useState(null);
|
|
9947
10763
|
var edit = editS[0], setEdit = editS[1];
|
|
9948
10764
|
var nodeModalS = React.useState(null);
|
|
@@ -10172,6 +10988,40 @@ var require_tasks_view = __commonJS({
|
|
|
10172
10988
|
} else say(r && r.error || "delete failed");
|
|
10173
10989
|
});
|
|
10174
10990
|
}
|
|
10991
|
+
function openTimelinePreview(member, event) {
|
|
10992
|
+
timelineTrigger.current = event && event.currentTarget || timelineTrigger.current;
|
|
10993
|
+
api.call("tasks.get", { id: member.id }).then(function(r) {
|
|
10994
|
+
if (r && r.ok && r.result && r.result.task) return r.result.task;
|
|
10995
|
+
return member;
|
|
10996
|
+
}).catch(function() {
|
|
10997
|
+
return member;
|
|
10998
|
+
}).then(function(task) {
|
|
10999
|
+
if (task) setTimelinePreview(task);
|
|
11000
|
+
});
|
|
11001
|
+
}
|
|
11002
|
+
function closeTimelinePreview() {
|
|
11003
|
+
setTimelinePreview(null);
|
|
11004
|
+
var trigger = timelineTrigger.current;
|
|
11005
|
+
timelineTrigger.current = null;
|
|
11006
|
+
if (trigger && trigger.isConnected) trigger.focus({ preventScroll: true });
|
|
11007
|
+
}
|
|
11008
|
+
function bumpTimeline() {
|
|
11009
|
+
setTimelineReload(function(n) {
|
|
11010
|
+
return n + 1;
|
|
11011
|
+
});
|
|
11012
|
+
}
|
|
11013
|
+
function deletePreviewTask(task) {
|
|
11014
|
+
if (cfgConfirm && !window.confirm(t.deleteTaskConfirm)) return;
|
|
11015
|
+
api.call("tasks.delete", { id: task.id }).then(function(r) {
|
|
11016
|
+
if (r && r.ok) {
|
|
11017
|
+
closeTimelinePreview();
|
|
11018
|
+
refreshList();
|
|
11019
|
+
refreshTagNav();
|
|
11020
|
+
bumpTimeline();
|
|
11021
|
+
say(t.deleted);
|
|
11022
|
+
} else say(r && r.error || "delete failed");
|
|
11023
|
+
});
|
|
11024
|
+
}
|
|
10175
11025
|
function batchDelete() {
|
|
10176
11026
|
var ids = Array.from(selectedIds);
|
|
10177
11027
|
if (!ids.length) return;
|
|
@@ -10627,6 +11477,7 @@ var require_tasks_view = __commonJS({
|
|
|
10627
11477
|
setCreateState(null);
|
|
10628
11478
|
refreshList();
|
|
10629
11479
|
refreshTree();
|
|
11480
|
+
bumpTimeline();
|
|
10630
11481
|
say(require_ownership().receipt(result));
|
|
10631
11482
|
}
|
|
10632
11483
|
}) : null,
|
|
@@ -10636,23 +11487,64 @@ var require_tasks_view = __commonJS({
|
|
|
10636
11487
|
api,
|
|
10637
11488
|
task: timelineTask,
|
|
10638
11489
|
onChanged: refreshList,
|
|
11490
|
+
refreshKey: timelineReload,
|
|
10639
11491
|
onClose: function() {
|
|
10640
11492
|
setTimelineTask(null);
|
|
11493
|
+
setTimelinePreview(null);
|
|
10641
11494
|
},
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
if (!r || !r.ok) throw Error(r && r.error || t.fail);
|
|
10645
|
-
setTimelineTask(null);
|
|
10646
|
-
setEditTask(r.result.task);
|
|
10647
|
-
}).catch(function(err) {
|
|
10648
|
-
say(String(err.message || err));
|
|
10649
|
-
});
|
|
10650
|
-
},
|
|
11495
|
+
// 成员行只开只读预览;预览里的「编辑」才进编辑面板。
|
|
11496
|
+
onOpen: openTimelinePreview,
|
|
10651
11497
|
onCreateTimeline: function(originTask) {
|
|
10652
11498
|
setTimelineTask(null);
|
|
11499
|
+
setTimelinePreview(null);
|
|
10653
11500
|
setCreateState({ source: "1", originTask, defaultTableId: originTask.tableId });
|
|
10654
11501
|
}
|
|
10655
11502
|
}) : null,
|
|
11503
|
+
timelineTask && timelinePreview ? h(TaskPreview, {
|
|
11504
|
+
key: "preview-" + timelinePreview.id,
|
|
11505
|
+
t,
|
|
11506
|
+
task: timelinePreview,
|
|
11507
|
+
onClose: closeTimelinePreview,
|
|
11508
|
+
cardProps: {
|
|
11509
|
+
task: timelinePreview,
|
|
11510
|
+
t,
|
|
11511
|
+
lang: props.lang,
|
|
11512
|
+
keyword: "",
|
|
11513
|
+
bodyMode: cfg["ui.bodyMode"],
|
|
11514
|
+
update: function(task, patch) {
|
|
11515
|
+
api.call("tasks.update", Object.assign({ id: task.id }, patch)).then(function(r) {
|
|
11516
|
+
if (!r || !r.ok) {
|
|
11517
|
+
say(r && r.error || "update failed");
|
|
11518
|
+
return;
|
|
11519
|
+
}
|
|
11520
|
+
return api.call("tasks.get", { id: task.id }).then(function(next) {
|
|
11521
|
+
if (next && next.ok && next.result && next.result.task) setTimelinePreview(next.result.task);
|
|
11522
|
+
refreshList();
|
|
11523
|
+
bumpTimeline();
|
|
11524
|
+
});
|
|
11525
|
+
}).catch(function(e) {
|
|
11526
|
+
say(String(e && e.message || e));
|
|
11527
|
+
});
|
|
11528
|
+
},
|
|
11529
|
+
onEdit: function(task) {
|
|
11530
|
+
closeTimelinePreview();
|
|
11531
|
+
setEditTask(task);
|
|
11532
|
+
},
|
|
11533
|
+
onDone: function(task) {
|
|
11534
|
+
closeTimelinePreview();
|
|
11535
|
+
setDoneTask(task);
|
|
11536
|
+
},
|
|
11537
|
+
onRestart: function(task) {
|
|
11538
|
+
closeTimelinePreview();
|
|
11539
|
+
setCreateState({ source: "2", originTask: task });
|
|
11540
|
+
},
|
|
11541
|
+
onTimeline: function(task) {
|
|
11542
|
+
closeTimelinePreview();
|
|
11543
|
+
setTimelineTask(task);
|
|
11544
|
+
},
|
|
11545
|
+
onDelete: deletePreviewTask
|
|
11546
|
+
}
|
|
11547
|
+
}) : null,
|
|
10656
11548
|
nodeModal ? h(NodeModal, {
|
|
10657
11549
|
key: "node-" + (nodeModal.node ? nodeModal.node.id : "new"),
|
|
10658
11550
|
t,
|
|
@@ -10678,6 +11570,7 @@ var require_tasks_view = __commonJS({
|
|
|
10678
11570
|
onSaved: function(result) {
|
|
10679
11571
|
setEditTask(null);
|
|
10680
11572
|
refreshList();
|
|
11573
|
+
bumpTimeline();
|
|
10681
11574
|
say(require_ownership().receipt(result));
|
|
10682
11575
|
}
|
|
10683
11576
|
}) : null,
|
|
@@ -10692,6 +11585,7 @@ var require_tasks_view = __commonJS({
|
|
|
10692
11585
|
onDone: function() {
|
|
10693
11586
|
setDoneTask(null);
|
|
10694
11587
|
refreshList();
|
|
11588
|
+
bumpTimeline();
|
|
10695
11589
|
say(t.doneSuccess);
|
|
10696
11590
|
},
|
|
10697
11591
|
onError: function(e) {
|
|
@@ -10863,59 +11757,6 @@ var require_timeline_merge = __commonJS({
|
|
|
10863
11757
|
}
|
|
10864
11758
|
});
|
|
10865
11759
|
|
|
10866
|
-
// packages/addons/tasks/client/modals/task-preview.cjs
|
|
10867
|
-
var require_task_preview = __commonJS({
|
|
10868
|
-
"packages/addons/tasks/client/modals/task-preview.cjs"(exports2, module2) {
|
|
10869
|
-
"use strict";
|
|
10870
|
-
module2.exports = function createTaskPreview(React, TaskItem) {
|
|
10871
|
-
var h = React.createElement;
|
|
10872
|
-
function TaskPreview(props) {
|
|
10873
|
-
var t = props.t, task = props.task;
|
|
10874
|
-
var titleId = "wbt-preview-title";
|
|
10875
|
-
function onKey(e) {
|
|
10876
|
-
if (e.key !== "Escape") return;
|
|
10877
|
-
e.preventDefault();
|
|
10878
|
-
e.stopPropagation();
|
|
10879
|
-
props.onClose();
|
|
10880
|
-
}
|
|
10881
|
-
return h(
|
|
10882
|
-
"div",
|
|
10883
|
-
{
|
|
10884
|
-
className: "wbt-modal-mask",
|
|
10885
|
-
onKeyDownCapture: onKey,
|
|
10886
|
-
onMouseDown: function(e) {
|
|
10887
|
-
if (e.target === e.currentTarget) props.onClose();
|
|
10888
|
-
}
|
|
10889
|
-
},
|
|
10890
|
-
h(
|
|
10891
|
-
"div",
|
|
10892
|
-
{
|
|
10893
|
-
className: "wbt-modal wide wbt-preview",
|
|
10894
|
-
role: "dialog",
|
|
10895
|
-
"aria-modal": "true",
|
|
10896
|
-
"aria-labelledby": titleId,
|
|
10897
|
-
"aria-label": t.previewLabel
|
|
10898
|
-
},
|
|
10899
|
-
h(
|
|
10900
|
-
"div",
|
|
10901
|
-
{ className: "wbt-modal-head" },
|
|
10902
|
-
h("h3", { id: titleId }, String(task.title || "").trim() || t.previewUntitled),
|
|
10903
|
-
h("button", { type: "button", className: "wbt-icon", title: t.close, "aria-label": t.close, onClick: props.onClose }, "\xD7")
|
|
10904
|
-
),
|
|
10905
|
-
h("div", { className: "wbt-preview-body" }, h(TaskItem, props.cardProps)),
|
|
10906
|
-
h(
|
|
10907
|
-
"div",
|
|
10908
|
-
{ className: "wbt-modal-foot" },
|
|
10909
|
-
h("button", { type: "button", className: "wbt-btn ghost", autoFocus: true, onClick: props.onClose }, t.close)
|
|
10910
|
-
)
|
|
10911
|
-
)
|
|
10912
|
-
);
|
|
10913
|
-
}
|
|
10914
|
-
return TaskPreview;
|
|
10915
|
-
};
|
|
10916
|
-
}
|
|
10917
|
-
});
|
|
10918
|
-
|
|
10919
11760
|
// packages/addons/tasks/client/views/timeline-view.cjs
|
|
10920
11761
|
var require_timeline_view = __commonJS({
|
|
10921
11762
|
"packages/addons/tasks/client/views/timeline-view.cjs"(exports2, module2) {
|
|
@@ -11107,6 +11948,13 @@ var require_timeline_view = __commonJS({
|
|
|
11107
11948
|
setDetail(null);
|
|
11108
11949
|
if (detailTrigger.current) detailTrigger.current.focus({ preventScroll: true });
|
|
11109
11950
|
}
|
|
11951
|
+
function openPreview(member) {
|
|
11952
|
+
api.call("tasks.get", { id: member.id }).then(function(r) {
|
|
11953
|
+
setDetail(r && r.ok && r.result && r.result.task ? r.result.task : member);
|
|
11954
|
+
}).catch(function() {
|
|
11955
|
+
setDetail(member);
|
|
11956
|
+
});
|
|
11957
|
+
}
|
|
11110
11958
|
function say(message) {
|
|
11111
11959
|
setToast(String(message || ""));
|
|
11112
11960
|
}
|
|
@@ -11329,33 +12177,6 @@ var require_timeline_view = __commonJS({
|
|
|
11329
12177
|
setMulti(false);
|
|
11330
12178
|
reload();
|
|
11331
12179
|
} }) : null,
|
|
11332
|
-
detail && !editTask ? h(TaskPreview, {
|
|
11333
|
-
key: "preview-" + detail.id,
|
|
11334
|
-
t,
|
|
11335
|
-
task: detail,
|
|
11336
|
-
onClose: closeDetail,
|
|
11337
|
-
cardProps: {
|
|
11338
|
-
task: detail,
|
|
11339
|
-
t,
|
|
11340
|
-
lang,
|
|
11341
|
-
keyword: "",
|
|
11342
|
-
bodyMode: cfg["ui.bodyMode"],
|
|
11343
|
-
update: updateTask,
|
|
11344
|
-
onEdit: function(task) {
|
|
11345
|
-
setEditTask(task);
|
|
11346
|
-
},
|
|
11347
|
-
onDone: function(task) {
|
|
11348
|
-
setDoneTask(task);
|
|
11349
|
-
},
|
|
11350
|
-
onRestart: function(task) {
|
|
11351
|
-
setCreateState({ source: "2", originTask: task });
|
|
11352
|
-
},
|
|
11353
|
-
onTimeline: function(task) {
|
|
11354
|
-
setTimelineTask(task);
|
|
11355
|
-
},
|
|
11356
|
-
onDelete: removeTask
|
|
11357
|
-
}
|
|
11358
|
-
}) : null,
|
|
11359
12180
|
editTask ? h(deps.EditModal, {
|
|
11360
12181
|
key: "edit-" + editTask.id,
|
|
11361
12182
|
api,
|
|
@@ -11401,22 +12222,54 @@ var require_timeline_view = __commonJS({
|
|
|
11401
12222
|
api,
|
|
11402
12223
|
task: timelineTask,
|
|
11403
12224
|
onChanged: reload,
|
|
12225
|
+
refreshKey: refresh,
|
|
11404
12226
|
onClose: function() {
|
|
11405
12227
|
setTimelineTask(null);
|
|
12228
|
+
setDetail(null);
|
|
11406
12229
|
},
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
}).catch(function(e) {
|
|
11412
|
-
say(String(e && e.message || e));
|
|
11413
|
-
});
|
|
12230
|
+
// 弹窗里的成员行同样只开预览:弹窗保持挂载,页码与滚动不丢。
|
|
12231
|
+
onOpen: function(member, e) {
|
|
12232
|
+
detailTrigger.current = e && e.currentTarget;
|
|
12233
|
+
openPreview(member);
|
|
11414
12234
|
},
|
|
11415
12235
|
onCreateTimeline: function(originTask) {
|
|
11416
12236
|
setTimelineTask(null);
|
|
12237
|
+
setDetail(null);
|
|
11417
12238
|
setCreateState({ source: "1", originTask, defaultTableId: originTask.tableId });
|
|
11418
12239
|
}
|
|
11419
12240
|
}) : null,
|
|
12241
|
+
// 预览渲染在时间线弹窗之后,叠在它上面:Esc 只关预览,弹窗与分页原样保留。
|
|
12242
|
+
detail && !editTask ? h(TaskPreview, {
|
|
12243
|
+
key: "preview-" + detail.id,
|
|
12244
|
+
t,
|
|
12245
|
+
task: detail,
|
|
12246
|
+
onClose: closeDetail,
|
|
12247
|
+
cardProps: {
|
|
12248
|
+
task: detail,
|
|
12249
|
+
t,
|
|
12250
|
+
lang,
|
|
12251
|
+
keyword: "",
|
|
12252
|
+
bodyMode: cfg["ui.bodyMode"],
|
|
12253
|
+
update: updateTask,
|
|
12254
|
+
onEdit: function(task) {
|
|
12255
|
+
closeDetail();
|
|
12256
|
+
setEditTask(task);
|
|
12257
|
+
},
|
|
12258
|
+
onDone: function(task) {
|
|
12259
|
+
closeDetail();
|
|
12260
|
+
setDoneTask(task);
|
|
12261
|
+
},
|
|
12262
|
+
onRestart: function(task) {
|
|
12263
|
+
closeDetail();
|
|
12264
|
+
setCreateState({ source: "2", originTask: task });
|
|
12265
|
+
},
|
|
12266
|
+
onTimeline: function(task) {
|
|
12267
|
+
closeDetail();
|
|
12268
|
+
setTimelineTask(task);
|
|
12269
|
+
},
|
|
12270
|
+
onDelete: removeTask
|
|
12271
|
+
}
|
|
12272
|
+
}) : null,
|
|
11420
12273
|
createState ? h(deps.CreateModal, {
|
|
11421
12274
|
key: (createState.source || "0") + "-" + (createState.originTask && createState.originTask.id || ""),
|
|
11422
12275
|
t,
|
|
@@ -11942,7 +12795,7 @@ var init_list_checks = __esm({
|
|
|
11942
12795
|
var TimelineView = require_timeline_view()({ React, COPY, injectCss, statusInfo, configView, CFG_FALLBACK, TaskItem, EditModal, DoneModal, TimelineModal, CreateModal });
|
|
11943
12796
|
host.registerAddon({
|
|
11944
12797
|
id: "wb-addon-tasks",
|
|
11945
|
-
version: "5.2.
|
|
12798
|
+
version: "5.2.26",
|
|
11946
12799
|
icon: (init_list_checks(), __toCommonJS(list_checks_exports)).default,
|
|
11947
12800
|
views: [
|
|
11948
12801
|
{ id: "stats", icon: tabIcon("chart"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: statsView.TasksStatsView, keepAlive: true },
|