@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.
Files changed (119) hide show
  1. package/dist/components/common/DatePicker/DatePicker.cjs +1 -0
  2. package/dist/components/common/DatePicker/DatePicker.js +88 -0
  3. package/dist/components/common/DatePicker/TimePicker.cjs +1 -0
  4. package/dist/components/common/DatePicker/TimePicker.js +78 -0
  5. package/dist/components/common/appearance/Hider.cjs +1 -0
  6. package/dist/components/common/appearance/Hider.js +5 -0
  7. package/dist/components/common/button/Button.cjs +1 -0
  8. package/dist/components/common/button/Button.js +64 -0
  9. package/dist/components/common/button/CloneButtonTable.cjs +1 -0
  10. package/dist/components/common/button/CloneButtonTable.js +20 -0
  11. package/dist/components/common/button/DeleteButtonTable.cjs +1 -0
  12. package/dist/components/common/button/DeleteButtonTable.js +68 -0
  13. package/dist/components/common/button/ExportButton.cjs +1 -0
  14. package/dist/components/common/button/ExportButton.js +27 -0
  15. package/dist/components/common/button/HideButtonTable.cjs +1 -0
  16. package/dist/components/common/button/HideButtonTable.js +68 -0
  17. package/dist/components/common/button/ImportButton.cjs +1 -0
  18. package/dist/components/common/button/ImportButton.js +56 -0
  19. package/dist/components/common/button/NewButton.cjs +1 -0
  20. package/dist/components/common/button/NewButton.js +24 -0
  21. package/dist/components/common/button/PrintButton.cjs +1 -0
  22. package/dist/components/common/button/PrintButton.js +26 -0
  23. package/dist/components/common/button/RefreshButton.cjs +1 -0
  24. package/dist/components/common/button/RefreshButton.js +24 -0
  25. package/dist/components/common/button/UnHideButton.cjs +1 -0
  26. package/dist/components/common/button/UnHideButton.js +70 -0
  27. package/dist/components/common/button/UpdateButtonTable.cjs +1 -0
  28. package/dist/components/common/button/UpdateButtonTable.js +20 -0
  29. package/dist/components/common/button/ViewButtonTable.cjs +1 -0
  30. package/dist/components/common/button/ViewButtonTable.js +20 -0
  31. package/dist/components/common/check-box/CheckBox.cjs +1 -0
  32. package/dist/components/common/check-box/CheckBox.js +40 -0
  33. package/dist/components/common/description/DescList.cjs +1 -0
  34. package/dist/components/common/description/DescList.js +16 -0
  35. package/dist/components/common/layout/VerticalSpace.cjs +1 -0
  36. package/dist/components/common/layout/VerticalSpace.js +6 -0
  37. package/dist/components/common/loading/LoadingIndicator.cjs +1 -0
  38. package/dist/components/common/loading/LoadingIndicator.js +24 -0
  39. package/dist/components/common/picker/ImagePicker.cjs +1 -0
  40. package/dist/components/common/picker/ImagePicker.js +282 -0
  41. package/dist/components/common/radio/RadioGroupComponent.cjs +1 -0
  42. package/dist/components/common/radio/RadioGroupComponent.js +19 -0
  43. package/dist/components/common/report/SelectFieldInReport.cjs +1 -0
  44. package/dist/components/common/report/SelectFieldInReport.js +30 -0
  45. package/dist/components/common/select/CustomSelectOption.cjs +1 -0
  46. package/dist/components/common/select/CustomSelectOption.js +13 -0
  47. package/dist/components/common/select/SelectComponent.cjs +1 -0
  48. package/dist/components/common/select/SelectComponent.js +89 -0
  49. package/dist/components/common/show-more/index.cjs +1 -0
  50. package/dist/components/common/show-more/index.js +8 -0
  51. package/dist/components/common/tab/TabViewWithRoute.cjs +1 -0
  52. package/dist/components/common/tab/TabViewWithRoute.js +38 -0
  53. package/dist/components/common/table/table.cjs +1 -0
  54. package/dist/components/common/table/table.js +40 -0
  55. package/dist/components/common/tag/StatusTag.cjs +1 -0
  56. package/dist/components/common/tag/StatusTag.js +30 -0
  57. package/dist/components/common/text/index.cjs +1 -0
  58. package/dist/components/common/text/index.js +5 -0
  59. package/dist/components/common/text/title/index.cjs +1 -0
  60. package/dist/components/common/text/title/index.js +5 -0
  61. package/dist/components/common/text-field/NumberField.cjs +1 -0
  62. package/dist/components/common/text-field/NumberField.js +83 -0
  63. package/dist/components/common/text-field/PhoneNumberField.cjs +1 -0
  64. package/dist/components/common/text-field/PhoneNumberField.js +18 -0
  65. package/dist/components/common/text-field/TextArea.cjs +1 -0
  66. package/dist/components/common/text-field/TextArea.js +47 -0
  67. package/dist/components/common/text-field/TextField.cjs +1 -0
  68. package/dist/components/common/text-field/TextField.js +73 -0
  69. package/dist/components/common/tooltip/TooltipComponent.cjs +1 -0
  70. package/dist/components/common/tooltip/TooltipComponent.js +9 -0
  71. package/dist/components/common/wizard/WizardResult.cjs +1 -0
  72. package/dist/components/common/wizard/WizardResult.js +60 -0
  73. package/dist/components/common/wizard/WizardViewForm.cjs +1 -0
  74. package/dist/components/common/wizard/WizardViewForm.js +74 -0
  75. package/dist/components/crud/CrudComponent.cjs +1 -0
  76. package/dist/components/crud/CrudComponent.js +210 -0
  77. package/dist/components/crud/CrudField.cjs +1 -0
  78. package/dist/components/crud/CrudField.js +459 -0
  79. package/dist/components/crud/CrudForm.cjs +1 -0
  80. package/dist/components/crud/CrudForm.js +91 -0
  81. package/dist/components/crud/CrudFormWizard.cjs +1 -0
  82. package/dist/components/crud/CrudFormWizard.js +140 -0
  83. package/dist/components/crud/CrudReportComponent.cjs +4 -0
  84. package/dist/components/crud/CrudReportComponent.js +255 -0
  85. package/dist/components/crud/CrudSearchComponent.cjs +1 -0
  86. package/dist/components/crud/CrudSearchComponent.js +95 -0
  87. package/dist/components/crud/FileCrudField.cjs +1 -0
  88. package/dist/components/crud/FileCrudField.js +220 -0
  89. package/dist/components/crud/ImageCrudField.cjs +1 -0
  90. package/dist/components/crud/ImageCrudField.js +113 -0
  91. package/dist/components/crud/import/CrudImportButton.cjs +1 -0
  92. package/dist/components/crud/import/CrudImportButton.js +31 -0
  93. package/dist/components/crud/import/CrudImportComponent.cjs +2 -0
  94. package/dist/components/crud/import/CrudImportComponent.js +221 -0
  95. package/dist/components/crud/view/CrudDecListView.cjs +1 -0
  96. package/dist/components/crud/view/CrudDecListView.js +42 -0
  97. package/dist/components/crud/view/CrudViewer.cjs +1 -0
  98. package/dist/components/crud/view/CrudViewer.js +217 -0
  99. package/dist/components/crud/view/CrudViewerUtil.cjs +1 -0
  100. package/dist/components/crud/view/CrudViewerUtil.js +57 -0
  101. package/dist/index.cjs +1 -1
  102. package/dist/index.js +10 -10
  103. package/dist/locale/hooks/translation-constants.cjs +1 -0
  104. package/dist/locale/hooks/translation-constants.js +4 -0
  105. package/dist/locale/index.cjs +1 -0
  106. package/dist/locale/index.js +33 -0
  107. package/dist/locale/translations/en.cjs +1 -0
  108. package/dist/locale/translations/en.js +60 -0
  109. package/dist/util/DateUtil.cjs +1 -0
  110. package/dist/util/DateUtil.js +6 -0
  111. package/dist/util/ImageUtil.cjs +1 -0
  112. package/dist/util/ImageUtil.js +63 -0
  113. package/dist/util/NumberUtil.cjs +1 -0
  114. package/dist/util/NumberUtil.js +60 -0
  115. package/dist/util/ValidationUtil.cjs +1 -0
  116. package/dist/util/ValidationUtil.js +60 -0
  117. package/dist/util/index.cjs +1 -1
  118. package/dist/util/index.js +4 -4
  119. package/package.json +1 -1
@@ -0,0 +1,70 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { UpCircleOutlined as c } from "@ant-design/icons";
3
+ import { Popconfirm as g } from "antd";
4
+ import { useMemo as x, useState as A, useEffect as U, useCallback as _ } from "react";
5
+ import { useTranslation as k } from "react-i18next";
6
+ import d from "./Button.js";
7
+ import { TRANSLATION_NAMESPACE as E } from "../../../locale/hooks/translation-constants.js";
8
+ function O({
9
+ shouldConfirm: C = !0,
10
+ block: e,
11
+ value: i,
12
+ loading: a,
13
+ onClick: s,
14
+ text: f,
15
+ disabled: l,
16
+ type: m = "link",
17
+ hidden: T
18
+ }) {
19
+ const { t } = k(E), n = x(() => f ?? t("str.unhide"), [f, t]), [u, r] = A(!1);
20
+ U(() => {
21
+ r(a ?? !1);
22
+ }, [a]);
23
+ const p = _(
24
+ async () => {
25
+ try {
26
+ r(!0), await s(i);
27
+ } finally {
28
+ r(!1);
29
+ }
30
+ },
31
+ [s, i]
32
+ );
33
+ return C ? /* @__PURE__ */ o(
34
+ g,
35
+ {
36
+ title: t("qus.doYouWantToHide"),
37
+ okText: n.toUpperCase(),
38
+ cancelText: t("str.no").toUpperCase(),
39
+ onConfirm: p,
40
+ children: /* @__PURE__ */ o(
41
+ d,
42
+ {
43
+ tooltip: n,
44
+ icon: /* @__PURE__ */ o(c, {}),
45
+ disabled: l,
46
+ loading: u,
47
+ type: m,
48
+ danger: !0,
49
+ hidden: T,
50
+ block: e
51
+ }
52
+ )
53
+ }
54
+ ) : /* @__PURE__ */ o(
55
+ d,
56
+ {
57
+ tooltip: n,
58
+ icon: /* @__PURE__ */ o(c, {}),
59
+ disabled: l,
60
+ loading: u,
61
+ type: m,
62
+ danger: !0,
63
+ block: e,
64
+ onClick: p
65
+ }
66
+ );
67
+ }
68
+ export {
69
+ O as default
70
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),o=require("@ant-design/icons"),r=require("react-i18next"),i=require("./Button.cjs"),u=require("../../../locale/hooks/translation-constants.cjs");function c({value:n,onClick:e}){const{t:s}=r.useTranslation(u.TRANSLATION_NAMESPACE);return t.jsx(i,{tooltip:s("str.update"),type:"link",onClick:()=>e(n),icon:t.jsx(o.EditOutlined,{})})}module.exports=c;
@@ -0,0 +1,20 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { EditOutlined as i } from "@ant-design/icons";
3
+ import { useTranslation as m } from "react-i18next";
4
+ import p from "./Button.js";
5
+ import { TRANSLATION_NAMESPACE as e } from "../../../locale/hooks/translation-constants.js";
6
+ function d({ value: o, onClick: r }) {
7
+ const { t: n } = m(e);
8
+ return /* @__PURE__ */ t(
9
+ p,
10
+ {
11
+ tooltip: n("str.update"),
12
+ type: "link",
13
+ onClick: () => r(o),
14
+ icon: /* @__PURE__ */ t(i, {})
15
+ }
16
+ );
17
+ }
18
+ export {
19
+ d as default
20
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),i=require("@ant-design/icons"),o=require("react-i18next"),r=require("./Button.cjs"),u=require("../../../locale/hooks/translation-constants.cjs");function c({value:n,onClick:e}){const{t:s}=o.useTranslation(u.TRANSLATION_NAMESPACE);return t.jsx(r,{type:"link",onClick:()=>e(n),icon:t.jsx(i.EyeOutlined,{}),tooltip:s("str.view")})}module.exports=c;
@@ -0,0 +1,20 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { EyeOutlined as n } from "@ant-design/icons";
3
+ import { useTranslation as e } from "react-i18next";
4
+ import m from "./Button.js";
5
+ import { TRANSLATION_NAMESPACE as p } from "../../../locale/hooks/translation-constants.js";
6
+ function c({ value: t, onClick: r }) {
7
+ const { t: i } = e(p);
8
+ return /* @__PURE__ */ o(
9
+ m,
10
+ {
11
+ type: "link",
12
+ onClick: () => r(t),
13
+ icon: /* @__PURE__ */ o(n, {}),
14
+ tooltip: i("str.view")
15
+ }
16
+ );
17
+ }
18
+ export {
19
+ c as default
20
+ };
@@ -0,0 +1 @@
1
+ "use strict";const r=require("react/jsx-runtime"),s=require("antd"),m=s.Form.Item,x=({onChange:e,label:d,initialValue:c=!1,disabled:n,switch:t=!1,...h})=>r.jsxs(m,{...h,valuePropName:"checked",initialValue:c,label:t?d:void 0,children:[!!t&&r.jsx(s.Switch,{disabled:n,defaultChecked:c,onChange:e&&(o=>e(o))}),!t&&r.jsx(s.Checkbox,{disabled:n,defaultChecked:c,onChange:e&&(o=>e(o.target.checked)),children:d})]});module.exports=x;
@@ -0,0 +1,40 @@
1
+ import { jsxs as h, jsx as d } from "react/jsx-runtime";
2
+ import { Form as k, Switch as s, Checkbox as p } from "antd";
3
+ const x = k.Item, C = ({
4
+ onChange: e,
5
+ label: t,
6
+ initialValue: o = !1,
7
+ disabled: m,
8
+ switch: r = !1,
9
+ ...f
10
+ }) => /* @__PURE__ */ h(
11
+ x,
12
+ {
13
+ ...f,
14
+ valuePropName: "checked",
15
+ initialValue: o,
16
+ label: r ? t : void 0,
17
+ children: [
18
+ !!r && /* @__PURE__ */ d(
19
+ s,
20
+ {
21
+ disabled: m,
22
+ defaultChecked: o,
23
+ onChange: e && ((c) => e(c))
24
+ }
25
+ ),
26
+ !r && /* @__PURE__ */ d(
27
+ p,
28
+ {
29
+ disabled: m,
30
+ defaultChecked: o,
31
+ onChange: e && ((c) => e(c.target.checked)),
32
+ children: t
33
+ }
34
+ )
35
+ ]
36
+ }
37
+ );
38
+ export {
39
+ C as default
40
+ };
@@ -0,0 +1 @@
1
+ "use strict";const n=require("react/jsx-runtime"),o=require("antd"),u=require("react"),a=require("../../../util/NumberUtil.cjs"),l=o.Descriptions.Item,m=({list:r,keepEmptyValues:s,...i})=>{const c=u.useMemo(()=>{const t=s?r:r.filter(e=>e&&!!e.value);return t.forEach(e=>{!e.noFormatting&&!isNaN(e.value)&&(e.value=a.default.toMoney(e.value))}),t},[s,r]);return n.jsx(o.Descriptions,{...i,children:c.map(({label:t,value:e})=>n.jsx(l,{label:t,children:e},t))})};module.exports=m;
@@ -0,0 +1,16 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { Descriptions as n } from "antd";
3
+ import { useMemo as c } from "react";
4
+ import a from "../../../util/NumberUtil.js";
5
+ const u = n.Item, h = ({ list: t, keepEmptyValues: e, ...m }) => {
6
+ const s = c(() => {
7
+ const r = e ? t : t.filter((o) => o && !!o.value);
8
+ return r.forEach((o) => {
9
+ !o.noFormatting && !isNaN(o.value) && (o.value = a.toMoney(o.value));
10
+ }), r;
11
+ }, [e, t]);
12
+ return /* @__PURE__ */ i(n, { ...m, children: s.map(({ label: r, value: o }) => /* @__PURE__ */ i(u, { label: r, children: o }, r)) });
13
+ };
14
+ export {
15
+ h as default
16
+ };
@@ -0,0 +1 @@
1
+ "use strict";const r=require("react/jsx-runtime"),c=require("antd"),s=({children:e,className:t=""})=>r.jsx(c.Space,{direction:"vertical",className:[t,"w-100"].join(" "),children:e});module.exports=s;
@@ -0,0 +1,6 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Space as a } from "antd";
3
+ const i = ({ children: r, className: e = "" }) => /* @__PURE__ */ t(a, { direction: "vertical", className: [e, "w-100"].join(" "), children: r });
4
+ export {
5
+ i as default
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),r=require("antd"),o=require("react-i18next"),i=require("../button/Button.cjs"),c=require("../../../locale/hooks/translation-constants.cjs"),u=({loading:s,children:n,error:a})=>{const{t:e}=o.useTranslation(c.TRANSLATION_NAMESPACE);return t.jsx(r.Skeleton,{loading:s,paragraph:!0,className:"h-100",children:a?t.jsx(r.Result,{status:"404",title:404,subTitle:e("err.notFound"),className:"",extra:t.jsx(i,{to:-1,type:"primary",children:e("str.goBack")})}):n})};module.exports=u;
@@ -0,0 +1,24 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Skeleton as n, Result as s } from "antd";
3
+ import { useTranslation as m } from "react-i18next";
4
+ import i from "../button/Button.js";
5
+ import { TRANSLATION_NAMESPACE as p } from "../../../locale/hooks/translation-constants.js";
6
+ const N = ({ loading: o, children: e, error: a }) => {
7
+ const { t: r } = m(p);
8
+ return (
9
+ // <Spin spinning={loading} className="h-100">
10
+ /* @__PURE__ */ t(n, { loading: o, paragraph: !0, className: "h-100", children: a ? /* @__PURE__ */ t(
11
+ s,
12
+ {
13
+ status: "404",
14
+ title: 404,
15
+ subTitle: r("err.notFound"),
16
+ className: "",
17
+ extra: /* @__PURE__ */ t(i, { to: -1, type: "primary", children: r("str.goBack") })
18
+ }
19
+ ) : e })
20
+ );
21
+ };
22
+ export {
23
+ N as default
24
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime");;/* empty css */;/* empty css */const S=require("@ant-design/icons"),F=require("antd"),s=require("react"),xe=require("react-cropper"),he=require("react-i18next"),je=require("../../../locale/hooks/translation-constants.cjs"),E=require("../button/Button.cjs"),we=require("../../../util/ImageUtil.cjs"),Ce=F.Form.Item;function X(r){return new Promise((d,p)=>{const n=new FileReader;n.readAsDataURL(r),n.onload=()=>d(n.result),n.onerror=f=>p(f)})}const ve=({values:r=[],required:d,buttonType:p,label:n,name:f,onChange:m,aspectRatio:N,buttonTitle:j,hidePreview:w,buttonSize:g="large",showButtonText:x=!0,showOnlyIcon:D=!1,icon:y=t.jsx(S.UploadOutlined,{}),loading:O,maxCount:C=1,onAdd:l,onRemove:U,listType:I,..._})=>{const[Z,ee]=s.useState(""),[te,se]=s.useState(""),[re,z]=s.useState(!1),q=s.useRef(),a=s.useRef(),[i,M]=s.useState([]),[h,k]=s.useState(),ne=s.useRef(),oe=()=>z(!1),ae=async e=>{!e.url&&!e.preview&&(e.preview=await X(e.originFileObj)),se(e.url||e.preview),z(!0),ee(e.name)},[B,R]=s.useState(!1),ie=()=>{},T=e=>{var o;(o=a==null?void 0:a.current)==null||o.cropper.rotate(e?-90:90)};s.useEffect(()=>{m==null||m(i[0],i)},[i,m]);const ce=()=>{var b;const e=(b=a==null?void 0:a.current)==null?void 0:b.cropper.getCroppedCanvas(),{type:o,size:c,name:u,uid:v}=q.current;R(!0),e==null||e.toBlob(async me=>{const ge=Object.assign(new File([me],u,{type:o}),{uid:v}),G=await we.resizeImage(ge),K=await X(G),Q={url:K,name:u,uid:v,type:o,size:c,thumbUrl:K,originFileObj:G};if(l)try{R(!0),await l(Q)}finally{R(!1)}M([Q,...i]),R(!1)}),k(void 0)},le=()=>{k(void 0),q.current=void 0},L=s.useCallback(e=>{const o=e;if(o){q.current=o;const c=new FileReader;c.addEventListener("load",()=>{var u;if(typeof c.result=="string"){k(c.result);const v=localStorage.getItem("cropper.box"),b=v?JSON.parse(v):void 0;b&&((u=a==null?void 0:a.current)==null||u.cropper.setCropBoxData(b)),setTimeout(()=>{H()},100)}}),c.readAsDataURL(o)}},[]);s.useEffect(()=>{if(r!=null&&r.length||typeof r=="string"){const e=Array.isArray(r)?r.map(o=>[{uid:r,url:o}]):[{uid:r,url:r}];M(e)}},[r]);const{t:P}=he.useTranslation(je.TRANSLATION_NAMESPACE),de=s.useMemo(()=>d?{required:d,validator:(e,o,c)=>{h||i!=null&&i.length?c():c(`${n??""} ${P("err.validation.required")}`)}}:void 0,[d,h,i==null?void 0:i.length,n,P]),J=j??P("message.fileUploadMessage2"),V=s.useMemo(()=>t.jsx(Y,{showLoadingIndicator:B,_buttonTitle:J,buttonSize:g,buttonType:p,fileList:i,hidePreview:w,icon:y,loading:O,listType:I,maxCount:C,onChangeFile:L,onRemove:U,showButtonText:x,handlePreview:ae,setFileList:M}),[B,J,g,p,i,w,y,O,I,C,L,U,x]);ne.current=V.props.beforeUpload;const[ue,W]=s.useState(0),[pe,$]=s.useState(0),[A,fe]=s.useState();s.useEffect(()=>{const e=setTimeout(()=>{A&&localStorage.setItem("cropper.box",JSON.stringify(A))},400);return()=>clearTimeout(e)},[A]),s.useEffect(()=>{h||(W(0),$(0))},[h]);const H=s.useCallback(async()=>{var o;const e=(o=a==null?void 0:a.current)==null?void 0:o.cropper;if(e){const{width:c,height:u}=e.getCroppedCanvas();fe(e.getCropBoxData()),W(c),$(u)}},[]);return t.jsxs(t.Fragment,{children:[t.jsx(Ce,{label:n,..._,name:f,className:"mb-0",rules:[de,..._.rules??[]],children:V}),t.jsxs(F.Modal,{open:!!h,maskClosable:!1,onOk:ce,closable:!1,onCancel:le,children:[t.jsx(xe.Cropper,{ref:a,src:h,cropmove:H,viewMode:1,aspectRatio:N,cropend:()=>ie()}),t.jsx("p",{className:"text-center",children:[ue,pe].join(" ⨉ ")}),t.jsxs("div",{className:"mt-2 d-flex justify-content-center",children:[t.jsx(E,{size:"large",icon:t.jsx(S.RotateLeftOutlined,{}),onClick:()=>T(!0)}),t.jsx(E,{size:"large",icon:t.jsx(S.RotateRightOutlined,{}),onClick:()=>T(!1)})]})]}),t.jsx(F.Modal,{open:re,title:Z,footer:null,onCancel:oe,children:t.jsx("div",{className:"text-center",children:t.jsx("img",{alt:"example",style:{maxWidth:"400px"},src:te})})})]})},Y=({_buttonTitle:r,buttonSize:d,buttonType:p,fileList:n,hidePreview:f,icon:m,loading:N,maxCount:j,onChangeFile:w,onRemove:g,showButtonText:x,handlePreview:D,setFileList:y,showLoadingIndicator:O,listType:C="picture"})=>t.jsx(t.Fragment,{children:t.jsxs(F.Upload,{accept:"image/x-png,image/gif,image/jpeg",fileList:n,defaultFileList:n,onChange:()=>{},className:(n.length>=j?" hide-upload ":"")+" mb-0",multiple:!1,onPreview:f?void 0:D,onDrop:l=>(w(l.dataTransfer.files.item(0)),!1),listType:C,showUploadList:!f,onRemove:l=>{const U=n.filter(I=>l.uid!==I.uid);g==null||g(l),y(U)},beforeUpload:async l=>(w(l),!1),maxCount:j,children:[O&&t.jsx(S.LoadingOutlined,{}),t.jsx("div",{className:"d-flex flex-column",children:n.length<j&&(C==="picture-circle"?t.jsx(S.UploadOutlined,{}):t.jsx(E,{loading:N,tooltip:x?void 0:r,size:d,icon:m,type:x?p:"text",children:x?r:void 0}))})]},n.length)});exports.UploadComponent=Y;exports.default=ve;
@@ -0,0 +1,282 @@
1
+ import { jsx as t, jsxs as S, Fragment as oe } from "react/jsx-runtime";
2
+ /* empty css */
3
+ /* empty css */
4
+ import { RotateLeftOutlined as ye, RotateRightOutlined as Ie, UploadOutlined as ne, LoadingOutlined as Oe } from "@ant-design/icons";
5
+ import { Form as Ue, Modal as q, Upload as Ne } from "antd";
6
+ import z, { useRef as B, useState as w, useEffect as R, useCallback as ee, useMemo as te } from "react";
7
+ import { Cropper as Fe } from "react-cropper";
8
+ import { useTranslation as Re } from "react-i18next";
9
+ import { TRANSLATION_NAMESPACE as Se } from "../../../locale/hooks/translation-constants.js";
10
+ import E from "../button/Button.js";
11
+ import je from "../../../util/ImageUtil.js";
12
+ const ke = Ue.Item;
13
+ function re(r) {
14
+ return new Promise((l, p) => {
15
+ const o = new FileReader();
16
+ o.readAsDataURL(r), o.onload = () => l(o.result), o.onerror = (m) => p(m);
17
+ });
18
+ }
19
+ const We = ({
20
+ values: r = [],
21
+ required: l,
22
+ buttonType: p,
23
+ label: o,
24
+ name: m,
25
+ onChange: f,
26
+ aspectRatio: j,
27
+ buttonTitle: C,
28
+ hidePreview: v,
29
+ buttonSize: u = "large",
30
+ showButtonText: g = !0,
31
+ showOnlyIcon: _ = !1,
32
+ icon: I = /* @__PURE__ */ t(ne, {}),
33
+ loading: O,
34
+ maxCount: b = 1,
35
+ onAdd: c,
36
+ onRemove: U,
37
+ listType: N,
38
+ ...L
39
+ }) => {
40
+ const [ie, ae] = z.useState(""), [se, ce] = z.useState(""), [le, T] = z.useState(!1), k = B(), i = B(), [a, A] = w([]), [h, P] = w(), de = B(), pe = () => T(!1), me = async (e) => {
41
+ !e.url && !e.preview && (e.preview = await re(e.originFileObj)), ce(e.url || e.preview), T(!0), ae(e.name);
42
+ }, [J, F] = w(!1), fe = () => {
43
+ }, V = (e) => {
44
+ var n;
45
+ (n = i == null ? void 0 : i.current) == null || n.cropper.rotate(e ? -90 : 90);
46
+ };
47
+ R(() => {
48
+ f == null || f(a[0], a);
49
+ }, [a, f]);
50
+ const ue = () => {
51
+ var y;
52
+ const e = (y = i == null ? void 0 : i.current) == null ? void 0 : y.cropper.getCroppedCanvas(), { type: n, size: s, name: d, uid: x } = k.current;
53
+ F(!0), e == null || e.toBlob(async (be) => {
54
+ const xe = Object.assign(new File([be], d, { type: n }), {
55
+ uid: x
56
+ }), X = await je.resizeImage(xe), Y = await re(X), Z = {
57
+ url: Y,
58
+ name: d,
59
+ uid: x,
60
+ type: n,
61
+ size: s,
62
+ thumbUrl: Y,
63
+ originFileObj: X
64
+ };
65
+ if (c)
66
+ try {
67
+ F(!0), await c(Z);
68
+ } finally {
69
+ F(!1);
70
+ }
71
+ A([Z, ...a]), F(!1);
72
+ }), P(void 0);
73
+ }, ge = () => {
74
+ P(void 0), k.current = void 0;
75
+ }, W = ee((e) => {
76
+ const n = e;
77
+ if (n) {
78
+ k.current = n;
79
+ const s = new FileReader();
80
+ s.addEventListener("load", () => {
81
+ var d;
82
+ if (typeof s.result == "string") {
83
+ P(s.result);
84
+ const x = localStorage.getItem("cropper.box"), y = x ? JSON.parse(x) : void 0;
85
+ y && ((d = i == null ? void 0 : i.current) == null || d.cropper.setCropBoxData(y)), setTimeout(() => {
86
+ Q();
87
+ }, 100);
88
+ }
89
+ }), s.readAsDataURL(n);
90
+ }
91
+ }, []);
92
+ R(() => {
93
+ if (r != null && r.length || typeof r == "string") {
94
+ const e = Array.isArray(r) ? r.map((n) => [{ uid: r, url: n }]) : [{ uid: r, url: r }];
95
+ A(e);
96
+ }
97
+ }, [r]);
98
+ const { t: D } = Re(Se), he = te(
99
+ () => l ? {
100
+ required: l,
101
+ validator: (e, n, s) => {
102
+ h || a != null && a.length ? s() : s(`${o ?? ""} ${D("err.validation.required")}`);
103
+ }
104
+ } : void 0,
105
+ [l, h, a == null ? void 0 : a.length, o, D]
106
+ ), $ = C ?? D("message.fileUploadMessage2"), H = te(
107
+ () => /* @__PURE__ */ t(
108
+ Ae,
109
+ {
110
+ showLoadingIndicator: J,
111
+ _buttonTitle: $,
112
+ buttonSize: u,
113
+ buttonType: p,
114
+ fileList: a,
115
+ hidePreview: v,
116
+ icon: I,
117
+ loading: O,
118
+ listType: N,
119
+ maxCount: b,
120
+ onChangeFile: W,
121
+ onRemove: U,
122
+ showButtonText: g,
123
+ handlePreview: me,
124
+ setFileList: A
125
+ }
126
+ ),
127
+ [
128
+ J,
129
+ $,
130
+ u,
131
+ p,
132
+ a,
133
+ v,
134
+ I,
135
+ O,
136
+ N,
137
+ b,
138
+ W,
139
+ U,
140
+ g
141
+ ]
142
+ );
143
+ de.current = H.props.beforeUpload;
144
+ const [we, G] = w(0), [Ce, K] = w(0), [M, ve] = w();
145
+ R(() => {
146
+ const e = setTimeout(() => {
147
+ M && localStorage.setItem("cropper.box", JSON.stringify(M));
148
+ }, 400);
149
+ return () => clearTimeout(e);
150
+ }, [M]), R(() => {
151
+ h || (G(0), K(0));
152
+ }, [h]);
153
+ const Q = ee(async () => {
154
+ var n;
155
+ const e = (n = i == null ? void 0 : i.current) == null ? void 0 : n.cropper;
156
+ if (e) {
157
+ const { width: s, height: d } = e.getCroppedCanvas();
158
+ ve(e.getCropBoxData()), G(s), K(d);
159
+ }
160
+ }, []);
161
+ return /* @__PURE__ */ S(oe, { children: [
162
+ /* @__PURE__ */ t(
163
+ ke,
164
+ {
165
+ label: o,
166
+ ...L,
167
+ name: m,
168
+ className: "mb-0",
169
+ rules: [he, ...L.rules ?? []],
170
+ children: H
171
+ }
172
+ ),
173
+ /* @__PURE__ */ S(
174
+ q,
175
+ {
176
+ open: !!h,
177
+ maskClosable: !1,
178
+ onOk: ue,
179
+ closable: !1,
180
+ onCancel: ge,
181
+ children: [
182
+ /* @__PURE__ */ t(
183
+ Fe,
184
+ {
185
+ ref: i,
186
+ src: h,
187
+ cropmove: Q,
188
+ viewMode: 1,
189
+ aspectRatio: j,
190
+ cropend: () => fe()
191
+ }
192
+ ),
193
+ /* @__PURE__ */ t("p", { className: "text-center", children: [we, Ce].join(" ⨉ ") }),
194
+ /* @__PURE__ */ S("div", { className: "mt-2 d-flex justify-content-center", children: [
195
+ /* @__PURE__ */ t(
196
+ E,
197
+ {
198
+ size: "large",
199
+ icon: /* @__PURE__ */ t(ye, {}),
200
+ onClick: () => V(!0)
201
+ }
202
+ ),
203
+ /* @__PURE__ */ t(
204
+ E,
205
+ {
206
+ size: "large",
207
+ icon: /* @__PURE__ */ t(Ie, {}),
208
+ onClick: () => V(!1)
209
+ }
210
+ )
211
+ ] })
212
+ ]
213
+ }
214
+ ),
215
+ /* @__PURE__ */ t(
216
+ q,
217
+ {
218
+ open: le,
219
+ title: ie,
220
+ footer: null,
221
+ onCancel: pe,
222
+ children: /* @__PURE__ */ t("div", { className: "text-center", children: /* @__PURE__ */ t("img", { alt: "example", style: { maxWidth: "400px" }, src: se }) })
223
+ }
224
+ )
225
+ ] });
226
+ }, Ae = ({
227
+ _buttonTitle: r,
228
+ buttonSize: l,
229
+ buttonType: p,
230
+ fileList: o,
231
+ hidePreview: m,
232
+ icon: f,
233
+ loading: j,
234
+ maxCount: C,
235
+ onChangeFile: v,
236
+ onRemove: u,
237
+ showButtonText: g,
238
+ handlePreview: _,
239
+ setFileList: I,
240
+ showLoadingIndicator: O,
241
+ listType: b = "picture"
242
+ }) => /* @__PURE__ */ t(oe, { children: /* @__PURE__ */ S(
243
+ Ne,
244
+ {
245
+ accept: "image/x-png,image/gif,image/jpeg",
246
+ fileList: o,
247
+ defaultFileList: o,
248
+ onChange: () => {
249
+ },
250
+ className: (o.length >= C ? " hide-upload " : "") + " mb-0",
251
+ multiple: !1,
252
+ onPreview: m ? void 0 : _,
253
+ onDrop: (c) => (v(c.dataTransfer.files.item(0)), !1),
254
+ listType: b,
255
+ showUploadList: !m,
256
+ onRemove: (c) => {
257
+ const U = o.filter((N) => c.uid !== N.uid);
258
+ u == null || u(c), I(U);
259
+ },
260
+ beforeUpload: async (c) => (v(c), !1),
261
+ maxCount: C,
262
+ children: [
263
+ O && /* @__PURE__ */ t(Oe, {}),
264
+ /* @__PURE__ */ t("div", { className: "d-flex flex-column", children: o.length < C && (b === "picture-circle" ? /* @__PURE__ */ t(ne, {}) : /* @__PURE__ */ t(
265
+ E,
266
+ {
267
+ loading: j,
268
+ tooltip: g ? void 0 : r,
269
+ size: l,
270
+ icon: f,
271
+ type: g ? p : "text",
272
+ children: g ? r : void 0
273
+ }
274
+ )) })
275
+ ]
276
+ },
277
+ o.length
278
+ ) });
279
+ export {
280
+ Ae as UploadComponent,
281
+ We as default
282
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("react/jsx-runtime"),t=require("antd"),c=require("react"),d=({button:a,disabled:i,...n})=>{const m=c.useMemo(()=>{const{enum:e,translations:o}=n;if(e){const r=[];for(const u of e)r.push({key:u,value:(o==null?void 0:o[u])??u.toUpperCase()});return r}else return n.values},[n]),l=a?t.Radio.Button:t.Radio;return s.jsx(t.Form.Item,{...n,children:s.jsx(t.Radio.Group,{disabled:i,children:m.map(({key:e,value:o})=>s.jsx(l,{value:e,children:o},e))})})},R=c.memo(d);module.exports=R;
@@ -0,0 +1,19 @@
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { Radio as m, Form as i } from "antd";
3
+ import { memo as p, useMemo as d } from "react";
4
+ const f = ({ button: a, disabled: s, ...n }) => {
5
+ const l = d(() => {
6
+ const { enum: e, translations: o } = n;
7
+ if (e) {
8
+ const r = [];
9
+ for (const t of e)
10
+ r.push({ key: t, value: (o == null ? void 0 : o[t]) ?? t.toUpperCase() });
11
+ return r;
12
+ } else
13
+ return n.values;
14
+ }, [n]), c = a ? m.Button : m;
15
+ return /* @__PURE__ */ u(i.Item, { ...n, children: /* @__PURE__ */ u(m.Group, { disabled: s, children: l.map(({ key: e, value: o }) => /* @__PURE__ */ u(c, { value: e, children: o }, e)) }) });
16
+ }, G = p(f);
17
+ export {
18
+ G as default
19
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("antd"),u=require("react"),f=require("../select/SelectComponent.cjs"),b=({className:a,onSelect:d,label:S,required:p,name:l,mode:c,items:t})=>{const r=o.Form.useFormInstance(),[s,F]=u.useState(!0);return u.useEffect(()=>{if(t&&s){const e=t.filter(i=>i.alreadySelected).map(i=>i.id);r==null||r.setFieldsValue({[l]:c==="multiple"?e:e==null?void 0:e[0]}),F(!1)}},[s,r,t,c,l]),n.jsx(f,{required:p,label:S,mode:c,className:a,name:l,onSelect:d,items:t,itemBuilder:e=>n.jsx(o.Select.Option,{value:e.id,disabled:e.lock,children:e.label},e.id)})};exports.SelectFieldInReport=b;
@@ -0,0 +1,30 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { Form as f, Select as m } from "antd";
3
+ import { useState as F, useEffect as S } from "react";
4
+ import b from "../select/SelectComponent.js";
5
+ const k = ({ className: n, onSelect: p, label: u, required: a, name: l, mode: o, items: e }) => {
6
+ const r = f.useFormInstance(), [c, d] = F(!0);
7
+ return S(() => {
8
+ if (e && c) {
9
+ const t = e.filter((i) => i.alreadySelected).map((i) => i.id);
10
+ r == null || r.setFieldsValue({
11
+ [l]: o === "multiple" ? t : t == null ? void 0 : t[0]
12
+ }), d(!1);
13
+ }
14
+ }, [c, r, e, o, l]), /* @__PURE__ */ s(
15
+ b,
16
+ {
17
+ required: a,
18
+ label: u,
19
+ mode: o,
20
+ className: n,
21
+ name: l,
22
+ onSelect: p,
23
+ items: e,
24
+ itemBuilder: (t) => /* @__PURE__ */ s(m.Option, { value: t.id, disabled: t.lock, children: t.label }, t.id)
25
+ }
26
+ );
27
+ };
28
+ export {
29
+ k as SelectFieldInReport
30
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),s=require("antd"),n=s.List.Item.Meta,r=s.List.Item,o=({title:e,description:i,children:c})=>t.jsxs(r,{className:"",children:[t.jsx("div",{children:t.jsx(n,{title:e,description:i})}),t.jsx("div",{className:"float-right",children:c})]});module.exports=o;
@@ -0,0 +1,13 @@
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import { List as e } from "antd";
3
+ const a = e.Item.Meta, i = e.Item, n = ({
4
+ title: s,
5
+ description: o,
6
+ children: m
7
+ }) => /* @__PURE__ */ r(i, { className: "", children: [
8
+ /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(a, { title: s, description: o }) }),
9
+ /* @__PURE__ */ t("div", { className: "float-right", children: m })
10
+ ] });
11
+ export {
12
+ n as default
13
+ };
@@ -0,0 +1 @@
1
+ "use strict";const r=require("react/jsx-runtime"),a=require("antd"),k=require("react"),H=require("react-i18next"),P=require("../../../locale/hooks/translation-constants.cjs"),b=require("../tooltip/TooltipComponent.cjs");function B({label:l,rules:j=[],required:w,placeholder:h,notSearch:q,children:x,readOnly:s,items:o,dropdownRender:L,itemBuilder:T,loading:f,showLoadingInEmptyIndicator:N,nameFieldInArray:m="name",innerRef:_,tooltip:I,filterOption:p,tagRender:A,...n}){const{t:E}=H.useTranslation(P.TRANSLATION_NAMESPACE),M=k.useCallback(e=>{const t=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[m];return r.jsx("option",{value:t,children:r.jsx("div",{dangerouslySetInnerHTML:{__html:c}})},t)},[m]);return r.jsx(a.ConfigProvider,{renderEmpty:N&&f?()=>r.jsx(a.Spin,{}):void 0,children:r.jsx(b,{title:I,children:r.jsx(a.Form.Item,{label:l,name:n.name,help:n.help,className:n.className,rules:[...j,{required:w,message:`${l??h??""} ${E("err.validation.required")}`}],children:r.jsx(a.Select,{ref:_,loading:f,open:s?!1:void 0,onChange:!s&&n.onChange,allowClear:!s&&n.allowClear,showSearch:!q,className:`max-width ${s?"readOnly":""}`,...n,tagRender:A,placeholder:h??l,filterOption:p??((e,t)=>{var c,C,u,g;try{const i=(u=(C=(c=t==null?void 0:t.children)==null?void 0:c.props)==null?void 0:C.dangerouslySetInnerHTML)==null?void 0:u.__html,O=e.toLowerCase().split(/\s+/),S=(t==null?void 0:t.children)??"",y=typeof S=="string"?S.toLowerCase():typeof i=="string"?i.toLowerCase():"",R=(((g=t==null?void 0:t.value)==null?void 0:g.toString())??"").toLowerCase(),$=y.replace(/\s/g,"");return O.every(d=>y.indexOf(d)>=0||R.indexOf(d)>=0||$.indexOf(d)>=0)}catch(i){return console.log(i),!0}}),dropdownRender:L,children:x===null?void 0:x??(o&&(o==null?void 0:o.map(T??M)))})})})})}module.exports=B;