@hkyhy/marsun-components-core 0.1.63 → 0.1.66

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 (34) hide show
  1. package/dist/components/Alert/Alert.d.ts +28 -0
  2. package/dist/components/Alert/Alert.js +74 -0
  3. package/dist/components/Alert/Alert.js.map +1 -0
  4. package/dist/components/Alert/index.d.ts +2 -0
  5. package/dist/components/Alert/style.module.scss.js +17 -0
  6. package/dist/components/Alert/style.module.scss.js.map +1 -0
  7. package/dist/components/Form/index.d.ts +1 -0
  8. package/dist/components/Form/kneFormInfo.d.ts +7 -1
  9. package/dist/components/Form/kneFormInfo.js +39 -21
  10. package/dist/components/Form/kneFormInfo.js.map +1 -1
  11. package/dist/components/Form/normalizeLabelTips.d.ts +14 -0
  12. package/dist/components/Form/normalizeLabelTips.js +40 -0
  13. package/dist/components/Form/normalizeLabelTips.js.map +1 -0
  14. package/dist/components/Layout/ModulePageShell/index.d.ts +2 -1
  15. package/dist/components/Layout/ModulePageShell/index.js +1 -7
  16. package/dist/components/Layout/ModulePageShell/index.js.map +1 -1
  17. package/dist/components/Layout/PageShell/PageShellContext.d.ts +9 -2
  18. package/dist/components/Layout/PageShell/PageShellContext.js +23 -23
  19. package/dist/components/Layout/PageShell/PageShellContext.js.map +1 -1
  20. package/dist/components/Layout/PageShell/index.d.ts +2 -2
  21. package/dist/components/Layout/index.d.ts +1 -1
  22. package/dist/components/StateBar/StateBar.d.ts +17 -2
  23. package/dist/components/StateBar/StateBar.js +74 -33
  24. package/dist/components/StateBar/StateBar.js.map +1 -1
  25. package/dist/components/StateBar/index.d.ts +1 -1
  26. package/dist/components/StateBar/style.module.scss.js +10 -8
  27. package/dist/components/StateBar/style.module.scss.js.map +1 -1
  28. package/dist/components/index.d.ts +1 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +617 -612
  31. package/dist/index.js.map +1 -1
  32. package/dist/marsun-components-core.css +1 -1
  33. package/dist/styles/global.css +1 -1
  34. package/package.json +1 -1
@@ -0,0 +1,28 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ export type AlertType = 'info' | 'success' | 'warning' | 'error';
3
+ export interface MarsunAlertProps {
4
+ /** 语义类型,默认 info */
5
+ type?: AlertType;
6
+ /** 主文案(必填,建议 ≤2 行) */
7
+ message: ReactNode;
8
+ /** 补充说明;含可操作链接/按钮时再加 */
9
+ description?: ReactNode;
10
+ /** 是否展示左侧图标,默认 true */
11
+ showIcon?: boolean;
12
+ /** 自定义图标,优先级高于默认语义图标 */
13
+ icon?: ReactNode;
14
+ /** 右侧操作区(如按钮) */
15
+ action?: ReactNode;
16
+ /** 是否可关闭 */
17
+ closable?: boolean;
18
+ /** 关闭回调(受控关闭时由业务处理;未受控时内部隐藏) */
19
+ onClose?: () => void;
20
+ className?: string;
21
+ style?: CSSProperties;
22
+ }
23
+ /**
24
+ * 显性提示条:语义色 + 左侧强调线 + core Icons。
25
+ * 静态说明请用 Info + TooltipInfo,勿滥用本组件作页面常驻说明。
26
+ */
27
+ declare const MarsunAlert: React.FC<MarsunAlertProps>;
28
+ export default MarsunAlert;
@@ -0,0 +1,74 @@
1
+ import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
+ import e from "classnames";
3
+ import { useState as b } from "react";
4
+ import a from "./style.module.scss.js";
5
+ import { X as v } from "../Icons/X.js";
6
+ import { CircleX as z } from "../Icons/CircleX.js";
7
+ import { CircleAlert as C } from "../Icons/CircleAlert.js";
8
+ import { CircleCheck as g } from "../Icons/CircleCheck.js";
9
+ import { Info as x } from "../Icons/Info.js";
10
+ const A = {
11
+ info: /* @__PURE__ */ r(x, { size: 16, "aria-hidden": !0 }),
12
+ success: /* @__PURE__ */ r(g, { size: 16, "aria-hidden": !0 }),
13
+ warning: /* @__PURE__ */ r(C, { size: 16, "aria-hidden": !0 }),
14
+ error: /* @__PURE__ */ r(z, { size: 16, "aria-hidden": !0 })
15
+ }, F = ({
16
+ type: s = "info",
17
+ message: m,
18
+ description: l,
19
+ showIcon: u = !0,
20
+ icon: o,
21
+ action: n,
22
+ closable: c = !1,
23
+ onClose: t,
24
+ className: d,
25
+ style: f
26
+ }) => {
27
+ const [h, p] = b(!1);
28
+ if (h) return null;
29
+ const N = () => {
30
+ t == null || t(), p(!0);
31
+ };
32
+ return /* @__PURE__ */ i(
33
+ "div",
34
+ {
35
+ role: "alert",
36
+ className: e(
37
+ "marsun-alert",
38
+ a["marsun-alert"],
39
+ `marsun-alert--${s}`,
40
+ a[`marsun-alert--${s}`],
41
+ d
42
+ ),
43
+ style: f,
44
+ children: [
45
+ u ? /* @__PURE__ */ r("span", { className: e("marsun-alert-icon", a["marsun-alert-icon"]), "aria-hidden": !0, children: o ?? A[s] }) : null,
46
+ /* @__PURE__ */ i("div", { className: e("marsun-alert-body", a["marsun-alert-body"]), children: [
47
+ /* @__PURE__ */ r("div", { className: e("marsun-alert-message", a["marsun-alert-message"]), children: m }),
48
+ l != null && l !== !1 ? /* @__PURE__ */ r(
49
+ "div",
50
+ {
51
+ className: e("marsun-alert-description", a["marsun-alert-description"]),
52
+ children: l
53
+ }
54
+ ) : null
55
+ ] }),
56
+ n ? /* @__PURE__ */ r("div", { className: e("marsun-alert-action", a["marsun-alert-action"]), children: n }) : null,
57
+ c ? /* @__PURE__ */ r(
58
+ "button",
59
+ {
60
+ type: "button",
61
+ className: e("marsun-alert-close", a["marsun-alert-close"]),
62
+ "aria-label": "关闭",
63
+ onClick: N,
64
+ children: /* @__PURE__ */ r(v, { size: 14 })
65
+ }
66
+ ) : null
67
+ ]
68
+ }
69
+ );
70
+ };
71
+ export {
72
+ F as default
73
+ };
74
+ //# sourceMappingURL=Alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alert.js","sources":["../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport type { CSSProperties, ReactNode } from 'react';\nimport { useState } from 'react';\nimport { CircleAlert, CircleCheck, CircleX, Info, X } from '../Icons';\nimport styles from './style.module.scss';\n\nexport type AlertType = 'info' | 'success' | 'warning' | 'error';\n\nexport interface MarsunAlertProps {\n /** 语义类型,默认 info */\n type?: AlertType;\n /** 主文案(必填,建议 ≤2 行) */\n message: ReactNode;\n /** 补充说明;含可操作链接/按钮时再加 */\n description?: ReactNode;\n /** 是否展示左侧图标,默认 true */\n showIcon?: boolean;\n /** 自定义图标,优先级高于默认语义图标 */\n icon?: ReactNode;\n /** 右侧操作区(如按钮) */\n action?: ReactNode;\n /** 是否可关闭 */\n closable?: boolean;\n /** 关闭回调(受控关闭时由业务处理;未受控时内部隐藏) */\n onClose?: () => void;\n className?: string;\n style?: CSSProperties;\n}\n\nconst DEFAULT_ICON: Record<AlertType, ReactNode> = {\n info: <Info size={16} aria-hidden />,\n success: <CircleCheck size={16} aria-hidden />,\n warning: <CircleAlert size={16} aria-hidden />,\n error: <CircleX size={16} aria-hidden />,\n};\n\n/**\n * 显性提示条:语义色 + 左侧强调线 + core Icons。\n * 静态说明请用 Info + TooltipInfo,勿滥用本组件作页面常驻说明。\n */\nconst MarsunAlert: React.FC<MarsunAlertProps> = ({\n type = 'info',\n message,\n description,\n showIcon = true,\n icon,\n action,\n closable = false,\n onClose,\n className,\n style,\n}) => {\n const [closed, setClosed] = useState(false);\n if (closed) return null;\n\n const handleClose = () => {\n onClose?.();\n setClosed(true);\n };\n\n return (\n <div\n role=\"alert\"\n className={classNames(\n 'marsun-alert',\n styles['marsun-alert'],\n `marsun-alert--${type}`,\n styles[`marsun-alert--${type}`],\n className,\n )}\n style={style}\n >\n {showIcon ? (\n <span className={classNames('marsun-alert-icon', styles['marsun-alert-icon'])} aria-hidden>\n {icon ?? DEFAULT_ICON[type]}\n </span>\n ) : null}\n <div className={classNames('marsun-alert-body', styles['marsun-alert-body'])}>\n <div className={classNames('marsun-alert-message', styles['marsun-alert-message'])}>\n {message}\n </div>\n {description != null && description !== false ? (\n <div\n className={classNames('marsun-alert-description', styles['marsun-alert-description'])}\n >\n {description}\n </div>\n ) : null}\n </div>\n {action ? (\n <div className={classNames('marsun-alert-action', styles['marsun-alert-action'])}>\n {action}\n </div>\n ) : null}\n {closable ? (\n <button\n type=\"button\"\n className={classNames('marsun-alert-close', styles['marsun-alert-close'])}\n aria-label=\"关闭\"\n onClick={handleClose}\n >\n <X size={14} />\n </button>\n ) : null}\n </div>\n );\n};\n\nexport default MarsunAlert;\n"],"names":["DEFAULT_ICON","jsx","Info","CircleCheck","CircleAlert","CircleX","MarsunAlert","type","message","description","showIcon","icon","action","closable","onClose","className","style","closed","setClosed","useState","handleClose","jsxs","classNames","styles","X"],"mappings":";;;;;;;;;AA6BA,MAAMA,IAA6C;AAAA,EACjD,MAAM,gBAAAC,EAACC,GAAA,EAAK,MAAM,IAAI,eAAW,IAAC;AAAA,EAClC,SAAS,gBAAAD,EAACE,GAAA,EAAY,MAAM,IAAI,eAAW,IAAC;AAAA,EAC5C,SAAS,gBAAAF,EAACG,GAAA,EAAY,MAAM,IAAI,eAAW,IAAC;AAAA,EAC5C,OAAO,gBAAAH,EAACI,GAAA,EAAQ,MAAM,IAAI,eAAW,GAAA,CAAC;AACxC,GAMMC,IAA0C,CAAC;AAAA,EAC/C,MAAAC,IAAO;AAAA,EACP,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AACF,MAAM;AACJ,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK;AAC1C,MAAIF,EAAQ,QAAO;AAEnB,QAAMG,IAAc,MAAM;AACxB,IAAAN,KAAA,QAAAA,KACAI,EAAU,EAAI;AAAA,EAChB;AAEA,SACE,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAWC;AAAA,QACT;AAAA,QACAC,EAAO,cAAc;AAAA,QACrB,iBAAiBhB,CAAI;AAAA,QACrBgB,EAAO,iBAAiBhB,CAAI,EAAE;AAAA,QAC9BQ;AAAA,MAAA;AAAA,MAEF,OAAAC;AAAA,MAEC,UAAA;AAAA,QAAAN,IACC,gBAAAT,EAAC,QAAA,EAAK,WAAWqB,EAAW,qBAAqBC,EAAO,mBAAmB,CAAC,GAAG,eAAW,IACvF,UAAAZ,KAAQX,EAAaO,CAAI,GAC5B,IACE;AAAA,QACJ,gBAAAc,EAAC,SAAI,WAAWC,EAAW,qBAAqBC,EAAO,mBAAmB,CAAC,GACzE,UAAA;AAAA,UAAA,gBAAAtB,EAAC,OAAA,EAAI,WAAWqB,EAAW,wBAAwBC,EAAO,sBAAsB,CAAC,GAC9E,UAAAf,EAAA,CACH;AAAA,UACCC,KAAe,QAAQA,MAAgB,KACtC,gBAAAR;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWqB,EAAW,4BAA4BC,EAAO,0BAA0B,CAAC;AAAA,cAEnF,UAAAd;AAAA,YAAA;AAAA,UAAA,IAED;AAAA,QAAA,GACN;AAAA,QACCG,IACC,gBAAAX,EAAC,OAAA,EAAI,WAAWqB,EAAW,uBAAuBC,EAAO,qBAAqB,CAAC,GAC5E,UAAAX,EAAA,CACH,IACE;AAAA,QACHC,IACC,gBAAAZ;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAWqB,EAAW,sBAAsBC,EAAO,oBAAoB,CAAC;AAAA,YACxE,cAAW;AAAA,YACX,SAASH;AAAA,YAET,UAAA,gBAAAnB,EAACuB,GAAA,EAAE,MAAM,GAAA,CAAI;AAAA,UAAA;AAAA,QAAA,IAEb;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV;"}
@@ -0,0 +1,2 @@
1
+ export { default as Alert } from './Alert';
2
+ export type { MarsunAlertProps, AlertType } from './Alert';
@@ -0,0 +1,17 @@
1
+ const a = {
2
+ "marsun-alert": "_marsun-alert_dsoal_1",
3
+ "marsun-alert-icon": "_marsun-alert-icon_dsoal_13",
4
+ "marsun-alert-body": "_marsun-alert-body_dsoal_23",
5
+ "marsun-alert-message": "_marsun-alert-message_dsoal_29",
6
+ "marsun-alert-description": "_marsun-alert-description_dsoal_36",
7
+ "marsun-alert-action": "_marsun-alert-action_dsoal_44",
8
+ "marsun-alert-close": "_marsun-alert-close_dsoal_50",
9
+ "marsun-alert--info": "_marsun-alert--info_dsoal_70",
10
+ "marsun-alert--success": "_marsun-alert--success_dsoal_78",
11
+ "marsun-alert--warning": "_marsun-alert--warning_dsoal_86",
12
+ "marsun-alert--error": "_marsun-alert--error_dsoal_94"
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":";;;;;;;;;;;;;"}
@@ -11,6 +11,7 @@ export type { FormDataSyncProps } from './FormDataSync';
11
11
  /** @kne/form-info — 业务从包根导入,勿直连 @kne/form-info */
12
12
  export { FormInfo, Form, FormModal, FormSteps, FormStepsModal, List, TableList, MultiField, Input, TextArea, Select, TreeSelect, InputNumber, Switch, RadioGroup, SubmitButton, ResetButton, CancelButton, } from './kneFormInfo';
13
13
  export type { FormInfoProps, FormProps, FormModalProps, FormStepsProps, FormStepsModalProps, ListProps, TableListProps, MultiFieldProps, } from './kneFormInfo';
14
+ export { normalizeLabelTips, withNormalizedLabelTips } from './normalizeLabelTips';
14
15
  /** @kne/react-form — 引擎 API;默认组件为 ReactForm(勿与 FormInfo 的 Form 混淆) */
15
16
  export { ReactForm, GroupList, useField, useFormApi, useFormContext, useGroup, useSubmit, useReset, RULES, preset, interceptors, compileErrMsg, computedFieldValueFromFormData, computedFormDataFormState, filterEmpty, findField, formUtils, isEmpty, isNotEmpty, matchFields, stateToError, stateToIsPass, } from './kneReactForm';
16
17
  export type { GroupListRenderProps } from './kneReactForm';
@@ -3,6 +3,8 @@ import { ComponentType, FC, ReactNode } from 'react';
3
3
  type FieldProps = {
4
4
  name: string;
5
5
  label?: ReactNode;
6
+ /** 字符串自动变 Info 悬停;也可传 ReactNode / (props)=>ReactNode 自定义 */
7
+ labelTips?: ReactNode | ((props: FieldProps) => ReactNode);
6
8
  rule?: string;
7
9
  placeholder?: string;
8
10
  disabled?: boolean;
@@ -37,7 +39,10 @@ export declare const TableList: FC<Omit<TableListProps, "itemTitle"> & {
37
39
  itemTitle?: (ctx: ItemTitleCtx) => string;
38
40
  }>;
39
41
  export declare const MultiField: FC<MultiFieldProps>;
40
- export declare const Input: ComponentType<FieldProps>;
42
+ type KneInputType = ComponentType<FieldProps> & {
43
+ Password: ComponentType<FieldProps>;
44
+ };
45
+ export declare const Input: KneInputType;
41
46
  export declare const TextArea: ComponentType<FieldProps>;
42
47
  export declare const Select: ComponentType<FieldProps>;
43
48
  export declare const TreeSelect: ComponentType<FieldProps>;
@@ -47,3 +52,4 @@ export declare const RadioGroup: ComponentType<FieldProps>;
47
52
  export declare const SubmitButton: ComponentType<ButtonProps>;
48
53
  export declare const ResetButton: ComponentType<ButtonProps>;
49
54
  export declare const CancelButton: ComponentType<ButtonProps>;
55
+ export { normalizeLabelTips, withNormalizedLabelTips } from './normalizeLabelTips';
@@ -1,25 +1,43 @@
1
1
  /* empty css */
2
- import t, { Form as o, FormModal as s, FormSteps as e, FormStepsModal as n, List as a, MultiField as r, TableList as c } from "@kne/form-info";
3
- import { CancelButton as u, Input as m, InputNumber as i, RadioGroup as l, ResetButton as p, Select as S, SubmitButton as F, Switch as $, TextArea as d, TreeSelect as B } from "@kne/react-form-antd";
4
- const I = t, L = o, R = s, f = e, x = n, h = a, w = c, A = r, C = m, G = d, N = S, g = B, j = i, k = $, q = l, v = F, y = p, z = u;
2
+ import s, { Form as e, FormModal as n, FormSteps as a, FormStepsModal as r, List as c, MultiField as i, TableList as m } from "@kne/form-info";
3
+ import { CancelButton as u, ResetButton as l, SubmitButton as p, Input as S, TextArea as d, Select as F, TreeSelect as $, InputNumber as b, Switch as T, RadioGroup as B } from "@kne/react-form-antd";
4
+ import { withNormalizedLabelTips as t } from "./normalizeLabelTips.js";
5
+ import { normalizeLabelTips as H } from "./normalizeLabelTips.js";
6
+ const R = s, x = e, h = n, N = a, A = r, C = c, G = m, z = i, o = S, I = t(o), P = Object.assign(I, {
7
+ Password: t(o.Password)
8
+ }), g = t(
9
+ d
10
+ ), j = t(
11
+ F
12
+ ), y = t(
13
+ $
14
+ ), K = t(
15
+ b
16
+ ), O = t(
17
+ T
18
+ ), W = t(
19
+ B
20
+ ), k = p, q = l, v = u;
5
21
  export {
6
- z as CancelButton,
7
- L as Form,
8
- I as FormInfo,
9
- R as FormModal,
10
- f as FormSteps,
11
- x as FormStepsModal,
12
- C as Input,
13
- j as InputNumber,
14
- h as List,
15
- A as MultiField,
16
- q as RadioGroup,
17
- y as ResetButton,
18
- N as Select,
19
- v as SubmitButton,
20
- k as Switch,
21
- w as TableList,
22
- G as TextArea,
23
- g as TreeSelect
22
+ v as CancelButton,
23
+ x as Form,
24
+ R as FormInfo,
25
+ h as FormModal,
26
+ N as FormSteps,
27
+ A as FormStepsModal,
28
+ P as Input,
29
+ K as InputNumber,
30
+ C as List,
31
+ z as MultiField,
32
+ W as RadioGroup,
33
+ q as ResetButton,
34
+ j as Select,
35
+ k as SubmitButton,
36
+ O as Switch,
37
+ G as TableList,
38
+ g as TextArea,
39
+ y as TreeSelect,
40
+ H as normalizeLabelTips,
41
+ t as withNormalizedLabelTips
24
42
  };
25
43
  //# sourceMappingURL=kneFormInfo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kneFormInfo.js","sources":["../../../src/components/Form/kneFormInfo.ts"],"sourcesContent":["/**\n * 经 core 再导出 @kne/form-info(业务唯一入口)。\n * 布局组件来自 @kne/form-info;字段组件须从 @kne/react-form-antd 具名导入\n * (form-info 的 `export *` 在 Vite 下经 namespace 读取时常为 undefined)。\n */\nimport '@kne/form-info/dist/index.css';\nimport FormInfoBase, {\n Form as KneForm,\n FormModal as KneFormModal,\n FormSteps as KneFormSteps,\n FormStepsModal as KneFormStepsModal,\n List as KneList,\n MultiField as KneMultiField,\n TableList as KneTableList,\n type FormModalProps,\n type FormProps,\n type FormStepsModalProps,\n type FormStepsProps,\n type ListProps,\n type MultiFieldProps,\n type TableListProps,\n type FormInfoProps,\n} from '@kne/form-info';\nimport {\n CancelButton as KneCancelButton,\n Input as KneInput,\n InputNumber as KneInputNumber,\n RadioGroup as KneRadioGroup,\n ResetButton as KneResetButton,\n Select as KneSelect,\n SubmitButton as KneSubmitButton,\n Switch as KneSwitch,\n TextArea as KneTextArea,\n TreeSelect as KneTreeSelect,\n} from '@kne/react-form-antd';\nimport type { ComponentType, FC, ReactNode } from 'react';\n\ntype FieldProps = {\n name: string;\n label?: ReactNode;\n rule?: string;\n placeholder?: string;\n disabled?: boolean;\n block?: boolean;\n rows?: number;\n options?: unknown[];\n [key: string]: unknown;\n};\n\ntype ButtonProps = {\n children?: ReactNode;\n type?: string;\n loading?: boolean;\n [key: string]: unknown;\n};\n\ntype ItemTitleCtx = { index: number; data?: Record<string, unknown> };\n\nexport type {\n FormInfoProps,\n FormProps,\n FormModalProps,\n FormStepsProps,\n FormStepsModalProps,\n ListProps,\n TableListProps,\n MultiFieldProps,\n};\n\nexport const FormInfo = FormInfoBase;\nexport const Form = KneForm;\nexport const FormModal = KneFormModal as FC<FormModalProps & { children?: ReactNode }>;\nexport const FormSteps = KneFormSteps as FC<FormStepsProps>;\nexport const FormStepsModal = KneFormStepsModal as FC<FormStepsModalProps>;\n\nexport const List = KneList as FC<\n Omit<ListProps, 'itemTitle'> & {\n maxLength?: number;\n itemTitle?: (ctx: ItemTitleCtx) => string;\n }\n>;\nexport const TableList = KneTableList as FC<\n Omit<TableListProps, 'itemTitle'> & {\n itemTitle?: (ctx: ItemTitleCtx) => string;\n }\n>;\nexport const MultiField = KneMultiField as FC<MultiFieldProps>;\n\nexport const Input = KneInput as ComponentType<FieldProps>;\nexport const TextArea = KneTextArea as ComponentType<FieldProps>;\nexport const Select = KneSelect as ComponentType<FieldProps>;\nexport const TreeSelect = KneTreeSelect as ComponentType<FieldProps>;\nexport const InputNumber = KneInputNumber as ComponentType<FieldProps>;\nexport const Switch = KneSwitch as ComponentType<FieldProps>;\nexport const RadioGroup = KneRadioGroup as ComponentType<FieldProps>;\nexport const SubmitButton = KneSubmitButton as ComponentType<ButtonProps>;\nexport const ResetButton = KneResetButton as ComponentType<ButtonProps>;\nexport const CancelButton = KneCancelButton as ComponentType<ButtonProps>;\n"],"names":["FormInfo","FormInfoBase","Form","KneForm","FormModal","KneFormModal","FormSteps","KneFormSteps","FormStepsModal","KneFormStepsModal","List","KneList","TableList","KneTableList","MultiField","KneMultiField","Input","KneInput","TextArea","KneTextArea","Select","KneSelect","TreeSelect","KneTreeSelect","InputNumber","KneInputNumber","Switch","KneSwitch","RadioGroup","KneRadioGroup","SubmitButton","KneSubmitButton","ResetButton","KneResetButton","CancelButton","KneCancelButton"],"mappings":";;;AAqEO,MAAMA,IAAWC,GACXC,IAAOC,GACPC,IAAYC,GACZC,IAAYC,GACZC,IAAiBC,GAEjBC,IAAOC,GAMPC,IAAYC,GAKZC,IAAaC,GAEbC,IAAQC,GACRC,IAAWC,GACXC,IAASC,GACTC,IAAaC,GACbC,IAAcC,GACdC,IAASC,GACTC,IAAaC,GACbC,IAAeC,GACfC,IAAcC,GACdC,IAAeC;"}
1
+ {"version":3,"file":"kneFormInfo.js","sources":["../../../src/components/Form/kneFormInfo.ts"],"sourcesContent":["/**\n * 经 core 再导出 @kne/form-info(业务唯一入口)。\n * 布局组件来自 @kne/form-info;字段组件须从 @kne/react-form-antd 具名导入\n * (form-info 的 `export *` 在 Vite 下经 namespace 读取时常为 undefined)。\n *\n * 字段 `labelTips`:字符串由 {@link withNormalizedLabelTips} 统一包成 Info+TooltipInfo。\n */\nimport '@kne/form-info/dist/index.css';\nimport FormInfoBase, {\n Form as KneForm,\n FormModal as KneFormModal,\n FormSteps as KneFormSteps,\n FormStepsModal as KneFormStepsModal,\n List as KneList,\n MultiField as KneMultiField,\n TableList as KneTableList,\n type FormModalProps,\n type FormProps,\n type FormStepsModalProps,\n type FormStepsProps,\n type ListProps,\n type MultiFieldProps,\n type TableListProps,\n type FormInfoProps,\n} from '@kne/form-info';\nimport {\n CancelButton as KneCancelButton,\n Input as KneInput,\n InputNumber as KneInputNumber,\n RadioGroup as KneRadioGroup,\n ResetButton as KneResetButton,\n Select as KneSelect,\n SubmitButton as KneSubmitButton,\n Switch as KneSwitch,\n TextArea as KneTextArea,\n TreeSelect as KneTreeSelect,\n} from '@kne/react-form-antd';\nimport type { ComponentType, FC, ReactNode } from 'react';\nimport { withNormalizedLabelTips } from './normalizeLabelTips';\n\ntype FieldProps = {\n name: string;\n label?: ReactNode;\n /** 字符串自动变 Info 悬停;也可传 ReactNode / (props)=>ReactNode 自定义 */\n labelTips?: ReactNode | ((props: FieldProps) => ReactNode);\n rule?: string;\n placeholder?: string;\n disabled?: boolean;\n block?: boolean;\n rows?: number;\n options?: unknown[];\n [key: string]: unknown;\n};\n\ntype ButtonProps = {\n children?: ReactNode;\n type?: string;\n loading?: boolean;\n [key: string]: unknown;\n};\n\ntype ItemTitleCtx = { index: number; data?: Record<string, unknown> };\n\nexport type {\n FormInfoProps,\n FormProps,\n FormModalProps,\n FormStepsProps,\n FormStepsModalProps,\n ListProps,\n TableListProps,\n MultiFieldProps,\n};\n\nexport const FormInfo = FormInfoBase;\nexport const Form = KneForm;\nexport const FormModal = KneFormModal as FC<FormModalProps & { children?: ReactNode }>;\nexport const FormSteps = KneFormSteps as FC<FormStepsProps>;\nexport const FormStepsModal = KneFormStepsModal as FC<FormStepsModalProps>;\n\nexport const List = KneList as FC<\n Omit<ListProps, 'itemTitle'> & {\n maxLength?: number;\n itemTitle?: (ctx: ItemTitleCtx) => string;\n }\n>;\nexport const TableList = KneTableList as FC<\n Omit<TableListProps, 'itemTitle'> & {\n itemTitle?: (ctx: ItemTitleCtx) => string;\n }\n>;\nexport const MultiField = KneMultiField as FC<MultiFieldProps>;\n\ntype KneInputType = ComponentType<FieldProps> & { Password: ComponentType<FieldProps> };\nconst KneInputTyped = KneInput as unknown as KneInputType;\nconst InputWrapped = withNormalizedLabelTips(KneInputTyped);\nexport const Input = Object.assign(InputWrapped, {\n Password: withNormalizedLabelTips(KneInputTyped.Password),\n}) as KneInputType;\n\nexport const TextArea = withNormalizedLabelTips(\n KneTextArea as ComponentType<FieldProps>,\n) as ComponentType<FieldProps>;\nexport const Select = withNormalizedLabelTips(\n KneSelect as ComponentType<FieldProps>,\n) as ComponentType<FieldProps>;\nexport const TreeSelect = withNormalizedLabelTips(\n KneTreeSelect as ComponentType<FieldProps>,\n) as ComponentType<FieldProps>;\nexport const InputNumber = withNormalizedLabelTips(\n KneInputNumber as ComponentType<FieldProps>,\n) as ComponentType<FieldProps>;\nexport const Switch = withNormalizedLabelTips(\n KneSwitch as ComponentType<FieldProps>,\n) as ComponentType<FieldProps>;\nexport const RadioGroup = withNormalizedLabelTips(\n KneRadioGroup as ComponentType<FieldProps>,\n) as ComponentType<FieldProps>;\n\nexport const SubmitButton = KneSubmitButton as ComponentType<ButtonProps>;\nexport const ResetButton = KneResetButton as ComponentType<ButtonProps>;\nexport const CancelButton = KneCancelButton as ComponentType<ButtonProps>;\n\nexport { normalizeLabelTips, withNormalizedLabelTips } from './normalizeLabelTips';\n"],"names":["FormInfo","FormInfoBase","Form","KneForm","FormModal","KneFormModal","FormSteps","KneFormSteps","FormStepsModal","KneFormStepsModal","List","KneList","TableList","KneTableList","MultiField","KneMultiField","KneInputTyped","KneInput","InputWrapped","withNormalizedLabelTips","Input","TextArea","KneTextArea","Select","KneSelect","TreeSelect","KneTreeSelect","InputNumber","KneInputNumber","Switch","KneSwitch","RadioGroup","KneRadioGroup","SubmitButton","KneSubmitButton","ResetButton","KneResetButton","CancelButton","KneCancelButton"],"mappings":";;;;;AA0EO,MAAMA,IAAWC,GACXC,IAAOC,GACPC,IAAYC,GACZC,IAAYC,GACZC,IAAiBC,GAEjBC,IAAOC,GAMPC,IAAYC,GAKZC,IAAaC,GAGpBC,IAAgBC,GAChBC,IAAeC,EAAwBH,CAAa,GAC7CI,IAAQ,OAAO,OAAOF,GAAc;AAAA,EAC/C,UAAUC,EAAwBH,EAAc,QAAQ;AAC1D,CAAC,GAEYK,IAAWF;AAAA,EACtBG;AACF,GACaC,IAASJ;AAAA,EACpBK;AACF,GACaC,IAAaN;AAAA,EACxBO;AACF,GACaC,IAAcR;AAAA,EACzBS;AACF,GACaC,IAASV;AAAA,EACpBW;AACF,GACaC,IAAaZ;AAAA,EACxBa;AACF,GAEaC,IAAeC,GACfC,IAAcC,GACdC,IAAeC;"}
@@ -0,0 +1,14 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+ /**
3
+ * kne 原生会把字符串 `labelTips` 直接拼进 label 旁正文。
4
+ * core 约定:字符串 / 数字 → Info + TooltipInfo(悬停说明);
5
+ * 已是 ReactNode / function → 原样透传(业务可自定义)。
6
+ * 必填仍用 `rule="REQ"`,不要把「必填/选填」写进 tip。
7
+ */
8
+ export declare function normalizeLabelTips(labelTips: unknown): ReactNode | undefined;
9
+ type WithLabelTips = {
10
+ labelTips?: unknown;
11
+ };
12
+ /** 包装 kne 字段:拦截 labelTips 字符串并规范化 */
13
+ export declare function withNormalizedLabelTips<P extends WithLabelTips>(Comp: ComponentType<P>): ComponentType<P>;
14
+ export {};
@@ -0,0 +1,40 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import s from "../TooltipInfo/TooltipInfo.js";
3
+ import { Info as f } from "../Icons/Info.js";
4
+ function l(t) {
5
+ if (!(t == null || t === !1)) {
6
+ if (typeof t == "string" || typeof t == "number") {
7
+ const i = String(t).trim();
8
+ return i ? /* @__PURE__ */ r(
9
+ s,
10
+ {
11
+ type: "note",
12
+ note: { title: "说明", description: i },
13
+ minWidth: 220,
14
+ maxWidth: 360,
15
+ children: /* @__PURE__ */ r(
16
+ f,
17
+ {
18
+ size: 14,
19
+ "aria-label": "说明",
20
+ style: { marginLeft: 4, cursor: "pointer", verticalAlign: "-2px" }
21
+ }
22
+ )
23
+ }
24
+ ) : void 0;
25
+ }
26
+ return t;
27
+ }
28
+ }
29
+ function u(t) {
30
+ const i = (o) => {
31
+ const { labelTips: a, ...m } = o, e = l(a);
32
+ return /* @__PURE__ */ r(t, { ...m, ...e !== void 0 ? { labelTips: e } : {} });
33
+ }, n = t.displayName || t.name || "Field";
34
+ return i.displayName = `WithNormalizedLabelTips(${n})`, i;
35
+ }
36
+ export {
37
+ l as normalizeLabelTips,
38
+ u as withNormalizedLabelTips
39
+ };
40
+ //# sourceMappingURL=normalizeLabelTips.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeLabelTips.js","sources":["../../../src/components/Form/normalizeLabelTips.tsx"],"sourcesContent":["import type { ComponentType, ReactNode } from 'react';\nimport { Info } from '@/components/Icons';\nimport { TooltipInfo } from '@/components/TooltipInfo';\n\n/**\n * kne 原生会把字符串 `labelTips` 直接拼进 label 旁正文。\n * core 约定:字符串 / 数字 → Info + TooltipInfo(悬停说明);\n * 已是 ReactNode / function → 原样透传(业务可自定义)。\n * 必填仍用 `rule=\"REQ\"`,不要把「必填/选填」写进 tip。\n */\nexport function normalizeLabelTips(labelTips: unknown): ReactNode | undefined {\n if (labelTips == null || labelTips === false) {\n return undefined;\n }\n if (typeof labelTips === 'string' || typeof labelTips === 'number') {\n const text = String(labelTips).trim();\n if (!text) {\n return undefined;\n }\n return (\n <TooltipInfo\n type=\"note\"\n note={{ title: '说明', description: text }}\n minWidth={220}\n maxWidth={360}\n >\n <Info\n size={14}\n aria-label=\"说明\"\n style={{ marginLeft: 4, cursor: 'pointer', verticalAlign: '-2px' }}\n />\n </TooltipInfo>\n );\n }\n return labelTips as ReactNode;\n}\n\ntype WithLabelTips = { labelTips?: unknown };\n\n/** 包装 kne 字段:拦截 labelTips 字符串并规范化 */\nexport function withNormalizedLabelTips<P extends WithLabelTips>(\n Comp: ComponentType<P>,\n): ComponentType<P> {\n const Wrapped = (props: P) => {\n const { labelTips, ...rest } = props;\n const next = normalizeLabelTips(labelTips);\n return <Comp {...(rest as P)} {...(next !== undefined ? { labelTips: next } : {})} />;\n };\n const name = Comp.displayName || Comp.name || 'Field';\n Wrapped.displayName = `WithNormalizedLabelTips(${name})`;\n return Wrapped;\n}\n"],"names":["normalizeLabelTips","labelTips","text","jsx","TooltipInfo","Info","withNormalizedLabelTips","Comp","Wrapped","props","rest","next","name"],"mappings":";;;AAUO,SAASA,EAAmBC,GAA2C;AAC5E,MAAI,EAAAA,KAAa,QAAQA,MAAc,KAGvC;AAAA,QAAI,OAAOA,KAAc,YAAY,OAAOA,KAAc,UAAU;AAClE,YAAMC,IAAO,OAAOD,CAAS,EAAE,KAAA;AAC/B,aAAKC,IAIH,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,MAAM,EAAE,OAAO,MAAM,aAAaF,EAAA;AAAA,UAClC,UAAU;AAAA,UACV,UAAU;AAAA,UAEV,UAAA,gBAAAC;AAAA,YAACE;AAAA,YAAA;AAAA,cACC,MAAM;AAAA,cACN,cAAW;AAAA,cACX,OAAO,EAAE,YAAY,GAAG,QAAQ,WAAW,eAAe,OAAA;AAAA,YAAO;AAAA,UAAA;AAAA,QACnE;AAAA,MAAA,IAbF;AAAA,IAgBJ;AACA,WAAOJ;AAAA;AACT;AAKO,SAASK,EACdC,GACkB;AAClB,QAAMC,IAAU,CAACC,MAAa;AAC5B,UAAM,EAAE,WAAAR,GAAW,GAAGS,EAAA,IAASD,GACzBE,IAAOX,EAAmBC,CAAS;AACzC,WAAO,gBAAAE,EAACI,GAAA,EAAM,GAAIG,GAAa,GAAIC,MAAS,SAAY,EAAE,WAAWA,EAAA,IAAS,CAAA,EAAC,CAAI;AAAA,EACrF,GACMC,IAAOL,EAAK,eAAeA,EAAK,QAAQ;AAC9C,SAAAC,EAAQ,cAAc,2BAA2BI,CAAI,KAC9CJ;AACT;"}
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { PageShellActionItem } from '../PageShell';
2
3
  export type ModulePageShellProps = {
3
4
  title?: string;
4
5
  description?: ReactNode;
@@ -8,7 +9,7 @@ export type ModulePageShellProps = {
8
9
  spinning?: boolean;
9
10
  /** 是否同步 title/description/actions 到 PageShellProvider(App 顶栏),默认 true */
10
11
  syncPageMeta?: boolean;
11
- actions?: Record<string, unknown>[];
12
+ actions?: PageShellActionItem[];
12
13
  children?: ReactNode;
13
14
  className?: string;
14
15
  bodyClassName?: string;
@@ -27,13 +27,7 @@ const w = ({
27
27
  }, [m, r, i, n, a]), /* @__PURE__ */ h("div", { className: l("module-page-shell", o["module-page-shell"], t), children: [
28
28
  s ? /* @__PURE__ */ e("div", { className: l("module-page-breadcrumb", o["module-page-breadcrumb"]), children: s }) : null,
29
29
  d ? /* @__PURE__ */ e("div", { className: l("module-page-toolbar", o["module-page-toolbar"]), children: d }) : null,
30
- /* @__PURE__ */ e(
31
- "div",
32
- {
33
- className: l("module-page-body", o["module-page-body"], g),
34
- children: /* @__PURE__ */ e(N, { spinning: f, children: p })
35
- }
36
- )
30
+ /* @__PURE__ */ e("div", { className: l("module-page-body", o["module-page-body"], g), children: /* @__PURE__ */ e(N, { spinning: f, children: p }) })
37
31
  ] });
38
32
  };
39
33
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Layout/ModulePageShell/index.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport type { ReactNode } from 'react';\nimport { useEffect } from 'react';\nimport PageSpin from '../PageSpin';\nimport { usePageShell } from '../PageShell';\nimport styles from './style.module.scss';\n\nexport type ModulePageShellProps = {\n title?: string;\n description?: ReactNode;\n breadcrumb?: ReactNode;\n toolbar?: ReactNode;\n /** 页面级 loading,与 usePageShellLoading 注册的 ctx loading 合并 */\n spinning?: boolean;\n /** 是否同步 title/description/actions 到 PageShellProvider(App 顶栏),默认 true */\n syncPageMeta?: boolean;\n actions?: Record<string, unknown>[];\n children?: ReactNode;\n className?: string;\n bodyClassName?: string;\n};\n\nconst ModulePageShell: React.FC<ModulePageShellProps> = ({\n title,\n description,\n breadcrumb,\n toolbar,\n spinning = false,\n syncPageMeta = true,\n actions,\n children,\n className,\n bodyClassName,\n}) => {\n const { setPageMeta, pageLoading: ctxLoading } = usePageShell();\n const showSpinning = Boolean(spinning || ctxLoading);\n\n useEffect(() => {\n if (!syncPageMeta) return;\n setPageMeta({\n title,\n description,\n actionItems: actions,\n });\n return () => setPageMeta({});\n }, [title, description, actions, syncPageMeta, setPageMeta]);\n\n return (\n <div className={classNames('module-page-shell', styles['module-page-shell'], className)}>\n {breadcrumb ? (\n <div className={classNames('module-page-breadcrumb', styles['module-page-breadcrumb'])}>\n {breadcrumb}\n </div>\n ) : null}\n\n {toolbar ? (\n <div className={classNames('module-page-toolbar', styles['module-page-toolbar'])}>\n {toolbar}\n </div>\n ) : null}\n\n <div\n className={classNames('module-page-body', styles['module-page-body'], bodyClassName)}\n >\n <PageSpin spinning={showSpinning}>{children}</PageSpin>\n </div>\n </div>\n );\n};\n\nexport default ModulePageShell;\n"],"names":["ModulePageShell","title","description","breadcrumb","toolbar","spinning","syncPageMeta","actions","children","className","bodyClassName","setPageMeta","ctxLoading","usePageShell","showSpinning","useEffect","jsxs","classNames","styles","jsx","PageSpin"],"mappings":";;;;;;AAsBA,MAAMA,IAAkD,CAAC;AAAA,EACvD,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,cAAAC,IAAe;AAAA,EACf,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AACF,MAAM;AACJ,QAAM,EAAE,aAAAC,GAAa,aAAaC,EAAA,IAAeC,EAAA,GAC3CC,IAAe,GAAQT,KAAYO;AAEzC,SAAAG,EAAU,MAAM;AACd,QAAKT;AACL,aAAAK,EAAY;AAAA,QACV,OAAAV;AAAA,QACA,aAAAC;AAAA,QACA,aAAaK;AAAA,MAAA,CACd,GACM,MAAMI,EAAY,EAAE;AAAA,EAC7B,GAAG,CAACV,GAAOC,GAAaK,GAASD,GAAcK,CAAW,CAAC,GAGzD,gBAAAK,EAAC,SAAI,WAAWC,EAAW,qBAAqBC,EAAO,mBAAmB,GAAGT,CAAS,GACnF,UAAA;AAAA,IAAAN,IACC,gBAAAgB,EAAC,OAAA,EAAI,WAAWF,EAAW,0BAA0BC,EAAO,wBAAwB,CAAC,GAClF,UAAAf,EAAA,CACH,IACE;AAAA,IAEHC,IACC,gBAAAe,EAAC,OAAA,EAAI,WAAWF,EAAW,uBAAuBC,EAAO,qBAAqB,CAAC,GAC5E,UAAAd,EAAA,CACH,IACE;AAAA,IAEJ,gBAAAe;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWF,EAAW,oBAAoBC,EAAO,kBAAkB,GAAGR,CAAa;AAAA,QAEnF,UAAA,gBAAAS,EAACC,GAAA,EAAS,UAAUN,GAAe,UAAAN,EAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAC9C,GACF;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Layout/ModulePageShell/index.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport type { ReactNode } from 'react';\nimport { useEffect } from 'react';\nimport PageSpin from '../PageSpin';\nimport { usePageShell, type PageShellActionItem } from '../PageShell';\nimport styles from './style.module.scss';\n\nexport type ModulePageShellProps = {\n title?: string;\n description?: ReactNode;\n breadcrumb?: ReactNode;\n toolbar?: ReactNode;\n /** 页面级 loading,与 usePageShellLoading 注册的 ctx loading 合并 */\n spinning?: boolean;\n /** 是否同步 title/description/actions 到 PageShellProvider(App 顶栏),默认 true */\n syncPageMeta?: boolean;\n actions?: PageShellActionItem[];\n children?: ReactNode;\n className?: string;\n bodyClassName?: string;\n};\n\nconst ModulePageShell: React.FC<ModulePageShellProps> = ({\n title,\n description,\n breadcrumb,\n toolbar,\n spinning = false,\n syncPageMeta = true,\n actions,\n children,\n className,\n bodyClassName,\n}) => {\n const { setPageMeta, pageLoading: ctxLoading } = usePageShell();\n const showSpinning = Boolean(spinning || ctxLoading);\n\n useEffect(() => {\n if (!syncPageMeta) return;\n setPageMeta({\n title,\n description,\n actionItems: actions,\n });\n return () => setPageMeta({});\n }, [title, description, actions, syncPageMeta, setPageMeta]);\n\n return (\n <div className={classNames('module-page-shell', styles['module-page-shell'], className)}>\n {breadcrumb ? (\n <div className={classNames('module-page-breadcrumb', styles['module-page-breadcrumb'])}>\n {breadcrumb}\n </div>\n ) : null}\n\n {toolbar ? (\n <div className={classNames('module-page-toolbar', styles['module-page-toolbar'])}>\n {toolbar}\n </div>\n ) : null}\n\n <div className={classNames('module-page-body', styles['module-page-body'], bodyClassName)}>\n <PageSpin spinning={showSpinning}>{children}</PageSpin>\n </div>\n </div>\n );\n};\n\nexport default ModulePageShell;\n"],"names":["ModulePageShell","title","description","breadcrumb","toolbar","spinning","syncPageMeta","actions","children","className","bodyClassName","setPageMeta","ctxLoading","usePageShell","showSpinning","useEffect","jsxs","classNames","styles","jsx","PageSpin"],"mappings":";;;;;;AAsBA,MAAMA,IAAkD,CAAC;AAAA,EACvD,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,cAAAC,IAAe;AAAA,EACf,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AACF,MAAM;AACJ,QAAM,EAAE,aAAAC,GAAa,aAAaC,EAAA,IAAeC,EAAA,GAC3CC,IAAe,GAAQT,KAAYO;AAEzC,SAAAG,EAAU,MAAM;AACd,QAAKT;AACL,aAAAK,EAAY;AAAA,QACV,OAAAV;AAAA,QACA,aAAAC;AAAA,QACA,aAAaK;AAAA,MAAA,CACd,GACM,MAAMI,EAAY,EAAE;AAAA,EAC7B,GAAG,CAACV,GAAOC,GAAaK,GAASD,GAAcK,CAAW,CAAC,GAGzD,gBAAAK,EAAC,SAAI,WAAWC,EAAW,qBAAqBC,EAAO,mBAAmB,GAAGT,CAAS,GACnF,UAAA;AAAA,IAAAN,IACC,gBAAAgB,EAAC,OAAA,EAAI,WAAWF,EAAW,0BAA0BC,EAAO,wBAAwB,CAAC,GAClF,UAAAf,EAAA,CACH,IACE;AAAA,IAEHC,IACC,gBAAAe,EAAC,OAAA,EAAI,WAAWF,EAAW,uBAAuBC,EAAO,qBAAqB,CAAC,GAC5E,UAAAd,EAAA,CACH,IACE;AAAA,IAEJ,gBAAAe,EAAC,OAAA,EAAI,WAAWF,EAAW,oBAAoBC,EAAO,kBAAkB,GAAGR,CAAa,GACtF,UAAA,gBAAAS,EAACC,GAAA,EAAS,UAAUN,GAAe,UAAAN,GAAS,EAAA,CAC9C;AAAA,EAAA,GACF;AAEJ;"}
@@ -1,8 +1,15 @@
1
- import { ReactNode } from 'react';
1
+ import { Key, ReactNode } from 'react';
2
+ /** ButtonGroup list 项:对象配置 或 自定义渲染函数(如 Dropdown 主按钮) */
3
+ export type PageShellActionItem = Record<string, unknown> | ((props: {
4
+ className?: string;
5
+ key?: Key;
6
+ }, ctx?: {
7
+ isDropdown?: boolean;
8
+ }) => ReactNode);
2
9
  export type PageShellMeta = {
3
10
  title?: string;
4
11
  description?: ReactNode;
5
- actionItems?: Record<string, unknown>[];
12
+ actionItems?: PageShellActionItem[];
6
13
  };
7
14
  type PageShellContextValue = {
8
15
  meta: PageShellMeta;
@@ -1,39 +1,39 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { useState as g, useCallback as r, useMemo as d, useContext as m, useEffect as L, createContext as M } from "react";
3
- const c = {}, l = M({
4
- meta: c,
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { useState as c, useCallback as r, useMemo as m, useContext as L, useEffect as M, createContext as S } from "react";
3
+ const g = {}, u = S({
4
+ meta: g,
5
5
  setPageMeta: () => {
6
6
  },
7
7
  pageLoading: !1,
8
8
  setPageLoading: () => {
9
9
  }
10
10
  });
11
- function S() {
12
- return m(l);
11
+ function h() {
12
+ return L(u);
13
13
  }
14
- function p(t) {
15
- const { setPageLoading: e } = S();
16
- L(() => (e(t), () => e(!1)), [t, e]);
14
+ function p(o) {
15
+ const { setPageLoading: a } = h();
16
+ M(() => (a(o), () => a(!1)), [o, a]);
17
17
  }
18
- function C({ children: t }) {
19
- const [e, u] = g(c), [o, P] = g(!1), s = r((a) => {
20
- u(a);
21
- }, []), n = r((a) => {
22
- P(a);
23
- }, []), i = d(
18
+ function x({ children: o }) {
19
+ const [a, l] = c(g), [s, P] = c(!1), n = r((e) => {
20
+ l((t) => t.title === e.title && t.description === e.description && t.actionItems === e.actionItems ? t : e);
21
+ }, []), i = r((e) => {
22
+ P((t) => t === e ? t : e);
23
+ }, []), f = m(
24
24
  () => ({
25
- meta: e,
26
- setPageMeta: s,
27
- pageLoading: o,
28
- setPageLoading: n
25
+ meta: a,
26
+ setPageMeta: n,
27
+ pageLoading: s,
28
+ setPageLoading: i
29
29
  }),
30
- [e, s, o, n]
30
+ [a, n, s, i]
31
31
  );
32
- return /* @__PURE__ */ f(l.Provider, { value: i, children: t });
32
+ return /* @__PURE__ */ d(u.Provider, { value: f, children: o });
33
33
  }
34
34
  export {
35
- C as PageShellProvider,
36
- S as usePageShell,
35
+ x as PageShellProvider,
36
+ h as usePageShell,
37
37
  p as usePageShellLoading
38
38
  };
39
39
  //# sourceMappingURL=PageShellContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageShellContext.js","sources":["../../../../src/components/Layout/PageShell/PageShellContext.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\n\nexport type PageShellMeta = {\n title?: string;\n description?: ReactNode;\n actionItems?: Record<string, unknown>[];\n};\n\ntype PageShellContextValue = {\n meta: PageShellMeta;\n setPageMeta: (next: PageShellMeta) => void;\n pageLoading: boolean;\n setPageLoading: (loading: boolean) => void;\n};\n\nconst EMPTY_META: PageShellMeta = {};\n\nconst PageShellContext = createContext<PageShellContextValue>({\n meta: EMPTY_META,\n setPageMeta: () => {},\n pageLoading: false,\n setPageLoading: () => {},\n});\n\nexport function usePageShell() {\n return useContext(PageShellContext);\n}\n\n/** 深层子组件向 Layout body Spin 注册 loading(卸载时自动清除) */\nexport function usePageShellLoading(spinning: boolean) {\n const { setPageLoading } = usePageShell();\n useEffect(() => {\n setPageLoading(spinning);\n return () => setPageLoading(false);\n }, [spinning, setPageLoading]);\n}\n\nexport type PageShellProviderProps = {\n children: ReactNode;\n};\n\nexport function PageShellProvider({ children }: PageShellProviderProps) {\n const [meta, setMeta] = useState<PageShellMeta>(EMPTY_META);\n const [pageLoading, setPageLoadingState] = useState(false);\n\n const setPageMeta = useCallback((next: PageShellMeta) => {\n setMeta(next);\n }, []);\n\n const setPageLoading = useCallback((loading: boolean) => {\n setPageLoadingState(loading);\n }, []);\n\n const value = useMemo(\n () => ({\n meta,\n setPageMeta,\n pageLoading,\n setPageLoading,\n }),\n [meta, setPageMeta, pageLoading, setPageLoading],\n );\n\n return <PageShellContext.Provider value={value}>{children}</PageShellContext.Provider>;\n}\n"],"names":["EMPTY_META","PageShellContext","createContext","usePageShell","useContext","usePageShellLoading","spinning","setPageLoading","useEffect","PageShellProvider","children","meta","setMeta","useState","pageLoading","setPageLoadingState","setPageMeta","useCallback","next","loading","value","useMemo","jsx"],"mappings":";;AAgBA,MAAMA,IAA4B,CAAA,GAE5BC,IAAmBC,EAAqC;AAAA,EAC5D,MAAMF;AAAA,EACN,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,aAAa;AAAA,EACb,gBAAgB,MAAM;AAAA,EAAC;AACzB,CAAC;AAEM,SAASG,IAAe;AAC7B,SAAOC,EAAWH,CAAgB;AACpC;AAGO,SAASI,EAAoBC,GAAmB;AACrD,QAAM,EAAE,gBAAAC,EAAA,IAAmBJ,EAAA;AAC3B,EAAAK,EAAU,OACRD,EAAeD,CAAQ,GAChB,MAAMC,EAAe,EAAK,IAChC,CAACD,GAAUC,CAAc,CAAC;AAC/B;AAMO,SAASE,EAAkB,EAAE,UAAAC,KAAoC;AACtE,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAwBb,CAAU,GACpD,CAACc,GAAaC,CAAmB,IAAIF,EAAS,EAAK,GAEnDG,IAAcC,EAAY,CAACC,MAAwB;AACvD,IAAAN,EAAQM,CAAI;AAAA,EACd,GAAG,CAAA,CAAE,GAECX,IAAiBU,EAAY,CAACE,MAAqB;AACvD,IAAAJ,EAAoBI,CAAO;AAAA,EAC7B,GAAG,CAAA,CAAE,GAECC,IAAQC;AAAA,IACZ,OAAO;AAAA,MACL,MAAAV;AAAA,MACA,aAAAK;AAAA,MACA,aAAAF;AAAA,MACA,gBAAAP;AAAA,IAAA;AAAA,IAEF,CAACI,GAAMK,GAAaF,GAAaP,CAAc;AAAA,EAAA;AAGjD,SAAO,gBAAAe,EAACrB,EAAiB,UAAjB,EAA0B,OAAAmB,GAAe,UAAAV,EAAA,CAAS;AAC5D;"}
1
+ {"version":3,"file":"PageShellContext.js","sources":["../../../../src/components/Layout/PageShell/PageShellContext.tsx"],"sourcesContent":["import type { Key, ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\n\n/** ButtonGroup list 项:对象配置 或 自定义渲染函数(如 Dropdown 主按钮) */\nexport type PageShellActionItem =\n | Record<string, unknown>\n | ((props: { className?: string; key?: Key }, ctx?: { isDropdown?: boolean }) => ReactNode);\n\nexport type PageShellMeta = {\n title?: string;\n description?: ReactNode;\n actionItems?: PageShellActionItem[];\n};\n\ntype PageShellContextValue = {\n meta: PageShellMeta;\n setPageMeta: (next: PageShellMeta) => void;\n pageLoading: boolean;\n setPageLoading: (loading: boolean) => void;\n};\n\nconst EMPTY_META: PageShellMeta = {};\n\nconst PageShellContext = createContext<PageShellContextValue>({\n meta: EMPTY_META,\n setPageMeta: () => {},\n pageLoading: false,\n setPageLoading: () => {},\n});\n\nexport function usePageShell() {\n return useContext(PageShellContext);\n}\n\n/** 深层子组件向 Layout body Spin 注册 loading(卸载时自动清除) */\nexport function usePageShellLoading(spinning: boolean) {\n const { setPageLoading } = usePageShell();\n useEffect(() => {\n setPageLoading(spinning);\n return () => setPageLoading(false);\n }, [spinning, setPageLoading]);\n}\n\nexport type PageShellProviderProps = {\n children: ReactNode;\n};\n\nexport function PageShellProvider({ children }: PageShellProviderProps) {\n const [meta, setMeta] = useState<PageShellMeta>(EMPTY_META);\n const [pageLoading, setPageLoadingState] = useState(false);\n\n const setPageMeta = useCallback((next: PageShellMeta) => {\n setMeta((prev) => {\n if (\n prev.title === next.title &&\n prev.description === next.description &&\n prev.actionItems === next.actionItems\n ) {\n return prev;\n }\n return next;\n });\n }, []);\n\n const setPageLoading = useCallback((loading: boolean) => {\n setPageLoadingState((prev) => (prev === loading ? prev : loading));\n }, []);\n\n const value = useMemo(\n () => ({\n meta,\n setPageMeta,\n pageLoading,\n setPageLoading,\n }),\n [meta, setPageMeta, pageLoading, setPageLoading],\n );\n\n return <PageShellContext.Provider value={value}>{children}</PageShellContext.Provider>;\n}\n"],"names":["EMPTY_META","PageShellContext","createContext","usePageShell","useContext","usePageShellLoading","spinning","setPageLoading","useEffect","PageShellProvider","children","meta","setMeta","useState","pageLoading","setPageLoadingState","setPageMeta","useCallback","next","prev","loading","value","useMemo","jsx"],"mappings":";;AAqBA,MAAMA,IAA4B,CAAA,GAE5BC,IAAmBC,EAAqC;AAAA,EAC5D,MAAMF;AAAA,EACN,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,aAAa;AAAA,EACb,gBAAgB,MAAM;AAAA,EAAC;AACzB,CAAC;AAEM,SAASG,IAAe;AAC7B,SAAOC,EAAWH,CAAgB;AACpC;AAGO,SAASI,EAAoBC,GAAmB;AACrD,QAAM,EAAE,gBAAAC,EAAA,IAAmBJ,EAAA;AAC3B,EAAAK,EAAU,OACRD,EAAeD,CAAQ,GAChB,MAAMC,EAAe,EAAK,IAChC,CAACD,GAAUC,CAAc,CAAC;AAC/B;AAMO,SAASE,EAAkB,EAAE,UAAAC,KAAoC;AACtE,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAwBb,CAAU,GACpD,CAACc,GAAaC,CAAmB,IAAIF,EAAS,EAAK,GAEnDG,IAAcC,EAAY,CAACC,MAAwB;AACvD,IAAAN,EAAQ,CAACO,MAELA,EAAK,UAAUD,EAAK,SACpBC,EAAK,gBAAgBD,EAAK,eAC1BC,EAAK,gBAAgBD,EAAK,cAEnBC,IAEFD,CACR;AAAA,EACH,GAAG,CAAA,CAAE,GAECX,IAAiBU,EAAY,CAACG,MAAqB;AACvD,IAAAL,EAAoB,CAACI,MAAUA,MAASC,IAAUD,IAAOC,CAAQ;AAAA,EACnE,GAAG,CAAA,CAAE,GAECC,IAAQC;AAAA,IACZ,OAAO;AAAA,MACL,MAAAX;AAAA,MACA,aAAAK;AAAA,MACA,aAAAF;AAAA,MACA,gBAAAP;AAAA,IAAA;AAAA,IAEF,CAACI,GAAMK,GAAaF,GAAaP,CAAc;AAAA,EAAA;AAGjD,SAAO,gBAAAgB,EAACtB,EAAiB,UAAjB,EAA0B,OAAAoB,GAAe,UAAAX,EAAA,CAAS;AAC5D;"}
@@ -1,2 +1,2 @@
1
- export { PageShellProvider, usePageShell, usePageShellLoading, } from './PageShellContext';
2
- export type { PageShellMeta, PageShellProviderProps } from './PageShellContext';
1
+ export { PageShellProvider, usePageShell, usePageShellLoading } from './PageShellContext';
2
+ export type { PageShellMeta, PageShellProviderProps, PageShellActionItem, } from './PageShellContext';
@@ -3,7 +3,7 @@ export type { PageHeaderLayoutProps } from './PageHeaderLayout';
3
3
  export { default as PageSpin } from './PageSpin';
4
4
  export type { PageSpinProps } from './PageSpin';
5
5
  export { PageShellProvider, usePageShell, usePageShellLoading } from './PageShell';
6
- export type { PageShellMeta, PageShellProviderProps } from './PageShell';
6
+ export type { PageShellMeta, PageShellProviderProps, PageShellActionItem } from './PageShell';
7
7
  export { default as ModulePageShell } from './ModulePageShell';
8
8
  export type { ModulePageShellProps } from './ModulePageShell';
9
9
  export { AgentAppShell } from './AgentAppShell';
@@ -1,14 +1,29 @@
1
1
  import { TabsProps } from 'antd';
2
- import { CSSProperties, ReactNode } from 'react';
2
+ import { CSSProperties, MouseEvent, ReactNode } from 'react';
3
+ import { IconName } from '../Icons';
3
4
  import { DescriptionItem } from '../Descriptions/CommonDescriptions';
4
5
  export type StateBarType = 'tab' | 'radio' | 'step';
6
+ /** Tab 项旁操作(icon + 可选文案提示 + 点击) */
7
+ export type StateBarActionItem = {
8
+ /** Icons 注册表名,如 `Info` / `Plus` / `Pencil` */
9
+ iconType: IconName;
10
+ /** Tooltip 文案;缺省不包 Tooltip */
11
+ label?: string;
12
+ onClick?: (e: MouseEvent<HTMLElement>) => void;
13
+ disabled?: boolean;
14
+ className?: string;
15
+ /** 图标尺寸,默认 14 */
16
+ size?: number;
17
+ };
5
18
  export type StateBarOption = {
6
19
  key: string;
7
20
  /** 选项卡标题(优先于 label) */
8
21
  tab?: ReactNode;
9
22
  label?: ReactNode;
10
- /** 标题旁 Info + TooltipInfo(对齐 Modal/InteractiveBlock);为空不展示 icon */
23
+ /** 标题旁 Info + TooltipInfo(对齐 Modal/InteractiveBlock);为空不展示 */
11
24
  info?: DescriptionItem[];
25
+ /** 标题旁额外操作图标(可与 info 并存) */
26
+ actions?: StateBarActionItem[];
12
27
  children?: ReactNode;
13
28
  disabled?: boolean;
14
29
  className?: string;