react-table-edit 1.4.37 → 1.4.38

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.
@@ -14,8 +14,6 @@ export type IFTableEditProps = {
14
14
  addDisable?: boolean;
15
15
  haveSum?: boolean;
16
16
  disableAutoKey?: boolean;
17
- isTree?: boolean;
18
- fieldChildren?: string;
19
17
  formatSetting?: IFTableEditFormat;
20
18
  pagingSetting?: IFTableEditPaging;
21
19
  buttonSetting?: IFTableEditButton;
@@ -26,6 +24,13 @@ export type IFTableEditProps = {
26
24
  allowFilter?: boolean;
27
25
  allowOrder?: boolean;
28
26
  optionsFilter?: any;
27
+ settingColumns?: {
28
+ field: string;
29
+ headerText?: string;
30
+ visible?: boolean;
31
+ fixedType?: "left" | "right";
32
+ width?: number | string;
33
+ }[];
29
34
  setSelectedItem?: Dispatch<SetStateAction<any>>;
30
35
  commandClick?: (data: any) => void;
31
36
  handleSelect?: (data: any) => void;
@@ -37,7 +37,13 @@ export declare const FindNodeByPath: (tree: any[], path: string) => {
37
37
  * fisrtObjWidthFixRight: number // Chỉ số cột đầu tiên fixed right
38
38
  * }
39
39
  */
40
- export declare const calculateTableStructure: (columns: any[]) => {
40
+ export declare const calculateTableStructure: (columns: any[], settingColumns?: {
41
+ field: string;
42
+ headerText?: string;
43
+ visible?: boolean;
44
+ fixedType?: "left" | "right";
45
+ width?: number | string;
46
+ }[]) => {
41
47
  levels: any[][];
42
48
  flat: any[];
43
49
  flatVisble: any[];
package/dist/index.d.ts CHANGED
@@ -402,8 +402,6 @@ type IFTableEditProps = {
402
402
  addDisable?: boolean;
403
403
  haveSum?: boolean;
404
404
  disableAutoKey?: boolean;
405
- isTree?: boolean;
406
- fieldChildren?: string;
407
405
  formatSetting?: IFTableEditFormat;
408
406
  pagingSetting?: IFTableEditPaging;
409
407
  buttonSetting?: IFTableEditButton;
@@ -414,6 +412,13 @@ type IFTableEditProps = {
414
412
  allowFilter?: boolean;
415
413
  allowOrder?: boolean;
416
414
  optionsFilter?: any;
415
+ settingColumns?: {
416
+ field: string;
417
+ headerText?: string;
418
+ visible?: boolean;
419
+ fixedType?: "left" | "right";
420
+ width?: number | string;
421
+ }[];
417
422
  setSelectedItem?: Dispatch<SetStateAction<any>>;
418
423
  commandClick?: (data: any) => void;
419
424
  handleSelect?: (data: any) => void;
@@ -481,7 +486,13 @@ declare const FindNodeByPath: (tree: any[], path: string) => {
481
486
  * fisrtObjWidthFixRight: number // Chỉ số cột đầu tiên fixed right
482
487
  * }
483
488
  */
484
- declare const calculateTableStructure: (columns: any[]) => {
489
+ declare const calculateTableStructure: (columns: any[], settingColumns?: {
490
+ field: string;
491
+ headerText?: string;
492
+ visible?: boolean;
493
+ fixedType?: "left" | "right";
494
+ width?: number | string;
495
+ }[]) => {
485
496
  levels: any[][];
486
497
  flat: any[];
487
498
  flatVisble: any[];
package/dist/index.js CHANGED
@@ -17682,7 +17682,7 @@ const FindNodeByPath = (tree, path) => {
17682
17682
  * fisrtObjWidthFixRight: number // Chỉ số cột đầu tiên fixed right
17683
17683
  * }
17684
17684
  */
17685
- const calculateTableStructure = (columns) => {
17685
+ const calculateTableStructure = (columns, settingColumns) => {
17686
17686
  const levels = [];
17687
17687
  const flat = [];
17688
17688
  const objWidthFixLeft = {};
@@ -17720,6 +17720,17 @@ const calculateTableStructure = (columns) => {
17720
17720
  colspan,
17721
17721
  rowspan: hasChildren ? 1 : maxDepth - level
17722
17722
  };
17723
+ if (settingColumns && settingColumns.length > 0) {
17724
+ const column = settingColumns.find((y) => y.field === cell.field);
17725
+ if (column) {
17726
+ cell.visible = column.visible;
17727
+ cell.fixedType = column.fixedType;
17728
+ cell.width = column.width;
17729
+ }
17730
+ else {
17731
+ cell.visible = false;
17732
+ }
17733
+ }
17723
17734
  levels[level].push(cell);
17724
17735
  const headerKey = `${level}-${indexCol}`;
17725
17736
  if (col.fixedType === "left" && col.visible !== false) {
@@ -42824,7 +42835,7 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
42824
42835
 
42825
42836
  const TableEdit = React$5.forwardRef((props, ref) => {
42826
42837
  const { t } = reactI18next.useTranslation();
42827
- const { idTable, dataSource, columns, pagingSetting, setDataSource, height, maxHeight, minHeight, defaultValue, toolbarSetting, searchSetting, selectedItem, selectEnable, editDisable, addDisable, buttonSetting, formatSetting, haveSum, isMulti, disableAutoKey, commandClick, dataSourceChange, rowChange, setSelectedItem, handleSelect, onDuplicate, saveSettingColumn, allowFilter = true, allowOrder, optionsFilter } = props;
42838
+ const { idTable, dataSource, columns, pagingSetting, setDataSource, height, maxHeight, minHeight, defaultValue, toolbarSetting, searchSetting, selectedItem, selectEnable, editDisable, addDisable, buttonSetting, formatSetting, haveSum, isMulti, disableAutoKey, commandClick, dataSourceChange, rowChange, setSelectedItem, handleSelect, onDuplicate, saveSettingColumn, allowFilter = true, allowOrder, settingColumns, optionsFilter } = props;
42828
42839
  React$5.useImperativeHandle(ref, () => {
42829
42840
  return {
42830
42841
  refeshFocusRow: handleRefeshRow
@@ -42851,8 +42862,8 @@ const TableEdit = React$5.forwardRef((props, ref) => {
42851
42862
  }
42852
42863
  }, [dataSource]);
42853
42864
  const { levels: headerColumns, flat: contentColumns, flatVisble, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, objHeaderWidthFixLeft, objHeaderWidthFixRight, indexFirstEdit: indexFirstEdit, indexLastEdit: indexLastEdit } = React$5.useMemo(() => {
42854
- return calculateTableStructure(columns);
42855
- }, [columns, refreshColumns]);
42865
+ return calculateTableStructure(columns, settingColumns);
42866
+ }, [columns, settingColumns, refreshColumns]);
42856
42867
  const handleRefeshRow = () => {
42857
42868
  setRefreshRow(true);
42858
42869
  setTimeout(() => {