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