@jc-times/business-ui 0.2.54 → 0.2.55
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/CHANGELOG.md +8 -1
- package/bin/business-ui-gate.mjs +0 -0
- package/dist/Cascader.js +8 -0
- package/dist/Combobox.js +104 -61
- package/dist/MultilineAutoComplete.js +80 -0
- package/dist/SortableList.js +141 -31
- package/dist/business-ui.js +14 -12
- package/dist/document-viewer/DocumentViewer.js +42 -42
- package/dist/document-viewer-v2/DocumentViewerV2.js +19 -15
- package/dist/document-viewer-v2/HeadlessPdfViewer.js +216 -182
- package/dist/pdfium-viewer.js +1 -0
- package/dist/sortable-transfer-scope.js +36 -0
- package/dist/styles.css +1 -1
- package/dist/types/Combobox.d.ts +1 -0
- package/dist/types/MultilineAutoComplete.d.ts +20 -0
- package/dist/types/SortableList.d.ts +19 -2
- package/dist/types/UserProfilePopover.d.ts +0 -1
- package/dist/types/document-viewer/DocumentViewer.d.ts +2 -0
- package/dist/types/document-viewer-v2/DocumentViewerV2.d.ts +1 -0
- package/dist/types/document-viewer-v2/HeadlessPdfViewer.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/sortable-transfer-scope.d.ts +30 -0
- package/docs/agent-guide.md +1 -1
- package/docs/api.md +1 -1
- package/docs/document-viewer-v2.md +5 -4
- package/docs/release.md +7 -6
- package/docs/sortable-list.md +1 -1
- package/docs/viewport-qa.md +9 -3
- package/package.json +167 -168
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
# 0.2.
|
|
1
|
+
# 0.2.55
|
|
2
|
+
|
|
3
|
+
- 修复 `SortableList` 空列表接收区缺少最小高度、空状态和根节点拖放高亮的问题。
|
|
4
|
+
- 修复 PDFium 折叠搜索收起后残留旧结果,以及隐藏内置工具栏时无法打开搜索的问题;移动工具栏过宽时可横向滚动。
|
|
5
|
+
- 文档查看器新增 `layoutMode="fill"`,统一弹窗、抽屉和 flex/grid 容器中的宽高与最小尺寸;PDFium 移动连续阅读模式由公共组件识别窄屏/触屏,并覆盖单页模式与文字选择,避免业务项目重复维护手机适配。
|
|
6
|
+
- npm 自动发布流程统一改为 npmjs 公共仓库,并从 `publishConfig.access` 读取访问级别。
|
|
7
|
+
|
|
8
|
+
# 0.2.53
|
|
2
9
|
|
|
3
10
|
- 新增 `UserProfilePopover`:紧凑的人员标签和只读资料卡,支持姓名、编号、部门、身份标签、头像与受控打开状态;资料卡随视口在 300–560px 间缩放,并保留键盘关闭与焦点归还。
|
|
4
11
|
|
package/bin/business-ui-gate.mjs
CHANGED
|
File without changes
|
package/dist/Cascader.js
CHANGED
|
@@ -53,6 +53,14 @@ function m(m) {
|
|
|
53
53
|
displayRender: (e) => e.join(" / "),
|
|
54
54
|
getPopupContainer: (e) => x instanceof HTMLElement ? x : e.ownerDocument.body,
|
|
55
55
|
popupMatchSelectWidth: !1,
|
|
56
|
+
popupAlign: {
|
|
57
|
+
htmlRegion: "visible",
|
|
58
|
+
overflow: {
|
|
59
|
+
adjustX: 1,
|
|
60
|
+
adjustY: 1,
|
|
61
|
+
shiftX: !0
|
|
62
|
+
}
|
|
63
|
+
},
|
|
56
64
|
components: { input: /* @__PURE__ */ d("input", {
|
|
57
65
|
...S,
|
|
58
66
|
ref: O,
|
package/dist/Combobox.js
CHANGED
|
@@ -1,106 +1,149 @@
|
|
|
1
1
|
import { useOverlayContainer as e } from "./OverlayContainer.js";
|
|
2
2
|
import { Check as t, ChevronDown as n, LoaderCircle as r } from "lucide-react";
|
|
3
|
-
import {
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { ListLayout as
|
|
3
|
+
import { useContext as i, useEffect as a, useId as o, useMemo as s, useRef as c } from "react";
|
|
4
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
|
+
import { Button as f, Collection as p, ComboBox as m, ComboBoxStateContext as h, Header as g, Input as _, Label as v, ListBox as y, ListBoxItem as b, ListBoxSection as x, Popover as S, Text as C } from "react-aria-components";
|
|
6
|
+
import { ListLayout as w, Virtualizer as T } from "react-aria-components/Virtualizer";
|
|
7
7
|
//#region src/Combobox.tsx
|
|
8
|
-
var
|
|
8
|
+
var E = {
|
|
9
9
|
rowSize: 48,
|
|
10
10
|
gap: 2,
|
|
11
11
|
padding: 4
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
let
|
|
13
|
+
function D({ items: i, label: a, placeholder: c = "搜索或选择", inputValue: h, defaultInputValue: D, selectedKey: k, defaultSelectedKey: A, onInputChange: j, onSelectionChange: M, loading: N = !1, disabled: P = !1, required: F = !1, allowsCustomValue: I = !1, emptyText: L = "没有匹配项", helpText: R, error: z, virtualized: B = i.length > 100, className: V = "", inputRef: H, inputProps: U, placement: W = "bottom start", portalContainer: G }) {
|
|
14
|
+
let K = `ui-combobox-${o().replaceAll(":", "")}`, q = e(G), J = s(() => Array.from(i), [i]), Y = s(() => {
|
|
15
|
+
let e = /* @__PURE__ */ new Map();
|
|
16
|
+
for (let t of J) {
|
|
17
|
+
let n = t.group ?? "";
|
|
18
|
+
e.has(n) || e.set(n, {
|
|
19
|
+
id: `group:${n}`,
|
|
20
|
+
label: n,
|
|
21
|
+
items: []
|
|
22
|
+
}), e.get(n).items.push(t);
|
|
23
|
+
}
|
|
24
|
+
return Array.from(e.values());
|
|
25
|
+
}, [J]), X = J.some((e) => e.group !== void 0), Z = (e) => /* @__PURE__ */ u(b, {
|
|
26
|
+
id: e.id,
|
|
27
|
+
textValue: e.label,
|
|
28
|
+
isDisabled: e.disabled,
|
|
29
|
+
className: "ui-combobox-item",
|
|
30
|
+
children: ({ isSelected: n }) => /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ d("span", { children: [/* @__PURE__ */ u("strong", { children: e.label }), e.description && /* @__PURE__ */ u("small", { children: e.description })] }), n && /* @__PURE__ */ u(t, {
|
|
31
|
+
size: 15,
|
|
32
|
+
"aria-hidden": "true"
|
|
33
|
+
})] })
|
|
34
|
+
}), Q = () => /* @__PURE__ */ u("div", {
|
|
35
|
+
className: "ui-combobox-empty",
|
|
36
|
+
children: N ? "正在加载…" : L
|
|
37
|
+
}), $ = X ? /* @__PURE__ */ u(y, {
|
|
15
38
|
className: "ui-combobox-list",
|
|
16
|
-
items:
|
|
17
|
-
layout:
|
|
18
|
-
renderEmptyState:
|
|
19
|
-
|
|
20
|
-
children: k ? "正在加载…" : N
|
|
21
|
-
}),
|
|
22
|
-
children: (e) => /* @__PURE__ */ s(m, {
|
|
39
|
+
items: Y,
|
|
40
|
+
layout: "stack",
|
|
41
|
+
renderEmptyState: Q,
|
|
42
|
+
children: (e) => /* @__PURE__ */ d(x, {
|
|
23
43
|
id: e.id,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
44
|
+
"aria-label": e.label || "选项",
|
|
45
|
+
children: [e.label && /* @__PURE__ */ u(g, {
|
|
46
|
+
className: "ui-combobox-group-heading",
|
|
47
|
+
children: e.label
|
|
48
|
+
}), /* @__PURE__ */ u(p, {
|
|
49
|
+
items: e.items,
|
|
50
|
+
children: Z
|
|
51
|
+
})]
|
|
31
52
|
})
|
|
53
|
+
}) : /* @__PURE__ */ u(y, {
|
|
54
|
+
className: "ui-combobox-list",
|
|
55
|
+
items: J,
|
|
56
|
+
layout: B ? "grid" : "stack",
|
|
57
|
+
renderEmptyState: Q,
|
|
58
|
+
children: Z
|
|
32
59
|
});
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
60
|
+
return /* @__PURE__ */ d(m, {
|
|
61
|
+
items: J,
|
|
62
|
+
className: `ui-combobox ${V}`.trim(),
|
|
63
|
+
inputValue: h,
|
|
64
|
+
defaultInputValue: D,
|
|
65
|
+
selectedKey: k,
|
|
66
|
+
defaultSelectedKey: A,
|
|
67
|
+
onInputChange: j,
|
|
68
|
+
onSelectionChange: (e) => M?.(e === null ? null : String(e)),
|
|
69
|
+
isDisabled: P,
|
|
70
|
+
isRequired: F,
|
|
71
|
+
allowsCustomValue: I,
|
|
44
72
|
menuTrigger: "focus",
|
|
45
|
-
"aria-label":
|
|
46
|
-
"aria-labelledby":
|
|
73
|
+
"aria-label": a === void 0 ? U?.["aria-label"] : void 0,
|
|
74
|
+
"aria-labelledby": a === void 0 ? U?.["aria-labelledby"] : void 0,
|
|
47
75
|
children: [
|
|
48
|
-
|
|
76
|
+
a === void 0 ? null : /* @__PURE__ */ d(v, {
|
|
49
77
|
className: "ui-form-label",
|
|
50
|
-
children: [
|
|
78
|
+
children: [a, F && /* @__PURE__ */ u("span", {
|
|
51
79
|
className: "ui-form-required",
|
|
52
80
|
"aria-hidden": "true",
|
|
53
81
|
children: "*"
|
|
54
82
|
})]
|
|
55
83
|
}),
|
|
56
|
-
/* @__PURE__ */
|
|
84
|
+
I && /* @__PURE__ */ u(O, {
|
|
85
|
+
count: J.length,
|
|
86
|
+
loading: N
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ d("div", {
|
|
57
89
|
className: "ui-combobox-control",
|
|
58
|
-
children: [/* @__PURE__ */
|
|
59
|
-
...
|
|
60
|
-
ref:
|
|
61
|
-
id:
|
|
90
|
+
children: [/* @__PURE__ */ u(_, {
|
|
91
|
+
...U,
|
|
92
|
+
ref: H,
|
|
93
|
+
id: K,
|
|
62
94
|
className: "ui-input",
|
|
63
|
-
placeholder:
|
|
64
|
-
"aria-invalid":
|
|
65
|
-
}), /* @__PURE__ */
|
|
95
|
+
placeholder: c,
|
|
96
|
+
"aria-invalid": z ? !0 : U?.["aria-invalid"]
|
|
97
|
+
}), /* @__PURE__ */ u(f, {
|
|
66
98
|
className: "ui-combobox-trigger",
|
|
67
99
|
"aria-label": "展开选项",
|
|
68
|
-
children:
|
|
100
|
+
children: N ? /* @__PURE__ */ u(r, {
|
|
69
101
|
className: "spin",
|
|
70
102
|
size: 16
|
|
71
|
-
}) : /* @__PURE__ */
|
|
103
|
+
}) : /* @__PURE__ */ u(n, { size: 16 })
|
|
72
104
|
})]
|
|
73
105
|
}),
|
|
74
|
-
|
|
106
|
+
R === void 0 ? null : /* @__PURE__ */ u(C, {
|
|
75
107
|
slot: "description",
|
|
76
108
|
className: "ui-form-help",
|
|
77
|
-
children:
|
|
109
|
+
children: R
|
|
78
110
|
}),
|
|
79
|
-
|
|
111
|
+
z === void 0 || z === "" ? null : /* @__PURE__ */ u(C, {
|
|
80
112
|
slot: "errorMessage",
|
|
81
113
|
className: "ui-form-error",
|
|
82
|
-
children:
|
|
114
|
+
children: z
|
|
83
115
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ d(S, {
|
|
85
117
|
className: "ui-combobox-popover",
|
|
86
118
|
"data-ui-aria-overlay": "",
|
|
87
119
|
maxHeight: 320,
|
|
88
|
-
placement:
|
|
89
|
-
UNSTABLE_portalContainer:
|
|
90
|
-
children: [
|
|
120
|
+
placement: W,
|
|
121
|
+
UNSTABLE_portalContainer: q,
|
|
122
|
+
children: [N && /* @__PURE__ */ d("div", {
|
|
91
123
|
className: "ui-combobox-loading",
|
|
92
|
-
children: [/* @__PURE__ */
|
|
124
|
+
children: [/* @__PURE__ */ u(r, {
|
|
93
125
|
className: "spin",
|
|
94
126
|
size: 15
|
|
95
127
|
}), "正在加载"]
|
|
96
|
-
}),
|
|
97
|
-
layout:
|
|
98
|
-
layoutOptions:
|
|
99
|
-
children:
|
|
100
|
-
}) :
|
|
128
|
+
}), B ? /* @__PURE__ */ u(T, {
|
|
129
|
+
layout: w,
|
|
130
|
+
layoutOptions: E,
|
|
131
|
+
children: $
|
|
132
|
+
}) : $]
|
|
101
133
|
})
|
|
102
134
|
]
|
|
103
135
|
});
|
|
104
136
|
}
|
|
137
|
+
function O({ count: e, loading: t }) {
|
|
138
|
+
let n = i(h), r = c(n);
|
|
139
|
+
return r.current = n, a(() => {
|
|
140
|
+
let n = r.current;
|
|
141
|
+
e && !t && n?.isFocused && !n.isOpen && n.open(null, "manual");
|
|
142
|
+
}, [
|
|
143
|
+
e,
|
|
144
|
+
t,
|
|
145
|
+
n?.collection.size
|
|
146
|
+
]), null;
|
|
147
|
+
}
|
|
105
148
|
//#endregion
|
|
106
|
-
export {
|
|
149
|
+
export { D as Combobox };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useOverlayContainer as e } from "./OverlayContainer.js";
|
|
2
|
+
import { useRef as t, useState as n } from "react";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import { Autocomplete as a, Label as o, ListBox as s, ListBoxItem as c, Popover as l, TextArea as u, TextField as d } from "react-aria-components";
|
|
5
|
+
//#region src/MultilineAutoComplete.tsx
|
|
6
|
+
function f(f) {
|
|
7
|
+
let p = t(null), m = t(null), [h, g] = n(!1), [_, v] = n(!1), y = e(f.portalContainer), b = f.items.filter((e) => e.label.toLocaleLowerCase().includes(f.value.toLocaleLowerCase()));
|
|
8
|
+
return /* @__PURE__ */ i("div", {
|
|
9
|
+
className: `ui-multiline-autocomplete ${f.className ?? ""}`,
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ i(a, {
|
|
12
|
+
disableAutoFocusFirst: !0,
|
|
13
|
+
inputValue: f.value,
|
|
14
|
+
onInputChange: (e) => {
|
|
15
|
+
v(!1), f.onChange(e);
|
|
16
|
+
},
|
|
17
|
+
children: [/* @__PURE__ */ i(d, {
|
|
18
|
+
"aria-label": f["aria-label"],
|
|
19
|
+
isDisabled: f.disabled,
|
|
20
|
+
onFocus: () => {
|
|
21
|
+
g(!0), v(!1), f.onFocus?.();
|
|
22
|
+
},
|
|
23
|
+
onBlur: (e) => {
|
|
24
|
+
m.current?.contains(e.relatedTarget) || (g(!1), f.onBlur?.());
|
|
25
|
+
},
|
|
26
|
+
children: [f.label !== void 0 && /* @__PURE__ */ r(o, {
|
|
27
|
+
className: "ui-form-label",
|
|
28
|
+
children: f.label
|
|
29
|
+
}), /* @__PURE__ */ r(u, {
|
|
30
|
+
ref: p,
|
|
31
|
+
className: "ui-input ui-multiline-input",
|
|
32
|
+
placeholder: f.placeholder,
|
|
33
|
+
rows: Math.min(6, f.value.split("\n").length)
|
|
34
|
+
})]
|
|
35
|
+
}), /* @__PURE__ */ r(l, {
|
|
36
|
+
ref: m,
|
|
37
|
+
triggerRef: p,
|
|
38
|
+
isNonModal: !0,
|
|
39
|
+
isOpen: h && !_ && !f.disabled && b.length > 0,
|
|
40
|
+
onOpenChange: (e) => {
|
|
41
|
+
e || v(!0);
|
|
42
|
+
},
|
|
43
|
+
UNSTABLE_portalContainer: y,
|
|
44
|
+
placement: "bottom start",
|
|
45
|
+
className: "ui-combobox-popover",
|
|
46
|
+
"data-ui-aria-overlay": "",
|
|
47
|
+
maxHeight: 260,
|
|
48
|
+
children: /* @__PURE__ */ r(s, {
|
|
49
|
+
"aria-label": "输入建议",
|
|
50
|
+
className: "ui-combobox-list",
|
|
51
|
+
items: b,
|
|
52
|
+
selectionMode: "none",
|
|
53
|
+
onAction: (e) => {
|
|
54
|
+
let t = b.find((t) => t.id === String(e));
|
|
55
|
+
t && !t.disabled && (f.onChange(t.label), f.onSelect?.(t), v(!0), p.current?.focus());
|
|
56
|
+
},
|
|
57
|
+
children: (e) => /* @__PURE__ */ r(c, {
|
|
58
|
+
id: e.id,
|
|
59
|
+
textValue: e.label,
|
|
60
|
+
isDisabled: e.disabled,
|
|
61
|
+
className: "ui-combobox-item",
|
|
62
|
+
children: /* @__PURE__ */ i("span", { children: [/* @__PURE__ */ r("strong", { children: e.label }), e.description && /* @__PURE__ */ r("small", { children: e.description })] })
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
})]
|
|
66
|
+
}),
|
|
67
|
+
f.loading && /* @__PURE__ */ r("span", {
|
|
68
|
+
role: "status",
|
|
69
|
+
className: "ui-form-help",
|
|
70
|
+
children: "正在查找…"
|
|
71
|
+
}),
|
|
72
|
+
f.helpText && /* @__PURE__ */ r("span", {
|
|
73
|
+
className: "ui-form-help",
|
|
74
|
+
children: f.helpText
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { f as MultilineAutoComplete };
|
package/dist/SortableList.js
CHANGED
|
@@ -1,45 +1,155 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { activeSortableTransfer as e, beginSortableTransfer as t, consumeSortableTransfer as n, endSortableTransfer as r, hasUniqueSortableTarget as i, registerSortableTarget as a, routeSortableTarget as o, useSortableTransferScope as s } from "./sortable-transfer-scope.js";
|
|
2
|
+
import { GripVertical as c } from "lucide-react";
|
|
3
|
+
import { useEffect as l, useLayoutEffect as u, useMemo as d, useRef as f } from "react";
|
|
4
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
5
|
+
import { Button as h, GridList as g, GridListItem as _, useDragAndDrop as v } from "react-aria-components";
|
|
5
6
|
//#region src/SortableList.tsx
|
|
6
|
-
function
|
|
7
|
-
let
|
|
7
|
+
function y(s) {
|
|
8
|
+
let y = f(/* @__PURE__ */ new Set()), x = f({ mime: `application/x-ui-sortable-${Math.random().toString(36).slice(2)}` }).current, S = s.transferScope?.mime ?? x.mime, C = f(s);
|
|
9
|
+
C.current = s, l(() => () => {
|
|
10
|
+
r(s.transferScope, x);
|
|
11
|
+
}, [s.transferScope, x]), l(() => {
|
|
12
|
+
s.disabled && (y.current.clear(), r(s.transferScope, x));
|
|
13
|
+
}, [
|
|
14
|
+
s.disabled,
|
|
15
|
+
s.transferScope,
|
|
16
|
+
x
|
|
17
|
+
]);
|
|
18
|
+
let w = d(() => s.items.map((e, t) => ({
|
|
8
19
|
item: e,
|
|
9
20
|
index: t,
|
|
10
|
-
key:
|
|
11
|
-
})), [
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
key: s.getKey(e)
|
|
22
|
+
})), [s.items, s.getKey]), T = d(() => {
|
|
23
|
+
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
24
|
+
for (let n of w) e.has(n.key) && t.add(n.key), e.set(n.key, n);
|
|
25
|
+
return {
|
|
26
|
+
index: e,
|
|
27
|
+
duplicates: t
|
|
28
|
+
};
|
|
29
|
+
}, [w]), E = f(T);
|
|
30
|
+
E.current = T;
|
|
31
|
+
function D(e) {
|
|
32
|
+
let t = [...e].map((e) => E.current.duplicates.has(e) ? void 0 : E.current.index.get(e));
|
|
33
|
+
return t.some((e) => !e) ? [] : t.sort((e, t) => e.index - t.index).map((e) => e.item);
|
|
34
|
+
}
|
|
35
|
+
function O() {
|
|
36
|
+
let t = e(s.transferScope), n = t?.keys ?? y.current;
|
|
37
|
+
return {
|
|
38
|
+
keys: n,
|
|
39
|
+
moving: t ? t.consumed ? [] : t.resolve() : s.transferScope ? [] : D(n),
|
|
40
|
+
external: !!(t && t.source !== x)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function k() {
|
|
44
|
+
let t = e(s.transferScope);
|
|
45
|
+
return {
|
|
46
|
+
sourceListId: t ? t.sourceListId : s.listId,
|
|
47
|
+
targetListId: s.listId
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function A() {
|
|
51
|
+
let e = O();
|
|
52
|
+
return !s.disabled && s.transferScope?.targets.has(x) && e.external && e.moving.length > 0 && e.moving.length === e.keys.size && ![...e.keys].some((e) => T.index.has(e)) && s.onDropOnList && (!s.canDropOnList || s.canDropOnList(e.moving)) ? e : null;
|
|
53
|
+
}
|
|
54
|
+
function j(e, t) {
|
|
55
|
+
let { keys: n, moving: r, external: a } = O(), o = T.index.get(e)?.item;
|
|
56
|
+
if (s.disabled || s.transferScope && !s.transferScope.targets.has(x) || o === void 0 || T.duplicates.has(e) || !i(s.transferScope, e) || !r.length || r.length !== n.size || n.has(e)) return null;
|
|
57
|
+
if (t === "on") {
|
|
58
|
+
if (!s.onDropOnItem || s.canDropOnItem && !s.canDropOnItem(r, o)) return null;
|
|
59
|
+
} else if (a && (!s.onDropBetweenItems || s.canDropBetweenItems && !s.canDropBetweenItems(r, o, t))) return null;
|
|
60
|
+
return {
|
|
61
|
+
moving: r,
|
|
62
|
+
target: o,
|
|
63
|
+
keys: n,
|
|
64
|
+
external: a
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
let M = f(N);
|
|
68
|
+
M.current = N, u(() => a(s.transferScope, x, {
|
|
69
|
+
accepts: (e) => E.current.index.has(e),
|
|
70
|
+
commit: (e, t) => M.current(e, t)
|
|
71
|
+
}), [s.transferScope, x]);
|
|
72
|
+
function N(e, t) {
|
|
73
|
+
let r = j(e, t);
|
|
74
|
+
if (!r) {
|
|
75
|
+
T.index.has(e) || o(s.transferScope, x, e, t);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
n(s.transferScope), t === "on" ? s.onDropOnItem?.(r.moving, r.target, k()) : r.external ? s.onDropBetweenItems?.(r.moving, r.target, t, k()) : s.onReorder(b(s.items, r.keys, e, t, s.getKey));
|
|
79
|
+
}
|
|
80
|
+
function P(e) {
|
|
81
|
+
let n = new Set(e);
|
|
82
|
+
y.current = n;
|
|
83
|
+
let r = s.transferScope;
|
|
84
|
+
t(r, {
|
|
85
|
+
source: x,
|
|
86
|
+
sourceListId: s.listId,
|
|
87
|
+
keys: n,
|
|
88
|
+
resolve: () => C.current.disabled || C.current.transferScope !== r || [...n].some((e) => !i(r, e)) ? [] : D(n)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
let { dragAndDropHooks: F } = v({
|
|
92
|
+
isDisabled: s.disabled,
|
|
93
|
+
getItems: (e) => (P(e), [...e].map((e) => ({
|
|
94
|
+
"text/plain": String(e),
|
|
95
|
+
[S]: String(e)
|
|
96
|
+
}))),
|
|
14
97
|
getAllowedDropOperations: () => ["move"],
|
|
15
|
-
|
|
98
|
+
onDragStart: (e) => P(e.keys),
|
|
99
|
+
onDragEnd: () => {
|
|
100
|
+
y.current.clear(), r(s.transferScope, x);
|
|
101
|
+
},
|
|
102
|
+
shouldAcceptItemDrop: (e, t) => t.has(S) && !!j(e.key, "on"),
|
|
103
|
+
getDropOperation: (e, t) => t.has(S) && (e.type === "root" ? A() : j(e.key, e.dropPosition)) ? "move" : "cancel",
|
|
104
|
+
onRootDrop: () => {
|
|
105
|
+
let e = A();
|
|
106
|
+
e && (n(s.transferScope), s.onDropOnList?.(e.moving, k()));
|
|
107
|
+
},
|
|
108
|
+
onMove: (e) => N(e.target.key, e.target.dropPosition),
|
|
109
|
+
onInsert: s.transferScope && s.onDropBetweenItems ? (e) => N(e.target.key, e.target.dropPosition) : void 0,
|
|
110
|
+
onItemDrop: s.transferScope && s.onDropOnItem ? (e) => N(e.target.key, "on") : void 0
|
|
16
111
|
});
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
"aria-label":
|
|
19
|
-
items:
|
|
112
|
+
return /* @__PURE__ */ p(g, {
|
|
113
|
+
"aria-label": s["aria-label"],
|
|
114
|
+
items: w,
|
|
115
|
+
renderEmptyState: s.renderEmptyState ?? (() => /* @__PURE__ */ p("span", {
|
|
116
|
+
className: "ui-sortable-empty",
|
|
117
|
+
children: s.onDropOnList && !s.disabled ? "拖动项目到此处" : "暂无项目"
|
|
118
|
+
})),
|
|
20
119
|
selectionMode: "none",
|
|
21
|
-
dragAndDropHooks:
|
|
22
|
-
className: ["ui-sortable-list",
|
|
23
|
-
children: ({ item:
|
|
24
|
-
id:
|
|
25
|
-
textValue:
|
|
120
|
+
dragAndDropHooks: F,
|
|
121
|
+
className: ["ui-sortable-list", s.className].filter(Boolean).join(" "),
|
|
122
|
+
children: ({ item: e, index: t, key: n }) => /* @__PURE__ */ m(_, {
|
|
123
|
+
id: n,
|
|
124
|
+
textValue: s.getTextValue(e, t),
|
|
26
125
|
className: "ui-sortable-item",
|
|
27
|
-
children: [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"aria-label": c.dragLabel?.(t, a) ?? `拖动第 ${a + 1} 项排序`,
|
|
31
|
-
children: /* @__PURE__ */ n(e, {
|
|
126
|
+
children: [
|
|
127
|
+
!s.disabled && /* @__PURE__ */ p("span", {
|
|
128
|
+
className: "ui-sortable-placeholder",
|
|
32
129
|
"aria-hidden": "true",
|
|
33
|
-
|
|
130
|
+
children: s.draggingLabel ?? "原位置保留,松开后移动"
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ p(h, {
|
|
133
|
+
slot: "drag",
|
|
134
|
+
className: "ui-sortable-handle",
|
|
135
|
+
isDisabled: s.disabled,
|
|
136
|
+
style: s.disabled ? { display: "none" } : void 0,
|
|
137
|
+
"aria-label": s.dragLabel?.(e, t) ?? `拖动第 ${t + 1} 项排序`,
|
|
138
|
+
children: /* @__PURE__ */ p(c, {
|
|
139
|
+
"aria-hidden": "true",
|
|
140
|
+
size: 18
|
|
141
|
+
})
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ p("div", {
|
|
144
|
+
className: "ui-sortable-content",
|
|
145
|
+
style: s.disabled ? { gridColumn: "1 / -1" } : void 0,
|
|
146
|
+
children: s.renderItem(e, t)
|
|
34
147
|
})
|
|
35
|
-
|
|
36
|
-
className: "ui-sortable-content",
|
|
37
|
-
children: c.renderItem(t, a)
|
|
38
|
-
})]
|
|
148
|
+
]
|
|
39
149
|
})
|
|
40
150
|
});
|
|
41
151
|
}
|
|
42
|
-
function
|
|
152
|
+
function b(e, t, n, r, i) {
|
|
43
153
|
let a = e.filter((e) => t.has(i(e)));
|
|
44
154
|
if (!a.length || r === "on") return e;
|
|
45
155
|
let o = e.filter((e) => !t.has(i(e))), s = o.findIndex((e) => i(e) === n);
|
|
@@ -52,4 +162,4 @@ function l(e, t, n, r, i) {
|
|
|
52
162
|
];
|
|
53
163
|
}
|
|
54
164
|
//#endregion
|
|
55
|
-
export {
|
|
165
|
+
export { y as SortableList, b as moveSortableItems, s as useSortableTransferScope };
|
package/dist/business-ui.js
CHANGED
|
@@ -31,15 +31,17 @@ import { Badge as Q } from "./Badge.js";
|
|
|
31
31
|
import { MetricCard as $ } from "./MetricCard.js";
|
|
32
32
|
import { PageHeader as ee } from "./PageHeader.js";
|
|
33
33
|
import { SectionCard as te } from "./SectionCard.js";
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
|
|
34
|
+
import { useSortableTransferScope as ne } from "./sortable-transfer-scope.js";
|
|
35
|
+
import { SortableList as re, moveSortableItems as ie } from "./SortableList.js";
|
|
36
|
+
import { TreeSelect as ae, buildTreeSelectTree as oe, filterTreeSelectTree as se } from "./TreeSelect.js";
|
|
37
|
+
import { Cascader as ce, buildCascaderOptions as le, indexCascaderPaths as ue } from "./Cascader.js";
|
|
38
|
+
import { StructuredAddressInput as de, findAddressRegionPath as fe, flattenAddressRegions as pe, searchAddressRegions as me } from "./StructuredAddressInput.js";
|
|
39
|
+
import { FileDropzone as he, acceptsFile as ge } from "./FileDropzone.js";
|
|
40
|
+
import { useFilePreparation as _e } from "./useFilePreparation.js";
|
|
41
|
+
import { FilePreparationDialog as ve } from "./FilePreparationDialog.js";
|
|
42
|
+
import { PreparedFileDropzone as ye } from "./PreparedFileDropzone.js";
|
|
43
|
+
import { formatDecimalAmount as be, formatScaledMoney as xe } from "./amount-format.js";
|
|
44
|
+
import { NumericInput as Se, ScaledNumericInput as Ce } from "./NumericInput.js";
|
|
45
|
+
import { MultiSelect as we } from "./MultiSelect.js";
|
|
46
|
+
import { MultilineAutoComplete as Te } from "./MultilineAutoComplete.js";
|
|
47
|
+
export { r as Alert, q as AsyncDirectoryPicker, K as AsyncSearchPicker, U as AsyncState, v as AutoComplete, y as Autocomplete, Q as Badge, e as Button, ce as Cascader, d as Checkbox, _ as Combobox, X as ConfirmDialog, w as DataTable, C as DataTableMergedRows, S as DataTableTheme, T as DataTableView, j as DateInput, k as Dialog, J as DropdownMenu, i as EmptyState, O as ExplainableButton, he as FileDropzone, ve as FilePreparationDialog, f as FormField, t as LinkButton, Y as Menu, $ as MetricCard, A as ModalShell, we as MultiSelect, Te as MultilineAutoComplete, Se as NumericInput, ee as PageHeader, P as Pagination, s as Popconfirm, c as Popover, ye as PreparedFileDropzone, W as RecoverableAsyncState, R as RovingTabList, z as RovingTabPanel, Ce as ScaledNumericInput, te as SectionCard, H as SegmentedControl, g as Select, p as SelectInput, a as Skeleton, o as SkeletonText, re as SortableList, de as StructuredAddressInput, m as TextArea, h as TextInput, b as ToastProvider, V as ToggleSwitch, l as Tooltip, ae as TreeSelect, u as UserProfilePopover, ge as acceptsFile, le as buildCascaderOptions, oe as buildTreeSelectTree, n as buttonClassName, M as calendarDays, F as clampPage, se as filterTreeSelectTree, fe as findAddressRegionPath, pe as flattenAddressRegions, be as formatDecimalAmount, xe as formatScaledMoney, ue as indexCascaderPaths, ie as moveSortableItems, B as nextRovingTabValue, I as pageCount, N as parseDate, me as searchAddressRegions, E as sortRows, D as useDataTable, Z as useDebouncedValue, _e as useFilePreparation, G as useModalFocusTrap, ne as useSortableTransferScope, x as useToast, L as visiblePages };
|