@zat-design/sisyphus-react 3.9.7 → 3.9.8

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.
@@ -917,7 +917,7 @@
917
917
  }
918
918
  .pro-header .pro-header-describe .ant-space .pro-header-describe-value .pro-header-describe-items.pro-header-describe-items-more .pro-header-tag {
919
919
  padding: 0;
920
- background: transparent;
920
+ background: transparent !important;
921
921
  color: #333;
922
922
  }
923
923
  .pro-header .pro-header-copy {
@@ -1854,6 +1854,12 @@
1854
1854
  .pro-table .ant-table-content > table td .pro-form-view-container_nowrap {
1855
1855
  white-space: normal;
1856
1856
  }
1857
+ .pro-table .ant-table-content > table td.ant-table-row-expand-icon-cell > button.ant-table-row-expand-icon {
1858
+ left: 50%;
1859
+ top: 50%;
1860
+ -webkit-transform: translate(-50%, -50%);
1861
+ transform: translate(-50%, -50%);
1862
+ }
1857
1863
  .pro-table .ant-table-content > table .ant-table-thead > tr > th:not(.ant-table-selection-column):not( .ant-table-row-expand-icon-cell):not([colspan]).is-required.is-required-right .pro-edit-table-title::before {
1858
1864
  position: static;
1859
1865
  top: 0;
package/dist/less.esm.css CHANGED
@@ -917,7 +917,7 @@
917
917
  }
918
918
  .pro-header .pro-header-describe .ant-space .pro-header-describe-value .pro-header-describe-items.pro-header-describe-items-more .pro-header-tag {
919
919
  padding: 0;
920
- background: transparent;
920
+ background: transparent !important;
921
921
  color: #333;
922
922
  }
923
923
  .pro-header .pro-header-copy {
@@ -1854,6 +1854,12 @@
1854
1854
  .pro-table .ant-table-content > table td .pro-form-view-container_nowrap {
1855
1855
  white-space: normal;
1856
1856
  }
1857
+ .pro-table .ant-table-content > table td.ant-table-row-expand-icon-cell > button.ant-table-row-expand-icon {
1858
+ left: 50%;
1859
+ top: 50%;
1860
+ -webkit-transform: translate(-50%, -50%);
1861
+ transform: translate(-50%, -50%);
1862
+ }
1857
1863
  .pro-table .ant-table-content > table .ant-table-thead > tr > th:not(.ant-table-selection-column):not( .ant-table-row-expand-icon-cell):not([colspan]).is-required.is-required-right .pro-edit-table-title::before {
1858
1864
  position: static;
1859
1865
  top: 0;
@@ -236,15 +236,14 @@ export var actions = {
236
236
  virtualKey: virtualKey,
237
237
  selectedRowKeys: selectedRowKeys
238
238
  });
239
+ var nextData = {
240
+ selectedRowKeys: [],
241
+ selectedRows: []
242
+ };
239
243
  // 删除的选择数据包含单行编辑行时,清空可编辑key
240
244
  if (virtualKey && selectedRowKeys.includes(editingKeys === null || editingKeys === void 0 ? void 0 : editingKeys[0])) {
241
- setState({
242
- editingKeys: []
243
- });
245
+ nextData.editingKeys = [];
244
246
  }
245
- setState({
246
- selectedRowKeys: [],
247
- selectedRows: []
248
- });
247
+ setState(nextData);
249
248
  }
250
249
  };
@@ -81,7 +81,7 @@
81
81
  &.pro-header-describe-items-more{
82
82
  .pro-header-tag{
83
83
  padding: 0;
84
- background: transparent;
84
+ background: transparent !important;
85
85
  color: #333 ;
86
86
  }
87
87
 
@@ -1,12 +1,12 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
3
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
5
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
5
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
6
  var _excluded = ["children"];
8
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
- import { createContext, useContext, useMemo, useRef, useState } from 'react';
8
+ import { createContext, useCallback, useContext, useMemo, useRef, useState } from 'react';
9
+ import { debounce } from 'lodash';
10
10
  import { useSetState, useLocalStorageState, useDeepCompareEffect } from 'ahooks';
11
11
  import { handleScroll } from './utils';
12
12
  import Step from './components/Step';
@@ -20,10 +20,9 @@ export var useStep = function useStep() {
20
20
  var ProStep = function ProStep(_ref) {
21
21
  var children = _ref.children,
22
22
  resetProps = _objectWithoutProperties(_ref, _excluded);
23
- var _useState = useState([]),
23
+ var _useState = useState({}),
24
24
  _useState2 = _slicedToArray(_useState, 2),
25
- ids = _useState2[0],
26
- setIds = _useState2[1];
25
+ reRender = _useState2[1];
27
26
  var _useSetState = useSetState({}),
28
27
  _useSetState2 = _slicedToArray(_useSetState, 2),
29
28
  errorCollection = _useSetState2[0],
@@ -33,6 +32,7 @@ var ProStep = function ProStep(_ref) {
33
32
  var _useLocalStorageState = useLocalStorageState('cache-pro-step'),
34
33
  _useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 2),
35
34
  setLocalData = _useLocalStorageState2[1];
35
+ var ids = Object.keys(registerMap.current);
36
36
  var targetOffset = resetProps.targetOffset,
37
37
  _resetProps$collapse = resetProps.collapse,
38
38
  collapse = _resetProps$collapse === void 0 ? false : _resetProps$collapse,
@@ -61,6 +61,9 @@ var ProStep = function ProStep(_ref) {
61
61
  return pre.order - next.order;
62
62
  });
63
63
  }, [resetProps === null || resetProps === void 0 ? void 0 : resetProps.dataSource, registerMap.current, ids]);
64
+ var debounceReRender = useCallback(debounce(function () {
65
+ return reRender({});
66
+ }, 500), []);
64
67
  // 用来注册form匹配到对应的模块id
65
68
  var register = function register(_ref4) {
66
69
  var id = _ref4.id,
@@ -72,10 +75,8 @@ var ProStep = function ProStep(_ref) {
72
75
  var record = {};
73
76
  record.title = title;
74
77
  record.order = order;
75
- if (!ids.includes(id)) {
76
- setIds(function (preState) {
77
- return [].concat(_toConsumableArray(preState), [id]);
78
- });
78
+ if (!registerMap.current[id]) {
79
+ debounceReRender();
79
80
  }
80
81
  if (disabled) {
81
82
  registerMap.current[id] = record;
@@ -139,8 +139,29 @@ export var formatColumn = function formatColumn(_ref2) {
139
139
  index: index
140
140
  });
141
141
  // viewRender 返回值为 false 时,不显示对比
142
- if (isBoolean(diffResult) && !diffResult) {
143
- otherProps.isChanged = false;
142
+ if (isBoolean(diffResult)) {
143
+ if (!diffResult) {
144
+ otherProps.isChanged = false;
145
+ _isAddCell = false;
146
+ } else {
147
+ otherProps.isChanged = true;
148
+ _isAddCell = false;
149
+ }
150
+ }
151
+ // 指定返回相同了
152
+ if (typeof diffResult === 'string') {
153
+ if (diffResult === 'changed') {
154
+ _isAddCell = false;
155
+ otherProps.isChanged = true;
156
+ }
157
+ if (diffResult === 'same') {
158
+ _isAddCell = false;
159
+ otherProps.isChanged = false;
160
+ }
161
+ if (diffResult === 'add') {
162
+ _isAddCell = true;
163
+ otherProps.isChanged = false;
164
+ }
144
165
  }
145
166
  originalValue = diffResult;
146
167
  }
@@ -155,9 +176,11 @@ export var formatColumn = function formatColumn(_ref2) {
155
176
  index: index
156
177
  });
157
178
  if (_diffResult === 'changed') {
179
+ _isAddCell = false;
158
180
  otherProps.isChanged = true;
159
181
  }
160
182
  if (_diffResult === 'same') {
183
+ _isAddCell = false;
161
184
  otherProps.isChanged = false;
162
185
  }
163
186
  if (_diffResult === 'add') {
@@ -317,6 +340,11 @@ export var formatColumn = function formatColumn(_ref2) {
317
340
  if (!originalValue) {
318
341
  originalRenderValue = '-';
319
342
  }
343
+ if (renderValue !== originalRenderValue) {
344
+ otherProps.isChanged = true;
345
+ } else {
346
+ otherProps.isChanged = false;
347
+ }
320
348
  var node = _jsxs(_Space, {
321
349
  size: 8,
322
350
  children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
@@ -250,6 +250,9 @@ var ProTable = function ProTable(props) {
250
250
  if (isExistPercentWidth) {
251
251
  _scroll = props === null || props === void 0 ? void 0 : props.scroll;
252
252
  }
253
+ if (props.expandable) {
254
+ _scroll = {};
255
+ }
253
256
  var handleColumnConfig = /*#__PURE__*/function () {
254
257
  var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(checkList) {
255
258
  var newColumns, _columnConfig$onColum, catchColumns;
@@ -40,6 +40,13 @@
40
40
  .pro-form-view-container_nowrap {
41
41
  white-space: normal;
42
42
  }
43
+ &.@{ant-prefix}-table-row-expand-icon-cell {
44
+ >button.@{ant-prefix}-table-row-expand-icon{
45
+ left: 50%;
46
+ top: 50%;
47
+ transform: translate(-50%, -50%);
48
+ }
49
+ }
43
50
  }
44
51
 
45
52
  .@{ant-prefix}-table-thead
@@ -569,8 +569,8 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
569
569
  children: _jsx(_TreeSelect, _objectSpread(_objectSpread({
570
570
  maxTagPlaceholder: function maxTagPlaceholder(rest) {
571
571
  var _rest = rest.map(function (tag) {
572
- var _tag$label, _tag$label$props, _tag$label$props$dang;
573
- return (tag === null || tag === void 0 ? void 0 : (_tag$label = tag.label) === null || _tag$label === void 0 ? void 0 : (_tag$label$props = _tag$label.props) === null || _tag$label$props === void 0 ? void 0 : (_tag$label$props$dang = _tag$label$props.dangerouslySetInnerHTML) === null || _tag$label$props$dang === void 0 ? void 0 : _tag$label$props$dang.__html) || tag.label;
572
+ var _tag$label, _tag$label$props, _tag$label2, _tag$label2$props, _tag$label2$props$chi, _tag$label2$props$chi2, _tag$label2$props$chi3, _tag$label3, _tag$label3$props, _tag$label3$props$dan;
573
+ return ((tag === null || tag === void 0 ? void 0 : (_tag$label = tag.label) === null || _tag$label === void 0 ? void 0 : (_tag$label$props = _tag$label.props) === null || _tag$label$props === void 0 ? void 0 : _tag$label$props.children) ? tag === null || tag === void 0 ? void 0 : (_tag$label2 = tag.label) === null || _tag$label2 === void 0 ? void 0 : (_tag$label2$props = _tag$label2.props) === null || _tag$label2$props === void 0 ? void 0 : (_tag$label2$props$chi = _tag$label2$props.children) === null || _tag$label2$props$chi === void 0 ? void 0 : (_tag$label2$props$chi2 = _tag$label2$props$chi.props) === null || _tag$label2$props$chi2 === void 0 ? void 0 : (_tag$label2$props$chi3 = _tag$label2$props$chi2.dangerouslySetInnerHTML) === null || _tag$label2$props$chi3 === void 0 ? void 0 : _tag$label2$props$chi3.__html : tag === null || tag === void 0 ? void 0 : (_tag$label3 = tag.label) === null || _tag$label3 === void 0 ? void 0 : (_tag$label3$props = _tag$label3.props) === null || _tag$label3$props === void 0 ? void 0 : (_tag$label3$props$dan = _tag$label3$props.dangerouslySetInnerHTML) === null || _tag$label3$props$dan === void 0 ? void 0 : _tag$label3$props$dan.__html) || tag.label;
574
574
  });
575
575
  var _str = _rest.join('、');
576
576
  return _jsx(_Tooltip, {
@@ -242,15 +242,14 @@ var actions = exports.actions = {
242
242
  virtualKey: virtualKey,
243
243
  selectedRowKeys: selectedRowKeys
244
244
  });
245
+ var nextData = {
246
+ selectedRowKeys: [],
247
+ selectedRows: []
248
+ };
245
249
  // 删除的选择数据包含单行编辑行时,清空可编辑key
246
250
  if (virtualKey && selectedRowKeys.includes(editingKeys === null || editingKeys === void 0 ? void 0 : editingKeys[0])) {
247
- setState({
248
- editingKeys: []
249
- });
251
+ nextData.editingKeys = [];
250
252
  }
251
- setState({
252
- selectedRowKeys: [],
253
- selectedRows: []
254
- });
253
+ setState(nextData);
255
254
  }
256
255
  };
@@ -81,7 +81,7 @@
81
81
  &.pro-header-describe-items-more{
82
82
  .pro-header-tag{
83
83
  padding: 0;
84
- background: transparent;
84
+ background: transparent !important;
85
85
  color: #333 ;
86
86
  }
87
87
 
@@ -8,11 +8,11 @@ exports.useStep = exports.default = exports.ProStepContext = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
9
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
12
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
14
13
  var _jsxRuntime = require("react/jsx-runtime");
15
14
  var _react = require("react");
15
+ var _lodash = require("lodash");
16
16
  var _ahooks = require("ahooks");
17
17
  var _utils = require("./utils");
18
18
  var _Step = _interopRequireDefault(require("./components/Step"));
@@ -27,10 +27,9 @@ var useStep = exports.useStep = function useStep() {
27
27
  var ProStep = function ProStep(_ref) {
28
28
  var children = _ref.children,
29
29
  resetProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
30
- var _useState = (0, _react.useState)([]),
30
+ var _useState = (0, _react.useState)({}),
31
31
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
32
- ids = _useState2[0],
33
- setIds = _useState2[1];
32
+ reRender = _useState2[1];
34
33
  var _useSetState = (0, _ahooks.useSetState)({}),
35
34
  _useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
36
35
  errorCollection = _useSetState2[0],
@@ -40,6 +39,7 @@ var ProStep = function ProStep(_ref) {
40
39
  var _useLocalStorageState = (0, _ahooks.useLocalStorageState)('cache-pro-step'),
41
40
  _useLocalStorageState2 = (0, _slicedToArray2.default)(_useLocalStorageState, 2),
42
41
  setLocalData = _useLocalStorageState2[1];
42
+ var ids = Object.keys(registerMap.current);
43
43
  var targetOffset = resetProps.targetOffset,
44
44
  _resetProps$collapse = resetProps.collapse,
45
45
  collapse = _resetProps$collapse === void 0 ? false : _resetProps$collapse,
@@ -68,6 +68,9 @@ var ProStep = function ProStep(_ref) {
68
68
  return pre.order - next.order;
69
69
  });
70
70
  }, [resetProps === null || resetProps === void 0 ? void 0 : resetProps.dataSource, registerMap.current, ids]);
71
+ var debounceReRender = (0, _react.useCallback)((0, _lodash.debounce)(function () {
72
+ return reRender({});
73
+ }, 500), []);
71
74
  // 用来注册form匹配到对应的模块id
72
75
  var register = function register(_ref4) {
73
76
  var id = _ref4.id,
@@ -79,10 +82,8 @@ var ProStep = function ProStep(_ref) {
79
82
  var record = {};
80
83
  record.title = title;
81
84
  record.order = order;
82
- if (!ids.includes(id)) {
83
- setIds(function (preState) {
84
- return [].concat((0, _toConsumableArray2.default)(preState), [id]);
85
- });
85
+ if (!registerMap.current[id]) {
86
+ debounceReRender();
86
87
  }
87
88
  if (disabled) {
88
89
  registerMap.current[id] = record;
@@ -145,8 +145,29 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
145
145
  index: index
146
146
  });
147
147
  // viewRender 返回值为 false 时,不显示对比
148
- if ((0, _lodash.isBoolean)(diffResult) && !diffResult) {
149
- otherProps.isChanged = false;
148
+ if ((0, _lodash.isBoolean)(diffResult)) {
149
+ if (!diffResult) {
150
+ otherProps.isChanged = false;
151
+ _isAddCell = false;
152
+ } else {
153
+ otherProps.isChanged = true;
154
+ _isAddCell = false;
155
+ }
156
+ }
157
+ // 指定返回相同了
158
+ if (typeof diffResult === 'string') {
159
+ if (diffResult === 'changed') {
160
+ _isAddCell = false;
161
+ otherProps.isChanged = true;
162
+ }
163
+ if (diffResult === 'same') {
164
+ _isAddCell = false;
165
+ otherProps.isChanged = false;
166
+ }
167
+ if (diffResult === 'add') {
168
+ _isAddCell = true;
169
+ otherProps.isChanged = false;
170
+ }
150
171
  }
151
172
  originalValue = diffResult;
152
173
  }
@@ -161,9 +182,11 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
161
182
  index: index
162
183
  });
163
184
  if (_diffResult === 'changed') {
185
+ _isAddCell = false;
164
186
  otherProps.isChanged = true;
165
187
  }
166
188
  if (_diffResult === 'same') {
189
+ _isAddCell = false;
167
190
  otherProps.isChanged = false;
168
191
  }
169
192
  if (_diffResult === 'add') {
@@ -323,6 +346,11 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
323
346
  if (!originalValue) {
324
347
  originalRenderValue = '-';
325
348
  }
349
+ if (renderValue !== originalRenderValue) {
350
+ otherProps.isChanged = true;
351
+ } else {
352
+ otherProps.isChanged = false;
353
+ }
326
354
  var node = (0, _jsxRuntime.jsxs)(_antd.Space, {
327
355
  size: 8,
328
356
  children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
@@ -257,6 +257,9 @@ var ProTable = function ProTable(props) {
257
257
  if (isExistPercentWidth) {
258
258
  _scroll = props === null || props === void 0 ? void 0 : props.scroll;
259
259
  }
260
+ if (props.expandable) {
261
+ _scroll = {};
262
+ }
260
263
  var handleColumnConfig = /*#__PURE__*/function () {
261
264
  var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(checkList) {
262
265
  var newColumns, _columnConfig$onColum, catchColumns;
@@ -40,6 +40,13 @@
40
40
  .pro-form-view-container_nowrap {
41
41
  white-space: normal;
42
42
  }
43
+ &.@{ant-prefix}-table-row-expand-icon-cell {
44
+ >button.@{ant-prefix}-table-row-expand-icon{
45
+ left: 50%;
46
+ top: 50%;
47
+ transform: translate(-50%, -50%);
48
+ }
49
+ }
43
50
  }
44
51
 
45
52
  .@{ant-prefix}-table-thead
@@ -569,8 +569,8 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
569
569
  children: (0, _jsxRuntime.jsx)(_antd.TreeSelect, (0, _objectSpread2.default)((0, _objectSpread2.default)({
570
570
  maxTagPlaceholder: function maxTagPlaceholder(rest) {
571
571
  var _rest = rest.map(function (tag) {
572
- var _tag$label, _tag$label$props, _tag$label$props$dang;
573
- return (tag === null || tag === void 0 ? void 0 : (_tag$label = tag.label) === null || _tag$label === void 0 ? void 0 : (_tag$label$props = _tag$label.props) === null || _tag$label$props === void 0 ? void 0 : (_tag$label$props$dang = _tag$label$props.dangerouslySetInnerHTML) === null || _tag$label$props$dang === void 0 ? void 0 : _tag$label$props$dang.__html) || tag.label;
572
+ var _tag$label, _tag$label$props, _tag$label2, _tag$label2$props, _tag$label2$props$chi, _tag$label2$props$chi2, _tag$label2$props$chi3, _tag$label3, _tag$label3$props, _tag$label3$props$dan;
573
+ return ((tag === null || tag === void 0 ? void 0 : (_tag$label = tag.label) === null || _tag$label === void 0 ? void 0 : (_tag$label$props = _tag$label.props) === null || _tag$label$props === void 0 ? void 0 : _tag$label$props.children) ? tag === null || tag === void 0 ? void 0 : (_tag$label2 = tag.label) === null || _tag$label2 === void 0 ? void 0 : (_tag$label2$props = _tag$label2.props) === null || _tag$label2$props === void 0 ? void 0 : (_tag$label2$props$chi = _tag$label2$props.children) === null || _tag$label2$props$chi === void 0 ? void 0 : (_tag$label2$props$chi2 = _tag$label2$props$chi.props) === null || _tag$label2$props$chi2 === void 0 ? void 0 : (_tag$label2$props$chi3 = _tag$label2$props$chi2.dangerouslySetInnerHTML) === null || _tag$label2$props$chi3 === void 0 ? void 0 : _tag$label2$props$chi3.__html : tag === null || tag === void 0 ? void 0 : (_tag$label3 = tag.label) === null || _tag$label3 === void 0 ? void 0 : (_tag$label3$props = _tag$label3.props) === null || _tag$label3$props === void 0 ? void 0 : (_tag$label3$props$dan = _tag$label3$props.dangerouslySetInnerHTML) === null || _tag$label3$props$dan === void 0 ? void 0 : _tag$label3$props$dan.__html) || tag.label;
574
574
  });
575
575
  var _str = _rest.join('、');
576
576
  return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.9.7",
3
+ "version": "3.9.8",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1,5 +0,0 @@
1
- {
2
- "recommendations": [
3
- "kisstkondoros.vscode-codemetrics"
4
- ]
5
- }