es-grid-template 1.3.2 → 1.3.3

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.
@@ -156,7 +156,6 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
156
156
  min: selectedKeys[0],
157
157
  max: selectedKeys[1],
158
158
  onChange: vals => {
159
- console.log('NumberRange', vals);
160
159
  setSelectedKeys(vals);
161
160
  }
162
161
  })));
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
+ import type { IFormat } from "../type";
2
3
  type Props = {
3
4
  t?: any;
4
- format?: any;
5
+ format?: IFormat;
5
6
  min: number | string | undefined;
6
7
  max: number | string | undefined;
7
8
  onChange?: (values: any[]) => void;
@@ -1,11 +1,13 @@
1
1
  import React, { Fragment } from "react";
2
2
  import { NumericFormat } from "react-numeric-component";
3
3
  import { Input } from "rc-master-ui";
4
+ import { checkDecimalSeparator, checkThousandSeparator } from "../hooks";
4
5
  const NumberRange = props => {
5
6
  const {
6
7
  t,
7
8
  max,
8
9
  min,
10
+ format,
9
11
  onChange
10
12
  } = props;
11
13
  const values = React.useMemo(() => [min, max], [min, max]);
@@ -17,43 +19,45 @@ const NumberRange = props => {
17
19
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
18
20
  className: '',
19
21
  style: {
20
- display: 'flex'
22
+ display: 'flex',
23
+ alignItems: 'center',
24
+ columnGap: 5
21
25
  }
22
- }, /*#__PURE__*/React.createElement("div", {
23
- style: {
24
- marginBottom: 8
25
- }
26
- }, /*#__PURE__*/React.createElement(NumericFormat, {
26
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(NumericFormat, {
27
27
  value: values[0] ?? ''
28
28
  // value={min}
29
- // thousandSeparator={checkThousandSeparator(thousandSeparator, decimalSeparator)}
30
- // decimalSeparator={checkDecimalSeparator(thousandSeparator, decimalSeparator)}
31
29
  ,
30
+ thousandSeparator: checkThousandSeparator(format?.thousandSeparator, format?.decimalSeparator),
31
+ decimalSeparator: checkDecimalSeparator(format?.thousandSeparator, format?.decimalSeparator),
32
32
  allowNegative: true,
33
33
  customInput: Input,
34
- className: ' rounded-0 input-element form-control',
34
+ className: ' rounded-0 input-element',
35
35
  onValueChange: vals => {
36
36
  // onChangeValueFilter(type, values.floatValue, 'min')
37
37
 
38
38
  // setValues([vals.floatValue, values[1]])
39
39
  onChange?.([vals.floatValue, max]);
40
- },
41
- placeholder: t ? t('Min') : 'Min',
40
+ }
41
+ // placeholder={t ? t('Min') : 'Min'}
42
+ ,
43
+ placeholder: t ? t('From') : 'From',
42
44
  autoFocus: true
43
- })), /*#__PURE__*/React.createElement("span", null, "-"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(NumericFormat, {
45
+ })), /*#__PURE__*/React.createElement("span", null, " - "), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(NumericFormat, {
44
46
  value: values[1] ?? ''
45
47
  // value={max}
46
- // thousandSeparator={checkThousandSeparator(thousandSeparator, decimalSeparator)}
47
- // decimalSeparator={checkDecimalSeparator(thousandSeparator, decimalSeparator)}
48
48
  ,
49
+ thousandSeparator: checkThousandSeparator(format?.thousandSeparator, format?.decimalSeparator),
50
+ decimalSeparator: checkDecimalSeparator(format?.thousandSeparator, format?.decimalSeparator),
49
51
  allowNegative: true,
50
52
  customInput: Input,
51
- className: ' rounded-0 input-element form-control',
53
+ className: ' rounded-0 input-element',
52
54
  onValueChange: vals => {
53
55
  // setValues([values[0], vals.floatValue])
54
56
  onChange?.([min, vals.floatValue]);
55
- },
56
- placeholder: t ? t('Max') : 'Max'
57
+ }
58
+ // placeholder={t ? t('Max') : 'Max'}
59
+ ,
60
+ placeholder: t ? t('To') : 'To'
57
61
  }))));
58
62
  };
59
63
  export default NumberRange;
@@ -714,7 +714,8 @@ const GridEdit = props => {
714
714
  };
715
715
  }, []);
716
716
  const handleMouseDown = useCallback((record, row, col, e) => {
717
- setEditingKey('');
717
+ // setEditingKey('')
718
+
718
719
  if (e.button === 2) {
719
720
  e.stopPropagation();
720
721
  return;
@@ -38,6 +38,14 @@ const Group = props => {
38
38
  }
39
39
  return [];
40
40
  });
41
+ React.useEffect(() => {
42
+ if (defaultExpandedRowKeys) {
43
+ setInnerExpandedKeys(defaultExpandedRowKeys);
44
+ }
45
+ if (defaultExpandAllRows) {
46
+ setInnerExpandedKeys(findAllChildrenKeys(dataSource, getRowKey, childrenColumnName) ?? []);
47
+ }
48
+ }, [defaultExpandedRowKeys, defaultExpandAllRows, dataSource]);
41
49
  const mergedExpandedKeys = React.useMemo(() => new Set(innerExpandedKeys || []), [innerExpandedKeys]);
42
50
  const onTriggerExpand = React.useCallback(record => {
43
51
  const key = getRowKey(record, dataSource.indexOf(record));
@@ -169,7 +169,6 @@ const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, s
169
169
  min: selectedKeys[0],
170
170
  max: selectedKeys[1],
171
171
  onChange: vals => {
172
- console.log('NumberRange', vals);
173
172
  setSelectedKeys(vals);
174
173
  }
175
174
  })));
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
+ import type { IFormat } from "../type";
2
3
  type Props = {
3
4
  t?: any;
4
- format?: any;
5
+ format?: IFormat;
5
6
  min: number | string | undefined;
6
7
  max: number | string | undefined;
7
8
  onChange?: (values: any[]) => void;
@@ -7,6 +7,7 @@ exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNumericComponent = require("react-numeric-component");
9
9
  var _rcMasterUi = require("rc-master-ui");
10
+ var _hooks = require("../hooks");
10
11
  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); }
11
12
  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; }
12
13
  const NumberRange = props => {
@@ -14,6 +15,7 @@ const NumberRange = props => {
14
15
  t,
15
16
  max,
16
17
  min,
18
+ format,
17
19
  onChange
18
20
  } = props;
19
21
  const values = _react.default.useMemo(() => [min, max], [min, max]);
@@ -25,43 +27,45 @@ const NumberRange = props => {
25
27
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
26
28
  className: '',
27
29
  style: {
28
- display: 'flex'
30
+ display: 'flex',
31
+ alignItems: 'center',
32
+ columnGap: 5
29
33
  }
30
- }, /*#__PURE__*/_react.default.createElement("div", {
31
- style: {
32
- marginBottom: 8
33
- }
34
- }, /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, {
34
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, {
35
35
  value: values[0] ?? ''
36
36
  // value={min}
37
- // thousandSeparator={checkThousandSeparator(thousandSeparator, decimalSeparator)}
38
- // decimalSeparator={checkDecimalSeparator(thousandSeparator, decimalSeparator)}
39
37
  ,
38
+ thousandSeparator: (0, _hooks.checkThousandSeparator)(format?.thousandSeparator, format?.decimalSeparator),
39
+ decimalSeparator: (0, _hooks.checkDecimalSeparator)(format?.thousandSeparator, format?.decimalSeparator),
40
40
  allowNegative: true,
41
41
  customInput: _rcMasterUi.Input,
42
- className: ' rounded-0 input-element form-control',
42
+ className: ' rounded-0 input-element',
43
43
  onValueChange: vals => {
44
44
  // onChangeValueFilter(type, values.floatValue, 'min')
45
45
 
46
46
  // setValues([vals.floatValue, values[1]])
47
47
  onChange?.([vals.floatValue, max]);
48
- },
49
- placeholder: t ? t('Min') : 'Min',
48
+ }
49
+ // placeholder={t ? t('Min') : 'Min'}
50
+ ,
51
+ placeholder: t ? t('From') : 'From',
50
52
  autoFocus: true
51
- })), /*#__PURE__*/_react.default.createElement("span", null, "-"), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, {
53
+ })), /*#__PURE__*/_react.default.createElement("span", null, " - "), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, {
52
54
  value: values[1] ?? ''
53
55
  // value={max}
54
- // thousandSeparator={checkThousandSeparator(thousandSeparator, decimalSeparator)}
55
- // decimalSeparator={checkDecimalSeparator(thousandSeparator, decimalSeparator)}
56
56
  ,
57
+ thousandSeparator: (0, _hooks.checkThousandSeparator)(format?.thousandSeparator, format?.decimalSeparator),
58
+ decimalSeparator: (0, _hooks.checkDecimalSeparator)(format?.thousandSeparator, format?.decimalSeparator),
57
59
  allowNegative: true,
58
60
  customInput: _rcMasterUi.Input,
59
- className: ' rounded-0 input-element form-control',
61
+ className: ' rounded-0 input-element',
60
62
  onValueChange: vals => {
61
63
  // setValues([values[0], vals.floatValue])
62
64
  onChange?.([min, vals.floatValue]);
63
- },
64
- placeholder: t ? t('Max') : 'Max'
65
+ }
66
+ // placeholder={t ? t('Max') : 'Max'}
67
+ ,
68
+ placeholder: t ? t('To') : 'To'
65
69
  }))));
66
70
  };
67
71
  var _default = exports.default = NumberRange;
@@ -722,7 +722,8 @@ const GridEdit = props => {
722
722
  };
723
723
  }, []);
724
724
  const handleMouseDown = (0, _react.useCallback)((record, row, col, e) => {
725
- setEditingKey('');
725
+ // setEditingKey('')
726
+
726
727
  if (e.button === 2) {
727
728
  e.stopPropagation();
728
729
  return;
@@ -47,6 +47,14 @@ const Group = props => {
47
47
  }
48
48
  return [];
49
49
  });
50
+ _react.default.useEffect(() => {
51
+ if (defaultExpandedRowKeys) {
52
+ setInnerExpandedKeys(defaultExpandedRowKeys);
53
+ }
54
+ if (defaultExpandAllRows) {
55
+ setInnerExpandedKeys((0, _hooks.findAllChildrenKeys)(dataSource, getRowKey, childrenColumnName) ?? []);
56
+ }
57
+ }, [defaultExpandedRowKeys, defaultExpandAllRows, dataSource]);
50
58
  const mergedExpandedKeys = _react.default.useMemo(() => new Set(innerExpandedKeys || []), [innerExpandedKeys]);
51
59
  const onTriggerExpand = _react.default.useCallback(record => {
52
60
  const key = getRowKey(record, dataSource.indexOf(record));
package/package.json CHANGED
@@ -1,109 +1,109 @@
1
- {
2
- "name": "es-grid-template",
3
- "version": "1.3.2",
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.3",
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
+ }