@kingteza/crud-component 1.0.3 → 1.0.5
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/FileSaver.min.cjs +1 -0
- package/dist/_virtual/FileSaver.min.js +5 -1
- package/dist/_virtual/FileSaver.min2.cjs +1 -0
- package/dist/_virtual/FileSaver.min2.js +4 -1
- package/dist/_virtual/ShowMoreText.cjs +1 -0
- package/dist/_virtual/ShowMoreText.js +7 -1
- package/dist/_virtual/ShowMoreText2.cjs +1 -0
- package/dist/_virtual/ShowMoreText2.js +4 -1
- package/dist/_virtual/Truncate.cjs +1 -0
- package/dist/_virtual/Truncate.js +4 -1
- package/dist/_virtual/_commonjsHelpers.cjs +1 -0
- package/dist/_virtual/_commonjsHelpers.js +8 -1
- package/dist/_virtual/advancedFormat.cjs +1 -0
- package/dist/_virtual/advancedFormat.js +7 -1
- package/dist/_virtual/advancedFormat2.cjs +1 -0
- 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.cjs +1 -0
- 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.cjs +1 -0
- 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/index10.cjs +1 -0
- package/dist/_virtual/index10.js +4 -1
- package/dist/_virtual/index2.cjs +1 -0
- package/dist/_virtual/index2.js +4 -1
- package/dist/_virtual/index3.cjs +1 -0
- package/dist/_virtual/index3.js +4 -1
- package/dist/_virtual/index4.cjs +1 -0
- package/dist/_virtual/index4.js +4 -1
- package/dist/_virtual/index5.cjs +1 -0
- package/dist/_virtual/index5.js +7 -1
- package/dist/_virtual/index6.cjs +1 -0
- package/dist/_virtual/index6.js +2 -1
- package/dist/_virtual/index7.cjs +1 -0
- package/dist/_virtual/index7.js +7 -1
- package/dist/_virtual/index8.cjs +1 -0
- package/dist/_virtual/index8.js +7 -1
- package/dist/_virtual/index9.cjs +1 -0
- package/dist/_virtual/index9.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/main.cjs +1 -0
- package/dist/_virtual/main.js +7 -1
- package/dist/_virtual/main2.cjs +1 -0
- package/dist/_virtual/main2.js +4 -1
- package/dist/_virtual/papaparse.min.cjs +1 -0
- package/dist/_virtual/papaparse.min.js +7 -1
- package/dist/_virtual/papaparse.min2.cjs +1 -0
- package/dist/_virtual/papaparse.min2.js +4 -1
- package/dist/_virtual/react-is.development.cjs +1 -0
- package/dist/_virtual/react-is.development.js +4 -1
- package/dist/_virtual/react-is.production.min.cjs +1 -0
- package/dist/_virtual/react-is.production.min.js +4 -1
- package/dist/_virtual/react-jsx-runtime.development.cjs +1 -0
- 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 +285 -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 +37 -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 +61 -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 +142 -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 +227 -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/{components/crud/import/CrudImportComponent.js → src/components/crud/import/CrudImportComponent.cjs} +1 -1
- package/dist/src/components/crud/import/CrudImportComponent.js +222 -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 +58 -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.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 +5 -4
- 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/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/util/DateUtil.js +0 -1
- package/dist/util/ImageUtil.js +0 -1
- package/dist/util/ValidationUtil.js +0 -1
- /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/{locale/translations/en.js → src/locale/translations/en.cjs} +0 -0
- /package/dist/{util/NumberUtil.js → src/util/NumberUtil.cjs} +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var E = (e, a, t) => a in e ? A(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
|
|
3
|
+
var h = (e, a, t) => E(e, typeof a != "symbol" ? a + "" : a, t);
|
|
4
|
+
import { j as l } from "../../../_virtual/jsx-runtime.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { Form as x, Input as O, Avatar as S, Image as D } from "antd";
|
|
7
|
+
import N from "../../../_virtual/index.js";
|
|
8
|
+
import { useState as F, useCallback as W, useEffect as w } from "react";
|
|
9
|
+
import q from "../../util/NumberUtil.js";
|
|
10
|
+
import z from "../../util/ValidationUtil.js";
|
|
11
|
+
import B from "../common/picker/ImagePicker.js";
|
|
12
|
+
import G from "../../../node_modules/uuid/dist/esm-browser/v4.js";
|
|
13
|
+
import H from "../../../node_modules/@ant-design/icons/es/icons/EyeOutlined.js";
|
|
14
|
+
class J {
|
|
15
|
+
}
|
|
16
|
+
class te extends J {
|
|
17
|
+
constructor(t = "", s = "") {
|
|
18
|
+
super();
|
|
19
|
+
h(this, "rootPath");
|
|
20
|
+
h(this, "subPath");
|
|
21
|
+
this.rootPath = t, this.subPath = s;
|
|
22
|
+
}
|
|
23
|
+
cloneFilePath(t) {
|
|
24
|
+
const s = N.parse(t), r = `${s.name}_cloned_${q.randInt(1e5)}`;
|
|
25
|
+
return N.format({
|
|
26
|
+
dir: s.dir,
|
|
27
|
+
ext: s.ext,
|
|
28
|
+
name: r
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
generateFileName(t) {
|
|
32
|
+
return `${t.split(".")[0]}_${G().replace("-", "")}`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function se({
|
|
36
|
+
name: e,
|
|
37
|
+
label: a,
|
|
38
|
+
required: t,
|
|
39
|
+
provider: s,
|
|
40
|
+
onUploading: r,
|
|
41
|
+
aspectRatio: I,
|
|
42
|
+
onRemoved: c,
|
|
43
|
+
fieldClassName: d,
|
|
44
|
+
hideLabel: V = !1,
|
|
45
|
+
listType: C
|
|
46
|
+
}) {
|
|
47
|
+
const i = x.useFormInstance(), u = x.useWatch(e, i), [P, $] = F(!1), p = W(
|
|
48
|
+
async (n, g) => {
|
|
49
|
+
if (g) {
|
|
50
|
+
r == null || r(!0);
|
|
51
|
+
const m = n.name, o = m.split("."), y = o[o.length - 1], b = s.generateFileName(m), k = `${await s.getInitialPath()}/${b}.${y}`, _ = await s.upload(n, k);
|
|
52
|
+
$(!0), r == null || r(!1), i.setFieldValue(e, _);
|
|
53
|
+
} else {
|
|
54
|
+
console.log(n);
|
|
55
|
+
const m = i.getFieldsValue(), o = await s.delete(m[e]);
|
|
56
|
+
c == null || c(), o && i.setFieldsValue({ [e]: null });
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
[i, e, c, r, s]
|
|
60
|
+
), [f, j] = F();
|
|
61
|
+
return w(() => {
|
|
62
|
+
!P && u ? s.getRealUrl(u).then(j) : j(f);
|
|
63
|
+
}, [u, P, s, f]), /* @__PURE__ */ l.jsx(l.Fragment, { children: /* @__PURE__ */ l.jsxs(
|
|
64
|
+
x.Item,
|
|
65
|
+
{
|
|
66
|
+
rules: t ? z.required(a) : [],
|
|
67
|
+
label: V ? null : a,
|
|
68
|
+
required: t,
|
|
69
|
+
name: e,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ l.jsx(
|
|
72
|
+
B,
|
|
73
|
+
{
|
|
74
|
+
noStyle: !0,
|
|
75
|
+
listType: C,
|
|
76
|
+
aspectRatio: I,
|
|
77
|
+
values: f,
|
|
78
|
+
onRemove: (n) => {
|
|
79
|
+
n && p(n, !1);
|
|
80
|
+
},
|
|
81
|
+
onAdd: async (n) => {
|
|
82
|
+
n && await p(n, !0);
|
|
83
|
+
},
|
|
84
|
+
className: d
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ l.jsx(O, { hidden: !0 })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
) });
|
|
91
|
+
}
|
|
92
|
+
const ae = ({ provider: e, value: a }) => {
|
|
93
|
+
const [t, s] = F();
|
|
94
|
+
return w(() => {
|
|
95
|
+
a && e.getRealUrl(a).then(s);
|
|
96
|
+
}, [e, a]), t ? /* @__PURE__ */ l.jsx(K, { url: t }) : /* @__PURE__ */ l.jsx(l.Fragment, {});
|
|
97
|
+
}, K = ({ url: e }) => /* @__PURE__ */ l.jsx(S, { className: "p-0", children: /* @__PURE__ */ l.jsx(
|
|
98
|
+
D,
|
|
99
|
+
{
|
|
100
|
+
className: "m-0 p-0 position-relative",
|
|
101
|
+
src: e,
|
|
102
|
+
preview: {
|
|
103
|
+
mask: /* @__PURE__ */ l.jsx(H, {})
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
) });
|
|
107
|
+
export {
|
|
108
|
+
J as FileDownloadProvider,
|
|
109
|
+
te as FileUploadProvider,
|
|
110
|
+
K as ImageCellValue,
|
|
111
|
+
ae as ImageCrudCellValue,
|
|
112
|
+
se as default
|
|
113
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("../../../../_virtual/jsx-runtime.cjs"),o=require("react"),u=require("../../../locale/hooks/translation-constants.cjs"),i=require("./CrudImportComponent.cjs"),c=require("../../common/button/Button.cjs"),p=require("../../../../node_modules/react-i18next/dist/es/useTranslation.cjs"),x=require("../../../../node_modules/@ant-design/icons/es/icons/ImportOutlined.cjs");function m(n){const{t:s}=p.useTranslation(u.TRANSLATION_NAMESPACE),[r,e]=o.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(i,{open:r,onCloseMethod:e,...n}),t.jsxRuntimeExports.jsx(c,{icon:t.jsxRuntimeExports.jsx(x,{}),onClick:()=>e(!0),children:s("str.import")})]})}module.exports=m;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { j as o } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { useState as e } from "react";
|
|
3
|
+
import { TRANSLATION_NAMESPACE as p } from "../../../locale/hooks/translation-constants.js";
|
|
4
|
+
import s from "./CrudImportComponent.js";
|
|
5
|
+
import i from "../../common/button/Button.js";
|
|
6
|
+
import { useTranslation as f } from "../../../../node_modules/react-i18next/dist/es/useTranslation.js";
|
|
7
|
+
import u from "../../../../node_modules/@ant-design/icons/es/icons/ImportOutlined.js";
|
|
8
|
+
function I(r) {
|
|
9
|
+
const { t: n } = f(p), [m, t] = e(!1);
|
|
10
|
+
return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
11
|
+
/* @__PURE__ */ o.jsx(
|
|
12
|
+
s,
|
|
13
|
+
{
|
|
14
|
+
open: m,
|
|
15
|
+
onCloseMethod: t,
|
|
16
|
+
...r
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
/* @__PURE__ */ o.jsx(
|
|
20
|
+
i,
|
|
21
|
+
{
|
|
22
|
+
icon: /* @__PURE__ */ o.jsx(u, {}),
|
|
23
|
+
onClick: () => t(!0),
|
|
24
|
+
children: n("str.import")
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
I as default
|
|
31
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const s=require("
|
|
1
|
+
"use strict";const s=require("../../../../_virtual/jsx-runtime.cjs"),M=require("../../../../_virtual/papaparse.min.cjs"),d=require("antd"),B=require("../../../../_virtual/FileSaver.min.cjs"),o=require("react"),O=require("../../../locale/hooks/translation-constants.cjs"),V=require("../view/CrudViewer.cjs"),_=require("../../../util/DateUtil.cjs"),L=require("../../common/button/Button.cjs"),W=require("../../common/button/ImportButton.cjs"),z=require("../../../../node_modules/react-i18next/dist/es/useTranslation.cjs"),N=require("../../../../node_modules/@ant-design/icons/es/icons/WarningTwoTone.cjs"),$=require("../../../../node_modules/@ant-design/icons/es/icons/DownloadOutlined.cjs");function U({onCloseMethod:E,open:b,fields:q,importProps:a}){const[u,w]=o.useState([]),[C,h]=o.useState(!1),[T,g]=o.useState(0);o.useEffect(()=>{b||(w([]),h(!1))},[b]);const f=o.useMemo(()=>new Map(q.filter(e=>{var t;return!e.hidden&&!((t=e.importProps)!=null&&t.hidden)&&!e.readonly}).map(e=>[e.name,e])),[q]),v=o.useMemo(()=>Array.from(f.values()).flatMap(e=>{var t;return[e.name,...((t=e.importProps)==null?void 0:t.extraFields)??[]]}),[f]),F=o.useCallback(async function(){const e=`${v.join(",")}
|
|
2
2
|
`,t=new Blob([e],{type:"text/csv;charset=utf-8;"});B.FileSaver_minExports.saveAs(t,(a==null?void 0:a.name)+" - "+_.formatDateTimeWithSecond(new Date).replaceAll(":","-")+".csv")},[v,a==null?void 0:a.name]),{t:l}=z.useTranslation(O.TRANSLATION_NAMESPACE),D=o.useCallback(async e=>{const t=new FileReader;t.onerror=console.error,t.onload=async r=>{var n;const c=(n=r==null?void 0:r.target)==null?void 0:n.result,i=M.parse(c,{header:!0});w(i.data)},t.readAsText(e)},[]),y=o.useMemo(()=>{var t,r,c;let e=!1;for(const i of u)for(const[n,x]of f.entries()){const j=i[n],m=j||!isNaN(j);if(x.required&&!m)if((r=(t=x.importProps)==null?void 0:t.extraFields)!=null&&r.length)for(const R of((c=x.importProps)==null?void 0:c.extraFields)??[])if(i[R]||!isNaN(i[R])){e=!1;break}else return!0;else return!0}return e},[u,f]),p=o.useCallback(e=>(t,r)=>{var i,n,x;const c=t||!isNaN(t);if(e.required&&!c){let j=l("err.validation.required");if((n=(i=e.importProps)==null?void 0:i.extraFields)!=null&&n.length){const m=(x=e.importProps)==null?void 0:x.extraFields;(m==null?void 0:m.find(A=>!r[A]))&&(j="Either one of these fields is required: "+[e.name,...m].join(", "))}return s.jsxRuntimeExports.jsxs(d.Tooltip,{className:"d-flex",title:j,children:[s.jsxRuntimeExports.jsx(N,{twoToneColor:"#ee9702"}),t]})}return t},[l]),S=o.useCallback(async e=>{g(e)},[]),k=o.useCallback(async()=>{try{h(!0),await a.onClickImport(u,S),E(!1)}finally{h(!1),g(0)}},[u,a,E,S]),I=o.useCallback(async()=>{y?d.Modal.warn({title:l("str.warning"),content:l("qus.importWithIssues"),okText:l("str.import"),onOk:k,okCancel:!0,closable:!0}):k()},[y,k,l]);return s.jsxRuntimeExports.jsxs(d.Modal,{title:[l("str.import"),a==null?void 0:a.name].filter(Boolean).join(" "),width:"100%",open:b,onOk:I,destroyOnClose:!0,onCancel:()=>E(!1),okText:l("str.import"),confirmLoading:C,okButtonProps:{disabled:!(u!=null&&u.length)},footer:(e,{OkBtn:t,CancelBtn:r})=>s.jsxRuntimeExports.jsxs(d.Space,{children:[s.jsxRuntimeExports.jsx(r,{}),s.jsxRuntimeExports.jsx(t,{}),y&&s.jsxRuntimeExports.jsx(d.Tooltip,{className:"d-flex",title:"Some fields have issue. Please review before submit.",children:s.jsxRuntimeExports.jsx(N,{twoToneColor:"#ee9702"})})]}),children:[s.jsxRuntimeExports.jsxs(d.Space,{children:[s.jsxRuntimeExports.jsx(L,{onClick:F,icon:s.jsxRuntimeExports.jsx($,{}),children:l("str.downloadCsvTemplate")}),s.jsxRuntimeExports.jsx(W.ImportButton,{disabled:C,type:"default",onClick:D,accept:".csv",children:l("str.importCsvFile")})]}),s.jsxRuntimeExports.jsx(d.Spin,{spinning:C,indicator:T?s.jsxRuntimeExports.jsx(d.Progress,{type:"circle",percent:T*100,size:50,format:e=>`${parseInt(e)}%`}):void 0,children:s.jsxRuntimeExports.jsx(V,{data:u,bordered:!0,size:"small",fields:Array.from(f.values()).flatMap(e=>{var t,r,c,i;return e.type==="text"?[{...e,label:e.name,render:p(e)},...((r=(t=e.importProps)==null?void 0:t.extraFields)==null?void 0:r.map(n=>({...e,name:n,label:n,render:p(e)})))??[]]:e.type==="select"?[{...e,label:e.name,type:"text",render:p(e)},...((i=(c=e.importProps)==null?void 0:c.extraFields)==null?void 0:i.map(n=>({...e,name:n,label:n,type:"text",render:p(e)})))??[]]:[{...e,label:e.name,render:p(e)}]})})})]})}module.exports=U;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { j as t } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import L from "../../../../_virtual/papaparse.min.js";
|
|
3
|
+
import { Tooltip as S, Modal as q, Space as B, Spin as _, Progress as $ } from "antd";
|
|
4
|
+
import { F as z } from "../../../../_virtual/FileSaver.min.js";
|
|
5
|
+
import { useState as w, useEffect as W, useMemo as v, useCallback as m } from "react";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as U } from "../../../locale/hooks/translation-constants.js";
|
|
7
|
+
import G from "../view/CrudViewer.js";
|
|
8
|
+
import H from "../../../util/DateUtil.js";
|
|
9
|
+
import J from "../../common/button/Button.js";
|
|
10
|
+
import { ImportButton as K } from "../../common/button/ImportButton.js";
|
|
11
|
+
import { useTranslation as Q } from "../../../../node_modules/react-i18next/dist/es/useTranslation.js";
|
|
12
|
+
import R from "../../../../node_modules/@ant-design/icons/es/icons/WarningTwoTone.js";
|
|
13
|
+
import X from "../../../../node_modules/@ant-design/icons/es/icons/DownloadOutlined.js";
|
|
14
|
+
function de({
|
|
15
|
+
onCloseMethod: h,
|
|
16
|
+
open: y,
|
|
17
|
+
fields: A,
|
|
18
|
+
importProps: o
|
|
19
|
+
}) {
|
|
20
|
+
const [c, N] = w([]), [j, b] = w(!1), [T, E] = w(0);
|
|
21
|
+
W(() => {
|
|
22
|
+
y || (N([]), b(!1));
|
|
23
|
+
}, [y]);
|
|
24
|
+
const u = v(
|
|
25
|
+
() => new Map(
|
|
26
|
+
A.filter((e) => {
|
|
27
|
+
var r;
|
|
28
|
+
return !e.hidden && !((r = e.importProps) != null && r.hidden) && !e.readonly;
|
|
29
|
+
}).map((e) => [e.name, e])
|
|
30
|
+
),
|
|
31
|
+
[A]
|
|
32
|
+
), F = v(
|
|
33
|
+
() => Array.from(u.values()).flatMap((e) => {
|
|
34
|
+
var r;
|
|
35
|
+
return [
|
|
36
|
+
e.name,
|
|
37
|
+
...((r = e.importProps) == null ? void 0 : r.extraFields) ?? []
|
|
38
|
+
];
|
|
39
|
+
}),
|
|
40
|
+
[u]
|
|
41
|
+
), V = m(
|
|
42
|
+
async function() {
|
|
43
|
+
const e = `${F.join(",")}
|
|
44
|
+
`, r = new Blob([e], { type: "text/csv;charset=utf-8;" });
|
|
45
|
+
z.saveAs(
|
|
46
|
+
r,
|
|
47
|
+
(o == null ? void 0 : o.name) + " - " + H.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
[F, o == null ? void 0 : o.name]
|
|
51
|
+
), { t: i } = Q(U), M = m(async (e) => {
|
|
52
|
+
const r = new FileReader();
|
|
53
|
+
r.onerror = console.error, r.onload = async (n) => {
|
|
54
|
+
var s;
|
|
55
|
+
const l = (s = n == null ? void 0 : n.target) == null ? void 0 : s.result, a = L.parse(l, { header: !0 });
|
|
56
|
+
N(a.data);
|
|
57
|
+
}, r.readAsText(e);
|
|
58
|
+
}, []), C = v(() => {
|
|
59
|
+
var r, n, l;
|
|
60
|
+
let e = !1;
|
|
61
|
+
for (const a of c)
|
|
62
|
+
for (const [s, d] of u.entries()) {
|
|
63
|
+
const x = a[s], f = x || !isNaN(x);
|
|
64
|
+
if (d.required && !f)
|
|
65
|
+
if ((n = (r = d.importProps) == null ? void 0 : r.extraFields) != null && n.length)
|
|
66
|
+
for (const g of ((l = d.importProps) == null ? void 0 : l.extraFields) ?? [])
|
|
67
|
+
if (a[g] || !isNaN(a[g])) {
|
|
68
|
+
e = !1;
|
|
69
|
+
break;
|
|
70
|
+
} else return !0;
|
|
71
|
+
else return !0;
|
|
72
|
+
}
|
|
73
|
+
return e;
|
|
74
|
+
}, [c, u]), p = m(
|
|
75
|
+
(e) => (r, n) => {
|
|
76
|
+
var a, s, d;
|
|
77
|
+
const l = r || !isNaN(r);
|
|
78
|
+
if (e.required && !l) {
|
|
79
|
+
let x = i("err.validation.required");
|
|
80
|
+
if ((s = (a = e.importProps) == null ? void 0 : a.extraFields) != null && s.length) {
|
|
81
|
+
const f = (d = e.importProps) == null ? void 0 : d.extraFields;
|
|
82
|
+
(f == null ? void 0 : f.find((D) => !n[D])) && (x = "Either one of these fields is required: " + [e.name, ...f].join(", "));
|
|
83
|
+
}
|
|
84
|
+
return /* @__PURE__ */ t.jsxs(S, { className: "d-flex", title: x, children: [
|
|
85
|
+
/* @__PURE__ */ t.jsx(R, { twoToneColor: "#ee9702" }),
|
|
86
|
+
r
|
|
87
|
+
] });
|
|
88
|
+
}
|
|
89
|
+
return r;
|
|
90
|
+
},
|
|
91
|
+
[i]
|
|
92
|
+
), I = m(async (e) => {
|
|
93
|
+
E(e);
|
|
94
|
+
}, []), k = m(async () => {
|
|
95
|
+
try {
|
|
96
|
+
b(!0), await o.onClickImport(c, I), h(!1);
|
|
97
|
+
} finally {
|
|
98
|
+
b(!1), E(0);
|
|
99
|
+
}
|
|
100
|
+
}, [c, o, h, I]), O = m(async () => {
|
|
101
|
+
C ? q.warn({
|
|
102
|
+
title: i("str.warning"),
|
|
103
|
+
content: i("qus.importWithIssues"),
|
|
104
|
+
okText: i("str.import"),
|
|
105
|
+
onOk: k,
|
|
106
|
+
okCancel: !0,
|
|
107
|
+
closable: !0
|
|
108
|
+
}) : k();
|
|
109
|
+
}, [C, k, i]);
|
|
110
|
+
return /* @__PURE__ */ t.jsxs(
|
|
111
|
+
q,
|
|
112
|
+
{
|
|
113
|
+
title: [i("str.import"), o == null ? void 0 : o.name].filter(Boolean).join(" "),
|
|
114
|
+
width: "100%",
|
|
115
|
+
open: y,
|
|
116
|
+
onOk: O,
|
|
117
|
+
destroyOnClose: !0,
|
|
118
|
+
onCancel: () => h(!1),
|
|
119
|
+
okText: i("str.import"),
|
|
120
|
+
confirmLoading: j,
|
|
121
|
+
okButtonProps: {
|
|
122
|
+
disabled: !(c != null && c.length)
|
|
123
|
+
},
|
|
124
|
+
footer: (e, { OkBtn: r, CancelBtn: n }) => /* @__PURE__ */ t.jsxs(B, { children: [
|
|
125
|
+
/* @__PURE__ */ t.jsx(n, {}),
|
|
126
|
+
/* @__PURE__ */ t.jsx(r, {}),
|
|
127
|
+
C && /* @__PURE__ */ t.jsx(
|
|
128
|
+
S,
|
|
129
|
+
{
|
|
130
|
+
className: "d-flex",
|
|
131
|
+
title: "Some fields have issue. Please review before submit.",
|
|
132
|
+
children: /* @__PURE__ */ t.jsx(R, { twoToneColor: "#ee9702" })
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
] }),
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ t.jsxs(B, { children: [
|
|
138
|
+
/* @__PURE__ */ t.jsx(
|
|
139
|
+
J,
|
|
140
|
+
{
|
|
141
|
+
onClick: V,
|
|
142
|
+
icon: /* @__PURE__ */ t.jsx(X, {}),
|
|
143
|
+
children: i("str.downloadCsvTemplate")
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
/* @__PURE__ */ t.jsx(
|
|
147
|
+
K,
|
|
148
|
+
{
|
|
149
|
+
disabled: j,
|
|
150
|
+
type: "default",
|
|
151
|
+
onClick: M,
|
|
152
|
+
accept: ".csv",
|
|
153
|
+
children: i("str.importCsvFile")
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
] }),
|
|
157
|
+
/* @__PURE__ */ t.jsx(
|
|
158
|
+
_,
|
|
159
|
+
{
|
|
160
|
+
spinning: j,
|
|
161
|
+
indicator: T ? /* @__PURE__ */ t.jsx(
|
|
162
|
+
$,
|
|
163
|
+
{
|
|
164
|
+
type: "circle",
|
|
165
|
+
percent: T * 100,
|
|
166
|
+
size: 50,
|
|
167
|
+
format: (e) => `${parseInt(e)}%`
|
|
168
|
+
}
|
|
169
|
+
) : void 0,
|
|
170
|
+
children: /* @__PURE__ */ t.jsx(
|
|
171
|
+
G,
|
|
172
|
+
{
|
|
173
|
+
data: c,
|
|
174
|
+
bordered: !0,
|
|
175
|
+
size: "small",
|
|
176
|
+
fields: Array.from(u.values()).flatMap((e) => {
|
|
177
|
+
var r, n, l, a;
|
|
178
|
+
return e.type === "text" ? [
|
|
179
|
+
{
|
|
180
|
+
...e,
|
|
181
|
+
label: e.name,
|
|
182
|
+
render: p(e)
|
|
183
|
+
},
|
|
184
|
+
...((n = (r = e.importProps) == null ? void 0 : r.extraFields) == null ? void 0 : n.map((s) => ({
|
|
185
|
+
...e,
|
|
186
|
+
name: s,
|
|
187
|
+
label: s,
|
|
188
|
+
render: p(e)
|
|
189
|
+
}))) ?? []
|
|
190
|
+
] : e.type === "select" ? [
|
|
191
|
+
{
|
|
192
|
+
...e,
|
|
193
|
+
label: e.name,
|
|
194
|
+
type: "text",
|
|
195
|
+
render: p(e)
|
|
196
|
+
},
|
|
197
|
+
...((a = (l = e.importProps) == null ? void 0 : l.extraFields) == null ? void 0 : a.map((s) => ({
|
|
198
|
+
...e,
|
|
199
|
+
name: s,
|
|
200
|
+
label: s,
|
|
201
|
+
type: "text",
|
|
202
|
+
render: p(e)
|
|
203
|
+
}))) ?? []
|
|
204
|
+
] : [
|
|
205
|
+
{
|
|
206
|
+
...e,
|
|
207
|
+
label: e.name,
|
|
208
|
+
render: p(e)
|
|
209
|
+
}
|
|
210
|
+
];
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
export {
|
|
221
|
+
de as default
|
|
222
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../../_virtual/jsx-runtime.cjs"),R=require("../../common/description/DescList.cjs"),b=require("react"),g=require("../../../locale/hooks/translation-constants.cjs"),p=require("./CrudViewerUtil.cjs"),q=require("../../../../node_modules/react-i18next/dist/es/useTranslation.cjs");function C({className:l,fields:u,data:e,descListColumn:c={xs:1,md:3,sm:2,lg:4},layout:m,action:t,keepEmptyValues:x}){const{t:i}=q.useTranslation(g.TRANSLATION_NAMESPACE),j=b.useMemo(()=>{const o=u.filter(({hidden:r,hideInDescList:s})=>!r&&!s).map((r,s)=>({label:r.label,noFormatting:!0,value:p.getRendererValueCrudViewer(r)(e==null?void 0:e[r.name],e,s)}));return t&&o.push({label:i("str.action"),value:t}),o},[t,e,u,i]);return e?n.jsxRuntimeExports.jsx(R,{keepEmptyValues:x,bordered:!0,column:c,className:l,layout:m,list:j}):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{})}exports.CrudDecListView=C;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { j as m } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import x from "../../common/description/DescList.js";
|
|
3
|
+
import { useMemo as b } from "react";
|
|
4
|
+
import { TRANSLATION_NAMESPACE as g } from "../../../locale/hooks/translation-constants.js";
|
|
5
|
+
import { getRendererValueCrudViewer as j } from "./CrudViewerUtil.js";
|
|
6
|
+
import { useTranslation as A } from "../../../../node_modules/react-i18next/dist/es/useTranslation.js";
|
|
7
|
+
function V({
|
|
8
|
+
className: u,
|
|
9
|
+
fields: s,
|
|
10
|
+
data: r,
|
|
11
|
+
descListColumn: l = { xs: 1, md: 3, sm: 2, lg: 4 },
|
|
12
|
+
layout: f,
|
|
13
|
+
action: o,
|
|
14
|
+
keepEmptyValues: p
|
|
15
|
+
}) {
|
|
16
|
+
const { t: i } = A(g), c = b(() => {
|
|
17
|
+
const n = s.filter(({ hidden: e, hideInDescList: t }) => !e && !t).map((e, t) => ({
|
|
18
|
+
label: e.label,
|
|
19
|
+
noFormatting: !0,
|
|
20
|
+
value: j(e)(
|
|
21
|
+
r == null ? void 0 : r[e.name],
|
|
22
|
+
r,
|
|
23
|
+
t
|
|
24
|
+
)
|
|
25
|
+
}));
|
|
26
|
+
return o && n.push({ label: i("str.action"), value: o }), n;
|
|
27
|
+
}, [o, r, s, i]);
|
|
28
|
+
return r ? /* @__PURE__ */ m.jsx(
|
|
29
|
+
x,
|
|
30
|
+
{
|
|
31
|
+
keepEmptyValues: p,
|
|
32
|
+
bordered: !0,
|
|
33
|
+
column: l,
|
|
34
|
+
className: u,
|
|
35
|
+
layout: f,
|
|
36
|
+
list: c
|
|
37
|
+
}
|
|
38
|
+
) : /* @__PURE__ */ m.jsx(m.Fragment, {});
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
V as CrudDecListView
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("../../../../_virtual/jsx-runtime.cjs"),P=require("antd"),k=require("../../common/button/CloneButtonTable.cjs"),H=require("../../common/button/DeleteButtonTable.cjs"),U=require("../../common/button/ExportButton.cjs"),F=require("../../common/button/HideButtonTable.cjs"),tt=require("../../common/button/RefreshButton.cjs"),st=require("../../common/button/UpdateButtonTable.cjs"),rt=require("../../common/button/ViewButtonTable.cjs"),et=require("../../common/layout/VerticalSpace.cjs"),ut=require("../../common/table/table.cjs"),i=require("react"),nt=require("../../../locale/hooks/translation-constants.cjs"),ot=require("../CrudSearchComponent.cjs"),xt=require("./CrudDecListView.cjs"),N=require("./CrudViewerUtil.cjs"),ct=require("../../../../node_modules/react-i18next/dist/es/useTranslation.cjs");function jt({idField:e="id",loadingData:O,fields:c,isDeleting:p,isHiding:v,viewable:o=!1,paginateProps:m,onDelete:l,onHide:B,onUpdate:a,data:E=[],extraAction:R,onClickUpdate:x,minusHeight:g,scroll:z,onClickClone:h,className:_,expandable:$,size:w,bordered:A,descListColumn:G,extraView:T,decListLayout:J,scrollToTop:it,onClickRefresh:b,closeViewOnClickUpdate:C,onExport:f,confirmHiding:I,confirmDeleting:V,rowClassName:K,actionWidth:Q=190,...W}){const{t:X}=ct.useTranslation(nt.TRANSLATION_NAMESPACE),M=i.useMemo(()=>c.map(({hideInTable:s,hidden:r,width:j,name:n,label:Z,halign:D,...L})=>({title:Z,width:j,key:n,dataIndex:n,hidden:s||r,align:D??(L.type==="number"?"right":void 0),render:N.getRendererValueCrudViewer(L)})),[c]),[u,q]=i.useState(),[y,S]=i.useState();i.useEffect(()=>{E&&q(s=>{if(s)return E.find(r=>r[e]===s[e])})},[E,e,u]);const d=i.useCallback(s=>{var j;const r=R==null?void 0:R(s);return(Array.isArray(r)?(j=r==null?void 0:r.filter(Boolean))!=null&&j.length:r)||a||x||h||l?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r,(a||x)&&t.jsxRuntimeExports.jsx(st,{value:s,onClick:n=>{S(n[e]),x==null||x(s),C&&q(void 0)}}),h&&t.jsxRuntimeExports.jsx(k,{value:s,onClick:n=>h(n)}),f&&t.jsxRuntimeExports.jsx(U.ExportButton,{value:s,onClick:async n=>await f(n)}),B&&t.jsxRuntimeExports.jsx(F,{value:s,disabled:v,shouldConfirm:I,loading:v&&s[e]===y,onClick:async n=>{S(n[e]),await B({[e]:n[e]})}}),l&&t.jsxRuntimeExports.jsx(H,{value:s,disabled:p,shouldConfirm:V,loading:p&&s[e]===y,onClick:async n=>{S(n[e]),await l({[e]:n[e]})}})]}):void 0},[C,V,I,R,e,p,v,h,x,l,f,B,a,y]),Y=i.useMemo(()=>{let s=typeof o=="string"?u==null?void 0:u[o]:void 0;if(typeof s=="object"){const r=c.find(j=>j.name===o);s=N.getRendererValueCrudViewer(r)(s,u,0)}return s},[o,u,c]);return t.jsxRuntimeExports.jsxs("div",{children:[o&&t.jsxRuntimeExports.jsx(P.Modal,{width:"100%",open:!!u,title:Y??t.jsxRuntimeExports.jsx("div",{children:" "}),footer:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),closable:!0,onCancel:()=>q(void 0),children:!!u&&t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(xt.CrudDecListView,{layout:J,descListColumn:G,data:u,fields:c,action:d(u)}),T==null?void 0:T(u)]},u==null?void 0:u[e])}),t.jsxRuntimeExports.jsx(ot,{fields:c,...W}),t.jsxRuntimeExports.jsxs(et,{children:[!!b&&t.jsxRuntimeExports.jsx(tt.RefreshButton,{onClick:b}),t.jsxRuntimeExports.jsx(ut,{rowClassName:K,className:_,scroll:z??(g?{y:`calc(100vh - ${g})`}:void 0),id:"crud-table",dataSource:E,loading:O,bordered:A,size:w,expandable:$,pagination:m?{total:m.count,onChange:m.setPage,current:m.page,pageSize:m.pageSize}:void 0,columns:a||x||l||R||o?[...M,{title:X("str.action"),dataIndex:"",fixed:"right",width:Q,render:(s,r)=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[o&&t.jsxRuntimeExports.jsx(rt,{value:r,onClick:q}),d(r)]})}]:M})]})]})}module.exports=jt;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { j as r } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { Modal as k } from "antd";
|
|
3
|
+
import H from "../../common/button/CloneButtonTable.js";
|
|
4
|
+
import U from "../../common/button/DeleteButtonTable.js";
|
|
5
|
+
import { ExportButton as F } from "../../common/button/ExportButton.js";
|
|
6
|
+
import rr from "../../common/button/HideButtonTable.js";
|
|
7
|
+
import { RefreshButton as or } from "../../common/button/RefreshButton.js";
|
|
8
|
+
import tr from "../../common/button/UpdateButtonTable.js";
|
|
9
|
+
import sr from "../../common/button/ViewButtonTable.js";
|
|
10
|
+
import mr from "../../common/layout/VerticalSpace.js";
|
|
11
|
+
import ur from "../../common/table/table.js";
|
|
12
|
+
import { useMemo as L, useState as _, useEffect as nr, useCallback as er } from "react";
|
|
13
|
+
import { TRANSLATION_NAMESPACE as fr } from "../../../locale/hooks/translation-constants.js";
|
|
14
|
+
import cr from "../CrudSearchComponent.js";
|
|
15
|
+
import { CrudDecListView as lr } from "./CrudDecListView.js";
|
|
16
|
+
import { getRendererValueCrudViewer as V } from "./CrudViewerUtil.js";
|
|
17
|
+
import { useTranslation as jr } from "../../../../node_modules/react-i18next/dist/es/useTranslation.js";
|
|
18
|
+
function Or({
|
|
19
|
+
idField: s = "id",
|
|
20
|
+
loadingData: $,
|
|
21
|
+
fields: f,
|
|
22
|
+
isDeleting: y,
|
|
23
|
+
isHiding: B,
|
|
24
|
+
viewable: n = !1,
|
|
25
|
+
paginateProps: l,
|
|
26
|
+
onDelete: j,
|
|
27
|
+
onHide: p,
|
|
28
|
+
onUpdate: h,
|
|
29
|
+
data: v = [],
|
|
30
|
+
extraAction: a,
|
|
31
|
+
onClickUpdate: e,
|
|
32
|
+
minusHeight: I,
|
|
33
|
+
scroll: q,
|
|
34
|
+
onClickClone: T,
|
|
35
|
+
className: A,
|
|
36
|
+
expandable: G,
|
|
37
|
+
size: J,
|
|
38
|
+
bordered: K,
|
|
39
|
+
descListColumn: Q,
|
|
40
|
+
extraView: i,
|
|
41
|
+
decListLayout: W,
|
|
42
|
+
scrollToTop: ar,
|
|
43
|
+
onClickRefresh: C,
|
|
44
|
+
closeViewOnClickUpdate: R,
|
|
45
|
+
onExport: S,
|
|
46
|
+
confirmHiding: E,
|
|
47
|
+
confirmDeleting: M,
|
|
48
|
+
rowClassName: X,
|
|
49
|
+
actionWidth: Y = 190,
|
|
50
|
+
...Z
|
|
51
|
+
}) {
|
|
52
|
+
const { t: d } = jr(fr), N = L(
|
|
53
|
+
() => f.map(
|
|
54
|
+
({ hideInTable: o, hidden: t, width: c, name: u, label: w, halign: D, ...z }) => ({
|
|
55
|
+
title: w,
|
|
56
|
+
width: c,
|
|
57
|
+
key: u,
|
|
58
|
+
dataIndex: u,
|
|
59
|
+
hidden: o || t,
|
|
60
|
+
align: D ?? (z.type === "number" ? "right" : void 0),
|
|
61
|
+
render: V(z)
|
|
62
|
+
})
|
|
63
|
+
),
|
|
64
|
+
[f]
|
|
65
|
+
), [m, x] = _(), [b, g] = _();
|
|
66
|
+
nr(() => {
|
|
67
|
+
v && x((o) => {
|
|
68
|
+
if (o)
|
|
69
|
+
return v.find((t) => t[s] === o[s]);
|
|
70
|
+
});
|
|
71
|
+
}, [v, s, m]);
|
|
72
|
+
const O = er(
|
|
73
|
+
(o) => {
|
|
74
|
+
var c;
|
|
75
|
+
const t = a == null ? void 0 : a(o);
|
|
76
|
+
return (Array.isArray(t) ? (c = t == null ? void 0 : t.filter(Boolean)) != null && c.length : t) || h || e || T || j ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
77
|
+
t,
|
|
78
|
+
(h || e) && /* @__PURE__ */ r.jsx(
|
|
79
|
+
tr,
|
|
80
|
+
{
|
|
81
|
+
value: o,
|
|
82
|
+
onClick: (u) => {
|
|
83
|
+
g(u[s]), e == null || e(o), R && x(void 0);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
T && /* @__PURE__ */ r.jsx(H, { value: o, onClick: (u) => T(u) }),
|
|
88
|
+
S && /* @__PURE__ */ r.jsx(
|
|
89
|
+
F,
|
|
90
|
+
{
|
|
91
|
+
value: o,
|
|
92
|
+
onClick: async (u) => await S(u)
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
p && /* @__PURE__ */ r.jsx(
|
|
96
|
+
rr,
|
|
97
|
+
{
|
|
98
|
+
value: o,
|
|
99
|
+
disabled: B,
|
|
100
|
+
shouldConfirm: E,
|
|
101
|
+
loading: B && o[s] === b,
|
|
102
|
+
onClick: async (u) => {
|
|
103
|
+
g(u[s]), await p({ [s]: u[s] });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
j && /* @__PURE__ */ r.jsx(
|
|
108
|
+
U,
|
|
109
|
+
{
|
|
110
|
+
value: o,
|
|
111
|
+
disabled: y,
|
|
112
|
+
shouldConfirm: M,
|
|
113
|
+
loading: y && o[s] === b,
|
|
114
|
+
onClick: async (u) => {
|
|
115
|
+
g(u[s]), await j({ [s]: u[s] });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] }) : void 0;
|
|
120
|
+
},
|
|
121
|
+
[
|
|
122
|
+
R,
|
|
123
|
+
M,
|
|
124
|
+
E,
|
|
125
|
+
a,
|
|
126
|
+
s,
|
|
127
|
+
y,
|
|
128
|
+
B,
|
|
129
|
+
T,
|
|
130
|
+
e,
|
|
131
|
+
j,
|
|
132
|
+
S,
|
|
133
|
+
p,
|
|
134
|
+
h,
|
|
135
|
+
b
|
|
136
|
+
]
|
|
137
|
+
), P = L(() => {
|
|
138
|
+
let o = typeof n == "string" ? m == null ? void 0 : m[n] : void 0;
|
|
139
|
+
if (typeof o == "object") {
|
|
140
|
+
const t = f.find((c) => c.name === n);
|
|
141
|
+
o = V(t)(
|
|
142
|
+
o,
|
|
143
|
+
m,
|
|
144
|
+
0
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
return o;
|
|
148
|
+
}, [n, m, f]);
|
|
149
|
+
return /* @__PURE__ */ r.jsxs("div", { children: [
|
|
150
|
+
n && /* @__PURE__ */ r.jsx(
|
|
151
|
+
k,
|
|
152
|
+
{
|
|
153
|
+
width: "100%",
|
|
154
|
+
open: !!m,
|
|
155
|
+
title: P ?? /* @__PURE__ */ r.jsx("div", { children: " " }),
|
|
156
|
+
footer: /* @__PURE__ */ r.jsx(r.Fragment, {}),
|
|
157
|
+
closable: !0,
|
|
158
|
+
onCancel: () => x(void 0),
|
|
159
|
+
children: !!m && /* @__PURE__ */ r.jsxs("div", { children: [
|
|
160
|
+
/* @__PURE__ */ r.jsx(
|
|
161
|
+
lr,
|
|
162
|
+
{
|
|
163
|
+
layout: W,
|
|
164
|
+
descListColumn: Q,
|
|
165
|
+
data: m,
|
|
166
|
+
fields: f,
|
|
167
|
+
action: O(m)
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
i == null ? void 0 : i(m)
|
|
171
|
+
] }, m == null ? void 0 : m[s])
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ r.jsx(cr, { fields: f, ...Z }),
|
|
175
|
+
/* @__PURE__ */ r.jsxs(mr, { children: [
|
|
176
|
+
!!C && /* @__PURE__ */ r.jsx(or, { onClick: C }),
|
|
177
|
+
/* @__PURE__ */ r.jsx(
|
|
178
|
+
ur,
|
|
179
|
+
{
|
|
180
|
+
rowClassName: X,
|
|
181
|
+
className: A,
|
|
182
|
+
scroll: q ?? (I ? {
|
|
183
|
+
y: `calc(100vh - ${I})`
|
|
184
|
+
} : void 0),
|
|
185
|
+
id: "crud-table",
|
|
186
|
+
dataSource: v,
|
|
187
|
+
loading: $,
|
|
188
|
+
bordered: K,
|
|
189
|
+
size: J,
|
|
190
|
+
expandable: G,
|
|
191
|
+
pagination: l ? {
|
|
192
|
+
total: l.count,
|
|
193
|
+
onChange: l.setPage,
|
|
194
|
+
current: l.page,
|
|
195
|
+
pageSize: l.pageSize
|
|
196
|
+
} : void 0,
|
|
197
|
+
columns: h || e || j || a || n ? [
|
|
198
|
+
...N,
|
|
199
|
+
{
|
|
200
|
+
title: d("str.action"),
|
|
201
|
+
dataIndex: "",
|
|
202
|
+
fixed: "right",
|
|
203
|
+
width: Y,
|
|
204
|
+
render: (o, t) => /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
205
|
+
n && /* @__PURE__ */ r.jsx(sr, { value: t, onClick: x }),
|
|
206
|
+
O(t)
|
|
207
|
+
] })
|
|
208
|
+
}
|
|
209
|
+
] : N
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] })
|
|
213
|
+
] });
|
|
214
|
+
}
|
|
215
|
+
export {
|
|
216
|
+
Or as default
|
|
217
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../../../_virtual/jsx-runtime.cjs"),m=require("antd"),x=require("../../common/show-more/index.cjs"),j=require("../FileCrudField.cjs"),v=require("../ImageCrudField.cjs"),y=require("../../../locale/hooks/translation-constants.cjs"),C=require("../../../../node_modules/i18next/dist/esm/i18next.cjs"),r=require("../../../util/DateUtil.cjs"),s=require("../../../util/NumberUtil.cjs"),g=require("../../../../node_modules/@ant-design/icons/es/icons/CheckOutlined.cjs"),d=require("../../../../node_modules/@ant-design/icons/es/icons/CloseOutlined.cjs");function q({type:a,render:i,...n}){return a==="object"?(t,u,e)=>typeof i=="function"?i(t,u,e):"":a==="select"?(t,u,e)=>{const o=n;let c=o.multiple?Array.isArray(t)?t.map(f=>f==null?void 0:f[o.innerFieldLabel??"name"]):void 0:t==null?void 0:t[o.innerFieldLabel??"name"];return(!c&&typeof t=="string"||typeof t=="number")&&(c=t),typeof i=="function"?i(c,u,e):Array.isArray(c)?c.join(", "):c}:a==="number"?(t,u,e)=>typeof i=="function"?i(t,u,e):n!=null&&n.int?s.default.toInt(t,n.formatted):s.default.toMoney(t):a==="enum"?(t,u,e)=>{var c;const o=C.t(((c=n==null?void 0:n.translation)==null?void 0:c[t??""])??t,{ns:y.TRANSLATION_NAMESPACE});return typeof i=="function"?i(t,u,e):o}:a==="date"?(t,u,e)=>{if(!t)return"-";const o=n!=null&&n.formatTime?r.formatDateTime(t):r.formatDate(t);return typeof i=="function"?i(t,u,e):o}:a==="checkbox"?(t,u,e)=>typeof i=="function"?i(t,u,e):t?l.jsxRuntimeExports.jsx(g,{}):l.jsxRuntimeExports.jsx(d,{}):a==="image"?(t,u,e)=>typeof i=="function"?i(t,u,e):l.jsxRuntimeExports.jsx(v.ImageCrudCellValue,{value:t,provider:n.provider}):a==="file"?(t,u,e)=>typeof i=="function"?i(t,u,e):l.jsxRuntimeExports.jsx(j.FileCrudCellValue,{value:t,provider:n.provider}):a==="time"?(t,u,e)=>{if(!t)return"-";const o=n==null?void 0:n.format,c=n==null?void 0:n.use12Hours,f=r.formatTime(t,o||(c?"hh:mm:ss A":void 0));return typeof i=="function"?i(t,u,e):f}:a==="color"?(t,u,e)=>typeof i=="function"?i(t,u,e):typeof t=="string"&&t.startsWith("#")?l.jsxRuntimeExports.jsx(m.Tooltip,{title:t,children:l.jsxRuntimeExports.jsx(m.Avatar,{style:{backgroundColor:t}})}):String(t):a==="textarea"?(t,u,e)=>{const o=(n==null?void 0:n.truncated)??1;return typeof i=="function"?i(t,u,e):o?l.jsxRuntimeExports.jsx(x.ShowMore,{lines:o===!0?1:o,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=q;
|