@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 +3 -1
- package/dist/index.cjs +31 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +23 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/styles/composites.css +11 -0
package/dist/index.d.cts
CHANGED
|
@@ -243,6 +243,8 @@ interface SessionReplayProps {
|
|
|
243
243
|
endOffsetMs?: number;
|
|
244
244
|
/** 官方快照恢复后自动播放;默认 false,便于观看短片段。 */
|
|
245
245
|
autoPlay?: boolean;
|
|
246
|
+
/** 默认关闭;启用后播放 rrweb 已采集的连续鼠标轨迹。 */
|
|
247
|
+
mouseTrail?: boolean;
|
|
246
248
|
/** 纯可见时间标记,不读取或解析业务对象。 */
|
|
247
249
|
markers?: readonly SessionReplayMarker[];
|
|
248
250
|
/** 控制栏上方的简短提示、图例或额外操作。 */
|
|
@@ -330,7 +332,7 @@ interface ErrorReportButtonProps {
|
|
|
330
332
|
disabled?: boolean;
|
|
331
333
|
/** 宿主处理上报失败的回调,可以展示适合当前业务的反馈。 */
|
|
332
334
|
onReportFailure?: (error: unknown) => void;
|
|
333
|
-
/**
|
|
335
|
+
/** 按实际采集范围提供的无障碍说明,供辅助技术读取。 */
|
|
334
336
|
description?: string;
|
|
335
337
|
}
|
|
336
338
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -243,6 +243,8 @@ interface SessionReplayProps {
|
|
|
243
243
|
endOffsetMs?: number;
|
|
244
244
|
/** 官方快照恢复后自动播放;默认 false,便于观看短片段。 */
|
|
245
245
|
autoPlay?: boolean;
|
|
246
|
+
/** 默认关闭;启用后播放 rrweb 已采集的连续鼠标轨迹。 */
|
|
247
|
+
mouseTrail?: boolean;
|
|
246
248
|
/** 纯可见时间标记,不读取或解析业务对象。 */
|
|
247
249
|
markers?: readonly SessionReplayMarker[];
|
|
248
250
|
/** 控制栏上方的简短提示、图例或额外操作。 */
|
|
@@ -330,7 +332,7 @@ interface ErrorReportButtonProps {
|
|
|
330
332
|
disabled?: boolean;
|
|
331
333
|
/** 宿主处理上报失败的回调,可以展示适合当前业务的反馈。 */
|
|
332
334
|
onReportFailure?: (error: unknown) => void;
|
|
333
|
-
/**
|
|
335
|
+
/** 按实际采集范围提供的无障碍说明,供辅助技术读取。 */
|
|
334
336
|
description?: string;
|
|
335
337
|
}
|
|
336
338
|
/**
|
package/dist/index.js
CHANGED
|
@@ -917,6 +917,7 @@ function useSessionReplay(options) {
|
|
|
917
917
|
if (!current || failed || player || !Constructor || !stageRef.current || !rootRef.current) return;
|
|
918
918
|
if (stageRef.current.clientWidth <= 0 || stageRef.current.clientHeight <= 0) return;
|
|
919
919
|
try {
|
|
920
|
+
const mouseTrailColor = callbackRef.current.mouseTrailColor;
|
|
920
921
|
player = new Constructor(prepared, {
|
|
921
922
|
root: rootRef.current,
|
|
922
923
|
// 实例只能挂载在自己的专属节点。
|
|
@@ -926,8 +927,8 @@ function useSessionReplay(options) {
|
|
|
926
927
|
// 不输出授权录像数据。
|
|
927
928
|
showWarning: false,
|
|
928
929
|
// 友好错误由包装层统一处理。
|
|
929
|
-
mouseTail: false,
|
|
930
|
-
//
|
|
930
|
+
mouseTail: mouseTrailColor ? { strokeStyle: mouseTrailColor } : false,
|
|
931
|
+
// 官方只在回放外层绘制已录制的鼠标轨迹。
|
|
931
932
|
triggerFocus: false,
|
|
932
933
|
// 回放不能改变宿主焦点。
|
|
933
934
|
UNSAFE_replayCanvas: false,
|
|
@@ -1007,6 +1008,16 @@ function useSessionReplay(options) {
|
|
|
1007
1008
|
releaseEngine();
|
|
1008
1009
|
};
|
|
1009
1010
|
}, [options.active, options.loading, options.error, options.events, options.startOffsetMs, options.endOffsetMs, options.autoPlay, options.stageRef, options.rootRef, publish]);
|
|
1011
|
+
useEffect2(() => {
|
|
1012
|
+
const player = engineRef.current;
|
|
1013
|
+
if (!player) return;
|
|
1014
|
+
const color = options.mouseTrailColor;
|
|
1015
|
+
try {
|
|
1016
|
+
player.setConfig({ mouseTail: color ? { strokeStyle: color } : false });
|
|
1017
|
+
} catch {
|
|
1018
|
+
runtimeFailureRef.current?.();
|
|
1019
|
+
}
|
|
1020
|
+
}, [options.mouseTrailColor]);
|
|
1010
1021
|
const play = useCallback(() => {
|
|
1011
1022
|
if (!engineRef.current || stateRef.current.status !== "ready" || !rangeRef.current.total) return;
|
|
1012
1023
|
const target = stateRef.current.currentTimeMs >= rangeRef.current.total ? 0 : stateRef.current.currentTimeMs;
|
|
@@ -1062,7 +1073,7 @@ function useSessionReplay(options) {
|
|
|
1062
1073
|
// src/composites/SessionReplay.tsx
|
|
1063
1074
|
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
1064
1075
|
var playbackRates = [0.5, 1, 1.5, 2];
|
|
1065
|
-
var SessionReplay = forwardRef4(function SessionReplay2({ events, active = true, loading = false, error, startOffsetMs, endOffsetMs, autoPlay = false, markers = [], extra, onStateChange, onError, className, style }, ref) {
|
|
1076
|
+
var SessionReplay = forwardRef4(function SessionReplay2({ events, active = true, loading = false, error, startOffsetMs, endOffsetMs, autoPlay = false, mouseTrail = false, markers = [], extra, onStateChange, onError, className, style }, ref) {
|
|
1066
1077
|
const { token } = theme.useToken();
|
|
1067
1078
|
const containerRef = useRef3(null);
|
|
1068
1079
|
const stageRef = useRef3(null);
|
|
@@ -1076,7 +1087,8 @@ var SessionReplay = forwardRef4(function SessionReplay2({ events, active = true,
|
|
|
1076
1087
|
useEffect3(() => {
|
|
1077
1088
|
setProblem(null);
|
|
1078
1089
|
}, [events, active, loading, error, startOffsetMs, endOffsetMs]);
|
|
1079
|
-
const
|
|
1090
|
+
const mouseTrailColor = mouseTrail ? token.colorPrimary : void 0;
|
|
1091
|
+
const controls = useSessionReplay({ events, active, loading, error, startOffsetMs, endOffsetMs, autoPlay, mouseTrailColor, stageRef, rootRef, onStateChange, onError: reportError });
|
|
1080
1092
|
const { state, play, pause, seek, restart, getState, setPlaybackRate } = controls;
|
|
1081
1093
|
const ready = state.status === "ready";
|
|
1082
1094
|
const themeStyle = {
|
|
@@ -1213,14 +1225,13 @@ import {
|
|
|
1213
1225
|
import { createContext, useContext } from "react";
|
|
1214
1226
|
|
|
1215
1227
|
// src/composites/ErrorReportButton.tsx
|
|
1216
|
-
import { BugOutlined } from "@ant-design/icons";
|
|
1217
1228
|
import { useRef as useRef4, useState as useState4 } from "react";
|
|
1218
1229
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1219
1230
|
function ErrorReportButton({
|
|
1220
1231
|
onReport,
|
|
1221
1232
|
disabled = false,
|
|
1222
1233
|
onReportFailure,
|
|
1223
|
-
description
|
|
1234
|
+
description
|
|
1224
1235
|
}) {
|
|
1225
1236
|
const pending = useRef4(false);
|
|
1226
1237
|
const [reporting, setReporting] = useState4(false);
|
|
@@ -1237,17 +1248,17 @@ function ErrorReportButton({
|
|
|
1237
1248
|
setReporting(false);
|
|
1238
1249
|
}
|
|
1239
1250
|
}
|
|
1240
|
-
return /* @__PURE__ */ jsx5(
|
|
1251
|
+
return /* @__PURE__ */ jsx5(
|
|
1241
1252
|
Button,
|
|
1242
1253
|
{
|
|
1243
1254
|
"data-adminsmart-error-report": "true",
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1255
|
+
"aria-description": description,
|
|
1256
|
+
"aria-busy": reporting || void 0,
|
|
1257
|
+
disabled: disabled || reporting,
|
|
1247
1258
|
onClick: report,
|
|
1248
|
-
children: "\u95EE\u9898\u4E0A\u62A5"
|
|
1259
|
+
children: reporting ? "\u4E0A\u62A5\u4E2D\u2026" : "\u95EE\u9898\u4E0A\u62A5"
|
|
1249
1260
|
}
|
|
1250
|
-
)
|
|
1261
|
+
);
|
|
1251
1262
|
}
|
|
1252
1263
|
|
|
1253
1264
|
// src/composites/OperationToolbar.tsx
|