@kingteza/crud-component 1.2.1 → 1.2.2

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 (241) hide show
  1. package/dist/Play.d.ts +2 -0
  2. package/dist/README.md +89 -0
  3. package/dist/common/appearance/Hider.cjs.js +1 -0
  4. package/dist/common/appearance/Hider.d.ts +6 -0
  5. package/dist/common/appearance/Hider.es.js +5 -0
  6. package/dist/common/appearance/index.d.ts +1 -0
  7. package/dist/common/button/Button.cjs.js +1 -0
  8. package/dist/common/button/Button.d.ts +11 -0
  9. package/dist/common/button/Button.es.js +57 -0
  10. package/dist/common/button/CloneButtonTable.cjs.js +1 -0
  11. package/dist/common/button/CloneButtonTable.d.ts +6 -0
  12. package/dist/common/button/CloneButtonTable.es.js +19 -0
  13. package/dist/common/button/DeleteButtonTable.cjs.js +1 -0
  14. package/dist/common/button/DeleteButtonTable.d.ts +13 -0
  15. package/dist/common/button/DeleteButtonTable.es.js +64 -0
  16. package/dist/common/button/ExportButton.cjs.js +1 -0
  17. package/dist/common/button/ExportButton.d.ts +4 -0
  18. package/dist/common/button/ExportButton.es.js +26 -0
  19. package/dist/common/button/HideButtonTable.cjs.js +1 -0
  20. package/dist/common/button/HideButtonTable.d.ts +13 -0
  21. package/dist/common/button/HideButtonTable.es.js +67 -0
  22. package/dist/common/button/ImportButton.cjs.js +1 -0
  23. package/dist/common/button/ImportButton.d.ts +9 -0
  24. package/dist/common/button/ImportButton.es.js +55 -0
  25. package/dist/common/button/NewButton.cjs.js +1 -0
  26. package/dist/common/button/NewButton.d.ts +12 -0
  27. package/dist/common/button/NewButton.es.js +23 -0
  28. package/dist/common/button/PrintButton.cjs.js +1 -0
  29. package/dist/common/button/PrintButton.d.ts +12 -0
  30. package/dist/common/button/PrintButton.es.js +25 -0
  31. package/dist/common/button/RefreshButton.cjs.js +1 -0
  32. package/dist/common/button/RefreshButton.d.ts +11 -0
  33. package/dist/common/button/RefreshButton.es.js +23 -0
  34. package/dist/common/button/UnHideButton.cjs.js +1 -0
  35. package/dist/common/button/UnHideButton.d.ts +14 -0
  36. package/dist/common/button/UnHideButton.es.js +69 -0
  37. package/dist/common/button/UpdateButtonTable.cjs.js +1 -0
  38. package/dist/common/button/UpdateButtonTable.d.ts +6 -0
  39. package/dist/common/button/UpdateButtonTable.es.js +19 -0
  40. package/dist/common/button/ViewButtonTable.cjs.js +1 -0
  41. package/dist/common/button/ViewButtonTable.d.ts +6 -0
  42. package/dist/common/button/ViewButtonTable.es.js +19 -0
  43. package/dist/common/button/index.d.ts +14 -0
  44. package/dist/common/check-box/CheckBox.cjs.js +1 -0
  45. package/dist/common/check-box/CheckBox.d.ts +9 -0
  46. package/dist/common/check-box/CheckBox.es.js +40 -0
  47. package/dist/common/check-box/index.d.ts +2 -0
  48. package/dist/common/date-picker/DatePicker.cjs.js +1 -0
  49. package/dist/common/date-picker/DatePicker.d.ts +37 -0
  50. package/dist/common/date-picker/DatePicker.es.js +87 -0
  51. package/dist/common/date-picker/TimePicker.cjs.js +1 -0
  52. package/dist/common/date-picker/TimePicker.d.ts +34 -0
  53. package/dist/common/date-picker/TimePicker.es.js +77 -0
  54. package/dist/common/date-picker/index.d.ts +3 -0
  55. package/dist/common/description/DescList.cjs.js +1 -0
  56. package/dist/common/description/DescList.d.ts +18 -0
  57. package/dist/common/description/DescList.es.js +16 -0
  58. package/dist/common/description/DescriptionComponent.d.ts +7 -0
  59. package/dist/common/description/index.d.ts +3 -0
  60. package/dist/common/icon/KIcon.cjs.js +1 -0
  61. package/dist/common/icon/KIcon.d.ts +9 -0
  62. package/dist/common/icon/KIcon.es.js +11 -0
  63. package/dist/common/index.cjs.js +1 -0
  64. package/dist/common/index.d.ts +20 -0
  65. package/dist/common/index.es.js +78 -0
  66. package/dist/common/layout/VerticalSpace.cjs.js +1 -0
  67. package/dist/common/layout/VerticalSpace.d.ts +5 -0
  68. package/dist/common/layout/VerticalSpace.es.js +6 -0
  69. package/dist/common/layout/index.d.ts +2 -0
  70. package/dist/common/loading/LoadingIndicator.cjs.js +1 -0
  71. package/dist/common/loading/LoadingIndicator.d.ts +6 -0
  72. package/dist/common/loading/LoadingIndicator.es.js +23 -0
  73. package/dist/common/loading/index.d.ts +2 -0
  74. package/dist/common/picker/ImagePicker.cjs.js +1 -0
  75. package/dist/common/picker/ImagePicker.d.ts +56 -0
  76. package/dist/common/picker/ImagePicker.es.js +320 -0
  77. package/dist/common/picker/index.d.ts +2 -0
  78. package/dist/common/radio/RadioGroupComponent.cjs.js +1 -0
  79. package/dist/common/radio/RadioGroupComponent.d.ts +18 -0
  80. package/dist/common/radio/RadioGroupComponent.es.js +19 -0
  81. package/dist/common/radio/index.d.ts +2 -0
  82. package/dist/common/report/SelectFieldInReport.cjs.js +1 -0
  83. package/dist/common/report/SelectFieldInReport.d.ts +16 -0
  84. package/dist/common/report/SelectFieldInReport.es.js +30 -0
  85. package/dist/common/report/index.d.ts +3 -0
  86. package/dist/common/rich/index.cjs.js +1 -0
  87. package/dist/common/rich/index.d.ts +10 -0
  88. package/dist/common/rich/index.es.js +66 -0
  89. package/dist/common/select/CustomSelectOption.cjs.js +1 -0
  90. package/dist/common/select/CustomSelectOption.d.ts +7 -0
  91. package/dist/common/select/CustomSelectOption.es.js +13 -0
  92. package/dist/common/select/SelectComponent.cjs.js +1 -0
  93. package/dist/common/select/SelectComponent.d.ts +21 -0
  94. package/dist/common/select/SelectComponent.es.js +85 -0
  95. package/dist/common/select/index.d.ts +3 -0
  96. package/dist/common/show-more/index.cjs.js +1 -0
  97. package/dist/common/show-more/index.d.ts +4 -0
  98. package/dist/common/show-more/index.es.js +8 -0
  99. package/dist/common/tab/TabViewWithRoute.cjs.js +1 -0
  100. package/dist/common/tab/TabViewWithRoute.d.ts +13 -0
  101. package/dist/common/tab/TabViewWithRoute.es.js +38 -0
  102. package/dist/common/tab/index.d.ts +2 -0
  103. package/dist/common/table/index.d.ts +3 -0
  104. package/dist/common/table/table.cjs.js +1 -0
  105. package/dist/common/table/table.d.ts +19 -0
  106. package/dist/common/table/table.es.js +40 -0
  107. package/dist/common/tag/StatusTag.cjs.js +1 -0
  108. package/dist/common/tag/StatusTag.d.ts +14 -0
  109. package/dist/common/tag/StatusTag.es.js +29 -0
  110. package/dist/common/tag/index.d.ts +2 -0
  111. package/dist/common/text/index.cjs.js +1 -0
  112. package/dist/common/text/index.d.ts +3 -0
  113. package/dist/common/text/index.es.js +5 -0
  114. package/dist/common/text/title/TitleWithHeadTitle.d.ts +7 -0
  115. package/dist/common/text/title/index.cjs.js +1 -0
  116. package/dist/common/text/title/index.d.ts +1 -0
  117. package/dist/common/text/title/index.es.js +5 -0
  118. package/dist/common/text-field/NumberField.cjs.js +1 -0
  119. package/dist/common/text-field/NumberField.d.ts +13 -0
  120. package/dist/common/text-field/NumberField.es.js +83 -0
  121. package/dist/common/text-field/PhoneNumberField.cjs.js +1 -0
  122. package/dist/common/text-field/PhoneNumberField.d.ts +4 -0
  123. package/dist/common/text-field/PhoneNumberField.es.js +18 -0
  124. package/dist/common/text-field/TextArea.cjs.js +1 -0
  125. package/dist/common/text-field/TextArea.d.ts +17 -0
  126. package/dist/common/text-field/TextArea.es.js +46 -0
  127. package/dist/common/text-field/TextField.cjs.js +1 -0
  128. package/dist/common/text-field/TextField.d.ts +27 -0
  129. package/dist/common/text-field/TextField.es.js +72 -0
  130. package/dist/common/text-field/index.d.ts +5 -0
  131. package/dist/common/tooltip/TooltipComponent.cjs.js +1 -0
  132. package/dist/common/tooltip/TooltipComponent.d.ts +5 -0
  133. package/dist/common/tooltip/TooltipComponent.es.js +9 -0
  134. package/dist/common/tooltip/index.d.ts +2 -0
  135. package/dist/common/wizard/WizardResult.cjs.js +1 -0
  136. package/dist/common/wizard/WizardResult.d.ts +16 -0
  137. package/dist/common/wizard/WizardResult.es.js +58 -0
  138. package/dist/common/wizard/WizardViewForm.cjs.js +1 -0
  139. package/dist/common/wizard/WizardViewForm.d.ts +24 -0
  140. package/dist/common/wizard/WizardViewForm.es.js +74 -0
  141. package/dist/common/wizard/index.d.ts +3 -0
  142. package/dist/context/WindowDimension.cjs.js +1 -0
  143. package/dist/context/WindowDimension.d.ts +4 -0
  144. package/dist/context/WindowDimension.es.js +8 -0
  145. package/dist/context/index.d.ts +1 -0
  146. package/dist/crud/CrudComponent.cjs.js +1 -0
  147. package/dist/crud/CrudComponent.d.ts +245 -0
  148. package/dist/crud/CrudComponent.es.js +123 -0
  149. package/dist/crud/CrudField.cjs.js +1 -0
  150. package/dist/crud/CrudField.d.ts +4 -0
  151. package/dist/crud/CrudField.es.js +461 -0
  152. package/dist/crud/CrudForm.cjs.js +1 -0
  153. package/dist/crud/CrudForm.d.ts +14 -0
  154. package/dist/crud/CrudForm.es.js +103 -0
  155. package/dist/crud/CrudFormWizard.cjs.js +1 -0
  156. package/dist/crud/CrudFormWizard.d.ts +14 -0
  157. package/dist/crud/CrudFormWizard.es.js +140 -0
  158. package/dist/crud/CrudReportComponent.cjs.js +4 -0
  159. package/dist/crud/CrudReportComponent.d.ts +44 -0
  160. package/dist/crud/CrudReportComponent.es.js +255 -0
  161. package/dist/crud/CrudSearchComponent.cjs.js +1 -0
  162. package/dist/crud/CrudSearchComponent.d.ts +21 -0
  163. package/dist/crud/CrudSearchComponent.es.js +96 -0
  164. package/dist/crud/CrudTextAreaComponent.cjs.js +1 -0
  165. package/dist/crud/CrudTextAreaComponent.d.ts +22 -0
  166. package/dist/crud/CrudTextAreaComponent.es.js +52 -0
  167. package/dist/crud/FileCrudField.cjs.js +1 -0
  168. package/dist/crud/FileCrudField.d.ts +25 -0
  169. package/dist/crud/FileCrudField.es.js +221 -0
  170. package/dist/crud/ImageCrudField.cjs.js +1 -0
  171. package/dist/crud/ImageCrudField.d.ts +38 -0
  172. package/dist/crud/ImageCrudField.es.js +115 -0
  173. package/dist/crud/actions/index.cjs.js +1 -0
  174. package/dist/crud/actions/index.d.ts +26 -0
  175. package/dist/crud/actions/index.es.js +88 -0
  176. package/dist/crud/import/CrudImportButton.cjs.js +1 -0
  177. package/dist/crud/import/CrudImportButton.d.ts +3 -0
  178. package/dist/crud/import/CrudImportButton.es.js +30 -0
  179. package/dist/crud/import/CrudImportComponent.cjs.js +2 -0
  180. package/dist/crud/import/CrudImportComponent.d.ts +14 -0
  181. package/dist/crud/import/CrudImportComponent.es.js +222 -0
  182. package/dist/crud/index.d.ts +23 -0
  183. package/dist/crud/modal/index.cjs.js +1 -0
  184. package/dist/crud/modal/index.d.ts +24 -0
  185. package/dist/crud/modal/index.es.js +146 -0
  186. package/dist/crud/view/CrudDecListView.cjs.js +1 -0
  187. package/dist/crud/view/CrudDecListView.d.ts +15 -0
  188. package/dist/crud/view/CrudDecListView.es.js +57 -0
  189. package/dist/crud/view/CrudViewer.cjs.js +1 -0
  190. package/dist/crud/view/CrudViewer.d.ts +43 -0
  191. package/dist/crud/view/CrudViewer.es.js +304 -0
  192. package/dist/crud/view/CrudViewerUtil.cjs.js +1 -0
  193. package/dist/crud/view/CrudViewerUtil.d.ts +2 -0
  194. package/dist/crud/view/CrudViewerUtil.es.js +98 -0
  195. package/dist/crud/view/index.d.ts +5 -0
  196. package/dist/crud-component.css +6 -0
  197. package/dist/hooks/NavigatorHooks.cjs.js +1 -0
  198. package/dist/hooks/NavigatorHooks.d.ts +1 -0
  199. package/dist/hooks/NavigatorHooks.es.js +9 -0
  200. package/dist/icons/FlipHIcon.cjs.js +1 -0
  201. package/dist/icons/FlipHIcon.d.ts +3 -0
  202. package/dist/icons/FlipHIcon.es.js +28 -0
  203. package/dist/icons/FlipVIcon.cjs.js +1 -0
  204. package/dist/icons/FlipVIcon.d.ts +3 -0
  205. package/dist/icons/FlipVIcon.es.js +28 -0
  206. package/dist/index.cjs.js +1 -0
  207. package/dist/index.d.ts +4 -0
  208. package/dist/index.es.js +46 -0
  209. package/dist/locale/hooks/translation-constants.cjs.js +1 -0
  210. package/dist/locale/hooks/translation-constants.d.ts +1 -0
  211. package/dist/locale/hooks/translation-constants.es.js +4 -0
  212. package/dist/locale/index.cjs.js +1 -0
  213. package/dist/locale/index.d.ts +85 -0
  214. package/dist/locale/index.es.js +57 -0
  215. package/dist/locale/translations/en.cjs.js +1 -0
  216. package/dist/locale/translations/en.d.ts +63 -0
  217. package/dist/locale/translations/en.es.js +65 -0
  218. package/dist/package.json +122 -0
  219. package/dist/types/DialogComponentProp.d.ts +8 -0
  220. package/dist/types/Id.d.ts +10 -0
  221. package/dist/util/CrudUtil.cjs.js +1 -0
  222. package/dist/util/CrudUtil.d.ts +5 -0
  223. package/dist/util/CrudUtil.es.js +8 -0
  224. package/dist/util/DateUtil.cjs.js +1 -0
  225. package/dist/util/DateUtil.d.ts +7 -0
  226. package/dist/util/DateUtil.es.js +18 -0
  227. package/dist/util/ImageUtil.cjs.js +1 -0
  228. package/dist/util/ImageUtil.d.ts +14 -0
  229. package/dist/util/ImageUtil.es.js +63 -0
  230. package/dist/util/NumberUtil.cjs.js +1 -0
  231. package/dist/util/NumberUtil.d.ts +17 -0
  232. package/dist/util/NumberUtil.es.js +60 -0
  233. package/dist/util/ValidationUtil.cjs.js +1 -0
  234. package/dist/util/ValidationUtil.d.ts +14 -0
  235. package/dist/util/ValidationUtil.es.js +63 -0
  236. package/dist/util/index.cjs.js +1 -0
  237. package/dist/util/index.d.ts +4 -0
  238. package/dist/util/index.es.js +10 -0
  239. package/dist/vite-env.d.ts +1 -0
  240. package/package.json +4 -12
  241. package/release.config.cjs +0 -27
@@ -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,2 @@
1
+ import { default as VerticalSpace } from './VerticalSpace';
2
+ export { VerticalSpace };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),r=require("antd"),i=require("../../locale/index.cjs.js"),o=require("../button/Button.cjs.js"),u=({loading:s,children:n,error:a})=>{const{t:e}=i.useTranslationLib();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(o,{to:-1,type:"primary",children:e("str.goBack")})}):n})};module.exports=u;
@@ -0,0 +1,6 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ declare const LoadingIndicator: FC<PropsWithChildren<{
3
+ loading: boolean;
4
+ error?: any;
5
+ }>>;
6
+ export default LoadingIndicator;
@@ -0,0 +1,23 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Skeleton as n, Result as s } from "antd";
3
+ import { useTranslationLib as i } from "../../locale/index.es.js";
4
+ import m from "../button/Button.es.js";
5
+ const d = ({ loading: o, children: e, error: a }) => {
6
+ const { t: r } = i();
7
+ return (
8
+ // <Spin spinning={loading} className="h-100">
9
+ /* @__PURE__ */ t(n, { loading: o, paragraph: !0, className: "h-100", children: a ? /* @__PURE__ */ t(
10
+ s,
11
+ {
12
+ status: "404",
13
+ title: 404,
14
+ subTitle: r("err.notFound"),
15
+ className: "",
16
+ extra: /* @__PURE__ */ t(m, { to: -1, type: "primary", children: r("str.goBack") })
17
+ }
18
+ ) : e })
19
+ );
20
+ };
21
+ export {
22
+ d as default
23
+ };
@@ -0,0 +1,2 @@
1
+ import { default as LoadingIndicator } from './LoadingIndicator';
2
+ export { LoadingIndicator };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),je=require("react-advanced-cropper");;/* empty css */;/* empty css */const O=require("@ant-design/icons"),U=require("antd"),s=require("react"),he=require("../../locale/index.cjs.js"),I=require("../button/Button.cjs.js"),we=require("../../util/ImageUtil.cjs.js"),Ce=require("../../icons/FlipHIcon.cjs.js"),be=require("../../icons/FlipVIcon.cjs.js"),ve=U.Form.Item,Y="crud-component.image-picker.button-state";function Z(o){return new Promise((u,p)=>{const n=new FileReader;n.readAsDataURL(o),n.onload=()=>u(n.result),n.onerror=m=>p(m)})}const Se=({values:o=[],required:u,buttonType:p,label:n,name:m,onChange:f,aspectRatio:h,buttonTitle:w,hidePreview:C,buttonSize:g="large",showButtonText:x=!0,showOnlyIcon:_=!1,icon:k=t.jsx(O.UploadOutlined,{}),loading:F,maxCount:b=1,onAdd:a,onRemove:R,listType:q,...A})=>{const[te,re]=s.useState(""),[se,oe]=s.useState(""),[ne,B]=s.useState(!1),T=s.useRef(),l=s.useRef(null),[i,z]=s.useState([]),[j,P]=s.useState(),ie=s.useRef(),ae=()=>B(!1),ce=async e=>{!e.url&&!e.preview&&(e.preview=await Z(e.originFileObj)),oe(e.url||e.preview),B(!0),re(e.name)},[D,N]=s.useState(!1),H=e=>{var r;(r=l.current)==null||r.rotateImage(e?-90:90)},L=s.useCallback(e=>{var r;l.current&&((r=l.current)==null||r.flipImage(e==="h",e==="v"))},[]);s.useEffect(()=>{f==null||f(i[0],i)},[i,f]);const le=async()=>{var y;const e=(y=l.current)==null?void 0:y.getCanvas(),{type:r,size:c,name:v,uid:S}=T.current;N(!0),e==null||e.toBlob(async ge=>{const xe=Object.assign(new File([ge],v,{type:r}),{uid:S}),Q=await we.resizeImage(xe),E=await Z(Q);console.log({url:E});const X={url:E,name:v,uid:S,type:r,size:c,thumbUrl:E,originFileObj:Q};if(a)try{N(!0),await a(X)}finally{N(!1)}z([X,...i]),N(!1)}),P(void 0)},ue=()=>{P(void 0),T.current=void 0},V=s.useCallback(e=>{const r=e;if(r){T.current=r;const c=new FileReader;c.addEventListener("load",()=>{var v;if(typeof c.result=="string"){P(c.result);const S=localStorage.getItem(Y),y=S?JSON.parse(S):void 0;y&&((v=l.current)==null||v.setState(y)),setTimeout(()=>{K(l.current)},100)}}),c.readAsDataURL(r)}},[]);s.useEffect(()=>{if(o!=null&&o.length||typeof o=="string"){const e=Array.isArray(o)?o.map(r=>[{uid:o,url:r}]):[{uid:o,url:o}];z(e)}},[o]);const{t:d}=he.useTranslationLib(),de=s.useMemo(()=>u?{required:u,validator:(e,r,c)=>{j||i!=null&&i.length?c():c(`${n??""} ${d("err.validation.required")}`)}}:void 0,[u,j,i==null?void 0:i.length,n,d]),J=w??d("message.uploadButtonText"),W=s.useMemo(()=>t.jsx(ee,{showLoadingIndicator:D,_buttonTitle:J,buttonSize:g,buttonType:p,fileList:i,hidePreview:C,icon:k,loading:F,listType:q,maxCount:b,onChangeFile:V,onRemove:R,showButtonText:x,handlePreview:ce,setFileList:z}),[D,J,g,p,i,C,k,F,q,b,V,R,x]);ie.current=W.props.beforeUpload;const[pe,$]=s.useState(0),[me,G]=s.useState(0),[M,fe]=s.useState();s.useEffect(()=>{const e=setTimeout(()=>{M&&localStorage.setItem(Y,JSON.stringify(M))},400);return()=>clearTimeout(e)},[M]),s.useEffect(()=>{if(!j){$(0),G(0);const e=setTimeout(()=>{var r;(r=l.current)==null||r.reset()},1500);return()=>clearTimeout(e)}},[j]);const K=s.useCallback(async e=>{if(e){const r=e.getCoordinates();fe(e.getState()),$((r==null?void 0:r.width)??10),G((r==null?void 0:r.height)??10)}},[]);return t.jsxs(t.Fragment,{children:[t.jsx(ve,{label:n,...A,name:m,className:"mb-0",rules:[de,...A.rules??[]],children:W}),t.jsxs(U.Modal,{open:!!j,maskClosable:!1,onOk:le,closable:!1,onCancel:ue,destroyOnHidden:!0,children:[t.jsx(je.Cropper,{ref:l,stencilProps:{grid:!0},style:{border:"1px solid black"},src:j,onChange:e=>{K(e)},aspectRatio:h?{minimum:h,maximum:h}:void 0}),t.jsx("p",{className:"text-center",children:[pe,me].join(" ⨉ ")}),t.jsx("div",{className:"mt-2 d-flex justify-content-center",children:t.jsxs(U.Space.Compact,{children:[t.jsx(I,{size:"large",tooltip:d("str.rotateLeft"),icon:t.jsx(O.RotateLeftOutlined,{}),onClick:()=>H(!0)}),t.jsx(I,{size:"large",icon:t.jsx(O.RotateRightOutlined,{}),tooltip:d("str.rotateRight"),onClick:()=>H(!1)}),t.jsx(I,{size:"large",icon:t.jsx(Ce,{}),tooltip:d("str.flipHorizontal"),onClick:()=>L("h")}),t.jsx(I,{size:"large",icon:t.jsx(be,{}),tooltip:d("str.flipVertical"),onClick:()=>L("v")})]})})]}),t.jsx(U.Modal,{open:ne,title:te,footer:null,onCancel:ae,children:t.jsx("div",{className:"text-center",children:t.jsx("img",{alt:"example",style:{maxWidth:"400px"},src:se})})})]})},ee=({_buttonTitle:o,buttonSize:u,buttonType:p,fileList:n,hidePreview:m,icon:f,loading:h,maxCount:w,onChangeFile:C,onRemove:g,showButtonText:x,handlePreview:_,setFileList:k,showLoadingIndicator:F,listType:b="picture"})=>t.jsxs(U.Upload,{accept:"image/x-png,image/gif,image/jpeg",fileList:n,defaultFileList:n,onChange:()=>{},className:(n.length>=w?" hide-upload ":"")+" mb-0",multiple:!1,onPreview:m?void 0:_,onDrop:a=>(C(a.dataTransfer.files.item(0)),!1),listType:b,showUploadList:!m,onRemove:a=>{const R=n.filter(q=>a.uid!==q.uid);g==null||g(a),k(R)},beforeUpload:async a=>(C(a),!1),maxCount:w,children:[F&&t.jsx(O.LoadingOutlined,{}),t.jsx("div",{className:"d-flex flex-column",children:n.length<w&&(b==="picture-circle"?t.jsx(O.UploadOutlined,{}):t.jsx(I,{loading:h,tooltip:x?void 0:o,size:u,icon:f,type:x?p:"text",children:x?o:void 0}))})]},n.length);exports.UploadComponent=ee;exports.default=Se;
@@ -0,0 +1,56 @@
1
+ import { FormItemProps } from 'antd';
2
+ import { UploadFile } from 'antd/lib/upload/interface';
3
+ import { FC, ReactElement } from 'react';
4
+ import { UploadListType } from 'antd/es/upload/interface';
5
+ export declare function dataURLtoFile({ url, name }: {
6
+ url: any;
7
+ name: any;
8
+ }): File;
9
+ interface Props extends FormItemProps {
10
+ values?: string[] | string;
11
+ maxCount?: number;
12
+ onChange?: (file?: UploadFile, allFiles?: UploadFile[]) => void;
13
+ buttonTitle?: string;
14
+ listType?: UploadListType;
15
+ hidePreview?: boolean;
16
+ buttonSize?: string;
17
+ showButtonText?: boolean;
18
+ aspectRatio?: number;
19
+ showOnlyIcon?: boolean;
20
+ icon?: ReactElement;
21
+ loading?: boolean;
22
+ buttonType?: string;
23
+ onAdd?: (file?: UploadFile) => Promise<void>;
24
+ onRemove?: (file?: UploadFile) => void;
25
+ }
26
+ /**
27
+ * When submitting Uploader
28
+ * ```
29
+ * if(field === undefined)
30
+ * "There is no file uploaded"
31
+ * else if(field.fileList.length === 0)
32
+ * "The initial file is deleted"
33
+ * else if(field.fileList.length > 1)
34
+ * "A new file has been uploaded"
35
+ * ```
36
+ *
37
+ */
38
+ declare const ImagePicker: FC<Props>;
39
+ export declare const UploadComponent: FC<{
40
+ _buttonTitle: any;
41
+ buttonSize: any;
42
+ buttonType: any;
43
+ fileList: any;
44
+ hidePreview: any;
45
+ icon: any;
46
+ loading: any;
47
+ maxCount: any;
48
+ onChangeFile: any;
49
+ onRemove: any;
50
+ showButtonText: any;
51
+ handlePreview: any;
52
+ setFileList: any;
53
+ showLoadingIndicator?: boolean;
54
+ listType?: UploadListType;
55
+ }>;
56
+ export default ImagePicker;
@@ -0,0 +1,320 @@
1
+ import { jsx as r, jsxs as z, Fragment as Ie } from "react/jsx-runtime";
2
+ import { Cropper as xe } from "react-advanced-cropper";
3
+ /* empty css */
4
+ /* empty css */
5
+ import { RotateLeftOutlined as Fe, RotateRightOutlined as Oe, UploadOutlined as ne, LoadingOutlined as Se } from "@ant-design/icons";
6
+ import { Form as Ue, Modal as te, Space as ke, Upload as Re } from "antd";
7
+ import H, { useRef as L, useState as w, useCallback as V, useEffect as j, useMemo as re } from "react";
8
+ import { useTranslationLib as Ne } from "../../locale/index.es.js";
9
+ import O from "../button/Button.es.js";
10
+ import je from "../../util/ImageUtil.es.js";
11
+ import ze from "../../icons/FlipHIcon.es.js";
12
+ import Te from "../../icons/FlipVIcon.es.js";
13
+ const Pe = Ue.Item, oe = "crud-component.image-picker.button-state";
14
+ function ie(o) {
15
+ return new Promise((c, m) => {
16
+ const i = new FileReader();
17
+ i.readAsDataURL(o), i.onload = () => c(i.result), i.onerror = (p) => m(p);
18
+ });
19
+ }
20
+ const Ke = ({
21
+ values: o = [],
22
+ required: c,
23
+ buttonType: m,
24
+ label: i,
25
+ name: p,
26
+ onChange: u,
27
+ aspectRatio: C,
28
+ buttonTitle: b,
29
+ hidePreview: v,
30
+ buttonSize: f = "large",
31
+ showButtonText: g = !0,
32
+ showOnlyIcon: _ = !1,
33
+ icon: S = /* @__PURE__ */ r(ne, {}),
34
+ loading: U,
35
+ maxCount: y = 1,
36
+ onAdd: s,
37
+ onRemove: k,
38
+ listType: R,
39
+ ...E
40
+ }) => {
41
+ const [se, ae] = H.useState(""), [le, ce] = H.useState(""), [de, M] = H.useState(!1), T = L(), l = L(null), [n, P] = w([]), [h, B] = w(), me = L(), pe = () => M(!1), ue = async (e) => {
42
+ !e.url && !e.preview && (e.preview = await ie(e.originFileObj)), ce(e.url || e.preview), M(!0), ae(e.name);
43
+ }, [J, N] = w(!1), W = (e) => {
44
+ var t;
45
+ (t = l.current) == null || t.rotateImage(e ? -90 : 90);
46
+ }, $ = V((e) => {
47
+ var t;
48
+ l.current && ((t = l.current) == null || t.flipImage(e === "h", e === "v"));
49
+ }, []);
50
+ j(() => {
51
+ u == null || u(n[0], n);
52
+ }, [n, u]);
53
+ const fe = async () => {
54
+ var F;
55
+ const e = (F = l.current) == null ? void 0 : F.getCanvas(), { type: t, size: a, name: I, uid: x } = T.current;
56
+ N(!0), e == null || e.toBlob(async (ve) => {
57
+ const ye = Object.assign(new File([ve], I, { type: t }), {
58
+ uid: x
59
+ }), q = await je.resizeImage(ye), D = await ie(q);
60
+ console.log({ url: D });
61
+ const ee = {
62
+ url: D,
63
+ name: I,
64
+ uid: x,
65
+ type: t,
66
+ size: a,
67
+ thumbUrl: D,
68
+ originFileObj: q
69
+ };
70
+ if (s)
71
+ try {
72
+ N(!0), await s(ee);
73
+ } finally {
74
+ N(!1);
75
+ }
76
+ P([ee, ...n]), N(!1);
77
+ }), B(void 0);
78
+ }, ge = () => {
79
+ B(void 0), T.current = void 0;
80
+ }, G = V((e) => {
81
+ const t = e;
82
+ if (t) {
83
+ T.current = t;
84
+ const a = new FileReader();
85
+ a.addEventListener("load", () => {
86
+ var I;
87
+ if (typeof a.result == "string") {
88
+ B(a.result);
89
+ const x = localStorage.getItem(oe), F = x ? JSON.parse(x) : void 0;
90
+ F && ((I = l.current) == null || I.setState(F)), setTimeout(() => {
91
+ Z(l.current);
92
+ }, 100);
93
+ }
94
+ }), a.readAsDataURL(t);
95
+ }
96
+ }, []);
97
+ j(() => {
98
+ if (o != null && o.length || typeof o == "string") {
99
+ const e = Array.isArray(o) ? o.map((t) => [{ uid: o, url: t }]) : [{ uid: o, url: o }];
100
+ P(e);
101
+ }
102
+ }, [o]);
103
+ const { t: d } = Ne(), he = re(
104
+ () => c ? {
105
+ required: c,
106
+ validator: (e, t, a) => {
107
+ h || n != null && n.length ? a() : a(`${i ?? ""} ${d("err.validation.required")}`);
108
+ }
109
+ } : void 0,
110
+ [c, h, n == null ? void 0 : n.length, i, d]
111
+ ), K = b ?? d("message.uploadButtonText"), Q = re(
112
+ () => /* @__PURE__ */ r(
113
+ Be,
114
+ {
115
+ showLoadingIndicator: J,
116
+ _buttonTitle: K,
117
+ buttonSize: f,
118
+ buttonType: m,
119
+ fileList: n,
120
+ hidePreview: v,
121
+ icon: S,
122
+ loading: U,
123
+ listType: R,
124
+ maxCount: y,
125
+ onChangeFile: G,
126
+ onRemove: k,
127
+ showButtonText: g,
128
+ handlePreview: ue,
129
+ setFileList: P
130
+ }
131
+ ),
132
+ [
133
+ J,
134
+ K,
135
+ f,
136
+ m,
137
+ n,
138
+ v,
139
+ S,
140
+ U,
141
+ R,
142
+ y,
143
+ G,
144
+ k,
145
+ g
146
+ ]
147
+ );
148
+ me.current = Q.props.beforeUpload;
149
+ const [we, X] = w(0), [Ce, Y] = w(0), [A, be] = w();
150
+ j(() => {
151
+ const e = setTimeout(() => {
152
+ A && localStorage.setItem(oe, JSON.stringify(A));
153
+ }, 400);
154
+ return () => clearTimeout(e);
155
+ }, [A]), j(() => {
156
+ if (!h) {
157
+ X(0), Y(0);
158
+ const e = setTimeout(() => {
159
+ var t;
160
+ (t = l.current) == null || t.reset();
161
+ }, 1500);
162
+ return () => clearTimeout(e);
163
+ }
164
+ }, [h]);
165
+ const Z = V(async (e) => {
166
+ if (e) {
167
+ const t = e.getCoordinates();
168
+ be(e.getState()), X((t == null ? void 0 : t.width) ?? 10), Y((t == null ? void 0 : t.height) ?? 10);
169
+ }
170
+ }, []);
171
+ return /* @__PURE__ */ z(Ie, { children: [
172
+ /* @__PURE__ */ r(
173
+ Pe,
174
+ {
175
+ label: i,
176
+ ...E,
177
+ name: p,
178
+ className: "mb-0",
179
+ rules: [he, ...E.rules ?? []],
180
+ children: Q
181
+ }
182
+ ),
183
+ /* @__PURE__ */ z(
184
+ te,
185
+ {
186
+ open: !!h,
187
+ maskClosable: !1,
188
+ onOk: fe,
189
+ closable: !1,
190
+ onCancel: ge,
191
+ destroyOnHidden: !0,
192
+ children: [
193
+ /* @__PURE__ */ r(
194
+ xe,
195
+ {
196
+ ref: l,
197
+ stencilProps: {
198
+ grid: !0
199
+ },
200
+ style: { border: "1px solid black" },
201
+ src: h,
202
+ onChange: (e) => {
203
+ Z(e);
204
+ },
205
+ aspectRatio: C ? {
206
+ minimum: C,
207
+ maximum: C
208
+ } : void 0
209
+ }
210
+ ),
211
+ /* @__PURE__ */ r("p", { className: "text-center", children: [we, Ce].join(" ⨉ ") }),
212
+ /* @__PURE__ */ r("div", { className: "mt-2 d-flex justify-content-center", children: /* @__PURE__ */ z(ke.Compact, { children: [
213
+ /* @__PURE__ */ r(
214
+ O,
215
+ {
216
+ size: "large",
217
+ tooltip: d("str.rotateLeft"),
218
+ icon: /* @__PURE__ */ r(Fe, {}),
219
+ onClick: () => W(!0)
220
+ }
221
+ ),
222
+ /* @__PURE__ */ r(
223
+ O,
224
+ {
225
+ size: "large",
226
+ icon: /* @__PURE__ */ r(Oe, {}),
227
+ tooltip: d("str.rotateRight"),
228
+ onClick: () => W(!1)
229
+ }
230
+ ),
231
+ /* @__PURE__ */ r(
232
+ O,
233
+ {
234
+ size: "large",
235
+ icon: /* @__PURE__ */ r(ze, {}),
236
+ tooltip: d("str.flipHorizontal"),
237
+ onClick: () => $("h")
238
+ }
239
+ ),
240
+ /* @__PURE__ */ r(
241
+ O,
242
+ {
243
+ size: "large",
244
+ icon: /* @__PURE__ */ r(Te, {}),
245
+ tooltip: d("str.flipVertical"),
246
+ onClick: () => $("v")
247
+ }
248
+ )
249
+ ] }) })
250
+ ]
251
+ }
252
+ ),
253
+ /* @__PURE__ */ r(
254
+ te,
255
+ {
256
+ open: de,
257
+ title: se,
258
+ footer: null,
259
+ onCancel: pe,
260
+ children: /* @__PURE__ */ r("div", { className: "text-center", children: /* @__PURE__ */ r("img", { alt: "example", style: { maxWidth: "400px" }, src: le }) })
261
+ }
262
+ )
263
+ ] });
264
+ }, Be = ({
265
+ _buttonTitle: o,
266
+ buttonSize: c,
267
+ buttonType: m,
268
+ fileList: i,
269
+ hidePreview: p,
270
+ icon: u,
271
+ loading: C,
272
+ maxCount: b,
273
+ onChangeFile: v,
274
+ onRemove: f,
275
+ showButtonText: g,
276
+ handlePreview: _,
277
+ setFileList: S,
278
+ showLoadingIndicator: U,
279
+ listType: y = "picture"
280
+ }) => /* @__PURE__ */ z(
281
+ Re,
282
+ {
283
+ accept: "image/x-png,image/gif,image/jpeg",
284
+ fileList: i,
285
+ defaultFileList: i,
286
+ onChange: () => {
287
+ },
288
+ className: (i.length >= b ? " hide-upload " : "") + " mb-0",
289
+ multiple: !1,
290
+ onPreview: p ? void 0 : _,
291
+ onDrop: (s) => (v(s.dataTransfer.files.item(0)), !1),
292
+ listType: y,
293
+ showUploadList: !p,
294
+ onRemove: (s) => {
295
+ const k = i.filter((R) => s.uid !== R.uid);
296
+ f == null || f(s), S(k);
297
+ },
298
+ beforeUpload: async (s) => (v(s), !1),
299
+ maxCount: b,
300
+ children: [
301
+ U && /* @__PURE__ */ r(Se, {}),
302
+ /* @__PURE__ */ r("div", { className: "d-flex flex-column", children: i.length < b && (y === "picture-circle" ? /* @__PURE__ */ r(ne, {}) : /* @__PURE__ */ r(
303
+ O,
304
+ {
305
+ loading: C,
306
+ tooltip: g ? void 0 : o,
307
+ size: c,
308
+ icon: u,
309
+ type: g ? m : "text",
310
+ children: g ? o : void 0
311
+ }
312
+ )) })
313
+ ]
314
+ },
315
+ i.length
316
+ );
317
+ export {
318
+ Be as UploadComponent,
319
+ Ke as default
320
+ };
@@ -0,0 +1,2 @@
1
+ import { default as ImagePicker } from './ImagePicker';
2
+ export { ImagePicker };
@@ -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,18 @@
1
+ import { FormItemProps } from 'antd';
2
+ interface GeneralProps extends FormItemProps {
3
+ values: {
4
+ key: string | number | undefined;
5
+ value: string | number;
6
+ }[];
7
+ }
8
+ interface EnumProps extends FormItemProps {
9
+ enum: string[];
10
+ translations?: any;
11
+ }
12
+ type Props = (GeneralProps | EnumProps) & {
13
+ onChange?: (evt: boolean) => void;
14
+ disabled?: boolean;
15
+ button?: boolean;
16
+ };
17
+ declare const _default: import('react').NamedExoticComponent<Props>;
18
+ export default _default;
@@ -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,2 @@
1
+ import { default as RadioGroupComponent } from './RadioGroupComponent';
2
+ export { RadioGroupComponent };
@@ -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.js"),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,16 @@
1
+ import { FC } from 'react';
2
+ export interface ReportSelectFieldItems {
3
+ id: any;
4
+ label: string;
5
+ lock?: boolean;
6
+ alreadySelected?: boolean;
7
+ }
8
+ export declare const SelectFieldInReport: FC<{
9
+ mode?: "multiple" | "tags" | undefined;
10
+ name: string;
11
+ label: string;
12
+ className?: string;
13
+ required?: boolean;
14
+ onSelect?: (val: any) => void;
15
+ items: ReportSelectFieldItems[];
16
+ }>;
@@ -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.es.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,3 @@
1
+ import { SelectFieldInReport, ReportSelectFieldItems } from './SelectFieldInReport';
2
+ export { SelectFieldInReport };
3
+ export type { ReportSelectFieldItems };
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.create;var p=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var w=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of V(t))!F.call(e,o)&&o!==r&&p(e,o,{get:()=>t[o],enumerable:!(s=q(t,o))||s.enumerable});return e};var R=(e,t,r)=>(r=e!=null?g(j(e)):{},w(t||!e||!e.__esModule?p(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime");;/* empty css */;/* empty css */const h=require("antd"),c=require("react"),y=require("../../util/ValidationUtil.cjs.js"),E=c.lazy(async()=>{const{default:e}=await import("react-quill");return{default:t=>a.jsx(e,{...t})}}),S=({name:e,label:t,required:r,rules:s=[],disabled:o})=>{const n=h.Form.useFormInstance(),[u,d]=c.useState(""),f={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],["link"],["clean"]]},b=["bold","italic","underline","strike","blockquote","list","bullet","link"];c.useEffect(()=>{const i=n.getFieldValue(e);i&&i!=="<p></p>"&&i!=="<p><br></p>"&&d(i)},[n,e]);const l=h.Form.useWatch(e,n);c.useEffect(()=>{l!==u&&d(!l||l==="<p></p>"||l==="<p><br></p>"?"":l)},[l,u]);const k=i=>{d(i);const x=!i||i==="<p></p>"||i.trim()==="<p><br></p>"?void 0:i;n.setFieldValue(e,x),n.validateFields([e]).catch(()=>{})},m=c.useMemo(()=>r?[...s,...y.required(t??"")]:s,[r,s,t]);return a.jsx(h.Form.Item,{name:e,label:t,rules:m,children:a.jsx(c.Suspense,{fallback:a.jsx("div",{children:"Loading editor..."}),children:a.jsx(E,{readOnly:o,value:u,onChange:k,theme:"snow",className:"bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",modules:f,formats:b})})})};exports.RichTextEditor=S;
@@ -0,0 +1,10 @@
1
+ import { Rule } from 'antd/es/form';
2
+ import { FC } from 'react';
3
+ export interface RichTextEditorProps {
4
+ label?: string;
5
+ name: string;
6
+ required?: boolean;
7
+ rules?: Rule[];
8
+ disabled?: boolean;
9
+ }
10
+ export declare const RichTextEditor: FC<RichTextEditorProps>;
@@ -0,0 +1,66 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ /* empty css */
3
+ /* empty css */
4
+ import { Form as a } from "antd";
5
+ import V, { useState as g, useEffect as u, useMemo as w, Suspense as F } from "react";
6
+ import x from "../../util/ValidationUtil.es.js";
7
+ const R = V.lazy(async () => {
8
+ const { default: e } = await import("react-quill");
9
+ return { default: (o) => /* @__PURE__ */ l(e, { ...o }) };
10
+ }), S = ({
11
+ name: e,
12
+ label: o,
13
+ required: d,
14
+ rules: c = [],
15
+ disabled: p
16
+ }) => {
17
+ const r = a.useFormInstance(), [n, s] = g(""), m = {
18
+ toolbar: [
19
+ ["bold", "italic", "underline", "strike", "blockquote"],
20
+ [{ list: "ordered" }, { list: "bullet" }],
21
+ ["link"],
22
+ ["clean"]
23
+ ]
24
+ }, f = [
25
+ "bold",
26
+ "italic",
27
+ "underline",
28
+ "strike",
29
+ "blockquote",
30
+ "list",
31
+ "bullet",
32
+ "link"
33
+ ];
34
+ u(() => {
35
+ const t = r.getFieldValue(e);
36
+ t && t !== "<p></p>" && t !== "<p><br></p>" && s(t);
37
+ }, [r, e]);
38
+ const i = a.useWatch(e, r);
39
+ u(() => {
40
+ i !== n && s(!i || i === "<p></p>" || i === "<p><br></p>" ? "" : i);
41
+ }, [i, n]);
42
+ const h = (t) => {
43
+ s(t);
44
+ const k = !t || t === "<p></p>" || t.trim() === "<p><br></p>" ? void 0 : t;
45
+ r.setFieldValue(e, k), r.validateFields([e]).catch(() => {
46
+ });
47
+ }, b = w(
48
+ () => d ? [...c, ...x.required(o ?? "")] : c,
49
+ [d, c, o]
50
+ );
51
+ return /* @__PURE__ */ l(a.Item, { name: e, label: o, rules: b, children: /* @__PURE__ */ l(F, { fallback: /* @__PURE__ */ l("div", { children: "Loading editor..." }), children: /* @__PURE__ */ l(
52
+ R,
53
+ {
54
+ readOnly: p,
55
+ value: n,
56
+ onChange: h,
57
+ theme: "snow",
58
+ className: "bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",
59
+ modules: m,
60
+ formats: f
61
+ }
62
+ ) }) });
63
+ };
64
+ export {
65
+ S as RichTextEditor
66
+ };
@@ -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,7 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ type CustomSelectOptionProps = {
3
+ title: string;
4
+ description?: string;
5
+ };
6
+ declare const CustomSelectOption: FC<PropsWithChildren<CustomSelectOptionProps>>;
7
+ export default CustomSelectOption;
@@ -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 n=require("react/jsx-runtime"),l=require("antd"),O=require("react"),V=require("../../locale/index.cjs.js"),B=require("../tooltip/TooltipComponent.cjs.js"),D=require("../../util/ValidationUtil.cjs.js");function E({label:a,rules:S=[],required:h,placeholder:x,notSearch:L,children:f,readOnly:s,items:o,dropdownRender:p,itemBuilder:q,loading:m,showLoadingInEmptyIndicator:T,nameFieldInArray:u="name",innerRef:_,tooltip:b,filterOption:N,tagRender:R,...r}){const{t:P}=V.useTranslationLib(),k=O.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[u];return n.jsx("option",{value:t,children:n.jsx("div",{dangerouslySetInnerHTML:{__html:c}})},t)},[u]),F=a??x??"";return n.jsx(l.ConfigProvider,{renderEmpty:T&&m?()=>n.jsx(l.Spin,{}):void 0,children:n.jsx(B,{title:b,children:n.jsx(l.Form.Item,{label:a,name:r.name,help:r.help,className:r.className,required:h,rules:[...S,...h?D.required(F):[]],children:n.jsx(l.Select,{ref:_,loading:m,open:s?!1:void 0,onChange:!s&&r.onChange,allowClear:!s&&r.allowClear,showSearch:!L,className:`max-width ${s?"readOnly":""}`,...r,tagRender:R,placeholder:x??a,filterOption:N??((e,t)=>{var c,g,C,j;try{const i=(C=(g=(c=t==null?void 0:t.children)==null?void 0:c.props)==null?void 0:g.dangerouslySetInnerHTML)==null?void 0:C.__html,H=e.toLowerCase().split(/\s+/),y=(t==null?void 0:t.children)??"",w=typeof y=="string"?y.toLowerCase():typeof i=="string"?i.toLowerCase():"",I=(((j=t==null?void 0:t.value)==null?void 0:j.toString())??"").toLowerCase(),M=w.replace(/\s/g,"");return H.every(d=>w.indexOf(d)>=0||I.indexOf(d)>=0||M.indexOf(d)>=0)}catch(i){return console.log(i),!0}}),popupRender:p,children:f===null?void 0:f??(o?o==null?void 0:o.map(q??k):n.jsx(n.Fragment,{}))})})})})}module.exports=E;