@hkyhy/marsun-components-core 0.1.100 → 0.1.102
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/components/Editor/VariablePicker.js +13 -13
- package/dist/components/Editor/VariablePicker.js.map +1 -1
- package/dist/components/FormInfo/RichTextField/index.js +46 -69
- package/dist/components/FormInfo/RichTextField/index.js.map +1 -1
- package/dist/components/FormInfo/VariableMentionInput/index.d.ts +1 -0
- package/dist/components/FormInfo/VariableMentionInput/index.js +53 -47
- package/dist/components/FormInfo/VariableMentionInput/index.js.map +1 -1
- package/dist/components/FormInfo/VariableMentionInput/style.module.scss.js +6 -5
- package/dist/components/FormInfo/VariableMentionInput/style.module.scss.js.map +1 -1
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.d.ts +3 -0
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.js +59 -49
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.js.map +1 -1
- package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js +20 -18
- package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js.map +1 -1
- package/dist/components/Tools/Inbox/index.d.ts +1 -0
- package/dist/components/Tools/Inbox/sanitizeInboxHtml.d.ts +5 -0
- package/dist/components/Tools/Inbox/sanitizeInboxHtml.js +14 -0
- package/dist/components/Tools/Inbox/sanitizeInboxHtml.js.map +1 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.d.ts +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.js +3 -3
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/MessageTemplateAdmin.js +160 -145
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/MessageTemplateAdmin.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.js +100 -99
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/PushRulesPanel/index.d.ts +2 -2
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/PushRulesPanel/index.js +140 -129
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/PushRulesPanel/index.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/VariablesPanel/index.d.ts +2 -2
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/VariablesPanel/index.js +78 -78
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/VariablesPanel/index.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/index.d.ts +2 -2
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.d.ts +26 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.js +47 -19
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MsgCenterAppSwitcher/MsgCenterAppSwitcher.d.ts +22 -0
- package/dist/components/Tools/MessageCenter/MsgCenterAppSwitcher/MsgCenterAppSwitcher.js +64 -0
- package/dist/components/Tools/MessageCenter/MsgCenterAppSwitcher/MsgCenterAppSwitcher.js.map +1 -0
- package/dist/components/Tools/MessageCenter/MsgCenterAppSwitcher/index.d.ts +2 -0
- package/dist/components/Tools/MessageCenter/index.d.ts +7 -1
- package/dist/components/Tools/MessageCenter/msgCenterAppSwitch.d.ts +39 -0
- package/dist/components/Tools/MessageCenter/msgCenterAppSwitch.js +94 -0
- package/dist/components/Tools/MessageCenter/msgCenterAppSwitch.js.map +1 -0
- package/dist/components/Tools/MessageCenter/useMsgCenterAppKey.d.ts +2 -0
- package/dist/components/Tools/MessageCenter/useMsgCenterAppKey.js +18 -0
- package/dist/components/Tools/MessageCenter/useMsgCenterAppKey.js.map +1 -0
- package/dist/components/Tools/index.d.ts +3 -2
- package/dist/index.js +653 -636
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/node_modules/dompurify/dist/purify.es.js +908 -0
- package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -0
- package/dist/node_modules/isomorphic-dompurify/dist/browser.js +17 -0
- package/dist/node_modules/isomorphic-dompurify/dist/browser.js.map +1 -0
- package/dist/styles/global.css +1 -1
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as b, jsx as
|
|
1
|
+
import { jsxs as b, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { Dropdown as f, Button as h } from "antd";
|
|
3
3
|
import { useMemo as g } from "react";
|
|
4
4
|
import { filterVariableFeed as w } from "./variableMention.js";
|
|
@@ -8,12 +8,12 @@ const V = ({
|
|
|
8
8
|
disabled: i,
|
|
9
9
|
catalogError: r,
|
|
10
10
|
onPick: m,
|
|
11
|
-
buttonText:
|
|
12
|
-
size:
|
|
11
|
+
buttonText: d = "插入变量",
|
|
12
|
+
size: c = "middle",
|
|
13
13
|
className: p,
|
|
14
14
|
getPopupContainer: k
|
|
15
15
|
}) => {
|
|
16
|
-
const a = g(() => w(o, ""), [o]),
|
|
16
|
+
const a = g(() => w(o, ""), [o]), l = a.length === 0, s = r ? `目录失败:${r}` : l ? "暂无 catalog 变量" : void 0, u = l ? [
|
|
17
17
|
{
|
|
18
18
|
key: "__empty",
|
|
19
19
|
disabled: !0,
|
|
@@ -22,28 +22,28 @@ const V = ({
|
|
|
22
22
|
] : a.map((e) => ({
|
|
23
23
|
key: e.key,
|
|
24
24
|
label: /* @__PURE__ */ b("span", { className: n["var-mention-option"], children: [
|
|
25
|
-
e.label ? /* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
25
|
+
e.label ? /* @__PURE__ */ t("span", { className: n["var-mention-label"], children: e.label }) : null,
|
|
26
|
+
/* @__PURE__ */ t("span", { className: n["var-mention-token"], children: e.key })
|
|
27
27
|
] }),
|
|
28
28
|
onClick: () => m(e.key)
|
|
29
29
|
}));
|
|
30
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ t(
|
|
31
31
|
f,
|
|
32
32
|
{
|
|
33
|
-
disabled: i ||
|
|
33
|
+
disabled: i || l,
|
|
34
34
|
trigger: ["click"],
|
|
35
35
|
getPopupContainer: k,
|
|
36
|
-
dropdownRender: (e) => /* @__PURE__ */
|
|
36
|
+
dropdownRender: (e) => /* @__PURE__ */ t("div", { onMouseDown: (y) => y.preventDefault(), children: e }),
|
|
37
37
|
menu: { items: u },
|
|
38
|
-
children: /* @__PURE__ */
|
|
38
|
+
children: /* @__PURE__ */ t(
|
|
39
39
|
h,
|
|
40
40
|
{
|
|
41
41
|
type: "default",
|
|
42
|
-
size:
|
|
43
|
-
disabled: i ||
|
|
42
|
+
size: c,
|
|
43
|
+
disabled: i || l,
|
|
44
44
|
title: s,
|
|
45
45
|
className: p,
|
|
46
|
-
children:
|
|
46
|
+
children: d
|
|
47
47
|
}
|
|
48
48
|
)
|
|
49
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariablePicker.js","sources":["../../../src/components/Editor/VariablePicker.tsx"],"sourcesContent":["import { Button, Dropdown } from 'antd';\nimport type { MenuProps } from 'antd';\nimport React, { useMemo } from 'react';\nimport { filterVariableFeed, type VariableMentionItem } from './variableMention';\nimport styles from '../FormInfo/VariableMentionInput/style.module.scss';\n\nexport type VariablePickerProps = {\n variables?: VariableMentionItem[];\n disabled?: boolean;\n /** catalog 加载失败短文案;有值时优先于「暂无变量」 */\n catalogError?: string;\n onPick: (key: string) => void;\n /** 按钮文案,默认「插入变量」 */\n buttonText?: string;\n size?: 'small' | 'middle' | 'large';\n className?: string;\n getPopupContainer?: (node: HTMLElement) => HTMLElement;\n};\n\n/**\n * Coze/Dify 风格:点选插入变量(中文 + code)。无 `/` 触发。\n */\nexport const VariablePicker: React.FC<VariablePickerProps> = ({\n variables,\n disabled,\n catalogError,\n onPick,\n buttonText = '插入变量',\n size = '
|
|
1
|
+
{"version":3,"file":"VariablePicker.js","sources":["../../../src/components/Editor/VariablePicker.tsx"],"sourcesContent":["import { Button, Dropdown } from 'antd';\nimport type { MenuProps } from 'antd';\nimport React, { useMemo } from 'react';\nimport { filterVariableFeed, type VariableMentionItem } from './variableMention';\nimport styles from '../FormInfo/VariableMentionInput/style.module.scss';\n\nexport type VariablePickerProps = {\n variables?: VariableMentionItem[];\n disabled?: boolean;\n /** catalog 加载失败短文案;有值时优先于「暂无变量」 */\n catalogError?: string;\n onPick: (key: string) => void;\n /** 按钮文案,默认「插入变量」 */\n buttonText?: string;\n size?: 'small' | 'middle' | 'large';\n className?: string;\n getPopupContainer?: (node: HTMLElement) => HTMLElement;\n};\n\n/**\n * Coze/Dify 风格:点选插入变量(中文 + code)。无 `/` 触发。\n */\nexport const VariablePicker: React.FC<VariablePickerProps> = ({\n variables,\n disabled,\n catalogError,\n onPick,\n buttonText = '插入变量',\n size = 'middle',\n className,\n getPopupContainer,\n}) => {\n const list = useMemo(() => filterVariableFeed(variables, ''), [variables]);\n const empty = list.length === 0;\n const tip = catalogError ? `目录失败:${catalogError}` : empty ? '暂无 catalog 变量' : undefined;\n\n const items: MenuProps['items'] = empty\n ? [\n {\n key: '__empty',\n disabled: true,\n label: tip || '暂无变量',\n },\n ]\n : list.map((v) => ({\n key: v.key,\n label: (\n <span className={styles['var-mention-option']}>\n {v.label ? <span className={styles['var-mention-label']}>{v.label}</span> : null}\n <span className={styles['var-mention-token']}>{v.key}</span>\n </span>\n ),\n onClick: () => onPick(v.key),\n }));\n\n return (\n <Dropdown\n disabled={disabled || empty}\n trigger={['click']}\n getPopupContainer={getPopupContainer}\n dropdownRender={(menu) => <div onMouseDown={(e) => e.preventDefault()}>{menu}</div>}\n menu={{ items }}\n >\n <Button\n type=\"default\"\n size={size}\n disabled={disabled || empty}\n title={tip}\n className={className}\n >\n {buttonText}\n </Button>\n </Dropdown>\n );\n};\n\nexport default VariablePicker;\n"],"names":["VariablePicker","variables","disabled","catalogError","onPick","buttonText","size","className","getPopupContainer","list","useMemo","filterVariableFeed","empty","tip","items","v","jsxs","styles","jsx","Dropdown","menu","e","Button"],"mappings":";;;;;AAsBO,MAAMA,IAAgD,CAAC;AAAA,EAC5D,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,MAAAC,IAAO;AAAA,EACP,WAAAC;AAAA,EACA,mBAAAC;AACF,MAAM;AACJ,QAAMC,IAAOC,EAAQ,MAAMC,EAAmBV,GAAW,EAAE,GAAG,CAACA,CAAS,CAAC,GACnEW,IAAQH,EAAK,WAAW,GACxBI,IAAMV,IAAe,QAAQA,CAAY,KAAKS,IAAQ,kBAAkB,QAExEE,IAA4BF,IAC9B;AAAA,IACE;AAAA,MACE,KAAK;AAAA,MACL,UAAU;AAAA,MACV,OAAOC,KAAO;AAAA,IAAA;AAAA,EAChB,IAEFJ,EAAK,IAAI,CAACM,OAAO;AAAA,IACf,KAAKA,EAAE;AAAA,IACP,OACE,gBAAAC,EAAC,QAAA,EAAK,WAAWC,EAAO,oBAAoB,GACzC,UAAA;AAAA,MAAAF,EAAE,0BAAS,QAAA,EAAK,WAAWE,EAAO,mBAAmB,GAAI,UAAAF,EAAE,MAAA,CAAM,IAAU;AAAA,wBAC3E,QAAA,EAAK,WAAWE,EAAO,mBAAmB,GAAI,YAAE,IAAA,CAAI;AAAA,IAAA,GACvD;AAAA,IAEF,SAAS,MAAMb,EAAOW,EAAE,GAAG;AAAA,EAAA,EAC3B;AAEN,SACE,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,UAAUjB,KAAYU;AAAA,MACtB,SAAS,CAAC,OAAO;AAAA,MACjB,mBAAAJ;AAAA,MACA,gBAAgB,CAACY,MAAS,gBAAAF,EAAC,OAAA,EAAI,aAAa,CAACG,MAAMA,EAAE,eAAA,GAAmB,UAAAD,EAAA,CAAK;AAAA,MAC7E,MAAM,EAAE,OAAAN,EAAA;AAAA,MAER,UAAA,gBAAAI;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,MAAAhB;AAAA,UACA,UAAUJ,KAAYU;AAAA,UACtB,OAAOC;AAAA,UACP,WAAAN;AAAA,UAEC,UAAAF;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;"}
|
|
@@ -1,82 +1,59 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { Suspense as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
() => import("../../Editor/index.js").then((
|
|
8
|
-
),
|
|
9
|
-
value:
|
|
10
|
-
onChange:
|
|
11
|
-
disabled:
|
|
12
|
-
readOnly:
|
|
13
|
-
placeholder:
|
|
14
|
-
minHeight:
|
|
15
|
-
enableVariableMention:
|
|
16
|
-
variables:
|
|
17
|
-
catalogError:
|
|
18
|
-
className:
|
|
19
|
-
editorKey:
|
|
20
|
-
id:
|
|
21
|
-
}) => /* @__PURE__ */
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as p from "@kne/react-form-antd";
|
|
3
|
+
import R from "classnames";
|
|
4
|
+
import { Suspense as T, lazy as u } from "react";
|
|
5
|
+
import o from "./style.module.scss.js";
|
|
6
|
+
const N = u(
|
|
7
|
+
() => import("../../Editor/index.js").then((t) => ({ default: t.RichTextEditor }))
|
|
8
|
+
), F = ({
|
|
9
|
+
value: t = "",
|
|
10
|
+
onChange: r,
|
|
11
|
+
disabled: i,
|
|
12
|
+
readOnly: s,
|
|
13
|
+
placeholder: m,
|
|
14
|
+
minHeight: d = 140,
|
|
15
|
+
enableVariableMention: a,
|
|
16
|
+
variables: n,
|
|
17
|
+
catalogError: l,
|
|
18
|
+
className: h,
|
|
19
|
+
editorKey: f,
|
|
20
|
+
id: x
|
|
21
|
+
}) => /* @__PURE__ */ e(
|
|
22
22
|
"div",
|
|
23
23
|
{
|
|
24
|
-
className:
|
|
24
|
+
className: R(
|
|
25
25
|
"marsun-form-rich-text",
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
o["form-rich-text"],
|
|
27
|
+
i && o["form-rich-text-disabled"],
|
|
28
|
+
h
|
|
29
29
|
),
|
|
30
|
-
"data-field-id":
|
|
31
|
-
children: /* @__PURE__ */
|
|
32
|
-
|
|
30
|
+
"data-field-id": x,
|
|
31
|
+
children: /* @__PURE__ */ e(T, { fallback: /* @__PURE__ */ e("div", { className: o["form-rich-text-loading"], children: "加载编辑器…" }), children: /* @__PURE__ */ e(
|
|
32
|
+
N,
|
|
33
33
|
{
|
|
34
|
-
value:
|
|
35
|
-
onChange:
|
|
36
|
-
disabled:
|
|
37
|
-
readOnly:
|
|
38
|
-
placeholder:
|
|
39
|
-
minHeight:
|
|
40
|
-
enableVariableMention:
|
|
41
|
-
variables:
|
|
42
|
-
catalogError:
|
|
34
|
+
value: t,
|
|
35
|
+
onChange: r,
|
|
36
|
+
disabled: i,
|
|
37
|
+
readOnly: s,
|
|
38
|
+
placeholder: m,
|
|
39
|
+
minHeight: d,
|
|
40
|
+
enableVariableMention: a,
|
|
41
|
+
variables: n,
|
|
42
|
+
catalogError: l
|
|
43
43
|
},
|
|
44
|
-
|
|
44
|
+
f || "rte"
|
|
45
45
|
) })
|
|
46
46
|
}
|
|
47
|
-
),
|
|
48
|
-
const { useDecorator:
|
|
49
|
-
|
|
50
|
-
catalogError: o,
|
|
51
|
-
placeholder: a,
|
|
52
|
-
className: c,
|
|
53
|
-
enableVariableMention: s,
|
|
54
|
-
readOnly: l,
|
|
55
|
-
minHeight: n,
|
|
56
|
-
editorKey: d,
|
|
57
|
-
...m
|
|
58
|
-
} = e;
|
|
59
|
-
return i({
|
|
47
|
+
), c = (t) => {
|
|
48
|
+
const { useDecorator: r } = p.hooks;
|
|
49
|
+
return r({
|
|
60
50
|
fieldName: "richTextEditor",
|
|
61
|
-
...
|
|
62
|
-
})(
|
|
63
|
-
b,
|
|
64
|
-
{
|
|
65
|
-
...p,
|
|
66
|
-
variables: t,
|
|
67
|
-
catalogError: o,
|
|
68
|
-
placeholder: a,
|
|
69
|
-
className: c,
|
|
70
|
-
enableVariableMention: s,
|
|
71
|
-
readOnly: l,
|
|
72
|
-
minHeight: n,
|
|
73
|
-
editorKey: d
|
|
74
|
-
}
|
|
75
|
-
));
|
|
51
|
+
...t
|
|
52
|
+
})(F);
|
|
76
53
|
};
|
|
77
|
-
|
|
78
|
-
const
|
|
54
|
+
c.displayName = "RichTextField";
|
|
55
|
+
const b = c;
|
|
79
56
|
export {
|
|
80
|
-
|
|
57
|
+
b as RichTextField
|
|
81
58
|
};
|
|
82
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/FormInfo/RichTextField/index.tsx"],"sourcesContent":["import * as ReactFormAntd from '@kne/react-form-antd';\nimport classNames from 'classnames';\nimport type { ComponentType, FC, ReactNode } from 'react';\nimport { Suspense, lazy } from 'react';\nimport type { VariableMentionItem } from '@/components/Editor/variableMention';\nimport styles from './style.module.scss';\n\nconst RichTextEditor = lazy(() =>\n import('@/components/Editor').then((m) => ({ default: m.RichTextEditor })),\n);\n\nexport type RichTextFieldProps = {\n name: string;\n label?: ReactNode;\n labelTips?: ReactNode | ((props: RichTextFieldProps) => ReactNode);\n rule?: string;\n disabled?: boolean;\n readOnly?: boolean;\n placeholder?: string;\n minHeight?: number;\n enableVariableMention?: boolean;\n variables?: VariableMentionItem[];\n catalogError?: string;\n className?: string;\n /** remount 键(换文档时传入) */\n editorKey?: string;\n [key: string]: unknown;\n};\n\ntype FieldRenderProps = {\n value?: string;\n onChange?: (v: string) => void;\n disabled?: boolean;\n id?: string;\n};\n\ntype KneHooks = {\n useDecorator: (\n opts: Record<string, unknown>,\n ) => (Comp: ComponentType<FieldRenderProps>) => ReactNode;\n};\n\n/**\n * FormInfo 富文本字段:外观对齐 Input;L2 Editor 懒加载;「插入变量」+ 原子色块。\n */\nconst RichTextControl: FC
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/FormInfo/RichTextField/index.tsx"],"sourcesContent":["import * as ReactFormAntd from '@kne/react-form-antd';\nimport classNames from 'classnames';\nimport type { ComponentType, FC, ReactNode } from 'react';\nimport { Suspense, lazy } from 'react';\nimport type { VariableMentionItem } from '@/components/Editor/variableMention';\nimport styles from './style.module.scss';\n\nconst RichTextEditor = lazy(() =>\n import('@/components/Editor').then((m) => ({ default: m.RichTextEditor })),\n);\n\nexport type RichTextFieldProps = {\n name: string;\n label?: ReactNode;\n labelTips?: ReactNode | ((props: RichTextFieldProps) => ReactNode);\n rule?: string;\n disabled?: boolean;\n readOnly?: boolean;\n placeholder?: string;\n minHeight?: number;\n enableVariableMention?: boolean;\n variables?: VariableMentionItem[];\n catalogError?: string;\n className?: string;\n /** remount 键(换文档时传入) */\n editorKey?: string;\n [key: string]: unknown;\n};\n\ntype FieldRenderProps = {\n value?: string;\n onChange?: (v: string) => void;\n disabled?: boolean;\n id?: string;\n readOnly?: boolean;\n placeholder?: string;\n minHeight?: number;\n enableVariableMention?: boolean;\n variables?: VariableMentionItem[];\n catalogError?: string;\n className?: string;\n editorKey?: string;\n};\n\ntype KneHooks = {\n useDecorator: (\n opts: Record<string, unknown>,\n ) => (Comp: ComponentType<FieldRenderProps>) => ReactNode;\n};\n\n/**\n * FormInfo 富文本字段:外观对齐 Input;L2 Editor 懒加载;「插入变量」+ 原子色块。\n * 须作为稳定组件类型交给 useDecorator(禁内联函数,否则每键 remount 丢焦)。\n */\nconst RichTextControl: FC<FieldRenderProps> = ({\n value = '',\n onChange,\n disabled,\n readOnly,\n placeholder,\n minHeight = 140,\n enableVariableMention,\n variables,\n catalogError,\n className,\n editorKey,\n id,\n}) => (\n <div\n className={classNames(\n 'marsun-form-rich-text',\n styles['form-rich-text'],\n disabled && styles['form-rich-text-disabled'],\n className,\n )}\n data-field-id={id}\n >\n <Suspense fallback={<div className={styles['form-rich-text-loading']}>加载编辑器…</div>}>\n <RichTextEditor\n key={editorKey || 'rte'}\n value={value}\n onChange={onChange}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n minHeight={minHeight}\n enableVariableMention={enableVariableMention}\n variables={variables}\n catalogError={catalogError}\n />\n </Suspense>\n </div>\n);\n\nconst RichTextFieldInner: FC<RichTextFieldProps> = (props) => {\n const { useDecorator } = (ReactFormAntd as unknown as { hooks: KneHooks }).hooks;\n const render = useDecorator({\n fieldName: 'richTextEditor',\n ...props,\n });\n return render(RichTextControl);\n};\n\nRichTextFieldInner.displayName = 'RichTextField';\n\nexport const RichTextField = RichTextFieldInner as ComponentType<RichTextFieldProps>;\n\nexport default RichTextField;\n"],"names":["RichTextEditor","lazy","m","RichTextControl","value","onChange","disabled","readOnly","placeholder","minHeight","enableVariableMention","variables","catalogError","className","editorKey","id","jsx","classNames","styles","Suspense","RichTextFieldInner","props","useDecorator","ReactFormAntd","RichTextField"],"mappings":";;;;;AAOA,MAAMA,IAAiBC;AAAA,EAAK,MAC1B,OAAO,uBAAqB,EAAE,KAAK,CAACC,OAAO,EAAE,SAASA,EAAE,iBAAiB;AAC3E,GA6CMC,IAAwC,CAAC;AAAA,EAC7C,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,uBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC;AACF,MACE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACT;AAAA,MACAC,EAAO,gBAAgB;AAAA,MACvBZ,KAAYY,EAAO,yBAAyB;AAAA,MAC5CL;AAAA,IAAA;AAAA,IAEF,iBAAeE;AAAA,IAEf,UAAA,gBAAAC,EAACG,GAAA,EAAS,UAAU,gBAAAH,EAAC,OAAA,EAAI,WAAWE,EAAO,wBAAwB,GAAG,UAAA,SAAA,CAAM,GAC1E,UAAA,gBAAAF;AAAA,MAAChB;AAAA,MAAA;AAAA,QAEC,OAAAI;AAAA,QACA,UAAAC;AAAA,QACA,UAAAC;AAAA,QACA,UAAAC;AAAA,QACA,aAAAC;AAAA,QACA,WAAAC;AAAA,QACA,uBAAAC;AAAA,QACA,WAAAC;AAAA,QACA,cAAAC;AAAA,MAAA;AAAA,MATKE,KAAa;AAAA,IAAA,EAUpB,CACF;AAAA,EAAA;AACF,GAGIM,IAA6C,CAACC,MAAU;AAC5D,QAAM,EAAE,cAAAC,MAAkBC,EAAiD;AAK3E,SAJeD,EAAa;AAAA,IAC1B,WAAW;AAAA,IACX,GAAGD;AAAA,EAAA,CACJ,EACalB,CAAe;AAC/B;AAEAiB,EAAmB,cAAc;AAE1B,MAAMI,IAAgBJ;"}
|
|
@@ -11,6 +11,7 @@ export type VariableMentionFieldProps = {
|
|
|
11
11
|
variables?: VariableMentionItem[];
|
|
12
12
|
catalogError?: string;
|
|
13
13
|
className?: string;
|
|
14
|
+
size?: 'small' | 'middle' | 'large';
|
|
14
15
|
[key: string]: unknown;
|
|
15
16
|
};
|
|
16
17
|
export declare const VariableMentionField: ComponentType<VariableMentionFieldProps>;
|
|
@@ -1,73 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { useRef as
|
|
1
|
+
import { jsxs as V, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import * as v from "@kne/react-form-antd";
|
|
3
|
+
import { Input as x } from "antd";
|
|
4
|
+
import M from "classnames";
|
|
5
|
+
import { useRef as p } from "react";
|
|
6
6
|
import { insertVarTokenAt as y } from "../../Editor/variableMention.js";
|
|
7
|
-
import { VariablePicker as
|
|
8
|
-
import
|
|
9
|
-
const g = ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import { VariablePicker as R } from "../../Editor/VariablePicker.js";
|
|
8
|
+
import i from "./style.module.scss.js";
|
|
9
|
+
const g = ({
|
|
10
|
+
value: o = "",
|
|
11
|
+
onChange: e,
|
|
12
|
+
onBlur: c,
|
|
13
|
+
disabled: s,
|
|
14
|
+
variables: f,
|
|
15
|
+
catalogError: d,
|
|
16
|
+
placeholder: k,
|
|
17
|
+
className: S,
|
|
18
|
+
id: b,
|
|
19
|
+
size: a = "middle"
|
|
20
|
+
}) => {
|
|
21
|
+
const n = p(String(o || "").length), m = p(null), N = (t) => {
|
|
22
|
+
const r = y(String(o || ""), t, n.current);
|
|
23
|
+
e == null || e(r), n.current = n.current + `{{${t}}}`.length;
|
|
13
24
|
};
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
|
|
25
|
+
return /* @__PURE__ */ V("div", { ref: m, className: i["var-mention-wrap"], children: [
|
|
26
|
+
/* @__PURE__ */ l(
|
|
27
|
+
x,
|
|
17
28
|
{
|
|
18
|
-
id:
|
|
29
|
+
id: b,
|
|
30
|
+
size: a,
|
|
19
31
|
value: o,
|
|
20
|
-
disabled:
|
|
21
|
-
placeholder:
|
|
22
|
-
className:
|
|
32
|
+
disabled: s,
|
|
33
|
+
placeholder: k || "点右侧「插入变量」,或手打 {{key}}",
|
|
34
|
+
className: M("marsun-var-mention-input", i["var-mention-input"], S),
|
|
35
|
+
onBlur: c,
|
|
23
36
|
onChange: (t) => {
|
|
24
37
|
const r = t.target.value;
|
|
25
|
-
|
|
38
|
+
n.current = t.target.selectionStart ?? r.length, e == null || e(r);
|
|
26
39
|
},
|
|
27
40
|
onSelect: (t) => {
|
|
28
41
|
const r = t.target;
|
|
29
|
-
|
|
42
|
+
n.current = r.selectionStart ?? -1;
|
|
30
43
|
},
|
|
31
44
|
onClick: (t) => {
|
|
32
45
|
const r = t.target;
|
|
33
|
-
|
|
46
|
+
n.current = r.selectionStart ?? -1;
|
|
34
47
|
},
|
|
35
48
|
onKeyUp: (t) => {
|
|
36
49
|
const r = t.target;
|
|
37
|
-
|
|
50
|
+
n.current = r.selectionStart ?? -1;
|
|
38
51
|
}
|
|
39
52
|
}
|
|
40
53
|
),
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
|
|
54
|
+
/* @__PURE__ */ l(
|
|
55
|
+
R,
|
|
43
56
|
{
|
|
44
|
-
variables:
|
|
45
|
-
catalogError:
|
|
46
|
-
disabled:
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
variables: f,
|
|
58
|
+
catalogError: d,
|
|
59
|
+
disabled: s,
|
|
60
|
+
size: a,
|
|
61
|
+
className: i["var-mention-picker"],
|
|
62
|
+
getPopupContainer: () => m.current || document.body,
|
|
63
|
+
onPick: N
|
|
49
64
|
}
|
|
50
65
|
)
|
|
51
|
-
] })
|
|
52
|
-
},
|
|
53
|
-
const { useDecorator:
|
|
54
|
-
return
|
|
66
|
+
] });
|
|
67
|
+
}, u = (o) => {
|
|
68
|
+
const { useDecorator: e } = v.hooks;
|
|
69
|
+
return e({
|
|
55
70
|
fieldName: "variableMentionInput",
|
|
56
|
-
...
|
|
57
|
-
})(
|
|
58
|
-
g,
|
|
59
|
-
{
|
|
60
|
-
...e,
|
|
61
|
-
variables: c,
|
|
62
|
-
catalogError: a,
|
|
63
|
-
placeholder: s,
|
|
64
|
-
className: l
|
|
65
|
-
}
|
|
66
|
-
));
|
|
71
|
+
...o
|
|
72
|
+
})(g);
|
|
67
73
|
};
|
|
68
|
-
|
|
69
|
-
const
|
|
74
|
+
u.displayName = "VariableMentionField";
|
|
75
|
+
const K = u;
|
|
70
76
|
export {
|
|
71
|
-
|
|
77
|
+
K as VariableMentionField
|
|
72
78
|
};
|
|
73
79
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/FormInfo/VariableMentionInput/index.tsx"],"sourcesContent":["import * as ReactFormAntd from '@kne/react-form-antd';\nimport { Input
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/FormInfo/VariableMentionInput/index.tsx"],"sourcesContent":["import * as ReactFormAntd from '@kne/react-form-antd';\nimport { Input } from 'antd';\nimport classNames from 'classnames';\nimport type { ComponentType, FC, ReactNode } from 'react';\nimport { useRef } from 'react';\nimport { insertVarTokenAt, type VariableMentionItem } from '@/components/Editor/variableMention';\nimport { VariablePicker } from '@/components/Editor/VariablePicker';\nimport styles from './style.module.scss';\n\nexport type VariableMentionFieldProps = {\n name: string;\n label?: ReactNode;\n labelTips?: ReactNode | ((props: VariableMentionFieldProps) => ReactNode);\n rule?: string;\n disabled?: boolean;\n placeholder?: string;\n enableVariableMention?: boolean;\n variables?: VariableMentionItem[];\n catalogError?: string;\n className?: string;\n size?: 'small' | 'middle' | 'large';\n [key: string]: unknown;\n};\n\ntype FieldRenderProps = {\n value?: string;\n onChange?: (v: string) => void;\n onBlur?: (...args: unknown[]) => void;\n disabled?: boolean;\n id?: string;\n size?: 'small' | 'middle' | 'large';\n placeholder?: string;\n className?: string;\n variables?: VariableMentionItem[];\n catalogError?: string;\n};\n\ntype KneHooks = {\n useDecorator: (\n opts: Record<string, unknown>,\n ) => (Comp: ComponentType<FieldRenderProps>) => ReactNode;\n};\n\n/**\n * 标题变量:Input +「插入变量」按钮(明文 {{key}},可手改;无 `/` 触发)。\n * 须作为稳定组件类型交给 useDecorator(禁内联函数,否则每键 remount 丢焦)。\n */\nconst VariableMentionControl: FC<FieldRenderProps> = ({\n value = '',\n onChange,\n onBlur,\n disabled,\n variables,\n catalogError,\n placeholder,\n className,\n id,\n size = 'middle',\n}) => {\n const caretRef = useRef(String(value || '').length);\n const rootRef = useRef<HTMLDivElement>(null);\n\n const pick = (key: string) => {\n const next = insertVarTokenAt(String(value || ''), key, caretRef.current);\n onChange?.(next);\n caretRef.current = caretRef.current + `{{${key}}}`.length;\n };\n\n return (\n <div ref={rootRef} className={styles['var-mention-wrap']}>\n <Input\n id={id}\n size={size}\n value={value}\n disabled={disabled}\n placeholder={placeholder || '点右侧「插入变量」,或手打 {{key}}'}\n className={classNames('marsun-var-mention-input', styles['var-mention-input'], className)}\n onBlur={onBlur}\n onChange={(e) => {\n const next = e.target.value;\n caretRef.current = e.target.selectionStart ?? next.length;\n onChange?.(next);\n }}\n onSelect={(e) => {\n const t = e.target as HTMLInputElement;\n caretRef.current = t.selectionStart ?? -1;\n }}\n onClick={(e) => {\n const t = e.target as HTMLInputElement;\n caretRef.current = t.selectionStart ?? -1;\n }}\n onKeyUp={(e) => {\n const t = e.target as HTMLInputElement;\n caretRef.current = t.selectionStart ?? -1;\n }}\n />\n <VariablePicker\n variables={variables}\n catalogError={catalogError}\n disabled={disabled}\n size={size}\n className={styles['var-mention-picker']}\n getPopupContainer={() => rootRef.current || document.body}\n onPick={pick}\n />\n </div>\n );\n};\n\nconst VariableMentionInner: FC<VariableMentionFieldProps> = (props) => {\n const { useDecorator } = (ReactFormAntd as unknown as { hooks: KneHooks }).hooks;\n // variables / catalogError 等经 useDecorator → others 下发;禁 render(() => …) 内联类型\n const render = useDecorator({\n fieldName: 'variableMentionInput',\n ...props,\n });\n return render(VariableMentionControl);\n};\n\nVariableMentionInner.displayName = 'VariableMentionField';\n\nexport const VariableMentionField =\n VariableMentionInner as ComponentType<VariableMentionFieldProps>;\n\nexport default VariableMentionField;\n"],"names":["VariableMentionControl","value","onChange","onBlur","disabled","variables","catalogError","placeholder","className","id","size","caretRef","useRef","rootRef","pick","key","next","insertVarTokenAt","styles","jsx","Input","classNames","e","t","VariablePicker","VariableMentionInner","props","useDecorator","ReactFormAntd","VariableMentionField"],"mappings":";;;;;;;;AA+CA,MAAMA,IAA+C,CAAC;AAAA,EACpD,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,MAAAC,IAAO;AACT,MAAM;AACJ,QAAMC,IAAWC,EAAO,OAAOX,KAAS,EAAE,EAAE,MAAM,GAC5CY,IAAUD,EAAuB,IAAI,GAErCE,IAAO,CAACC,MAAgB;AAC5B,UAAMC,IAAOC,EAAiB,OAAOhB,KAAS,EAAE,GAAGc,GAAKJ,EAAS,OAAO;AACxE,IAAAT,KAAA,QAAAA,EAAWc,IACXL,EAAS,UAAUA,EAAS,UAAU,KAAKI,CAAG,KAAK;AAAA,EACrD;AAEA,2BACG,OAAA,EAAI,KAAKF,GAAS,WAAWK,EAAO,kBAAkB,GACrD,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,IAAAX;AAAA,QACA,MAAAC;AAAA,QACA,OAAAT;AAAA,QACA,UAAAG;AAAA,QACA,aAAaG,KAAe;AAAA,QAC5B,WAAWc,EAAW,4BAA4BH,EAAO,mBAAmB,GAAGV,CAAS;AAAA,QACxF,QAAAL;AAAA,QACA,UAAU,CAACmB,MAAM;AACf,gBAAMN,IAAOM,EAAE,OAAO;AACtB,UAAAX,EAAS,UAAUW,EAAE,OAAO,kBAAkBN,EAAK,QACnDd,KAAA,QAAAA,EAAWc;AAAA,QACb;AAAA,QACA,UAAU,CAACM,MAAM;AACf,gBAAMC,IAAID,EAAE;AACZ,UAAAX,EAAS,UAAUY,EAAE,kBAAkB;AAAA,QACzC;AAAA,QACA,SAAS,CAACD,MAAM;AACd,gBAAMC,IAAID,EAAE;AACZ,UAAAX,EAAS,UAAUY,EAAE,kBAAkB;AAAA,QACzC;AAAA,QACA,SAAS,CAACD,MAAM;AACd,gBAAMC,IAAID,EAAE;AACZ,UAAAX,EAAS,UAAUY,EAAE,kBAAkB;AAAA,QACzC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAAJ;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,WAAAnB;AAAA,QACA,cAAAC;AAAA,QACA,UAAAF;AAAA,QACA,MAAAM;AAAA,QACA,WAAWQ,EAAO,oBAAoB;AAAA,QACtC,mBAAmB,MAAML,EAAQ,WAAW,SAAS;AAAA,QACrD,QAAQC;AAAA,MAAA;AAAA,IAAA;AAAA,EACV,GACF;AAEJ,GAEMW,IAAsD,CAACC,MAAU;AACrE,QAAM,EAAE,cAAAC,MAAkBC,EAAiD;AAM3E,SAJeD,EAAa;AAAA,IAC1B,WAAW;AAAA,IACX,GAAGD;AAAA,EAAA,CACJ,EACa1B,CAAsB;AACtC;AAEAyB,EAAqB,cAAc;AAE5B,MAAMI,IACXJ;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
const n = {
|
|
2
|
-
"var-mention-wrap": "_var-mention-
|
|
3
|
-
"var-mention-input": "_var-mention-
|
|
4
|
-
"var-mention-
|
|
5
|
-
"var-mention-
|
|
6
|
-
"var-mention-
|
|
2
|
+
"var-mention-wrap": "_var-mention-wrap_7gf45_1",
|
|
3
|
+
"var-mention-input": "_var-mention-input_7gf45_9",
|
|
4
|
+
"var-mention-picker": "_var-mention-picker_7gf45_15",
|
|
5
|
+
"var-mention-option": "_var-mention-option_7gf45_20",
|
|
6
|
+
"var-mention-token": "_var-mention-token_7gf45_26",
|
|
7
|
+
"var-mention-label": "_var-mention-label_7gf45_37"
|
|
7
8
|
};
|
|
8
9
|
export {
|
|
9
10
|
n as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -3,7 +3,10 @@ export type InboxBellMessageType = 'alert' | 'action' | 'remind' | string;
|
|
|
3
3
|
export type InboxBellItem = {
|
|
4
4
|
id: string;
|
|
5
5
|
title?: string;
|
|
6
|
+
/** 纯文本摘要(列表兼容) */
|
|
6
7
|
summary?: string;
|
|
8
|
+
/** 已渲染 HTML 正文;空则主摘要位回落 summary */
|
|
9
|
+
bodyHtml?: string | null;
|
|
7
10
|
read?: boolean;
|
|
8
11
|
messageType?: InboxBellMessageType;
|
|
9
12
|
href?: string;
|