react-table-edit 1.4.17 → 1.4.19
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/select-table/index.d.ts +1 -1
- package/dist/component/edit-form-inline/select-table/index.d.ts +1 -1
- package/dist/component/table/command.d.ts +1 -1
- package/dist/component/type/index.d.ts +65 -0
- package/dist/component/utils.d.ts +25 -0
- package/dist/component/virtualized-table/content.d.ts +22 -0
- package/dist/component/virtualized-table/group-col.d.ts +6 -0
- package/dist/component/virtualized-table/header.d.ts +30 -0
- package/dist/component/virtualized-table/index.d.ts +25 -0
- package/dist/component/virtualized-table/loading-item.d.ts +4 -0
- package/dist/index.d.ts +91 -1
- package/dist/index.js +212 -157
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +212 -158
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ type IFDataProps = {
|
|
|
5
5
|
rowData: any;
|
|
6
6
|
indexRow: number;
|
|
7
7
|
indexFocus?: number;
|
|
8
|
-
setIndexFocus
|
|
8
|
+
setIndexFocus?: Dispatch<SetStateAction<number>>;
|
|
9
9
|
handleCommandClick: any;
|
|
10
10
|
};
|
|
11
11
|
declare const CommandElement: (props: IFDataProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,6 +4,10 @@ import { UseFormGetValues, UseFormReset, UseFormSetValue } from "react-hook-form
|
|
|
4
4
|
type ITextAlign = 'center' | 'left' | 'right';
|
|
5
5
|
/** Loại chỉnh sửa của cột */
|
|
6
6
|
type IEditType = 'text' | 'numeric' | 'datetime' | 'selectTree' | 'date' | 'select' | 'checkbox' | 'form' | 'formInline' | 'color';
|
|
7
|
+
/** Loại hiển thị của cột */
|
|
8
|
+
type IViewType = 'text' | 'numeric' | 'datetime' | 'date' | 'checkbox' | '#' | 'command';
|
|
9
|
+
/** Loại loc của cột */
|
|
10
|
+
type IFilterType = 'text' | 'numeric' | 'date' | 'select';
|
|
7
11
|
/** Cấu hình thao tác trên cột */
|
|
8
12
|
export type ICommandItem = {
|
|
9
13
|
/** ID thao tác */
|
|
@@ -343,4 +347,65 @@ export type FromItemsField = {
|
|
|
343
347
|
/** Danh sách lựa chọn (chỉ áp dụng với loại 'select' và 'selectCreatable') */
|
|
344
348
|
options?: any[];
|
|
345
349
|
};
|
|
350
|
+
export type IColumnsVirtualizedAgg = {
|
|
351
|
+
field: string;
|
|
352
|
+
value: any;
|
|
353
|
+
/** Kiểu xem cột */
|
|
354
|
+
type?: string;
|
|
355
|
+
};
|
|
356
|
+
/** Định nghĩa cột bảng ciew ảo*/
|
|
357
|
+
export type IColumnVirtualizedTable = {
|
|
358
|
+
/** Tên thuộc tính */
|
|
359
|
+
field: string;
|
|
360
|
+
/** Tiêu đề hiển thị ở header */
|
|
361
|
+
headerText?: string;
|
|
362
|
+
/** Khóa chính */
|
|
363
|
+
isPrimarykey?: boolean;
|
|
364
|
+
/** Có tính tổng */
|
|
365
|
+
haveSum?: boolean;
|
|
366
|
+
/** Có tooltip */
|
|
367
|
+
haveToolTip?: boolean;
|
|
368
|
+
/** Chiều rộng cột */
|
|
369
|
+
width?: number | string;
|
|
370
|
+
/** Chiều rộng tối thiểu */
|
|
371
|
+
minWidth?: number | string;
|
|
372
|
+
/** Chiều rộng tối đa */
|
|
373
|
+
maxWidth?: number | string;
|
|
374
|
+
/** Có hiển thị không */
|
|
375
|
+
visible?: boolean;
|
|
376
|
+
/** Kiểu xem cột */
|
|
377
|
+
type?: IViewType;
|
|
378
|
+
settingFilter?: IFSettingFilterColumn;
|
|
379
|
+
/** Căn lề */
|
|
380
|
+
textAlign?: ITextAlign;
|
|
381
|
+
/** Cố định trái/phải */
|
|
382
|
+
fixedType?: 'left' | 'right' | undefined;
|
|
383
|
+
/** Danh sách thao tác */
|
|
384
|
+
commandItems?: ICommandItem[];
|
|
385
|
+
/** Cấu hình cho kiểu numeric */
|
|
386
|
+
numericSettings?: ISettingNumericElement;
|
|
387
|
+
/** Danh sách cột con */
|
|
388
|
+
columns?: IColumnTable[];
|
|
389
|
+
/** Điều kiện disable cột */
|
|
390
|
+
disabledCondition?: (row: any) => boolean;
|
|
391
|
+
/** Template hiển thị khi không ở chế độ edit */
|
|
392
|
+
template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
|
|
393
|
+
/** Số dòng chiếm (rowspan) */
|
|
394
|
+
rowspan?: number;
|
|
395
|
+
};
|
|
396
|
+
export type IFSettingFilterColumn = {
|
|
397
|
+
/** Kiểu lọc cột */
|
|
398
|
+
filterType?: IFilterType;
|
|
399
|
+
allowFilter?: boolean;
|
|
400
|
+
options: any[];
|
|
401
|
+
};
|
|
402
|
+
export type IFOrderTable = {
|
|
403
|
+
key: string;
|
|
404
|
+
direction: 'asc' | 'desc';
|
|
405
|
+
};
|
|
406
|
+
export type IFFilterTable = {
|
|
407
|
+
key: string;
|
|
408
|
+
value: any;
|
|
409
|
+
ope: 'startswith' | 'endswith' | 'contains' | 'equal' | 'notequal' | 'greaterthan' | 'greaterthanorequal' | 'lessthan' | 'lessthanorequal';
|
|
410
|
+
};
|
|
346
411
|
export {};
|
|
@@ -21,3 +21,28 @@ export declare const FindNodeByPath: (tree: any[], path: string) => {
|
|
|
21
21
|
firstIndex: number;
|
|
22
22
|
node: any;
|
|
23
23
|
} | null;
|
|
24
|
+
/**
|
|
25
|
+
* Tính toán cấu trúc bảng từ dữ liệu column dạng cây:
|
|
26
|
+
* - Tạo header dạng nhiều cấp (header theo chiều dọc)
|
|
27
|
+
* - Chuyển cột thành dạng phẳng để render nội dung
|
|
28
|
+
* - Tính toán vị trí cố định trái/phải (fixed column) để hiển thị sticky
|
|
29
|
+
*
|
|
30
|
+
* @param columns Mảng cấu trúc cây đại diện cho các cột của bảng
|
|
31
|
+
* @returns {
|
|
32
|
+
* levels: IHeaderColumnTable[][] // Các hàng header theo cấp
|
|
33
|
+
* flat: IColumnVirtualizedTable[] // Danh sách cột phẳng
|
|
34
|
+
* objWidthFixLeft: Record<number, number> // Offset trái cho cột fixed left
|
|
35
|
+
* objWidthFixRight: Record<number, number> // Offset phải cho cột fixed right
|
|
36
|
+
* lastObjWidthFixLeft: number // Chỉ số cột cuối cùng fixed left
|
|
37
|
+
* fisrtObjWidthFixRight: number // Chỉ số cột đầu tiên fixed right
|
|
38
|
+
* }
|
|
39
|
+
*/
|
|
40
|
+
export declare const calculateTableStructure: (columns: any[]) => {
|
|
41
|
+
levels: any[][];
|
|
42
|
+
flat: any[];
|
|
43
|
+
flatVisble: any[];
|
|
44
|
+
objWidthFixLeft: Record<number, number>;
|
|
45
|
+
objWidthFixRight: Record<number, number>;
|
|
46
|
+
lastObjWidthFixLeft: number;
|
|
47
|
+
fisrtObjWidthFixRight: number;
|
|
48
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IColumnVirtualizedTable, IFTableEditFormat } from "../type";
|
|
2
|
+
type IContentColProps = {
|
|
3
|
+
col: IColumnVirtualizedTable;
|
|
4
|
+
row: any;
|
|
5
|
+
indexRow: number;
|
|
6
|
+
indexCol: number;
|
|
7
|
+
isSelected: boolean;
|
|
8
|
+
formatSetting?: IFTableEditFormat;
|
|
9
|
+
idTable: string;
|
|
10
|
+
selectedRows: any[];
|
|
11
|
+
objWidthFixLeft: any;
|
|
12
|
+
objWidthFixRight: any;
|
|
13
|
+
lastObjWidthFixLeft: number;
|
|
14
|
+
fisrtObjWidthFixRight: number;
|
|
15
|
+
selectEnable?: boolean;
|
|
16
|
+
isMulti?: boolean;
|
|
17
|
+
fieldKey: string;
|
|
18
|
+
setSelectedRows: (value: any[]) => void;
|
|
19
|
+
handleCommandClick: (id: string, rowData: any, index: number) => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const RenderContentCol: (props: IContentColProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { IColumnVirtualizedTable, IFFilterTable, IFOrderTable, IFTableEditFormat } from "../type";
|
|
3
|
+
import 'react-resizable/css/styles.css';
|
|
4
|
+
type IFDataProps = {
|
|
5
|
+
selectEnable: boolean;
|
|
6
|
+
dataSource: any[];
|
|
7
|
+
setSelectedRows: Dispatch<SetStateAction<any[]>>;
|
|
8
|
+
col: IColumnVirtualizedTable;
|
|
9
|
+
columns: IColumnVirtualizedTable[];
|
|
10
|
+
setColumns?: (columns: IColumnVirtualizedTable[]) => void;
|
|
11
|
+
changeFilter: (data: IFFilterTable[]) => void;
|
|
12
|
+
changeOrder: (data: IFOrderTable[]) => void;
|
|
13
|
+
indexCol: number;
|
|
14
|
+
indexParent: number;
|
|
15
|
+
objWidthFixLeft: any;
|
|
16
|
+
objWidthFixRight: any;
|
|
17
|
+
totalCount: number;
|
|
18
|
+
lastObjWidthFixLeft: number;
|
|
19
|
+
fisrtObjWidthFixRight: number;
|
|
20
|
+
selectedRows: any[];
|
|
21
|
+
isMulti: boolean;
|
|
22
|
+
allowFilter?: boolean;
|
|
23
|
+
allowOrder?: boolean;
|
|
24
|
+
filterBy: IFFilterTable[];
|
|
25
|
+
orderBy: IFOrderTable[];
|
|
26
|
+
container: any;
|
|
27
|
+
formatSetting?: IFTableEditFormat;
|
|
28
|
+
};
|
|
29
|
+
declare const HeaderTableCol: (props: IFDataProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export default HeaderTableCol;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IColumnsVirtualizedAgg, IColumnVirtualizedTable, IFFilterTable, IFOrderTable, IFTableEditFormat, IFTableEditPaging, IFTableEditSearchSetting, IFTableEditToolbar } from '../type';
|
|
3
|
+
type VirtualTableProps = {
|
|
4
|
+
idTable: string;
|
|
5
|
+
dataSource: any[];
|
|
6
|
+
rowHeight?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
columns: IColumnVirtualizedTable[];
|
|
9
|
+
selectEnable?: boolean;
|
|
10
|
+
isMutil?: boolean;
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
formatSetting?: IFTableEditFormat;
|
|
13
|
+
allowFilter?: boolean;
|
|
14
|
+
allowOrder?: boolean;
|
|
15
|
+
pagingSetting?: IFTableEditPaging;
|
|
16
|
+
toolbarSetting?: IFTableEditToolbar;
|
|
17
|
+
searchSetting?: IFTableEditSearchSetting;
|
|
18
|
+
columnsAggregate?: IColumnsVirtualizedAgg[];
|
|
19
|
+
setColumns?: (columns: IColumnVirtualizedTable[]) => void;
|
|
20
|
+
commandClick?: (data: any) => void;
|
|
21
|
+
changeFilter?: (data: IFFilterTable[]) => void;
|
|
22
|
+
changeOrder?: (data: IFOrderTable[]) => void;
|
|
23
|
+
};
|
|
24
|
+
declare const VirtualTable: React.FC<VirtualTableProps>;
|
|
25
|
+
export default VirtualTable;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
8
8
|
type ITextAlign = 'center' | 'left' | 'right';
|
|
9
9
|
/** Loại chỉnh sửa của cột */
|
|
10
10
|
type IEditType = 'text' | 'numeric' | 'datetime' | 'selectTree' | 'date' | 'select' | 'checkbox' | 'form' | 'formInline' | 'color';
|
|
11
|
+
/** Loại hiển thị của cột */
|
|
12
|
+
type IViewType = 'text' | 'numeric' | 'datetime' | 'date' | 'checkbox' | '#' | 'command';
|
|
13
|
+
/** Loại loc của cột */
|
|
14
|
+
type IFilterType = 'text' | 'numeric' | 'date' | 'select';
|
|
11
15
|
/** Cấu hình thao tác trên cột */
|
|
12
16
|
type ICommandItem = {
|
|
13
17
|
/** ID thao tác */
|
|
@@ -347,6 +351,67 @@ type FromItemsField = {
|
|
|
347
351
|
/** Danh sách lựa chọn (chỉ áp dụng với loại 'select' và 'selectCreatable') */
|
|
348
352
|
options?: any[];
|
|
349
353
|
};
|
|
354
|
+
type IColumnsVirtualizedAgg = {
|
|
355
|
+
field: string;
|
|
356
|
+
value: any;
|
|
357
|
+
/** Kiểu xem cột */
|
|
358
|
+
type?: string;
|
|
359
|
+
};
|
|
360
|
+
/** Định nghĩa cột bảng ciew ảo*/
|
|
361
|
+
type IColumnVirtualizedTable = {
|
|
362
|
+
/** Tên thuộc tính */
|
|
363
|
+
field: string;
|
|
364
|
+
/** Tiêu đề hiển thị ở header */
|
|
365
|
+
headerText?: string;
|
|
366
|
+
/** Khóa chính */
|
|
367
|
+
isPrimarykey?: boolean;
|
|
368
|
+
/** Có tính tổng */
|
|
369
|
+
haveSum?: boolean;
|
|
370
|
+
/** Có tooltip */
|
|
371
|
+
haveToolTip?: boolean;
|
|
372
|
+
/** Chiều rộng cột */
|
|
373
|
+
width?: number | string;
|
|
374
|
+
/** Chiều rộng tối thiểu */
|
|
375
|
+
minWidth?: number | string;
|
|
376
|
+
/** Chiều rộng tối đa */
|
|
377
|
+
maxWidth?: number | string;
|
|
378
|
+
/** Có hiển thị không */
|
|
379
|
+
visible?: boolean;
|
|
380
|
+
/** Kiểu xem cột */
|
|
381
|
+
type?: IViewType;
|
|
382
|
+
settingFilter?: IFSettingFilterColumn;
|
|
383
|
+
/** Căn lề */
|
|
384
|
+
textAlign?: ITextAlign;
|
|
385
|
+
/** Cố định trái/phải */
|
|
386
|
+
fixedType?: 'left' | 'right' | undefined;
|
|
387
|
+
/** Danh sách thao tác */
|
|
388
|
+
commandItems?: ICommandItem[];
|
|
389
|
+
/** Cấu hình cho kiểu numeric */
|
|
390
|
+
numericSettings?: ISettingNumericElement;
|
|
391
|
+
/** Danh sách cột con */
|
|
392
|
+
columns?: IColumnTable[];
|
|
393
|
+
/** Điều kiện disable cột */
|
|
394
|
+
disabledCondition?: (row: any) => boolean;
|
|
395
|
+
/** Template hiển thị khi không ở chế độ edit */
|
|
396
|
+
template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
|
|
397
|
+
/** Số dòng chiếm (rowspan) */
|
|
398
|
+
rowspan?: number;
|
|
399
|
+
};
|
|
400
|
+
type IFSettingFilterColumn = {
|
|
401
|
+
/** Kiểu lọc cột */
|
|
402
|
+
filterType?: IFilterType;
|
|
403
|
+
allowFilter?: boolean;
|
|
404
|
+
options: any[];
|
|
405
|
+
};
|
|
406
|
+
type IFOrderTable = {
|
|
407
|
+
key: string;
|
|
408
|
+
direction: 'asc' | 'desc';
|
|
409
|
+
};
|
|
410
|
+
type IFFilterTable = {
|
|
411
|
+
key: string;
|
|
412
|
+
value: any;
|
|
413
|
+
ope: 'startswith' | 'endswith' | 'contains' | 'equal' | 'notequal' | 'greaterthan' | 'greaterthanorequal' | 'lessthan' | 'lessthanorequal';
|
|
414
|
+
};
|
|
350
415
|
|
|
351
416
|
type IFTableEditProps = {
|
|
352
417
|
idTable?: string;
|
|
@@ -415,6 +480,31 @@ declare const FindNodeByPath: (tree: any[], path: string) => {
|
|
|
415
480
|
firstIndex: number;
|
|
416
481
|
node: any;
|
|
417
482
|
} | null;
|
|
483
|
+
/**
|
|
484
|
+
* Tính toán cấu trúc bảng từ dữ liệu column dạng cây:
|
|
485
|
+
* - Tạo header dạng nhiều cấp (header theo chiều dọc)
|
|
486
|
+
* - Chuyển cột thành dạng phẳng để render nội dung
|
|
487
|
+
* - Tính toán vị trí cố định trái/phải (fixed column) để hiển thị sticky
|
|
488
|
+
*
|
|
489
|
+
* @param columns Mảng cấu trúc cây đại diện cho các cột của bảng
|
|
490
|
+
* @returns {
|
|
491
|
+
* levels: IHeaderColumnTable[][] // Các hàng header theo cấp
|
|
492
|
+
* flat: IColumnVirtualizedTable[] // Danh sách cột phẳng
|
|
493
|
+
* objWidthFixLeft: Record<number, number> // Offset trái cho cột fixed left
|
|
494
|
+
* objWidthFixRight: Record<number, number> // Offset phải cho cột fixed right
|
|
495
|
+
* lastObjWidthFixLeft: number // Chỉ số cột cuối cùng fixed left
|
|
496
|
+
* fisrtObjWidthFixRight: number // Chỉ số cột đầu tiên fixed right
|
|
497
|
+
* }
|
|
498
|
+
*/
|
|
499
|
+
declare const calculateTableStructure: (columns: any[]) => {
|
|
500
|
+
levels: any[][];
|
|
501
|
+
flat: any[];
|
|
502
|
+
flatVisble: any[];
|
|
503
|
+
objWidthFixLeft: Record<number, number>;
|
|
504
|
+
objWidthFixRight: Record<number, number>;
|
|
505
|
+
lastObjWidthFixLeft: number;
|
|
506
|
+
fisrtObjWidthFixRight: number;
|
|
507
|
+
};
|
|
418
508
|
|
|
419
509
|
type IFDataProps$1 = {
|
|
420
510
|
buttonWidth?: number;
|
|
@@ -623,4 +713,4 @@ type IFProps = {
|
|
|
623
713
|
};
|
|
624
714
|
declare const Wizard: React.ForwardRefExoticComponent<IFProps & React.RefAttributes<unknown>>;
|
|
625
715
|
|
|
626
|
-
export { ExportExcelComponent, FindNodeByPath, type FromItemsField, type IColumnTable, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFPageSize, type IFPropsDetail, type IFTableEditButton, type IFTableEditFormat, type IFTableEditPaging, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFTableSelectFormat, type IFTableTreeSelectFormat, type IFToolbarOptions, type IHeaderColumnTable, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, ImportExcelComponent, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, Wizard, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|
|
716
|
+
export { ExportExcelComponent, FindNodeByPath, type FromItemsField, type IColumnTable, type IColumnVirtualizedTable, type IColumnsVirtualizedAgg, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFFilterTable, type IFOrderTable, type IFPageSize, type IFPropsDetail, type IFSettingFilterColumn, type IFTableEditButton, type IFTableEditFormat, type IFTableEditPaging, type IFTableEditSearchSetting, type IFTableEditToolbar, type IFTableSelectFormat, type IFTableTreeSelectFormat, type IFToolbarOptions, type IHeaderColumnTable, type ISettingFormElement, type ISettingNumericElement, type ISettingSelectElement, ImportExcelComponent, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, Wizard, calculateTableStructure, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|