dsh-workbench-sites 1.12.9 → 1.12.11
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 +520 -180
- package/lib/domain/accounts.js +4 -1
- package/lib/index.js +1 -1
- package/lib/infra/vault-link.js +15 -2
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -528,8 +528,9 @@ var require_overlay = __commonJS({
|
|
|
528
528
|
var autoFocusDialog = opts.autoFocusDialog !== false;
|
|
529
529
|
var focusableSelector = opts.focusableSelector || FOCUSABLE;
|
|
530
530
|
function Modal(props) {
|
|
531
|
-
var
|
|
532
|
-
|
|
531
|
+
var R = props.React || React2;
|
|
532
|
+
var ref = R.useRef(null);
|
|
533
|
+
R.useEffect(function() {
|
|
533
534
|
var previous = typeof document !== "undefined" ? document.activeElement : null;
|
|
534
535
|
var focusIt = props.autoFocus !== void 0 ? props.autoFocus : autoFocusDialog;
|
|
535
536
|
if (focusIt && ref.current) ref.current.focus();
|
|
@@ -595,6 +596,305 @@ var require_overlay = __commonJS({
|
|
|
595
596
|
}
|
|
596
597
|
});
|
|
597
598
|
|
|
599
|
+
// packages/addons/lib/stepper.cjs
|
|
600
|
+
var require_stepper = __commonJS({
|
|
601
|
+
"packages/addons/lib/stepper.cjs"(exports2, module2) {
|
|
602
|
+
"use strict";
|
|
603
|
+
function stepState(index, current, maxVisited) {
|
|
604
|
+
if (index === current) return "current";
|
|
605
|
+
if (index < current) return "done";
|
|
606
|
+
if (index <= maxVisited) return "visited";
|
|
607
|
+
return "todo";
|
|
608
|
+
}
|
|
609
|
+
function Steps(props) {
|
|
610
|
+
var h2 = props.h;
|
|
611
|
+
var steps = props.steps || [];
|
|
612
|
+
var current = props.current || 0;
|
|
613
|
+
var maxVisited = props.maxVisited === void 0 ? current : props.maxVisited;
|
|
614
|
+
var invalid = props.invalid || {};
|
|
615
|
+
var disabled = !!props.disabled;
|
|
616
|
+
var label = props.label || "\u6B65\u9AA4";
|
|
617
|
+
return h2(
|
|
618
|
+
"nav",
|
|
619
|
+
{ className: "wbctl-steps" + (props.className ? " " + props.className : ""), "aria-label": label },
|
|
620
|
+
h2(
|
|
621
|
+
"ol",
|
|
622
|
+
{ className: "wbctl-step-list" },
|
|
623
|
+
steps.map(function(step, index) {
|
|
624
|
+
var state = stepState(index, current, maxVisited);
|
|
625
|
+
var canJump = !disabled && typeof props.onJump === "function" && state !== "current" && state !== "todo";
|
|
626
|
+
var isInvalid = !!invalid[index] || !!invalid[step.key];
|
|
627
|
+
return h2(
|
|
628
|
+
"li",
|
|
629
|
+
{ key: step.key || index, className: "wbctl-step-item" },
|
|
630
|
+
h2(
|
|
631
|
+
"button",
|
|
632
|
+
{
|
|
633
|
+
type: "button",
|
|
634
|
+
className: "wbctl-step",
|
|
635
|
+
"data-state": state,
|
|
636
|
+
"data-invalid": isInvalid ? "true" : null,
|
|
637
|
+
"aria-current": state === "current" ? "step" : void 0,
|
|
638
|
+
"aria-label": index + 1 + " \xB7 " + step.label + (state === "done" ? "\uFF08\u5DF2\u5B8C\u6210\uFF09" : ""),
|
|
639
|
+
disabled: disabled || state === "todo",
|
|
640
|
+
title: step.hint || "",
|
|
641
|
+
onClick: function() {
|
|
642
|
+
if (canJump) props.onJump(index);
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
h2("span", { className: "wbctl-step-index", "aria-hidden": "true" }, state === "done" ? "\u2713" : String(index + 1)),
|
|
646
|
+
h2("span", { className: "wbctl-step-label" }, step.label),
|
|
647
|
+
step.hint ? h2("span", { className: "wbctl-step-hint" }, step.hint) : null,
|
|
648
|
+
step.optional ? h2("span", { className: "wbctl-step-opt" }, "\u53EF\u9009") : null
|
|
649
|
+
)
|
|
650
|
+
);
|
|
651
|
+
})
|
|
652
|
+
)
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
var STYLES = [
|
|
656
|
+
".wbctl-steps{display:block;min-width:0}",
|
|
657
|
+
".wbctl-step-list{display:flex;align-items:stretch;gap:6px;list-style:none;margin:0 0 14px;padding:0;min-width:0}",
|
|
658
|
+
".wbctl-step-item{display:flex;flex:1 1 0;min-width:0}",
|
|
659
|
+
".wbctl-step{display:flex;align-items:center;gap:7px;flex:1 1 auto;min-width:0;padding:7px 9px;border:1px solid var(--wb-line,var(--wb-border));border-radius:10px;background:transparent;color:var(--wb-muted,inherit);font:inherit;font-size:12px;line-height:1.35;text-align:left;cursor:default;transition:background .14s ease,border-color .14s ease,color .14s ease}",
|
|
660
|
+
".wbctl-step[data-state=done],.wbctl-step[data-state=visited]{color:inherit;cursor:pointer}",
|
|
661
|
+
".wbctl-step[data-state=done]{border-color:color-mix(in oklab,var(--wb-ok,var(--wb-accent,#2563eb)) 36%,var(--wb-border))}",
|
|
662
|
+
".wbctl-step[data-state=current]{border-color:color-mix(in oklab,var(--wb-accent,#2563eb) 58%,var(--wb-border));background:color-mix(in oklab,var(--wb-accent,#2563eb) 8%,transparent);color:inherit;font-weight:600}",
|
|
663
|
+
".wbctl-step[data-state=visited]:hover,.wbctl-step[data-state=done]:hover{background:color-mix(in oklab,currentColor 7%,transparent)}",
|
|
664
|
+
".wbctl-step[data-invalid=true]{border-color:var(--wb-danger,#d33)}",
|
|
665
|
+
".wbctl-step:focus-visible{outline:2px solid var(--wb-accent,#2563eb);outline-offset:2px}",
|
|
666
|
+
".wbctl-step:disabled{cursor:default;opacity:.72}",
|
|
667
|
+
".wbctl-step-index{display:inline-flex;align-items:center;justify-content:center;flex:none;width:20px;height:20px;border-radius:50%;font-size:11px;font-variant-numeric:tabular-nums;background:color-mix(in oklab,currentColor 15%,transparent)}",
|
|
668
|
+
".wbctl-step[data-state=current] .wbctl-step-index{background:var(--wb-accent,#2563eb);color:var(--wb-on-accent,#fff)}",
|
|
669
|
+
".wbctl-step[data-state=done] .wbctl-step-index{background:color-mix(in oklab,var(--wb-ok,var(--wb-accent,#2563eb)) 20%,transparent);color:var(--wb-ok,var(--wb-accent,#2563eb))}",
|
|
670
|
+
".wbctl-step-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
671
|
+
".wbctl-step-hint{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:400;opacity:.62}",
|
|
672
|
+
".wbctl-step-opt{flex:none;font-size:10px;font-weight:400;opacity:.55}",
|
|
673
|
+
"@media (max-width:760px){.wbctl-step{padding:6px 7px;font-size:11.5px}.wbctl-step-hint,.wbctl-step-opt{display:none}.wbctl-step-index{width:18px;height:18px;font-size:10px}}",
|
|
674
|
+
"@media (max-width:520px){.wbctl-step-list{gap:4px}.wbctl-step-label{white-space:normal}.wbctl-step{gap:5px}}",
|
|
675
|
+
"@media (prefers-reduced-motion:reduce){.wbctl-step{transition:none}}"
|
|
676
|
+
];
|
|
677
|
+
module2.exports = { Steps, stepState, styles: STYLES };
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
// packages/addons/lib/staged-dialog.cjs
|
|
682
|
+
var require_staged_dialog = __commonJS({
|
|
683
|
+
"packages/addons/lib/staged-dialog.cjs"(exports2, module2) {
|
|
684
|
+
"use strict";
|
|
685
|
+
var defaultReact = require("react");
|
|
686
|
+
var overlayFactory = require_overlay();
|
|
687
|
+
var stepper = require_stepper();
|
|
688
|
+
function validateStep(step) {
|
|
689
|
+
if (!step || typeof step.validate !== "function") return "";
|
|
690
|
+
var message = step.validate();
|
|
691
|
+
return message ? String(message) : "";
|
|
692
|
+
}
|
|
693
|
+
function firstFailing(steps) {
|
|
694
|
+
var list = steps || [];
|
|
695
|
+
for (var i = 0; i < list.length; i += 1) {
|
|
696
|
+
var message = validateStep(list[i]);
|
|
697
|
+
if (message) return { index: i, key: list[i] && list[i].key, message };
|
|
698
|
+
}
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
701
|
+
function createStagedDialog(options) {
|
|
702
|
+
var opts = options || {};
|
|
703
|
+
var React2 = opts.React || defaultReact;
|
|
704
|
+
var h2 = React2.createElement;
|
|
705
|
+
var dialogClass = ((opts.dialogClass || "") + " wbctl-dialog").trim();
|
|
706
|
+
var Overlay = overlayFactory(
|
|
707
|
+
Object.assign({}, opts, {
|
|
708
|
+
React: React2,
|
|
709
|
+
dialogClass,
|
|
710
|
+
// 首焦点由外壳送进对话框,字段由 focusStep 负责,避免打开瞬间落进第一个输入框。
|
|
711
|
+
autoFocusDialog: opts.autoFocusDialog !== false
|
|
712
|
+
})
|
|
713
|
+
);
|
|
714
|
+
function StagedDialog(props) {
|
|
715
|
+
var R = props.React || React2;
|
|
716
|
+
var steps = props.steps || [];
|
|
717
|
+
var count = steps.length;
|
|
718
|
+
var busy = !!props.submitting || !!props.busy;
|
|
719
|
+
var indexState = R.useState(props.initialStep || 0);
|
|
720
|
+
var rawIndex = indexState[0];
|
|
721
|
+
var setIndex = indexState[1];
|
|
722
|
+
var index = count === 0 ? 0 : Math.min(Math.max(rawIndex, 0), count - 1);
|
|
723
|
+
var visitedState = R.useState(props.initialStep || 0);
|
|
724
|
+
var maxVisited = count === 0 ? 0 : Math.min(Math.max(visitedState[0], index), count - 1);
|
|
725
|
+
var setMaxVisited = visitedState[1];
|
|
726
|
+
var errorState = R.useState("");
|
|
727
|
+
var stepError = errorState[0];
|
|
728
|
+
var setStepError = errorState[1];
|
|
729
|
+
var invalidState = R.useState({});
|
|
730
|
+
var invalid = invalidState[0];
|
|
731
|
+
var setInvalid = invalidState[1];
|
|
732
|
+
var bodyRef = R.useRef(null);
|
|
733
|
+
var mounted = R.useRef(true);
|
|
734
|
+
function runValidate(step) {
|
|
735
|
+
return validateStep(step);
|
|
736
|
+
}
|
|
737
|
+
function markInvalid(i, bad) {
|
|
738
|
+
setInvalid(function(prev) {
|
|
739
|
+
var next2 = Object.assign({}, prev);
|
|
740
|
+
if (bad) next2[i] = true;
|
|
741
|
+
else delete next2[i];
|
|
742
|
+
return next2;
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
function focusBody() {
|
|
746
|
+
var el = bodyRef.current;
|
|
747
|
+
if (el && typeof el.focus === "function") el.focus();
|
|
748
|
+
}
|
|
749
|
+
R.useEffect(
|
|
750
|
+
function() {
|
|
751
|
+
if (!mounted.current) return;
|
|
752
|
+
focusBody();
|
|
753
|
+
},
|
|
754
|
+
[index]
|
|
755
|
+
);
|
|
756
|
+
R.useEffect(function() {
|
|
757
|
+
mounted.current = true;
|
|
758
|
+
return function() {
|
|
759
|
+
mounted.current = false;
|
|
760
|
+
};
|
|
761
|
+
}, []);
|
|
762
|
+
function goTo(i) {
|
|
763
|
+
if (busy || i < 0 || i >= count) return;
|
|
764
|
+
setIndex(i);
|
|
765
|
+
if (i > maxVisited) setMaxVisited(i);
|
|
766
|
+
setStepError("");
|
|
767
|
+
}
|
|
768
|
+
function fail(i, message) {
|
|
769
|
+
markInvalid(i, true);
|
|
770
|
+
goTo(i);
|
|
771
|
+
setStepError(message);
|
|
772
|
+
focusBody();
|
|
773
|
+
}
|
|
774
|
+
function next() {
|
|
775
|
+
if (busy) return;
|
|
776
|
+
var message = runValidate(steps[index]);
|
|
777
|
+
if (message) {
|
|
778
|
+
fail(index, message);
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
markInvalid(index, false);
|
|
782
|
+
goTo(Math.min(index + 1, count - 1));
|
|
783
|
+
}
|
|
784
|
+
function back() {
|
|
785
|
+
if (busy || index === 0) return;
|
|
786
|
+
goTo(index - 1);
|
|
787
|
+
}
|
|
788
|
+
function jump(i) {
|
|
789
|
+
if (busy || i > maxVisited) return;
|
|
790
|
+
goTo(i);
|
|
791
|
+
}
|
|
792
|
+
function submit() {
|
|
793
|
+
if (busy) return;
|
|
794
|
+
var bad = firstFailing(steps);
|
|
795
|
+
if (bad) {
|
|
796
|
+
fail(bad.index, bad.message);
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
for (var i = 0; i < count; i++) markInvalid(i, false);
|
|
800
|
+
setStepError("");
|
|
801
|
+
if (typeof props.onSubmit === "function") props.onSubmit();
|
|
802
|
+
}
|
|
803
|
+
function cancel() {
|
|
804
|
+
if (busy) return;
|
|
805
|
+
if (typeof props.onClose === "function") props.onClose();
|
|
806
|
+
}
|
|
807
|
+
var current = steps[index];
|
|
808
|
+
var isLast = index >= count - 1;
|
|
809
|
+
var saveText = props.submitText || "\u4FDD\u5B58";
|
|
810
|
+
var shownError = stepError || props.error || "";
|
|
811
|
+
return h2(
|
|
812
|
+
Overlay,
|
|
813
|
+
props,
|
|
814
|
+
count > 1 ? h2(stepper.Steps, {
|
|
815
|
+
h: h2,
|
|
816
|
+
steps: steps.map(function(step) {
|
|
817
|
+
return { key: step.key, label: step.label, hint: step.hint, optional: step.optional };
|
|
818
|
+
}),
|
|
819
|
+
current: index,
|
|
820
|
+
maxVisited,
|
|
821
|
+
onJump: jump,
|
|
822
|
+
invalid,
|
|
823
|
+
disabled: busy,
|
|
824
|
+
label: props.stepsLabel || "\u521B\u5EFA\u6B65\u9AA4"
|
|
825
|
+
}) : null,
|
|
826
|
+
h2(
|
|
827
|
+
"div",
|
|
828
|
+
{
|
|
829
|
+
className: "wbctl-dialog-body" + (props.bodyClassName ? " " + props.bodyClassName : ""),
|
|
830
|
+
ref: bodyRef,
|
|
831
|
+
tabIndex: -1
|
|
832
|
+
},
|
|
833
|
+
current ? current.render(h2, props) : null
|
|
834
|
+
),
|
|
835
|
+
props.footerExtra || null,
|
|
836
|
+
shownError ? h2("div", { className: "wbctl-dialog-err", role: "alert" }, shownError) : null,
|
|
837
|
+
h2(
|
|
838
|
+
"div",
|
|
839
|
+
{ className: "wbctl-dialog-foot" },
|
|
840
|
+
count > 1 ? h2("span", { className: "wbctl-dialog-progress" }, index + 1 + " / " + count) : null,
|
|
841
|
+
props.footerNote ? h2("span", { className: "wbctl-dialog-note" }, props.footerNote) : null,
|
|
842
|
+
h2("span", { className: "wbctl-dialog-spacer" }),
|
|
843
|
+
index > 0 ? h2(
|
|
844
|
+
"button",
|
|
845
|
+
{ type: "button", className: "wbctl-btn", onClick: back, disabled: busy },
|
|
846
|
+
props.backText || "\u4E0A\u4E00\u6B65"
|
|
847
|
+
) : null,
|
|
848
|
+
h2("button", { type: "button", className: "wbctl-btn", onClick: cancel, disabled: busy }, props.cancelText || "\u53D6\u6D88"),
|
|
849
|
+
h2(
|
|
850
|
+
"button",
|
|
851
|
+
{
|
|
852
|
+
type: "button",
|
|
853
|
+
className: "wbctl-btn wbctl-btn-p",
|
|
854
|
+
onClick: isLast ? submit : next,
|
|
855
|
+
// submitDisabled 只作用于末步的保存:插件据此把「结构性不合法」(JSON 语法、无可选 action)
|
|
856
|
+
// 提前反映成禁用态,避免用户点到保存才被弹回第一步。
|
|
857
|
+
disabled: busy || isLast && !!props.submitDisabled
|
|
858
|
+
},
|
|
859
|
+
busy ? saveText + "\u4E2D\u2026" : isLast ? saveText : props.nextText || "\u4E0B\u4E00\u6B65"
|
|
860
|
+
)
|
|
861
|
+
)
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
StagedDialog.displayName = opts.displayName || "StagedDialog";
|
|
865
|
+
return StagedDialog;
|
|
866
|
+
}
|
|
867
|
+
var STYLES = [
|
|
868
|
+
// 宽表单:内容多时给足横向空间,窄屏留 16px 边距后铺满。
|
|
869
|
+
".wbctl-dialog{width:min(880px,calc(100vw - 32px));max-height:min(92vh,760px);display:flex;flex-direction:column;overflow:hidden}",
|
|
870
|
+
".wbctl-dialog-body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;padding:2px 2px 10px;outline:none}",
|
|
871
|
+
".wbctl-dialog-body:focus-visible{outline:none}",
|
|
872
|
+
".wbctl-dialog-foot{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding-top:10px;margin-top:10px;border-top:1px solid var(--wb-line,var(--wb-border))}",
|
|
873
|
+
".wbctl-dialog-progress{font-size:11.5px;color:var(--wb-muted,#666);font-variant-numeric:tabular-nums}",
|
|
874
|
+
".wbctl-dialog-note{font-size:11.5px;color:var(--wb-muted,#666);min-width:0}",
|
|
875
|
+
".wbctl-dialog-spacer{flex:1 1 auto}",
|
|
876
|
+
".wbctl-dialog-err{margin-top:8px;padding:7px 10px;border-radius:8px;border:1px solid color-mix(in oklab,var(--wb-danger,#d33) 45%,transparent);background:color-mix(in oklab,var(--wb-danger,#d33) 8%,transparent);color:var(--wb-danger,#d33);font-size:12px}",
|
|
877
|
+
".wbctl-btn{padding:6px 14px;border:1px solid var(--wb-border,#d0d5dd);border-radius:8px;background:var(--wb-card,#fff);color:inherit;font:inherit;font-size:12.5px;cursor:pointer}",
|
|
878
|
+
".wbctl-btn:hover:not(:disabled){background:color-mix(in oklab,currentColor 7%,transparent)}",
|
|
879
|
+
".wbctl-btn:focus-visible{outline:2px solid var(--wb-accent,#2563eb);outline-offset:2px}",
|
|
880
|
+
".wbctl-btn:disabled{opacity:.55;cursor:default}",
|
|
881
|
+
".wbctl-btn.wbctl-btn-p{background:var(--wb-accent,#2563eb);border-color:transparent;color:var(--wb-on-accent,#fff)}",
|
|
882
|
+
".wbctl-btn.wbctl-btn-p:hover:not(:disabled){background:color-mix(in oklab,var(--wb-accent,#2563eb) 86%,#000)}",
|
|
883
|
+
// 确认步:键值对清单,各插件共用,避免再各写一套只读摘要。\n ".wbctl-review{display:flex;flex-direction:column;border:1px solid var(--wb-line,var(--wb-border));border-radius:10px;overflow:hidden}",\n ".wbctl-review-row{display:grid;grid-template-columns:96px minmax(0,1fr);gap:10px;padding:8px 12px;font-size:12.5px;background:var(--wb-surface,transparent)}",\n ".wbctl-review-row+.wbctl-review-row{border-top:1px solid var(--wb-line,var(--wb-border))}",\n ".wbctl-review-k{color:var(--wb-muted,inherit);font-size:11.5px;line-height:1.6}",\n ".wbctl-review-v{min-width:0;word-break:break-word;line-height:1.6}",\n ".wbctl-note{margin:10px 0 0;font-size:11.5px;color:var(--wb-muted,inherit)}",\n // 两列字段布局:内容多的弹窗不再单列拉长,窄屏回落单列。
|
|
884
|
+
".wbctl-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 14px}",
|
|
885
|
+
".wbctl-form>.full{grid-column:1/-1}",
|
|
886
|
+
"@media (max-width:760px){.wbctl-dialog{width:calc(100vw - 16px);max-height:94vh}.wbctl-form{grid-template-columns:1fr}.wbctl-form>.full{grid-column:auto}}",
|
|
887
|
+
"@media (prefers-reduced-motion:reduce){.wbctl-btn{transition:none}}"
|
|
888
|
+
];
|
|
889
|
+
module2.exports = {
|
|
890
|
+
createStagedDialog,
|
|
891
|
+
validateStep,
|
|
892
|
+
firstFailing,
|
|
893
|
+
styles: STYLES
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
|
|
598
898
|
// packages/addons/lib/date-picker.cjs
|
|
599
899
|
var require_date_picker = __commonJS({
|
|
600
900
|
"packages/addons/lib/date-picker.cjs"(exports2, module2) {
|
|
@@ -5495,7 +5795,7 @@ var require_styles = __commonJS({
|
|
|
5495
5795
|
".wbs-toast{position:fixed;left:50%;bottom:38px;transform:translateX(-50%);z-index:1200;background:var(--dsw-alias-toast-bg,#26302d);color:var(--dsw-alias-toast-label,#fff);border-radius:8px;padding:8px 14px;font-size:12px;box-shadow:0 8px 24px rgba(0,0,0,.22);max-width:80vw}",
|
|
5496
5796
|
".wbs-toast.err{background:var(--dsw-alias-state-error-primary,#9d332b)}",
|
|
5497
5797
|
".wbs-mask{position:fixed;inset:0;z-index:900;background:rgba(24,28,26,.34);display:flex;align-items:center;justify-content:center;padding:22px}",
|
|
5498
|
-
".wbs-modal{width:min(700px,96vw);max-height:88vh;overflow:auto;background:var(--dsw-alias-bg-layer-1,#fffdf7);border:1px solid var(--wbs-line);border-radius:14px;box-shadow:0 24px 70px rgba(0,0,0,.24);padding:18px}",
|
|
5798
|
+
// 分步表单的字段容器:两列排布,窄屏回落单列(宽度与步骤条来自 lib/staged-dialog.cjs)。\n ".wbs-field{display:flex;flex-direction:column;gap:5px;min-width:0}",\n ".wbs-field.full{grid-column:1 / -1}",\n ".wbs-field .wbs-label{margin:0}",\n ".wbs-modal{width:min(700px,96vw);max-height:88vh;overflow:auto;background:var(--dsw-alias-bg-layer-1,#fffdf7);border:1px solid var(--wbs-line);border-radius:14px;box-shadow:0 24px 70px rgba(0,0,0,.24);padding:18px}",
|
|
5499
5799
|
".wbs-modal.small{width:min(430px,94vw)}",
|
|
5500
5800
|
".wbs-modal-title{display:flex;align-items:center;gap:8px;font-size:16px;font-weight:650;margin-bottom:4px}",
|
|
5501
5801
|
".wbs-modal-title .wbs-svg{color:var(--wbs-accent);opacity:.85;flex:none}",
|
|
@@ -5527,7 +5827,7 @@ var require_styles = __commonJS({
|
|
|
5527
5827
|
".wbs-note{font-size:11px;color:var(--wbs-muted);line-height:1.6}",
|
|
5528
5828
|
"@media(max-width:860px){.wbs-body{flex-direction:column}.wbs-tree{width:100%;max-height:220px}.wbs-table{min-width:760px}.wbs-root{min-height:0}}",
|
|
5529
5829
|
"@media(max-width:600px){.wbs-head h2{font-size:18px}.wbs-linkrow{grid-template-columns:1fr 1fr}.wbs-modal{padding:14px}}"
|
|
5530
|
-
].concat(require_filter_checklist_styles()).concat(require_client_base_styles().secretFieldStyles).concat([require_date_picker_styles()("wbs")]).concat(require_switch().styles).join("\n");
|
|
5830
|
+
].concat(require_stepper().styles, require_staged_dialog().styles).concat(require_filter_checklist_styles()).concat(require_client_base_styles().secretFieldStyles).concat([require_date_picker_styles()("wbs")]).concat(require_switch().styles).join("\n");
|
|
5531
5831
|
}
|
|
5532
5832
|
});
|
|
5533
5833
|
|
|
@@ -6809,6 +7109,7 @@ var React = require("react");
|
|
|
6809
7109
|
var h = React.createElement;
|
|
6810
7110
|
var TagFilter = require_tagfilter();
|
|
6811
7111
|
var createOverlay = require_overlay();
|
|
7112
|
+
var staged = require_staged_dialog();
|
|
6812
7113
|
(function() {
|
|
6813
7114
|
var host = window.__WB_HOST__;
|
|
6814
7115
|
if (!host) {
|
|
@@ -6887,6 +7188,28 @@ var createOverlay = require_overlay();
|
|
|
6887
7188
|
return props.small ? " small" : "";
|
|
6888
7189
|
}
|
|
6889
7190
|
});
|
|
7191
|
+
var SiteFormDialog = staged.createStagedDialog({
|
|
7192
|
+
React: React2,
|
|
7193
|
+
tag: "div",
|
|
7194
|
+
displayName: "SiteFormDialog",
|
|
7195
|
+
maskClass: "wbs-mask",
|
|
7196
|
+
dialogClass: "wbs-modal",
|
|
7197
|
+
header: function(p) {
|
|
7198
|
+
return h2(
|
|
7199
|
+
"div",
|
|
7200
|
+
{ className: "wbs-modal-title" },
|
|
7201
|
+
h2(Icon2, { name: p.mode === "edit" ? "edit" : "plus", size: 15 }),
|
|
7202
|
+
p.title,
|
|
7203
|
+
h2("button", { type: "button", className: "wbs-mini wbs-modal-x", title: p.cancelLabel, disabled: !!p.submitting, onClick: p.onClose }, h2(Icon2, { name: "x", size: 15 }))
|
|
7204
|
+
);
|
|
7205
|
+
},
|
|
7206
|
+
closeOnEscape: function(p) {
|
|
7207
|
+
return !p.submitting;
|
|
7208
|
+
},
|
|
7209
|
+
closeOnMask: function(p) {
|
|
7210
|
+
return !p.submitting;
|
|
7211
|
+
}
|
|
7212
|
+
});
|
|
6890
7213
|
function SiteFormModal(props) {
|
|
6891
7214
|
var api = props.api;
|
|
6892
7215
|
var lang = props.lang || "zh";
|
|
@@ -6894,8 +7217,6 @@ var createOverlay = require_overlay();
|
|
|
6894
7217
|
var site = props.site;
|
|
6895
7218
|
var current = props.current || { id: "0", path: [] };
|
|
6896
7219
|
var tagOn = !!props.tagOn;
|
|
6897
|
-
var maxStep = tagOn ? 2 : 1;
|
|
6898
|
-
var [step, setStep] = useState(0);
|
|
6899
7220
|
var [name, setName] = useState(site ? site.siteName : "");
|
|
6900
7221
|
var [desc, setDesc] = useState(site ? site.description : "");
|
|
6901
7222
|
var [links, setLinks] = useState(function() {
|
|
@@ -6989,33 +7310,23 @@ var createOverlay = require_overlay();
|
|
|
6989
7310
|
}
|
|
6990
7311
|
function removeLink(index) {
|
|
6991
7312
|
setLinks(function(prev) {
|
|
6992
|
-
var
|
|
7313
|
+
var next = prev.filter(function(_, i) {
|
|
6993
7314
|
return i !== index;
|
|
6994
7315
|
});
|
|
6995
|
-
return
|
|
7316
|
+
return next.length ? next : [{ description: "", link: "" }];
|
|
6996
7317
|
});
|
|
6997
7318
|
if (defaultIdx === index) setDefaultIdx(0);
|
|
6998
7319
|
else if (defaultIdx > index) setDefaultIdx(defaultIdx - 1);
|
|
6999
7320
|
}
|
|
7000
|
-
function
|
|
7001
|
-
if (
|
|
7321
|
+
function save() {
|
|
7322
|
+
if (!String(name).trim()) {
|
|
7002
7323
|
setError(text(lang, "requiredName"));
|
|
7003
|
-
return
|
|
7324
|
+
return;
|
|
7004
7325
|
}
|
|
7005
|
-
if (
|
|
7326
|
+
if (!dirIds.length) {
|
|
7006
7327
|
setError(text(lang, "requiredDirs"));
|
|
7007
|
-
return
|
|
7328
|
+
return;
|
|
7008
7329
|
}
|
|
7009
|
-
setError("");
|
|
7010
|
-
return true;
|
|
7011
|
-
}
|
|
7012
|
-
function next() {
|
|
7013
|
-
if (step >= maxStep) return;
|
|
7014
|
-
if (!validate(step + 1)) return;
|
|
7015
|
-
setStep(step + 1);
|
|
7016
|
-
}
|
|
7017
|
-
function save() {
|
|
7018
|
-
if (!validate(2)) return;
|
|
7019
7330
|
setSaving(true);
|
|
7020
7331
|
setError("");
|
|
7021
7332
|
var siteLinks = links.filter(function(l) {
|
|
@@ -7046,170 +7357,199 @@ var createOverlay = require_overlay();
|
|
|
7046
7357
|
setError(errText(e));
|
|
7047
7358
|
});
|
|
7048
7359
|
}
|
|
7049
|
-
var steps = tagOn ? [text(lang, "step1"), text(lang, "step2"), text(lang, "step3")] : [text(lang, "step1"), text(lang, "step2")];
|
|
7050
7360
|
var title = mode === "edit" ? text(lang, "editTitle") : text(lang, "createTitle");
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
h2(Icon2, { name: mode === "edit" ? "edit" : "plus", size: 15 }),
|
|
7058
|
-
title,
|
|
7059
|
-
h2("button", { type: "button", className: "wbs-mini wbs-modal-x", title: text(lang, "cancel"), onClick: props.onClose }, h2(Icon2, { name: "x", size: 15 }))
|
|
7060
|
-
),
|
|
7061
|
-
h2("div", { className: "wbs-steps" }, steps.map(function(s, i) {
|
|
7062
|
-
return h2("span", { key: i, className: "wbs-step" + (i === step ? " on" : "") }, i + 1 + " \xB7 " + s);
|
|
7063
|
-
})),
|
|
7064
|
-
step === 0 ? h2(
|
|
7065
|
-
"div",
|
|
7066
|
-
null,
|
|
7067
|
-
h2("label", { className: "wbs-label" }, text(lang, "siteName")),
|
|
7068
|
-
h2("input", {
|
|
7069
|
-
className: "wbs-input",
|
|
7070
|
-
value: name,
|
|
7071
|
-
autoFocus: true,
|
|
7072
|
-
placeholder: text(lang, "siteNamePh"),
|
|
7073
|
-
onChange: function(e) {
|
|
7074
|
-
setName(e.target.value);
|
|
7075
|
-
}
|
|
7076
|
-
}),
|
|
7077
|
-
h2("label", { className: "wbs-label" }, text(lang, "desc")),
|
|
7078
|
-
h2("textarea", {
|
|
7079
|
-
className: "wbs-textarea",
|
|
7080
|
-
value: desc,
|
|
7081
|
-
placeholder: text(lang, "descPh"),
|
|
7082
|
-
onChange: function(e) {
|
|
7083
|
-
setDesc(e.target.value);
|
|
7084
|
-
}
|
|
7085
|
-
}),
|
|
7086
|
-
h2("label", { className: "wbs-label" }, text(lang, "linkList")),
|
|
7087
|
-
links.map(function(l, i) {
|
|
7088
|
-
return h2(
|
|
7361
|
+
var steps = [
|
|
7362
|
+
{
|
|
7363
|
+
key: "basic",
|
|
7364
|
+
label: text(lang, "step1"),
|
|
7365
|
+
render: function(hh) {
|
|
7366
|
+
return hh(
|
|
7089
7367
|
"div",
|
|
7090
|
-
{ className: "
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
value: l.link,
|
|
7102
|
-
placeholder: text(lang, "linkUrl"),
|
|
7103
|
-
onChange: function(e) {
|
|
7104
|
-
updateLink(i, "link", e.target.value);
|
|
7105
|
-
}
|
|
7106
|
-
}),
|
|
7107
|
-
h2(
|
|
7108
|
-
"label",
|
|
7109
|
-
{ className: "wbs-radio", title: text(lang, "setDefault") },
|
|
7110
|
-
h2("input", {
|
|
7111
|
-
type: "radio",
|
|
7112
|
-
name: "wbs-default-link",
|
|
7113
|
-
checked: defaultIdx === i,
|
|
7114
|
-
onChange: function() {
|
|
7115
|
-
setDefaultIdx(i);
|
|
7368
|
+
{ className: "wbctl-form" },
|
|
7369
|
+
hh(
|
|
7370
|
+
"div",
|
|
7371
|
+
{ className: "wbs-field" },
|
|
7372
|
+
hh("label", { className: "wbs-label" }, text(lang, "siteName")),
|
|
7373
|
+
hh("input", {
|
|
7374
|
+
className: "wbs-input",
|
|
7375
|
+
value: name,
|
|
7376
|
+
placeholder: text(lang, "siteNamePh"),
|
|
7377
|
+
onChange: function(e) {
|
|
7378
|
+
setName(e.target.value);
|
|
7116
7379
|
}
|
|
7117
|
-
})
|
|
7118
|
-
text(lang, "default")
|
|
7380
|
+
})
|
|
7119
7381
|
),
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
!flatDirs.length ? h2("div", { className: "wbs-note" }, text(lang, "noDirs")) : h2(
|
|
7132
|
-
"div",
|
|
7133
|
-
{ className: "wbs-dirlist" },
|
|
7134
|
-
flatDirs.map(function(item) {
|
|
7135
|
-
var id = String(item.node.id);
|
|
7136
|
-
return h2(
|
|
7137
|
-
"label",
|
|
7138
|
-
{
|
|
7139
|
-
key: id,
|
|
7140
|
-
className: "wbs-dircheck",
|
|
7141
|
-
style: { paddingLeft: 6 + item.depth * 16 }
|
|
7142
|
-
},
|
|
7143
|
-
h2("input", {
|
|
7144
|
-
type: "checkbox",
|
|
7145
|
-
checked: dirIds.indexOf(id) >= 0,
|
|
7146
|
-
onChange: function() {
|
|
7147
|
-
toggleDir(id);
|
|
7382
|
+
hh(
|
|
7383
|
+
"div",
|
|
7384
|
+
{ className: "wbs-field" },
|
|
7385
|
+
hh("label", { className: "wbs-label" }, text(lang, "desc")),
|
|
7386
|
+
hh("textarea", {
|
|
7387
|
+
className: "wbs-textarea",
|
|
7388
|
+
rows: 3,
|
|
7389
|
+
value: desc,
|
|
7390
|
+
placeholder: text(lang, "descPh"),
|
|
7391
|
+
onChange: function(e) {
|
|
7392
|
+
setDesc(e.target.value);
|
|
7148
7393
|
}
|
|
7394
|
+
})
|
|
7395
|
+
),
|
|
7396
|
+
hh(
|
|
7397
|
+
"div",
|
|
7398
|
+
{ className: "wbs-field full" },
|
|
7399
|
+
hh("label", { className: "wbs-label" }, text(lang, "linkList")),
|
|
7400
|
+
links.map(function(l, i) {
|
|
7401
|
+
return hh(
|
|
7402
|
+
"div",
|
|
7403
|
+
{ className: "wbs-linkrow", key: i },
|
|
7404
|
+
hh("input", {
|
|
7405
|
+
className: "wbs-input",
|
|
7406
|
+
value: l.description,
|
|
7407
|
+
placeholder: text(lang, "linkDesc"),
|
|
7408
|
+
onChange: function(e) {
|
|
7409
|
+
updateLink(i, "description", e.target.value);
|
|
7410
|
+
}
|
|
7411
|
+
}),
|
|
7412
|
+
hh("input", {
|
|
7413
|
+
className: "wbs-input",
|
|
7414
|
+
value: l.link,
|
|
7415
|
+
placeholder: text(lang, "linkUrl"),
|
|
7416
|
+
onChange: function(e) {
|
|
7417
|
+
updateLink(i, "link", e.target.value);
|
|
7418
|
+
}
|
|
7419
|
+
}),
|
|
7420
|
+
hh(
|
|
7421
|
+
"label",
|
|
7422
|
+
{ className: "wbs-radio", title: text(lang, "setDefault") },
|
|
7423
|
+
hh("input", {
|
|
7424
|
+
type: "radio",
|
|
7425
|
+
name: "wbs-default-link",
|
|
7426
|
+
checked: defaultIdx === i,
|
|
7427
|
+
onChange: function() {
|
|
7428
|
+
setDefaultIdx(i);
|
|
7429
|
+
}
|
|
7430
|
+
}),
|
|
7431
|
+
text(lang, "default")
|
|
7432
|
+
),
|
|
7433
|
+
hh("button", { type: "button", className: "wbs-mini", title: text(lang, "removeLink"), onClick: function() {
|
|
7434
|
+
removeLink(i);
|
|
7435
|
+
} }, hh(Icon2, { name: "x", size: 13 }))
|
|
7436
|
+
);
|
|
7149
7437
|
}),
|
|
7150
|
-
|
|
7151
|
-
)
|
|
7152
|
-
})
|
|
7153
|
-
),
|
|
7154
|
-
h2("div", { className: "wbs-note", style: { marginTop: 8 } }, "\u7AD9\u70B9\u53EF\u540C\u65F6\u6302\u5728\u591A\u4E2A\u76EE\u5F55\u4E0B\uFF1B\u5217\u8868\u4F1A\u6309\u76EE\u5F55\u5B50\u6811\u8FC7\u6EE4\u3002")
|
|
7155
|
-
) : null,
|
|
7156
|
-
tagOn && step === 2 ? h2(
|
|
7157
|
-
"div",
|
|
7158
|
-
null,
|
|
7159
|
-
h2("div", { className: "wbs-label" }, text(lang, "chooseTags")),
|
|
7160
|
-
tags.length ? h2("div", { className: "wbs-chips" }, tags.map(function(t) {
|
|
7161
|
-
return h2(
|
|
7162
|
-
"span",
|
|
7163
|
-
{ className: "wbs-chip", key: t.id },
|
|
7164
|
-
t.name,
|
|
7165
|
-
h2("button", { type: "button", onClick: function() {
|
|
7166
|
-
toggleTag(t);
|
|
7167
|
-
}, title: "\u79FB\u9664" }, h2(Icon2, { name: "x", size: 12 }))
|
|
7438
|
+
hh("button", { type: "button", className: "wbs-btn sm", onClick: addLink }, hh(Icon2, { name: "plus", size: 13 }), text(lang, "addLink"))
|
|
7439
|
+
)
|
|
7168
7440
|
);
|
|
7169
|
-
}
|
|
7170
|
-
|
|
7171
|
-
"
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7441
|
+
},
|
|
7442
|
+
validate: function() {
|
|
7443
|
+
return String(name).trim() ? "" : text(lang, "requiredName");
|
|
7444
|
+
}
|
|
7445
|
+
},
|
|
7446
|
+
{
|
|
7447
|
+
key: "dirs",
|
|
7448
|
+
label: text(lang, "step2"),
|
|
7449
|
+
render: function(hh) {
|
|
7450
|
+
return hh(
|
|
7451
|
+
"div",
|
|
7452
|
+
{ className: "wbs-field" },
|
|
7453
|
+
hh("div", { className: "wbs-label" }, text(lang, "chooseDirs")),
|
|
7454
|
+
!flatDirs.length ? hh("div", { className: "wbs-note" }, text(lang, "noDirs")) : hh(
|
|
7455
|
+
"div",
|
|
7456
|
+
{ className: "wbs-dirlist" },
|
|
7457
|
+
flatDirs.map(function(item) {
|
|
7458
|
+
var id = String(item.node.id);
|
|
7459
|
+
return hh(
|
|
7460
|
+
"label",
|
|
7461
|
+
{
|
|
7462
|
+
key: id,
|
|
7463
|
+
className: "wbs-dircheck",
|
|
7464
|
+
style: { paddingLeft: 6 + item.depth * 16 }
|
|
7465
|
+
},
|
|
7466
|
+
hh("input", {
|
|
7467
|
+
type: "checkbox",
|
|
7468
|
+
checked: dirIds.indexOf(id) >= 0,
|
|
7469
|
+
onChange: function() {
|
|
7470
|
+
toggleDir(id);
|
|
7471
|
+
}
|
|
7472
|
+
}),
|
|
7473
|
+
hh("span", null, item.node.name)
|
|
7474
|
+
);
|
|
7475
|
+
})
|
|
7476
|
+
),
|
|
7477
|
+
hh("div", { className: "wbs-note", style: { marginTop: 8 } }, "\u7AD9\u70B9\u53EF\u540C\u65F6\u6302\u5728\u591A\u4E2A\u76EE\u5F55\u4E0B\uFF1B\u5217\u8868\u4F1A\u6309\u76EE\u5F55\u5B50\u6811\u8FC7\u6EE4\u3002")
|
|
7198
7478
|
);
|
|
7199
|
-
}
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7479
|
+
},
|
|
7480
|
+
validate: function() {
|
|
7481
|
+
return dirIds.length ? "" : text(lang, "requiredDirs");
|
|
7482
|
+
}
|
|
7483
|
+
},
|
|
7484
|
+
tagOn ? {
|
|
7485
|
+
key: "tags",
|
|
7486
|
+
label: text(lang, "step3"),
|
|
7487
|
+
optional: true,
|
|
7488
|
+
render: function(hh) {
|
|
7489
|
+
return hh(
|
|
7490
|
+
"div",
|
|
7491
|
+
{ className: "wbs-field" },
|
|
7492
|
+
hh("div", { className: "wbs-label" }, text(lang, "chooseTags")),
|
|
7493
|
+
tags.length ? hh("div", { className: "wbs-chips" }, tags.map(function(t) {
|
|
7494
|
+
return hh(
|
|
7495
|
+
"span",
|
|
7496
|
+
{ className: "wbs-chip", key: t.id },
|
|
7497
|
+
t.name,
|
|
7498
|
+
hh("button", { type: "button", onClick: function() {
|
|
7499
|
+
toggleTag(t);
|
|
7500
|
+
}, title: "\u79FB\u9664" }, hh(Icon2, { name: "x", size: 12 }))
|
|
7501
|
+
);
|
|
7502
|
+
})) : hh("div", { className: "wbs-note" }, "\u6682\u672A\u9009\u62E9\u6807\u7B7E"),
|
|
7503
|
+
hh(
|
|
7504
|
+
"div",
|
|
7505
|
+
{ className: "wbs-tagsearch", style: { marginTop: 10 } },
|
|
7506
|
+
hh("input", {
|
|
7507
|
+
className: "wbs-input",
|
|
7508
|
+
value: tagQuery,
|
|
7509
|
+
placeholder: text(lang, "tagSearch"),
|
|
7510
|
+
onChange: function(e) {
|
|
7511
|
+
setTagQuery(e.target.value);
|
|
7512
|
+
}
|
|
7513
|
+
})
|
|
7514
|
+
),
|
|
7515
|
+
hh("div", { className: "wbs-tagresults" }, tagResults.length ? tagResults.map(function(t) {
|
|
7516
|
+
var on = tags.some(function(x) {
|
|
7517
|
+
return x.id === t.id;
|
|
7518
|
+
});
|
|
7519
|
+
return hh(
|
|
7520
|
+
"button",
|
|
7521
|
+
{
|
|
7522
|
+
key: t.id,
|
|
7523
|
+
type: "button",
|
|
7524
|
+
className: "wbs-tagresult" + (on ? " on" : ""),
|
|
7525
|
+
onClick: function() {
|
|
7526
|
+
toggleTag(t);
|
|
7527
|
+
}
|
|
7528
|
+
},
|
|
7529
|
+
hh(Icon2, { name: on ? "check" : "plus", size: 12 }),
|
|
7530
|
+
hh("span", null, t.name)
|
|
7531
|
+
);
|
|
7532
|
+
}) : hh("div", { className: "wbs-note", style: { padding: 6 } }, text(lang, "noTags"))),
|
|
7533
|
+
hh("div", { className: "wbs-note", style: { marginTop: 8 } }, "\u6807\u7B7E\u7531\u6807\u7B7E\u5B50\u63D2\u4EF6\u63D0\u4F9B\uFF0C\u53EF\u591A\u9009\u3002")
|
|
7534
|
+
);
|
|
7535
|
+
}
|
|
7536
|
+
} : null
|
|
7537
|
+
].filter(Boolean);
|
|
7538
|
+
return h2(SiteFormDialog, {
|
|
7539
|
+
title,
|
|
7540
|
+
mode,
|
|
7541
|
+
cancelLabel: text(lang, "cancel"),
|
|
7542
|
+
steps,
|
|
7543
|
+
submitting: saving,
|
|
7544
|
+
error,
|
|
7545
|
+
onClose: props.onClose,
|
|
7546
|
+
onSubmit: save,
|
|
7547
|
+
submitText: text(lang, "save"),
|
|
7548
|
+
cancelText: text(lang, "cancel"),
|
|
7549
|
+
nextText: text(lang, "nextStep"),
|
|
7550
|
+
backText: text(lang, "back"),
|
|
7551
|
+
stepsLabel: text(lang, "createTitle")
|
|
7552
|
+
});
|
|
7213
7553
|
}
|
|
7214
7554
|
function DirModal(props) {
|
|
7215
7555
|
var api = props.api;
|
|
@@ -8036,7 +8376,7 @@ var createOverlay = require_overlay();
|
|
|
8036
8376
|
injectCss();
|
|
8037
8377
|
host.registerAddon({
|
|
8038
8378
|
id: "wb-addon-sites",
|
|
8039
|
-
version: "1.12.
|
|
8379
|
+
version: "1.12.11",
|
|
8040
8380
|
icon: icons.ICONS["globe"],
|
|
8041
8381
|
views: [
|
|
8042
8382
|
{ id: "stats", icon: tabIcon("chart"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: statsView.SitesStatsView },
|
package/lib/domain/accounts.js
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
requireVault,
|
|
35
35
|
flagsOfSite,
|
|
36
36
|
upsertAccountSecrets,
|
|
37
|
+
setAccountOf,
|
|
37
38
|
deleteAccountField,
|
|
38
39
|
deleteAccountSecrets,
|
|
39
40
|
} from "../infra/vault-link.js";
|
|
@@ -113,7 +114,7 @@ export async function createAccount(db, args, origin) {
|
|
|
113
114
|
try {
|
|
114
115
|
const values = {};
|
|
115
116
|
for (const item of fields) values[item.field] = item.value;
|
|
116
|
-
const writtenSet = await upsertAccountSecrets(siteId, id, values);
|
|
117
|
+
const writtenSet = await upsertAccountSecrets(siteId, id, values, account);
|
|
117
118
|
if (writtenSet.setId) rememberSet(db, id, writtenSet.setId, origin);
|
|
118
119
|
} catch (error) {
|
|
119
120
|
// 敏感字段未能全部落进保险箱:撤掉刚插入的账号,避免“半条账号”。
|
|
@@ -149,6 +150,8 @@ export async function updateAccount(db, args, origin) {
|
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
if (writtenSet.setId && !existing.vault_set_id) rememberSet(db, id, writtenSet.setId, origin);
|
|
153
|
+
// 登录名变了:集合上的「账号」展示值跟着改(集合不存在时静默忽略)。
|
|
154
|
+
if (account !== String(existing.account || "")) await setAccountOf(existing.site_id, id, account);
|
|
152
155
|
|
|
153
156
|
const ts = now();
|
|
154
157
|
tx(db, function () {
|
package/lib/index.js
CHANGED
|
@@ -100,7 +100,7 @@ export function apply(ctx) {
|
|
|
100
100
|
id: "wb-addon-sites",
|
|
101
101
|
title: "站点",
|
|
102
102
|
description: "站点收藏:目录树、链接与标签(标签需安装标签插件);含统计/记录/配置/数据四个视图",
|
|
103
|
-
version: "1.12.
|
|
103
|
+
version: "1.12.11",
|
|
104
104
|
category: "assets",
|
|
105
105
|
tables: ["site", "site_node", "site_node_mapping", "tag_mapping", "site_account", "site_account_external"],
|
|
106
106
|
sync: siteSync,
|
package/lib/infra/vault-link.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* sites 不持有任何密钥,也不直接读写 vault_* 表;所有动作走 vault 的 plugin 接口。
|
|
5
5
|
* 0.3.0 起一个账号 = 一个集合(集合名就是 accountId),密码/手机号/证件号是集合里的三条凭据;
|
|
6
|
+
* 0.4.0 起集合额外带 account 展示值(站点登录名,可空、可重复),幂等键仍是 accountId;
|
|
6
7
|
* 站点行只记 vault_set_id,用来发现「集合被删」这种失效状态。
|
|
7
8
|
*/
|
|
8
9
|
|
|
@@ -93,9 +94,10 @@ export async function accountSet(siteId, accountId) {
|
|
|
93
94
|
return (reply && reply.set) || null;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
/**
|
|
97
|
-
export async function upsertAccountSecrets(siteId, accountId, values) {
|
|
97
|
+
/** 把账号的若干敏感字段写进集合(按集合名幂等建集合,新建时带上账号展示值);返回集合 id。 */
|
|
98
|
+
export async function upsertAccountSecrets(siteId, accountId, values, account) {
|
|
98
99
|
const groupId = await groupOfSite(siteId);
|
|
100
|
+
const setAccount = String(account == null ? "" : account);
|
|
99
101
|
let setId = "";
|
|
100
102
|
for (const spec of ACCOUNT_FIELDS) {
|
|
101
103
|
if (values[spec.field] === undefined) continue;
|
|
@@ -106,6 +108,7 @@ export async function upsertAccountSecrets(siteId, accountId, values) {
|
|
|
106
108
|
subjectId: String(siteId),
|
|
107
109
|
groupId,
|
|
108
110
|
setName: String(accountId),
|
|
111
|
+
setAccount,
|
|
109
112
|
name: accountSecretName(accountId, spec.field),
|
|
110
113
|
kind: spec.kind,
|
|
111
114
|
secret: text,
|
|
@@ -116,6 +119,16 @@ export async function upsertAccountSecrets(siteId, accountId, values) {
|
|
|
116
119
|
return { setId };
|
|
117
120
|
}
|
|
118
121
|
|
|
122
|
+
/** 站点账号改名后同步集合上的「账号」展示值;集合尚不存在时静默忽略。 */
|
|
123
|
+
export async function setAccountOf(siteId, accountId, account) {
|
|
124
|
+
return call("vault.pluginSetAccount", {
|
|
125
|
+
subjectType: "site",
|
|
126
|
+
subjectId: String(siteId),
|
|
127
|
+
setName: String(accountId),
|
|
128
|
+
account: String(account == null ? "" : account),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
119
132
|
/** 摘掉账号集合里的一个字段(凭据不再属于任何集合时才被软删)。 */
|
|
120
133
|
export async function deleteAccountField(siteId, accountId, field) {
|
|
121
134
|
const groupId = await groupOfSite(siteId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-workbench-sites",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "个人工作台站点插件:目录树、链接与标签",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"id": "wb-addon-sites",
|
|
10
10
|
"title": "站点",
|
|
11
11
|
"description": "站点 + 统计/记录/配置/数据四个视图:目录树、链接与标签,附表数据浏览",
|
|
12
|
-
"version": "1.12.
|
|
12
|
+
"version": "1.12.11",
|
|
13
13
|
"minShell": "0.8.0",
|
|
14
14
|
"tables": [
|
|
15
15
|
"site",
|