@jc-times/business-ui 0.2.53 → 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 CHANGED
@@ -1,4 +1,11 @@
1
- # 0.2.53
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
 
@@ -48,6 +55,10 @@
48
55
 
49
56
  # Changelog
50
57
 
58
+ ## 0.2.54
59
+
60
+ - PDFium Headless 新增 `mobileMode="continuous-reader"`:手机/粗指针连续阅读时恢复原生纵向滚动,收起缩略图与分页底栏,并压缩工具栏;`searchMode="collapsible"` 统一提供搜索开关和手机图标布局。
61
+
51
62
  ## 0.2.48
52
63
 
53
64
  - Cascader:按可见视口处理多列展开的边缘碰撞,修复右侧表单区县列超出屏幕的问题。
package/README.md CHANGED
@@ -21,18 +21,18 @@ React 等 peer dependencies 按所安装版本的 package.json 配置。应用
21
21
 
22
22
  | 文档 | 用途 |
23
23
  | --- | --- |
24
- | [Agent 使用指南](docs/agent-guide.md) | 场景选型、组件组合、边界和接入检查 |
25
- | [依赖维护](docs/dependencies.md) | 稳定版本核查、兼容例外、消费迁移要求 |
26
- | [公共 API](docs/api.md) | 公共行为、参数说明、数字输入与装饰示例;完整签名见安装包类型声明 |
27
- | [DataTable 与 MRT 迁移](docs/data-table.md) | 公共表格替代、旧参数兼容、完整配置、独立入口与合并明细;0.2.31起提供 |
28
- | [表格能力与 MRT 样例](docs/mrt-poc.md) | DataTable边界、筛选/列管理、产品行合并/展开、配置及性能;包含业务样例与公共API边界 |
24
+ | [Agent 使用指南](docs/agent-guide.md) | 场景选型、组件组合、边界和接入检查 |
25
+ | [依赖维护](docs/dependencies.md) | 稳定版本核查、兼容例外、消费迁移要求 |
26
+ | [公共 API](docs/api.md) | 公共行为、参数说明、数字输入与装饰示例;完整签名见安装包类型声明 |
27
+ | [DataTable 与 MRT 迁移](docs/data-table.md) | 公共表格替代、旧参数兼容、完整配置、独立入口与合并明细;0.2.31起提供 |
28
+ | [表格能力与 MRT 样例](docs/mrt-poc.md) | DataTable边界、筛选/列管理、产品行合并/展开、配置及性能;包含业务样例与公共API边界 |
29
29
  | [分段控制器](docs/api.md#分段控制器-segmentedcontrol) | 少量互斥选项、浅底/图标/纵向示例、兼容边界 |
30
30
  | [组件设计策略](docs/component-strategy.md) | 设计依据、公共能力范围和交互内核策略 |
31
31
  | [弹窗迁移](docs/modal-shell-migration.md) | header/content/footer 稳定插槽与历史写法迁移 |
32
32
  | [成熟度迁移](docs/maturity-migration.md) | 日期、多选、目录缓存、表格、文件限制及 Toast 行为 |
33
33
  | [上传前处理](docs/file-preparation.md) | 文件异步前处理、整批提交与取消 |
34
34
  | [文档查看器](docs/document-viewer.md) | PDF.js 与图片查看入口 |
35
- | [文档与图片查看器 V2](docs/document-viewer-v2.md) | PDFium/WASM、原生页面叠层、图片及 V1 兼容入口与迁移边界 |
35
+ | [文档与图片查看器 V2](docs/document-viewer-v2.md) | PDFium/WASM、原生页面叠层、图片及 V1 兼容入口与迁移边界 |
36
36
  | [多视口验收](docs/viewport-qa.md) | 桌面、移动与交互验证 |
37
37
  | [发布流程](docs/release.md) | registry、版本、制品与发布检查 |
38
38
  | [变更记录](CHANGELOG.md) | 按版本查看变化 |
@@ -52,4 +52,4 @@ React 等 peer dependencies 按所安装版本的 package.json 配置。应用
52
52
 
53
53
  仓库通过 `v<package.version>` 标签触发受控发布。公共包本地验证、正式发布、消费应用升级和生产部署是不同状态,应分别验证和记录。
54
54
 
55
- - [通用级联选择与部门/地址适配](docs/cascader.md)
55
+ - [通用级联选择与部门/地址适配](docs/cascader.md)
@@ -2,16 +2,16 @@
2
2
 
3
3
  `@jc-times/business-ui` 使用以下固定版本开源依赖。依赖源码未复制到本仓库;最终安装包由包管理器连同各自许可证一并解析。
4
4
 
5
- | Package | Version | License | Project |
6
- | --- | --- | --- | --- |
7
- | `lucide-react` | 1.45.0(开发验证版本) | ISC | https://github.com/lucide-icons/lucide |
8
- | `pdfjs-dist` | 6.3.289 | Apache-2.0 | https://github.com/mozilla/pdf.js |
9
- | `material-react-table` | 3.2.1 | MIT | https://github.com/KevinVandy/material-react-table |
10
- | `@mui/material`, `@mui/icons-material` | 7.3.11 | MIT | https://github.com/mui/material-ui |
11
- | `@mui/x-date-pickers` | 9.13.0 | MIT | https://github.com/mui/mui-x |
12
- | `@emotion/react`, `@emotion/styled` | 11.14.0 / 11.14.1 | MIT | https://github.com/emotion-js/emotion |
13
- | `@embedpdf/react-pdf-viewer` | 2.15.0 | MIT | https://github.com/embedpdf/embed-pdf-viewer |
14
- | `@embedpdf/core`, `@embedpdf/engines`, `@embedpdf/plugin-document-manager`, `@embedpdf/plugin-viewport`, `@embedpdf/plugin-scroll`, `@embedpdf/plugin-render`, `@embedpdf/plugin-zoom`, `@embedpdf/plugin-rotate`, `@embedpdf/plugin-thumbnail` | 2.15.0 | MIT | https://github.com/embedpdf/embed-pdf-viewer |
5
+ | Package | Version | License | Project |
6
+ | --- | --- | --- | --- |
7
+ | `lucide-react` | 1.45.0(开发验证版本) | ISC | https://github.com/lucide-icons/lucide |
8
+ | `pdfjs-dist` | 6.3.289 | Apache-2.0 | https://github.com/mozilla/pdf.js |
9
+ | `material-react-table` | 3.2.1 | MIT | https://github.com/KevinVandy/material-react-table |
10
+ | `@mui/material`, `@mui/icons-material` | 7.3.11 | MIT | https://github.com/mui/material-ui |
11
+ | `@mui/x-date-pickers` | 9.13.0 | MIT | https://github.com/mui/mui-x |
12
+ | `@emotion/react`, `@emotion/styled` | 11.14.0 / 11.14.1 | MIT | https://github.com/emotion-js/emotion |
13
+ | `@embedpdf/react-pdf-viewer` | 2.15.0 | MIT | https://github.com/embedpdf/embed-pdf-viewer |
14
+ | `@embedpdf/core`, `@embedpdf/engines`, `@embedpdf/plugin-document-manager`, `@embedpdf/plugin-viewport`, `@embedpdf/plugin-scroll`, `@embedpdf/plugin-render`, `@embedpdf/plugin-zoom`, `@embedpdf/plugin-rotate`, `@embedpdf/plugin-thumbnail` | 2.15.0 | MIT | https://github.com/embedpdf/embed-pdf-viewer |
15
15
  | PDFium(由 `@embedpdf/pdfium` 随查看器分发) | 2.15.0 | BSD-3-Clause / Apache-2.0 等,详见依赖内 `LICENSE.pdfium` | https://pdfium.googlesource.com/pdfium/ |
16
16
  | `@radix-ui/react-popover` | 1.1.23 | MIT | https://github.com/radix-ui/primitives |
17
17
  | `@radix-ui/react-dialog` | 1.1.23 | MIT | https://github.com/radix-ui/primitives |
@@ -26,6 +26,6 @@
26
26
 
27
27
  ## @rc-component/cascader 1.25.0
28
28
 
29
- MIT, Copyright (c) 2019-present react-component. Source: https://github.com/react-component/cascader. Used as the external Cascader interaction dependency; license reproduced in licenses/rc-cascader-MIT.txt. Transitive dependencies retain their own notices in their installed packages.
30
-
31
- 0.2.46 additionally bundles the React gesture entry of @embedpdf/plugin-zoom@2.15.0 with a pinned bounds/precision patch. Original MIT license: licenses/embedpdf-MIT.txt; patch: patches/@embedpdf__plugin-zoom@2.15.0.patch. Engine and core plugin implementations remain external.
29
+ MIT, Copyright (c) 2019-present react-component. Source: https://github.com/react-component/cascader. Used as the external Cascader interaction dependency; license reproduced in licenses/rc-cascader-MIT.txt. Transitive dependencies retain their own notices in their installed packages.
30
+
31
+ 0.2.46 additionally bundles the React gesture entry of @embedpdf/plugin-zoom@2.15.0 with a pinned bounds/precision patch. Original MIT license: licenses/embedpdf-MIT.txt; patch: patches/@embedpdf__plugin-zoom@2.15.0.patch. Engine and core plugin implementations remain external.
File without changes
@@ -1,118 +1,155 @@
1
- import { activeSortableTransfer as e, beginSortableTransfer as t, consumeSortableTransfer as n, endSortableTransfer as r, registerSortableTarget as i, routeSortableTarget as a, useSortableTransferScope as o } from "./sortable-transfer-scope.js";
2
- import { GripVertical as s } from "lucide-react";
3
- import { useEffect as c, useLayoutEffect as l, useMemo as u, useRef as d } from "react";
4
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
5
- import { Button as m, GridList as h, GridListItem as g, useDragAndDrop as _ } from "react-aria-components";
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";
6
6
  //#region src/SortableList.tsx
7
- function v(o) {
8
- let v = d(/* @__PURE__ */ new Set()), b = d({ mime: `application/x-ui-sortable-${Math.random().toString(36).slice(2)}` }).current, x = o.transferScope?.mime ?? b.mime, S = d(o);
9
- S.current = o, c(() => () => {
10
- r(o.transferScope, b);
11
- }, [o.transferScope, b]), c(() => {
12
- o.disabled && (v.current.clear(), r(o.transferScope, b));
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
13
  }, [
14
- o.disabled,
15
- o.transferScope,
16
- b
14
+ s.disabled,
15
+ s.transferScope,
16
+ x
17
17
  ]);
18
- let C = u(() => o.items.map((e, t) => ({
18
+ let w = d(() => s.items.map((e, t) => ({
19
19
  item: e,
20
20
  index: t,
21
- key: o.getKey(e)
22
- })), [o.items, o.getKey]);
23
- function w() {
24
- let t = e(o.transferScope), n = t?.keys ?? v.current;
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;
25
37
  return {
26
38
  keys: n,
27
- moving: t ? t.consumed ? [] : t.resolve() : o.items.filter((e) => n.has(o.getKey(e))),
28
- external: !!(t && t.source !== b)
39
+ moving: t ? t.consumed ? [] : t.resolve() : s.transferScope ? [] : D(n),
40
+ external: !!(t && t.source !== x)
29
41
  };
30
42
  }
31
- function T(e, t) {
32
- let { keys: n, moving: r, external: i } = w(), a = o.items.find((t) => o.getKey(t) === e);
33
- if (o.disabled || !a || !r.length || r.length !== n.size || n.has(e)) return null;
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;
34
57
  if (t === "on") {
35
- if (!o.onDropOnItem || o.canDropOnItem && !o.canDropOnItem(r, a)) return null;
36
- } else if (i && (!o.onDropBetweenItems || o.canDropBetweenItems && !o.canDropBetweenItems(r, a, t))) return null;
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;
37
60
  return {
38
61
  moving: r,
39
- target: a,
62
+ target: o,
40
63
  keys: n,
41
- external: i
64
+ external: a
42
65
  };
43
66
  }
44
- let E = d(D);
45
- E.current = D, l(() => i(o.transferScope, b, {
46
- accepts: (e) => S.current.items.some((t) => S.current.getKey(t) === e),
47
- commit: (e, t) => E.current(e, t)
48
- }), [o.transferScope, b]);
49
- function D(e, t) {
50
- let r = T(e, t);
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);
51
74
  if (!r) {
52
- o.items.some((t) => o.getKey(t) === e) || a(o.transferScope, b, e, t);
75
+ T.index.has(e) || o(s.transferScope, x, e, t);
53
76
  return;
54
77
  }
55
- n(o.transferScope), t === "on" ? o.onDropOnItem?.(r.moving, r.target) : r.external ? o.onDropBetweenItems?.(r.moving, r.target, t) : o.onReorder(y(o.items, r.keys, e, t, o.getKey));
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));
56
79
  }
57
- function O(e) {
80
+ function P(e) {
58
81
  let n = new Set(e);
59
- v.current = n, t(o.transferScope, {
60
- source: b,
82
+ y.current = n;
83
+ let r = s.transferScope;
84
+ t(r, {
85
+ source: x,
86
+ sourceListId: s.listId,
61
87
  keys: n,
62
- resolve: () => S.current.disabled ? [] : S.current.items.filter((e) => n.has(S.current.getKey(e)))
88
+ resolve: () => C.current.disabled || C.current.transferScope !== r || [...n].some((e) => !i(r, e)) ? [] : D(n)
63
89
  });
64
90
  }
65
- let { dragAndDropHooks: k } = _({
66
- isDisabled: o.disabled,
67
- getItems: (e) => (O(e), [...e].map((e) => ({
91
+ let { dragAndDropHooks: F } = v({
92
+ isDisabled: s.disabled,
93
+ getItems: (e) => (P(e), [...e].map((e) => ({
68
94
  "text/plain": String(e),
69
- [x]: String(e)
95
+ [S]: String(e)
70
96
  }))),
71
97
  getAllowedDropOperations: () => ["move"],
72
- onDragStart: (e) => O(e.keys),
98
+ onDragStart: (e) => P(e.keys),
73
99
  onDragEnd: () => {
74
- v.current.clear(), r(o.transferScope, b);
100
+ y.current.clear(), r(s.transferScope, x);
75
101
  },
76
- shouldAcceptItemDrop: (e, t) => t.has(x) && !!T(e.key, "on"),
77
- getDropOperation: (e, t) => t.has(x) && e.type === "item" && T(e.key, e.dropPosition) ? "move" : "cancel",
78
- onMove: (e) => D(e.target.key, e.target.dropPosition),
79
- onInsert: o.transferScope && o.onDropBetweenItems ? (e) => D(e.target.key, e.target.dropPosition) : void 0,
80
- onItemDrop: o.transferScope && o.onDropOnItem ? (e) => D(e.target.key, "on") : void 0
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
81
111
  });
82
- return /* @__PURE__ */ f(h, {
83
- "aria-label": o["aria-label"],
84
- items: C,
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
+ })),
85
119
  selectionMode: "none",
86
- dragAndDropHooks: o.disabled ? void 0 : k,
87
- className: ["ui-sortable-list", o.className].filter(Boolean).join(" "),
88
- children: ({ item: e, index: t, key: n }) => /* @__PURE__ */ p(g, {
120
+ dragAndDropHooks: F,
121
+ className: ["ui-sortable-list", s.className].filter(Boolean).join(" "),
122
+ children: ({ item: e, index: t, key: n }) => /* @__PURE__ */ m(_, {
89
123
  id: n,
90
- textValue: o.getTextValue(e, t),
124
+ textValue: s.getTextValue(e, t),
91
125
  className: "ui-sortable-item",
92
126
  children: [
93
- !o.disabled && /* @__PURE__ */ f("span", {
127
+ !s.disabled && /* @__PURE__ */ p("span", {
94
128
  className: "ui-sortable-placeholder",
95
129
  "aria-hidden": "true",
96
- children: o.draggingLabel ?? "原位置保留,松开后移动"
130
+ children: s.draggingLabel ?? "原位置保留,松开后移动"
97
131
  }),
98
- !o.disabled && /* @__PURE__ */ f(m, {
132
+ /* @__PURE__ */ p(h, {
99
133
  slot: "drag",
100
134
  className: "ui-sortable-handle",
101
- "aria-label": o.dragLabel?.(e, t) ?? `拖动第 ${t + 1} 项排序`,
102
- children: /* @__PURE__ */ f(s, {
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, {
103
139
  "aria-hidden": "true",
104
140
  size: 18
105
141
  })
106
142
  }),
107
- /* @__PURE__ */ f("div", {
143
+ /* @__PURE__ */ p("div", {
108
144
  className: "ui-sortable-content",
109
- children: o.renderItem(e, t)
145
+ style: s.disabled ? { gridColumn: "1 / -1" } : void 0,
146
+ children: s.renderItem(e, t)
110
147
  })
111
148
  ]
112
149
  })
113
- }, o.disabled ? "static" : "sortable");
150
+ });
114
151
  }
115
- function y(e, t, n, r, i) {
152
+ function b(e, t, n, r, i) {
116
153
  let a = e.filter((e) => t.has(i(e)));
117
154
  if (!a.length || r === "on") return e;
118
155
  let o = e.filter((e) => !t.has(i(e))), s = o.findIndex((e) => i(e) === n);
@@ -125,4 +162,4 @@ function y(e, t, n, r, i) {
125
162
  ];
126
163
  }
127
164
  //#endregion
128
- export { v as SortableList, y as moveSortableItems, o as useSortableTransferScope };
165
+ export { y as SortableList, b as moveSortableItems, s as useSortableTransferScope };
@@ -12,17 +12,17 @@ import { jsx as u, jsxs as d } from "react/jsx-runtime";
12
12
  function f(e) {
13
13
  return /* @__PURE__ */ u(p, { ...e }, `${e.source.kind}:${e.source.id}`);
14
14
  }
15
- function p({ source: f, title: p, className: m = "", style: h, ariaLabel: g = "文档查看器", toolbar: _, footer: v, currentPage: y, onCurrentPageChange: b, pageMode: x = "continuous", renderPage: S }) {
16
- let C = s(f.id), [w, T] = l(1), E = f.kind === "pdf" ? f.document.numPages : f.images.length, D = Math.max(1, Math.min(E, y ?? w)), O = c(() => Array.from({ length: E }, (e, t) => t + 1), [E]), k = (e) => {
17
- T(e), b?.(e);
15
+ function p({ source: f, title: p, className: m = "", style: h, layoutMode: g = "standalone", ariaLabel: _ = "文档查看器", toolbar: v, footer: y, currentPage: b, onCurrentPageChange: x, pageMode: S = "continuous", renderPage: C }) {
16
+ let w = s(f.id), [T, E] = l(1), D = f.kind === "pdf" ? f.document.numPages : f.images.length, O = Math.max(1, Math.min(D, b ?? T)), k = c(() => Array.from({ length: D }, (e, t) => t + 1), [D]), A = (e) => {
17
+ E(e), x?.(e);
18
18
  };
19
19
  return /* @__PURE__ */ u("section", {
20
- ref: C.containerRef,
21
- "aria-label": g,
20
+ ref: w.containerRef,
21
+ "aria-label": _,
22
22
  style: h,
23
- className: `ui-document-viewer ${C.fullscreen ? "ui-viewer-fullscreen" : ""} ${m}`,
23
+ className: `ui-document-viewer ${g === "fill" ? "ui-viewer-fill" : ""} ${w.fullscreen ? "ui-viewer-fullscreen" : ""} ${m}`,
24
24
  children: /* @__PURE__ */ d(t.Provider, {
25
- value: C.containerRef.current,
25
+ value: w.containerRef.current,
26
26
  children: [
27
27
  /* @__PURE__ */ d("div", {
28
28
  className: "ui-viewer-toolbar",
@@ -31,37 +31,37 @@ function p({ source: f, title: p, className: m = "", style: h, ariaLabel: g = "
31
31
  className: "ui-viewer-title",
32
32
  children: p
33
33
  }),
34
- _,
34
+ v,
35
35
  /* @__PURE__ */ u(o, {
36
- zoom: C.zoom,
37
- disabled: !E,
38
- fullscreen: C.fullscreen,
39
- canZoomIn: C.canZoomIn,
40
- canZoomOut: C.canZoomOut,
41
- onZoomIn: C.zoomIn,
42
- onZoomOut: C.zoomOut,
43
- onRotate: C.rotate,
44
- onToggleFullscreen: C.toggleFullscreen
36
+ zoom: w.zoom,
37
+ disabled: !D,
38
+ fullscreen: w.fullscreen,
39
+ canZoomIn: w.canZoomIn,
40
+ canZoomOut: w.canZoomOut,
41
+ onZoomIn: w.zoomIn,
42
+ onZoomOut: w.zoomOut,
43
+ onRotate: w.rotate,
44
+ onToggleFullscreen: w.toggleFullscreen
45
45
  })
46
46
  ]
47
47
  }),
48
- E ? f.kind === "pdf" ? /* @__PURE__ */ u(r, {
48
+ D ? f.kind === "pdf" ? /* @__PURE__ */ u(r, {
49
49
  document: f.document,
50
- pages: O,
51
- pageMode: x,
52
- currentPage: D,
53
- onCurrentPageChange: k,
54
- zoom: C.zoom,
55
- rotation: C.rotation,
50
+ pages: k,
51
+ pageMode: S,
52
+ currentPage: O,
53
+ onCurrentPageChange: A,
54
+ zoom: w.zoom,
55
+ rotation: w.rotation,
56
56
  rail: /* @__PURE__ */ u(a, {
57
57
  document: f.document,
58
- currentPage: D,
59
- onCurrentPageChange: k
58
+ currentPage: O,
59
+ onCurrentPageChange: A
60
60
  }),
61
- renderPage: S ? (e) => S({
61
+ renderPage: C ? (e) => C({
62
62
  page: e,
63
- zoom: C.zoom,
64
- rotation: C.rotation
63
+ zoom: w.zoom,
64
+ rotation: w.rotation
65
65
  }) : void 0
66
66
  }) : /* @__PURE__ */ u(n, {
67
67
  rail: /* @__PURE__ */ u("div", {
@@ -69,8 +69,8 @@ function p({ source: f, title: p, className: m = "", style: h, ariaLabel: g = "
69
69
  children: f.images.map((t, n) => /* @__PURE__ */ d(e, {
70
70
  variant: "ghost",
71
71
  className: "ui-page-thumbnail",
72
- "aria-current": D === n + 1 ? "page" : void 0,
73
- onClick: () => k(n + 1),
72
+ "aria-current": O === n + 1 ? "page" : void 0,
73
+ onClick: () => A(n + 1),
74
74
  children: [/* @__PURE__ */ u("img", {
75
75
  src: t.src,
76
76
  alt: "",
@@ -79,10 +79,10 @@ function p({ source: f, title: p, className: m = "", style: h, ariaLabel: g = "
79
79
  }, `${n}:${t.src}`))
80
80
  }),
81
81
  children: /* @__PURE__ */ u(i, {
82
- image: f.images[D - 1],
83
- zoom: C.zoom,
84
- rotation: C.rotation
85
- }, f.images[D - 1].src)
82
+ image: f.images[O - 1],
83
+ zoom: w.zoom,
84
+ rotation: w.rotation
85
+ }, f.images[O - 1].src)
86
86
  }) : /* @__PURE__ */ u("div", {
87
87
  role: "status",
88
88
  children: "没有可预览的页面"
@@ -93,26 +93,26 @@ function p({ source: f, title: p, className: m = "", style: h, ariaLabel: g = "
93
93
  /* @__PURE__ */ u(e, {
94
94
  variant: "ghost",
95
95
  size: "compact",
96
- disabled: D <= 1,
97
- onClick: () => k(D - 1),
96
+ disabled: O <= 1,
97
+ onClick: () => A(O - 1),
98
98
  children: "上一页"
99
99
  }),
100
100
  /* @__PURE__ */ d("span", {
101
101
  "aria-live": "polite",
102
102
  children: [
103
- E ? D : 0,
103
+ D ? O : 0,
104
104
  " / ",
105
- E
105
+ D
106
106
  ]
107
107
  }),
108
108
  /* @__PURE__ */ u(e, {
109
109
  variant: "ghost",
110
110
  size: "compact",
111
- disabled: D >= E,
112
- onClick: () => k(D + 1),
111
+ disabled: O >= D,
112
+ onClick: () => A(O + 1),
113
113
  children: "下一页"
114
114
  }),
115
- v
115
+ y
116
116
  ]
117
117
  })
118
118
  ]
@@ -132,21 +132,25 @@ function g(n) {
132
132
  function _(e) {
133
133
  return e.source.kind === "url" || e.source.kind === "buffer";
134
134
  }
135
- function v({ source: e, config: n, className: c, style: l, ariaLabel: u = "PDF 文档查看器", onInit: d, onReady: p, title: m, toolbar: g, footer: _ }) {
136
- let v = i(() => h(e, n), [e, n]), y = r((e) => {
137
- f(e), d?.(e);
138
- }, [d]);
135
+ function v({ source: e, config: n, className: c, style: l, layoutMode: u = "standalone", ariaLabel: d = "PDF 文档查看器", onInit: p, onReady: m, title: g, toolbar: _, footer: v }) {
136
+ let y = i(() => h(e, n), [e, n]), b = r((e) => {
137
+ f(e), p?.(e);
138
+ }, [p]);
139
139
  return /* @__PURE__ */ o("section", {
140
- className: ["ui-document-viewer-v2", c].filter(Boolean).join(" "),
140
+ className: [
141
+ "ui-document-viewer-v2",
142
+ u === "fill" && "ui-viewer-fill",
143
+ c
144
+ ].filter(Boolean).join(" "),
141
145
  style: l,
142
- "aria-label": u,
146
+ "aria-label": d,
143
147
  children: [
144
- (m !== void 0 || g !== void 0) && /* @__PURE__ */ o("div", {
148
+ (g !== void 0 || _ !== void 0) && /* @__PURE__ */ o("div", {
145
149
  className: "ui-viewer-toolbar",
146
- children: [m !== void 0 && /* @__PURE__ */ a("div", {
150
+ children: [g !== void 0 && /* @__PURE__ */ a("div", {
147
151
  className: "ui-viewer-title",
148
- children: m
149
- }), g]
152
+ children: g
153
+ }), _]
150
154
  }),
151
155
  /* @__PURE__ */ a(t, {
152
156
  fallback: /* @__PURE__ */ a("div", {
@@ -155,14 +159,14 @@ function v({ source: e, config: n, className: c, style: l, ariaLabel: u = "PDF
155
159
  }),
156
160
  children: /* @__PURE__ */ a(s, {
157
161
  className: "ui-document-viewer-v2-engine",
158
- config: v,
159
- onInit: y,
160
- onReady: p
162
+ config: y,
163
+ onInit: b,
164
+ onReady: m
161
165
  }, e.id)
162
166
  }),
163
- _ !== void 0 && /* @__PURE__ */ a("div", {
167
+ v !== void 0 && /* @__PURE__ */ a("div", {
164
168
  className: "ui-viewer-footer",
165
- children: _
169
+ children: v
166
170
  })
167
171
  ]
168
172
  });