@qq1948037137/adminsmart-ui 0.1.30 → 0.1.32

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 CHANGED
@@ -51,7 +51,7 @@ function Example() {
51
51
 
52
52
  `Pagination`、`Table`、`DataTable` 和显式启用分页的 `List` 默认显示 `共 N 条`,数量来自 Ant 的本地数据总数或业务传入的 `total`,不会把当前页行数当作完整数量。原生 `showTotal={(total, range) => ...}` 可自定义总数文案,显式 `showTotal={undefined}` 可隐藏;表格和列表仍可通过 `pagination={false}` 关闭分页。页码、每页条数、回调、ref 和原生公开类型继续保留,列表未配置分页时不会额外开启分页。
53
53
 
54
- 用 `ReportErrorProvider` 在应用入口绑定问题上报行为。`OperationToolbar` 将「问题上报」放在新增、导出等左侧业务操作之后,右侧的 `TableControls` 依次提供搜索显隐、刷新和选择列。`SearchPanel.tools/trailingTools` 和 `CrudWorkspace.actions/controls` 会使用同一个操作栏。没有列表工具栏的页面可使用 `ErrorReportButton`。宿主负责采集范围、脱敏、请求和结果反馈。
54
+ 用 `ReportErrorProvider` 在应用入口绑定问题上报行为。`OperationToolbar` 将「问题上报」放在新增、导出等左侧业务操作之后,右侧的 `TableControls` 依次提供搜索显隐、刷新和选择列。`SearchPanel.tools/trailingTools` 和 `CrudWorkspace.actions/controls` 会使用同一个操作栏。没有列表工具栏的页面可使用 `ErrorReportButton`。上报中通过文字展示进度并阻止重复提交,`description` 供辅助技术读取。宿主负责采集范围、脱敏、请求和结果反馈。
55
55
 
56
56
  在 `WorkspaceLayout contentMode="table"` 的内容区嵌入 `CrudWorkspace`,可使用独立的筛选、操作栏、反馈与页脚插槽,`DataTable` 自动填满剩余区域。结果超出高度时在表体内滚动,分页仍保持可见。文档站的「CrudWorkspace 标准 CRUD 工作区」展示同一布局中的搜索、刷新、显隐列、新建、编辑和删除。
57
57
 
@@ -59,6 +59,8 @@ function Example() {
59
59
 
60
60
  `SessionReplay` 接收已授权、已解压的只读对象事件,默认暂停在可见窗口起点。它按需装载 `@rrweb/replay@2.0.1` 的官方 JS/CSS,相关 rrweb、types、utils、rrdom 和 snapshot 协议包也精确锁定为 `2.0.1`;发布验证会检查全新宿主的实际安装树,防止上游范围依赖漂移。组件等待真实容器尺寸和官方快照重建,负责有界跳转、结束重播、倍率、时间标记与全屏;隐藏或切换事件时销毁实例和监听。样式随既有 `@adminsmart/ui/styles/composites.css` 交付。业务宿主仍负责数据请求、权限、解压和录制脱敏;组件不会读取 API、凭据、会话或录制原页面。可操作的 5 秒合成录像见文档站 `SessionReplay 操作回放`,公开输入与引用类型由包类型声明提供。
61
61
 
62
+ `SessionReplay` 默认关闭鼠标轨迹。宿主传入 `mouseTrail` 与已录制的 rrweb `MouseMove` 事件后,播放器以主题主色显示原生轨迹。轨迹跟随录像坐标和播放倍率;拖动时间轴保留该时刻的鼠标位置。文档示例可实时开关轨迹。
63
+
62
64
  ## 首次发布与可信自动发布
63
65
 
64
66
  GitHub 工作流通过仓库变量 `NPM_RELEASE_ENABLED` 控制发布;变量未设为 `true` 时,仅显示待设置通知。首次包不存在时,发布状态机只返回 `bootstrap-needed`,不猜版本、不创建版本提交。首次发布前应完成账号 2FA 和 npm CLI 登录,确认源码已提交到私有仓库 `1948037137/adminsmart-ui` 的当前 `main`,然后执行:
package/dist/index.cjs CHANGED
@@ -1013,6 +1013,7 @@ function useSessionReplay(options) {
1013
1013
  if (!current || failed || player || !Constructor || !stageRef.current || !rootRef.current) return;
1014
1014
  if (stageRef.current.clientWidth <= 0 || stageRef.current.clientHeight <= 0) return;
1015
1015
  try {
1016
+ const mouseTrailColor = callbackRef.current.mouseTrailColor;
1016
1017
  player = new Constructor(prepared, {
1017
1018
  root: rootRef.current,
1018
1019
  // 实例只能挂载在自己的专属节点。
@@ -1022,8 +1023,8 @@ function useSessionReplay(options) {
1022
1023
  // 不输出授权录像数据。
1023
1024
  showWarning: false,
1024
1025
  // 友好错误由包装层统一处理。
1025
- mouseTail: false,
1026
- // 不额外生成画布轨迹。
1026
+ mouseTail: mouseTrailColor ? { strokeStyle: mouseTrailColor } : false,
1027
+ // 官方只在回放外层绘制已录制的鼠标轨迹。
1027
1028
  triggerFocus: false,
1028
1029
  // 回放不能改变宿主焦点。
1029
1030
  UNSAFE_replayCanvas: false,
@@ -1103,6 +1104,16 @@ function useSessionReplay(options) {
1103
1104
  releaseEngine();
1104
1105
  };
1105
1106
  }, [options.active, options.loading, options.error, options.events, options.startOffsetMs, options.endOffsetMs, options.autoPlay, options.stageRef, options.rootRef, publish]);
1107
+ (0, import_react5.useEffect)(() => {
1108
+ const player = engineRef.current;
1109
+ if (!player) return;
1110
+ const color = options.mouseTrailColor;
1111
+ try {
1112
+ player.setConfig({ mouseTail: color ? { strokeStyle: color } : false });
1113
+ } catch {
1114
+ runtimeFailureRef.current?.();
1115
+ }
1116
+ }, [options.mouseTrailColor]);
1106
1117
  const play = (0, import_react5.useCallback)(() => {
1107
1118
  if (!engineRef.current || stateRef.current.status !== "ready" || !rangeRef.current.total) return;
1108
1119
  const target = stateRef.current.currentTimeMs >= rangeRef.current.total ? 0 : stateRef.current.currentTimeMs;
@@ -1158,7 +1169,7 @@ function useSessionReplay(options) {
1158
1169
  // src/composites/SessionReplay.tsx
1159
1170
  var import_jsx_runtime4 = require("react/jsx-runtime");
1160
1171
  var playbackRates = [0.5, 1, 1.5, 2];
1161
- var SessionReplay = (0, import_react6.forwardRef)(function SessionReplay2({ events, active = true, loading = false, error, startOffsetMs, endOffsetMs, autoPlay = false, markers = [], extra, onStateChange, onError, className, style }, ref) {
1172
+ var SessionReplay = (0, import_react6.forwardRef)(function SessionReplay2({ events, active = true, loading = false, error, startOffsetMs, endOffsetMs, autoPlay = false, mouseTrail = false, markers = [], extra, onStateChange, onError, className, style }, ref) {
1162
1173
  const { token } = import_antd45.theme.useToken();
1163
1174
  const containerRef = (0, import_react6.useRef)(null);
1164
1175
  const stageRef = (0, import_react6.useRef)(null);
@@ -1172,7 +1183,8 @@ var SessionReplay = (0, import_react6.forwardRef)(function SessionReplay2({ even
1172
1183
  (0, import_react6.useEffect)(() => {
1173
1184
  setProblem(null);
1174
1185
  }, [events, active, loading, error, startOffsetMs, endOffsetMs]);
1175
- const controls = useSessionReplay({ events, active, loading, error, startOffsetMs, endOffsetMs, autoPlay, stageRef, rootRef, onStateChange, onError: reportError });
1186
+ const mouseTrailColor = mouseTrail ? token.colorPrimary : void 0;
1187
+ const controls = useSessionReplay({ events, active, loading, error, startOffsetMs, endOffsetMs, autoPlay, mouseTrailColor, stageRef, rootRef, onStateChange, onError: reportError });
1176
1188
  const { state, play, pause, seek, restart, getState, setPlaybackRate } = controls;
1177
1189
  const ready = state.status === "ready";
1178
1190
  const themeStyle = {
@@ -1295,21 +1307,20 @@ var SessionReplay = (0, import_react6.forwardRef)(function SessionReplay2({ even
1295
1307
  });
1296
1308
 
1297
1309
  // src/composites/SearchPanel.tsx
1298
- var import_icons4 = require("@ant-design/icons");
1310
+ var import_icons3 = require("@ant-design/icons");
1299
1311
  var import_react9 = require("react");
1300
1312
 
1301
1313
  // src/composites/OperationToolbar.tsx
1302
1314
  var import_react8 = require("react");
1303
1315
 
1304
1316
  // src/composites/ErrorReportButton.tsx
1305
- var import_icons3 = require("@ant-design/icons");
1306
1317
  var import_react7 = require("react");
1307
1318
  var import_jsx_runtime5 = require("react/jsx-runtime");
1308
1319
  function ErrorReportButton({
1309
1320
  onReport,
1310
1321
  disabled = false,
1311
1322
  onReportFailure,
1312
- description = "\u95EE\u9898\u4E0A\u62A5"
1323
+ description
1313
1324
  }) {
1314
1325
  const pending = (0, import_react7.useRef)(false);
1315
1326
  const [reporting, setReporting] = (0, import_react7.useState)(false);
@@ -1326,17 +1337,17 @@ function ErrorReportButton({
1326
1337
  setReporting(false);
1327
1338
  }
1328
1339
  }
1329
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tooltip, { title: description, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1340
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1330
1341
  Button,
1331
1342
  {
1332
1343
  "data-adminsmart-error-report": "true",
1333
- icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.BugOutlined, { "aria-hidden": "true" }),
1334
- disabled,
1335
- loading: reporting,
1344
+ "aria-description": description,
1345
+ "aria-busy": reporting || void 0,
1346
+ disabled: disabled || reporting,
1336
1347
  onClick: report,
1337
- children: "\u95EE\u9898\u4E0A\u62A5"
1348
+ children: reporting ? "\u4E0A\u62A5\u4E2D\u2026" : "\u95EE\u9898\u4E0A\u62A5"
1338
1349
  }
1339
- ) });
1350
+ );
1340
1351
  }
1341
1352
 
1342
1353
  // src/composites/OperationToolbar.tsx
@@ -1424,7 +1435,7 @@ var SearchPanel = (0, import_react9.forwardRef)(function SearchPanel2({ fields,
1424
1435
  Button,
1425
1436
  {
1426
1437
  type: "link",
1427
- icon: expanded ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons4.UpOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons4.DownOutlined, {}),
1438
+ icon: expanded ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons3.UpOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons3.DownOutlined, {}),
1428
1439
  "aria-expanded": expanded,
1429
1440
  onClick: () => setExpanded((value) => !value),
1430
1441
  children: expanded ? "\u6536\u8D77\u7B5B\u9009" : "\u5C55\u5F00\u7B5B\u9009"
@@ -1438,7 +1449,7 @@ var SearchPanel = (0, import_react9.forwardRef)(function SearchPanel2({ fields,
1438
1449
  });
1439
1450
 
1440
1451
  // src/composites/TableControls.tsx
1441
- var import_icons5 = require("@ant-design/icons");
1452
+ var import_icons4 = require("@ant-design/icons");
1442
1453
  var import_react10 = require("react");
1443
1454
  var import_jsx_runtime8 = require("react/jsx-runtime");
1444
1455
  function TableControls({
@@ -1487,7 +1498,7 @@ function TableControls({
1487
1498
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Tooltip, { title: searchLabel, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1488
1499
  Button,
1489
1500
  {
1490
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons5.SearchOutlined, { "aria-hidden": "true" }),
1501
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons4.SearchOutlined, { "aria-hidden": "true" }),
1491
1502
  "aria-label": searchLabel,
1492
1503
  "aria-pressed": searchVisible,
1493
1504
  "data-adminsmart-table-tool": "true",
@@ -1498,7 +1509,7 @@ function TableControls({
1498
1509
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Tooltip, { title: "\u5237\u65B0\u5217\u8868", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1499
1510
  Button,
1500
1511
  {
1501
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons5.ReloadOutlined, { "aria-hidden": "true" }),
1512
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons4.ReloadOutlined, { "aria-hidden": "true" }),
1502
1513
  "aria-label": "\u5237\u65B0\u5217\u8868",
1503
1514
  "data-adminsmart-table-tool": "true",
1504
1515
  loading: refreshing,
@@ -1542,7 +1553,7 @@ function TableControls({
1542
1553
  Button,
1543
1554
  {
1544
1555
  ref: triggerRef,
1545
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons5.SettingOutlined, { "aria-hidden": "true" }),
1556
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons4.SettingOutlined, { "aria-hidden": "true" }),
1546
1557
  "aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217",
1547
1558
  "data-adminsmart-table-tool": "true",
1548
1559
  "aria-haspopup": "dialog",
@@ -1774,7 +1785,7 @@ function EllipsisText({
1774
1785
  }
1775
1786
 
1776
1787
  // src/composites/RowActions.tsx
1777
- var import_icons6 = require("@ant-design/icons");
1788
+ var import_icons5 = require("@ant-design/icons");
1778
1789
  var import_react13 = require("react");
1779
1790
  var import_jsx_runtime14 = require("react/jsx-runtime");
1780
1791
  function collectButtons(children) {
@@ -1826,7 +1837,7 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
1826
1837
  {
1827
1838
  type: "text",
1828
1839
  size: "small",
1829
- icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons6.EllipsisOutlined, {}),
1840
+ icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons5.EllipsisOutlined, {}),
1830
1841
  "aria-label": moreLabel,
1831
1842
  "aria-haspopup": "menu",
1832
1843
  "data-adminsmart-row-more": "true",