react-table-edit 1.4.12 → 1.4.13

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
@@ -42236,7 +42236,7 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
42236
42236
  return ((item.align === 'center') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : '');
42237
42237
  }) }), jsxs("div", { className: "r-toolbar-right", children: [toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
42238
42238
  return ((item.align === 'right') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : '');
42239
- }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxs("ul", { className: "mb-0 pe-50", children: [jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" })] }) })] }) })] })] }) }));
42239
+ }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxs("ul", { className: "mb-0 pe-50", children: [jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl + Shift + \u2193 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng d\u01B0\u1EDBi" })] }) })] }) })] })] }) }));
42240
42240
  };
42241
42241
 
42242
42242
  const handleArrowRight = (e, params) => {
@@ -42288,17 +42288,38 @@ const handleArrowUp = (e, params) => {
42288
42288
  }
42289
42289
  };
42290
42290
  const handleArrowDown = (e, params) => {
42291
- const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement } = params;
42292
- const element = document.getElementById(idElement);
42293
- if (!isSelectMenuOpen(element) && indexRow < totalCount) {
42294
- if (pagingClient && (indexRow % (pagingSetting?.pageSize ?? 0)) === 0 && pagingSetting?.setCurrentPage) {
42295
- pagingSetting?.setCurrentPage((pagingSetting?.currentPage ?? 1) + 1);
42291
+ const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement, rowChange, changeDataSource, dataSource, contentColumns, row } = params;
42292
+ if ((e.ctrlKey || e.metaKey) && e.shiftKey) {
42293
+ if (indexRow < totalCount) {
42294
+ const column = contentColumns[indexCol - 1];
42295
+ for (let index = indexRow; index < totalCount; index++) {
42296
+ const element = dataSource[index];
42297
+ element[column.field ?? ''] = row[column.field ?? ''];
42298
+ if (column.callback && column.callbackValue) {
42299
+ const value = column.callbackValue(row);
42300
+ column.callback(value, index, element);
42301
+ }
42302
+ if (rowChange) {
42303
+ rowChange(element, indexRow, column.field);
42304
+ }
42305
+ }
42306
+ changeDataSource(dataSource);
42296
42307
  }
42297
- setIndexFocus(indexRow);
42298
- focusNewElement(indexCol, indexRow + 1, true);
42299
42308
  e.preventDefault();
42300
42309
  return e.code;
42301
42310
  }
42311
+ else {
42312
+ const element = document.getElementById(idElement);
42313
+ if (!isSelectMenuOpen(element) && indexRow < totalCount) {
42314
+ if (pagingClient && (indexRow % (pagingSetting?.pageSize ?? 0)) === 0 && pagingSetting?.setCurrentPage) {
42315
+ pagingSetting?.setCurrentPage((pagingSetting?.currentPage ?? 1) + 1);
42316
+ }
42317
+ setIndexFocus(indexRow);
42318
+ focusNewElement(indexCol, indexRow + 1, true);
42319
+ e.preventDefault();
42320
+ return e.code;
42321
+ }
42322
+ }
42302
42323
  };
42303
42324
  const handleTab = (e, params) => {
42304
42325
  const { indexCol, columnLastEdit, indexRow, totalCount, moveIndexRowToNewPage, pagingClient, pagingSetting, setIndexFocus, focusNewElement } = params;
@@ -42676,9 +42697,7 @@ const TableEdit = forwardRef((props, ref) => {
42676
42697
  }
42677
42698
  handleDataChange(row, col, indexRow);
42678
42699
  }, dateFormat: "dd/MM/yyyy HH:mm", onKeyDown: (e) => {
42679
- if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
42680
- return true;
42681
- }
42700
+ checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
42682
42701
  } }));
42683
42702
  case 'select':
42684
42703
  let valueSelect;
@@ -42724,7 +42743,7 @@ const TableEdit = forwardRef((props, ref) => {
42724
42743
  }
42725
42744
  handleDataChange(row, col, indexRow);
42726
42745
  }, fieldValue: col.selectSettings?.fieldValue, fieldLabel: col.selectSettings?.fieldLabel, component: gridRef, columns: col.selectSettings?.columns, isClearable: col.selectSettings?.isClearable ?? false, formatSetting: formatSetting, placeholder: t('Select'), loadOptions: col.selectSettings?.loadOptions, handleAdd: col.selectSettings?.handAddNew ? (e) => col.selectSettings?.handAddNew(e, indexRow, row) : undefined, isMulti: col.selectSettings?.isMulti, noHeader: col.selectSettings?.noHeader, showFooter: col.selectSettings?.showFooter, formatOptionLabel: col.selectSettings?.formatOptionLabel, footerComponent: col.selectSettings?.footerComponent, invalid: (col.validate && !isNullOrUndefined$1(col.validate(row[col.field], row))), maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : undefined, menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, textAlign: col.textAlign ?? 'left', allowCreate: col.selectSettings?.allowCreate, onKeyDown: (e) => {
42727
- if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) ;
42746
+ return checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
42728
42747
  }, onOpenMenu: () => {
42729
42748
  if (col.selectSettings?.onOpenMenu) {
42730
42749
  col.selectSettings?.onOpenMenu(row, col, indexRow);
@@ -42780,7 +42799,7 @@ const TableEdit = forwardRef((props, ref) => {
42780
42799
  col.selectSettings?.onOpenMenu(row, col, indexRow);
42781
42800
  }
42782
42801
  }, loadOptions: col.selectSettings?.loadOptions, handleAdd: col.selectSettings?.handAddNew ? (e) => col.selectSettings?.handAddNew(e, indexRow, row) : undefined, fieldChildren: col.selectSettings?.fieldChild ?? 'children', selectChilds: col.selectSettings?.selectChilds, showFooter: col.selectSettings?.showFooter, formatOptionLabel: col.selectSettings?.formatOptionLabel, footerComponent: col.selectSettings?.footerComponent, width: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, isMulti: col.selectSettings?.isMulti, noHeader: col.selectSettings?.noHeader, invalid: col.validate && col.validate(row[col.field], row), maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : undefined, menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, textAlign: col.textAlign ?? 'left', onKeyDown: (e) => {
42783
- if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) ;
42802
+ checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
42784
42803
  }, onPaste: (e) => {
42785
42804
  if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable && !col.disablePaste) {
42786
42805
  pasteDataFromExcel(indexRow, indexCol, e);
@@ -42795,7 +42814,7 @@ const TableEdit = forwardRef((props, ref) => {
42795
42814
  }
42796
42815
  handleDataChange(row, col, indexRow);
42797
42816
  }, onKeyDown: (e) => {
42798
- if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) ;
42817
+ checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
42799
42818
  } }));
42800
42819
  case 'numeric':
42801
42820
  const numericFormatProps = {
@@ -42945,6 +42964,8 @@ const TableEdit = forwardRef((props, ref) => {
42945
42964
  addDisable,
42946
42965
  editDisable,
42947
42966
  focusNewElement,
42967
+ changeDataSource,
42968
+ rowChange,
42948
42969
  handleDuplicate: () => handleDuplicate(dataSource, indexFocus, fieldKey, defaultValue, fieldUniKey, changeDataSource, tableElement, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate),
42949
42970
  idElement,
42950
42971
  indexCol,