@hkyhy/marsun-components-core 0.1.130 → 0.1.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/_virtual/index.js +5 -5
- package/dist/_virtual/index2.js +5 -5
- package/dist/components/Editor/RichTextEditor/RichTextEditor.d.ts +3 -1
- package/dist/components/Editor/RichTextEditor/RichTextEditor.js +140 -61
- package/dist/components/Editor/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/components/Editor/RichTextEditor/style.module.scss.js +7 -7
- package/dist/components/Editor/index.d.ts +2 -2
- package/dist/components/Editor/index.js +20 -14
- package/dist/components/Editor/msgVarTokenPlugin.d.ts +22 -1
- package/dist/components/Editor/msgVarTokenPlugin.js +188 -45
- package/dist/components/Editor/msgVarTokenPlugin.js.map +1 -1
- package/dist/components/Editor/variableMention.d.ts +20 -1
- package/dist/components/Editor/variableMention.js +134 -46
- package/dist/components/Editor/variableMention.js.map +1 -1
- package/dist/components/FormInfo/RichTextField/index.d.ts +2 -0
- package/dist/components/FormInfo/RichTextField/index.js +46 -43
- package/dist/components/FormInfo/RichTextField/index.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.js +121 -112
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.js.map +1 -1
- package/dist/editor.js +22 -16
- package/dist/index.js +361 -355
- package/dist/marsun-components-core.css +1 -1
- package/dist/node_modules/@antv/g-lite/dist/index.esm.js +1 -1
- package/dist/node_modules/@antv/g2/esm/data/kde.js +1 -1
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/styles/global.css +1 -1
- package/package.json +1 -1
|
@@ -15,6 +15,8 @@ export type RichTextFieldProps = {
|
|
|
15
15
|
className?: string;
|
|
16
16
|
/** remount 键(换文档时传入) */
|
|
17
17
|
editorKey?: string;
|
|
18
|
+
/** 编辑器 HTML 旁路(保存时优先用,避免 Form 滞后丢样式) */
|
|
19
|
+
onEditorHtml?: (html: string) => void;
|
|
18
20
|
[key: string]: unknown;
|
|
19
21
|
};
|
|
20
22
|
export declare const RichTextField: ComponentType<RichTextFieldProps>;
|
|
@@ -1,59 +1,62 @@
|
|
|
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:
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as T from "@kne/react-form-antd";
|
|
3
|
+
import u from "classnames";
|
|
4
|
+
import { Suspense as N, lazy as F } from "react";
|
|
5
|
+
import s from "./style.module.scss.js";
|
|
6
|
+
const y = F(
|
|
7
|
+
() => import("../../Editor/index.js").then((e) => ({ default: e.RichTextEditor }))
|
|
8
|
+
), k = ({
|
|
9
|
+
value: e = "",
|
|
10
10
|
onChange: r,
|
|
11
11
|
disabled: i,
|
|
12
|
-
readOnly:
|
|
13
|
-
placeholder:
|
|
14
|
-
minHeight:
|
|
15
|
-
enableVariableMention:
|
|
16
|
-
variables:
|
|
17
|
-
catalogError:
|
|
18
|
-
className:
|
|
19
|
-
editorKey:
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
readOnly: m,
|
|
13
|
+
placeholder: d,
|
|
14
|
+
minHeight: l = 140,
|
|
15
|
+
enableVariableMention: f,
|
|
16
|
+
variables: x,
|
|
17
|
+
catalogError: h,
|
|
18
|
+
className: n,
|
|
19
|
+
editorKey: p,
|
|
20
|
+
onEditorHtml: c,
|
|
21
|
+
id: R
|
|
22
|
+
}) => /* @__PURE__ */ t(
|
|
22
23
|
"div",
|
|
23
24
|
{
|
|
24
|
-
className:
|
|
25
|
+
className: u(
|
|
25
26
|
"marsun-form-rich-text",
|
|
26
|
-
|
|
27
|
-
i &&
|
|
28
|
-
|
|
27
|
+
s["form-rich-text"],
|
|
28
|
+
i && s["form-rich-text-disabled"],
|
|
29
|
+
n
|
|
29
30
|
),
|
|
30
|
-
"data-field-id":
|
|
31
|
-
children: /* @__PURE__ */
|
|
32
|
-
|
|
31
|
+
"data-field-id": R,
|
|
32
|
+
children: /* @__PURE__ */ t(N, { fallback: /* @__PURE__ */ t("div", { className: s["form-rich-text-loading"], children: "加载编辑器…" }), children: /* @__PURE__ */ t(
|
|
33
|
+
y,
|
|
33
34
|
{
|
|
34
|
-
value:
|
|
35
|
-
onChange:
|
|
35
|
+
value: e,
|
|
36
|
+
onChange: (o) => {
|
|
37
|
+
r == null || r(o), c == null || c(o);
|
|
38
|
+
},
|
|
36
39
|
disabled: i,
|
|
37
|
-
readOnly:
|
|
38
|
-
placeholder:
|
|
39
|
-
minHeight:
|
|
40
|
-
enableVariableMention:
|
|
41
|
-
variables:
|
|
42
|
-
catalogError:
|
|
40
|
+
readOnly: m,
|
|
41
|
+
placeholder: d,
|
|
42
|
+
minHeight: l,
|
|
43
|
+
enableVariableMention: f,
|
|
44
|
+
variables: x,
|
|
45
|
+
catalogError: h
|
|
43
46
|
},
|
|
44
|
-
|
|
47
|
+
p || "rte"
|
|
45
48
|
) })
|
|
46
49
|
}
|
|
47
|
-
),
|
|
48
|
-
const { useDecorator: r } =
|
|
50
|
+
), a = (e) => {
|
|
51
|
+
const { useDecorator: r } = T.hooks;
|
|
49
52
|
return r({
|
|
50
|
-
fieldName: "
|
|
51
|
-
...
|
|
52
|
-
})(
|
|
53
|
+
fieldName: "textArea",
|
|
54
|
+
...e
|
|
55
|
+
})(k);
|
|
53
56
|
};
|
|
54
|
-
|
|
55
|
-
const
|
|
57
|
+
a.displayName = "RichTextField";
|
|
58
|
+
const z = a;
|
|
56
59
|
export {
|
|
57
|
-
|
|
60
|
+
z as RichTextField
|
|
58
61
|
};
|
|
59
62
|
//# 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 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: '
|
|
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 /** 编辑器 HTML 旁路(保存时优先用,避免 Form 滞后丢样式) */\n onEditorHtml?: (html: string) => void;\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 onEditorHtml?: (html: string) => void;\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 onEditorHtml,\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={(html) => {\n onChange?.(html);\n onEditorHtml?.(html);\n }}\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 // fieldName 用已注册的 textArea,保证 Form data 按 name 回填 value(自定义名易空值)\n const render = useDecorator({\n fieldName: 'textArea',\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","onEditorHtml","id","jsx","classNames","styles","Suspense","html","RichTextFieldInner","props","useDecorator","ReactFormAntd","RichTextField"],"mappings":";;;;;AAOA,MAAMA,IAAiBC;AAAA,EAAK,MAC1B,OAAO,uBAAqB,EAAE,KAAK,CAACC,OAAO,EAAE,SAASA,EAAE,iBAAiB;AAC3E,GAgDMC,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,cAAAC;AAAA,EACA,IAAAC;AACF,MACE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACT;AAAA,MACAC,EAAO,gBAAgB;AAAA,MACvBb,KAAYa,EAAO,yBAAyB;AAAA,MAC5CN;AAAA,IAAA;AAAA,IAEF,iBAAeG;AAAA,IAEf,UAAA,gBAAAC,EAACG,GAAA,EAAS,UAAU,gBAAAH,EAAC,OAAA,EAAI,WAAWE,EAAO,wBAAwB,GAAG,UAAA,SAAA,CAAM,GAC1E,UAAA,gBAAAF;AAAA,MAACjB;AAAA,MAAA;AAAA,QAEC,OAAAI;AAAA,QACA,UAAU,CAACiB,MAAS;AAClB,UAAAhB,KAAA,QAAAA,EAAWgB,IACXN,KAAA,QAAAA,EAAeM;AAAA,QACjB;AAAA,QACA,UAAAf;AAAA,QACA,UAAAC;AAAA,QACA,aAAAC;AAAA,QACA,WAAAC;AAAA,QACA,uBAAAC;AAAA,QACA,WAAAC;AAAA,QACA,cAAAC;AAAA,MAAA;AAAA,MAZKE,KAAa;AAAA,IAAA,EAapB,CACF;AAAA,EAAA;AACF,GAGIQ,IAA6C,CAACC,MAAU;AAC5D,QAAM,EAAE,cAAAC,MAAkBC,EAAiD;AAM3E,SAJeD,EAAa;AAAA,IAC1B,WAAW;AAAA,IACX,GAAGD;AAAA,EAAA,CACJ,EACapB,CAAe;AAC/B;AAEAmB,EAAmB,cAAc;AAE1B,MAAMI,IAAgBJ;"}
|
|
@@ -1,63 +1,65 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { RichTextField as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
1
|
+
import { jsx as t, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { RichTextField as q } from "../../../../FormInfo/RichTextField/index.js";
|
|
3
|
+
import { ensureRichTextBlockHtml as L, unwrapMsgVarSpansForStorage as G } from "../../../../Editor/variableMention.js";
|
|
4
|
+
import { sanitizeInboxHtml as U } from "../../../Inbox/sanitizeInboxHtml.js";
|
|
5
|
+
import { normalizeTemplatePlaceholders as b, applyTemplateVars as O } from "../../utils/templateCode.js";
|
|
6
|
+
import { message as T, Modal as J, Typography as D, Collapse as X } from "antd";
|
|
7
|
+
import { useState as A, useRef as Y, useEffect as Z, useMemo as P, useCallback as i } from "react";
|
|
8
|
+
import { AUDIENCE_SLOT_OPTIONS as W, normalizeAudienceSlots as ee, hasAudienceSelection as oe, ORG_TENANT_SLOT as le } from "../audienceSlots.js";
|
|
9
|
+
import s from "../style.module.scss.js";
|
|
10
|
+
import { Input as V, Select as I } from "../../../../FormInfo/fields.js";
|
|
11
|
+
import te from "../../../../FormInfo/FormModal.js";
|
|
12
|
+
import se from "../../../../FormInfo/FormInfo.js";
|
|
13
|
+
import re from "../../../../FormInfo/FormItem.js";
|
|
14
|
+
const C = {
|
|
14
15
|
getPopupContainer: () => document.body,
|
|
15
16
|
styles: { popup: { root: { zIndex: 2e3 } } }
|
|
16
|
-
},
|
|
17
|
-
open:
|
|
17
|
+
}, ve = ({
|
|
18
|
+
open: S,
|
|
18
19
|
isCreate: n,
|
|
19
20
|
initial: e,
|
|
20
21
|
catalog: p,
|
|
21
|
-
roleOptions:
|
|
22
|
-
variables:
|
|
22
|
+
roleOptions: R,
|
|
23
|
+
variables: h,
|
|
23
24
|
catalogError: u,
|
|
24
|
-
previewVars:
|
|
25
|
+
previewVars: K,
|
|
25
26
|
canWrite: r,
|
|
26
|
-
onCancel:
|
|
27
|
-
onSubmit:
|
|
27
|
+
onCancel: x,
|
|
28
|
+
onSubmit: F,
|
|
28
29
|
renderAudienceField: a
|
|
29
30
|
}) => {
|
|
30
|
-
const [
|
|
31
|
-
|
|
32
|
-
if (!
|
|
33
|
-
|
|
31
|
+
const [N, M] = A([]), [E, g] = A(!1), v = Y("");
|
|
32
|
+
Z(() => {
|
|
33
|
+
if (!S || !e) {
|
|
34
|
+
g(!1), v.current = "";
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
M(e.audienceRoles || e.roles || []), v.current = L(
|
|
38
|
+
b(e.bodyTemplate || "")
|
|
39
|
+
);
|
|
40
|
+
const o = window.requestAnimationFrame(() => g(!0));
|
|
38
41
|
return () => window.cancelAnimationFrame(o);
|
|
39
|
-
}, [
|
|
40
|
-
const
|
|
42
|
+
}, [S, e]);
|
|
43
|
+
const H = (e == null ? void 0 : e.id) || (e == null ? void 0 : e.code) || (n ? "create" : "edit"), k = P(() => e ? {
|
|
41
44
|
code: e.code,
|
|
42
45
|
eventKey: e.eventKey,
|
|
43
46
|
scenario: e.scenario || e.label || "",
|
|
44
|
-
titleTemplate:
|
|
47
|
+
titleTemplate: b(
|
|
45
48
|
e.titleTemplate || e.titlePreview || ""
|
|
46
49
|
),
|
|
47
|
-
|
|
50
|
+
// seed/库内常为无 <p> 纯文本;先块级化,避免 RTE setData 丢正文
|
|
51
|
+
bodyTemplate: L(
|
|
52
|
+
b(e.bodyTemplate || "")
|
|
53
|
+
),
|
|
48
54
|
audienceRoles: e.audienceRoles || e.roles || [],
|
|
49
55
|
audienceSlots: e.audienceSlots || []
|
|
50
|
-
} : {}, [e]),
|
|
51
|
-
|
|
52
|
-
}, []),
|
|
53
|
-
if (!N)
|
|
54
|
-
return [
|
|
55
|
-
/* @__PURE__ */ s(k.Text, { type: "secondary", children: "加载编辑器…" }, "loading")
|
|
56
|
-
];
|
|
56
|
+
} : {}, [e]), _ = u ? `目录加载失败,无法插入变量(${u})` : h.length === 0 ? "暂无 catalog 变量" : "", $ = i((o) => {
|
|
57
|
+
g(!!o);
|
|
58
|
+
}, []), j = P(() => {
|
|
57
59
|
const o = [];
|
|
58
|
-
return n || o.push(/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
|
|
60
|
+
return n || o.push(/* @__PURE__ */ t(V, { name: "code", label: "编号", disabled: !0 }, "code")), o.push(
|
|
61
|
+
/* @__PURE__ */ t(
|
|
62
|
+
I,
|
|
61
63
|
{
|
|
62
64
|
name: "eventKey",
|
|
63
65
|
label: "适用场景",
|
|
@@ -69,71 +71,74 @@ const K = {
|
|
|
69
71
|
label: l.label || l.eventKey
|
|
70
72
|
})),
|
|
71
73
|
placeholder: p.length ? "选择场景" : "暂无事件目录",
|
|
72
|
-
...
|
|
74
|
+
...C
|
|
73
75
|
},
|
|
74
76
|
"eventKey"
|
|
75
77
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
|
|
78
|
+
/* @__PURE__ */ t(
|
|
79
|
+
V,
|
|
78
80
|
{
|
|
79
81
|
name: "titleTemplate",
|
|
80
82
|
label: "标题模板",
|
|
81
83
|
rule: "REQ",
|
|
82
84
|
disabled: !r,
|
|
83
85
|
enableVariableMention: !0,
|
|
84
|
-
variables:
|
|
86
|
+
variables: h,
|
|
85
87
|
catalogError: u,
|
|
86
88
|
placeholder: "点「插入变量」选择 catalog 变量",
|
|
87
89
|
labelTips: n ? "新建默认停用。标题:点「插入变量」插入明文 {{key}}(可手改)。正文:原子色块,不可改字,整颗删除。" : "标题可手改 {{key}};正文为原子色块(不可改字、Backspace 整颗删)。"
|
|
88
90
|
},
|
|
89
91
|
"titleTemplate"
|
|
90
92
|
),
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
93
|
+
/* @__PURE__ */ t(
|
|
94
|
+
q,
|
|
93
95
|
{
|
|
94
96
|
name: "bodyTemplate",
|
|
95
97
|
label: "正文模板",
|
|
96
98
|
disabled: !r,
|
|
97
99
|
enableVariableMention: !0,
|
|
98
|
-
variables:
|
|
100
|
+
variables: h,
|
|
99
101
|
catalogError: u,
|
|
100
|
-
editorKey:
|
|
102
|
+
editorKey: H,
|
|
101
103
|
placeholder: "编辑正文,点「插入变量」",
|
|
102
|
-
minHeight: 160
|
|
104
|
+
minHeight: 160,
|
|
105
|
+
onEditorHtml: (l) => {
|
|
106
|
+
v.current = l;
|
|
107
|
+
}
|
|
103
108
|
},
|
|
104
109
|
"bodyTemplate"
|
|
105
110
|
)
|
|
106
111
|
), a || o.push(
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
|
|
112
|
+
/* @__PURE__ */ t(
|
|
113
|
+
I,
|
|
109
114
|
{
|
|
110
115
|
name: "audienceRoles",
|
|
111
116
|
label: "受众角色",
|
|
112
117
|
mode: "multiple",
|
|
113
118
|
allowClear: !0,
|
|
114
119
|
disabled: !r,
|
|
115
|
-
options:
|
|
120
|
+
options: R.map((l) => ({
|
|
116
121
|
value: l.code,
|
|
117
122
|
label: l.name || l.code
|
|
118
123
|
})),
|
|
119
124
|
optionFilterProp: "label",
|
|
120
125
|
maxTagCount: "responsive",
|
|
121
|
-
placeholder:
|
|
126
|
+
placeholder: R.length ? "下拉选择角色(可多选)" : "暂无角色数据",
|
|
122
127
|
notFoundContent: "暂无角色",
|
|
123
128
|
labelTips: "可与「通知范围」并存;至少选角色或槽位之一。emit 与显式 userIds 并集送达。",
|
|
124
|
-
...
|
|
129
|
+
...C
|
|
125
130
|
},
|
|
126
131
|
"audienceRoles"
|
|
127
132
|
),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
133
|
+
/* @__PURE__ */ t(
|
|
134
|
+
I,
|
|
130
135
|
{
|
|
131
136
|
name: "audienceSlots",
|
|
132
137
|
label: "通知范围",
|
|
133
138
|
mode: "multiple",
|
|
134
139
|
allowClear: !0,
|
|
135
140
|
disabled: !r,
|
|
136
|
-
options:
|
|
141
|
+
options: W.map((l) => ({
|
|
137
142
|
value: l.value,
|
|
138
143
|
label: l.label
|
|
139
144
|
})),
|
|
@@ -142,114 +147,118 @@ const K = {
|
|
|
142
147
|
placeholder: "可选:本人/领导/部门/分厂/租户或任务当事人",
|
|
143
148
|
notFoundContent: "暂无槽位",
|
|
144
149
|
labelTips: "依赖业务 emit.audienceContext;无上下文的槽不会发出。选「本租户」保存前会确认。",
|
|
145
|
-
...
|
|
150
|
+
...C
|
|
146
151
|
},
|
|
147
152
|
"audienceSlots"
|
|
148
153
|
)
|
|
149
154
|
), o;
|
|
150
155
|
}, [
|
|
151
|
-
|
|
156
|
+
E,
|
|
152
157
|
n,
|
|
153
158
|
r,
|
|
154
159
|
p,
|
|
155
|
-
|
|
156
|
-
|
|
160
|
+
h,
|
|
161
|
+
H,
|
|
157
162
|
u,
|
|
158
163
|
a,
|
|
159
|
-
|
|
160
|
-
]),
|
|
164
|
+
R
|
|
165
|
+
]), Q = P(
|
|
161
166
|
() => ({
|
|
162
|
-
data:
|
|
167
|
+
data: k,
|
|
163
168
|
onSubmit: async (o) => {
|
|
164
169
|
if (!r)
|
|
165
|
-
return
|
|
170
|
+
return T.warning("当前为只读(业务未授予写权限)"), !1;
|
|
166
171
|
const l = String(o.eventKey || "").trim();
|
|
167
172
|
if (!l)
|
|
168
|
-
return
|
|
169
|
-
const
|
|
170
|
-
if (!
|
|
171
|
-
return
|
|
172
|
-
const f = a ?
|
|
173
|
-
if (!
|
|
173
|
+
return T.warning("请选择适用场景"), !1;
|
|
174
|
+
const w = b(String(o.titleTemplate || ""));
|
|
175
|
+
if (!w.trim())
|
|
176
|
+
return T.warning("请填写标题模板"), !1;
|
|
177
|
+
const f = a ? N : Array.isArray(o.audienceRoles) ? o.audienceRoles : [], m = ee(o.audienceSlots || []);
|
|
178
|
+
if (!oe({
|
|
174
179
|
roles: f,
|
|
175
180
|
slots: m,
|
|
176
181
|
userIds: null
|
|
177
182
|
}))
|
|
178
|
-
return
|
|
179
|
-
if (m.includes(
|
|
180
|
-
|
|
183
|
+
return T.warning("请选择受众角色或通知范围(至少一个)"), !1;
|
|
184
|
+
if (m.includes(le) && !await new Promise((B) => {
|
|
185
|
+
J.confirm({
|
|
181
186
|
title: "确认通知本租户全员?",
|
|
182
187
|
content: "已选「本租户(全公司)」:将向当前租户内用户展开(≠跨租户)。确认保存?",
|
|
183
188
|
okText: "确认保存",
|
|
184
189
|
cancelText: "取消",
|
|
185
|
-
onOk: () =>
|
|
186
|
-
onCancel: () =>
|
|
190
|
+
onOk: () => B(!0),
|
|
191
|
+
onCancel: () => B(!1)
|
|
187
192
|
});
|
|
188
193
|
}))
|
|
189
194
|
return !1;
|
|
190
|
-
const
|
|
195
|
+
const c = p.find((d) => d.eventKey === l), z = String((c == null ? void 0 : c.label) || o.scenario || l).trim();
|
|
191
196
|
try {
|
|
192
|
-
await
|
|
197
|
+
await F({
|
|
193
198
|
...e || {},
|
|
194
199
|
code: o.code || (e == null ? void 0 : e.code),
|
|
195
200
|
eventKey: l,
|
|
196
|
-
scenario:
|
|
197
|
-
label:
|
|
198
|
-
messageType: (
|
|
199
|
-
titleTemplate:
|
|
200
|
-
bodyTemplate:
|
|
201
|
+
scenario: z,
|
|
202
|
+
label: z,
|
|
203
|
+
messageType: (c == null ? void 0 : c.messageType) || (e == null ? void 0 : e.messageType) || "alert",
|
|
204
|
+
titleTemplate: w,
|
|
205
|
+
bodyTemplate: G(
|
|
206
|
+
b(
|
|
207
|
+
String(v.current || o.bodyTemplate || "")
|
|
208
|
+
)
|
|
209
|
+
),
|
|
201
210
|
audienceRoles: f,
|
|
202
211
|
roles: f,
|
|
203
212
|
audienceSlots: m,
|
|
204
213
|
enabled: n ? !1 : (e == null ? void 0 : e.enabled) !== !1,
|
|
205
214
|
channel: (e == null ? void 0 : e.channel) || "in_app"
|
|
206
|
-
}),
|
|
207
|
-
} catch (
|
|
208
|
-
return
|
|
215
|
+
}), x();
|
|
216
|
+
} catch (d) {
|
|
217
|
+
return T.error(d instanceof Error ? d.message : String(d)), !1;
|
|
209
218
|
}
|
|
210
219
|
}
|
|
211
220
|
}),
|
|
212
221
|
[
|
|
213
|
-
|
|
222
|
+
k,
|
|
214
223
|
r,
|
|
215
224
|
p,
|
|
216
|
-
|
|
225
|
+
F,
|
|
217
226
|
e,
|
|
218
|
-
|
|
227
|
+
N,
|
|
219
228
|
n,
|
|
220
|
-
|
|
229
|
+
x,
|
|
221
230
|
a
|
|
222
231
|
]
|
|
223
232
|
);
|
|
224
233
|
return /* @__PURE__ */ y(
|
|
225
|
-
|
|
234
|
+
te,
|
|
226
235
|
{
|
|
227
236
|
title: n ? "新建模板" : "编辑模板",
|
|
228
|
-
open:
|
|
229
|
-
onCancel:
|
|
237
|
+
open: S,
|
|
238
|
+
onCancel: x,
|
|
230
239
|
width: 720,
|
|
231
240
|
size: "small",
|
|
232
241
|
className: "msg-center-form-modal",
|
|
233
242
|
okText: "保存",
|
|
234
243
|
autoClose: !1,
|
|
235
244
|
focusable: { trap: !1 },
|
|
236
|
-
afterOpenChange:
|
|
237
|
-
formProps:
|
|
245
|
+
afterOpenChange: $,
|
|
246
|
+
formProps: Q,
|
|
238
247
|
children: [
|
|
239
|
-
/* @__PURE__ */
|
|
240
|
-
a ? /* @__PURE__ */ y("div", { className:
|
|
241
|
-
/* @__PURE__ */ y(
|
|
242
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ t(se, { column: 1, list: j }),
|
|
249
|
+
a ? /* @__PURE__ */ y("div", { className: s.audienceBlock, children: [
|
|
250
|
+
/* @__PURE__ */ y(D.Text, { className: s.audienceLabel, children: [
|
|
251
|
+
/* @__PURE__ */ t("span", { style: { color: "#ff4d4f", marginRight: 4 }, children: "*" }),
|
|
243
252
|
"受众角色"
|
|
244
253
|
] }),
|
|
245
|
-
a({ roles:
|
|
254
|
+
a({ roles: N, onChange: M })
|
|
246
255
|
] }) : null,
|
|
247
|
-
|
|
248
|
-
const l = (typeof o.getFormData == "function" ? o.getFormData() : void 0) ?? o.formData ??
|
|
249
|
-
return /* @__PURE__ */ y("div", { className:
|
|
250
|
-
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
|
|
256
|
+
E ? /* @__PURE__ */ t(re, { children: (o) => {
|
|
257
|
+
const l = (typeof o.getFormData == "function" ? o.getFormData() : void 0) ?? o.formData ?? k, w = O(String(l.titleTemplate || ""), K), f = O(String(l.bodyTemplate || ""), K), m = U(f);
|
|
258
|
+
return /* @__PURE__ */ y("div", { className: s.previewCollapse, children: [
|
|
259
|
+
_ ? /* @__PURE__ */ t(D.Text, { type: "secondary", children: _ }) : null,
|
|
260
|
+
/* @__PURE__ */ t(
|
|
261
|
+
X,
|
|
253
262
|
{
|
|
254
263
|
ghost: !0,
|
|
255
264
|
size: "small",
|
|
@@ -257,15 +266,15 @@ const K = {
|
|
|
257
266
|
{
|
|
258
267
|
key: "preview",
|
|
259
268
|
label: "效果预览",
|
|
260
|
-
children: /* @__PURE__ */ y("div", { className:
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
m ? /* @__PURE__ */
|
|
269
|
+
children: /* @__PURE__ */ y("div", { className: s.previewCard, children: [
|
|
270
|
+
/* @__PURE__ */ t("div", { className: s.previewTitle, children: w.trim() || /* @__PURE__ */ t("span", { className: s.previewEmpty, children: "(无标题)" }) }),
|
|
271
|
+
m ? /* @__PURE__ */ t(
|
|
263
272
|
"div",
|
|
264
273
|
{
|
|
265
|
-
className:
|
|
274
|
+
className: s.previewBody,
|
|
266
275
|
dangerouslySetInnerHTML: { __html: m }
|
|
267
276
|
}
|
|
268
|
-
) : /* @__PURE__ */
|
|
277
|
+
) : /* @__PURE__ */ t("div", { className: `${s.previewBody} ${s.previewEmpty}`, children: "(无正文)" })
|
|
269
278
|
] })
|
|
270
279
|
}
|
|
271
280
|
]
|
|
@@ -278,6 +287,6 @@ const K = {
|
|
|
278
287
|
);
|
|
279
288
|
};
|
|
280
289
|
export {
|
|
281
|
-
|
|
290
|
+
ve as TemplateFormModal
|
|
282
291
|
};
|
|
283
292
|
//# sourceMappingURL=TemplateFormModal.js.map
|