linkmore-design 1.1.27-beta.3 → 1.1.27-beta.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.
@@ -1255,6 +1255,11 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1255
1255
  }, body)
1256
1256
  };
1257
1257
  }, [sortOpen, resizeable, components, colSortOpen, customizeDataSource, columns, openRowGroup]);
1258
+ (0, _react.useEffect)(function () {
1259
+ if (autoSize && autoSize.height !== '100%') {
1260
+ document.querySelector('.lm_protable .ant-table-body').style.height = autoSize.height + 'px';
1261
+ }
1262
+ }, [autoSize]);
1258
1263
  return /*#__PURE__*/_react.default.createElement("div", {
1259
1264
  style: {
1260
1265
  height: '100%',
@@ -21,14 +21,18 @@ var dfs = function dfs(dataSource, dataIndex, expression) {
21
21
  }
22
22
  calc(item, [[dataIndex, expression]], history);
23
23
  });
24
- console.log(history);
25
24
  if (history && history.length) {
26
25
  var sum = 0;
27
26
  history.forEach(function (h) {
28
27
  sum += h.sum;
29
28
  });
30
29
  history.forEach(function (h) {
31
- h.item[h.dataIndex] = (h.sum / sum * 100).toFixed(2) + '%';
30
+ if (sum < 0.000001) {
31
+ sum = 0;
32
+ h.item[h.dataIndex] = '0%';
33
+ } else {
34
+ h.item[h.dataIndex] = (h.sum / sum * 100).toFixed(2) + '%';
35
+ }
32
36
  h.item["".concat(h.dataIndex, "_sum")] = sum;
33
37
  });
34
38
  }
@@ -36,6 +40,9 @@ var dfs = function dfs(dataSource, dataIndex, expression) {
36
40
  average(dataSource);
37
41
  };
38
42
  var strategy = [{
43
+ value: '',
44
+ label: '不计算'
45
+ }, {
39
46
  value: 'percent',
40
47
  label: '百分比'
41
48
  }, {
@@ -85,26 +92,28 @@ var CalcExpression = function CalcExpression(props) {
85
92
  }
86
93
  };
87
94
  if (record && record._group && isShowSelect && (col === null || col === void 0 ? void 0 : col.dataIndex)) {
88
- return /*#__PURE__*/React.createElement("td", Object.assign({}, rest, {
95
+ var select = Object.assign({
96
+ placeholder: '不计算',
97
+ allowClear: false,
98
+ size: "small",
99
+ bordered: false
100
+ }, col.expressionSelect ? col.expressionSelect : {});
101
+ return /*#__PURE__*/React.createElement("td", Object.assign({}, rest), /*#__PURE__*/React.createElement("div", {
89
102
  style: {
90
103
  display: 'flex',
91
104
  alignItems: 'center'
92
105
  }
93
- }), /*#__PURE__*/React.createElement("span", null, record[col.dataIndex]), /*#__PURE__*/React.createElement(Select, {
106
+ }, /*#__PURE__*/React.createElement("span", null, record[col.dataIndex]), /*#__PURE__*/React.createElement(Select, Object.assign({
94
107
  className: "calc-select",
95
108
  value: record["".concat(col.dataIndex, "_exp")],
96
- size: "small",
97
- bordered: false,
98
- onChange: onChange,
99
- placeholder: "\u8BF7\u9009\u62E9",
100
- allowClear: true
101
- }, currentStrategy.map(function (item) {
109
+ onChange: onChange
110
+ }, select), currentStrategy.map(function (item) {
102
111
  return /*#__PURE__*/React.createElement(Option, {
103
112
  className: "calc-option",
104
113
  value: item.value,
105
114
  key: item.value
106
115
  }, item.label);
107
- })));
116
+ }))));
108
117
  }
109
118
  return /*#__PURE__*/React.createElement("td", Object.assign({}, rest), children);
110
119
  };
@@ -1255,6 +1255,11 @@ var ResetTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
1255
1255
  }, body)
1256
1256
  };
1257
1257
  }, [sortOpen, resizeable, components, colSortOpen, customizeDataSource, columns, openRowGroup]);
1258
+ (0, _react.useEffect)(function () {
1259
+ if (autoSize && autoSize.height !== '100%') {
1260
+ document.querySelector('.lm_protable .ant-table-body').style.height = autoSize.height + 'px';
1261
+ }
1262
+ }, [autoSize]);
1258
1263
  return /*#__PURE__*/_react.default.createElement("div", {
1259
1264
  style: {
1260
1265
  height: '100%',
@@ -29,14 +29,18 @@ var dfs = function dfs(dataSource, dataIndex, expression) {
29
29
  }
30
30
  (0, _expression.default)(item, [[dataIndex, expression]], history);
31
31
  });
32
- console.log(history);
33
32
  if (history && history.length) {
34
33
  var sum = 0;
35
34
  history.forEach(function (h) {
36
35
  sum += h.sum;
37
36
  });
38
37
  history.forEach(function (h) {
39
- h.item[h.dataIndex] = (h.sum / sum * 100).toFixed(2) + '%';
38
+ if (sum < 0.000001) {
39
+ sum = 0;
40
+ h.item[h.dataIndex] = '0%';
41
+ } else {
42
+ h.item[h.dataIndex] = (h.sum / sum * 100).toFixed(2) + '%';
43
+ }
40
44
  h.item["".concat(h.dataIndex, "_sum")] = sum;
41
45
  });
42
46
  }
@@ -44,6 +48,9 @@ var dfs = function dfs(dataSource, dataIndex, expression) {
44
48
  average(dataSource);
45
49
  };
46
50
  var strategy = [{
51
+ value: '',
52
+ label: '不计算'
53
+ }, {
47
54
  value: 'percent',
48
55
  label: '百分比'
49
56
  }, {
@@ -93,26 +100,28 @@ var CalcExpression = function CalcExpression(props) {
93
100
  }
94
101
  };
95
102
  if (record && record._group && isShowSelect && (col === null || col === void 0 ? void 0 : col.dataIndex)) {
96
- return /*#__PURE__*/_react.default.createElement("td", Object.assign({}, rest, {
103
+ var select = Object.assign({
104
+ placeholder: '不计算',
105
+ allowClear: false,
106
+ size: "small",
107
+ bordered: false
108
+ }, col.expressionSelect ? col.expressionSelect : {});
109
+ return /*#__PURE__*/_react.default.createElement("td", Object.assign({}, rest), /*#__PURE__*/_react.default.createElement("div", {
97
110
  style: {
98
111
  display: 'flex',
99
112
  alignItems: 'center'
100
113
  }
101
- }), /*#__PURE__*/_react.default.createElement("span", null, record[col.dataIndex]), /*#__PURE__*/_react.default.createElement(_Select.default, {
114
+ }, /*#__PURE__*/_react.default.createElement("span", null, record[col.dataIndex]), /*#__PURE__*/_react.default.createElement(_Select.default, Object.assign({
102
115
  className: "calc-select",
103
116
  value: record["".concat(col.dataIndex, "_exp")],
104
- size: "small",
105
- bordered: false,
106
- onChange: onChange,
107
- placeholder: "\u8BF7\u9009\u62E9",
108
- allowClear: true
109
- }, currentStrategy.map(function (item) {
117
+ onChange: onChange
118
+ }, select), currentStrategy.map(function (item) {
110
119
  return /*#__PURE__*/_react.default.createElement(Option, {
111
120
  className: "calc-option",
112
121
  value: item.value,
113
122
  key: item.value
114
123
  }, item.label);
115
- })));
124
+ }))));
116
125
  }
117
126
  return /*#__PURE__*/_react.default.createElement("td", Object.assign({}, rest), children);
118
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkmore-design",
3
- "version": "1.1.27-beta.3",
3
+ "version": "1.1.27-beta.5",
4
4
  "author": {
5
5
  "name": "nowthen",
6
6
  "email": "rnlvwyx@gmail.com"