@jc-times/business-ui 0.3.0 → 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/CHANGELOG.md +4 -0
- 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/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/package.json +1 -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
|
})]
|
|
@@ -1,187 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
4
|
-
import { useCapability as c, useDocumentState as l, usePlugin as u } from "@embedpdf/core/react";
|
|
5
|
-
import { useViewportElement as d } from "@embedpdf/plugin-viewport/react";
|
|
6
|
-
import { ZoomPlugin as f, initialDocumentState as p } from "@embedpdf/plugin-zoom";
|
|
7
|
-
export * from "@embedpdf/plugin-zoom";
|
|
8
|
-
//#region node_modules/.pnpm/@embedpdf+plugin-zoom@2.15.0_patch_hash=21cc50a50730a2920846ef4e8bb72d24d69849e9fd43d6f_aede46f2a75cbc54dc0fefd84f941023/node_modules/@embedpdf/plugin-zoom/dist/react/index.js
|
|
9
|
-
var m = /* @__PURE__ */ e({
|
|
10
|
-
MarqueeZoom: () => w,
|
|
11
|
-
ZoomGestureWrapper: () => C,
|
|
12
|
-
useZoom: () => v,
|
|
13
|
-
useZoomCapability: () => g,
|
|
14
|
-
useZoomGesture: () => S,
|
|
15
|
-
useZoomPlugin: () => _
|
|
16
|
-
});
|
|
17
|
-
import * as h from "@embedpdf/plugin-zoom";
|
|
18
|
-
t(m, h);
|
|
19
|
-
var g = () => c(f.id), _ = () => u(f.id), v = (e) => {
|
|
20
|
-
let { provides: t } = g(), [r, i] = o(p);
|
|
21
|
-
return n(() => {
|
|
22
|
-
if (!t) return;
|
|
23
|
-
let n = t.forDocument(e);
|
|
24
|
-
return i(n.getState()), n.onStateChange((e) => {
|
|
25
|
-
i(e);
|
|
26
|
-
});
|
|
27
|
-
}, [t, e]), {
|
|
28
|
-
state: r,
|
|
29
|
-
provides: t?.forDocument(e) ?? null
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
function y(e) {
|
|
33
|
-
let [t, n] = [e[0], e[1]], r = n.clientX - t.clientX, i = n.clientY - t.clientY;
|
|
34
|
-
return Math.hypot(r, i);
|
|
35
|
-
}
|
|
36
|
-
function b(e) {
|
|
37
|
-
let [t, n] = [e[0], e[1]];
|
|
38
|
-
return {
|
|
39
|
-
x: (t.clientX + n.clientX) / 2,
|
|
40
|
-
y: (t.clientY + n.clientY) / 2
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function x({ element: e, container: t, documentId: n, zoomProvides: r, viewportGap: i = 0, options: a = {} }) {
|
|
44
|
-
let { enablePinch: o = !0, enableWheel: s = !0, minZoom: c = .1, maxZoom: l = 3 } = a;
|
|
45
|
-
if (typeof window > "u") return () => {};
|
|
46
|
-
let u = r.forDocument(n), d = () => u.getState(), f = 0, p = 1, m = !1, h = 0, g = null, _ = 1, v = 0, x = 0, S = 0, C = 0, w = 0, T = 0, E = 0, D = 0, O = 0, k = 0, A = 0, j = 0, M = 0, N = (e, t, n) => Math.min(Math.max(e, t), n), P = () => {
|
|
47
|
-
let n = t.clientWidth - 2 * i, r = e.offsetWidth, a = r < n ? (n - r) / 2 : 0;
|
|
48
|
-
e.style.marginLeft = `${a}px`;
|
|
49
|
-
}, F = (e) => {
|
|
50
|
-
let t = v * e, n = x * e, r = O * (1 - e), i = D - t / 2 - S, a = k - M * e - S, o = Math.max(0, t - E), s = E * .3, c = Math.min(1, o / s), l = i + (a - i) * c;
|
|
51
|
-
if (n > T - j * 2) {
|
|
52
|
-
let e = C + r, t = j, i = T - j - n;
|
|
53
|
-
r = N(e, i, t) - C;
|
|
54
|
-
}
|
|
55
|
-
if (t > w - j * 2) {
|
|
56
|
-
let e = S + l, n = j, r = w - j - t;
|
|
57
|
-
l = N(e, r, n) - S;
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
tx: l,
|
|
61
|
-
ty: r,
|
|
62
|
-
blend: c,
|
|
63
|
-
finalWidth: t
|
|
64
|
-
};
|
|
65
|
-
}, I = (t) => {
|
|
66
|
-
t = Number(N(f * t, c, l).toFixed(2)) / f, p = t;
|
|
67
|
-
let { tx: n, ty: r } = F(t);
|
|
68
|
-
e.style.transformOrigin = "0 0", e.style.transform = `translate(${n}px, ${r}px) scale(${t})`;
|
|
69
|
-
}, L = () => {
|
|
70
|
-
e.style.transform = "none", e.style.transformOrigin = "0 0", p = 1;
|
|
71
|
-
}, R = () => {
|
|
72
|
-
let { tx: e, finalWidth: t } = F(p), n = (p - 1) * f, r, i = A;
|
|
73
|
-
if (t <= E) r = D;
|
|
74
|
-
else {
|
|
75
|
-
let t = 1 - p;
|
|
76
|
-
r = Math.abs(t) > .001 ? S + e / t : k;
|
|
77
|
-
}
|
|
78
|
-
u.requestZoomBy(n, {
|
|
79
|
-
vx: r,
|
|
80
|
-
vy: i
|
|
81
|
-
}), L(), f = 0;
|
|
82
|
-
}, z = (n, r) => {
|
|
83
|
-
let a = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
84
|
-
j = i, v = o.width, x = o.height, S = o.left - a.left, C = o.top - a.top, w = a.width, T = a.height, E = t.clientWidth, D = t.clientLeft + E / 2;
|
|
85
|
-
let s = n - o.left;
|
|
86
|
-
O = r - o.top, k = n - a.left, A = r - a.top, M = v < E ? k * v / E : s;
|
|
87
|
-
}, B = (e) => {
|
|
88
|
-
if (e.touches.length !== 2) return;
|
|
89
|
-
m = !0, f = d().currentZoomLevel, h = y(e.touches);
|
|
90
|
-
let t = b(e.touches);
|
|
91
|
-
z(t.x, t.y), e.preventDefault();
|
|
92
|
-
}, V = (e) => {
|
|
93
|
-
if (!m || e.touches.length !== 2) return;
|
|
94
|
-
let t = y(e.touches) / h;
|
|
95
|
-
I(t), e.preventDefault();
|
|
96
|
-
}, H = (e) => {
|
|
97
|
-
m && (e.touches.length >= 2 || (m = !1, R()));
|
|
98
|
-
}, U = (e) => {
|
|
99
|
-
if (!e.ctrlKey && !e.metaKey) return;
|
|
100
|
-
e.preventDefault(), g === null ? (f = d().currentZoomLevel, _ = 1, z(e.clientX, e.clientY)) : clearTimeout(g);
|
|
101
|
-
let t = 1 - e.deltaY * .01;
|
|
102
|
-
_ *= t, _ = Math.max(.1, Math.min(10, _)), I(_), g = setTimeout(() => {
|
|
103
|
-
g = null, R(), _ = 1;
|
|
104
|
-
}, 150);
|
|
105
|
-
}, W = u.onStateChange(() => P()), G = new ResizeObserver(() => P());
|
|
106
|
-
return G.observe(e), G.observe(t), P(), o && (t.addEventListener("touchstart", B, { passive: !1 }), t.addEventListener("touchmove", V, { passive: !1 }), t.addEventListener("touchend", H), t.addEventListener("touchcancel", H)), s && t.addEventListener("wheel", U, { passive: !1 }), () => {
|
|
107
|
-
o && (t.removeEventListener("touchstart", B), t.removeEventListener("touchmove", V), t.removeEventListener("touchend", H), t.removeEventListener("touchcancel", H)), s && t.removeEventListener("wheel", U), g && clearTimeout(g), W(), G.disconnect(), L(), e.style.marginLeft = "";
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function S(e, t = {}) {
|
|
111
|
-
let { provides: n } = c("viewport"), { provides: i } = g(), o = d(), s = a(null);
|
|
112
|
-
return r(() => {
|
|
113
|
-
let r = s.current, a = o?.current;
|
|
114
|
-
if (r && a && i) return x({
|
|
115
|
-
element: r,
|
|
116
|
-
container: a,
|
|
117
|
-
documentId: e,
|
|
118
|
-
zoomProvides: i,
|
|
119
|
-
viewportGap: n?.getViewportGap() || 0,
|
|
120
|
-
options: t
|
|
121
|
-
});
|
|
122
|
-
}, [
|
|
123
|
-
n,
|
|
124
|
-
i,
|
|
125
|
-
e,
|
|
126
|
-
o,
|
|
127
|
-
t.enablePinch,
|
|
128
|
-
t.enableWheel,
|
|
129
|
-
t.minZoom,
|
|
130
|
-
t.maxZoom
|
|
131
|
-
]), { elementRef: s };
|
|
132
|
-
}
|
|
133
|
-
function C({ children: e, documentId: t, style: n, enablePinch: r = !0, enableWheel: a = !0, minZoom: o = .1, maxZoom: c = 3, ...l }) {
|
|
134
|
-
let { elementRef: u } = S(t, i(() => ({
|
|
135
|
-
enablePinch: r,
|
|
136
|
-
enableWheel: a,
|
|
137
|
-
minZoom: o,
|
|
138
|
-
maxZoom: c
|
|
139
|
-
}), [
|
|
140
|
-
r,
|
|
141
|
-
a,
|
|
142
|
-
o,
|
|
143
|
-
c
|
|
144
|
-
]));
|
|
145
|
-
return /* @__PURE__ */ s("div", {
|
|
146
|
-
ref: u,
|
|
147
|
-
...l,
|
|
148
|
-
style: {
|
|
149
|
-
...n,
|
|
150
|
-
display: "inline-block",
|
|
151
|
-
overflow: "visible",
|
|
152
|
-
boxSizing: "border-box"
|
|
153
|
-
},
|
|
154
|
-
children: e
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
var w = ({ documentId: e, pageIndex: t, scale: r, className: a, stroke: c = "rgba(33,150,243,0.8)", fill: u = "rgba(33,150,243,0.15)" }) => {
|
|
158
|
-
let { provides: d } = g(), f = l(e), [p, m] = o(null), h = i(() => r === void 0 ? f?.scale ?? 1 : r, [r, f?.scale]);
|
|
159
|
-
return n(() => {
|
|
160
|
-
if (d) return d.registerMarqueeOnPage({
|
|
161
|
-
documentId: e,
|
|
162
|
-
pageIndex: t,
|
|
163
|
-
scale: h,
|
|
164
|
-
callback: { onPreview: m }
|
|
165
|
-
});
|
|
166
|
-
}, [
|
|
167
|
-
d,
|
|
168
|
-
e,
|
|
169
|
-
t,
|
|
170
|
-
h
|
|
171
|
-
]), p ? /* @__PURE__ */ s("div", {
|
|
172
|
-
style: {
|
|
173
|
-
position: "absolute",
|
|
174
|
-
pointerEvents: "none",
|
|
175
|
-
left: p.origin.x * h,
|
|
176
|
-
top: p.origin.y * h,
|
|
177
|
-
width: p.size.width * h,
|
|
178
|
-
height: p.size.height * h,
|
|
179
|
-
border: `1px solid ${c}`,
|
|
180
|
-
background: u,
|
|
181
|
-
boxSizing: "border-box"
|
|
182
|
-
},
|
|
183
|
-
className: a
|
|
184
|
-
}) : null;
|
|
185
|
-
};
|
|
1
|
+
//#region node_modules/.pnpm/lucide-react@1.45.0_react@19.3.0/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs
|
|
2
|
+
var e = (e) => e?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
186
3
|
//#endregion
|
|
187
|
-
export {
|
|
4
|
+
export { e as toKebabCase };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext as e, useContext as t } from "react";
|
|
3
|
+
//#region node_modules/.pnpm/lucide-react@1.45.0_react@19.3.0/node_modules/lucide-react/dist/esm/context.mjs
|
|
4
|
+
var n = e({}), r = () => t(n);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { r as useLucideContext };
|