@qq1948037137/adminsmart-ui 0.1.25 → 0.1.27
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 +142 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +171 -34
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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
|
@@ -161,6 +161,7 @@ var Button = Object.assign(wrapAntComponent(import_antd.Button, "Button"), {
|
|
|
161
161
|
// src/components/ThemeModeButton.tsx
|
|
162
162
|
var import_icons = require("@ant-design/icons");
|
|
163
163
|
var import_react2 = require("react");
|
|
164
|
+
var import_react_dom = require("react-dom");
|
|
164
165
|
|
|
165
166
|
// src/components/overlay.ts
|
|
166
167
|
var import_antd2 = require("antd");
|
|
@@ -171,14 +172,136 @@ var Tooltip = Object.assign(wrapAntComponent(import_antd2.Tooltip, "Tooltip"), {
|
|
|
171
172
|
|
|
172
173
|
// src/components/ThemeModeButton.tsx
|
|
173
174
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
175
|
+
var documentTransitions = /* @__PURE__ */ new WeakMap();
|
|
176
|
+
var transitionAttribute = "data-adminsmart-theme-transition";
|
|
177
|
+
var transitionStyles = `
|
|
178
|
+
/* \u53EA\u6539\u53D8\u672C\u7EC4\u4EF6\u6301\u6709\u7684\u539F\u751F\u9875\u9762\u5FEB\u7167\uFF0C\u4E0D\u7ED9\u4E1A\u52A1\u63A7\u4EF6\u65BD\u52A0\u5168\u5C40\u52A8\u753B\u3002 */
|
|
179
|
+
html[${transitionAttribute}]::view-transition-old(root),
|
|
180
|
+
html[${transitionAttribute}]::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
|
|
181
|
+
html[${transitionAttribute}='dark']::view-transition-old(root),
|
|
182
|
+
html[${transitionAttribute}='light']::view-transition-new(root) { z-index: 1; }
|
|
183
|
+
html[${transitionAttribute}='dark']::view-transition-new(root),
|
|
184
|
+
html[${transitionAttribute}='light']::view-transition-old(root) { z-index: 2; }
|
|
185
|
+
`;
|
|
186
|
+
function reportThemeError(view, error) {
|
|
187
|
+
if (typeof view.reportError === "function") view.reportError(error);
|
|
188
|
+
else view.setTimeout(() => {
|
|
189
|
+
throw error;
|
|
190
|
+
}, 0);
|
|
191
|
+
}
|
|
192
|
+
function waitForThemeCommit(view) {
|
|
193
|
+
return new Promise((resolve) => {
|
|
194
|
+
let frame;
|
|
195
|
+
let timer;
|
|
196
|
+
const finish = () => {
|
|
197
|
+
if (frame !== void 0) view.cancelAnimationFrame?.(frame);
|
|
198
|
+
if (timer !== void 0) view.clearTimeout(timer);
|
|
199
|
+
resolve();
|
|
200
|
+
};
|
|
201
|
+
timer = view.setTimeout(finish, 100);
|
|
202
|
+
frame = view.requestAnimationFrame(finish);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
174
205
|
var ThemeModeButton = (0, import_react2.forwardRef)(
|
|
175
|
-
function ThemeModeButton2({ mode, onModeChange, tooltipProps, onClick, ...props }, ref) {
|
|
206
|
+
function ThemeModeButton2({ mode, onModeChange, transition = "reveal", transitionDuration = 500, tooltipProps, onClick, ...props }, ref) {
|
|
176
207
|
const nextMode = mode === "dark" ? "light" : "dark";
|
|
177
208
|
const actionLabel = nextMode === "dark" ? "\u5207\u6362\u5230\u591C\u95F4\u4E3B\u9898" : "\u5207\u6362\u5230\u65E5\u95F4\u4E3B\u9898";
|
|
178
209
|
const nextModeIcon = nextMode === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.MoonOutlined, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SunOutlined, { "aria-hidden": true });
|
|
210
|
+
const activeCleanup = (0, import_react2.useRef)(null);
|
|
211
|
+
const [transitioning, setTransitioning] = (0, import_react2.useState)(false);
|
|
212
|
+
(0, import_react2.useEffect)(() => () => activeCleanup.current?.(), []);
|
|
179
213
|
const handleClick = (event) => {
|
|
180
214
|
onClick?.(event);
|
|
181
|
-
if (
|
|
215
|
+
if (event.defaultPrevented || !onModeChange || activeCleanup.current) return;
|
|
216
|
+
const ownerDocument = event.currentTarget.ownerDocument;
|
|
217
|
+
const view = ownerDocument.defaultView;
|
|
218
|
+
const root = ownerDocument.documentElement;
|
|
219
|
+
const duration = Number.isFinite(transitionDuration) ? transitionDuration : 500;
|
|
220
|
+
if (documentTransitions.has(ownerDocument)) return;
|
|
221
|
+
if (!view || transition === "none" || duration <= 0 || view.matchMedia?.("(prefers-reduced-motion: reduce)").matches || typeof ownerDocument.startViewTransition !== "function" || typeof root.animate !== "function") {
|
|
222
|
+
const result = onModeChange(nextMode);
|
|
223
|
+
if (view) void Promise.resolve(result).catch((error) => reportThemeError(view, error));
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const bounds = event.currentTarget.getBoundingClientRect();
|
|
227
|
+
const x = event.detail > 0 ? event.clientX : bounds.left + bounds.width / 2;
|
|
228
|
+
const y = event.detail > 0 ? event.clientY : bounds.top + bounds.height / 2;
|
|
229
|
+
const radius = Math.hypot(Math.max(x, view.innerWidth - x), Math.max(y, view.innerHeight - y));
|
|
230
|
+
const previousAttribute = root.getAttribute(transitionAttribute);
|
|
231
|
+
const style = ownerDocument.createElement("style");
|
|
232
|
+
let nativeTransition;
|
|
233
|
+
let animation;
|
|
234
|
+
let cancelled = false;
|
|
235
|
+
let applied = false;
|
|
236
|
+
const cleanup = () => {
|
|
237
|
+
if (cancelled) return;
|
|
238
|
+
cancelled = true;
|
|
239
|
+
animation?.cancel();
|
|
240
|
+
nativeTransition?.skipTransition();
|
|
241
|
+
style.remove();
|
|
242
|
+
if (documentTransitions.get(ownerDocument) === cleanup) {
|
|
243
|
+
documentTransitions.delete(ownerDocument);
|
|
244
|
+
if (previousAttribute === null) root.removeAttribute(transitionAttribute);
|
|
245
|
+
else root.setAttribute(transitionAttribute, previousAttribute);
|
|
246
|
+
}
|
|
247
|
+
if (activeCleanup.current === cleanup) {
|
|
248
|
+
activeCleanup.current = null;
|
|
249
|
+
setTransitioning(false);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
activeCleanup.current = cleanup;
|
|
253
|
+
documentTransitions.set(ownerDocument, cleanup);
|
|
254
|
+
setTransitioning(true);
|
|
255
|
+
style.textContent = transitionStyles;
|
|
256
|
+
style.dataset.adminsmartThemeTransition = "";
|
|
257
|
+
ownerDocument.head.appendChild(style);
|
|
258
|
+
root.setAttribute(transitionAttribute, nextMode);
|
|
259
|
+
try {
|
|
260
|
+
nativeTransition = ownerDocument.startViewTransition(async () => {
|
|
261
|
+
if (cancelled) return;
|
|
262
|
+
applied = true;
|
|
263
|
+
let result = void 0;
|
|
264
|
+
try {
|
|
265
|
+
(0, import_react_dom.flushSync)(() => {
|
|
266
|
+
result = onModeChange(nextMode);
|
|
267
|
+
});
|
|
268
|
+
await result;
|
|
269
|
+
if (!cancelled && typeof view.requestAnimationFrame === "function") {
|
|
270
|
+
await waitForThemeCommit(view);
|
|
271
|
+
}
|
|
272
|
+
} catch (error) {
|
|
273
|
+
reportThemeError(view, error);
|
|
274
|
+
throw error;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
void nativeTransition.updateCallbackDone.catch(() => void 0);
|
|
278
|
+
void nativeTransition.ready.then(() => {
|
|
279
|
+
if (cancelled) return;
|
|
280
|
+
const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${radius}px at ${x}px ${y}px)`];
|
|
281
|
+
animation = root.animate({ clipPath: nextMode === "dark" ? clipPath : clipPath.reverse() }, {
|
|
282
|
+
duration,
|
|
283
|
+
// 宿主可调整节奏,不替换主题算法。
|
|
284
|
+
easing: "ease-in",
|
|
285
|
+
// 与 Ant 官网圆形过渡保持同类节奏。
|
|
286
|
+
pseudoElement: nextMode === "dark" ? "::view-transition-new(root)" : "::view-transition-old(root)"
|
|
287
|
+
// 只处理深色快照。
|
|
288
|
+
});
|
|
289
|
+
return animation.finished;
|
|
290
|
+
}).catch(() => {
|
|
291
|
+
if (!cancelled && !applied) {
|
|
292
|
+
applied = true;
|
|
293
|
+
const result = onModeChange(nextMode);
|
|
294
|
+
void Promise.resolve(result).catch((error) => reportThemeError(view, error));
|
|
295
|
+
}
|
|
296
|
+
}).finally(cleanup).catch((error) => reportThemeError(view, error));
|
|
297
|
+
void nativeTransition.finished.catch(() => void 0).finally(cleanup);
|
|
298
|
+
} catch {
|
|
299
|
+
cleanup();
|
|
300
|
+
if (!applied) {
|
|
301
|
+
const result = onModeChange(nextMode);
|
|
302
|
+
void Promise.resolve(result).catch((error) => reportThemeError(view, error));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
182
305
|
};
|
|
183
306
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip, { title: actionLabel, ...tooltipProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
184
307
|
Button,
|
|
@@ -188,8 +311,11 @@ var ThemeModeButton = (0, import_react2.forwardRef)(
|
|
|
188
311
|
icon: nextModeIcon,
|
|
189
312
|
"aria-label": actionLabel,
|
|
190
313
|
"aria-pressed": mode === "dark",
|
|
314
|
+
"aria-busy": transitioning || void 0,
|
|
191
315
|
...props,
|
|
316
|
+
style: { minWidth: 44, minHeight: 44, ...props.style },
|
|
192
317
|
ref,
|
|
318
|
+
disabled: transitioning ? true : props.disabled,
|
|
193
319
|
onClick: handleClick
|
|
194
320
|
}
|
|
195
321
|
) });
|
|
@@ -241,6 +367,11 @@ var Select = Object.assign(wrapAntComponent(import_antd8.Select, "Select"), {
|
|
|
241
367
|
var import_antd10 = require("antd");
|
|
242
368
|
var import_react3 = require("react");
|
|
243
369
|
|
|
370
|
+
// src/internal/paginationTotal.ts
|
|
371
|
+
function paginationTotal(total) {
|
|
372
|
+
return `\u5171 ${total} \u6761`;
|
|
373
|
+
}
|
|
374
|
+
|
|
244
375
|
// src/components/feedback.ts
|
|
245
376
|
var import_antd9 = require("antd");
|
|
246
377
|
var Alert = Object.assign(wrapAntComponent(import_antd9.Alert, "Alert"), {
|
|
@@ -275,7 +406,9 @@ function normalizeTableProps(props) {
|
|
|
275
406
|
const locale = props.locale ?? {};
|
|
276
407
|
const content = locale.emptyText;
|
|
277
408
|
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
|
-
|
|
409
|
+
const pagination = props.pagination;
|
|
410
|
+
const tablePagination = pagination === false ? false : { showTotal: paginationTotal, ...pagination };
|
|
411
|
+
return { ...props, locale: { ...locale, emptyText }, pagination: tablePagination };
|
|
279
412
|
}
|
|
280
413
|
var Summary = Object.assign(wrapAntComponent(import_antd10.Table.Summary, "Table.Summary"), {
|
|
281
414
|
Row: wrapAntComponent(import_antd10.Table.Summary.Row, "Table.Summary.Row"),
|
|
@@ -338,10 +471,14 @@ var Descriptions = Object.assign(wrapAntComponent(import_antd13.Descriptions, "D
|
|
|
338
471
|
var ListItem = Object.assign(wrapAntComponent(import_antd13.List.Item, "List.Item"), {
|
|
339
472
|
Meta: wrapAntComponent(import_antd13.List.Item.Meta, "List.Item.Meta")
|
|
340
473
|
});
|
|
341
|
-
|
|
474
|
+
function normalizeListProps(props) {
|
|
475
|
+
const pagination = props.pagination;
|
|
476
|
+
return pagination && typeof pagination === "object" ? { ...props, pagination: { showTotal: paginationTotal, ...pagination } } : props;
|
|
477
|
+
}
|
|
478
|
+
var List = Object.assign(wrapAntComponent(import_antd13.List, "List", {}, normalizeListProps), {
|
|
342
479
|
Item: ListItem
|
|
343
480
|
});
|
|
344
|
-
var Pagination = wrapAntComponent(import_antd13.Pagination, "Pagination");
|
|
481
|
+
var Pagination = wrapAntComponent(import_antd13.Pagination, "Pagination", { showTotal: paginationTotal });
|
|
345
482
|
var Tree = Object.assign(wrapAntComponent(import_antd13.Tree, "Tree"), {
|
|
346
483
|
DirectoryTree: wrapAntComponent(import_antd13.Tree.DirectoryTree, "Tree.DirectoryTree"),
|
|
347
484
|
TreeNode: wrapAntComponent(import_antd13.Tree.TreeNode, "Tree.TreeNode")
|