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