react-table-edit 1.5.37 → 1.5.39

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.js CHANGED
@@ -68391,7 +68391,7 @@ const TabValidateImportExcel = (props) => {
68391
68391
 
68392
68392
  const ModalImportComponent = (props) => {
68393
68393
  const { t } = reactI18next.useTranslation();
68394
- const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, getGeneralSettingApi, updateGeneralSettingApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, formatNumber, mapColumn, headerValidateExcelColumns } = props;
68394
+ const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, getGeneralSettingApi, updateGeneralSettingApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, formatNumber, mapColumn, headerValidateExcelColumns, style, } = props;
68395
68395
  const [optionField, setOptionField] = React$5.useState([]);
68396
68396
  const [dataMerge, setDataMerge] = React$5.useState([]);
68397
68397
  const [dataValidate, setDataValidate] = React$5.useState([]);
@@ -68406,22 +68406,22 @@ const ModalImportComponent = (props) => {
68406
68406
  step: create$1(),
68407
68407
  sheetId: create$2().when('step', {
68408
68408
  is: 1,
68409
- then: create$2().required(`${t('Sheet name')} ${t('is required')}`)
68409
+ then: create$2().required(`${t('Sheet name')} ${t('is required')}`),
68410
68410
  }),
68411
68411
  headerRow: create$1().when('step', {
68412
68412
  is: 1,
68413
- then: create$1().required(`${t('Header row')} ${t('is required')}`)
68414
- })
68413
+ then: create$1().required(`${t('Header row')} ${t('is required')}`),
68414
+ }),
68415
68415
  });
68416
68416
  const defaultValues = {
68417
68417
  step: 1,
68418
68418
  headerRow: defaultHeaderRow ?? 1,
68419
- dataMap: []
68419
+ dataMap: [],
68420
68420
  };
68421
- const { control, clearErrors, reset, handleSubmit, getValues, setValue, watch, setError, formState: { errors } } = useForm({
68421
+ const { control, clearErrors, reset, handleSubmit, getValues, setValue, watch, setError, formState: { errors }, } = useForm({
68422
68422
  defaultValues,
68423
68423
  mode: 'onChange',
68424
- resolver: o(formSchema)
68424
+ resolver: o(formSchema),
68425
68425
  });
68426
68426
  const handleSetColumns = (headerColumns, dataS) => {
68427
68427
  if (headerColumns.length === 0) {
@@ -68459,7 +68459,10 @@ const ModalImportComponent = (props) => {
68459
68459
  validateExcelApi(arr)
68460
68460
  .then((rs) => {
68461
68461
  setCheckInitValidate(false);
68462
- const list = rs.map((item) => ({ ...item, errors: item.errors.map((x) => connectString(t, x)) }));
68462
+ const list = rs.map((item) => ({
68463
+ ...item,
68464
+ errors: item.errors.map((x) => connectString(t, x)),
68465
+ }));
68463
68466
  setDataValidate(list);
68464
68467
  setDataInvalid(list.filter((x) => x.errors?.length > 0));
68465
68468
  setDataValid(list.filter((x) => x.error || x.errors?.length === 0));
@@ -68501,7 +68504,13 @@ const ModalImportComponent = (props) => {
68501
68504
  });
68502
68505
  };
68503
68506
  const getDataType = (e) => {
68504
- return e.dataType === 'numeric' || e.dataType === 'datetime' || e.dataType === 'date' ? e.dataType : e.dataType === 'boolean' ? 'checkbox' : 'text';
68507
+ return e.dataType === 'numeric' ||
68508
+ e.dataType === 'datetime' ||
68509
+ e.dataType === 'date'
68510
+ ? e.dataType
68511
+ : e.dataType === 'boolean'
68512
+ ? 'checkbox'
68513
+ : 'text';
68505
68514
  };
68506
68515
  const defaultValidateExcelColumns = [
68507
68516
  {
@@ -68509,7 +68518,7 @@ const ModalImportComponent = (props) => {
68509
68518
  headerText: 'Row',
68510
68519
  fixedType: 'left',
68511
68520
  textAlign: 'center',
68512
- width: 80
68521
+ width: 80,
68513
68522
  },
68514
68523
  {
68515
68524
  field: 'result',
@@ -68517,8 +68526,8 @@ const ModalImportComponent = (props) => {
68517
68526
  fixedType: 'left',
68518
68527
  width: 140,
68519
68528
  template: (props) => {
68520
- return props.errors?.length === 0 ? jsxRuntime.jsx("span", { className: "text-success", children: t('Valid') }) : jsxRuntime.jsx("span", { className: "text-danger", children: t('Invalid') });
68521
- }
68529
+ return props.errors?.length === 0 ? (jsxRuntime.jsx("span", { className: "text-success", children: t('Valid') })) : (jsxRuntime.jsx("span", { className: "text-danger", children: t('Invalid') }));
68530
+ },
68522
68531
  },
68523
68532
  {
68524
68533
  field: 'errorDetail',
@@ -68529,8 +68538,8 @@ const ModalImportComponent = (props) => {
68529
68538
  return (jsxRuntime.jsx("div", { children: props.errors?.map((item, index) => {
68530
68539
  return (jsxRuntime.jsxs("div", { className: "d-flex text-danger align-items-center", children: [jsxRuntime.jsx(SvgCircle, { fontSize: 6, className: "me-50 " }), jsxRuntime.jsx("div", { style: { fontSize: '12px' }, children: t(item) })] }, index));
68531
68540
  }) }));
68532
- }
68533
- }
68541
+ },
68542
+ },
68534
68543
  ];
68535
68544
  const handleFormOpened = () => {
68536
68545
  if (getGeneralSettingApi) {
@@ -68563,8 +68572,8 @@ const ModalImportComponent = (props) => {
68563
68572
  headerText: e.header,
68564
68573
  width: e.width ?? 150,
68565
68574
  type: getDataType(e),
68566
- template: e.template
68567
- }))
68575
+ template: e.template,
68576
+ })),
68568
68577
  ]);
68569
68578
  }
68570
68579
  };
@@ -68580,29 +68589,31 @@ const ModalImportComponent = (props) => {
68580
68589
  setValue('step', 2);
68581
68590
  }
68582
68591
  };
68583
- return (jsxRuntime.jsx(Modal$1, { isOpen: openModal, toggle: handleModal, backdrop: "static", className: "modal-dialog-centered modal-xl", contentClassName: "p-0", onOpened: handleFormOpened, onClosed: handleModalClosed, children: jsxRuntime.jsxs(Form$1, { id: "form-modal-globalzone", className: "todo-modal modal-form-content", children: [jsxRuntime.jsx(ModalHeader, { typeModal: 'Import', handleModal: handleModal, title: "Import Excel" }), jsxRuntime.jsx(Scrollbars, { autoHide: true, autoHeight: true, autoHeightMax: windowSize.innerHeight - 120, children: jsxRuntime.jsx(ModalBody$1, { children: jsxRuntime.jsx("div", { style: { marginTop: '-25px' }, className: "modern-horizontal-wizard", children: jsxRuntime.jsx(Wizard, { activeStep: watch('step'), type: "modern-horizontal", steps: [
68592
+ return (jsxRuntime.jsx(Modal$1, { isOpen: openModal, style: style, toggle: handleModal, backdrop: "static", className: "modal-dialog-centered modal-xl", contentClassName: "p-0", onOpened: handleFormOpened, onClosed: handleModalClosed, children: jsxRuntime.jsxs(Form$1, { id: "form-modal-globalzone", className: "todo-modal modal-form-content", children: [jsxRuntime.jsx(ModalHeader, { typeModal: 'Import', handleModal: handleModal, title: "Import Excel" }), jsxRuntime.jsx(Scrollbars, { autoHide: true, autoHeight: true, autoHeightMax: windowSize.innerHeight - 120, children: jsxRuntime.jsx(ModalBody$1, { children: jsxRuntime.jsx("div", { style: { marginTop: '-25px' }, className: "modern-horizontal-wizard", children: jsxRuntime.jsx(Wizard, { activeStep: watch('step'), type: "modern-horizontal", steps: [
68584
68593
  {
68585
68594
  id: 'upload-file',
68586
68595
  title: t('Upload file'),
68587
- content: jsxRuntime.jsx(TabSelectFileImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, watch: watch, templateUrl: templateUrl })
68596
+ content: (jsxRuntime.jsx(TabSelectFileImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, watch: watch, templateUrl: templateUrl })),
68588
68597
  },
68589
68598
  {
68590
68599
  id: 'merge-data',
68591
68600
  title: t('Merge data fields'),
68592
- content: jsxRuntime.jsx(TabMergeImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, formatNumber: formatNumber, watch: watch, optionField: optionField, windowSize: windowSize })
68601
+ content: (jsxRuntime.jsx(TabMergeImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, formatNumber: formatNumber, watch: watch, optionField: optionField, windowSize: windowSize })),
68593
68602
  },
68594
68603
  {
68595
68604
  id: 'validate-data',
68596
68605
  title: t('Validate data'),
68597
- content: jsxRuntime.jsx(TabValidateImportExcel, { formatNumber: formatNumber, dataInvalid: dataInvalid, dataValid: dataValid, dataValidate: dataValidate, headerValidateExcelColumns: validateExcelColumns, windowSize: windowSize })
68606
+ content: (jsxRuntime.jsx(TabValidateImportExcel, { formatNumber: formatNumber, dataInvalid: dataInvalid, dataValid: dataValid, dataValidate: dataValidate, headerValidateExcelColumns: validateExcelColumns, windowSize: windowSize })),
68598
68607
  },
68599
68608
  {
68600
68609
  id: 'handle-error',
68601
68610
  title: t('Error result'),
68602
68611
  visible: !!headerErrorExcelColumns,
68603
- content: jsxRuntime.jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
68604
- }
68605
- ] }) }) }) }), jsxRuntime.jsxs("div", { className: "d-flex justify-content-between align-items-center p-1", style: { boxShadow: '0 4px 24px 0 rgb(34 41 47 / 10%)' }, children: [jsxRuntime.jsx("div", { className: "d-flex align-items-center", children: watch('step') === 2 && getGeneralSettingApi && updateGeneralSettingApi && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$1, { checked: isSaveSetting, type: "checkbox", className: "me-50", onChange: (val) => {
68612
+ content: (jsxRuntime.jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })),
68613
+ },
68614
+ ] }) }) }) }), jsxRuntime.jsxs("div", { className: "d-flex justify-content-between align-items-center p-1", style: { boxShadow: '0 4px 24px 0 rgb(34 41 47 / 10%)' }, children: [jsxRuntime.jsx("div", { className: "d-flex align-items-center", children: watch('step') === 2 &&
68615
+ getGeneralSettingApi &&
68616
+ updateGeneralSettingApi && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$1, { checked: isSaveSetting, type: "checkbox", className: "me-50", onChange: (val) => {
68606
68617
  setIsSaveSetting(val.target.checked);
68607
68618
  } }), jsxRuntime.jsx("span", { children: "L\u01B0u th\u00F4ng tin gh\u00E9p tr\u01B0\u1EDDng d\u1EEF li\u1EC7u" })] })) }), jsxRuntime.jsxs("div", { className: "d-flex align-items-center", children: [jsxRuntime.jsx(Button$1$1, { disabled: !getValues('file'), color: "primary", outline: true, className: `update-btn update-todo-item me-1 ${watch('step') !== 1 ? '' : 'd-none'}`, onClick: handleBackStep, children: t('Back') }), jsxRuntime.jsx(Button$1$1, { className: `update-btn update-todo-item me-1 ${watch('step') !== 3 ? '' : 'd-none'}`, disabled: !watch('file') || checkInitValidate, color: "primary", onClick: handleSubmit(onSubmit), children: t('Next') }), jsxRuntime.jsx(Button$1$1, { className: `update-btn update-todo-item me-1 ${watch('step') === 3 ? '' : 'd-none'}`, disabled: dataValid.length === 0 || !getValues('file') || checkInit, color: "primary", onClick: handleSubmit(onSubmit), children: t('Import') }), jsxRuntime.jsx(Button$1$1, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
68608
68619
  };
@@ -68737,21 +68748,32 @@ const UnExpandAllIcon = ({ className, color = '#7F7F7F', size = 24, onClick, sty
68737
68748
  };
68738
68749
 
68739
68750
  const RenderContentCol = (props) => {
68740
- const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, fieldKey, isMulti, } = props;
68751
+ const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, fieldKey, isMulti } = props;
68741
68752
  const cellId = `content-${idTable}-row${indexRow}col-${indexCol}`;
68742
68753
  const checkOverflow = () => {
68743
68754
  const element = document.getElementById(cellId);
68744
68755
  return element && element.scrollWidth > element.clientWidth;
68745
68756
  };
68757
+ const toggleSelect = () => {
68758
+ const idx = selectedRows?.findIndex((x) => x?.[fieldKey] === row?.[fieldKey]);
68759
+ if (idx > -1) {
68760
+ if (isMulti) {
68761
+ return selectedRows?.filter((_, i) => i !== idx);
68762
+ }
68763
+ return [];
68764
+ }
68765
+ if (isMulti) {
68766
+ return [...selectedRows, row];
68767
+ }
68768
+ return [row];
68769
+ };
68746
68770
  const RenderElement = () => {
68747
68771
  if (col.field === '#' || col.type === '#') {
68748
68772
  return (jsxRuntime.jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer text-center', {
68749
- 'r-active-cell': isSelected,
68773
+ 'r-active-cell': isSelected
68750
68774
  }), style: {
68751
- fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
68752
- ? 600
68753
- : 400,
68754
- fontStyle: row.haveItalicType ? 'italic' : 'normal',
68775
+ fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
68776
+ fontStyle: row.haveItalicType ? 'italic' : 'normal'
68755
68777
  }, onDoubleClick: (e) => {
68756
68778
  e.preventDefault();
68757
68779
  handleCloseContext();
@@ -68760,34 +68782,13 @@ const RenderContentCol = (props) => {
68760
68782
  }
68761
68783
  else if (col.type === 'checkbox' || col.field === 'checkbox') {
68762
68784
  return (jsxRuntime.jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer', {
68763
- 'r-active-cell': isSelected,
68785
+ 'r-active-cell': isSelected
68764
68786
  }), style: {
68765
68787
  display: 'flex',
68766
- justifyContent: col.textAlign === 'center'
68767
- ? 'center'
68768
- : col.textAlign === 'right'
68769
- ? 'flex-end'
68770
- : 'flex-start',
68771
- alignItems: 'center',
68788
+ justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start',
68789
+ alignItems: 'center'
68772
68790
  }, onClick: (e) => {
68773
- const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
68774
- if (index > -1) {
68775
- if (isMulti) {
68776
- selectedRows?.splice(index, 1);
68777
- setSelectedRows([...selectedRows]);
68778
- }
68779
- else {
68780
- setSelectedRows([]);
68781
- }
68782
- }
68783
- else {
68784
- if (isMulti) {
68785
- setSelectedRows([...selectedRows, row]);
68786
- }
68787
- else {
68788
- setSelectedRows([row]);
68789
- }
68790
- }
68791
+ setSelectedRows(toggleSelect());
68791
68792
  e.stopPropagation();
68792
68793
  }, children: jsxRuntime.jsx(Input$1, { defaultChecked: isSelected, type: "checkbox", className: "cursor-pointer", style: { textAlign: col.textAlign ?? 'center' } }) }));
68793
68794
  }
@@ -68795,11 +68796,8 @@ const RenderContentCol = (props) => {
68795
68796
  let value = row[col.field];
68796
68797
  // ✅ Format dữ liệu theo loại cột
68797
68798
  if (col.type === 'numeric') {
68798
- value =
68799
- formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
68800
- if (!zeroVisiable &&
68801
- !(row?.sortOrder < 0 || row?.sortOrder > 100000) &&
68802
- (value === '0' || value === 0)) {
68799
+ value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
68800
+ if (!zeroVisiable && !(row?.sortOrder < 0 || row?.sortOrder > 100000) && (value === '0' || value === 0)) {
68803
68801
  value = '';
68804
68802
  }
68805
68803
  }
@@ -68807,88 +68805,75 @@ const RenderContentCol = (props) => {
68807
68805
  value = value ? formatDateTime(value, formatSetting?.dateFormat) : '';
68808
68806
  }
68809
68807
  else if (col.type === 'datetime') {
68810
- value = value
68811
- ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
68812
- : '';
68808
+ value = value ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm') : '';
68813
68809
  }
68814
68810
  if (col.template) {
68815
68811
  value = col.template(row, indexRow) ?? '';
68816
68812
  }
68817
68813
  const isNegative = col.type === 'numeric' && Number(row[col.field]) < 0;
68818
- const textColor = isNegative
68819
- ? (formatSetting?.colorNegative ?? 'red')
68820
- : undefined;
68821
- const prefix = isNegative ? (formatSetting?.prefixNegative ?? '-') : '';
68822
- const suffix = isNegative ? (formatSetting?.suffixNegative ?? '') : '';
68823
- const displayText = isNegative
68824
- ? `${prefix}${value}${suffix}`
68825
- : (value ?? '');
68814
+ const textColor = isNegative ? formatSetting?.colorNegative ?? 'red' : undefined;
68815
+ const prefix = isNegative ? formatSetting?.prefixNegative ?? '-' : '';
68816
+ const suffix = isNegative ? formatSetting?.suffixNegative ?? '' : '';
68817
+ const displayText = isNegative ? `${prefix}${value}${suffix}` : value ?? '';
68826
68818
  return (jsxRuntime.jsxs("div", { className: classNames$1('r-rowcell-div cursor-pointer', {
68827
- 'r-active-cell': isSelected,
68819
+ 'r-active-cell': isSelected
68828
68820
  }), style: {
68829
- fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
68830
- ? 600
68831
- : 400,
68832
- fontStyle: row.haveItalicType ? 'italic' : 'normal',
68833
- }, onDoubleClick: (e) => {
68834
- e.preventDefault();
68835
- handleCloseContext();
68836
- handleDoubleClick?.(row, col);
68821
+ fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
68822
+ fontStyle: row.haveItalicType ? 'italic' : 'normal'
68837
68823
  }, children: [jsxRuntime.jsx("div", { className: "r-cell-text", style: {
68838
68824
  display: 'flex',
68839
- justifyContent: col.textAlign === 'center'
68840
- ? 'center'
68841
- : col.textAlign === 'right'
68842
- ? 'flex-end'
68843
- : 'flex-start',
68844
- alignItems: 'center',
68825
+ justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start',
68826
+ alignItems: 'center'
68845
68827
  }, children: jsxRuntime.jsx("div", { id: cellId, style: {
68846
68828
  color: textColor,
68847
68829
  overflow: 'hidden',
68848
68830
  textOverflow: 'ellipsis',
68849
68831
  whiteSpace: 'pre',
68850
- maxWidth: '100%',
68832
+ maxWidth: '100%'
68851
68833
  }, children: displayText }) }), checkOverflow() && (jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: cellId, placement: "top", children: jsxRuntime.jsx("div", { style: { color: textColor }, onClick: (e) => {
68852
68834
  e.stopPropagation();
68853
68835
  e.preventDefault();
68854
68836
  }, children: displayText }) }))] }));
68855
68837
  }
68856
68838
  };
68839
+ const clickTimerRef = React$5.useRef(null);
68857
68840
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: col.visible !== false && col.isGroup !== true && (jsxRuntime.jsx("td", { className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, {
68858
- 'fixed-last': (col.fixedType === 'left' &&
68859
- indexCol === lastObjWidthFixLeft) ||
68860
- (col.fixedType === 'right' &&
68861
- indexCol === fisrtObjWidthFixRight),
68841
+ 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight)
68862
68842
  }, { 'r-active': isSelected }), style: {
68863
68843
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
68864
- right: col.fixedType === 'right'
68865
- ? objWidthFixRight[indexCol]
68866
- : undefined,
68844
+ right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined
68867
68845
  }, onClick: (e) => {
68868
- if (e.target.nodeName === 'DIV' || e.target.nodeName === 'TD') {
68869
- const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
68870
- if (index > -1) {
68871
- if (isMulti) {
68872
- selectedRows?.splice(index, 1);
68873
- setSelectedRows([...selectedRows]);
68874
- }
68875
- else {
68876
- setSelectedRows([]);
68877
- }
68878
- }
68879
- else {
68880
- if (isMulti) {
68881
- setSelectedRows([...selectedRows, row]);
68882
- }
68883
- else {
68884
- setSelectedRows([row]);
68885
- }
68886
- }
68846
+ const tag = e.target?.nodeName;
68847
+ if (tag !== 'DIV' && tag !== 'TD') {
68848
+ return;
68849
+ }
68850
+ if (clickTimerRef.current) {
68851
+ window.clearTimeout(clickTimerRef.current);
68887
68852
  }
68853
+ if (handleDoubleClick) {
68854
+ clickTimerRef.current = window.setTimeout(() => {
68855
+ setSelectedRows(toggleSelect());
68856
+ clickTimerRef.current = null;
68857
+ }, 200);
68858
+ }
68859
+ else {
68860
+ setSelectedRows(toggleSelect());
68861
+ clickTimerRef.current = null;
68862
+ }
68863
+ }, onDoubleClick: (e) => {
68864
+ // hủy single click pending để không đổi style trước
68865
+ if (clickTimerRef.current) {
68866
+ window.clearTimeout(clickTimerRef.current);
68867
+ }
68868
+ clickTimerRef.current = null;
68869
+ handleCloseContext();
68870
+ handleDoubleClick?.(row, col);
68871
+ e.preventDefault();
68872
+ e.stopPropagation();
68888
68873
  }, children: RenderElement() }, `col-${indexRow}-${indexCol}`)) }));
68889
68874
  };
68890
68875
 
68891
- 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, contextMenuItems, handleContextMenuClick, }) => {
68876
+ 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, contextMenuItems, handleContextMenuClick }) => {
68892
68877
  const { t } = reactI18next.useTranslation();
68893
68878
  const gridRef = React$5.useRef(null);
68894
68879
  const [openPopupSetupColumn, setOpenPopupSetupColumn] = React$5.useState(false);
@@ -68896,8 +68881,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68896
68881
  const [orderBy, setOrderBy] = React$5.useState([]);
68897
68882
  const [filterBy, setFilterBy] = React$5.useState([]);
68898
68883
  const [searchTerm, setSearchTerm] = React$5.useState('');
68899
- const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ??
68900
- 'id';
68884
+ const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? 'id';
68901
68885
  const [contentColumns, setContentColumns] = React$5.useState([]);
68902
68886
  const [groupColumns, setGroupColumns] = React$5.useState([]);
68903
68887
  const [expandsAll, setExpandsAll] = React$5.useState(true);
@@ -68916,7 +68900,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68916
68900
  }
68917
68901
  setExpandsAll(true);
68918
68902
  }, [groupSetting?.groupColumns]);
68919
- const { levels: headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, } = React$5.useMemo(() => {
68903
+ const { levels: headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = React$5.useMemo(() => {
68920
68904
  const rs = calculateTableStructure(columns, settingColumns?.value, groupSetting?.groupColumns);
68921
68905
  setContentColumns(rs.flat);
68922
68906
  return rs;
@@ -68945,10 +68929,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68945
68929
  if (searchTerm) {
68946
68930
  datas = datas.filter((row) => {
68947
68931
  return searchSetting?.keyField?.some((key) => {
68948
- return row[key]
68949
- ?.toString()
68950
- .toLowerCase()
68951
- .includes(searchTerm.trim().toLowerCase());
68932
+ return row[key]?.toString().toLowerCase().includes(searchTerm.trim().toLowerCase());
68952
68933
  });
68953
68934
  });
68954
68935
  }
@@ -68957,10 +68938,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68957
68938
  return filterBy.every((filter) => {
68958
68939
  const { key, value, ope } = filter;
68959
68940
  const rowValue = row[key];
68960
- if (rowValue === undefined ||
68961
- rowValue === null ||
68962
- value === undefined ||
68963
- value === null) {
68941
+ if (rowValue === undefined || rowValue === null || value === undefined || value === null) {
68964
68942
  return false;
68965
68943
  }
68966
68944
  const valStr = String(rowValue).toLowerCase();
@@ -69023,17 +69001,12 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69023
69001
  }
69024
69002
  };
69025
69003
  const searchTemplate = () => {
69026
- return (jsxRuntime.jsx("div", { className: "me-50 r-search", children: jsxRuntime.jsx(ReactInput, { style: { width: '230px' }, value: searchSetting?.searchTerm !== undefined
69027
- ? searchSetting?.searchTerm
69028
- : searchTerm, setSearchTerm: searchSetting?.setSearchTerm
69029
- ? searchSetting?.setSearchTerm
69030
- : setSearchTerm, placeholder: t('Search'), onKeyPress: handleKeyPress }) }));
69004
+ return (jsxRuntime.jsx("div", { className: "me-50 r-search", children: jsxRuntime.jsx(ReactInput, { style: { width: '230px' }, value: searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm, setSearchTerm: searchSetting?.setSearchTerm ? searchSetting?.setSearchTerm : setSearchTerm, placeholder: t('Search'), onKeyPress: handleKeyPress }) }));
69031
69005
  };
69032
69006
  const groupbtnTemplate = () => {
69033
69007
  return (jsxRuntime.jsxs(UncontrolledDropdown, { children: [jsxRuntime.jsx(DropdownToggle$1, { tag: "div", id: "group-dropdown-toggle", style: { position: 'relative' }, onClick: (e) => e.preventDefault(), children: jsxRuntime.jsx(GroupIcon, { color: "#7F7F7F", size: 24 }) }), jsxRuntime.jsxs(DropdownMenu$1, { className: "formula-dropdown icon-dropdown p-1", children: [jsxRuntime.jsx("div", { className: "mb-1", style: { fontSize: 16, fontWeight: 500 }, children: "Nh\u00F3m d\u1EEF li\u1EC7u theo c\u1ED9t" }), jsxRuntime.jsxs("div", { className: 'form-group', children: [jsxRuntime.jsx(Label$1, { id: `label-group-1`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 1" }), jsxRuntime.jsx("div", { className: "form-input", children: jsxRuntime.jsx(SelectTable, { options: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[0]
69034
69008
  ? {
69035
- headerText: t(contentColumns.find((x) => x.field === groupColumns[0])?.headerText ??
69036
- contentColumns.find((x) => x.field === groupColumns[0])?.headerText),
69009
+ headerText: t(contentColumns.find((x) => x.field === groupColumns[0])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[0])?.headerText)
69037
69010
  }
69038
69011
  : undefined, onChange: (val) => {
69039
69012
  if (val) {
@@ -69045,8 +69018,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69045
69018
  setGroupColumns([...groupColumns]);
69046
69019
  }, isClearable: groupColumns?.length === 1 }) })] }), jsxRuntime.jsxs("div", { className: 'form-group', children: [jsxRuntime.jsx(Label$1, { id: `label-group-2`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 2" }), jsxRuntime.jsx("div", { className: "form-input", children: jsxRuntime.jsx(SelectTable, { options: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[1]
69047
69020
  ? {
69048
- headerText: t(contentColumns.find((x) => x.field === groupColumns[1])?.headerText ??
69049
- contentColumns.find((x) => x.field === groupColumns[1])?.headerText),
69021
+ headerText: t(contentColumns.find((x) => x.field === groupColumns[1])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[1])?.headerText)
69050
69022
  }
69051
69023
  : undefined, onChange: (val) => {
69052
69024
  if (val) {
@@ -69058,8 +69030,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69058
69030
  setGroupColumns([...groupColumns]);
69059
69031
  }, isClearable: groupColumns?.length === 2 }) })] }), jsxRuntime.jsxs("div", { className: 'form-group', children: [jsxRuntime.jsx(Label$1, { id: `label-group-3`, style: { fontWeight: 500, fontSize: 13 }, children: "M\u1EE9c 3" }), jsxRuntime.jsx("div", { className: "form-input", children: jsxRuntime.jsx(SelectTable, { options: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[2]
69060
69032
  ? {
69061
- headerText: t(contentColumns.find((x) => x.field === groupColumns[2])?.headerText ??
69062
- contentColumns.find((x) => x.field === groupColumns[2])?.headerText),
69033
+ headerText: t(contentColumns.find((x) => x.field === groupColumns[2])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[2])?.headerText)
69063
69034
  }
69064
69035
  : undefined, onChange: (val) => {
69065
69036
  if (groupSetting) {
@@ -69073,7 +69044,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69073
69044
  }
69074
69045
  }, isClearable: groupColumns?.length === 3 }) })] }), jsxRuntime.jsxs("div", { className: "border-top d-flex justify-content-end mt-1", children: [jsxRuntime.jsx(Button$1$1, { color: "primary", className: "mt-1 me-50 rounded", size: "sm", onClick: () => {
69075
69046
  groupSetting?.onGroup({
69076
- columnGrouped: groupColumns.filter((x) => x),
69047
+ columnGrouped: groupColumns.filter((x) => x)
69077
69048
  });
69078
69049
  document.getElementById('group-dropdown-toggle')?.click();
69079
69050
  }, children: `${t('Apply')}` }), jsxRuntime.jsx(Button$1$1, { color: "secondary", outline: true, className: "mt-1 rounded", size: "sm", onClick: () => {
@@ -69082,16 +69053,14 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69082
69053
  }, children: `${t('Delete')}` })] })] })] }));
69083
69054
  };
69084
69055
  const chooseColumnsTemplate = () => {
69085
- return (jsxRuntime.jsx(SvgSettings, { className: "r-toolbar-icon", fontSize: 20, color: "#7F7F7F", onClick: () => setOpenPopupSetupColumn(true) }));
69056
+ return jsxRuntime.jsx(SvgSettings, { className: "r-toolbar-icon", fontSize: 20, color: "#7F7F7F", onClick: () => setOpenPopupSetupColumn(true) });
69086
69057
  };
69087
69058
  const expandTemplate = () => {
69088
69059
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!expandsAll && (jsxRuntime.jsx(ExpandAllIcon, { onClick: () => {
69089
69060
  setExpandsAll(true);
69090
- }, color: "#7F7F7F", size: 24 })), expandsAll && (jsxRuntime.jsx(UnExpandAllIcon, { onClick: () => setExpandsAll(false), color: "#7F7F7F", size: 24 }))] }));
69061
+ }, color: "#7F7F7F", size: 24 })), expandsAll && jsxRuntime.jsx(UnExpandAllIcon, { onClick: () => setExpandsAll(false), color: "#7F7F7F", size: 24 })] }));
69091
69062
  };
69092
- const defaultToolbarOption = searchSetting?.searchEnable
69093
- ? [{ template: searchTemplate, align: 'left' }]
69094
- : [];
69063
+ const defaultToolbarOption = searchSetting?.searchEnable ? [{ template: searchTemplate, align: 'left' }] : [];
69095
69064
  if (groupSetting) {
69096
69065
  defaultToolbarOption.push({ template: groupbtnTemplate, align: 'left' });
69097
69066
  }
@@ -69100,10 +69069,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69100
69069
  }
69101
69070
  let toolbarTopOption = [];
69102
69071
  if (toolbarSetting?.toolbarOptions) {
69103
- toolbarTopOption = [
69104
- ...defaultToolbarOption,
69105
- ...toolbarSetting?.toolbarOptions,
69106
- ];
69072
+ toolbarTopOption = [...defaultToolbarOption, ...toolbarSetting?.toolbarOptions];
69107
69073
  }
69108
69074
  else {
69109
69075
  toolbarTopOption = [...defaultToolbarOption];
@@ -69134,9 +69100,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69134
69100
  React$5.useEffect(() => {
69135
69101
  if (setSelectedItem) {
69136
69102
  if (isMulti) {
69137
- if (dataSource &&
69138
- selectedRows &&
69139
- selectedRows?.length !== selectedItem?.length) {
69103
+ if (dataSource && selectedRows && selectedRows?.length !== selectedItem?.length) {
69140
69104
  setSelectedItem([...selectedRows]);
69141
69105
  if (handleSelect) {
69142
69106
  handleSelect([...selectedRows]);
@@ -69145,8 +69109,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69145
69109
  }
69146
69110
  else {
69147
69111
  if (dataSource && selectedRows?.length > 0) {
69148
- if (!selectedItem ||
69149
- selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
69112
+ if (!selectedItem || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
69150
69113
  setSelectedItem({ ...selectedRows[0] });
69151
69114
  if (handleSelect) {
69152
69115
  handleSelect({ ...selectedRows[0] });
@@ -69165,8 +69128,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69165
69128
  React$5.useEffect(() => {
69166
69129
  if (!isMulti) {
69167
69130
  if (dataSource && selectedItem && selectedItem[fieldKey]) {
69168
- if (selectedRows?.length === 0 ||
69169
- selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
69131
+ if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
69170
69132
  setSelectedRows([selectedItem]);
69171
69133
  }
69172
69134
  }
@@ -69175,9 +69137,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69175
69137
  }
69176
69138
  }
69177
69139
  else {
69178
- if (dataSource &&
69179
- selectedItem &&
69180
- selectedRows?.length !== selectedItem.length) {
69140
+ if (dataSource && selectedItem && selectedRows?.length !== selectedItem.length) {
69181
69141
  setSelectedRows(selectedItem ? [...selectedItem] : []);
69182
69142
  }
69183
69143
  }
@@ -69195,67 +69155,52 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69195
69155
  const col = contentColumns.find((x) => x.field === row.field);
69196
69156
  let value = row[col.field];
69197
69157
  if (col.type === 'numeric') {
69198
- value =
69199
- formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
69158
+ value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
69200
69159
  }
69201
69160
  else if (col.type === 'date') {
69202
- value = value
69203
- ? formatDateTime(value, formatSetting?.dateFormat)
69204
- : '';
69161
+ value = value ? formatDateTime(value, formatSetting?.dateFormat) : '';
69205
69162
  }
69206
69163
  else if (col.type === 'datetime') {
69207
- value = value
69208
- ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
69209
- : '';
69164
+ value = value ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm') : '';
69210
69165
  }
69211
69166
  if (col.template) {
69212
69167
  value = col.template(row, indexRow) ?? '';
69213
69168
  }
69214
69169
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsxRuntime.jsx("td", { className: "r-rowcell r-cell-group", colSpan: 3, children: jsxRuntime.jsxs("div", { className: "r-rowcell-div", children: [jsxRuntime.jsx(SvgChevronRight, { style: {
69215
69170
  marginLeft: level * 20,
69216
- transform: expand ? 'rotate(90deg)' : 'rotate(0deg)',
69171
+ transform: expand ? 'rotate(90deg)' : 'rotate(0deg)'
69217
69172
  }, fontSize: 15, onClick: () => {
69218
69173
  setExpand(!expand);
69219
69174
  setExpandsAll(undefined);
69220
69175
  row.expand = !expand;
69221
69176
  } }), t(col.headerDisplay ?? col.headerText), ": ", value, " (", row.children.length, ")"] }) }), contentColumns.map((colSum, indexCol) => {
69222
- if (indexCol <= firstColSpan ||
69223
- colSum.visible === false ||
69224
- colSum.isGroup === true) {
69177
+ if (indexCol <= firstColSpan || colSum.visible === false || colSum.isGroup === true) {
69225
69178
  return;
69226
69179
  }
69227
69180
  let sumValue = row[colSum.field];
69228
- const haveSum = row[colSum.field] !== undefined &&
69229
- row[colSum.field] !== null;
69230
- if (!haveSum &&
69231
- colSum.haveSum === true &&
69232
- colSum.type === 'numeric') {
69181
+ const haveSum = row[colSum.field] !== undefined && row[colSum.field] !== null;
69182
+ if (!haveSum && colSum.haveSum === true && colSum.type === 'numeric') {
69233
69183
  sumValue = row.children.reduce(function (accumulator, currentValue) {
69234
- return (Number(accumulator ?? 0) +
69235
- Number(currentValue[colSum.field] ?? 0));
69184
+ return Number(accumulator ?? 0) + Number(currentValue[colSum.field] ?? 0);
69236
69185
  }, 0);
69237
69186
  }
69238
69187
  if (colSum.type === 'numeric') {
69239
69188
  sumValue = formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', colSum.numericSettings?.fraction, true, false);
69240
- if (!zeroVisiable &&
69241
- (sumValue === '0' || sumValue === 0)) {
69189
+ if (!zeroVisiable && (sumValue === '0' || sumValue === 0)) {
69242
69190
  sumValue = '';
69243
69191
  }
69244
69192
  }
69245
69193
  return (jsxRuntime.jsx("td", { className: "r-rowcell r-cell-sum-group", children: jsxRuntime.jsx("div", { className: "r-rowcell-div", style: {
69246
- justifyContent: colSum.textAlign
69247
- ? colSum.textAlign
69248
- : 'left',
69249
- }, children: (haveSum || colSum.haveSum === true) &&
69250
- Number(row[colSum.field] ?? '0') < 0 ? (jsxRuntime.jsxs("div", { style: {
69251
- color: formatSetting?.colorNegative ?? 'red',
69194
+ justifyContent: colSum.textAlign ? colSum.textAlign : 'left'
69195
+ }, children: (haveSum || colSum.haveSum === true) && Number(row[colSum.field] ?? '0') < 0 ? (jsxRuntime.jsxs("div", { style: {
69196
+ color: formatSetting?.colorNegative ?? 'red'
69252
69197
  }, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] })) : (sumValue) }) }, `group-sum-cell-${level}-${indexRow}-${indexCol}`));
69253
- })] }), expand && (jsxRuntime.jsx(RenderContent, { datas: row.children, level: level + 1 }))] }, `row-${level}-${indexRow}`));
69198
+ })] }), expand && jsxRuntime.jsx(RenderContent, { datas: row.children, level: level + 1 })] }, `row-${level}-${indexRow}`));
69254
69199
  }
69255
69200
  else {
69256
69201
  const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
69257
69202
  return (jsxRuntime.jsx("tr", { id: `row-content-${indexRow}`, "aria-rowindex": indexRow + 1, role: "row", className: classNames$1('r-row', {
69258
- 'r-last-row': level === 0 && indexRow === viewData.length - 1,
69203
+ 'r-last-row': level === 0 && indexRow === viewData.length - 1
69259
69204
  }), onContextMenu: (e) => {
69260
69205
  e.preventDefault();
69261
69206
  handleContextMenu(e, row);
@@ -69271,7 +69216,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69271
69216
  x: e.clientX,
69272
69217
  y: e.clientY,
69273
69218
  row,
69274
- show: true,
69219
+ show: true
69275
69220
  });
69276
69221
  }, 100);
69277
69222
  };
@@ -69286,9 +69231,9 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69286
69231
  virtualDivRef.current.style.height = '0px';
69287
69232
  }
69288
69233
  }, [context]);
69289
- return (jsxRuntime.jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxRuntime.jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && (jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption })), headerComponent && headerComponent(), jsxRuntime.jsxs("div", { ref: gridRef, className: "r-gridtable", style: {
69234
+ return (jsxRuntime.jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxRuntime.jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), headerComponent && headerComponent(), jsxRuntime.jsxs("div", { ref: gridRef, className: "r-gridtable", style: {
69290
69235
  height: `${height ? `${height}px` : 'auto'}`,
69291
- position: 'relative',
69236
+ position: 'relative'
69292
69237
  }, children: [jsxRuntime.jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: contentColumns }), jsxRuntime.jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => {
69293
69238
  return (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((col, index) => (jsxRuntime.jsx(HeaderTableCol, { col: col, idTable: idTable ?? '', dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, selectEnable: true, selectedRows: selectedRows, setSelectedRows: setSelectedRows, container: gridRef, filterBy: filterBy, orderBy: orderBy, optionsFilter: querySetting?.optionsFilter, allowFiltering: querySetting?.allowFiltering, allowSorting: querySetting?.allowSorting, formatSetting: formatSetting, changeFilter: (val) => {
69294
69239
  setFilterBy([...val]);
@@ -69307,32 +69252,22 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69307
69252
  }
69308
69253
  const item = columnsAggregate?.find((x) => x.field === col.field);
69309
69254
  let sumValue = item?.value;
69310
- if (!item &&
69311
- col.haveSum === true &&
69312
- col.type === 'numeric') {
69255
+ if (!item && col.haveSum === true && col.type === 'numeric') {
69313
69256
  sumValue = viewData.reduce(function (accumulator, currentValue) {
69314
- return (Number(accumulator ?? 0) +
69315
- Number(currentValue[col.field] ?? 0));
69257
+ return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
69316
69258
  }, 0);
69317
69259
  }
69318
69260
  if (col.type === 'numeric') {
69319
69261
  sumValue = formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false);
69320
69262
  }
69321
69263
  return (jsxRuntime.jsx("td", { className: classNames$1(`p-0 px-50 r-footer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
69322
- left: col.fixedType === 'left'
69323
- ? objWidthFixLeft[indexCol]
69324
- : undefined,
69325
- right: col.fixedType === 'right'
69326
- ? objWidthFixRight[indexCol]
69327
- : undefined,
69328
- textAlign: col.textAlign ? col.textAlign : 'left',
69329
- }, children: jsxRuntime.jsx("div", { className: "r-footer-div", children: (item || col.haveSum === true) &&
69330
- Number(item?.value ?? '0') < 0 ? (jsxRuntime.jsxs("div", { style: {
69331
- color: formatSetting?.colorNegative ?? 'red',
69264
+ left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
69265
+ right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
69266
+ textAlign: col.textAlign ? col.textAlign : 'left'
69267
+ }, children: jsxRuntime.jsx("div", { className: "r-footer-div", children: (item || col.haveSum === true) && Number(item?.value ?? '0') < 0 ? (jsxRuntime.jsxs("div", { style: {
69268
+ color: formatSetting?.colorNegative ?? 'red'
69332
69269
  }, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] })) : (sumValue) }) }, `summarycell-${indexCol}`));
69333
- }) })) })] }), jsxRuntime.jsx("div", { ref: virtualDivRef }), context &&
69334
- (contextMenuItems?.length ?? 0) > 0 &&
69335
- handleContextMenuClick && (jsxRuntime.jsx(Popover$1, { className: "r-context-popover", placement: "right-start", isOpen: context.show, target: virtualDivRef.current, toggle: handleCloseContext, fade: false, children: jsxRuntime.jsx(PopoverBody$1, { children: contextMenuItems?.map((item, index) => {
69270
+ }) })) })] }), jsxRuntime.jsx("div", { ref: virtualDivRef }), context && (contextMenuItems?.length ?? 0) > 0 && handleContextMenuClick && (jsxRuntime.jsx(Popover$1, { className: "r-context-popover", placement: "right-start", isOpen: context.show, target: virtualDivRef.current, toggle: handleCloseContext, fade: false, children: jsxRuntime.jsx(PopoverBody$1, { children: contextMenuItems?.map((item, index) => {
69336
69271
  return (jsxRuntime.jsxs("div", { className: "r-context-item", onClick: () => {
69337
69272
  handleCloseContext();
69338
69273
  handleContextMenuClick?.(item, context.row);
@@ -69347,7 +69282,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69347
69282
  visible: x.visible,
69348
69283
  fixedType: x.fixedType,
69349
69284
  width: x.width,
69350
- sortOrder: index + 1,
69285
+ sortOrder: index + 1
69351
69286
  })));
69352
69287
  }
69353
69288
  } })] }));