react-table-edit 1.4.27 → 1.4.28

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.
@@ -1,6 +1,6 @@
1
1
  import { Control, FieldErrors, UseFormGetValues, UseFormSetValue, UseFormWatch } from 'react-hook-form';
2
2
  import { IFDataExcel } from './utils';
3
- import { IFNumberFormat } from './IType';
3
+ import { IFNumberFormat } from './type';
4
4
  export interface IFPropsDetail {
5
5
  control: Control<IFDataExcel>;
6
6
  watch: UseFormWatch<IFDataExcel>;
@@ -1,4 +1,4 @@
1
- import { IFNumberFormat } from './IType';
1
+ import { IFNumberFormat } from './type';
2
2
  export interface IFPropsDetail {
3
3
  dataError: any[];
4
4
  windowSize: any;
@@ -1,6 +1,6 @@
1
1
  import { Control, FieldErrors, UseFormGetValues, UseFormSetValue, UseFormWatch } from 'react-hook-form';
2
2
  import { IFDataExcel } from './utils';
3
- import { IFNumberFormat } from './IType';
3
+ import { IFNumberFormat } from './type';
4
4
  export interface IFPropsDetail {
5
5
  control: Control<IFDataExcel>;
6
6
  watch: UseFormWatch<IFDataExcel>;
@@ -1,4 +1,4 @@
1
- import { IFNumberFormat } from './IType';
1
+ import { IFNumberFormat } from './type';
2
2
  export interface IFPropsDetail {
3
3
  dataInvalid: any[];
4
4
  dataValid: any[];
@@ -0,0 +1,24 @@
1
+ export interface IFDataExcel {
2
+ step: number;
3
+ file?: any;
4
+ sheetId?: string;
5
+ headerRow?: number;
6
+ dataMap: IFDataMapExcel[];
7
+ }
8
+ export interface IFDataMapExcel {
9
+ field: string;
10
+ headerDefault: string[];
11
+ header: string;
12
+ dataType: 'numeric' | 'string' | 'date' | 'datetime' | 'boolean';
13
+ column?: string;
14
+ disableEdit?: boolean;
15
+ isRequired?: boolean;
16
+ }
17
+ export type IFNumberFormat = {
18
+ dateFormat?: string;
19
+ decimalSeparator?: string;
20
+ thousandSeparator?: string;
21
+ colorNegative?: string;
22
+ prefixNegative?: string;
23
+ suffixNegative?: string;
24
+ };
@@ -0,0 +1,22 @@
1
+ import { IColumnTable, IFTableEditFormat } from "../type";
2
+ type IContentColProps = {
3
+ col: IColumnTable;
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,6 @@
1
+ import { IColumnTable } from "../type";
2
+ type IFProps = {
3
+ contentColumns: IColumnTable[];
4
+ };
5
+ export declare const RenderColGroup: ({ contentColumns }: IFProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,32 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { IColumnTable, IFFilterTable, IFOrderTable, IFTableEditFormat } from "../type";
3
+ import 'react-resizable/css/styles.css';
4
+ type IFDataProps = {
5
+ idTable: string;
6
+ selectEnable: boolean;
7
+ dataSource: any[];
8
+ setSelectedRows: Dispatch<SetStateAction<any[]>>;
9
+ col: IColumnTable;
10
+ columns: IColumnTable[];
11
+ setColumns?: (columns: IColumnTable[]) => void;
12
+ changeFilter: (data: IFFilterTable[]) => void;
13
+ changeOrder: (data: IFOrderTable[]) => void;
14
+ indexCol: number;
15
+ indexParent: number;
16
+ objWidthFixLeft: any;
17
+ objWidthFixRight: any;
18
+ totalCount: number;
19
+ lastObjWidthFixLeft: number;
20
+ fisrtObjWidthFixRight: number;
21
+ selectedRows: any[];
22
+ isMulti: boolean;
23
+ allowFilter?: boolean;
24
+ allowOrder?: boolean;
25
+ filterBy: IFFilterTable[];
26
+ orderBy: IFOrderTable[];
27
+ container: any;
28
+ optionsFilter: any;
29
+ formatSetting?: IFTableEditFormat;
30
+ };
31
+ declare const HeaderTableCol: (props: IFDataProps) => import("react/jsx-runtime").JSX.Element;
32
+ export default HeaderTableCol;
@@ -0,0 +1,29 @@
1
+ import React, { Dispatch, SetStateAction } from 'react';
2
+ import { IColumnsAgg, IColumnTable, IFFilterTable, IFOrderTable, IFTableEditFormat, IFTableEditPaging, IFTableEditSearchSetting, IFTableEditToolbar } from '../type';
3
+ type TableViewProps = {
4
+ idTable: string;
5
+ dataSource: any[];
6
+ rowHeight?: number;
7
+ height?: number;
8
+ columns: IColumnTable[];
9
+ selectEnable?: boolean;
10
+ isMutil?: boolean;
11
+ isLoading?: boolean;
12
+ formatSetting?: IFTableEditFormat;
13
+ allowFilter?: boolean;
14
+ allowOrder?: boolean;
15
+ optionsFilter?: any;
16
+ pagingSetting?: IFTableEditPaging;
17
+ toolbarSetting?: IFTableEditToolbar;
18
+ searchSetting?: IFTableEditSearchSetting;
19
+ columnsAggregate?: IColumnsAgg[];
20
+ selectedItem?: any;
21
+ setSelectedItem?: Dispatch<SetStateAction<any>>;
22
+ setColumns?: (columns: IColumnTable[]) => void;
23
+ commandClick?: (data: any) => void;
24
+ changeFilter?: (data: IFFilterTable[]) => void;
25
+ changeOrder?: (data: IFOrderTable[]) => void;
26
+ handleSelect?: (data: any) => void;
27
+ };
28
+ declare const TableView: React.FC<TableViewProps>;
29
+ export { TableView };
@@ -0,0 +1,4 @@
1
+ export declare const SkeletonRow: ({ columns, rowHeight }: {
2
+ columns: number;
3
+ rowHeight: number;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -2,11 +2,14 @@ import { Dispatch, ReactNode, SetStateAction, JSX } from "react";
2
2
  import { UseFormGetValues, UseFormReset, UseFormSetValue } from "react-hook-form";
3
3
  /** Căn lề văn bản trong bảng */
4
4
  type ITextAlign = 'center' | 'left' | 'right';
5
- /** Loại chỉnh sửa của cột */
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 */
5
+ /**
6
+ * Loại cột hiển thị trong hệ thống.
7
+ *
8
+ * Lưu ý:
9
+ * - Các loại 'text', 'numeric', 'datetime' không được dùng cho view.
10
+ */
11
+ type IColumnType = '#' | 'command' | 'text' | 'numeric' | 'datetime' | 'date' | 'checkbox' | 'select' | 'form' | 'formInline' | 'color' | 'selectTree';
12
+ /** Loại lọc của cột */
10
13
  type IFilterType = 'text' | 'numeric' | 'date' | 'select';
11
14
  /** Cấu hình thao tác trên cột */
12
15
  export type ICommandItem = {
@@ -140,7 +143,7 @@ export type IColumnTable = {
140
143
  /** Không cho phép thay đổi trạng thái ẩn/hiện */
141
144
  invisibleDisable?: boolean;
142
145
  /** Kiểu chỉnh sửa */
143
- editType?: IEditType;
146
+ type?: IColumnType;
144
147
  /** Căn lề */
145
148
  textAlign?: ITextAlign;
146
149
  /** Cố định trái/phải */
@@ -174,11 +177,13 @@ export type IColumnTable = {
174
177
  /** Template hiển thị khi không ở chế độ edit */
175
178
  template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
176
179
  /** Xác định loại edit dựa trên điều kiện */
177
- editTypeCondition?: (row: any) => string;
180
+ typeCondition?: (row: any) => string;
178
181
  /** Sự kiện khi paste dữ liệu */
179
182
  onPaste?: (dataRow: any, dataPaste: any) => void;
180
183
  /** Xác thực dữ liệu được paste */
181
184
  onPasteValidate?: (dataPaste: string, dataRow: any, rowIndex: number) => Promise<any>;
185
+ /**Không có tác dụng */
186
+ rowspan?: number;
182
187
  };
183
188
  /** Cấu hình phân trang */
184
189
  export type IFTableEditPaging = {
@@ -297,7 +302,7 @@ export type IHeaderColumnTable = {
297
302
  /** Cấu hình cho kiểu numeric */
298
303
  numericSettings?: ISettingNumericElement;
299
304
  /** Kiểu chỉnh sửa */
300
- editType?: IEditType;
305
+ type?: IColumnType;
301
306
  /** Thứ tự cột */
302
307
  index?: number;
303
308
  };
@@ -359,55 +364,12 @@ export type FromItemsField = {
359
364
  /** Danh sách lựa chọn (chỉ áp dụng với loại 'select' và 'selectCreatable') */
360
365
  options?: any[];
361
366
  };
362
- export type IColumnsVirtualizedAgg = {
367
+ export type IColumnsAgg = {
363
368
  field: string;
364
369
  value: any;
365
370
  /** Kiểu xem cột */
366
371
  type?: string;
367
372
  };
368
- /** Định nghĩa cột bảng ciew ảo*/
369
- export type IColumnVirtualizedTable = {
370
- /** Tên thuộc tính */
371
- field: string;
372
- /** Tiêu đề hiển thị ở header */
373
- headerText?: string;
374
- /** Khóa chính */
375
- isPrimarykey?: boolean;
376
- /** Có tính tổng */
377
- haveSum?: boolean;
378
- /** Có tooltip */
379
- haveToolTip?: boolean;
380
- /** Chiều rộng cột */
381
- width?: number | string;
382
- /** Chiều rộng tối thiểu */
383
- minWidth?: number | string;
384
- /** Chiều rộng tối đa */
385
- maxWidth?: number | string;
386
- /** Có hiển thị không */
387
- visible?: boolean;
388
- /** Kiểu xem cột */
389
- type?: IViewType;
390
- /** Kiểu lọc cột */
391
- filterType?: IFilterType;
392
- /** Cho phép lọc cột */
393
- allowFilter?: boolean;
394
- /** Căn lề */
395
- textAlign?: ITextAlign;
396
- /** Cố định trái/phải */
397
- fixedType?: 'left' | 'right' | undefined;
398
- /** Danh sách thao tác */
399
- commandItems?: ICommandItem[];
400
- /** Cấu hình cho kiểu numeric */
401
- numericSettings?: ISettingNumericElement;
402
- /** Danh sách cột con */
403
- columns?: IColumnTable[];
404
- /** Điều kiện disable cột */
405
- disabledCondition?: (row: any) => boolean;
406
- /** Template hiển thị khi không ở chế độ edit */
407
- template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
408
- /** Số dòng chiếm (rowspan) */
409
- rowspan?: number;
410
- };
411
373
  export type IFOrderTable = {
412
374
  key: string;
413
375
  direction: 'asc' | 'desc';
@@ -30,7 +30,7 @@ export declare const FindNodeByPath: (tree: any[], path: string) => {
30
30
  * @param columns Mảng cấu trúc cây đại diện cho các cột của bảng
31
31
  * @returns {
32
32
  * levels: IHeaderColumnTable[][] // Các hàng header theo cấp
33
- * flat: IColumnVirtualizedTable[] // Danh sách cột phẳng
33
+ * flat: IColumnTable[] // Danh sách cột phẳng
34
34
  * objWidthFixLeft: Record<number, number> // Offset trái cho cột fixed left
35
35
  * objWidthFixRight: Record<number, number> // Offset phải cho cột fixed right
36
36
  * lastObjWidthFixLeft: number // Chỉ số cột cuối cùng fixed left
package/dist/index.d.ts CHANGED
@@ -6,11 +6,14 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
 
7
7
  /** Căn lề văn bản trong bảng */
8
8
  type ITextAlign = 'center' | 'left' | 'right';
9
- /** Loại chỉnh sửa của cột */
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 */
9
+ /**
10
+ * Loại cột hiển thị trong hệ thống.
11
+ *
12
+ * Lưu ý:
13
+ * - Các loại 'text', 'numeric', 'datetime' không được dùng cho view.
14
+ */
15
+ type IColumnType = '#' | 'command' | 'text' | 'numeric' | 'datetime' | 'date' | 'checkbox' | 'select' | 'form' | 'formInline' | 'color' | 'selectTree';
16
+ /** Loại lọc của cột */
14
17
  type IFilterType = 'text' | 'numeric' | 'date' | 'select';
15
18
  /** Cấu hình thao tác trên cột */
16
19
  type ICommandItem = {
@@ -144,7 +147,7 @@ type IColumnTable = {
144
147
  /** Không cho phép thay đổi trạng thái ẩn/hiện */
145
148
  invisibleDisable?: boolean;
146
149
  /** Kiểu chỉnh sửa */
147
- editType?: IEditType;
150
+ type?: IColumnType;
148
151
  /** Căn lề */
149
152
  textAlign?: ITextAlign;
150
153
  /** Cố định trái/phải */
@@ -178,11 +181,13 @@ type IColumnTable = {
178
181
  /** Template hiển thị khi không ở chế độ edit */
179
182
  template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
180
183
  /** Xác định loại edit dựa trên điều kiện */
181
- editTypeCondition?: (row: any) => string;
184
+ typeCondition?: (row: any) => string;
182
185
  /** Sự kiện khi paste dữ liệu */
183
186
  onPaste?: (dataRow: any, dataPaste: any) => void;
184
187
  /** Xác thực dữ liệu được paste */
185
188
  onPasteValidate?: (dataPaste: string, dataRow: any, rowIndex: number) => Promise<any>;
189
+ /**Không có tác dụng */
190
+ rowspan?: number;
186
191
  };
187
192
  /** Cấu hình phân trang */
188
193
  type IFTableEditPaging = {
@@ -301,7 +306,7 @@ type IHeaderColumnTable = {
301
306
  /** Cấu hình cho kiểu numeric */
302
307
  numericSettings?: ISettingNumericElement;
303
308
  /** Kiểu chỉnh sửa */
304
- editType?: IEditType;
309
+ type?: IColumnType;
305
310
  /** Thứ tự cột */
306
311
  index?: number;
307
312
  };
@@ -363,55 +368,12 @@ type FromItemsField = {
363
368
  /** Danh sách lựa chọn (chỉ áp dụng với loại 'select' và 'selectCreatable') */
364
369
  options?: any[];
365
370
  };
366
- type IColumnsVirtualizedAgg = {
371
+ type IColumnsAgg = {
367
372
  field: string;
368
373
  value: any;
369
374
  /** Kiểu xem cột */
370
375
  type?: string;
371
376
  };
372
- /** Định nghĩa cột bảng ciew ảo*/
373
- type IColumnVirtualizedTable = {
374
- /** Tên thuộc tính */
375
- field: string;
376
- /** Tiêu đề hiển thị ở header */
377
- headerText?: string;
378
- /** Khóa chính */
379
- isPrimarykey?: boolean;
380
- /** Có tính tổng */
381
- haveSum?: boolean;
382
- /** Có tooltip */
383
- haveToolTip?: boolean;
384
- /** Chiều rộng cột */
385
- width?: number | string;
386
- /** Chiều rộng tối thiểu */
387
- minWidth?: number | string;
388
- /** Chiều rộng tối đa */
389
- maxWidth?: number | string;
390
- /** Có hiển thị không */
391
- visible?: boolean;
392
- /** Kiểu xem cột */
393
- type?: IViewType;
394
- /** Kiểu lọc cột */
395
- filterType?: IFilterType;
396
- /** Cho phép lọc cột */
397
- allowFilter?: boolean;
398
- /** Căn lề */
399
- textAlign?: ITextAlign;
400
- /** Cố định trái/phải */
401
- fixedType?: 'left' | 'right' | undefined;
402
- /** Danh sách thao tác */
403
- commandItems?: ICommandItem[];
404
- /** Cấu hình cho kiểu numeric */
405
- numericSettings?: ISettingNumericElement;
406
- /** Danh sách cột con */
407
- columns?: IColumnTable[];
408
- /** Điều kiện disable cột */
409
- disabledCondition?: (row: any) => boolean;
410
- /** Template hiển thị khi không ở chế độ edit */
411
- template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
412
- /** Số dòng chiếm (rowspan) */
413
- rowspan?: number;
414
- };
415
377
  type IFOrderTable = {
416
378
  key: string;
417
379
  direction: 'asc' | 'desc';
@@ -501,7 +463,7 @@ declare const FindNodeByPath: (tree: any[], path: string) => {
501
463
  * @param columns Mảng cấu trúc cây đại diện cho các cột của bảng
502
464
  * @returns {
503
465
  * levels: IHeaderColumnTable[][] // Các hàng header theo cấp
504
- * flat: IColumnVirtualizedTable[] // Danh sách cột phẳng
466
+ * flat: IColumnTable[] // Danh sách cột phẳng
505
467
  * objWidthFixLeft: Record<number, number> // Offset trái cho cột fixed left
506
468
  * objWidthFixRight: Record<number, number> // Offset phải cho cột fixed right
507
469
  * lastObjWidthFixLeft: number // Chỉ số cột cuối cùng fixed left
@@ -729,12 +691,12 @@ type IFProps = {
729
691
  };
730
692
  declare const Wizard: React.ForwardRefExoticComponent<IFProps & React.RefAttributes<unknown>>;
731
693
 
732
- type VirtualTableProps = {
694
+ type TableViewProps = {
733
695
  idTable: string;
734
696
  dataSource: any[];
735
697
  rowHeight?: number;
736
698
  height?: number;
737
- columns: IColumnVirtualizedTable[];
699
+ columns: IColumnTable[];
738
700
  selectEnable?: boolean;
739
701
  isMutil?: boolean;
740
702
  isLoading?: boolean;
@@ -745,12 +707,15 @@ type VirtualTableProps = {
745
707
  pagingSetting?: IFTableEditPaging;
746
708
  toolbarSetting?: IFTableEditToolbar;
747
709
  searchSetting?: IFTableEditSearchSetting;
748
- columnsAggregate?: IColumnsVirtualizedAgg[];
749
- setColumns?: (columns: IColumnVirtualizedTable[]) => void;
710
+ columnsAggregate?: IColumnsAgg[];
711
+ selectedItem?: any;
712
+ setSelectedItem?: Dispatch<SetStateAction<any>>;
713
+ setColumns?: (columns: IColumnTable[]) => void;
750
714
  commandClick?: (data: any) => void;
751
715
  changeFilter?: (data: IFFilterTable[]) => void;
752
716
  changeOrder?: (data: IFOrderTable[]) => void;
717
+ handleSelect?: (data: any) => void;
753
718
  };
754
- declare const VirtualTable: React__default.FC<VirtualTableProps>;
719
+ declare const TableView: React__default.FC<TableViewProps>;
755
720
 
756
- 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 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, VirtualTable, Wizard, calculateTableStructure, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
721
+ export { ExportExcelComponent, FindNodeByPath, type FromItemsField, type IColumnTable, type IColumnsAgg, type ICommandItem, type IFColumnSelectTable, type IFColumnSelectTableTree, type IFCurrentPage, type IFCurrentPageConfig, type IFFilterTable, type IFOrderTable, 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, TableView, TabsMenuComponent, Wizard, calculateTableStructure, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };