@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,118 +1,118 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Modal as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { ExportButton as
|
|
6
|
-
import
|
|
7
|
-
import { RefreshButton as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useMemo as
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
function
|
|
19
|
-
idField:
|
|
20
|
-
loadingData:
|
|
21
|
-
fields:
|
|
22
|
-
isDeleting:
|
|
23
|
-
isHiding:
|
|
24
|
-
viewable:
|
|
25
|
-
paginateProps:
|
|
26
|
-
onDelete:
|
|
27
|
-
onHide:
|
|
28
|
-
onUpdate:
|
|
29
|
-
data:
|
|
1
|
+
import { jsxs as v, Fragment as M, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Modal as U } from "antd";
|
|
3
|
+
import F from "../../common/button/CloneButtonTable.js";
|
|
4
|
+
import rr from "../../common/button/DeleteButtonTable.js";
|
|
5
|
+
import { ExportButton as or } from "../../common/button/ExportButton.js";
|
|
6
|
+
import tr from "../../common/button/HideButtonTable.js";
|
|
7
|
+
import { RefreshButton as mr } from "../../common/button/RefreshButton.js";
|
|
8
|
+
import ur from "../../common/button/UpdateButtonTable.js";
|
|
9
|
+
import nr from "../../common/button/ViewButtonTable.js";
|
|
10
|
+
import fr from "../../common/layout/VerticalSpace.js";
|
|
11
|
+
import cr from "../../common/table/table.js";
|
|
12
|
+
import { useMemo as $, useState as q, useEffect as er, useCallback as lr } from "react";
|
|
13
|
+
import { useTranslation as sr } from "react-i18next";
|
|
14
|
+
import { TRANSLATION_NAMESPACE as hr } from "../../../locale/hooks/translation-constants.js";
|
|
15
|
+
import ar from "../CrudSearchComponent.js";
|
|
16
|
+
import { CrudDecListView as vr } from "./CrudDecListView.js";
|
|
17
|
+
import { getRendererValueCrudViewer as A } from "./CrudViewerUtil.js";
|
|
18
|
+
function _r({
|
|
19
|
+
idField: t = "id",
|
|
20
|
+
loadingData: G,
|
|
21
|
+
fields: e,
|
|
22
|
+
isDeleting: S,
|
|
23
|
+
isHiding: b,
|
|
24
|
+
viewable: f = !1,
|
|
25
|
+
paginateProps: s,
|
|
26
|
+
onDelete: h,
|
|
27
|
+
onHide: i,
|
|
28
|
+
onUpdate: T,
|
|
29
|
+
data: y = [],
|
|
30
30
|
extraAction: a,
|
|
31
|
-
onClickUpdate:
|
|
32
|
-
minusHeight:
|
|
33
|
-
scroll:
|
|
34
|
-
onClickClone:
|
|
35
|
-
className:
|
|
36
|
-
expandable:
|
|
37
|
-
size:
|
|
38
|
-
bordered:
|
|
39
|
-
descListColumn:
|
|
40
|
-
extraView:
|
|
41
|
-
decListLayout:
|
|
42
|
-
scrollToTop:
|
|
43
|
-
onClickRefresh:
|
|
31
|
+
onClickUpdate: c,
|
|
32
|
+
minusHeight: N,
|
|
33
|
+
scroll: J,
|
|
34
|
+
onClickClone: B,
|
|
35
|
+
className: K,
|
|
36
|
+
expandable: Q,
|
|
37
|
+
size: W,
|
|
38
|
+
bordered: X,
|
|
39
|
+
descListColumn: Y,
|
|
40
|
+
extraView: g,
|
|
41
|
+
decListLayout: Z,
|
|
42
|
+
scrollToTop: Tr,
|
|
43
|
+
onClickRefresh: O,
|
|
44
44
|
closeViewOnClickUpdate: R,
|
|
45
|
-
onExport:
|
|
46
|
-
confirmHiding:
|
|
47
|
-
confirmDeleting:
|
|
48
|
-
rowClassName:
|
|
49
|
-
actionWidth:
|
|
50
|
-
...
|
|
45
|
+
onExport: I,
|
|
46
|
+
confirmHiding: z,
|
|
47
|
+
confirmDeleting: E,
|
|
48
|
+
rowClassName: d,
|
|
49
|
+
actionWidth: P = 190,
|
|
50
|
+
...w
|
|
51
51
|
}) {
|
|
52
|
-
const { t:
|
|
53
|
-
() =>
|
|
54
|
-
({ hideInTable:
|
|
55
|
-
title:
|
|
56
|
-
width:
|
|
52
|
+
const { t: D } = sr(hr), L = $(
|
|
53
|
+
() => e.map(
|
|
54
|
+
({ hideInTable: r, hidden: o, width: l, name: u, label: H, halign: x, ...V }) => ({
|
|
55
|
+
title: H,
|
|
56
|
+
width: l,
|
|
57
57
|
key: u,
|
|
58
58
|
dataIndex: u,
|
|
59
|
-
hidden:
|
|
60
|
-
align:
|
|
61
|
-
render: V
|
|
59
|
+
hidden: r || o,
|
|
60
|
+
align: x ?? (V.type === "number" ? "right" : void 0),
|
|
61
|
+
render: A(V)
|
|
62
62
|
})
|
|
63
63
|
),
|
|
64
|
-
[
|
|
65
|
-
), [m,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (
|
|
69
|
-
return
|
|
64
|
+
[e]
|
|
65
|
+
), [m, p] = q(), [C, j] = q();
|
|
66
|
+
er(() => {
|
|
67
|
+
y && p((r) => {
|
|
68
|
+
if (r)
|
|
69
|
+
return y.find((o) => o[t] === r[t]);
|
|
70
70
|
});
|
|
71
|
-
}, [
|
|
72
|
-
const
|
|
73
|
-
(
|
|
74
|
-
var
|
|
75
|
-
const
|
|
76
|
-
return (Array.isArray(
|
|
77
|
-
|
|
78
|
-
(
|
|
79
|
-
|
|
71
|
+
}, [y, t, m]);
|
|
72
|
+
const _ = lr(
|
|
73
|
+
(r) => {
|
|
74
|
+
var l;
|
|
75
|
+
const o = a == null ? void 0 : a(r);
|
|
76
|
+
return (Array.isArray(o) ? (l = o == null ? void 0 : o.filter(Boolean)) != null && l.length : o) || T || c || B || h ? /* @__PURE__ */ v(M, { children: [
|
|
77
|
+
o,
|
|
78
|
+
(T || c) && /* @__PURE__ */ n(
|
|
79
|
+
ur,
|
|
80
80
|
{
|
|
81
|
-
value:
|
|
81
|
+
value: r,
|
|
82
82
|
onClick: (u) => {
|
|
83
|
-
|
|
83
|
+
j(u[t]), c == null || c(r), R && p(void 0);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
B && /* @__PURE__ */ n(F, { value: r, onClick: (u) => B(u) }),
|
|
88
|
+
I && /* @__PURE__ */ n(
|
|
89
|
+
or,
|
|
90
90
|
{
|
|
91
|
-
value:
|
|
92
|
-
onClick: async (u) => await
|
|
91
|
+
value: r,
|
|
92
|
+
onClick: async (u) => await I(u)
|
|
93
93
|
}
|
|
94
94
|
),
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
i && /* @__PURE__ */ n(
|
|
96
|
+
tr,
|
|
97
97
|
{
|
|
98
|
-
value:
|
|
99
|
-
disabled:
|
|
100
|
-
shouldConfirm:
|
|
101
|
-
loading:
|
|
98
|
+
value: r,
|
|
99
|
+
disabled: b,
|
|
100
|
+
shouldConfirm: z,
|
|
101
|
+
loading: b && r[t] === C,
|
|
102
102
|
onClick: async (u) => {
|
|
103
|
-
|
|
103
|
+
j(u[t]), await i({ [t]: u[t] });
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
),
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
h && /* @__PURE__ */ n(
|
|
108
|
+
rr,
|
|
109
109
|
{
|
|
110
|
-
value:
|
|
111
|
-
disabled:
|
|
112
|
-
shouldConfirm:
|
|
113
|
-
loading:
|
|
110
|
+
value: r,
|
|
111
|
+
disabled: S,
|
|
112
|
+
shouldConfirm: E,
|
|
113
|
+
loading: S && r[t] === C,
|
|
114
114
|
onClick: async (u) => {
|
|
115
|
-
|
|
115
|
+
j(u[t]), await h({ [t]: u[t] });
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
)
|
|
@@ -120,98 +120,98 @@ function Or({
|
|
|
120
120
|
},
|
|
121
121
|
[
|
|
122
122
|
R,
|
|
123
|
-
M,
|
|
124
123
|
E,
|
|
124
|
+
z,
|
|
125
125
|
a,
|
|
126
|
-
|
|
127
|
-
y,
|
|
128
|
-
B,
|
|
129
|
-
T,
|
|
130
|
-
e,
|
|
131
|
-
j,
|
|
126
|
+
t,
|
|
132
127
|
S,
|
|
133
|
-
|
|
128
|
+
b,
|
|
129
|
+
B,
|
|
130
|
+
c,
|
|
134
131
|
h,
|
|
135
|
-
|
|
132
|
+
I,
|
|
133
|
+
i,
|
|
134
|
+
T,
|
|
135
|
+
C
|
|
136
136
|
]
|
|
137
|
-
),
|
|
138
|
-
let
|
|
139
|
-
if (typeof
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
), k = $(() => {
|
|
138
|
+
let r = typeof f == "string" ? m == null ? void 0 : m[f] : void 0;
|
|
139
|
+
if (typeof r == "object") {
|
|
140
|
+
const o = e.find((l) => l.name === f);
|
|
141
|
+
r = A(o)(
|
|
142
|
+
r,
|
|
143
143
|
m,
|
|
144
144
|
0
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
|
-
return
|
|
148
|
-
}, [
|
|
149
|
-
return /* @__PURE__ */
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
return r;
|
|
148
|
+
}, [f, m, e]);
|
|
149
|
+
return /* @__PURE__ */ v("div", { children: [
|
|
150
|
+
f && /* @__PURE__ */ n(
|
|
151
|
+
U,
|
|
152
152
|
{
|
|
153
153
|
width: "100%",
|
|
154
154
|
open: !!m,
|
|
155
|
-
title:
|
|
156
|
-
footer: /* @__PURE__ */
|
|
155
|
+
title: k ?? /* @__PURE__ */ n("div", { children: " " }),
|
|
156
|
+
footer: /* @__PURE__ */ n(M, {}),
|
|
157
157
|
closable: !0,
|
|
158
|
-
onCancel: () =>
|
|
159
|
-
children: !!m && /* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
|
|
158
|
+
onCancel: () => p(void 0),
|
|
159
|
+
children: !!m && /* @__PURE__ */ v("div", { children: [
|
|
160
|
+
/* @__PURE__ */ n(
|
|
161
|
+
vr,
|
|
162
162
|
{
|
|
163
|
-
layout:
|
|
164
|
-
descListColumn:
|
|
163
|
+
layout: Z,
|
|
164
|
+
descListColumn: Y,
|
|
165
165
|
data: m,
|
|
166
|
-
fields:
|
|
167
|
-
action:
|
|
166
|
+
fields: e,
|
|
167
|
+
action: _(m)
|
|
168
168
|
}
|
|
169
169
|
),
|
|
170
|
-
|
|
171
|
-
] }, m == null ? void 0 : m[
|
|
170
|
+
g == null ? void 0 : g(m)
|
|
171
|
+
] }, m == null ? void 0 : m[t])
|
|
172
172
|
}
|
|
173
173
|
),
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
!!
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
|
|
174
|
+
/* @__PURE__ */ n(ar, { fields: e, ...w }),
|
|
175
|
+
/* @__PURE__ */ v(fr, { children: [
|
|
176
|
+
!!O && /* @__PURE__ */ n(mr, { onClick: O }),
|
|
177
|
+
/* @__PURE__ */ n(
|
|
178
|
+
cr,
|
|
179
179
|
{
|
|
180
|
-
rowClassName:
|
|
181
|
-
className:
|
|
182
|
-
scroll:
|
|
183
|
-
y: `calc(100vh - ${
|
|
180
|
+
rowClassName: d,
|
|
181
|
+
className: K,
|
|
182
|
+
scroll: J ?? (N ? {
|
|
183
|
+
y: `calc(100vh - ${N})`
|
|
184
184
|
} : void 0),
|
|
185
185
|
id: "crud-table",
|
|
186
|
-
dataSource:
|
|
187
|
-
loading:
|
|
188
|
-
bordered:
|
|
189
|
-
size:
|
|
190
|
-
expandable:
|
|
191
|
-
pagination:
|
|
192
|
-
total:
|
|
193
|
-
onChange:
|
|
194
|
-
current:
|
|
195
|
-
pageSize:
|
|
186
|
+
dataSource: y,
|
|
187
|
+
loading: G,
|
|
188
|
+
bordered: X,
|
|
189
|
+
size: W,
|
|
190
|
+
expandable: Q,
|
|
191
|
+
pagination: s ? {
|
|
192
|
+
total: s.count,
|
|
193
|
+
onChange: s.setPage,
|
|
194
|
+
current: s.page,
|
|
195
|
+
pageSize: s.pageSize
|
|
196
196
|
} : void 0,
|
|
197
|
-
columns:
|
|
198
|
-
...
|
|
197
|
+
columns: T || c || h || a || f ? [
|
|
198
|
+
...L,
|
|
199
199
|
{
|
|
200
|
-
title:
|
|
200
|
+
title: D("str.action"),
|
|
201
201
|
dataIndex: "",
|
|
202
202
|
fixed: "right",
|
|
203
|
-
width:
|
|
204
|
-
render: (
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
width: P,
|
|
204
|
+
render: (r, o) => /* @__PURE__ */ v(M, { children: [
|
|
205
|
+
f && /* @__PURE__ */ n(nr, { value: o, onClick: p }),
|
|
206
|
+
_(o)
|
|
207
207
|
] })
|
|
208
208
|
}
|
|
209
|
-
] :
|
|
209
|
+
] : L
|
|
210
210
|
}
|
|
211
211
|
)
|
|
212
212
|
] })
|
|
213
213
|
] });
|
|
214
214
|
}
|
|
215
215
|
export {
|
|
216
|
-
|
|
216
|
+
_r as default
|
|
217
217
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),m=require("@ant-design/icons"),s=require("antd"),y=require("../../common/show-more/index.cjs"),C=require("../FileCrudField.cjs"),g=require("../ImageCrudField.cjs"),x=require("../../../locale/hooks/translation-constants.cjs"),d=require("i18next"),r=require("../../../util/DateUtil.cjs"),v=require("../../../util/NumberUtil.cjs");function j({type:a,render:i,...n}){return a==="object"?(t,u,o)=>typeof i=="function"?i(t,u,o):"":a==="select"?(t,u,o)=>{const e=n;let c=e.multiple?Array.isArray(t)?t.map(f=>f==null?void 0:f[e.innerFieldLabel??"name"]):void 0:t==null?void 0:t[e.innerFieldLabel??"name"];return(!c&&typeof t=="string"||typeof t=="number")&&(c=t),typeof i=="function"?i(c,u,o):Array.isArray(c)?c.join(", "):c}:a==="number"?(t,u,o)=>typeof i=="function"?i(t,u,o):n!=null&&n.int?v.default.toInt(t,n.formatted):v.default.toMoney(t):a==="enum"?(t,u,o)=>{var c;const e=d.t(((c=n==null?void 0:n.translation)==null?void 0:c[t??""])??t,{ns:x.TRANSLATION_NAMESPACE});return typeof i=="function"?i(t,u,o):e}:a==="date"?(t,u,o)=>{if(!t)return"-";const e=n!=null&&n.formatTime?r.formatDateTime(t):r.formatDate(t);return typeof i=="function"?i(t,u,o):e}:a==="checkbox"?(t,u,o)=>typeof i=="function"?i(t,u,o):t?l.jsx(m.CheckOutlined,{}):l.jsx(m.CloseOutlined,{}):a==="image"?(t,u,o)=>typeof i=="function"?i(t,u,o):l.jsx(g.ImageCrudCellValue,{value:t,provider:n.provider}):a==="file"?(t,u,o)=>typeof i=="function"?i(t,u,o):l.jsx(C.FileCrudCellValue,{value:t,provider:n.provider}):a==="time"?(t,u,o)=>{if(!t)return"-";const e=n==null?void 0:n.format,c=n==null?void 0:n.use12Hours,f=r.formatTime(t,e||(c?"hh:mm:ss A":void 0));return typeof i=="function"?i(t,u,o):f}:a==="color"?(t,u,o)=>typeof i=="function"?i(t,u,o):typeof t=="string"&&t.startsWith("#")?l.jsx(s.Tooltip,{title:t,children:l.jsx(s.Avatar,{style:{backgroundColor:t}})}):String(t):a==="textarea"?(t,u,o)=>{const e=(n==null?void 0:n.truncated)??1;return typeof i=="function"?i(t,u,o):e?l.jsx(y.ShowMore,{lines:e===!0?1:e,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=j;
|
|
@@ -1,58 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { CheckOutlined as y, CloseOutlined as A } from "@ant-design/icons";
|
|
3
|
+
import { Tooltip as e, Avatar as C } from "antd";
|
|
4
|
+
import { ShowMore as b } from "../../common/show-more/index.js";
|
|
5
|
+
import { FileCrudCellValue as g } from "../FileCrudField.js";
|
|
6
|
+
import { ImageCrudCellValue as h } from "../ImageCrudField.js";
|
|
7
|
+
import { TRANSLATION_NAMESPACE as T } from "../../../locale/hooks/translation-constants.js";
|
|
8
|
+
import { t as S } from "i18next";
|
|
8
9
|
import r from "../../../util/DateUtil.js";
|
|
9
10
|
import v from "../../../util/NumberUtil.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function M({
|
|
13
|
-
type: u,
|
|
11
|
+
function O({
|
|
12
|
+
type: m,
|
|
14
13
|
render: i,
|
|
15
14
|
...o
|
|
16
15
|
}) {
|
|
17
|
-
return
|
|
18
|
-
const
|
|
19
|
-
let a =
|
|
20
|
-
return (!a && typeof t == "string" || typeof t == "number") && (a = t), typeof i == "function" ? i(a,
|
|
21
|
-
} :
|
|
16
|
+
return m === "object" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : "" : m === "select" ? (t, n, f) => {
|
|
17
|
+
const u = o;
|
|
18
|
+
let a = u.multiple ? Array.isArray(t) ? t.map((c) => c == null ? void 0 : c[u.innerFieldLabel ?? "name"]) : void 0 : t == null ? void 0 : t[u.innerFieldLabel ?? "name"];
|
|
19
|
+
return (!a && typeof t == "string" || typeof t == "number") && (a = t), typeof i == "function" ? i(a, n, f) : Array.isArray(a) ? a.join(", ") : a;
|
|
20
|
+
} : m === "number" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : o != null && o.int ? v.toInt(t, o.formatted) : v.toMoney(t) : m === "enum" ? (t, n, f) => {
|
|
22
21
|
var a;
|
|
23
|
-
const
|
|
22
|
+
const u = S(
|
|
24
23
|
((a = o == null ? void 0 : o.translation) == null ? void 0 : a[t ?? ""]) ?? t,
|
|
25
|
-
{ ns:
|
|
24
|
+
{ ns: T }
|
|
26
25
|
);
|
|
27
|
-
return typeof i == "function" ? i(t,
|
|
28
|
-
} :
|
|
26
|
+
return typeof i == "function" ? i(t, n, f) : u;
|
|
27
|
+
} : m === "date" ? (t, n, f) => {
|
|
29
28
|
if (!t) return "-";
|
|
30
|
-
const
|
|
31
|
-
return typeof i == "function" ? i(t,
|
|
32
|
-
} :
|
|
33
|
-
|
|
29
|
+
const u = o != null && o.formatTime ? r.formatDateTime(t) : r.formatDate(t);
|
|
30
|
+
return typeof i == "function" ? i(t, n, f) : u;
|
|
31
|
+
} : m === "checkbox" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : t ? /* @__PURE__ */ l(y, {}) : /* @__PURE__ */ l(A, {}) : m === "image" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l(
|
|
32
|
+
h,
|
|
34
33
|
{
|
|
35
34
|
value: t,
|
|
36
35
|
provider: o.provider
|
|
37
36
|
}
|
|
38
|
-
) :
|
|
39
|
-
|
|
37
|
+
) : m === "file" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l(
|
|
38
|
+
g,
|
|
40
39
|
{
|
|
41
40
|
value: t,
|
|
42
41
|
provider: o.provider
|
|
43
42
|
}
|
|
44
|
-
) :
|
|
43
|
+
) : m === "time" ? (t, n, f) => {
|
|
45
44
|
if (!t) return "-";
|
|
46
|
-
const
|
|
45
|
+
const u = o == null ? void 0 : o.format, a = o == null ? void 0 : o.use12Hours, c = r.formatTime(
|
|
47
46
|
t,
|
|
48
|
-
|
|
47
|
+
u || (a ? "hh:mm:ss A" : void 0)
|
|
49
48
|
);
|
|
50
|
-
return typeof i == "function" ? i(t,
|
|
51
|
-
} :
|
|
52
|
-
const
|
|
53
|
-
return typeof i == "function" ? i(t,
|
|
49
|
+
return typeof i == "function" ? i(t, n, f) : c;
|
|
50
|
+
} : m === "color" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ l(e, { title: t, children: /* @__PURE__ */ l(C, { style: { backgroundColor: t } }) }) : String(t) : m === "textarea" ? (t, n, f) => {
|
|
51
|
+
const u = (o == null ? void 0 : o.truncated) ?? 1;
|
|
52
|
+
return typeof i == "function" ? i(t, n, f) : u ? /* @__PURE__ */ l(b, { lines: u === !0 ? 1 : u, children: t }) : t;
|
|
54
53
|
} : typeof i == "function" ? i : (t) => t;
|
|
55
54
|
}
|
|
56
55
|
export {
|
|
57
|
-
|
|
56
|
+
O as getRendererValueCrudViewer
|
|
58
57
|
};
|
package/dist/locale/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./hooks/translation-constants.cjs"),o=require("./translations/en.cjs"),t=require("i18next"),u=require("react-i18next"),a={en:{[s.TRANSLATION_NAMESPACE]:o}},i=(e={})=>{const{translations:n=a,language:r="en"}=e;return t.use(u.initReactI18next).init({resources:n,lng:r,fallbackLng:"en",ns:s.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),t},l=(e,n)=>{t.addResourceBundle(e,s.TRANSLATION_NAMESPACE,n,!0,!0)};exports.defaultTranslations=a;exports.setupI18n=i;exports.updateTranslations=l;
|
package/dist/locale/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TRANSLATION_NAMESPACE as o } from "./hooks/translation-constants.js";
|
|
2
2
|
import a from "./translations/en.js";
|
|
3
|
-
import t from "
|
|
4
|
-
import { initReactI18next as s } from "
|
|
3
|
+
import t from "i18next";
|
|
4
|
+
import { initReactI18next as s } from "react-i18next";
|
|
5
5
|
const i = {
|
|
6
6
|
en: {
|
|
7
7
|
[o]: a
|
package/dist/util/DateUtil.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("
|
|
1
|
+
"use strict";const e=require("dayjs"),a=require("i18next"),o=t=>e(t).locale(a.language).format("YYYY-MM-DD HH:mm"),m=t=>e(t).locale(a.language).format("YYYY-MM-DD HH:mm:ss"),n=t=>e(t).locale(a.language).format("YYYY-MM-DD"),s=(t,r="HH:mm:ss")=>e(t).locale(a.language).format(r),c={formatDateTime:o,formatDate:n,formatDateTimeWithSecond:m,formatTime:s};module.exports=c;
|
package/dist/util/DateUtil.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import e from "
|
|
3
|
-
const m = (
|
|
1
|
+
import a from "dayjs";
|
|
2
|
+
import e from "i18next";
|
|
3
|
+
const m = (t) => a(t).locale(e.language).format("YYYY-MM-DD HH:mm"), r = (t) => a(t).locale(e.language).format("YYYY-MM-DD HH:mm:ss"), n = (t) => a(t).locale(e.language).format("YYYY-MM-DD"), l = (t, o = "HH:mm:ss") => a(t).locale(e.language).format(o), s = { formatDateTime: m, formatDate: n, formatDateTimeWithSecond: r, formatTime: l };
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
s as default
|
|
6
6
|
};
|
package/dist/util/ImageUtil.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("
|
|
1
|
+
"use strict";const c=require("browser-image-compression");class g{async resizeImage(t){const e=await c(t,{maxSizeMB:1,maxWidthOrHeight:1920,useWebWorker:!0}),a=t.uid;return Object.assign(e,{uid:a,lastModifiedDate:new Date})}async getImageData(t){const e=await this.getImageData0(t);if(e){const a=new Image;a.src=e.data;const o=await new Promise(n=>{a.onload=function(){n({height:a.height,width:a.width})}});return Object.assign(e,o),e}else return null}async getImageData0(t){try{if(t.startsWith("data:image/")){const e=t.match(/^data:image\/(png|jpeg|jpg);base64,(.*)$/);if(!e)throw new Error("Invalid base64 image data");return{data:t,type:e[1]}}else{const e=await fetch(t);if(!e.ok)throw new Error("Network response was not ok");const a=await e.blob();return new Promise((o,n)=>{const s=new FileReader;s.onloadend=function(){const r=s.result,i=r.match(/^data:image\/(png|jpeg|jpg);base64,/);i?o({data:r,type:i[1]}):n(new Error("Could not determine image type"))},s.onerror=n,s.readAsDataURL(a)})}}catch(e){return console.warn(e),null}}}const d=new g;module.exports=d;
|
package/dist/util/ImageUtil.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("
|
|
1
|
+
"use strict";const i=require("i18next"),a=require("./NumberUtil.cjs"),o=e=>[{required:!0,message:`${e} ${i.t("err.validation.required")}`}],s=()=>[{min:8,message:i.t("err.validation.minLength8")}],d=()=>[{type:"number",validator(e,r,t){const n=Number(r);isNaN(n)&&r||n<0||n>100?t(i.t("err.validation.percentage")):t()},message:i.t("err.validation.percentage")}],u=e=>[{max:Number(e),min:0,type:"number",message:i.t("err.validation.maximumValueExceeded").replace("%maxValue%",a.default.toMoney(e))}],l=()=>[{validator:(e,r,t)=>(r.length===12||r.length===10)&&r.search(/^([0-9]{9}[x|X|v|V])|([0-9]{12})$/)!==-1?t():t(i.t("err.validation.invalidNic"))}],m=e=>[{message:`${i.t("err.validation.invalid")} ${e}`,pattern:/^(?:0|94|\+94|0094)?(?:(11|21|23|24|25|26|27|31|32|33|34|35|36|37|38|41|45|47|51|52|54|55|57|63|65|66|67|81|91)(0|2|3|4|5|7|9)|7(0|1|2|4|5|6|7|8)\d)\d{6}$/}],v=()=>[{message:`${i.t("err.validation.positiveNumber")}`,type:"number",validator(e,r,t){r<=0?t(e.message):t()}}],g={percentageValidation:d,required:o,maxValidation:u,passwordValidation:s,nicValidation:l,phoneValidation:m,positiveNumberValidation:v};module.exports=g;
|