react-table-edit 1.5.44 → 1.5.46

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/index.mjs CHANGED
@@ -19807,20 +19807,17 @@ const isNullOrUndefined$1 = (d) => {
19807
19807
  const generateUUID = () => {
19808
19808
  // Public Domain/MIT
19809
19809
  let d = new Date().getTime(); //Timestamp
19810
- let d2 = (typeof performance !== 'undefined' &&
19811
- performance.now &&
19812
- performance.now() * 1000) ||
19813
- 0; //Time in microseconds since page-load or 0 if unsupported
19810
+ let d2 = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0; //Time in microseconds since page-load or 0 if unsupported
19814
19811
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
19815
19812
  let r = Math.random() * 16; //random number between 0 and 16
19816
19813
  if (d > 0) {
19817
19814
  //Use timestamp until depleted
19818
- r = ((d + r) % 16) | 0;
19815
+ r = (d + r) % 16 | 0;
19819
19816
  d = Math.floor(d / 16);
19820
19817
  }
19821
19818
  else {
19822
19819
  //Use microseconds since page-load if supported
19823
- r = ((d2 + r) % 16) | 0;
19820
+ r = (d2 + r) % 16 | 0;
19824
19821
  d2 = Math.floor(d2 / 16);
19825
19822
  }
19826
19823
  return (c === 'x' ? r : 0x3).toString(16);
@@ -19842,16 +19839,12 @@ const formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 2,
19842
19839
  // eslint-disable-next-line
19843
19840
  if (str || str == '0') {
19844
19841
  str = str.toString();
19845
- const value = decimalSeparator !== '.'
19846
- ? str.toString().replaceAll('.', decimalSeparator ?? '')
19847
- : str;
19842
+ const value = decimalSeparator !== '.' ? str.toString().replaceAll('.', decimalSeparator ?? '') : str;
19848
19843
  const arr = value.toString().split(decimalSeparator ?? '', 2);
19849
19844
  let flag = value.toString().includes(decimalSeparator ?? '');
19850
19845
  if (arr[0].length < 3) {
19851
19846
  const intergerArr = haveNegative ? arr[0] : arr[0].replace('-', '');
19852
- return flag
19853
- ? `${intergerArr}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ''}`
19854
- : intergerArr;
19847
+ return flag ? `${intergerArr}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ''}` : intergerArr;
19855
19848
  }
19856
19849
  else {
19857
19850
  let flagNegative = false;
@@ -19875,9 +19868,7 @@ const formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 2,
19875
19868
  if (flagNegative && haveNegative) {
19876
19869
  arr[0] = '-'.concat(arr[0]);
19877
19870
  }
19878
- return flag
19879
- ? `${arr[0]}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ''}`
19880
- : arr[0];
19871
+ return flag ? `${arr[0]}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ''}` : arr[0];
19881
19872
  }
19882
19873
  }
19883
19874
  else {
@@ -19900,7 +19891,7 @@ const formatDateTime = (data, format = 'dd/MM/yyyy') => {
19900
19891
  MM: String(date.getMonth() + 1).padStart(2, '0'),
19901
19892
  yyyy: date.getFullYear(),
19902
19893
  HH: String(date.getHours()).padStart(2, '0'),
19903
- mm: String(date.getMinutes()).padStart(2, '0'),
19894
+ mm: String(date.getMinutes()).padStart(2, '0')
19904
19895
  };
19905
19896
  return format.replace(/dd|DD|MM|yyyy|HH|mm/g, (match) => map[match]);
19906
19897
  };
@@ -19921,7 +19912,7 @@ const FindNodeByPath = (tree, path) => {
19921
19912
  parent: current,
19922
19913
  lastIndex: levels.at(-1),
19923
19914
  firstIndex: levels.length === 1 ? levels[0] : -1,
19924
- node,
19915
+ node
19925
19916
  };
19926
19917
  };
19927
19918
  /**
@@ -19949,7 +19940,7 @@ const calculateTableStructure = (columns, settingColumns, groupColumns) => {
19949
19940
  const objHeaderWidthFixLeft = {};
19950
19941
  let maxDepth = 0;
19951
19942
  // Tính depth tối đa
19952
- const calculateDepth = (cols, depth = 1) => Math.max(...cols.map((col) => col.columns?.length ? calculateDepth(col.columns, depth + 1) : depth));
19943
+ const calculateDepth = (cols, depth = 1) => Math.max(...cols.map((col) => (col.columns?.length ? calculateDepth(col.columns, depth + 1) : depth)));
19953
19944
  maxDepth = calculateDepth(columns);
19954
19945
  let leftTotal = 0;
19955
19946
  let rightTotal = 0;
@@ -19987,8 +19978,7 @@ const calculateTableStructure = (columns, settingColumns, groupColumns) => {
19987
19978
  newCell.numericSettings = { fraction: setting.fraction };
19988
19979
  }
19989
19980
  }
19990
- newCell.headerDisplay =
19991
- setting.headerText || (newCell.headerDisplay ?? newCell.headerText);
19981
+ newCell.headerDisplay = setting.headerText || (newCell.headerDisplay ?? newCell.headerText);
19992
19982
  }
19993
19983
  else {
19994
19984
  if (newCell.columns?.length) {
@@ -20024,13 +20014,11 @@ const calculateTableStructure = (columns, settingColumns, groupColumns) => {
20024
20014
  ...col,
20025
20015
  columns: col.columns ?? [],
20026
20016
  colspan,
20027
- rowspan: hasChildren ? 1 : maxDepth - level,
20017
+ rowspan: hasChildren ? 1 : maxDepth - level
20028
20018
  };
20029
20019
  levels[level].push(cell);
20030
20020
  const headerKey = `${level}-${indexCol}`;
20031
- if (cell.fixedType === 'left' &&
20032
- cell.visible !== false &&
20033
- cell.isGroup !== true) {
20021
+ if (cell.fixedType === 'left' && cell.visible !== false && cell.isGroup !== true) {
20034
20022
  objHeaderWidthFixLeft[headerKey] = leftTotal;
20035
20023
  }
20036
20024
  if (!hasChildren) {
@@ -20038,48 +20026,33 @@ const calculateTableStructure = (columns, settingColumns, groupColumns) => {
20038
20026
  const width = cell.width ?? 40;
20039
20027
  cell.index = index;
20040
20028
  flat.push(cell);
20041
- if (cell.fixedType === 'left' &&
20042
- cell.visible !== false &&
20043
- cell.isGroup !== true) {
20029
+ if (cell.fixedType === 'left' && cell.visible !== false && cell.isGroup !== true) {
20044
20030
  objWidthFixLeft[index] = leftTotal;
20045
20031
  leftTotal += width;
20046
20032
  }
20047
- if (cell.fixedType === 'right' &&
20048
- cell.visible !== false &&
20049
- cell.isGroup !== true) {
20033
+ if (cell.fixedType === 'right' && cell.visible !== false && cell.isGroup !== true) {
20050
20034
  rightTotal -= width;
20051
20035
  objWidthFixRight[index] = rightTotal;
20052
20036
  }
20053
20037
  }
20054
- if (cell.fixedType === 'right' &&
20055
- cell.visible !== false &&
20056
- cell.isGroup !== true) {
20038
+ if (cell.fixedType === 'right' && cell.visible !== false && cell.isGroup !== true) {
20057
20039
  objHeaderWidthFixRight[headerKey] = rightTotal;
20058
20040
  }
20059
20041
  return colspanSum + colspan;
20060
20042
  }, 0);
20061
20043
  };
20062
20044
  calcTotalRightWidth(columns);
20063
- if ((settingColumns?.length ?? 0) > 0) {
20064
- applySetting(columns);
20065
- }
20066
- traverse(columns);
20045
+ const newColumns = (settingColumns?.length ?? 0) > 0 ? applySetting(columns) : columns;
20046
+ traverse(newColumns);
20067
20047
  // Danh sách các cột được hiển thị
20068
20048
  // const flatVisble = flat.filter((e) => e.visible !== false)
20069
- const flatVisbleContent = flat.filter((x) => x.visible !== false &&
20070
- x.field !== 'command' &&
20071
- x.field !== '#' &&
20072
- x.field !== 'checkbox');
20049
+ const flatVisbleContent = flat.filter((x) => x.visible !== false && x.field !== 'command' && x.field !== '#' && x.field !== 'checkbox');
20073
20050
  // Tính toán vị trí đầu tiên và cuối cùng của các cột cố định
20074
20051
  const lastObjWidthFixLeft = Math.max(...Object.keys(objWidthFixLeft).map(Number), 0);
20075
20052
  const fisrtObjWidthFixRight = Math.min(...Object.keys(objWidthFixRight).map(Number), flat.length);
20076
20053
  // Tính toán vị trí đầu tiên và cuối cùng của các cột có thể sửa
20077
20054
  const indexFirstEdit = flat.findIndex((item) => item.editEnable && item.visible !== false && !item.disabledCondition);
20078
- const indexLastEdit = flat
20079
- .map((item, idx) => item.editEnable && item.visible !== false && !item.disabledCondition
20080
- ? idx
20081
- : -1)
20082
- .reduce((acc, val) => (val > acc ? val : acc), -1);
20055
+ const indexLastEdit = flat.map((item, idx) => (item.editEnable && item.visible !== false && !item.disabledCondition ? idx : -1)).reduce((acc, val) => (val > acc ? val : acc), -1);
20083
20056
  return {
20084
20057
  levels,
20085
20058
  flat,
@@ -20092,7 +20065,7 @@ const calculateTableStructure = (columns, settingColumns, groupColumns) => {
20092
20065
  objHeaderWidthFixRight,
20093
20066
  objHeaderWidthFixLeft,
20094
20067
  indexFirstEdit,
20095
- indexLastEdit,
20068
+ indexLastEdit
20096
20069
  };
20097
20070
  };
20098
20071
  /**
@@ -20102,10 +20075,7 @@ const CheckRowMatch = (row, filters, keyword, searchKeys) => {
20102
20075
  const isFilterMatch = filters.every((filter) => {
20103
20076
  const { key, value, ope } = filter;
20104
20077
  const rowValue = row[key];
20105
- if (rowValue === undefined ||
20106
- rowValue === null ||
20107
- value === undefined ||
20108
- value === null) {
20078
+ if (rowValue === undefined || rowValue === null || value === undefined || value === null) {
20109
20079
  return false;
20110
20080
  }
20111
20081
  const valStr = String(rowValue).toLowerCase();
@@ -20138,10 +20108,7 @@ const CheckRowMatch = (row, filters, keyword, searchKeys) => {
20138
20108
  const isSearchMatch = !keyword ||
20139
20109
  searchKeys.some((key) => {
20140
20110
  const val = row[key];
20141
- return val
20142
- ?.toString()
20143
- .toLowerCase()
20144
- .includes(keyword.trim().toLowerCase());
20111
+ return val?.toString().toLowerCase().includes(keyword.trim().toLowerCase());
20145
20112
  });
20146
20113
  return isFilterMatch && isSearchMatch;
20147
20114
  };
@@ -20301,7 +20268,7 @@ const TableElement$1 = React__default.memo((props) => {
20301
20268
 
20302
20269
  const defaultMaxHeight$1 = 250;
20303
20270
  const SelectTable = forwardRef((props, ref) => {
20304
- const { id, menuWidth, width, invalid, placeholder, textAlign, options, columns, value, fieldValue, fieldLabel, maxHeight, isClearable, component, isMulti, noHeader, isDisabled, showFooter, formatSetting, allowCreate, onPaste, onChange, handleAdd, onKeyDown, onOpenMenu, loadOptions, onCloseMenu, footerComponent, formatOptionLabel, compareFunction, } = props;
20271
+ const { id, menuWidth, width, invalid, placeholder, textAlign, options, columns, value, fieldValue, fieldLabel, maxHeight, isClearable, component, isMulti, noHeader, isDisabled, showFooter, formatSetting, allowCreate, onPaste, onChange, handleAdd, onKeyDown, onOpenMenu, loadOptions, onCloseMenu, footerComponent, formatOptionLabel, compareFunction } = props;
20305
20272
  const selectTableRef = useRef(null);
20306
20273
  const selectMenuTableRef = useRef(null);
20307
20274
  const inputRef = useRef(null);
@@ -20318,8 +20285,8 @@ const SelectTable = forwardRef((props, ref) => {
20318
20285
  {
20319
20286
  headerText: 'Name',
20320
20287
  field: fieldLabel ?? 'label',
20321
- width: menuWidth,
20322
- },
20288
+ width: menuWidth
20289
+ }
20323
20290
  ];
20324
20291
  const closeMenu = () => {
20325
20292
  setDropdownOpen(false);
@@ -20333,7 +20300,7 @@ const SelectTable = forwardRef((props, ref) => {
20333
20300
  ...val,
20334
20301
  [fieldLabel ?? 'label']: val.valueCreate,
20335
20302
  isCreated: undefined,
20336
- isCreatedItem: true,
20303
+ isCreatedItem: true
20337
20304
  };
20338
20305
  options.unshift(newVal);
20339
20306
  onChange(newVal);
@@ -20343,9 +20310,7 @@ const SelectTable = forwardRef((props, ref) => {
20343
20310
  };
20344
20311
  useEffect(() => {
20345
20312
  if (dropdownOpen && value && !isMulti && selectMenuTableRef) {
20346
- const index = currentOptions?.findIndex((row) => compareFunction
20347
- ? compareFunction(row)
20348
- : row[fieldValue ?? 'value'] === value[fieldValue ?? 'value']);
20313
+ const index = currentOptions?.findIndex((row) => (compareFunction ? compareFunction(row) : row[fieldValue ?? 'value'] === value[fieldValue ?? 'value']));
20349
20314
  if (index >= 0) {
20350
20315
  selectMenuTableRef.current.scrollTo({ top: (index - 1) * 30 });
20351
20316
  }
@@ -20392,28 +20357,14 @@ const SelectTable = forwardRef((props, ref) => {
20392
20357
  }
20393
20358
  }
20394
20359
  };
20395
- const listKeyUse = [
20396
- 'Escape',
20397
- 'Space',
20398
- 'Enter',
20399
- 'Tab',
20400
- 'NumpadEnter',
20401
- 'ArrowDown',
20402
- 'ArrowUp',
20403
- 'F9',
20404
- ];
20360
+ const listKeyUse = ['Escape', 'Space', 'Enter', 'Tab', 'NumpadEnter', 'ArrowDown', 'ArrowUp', 'F9'];
20405
20361
  const handleOnKeyDown = (e) => {
20406
20362
  let key = '';
20407
20363
  if (onKeyDown &&
20408
20364
  (!dropdownOpen ||
20409
20365
  !listKeyUse.includes(e.code) ||
20410
- ((e.code === 'Enter' ||
20411
- e.code === 'Tab' ||
20412
- e.code === 'NumpadEnter' ||
20413
- e.code === 'Space') &&
20414
- !(currentOptions[indexFocus] || haveCreateNew)) ||
20415
- ((e.code === 'ArrowDown' || e.code === 'ArrowUp') &&
20416
- currentOptions.length === 0) ||
20366
+ ((e.code === 'Enter' || e.code === 'Tab' || e.code === 'NumpadEnter' || e.code === 'Space') && !(currentOptions[indexFocus] || haveCreateNew)) ||
20367
+ ((e.code === 'ArrowDown' || e.code === 'ArrowUp') && currentOptions.length === 0) ||
20417
20368
  (e.code === 'Escape' && !(isClearable && value && !isDisabled)))) {
20418
20369
  key = onKeyDown(e);
20419
20370
  }
@@ -20430,7 +20381,7 @@ const SelectTable = forwardRef((props, ref) => {
20430
20381
  valueCreate: searchTerm,
20431
20382
  [fieldValue ?? 'value']: searchTerm,
20432
20383
  [fieldLabel ?? 'label']: `${t('Create')} '${searchTerm}'`,
20433
- isCreated: true,
20384
+ isCreated: true
20434
20385
  };
20435
20386
  }
20436
20387
  else {
@@ -20452,16 +20403,14 @@ const SelectTable = forwardRef((props, ref) => {
20452
20403
  flag = true;
20453
20404
  }
20454
20405
  }
20455
- else if (e.code === 'Enter' ||
20456
- e.code === 'Tab' ||
20457
- e.code === 'NumpadEnter') {
20406
+ else if (e.code === 'Enter' || e.code === 'Tab' || e.code === 'NumpadEnter') {
20458
20407
  let newItem;
20459
20408
  if (haveCreateNew && indexFocus === 0) {
20460
20409
  newItem = {
20461
20410
  valueCreate: searchTerm,
20462
20411
  [fieldValue ?? 'value']: searchTerm,
20463
20412
  [fieldLabel ?? 'label']: `${t('Create')} '${searchTerm}'`,
20464
- isCreated: true,
20413
+ isCreated: true
20465
20414
  };
20466
20415
  }
20467
20416
  else {
@@ -20480,10 +20429,7 @@ const SelectTable = forwardRef((props, ref) => {
20480
20429
  newIndex = indexFocus + 1;
20481
20430
  }
20482
20431
  else if (value) {
20483
- newIndex =
20484
- currentOptions?.findIndex((row) => compareFunction
20485
- ? compareFunction(row)
20486
- : row[fieldValue ?? 'value'] === value[fieldValue ?? 'value']) + 1;
20432
+ newIndex = currentOptions?.findIndex((row) => (compareFunction ? compareFunction(row) : row[fieldValue ?? 'value'] === value[fieldValue ?? 'value'])) + 1;
20487
20433
  }
20488
20434
  if (newIndex < currentOptions.length) {
20489
20435
  setIndexFocus(newIndex);
@@ -20507,10 +20453,7 @@ const SelectTable = forwardRef((props, ref) => {
20507
20453
  newIndex = indexFocus - 1;
20508
20454
  }
20509
20455
  else if (value) {
20510
- newIndex =
20511
- currentOptions?.findIndex((row) => compareFunction
20512
- ? compareFunction(row)
20513
- : row[fieldValue ?? 'value'] === value[fieldValue ?? 'value']) - 1;
20456
+ newIndex = currentOptions?.findIndex((row) => (compareFunction ? compareFunction(row) : row[fieldValue ?? 'value'] === value[fieldValue ?? 'value'])) - 1;
20514
20457
  }
20515
20458
  if (newIndex >= 0) {
20516
20459
  setIndexFocus(newIndex);
@@ -20543,11 +20486,7 @@ const SelectTable = forwardRef((props, ref) => {
20543
20486
  scrollToElement(selectMenuTableRef.current, selectMenuTableRef.current.scrollHeight);
20544
20487
  }
20545
20488
  else if (flag === 0 && rect.bottom + 30 > parentRect.bottom) {
20546
- scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop -
20547
- selectMenuTableRef.current.offsetTop -
20548
- parentRect.height +
20549
- rect.height +
20550
- 50);
20489
+ scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - selectMenuTableRef.current.offsetTop - parentRect.height + rect.height + 50);
20551
20490
  }
20552
20491
  else if (flag === 2 && rect.top < parentRect.top + 50) {
20553
20492
  scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - 65);
@@ -20561,7 +20500,7 @@ const SelectTable = forwardRef((props, ref) => {
20561
20500
  timeOutElement = setTimeout(() => {
20562
20501
  elemment.scrollTo({
20563
20502
  top,
20564
- behavior: 'smooth',
20503
+ behavior: 'smooth'
20565
20504
  });
20566
20505
  }, 100);
20567
20506
  };
@@ -20571,12 +20510,7 @@ const SelectTable = forwardRef((props, ref) => {
20571
20510
  }
20572
20511
  for (let index = 0; index < columnsSearch.length; index++) {
20573
20512
  const key = columnsSearch[index].field.trim();
20574
- if (data[key] &&
20575
- data[key]
20576
- .toString()
20577
- .trim()
20578
- .toLowerCase()
20579
- .includes(keyword.trim().toLowerCase())) {
20513
+ if (data[key] && data[key].toString().trim().toLowerCase().includes(keyword.trim().toLowerCase())) {
20580
20514
  return true;
20581
20515
  }
20582
20516
  }
@@ -20592,8 +20526,7 @@ const SelectTable = forwardRef((props, ref) => {
20592
20526
  if (!searchTerm) {
20593
20527
  setOptionsLoad(undefined);
20594
20528
  }
20595
- else if (allowCreate &&
20596
- !currentOptions?.find((x) => x[fieldLabel ?? 'label'] === searchTerm)) {
20529
+ else if (allowCreate && !currentOptions?.find((x) => x[fieldLabel ?? 'label'] === searchTerm)) {
20597
20530
  setHaveCreateNew(true);
20598
20531
  return;
20599
20532
  }
@@ -20607,22 +20540,15 @@ const SelectTable = forwardRef((props, ref) => {
20607
20540
  const { indexRow, row, isSelected, level = 0 } = props;
20608
20541
  return (jsxs("tr", { id: `row-select-table-${indexRow}`, style: { paddingLeft: 10 * level }, className: classNames$1('r-select-row', { 'last-row': indexRow === currentOptions.length - 1 }, { 'fisrt-row': indexRow === 0 }), children: [isMulti && (jsx("td", { className: classNames$1(`r-select-rowcell`, {
20609
20542
  'r-select-move': indexFocus === indexRow,
20610
- 'r-select-active': !isMulti &&
20611
- value &&
20612
- (compareFunction
20613
- ? compareFunction(row)
20614
- : value[fieldValue ?? 'value'] ===
20615
- row[fieldValue ?? 'value']),
20543
+ 'r-select-active': !isMulti && value && (compareFunction ? compareFunction(row) : value[fieldValue ?? 'value'] === row[fieldValue ?? 'value'])
20616
20544
  }), style: {
20617
20545
  width: 40,
20618
20546
  textAlign: 'center',
20619
20547
  padding: 0,
20620
- paddingBottom: 6,
20548
+ paddingBottom: 6
20621
20549
  }, onClick: (e) => {
20622
20550
  if (isMulti) {
20623
- const index = value?.findIndex((x) => compareFunction
20624
- ? compareFunction(row)
20625
- : x[fieldValue ?? 'value'] === row[fieldValue ?? 'value']);
20551
+ const index = value?.findIndex((x) => (compareFunction ? compareFunction(row) : x[fieldValue ?? 'value'] === row[fieldValue ?? 'value']));
20626
20552
  if (index > -1) {
20627
20553
  value?.splice(index, 1);
20628
20554
  handChange([...value]);
@@ -20640,42 +20566,28 @@ const SelectTable = forwardRef((props, ref) => {
20640
20566
  }
20641
20567
  }, children: jsx(Input$1, { checked: isSelected, type: "checkbox", className: "cursor-pointer", onChange: () => { }, style: { textAlign: 'center', marginTop: 6 } }) })), (columns ? columns : defaultColumns).map((col, indexCol) => {
20642
20568
  let valueDisplay = row[col.field];
20643
- if (col.type === 'numeric' ||
20644
- (col.typeCondition && col.typeCondition(row) === 'numeric')) {
20645
- valueDisplay =
20646
- formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? '.', formatSetting?.thousandSeparator ?? ',', col.fraction ?? 0, true, false) ?? 0;
20569
+ if (col.type === 'numeric' || (col.typeCondition && col.typeCondition(row) === 'numeric')) {
20570
+ valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? '.', formatSetting?.thousandSeparator ?? ',', col.fraction ?? 0, true, false) ?? 0;
20647
20571
  }
20648
20572
  else if (col.type === 'date') {
20649
- valueDisplay = valueDisplay
20650
- ? formatDateTime(valueDisplay, formatSetting?.dateFormat)
20651
- : '';
20573
+ valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat) : '';
20652
20574
  }
20653
20575
  else if (col.type === 'datetime') {
20654
- valueDisplay = valueDisplay
20655
- ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
20656
- : '';
20576
+ valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm') : '';
20657
20577
  }
20658
20578
  return (jsxs(Fragment, { children: [col.visible !== false && (jsx("td", { id: `select-${id}-${indexRow}-${indexCol}`,
20659
20579
  // ref={refRow}
20660
20580
  className: classNames$1(`r-select-rowcell`, {
20661
20581
  'r-select-move': indexFocus === indexRow,
20662
- 'r-select-active': !isMulti &&
20663
- value &&
20664
- (compareFunction
20665
- ? compareFunction(row)
20666
- : value[fieldValue ?? 'value'] ===
20667
- row[fieldValue ?? 'value']),
20582
+ 'r-select-active': !isMulti && value && (compareFunction ? compareFunction(row) : value[fieldValue ?? 'value'] === row[fieldValue ?? 'value'])
20668
20583
  }), style: {
20669
20584
  minWidth: col.minWidth,
20670
20585
  width: col.width,
20671
20586
  maxWidth: col.maxWidth,
20672
- textAlign: col.textAlign ? col.textAlign : 'left',
20587
+ textAlign: col.textAlign ? col.textAlign : 'left'
20673
20588
  }, onClick: (e) => {
20674
20589
  if (isMulti) {
20675
- const index = value?.findIndex((x) => compareFunction
20676
- ? compareFunction(row)
20677
- : x[fieldValue ?? 'value'] ===
20678
- row[fieldValue ?? 'value']);
20590
+ const index = value?.findIndex((x) => (compareFunction ? compareFunction(row) : x[fieldValue ?? 'value'] === row[fieldValue ?? 'value']));
20679
20591
  if (index > -1) {
20680
20592
  value?.splice(index, 1);
20681
20593
  handChange([...value]);
@@ -20702,7 +20614,7 @@ const SelectTable = forwardRef((props, ref) => {
20702
20614
  setIndexFocus(indexRow);
20703
20615
  }
20704
20616
  e.stopPropagation();
20705
- }, children: col.template ? (col.template(row, indexRow)) : col.type === 'numeric' && Number(row[col.field]) < 0 ? (jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] })) : (valueDisplay) }, `col-${indexRow}-${indexCol}`)), checkOverflow(indexRow, indexCol) && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay }))] }, indexCol));
20617
+ }, children: col.template ? col.template(row, indexRow) : col.type === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : valueDisplay }, `col-${indexRow}-${indexCol}`)), checkOverflow(indexRow, indexCol) && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay }))] }, indexCol));
20706
20618
  })] }, `row-${indexRow}`));
20707
20619
  });
20708
20620
  return (jsx("div", { className: classNames$1('react-select-table', { 'is-invalid': invalid }), ref: ref, id: id, children: jsx("div", { ref: selectTableRef, children: jsxs(Dropdown$1$1, { isOpen: dropdownOpen, toggle: () => { }, onMouseDown: (e) => e.preventDefault(), children: [jsxs(DropdownToggle$1, { onClick: (e) => {
@@ -20712,26 +20624,14 @@ const SelectTable = forwardRef((props, ref) => {
20712
20624
  }
20713
20625
  e.preventDefault();
20714
20626
  }, tag: "div", style: {
20715
- width: width
20716
- ? width
20717
- : selectTableRef?.current?.clientWidth
20718
- ? selectTableRef?.current?.clientWidth
20719
- : 'auto',
20627
+ width: width ? width : selectTableRef?.current?.clientWidth ? selectTableRef?.current?.clientWidth : 'auto'
20720
20628
  }, className: classNames$1('select-table-control', { 'r-select-is-disabled': isDisabled }, { 'r-select-is-open': dropdownOpen }, { 'r-select-is-focus': isFocus }, { 'r-select-is-invalid': invalid }), children: [jsxs("div", { className: "select-table-container", children: [isMulti ? (jsx("div", { className: classNames$1('select-value is-mutil', {
20721
- 'd-none': searchTerm,
20629
+ 'd-none': searchTerm
20722
20630
  }), children: value?.map((ele, index) => {
20723
- return (jsxs("span", { children: [index === 0 ? '' : ', ', formatOptionLabel
20724
- ? formatOptionLabel(ele)
20725
- : ele[fieldLabel ?? 'label']] }, index));
20631
+ return (jsxs("span", { children: [index === 0 ? '' : ', ', formatOptionLabel ? formatOptionLabel(ele) : ele[fieldLabel ?? 'label']] }, index));
20726
20632
  }) })) : (jsxs("div", { className: classNames$1('select-value', {
20727
- 'd-none': searchTerm,
20728
- }), children: [value
20729
- ? formatOptionLabel
20730
- ? formatOptionLabel(value)
20731
- : value[fieldLabel ?? 'label']
20732
- : '', ' '] })), !((isMulti ? value?.length > 0 : value) ||
20733
- isDisabled ||
20734
- searchTerm) && (jsx("div", { className: classNames$1('select-placeholder'), children: placeholder })), jsx("div", { className: "input-container", children: jsx("input", { style: { textAlign: textAlign ?? 'left' }, ref: inputRef, className: classNames$1('select-input'), readOnly: isDisabled, value: searchTerm, onPaste: (e) => onPaste && !dropdownOpen && onPaste(e), onChange: (val) => {
20633
+ 'd-none': searchTerm
20634
+ }), children: [value ? (formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? 'label']) : '', ' '] })), !((isMulti ? value?.length > 0 : value) || isDisabled || searchTerm) && jsx("div", { className: classNames$1('select-placeholder'), children: placeholder }), jsx("div", { className: "input-container", children: jsx("input", { style: { textAlign: textAlign ?? 'left' }, ref: inputRef, className: classNames$1('select-input'), readOnly: isDisabled, value: searchTerm, onPaste: (e) => onPaste && !dropdownOpen && onPaste(e), onChange: (val) => {
20735
20635
  if (val.target.value) {
20736
20636
  if (loadOptions && val.target.value) {
20737
20637
  setIsLoading(true);
@@ -20753,23 +20653,21 @@ const SelectTable = forwardRef((props, ref) => {
20753
20653
  width: width ? width + 2 : 'min-content',
20754
20654
  position: 'fixed',
20755
20655
  borderRadius: 4,
20756
- zIndex: 9999,
20656
+ zIndex: 9999
20757
20657
  }, children: jsx(DropdownItem$1, { className: classNames$1('p-0 menu-select-table'), tag: "div", header: true, children: dropdownOpen && (jsx("div", { style: { backgroundColor: 'none' }, onMouseDown: (e) => {
20758
20658
  if (!isDisabled) {
20759
20659
  inputRef?.current.focus();
20760
20660
  e.preventDefault();
20761
20661
  }
20762
20662
  }, children: jsxs("div", { className: "r-select-grid", children: [jsx("div", { className: classNames$1('r-select-gridtable', {
20763
- 'no-header': noHeader || (columns?.length ?? 0) === 0,
20663
+ 'no-header': noHeader || (columns?.length ?? 0) === 0
20764
20664
  }), ref: selectMenuTableRef, style: {
20765
20665
  width: menuWidth,
20766
20666
  minWidth: selectTableRef?.current?.clientWidth,
20767
- maxHeight: maxHeight ?? defaultMaxHeight$1,
20667
+ maxHeight: maxHeight ?? defaultMaxHeight$1
20768
20668
  }, children: jsx(TableElement$1, { haveCreateNew: haveCreateNew, isLoading: isLoading, searchTerm: searchTerm, fieldLabel: fieldLabel, noHeader: noHeader, closeMenu: closeMenu, value: value, isMulti: isMulti, currentOptions: currentOptions, fieldValue: fieldValue, columns: columns, defaultColumns: defaultColumns, indexFocus: indexFocus, formatSetting: formatSetting, handChange: handChange, compareFunction: compareFunction, setIndexFocus: setIndexFocus, setSearchTerm: setSearchTerm }) }), jsxs("div", { className: classNames$1('r-select-footer', {
20769
- 'd-none': !(showFooter === true ||
20770
- handleAdd ||
20771
- isMulti),
20772
- }), children: [jsxs(Button$1$1, { outline: true, color: "primary", onClick: () => handleAdd?.(), className: classNames$1('r-btn d-flex align-items-center', { 'd-none': !handleAdd }), children: [jsx(SvgPlus, { className: "me-50", fontSize: 16 }), t('AddNew'), " (F9)"] }), isMulti && (jsx("div", { className: "ms-50 text-primary h-100 d-flex align-items-center", children: t('countSelected', { item: value?.length ?? 0 }) })), footerComponent ? footerComponent() : null] })] }) })) }) })] }) }) }));
20669
+ 'd-none': !(showFooter === true || handleAdd || isMulti)
20670
+ }), children: [jsxs(Button$1$1, { outline: true, color: "primary", onClick: () => handleAdd?.(), className: classNames$1('r-btn d-flex align-items-center', { 'd-none': !handleAdd }), children: [jsx(SvgPlus, { className: "me-50", fontSize: 16 }), t('AddNew'), " (F9)"] }), isMulti && jsx("div", { className: "ms-50 text-primary h-100 d-flex align-items-center", children: t('countSelected', { item: value?.length ?? 0 }) }), footerComponent ? footerComponent() : null] })] }) })) }) })] }) }) }));
20773
20671
  });
20774
20672
 
20775
20673
  const PagingComponent = ({ totalItem, gridRef, pageSize, currentPage, onChangePage, pageOptions, onChangePageSize }) => {
@@ -39768,6 +39666,8 @@ const NumberFilterComponent = ({ column, filterBy, fieldFilter, handleSave, form
39768
39666
  allowNegative: column.numericSettings?.allowNegative ?? false,
39769
39667
  decimalScale: column.numericSettings?.fraction ?? 0
39770
39668
  };
39669
+ console.log(column.numericSettings?.fraction);
39670
+ console.log(column.field);
39771
39671
  let floatValue = parseFloat(valueFilter ?? '0');
39772
39672
  return (jsx(Fragment$1, { children: jsxs("div", { className: "r-filter-popup", onKeyDown: (e) => {
39773
39673
  if (e.code === 'Enter' || e.code === 'NumpadEnter') {
@@ -69615,7 +69515,7 @@ const UnExpandAllIcon = ({ className, color = '#7F7F7F', size = 24, onClick, sty
69615
69515
  };
69616
69516
 
69617
69517
  const RenderContentCol = React__default.memo((props) => {
69618
- const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, handleCellClick, fieldKey, isMulti, } = props;
69518
+ const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, handleCellClick, fieldKey, isMulti } = props;
69619
69519
  const cellId = `content-${idTable}-row${indexRow}col-${indexCol}`;
69620
69520
  const checkOverflow = () => {
69621
69521
  const element = document.getElementById(cellId);
@@ -69637,12 +69537,10 @@ const RenderContentCol = React__default.memo((props) => {
69637
69537
  const RenderElement = () => {
69638
69538
  if (col.field === '#' || col.type === '#') {
69639
69539
  return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer text-center', {
69640
- 'r-active-cell': isSelected,
69540
+ 'r-active-cell': isSelected
69641
69541
  }), style: {
69642
- fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
69643
- ? 600
69644
- : 400,
69645
- fontStyle: row.haveItalicType ? 'italic' : 'normal',
69542
+ fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
69543
+ fontStyle: row.haveItalicType ? 'italic' : 'normal'
69646
69544
  }, onDoubleClick: (e) => {
69647
69545
  e.preventDefault();
69648
69546
  handleCloseContext();
@@ -69651,15 +69549,11 @@ const RenderContentCol = React__default.memo((props) => {
69651
69549
  }
69652
69550
  else if (col.type === 'checkbox' || col.field === 'checkbox') {
69653
69551
  return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer', {
69654
- 'r-active-cell': isSelected,
69552
+ 'r-active-cell': isSelected
69655
69553
  }), style: {
69656
69554
  display: 'flex',
69657
- justifyContent: col.textAlign === 'center'
69658
- ? 'center'
69659
- : col.textAlign === 'right'
69660
- ? 'flex-end'
69661
- : 'flex-start',
69662
- alignItems: 'center',
69555
+ justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start',
69556
+ alignItems: 'center'
69663
69557
  }, onClick: (e) => {
69664
69558
  setSelectedRows(toggleSelect());
69665
69559
  e.stopPropagation();
@@ -69669,12 +69563,8 @@ const RenderContentCol = React__default.memo((props) => {
69669
69563
  let value = row[col.field];
69670
69564
  // ✅ Format dữ liệu theo loại cột
69671
69565
  if (col.type === 'numeric') {
69672
- value =
69673
- formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
69674
- if (!zeroVisiable &&
69675
- !col.zeroVisiable &&
69676
- !(row?.sortOrder < 0 || row?.sortOrder > 100000) &&
69677
- (value === '0' || value === 0)) {
69566
+ value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
69567
+ if (!zeroVisiable && !col.zeroVisiable && !(row?.sortOrder < 0 || row?.sortOrder > 100000) && (value === '0' || value === 0)) {
69678
69568
  value = '';
69679
69569
  }
69680
69570
  }
@@ -69682,43 +69572,31 @@ const RenderContentCol = React__default.memo((props) => {
69682
69572
  value = value ? formatDateTime(value, formatSetting?.dateFormat) : '';
69683
69573
  }
69684
69574
  else if (col.type === 'datetime') {
69685
- value = value
69686
- ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
69687
- : '';
69575
+ value = value ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm') : '';
69688
69576
  }
69689
69577
  if (col.template) {
69690
69578
  value = col.template(row, indexRow) ?? '';
69691
69579
  }
69692
69580
  const isNegative = col.type === 'numeric' && Number(row[col.field]) < 0;
69693
- const textColor = isNegative
69694
- ? (formatSetting?.colorNegative ?? 'red')
69695
- : undefined;
69696
- const prefix = isNegative ? (formatSetting?.prefixNegative ?? '-') : '';
69697
- const suffix = isNegative ? (formatSetting?.suffixNegative ?? '') : '';
69698
- const displayText = isNegative
69699
- ? `${prefix}${value}${suffix}`
69700
- : (value ?? '');
69581
+ const textColor = isNegative ? formatSetting?.colorNegative ?? 'red' : undefined;
69582
+ const prefix = isNegative ? formatSetting?.prefixNegative ?? '-' : '';
69583
+ const suffix = isNegative ? formatSetting?.suffixNegative ?? '' : '';
69584
+ const displayText = isNegative ? `${prefix}${value}${suffix}` : value ?? '';
69701
69585
  return (jsxs("div", { className: classNames$1('r-rowcell-div cursor-pointer', {
69702
- 'r-active-cell': isSelected,
69586
+ 'r-active-cell': isSelected
69703
69587
  }), style: {
69704
- fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
69705
- ? 600
69706
- : 400,
69707
- fontStyle: row.haveItalicType ? 'italic' : 'normal',
69588
+ fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
69589
+ fontStyle: row.haveItalicType ? 'italic' : 'normal'
69708
69590
  }, children: [jsx("div", { className: "r-cell-text", style: {
69709
69591
  display: 'flex',
69710
- justifyContent: col.textAlign === 'center'
69711
- ? 'center'
69712
- : col.textAlign === 'right'
69713
- ? 'flex-end'
69714
- : 'flex-start',
69715
- alignItems: 'center',
69592
+ justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start',
69593
+ alignItems: 'center'
69716
69594
  }, children: jsx("div", { id: cellId, style: {
69717
69595
  color: textColor,
69718
69596
  overflow: 'hidden',
69719
69597
  textOverflow: 'ellipsis',
69720
69598
  whiteSpace: 'pre',
69721
- maxWidth: '100%',
69599
+ maxWidth: '100%'
69722
69600
  }, children: displayText }) }), checkOverflow() && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: cellId, placement: "top", children: jsx("div", { style: { color: textColor }, onClick: (e) => {
69723
69601
  e.stopPropagation();
69724
69602
  e.preventDefault();
@@ -69727,15 +69605,10 @@ const RenderContentCol = React__default.memo((props) => {
69727
69605
  };
69728
69606
  const clickTimerRef = useRef(null);
69729
69607
  return (jsx(Fragment$1, { children: col.visible !== false && col.isGroup !== true && (jsx("td", { className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, {
69730
- 'fixed-last': (col.fixedType === 'left' &&
69731
- indexCol === lastObjWidthFixLeft) ||
69732
- (col.fixedType === 'right' &&
69733
- indexCol === fisrtObjWidthFixRight),
69608
+ 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight)
69734
69609
  }, { 'r-active': isSelected }), style: {
69735
69610
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
69736
- right: col.fixedType === 'right'
69737
- ? objWidthFixRight[indexCol]
69738
- : undefined,
69611
+ right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined
69739
69612
  }, onClick: (e) => {
69740
69613
  const tag = e.target?.nodeName;
69741
69614
  if (tag !== 'DIV' && tag !== 'TD') {
@@ -69949,9 +69822,9 @@ const TableElement = React__default.memo((props) => {
69949
69822
  ? colSum.textAlign
69950
69823
  : 'left',
69951
69824
  }, children: (haveSum || colSum.haveSum === true) &&
69952
- Number(row[colSum.field] ?? '0') < 0 ? (jsxs("div", { style: {
69825
+ Number(row[colSum.field] ?? '0') < 0 ? (jsx("div", { style: {
69953
69826
  color: formatSetting?.colorNegative ?? 'red',
69954
- }, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] })) : (sumValue) }) }, `group-sum-cell-${level}-${indexRow}-${indexCol}`));
69827
+ }, children: `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}` })) : (sumValue) }) }, `group-sum-cell-${level}-${indexRow}-${indexCol}`));
69955
69828
  })] }), expand && (jsx(RenderContent, { datas: row.children, level: level + 1 }))] }, `row-${level}-${indexRow}`));
69956
69829
  }
69957
69830
  else {
@@ -70026,7 +69899,7 @@ const TableElement = React__default.memo((props) => {
70026
69899
  }) }) })), (viewData.length ?? 0) === 0 && !isLoading && (jsxs("div", { className: "r-no-data", children: [jsx("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [jsx("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }), jsx("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })] })] }) }), t('No data available.')] }))] }));
70027
69900
  });
70028
69901
 
70029
- const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoading, formatSetting, querySetting, pagingSetting, searchSetting, columnsAggregate, toolbarSetting, selectedItem, setSelectedItem, handleSelect, saveSettingColumn, resetDefaultColumns, settingColumns, headerComponent, groupSetting, zeroVisiable, isMulti, handleDoubleClick, handleCellClick, contextMenuItems, headerHeight, handleContextMenuClick, }) => {
69902
+ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoading, formatSetting, querySetting, pagingSetting, searchSetting, columnsAggregate, toolbarSetting, selectedItem, setSelectedItem, handleSelect, saveSettingColumn, resetDefaultColumns, settingColumns, headerComponent, groupSetting, zeroVisiable, isMulti, handleDoubleClick, handleCellClick, contextMenuItems, headerHeight, handleContextMenuClick }) => {
70030
69903
  const { t } = useTranslation();
70031
69904
  const gridRef = useRef(null);
70032
69905
  const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState(false);
@@ -70039,8 +69912,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70039
69912
  const [expandsAll, setExpandsAll] = useState(true);
70040
69913
  const [maximize, setMaximize] = useState(false);
70041
69914
  const [windowHeight, setWindowHeight] = useState(window.innerHeight);
70042
- const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ??
70043
- 'id';
69915
+ const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? 'id';
70044
69916
  useEffect(() => {
70045
69917
  const handleResize = () => {
70046
69918
  setWindowHeight(window.innerHeight);
@@ -70050,19 +69922,14 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70050
69922
  }, []);
70051
69923
  const heightTable = useMemo(() => {
70052
69924
  if (maximize) {
70053
- return (windowHeight -
70054
- (pagingSetting?.allowPaging ? 50 : 0) -
70055
- (haveSum ? 30 : 0) -
70056
- (headerHeight ?? 59) -
70057
- (toolbarSetting?.showBottomToolbar ? 42 : 0) -
70058
- (toolbarSetting?.showTopToolbar ? 42 : 0));
69925
+ return windowHeight - (pagingSetting?.allowPaging ? 50 : 0) - (haveSum ? 30 : 0) - (headerHeight ?? 59) - (toolbarSetting?.showBottomToolbar ? 42 : 0) - (toolbarSetting?.showTopToolbar ? 42 : 0);
70059
69926
  }
70060
69927
  return height;
70061
69928
  }, [height, maximize, windowHeight]);
70062
69929
  const optionsGroupColumn = useMemo(() => {
70063
69930
  return contentColumns.map((col) => ({
70064
69931
  ...col,
70065
- headerText: t(col.headerText),
69932
+ headerText: t(col.headerText)
70066
69933
  }));
70067
69934
  }, [contentColumns]);
70068
69935
  useEffect(() => {
@@ -70071,7 +69938,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70071
69938
  }
70072
69939
  setExpandsAll(true);
70073
69940
  }, [groupSetting?.groupColumns]);
70074
- const { levels: headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, } = useMemo(() => {
69941
+ const { levels: headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = useMemo(() => {
70075
69942
  const rs = calculateTableStructure(columns, settingColumns?.value, groupSetting?.groupColumns);
70076
69943
  setContentColumns(rs.flat);
70077
69944
  return rs;
@@ -70089,17 +69956,12 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70089
69956
  }
70090
69957
  };
70091
69958
  const searchTemplate = () => {
70092
- return (jsx("div", { className: "me-50 r-search", children: jsx(ReactInput, { style: { width: '230px' }, value: searchSetting?.searchTerm !== undefined
70093
- ? searchSetting?.searchTerm
70094
- : searchTerm, setSearchTerm: searchSetting?.setSearchTerm
70095
- ? searchSetting?.setSearchTerm
70096
- : setSearchTerm, placeholder: t('Search'), onKeyPress: handleKeyPress }) }));
69959
+ return (jsx("div", { className: "me-50 r-search", children: jsx(ReactInput, { style: { width: '230px' }, value: searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm, setSearchTerm: searchSetting?.setSearchTerm ? searchSetting?.setSearchTerm : setSearchTerm, placeholder: t('Search'), onKeyPress: handleKeyPress }) }));
70097
69960
  };
70098
69961
  const groupbtnTemplate = () => {
70099
69962
  return (jsxs(UncontrolledDropdown, { children: [jsx(DropdownToggle$1, { tag: "div", id: "group-dropdown-toggle", style: { position: 'relative' }, onClick: (e) => e.preventDefault(), children: jsx(GroupIcon, { color: "#7F7F7F", size: 24 }) }), jsxs(DropdownMenu$1, { className: "formula-dropdown icon-dropdown p-1", children: [jsx("div", { className: "mb-1", style: { fontSize: 16, fontWeight: 500 }, children: "Nh\u00F3m d\u1EEF li\u1EC7u theo c\u1ED9t" }), jsxs("div", { className: 'form-group', children: [jsx(Label$1, { id: `label-group-1`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 1" }), jsx("div", { className: "form-input", children: jsx(SelectTable, { options: optionsGroupColumn, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[0]
70100
69963
  ? {
70101
- headerText: t(contentColumns.find((x) => x.field === groupColumns[0])?.headerText ??
70102
- contentColumns.find((x) => x.field === groupColumns[0])?.headerText),
69964
+ headerText: t(contentColumns.find((x) => x.field === groupColumns[0])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[0])?.headerText)
70103
69965
  }
70104
69966
  : undefined, onChange: (val) => {
70105
69967
  if (val) {
@@ -70111,8 +69973,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70111
69973
  setGroupColumns([...groupColumns]);
70112
69974
  }, isClearable: groupColumns?.length === 1 }) })] }), jsxs("div", { className: 'form-group', children: [jsx(Label$1, { id: `label-group-2`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 2" }), jsx("div", { className: "form-input", children: jsx(SelectTable, { options: optionsGroupColumn, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[1]
70113
69975
  ? {
70114
- headerText: t(contentColumns.find((x) => x.field === groupColumns[1])?.headerText ??
70115
- contentColumns.find((x) => x.field === groupColumns[1])?.headerText),
69976
+ headerText: t(contentColumns.find((x) => x.field === groupColumns[1])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[1])?.headerText)
70116
69977
  }
70117
69978
  : undefined, onChange: (val) => {
70118
69979
  if (val) {
@@ -70124,8 +69985,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70124
69985
  setGroupColumns([...groupColumns]);
70125
69986
  }, isClearable: groupColumns?.length === 2 }) })] }), jsxs("div", { className: 'form-group', children: [jsx(Label$1, { id: `label-group-3`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 3" }), jsx("div", { className: "form-input", children: jsx(SelectTable, { options: optionsGroupColumn, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[2]
70126
69987
  ? {
70127
- headerText: t(contentColumns.find((x) => x.field === groupColumns[2])?.headerText ??
70128
- contentColumns.find((x) => x.field === groupColumns[2])?.headerText),
69988
+ headerText: t(contentColumns.find((x) => x.field === groupColumns[2])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[2])?.headerText)
70129
69989
  }
70130
69990
  : undefined, onChange: (val) => {
70131
69991
  if (groupSetting) {
@@ -70139,7 +69999,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70139
69999
  }
70140
70000
  }, isClearable: groupColumns?.length === 3 }) })] }), jsxs("div", { className: "border-top d-flex justify-content-end mt-1", children: [jsx(Button$1$1, { color: "primary", className: "mt-1 me-50 rounded", size: "sm", onClick: () => {
70141
70001
  groupSetting?.onGroup({
70142
- columnGrouped: groupColumns.filter((x) => x),
70002
+ columnGrouped: groupColumns.filter((x) => x)
70143
70003
  });
70144
70004
  document.getElementById('group-dropdown-toggle')?.click();
70145
70005
  }, children: `${t('Apply')}` }), jsx(Button$1$1, { color: "secondary", outline: true, className: "mt-1 rounded", size: "sm", onClick: () => {
@@ -70148,16 +70008,14 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70148
70008
  }, children: `${t('Delete')}` })] })] })] }));
70149
70009
  };
70150
70010
  const chooseColumnsTemplate = () => {
70151
- return (jsx(SvgSettings, { className: "r-toolbar-icon", fontSize: 20, color: "#7F7F7F", onClick: () => setOpenPopupSetupColumn(true) }));
70011
+ return jsx(SvgSettings, { className: "r-toolbar-icon", fontSize: 20, color: "#7F7F7F", onClick: () => setOpenPopupSetupColumn(true) });
70152
70012
  };
70153
70013
  const expandTemplate = () => {
70154
70014
  return (jsxs(Fragment$1, { children: [!expandsAll && (jsx(ExpandAllIcon, { onClick: () => {
70155
70015
  setExpandsAll(true);
70156
- }, color: "#7F7F7F", size: 24 })), expandsAll && (jsx(UnExpandAllIcon, { onClick: () => setExpandsAll(false), color: "#7F7F7F", size: 24 }))] }));
70016
+ }, color: "#7F7F7F", size: 24 })), expandsAll && jsx(UnExpandAllIcon, { onClick: () => setExpandsAll(false), color: "#7F7F7F", size: 24 })] }));
70157
70017
  };
70158
- const defaultToolbarOption = searchSetting?.searchEnable
70159
- ? [{ template: searchTemplate, align: 'left' }]
70160
- : [];
70018
+ const defaultToolbarOption = searchSetting?.searchEnable ? [{ template: searchTemplate, align: 'left' }] : [];
70161
70019
  if (groupSetting) {
70162
70020
  defaultToolbarOption.push({ template: groupbtnTemplate, align: 'left' });
70163
70021
  }
@@ -70166,10 +70024,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70166
70024
  }
70167
70025
  let toolbarTopOption = [];
70168
70026
  if (toolbarSetting?.toolbarOptions) {
70169
- toolbarTopOption = [
70170
- ...defaultToolbarOption,
70171
- ...toolbarSetting?.toolbarOptions,
70172
- ];
70027
+ toolbarTopOption = [...defaultToolbarOption, ...toolbarSetting?.toolbarOptions];
70173
70028
  }
70174
70029
  else {
70175
70030
  toolbarTopOption = [...defaultToolbarOption];
@@ -70200,9 +70055,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70200
70055
  useEffect(() => {
70201
70056
  if (setSelectedItem) {
70202
70057
  if (isMulti) {
70203
- if (dataSource &&
70204
- selectedRows &&
70205
- selectedRows?.length !== selectedItem?.length) {
70058
+ if (dataSource && selectedRows && selectedRows?.length !== selectedItem?.length) {
70206
70059
  setSelectedItem([...selectedRows]);
70207
70060
  if (handleSelect) {
70208
70061
  handleSelect([...selectedRows]);
@@ -70211,8 +70064,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70211
70064
  }
70212
70065
  else {
70213
70066
  if (dataSource && selectedRows?.length > 0) {
70214
- if (!selectedItem ||
70215
- selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
70067
+ if (!selectedItem || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
70216
70068
  setSelectedItem({ ...selectedRows[0] });
70217
70069
  if (handleSelect) {
70218
70070
  handleSelect({ ...selectedRows[0] });
@@ -70231,8 +70083,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70231
70083
  useEffect(() => {
70232
70084
  if (!isMulti) {
70233
70085
  if (dataSource && selectedItem && selectedItem[fieldKey]) {
70234
- if (selectedRows?.length === 0 ||
70235
- selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
70086
+ if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
70236
70087
  setSelectedRows([selectedItem]);
70237
70088
  }
70238
70089
  }
@@ -70241,18 +70092,16 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70241
70092
  }
70242
70093
  }
70243
70094
  else {
70244
- if (dataSource &&
70245
- selectedItem &&
70246
- selectedRows?.length !== selectedItem.length) {
70095
+ if (dataSource && selectedItem && selectedRows?.length !== selectedItem.length) {
70247
70096
  setSelectedRows(selectedItem ? [...selectedItem] : []);
70248
70097
  }
70249
70098
  }
70250
70099
  }, [selectedItem]);
70251
70100
  return (jsxs("div", { className: classNames$1('r-table-edit r-virtualized-table', {
70252
- 'is-maximized': maximize,
70253
- }), children: [jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && (jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption, maximize: maximize, setMaximize: setMaximize })), headerComponent && headerComponent(), jsxs("div", { ref: gridRef, className: "r-gridtable", style: {
70101
+ 'is-maximized': maximize
70102
+ }), children: [jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption, maximize: maximize, setMaximize: setMaximize }), headerComponent && headerComponent(), jsxs("div", { ref: gridRef, className: "r-gridtable", style: {
70254
70103
  height: `${heightTable ? `${heightTable}px` : 'auto'}`,
70255
- position: 'relative',
70104
+ position: 'relative'
70256
70105
  }, children: [jsx(TableElement, { idTable: idTable, gridRef: gridRef, isLoading: isLoading, dataSource: dataSource, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, fieldKey: fieldKey, lastObjWidthFixLeft: lastObjWidthFixLeft, fisrtObjWidthFixRight: fisrtObjWidthFixRight, selectedRows: selectedRows, isMulti: isMulti, filterBy: filterBy, orderBy: orderBy, formatSetting: formatSetting, contentColumns: contentColumns, headerColumns: headerColumns, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, searchTerm: searchTerm, searchSetting: searchSetting, columnsAggregate: columnsAggregate, haveSum: haveSum, expandsAll: expandsAll, zeroVisiable: zeroVisiable, contextMenuItems: contextMenuItems, handleContextMenuClick: handleContextMenuClick, setFilterBy: setFilterBy, setSelectedRows: setSelectedRows, setOrderBy: setOrderBy, handleDoubleClick: handleDoubleClick, handleCellClick: handleCellClick, querySetting: querySetting, setContentColumns: setContentColumns, setExpandsAll: setExpandsAll }), isLoading && (jsx("div", { className: "r-loading-overlay", children: jsxs("div", { className: "r-loading", children: [jsx(Spinner$1, { className: "me-1" }), t('Loading...')] }) }))] })] }), pagingSetting?.allowPaging && (jsx(PagingComponent, { gridRef: gridRef, onChangePage: onChangePage, pageSize: pagingSetting?.pageSize ?? 0, currentPage: pagingSetting?.currentPage ?? 0, pageOptions: pagingSetting?.pageOptions ?? [20, 30, 50, 100], totalItem: pagingSetting?.totalItem ?? 0, onChangePageSize: onChangePageSize })), jsx(SettingColumn, { gridRef: gridRef, handleSidebar: () => {
70257
70106
  setOpenPopupSetupColumn(!openPopupSetupColumn);
70258
70107
  }, settingColumns: settingColumns, openSidebar: openPopupSetupColumn, column: [...contentColumns], resetDefaultColumns: resetDefaultColumns, setColumn: (newColumns) => {
@@ -70263,7 +70112,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
70263
70112
  visible: x.visible,
70264
70113
  fixedType: x.fixedType,
70265
70114
  width: x.width,
70266
- sortOrder: index + 1,
70115
+ sortOrder: index + 1
70267
70116
  })));
70268
70117
  }
70269
70118
  } })] }));