@kingteza/crud-component 1.0.56 → 1.0.57
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/App.d.ts +5 -0
- package/common/button/Button.cjs.js +1 -1
- package/common/button/Button.d.ts +2 -3
- package/common/button/Button.es.js +54 -61
- package/crud/CrudComponent.cjs.js +1 -1
- package/crud/CrudComponent.d.ts +5 -1
- package/crud/CrudComponent.es.js +138 -137
- package/crud/CrudField.cjs.js +1 -1
- package/crud/CrudField.es.js +160 -159
- package/crud/CrudForm.cjs.js +1 -1
- package/crud/CrudForm.es.js +57 -56
- package/crud/CrudFormWizard.cjs.js +1 -1
- package/crud/CrudFormWizard.es.js +53 -52
- package/crud/CrudSearchComponent.cjs.js +1 -1
- package/crud/CrudSearchComponent.es.js +39 -38
- package/crud/CrudTextAreaComponent.cjs.js +1 -1
- package/crud/CrudTextAreaComponent.es.js +29 -28
- package/crud/FileCrudField.cjs.js +1 -1
- package/crud/FileCrudField.es.js +70 -69
- package/crud/view/CrudDecListView.cjs.js +1 -1
- package/crud/view/CrudDecListView.es.js +29 -25
- package/crud/view/CrudViewer.cjs.js +1 -1
- package/crud/view/CrudViewer.es.js +137 -133
- package/crud/view/CrudViewerUtil.cjs.js +1 -1
- package/crud/view/CrudViewerUtil.es.js +51 -48
- package/hooks/NavigatorHooks.cjs.js +1 -1
- package/hooks/NavigatorHooks.d.ts +1 -1
- package/hooks/NavigatorHooks.es.js +4 -3
- package/package.json +1 -1
- package/util/CrudUtil.cjs.js +1 -0
- package/util/CrudUtil.d.ts +5 -0
- package/util/CrudUtil.es.js +8 -0
package/crud/CrudField.es.js
CHANGED
|
@@ -1,85 +1,86 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Form as j, Radio as
|
|
3
|
-
import { useEffect as L, useState as G, useCallback as
|
|
4
|
-
import
|
|
5
|
-
import { useTranslationLib as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
1
|
+
import { jsx as t, Fragment as S, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { Form as j, Radio as M, Select as I, Tag as W, ColorPicker as X } from "antd";
|
|
3
|
+
import { useEffect as L, useState as G, useMemo as _, useCallback as Y } from "react";
|
|
4
|
+
import Z from "react-highlight-words";
|
|
5
|
+
import { useTranslationLib as V } from "../locale/index.es.js";
|
|
6
|
+
import ee from "./FileCrudField.es.js";
|
|
7
|
+
import re from "./ImageCrudField.es.js";
|
|
8
|
+
import te from "../common/check-box/CheckBox.es.js";
|
|
9
|
+
import ae from "../common/date-picker/DatePicker.es.js";
|
|
10
|
+
import oe from "../common/date-picker/TimePicker.es.js";
|
|
11
|
+
import z from "../common/select/SelectComponent.es.js";
|
|
12
|
+
import le from "../common/text-field/NumberField.es.js";
|
|
13
|
+
import ne from "../common/text-field/TextField.es.js";
|
|
14
|
+
import ie from "../common/tooltip/TooltipComponent.es.js";
|
|
15
|
+
import de from "./CrudTextAreaComponent.es.js";
|
|
16
|
+
import $ from "../util/CrudUtil.es.js";
|
|
17
|
+
function Re(v) {
|
|
17
18
|
const {
|
|
18
19
|
label: n,
|
|
19
20
|
name: c,
|
|
20
|
-
type:
|
|
21
|
+
type: p,
|
|
21
22
|
required: d,
|
|
22
|
-
hidden:
|
|
23
|
+
hidden: k,
|
|
23
24
|
rules: m = [],
|
|
24
25
|
updatable: u = !0,
|
|
25
|
-
readonly:
|
|
26
|
-
fieldClassName:
|
|
27
|
-
customFormFieldRender:
|
|
26
|
+
readonly: R = !1,
|
|
27
|
+
fieldClassName: f,
|
|
28
|
+
customFormFieldRender: P,
|
|
28
29
|
fieldTooltip: b,
|
|
29
30
|
...e
|
|
30
31
|
} = v, h = j.useFormInstance();
|
|
31
32
|
L(() => {
|
|
32
|
-
if (
|
|
33
|
+
if (p === "select") {
|
|
33
34
|
const {
|
|
34
35
|
items: l = [],
|
|
35
36
|
onSearch: i,
|
|
36
|
-
searchOnType:
|
|
37
|
+
searchOnType: o
|
|
37
38
|
} = e;
|
|
38
|
-
!(l != null && l.length) && !
|
|
39
|
+
!(l != null && l.length) && !o && (i == null || i(void 0, h, e == null ? void 0 : e.updatingValue));
|
|
39
40
|
}
|
|
40
|
-
}, [h, e,
|
|
41
|
-
const { t:
|
|
42
|
-
if (
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
45
|
-
switch (
|
|
41
|
+
}, [h, e, p, e == null ? void 0 : e.updatingValue]);
|
|
42
|
+
const { t: T } = V();
|
|
43
|
+
if (R || k) return /* @__PURE__ */ t(S, {});
|
|
44
|
+
if (P)
|
|
45
|
+
return P(h, v);
|
|
46
|
+
switch (p) {
|
|
46
47
|
case "text":
|
|
47
48
|
case "email":
|
|
48
49
|
case "password": {
|
|
49
50
|
const { onChange: l, placeholder: i } = e;
|
|
50
|
-
return /* @__PURE__ */
|
|
51
|
-
|
|
51
|
+
return /* @__PURE__ */ t(
|
|
52
|
+
ne,
|
|
52
53
|
{
|
|
53
54
|
placeholder: i,
|
|
54
55
|
disabled: !u,
|
|
55
56
|
rules: m,
|
|
56
57
|
required: d,
|
|
57
|
-
onChange: l ? (
|
|
58
|
-
type:
|
|
58
|
+
onChange: l ? (o) => l(o, h) : void 0,
|
|
59
|
+
type: p,
|
|
59
60
|
name: c,
|
|
60
61
|
tooltip: b,
|
|
61
62
|
label: n,
|
|
62
|
-
className:
|
|
63
|
+
className: f,
|
|
63
64
|
autoComplete: "new-password"
|
|
64
65
|
}
|
|
65
66
|
);
|
|
66
67
|
}
|
|
67
68
|
case "number": {
|
|
68
|
-
const { onChange: l, placeholder: i, allowMinus:
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
-
|
|
69
|
+
const { onChange: l, placeholder: i, allowMinus: o } = e;
|
|
70
|
+
return /* @__PURE__ */ t(
|
|
71
|
+
le,
|
|
71
72
|
{
|
|
72
73
|
placeholder: i,
|
|
73
74
|
disabled: !u,
|
|
74
75
|
moneyField: !!e.formatted,
|
|
75
|
-
type:
|
|
76
|
+
type: p,
|
|
76
77
|
onChange: l ? (C) => l(C, h) : void 0,
|
|
77
78
|
rules: m,
|
|
78
79
|
autoComplete: "false",
|
|
79
80
|
required: d,
|
|
80
81
|
tooltip: b,
|
|
81
|
-
className:
|
|
82
|
-
min:
|
|
82
|
+
className: f,
|
|
83
|
+
min: o ? null : void 0,
|
|
83
84
|
name: c,
|
|
84
85
|
label: n
|
|
85
86
|
}
|
|
@@ -89,28 +90,28 @@ function Te(v) {
|
|
|
89
90
|
const {
|
|
90
91
|
range: l,
|
|
91
92
|
disableToday: i,
|
|
92
|
-
disabledFutureDays:
|
|
93
|
+
disabledFutureDays: o,
|
|
93
94
|
disabledPastDays: C,
|
|
94
95
|
onChange: y,
|
|
95
96
|
placeholder: g,
|
|
96
97
|
format: x
|
|
97
98
|
} = e;
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
|
|
99
|
+
return /* @__PURE__ */ t(
|
|
100
|
+
ae,
|
|
100
101
|
{
|
|
101
102
|
placeholder: g,
|
|
102
103
|
required: d,
|
|
103
104
|
disabled: !u,
|
|
104
|
-
type:
|
|
105
|
+
type: p,
|
|
105
106
|
format: x,
|
|
106
107
|
tooltip: b,
|
|
107
108
|
range: l,
|
|
108
109
|
name: c,
|
|
109
110
|
label: n,
|
|
110
|
-
onChange: y ? (
|
|
111
|
-
className:
|
|
111
|
+
onChange: y ? (F) => y(F, h) : void 0,
|
|
112
|
+
className: f,
|
|
112
113
|
disableToday: i,
|
|
113
|
-
disabledFutureDays:
|
|
114
|
+
disabledFutureDays: o,
|
|
114
115
|
disabledPastDays: C
|
|
115
116
|
}
|
|
116
117
|
);
|
|
@@ -119,79 +120,79 @@ function Te(v) {
|
|
|
119
120
|
const {
|
|
120
121
|
range: l = !1,
|
|
121
122
|
disableCurrent: i,
|
|
122
|
-
disabledFuture:
|
|
123
|
+
disabledFuture: o,
|
|
123
124
|
disabledPast: C,
|
|
124
125
|
onChange: y,
|
|
125
126
|
use12Hours: g,
|
|
126
127
|
format: x,
|
|
127
|
-
placeholder:
|
|
128
|
+
placeholder: F
|
|
128
129
|
} = e;
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
-
|
|
130
|
+
return /* @__PURE__ */ t(
|
|
131
|
+
oe,
|
|
131
132
|
{
|
|
132
|
-
placeholder:
|
|
133
|
+
placeholder: F,
|
|
133
134
|
required: d,
|
|
134
135
|
format: x,
|
|
135
136
|
disabled: !u,
|
|
136
|
-
type:
|
|
137
|
+
type: p,
|
|
137
138
|
tooltip: b,
|
|
138
139
|
range: l,
|
|
139
140
|
use12Hours: g,
|
|
140
141
|
name: c,
|
|
141
142
|
label: n,
|
|
142
|
-
onChange: y ? (
|
|
143
|
-
className:
|
|
143
|
+
onChange: y ? (a) => y(a, h) : void 0,
|
|
144
|
+
className: f,
|
|
144
145
|
disableCurrent: i,
|
|
145
|
-
disabledFuture:
|
|
146
|
+
disabledFuture: o,
|
|
146
147
|
disabledPast: C
|
|
147
148
|
}
|
|
148
149
|
);
|
|
149
150
|
}
|
|
150
151
|
case "textarea":
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
+
return /* @__PURE__ */ t(de, { ...v });
|
|
152
153
|
case "image":
|
|
153
|
-
return /* @__PURE__ */
|
|
154
|
-
|
|
154
|
+
return /* @__PURE__ */ t(
|
|
155
|
+
re,
|
|
155
156
|
{
|
|
156
157
|
...e,
|
|
157
158
|
required: d,
|
|
158
159
|
name: c,
|
|
159
160
|
label: n,
|
|
160
161
|
rules: m,
|
|
161
|
-
fieldClassName:
|
|
162
|
+
fieldClassName: f,
|
|
162
163
|
onRemoved: e.onRemoved,
|
|
163
164
|
onUploading: e.onUploading,
|
|
164
165
|
provider: e.provider
|
|
165
166
|
}
|
|
166
167
|
);
|
|
167
168
|
case "file":
|
|
168
|
-
return /* @__PURE__ */
|
|
169
|
-
|
|
169
|
+
return /* @__PURE__ */ t(
|
|
170
|
+
ee,
|
|
170
171
|
{
|
|
171
172
|
...e,
|
|
172
173
|
required: d,
|
|
173
174
|
name: c,
|
|
174
175
|
label: n,
|
|
175
176
|
rules: m,
|
|
176
|
-
fieldClassName:
|
|
177
|
+
fieldClassName: f,
|
|
177
178
|
onRemoved: e.onRemoved,
|
|
178
179
|
onUploading: e.onUploading,
|
|
179
180
|
provider: e.provider
|
|
180
181
|
}
|
|
181
182
|
);
|
|
182
183
|
case "select":
|
|
183
|
-
return /* @__PURE__ */
|
|
184
|
-
|
|
184
|
+
return /* @__PURE__ */ t(
|
|
185
|
+
se,
|
|
185
186
|
{
|
|
186
187
|
...e,
|
|
187
188
|
required: d,
|
|
188
189
|
name: c,
|
|
189
190
|
label: n,
|
|
190
191
|
rules: m,
|
|
191
|
-
fieldClassName:
|
|
192
|
+
fieldClassName: f,
|
|
192
193
|
form: h,
|
|
193
194
|
updatable: u,
|
|
194
|
-
readonly:
|
|
195
|
+
readonly: R,
|
|
195
196
|
fieldTooltip: b
|
|
196
197
|
}
|
|
197
198
|
);
|
|
@@ -199,13 +200,13 @@ function Te(v) {
|
|
|
199
200
|
const {
|
|
200
201
|
enum: l,
|
|
201
202
|
radio: i = !1,
|
|
202
|
-
translation:
|
|
203
|
+
translation: o,
|
|
203
204
|
onChange: C,
|
|
204
205
|
onSearch: y,
|
|
205
206
|
multiple: g,
|
|
206
207
|
tagRender: x
|
|
207
|
-
} = e,
|
|
208
|
-
return i ? /* @__PURE__ */
|
|
208
|
+
} = e, F = Array.isArray(l) ? l : Object.keys(l);
|
|
209
|
+
return i ? /* @__PURE__ */ t(
|
|
209
210
|
j.Item,
|
|
210
211
|
{
|
|
211
212
|
...e,
|
|
@@ -214,49 +215,49 @@ function Te(v) {
|
|
|
214
215
|
tooltip: b,
|
|
215
216
|
rules: m,
|
|
216
217
|
label: n,
|
|
217
|
-
className: ["w-100",
|
|
218
|
-
children: /* @__PURE__ */
|
|
219
|
-
|
|
218
|
+
className: ["w-100", f].join(" "),
|
|
219
|
+
children: /* @__PURE__ */ t(
|
|
220
|
+
M.Group,
|
|
220
221
|
{
|
|
221
222
|
...e,
|
|
222
|
-
onChange: C ? (
|
|
223
|
-
var
|
|
224
|
-
return C((
|
|
223
|
+
onChange: C ? (a) => {
|
|
224
|
+
var w;
|
|
225
|
+
return C((w = a == null ? void 0 : a.target) == null ? void 0 : w.value, h);
|
|
225
226
|
} : void 0,
|
|
226
|
-
children:
|
|
227
|
+
children: F.map((a) => /* @__PURE__ */ t(M, { disabled: !u, value: a, children: o ? T(o[a]) : a }, a))
|
|
227
228
|
}
|
|
228
229
|
)
|
|
229
230
|
}
|
|
230
|
-
) : /* @__PURE__ */
|
|
231
|
-
|
|
231
|
+
) : /* @__PURE__ */ t(
|
|
232
|
+
z,
|
|
232
233
|
{
|
|
233
234
|
...e,
|
|
234
|
-
tagRender: typeof x == "function" ? x : x ? (
|
|
235
|
-
const { value:
|
|
236
|
-
return
|
|
235
|
+
tagRender: typeof x == "function" ? x : x ? (a) => {
|
|
236
|
+
const { value: w, label: N } = a, O = x[w];
|
|
237
|
+
return O ? /* @__PURE__ */ t(W, { color: O.color, children: N }) : /* @__PURE__ */ t(W, { children: N });
|
|
237
238
|
} : void 0,
|
|
238
|
-
onChange: C ? (
|
|
239
|
-
className: ["w-100",
|
|
239
|
+
onChange: C ? (a) => C(a, h) : void 0,
|
|
240
|
+
className: ["w-100", f].join(" "),
|
|
240
241
|
name: c,
|
|
241
|
-
items:
|
|
242
|
+
items: F,
|
|
242
243
|
required: d,
|
|
243
244
|
tooltip: b,
|
|
244
245
|
rules: m,
|
|
245
246
|
label: n,
|
|
246
247
|
disabled: !u,
|
|
247
|
-
onSearch: y ? (
|
|
248
|
+
onSearch: y ? (a) => y(a, h) : void 0,
|
|
248
249
|
allowClear: !0,
|
|
249
250
|
mode: g ? "multiple" : void 0,
|
|
250
|
-
itemBuilder: (
|
|
251
|
+
itemBuilder: (a) => /* @__PURE__ */ t(I.Option, { value: a, children: o ? T(o[a]) : a }, a)
|
|
251
252
|
}
|
|
252
253
|
);
|
|
253
254
|
}
|
|
254
255
|
case "checkbox": {
|
|
255
256
|
const { onChange: l } = e;
|
|
256
|
-
return /* @__PURE__ */
|
|
257
|
-
|
|
257
|
+
return /* @__PURE__ */ t(
|
|
258
|
+
te,
|
|
258
259
|
{
|
|
259
|
-
className:
|
|
260
|
+
className: f,
|
|
260
261
|
rules: m,
|
|
261
262
|
onChange: l ? (i) => l(i, h) : void 0,
|
|
262
263
|
label: n,
|
|
@@ -267,8 +268,8 @@ function Te(v) {
|
|
|
267
268
|
);
|
|
268
269
|
}
|
|
269
270
|
case "color":
|
|
270
|
-
return /* @__PURE__ */
|
|
271
|
-
|
|
271
|
+
return /* @__PURE__ */ t(
|
|
272
|
+
ce,
|
|
272
273
|
{
|
|
273
274
|
...e,
|
|
274
275
|
type: "color",
|
|
@@ -276,109 +277,109 @@ function Te(v) {
|
|
|
276
277
|
name: c,
|
|
277
278
|
label: n,
|
|
278
279
|
rules: m,
|
|
279
|
-
fieldClassName:
|
|
280
|
+
fieldClassName: f,
|
|
280
281
|
updatable: u,
|
|
281
|
-
readonly:
|
|
282
|
+
readonly: R,
|
|
282
283
|
fieldTooltip: b
|
|
283
284
|
}
|
|
284
285
|
);
|
|
285
286
|
default:
|
|
286
|
-
return /* @__PURE__ */
|
|
287
|
+
return /* @__PURE__ */ t(S, { children: `${p} Not Implemented` });
|
|
287
288
|
}
|
|
288
289
|
}
|
|
289
|
-
function
|
|
290
|
+
function se(v) {
|
|
290
291
|
const {
|
|
291
292
|
items: n = [],
|
|
292
293
|
loading: c,
|
|
293
|
-
searchOnType:
|
|
294
|
+
searchOnType: p,
|
|
294
295
|
onSearch: d,
|
|
295
|
-
multiple:
|
|
296
|
+
multiple: k,
|
|
296
297
|
onChange: m,
|
|
297
298
|
highlightSearch: u,
|
|
298
|
-
required:
|
|
299
|
-
fieldClassName:
|
|
300
|
-
rules:
|
|
299
|
+
required: R,
|
|
300
|
+
fieldClassName: f,
|
|
301
|
+
rules: P,
|
|
301
302
|
fieldTooltip: b,
|
|
302
303
|
updatable: e,
|
|
303
304
|
label: h,
|
|
304
|
-
name:
|
|
305
|
+
name: T,
|
|
305
306
|
tagRender: l,
|
|
306
307
|
updatingValue: i,
|
|
307
|
-
onSet:
|
|
308
|
+
onSet: o,
|
|
308
309
|
placeholder: C,
|
|
309
310
|
allowClear: y = !0
|
|
310
|
-
} = v, g = v.form, [x,
|
|
311
|
+
} = v, g = v.form, [x, F] = G(""), a = _(() => $.getRealName(T), [T]), w = _(() => $.getRealName(T, "upsertFieldName"), [T]), N = j.useWatch(a, g), [O, U] = G(!0);
|
|
311
312
|
L(() => {
|
|
312
|
-
|
|
313
|
-
}, [
|
|
314
|
-
|
|
315
|
-
}, [
|
|
316
|
-
const
|
|
317
|
-
async (
|
|
318
|
-
|
|
313
|
+
o && O && N && (o == null || o(N, n, g), U(!1));
|
|
314
|
+
}, [O, g, n, a, o, N]), L(() => {
|
|
315
|
+
N && U(!0);
|
|
316
|
+
}, [N]);
|
|
317
|
+
const J = Y(
|
|
318
|
+
async (r) => {
|
|
319
|
+
F(r), p && (d == null || d(r, g, i));
|
|
319
320
|
},
|
|
320
|
-
[g, d,
|
|
321
|
+
[g, d, p, i]
|
|
321
322
|
);
|
|
322
|
-
return /* @__PURE__ */
|
|
323
|
-
|
|
323
|
+
return /* @__PURE__ */ t(
|
|
324
|
+
z,
|
|
324
325
|
{
|
|
325
326
|
...v,
|
|
326
327
|
maxTagCount: "responsive",
|
|
327
|
-
maxTagPlaceholder: (
|
|
328
|
-
|
|
328
|
+
maxTagPlaceholder: (r) => /* @__PURE__ */ E(
|
|
329
|
+
ie,
|
|
329
330
|
{
|
|
330
|
-
title: /* @__PURE__ */
|
|
331
|
+
title: /* @__PURE__ */ t(S, { children: r.map((s) => /* @__PURE__ */ E(S, { children: [
|
|
331
332
|
s.label,
|
|
332
333
|
" ",
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ t("br", {})
|
|
334
335
|
] })) }),
|
|
335
336
|
children: [
|
|
336
337
|
"+",
|
|
337
|
-
|
|
338
|
+
r == null ? void 0 : r.length
|
|
338
339
|
]
|
|
339
340
|
}
|
|
340
341
|
),
|
|
341
342
|
placeholder: C,
|
|
342
|
-
onSelect: (
|
|
343
|
-
|
|
343
|
+
onSelect: (r) => {
|
|
344
|
+
o == null || o(r == null ? void 0 : r.key, n, g);
|
|
344
345
|
},
|
|
345
|
-
onChange: m ? (
|
|
346
|
-
|
|
346
|
+
onChange: m ? (r) => {
|
|
347
|
+
F(""), m(r, g);
|
|
347
348
|
} : void 0,
|
|
348
|
-
mode:
|
|
349
|
-
className: ["w-100",
|
|
350
|
-
name:
|
|
349
|
+
mode: k ? "multiple" : void 0,
|
|
350
|
+
className: ["w-100", f].join(" "),
|
|
351
|
+
name: w,
|
|
351
352
|
items: n,
|
|
352
|
-
required:
|
|
353
|
+
required: R,
|
|
353
354
|
tooltip: b,
|
|
354
355
|
tagRender: l,
|
|
355
|
-
rules:
|
|
356
|
+
rules: P,
|
|
356
357
|
disabled: !e,
|
|
357
358
|
label: h,
|
|
358
359
|
allowClear: y,
|
|
359
|
-
onSearch:
|
|
360
|
+
onSearch: J,
|
|
360
361
|
loading: c,
|
|
361
|
-
filterOption: u ? (
|
|
362
|
+
filterOption: u ? (r, s) => {
|
|
362
363
|
var A, B, H;
|
|
363
364
|
try {
|
|
364
|
-
const
|
|
365
|
-
return
|
|
366
|
-
(
|
|
365
|
+
const q = r.toLowerCase().split(/\s+/), K = ((typeof (s == null ? void 0 : s.children) == "string" ? s == null ? void 0 : s.children : (B = (A = s == null ? void 0 : s.children) == null ? void 0 : A.props) == null ? void 0 : B.textToHighlight) ?? "").toLowerCase(), Q = (((H = s == null ? void 0 : s.value) == null ? void 0 : H.toString()) ?? "").toLowerCase();
|
|
366
|
+
return q.every(
|
|
367
|
+
(D) => K.indexOf(D) >= 0 || Q.indexOf(D) >= 0
|
|
367
368
|
);
|
|
368
369
|
} catch {
|
|
369
370
|
return !0;
|
|
370
371
|
}
|
|
371
372
|
} : void 0,
|
|
372
|
-
itemBuilder: u ? (
|
|
373
|
-
const s =
|
|
374
|
-
return /* @__PURE__ */
|
|
373
|
+
itemBuilder: u ? (r) => {
|
|
374
|
+
const s = r.value ? String(r.value) : void 0;
|
|
375
|
+
return /* @__PURE__ */ t(
|
|
375
376
|
I.Option,
|
|
376
377
|
{
|
|
377
|
-
value:
|
|
378
|
+
value: r.key,
|
|
378
379
|
title: s,
|
|
379
|
-
disabled:
|
|
380
|
-
children: /* @__PURE__ */
|
|
381
|
-
|
|
380
|
+
disabled: r.disabled,
|
|
381
|
+
children: /* @__PURE__ */ t(
|
|
382
|
+
Z,
|
|
382
383
|
{
|
|
383
384
|
highlightClassName: "highlight-text",
|
|
384
385
|
searchWords: (x ?? "").split(" "),
|
|
@@ -387,41 +388,41 @@ function le(v) {
|
|
|
387
388
|
}
|
|
388
389
|
)
|
|
389
390
|
},
|
|
390
|
-
|
|
391
|
+
r.key
|
|
391
392
|
);
|
|
392
|
-
} : (
|
|
393
|
+
} : (r) => /* @__PURE__ */ t(
|
|
393
394
|
I.Option,
|
|
394
395
|
{
|
|
395
|
-
value:
|
|
396
|
-
title:
|
|
397
|
-
disabled:
|
|
398
|
-
children:
|
|
396
|
+
value: r.key,
|
|
397
|
+
title: r.value,
|
|
398
|
+
disabled: r.disabled,
|
|
399
|
+
children: r.value
|
|
399
400
|
},
|
|
400
|
-
|
|
401
|
+
r.key
|
|
401
402
|
)
|
|
402
403
|
}
|
|
403
404
|
);
|
|
404
405
|
}
|
|
405
|
-
function
|
|
406
|
+
function ce(v) {
|
|
406
407
|
const {
|
|
407
408
|
required: n,
|
|
408
409
|
fieldClassName: c,
|
|
409
|
-
rules:
|
|
410
|
+
rules: p,
|
|
410
411
|
fieldTooltip: d,
|
|
411
|
-
updatable:
|
|
412
|
+
updatable: k,
|
|
412
413
|
label: m,
|
|
413
414
|
name: u
|
|
414
415
|
} = v;
|
|
415
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ t(
|
|
416
417
|
j.Item,
|
|
417
418
|
{
|
|
418
419
|
label: m,
|
|
419
420
|
name: u,
|
|
420
421
|
required: n,
|
|
421
|
-
rules:
|
|
422
|
+
rules: p,
|
|
422
423
|
tooltip: d,
|
|
423
|
-
children: /* @__PURE__ */
|
|
424
|
-
|
|
424
|
+
children: /* @__PURE__ */ t(
|
|
425
|
+
X,
|
|
425
426
|
{
|
|
426
427
|
disabledAlpha: !0,
|
|
427
428
|
format: "hex",
|
|
@@ -429,7 +430,7 @@ function ne(v) {
|
|
|
429
430
|
showText: !0,
|
|
430
431
|
trigger: "click",
|
|
431
432
|
className: c,
|
|
432
|
-
disabled: !
|
|
433
|
+
disabled: !k,
|
|
433
434
|
...v.innerProps
|
|
434
435
|
}
|
|
435
436
|
)
|
|
@@ -437,7 +438,7 @@ function ne(v) {
|
|
|
437
438
|
);
|
|
438
439
|
}
|
|
439
440
|
export {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
441
|
+
ce as ColorCrudFieldComponent,
|
|
442
|
+
se as SelectCrudFieldComponent,
|
|
443
|
+
Re as default
|
|
443
444
|
};
|
package/crud/CrudForm.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),c=require("antd"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),c=require("antd"),p=require("./CrudField.cjs.js"),b=require("../util/CrudUtil.cjs.js");function v({form:i,purpose:y="new",...m}){return e.jsx(c.Form,{form:i,layout:"vertical",children:e.jsx(x,{...m,purpose:y})})}function x({fields:i,formBuilder:y,grid:m,onDeleteFile:d,onUploadFile:u,purpose:o}){const j=s.useMemo(()=>i.filter(t=>!t.readonly).map(t=>{const a={onUploading:t.type==="image"||t.type==="file"?r=>{var n;t.onUploading&&((n=t.onUploading)==null||n.call(t,r)),u==null||u(r)}:void 0,onDelete:t.type==="image"||t.type==="file"?r=>{var n;t.onUploading&&((n=t.onDelete)==null||n.call(t,r)),d==null||d(r)}:void 0};return e.jsx(s.Fragment,{children:t.grid&&m?e.jsx(c.Col,{...t.grid,children:s.createElement(p.default,{...t,...a,key:typeof t.name=="string"?t.name:String(t.name),updatable:o!=="update"?!0:t.updatable})}):s.createElement(p.default,{...t,...a,key:typeof t.name=="string"?t.name:String(t.name),updatable:o!=="update"?!0:t.updatable})},t.name)}),[i,m,d,u,o]),C=s.useCallback((t,a={})=>{const r=i.find(n=>b.getRealName(n.name)===t);if(r!=null&&r.hidden)return e.jsx(e.Fragment,{});if(r){const n={onUploading:r.type==="image"||r.type==="file"?g=>{var f;r.onUploading&&((f=r.onUploading)==null||f.call(r,g)),u==null||u(g)}:void 0,onDelete:r.type==="image"||r.type==="file"?g=>{var f;r.onUploading&&((f=r.onDelete)==null||f.call(r,g)),d==null||d(g)}:void 0},l=b.getRealName(r.name),h=s.createElement(p.default,{...r,...a,...n,key:typeof l=="string"?l:String(l),updatable:o!=="update"?!0:r.updatable});return a.render?a.render(h):h}return e.jsx(e.Fragment,{})},[i,o]);return e.jsx(e.Fragment,{children:y?e.jsxs(e.Fragment,{children:[y(C,{isAnyFieldHidden(...t){const a=Array.isArray(t)?t:[t];return i.filter(n=>a.includes(n.name)).some(n=>n.hidden)},isAllFieldsHidden(...t){const a=Array.isArray(t)?t:[t];return i.filter(n=>a.includes(n.name)).every(n=>n.hidden)}}),e.jsxs(c.Form.Item,{hidden:!0,noStyle:!0,children:[e.jsx(c.Input,{name:"id"}),e.jsx(c.Input,{})]})]}):m?e.jsx(c.Row,{gutter:[8,8],children:j}):j})}exports.CrudForm=v;exports.CrudFormFields=x;
|