es-grid-template 1.8.48 → 1.8.50

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.
@@ -483,7 +483,7 @@ const TableContainerEdit = props => {
483
483
  [columnKey]: null
484
484
  };
485
485
  }
486
- if (isFormattedNumber(cellValue.trim())) {
486
+ if (isFormattedNumber(cellValue.trim()) || !isNaN(Number(cellValue.trim()))) {
487
487
  const colFormat = typeof columnOri.format === 'function' ? columnOri.format(record) : columnOri.format;
488
488
  const valuePasteFormat = detectSeparators(cellValue.trim());
489
489
  const cellFormat = getFormat(colFormat, format);
@@ -477,6 +477,10 @@ const TableBodyCell = props => {
477
477
  isSelectionChange,
478
478
  selectionSettings
479
479
  });
480
+ setFocusedCell?.({
481
+ colId: cell.column.id,
482
+ rowId: cell.row.id
483
+ });
480
484
  }
481
485
  }
482
486
  }, /*#__PURE__*/React.createElement("div", {
@@ -697,6 +697,78 @@ const TableBodyCellEdit = props => {
697
697
  }
698
698
  return;
699
699
  }
700
+ if (e.key === 'ArrowDown') {
701
+ // e.preventDefault()
702
+ // e.stopPropagation()
703
+
704
+ const nextRow = table.getRowModel().rows[rowNumber + 1];
705
+ if (nextRow) {
706
+ const nextRowId = nextRow.id;
707
+ setFocusedCell?.({
708
+ rowId: nextRowId,
709
+ colId
710
+ });
711
+ setStartCell?.({
712
+ rowId: nextRowId,
713
+ colId
714
+ });
715
+ setEndCell?.({
716
+ rowId: nextRowId,
717
+ colId
718
+ });
719
+ setRangeState?.(getSelectedCellMatrix(table, {
720
+ rowId: nextRowId,
721
+ colId
722
+ }, {
723
+ rowId: nextRowId,
724
+ colId
725
+ }));
726
+
727
+ // columnVirtualizer.scrollToIndex(nextCol.getIndex(), { align: 'center' })
728
+ // rowVirtualizer.scrollToIndex(nextRow.index, { align: 'center' })
729
+
730
+ const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextRowId}"]`);
731
+ const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
732
+ if (cellFocus) {
733
+ cellFocus.focus();
734
+ }
735
+ }
736
+ return;
737
+ }
738
+ if (e.key === 'ArrowUp') {
739
+ // e.preventDefault()
740
+ // e.stopPropagation()
741
+
742
+ const nextRow = table.getRowModel().rows[rowNumber - 1];
743
+ if (nextRow) {
744
+ const nextRowId = nextRow.id;
745
+ setFocusedCell?.({
746
+ rowId: nextRowId,
747
+ colId
748
+ });
749
+ setStartCell?.({
750
+ rowId: nextRowId,
751
+ colId
752
+ });
753
+ setEndCell?.({
754
+ rowId: nextRowId,
755
+ colId
756
+ });
757
+ setRangeState?.(getSelectedCellMatrix(table, {
758
+ rowId: nextRowId,
759
+ colId
760
+ }, {
761
+ rowId: nextRowId,
762
+ colId
763
+ }));
764
+ const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextRowId}"]`);
765
+ const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
766
+ if (cellFocus) {
767
+ cellFocus.focus();
768
+ }
769
+ }
770
+ return;
771
+ }
700
772
  if (e.key === 'Delete') {
701
773
  handleDeleteContent?.();
702
774
  return;
@@ -490,7 +490,7 @@ const TableContainerEdit = props => {
490
490
  [columnKey]: null
491
491
  };
492
492
  }
493
- if ((0, _utils.isFormattedNumber)(cellValue.trim())) {
493
+ if ((0, _utils.isFormattedNumber)(cellValue.trim()) || !isNaN(Number(cellValue.trim()))) {
494
494
  const colFormat = typeof columnOri.format === 'function' ? columnOri.format(record) : columnOri.format;
495
495
  const valuePasteFormat = (0, _utils.detectSeparators)(cellValue.trim());
496
496
  const cellFormat = (0, _utils.getFormat)(colFormat, format);
@@ -484,6 +484,10 @@ const TableBodyCell = props => {
484
484
  isSelectionChange,
485
485
  selectionSettings
486
486
  });
487
+ setFocusedCell?.({
488
+ colId: cell.column.id,
489
+ rowId: cell.row.id
490
+ });
487
491
  }
488
492
  }
489
493
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -703,6 +703,78 @@ const TableBodyCellEdit = props => {
703
703
  }
704
704
  return;
705
705
  }
706
+ if (e.key === 'ArrowDown') {
707
+ // e.preventDefault()
708
+ // e.stopPropagation()
709
+
710
+ const nextRow = table.getRowModel().rows[rowNumber + 1];
711
+ if (nextRow) {
712
+ const nextRowId = nextRow.id;
713
+ setFocusedCell?.({
714
+ rowId: nextRowId,
715
+ colId
716
+ });
717
+ setStartCell?.({
718
+ rowId: nextRowId,
719
+ colId
720
+ });
721
+ setEndCell?.({
722
+ rowId: nextRowId,
723
+ colId
724
+ });
725
+ setRangeState?.((0, _utils.getSelectedCellMatrix)(table, {
726
+ rowId: nextRowId,
727
+ colId
728
+ }, {
729
+ rowId: nextRowId,
730
+ colId
731
+ }));
732
+
733
+ // columnVirtualizer.scrollToIndex(nextCol.getIndex(), { align: 'center' })
734
+ // rowVirtualizer.scrollToIndex(nextRow.index, { align: 'center' })
735
+
736
+ const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextRowId}"]`);
737
+ const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
738
+ if (cellFocus) {
739
+ cellFocus.focus();
740
+ }
741
+ }
742
+ return;
743
+ }
744
+ if (e.key === 'ArrowUp') {
745
+ // e.preventDefault()
746
+ // e.stopPropagation()
747
+
748
+ const nextRow = table.getRowModel().rows[rowNumber - 1];
749
+ if (nextRow) {
750
+ const nextRowId = nextRow.id;
751
+ setFocusedCell?.({
752
+ rowId: nextRowId,
753
+ colId
754
+ });
755
+ setStartCell?.({
756
+ rowId: nextRowId,
757
+ colId
758
+ });
759
+ setEndCell?.({
760
+ rowId: nextRowId,
761
+ colId
762
+ });
763
+ setRangeState?.((0, _utils.getSelectedCellMatrix)(table, {
764
+ rowId: nextRowId,
765
+ colId
766
+ }, {
767
+ rowId: nextRowId,
768
+ colId
769
+ }));
770
+ const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextRowId}"]`);
771
+ const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
772
+ if (cellFocus) {
773
+ cellFocus.focus();
774
+ }
775
+ }
776
+ return;
777
+ }
706
778
  if (e.key === 'Delete') {
707
779
  handleDeleteContent?.();
708
780
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.8.48",
3
+ "version": "1.8.50",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",