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