@jc-times/business-ui 0.2.54 → 0.2.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  });