@hkyhy/marsun-components-core 0.1.33 → 0.1.34

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.
Files changed (36) hide show
  1. package/dist/components/AgentHub/Report/Detail/ReportMetaStrip/index.d.ts +19 -0
  2. package/dist/components/AgentHub/Report/Detail/ReportMetaStrip/index.js +46 -0
  3. package/dist/components/AgentHub/Report/Detail/ReportMetaStrip/index.js.map +1 -0
  4. package/dist/components/AgentHub/Report/Detail/ReportMetaStrip/style.module.scss.js +12 -0
  5. package/dist/components/AgentHub/Report/Detail/ReportMetaStrip/style.module.scss.js.map +1 -0
  6. package/dist/components/AgentHub/Report/Detail/ReportTemplate/index.d.ts +18 -0
  7. package/dist/components/AgentHub/Report/Detail/ReportTemplate/index.js +98 -0
  8. package/dist/components/AgentHub/Report/Detail/ReportTemplate/index.js.map +1 -0
  9. package/dist/components/AgentHub/Report/Detail/ReportTemplate/style.module.scss.js +14 -0
  10. package/dist/components/AgentHub/Report/Detail/ReportTemplate/style.module.scss.js.map +1 -0
  11. package/dist/components/AgentHub/Report/Detail/index.d.ts +4 -0
  12. package/dist/components/AgentHub/Report/index.d.ts +1 -0
  13. package/dist/components/InteractiveBlock/InteractiveBlock.d.ts +3 -0
  14. package/dist/components/InteractiveBlock/InteractiveBlock.js +49 -46
  15. package/dist/components/InteractiveBlock/InteractiveBlock.js.map +1 -1
  16. package/dist/components/InteractiveBlock/index.d.ts +1 -1
  17. package/dist/components/InteractiveBlock/style.module.scss.js +14 -13
  18. package/dist/components/InteractiveBlock/style.module.scss.js.map +1 -1
  19. package/dist/components/Modal/Modal/index.d.ts +6 -0
  20. package/dist/components/Modal/Modal/index.js +120 -0
  21. package/dist/components/Modal/Modal/index.js.map +1 -0
  22. package/dist/components/Modal/Modal/style.module.scss.js +17 -0
  23. package/dist/components/Modal/Modal/style.module.scss.js.map +1 -0
  24. package/dist/components/Modal/ModalTypes.d.ts +26 -0
  25. package/dist/components/Modal/StepModal/index.js +43 -41
  26. package/dist/components/Modal/StepModal/index.js.map +1 -1
  27. package/dist/components/Modal/index.d.ts +3 -0
  28. package/dist/components/Modal/utils/resolveModalSize.d.ts +22 -0
  29. package/dist/components/Modal/utils/resolveModalSize.js +28 -0
  30. package/dist/components/Modal/utils/resolveModalSize.js.map +1 -0
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +293 -282
  33. package/dist/index.js.map +1 -1
  34. package/dist/marsun-components-core.css +1 -1
  35. package/dist/styles/global.css +1 -1
  36. package/package.json +1 -1
@@ -0,0 +1,120 @@
1
+ import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
+ import I from "@kne/button-group";
3
+ import { Modal as z } from "antd";
4
+ import e from "classnames";
5
+ import { useMemo as h, useState as B, useEffect as T } from "react";
6
+ import { Info as V } from "../../Icons/index.js";
7
+ import { resolveModalWidth as _, resolveModalSizeAnchor as j, MODAL_SIZE_BODY_HEIGHT as C } from "../utils/resolveModalSize.js";
8
+ import r from "./style.module.scss.js";
9
+ import D from "../../TooltipInfo/TooltipInfo.js";
10
+ import G from "../../VirtualScrollbar/VirtualScrollbar/index.js";
11
+ function O() {
12
+ const [i, m] = B(() => typeof window < "u" ? window.innerWidth : 1200);
13
+ return T(() => {
14
+ const o = () => m(window.innerWidth);
15
+ return window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
16
+ }, []), i;
17
+ }
18
+ const Q = ({
19
+ open: i,
20
+ onCancel: m,
21
+ title: o,
22
+ info: a,
23
+ description: f,
24
+ actions: w,
25
+ footer: y = null,
26
+ size: l,
27
+ width: s,
28
+ children: v,
29
+ className: N,
30
+ destroyOnHidden: M = !0,
31
+ maskClosable: W = !1,
32
+ scrollable: b = !1,
33
+ closable: x = !0
34
+ }) => {
35
+ const n = O(), E = h(
36
+ () => _({ size: l, width: s, viewportWidth: n }),
37
+ [l, s, n]
38
+ ), L = h(
39
+ () => j({ size: l, width: s, viewportWidth: n }),
40
+ [l, s, n]
41
+ ), g = C[L], d = h(() => {
42
+ const u = (w ?? []).filter((H) => !H.hidden), c = u[0];
43
+ return !c || c.type != null ? u : [{ ...c, type: "primary" }, ...u.slice(1)];
44
+ }, [w]), S = /* @__PURE__ */ p("div", { className: e("marsun-modal-title-wrap", r["marsun-modal-title-wrap"]), children: [
45
+ /* @__PURE__ */ p("div", { className: e("marsun-modal-title-row", r["marsun-modal-title-row"]), children: [
46
+ /* @__PURE__ */ p("div", { className: e("marsun-modal-title-group", r["marsun-modal-title-group"]), children: [
47
+ /* @__PURE__ */ t("div", { className: e("marsun-modal-title", r["marsun-modal-title"]), children: o }),
48
+ a != null && a.length ? /* @__PURE__ */ t(
49
+ D,
50
+ {
51
+ content: a,
52
+ placement: "topLeft",
53
+ overlayStyle: { minWidth: 220, maxWidth: 360 },
54
+ overlayClassName: "marsun-modal-info-tooltip",
55
+ children: /* @__PURE__ */ t(
56
+ "span",
57
+ {
58
+ className: e(
59
+ "marsun-modal-info-trigger",
60
+ r["marsun-modal-info-trigger"]
61
+ ),
62
+ children: /* @__PURE__ */ t(V, { size: 16, "aria-hidden": !0 })
63
+ }
64
+ )
65
+ }
66
+ ) : null
67
+ ] }),
68
+ d.length > 0 ? /* @__PURE__ */ t(
69
+ "div",
70
+ {
71
+ className: e(
72
+ "marsun-modal-title-actions",
73
+ r["marsun-modal-title-actions"]
74
+ ),
75
+ children: /* @__PURE__ */ t(I, { list: d, showLength: Math.max(d.length, 2) })
76
+ }
77
+ ) : null
78
+ ] }),
79
+ f ? /* @__PURE__ */ t("div", { className: e("marsun-modal-description", r["marsun-modal-description"]), children: f }) : null
80
+ ] }), A = b ? /* @__PURE__ */ t(
81
+ G,
82
+ {
83
+ wrapperClassName: e(
84
+ "marsun-modal-scroll-wrapper",
85
+ r["marsun-modal-scroll-wrapper"]
86
+ ),
87
+ className: e("marsun-modal-scroll", r["marsun-modal-scroll"]),
88
+ children: v
89
+ }
90
+ ) : /* @__PURE__ */ t("div", { className: e("marsun-modal-body-inner", r["marsun-modal-body-inner"]), children: v });
91
+ return /* @__PURE__ */ t(
92
+ z,
93
+ {
94
+ open: i,
95
+ onCancel: m,
96
+ title: S,
97
+ footer: y,
98
+ width: E,
99
+ centered: !0,
100
+ closable: x,
101
+ maskClosable: W,
102
+ destroyOnHidden: M,
103
+ className: e("marsun-modal", r["marsun-modal"], N),
104
+ styles: {
105
+ body: {
106
+ height: g,
107
+ maxHeight: g,
108
+ overflow: "hidden",
109
+ paddingTop: 12,
110
+ paddingBottom: 12
111
+ }
112
+ },
113
+ children: A
114
+ }
115
+ );
116
+ };
117
+ export {
118
+ Q as default
119
+ };
120
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Modal/Modal/index.tsx"],"sourcesContent":["import ButtonGroup from '@kne/button-group';\nimport { Modal as AntModal } from 'antd';\nimport classNames from 'classnames';\nimport { useEffect, useMemo, useState, type ReactNode } from 'react';\nimport { Info } from '../../Icons';\nimport { TooltipInfo } from '../../TooltipInfo';\nimport { VirtualScrollbar } from '../../VirtualScrollbar';\nimport type { MarsunModalProps } from '../ModalTypes';\nimport {\n MODAL_SIZE_BODY_HEIGHT,\n resolveModalSizeAnchor,\n resolveModalWidth,\n} from '../utils/resolveModalSize';\nimport styles from './style.module.scss';\n\nfunction useViewportWidth(): number {\n const [vw, setVw] = useState(() => (typeof window !== 'undefined' ? window.innerWidth : 1200));\n\n useEffect(() => {\n const onResize = () => setVw(window.innerWidth);\n window.addEventListener('resize', onResize);\n return () => window.removeEventListener('resize', onResize);\n }, []);\n\n return vw;\n}\n\n/**\n * 通用居中 Modal:必填标题、可选 info/description、标题 Action(ButtonGroup)、S/M/L 宽度(只可缩小)、固定 body 高。\n */\nconst Modal: React.FC<MarsunModalProps> = ({\n open,\n onCancel,\n title,\n info,\n description,\n actions,\n footer = null,\n size,\n width,\n children,\n className,\n destroyOnHidden = true,\n maskClosable = false,\n scrollable = false,\n closable = true,\n}) => {\n const viewportWidth = useViewportWidth();\n const effectiveWidth = useMemo(\n () => resolveModalWidth({ size, width, viewportWidth }),\n [size, width, viewportWidth],\n );\n const sizeAnchor = useMemo(\n () => resolveModalSizeAnchor({ size, width, viewportWidth }),\n [size, width, viewportWidth],\n );\n const bodyHeight = MODAL_SIZE_BODY_HEIGHT[sizeAnchor];\n\n const visibleActions = useMemo(() => {\n const list = (actions ?? []).filter((a) => !a.hidden);\n const first = list[0];\n if (!first || first.type != null) return list;\n return [{ ...first, type: 'primary' as const }, ...list.slice(1)];\n }, [actions]);\n\n const titleNode = (\n <div className={classNames('marsun-modal-title-wrap', styles['marsun-modal-title-wrap'])}>\n <div className={classNames('marsun-modal-title-row', styles['marsun-modal-title-row'])}>\n <div className={classNames('marsun-modal-title-group', styles['marsun-modal-title-group'])}>\n <div className={classNames('marsun-modal-title', styles['marsun-modal-title'])}>\n {title}\n </div>\n {info?.length ? (\n <TooltipInfo\n content={info}\n placement=\"topLeft\"\n overlayStyle={{ minWidth: 220, maxWidth: 360 }}\n overlayClassName=\"marsun-modal-info-tooltip\"\n >\n <span\n className={classNames(\n 'marsun-modal-info-trigger',\n styles['marsun-modal-info-trigger'],\n )}\n >\n <Info size={16} aria-hidden />\n </span>\n </TooltipInfo>\n ) : null}\n </div>\n {visibleActions.length > 0 ? (\n <div\n className={classNames(\n 'marsun-modal-title-actions',\n styles['marsun-modal-title-actions'],\n )}\n >\n <ButtonGroup list={visibleActions} showLength={Math.max(visibleActions.length, 2)} />\n </div>\n ) : null}\n </div>\n {description ? (\n <div className={classNames('marsun-modal-description', styles['marsun-modal-description'])}>\n {description}\n </div>\n ) : null}\n </div>\n );\n\n const body: ReactNode = scrollable ? (\n <VirtualScrollbar\n wrapperClassName={classNames(\n 'marsun-modal-scroll-wrapper',\n styles['marsun-modal-scroll-wrapper'],\n )}\n className={classNames('marsun-modal-scroll', styles['marsun-modal-scroll'])}\n >\n {children}\n </VirtualScrollbar>\n ) : (\n <div className={classNames('marsun-modal-body-inner', styles['marsun-modal-body-inner'])}>\n {children}\n </div>\n );\n\n return (\n <AntModal\n open={open}\n onCancel={onCancel}\n title={titleNode}\n footer={footer}\n width={effectiveWidth}\n centered\n closable={closable}\n maskClosable={maskClosable}\n destroyOnHidden={destroyOnHidden}\n className={classNames('marsun-modal', styles['marsun-modal'], className)}\n styles={{\n body: {\n height: bodyHeight,\n maxHeight: bodyHeight,\n overflow: 'hidden',\n paddingTop: 12,\n paddingBottom: 12,\n },\n }}\n >\n {body}\n </AntModal>\n );\n};\n\nexport default Modal;\n"],"names":["useViewportWidth","vw","setVw","useState","useEffect","onResize","Modal","open","onCancel","title","info","description","actions","footer","size","width","children","className","destroyOnHidden","maskClosable","scrollable","closable","viewportWidth","effectiveWidth","useMemo","resolveModalWidth","sizeAnchor","resolveModalSizeAnchor","bodyHeight","MODAL_SIZE_BODY_HEIGHT","visibleActions","list","a","first","titleNode","classNames","styles","jsxs","jsx","TooltipInfo","Info","ButtonGroup","body","VirtualScrollbar","AntModal"],"mappings":";;;;;;;;;;AAeA,SAASA,IAA2B;AAClC,QAAM,CAACC,GAAIC,CAAK,IAAIC,EAAS,MAAO,OAAO,SAAW,MAAc,OAAO,aAAa,IAAK;AAE7F,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAW,MAAMH,EAAM,OAAO,UAAU;AAC9C,kBAAO,iBAAiB,UAAUG,CAAQ,GACnC,MAAM,OAAO,oBAAoB,UAAUA,CAAQ;AAAA,EAC5D,GAAG,CAAA,CAAE,GAEEJ;AACT;AAKA,MAAMK,IAAoC,CAAC;AAAA,EACzC,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,cAAAC,IAAe;AAAA,EACf,YAAAC,IAAa;A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AAW,gBAAgBC,EAAO,cAAc,GAAGnB,CAAS;AAAA,MACvE,QAAQ;AAAA,QACN,MAAM;AAAA,UACJ,QAAQW;AAAA,UACR,WAAWA;AAAA,UACX,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,eAAe;AAAA,QAAA;AAAA,MACjB;AAAA,MAGD,UAAAc;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -0,0 +1,17 @@
1
+ const a = {
2
+ "marsun-modal": "_marsun-modal_1ggfn_1",
3
+ "marsun-modal-title-wrap": "_marsun-modal-title-wrap_1ggfn_23",
4
+ "marsun-modal-title-row": "_marsun-modal-title-row_1ggfn_30",
5
+ "marsun-modal-title-group": "_marsun-modal-title-group_1ggfn_41",
6
+ "marsun-modal-title": "_marsun-modal-title_1ggfn_23",
7
+ "marsun-modal-info-trigger": "_marsun-modal-info-trigger_1ggfn_56",
8
+ "marsun-modal-title-actions": "_marsun-modal-title-actions_1ggfn_66",
9
+ "marsun-modal-description": "_marsun-modal-description_1ggfn_71",
10
+ "marsun-modal-scroll-wrapper": "_marsun-modal-scroll-wrapper_1ggfn_81",
11
+ "marsun-modal-scroll": "_marsun-modal-scroll_1ggfn_81",
12
+ "marsun-modal-body-inner": "_marsun-modal-body-inner_1ggfn_96"
13
+ };
14
+ export {
15
+ a as default
16
+ };
17
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -0,0 +1,26 @@
1
+ import { ReactNode } from 'react';
2
+ import { DescriptionItem } from '../Descriptions/CommonDescriptions';
3
+ import { ModalSize } from './utils/resolveModalSize';
4
+ export type MarsunModalProps = {
5
+ open: boolean;
6
+ onCancel: () => void;
7
+ /** 弹窗标题(必填) */
8
+ title: ReactNode;
9
+ /** 标题旁 Info + TooltipInfo(对齐 InteractiveBlock) */
10
+ info?: DescriptionItem[];
11
+ /** 标题行下方说明文案 */
12
+ description?: ReactNode;
13
+ /** 标题右侧操作,ButtonGroup listArray */
14
+ actions?: Record<string, unknown>[];
15
+ footer?: ReactNode | null;
16
+ size?: ModalSize;
17
+ /** 显式默认宽,优先于 size 作为锚点 */
18
+ width?: number;
19
+ children: ReactNode;
20
+ className?: string;
21
+ destroyOnHidden?: boolean;
22
+ maskClosable?: boolean;
23
+ /** body 内单层 VirtualScrollbar */
24
+ scrollable?: boolean;
25
+ closable?: boolean;
26
+ };
@@ -1,56 +1,58 @@
1
- import { jsxs as k, jsx as d } from "react/jsx-runtime";
2
- import { ChevronLeft as M } from "../../Icons/index.js";
3
- import { Modal as j, Steps as F, Button as c } from "antd";
4
- import { useMemo as I, useCallback as n } from "react";
1
+ import { jsxs as n, jsx as d } from "react/jsx-runtime";
2
+ import { ChevronLeft as I } from "../../Icons/index.js";
3
+ import { Modal as W, Steps as z, Button as c } from "antd";
4
+ import { useMemo as F, useCallback as k } from "react";
5
+ import { resolveModalWidth as L } from "../utils/resolveModalSize.js";
5
6
  import f from "./style.module.scss.js";
6
- import a from "classnames";
7
- const y = (m) => {
8
- if (m !== void 0)
9
- return typeof m == "function" ? m() : m;
10
- }, H = ({
11
- title: m,
12
- steps: r,
13
- current: e,
14
- open: x,
7
+ import e from "classnames";
8
+ const y = (t) => {
9
+ if (t !== void 0)
10
+ return typeof t == "function" ? t() : t;
11
+ }, K = ({
12
+ title: t,
13
+ steps: i,
14
+ current: a,
15
+ open: v,
15
16
  onCancel: s,
16
- width: N = 600,
17
+ width: x = 600,
17
18
  showSteps: u = !0,
18
- maskClosable: v = !1,
19
- className: w,
19
+ maskClosable: w = !1,
20
+ className: N,
20
21
  onStepChange: l
21
22
  }) => {
22
- const i = I(() => r.findIndex((t) => t.key === e), [r, e]), o = r[i], E = n(() => {
23
- i > 0 && (l == null || l(r[i - 1].key));
24
- }, [i, r, l]), b = n(async () => {
23
+ const r = F(() => i.findIndex((m) => m.key === a), [i, a]), o = i[r], E = k(() => {
24
+ r > 0 && (l == null || l(i[r - 1].key));
25
+ }, [r, i, l]), M = k(async () => {
25
26
  if (!(o != null && o.beforeEnter)) {
26
- i < r.length - 1 && (l == null || l(r[i + 1].key));
27
+ r < i.length - 1 && (l == null || l(i[r + 1].key));
27
28
  return;
28
29
  }
29
- await o.beforeEnter() && i < r.length - 1 && (l == null || l(r[i + 1].key));
30
- }, [o, i, r, l]), B = m ?? (o == null ? void 0 : o.title) ?? "";
31
- return /* @__PURE__ */ k(
32
- j,
30
+ await o.beforeEnter() && r < i.length - 1 && (l == null || l(i[r + 1].key));
31
+ }, [o, r, i, l]), b = t ?? (o == null ? void 0 : o.title) ?? "", B = () => (o == null ? void 0 : o.footer) !== void 0 ? y(o.footer) : /* @__PURE__ */ n("div", { className: e("step-modal-root", f["step-modal-root"]), children: [
32
+ r > 0 && (o == null ? void 0 : o.allowBack) !== !1 && /* @__PURE__ */ d(c, { icon: /* @__PURE__ */ d(I, {}), onClick: E, children: "上一步" }),
33
+ /* @__PURE__ */ d("div", { className: e("step-modal-container", f["step-modal-container"]) }),
34
+ /* @__PURE__ */ d(c, { onClick: s, children: "取消" }),
35
+ r < i.length - 1 && /* @__PURE__ */ d(c, { type: "primary", onClick: M, children: "下一步" })
36
+ ] }), j = L({ width: x });
37
+ return /* @__PURE__ */ n(
38
+ W,
33
39
  {
34
- title: B,
35
- open: x,
40
+ title: b,
41
+ open: v,
36
42
  onCancel: s,
37
- width: N,
38
- footer: (o == null ? void 0 : o.footer) !== void 0 ? y(o.footer) : /* @__PURE__ */ k("div", { className: a("step-modal-root", f["step-modal-root"]), children: [
39
- i > 0 && (o == null ? void 0 : o.allowBack) !== !1 && /* @__PURE__ */ d(c, { icon: /* @__PURE__ */ d(M, {}), onClick: E, children: "上一步" }),
40
- /* @__PURE__ */ d("div", { className: a("step-modal-container", f["step-modal-container"]) }),
41
- /* @__PURE__ */ d(c, { onClick: s, children: "取消" }),
42
- i < r.length - 1 && /* @__PURE__ */ d(c, { type: "primary", onClick: b, children: "下一步" })
43
- ] }),
44
- maskClosable: v,
45
- className: w,
43
+ width: j,
44
+ centered: !0,
45
+ footer: B(),
46
+ maskClosable: w,
47
+ className: N,
46
48
  children: [
47
- u && r.length > 1 && /* @__PURE__ */ d(
48
- F,
49
+ u && i.length > 1 && /* @__PURE__ */ d(
50
+ z,
49
51
  {
50
- current: i,
52
+ current: r,
51
53
  size: "small",
52
- className: a("step-modal-wrapper", f["step-modal-wrapper"]),
53
- items: r.map((t) => ({ title: t.title, description: t.description }))
54
+ className: e("step-modal-wrapper", f["step-modal-wrapper"]),
55
+ items: i.map((m) => ({ title: m.title, description: m.description }))
54
56
  }
55
57
  ),
56
58
  y(o == null ? void 0 : o.content)
@@ -59,6 +61,6 @@ const y = (m) => {
59
61
  );
60
62
  };
61
63
  export {
62
- H as default
64
+ K as default
63
65
  };
64
66
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Modal/StepModal/index.tsx"],"sourcesContent":["import { ChevronLeft } from '@/components/Icons';\nimport { Button, Modal, Steps } from 'antd';\nimport React, { useCallback, useMemo } from 'react';\nimport type { StepModalProps } from '../StepModalTypes';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\n\n/** 解析可能是函数的 content / footer */\nconst resolve = (val: React.ReactNode | (() => React.ReactNode) | undefined) => {\n if (val === undefined) return undefined;\n return typeof val === 'function' ? val() : val;\n};\n\n/**\n * 步骤式弹窗\n *\n * 将多步骤流程封装在同一个 Modal 中,自动管理步骤导航、标题切换和底部按钮。\n *\n * 用法:\n * ```tsx\n * const [current, setCurrent] = useState('select');\n * <StepModal\n * open={open}\n * current={current}\n * onCancel={onCancel}\n * steps={[\n * { key: 'select', title: '选择文件', content: <SelectStep /> },\n * { key: 'uploading', title: '上传文件', content: <UploadingStep /> },\n * { key: 'result', title: '上传结果', content: <ResultStep /> },\n * ]}\n * onStepChange={setCurrent}\n * />\n * ```\n */\nconst StepModal: React.FC<StepModalProps> = ({\n title,\n steps,\n current,\n open,\n onCancel,\n width = 600,\n showSteps = true,\n maskClosable = false,\n className,\n onStepChange,\n}) => {\n const currentIndex = useMemo(() => steps.findIndex((s) => s.key === current), [steps, current]);\n const currentStep = steps[currentIndex];\n\n const goBack = useCallback(() => {\n if (currentIndex > 0) {\n onStepChange?.(steps[currentIndex - 1]!.key);\n }\n }, [currentIndex, steps, onStepChange]);\n\n const goNext = useCallback(async () => {\n if (!currentStep?.beforeEnter) {\n if (currentIndex < steps.length - 1) {\n onStepChange?.(steps[currentIndex + 1]!.key);\n }\n return;\n }\n const canEnter = await currentStep.beforeEnter();\n if (canEnter && currentIndex < steps.length - 1) {\n onStepChange?.(steps[currentIndex + 1]!.key);\n }\n }, [currentStep, currentIndex, steps, onStepChange]);\n\n // 自动从标题推导\n const modalTitle = title ?? currentStep?.title ?? '';\n\n // 底部按钮:优先使用步骤自定义 footer,否则自动渲染\"取消/上一步/下一步\"\n const renderFooter = () => {\n if (currentStep?.footer !== undefined) return resolve(currentStep.footer);\n\n return (\n <div className={classNames('step-modal-root', styles['step-modal-root'])}>\n {currentIndex > 0 && currentStep?.allowBack !== false && (\n <Button icon={<ChevronLeft />} onClick={goBack}>\n 上一步\n </Button>\n )}\n <div className={classNames('step-modal-container', styles['step-modal-container'])} />\n <Button onClick={onCancel}>取消</Button>\n {currentIndex < steps.length - 1 && (\n <Button type=\"primary\" onClick={goNext}>\n 下一步\n </Button>\n )}\n </div>\n );\n };\n\n return (\n <Modal\n title={modalTitle}\n open={open}\n onCancel={onCancel}\n width={width}\n footer={renderFooter()}\n maskClosable={maskClosable}\n className={className}\n >\n {showSteps && steps.length > 1 && (\n <Steps\n current={currentIndex}\n size=\"small\"\n className={classNames('step-modal-wrapper', styles['step-modal-wrapper'])}\n items={steps.map((s) => ({ title: s.title, description: s.description }))}\n />\n )}\n {resolve(currentStep?.content)}\n </Modal>\n );\n};\n\nexport default StepModal;\n"],"names":["resolve","val","StepModal","title","steps","current","open","onCancel","width","showSteps","maskClosable","className","onStepChange","currentIndex","useMemo","s","currentStep","goBack","useCallback","goNext","modalTitle","jsxs","Modal","classNames","styles","jsx","Button","ChevronLeft","Steps"],"mappings":";;;;;;AAQA,MAAMA,IAAU,CAACC,MAA+D;AAC9E,MAAIA,MAAQ;AACZ,WAAO,OAAOA,KAAQ,aAAaA,EAAA,IAAQA;AAC7C,GAuBMC,IAAsC,CAAC;AAAA,EAC3C,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AAAA,EACZ,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,cAAAC;AACF,MAAM;AACJ,QAAMC,IAAeC,EAAQ,MAAMV,EAAM,UAAU,CAACW,MAAMA,EAAE,QAAQV,CAAO,GAAG,CAACD,GAAOC,CAAO,CAAC,GACxFW,IAAcZ,EAAMS,CAAY,GAEhCI,IAASC,EAAY,MAAM;AAC/B,IAAIL,IAAe,MACjBD,KAAA,QAAAA,EAAeR,EAAMS,IAAe,CAAC,EAAG;AAAA,EAE5C,GAAG,CAACA,GAAcT,GAAOQ,CAAY,CAAC,GAEhCO,IAASD,EAAY,YAAY;AACrC,QAAI,EAACF,KAAA,QAAAA,EAAa,cAAa;AAC7B,MAAIH,IAAeT,EAAM,SAAS,MAChCQ,KAAA,QAAAA,EAAeR,EAAMS,IAAe,CAAC,EAAG;AAE1C;AAAA,IACF;AAEA,IADiB,MAAMG,EAAY,YAAA,KACnBH,IAAeT,EAAM,SAAS,MAC5CQ,KAAA,QAAAA,EAAeR,EAAMS,IAAe,CAAC,EAAG;AAAA,EAE5C,GAAG,CAACG,GAAaH,GAAcT,GAAOQ,CAAY,CAAC,GAG7CQ,IAAajB,MAASa,KAAA,gBAAAA,EAAa,UAAS;AAwBlD,SACE,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAOF;AAAA,MACP,MAAAd;AAAA,MACA,UAAAC;AAAA,MACA,OAAAC;AAAA,MACA,SA1BEQ,KAAA,gBAAAA,EAAa,YAAW,SAAkBhB,EAAQgB,EAAY,MAAM,IAGtE,gBAAAK,EAAC,SAAI,WAAWE,EAAW,mBAAmBC,EAAO,iBAAiB,CAAC,GACpE,UAAA;AAAA,QAAAX,IAAe,MAAKG,KAAA,gBAAAA,EAAa,eAAc,MAC9C,gBAAAS,EAACC,GAAA,EAAO,MAAM,gBAAAD,EAACE,GAAA,CAAA,CAAY,GAAI,SAASV,GAAQ,UAAA,OAEhD;AAAA,QAEF,gBAAAQ,EAAC,SAAI,WAAWF,EAAW,wBAAwBC,EAAO,sBAAsB,CAAC,GAAG;AAAA,QACpF,gBAAAC,EAACC,GAAA,EAAO,SAASnB,GAAU,UAAA,MAAE;AAAA,QAC5BM,IAAeT,EAAM,SAAS,KAC7B,gBAAAqB,EAACC,KAAO,MAAK,WAAU,SAASP,GAAQ,UAAA,MAAA,CAExC;AAAA,MAAA,GAEJ;AAAA,MAWA,cAAAT;AAAA,MACA,WAAAC;AAAA,MAEC,UAAA;AAAA,QAAAF,KAAaL,EAAM,SAAS,KAC3B,gBAAAqB;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,SAASf;AAAA,YACT,MAAK;AAAA,YACL,WAAWU,EAAW,sBAAsBC,EAAO,oBAAoB,CAAC;AAAA,YACxE,OAAOpB,EAAM,IAAI,CAACW,OAAO,EAAE,OAAOA,EAAE,OAAO,aAAaA,EAAE,YAAA,EAAc;AAAA,UAAA;AAAA,QAAA;AAAA,QAG3Ef,EAAQgB,KAAA,gBAAAA,EAAa,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGnC;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Modal/StepModal/index.tsx"],"sourcesContent":["import { ChevronLeft } from '@/components/Icons';\nimport { Button, Modal, Steps } from 'antd';\nimport React, { useCallback, useMemo } from 'react';\nimport type { StepModalProps } from '../StepModalTypes';\nimport { resolveModalWidth } from '../utils/resolveModalSize';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\n\n/** 解析可能是函数的 content / footer */\nconst resolve = (val: React.ReactNode | (() => React.ReactNode) | undefined) => {\n if (val === undefined) return undefined;\n return typeof val === 'function' ? val() : val;\n};\n\n/**\n * 步骤式弹窗\n *\n * 将多步骤流程封装在同一个 Modal 中,自动管理步骤导航、标题切换和底部按钮。\n *\n * 用法:\n * ```tsx\n * const [current, setCurrent] = useState('select');\n * <StepModal\n * open={open}\n * current={current}\n * onCancel={onCancel}\n * steps={[\n * { key: 'select', title: '选择文件', content: <SelectStep /> },\n * { key: 'uploading', title: '上传文件', content: <UploadingStep /> },\n * { key: 'result', title: '上传结果', content: <ResultStep /> },\n * ]}\n * onStepChange={setCurrent}\n * />\n * ```\n */\nconst StepModal: React.FC<StepModalProps> = ({\n title,\n steps,\n current,\n open,\n onCancel,\n width = 600,\n showSteps = true,\n maskClosable = false,\n className,\n onStepChange,\n}) => {\n const currentIndex = useMemo(() => steps.findIndex((s) => s.key === current), [steps, current]);\n const currentStep = steps[currentIndex];\n\n const goBack = useCallback(() => {\n if (currentIndex > 0) {\n onStepChange?.(steps[currentIndex - 1]!.key);\n }\n }, [currentIndex, steps, onStepChange]);\n\n const goNext = useCallback(async () => {\n if (!currentStep?.beforeEnter) {\n if (currentIndex < steps.length - 1) {\n onStepChange?.(steps[currentIndex + 1]!.key);\n }\n return;\n }\n const canEnter = await currentStep.beforeEnter();\n if (canEnter && currentIndex < steps.length - 1) {\n onStepChange?.(steps[currentIndex + 1]!.key);\n }\n }, [currentStep, currentIndex, steps, onStepChange]);\n\n // 自动从标题推导\n const modalTitle = title ?? currentStep?.title ?? '';\n\n // 底部按钮:优先使用步骤自定义 footer,否则自动渲染\"取消/上一步/下一步\"\n const renderFooter = () => {\n if (currentStep?.footer !== undefined) return resolve(currentStep.footer);\n\n return (\n <div className={classNames('step-modal-root', styles['step-modal-root'])}>\n {currentIndex > 0 && currentStep?.allowBack !== false && (\n <Button icon={<ChevronLeft />} onClick={goBack}>\n 上一步\n </Button>\n )}\n <div className={classNames('step-modal-container', styles['step-modal-container'])} />\n <Button onClick={onCancel}>取消</Button>\n {currentIndex < steps.length - 1 && (\n <Button type=\"primary\" onClick={goNext}>\n 下一步\n </Button>\n )}\n </div>\n );\n };\n\n const effectiveWidth = resolveModalWidth({ width });\n\n return (\n <Modal\n title={modalTitle}\n open={open}\n onCancel={onCancel}\n width={effectiveWidth}\n centered\n footer={renderFooter()}\n maskClosable={maskClosable}\n className={className}\n >\n {showSteps && steps.length > 1 && (\n <Steps\n current={currentIndex}\n size=\"small\"\n className={classNames('step-modal-wrapper', styles['step-modal-wrapper'])}\n items={steps.map((s) => ({ title: s.title, description: s.description }))}\n />\n )}\n {resolve(currentStep?.content)}\n </Modal>\n );\n};\n\nexport default StepModal;\n"],"names":["resolve","val","StepModal","title","steps","current","open","onCancel","width","showSteps","maskClosable","className","onStepChange","currentIndex","useMemo","s","currentStep","goBack","useCallback","goNext","modalTitle","renderFooter","jsxs","classNames","styles","jsx","Button","ChevronLeft","effectiveWidth","resolveModalWidth","Modal","Steps"],"mappings":";;;;;;;AASA,MAAMA,IAAU,CAACC,MAA+D;AAC9E,MAAIA,MAAQ;AACZ,WAAO,OAAOA,KAAQ,aAAaA,EAAA,IAAQA;AAC7C,GAuBMC,IAAsC,CAAC;AAAA,EAC3C,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AAAA,EACZ,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,cAAAC;AACF,MAAM;AACJ,QAAMC,IAAeC,EAAQ,MAAMV,EAAM,UAAU,CAACW,MAAMA,EAAE,QAAQV,CAAO,GAAG,CAACD,GAAOC,CAAO,CAAC,GACxFW,IAAcZ,EAAMS,CAAY,GAEhCI,IAASC,EAAY,MAAM;A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d;AAAA,MACA,UAAAC;AAAA,MACA,OAAOqB;AAAA,MACP,UAAQ;AAAA,MACR,QAAQP,EAAA;AAAA,MACR,cAAAX;AAAA,MACA,WAAAC;AAAA,MAEC,UAAA;AAAA,QAAAF,KAAaL,EAAM,SAAS,KAC3B,gBAAAqB;AAAA,UAACM;AAAA,UAAA;AAAA,YACC,SAASlB;AAAA,YACT,MAAK;AAAA,YACL,WAAWU,EAAW,sBAAsBC,EAAO,oBAAoB,CAAC;AAAA,YACxE,OAAOpB,EAAM,IAAI,CAACW,OAAO,EAAE,OAAOA,EAAE,OAAO,aAAaA,EAAE,YAAA,EAAc;AAAA,UAAA;AAAA,QAAA;AAAA,QAG3Ef,EAAQgB,KAAA,gBAAAA,EAAa,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGnC;"}
@@ -1,2 +1,5 @@
1
+ export { default as Modal } from './Modal';
2
+ export type { MarsunModalProps } from './ModalTypes';
1
3
  export { default as StepModal } from './StepModal';
2
4
  export type { StepItem, StepModalProps } from './StepModalTypes';
5
+ export { MODAL_SIZE_BODY_HEIGHT, MODAL_SIZE_WIDTH, resolveModalSizeAnchor, resolveModalWidth, type ModalSize, type ResolveModalWidthOptions, } from './utils/resolveModalSize';
@@ -0,0 +1,22 @@
1
+ export type ModalSize = 'S' | 'M' | 'L';
2
+ export declare const MODAL_SIZE_WIDTH: Record<ModalSize, number>;
3
+ /** 固定 body 可视高度(外壳不随内容无限长高) */
4
+ export declare const MODAL_SIZE_BODY_HEIGHT: Record<ModalSize, string>;
5
+ export type ResolveModalWidthOptions = {
6
+ size?: ModalSize;
7
+ width?: number;
8
+ /** 未传时读 window.innerWidth;SSR 默认 1200 */
9
+ viewportWidth?: number;
10
+ };
11
+ /**
12
+ * 解析 Modal 有效宽度:只可缩小不可放大。
13
+ * - 有 width / size:以之为锚点,再与 viewport-64 取 min
14
+ * - 皆无:按视口自动选 S→M→L,再 cap
15
+ */
16
+ export declare function resolveModalWidth(options?: ResolveModalWidthOptions): number;
17
+ /** 解析用于高度锚点的 size(与宽度锚点一致,不受 cap 影响) */
18
+ export declare function resolveModalSizeAnchor(options: {
19
+ size?: ModalSize;
20
+ width?: number;
21
+ viewportWidth?: number;
22
+ }): ModalSize;
@@ -0,0 +1,28 @@
1
+ const r = {
2
+ S: 480,
3
+ M: 720,
4
+ L: 960
5
+ }, w = {
6
+ S: "min(420px, 60vh)",
7
+ M: "min(560px, 70vh)",
8
+ L: "min(720px, 80vh)"
9
+ }, d = 64;
10
+ function f(e = {}) {
11
+ const i = e.viewportWidth ?? (typeof window < "u" ? window.innerWidth : 1200), t = Math.max(280, i - d);
12
+ let n;
13
+ return e.width != null && Number.isFinite(e.width) ? n = e.width : e.size ? n = r[e.size] : i < 768 ? n = r.S : i < 1200 ? n = r.M : n = r.L, Math.min(n, t);
14
+ }
15
+ function h(e) {
16
+ if (e.size) return e.size;
17
+ if (e.width != null)
18
+ return e.width <= r.S ? "S" : e.width <= r.M ? "M" : "L";
19
+ const i = e.viewportWidth ?? (typeof window < "u" ? window.innerWidth : 1200);
20
+ return i < 768 ? "S" : i < 1200 ? "M" : "L";
21
+ }
22
+ export {
23
+ w as MODAL_SIZE_BODY_HEIGHT,
24
+ r as MODAL_SIZE_WIDTH,
25
+ h as resolveModalSizeAnchor,
26
+ f as resolveModalWidth
27
+ };
28
+ //# sourceMappingURL=resolveModalSize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveModalSize.js","sources":["../../../../src/components/Modal/utils/resolveModalSize.ts"],"sourcesContent":["export type ModalSize = 'S' | 'M' | 'L';\n\nexport const MODAL_SIZE_WIDTH: Record<ModalSize, number> = {\n S: 480,\n M: 720,\n L: 960,\n};\n\n/** 固定 body 可视高度(外壳不随内容无限长高) */\nexport const MODAL_SIZE_BODY_HEIGHT: Record<ModalSize, string> = {\n S: 'min(420px, 60vh)',\n M: 'min(560px, 70vh)',\n L: 'min(720px, 80vh)',\n};\n\nconst VIEWPORT_GUTTER = 64;\n\nexport type ResolveModalWidthOptions = {\n size?: ModalSize;\n width?: number;\n /** 未传时读 window.innerWidth;SSR 默认 1200 */\n viewportWidth?: number;\n};\n\n/**\n * 解析 Modal 有效宽度:只可缩小不可放大。\n * - 有 width / size:以之为锚点,再与 viewport-64 取 min\n * - 皆无:按视口自动选 S→M→L,再 cap\n */\nexport function resolveModalWidth(options: ResolveModalWidthOptions = {}): number {\n const vw = options.viewportWidth ?? (typeof window !== 'undefined' ? window.innerWidth : 1200);\n const cap = Math.max(280, vw - VIEWPORT_GUTTER);\n\n let preferred: number;\n if (options.width != null && Number.isFinite(options.width)) {\n preferred = options.width;\n } else if (options.size) {\n preferred = MODAL_SIZE_WIDTH[options.size];\n } else if (vw < 768) {\n preferred = MODAL_SIZE_WIDTH.S;\n } else if (vw < 1200) {\n preferred = MODAL_SIZE_WIDTH.M;\n } else {\n preferred = MODAL_SIZE_WIDTH.L;\n }\n\n return Math.min(preferred, cap);\n}\n\n/** 解析用于高度锚点的 size(与宽度锚点一致,不受 cap 影响) */\nexport function resolveModalSizeAnchor(options: {\n size?: ModalSize;\n width?: number;\n viewportWidth?: number;\n}): ModalSize {\n if (options.size) return options.size;\n if (options.width != null) {\n if (options.width <= MODAL_SIZE_WIDTH.S) return 'S';\n if (options.width <= MODAL_SIZE_WIDTH.M) return 'M';\n return 'L';\n }\n const vw = options.viewportWidth ?? (typeof window !== 'undefined' ? window.innerWidth : 1200);\n if (vw < 768) return 'S';\n if (vw < 1200) return 'M';\n return 'L';\n}\n"],"names":["MODAL_SIZE_WIDTH","MODAL_SIZE_BODY_HEIGHT","VIEWPORT_GUTTER","resolveModalWidth","options","vw","cap","preferred","resolveModalSizeAnchor"],"mappings":"AAEO,MAAMA,IAA8C;AAAA,EACzD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL,GAGaC,IAAoD;AAAA,EAC/D,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL,GAEMC,IAAkB;AAcjB,SAASC,EAAkBC,IAAoC,IAAY;AAChF,QAAMC,IAAKD,EAAQ,kBAAkB,OAAO,SAAW,MAAc,OAAO,aAAa,OACnFE,IAAM,KAAK,IAAI,KAAKD,IAAKH,CAAe;AAE9C,MAAIK;AACJ,SAAIH,EAAQ,SAAS,QAAQ,OAAO,SAASA,EAAQ,KAAK,IACxDG,IAAYH,EAAQ,QACXA,EAAQ,OACjBG,IAAYP,EAAiBI,EAAQ,IAAI,IAChCC,IAAK,MACdE,IAAYP,EAAiB,IACpBK,IAAK,OACdE,IAAYP,EAAiB,IAE7BO,IAAYP,EAAiB,GAGxB,KAAK,IAAIO,GAAWD,CAAG;AAChC;AAGO,SAASE,EAAuBJ,GAIzB;AACZ,MAAIA,EAAQ,KAAM,QAAOA,EAAQ;AACjC,MAAIA,EAAQ,SAAS;AACnB,WAAIA,EAAQ,SAASJ,EAAiB,IAAU,MAC5CI,EAAQ,SAASJ,EAAiB,IAAU,MACzC;AAET,QAAMK,IAAKD,EAAQ,kBAAkB,OAAO,SAAW,MAAc,OAAO,aAAa;AACzF,SAAIC,IAAK,MAAY,MACjBA,IAAK,OAAa,MACf;AACT;"}
package/dist/index.d.ts CHANGED
@@ -47,3 +47,4 @@ export { default as AgentHubSessionAccessGuard } from './components/AgentHub/Cha
47
47
  export type * from './components/AgentHub/types';
48
48
  export * from './components/AgentHub/Chat';
49
49
  export * from './components/AgentHub/KnowledgeBase';
50
+ export * from './components/AgentHub/Report';