@kingteza/crud-component 1.0.5 → 1.0.6
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/_commonjsHelpers.cjs +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -5
- 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/index.js +4 -4
- package/dist/_virtual/index2.cjs +1 -1
- package/dist/_virtual/index2.js +5 -2
- package/dist/_virtual/index3.js +2 -2
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index4.js +2 -2
- package/dist/_virtual/index5.cjs +1 -1
- package/dist/_virtual/index5.js +2 -5
- package/dist/_virtual/localeData.cjs +1 -1
- package/dist/_virtual/weekOfYear.cjs +1 -1
- package/dist/_virtual/weekYear.cjs +1 -1
- package/dist/_virtual/weekday.cjs +1 -1
- package/dist/common/index.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/src/components/common/DatePicker/DatePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/DatePicker.js +1 -1
- package/dist/src/components/common/DatePicker/TimePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/TimePicker.js +3 -3
- 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 +10 -10
- package/dist/src/components/common/button/CloneButtonTable.cjs +1 -1
- package/dist/src/components/common/button/CloneButtonTable.js +7 -7
- package/dist/src/components/common/button/DeleteButtonTable.cjs +1 -1
- package/dist/src/components/common/button/DeleteButtonTable.js +17 -17
- package/dist/src/components/common/button/ExportButton.cjs +1 -1
- package/dist/src/components/common/button/ExportButton.js +16 -16
- package/dist/src/components/common/button/HideButtonTable.cjs +1 -1
- package/dist/src/components/common/button/HideButtonTable.js +18 -18
- package/dist/src/components/common/button/ImportButton.cjs +1 -1
- package/dist/src/components/common/button/ImportButton.js +25 -25
- package/dist/src/components/common/button/NewButton.cjs +1 -1
- package/dist/src/components/common/button/NewButton.js +16 -16
- package/dist/src/components/common/button/PrintButton.cjs +1 -1
- package/dist/src/components/common/button/PrintButton.js +14 -14
- package/dist/src/components/common/button/RefreshButton.cjs +1 -1
- package/dist/src/components/common/button/RefreshButton.js +12 -12
- package/dist/src/components/common/button/UnHideButton.cjs +1 -1
- package/dist/src/components/common/button/UnHideButton.js +28 -28
- package/dist/src/components/common/button/UpdateButtonTable.cjs +1 -1
- package/dist/src/components/common/button/UpdateButtonTable.js +9 -9
- package/dist/src/components/common/button/ViewButtonTable.cjs +1 -1
- package/dist/src/components/common/button/ViewButtonTable.js +13 -13
- package/dist/src/components/common/check-box/CheckBox.cjs +1 -1
- package/dist/src/components/common/description/DescList.cjs +1 -1
- package/dist/src/components/common/layout/VerticalSpace.cjs +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.cjs +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.js +5 -5
- package/dist/src/components/common/picker/ImagePicker.cjs +1 -1
- package/dist/src/components/common/picker/ImagePicker.js +73 -76
- package/dist/src/components/common/radio/RadioGroupComponent.cjs +1 -1
- package/dist/src/components/common/report/SelectFieldInReport.cjs +1 -1
- package/dist/src/components/common/select/CustomSelectOption.cjs +1 -1
- package/dist/src/components/common/select/SelectComponent.cjs +1 -1
- package/dist/src/components/common/select/SelectComponent.js +5 -5
- package/dist/src/components/common/show-more/index.cjs +1 -1
- package/dist/src/components/common/show-more/index.js +1 -1
- package/dist/src/components/common/tab/TabViewWithRoute.cjs +1 -1
- package/dist/src/components/common/tab/TabViewWithRoute.js +11 -10
- package/dist/src/components/common/table/table.cjs +1 -1
- package/dist/src/components/common/tag/StatusTag.cjs +1 -1
- package/dist/src/components/common/tag/StatusTag.js +1 -1
- package/dist/src/components/common/text-field/NumberField.cjs +1 -1
- package/dist/src/components/common/text-field/NumberField.js +7 -7
- 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 +3 -3
- package/dist/src/components/common/text-field/TextField.cjs +1 -1
- package/dist/src/components/common/text-field/TextField.js +34 -34
- package/dist/src/components/common/tooltip/TooltipComponent.cjs +1 -1
- package/dist/src/components/common/wizard/WizardResult.cjs +1 -1
- package/dist/src/components/common/wizard/WizardResult.js +36 -37
- package/dist/src/components/common/wizard/WizardViewForm.cjs +1 -1
- package/dist/src/components/crud/CrudComponent.cjs +1 -1
- package/dist/src/components/crud/CrudComponent.js +15 -15
- package/dist/src/components/crud/CrudField.cjs +1 -1
- package/dist/src/components/crud/CrudField.js +22 -22
- package/dist/src/components/crud/CrudForm.js +10 -10
- package/dist/src/components/crud/CrudFormWizard.cjs +1 -1
- package/dist/src/components/crud/CrudFormWizard.js +63 -65
- package/dist/src/components/crud/CrudReportComponent.cjs +3 -3
- package/dist/src/components/crud/CrudReportComponent.js +54 -54
- package/dist/src/components/crud/CrudSearchComponent.cjs +1 -1
- package/dist/src/components/crud/CrudSearchComponent.js +23 -23
- package/dist/src/components/crud/FileCrudField.cjs +1 -1
- package/dist/src/components/crud/FileCrudField.js +94 -101
- package/dist/src/components/crud/ImageCrudField.cjs +1 -1
- package/dist/src/components/crud/ImageCrudField.js +35 -35
- package/dist/src/components/crud/import/CrudImportButton.cjs +1 -1
- package/dist/src/components/crud/import/CrudImportButton.js +12 -12
- package/dist/src/components/crud/import/CrudImportComponent.cjs +2 -2
- package/dist/src/components/crud/import/CrudImportComponent.js +94 -95
- 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 +7 -7
- package/dist/src/components/crud/view/CrudViewerUtil.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewerUtil.js +31 -32
- 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/ImageUtil.js +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 +1 -1
- package/dist/_virtual/FileSaver.min.cjs +0 -1
- package/dist/_virtual/FileSaver.min.js +0 -5
- package/dist/_virtual/FileSaver.min2.cjs +0 -1
- package/dist/_virtual/FileSaver.min2.js +0 -4
- package/dist/_virtual/ShowMoreText.cjs +0 -1
- package/dist/_virtual/ShowMoreText.js +0 -7
- package/dist/_virtual/ShowMoreText2.cjs +0 -1
- package/dist/_virtual/ShowMoreText2.js +0 -4
- package/dist/_virtual/Truncate.cjs +0 -1
- package/dist/_virtual/Truncate.js +0 -4
- package/dist/_virtual/index10.cjs +0 -1
- package/dist/_virtual/index10.js +0 -4
- package/dist/_virtual/index6.cjs +0 -1
- package/dist/_virtual/index6.js +0 -2
- package/dist/_virtual/index7.cjs +0 -1
- package/dist/_virtual/index7.js +0 -7
- package/dist/_virtual/index8.cjs +0 -1
- package/dist/_virtual/index8.js +0 -7
- package/dist/_virtual/index9.cjs +0 -1
- package/dist/_virtual/index9.js +0 -4
- package/dist/_virtual/main.cjs +0 -1
- package/dist/_virtual/main.js +0 -7
- package/dist/_virtual/main2.cjs +0 -1
- package/dist/_virtual/main2.js +0 -4
- package/dist/_virtual/papaparse.min.cjs +0 -1
- package/dist/_virtual/papaparse.min.js +0 -7
- package/dist/_virtual/papaparse.min2.cjs +0 -1
- package/dist/_virtual/papaparse.min2.js +0 -4
|
@@ -1,69 +1,68 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import G from "
|
|
8
|
-
import H from "../../../
|
|
9
|
-
import J from "
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
function de({
|
|
1
|
+
import { j as r } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { WarningTwoTone as S, DownloadOutlined as R } from "@ant-design/icons";
|
|
3
|
+
import W from "papaparse";
|
|
4
|
+
import { Tooltip as q, Modal as B, Space as O, Spin as z, Progress as _ } from "antd";
|
|
5
|
+
import { saveAs as $ } from "file-saver";
|
|
6
|
+
import { useState as k, useEffect as U, useMemo as T, useCallback as m } from "react";
|
|
7
|
+
import { useTranslation as G } from "react-i18next";
|
|
8
|
+
import { TRANSLATION_NAMESPACE as H } from "../../../locale/hooks/translation-constants.js";
|
|
9
|
+
import J from "../view/CrudViewer.js";
|
|
10
|
+
import K from "../../../util/DateUtil.js";
|
|
11
|
+
import Q from "../../common/button/Button.js";
|
|
12
|
+
import { ImportButton as X } from "../../common/button/ImportButton.js";
|
|
13
|
+
function ce({
|
|
15
14
|
onCloseMethod: h,
|
|
16
15
|
open: y,
|
|
17
|
-
fields:
|
|
16
|
+
fields: v,
|
|
18
17
|
importProps: o
|
|
19
18
|
}) {
|
|
20
|
-
const [c,
|
|
21
|
-
|
|
22
|
-
y || (
|
|
19
|
+
const [c, A] = k([]), [j, b] = k(!1), [N, D] = k(0);
|
|
20
|
+
U(() => {
|
|
21
|
+
y || (A([]), b(!1));
|
|
23
22
|
}, [y]);
|
|
24
|
-
const u =
|
|
23
|
+
const u = T(
|
|
25
24
|
() => new Map(
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
return !e.hidden && !((
|
|
25
|
+
v.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
|
+
[v]
|
|
31
|
+
), E = T(
|
|
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
|
), V = m(
|
|
42
41
|
async function() {
|
|
43
|
-
const e = `${
|
|
44
|
-
`,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(o == null ? void 0 : o.name) + " - " +
|
|
42
|
+
const e = `${E.join(",")}
|
|
43
|
+
`, t = new Blob([e], { type: "text/csv;charset=utf-8;" });
|
|
44
|
+
$(
|
|
45
|
+
t,
|
|
46
|
+
(o == null ? void 0 : o.name) + " - " + K.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
|
|
48
47
|
);
|
|
49
48
|
},
|
|
50
|
-
[
|
|
51
|
-
), { t:
|
|
52
|
-
const
|
|
53
|
-
|
|
49
|
+
[E, o == null ? void 0 : o.name]
|
|
50
|
+
), { t: l } = G(H), M = m(async (e) => {
|
|
51
|
+
const t = new FileReader();
|
|
52
|
+
t.onerror = console.error, t.onload = async (n) => {
|
|
54
53
|
var s;
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
}, []), C =
|
|
59
|
-
var
|
|
54
|
+
const i = (s = n == null ? void 0 : n.target) == null ? void 0 : s.result, a = W.parse(i, { header: !0 });
|
|
55
|
+
A(a.data);
|
|
56
|
+
}, t.readAsText(e);
|
|
57
|
+
}, []), C = T(() => {
|
|
58
|
+
var t, n, i;
|
|
60
59
|
let e = !1;
|
|
61
60
|
for (const a of c)
|
|
62
61
|
for (const [s, d] of u.entries()) {
|
|
63
62
|
const x = a[s], f = x || !isNaN(x);
|
|
64
63
|
if (d.required && !f)
|
|
65
|
-
if ((n = (
|
|
66
|
-
for (const g of ((
|
|
64
|
+
if ((n = (t = d.importProps) == null ? void 0 : t.extraFields) != null && n.length)
|
|
65
|
+
for (const g of ((i = d.importProps) == null ? void 0 : i.extraFields) ?? [])
|
|
67
66
|
if (a[g] || !isNaN(a[g])) {
|
|
68
67
|
e = !1;
|
|
69
68
|
break;
|
|
@@ -72,116 +71,116 @@ function de({
|
|
|
72
71
|
}
|
|
73
72
|
return e;
|
|
74
73
|
}, [c, u]), p = m(
|
|
75
|
-
(e) => (
|
|
74
|
+
(e) => (t, n) => {
|
|
76
75
|
var a, s, d;
|
|
77
|
-
const
|
|
78
|
-
if (e.required && !
|
|
79
|
-
let x =
|
|
76
|
+
const i = t || !isNaN(t);
|
|
77
|
+
if (e.required && !i) {
|
|
78
|
+
let x = l("err.validation.required");
|
|
80
79
|
if ((s = (a = e.importProps) == null ? void 0 : a.extraFields) != null && s.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((I) => !n[I])) && (x = "Either one of these fields is required: " + [e.name, ...f].join(", "));
|
|
83
82
|
}
|
|
84
|
-
return /* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
|
|
83
|
+
return /* @__PURE__ */ r.jsxs(q, { className: "d-flex", title: x, children: [
|
|
84
|
+
/* @__PURE__ */ r.jsx(S, { twoToneColor: "#ee9702" }),
|
|
85
|
+
t
|
|
87
86
|
] });
|
|
88
87
|
}
|
|
89
|
-
return
|
|
88
|
+
return t;
|
|
90
89
|
},
|
|
91
|
-
[
|
|
92
|
-
),
|
|
93
|
-
|
|
94
|
-
}, []),
|
|
90
|
+
[l]
|
|
91
|
+
), F = m(async (e) => {
|
|
92
|
+
D(e);
|
|
93
|
+
}, []), w = m(async () => {
|
|
95
94
|
try {
|
|
96
|
-
b(!0), await o.onClickImport(c,
|
|
95
|
+
b(!0), await o.onClickImport(c, F), h(!1);
|
|
97
96
|
} finally {
|
|
98
|
-
b(!1),
|
|
97
|
+
b(!1), D(0);
|
|
99
98
|
}
|
|
100
|
-
}, [c, o, h,
|
|
101
|
-
C ?
|
|
102
|
-
title:
|
|
103
|
-
content:
|
|
104
|
-
okText:
|
|
105
|
-
onOk:
|
|
99
|
+
}, [c, o, h, F]), L = m(async () => {
|
|
100
|
+
C ? B.warn({
|
|
101
|
+
title: l("str.warning"),
|
|
102
|
+
content: l("qus.importWithIssues"),
|
|
103
|
+
okText: l("str.import"),
|
|
104
|
+
onOk: w,
|
|
106
105
|
okCancel: !0,
|
|
107
106
|
closable: !0
|
|
108
|
-
}) :
|
|
109
|
-
}, [C,
|
|
110
|
-
return /* @__PURE__ */
|
|
111
|
-
|
|
107
|
+
}) : w();
|
|
108
|
+
}, [C, w, l]);
|
|
109
|
+
return /* @__PURE__ */ r.jsxs(
|
|
110
|
+
B,
|
|
112
111
|
{
|
|
113
|
-
title: [
|
|
112
|
+
title: [l("str.import"), o == null ? void 0 : o.name].filter(Boolean).join(" "),
|
|
114
113
|
width: "100%",
|
|
115
114
|
open: y,
|
|
116
|
-
onOk:
|
|
115
|
+
onOk: L,
|
|
117
116
|
destroyOnClose: !0,
|
|
118
117
|
onCancel: () => h(!1),
|
|
119
|
-
okText:
|
|
118
|
+
okText: l("str.import"),
|
|
120
119
|
confirmLoading: j,
|
|
121
120
|
okButtonProps: {
|
|
122
121
|
disabled: !(c != null && c.length)
|
|
123
122
|
},
|
|
124
|
-
footer: (e, { OkBtn:
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
C && /* @__PURE__ */
|
|
128
|
-
|
|
123
|
+
footer: (e, { OkBtn: t, CancelBtn: n }) => /* @__PURE__ */ r.jsxs(O, { children: [
|
|
124
|
+
/* @__PURE__ */ r.jsx(n, {}),
|
|
125
|
+
/* @__PURE__ */ r.jsx(t, {}),
|
|
126
|
+
C && /* @__PURE__ */ r.jsx(
|
|
127
|
+
q,
|
|
129
128
|
{
|
|
130
129
|
className: "d-flex",
|
|
131
130
|
title: "Some fields have issue. Please review before submit.",
|
|
132
|
-
children: /* @__PURE__ */
|
|
131
|
+
children: /* @__PURE__ */ r.jsx(S, { twoToneColor: "#ee9702" })
|
|
133
132
|
}
|
|
134
133
|
)
|
|
135
134
|
] }),
|
|
136
135
|
children: [
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
|
|
136
|
+
/* @__PURE__ */ r.jsxs(O, { children: [
|
|
137
|
+
/* @__PURE__ */ r.jsx(
|
|
138
|
+
Q,
|
|
140
139
|
{
|
|
141
140
|
onClick: V,
|
|
142
|
-
icon: /* @__PURE__ */
|
|
143
|
-
children:
|
|
141
|
+
icon: /* @__PURE__ */ r.jsx(R, {}),
|
|
142
|
+
children: l("str.downloadCsvTemplate")
|
|
144
143
|
}
|
|
145
144
|
),
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
|
|
145
|
+
/* @__PURE__ */ r.jsx(
|
|
146
|
+
X,
|
|
148
147
|
{
|
|
149
148
|
disabled: j,
|
|
150
149
|
type: "default",
|
|
151
150
|
onClick: M,
|
|
152
151
|
accept: ".csv",
|
|
153
|
-
children:
|
|
152
|
+
children: l("str.importCsvFile")
|
|
154
153
|
}
|
|
155
154
|
)
|
|
156
155
|
] }),
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
|
|
156
|
+
/* @__PURE__ */ r.jsx(
|
|
157
|
+
z,
|
|
159
158
|
{
|
|
160
159
|
spinning: j,
|
|
161
|
-
indicator:
|
|
162
|
-
|
|
160
|
+
indicator: N ? /* @__PURE__ */ r.jsx(
|
|
161
|
+
_,
|
|
163
162
|
{
|
|
164
163
|
type: "circle",
|
|
165
|
-
percent:
|
|
164
|
+
percent: N * 100,
|
|
166
165
|
size: 50,
|
|
167
166
|
format: (e) => `${parseInt(e)}%`
|
|
168
167
|
}
|
|
169
168
|
) : void 0,
|
|
170
|
-
children: /* @__PURE__ */
|
|
171
|
-
|
|
169
|
+
children: /* @__PURE__ */ r.jsx(
|
|
170
|
+
J,
|
|
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, n, 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
|
-
...((n = (
|
|
183
|
+
...((n = (t = e.importProps) == null ? void 0 : t.extraFields) == null ? void 0 : n.map((s) => ({
|
|
185
184
|
...e,
|
|
186
185
|
name: s,
|
|
187
186
|
label: s,
|
|
@@ -194,7 +193,7 @@ 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((s) => ({
|
|
198
197
|
...e,
|
|
199
198
|
name: s,
|
|
200
199
|
label: s,
|
|
@@ -218,5 +217,5 @@ function de({
|
|
|
218
217
|
);
|
|
219
218
|
}
|
|
220
219
|
export {
|
|
221
|
-
|
|
220
|
+
ce as default
|
|
222
221
|
};
|
|
@@ -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("antd"),k=require("../../common/button/CloneButtonTable.cjs"),H=require("../../common/button/DeleteButtonTable.cjs"),U=require("../../common/button/ExportButton.cjs"),F=require("../../common/button/HideButtonTable.cjs"),tt=require("../../common/button/RefreshButton.cjs"),et=require("../../common/button/UpdateButtonTable.cjs"),st=require("../../common/button/ViewButtonTable.cjs"),rt=require("../../common/layout/VerticalSpace.cjs"),ut=require("../../common/table/table.cjs"),l=require("react"),nt=require("react-i18next"),ot=require("../../../locale/hooks/translation-constants.cjs"),xt=require("../CrudSearchComponent.cjs"),ct=require("./CrudDecListView.cjs"),_=require("./CrudViewerUtil.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}=nt.useTranslation(ot.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(et.default,{value:e,onClick:n=>{y(n[r]),x==null||x(e),b&&h(void 0)}}),f&&t.jsxRuntimeExports.jsx(k.default,{value:e,onClick:n=>f(n)}),B&&t.jsxRuntimeExports.jsx(U.ExportButton,{value:e,onClick:async n=>await B(n)}),v&&t.jsxRuntimeExports.jsx(F.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(H.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(D.Modal,{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(ct.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(xt.default,{fields:c,...W}),t.jsxRuntimeExports.jsxs(rt.default,{children:[!!g&&t.jsxRuntimeExports.jsx(tt.RefreshButton,{onClick:g}),t.jsxRuntimeExports.jsx(ut.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(st.default,{value:s,onClick:h}),V(s)]})}]:M})]})]})}exports.default=jt;
|
|
@@ -10,11 +10,11 @@ import sr from "../../common/button/ViewButtonTable.js";
|
|
|
10
10
|
import mr from "../../common/layout/VerticalSpace.js";
|
|
11
11
|
import ur from "../../common/table/table.js";
|
|
12
12
|
import { useMemo as L, useState as _, useEffect as nr, useCallback as er } from "react";
|
|
13
|
-
import {
|
|
14
|
-
import cr from "
|
|
15
|
-
import
|
|
13
|
+
import { useTranslation as fr } from "react-i18next";
|
|
14
|
+
import { TRANSLATION_NAMESPACE as cr } from "../../../locale/hooks/translation-constants.js";
|
|
15
|
+
import lr from "../CrudSearchComponent.js";
|
|
16
|
+
import { CrudDecListView as jr } from "./CrudDecListView.js";
|
|
16
17
|
import { getRendererValueCrudViewer as V } from "./CrudViewerUtil.js";
|
|
17
|
-
import { useTranslation as jr } from "../../../../node_modules/react-i18next/dist/es/useTranslation.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 } = fr(cr), 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,
|
|
@@ -158,7 +158,7 @@ function Or({
|
|
|
158
158
|
onCancel: () => x(void 0),
|
|
159
159
|
children: !!m && /* @__PURE__ */ r.jsxs("div", { children: [
|
|
160
160
|
/* @__PURE__ */ r.jsx(
|
|
161
|
-
|
|
161
|
+
jr,
|
|
162
162
|
{
|
|
163
163
|
layout: W,
|
|
164
164
|
descListColumn: Q,
|
|
@@ -171,7 +171,7 @@ function Or({
|
|
|
171
171
|
] }, m == null ? void 0 : m[s])
|
|
172
172
|
}
|
|
173
173
|
),
|
|
174
|
-
/* @__PURE__ */ r.jsx(
|
|
174
|
+
/* @__PURE__ */ r.jsx(lr, { fields: f, ...Z }),
|
|
175
175
|
/* @__PURE__ */ r.jsxs(mr, { children: [
|
|
176
176
|
!!C && /* @__PURE__ */ r.jsx(or, { onClick: C }),
|
|
177
177
|
/* @__PURE__ */ r.jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../../_virtual/jsx-runtime.cjs"),m=require("@ant-design/icons"),s=require("antd"),j=require("../../common/show-more/index.cjs"),d=require("../FileCrudField.cjs"),v=require("../ImageCrudField.cjs"),y=require("../../../locale/hooks/translation-constants.cjs"),C=require("i18next"),r=require("../../../util/DateUtil.cjs"),x=require("../../../util/NumberUtil.cjs");function g({type:a,render:i,...n}){return a==="object"?(t,u,e)=>typeof i=="function"?i(t,u,e):"":a==="select"?(t,u,e)=>{const o=n;let l=o.multiple?Array.isArray(t)?t.map(f=>f==null?void 0:f[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,u,e):Array.isArray(l)?l.join(", "):l}:a==="number"?(t,u,e)=>typeof i=="function"?i(t,u,e):n!=null&&n.int?x.default.toInt(t,n.formatted):x.default.toMoney(t):a==="enum"?(t,u,e)=>{var l;const o=C.t(((l=n==null?void 0:n.translation)==null?void 0:l[t??""])??t,{ns:y.TRANSLATION_NAMESPACE});return typeof i=="function"?i(t,u,e):o}:a==="date"?(t,u,e)=>{if(!t)return"-";const o=n!=null&&n.formatTime?r.default.formatDateTime(t):r.default.formatDate(t);return typeof i=="function"?i(t,u,e):o}:a==="checkbox"?(t,u,e)=>typeof i=="function"?i(t,u,e):t?c.jsxRuntimeExports.jsx(m.CheckOutlined,{}):c.jsxRuntimeExports.jsx(m.CloseOutlined,{}):a==="image"?(t,u,e)=>typeof i=="function"?i(t,u,e):c.jsxRuntimeExports.jsx(v.ImageCrudCellValue,{value:t,provider:n.provider}):a==="file"?(t,u,e)=>typeof i=="function"?i(t,u,e):c.jsxRuntimeExports.jsx(d.FileCrudCellValue,{value:t,provider:n.provider}):a==="time"?(t,u,e)=>{if(!t)return"-";const o=n==null?void 0:n.format,l=n==null?void 0:n.use12Hours,f=r.default.formatTime(t,o||(l?"hh:mm:ss A":void 0));return typeof i=="function"?i(t,u,e):f}:a==="color"?(t,u,e)=>typeof i=="function"?i(t,u,e):typeof t=="string"&&t.startsWith("#")?c.jsxRuntimeExports.jsx(s.Tooltip,{title:t,children:c.jsxRuntimeExports.jsx(s.Avatar,{style:{backgroundColor:t}})}):String(t):a==="textarea"?(t,u,e)=>{const o=(n==null?void 0:n.truncated)??1;return typeof i=="function"?i(t,u,e):o?c.jsxRuntimeExports.jsx(j.ShowMore,{lines:o===!0?1:o,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=g;
|
|
@@ -1,58 +1,57 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { j as l } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { CheckOutlined as x, CloseOutlined as j } from "@ant-design/icons";
|
|
3
|
+
import { Tooltip as y, Avatar as e } from "antd";
|
|
4
|
+
import { ShowMore as A } from "../../common/show-more/index.js";
|
|
5
|
+
import { FileCrudCellValue as C } from "../FileCrudField.js";
|
|
5
6
|
import { ImageCrudCellValue as b } from "../ImageCrudField.js";
|
|
6
|
-
import { TRANSLATION_NAMESPACE as
|
|
7
|
-
import { t as
|
|
7
|
+
import { TRANSLATION_NAMESPACE as g } from "../../../locale/hooks/translation-constants.js";
|
|
8
|
+
import { t as h } 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 L({
|
|
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 = h(
|
|
24
23
|
((a = o == null ? void 0 : o.translation) == null ? void 0 : a[t ?? ""]) ?? t,
|
|
25
|
-
{ ns:
|
|
24
|
+
{ ns: g }
|
|
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
|
-
} :
|
|
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.jsx(x, {}) : /* @__PURE__ */ l.jsx(j, {}) : m === "image" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l.jsx(
|
|
33
32
|
b,
|
|
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.jsx(
|
|
38
|
+
C,
|
|
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.jsx(y, { title: t, children: /* @__PURE__ */ l.jsx(e, { 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.jsx(A, { lines: u === !0 ? 1 : u, children: t }) : t;
|
|
54
53
|
} : typeof i == "function" ? i : (t) => t;
|
|
55
54
|
}
|
|
56
55
|
export {
|
|
57
|
-
|
|
56
|
+
L as getRendererValueCrudViewer
|
|
58
57
|
};
|
|
@@ -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("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("browser-image-compression");class d{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 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;
|