react-table-edit 1.2.92 → 1.3.1
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/component/edit-form/index.d.ts +8 -6
- package/dist/component/select-table/index.d.ts +14 -15
- package/dist/component/table/index.d.ts +25 -22
- package/dist/index.d.ts +52 -52
- package/dist/index.js +2247 -1713
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2227 -1692
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ClipboardEvent, Dispatch, JSX, SetStateAction } from "react";
|
|
2
|
+
import { UseFormGetValues, UseFormReset, UseFormSetValue } from "react-hook-form";
|
|
1
3
|
import { InferType } from "yup";
|
|
2
4
|
export type FromItemsField = {
|
|
3
5
|
name: string;
|
|
@@ -13,8 +15,6 @@ type Props = {
|
|
|
13
15
|
id?: string;
|
|
14
16
|
field?: string;
|
|
15
17
|
displayValue: string;
|
|
16
|
-
onChange: any;
|
|
17
|
-
onPaste?: any;
|
|
18
18
|
textAlign?: 'left' | 'right' | 'center';
|
|
19
19
|
placeholder?: string;
|
|
20
20
|
invalid?: any;
|
|
@@ -26,10 +26,12 @@ type Props = {
|
|
|
26
26
|
onKeyDown?: any;
|
|
27
27
|
defaultValues?: any;
|
|
28
28
|
schema?: InferType<any>;
|
|
29
|
-
onFormOpen?: any;
|
|
30
|
-
onFormSubmit?: any;
|
|
31
|
-
footerTemplate?: any;
|
|
32
|
-
onChangeField?: any;
|
|
29
|
+
onFormOpen?: (rowData: any, itemsField: FromItemsField[], setItemsField: Dispatch<SetStateAction<FromItemsField[]>>) => void;
|
|
30
|
+
onFormSubmit?: (rowData: any, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>, reset: UseFormReset<any>) => void;
|
|
31
|
+
footerTemplate?: (rowData: any) => JSX.Element;
|
|
32
|
+
onChangeField?: (rowData: any, field: string, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>) => void;
|
|
33
|
+
onChange: (rowData: any) => void;
|
|
34
|
+
onPaste?: (e: ClipboardEvent<HTMLInputElement>) => void;
|
|
33
35
|
minWidth?: number;
|
|
34
36
|
openOnFocus?: boolean;
|
|
35
37
|
isClearable?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { JSX } from "react";
|
|
2
2
|
export type IFColumnSelectTable = {
|
|
3
3
|
field: string;
|
|
4
4
|
headerText: string;
|
|
@@ -23,24 +23,15 @@ export type IFTableSelectFormat = {
|
|
|
23
23
|
};
|
|
24
24
|
type Props = {
|
|
25
25
|
id?: string;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
value: any;
|
|
27
|
+
options: any[];
|
|
28
28
|
fieldValue?: string;
|
|
29
29
|
fieldLabel?: string;
|
|
30
|
-
onChange: any;
|
|
31
30
|
textAlign?: 'left' | 'right' | 'center';
|
|
32
31
|
placeholder?: string;
|
|
33
|
-
invalid?:
|
|
34
|
-
loadOptions?: any;
|
|
32
|
+
invalid?: boolean;
|
|
35
33
|
menuWidth?: number;
|
|
36
34
|
width?: number;
|
|
37
|
-
rowData?: any;
|
|
38
|
-
value: any;
|
|
39
|
-
onKeyDown?: any;
|
|
40
|
-
onOpenMenu?: any;
|
|
41
|
-
formatOptionLabel?: any;
|
|
42
|
-
handleAdd?: any;
|
|
43
|
-
options: any[];
|
|
44
35
|
isMulti?: boolean;
|
|
45
36
|
noHeader?: boolean;
|
|
46
37
|
maxHeight?: number;
|
|
@@ -49,9 +40,17 @@ type Props = {
|
|
|
49
40
|
isDisabled?: boolean;
|
|
50
41
|
allowCreate?: boolean;
|
|
51
42
|
showFooter?: boolean;
|
|
52
|
-
onPaste?: any;
|
|
53
|
-
onCloseMenu?: any;
|
|
54
43
|
formatSetting?: IFTableSelectFormat;
|
|
44
|
+
component?: string | HTMLElement | React.RefObject<HTMLElement> | undefined;
|
|
45
|
+
formatOptionLabel?: (ele: any) => JSX.Element;
|
|
46
|
+
loadOptions?: (keyword: string, callback: (rs: any[]) => void) => void;
|
|
47
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => any;
|
|
48
|
+
onOpenMenu?: () => void;
|
|
49
|
+
handleAdd?: (e?: any) => void;
|
|
50
|
+
onPaste?: (e: React.ClipboardEvent<HTMLInputElement>) => void;
|
|
51
|
+
onCloseMenu?: () => void;
|
|
52
|
+
footerComponent?: () => JSX.Element;
|
|
53
|
+
onChange: (val: any) => void;
|
|
55
54
|
};
|
|
56
55
|
declare const SelectTable: React.ForwardRefExoticComponent<Props & React.RefAttributes<unknown>>;
|
|
57
56
|
export { SelectTable };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Dispatch, ReactNode, SetStateAction } from "react";
|
|
1
|
+
import { Dispatch, JSX, ReactNode, SetStateAction } from "react";
|
|
2
|
+
import { FromItemsField } from "../edit-form";
|
|
2
3
|
import { IFColumnSelectTable } from "../select-table";
|
|
4
|
+
import { UseFormGetValues, UseFormReset, UseFormSetValue } from "react-hook-form";
|
|
3
5
|
type ITextAlign = 'center' | 'left' | 'right';
|
|
4
6
|
type IEditType = 'text' | 'numeric' | 'datetime' | 'selectTree' | 'date' | 'select' | 'checkbox' | 'form' | 'color';
|
|
5
7
|
export type ICommandItem = {
|
|
@@ -19,12 +21,13 @@ export type ISettingFormElement = {
|
|
|
19
21
|
menuWidth?: number;
|
|
20
22
|
menuHeight?: number;
|
|
21
23
|
displayValue?: any;
|
|
22
|
-
footerTemplate?: any;
|
|
23
24
|
openOnFocus?: boolean;
|
|
24
25
|
isClearable?: boolean;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
onFormOpen?: (rowData: any, itemsField: FromItemsField[], setItemsField: Dispatch<SetStateAction<FromItemsField[]>>) => void;
|
|
27
|
+
onFormSubmit?: (rowData: any, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>, reset: UseFormReset<any>) => void;
|
|
28
|
+
footerTemplate?: (rowData: any) => JSX.Element;
|
|
29
|
+
onChangeField?: (rowData: any, field: string, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>) => void;
|
|
30
|
+
onChange: (rowData: any) => JSX.Element;
|
|
28
31
|
};
|
|
29
32
|
export type ISettingSelectElement = {
|
|
30
33
|
isClearable?: boolean;
|
|
@@ -48,7 +51,7 @@ export type ISettingSelectElement = {
|
|
|
48
51
|
validateOption?: any;
|
|
49
52
|
optionsField?: string;
|
|
50
53
|
columns?: IFColumnSelectTable[];
|
|
51
|
-
onOpenMenu?: any;
|
|
54
|
+
onOpenMenu?: (row: any, col: IColumnTable, indexRow: number) => void;
|
|
52
55
|
};
|
|
53
56
|
export type ISettingNumericElement = {
|
|
54
57
|
min?: number;
|
|
@@ -63,9 +66,6 @@ export type IColumnTable = {
|
|
|
63
66
|
isUnikey?: boolean;
|
|
64
67
|
haveSum?: boolean;
|
|
65
68
|
haveToolTip?: boolean;
|
|
66
|
-
validate?: any;
|
|
67
|
-
disabledCondition?: any;
|
|
68
|
-
callback?: any;
|
|
69
69
|
width?: number | string;
|
|
70
70
|
minWidth?: number | string;
|
|
71
71
|
maxWidth?: number | string;
|
|
@@ -75,17 +75,20 @@ export type IColumnTable = {
|
|
|
75
75
|
editType?: IEditType;
|
|
76
76
|
textAlign?: ITextAlign;
|
|
77
77
|
fixedType?: 'left' | 'right' | undefined;
|
|
78
|
-
template?: any;
|
|
79
78
|
commandItems?: ICommandItem[];
|
|
80
|
-
editTypeCondition?: any;
|
|
81
|
-
onPaste?: any;
|
|
82
|
-
disablePaste?: any;
|
|
83
|
-
onPasteValidate?: any;
|
|
84
79
|
placeholder?: string;
|
|
85
80
|
numericSettings?: ISettingNumericElement;
|
|
86
81
|
selectSettings?: ISettingSelectElement;
|
|
87
82
|
formSettings?: ISettingFormElement;
|
|
88
83
|
columns?: IColumnTable[];
|
|
84
|
+
disablePaste?: boolean;
|
|
85
|
+
validate?: (value: any, row: any) => boolean;
|
|
86
|
+
disabledCondition?: (row: any) => boolean;
|
|
87
|
+
callback?: (value: any, indexRow: number) => void;
|
|
88
|
+
template?: (row: any, indexRow: number) => JSX.Element;
|
|
89
|
+
editTypeCondition?: (row: any) => string;
|
|
90
|
+
onPaste?: (dataRow: any, dataPaste: any) => void;
|
|
91
|
+
onPasteValidate?: (dataPaste: string, dataRow: any, rowIndex: number) => boolean;
|
|
89
92
|
};
|
|
90
93
|
export type IFTableEditPaging = {
|
|
91
94
|
allowPaging?: boolean;
|
|
@@ -131,16 +134,9 @@ export type IFTableEditProps = {
|
|
|
131
134
|
selectEnable?: boolean;
|
|
132
135
|
defaultValue?: any;
|
|
133
136
|
columns: IColumnTable[];
|
|
134
|
-
setDataSource?: any;
|
|
135
|
-
commandClick?: any;
|
|
136
|
-
rowChange?: any;
|
|
137
|
-
handleSelect?: any;
|
|
138
|
-
dataSourceChange?: any;
|
|
139
137
|
height?: number;
|
|
140
138
|
maxHeight?: number;
|
|
141
139
|
minHeight?: number;
|
|
142
|
-
selectedItem?: any;
|
|
143
|
-
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
144
140
|
isMulti?: boolean;
|
|
145
141
|
editDisable?: boolean;
|
|
146
142
|
addDisable?: boolean;
|
|
@@ -151,7 +147,14 @@ export type IFTableEditProps = {
|
|
|
151
147
|
buttonSetting?: IFTableEditButton;
|
|
152
148
|
toolbarSetting?: IFTableEditToolbar;
|
|
153
149
|
searchSetting?: IFTableEditSearchSetting;
|
|
154
|
-
|
|
150
|
+
selectedItem?: any;
|
|
151
|
+
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
152
|
+
commandClick?: (data: any) => void;
|
|
153
|
+
handleSelect?: (data: any) => void;
|
|
154
|
+
setDataSource?: (data: any[]) => void;
|
|
155
|
+
dataSourceChange?: (data: any[]) => void;
|
|
156
|
+
rowChange?: (row: any, indexRow: number, field: string) => void;
|
|
157
|
+
onDuplicate?: (newData: any, index: number) => void;
|
|
155
158
|
};
|
|
156
159
|
export type IFPageSize = {
|
|
157
160
|
pageSize: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { JSX, ReactNode, Dispatch, SetStateAction } from 'react';
|
|
3
|
+
import { UseFormSetValue, UseFormGetValues, UseFormReset, Control, UseFormWatch, FieldErrors } from 'react-hook-form';
|
|
3
4
|
import { TFunction } from 'react-i18next';
|
|
4
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
type FromItemsField = {
|
|
8
|
+
name: string;
|
|
9
|
+
label: string;
|
|
10
|
+
type: 'text' | 'numeric' | 'select' | 'selectCreatable';
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
fraction?: number;
|
|
13
|
+
min?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
options?: any[];
|
|
16
|
+
};
|
|
6
17
|
|
|
7
18
|
type IFColumnSelectTable = {
|
|
8
19
|
field: string;
|
|
@@ -28,24 +39,15 @@ type IFTableSelectFormat = {
|
|
|
28
39
|
};
|
|
29
40
|
type Props$1 = {
|
|
30
41
|
id?: string;
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
value: any;
|
|
43
|
+
options: any[];
|
|
33
44
|
fieldValue?: string;
|
|
34
45
|
fieldLabel?: string;
|
|
35
|
-
onChange: any;
|
|
36
46
|
textAlign?: 'left' | 'right' | 'center';
|
|
37
47
|
placeholder?: string;
|
|
38
|
-
invalid?:
|
|
39
|
-
loadOptions?: any;
|
|
48
|
+
invalid?: boolean;
|
|
40
49
|
menuWidth?: number;
|
|
41
50
|
width?: number;
|
|
42
|
-
rowData?: any;
|
|
43
|
-
value: any;
|
|
44
|
-
onKeyDown?: any;
|
|
45
|
-
onOpenMenu?: any;
|
|
46
|
-
formatOptionLabel?: any;
|
|
47
|
-
handleAdd?: any;
|
|
48
|
-
options: any[];
|
|
49
51
|
isMulti?: boolean;
|
|
50
52
|
noHeader?: boolean;
|
|
51
53
|
maxHeight?: number;
|
|
@@ -54,11 +56,19 @@ type Props$1 = {
|
|
|
54
56
|
isDisabled?: boolean;
|
|
55
57
|
allowCreate?: boolean;
|
|
56
58
|
showFooter?: boolean;
|
|
57
|
-
onPaste?: any;
|
|
58
|
-
onCloseMenu?: any;
|
|
59
59
|
formatSetting?: IFTableSelectFormat;
|
|
60
|
+
component?: string | HTMLElement | React__default.RefObject<HTMLElement> | undefined;
|
|
61
|
+
formatOptionLabel?: (ele: any) => JSX.Element;
|
|
62
|
+
loadOptions?: (keyword: string, callback: (rs: any[]) => void) => void;
|
|
63
|
+
onKeyDown?: (e: React__default.KeyboardEvent<HTMLInputElement>) => any;
|
|
64
|
+
onOpenMenu?: () => void;
|
|
65
|
+
handleAdd?: (e?: any) => void;
|
|
66
|
+
onPaste?: (e: React__default.ClipboardEvent<HTMLInputElement>) => void;
|
|
67
|
+
onCloseMenu?: () => void;
|
|
68
|
+
footerComponent?: () => JSX.Element;
|
|
69
|
+
onChange: (val: any) => void;
|
|
60
70
|
};
|
|
61
|
-
declare const SelectTable:
|
|
71
|
+
declare const SelectTable: React__default.ForwardRefExoticComponent<Props$1 & React__default.RefAttributes<unknown>>;
|
|
62
72
|
|
|
63
73
|
type ITextAlign = 'center' | 'left' | 'right';
|
|
64
74
|
type IEditType = 'text' | 'numeric' | 'datetime' | 'selectTree' | 'date' | 'select' | 'checkbox' | 'form' | 'color';
|
|
@@ -79,12 +89,13 @@ type ISettingFormElement = {
|
|
|
79
89
|
menuWidth?: number;
|
|
80
90
|
menuHeight?: number;
|
|
81
91
|
displayValue?: any;
|
|
82
|
-
footerTemplate?: any;
|
|
83
92
|
openOnFocus?: boolean;
|
|
84
93
|
isClearable?: boolean;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
onFormOpen?: (rowData: any, itemsField: FromItemsField[], setItemsField: Dispatch<SetStateAction<FromItemsField[]>>) => void;
|
|
95
|
+
onFormSubmit?: (rowData: any, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>, reset: UseFormReset<any>) => void;
|
|
96
|
+
footerTemplate?: (rowData: any) => JSX.Element;
|
|
97
|
+
onChangeField?: (rowData: any, field: string, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>) => void;
|
|
98
|
+
onChange: (rowData: any) => JSX.Element;
|
|
88
99
|
};
|
|
89
100
|
type ISettingSelectElement = {
|
|
90
101
|
isClearable?: boolean;
|
|
@@ -108,7 +119,7 @@ type ISettingSelectElement = {
|
|
|
108
119
|
validateOption?: any;
|
|
109
120
|
optionsField?: string;
|
|
110
121
|
columns?: IFColumnSelectTable[];
|
|
111
|
-
onOpenMenu?: any;
|
|
122
|
+
onOpenMenu?: (row: any, col: IColumnTable, indexRow: number) => void;
|
|
112
123
|
};
|
|
113
124
|
type ISettingNumericElement = {
|
|
114
125
|
min?: number;
|
|
@@ -123,9 +134,6 @@ type IColumnTable = {
|
|
|
123
134
|
isUnikey?: boolean;
|
|
124
135
|
haveSum?: boolean;
|
|
125
136
|
haveToolTip?: boolean;
|
|
126
|
-
validate?: any;
|
|
127
|
-
disabledCondition?: any;
|
|
128
|
-
callback?: any;
|
|
129
137
|
width?: number | string;
|
|
130
138
|
minWidth?: number | string;
|
|
131
139
|
maxWidth?: number | string;
|
|
@@ -135,17 +143,20 @@ type IColumnTable = {
|
|
|
135
143
|
editType?: IEditType;
|
|
136
144
|
textAlign?: ITextAlign;
|
|
137
145
|
fixedType?: 'left' | 'right' | undefined;
|
|
138
|
-
template?: any;
|
|
139
146
|
commandItems?: ICommandItem[];
|
|
140
|
-
editTypeCondition?: any;
|
|
141
|
-
onPaste?: any;
|
|
142
|
-
disablePaste?: any;
|
|
143
|
-
onPasteValidate?: any;
|
|
144
147
|
placeholder?: string;
|
|
145
148
|
numericSettings?: ISettingNumericElement;
|
|
146
149
|
selectSettings?: ISettingSelectElement;
|
|
147
150
|
formSettings?: ISettingFormElement;
|
|
148
151
|
columns?: IColumnTable[];
|
|
152
|
+
disablePaste?: boolean;
|
|
153
|
+
validate?: (value: any, row: any) => boolean;
|
|
154
|
+
disabledCondition?: (row: any) => boolean;
|
|
155
|
+
callback?: (value: any, indexRow: number) => void;
|
|
156
|
+
template?: (row: any, indexRow: number) => JSX.Element;
|
|
157
|
+
editTypeCondition?: (row: any) => string;
|
|
158
|
+
onPaste?: (dataRow: any, dataPaste: any) => void;
|
|
159
|
+
onPasteValidate?: (dataPaste: string, dataRow: any, rowIndex: number) => boolean;
|
|
149
160
|
};
|
|
150
161
|
type IFTableEditPaging = {
|
|
151
162
|
allowPaging?: boolean;
|
|
@@ -191,16 +202,9 @@ type IFTableEditProps = {
|
|
|
191
202
|
selectEnable?: boolean;
|
|
192
203
|
defaultValue?: any;
|
|
193
204
|
columns: IColumnTable[];
|
|
194
|
-
setDataSource?: any;
|
|
195
|
-
commandClick?: any;
|
|
196
|
-
rowChange?: any;
|
|
197
|
-
handleSelect?: any;
|
|
198
|
-
dataSourceChange?: any;
|
|
199
205
|
height?: number;
|
|
200
206
|
maxHeight?: number;
|
|
201
207
|
minHeight?: number;
|
|
202
|
-
selectedItem?: any;
|
|
203
|
-
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
204
208
|
isMulti?: boolean;
|
|
205
209
|
editDisable?: boolean;
|
|
206
210
|
addDisable?: boolean;
|
|
@@ -211,7 +215,14 @@ type IFTableEditProps = {
|
|
|
211
215
|
buttonSetting?: IFTableEditButton;
|
|
212
216
|
toolbarSetting?: IFTableEditToolbar;
|
|
213
217
|
searchSetting?: IFTableEditSearchSetting;
|
|
214
|
-
|
|
218
|
+
selectedItem?: any;
|
|
219
|
+
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
220
|
+
commandClick?: (data: any) => void;
|
|
221
|
+
handleSelect?: (data: any) => void;
|
|
222
|
+
setDataSource?: (data: any[]) => void;
|
|
223
|
+
dataSourceChange?: (data: any[]) => void;
|
|
224
|
+
rowChange?: (row: any, indexRow: number, field: string) => void;
|
|
225
|
+
onDuplicate?: (newData: any, index: number) => void;
|
|
215
226
|
};
|
|
216
227
|
type IFPageSize = {
|
|
217
228
|
pageSize: number;
|
|
@@ -239,18 +250,7 @@ type IHeaderColumnTable = {
|
|
|
239
250
|
fixedType?: 'left' | 'right' | undefined;
|
|
240
251
|
index?: number;
|
|
241
252
|
};
|
|
242
|
-
declare const TableEdit:
|
|
243
|
-
|
|
244
|
-
type FromItemsField = {
|
|
245
|
-
name: string;
|
|
246
|
-
label: string;
|
|
247
|
-
type: 'text' | 'numeric' | 'select' | 'selectCreatable';
|
|
248
|
-
disabled?: boolean;
|
|
249
|
-
fraction?: number;
|
|
250
|
-
min?: number;
|
|
251
|
-
max?: number;
|
|
252
|
-
options?: any[];
|
|
253
|
-
};
|
|
253
|
+
declare const TableEdit: React.ForwardRefExoticComponent<IFTableEditProps & React.RefAttributes<IFRef>>;
|
|
254
254
|
|
|
255
255
|
declare const messageHtmlBoxConfirm: (t: TFunction<"translation", undefined>, message: any[], handle: any, data: any, title?: string, btnOk?: string, btnCancel?: string) => void;
|
|
256
256
|
declare const messageHtmlBoxError: (t: TFunction<"translation", undefined>, message: any[], title?: string, btnCancel?: string) => void;
|
|
@@ -344,7 +344,7 @@ type Props = {
|
|
|
344
344
|
onOpenMenu?: any;
|
|
345
345
|
onPaste?: any;
|
|
346
346
|
};
|
|
347
|
-
declare const SelectTableTree:
|
|
347
|
+
declare const SelectTableTree: React__default.ForwardRefExoticComponent<Props & React__default.RefAttributes<unknown>>;
|
|
348
348
|
|
|
349
349
|
interface IFDataStyleSetting {
|
|
350
350
|
color: string;
|