@qq1948037137/adminsmart-ui 0.1.22 → 0.1.24

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.cjs CHANGED
@@ -89,6 +89,7 @@ __export(src_exports, {
89
89
  SearchPanel: () => SearchPanel,
90
90
  Segmented: () => Segmented,
91
91
  Select: () => Select,
92
+ SessionReplay: () => SessionReplay,
92
93
  Skeleton: () => Skeleton,
93
94
  Slider: () => Slider,
94
95
  Space: () => Space,
@@ -116,7 +117,7 @@ __export(src_exports, {
116
117
  mapSchemaField: () => mapSchemaField,
117
118
  schemaInitialValues: () => schemaInitialValues,
118
119
  tableBodyHeight: () => tableBodyHeight,
119
- theme: () => import_antd46.theme,
120
+ theme: () => import_antd47.theme,
120
121
  validateSchemaForm: () => validateSchemaForm
121
122
  });
122
123
  module.exports = __toCommonJS(src_exports);
@@ -529,7 +530,7 @@ var import_antd44 = require("antd");
529
530
  var Watermark = wrapAntComponent(import_antd44.Watermark, "Watermark");
530
531
 
531
532
  // src/index.ts
532
- var import_antd46 = require("antd");
533
+ var import_antd47 = require("antd");
533
534
 
534
535
  // src/composites/BusinessDrawer.tsx
535
536
  var import_react4 = require("react");
@@ -557,10 +558,572 @@ var BusinessDrawer = (0, import_react4.forwardRef)(function BusinessDrawer2({ si
557
558
  );
558
559
  });
559
560
 
560
- // src/composites/SearchPanel.tsx
561
+ // src/composites/SessionReplay.tsx
562
+ var import_react6 = require("react");
561
563
  var import_icons2 = require("@ant-design/icons");
564
+ var import_antd45 = require("antd");
565
+
566
+ // src/composites/sessionReplayModel.ts
567
+ function finiteReplayNumber(value, fallback = 0) {
568
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
569
+ }
570
+ function prepareReplayEvents(events) {
571
+ if (!Array.isArray(events) || events.length < 2) throw new Error("\u5F53\u524D\u56DE\u653E\u6CA1\u6709\u8DB3\u591F\u7684\u9875\u9762\u4E8B\u4EF6");
572
+ let previous = -Infinity;
573
+ for (const event of events) {
574
+ if (!event || typeof event !== "object" || !Number.isFinite(event.timestamp) || event.timestamp < previous)
575
+ throw new Error("\u5F53\u524D\u56DE\u653E\u4E8B\u4EF6\u65F6\u95F4\u65E0\u6548\uFF0C\u65E0\u6CD5\u8FD8\u539F\u9875\u9762");
576
+ previous = event.timestamp;
577
+ }
578
+ const copied = structuredClone(events);
579
+ const normalizeNode = (node) => {
580
+ if (!node || typeof node !== "object") return node;
581
+ const value = node;
582
+ if (String(value.tagName || "").toLowerCase() === "script") return null;
583
+ if (value.type === 1) {
584
+ value.name = "html";
585
+ value.publicId = "";
586
+ value.systemId = "";
587
+ }
588
+ if (value.type === 0 && value.compatMode !== "CSS1Compat" && value.compatMode !== "BackCompat")
589
+ delete value.compatMode;
590
+ if (Array.isArray(value.childNodes)) value.childNodes = value.childNodes.map(normalizeNode).filter(Boolean);
591
+ return value;
592
+ };
593
+ let hasSnapshot = false;
594
+ for (const event of copied) {
595
+ const data = event.data;
596
+ if (!data || typeof data !== "object") continue;
597
+ if (data.node) {
598
+ data.node = normalizeNode(data.node);
599
+ const node = data.node;
600
+ if (event.type === 2 && node?.type === 0 && Array.isArray(node.childNodes) && node.childNodes.length)
601
+ hasSnapshot = true;
602
+ }
603
+ if (Array.isArray(data.adds)) data.adds = data.adds.map((entry) => {
604
+ const addition = entry;
605
+ return { ...addition, node: normalizeNode(addition.node) };
606
+ }).filter((entry) => entry.node);
607
+ }
608
+ if (!hasSnapshot) throw new Error("\u5F53\u524D\u56DE\u653E\u7F3A\u5C11\u5B8C\u6574\u9875\u9762\u5FEB\u7167\uFF0C\u65E0\u6CD5\u8FD8\u539F\u9875\u9762");
609
+ return copied;
610
+ }
611
+ function replayRange(totalTime, startOffsetMs = 0, endOffsetMs) {
612
+ const duration = Math.max(0, finiteReplayNumber(totalTime));
613
+ const start = Math.min(duration, Math.max(0, finiteReplayNumber(startOffsetMs)));
614
+ const end = Math.min(duration, Math.max(start, finiteReplayNumber(endOffsetMs, duration)));
615
+ const total = end - start;
616
+ return {
617
+ start,
618
+ // 恢复到此内部时间后开始显示进度。
619
+ end,
620
+ // 所有播放和跳转不得越过此边界。
621
+ total,
622
+ // 控制栏显示此窗口长度。
623
+ toInternal: (visible) => start + Math.min(total, Math.max(0, finiteReplayNumber(visible))),
624
+ // 可见转内部。
625
+ toVisible: (internal) => Math.min(total, Math.max(0, finiteReplayNumber(internal) - start))
626
+ // 内部转可见。
627
+ };
628
+ }
629
+ function replayPlaybackWindow(events, startOffsetMs = 0, endOffsetMs) {
630
+ const firstTimestamp = finiteReplayNumber(events[0]?.timestamp);
631
+ const originalTotal = Math.max(0, finiteReplayNumber(events.at(-1)?.timestamp) - firstTimestamp);
632
+ const range = replayRange(originalTotal, startOffsetMs, endOffsetMs);
633
+ if (endOffsetMs === void 0) return { events: structuredClone(events), range };
634
+ const endTimestamp = firstTimestamp + range.end;
635
+ const withinEnd = events.filter((event) => event.timestamp <= endTimestamp);
636
+ if (!withinEnd.some((event) => event.type === 2))
637
+ throw new Error("\u5F53\u524D\u56DE\u653E\u7A97\u53E3\u65E9\u4E8E\u5B8C\u6574\u9875\u9762\u5FEB\u7167\uFF0C\u65E0\u6CD5\u8FD8\u539F\u9875\u9762");
638
+ const completeEvents = withinEnd.filter((event, index) => {
639
+ if (event.type !== 4) return true;
640
+ for (let next = index + 1; next < withinEnd.length; next += 1) {
641
+ if (withinEnd[next].type === 2) return true;
642
+ if (withinEnd[next].type === 4) break;
643
+ }
644
+ return false;
645
+ });
646
+ const copied = structuredClone(completeEvents);
647
+ copied.push({
648
+ type: 5,
649
+ // 官方Custom事件只提供时间调度,不改变页面DOM。
650
+ timestamp: endTimestamp,
651
+ // 请求终点成为官方metadata真实终点,尾部观察时间不缩短。
652
+ data: {
653
+ tag: "adminsmart-replay-boundary",
654
+ // 内部固定标记,不承载业务信息或外部回调。
655
+ payload: null
656
+ // 空载荷不包含用户数据。
657
+ }
658
+ });
659
+ return { events: copied, range };
660
+ }
661
+ function inclusivePauseOffset(events, target) {
662
+ const logicalTarget = Math.max(0, finiteReplayNumber(target));
663
+ const baseline = finiteReplayNumber(events[0]?.timestamp) + logicalTarget;
664
+ let equalEvent = false;
665
+ let increment = 1;
666
+ for (const event of events) {
667
+ if (event.timestamp === baseline) equalEvent = true;
668
+ if (event.timestamp > baseline) {
669
+ increment = Math.min(increment, event.timestamp - baseline);
670
+ break;
671
+ }
672
+ }
673
+ return equalEvent ? logicalTarget + increment : logicalTarget;
674
+ }
675
+ function replayFit(stageWidth, stageHeight, contentWidth, contentHeight) {
676
+ const width = Math.max(1, finiteReplayNumber(contentWidth, 1));
677
+ const height = Math.max(1, finiteReplayNumber(contentHeight, 1));
678
+ const scale = Math.min(1, Math.max(0, finiteReplayNumber(stageWidth)) / width, Math.max(0, finiteReplayNumber(stageHeight)) / height);
679
+ return {
680
+ scale,
681
+ // 作用于官方公开 wrapper。
682
+ left: Math.max(0, (stageWidth - width * scale) / 2),
683
+ // 水平居中。
684
+ top: Math.max(0, (stageHeight - height * scale) / 2)
685
+ // 垂直居中。
686
+ };
687
+ }
688
+ function replayClock(timeMs) {
689
+ const seconds = Math.floor(Math.max(0, finiteReplayNumber(timeMs)) / 1e3);
690
+ return `${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`;
691
+ }
692
+
693
+ // src/composites/useSessionReplay.ts
562
694
  var import_react5 = require("react");
563
695
 
696
+ // src/composites/sessionReplayEngine.ts
697
+ async function loadReplayEngine() {
698
+ const [, module2] = await Promise.all([import("@rrweb/replay/dist/style.css"), import("@rrweb/replay")]);
699
+ return module2.Replayer;
700
+ }
701
+
702
+ // src/composites/useSessionReplay.ts
703
+ function initialState(status) {
704
+ return {
705
+ status,
706
+ // 由容器可见性与输入决定。
707
+ currentTimeMs: 0,
708
+ // 新录像从可见起点开始。
709
+ durationMs: 0,
710
+ // 只有官方元数据能够确定时长。
711
+ playing: false,
712
+ // 未恢复快照前不宣称播放中。
713
+ playbackRate: 1
714
+ // 各次录像使用原速。
715
+ };
716
+ }
717
+ function useSessionReplay(options) {
718
+ const [state, setState] = (0, import_react5.useState)(() => initialState("idle"));
719
+ const stateRef = (0, import_react5.useRef)(state);
720
+ const engineRef = (0, import_react5.useRef)(null);
721
+ const runtimeFailureRef = (0, import_react5.useRef)(null);
722
+ const rangeRef = (0, import_react5.useRef)(replayRange(0));
723
+ const replayEventsRef = (0, import_react5.useRef)([]);
724
+ const callbackRef = (0, import_react5.useRef)(options);
725
+ callbackRef.current = options;
726
+ const publish = (0, import_react5.useCallback)((next) => {
727
+ stateRef.current = next;
728
+ setState(next);
729
+ callbackRef.current.onStateChange?.({ ...next });
730
+ }, []);
731
+ (0, import_react5.useEffect)(() => {
732
+ const { active, loading, error, events, stageRef, rootRef, startOffsetMs, endOffsetMs, autoPlay } = options;
733
+ engineRef.current = null;
734
+ runtimeFailureRef.current = null;
735
+ rangeRef.current = replayRange(0);
736
+ replayEventsRef.current = [];
737
+ if (!active) {
738
+ publish(initialState("idle"));
739
+ return;
740
+ }
741
+ if (loading) {
742
+ publish(initialState("loading"));
743
+ return;
744
+ }
745
+ if (error) {
746
+ publish(initialState("error"));
747
+ return;
748
+ }
749
+ if (!events.length) {
750
+ publish(initialState("empty"));
751
+ return;
752
+ }
753
+ let playback;
754
+ let prepared;
755
+ try {
756
+ playback = replayPlaybackWindow(prepareReplayEvents(events), startOffsetMs, endOffsetMs);
757
+ prepared = playback.events;
758
+ } catch (reason) {
759
+ const knownMessages = ["\u5F53\u524D\u56DE\u653E\u6CA1\u6709\u8DB3\u591F\u7684\u9875\u9762\u4E8B\u4EF6", "\u5F53\u524D\u56DE\u653E\u4E8B\u4EF6\u65F6\u95F4\u65E0\u6548\uFF0C\u65E0\u6CD5\u8FD8\u539F\u9875\u9762", "\u5F53\u524D\u56DE\u653E\u7F3A\u5C11\u5B8C\u6574\u9875\u9762\u5FEB\u7167\uFF0C\u65E0\u6CD5\u8FD8\u539F\u9875\u9762", "\u5F53\u524D\u56DE\u653E\u7A97\u53E3\u65E9\u4E8E\u5B8C\u6574\u9875\u9762\u5FEB\u7167\uFF0C\u65E0\u6CD5\u8FD8\u539F\u9875\u9762"];
760
+ const problem = { code: "invalid-events", message: reason instanceof Error && knownMessages.includes(reason.message) ? reason.message : "\u5F53\u524D\u56DE\u653E\u6570\u636E\u65E0\u6CD5\u8FD8\u539F\u9875\u9762" };
761
+ publish(initialState("error"));
762
+ callbackRef.current.onError?.(problem);
763
+ return;
764
+ }
765
+ replayEventsRef.current = prepared;
766
+ publish(initialState("loading"));
767
+ let current = true;
768
+ let failed = false;
769
+ let Constructor = null;
770
+ let player = null;
771
+ let snapshotReady = false;
772
+ let progressTimer;
773
+ let rebuildTimer;
774
+ let fitFrame;
775
+ let autoPlayFrame;
776
+ let observer = null;
777
+ const listeners = [];
778
+ const stopProgress = () => {
779
+ if (progressTimer !== void 0) window.clearInterval(progressTimer);
780
+ progressTimer = void 0;
781
+ };
782
+ const releaseEngine = () => {
783
+ stopProgress();
784
+ if (rebuildTimer !== void 0) window.clearTimeout(rebuildTimer);
785
+ if (fitFrame !== void 0) window.cancelAnimationFrame(fitFrame);
786
+ if (autoPlayFrame !== void 0) window.cancelAnimationFrame(autoPlayFrame);
787
+ if (player) {
788
+ for (const [eventName, handler] of listeners) player.off(eventName, handler);
789
+ try {
790
+ player.destroy();
791
+ } catch {
792
+ }
793
+ }
794
+ if (engineRef.current === player) engineRef.current = null;
795
+ player = null;
796
+ rootRef.current?.replaceChildren();
797
+ };
798
+ const fail = (code, message) => {
799
+ if (!current || failed) return;
800
+ failed = true;
801
+ releaseEngine();
802
+ observer?.disconnect();
803
+ publish(initialState("error"));
804
+ callbackRef.current.onError?.({ code, message });
805
+ };
806
+ const commandFailure = () => fail("rebuild-failed", "\u56DE\u653E\u9875\u9762\u6062\u590D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u56DE\u653E");
807
+ runtimeFailureRef.current = commandFailure;
808
+ const fit = () => {
809
+ if (!current || !player || !stageRef.current) return;
810
+ const dimensions = replayFit(stageRef.current.clientWidth, stageRef.current.clientHeight, Number(player.iframe.width), Number(player.iframe.height));
811
+ player.wrapper.style.position = "absolute";
812
+ player.wrapper.style.left = `${dimensions.left}px`;
813
+ player.wrapper.style.top = `${dimensions.top}px`;
814
+ player.wrapper.style.transformOrigin = "top left";
815
+ player.wrapper.style.transform = `scale(${dimensions.scale})`;
816
+ };
817
+ const scheduleFit = () => {
818
+ if (fitFrame !== void 0) window.cancelAnimationFrame(fitFrame);
819
+ fitFrame = window.requestAnimationFrame(() => {
820
+ fitFrame = void 0;
821
+ fit();
822
+ });
823
+ };
824
+ const startProgress = () => {
825
+ stopProgress();
826
+ progressTimer = window.setInterval(() => {
827
+ if (!current || !player || !snapshotReady) return;
828
+ try {
829
+ const time = player.getCurrentTime();
830
+ if (time >= rangeRef.current.end) {
831
+ player.pause(inclusivePauseOffset(prepared, rangeRef.current.end));
832
+ stopProgress();
833
+ publish({ ...stateRef.current, currentTimeMs: rangeRef.current.total, playing: false });
834
+ } else publish({ ...stateRef.current, currentTimeMs: rangeRef.current.toVisible(time) });
835
+ } catch {
836
+ fail("rebuild-failed", "\u56DE\u653E\u9875\u9762\u6062\u590D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u56DE\u653E");
837
+ }
838
+ }, 100);
839
+ };
840
+ const start = () => {
841
+ if (!current || failed || player || !Constructor || !stageRef.current || !rootRef.current) return;
842
+ if (stageRef.current.clientWidth <= 0 || stageRef.current.clientHeight <= 0) return;
843
+ try {
844
+ player = new Constructor(prepared, {
845
+ root: rootRef.current,
846
+ // 实例只能挂载在自己的专属节点。
847
+ skipInactive: false,
848
+ // 时间轴与用户可见窗口保持一致。
849
+ showDebug: false,
850
+ // 不输出授权录像数据。
851
+ showWarning: false,
852
+ // 友好错误由包装层统一处理。
853
+ mouseTail: false,
854
+ // 不额外生成画布轨迹。
855
+ triggerFocus: false,
856
+ // 回放不能改变宿主焦点。
857
+ UNSAFE_replayCanvas: false,
858
+ // 禁止不受保护的脚本/画布重建。
859
+ logger: { log() {
860
+ }, warn() {
861
+ } }
862
+ // 官方日志不会带事件进入控制台。
863
+ });
864
+ engineRef.current = player;
865
+ rangeRef.current = playback.range;
866
+ const listen = (eventName, handler) => {
867
+ listeners.push([eventName, handler]);
868
+ player.on(eventName, handler);
869
+ };
870
+ listen("fullsnapshot-rebuilded", () => {
871
+ if (!current || !player) return;
872
+ if (!player.iframe.contentDocument?.documentElement || !player.iframe.contentDocument?.body) {
873
+ fail("rebuild-failed", "\u56DE\u653E\u9875\u9762\u5FEB\u7167\u4E0D\u5B8C\u6574\uFF0C\u65E0\u6CD5\u663E\u793A\u753B\u9762");
874
+ return;
875
+ }
876
+ scheduleFit();
877
+ if (snapshotReady) return;
878
+ snapshotReady = true;
879
+ if (rebuildTimer !== void 0) window.clearTimeout(rebuildTimer);
880
+ publish({ ...initialState("ready"), durationMs: rangeRef.current.total });
881
+ if (autoPlay && rangeRef.current.total > 0) autoPlayFrame = window.requestAnimationFrame(() => {
882
+ autoPlayFrame = void 0;
883
+ if (current && player) player.play(rangeRef.current.start);
884
+ });
885
+ });
886
+ listen("resize", scheduleFit);
887
+ listen("start", () => {
888
+ if (!current || !snapshotReady) return;
889
+ publish({ ...stateRef.current, playing: true });
890
+ startProgress();
891
+ });
892
+ listen("pause", () => {
893
+ stopProgress();
894
+ if (current && snapshotReady) publish({ ...stateRef.current, playing: false });
895
+ });
896
+ listen("finish", () => {
897
+ stopProgress();
898
+ if (current && snapshotReady) publish({ ...stateRef.current, currentTimeMs: rangeRef.current.total, playing: false });
899
+ });
900
+ rebuildTimer = window.setTimeout(() => {
901
+ if (!snapshotReady) fail("rebuild-failed", "\u56DE\u653E\u9875\u9762\u672A\u80FD\u5B8C\u6210\u6062\u590D\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u56DE\u653E");
902
+ }, 4e3);
903
+ player.pause(inclusivePauseOffset(prepared, rangeRef.current.start));
904
+ scheduleFit();
905
+ } catch {
906
+ fail("rebuild-failed", "\u56DE\u653E\u9875\u9762\u6062\u590D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u56DE\u653E");
907
+ }
908
+ };
909
+ const onLayout = () => {
910
+ start();
911
+ scheduleFit();
912
+ };
913
+ if (typeof ResizeObserver === "function" && stageRef.current) {
914
+ observer = new ResizeObserver(onLayout);
915
+ observer.observe(stageRef.current);
916
+ }
917
+ window.addEventListener("resize", onLayout);
918
+ loadReplayEngine().then((value) => {
919
+ if (!current) return;
920
+ Constructor = value;
921
+ start();
922
+ }).catch(() => fail("engine-load", "\u56DE\u653E\u7EC4\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u56DE\u653E"));
923
+ return () => {
924
+ current = false;
925
+ observer?.disconnect();
926
+ window.removeEventListener("resize", onLayout);
927
+ if (runtimeFailureRef.current === commandFailure) runtimeFailureRef.current = null;
928
+ if (replayEventsRef.current === prepared) replayEventsRef.current = [];
929
+ releaseEngine();
930
+ };
931
+ }, [options.active, options.loading, options.error, options.events, options.startOffsetMs, options.endOffsetMs, options.autoPlay, options.stageRef, options.rootRef, publish]);
932
+ const play = (0, import_react5.useCallback)(() => {
933
+ if (!engineRef.current || stateRef.current.status !== "ready" || !rangeRef.current.total) return;
934
+ const target = stateRef.current.currentTimeMs >= rangeRef.current.total ? 0 : stateRef.current.currentTimeMs;
935
+ try {
936
+ engineRef.current.play(rangeRef.current.toInternal(target));
937
+ } catch {
938
+ runtimeFailureRef.current?.();
939
+ return;
940
+ }
941
+ publish({ ...stateRef.current, currentTimeMs: target, playing: true });
942
+ }, [publish]);
943
+ const pause = (0, import_react5.useCallback)(() => {
944
+ if (!engineRef.current || stateRef.current.status !== "ready" || !stateRef.current.playing) return;
945
+ let time;
946
+ try {
947
+ time = rangeRef.current.toInternal(rangeRef.current.toVisible(engineRef.current.getCurrentTime()));
948
+ engineRef.current.pause(inclusivePauseOffset(replayEventsRef.current, time));
949
+ } catch {
950
+ runtimeFailureRef.current?.();
951
+ return;
952
+ }
953
+ publish({ ...stateRef.current, currentTimeMs: rangeRef.current.toVisible(time), playing: false });
954
+ }, [publish]);
955
+ const seek = (0, import_react5.useCallback)((timeMs) => {
956
+ if (!engineRef.current || stateRef.current.status !== "ready") return;
957
+ const target = rangeRef.current.toInternal(timeMs);
958
+ try {
959
+ engineRef.current.pause(inclusivePauseOffset(replayEventsRef.current, target));
960
+ } catch {
961
+ runtimeFailureRef.current?.();
962
+ return;
963
+ }
964
+ publish({ ...stateRef.current, currentTimeMs: rangeRef.current.toVisible(target), playing: false });
965
+ }, [publish]);
966
+ const restart = (0, import_react5.useCallback)(() => {
967
+ seek(0);
968
+ play();
969
+ }, [play, seek]);
970
+ const setPlaybackRate = (0, import_react5.useCallback)((rate) => {
971
+ if (!engineRef.current || stateRef.current.status !== "ready" || !Number.isFinite(rate) || rate <= 0 || rate > 4) return;
972
+ try {
973
+ engineRef.current.setConfig({ speed: rate });
974
+ } catch {
975
+ runtimeFailureRef.current?.();
976
+ return;
977
+ }
978
+ publish({ ...stateRef.current, playbackRate: rate });
979
+ }, [publish]);
980
+ const getState = (0, import_react5.useCallback)(() => ({ ...stateRef.current }), []);
981
+ return { state, play, pause, seek, restart, setPlaybackRate, getState };
982
+ }
983
+
984
+ // src/composites/SessionReplay.tsx
985
+ var import_jsx_runtime4 = require("react/jsx-runtime");
986
+ var playbackRates = [0.5, 1, 1.5, 2];
987
+ 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) {
988
+ const { token } = import_antd45.theme.useToken();
989
+ const containerRef = (0, import_react6.useRef)(null);
990
+ const stageRef = (0, import_react6.useRef)(null);
991
+ const rootRef = (0, import_react6.useRef)(null);
992
+ const [problem, setProblem] = (0, import_react6.useState)(null);
993
+ const [fullscreen, setFullscreen] = (0, import_react6.useState)(false);
994
+ const reportError = (0, import_react6.useCallback)((value) => {
995
+ setProblem(value);
996
+ onError?.(value);
997
+ }, [onError]);
998
+ (0, import_react6.useEffect)(() => {
999
+ setProblem(null);
1000
+ }, [events, active, loading, error, startOffsetMs, endOffsetMs]);
1001
+ const controls = useSessionReplay({ events, active, loading, error, startOffsetMs, endOffsetMs, autoPlay, stageRef, rootRef, onStateChange, onError: reportError });
1002
+ const { state, play, pause, seek, restart, getState, setPlaybackRate } = controls;
1003
+ const ready = state.status === "ready";
1004
+ const themeStyle = {
1005
+ "--adminsmart-replay-bg": token.colorBgLayout,
1006
+ // 舞台周围的中性背景。
1007
+ "--adminsmart-replay-surface": token.colorBgContainer,
1008
+ // 控制区容器背景。
1009
+ "--adminsmart-replay-border": token.colorBorderSecondary,
1010
+ // 轻量边界。
1011
+ "--adminsmart-replay-text": token.colorText,
1012
+ // 主信息文字。
1013
+ "--adminsmart-replay-muted": token.colorTextSecondary,
1014
+ // 次要时间和提示。
1015
+ "--adminsmart-replay-primary": token.colorPrimary,
1016
+ // 通用时间标记。
1017
+ "--adminsmart-replay-warning": token.colorWarning,
1018
+ // 警告标记。
1019
+ "--adminsmart-replay-error": token.colorError,
1020
+ // 错误标记。
1021
+ "--adminsmart-replay-radius": `${token.borderRadiusLG}px`,
1022
+ // 主题圆角。
1023
+ ...style
1024
+ };
1025
+ (0, import_react6.useImperativeHandle)(ref, () => ({ play, pause, seek, restart, getState }), [play, pause, seek, restart, getState]);
1026
+ (0, import_react6.useEffect)(() => {
1027
+ if (!active) return;
1028
+ const container = containerRef.current;
1029
+ const sync = () => setFullscreen(document.fullscreenElement === container);
1030
+ document.addEventListener("fullscreenchange", sync);
1031
+ sync();
1032
+ return () => {
1033
+ document.removeEventListener("fullscreenchange", sync);
1034
+ if (document.fullscreenElement === container) void document.exitFullscreen?.().catch(() => {
1035
+ });
1036
+ };
1037
+ }, [active]);
1038
+ const toggleFullscreen = async () => {
1039
+ if (!containerRef.current || !ready) return;
1040
+ try {
1041
+ if (document.fullscreenElement === containerRef.current) await document.exitFullscreen();
1042
+ else await containerRef.current.requestFullscreen();
1043
+ if (problem?.code === "fullscreen") setProblem(null);
1044
+ } catch {
1045
+ reportError({ code: "fullscreen", message: "\u6D4F\u89C8\u5668\u672A\u5141\u8BB8\u5168\u5C4F\uFF0C\u4ECD\u53EF\u5728\u5F53\u524D\u9762\u677F\u64AD\u653E" });
1046
+ }
1047
+ };
1048
+ const statusText = loading || state.status === "loading" ? "\u6B63\u5728\u6062\u590D\u753B\u9762" : ready ? state.playing ? "\u64AD\u653E\u4E2D" : "\u5DF2\u6682\u505C" : state.status === "empty" ? "\u6682\u65E0\u5F55\u50CF" : state.status === "error" ? "\u65E0\u6CD5\u64AD\u653E" : "\u7B49\u5F85\u56DE\u653E";
1049
+ const errorText = error || problem?.message || (state.status === "error" ? "\u5F53\u524D\u56DE\u653E\u6570\u636E\u65E0\u6CD5\u8FD8\u539F\u9875\u9762" : "");
1050
+ const playLabel = state.playing ? "\u6682\u505C" : state.currentTimeMs >= state.durationMs && ready ? "\u91CD\u65B0\u64AD\u653E" : "\u64AD\u653E";
1051
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref: containerRef, className: ["adminsmart-session-replay", className].filter(Boolean).join(" "), style: themeStyle, "data-adminsmart-session-replay": true, "data-replay-status": state.status, children: [
1052
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref: stageRef, className: "adminsmart-session-replay__stage", "aria-label": "\u64CD\u4F5C\u56DE\u653E\u753B\u9762", "aria-busy": loading || state.status === "loading", children: [
1053
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: rootRef, className: "adminsmart-session-replay__mount" }),
1054
+ !ready && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "adminsmart-session-replay__placeholder", role: "status", children: loading || state.status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Spin, { description: "\u6B63\u5728\u6062\u590D\u56DE\u653E\u753B\u9762" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Empty, { description: errorText || (state.status === "empty" ? "\u6682\u65E0\u53EF\u64AD\u653E\u56DE\u653E\u6570\u636E" : "\u7B49\u5F85\u53EF\u89C1\u56DE\u653E\u7A97\u53E3"), image: import_antd45.Empty.PRESENTED_IMAGE_SIMPLE }) })
1055
+ ] }),
1056
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "adminsmart-session-replay__controls", children: [
1057
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "adminsmart-session-replay__summary", children: [
1058
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Tag, { color: ready ? "processing" : void 0, className: "adminsmart-session-replay__status", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-live": "polite", children: statusText }) }),
1059
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_antd45.Typography.Text, { className: "adminsmart-session-replay__clock", children: [
1060
+ replayClock(state.currentTimeMs),
1061
+ " ",
1062
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1063
+ "/ ",
1064
+ replayClock(state.durationMs)
1065
+ ] })
1066
+ ] }),
1067
+ extra && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "adminsmart-session-replay__extra", children: extra })
1068
+ ] }),
1069
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "adminsmart-session-replay__timeline", children: [
1070
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1071
+ import_antd45.Slider,
1072
+ {
1073
+ min: 0,
1074
+ max: Math.max(1, state.durationMs),
1075
+ value: state.currentTimeMs,
1076
+ disabled: !ready,
1077
+ onChange: (value) => seek(value),
1078
+ tooltip: { formatter: (value) => replayClock(value ?? 0) },
1079
+ ariaLabelForHandle: "\u56DE\u653E\u8FDB\u5EA6",
1080
+ ariaValueTextFormatterForHandle: (value) => `${replayClock(value)} / ${replayClock(state.durationMs)}`
1081
+ }
1082
+ ),
1083
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "adminsmart-session-replay__markers", "aria-label": "\u56DE\u653E\u65F6\u95F4\u6807\u8BB0", children: markers.filter((marker) => Number.isFinite(marker.timeMs)).map((marker, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Tooltip, { title: `${marker.label} \xB7 ${replayClock(marker.timeMs)}`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1084
+ "button",
1085
+ {
1086
+ type: "button",
1087
+ className: "adminsmart-session-replay__marker",
1088
+ "data-tone": marker.tone || "primary",
1089
+ style: { left: `${state.durationMs ? Math.min(100, Math.max(0, finiteReplayNumber(marker.timeMs) / state.durationMs * 100)) : 0}%` },
1090
+ "aria-label": `${marker.label} ${replayClock(marker.timeMs)}`,
1091
+ disabled: !ready,
1092
+ onClick: () => seek(marker.timeMs)
1093
+ }
1094
+ ) }, `${marker.timeMs}-${index}`)) })
1095
+ ] }),
1096
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "adminsmart-session-replay__toolbar", role: "group", "aria-label": "\u56DE\u653E\u64AD\u653E\u63A7\u5236", children: [
1097
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "adminsmart-session-replay__transport", children: [
1098
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Tooltip, { title: "\u540E\u9000 5 \u79D2", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Button, { icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.StepBackwardOutlined, { "aria-hidden": true }), "aria-label": "\u540E\u9000 5 \u79D2", disabled: !ready, onClick: () => seek(state.currentTimeMs - 5e3) }) }),
1099
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1100
+ import_antd45.Button,
1101
+ {
1102
+ type: "primary",
1103
+ icon: state.playing ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.PauseOutlined, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.PlayCircleOutlined, { "aria-hidden": true }),
1104
+ "aria-label": playLabel,
1105
+ disabled: !ready || !state.durationMs,
1106
+ onClick: state.playing ? pause : play,
1107
+ children: playLabel
1108
+ }
1109
+ ),
1110
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Tooltip, { title: "\u524D\u8FDB 5 \u79D2", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Button, { icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.StepForwardOutlined, { "aria-hidden": true }), "aria-label": "\u524D\u8FDB 5 \u79D2", disabled: !ready, onClick: () => seek(state.currentTimeMs + 5e3) }) }),
1111
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Tooltip, { title: "\u4ECE\u5934\u64AD\u653E", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Button, { type: "text", icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.RedoOutlined, { "aria-hidden": true }), "aria-label": "\u4ECE\u5934\u64AD\u653E", disabled: !ready || !state.durationMs, onClick: restart }) })
1112
+ ] }),
1113
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "adminsmart-session-replay__options", children: [
1114
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Select, { size: "small", value: state.playbackRate, disabled: !ready, "aria-label": "\u64AD\u653E\u901F\u5EA6", options: playbackRates.map((value) => ({ value, label: `${value}\xD7` })), onChange: setPlaybackRate, popupMatchSelectWidth: false }),
1115
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Tooltip, { title: fullscreen ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F\u64AD\u653E", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Button, { type: "text", icon: fullscreen ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.FullscreenExitOutlined, { "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.FullscreenOutlined, { "aria-hidden": true }), "aria-label": fullscreen ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F\u64AD\u653E", disabled: !ready, onClick: () => void toggleFullscreen() }) })
1116
+ ] })
1117
+ ] }),
1118
+ errorText && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd45.Alert, { type: problem?.code === "fullscreen" ? "warning" : "error", showIcon: true, title: errorText, className: "adminsmart-session-replay__notice" })
1119
+ ] })
1120
+ ] });
1121
+ });
1122
+
1123
+ // src/composites/SearchPanel.tsx
1124
+ var import_icons3 = require("@ant-design/icons");
1125
+ var import_react7 = require("react");
1126
+
564
1127
  // src/composites/searchPanelModel.ts
565
1128
  function searchColumnCount(width) {
566
1129
  return Math.min(6, Math.max(1, Math.floor((Math.max(0, width) + 16) / 256)));
@@ -570,17 +1133,17 @@ function collapsedSearchFieldLimit(columns) {
570
1133
  }
571
1134
 
572
1135
  // src/composites/SearchPanel.tsx
573
- var import_jsx_runtime4 = require("react/jsx-runtime");
574
- var SearchPanel = (0, import_react5.forwardRef)(function SearchPanel2({ fields, actions, tools, trailingTools, searchVisible = true, defaultExpanded = false, role = "search", style, ...props }, ref) {
575
- const rootRef = (0, import_react5.useRef)(null);
576
- const [width, setWidth] = (0, import_react5.useState)(0);
577
- const [expanded, setExpanded] = (0, import_react5.useState)(defaultExpanded);
578
- const items = import_react5.Children.toArray(fields);
1136
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1137
+ var SearchPanel = (0, import_react7.forwardRef)(function SearchPanel2({ fields, actions, tools, trailingTools, searchVisible = true, defaultExpanded = false, role = "search", style, ...props }, ref) {
1138
+ const rootRef = (0, import_react7.useRef)(null);
1139
+ const [width, setWidth] = (0, import_react7.useState)(0);
1140
+ const [expanded, setExpanded] = (0, import_react7.useState)(defaultExpanded);
1141
+ const items = import_react7.Children.toArray(fields);
579
1142
  const columns = searchColumnCount(width);
580
1143
  const collapsedLimit = collapsedSearchFieldLimit(columns);
581
1144
  const hasMore = items.length > collapsedLimit;
582
1145
  const fieldWidth = Math.min(240, Math.max(0, width));
583
- (0, import_react5.useEffect)(() => {
1146
+ (0, import_react7.useEffect)(() => {
584
1147
  const element = rootRef.current;
585
1148
  if (!element) return void 0;
586
1149
  const update = () => {
@@ -609,10 +1172,10 @@ var SearchPanel = (0, import_react5.forwardRef)(function SearchPanel2({ fields,
609
1172
  ...style
610
1173
  };
611
1174
  const hasToolbar = tools != null || trailingTools != null;
612
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ...props, ref: setRootRef, role: hasToolbar ? "toolbar" : role, style: panelStyle, "data-adminsmart-search-panel": "true", children: [
613
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: "[data-adminsmart-search-field] > .ant-form-item { margin-bottom: 0; }" }),
614
- (items.length > 0 || actions != null) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { role: hasToolbar ? role : void 0, "aria-hidden": !searchVisible, style: { display: searchVisible ? "flex" : "none", width: "100%", flexWrap: "wrap", alignItems: "end", gap: "12px 16px" }, children: [
615
- items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1175
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { ...props, ref: setRootRef, role: hasToolbar ? "toolbar" : role, style: panelStyle, "data-adminsmart-search-panel": "true", children: [
1176
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("style", { children: "[data-adminsmart-search-field] > .ant-form-item { margin-bottom: 0; }" }),
1177
+ (items.length > 0 || actions != null) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { role: hasToolbar ? role : void 0, "aria-hidden": !searchVisible, style: { display: searchVisible ? "flex" : "none", width: "100%", flexWrap: "wrap", alignItems: "end", gap: "12px 16px" }, children: [
1178
+ items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
616
1179
  "div",
617
1180
  {
618
1181
  hidden: !expanded && index >= collapsedLimit,
@@ -620,32 +1183,32 @@ var SearchPanel = (0, import_react5.forwardRef)(function SearchPanel2({ fields,
620
1183
  style: { minWidth: 0, width: fieldWidth || "min(240px, 100%)", flex: "0 0 auto" },
621
1184
  children: item
622
1185
  },
623
- (0, import_react5.isValidElement)(item) ? item.key ?? index : index
1186
+ (0, import_react7.isValidElement)(item) ? item.key ?? index : index
624
1187
  )),
625
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-adminsmart-search-actions": "true", style: { display: "flex", alignItems: "center", gap: 8, minHeight: 32 }, children: [
626
- hasMore ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1188
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-adminsmart-search-actions": "true", style: { display: "flex", alignItems: "center", gap: 8, minHeight: 32 }, children: [
1189
+ hasMore ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
627
1190
  Button,
628
1191
  {
629
1192
  type: "link",
630
- icon: expanded ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.UpOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.DownOutlined, {}),
1193
+ icon: expanded ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.UpOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.DownOutlined, {}),
631
1194
  "aria-expanded": expanded,
632
1195
  onClick: () => setExpanded((value) => !value),
633
1196
  children: expanded ? "\u6536\u8D77\u7B5B\u9009" : "\u5C55\u5F00\u7B5B\u9009"
634
1197
  }
635
1198
  ) : null,
636
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: actions })
1199
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: actions })
637
1200
  ] })
638
1201
  ] }),
639
- hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-adminsmart-toolbar-row": "true", style: { display: "flex", width: "100%", minWidth: 0, alignItems: "center", justifyContent: "space-between", flexWrap: "wrap", gap: 12 }, children: [
640
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { role: "group", "aria-label": "\u529F\u80FD\u64CD\u4F5C", "data-adminsmart-toolbar-actions": "true", style: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 12, minHeight: 32 }, children: tools }),
641
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { role: "group", "aria-label": "\u8868\u683C\u5DE5\u5177", style: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 12, marginLeft: "auto", minHeight: 32 }, children: trailingTools })
1202
+ hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-adminsmart-toolbar-row": "true", style: { display: "flex", width: "100%", minWidth: 0, alignItems: "center", justifyContent: "space-between", flexWrap: "wrap", gap: 12 }, children: [
1203
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { role: "group", "aria-label": "\u529F\u80FD\u64CD\u4F5C", "data-adminsmart-toolbar-actions": "true", style: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 12, minHeight: 32 }, children: tools }),
1204
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { role: "group", "aria-label": "\u8868\u683C\u5DE5\u5177", style: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 12, marginLeft: "auto", minHeight: 32 }, children: trailingTools })
642
1205
  ] })
643
1206
  ] });
644
1207
  });
645
1208
 
646
1209
  // src/composites/DataTable.tsx
647
- var import_react6 = require("react");
648
- var import_jsx_runtime5 = require("react/jsx-runtime");
1210
+ var import_react8 = require("react");
1211
+ var import_jsx_runtime6 = require("react/jsx-runtime");
649
1212
  function tableBodyHeight(availableHeight, chromeHeight) {
650
1213
  return Math.max(0, Math.floor(availableHeight - chromeHeight - 16));
651
1214
  }
@@ -666,10 +1229,10 @@ function DataTableInner({
666
1229
  scroll,
667
1230
  ...tableProps
668
1231
  }, ref) {
669
- const containerRef = (0, import_react6.useRef)(null);
670
- const [bodyHeight, setBodyHeight] = (0, import_react6.useState)(360);
1232
+ const containerRef = (0, import_react8.useRef)(null);
1233
+ const [bodyHeight, setBodyHeight] = (0, import_react8.useState)(360);
671
1234
  const hasExplicitHeight = containerHeight != null || containerStyle?.height != null;
672
- (0, import_react6.useLayoutEffect)(() => {
1235
+ (0, import_react8.useLayoutEffect)(() => {
673
1236
  const container = containerRef.current;
674
1237
  if (!container || scroll?.y != null) return void 0;
675
1238
  const update = () => {
@@ -703,14 +1266,14 @@ function DataTableInner({
703
1266
  y: scroll?.y ?? bodyHeight
704
1267
  };
705
1268
  const tablePagination = pagination === false ? false : pagination?.placement || pagination?.position ? pagination : { placement: ["bottomEnd"], ...pagination };
706
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1269
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
707
1270
  "div",
708
1271
  {
709
1272
  ref: containerRef,
710
1273
  className: containerClassName,
711
1274
  "data-adminsmart-data-table": "true",
712
1275
  style: { width: "100%", minWidth: 0, overflowX: "hidden", ...containerHeight == null ? {} : { height: containerHeight, overflowY: "hidden" }, ...containerStyle },
713
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1276
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
714
1277
  Table,
715
1278
  {
716
1279
  ...tableProps,
@@ -722,11 +1285,11 @@ function DataTableInner({
722
1285
  }
723
1286
  );
724
1287
  }
725
- var DataTable = (0, import_react6.forwardRef)(DataTableInner);
1288
+ var DataTable = (0, import_react8.forwardRef)(DataTableInner);
726
1289
 
727
1290
  // src/composites/WorkspaceLayout.tsx
728
- var import_antd45 = require("antd");
729
- var import_jsx_runtime6 = require("react/jsx-runtime");
1291
+ var import_antd46 = require("antd");
1292
+ var import_jsx_runtime7 = require("react/jsx-runtime");
730
1293
  var LIGHT_WORKSPACE_BACKGROUND = "#f6f9fe";
731
1294
  function WorkspaceLayout({
732
1295
  header,
@@ -744,7 +1307,7 @@ function WorkspaceLayout({
744
1307
  contentClassName,
745
1308
  height
746
1309
  }) {
747
- const { token } = import_antd45.theme.useToken();
1310
+ const { token } = import_antd46.theme.useToken();
748
1311
  const rootClassName = ["adminsmart-workspace", className].filter(Boolean).join(" ");
749
1312
  const contentClasses = ["adminsmart-workspace__content", contentClassName].filter(Boolean).join(" ");
750
1313
  const siderClasses = ["adminsmart-workspace__sider", siderProps?.className].filter(Boolean).join(" ");
@@ -758,10 +1321,10 @@ function WorkspaceLayout({
758
1321
  "--adminsmart-workspace-bg": themeMode === "dark" ? token.colorBgLayout : LIGHT_WORKSPACE_BACKGROUND
759
1322
  // 夜间不复用日间固定底色。
760
1323
  };
761
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Layout, { className: rootClassName, style: workspaceStyle, "data-theme-mode": themeMode, children: [
762
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("header", { className: "adminsmart-workspace__header", children: header }),
763
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Layout, { className: "adminsmart-workspace__body", children: [
764
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1324
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Layout, { className: rootClassName, style: workspaceStyle, "data-theme-mode": themeMode, children: [
1325
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("header", { className: "adminsmart-workspace__header", children: header }),
1326
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Layout, { className: "adminsmart-workspace__body", children: [
1327
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
765
1328
  Layout.Sider,
766
1329
  {
767
1330
  theme: themeMode,
@@ -773,9 +1336,9 @@ function WorkspaceLayout({
773
1336
  children: sidebar
774
1337
  }
775
1338
  ),
776
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Layout, { className: "adminsmart-workspace__main", children: [
1339
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Layout, { className: "adminsmart-workspace__main", children: [
777
1340
  tabs,
778
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
1341
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
779
1342
  footer
780
1343
  ] })
781
1344
  ] })
@@ -783,7 +1346,7 @@ function WorkspaceLayout({
783
1346
  }
784
1347
 
785
1348
  // src/composites/CrudScaffold.tsx
786
- var import_jsx_runtime7 = require("react/jsx-runtime");
1349
+ var import_jsx_runtime8 = require("react/jsx-runtime");
787
1350
  function CrudScaffold({
788
1351
  label,
789
1352
  description,
@@ -795,16 +1358,16 @@ function CrudScaffold({
795
1358
  ...props
796
1359
  }) {
797
1360
  const classes = ["adminsmart-crud", className].filter(Boolean).join(" ");
798
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("main", { ...props, className: classes, "aria-label": label, "aria-description": description, children: [
799
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "adminsmart-crud__filters", children: filters }),
800
- status ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "adminsmart-crud__status", children: status }) : null,
801
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "adminsmart-crud__results", children: results }),
1361
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("main", { ...props, className: classes, "aria-label": label, "aria-description": description, children: [
1362
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "adminsmart-crud__filters", children: filters }),
1363
+ status ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "adminsmart-crud__status", children: status }) : null,
1364
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "adminsmart-crud__results", children: results }),
802
1365
  drawer
803
1366
  ] });
804
1367
  }
805
1368
 
806
1369
  // src/composites/EllipsisText.tsx
807
- var import_jsx_runtime8 = require("react/jsx-runtime");
1370
+ var import_jsx_runtime9 = require("react/jsx-runtime");
808
1371
  function EllipsisText({
809
1372
  children,
810
1373
  maxWidth = 240,
@@ -816,7 +1379,7 @@ function EllipsisText({
816
1379
  const classes = ["adminsmart-ellipsis-text", className].filter(Boolean).join(" ");
817
1380
  const widthValue = typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
818
1381
  const textStyle = { "--adminsmart-ellipsis-width": widthValue, ...style };
819
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1382
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
820
1383
  Typography.Text,
821
1384
  {
822
1385
  ...props,
@@ -829,14 +1392,14 @@ function EllipsisText({
829
1392
  }
830
1393
 
831
1394
  // src/composites/RowActions.tsx
832
- var import_icons3 = require("@ant-design/icons");
833
- var import_react7 = require("react");
834
- var import_jsx_runtime9 = require("react/jsx-runtime");
1395
+ var import_icons4 = require("@ant-design/icons");
1396
+ var import_react9 = require("react");
1397
+ var import_jsx_runtime10 = require("react/jsx-runtime");
835
1398
  function collectButtons(children) {
836
1399
  const actions = [];
837
- import_react7.Children.forEach(children, (child) => {
838
- if (!(0, import_react7.isValidElement)(child)) return;
839
- if (child.type === import_react7.Fragment) actions.push(...collectButtons(child.props.children));
1400
+ import_react9.Children.forEach(children, (child) => {
1401
+ if (!(0, import_react9.isValidElement)(child)) return;
1402
+ if (child.type === import_react9.Fragment) actions.push(...collectButtons(child.props.children));
840
1403
  else {
841
1404
  if (child.type !== Button && child.type !== "button") throw new TypeError("RowActions \u53EA\u63A5\u53D7\u5DF2\u6309\u6743\u9650\u7B5B\u9009\u7684 Button \u6216 Fragment");
842
1405
  if (!child.props.hidden) actions.push(child);
@@ -862,9 +1425,9 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
862
1425
  // 菜单仍按官方语义标识需要确认的动作。
863
1426
  }));
864
1427
  const classes = ["adminsmart-row-action-group", className].filter(Boolean).join(" ");
865
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Space, { ...props, className: classes, size, wrap, children: [
1428
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Space, { ...props, className: classes, size, wrap, children: [
866
1429
  direct,
867
- overflow.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1430
+ overflow.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
868
1431
  Dropdown,
869
1432
  {
870
1433
  trigger: ["click"],
@@ -876,12 +1439,12 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
876
1439
  action.props.onClick?.(domEvent);
877
1440
  }
878
1441
  },
879
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Tooltip, { title: moreLabel, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1442
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tooltip, { title: moreLabel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
880
1443
  Button,
881
1444
  {
882
1445
  type: "text",
883
1446
  size: "small",
884
- icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons3.EllipsisOutlined, {}),
1447
+ icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons4.EllipsisOutlined, {}),
885
1448
  "aria-label": moreLabel,
886
1449
  "aria-haspopup": "menu",
887
1450
  "data-adminsmart-row-more": "true",
@@ -895,7 +1458,7 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
895
1458
 
896
1459
  // src/schema/SchemaForm.tsx
897
1460
  var import_dayjs = __toESM(require("dayjs"), 1);
898
- var import_react8 = require("react");
1461
+ var import_react10 = require("react");
899
1462
 
900
1463
  // src/schema/model.ts
901
1464
  var FIELD_TYPES = /* @__PURE__ */ new Set([
@@ -1078,7 +1641,7 @@ function schemaInitialValues(schema) {
1078
1641
  }
1079
1642
 
1080
1643
  // src/schema/SchemaForm.tsx
1081
- var import_jsx_runtime10 = require("react/jsx-runtime");
1644
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1082
1645
  function fieldRules(field) {
1083
1646
  const rules = [];
1084
1647
  if (field.required) {
@@ -1123,32 +1686,32 @@ function dateItemProps(field) {
1123
1686
  function renderControl(field) {
1124
1687
  switch (field.type) {
1125
1688
  case "input":
1126
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Input, { placeholder: field.placeholder });
1689
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Input, { placeholder: field.placeholder });
1127
1690
  case "password":
1128
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Input.Password, { placeholder: field.placeholder });
1691
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Input.Password, { placeholder: field.placeholder });
1129
1692
  case "textarea":
1130
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Input.TextArea, { placeholder: field.placeholder });
1693
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Input.TextArea, { placeholder: field.placeholder });
1131
1694
  case "number":
1132
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
1695
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
1133
1696
  case "select":
1134
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Select, { placeholder: field.placeholder, options: field.options });
1697
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Select, { placeholder: field.placeholder, options: field.options });
1135
1698
  case "radio":
1136
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Radio.Group, { options: field.options });
1699
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Radio.Group, { options: field.options });
1137
1700
  case "checkbox":
1138
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Checkbox, {});
1701
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Checkbox, {});
1139
1702
  case "switch":
1140
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Switch, {});
1703
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Switch, {});
1141
1704
  case "date":
1142
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
1705
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
1143
1706
  case "dateRange":
1144
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
1707
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
1145
1708
  }
1146
1709
  }
1147
- var SchemaForm = (0, import_react8.forwardRef)(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
1710
+ var SchemaForm = (0, import_react10.forwardRef)(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
1148
1711
  const result = validateSchemaForm(schema);
1149
1712
  if (!result.valid) throw new Error(`SchemaForm \u914D\u7F6E\u65E0\u6548\uFF1A${result.errors.map((issue) => `${issue.path} ${issue.message}`).join("\uFF1B")}`);
1150
1713
  const defaults = schemaInitialValues(schema);
1151
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1714
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1152
1715
  Form,
1153
1716
  {
1154
1717
  ...formProps,
@@ -1166,7 +1729,7 @@ var SchemaForm = (0, import_react8.forwardRef)(function SchemaForm2({ schema, on
1166
1729
  children: [
1167
1730
  schema.fields.map((field) => {
1168
1731
  const mapped = mapSchemaField(field);
1169
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1732
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1170
1733
  Form.Item,
1171
1734
  {
1172
1735
  name: mapped.name,
@@ -1179,7 +1742,7 @@ var SchemaForm = (0, import_react8.forwardRef)(function SchemaForm2({ schema, on
1179
1742
  mapped.name
1180
1743
  );
1181
1744
  }),
1182
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "primary", htmlType: "submit", children: schema.submitText ?? "\u63D0\u4EA4" }) })
1745
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { type: "primary", htmlType: "submit", children: schema.submitText ?? "\u63D0\u4EA4" }) })
1183
1746
  ]
1184
1747
  }
1185
1748
  );
@@ -1245,6 +1808,7 @@ var SchemaForm = (0, import_react8.forwardRef)(function SchemaForm2({ schema, on
1245
1808
  SearchPanel,
1246
1809
  Segmented,
1247
1810
  Select,
1811
+ SessionReplay,
1248
1812
  Skeleton,
1249
1813
  Slider,
1250
1814
  Space,