@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,58 @@
|
|
|
1
|
+
import { j as c } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { Tooltip as x, Avatar as j } from "antd";
|
|
3
|
+
import { ShowMore as y } from "../../common/show-more/index.js";
|
|
4
|
+
import { FileCrudCellValue as A } from "../FileCrudField.js";
|
|
5
|
+
import { ImageCrudCellValue as b } from "../ImageCrudField.js";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as e } from "../../../locale/hooks/translation-constants.js";
|
|
7
|
+
import { t as g } from "../../../../node_modules/i18next/dist/esm/i18next.js";
|
|
8
|
+
import r from "../../../util/DateUtil.js";
|
|
9
|
+
import v from "../../../util/NumberUtil.js";
|
|
10
|
+
import h from "../../../../node_modules/@ant-design/icons/es/icons/CheckOutlined.js";
|
|
11
|
+
import C from "../../../../node_modules/@ant-design/icons/es/icons/CloseOutlined.js";
|
|
12
|
+
function M({
|
|
13
|
+
type: u,
|
|
14
|
+
render: i,
|
|
15
|
+
...o
|
|
16
|
+
}) {
|
|
17
|
+
return u === "object" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : "" : u === "select" ? (t, f, n) => {
|
|
18
|
+
const m = o;
|
|
19
|
+
let a = m.multiple ? Array.isArray(t) ? t.map((l) => l == null ? void 0 : l[m.innerFieldLabel ?? "name"]) : void 0 : t == null ? void 0 : t[m.innerFieldLabel ?? "name"];
|
|
20
|
+
return (!a && typeof t == "string" || typeof t == "number") && (a = t), typeof i == "function" ? i(a, f, n) : Array.isArray(a) ? a.join(", ") : a;
|
|
21
|
+
} : u === "number" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : o != null && o.int ? v.toInt(t, o.formatted) : v.toMoney(t) : u === "enum" ? (t, f, n) => {
|
|
22
|
+
var a;
|
|
23
|
+
const m = g(
|
|
24
|
+
((a = o == null ? void 0 : o.translation) == null ? void 0 : a[t ?? ""]) ?? t,
|
|
25
|
+
{ ns: e }
|
|
26
|
+
);
|
|
27
|
+
return typeof i == "function" ? i(t, f, n) : m;
|
|
28
|
+
} : u === "date" ? (t, f, n) => {
|
|
29
|
+
if (!t) return "-";
|
|
30
|
+
const m = o != null && o.formatTime ? r.formatDateTime(t) : r.formatDate(t);
|
|
31
|
+
return typeof i == "function" ? i(t, f, n) : m;
|
|
32
|
+
} : u === "checkbox" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : t ? /* @__PURE__ */ c.jsx(h, {}) : /* @__PURE__ */ c.jsx(C, {}) : u === "image" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : /* @__PURE__ */ c.jsx(
|
|
33
|
+
b,
|
|
34
|
+
{
|
|
35
|
+
value: t,
|
|
36
|
+
provider: o.provider
|
|
37
|
+
}
|
|
38
|
+
) : u === "file" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : /* @__PURE__ */ c.jsx(
|
|
39
|
+
A,
|
|
40
|
+
{
|
|
41
|
+
value: t,
|
|
42
|
+
provider: o.provider
|
|
43
|
+
}
|
|
44
|
+
) : u === "time" ? (t, f, n) => {
|
|
45
|
+
if (!t) return "-";
|
|
46
|
+
const m = o == null ? void 0 : o.format, a = o == null ? void 0 : o.use12Hours, l = r.formatTime(
|
|
47
|
+
t,
|
|
48
|
+
m || (a ? "hh:mm:ss A" : void 0)
|
|
49
|
+
);
|
|
50
|
+
return typeof i == "function" ? i(t, f, n) : l;
|
|
51
|
+
} : u === "color" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ c.jsx(x, { title: t, children: /* @__PURE__ */ c.jsx(j, { style: { backgroundColor: t } }) }) : String(t) : u === "textarea" ? (t, f, n) => {
|
|
52
|
+
const m = (o == null ? void 0 : o.truncated) ?? 1;
|
|
53
|
+
return typeof i == "function" ? i(t, f, n) : m ? /* @__PURE__ */ c.jsx(y, { lines: m === !0 ? 1 : m, children: t }) : t;
|
|
54
|
+
} : typeof i == "function" ? i : (t) => t;
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
M as getRendererValueCrudViewer
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("../../node_modules/react-responsive/dist/esm/index.cjs");function n(){const i=e.useMediaQuery({minWidth:768}),s=e.useMediaQuery({maxWidth:767});return{isDesktop:i,isMobile:s}}module.exports=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./hooks/translation-constants.cjs"),u=require("./translations/en.cjs"),n=require("../../node_modules/i18next/dist/esm/i18next.cjs"),o=require("../../node_modules/react-i18next/dist/es/initReactI18next.cjs"),s={en:{[a.TRANSLATION_NAMESPACE]:u}},i=(e={})=>{const{translations:t=s,language:r="en"}=e;return n.default.use(o.initReactI18next).init({resources:t,lng:r,fallbackLng:"en",ns:a.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),n.default},l=(e,t)=>{n.default.addResourceBundle(e,a.TRANSLATION_NAMESPACE,t,!0,!0)};exports.defaultTranslations=s;exports.setupI18n=i;exports.updateTranslations=l;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TRANSLATION_NAMESPACE as o } from "./hooks/translation-constants.js";
|
|
2
|
+
import a from "./translations/en.js";
|
|
3
|
+
import t from "../../node_modules/i18next/dist/esm/i18next.js";
|
|
4
|
+
import { initReactI18next as s } from "../../node_modules/react-i18next/dist/es/initReactI18next.js";
|
|
5
|
+
const i = {
|
|
6
|
+
en: {
|
|
7
|
+
[o]: a
|
|
8
|
+
}
|
|
9
|
+
}, m = (n = {}) => {
|
|
10
|
+
const { translations: e = i, language: r = "en" } = n;
|
|
11
|
+
return t.use(s).init({
|
|
12
|
+
resources: e,
|
|
13
|
+
lng: r,
|
|
14
|
+
fallbackLng: "en",
|
|
15
|
+
ns: o,
|
|
16
|
+
interpolation: {
|
|
17
|
+
escapeValue: !1
|
|
18
|
+
}
|
|
19
|
+
}), t;
|
|
20
|
+
}, f = (n, e) => {
|
|
21
|
+
t.addResourceBundle(
|
|
22
|
+
n,
|
|
23
|
+
o,
|
|
24
|
+
e,
|
|
25
|
+
!0,
|
|
26
|
+
!0
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
i as defaultTranslations,
|
|
31
|
+
m as setupI18n,
|
|
32
|
+
f as updateTranslations
|
|
33
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
str: {
|
|
3
|
+
delete: "Delete",
|
|
4
|
+
clone: "Clone",
|
|
5
|
+
update: "Update",
|
|
6
|
+
new: "New",
|
|
7
|
+
back: "Back",
|
|
8
|
+
next: "Next",
|
|
9
|
+
save: "Save",
|
|
10
|
+
import: "Import",
|
|
11
|
+
cancel: "Cancel",
|
|
12
|
+
print: "Print",
|
|
13
|
+
hide: "Hide",
|
|
14
|
+
no: "No",
|
|
15
|
+
action: "Action",
|
|
16
|
+
remove: "Remove",
|
|
17
|
+
view: "View",
|
|
18
|
+
ok: "Ok",
|
|
19
|
+
yes: "Yes",
|
|
20
|
+
warning: "Warning",
|
|
21
|
+
success: "Success",
|
|
22
|
+
error: "Error",
|
|
23
|
+
retry: "Retry",
|
|
24
|
+
previous: "Previous",
|
|
25
|
+
unhide: "Unhide",
|
|
26
|
+
downloadCsvTemplate: "Download CSV Template",
|
|
27
|
+
importCsvFile: "Import CSV File",
|
|
28
|
+
export: "Export",
|
|
29
|
+
goBack: "Go Back",
|
|
30
|
+
refresh: "Refresh",
|
|
31
|
+
fileUploadMessage1: "Drag file here or ",
|
|
32
|
+
fileUploadMessage2: "Click to Upload"
|
|
33
|
+
},
|
|
34
|
+
err: {
|
|
35
|
+
save: "An error occurred while saving",
|
|
36
|
+
validation: {
|
|
37
|
+
required: "is required",
|
|
38
|
+
minLength8: "must be at least 8 characters",
|
|
39
|
+
percentage: "must be a percentage",
|
|
40
|
+
maximumValueExceeded: "must be less than %maxValue%",
|
|
41
|
+
invalidNic: "must be a valid NIC",
|
|
42
|
+
invalid: "must be a valid"
|
|
43
|
+
},
|
|
44
|
+
notFound: "Not Found"
|
|
45
|
+
},
|
|
46
|
+
message: {
|
|
47
|
+
loading: {
|
|
48
|
+
saving: "Saving"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
qus: {
|
|
52
|
+
importWithIssues: "Some fields have issues. Do you want to proceed with the import?",
|
|
53
|
+
doYouWantToDelete: "Do you want to delete?",
|
|
54
|
+
doYouWantToHide: "Do you want to hide?",
|
|
55
|
+
doYouWantToUnhide: "Do you want to unhide?"
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
e as default
|
|
60
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("../../_virtual/dayjs.min.cjs"),a=require("../../node_modules/i18next/dist/esm/i18next.cjs"),o=t=>e(t).locale(a.default.language).format("YYYY-MM-DD HH:mm"),m=t=>e(t).locale(a.default.language).format("YYYY-MM-DD HH:mm:ss"),n=t=>e(t).locale(a.default.language).format("YYYY-MM-DD"),l=(t,r="HH:mm:ss")=>e(t).locale(a.default.language).format(r),s={formatDateTime:o,formatDate:n,formatDateTimeWithSecond:m,formatTime:l};module.exports=s;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import t from "../../_virtual/dayjs.min.js";
|
|
2
|
+
import e from "../../node_modules/i18next/dist/esm/i18next.js";
|
|
3
|
+
const m = (a) => t(a).locale(e.language).format("YYYY-MM-DD HH:mm"), r = (a) => t(a).locale(e.language).format("YYYY-MM-DD HH:mm:ss"), n = (a) => t(a).locale(e.language).format("YYYY-MM-DD"), l = (a, o = "HH:mm:ss") => t(a).locale(e.language).format(o), c = { formatDateTime: m, formatDate: n, formatDateTimeWithSecond: r, formatTime: l };
|
|
4
|
+
export {
|
|
5
|
+
c as default
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("../../node_modules/browser-image-compression/dist/browser-image-compression.cjs");class g{async resizeImage(t){const e=await c(t,{maxSizeMB:1,maxWidthOrHeight:1920,useWebWorker:!0}),a=t.uid;return Object.assign(e,{uid:a,lastModifiedDate:new Date})}async getImageData(t){const e=await this.getImageData0(t);if(e){const a=new Image;a.src=e.data;const r=await new Promise(n=>{a.onload=function(){n({height:a.height,width:a.width})}});return Object.assign(e,r),e}else return null}async getImageData0(t){try{if(t.startsWith("data:image/")){const e=t.match(/^data:image\/(png|jpeg|jpg);base64,(.*)$/);if(!e)throw new Error("Invalid base64 image data");return{data:t,type:e[1]}}else{const e=await fetch(t);if(!e.ok)throw new Error("Network response was not ok");const a=await e.blob();return new Promise((r,n)=>{const s=new FileReader;s.onloadend=function(){const o=s.result,i=o.match(/^data:image\/(png|jpeg|jpg);base64,/);i?r({data:o,type:i[1]}):n(new Error("Could not determine image type"))},s.onerror=n,s.readAsDataURL(a)})}}catch(e){return console.warn(e),null}}}const d=new g;module.exports=d;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import c from "../../node_modules/browser-image-compression/dist/browser-image-compression.js";
|
|
2
|
+
class g {
|
|
3
|
+
async resizeImage(t) {
|
|
4
|
+
const e = await c(t, {
|
|
5
|
+
maxSizeMB: 1,
|
|
6
|
+
maxWidthOrHeight: 1920,
|
|
7
|
+
useWebWorker: !0
|
|
8
|
+
}), a = t.uid;
|
|
9
|
+
return Object.assign(e, {
|
|
10
|
+
uid: a,
|
|
11
|
+
lastModifiedDate: /* @__PURE__ */ new Date()
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async getImageData(t) {
|
|
15
|
+
const e = await this.getImageData0(t);
|
|
16
|
+
if (e) {
|
|
17
|
+
const a = new Image();
|
|
18
|
+
a.src = e.data;
|
|
19
|
+
const o = await new Promise(
|
|
20
|
+
(n) => {
|
|
21
|
+
a.onload = function() {
|
|
22
|
+
n({
|
|
23
|
+
height: a.height,
|
|
24
|
+
width: a.width
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
return Object.assign(e, o), e;
|
|
30
|
+
} else
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
async getImageData0(t) {
|
|
34
|
+
try {
|
|
35
|
+
if (t.startsWith("data:image/")) {
|
|
36
|
+
const e = t.match(/^data:image\/(png|jpeg|jpg);base64,(.*)$/);
|
|
37
|
+
if (!e)
|
|
38
|
+
throw new Error("Invalid base64 image data");
|
|
39
|
+
return { data: t, type: e[1] };
|
|
40
|
+
} else {
|
|
41
|
+
const e = await fetch(t);
|
|
42
|
+
if (!e.ok) throw new Error("Network response was not ok");
|
|
43
|
+
const a = await e.blob();
|
|
44
|
+
return new Promise((o, n) => {
|
|
45
|
+
const s = new FileReader();
|
|
46
|
+
s.onloadend = function() {
|
|
47
|
+
const r = s.result, i = r.match(/^data:image\/(png|jpeg|jpg);base64,/);
|
|
48
|
+
i ? o({
|
|
49
|
+
data: r,
|
|
50
|
+
type: i[1]
|
|
51
|
+
}) : n(new Error("Could not determine image type"));
|
|
52
|
+
}, s.onerror = n, s.readAsDataURL(a);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
} catch (e) {
|
|
56
|
+
return console.warn(e), null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const l = new g();
|
|
61
|
+
export {
|
|
62
|
+
l as default
|
|
63
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const o = {
|
|
2
|
+
minimumFractionDigits: 2,
|
|
3
|
+
maximumFractionDigits: 2
|
|
4
|
+
}, i = { minimumFractionDigits: 0, maximumFractionDigits: 0 };
|
|
5
|
+
function a(t = 0) {
|
|
6
|
+
return (+t).toLocaleString("en", o);
|
|
7
|
+
}
|
|
8
|
+
function u(t = 0, n = 2) {
|
|
9
|
+
const r = e(t, n);
|
|
10
|
+
return isNaN(r) ? void 0 : r;
|
|
11
|
+
}
|
|
12
|
+
function e(t = 0, n = 2) {
|
|
13
|
+
switch (t = +t, (typeof n != "number" || n < 0) && (n = 2), n) {
|
|
14
|
+
case 0:
|
|
15
|
+
return Math.round(t);
|
|
16
|
+
case 1:
|
|
17
|
+
return Math.round(t * 10) / 10;
|
|
18
|
+
case 2:
|
|
19
|
+
return Math.round(t * 100) / 100;
|
|
20
|
+
case 3:
|
|
21
|
+
return Math.round(t * 1e3) / 1e3;
|
|
22
|
+
case 4:
|
|
23
|
+
return Math.round(t * 1e4) / 1e4;
|
|
24
|
+
default: {
|
|
25
|
+
const r = Math.pow(10, n);
|
|
26
|
+
return Math.round(t * r) / r;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function c(t = 0, n = !1) {
|
|
31
|
+
const r = Math.floor(t);
|
|
32
|
+
return n ? r.toLocaleString("en", i) : r.toString();
|
|
33
|
+
}
|
|
34
|
+
function s(t = 1e9) {
|
|
35
|
+
return Math.floor(Math.random() * (t + 1));
|
|
36
|
+
}
|
|
37
|
+
function d(t) {
|
|
38
|
+
const n = Number(t);
|
|
39
|
+
return isNaN(n) ? 0 : n;
|
|
40
|
+
}
|
|
41
|
+
function f(t = 0) {
|
|
42
|
+
const n = t.toString();
|
|
43
|
+
if (!n.includes("."))
|
|
44
|
+
return t;
|
|
45
|
+
const r = n.replace(/\.?0+$/, "");
|
|
46
|
+
return Number(r);
|
|
47
|
+
}
|
|
48
|
+
const m = {
|
|
49
|
+
toInt: c,
|
|
50
|
+
round: e,
|
|
51
|
+
toMoney: a,
|
|
52
|
+
randInt: s,
|
|
53
|
+
withoutNan: d,
|
|
54
|
+
removeTrailingZeros: f,
|
|
55
|
+
roundNoNan: u
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
m as default,
|
|
59
|
+
d as withoutNan
|
|
60
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("../../node_modules/i18next/dist/esm/i18next.cjs"),a=require("./NumberUtil.cjs"),o=e=>[{required:!0,message:`${e} ${i.t("err.validation.required")}`}],s=()=>[{min:8,message:i.t("err.validation.minLength8")}],d=()=>[{type:"number",validator(e,r,t){const n=Number(r);isNaN(n)&&r||n<0||n>100?t(i.t("err.validation.percentage")):t()},message:i.t("err.validation.percentage")}],u=e=>[{max:Number(e),min:0,type:"number",message:i.t("err.validation.maximumValueExceeded").replace("%maxValue%",a.default.toMoney(e))}],l=()=>[{validator:(e,r,t)=>(r.length===12||r.length===10)&&r.search(/^([0-9]{9}[x|X|v|V])|([0-9]{12})$/)!==-1?t():t(i.t("err.validation.invalidNic"))}],m=e=>[{message:`${i.t("err.validation.invalid")} ${e}`,pattern:/^(?:0|94|\+94|0094)?(?:(11|21|23|24|25|26|27|31|32|33|34|35|36|37|38|41|45|47|51|52|54|55|57|63|65|66|67|81|91)(0|2|3|4|5|7|9)|7(0|1|2|4|5|6|7|8)\d)\d{6}$/}],v=()=>[{message:`${i.t("err.validation.positiveNumber")}`,type:"number",validator(e,r,t){r<=0?t(e.message):t()}}],g={percentageValidation:d,required:o,maxValidation:u,passwordValidation:s,nicValidation:l,phoneValidation:m,positiveNumberValidation:v};module.exports=g;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as r } from "../../node_modules/i18next/dist/esm/i18next.js";
|
|
2
|
+
import n from "./NumberUtil.js";
|
|
3
|
+
const o = (e) => [
|
|
4
|
+
{
|
|
5
|
+
required: !0,
|
|
6
|
+
message: `${e} ${r("err.validation.required")}`
|
|
7
|
+
}
|
|
8
|
+
], s = () => [
|
|
9
|
+
{
|
|
10
|
+
min: 8,
|
|
11
|
+
message: r("err.validation.minLength8")
|
|
12
|
+
}
|
|
13
|
+
], d = () => [
|
|
14
|
+
{
|
|
15
|
+
type: "number",
|
|
16
|
+
validator(e, t, i) {
|
|
17
|
+
const a = Number(t);
|
|
18
|
+
isNaN(a) && t ? i(r("err.validation.percentage")) : a < 0 || a > 100 ? i(r("err.validation.percentage")) : i();
|
|
19
|
+
},
|
|
20
|
+
message: r("err.validation.percentage")
|
|
21
|
+
}
|
|
22
|
+
], m = (e) => [
|
|
23
|
+
{
|
|
24
|
+
max: Number(e),
|
|
25
|
+
min: 0,
|
|
26
|
+
type: "number",
|
|
27
|
+
message: r("err.validation.maximumValueExceeded").replace(
|
|
28
|
+
"%maxValue%",
|
|
29
|
+
n.toMoney(e)
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
], l = () => [
|
|
33
|
+
{
|
|
34
|
+
validator: (e, t, i) => t.length === 12 || t.length === 10 ? t.search(/^([0-9]{9}[x|X|v|V])|([0-9]{12})$/) !== -1 ? i() : i(r("err.validation.invalidNic")) : i(r("err.validation.invalidNic"))
|
|
35
|
+
}
|
|
36
|
+
], u = (e) => [
|
|
37
|
+
{
|
|
38
|
+
message: `${r("err.validation.invalid")} ${e}`,
|
|
39
|
+
pattern: /^(?:0|94|\+94|0094)?(?:(11|21|23|24|25|26|27|31|32|33|34|35|36|37|38|41|45|47|51|52|54|55|57|63|65|66|67|81|91)(0|2|3|4|5|7|9)|7(0|1|2|4|5|6|7|8)\d)\d{6}$/
|
|
40
|
+
}
|
|
41
|
+
], v = () => [
|
|
42
|
+
{
|
|
43
|
+
message: `${r("err.validation.positiveNumber")}`,
|
|
44
|
+
type: "number",
|
|
45
|
+
validator(e, t, i) {
|
|
46
|
+
t <= 0 ? i(e.message) : i();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
], V = {
|
|
50
|
+
percentageValidation: d,
|
|
51
|
+
required: o,
|
|
52
|
+
maxValidation: m,
|
|
53
|
+
passwordValidation: s,
|
|
54
|
+
nicValidation: l,
|
|
55
|
+
phoneValidation: u,
|
|
56
|
+
positiveNumberValidation: v
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
V as default
|
|
60
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RcFile } from 'antd/lib/upload';
|
|
2
|
+
export type ImageDataReturn = {
|
|
3
|
+
data: string;
|
|
4
|
+
type: 'png' | 'jpeg' | 'jpg';
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
} | null;
|
|
8
|
+
declare class ImageUtl {
|
|
9
|
+
resizeImage(file: RcFile): Promise<RcFile>;
|
|
10
|
+
getImageData(uriOrBase64: string): Promise<ImageDataReturn>;
|
|
11
|
+
getImageData0(uriOrBase64: string): Promise<ImageDataReturn>;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: ImageUtl;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare function toMoney(num?: number): string;
|
|
2
|
+
declare function roundNoNan(num?: number, pow?: number): number | undefined;
|
|
3
|
+
declare function round(num?: number, pow?: number): number;
|
|
4
|
+
declare function toInt(num?: number, formatted?: boolean): string;
|
|
5
|
+
declare function randInt(max?: number): number;
|
|
6
|
+
export declare function withoutNan(value: number): number;
|
|
7
|
+
declare function removeTrailingZeros(num?: number): number;
|
|
8
|
+
declare const _default: {
|
|
9
|
+
toInt: typeof toInt;
|
|
10
|
+
round: typeof round;
|
|
11
|
+
toMoney: typeof toMoney;
|
|
12
|
+
randInt: typeof randInt;
|
|
13
|
+
withoutNan: typeof withoutNan;
|
|
14
|
+
removeTrailingZeros: typeof removeTrailingZeros;
|
|
15
|
+
roundNoNan: typeof roundNoNan;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Rule } from 'antd/lib/form';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
percentageValidation: () => Rule[];
|
|
4
|
+
required: (modelName: string) => {
|
|
5
|
+
required: boolean;
|
|
6
|
+
message: string;
|
|
7
|
+
}[];
|
|
8
|
+
maxValidation: (max: number) => Rule[];
|
|
9
|
+
passwordValidation: () => Rule[];
|
|
10
|
+
nicValidation: () => Rule[];
|
|
11
|
+
phoneValidation: (modelName: string) => Rule[];
|
|
12
|
+
positiveNumberValidation: () => Rule[];
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../src/util/DateUtil.cjs"),e=require("../src/util/NumberUtil.cjs"),i=require("../src/util/ImageUtil.cjs"),l=require("../src/util/ValidationUtil.cjs");exports.DateUtil=t;exports.NumberUtil=e.default;exports.ImageUtil=i;exports.ValidationUtil=l;
|
package/dist/util/index.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { default as e } from "../src/util/DateUtil.js";
|
|
2
|
+
import { default as o } from "../src/util/NumberUtil.js";
|
|
3
|
+
import { default as f } from "../src/util/ImageUtil.js";
|
|
4
|
+
import { default as m } from "../src/util/ValidationUtil.js";
|
|
5
|
+
export {
|
|
6
|
+
e as DateUtil,
|
|
7
|
+
f as ImageUtil,
|
|
8
|
+
o as NumberUtil,
|
|
9
|
+
m as ValidationUtil
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingteza/crud-component",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.5",
|
|
5
5
|
"description": "React CRUD component library with Ant Design",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"require": "./dist/index.cjs"
|
|
38
38
|
},
|
|
39
39
|
"./common": {
|
|
40
|
-
"types": "./dist/common/index.d.ts",
|
|
41
|
-
"import": "./dist/common/index.js",
|
|
42
|
-
"require": "./dist/common/index.cjs"
|
|
40
|
+
"types": "./dist/components/common/index.d.ts",
|
|
41
|
+
"import": "./dist/components/common/index.js",
|
|
42
|
+
"require": "./dist/components/common/index.cjs"
|
|
43
43
|
},
|
|
44
44
|
"./util": {
|
|
45
45
|
"types": "./dist/util/index.d.ts",
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"react": "^18.0.0",
|
|
88
88
|
"react-dom": "^18.0.0",
|
|
89
89
|
"react-i18next": "^15.2.0",
|
|
90
|
+
"tsup": "^8.3.5",
|
|
90
91
|
"typescript": "~5.6.2",
|
|
91
92
|
"typescript-eslint": "^8.18.2",
|
|
92
93
|
"vite": "^6.0.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const d=require("../../../_virtual/jsx-runtime.js"),r=require("antd"),t=require("../../../_virtual/dayjs.min.js"),C=require("../../../_virtual/advancedFormat.js"),F=require("../../../_virtual/customParseFormat.js"),T=require("../../../_virtual/localeData.js"),v=require("../../../_virtual/weekday.js"),I=require("../../../_virtual/weekOfYear.js"),S=require("../../../_virtual/weekYear.js"),Y=require("../../../locale/hooks/translation-constants.js"),_=require("react"),$=require("../../../node_modules/react-i18next/dist/es/useTranslation.js");t.extend(F);t.extend(C);t.extend(v);t.extend(T);t.extend(I);t.extend(S);const L=({type:M,required:x,label:o,rules:m=[],placeholder:a,disabledPastDays:c=!1,disableToday:i=!1,onEnter:z,disabled:q,nextFocus:B,onChange:s,range:f,showTime:l,disabledFutureDays:u,picker:k,defaultValue:j,value:p,format:O,autoComplete:G="off",enabledDates:H=[],renderExtraFooter:R,...y})=>{const{t:E}=$.useTranslation(Y.TRANSLATION_NAMESPACE),P=f?r.DatePicker.RangePicker:r.DatePicker,w=_.useCallback(e=>{if(!e)return!1;const n=t(),A=c&&e<n.startOf("day"),D=u&&e>n.endOf("day"),N=i&&e<n.endOf("day")&&n.startOf("day")<e;return A||D||N},[c,u,i]);return d.jsxRuntimeExports.jsx(r.Form.Item,{...y,label:o,rules:[{required:x,message:`${o??a??""} ${E("err.validation.required")}`},...m],children:d.jsxRuntimeExports.jsx(P,{renderExtraFooter:R,value:p,picker:k,defaultValue:j,format:O,onChange:e=>s==null?void 0:s(e),disabledDate:w,disabled:q,className:"w-100",placeholder:a,showTime:l})})};module.exports=L;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("../../../_virtual/jsx-runtime.js"),c=require("antd"),F=require("../../../_virtual/dayjs.min.js"),x=require("react"),I=require("../../../locale/hooks/translation-constants.js"),M=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),_=({type:$,required:T,label:i,rules:q=[],placeholder:s,disabledPast:r=!1,disableCurrent:m=!1,onEnter:v,disabled:f,use12Hours:j,nextFocus:w,onChange:o,range:n,disabledFuture:a,defaultValue:p,value:R,format:k,autoComplete:D="off",renderExtraFooter:E,...A})=>{const{t:N}=M.useTranslation(I.TRANSLATION_NAMESPACE),u=x.useMemo(()=>s||(n?["From","To"]:"Select time"),[s,n]);console.log(u);const P=n?c.TimePicker.RangePicker:c.TimePicker,y=x.useCallback(e=>{if(!e)return!1;const t=F(),S=r&&e<t,d=a&&e>t,C=m&&e<t&&t<e;return S||d||C},[m,a,r]);return l.jsxRuntimeExports.jsx(c.Form.Item,{...A,label:i,rules:[{required:T,message:`${i??s??""} ${N("err.validation.required")}`},...q],children:l.jsxRuntimeExports.jsx(P,{use12Hours:j,renderExtraFooter:E,value:R,defaultValue:p,format:k,onChange:e=>o==null?void 0:o(e),disabledDate:y,disabled:f,className:"w-100",placeholder:u})})};module.exports=_;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("../../../_virtual/jsx-runtime.js"),r=({children:s,hide:e})=>t.jsxRuntimeExports.jsx("div",{className:e?"d-none":"",children:s});module.exports=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("../../../_virtual/jsx-runtime.js"),d=require("antd"),R=require("../../../locale/hooks/translation-constants.js"),x=require("react");;/* empty css */const m=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),c=require("../../../node_modules/react-router/dist/development/chunk-K6AXKMTT.js"),v=({className:i,to:e,onClick:t,tooltip:o,ref:j,...n})=>{var u;const{t:a}=m.useTranslation(R.TRANSLATION_NAMESPACE),s=x.useContext(c.NavigationContext)?(u=c.useNavigate)==null?void 0:u.call(c):void 0,r=x.useMemo(()=>l.jsxRuntimeExports.jsx(d.Button,{onClick:t||(e&&s?()=>s(e):void 0),className:i,...n,children:n.children||a(`button.${n.type}`)}),[i,s,t,n,a,e]);return o?l.jsxRuntimeExports.jsx(d.Tooltip,{title:o,children:r}):r},y=({className:i,to:e,onClick:t,tooltip:o,ref:j,...n})=>{const a=c.useNavigate(),[g,s]=x.useState(!1),r=x.useCallback(async q=>{try{return s(!0),await t(q)}finally{s(!1)}},[t]),u=x.useMemo(()=>l.jsxRuntimeExports.jsx(d.Button,{loading:g||n.loading,onClick:t?r:e?()=>a(e):void 0,className:i,...n}),[r,i,g,a,t,n,e]);return o?l.jsxRuntimeExports.jsx(d.Tooltip,{title:o,children:u}):u};v.Async=y;module.exports=v;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("../../../_virtual/jsx-runtime.js"),s=require("./Button.js"),r=require("../../../locale/hooks/translation-constants.js"),i=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),u=require("../../../node_modules/@ant-design/icons/es/icons/CopyOutlined.js");function c({value:n,onClick:e}){const{t:o}=i.useTranslation(r.TRANSLATION_NAMESPACE);return t.jsxRuntimeExports.jsx(s,{type:"link",onClick:()=>e(n),icon:t.jsxRuntimeExports.jsx(u,{}),tooltip:o("clone")})}module.exports=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("../../../_virtual/jsx-runtime.js"),q=require("antd"),n=require("react"),f=require("./Button.js"),E=require("../../../locale/hooks/translation-constants.js"),R=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),m=require("../../../node_modules/@ant-design/icons/es/icons/DeleteOutlined.js");function T({shouldConfirm:d=!0,block:r,value:i,loading:u,onClick:a,text:c,disabled:l,type:x="link"}){const{t:e}=R.useTranslation(E.TRANSLATION_NAMESPACE),s=n.useMemo(()=>c??e("str.delete"),[c,e]),[p,o]=n.useState(!1);n.useEffect(()=>{o(u??!1)},[u]);const j=n.useCallback(async()=>{try{o(!0),await a(i)}finally{o(!1)}},[a,i]);return d?t.jsxRuntimeExports.jsx(q.Popconfirm,{title:e("qus.doYouWantToDelete"),okText:s.toUpperCase(),cancelText:e("str.no").toUpperCase(),onConfirm:j,children:t.jsxRuntimeExports.jsx(f,{tooltip:s,icon:t.jsxRuntimeExports.jsx(m,{}),disabled:l,loading:p,type:x,danger:!0,block:r})}):t.jsxRuntimeExports.jsx(f,{tooltip:s,icon:t.jsxRuntimeExports.jsx(m,{}),disabled:l,loading:p,type:x,danger:!0,block:r,onClick:j})}module.exports=T;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../../_virtual/jsx-runtime.js"),s=require("react"),a=require("./Button.js"),c=require("../../../locale/hooks/translation-constants.js"),l=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),x=require("../../../node_modules/@ant-design/icons/es/icons/ExportOutlined.js");function p({value:t,onClick:e}){const[r,n]=s.useState(!1),{t:i}=l.useTranslation(c.TRANSLATION_NAMESPACE),u=s.useCallback(async()=>{n(!0),e(t).finally(()=>n(!1))},[e,t]);return o.jsxRuntimeExports.jsx(a,{loading:r,type:"link",onClick:u,icon:o.jsxRuntimeExports.jsx(x,{}),tooltip:i("str.export")})}exports.ExportButton=p;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("../../../_virtual/jsx-runtime.js"),q=require("antd"),n=require("react"),C=require("../../../locale/hooks/translation-constants.js"),d=require("./Button.js"),E=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),f=require("../../../node_modules/@ant-design/icons/es/icons/DownCircleOutlined.js");function R({shouldConfirm:m=!0,block:r,value:i,loading:u,onClick:a,text:c,disabled:l,type:x="link"}){const{t:e}=E.useTranslation(C.TRANSLATION_NAMESPACE),s=n.useMemo(()=>c??e("str.hide"),[c,e]),[p,o]=n.useState(!1);n.useEffect(()=>{o(u??!1)},[u]);const j=n.useCallback(async()=>{try{o(!0),await a(i)}finally{o(!1)}},[a,i]);return m?t.jsxRuntimeExports.jsx(q.Popconfirm,{title:e("qus.doYouWantToHide"),okText:s.toUpperCase(),cancelText:e("str.no").toUpperCase(),onConfirm:j,children:t.jsxRuntimeExports.jsx(d,{tooltip:s,icon:t.jsxRuntimeExports.jsx(f,{}),disabled:l,loading:p,type:x,danger:!0,block:r})}):t.jsxRuntimeExports.jsx(d,{tooltip:s,icon:t.jsxRuntimeExports.jsx(f,{}),disabled:l,loading:p,type:x,danger:!0,block:r,onClick:j})}module.exports=R;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../_virtual/jsx-runtime.js"),s=require("react"),g=require("../../../locale/hooks/translation-constants.js"),R=require("./Button.js"),k=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),q=require("../../../node_modules/@ant-design/icons/es/icons/ImportOutlined.js");function C({onClick:o,children:u,accept:c,className:a,disabled:l,type:x="link"}){const[p,i]=s.useState(!1),{t:m}=k.useTranslation(g.TRANSLATION_NAMESPACE),e=s.useRef(null),j=s.useCallback(()=>{d(t=>t+1),e.current&&setTimeout(()=>{var t;(t=e==null?void 0:e.current)==null||t.click()},10)},[]),[f,d]=s.useState(0),y=s.useCallback(async t=>{i(!0);const r=t.target.files[0];r&&await o(r),i(!1)},[o]);return n.jsxRuntimeExports.jsxs("div",{className:a,children:[n.jsxRuntimeExports.jsx("input",{type:"file",style:{display:"none"},ref:e,onChange:y,accept:c},f),n.jsxRuntimeExports.jsx(R,{loading:p,type:x,disabled:l,onClick:j,icon:n.jsxRuntimeExports.jsx(q,{}),tooltip:m("str.import"),children:u})]})}exports.ImportButton=C;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../_virtual/jsx-runtime.js"),a=require("./Button.js"),l=require("../../../locale/hooks/translation-constants.js"),x=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),j=require("../../../node_modules/@ant-design/icons/es/icons/PlusOutlined.js"),m=({size:n,block:r,className:s,type:o="primary",onClick:t,title:u,to:i})=>{const{t:c}=x.useTranslation(l.TRANSLATION_NAMESPACE);return e.jsxRuntimeExports.jsx(a,{type:o,className:s,to:i,block:r,size:n,onClick:t&&(()=>t(!0)),icon:e.jsxRuntimeExports.jsx(j,{}),children:u??c("str.new")})};exports.NewButton=m;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../_virtual/jsx-runtime.js"),p=require("./Button.js"),x=require("../../../locale/hooks/translation-constants.js"),j=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),m=require("../../../node_modules/@ant-design/icons/es/icons/PrinterOutlined.js"),q=({disabled:s,loading:e,block:i,className:o,type:u="primary",onClick:c,title:a,to:l})=>{const{t:n}=j.useTranslation(x.TRANSLATION_NAMESPACE),t=a??n("str.print");return r.jsxRuntimeExports.jsx(p,{type:u,className:o,to:l,loading:e,disabled:s,block:i,onClick:c,tooltip:t!=null&&t.trim()?"":n("str.print"),icon:r.jsxRuntimeExports.jsx(m,{}),children:t})};exports.PrintButton=q;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../_virtual/jsx-runtime.js"),c=require("../../../locale/hooks/translation-constants.js"),l=require("./Button.js"),x=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),R=require("../../../node_modules/@ant-design/icons/es/icons/ReloadOutlined.js"),j=({disabled:r,block:n,className:s,type:o="primary",onClick:t,title:u,to:i})=>{const{t:a}=x.useTranslation(c.TRANSLATION_NAMESPACE);return e.jsxRuntimeExports.jsx(l,{type:o,disabled:r,className:s,to:i,block:n,onClick:t&&(()=>t(!0)),icon:e.jsxRuntimeExports.jsx(R,{}),children:u??a("str.refresh")})};exports.RefreshButton=j;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("../../../_virtual/jsx-runtime.js"),C=require("antd"),n=require("react"),d=require("./Button.js"),E=require("../../../locale/hooks/translation-constants.js"),R=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),f=require("../../../node_modules/@ant-design/icons/es/icons/UpCircleOutlined.js");function T({shouldConfirm:m=!0,block:r,value:i,loading:u,onClick:a,text:c,disabled:l,type:x="link",hidden:q}){const{t:e}=R.useTranslation(E.TRANSLATION_NAMESPACE),s=n.useMemo(()=>c??e("str.unhide"),[c,e]),[p,o]=n.useState(!1);n.useEffect(()=>{o(u??!1)},[u]);const j=n.useCallback(async()=>{try{o(!0),await a(i)}finally{o(!1)}},[a,i]);return m?t.jsxRuntimeExports.jsx(C.Popconfirm,{title:e("qus.doYouWantToHide"),okText:s.toUpperCase(),cancelText:e("str.no").toUpperCase(),onConfirm:j,children:t.jsxRuntimeExports.jsx(d,{tooltip:s,icon:t.jsxRuntimeExports.jsx(f,{}),disabled:l,loading:p,type:x,danger:!0,hidden:q,block:r})}):t.jsxRuntimeExports.jsx(d,{tooltip:s,icon:t.jsxRuntimeExports.jsx(f,{}),disabled:l,loading:p,type:x,danger:!0,block:r,onClick:j})}module.exports=T;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("../../../_virtual/jsx-runtime.js"),o=require("./Button.js"),r=require("../../../locale/hooks/translation-constants.js"),i=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),u=require("../../../node_modules/@ant-design/icons/es/icons/EditOutlined.js");function a({value:n,onClick:s}){const{t:e}=i.useTranslation(r.TRANSLATION_NAMESPACE);return t.jsxRuntimeExports.jsx(o,{tooltip:e("str.update"),type:"link",onClick:()=>s(n),icon:t.jsxRuntimeExports.jsx(u,{})})}module.exports=a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("../../../_virtual/jsx-runtime.js"),i=require("./Button.js"),o=require("../../../locale/hooks/translation-constants.js"),r=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),u=require("../../../node_modules/@ant-design/icons/es/icons/EyeOutlined.js");function c({value:n,onClick:e}){const{t:s}=r.useTranslation(o.TRANSLATION_NAMESPACE);return t.jsxRuntimeExports.jsx(i,{type:"link",onClick:()=>e(n),icon:t.jsxRuntimeExports.jsx(u,{}),tooltip:s("str.view")})}module.exports=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("../../../_virtual/jsx-runtime.js"),c=require("antd"),u=c.Form.Item,d=({onChange:e,label:x,initialValue:t=!1,disabled:n,switch:s=!1,...m})=>r.jsxRuntimeExports.jsxs(u,{...m,valuePropName:"checked",initialValue:t,label:s?x:void 0,children:[!!s&&r.jsxRuntimeExports.jsx(c.Switch,{disabled:n,defaultChecked:t,onChange:e&&(o=>e(o))}),!s&&r.jsxRuntimeExports.jsx(c.Checkbox,{disabled:n,defaultChecked:t,onChange:e&&(o=>e(o.target.checked)),children:x})]});module.exports=d;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("../../../_virtual/jsx-runtime.js"),o=require("antd"),u=require("react"),a=require("../../../util/NumberUtil.js"),m=o.Descriptions.Item,x=({list:s,keepEmptyValues:r,...i})=>{const c=u.useMemo(()=>{const t=r?s:s.filter(e=>e&&!!e.value);return t.forEach(e=>{!e.noFormatting&&!isNaN(e.value)&&(e.value=a.default.toMoney(e.value))}),t},[r,s]);return n.jsxRuntimeExports.jsx(o.Descriptions,{...i,children:c.map(({label:t,value:e})=>n.jsxRuntimeExports.jsx(m,{label:t,children:e},t))})};module.exports=x;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("../../../_virtual/jsx-runtime.js"),s=require("antd"),c=({children:e,className:t=""})=>r.jsxRuntimeExports.jsx(s.Space,{direction:"vertical",className:[t,"w-100"].join(" "),children:e});module.exports=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("../../../_virtual/jsx-runtime.js"),e=require("antd"),a=require("../button/Button.js"),i=require("../../../locale/hooks/translation-constants.js"),u=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),c=({loading:r,children:n,error:o})=>{const{t:s}=u.useTranslation(i.TRANSLATION_NAMESPACE);return t.jsxRuntimeExports.jsx(e.Skeleton,{loading:r,paragraph:!0,className:"h-100",children:o?t.jsxRuntimeExports.jsx(e.Result,{status:"404",title:404,subTitle:s("err.notFound"),className:"",extra:t.jsxRuntimeExports.jsx(a,{to:-1,type:"primary",children:s("str.goBack")})}):n})};module.exports=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../_virtual/jsx-runtime.js");;/* empty css */;/* empty css */const O=require("antd"),s=require("react"),fe=require("../../../node_modules/react-cropper/dist/react-cropper.es.js"),ge=require("../../../locale/hooks/translation-constants.js"),P=require("../button/Button.js"),Re=require("../../../util/ImageUtil.js"),he=require("../../../node_modules/react-i18next/dist/es/useTranslation.js"),Ee=require("../../../node_modules/@ant-design/icons/es/icons/RotateLeftOutlined.js"),we=require("../../../node_modules/@ant-design/icons/es/icons/RotateRightOutlined.js"),X=require("../../../node_modules/@ant-design/icons/es/icons/UploadOutlined.js"),Ce=require("../../../node_modules/@ant-design/icons/es/icons/LoadingOutlined.js"),ve=O.Form.Item;function Q(r){return new Promise((u,x)=>{const n=new FileReader;n.readAsDataURL(r),n.onload=()=>u(n.result),n.onerror=p=>x(p)})}const be=({values:r=[],required:u,buttonType:x,label:n,name:p,onChange:m,aspectRatio:U,buttonTitle:R,hidePreview:h,buttonSize:j="large",showButtonText:f=!0,showOnlyIcon:A=!1,icon:v=t.jsxRuntimeExports.jsx(X,{}),loading:b,maxCount:E=1,onAdd:l,onRemove:S,listType:y,..._})=>{const[Z,ee]=s.useState(""),[te,se]=s.useState(""),[re,D]=s.useState(!1),I=s.useRef(),i=s.useRef(),[a,F]=s.useState([]),[g,N]=s.useState(),ne=s.useRef(),oe=()=>D(!1),ie=async e=>{!e.url&&!e.preview&&(e.preview=await Q(e.originFileObj)),se(e.url||e.preview),D(!0),ee(e.name)},[z,q]=s.useState(!1),ae=()=>{},B=e=>{var o;(o=i==null?void 0:i.current)==null||o.cropper.rotate(e?-90:90)};s.useEffect(()=>{m==null||m(a[0],a)},[a,m]);const ce=()=>{var C;const e=(C=i==null?void 0:i.current)==null?void 0:C.cropper.getCroppedCanvas(),{type:o,size:c,name:d,uid:w}=I.current;q(!0),e==null||e.toBlob(async me=>{const je=Object.assign(new File([me],d,{type:o}),{uid:w}),H=await Re.resizeImage(je),G=await Q(H),K={url:G,name:d,uid:w,type:o,size:c,thumbUrl:G,originFileObj:H};if(l)try{q(!0),await l(K)}finally{q(!1)}F([K,...a]),q(!1)}),N(void 0)},le=()=>{N(void 0),I.current=void 0},T=s.useCallback(e=>{const o=e;if(o){I.current=o;const c=new FileReader;c.addEventListener("load",()=>{var d;if(typeof c.result=="string"){N(c.result);const w=localStorage.getItem("cropper.box"),C=w?JSON.parse(w):void 0;C&&((d=i==null?void 0:i.current)==null||d.cropper.setCropBoxData(C)),setTimeout(()=>{$()},100)}}),c.readAsDataURL(o)}},[]);s.useEffect(()=>{if(r!=null&&r.length||typeof r=="string"){const e=Array.isArray(r)?r.map(o=>[{uid:r,url:o}]):[{uid:r,url:r}];F(e)}},[r]);const{t:M}=he.useTranslation(ge.TRANSLATION_NAMESPACE),ue=s.useMemo(()=>u?{required:u,validator:(e,o,c)=>{g||a!=null&&a.length?c():c(`${n??""} ${M("err.validation.required")}`)}}:void 0,[u,g,a==null?void 0:a.length,n,M]),L=R??M("message.fileUploadMessage2"),J=s.useMemo(()=>t.jsxRuntimeExports.jsx(Y,{showLoadingIndicator:z,_buttonTitle:L,buttonSize:j,buttonType:x,fileList:a,hidePreview:h,icon:v,loading:b,listType:y,maxCount:E,onChangeFile:T,onRemove:S,showButtonText:f,handlePreview:ie,setFileList:F}),[z,L,j,x,a,h,v,b,y,E,T,S,f]);ne.current=J.props.beforeUpload;const[de,V]=s.useState(0),[xe,W]=s.useState(0),[k,pe]=s.useState();s.useEffect(()=>{const e=setTimeout(()=>{k&&localStorage.setItem("cropper.box",JSON.stringify(k))},400);return()=>clearTimeout(e)},[k]),s.useEffect(()=>{g||(V(0),W(0))},[g]);const $=s.useCallback(async()=>{var o;const e=(o=i==null?void 0:i.current)==null?void 0:o.cropper;if(e){const{width:c,height:d}=e.getCroppedCanvas();pe(e.getCropBoxData()),V(c),W(d)}},[]);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(ve,{label:n,..._,name:p,className:"mb-0",rules:[ue,..._.rules??[]],children:J}),t.jsxRuntimeExports.jsxs(O.Modal,{open:!!g,maskClosable:!1,onOk:ce,closable:!1,onCancel:le,children:[t.jsxRuntimeExports.jsx(fe.Cropper,{ref:i,src:g,cropmove:$,viewMode:1,aspectRatio:U,cropend:()=>ae()}),t.jsxRuntimeExports.jsx("p",{className:"text-center",children:[de,xe].join(" ⨉ ")}),t.jsxRuntimeExports.jsxs("div",{className:"mt-2 d-flex justify-content-center",children:[t.jsxRuntimeExports.jsx(P,{size:"large",icon:t.jsxRuntimeExports.jsx(Ee,{}),onClick:()=>B(!0)}),t.jsxRuntimeExports.jsx(P,{size:"large",icon:t.jsxRuntimeExports.jsx(we,{}),onClick:()=>B(!1)})]})]}),t.jsxRuntimeExports.jsx(O.Modal,{open:re,title:Z,footer:null,onCancel:oe,children:t.jsxRuntimeExports.jsx("div",{className:"text-center",children:t.jsxRuntimeExports.jsx("img",{alt:"example",style:{maxWidth:"400px"},src:te})})})]})},Y=({_buttonTitle:r,buttonSize:u,buttonType:x,fileList:n,hidePreview:p,icon:m,loading:U,maxCount:R,onChangeFile:h,onRemove:j,showButtonText:f,handlePreview:A,setFileList:v,showLoadingIndicator:b,listType:E="picture"})=>t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(O.Upload,{accept:"image/x-png,image/gif,image/jpeg",fileList:n,defaultFileList:n,onChange:()=>{},className:(n.length>=R?" hide-upload ":"")+" mb-0",multiple:!1,onPreview:p?void 0:A,onDrop:l=>(h(l.dataTransfer.files.item(0)),!1),listType:E,showUploadList:!p,onRemove:l=>{const S=n.filter(y=>l.uid!==y.uid);j==null||j(l),v(S)},beforeUpload:async l=>(h(l),!1),maxCount:R,children:[b&&t.jsxRuntimeExports.jsx(Ce,{}),t.jsxRuntimeExports.jsx("div",{className:"d-flex flex-column",children:n.length<R&&(E==="picture-circle"?t.jsxRuntimeExports.jsx(X,{}):t.jsxRuntimeExports.jsx(P,{loading:U,tooltip:f?void 0:r,size:u,icon:m,type:f?x:"text",children:f?r:void 0}))})]},n.length)});exports.UploadComponent=Y;exports.default=be;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("../../../_virtual/jsx-runtime.js"),n=require("antd"),i=require("react"),l=({button:m,disabled:c,...t})=>{const a=i.useMemo(()=>{const{enum:e,translations:o}=t;if(e){const r=[];for(const u of e)r.push({key:u,value:(o==null?void 0:o[u])??u.toUpperCase()});return r}else return t.values},[t]),x=m?n.Radio.Button:n.Radio;return s.jsxRuntimeExports.jsx(n.Form.Item,{...t,children:s.jsxRuntimeExports.jsx(n.Radio.Group,{disabled:c,children:a.map(({key:e,value:o})=>s.jsxRuntimeExports.jsx(x,{value:e,children:o},e))})})},R=i.memo(l);module.exports=R;
|