@jc-times/business-ui 0.2.55 → 0.3.1
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/AGENTS.md +6 -6
- package/CHANGELOG.md +315 -307
- package/README.md +48 -48
- package/THIRD_PARTY_NOTICES.md +18 -18
- package/bin/business-ui-gate.mjs +171 -171
- package/dist/Alert.js +5 -1
- package/dist/Button.js +1 -1
- package/dist/Cascader.js +19 -19
- package/dist/Combobox.js +38 -38
- package/dist/DataTableIcons.js +25 -25
- package/dist/DateInput.js +67 -67
- package/dist/DropdownMenu.js +35 -35
- package/dist/EmptyState.js +8 -8
- package/dist/ExplainableButton.js +11 -11
- package/dist/FloatingControls.js +31 -31
- package/dist/ModalShell.js +32 -32
- package/dist/MultiSelect.js +37 -37
- package/dist/Pagination.js +27 -27
- package/dist/RecoverableAsyncState.js +8 -8
- package/dist/Select.js +17 -17
- package/dist/SortableList.js +18 -18
- package/dist/Toast.js +30 -30
- package/dist/TreeSelect.js +107 -107
- package/dist/data-table.js +71 -71
- package/dist/document-viewer/PdfToolbar.js +12 -12
- package/dist/document-viewer/PdfWorkspace.js +15 -15
- package/dist/document-viewer-v2/HeadlessPdfViewer.js +6 -6
- package/dist/form-controls.js +4 -0
- package/dist/types/form-controls.d.ts +8 -0
- package/dist/vendor/embedpdf-zoom-react.js +3 -186
- package/dist/vendor/embedpdf-zoom-react10.js +6 -0
- package/dist/vendor/embedpdf-zoom-react11.js +30 -0
- package/dist/vendor/embedpdf-zoom-react12.js +16 -0
- package/dist/vendor/embedpdf-zoom-react13.js +15 -0
- package/dist/vendor/embedpdf-zoom-react14.js +33 -0
- package/dist/vendor/embedpdf-zoom-react15.js +20 -0
- package/dist/vendor/embedpdf-zoom-react16.js +26 -0
- package/dist/vendor/embedpdf-zoom-react17.js +25 -0
- package/dist/vendor/embedpdf-zoom-react18.js +17 -0
- package/dist/vendor/embedpdf-zoom-react19.js +187 -0
- package/dist/vendor/embedpdf-zoom-react2.js +13 -0
- package/dist/vendor/embedpdf-zoom-react3.js +14 -0
- package/dist/vendor/embedpdf-zoom-react4.js +8 -0
- package/dist/vendor/embedpdf-zoom-react5.js +4 -0
- package/dist/vendor/embedpdf-zoom-react6.js +14 -0
- package/dist/vendor/embedpdf-zoom-react7.js +40 -0
- package/dist/vendor/embedpdf-zoom-react8.js +17 -0
- package/dist/vendor/embedpdf-zoom-react9.js +7 -0
- package/docs/agent-guide.md +170 -168
- package/docs/api.md +252 -248
- package/docs/cascader.md +58 -58
- package/docs/component-strategy.md +93 -93
- package/docs/data-table.md +127 -127
- package/docs/document-viewer-v2.md +265 -265
- package/docs/modal-shell-migration.md +43 -43
- package/docs/mrt-poc.md +1 -1
- package/docs/sortable-list.md +42 -42
- package/docs/user-profile.md +17 -17
- package/docs/viewport-qa.md +126 -126
- package/licenses/rc-cascader-MIT.txt +21 -21
- package/package.json +5 -1
package/dist/data-table.js
CHANGED
|
@@ -4,9 +4,9 @@ import { DataTableTheme as n } from "./DataTableTheme.js";
|
|
|
4
4
|
import { icons as r } from "./DataTableIcons.js";
|
|
5
5
|
import { DataTableHorizontalScrollbar as i } from "./DataTableHorizontalScrollbar.js";
|
|
6
6
|
import { DataTableMergedRows as a } from "./DataTableMergedRows.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { memo as o, useCallback as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
8
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
import { ArrowDown as p, ArrowUp as m, ChevronsUpDown as h } from "lucide-react";
|
|
10
10
|
import { MRT_Table as g, MaterialReactTable as _, useMaterialReactTable as v } from "material-react-table";
|
|
11
11
|
import { MRT_Localization_ZH_HANS as y } from "material-react-table/locales/zh-Hans";
|
|
12
12
|
//#region src/DataTable.tsx
|
|
@@ -22,54 +22,54 @@ function x(e) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
function S({ table: e, stickyHorizontalScrollbar: t = !1, horizontalScrollbarLabel: r }) {
|
|
25
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ d(n, { children: /* @__PURE__ */ d(i, {
|
|
26
26
|
enabled: t,
|
|
27
27
|
label: r,
|
|
28
|
-
children: /* @__PURE__ */
|
|
28
|
+
children: /* @__PURE__ */ d(_, { table: e })
|
|
29
29
|
}) });
|
|
30
30
|
}
|
|
31
31
|
function C(e) {
|
|
32
|
-
return "options" in e ? /* @__PURE__ */
|
|
32
|
+
return "options" in e ? /* @__PURE__ */ d(w, { ...e }) : /* @__PURE__ */ d(n, { children: /* @__PURE__ */ d(T, { ...e }) });
|
|
33
33
|
}
|
|
34
34
|
function w({ options: e, stickyHorizontalScrollbar: t, horizontalScrollbarLabel: n }) {
|
|
35
35
|
let r = x(e);
|
|
36
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ d(S, {
|
|
37
37
|
table: r,
|
|
38
38
|
stickyHorizontalScrollbar: t,
|
|
39
39
|
horizontalScrollbarLabel: n
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
function T({ rows: n, columns: r, getRowId: a, caption: o, sort:
|
|
43
|
-
let [
|
|
42
|
+
function T({ rows: n, columns: r, getRowId: a, caption: o, sort: p, defaultSort: m = null, onSortChange: h, sortMode: _ = "client", selectionSummary: y = !0, selectPageLabel: b = "选择本页全部", renderSelectionActions: x, hiddenColumnIds: S, selectedRowIds: C, onSelectedRowIdsChange: w, getRowDisabled: T, loading: D = !1, loadingRows: k = 4, emptyTitle: M = "暂无数据", emptyDescription: N, emptyAction: P, mobileLayout: ee = "scroll", className: te = "", stickyHorizontalScrollbar: F = !1, horizontalScrollbarLabel: I, rootRef: L, rootProps: R, tableRef: z, tableProps: B }) {
|
|
43
|
+
let [V, H] = u(m), U = p === void 0 ? V : p, W = c(() => _ === "server" ? n : E(n, r, U), [
|
|
44
44
|
n,
|
|
45
45
|
r,
|
|
46
|
-
|
|
46
|
+
U,
|
|
47
47
|
_
|
|
48
|
-
]),
|
|
48
|
+
]), G = c(() => r.filter((e) => !S?.has(e.id)), [r, S]), K = c(() => W.map((e) => ({
|
|
49
49
|
row: e,
|
|
50
50
|
id: a(e),
|
|
51
51
|
disabled: T?.(e) ?? !1
|
|
52
52
|
})), [
|
|
53
|
-
|
|
53
|
+
W,
|
|
54
54
|
a,
|
|
55
55
|
T
|
|
56
|
-
]),
|
|
56
|
+
]), q = c(() => K.filter((e) => !e.disabled), [K]), J = c(() => {
|
|
57
57
|
let e = 0;
|
|
58
|
-
for (let t of
|
|
58
|
+
for (let t of q) C?.has(t.id) && (e += 1);
|
|
59
59
|
return e;
|
|
60
|
-
}, [
|
|
61
|
-
function
|
|
60
|
+
}, [q, C]), Y = q.length > 0 && J === q.length, X = J > 0 && !Y;
|
|
61
|
+
function Z(e) {
|
|
62
62
|
if (!(e.sortValue || _ === "server" && e.sortable)) return;
|
|
63
|
-
let t =
|
|
63
|
+
let t = U?.columnId === e.id ? U.direction === "ascending" ? {
|
|
64
64
|
columnId: e.id,
|
|
65
65
|
direction: "descending"
|
|
66
66
|
} : null : {
|
|
67
67
|
columnId: e.id,
|
|
68
68
|
direction: "ascending"
|
|
69
69
|
};
|
|
70
|
-
|
|
70
|
+
H(t), h?.(t);
|
|
71
71
|
}
|
|
72
|
-
let Q =
|
|
72
|
+
let Q = l({
|
|
73
73
|
selectedRowIds: C,
|
|
74
74
|
onSelectedRowIdsChange: w
|
|
75
75
|
});
|
|
@@ -77,7 +77,7 @@ function T({ rows: n, columns: r, getRowId: a, caption: o, sort: s, defaultSort:
|
|
|
77
77
|
selectedRowIds: C,
|
|
78
78
|
onSelectedRowIdsChange: w
|
|
79
79
|
};
|
|
80
|
-
let ne =
|
|
80
|
+
let ne = s((e) => {
|
|
81
81
|
let t = Q.current;
|
|
82
82
|
if (!t.onSelectedRowIdsChange) return;
|
|
83
83
|
let n = new Set(t.selectedRowIds ?? []);
|
|
@@ -86,53 +86,53 @@ function T({ rows: n, columns: r, getRowId: a, caption: o, sort: s, defaultSort:
|
|
|
86
86
|
function re() {
|
|
87
87
|
if (!w) return;
|
|
88
88
|
let e = new Set(C ?? []);
|
|
89
|
-
for (let t of
|
|
89
|
+
for (let t of q) Y ? e.delete(t.id) : e.add(t.id);
|
|
90
90
|
w(e);
|
|
91
91
|
}
|
|
92
|
-
let $ = !!(C && w), ie =
|
|
92
|
+
let $ = !!(C && w), ie = c(() => [...$ ? [{
|
|
93
93
|
id: "__selection",
|
|
94
94
|
header: "",
|
|
95
95
|
size: 44,
|
|
96
|
-
Header: () => /* @__PURE__ */
|
|
97
|
-
checked:
|
|
98
|
-
indeterminate:
|
|
96
|
+
Header: () => /* @__PURE__ */ d(j, {
|
|
97
|
+
checked: Y,
|
|
98
|
+
indeterminate: X,
|
|
99
99
|
"aria-label": b,
|
|
100
|
-
disabled: D || !
|
|
100
|
+
disabled: D || !q.length,
|
|
101
101
|
onChange: re
|
|
102
102
|
})
|
|
103
|
-
}] : [], ...
|
|
103
|
+
}] : [], ...G.map((e) => ({
|
|
104
104
|
id: e.id,
|
|
105
105
|
header: typeof e.header == "string" ? e.header : e.mobileLabel ?? e.id,
|
|
106
106
|
Header: () => {
|
|
107
|
-
let t =
|
|
108
|
-
return e.sortValue || _ === "server" && e.sortable ? /* @__PURE__ */
|
|
107
|
+
let t = U?.columnId === e.id ? U.direction : void 0;
|
|
108
|
+
return e.sortValue || _ === "server" && e.sortable ? /* @__PURE__ */ f("button", {
|
|
109
109
|
type: "button",
|
|
110
110
|
className: "ui-table-sort",
|
|
111
|
-
onClick: () =>
|
|
112
|
-
children: [e.header, /* @__PURE__ */
|
|
111
|
+
onClick: () => Z(e),
|
|
112
|
+
children: [e.header, /* @__PURE__ */ d(A, { direction: t })]
|
|
113
113
|
}) : e.header;
|
|
114
114
|
},
|
|
115
115
|
muiTableHeadCellProps: {
|
|
116
116
|
style: { width: e.width },
|
|
117
117
|
"data-align": e.align ?? "start",
|
|
118
|
-
"aria-sort":
|
|
118
|
+
"aria-sort": U?.columnId === e.id ? U.direction : e.sortValue || _ === "server" && e.sortable ? "none" : void 0
|
|
119
119
|
}
|
|
120
120
|
}))], [
|
|
121
|
-
|
|
121
|
+
G,
|
|
122
122
|
$,
|
|
123
|
+
Y,
|
|
123
124
|
X,
|
|
124
|
-
Z,
|
|
125
125
|
C,
|
|
126
126
|
D,
|
|
127
|
-
|
|
127
|
+
U,
|
|
128
128
|
_,
|
|
129
|
-
|
|
129
|
+
q,
|
|
130
130
|
b,
|
|
131
|
-
|
|
131
|
+
h,
|
|
132
132
|
w
|
|
133
133
|
]), ae = v({
|
|
134
134
|
columns: ie,
|
|
135
|
-
data:
|
|
135
|
+
data: W,
|
|
136
136
|
getRowId: (e) => a(e),
|
|
137
137
|
enableSorting: !1,
|
|
138
138
|
enableColumnActions: !1,
|
|
@@ -145,56 +145,56 @@ function T({ rows: n, columns: r, getRowId: a, caption: o, sort: s, defaultSort:
|
|
|
145
145
|
layoutMode: "semantic",
|
|
146
146
|
renderCaption: o === void 0 ? void 0 : () => o,
|
|
147
147
|
muiTableProps: {
|
|
148
|
-
...
|
|
149
|
-
ref:
|
|
148
|
+
...B,
|
|
149
|
+
ref: z,
|
|
150
150
|
className: "ui-data-table",
|
|
151
151
|
"aria-busy": D || void 0
|
|
152
152
|
},
|
|
153
|
-
muiTableBodyProps: { children: D ? Array.from({ length: Math.max(1,
|
|
153
|
+
muiTableBodyProps: { children: D ? Array.from({ length: Math.max(1, k) }, (e, n) => /* @__PURE__ */ f("tr", { children: [$ && /* @__PURE__ */ d("td", {
|
|
154
154
|
className: "ui-table-selection",
|
|
155
|
-
children: /* @__PURE__ */
|
|
155
|
+
children: /* @__PURE__ */ d(t, {
|
|
156
156
|
width: 18,
|
|
157
157
|
height: 18
|
|
158
158
|
})
|
|
159
|
-
}),
|
|
159
|
+
}), G.map((e) => /* @__PURE__ */ d("td", { children: /* @__PURE__ */ d(t, { width: n % 2 ? "68%" : "86%" }) }, e.id))] }, `loading-${n}`)) : K.map(({ row: e, id: t, disabled: n }) => /* @__PURE__ */ d(O, {
|
|
160
160
|
row: e,
|
|
161
161
|
id: t,
|
|
162
162
|
disabled: n,
|
|
163
|
-
columns:
|
|
163
|
+
columns: G,
|
|
164
164
|
selectable: $,
|
|
165
165
|
selected: C?.has(t) ?? !1,
|
|
166
166
|
onToggle: ne
|
|
167
167
|
}, t)) }
|
|
168
168
|
});
|
|
169
|
-
return /* @__PURE__ */
|
|
170
|
-
...
|
|
171
|
-
ref:
|
|
172
|
-
"data-mobile-layout":
|
|
173
|
-
className: `ui-data-table-wrap ${
|
|
169
|
+
return /* @__PURE__ */ f("div", {
|
|
170
|
+
...R,
|
|
171
|
+
ref: L,
|
|
172
|
+
"data-mobile-layout": ee,
|
|
173
|
+
className: `ui-data-table-wrap ${te}`.trim(),
|
|
174
174
|
children: [
|
|
175
|
-
$ && C && C.size > 0 && (y || x) && /* @__PURE__ */
|
|
175
|
+
$ && C && C.size > 0 && (y || x) && /* @__PURE__ */ f("div", {
|
|
176
176
|
className: "ui-table-selection-summary",
|
|
177
|
-
children: [y && /* @__PURE__ */
|
|
177
|
+
children: [y && /* @__PURE__ */ f("span", {
|
|
178
178
|
role: "status",
|
|
179
179
|
children: [
|
|
180
180
|
"已选择 ",
|
|
181
181
|
C.size,
|
|
182
182
|
" 项(本页 ",
|
|
183
|
-
|
|
183
|
+
J,
|
|
184
184
|
" 项)"
|
|
185
185
|
]
|
|
186
186
|
}), x?.(C)]
|
|
187
187
|
}),
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
enabled:
|
|
190
|
-
label:
|
|
191
|
-
children: /* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ d(i, {
|
|
189
|
+
enabled: F,
|
|
190
|
+
label: I,
|
|
191
|
+
children: /* @__PURE__ */ d(g, { table: ae })
|
|
192
192
|
}),
|
|
193
|
-
!D &&
|
|
193
|
+
!D && W.length === 0 && /* @__PURE__ */ d(e, {
|
|
194
194
|
compact: !0,
|
|
195
|
-
title:
|
|
196
|
-
description:
|
|
197
|
-
action:
|
|
195
|
+
title: M,
|
|
196
|
+
description: N,
|
|
197
|
+
action: P
|
|
198
198
|
})
|
|
199
199
|
]
|
|
200
200
|
});
|
|
@@ -209,43 +209,43 @@ function E(e, t, n) {
|
|
|
209
209
|
index: t,
|
|
210
210
|
value: r.sortValue(e)
|
|
211
211
|
})).sort((e, t) => {
|
|
212
|
-
let n =
|
|
212
|
+
let n = k(e.value, t.value);
|
|
213
213
|
return n === 0 ? e.index - t.index : n * i;
|
|
214
214
|
}).map(({ row: e }) => e);
|
|
215
215
|
}
|
|
216
216
|
function D({ row: e, id: t, disabled: n, columns: r, selectable: i, selected: a, onToggle: o }) {
|
|
217
|
-
return /* @__PURE__ */
|
|
217
|
+
return /* @__PURE__ */ f("tr", {
|
|
218
218
|
"aria-selected": a || void 0,
|
|
219
219
|
"data-disabled": n || void 0,
|
|
220
|
-
children: [i && /* @__PURE__ */
|
|
220
|
+
children: [i && /* @__PURE__ */ d("td", {
|
|
221
221
|
className: "ui-table-selection",
|
|
222
|
-
children: /* @__PURE__ */
|
|
222
|
+
children: /* @__PURE__ */ d("input", {
|
|
223
223
|
type: "checkbox",
|
|
224
224
|
"aria-label": `选择 ${t}`,
|
|
225
225
|
checked: a,
|
|
226
226
|
disabled: n,
|
|
227
227
|
onChange: () => o(t)
|
|
228
228
|
})
|
|
229
|
-
}), r.map((t) => /* @__PURE__ */
|
|
229
|
+
}), r.map((t) => /* @__PURE__ */ d("td", {
|
|
230
230
|
"data-align": t.align ?? "start",
|
|
231
231
|
"data-label": t.mobileLabel ?? (typeof t.header == "string" ? t.header : void 0),
|
|
232
232
|
children: t.cell(e)
|
|
233
233
|
}, t.id))]
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
var
|
|
237
|
-
function
|
|
236
|
+
var O = o(D);
|
|
237
|
+
function k(e, t) {
|
|
238
238
|
if (e == null && t == null) return 0;
|
|
239
239
|
if (e == null) return 1;
|
|
240
240
|
if (t == null) return -1;
|
|
241
241
|
let n = e instanceof Date ? e.getTime() : e, r = t instanceof Date ? t.getTime() : t;
|
|
242
242
|
return typeof n == "number" && typeof r == "number" ? n - r : b.compare(String(n), String(r));
|
|
243
243
|
}
|
|
244
|
-
function
|
|
245
|
-
return
|
|
244
|
+
function A({ direction: e }) {
|
|
245
|
+
return d(e === "ascending" ? m : e === "descending" ? p : h, { size: 14 });
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
return /* @__PURE__ */
|
|
247
|
+
function j({ indeterminate: e, ...t }) {
|
|
248
|
+
return /* @__PURE__ */ d("input", {
|
|
249
249
|
...t,
|
|
250
250
|
type: "checkbox",
|
|
251
251
|
ref: (t) => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Button as e } from "../Button.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { Maximize2 as r, Minimize2 as i, RotateCw as a, ZoomIn as o, ZoomOut as s } from "lucide-react";
|
|
4
4
|
//#region src/document-viewer/PdfToolbar.tsx
|
|
5
5
|
function c(c) {
|
|
6
|
-
return /* @__PURE__ */
|
|
6
|
+
return /* @__PURE__ */ n("div", {
|
|
7
7
|
className: "ui-viewer-tools",
|
|
8
8
|
"aria-label": "文档视图工具",
|
|
9
9
|
children: [
|
|
10
|
-
/* @__PURE__ */
|
|
10
|
+
/* @__PURE__ */ t(e, {
|
|
11
11
|
variant: "ghost",
|
|
12
12
|
size: "compact",
|
|
13
13
|
className: "ui-viewer-tool",
|
|
@@ -16,13 +16,13 @@ function c(c) {
|
|
|
16
16
|
title: "缩小",
|
|
17
17
|
disabled: c.disabled || !c.canZoomOut,
|
|
18
18
|
onClick: c.onZoomOut,
|
|
19
|
-
children: /* @__PURE__ */
|
|
19
|
+
children: /* @__PURE__ */ t(s, { size: 16 })
|
|
20
20
|
}),
|
|
21
|
-
/* @__PURE__ */
|
|
21
|
+
/* @__PURE__ */ n("span", {
|
|
22
22
|
"aria-live": "polite",
|
|
23
23
|
children: [Math.round(c.zoom * 100), "%"]
|
|
24
24
|
}),
|
|
25
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ t(e, {
|
|
26
26
|
variant: "ghost",
|
|
27
27
|
size: "compact",
|
|
28
28
|
className: "ui-viewer-tool",
|
|
@@ -31,9 +31,9 @@ function c(c) {
|
|
|
31
31
|
title: "放大",
|
|
32
32
|
disabled: c.disabled || !c.canZoomIn,
|
|
33
33
|
onClick: c.onZoomIn,
|
|
34
|
-
children: /* @__PURE__ */ o
|
|
34
|
+
children: /* @__PURE__ */ t(o, { size: 16 })
|
|
35
35
|
}),
|
|
36
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ t(e, {
|
|
37
37
|
variant: "ghost",
|
|
38
38
|
size: "compact",
|
|
39
39
|
className: "ui-viewer-tool ui-viewer-tool-separated",
|
|
@@ -42,9 +42,9 @@ function c(c) {
|
|
|
42
42
|
title: "顺时针旋转 90°",
|
|
43
43
|
disabled: c.disabled,
|
|
44
44
|
onClick: c.onRotate,
|
|
45
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ t(a, { size: 16 })
|
|
46
46
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ t(e, {
|
|
48
48
|
variant: "ghost",
|
|
49
49
|
size: "compact",
|
|
50
50
|
className: "ui-viewer-tool",
|
|
@@ -52,7 +52,7 @@ function c(c) {
|
|
|
52
52
|
"aria-label": c.fullscreen ? "退出全屏" : "全屏查看文档",
|
|
53
53
|
title: c.fullscreen ? "退出全屏" : "全屏",
|
|
54
54
|
onClick: c.onToggleFullscreen,
|
|
55
|
-
children: c.fullscreen ? /* @__PURE__ */
|
|
55
|
+
children: c.fullscreen ? /* @__PURE__ */ t(i, { size: 16 }) : /* @__PURE__ */ t(r, { size: 16 })
|
|
56
56
|
})
|
|
57
57
|
]
|
|
58
58
|
});
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { Button as e } from "../Button.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { createContext as t, useContext as n, useEffect as r, useState as i } from "react";
|
|
3
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
|
+
import { PanelLeftClose as s, PanelLeftOpen as c } from "lucide-react";
|
|
5
5
|
//#region src/document-viewer/PdfWorkspace.tsx
|
|
6
|
-
var l =
|
|
7
|
-
function d({ rail:
|
|
8
|
-
let [p, m] =
|
|
9
|
-
return
|
|
6
|
+
var l = t(!1), u = () => n(l);
|
|
7
|
+
function d({ rail: t, children: n, defaultRailCollapsed: u, className: d = "", ...f }) {
|
|
8
|
+
let [p, m] = i(() => u ?? (typeof window < "u" && window.matchMedia("(max-width: 900px)").matches));
|
|
9
|
+
return r(() => {
|
|
10
10
|
let e = window.matchMedia("(max-width: 900px)"), t = () => {
|
|
11
11
|
(e.matches || u === void 0) && m(e.matches);
|
|
12
12
|
};
|
|
13
13
|
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
14
|
-
}, [u]), /* @__PURE__ */
|
|
14
|
+
}, [u]), /* @__PURE__ */ o("div", {
|
|
15
15
|
...f,
|
|
16
16
|
className: `ui-pdf-workspace ${p ? "ui-rail-collapsed" : ""} ${d}`,
|
|
17
17
|
children: [
|
|
18
|
-
/* @__PURE__ */
|
|
18
|
+
/* @__PURE__ */ a("aside", {
|
|
19
19
|
className: "ui-viewer-rail",
|
|
20
20
|
hidden: p,
|
|
21
21
|
"aria-label": "页面缩略图",
|
|
22
|
-
children: /* @__PURE__ */
|
|
22
|
+
children: /* @__PURE__ */ a(l.Provider, {
|
|
23
23
|
value: p,
|
|
24
|
-
children:
|
|
24
|
+
children: t
|
|
25
25
|
})
|
|
26
26
|
}),
|
|
27
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ o(e, {
|
|
28
28
|
variant: "secondary",
|
|
29
29
|
size: "compact",
|
|
30
30
|
className: "ui-viewer-rail-toggle",
|
|
31
31
|
"aria-expanded": !p,
|
|
32
32
|
"aria-label": p ? "显示页面缩略图" : "隐藏页面缩略图",
|
|
33
33
|
onClick: () => m((e) => !e),
|
|
34
|
-
children: [
|
|
34
|
+
children: [a(p ? c : s, { size: 17 }), /* @__PURE__ */ a("span", { children: p ? "页面" : "收起" })]
|
|
35
35
|
}),
|
|
36
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ a("div", {
|
|
37
37
|
className: "ui-viewer-stage",
|
|
38
|
-
children:
|
|
38
|
+
children: n
|
|
39
39
|
})
|
|
40
40
|
]
|
|
41
41
|
});
|
|
@@ -2,11 +2,11 @@ import { Button as e } from "../Button.js";
|
|
|
2
2
|
import { PdfWorkspace as t } from "../document-viewer/PdfWorkspace.js";
|
|
3
3
|
import { PdfToolbar as n } from "../document-viewer/PdfToolbar.js";
|
|
4
4
|
import { usePdfViewport as r } from "../document-viewer/usePdfViewport.js";
|
|
5
|
-
import { ZoomGestureWrapper as i, react_exports as a, useZoom as o } from "../vendor/embedpdf-zoom-
|
|
5
|
+
import { ZoomGestureWrapper as i, react_exports as a, useZoom as o } from "../vendor/embedpdf-zoom-react19.js";
|
|
6
6
|
import { HeadlessSearch as s } from "./HeadlessSearch.js";
|
|
7
|
-
import {
|
|
8
|
-
import { useEffect as c, useLayoutEffect as ne, useMemo as re, useRef as l, useState as u } from "react";
|
|
7
|
+
import { useEffect as c, useLayoutEffect as ee, useMemo as te, useRef as l, useState as u } from "react";
|
|
9
8
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
import { Search as ne, X as re } from "lucide-react";
|
|
10
10
|
import { createPluginRegistration as p } from "@embedpdf/core";
|
|
11
11
|
import { EmbedPDF as m, useDocumentState as ie } from "@embedpdf/core/react";
|
|
12
12
|
import { usePdfiumEngine as h } from "@embedpdf/engines/react";
|
|
@@ -76,12 +76,12 @@ function T(e) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
function E(p) {
|
|
79
|
-
let m = p.source.id, h = ie(m), g = h?.document, { provides: _ } = ce(), v =
|
|
79
|
+
let m = p.source.id, h = ie(m), g = h?.document, { provides: _ } = ce(), v = te(() => _?.forDocument(m), [_, m]), { provides: y, state: b } = o(m), { provides: x } = oe(), { provides: S } = ve(), { provides: _e } = he(m), { provides: C, rotation: w } = de(m), T = r(m), [E, D] = u(1), [O, k] = u(null), A = be(p.mobileMode === "continuous-reader"), j = p.searchMode === "collapsible", M = p.features?.search !== !1, [N, P] = u(!j), F = g?.pages.length ?? 0, I = Math.max(1, Math.min(F || 1, p.currentPage ?? E)), L = p.pageMode === "single" && !A, R = p.features?.textSelection !== !1 && !A, z = l(p);
|
|
80
80
|
z.current = p, c(() => {
|
|
81
81
|
P(!j), k(null);
|
|
82
82
|
}, [m, j]);
|
|
83
83
|
let B = h?.scale ?? 1, V = l(!1), H = l(p.currentPage ?? 1), U = l(!0), W = l(I), G = l(L), K = l(null);
|
|
84
|
-
|
|
84
|
+
ee(() => {
|
|
85
85
|
(W.current !== I || G.current !== L) && ((G.current !== L || I !== K.current) && (H.current = I), G.current !== L && (U.current = !0), W.current = I, G.current = L, K.current = null);
|
|
86
86
|
}, [I, L]);
|
|
87
87
|
let q = l(y);
|
|
@@ -290,7 +290,7 @@ function E(p) {
|
|
|
290
290
|
onClick: () => {
|
|
291
291
|
N && (_e?.stopSearch(), k(null)), P(!N);
|
|
292
292
|
},
|
|
293
|
-
children: [d(N ?
|
|
293
|
+
children: [d(N ? re : ne, { size: 15 }), /* @__PURE__ */ d("span", {
|
|
294
294
|
className: "ui-mobile-reader-search-label",
|
|
295
295
|
children: N ? "收起搜索" : "搜索文档"
|
|
296
296
|
})]
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Button as e, LinkButton as t, buttonClassName as n } from "./Button.js";
|
|
2
|
+
import { Alert as r } from "./Alert.js";
|
|
3
|
+
import { Checkbox as i, FormField as a, SelectInput as o, TextArea as s, TextInput as c } from "./FormField.js";
|
|
4
|
+
export { r as Alert, e as Button, i as Checkbox, a as FormField, t as LinkButton, o as SelectInput, s as TextArea, c as TextInput, n as buttonClassName };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight entry point for simple authenticated forms and standalone pages.
|
|
3
|
+
* It deliberately excludes directory pickers, date controls, data tables and
|
|
4
|
+
* document viewers so consumers do not pull their dependency graphs.
|
|
5
|
+
*/
|
|
6
|
+
export { Alert, type AlertProps, type AlertTone } from "./Alert";
|
|
7
|
+
export { Button, LinkButton, buttonClassName, type ButtonProps, type ButtonVariant, type ButtonSize, type LinkButtonProps } from "./Button";
|
|
8
|
+
export { Checkbox, FormField, SelectInput, TextArea, TextInput, type TextInputProps, type TextAreaProps, type SelectInputProps } from "./FormField";
|