@kingteza/crud-component 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/common/DatePicker/DatePicker.cjs +1 -0
- package/dist/components/common/DatePicker/DatePicker.js +88 -0
- package/dist/components/common/DatePicker/TimePicker.cjs +1 -0
- package/dist/components/common/DatePicker/TimePicker.js +78 -0
- package/dist/components/common/appearance/Hider.cjs +1 -0
- package/dist/components/common/appearance/Hider.js +5 -0
- package/dist/components/common/button/Button.cjs +1 -0
- package/dist/components/common/button/Button.js +64 -0
- package/dist/components/common/button/CloneButtonTable.cjs +1 -0
- package/dist/components/common/button/CloneButtonTable.js +20 -0
- package/dist/components/common/button/DeleteButtonTable.cjs +1 -0
- package/dist/components/common/button/DeleteButtonTable.js +68 -0
- package/dist/components/common/button/ExportButton.cjs +1 -0
- package/dist/components/common/button/ExportButton.js +27 -0
- package/dist/components/common/button/HideButtonTable.cjs +1 -0
- package/dist/components/common/button/HideButtonTable.js +68 -0
- package/dist/components/common/button/ImportButton.cjs +1 -0
- package/dist/components/common/button/ImportButton.js +56 -0
- package/dist/components/common/button/NewButton.cjs +1 -0
- package/dist/components/common/button/NewButton.js +24 -0
- package/dist/components/common/button/PrintButton.cjs +1 -0
- package/dist/components/common/button/PrintButton.js +26 -0
- package/dist/components/common/button/RefreshButton.cjs +1 -0
- package/dist/components/common/button/RefreshButton.js +24 -0
- package/dist/components/common/button/UnHideButton.cjs +1 -0
- package/dist/components/common/button/UnHideButton.js +70 -0
- package/dist/components/common/button/UpdateButtonTable.cjs +1 -0
- package/dist/components/common/button/UpdateButtonTable.js +20 -0
- package/dist/components/common/button/ViewButtonTable.cjs +1 -0
- package/dist/components/common/button/ViewButtonTable.js +20 -0
- package/dist/components/common/check-box/CheckBox.cjs +1 -0
- package/dist/components/common/check-box/CheckBox.js +40 -0
- package/dist/components/common/description/DescList.cjs +1 -0
- package/dist/components/common/description/DescList.js +16 -0
- package/dist/components/common/layout/VerticalSpace.cjs +1 -0
- package/dist/components/common/layout/VerticalSpace.js +6 -0
- package/dist/components/common/loading/LoadingIndicator.cjs +1 -0
- package/dist/components/common/loading/LoadingIndicator.js +24 -0
- package/dist/components/common/picker/ImagePicker.cjs +1 -0
- package/dist/components/common/picker/ImagePicker.js +282 -0
- package/dist/components/common/radio/RadioGroupComponent.cjs +1 -0
- package/dist/components/common/radio/RadioGroupComponent.js +19 -0
- package/dist/components/common/report/SelectFieldInReport.cjs +1 -0
- package/dist/components/common/report/SelectFieldInReport.js +30 -0
- package/dist/components/common/select/CustomSelectOption.cjs +1 -0
- package/dist/components/common/select/CustomSelectOption.js +13 -0
- package/dist/components/common/select/SelectComponent.cjs +1 -0
- package/dist/components/common/select/SelectComponent.js +89 -0
- package/dist/components/common/show-more/index.cjs +1 -0
- package/dist/components/common/show-more/index.js +8 -0
- package/dist/components/common/tab/TabViewWithRoute.cjs +1 -0
- package/dist/components/common/tab/TabViewWithRoute.js +38 -0
- package/dist/components/common/table/table.cjs +1 -0
- package/dist/components/common/table/table.js +40 -0
- package/dist/components/common/tag/StatusTag.cjs +1 -0
- package/dist/components/common/tag/StatusTag.js +30 -0
- package/dist/components/common/text/index.cjs +1 -0
- package/dist/components/common/text/index.js +5 -0
- package/dist/components/common/text/title/index.cjs +1 -0
- package/dist/components/common/text/title/index.js +5 -0
- package/dist/components/common/text-field/NumberField.cjs +1 -0
- package/dist/components/common/text-field/NumberField.js +83 -0
- package/dist/components/common/text-field/PhoneNumberField.cjs +1 -0
- package/dist/components/common/text-field/PhoneNumberField.js +18 -0
- package/dist/components/common/text-field/TextArea.cjs +1 -0
- package/dist/components/common/text-field/TextArea.js +47 -0
- package/dist/components/common/text-field/TextField.cjs +1 -0
- package/dist/components/common/text-field/TextField.js +73 -0
- package/dist/components/common/tooltip/TooltipComponent.cjs +1 -0
- package/dist/components/common/tooltip/TooltipComponent.js +9 -0
- package/dist/components/common/wizard/WizardResult.cjs +1 -0
- package/dist/components/common/wizard/WizardResult.js +60 -0
- package/dist/components/common/wizard/WizardViewForm.cjs +1 -0
- package/dist/components/common/wizard/WizardViewForm.js +74 -0
- package/dist/components/crud/CrudComponent.cjs +1 -0
- package/dist/components/crud/CrudComponent.js +210 -0
- package/dist/components/crud/CrudField.cjs +1 -0
- package/dist/components/crud/CrudField.js +459 -0
- package/dist/components/crud/CrudForm.cjs +1 -0
- package/dist/components/crud/CrudForm.js +91 -0
- package/dist/components/crud/CrudFormWizard.cjs +1 -0
- package/dist/components/crud/CrudFormWizard.js +140 -0
- package/dist/components/crud/CrudReportComponent.cjs +4 -0
- package/dist/components/crud/CrudReportComponent.js +255 -0
- package/dist/components/crud/CrudSearchComponent.cjs +1 -0
- package/dist/components/crud/CrudSearchComponent.js +95 -0
- package/dist/components/crud/FileCrudField.cjs +1 -0
- package/dist/components/crud/FileCrudField.js +220 -0
- package/dist/components/crud/ImageCrudField.cjs +1 -0
- package/dist/components/crud/ImageCrudField.js +113 -0
- package/dist/components/crud/import/CrudImportButton.cjs +1 -0
- package/dist/components/crud/import/CrudImportButton.js +31 -0
- package/dist/components/crud/import/CrudImportComponent.cjs +2 -0
- package/dist/components/crud/import/CrudImportComponent.js +221 -0
- package/dist/components/crud/view/CrudDecListView.cjs +1 -0
- package/dist/components/crud/view/CrudDecListView.js +42 -0
- package/dist/components/crud/view/CrudViewer.cjs +1 -0
- package/dist/components/crud/view/CrudViewer.js +217 -0
- package/dist/components/crud/view/CrudViewerUtil.cjs +1 -0
- package/dist/components/crud/view/CrudViewerUtil.js +57 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +10 -10
- package/dist/locale/hooks/translation-constants.cjs +1 -0
- package/dist/locale/hooks/translation-constants.js +4 -0
- package/dist/locale/index.cjs +1 -0
- package/dist/locale/index.js +33 -0
- package/dist/locale/translations/en.cjs +1 -0
- package/dist/locale/translations/en.js +60 -0
- package/dist/util/DateUtil.cjs +1 -0
- package/dist/util/DateUtil.js +6 -0
- package/dist/util/ImageUtil.cjs +1 -0
- package/dist/util/ImageUtil.js +63 -0
- package/dist/util/NumberUtil.cjs +1 -0
- package/dist/util/NumberUtil.js +60 -0
- package/dist/util/ValidationUtil.cjs +1 -0
- package/dist/util/ValidationUtil.js +60 -0
- package/dist/util/index.cjs +1 -1
- package/dist/util/index.js +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { jsxs as v, Fragment as M, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Modal as U } from "antd";
|
|
3
|
+
import F from "../../common/button/CloneButtonTable.js";
|
|
4
|
+
import rr from "../../common/button/DeleteButtonTable.js";
|
|
5
|
+
import { ExportButton as or } from "../../common/button/ExportButton.js";
|
|
6
|
+
import tr from "../../common/button/HideButtonTable.js";
|
|
7
|
+
import { RefreshButton as mr } from "../../common/button/RefreshButton.js";
|
|
8
|
+
import ur from "../../common/button/UpdateButtonTable.js";
|
|
9
|
+
import nr from "../../common/button/ViewButtonTable.js";
|
|
10
|
+
import fr from "../../common/layout/VerticalSpace.js";
|
|
11
|
+
import cr from "../../common/table/table.js";
|
|
12
|
+
import { useMemo as $, useState as q, useEffect as er, useCallback as lr } from "react";
|
|
13
|
+
import { useTranslation as sr } from "react-i18next";
|
|
14
|
+
import { TRANSLATION_NAMESPACE as hr } from "../../../locale/hooks/translation-constants.js";
|
|
15
|
+
import ar from "../CrudSearchComponent.js";
|
|
16
|
+
import { CrudDecListView as vr } from "./CrudDecListView.js";
|
|
17
|
+
import { getRendererValueCrudViewer as A } from "./CrudViewerUtil.js";
|
|
18
|
+
function _r({
|
|
19
|
+
idField: t = "id",
|
|
20
|
+
loadingData: G,
|
|
21
|
+
fields: e,
|
|
22
|
+
isDeleting: S,
|
|
23
|
+
isHiding: b,
|
|
24
|
+
viewable: f = !1,
|
|
25
|
+
paginateProps: s,
|
|
26
|
+
onDelete: h,
|
|
27
|
+
onHide: i,
|
|
28
|
+
onUpdate: T,
|
|
29
|
+
data: y = [],
|
|
30
|
+
extraAction: a,
|
|
31
|
+
onClickUpdate: c,
|
|
32
|
+
minusHeight: N,
|
|
33
|
+
scroll: J,
|
|
34
|
+
onClickClone: B,
|
|
35
|
+
className: K,
|
|
36
|
+
expandable: Q,
|
|
37
|
+
size: W,
|
|
38
|
+
bordered: X,
|
|
39
|
+
descListColumn: Y,
|
|
40
|
+
extraView: g,
|
|
41
|
+
decListLayout: Z,
|
|
42
|
+
scrollToTop: Tr,
|
|
43
|
+
onClickRefresh: O,
|
|
44
|
+
closeViewOnClickUpdate: R,
|
|
45
|
+
onExport: I,
|
|
46
|
+
confirmHiding: z,
|
|
47
|
+
confirmDeleting: E,
|
|
48
|
+
rowClassName: d,
|
|
49
|
+
actionWidth: P = 190,
|
|
50
|
+
...w
|
|
51
|
+
}) {
|
|
52
|
+
const { t: D } = sr(hr), L = $(
|
|
53
|
+
() => e.map(
|
|
54
|
+
({ hideInTable: r, hidden: o, width: l, name: u, label: H, halign: x, ...V }) => ({
|
|
55
|
+
title: H,
|
|
56
|
+
width: l,
|
|
57
|
+
key: u,
|
|
58
|
+
dataIndex: u,
|
|
59
|
+
hidden: r || o,
|
|
60
|
+
align: x ?? (V.type === "number" ? "right" : void 0),
|
|
61
|
+
render: A(V)
|
|
62
|
+
})
|
|
63
|
+
),
|
|
64
|
+
[e]
|
|
65
|
+
), [m, p] = q(), [C, j] = q();
|
|
66
|
+
er(() => {
|
|
67
|
+
y && p((r) => {
|
|
68
|
+
if (r)
|
|
69
|
+
return y.find((o) => o[t] === r[t]);
|
|
70
|
+
});
|
|
71
|
+
}, [y, t, m]);
|
|
72
|
+
const _ = lr(
|
|
73
|
+
(r) => {
|
|
74
|
+
var l;
|
|
75
|
+
const o = a == null ? void 0 : a(r);
|
|
76
|
+
return (Array.isArray(o) ? (l = o == null ? void 0 : o.filter(Boolean)) != null && l.length : o) || T || c || B || h ? /* @__PURE__ */ v(M, { children: [
|
|
77
|
+
o,
|
|
78
|
+
(T || c) && /* @__PURE__ */ n(
|
|
79
|
+
ur,
|
|
80
|
+
{
|
|
81
|
+
value: r,
|
|
82
|
+
onClick: (u) => {
|
|
83
|
+
j(u[t]), c == null || c(r), R && p(void 0);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
B && /* @__PURE__ */ n(F, { value: r, onClick: (u) => B(u) }),
|
|
88
|
+
I && /* @__PURE__ */ n(
|
|
89
|
+
or,
|
|
90
|
+
{
|
|
91
|
+
value: r,
|
|
92
|
+
onClick: async (u) => await I(u)
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
i && /* @__PURE__ */ n(
|
|
96
|
+
tr,
|
|
97
|
+
{
|
|
98
|
+
value: r,
|
|
99
|
+
disabled: b,
|
|
100
|
+
shouldConfirm: z,
|
|
101
|
+
loading: b && r[t] === C,
|
|
102
|
+
onClick: async (u) => {
|
|
103
|
+
j(u[t]), await i({ [t]: u[t] });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
h && /* @__PURE__ */ n(
|
|
108
|
+
rr,
|
|
109
|
+
{
|
|
110
|
+
value: r,
|
|
111
|
+
disabled: S,
|
|
112
|
+
shouldConfirm: E,
|
|
113
|
+
loading: S && r[t] === C,
|
|
114
|
+
onClick: async (u) => {
|
|
115
|
+
j(u[t]), await h({ [t]: u[t] });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] }) : void 0;
|
|
120
|
+
},
|
|
121
|
+
[
|
|
122
|
+
R,
|
|
123
|
+
E,
|
|
124
|
+
z,
|
|
125
|
+
a,
|
|
126
|
+
t,
|
|
127
|
+
S,
|
|
128
|
+
b,
|
|
129
|
+
B,
|
|
130
|
+
c,
|
|
131
|
+
h,
|
|
132
|
+
I,
|
|
133
|
+
i,
|
|
134
|
+
T,
|
|
135
|
+
C
|
|
136
|
+
]
|
|
137
|
+
), k = $(() => {
|
|
138
|
+
let r = typeof f == "string" ? m == null ? void 0 : m[f] : void 0;
|
|
139
|
+
if (typeof r == "object") {
|
|
140
|
+
const o = e.find((l) => l.name === f);
|
|
141
|
+
r = A(o)(
|
|
142
|
+
r,
|
|
143
|
+
m,
|
|
144
|
+
0
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
return r;
|
|
148
|
+
}, [f, m, e]);
|
|
149
|
+
return /* @__PURE__ */ v("div", { children: [
|
|
150
|
+
f && /* @__PURE__ */ n(
|
|
151
|
+
U,
|
|
152
|
+
{
|
|
153
|
+
width: "100%",
|
|
154
|
+
open: !!m,
|
|
155
|
+
title: k ?? /* @__PURE__ */ n("div", { children: " " }),
|
|
156
|
+
footer: /* @__PURE__ */ n(M, {}),
|
|
157
|
+
closable: !0,
|
|
158
|
+
onCancel: () => p(void 0),
|
|
159
|
+
children: !!m && /* @__PURE__ */ v("div", { children: [
|
|
160
|
+
/* @__PURE__ */ n(
|
|
161
|
+
vr,
|
|
162
|
+
{
|
|
163
|
+
layout: Z,
|
|
164
|
+
descListColumn: Y,
|
|
165
|
+
data: m,
|
|
166
|
+
fields: e,
|
|
167
|
+
action: _(m)
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
g == null ? void 0 : g(m)
|
|
171
|
+
] }, m == null ? void 0 : m[t])
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ n(ar, { fields: e, ...w }),
|
|
175
|
+
/* @__PURE__ */ v(fr, { children: [
|
|
176
|
+
!!O && /* @__PURE__ */ n(mr, { onClick: O }),
|
|
177
|
+
/* @__PURE__ */ n(
|
|
178
|
+
cr,
|
|
179
|
+
{
|
|
180
|
+
rowClassName: d,
|
|
181
|
+
className: K,
|
|
182
|
+
scroll: J ?? (N ? {
|
|
183
|
+
y: `calc(100vh - ${N})`
|
|
184
|
+
} : void 0),
|
|
185
|
+
id: "crud-table",
|
|
186
|
+
dataSource: y,
|
|
187
|
+
loading: G,
|
|
188
|
+
bordered: X,
|
|
189
|
+
size: W,
|
|
190
|
+
expandable: Q,
|
|
191
|
+
pagination: s ? {
|
|
192
|
+
total: s.count,
|
|
193
|
+
onChange: s.setPage,
|
|
194
|
+
current: s.page,
|
|
195
|
+
pageSize: s.pageSize
|
|
196
|
+
} : void 0,
|
|
197
|
+
columns: T || c || h || a || f ? [
|
|
198
|
+
...L,
|
|
199
|
+
{
|
|
200
|
+
title: D("str.action"),
|
|
201
|
+
dataIndex: "",
|
|
202
|
+
fixed: "right",
|
|
203
|
+
width: P,
|
|
204
|
+
render: (r, o) => /* @__PURE__ */ v(M, { children: [
|
|
205
|
+
f && /* @__PURE__ */ n(nr, { value: o, onClick: p }),
|
|
206
|
+
_(o)
|
|
207
|
+
] })
|
|
208
|
+
}
|
|
209
|
+
] : L
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] })
|
|
213
|
+
] });
|
|
214
|
+
}
|
|
215
|
+
export {
|
|
216
|
+
_r as default
|
|
217
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),m=require("@ant-design/icons"),s=require("antd"),y=require("../../common/show-more/index.cjs"),C=require("../FileCrudField.cjs"),g=require("../ImageCrudField.cjs"),x=require("../../../locale/hooks/translation-constants.cjs"),d=require("i18next"),r=require("../../../util/DateUtil.cjs"),v=require("../../../util/NumberUtil.cjs");function j({type:a,render:i,...n}){return a==="object"?(t,u,o)=>typeof i=="function"?i(t,u,o):"":a==="select"?(t,u,o)=>{const e=n;let c=e.multiple?Array.isArray(t)?t.map(f=>f==null?void 0:f[e.innerFieldLabel??"name"]):void 0:t==null?void 0:t[e.innerFieldLabel??"name"];return(!c&&typeof t=="string"||typeof t=="number")&&(c=t),typeof i=="function"?i(c,u,o):Array.isArray(c)?c.join(", "):c}:a==="number"?(t,u,o)=>typeof i=="function"?i(t,u,o):n!=null&&n.int?v.default.toInt(t,n.formatted):v.default.toMoney(t):a==="enum"?(t,u,o)=>{var c;const e=d.t(((c=n==null?void 0:n.translation)==null?void 0:c[t??""])??t,{ns:x.TRANSLATION_NAMESPACE});return typeof i=="function"?i(t,u,o):e}:a==="date"?(t,u,o)=>{if(!t)return"-";const e=n!=null&&n.formatTime?r.formatDateTime(t):r.formatDate(t);return typeof i=="function"?i(t,u,o):e}:a==="checkbox"?(t,u,o)=>typeof i=="function"?i(t,u,o):t?l.jsx(m.CheckOutlined,{}):l.jsx(m.CloseOutlined,{}):a==="image"?(t,u,o)=>typeof i=="function"?i(t,u,o):l.jsx(g.ImageCrudCellValue,{value:t,provider:n.provider}):a==="file"?(t,u,o)=>typeof i=="function"?i(t,u,o):l.jsx(C.FileCrudCellValue,{value:t,provider:n.provider}):a==="time"?(t,u,o)=>{if(!t)return"-";const e=n==null?void 0:n.format,c=n==null?void 0:n.use12Hours,f=r.formatTime(t,e||(c?"hh:mm:ss A":void 0));return typeof i=="function"?i(t,u,o):f}:a==="color"?(t,u,o)=>typeof i=="function"?i(t,u,o):typeof t=="string"&&t.startsWith("#")?l.jsx(s.Tooltip,{title:t,children:l.jsx(s.Avatar,{style:{backgroundColor:t}})}):String(t):a==="textarea"?(t,u,o)=>{const e=(n==null?void 0:n.truncated)??1;return typeof i=="function"?i(t,u,o):e?l.jsx(y.ShowMore,{lines:e===!0?1:e,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=j;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { CheckOutlined as y, CloseOutlined as A } from "@ant-design/icons";
|
|
3
|
+
import { Tooltip as e, Avatar as C } from "antd";
|
|
4
|
+
import { ShowMore as b } from "../../common/show-more/index.js";
|
|
5
|
+
import { FileCrudCellValue as g } from "../FileCrudField.js";
|
|
6
|
+
import { ImageCrudCellValue as h } from "../ImageCrudField.js";
|
|
7
|
+
import { TRANSLATION_NAMESPACE as T } from "../../../locale/hooks/translation-constants.js";
|
|
8
|
+
import { t as S } from "i18next";
|
|
9
|
+
import r from "../../../util/DateUtil.js";
|
|
10
|
+
import v from "../../../util/NumberUtil.js";
|
|
11
|
+
function O({
|
|
12
|
+
type: m,
|
|
13
|
+
render: i,
|
|
14
|
+
...o
|
|
15
|
+
}) {
|
|
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) => {
|
|
21
|
+
var a;
|
|
22
|
+
const u = S(
|
|
23
|
+
((a = o == null ? void 0 : o.translation) == null ? void 0 : a[t ?? ""]) ?? t,
|
|
24
|
+
{ ns: T }
|
|
25
|
+
);
|
|
26
|
+
return typeof i == "function" ? i(t, n, f) : u;
|
|
27
|
+
} : m === "date" ? (t, n, f) => {
|
|
28
|
+
if (!t) return "-";
|
|
29
|
+
const u = o != null && o.formatTime ? r.formatDateTime(t) : r.formatDate(t);
|
|
30
|
+
return typeof i == "function" ? i(t, n, f) : u;
|
|
31
|
+
} : m === "checkbox" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : t ? /* @__PURE__ */ l(y, {}) : /* @__PURE__ */ l(A, {}) : m === "image" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l(
|
|
32
|
+
h,
|
|
33
|
+
{
|
|
34
|
+
value: t,
|
|
35
|
+
provider: o.provider
|
|
36
|
+
}
|
|
37
|
+
) : m === "file" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l(
|
|
38
|
+
g,
|
|
39
|
+
{
|
|
40
|
+
value: t,
|
|
41
|
+
provider: o.provider
|
|
42
|
+
}
|
|
43
|
+
) : m === "time" ? (t, n, f) => {
|
|
44
|
+
if (!t) return "-";
|
|
45
|
+
const u = o == null ? void 0 : o.format, a = o == null ? void 0 : o.use12Hours, c = r.formatTime(
|
|
46
|
+
t,
|
|
47
|
+
u || (a ? "hh:mm:ss A" : void 0)
|
|
48
|
+
);
|
|
49
|
+
return typeof i == "function" ? i(t, n, f) : c;
|
|
50
|
+
} : m === "color" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ l(e, { title: t, children: /* @__PURE__ */ l(C, { style: { backgroundColor: t } }) }) : String(t) : m === "textarea" ? (t, n, f) => {
|
|
51
|
+
const u = (o == null ? void 0 : o.truncated) ?? 1;
|
|
52
|
+
return typeof i == "function" ? i(t, n, f) : u ? /* @__PURE__ */ l(b, { lines: u === !0 ? 1 : u, children: t }) : t;
|
|
53
|
+
} : typeof i == "function" ? i : (t) => t;
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
O as getRendererValueCrudViewer
|
|
57
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./locale/hooks/translation-constants.cjs"),o=require("./locale/index.cjs"),C=require("./components/crud/CrudComponent.cjs"),r=require("./components/crud/CrudField.cjs"),i=require("./components/crud/CrudFormWizard.cjs"),n=require("./components/crud/CrudReportComponent.cjs"),t=require("./components/crud/CrudSearchComponent.cjs"),d=require("./components/crud/CrudForm.cjs"),l=require("./components/crud/FileCrudField.cjs"),e=require("./components/crud/ImageCrudField.cjs");exports.TRANSLATION_NAMESPACE=u.TRANSLATION_NAMESPACE;exports.setupI18n=o.setupI18n;exports.updateTranslations=o.updateTranslations;exports.CrudComponent=C;exports.ColorCrudFieldComponent=r.ColorCrudFieldComponent;exports.CrudField=r.default;exports.SelectCrudFieldComponent=r.SelectCrudFieldComponent;exports.CrudFormWizard=i;exports.CrudReportComponent=n;exports.CrudSearchComponent=t;exports.CrudForm=d.CrudForm;exports.CrudFormFields=d.CrudFormFields;exports.FileCellValue=l.FileCellValue;exports.FileCrudCellValue=l.FileCrudCellValue;exports.FileCrudField=l.default;exports.FileDownloadProvider=e.FileDownloadProvider;exports.FileUploadProvider=e.FileUploadProvider;exports.ImageCellValue=e.ImageCellValue;exports.ImageCrudCellValue=e.ImageCrudCellValue;exports.ImageCrudField=e.default;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { TRANSLATION_NAMESPACE as o } from "./
|
|
2
|
-
import { setupI18n as d, updateTranslations as a } from "./
|
|
3
|
-
import { default as u } from "./
|
|
4
|
-
import { ColorCrudFieldComponent as m, default as p, SelectCrudFieldComponent as f } from "./
|
|
5
|
-
import { default as n } from "./
|
|
6
|
-
import { default as s } from "./
|
|
7
|
-
import { default as I } from "./
|
|
8
|
-
import { CrudForm as S, CrudFormFields as V } from "./
|
|
9
|
-
import { FileCellValue as N, FileCrudCellValue as P, default as T } from "./
|
|
10
|
-
import { FileDownloadProvider as v, FileUploadProvider as E, ImageCellValue as R, ImageCrudCellValue as h, default as w } from "./
|
|
1
|
+
import { TRANSLATION_NAMESPACE as o } from "./locale/hooks/translation-constants.js";
|
|
2
|
+
import { setupI18n as d, updateTranslations as a } from "./locale/index.js";
|
|
3
|
+
import { default as u } from "./components/crud/CrudComponent.js";
|
|
4
|
+
import { ColorCrudFieldComponent as m, default as p, SelectCrudFieldComponent as f } from "./components/crud/CrudField.js";
|
|
5
|
+
import { default as n } from "./components/crud/CrudFormWizard.js";
|
|
6
|
+
import { default as s } from "./components/crud/CrudReportComponent.js";
|
|
7
|
+
import { default as I } from "./components/crud/CrudSearchComponent.js";
|
|
8
|
+
import { CrudForm as S, CrudFormFields as V } from "./components/crud/CrudForm.js";
|
|
9
|
+
import { FileCellValue as N, FileCrudCellValue as P, default as T } from "./components/crud/FileCrudField.js";
|
|
10
|
+
import { FileDownloadProvider as v, FileUploadProvider as E, ImageCellValue as R, ImageCrudCellValue as h, default as w } from "./components/crud/ImageCrudField.js";
|
|
11
11
|
export {
|
|
12
12
|
m as ColorCrudFieldComponent,
|
|
13
13
|
u as CrudComponent,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="crud-component";exports.TRANSLATION_NAMESPACE=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./hooks/translation-constants.cjs"),o=require("./translations/en.cjs"),t=require("i18next"),u=require("react-i18next"),a={en:{[s.TRANSLATION_NAMESPACE]:o}},i=(e={})=>{const{translations:n=a,language:r="en"}=e;return t.use(u.initReactI18next).init({resources:n,lng:r,fallbackLng:"en",ns:s.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),t},l=(e,n)=>{t.addResourceBundle(e,s.TRANSLATION_NAMESPACE,n,!0,!0)};exports.defaultTranslations=a;exports.setupI18n=i;exports.updateTranslations=l;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TRANSLATION_NAMESPACE as o } from "./hooks/translation-constants.js";
|
|
2
|
+
import a from "./translations/en.js";
|
|
3
|
+
import t from "i18next";
|
|
4
|
+
import { initReactI18next as s } from "react-i18next";
|
|
5
|
+
const i = {
|
|
6
|
+
en: {
|
|
7
|
+
[o]: a
|
|
8
|
+
}
|
|
9
|
+
}, m = (n = {}) => {
|
|
10
|
+
const { translations: e = i, language: r = "en" } = n;
|
|
11
|
+
return t.use(s).init({
|
|
12
|
+
resources: e,
|
|
13
|
+
lng: r,
|
|
14
|
+
fallbackLng: "en",
|
|
15
|
+
ns: o,
|
|
16
|
+
interpolation: {
|
|
17
|
+
escapeValue: !1
|
|
18
|
+
}
|
|
19
|
+
}), t;
|
|
20
|
+
}, f = (n, e) => {
|
|
21
|
+
t.addResourceBundle(
|
|
22
|
+
n,
|
|
23
|
+
o,
|
|
24
|
+
e,
|
|
25
|
+
!0,
|
|
26
|
+
!0
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
i as defaultTranslations,
|
|
31
|
+
m as setupI18n,
|
|
32
|
+
f as updateTranslations
|
|
33
|
+
};
|
|
@@ -0,0 +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?"}};module.exports=e;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
str: {
|
|
3
|
+
delete: "Delete",
|
|
4
|
+
clone: "Clone",
|
|
5
|
+
update: "Update",
|
|
6
|
+
new: "New",
|
|
7
|
+
back: "Back",
|
|
8
|
+
next: "Next",
|
|
9
|
+
save: "Save",
|
|
10
|
+
import: "Import",
|
|
11
|
+
cancel: "Cancel",
|
|
12
|
+
print: "Print",
|
|
13
|
+
hide: "Hide",
|
|
14
|
+
no: "No",
|
|
15
|
+
action: "Action",
|
|
16
|
+
remove: "Remove",
|
|
17
|
+
view: "View",
|
|
18
|
+
ok: "Ok",
|
|
19
|
+
yes: "Yes",
|
|
20
|
+
warning: "Warning",
|
|
21
|
+
success: "Success",
|
|
22
|
+
error: "Error",
|
|
23
|
+
retry: "Retry",
|
|
24
|
+
previous: "Previous",
|
|
25
|
+
unhide: "Unhide",
|
|
26
|
+
downloadCsvTemplate: "Download CSV Template",
|
|
27
|
+
importCsvFile: "Import CSV File",
|
|
28
|
+
export: "Export",
|
|
29
|
+
goBack: "Go Back",
|
|
30
|
+
refresh: "Refresh",
|
|
31
|
+
fileUploadMessage1: "Drag file here or ",
|
|
32
|
+
fileUploadMessage2: "Click to Upload"
|
|
33
|
+
},
|
|
34
|
+
err: {
|
|
35
|
+
save: "An error occurred while saving",
|
|
36
|
+
validation: {
|
|
37
|
+
required: "is required",
|
|
38
|
+
minLength8: "must be at least 8 characters",
|
|
39
|
+
percentage: "must be a percentage",
|
|
40
|
+
maximumValueExceeded: "must be less than %maxValue%",
|
|
41
|
+
invalidNic: "must be a valid NIC",
|
|
42
|
+
invalid: "must be a valid"
|
|
43
|
+
},
|
|
44
|
+
notFound: "Not Found"
|
|
45
|
+
},
|
|
46
|
+
message: {
|
|
47
|
+
loading: {
|
|
48
|
+
saving: "Saving"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
qus: {
|
|
52
|
+
importWithIssues: "Some fields have issues. Do you want to proceed with the import?",
|
|
53
|
+
doYouWantToDelete: "Do you want to delete?",
|
|
54
|
+
doYouWantToHide: "Do you want to hide?",
|
|
55
|
+
doYouWantToUnhide: "Do you want to unhide?"
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
e as default
|
|
60
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("dayjs"),a=require("i18next"),o=t=>e(t).locale(a.language).format("YYYY-MM-DD HH:mm"),m=t=>e(t).locale(a.language).format("YYYY-MM-DD HH:mm:ss"),n=t=>e(t).locale(a.language).format("YYYY-MM-DD"),s=(t,r="HH:mm:ss")=>e(t).locale(a.language).format(r),c={formatDateTime:o,formatDate:n,formatDateTimeWithSecond:m,formatTime:s};module.exports=c;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import a from "dayjs";
|
|
2
|
+
import e from "i18next";
|
|
3
|
+
const m = (t) => a(t).locale(e.language).format("YYYY-MM-DD HH:mm"), r = (t) => a(t).locale(e.language).format("YYYY-MM-DD HH:mm:ss"), n = (t) => a(t).locale(e.language).format("YYYY-MM-DD"), l = (t, o = "HH:mm:ss") => a(t).locale(e.language).format(o), s = { formatDateTime: m, formatDate: n, formatDateTimeWithSecond: r, formatTime: l };
|
|
4
|
+
export {
|
|
5
|
+
s as default
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import c from "../node_modules/browser-image-compression/dist/browser-image-compression.js";
|
|
2
|
+
class g {
|
|
3
|
+
async resizeImage(t) {
|
|
4
|
+
const e = await c(t, {
|
|
5
|
+
maxSizeMB: 1,
|
|
6
|
+
maxWidthOrHeight: 1920,
|
|
7
|
+
useWebWorker: !0
|
|
8
|
+
}), a = t.uid;
|
|
9
|
+
return Object.assign(e, {
|
|
10
|
+
uid: a,
|
|
11
|
+
lastModifiedDate: /* @__PURE__ */ new Date()
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async getImageData(t) {
|
|
15
|
+
const e = await this.getImageData0(t);
|
|
16
|
+
if (e) {
|
|
17
|
+
const a = new Image();
|
|
18
|
+
a.src = e.data;
|
|
19
|
+
const o = await new Promise(
|
|
20
|
+
(n) => {
|
|
21
|
+
a.onload = function() {
|
|
22
|
+
n({
|
|
23
|
+
height: a.height,
|
|
24
|
+
width: a.width
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
return Object.assign(e, o), e;
|
|
30
|
+
} else
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
async getImageData0(t) {
|
|
34
|
+
try {
|
|
35
|
+
if (t.startsWith("data:image/")) {
|
|
36
|
+
const e = t.match(/^data:image\/(png|jpeg|jpg);base64,(.*)$/);
|
|
37
|
+
if (!e)
|
|
38
|
+
throw new Error("Invalid base64 image data");
|
|
39
|
+
return { data: t, type: e[1] };
|
|
40
|
+
} else {
|
|
41
|
+
const e = await fetch(t);
|
|
42
|
+
if (!e.ok) throw new Error("Network response was not ok");
|
|
43
|
+
const a = await e.blob();
|
|
44
|
+
return new Promise((o, n) => {
|
|
45
|
+
const s = new FileReader();
|
|
46
|
+
s.onloadend = function() {
|
|
47
|
+
const r = s.result, i = r.match(/^data:image\/(png|jpeg|jpg);base64,/);
|
|
48
|
+
i ? o({
|
|
49
|
+
data: r,
|
|
50
|
+
type: i[1]
|
|
51
|
+
}) : n(new Error("Could not determine image type"));
|
|
52
|
+
}, s.onerror = n, s.readAsDataURL(a);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
} catch (e) {
|
|
56
|
+
return console.warn(e), null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const l = new g();
|
|
61
|
+
export {
|
|
62
|
+
l as default
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i={minimumFractionDigits:2,maximumFractionDigits:2},a={minimumFractionDigits:0,maximumFractionDigits:0};function u(t=0){return(+t).toLocaleString("en",i)}function c(t=0,n=2){const r=e(t,n);return isNaN(r)?void 0:r}function e(t=0,n=2){switch(t=+t,(typeof n!="number"||n<0)&&(n=2),n){case 0:return Math.round(t);case 1:return Math.round(t*10)/10;case 2:return Math.round(t*100)/100;case 3:return Math.round(t*1e3)/1e3;case 4:return Math.round(t*1e4)/1e4;default:{const r=Math.pow(10,n);return Math.round(t*r)/r}}}function s(t=0,n=!1){const r=Math.floor(t);return n?r.toLocaleString("en",a):r.toString()}function d(t=1e9){return Math.floor(Math.random()*(t+1))}function o(t){const n=Number(t);return isNaN(n)?0:n}function l(t=0){const n=t.toString();if(!n.includes("."))return t;const r=n.replace(/\.?0+$/,"");return Number(r)}const f={toInt:s,round:e,toMoney:u,randInt:d,withoutNan:o,removeTrailingZeros:l,roundNoNan:c};exports.default=f;exports.withoutNan=o;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const o = {
|
|
2
|
+
minimumFractionDigits: 2,
|
|
3
|
+
maximumFractionDigits: 2
|
|
4
|
+
}, i = { minimumFractionDigits: 0, maximumFractionDigits: 0 };
|
|
5
|
+
function a(t = 0) {
|
|
6
|
+
return (+t).toLocaleString("en", o);
|
|
7
|
+
}
|
|
8
|
+
function u(t = 0, n = 2) {
|
|
9
|
+
const r = e(t, n);
|
|
10
|
+
return isNaN(r) ? void 0 : r;
|
|
11
|
+
}
|
|
12
|
+
function e(t = 0, n = 2) {
|
|
13
|
+
switch (t = +t, (typeof n != "number" || n < 0) && (n = 2), n) {
|
|
14
|
+
case 0:
|
|
15
|
+
return Math.round(t);
|
|
16
|
+
case 1:
|
|
17
|
+
return Math.round(t * 10) / 10;
|
|
18
|
+
case 2:
|
|
19
|
+
return Math.round(t * 100) / 100;
|
|
20
|
+
case 3:
|
|
21
|
+
return Math.round(t * 1e3) / 1e3;
|
|
22
|
+
case 4:
|
|
23
|
+
return Math.round(t * 1e4) / 1e4;
|
|
24
|
+
default: {
|
|
25
|
+
const r = Math.pow(10, n);
|
|
26
|
+
return Math.round(t * r) / r;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function c(t = 0, n = !1) {
|
|
31
|
+
const r = Math.floor(t);
|
|
32
|
+
return n ? r.toLocaleString("en", i) : r.toString();
|
|
33
|
+
}
|
|
34
|
+
function s(t = 1e9) {
|
|
35
|
+
return Math.floor(Math.random() * (t + 1));
|
|
36
|
+
}
|
|
37
|
+
function d(t) {
|
|
38
|
+
const n = Number(t);
|
|
39
|
+
return isNaN(n) ? 0 : n;
|
|
40
|
+
}
|
|
41
|
+
function f(t = 0) {
|
|
42
|
+
const n = t.toString();
|
|
43
|
+
if (!n.includes("."))
|
|
44
|
+
return t;
|
|
45
|
+
const r = n.replace(/\.?0+$/, "");
|
|
46
|
+
return Number(r);
|
|
47
|
+
}
|
|
48
|
+
const m = {
|
|
49
|
+
toInt: c,
|
|
50
|
+
round: e,
|
|
51
|
+
toMoney: a,
|
|
52
|
+
randInt: s,
|
|
53
|
+
withoutNan: d,
|
|
54
|
+
removeTrailingZeros: f,
|
|
55
|
+
roundNoNan: u
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
m as default,
|
|
59
|
+
d as withoutNan
|
|
60
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("i18next"),a=require("./NumberUtil.cjs"),o=e=>[{required:!0,message:`${e} ${i.t("err.validation.required")}`}],s=()=>[{min:8,message:i.t("err.validation.minLength8")}],d=()=>[{type:"number",validator(e,r,t){const n=Number(r);isNaN(n)&&r||n<0||n>100?t(i.t("err.validation.percentage")):t()},message:i.t("err.validation.percentage")}],u=e=>[{max:Number(e),min:0,type:"number",message:i.t("err.validation.maximumValueExceeded").replace("%maxValue%",a.default.toMoney(e))}],l=()=>[{validator:(e,r,t)=>(r.length===12||r.length===10)&&r.search(/^([0-9]{9}[x|X|v|V])|([0-9]{12})$/)!==-1?t():t(i.t("err.validation.invalidNic"))}],m=e=>[{message:`${i.t("err.validation.invalid")} ${e}`,pattern:/^(?:0|94|\+94|0094)?(?:(11|21|23|24|25|26|27|31|32|33|34|35|36|37|38|41|45|47|51|52|54|55|57|63|65|66|67|81|91)(0|2|3|4|5|7|9)|7(0|1|2|4|5|6|7|8)\d)\d{6}$/}],v=()=>[{message:`${i.t("err.validation.positiveNumber")}`,type:"number",validator(e,r,t){r<=0?t(e.message):t()}}],g={percentageValidation:d,required:o,maxValidation:u,passwordValidation:s,nicValidation:l,phoneValidation:m,positiveNumberValidation:v};module.exports=g;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as r } from "i18next";
|
|
2
|
+
import n from "./NumberUtil.js";
|
|
3
|
+
const o = (e) => [
|
|
4
|
+
{
|
|
5
|
+
required: !0,
|
|
6
|
+
message: `${e} ${r("err.validation.required")}`
|
|
7
|
+
}
|
|
8
|
+
], s = () => [
|
|
9
|
+
{
|
|
10
|
+
min: 8,
|
|
11
|
+
message: r("err.validation.minLength8")
|
|
12
|
+
}
|
|
13
|
+
], d = () => [
|
|
14
|
+
{
|
|
15
|
+
type: "number",
|
|
16
|
+
validator(e, t, i) {
|
|
17
|
+
const a = Number(t);
|
|
18
|
+
isNaN(a) && t ? i(r("err.validation.percentage")) : a < 0 || a > 100 ? i(r("err.validation.percentage")) : i();
|
|
19
|
+
},
|
|
20
|
+
message: r("err.validation.percentage")
|
|
21
|
+
}
|
|
22
|
+
], m = (e) => [
|
|
23
|
+
{
|
|
24
|
+
max: Number(e),
|
|
25
|
+
min: 0,
|
|
26
|
+
type: "number",
|
|
27
|
+
message: r("err.validation.maximumValueExceeded").replace(
|
|
28
|
+
"%maxValue%",
|
|
29
|
+
n.toMoney(e)
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
], l = () => [
|
|
33
|
+
{
|
|
34
|
+
validator: (e, t, i) => t.length === 12 || t.length === 10 ? t.search(/^([0-9]{9}[x|X|v|V])|([0-9]{12})$/) !== -1 ? i() : i(r("err.validation.invalidNic")) : i(r("err.validation.invalidNic"))
|
|
35
|
+
}
|
|
36
|
+
], u = (e) => [
|
|
37
|
+
{
|
|
38
|
+
message: `${r("err.validation.invalid")} ${e}`,
|
|
39
|
+
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}$/
|
|
40
|
+
}
|
|
41
|
+
], v = () => [
|
|
42
|
+
{
|
|
43
|
+
message: `${r("err.validation.positiveNumber")}`,
|
|
44
|
+
type: "number",
|
|
45
|
+
validator(e, t, i) {
|
|
46
|
+
t <= 0 ? i(e.message) : i();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
], V = {
|
|
50
|
+
percentageValidation: d,
|
|
51
|
+
required: o,
|
|
52
|
+
maxValidation: m,
|
|
53
|
+
passwordValidation: s,
|
|
54
|
+
nicValidation: l,
|
|
55
|
+
phoneValidation: u,
|
|
56
|
+
positiveNumberValidation: v
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
V as default
|
|
60
|
+
};
|
package/dist/util/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./DateUtil.cjs"),e=require("./NumberUtil.cjs"),i=require("./ImageUtil.cjs"),l=require("./ValidationUtil.cjs");exports.DateUtil=t;exports.NumberUtil=e.default;exports.ImageUtil=i;exports.ValidationUtil=l;
|
package/dist/util/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { default as e } from "
|
|
2
|
-
import { default as o } from "
|
|
3
|
-
import { default as f } from "
|
|
4
|
-
import { default as m } from "
|
|
1
|
+
import { default as e } from "./DateUtil.js";
|
|
2
|
+
import { default as o } from "./NumberUtil.js";
|
|
3
|
+
import { default as f } from "./ImageUtil.js";
|
|
4
|
+
import { default as m } from "./ValidationUtil.js";
|
|
5
5
|
export {
|
|
6
6
|
e as DateUtil,
|
|
7
7
|
f as ImageUtil,
|