@jc-times/business-ui 0.3.0 → 0.3.2
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 +10 -0
- package/THIRD_PARTY_NOTICES.md +5 -0
- package/assets/pdf-fonts/NotoSans-Bold.ttf +0 -0
- package/assets/pdf-fonts/NotoSans-BoldItalic.ttf +0 -0
- package/assets/pdf-fonts/NotoSans-Italic.ttf +0 -0
- package/assets/pdf-fonts/NotoSans-Regular.ttf +0 -0
- package/assets/pdf-fonts/NotoSansHans-Regular.otf +0 -0
- package/assets/pdf-fonts/OFL-CJK.txt +92 -0
- package/assets/pdf-fonts/OFL-Latin.txt +94 -0
- package/assets/pdf-fonts/README.md +11 -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/DocumentViewerV2.js +49 -48
- package/dist/document-viewer-v2/HeadlessPdfViewer.js +128 -124
- package/dist/document-viewer-v2/pdf-font-fallback.js +35 -0
- package/dist/types/document-viewer-v2/pdf-font-fallback.d.ts +2 -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 +2 -0
- package/docs/document-viewer-v2.md +2 -2
- package/package.json +7 -3
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
|
});
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { DocumentViewer as e } from "../document-viewer/DocumentViewer.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { pdfFontFallback as t } from "./pdf-font-fallback.js";
|
|
3
|
+
import { Suspense as n, lazy as r, useCallback as i, useMemo as a } from "react";
|
|
4
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
5
|
//#region src/document-viewer-v2/DocumentViewerV2.tsx
|
|
5
|
-
var
|
|
6
|
+
var c = r(() => import("@embedpdf/react-pdf-viewer").then((e) => ({ default: e.PDFViewer }))), l = r(() => import("./HeadlessPdfViewer.js")), u = [
|
|
6
7
|
"annotation",
|
|
7
8
|
"redaction",
|
|
8
9
|
"insert",
|
|
9
10
|
"form"
|
|
10
|
-
],
|
|
11
|
-
function
|
|
11
|
+
], d = "data-business-ui-document-viewer-v2-toolbar", f = "\n[data-epdf-i=\"main-toolbar\"] {\n min-height: 52px;\n gap: 8px;\n padding: 7px 12px;\n border-bottom-color: var(--ui-border, #dde0eb);\n background: var(--ui-surface, #fff);\n box-shadow: 0 1px 0 color-mix(in srgb, var(--ui-text, #242837) 3%, transparent);\n}\n\n[data-epdf-i=\"main-toolbar\"] [data-epdf-i$=\"-group\"] {\n gap: 4px;\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]) {\n width: 36px;\n min-width: 36px;\n height: 36px;\n padding: 7px;\n border: 1px solid transparent;\n border-radius: var(--ui-radius, 8px);\n color: var(--ui-muted, #70778b);\n background: transparent;\n box-shadow: none;\n transition:\n color var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease),\n background-color var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease),\n border-color var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease),\n box-shadow var(--ui-motion-fast, 120ms) var(--ui-ease-standard, ease);\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]):hover:not(:disabled) {\n border-color: color-mix(in srgb, var(--ui-primary, #5965a8) 22%, var(--ui-border, #dde0eb));\n color: var(--ui-primary-hover, #414a78);\n background: var(--ui-primary-soft, #eef0fb);\n box-shadow: none;\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]):focus-visible {\n border-color: var(--ui-primary, #5965a8);\n outline: 3px solid var(--ui-focus, rgb(89 101 168 / 28%));\n outline-offset: 1px;\n}\n\n[data-epdf-i=\"main-toolbar\"] button.bg-interactive-selected {\n border-color: color-mix(in srgb, var(--ui-primary, #5965a8) 42%, var(--ui-border, #dde0eb));\n color: var(--ui-primary-hover, #414a78);\n background: var(--ui-primary-soft, #eef0fb);\n box-shadow: 0 1px 3px color-mix(in srgb, var(--ui-primary, #5965a8) 16%, transparent);\n}\n\n[data-epdf-i=\"main-toolbar\"] button:disabled {\n opacity: .48;\n}\n\n[data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]) > svg {\n width: 20px;\n height: 20px;\n}\n\n[data-epdf-i=\"zoom-toolbar\"] > .relative > .flex {\n height: 36px;\n padding-left: 8px;\n overflow: hidden;\n border: 1px solid var(--ui-border, #dde0eb);\n border-radius: var(--ui-radius, 8px);\n color: var(--ui-text, #242837);\n background: var(--ui-surface, #fff);\n}\n\n[data-epdf-i=\"zoom-toolbar\"] input[name=\"zoom\"] {\n width: 36px;\n color: var(--ui-text, #242837);\n font-weight: 700;\n}\n\n[data-epdf-i=\"zoom-toolbar\"] > .relative > .flex > button {\n width: 34px;\n min-width: 34px;\n height: 34px;\n padding: 7px;\n border: 0;\n border-radius: 6px;\n}\n\n[data-epdf-i=\"main-toolbar\"] [aria-hidden=\"true\"] > div {\n background: var(--ui-border, #dde0eb);\n}\n\n@container (max-width: 640px) {\n [data-epdf-i=\"main-toolbar\"] {\n min-height: 56px;\n padding: 7px 8px;\n }\n\n [data-epdf-i=\"main-toolbar\"] button:not([role=\"tab\"]) {\n width: 40px;\n min-width: 40px;\n height: 40px;\n }\n}\n";
|
|
12
|
+
function p(e) {
|
|
12
13
|
let { shadowRoot: t } = e;
|
|
13
14
|
if (!t || t.querySelector("[data-business-ui-document-viewer-v2-toolbar]")) return;
|
|
14
15
|
let n = t.ownerDocument.createElement("style");
|
|
15
|
-
n.setAttribute(
|
|
16
|
+
n.setAttribute(d, ""), n.textContent = f, t.append(n);
|
|
16
17
|
}
|
|
17
|
-
var
|
|
18
|
+
var m = {
|
|
18
19
|
preference: "system",
|
|
19
20
|
light: {
|
|
20
21
|
background: {
|
|
@@ -58,113 +59,113 @@ var p = {
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
|
-
function
|
|
62
|
+
function h(e) {
|
|
62
63
|
return {
|
|
63
|
-
...
|
|
64
|
+
...m,
|
|
64
65
|
...e,
|
|
65
66
|
light: {
|
|
66
|
-
...
|
|
67
|
+
...m.light,
|
|
67
68
|
...e?.light,
|
|
68
69
|
background: {
|
|
69
|
-
...
|
|
70
|
+
...m.light?.background,
|
|
70
71
|
...e?.light?.background
|
|
71
72
|
},
|
|
72
73
|
foreground: {
|
|
73
|
-
...
|
|
74
|
+
...m.light?.foreground,
|
|
74
75
|
...e?.light?.foreground
|
|
75
76
|
},
|
|
76
77
|
border: {
|
|
77
|
-
...
|
|
78
|
+
...m.light?.border,
|
|
78
79
|
...e?.light?.border
|
|
79
80
|
},
|
|
80
81
|
accent: {
|
|
81
|
-
...
|
|
82
|
+
...m.light?.accent,
|
|
82
83
|
...e?.light?.accent
|
|
83
84
|
},
|
|
84
85
|
interactive: {
|
|
85
|
-
...
|
|
86
|
+
...m.light?.interactive,
|
|
86
87
|
...e?.light?.interactive
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
-
let { documentManager:
|
|
92
|
+
function g(e, n = {}) {
|
|
93
|
+
let { documentManager: r, disabledCategories: i, fonts: a, i18n: o, theme: s, ...c } = n, { id: l, kind: d, ...f } = e;
|
|
93
94
|
return {
|
|
94
95
|
worker: !0,
|
|
95
96
|
tabBar: "never",
|
|
96
|
-
fontFallback:
|
|
97
|
-
...
|
|
98
|
-
disabledCategories:
|
|
97
|
+
fontFallback: t,
|
|
98
|
+
...c,
|
|
99
|
+
disabledCategories: i ?? [...u],
|
|
99
100
|
fonts: {
|
|
100
101
|
ui: null,
|
|
101
102
|
signature: null,
|
|
102
|
-
...
|
|
103
|
+
...a
|
|
103
104
|
},
|
|
104
105
|
i18n: {
|
|
105
106
|
defaultLocale: "zh-CN",
|
|
106
|
-
...
|
|
107
|
+
...o
|
|
107
108
|
},
|
|
108
|
-
theme:
|
|
109
|
+
theme: h(s),
|
|
109
110
|
documentManager: {
|
|
110
111
|
maxDocuments: 1,
|
|
111
|
-
...
|
|
112
|
+
...r,
|
|
112
113
|
initialDocuments: [{
|
|
113
|
-
...
|
|
114
|
-
documentId:
|
|
114
|
+
...f,
|
|
115
|
+
documentId: l,
|
|
115
116
|
autoActivate: !0
|
|
116
117
|
}]
|
|
117
118
|
}
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
-
return
|
|
122
|
-
fallback: /* @__PURE__ */
|
|
121
|
+
function _(t) {
|
|
122
|
+
return t.renderer === "headless" ? /* @__PURE__ */ o(n, {
|
|
123
|
+
fallback: /* @__PURE__ */ o("div", {
|
|
123
124
|
role: "status",
|
|
124
125
|
children: "正在加载 PDF 查看器…"
|
|
125
126
|
}),
|
|
126
|
-
children: /* @__PURE__ */
|
|
127
|
-
}) :
|
|
128
|
-
...
|
|
129
|
-
className: ["ui-document-viewer-v2-compat",
|
|
127
|
+
children: /* @__PURE__ */ o(l, { ...t }, `${t.source.kind}:${t.source.id}`)
|
|
128
|
+
}) : v(t) ? /* @__PURE__ */ o(y, { ...t }) : /* @__PURE__ */ o(e, {
|
|
129
|
+
...t,
|
|
130
|
+
className: ["ui-document-viewer-v2-compat", t.className].filter(Boolean).join(" ")
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function v(e) {
|
|
133
134
|
return e.source.kind === "url" || e.source.kind === "buffer";
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
-
let y =
|
|
137
|
-
|
|
138
|
-
}, [
|
|
139
|
-
return /* @__PURE__ */
|
|
136
|
+
function y({ source: e, config: t, className: r, style: l, layoutMode: u = "standalone", ariaLabel: d = "PDF 文档查看器", onInit: f, onReady: m, title: h, toolbar: _, footer: v }) {
|
|
137
|
+
let y = a(() => g(e, t), [e, t]), b = i((e) => {
|
|
138
|
+
p(e), f?.(e);
|
|
139
|
+
}, [f]);
|
|
140
|
+
return /* @__PURE__ */ s("section", {
|
|
140
141
|
className: [
|
|
141
142
|
"ui-document-viewer-v2",
|
|
142
143
|
u === "fill" && "ui-viewer-fill",
|
|
143
|
-
|
|
144
|
+
r
|
|
144
145
|
].filter(Boolean).join(" "),
|
|
145
146
|
style: l,
|
|
146
147
|
"aria-label": d,
|
|
147
148
|
children: [
|
|
148
|
-
(
|
|
149
|
+
(h !== void 0 || _ !== void 0) && /* @__PURE__ */ s("div", {
|
|
149
150
|
className: "ui-viewer-toolbar",
|
|
150
|
-
children: [
|
|
151
|
+
children: [h !== void 0 && /* @__PURE__ */ o("div", {
|
|
151
152
|
className: "ui-viewer-title",
|
|
152
|
-
children:
|
|
153
|
+
children: h
|
|
153
154
|
}), _]
|
|
154
155
|
}),
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
fallback: /* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ o(n, {
|
|
157
|
+
fallback: /* @__PURE__ */ o("div", {
|
|
157
158
|
role: "status",
|
|
158
159
|
children: "正在加载 PDF 查看器…"
|
|
159
160
|
}),
|
|
160
|
-
children: /* @__PURE__ */
|
|
161
|
+
children: /* @__PURE__ */ o(c, {
|
|
161
162
|
className: "ui-document-viewer-v2-engine",
|
|
162
163
|
config: y,
|
|
163
164
|
onInit: b,
|
|
164
165
|
onReady: m
|
|
165
166
|
}, e.id)
|
|
166
167
|
}),
|
|
167
|
-
v !== void 0 && /* @__PURE__ */
|
|
168
|
+
v !== void 0 && /* @__PURE__ */ o("div", {
|
|
168
169
|
className: "ui-viewer-footer",
|
|
169
170
|
children: v
|
|
170
171
|
})
|
|
@@ -172,4 +173,4 @@ function v({ source: e, config: n, className: c, style: l, layoutMode: u = "stan
|
|
|
172
173
|
});
|
|
173
174
|
}
|
|
174
175
|
//#endregion
|
|
175
|
-
export {
|
|
176
|
+
export { u as DOCUMENT_VIEWER_V2_DISABLED_CATEGORIES, d as DOCUMENT_VIEWER_V2_TOOLBAR_STYLE_ATTRIBUTE, _ as DocumentViewerV2, p as applyDocumentViewerV2ToolbarStyles, g as createDocumentViewerV2Config };
|