szld-libs 0.4.49 → 0.4.50
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/style.css +1 -1
- package/dist/szld-components.es.js +18408 -17763
- package/dist/szld-components.umd.js +217 -101
- package/es/components/DynamicForm/myRichText/index.d.ts +2 -1
- package/es/components/DynamicForm/myRichText/index.js +1 -1
- package/es/components/DynamicFormMobile/func.js +4 -0
- package/es/components/DynamicFormMobile/myRichText/enmu.d.ts +5 -0
- package/es/components/DynamicFormMobile/myRichText/enmu.js +68 -0
- package/es/components/DynamicFormMobile/myRichText/index.d.ts +11 -0
- package/es/components/DynamicFormMobile/myRichText/index.js +291 -0
- package/es/components/DynamicFormMobile/myRichText/vite.svg +1 -0
- package/es/components/DynamicFormMobile/mySelect/index.css +9 -1
- package/es/components/DynamicFormMobile/mySelect/index.d.ts +1 -1
- package/es/components/DynamicFormMobile/mySelect/index.js +55 -24
- package/es/components/DynamicFormMobile/myUpload/index.d.ts +1 -1
- package/es/components/DynamicFormMobile/selectModel/index.d.ts +1 -1
- package/es/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +1 -1
- package/es/components/DynamicFormMobile/useDynamicForm.d.ts +2 -2
- package/es/components/DynamicFormMobile/useDynamicForm.js +19 -4
- package/es/index.js +6 -4
- package/es/mock/index.js +2 -2
- package/lib/components/DynamicForm/myRichText/index.d.ts +2 -1
- package/lib/components/DynamicForm/myRichText/index.js +1 -1
- package/lib/components/DynamicFormMobile/func.js +4 -0
- package/lib/components/DynamicFormMobile/myRichText/enmu.d.ts +5 -0
- package/lib/components/DynamicFormMobile/myRichText/enmu.js +68 -0
- package/lib/components/DynamicFormMobile/myRichText/index.d.ts +11 -0
- package/lib/components/DynamicFormMobile/myRichText/index.js +290 -0
- package/lib/components/DynamicFormMobile/myRichText/vite.svg +1 -0
- package/lib/components/DynamicFormMobile/mySelect/index.css +9 -1
- package/lib/components/DynamicFormMobile/mySelect/index.d.ts +1 -1
- package/lib/components/DynamicFormMobile/mySelect/index.js +55 -24
- package/lib/components/DynamicFormMobile/myUpload/index.d.ts +1 -1
- package/lib/components/DynamicFormMobile/selectModel/index.d.ts +1 -1
- package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +1 -1
- package/lib/components/DynamicFormMobile/useDynamicForm.d.ts +2 -2
- package/lib/components/DynamicFormMobile/useDynamicForm.js +19 -4
- package/lib/index.js +6 -4
- package/lib/mock/index.js +2 -2
- package/package.json +2 -1
- package/es/utils/enum.d.ts +0 -4
- package/es/utils/enum.js +0 -10
- package/lib/utils/enum.d.ts +0 -4
- package/lib/utils/enum.js +0 -10
|
@@ -4,7 +4,8 @@ interface IMyRichTextProps {
|
|
|
4
4
|
readonly: boolean;
|
|
5
5
|
style: React.CSSProperties;
|
|
6
6
|
value: string;
|
|
7
|
+
langId?: string;
|
|
7
8
|
onChange: (val: string) => void;
|
|
8
9
|
}
|
|
9
|
-
declare const MyRichText: ({ item, readonly, style, value, onChange }: IMyRichTextProps) => import("react").JSX.Element | null;
|
|
10
|
+
declare const MyRichText: ({ item, readonly, style, value, langId, onChange }: IMyRichTextProps) => import("react").JSX.Element | null;
|
|
10
11
|
export default MyRichText;
|
|
@@ -9,7 +9,7 @@ import StarterKit from "@tiptap/starter-kit";
|
|
|
9
9
|
import Color from "@tiptap/extension-color";
|
|
10
10
|
import { useState, useEffect } from "react";
|
|
11
11
|
import { BoldOutlined, ItalicOutlined, UnderlineOutlined, StrikethroughOutlined, ClearOutlined, FontSizeOutlined, AlignLeftOutlined, AlignCenterOutlined, AlignRightOutlined, BlockOutlined, UnorderedListOutlined, OrderedListOutlined, ToolOutlined, LinkOutlined, UndoOutlined, RedoOutlined } from "@ant-design/icons";
|
|
12
|
-
const MyRichText = ({ item, readonly, style, value, onChange }) => {
|
|
12
|
+
const MyRichText = ({ item, readonly, style, value, langId, onChange }) => {
|
|
13
13
|
const [color, setColor] = useState("#1677ff");
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
const styleSheet = document.createElement("style");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
2
|
import { message } from "antd";
|
|
3
|
+
import { base64ToString } from "../../utils/method";
|
|
3
4
|
const handleGetPlaceholder = (itemWithJson, langId) => {
|
|
4
5
|
const { input = "" } = (itemWithJson == null ? void 0 : itemWithJson.json) || {};
|
|
5
6
|
let placeholderCn = "请输入", placeholderEn = "Please input";
|
|
@@ -83,6 +84,9 @@ const handleSetFormItemInitialValue = (itemWithJson) => {
|
|
|
83
84
|
if (inputType === "time-picker" && !initialValue && ((_g = itemWithJson.json) == null ? void 0 : _g["auto-generate"]) && ((_h = itemWithJson.json) == null ? void 0 : _h["auto-generate-type"]) === "currenttimestamp") {
|
|
84
85
|
initialValue = dayjs().unix().toString();
|
|
85
86
|
}
|
|
87
|
+
if (inputType === "rich-text" && initialValue) {
|
|
88
|
+
initialValue = base64ToString(initialValue);
|
|
89
|
+
}
|
|
86
90
|
if (itemWithJson.attrtype === 1) {
|
|
87
91
|
initialValue = handleGetSingleAttrListObj(itemWithJson.children || []);
|
|
88
92
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const fontSizes = [
|
|
2
|
+
{ value: "12px", label: "12px" },
|
|
3
|
+
{ value: "14px", label: "14px" },
|
|
4
|
+
{ value: "16px", label: "16px" },
|
|
5
|
+
{ value: "18px", label: "18px" },
|
|
6
|
+
{ value: "20px", label: "20px" },
|
|
7
|
+
{ value: "24px", label: "24px" },
|
|
8
|
+
{ value: "28px", label: "28px" },
|
|
9
|
+
{ value: "32px", label: "32px" },
|
|
10
|
+
{ value: "36px", label: "36px" }
|
|
11
|
+
];
|
|
12
|
+
const colors = [
|
|
13
|
+
"#000000",
|
|
14
|
+
"#ffffff",
|
|
15
|
+
"#333333",
|
|
16
|
+
"#666666",
|
|
17
|
+
"#999999",
|
|
18
|
+
"#cccccc",
|
|
19
|
+
"#ff0000",
|
|
20
|
+
"#cc0000",
|
|
21
|
+
"#ff3333",
|
|
22
|
+
"#ff6666",
|
|
23
|
+
"#ff9999",
|
|
24
|
+
"#ffcccc",
|
|
25
|
+
"#ff6600",
|
|
26
|
+
"#cc5200",
|
|
27
|
+
"#ff8533",
|
|
28
|
+
"#ffad66",
|
|
29
|
+
"#ffd4a3",
|
|
30
|
+
"#ffff00",
|
|
31
|
+
"#cccc00",
|
|
32
|
+
"#ffff33",
|
|
33
|
+
"#ffff66",
|
|
34
|
+
"#ffff99",
|
|
35
|
+
"#00cc00",
|
|
36
|
+
"#009900",
|
|
37
|
+
"#33ff33",
|
|
38
|
+
"#66ff66",
|
|
39
|
+
"#99ff99",
|
|
40
|
+
"#00cccc",
|
|
41
|
+
"#009999",
|
|
42
|
+
"#33ffff",
|
|
43
|
+
"#66ffff",
|
|
44
|
+
"#99ffff",
|
|
45
|
+
"#0066ff",
|
|
46
|
+
"#004dcc",
|
|
47
|
+
"#3385ff",
|
|
48
|
+
"#66a3ff",
|
|
49
|
+
"#99c1ff",
|
|
50
|
+
"#9900ff",
|
|
51
|
+
"#7300cc",
|
|
52
|
+
"#b333ff",
|
|
53
|
+
"#cc66ff",
|
|
54
|
+
"#e0a3ff",
|
|
55
|
+
"#ff0099",
|
|
56
|
+
"#cc007a",
|
|
57
|
+
"#ff33aa",
|
|
58
|
+
"#ff66bb",
|
|
59
|
+
"#ff99cc",
|
|
60
|
+
"#996633",
|
|
61
|
+
"#734d29",
|
|
62
|
+
"#b3804d",
|
|
63
|
+
"#cc9966"
|
|
64
|
+
];
|
|
65
|
+
export {
|
|
66
|
+
colors,
|
|
67
|
+
fontSizes
|
|
68
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface IMyRichTextProps {
|
|
3
|
+
item: any;
|
|
4
|
+
readonly: boolean;
|
|
5
|
+
style: React.CSSProperties;
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (val: string) => void;
|
|
8
|
+
langId?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const MyRichText: ({ item, readonly, style, value, langId, onChange }: IMyRichTextProps) => import("react").JSX.Element | null;
|
|
11
|
+
export default MyRichText;
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEditor, EditorContent } from "@tiptap/react";
|
|
3
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
4
|
+
import { TextStyle } from "@tiptap/extension-text-style";
|
|
5
|
+
import TextAlign from "@tiptap/extension-text-align";
|
|
6
|
+
import Highlight from "@tiptap/extension-highlight";
|
|
7
|
+
import FontSize from "@tiptap/extension-font-size";
|
|
8
|
+
import Color from "@tiptap/extension-color";
|
|
9
|
+
import { useState, useEffect } from "react";
|
|
10
|
+
import { Space, Button, Popup } from "react-vant";
|
|
11
|
+
import { Undo, Redo, Bold, Italic, Underline, Strikethrough, AlignLeft, AlignCenter, AlignRight, List, ListOrdered } from "lucide-react";
|
|
12
|
+
import { fontSizes, colors } from "./enmu";
|
|
13
|
+
const MyRichText = ({ item, readonly, style, value, langId, onChange }) => {
|
|
14
|
+
const [showFontSizePicker, setShowFontSizePicker] = useState(false);
|
|
15
|
+
const [showColorPicker, setShowColorPicker] = useState(false);
|
|
16
|
+
const [selectedSize, setSelectedSize] = useState("16px");
|
|
17
|
+
const [selectedColor, setSelectedColor] = useState("#1677ff");
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const styleSheet = document.createElement("style");
|
|
20
|
+
styleSheet.textContent = `
|
|
21
|
+
.MyRichText_ProseMirror {
|
|
22
|
+
min-height: 200px !important;
|
|
23
|
+
outline: none !important;
|
|
24
|
+
box-shadow: none !important;
|
|
25
|
+
border: none !important;
|
|
26
|
+
padding: 12px;
|
|
27
|
+
font-size: 16px;
|
|
28
|
+
line-height: 1.6;
|
|
29
|
+
}
|
|
30
|
+
.MyRichText_ProseMirror:focus,
|
|
31
|
+
.MyRichText_ProseMirror:focus-visible {
|
|
32
|
+
outline: none !important;
|
|
33
|
+
box-shadow: none !important;
|
|
34
|
+
border: none !important;
|
|
35
|
+
}
|
|
36
|
+
.MyRichText_ProseMirror p {
|
|
37
|
+
min-height: 1.5em;
|
|
38
|
+
margin: 0 0 8px 0;
|
|
39
|
+
padding: 0;
|
|
40
|
+
}
|
|
41
|
+
.MyRichText_ProseMirror h1,
|
|
42
|
+
.MyRichText_ProseMirror h2,
|
|
43
|
+
.MyRichText_ProseMirror h3 {
|
|
44
|
+
margin: 12px 0;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
document.head.appendChild(styleSheet);
|
|
48
|
+
return () => {
|
|
49
|
+
document.head.removeChild(styleSheet);
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
const editor = useEditor({
|
|
53
|
+
extensions: [
|
|
54
|
+
StarterKit,
|
|
55
|
+
Highlight.configure({ multicolor: true }),
|
|
56
|
+
TextAlign.configure({
|
|
57
|
+
types: ["heading", "paragraph"]
|
|
58
|
+
}),
|
|
59
|
+
TextStyle,
|
|
60
|
+
FontSize,
|
|
61
|
+
Color.configure({
|
|
62
|
+
types: ["textStyle"]
|
|
63
|
+
})
|
|
64
|
+
],
|
|
65
|
+
content: value || "<p><br /></p>",
|
|
66
|
+
editable: !readonly,
|
|
67
|
+
editorProps: {
|
|
68
|
+
attributes: {
|
|
69
|
+
class: "MyRichText_ProseMirror"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
onUpdate: ({ editor: editor2 }) => {
|
|
73
|
+
onChange(editor2.getHTML());
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
if (!editor) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const formatButtons = [
|
|
80
|
+
{
|
|
81
|
+
key: "bold",
|
|
82
|
+
icon: /* @__PURE__ */ jsx(Bold, { size: 18 }),
|
|
83
|
+
label: "粗",
|
|
84
|
+
action: () => editor.chain().focus().toggleBold().run(),
|
|
85
|
+
active: "bold"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: "italic",
|
|
89
|
+
icon: /* @__PURE__ */ jsx(Italic, { size: 18 }),
|
|
90
|
+
label: "斜",
|
|
91
|
+
action: () => editor.chain().focus().toggleItalic().run(),
|
|
92
|
+
active: "italic"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: "underline",
|
|
96
|
+
icon: /* @__PURE__ */ jsx(Underline, { size: 18 }),
|
|
97
|
+
label: "下",
|
|
98
|
+
action: () => editor.chain().focus().toggleUnderline().run(),
|
|
99
|
+
active: "underline"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: "strike",
|
|
103
|
+
icon: /* @__PURE__ */ jsx(Strikethrough, { size: 18 }),
|
|
104
|
+
label: "删",
|
|
105
|
+
action: () => editor.chain().focus().toggleStrike().run(),
|
|
106
|
+
active: "strike"
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
const alignButtons = [
|
|
110
|
+
{
|
|
111
|
+
key: "align-left",
|
|
112
|
+
icon: /* @__PURE__ */ jsx(AlignLeft, { size: 18 }),
|
|
113
|
+
label: "左",
|
|
114
|
+
action: () => editor.chain().focus().setTextAlign("left").run(),
|
|
115
|
+
active: { textAlign: "left" }
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: "align-center",
|
|
119
|
+
icon: /* @__PURE__ */ jsx(AlignCenter, { size: 18 }),
|
|
120
|
+
label: "中",
|
|
121
|
+
action: () => editor.chain().focus().setTextAlign("center").run(),
|
|
122
|
+
active: { textAlign: "center" }
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
key: "align-right",
|
|
126
|
+
icon: /* @__PURE__ */ jsx(AlignRight, { size: 18 }),
|
|
127
|
+
label: "右",
|
|
128
|
+
action: () => editor.chain().focus().setTextAlign("right").run(),
|
|
129
|
+
active: { textAlign: "right" }
|
|
130
|
+
}
|
|
131
|
+
];
|
|
132
|
+
const listButtons = [
|
|
133
|
+
{
|
|
134
|
+
key: "bulletList",
|
|
135
|
+
icon: /* @__PURE__ */ jsx(List, { size: 18 }),
|
|
136
|
+
label: "列",
|
|
137
|
+
action: () => editor.chain().focus().toggleBulletList().run(),
|
|
138
|
+
active: "bulletList"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
key: "orderedList",
|
|
142
|
+
icon: /* @__PURE__ */ jsx(ListOrdered, { size: 20 }),
|
|
143
|
+
label: "序",
|
|
144
|
+
action: () => editor.chain().focus().toggleOrderedList().run(),
|
|
145
|
+
active: "orderedList"
|
|
146
|
+
}
|
|
147
|
+
];
|
|
148
|
+
const handleFontSizeChange = (size) => {
|
|
149
|
+
setSelectedSize(size);
|
|
150
|
+
editor.chain().focus().setFontSize(size).run();
|
|
151
|
+
setShowFontSizePicker(false);
|
|
152
|
+
};
|
|
153
|
+
const handleColorChange = (color) => {
|
|
154
|
+
setSelectedColor(color);
|
|
155
|
+
editor.chain().focus().setColor(color).run();
|
|
156
|
+
setShowColorPicker(false);
|
|
157
|
+
};
|
|
158
|
+
return /* @__PURE__ */ jsxs("div", { style: { ...style, border: "1px solid #eee", borderRadius: 8, overflow: "hidden", backgroundColor: "#fff" }, children: [
|
|
159
|
+
/* @__PURE__ */ jsx(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
style: {
|
|
163
|
+
padding: "8px 12px",
|
|
164
|
+
background: "#f8f9fa",
|
|
165
|
+
borderBottom: "1px solid #eee"
|
|
166
|
+
},
|
|
167
|
+
children: /* @__PURE__ */ jsxs(Space, { wrap: true, children: [
|
|
168
|
+
formatButtons.map((btn) => /* @__PURE__ */ jsx(
|
|
169
|
+
Button,
|
|
170
|
+
{
|
|
171
|
+
size: "small",
|
|
172
|
+
type: editor.isActive(btn.active) ? "primary" : "default",
|
|
173
|
+
plain: true,
|
|
174
|
+
onClick: btn.action,
|
|
175
|
+
disabled: readonly,
|
|
176
|
+
icon: btn.icon
|
|
177
|
+
},
|
|
178
|
+
btn.key
|
|
179
|
+
)),
|
|
180
|
+
/* @__PURE__ */ jsx(Button, { size: "small", plain: true, onClick: () => setShowFontSizePicker(true), disabled: readonly, children: selectedSize }),
|
|
181
|
+
/* @__PURE__ */ jsx(
|
|
182
|
+
Button,
|
|
183
|
+
{
|
|
184
|
+
size: "small",
|
|
185
|
+
plain: true,
|
|
186
|
+
onClick: () => setShowColorPicker(true),
|
|
187
|
+
disabled: readonly,
|
|
188
|
+
style: {
|
|
189
|
+
width: "32px",
|
|
190
|
+
height: "32px",
|
|
191
|
+
backgroundColor: selectedColor,
|
|
192
|
+
borderRadius: "4px"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
alignButtons.map((btn) => /* @__PURE__ */ jsx(
|
|
197
|
+
Button,
|
|
198
|
+
{
|
|
199
|
+
size: "small",
|
|
200
|
+
type: editor.isActive(btn.active) ? "primary" : "default",
|
|
201
|
+
plain: true,
|
|
202
|
+
onClick: btn.action,
|
|
203
|
+
disabled: readonly,
|
|
204
|
+
icon: btn.icon
|
|
205
|
+
},
|
|
206
|
+
btn.key
|
|
207
|
+
)),
|
|
208
|
+
listButtons.map((btn) => /* @__PURE__ */ jsx(
|
|
209
|
+
Button,
|
|
210
|
+
{
|
|
211
|
+
size: "small",
|
|
212
|
+
type: editor.isActive(btn.active) ? "primary" : "default",
|
|
213
|
+
plain: true,
|
|
214
|
+
onClick: btn.action,
|
|
215
|
+
disabled: readonly,
|
|
216
|
+
icon: btn.icon
|
|
217
|
+
},
|
|
218
|
+
btn.key
|
|
219
|
+
)),
|
|
220
|
+
/* @__PURE__ */ jsx(
|
|
221
|
+
Button,
|
|
222
|
+
{
|
|
223
|
+
size: "small",
|
|
224
|
+
plain: true,
|
|
225
|
+
onClick: () => editor.chain().focus().undo().run(),
|
|
226
|
+
disabled: readonly || !editor.can().undo(),
|
|
227
|
+
icon: /* @__PURE__ */ jsx(Undo, { size: 18 })
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ jsx(
|
|
231
|
+
Button,
|
|
232
|
+
{
|
|
233
|
+
size: "small",
|
|
234
|
+
plain: true,
|
|
235
|
+
onClick: () => editor.chain().focus().redo().run(),
|
|
236
|
+
disabled: readonly || !editor.can().redo(),
|
|
237
|
+
icon: /* @__PURE__ */ jsx(Redo, { size: 18 })
|
|
238
|
+
}
|
|
239
|
+
)
|
|
240
|
+
] })
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
/* @__PURE__ */ jsx("div", { onClick: () => editor.chain().focus().run(), children: /* @__PURE__ */ jsx(
|
|
244
|
+
EditorContent,
|
|
245
|
+
{
|
|
246
|
+
editor,
|
|
247
|
+
style: {
|
|
248
|
+
minHeight: 200,
|
|
249
|
+
outline: "none",
|
|
250
|
+
backgroundColor: "#fff"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
) }),
|
|
254
|
+
/* @__PURE__ */ jsx(Popup, { visible: showFontSizePicker, position: "bottom", onClose: () => setShowFontSizePicker(false), children: /* @__PURE__ */ jsxs("div", { style: { padding: "20px" }, children: [
|
|
255
|
+
/* @__PURE__ */ jsx("h3", { style: { textAlign: "center", marginBottom: "16px", fontSize: "16px", fontWeight: "bold" }, children: "选择字体大小" }),
|
|
256
|
+
/* @__PURE__ */ jsx(Space, { wrap: true, style: { justifyContent: "center" }, children: fontSizes.map((size) => /* @__PURE__ */ jsx(
|
|
257
|
+
Button,
|
|
258
|
+
{
|
|
259
|
+
size: "small",
|
|
260
|
+
type: selectedSize === size.value ? "primary" : "default",
|
|
261
|
+
onClick: () => handleFontSizeChange(size.value),
|
|
262
|
+
style: { padding: "8px 16px", margin: "4px" },
|
|
263
|
+
children: size.label
|
|
264
|
+
},
|
|
265
|
+
size.value
|
|
266
|
+
)) })
|
|
267
|
+
] }) }),
|
|
268
|
+
/* @__PURE__ */ jsx(Popup, { visible: showColorPicker, position: "bottom", onClose: () => setShowColorPicker(false), children: /* @__PURE__ */ jsxs("div", { style: { padding: "20px" }, children: [
|
|
269
|
+
/* @__PURE__ */ jsx("h3", { style: { textAlign: "center", marginBottom: "16px", fontSize: "16px", fontWeight: "bold" }, children: "选择文字颜色" }),
|
|
270
|
+
/* @__PURE__ */ jsx(Space, { wrap: true, children: colors.map((color) => /* @__PURE__ */ jsx(
|
|
271
|
+
Button,
|
|
272
|
+
{
|
|
273
|
+
size: "small",
|
|
274
|
+
plain: true,
|
|
275
|
+
onClick: () => handleColorChange(color),
|
|
276
|
+
style: {
|
|
277
|
+
width: "24px",
|
|
278
|
+
height: "24px",
|
|
279
|
+
borderRadius: "50%",
|
|
280
|
+
backgroundColor: color,
|
|
281
|
+
margin: "4px"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
color
|
|
285
|
+
)) })
|
|
286
|
+
] }) })
|
|
287
|
+
] });
|
|
288
|
+
};
|
|
289
|
+
export {
|
|
290
|
+
MyRichText as default
|
|
291
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
.index-module_checkbox-group_4684b .index-module_checkbox-group-content_f81a1 {
|
|
21
21
|
overflow-y: auto;
|
|
22
|
-
margin-top:
|
|
22
|
+
margin-top: 16px;
|
|
23
23
|
}
|
|
24
24
|
.index-module_checkbox-group_4684b .index-module_checkbox-group-content_f81a1 .index-module_checkbox-item_1b36c {
|
|
25
25
|
font-size: 14px;
|
|
@@ -29,3 +29,11 @@
|
|
|
29
29
|
font-size: 14px;
|
|
30
30
|
color: #999;
|
|
31
31
|
}
|
|
32
|
+
.index-module_checkbox-group_4684b .index-module_checkbox-group-check-all_1e608 {
|
|
33
|
+
border-bottom: 1px solid #e5e5e5;
|
|
34
|
+
padding-top: 40px;
|
|
35
|
+
padding-bottom: 16px;
|
|
36
|
+
}
|
|
37
|
+
.index-module_checkbox-group_4684b .index-module_checkbox-group-check-all_1e608 .index-module_item_4fef5 {
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Ijson } from '
|
|
2
|
+
import { Ijson } from '../../DynamicForm/index.d';
|
|
3
3
|
import { AxiosResponse } from 'axios';
|
|
4
4
|
declare const MySelect: ({ item, readonly, style, commonRequestWidthParams, commonRequest, value, onChange, interfaceTypeDict, interfaceTypeSysDict, actionUrlKey, actionUrlExtraParams, langId, getTitle, attrid, }: {
|
|
5
5
|
item: Ijson;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { handleGetList, handleGetControlPanelConfig } from "../../../utils/szxkFunc";
|
|
2
3
|
import { handleSelectOptions, findRowByValue } from "../../DynamicForm/func";
|
|
3
4
|
import { Toast, Field, Popup, Checkbox, Picker } from "react-vant";
|
|
4
5
|
import { useState, useEffect } from "react";
|
|
5
6
|
import { Flex } from "antd";
|
|
6
|
-
import { handleGetList, handleGetControlPanelConfig } from "../../../utils/szxkFunc";
|
|
7
7
|
const checkboxGroup = "index-module_checkbox-group_4684b";
|
|
8
8
|
const checkboxGroupHeader = "index-module_checkbox-group-header_192bd";
|
|
9
9
|
const checkboxGroupContent = "index-module_checkbox-group-content_f81a1";
|
|
10
10
|
const checkboxItem = "index-module_checkbox-item_1b36c";
|
|
11
11
|
const checkboxGroupCancel = "index-module_checkbox-group-cancel_c5cfb";
|
|
12
|
+
const checkboxGroupCheckAll = "index-module_checkbox-group-check-all_1e608";
|
|
13
|
+
const item = "index-module_item_4fef5";
|
|
12
14
|
const styles = {
|
|
13
15
|
"checkbox-group": "index-module_checkbox-group_4684b",
|
|
14
16
|
checkboxGroup,
|
|
@@ -19,10 +21,13 @@ const styles = {
|
|
|
19
21
|
"checkbox-item": "index-module_checkbox-item_1b36c",
|
|
20
22
|
checkboxItem,
|
|
21
23
|
"checkbox-group-cancel": "index-module_checkbox-group-cancel_c5cfb",
|
|
22
|
-
checkboxGroupCancel
|
|
24
|
+
checkboxGroupCancel,
|
|
25
|
+
"checkbox-group-check-all": "index-module_checkbox-group-check-all_1e608",
|
|
26
|
+
checkboxGroupCheckAll,
|
|
27
|
+
item
|
|
23
28
|
};
|
|
24
29
|
const MySelect = ({
|
|
25
|
-
item,
|
|
30
|
+
item: item2,
|
|
26
31
|
readonly,
|
|
27
32
|
style,
|
|
28
33
|
commonRequestWidthParams,
|
|
@@ -37,29 +42,34 @@ const MySelect = ({
|
|
|
37
42
|
getTitle,
|
|
38
43
|
attrid
|
|
39
44
|
}) => {
|
|
45
|
+
var _a;
|
|
40
46
|
const [options, setOptions] = useState([]);
|
|
41
47
|
const [instanceList, setInstanceList] = useState([]);
|
|
48
|
+
const [isAllChecked, setIsAllChecked] = useState(false);
|
|
49
|
+
const [showPopup, setShowPopup] = useState(false);
|
|
50
|
+
const [selectedValues, setSelectedValues] = useState([]);
|
|
51
|
+
const [confirmValues, setConfirmValues] = useState([]);
|
|
42
52
|
useEffect(() => {
|
|
43
|
-
if (
|
|
53
|
+
if (item2.input === "mult-select" && value && Array.isArray(value)) {
|
|
44
54
|
setSelectedValues(value || []);
|
|
45
55
|
setConfirmValues(value || []);
|
|
46
56
|
}
|
|
47
57
|
}, [value]);
|
|
48
58
|
useEffect(() => {
|
|
49
59
|
handleLoadOptions();
|
|
50
|
-
}, [
|
|
60
|
+
}, [item2.inputType, item2.classify, item2.data, item2.options]);
|
|
51
61
|
const handleLoadOptions = async () => {
|
|
52
|
-
if (
|
|
53
|
-
const keyField =
|
|
62
|
+
if (item2.inputType === "instance-url" && (item2 == null ? void 0 : item2["instance-source-number"]) && attrid) {
|
|
63
|
+
const keyField = item2 == null ? void 0 : item2["key-field"];
|
|
54
64
|
if (!keyField) {
|
|
55
65
|
Toast("请配置key-field");
|
|
56
66
|
return;
|
|
57
67
|
}
|
|
58
68
|
const params = {
|
|
59
|
-
"source-number":
|
|
69
|
+
"source-number": item2 == null ? void 0 : item2["instance-source-number"]
|
|
60
70
|
};
|
|
61
71
|
let list2 = await handleGetList(params, commonRequestWidthParams);
|
|
62
|
-
const controlPanelConfig = await handleGetControlPanelConfig(
|
|
72
|
+
const controlPanelConfig = await handleGetControlPanelConfig(item2 == null ? void 0 : item2["instance-source-number"], commonRequest);
|
|
63
73
|
if (controlPanelConfig) {
|
|
64
74
|
const nonUniversalHeader = (controlPanelConfig == null ? void 0 : controlPanelConfig["non-universal-header"]) || [];
|
|
65
75
|
const labelConfig = (nonUniversalHeader == null ? void 0 : nonUniversalHeader["label"]) || [];
|
|
@@ -88,14 +98,11 @@ const MySelect = ({
|
|
|
88
98
|
interfaceTypeSysDict,
|
|
89
99
|
actionUrlKey,
|
|
90
100
|
actionUrlExtraParams,
|
|
91
|
-
item
|
|
101
|
+
item: item2
|
|
92
102
|
});
|
|
93
103
|
setOptions(list);
|
|
94
104
|
};
|
|
95
|
-
|
|
96
|
-
const [selectedValues, setSelectedValues] = useState([]);
|
|
97
|
-
const [confirmValues, setConfirmValues] = useState([]);
|
|
98
|
-
return /* @__PURE__ */ jsx(Fragment, { children: item.input === "mult-select" ? /* @__PURE__ */ jsxs("div", { style: { width: "100%", ...style }, children: [
|
|
105
|
+
return /* @__PURE__ */ jsx(Fragment, { children: item2.input === "mult-select" ? /* @__PURE__ */ jsxs("div", { style: { width: "100%", ...style }, children: [
|
|
99
106
|
/* @__PURE__ */ jsx(
|
|
100
107
|
Field,
|
|
101
108
|
{
|
|
@@ -109,7 +116,7 @@ const MySelect = ({
|
|
|
109
116
|
setSelectedValues([...confirmValues]);
|
|
110
117
|
setShowPopup(true);
|
|
111
118
|
},
|
|
112
|
-
placeholder: langId === "10001" ? (
|
|
119
|
+
placeholder: langId === "10001" ? (item2 == null ? void 0 : item2["default-prompt"]) || "请选择" : (item2 == null ? void 0 : item2["default-prompt"]) || "Please select"
|
|
113
120
|
}
|
|
114
121
|
),
|
|
115
122
|
/* @__PURE__ */ jsx(
|
|
@@ -135,14 +142,38 @@ const MySelect = ({
|
|
|
135
142
|
}
|
|
136
143
|
)
|
|
137
144
|
] }),
|
|
145
|
+
(item2 == null ? void 0 : item2["custom-operation"]) && item2.input === "mult-select" && ((_a = item2 == null ? void 0 : item2["operation-types"]) == null ? void 0 : _a.includes("check-all")) && /* @__PURE__ */ jsx("div", { className: styles["checkbox-group-check-all"], children: /* @__PURE__ */ jsx(
|
|
146
|
+
Checkbox,
|
|
147
|
+
{
|
|
148
|
+
className: styles["item"],
|
|
149
|
+
shape: "square",
|
|
150
|
+
checked: isAllChecked,
|
|
151
|
+
onChange: (v) => {
|
|
152
|
+
setIsAllChecked(v);
|
|
153
|
+
setSelectedValues(v ? options.map((item22) => item22.value) : []);
|
|
154
|
+
},
|
|
155
|
+
children: langId === "10001" ? "全选" : "check all"
|
|
156
|
+
}
|
|
157
|
+
) }),
|
|
138
158
|
/* @__PURE__ */ jsx(
|
|
139
159
|
"div",
|
|
140
160
|
{
|
|
141
161
|
style: {
|
|
142
|
-
height: " calc(60vh -
|
|
162
|
+
height: " calc(60vh - 126px)"
|
|
143
163
|
},
|
|
144
164
|
className: styles["checkbox-group-content"],
|
|
145
|
-
children: /* @__PURE__ */ jsx(
|
|
165
|
+
children: /* @__PURE__ */ jsx(
|
|
166
|
+
Checkbox.Group,
|
|
167
|
+
{
|
|
168
|
+
iconSize: "18",
|
|
169
|
+
onChange: (v) => {
|
|
170
|
+
setSelectedValues(v);
|
|
171
|
+
setIsAllChecked((v == null ? void 0 : v.length) === (options == null ? void 0 : options.length));
|
|
172
|
+
},
|
|
173
|
+
value: selectedValues,
|
|
174
|
+
children: options.map((item22) => /* @__PURE__ */ jsx(Checkbox, { shape: "square", className: styles["checkbox-item"], name: item22.value, children: item22.label }, item22.value))
|
|
175
|
+
}
|
|
176
|
+
)
|
|
146
177
|
}
|
|
147
178
|
)
|
|
148
179
|
] })
|
|
@@ -158,8 +189,8 @@ const MySelect = ({
|
|
|
158
189
|
text: "label"
|
|
159
190
|
},
|
|
160
191
|
onConfirm: (val) => {
|
|
161
|
-
if (attrid && (instanceList == null ? void 0 : instanceList.length) > 0 && (
|
|
162
|
-
const keyField =
|
|
192
|
+
if (attrid && (instanceList == null ? void 0 : instanceList.length) > 0 && (item2 == null ? void 0 : item2.inputType) === "instance-url") {
|
|
193
|
+
const keyField = item2 == null ? void 0 : item2["key-field"];
|
|
163
194
|
const row = findRowByValue(instanceList, String(val));
|
|
164
195
|
const keys = Object.keys(keyField || {});
|
|
165
196
|
const newObj = keys == null ? void 0 : keys.reduce((prev, cur) => {
|
|
@@ -174,16 +205,16 @@ const MySelect = ({
|
|
|
174
205
|
onChange(val);
|
|
175
206
|
},
|
|
176
207
|
children: (val, _, actions) => {
|
|
177
|
-
var
|
|
208
|
+
var _a2;
|
|
178
209
|
val = val || value;
|
|
179
210
|
let str = "";
|
|
180
211
|
if (Array.isArray(val)) {
|
|
181
212
|
str = (val == null ? void 0 : val.map((v) => {
|
|
182
|
-
var
|
|
183
|
-
return ((
|
|
213
|
+
var _a3;
|
|
214
|
+
return ((_a3 = options.find((x) => x.value === v)) == null ? void 0 : _a3.label) || v;
|
|
184
215
|
}).join(",")) || "";
|
|
185
216
|
}
|
|
186
|
-
str = ((
|
|
217
|
+
str = ((_a2 = options.find((v) => v.value === val)) == null ? void 0 : _a2.label) || val;
|
|
187
218
|
return /* @__PURE__ */ jsx(
|
|
188
219
|
Field,
|
|
189
220
|
{
|
|
@@ -191,7 +222,7 @@ const MySelect = ({
|
|
|
191
222
|
isLink: true,
|
|
192
223
|
readOnly: true,
|
|
193
224
|
clickable: true,
|
|
194
|
-
placeholder: langId === "10001" ? (
|
|
225
|
+
placeholder: langId === "10001" ? (item2 == null ? void 0 : item2["default-prompt"]) || "请选择" : (item2 == null ? void 0 : item2["default-prompt"]) || "Please select",
|
|
195
226
|
value: str,
|
|
196
227
|
onClick: () => {
|
|
197
228
|
if (readonly)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IformConfigItem, IformItemStyle } from '../DynamicForm/index.d';
|
|
3
|
-
import { AxiosResponse } from 'axios';
|
|
4
2
|
import { FormListFieldData, UploadFile } from 'antd';
|
|
3
|
+
import { IformConfigItem, IformItemStyle } from '../DynamicForm/index.d';
|
|
5
4
|
import { FormInstance } from 'react-vant';
|
|
5
|
+
import { AxiosResponse } from 'axios';
|
|
6
6
|
interface IDynamicFormProps {
|
|
7
7
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
8
8
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|