react-table-edit 1.5.36 → 1.5.37

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
@@ -68708,7 +68708,7 @@ const UnExpandAllIcon = ({ className, color = '#7F7F7F', size = 24, onClick, sty
68708
68708
  };
68709
68709
 
68710
68710
  const RenderContentCol = (props) => {
68711
- const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, fieldKey, isMulti } = props;
68711
+ const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, fieldKey, isMulti, } = props;
68712
68712
  const cellId = `content-${idTable}-row${indexRow}col-${indexCol}`;
68713
68713
  const checkOverflow = () => {
68714
68714
  const element = document.getElementById(cellId);
@@ -68716,9 +68716,13 @@ const RenderContentCol = (props) => {
68716
68716
  };
68717
68717
  const RenderElement = () => {
68718
68718
  if (col.field === '#' || col.type === '#') {
68719
- return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer text-center', { 'r-active-cell': isSelected }), style: {
68720
- fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
68721
- fontStyle: row.haveItalicType ? 'italic' : 'normal'
68719
+ return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer text-center', {
68720
+ 'r-active-cell': isSelected,
68721
+ }), style: {
68722
+ fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
68723
+ ? 600
68724
+ : 400,
68725
+ fontStyle: row.haveItalicType ? 'italic' : 'normal',
68722
68726
  }, onDoubleClick: (e) => {
68723
68727
  e.preventDefault();
68724
68728
  handleCloseContext();
@@ -68726,7 +68730,17 @@ const RenderContentCol = (props) => {
68726
68730
  }, children: indexRow + 1 }));
68727
68731
  }
68728
68732
  else if (col.type === 'checkbox' || col.field === 'checkbox') {
68729
- return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer', { 'r-active-cell': isSelected }), style: { display: 'flex', justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start', alignItems: 'center' }, onClick: (e) => {
68733
+ return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer', {
68734
+ 'r-active-cell': isSelected,
68735
+ }), style: {
68736
+ display: 'flex',
68737
+ justifyContent: col.textAlign === 'center'
68738
+ ? 'center'
68739
+ : col.textAlign === 'right'
68740
+ ? 'flex-end'
68741
+ : 'flex-start',
68742
+ alignItems: 'center',
68743
+ }, onClick: (e) => {
68730
68744
  const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
68731
68745
  if (index > -1) {
68732
68746
  if (isMulti) {
@@ -68752,8 +68766,11 @@ const RenderContentCol = (props) => {
68752
68766
  let value = row[col.field];
68753
68767
  // ✅ Format dữ liệu theo loại cột
68754
68768
  if (col.type === 'numeric') {
68755
- value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
68756
- if (!zeroVisiable && !(row?.sortOrder < 0 || row?.sortOrder > 100000) && (value === '0' || value === 0)) {
68769
+ value =
68770
+ formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
68771
+ if (!zeroVisiable &&
68772
+ !(row?.sortOrder < 0 || row?.sortOrder > 100000) &&
68773
+ (value === '0' || value === 0)) {
68757
68774
  value = '';
68758
68775
  }
68759
68776
  }
@@ -68761,42 +68778,63 @@ const RenderContentCol = (props) => {
68761
68778
  value = value ? formatDateTime(value, formatSetting?.dateFormat) : '';
68762
68779
  }
68763
68780
  else if (col.type === 'datetime') {
68764
- value = value ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm') : '';
68781
+ value = value
68782
+ ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
68783
+ : '';
68765
68784
  }
68766
68785
  if (col.template) {
68767
68786
  value = col.template(row, indexRow) ?? '';
68768
68787
  }
68769
68788
  const isNegative = col.type === 'numeric' && Number(row[col.field]) < 0;
68770
- const textColor = isNegative ? formatSetting?.colorNegative ?? 'red' : undefined;
68771
- const prefix = isNegative ? formatSetting?.prefixNegative ?? '-' : '';
68772
- const suffix = isNegative ? formatSetting?.suffixNegative ?? '' : '';
68773
- const displayText = isNegative ? `${prefix}${value}${suffix}` : value ?? '';
68774
- return (jsxs("div", { className: classNames$1('r-rowcell-div cursor-pointer', { 'r-active-cell': isSelected }), style: {
68775
- fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
68776
- fontStyle: row.haveItalicType ? 'italic' : 'normal'
68789
+ const textColor = isNegative
68790
+ ? (formatSetting?.colorNegative ?? 'red')
68791
+ : undefined;
68792
+ const prefix = isNegative ? (formatSetting?.prefixNegative ?? '-') : '';
68793
+ const suffix = isNegative ? (formatSetting?.suffixNegative ?? '') : '';
68794
+ const displayText = isNegative
68795
+ ? `${prefix}${value}${suffix}`
68796
+ : (value ?? '');
68797
+ return (jsxs("div", { className: classNames$1('r-rowcell-div cursor-pointer', {
68798
+ 'r-active-cell': isSelected,
68799
+ }), style: {
68800
+ fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
68801
+ ? 600
68802
+ : 400,
68803
+ fontStyle: row.haveItalicType ? 'italic' : 'normal',
68777
68804
  }, onDoubleClick: (e) => {
68778
68805
  e.preventDefault();
68779
68806
  handleCloseContext();
68780
68807
  handleDoubleClick?.(row, col);
68781
68808
  }, children: [jsx("div", { className: "r-cell-text", style: {
68782
68809
  display: 'flex',
68783
- justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start',
68784
- alignItems: 'center'
68810
+ justifyContent: col.textAlign === 'center'
68811
+ ? 'center'
68812
+ : col.textAlign === 'right'
68813
+ ? 'flex-end'
68814
+ : 'flex-start',
68815
+ alignItems: 'center',
68785
68816
  }, children: jsx("div", { id: cellId, style: {
68786
68817
  color: textColor,
68787
68818
  overflow: 'hidden',
68788
68819
  textOverflow: 'ellipsis',
68789
68820
  whiteSpace: 'pre',
68790
- maxWidth: '100%'
68821
+ maxWidth: '100%',
68791
68822
  }, children: displayText }) }), checkOverflow() && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: cellId, placement: "top", children: jsx("div", { style: { color: textColor }, onClick: (e) => {
68792
68823
  e.stopPropagation();
68793
68824
  e.preventDefault();
68794
68825
  }, children: displayText }) }))] }));
68795
68826
  }
68796
68827
  };
68797
- 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 }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': isSelected }), style: {
68828
+ 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 }, {
68829
+ 'fixed-last': (col.fixedType === 'left' &&
68830
+ indexCol === lastObjWidthFixLeft) ||
68831
+ (col.fixedType === 'right' &&
68832
+ indexCol === fisrtObjWidthFixRight),
68833
+ }, { 'r-active': isSelected }), style: {
68798
68834
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
68799
- right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined
68835
+ right: col.fixedType === 'right'
68836
+ ? objWidthFixRight[indexCol]
68837
+ : undefined,
68800
68838
  }, onClick: (e) => {
68801
68839
  if (e.target.nodeName === 'DIV' || e.target.nodeName === 'TD') {
68802
68840
  const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
@@ -68817,12 +68855,11 @@ const RenderContentCol = (props) => {
68817
68855
  setSelectedRows([row]);
68818
68856
  }
68819
68857
  }
68820
- e.stopPropagation();
68821
68858
  }
68822
68859
  }, children: RenderElement() }, `col-${indexRow}-${indexCol}`)) }));
68823
68860
  };
68824
68861
 
68825
- 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 }) => {
68862
+ 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, }) => {
68826
68863
  const { t } = useTranslation();
68827
68864
  const gridRef = useRef(null);
68828
68865
  const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState(false);
@@ -68830,7 +68867,8 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68830
68867
  const [orderBy, setOrderBy] = useState([]);
68831
68868
  const [filterBy, setFilterBy] = useState([]);
68832
68869
  const [searchTerm, setSearchTerm] = useState('');
68833
- const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? 'id';
68870
+ const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ??
68871
+ 'id';
68834
68872
  const [contentColumns, setContentColumns] = useState([]);
68835
68873
  const [groupColumns, setGroupColumns] = useState([]);
68836
68874
  const [expandsAll, setExpandsAll] = useState(true);
@@ -68849,7 +68887,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68849
68887
  }
68850
68888
  setExpandsAll(true);
68851
68889
  }, [groupSetting?.groupColumns]);
68852
- const { levels: headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = useMemo(() => {
68890
+ const { levels: headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, } = useMemo(() => {
68853
68891
  const rs = calculateTableStructure(columns, settingColumns?.value, groupSetting?.groupColumns);
68854
68892
  setContentColumns(rs.flat);
68855
68893
  return rs;
@@ -68878,7 +68916,10 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68878
68916
  if (searchTerm) {
68879
68917
  datas = datas.filter((row) => {
68880
68918
  return searchSetting?.keyField?.some((key) => {
68881
- return row[key]?.toString().toLowerCase().includes(searchTerm.trim().toLowerCase());
68919
+ return row[key]
68920
+ ?.toString()
68921
+ .toLowerCase()
68922
+ .includes(searchTerm.trim().toLowerCase());
68882
68923
  });
68883
68924
  });
68884
68925
  }
@@ -68887,7 +68928,10 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68887
68928
  return filterBy.every((filter) => {
68888
68929
  const { key, value, ope } = filter;
68889
68930
  const rowValue = row[key];
68890
- if (rowValue === undefined || rowValue === null || value === undefined || value === null) {
68931
+ if (rowValue === undefined ||
68932
+ rowValue === null ||
68933
+ value === undefined ||
68934
+ value === null) {
68891
68935
  return false;
68892
68936
  }
68893
68937
  const valStr = String(rowValue).toLowerCase();
@@ -68950,10 +68994,19 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68950
68994
  }
68951
68995
  };
68952
68996
  const searchTemplate = () => {
68953
- 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 }) }));
68997
+ return (jsx("div", { className: "me-50 r-search", children: jsx(ReactInput, { style: { width: '230px' }, value: searchSetting?.searchTerm !== undefined
68998
+ ? searchSetting?.searchTerm
68999
+ : searchTerm, setSearchTerm: searchSetting?.setSearchTerm
69000
+ ? searchSetting?.setSearchTerm
69001
+ : setSearchTerm, placeholder: t('Search'), onKeyPress: handleKeyPress }) }));
68954
69002
  };
68955
69003
  const groupbtnTemplate = () => {
68956
- 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: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[0] ? { headerText: t(contentColumns.find((x) => x.field === groupColumns[0])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[0])?.headerText) } : undefined, onChange: (val) => {
69004
+ 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: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[0]
69005
+ ? {
69006
+ headerText: t(contentColumns.find((x) => x.field === groupColumns[0])?.headerText ??
69007
+ contentColumns.find((x) => x.field === groupColumns[0])?.headerText),
69008
+ }
69009
+ : undefined, onChange: (val) => {
68957
69010
  if (val) {
68958
69011
  groupColumns[0] = val.field;
68959
69012
  }
@@ -68961,7 +69014,12 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68961
69014
  groupColumns.pop();
68962
69015
  }
68963
69016
  setGroupColumns([...groupColumns]);
68964
- }, 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: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[1] ? { headerText: t(contentColumns.find((x) => x.field === groupColumns[1])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[1])?.headerText) } : undefined, onChange: (val) => {
69017
+ }, 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: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[1]
69018
+ ? {
69019
+ headerText: t(contentColumns.find((x) => x.field === groupColumns[1])?.headerText ??
69020
+ contentColumns.find((x) => x.field === groupColumns[1])?.headerText),
69021
+ }
69022
+ : undefined, onChange: (val) => {
68965
69023
  if (val) {
68966
69024
  groupColumns[1] = val.field;
68967
69025
  }
@@ -68969,7 +69027,12 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68969
69027
  groupColumns.pop();
68970
69028
  }
68971
69029
  setGroupColumns([...groupColumns]);
68972
- }, 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: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[2] ? { headerText: t(contentColumns.find((x) => x.field === groupColumns[2])?.headerText ?? contentColumns.find((x) => x.field === groupColumns[2])?.headerText) } : undefined, onChange: (val) => {
69030
+ }, 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: contentColumns, fieldLabel: 'headerText', fieldValue: 'field', value: groupColumns[2]
69031
+ ? {
69032
+ headerText: t(contentColumns.find((x) => x.field === groupColumns[2])?.headerText ??
69033
+ contentColumns.find((x) => x.field === groupColumns[2])?.headerText),
69034
+ }
69035
+ : undefined, onChange: (val) => {
68973
69036
  if (groupSetting) {
68974
69037
  if (val) {
68975
69038
  groupColumns[2] = val.field;
@@ -68980,7 +69043,9 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68980
69043
  setGroupColumns([...groupColumns]);
68981
69044
  }
68982
69045
  }, 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: () => {
68983
- groupSetting?.onGroup({ columnGrouped: groupColumns.filter((x) => x) });
69046
+ groupSetting?.onGroup({
69047
+ columnGrouped: groupColumns.filter((x) => x),
69048
+ });
68984
69049
  document.getElementById('group-dropdown-toggle')?.click();
68985
69050
  }, children: `${t('Apply')}` }), jsx(Button$1$1, { color: "secondary", outline: true, className: "mt-1 rounded", size: "sm", onClick: () => {
68986
69051
  groupSetting?.onGroup({ columnGrouped: [] });
@@ -68988,14 +69053,16 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
68988
69053
  }, children: `${t('Delete')}` })] })] })] }));
68989
69054
  };
68990
69055
  const chooseColumnsTemplate = () => {
68991
- return jsx(SvgSettings, { className: "r-toolbar-icon", fontSize: 20, color: "#7F7F7F", onClick: () => setOpenPopupSetupColumn(true) });
69056
+ return (jsx(SvgSettings, { className: "r-toolbar-icon", fontSize: 20, color: "#7F7F7F", onClick: () => setOpenPopupSetupColumn(true) }));
68992
69057
  };
68993
69058
  const expandTemplate = () => {
68994
69059
  return (jsxs(Fragment$1, { children: [!expandsAll && (jsx(ExpandAllIcon, { onClick: () => {
68995
69060
  setExpandsAll(true);
68996
- }, color: "#7F7F7F", size: 24 })), expandsAll && jsx(UnExpandAllIcon, { onClick: () => setExpandsAll(false), color: "#7F7F7F", size: 24 })] }));
69061
+ }, color: "#7F7F7F", size: 24 })), expandsAll && (jsx(UnExpandAllIcon, { onClick: () => setExpandsAll(false), color: "#7F7F7F", size: 24 }))] }));
68997
69062
  };
68998
- const defaultToolbarOption = searchSetting?.searchEnable ? [{ template: searchTemplate, align: 'left' }] : [];
69063
+ const defaultToolbarOption = searchSetting?.searchEnable
69064
+ ? [{ template: searchTemplate, align: 'left' }]
69065
+ : [];
68999
69066
  if (groupSetting) {
69000
69067
  defaultToolbarOption.push({ template: groupbtnTemplate, align: 'left' });
69001
69068
  }
@@ -69004,7 +69071,10 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69004
69071
  }
69005
69072
  let toolbarTopOption = [];
69006
69073
  if (toolbarSetting?.toolbarOptions) {
69007
- toolbarTopOption = [...defaultToolbarOption, ...toolbarSetting?.toolbarOptions];
69074
+ toolbarTopOption = [
69075
+ ...defaultToolbarOption,
69076
+ ...toolbarSetting?.toolbarOptions,
69077
+ ];
69008
69078
  }
69009
69079
  else {
69010
69080
  toolbarTopOption = [...defaultToolbarOption];
@@ -69033,11 +69103,11 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69033
69103
  }
69034
69104
  };
69035
69105
  useEffect(() => {
69036
- console.log(selectedRows);
69037
- console.log(isMulti);
69038
69106
  if (setSelectedItem) {
69039
69107
  if (isMulti) {
69040
- if (dataSource && selectedRows && selectedRows?.length !== selectedItem?.length) {
69108
+ if (dataSource &&
69109
+ selectedRows &&
69110
+ selectedRows?.length !== selectedItem?.length) {
69041
69111
  setSelectedItem([...selectedRows]);
69042
69112
  if (handleSelect) {
69043
69113
  handleSelect([...selectedRows]);
@@ -69046,7 +69116,8 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69046
69116
  }
69047
69117
  else {
69048
69118
  if (dataSource && selectedRows?.length > 0) {
69049
- if (!selectedItem || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
69119
+ if (!selectedItem ||
69120
+ selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
69050
69121
  setSelectedItem({ ...selectedRows[0] });
69051
69122
  if (handleSelect) {
69052
69123
  handleSelect({ ...selectedRows[0] });
@@ -69065,7 +69136,8 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69065
69136
  useEffect(() => {
69066
69137
  if (!isMulti) {
69067
69138
  if (dataSource && selectedItem && selectedItem[fieldKey]) {
69068
- if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
69139
+ if (selectedRows?.length === 0 ||
69140
+ selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
69069
69141
  setSelectedRows([selectedItem]);
69070
69142
  }
69071
69143
  }
@@ -69074,7 +69146,9 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69074
69146
  }
69075
69147
  }
69076
69148
  else {
69077
- if (dataSource && selectedItem && selectedRows?.length !== selectedItem.length) {
69149
+ if (dataSource &&
69150
+ selectedItem &&
69151
+ selectedRows?.length !== selectedItem.length) {
69078
69152
  setSelectedRows(selectedItem ? [...selectedItem] : []);
69079
69153
  }
69080
69154
  }
@@ -69092,44 +69166,68 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69092
69166
  const col = contentColumns.find((x) => x.field === row.field);
69093
69167
  let value = row[col.field];
69094
69168
  if (col.type === 'numeric') {
69095
- value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
69169
+ value =
69170
+ formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
69096
69171
  }
69097
69172
  else if (col.type === 'date') {
69098
- value = value ? formatDateTime(value, formatSetting?.dateFormat) : '';
69173
+ value = value
69174
+ ? formatDateTime(value, formatSetting?.dateFormat)
69175
+ : '';
69099
69176
  }
69100
69177
  else if (col.type === 'datetime') {
69101
- value = value ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm') : '';
69178
+ value = value
69179
+ ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
69180
+ : '';
69102
69181
  }
69103
69182
  if (col.template) {
69104
69183
  value = col.template(row, indexRow) ?? '';
69105
69184
  }
69106
- return (jsxs(Fragment$1, { children: [jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsx("td", { className: "r-rowcell r-cell-group", colSpan: 3, children: jsxs("div", { className: "r-rowcell-div", children: [jsx(SvgChevronRight, { style: { marginLeft: level * 20, transform: expand ? 'rotate(90deg)' : 'rotate(0deg)' }, fontSize: 15, onClick: () => {
69185
+ return (jsxs(Fragment$1, { children: [jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsx("td", { className: "r-rowcell r-cell-group", colSpan: 3, children: jsxs("div", { className: "r-rowcell-div", children: [jsx(SvgChevronRight, { style: {
69186
+ marginLeft: level * 20,
69187
+ transform: expand ? 'rotate(90deg)' : 'rotate(0deg)',
69188
+ }, fontSize: 15, onClick: () => {
69107
69189
  setExpand(!expand);
69108
69190
  setExpandsAll(undefined);
69109
69191
  row.expand = !expand;
69110
69192
  } }), t(col.headerDisplay ?? col.headerText), ": ", value, " (", row.children.length, ")"] }) }), contentColumns.map((colSum, indexCol) => {
69111
- if (indexCol <= firstColSpan || colSum.visible === false || colSum.isGroup === true) {
69193
+ if (indexCol <= firstColSpan ||
69194
+ colSum.visible === false ||
69195
+ colSum.isGroup === true) {
69112
69196
  return;
69113
69197
  }
69114
69198
  let sumValue = row[colSum.field];
69115
- const haveSum = row[colSum.field] !== undefined && row[colSum.field] !== null;
69116
- if (!haveSum && colSum.haveSum === true && colSum.type === 'numeric') {
69199
+ const haveSum = row[colSum.field] !== undefined &&
69200
+ row[colSum.field] !== null;
69201
+ if (!haveSum &&
69202
+ colSum.haveSum === true &&
69203
+ colSum.type === 'numeric') {
69117
69204
  sumValue = row.children.reduce(function (accumulator, currentValue) {
69118
- return Number(accumulator ?? 0) + Number(currentValue[colSum.field] ?? 0);
69205
+ return (Number(accumulator ?? 0) +
69206
+ Number(currentValue[colSum.field] ?? 0));
69119
69207
  }, 0);
69120
69208
  }
69121
69209
  if (colSum.type === 'numeric') {
69122
69210
  sumValue = formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', colSum.numericSettings?.fraction, true, false);
69123
- if (!zeroVisiable && (sumValue === '0' || sumValue === 0)) {
69211
+ if (!zeroVisiable &&
69212
+ (sumValue === '0' || sumValue === 0)) {
69124
69213
  sumValue = '';
69125
69214
  }
69126
69215
  }
69127
- return (jsx("td", { className: "r-rowcell r-cell-sum-group", children: jsx("div", { className: "r-rowcell-div", style: { justifyContent: colSum.textAlign ? colSum.textAlign : 'left' }, children: (haveSum || colSum.haveSum === true) && Number(row[colSum.field] ?? '0') < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] }) : sumValue }) }, `group-sum-cell-${level}-${indexRow}-${indexCol}`));
69128
- })] }), expand && jsx(RenderContent, { datas: row.children, level: level + 1 })] }, `row-${level}-${indexRow}`));
69216
+ return (jsx("td", { className: "r-rowcell r-cell-sum-group", children: jsx("div", { className: "r-rowcell-div", style: {
69217
+ justifyContent: colSum.textAlign
69218
+ ? colSum.textAlign
69219
+ : 'left',
69220
+ }, children: (haveSum || colSum.haveSum === true) &&
69221
+ Number(row[colSum.field] ?? '0') < 0 ? (jsxs("div", { style: {
69222
+ color: formatSetting?.colorNegative ?? 'red',
69223
+ }, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] })) : (sumValue) }) }, `group-sum-cell-${level}-${indexRow}-${indexCol}`));
69224
+ })] }), expand && (jsx(RenderContent, { datas: row.children, level: level + 1 }))] }, `row-${level}-${indexRow}`));
69129
69225
  }
69130
69226
  else {
69131
69227
  const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
69132
- return (jsx("tr", { id: `row-content-${indexRow}`, "aria-rowindex": indexRow + 1, role: "row", className: classNames$1('r-row', { 'r-last-row': level === 0 && indexRow === viewData.length - 1 }), onContextMenu: (e) => {
69228
+ return (jsx("tr", { id: `row-content-${indexRow}`, "aria-rowindex": indexRow + 1, role: "row", className: classNames$1('r-row', {
69229
+ 'r-last-row': level === 0 && indexRow === viewData.length - 1,
69230
+ }), onContextMenu: (e) => {
69133
69231
  e.preventDefault();
69134
69232
  handleContextMenu(e, row);
69135
69233
  }, children: contentColumns.map((column, indexCol) => (jsx(RenderContentCol, { idTable: idTable, col: column, fieldKey: fieldKey, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, isMulti: isMulti, selectedRows: selectedRows, setSelectedRows: setSelectedRows, formatSetting: formatSetting, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row, zeroVisiable: zeroVisiable, handleCloseContext: handleCloseContext, handleDoubleClick: handleDoubleClick }, indexCol))) }, `row-content-${indexRow}`));
@@ -69144,7 +69242,7 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69144
69242
  x: e.clientX,
69145
69243
  y: e.clientY,
69146
69244
  row,
69147
- show: true
69245
+ show: true,
69148
69246
  });
69149
69247
  }, 100);
69150
69248
  };
@@ -69159,7 +69257,10 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69159
69257
  virtualDivRef.current.style.height = '0px';
69160
69258
  }
69161
69259
  }, [context]);
69162
- return (jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), headerComponent && headerComponent(), jsxs("div", { ref: gridRef, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}`, position: 'relative' }, children: [jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsx(RenderColGroup, { contentColumns: contentColumns }), jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => {
69260
+ return (jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && (jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption })), headerComponent && headerComponent(), jsxs("div", { ref: gridRef, className: "r-gridtable", style: {
69261
+ height: `${height ? `${height}px` : 'auto'}`,
69262
+ position: 'relative',
69263
+ }, children: [jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsx(RenderColGroup, { contentColumns: contentColumns }), jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => {
69163
69264
  return (jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((col, index) => (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) => {
69164
69265
  setFilterBy([...val]);
69165
69266
  if (querySetting?.changeFilter) {
@@ -69177,20 +69278,32 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69177
69278
  }
69178
69279
  const item = columnsAggregate?.find((x) => x.field === col.field);
69179
69280
  let sumValue = item?.value;
69180
- if (!item && col.haveSum === true && col.type === 'numeric') {
69281
+ if (!item &&
69282
+ col.haveSum === true &&
69283
+ col.type === 'numeric') {
69181
69284
  sumValue = viewData.reduce(function (accumulator, currentValue) {
69182
- return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
69285
+ return (Number(accumulator ?? 0) +
69286
+ Number(currentValue[col.field] ?? 0));
69183
69287
  }, 0);
69184
69288
  }
69185
69289
  if (col.type === 'numeric') {
69186
69290
  sumValue = formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false);
69187
69291
  }
69188
69292
  return (jsx("td", { className: classNames$1(`p-0 px-50 r-footer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
69189
- left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
69190
- right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
69191
- textAlign: col.textAlign ? col.textAlign : 'left'
69192
- }, children: jsx("div", { className: "r-footer-div", children: (item || col.haveSum === true) && Number(item?.value ?? '0') < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] }) : sumValue }) }, `summarycell-${indexCol}`));
69193
- }) })) })] }), jsx("div", { ref: virtualDivRef }), context && (contextMenuItems?.length ?? 0) > 0 && handleContextMenuClick && (jsx(Popover$1, { className: "r-context-popover", placement: "right-start", isOpen: context.show, target: virtualDivRef.current, toggle: handleCloseContext, fade: false, children: jsx(PopoverBody$1, { children: contextMenuItems?.map((item, index) => {
69293
+ left: col.fixedType === 'left'
69294
+ ? objWidthFixLeft[indexCol]
69295
+ : undefined,
69296
+ right: col.fixedType === 'right'
69297
+ ? objWidthFixRight[indexCol]
69298
+ : undefined,
69299
+ textAlign: col.textAlign ? col.textAlign : 'left',
69300
+ }, children: jsx("div", { className: "r-footer-div", children: (item || col.haveSum === true) &&
69301
+ Number(item?.value ?? '0') < 0 ? (jsxs("div", { style: {
69302
+ color: formatSetting?.colorNegative ?? 'red',
69303
+ }, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] })) : (sumValue) }) }, `summarycell-${indexCol}`));
69304
+ }) })) })] }), jsx("div", { ref: virtualDivRef }), context &&
69305
+ (contextMenuItems?.length ?? 0) > 0 &&
69306
+ handleContextMenuClick && (jsx(Popover$1, { className: "r-context-popover", placement: "right-start", isOpen: context.show, target: virtualDivRef.current, toggle: handleCloseContext, fade: false, children: jsx(PopoverBody$1, { children: contextMenuItems?.map((item, index) => {
69194
69307
  return (jsxs("div", { className: "r-context-item", onClick: () => {
69195
69308
  handleCloseContext();
69196
69309
  handleContextMenuClick?.(item, context.row);
@@ -69199,7 +69312,14 @@ const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoad
69199
69312
  setOpenPopupSetupColumn(!openPopupSetupColumn);
69200
69313
  }, settingColumns: settingColumns, openSidebar: openPopupSetupColumn, column: [...contentColumns], resetDefaultColumns: resetDefaultColumns, setColumn: (newColumns) => {
69201
69314
  if (saveSettingColumn) {
69202
- saveSettingColumn(newColumns.map((x, index) => ({ field: x.field, headerText: x.headerDisplay, visible: x.visible, fixedType: x.fixedType, width: x.width, sortOrder: index + 1 })));
69315
+ saveSettingColumn(newColumns.map((x, index) => ({
69316
+ field: x.field,
69317
+ headerText: x.headerDisplay,
69318
+ visible: x.visible,
69319
+ fixedType: x.fixedType,
69320
+ width: x.width,
69321
+ sortOrder: index + 1,
69322
+ })));
69203
69323
  }
69204
69324
  } })] }));
69205
69325
  };