@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,70 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import X from "../../../node_modules/@ant-design/icons/es/icons/DownloadOutlined.js";
|
|
1
|
+
import { jsxs as y, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { WarningTwoTone as q, DownloadOutlined as z } from "@ant-design/icons";
|
|
3
|
+
import R from "papaparse";
|
|
4
|
+
import { Tooltip as B, Modal as O, Space as V, Spin as _, Progress as $ } from "antd";
|
|
5
|
+
import { saveAs as U } from "file-saver";
|
|
6
|
+
import { useState as v, useEffect as G, useMemo as A, useCallback as m } from "react";
|
|
7
|
+
import { useTranslation as H } from "react-i18next";
|
|
8
|
+
import { TRANSLATION_NAMESPACE as J } from "../../../locale/hooks/translation-constants.js";
|
|
9
|
+
import K from "../view/CrudViewer.js";
|
|
10
|
+
import Q from "../../../util/DateUtil.js";
|
|
11
|
+
import X from "../../common/button/Button.js";
|
|
12
|
+
import { ImportButton as Y } from "../../common/button/ImportButton.js";
|
|
14
13
|
function de({
|
|
15
|
-
onCloseMethod:
|
|
16
|
-
open:
|
|
17
|
-
fields:
|
|
14
|
+
onCloseMethod: x,
|
|
15
|
+
open: b,
|
|
16
|
+
fields: N,
|
|
18
17
|
importProps: o
|
|
19
18
|
}) {
|
|
20
|
-
const [c,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, [
|
|
24
|
-
const u =
|
|
19
|
+
const [c, D] = v([]), [C, w] = v(!1), [E, F] = v(0);
|
|
20
|
+
G(() => {
|
|
21
|
+
b || (D([]), w(!1));
|
|
22
|
+
}, [b]);
|
|
23
|
+
const u = A(
|
|
25
24
|
() => new Map(
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
return !e.hidden && !((
|
|
25
|
+
N.filter((e) => {
|
|
26
|
+
var t;
|
|
27
|
+
return !e.hidden && !((t = e.importProps) != null && t.hidden) && !e.readonly;
|
|
29
28
|
}).map((e) => [e.name, e])
|
|
30
29
|
),
|
|
31
|
-
[
|
|
32
|
-
),
|
|
30
|
+
[N]
|
|
31
|
+
), I = A(
|
|
33
32
|
() => Array.from(u.values()).flatMap((e) => {
|
|
34
|
-
var
|
|
33
|
+
var t;
|
|
35
34
|
return [
|
|
36
35
|
e.name,
|
|
37
|
-
...((
|
|
36
|
+
...((t = e.importProps) == null ? void 0 : t.extraFields) ?? []
|
|
38
37
|
];
|
|
39
38
|
}),
|
|
40
39
|
[u]
|
|
41
|
-
),
|
|
40
|
+
), M = m(
|
|
42
41
|
async function() {
|
|
43
|
-
const e = `${
|
|
44
|
-
`,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(o == null ? void 0 : o.name) + " - " +
|
|
42
|
+
const e = `${I.join(",")}
|
|
43
|
+
`, t = new Blob([e], { type: "text/csv;charset=utf-8;" });
|
|
44
|
+
U(
|
|
45
|
+
t,
|
|
46
|
+
(o == null ? void 0 : o.name) + " - " + Q.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
|
|
48
47
|
);
|
|
49
48
|
},
|
|
50
|
-
[
|
|
51
|
-
), { t:
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
var
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
}, []),
|
|
59
|
-
var
|
|
49
|
+
[I, o == null ? void 0 : o.name]
|
|
50
|
+
), { t: l } = H(J), L = m(async (e) => {
|
|
51
|
+
const t = new FileReader();
|
|
52
|
+
t.onerror = console.error, t.onload = async (r) => {
|
|
53
|
+
var n;
|
|
54
|
+
const i = (n = r == null ? void 0 : r.target) == null ? void 0 : n.result, a = R.parse(i, { header: !0 });
|
|
55
|
+
D(a.data);
|
|
56
|
+
}, t.readAsText(e);
|
|
57
|
+
}, []), g = A(() => {
|
|
58
|
+
var t, r, i;
|
|
60
59
|
let e = !1;
|
|
61
60
|
for (const a of c)
|
|
62
|
-
for (const [
|
|
63
|
-
const
|
|
61
|
+
for (const [n, d] of u.entries()) {
|
|
62
|
+
const h = a[n], f = h || !isNaN(h);
|
|
64
63
|
if (d.required && !f)
|
|
65
|
-
if ((
|
|
66
|
-
for (const
|
|
67
|
-
if (a[
|
|
64
|
+
if ((r = (t = d.importProps) == null ? void 0 : t.extraFields) != null && r.length)
|
|
65
|
+
for (const T of ((i = d.importProps) == null ? void 0 : i.extraFields) ?? [])
|
|
66
|
+
if (a[T] || !isNaN(a[T])) {
|
|
68
67
|
e = !1;
|
|
69
68
|
break;
|
|
70
69
|
} else return !0;
|
|
@@ -72,119 +71,119 @@ function de({
|
|
|
72
71
|
}
|
|
73
72
|
return e;
|
|
74
73
|
}, [c, u]), p = m(
|
|
75
|
-
(e) => (
|
|
76
|
-
var a,
|
|
77
|
-
const
|
|
78
|
-
if (e.required && !
|
|
79
|
-
let
|
|
80
|
-
if ((
|
|
74
|
+
(e) => (t, r) => {
|
|
75
|
+
var a, n, d;
|
|
76
|
+
const i = t || !isNaN(t);
|
|
77
|
+
if (e.required && !i) {
|
|
78
|
+
let h = l("err.validation.required");
|
|
79
|
+
if ((n = (a = e.importProps) == null ? void 0 : a.extraFields) != null && n.length) {
|
|
81
80
|
const f = (d = e.importProps) == null ? void 0 : d.extraFields;
|
|
82
|
-
(f == null ? void 0 : f.find((
|
|
81
|
+
(f == null ? void 0 : f.find((j) => !r[j])) && (h = "Either one of these fields is required: " + [e.name, ...f].join(", "));
|
|
83
82
|
}
|
|
84
|
-
return /* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
|
|
83
|
+
return /* @__PURE__ */ y(B, { className: "d-flex", title: h, children: [
|
|
84
|
+
/* @__PURE__ */ s(q, { twoToneColor: "#ee9702" }),
|
|
85
|
+
t
|
|
87
86
|
] });
|
|
88
87
|
}
|
|
89
|
-
return
|
|
88
|
+
return t;
|
|
90
89
|
},
|
|
91
|
-
[
|
|
92
|
-
),
|
|
93
|
-
|
|
90
|
+
[l]
|
|
91
|
+
), S = m(async (e) => {
|
|
92
|
+
F(e);
|
|
94
93
|
}, []), k = m(async () => {
|
|
95
94
|
try {
|
|
96
|
-
|
|
95
|
+
w(!0), await o.onClickImport(c, S), x(!1);
|
|
97
96
|
} finally {
|
|
98
|
-
|
|
97
|
+
w(!1), F(0);
|
|
99
98
|
}
|
|
100
|
-
}, [c, o,
|
|
101
|
-
|
|
102
|
-
title:
|
|
103
|
-
content:
|
|
104
|
-
okText:
|
|
99
|
+
}, [c, o, x, S]), W = m(async () => {
|
|
100
|
+
g ? O.warn({
|
|
101
|
+
title: l("str.warning"),
|
|
102
|
+
content: l("qus.importWithIssues"),
|
|
103
|
+
okText: l("str.import"),
|
|
105
104
|
onOk: k,
|
|
106
105
|
okCancel: !0,
|
|
107
106
|
closable: !0
|
|
108
107
|
}) : k();
|
|
109
|
-
}, [
|
|
110
|
-
return /* @__PURE__ */
|
|
111
|
-
|
|
108
|
+
}, [g, k, l]);
|
|
109
|
+
return /* @__PURE__ */ y(
|
|
110
|
+
O,
|
|
112
111
|
{
|
|
113
|
-
title: [
|
|
112
|
+
title: [l("str.import"), o == null ? void 0 : o.name].filter(Boolean).join(" "),
|
|
114
113
|
width: "100%",
|
|
115
|
-
open:
|
|
116
|
-
onOk:
|
|
114
|
+
open: b,
|
|
115
|
+
onOk: W,
|
|
117
116
|
destroyOnClose: !0,
|
|
118
|
-
onCancel: () =>
|
|
119
|
-
okText:
|
|
120
|
-
confirmLoading:
|
|
117
|
+
onCancel: () => x(!1),
|
|
118
|
+
okText: l("str.import"),
|
|
119
|
+
confirmLoading: C,
|
|
121
120
|
okButtonProps: {
|
|
122
121
|
disabled: !(c != null && c.length)
|
|
123
122
|
},
|
|
124
|
-
footer: (e, { OkBtn:
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */ t
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
footer: (e, { OkBtn: t, CancelBtn: r }) => /* @__PURE__ */ y(V, { children: [
|
|
124
|
+
/* @__PURE__ */ s(r, {}),
|
|
125
|
+
/* @__PURE__ */ s(t, {}),
|
|
126
|
+
g && /* @__PURE__ */ s(
|
|
127
|
+
B,
|
|
129
128
|
{
|
|
130
129
|
className: "d-flex",
|
|
131
130
|
title: "Some fields have issue. Please review before submit.",
|
|
132
|
-
children: /* @__PURE__ */
|
|
131
|
+
children: /* @__PURE__ */ s(q, { twoToneColor: "#ee9702" })
|
|
133
132
|
}
|
|
134
133
|
)
|
|
135
134
|
] }),
|
|
136
135
|
children: [
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
|
|
136
|
+
/* @__PURE__ */ y(V, { children: [
|
|
137
|
+
/* @__PURE__ */ s(
|
|
138
|
+
X,
|
|
140
139
|
{
|
|
141
|
-
onClick:
|
|
142
|
-
icon: /* @__PURE__ */
|
|
143
|
-
children:
|
|
140
|
+
onClick: M,
|
|
141
|
+
icon: /* @__PURE__ */ s(z, {}),
|
|
142
|
+
children: l("str.downloadCsvTemplate")
|
|
144
143
|
}
|
|
145
144
|
),
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
|
|
145
|
+
/* @__PURE__ */ s(
|
|
146
|
+
Y,
|
|
148
147
|
{
|
|
149
|
-
disabled:
|
|
148
|
+
disabled: C,
|
|
150
149
|
type: "default",
|
|
151
|
-
onClick:
|
|
150
|
+
onClick: L,
|
|
152
151
|
accept: ".csv",
|
|
153
|
-
children:
|
|
152
|
+
children: l("str.importCsvFile")
|
|
154
153
|
}
|
|
155
154
|
)
|
|
156
155
|
] }),
|
|
157
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ s(
|
|
158
157
|
_,
|
|
159
158
|
{
|
|
160
|
-
spinning:
|
|
161
|
-
indicator:
|
|
159
|
+
spinning: C,
|
|
160
|
+
indicator: E ? /* @__PURE__ */ s(
|
|
162
161
|
$,
|
|
163
162
|
{
|
|
164
163
|
type: "circle",
|
|
165
|
-
percent:
|
|
164
|
+
percent: E * 100,
|
|
166
165
|
size: 50,
|
|
167
166
|
format: (e) => `${parseInt(e)}%`
|
|
168
167
|
}
|
|
169
168
|
) : void 0,
|
|
170
|
-
children: /* @__PURE__ */
|
|
171
|
-
|
|
169
|
+
children: /* @__PURE__ */ s(
|
|
170
|
+
K,
|
|
172
171
|
{
|
|
173
172
|
data: c,
|
|
174
173
|
bordered: !0,
|
|
175
174
|
size: "small",
|
|
176
175
|
fields: Array.from(u.values()).flatMap((e) => {
|
|
177
|
-
var
|
|
176
|
+
var t, r, i, a;
|
|
178
177
|
return e.type === "text" ? [
|
|
179
178
|
{
|
|
180
179
|
...e,
|
|
181
180
|
label: e.name,
|
|
182
181
|
render: p(e)
|
|
183
182
|
},
|
|
184
|
-
...((
|
|
183
|
+
...((r = (t = e.importProps) == null ? void 0 : t.extraFields) == null ? void 0 : r.map((n) => ({
|
|
185
184
|
...e,
|
|
186
|
-
name:
|
|
187
|
-
label:
|
|
185
|
+
name: n,
|
|
186
|
+
label: n,
|
|
188
187
|
render: p(e)
|
|
189
188
|
}))) ?? []
|
|
190
189
|
] : e.type === "select" ? [
|
|
@@ -194,10 +193,10 @@ function de({
|
|
|
194
193
|
type: "text",
|
|
195
194
|
render: p(e)
|
|
196
195
|
},
|
|
197
|
-
...((a = (
|
|
196
|
+
...((a = (i = e.importProps) == null ? void 0 : i.extraFields) == null ? void 0 : a.map((n) => ({
|
|
198
197
|
...e,
|
|
199
|
-
name:
|
|
200
|
-
label:
|
|
198
|
+
name: n,
|
|
199
|
+
label: n,
|
|
201
200
|
type: "text",
|
|
202
201
|
render: p(e)
|
|
203
202
|
}))) ?? []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),q=require("../../common/description/DescList.cjs"),C=require("react"),f=require("react-i18next"),x=require("../../../locale/hooks/translation-constants.cjs"),V=require("./CrudViewerUtil.cjs");function a({className:l,fields:u,data:e,descListColumn:c={xs:1,md:3,sm:2,lg:4},layout:m,action:t,keepEmptyValues:b}){const{t:i}=f.useTranslation(x.TRANSLATION_NAMESPACE),g=C.useMemo(()=>{const o=u.filter(({hidden:r,hideInDescList:s})=>!r&&!s).map((r,s)=>({label:r.label,noFormatting:!0,value:V.getRendererValueCrudViewer(r)(e==null?void 0:e[r.name],e,s)}));return t&&o.push({label:i("str.action"),value:t}),o},[t,e,u,i]);return e?n.jsx(q,{keepEmptyValues:b,bordered:!0,column:c,className:l,layout:m,list:g}):n.jsx(n.Fragment,{})}exports.CrudDecListView=a;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
function
|
|
8
|
-
className:
|
|
9
|
-
fields:
|
|
1
|
+
import { jsx as l, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import g from "../../common/description/DescList.js";
|
|
3
|
+
import { useMemo as A } from "react";
|
|
4
|
+
import { useTranslation as x } from "react-i18next";
|
|
5
|
+
import { TRANSLATION_NAMESPACE as C } from "../../../locale/hooks/translation-constants.js";
|
|
6
|
+
import { getRendererValueCrudViewer as L } from "./CrudViewerUtil.js";
|
|
7
|
+
function E({
|
|
8
|
+
className: n,
|
|
9
|
+
fields: t,
|
|
10
10
|
data: r,
|
|
11
|
-
descListColumn:
|
|
11
|
+
descListColumn: u = { xs: 1, md: 3, sm: 2, lg: 4 },
|
|
12
12
|
layout: f,
|
|
13
13
|
action: o,
|
|
14
14
|
keepEmptyValues: p
|
|
15
15
|
}) {
|
|
16
|
-
const { t: i } =
|
|
17
|
-
const
|
|
16
|
+
const { t: i } = x(C), c = A(() => {
|
|
17
|
+
const s = t.filter(({ hidden: e, hideInDescList: m }) => !e && !m).map((e, m) => ({
|
|
18
18
|
label: e.label,
|
|
19
19
|
noFormatting: !0,
|
|
20
|
-
value:
|
|
20
|
+
value: L(e)(
|
|
21
21
|
r == null ? void 0 : r[e.name],
|
|
22
22
|
r,
|
|
23
|
-
|
|
23
|
+
m
|
|
24
24
|
)
|
|
25
25
|
}));
|
|
26
|
-
return o &&
|
|
27
|
-
}, [o, r,
|
|
28
|
-
return r ? /* @__PURE__ */
|
|
29
|
-
|
|
26
|
+
return o && s.push({ label: i("str.action"), value: o }), s;
|
|
27
|
+
}, [o, r, t, i]);
|
|
28
|
+
return r ? /* @__PURE__ */ l(
|
|
29
|
+
g,
|
|
30
30
|
{
|
|
31
31
|
keepEmptyValues: p,
|
|
32
32
|
bordered: !0,
|
|
33
|
-
column:
|
|
34
|
-
className:
|
|
33
|
+
column: u,
|
|
34
|
+
className: n,
|
|
35
35
|
layout: f,
|
|
36
36
|
list: c
|
|
37
37
|
}
|
|
38
|
-
) : /* @__PURE__ */
|
|
38
|
+
) : /* @__PURE__ */ l(b, {});
|
|
39
39
|
}
|
|
40
40
|
export {
|
|
41
|
-
|
|
41
|
+
E as CrudDecListView
|
|
42
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),k=require("antd"),H=require("../../common/button/CloneButtonTable.cjs"),p=require("../../common/button/DeleteButtonTable.cjs"),U=require("../../common/button/ExportButton.cjs"),F=require("../../common/button/HideButtonTable.cjs"),rr=require("../../common/button/RefreshButton.cjs"),er=require("../../common/button/UpdateButtonTable.cjs"),tr=require("../../common/button/ViewButtonTable.cjs"),sr=require("../../common/layout/VerticalSpace.cjs"),ur=require("../../common/table/table.cjs"),j=require("react"),nr=require("react-i18next"),or=require("../../../locale/hooks/translation-constants.cjs"),cr=require("../CrudSearchComponent.cjs"),lr=require("./CrudDecListView.cjs"),O=require("./CrudViewerUtil.cjs");function ar({idField:s="id",loadingData:z,fields:l,isDeleting:T,isHiding:m,viewable:o=!1,paginateProps:h,onDelete:q,onHide:y,onUpdate:v,data:x=[],extraAction:i,onClickUpdate:c,minusHeight:R,scroll:_,onClickClone:B,className:$,expandable:w,size:A,bordered:G,descListColumn:J,extraView:S,decListLayout:K,scrollToTop:jr,onClickRefresh:I,closeViewOnClickUpdate:V,onExport:g,confirmHiding:M,confirmDeleting:d,rowClassName:Q,actionWidth:W=190,...X}){const{t:Y}=nr.useTranslation(or.TRANSLATION_NAMESPACE),E=j.useMemo(()=>l.map(({hideInTable:e,hidden:t,width:a,name:n,label:D,halign:P,...N})=>({title:D,width:a,key:n,dataIndex:n,hidden:e||t,align:P??(N.type==="number"?"right":void 0),render:O.getRendererValueCrudViewer(N)})),[l]),[u,f]=j.useState(),[b,C]=j.useState();j.useEffect(()=>{x&&f(e=>{if(e)return x.find(t=>t[s]===e[s])})},[x,s,u]);const L=j.useCallback(e=>{var a;const t=i==null?void 0:i(e);return(Array.isArray(t)?(a=t==null?void 0:t.filter(Boolean))!=null&&a.length:t)||v||c||B||q?r.jsxs(r.Fragment,{children:[t,(v||c)&&r.jsx(er,{value:e,onClick:n=>{C(n[s]),c==null||c(e),V&&f(void 0)}}),B&&r.jsx(H,{value:e,onClick:n=>B(n)}),g&&r.jsx(U.ExportButton,{value:e,onClick:async n=>await g(n)}),y&&r.jsx(F,{value:e,disabled:m,shouldConfirm:M,loading:m&&e[s]===b,onClick:async n=>{C(n[s]),await y({[s]:n[s]})}}),q&&r.jsx(p,{value:e,disabled:T,shouldConfirm:d,loading:T&&e[s]===b,onClick:async n=>{C(n[s]),await q({[s]:n[s]})}})]}):void 0},[V,d,M,i,s,T,m,B,c,q,g,y,v,b]),Z=j.useMemo(()=>{let e=typeof o=="string"?u==null?void 0:u[o]:void 0;if(typeof e=="object"){const t=l.find(a=>a.name===o);e=O.getRendererValueCrudViewer(t)(e,u,0)}return e},[o,u,l]);return r.jsxs("div",{children:[o&&r.jsx(k.Modal,{width:"100%",open:!!u,title:Z??r.jsx("div",{children:" "}),footer:r.jsx(r.Fragment,{}),closable:!0,onCancel:()=>f(void 0),children:!!u&&r.jsxs("div",{children:[r.jsx(lr.CrudDecListView,{layout:K,descListColumn:J,data:u,fields:l,action:L(u)}),S==null?void 0:S(u)]},u==null?void 0:u[s])}),r.jsx(cr,{fields:l,...X}),r.jsxs(sr,{children:[!!I&&r.jsx(rr.RefreshButton,{onClick:I}),r.jsx(ur,{rowClassName:Q,className:$,scroll:_??(R?{y:`calc(100vh - ${R})`}:void 0),id:"crud-table",dataSource:x,loading:z,bordered:G,size:A,expandable:w,pagination:h?{total:h.count,onChange:h.setPage,current:h.page,pageSize:h.pageSize}:void 0,columns:v||c||q||i||o?[...E,{title:Y("str.action"),dataIndex:"",fixed:"right",width:W,render:(e,t)=>r.jsxs(r.Fragment,{children:[o&&r.jsx(tr,{value:t,onClick:f}),L(t)]})}]:E})]})]})}module.exports=ar;
|