@qq1948037137/adminsmart-ui 0.1.24 → 0.1.26

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/dist/index.d.cts CHANGED
@@ -80,6 +80,7 @@ declare const Timeline: typeof Timeline$1;
80
80
  declare const Card: typeof Card$1;
81
81
  declare const Descriptions: typeof Descriptions$1;
82
82
  declare const List: typeof List$1;
83
+ /** 默认显示完整记录总数,原生 showTotal 回调或显式 undefined 可以覆盖;所有页码与事件仍由 Ant 处理。 */
83
84
  declare const Pagination: typeof Pagination$1;
84
85
  declare const Tree: typeof Tree$1;
85
86
 
package/dist/index.d.ts CHANGED
@@ -80,6 +80,7 @@ declare const Timeline: typeof Timeline$1;
80
80
  declare const Card: typeof Card$1;
81
81
  declare const Descriptions: typeof Descriptions$1;
82
82
  declare const List: typeof List$1;
83
+ /** 默认显示完整记录总数,原生 showTotal 回调或显式 undefined 可以覆盖;所有页码与事件仍由 Ant 处理。 */
83
84
  declare const Pagination: typeof Pagination$1;
84
85
  declare const Tree: typeof Tree$1;
85
86
 
package/dist/index.js CHANGED
@@ -117,6 +117,11 @@ var Select = Object.assign(wrapAntComponent(AntSelect, "Select"), {
117
117
  import { Table as AntTable } from "antd";
118
118
  import { createElement as createElement2 } from "react";
119
119
 
120
+ // src/internal/paginationTotal.ts
121
+ function paginationTotal(total) {
122
+ return `\u5171 ${total} \u6761`;
123
+ }
124
+
120
125
  // src/components/feedback.ts
121
126
  import {
122
127
  Alert as AntAlert,
@@ -161,7 +166,9 @@ function normalizeTableProps(props) {
161
166
  const locale = props.locale ?? {};
162
167
  const content = locale.emptyText;
163
168
  const emptyText = content === void 0 ? createElement2(TableEmpty) : typeof content === "string" || typeof content === "number" ? createElement2(TableEmpty, { description: content }) : content;
164
- return { ...props, locale: { ...locale, emptyText } };
169
+ const pagination = props.pagination;
170
+ const tablePagination = pagination === false ? false : { showTotal: paginationTotal, ...pagination };
171
+ return { ...props, locale: { ...locale, emptyText }, pagination: tablePagination };
165
172
  }
166
173
  var Summary = Object.assign(wrapAntComponent(AntTable.Summary, "Table.Summary"), {
167
174
  Row: wrapAntComponent(AntTable.Summary.Row, "Table.Summary.Row"),
@@ -240,10 +247,14 @@ var Descriptions = Object.assign(wrapAntComponent(AntDescriptions, "Descriptions
240
247
  var ListItem = Object.assign(wrapAntComponent(AntList.Item, "List.Item"), {
241
248
  Meta: wrapAntComponent(AntList.Item.Meta, "List.Item.Meta")
242
249
  });
243
- var List = Object.assign(wrapAntComponent(AntList, "List"), {
250
+ function normalizeListProps(props) {
251
+ const pagination = props.pagination;
252
+ return pagination && typeof pagination === "object" ? { ...props, pagination: { showTotal: paginationTotal, ...pagination } } : props;
253
+ }
254
+ var List = Object.assign(wrapAntComponent(AntList, "List", {}, normalizeListProps), {
244
255
  Item: ListItem
245
256
  });
246
- var Pagination = wrapAntComponent(AntPagination, "Pagination");
257
+ var Pagination = wrapAntComponent(AntPagination, "Pagination", { showTotal: paginationTotal });
247
258
  var Tree = Object.assign(wrapAntComponent(AntTree, "Tree"), {
248
259
  DirectoryTree: wrapAntComponent(AntTree.DirectoryTree, "Tree.DirectoryTree"),
249
260
  TreeNode: wrapAntComponent(AntTree.TreeNode, "Tree.TreeNode")
@@ -594,6 +605,25 @@ function replayFit(stageWidth, stageHeight, contentWidth, contentHeight) {
594
605
  // 垂直居中。
595
606
  };
596
607
  }
608
+ function replayWidthLayout(stageWidth, contentWidth, contentHeight) {
609
+ const width = finiteReplayNumber(stageWidth);
610
+ const recordedWidth = finiteReplayNumber(contentWidth);
611
+ const recordedHeight = finiteReplayNumber(contentHeight);
612
+ if (width <= 0 || recordedWidth <= 0 || recordedHeight <= 0) return null;
613
+ const scale = width / recordedWidth;
614
+ const height = recordedHeight * scale;
615
+ if (!Number.isFinite(scale) || !Number.isFinite(height) || height <= 0) return null;
616
+ return {
617
+ scale,
618
+ // 普通容器允许按可用宽度放大或缩小。
619
+ height,
620
+ // 官方视口完整占据舞台,业务抽屉负责正文滚动。
621
+ left: 0,
622
+ // 正常容器不增加左右背景留白。
623
+ top: 0
624
+ // 舞台高度与缩放画面一致,无需垂直居中。
625
+ };
626
+ }
597
627
  function replayClock(timeMs) {
598
628
  const seconds = Math.floor(Math.max(0, finiteReplayNumber(timeMs)) / 1e3);
599
629
  return `${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`;
@@ -703,6 +733,8 @@ function useSessionReplay(options) {
703
733
  if (engineRef.current === player) engineRef.current = null;
704
734
  player = null;
705
735
  rootRef.current?.replaceChildren();
736
+ stageRef.current?.style.removeProperty("--adminsmart-replay-recorded-height");
737
+ stageRef.current?.removeAttribute("data-replay-viewport");
706
738
  };
707
739
  const fail = (code, message) => {
708
740
  if (!current || failed) return;
@@ -716,7 +748,15 @@ function useSessionReplay(options) {
716
748
  runtimeFailureRef.current = commandFailure;
717
749
  const fit = () => {
718
750
  if (!current || !player || !stageRef.current) return;
719
- const dimensions = replayFit(stageRef.current.clientWidth, stageRef.current.clientHeight, Number(player.iframe.width), Number(player.iframe.height));
751
+ const stage = stageRef.current;
752
+ const recordedWidth = Number(player.iframe.width);
753
+ const recordedHeight = Number(player.iframe.height);
754
+ const widthLayout = replayWidthLayout(stage.clientWidth, recordedWidth, recordedHeight);
755
+ if (!widthLayout) return;
756
+ stage.style.setProperty("--adminsmart-replay-recorded-height", `${widthLayout.height}px`);
757
+ stage.setAttribute("data-replay-viewport", "recorded");
758
+ const fullscreen = document.fullscreenElement === stage.parentElement;
759
+ const dimensions = fullscreen ? replayFit(stage.clientWidth, stage.clientHeight, recordedWidth, recordedHeight) : widthLayout;
720
760
  player.wrapper.style.position = "absolute";
721
761
  player.wrapper.style.left = `${dimensions.left}px`;
722
762
  player.wrapper.style.top = `${dimensions.top}px`;
@@ -724,6 +764,7 @@ function useSessionReplay(options) {
724
764
  player.wrapper.style.transform = `scale(${dimensions.scale})`;
725
765
  };
726
766
  const scheduleFit = () => {
767
+ if (!current || failed) return;
727
768
  if (fitFrame !== void 0) window.cancelAnimationFrame(fitFrame);
728
769
  fitFrame = window.requestAnimationFrame(() => {
729
770
  fitFrame = void 0;
@@ -824,6 +865,7 @@ function useSessionReplay(options) {
824
865
  observer.observe(stageRef.current);
825
866
  }
826
867
  window.addEventListener("resize", onLayout);
868
+ document.addEventListener("fullscreenchange", onLayout);
827
869
  loadReplayEngine().then((value) => {
828
870
  if (!current) return;
829
871
  Constructor = value;
@@ -833,6 +875,7 @@ function useSessionReplay(options) {
833
875
  current = false;
834
876
  observer?.disconnect();
835
877
  window.removeEventListener("resize", onLayout);
878
+ document.removeEventListener("fullscreenchange", onLayout);
836
879
  if (runtimeFailureRef.current === commandFailure) runtimeFailureRef.current = null;
837
880
  if (replayEventsRef.current === prepared) replayEventsRef.current = [];
838
881
  releaseEngine();