@kingteza/crud-component 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts +2 -0
- package/dist/_virtual/_commonjsHelpers.cjs +1 -0
- package/dist/_virtual/_commonjsHelpers.js +6 -1
- package/dist/_virtual/advancedFormat.cjs +1 -0
- package/dist/_virtual/advancedFormat.js +7 -1
- package/dist/_virtual/advancedFormat2.js +4 -1
- package/dist/_virtual/customParseFormat.cjs +1 -0
- package/dist/_virtual/customParseFormat.js +7 -1
- package/dist/_virtual/customParseFormat2.js +4 -1
- package/dist/_virtual/dayjs.min.cjs +1 -0
- package/dist/_virtual/dayjs.min.js +7 -1
- package/dist/_virtual/dayjs.min2.js +4 -1
- package/dist/_virtual/index.cjs +1 -0
- package/dist/_virtual/index.js +7 -1
- package/dist/_virtual/index2.cjs +1 -0
- package/dist/_virtual/index2.js +7 -1
- package/dist/_virtual/index3.cjs +1 -0
- package/dist/_virtual/index3.js +4 -1
- package/dist/_virtual/index4.js +4 -1
- package/dist/_virtual/index5.cjs +1 -0
- package/dist/_virtual/index5.js +4 -1
- package/dist/_virtual/jsx-runtime.cjs +1 -0
- package/dist/_virtual/jsx-runtime.js +5 -1
- package/dist/_virtual/jsx-runtime2.cjs +1 -0
- package/dist/_virtual/jsx-runtime2.js +4 -1
- package/dist/_virtual/localeData.cjs +1 -0
- package/dist/_virtual/localeData.js +7 -1
- package/dist/_virtual/localeData2.cjs +1 -0
- package/dist/_virtual/localeData2.js +4 -1
- package/dist/_virtual/react-is.development.js +4 -1
- package/dist/_virtual/react-is.production.min.js +4 -1
- package/dist/_virtual/react-jsx-runtime.development.js +4 -1
- package/dist/_virtual/react-jsx-runtime.production.min.cjs +1 -0
- package/dist/_virtual/react-jsx-runtime.production.min.js +4 -1
- package/dist/_virtual/weekOfYear.cjs +1 -0
- package/dist/_virtual/weekOfYear.js +7 -1
- package/dist/_virtual/weekOfYear2.cjs +1 -0
- package/dist/_virtual/weekOfYear2.js +4 -1
- package/dist/_virtual/weekYear.cjs +1 -0
- package/dist/_virtual/weekYear.js +7 -1
- package/dist/_virtual/weekYear2.cjs +1 -0
- package/dist/_virtual/weekYear2.js +4 -1
- package/dist/_virtual/weekday.cjs +1 -0
- package/dist/_virtual/weekday.js +7 -1
- package/dist/_virtual/weekday2.cjs +1 -0
- package/dist/_virtual/weekday2.js +4 -1
- package/dist/common/index.cjs +1 -0
- package/dist/common/index.js +75 -1
- package/dist/components/common/DatePicker/DatePicker.d.ts +37 -0
- package/dist/components/common/DatePicker/TimePicker.d.ts +34 -0
- package/dist/components/common/DatePicker/index.d.ts +3 -0
- package/dist/components/common/appearance/Hider.d.ts +6 -0
- package/dist/components/common/appearance/index.d.ts +0 -0
- package/dist/components/common/button/Button.d.ts +12 -0
- package/dist/components/common/button/CloneButtonTable.d.ts +6 -0
- package/dist/components/common/button/DeleteButtonTable.d.ts +13 -0
- package/dist/components/common/button/ExportButton.d.ts +4 -0
- package/dist/components/common/button/HideButtonTable.d.ts +13 -0
- package/dist/components/common/button/ImportButton.d.ts +9 -0
- package/dist/components/common/button/NewButton.d.ts +12 -0
- package/dist/components/common/button/PrintButton.d.ts +12 -0
- package/dist/components/common/button/RefreshButton.d.ts +11 -0
- package/dist/components/common/button/UnHideButton.d.ts +14 -0
- package/dist/components/common/button/UpdateButtonTable.d.ts +6 -0
- package/dist/components/common/button/ViewButtonTable.d.ts +6 -0
- package/dist/components/common/button/index.d.ts +14 -0
- package/dist/components/common/check-box/CheckBox.d.ts +9 -0
- package/dist/components/common/check-box/index.d.ts +2 -0
- package/dist/components/common/description/DescList.d.ts +18 -0
- package/dist/components/common/description/DescriptionComponent.d.ts +7 -0
- package/dist/components/common/description/index.d.ts +3 -0
- package/dist/components/common/index.d.ts +22 -0
- package/dist/components/common/layout/VerticalSpace.d.ts +5 -0
- package/dist/components/common/layout/index.d.ts +2 -0
- package/dist/components/common/loading/LoadingIndicator.d.ts +6 -0
- package/dist/components/common/loading/index.d.ts +2 -0
- package/dist/components/common/picker/ImagePicker.d.ts +56 -0
- package/dist/components/common/picker/index.d.ts +2 -0
- package/dist/components/common/radio/RadioGroupComponent.d.ts +18 -0
- package/dist/components/common/radio/index.d.ts +2 -0
- package/dist/components/common/report/SelectFieldInReport.d.ts +16 -0
- package/dist/components/common/report/index.d.ts +3 -0
- package/dist/components/common/select/CustomSelectOption.d.ts +7 -0
- package/dist/components/common/select/SelectComponent.d.ts +21 -0
- package/dist/components/common/select/index.d.ts +3 -0
- package/dist/components/common/show-more/index.d.ts +4 -0
- package/dist/components/common/tab/TabViewWithRoute.d.ts +13 -0
- package/dist/components/common/tab/index.d.ts +2 -0
- package/dist/components/common/table/index.d.ts +3 -0
- package/dist/components/common/table/table.d.ts +19 -0
- package/dist/components/common/tag/StatusTag.d.ts +14 -0
- package/dist/components/common/tag/index.d.ts +2 -0
- package/dist/components/common/text/index.d.ts +3 -0
- package/dist/components/common/text/title/TitleWithHeadTitle.d.ts +7 -0
- package/dist/components/common/text/title/index.d.ts +1 -0
- package/dist/components/common/text-field/NumberField.d.ts +13 -0
- package/dist/components/common/text-field/PhoneNumberField.d.ts +4 -0
- package/dist/components/common/text-field/TextArea.d.ts +17 -0
- package/dist/components/common/text-field/TextField.d.ts +27 -0
- package/dist/components/common/text-field/index.d.ts +5 -0
- package/dist/components/common/tooltip/TooltipComponent.d.ts +5 -0
- package/dist/components/common/tooltip/index.d.ts +2 -0
- package/dist/components/common/wizard/WizardResult.d.ts +16 -0
- package/dist/components/common/wizard/WizardViewForm.d.ts +24 -0
- package/dist/components/common/wizard/index.d.ts +3 -0
- package/dist/components/crud/CrudComponent.d.ts +237 -0
- package/dist/components/crud/CrudField.d.ts +4 -0
- package/dist/components/crud/CrudForm.d.ts +14 -0
- package/dist/components/crud/CrudFormWizard.d.ts +14 -0
- package/dist/components/crud/CrudReportComponent.d.ts +44 -0
- package/dist/components/crud/CrudSearchComponent.d.ts +21 -0
- package/dist/components/crud/FileCrudField.d.ts +25 -0
- package/dist/components/crud/ImageCrudField.d.ts +38 -0
- package/dist/components/crud/import/CrudImportButton.d.ts +3 -0
- package/dist/components/crud/import/CrudImportComponent.d.ts +14 -0
- package/dist/components/crud/index.d.ts +15 -0
- package/dist/components/crud/view/CrudDecListView.d.ts +14 -0
- package/dist/components/crud/view/CrudViewer.d.ts +43 -0
- package/dist/components/crud/view/CrudViewerUtil.d.ts +2 -0
- package/dist/components/crud/view/index.d.ts +5 -0
- package/dist/context/WindowDimension.d.ts +4 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +4 -63
- package/dist/index.js +32 -1
- package/dist/locale/hooks/translation-constants.d.ts +1 -0
- package/dist/locale/index.d.ts +69 -0
- package/dist/locale/translations/en.d.ts +58 -0
- package/dist/main.d.ts +0 -0
- package/dist/src/components/common/DatePicker/DatePicker.cjs +1 -0
- package/dist/src/components/common/DatePicker/DatePicker.js +88 -0
- package/dist/src/components/common/DatePicker/TimePicker.cjs +1 -0
- package/dist/src/components/common/DatePicker/TimePicker.js +78 -0
- package/dist/src/components/common/appearance/Hider.cjs +1 -0
- package/dist/src/components/common/appearance/Hider.js +5 -0
- package/dist/src/components/common/button/Button.cjs +1 -0
- package/dist/src/components/common/button/Button.js +64 -0
- package/dist/src/components/common/button/CloneButtonTable.cjs +1 -0
- package/dist/src/components/common/button/CloneButtonTable.js +20 -0
- package/dist/src/components/common/button/DeleteButtonTable.cjs +1 -0
- package/dist/src/components/common/button/DeleteButtonTable.js +68 -0
- package/dist/src/components/common/button/ExportButton.cjs +1 -0
- package/dist/src/components/common/button/ExportButton.js +27 -0
- package/dist/src/components/common/button/HideButtonTable.cjs +1 -0
- package/dist/src/components/common/button/HideButtonTable.js +68 -0
- package/dist/src/components/common/button/ImportButton.cjs +1 -0
- package/dist/src/components/common/button/ImportButton.js +56 -0
- package/dist/src/components/common/button/NewButton.cjs +1 -0
- package/dist/src/components/common/button/NewButton.js +24 -0
- package/dist/src/components/common/button/PrintButton.cjs +1 -0
- package/dist/src/components/common/button/PrintButton.js +26 -0
- package/dist/src/components/common/button/RefreshButton.cjs +1 -0
- package/dist/src/components/common/button/RefreshButton.js +24 -0
- package/dist/src/components/common/button/UnHideButton.cjs +1 -0
- package/dist/src/components/common/button/UnHideButton.js +70 -0
- package/dist/src/components/common/button/UpdateButtonTable.cjs +1 -0
- package/dist/src/components/common/button/UpdateButtonTable.js +20 -0
- package/dist/src/components/common/button/ViewButtonTable.cjs +1 -0
- package/dist/src/components/common/button/ViewButtonTable.js +20 -0
- package/dist/src/components/common/check-box/CheckBox.cjs +1 -0
- package/dist/src/components/common/check-box/CheckBox.js +40 -0
- package/dist/src/components/common/description/DescList.cjs +1 -0
- package/dist/src/components/common/description/DescList.js +16 -0
- package/dist/src/components/common/layout/VerticalSpace.cjs +1 -0
- package/dist/src/components/common/layout/VerticalSpace.js +6 -0
- package/dist/src/components/common/loading/LoadingIndicator.cjs +1 -0
- package/dist/src/components/common/loading/LoadingIndicator.js +24 -0
- package/dist/src/components/common/picker/ImagePicker.cjs +1 -0
- package/dist/src/components/common/picker/ImagePicker.js +282 -0
- package/dist/src/components/common/radio/RadioGroupComponent.cjs +1 -0
- package/dist/src/components/common/radio/RadioGroupComponent.js +19 -0
- package/dist/src/components/common/report/SelectFieldInReport.cjs +1 -0
- package/dist/src/components/common/report/SelectFieldInReport.js +30 -0
- package/dist/src/components/common/select/CustomSelectOption.cjs +1 -0
- package/dist/src/components/common/select/CustomSelectOption.js +13 -0
- package/dist/src/components/common/select/SelectComponent.cjs +1 -0
- package/dist/src/components/common/select/SelectComponent.js +89 -0
- package/dist/src/components/common/show-more/index.cjs +1 -0
- package/dist/src/components/common/show-more/index.js +8 -0
- package/dist/src/components/common/tab/TabViewWithRoute.cjs +1 -0
- package/dist/src/components/common/tab/TabViewWithRoute.js +38 -0
- package/dist/src/components/common/table/table.cjs +1 -0
- package/dist/src/components/common/table/table.js +40 -0
- package/dist/src/components/common/tag/StatusTag.cjs +1 -0
- package/dist/src/components/common/tag/StatusTag.js +30 -0
- package/dist/src/components/common/text/index.js +5 -0
- package/dist/src/components/common/text/title/index.js +5 -0
- package/dist/src/components/common/text-field/NumberField.cjs +1 -0
- package/dist/src/components/common/text-field/NumberField.js +83 -0
- package/dist/src/components/common/text-field/PhoneNumberField.cjs +1 -0
- package/dist/src/components/common/text-field/PhoneNumberField.js +18 -0
- package/dist/src/components/common/text-field/TextArea.cjs +1 -0
- package/dist/src/components/common/text-field/TextArea.js +47 -0
- package/dist/src/components/common/text-field/TextField.cjs +1 -0
- package/dist/src/components/common/text-field/TextField.js +73 -0
- package/dist/src/components/common/tooltip/TooltipComponent.cjs +1 -0
- package/dist/src/components/common/tooltip/TooltipComponent.js +9 -0
- package/dist/src/components/common/wizard/WizardResult.cjs +1 -0
- package/dist/src/components/common/wizard/WizardResult.js +60 -0
- package/dist/src/components/common/wizard/WizardViewForm.cjs +1 -0
- package/dist/src/components/common/wizard/WizardViewForm.js +74 -0
- package/dist/src/components/crud/CrudComponent.cjs +1 -0
- package/dist/src/components/crud/CrudComponent.js +210 -0
- package/dist/src/components/crud/CrudField.cjs +1 -0
- package/dist/src/components/crud/CrudField.js +459 -0
- package/dist/src/components/crud/CrudForm.cjs +1 -0
- package/dist/src/components/crud/CrudForm.js +91 -0
- package/dist/src/components/crud/CrudFormWizard.cjs +1 -0
- package/dist/src/components/crud/CrudFormWizard.js +140 -0
- package/dist/src/components/crud/CrudReportComponent.cjs +4 -0
- package/dist/src/components/crud/CrudReportComponent.js +255 -0
- package/dist/src/components/crud/CrudSearchComponent.cjs +1 -0
- package/dist/src/components/crud/CrudSearchComponent.js +95 -0
- package/dist/src/components/crud/FileCrudField.cjs +1 -0
- package/dist/src/components/crud/FileCrudField.js +220 -0
- package/dist/src/components/crud/ImageCrudField.cjs +1 -0
- package/dist/src/components/crud/ImageCrudField.js +113 -0
- package/dist/src/components/crud/import/CrudImportButton.cjs +1 -0
- package/dist/src/components/crud/import/CrudImportButton.js +31 -0
- package/dist/src/components/crud/import/CrudImportComponent.cjs +2 -0
- package/dist/src/components/crud/import/CrudImportComponent.js +221 -0
- package/dist/src/components/crud/view/CrudDecListView.cjs +1 -0
- package/dist/src/components/crud/view/CrudDecListView.js +42 -0
- package/dist/src/components/crud/view/CrudViewer.cjs +1 -0
- package/dist/src/components/crud/view/CrudViewer.js +217 -0
- package/dist/src/components/crud/view/CrudViewerUtil.cjs +1 -0
- package/dist/src/components/crud/view/CrudViewerUtil.js +57 -0
- package/dist/src/context/WindowDimension.cjs +1 -0
- package/dist/src/context/WindowDimension.js +8 -0
- package/dist/src/locale/hooks/translation-constants.js +4 -0
- package/dist/src/locale/index.cjs +1 -0
- package/dist/src/locale/index.js +33 -0
- package/dist/src/locale/translations/en.cjs +1 -0
- package/dist/src/locale/translations/en.js +60 -0
- package/dist/src/util/DateUtil.cjs +1 -0
- package/dist/src/util/DateUtil.js +6 -0
- package/dist/src/util/ImageUtil.cjs +1 -0
- package/dist/src/util/ImageUtil.js +63 -0
- package/dist/src/util/NumberUtil.js +60 -0
- package/dist/src/util/ValidationUtil.cjs +1 -0
- package/dist/src/util/ValidationUtil.js +60 -0
- package/dist/types/DialogComponentProp.d.ts +8 -0
- package/dist/types/Id.d.ts +10 -0
- package/dist/util/DateUtil.d.ts +7 -0
- package/dist/util/ImageUtil.d.ts +14 -0
- package/dist/util/NumberUtil.d.ts +17 -0
- package/dist/util/ValidationUtil.d.ts +14 -0
- package/dist/util/index.cjs +1 -0
- package/dist/util/index.js +10 -1
- package/dist/vite-env.d.ts +1 -0
- package/package.json +1 -1
- package/dist/_virtual/FileSaver.min.js +0 -1
- package/dist/_virtual/ShowMoreText.js +0 -1
- package/dist/_virtual/index6.js +0 -1
- package/dist/_virtual/index7.js +0 -1
- package/dist/_virtual/index8.js +0 -1
- package/dist/_virtual/main.js +0 -1
- package/dist/_virtual/papaparse.min.js +0 -1
- package/dist/components/common/DatePicker/DatePicker.js +0 -1
- package/dist/components/common/DatePicker/TimePicker.js +0 -1
- package/dist/components/common/appearance/Hider.js +0 -1
- package/dist/components/common/button/Button.js +0 -1
- package/dist/components/common/button/CloneButtonTable.js +0 -1
- package/dist/components/common/button/DeleteButtonTable.js +0 -1
- package/dist/components/common/button/ExportButton.js +0 -1
- package/dist/components/common/button/HideButtonTable.js +0 -1
- package/dist/components/common/button/ImportButton.js +0 -1
- package/dist/components/common/button/NewButton.js +0 -1
- package/dist/components/common/button/PrintButton.js +0 -1
- package/dist/components/common/button/RefreshButton.js +0 -1
- package/dist/components/common/button/UnHideButton.js +0 -1
- package/dist/components/common/button/UpdateButtonTable.js +0 -1
- package/dist/components/common/button/ViewButtonTable.js +0 -1
- package/dist/components/common/check-box/CheckBox.js +0 -1
- package/dist/components/common/description/DescList.js +0 -1
- package/dist/components/common/layout/VerticalSpace.js +0 -1
- package/dist/components/common/loading/LoadingIndicator.js +0 -1
- package/dist/components/common/picker/ImagePicker.js +0 -1
- package/dist/components/common/radio/RadioGroupComponent.js +0 -1
- package/dist/components/common/report/SelectFieldInReport.js +0 -1
- package/dist/components/common/select/CustomSelectOption.js +0 -1
- package/dist/components/common/select/SelectComponent.js +0 -1
- package/dist/components/common/show-more/index.js +0 -1
- package/dist/components/common/tab/TabViewWithRoute.js +0 -1
- package/dist/components/common/table/table.js +0 -1
- package/dist/components/common/tag/StatusTag.js +0 -1
- package/dist/components/common/text-field/NumberField.js +0 -1
- package/dist/components/common/text-field/PhoneNumberField.js +0 -1
- package/dist/components/common/text-field/TextArea.js +0 -1
- package/dist/components/common/text-field/TextField.js +0 -1
- package/dist/components/common/tooltip/TooltipComponent.js +0 -1
- package/dist/components/common/wizard/WizardResult.js +0 -1
- package/dist/components/common/wizard/WizardViewForm.js +0 -1
- package/dist/components/crud/CrudComponent.js +0 -1
- package/dist/components/crud/CrudField.js +0 -1
- package/dist/components/crud/CrudForm.js +0 -1
- package/dist/components/crud/CrudFormWizard.js +0 -1
- package/dist/components/crud/CrudReportComponent.js +0 -4
- package/dist/components/crud/CrudSearchComponent.js +0 -1
- package/dist/components/crud/FileCrudField.js +0 -1
- package/dist/components/crud/ImageCrudField.js +0 -1
- package/dist/components/crud/import/CrudImportButton.js +0 -1
- package/dist/components/crud/import/CrudImportComponent.js +0 -2
- package/dist/components/crud/view/CrudDecListView.js +0 -1
- package/dist/components/crud/view/CrudViewer.js +0 -1
- package/dist/components/crud/view/CrudViewerUtil.js +0 -1
- package/dist/context/WindowDimension.js +0 -1
- package/dist/locale/index.js +0 -1
- package/dist/locale/translations/en.js +0 -1
- package/dist/util/DateUtil.js +0 -1
- package/dist/util/ImageUtil.js +0 -1
- package/dist/util/ValidationUtil.js +0 -1
- /package/dist/_virtual/{FileSaver.min2.js → advancedFormat2.cjs} +0 -0
- /package/dist/_virtual/{main2.js → customParseFormat2.cjs} +0 -0
- /package/dist/_virtual/{papaparse.min2.js → dayjs.min2.cjs} +0 -0
- /package/dist/_virtual/{ShowMoreText2.js → index4.cjs} +0 -0
- /package/dist/_virtual/{Truncate.js → react-is.development.cjs} +0 -0
- /package/dist/_virtual/{index10.js → react-is.production.min.cjs} +0 -0
- /package/dist/_virtual/{index9.js → react-jsx-runtime.development.cjs} +0 -0
- /package/dist/{components/common/text/index.js → src/components/common/text/index.cjs} +0 -0
- /package/dist/{components/common/text/title/index.js → src/components/common/text/title/index.cjs} +0 -0
- /package/dist/{locale/hooks/translation-constants.js → src/locale/hooks/translation-constants.cjs} +0 -0
- /package/dist/{util/NumberUtil.js → src/util/NumberUtil.cjs} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../_virtual/jsx-runtime.cjs"),D=require("@ant-design/icons"),r=require("antd"),a=require("react"),y=require("./CrudField.cjs"),H=require("./view/CrudViewer.cjs"),v=require("../common/button/Button.cjs"),J=require("../common/button/PrintButton.cjs"),K=require("../common/report/SelectFieldInReport.cjs"),Q=require("../common/select/SelectComponent.cjs"),I=require("./view/CrudViewerUtil.cjs"),V={lg:6,md:8,sm:12,xs:24},W={lg:12,md:16,sm:24,xs:24};function X({fields:u,data:d,idField:A,loadingData:x,onSubmit:S,paginateProps:_,size:L,onClickPrint:j,onClickExcelExport:b,minusHeight:M,extraSearchFields:g,searchOnMount:E,summary:O}){const{searchable:G,selectable:m,sortable:B,defaultSort:c}=a.useMemo(()=>{var f,p,C,N,T;const e=[],s=[],o=[];let n;for(const l of u.filter(z=>!z.hidden))l.type==="image"||!l.report||((f=l.report)!=null&&f.searchable&&e.push(l),(p=l.report)!=null&&p.sortable&&(s.push(l),!n&&((C=l.report)!=null&&C.defaultSort)&&(n=l)),l.hideInTable||o.push({id:l.name,label:l.label,lock:(N=l.report)==null?void 0:N.lock,alreadySelected:(T=l.report)==null?void 0:T.alreadySelected}));return{defaultSort:n,searchable:e,sortable:s,selectable:o}},[u]),[R,F]=a.useState([]),h=a.useCallback(async({sortBy:e,sortByType:s,showFields:o=[],...n})=>{const f=[];e&&f.push({field:e,sort:s??"DESC"}),F(u.filter(p=>o.includes(p.name)).map(p=>({...p,hideInTable:!1}))),S({showFields:o,sortBy:f,...n})},[u,S]),[i]=r.Form.useForm(),[w,U]=a.useState(!1),[q,$]=a.useState(!0);return a.useEffect(()=>{if(E&&q){const e=setTimeout(()=>{i.validateFields().then(s=>{h(s)}),$(!1)},200);return()=>clearTimeout(e)}},[h,i,q,E]),a.useEffect(()=>{var s,o,n;!i.getFieldValue("sortBy")&&c&&(console.log((s=c.report)==null?void 0:s.defaultSort),i.setFieldsValue({sortBy:c.name,sortByType:typeof((o=c.report)==null?void 0:o.defaultSort)=="string"?(n=c.report)==null?void 0:n.defaultSort:"ASC"}))},[c,i]),a.useEffect(()=>{if(w){const e=m.filter(s=>s.alreadySelected).map(s=>s.id);F(u.filter(s=>e.includes(s.name)).map(s=>({...s,hideInTable:!1}))),U(!1)}},[u,w,m]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(r.Space,{className:"w-100",direction:"vertical",children:[t.jsxRuntimeExports.jsxs(r.Form,{form:i,layout:"vertical",onFinish:h,children:[t.jsxRuntimeExports.jsxs(r.Row,{gutter:[8,8],children:[G.map(e=>{var s,o,n;return t.jsxRuntimeExports.jsx(r.Col,{...e.grid??V,style:{alignSelf:"end"},children:(s=e.report)!=null&&s.customRender?e.report.customRender(i):e.type==="date"?t.jsxRuntimeExports.jsx(y.default,{...e,type:"date",range:(o=e.report)==null?void 0:o.range,required:!!((n=e.report)!=null&&n.required),readonly:!1,fieldClassName:"mb-0"}):e.type==="select"?t.jsxRuntimeExports.jsx(y.default,{...e,type:"select",multiple:!0,required:!1,readonly:!1,fieldClassName:"mb-0"}):t.jsxRuntimeExports.jsx(y.default,{...e,readonly:!1,required:!1,fieldClassName:"mb-0"})},e.name)}),!!(m!=null&&m.length)&&t.jsxRuntimeExports.jsx(r.Col,{...W,children:t.jsxRuntimeExports.jsx(K.SelectFieldInReport,{items:m,name:"showFields",mode:"multiple",label:"Show Fields",className:"mb-0"})}),!!B.length&&t.jsxRuntimeExports.jsx(r.Col,{...V,children:t.jsxRuntimeExports.jsx(Q.default,{label:"Sort By",name:"sortBy",items:B.map(e=>({id:e.name,label:e.label})),nameFieldInArray:"label",fieldId:"id",className:"mb-0",dropdownRender:e=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[e,t.jsxRuntimeExports.jsx(r.Form.Item,{name:"sortByType",noStyle:!0,className:"mt-3",children:t.jsxRuntimeExports.jsx(r.Radio.Group,{className:"w-100",defaultValue:"DESC",optionType:"button",children:t.jsxRuntimeExports.jsxs(r.Row,{children:[t.jsxRuntimeExports.jsx(r.Col,{xs:12,children:t.jsxRuntimeExports.jsx(r.Radio,{className:"w-100",style:{borderTopRightRadius:0,borderBottomRightRadius:0},value:"ASC",children:"Ascending"})}),t.jsxRuntimeExports.jsx(r.Col,{xs:12,children:t.jsxRuntimeExports.jsx(r.Radio,{className:"w-100",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0},value:"DESC",children:"Descending"})})]})})})]})})}),g?g(i):null]}),t.jsxRuntimeExports.jsx(v.default,{className:"mt-3",type:"primary",block:!0,htmlType:"submit",disabled:x,children:"Submit"})]}),t.jsxRuntimeExports.jsxs(r.Space,{children:[!!j&&t.jsxRuntimeExports.jsx(J.PrintButton,{disabled:x||!d.length,onClick:()=>j==null?void 0:j({tableId:"#crud-table table",data:d,fields:R.map(e=>({...e,render:I.getRendererValueCrudViewer(e)}))})}),!!b&&t.jsxRuntimeExports.jsx(v.default,{disabled:x||!d.length,onClick:()=>b==null?void 0:b({tableId:"#crud-table table",data:d,fields:R.map(e=>({...e,render:I.getRendererValueCrudViewer(e)}))}),icon:t.jsxRuntimeExports.jsx(D.FileExcelOutlined,{}),className:`group
|
|
2
|
+
${x||!d.length?"":"!bg-green-700 hover:!bg-green-600 !text-white !border-green-700 hover:!border-green-600"}
|
|
3
|
+
|
|
4
|
+
`,children:"Excel"})]}),O,t.jsxRuntimeExports.jsx(H.default,{minusHeight:M,data:d,size:L,fields:R,idField:A,loadingData:x,paginateProps:_,viewable:!1})]})})}exports.default=X;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { FileExcelOutlined as X } from "@ant-design/icons";
|
|
3
|
+
import { Form as j, Space as L, Row as G, Col as f, Radio as S } from "antd";
|
|
4
|
+
import { useMemo as Y, useState as x, useCallback as Z, useEffect as B } from "react";
|
|
5
|
+
import R from "./CrudField.js";
|
|
6
|
+
import E from "./view/CrudViewer.js";
|
|
7
|
+
import O from "../common/button/Button.js";
|
|
8
|
+
import { PrintButton as k } from "../common/button/PrintButton.js";
|
|
9
|
+
import { SelectFieldInReport as P } from "../common/report/SelectFieldInReport.js";
|
|
10
|
+
import ee from "../common/select/SelectComponent.js";
|
|
11
|
+
import { getRendererValueCrudViewer as _ } from "./view/CrudViewerUtil.js";
|
|
12
|
+
const $ = { lg: 6, md: 8, sm: 12, xs: 24 }, re = { lg: 12, md: 16, sm: 24, xs: 24 };
|
|
13
|
+
function pe({
|
|
14
|
+
fields: n,
|
|
15
|
+
data: i,
|
|
16
|
+
idField: z,
|
|
17
|
+
loadingData: c,
|
|
18
|
+
onSubmit: F,
|
|
19
|
+
paginateProps: D,
|
|
20
|
+
size: H,
|
|
21
|
+
onClickPrint: b,
|
|
22
|
+
onClickExcelExport: h,
|
|
23
|
+
minusHeight: J,
|
|
24
|
+
extraSearchFields: w,
|
|
25
|
+
searchOnMount: N,
|
|
26
|
+
summary: K
|
|
27
|
+
}) {
|
|
28
|
+
const { searchable: M, selectable: d, sortable: T, defaultSort: m } = Y(() => {
|
|
29
|
+
var p, u, V, q, A;
|
|
30
|
+
const e = [], t = [], l = [];
|
|
31
|
+
let o;
|
|
32
|
+
for (const s of n.filter((W) => !W.hidden))
|
|
33
|
+
s.type === "image" || !s.report || ((p = s.report) != null && p.searchable && e.push(s), (u = s.report) != null && u.sortable && (t.push(s), !o && ((V = s.report) != null && V.defaultSort) && (o = s)), s.hideInTable || l.push({
|
|
34
|
+
id: s.name,
|
|
35
|
+
label: s.label,
|
|
36
|
+
lock: (q = s.report) == null ? void 0 : q.lock,
|
|
37
|
+
alreadySelected: (A = s.report) == null ? void 0 : A.alreadySelected
|
|
38
|
+
}));
|
|
39
|
+
return {
|
|
40
|
+
defaultSort: o,
|
|
41
|
+
searchable: e,
|
|
42
|
+
sortable: t,
|
|
43
|
+
selectable: l
|
|
44
|
+
};
|
|
45
|
+
}, [n]), [y, v] = x(
|
|
46
|
+
[]
|
|
47
|
+
), g = Z(
|
|
48
|
+
async ({
|
|
49
|
+
sortBy: e,
|
|
50
|
+
sortByType: t,
|
|
51
|
+
showFields: l = [],
|
|
52
|
+
...o
|
|
53
|
+
}) => {
|
|
54
|
+
const p = [];
|
|
55
|
+
e && p.push({
|
|
56
|
+
field: e,
|
|
57
|
+
sort: t ?? "DESC"
|
|
58
|
+
}), v(
|
|
59
|
+
n.filter((u) => l.includes(u.name)).map((u) => ({ ...u, hideInTable: !1 }))
|
|
60
|
+
), F({ showFields: l, sortBy: p, ...o });
|
|
61
|
+
},
|
|
62
|
+
[n, F]
|
|
63
|
+
), [a] = j.useForm(), [C, Q] = x(!1), [I, U] = x(!0);
|
|
64
|
+
return B(() => {
|
|
65
|
+
if (N && I) {
|
|
66
|
+
const e = setTimeout(() => {
|
|
67
|
+
a.validateFields().then((t) => {
|
|
68
|
+
g(t);
|
|
69
|
+
}), U(!1);
|
|
70
|
+
}, 200);
|
|
71
|
+
return () => clearTimeout(e);
|
|
72
|
+
}
|
|
73
|
+
}, [g, a, I, N]), B(() => {
|
|
74
|
+
var t, l, o;
|
|
75
|
+
!a.getFieldValue("sortBy") && m && (console.log((t = m.report) == null ? void 0 : t.defaultSort), a.setFieldsValue({
|
|
76
|
+
sortBy: m.name,
|
|
77
|
+
sortByType: typeof ((l = m.report) == null ? void 0 : l.defaultSort) == "string" ? (o = m.report) == null ? void 0 : o.defaultSort : "ASC"
|
|
78
|
+
}));
|
|
79
|
+
}, [m, a]), B(() => {
|
|
80
|
+
if (C) {
|
|
81
|
+
const e = d.filter((t) => t.alreadySelected).map((t) => t.id);
|
|
82
|
+
v(
|
|
83
|
+
n.filter((t) => e.includes(t.name)).map((t) => ({ ...t, hideInTable: !1 }))
|
|
84
|
+
), Q(!1);
|
|
85
|
+
}
|
|
86
|
+
}, [n, C, d]), /* @__PURE__ */ r.jsx(r.Fragment, { children: /* @__PURE__ */ r.jsxs(L, { className: "w-100", direction: "vertical", children: [
|
|
87
|
+
/* @__PURE__ */ r.jsxs(j, { form: a, layout: "vertical", onFinish: g, children: [
|
|
88
|
+
/* @__PURE__ */ r.jsxs(G, { gutter: [8, 8], children: [
|
|
89
|
+
M.map((e) => {
|
|
90
|
+
var t, l, o;
|
|
91
|
+
return /* @__PURE__ */ r.jsx(
|
|
92
|
+
f,
|
|
93
|
+
{
|
|
94
|
+
...e.grid ?? $,
|
|
95
|
+
style: { alignSelf: "end" },
|
|
96
|
+
children: (t = e.report) != null && t.customRender ? e.report.customRender(a) : e.type === "date" ? /* @__PURE__ */ r.jsx(
|
|
97
|
+
R,
|
|
98
|
+
{
|
|
99
|
+
...e,
|
|
100
|
+
type: "date",
|
|
101
|
+
range: (l = e.report) == null ? void 0 : l.range,
|
|
102
|
+
required: !!((o = e.report) != null && o.required),
|
|
103
|
+
readonly: !1,
|
|
104
|
+
fieldClassName: "mb-0"
|
|
105
|
+
}
|
|
106
|
+
) : e.type === "select" ? /* @__PURE__ */ r.jsx(
|
|
107
|
+
R,
|
|
108
|
+
{
|
|
109
|
+
...e,
|
|
110
|
+
type: "select",
|
|
111
|
+
multiple: !0,
|
|
112
|
+
required: !1,
|
|
113
|
+
readonly: !1,
|
|
114
|
+
fieldClassName: "mb-0"
|
|
115
|
+
}
|
|
116
|
+
) : /* @__PURE__ */ r.jsx(
|
|
117
|
+
R,
|
|
118
|
+
{
|
|
119
|
+
...e,
|
|
120
|
+
readonly: !1,
|
|
121
|
+
required: !1,
|
|
122
|
+
fieldClassName: "mb-0"
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
},
|
|
126
|
+
e.name
|
|
127
|
+
);
|
|
128
|
+
}),
|
|
129
|
+
!!(d != null && d.length) && /* @__PURE__ */ r.jsx(f, { ...re, children: /* @__PURE__ */ r.jsx(
|
|
130
|
+
P,
|
|
131
|
+
{
|
|
132
|
+
items: d,
|
|
133
|
+
name: "showFields",
|
|
134
|
+
mode: "multiple",
|
|
135
|
+
label: "Show Fields",
|
|
136
|
+
className: "mb-0"
|
|
137
|
+
}
|
|
138
|
+
) }),
|
|
139
|
+
!!T.length && /* @__PURE__ */ r.jsx(f, { ...$, children: /* @__PURE__ */ r.jsx(
|
|
140
|
+
ee,
|
|
141
|
+
{
|
|
142
|
+
label: "Sort By",
|
|
143
|
+
name: "sortBy",
|
|
144
|
+
items: T.map((e) => ({ id: e.name, label: e.label })),
|
|
145
|
+
nameFieldInArray: "label",
|
|
146
|
+
fieldId: "id",
|
|
147
|
+
className: "mb-0",
|
|
148
|
+
dropdownRender: (e) => /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
149
|
+
e,
|
|
150
|
+
/* @__PURE__ */ r.jsx(j.Item, { name: "sortByType", noStyle: !0, className: "mt-3", children: /* @__PURE__ */ r.jsx(
|
|
151
|
+
S.Group,
|
|
152
|
+
{
|
|
153
|
+
className: "w-100",
|
|
154
|
+
defaultValue: "DESC",
|
|
155
|
+
optionType: "button",
|
|
156
|
+
children: /* @__PURE__ */ r.jsxs(G, { children: [
|
|
157
|
+
/* @__PURE__ */ r.jsx(f, { xs: 12, children: /* @__PURE__ */ r.jsx(
|
|
158
|
+
S,
|
|
159
|
+
{
|
|
160
|
+
className: "w-100",
|
|
161
|
+
style: {
|
|
162
|
+
borderTopRightRadius: 0,
|
|
163
|
+
borderBottomRightRadius: 0
|
|
164
|
+
},
|
|
165
|
+
value: "ASC",
|
|
166
|
+
children: "Ascending"
|
|
167
|
+
}
|
|
168
|
+
) }),
|
|
169
|
+
/* @__PURE__ */ r.jsx(f, { xs: 12, children: /* @__PURE__ */ r.jsx(
|
|
170
|
+
S,
|
|
171
|
+
{
|
|
172
|
+
className: "w-100",
|
|
173
|
+
style: {
|
|
174
|
+
borderTopLeftRadius: 0,
|
|
175
|
+
borderBottomLeftRadius: 0
|
|
176
|
+
},
|
|
177
|
+
value: "DESC",
|
|
178
|
+
children: "Descending"
|
|
179
|
+
}
|
|
180
|
+
) })
|
|
181
|
+
] })
|
|
182
|
+
}
|
|
183
|
+
) })
|
|
184
|
+
] })
|
|
185
|
+
}
|
|
186
|
+
) }),
|
|
187
|
+
w ? w(a) : null
|
|
188
|
+
] }),
|
|
189
|
+
/* @__PURE__ */ r.jsx(
|
|
190
|
+
O,
|
|
191
|
+
{
|
|
192
|
+
className: "mt-3",
|
|
193
|
+
type: "primary",
|
|
194
|
+
block: !0,
|
|
195
|
+
htmlType: "submit",
|
|
196
|
+
disabled: c,
|
|
197
|
+
children: "Submit"
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
] }),
|
|
201
|
+
/* @__PURE__ */ r.jsxs(L, { children: [
|
|
202
|
+
!!b && /* @__PURE__ */ r.jsx(
|
|
203
|
+
k,
|
|
204
|
+
{
|
|
205
|
+
disabled: c || !i.length,
|
|
206
|
+
onClick: () => b == null ? void 0 : b({
|
|
207
|
+
tableId: "#crud-table table",
|
|
208
|
+
data: i,
|
|
209
|
+
fields: y.map((e) => ({
|
|
210
|
+
...e,
|
|
211
|
+
render: _(e)
|
|
212
|
+
}))
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
!!h && /* @__PURE__ */ r.jsx(
|
|
217
|
+
O,
|
|
218
|
+
{
|
|
219
|
+
disabled: c || !i.length,
|
|
220
|
+
onClick: () => h == null ? void 0 : h({
|
|
221
|
+
tableId: "#crud-table table",
|
|
222
|
+
data: i,
|
|
223
|
+
fields: y.map((e) => ({
|
|
224
|
+
...e,
|
|
225
|
+
render: _(e)
|
|
226
|
+
}))
|
|
227
|
+
}),
|
|
228
|
+
icon: /* @__PURE__ */ r.jsx(X, {}),
|
|
229
|
+
className: `group
|
|
230
|
+
${c || !i.length ? "" : "!bg-green-700 hover:!bg-green-600 !text-white !border-green-700 hover:!border-green-600"}
|
|
231
|
+
|
|
232
|
+
`,
|
|
233
|
+
children: "Excel"
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
] }),
|
|
237
|
+
K,
|
|
238
|
+
/* @__PURE__ */ r.jsx(
|
|
239
|
+
E,
|
|
240
|
+
{
|
|
241
|
+
minusHeight: J,
|
|
242
|
+
data: i,
|
|
243
|
+
size: H,
|
|
244
|
+
fields: y,
|
|
245
|
+
idField: z,
|
|
246
|
+
loadingData: c,
|
|
247
|
+
paginateProps: D,
|
|
248
|
+
viewable: !1
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
] }) });
|
|
252
|
+
}
|
|
253
|
+
export {
|
|
254
|
+
pe as default
|
|
255
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../../_virtual/jsx-runtime.cjs"),o=require("react"),E=require("@ant-design/icons"),i=require("antd"),a=require("./CrudField.cjs"),q=require("../common/button/Button.cjs");function M({searchFields:t=[],fields:m,searchOnChange:d,onSearch:b,searchDefaultValues:g,searchFieldsCustomColumnProps:r}){const R=o.useMemo(()=>t.map(n=>typeof n=="string"?{...m.find(y=>n===y.name),required:!1}:{...m.find(f=>(n==null?void 0:n.name)===f.name),...n}).filter(n=>n&&!(n!=null&&n.hidden)),[t,m]),j=o.useMemo(()=>t.length===1?{field:22,button:2}:t.length===2?{field:11,button:2}:t.length===3?{field:6,button:6}:t.length===4?{field:5,button:4}:t.length===5?{field:4,button:4}:{field:4,button:4},[t.length]),p=o.useMemo(()=>t.length===1?{field:22,button:2}:t.length===2?{field:11,button:2}:t.length===3?{field:6,button:6}:t.length===4?{field:5,button:4}:t.length===5?{field:4,button:4}:{field:4,button:4},[t.length]),s=o.useMemo(()=>t.length===1?{field:21,button:3}:t.length===2?{field:11,button:2}:t.length===3?{field:24,button:24}:t.length===4?{field:5,button:4}:t.length===5?{field:4,button:4}:{field:4,button:4},[t.length]),[u]=i.Form.useForm(),x=o.useCallback(async n=>{if((n||d)&&b){const l=await u.validateFields();b(l)}},[u,b,d]);return o.useEffect(()=>{g&&(u.setFieldsValue(g),x(!0))},[u,g]),t!=null&&t.length?e.jsxRuntimeExports.jsx(i.Form,{form:u,onFinish:()=>x(!0),layout:"vertical",className:"mb-2",onChange:()=>x(!1),children:e.jsxRuntimeExports.jsxs(i.Row,{gutter:[4,8],className:"w-100",children:[R.map((n,l)=>{const f=(r==null?void 0:r[l])??{md:j.field,sm:p.field,xs:s.field};return o.createElement(i.Col,{...f,key:`search_field_${String(n.name)}`,className:"align-self-end"},e.jsxRuntimeExports.jsx(a.default,{...n,readonly:!1,fieldClassName:"mb-0"}))}),e.jsxRuntimeExports.jsx(i.Col,{md:j.button,sm:p.button,xs:s.button,style:{alignSelf:"end"},children:e.jsxRuntimeExports.jsx(q.default,{type:"primary",htmlType:"submit",block:!0,icon:e.jsxRuntimeExports.jsx(E.SearchOutlined,{})})})]})}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})}exports.default=M;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { j as o } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { useMemo as l, useCallback as k, useEffect as E, createElement as v } from "react";
|
|
3
|
+
import { SearchOutlined as R } from "@ant-design/icons";
|
|
4
|
+
import { Form as y, Row as S, Col as w } from "antd";
|
|
5
|
+
import _ from "./CrudField.js";
|
|
6
|
+
import q from "../common/button/Button.js";
|
|
7
|
+
function G({
|
|
8
|
+
searchFields: t = [],
|
|
9
|
+
fields: e,
|
|
10
|
+
searchOnChange: p,
|
|
11
|
+
onSearch: i,
|
|
12
|
+
searchDefaultValues: b,
|
|
13
|
+
searchFieldsCustomColumnProps: g
|
|
14
|
+
}) {
|
|
15
|
+
const N = l(
|
|
16
|
+
() => t.map((n) => typeof n == "string" ? {
|
|
17
|
+
...e.find((a) => n === a.name),
|
|
18
|
+
required: !1
|
|
19
|
+
} : {
|
|
20
|
+
...e.find(
|
|
21
|
+
(u) => (n == null ? void 0 : n.name) === u.name
|
|
22
|
+
),
|
|
23
|
+
...n
|
|
24
|
+
}).filter((n) => n && !(n != null && n.hidden)),
|
|
25
|
+
[t, e]
|
|
26
|
+
), x = l(
|
|
27
|
+
() => t.length === 1 ? { field: 22, button: 2 } : t.length === 2 ? { field: 11, button: 2 } : t.length === 3 ? { field: 6, button: 6 } : t.length === 4 ? { field: 5, button: 4 } : t.length === 5 ? { field: 4, button: 4 } : { field: 4, button: 4 },
|
|
28
|
+
[t.length]
|
|
29
|
+
), d = l(
|
|
30
|
+
() => t.length === 1 ? { field: 22, button: 2 } : t.length === 2 ? { field: 11, button: 2 } : t.length === 3 ? { field: 6, button: 6 } : t.length === 4 ? { field: 5, button: 4 } : t.length === 5 ? { field: 4, button: 4 } : { field: 4, button: 4 },
|
|
31
|
+
[t.length]
|
|
32
|
+
), j = l(
|
|
33
|
+
() => t.length === 1 ? { field: 21, button: 3 } : t.length === 2 ? { field: 11, button: 2 } : t.length === 3 ? { field: 24, button: 24 } : t.length === 4 ? { field: 5, button: 4 } : t.length === 5 ? { field: 4, button: 4 } : { field: 4, button: 4 },
|
|
34
|
+
[t.length]
|
|
35
|
+
), [f] = y.useForm(), r = k(
|
|
36
|
+
async (n) => {
|
|
37
|
+
if ((n || p) && i) {
|
|
38
|
+
const m = await f.validateFields();
|
|
39
|
+
i(m);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
[f, i, p]
|
|
43
|
+
);
|
|
44
|
+
return E(() => {
|
|
45
|
+
b && (f.setFieldsValue(b), r(!0));
|
|
46
|
+
}, [f, b]), t != null && t.length ? /* @__PURE__ */ o.jsx(
|
|
47
|
+
y,
|
|
48
|
+
{
|
|
49
|
+
form: f,
|
|
50
|
+
onFinish: () => r(!0),
|
|
51
|
+
layout: "vertical",
|
|
52
|
+
className: "mb-2",
|
|
53
|
+
onChange: () => r(!1),
|
|
54
|
+
children: /* @__PURE__ */ o.jsxs(S, { gutter: [4, 8], className: "w-100", children: [
|
|
55
|
+
N.map((n, m) => {
|
|
56
|
+
const u = (g == null ? void 0 : g[m]) ?? {
|
|
57
|
+
md: x.field,
|
|
58
|
+
sm: d.field,
|
|
59
|
+
xs: j.field
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ v(
|
|
62
|
+
w,
|
|
63
|
+
{
|
|
64
|
+
...u,
|
|
65
|
+
key: `search_field_${String(n.name)}`,
|
|
66
|
+
className: "align-self-end"
|
|
67
|
+
},
|
|
68
|
+
/* @__PURE__ */ o.jsx(_, { ...n, readonly: !1, fieldClassName: "mb-0" })
|
|
69
|
+
);
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ o.jsx(
|
|
72
|
+
w,
|
|
73
|
+
{
|
|
74
|
+
md: x.button,
|
|
75
|
+
sm: d.button,
|
|
76
|
+
xs: j.button,
|
|
77
|
+
style: { alignSelf: "end" },
|
|
78
|
+
children: /* @__PURE__ */ o.jsx(
|
|
79
|
+
q,
|
|
80
|
+
{
|
|
81
|
+
type: "primary",
|
|
82
|
+
htmlType: "submit",
|
|
83
|
+
block: !0,
|
|
84
|
+
icon: /* @__PURE__ */ o.jsx(R, {})
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] })
|
|
90
|
+
}
|
|
91
|
+
) : /* @__PURE__ */ o.jsx(o.Fragment, {});
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
G as default
|
|
95
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../../_virtual/jsx-runtime.cjs");;/* empty css */const x=require("@ant-design/icons"),h=require("antd"),M=require("mime"),u=require("react"),B=require("react-i18next"),H=require("../../locale/hooks/translation-constants.cjs"),z=require("../../util/ValidationUtil.cjs"),w=require("../common/button/Button.cjs"),G=require("../common/layout/VerticalSpace.cjs");function J({name:l,label:t,required:r,provider:s,onUploading:i,onRemoved:d,fieldClassName:p,accept:g,rules:D,maxCount:C=1,block:N,...k}){const j=h.Form.useFormInstance(),f=h.Form.useWatch(l,j),[P,O]=u.useState(!1),[q,U]=u.useState(!1),_=u.useCallback(async n=>{var a,o;try{const{file:c}=n,R=c.name;O(!0),U(!0),i==null||i(!0);const F=R??"",b=F.split("."),L=b[b.length-1],W=s.generateFileName(F),I=`${await s.getInitialPath()}/${W}.${L}`;console.log({filePath:I});const V=await s.upload({...c,originFileObj:c},I);i==null||i(!1),j.setFieldValue(l,V),(a=n.onSuccess)==null||a.call(n,V)}catch(c){(o=n.onError)==null||o.call(n,c)}finally{O(!1)}},[j,l,i,s]),[E,S]=u.useState([]);u.useEffect(()=>{!q&&f&&Promise.all((Array.isArray(f)?f:[f]).map(async n=>{const a=M.getType(n),o=n.split("/").pop(),c=await s.getRealUrl(n);return{uid:n,url:c,type:a,name:o}})).then(n=>S(()=>{const a=n.map(({url:o,type:c,uid:R,name:F})=>({uid:R,url:o,type:c,response:R,thumbUrl:o,name:F}));return console.log(a),a}))},[f,q,P,s]);const $=u.useCallback(async n=>{const a=n.response,o=a||j.getFieldValue(l);await s.delete(o),d==null||d(),n&&j.setFieldsValue({[l]:null})},[j,l,d,s]);return e.jsxRuntimeExports.jsxs(h.Form.Item,{label:t,required:r,name:l,className:p,rules:[...r?z.default.required(t):[],...D??[]],children:[e.jsxRuntimeExports.jsx("input",{hidden:!0}),e.jsxRuntimeExports.jsx(h.Upload,{...k,fileList:E,className:((E==null?void 0:E.length)??0)>=C?"hide-upload":"",maxCount:C,customRequest:_,onRemove:$,listType:"picture",onChange:({fileList:n})=>{S(n)},style:N?{width:"100%"}:void 0,children:e.jsxRuntimeExports.jsx(w.default,{loading:P,children:"Upload File"})})]})}const K=({provider:l,value:t})=>{const[r,s]=u.useState();return u.useEffect(()=>{t&&l.getRealUrl(t).then(i=>{s({mimeType:M.getType(t),url:i,fileName:t.split("/").pop()??t})})},[l,t]),r?e.jsxRuntimeExports.jsx(A,{fileName:r.fileName,url:r==null?void 0:r.url,mimeType:r==null?void 0:r.mimeType}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})},A=({url:l,mimeType:t="",fileName:r})=>{const s=u.useMemo(()=>t!=null&&t.includes("image")?"image":t!=null&&t.includes("pdf")?"pdf":t!=null&&t.includes("word")?"word":t!=null&&t.includes("text")?"text":t!=null&&t.includes("presentation")?"presentation":t!=null&&t.includes("excel")||t!=null&&t.includes("spreadsheet")?"excel":"file",[t]),i=u.useMemo(()=>{switch(s){case"image":return e.jsxRuntimeExports.jsx(x.FileImageOutlined,{});case"pdf":return e.jsxRuntimeExports.jsx(x.FilePdfOutlined,{});case"word":return e.jsxRuntimeExports.jsx(x.FileWordOutlined,{});case"text":return e.jsxRuntimeExports.jsx(x.FileTextOutlined,{});case"excel":return e.jsxRuntimeExports.jsx(x.FileExcelOutlined,{});case"presentation":return e.jsxRuntimeExports.jsx(x.FilePptOutlined,{});default:return e.jsxRuntimeExports.jsx(x.FileOutlined,{})}},[s]),[d,p]=u.useState(!1),{t:g}=B.useTranslation(H.TRANSLATION_NAMESPACE);return s!=="file"&&s!=="text"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(h.Modal,{open:d,title:r,onCancel:()=>p(!1),footer:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),width:"100%",style:{top:"8px",minHeight:"700px"},destroyOnClose:!0,children:e.jsxRuntimeExports.jsxs(G.default,{children:[e.jsxRuntimeExports.jsx(w.default,{tooltip:r,icon:e.jsxRuntimeExports.jsx(x.ExportOutlined,{}),target:"_blank",href:l,style:{textDecoration:"none"},children:g("str.openInNewTab")}),s==="image"?e.jsxRuntimeExports.jsx("img",{src:l,alt:r,style:{width:"100%"}}):s==="pdf"?e.jsxRuntimeExports.jsxs("iframe",{title:r,src:l,width:"100%",height:"700px",children:["This browser does not support PDFs. Please download the PDF to view it:",e.jsxRuntimeExports.jsx("a",{href:l,children:"Download PDF"}),"."]}):e.jsxRuntimeExports.jsxs("iframe",{title:r,src:`https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(l)}`,width:"100%",height:"700px",children:["This browser does not support open ",s.toUpperCase(),". Please download the",s.toUpperCase()," to view it:",e.jsxRuntimeExports.jsxs("a",{href:l,children:["Download ",s.toUpperCase()]}),"."]})]})}),e.jsxRuntimeExports.jsx(w.default,{tooltip:r,icon:i,shape:"circle",onClick:()=>p(!0)})]}):e.jsxRuntimeExports.jsx(w.default,{tooltip:r,icon:i,target:"_blank",href:l,shape:"circle"})};exports.FileCellValue=A;exports.FileCrudCellValue=K;exports.default=J;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { FileOutlined as H, FilePptOutlined as z, FileExcelOutlined as G, FileTextOutlined as J, FileWordOutlined as K, FilePdfOutlined as Q, FileImageOutlined as X, ExportOutlined as Y } from "@ant-design/icons";
|
|
4
|
+
import { Form as g, Upload as Z, Modal as v } from "antd";
|
|
5
|
+
import S from "mime";
|
|
6
|
+
import { useState as h, useCallback as N, useEffect as U, useMemo as M } from "react";
|
|
7
|
+
import { useTranslation as y } from "react-i18next";
|
|
8
|
+
import { TRANSLATION_NAMESPACE as m } from "../../locale/hooks/translation-constants.js";
|
|
9
|
+
import T from "../../util/ValidationUtil.js";
|
|
10
|
+
import w from "../common/button/Button.js";
|
|
11
|
+
import tt from "../common/layout/VerticalSpace.js";
|
|
12
|
+
function ht({
|
|
13
|
+
name: n,
|
|
14
|
+
label: t,
|
|
15
|
+
required: r,
|
|
16
|
+
provider: s,
|
|
17
|
+
onUploading: a,
|
|
18
|
+
onRemoved: u,
|
|
19
|
+
fieldClassName: x,
|
|
20
|
+
accept: C,
|
|
21
|
+
rules: k,
|
|
22
|
+
maxCount: P = 1,
|
|
23
|
+
block: $,
|
|
24
|
+
..._
|
|
25
|
+
}) {
|
|
26
|
+
const d = g.useFormInstance(), f = g.useWatch(n, d), [O, I] = h(!1), [V, L] = h(!1), R = N(
|
|
27
|
+
async (l) => {
|
|
28
|
+
var c, o;
|
|
29
|
+
try {
|
|
30
|
+
const { file: i } = l, p = i.name;
|
|
31
|
+
I(!0), L(!0), a == null || a(!0);
|
|
32
|
+
const F = p ?? "", E = F.split("."), q = E[E.length - 1], B = s.generateFileName(F), A = `${await s.getInitialPath()}/${B}.${q}`;
|
|
33
|
+
console.log({ filePath: A });
|
|
34
|
+
const D = await s.upload(
|
|
35
|
+
{ ...i, originFileObj: i },
|
|
36
|
+
A
|
|
37
|
+
);
|
|
38
|
+
a == null || a(!1), d.setFieldValue(n, D), (c = l.onSuccess) == null || c.call(l, D);
|
|
39
|
+
} catch (i) {
|
|
40
|
+
(o = l.onError) == null || o.call(l, i);
|
|
41
|
+
} finally {
|
|
42
|
+
I(!1);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
[d, n, a, s]
|
|
46
|
+
), [j, b] = h([]);
|
|
47
|
+
U(() => {
|
|
48
|
+
!V && f && Promise.all(
|
|
49
|
+
(Array.isArray(f) ? f : [f]).map(
|
|
50
|
+
async (l) => {
|
|
51
|
+
const c = S.getType(l), o = l.split("/").pop(), i = await s.getRealUrl(l);
|
|
52
|
+
return {
|
|
53
|
+
uid: l,
|
|
54
|
+
url: i,
|
|
55
|
+
type: c,
|
|
56
|
+
name: o
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
).then((l) => b(() => {
|
|
61
|
+
const c = l.map(({ url: o, type: i, uid: p, name: F }) => ({ uid: p, url: o, type: i, response: p, thumbUrl: o, name: F }));
|
|
62
|
+
return console.log(c), c;
|
|
63
|
+
}));
|
|
64
|
+
}, [f, V, O, s]);
|
|
65
|
+
const W = N(
|
|
66
|
+
async (l) => {
|
|
67
|
+
const c = l.response, o = c || d.getFieldValue(n);
|
|
68
|
+
await s.delete(o), u == null || u(), l && d.setFieldsValue({ [n]: null });
|
|
69
|
+
},
|
|
70
|
+
[d, n, u, s]
|
|
71
|
+
);
|
|
72
|
+
return /* @__PURE__ */ e.jsxs(
|
|
73
|
+
g.Item,
|
|
74
|
+
{
|
|
75
|
+
label: t,
|
|
76
|
+
required: r,
|
|
77
|
+
name: n,
|
|
78
|
+
className: x,
|
|
79
|
+
rules: [
|
|
80
|
+
...r ? T.required(t) : [],
|
|
81
|
+
...k ?? []
|
|
82
|
+
],
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ e.jsx("input", { hidden: !0 }),
|
|
85
|
+
/* @__PURE__ */ e.jsx(
|
|
86
|
+
Z,
|
|
87
|
+
{
|
|
88
|
+
..._,
|
|
89
|
+
fileList: j,
|
|
90
|
+
className: ((j == null ? void 0 : j.length) ?? 0) >= P ? "hide-upload" : "",
|
|
91
|
+
maxCount: P,
|
|
92
|
+
customRequest: R,
|
|
93
|
+
onRemove: W,
|
|
94
|
+
listType: "picture",
|
|
95
|
+
onChange: ({ fileList: l }) => {
|
|
96
|
+
b(l);
|
|
97
|
+
},
|
|
98
|
+
style: $ ? { width: "100%" } : void 0,
|
|
99
|
+
children: /* @__PURE__ */ e.jsx(w, { loading: O, children: "Upload File" })
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
const xt = ({ provider: n, value: t }) => {
|
|
107
|
+
const [r, s] = h();
|
|
108
|
+
return U(() => {
|
|
109
|
+
t && n.getRealUrl(t).then((a) => {
|
|
110
|
+
s({
|
|
111
|
+
mimeType: S.getType(t),
|
|
112
|
+
url: a,
|
|
113
|
+
fileName: t.split("/").pop() ?? t
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}, [n, t]), r ? /* @__PURE__ */ e.jsx(
|
|
117
|
+
et,
|
|
118
|
+
{
|
|
119
|
+
fileName: r.fileName,
|
|
120
|
+
url: r == null ? void 0 : r.url,
|
|
121
|
+
mimeType: r == null ? void 0 : r.mimeType
|
|
122
|
+
}
|
|
123
|
+
) : /* @__PURE__ */ e.jsx(e.Fragment, {});
|
|
124
|
+
}, et = ({ url: n, mimeType: t = "", fileName: r }) => {
|
|
125
|
+
const s = M(() => t != null && t.includes("image") ? "image" : t != null && t.includes("pdf") ? "pdf" : t != null && t.includes("word") ? "word" : t != null && t.includes("text") ? "text" : t != null && t.includes("presentation") ? "presentation" : t != null && t.includes("excel") || t != null && t.includes("spreadsheet") ? "excel" : "file", [t]), a = M(() => {
|
|
126
|
+
switch (s) {
|
|
127
|
+
case "image":
|
|
128
|
+
return /* @__PURE__ */ e.jsx(X, {});
|
|
129
|
+
case "pdf":
|
|
130
|
+
return /* @__PURE__ */ e.jsx(Q, {});
|
|
131
|
+
case "word":
|
|
132
|
+
return /* @__PURE__ */ e.jsx(K, {});
|
|
133
|
+
case "text":
|
|
134
|
+
return /* @__PURE__ */ e.jsx(J, {});
|
|
135
|
+
case "excel":
|
|
136
|
+
return /* @__PURE__ */ e.jsx(G, {});
|
|
137
|
+
case "presentation":
|
|
138
|
+
return /* @__PURE__ */ e.jsx(z, {});
|
|
139
|
+
default:
|
|
140
|
+
return /* @__PURE__ */ e.jsx(H, {});
|
|
141
|
+
}
|
|
142
|
+
}, [s]), [u, x] = h(!1), { t: C } = y(m);
|
|
143
|
+
return s !== "file" && s !== "text" ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
144
|
+
/* @__PURE__ */ e.jsx(
|
|
145
|
+
v,
|
|
146
|
+
{
|
|
147
|
+
open: u,
|
|
148
|
+
title: r,
|
|
149
|
+
onCancel: () => x(!1),
|
|
150
|
+
footer: /* @__PURE__ */ e.jsx(e.Fragment, {}),
|
|
151
|
+
width: "100%",
|
|
152
|
+
style: { top: "8px", minHeight: "700px" },
|
|
153
|
+
destroyOnClose: !0,
|
|
154
|
+
children: /* @__PURE__ */ e.jsxs(tt, { children: [
|
|
155
|
+
/* @__PURE__ */ e.jsx(
|
|
156
|
+
w,
|
|
157
|
+
{
|
|
158
|
+
tooltip: r,
|
|
159
|
+
icon: /* @__PURE__ */ e.jsx(Y, {}),
|
|
160
|
+
target: "_blank",
|
|
161
|
+
href: n,
|
|
162
|
+
style: { textDecoration: "none" },
|
|
163
|
+
children: C("str.openInNewTab")
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
s === "image" ? /* @__PURE__ */ e.jsx("img", { src: n, alt: r, style: { width: "100%" } }) : s === "pdf" ? /* @__PURE__ */ e.jsxs("iframe", { title: r, src: n, width: "100%", height: "700px", children: [
|
|
167
|
+
"This browser does not support PDFs. Please download the PDF to view it:",
|
|
168
|
+
/* @__PURE__ */ e.jsx("a", { href: n, children: "Download PDF" }),
|
|
169
|
+
"."
|
|
170
|
+
] }) : /* @__PURE__ */ e.jsxs(
|
|
171
|
+
"iframe",
|
|
172
|
+
{
|
|
173
|
+
title: r,
|
|
174
|
+
src: `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(
|
|
175
|
+
n
|
|
176
|
+
)}`,
|
|
177
|
+
width: "100%",
|
|
178
|
+
height: "700px",
|
|
179
|
+
children: [
|
|
180
|
+
"This browser does not support open ",
|
|
181
|
+
s.toUpperCase(),
|
|
182
|
+
". Please download the",
|
|
183
|
+
s.toUpperCase(),
|
|
184
|
+
" to view it:",
|
|
185
|
+
/* @__PURE__ */ e.jsxs("a", { href: n, children: [
|
|
186
|
+
"Download ",
|
|
187
|
+
s.toUpperCase()
|
|
188
|
+
] }),
|
|
189
|
+
"."
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
] })
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
/* @__PURE__ */ e.jsx(
|
|
197
|
+
w,
|
|
198
|
+
{
|
|
199
|
+
tooltip: r,
|
|
200
|
+
icon: a,
|
|
201
|
+
shape: "circle",
|
|
202
|
+
onClick: () => x(!0)
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
] }) : /* @__PURE__ */ e.jsx(
|
|
206
|
+
w,
|
|
207
|
+
{
|
|
208
|
+
tooltip: r,
|
|
209
|
+
icon: a,
|
|
210
|
+
target: "_blank",
|
|
211
|
+
href: n,
|
|
212
|
+
shape: "circle"
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
};
|
|
216
|
+
export {
|
|
217
|
+
et as FileCellValue,
|
|
218
|
+
xt as FileCrudCellValue,
|
|
219
|
+
ht as default
|
|
220
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var S=Object.defineProperty;var _=(e,a,t)=>a in e?S(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t;var h=(e,a,t)=>_(e,typeof a!="symbol"?a+"":a,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("../../../_virtual/jsx-runtime.cjs");;/* empty css */const O=require("@ant-design/icons"),u=require("antd"),I=require("path-browserify"),i=require("react"),k=require("../../util/NumberUtil.cjs"),A=require("../../util/ValidationUtil.cjs"),D=require("uuid"),M=require("../common/picker/ImagePicker.cjs");class p{}class T extends p{constructor(t="",s=""){super();h(this,"rootPath");h(this,"subPath");this.rootPath=t,this.subPath=s}cloneFilePath(t){const s=I.parse(t),r=`${s.name}_cloned_${k.default.randInt(1e5)}`;return I.format({dir:s.dir,ext:s.ext,name:r})}generateFileName(t){return`${t.split(".")[0]}_${D.v4().replace("-","")}`}}function W({name:e,label:a,required:t,provider:s,onUploading:r,aspectRatio:j,onRemoved:o,fieldClassName:g,hideLabel:q=!1,listType:w}){const c=u.Form.useFormInstance(),f=u.Form.useWatch(e,c),[F,C]=i.useState(!1),P=i.useCallback(async(n,N)=>{if(N){r==null||r(!0);const m=n.name,x=m.split("."),V=x[x.length-1],y=s.generateFileName(m),$=`${await s.getInitialPath()}/${y}.${V}`,b=await s.upload(n,$);C(!0),r==null||r(!1),c.setFieldValue(e,b)}else{console.log(n);const m=c.getFieldsValue(),x=await s.delete(m[e]);o==null||o(),x&&c.setFieldsValue({[e]:null})}},[c,e,o,r,s]),[d,E]=i.useState();return i.useEffect(()=>{!F&&f?s.getRealUrl(f).then(E):E(d)},[f,F,s,d]),l.jsxRuntimeExports.jsx(l.jsxRuntimeExports.Fragment,{children:l.jsxRuntimeExports.jsxs(u.Form.Item,{rules:t?A.default.required(a):[],label:q?null:a,required:t,name:e,children:[l.jsxRuntimeExports.jsx(M.default,{noStyle:!0,listType:w,aspectRatio:j,values:d,onRemove:n=>{n&&P(n,!1)},onAdd:async n=>{n&&await P(n,!0)},className:g}),l.jsxRuntimeExports.jsx(u.Input,{hidden:!0})]})})}const z=({provider:e,value:a})=>{const[t,s]=i.useState();return i.useEffect(()=>{a&&e.getRealUrl(a).then(s)},[e,a]),t?l.jsxRuntimeExports.jsx(R,{url:t}):l.jsxRuntimeExports.jsx(l.jsxRuntimeExports.Fragment,{})},R=({url:e})=>l.jsxRuntimeExports.jsx(u.Avatar,{className:"p-0",children:l.jsxRuntimeExports.jsx(u.Image,{className:"m-0 p-0 position-relative",src:e,preview:{mask:l.jsxRuntimeExports.jsx(O.EyeOutlined,{})}})});exports.FileDownloadProvider=p;exports.FileUploadProvider=T;exports.ImageCellValue=R;exports.ImageCrudCellValue=z;exports.default=W;
|