@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/README.md +2 -0
- package/dist/index.cjs +47 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +47 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/styles/composites.css +13 -0
package/README.md
CHANGED
|
@@ -49,6 +49,8 @@ function Example() {
|
|
|
49
49
|
|
|
50
50
|
所有包装组件保留 Ant 原有 props、ref 类型与公开静态 API;包装后的静态子组件也有独立扩展点。`theme`、图标、locale 是**原样透传**,并非包装。`BusinessDrawer` 统一右侧业务抽屉及尺寸档位;原生 `Drawer` 仍允许按 Ant 属性覆盖。`SearchPanel` 使用等宽字段和最多两行的默认折叠;`DataTable` 默认将数据滚动限制在表格内部并把分页放在右下角。`SchemaForm` 根据 JSON 字段配置渲染输入、密码、文本域、数值、选择、单选、布尔值和日期控件,事件处理器通过独立 props 传入,不执行配置中的代码。输入值默认不裁剪空格,避免改变密码和精确搜索语义。
|
|
51
51
|
|
|
52
|
+
`Pagination`、`Table`、`DataTable` 和显式启用分页的 `List` 默认显示 `共 N 条`,数量来自 Ant 的本地数据总数或业务传入的 `total`,不会把当前页行数当作完整数量。原生 `showTotal={(total, range) => ...}` 可自定义总数文案,显式 `showTotal={undefined}` 可隐藏;表格和列表仍可通过 `pagination={false}` 关闭分页。页码、每页条数、回调、ref 和原生公开类型继续保留,列表未配置分页时不会额外开启分页。
|
|
53
|
+
|
|
52
54
|
主应用的本地 tarball 过渡与 npm Registry 升级都必须锁定精确版本、实际包名和完整性,不能仅改依赖字符串而跳过来源校验。本库通过 `adminsmartUiSource: { sha256, gitCommit }` 提供构建源码标记,消费者使用 Registry 的 `dist.integrity` 与 `dist.tarball` 核对字节。该标记是项目来源契约,不是官方 provenance。
|
|
53
55
|
|
|
54
56
|
`SessionReplay` 接收已授权、已解压的只读对象事件,默认暂停在可见窗口起点。它按需装载 `@rrweb/replay@2.0.1` 的官方 JS/CSS,相关 rrweb、types、utils、rrdom 和 snapshot 协议包也精确锁定为 `2.0.1`;发布验证会检查全新宿主的实际安装树,防止上游范围依赖漂移。组件等待真实容器尺寸和官方快照重建,负责有界跳转、结束重播、倍率、时间标记与全屏;隐藏或切换事件时销毁实例和监听。样式随既有 `@adminsmart/ui/styles/composites.css` 交付。业务宿主仍负责数据请求、权限、解压和录制脱敏;组件不会读取 API、凭据、会话或录制原页面。可操作的 5 秒合成录像见文档站 `SessionReplay 操作回放`,公开输入与引用类型由包类型声明提供。
|
package/dist/index.cjs
CHANGED
|
@@ -241,6 +241,11 @@ var Select = Object.assign(wrapAntComponent(import_antd8.Select, "Select"), {
|
|
|
241
241
|
var import_antd10 = require("antd");
|
|
242
242
|
var import_react3 = require("react");
|
|
243
243
|
|
|
244
|
+
// src/internal/paginationTotal.ts
|
|
245
|
+
function paginationTotal(total) {
|
|
246
|
+
return `\u5171 ${total} \u6761`;
|
|
247
|
+
}
|
|
248
|
+
|
|
244
249
|
// src/components/feedback.ts
|
|
245
250
|
var import_antd9 = require("antd");
|
|
246
251
|
var Alert = Object.assign(wrapAntComponent(import_antd9.Alert, "Alert"), {
|
|
@@ -275,7 +280,9 @@ function normalizeTableProps(props) {
|
|
|
275
280
|
const locale = props.locale ?? {};
|
|
276
281
|
const content = locale.emptyText;
|
|
277
282
|
const emptyText = content === void 0 ? (0, import_react3.createElement)(TableEmpty) : typeof content === "string" || typeof content === "number" ? (0, import_react3.createElement)(TableEmpty, { description: content }) : content;
|
|
278
|
-
|
|
283
|
+
const pagination = props.pagination;
|
|
284
|
+
const tablePagination = pagination === false ? false : { showTotal: paginationTotal, ...pagination };
|
|
285
|
+
return { ...props, locale: { ...locale, emptyText }, pagination: tablePagination };
|
|
279
286
|
}
|
|
280
287
|
var Summary = Object.assign(wrapAntComponent(import_antd10.Table.Summary, "Table.Summary"), {
|
|
281
288
|
Row: wrapAntComponent(import_antd10.Table.Summary.Row, "Table.Summary.Row"),
|
|
@@ -338,10 +345,14 @@ var Descriptions = Object.assign(wrapAntComponent(import_antd13.Descriptions, "D
|
|
|
338
345
|
var ListItem = Object.assign(wrapAntComponent(import_antd13.List.Item, "List.Item"), {
|
|
339
346
|
Meta: wrapAntComponent(import_antd13.List.Item.Meta, "List.Item.Meta")
|
|
340
347
|
});
|
|
341
|
-
|
|
348
|
+
function normalizeListProps(props) {
|
|
349
|
+
const pagination = props.pagination;
|
|
350
|
+
return pagination && typeof pagination === "object" ? { ...props, pagination: { showTotal: paginationTotal, ...pagination } } : props;
|
|
351
|
+
}
|
|
352
|
+
var List = Object.assign(wrapAntComponent(import_antd13.List, "List", {}, normalizeListProps), {
|
|
342
353
|
Item: ListItem
|
|
343
354
|
});
|
|
344
|
-
var Pagination = wrapAntComponent(import_antd13.Pagination, "Pagination");
|
|
355
|
+
var Pagination = wrapAntComponent(import_antd13.Pagination, "Pagination", { showTotal: paginationTotal });
|
|
345
356
|
var Tree = Object.assign(wrapAntComponent(import_antd13.Tree, "Tree"), {
|
|
346
357
|
DirectoryTree: wrapAntComponent(import_antd13.Tree.DirectoryTree, "Tree.DirectoryTree"),
|
|
347
358
|
TreeNode: wrapAntComponent(import_antd13.Tree.TreeNode, "Tree.TreeNode")
|
|
@@ -685,6 +696,25 @@ function replayFit(stageWidth, stageHeight, contentWidth, contentHeight) {
|
|
|
685
696
|
// 垂直居中。
|
|
686
697
|
};
|
|
687
698
|
}
|
|
699
|
+
function replayWidthLayout(stageWidth, contentWidth, contentHeight) {
|
|
700
|
+
const width = finiteReplayNumber(stageWidth);
|
|
701
|
+
const recordedWidth = finiteReplayNumber(contentWidth);
|
|
702
|
+
const recordedHeight = finiteReplayNumber(contentHeight);
|
|
703
|
+
if (width <= 0 || recordedWidth <= 0 || recordedHeight <= 0) return null;
|
|
704
|
+
const scale = width / recordedWidth;
|
|
705
|
+
const height = recordedHeight * scale;
|
|
706
|
+
if (!Number.isFinite(scale) || !Number.isFinite(height) || height <= 0) return null;
|
|
707
|
+
return {
|
|
708
|
+
scale,
|
|
709
|
+
// 普通容器允许按可用宽度放大或缩小。
|
|
710
|
+
height,
|
|
711
|
+
// 官方视口完整占据舞台,业务抽屉负责正文滚动。
|
|
712
|
+
left: 0,
|
|
713
|
+
// 正常容器不增加左右背景留白。
|
|
714
|
+
top: 0
|
|
715
|
+
// 舞台高度与缩放画面一致,无需垂直居中。
|
|
716
|
+
};
|
|
717
|
+
}
|
|
688
718
|
function replayClock(timeMs) {
|
|
689
719
|
const seconds = Math.floor(Math.max(0, finiteReplayNumber(timeMs)) / 1e3);
|
|
690
720
|
return `${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`;
|
|
@@ -794,6 +824,8 @@ function useSessionReplay(options) {
|
|
|
794
824
|
if (engineRef.current === player) engineRef.current = null;
|
|
795
825
|
player = null;
|
|
796
826
|
rootRef.current?.replaceChildren();
|
|
827
|
+
stageRef.current?.style.removeProperty("--adminsmart-replay-recorded-height");
|
|
828
|
+
stageRef.current?.removeAttribute("data-replay-viewport");
|
|
797
829
|
};
|
|
798
830
|
const fail = (code, message) => {
|
|
799
831
|
if (!current || failed) return;
|
|
@@ -807,7 +839,15 @@ function useSessionReplay(options) {
|
|
|
807
839
|
runtimeFailureRef.current = commandFailure;
|
|
808
840
|
const fit = () => {
|
|
809
841
|
if (!current || !player || !stageRef.current) return;
|
|
810
|
-
const
|
|
842
|
+
const stage = stageRef.current;
|
|
843
|
+
const recordedWidth = Number(player.iframe.width);
|
|
844
|
+
const recordedHeight = Number(player.iframe.height);
|
|
845
|
+
const widthLayout = replayWidthLayout(stage.clientWidth, recordedWidth, recordedHeight);
|
|
846
|
+
if (!widthLayout) return;
|
|
847
|
+
stage.style.setProperty("--adminsmart-replay-recorded-height", `${widthLayout.height}px`);
|
|
848
|
+
stage.setAttribute("data-replay-viewport", "recorded");
|
|
849
|
+
const fullscreen = document.fullscreenElement === stage.parentElement;
|
|
850
|
+
const dimensions = fullscreen ? replayFit(stage.clientWidth, stage.clientHeight, recordedWidth, recordedHeight) : widthLayout;
|
|
811
851
|
player.wrapper.style.position = "absolute";
|
|
812
852
|
player.wrapper.style.left = `${dimensions.left}px`;
|
|
813
853
|
player.wrapper.style.top = `${dimensions.top}px`;
|
|
@@ -815,6 +855,7 @@ function useSessionReplay(options) {
|
|
|
815
855
|
player.wrapper.style.transform = `scale(${dimensions.scale})`;
|
|
816
856
|
};
|
|
817
857
|
const scheduleFit = () => {
|
|
858
|
+
if (!current || failed) return;
|
|
818
859
|
if (fitFrame !== void 0) window.cancelAnimationFrame(fitFrame);
|
|
819
860
|
fitFrame = window.requestAnimationFrame(() => {
|
|
820
861
|
fitFrame = void 0;
|
|
@@ -915,6 +956,7 @@ function useSessionReplay(options) {
|
|
|
915
956
|
observer.observe(stageRef.current);
|
|
916
957
|
}
|
|
917
958
|
window.addEventListener("resize", onLayout);
|
|
959
|
+
document.addEventListener("fullscreenchange", onLayout);
|
|
918
960
|
loadReplayEngine().then((value) => {
|
|
919
961
|
if (!current) return;
|
|
920
962
|
Constructor = value;
|
|
@@ -924,6 +966,7 @@ function useSessionReplay(options) {
|
|
|
924
966
|
current = false;
|
|
925
967
|
observer?.disconnect();
|
|
926
968
|
window.removeEventListener("resize", onLayout);
|
|
969
|
+
document.removeEventListener("fullscreenchange", onLayout);
|
|
927
970
|
if (runtimeFailureRef.current === commandFailure) runtimeFailureRef.current = null;
|
|
928
971
|
if (replayEventsRef.current === prepared) replayEventsRef.current = [];
|
|
929
972
|
releaseEngine();
|