@kingteza/crud-component 1.0.24 → 1.0.25
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/App.d.ts +2 -0
- package/components/common/DatePicker/DatePicker.cjs +1 -0
- package/components/common/DatePicker/DatePicker.d.ts +37 -0
- package/components/common/DatePicker/DatePicker.js +88 -0
- package/components/common/DatePicker/TimePicker.cjs +1 -0
- package/components/common/DatePicker/TimePicker.d.ts +34 -0
- package/components/common/DatePicker/TimePicker.js +78 -0
- package/components/common/DatePicker/index.d.ts +3 -0
- package/components/common/appearance/Hider.cjs +1 -0
- package/components/common/appearance/Hider.d.ts +6 -0
- package/components/common/appearance/Hider.js +5 -0
- package/components/common/appearance/index.d.ts +0 -0
- package/components/common/button/Button.cjs +1 -0
- package/components/common/button/Button.d.ts +12 -0
- package/components/common/button/Button.js +79 -0
- package/components/common/button/CloneButtonTable.cjs +1 -0
- package/components/common/button/CloneButtonTable.d.ts +6 -0
- package/components/common/button/CloneButtonTable.js +20 -0
- package/components/common/button/DeleteButtonTable.cjs +1 -0
- package/components/common/button/DeleteButtonTable.d.ts +13 -0
- package/components/common/button/DeleteButtonTable.js +68 -0
- package/components/common/button/ExportButton.cjs +1 -0
- package/components/common/button/ExportButton.d.ts +4 -0
- package/components/common/button/ExportButton.js +27 -0
- package/components/common/button/HideButtonTable.cjs +1 -0
- package/components/common/button/HideButtonTable.d.ts +13 -0
- package/components/common/button/HideButtonTable.js +68 -0
- package/components/common/button/ImportButton.cjs +1 -0
- package/components/common/button/ImportButton.d.ts +9 -0
- package/components/common/button/ImportButton.js +56 -0
- package/components/common/button/NewButton.cjs +1 -0
- package/components/common/button/NewButton.d.ts +12 -0
- package/components/common/button/NewButton.js +24 -0
- package/components/common/button/PrintButton.cjs +1 -0
- package/components/common/button/PrintButton.d.ts +12 -0
- package/components/common/button/PrintButton.js +26 -0
- package/components/common/button/RefreshButton.cjs +1 -0
- package/components/common/button/RefreshButton.d.ts +11 -0
- package/components/common/button/RefreshButton.js +24 -0
- package/components/common/button/UnHideButton.cjs +1 -0
- package/components/common/button/UnHideButton.d.ts +14 -0
- package/components/common/button/UnHideButton.js +70 -0
- package/components/common/button/UpdateButtonTable.cjs +1 -0
- package/components/common/button/UpdateButtonTable.d.ts +6 -0
- package/components/common/button/UpdateButtonTable.js +20 -0
- package/components/common/button/ViewButtonTable.cjs +1 -0
- package/components/common/button/ViewButtonTable.d.ts +6 -0
- package/components/common/button/ViewButtonTable.js +20 -0
- package/components/common/button/index.d.ts +14 -0
- package/components/common/check-box/CheckBox.cjs +1 -0
- package/components/common/check-box/CheckBox.d.ts +9 -0
- package/components/common/check-box/CheckBox.js +40 -0
- package/components/common/check-box/index.d.ts +2 -0
- package/components/common/description/DescList.cjs +1 -0
- package/components/common/description/DescList.d.ts +18 -0
- package/components/common/description/DescList.js +16 -0
- package/components/common/description/DescriptionComponent.d.ts +7 -0
- package/components/common/description/index.d.ts +3 -0
- package/components/common/index.d.ts +22 -0
- package/components/common/layout/VerticalSpace.cjs +1 -0
- package/components/common/layout/VerticalSpace.d.ts +5 -0
- package/components/common/layout/VerticalSpace.js +6 -0
- package/components/common/layout/index.d.ts +2 -0
- package/components/common/loading/LoadingIndicator.cjs +1 -0
- package/components/common/loading/LoadingIndicator.d.ts +6 -0
- package/components/common/loading/LoadingIndicator.js +24 -0
- package/components/common/loading/index.d.ts +2 -0
- package/components/common/picker/ImagePicker.cjs +1 -0
- package/components/common/picker/ImagePicker.d.ts +56 -0
- package/components/common/picker/ImagePicker.js +282 -0
- package/components/common/picker/index.d.ts +2 -0
- package/components/common/radio/RadioGroupComponent.cjs +1 -0
- package/components/common/radio/RadioGroupComponent.d.ts +18 -0
- package/components/common/radio/RadioGroupComponent.js +19 -0
- package/components/common/radio/index.d.ts +2 -0
- package/components/common/report/SelectFieldInReport.cjs +1 -0
- package/components/common/report/SelectFieldInReport.d.ts +16 -0
- package/components/common/report/SelectFieldInReport.js +30 -0
- package/components/common/report/index.d.ts +3 -0
- package/components/common/select/CustomSelectOption.cjs +1 -0
- package/components/common/select/CustomSelectOption.d.ts +7 -0
- package/components/common/select/CustomSelectOption.js +13 -0
- package/components/common/select/SelectComponent.cjs +1 -0
- package/components/common/select/SelectComponent.d.ts +21 -0
- package/components/common/select/SelectComponent.js +89 -0
- package/components/common/select/index.d.ts +3 -0
- package/components/common/show-more/index.cjs +1 -0
- package/components/common/show-more/index.d.ts +4 -0
- package/components/common/show-more/index.js +8 -0
- package/components/common/tab/TabViewWithRoute.cjs +1 -0
- package/components/common/tab/TabViewWithRoute.d.ts +13 -0
- package/components/common/tab/TabViewWithRoute.js +38 -0
- package/components/common/tab/index.d.ts +2 -0
- package/components/common/table/index.d.ts +3 -0
- package/components/common/table/table.cjs +1 -0
- package/components/common/table/table.d.ts +19 -0
- package/components/common/table/table.js +40 -0
- package/components/common/tag/StatusTag.cjs +1 -0
- package/components/common/tag/StatusTag.d.ts +14 -0
- package/components/common/tag/StatusTag.js +30 -0
- package/components/common/tag/index.d.ts +2 -0
- package/components/common/text/index.cjs +1 -0
- package/components/common/text/index.d.ts +3 -0
- package/components/common/text/index.js +5 -0
- package/components/common/text/title/TitleWithHeadTitle.d.ts +7 -0
- package/components/common/text/title/index.cjs +1 -0
- package/components/common/text/title/index.d.ts +1 -0
- package/components/common/text/title/index.js +5 -0
- package/components/common/text-field/NumberField.cjs +1 -0
- package/components/common/text-field/NumberField.d.ts +13 -0
- package/components/common/text-field/NumberField.js +83 -0
- package/components/common/text-field/PhoneNumberField.cjs +1 -0
- package/components/common/text-field/PhoneNumberField.d.ts +4 -0
- package/components/common/text-field/PhoneNumberField.js +18 -0
- package/components/common/text-field/TextArea.cjs +1 -0
- package/components/common/text-field/TextArea.d.ts +17 -0
- package/components/common/text-field/TextArea.js +47 -0
- package/components/common/text-field/TextField.cjs +1 -0
- package/components/common/text-field/TextField.d.ts +27 -0
- package/components/common/text-field/TextField.js +73 -0
- package/components/common/text-field/index.d.ts +5 -0
- package/components/common/tooltip/TooltipComponent.cjs +1 -0
- package/components/common/tooltip/TooltipComponent.d.ts +5 -0
- package/components/common/tooltip/TooltipComponent.js +9 -0
- package/components/common/tooltip/index.d.ts +2 -0
- package/components/common/wizard/WizardResult.cjs +1 -0
- package/components/common/wizard/WizardResult.d.ts +16 -0
- package/components/common/wizard/WizardResult.js +60 -0
- package/components/common/wizard/WizardViewForm.cjs +1 -0
- package/components/common/wizard/WizardViewForm.d.ts +24 -0
- package/components/common/wizard/WizardViewForm.js +74 -0
- package/components/common/wizard/index.d.ts +3 -0
- package/components/crud/CrudComponent.cjs +1 -0
- package/components/crud/CrudComponent.d.ts +237 -0
- package/components/crud/CrudComponent.js +210 -0
- package/components/crud/CrudField.cjs +1 -0
- package/components/crud/CrudField.d.ts +4 -0
- package/components/crud/CrudField.js +459 -0
- package/components/crud/CrudForm.cjs +1 -0
- package/components/crud/CrudForm.d.ts +14 -0
- package/components/crud/CrudForm.js +91 -0
- package/components/crud/CrudFormWizard.cjs +1 -0
- package/components/crud/CrudFormWizard.d.ts +14 -0
- package/components/crud/CrudFormWizard.js +140 -0
- package/components/crud/CrudReportComponent.cjs +4 -0
- package/components/crud/CrudReportComponent.d.ts +44 -0
- package/components/crud/CrudReportComponent.js +255 -0
- package/components/crud/CrudSearchComponent.cjs +1 -0
- package/components/crud/CrudSearchComponent.d.ts +21 -0
- package/components/crud/CrudSearchComponent.js +95 -0
- package/components/crud/FileCrudField.cjs +1 -0
- package/components/crud/FileCrudField.d.ts +25 -0
- package/components/crud/FileCrudField.js +220 -0
- package/components/crud/ImageCrudField.cjs +1 -0
- package/components/crud/ImageCrudField.d.ts +38 -0
- package/components/crud/ImageCrudField.js +113 -0
- package/components/crud/import/CrudImportButton.cjs +1 -0
- package/components/crud/import/CrudImportButton.d.ts +3 -0
- package/components/crud/import/CrudImportButton.js +31 -0
- package/components/crud/import/CrudImportComponent.cjs +2 -0
- package/components/crud/import/CrudImportComponent.d.ts +14 -0
- package/components/crud/import/CrudImportComponent.js +223 -0
- package/components/crud/index.d.ts +15 -0
- package/components/crud/view/CrudDecListView.cjs +1 -0
- package/components/crud/view/CrudDecListView.d.ts +14 -0
- package/components/crud/view/CrudDecListView.js +42 -0
- package/components/crud/view/CrudViewer.cjs +1 -0
- package/components/crud/view/CrudViewer.d.ts +43 -0
- package/components/crud/view/CrudViewer.js +217 -0
- package/components/crud/view/CrudViewerUtil.cjs +1 -0
- package/components/crud/view/CrudViewerUtil.d.ts +2 -0
- package/components/crud/view/CrudViewerUtil.js +57 -0
- package/components/crud/view/index.d.ts +5 -0
- package/index.cjs +1 -0
- package/index.d.ts +4 -0
- package/index.js +32 -0
- package/locale/hooks/translation-constants.cjs +1 -0
- package/locale/hooks/translation-constants.d.ts +1 -0
- package/locale/hooks/translation-constants.js +4 -0
- package/locale/index.cjs +1 -0
- package/locale/index.d.ts +74 -0
- package/locale/index.js +37 -0
- package/locale/translations/en.cjs +1 -0
- package/locale/translations/en.d.ts +58 -0
- package/locale/translations/en.js +60 -0
- package/main.d.ts +0 -0
- package/package.json +2 -2
- package/util/DateUtil.cjs +1 -0
- package/util/DateUtil.d.ts +7 -0
- package/util/DateUtil.js +6 -0
- package/util/ImageUtil.cjs +1 -0
- package/util/ImageUtil.d.ts +14 -0
- package/util/ImageUtil.js +63 -0
- package/util/NumberUtil.cjs +1 -0
- package/util/NumberUtil.d.ts +17 -0
- package/util/NumberUtil.js +60 -0
- package/util/ValidationUtil.cjs +1 -0
- package/util/ValidationUtil.d.ts +14 -0
- package/util/ValidationUtil.js +60 -0
- package/util/index.cjs +1 -0
- package/util/index.d.ts +4 -0
- package/util/index.js +10 -0
- package/vite-env.d.ts +1 -0
- package/README.md +0 -89
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),y=require("antd"),ae=require("dayjs"),o=require("react"),le=require("react-i18next"),ie=require("../../locale/hooks/translation-constants.cjs"),ce=require("./CrudForm.cjs"),re=require("./CrudFormWizard.cjs"),ue=require("./import/CrudImportButton.cjs"),de=require("./view/CrudViewer.cjs"),fe=require("../common/button/NewButton.cjs"),pe=require("../common/button/PrintButton.cjs"),{useForm:me}=y.Form;function ye({idField:C="id",onCreate:g,onDelete:M,onHide:_,onUpdate:f,fields:l,data:w,grid:D,isHiding:R,isCreating:h,isDeleting:U,isUpdating:q,paginateProps:W,onPrint:N,printing:L,viewable:H,loadingData:G,formBuilder:J,extraAction:K,minusHeight:Q,cloneable:X,fullWidthModal:Y=!0,wizard:i,extraView:Z,importable:P,onClickNew:V,...$}){const{t:v}=le.useTranslation(ie.TRANSLATION_NAMESPACE),[j,x]=o.useState(!1),[p,k]=o.useState(),[z,B]=o.useState(),[c]=me(),A=o.useCallback(async s=>{const u=i?s:await c.validateFields(),r=l.filter(e=>e.type==="color"),a={};r.forEach(e=>{var d;const t=c.getFieldValue(e.name);a[e.name]=typeof t=="string"?t:(d=t==null?void 0:t.toHexString())==null?void 0:d.toUpperCase()}),Object.assign(u,a),p&&f?(await f({...u,[C]:p[C]}),k(void 0)):!p&&g&&await g(u),B(void 0),c.resetFields(),x(!1)},[l,c,C,g,f,p,i]),[ee,I]=o.useState(!1),[te,S]=o.useState(!1);o.useEffect(()=>{j?(I(!1),S(!1)):F(void 0)},[j]);const O=o.useCallback(async s=>{I(s),S(!0)},[]),T=o.useCallback(async()=>{S(!0)},[]),[ne,E]=o.useState(!1),b=o.useCallback(async(s,u=!0,r=!1)=>{try{E(!0),x(!0),u&&F("update");const a={};for(const e of l){const t=s[e.name];if(r&&e.type==="image"){const d=t;try{const oe=await e.provider.clone(d);a[e.name]=oe;continue}catch{continue}}e.type==="date"?t&&(a[e.name]=ae(t)):e.type==="select"?e.multiple&&Array.isArray(t)?a[e.name]=t.map(d=>d[e.innerFieldId??"id"]):t&&typeof t=="object"?a[e.name]=t[e.innerFieldId??"id"]:(t&&typeof t=="string"||typeof t=="number")&&(a[e.name]=t):a[e.name]=t}c.setFieldsValue(a),B(a),u&&k(s)}finally{E(!1)}},[l,c]),[m,F]=o.useState(),se=o.useCallback(async s=>{F("clone"),b(s,!1,!0)},[b]);return n.jsxs(n.Fragment,{children:[n.jsxs(y.Space,{direction:"vertical",className:"w-100",children:[n.jsxs("div",{className:"w-100 d-flex",children:[n.jsx("div",{style:{flex:1},children:n.jsx(fe.NewButton,{onClick:()=>{V?V():(x(s=>!s),F("new"))},className:"flex-1"})}),n.jsxs(y.Space,{children:[!!N&&n.jsx(pe.PrintButton,{className:"float-right",loading:L,onClick:N}),!!P&&n.jsx(ue,{fields:l,importProps:P})]})]}),n.jsx(de,{...$,minusHeight:Q,data:w,fields:l,extraAction:K,idField:C,isDeleting:U,loadingData:G,onClickUpdate:f?b:void 0,onHide:_,isHiding:R,onDelete:M,onUpdate:f,onClickClone:X?se:void 0,paginateProps:W,viewable:H,extraView:Z})]}),n.jsx(y.Modal,{width:Y?"100%":void 0,title:v(m??"new"),open:j,confirmLoading:h||q,okText:v("str."+(m==="update"?"update":"save")),cancelText:v("str.cancel"),cancelButtonProps:{disabled:te,hidden:!!i},okButtonProps:{disabled:ee,hidden:!!i},onCancel:async()=>{try{if(m==="clone"){const s=i?p:c.getFieldsValue(),u=l.filter(r=>r.type==="image");for(const r of u)s[r.name]&&r.provider.delete(s[r.name])}}finally{}i||c.resetFields(),B(void 0),k(void 0),x(!1)},onOk:()=>A(),destroyOnClose:!0,children:n.jsxs(y.Spin,{spinning:ne,children:[!i&&n.jsx(ce.CrudForm,{purpose:m,fields:l,form:c,formBuilder:J,grid:D,onDeleteFile:T,onUploadFile:O}),i&&n.jsx(re,{submitting:h||q,className:"mt-2",onSave:A,updatingValue:z,fields:l,onDeleteFile:T,onUploadFile:O,purpose:m,wizard:i})]})})]})}module.exports=ye;
|
|
@@ -0,0 +1,237 @@
|
|
|
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 } from 'react';
|
|
6
|
+
import { default as IdProps } from 'types/Id';
|
|
7
|
+
import { CrudSearchComponentProps } from './CrudSearchComponent';
|
|
8
|
+
import { FileCrudField } from './FileCrudField';
|
|
9
|
+
import { ImageCrudField } from './ImageCrudField';
|
|
10
|
+
import { CrudImportProps } from './import/CrudImportComponent';
|
|
11
|
+
import { SelectTagRenderProps } from 'components/common/select/SelectComponent';
|
|
12
|
+
export type SelectFieldItem = {
|
|
13
|
+
key?: string | number;
|
|
14
|
+
value: string | number;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export interface InitialCrudField<T> {
|
|
18
|
+
label: string;
|
|
19
|
+
updatingValue?: T;
|
|
20
|
+
render?: (value: any, obj: T, index: number) => any;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
updatable?: boolean;
|
|
23
|
+
fieldTooltip?: string;
|
|
24
|
+
hideInTable?: boolean;
|
|
25
|
+
hideInDescList?: boolean;
|
|
26
|
+
readonly?: boolean;
|
|
27
|
+
fieldClassName?: string;
|
|
28
|
+
halign?: "right" | "left";
|
|
29
|
+
/**
|
|
30
|
+
* Indicates the fields is visible or not
|
|
31
|
+
*/
|
|
32
|
+
hidden?: boolean;
|
|
33
|
+
width?: number | string;
|
|
34
|
+
name: keyof T | (string | number)[];
|
|
35
|
+
rules?: Rule[];
|
|
36
|
+
grid?: CrudFieldGrid;
|
|
37
|
+
report?: {
|
|
38
|
+
searchable?: boolean;
|
|
39
|
+
sortable?: boolean;
|
|
40
|
+
defaultSort?: boolean | "ASC" | "DESC";
|
|
41
|
+
lock?: boolean;
|
|
42
|
+
alreadySelected?: boolean;
|
|
43
|
+
customRender?: (form: FormInstance<any>) => ReactElement;
|
|
44
|
+
};
|
|
45
|
+
customFormFieldRender?: (form: FormInstance<T>, props: InitialCrudField<T>) => React.ReactElement;
|
|
46
|
+
importProps?: {
|
|
47
|
+
extraFields?: string[];
|
|
48
|
+
hidden?: boolean;
|
|
49
|
+
};
|
|
50
|
+
hideLabel?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export type CrudFieldGrid = {
|
|
53
|
+
xs?: number;
|
|
54
|
+
sm?: number;
|
|
55
|
+
md?: number;
|
|
56
|
+
lg?: number;
|
|
57
|
+
xl?: number;
|
|
58
|
+
xxl?: number;
|
|
59
|
+
};
|
|
60
|
+
export interface SelectCrudField<T, ItemType extends SelectFieldItem = SelectFieldItem> extends InitialCrudField<T> {
|
|
61
|
+
type: "select";
|
|
62
|
+
placeholder?: string;
|
|
63
|
+
/**
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
allowClear?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Used when the type is 'select'
|
|
69
|
+
*/
|
|
70
|
+
innerFieldId?: string;
|
|
71
|
+
innerFieldLabel?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Used when the type is 'select'
|
|
74
|
+
*/
|
|
75
|
+
items: ItemType[];
|
|
76
|
+
tagRender?: SelectTagRenderProps;
|
|
77
|
+
/**
|
|
78
|
+
* Whether the search should be highlighted
|
|
79
|
+
*/
|
|
80
|
+
highlightSearch?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Used when the type is 'select'
|
|
83
|
+
*/
|
|
84
|
+
loading?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Used when the type is 'select'
|
|
87
|
+
*/
|
|
88
|
+
onSearch?: (keyword: any, form: FormInstance<T>, record: T | undefined) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Used when the type is 'select'. Wether the result should refresh if the search value is changed.
|
|
91
|
+
*/
|
|
92
|
+
searchOnType?: boolean;
|
|
93
|
+
multiple?: boolean;
|
|
94
|
+
report?: InitialCrudField<T>["report"] & {
|
|
95
|
+
multiple?: boolean;
|
|
96
|
+
};
|
|
97
|
+
onChange?: (value: any, form: FormInstance<T>) => void;
|
|
98
|
+
onSet?: (value: any | any[], items: SelectFieldItem[], form: FormInstance<T>) => void;
|
|
99
|
+
}
|
|
100
|
+
export interface EnumCrudField<T> extends InitialCrudField<T> {
|
|
101
|
+
type: "enum";
|
|
102
|
+
placeholder?: string;
|
|
103
|
+
enum: object | object[];
|
|
104
|
+
radio?: boolean;
|
|
105
|
+
translation?: object;
|
|
106
|
+
multiple?: boolean;
|
|
107
|
+
tagRender?: SelectTagRenderProps;
|
|
108
|
+
onChange?: (value: any, form: FormInstance<T>) => void;
|
|
109
|
+
onSearch?: (keyword: any, form: FormInstance<T>) => void;
|
|
110
|
+
}
|
|
111
|
+
export interface ObjectCrudField<T> extends InitialCrudField<T> {
|
|
112
|
+
type: "object";
|
|
113
|
+
render: (value: any, obj: T, index: number) => any;
|
|
114
|
+
translation?: object;
|
|
115
|
+
}
|
|
116
|
+
export interface TextBasedFieldProps<T> extends InitialCrudField<T> {
|
|
117
|
+
placeholder?: string;
|
|
118
|
+
type: "text" | "time" | "email" | "password";
|
|
119
|
+
onChange?: (value: string, form: FormInstance<T>) => void;
|
|
120
|
+
}
|
|
121
|
+
export interface TextAreaBasedFieldProps<T> extends InitialCrudField<T> {
|
|
122
|
+
placeholder?: string;
|
|
123
|
+
type: "textarea";
|
|
124
|
+
rows?: number;
|
|
125
|
+
cols?: number;
|
|
126
|
+
/**
|
|
127
|
+
* number of lines to show. If false will not show truncated
|
|
128
|
+
* @default 2
|
|
129
|
+
*/
|
|
130
|
+
truncated?: boolean | number;
|
|
131
|
+
onChange?: (value: string, form: FormInstance<T>) => void;
|
|
132
|
+
}
|
|
133
|
+
export interface ColorPickerFieldProps<T> extends Omit<InitialCrudField<T>, "placeholder"> {
|
|
134
|
+
type: "color";
|
|
135
|
+
innerProps?: ColorPickerProps;
|
|
136
|
+
}
|
|
137
|
+
export interface CheckboxBasedFieldProps<T> extends InitialCrudField<T> {
|
|
138
|
+
type: "checkbox";
|
|
139
|
+
onChange?: (value: boolean, form: FormInstance<T>) => void;
|
|
140
|
+
}
|
|
141
|
+
export interface NumberBasedFieldProps<T> extends InitialCrudField<T> {
|
|
142
|
+
type: "number";
|
|
143
|
+
placeholder?: string;
|
|
144
|
+
allowMinus?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* If it is number field making this true will convert the value to comma separated number field
|
|
147
|
+
*/
|
|
148
|
+
formatted?: boolean;
|
|
149
|
+
int?: boolean;
|
|
150
|
+
onChange?: (value: number, form: FormInstance<T>) => void;
|
|
151
|
+
}
|
|
152
|
+
export interface DateBasedFieldProps<T> extends InitialCrudField<T> {
|
|
153
|
+
type: "date";
|
|
154
|
+
format?: string;
|
|
155
|
+
placeholder?: string;
|
|
156
|
+
/**
|
|
157
|
+
* If it is number field making this true will convert the value to comma separated number field
|
|
158
|
+
*/
|
|
159
|
+
formatTime?: boolean;
|
|
160
|
+
range?: boolean;
|
|
161
|
+
disableToday?: boolean;
|
|
162
|
+
disabledFutureDays?: boolean;
|
|
163
|
+
disabledPastDays?: boolean;
|
|
164
|
+
report?: InitialCrudField<T>["report"] & {
|
|
165
|
+
range?: boolean;
|
|
166
|
+
required?: boolean;
|
|
167
|
+
};
|
|
168
|
+
onChange?: (value: Dayjs | undefined, form: FormInstance<T>) => void;
|
|
169
|
+
}
|
|
170
|
+
export interface TimeBasedFieldProps<T> extends InitialCrudField<T> {
|
|
171
|
+
type: "time";
|
|
172
|
+
placeholder?: string;
|
|
173
|
+
use12Hours?: boolean;
|
|
174
|
+
range?: boolean;
|
|
175
|
+
format?: "h:mm:ss" | "h:mm:ss A" | "h:mm" | "h:mm A" | "mm" | "h" | "h A";
|
|
176
|
+
disableCurrent?: boolean;
|
|
177
|
+
disabledFuture?: boolean;
|
|
178
|
+
disabledPast?: boolean;
|
|
179
|
+
report?: InitialCrudField<T>["report"] & {
|
|
180
|
+
range?: boolean;
|
|
181
|
+
};
|
|
182
|
+
onChange?: (value: Dayjs | undefined, form: FormInstance<T>) => void;
|
|
183
|
+
}
|
|
184
|
+
export type CrudPurpose = "new" | "clone" | "update";
|
|
185
|
+
export type GetFormFieldOptions = {
|
|
186
|
+
onChange?: (value: any) => void;
|
|
187
|
+
render?: (component: React.JSX.Element) => React.ReactElement;
|
|
188
|
+
};
|
|
189
|
+
export type FormBuilderFunc0<T> = (name: keyof T, options?: GetFormFieldOptions) => ReactElement;
|
|
190
|
+
export type FormBuilderFunc<T> = (i: FormBuilderFunc0<T>, otherUtils: {
|
|
191
|
+
isAnyFieldHidden: (...name: Array<keyof T>) => boolean;
|
|
192
|
+
isAllFieldsHidden: (...name: Array<keyof T>) => boolean;
|
|
193
|
+
}) => ReactElement;
|
|
194
|
+
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>;
|
|
195
|
+
export type CrudPaginateProps = false | {
|
|
196
|
+
page?: number;
|
|
197
|
+
setPage?: (page: number, pageSize?: number) => void;
|
|
198
|
+
pageSize?: number;
|
|
199
|
+
count?: number;
|
|
200
|
+
};
|
|
201
|
+
export type CrudWizardProp<T> = {
|
|
202
|
+
title: string;
|
|
203
|
+
fields: Array<keyof T>;
|
|
204
|
+
icon?: ReactElement;
|
|
205
|
+
formBuilder?: FormBuilderFunc<T>;
|
|
206
|
+
grid?: boolean;
|
|
207
|
+
};
|
|
208
|
+
export type CrudComponentProps<T, FormType = T> = {
|
|
209
|
+
fields: CrudFieldProps<T>[];
|
|
210
|
+
data: T[] | undefined;
|
|
211
|
+
idField?: string;
|
|
212
|
+
grid?: boolean;
|
|
213
|
+
onPrint?: () => void;
|
|
214
|
+
printing?: boolean;
|
|
215
|
+
onCreate?: (t: FormType) => Promise<any>;
|
|
216
|
+
onHide?: (id: any) => Promise<any>;
|
|
217
|
+
onDelete?: (id: any) => Promise<any>;
|
|
218
|
+
onUpdate?: (t: FormType & IdProps) => Promise<any>;
|
|
219
|
+
loadingData?: boolean;
|
|
220
|
+
isCreating?: boolean;
|
|
221
|
+
isHiding?: boolean;
|
|
222
|
+
isDeleting?: boolean;
|
|
223
|
+
isUpdating?: boolean;
|
|
224
|
+
viewable?: boolean | keyof T;
|
|
225
|
+
extraAction?: (t: T) => ReactElement;
|
|
226
|
+
paginateProps?: CrudPaginateProps;
|
|
227
|
+
formBuilder?: FormBuilderFunc<T>;
|
|
228
|
+
minusHeight?: string;
|
|
229
|
+
cloneable?: boolean;
|
|
230
|
+
fullWidthModal?: boolean;
|
|
231
|
+
wizard?: CrudWizardProp<T>[];
|
|
232
|
+
extraView?: (t: T) => React.ReactElement;
|
|
233
|
+
importable?: CrudImportProps<T>;
|
|
234
|
+
onClickNew?: () => void;
|
|
235
|
+
} & CrudSearchComponentProps<T, FormType>;
|
|
236
|
+
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, ...props }: CrudComponentProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
|
|
237
|
+
export default CrudComponent;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { jsxs as y, Fragment as se, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { Space as D, Modal as re, Spin as ce, Form as me } from "antd";
|
|
3
|
+
import fe from "dayjs";
|
|
4
|
+
import { useState as m, useCallback as F, useEffect as de } from "react";
|
|
5
|
+
import { useTranslation as ue } from "react-i18next";
|
|
6
|
+
import { TRANSLATION_NAMESPACE as pe } from "../../locale/hooks/translation-constants.js";
|
|
7
|
+
import { CrudForm as ye } from "./CrudForm.js";
|
|
8
|
+
import Fe from "./CrudFormWizard.js";
|
|
9
|
+
import ge from "./import/CrudImportButton.js";
|
|
10
|
+
import ve from "./view/CrudViewer.js";
|
|
11
|
+
import { NewButton as Ce } from "../common/button/NewButton.js";
|
|
12
|
+
import { PrintButton as Be } from "../common/button/PrintButton.js";
|
|
13
|
+
const { useForm: he } = me;
|
|
14
|
+
function Ie({
|
|
15
|
+
idField: g = "id",
|
|
16
|
+
onCreate: B,
|
|
17
|
+
onDelete: U,
|
|
18
|
+
onHide: W,
|
|
19
|
+
onUpdate: d,
|
|
20
|
+
fields: l,
|
|
21
|
+
data: w,
|
|
22
|
+
grid: L,
|
|
23
|
+
isHiding: H,
|
|
24
|
+
isCreating: V,
|
|
25
|
+
isDeleting: R,
|
|
26
|
+
isUpdating: P,
|
|
27
|
+
paginateProps: q,
|
|
28
|
+
onPrint: A,
|
|
29
|
+
printing: G,
|
|
30
|
+
viewable: J,
|
|
31
|
+
loadingData: K,
|
|
32
|
+
formBuilder: Q,
|
|
33
|
+
extraAction: X,
|
|
34
|
+
minusHeight: Y,
|
|
35
|
+
cloneable: Z,
|
|
36
|
+
fullWidthModal: $ = !0,
|
|
37
|
+
wizard: a,
|
|
38
|
+
extraView: z,
|
|
39
|
+
importable: j,
|
|
40
|
+
onClickNew: O,
|
|
41
|
+
...ee
|
|
42
|
+
}) {
|
|
43
|
+
const { t: h } = ue(pe), [k, v] = m(!1), [u, b] = m(), [te, x] = m(), [i] = he(), T = F(
|
|
44
|
+
async (o) => {
|
|
45
|
+
const r = a ? o : await i.validateFields(), s = l.filter((e) => e.type === "color"), n = {};
|
|
46
|
+
s.forEach((e) => {
|
|
47
|
+
var f;
|
|
48
|
+
const t = i.getFieldValue(e.name);
|
|
49
|
+
n[e.name] = typeof t == "string" ? t : (f = t == null ? void 0 : t.toHexString()) == null ? void 0 : f.toUpperCase();
|
|
50
|
+
}), Object.assign(r, n), u && d ? (await d({
|
|
51
|
+
...r,
|
|
52
|
+
[g]: u[g]
|
|
53
|
+
}), b(void 0)) : !u && B && await B(r), x(void 0), i.resetFields(), v(!1);
|
|
54
|
+
},
|
|
55
|
+
[l, i, g, B, d, u, a]
|
|
56
|
+
), [oe, E] = m(!1), [ne, S] = m(!1);
|
|
57
|
+
de(() => {
|
|
58
|
+
k ? (E(!1), S(!1)) : C(void 0);
|
|
59
|
+
}, [k]);
|
|
60
|
+
const I = F(async (o) => {
|
|
61
|
+
E(o), S(!0);
|
|
62
|
+
}, []), M = F(async () => {
|
|
63
|
+
S(!0);
|
|
64
|
+
}, []), [le, _] = m(!1), N = F(
|
|
65
|
+
async (o, r = !0, s = !1) => {
|
|
66
|
+
try {
|
|
67
|
+
_(!0), v(!0), r && C("update");
|
|
68
|
+
const n = {};
|
|
69
|
+
for (const e of l) {
|
|
70
|
+
const t = o[e.name];
|
|
71
|
+
if (s && e.type === "image") {
|
|
72
|
+
const f = t;
|
|
73
|
+
try {
|
|
74
|
+
const ie = await e.provider.clone(f);
|
|
75
|
+
n[e.name] = ie;
|
|
76
|
+
continue;
|
|
77
|
+
} catch {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
e.type === "date" ? t && (n[e.name] = fe(t)) : e.type === "select" ? e.multiple && Array.isArray(t) ? n[e.name] = t.map(
|
|
82
|
+
(f) => f[e.innerFieldId ?? "id"]
|
|
83
|
+
) : t && typeof t == "object" ? n[e.name] = t[e.innerFieldId ?? "id"] : (t && typeof t == "string" || typeof t == "number") && (n[e.name] = t) : n[e.name] = t;
|
|
84
|
+
}
|
|
85
|
+
i.setFieldsValue(n), x(n), r && b(o);
|
|
86
|
+
} finally {
|
|
87
|
+
_(!1);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
[l, i]
|
|
91
|
+
), [p, C] = m(), ae = F(
|
|
92
|
+
async (o) => {
|
|
93
|
+
C("clone"), N(o, !1, !0);
|
|
94
|
+
},
|
|
95
|
+
[N]
|
|
96
|
+
);
|
|
97
|
+
return /* @__PURE__ */ y(se, { children: [
|
|
98
|
+
/* @__PURE__ */ y(D, { direction: "vertical", className: "w-100", children: [
|
|
99
|
+
/* @__PURE__ */ y("div", { className: "w-100 d-flex", children: [
|
|
100
|
+
/* @__PURE__ */ c("div", { style: { flex: 1 }, children: /* @__PURE__ */ c(
|
|
101
|
+
Ce,
|
|
102
|
+
{
|
|
103
|
+
onClick: () => {
|
|
104
|
+
O ? O() : (v((o) => !o), C("new"));
|
|
105
|
+
},
|
|
106
|
+
className: "flex-1"
|
|
107
|
+
}
|
|
108
|
+
) }),
|
|
109
|
+
/* @__PURE__ */ y(D, { children: [
|
|
110
|
+
!!A && /* @__PURE__ */ c(
|
|
111
|
+
Be,
|
|
112
|
+
{
|
|
113
|
+
className: "float-right",
|
|
114
|
+
loading: G,
|
|
115
|
+
onClick: A
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
!!j && /* @__PURE__ */ c(ge, { fields: l, importProps: j })
|
|
119
|
+
] })
|
|
120
|
+
] }),
|
|
121
|
+
/* @__PURE__ */ c(
|
|
122
|
+
ve,
|
|
123
|
+
{
|
|
124
|
+
...ee,
|
|
125
|
+
minusHeight: Y,
|
|
126
|
+
data: w,
|
|
127
|
+
fields: l,
|
|
128
|
+
extraAction: X,
|
|
129
|
+
idField: g,
|
|
130
|
+
isDeleting: R,
|
|
131
|
+
loadingData: K,
|
|
132
|
+
onClickUpdate: d ? N : void 0,
|
|
133
|
+
onHide: W,
|
|
134
|
+
isHiding: H,
|
|
135
|
+
onDelete: U,
|
|
136
|
+
onUpdate: d,
|
|
137
|
+
onClickClone: Z ? ae : void 0,
|
|
138
|
+
paginateProps: q,
|
|
139
|
+
viewable: J,
|
|
140
|
+
extraView: z
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ c(
|
|
145
|
+
re,
|
|
146
|
+
{
|
|
147
|
+
width: $ ? "100%" : void 0,
|
|
148
|
+
title: h(p ?? "new"),
|
|
149
|
+
open: k,
|
|
150
|
+
confirmLoading: V || P,
|
|
151
|
+
okText: h("str." + (p === "update" ? "update" : "save")),
|
|
152
|
+
cancelText: h("str.cancel"),
|
|
153
|
+
cancelButtonProps: {
|
|
154
|
+
disabled: ne,
|
|
155
|
+
hidden: !!a
|
|
156
|
+
},
|
|
157
|
+
okButtonProps: {
|
|
158
|
+
disabled: oe,
|
|
159
|
+
hidden: !!a
|
|
160
|
+
},
|
|
161
|
+
onCancel: async () => {
|
|
162
|
+
try {
|
|
163
|
+
if (p === "clone") {
|
|
164
|
+
const o = a ? u : i.getFieldsValue(), r = l.filter((s) => s.type === "image");
|
|
165
|
+
for (const s of r)
|
|
166
|
+
o[s.name] && s.provider.delete(
|
|
167
|
+
o[s.name]
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
} finally {
|
|
171
|
+
}
|
|
172
|
+
a || i.resetFields(), x(void 0), b(void 0), v(!1);
|
|
173
|
+
},
|
|
174
|
+
onOk: () => T(),
|
|
175
|
+
destroyOnClose: !0,
|
|
176
|
+
children: /* @__PURE__ */ y(ce, { spinning: le, children: [
|
|
177
|
+
!a && /* @__PURE__ */ c(
|
|
178
|
+
ye,
|
|
179
|
+
{
|
|
180
|
+
purpose: p,
|
|
181
|
+
fields: l,
|
|
182
|
+
form: i,
|
|
183
|
+
formBuilder: Q,
|
|
184
|
+
grid: L,
|
|
185
|
+
onDeleteFile: M,
|
|
186
|
+
onUploadFile: I
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
a && /* @__PURE__ */ c(
|
|
190
|
+
Fe,
|
|
191
|
+
{
|
|
192
|
+
submitting: V || P,
|
|
193
|
+
className: "mt-2",
|
|
194
|
+
onSave: T,
|
|
195
|
+
updatingValue: te,
|
|
196
|
+
fields: l,
|
|
197
|
+
onDeleteFile: M,
|
|
198
|
+
onUploadFile: I,
|
|
199
|
+
purpose: p,
|
|
200
|
+
wizard: a
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] })
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
] });
|
|
207
|
+
}
|
|
208
|
+
export {
|
|
209
|
+
Ie as default
|
|
210
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),v=require("antd"),q=require("react"),D=require("react-highlight-words"),W=require("react-i18next"),G=require("../../locale/hooks/translation-constants.cjs"),$=require("./FileCrudField.cjs"),z=require("./ImageCrudField.cjs"),J=require("../common/DatePicker/DatePicker.cjs"),K=require("../common/DatePicker/TimePicker.cjs"),Q=require("../common/check-box/CheckBox.cjs"),L=require("../common/select/SelectComponent.cjs"),X=require("../common/text-field/NumberField.cjs"),Y=require("../common/text-field/TextField.cjs"),Z=require("../common/text-field/TextArea.cjs"),V=require("../common/tooltip/TooltipComponent.cjs");function ee(F){const{label:o,name:c,type:p,required:i,hidden:N,rules:m=[],updatable:h=!0,readonly:S=!1,fieldClassName:C,customFormFieldRender:w,fieldTooltip:b,...e}=F,g=v.Form.useFormInstance();q.useEffect(()=>{if(p==="select"){const{items:a=[],onSearch:n,searchOnType:l}=e;!(a!=null&&a.length)&&!l&&(n==null||n(void 0,g,e==null?void 0:e.updatingValue))}},[g,e,p,e==null?void 0:e.updatingValue]);const{t:T}=W.useTranslation(G.TRANSLATION_NAMESPACE);if(S||N)return t.jsx(t.Fragment,{});if(w)return w(g,F);switch(p){case"text":case"email":case"password":{const{onChange:a,placeholder:n}=e;return t.jsx(Y.default,{placeholder:n,disabled:!h,rules:m,required:i,onChange:a?l=>a(l,g):void 0,type:p,name:c,tooltip:b,label:o,className:C,autoComplete:"new-password"})}case"number":{const{onChange:a,placeholder:n,allowMinus:l}=e;return t.jsx(X,{placeholder:n,disabled:!h,moneyField:!!e.formatted,type:p,onChange:a?f=>a(f,g):void 0,rules:m,autoComplete:"false",required:i,tooltip:b,className:C,min:l?null:void 0,name:c,label:o})}case"date":{const{range:a,disableToday:n,disabledFutureDays:l,disabledPastDays:f,onChange:x,placeholder:u,format:y}=e;return t.jsx(J,{placeholder:u,required:i,disabled:!h,type:p,format:y,tooltip:b,range:a,name:c,label:o,onChange:x?s=>x(s,g):void 0,className:C,disableToday:n,disabledFutureDays:l,disabledPastDays:f})}case"time":{const{range:a=!1,disableCurrent:n,disabledFuture:l,disabledPast:f,onChange:x,use12Hours:u,format:y,placeholder:s}=e;return t.jsx(K,{placeholder:s,required:i,format:y,disabled:!h,type:p,tooltip:b,range:a,use12Hours:u,name:c,label:o,onChange:x?j=>x(j,g):void 0,className:C,disableCurrent:n,disabledFuture:l,disabledPast:f})}case"textarea":{const{onChange:a,placeholder:n,rows:l,cols:f}=e;return t.jsx(Z.default,{rules:m,placeholder:n,onChange:a?x=>{var u;return a((u=x==null?void 0:x.target)==null?void 0:u.value,g)}:void 0,tooltip:b,required:i,disabled:!h,name:c,label:o,className:C,rows:l,cols:f})}case"image":return t.jsx(z.default,{...e,required:i,name:c,label:o,rules:m,fieldClassName:C,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"file":return t.jsx($.default,{...e,required:i,name:c,label:o,rules:m,fieldClassName:C,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"select":return t.jsx(B,{...e,required:i,name:c,label:o,rules:m,fieldClassName:C,form:g,updatable:h,readonly:S,fieldTooltip:b});case"enum":{const{enum:a,radio:n=!1,translation:l,onChange:f,onSearch:x,multiple:u}=e,y=Array.isArray(a)?a:Object.keys(a);return n?t.jsx(v.Form.Item,{...e,name:c,required:i,tooltip:b,rules:m,label:o,className:["w-100",C].join(" "),children:t.jsx(v.Radio.Group,{...e,onChange:f?s=>{var j;return f((j=s==null?void 0:s.target)==null?void 0:j.value,g)}:void 0,children:y.map(s=>t.jsx(v.Radio,{disabled:!h,value:s,children:l?T(l[s]):s},s))})}):t.jsx(L,{...e,onChange:f?s=>f(s,g):void 0,className:["w-100",C].join(" "),name:c,items:y,required:i,tooltip:b,rules:m,label:o,disabled:!h,onSearch:x?s=>x(s,g):void 0,allowClear:!0,mode:u?"multiple":void 0,itemBuilder:s=>t.jsx(v.Select.Option,{value:s,children:l?T(l[s]):s},s)})}case"checkbox":{const{onChange:a}=e;return t.jsx(Q,{className:C,rules:m,onChange:a?n=>a(n,g):void 0,label:o,tooltip:b,disabled:!h,name:c})}case"color":return t.jsx(H,{...e,type:"color",required:i,name:c,label:o,rules:m,fieldClassName:C,updatable:h,readonly:S,fieldTooltip:b});default:return t.jsx(t.Fragment,{children:`${p} Not Implemented`})}}function B(F){const{items:o=[],loading:c,searchOnType:p,onSearch:i,multiple:N,onChange:m,highlightSearch:h,required:S,fieldClassName:C,rules:w,fieldTooltip:b,updatable:e,label:g,name:T,tagRender:a,updatingValue:n,onSet:l,placeholder:f,allowClear:x=!0}=F,u=F.form,[y,s]=q.useState(""),j=v.Form.useWatch(T,u),[k,O]=q.useState(!0);q.useEffect(()=>{l&&k&&j&&(l==null||l(j,o,u),O(!1))},[k,u,o,T,l,j]),q.useEffect(()=>{j&&O(!0)},[j]);const M=q.useCallback(async r=>{s(r),p&&(i==null||i(r,u,n))},[u,i,p,n]);return t.jsx(L,{...F,maxTagCount:"responsive",maxTagPlaceholder:r=>t.jsxs(V,{title:t.jsx(t.Fragment,{children:r.map(d=>t.jsxs(t.Fragment,{children:[d.label," ",t.jsx("br",{})]}))}),children:["+",r==null?void 0:r.length]}),placeholder:f,onSelect:r=>{l==null||l(r==null?void 0:r.key,o,u)},onChange:m?r=>{s(""),m(r,u)}:void 0,mode:N?"multiple":void 0,className:["w-100",C].join(" "),name:T,items:o,required:S,tooltip:b,tagRender:a,rules:w,disabled:!e,label:g,allowClear:x,onSearch:M,loading:c,filterOption:h?(r,d)=>{var R,P,A;try{const I=r.toLowerCase().split(/\s+/),U=((typeof(d==null?void 0:d.children)=="string"?d==null?void 0:d.children:(P=(R=d==null?void 0:d.children)==null?void 0:R.props)==null?void 0:P.textToHighlight)??"").toLowerCase(),_=(((A=d==null?void 0:d.value)==null?void 0:A.toString())??"").toLowerCase();return I.every(E=>U.indexOf(E)>=0||_.indexOf(E)>=0)}catch{return!0}}:void 0,itemBuilder:h?r=>{const d=r.value?String(r.value):void 0;return t.jsx(v.Select.Option,{value:r.key,title:d,disabled:r.disabled,children:t.jsx(D,{highlightClassName:"highlight-text",searchWords:(y??"").split(" "),autoEscape:!0,textToHighlight:d??""})},r.key)}:r=>t.jsx(v.Select.Option,{value:r.key,title:r.value,disabled:r.disabled,children:r.value},r.key)})}function H(F){const{required:o,fieldClassName:c,rules:p,fieldTooltip:i,updatable:N,label:m,name:h}=F;return t.jsx(v.Form.Item,{label:m,name:h,required:o,rules:p,tooltip:i,children:t.jsx(v.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:c,disabled:!N,...F.innerProps})})}exports.ColorCrudFieldComponent=H;exports.SelectCrudFieldComponent=B;exports.default=ee;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ColorPickerFieldProps, CrudFieldProps, SelectCrudField } from './CrudComponent';
|
|
2
|
+
export default function CrudField<T>(props0: CrudFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function SelectCrudFieldComponent<T>(props: SelectCrudField<T>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function ColorCrudFieldComponent<T>(props: ColorPickerFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|