es-grid-template 1.3.4 → 1.3.5

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.
@@ -512,7 +512,10 @@ const TableGrid = props => {
512
512
  ,
513
513
  showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
514
514
  }, pagination)), bottomToolbar?.(), /*#__PURE__*/React.createElement(Tooltip, {
515
- id: "tooltip-header"
515
+ id: "tooltip-header",
516
+ style: {
517
+ zIndex: 1999
518
+ }
516
519
  }));
517
520
  };
518
521
  export default TableGrid;
@@ -8,9 +8,13 @@ import CheckboxFilter from "../../CheckboxFilter";
8
8
  import { SELECTION_COLUMN } from "rc-master-ui/es/table/hooks/useSelection";
9
9
  import NumberRange from "../../number-range";
10
10
  import Number from "../../number";
11
+ // import {Typography} from "antd";
11
12
  const {
12
13
  RangePicker
13
14
  } = DatePicker;
15
+
16
+ // const { Text } = Typography;
17
+
14
18
  export function flatColumns(columns, parentKey = 'key') {
15
19
  // @ts-ignore
16
20
  return columns.filter(column => column && typeof column === 'object').reduce((list, column, index) => {
@@ -67,7 +67,9 @@ const HeaderContent = props => {
67
67
  // style={{flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', wordBreak: 'keep-all'}}
68
68
  // style={{flex: 1}}
69
69
  className: classnames('', {}),
70
- "data-tooltip-id": "tooltip-header",
70
+ "data-tooltip-id": "tooltip-header"
71
+ // data-tooltip-id="tooltip-cell-content"
72
+ ,
71
73
  "data-tooltip-content": tooltip,
72
74
  "data-tooltip-offset": 16
73
75
  }, headerTemplate ? getTemplate(headerTemplate) : t ? t(text) : text));
@@ -801,8 +801,6 @@ const GridEdit = props => {
801
801
  };
802
802
  }, []);
803
803
  const handleMouseDown = (record, row, col, e) => {
804
- // setEditingKey('')
805
-
806
804
  if (e.button === 2) {
807
805
  e.stopPropagation();
808
806
  return;
@@ -1049,6 +1047,14 @@ const GridEdit = props => {
1049
1047
  }
1050
1048
  if (row < rowSelectedEnd) {
1051
1049
  // kéo lên trên
1050
+
1051
+ const rowSelectedStart = getFirstSelectCell(selectedCells).row;
1052
+ const newPasteCells = new Set();
1053
+ for (let r = Math.min(rowSelectedStart, row); r <= Math.max(rowSelectedStart, row) - 1; r++) {
1054
+ for (let c = Math.min(colStart, col); c <= Math.max(colStart, colEnd); c++) {
1055
+ newPasteCells.add(`${r}-${c}`);
1056
+ }
1057
+ }
1052
1058
  }
1053
1059
  if (col > colEnd) {
1054
1060
  // kéo sang phải
@@ -1153,7 +1159,7 @@ const GridEdit = props => {
1153
1159
  return {
1154
1160
  row,
1155
1161
  col,
1156
- value: flattenData(childrenColumnName, dataSource)[row][columnKey]
1162
+ value: flattenData(childrenColumnName, dataSource)[row][columnKey] ?? ''
1157
1163
  };
1158
1164
  // return { row, col, value: '' };
1159
1165
  });
@@ -1297,7 +1303,7 @@ const GridEdit = props => {
1297
1303
  };
1298
1304
  const handlePaste = (record, indexCol, rowNumber, e) => {
1299
1305
  // const clipboard: any = (e.clipboardData || (window && window?.Clipboard)).getData("text")
1300
- const pasteData = e.clipboardData.getData("text/plain").trim();
1306
+ const pasteData = e.clipboardData.getData("text/plain");
1301
1307
 
1302
1308
  // Chuyển đổi dữ liệu từ clipboard thành mảng
1303
1309
  const rowsPasted = pasteData.split("\n").map(row =>
@@ -1724,7 +1730,7 @@ const GridEdit = props => {
1724
1730
  const isPasteLeft = colIndex === Math.min(cellPasteStart.col, cellPasteSEnd?.col);
1725
1731
  return `${cellClass} ${isPasteBottom ? `cell-paste-border-bottom` : ''} ${isPasteSelected && isPasteRight ? `cell-paste-border-right` : ''} ${isPasteSelected && isPasteLeft ? `fixed-cell-paste-border-left` : ''} ${isBottom ? `cell-border-bottom` : ''} ${isRight ? `cell-border-right` : ''} ${isLeft ? `fixed-cell-border-left` : ''} ${isBottom && isRight ? `cell-border-end` : ''}`;
1726
1732
  };
1727
- const convertColumns = flatColumns2(columns).map((column, colIndex) => {
1733
+ const convertColumns = flatColumns2(columns.filter(it => it.visible !== false)).map((column, colIndex) => {
1728
1734
  if (!column?.field && !column?.key) {
1729
1735
  return column;
1730
1736
  }
@@ -1918,6 +1924,10 @@ const GridEdit = props => {
1918
1924
  title: getValueCell(column, record[column.field], format),
1919
1925
  'data-col-index': colIndex,
1920
1926
  'data-row-index': rowNumber,
1927
+ // 'data-tooltip-id': "tooltip-cell-content",
1928
+ // 'data-tooltip-content': 'tooltip-cell-content',
1929
+ // 'data-tooltip-delay-show': 1000,
1930
+ // 'data-tooltip-content': getValueCell(column, record[column.field as any], format),
1921
1931
  editing: isEditing(record) && rowEditable?.(record) !== false && isEditable(column, record),
1922
1932
  cellEditing,
1923
1933
  t,
@@ -1978,7 +1988,9 @@ const GridEdit = props => {
1978
1988
  // onMouseEnter={(event) => handlePointEnter(event)}
1979
1989
  // onMouseLeave={() => handlePointLeave()}
1980
1990
  ,
1981
- onMouseDown: () => {
1991
+ onMouseDown: e => {
1992
+ // e.stopPropagation()
1993
+ // e.preventDefault()
1982
1994
  setIsPasteDragging(true);
1983
1995
  },
1984
1996
  onDoubleClick: handlePointDoubleClick
@@ -2000,6 +2012,11 @@ const GridEdit = props => {
2000
2012
  ...find
2001
2013
  };
2002
2014
  }
2015
+ if (!find) {
2016
+ return {
2017
+ ...column
2018
+ };
2019
+ }
2003
2020
 
2004
2021
  // Xử lý đệ quy cho children
2005
2022
  if (column.children?.length) {
@@ -513,7 +513,10 @@ const TableGrid = props => {
513
513
  ,
514
514
  showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
515
515
  }, pagination)), bottomToolbar?.(), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
516
- id: "tooltip-header"
516
+ id: "tooltip-header",
517
+ style: {
518
+ zIndex: 1999
519
+ }
517
520
  }));
518
521
  };
519
522
  var _default = exports.default = TableGrid;
@@ -19,9 +19,13 @@ var _numberRange = _interopRequireDefault(require("../../number-range"));
19
19
  var _number = _interopRequireDefault(require("../../number"));
20
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
+ // import {Typography} from "antd";
22
23
  const {
23
24
  RangePicker
24
25
  } = _rcMasterUi.DatePicker;
26
+
27
+ // const { Text } = Typography;
28
+
25
29
  function flatColumns(columns, parentKey = 'key') {
26
30
  // @ts-ignore
27
31
  return columns.filter(column => column && typeof column === 'object').reduce((list, column, index) => {
@@ -76,7 +76,9 @@ const HeaderContent = props => {
76
76
  // style={{flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', wordBreak: 'keep-all'}}
77
77
  // style={{flex: 1}}
78
78
  className: (0, _classnames.default)('', {}),
79
- "data-tooltip-id": "tooltip-header",
79
+ "data-tooltip-id": "tooltip-header"
80
+ // data-tooltip-id="tooltip-cell-content"
81
+ ,
80
82
  "data-tooltip-content": tooltip,
81
83
  "data-tooltip-offset": 16
82
84
  }, headerTemplate ? (0, _utils.getTemplate)(headerTemplate) : t ? t(text) : text));
@@ -801,8 +801,6 @@ const GridEdit = props => {
801
801
  };
802
802
  }, []);
803
803
  const handleMouseDown = (record, row, col, e) => {
804
- // setEditingKey('')
805
-
806
804
  if (e.button === 2) {
807
805
  e.stopPropagation();
808
806
  return;
@@ -1049,6 +1047,14 @@ const GridEdit = props => {
1049
1047
  }
1050
1048
  if (row < rowSelectedEnd) {
1051
1049
  // kéo lên trên
1050
+
1051
+ const rowSelectedStart = (0, _hooks.getFirstSelectCell)(selectedCells).row;
1052
+ const newPasteCells = new Set();
1053
+ for (let r = Math.min(rowSelectedStart, row); r <= Math.max(rowSelectedStart, row) - 1; r++) {
1054
+ for (let c = Math.min(colStart, col); c <= Math.max(colStart, colEnd); c++) {
1055
+ newPasteCells.add(`${r}-${c}`);
1056
+ }
1057
+ }
1052
1058
  }
1053
1059
  if (col > colEnd) {
1054
1060
  // kéo sang phải
@@ -1153,7 +1159,7 @@ const GridEdit = props => {
1153
1159
  return {
1154
1160
  row,
1155
1161
  col,
1156
- value: (0, _hooks.flattenData)(childrenColumnName, dataSource)[row][columnKey]
1162
+ value: (0, _hooks.flattenData)(childrenColumnName, dataSource)[row][columnKey] ?? ''
1157
1163
  };
1158
1164
  // return { row, col, value: '' };
1159
1165
  });
@@ -1297,7 +1303,7 @@ const GridEdit = props => {
1297
1303
  };
1298
1304
  const handlePaste = (record, indexCol, rowNumber, e) => {
1299
1305
  // const clipboard: any = (e.clipboardData || (window && window?.Clipboard)).getData("text")
1300
- const pasteData = e.clipboardData.getData("text/plain").trim();
1306
+ const pasteData = e.clipboardData.getData("text/plain");
1301
1307
 
1302
1308
  // Chuyển đổi dữ liệu từ clipboard thành mảng
1303
1309
  const rowsPasted = pasteData.split("\n").map(row =>
@@ -1724,7 +1730,7 @@ const GridEdit = props => {
1724
1730
  const isPasteLeft = colIndex === Math.min(cellPasteStart.col, cellPasteSEnd?.col);
1725
1731
  return `${cellClass} ${isPasteBottom ? `cell-paste-border-bottom` : ''} ${isPasteSelected && isPasteRight ? `cell-paste-border-right` : ''} ${isPasteSelected && isPasteLeft ? `fixed-cell-paste-border-left` : ''} ${isBottom ? `cell-border-bottom` : ''} ${isRight ? `cell-border-right` : ''} ${isLeft ? `fixed-cell-border-left` : ''} ${isBottom && isRight ? `cell-border-end` : ''}`;
1726
1732
  };
1727
- const convertColumns = (0, _columns.flatColumns2)(columns).map((column, colIndex) => {
1733
+ const convertColumns = (0, _columns.flatColumns2)(columns.filter(it => it.visible !== false)).map((column, colIndex) => {
1728
1734
  if (!column?.field && !column?.key) {
1729
1735
  return column;
1730
1736
  }
@@ -1918,6 +1924,10 @@ const GridEdit = props => {
1918
1924
  title: (0, _columns.getValueCell)(column, record[column.field], format),
1919
1925
  'data-col-index': colIndex,
1920
1926
  'data-row-index': rowNumber,
1927
+ // 'data-tooltip-id': "tooltip-cell-content",
1928
+ // 'data-tooltip-content': 'tooltip-cell-content',
1929
+ // 'data-tooltip-delay-show': 1000,
1930
+ // 'data-tooltip-content': getValueCell(column, record[column.field as any], format),
1921
1931
  editing: isEditing(record) && rowEditable?.(record) !== false && (0, _hooks.isEditable)(column, record),
1922
1932
  cellEditing,
1923
1933
  t,
@@ -1978,7 +1988,9 @@ const GridEdit = props => {
1978
1988
  // onMouseEnter={(event) => handlePointEnter(event)}
1979
1989
  // onMouseLeave={() => handlePointLeave()}
1980
1990
  ,
1981
- onMouseDown: () => {
1991
+ onMouseDown: e => {
1992
+ // e.stopPropagation()
1993
+ // e.preventDefault()
1982
1994
  setIsPasteDragging(true);
1983
1995
  },
1984
1996
  onDoubleClick: handlePointDoubleClick
@@ -2000,6 +2012,11 @@ const GridEdit = props => {
2000
2012
  ...find
2001
2013
  };
2002
2014
  }
2015
+ if (!find) {
2016
+ return {
2017
+ ...column
2018
+ };
2019
+ }
2003
2020
 
2004
2021
  // Xử lý đệ quy cho children
2005
2022
  if (column.children?.length) {
package/package.json CHANGED
@@ -1,109 +1,109 @@
1
- {
2
- "name": "es-grid-template",
3
- "version": "1.3.4",
4
- "description": "es-grid-template",
5
- "keywords": [
6
- "react",
7
- "react-component",
8
- "grid",
9
- "table"
10
- ],
11
- "license": "MIT",
12
- "main": "lib/index",
13
- "module": "es/index",
14
- "files": [
15
- "lib",
16
- "es",
17
- "assets/*.css",
18
- "assets/*.scss"
19
- ],
20
- "scripts": {
21
- "__compile": "father build && ",
22
- "compile": "father build && sass assets/index.scss assets/index.css",
23
- "docs:build": "dumi build",
24
- "__docs:deploy": "gh-pages -d dist",
25
- "lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
26
- "now-build": "npm run docs:build",
27
- "prepare": "dumi setup",
28
- "prepublishOnly": "npm run compile",
29
- "postpublish": "npm run docs:build",
30
- "__postpublish": "npm run docs:build && npm run docs:deploy",
31
- "start": "dumi dev",
32
- "test": "vitest --watch false",
33
- "coverage": "vitest run --coverage"
34
- },
35
- "dependencies": {
36
- "@ant-design/colors": "^8.0.0",
37
- "@ant-design/cssinjs": "^1.22.0",
38
- "@ant-design/cssinjs-utils": "^1.1.1",
39
- "@ant-design/icons": "^5.5.2",
40
- "@babel/runtime": "^7.11.2",
41
- "@core-rc/rc-select": "^0.0.8",
42
- "@ctrl/tinycolor": "^3.6.1",
43
- "@faker-js/faker": "^9.5.0",
44
- "@floating-ui/react": "^0.27.5",
45
- "@rc-component/color-picker": "^2.0.1",
46
- "@rc-component/father-plugin": "^2.0.1",
47
- "@rc-component/trigger": "^2.0.0",
48
- "@rc-component/util": "^1.0.1",
49
- "@types/react-resizable": "^3.0.8",
50
- "@types/styled-components": "^5.1.34",
51
- "@vitest/coverage-v8": "^2.0.5",
52
- "antd": "^5.24.1",
53
- "antd-style": "^3.7.1",
54
- "becoxy-icons": "^2.0.1",
55
- "classnames": "^2.3.1",
56
- "dayjs": "^1.11.13",
57
- "lodash": "^4.17.21",
58
- "moment": "^2.30.1",
59
- "postcss": "^8.4.35",
60
- "rc-checkbox": "^3.5.0",
61
- "rc-dropdown": "^4.2.1",
62
- "rc-field-form": "^2.6.0",
63
- "rc-master-ui": "^1.1.23",
64
- "rc-select": "^14.16.3",
65
- "rc-tooltip": "^6.3.0",
66
- "rc-tree": "^5.10.1",
67
- "rc-tree-select": "^5.24.5",
68
- "react-hook-form": "^7.54.2",
69
- "react-hot-toast": "^2.5.2",
70
- "react-numeric-component": "^1.0.7",
71
- "react-resizable": "^3.0.5",
72
- "react-tooltip": "^5.28.1",
73
- "sass": "^1.81.0",
74
- "styled-components": "^6.1.15",
75
- "sweetalert2": "^11.4.14",
76
- "sweetalert2-react-content": "^5.0.0",
77
- "throttle-debounce": "^5.0.2",
78
- "vitest": "^2.0.5"
79
- },
80
- "devDependencies": {
81
- "@babel/cli": "^7.26.4",
82
- "@babel/preset-env": "^7.26.9",
83
- "@rc-component/np": "^1.0.3",
84
- "@testing-library/react": "^14.0.0",
85
- "@types/jest": "^29.4.0",
86
- "@types/react": "^18.0.26",
87
- "@types/react-dom": "^18.0.10",
88
- "@types/warning": "^3.0.0",
89
- "cross-env": "^7.0.0",
90
- "dumi": "^2.2.13",
91
- "eslint": "^8.56.0",
92
- "eslint-plugin-unicorn": "^55.0.0",
93
- "father": "^4.0.0",
94
- "gh-pages": "^3.1.0",
95
- "less": "^4.1.1",
96
- "np": "^7.1.0",
97
- "rc-test": "^7.0.9",
98
- "react": "^18.2.0",
99
- "react-dom": "^18.2.0",
100
- "typescript": "^4.0.5"
101
- },
102
- "peerDependencies": {
103
- "react": ">=16.9.0",
104
- "react-dom": ">=16.9.0"
105
- },
106
- "umi": {
107
- "configFile": "config.ts"
108
- }
109
- }
1
+ {
2
+ "name": "es-grid-template",
3
+ "version": "1.3.5",
4
+ "description": "es-grid-template",
5
+ "keywords": [
6
+ "react",
7
+ "react-component",
8
+ "grid",
9
+ "table"
10
+ ],
11
+ "license": "MIT",
12
+ "main": "lib/index",
13
+ "module": "es/index",
14
+ "files": [
15
+ "lib",
16
+ "es",
17
+ "assets/*.css",
18
+ "assets/*.scss"
19
+ ],
20
+ "scripts": {
21
+ "__compile": "father build && ",
22
+ "compile": "father build && sass assets/index.scss assets/index.css",
23
+ "docs:build": "dumi build",
24
+ "__docs:deploy": "gh-pages -d dist",
25
+ "lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
26
+ "now-build": "npm run docs:build",
27
+ "prepare": "dumi setup",
28
+ "prepublishOnly": "npm run compile",
29
+ "postpublish": "npm run docs:build",
30
+ "__postpublish": "npm run docs:build && npm run docs:deploy",
31
+ "start": "dumi dev",
32
+ "test": "vitest --watch false",
33
+ "coverage": "vitest run --coverage"
34
+ },
35
+ "dependencies": {
36
+ "@ant-design/colors": "^8.0.0",
37
+ "@ant-design/cssinjs": "^1.22.0",
38
+ "@ant-design/cssinjs-utils": "^1.1.1",
39
+ "@ant-design/icons": "^5.5.2",
40
+ "@babel/runtime": "^7.11.2",
41
+ "@core-rc/rc-select": "^0.0.8",
42
+ "@ctrl/tinycolor": "^3.6.1",
43
+ "@faker-js/faker": "^9.5.0",
44
+ "@floating-ui/react": "^0.27.5",
45
+ "@rc-component/color-picker": "^2.0.1",
46
+ "@rc-component/father-plugin": "^2.0.1",
47
+ "@rc-component/trigger": "^2.0.0",
48
+ "@rc-component/util": "^1.0.1",
49
+ "@types/react-resizable": "^3.0.8",
50
+ "@types/styled-components": "^5.1.34",
51
+ "@vitest/coverage-v8": "^2.0.5",
52
+ "antd": "^5.24.1",
53
+ "antd-style": "^3.7.1",
54
+ "becoxy-icons": "^2.0.1",
55
+ "classnames": "^2.3.1",
56
+ "dayjs": "^1.11.13",
57
+ "lodash": "^4.17.21",
58
+ "moment": "^2.30.1",
59
+ "postcss": "^8.4.35",
60
+ "rc-checkbox": "^3.5.0",
61
+ "rc-dropdown": "^4.2.1",
62
+ "rc-field-form": "^2.6.0",
63
+ "rc-master-ui": "^1.1.24",
64
+ "rc-select": "^14.16.3",
65
+ "rc-tooltip": "^6.3.0",
66
+ "rc-tree": "^5.10.1",
67
+ "rc-tree-select": "^5.24.5",
68
+ "react-hook-form": "^7.54.2",
69
+ "react-hot-toast": "^2.5.2",
70
+ "react-numeric-component": "^1.0.7",
71
+ "react-resizable": "^3.0.5",
72
+ "react-tooltip": "^5.28.1",
73
+ "sass": "^1.81.0",
74
+ "styled-components": "^6.1.15",
75
+ "sweetalert2": "^11.4.14",
76
+ "sweetalert2-react-content": "^5.0.0",
77
+ "throttle-debounce": "^5.0.2",
78
+ "vitest": "^2.0.5"
79
+ },
80
+ "devDependencies": {
81
+ "@babel/cli": "^7.26.4",
82
+ "@babel/preset-env": "^7.26.9",
83
+ "@rc-component/np": "^1.0.3",
84
+ "@testing-library/react": "^14.0.0",
85
+ "@types/jest": "^29.4.0",
86
+ "@types/react": "^18.0.26",
87
+ "@types/react-dom": "^18.0.10",
88
+ "@types/warning": "^3.0.0",
89
+ "cross-env": "^7.0.0",
90
+ "dumi": "^2.2.13",
91
+ "eslint": "^8.56.0",
92
+ "eslint-plugin-unicorn": "^55.0.0",
93
+ "father": "^4.0.0",
94
+ "gh-pages": "^3.1.0",
95
+ "less": "^4.1.1",
96
+ "np": "^7.1.0",
97
+ "rc-test": "^7.0.9",
98
+ "react": "^18.2.0",
99
+ "react-dom": "^18.2.0",
100
+ "typescript": "^4.0.5"
101
+ },
102
+ "peerDependencies": {
103
+ "react": ">=16.9.0",
104
+ "react-dom": ">=16.9.0"
105
+ },
106
+ "umi": {
107
+ "configFile": "config.ts"
108
+ }
109
+ }