szld-libs 0.4.49 → 0.4.51
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 +20249 -19514
- package/dist/szld-components.umd.js +229 -113
- package/es/components/DynamicForm/func.d.ts +2 -2
- package/es/components/DynamicForm/func.js +12 -7
- package/es/components/DynamicForm/index.d.ts +1 -0
- package/es/components/DynamicForm/index.js +41 -7
- package/es/components/DynamicForm/myCascader/index.d.ts +2 -1
- package/es/components/DynamicForm/myCascader/index.js +9 -11
- package/es/components/DynamicForm/myRadio/index.d.ts +5 -1
- package/es/components/DynamicForm/myRadio/index.js +63 -17
- package/es/components/DynamicForm/myRichText/index.d.ts +3 -1
- package/es/components/DynamicForm/myRichText/index.js +20 -30
- package/es/components/DynamicForm/mySelect/index.js +1 -1
- package/es/components/DynamicForm/selectModelBackfillFormItem/index.js +1 -1
- package/es/components/DynamicForm/useDynamicForm.d.ts +1 -0
- package/es/components/DynamicForm/useDynamicForm.js +23 -19
- 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 +1 -1
- package/es/utils/szxkFunc.d.ts +11 -0
- package/es/utils/szxkFunc.js +25 -0
- package/lib/components/DynamicForm/func.d.ts +2 -2
- package/lib/components/DynamicForm/func.js +12 -7
- package/lib/components/DynamicForm/index.d.ts +1 -0
- package/lib/components/DynamicForm/index.js +38 -4
- package/lib/components/DynamicForm/myCascader/index.d.ts +2 -1
- package/lib/components/DynamicForm/myCascader/index.js +9 -11
- package/lib/components/DynamicForm/myRadio/index.d.ts +5 -1
- package/lib/components/DynamicForm/myRadio/index.js +61 -15
- package/lib/components/DynamicForm/myRichText/index.d.ts +3 -1
- package/lib/components/DynamicForm/myRichText/index.js +19 -29
- package/lib/components/DynamicForm/mySelect/index.js +1 -1
- package/lib/components/DynamicForm/selectModelBackfillFormItem/index.js +1 -1
- package/lib/components/DynamicForm/useDynamicForm.d.ts +1 -0
- package/lib/components/DynamicForm/useDynamicForm.js +19 -15
- 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 +1 -1
- package/lib/utils/szxkFunc.d.ts +11 -0
- package/lib/utils/szxkFunc.js +25 -0
- 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
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const react$1 = require("@tiptap/react");
|
|
4
|
+
const StarterKit = require("@tiptap/starter-kit");
|
|
5
|
+
const extensionTextStyle = require("@tiptap/extension-text-style");
|
|
6
|
+
const TextAlign = require("@tiptap/extension-text-align");
|
|
7
|
+
const Highlight = require("@tiptap/extension-highlight");
|
|
8
|
+
const FontSize = require("@tiptap/extension-font-size");
|
|
9
|
+
const Color = require("@tiptap/extension-color");
|
|
10
|
+
const react = require("react");
|
|
11
|
+
const reactVant = require("react-vant");
|
|
12
|
+
const lucideReact = require("lucide-react");
|
|
13
|
+
const enmu = require("./enmu");
|
|
14
|
+
const MyRichText = ({ item, readonly, style, value, langId, onChange }) => {
|
|
15
|
+
const [showFontSizePicker, setShowFontSizePicker] = react.useState(false);
|
|
16
|
+
const [showColorPicker, setShowColorPicker] = react.useState(false);
|
|
17
|
+
const [selectedSize, setSelectedSize] = react.useState("16px");
|
|
18
|
+
const [selectedColor, setSelectedColor] = react.useState("#1677ff");
|
|
19
|
+
react.useEffect(() => {
|
|
20
|
+
const styleSheet = document.createElement("style");
|
|
21
|
+
styleSheet.textContent = `
|
|
22
|
+
.MyRichText_ProseMirror {
|
|
23
|
+
min-height: 200px !important;
|
|
24
|
+
outline: none !important;
|
|
25
|
+
box-shadow: none !important;
|
|
26
|
+
border: none !important;
|
|
27
|
+
padding: 12px;
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
line-height: 1.6;
|
|
30
|
+
}
|
|
31
|
+
.MyRichText_ProseMirror:focus,
|
|
32
|
+
.MyRichText_ProseMirror:focus-visible {
|
|
33
|
+
outline: none !important;
|
|
34
|
+
box-shadow: none !important;
|
|
35
|
+
border: none !important;
|
|
36
|
+
}
|
|
37
|
+
.MyRichText_ProseMirror p {
|
|
38
|
+
min-height: 1.5em;
|
|
39
|
+
margin: 0 0 8px 0;
|
|
40
|
+
padding: 0;
|
|
41
|
+
}
|
|
42
|
+
.MyRichText_ProseMirror h1,
|
|
43
|
+
.MyRichText_ProseMirror h2,
|
|
44
|
+
.MyRichText_ProseMirror h3 {
|
|
45
|
+
margin: 12px 0;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
document.head.appendChild(styleSheet);
|
|
49
|
+
return () => {
|
|
50
|
+
document.head.removeChild(styleSheet);
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
53
|
+
const editor = react$1.useEditor({
|
|
54
|
+
extensions: [
|
|
55
|
+
StarterKit,
|
|
56
|
+
Highlight.configure({ multicolor: true }),
|
|
57
|
+
TextAlign.configure({
|
|
58
|
+
types: ["heading", "paragraph"]
|
|
59
|
+
}),
|
|
60
|
+
extensionTextStyle.TextStyle,
|
|
61
|
+
FontSize,
|
|
62
|
+
Color.configure({
|
|
63
|
+
types: ["textStyle"]
|
|
64
|
+
})
|
|
65
|
+
],
|
|
66
|
+
content: value || "<p><br /></p>",
|
|
67
|
+
editable: !readonly,
|
|
68
|
+
editorProps: {
|
|
69
|
+
attributes: {
|
|
70
|
+
class: "MyRichText_ProseMirror"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
onUpdate: ({ editor: editor2 }) => {
|
|
74
|
+
onChange(editor2.getHTML());
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
if (!editor) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const formatButtons = [
|
|
81
|
+
{
|
|
82
|
+
key: "bold",
|
|
83
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bold, { size: 18 }),
|
|
84
|
+
label: "粗",
|
|
85
|
+
action: () => editor.chain().focus().toggleBold().run(),
|
|
86
|
+
active: "bold"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: "italic",
|
|
90
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Italic, { size: 18 }),
|
|
91
|
+
label: "斜",
|
|
92
|
+
action: () => editor.chain().focus().toggleItalic().run(),
|
|
93
|
+
active: "italic"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
key: "underline",
|
|
97
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Underline, { size: 18 }),
|
|
98
|
+
label: "下",
|
|
99
|
+
action: () => editor.chain().focus().toggleUnderline().run(),
|
|
100
|
+
active: "underline"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: "strike",
|
|
104
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Strikethrough, { size: 18 }),
|
|
105
|
+
label: "删",
|
|
106
|
+
action: () => editor.chain().focus().toggleStrike().run(),
|
|
107
|
+
active: "strike"
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
const alignButtons = [
|
|
111
|
+
{
|
|
112
|
+
key: "align-left",
|
|
113
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignLeft, { size: 18 }),
|
|
114
|
+
label: "左",
|
|
115
|
+
action: () => editor.chain().focus().setTextAlign("left").run(),
|
|
116
|
+
active: { textAlign: "left" }
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
key: "align-center",
|
|
120
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignCenter, { size: 18 }),
|
|
121
|
+
label: "中",
|
|
122
|
+
action: () => editor.chain().focus().setTextAlign("center").run(),
|
|
123
|
+
active: { textAlign: "center" }
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
key: "align-right",
|
|
127
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignRight, { size: 18 }),
|
|
128
|
+
label: "右",
|
|
129
|
+
action: () => editor.chain().focus().setTextAlign("right").run(),
|
|
130
|
+
active: { textAlign: "right" }
|
|
131
|
+
}
|
|
132
|
+
];
|
|
133
|
+
const listButtons = [
|
|
134
|
+
{
|
|
135
|
+
key: "bulletList",
|
|
136
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { size: 18 }),
|
|
137
|
+
label: "列",
|
|
138
|
+
action: () => editor.chain().focus().toggleBulletList().run(),
|
|
139
|
+
active: "bulletList"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
key: "orderedList",
|
|
143
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListOrdered, { size: 20 }),
|
|
144
|
+
label: "序",
|
|
145
|
+
action: () => editor.chain().focus().toggleOrderedList().run(),
|
|
146
|
+
active: "orderedList"
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
const handleFontSizeChange = (size) => {
|
|
150
|
+
setSelectedSize(size);
|
|
151
|
+
editor.chain().focus().setFontSize(size).run();
|
|
152
|
+
setShowFontSizePicker(false);
|
|
153
|
+
};
|
|
154
|
+
const handleColorChange = (color) => {
|
|
155
|
+
setSelectedColor(color);
|
|
156
|
+
editor.chain().focus().setColor(color).run();
|
|
157
|
+
setShowColorPicker(false);
|
|
158
|
+
};
|
|
159
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...style, border: "1px solid #eee", borderRadius: 8, overflow: "hidden", backgroundColor: "#fff" }, children: [
|
|
160
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
161
|
+
"div",
|
|
162
|
+
{
|
|
163
|
+
style: {
|
|
164
|
+
padding: "8px 12px",
|
|
165
|
+
background: "#f8f9fa",
|
|
166
|
+
borderBottom: "1px solid #eee"
|
|
167
|
+
},
|
|
168
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(reactVant.Space, { wrap: true, children: [
|
|
169
|
+
formatButtons.map((btn) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
170
|
+
reactVant.Button,
|
|
171
|
+
{
|
|
172
|
+
size: "small",
|
|
173
|
+
type: editor.isActive(btn.active) ? "primary" : "default",
|
|
174
|
+
plain: true,
|
|
175
|
+
onClick: btn.action,
|
|
176
|
+
disabled: readonly,
|
|
177
|
+
icon: btn.icon
|
|
178
|
+
},
|
|
179
|
+
btn.key
|
|
180
|
+
)),
|
|
181
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactVant.Button, { size: "small", plain: true, onClick: () => setShowFontSizePicker(true), disabled: readonly, children: selectedSize }),
|
|
182
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
183
|
+
reactVant.Button,
|
|
184
|
+
{
|
|
185
|
+
size: "small",
|
|
186
|
+
plain: true,
|
|
187
|
+
onClick: () => setShowColorPicker(true),
|
|
188
|
+
disabled: readonly,
|
|
189
|
+
style: {
|
|
190
|
+
width: "32px",
|
|
191
|
+
height: "32px",
|
|
192
|
+
backgroundColor: selectedColor,
|
|
193
|
+
borderRadius: "4px"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
alignButtons.map((btn) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
198
|
+
reactVant.Button,
|
|
199
|
+
{
|
|
200
|
+
size: "small",
|
|
201
|
+
type: editor.isActive(btn.active) ? "primary" : "default",
|
|
202
|
+
plain: true,
|
|
203
|
+
onClick: btn.action,
|
|
204
|
+
disabled: readonly,
|
|
205
|
+
icon: btn.icon
|
|
206
|
+
},
|
|
207
|
+
btn.key
|
|
208
|
+
)),
|
|
209
|
+
listButtons.map((btn) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
210
|
+
reactVant.Button,
|
|
211
|
+
{
|
|
212
|
+
size: "small",
|
|
213
|
+
type: editor.isActive(btn.active) ? "primary" : "default",
|
|
214
|
+
plain: true,
|
|
215
|
+
onClick: btn.action,
|
|
216
|
+
disabled: readonly,
|
|
217
|
+
icon: btn.icon
|
|
218
|
+
},
|
|
219
|
+
btn.key
|
|
220
|
+
)),
|
|
221
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
222
|
+
reactVant.Button,
|
|
223
|
+
{
|
|
224
|
+
size: "small",
|
|
225
|
+
plain: true,
|
|
226
|
+
onClick: () => editor.chain().focus().undo().run(),
|
|
227
|
+
disabled: readonly || !editor.can().undo(),
|
|
228
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Undo, { size: 18 })
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
232
|
+
reactVant.Button,
|
|
233
|
+
{
|
|
234
|
+
size: "small",
|
|
235
|
+
plain: true,
|
|
236
|
+
onClick: () => editor.chain().focus().redo().run(),
|
|
237
|
+
disabled: readonly || !editor.can().redo(),
|
|
238
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Redo, { size: 18 })
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] })
|
|
242
|
+
}
|
|
243
|
+
),
|
|
244
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => editor.chain().focus().run(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
245
|
+
react$1.EditorContent,
|
|
246
|
+
{
|
|
247
|
+
editor,
|
|
248
|
+
style: {
|
|
249
|
+
minHeight: 200,
|
|
250
|
+
outline: "none",
|
|
251
|
+
backgroundColor: "#fff"
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
) }),
|
|
255
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactVant.Popup, { visible: showFontSizePicker, position: "bottom", onClose: () => setShowFontSizePicker(false), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "20px" }, children: [
|
|
256
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: { textAlign: "center", marginBottom: "16px", fontSize: "16px", fontWeight: "bold" }, children: "选择字体大小" }),
|
|
257
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactVant.Space, { wrap: true, style: { justifyContent: "center" }, children: enmu.fontSizes.map((size) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
258
|
+
reactVant.Button,
|
|
259
|
+
{
|
|
260
|
+
size: "small",
|
|
261
|
+
type: selectedSize === size.value ? "primary" : "default",
|
|
262
|
+
onClick: () => handleFontSizeChange(size.value),
|
|
263
|
+
style: { padding: "8px 16px", margin: "4px" },
|
|
264
|
+
children: size.label
|
|
265
|
+
},
|
|
266
|
+
size.value
|
|
267
|
+
)) })
|
|
268
|
+
] }) }),
|
|
269
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactVant.Popup, { visible: showColorPicker, position: "bottom", onClose: () => setShowColorPicker(false), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "20px" }, children: [
|
|
270
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: { textAlign: "center", marginBottom: "16px", fontSize: "16px", fontWeight: "bold" }, children: "选择文字颜色" }),
|
|
271
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactVant.Space, { wrap: true, children: enmu.colors.map((color) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
272
|
+
reactVant.Button,
|
|
273
|
+
{
|
|
274
|
+
size: "small",
|
|
275
|
+
plain: true,
|
|
276
|
+
onClick: () => handleColorChange(color),
|
|
277
|
+
style: {
|
|
278
|
+
width: "24px",
|
|
279
|
+
height: "24px",
|
|
280
|
+
borderRadius: "50%",
|
|
281
|
+
backgroundColor: color,
|
|
282
|
+
margin: "4px"
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
color
|
|
286
|
+
)) })
|
|
287
|
+
] }) })
|
|
288
|
+
] });
|
|
289
|
+
};
|
|
290
|
+
module.exports = MyRichText;
|
|
@@ -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,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const szxkFunc = require("../../../utils/szxkFunc");
|
|
3
4
|
const func = require("../../DynamicForm/func");
|
|
4
5
|
const reactVant = require("react-vant");
|
|
5
6
|
const react = require("react");
|
|
6
7
|
const antd = require("antd");
|
|
7
|
-
const szxkFunc = require("../../../utils/szxkFunc");
|
|
8
8
|
const checkboxGroup = "index-module_checkbox-group_4684b";
|
|
9
9
|
const checkboxGroupHeader = "index-module_checkbox-group-header_192bd";
|
|
10
10
|
const checkboxGroupContent = "index-module_checkbox-group-content_f81a1";
|
|
11
11
|
const checkboxItem = "index-module_checkbox-item_1b36c";
|
|
12
12
|
const checkboxGroupCancel = "index-module_checkbox-group-cancel_c5cfb";
|
|
13
|
+
const checkboxGroupCheckAll = "index-module_checkbox-group-check-all_1e608";
|
|
14
|
+
const item = "index-module_item_4fef5";
|
|
13
15
|
const styles = {
|
|
14
16
|
"checkbox-group": "index-module_checkbox-group_4684b",
|
|
15
17
|
checkboxGroup,
|
|
@@ -20,10 +22,13 @@ const styles = {
|
|
|
20
22
|
"checkbox-item": "index-module_checkbox-item_1b36c",
|
|
21
23
|
checkboxItem,
|
|
22
24
|
"checkbox-group-cancel": "index-module_checkbox-group-cancel_c5cfb",
|
|
23
|
-
checkboxGroupCancel
|
|
25
|
+
checkboxGroupCancel,
|
|
26
|
+
"checkbox-group-check-all": "index-module_checkbox-group-check-all_1e608",
|
|
27
|
+
checkboxGroupCheckAll,
|
|
28
|
+
item
|
|
24
29
|
};
|
|
25
30
|
const MySelect = ({
|
|
26
|
-
item,
|
|
31
|
+
item: item2,
|
|
27
32
|
readonly,
|
|
28
33
|
style,
|
|
29
34
|
commonRequestWidthParams,
|
|
@@ -38,29 +43,34 @@ const MySelect = ({
|
|
|
38
43
|
getTitle,
|
|
39
44
|
attrid
|
|
40
45
|
}) => {
|
|
46
|
+
var _a;
|
|
41
47
|
const [options, setOptions] = react.useState([]);
|
|
42
48
|
const [instanceList, setInstanceList] = react.useState([]);
|
|
49
|
+
const [isAllChecked, setIsAllChecked] = react.useState(false);
|
|
50
|
+
const [showPopup, setShowPopup] = react.useState(false);
|
|
51
|
+
const [selectedValues, setSelectedValues] = react.useState([]);
|
|
52
|
+
const [confirmValues, setConfirmValues] = react.useState([]);
|
|
43
53
|
react.useEffect(() => {
|
|
44
|
-
if (
|
|
54
|
+
if (item2.input === "mult-select" && value && Array.isArray(value)) {
|
|
45
55
|
setSelectedValues(value || []);
|
|
46
56
|
setConfirmValues(value || []);
|
|
47
57
|
}
|
|
48
58
|
}, [value]);
|
|
49
59
|
react.useEffect(() => {
|
|
50
60
|
handleLoadOptions();
|
|
51
|
-
}, [
|
|
61
|
+
}, [item2.inputType, item2.classify, item2.data, item2.options]);
|
|
52
62
|
const handleLoadOptions = async () => {
|
|
53
|
-
if (
|
|
54
|
-
const keyField =
|
|
63
|
+
if (item2.inputType === "instance-url" && (item2 == null ? void 0 : item2["instance-source-number"]) && attrid) {
|
|
64
|
+
const keyField = item2 == null ? void 0 : item2["key-field"];
|
|
55
65
|
if (!keyField) {
|
|
56
66
|
reactVant.Toast("请配置key-field");
|
|
57
67
|
return;
|
|
58
68
|
}
|
|
59
69
|
const params = {
|
|
60
|
-
"source-number":
|
|
70
|
+
"source-number": item2 == null ? void 0 : item2["instance-source-number"]
|
|
61
71
|
};
|
|
62
72
|
let list2 = await szxkFunc.handleGetList(params, commonRequestWidthParams);
|
|
63
|
-
const controlPanelConfig = await szxkFunc.handleGetControlPanelConfig(
|
|
73
|
+
const controlPanelConfig = await szxkFunc.handleGetControlPanelConfig(item2 == null ? void 0 : item2["instance-source-number"], commonRequest);
|
|
64
74
|
if (controlPanelConfig) {
|
|
65
75
|
const nonUniversalHeader = (controlPanelConfig == null ? void 0 : controlPanelConfig["non-universal-header"]) || [];
|
|
66
76
|
const labelConfig = (nonUniversalHeader == null ? void 0 : nonUniversalHeader["label"]) || [];
|
|
@@ -89,14 +99,11 @@ const MySelect = ({
|
|
|
89
99
|
interfaceTypeSysDict,
|
|
90
100
|
actionUrlKey,
|
|
91
101
|
actionUrlExtraParams,
|
|
92
|
-
item
|
|
102
|
+
item: item2
|
|
93
103
|
});
|
|
94
104
|
setOptions(list);
|
|
95
105
|
};
|
|
96
|
-
|
|
97
|
-
const [selectedValues, setSelectedValues] = react.useState([]);
|
|
98
|
-
const [confirmValues, setConfirmValues] = react.useState([]);
|
|
99
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: item.input === "mult-select" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", ...style }, children: [
|
|
106
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: item2.input === "mult-select" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", ...style }, children: [
|
|
100
107
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
101
108
|
reactVant.Field,
|
|
102
109
|
{
|
|
@@ -110,7 +117,7 @@ const MySelect = ({
|
|
|
110
117
|
setSelectedValues([...confirmValues]);
|
|
111
118
|
setShowPopup(true);
|
|
112
119
|
},
|
|
113
|
-
placeholder: langId === "10001" ? (
|
|
120
|
+
placeholder: langId === "10001" ? (item2 == null ? void 0 : item2["default-prompt"]) || "请选择" : (item2 == null ? void 0 : item2["default-prompt"]) || "Please select"
|
|
114
121
|
}
|
|
115
122
|
),
|
|
116
123
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -136,14 +143,38 @@ const MySelect = ({
|
|
|
136
143
|
}
|
|
137
144
|
)
|
|
138
145
|
] }),
|
|
146
|
+
(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__ */ jsxRuntime.jsx("div", { className: styles["checkbox-group-check-all"], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
147
|
+
reactVant.Checkbox,
|
|
148
|
+
{
|
|
149
|
+
className: styles["item"],
|
|
150
|
+
shape: "square",
|
|
151
|
+
checked: isAllChecked,
|
|
152
|
+
onChange: (v) => {
|
|
153
|
+
setIsAllChecked(v);
|
|
154
|
+
setSelectedValues(v ? options.map((item22) => item22.value) : []);
|
|
155
|
+
},
|
|
156
|
+
children: langId === "10001" ? "全选" : "check all"
|
|
157
|
+
}
|
|
158
|
+
) }),
|
|
139
159
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
140
160
|
"div",
|
|
141
161
|
{
|
|
142
162
|
style: {
|
|
143
|
-
height: " calc(60vh -
|
|
163
|
+
height: " calc(60vh - 126px)"
|
|
144
164
|
},
|
|
145
165
|
className: styles["checkbox-group-content"],
|
|
146
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
167
|
+
reactVant.Checkbox.Group,
|
|
168
|
+
{
|
|
169
|
+
iconSize: "18",
|
|
170
|
+
onChange: (v) => {
|
|
171
|
+
setSelectedValues(v);
|
|
172
|
+
setIsAllChecked((v == null ? void 0 : v.length) === (options == null ? void 0 : options.length));
|
|
173
|
+
},
|
|
174
|
+
value: selectedValues,
|
|
175
|
+
children: options.map((item22) => /* @__PURE__ */ jsxRuntime.jsx(reactVant.Checkbox, { shape: "square", className: styles["checkbox-item"], name: item22.value, children: item22.label }, item22.value))
|
|
176
|
+
}
|
|
177
|
+
)
|
|
147
178
|
}
|
|
148
179
|
)
|
|
149
180
|
] })
|
|
@@ -159,8 +190,8 @@ const MySelect = ({
|
|
|
159
190
|
text: "label"
|
|
160
191
|
},
|
|
161
192
|
onConfirm: (val) => {
|
|
162
|
-
if (attrid && (instanceList == null ? void 0 : instanceList.length) > 0 && (
|
|
163
|
-
const keyField =
|
|
193
|
+
if (attrid && (instanceList == null ? void 0 : instanceList.length) > 0 && (item2 == null ? void 0 : item2.inputType) === "instance-url") {
|
|
194
|
+
const keyField = item2 == null ? void 0 : item2["key-field"];
|
|
164
195
|
const row = func.findRowByValue(instanceList, String(val));
|
|
165
196
|
const keys = Object.keys(keyField || {});
|
|
166
197
|
const newObj = keys == null ? void 0 : keys.reduce((prev, cur) => {
|
|
@@ -175,16 +206,16 @@ const MySelect = ({
|
|
|
175
206
|
onChange(val);
|
|
176
207
|
},
|
|
177
208
|
children: (val, _, actions) => {
|
|
178
|
-
var
|
|
209
|
+
var _a2;
|
|
179
210
|
val = val || value;
|
|
180
211
|
let str = "";
|
|
181
212
|
if (Array.isArray(val)) {
|
|
182
213
|
str = (val == null ? void 0 : val.map((v) => {
|
|
183
|
-
var
|
|
184
|
-
return ((
|
|
214
|
+
var _a3;
|
|
215
|
+
return ((_a3 = options.find((x) => x.value === v)) == null ? void 0 : _a3.label) || v;
|
|
185
216
|
}).join(",")) || "";
|
|
186
217
|
}
|
|
187
|
-
str = ((
|
|
218
|
+
str = ((_a2 = options.find((v) => v.value === val)) == null ? void 0 : _a2.label) || val;
|
|
188
219
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
189
220
|
reactVant.Field,
|
|
190
221
|
{
|
|
@@ -192,7 +223,7 @@ const MySelect = ({
|
|
|
192
223
|
isLink: true,
|
|
193
224
|
readOnly: true,
|
|
194
225
|
clickable: true,
|
|
195
|
-
placeholder: langId === "10001" ? (
|
|
226
|
+
placeholder: langId === "10001" ? (item2 == null ? void 0 : item2["default-prompt"]) || "请选择" : (item2 == null ? void 0 : item2["default-prompt"]) || "Please select",
|
|
196
227
|
value: str,
|
|
197
228
|
onClick: () => {
|
|
198
229
|
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>>;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const icons = require("@ant-design/icons");
|
|
4
|
-
const
|
|
4
|
+
const antd = require("antd");
|
|
5
5
|
const method = require("../../utils/method");
|
|
6
|
+
const func = require("./func");
|
|
6
7
|
const SelectModelBackfillFormItem = require("./selectModelBackfillFormItem");
|
|
8
|
+
const reactVant = require("react-vant");
|
|
7
9
|
const react = require("react");
|
|
8
10
|
const isoWeek = require("dayjs/plugin/isoWeek");
|
|
9
11
|
const SelectModel = require("./selectModel");
|
|
10
12
|
const MyCheckbox = require("./myCheckbox");
|
|
11
13
|
const MyCascader = require("./myCascader");
|
|
14
|
+
const MyCalendar = require("./myCalendar");
|
|
15
|
+
const MyRichText = require("./myRichText");
|
|
12
16
|
const dayjs = require("dayjs");
|
|
13
17
|
const RadioCard = require("./radioCard");
|
|
14
18
|
const MySelect = require("./mySelect");
|
|
15
19
|
const MyUpload = require("./myUpload");
|
|
16
20
|
const MyRadio = require("./myRadio");
|
|
17
|
-
const antd = require("antd");
|
|
18
|
-
const reactVant = require("react-vant");
|
|
19
|
-
const MyCalendar = require("./myCalendar");
|
|
20
21
|
dayjs.extend(isoWeek);
|
|
21
22
|
function useDynamicForm(props) {
|
|
22
23
|
const {
|
|
@@ -758,6 +759,20 @@ function useDynamicForm(props) {
|
|
|
758
759
|
commonRequestWidthParams
|
|
759
760
|
}
|
|
760
761
|
);
|
|
762
|
+
case "rich-text":
|
|
763
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
764
|
+
MyRichText,
|
|
765
|
+
{
|
|
766
|
+
langId,
|
|
767
|
+
readonly,
|
|
768
|
+
item: item.json,
|
|
769
|
+
onChange: (val) => {
|
|
770
|
+
form.setFieldValue(item.attrid, val);
|
|
771
|
+
},
|
|
772
|
+
value: formatValue,
|
|
773
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
774
|
+
}
|
|
775
|
+
);
|
|
761
776
|
default:
|
|
762
777
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
763
778
|
reactVant.Input,
|
package/lib/index.js
CHANGED
|
@@ -16,7 +16,7 @@ const Demo = () => {
|
|
|
16
16
|
const formRef = react.useRef(null);
|
|
17
17
|
const [form] = antd.Form.useForm();
|
|
18
18
|
const [list, setList] = react.useState([]);
|
|
19
|
-
const [langId, setLangId] = react.useState("");
|
|
19
|
+
const [langId, setLangId] = react.useState("10002");
|
|
20
20
|
const onValuesChange = async (values, allValues) => {
|
|
21
21
|
};
|
|
22
22
|
react.useEffect(() => {
|
package/lib/utils/szxkFunc.d.ts
CHANGED
|
@@ -70,3 +70,14 @@ export declare const handleFormatMobileDate: (values: Record<string, any>, forma
|
|
|
70
70
|
export declare const handleNonUniversalHeader: (nonUniversalHeader: Record<string, string>, data: Record<string, any>) => Record<string, any>;
|
|
71
71
|
export declare const handleGetControlPanelConfig: (sourceNumber: string | number, commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>) => Promise<any>;
|
|
72
72
|
export declare const isJson: (str: string) => boolean;
|
|
73
|
+
export declare const getLangData: ({ commonRequestWidthParams, params, interfaceConfig, langId, }: {
|
|
74
|
+
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
75
|
+
params: {
|
|
76
|
+
sysid: string;
|
|
77
|
+
pageid?: string;
|
|
78
|
+
dataid?: string;
|
|
79
|
+
dicid?: string;
|
|
80
|
+
};
|
|
81
|
+
interfaceConfig?: Record<string, string> | undefined;
|
|
82
|
+
langId: string | undefined;
|
|
83
|
+
}) => Promise<any>;
|
package/lib/utils/szxkFunc.js
CHANGED
|
@@ -109,6 +109,31 @@ const isJson = (str) => {
|
|
|
109
109
|
return false;
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
|
+
const getLangData = async ({
|
|
113
|
+
commonRequestWidthParams,
|
|
114
|
+
params,
|
|
115
|
+
interfaceConfig = {
|
|
116
|
+
PageName: "dns_relay",
|
|
117
|
+
Controlname: "Connon_Control",
|
|
118
|
+
InterfaceType: "YYGLOpenList"
|
|
119
|
+
},
|
|
120
|
+
langId
|
|
121
|
+
}) => {
|
|
122
|
+
var _a;
|
|
123
|
+
try {
|
|
124
|
+
if (!langId)
|
|
125
|
+
return [];
|
|
126
|
+
langId = String(langId);
|
|
127
|
+
const res = await commonRequestWidthParams(interfaceConfig, params);
|
|
128
|
+
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
129
|
+
const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
130
|
+
return (list == null ? void 0 : list.filter((item) => item.dicid === langId)) || [];
|
|
131
|
+
}
|
|
132
|
+
return [];
|
|
133
|
+
} catch (error) {
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
exports.getLangData = getLangData;
|
|
112
137
|
exports.handleCallSupportCode = handleCallSupportCode;
|
|
113
138
|
exports.handleFormatMobileDate = handleFormatMobileDate;
|
|
114
139
|
exports.handleGetAttrDetail = handleGetAttrDetail;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "szld-libs",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.51",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"crypto-js": "^4.2.0",
|
|
25
25
|
"dayjs": "^1.11.19",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
|
+
"lucide-react": "^1.21.0",
|
|
27
28
|
"pako": "^2.1.0",
|
|
28
29
|
"query-string": "^9.3.1",
|
|
29
30
|
"react": "^18.2.0",
|