@kingteza/crud-component 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/ShowMoreText.cjs +1 -1
- package/dist/_virtual/advancedFormat.cjs +1 -1
- package/dist/_virtual/customParseFormat.cjs +1 -1
- package/dist/_virtual/dayjs.min.cjs +1 -1
- package/dist/_virtual/index.cjs +1 -1
- package/dist/_virtual/index10.cjs +1 -1
- package/dist/_virtual/index10.js +2 -5
- package/dist/_virtual/index2.cjs +1 -1
- package/dist/_virtual/index2.js +2 -3
- package/dist/_virtual/index3.cjs +1 -1
- package/dist/_virtual/index3.js +2 -5
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index4.js +2 -4
- package/dist/_virtual/index6.cjs +1 -1
- package/dist/_virtual/index6.js +5 -2
- package/dist/_virtual/index7.cjs +1 -1
- package/dist/_virtual/index7.js +5 -2
- package/dist/_virtual/index8.cjs +1 -1
- package/dist/_virtual/index8.js +7 -2
- package/dist/_virtual/index9.cjs +1 -1
- package/dist/_virtual/index9.js +2 -5
- package/dist/_virtual/localeData.cjs +1 -1
- package/dist/_virtual/main.cjs +1 -1
- package/dist/_virtual/papaparse.min.cjs +1 -1
- package/dist/_virtual/weekOfYear.cjs +1 -1
- package/dist/_virtual/weekYear.cjs +1 -1
- package/dist/_virtual/weekday.cjs +1 -1
- package/dist/common/index.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/src/components/common/DatePicker/DatePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/DatePicker.js +22 -23
- package/dist/src/components/common/DatePicker/TimePicker.cjs +1 -1
- package/dist/src/components/common/DatePicker/TimePicker.js +12 -13
- package/dist/src/components/common/appearance/Hider.cjs +1 -1
- package/dist/src/components/common/button/Button.cjs +1 -1
- package/dist/src/components/common/button/Button.js +27 -28
- package/dist/src/components/common/button/CloneButtonTable.cjs +1 -1
- package/dist/src/components/common/button/CloneButtonTable.js +3 -3
- package/dist/src/components/common/button/DeleteButtonTable.cjs +1 -1
- package/dist/src/components/common/button/DeleteButtonTable.js +7 -7
- package/dist/src/components/common/button/ExportButton.cjs +1 -1
- package/dist/src/components/common/button/ExportButton.js +5 -5
- package/dist/src/components/common/button/HideButtonTable.cjs +1 -1
- package/dist/src/components/common/button/HideButtonTable.js +7 -7
- package/dist/src/components/common/button/ImportButton.cjs +1 -1
- package/dist/src/components/common/button/ImportButton.js +5 -5
- package/dist/src/components/common/button/NewButton.cjs +1 -1
- package/dist/src/components/common/button/NewButton.js +5 -5
- package/dist/src/components/common/button/PrintButton.cjs +1 -1
- package/dist/src/components/common/button/PrintButton.js +5 -5
- package/dist/src/components/common/button/RefreshButton.cjs +1 -1
- package/dist/src/components/common/button/RefreshButton.js +5 -5
- package/dist/src/components/common/button/UnHideButton.cjs +1 -1
- package/dist/src/components/common/button/UnHideButton.js +7 -7
- package/dist/src/components/common/button/UpdateButtonTable.cjs +1 -1
- package/dist/src/components/common/button/UpdateButtonTable.js +5 -5
- package/dist/src/components/common/button/ViewButtonTable.cjs +1 -1
- package/dist/src/components/common/button/ViewButtonTable.js +5 -5
- package/dist/src/components/common/check-box/CheckBox.cjs +1 -1
- package/dist/src/components/common/check-box/CheckBox.js +15 -17
- package/dist/src/components/common/description/DescList.cjs +1 -1
- package/dist/src/components/common/description/DescList.js +1 -1
- package/dist/src/components/common/layout/VerticalSpace.cjs +1 -1
- package/dist/src/components/common/layout/VerticalSpace.js +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.cjs +1 -1
- package/dist/src/components/common/loading/LoadingIndicator.js +8 -9
- package/dist/src/components/common/picker/ImagePicker.cjs +1 -1
- package/dist/src/components/common/picker/ImagePicker.js +40 -42
- package/dist/src/components/common/radio/RadioGroupComponent.cjs +1 -1
- package/dist/src/components/common/radio/RadioGroupComponent.js +16 -17
- package/dist/src/components/common/report/SelectFieldInReport.cjs +1 -1
- package/dist/src/components/common/report/SelectFieldInReport.js +16 -17
- package/dist/src/components/common/select/CustomSelectOption.cjs +1 -1
- package/dist/src/components/common/select/CustomSelectOption.js +1 -1
- package/dist/src/components/common/select/SelectComponent.cjs +1 -1
- package/dist/src/components/common/select/SelectComponent.js +33 -36
- package/dist/src/components/common/show-more/index.cjs +1 -1
- package/dist/src/components/common/tab/TabViewWithRoute.cjs +1 -1
- package/dist/src/components/common/tab/TabViewWithRoute.js +14 -15
- package/dist/src/components/common/table/table.cjs +1 -1
- package/dist/src/components/common/table/table.js +16 -16
- package/dist/src/components/common/tag/StatusTag.cjs +1 -1
- package/dist/src/components/common/tag/StatusTag.js +4 -4
- package/dist/src/components/common/text/index.cjs +1 -1
- package/dist/src/components/common/text/index.js +1 -1
- package/dist/src/components/common/text/title/index.cjs +1 -1
- package/dist/src/components/common/text/title/index.js +1 -1
- package/dist/src/components/common/text-field/NumberField.cjs +1 -1
- package/dist/src/components/common/text-field/NumberField.js +19 -20
- package/dist/src/components/common/text-field/PhoneNumberField.cjs +1 -1
- package/dist/src/components/common/text-field/TextArea.cjs +1 -1
- package/dist/src/components/common/text-field/TextArea.js +18 -19
- package/dist/src/components/common/text-field/TextField.cjs +1 -1
- package/dist/src/components/common/text-field/TextField.js +21 -22
- package/dist/src/components/common/tooltip/TooltipComponent.cjs +1 -1
- package/dist/src/components/common/tooltip/TooltipComponent.js +1 -1
- package/dist/src/components/common/wizard/WizardResult.cjs +1 -1
- package/dist/src/components/common/wizard/WizardResult.js +5 -5
- package/dist/src/components/common/wizard/WizardViewForm.cjs +1 -1
- package/dist/src/components/common/wizard/WizardViewForm.js +1 -1
- package/dist/src/components/crud/CrudComponent.cjs +1 -1
- package/dist/src/components/crud/CrudComponent.js +71 -74
- package/dist/src/components/crud/CrudField.cjs +1 -1
- package/dist/src/components/crud/CrudField.js +93 -96
- package/dist/src/components/crud/CrudForm.cjs +1 -1
- package/dist/src/components/crud/CrudForm.js +27 -30
- package/dist/src/components/crud/CrudFormWizard.cjs +1 -1
- package/dist/src/components/crud/CrudFormWizard.js +54 -57
- package/dist/src/components/crud/CrudReportComponent.cjs +3 -3
- package/dist/src/components/crud/CrudReportComponent.js +47 -51
- package/dist/src/components/crud/CrudSearchComponent.cjs +1 -1
- package/dist/src/components/crud/CrudSearchComponent.js +21 -23
- package/dist/src/components/crud/FileCrudField.cjs +1 -1
- package/dist/src/components/crud/FileCrudField.js +29 -31
- package/dist/src/components/crud/ImageCrudField.cjs +1 -1
- package/dist/src/components/crud/ImageCrudField.js +43 -46
- package/dist/src/components/crud/import/CrudImportButton.cjs +1 -1
- package/dist/src/components/crud/import/CrudImportButton.js +7 -7
- package/dist/src/components/crud/import/CrudImportComponent.cjs +2 -2
- package/dist/src/components/crud/import/CrudImportComponent.js +60 -64
- package/dist/src/components/crud/view/CrudDecListView.cjs +1 -1
- package/dist/src/components/crud/view/CrudDecListView.js +5 -5
- package/dist/src/components/crud/view/CrudViewer.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewer.js +25 -25
- package/dist/src/components/crud/view/CrudViewerUtil.cjs +1 -1
- package/dist/src/components/crud/view/CrudViewerUtil.js +17 -18
- package/dist/src/context/WindowDimension.cjs +1 -1
- package/dist/src/locale/index.cjs +1 -1
- package/dist/src/locale/index.js +2 -2
- package/dist/src/locale/translations/en.cjs +1 -1
- package/dist/src/util/DateUtil.cjs +1 -1
- package/dist/src/util/DateUtil.js +4 -4
- package/dist/src/util/ImageUtil.cjs +1 -1
- package/dist/src/util/ValidationUtil.cjs +1 -1
- package/dist/src/util/ValidationUtil.js +1 -1
- package/dist/util/index.cjs +1 -1
- package/package.json +9 -7
- package/dist/_virtual/index11.cjs +0 -1
- package/dist/_virtual/index11.js +0 -7
- package/dist/_virtual/index12.cjs +0 -1
- package/dist/_virtual/index12.js +0 -4
- package/dist/_virtual/index13.cjs +0 -1
- package/dist/_virtual/index13.js +0 -4
- package/dist/_virtual/react-is.development2.cjs +0 -1
- package/dist/_virtual/react-is.development2.js +0 -4
- package/dist/_virtual/react-is.production.min2.cjs +0 -1
- package/dist/_virtual/react-is.production.min2.js +0 -4
- package/dist/common/index.d.ts +0 -2
|
@@ -1,28 +1,24 @@
|
|
|
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
|
-
|
|
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({
|
|
3
|
+
import { Tooltip as S, Modal as q, Space as B, Spin as _, Progress as $ } from "antd";
|
|
4
|
+
import { F as z } from "../../../../_virtual/FileSaver.min.js";
|
|
5
|
+
import { useState as w, useEffect as W, useMemo as v, useCallback as m } from "react";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as U } from "../../../locale/hooks/translation-constants.js";
|
|
7
|
+
import G from "../view/CrudViewer.js";
|
|
8
|
+
import H from "../../../util/DateUtil.js";
|
|
9
|
+
import J from "../../common/button/Button.js";
|
|
10
|
+
import { ImportButton as K } from "../../common/button/ImportButton.js";
|
|
11
|
+
import { useTranslation as Q } from "../../../../node_modules/react-i18next/dist/es/useTranslation.js";
|
|
12
|
+
import R from "../../../../node_modules/@ant-design/icons/es/icons/WarningTwoTone.js";
|
|
13
|
+
import X from "../../../../node_modules/@ant-design/icons/es/icons/DownloadOutlined.js";
|
|
14
|
+
function de({
|
|
19
15
|
onCloseMethod: h,
|
|
20
16
|
open: y,
|
|
21
17
|
fields: A,
|
|
22
|
-
importProps:
|
|
18
|
+
importProps: o
|
|
23
19
|
}) {
|
|
24
20
|
const [c, N] = w([]), [j, b] = w(!1), [T, E] = w(0);
|
|
25
|
-
|
|
21
|
+
W(() => {
|
|
26
22
|
y || (N([]), b(!1));
|
|
27
23
|
}, [y]);
|
|
28
24
|
const u = v(
|
|
@@ -42,32 +38,32 @@ function pe({
|
|
|
42
38
|
];
|
|
43
39
|
}),
|
|
44
40
|
[u]
|
|
45
|
-
), V =
|
|
41
|
+
), V = m(
|
|
46
42
|
async function() {
|
|
47
43
|
const e = `${F.join(",")}
|
|
48
44
|
`, r = new Blob([e], { type: "text/csv;charset=utf-8;" });
|
|
49
|
-
|
|
45
|
+
z.saveAs(
|
|
50
46
|
r,
|
|
51
|
-
(
|
|
47
|
+
(o == null ? void 0 : o.name) + " - " + H.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
|
|
52
48
|
);
|
|
53
49
|
},
|
|
54
|
-
[F,
|
|
55
|
-
), { t: i } =
|
|
50
|
+
[F, o == null ? void 0 : o.name]
|
|
51
|
+
), { t: i } = Q(U), M = m(async (e) => {
|
|
56
52
|
const r = new FileReader();
|
|
57
|
-
r.onerror = console.error, r.onload = async (
|
|
58
|
-
var
|
|
59
|
-
const l = (
|
|
53
|
+
r.onerror = console.error, r.onload = async (n) => {
|
|
54
|
+
var s;
|
|
55
|
+
const l = (s = n == null ? void 0 : n.target) == null ? void 0 : s.result, a = L.parse(l, { header: !0 });
|
|
60
56
|
N(a.data);
|
|
61
57
|
}, r.readAsText(e);
|
|
62
58
|
}, []), C = v(() => {
|
|
63
|
-
var r,
|
|
59
|
+
var r, n, l;
|
|
64
60
|
let e = !1;
|
|
65
61
|
for (const a of c)
|
|
66
|
-
for (const [
|
|
67
|
-
const x = a[
|
|
68
|
-
if (
|
|
69
|
-
if ((
|
|
70
|
-
for (const g of ((l =
|
|
62
|
+
for (const [s, d] of u.entries()) {
|
|
63
|
+
const x = a[s], f = x || !isNaN(x);
|
|
64
|
+
if (d.required && !f)
|
|
65
|
+
if ((n = (r = d.importProps) == null ? void 0 : r.extraFields) != null && n.length)
|
|
66
|
+
for (const g of ((l = d.importProps) == null ? void 0 : l.extraFields) ?? [])
|
|
71
67
|
if (a[g] || !isNaN(a[g])) {
|
|
72
68
|
e = !1;
|
|
73
69
|
break;
|
|
@@ -75,34 +71,34 @@ function pe({
|
|
|
75
71
|
else return !0;
|
|
76
72
|
}
|
|
77
73
|
return e;
|
|
78
|
-
}, [c, u]), p =
|
|
79
|
-
(e) => (r,
|
|
80
|
-
var a,
|
|
74
|
+
}, [c, u]), p = m(
|
|
75
|
+
(e) => (r, n) => {
|
|
76
|
+
var a, s, d;
|
|
81
77
|
const l = r || !isNaN(r);
|
|
82
78
|
if (e.required && !l) {
|
|
83
79
|
let x = i("err.validation.required");
|
|
84
|
-
if ((
|
|
85
|
-
const f = (
|
|
86
|
-
(f == null ? void 0 : f.find((D) => !
|
|
80
|
+
if ((s = (a = e.importProps) == null ? void 0 : a.extraFields) != null && s.length) {
|
|
81
|
+
const f = (d = e.importProps) == null ? void 0 : d.extraFields;
|
|
82
|
+
(f == null ? void 0 : f.find((D) => !n[D])) && (x = "Either one of these fields is required: " + [e.name, ...f].join(", "));
|
|
87
83
|
}
|
|
88
84
|
return /* @__PURE__ */ t.jsxs(S, { className: "d-flex", title: x, children: [
|
|
89
|
-
/* @__PURE__ */ t.jsx(
|
|
85
|
+
/* @__PURE__ */ t.jsx(R, { twoToneColor: "#ee9702" }),
|
|
90
86
|
r
|
|
91
87
|
] });
|
|
92
88
|
}
|
|
93
89
|
return r;
|
|
94
90
|
},
|
|
95
91
|
[i]
|
|
96
|
-
), I =
|
|
92
|
+
), I = m(async (e) => {
|
|
97
93
|
E(e);
|
|
98
|
-
}, []), k =
|
|
94
|
+
}, []), k = m(async () => {
|
|
99
95
|
try {
|
|
100
|
-
b(!0), await
|
|
96
|
+
b(!0), await o.onClickImport(c, I), h(!1);
|
|
101
97
|
} finally {
|
|
102
98
|
b(!1), E(0);
|
|
103
99
|
}
|
|
104
|
-
}, [c,
|
|
105
|
-
C ?
|
|
100
|
+
}, [c, o, h, I]), O = m(async () => {
|
|
101
|
+
C ? q.warn({
|
|
106
102
|
title: i("str.warning"),
|
|
107
103
|
content: i("qus.importWithIssues"),
|
|
108
104
|
okText: i("str.import"),
|
|
@@ -112,9 +108,9 @@ function pe({
|
|
|
112
108
|
}) : k();
|
|
113
109
|
}, [C, k, i]);
|
|
114
110
|
return /* @__PURE__ */ t.jsxs(
|
|
115
|
-
|
|
111
|
+
q,
|
|
116
112
|
{
|
|
117
|
-
title: [i("str.import"),
|
|
113
|
+
title: [i("str.import"), o == null ? void 0 : o.name].filter(Boolean).join(" "),
|
|
118
114
|
width: "100%",
|
|
119
115
|
open: y,
|
|
120
116
|
onOk: O,
|
|
@@ -125,30 +121,30 @@ function pe({
|
|
|
125
121
|
okButtonProps: {
|
|
126
122
|
disabled: !(c != null && c.length)
|
|
127
123
|
},
|
|
128
|
-
footer: (e, { OkBtn: r, CancelBtn:
|
|
129
|
-
/* @__PURE__ */ t.jsx(
|
|
124
|
+
footer: (e, { OkBtn: r, CancelBtn: n }) => /* @__PURE__ */ t.jsxs(B, { children: [
|
|
125
|
+
/* @__PURE__ */ t.jsx(n, {}),
|
|
130
126
|
/* @__PURE__ */ t.jsx(r, {}),
|
|
131
127
|
C && /* @__PURE__ */ t.jsx(
|
|
132
128
|
S,
|
|
133
129
|
{
|
|
134
130
|
className: "d-flex",
|
|
135
131
|
title: "Some fields have issue. Please review before submit.",
|
|
136
|
-
children: /* @__PURE__ */ t.jsx(
|
|
132
|
+
children: /* @__PURE__ */ t.jsx(R, { twoToneColor: "#ee9702" })
|
|
137
133
|
}
|
|
138
134
|
)
|
|
139
135
|
] }),
|
|
140
136
|
children: [
|
|
141
|
-
/* @__PURE__ */ t.jsxs(
|
|
137
|
+
/* @__PURE__ */ t.jsxs(B, { children: [
|
|
142
138
|
/* @__PURE__ */ t.jsx(
|
|
143
|
-
|
|
139
|
+
J,
|
|
144
140
|
{
|
|
145
141
|
onClick: V,
|
|
146
|
-
icon: /* @__PURE__ */ t.jsx(
|
|
142
|
+
icon: /* @__PURE__ */ t.jsx(X, {}),
|
|
147
143
|
children: i("str.downloadCsvTemplate")
|
|
148
144
|
}
|
|
149
145
|
),
|
|
150
146
|
/* @__PURE__ */ t.jsx(
|
|
151
|
-
|
|
147
|
+
K,
|
|
152
148
|
{
|
|
153
149
|
disabled: j,
|
|
154
150
|
type: "default",
|
|
@@ -159,11 +155,11 @@ function pe({
|
|
|
159
155
|
)
|
|
160
156
|
] }),
|
|
161
157
|
/* @__PURE__ */ t.jsx(
|
|
162
|
-
|
|
158
|
+
_,
|
|
163
159
|
{
|
|
164
160
|
spinning: j,
|
|
165
161
|
indicator: T ? /* @__PURE__ */ t.jsx(
|
|
166
|
-
|
|
162
|
+
$,
|
|
167
163
|
{
|
|
168
164
|
type: "circle",
|
|
169
165
|
percent: T * 100,
|
|
@@ -172,23 +168,23 @@ function pe({
|
|
|
172
168
|
}
|
|
173
169
|
) : void 0,
|
|
174
170
|
children: /* @__PURE__ */ t.jsx(
|
|
175
|
-
|
|
171
|
+
G,
|
|
176
172
|
{
|
|
177
173
|
data: c,
|
|
178
174
|
bordered: !0,
|
|
179
175
|
size: "small",
|
|
180
176
|
fields: Array.from(u.values()).flatMap((e) => {
|
|
181
|
-
var r,
|
|
177
|
+
var r, n, l, a;
|
|
182
178
|
return e.type === "text" ? [
|
|
183
179
|
{
|
|
184
180
|
...e,
|
|
185
181
|
label: e.name,
|
|
186
182
|
render: p(e)
|
|
187
183
|
},
|
|
188
|
-
...((
|
|
184
|
+
...((n = (r = e.importProps) == null ? void 0 : r.extraFields) == null ? void 0 : n.map((s) => ({
|
|
189
185
|
...e,
|
|
190
|
-
name:
|
|
191
|
-
label:
|
|
186
|
+
name: s,
|
|
187
|
+
label: s,
|
|
192
188
|
render: p(e)
|
|
193
189
|
}))) ?? []
|
|
194
190
|
] : e.type === "select" ? [
|
|
@@ -198,10 +194,10 @@ function pe({
|
|
|
198
194
|
type: "text",
|
|
199
195
|
render: p(e)
|
|
200
196
|
},
|
|
201
|
-
...((a = (l = e.importProps) == null ? void 0 : l.extraFields) == null ? void 0 : a.map((
|
|
197
|
+
...((a = (l = e.importProps) == null ? void 0 : l.extraFields) == null ? void 0 : a.map((s) => ({
|
|
202
198
|
...e,
|
|
203
|
-
name:
|
|
204
|
-
label:
|
|
199
|
+
name: s,
|
|
200
|
+
label: s,
|
|
205
201
|
type: "text",
|
|
206
202
|
render: p(e)
|
|
207
203
|
}))) ?? []
|
|
@@ -222,5 +218,5 @@ function pe({
|
|
|
222
218
|
);
|
|
223
219
|
}
|
|
224
220
|
export {
|
|
225
|
-
|
|
221
|
+
de as default
|
|
226
222
|
};
|
|
@@ -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"),
|
|
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"),q=require("../../../../node_modules/react-i18next/dist/es/useTranslation.cjs");function C({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}=q.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,{keepEmptyValues:x,bordered:!0,column:c,className:l,layout:m,list:j}):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{})}exports.CrudDecListView=C;
|
|
@@ -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 { TRANSLATION_NAMESPACE as g } from "../../../locale/hooks/translation-constants.js";
|
|
5
|
+
import { getRendererValueCrudViewer as j } from "./CrudViewerUtil.js";
|
|
6
|
+
import { useTranslation as A } from "../../../../node_modules/react-i18next/dist/es/useTranslation.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 } = g
|
|
16
|
+
const { t: i } = A(g), 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: j(e)(
|
|
21
21
|
r == null ? void 0 : r[e.name],
|
|
22
22
|
r,
|
|
23
23
|
t
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const t=require("../../../../_virtual/jsx-runtime.cjs"),P=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"),st=require("../../common/button/UpdateButtonTable.cjs"),rt=require("../../common/button/ViewButtonTable.cjs"),et=require("../../common/layout/VerticalSpace.cjs"),ut=require("../../common/table/table.cjs"),i=require("react"),nt=require("../../../locale/hooks/translation-constants.cjs"),ot=require("../CrudSearchComponent.cjs"),xt=require("./CrudDecListView.cjs"),N=require("./CrudViewerUtil.cjs"),ct=require("../../../../node_modules/react-i18next/dist/es/useTranslation.cjs");function jt({idField:e="id",loadingData:O,fields:c,isDeleting:p,isHiding:v,viewable:o=!1,paginateProps:m,onDelete:l,onHide:B,onUpdate:a,data:E=[],extraAction:R,onClickUpdate:x,minusHeight:g,scroll:z,onClickClone:h,className:_,expandable:$,size:w,bordered:A,descListColumn:G,extraView:T,decListLayout:J,scrollToTop:it,onClickRefresh:b,closeViewOnClickUpdate:C,onExport:f,confirmHiding:I,confirmDeleting:V,rowClassName:K,actionWidth:Q=190,...W}){const{t:X}=ct.useTranslation(nt.TRANSLATION_NAMESPACE),M=i.useMemo(()=>c.map(({hideInTable:s,hidden:r,width:j,name:n,label:Z,halign:D,...L})=>({title:Z,width:j,key:n,dataIndex:n,hidden:s||r,align:D??(L.type==="number"?"right":void 0),render:N.getRendererValueCrudViewer(L)})),[c]),[u,q]=i.useState(),[y,S]=i.useState();i.useEffect(()=>{E&&q(s=>{if(s)return E.find(r=>r[e]===s[e])})},[E,e,u]);const d=i.useCallback(s=>{var j;const r=R==null?void 0:R(s);return(Array.isArray(r)?(j=r==null?void 0:r.filter(Boolean))!=null&&j.length:r)||a||x||h||l?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r,(a||x)&&t.jsxRuntimeExports.jsx(st,{value:s,onClick:n=>{S(n[e]),x==null||x(s),C&&q(void 0)}}),h&&t.jsxRuntimeExports.jsx(k,{value:s,onClick:n=>h(n)}),f&&t.jsxRuntimeExports.jsx(U.ExportButton,{value:s,onClick:async n=>await f(n)}),B&&t.jsxRuntimeExports.jsx(F,{value:s,disabled:v,shouldConfirm:I,loading:v&&s[e]===y,onClick:async n=>{S(n[e]),await B({[e]:n[e]})}}),l&&t.jsxRuntimeExports.jsx(H,{value:s,disabled:p,shouldConfirm:V,loading:p&&s[e]===y,onClick:async n=>{S(n[e]),await l({[e]:n[e]})}})]}):void 0},[C,V,I,R,e,p,v,h,x,l,f,B,a,y]),Y=i.useMemo(()=>{let s=typeof o=="string"?u==null?void 0:u[o]:void 0;if(typeof s=="object"){const r=c.find(j=>j.name===o);s=N.getRendererValueCrudViewer(r)(s,u,0)}return s},[o,u,c]);return t.jsxRuntimeExports.jsxs("div",{children:[o&&t.jsxRuntimeExports.jsx(P.Modal,{width:"100%",open:!!u,title:Y??t.jsxRuntimeExports.jsx("div",{children:" "}),footer:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),closable:!0,onCancel:()=>q(void 0),children:!!u&&t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(xt.CrudDecListView,{layout:J,descListColumn:G,data:u,fields:c,action:d(u)}),T==null?void 0:T(u)]},u==null?void 0:u[e])}),t.jsxRuntimeExports.jsx(ot,{fields:c,...W}),t.jsxRuntimeExports.jsxs(et,{children:[!!b&&t.jsxRuntimeExports.jsx(tt.RefreshButton,{onClick:b}),t.jsxRuntimeExports.jsx(ut,{rowClassName:K,className:_,scroll:z??(g?{y:`calc(100vh - ${g})`}:void 0),id:"crud-table",dataSource:E,loading:O,bordered:A,size:w,expandable:$,pagination:m?{total:m.count,onChange:m.setPage,current:m.page,pageSize:m.pageSize}:void 0,columns:a||x||l||R||o?[...M,{title:X("str.action"),dataIndex:"",fixed:"right",width:Q,render:(s,r)=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[o&&t.jsxRuntimeExports.jsx(rt,{value:r,onClick:q}),d(r)]})}]:M})]})]})}module.exports=jt;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { j as r } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import k from "
|
|
3
|
-
import H from "../../common/button/
|
|
4
|
-
import
|
|
5
|
-
import F from "../../common/button/
|
|
6
|
-
import
|
|
7
|
-
import or from "../../common/button/
|
|
8
|
-
import tr from "../../common/button/
|
|
9
|
-
import sr from "../../common/
|
|
10
|
-
import mr from "../../common/
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
2
|
+
import { Modal as k } from "antd";
|
|
3
|
+
import H from "../../common/button/CloneButtonTable.js";
|
|
4
|
+
import U from "../../common/button/DeleteButtonTable.js";
|
|
5
|
+
import { ExportButton as F } from "../../common/button/ExportButton.js";
|
|
6
|
+
import rr from "../../common/button/HideButtonTable.js";
|
|
7
|
+
import { RefreshButton as or } from "../../common/button/RefreshButton.js";
|
|
8
|
+
import tr from "../../common/button/UpdateButtonTable.js";
|
|
9
|
+
import sr from "../../common/button/ViewButtonTable.js";
|
|
10
|
+
import mr from "../../common/layout/VerticalSpace.js";
|
|
11
|
+
import ur from "../../common/table/table.js";
|
|
12
|
+
import { useMemo as L, useState as _, useEffect as nr, useCallback as er } from "react";
|
|
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 jr from "../../../../node_modules/
|
|
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 } = jr(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
|
+
nr(() => {
|
|
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 = er(
|
|
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
|
+
tr,
|
|
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(H, { value: o, onClick: (u) => T(u) }),
|
|
88
88
|
S && /* @__PURE__ */ r.jsx(
|
|
89
|
-
|
|
89
|
+
F,
|
|
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
|
+
rr,
|
|
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
|
+
U,
|
|
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
|
+
k,
|
|
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(mr, { children: [
|
|
176
|
+
!!C && /* @__PURE__ */ r.jsx(or, { onClick: C }),
|
|
177
177
|
/* @__PURE__ */ r.jsx(
|
|
178
|
-
|
|
178
|
+
ur,
|
|
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(sr, { 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 l=require("../../../../_virtual/jsx-runtime.cjs"),m=require("antd"),x=require("../../common/show-more/index.cjs"),j=require("../FileCrudField.cjs"),v=require("../ImageCrudField.cjs"),y=require("../../../locale/hooks/translation-constants.cjs"),C=require("../../../../node_modules/i18next/dist/esm/i18next.cjs"),r=require("../../../util/DateUtil.cjs"),s=require("../../../util/NumberUtil.cjs"),g=require("../../../../node_modules/@ant-design/icons/es/icons/CheckOutlined.cjs"),d=require("../../../../node_modules/@ant-design/icons/es/icons/CloseOutlined.cjs");function q({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 c=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(!c&&typeof t=="string"||typeof t=="number")&&(c=t),typeof i=="function"?i(c,u,e):Array.isArray(c)?c.join(", "):c}:a==="number"?(t,u,e)=>typeof i=="function"?i(t,u,e):n!=null&&n.int?s.default.toInt(t,n.formatted):s.default.toMoney(t):a==="enum"?(t,u,e)=>{var c;const o=C.t(((c=n==null?void 0:n.translation)==null?void 0:c[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.formatDateTime(t):r.formatDate(t);return typeof i=="function"?i(t,u,e):o}:a==="checkbox"?(t,u,e)=>typeof i=="function"?i(t,u,e):t?l.jsxRuntimeExports.jsx(g,{}):l.jsxRuntimeExports.jsx(d,{}):a==="image"?(t,u,e)=>typeof i=="function"?i(t,u,e):l.jsxRuntimeExports.jsx(v.ImageCrudCellValue,{value:t,provider:n.provider}):a==="file"?(t,u,e)=>typeof i=="function"?i(t,u,e):l.jsxRuntimeExports.jsx(j.FileCrudCellValue,{value:t,provider:n.provider}):a==="time"?(t,u,e)=>{if(!t)return"-";const o=n==null?void 0:n.format,c=n==null?void 0:n.use12Hours,f=r.formatTime(t,o||(c?"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("#")?l.jsxRuntimeExports.jsx(m.Tooltip,{title:t,children:l.jsxRuntimeExports.jsx(m.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?l.jsxRuntimeExports.jsx(x.ShowMore,{lines:o===!0?1:o,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=q;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { j as c } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { Tooltip as x, Avatar as j } from "antd";
|
|
3
|
+
import { ShowMore as y } from "../../common/show-more/index.js";
|
|
4
|
+
import { FileCrudCellValue as A } from "../FileCrudField.js";
|
|
5
|
+
import { ImageCrudCellValue as b } from "../ImageCrudField.js";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as e } from "../../../locale/hooks/translation-constants.js";
|
|
7
|
+
import { t as g } from "../../../../node_modules/i18next/dist/esm/i18next.js";
|
|
7
8
|
import r from "../../../util/DateUtil.js";
|
|
8
9
|
import v from "../../../util/NumberUtil.js";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import C from "../../../../node_modules/antd/es/avatar/index.js";
|
|
13
|
-
function k({
|
|
10
|
+
import h from "../../../../node_modules/@ant-design/icons/es/icons/CheckOutlined.js";
|
|
11
|
+
import C from "../../../../node_modules/@ant-design/icons/es/icons/CloseOutlined.js";
|
|
12
|
+
function M({
|
|
14
13
|
type: u,
|
|
15
14
|
render: i,
|
|
16
15
|
...o
|
|
@@ -21,23 +20,23 @@ function k({
|
|
|
21
20
|
return (!a && typeof t == "string" || typeof t == "number") && (a = t), typeof i == "function" ? i(a, f, n) : Array.isArray(a) ? a.join(", ") : a;
|
|
22
21
|
} : 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) => {
|
|
23
22
|
var a;
|
|
24
|
-
const m =
|
|
23
|
+
const m = g(
|
|
25
24
|
((a = o == null ? void 0 : o.translation) == null ? void 0 : a[t ?? ""]) ?? t,
|
|
26
|
-
{ ns:
|
|
25
|
+
{ ns: e }
|
|
27
26
|
);
|
|
28
27
|
return typeof i == "function" ? i(t, f, n) : m;
|
|
29
28
|
} : u === "date" ? (t, f, n) => {
|
|
30
29
|
if (!t) return "-";
|
|
31
30
|
const m = o != null && o.formatTime ? r.formatDateTime(t) : r.formatDate(t);
|
|
32
31
|
return typeof i == "function" ? i(t, f, n) : m;
|
|
33
|
-
} : u === "checkbox" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : t ? /* @__PURE__ */ c.jsx(
|
|
34
|
-
|
|
32
|
+
} : u === "checkbox" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : t ? /* @__PURE__ */ c.jsx(h, {}) : /* @__PURE__ */ c.jsx(C, {}) : u === "image" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : /* @__PURE__ */ c.jsx(
|
|
33
|
+
b,
|
|
35
34
|
{
|
|
36
35
|
value: t,
|
|
37
36
|
provider: o.provider
|
|
38
37
|
}
|
|
39
38
|
) : u === "file" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : /* @__PURE__ */ c.jsx(
|
|
40
|
-
|
|
39
|
+
A,
|
|
41
40
|
{
|
|
42
41
|
value: t,
|
|
43
42
|
provider: o.provider
|
|
@@ -49,11 +48,11 @@ function k({
|
|
|
49
48
|
m || (a ? "hh:mm:ss A" : void 0)
|
|
50
49
|
);
|
|
51
50
|
return typeof i == "function" ? i(t, f, n) : l;
|
|
52
|
-
} : u === "color" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ c.jsx(
|
|
51
|
+
} : u === "color" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ c.jsx(x, { title: t, children: /* @__PURE__ */ c.jsx(j, { style: { backgroundColor: t } }) }) : String(t) : u === "textarea" ? (t, f, n) => {
|
|
53
52
|
const m = (o == null ? void 0 : o.truncated) ?? 1;
|
|
54
|
-
return typeof i == "function" ? i(t, f, n) : m ? /* @__PURE__ */ c.jsx(
|
|
53
|
+
return typeof i == "function" ? i(t, f, n) : m ? /* @__PURE__ */ c.jsx(y, { lines: m === !0 ? 1 : m, children: t }) : t;
|
|
55
54
|
} : typeof i == "function" ? i : (t) => t;
|
|
56
55
|
}
|
|
57
56
|
export {
|
|
58
|
-
|
|
57
|
+
M as getRendererValueCrudViewer
|
|
59
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const e=require("../../node_modules/react-responsive/dist/esm/index.cjs");function n(){const i=e.useMediaQuery({minWidth:768}),s=e.useMediaQuery({maxWidth:767});return{isDesktop:i,isMobile:s}}module.exports=n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./hooks/translation-constants.cjs"),u=require("./translations/en.cjs"),n=require("../../node_modules/i18next/dist/esm/i18next.cjs"),o=require("../../node_modules/react-i18next/dist/es/initReactI18next.cjs"),s={en:{[a.TRANSLATION_NAMESPACE]:u}},i=(e={})=>{const{translations:t=s,language:r="en"}=e;return n.default.use(o.initReactI18next).init({resources:t,lng:r,fallbackLng:"en",ns:a.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),n.default},l=(e,t)=>{n.default.addResourceBundle(e,a.TRANSLATION_NAMESPACE,t,!0,!0)};exports.defaultTranslations=s;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 "i18next";
|
|
4
|
-
import { initReactI18next as s } from "react-i18next";
|
|
3
|
+
import t from "../../node_modules/i18next/dist/esm/i18next.js";
|
|
4
|
+
import { initReactI18next as s } from "../../node_modules/react-i18next/dist/es/initReactI18next.js";
|
|
5
5
|
const i = {
|
|
6
6
|
en: {
|
|
7
7
|
[o]: a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
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?"}};module.exports=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const e=require("../../_virtual/dayjs.min.cjs"),a=require("../../node_modules/i18next/dist/esm/i18next.cjs"),o=t=>e(t).locale(a.default.language).format("YYYY-MM-DD HH:mm"),m=t=>e(t).locale(a.default.language).format("YYYY-MM-DD HH:mm:ss"),n=t=>e(t).locale(a.default.language).format("YYYY-MM-DD"),l=(t,r="HH:mm:ss")=>e(t).locale(a.default.language).format(r),s={formatDateTime:o,formatDate:n,formatDateTimeWithSecond:m,formatTime:l};module.exports=s;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import e from "i18next";
|
|
3
|
-
const m = (
|
|
1
|
+
import t from "../../_virtual/dayjs.min.js";
|
|
2
|
+
import e from "../../node_modules/i18next/dist/esm/i18next.js";
|
|
3
|
+
const m = (a) => t(a).locale(e.language).format("YYYY-MM-DD HH:mm"), r = (a) => t(a).locale(e.language).format("YYYY-MM-DD HH:mm:ss"), n = (a) => t(a).locale(e.language).format("YYYY-MM-DD"), l = (a, o = "HH:mm:ss") => t(a).locale(e.language).format(o), c = { formatDateTime: m, formatDate: n, formatDateTimeWithSecond: r, formatTime: l };
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
c as default
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const c=require("../../node_modules/browser-image-compression/dist/browser-image-compression.cjs");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 r=await new Promise(n=>{a.onload=function(){n({height:a.height,width:a.width})}});return Object.assign(e,r),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((r,n)=>{const s=new FileReader;s.onloadend=function(){const o=s.result,i=o.match(/^data:image\/(png|jpeg|jpg);base64,/);i?r({data:o,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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const i=require("../../node_modules/i18next/dist/esm/i18next.cjs"),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;
|
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
|
|
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;
|