react-table-edit 1.4.56 → 1.4.68
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/modal-import-excel/index.d.ts +2 -1
- package/dist/component/modal-import-excel/type.d.ts +2 -0
- package/dist/component/table/cell-content.d.ts +1 -1
- package/dist/component/table/cell.d.ts +1 -1
- package/dist/component/table/data-table.d.ts +1 -1
- package/dist/component/table/header.d.ts +4 -3
- package/dist/component/table/index.d.ts +6 -1
- package/dist/component/table/setting-column.d.ts +8 -1
- package/dist/component/type/index.d.ts +2 -0
- package/dist/index.d.ts +24 -14
- package/dist/index.js +1137 -231
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1136 -231
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +113 -58
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/sidebar.css +14 -0
- package/dist/styles/sidebar.css.map +1 -1
- package/package.json +4 -2
|
@@ -30,8 +30,9 @@ type IFProps = {
|
|
|
30
30
|
* @param item Dòng dữ liệu hiện tại
|
|
31
31
|
* @param ele Cấu hình mapping của cột
|
|
32
32
|
* @param value Giá trị trong cell
|
|
33
|
+
* @returns boolean: nếu trả ra true thì giá trị cho trường thì sẽ không được thiết lập lại
|
|
33
34
|
*/
|
|
34
|
-
handleValidate?: (item: any, ele: IFDataMapExcel, value: string) =>
|
|
35
|
+
handleValidate?: (item: any, ele: IFDataMapExcel, value: string) => boolean | undefined;
|
|
35
36
|
/**
|
|
36
37
|
* API import Excel
|
|
37
38
|
* @param params Tham số gửi lên server
|
|
@@ -22,6 +22,8 @@ export interface IFDataMapExcel {
|
|
|
22
22
|
isRequired?: boolean;
|
|
23
23
|
/** Độ rộng cột (pixel hoặc đơn vị tùy theo UI) */
|
|
24
24
|
width?: number;
|
|
25
|
+
/** Template hiển thị */
|
|
26
|
+
template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
|
|
25
27
|
}
|
|
26
28
|
export type IFNumberFormat = {
|
|
27
29
|
dateFormat?: string;
|
|
@@ -12,7 +12,7 @@ interface CellContentComponentProps {
|
|
|
12
12
|
typeDis: "edit" | "template" | "data";
|
|
13
13
|
displayValue: string | number | boolean | null | undefined;
|
|
14
14
|
content: any;
|
|
15
|
-
focusEditElementCell: (e: KeyboardEvent<any> | React.MouseEvent<HTMLDivElement, MouseEvent>, row: number, rol: number) => void;
|
|
15
|
+
focusEditElementCell: (e: KeyboardEvent<any> | React.MouseEvent<HTMLDivElement, MouseEvent>, row: number, rol: number, isOpenDropDown?: boolean) => void;
|
|
16
16
|
handleKeyDown: (e: React.KeyboardEvent<HTMLDivElement>, row: any) => void;
|
|
17
17
|
handleDataChange: (row: any, col: IColumnTable, indexRow: number) => void;
|
|
18
18
|
handleMouseDown: (e: React.MouseEvent, type: 1 | 2, isDragHandler?: boolean) => void;
|
|
@@ -46,7 +46,7 @@ interface CellComponentProps {
|
|
|
46
46
|
} | undefined>>;
|
|
47
47
|
setStartCell: Dispatch<SetStateAction<ICellInfo>>;
|
|
48
48
|
handeCopyCell: (indexColCopy: number, indexRowCopy: number, maxRowPaste: number) => Promise<void>;
|
|
49
|
-
focusEditElementCell: (e: KeyboardEvent<any> | React.MouseEvent<HTMLDivElement, MouseEvent>, row: number, rol: number) => void;
|
|
49
|
+
focusEditElementCell: (e: KeyboardEvent<any> | React.MouseEvent<HTMLDivElement, MouseEvent>, row: number, rol: number, isOpenDropDown?: boolean) => void;
|
|
50
50
|
rowChange?: (row: any, indexRow: number, field: string) => void;
|
|
51
51
|
handleDataChange: (row: any, col: IColumnTable, indexRow: number) => void;
|
|
52
52
|
changeDataSource: (data: any[]) => void;
|
|
@@ -49,6 +49,7 @@ interface TableComponentProps {
|
|
|
49
49
|
haveSum?: boolean;
|
|
50
50
|
rowChange?: (row: any, indexRow: number, field: string) => void;
|
|
51
51
|
setSelectedRows: Dispatch<SetStateAction<any[]>>;
|
|
52
|
+
setContentColumns: (col: any[]) => void;
|
|
52
53
|
handleDataChange: (row: any, col: IColumnTable, indexRow: number) => void;
|
|
53
54
|
changeDataSource: (newData: any[]) => void;
|
|
54
55
|
handleCommandClick: (id: string, rowData: any, index: number) => void;
|
|
@@ -60,7 +61,6 @@ interface TableComponentProps {
|
|
|
60
61
|
focusEditElementCell: (e: any, row: number, col: number) => void;
|
|
61
62
|
setFilterBy: (val: any[]) => void;
|
|
62
63
|
setOrderBy: (val: any[]) => void;
|
|
63
|
-
saveSettingColumn?: (cols: any[]) => void;
|
|
64
64
|
checkRowMatch: (row: any, filterBy: any[], searchTerm: string, keyField: string[]) => boolean;
|
|
65
65
|
handeCopyCell: (indexColCopy: number, indexRowCopy: number, maxRowPaste: number) => Promise<void>;
|
|
66
66
|
}
|
|
@@ -8,9 +8,6 @@ type IFDataProps = {
|
|
|
8
8
|
setSelectedRows: Dispatch<SetStateAction<any[]>>;
|
|
9
9
|
col: IHeaderColumnTable;
|
|
10
10
|
columns: IHeaderColumnTable[];
|
|
11
|
-
setColumns?: (columns: IHeaderColumnTable[]) => void;
|
|
12
|
-
changeFilter: (data: IFFilterTable[]) => void;
|
|
13
|
-
changeOrder: (data: IFOrderTable[]) => void;
|
|
14
11
|
indexCol: number;
|
|
15
12
|
indexParent: number;
|
|
16
13
|
objHeaderWidthFixLeft: any;
|
|
@@ -27,6 +24,10 @@ type IFDataProps = {
|
|
|
27
24
|
container: any;
|
|
28
25
|
optionsFilter: any;
|
|
29
26
|
formatSetting?: IFTableEditFormat;
|
|
27
|
+
setColumns?: (columns: IHeaderColumnTable[]) => void;
|
|
28
|
+
changeFilter: (data: IFFilterTable[]) => void;
|
|
29
|
+
setContentColumns: (col: any[]) => void;
|
|
30
|
+
changeOrder: (data: IFOrderTable[]) => void;
|
|
30
31
|
};
|
|
31
32
|
declare const HeaderTableCol: (props: IFDataProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
33
|
export default HeaderTableCol;
|
|
@@ -24,7 +24,12 @@ export type IFTableEditProps = {
|
|
|
24
24
|
allowFilter?: boolean;
|
|
25
25
|
allowOrder?: boolean;
|
|
26
26
|
optionsFilter?: any;
|
|
27
|
-
settingColumns?:
|
|
27
|
+
settingColumns?: {
|
|
28
|
+
id?: string;
|
|
29
|
+
updatedDate?: Date;
|
|
30
|
+
updatedByName?: string;
|
|
31
|
+
value: IFSettingColumns[];
|
|
32
|
+
};
|
|
28
33
|
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
29
34
|
commandClick?: (data: any) => void;
|
|
30
35
|
handleSelect?: (data: any) => void;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { IColumnTable } from "../type";
|
|
1
|
+
import { IColumnTable, IFSettingColumns } from "../type";
|
|
2
2
|
export interface IFPropsDetail {
|
|
3
|
+
gridRef: any;
|
|
3
4
|
column: IColumnTable[];
|
|
4
5
|
setColumn: any;
|
|
5
6
|
openSidebar: boolean;
|
|
7
|
+
settingColumns?: {
|
|
8
|
+
id?: string;
|
|
9
|
+
updatedDate?: Date;
|
|
10
|
+
updatedByName?: string;
|
|
11
|
+
value: IFSettingColumns[];
|
|
12
|
+
};
|
|
6
13
|
handleSidebar: any;
|
|
7
14
|
resetDefaultColumns?: () => void;
|
|
8
15
|
formatSetting?: any;
|
|
@@ -49,6 +49,8 @@ export type IFSettingColumns = {
|
|
|
49
49
|
fixedType?: "left" | "right";
|
|
50
50
|
/** Chiều rộng cột */
|
|
51
51
|
width?: number | string;
|
|
52
|
+
/** Sắp xếp */
|
|
53
|
+
sortOrder: number;
|
|
52
54
|
};
|
|
53
55
|
/** Cấu hình phần tử form khi dùng loại cột `form` */
|
|
54
56
|
export type ISettingFormElement = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { ReactNode, Dispatch, SetStateAction, JSX } from 'react';
|
|
2
|
+
import React__default, { ReactNode, Dispatch, SetStateAction, JSX as JSX$1 } from 'react';
|
|
3
3
|
import { UseFormSetValue, UseFormGetValues, UseFormReset } from 'react-hook-form';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { TFunction } from 'react-i18next';
|
|
@@ -53,6 +53,8 @@ type IFSettingColumns = {
|
|
|
53
53
|
fixedType?: "left" | "right";
|
|
54
54
|
/** Chiều rộng cột */
|
|
55
55
|
width?: number | string;
|
|
56
|
+
/** Sắp xếp */
|
|
57
|
+
sortOrder: number;
|
|
56
58
|
};
|
|
57
59
|
/** Cấu hình phần tử form khi dùng loại cột `form` */
|
|
58
60
|
type ISettingFormElement = {
|
|
@@ -75,7 +77,7 @@ type ISettingFormElement = {
|
|
|
75
77
|
/** Sự kiện submit form */
|
|
76
78
|
onFormSubmit?: (rowData: any, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>, reset: UseFormReset<any>) => void;
|
|
77
79
|
/** Footer tùy chỉnh trong form */
|
|
78
|
-
footerTemplate?: (rowData: any) => JSX.Element;
|
|
80
|
+
footerTemplate?: (rowData: any) => JSX$1.Element;
|
|
79
81
|
/** Sự kiện thay đổi trường dữ liệu */
|
|
80
82
|
onChangeField?: (rowData: any, field: string, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>) => void;
|
|
81
83
|
/** Sự kiện thay đổi form */
|
|
@@ -120,9 +122,9 @@ type ISettingSelectElement = {
|
|
|
120
122
|
/** Danh sách cột hiển thị trong bảng chọn */
|
|
121
123
|
columns?: IFColumnSelectTable[];
|
|
122
124
|
/** Tuỳ chỉnh hiển thị option */
|
|
123
|
-
formatOptionLabel?: (ele: any) => JSX.Element;
|
|
125
|
+
formatOptionLabel?: (ele: any) => JSX$1.Element;
|
|
124
126
|
/** Component footer trong menu chọn */
|
|
125
|
-
footerComponent?: () => JSX.Element;
|
|
127
|
+
footerComponent?: () => JSX$1.Element;
|
|
126
128
|
/** Load options động */
|
|
127
129
|
loadOptions?: (keyword: string, callback: (rs: any[]) => void) => void;
|
|
128
130
|
/** Sự kiện mở menu */
|
|
@@ -202,7 +204,7 @@ type IColumnTable = {
|
|
|
202
204
|
/** Callback khi thay đổi giá trị */
|
|
203
205
|
callback?: (value: any, indexRow: number, item: any) => void;
|
|
204
206
|
/** Template hiển thị khi không ở chế độ edit */
|
|
205
|
-
template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
|
|
207
|
+
template?: (row: any, indexRow: number) => JSX$1.Element | string | number | undefined;
|
|
206
208
|
/** Xác định loại edit dựa trên điều kiện */
|
|
207
209
|
typeCondition?: (row: any) => IColumnType;
|
|
208
210
|
/** Sự kiện khi paste dữ liệu */
|
|
@@ -435,7 +437,12 @@ type IFTableEditProps = {
|
|
|
435
437
|
allowFilter?: boolean;
|
|
436
438
|
allowOrder?: boolean;
|
|
437
439
|
optionsFilter?: any;
|
|
438
|
-
settingColumns?:
|
|
440
|
+
settingColumns?: {
|
|
441
|
+
id?: string;
|
|
442
|
+
updatedDate?: Date;
|
|
443
|
+
updatedByName?: string;
|
|
444
|
+
value: IFSettingColumns[];
|
|
445
|
+
};
|
|
439
446
|
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
440
447
|
commandClick?: (data: any) => void;
|
|
441
448
|
handleSelect?: (data: any) => void;
|
|
@@ -502,6 +509,8 @@ interface IFDataMapExcel {
|
|
|
502
509
|
isRequired?: boolean;
|
|
503
510
|
/** Độ rộng cột (pixel hoặc đơn vị tùy theo UI) */
|
|
504
511
|
width?: number;
|
|
512
|
+
/** Template hiển thị */
|
|
513
|
+
template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
|
|
505
514
|
}
|
|
506
515
|
type IFNumberFormat = {
|
|
507
516
|
dateFormat?: string;
|
|
@@ -542,8 +551,9 @@ type IFProps$1 = {
|
|
|
542
551
|
* @param item Dòng dữ liệu hiện tại
|
|
543
552
|
* @param ele Cấu hình mapping của cột
|
|
544
553
|
* @param value Giá trị trong cell
|
|
554
|
+
* @returns boolean: nếu trả ra true thì giá trị cho trường thì sẽ không được thiết lập lại
|
|
545
555
|
*/
|
|
546
|
-
handleValidate?: (item: any, ele: IFDataMapExcel, value: string) =>
|
|
556
|
+
handleValidate?: (item: any, ele: IFDataMapExcel, value: string) => boolean | undefined;
|
|
547
557
|
/**
|
|
548
558
|
* API import Excel
|
|
549
559
|
* @param params Tham số gửi lên server
|
|
@@ -600,14 +610,14 @@ type Props$1 = {
|
|
|
600
610
|
showFooter?: boolean;
|
|
601
611
|
formatSetting?: IFTableSelectFormat;
|
|
602
612
|
component?: string | HTMLElement | React__default.RefObject<HTMLElement> | undefined;
|
|
603
|
-
formatOptionLabel?: (ele: any) => JSX.Element;
|
|
613
|
+
formatOptionLabel?: (ele: any) => JSX$1.Element;
|
|
604
614
|
loadOptions?: (keyword: string, callback: (rs: any[]) => void) => void;
|
|
605
615
|
onKeyDown?: (e: React__default.KeyboardEvent<HTMLInputElement>) => any;
|
|
606
616
|
onOpenMenu?: () => void;
|
|
607
617
|
handleAdd?: (e?: any) => void;
|
|
608
618
|
onPaste?: (e: React__default.ClipboardEvent<HTMLInputElement>) => void;
|
|
609
619
|
onCloseMenu?: () => void;
|
|
610
|
-
footerComponent?: () => JSX.Element;
|
|
620
|
+
footerComponent?: () => JSX$1.Element;
|
|
611
621
|
onChange: (val: any) => void;
|
|
612
622
|
compareFunction?: (row?: any) => boolean | undefined;
|
|
613
623
|
};
|
|
@@ -764,10 +774,10 @@ declare const calculateTableStructure: (columns: any[], settingColumns?: IFSetti
|
|
|
764
774
|
|
|
765
775
|
type IFSteps = {
|
|
766
776
|
id: string;
|
|
767
|
-
content: JSX.Element;
|
|
768
|
-
subtitle?: JSX.Element | string;
|
|
769
|
-
title: JSX.Element | string;
|
|
770
|
-
icon?: JSX.Element | string;
|
|
777
|
+
content: JSX$1.Element;
|
|
778
|
+
subtitle?: JSX$1.Element | string;
|
|
779
|
+
title: JSX$1.Element | string;
|
|
780
|
+
icon?: JSX$1.Element | string;
|
|
771
781
|
done?: boolean;
|
|
772
782
|
loading?: boolean;
|
|
773
783
|
disable?: boolean;
|
|
@@ -784,7 +794,7 @@ type IFProps = {
|
|
|
784
794
|
heightContent?: number | string;
|
|
785
795
|
widthContent?: number | string;
|
|
786
796
|
type?: 'vertical' | 'horizontal' | 'modern-horizontal' | 'modern-vertical';
|
|
787
|
-
separator?: JSX.Element;
|
|
797
|
+
separator?: JSX$1.Element;
|
|
788
798
|
};
|
|
789
799
|
declare const Wizard: React.ForwardRefExoticComponent<IFProps & React.RefAttributes<unknown>>;
|
|
790
800
|
|