antd-crud-table 0.0.13 → 0.1.0
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 +0 -10
- package/dist/CrudTable-CDqv0ksy.cjs +387 -0
- package/dist/CrudTable-DbG9ZeYQ.js +73031 -0
- package/dist/CrudTable.cjs +1 -1
- package/dist/CrudTable.js +211 -234
- package/dist/CrudTableExperimental.cjs +1 -1
- package/dist/CrudTableExperimental.js +303 -372
- package/dist/CrudTableLazy.cjs +1 -1
- package/dist/CrudTableLazy.js +23 -23
- package/dist/antd-crud-table.css +2 -1
- package/dist/chunk-BZRuZbSa.cjs +1 -0
- package/dist/chunk-DrlAKpkd.js +23 -0
- package/dist/jsx-runtime-Blo4gjKb.js +475 -0
- package/dist/jsx-runtime-D8R_Hd8N.cjs +16 -0
- package/dist/message-C5ORE39N.cjs +124 -0
- package/dist/message-C9NNC2sM.js +7083 -0
- package/dist/useCrudTable.cjs +1 -1
- package/dist/useCrudTable.js +234 -194
- package/dist/utils/exportData.d.ts +37 -0
- package/package.json +13 -15
- package/dist/CrudTable-W5dD5mDc.js +0 -74793
- package/dist/CrudTable-ck226KHr.cjs +0 -407
- package/dist/index-DNXRWKhU.js +0 -6314
- package/dist/index-DygfPlBI.cjs +0 -145
- package/dist/jsx-runtime-Drh4NO5G.js +0 -633
- package/dist/jsx-runtime-qcKc-DpB.cjs +0 -30
|
@@ -1,373 +1,304 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
name: t,
|
|
303
|
-
label: a,
|
|
304
|
-
rules: s,
|
|
305
|
-
children: /* @__PURE__ */ r.jsx(X, { disabled: n })
|
|
306
|
-
},
|
|
307
|
-
t
|
|
308
|
-
);
|
|
309
|
-
case "number":
|
|
310
|
-
return /* @__PURE__ */ r.jsx(
|
|
311
|
-
l.Item,
|
|
312
|
-
{
|
|
313
|
-
name: t,
|
|
314
|
-
label: a,
|
|
315
|
-
rules: s,
|
|
316
|
-
children: /* @__PURE__ */ r.jsx(U, { style: { width: "100%" }, disabled: n })
|
|
317
|
-
},
|
|
318
|
-
t
|
|
319
|
-
);
|
|
320
|
-
case "date":
|
|
321
|
-
return /* @__PURE__ */ r.jsx(
|
|
322
|
-
l.Item,
|
|
323
|
-
{
|
|
324
|
-
name: t,
|
|
325
|
-
label: a,
|
|
326
|
-
rules: s,
|
|
327
|
-
children: /* @__PURE__ */ r.jsx(G, { style: { width: "100%" }, showTime: !0, disabled: n })
|
|
328
|
-
},
|
|
329
|
-
t
|
|
330
|
-
);
|
|
331
|
-
case "boolean":
|
|
332
|
-
return /* @__PURE__ */ r.jsx(
|
|
333
|
-
l.Item,
|
|
334
|
-
{
|
|
335
|
-
name: t,
|
|
336
|
-
label: a,
|
|
337
|
-
valuePropName: "checked",
|
|
338
|
-
children: /* @__PURE__ */ r.jsx(W, { disabled: n })
|
|
339
|
-
},
|
|
340
|
-
t
|
|
341
|
-
);
|
|
342
|
-
case "enum":
|
|
343
|
-
return /* @__PURE__ */ r.jsx(
|
|
344
|
-
l.Item,
|
|
345
|
-
{
|
|
346
|
-
name: t,
|
|
347
|
-
label: a,
|
|
348
|
-
rules: s,
|
|
349
|
-
children: /* @__PURE__ */ r.jsx(
|
|
350
|
-
Q,
|
|
351
|
-
{
|
|
352
|
-
disabled: n,
|
|
353
|
-
placeholder: `Select ${a.toLowerCase()}`,
|
|
354
|
-
options: Object.entries(e.enumOptions || {}).map(([B, N]) => ({
|
|
355
|
-
label: N.text,
|
|
356
|
-
value: B
|
|
357
|
-
}))
|
|
358
|
-
}
|
|
359
|
-
)
|
|
360
|
-
},
|
|
361
|
-
t
|
|
362
|
-
);
|
|
363
|
-
default:
|
|
364
|
-
return null;
|
|
365
|
-
}
|
|
366
|
-
}) })
|
|
367
|
-
}
|
|
368
|
-
)
|
|
369
|
-
] });
|
|
370
|
-
};
|
|
371
|
-
export {
|
|
372
|
-
oe as default
|
|
1
|
+
import { a as e } from "./chunk-DrlAKpkd.js";
|
|
2
|
+
import { _ as t, a as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, y } from "./CrudTable-DbG9ZeYQ.js";
|
|
3
|
+
import { t as b } from "./message-C9NNC2sM.js";
|
|
4
|
+
import { t as x } from "./jsx-runtime-Blo4gjKb.js";
|
|
5
|
+
import { useCrudTable as S } from "./useCrudTable.js";
|
|
6
|
+
import { useEffect as C, useState as w } from "react";
|
|
7
|
+
//#region lib/CrudTableExperimental.tsx
|
|
8
|
+
var T = /* @__PURE__ */ e(s(), 1), E = x(), D = (e) => {
|
|
9
|
+
let { columns: s, rowKey: x, title: D, defaultPageSize: O = 10, hookConfig: k, enableBulkOperations: A = !1, customActions: j } = e, M = S(x, {
|
|
10
|
+
defaultPageSize: O,
|
|
11
|
+
...k
|
|
12
|
+
}), [N, P] = w(!1), [F, I] = w(null), [L, R] = w([]), [z] = i.useForm();
|
|
13
|
+
C(() => {
|
|
14
|
+
M.refresh();
|
|
15
|
+
}, []);
|
|
16
|
+
let B = s.map((e) => {
|
|
17
|
+
let t = {
|
|
18
|
+
...e,
|
|
19
|
+
dataIndex: e.dataIndex,
|
|
20
|
+
title: e.title,
|
|
21
|
+
search: e.searchable !== !1
|
|
22
|
+
};
|
|
23
|
+
switch (e.fieldType) {
|
|
24
|
+
case "date": return {
|
|
25
|
+
...t,
|
|
26
|
+
valueType: "dateTime",
|
|
27
|
+
render: (t, n) => {
|
|
28
|
+
let r = n[e.dataIndex];
|
|
29
|
+
if (!r) return "-";
|
|
30
|
+
try {
|
|
31
|
+
return /* @__PURE__ */ (0, E.jsx)("span", { children: m(g(r), "yyyy-MM-dd HH:mm") });
|
|
32
|
+
} catch {
|
|
33
|
+
return /* @__PURE__ */ (0, E.jsx)("span", { children: r });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
case "enum": return {
|
|
38
|
+
...t,
|
|
39
|
+
valueType: "select",
|
|
40
|
+
valueEnum: e.enumOptions,
|
|
41
|
+
render: (t, n) => {
|
|
42
|
+
let r = n[e.dataIndex], i = e.enumOptions?.[r];
|
|
43
|
+
return i ? /* @__PURE__ */ (0, E.jsx)(h, {
|
|
44
|
+
color: i.color,
|
|
45
|
+
children: i.text
|
|
46
|
+
}) : r;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
case "number": return {
|
|
50
|
+
...t,
|
|
51
|
+
valueType: "digit",
|
|
52
|
+
render: (t, n) => {
|
|
53
|
+
let r = n[e.dataIndex];
|
|
54
|
+
return typeof r == "number" ? r.toLocaleString() : r;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
case "boolean": return {
|
|
58
|
+
...t,
|
|
59
|
+
valueType: "switch",
|
|
60
|
+
render: (t, n) => /* @__PURE__ */ (0, E.jsx)(h, {
|
|
61
|
+
color: n[e.dataIndex] ? "green" : "red",
|
|
62
|
+
children: n[e.dataIndex] ? "Yes" : "No"
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
case "custom": return {
|
|
66
|
+
...t,
|
|
67
|
+
render: (t, n) => e.customRender?.(n[e.dataIndex], n)
|
|
68
|
+
};
|
|
69
|
+
default: return t;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
B.push({
|
|
73
|
+
title: "Actions",
|
|
74
|
+
valueType: "option",
|
|
75
|
+
width: 200,
|
|
76
|
+
render: (e, t) => {
|
|
77
|
+
let n = [/* @__PURE__ */ (0, E.jsx)(o, {
|
|
78
|
+
type: "link",
|
|
79
|
+
size: "small",
|
|
80
|
+
onClick: () => H(t),
|
|
81
|
+
children: "Edit"
|
|
82
|
+
}, "edit"), /* @__PURE__ */ (0, E.jsx)(o, {
|
|
83
|
+
type: "link",
|
|
84
|
+
size: "small",
|
|
85
|
+
danger: !0,
|
|
86
|
+
onClick: () => W(t[x]),
|
|
87
|
+
children: "Delete"
|
|
88
|
+
}, "delete")], r = j?.(t, M) || [];
|
|
89
|
+
return [...n, ...r];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
let V = async (e, t, n) => {
|
|
93
|
+
try {
|
|
94
|
+
let r = {
|
|
95
|
+
current: e.current,
|
|
96
|
+
pageSize: e.pageSize,
|
|
97
|
+
sortBy: Object.keys(t)[0],
|
|
98
|
+
sortOrder: Object.values(t)[0],
|
|
99
|
+
...n,
|
|
100
|
+
...e
|
|
101
|
+
}, i = M.operations;
|
|
102
|
+
if (i?.getList) {
|
|
103
|
+
let e = await i.getList(r);
|
|
104
|
+
return {
|
|
105
|
+
data: e.data,
|
|
106
|
+
success: !0,
|
|
107
|
+
total: e.total
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
data: M.state.data,
|
|
112
|
+
success: !0,
|
|
113
|
+
total: M.state.total
|
|
114
|
+
};
|
|
115
|
+
} catch {
|
|
116
|
+
return b.error("Failed to fetch data"), {
|
|
117
|
+
data: [],
|
|
118
|
+
success: !1,
|
|
119
|
+
total: 0
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}, H = (e) => {
|
|
123
|
+
if (I(e || null), e) {
|
|
124
|
+
let t = { ...e };
|
|
125
|
+
s.forEach((e) => {
|
|
126
|
+
let n = e.dataIndex;
|
|
127
|
+
if (e.fieldType === "date" && t[n]) try {
|
|
128
|
+
t[n] = (0, T.default)(t[n]);
|
|
129
|
+
} catch {}
|
|
130
|
+
}), z.setFieldsValue(t);
|
|
131
|
+
} else z.resetFields();
|
|
132
|
+
P(!0);
|
|
133
|
+
}, U = async () => {
|
|
134
|
+
try {
|
|
135
|
+
let e = await z.validateFields(), t = { ...e };
|
|
136
|
+
s.forEach((n) => {
|
|
137
|
+
let r = n.dataIndex;
|
|
138
|
+
if (n.fieldType === "date" && e[r]) try {
|
|
139
|
+
t[r] = d(e[r]);
|
|
140
|
+
} catch {}
|
|
141
|
+
n.formConfig?.transform && (t[r] = n.formConfig.transform(e[r]));
|
|
142
|
+
}), F && F[x] ? await M.update(F[x], t) : await M.create(t), P(!1), M.actionRef.current?.reload();
|
|
143
|
+
} catch (e) {
|
|
144
|
+
console.error("Form validation failed:", e);
|
|
145
|
+
}
|
|
146
|
+
}, W = async (e) => {
|
|
147
|
+
l.confirm({
|
|
148
|
+
title: "Are you sure?",
|
|
149
|
+
content: "This action cannot be undone.",
|
|
150
|
+
okText: "Yes, Delete",
|
|
151
|
+
okType: "danger",
|
|
152
|
+
cancelText: "Cancel",
|
|
153
|
+
onOk: async () => {
|
|
154
|
+
await M.delete(e) && M.actionRef.current?.reload();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}, G = async () => {
|
|
158
|
+
if (L.length === 0) {
|
|
159
|
+
b.warning("Please select items to delete");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
l.confirm({
|
|
163
|
+
title: `Delete ${L.length} items?`,
|
|
164
|
+
content: "This action cannot be undone.",
|
|
165
|
+
okText: "Yes, Delete All",
|
|
166
|
+
okType: "danger",
|
|
167
|
+
cancelText: "Cancel",
|
|
168
|
+
onOk: async () => {
|
|
169
|
+
let e = L.map((e) => M.delete(e));
|
|
170
|
+
await Promise.allSettled(e), R([]), M.actionRef.current?.reload();
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}, K = A ? {
|
|
174
|
+
selectedRowKeys: L,
|
|
175
|
+
onChange: R
|
|
176
|
+
} : void 0;
|
|
177
|
+
return /* @__PURE__ */ (0, E.jsxs)(n, {
|
|
178
|
+
needDeps: !0,
|
|
179
|
+
intl: f,
|
|
180
|
+
children: [/* @__PURE__ */ (0, E.jsx)(c, {
|
|
181
|
+
headerTitle: D,
|
|
182
|
+
rowKey: x,
|
|
183
|
+
rowClassName: (e, t) => t % 2 == 0 ? "row-differentiator" : "",
|
|
184
|
+
actionRef: M.actionRef,
|
|
185
|
+
columns: B,
|
|
186
|
+
request: V,
|
|
187
|
+
search: { labelWidth: "auto" },
|
|
188
|
+
pagination: {
|
|
189
|
+
pageSize: O,
|
|
190
|
+
showSizeChanger: !0,
|
|
191
|
+
showQuickJumper: !0
|
|
192
|
+
},
|
|
193
|
+
loading: M.state.loading,
|
|
194
|
+
rowSelection: K,
|
|
195
|
+
toolBarRender: () => [
|
|
196
|
+
/* @__PURE__ */ (0, E.jsx)(o, {
|
|
197
|
+
type: "primary",
|
|
198
|
+
icon: /* @__PURE__ */ (0, E.jsx)(v, {}),
|
|
199
|
+
onClick: () => H(),
|
|
200
|
+
children: "New"
|
|
201
|
+
}, "add"),
|
|
202
|
+
...A && L.length > 0 ? [/* @__PURE__ */ (0, E.jsxs)(o, {
|
|
203
|
+
danger: !0,
|
|
204
|
+
onClick: G,
|
|
205
|
+
children: [
|
|
206
|
+
"Delete Selected (",
|
|
207
|
+
L.length,
|
|
208
|
+
")"
|
|
209
|
+
]
|
|
210
|
+
}, "bulk-delete")] : [],
|
|
211
|
+
/* @__PURE__ */ (0, E.jsx)(a, {
|
|
212
|
+
menu: { items: [{
|
|
213
|
+
key: "export",
|
|
214
|
+
label: "Export",
|
|
215
|
+
disabled: !0
|
|
216
|
+
}, {
|
|
217
|
+
key: "refresh",
|
|
218
|
+
label: "Refresh",
|
|
219
|
+
onClick: () => M.refresh()
|
|
220
|
+
}] },
|
|
221
|
+
children: /* @__PURE__ */ (0, E.jsx)(o, { children: /* @__PURE__ */ (0, E.jsx)(y, {}) })
|
|
222
|
+
}, "menu")
|
|
223
|
+
],
|
|
224
|
+
options: {
|
|
225
|
+
setting: { listsHeight: 400 },
|
|
226
|
+
reload: () => M.refresh()
|
|
227
|
+
},
|
|
228
|
+
dateFormatter: "string"
|
|
229
|
+
}), /* @__PURE__ */ (0, E.jsx)(l, {
|
|
230
|
+
title: F ? "Edit Item" : "Create Item",
|
|
231
|
+
open: N,
|
|
232
|
+
onOk: U,
|
|
233
|
+
onCancel: () => P(!1),
|
|
234
|
+
destroyOnClose: !0,
|
|
235
|
+
width: 600,
|
|
236
|
+
children: /* @__PURE__ */ (0, E.jsx)(i, {
|
|
237
|
+
form: z,
|
|
238
|
+
layout: "vertical",
|
|
239
|
+
children: s.map((e) => {
|
|
240
|
+
if (!e.dataIndex) return null;
|
|
241
|
+
let n = e.dataIndex, a = e.title, o = !(e.fieldEditable ?? !0), s = e.formConfig?.rules || (e.formConfig?.required ? [{
|
|
242
|
+
required: !0,
|
|
243
|
+
message: `${a} is required`
|
|
244
|
+
}] : []);
|
|
245
|
+
if (e.formConfig?.component) return /* @__PURE__ */ (0, E.jsx)(i.Item, {
|
|
246
|
+
name: n,
|
|
247
|
+
label: a,
|
|
248
|
+
rules: s,
|
|
249
|
+
children: e.formConfig.component
|
|
250
|
+
}, n);
|
|
251
|
+
switch (e.fieldType) {
|
|
252
|
+
case "string": return /* @__PURE__ */ (0, E.jsx)(i.Item, {
|
|
253
|
+
name: n,
|
|
254
|
+
label: a,
|
|
255
|
+
rules: s,
|
|
256
|
+
children: /* @__PURE__ */ (0, E.jsx)(_, { disabled: o })
|
|
257
|
+
}, n);
|
|
258
|
+
case "number": return /* @__PURE__ */ (0, E.jsx)(i.Item, {
|
|
259
|
+
name: n,
|
|
260
|
+
label: a,
|
|
261
|
+
rules: s,
|
|
262
|
+
children: /* @__PURE__ */ (0, E.jsx)(u, {
|
|
263
|
+
style: { width: "100%" },
|
|
264
|
+
disabled: o
|
|
265
|
+
})
|
|
266
|
+
}, n);
|
|
267
|
+
case "date": return /* @__PURE__ */ (0, E.jsx)(i.Item, {
|
|
268
|
+
name: n,
|
|
269
|
+
label: a,
|
|
270
|
+
rules: s,
|
|
271
|
+
children: /* @__PURE__ */ (0, E.jsx)(p, {
|
|
272
|
+
style: { width: "100%" },
|
|
273
|
+
showTime: !0,
|
|
274
|
+
disabled: o
|
|
275
|
+
})
|
|
276
|
+
}, n);
|
|
277
|
+
case "boolean": return /* @__PURE__ */ (0, E.jsx)(i.Item, {
|
|
278
|
+
name: n,
|
|
279
|
+
label: a,
|
|
280
|
+
valuePropName: "checked",
|
|
281
|
+
children: /* @__PURE__ */ (0, E.jsx)(r, { disabled: o })
|
|
282
|
+
}, n);
|
|
283
|
+
case "enum": return /* @__PURE__ */ (0, E.jsx)(i.Item, {
|
|
284
|
+
name: n,
|
|
285
|
+
label: a,
|
|
286
|
+
rules: s,
|
|
287
|
+
children: /* @__PURE__ */ (0, E.jsx)(t, {
|
|
288
|
+
disabled: o,
|
|
289
|
+
placeholder: `Select ${a.toLowerCase()}`,
|
|
290
|
+
options: Object.entries(e.enumOptions || {}).map(([e, t]) => ({
|
|
291
|
+
label: t.text,
|
|
292
|
+
value: e
|
|
293
|
+
}))
|
|
294
|
+
})
|
|
295
|
+
}, n);
|
|
296
|
+
default: return null;
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
})
|
|
300
|
+
})]
|
|
301
|
+
});
|
|
373
302
|
};
|
|
303
|
+
//#endregion
|
|
304
|
+
export { D as default };
|