es-grid-template 1.8.47 → 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.
@@ -27,7 +27,7 @@ const TableContainer = props => {
27
27
  table,
28
28
  id,
29
29
  prefix,
30
- // commandClick,
30
+ commandClick,
31
31
  editAble,
32
32
  rowKey,
33
33
  format,
@@ -160,7 +160,18 @@ const TableContainer = props => {
160
160
  // })
161
161
  }
162
162
  }, [columnSizingInfo]);
163
- const triggerCommandClick = () => {};
163
+ const triggerCommandClick = args => {
164
+ // const { id: idCommand, rowId, rowData, index } = args
165
+
166
+ // const tmpData = [...dataSource]
167
+
168
+ if (commandClick) {
169
+ commandClick({
170
+ ...args,
171
+ rows: originData
172
+ });
173
+ }
174
+ };
164
175
  return /*#__PURE__*/React.createElement("div", {
165
176
  ref: containerRef,
166
177
  id: id
@@ -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;
@@ -1916,92 +1916,11 @@ export const convertToObjTrue = arr => {
1916
1916
  export const getDiffent2Array = (a, b) => {
1917
1917
  return [...a.filter(x => !b.includes(x)), ...b.filter(x => !a.includes(x))];
1918
1918
  };
1919
-
1920
- // export function isTree(arr: any[]): boolean {
1921
- // if (!Array.isArray(arr)){
1922
- // return false
1923
- // }
1924
-
1925
- // function checkNode(node: any): boolean {
1926
- // if (typeof node !== "object" || node === null) {
1927
- // return false
1928
- // }
1929
-
1930
- // if ("children" in node) {
1931
-
1932
- // if (!Array.isArray(node.children)) {
1933
- // return false
1934
- // }
1935
- // if (node.children.length === 0) {
1936
- // return false
1937
- // }
1938
-
1939
- // for (const child of node.children) {
1940
- // if (!checkNode(child)) {
1941
- // return false
1942
- // }
1943
- // }
1944
-
1945
- // }
1946
-
1947
- // return true;
1948
- // }
1949
-
1950
- // for (const item of arr) {
1951
- // if (!checkNode(item)) return false;
1952
- // }
1953
-
1954
- // return true;
1955
- // }
1956
-
1957
1919
  export function findFirst(items) {
1958
1920
  const leftItem = items.find(item => item.getIsPinned() === 'left');
1959
1921
  if (leftItem) return leftItem;
1960
1922
  return null;
1961
1923
  }
1962
-
1963
- // export function isTreeArray(arr: any[]): boolean {
1964
- // if (!Array.isArray(arr) || arr.length === 0) {
1965
-
1966
- // return false
1967
- // }
1968
-
1969
- // // const requireNonEmpty = options?.requireNonEmptyChildren ?? false
1970
- // let hasParent = false
1971
-
1972
- // for (const item of arr) {
1973
- // if (typeof item !== 'object' || item === null) {
1974
-
1975
- // return false
1976
- // }
1977
-
1978
- // if ('children' in item) {
1979
- // const children = (item as any).children
1980
- // if (!Array.isArray(children)) {
1981
- // // return false;
1982
- // hasParent = false
1983
- // }
1984
-
1985
- // if (children && children.length > 0) {
1986
- // hasParent = true
1987
- // }
1988
-
1989
- // // if (requireNonEmpty) {
1990
-
1991
- // // if (children.length > 0) {
1992
- // // hasParent = true
1993
- // // }
1994
- // // } else {
1995
-
1996
- // // hasParent = true
1997
-
1998
- // // }
1999
- // }
2000
- // }
2001
-
2002
- // return hasParent
2003
- // }
2004
-
2005
1924
  export function isTreeArray(arr) {
2006
1925
  if (!Array.isArray(arr) || arr.length === 0) {
2007
1926
  return false;
@@ -37,7 +37,7 @@ const TableContainer = props => {
37
37
  table,
38
38
  id,
39
39
  prefix,
40
- // commandClick,
40
+ commandClick,
41
41
  editAble,
42
42
  rowKey,
43
43
  format,
@@ -170,7 +170,18 @@ const TableContainer = props => {
170
170
  // })
171
171
  }
172
172
  }, [columnSizingInfo]);
173
- const triggerCommandClick = () => {};
173
+ const triggerCommandClick = args => {
174
+ // const { id: idCommand, rowId, rowData, index } = args
175
+
176
+ // const tmpData = [...dataSource]
177
+
178
+ if (commandClick) {
179
+ commandClick({
180
+ ...args,
181
+ rows: originData
182
+ });
183
+ }
184
+ };
174
185
  return /*#__PURE__*/_react.default.createElement("div", {
175
186
  ref: containerRef,
176
187
  id: id
@@ -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;
@@ -2037,92 +2037,12 @@ exports.convertToObjTrue = convertToObjTrue;
2037
2037
  const getDiffent2Array = (a, b) => {
2038
2038
  return [...a.filter(x => !b.includes(x)), ...b.filter(x => !a.includes(x))];
2039
2039
  };
2040
-
2041
- // export function isTree(arr: any[]): boolean {
2042
- // if (!Array.isArray(arr)){
2043
- // return false
2044
- // }
2045
-
2046
- // function checkNode(node: any): boolean {
2047
- // if (typeof node !== "object" || node === null) {
2048
- // return false
2049
- // }
2050
-
2051
- // if ("children" in node) {
2052
-
2053
- // if (!Array.isArray(node.children)) {
2054
- // return false
2055
- // }
2056
- // if (node.children.length === 0) {
2057
- // return false
2058
- // }
2059
-
2060
- // for (const child of node.children) {
2061
- // if (!checkNode(child)) {
2062
- // return false
2063
- // }
2064
- // }
2065
-
2066
- // }
2067
-
2068
- // return true;
2069
- // }
2070
-
2071
- // for (const item of arr) {
2072
- // if (!checkNode(item)) return false;
2073
- // }
2074
-
2075
- // return true;
2076
- // }
2077
2040
  exports.getDiffent2Array = getDiffent2Array;
2078
2041
  function findFirst(items) {
2079
2042
  const leftItem = items.find(item => item.getIsPinned() === 'left');
2080
2043
  if (leftItem) return leftItem;
2081
2044
  return null;
2082
2045
  }
2083
-
2084
- // export function isTreeArray(arr: any[]): boolean {
2085
- // if (!Array.isArray(arr) || arr.length === 0) {
2086
-
2087
- // return false
2088
- // }
2089
-
2090
- // // const requireNonEmpty = options?.requireNonEmptyChildren ?? false
2091
- // let hasParent = false
2092
-
2093
- // for (const item of arr) {
2094
- // if (typeof item !== 'object' || item === null) {
2095
-
2096
- // return false
2097
- // }
2098
-
2099
- // if ('children' in item) {
2100
- // const children = (item as any).children
2101
- // if (!Array.isArray(children)) {
2102
- // // return false;
2103
- // hasParent = false
2104
- // }
2105
-
2106
- // if (children && children.length > 0) {
2107
- // hasParent = true
2108
- // }
2109
-
2110
- // // if (requireNonEmpty) {
2111
-
2112
- // // if (children.length > 0) {
2113
- // // hasParent = true
2114
- // // }
2115
- // // } else {
2116
-
2117
- // // hasParent = true
2118
-
2119
- // // }
2120
- // }
2121
- // }
2122
-
2123
- // return hasParent
2124
- // }
2125
-
2126
2046
  function isTreeArray(arr) {
2127
2047
  if (!Array.isArray(arr) || arr.length === 0) {
2128
2048
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.8.47",
3
+ "version": "1.8.50",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",
@@ -64,7 +64,7 @@
64
64
  "rc-checkbox": "^3.5.0",
65
65
  "rc-dropdown": "^4.2.1",
66
66
  "rc-field-form": "^2.6.0",
67
- "rc-master-ui": "1.1.44",
67
+ "rc-master-ui": "1.1.47",
68
68
  "rc-select": "^14.16.3",
69
69
  "rc-tooltip": "^6.3.0",
70
70
  "rc-tree": "^5.10.1",