@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,46 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Form as u, Input as p } from "antd";
|
|
3
|
+
import { useTranslationLib as I } from "../../locale/index.es.js";
|
|
4
|
+
const f = (n, e, t, r) => {
|
|
5
|
+
var o;
|
|
6
|
+
e && t && (n.preventDefault(), (o = t == null ? void 0 : t.getFieldInstance(e)) == null || o.focus()), r && r(n);
|
|
7
|
+
}, g = ({
|
|
8
|
+
required: n,
|
|
9
|
+
label: e,
|
|
10
|
+
rules: t = [],
|
|
11
|
+
placeholder: r,
|
|
12
|
+
onEnter: o,
|
|
13
|
+
nextFocus: c,
|
|
14
|
+
className: i,
|
|
15
|
+
...s
|
|
16
|
+
}) => {
|
|
17
|
+
const { t: d } = I(), l = u.useFormInstance();
|
|
18
|
+
return /* @__PURE__ */ a(
|
|
19
|
+
u.Item,
|
|
20
|
+
{
|
|
21
|
+
...s,
|
|
22
|
+
className: i,
|
|
23
|
+
label: e,
|
|
24
|
+
rules: [
|
|
25
|
+
...t,
|
|
26
|
+
{
|
|
27
|
+
required: n,
|
|
28
|
+
message: `${e} ${d("err.validation.required")}`
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
children: /* @__PURE__ */ a(
|
|
32
|
+
p.TextArea,
|
|
33
|
+
{
|
|
34
|
+
...s,
|
|
35
|
+
className: i,
|
|
36
|
+
onPressEnter: (m) => f(m, c, l, o),
|
|
37
|
+
placeholder: r ?? e
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
g as default,
|
|
45
|
+
f as onEnterInternalTextField
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),R=require("@ant-design/icons"),d=require("antd"),S=require("react"),_=require("../../locale/index.cjs.js"),$=require("../tooltip/TooltipComponent.cjs.js"),c=(n,t,e,i)=>{var s;t&&e&&(n.preventDefault(),(s=e==null?void 0:e.getFieldInstance(t))==null||s.focus()),i&&i(n)},A=({type:n,required:t,label:e,disabled:i,rules:s=[],placeholder:u,onEnter:l,size:p,form:x,addonAfter:g,addonBefore:m,nextFocus:I,autoComplete:f="off",defaultValue:j,readOnly:q,value:v,loading:T,onBlur:F,inputRef:P,status:h,autoFocus:C,onChange:D,tooltip:E,...M})=>{const{t:a}=_.useTranslationLib(),w=S.useMemo(()=>{const r=[...s,{required:t,message:`${e??u??""} ${a("err.validation.required")}`}];return n==="email"&&r.push({type:"email",message:a("err.validation.invalidEmail")}),r},[s,t,e,u,a,n]),L={disabled:i,value:v,readOnly:q,defaultValue:j,autoFocus:C,addonBefore:m,ref:P,onBlur:F,addonAfter:T?o.jsx(R.LoadingOutlined,{}):g,status:h,size:p,autoComplete:f,onPressEnter:r=>c(r,I,x,l),type:n,placeholder:u??e},O=n=="password"?d.Input.Password:d.Input;return o.jsx($,{title:E,children:o.jsx(d.Form.Item,{...M,label:e,rules:w,children:o.jsx(O,{...L})})})};exports.default=A;exports.onEnterInternalTextField=c;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FormItemProps } from 'antd';
|
|
2
|
+
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
3
|
+
import { FormInstance } from 'antd/lib/form/Form';
|
|
4
|
+
import { default as React } from 'react';
|
|
5
|
+
export interface TextFieldProps extends FormItemProps<any> {
|
|
6
|
+
type?: any;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
onEnter?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
9
|
+
form?: FormInstance<any>;
|
|
10
|
+
addonAfter?: any;
|
|
11
|
+
addonBefore?: any;
|
|
12
|
+
nextFocus?: string;
|
|
13
|
+
autoComplete?: string;
|
|
14
|
+
defaultValue?: any;
|
|
15
|
+
readOnly?: boolean;
|
|
16
|
+
value?: any;
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
size?: SizeType;
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
inputRef?: any;
|
|
22
|
+
onBlur?: any;
|
|
23
|
+
onChange?: (val: any) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const onEnterInternalTextField: (e: React.KeyboardEvent<HTMLInputElement>, nextFocus?: string, form?: FormInstance<any>, onEnter?: React.KeyboardEventHandler<HTMLInputElement>) => void;
|
|
26
|
+
declare const TextField: React.FC<TextFieldProps>;
|
|
27
|
+
export default TextField;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingOutlined as D } from "@ant-design/icons";
|
|
3
|
+
import { Input as d, Form as M } from "antd";
|
|
4
|
+
import { useMemo as O } from "react";
|
|
5
|
+
import { useTranslationLib as k } from "../../locale/index.es.js";
|
|
6
|
+
import q from "../tooltip/TooltipComponent.es.js";
|
|
7
|
+
const z = (n, o, t, e) => {
|
|
8
|
+
var i;
|
|
9
|
+
o && t && (n.preventDefault(), (i = t == null ? void 0 : t.getFieldInstance(o)) == null || i.focus()), e && e(n);
|
|
10
|
+
}, R = ({
|
|
11
|
+
type: n,
|
|
12
|
+
required: o,
|
|
13
|
+
label: t,
|
|
14
|
+
disabled: e,
|
|
15
|
+
rules: i = [],
|
|
16
|
+
placeholder: a,
|
|
17
|
+
onEnter: p,
|
|
18
|
+
size: f,
|
|
19
|
+
form: l,
|
|
20
|
+
addonAfter: u,
|
|
21
|
+
addonBefore: c,
|
|
22
|
+
nextFocus: g,
|
|
23
|
+
autoComplete: v = "off",
|
|
24
|
+
defaultValue: I,
|
|
25
|
+
readOnly: T,
|
|
26
|
+
value: h,
|
|
27
|
+
loading: x,
|
|
28
|
+
onBlur: C,
|
|
29
|
+
inputRef: F,
|
|
30
|
+
status: P,
|
|
31
|
+
autoFocus: w,
|
|
32
|
+
onChange: B,
|
|
33
|
+
tooltip: E,
|
|
34
|
+
...L
|
|
35
|
+
}) => {
|
|
36
|
+
const { t: m } = k(), $ = O(() => {
|
|
37
|
+
const r = [
|
|
38
|
+
...i,
|
|
39
|
+
{
|
|
40
|
+
required: o,
|
|
41
|
+
message: `${t ?? a ?? ""} ${m(
|
|
42
|
+
"err.validation.required"
|
|
43
|
+
)}`
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
return n === "email" && r.push({
|
|
47
|
+
type: "email",
|
|
48
|
+
message: m("err.validation.invalidEmail")
|
|
49
|
+
}), r;
|
|
50
|
+
}, [i, o, t, a, m, n]), j = {
|
|
51
|
+
disabled: e,
|
|
52
|
+
value: h,
|
|
53
|
+
readOnly: T,
|
|
54
|
+
defaultValue: I,
|
|
55
|
+
autoFocus: w,
|
|
56
|
+
addonBefore: c,
|
|
57
|
+
ref: F,
|
|
58
|
+
onBlur: C,
|
|
59
|
+
addonAfter: x ? /* @__PURE__ */ s(D, {}) : u,
|
|
60
|
+
status: P,
|
|
61
|
+
size: f,
|
|
62
|
+
autoComplete: v,
|
|
63
|
+
onPressEnter: (r) => z(r, g, l, p),
|
|
64
|
+
type: n,
|
|
65
|
+
placeholder: a ?? t
|
|
66
|
+
}, A = n == "password" ? d.Password : d;
|
|
67
|
+
return /* @__PURE__ */ s(q, { title: E, children: /* @__PURE__ */ s(M.Item, { ...L, label: t, rules: $, children: /* @__PURE__ */ s(A, { ...j }) }) });
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
R as default,
|
|
71
|
+
z as onEnterInternalTextField
|
|
72
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as NumberTextField } from './NumberField';
|
|
2
|
+
import { default as PhoneField } from './PhoneNumberField';
|
|
3
|
+
import { default as TextField } from './TextField';
|
|
4
|
+
import { default as TextAreaComponent } from './TextArea';
|
|
5
|
+
export { NumberTextField, PhoneField, TextField, TextAreaComponent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),e=require("antd"),n=({children:t,title:o})=>o?r.jsx(e.Tooltip,{title:o,children:t}):t;module.exports=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),l=require("@ant-design/icons"),r=require("antd"),x=require("../button/Button.cjs.js"),b=require("../../locale/index.cjs.js"),F=({errorChildren:v,children:a,onRetry:c,onClickBack:u,success:e,loading:o,error:i,successTitle:j,successMessage:p,errorMessage:n,errorTitle:m,loadingTitle:y,loadingMessage:T})=>{const{t:s}=b.useTranslationLib(),f=j??s("str.success"),q=m??s("str.error"),d=n?typeof n=="function"?n():n:s("err.save"),h=y??s("message.loading.saving");return t.jsx(r.Result,{status:o?void 0:e?"success":i?["403","404","500"].includes(i==null?void 0:i.code)?i.code:i?"error":void 0:void 0,title:o?h:e?f:i?q:void 0,icon:o?t.jsx(l.LoadingOutlined,{}):void 0,subTitle:o?T:e?p:i?typeof n=="function"?n()??d:n??d:void 0,extra:[e?t.jsx(t.Fragment,{children:a}):i?t.jsxs(t.Fragment,{children:[!!u&&t.jsx(x,{onClick:u,htmlType:"button",type:"primary",icon:t.jsx(l.ArrowLeftOutlined,{}),children:s("str.previous")}),!!c&&t.jsx(x,{type:"primary",onClick:()=>c(void 0,void 0,!0),children:s("str.retry")},"retry"),v]}):t.jsx(t.Fragment,{})]})};module.exports=F;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React, FC, PropsWithChildren } from 'react';
|
|
2
|
+
declare const WizardResult: FC<{
|
|
3
|
+
onRetry?: (_: undefined, __: undefined, retry: true) => void;
|
|
4
|
+
onClickBack?: () => void;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: any;
|
|
7
|
+
success: boolean;
|
|
8
|
+
successTitle?: string;
|
|
9
|
+
successMessage?: string;
|
|
10
|
+
errorTitle?: string;
|
|
11
|
+
errorMessage?: string | (() => string | undefined);
|
|
12
|
+
loadingTitle?: string;
|
|
13
|
+
loadingMessage?: string;
|
|
14
|
+
errorChildren?: React.ReactNode;
|
|
15
|
+
} & PropsWithChildren>;
|
|
16
|
+
export default WizardResult;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as o, jsxs as j, Fragment as s } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowLeftOutlined as B, LoadingOutlined as C } from "@ant-design/icons";
|
|
3
|
+
import { Result as O } from "antd";
|
|
4
|
+
import e from "../button/Button.es.js";
|
|
5
|
+
import { useTranslationLib as r } from "../../locale/index.es.js";
|
|
6
|
+
const W = ({
|
|
7
|
+
errorChildren: p,
|
|
8
|
+
children: f,
|
|
9
|
+
onRetry: c,
|
|
10
|
+
onClickBack: m,
|
|
11
|
+
success: d,
|
|
12
|
+
loading: l,
|
|
13
|
+
error: t,
|
|
14
|
+
successTitle: v,
|
|
15
|
+
successMessage: a,
|
|
16
|
+
errorMessage: i,
|
|
17
|
+
errorTitle: y,
|
|
18
|
+
loadingTitle: T,
|
|
19
|
+
loadingMessage: h
|
|
20
|
+
}) => {
|
|
21
|
+
const { t: n } = r(), x = v ?? n("str.success"), b = y ?? n("str.error"), u = i ? typeof i == "function" ? i() : i : n("err.save"), L = T ?? n("message.loading.saving");
|
|
22
|
+
return /* @__PURE__ */ o(
|
|
23
|
+
O,
|
|
24
|
+
{
|
|
25
|
+
status: l ? void 0 : d ? "success" : t ? ["403", "404", "500"].includes(t == null ? void 0 : t.code) ? t.code : t ? "error" : void 0 : void 0,
|
|
26
|
+
title: l ? L : d ? x : t ? b : void 0,
|
|
27
|
+
icon: l ? /* @__PURE__ */ o(C, {}) : void 0,
|
|
28
|
+
subTitle: l ? h : d ? a : t ? typeof i == "function" ? i() ?? u : i ?? u : void 0,
|
|
29
|
+
extra: [
|
|
30
|
+
d ? /* @__PURE__ */ o(s, { children: f }) : t ? /* @__PURE__ */ j(s, { children: [
|
|
31
|
+
!!m && /* @__PURE__ */ o(
|
|
32
|
+
e,
|
|
33
|
+
{
|
|
34
|
+
onClick: m,
|
|
35
|
+
htmlType: "button",
|
|
36
|
+
type: "primary",
|
|
37
|
+
icon: /* @__PURE__ */ o(B, {}),
|
|
38
|
+
children: n("str.previous")
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
!!c && /* @__PURE__ */ o(
|
|
42
|
+
e,
|
|
43
|
+
{
|
|
44
|
+
type: "primary",
|
|
45
|
+
onClick: () => c(void 0, void 0, !0),
|
|
46
|
+
children: n("str.retry")
|
|
47
|
+
},
|
|
48
|
+
"retry"
|
|
49
|
+
),
|
|
50
|
+
p
|
|
51
|
+
] }) : /* @__PURE__ */ o(s, {})
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
W as default
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),w=require("antd"),o=require("react"),F=require("../appearance/Hider.cjs.js"),{Step:R}=w.Steps,y=o.forwardRef(({pages:d,onSubmit:u,initPosition:f=0,progressDot:v,type:b,labelPlacement:g,className:k,pageStyle:q},C)=>{const[s,i]=o.useState(0),[r,p]=o.useState([]);o.useEffect(()=>{i(f)},[f]),o.useImperativeHandle(C,()=>({gotTo:t=>i(t)}),[]);const m=o.useCallback((t,a=!1,l=!1)=>{const e=[...r];if(t!==void 0&&(e[s]=t,p(e)),l||i(s+1),a&&u){const n={};for(const x of e)for(const S in x)n[S]=x[S];u(e,n)}},[s,r,u]),h=o.useCallback(()=>{const t=[...r];t[s]=void 0,p(t),i(s-1)},[s,r]),j=o.useMemo(()=>{const t=[],a=[],l=d.filter(e=>!e.hidden);for(let e=0;e<l.length;e++){const n=l[e];a.push(c.jsx(F,{hide:s!==e,children:n.component({forward:m,backward:h},r,s===e)},`${n.title}${e}`)),t.push(c.jsx(R,{icon:n.icon,title:n.title},n.title))}return{_pages:a,steps:t}},[h,s,r,m,d]);return c.jsxs(c.Fragment,{children:[c.jsx(w.Steps,{labelPlacement:g,progressDot:v,className:[k,"pb-3"].join(" "),current:s,type:b,children:j.steps}),c.jsx("div",{style:q,children:j._pages})]})});module.exports=y;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as React, ReactElement } from 'react';
|
|
2
|
+
interface WizardViewFormProps {
|
|
3
|
+
pages: {
|
|
4
|
+
hidden?: boolean;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
title: string;
|
|
7
|
+
component: (func: {
|
|
8
|
+
forward: (value?: any, submit?: boolean, isRetry?: boolean) => void;
|
|
9
|
+
backward: () => void;
|
|
10
|
+
}, formSubmissionData: any[], isActive: boolean) => ReactElement;
|
|
11
|
+
}[];
|
|
12
|
+
labelPlacement?: "vertical" | "horizontal";
|
|
13
|
+
initPosition?: number;
|
|
14
|
+
onSubmit?: (val: (any | undefined)[], combinedValue: any) => void;
|
|
15
|
+
type?: "default" | "navigation" | "inline";
|
|
16
|
+
className?: string;
|
|
17
|
+
progressDot?: boolean;
|
|
18
|
+
pageStyle?: React.CSSProperties;
|
|
19
|
+
}
|
|
20
|
+
export interface WizardViewFormRef {
|
|
21
|
+
gotTo: (index: number) => void;
|
|
22
|
+
}
|
|
23
|
+
declare const WizardViewForm: React.ForwardRefExoticComponent<WizardViewFormProps & React.RefAttributes<WizardViewFormRef>>;
|
|
24
|
+
export default WizardViewForm;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as f, jsxs as H, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { Steps as b } from "antd";
|
|
3
|
+
import { forwardRef as $, useState as S, useEffect as z, useImperativeHandle as E, useCallback as g, useMemo as I } from "react";
|
|
4
|
+
import M from "../appearance/Hider.es.js";
|
|
5
|
+
const { Step: N } = b, q = $(
|
|
6
|
+
({
|
|
7
|
+
pages: a,
|
|
8
|
+
onSubmit: l,
|
|
9
|
+
initPosition: d = 0,
|
|
10
|
+
progressDot: j,
|
|
11
|
+
type: k,
|
|
12
|
+
labelPlacement: x,
|
|
13
|
+
className: F,
|
|
14
|
+
pageStyle: y
|
|
15
|
+
}, C) => {
|
|
16
|
+
const [t, n] = S(0), [r, m] = S(
|
|
17
|
+
[]
|
|
18
|
+
);
|
|
19
|
+
z(() => {
|
|
20
|
+
n(d);
|
|
21
|
+
}, [d]), E(
|
|
22
|
+
C,
|
|
23
|
+
() => ({
|
|
24
|
+
gotTo: (s) => n(s)
|
|
25
|
+
}),
|
|
26
|
+
[]
|
|
27
|
+
);
|
|
28
|
+
const p = g(
|
|
29
|
+
(s, c = !1, i = !1) => {
|
|
30
|
+
const e = [...r];
|
|
31
|
+
if (s !== void 0 && (e[t] = s, m(e)), i || n(t + 1), c && l) {
|
|
32
|
+
const o = {};
|
|
33
|
+
for (const w of e)
|
|
34
|
+
for (const v in w)
|
|
35
|
+
o[v] = w[v];
|
|
36
|
+
l(e, o);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
[t, r, l]
|
|
40
|
+
), u = g(() => {
|
|
41
|
+
const s = [...r];
|
|
42
|
+
s[t] = void 0, m(s), n(t - 1);
|
|
43
|
+
}, [t, r]), h = I(() => {
|
|
44
|
+
const s = [], c = [], i = a.filter((e) => !e.hidden);
|
|
45
|
+
for (let e = 0; e < i.length; e++) {
|
|
46
|
+
const o = i[e];
|
|
47
|
+
c.push(
|
|
48
|
+
/* @__PURE__ */ f(M, { hide: t !== e, children: o.component({ forward: p, backward: u }, r, t === e) }, `${o.title}${e}`)
|
|
49
|
+
), s.push(/* @__PURE__ */ f(N, { icon: o.icon, title: o.title }, o.title));
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
_pages: c,
|
|
53
|
+
steps: s
|
|
54
|
+
};
|
|
55
|
+
}, [u, t, r, p, a]);
|
|
56
|
+
return /* @__PURE__ */ H(_, { children: [
|
|
57
|
+
/* @__PURE__ */ f(
|
|
58
|
+
b,
|
|
59
|
+
{
|
|
60
|
+
labelPlacement: x,
|
|
61
|
+
progressDot: j,
|
|
62
|
+
className: [F, "pb-3"].join(" "),
|
|
63
|
+
current: t,
|
|
64
|
+
type: k,
|
|
65
|
+
children: h.steps
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ f("div", { style: y, children: h._pages })
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
export {
|
|
73
|
+
q as default
|
|
74
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react-responsive");function t(){const s=e.useMediaQuery({minWidth:768}),i=e.useMediaQuery({maxWidth:767});return{isDesktop:s,isMobile:i}}module.exports=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useWindowDimensions } from './WindowDimension';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),l=require("antd"),t=require("react"),H=require("./modal/index.cjs.js"),J=require("./import/CrudImportButton.cjs.js"),K=require("./view/CrudViewer.cjs.js"),L=require("../common/button/NewButton.cjs.js"),M=require("../common/button/PrintButton.cjs.js"),{useForm:Q}=l.Form;function O({idField:a="id",onCreate:C,onDelete:j,onHide:m,onUpdate:n,fields:r,data:f,grid:k,isHiding:q,isCreating:h,isDeleting:p,isUpdating:B,paginateProps:w,onPrint:i,printing:N,viewable:v,loadingData:R,formBuilder:g,extraAction:y,minusHeight:b,cloneable:F,fullWidthModal:P=!0,wizard:S,extraView:I,importable:u,onClickNew:d,size:V,...z}){const c=t.useRef(null),A=t.useCallback(()=>{var s;(s=c.current)==null||s.create()},[]),o=t.useCallback(async(s,E=!0,G=!1)=>{var x;await((x=c.current)==null?void 0:x.update(s,E,G))},[]),D=t.useCallback(async s=>{o(s,!1,!0)},[o]);return e.jsxs(e.Fragment,{children:[e.jsxs(l.Space,{direction:"vertical",className:"w-100",children:[e.jsxs("div",{className:"w-100 d-flex",children:[e.jsx("div",{style:{flex:1},children:e.jsx(L.NewButton,{onClick:()=>{d?d():A()},className:"flex-1"})}),e.jsxs(l.Space,{children:[!!i&&e.jsx(M.PrintButton,{className:"float-right",loading:N,onClick:i}),!!u&&e.jsx(J,{fields:r,importProps:u})]})]}),e.jsx(K,{...z,minusHeight:b,data:f,size:V,fields:r,extraAction:y,idField:a,isDeleting:p,loadingData:R,onClickUpdate:n?o:void 0,onHide:m,isHiding:q,onDelete:j,onUpdate:n,onClickClone:F?D:void 0,paginateProps:w,viewable:v,extraView:I})]}),e.jsx(H,{ref:c,fields:r,wizard:S,grid:k,fullWidthModal:P,isCreating:h,isUpdating:B,onCreate:C,onUpdate:n,idField:a,formBuilder:g})]})}module.exports=O;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { ColorPickerProps } from 'antd';
|
|
2
|
+
import { Rule } from 'antd/es/form';
|
|
3
|
+
import { FormInstance } from 'antd/lib';
|
|
4
|
+
import { Dayjs } from 'dayjs';
|
|
5
|
+
import { default as React, ReactElement, ReactNode } from 'react';
|
|
6
|
+
import { CrudSearchComponentProps } from './CrudSearchComponent';
|
|
7
|
+
import { FileCrudField } from './FileCrudField';
|
|
8
|
+
import { ImageCrudField } from './ImageCrudField';
|
|
9
|
+
import { CrudImportProps } from './import/CrudImportComponent';
|
|
10
|
+
import { CrudDragableProps, CrudViewableProps } from './view/CrudViewer';
|
|
11
|
+
import { SelectTagRenderProps } from '../common/select/SelectComponent';
|
|
12
|
+
import { default as IdProps } from '../types/Id';
|
|
13
|
+
import { TextAreaBasedFieldProps } from './CrudTextAreaComponent';
|
|
14
|
+
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
15
|
+
export type SelectFieldItem = {
|
|
16
|
+
key?: string | number;
|
|
17
|
+
value: string | number;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export interface InitialCrudField<T> {
|
|
21
|
+
label: string;
|
|
22
|
+
fieldHelper?: ReactNode;
|
|
23
|
+
updatingValue?: T;
|
|
24
|
+
render?: (value: any, obj: T, index: number) => any;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
updatable?: boolean;
|
|
27
|
+
fieldTooltip?: string;
|
|
28
|
+
hideInTable?: boolean;
|
|
29
|
+
hideInDescList?: boolean;
|
|
30
|
+
readonly?: boolean;
|
|
31
|
+
fieldClassName?: string;
|
|
32
|
+
halign?: "right" | "left";
|
|
33
|
+
/**
|
|
34
|
+
* Indicates the fields is visible or not
|
|
35
|
+
*/
|
|
36
|
+
hidden?: boolean;
|
|
37
|
+
width?: number | string;
|
|
38
|
+
name: keyof T | (string | number)[];
|
|
39
|
+
rules?: Rule[];
|
|
40
|
+
grid?: CrudFieldGrid;
|
|
41
|
+
report?: {
|
|
42
|
+
searchable?: boolean;
|
|
43
|
+
sortable?: boolean;
|
|
44
|
+
defaultSort?: boolean | "ASC" | "DESC";
|
|
45
|
+
lock?: boolean;
|
|
46
|
+
alreadySelected?: boolean;
|
|
47
|
+
customRender?: (form: FormInstance<any>) => ReactElement;
|
|
48
|
+
};
|
|
49
|
+
customFormFieldRender?: (form: FormInstance<T>, props: InitialCrudField<T>) => React.ReactElement;
|
|
50
|
+
importProps?: {
|
|
51
|
+
extraFields?: string[];
|
|
52
|
+
hidden?: boolean;
|
|
53
|
+
};
|
|
54
|
+
hideLabel?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export type CrudFieldGrid = {
|
|
57
|
+
xs?: number;
|
|
58
|
+
sm?: number;
|
|
59
|
+
md?: number;
|
|
60
|
+
lg?: number;
|
|
61
|
+
xl?: number;
|
|
62
|
+
xxl?: number;
|
|
63
|
+
};
|
|
64
|
+
export interface SelectCrudField<T, ItemType extends SelectFieldItem = SelectFieldItem> extends Omit<InitialCrudField<T>, "name">, AddonFieldProps {
|
|
65
|
+
name: InitialCrudField<T>["name"] | {
|
|
66
|
+
name: keyof T | (string | number)[];
|
|
67
|
+
upsertFieldName: keyof T | (string | number)[];
|
|
68
|
+
};
|
|
69
|
+
type: "select";
|
|
70
|
+
placeholder?: string;
|
|
71
|
+
/**
|
|
72
|
+
* @default true
|
|
73
|
+
*/
|
|
74
|
+
allowClear?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Used when the type is 'select'
|
|
77
|
+
*/
|
|
78
|
+
innerFieldId?: string;
|
|
79
|
+
innerFieldLabel?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Used when the type is 'select'
|
|
82
|
+
*/
|
|
83
|
+
items: ItemType[];
|
|
84
|
+
tagRender?: SelectTagRenderProps;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the search should be highlighted
|
|
87
|
+
*/
|
|
88
|
+
highlightSearch?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Used when the type is 'select'
|
|
91
|
+
*/
|
|
92
|
+
loading?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Used when the type is 'select'
|
|
95
|
+
*/
|
|
96
|
+
onSearch?: (keyword: any, form: FormInstance<T>, record: T | undefined) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Used when the type is 'select'. Wether the result should refresh if the search value is changed.
|
|
99
|
+
*/
|
|
100
|
+
searchOnType?: boolean;
|
|
101
|
+
multiple?: boolean;
|
|
102
|
+
report?: InitialCrudField<T>["report"] & {
|
|
103
|
+
multiple?: boolean;
|
|
104
|
+
};
|
|
105
|
+
onChange?: (value: any, form: FormInstance<T>) => void;
|
|
106
|
+
onSet?: (value: any | any[], items: SelectFieldItem[], form: FormInstance<T>) => void;
|
|
107
|
+
}
|
|
108
|
+
export interface EnumCrudField<T> extends InitialCrudField<T> {
|
|
109
|
+
type: "enum";
|
|
110
|
+
placeholder?: string;
|
|
111
|
+
name: keyof T;
|
|
112
|
+
enum: object | object[];
|
|
113
|
+
radio?: boolean;
|
|
114
|
+
translation?: object;
|
|
115
|
+
multiple?: boolean;
|
|
116
|
+
tagRender?: Record<string, {
|
|
117
|
+
color: string;
|
|
118
|
+
}> | SelectTagRenderProps;
|
|
119
|
+
onChange?: (value: T[keyof T], form: FormInstance<T>) => void;
|
|
120
|
+
onSearch?: (keyword: string, form: FormInstance<T>) => void;
|
|
121
|
+
}
|
|
122
|
+
export type AddonFieldProps = {
|
|
123
|
+
addonAfter?: ReactNode;
|
|
124
|
+
addonBefore?: ReactNode;
|
|
125
|
+
};
|
|
126
|
+
export interface ObjectCrudField<T> extends InitialCrudField<T> {
|
|
127
|
+
type: "object";
|
|
128
|
+
render: (value: any, obj: T, index: number) => any;
|
|
129
|
+
translation?: object;
|
|
130
|
+
}
|
|
131
|
+
export interface TextBasedFieldProps<T> extends InitialCrudField<T>, AddonFieldProps {
|
|
132
|
+
placeholder?: string;
|
|
133
|
+
type: "text" | "time" | "email" | "password";
|
|
134
|
+
onChange?: (value: string, form: FormInstance<T>) => void;
|
|
135
|
+
}
|
|
136
|
+
export interface ColorPickerFieldProps<T> extends Omit<InitialCrudField<T>, "placeholder"> {
|
|
137
|
+
type: "color";
|
|
138
|
+
innerProps?: ColorPickerProps;
|
|
139
|
+
}
|
|
140
|
+
export interface CheckboxBasedFieldProps<T> extends InitialCrudField<T> {
|
|
141
|
+
type: "checkbox";
|
|
142
|
+
onChange?: (value: boolean, form: FormInstance<T>) => void;
|
|
143
|
+
}
|
|
144
|
+
export interface NumberBasedFieldProps<T> extends InitialCrudField<T>, AddonFieldProps {
|
|
145
|
+
type: "number";
|
|
146
|
+
placeholder?: string;
|
|
147
|
+
allowMinus?: boolean;
|
|
148
|
+
min?: number;
|
|
149
|
+
max?: number;
|
|
150
|
+
/**
|
|
151
|
+
* If it is number field making this true will convert the value to comma separated number field
|
|
152
|
+
*/
|
|
153
|
+
formatted?: boolean;
|
|
154
|
+
int?: boolean;
|
|
155
|
+
onChange?: (value: number, form: FormInstance<T>) => void;
|
|
156
|
+
}
|
|
157
|
+
export interface DateBasedFieldProps<T> extends InitialCrudField<T> {
|
|
158
|
+
type: "date";
|
|
159
|
+
format?: string;
|
|
160
|
+
placeholder?: string;
|
|
161
|
+
/**
|
|
162
|
+
* If it is number field making this true will convert the value to comma separated number field
|
|
163
|
+
*/
|
|
164
|
+
formatTime?: boolean;
|
|
165
|
+
range?: boolean;
|
|
166
|
+
disableToday?: boolean;
|
|
167
|
+
disabledFutureDays?: boolean;
|
|
168
|
+
disabledPastDays?: boolean;
|
|
169
|
+
report?: InitialCrudField<T>["report"] & {
|
|
170
|
+
range?: boolean;
|
|
171
|
+
required?: boolean;
|
|
172
|
+
};
|
|
173
|
+
onChange?: (value: Dayjs | undefined, form: FormInstance<T>) => void;
|
|
174
|
+
}
|
|
175
|
+
export interface TimeBasedFieldProps<T> extends InitialCrudField<T> {
|
|
176
|
+
type: "time";
|
|
177
|
+
placeholder?: string;
|
|
178
|
+
use12Hours?: boolean;
|
|
179
|
+
range?: boolean;
|
|
180
|
+
format?: "h:mm:ss" | "h:mm:ss A" | "h:mm" | "h:mm A" | "mm" | "h" | "h A";
|
|
181
|
+
disableCurrent?: boolean;
|
|
182
|
+
disabledFuture?: boolean;
|
|
183
|
+
disabledPast?: boolean;
|
|
184
|
+
report?: InitialCrudField<T>["report"] & {
|
|
185
|
+
range?: boolean;
|
|
186
|
+
};
|
|
187
|
+
onChange?: (value: Dayjs | undefined, form: FormInstance<T>) => void;
|
|
188
|
+
}
|
|
189
|
+
export type CrudPurpose = "new" | "clone" | "update";
|
|
190
|
+
export type GetFormFieldOptions = {
|
|
191
|
+
onChange?: (value: any) => void;
|
|
192
|
+
render?: (component: React.JSX.Element) => React.ReactElement;
|
|
193
|
+
};
|
|
194
|
+
export type FormBuilderFunc0<T> = (name: keyof T, options?: GetFormFieldOptions) => ReactElement;
|
|
195
|
+
export type FormBuilderFunc<T> = (i: FormBuilderFunc0<T>, otherUtils: {
|
|
196
|
+
isAnyFieldHidden: (...name: Array<keyof T>) => boolean;
|
|
197
|
+
isAllFieldsHidden: (...name: Array<keyof T>) => boolean;
|
|
198
|
+
purpose?: CrudPurpose;
|
|
199
|
+
}) => ReactElement;
|
|
200
|
+
export type CrudFieldProps<T> = SelectCrudField<T> | TextBasedFieldProps<T> | TextAreaBasedFieldProps<T> | ImageCrudField<T> | EnumCrudField<T> | DateBasedFieldProps<T> | TimeBasedFieldProps<T> | ObjectCrudField<T> | NumberBasedFieldProps<T> | CheckboxBasedFieldProps<T> | ColorPickerFieldProps<T> | FileCrudField<T>;
|
|
201
|
+
export type CrudPaginateProps = false | {
|
|
202
|
+
page?: number;
|
|
203
|
+
setPage?: (page: number, pageSize?: number) => void;
|
|
204
|
+
pageSize?: number;
|
|
205
|
+
count?: number;
|
|
206
|
+
};
|
|
207
|
+
export type CrudWizardProp<T> = {
|
|
208
|
+
title: string;
|
|
209
|
+
fields: Array<keyof T>;
|
|
210
|
+
icon?: ReactElement;
|
|
211
|
+
formBuilder?: FormBuilderFunc<T>;
|
|
212
|
+
grid?: boolean;
|
|
213
|
+
};
|
|
214
|
+
export type CrudComponentProps<T, FormType = T> = {
|
|
215
|
+
fields: CrudFieldProps<T>[];
|
|
216
|
+
data: T[] | undefined;
|
|
217
|
+
idField?: string;
|
|
218
|
+
grid?: boolean;
|
|
219
|
+
onPrint?: () => void;
|
|
220
|
+
printing?: boolean;
|
|
221
|
+
onCreate?: (t: FormType) => Promise<any>;
|
|
222
|
+
onHide?: (id: any) => Promise<any>;
|
|
223
|
+
onDelete?: (id: any) => Promise<any>;
|
|
224
|
+
onUpdate?: (t: FormType & IdProps) => Promise<any>;
|
|
225
|
+
loadingData?: boolean;
|
|
226
|
+
isCreating?: boolean;
|
|
227
|
+
isHiding?: boolean;
|
|
228
|
+
isDeleting?: boolean;
|
|
229
|
+
isUpdating?: boolean;
|
|
230
|
+
viewable?: CrudViewableProps<T>;
|
|
231
|
+
extraAction?: (t: T) => ReactElement;
|
|
232
|
+
paginateProps?: CrudPaginateProps;
|
|
233
|
+
formBuilder?: FormBuilderFunc<T>;
|
|
234
|
+
minusHeight?: string;
|
|
235
|
+
cloneable?: boolean;
|
|
236
|
+
fullWidthModal?: boolean;
|
|
237
|
+
wizard?: CrudWizardProp<T>[];
|
|
238
|
+
extraView?: (t: T) => React.ReactElement;
|
|
239
|
+
importable?: CrudImportProps<T>;
|
|
240
|
+
onClickNew?: () => void;
|
|
241
|
+
draggable?: CrudDragableProps<T>;
|
|
242
|
+
size?: SizeType;
|
|
243
|
+
} & CrudSearchComponentProps<T, FormType>;
|
|
244
|
+
declare function CrudComponent<T, FormType = T>({ idField, onCreate, onDelete, onHide, onUpdate, fields, data, grid, isHiding, isCreating, isDeleting, isUpdating, paginateProps, onPrint, printing, viewable, loadingData, formBuilder, extraAction, minusHeight, cloneable, fullWidthModal, wizard, extraView, importable, onClickNew, size, ...props }: CrudComponentProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
|
|
245
|
+
export default CrudComponent;
|