szld-libs 0.2.3 → 0.2.5
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/szld-components.es.js +1512 -1527
- package/dist/szld-components.umd.js +24 -25
- package/es/components/CreateForm/index.js +13 -13
- package/es/components/EditTable/index.js +0 -2
- package/es/index.js +56 -197
- package/lib/components/CreateForm/index.js +13 -13
- package/lib/components/EditTable/index.js +0 -2
- package/lib/index.js +53 -194
- package/package.json +2 -3
|
@@ -114,7 +114,7 @@ const CreateForm = (props) => {
|
|
|
114
114
|
const FormFields = (props) => {
|
|
115
115
|
const { valueType, valueProps, value, onChange, onBtnClick, inputRef } = props;
|
|
116
116
|
const children = useMemo(() => {
|
|
117
|
-
let result = /* @__PURE__ */ jsx(Input, { placeholder: "请输入",
|
|
117
|
+
let result = /* @__PURE__ */ jsx(Input, { placeholder: "请输入", allowClear: true, ...valueProps });
|
|
118
118
|
switch (valueType) {
|
|
119
119
|
case "rate":
|
|
120
120
|
result = /* @__PURE__ */ jsx(Rate, { ...valueProps });
|
|
@@ -133,8 +133,8 @@ const FormFields = (props) => {
|
|
|
133
133
|
Select,
|
|
134
134
|
{
|
|
135
135
|
placeholder: "请选择",
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
allowClear: true,
|
|
137
|
+
...valueProps
|
|
138
138
|
}
|
|
139
139
|
);
|
|
140
140
|
break;
|
|
@@ -153,8 +153,8 @@ const FormFields = (props) => {
|
|
|
153
153
|
Input.TextArea,
|
|
154
154
|
{
|
|
155
155
|
placeholder: "请输入",
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
allowClear: true,
|
|
157
|
+
...valueProps
|
|
158
158
|
}
|
|
159
159
|
);
|
|
160
160
|
break;
|
|
@@ -169,8 +169,8 @@ const FormFields = (props) => {
|
|
|
169
169
|
DatePicker,
|
|
170
170
|
{
|
|
171
171
|
style: { width: "100%" },
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
allowClear: true,
|
|
173
|
+
...valueProps
|
|
174
174
|
}
|
|
175
175
|
);
|
|
176
176
|
break;
|
|
@@ -179,8 +179,8 @@ const FormFields = (props) => {
|
|
|
179
179
|
DatePicker.RangePicker,
|
|
180
180
|
{
|
|
181
181
|
style: { width: "100%" },
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
allowClear: true,
|
|
183
|
+
...valueProps
|
|
184
184
|
}
|
|
185
185
|
);
|
|
186
186
|
break;
|
|
@@ -189,8 +189,8 @@ const FormFields = (props) => {
|
|
|
189
189
|
TimePicker,
|
|
190
190
|
{
|
|
191
191
|
style: { width: "100%" },
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
allowClear: true,
|
|
193
|
+
...valueProps
|
|
194
194
|
}
|
|
195
195
|
);
|
|
196
196
|
break;
|
|
@@ -198,8 +198,8 @@ const FormFields = (props) => {
|
|
|
198
198
|
result = /* @__PURE__ */ jsx(
|
|
199
199
|
Cascader,
|
|
200
200
|
{
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
allowClear: true,
|
|
202
|
+
...valueProps
|
|
203
203
|
}
|
|
204
204
|
);
|
|
205
205
|
break;
|
|
@@ -12,7 +12,6 @@ const EditableRow = ({ index, ...props }) => {
|
|
|
12
12
|
return /* @__PURE__ */ jsx(Form, { form, component: false, children: /* @__PURE__ */ jsx(EditableContext.Provider, { value: form, children: /* @__PURE__ */ jsx("tr", { ...props }) }) });
|
|
13
13
|
};
|
|
14
14
|
function EditableCell(props) {
|
|
15
|
-
console.log(props, "props");
|
|
16
15
|
const {
|
|
17
16
|
title,
|
|
18
17
|
editable,
|
|
@@ -32,7 +31,6 @@ function EditableCell(props) {
|
|
|
32
31
|
const values = await form.validateFields();
|
|
33
32
|
onChange({ ...record, ...values });
|
|
34
33
|
} catch (errInfo) {
|
|
35
|
-
console.log("Save failed:", errInfo);
|
|
36
34
|
}
|
|
37
35
|
};
|
|
38
36
|
const renderItem = () => {
|
package/es/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import ReactDOM from "react-dom/client";
|
|
4
4
|
import { BrowserRouter } from "react-router-dom";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { fileToDataURL, compressionFile } from "./utils/compression-file";
|
|
5
|
+
import { EditTable } from "./main";
|
|
6
|
+
import { Form } from "antd";
|
|
7
|
+
import "./utils/compression-file";
|
|
9
8
|
const Demo = () => {
|
|
10
|
-
|
|
11
|
-
useState([
|
|
9
|
+
Form.useForm();
|
|
10
|
+
const [list, setList] = useState([
|
|
12
11
|
{
|
|
13
12
|
PNOrderNo: 1,
|
|
14
13
|
PNName: "未分配",
|
|
@@ -28,6 +27,40 @@ const Demo = () => {
|
|
|
28
27
|
Remark: ""
|
|
29
28
|
}
|
|
30
29
|
]);
|
|
30
|
+
const columns = [
|
|
31
|
+
{
|
|
32
|
+
dataIndex: "PNOrderNo",
|
|
33
|
+
title: "序号",
|
|
34
|
+
width: 80
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
dataIndex: "PNName",
|
|
38
|
+
title: "节点名称"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
dataIndex: "PlanFinishDate",
|
|
42
|
+
title: "预计完成时间",
|
|
43
|
+
editable: true,
|
|
44
|
+
width: 400,
|
|
45
|
+
type: "datePicker",
|
|
46
|
+
valueProps: {
|
|
47
|
+
placeholder: "请输入内容"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
dataIndex: "Remark",
|
|
52
|
+
title: "备注",
|
|
53
|
+
editable: true,
|
|
54
|
+
type: "textarea",
|
|
55
|
+
width: 400,
|
|
56
|
+
valueProps: {
|
|
57
|
+
placeholder: "请输入内容",
|
|
58
|
+
autoSize: {
|
|
59
|
+
minRows: 3
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
];
|
|
31
64
|
useState(
|
|
32
65
|
Array.from({ length: 1e5 }, (_, key) => ({
|
|
33
66
|
key,
|
|
@@ -36,8 +69,8 @@ const Demo = () => {
|
|
|
36
69
|
}))
|
|
37
70
|
);
|
|
38
71
|
useState(false);
|
|
39
|
-
|
|
40
|
-
|
|
72
|
+
useState("");
|
|
73
|
+
useState("");
|
|
41
74
|
useState([
|
|
42
75
|
{
|
|
43
76
|
uid: "-1",
|
|
@@ -58,195 +91,21 @@ const Demo = () => {
|
|
|
58
91
|
url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
|
|
59
92
|
}
|
|
60
93
|
]);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
const selfWorlflowItem = (item, index, currentIndex) => {
|
|
77
|
-
let i = 0;
|
|
78
|
-
if (index < currentIndex) {
|
|
79
|
-
i = 1;
|
|
80
|
-
} else if (index === currentIndex) {
|
|
81
|
-
i = Number(item.IsLatest) === 2 ? 2 : 3;
|
|
94
|
+
return /* @__PURE__ */ jsx("div", { style: { height: "100vh" }, children: /* @__PURE__ */ jsx(
|
|
95
|
+
EditTable,
|
|
96
|
+
{
|
|
97
|
+
columns,
|
|
98
|
+
rowKey: "PNOrderNo",
|
|
99
|
+
onChange: (row) => {
|
|
100
|
+
const index = list.findIndex((v) => v.PNOrderNo === row.PNOrderNo);
|
|
101
|
+
const arr = [...list];
|
|
102
|
+
arr[index] = row;
|
|
103
|
+
setList(arr);
|
|
104
|
+
},
|
|
105
|
+
dataSource: list,
|
|
106
|
+
pagination: false
|
|
82
107
|
}
|
|
83
|
-
|
|
84
|
-
/* @__PURE__ */ jsx(
|
|
85
|
-
"div",
|
|
86
|
-
{
|
|
87
|
-
style: {
|
|
88
|
-
fontSize: "16px",
|
|
89
|
-
color: ["#666", "#333", "#FF0000", "#1864ff"][i],
|
|
90
|
-
fontWeight: 400,
|
|
91
|
-
marginBottom: "8px"
|
|
92
|
-
},
|
|
93
|
-
children: item.PNName
|
|
94
|
-
}
|
|
95
|
-
),
|
|
96
|
-
/* @__PURE__ */ jsx(
|
|
97
|
-
"div",
|
|
98
|
-
{
|
|
99
|
-
style: {
|
|
100
|
-
display: "flex",
|
|
101
|
-
alignItems: "center",
|
|
102
|
-
gap: "20px",
|
|
103
|
-
fontSize: "14px",
|
|
104
|
-
color: "#666"
|
|
105
|
-
},
|
|
106
|
-
children: item.UpdateTime ? /* @__PURE__ */ jsxs("span", { style: { color: "#333", fontWeight: "bold" }, children: [
|
|
107
|
-
"实际完成时间: ",
|
|
108
|
-
item.UpdateTime
|
|
109
|
-
] }) : /* @__PURE__ */ jsxs("span", { children: [
|
|
110
|
-
"预计完成时间: ",
|
|
111
|
-
item.PlanFinishDate || "暂无"
|
|
112
|
-
] })
|
|
113
|
-
}
|
|
114
|
-
),
|
|
115
|
-
item.Remark && /* @__PURE__ */ jsx(
|
|
116
|
-
"div",
|
|
117
|
-
{
|
|
118
|
-
style: {
|
|
119
|
-
marginTop: "10px",
|
|
120
|
-
background: "#ffffff",
|
|
121
|
-
border: "4px solid #fafafa",
|
|
122
|
-
borderRadius: "2px",
|
|
123
|
-
fontSize: "14px",
|
|
124
|
-
fontWeight: 400,
|
|
125
|
-
color: "#666",
|
|
126
|
-
padding: "20px",
|
|
127
|
-
wordBreak: "break-all"
|
|
128
|
-
},
|
|
129
|
-
children: item.Remark
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
] });
|
|
133
|
-
};
|
|
134
|
-
const onChange = async (e) => {
|
|
135
|
-
console.log(e);
|
|
136
|
-
const file3 = e.target.files[0];
|
|
137
|
-
const base64 = await fileToDataURL(file3);
|
|
138
|
-
setFile(base64);
|
|
139
|
-
const newFile = await compressionFile(file3, "image/jpeg", 0.2);
|
|
140
|
-
console.log(newFile);
|
|
141
|
-
const base64_2 = await fileToDataURL(newFile);
|
|
142
|
-
setFile2(base64_2);
|
|
143
|
-
};
|
|
144
|
-
return /* @__PURE__ */ jsxs("div", { style: { height: "100vh" }, children: [
|
|
145
|
-
/* @__PURE__ */ jsx(BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsx("span", { children: "副标题" }) }),
|
|
146
|
-
/* @__PURE__ */ jsx(AuthButton, { type: "primary", children: "按钮1" }),
|
|
147
|
-
/* @__PURE__ */ jsx(CoralButton, { PId: 100, auths: [{ PId: 100 }], children: "123" }),
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
149
|
-
SearchTable,
|
|
150
|
-
{
|
|
151
|
-
searchProps: {
|
|
152
|
-
items: [
|
|
153
|
-
{
|
|
154
|
-
dataIndex: "name",
|
|
155
|
-
valueProps: {
|
|
156
|
-
placeholder: "名称"
|
|
157
|
-
},
|
|
158
|
-
colProps: {
|
|
159
|
-
span: 6
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
valueType: "custom",
|
|
164
|
-
valueProps: {
|
|
165
|
-
children: /* @__PURE__ */ jsxs(Space, { children: [
|
|
166
|
-
/* @__PURE__ */ jsx(Form.Item, { name: "yzm", noStyle: true, children: /* @__PURE__ */ jsx(Input, { placeholder: "请输入验证码" }) }),
|
|
167
|
-
/* @__PURE__ */ jsx(Button, { children: "发送验证码" })
|
|
168
|
-
] })
|
|
169
|
-
},
|
|
170
|
-
colProps: {
|
|
171
|
-
span: 6
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
dataIndex: "mm",
|
|
176
|
-
valueType: "password",
|
|
177
|
-
colProps: {
|
|
178
|
-
span: 6
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
dataIndex: "pic",
|
|
183
|
-
valueType: "upload",
|
|
184
|
-
valueProps: {
|
|
185
|
-
maxCount: 1
|
|
186
|
-
},
|
|
187
|
-
colProps: {
|
|
188
|
-
span: 12
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
dataIndex: "pic2",
|
|
193
|
-
colProps: {
|
|
194
|
-
span: 12
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
dataIndex: "qwe",
|
|
199
|
-
valueProps: {
|
|
200
|
-
placeholder: "name"
|
|
201
|
-
},
|
|
202
|
-
colProps: {
|
|
203
|
-
span: 12
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
dataIndex: "btns",
|
|
208
|
-
valueType: "btns",
|
|
209
|
-
valueProps: [
|
|
210
|
-
{
|
|
211
|
-
btnType: "submit",
|
|
212
|
-
title: "确定",
|
|
213
|
-
type: "primary",
|
|
214
|
-
onClick: (v) => console.log(v)
|
|
215
|
-
}
|
|
216
|
-
]
|
|
217
|
-
}
|
|
218
|
-
],
|
|
219
|
-
formProps: { wrapperCol: { span: 24 }, form }
|
|
220
|
-
},
|
|
221
|
-
tableProps: {
|
|
222
|
-
minColumnWidth: 100,
|
|
223
|
-
columns: [
|
|
224
|
-
{ dataIndex: "A", title: "A", width: 100 },
|
|
225
|
-
{ dataIndex: "B", title: "B", width: 200 },
|
|
226
|
-
{ dataIndex: "C", title: "C", width: 200 },
|
|
227
|
-
{ dataIndex: "D", title: "D" },
|
|
228
|
-
{ dataIndex: "E", title: "E", width: 150 },
|
|
229
|
-
{ dataIndex: "F", title: "F", width: 150 }
|
|
230
|
-
],
|
|
231
|
-
pagination: false,
|
|
232
|
-
rowKey: "A",
|
|
233
|
-
dataSource: Array(3).fill(0).map((v, i) => ({ A: i + 1 }))
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
),
|
|
237
|
-
/* @__PURE__ */ jsx(Button, { onClick: handleClick, children: "click" }),
|
|
238
|
-
/* @__PURE__ */ jsx(Input, { type: "file", onChange }),
|
|
239
|
-
/* @__PURE__ */ jsx(
|
|
240
|
-
UploadFile,
|
|
241
|
-
{
|
|
242
|
-
compression: { type: "image/jpeg", quality: 0.2, limit: 300 },
|
|
243
|
-
maxSize: 100,
|
|
244
|
-
onChange: (info) => console.log(info)
|
|
245
|
-
}
|
|
246
|
-
),
|
|
247
|
-
/* @__PURE__ */ jsx("img", { src: file, style: { width: 400 } }),
|
|
248
|
-
/* @__PURE__ */ jsx("img", { src: file2, style: { width: 400 } })
|
|
249
|
-
] });
|
|
108
|
+
) });
|
|
250
109
|
};
|
|
251
110
|
ReactDOM.createRoot(document.getElementById("root")).render(
|
|
252
111
|
/* @__PURE__ */ jsx(BrowserRouter, { children: /* @__PURE__ */ jsx(Demo, {}) })
|
|
@@ -116,7 +116,7 @@ const CreateForm = (props) => {
|
|
|
116
116
|
const FormFields = (props) => {
|
|
117
117
|
const { valueType, valueProps, value, onChange, onBtnClick, inputRef } = props;
|
|
118
118
|
const children = React.useMemo(() => {
|
|
119
|
-
let result = /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { placeholder: "请输入",
|
|
119
|
+
let result = /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { placeholder: "请输入", allowClear: true, ...valueProps });
|
|
120
120
|
switch (valueType) {
|
|
121
121
|
case "rate":
|
|
122
122
|
result = /* @__PURE__ */ jsxRuntime.jsx(antd.Rate, { ...valueProps });
|
|
@@ -135,8 +135,8 @@ const FormFields = (props) => {
|
|
|
135
135
|
antd.Select,
|
|
136
136
|
{
|
|
137
137
|
placeholder: "请选择",
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
allowClear: true,
|
|
139
|
+
...valueProps
|
|
140
140
|
}
|
|
141
141
|
);
|
|
142
142
|
break;
|
|
@@ -155,8 +155,8 @@ const FormFields = (props) => {
|
|
|
155
155
|
antd.Input.TextArea,
|
|
156
156
|
{
|
|
157
157
|
placeholder: "请输入",
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
allowClear: true,
|
|
159
|
+
...valueProps
|
|
160
160
|
}
|
|
161
161
|
);
|
|
162
162
|
break;
|
|
@@ -171,8 +171,8 @@ const FormFields = (props) => {
|
|
|
171
171
|
antd.DatePicker,
|
|
172
172
|
{
|
|
173
173
|
style: { width: "100%" },
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
allowClear: true,
|
|
175
|
+
...valueProps
|
|
176
176
|
}
|
|
177
177
|
);
|
|
178
178
|
break;
|
|
@@ -181,8 +181,8 @@ const FormFields = (props) => {
|
|
|
181
181
|
antd.DatePicker.RangePicker,
|
|
182
182
|
{
|
|
183
183
|
style: { width: "100%" },
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
allowClear: true,
|
|
185
|
+
...valueProps
|
|
186
186
|
}
|
|
187
187
|
);
|
|
188
188
|
break;
|
|
@@ -191,8 +191,8 @@ const FormFields = (props) => {
|
|
|
191
191
|
antd.TimePicker,
|
|
192
192
|
{
|
|
193
193
|
style: { width: "100%" },
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
allowClear: true,
|
|
195
|
+
...valueProps
|
|
196
196
|
}
|
|
197
197
|
);
|
|
198
198
|
break;
|
|
@@ -200,8 +200,8 @@ const FormFields = (props) => {
|
|
|
200
200
|
result = /* @__PURE__ */ jsxRuntime.jsx(
|
|
201
201
|
antd.Cascader,
|
|
202
202
|
{
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
allowClear: true,
|
|
204
|
+
...valueProps
|
|
205
205
|
}
|
|
206
206
|
);
|
|
207
207
|
break;
|
|
@@ -13,7 +13,6 @@ const EditableRow = ({ index, ...props }) => {
|
|
|
13
13
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form, { form, component: false, children: /* @__PURE__ */ jsxRuntime.jsx(EditableContext.Provider, { value: form, children: /* @__PURE__ */ jsxRuntime.jsx("tr", { ...props }) }) });
|
|
14
14
|
};
|
|
15
15
|
function EditableCell(props) {
|
|
16
|
-
console.log(props, "props");
|
|
17
16
|
const {
|
|
18
17
|
title,
|
|
19
18
|
editable,
|
|
@@ -33,7 +32,6 @@ function EditableCell(props) {
|
|
|
33
32
|
const values = await form.validateFields();
|
|
34
33
|
onChange({ ...record, ...values });
|
|
35
34
|
} catch (errInfo) {
|
|
36
|
-
console.log("Save failed:", errInfo);
|
|
37
35
|
}
|
|
38
36
|
};
|
|
39
37
|
const renderItem = () => {
|