@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,89 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { ConfigProvider as P, Spin as b, Form as j, Select as q } from "antd";
|
|
3
|
+
import { useCallback as B } from "react";
|
|
4
|
+
import { useTranslation as D } from "react-i18next";
|
|
5
|
+
import { TRANSLATION_NAMESPACE as F } from "../../../locale/hooks/translation-constants.js";
|
|
6
|
+
import R from "../tooltip/TooltipComponent.js";
|
|
7
|
+
function Q({
|
|
8
|
+
label: m,
|
|
9
|
+
rules: w = [],
|
|
10
|
+
required: x,
|
|
11
|
+
placeholder: l,
|
|
12
|
+
notSearch: L,
|
|
13
|
+
children: a,
|
|
14
|
+
readOnly: o,
|
|
15
|
+
items: s,
|
|
16
|
+
dropdownRender: T,
|
|
17
|
+
itemBuilder: u,
|
|
18
|
+
loading: d,
|
|
19
|
+
showLoadingInEmptyIndicator: N,
|
|
20
|
+
nameFieldInArray: h = "name",
|
|
21
|
+
innerRef: _,
|
|
22
|
+
tooltip: A,
|
|
23
|
+
filterOption: E,
|
|
24
|
+
tagRender: I,
|
|
25
|
+
...n
|
|
26
|
+
}) {
|
|
27
|
+
const { t: M } = D(F), O = B(
|
|
28
|
+
(e) => {
|
|
29
|
+
const r = typeof e == "string" || typeof e == "number" ? e : e == null ? void 0 : e.id, c = typeof e == "string" || typeof e == "number" ? e : e == null ? void 0 : e[h];
|
|
30
|
+
return /* @__PURE__ */ t("option", { value: r, children: /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: c } }) }, r);
|
|
31
|
+
},
|
|
32
|
+
[h]
|
|
33
|
+
);
|
|
34
|
+
return /* @__PURE__ */ t(
|
|
35
|
+
P,
|
|
36
|
+
{
|
|
37
|
+
renderEmpty: N && d ? () => /* @__PURE__ */ t(b, {}) : void 0,
|
|
38
|
+
children: /* @__PURE__ */ t(R, { title: A, children: /* @__PURE__ */ t(
|
|
39
|
+
j.Item,
|
|
40
|
+
{
|
|
41
|
+
label: m,
|
|
42
|
+
name: n.name,
|
|
43
|
+
help: n.help,
|
|
44
|
+
className: n.className,
|
|
45
|
+
rules: [
|
|
46
|
+
...w,
|
|
47
|
+
{
|
|
48
|
+
required: x,
|
|
49
|
+
message: `${m ?? l ?? ""} ${M(
|
|
50
|
+
"err.validation.required"
|
|
51
|
+
)}`
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
children: /* @__PURE__ */ t(
|
|
55
|
+
q,
|
|
56
|
+
{
|
|
57
|
+
ref: _,
|
|
58
|
+
loading: d,
|
|
59
|
+
open: o ? !1 : void 0,
|
|
60
|
+
onChange: !o && n.onChange,
|
|
61
|
+
allowClear: !o && n.allowClear,
|
|
62
|
+
showSearch: !L,
|
|
63
|
+
className: `max-width ${o ? "readOnly" : ""}`,
|
|
64
|
+
...n,
|
|
65
|
+
tagRender: I,
|
|
66
|
+
placeholder: l ?? m,
|
|
67
|
+
filterOption: E ?? ((e, r) => {
|
|
68
|
+
var c, C, g, S;
|
|
69
|
+
try {
|
|
70
|
+
const i = (g = (C = (c = r == null ? void 0 : r.children) == null ? void 0 : c.props) == null ? void 0 : C.dangerouslySetInnerHTML) == null ? void 0 : g.__html, $ = e.toLowerCase().split(/\s+/), p = (r == null ? void 0 : r.children) ?? "", y = typeof p == "string" ? p.toLowerCase() : typeof i == "string" ? i.toLowerCase() : "", k = (((S = r == null ? void 0 : r.value) == null ? void 0 : S.toString()) ?? "").toLowerCase(), H = y.replace(/\s/g, "");
|
|
71
|
+
return $.every(
|
|
72
|
+
(f) => y.indexOf(f) >= 0 || k.indexOf(f) >= 0 || H.indexOf(f) >= 0
|
|
73
|
+
);
|
|
74
|
+
} catch (i) {
|
|
75
|
+
return console.log(i), !0;
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
dropdownRender: T,
|
|
79
|
+
children: a === null ? void 0 : a ?? (s && (s == null ? void 0 : s.map(u ?? O)))
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
) })
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
Q as default
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),o=require("react-show-more-text");;/* empty css */const e=r=>t.jsx(o,{...r});exports.ShowMore=e;exports.default=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("antd"),g=require("../../../context/WindowDimension.cjs"),i=require("react"),u=require("react-router"),q=require("react-router-dom"),{Content:T}=c.Layout,y=({positionOfRoute:n,initialKey:s="*",tabs:l,className:d="",mode:h="default"})=>{const[b,m]=i.useState(s),o=u.useNavigate(),p=e=>{o(e)},r=q.useLocation();i.useEffect(()=>{const e=r.pathname.split("/")[n];m(e??""),e||o(s,{replace:!0})},[s,r.pathname,o,n]);const{isDesktop:x}=g(),a=h==="side"&&x,f=a?"left":"top",j=a?"d-flex h-100":"";return t.jsxs("div",{className:`${d} ${j}`,children:[t.jsx(c.Tabs,{type:"card",tabPosition:f,activeKey:b,onChange:p,children:l.map(({key:e,label:v})=>t.jsx(c.Tabs.TabPane,{tab:v},e))}),t.jsx(T,{className:`max-height ${a?"overflow-auto":""}`,children:t.jsx(u.Outlet,{})})]})};exports.TabViewWithRoute=y;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsxs as v, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Tabs as r, Layout as x } from "antd";
|
|
3
|
+
import g from "../../../context/WindowDimension.js";
|
|
4
|
+
import { useState as y, useEffect as S } from "react";
|
|
5
|
+
import { useNavigate as w, Outlet as N } from "react-router";
|
|
6
|
+
import { useLocation as P } from "react-router-dom";
|
|
7
|
+
const { Content: T } = x, A = ({
|
|
8
|
+
positionOfRoute: c,
|
|
9
|
+
initialKey: o = "*",
|
|
10
|
+
tabs: i,
|
|
11
|
+
className: m = "",
|
|
12
|
+
mode: l = "default"
|
|
13
|
+
}) => {
|
|
14
|
+
const [p, u] = y(o), s = w(), f = (t) => {
|
|
15
|
+
s(t);
|
|
16
|
+
}, n = P();
|
|
17
|
+
S(() => {
|
|
18
|
+
const t = n.pathname.split("/")[c];
|
|
19
|
+
u(t ?? ""), t || s(o, { replace: !0 });
|
|
20
|
+
}, [o, n.pathname, s, c]);
|
|
21
|
+
const { isDesktop: d } = g(), a = l === "side" && d, h = a ? "left" : "top";
|
|
22
|
+
return /* @__PURE__ */ v("div", { className: `${m} ${a ? "d-flex h-100" : ""}`, children: [
|
|
23
|
+
/* @__PURE__ */ e(
|
|
24
|
+
r,
|
|
25
|
+
{
|
|
26
|
+
type: "card",
|
|
27
|
+
tabPosition: h,
|
|
28
|
+
activeKey: p,
|
|
29
|
+
onChange: f,
|
|
30
|
+
children: i.map(({ key: t, label: b }) => /* @__PURE__ */ e(r.TabPane, { tab: b }, t))
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ e(T, { className: `max-height ${a ? "overflow-auto" : ""}`, children: /* @__PURE__ */ e(N, {}) })
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
A as TabViewWithRoute
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("react/jsx-runtime"),c=require("antd"),l=require("react");function d({minusHeight:h,onRow:g,count:m=1,onPageSizeChanged:f,pagination:e=!1,rowKey:s="id",columns:t,className:o,scroll:n,...i}){const r=l.useMemo(()=>t.filter(u=>!u.hidden),[t]);return a.jsx(c.Table,{className:`custom-scroll ${o}`,style:{width:"100%"},columns:r,rowKey:s,...i,scroll:n||{x:!0},pagination:e&&{...e,hideOnSinglePage:!0,showSizeChanger:!1}})}module.exports=d;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { Table as m } from "antd";
|
|
3
|
+
import { useMemo as u } from "react";
|
|
4
|
+
function x({
|
|
5
|
+
minusHeight: f,
|
|
6
|
+
onRow: c,
|
|
7
|
+
count: d = 1,
|
|
8
|
+
onPageSizeChanged: h,
|
|
9
|
+
pagination: e = !1,
|
|
10
|
+
rowKey: n = "id",
|
|
11
|
+
columns: o,
|
|
12
|
+
className: i,
|
|
13
|
+
scroll: t,
|
|
14
|
+
...r
|
|
15
|
+
}) {
|
|
16
|
+
const s = u(() => o.filter((a) => !a.hidden), [o]);
|
|
17
|
+
return /* @__PURE__ */ l(
|
|
18
|
+
m,
|
|
19
|
+
{
|
|
20
|
+
className: `custom-scroll ${i}`,
|
|
21
|
+
style: { width: "100%" },
|
|
22
|
+
columns: s,
|
|
23
|
+
rowKey: n,
|
|
24
|
+
...r,
|
|
25
|
+
scroll: t || {
|
|
26
|
+
// y: `calc(100vh - ${minusHeight ?? 0}px)`,
|
|
27
|
+
x: !0
|
|
28
|
+
// scrollToFirstRowOnChange: true,
|
|
29
|
+
},
|
|
30
|
+
pagination: e && {
|
|
31
|
+
...e,
|
|
32
|
+
hideOnSinglePage: !0,
|
|
33
|
+
showSizeChanger: !1
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
x as default
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("react/jsx-runtime"),u=require("antd"),x=require("../../../locale/hooks/translation-constants.cjs"),T=require("react-i18next"),q=({onClick:n,clickable:o,colorFunction:s,translation:c,value:e})=>{var r;const t=s==null?void 0:s(e),{t:i}=T.useTranslation(x.TRANSLATION_NAMESPACE),a=u.Tag;return p.jsx(a,{onClick:n,color:t==null?void 0:t.color,icon:t==null?void 0:t.icon,style:{color:t==null?void 0:t.text,cursor:o?"pointer":void 0},children:(r=i(c[e]))==null?void 0:r.toUpperCase()})};module.exports=q;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Tag as f } from "antd";
|
|
3
|
+
import { TRANSLATION_NAMESPACE as T } from "../../../locale/hooks/translation-constants.js";
|
|
4
|
+
import { useTranslation as A } from "react-i18next";
|
|
5
|
+
const S = ({
|
|
6
|
+
onClick: e,
|
|
7
|
+
clickable: m,
|
|
8
|
+
colorFunction: t,
|
|
9
|
+
translation: p,
|
|
10
|
+
value: r
|
|
11
|
+
}) => {
|
|
12
|
+
var s;
|
|
13
|
+
const o = t == null ? void 0 : t(r), { t: n } = A(T);
|
|
14
|
+
return /* @__PURE__ */ i(
|
|
15
|
+
f,
|
|
16
|
+
{
|
|
17
|
+
onClick: e,
|
|
18
|
+
color: o == null ? void 0 : o.color,
|
|
19
|
+
icon: o == null ? void 0 : o.icon,
|
|
20
|
+
style: {
|
|
21
|
+
color: o == null ? void 0 : o.text,
|
|
22
|
+
cursor: m ? "pointer" : void 0
|
|
23
|
+
},
|
|
24
|
+
children: (s = n(p[r])) == null ? void 0 : s.toUpperCase()
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
S as default
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("antd"),{Text:t}=e.Typography;exports.Text=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("antd"),{Title:t}=e.Typography;exports.Title=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),p=require("antd"),m=require("react"),M=require("react-i18next"),P=require("../../../locale/hooks/translation-constants.cjs"),S=require("../tooltip/TooltipComponent.cjs"),L=require("./TextField.cjs"),O=m.forwardRef(function({type:b,required:i,label:e,rules:c=[],placeholder:r,onEnter:x,form:q,nextFocus:T,min:d,moneyField:n,addonAfter:f,minLength:N,defaultValue:j,pattern:l,disabled:I,readOnly:$,onChange:g,value:A,max:E,addonBefore:R,size:C,isInt:u=!1,tooltip:h,...w},B){const{t:a}=M.useTranslation(P.TRANSLATION_NAMESPACE),F=m.useMemo(()=>[...c,{required:i,message:`${e??r??""} ${a("err.validation.required")}`}],[c,e,r,a,i]);return o.jsx(S,{title:h,children:o.jsx(p.Form.Item,{...w,label:e,rules:F,children:o.jsx(p.InputNumber,{ref:B,disabled:I,defaultValue:j,value:A,readOnly:$,addonBefore:R,minLength:N,addonAfter:f,step:u?1:void 0,pattern:u?"d*":l,onChange:g,onPressEnter:t=>L.onEnterInternalTextField(t,T,q,x),className:"max-width",min:d===null?void 0:d??0,max:E,type:n?void 0:"number",size:C,formatter:n?t=>{if(t.includes(".")){const s=`${t}`.split(".");return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),s.join(".")}else return`${t}`.replace(/\B(?=(\d{3})+(?!\d))/g,",")}:void 0,parser:n?t=>t==null?void 0:t.replace(/\$\s?|(,*)/g,""):void 0,placeholder:r??e})})})});module.exports=O;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Form as P, InputNumber as R } from "antd";
|
|
3
|
+
import { forwardRef as S, useMemo as F } from "react";
|
|
4
|
+
import { useTranslation as L } from "react-i18next";
|
|
5
|
+
import { TRANSLATION_NAMESPACE as O } from "../../../locale/hooks/translation-constants.js";
|
|
6
|
+
import _ from "../tooltip/TooltipComponent.js";
|
|
7
|
+
import { onEnterInternalTextField as b } from "./TextField.js";
|
|
8
|
+
const K = S(
|
|
9
|
+
function({
|
|
10
|
+
// eslint-disable-next-line no-unused-vars
|
|
11
|
+
type: q,
|
|
12
|
+
required: m,
|
|
13
|
+
label: t,
|
|
14
|
+
rules: s = [],
|
|
15
|
+
placeholder: o,
|
|
16
|
+
onEnter: c,
|
|
17
|
+
form: a,
|
|
18
|
+
nextFocus: u,
|
|
19
|
+
min: p,
|
|
20
|
+
moneyField: e,
|
|
21
|
+
addonAfter: N,
|
|
22
|
+
minLength: T,
|
|
23
|
+
defaultValue: x,
|
|
24
|
+
pattern: $,
|
|
25
|
+
disabled: g,
|
|
26
|
+
readOnly: l,
|
|
27
|
+
onChange: A,
|
|
28
|
+
value: E,
|
|
29
|
+
max: I,
|
|
30
|
+
addonBefore: h,
|
|
31
|
+
size: j,
|
|
32
|
+
isInt: d = !1,
|
|
33
|
+
tooltip: w,
|
|
34
|
+
...B
|
|
35
|
+
}, C) {
|
|
36
|
+
const { t: f } = L(O), M = F(
|
|
37
|
+
() => [
|
|
38
|
+
...s,
|
|
39
|
+
{
|
|
40
|
+
required: m,
|
|
41
|
+
message: `${t ?? o ?? ""} ${f(
|
|
42
|
+
"err.validation.required"
|
|
43
|
+
)}`
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
[s, t, o, f, m]
|
|
47
|
+
);
|
|
48
|
+
return /* @__PURE__ */ i(_, { title: w, children: /* @__PURE__ */ i(P.Item, { ...B, label: t, rules: M, children: /* @__PURE__ */ i(
|
|
49
|
+
R,
|
|
50
|
+
{
|
|
51
|
+
ref: C,
|
|
52
|
+
disabled: g,
|
|
53
|
+
defaultValue: x,
|
|
54
|
+
value: E,
|
|
55
|
+
readOnly: l,
|
|
56
|
+
addonBefore: h,
|
|
57
|
+
minLength: T,
|
|
58
|
+
addonAfter: N,
|
|
59
|
+
step: d ? 1 : void 0,
|
|
60
|
+
pattern: d ? "d*" : $,
|
|
61
|
+
onChange: A,
|
|
62
|
+
onPressEnter: (r) => b(r, u, a, c),
|
|
63
|
+
className: "max-width",
|
|
64
|
+
min: p === null ? void 0 : p ?? 0,
|
|
65
|
+
max: I,
|
|
66
|
+
type: e ? void 0 : "number",
|
|
67
|
+
size: j,
|
|
68
|
+
formatter: e ? (r) => {
|
|
69
|
+
if (r.includes(".")) {
|
|
70
|
+
const n = `${r}`.split(".");
|
|
71
|
+
return n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), n.join(".");
|
|
72
|
+
} else
|
|
73
|
+
return `${r}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
74
|
+
} : void 0,
|
|
75
|
+
parser: e ? (r) => r == null ? void 0 : r.replace(/\$\s?|(,*)/g, "") : void 0,
|
|
76
|
+
placeholder: o ?? t
|
|
77
|
+
}
|
|
78
|
+
) }) });
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
export {
|
|
82
|
+
K as default
|
|
83
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),i=require("../../../util/ValidationUtil.cjs"),l=require("./TextField.cjs"),r=e=>t.jsx(l.default,{...e,rules:[...e.rules??[],...i.phoneValidation(e.label??e.placeholder??"")]});module.exports=r;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import t from "../../../util/ValidationUtil.js";
|
|
3
|
+
import i from "./TextField.js";
|
|
4
|
+
const m = (e) => /* @__PURE__ */ l(
|
|
5
|
+
i,
|
|
6
|
+
{
|
|
7
|
+
...e,
|
|
8
|
+
rules: [
|
|
9
|
+
...e.rules ?? [],
|
|
10
|
+
...t.phoneValidation(
|
|
11
|
+
e.label ?? e.placeholder ?? ""
|
|
12
|
+
)
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
export {
|
|
17
|
+
m as default
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),i=require("antd"),x=require("react-i18next"),A=require("../../../locale/hooks/translation-constants.cjs"),c=(n,e,t,r)=>{var s;e&&t&&(n.preventDefault(),(s=t==null?void 0:t.getFieldInstance(e))==null||s.focus()),r&&r(n)},q=({required:n,label:e,rules:t=[],placeholder:r,onEnter:s,nextFocus:l,className:o,...u})=>{const{t:d}=x.useTranslation(A.TRANSLATION_NAMESPACE),I=i.Form.useFormInstance();return a.jsx(i.Form.Item,{...u,className:o,label:e,rules:[...t,{required:n,message:`${e} ${d("err.validation.required")}`}],children:a.jsx(i.Input.TextArea,{...u,className:o,onPressEnter:T=>c(T,l,I,s),placeholder:r??e})})};exports.default=q;exports.onEnterInternalTextField=c;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Form as m, Input as l } from "antd";
|
|
3
|
+
import { useTranslation as A } from "react-i18next";
|
|
4
|
+
import { TRANSLATION_NAMESPACE as I } from "../../../locale/hooks/translation-constants.js";
|
|
5
|
+
const T = (r, e, t, n) => {
|
|
6
|
+
var o;
|
|
7
|
+
e && t && (r.preventDefault(), (o = t == null ? void 0 : t.getFieldInstance(e)) == null || o.focus()), n && n(r);
|
|
8
|
+
}, g = ({
|
|
9
|
+
required: r,
|
|
10
|
+
label: e,
|
|
11
|
+
rules: t = [],
|
|
12
|
+
placeholder: n,
|
|
13
|
+
onEnter: o,
|
|
14
|
+
nextFocus: u,
|
|
15
|
+
className: i,
|
|
16
|
+
...s
|
|
17
|
+
}) => {
|
|
18
|
+
const { t: c } = A(I), d = m.useFormInstance();
|
|
19
|
+
return /* @__PURE__ */ a(
|
|
20
|
+
m.Item,
|
|
21
|
+
{
|
|
22
|
+
...s,
|
|
23
|
+
className: i,
|
|
24
|
+
label: e,
|
|
25
|
+
rules: [
|
|
26
|
+
...t,
|
|
27
|
+
{
|
|
28
|
+
required: r,
|
|
29
|
+
message: `${e} ${c("err.validation.required")}`
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
children: /* @__PURE__ */ a(
|
|
33
|
+
l.TextArea,
|
|
34
|
+
{
|
|
35
|
+
...s,
|
|
36
|
+
className: i,
|
|
37
|
+
onPressEnter: (p) => T(p, u, d, o),
|
|
38
|
+
placeholder: n ?? e
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
g as default,
|
|
46
|
+
T as onEnterInternalTextField
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),O=require("@ant-design/icons"),c=require("antd"),R=require("react"),_=require("react-i18next"),w=require("../../../locale/hooks/translation-constants.cjs"),L=require("../tooltip/TooltipComponent.cjs"),d=(t,n,e,i)=>{var s;n&&e&&(t.preventDefault(),(s=e==null?void 0:e.getFieldInstance(n))==null||s.focus()),i&&i(t)},$=({type:t,required:n,label:e,disabled:i,rules:s=[],placeholder:a,onEnter:l,size:p,form:x,addonAfter:I,addonBefore:T,nextFocus:g,autoComplete:m="off",defaultValue:q,readOnly:f,value:j,loading:v,onBlur:A,inputRef:C,status:E,autoFocus:P,onChange:D,tooltip:F,...M})=>{const{t:u}=_.useTranslation(w.TRANSLATION_NAMESPACE),S=R.useMemo(()=>{const r=[...s,{required:n,message:`${e??a??""} ${u("err.validation.required")}`}];return t==="email"&&r.push({type:"email",message:u("err.validation.invalidEmail")}),r},[s,n,e,a,u,t]),h={disabled:i,value:j,readOnly:f,defaultValue:q,autoFocus:P,addonBefore:T,ref:C,onBlur:A,addonAfter:v?o.jsx(O.LoadingOutlined,{}):I,status:E,size:p,autoComplete:m,onPressEnter:r=>d(r,g,x,l),type:t,placeholder:a??e},N=t=="password"?c.Input.Password:c.Input;return o.jsx(L,{title:F,children:o.jsx(c.Form.Item,{...M,label:e,rules:S,children:o.jsx(N,{...h})})})};exports.default=$;exports.onEnterInternalTextField=d;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingOutlined as O } from "@ant-design/icons";
|
|
3
|
+
import { Input as d, Form as S } from "antd";
|
|
4
|
+
import { useMemo as $ } from "react";
|
|
5
|
+
import { useTranslation as j } from "react-i18next";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as D } from "../../../locale/hooks/translation-constants.js";
|
|
7
|
+
import R from "../tooltip/TooltipComponent.js";
|
|
8
|
+
const _ = (o, n, t, r) => {
|
|
9
|
+
var i;
|
|
10
|
+
n && t && (o.preventDefault(), (i = t == null ? void 0 : t.getFieldInstance(n)) == null || i.focus()), r && r(o);
|
|
11
|
+
}, Q = ({
|
|
12
|
+
type: o,
|
|
13
|
+
required: n,
|
|
14
|
+
label: t,
|
|
15
|
+
disabled: r,
|
|
16
|
+
rules: i = [],
|
|
17
|
+
placeholder: m,
|
|
18
|
+
onEnter: p,
|
|
19
|
+
size: f,
|
|
20
|
+
form: l,
|
|
21
|
+
addonAfter: u,
|
|
22
|
+
addonBefore: c,
|
|
23
|
+
nextFocus: T,
|
|
24
|
+
autoComplete: g = "off",
|
|
25
|
+
defaultValue: A,
|
|
26
|
+
readOnly: I,
|
|
27
|
+
value: v,
|
|
28
|
+
loading: C,
|
|
29
|
+
onBlur: E,
|
|
30
|
+
inputRef: P,
|
|
31
|
+
status: h,
|
|
32
|
+
autoFocus: x,
|
|
33
|
+
onChange: k,
|
|
34
|
+
tooltip: F,
|
|
35
|
+
...N
|
|
36
|
+
}) => {
|
|
37
|
+
const { t: a } = j(D), w = $(() => {
|
|
38
|
+
const e = [
|
|
39
|
+
...i,
|
|
40
|
+
{
|
|
41
|
+
required: n,
|
|
42
|
+
message: `${t ?? m ?? ""} ${a(
|
|
43
|
+
"err.validation.required"
|
|
44
|
+
)}`
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
return o === "email" && e.push({
|
|
48
|
+
type: "email",
|
|
49
|
+
message: a("err.validation.invalidEmail")
|
|
50
|
+
}), e;
|
|
51
|
+
}, [i, n, t, m, a, o]), L = {
|
|
52
|
+
disabled: r,
|
|
53
|
+
value: v,
|
|
54
|
+
readOnly: I,
|
|
55
|
+
defaultValue: A,
|
|
56
|
+
autoFocus: x,
|
|
57
|
+
addonBefore: c,
|
|
58
|
+
ref: P,
|
|
59
|
+
onBlur: E,
|
|
60
|
+
addonAfter: C ? /* @__PURE__ */ s(O, {}) : u,
|
|
61
|
+
status: h,
|
|
62
|
+
size: f,
|
|
63
|
+
autoComplete: g,
|
|
64
|
+
onPressEnter: (e) => _(e, T, l, p),
|
|
65
|
+
type: o,
|
|
66
|
+
placeholder: m ?? t
|
|
67
|
+
}, M = o == "password" ? d.Password : d;
|
|
68
|
+
return /* @__PURE__ */ s(R, { title: F, children: /* @__PURE__ */ s(S.Item, { ...N, label: t, rules: w, children: /* @__PURE__ */ s(M, { ...L }) }) });
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
Q as default,
|
|
72
|
+
_ as onEnterInternalTextField
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),e=require("antd"),n=({children:t,title:o})=>o?r.jsx(e.Tooltip,{title:o,children:t}):t;module.exports=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),a=require("@ant-design/icons"),y=require("antd"),o=require("i18next"),A=require("react-i18next"),d=require("../button/Button.cjs"),T=require("../../../locale/hooks/translation-constants.cjs"),h=({errorChildren:l,children:v,onRetry:r,onClickBack:c,success:n,loading:s,error:e,successTitle:x=o.t("str.success"),successMessage:j,errorMessage:u=o.t("err.save"),errorTitle:m=o.t("str.error"),loadingTitle:p=o.t("message.loading.saving"),loadingMessage:q})=>{const{t:i}=A.useTranslation(T.TRANSLATION_NAMESPACE);return t.jsx(y.Result,{status:s?void 0:n?"success":e?["403","404","500"].includes(e==null?void 0:e.code)?e.code:e?"error":void 0:void 0,title:s?p:n?x:e?m:void 0,icon:s?t.jsx(a.LoadingOutlined,{}):void 0,subTitle:s?q:n?j:e?typeof u=="function"?u()??i("err.save"):u??i("err.save"):void 0,extra:[n?t.jsx(t.Fragment,{children:v}):e?t.jsxs(t.Fragment,{children:[!!c&&t.jsx(d,{onClick:c,htmlType:"button",type:"primary",icon:t.jsx(a.ArrowLeftOutlined,{}),children:i("str.previous")}),!!r&&t.jsx(d,{type:"primary",onClick:()=>r(void 0,void 0,!0),children:i("str.retry")},"retry"),l]}):t.jsx(t.Fragment,{})]})};module.exports=h;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as i, Fragment as d, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingOutlined as h, ArrowLeftOutlined as x } from "@ant-design/icons";
|
|
3
|
+
import { Result as C } from "antd";
|
|
4
|
+
import { t as m } from "i18next";
|
|
5
|
+
import { useTranslation as L } from "react-i18next";
|
|
6
|
+
import l from "../button/Button.js";
|
|
7
|
+
import { TRANSLATION_NAMESPACE as N } from "../../../locale/hooks/translation-constants.js";
|
|
8
|
+
const w = ({
|
|
9
|
+
errorChildren: u,
|
|
10
|
+
children: a,
|
|
11
|
+
onRetry: p,
|
|
12
|
+
onClickBack: r,
|
|
13
|
+
success: o,
|
|
14
|
+
loading: e,
|
|
15
|
+
error: t,
|
|
16
|
+
successTitle: v = m("str.success"),
|
|
17
|
+
successMessage: f,
|
|
18
|
+
errorMessage: s = m("err.save"),
|
|
19
|
+
errorTitle: c = m("str.error"),
|
|
20
|
+
loadingTitle: y = m("message.loading.saving"),
|
|
21
|
+
loadingMessage: A
|
|
22
|
+
}) => {
|
|
23
|
+
const { t: n } = L(N);
|
|
24
|
+
return /* @__PURE__ */ i(
|
|
25
|
+
C,
|
|
26
|
+
{
|
|
27
|
+
status: e ? void 0 : o ? "success" : t ? ["403", "404", "500"].includes(t == null ? void 0 : t.code) ? t.code : t ? "error" : void 0 : void 0,
|
|
28
|
+
title: e ? y : o ? v : t ? c : void 0,
|
|
29
|
+
icon: e ? /* @__PURE__ */ i(h, {}) : void 0,
|
|
30
|
+
subTitle: e ? A : o ? f : t ? typeof s == "function" ? s() ?? n("err.save") : s ?? n("err.save") : void 0,
|
|
31
|
+
extra: [
|
|
32
|
+
o ? /* @__PURE__ */ i(d, { children: a }) : t ? /* @__PURE__ */ T(d, { children: [
|
|
33
|
+
!!r && /* @__PURE__ */ i(
|
|
34
|
+
l,
|
|
35
|
+
{
|
|
36
|
+
onClick: r,
|
|
37
|
+
htmlType: "button",
|
|
38
|
+
type: "primary",
|
|
39
|
+
icon: /* @__PURE__ */ i(x, {}),
|
|
40
|
+
children: n("str.previous")
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
!!p && /* @__PURE__ */ i(
|
|
44
|
+
l,
|
|
45
|
+
{
|
|
46
|
+
type: "primary",
|
|
47
|
+
onClick: () => p(void 0, void 0, !0),
|
|
48
|
+
children: n("str.retry")
|
|
49
|
+
},
|
|
50
|
+
"retry"
|
|
51
|
+
),
|
|
52
|
+
u
|
|
53
|
+
] }) : /* @__PURE__ */ i(d, {})
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
w as default
|
|
60
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),w=require("antd"),o=require("react"),F=require("../appearance/Hider.cjs"),{Step:R}=w.Steps,y=o.forwardRef(({pages:d,onSubmit:u,initPosition:f=0,progressDot:v,type:b,labelPlacement:g,className:k,pageStyle:q},C)=>{const[s,i]=o.useState(0),[r,p]=o.useState([]);o.useEffect(()=>{i(f)},[f]),o.useImperativeHandle(C,()=>({gotTo:t=>i(t)}),[]);const m=o.useCallback((t,a=!1,l=!1)=>{const e=[...r];if(t!==void 0&&(e[s]=t,p(e)),l||i(s+1),a&&u){const n={};for(const x of e)for(const S in x)n[S]=x[S];u(e,n)}},[s,r,u]),h=o.useCallback(()=>{const t=[...r];t[s]=void 0,p(t),i(s-1)},[s,r]),j=o.useMemo(()=>{const t=[],a=[],l=d.filter(e=>!e.hidden);for(let e=0;e<l.length;e++){const n=l[e];a.push(c.jsx(F,{hide:s!==e,children:n.component({forward:m,backward:h},r,s===e)},`${n.title}${e}`)),t.push(c.jsx(R,{icon:n.icon,title:n.title},n.title))}return{_pages:a,steps:t}},[h,s,r,m,d]);return c.jsxs(c.Fragment,{children:[c.jsx(w.Steps,{labelPlacement:g,progressDot:v,className:[k,"pb-3"].join(" "),current:s,type:b,children:j.steps}),c.jsx("div",{style:q,children:j._pages})]})});module.exports=y;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as f, jsxs as H, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { Steps as b } from "antd";
|
|
3
|
+
import { forwardRef as $, useState as S, useEffect as z, useImperativeHandle as E, useCallback as g, useMemo as I } from "react";
|
|
4
|
+
import M from "../appearance/Hider.js";
|
|
5
|
+
const { Step: N } = b, q = $(
|
|
6
|
+
({
|
|
7
|
+
pages: a,
|
|
8
|
+
onSubmit: l,
|
|
9
|
+
initPosition: d = 0,
|
|
10
|
+
progressDot: j,
|
|
11
|
+
type: k,
|
|
12
|
+
labelPlacement: x,
|
|
13
|
+
className: F,
|
|
14
|
+
pageStyle: y
|
|
15
|
+
}, C) => {
|
|
16
|
+
const [t, n] = S(0), [r, m] = S(
|
|
17
|
+
[]
|
|
18
|
+
);
|
|
19
|
+
z(() => {
|
|
20
|
+
n(d);
|
|
21
|
+
}, [d]), E(
|
|
22
|
+
C,
|
|
23
|
+
() => ({
|
|
24
|
+
gotTo: (s) => n(s)
|
|
25
|
+
}),
|
|
26
|
+
[]
|
|
27
|
+
);
|
|
28
|
+
const p = g(
|
|
29
|
+
(s, c = !1, i = !1) => {
|
|
30
|
+
const e = [...r];
|
|
31
|
+
if (s !== void 0 && (e[t] = s, m(e)), i || n(t + 1), c && l) {
|
|
32
|
+
const o = {};
|
|
33
|
+
for (const w of e)
|
|
34
|
+
for (const v in w)
|
|
35
|
+
o[v] = w[v];
|
|
36
|
+
l(e, o);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
[t, r, l]
|
|
40
|
+
), u = g(() => {
|
|
41
|
+
const s = [...r];
|
|
42
|
+
s[t] = void 0, m(s), n(t - 1);
|
|
43
|
+
}, [t, r]), h = I(() => {
|
|
44
|
+
const s = [], c = [], i = a.filter((e) => !e.hidden);
|
|
45
|
+
for (let e = 0; e < i.length; e++) {
|
|
46
|
+
const o = i[e];
|
|
47
|
+
c.push(
|
|
48
|
+
/* @__PURE__ */ f(M, { hide: t !== e, children: o.component({ forward: p, backward: u }, r, t === e) }, `${o.title}${e}`)
|
|
49
|
+
), s.push(/* @__PURE__ */ f(N, { icon: o.icon, title: o.title }, o.title));
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
_pages: c,
|
|
53
|
+
steps: s
|
|
54
|
+
};
|
|
55
|
+
}, [u, t, r, p, a]);
|
|
56
|
+
return /* @__PURE__ */ H(_, { children: [
|
|
57
|
+
/* @__PURE__ */ f(
|
|
58
|
+
b,
|
|
59
|
+
{
|
|
60
|
+
labelPlacement: x,
|
|
61
|
+
progressDot: j,
|
|
62
|
+
className: [F, "pb-3"].join(" "),
|
|
63
|
+
current: t,
|
|
64
|
+
type: k,
|
|
65
|
+
children: h.steps
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ f("div", { style: y, children: h._pages })
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
export {
|
|
73
|
+
q as default
|
|
74
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),y=require("antd"),ae=require("dayjs"),o=require("react"),le=require("react-i18next"),ie=require("../../locale/hooks/translation-constants.cjs"),ce=require("./CrudForm.cjs"),re=require("./CrudFormWizard.cjs"),ue=require("./import/CrudImportButton.cjs"),de=require("./view/CrudViewer.cjs"),fe=require("../common/button/NewButton.cjs"),pe=require("../common/button/PrintButton.cjs"),{useForm:me}=y.Form;function ye({idField:C="id",onCreate:g,onDelete:M,onHide:_,onUpdate:f,fields:l,data:w,grid:D,isHiding:R,isCreating:h,isDeleting:U,isUpdating:q,paginateProps:W,onPrint:N,printing:L,viewable:H,loadingData:G,formBuilder:J,extraAction:K,minusHeight:Q,cloneable:X,fullWidthModal:Y=!0,wizard:i,extraView:Z,importable:P,onClickNew:V,...$}){const{t:v}=le.useTranslation(ie.TRANSLATION_NAMESPACE),[j,x]=o.useState(!1),[p,k]=o.useState(),[z,B]=o.useState(),[c]=me(),A=o.useCallback(async s=>{const u=i?s:await c.validateFields(),r=l.filter(e=>e.type==="color"),a={};r.forEach(e=>{var d;const t=c.getFieldValue(e.name);a[e.name]=typeof t=="string"?t:(d=t==null?void 0:t.toHexString())==null?void 0:d.toUpperCase()}),Object.assign(u,a),p&&f?(await f({...u,[C]:p[C]}),k(void 0)):!p&&g&&await g(u),B(void 0),c.resetFields(),x(!1)},[l,c,C,g,f,p,i]),[ee,I]=o.useState(!1),[te,S]=o.useState(!1);o.useEffect(()=>{j?(I(!1),S(!1)):F(void 0)},[j]);const O=o.useCallback(async s=>{I(s),S(!0)},[]),T=o.useCallback(async()=>{S(!0)},[]),[ne,E]=o.useState(!1),b=o.useCallback(async(s,u=!0,r=!1)=>{try{E(!0),x(!0),u&&F("update");const a={};for(const e of l){const t=s[e.name];if(r&&e.type==="image"){const d=t;try{const oe=await e.provider.clone(d);a[e.name]=oe;continue}catch{continue}}e.type==="date"?t&&(a[e.name]=ae(t)):e.type==="select"?e.multiple&&Array.isArray(t)?a[e.name]=t.map(d=>d[e.innerFieldId??"id"]):t&&typeof t=="object"?a[e.name]=t[e.innerFieldId??"id"]:(t&&typeof t=="string"||typeof t=="number")&&(a[e.name]=t):a[e.name]=t}c.setFieldsValue(a),B(a),u&&k(s)}finally{E(!1)}},[l,c]),[m,F]=o.useState(),se=o.useCallback(async s=>{F("clone"),b(s,!1,!0)},[b]);return n.jsxs(n.Fragment,{children:[n.jsxs(y.Space,{direction:"vertical",className:"w-100",children:[n.jsxs("div",{className:"w-100 d-flex",children:[n.jsx("div",{style:{flex:1},children:n.jsx(fe.NewButton,{onClick:()=>{V?V():(x(s=>!s),F("new"))},className:"flex-1"})}),n.jsxs(y.Space,{children:[!!N&&n.jsx(pe.PrintButton,{className:"float-right",loading:L,onClick:N}),!!P&&n.jsx(ue,{fields:l,importProps:P})]})]}),n.jsx(de,{...$,minusHeight:Q,data:w,fields:l,extraAction:K,idField:C,isDeleting:U,loadingData:G,onClickUpdate:f?b:void 0,onHide:_,isHiding:R,onDelete:M,onUpdate:f,onClickClone:X?se:void 0,paginateProps:W,viewable:H,extraView:Z})]}),n.jsx(y.Modal,{width:Y?"100%":void 0,title:v(m??"new"),open:j,confirmLoading:h||q,okText:v("str."+(m==="update"?"update":"save")),cancelText:v("str.cancel"),cancelButtonProps:{disabled:te,hidden:!!i},okButtonProps:{disabled:ee,hidden:!!i},onCancel:async()=>{try{if(m==="clone"){const s=i?p:c.getFieldsValue(),u=l.filter(r=>r.type==="image");for(const r of u)s[r.name]&&r.provider.delete(s[r.name])}}finally{}i||c.resetFields(),B(void 0),k(void 0),x(!1)},onOk:()=>A(),destroyOnClose:!0,children:n.jsxs(y.Spin,{spinning:ne,children:[!i&&n.jsx(ce.CrudForm,{purpose:m,fields:l,form:c,formBuilder:J,grid:D,onDeleteFile:T,onUploadFile:O}),i&&n.jsx(re,{submitting:h||q,className:"mt-2",onSave:A,updatingValue:z,fields:l,onDeleteFile:T,onUploadFile:O,purpose:m,wizard:i})]})})]})}module.exports=ye;
|