@kingteza/crud-component 1.0.12 → 1.0.14

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