@kingteza/crud-component 1.0.14 → 1.0.16
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/components/common/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/common/DatePicker/DatePicker.js +42 -42
- package/dist/components/common/DatePicker/TimePicker.cjs +1 -1
- package/dist/components/common/DatePicker/TimePicker.js +39 -39
- package/dist/components/common/appearance/Hider.cjs +1 -1
- package/dist/components/common/appearance/Hider.js +3 -3
- package/dist/components/common/button/Button.cjs +1 -1
- package/dist/components/common/button/Button.js +19 -19
- package/dist/components/common/button/CloneButtonTable.cjs +1 -1
- package/dist/components/common/button/CloneButtonTable.js +11 -11
- package/dist/components/common/button/DeleteButtonTable.cjs +1 -1
- package/dist/components/common/button/DeleteButtonTable.js +29 -29
- package/dist/components/common/button/ExportButton.cjs +1 -1
- package/dist/components/common/button/ExportButton.js +17 -17
- package/dist/components/common/button/HideButtonTable.cjs +1 -1
- package/dist/components/common/button/HideButtonTable.js +35 -35
- package/dist/components/common/button/ImportButton.cjs +1 -1
- package/dist/components/common/button/ImportButton.js +28 -28
- package/dist/components/common/button/NewButton.cjs +1 -1
- package/dist/components/common/button/NewButton.js +14 -14
- package/dist/components/common/button/PrintButton.cjs +1 -1
- package/dist/components/common/button/PrintButton.js +14 -14
- package/dist/components/common/button/RefreshButton.cjs +1 -1
- package/dist/components/common/button/RefreshButton.js +16 -16
- package/dist/components/common/button/UnHideButton.cjs +1 -1
- package/dist/components/common/button/UnHideButton.js +37 -37
- package/dist/components/common/button/UpdateButtonTable.cjs +1 -1
- package/dist/components/common/button/UpdateButtonTable.js +11 -11
- package/dist/components/common/button/ViewButtonTable.cjs +1 -1
- package/dist/components/common/button/ViewButtonTable.js +10 -10
- package/dist/components/common/check-box/CheckBox.cjs +1 -1
- package/dist/components/common/check-box/CheckBox.js +20 -20
- package/dist/components/common/description/DescList.cjs +1 -1
- package/dist/components/common/description/DescList.js +9 -9
- package/dist/components/common/layout/VerticalSpace.cjs +1 -1
- package/dist/components/common/layout/VerticalSpace.js +3 -3
- package/dist/components/common/loading/LoadingIndicator.cjs +1 -1
- package/dist/components/common/loading/LoadingIndicator.js +12 -12
- package/dist/components/common/picker/ImagePicker.cjs +1 -1
- package/dist/components/common/picker/ImagePicker.js +173 -176
- package/dist/components/common/radio/RadioGroupComponent.cjs +1 -1
- package/dist/components/common/radio/RadioGroupComponent.js +6 -6
- package/dist/components/common/report/SelectFieldInReport.cjs +1 -1
- package/dist/components/common/report/SelectFieldInReport.js +11 -11
- package/dist/components/common/select/CustomSelectOption.cjs +1 -1
- package/dist/components/common/select/CustomSelectOption.js +7 -7
- package/dist/components/common/select/SelectComponent.cjs +1 -1
- package/dist/components/common/select/SelectComponent.js +36 -36
- package/dist/components/common/show-more/index.cjs +1 -1
- package/dist/components/common/show-more/index.js +5 -5
- package/dist/components/common/tab/TabViewWithRoute.cjs +1 -1
- package/dist/components/common/tab/TabViewWithRoute.js +23 -22
- package/dist/components/common/table/table.cjs +1 -1
- package/dist/components/common/table/table.js +12 -12
- package/dist/components/common/tag/StatusTag.cjs +1 -1
- package/dist/components/common/tag/StatusTag.js +13 -13
- package/dist/components/common/text-field/NumberField.cjs +1 -1
- package/dist/components/common/text-field/NumberField.js +43 -43
- package/dist/components/common/text-field/PhoneNumberField.cjs +1 -1
- package/dist/components/common/text-field/PhoneNumberField.js +4 -4
- package/dist/components/common/text-field/TextArea.cjs +1 -1
- package/dist/components/common/text-field/TextArea.js +20 -20
- package/dist/components/common/text-field/TextField.cjs +1 -1
- package/dist/components/common/text-field/TextField.js +47 -47
- package/dist/components/common/tooltip/TooltipComponent.cjs +1 -1
- package/dist/components/common/tooltip/TooltipComponent.js +3 -3
- package/dist/components/common/wizard/WizardResult.cjs +1 -1
- package/dist/components/common/wizard/WizardResult.js +37 -38
- package/dist/components/common/wizard/WizardViewForm.cjs +1 -1
- package/dist/components/common/wizard/WizardViewForm.js +43 -43
- package/dist/components/crud/CrudComponent.cjs +1 -1
- package/dist/components/crud/CrudComponent.js +130 -130
- package/dist/components/crud/CrudField.cjs +1 -1
- package/dist/components/crud/CrudField.js +217 -217
- package/dist/components/crud/CrudForm.cjs +1 -1
- package/dist/components/crud/CrudForm.js +55 -55
- package/dist/components/crud/CrudFormWizard.cjs +1 -1
- package/dist/components/crud/CrudFormWizard.js +82 -84
- package/dist/components/crud/CrudReportComponent.cjs +3 -3
- package/dist/components/crud/CrudReportComponent.js +123 -123
- package/dist/components/crud/CrudSearchComponent.cjs +1 -1
- package/dist/components/crud/CrudSearchComponent.js +43 -43
- package/dist/components/crud/FileCrudField.cjs +1 -1
- package/dist/components/crud/FileCrudField.js +118 -125
- package/dist/components/crud/ImageCrudField.cjs +1 -1
- package/dist/components/crud/ImageCrudField.js +56 -56
- package/dist/components/crud/import/CrudImportButton.cjs +1 -1
- package/dist/components/crud/import/CrudImportButton.js +18 -18
- package/dist/components/crud/import/CrudImportComponent.cjs +2 -2
- package/dist/components/crud/import/CrudImportComponent.js +108 -109
- package/dist/components/crud/view/CrudDecListView.cjs +1 -1
- package/dist/components/crud/view/CrudDecListView.js +22 -22
- package/dist/components/crud/view/CrudViewer.cjs +1 -1
- package/dist/components/crud/view/CrudViewer.js +152 -152
- package/dist/components/crud/view/CrudViewerUtil.cjs +1 -1
- package/dist/components/crud/view/CrudViewerUtil.js +33 -34
- package/dist/locale/index.cjs +1 -1
- package/dist/locale/index.js +2 -2
- package/dist/util/DateUtil.cjs +1 -1
- package/dist/util/DateUtil.js +4 -4
- package/dist/util/ImageUtil.cjs +1 -1
- package/dist/util/ImageUtil.js +1 -1
- package/dist/util/ValidationUtil.cjs +1 -1
- package/dist/util/ValidationUtil.js +1 -1
- package/package.json +1 -1
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Space as
|
|
3
|
-
import
|
|
4
|
-
import { useState as m, useCallback as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
const { useForm:
|
|
14
|
-
function
|
|
15
|
-
idField:
|
|
16
|
-
onCreate:
|
|
17
|
-
onDelete:
|
|
18
|
-
onHide:
|
|
1
|
+
import { jsxs as y, Fragment as se, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { Space as D, Modal as re, Spin as ce, Form as me } from "antd";
|
|
3
|
+
import fe from "dayjs";
|
|
4
|
+
import { useState as m, useCallback as F, useEffect as de } from "react";
|
|
5
|
+
import { useTranslation as ue } from "react-i18next";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as pe } from "../../locale/hooks/translation-constants.js";
|
|
7
|
+
import { CrudForm as ye } from "./CrudForm.js";
|
|
8
|
+
import Fe from "./CrudFormWizard.js";
|
|
9
|
+
import ge from "./import/CrudImportButton.js";
|
|
10
|
+
import ve from "./view/CrudViewer.js";
|
|
11
|
+
import { NewButton as Ce } from "../common/button/NewButton.js";
|
|
12
|
+
import { PrintButton as Be } from "../common/button/PrintButton.js";
|
|
13
|
+
const { useForm: he } = me;
|
|
14
|
+
function Ie({
|
|
15
|
+
idField: g = "id",
|
|
16
|
+
onCreate: B,
|
|
17
|
+
onDelete: U,
|
|
18
|
+
onHide: W,
|
|
19
19
|
onUpdate: d,
|
|
20
20
|
fields: l,
|
|
21
|
-
data:
|
|
22
|
-
grid:
|
|
23
|
-
isHiding:
|
|
24
|
-
isCreating:
|
|
21
|
+
data: w,
|
|
22
|
+
grid: L,
|
|
23
|
+
isHiding: H,
|
|
24
|
+
isCreating: V,
|
|
25
25
|
isDeleting: R,
|
|
26
|
-
isUpdating:
|
|
27
|
-
paginateProps:
|
|
28
|
-
onPrint:
|
|
29
|
-
printing:
|
|
30
|
-
viewable:
|
|
31
|
-
loadingData:
|
|
32
|
-
formBuilder:
|
|
33
|
-
extraAction:
|
|
34
|
-
minusHeight:
|
|
35
|
-
cloneable:
|
|
36
|
-
fullWidthModal:
|
|
26
|
+
isUpdating: P,
|
|
27
|
+
paginateProps: q,
|
|
28
|
+
onPrint: A,
|
|
29
|
+
printing: G,
|
|
30
|
+
viewable: J,
|
|
31
|
+
loadingData: K,
|
|
32
|
+
formBuilder: Q,
|
|
33
|
+
extraAction: X,
|
|
34
|
+
minusHeight: Y,
|
|
35
|
+
cloneable: Z,
|
|
36
|
+
fullWidthModal: $ = !0,
|
|
37
37
|
wizard: a,
|
|
38
|
-
extraView:
|
|
39
|
-
importable:
|
|
40
|
-
onClickNew:
|
|
41
|
-
...
|
|
38
|
+
extraView: z,
|
|
39
|
+
importable: j,
|
|
40
|
+
onClickNew: O,
|
|
41
|
+
...ee
|
|
42
42
|
}) {
|
|
43
|
-
const { t:
|
|
44
|
-
async (
|
|
45
|
-
const
|
|
46
|
-
|
|
43
|
+
const { t: h } = ue(pe), [k, v] = m(!1), [u, b] = m(), [te, x] = m(), [i] = he(), T = F(
|
|
44
|
+
async (o) => {
|
|
45
|
+
const r = a ? o : await i.validateFields(), s = l.filter((e) => e.type === "color"), n = {};
|
|
46
|
+
s.forEach((e) => {
|
|
47
47
|
var f;
|
|
48
48
|
const t = i.getFieldValue(e.name);
|
|
49
|
-
|
|
50
|
-
}), Object.assign(
|
|
51
|
-
...
|
|
52
|
-
[
|
|
53
|
-
}),
|
|
49
|
+
n[e.name] = typeof t == "string" ? t : (f = t == null ? void 0 : t.toHexString()) == null ? void 0 : f.toUpperCase();
|
|
50
|
+
}), Object.assign(r, n), u && d ? (await d({
|
|
51
|
+
...r,
|
|
52
|
+
[g]: u[g]
|
|
53
|
+
}), b(void 0)) : !u && B && await B(r), x(void 0), i.resetFields(), v(!1);
|
|
54
54
|
},
|
|
55
|
-
[l, i,
|
|
56
|
-
), [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
}, []),
|
|
63
|
-
|
|
64
|
-
}, []), [
|
|
65
|
-
async (
|
|
55
|
+
[l, i, g, B, d, u, a]
|
|
56
|
+
), [oe, E] = m(!1), [ne, S] = m(!1);
|
|
57
|
+
de(() => {
|
|
58
|
+
k ? (E(!1), S(!1)) : C(void 0);
|
|
59
|
+
}, [k]);
|
|
60
|
+
const I = F(async (o) => {
|
|
61
|
+
E(o), S(!0);
|
|
62
|
+
}, []), M = F(async () => {
|
|
63
|
+
S(!0);
|
|
64
|
+
}, []), [le, _] = m(!1), N = F(
|
|
65
|
+
async (o, r = !0, s = !1) => {
|
|
66
66
|
try {
|
|
67
|
-
|
|
68
|
-
const
|
|
67
|
+
_(!0), v(!0), r && C("update");
|
|
68
|
+
const n = {};
|
|
69
69
|
for (const e of l) {
|
|
70
|
-
const t =
|
|
71
|
-
if (
|
|
70
|
+
const t = o[e.name];
|
|
71
|
+
if (s && e.type === "image") {
|
|
72
72
|
const f = t;
|
|
73
73
|
try {
|
|
74
|
-
const
|
|
75
|
-
|
|
74
|
+
const ie = await e.provider.clone(f);
|
|
75
|
+
n[e.name] = ie;
|
|
76
76
|
continue;
|
|
77
77
|
} catch {
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
e.type === "date" ? t && (
|
|
81
|
+
e.type === "date" ? t && (n[e.name] = fe(t)) : e.type === "select" ? e.multiple && Array.isArray(t) ? n[e.name] = t.map(
|
|
82
82
|
(f) => f[e.innerFieldId ?? "id"]
|
|
83
|
-
) : t && typeof t == "object" ?
|
|
83
|
+
) : t && typeof t == "object" ? n[e.name] = t[e.innerFieldId ?? "id"] : (t && typeof t == "string" || typeof t == "number") && (n[e.name] = t) : n[e.name] = t;
|
|
84
84
|
}
|
|
85
|
-
i.setFieldsValue(
|
|
85
|
+
i.setFieldsValue(n), x(n), r && b(o);
|
|
86
86
|
} finally {
|
|
87
|
-
|
|
87
|
+
_(!1);
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
[l, i]
|
|
91
|
-
), [p,
|
|
92
|
-
async (
|
|
93
|
-
|
|
91
|
+
), [p, C] = m(), ae = F(
|
|
92
|
+
async (o) => {
|
|
93
|
+
C("clone"), N(o, !1, !0);
|
|
94
94
|
},
|
|
95
|
-
[
|
|
95
|
+
[N]
|
|
96
96
|
);
|
|
97
|
-
return /* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
|
|
97
|
+
return /* @__PURE__ */ y(se, { children: [
|
|
98
|
+
/* @__PURE__ */ y(D, { direction: "vertical", className: "w-100", children: [
|
|
99
|
+
/* @__PURE__ */ y("div", { className: "w-100 d-flex", children: [
|
|
100
|
+
/* @__PURE__ */ c("div", { style: { flex: 1 }, children: /* @__PURE__ */ c(
|
|
101
|
+
Ce,
|
|
102
102
|
{
|
|
103
103
|
onClick: () => {
|
|
104
|
-
|
|
104
|
+
O ? O() : (v((o) => !o), C("new"));
|
|
105
105
|
},
|
|
106
106
|
className: "flex-1"
|
|
107
107
|
}
|
|
108
108
|
) }),
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
!!
|
|
111
|
-
|
|
109
|
+
/* @__PURE__ */ y(D, { children: [
|
|
110
|
+
!!A && /* @__PURE__ */ c(
|
|
111
|
+
Be,
|
|
112
112
|
{
|
|
113
113
|
className: "float-right",
|
|
114
|
-
loading:
|
|
115
|
-
onClick:
|
|
114
|
+
loading: G,
|
|
115
|
+
onClick: A
|
|
116
116
|
}
|
|
117
117
|
),
|
|
118
|
-
!!
|
|
118
|
+
!!j && /* @__PURE__ */ c(ge, { fields: l, importProps: j })
|
|
119
119
|
] })
|
|
120
120
|
] }),
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
|
|
121
|
+
/* @__PURE__ */ c(
|
|
122
|
+
ve,
|
|
123
123
|
{
|
|
124
|
-
...
|
|
125
|
-
minusHeight:
|
|
126
|
-
data:
|
|
124
|
+
...ee,
|
|
125
|
+
minusHeight: Y,
|
|
126
|
+
data: w,
|
|
127
127
|
fields: l,
|
|
128
|
-
extraAction:
|
|
129
|
-
idField:
|
|
128
|
+
extraAction: X,
|
|
129
|
+
idField: g,
|
|
130
130
|
isDeleting: R,
|
|
131
|
-
loadingData:
|
|
132
|
-
onClickUpdate: d ?
|
|
133
|
-
onHide:
|
|
134
|
-
isHiding:
|
|
135
|
-
onDelete:
|
|
131
|
+
loadingData: K,
|
|
132
|
+
onClickUpdate: d ? N : void 0,
|
|
133
|
+
onHide: W,
|
|
134
|
+
isHiding: H,
|
|
135
|
+
onDelete: U,
|
|
136
136
|
onUpdate: d,
|
|
137
|
-
onClickClone:
|
|
138
|
-
paginateProps:
|
|
139
|
-
viewable:
|
|
140
|
-
extraView:
|
|
137
|
+
onClickClone: Z ? ae : void 0,
|
|
138
|
+
paginateProps: q,
|
|
139
|
+
viewable: J,
|
|
140
|
+
extraView: z
|
|
141
141
|
}
|
|
142
142
|
)
|
|
143
143
|
] }),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
144
|
+
/* @__PURE__ */ c(
|
|
145
|
+
re,
|
|
146
146
|
{
|
|
147
|
-
width:
|
|
148
|
-
title:
|
|
149
|
-
open:
|
|
150
|
-
confirmLoading:
|
|
151
|
-
okText:
|
|
152
|
-
cancelText:
|
|
147
|
+
width: $ ? "100%" : void 0,
|
|
148
|
+
title: h(p ?? "new"),
|
|
149
|
+
open: k,
|
|
150
|
+
confirmLoading: V || P,
|
|
151
|
+
okText: h("str." + (p === "update" ? "update" : "save")),
|
|
152
|
+
cancelText: h("str.cancel"),
|
|
153
153
|
cancelButtonProps: {
|
|
154
|
-
disabled:
|
|
154
|
+
disabled: ne,
|
|
155
155
|
hidden: !!a
|
|
156
156
|
},
|
|
157
157
|
okButtonProps: {
|
|
158
|
-
disabled:
|
|
158
|
+
disabled: oe,
|
|
159
159
|
hidden: !!a
|
|
160
160
|
},
|
|
161
161
|
onCancel: async () => {
|
|
162
162
|
try {
|
|
163
163
|
if (p === "clone") {
|
|
164
|
-
const
|
|
165
|
-
for (const
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
const o = a ? u : i.getFieldsValue(), r = l.filter((s) => s.type === "image");
|
|
165
|
+
for (const s of r)
|
|
166
|
+
o[s.name] && s.provider.delete(
|
|
167
|
+
o[s.name]
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
} finally {
|
|
171
171
|
}
|
|
172
|
-
a || i.resetFields(),
|
|
172
|
+
a || i.resetFields(), x(void 0), b(void 0), v(!1);
|
|
173
173
|
},
|
|
174
|
-
onOk: () =>
|
|
174
|
+
onOk: () => T(),
|
|
175
175
|
destroyOnClose: !0,
|
|
176
|
-
children: /* @__PURE__ */
|
|
177
|
-
!a && /* @__PURE__ */
|
|
178
|
-
|
|
176
|
+
children: /* @__PURE__ */ y(ce, { spinning: le, children: [
|
|
177
|
+
!a && /* @__PURE__ */ c(
|
|
178
|
+
ye,
|
|
179
179
|
{
|
|
180
180
|
purpose: p,
|
|
181
181
|
fields: l,
|
|
182
182
|
form: i,
|
|
183
|
-
formBuilder:
|
|
184
|
-
grid:
|
|
185
|
-
onDeleteFile:
|
|
186
|
-
onUploadFile:
|
|
183
|
+
formBuilder: Q,
|
|
184
|
+
grid: L,
|
|
185
|
+
onDeleteFile: M,
|
|
186
|
+
onUploadFile: I
|
|
187
187
|
}
|
|
188
188
|
),
|
|
189
|
-
a && /* @__PURE__ */
|
|
190
|
-
|
|
189
|
+
a && /* @__PURE__ */ c(
|
|
190
|
+
Fe,
|
|
191
191
|
{
|
|
192
|
-
submitting:
|
|
192
|
+
submitting: V || P,
|
|
193
193
|
className: "mt-2",
|
|
194
|
-
onSave:
|
|
195
|
-
updatingValue:
|
|
194
|
+
onSave: T,
|
|
195
|
+
updatingValue: te,
|
|
196
196
|
fields: l,
|
|
197
|
-
onDeleteFile:
|
|
198
|
-
onUploadFile:
|
|
197
|
+
onDeleteFile: M,
|
|
198
|
+
onUploadFile: I,
|
|
199
199
|
purpose: p,
|
|
200
200
|
wizard: a
|
|
201
201
|
}
|
|
@@ -206,5 +206,5 @@ function Oe({
|
|
|
206
206
|
] });
|
|
207
207
|
}
|
|
208
208
|
export {
|
|
209
|
-
|
|
209
|
+
Ie as default
|
|
210
210
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),v=require("antd"),q=require("react"),D=require("react-highlight-words"),W=require("react-i18next"),G=require("../../locale/hooks/translation-constants.cjs"),$=require("./FileCrudField.cjs"),z=require("./ImageCrudField.cjs"),J=require("../common/DatePicker/DatePicker.cjs"),K=require("../common/DatePicker/TimePicker.cjs"),Q=require("../common/check-box/CheckBox.cjs"),L=require("../common/select/SelectComponent.cjs"),X=require("../common/text-field/NumberField.cjs"),Y=require("../common/text-field/TextField.cjs"),Z=require("../common/text-field/TextArea.cjs"),V=require("../common/tooltip/TooltipComponent.cjs");function ee(F){const{label:o,name:c,type:p,required:i,hidden:N,rules:m=[],updatable:h=!0,readonly:S=!1,fieldClassName:C,customFormFieldRender:w,fieldTooltip:b,...e}=F,g=v.Form.useFormInstance();q.useEffect(()=>{if(p==="select"){const{items:a=[],onSearch:n,searchOnType:l}=e;!(a!=null&&a.length)&&!l&&(n==null||n(void 0,g,e==null?void 0:e.updatingValue))}},[g,e,p,e==null?void 0:e.updatingValue]);const{t:T}=W.useTranslation(G.TRANSLATION_NAMESPACE);if(S||N)return t.jsx(t.Fragment,{});if(w)return w(g,F);switch(p){case"text":case"email":case"password":{const{onChange:a,placeholder:n}=e;return t.jsx(Y.default,{placeholder:n,disabled:!h,rules:m,required:i,onChange:a?l=>a(l,g):void 0,type:p,name:c,tooltip:b,label:o,className:C,autoComplete:"new-password"})}case"number":{const{onChange:a,placeholder:n,allowMinus:l}=e;return t.jsx(X,{placeholder:n,disabled:!h,moneyField:!!e.formatted,type:p,onChange:a?f=>a(f,g):void 0,rules:m,autoComplete:"false",required:i,tooltip:b,className:C,min:l?null:void 0,name:c,label:o})}case"date":{const{range:a,disableToday:n,disabledFutureDays:l,disabledPastDays:f,onChange:x,placeholder:u,format:y}=e;return t.jsx(J,{placeholder:u,required:i,disabled:!h,type:p,format:y,tooltip:b,range:a,name:c,label:o,onChange:x?s=>x(s,g):void 0,className:C,disableToday:n,disabledFutureDays:l,disabledPastDays:f})}case"time":{const{range:a=!1,disableCurrent:n,disabledFuture:l,disabledPast:f,onChange:x,use12Hours:u,format:y,placeholder:s}=e;return t.jsx(K,{placeholder:s,required:i,format:y,disabled:!h,type:p,tooltip:b,range:a,use12Hours:u,name:c,label:o,onChange:x?j=>x(j,g):void 0,className:C,disableCurrent:n,disabledFuture:l,disabledPast:f})}case"textarea":{const{onChange:a,placeholder:n,rows:l,cols:f}=e;return t.jsx(Z.default,{rules:m,placeholder:n,onChange:a?x=>{var u;return a((u=x==null?void 0:x.target)==null?void 0:u.value,g)}:void 0,tooltip:b,required:i,disabled:!h,name:c,label:o,className:C,rows:l,cols:f})}case"image":return t.jsx(z.default,{...e,required:i,name:c,label:o,rules:m,fieldClassName:C,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"file":return t.jsx($.default,{...e,required:i,name:c,label:o,rules:m,fieldClassName:C,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"select":return t.jsx(B,{...e,required:i,name:c,label:o,rules:m,fieldClassName:C,form:g,updatable:h,readonly:S,fieldTooltip:b});case"enum":{const{enum:a,radio:n=!1,translation:l,onChange:f,onSearch:x,multiple:u}=e,y=Array.isArray(a)?a:Object.keys(a);return n?t.jsx(v.Form.Item,{...e,name:c,required:i,tooltip:b,rules:m,label:o,className:["w-100",C].join(" "),children:t.jsx(v.Radio.Group,{...e,onChange:f?s=>{var j;return f((j=s==null?void 0:s.target)==null?void 0:j.value,g)}:void 0,children:y.map(s=>t.jsx(v.Radio,{disabled:!h,value:s,children:l?T(l[s]):s},s))})}):t.jsx(L,{...e,onChange:f?s=>f(s,g):void 0,className:["w-100",C].join(" "),name:c,items:y,required:i,tooltip:b,rules:m,label:o,disabled:!h,onSearch:x?s=>x(s,g):void 0,allowClear:!0,mode:u?"multiple":void 0,itemBuilder:s=>t.jsx(v.Select.Option,{value:s,children:l?T(l[s]):s},s)})}case"checkbox":{const{onChange:a}=e;return t.jsx(Q,{className:C,rules:m,onChange:a?n=>a(n,g):void 0,label:o,tooltip:b,disabled:!h,name:c})}case"color":return t.jsx(H,{...e,type:"color",required:i,name:c,label:o,rules:m,fieldClassName:C,updatable:h,readonly:S,fieldTooltip:b});default:return t.jsx(t.Fragment,{children:`${p} Not Implemented`})}}function B(F){const{items:o=[],loading:c,searchOnType:p,onSearch:i,multiple:N,onChange:m,highlightSearch:h,required:S,fieldClassName:C,rules:w,fieldTooltip:b,updatable:e,label:g,name:T,tagRender:a,updatingValue:n,onSet:l,placeholder:f,allowClear:x=!0}=F,u=F.form,[y,s]=q.useState(""),j=v.Form.useWatch(T,u),[k,O]=q.useState(!0);q.useEffect(()=>{l&&k&&j&&(l==null||l(j,o,u),O(!1))},[k,u,o,T,l,j]),q.useEffect(()=>{j&&O(!0)},[j]);const M=q.useCallback(async r=>{s(r),p&&(i==null||i(r,u,n))},[u,i,p,n]);return t.jsx(L,{...F,maxTagCount:"responsive",maxTagPlaceholder:r=>t.jsxs(V,{title:t.jsx(t.Fragment,{children:r.map(d=>t.jsxs(t.Fragment,{children:[d.label," ",t.jsx("br",{})]}))}),children:["+",r==null?void 0:r.length]}),placeholder:f,onSelect:r=>{l==null||l(r==null?void 0:r.key,o,u)},onChange:m?r=>{s(""),m(r,u)}:void 0,mode:N?"multiple":void 0,className:["w-100",C].join(" "),name:T,items:o,required:S,tooltip:b,tagRender:a,rules:w,disabled:!e,label:g,allowClear:x,onSearch:M,loading:c,filterOption:h?(r,d)=>{var R,P,A;try{const I=r.toLowerCase().split(/\s+/),U=((typeof(d==null?void 0:d.children)=="string"?d==null?void 0:d.children:(P=(R=d==null?void 0:d.children)==null?void 0:R.props)==null?void 0:P.textToHighlight)??"").toLowerCase(),_=(((A=d==null?void 0:d.value)==null?void 0:A.toString())??"").toLowerCase();return I.every(E=>U.indexOf(E)>=0||_.indexOf(E)>=0)}catch{return!0}}:void 0,itemBuilder:h?r=>{const d=r.value?String(r.value):void 0;return t.jsx(v.Select.Option,{value:r.key,title:d,disabled:r.disabled,children:t.jsx(D,{highlightClassName:"highlight-text",searchWords:(y??"").split(" "),autoEscape:!0,textToHighlight:d??""})},r.key)}:r=>t.jsx(v.Select.Option,{value:r.key,title:r.value,disabled:r.disabled,children:r.value},r.key)})}function H(F){const{required:o,fieldClassName:c,rules:p,fieldTooltip:i,updatable:N,label:m,name:h}=F;return t.jsx(v.Form.Item,{label:m,name:h,required:o,rules:p,tooltip:i,children:t.jsx(v.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:c,disabled:!N,...F.innerProps})})}exports.ColorCrudFieldComponent=H;exports.SelectCrudFieldComponent=B;exports.default=ee;
|