@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,24 +1,28 @@
|
|
|
1
1
|
import { j as t } from "../../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import L from "../../../../_virtual/papaparse.min.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { TRANSLATION_NAMESPACE as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { ImportButton as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
3
|
+
import { F as _ } from "../../../../_virtual/FileSaver.min.js";
|
|
4
|
+
import { useState as w, useEffect as $, useMemo as v, useCallback as d } from "react";
|
|
5
|
+
import { useTranslation as z } from "react-i18next";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as W } from "../../../locale/hooks/translation-constants.js";
|
|
7
|
+
import U from "../view/CrudViewer.js";
|
|
8
|
+
import G from "../../../util/DateUtil.js";
|
|
9
|
+
import H from "../../common/button/Button.js";
|
|
10
|
+
import { ImportButton as J } from "../../common/button/ImportButton.js";
|
|
11
|
+
import S from "../../../../node_modules/antd/es/tooltip/index.js";
|
|
12
|
+
import q from "../../../../node_modules/@ant-design/icons/es/icons/WarningTwoTone.js";
|
|
13
|
+
import B from "../../../../node_modules/antd/es/modal/index.js";
|
|
14
|
+
import R from "../../../../node_modules/antd/es/space/index.js";
|
|
15
|
+
import K from "../../../../node_modules/@ant-design/icons/es/icons/DownloadOutlined.js";
|
|
16
|
+
import Q from "../../../../node_modules/antd/es/spin/index.js";
|
|
17
|
+
import X from "../../../../node_modules/antd/es/progress/progress.js";
|
|
18
|
+
function pe({
|
|
15
19
|
onCloseMethod: h,
|
|
16
20
|
open: y,
|
|
17
21
|
fields: A,
|
|
18
|
-
importProps:
|
|
22
|
+
importProps: s
|
|
19
23
|
}) {
|
|
20
24
|
const [c, N] = w([]), [j, b] = w(!1), [T, E] = w(0);
|
|
21
|
-
|
|
25
|
+
$(() => {
|
|
22
26
|
y || (N([]), b(!1));
|
|
23
27
|
}, [y]);
|
|
24
28
|
const u = v(
|
|
@@ -38,32 +42,32 @@ function de({
|
|
|
38
42
|
];
|
|
39
43
|
}),
|
|
40
44
|
[u]
|
|
41
|
-
), V =
|
|
45
|
+
), V = d(
|
|
42
46
|
async function() {
|
|
43
47
|
const e = `${F.join(",")}
|
|
44
48
|
`, r = new Blob([e], { type: "text/csv;charset=utf-8;" });
|
|
45
|
-
|
|
49
|
+
_.saveAs(
|
|
46
50
|
r,
|
|
47
|
-
(
|
|
51
|
+
(s == null ? void 0 : s.name) + " - " + G.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
|
|
48
52
|
);
|
|
49
53
|
},
|
|
50
|
-
[F,
|
|
51
|
-
), { t: i } =
|
|
54
|
+
[F, s == null ? void 0 : s.name]
|
|
55
|
+
), { t: i } = z(W), M = d(async (e) => {
|
|
52
56
|
const r = new FileReader();
|
|
53
|
-
r.onerror = console.error, r.onload = async (
|
|
54
|
-
var
|
|
55
|
-
const l = (
|
|
57
|
+
r.onerror = console.error, r.onload = async (o) => {
|
|
58
|
+
var n;
|
|
59
|
+
const l = (n = o == null ? void 0 : o.target) == null ? void 0 : n.result, a = L.parse(l, { header: !0 });
|
|
56
60
|
N(a.data);
|
|
57
61
|
}, r.readAsText(e);
|
|
58
62
|
}, []), C = v(() => {
|
|
59
|
-
var r,
|
|
63
|
+
var r, o, l;
|
|
60
64
|
let e = !1;
|
|
61
65
|
for (const a of c)
|
|
62
|
-
for (const [
|
|
63
|
-
const x = a[
|
|
64
|
-
if (
|
|
65
|
-
if ((
|
|
66
|
-
for (const g of ((l =
|
|
66
|
+
for (const [n, m] of u.entries()) {
|
|
67
|
+
const x = a[n], f = x || !isNaN(x);
|
|
68
|
+
if (m.required && !f)
|
|
69
|
+
if ((o = (r = m.importProps) == null ? void 0 : r.extraFields) != null && o.length)
|
|
70
|
+
for (const g of ((l = m.importProps) == null ? void 0 : l.extraFields) ?? [])
|
|
67
71
|
if (a[g] || !isNaN(a[g])) {
|
|
68
72
|
e = !1;
|
|
69
73
|
break;
|
|
@@ -71,34 +75,34 @@ function de({
|
|
|
71
75
|
else return !0;
|
|
72
76
|
}
|
|
73
77
|
return e;
|
|
74
|
-
}, [c, u]), p =
|
|
75
|
-
(e) => (r,
|
|
76
|
-
var a,
|
|
78
|
+
}, [c, u]), p = d(
|
|
79
|
+
(e) => (r, o) => {
|
|
80
|
+
var a, n, m;
|
|
77
81
|
const l = r || !isNaN(r);
|
|
78
82
|
if (e.required && !l) {
|
|
79
83
|
let x = i("err.validation.required");
|
|
80
|
-
if ((
|
|
81
|
-
const f = (
|
|
82
|
-
(f == null ? void 0 : f.find((D) => !
|
|
84
|
+
if ((n = (a = e.importProps) == null ? void 0 : a.extraFields) != null && n.length) {
|
|
85
|
+
const f = (m = e.importProps) == null ? void 0 : m.extraFields;
|
|
86
|
+
(f == null ? void 0 : f.find((D) => !o[D])) && (x = "Either one of these fields is required: " + [e.name, ...f].join(", "));
|
|
83
87
|
}
|
|
84
88
|
return /* @__PURE__ */ t.jsxs(S, { className: "d-flex", title: x, children: [
|
|
85
|
-
/* @__PURE__ */ t.jsx(
|
|
89
|
+
/* @__PURE__ */ t.jsx(q, { twoToneColor: "#ee9702" }),
|
|
86
90
|
r
|
|
87
91
|
] });
|
|
88
92
|
}
|
|
89
93
|
return r;
|
|
90
94
|
},
|
|
91
95
|
[i]
|
|
92
|
-
), I =
|
|
96
|
+
), I = d(async (e) => {
|
|
93
97
|
E(e);
|
|
94
|
-
}, []), k =
|
|
98
|
+
}, []), k = d(async () => {
|
|
95
99
|
try {
|
|
96
|
-
b(!0), await
|
|
100
|
+
b(!0), await s.onClickImport(c, I), h(!1);
|
|
97
101
|
} finally {
|
|
98
102
|
b(!1), E(0);
|
|
99
103
|
}
|
|
100
|
-
}, [c,
|
|
101
|
-
C ?
|
|
104
|
+
}, [c, s, h, I]), O = d(async () => {
|
|
105
|
+
C ? B.warn({
|
|
102
106
|
title: i("str.warning"),
|
|
103
107
|
content: i("qus.importWithIssues"),
|
|
104
108
|
okText: i("str.import"),
|
|
@@ -108,9 +112,9 @@ function de({
|
|
|
108
112
|
}) : k();
|
|
109
113
|
}, [C, k, i]);
|
|
110
114
|
return /* @__PURE__ */ t.jsxs(
|
|
111
|
-
|
|
115
|
+
B,
|
|
112
116
|
{
|
|
113
|
-
title: [i("str.import"),
|
|
117
|
+
title: [i("str.import"), s == null ? void 0 : s.name].filter(Boolean).join(" "),
|
|
114
118
|
width: "100%",
|
|
115
119
|
open: y,
|
|
116
120
|
onOk: O,
|
|
@@ -121,30 +125,30 @@ function de({
|
|
|
121
125
|
okButtonProps: {
|
|
122
126
|
disabled: !(c != null && c.length)
|
|
123
127
|
},
|
|
124
|
-
footer: (e, { OkBtn: r, CancelBtn:
|
|
125
|
-
/* @__PURE__ */ t.jsx(
|
|
128
|
+
footer: (e, { OkBtn: r, CancelBtn: o }) => /* @__PURE__ */ t.jsxs(R, { children: [
|
|
129
|
+
/* @__PURE__ */ t.jsx(o, {}),
|
|
126
130
|
/* @__PURE__ */ t.jsx(r, {}),
|
|
127
131
|
C && /* @__PURE__ */ t.jsx(
|
|
128
132
|
S,
|
|
129
133
|
{
|
|
130
134
|
className: "d-flex",
|
|
131
135
|
title: "Some fields have issue. Please review before submit.",
|
|
132
|
-
children: /* @__PURE__ */ t.jsx(
|
|
136
|
+
children: /* @__PURE__ */ t.jsx(q, { twoToneColor: "#ee9702" })
|
|
133
137
|
}
|
|
134
138
|
)
|
|
135
139
|
] }),
|
|
136
140
|
children: [
|
|
137
|
-
/* @__PURE__ */ t.jsxs(
|
|
141
|
+
/* @__PURE__ */ t.jsxs(R, { children: [
|
|
138
142
|
/* @__PURE__ */ t.jsx(
|
|
139
|
-
|
|
143
|
+
H,
|
|
140
144
|
{
|
|
141
145
|
onClick: V,
|
|
142
|
-
icon: /* @__PURE__ */ t.jsx(
|
|
146
|
+
icon: /* @__PURE__ */ t.jsx(K, {}),
|
|
143
147
|
children: i("str.downloadCsvTemplate")
|
|
144
148
|
}
|
|
145
149
|
),
|
|
146
150
|
/* @__PURE__ */ t.jsx(
|
|
147
|
-
|
|
151
|
+
J,
|
|
148
152
|
{
|
|
149
153
|
disabled: j,
|
|
150
154
|
type: "default",
|
|
@@ -155,11 +159,11 @@ function de({
|
|
|
155
159
|
)
|
|
156
160
|
] }),
|
|
157
161
|
/* @__PURE__ */ t.jsx(
|
|
158
|
-
|
|
162
|
+
Q,
|
|
159
163
|
{
|
|
160
164
|
spinning: j,
|
|
161
165
|
indicator: T ? /* @__PURE__ */ t.jsx(
|
|
162
|
-
|
|
166
|
+
X,
|
|
163
167
|
{
|
|
164
168
|
type: "circle",
|
|
165
169
|
percent: T * 100,
|
|
@@ -168,23 +172,23 @@ function de({
|
|
|
168
172
|
}
|
|
169
173
|
) : void 0,
|
|
170
174
|
children: /* @__PURE__ */ t.jsx(
|
|
171
|
-
|
|
175
|
+
U,
|
|
172
176
|
{
|
|
173
177
|
data: c,
|
|
174
178
|
bordered: !0,
|
|
175
179
|
size: "small",
|
|
176
180
|
fields: Array.from(u.values()).flatMap((e) => {
|
|
177
|
-
var r,
|
|
181
|
+
var r, o, l, a;
|
|
178
182
|
return e.type === "text" ? [
|
|
179
183
|
{
|
|
180
184
|
...e,
|
|
181
185
|
label: e.name,
|
|
182
186
|
render: p(e)
|
|
183
187
|
},
|
|
184
|
-
...((
|
|
188
|
+
...((o = (r = e.importProps) == null ? void 0 : r.extraFields) == null ? void 0 : o.map((n) => ({
|
|
185
189
|
...e,
|
|
186
|
-
name:
|
|
187
|
-
label:
|
|
190
|
+
name: n,
|
|
191
|
+
label: n,
|
|
188
192
|
render: p(e)
|
|
189
193
|
}))) ?? []
|
|
190
194
|
] : e.type === "select" ? [
|
|
@@ -194,10 +198,10 @@ function de({
|
|
|
194
198
|
type: "text",
|
|
195
199
|
render: p(e)
|
|
196
200
|
},
|
|
197
|
-
...((a = (l = e.importProps) == null ? void 0 : l.extraFields) == null ? void 0 : a.map((
|
|
201
|
+
...((a = (l = e.importProps) == null ? void 0 : l.extraFields) == null ? void 0 : a.map((n) => ({
|
|
198
202
|
...e,
|
|
199
|
-
name:
|
|
200
|
-
label:
|
|
203
|
+
name: n,
|
|
204
|
+
label: n,
|
|
201
205
|
type: "text",
|
|
202
206
|
render: p(e)
|
|
203
207
|
}))) ?? []
|
|
@@ -218,5 +222,5 @@ function de({
|
|
|
218
222
|
);
|
|
219
223
|
}
|
|
220
224
|
export {
|
|
221
|
-
|
|
225
|
+
pe as default
|
|
222
226
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../../_virtual/jsx-runtime.cjs"),R=require("../../common/description/DescList.cjs"),b=require("react"),g=require("../../../locale/hooks/translation-constants.cjs"),p=require("./CrudViewerUtil.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../../_virtual/jsx-runtime.cjs"),R=require("../../common/description/DescList.cjs"),b=require("react"),f=require("react-i18next"),g=require("../../../locale/hooks/translation-constants.cjs"),p=require("./CrudViewerUtil.cjs");function q({className:l,fields:u,data:e,descListColumn:c={xs:1,md:3,sm:2,lg:4},layout:m,action:t,keepEmptyValues:x}){const{t:i}=f.useTranslation(g.TRANSLATION_NAMESPACE),j=b.useMemo(()=>{const o=u.filter(({hidden:r,hideInDescList:s})=>!r&&!s).map((r,s)=>({label:r.label,noFormatting:!0,value:p.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.jsxRuntimeExports.jsx(R.default,{keepEmptyValues:x,bordered:!0,column:c,className:l,layout:m,list:j}):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{})}exports.CrudDecListView=q;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as m } from "../../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import x from "../../common/description/DescList.js";
|
|
3
3
|
import { useMemo as b } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { useTranslation as g } from "react-i18next";
|
|
5
|
+
import { TRANSLATION_NAMESPACE as j } from "../../../locale/hooks/translation-constants.js";
|
|
6
|
+
import { getRendererValueCrudViewer as A } from "./CrudViewerUtil.js";
|
|
7
7
|
function V({
|
|
8
8
|
className: u,
|
|
9
9
|
fields: s,
|
|
@@ -13,11 +13,11 @@ function V({
|
|
|
13
13
|
action: o,
|
|
14
14
|
keepEmptyValues: p
|
|
15
15
|
}) {
|
|
16
|
-
const { t: i } =
|
|
16
|
+
const { t: i } = g(j), c = b(() => {
|
|
17
17
|
const n = s.filter(({ hidden: e, hideInDescList: t }) => !e && !t).map((e, t) => ({
|
|
18
18
|
label: e.label,
|
|
19
19
|
noFormatting: !0,
|
|
20
|
-
value:
|
|
20
|
+
value: A(e)(
|
|
21
21
|
r == null ? void 0 : r[e.name],
|
|
22
22
|
r,
|
|
23
23
|
t
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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"),D=require("../../common/button/CloneButtonTable.cjs"),k=require("../../common/button/DeleteButtonTable.cjs"),H=require("../../common/button/ExportButton.cjs"),U=require("../../common/button/HideButtonTable.cjs"),F=require("../../common/button/RefreshButton.cjs"),tt=require("../../common/button/UpdateButtonTable.cjs"),et=require("../../common/button/ViewButtonTable.cjs"),st=require("../../common/layout/VerticalSpace.cjs"),rt=require("../../common/table/table.cjs"),l=require("react"),ut=require("react-i18next"),nt=require("../../../locale/hooks/translation-constants.cjs"),ot=require("../CrudSearchComponent.cjs"),xt=require("./CrudDecListView.cjs"),_=require("./CrudViewerUtil.cjs"),ct=require("../../../../node_modules/antd/es/modal/index.cjs");function jt({idField:r="id",loadingData:L,fields:c,isDeleting:q,isHiding:d,viewable:o=!1,paginateProps:i,onDelete:a,onHide:v,onUpdate:R,data:E=[],extraAction:m,onClickUpdate:x,minusHeight:S,scroll:N,onClickClone:f,className:z,expandable:$,size:w,bordered:A,descListColumn:G,extraView:p,decListLayout:J,scrollToTop:lt,onClickRefresh:g,closeViewOnClickUpdate:b,onExport:B,confirmHiding:C,confirmDeleting:I,rowClassName:K,actionWidth:Q=190,...W}){const{t:X}=ut.useTranslation(nt.TRANSLATION_NAMESPACE),M=l.useMemo(()=>c.map(({hideInTable:e,hidden:s,width:j,name:n,label:Z,halign:P,...O})=>({title:Z,width:j,key:n,dataIndex:n,hidden:e||s,align:P??(O.type==="number"?"right":void 0),render:_.getRendererValueCrudViewer(O)})),[c]),[u,h]=l.useState(),[T,y]=l.useState();l.useEffect(()=>{E&&h(e=>{if(e)return E.find(s=>s[r]===e[r])})},[E,r,u]);const V=l.useCallback(e=>{var j;const s=m==null?void 0:m(e);return(Array.isArray(s)?(j=s==null?void 0:s.filter(Boolean))!=null&&j.length:s)||R||x||f||a?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[s,(R||x)&&t.jsxRuntimeExports.jsx(tt.default,{value:e,onClick:n=>{y(n[r]),x==null||x(e),b&&h(void 0)}}),f&&t.jsxRuntimeExports.jsx(D.default,{value:e,onClick:n=>f(n)}),B&&t.jsxRuntimeExports.jsx(H.ExportButton,{value:e,onClick:async n=>await B(n)}),v&&t.jsxRuntimeExports.jsx(U.default,{value:e,disabled:d,shouldConfirm:C,loading:d&&e[r]===T,onClick:async n=>{y(n[r]),await v({[r]:n[r]})}}),a&&t.jsxRuntimeExports.jsx(k.default,{value:e,disabled:q,shouldConfirm:I,loading:q&&e[r]===T,onClick:async n=>{y(n[r]),await a({[r]:n[r]})}})]}):void 0},[b,I,C,m,r,q,d,f,x,a,B,v,R,T]),Y=l.useMemo(()=>{let e=typeof o=="string"?u==null?void 0:u[o]:void 0;if(typeof e=="object"){const s=c.find(j=>j.name===o);e=_.getRendererValueCrudViewer(s)(e,u,0)}return e},[o,u,c]);return t.jsxRuntimeExports.jsxs("div",{children:[o&&t.jsxRuntimeExports.jsx(ct.default,{width:"100%",open:!!u,title:Y??t.jsxRuntimeExports.jsx("div",{children:" "}),footer:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),closable:!0,onCancel:()=>h(void 0),children:!!u&&t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(xt.CrudDecListView,{layout:J,descListColumn:G,data:u,fields:c,action:V(u)}),p==null?void 0:p(u)]},u==null?void 0:u[r])}),t.jsxRuntimeExports.jsx(ot.default,{fields:c,...W}),t.jsxRuntimeExports.jsxs(st.default,{children:[!!g&&t.jsxRuntimeExports.jsx(F.RefreshButton,{onClick:g}),t.jsxRuntimeExports.jsx(rt.default,{rowClassName:K,className:z,scroll:N??(S?{y:`calc(100vh - ${S})`}:void 0),id:"crud-table",dataSource:E,loading:L,bordered:A,size:w,expandable:$,pagination:i?{total:i.count,onChange:i.setPage,current:i.page,pageSize:i.pageSize}:void 0,columns:R||x||a||m||o?[...M,{title:X("str.action"),dataIndex:"",fixed:"right",width:Q,render:(e,s)=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[o&&t.jsxRuntimeExports.jsx(et.default,{value:s,onClick:h}),V(s)]})}]:M})]})]})}exports.default=jt;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { j as r } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import
|
|
3
|
-
import H from "../../common/button/
|
|
4
|
-
import U from "../../common/button/
|
|
5
|
-
import
|
|
6
|
-
import rr from "../../common/button/
|
|
7
|
-
import
|
|
8
|
-
import tr from "../../common/button/
|
|
9
|
-
import sr from "../../common/
|
|
10
|
-
import mr from "../../common/
|
|
11
|
-
import ur from "
|
|
12
|
-
import {
|
|
2
|
+
import k from "../../common/button/CloneButtonTable.js";
|
|
3
|
+
import H from "../../common/button/DeleteButtonTable.js";
|
|
4
|
+
import { ExportButton as U } from "../../common/button/ExportButton.js";
|
|
5
|
+
import F from "../../common/button/HideButtonTable.js";
|
|
6
|
+
import { RefreshButton as rr } from "../../common/button/RefreshButton.js";
|
|
7
|
+
import or from "../../common/button/UpdateButtonTable.js";
|
|
8
|
+
import tr from "../../common/button/ViewButtonTable.js";
|
|
9
|
+
import sr from "../../common/layout/VerticalSpace.js";
|
|
10
|
+
import mr from "../../common/table/table.js";
|
|
11
|
+
import { useMemo as L, useState as _, useEffect as ur, useCallback as nr } from "react";
|
|
12
|
+
import { useTranslation as er } from "react-i18next";
|
|
13
13
|
import { TRANSLATION_NAMESPACE as fr } from "../../../locale/hooks/translation-constants.js";
|
|
14
14
|
import cr from "../CrudSearchComponent.js";
|
|
15
15
|
import { CrudDecListView as lr } from "./CrudDecListView.js";
|
|
16
16
|
import { getRendererValueCrudViewer as V } from "./CrudViewerUtil.js";
|
|
17
|
-
import
|
|
17
|
+
import jr from "../../../../node_modules/antd/es/modal/index.js";
|
|
18
18
|
function Or({
|
|
19
19
|
idField: s = "id",
|
|
20
20
|
loadingData: $,
|
|
@@ -49,7 +49,7 @@ function Or({
|
|
|
49
49
|
actionWidth: Y = 190,
|
|
50
50
|
...Z
|
|
51
51
|
}) {
|
|
52
|
-
const { t: d } =
|
|
52
|
+
const { t: d } = er(fr), N = L(
|
|
53
53
|
() => f.map(
|
|
54
54
|
({ hideInTable: o, hidden: t, width: c, name: u, label: w, halign: D, ...z }) => ({
|
|
55
55
|
title: w,
|
|
@@ -63,20 +63,20 @@ function Or({
|
|
|
63
63
|
),
|
|
64
64
|
[f]
|
|
65
65
|
), [m, x] = _(), [b, g] = _();
|
|
66
|
-
|
|
66
|
+
ur(() => {
|
|
67
67
|
v && x((o) => {
|
|
68
68
|
if (o)
|
|
69
69
|
return v.find((t) => t[s] === o[s]);
|
|
70
70
|
});
|
|
71
71
|
}, [v, s, m]);
|
|
72
|
-
const O =
|
|
72
|
+
const O = nr(
|
|
73
73
|
(o) => {
|
|
74
74
|
var c;
|
|
75
75
|
const t = a == null ? void 0 : a(o);
|
|
76
76
|
return (Array.isArray(t) ? (c = t == null ? void 0 : t.filter(Boolean)) != null && c.length : t) || h || e || T || j ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
77
77
|
t,
|
|
78
78
|
(h || e) && /* @__PURE__ */ r.jsx(
|
|
79
|
-
|
|
79
|
+
or,
|
|
80
80
|
{
|
|
81
81
|
value: o,
|
|
82
82
|
onClick: (u) => {
|
|
@@ -84,16 +84,16 @@ function Or({
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
),
|
|
87
|
-
T && /* @__PURE__ */ r.jsx(
|
|
87
|
+
T && /* @__PURE__ */ r.jsx(k, { value: o, onClick: (u) => T(u) }),
|
|
88
88
|
S && /* @__PURE__ */ r.jsx(
|
|
89
|
-
|
|
89
|
+
U,
|
|
90
90
|
{
|
|
91
91
|
value: o,
|
|
92
92
|
onClick: async (u) => await S(u)
|
|
93
93
|
}
|
|
94
94
|
),
|
|
95
95
|
p && /* @__PURE__ */ r.jsx(
|
|
96
|
-
|
|
96
|
+
F,
|
|
97
97
|
{
|
|
98
98
|
value: o,
|
|
99
99
|
disabled: B,
|
|
@@ -105,7 +105,7 @@ function Or({
|
|
|
105
105
|
}
|
|
106
106
|
),
|
|
107
107
|
j && /* @__PURE__ */ r.jsx(
|
|
108
|
-
|
|
108
|
+
H,
|
|
109
109
|
{
|
|
110
110
|
value: o,
|
|
111
111
|
disabled: y,
|
|
@@ -148,7 +148,7 @@ function Or({
|
|
|
148
148
|
}, [n, m, f]);
|
|
149
149
|
return /* @__PURE__ */ r.jsxs("div", { children: [
|
|
150
150
|
n && /* @__PURE__ */ r.jsx(
|
|
151
|
-
|
|
151
|
+
jr,
|
|
152
152
|
{
|
|
153
153
|
width: "100%",
|
|
154
154
|
open: !!m,
|
|
@@ -172,10 +172,10 @@ function Or({
|
|
|
172
172
|
}
|
|
173
173
|
),
|
|
174
174
|
/* @__PURE__ */ r.jsx(cr, { fields: f, ...Z }),
|
|
175
|
-
/* @__PURE__ */ r.jsxs(
|
|
176
|
-
!!C && /* @__PURE__ */ r.jsx(
|
|
175
|
+
/* @__PURE__ */ r.jsxs(sr, { children: [
|
|
176
|
+
!!C && /* @__PURE__ */ r.jsx(rr, { onClick: C }),
|
|
177
177
|
/* @__PURE__ */ r.jsx(
|
|
178
|
-
|
|
178
|
+
mr,
|
|
179
179
|
{
|
|
180
180
|
rowClassName: X,
|
|
181
181
|
className: A,
|
|
@@ -202,7 +202,7 @@ function Or({
|
|
|
202
202
|
fixed: "right",
|
|
203
203
|
width: Y,
|
|
204
204
|
render: (o, t) => /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
205
|
-
n && /* @__PURE__ */ r.jsx(
|
|
205
|
+
n && /* @__PURE__ */ r.jsx(tr, { value: t, onClick: x }),
|
|
206
206
|
O(t)
|
|
207
207
|
] })
|
|
208
208
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../../_virtual/jsx-runtime.cjs"),s=require("../../common/show-more/index.cjs"),x=require("../FileCrudField.cjs"),d=require("../ImageCrudField.cjs"),j=require("../../../locale/hooks/translation-constants.cjs"),v=require("i18next"),r=require("../../../util/DateUtil.cjs"),m=require("../../../util/NumberUtil.cjs"),y=require("../../../../node_modules/@ant-design/icons/es/icons/CheckOutlined.cjs"),C=require("../../../../node_modules/@ant-design/icons/es/icons/CloseOutlined.cjs"),g=require("../../../../node_modules/antd/es/tooltip/index.cjs"),q=require("../../../../node_modules/antd/es/avatar/index.cjs");function R({type:a,render:i,...u}){return a==="object"?(t,n,e)=>typeof i=="function"?i(t,n,e):"":a==="select"?(t,n,e)=>{const o=u;let l=o.multiple?Array.isArray(t)?t.map(c=>c==null?void 0:c[o.innerFieldLabel??"name"]):void 0:t==null?void 0:t[o.innerFieldLabel??"name"];return(!l&&typeof t=="string"||typeof t=="number")&&(l=t),typeof i=="function"?i(l,n,e):Array.isArray(l)?l.join(", "):l}:a==="number"?(t,n,e)=>typeof i=="function"?i(t,n,e):u!=null&&u.int?m.default.toInt(t,u.formatted):m.default.toMoney(t):a==="enum"?(t,n,e)=>{var l;const o=v.t(((l=u==null?void 0:u.translation)==null?void 0:l[t??""])??t,{ns:j.TRANSLATION_NAMESPACE});return typeof i=="function"?i(t,n,e):o}:a==="date"?(t,n,e)=>{if(!t)return"-";const o=u!=null&&u.formatTime?r.default.formatDateTime(t):r.default.formatDate(t);return typeof i=="function"?i(t,n,e):o}:a==="checkbox"?(t,n,e)=>typeof i=="function"?i(t,n,e):t?f.jsxRuntimeExports.jsx(y.default,{}):f.jsxRuntimeExports.jsx(C.default,{}):a==="image"?(t,n,e)=>typeof i=="function"?i(t,n,e):f.jsxRuntimeExports.jsx(d.ImageCrudCellValue,{value:t,provider:u.provider}):a==="file"?(t,n,e)=>typeof i=="function"?i(t,n,e):f.jsxRuntimeExports.jsx(x.FileCrudCellValue,{value:t,provider:u.provider}):a==="time"?(t,n,e)=>{if(!t)return"-";const o=u==null?void 0:u.format,l=u==null?void 0:u.use12Hours,c=r.default.formatTime(t,o||(l?"hh:mm:ss A":void 0));return typeof i=="function"?i(t,n,e):c}:a==="color"?(t,n,e)=>typeof i=="function"?i(t,n,e):typeof t=="string"&&t.startsWith("#")?f.jsxRuntimeExports.jsx(g.default,{title:t,children:f.jsxRuntimeExports.jsx(q.default,{style:{backgroundColor:t}})}):String(t):a==="textarea"?(t,n,e)=>{const o=(u==null?void 0:u.truncated)??1;return typeof i=="function"?i(t,n,e):o?f.jsxRuntimeExports.jsx(s.ShowMore,{lines:o===!0?1:o,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=R;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { j as c } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as g } from "../../../../node_modules/i18next/dist/esm/i18next.js";
|
|
2
|
+
import { ShowMore as x } from "../../common/show-more/index.js";
|
|
3
|
+
import { FileCrudCellValue as j } from "../FileCrudField.js";
|
|
4
|
+
import { ImageCrudCellValue as y } from "../ImageCrudField.js";
|
|
5
|
+
import { TRANSLATION_NAMESPACE as A } from "../../../locale/hooks/translation-constants.js";
|
|
6
|
+
import { t as b } from "i18next";
|
|
8
7
|
import r from "../../../util/DateUtil.js";
|
|
9
8
|
import v from "../../../util/NumberUtil.js";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
9
|
+
import e from "../../../../node_modules/@ant-design/icons/es/icons/CheckOutlined.js";
|
|
10
|
+
import g from "../../../../node_modules/@ant-design/icons/es/icons/CloseOutlined.js";
|
|
11
|
+
import h from "../../../../node_modules/antd/es/tooltip/index.js";
|
|
12
|
+
import C from "../../../../node_modules/antd/es/avatar/index.js";
|
|
13
|
+
function k({
|
|
13
14
|
type: u,
|
|
14
15
|
render: i,
|
|
15
16
|
...o
|
|
@@ -20,23 +21,23 @@ function M({
|
|
|
20
21
|
return (!a && typeof t == "string" || typeof t == "number") && (a = t), typeof i == "function" ? i(a, f, n) : Array.isArray(a) ? a.join(", ") : a;
|
|
21
22
|
} : u === "number" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : o != null && o.int ? v.toInt(t, o.formatted) : v.toMoney(t) : u === "enum" ? (t, f, n) => {
|
|
22
23
|
var a;
|
|
23
|
-
const m =
|
|
24
|
+
const m = b(
|
|
24
25
|
((a = o == null ? void 0 : o.translation) == null ? void 0 : a[t ?? ""]) ?? t,
|
|
25
|
-
{ ns:
|
|
26
|
+
{ ns: A }
|
|
26
27
|
);
|
|
27
28
|
return typeof i == "function" ? i(t, f, n) : m;
|
|
28
29
|
} : u === "date" ? (t, f, n) => {
|
|
29
30
|
if (!t) return "-";
|
|
30
31
|
const m = o != null && o.formatTime ? r.formatDateTime(t) : r.formatDate(t);
|
|
31
32
|
return typeof i == "function" ? i(t, f, n) : m;
|
|
32
|
-
} : u === "checkbox" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : t ? /* @__PURE__ */ c.jsx(
|
|
33
|
-
|
|
33
|
+
} : u === "checkbox" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : t ? /* @__PURE__ */ c.jsx(e, {}) : /* @__PURE__ */ c.jsx(g, {}) : u === "image" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : /* @__PURE__ */ c.jsx(
|
|
34
|
+
y,
|
|
34
35
|
{
|
|
35
36
|
value: t,
|
|
36
37
|
provider: o.provider
|
|
37
38
|
}
|
|
38
39
|
) : u === "file" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : /* @__PURE__ */ c.jsx(
|
|
39
|
-
|
|
40
|
+
j,
|
|
40
41
|
{
|
|
41
42
|
value: t,
|
|
42
43
|
provider: o.provider
|
|
@@ -48,11 +49,11 @@ function M({
|
|
|
48
49
|
m || (a ? "hh:mm:ss A" : void 0)
|
|
49
50
|
);
|
|
50
51
|
return typeof i == "function" ? i(t, f, n) : l;
|
|
51
|
-
} : u === "color" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ c.jsx(
|
|
52
|
+
} : u === "color" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ c.jsx(h, { title: t, children: /* @__PURE__ */ c.jsx(C, { style: { backgroundColor: t } }) }) : String(t) : u === "textarea" ? (t, f, n) => {
|
|
52
53
|
const m = (o == null ? void 0 : o.truncated) ?? 1;
|
|
53
|
-
return typeof i == "function" ? i(t, f, n) : m ? /* @__PURE__ */ c.jsx(
|
|
54
|
+
return typeof i == "function" ? i(t, f, n) : m ? /* @__PURE__ */ c.jsx(x, { lines: m === !0 ? 1 : m, children: t }) : t;
|
|
54
55
|
} : typeof i == "function" ? i : (t) => t;
|
|
55
56
|
}
|
|
56
57
|
export {
|
|
57
|
-
|
|
58
|
+
k as getRendererValueCrudViewer
|
|
58
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("../../node_modules/react-responsive/dist/esm/index.cjs");function
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../node_modules/react-responsive/dist/esm/index.cjs");function s(){const i=e.useMediaQuery({minWidth:768}),t=e.useMediaQuery({maxWidth:767});return{isDesktop:i,isMobile:t}}exports.default=s;
|
|
@@ -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.default}},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/src/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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={str:{delete:"Delete",clone:"Clone",update:"Update",new:"New",back:"Back",next:"Next",save:"Save",import:"Import",cancel:"Cancel",print:"Print",hide:"Hide",no:"No",action:"Action",remove:"Remove",view:"View",ok:"Ok",yes:"Yes",warning:"Warning",success:"Success",error:"Error",retry:"Retry",previous:"Previous",unhide:"Unhide",downloadCsvTemplate:"Download CSV Template",importCsvFile:"Import CSV File",export:"Export",goBack:"Go Back",refresh:"Refresh",fileUploadMessage1:"Drag file here or ",fileUploadMessage2:"Click to Upload"},err:{save:"An error occurred while saving",validation:{required:"is required",minLength8:"must be at least 8 characters",percentage:"must be a percentage",maximumValueExceeded:"must be less than %maxValue%",invalidNic:"must be a valid NIC",invalid:"must be a valid"},notFound:"Not Found"},message:{loading:{saving:"Saving"}},qus:{importWithIssues:"Some fields have issues. Do you want to proceed with the import?",doYouWantToDelete:"Do you want to delete?",doYouWantToHide:"Do you want to hide?",doYouWantToUnhide:"Do you want to unhide?"}};
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={str:{delete:"Delete",clone:"Clone",update:"Update",new:"New",back:"Back",next:"Next",save:"Save",import:"Import",cancel:"Cancel",print:"Print",hide:"Hide",no:"No",action:"Action",remove:"Remove",view:"View",ok:"Ok",yes:"Yes",warning:"Warning",success:"Success",error:"Error",retry:"Retry",previous:"Previous",unhide:"Unhide",downloadCsvTemplate:"Download CSV Template",importCsvFile:"Import CSV File",export:"Export",goBack:"Go Back",refresh:"Refresh",fileUploadMessage1:"Drag file here or ",fileUploadMessage2:"Click to Upload"},err:{save:"An error occurred while saving",validation:{required:"is required",minLength8:"must be at least 8 characters",percentage:"must be a percentage",maximumValueExceeded:"must be less than %maxValue%",invalidNic:"must be a valid NIC",invalid:"must be a valid"},notFound:"Not Found"},message:{loading:{saving:"Saving"}},qus:{importWithIssues:"Some fields have issues. Do you want to proceed with the import?",doYouWantToDelete:"Do you want to delete?",doYouWantToHide:"Do you want to hide?",doYouWantToUnhide:"Do you want to unhide?"}};exports.default=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../_virtual/dayjs.min.cjs"),a=require("i18next"),r=e=>t.default(e).locale(a.language).format("YYYY-MM-DD HH:mm"),l=e=>t.default(e).locale(a.language).format("YYYY-MM-DD HH:mm:ss"),u=e=>t.default(e).locale(a.language).format("YYYY-MM-DD"),n=(e,o="HH:mm:ss")=>t.default(e).locale(a.language).format(o),m={formatDateTime:r,formatDate:u,formatDateTimeWithSecond:l,formatTime:n};exports.default=m;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import e from "
|
|
3
|
-
const m = (
|
|
1
|
+
import a from "../../_virtual/dayjs.min.js";
|
|
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
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("../../node_modules/browser-image-compression/dist/browser-image-compression.cjs");class
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("../../node_modules/browser-image-compression/dist/browser-image-compression.cjs");class d{async resizeImage(t){const e=await c.default(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 g=new d;exports.default=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("i18next"),n=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 a=Number(r);isNaN(a)&&r||a<0||a>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%",n.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};exports.default=g;
|
package/dist/util/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../src/util/DateUtil.cjs"),e=require("../src/util/NumberUtil.cjs"),i=require("../src/util/ImageUtil.cjs"),l=require("../src/util/ValidationUtil.cjs");exports.DateUtil=t;exports.NumberUtil=e.default;exports.ImageUtil=i;exports.ValidationUtil=l;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../src/util/DateUtil.cjs"),e=require("../src/util/NumberUtil.cjs"),i=require("../src/util/ImageUtil.cjs"),l=require("../src/util/ValidationUtil.cjs");exports.DateUtil=t.default;exports.NumberUtil=e.default;exports.ImageUtil=i.default;exports.ValidationUtil=l.default;
|