@zat-design/sisyphus-react 3.6.2-beta.9 → 3.6.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.
@@ -2316,20 +2316,20 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2316
2316
  width: 100%;
2317
2317
  }
2318
2318
  .pro-address .ant-cascader {
2319
- width: 50% !important;
2319
+ width: 45% !important;
2320
2320
  }
2321
2321
  .pro-address .ant-cascader.no-detail {
2322
2322
  width: 100% !important;
2323
2323
  }
2324
2324
  .pro-address .pro-address-detail {
2325
- width: 50%;
2325
+ width: 55%;
2326
2326
  margin-left: 2px;
2327
2327
  }
2328
2328
  .pro-address .pro-address-detail .ant-input-affix-wrapper {
2329
2329
  width: 100%;
2330
2330
  }
2331
2331
  .pro-address .ant-input-affix-wrapper {
2332
- width: 50%;
2332
+ width: 55%;
2333
2333
  margin-left: 2px;
2334
2334
  }
2335
2335
  .pro-number-range .range-split {
package/dist/less.esm.css CHANGED
@@ -2316,20 +2316,20 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2316
2316
  width: 100%;
2317
2317
  }
2318
2318
  .pro-address .ant-cascader {
2319
- width: 50% !important;
2319
+ width: 45% !important;
2320
2320
  }
2321
2321
  .pro-address .ant-cascader.no-detail {
2322
2322
  width: 100% !important;
2323
2323
  }
2324
2324
  .pro-address .pro-address-detail {
2325
- width: 50%;
2325
+ width: 55%;
2326
2326
  margin-left: 2px;
2327
2327
  }
2328
2328
  .pro-address .pro-address-detail .ant-input-affix-wrapper {
2329
2329
  width: 100%;
2330
2330
  }
2331
2331
  .pro-address .ant-input-affix-wrapper {
2332
- width: 50%;
2332
+ width: 55%;
2333
2333
  margin-left: 2px;
2334
2334
  }
2335
2335
  .pro-number-range .range-split {
@@ -60,7 +60,7 @@ var ActionButton = function ActionButton(_ref) {
60
60
  // 其他操作按钮Props
61
61
  var actionBtnProps = _objectSpread(_objectSpread({}, btnConfig.buttonProps), {}, {
62
62
  onClick: function onClick() {
63
- btnConfig.onEvent(record, index);
63
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
64
64
  },
65
65
  disabled: getDisabled((_btnConfig$buttonProp3 = btnConfig.buttonProps) === null || _btnConfig$buttonProp3 === void 0 ? void 0 : _btnConfig$buttonProp3.disabled)
66
66
  });
@@ -77,7 +77,7 @@ var ActionButton = function ActionButton(_ref) {
77
77
  placement: "topRight",
78
78
  title: deleteMsgMap[btnConfig.type],
79
79
  onConfirm: function onConfirm() {
80
- btnConfig.onEvent(record, index);
80
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
81
81
  },
82
82
  disabled: isDisabled,
83
83
  okText: locale.ProEditTable.confirm,
@@ -97,13 +97,13 @@ var ActionButton = function ActionButton(_ref) {
97
97
  index: index,
98
98
  disabled: isDisabled,
99
99
  onClick: function onClick() {
100
- btnConfig.onEvent(record, index);
100
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
101
101
  }
102
102
  }))) : _jsx(_Button, _objectSpread(_objectSpread({}, omit(delBtnProps, ['buttonProps', 'isEditable'])), {}, {
103
103
  disabled: isDisabled,
104
104
  type: "link",
105
105
  onClick: function onClick() {
106
- btnConfig.onEvent(record, index);
106
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
107
107
  },
108
108
  children: btnConfig.label
109
109
  }))
@@ -73,37 +73,27 @@ var RenderToolbar = function RenderToolbar(config) {
73
73
  toolbar.needConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : true;
74
74
  toolbar.onEvent = /*#__PURE__*/function () {
75
75
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(record, index) {
76
- var _yield$onEvent;
77
76
  var onEvent, result;
78
77
  return _regeneratorRuntime().wrap(function _callee$(_context) {
79
78
  while (1) switch (_context.prev = _context.next) {
80
79
  case 0:
81
80
  onEvent = onClick || onHandle;
82
- _context.next = 3;
81
+ if (onEvent) {
82
+ _context.next = 5;
83
+ break;
84
+ }
85
+ result = true;
86
+ _context.next = 8;
87
+ break;
88
+ case 5:
89
+ _context.next = 7;
83
90
  return onEvent === null || onEvent === void 0 ? void 0 : onEvent(selectedRows, dataSource, {
84
91
  form: form,
85
92
  namePath: virtualName
86
93
  });
87
- case 3:
88
- _context.t1 = _yield$onEvent = _context.sent;
89
- _context.t0 = _context.t1 !== null;
90
- if (!_context.t0) {
91
- _context.next = 7;
92
- break;
93
- }
94
- _context.t0 = _yield$onEvent !== void 0;
95
94
  case 7:
96
- if (!_context.t0) {
97
- _context.next = 11;
98
- break;
99
- }
100
- _context.t2 = _yield$onEvent;
101
- _context.next = 12;
102
- break;
103
- case 11:
104
- _context.t2 = true;
105
- case 12:
106
- result = _context.t2;
95
+ result = _context.sent;
96
+ case 8:
107
97
  if (result && type !== 'custom') {
108
98
  actions[type](_objectSpread(_objectSpread({}, config), {}, {
109
99
  index: index,
@@ -113,7 +103,7 @@ var RenderToolbar = function RenderToolbar(config) {
113
103
  virtualName: virtualName
114
104
  }));
115
105
  }
116
- case 14:
106
+ case 9:
117
107
  case "end":
118
108
  return _context.stop();
119
109
  }
@@ -79,7 +79,7 @@ var getActionColumn = function getActionColumn(config) {
79
79
  action.needConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : true;
80
80
  action.onEvent = /*#__PURE__*/function () {
81
81
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(record, index) {
82
- var _form$getFieldValue, _yield$onEvent;
82
+ var _form$getFieldValue;
83
83
  var rowName, _record, onEvent, result;
84
84
  return _regeneratorRuntime().wrap(function _callee$(_context) {
85
85
  while (1) switch (_context.prev = _context.next) {
@@ -105,31 +105,22 @@ var getActionColumn = function getActionColumn(config) {
105
105
  // 编辑状态使用自定义form值,非编辑状态直接使用行数据
106
106
  _record = (_form$getFieldValue = form.getFieldValue(rowName)) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : record; // 新增事件可以设置初始默认值,当做函数的出参导出
107
107
  onEvent = onClick || onHandle;
108
- _context.next = 16;
108
+ if (onEvent) {
109
+ _context.next = 18;
110
+ break;
111
+ }
112
+ result = true;
113
+ _context.next = 21;
114
+ break;
115
+ case 18:
116
+ _context.next = 20;
109
117
  return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, index, {
110
118
  form: form,
111
119
  namePath: virtualRowName
112
120
  });
113
- case 16:
114
- _context.t2 = _yield$onEvent = _context.sent;
115
- _context.t1 = _context.t2 !== null;
116
- if (!_context.t1) {
117
- _context.next = 20;
118
- break;
119
- }
120
- _context.t1 = _yield$onEvent !== void 0;
121
121
  case 20:
122
- if (!_context.t1) {
123
- _context.next = 24;
124
- break;
125
- }
126
- _context.t3 = _yield$onEvent;
127
- _context.next = 25;
128
- break;
129
- case 24:
130
- _context.t3 = true;
131
- case 25:
132
- result = _context.t3;
122
+ result = _context.sent;
123
+ case 21:
133
124
  if (result && type !== 'custom') {
134
125
  actions[type](_objectSpread(_objectSpread({}, config), {}, {
135
126
  rowName: [].concat(_toConsumableArray(name), [index]),
@@ -139,7 +130,7 @@ var getActionColumn = function getActionColumn(config) {
139
130
  validateKeys: validateKeys
140
131
  }));
141
132
  }
142
- case 27:
133
+ case 22:
143
134
  case "end":
144
135
  return _context.stop();
145
136
  }
@@ -204,7 +195,7 @@ export var transformColumns = function transformColumns() {
204
195
  setState = config.setState,
205
196
  page = config.page;
206
197
  var isCell = mode === 'cell';
207
- var _columns = _toConsumableArray(columns);
198
+ var _columns = cloneDeep(columns);
208
199
  var _cacheMap = _objectSpread({}, cacheMap.current);
209
200
  var pageNum = tools.calc(page.pageNum, '-', 1);
210
201
  var firstIndex = tools.calc(pageNum, '*', page.pageSize);
@@ -17,10 +17,8 @@ import locale from '../../../../../locale';
17
17
  var actions = {
18
18
  add: {
19
19
  onClick: function onClick(value, _ref) {
20
- var operation = _ref.operation,
21
- form = _ref.form,
22
- namePath = _ref.namePath;
23
- operation.add();
20
+ var operation = _ref.operation;
21
+ operation.add({});
24
22
  },
25
23
  label: "".concat(locale.ProForm.formListActions[5]),
26
24
  icon: _jsx(PlusOutlined, {})
@@ -5,6 +5,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  import { forwardRef, useCallback, useImperativeHandle } from 'react';
7
7
  import { DndContext } from '@dnd-kit/core';
8
+ import { cloneDeep, isFunction } from 'lodash';
8
9
  import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
9
10
  import { toArray } from '../../../utils';
10
11
  import { namesPathTransform } from './utils';
@@ -55,6 +56,10 @@ var FormList = function FormList(props, ref) {
55
56
  listName: [].concat(_toConsumableArray(namePath), [item.name]),
56
57
  label: mode === 'less' ? undefined : item.label
57
58
  });
59
+ // 可编辑表格的columns需要消除引用关系,防止串数据
60
+ if (column.type === 'ProEditTable' && !isFunction(column.fieldProps)) {
61
+ column.fieldProps.columns = cloneDeep(column.fieldProps.columns);
62
+ }
58
63
  return column;
59
64
  });
60
65
  }, [columns]);
@@ -6,7 +6,7 @@
6
6
  width: 100%;
7
7
 
8
8
  .@{ant-prefix}-cascader {
9
- width: 50% !important;
9
+ width: 45% !important;
10
10
 
11
11
  &.no-detail {
12
12
  width: 100% !important;
@@ -14,7 +14,7 @@
14
14
  }
15
15
 
16
16
  .pro-address-detail {
17
- width: 50%;
17
+ width: 55%;
18
18
  margin-left: 2px;
19
19
 
20
20
  .@{ant-prefix}-input-affix-wrapper {
@@ -23,7 +23,7 @@
23
23
  }
24
24
 
25
25
  .@{ant-prefix}-input-affix-wrapper {
26
- width: 50%;
26
+ width: 55%;
27
27
  margin-left: 2px;
28
28
  }
29
29
  }
@@ -416,7 +416,7 @@ var Render = function Render(props) {
416
416
  };
417
417
  }
418
418
  // 需要过滤掉的form_item的key
419
- var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl'];
419
+ var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl', 'listName'];
420
420
  if (type === 'FormList') {
421
421
  lastComponentProps.disabled = lastDisabled;
422
422
  var lessMode = lastComponentProps.mode === 'less';
@@ -64,7 +64,7 @@ var ActionButton = function ActionButton(_ref) {
64
64
  // 其他操作按钮Props
65
65
  var actionBtnProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, btnConfig.buttonProps), {}, {
66
66
  onClick: function onClick() {
67
- btnConfig.onEvent(record, index);
67
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
68
68
  },
69
69
  disabled: getDisabled((_btnConfig$buttonProp3 = btnConfig.buttonProps) === null || _btnConfig$buttonProp3 === void 0 ? void 0 : _btnConfig$buttonProp3.disabled)
70
70
  });
@@ -81,7 +81,7 @@ var ActionButton = function ActionButton(_ref) {
81
81
  placement: "topRight",
82
82
  title: deleteMsgMap[btnConfig.type],
83
83
  onConfirm: function onConfirm() {
84
- btnConfig.onEvent(record, index);
84
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
85
85
  },
86
86
  disabled: isDisabled,
87
87
  okText: _locale.default.ProEditTable.confirm,
@@ -101,13 +101,13 @@ var ActionButton = function ActionButton(_ref) {
101
101
  index: index,
102
102
  disabled: isDisabled,
103
103
  onClick: function onClick() {
104
- btnConfig.onEvent(record, index);
104
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
105
105
  }
106
106
  }))) : (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(delBtnProps, ['buttonProps', 'isEditable'])), {}, {
107
107
  disabled: isDisabled,
108
108
  type: "link",
109
109
  onClick: function onClick() {
110
- btnConfig.onEvent(record, index);
110
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
111
111
  },
112
112
  children: btnConfig.label
113
113
  }))
@@ -79,37 +79,27 @@ var RenderToolbar = function RenderToolbar(config) {
79
79
  toolbar.needConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : true;
80
80
  toolbar.onEvent = /*#__PURE__*/function () {
81
81
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(record, index) {
82
- var _yield$onEvent;
83
82
  var onEvent, result;
84
83
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
85
84
  while (1) switch (_context.prev = _context.next) {
86
85
  case 0:
87
86
  onEvent = onClick || onHandle;
88
- _context.next = 3;
87
+ if (onEvent) {
88
+ _context.next = 5;
89
+ break;
90
+ }
91
+ result = true;
92
+ _context.next = 8;
93
+ break;
94
+ case 5:
95
+ _context.next = 7;
89
96
  return onEvent === null || onEvent === void 0 ? void 0 : onEvent(selectedRows, dataSource, {
90
97
  form: form,
91
98
  namePath: virtualName
92
99
  });
93
- case 3:
94
- _context.t1 = _yield$onEvent = _context.sent;
95
- _context.t0 = _context.t1 !== null;
96
- if (!_context.t0) {
97
- _context.next = 7;
98
- break;
99
- }
100
- _context.t0 = _yield$onEvent !== void 0;
101
100
  case 7:
102
- if (!_context.t0) {
103
- _context.next = 11;
104
- break;
105
- }
106
- _context.t2 = _yield$onEvent;
107
- _context.next = 12;
108
- break;
109
- case 11:
110
- _context.t2 = true;
111
- case 12:
112
- result = _context.t2;
101
+ result = _context.sent;
102
+ case 8:
113
103
  if (result && type !== 'custom') {
114
104
  _config.actions[type]((0, _objectSpread2.default)((0, _objectSpread2.default)({}, config), {}, {
115
105
  index: index,
@@ -119,7 +109,7 @@ var RenderToolbar = function RenderToolbar(config) {
119
109
  virtualName: virtualName
120
110
  }));
121
111
  }
122
- case 14:
112
+ case 9:
123
113
  case "end":
124
114
  return _context.stop();
125
115
  }
@@ -83,7 +83,7 @@ var getActionColumn = function getActionColumn(config) {
83
83
  action.needConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : true;
84
84
  action.onEvent = /*#__PURE__*/function () {
85
85
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(record, index) {
86
- var _form$getFieldValue, _yield$onEvent;
86
+ var _form$getFieldValue;
87
87
  var rowName, _record, onEvent, result;
88
88
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
89
89
  while (1) switch (_context.prev = _context.next) {
@@ -109,31 +109,22 @@ var getActionColumn = function getActionColumn(config) {
109
109
  // 编辑状态使用自定义form值,非编辑状态直接使用行数据
110
110
  _record = (_form$getFieldValue = form.getFieldValue(rowName)) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : record; // 新增事件可以设置初始默认值,当做函数的出参导出
111
111
  onEvent = onClick || onHandle;
112
- _context.next = 16;
112
+ if (onEvent) {
113
+ _context.next = 18;
114
+ break;
115
+ }
116
+ result = true;
117
+ _context.next = 21;
118
+ break;
119
+ case 18:
120
+ _context.next = 20;
113
121
  return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, index, {
114
122
  form: form,
115
123
  namePath: virtualRowName
116
124
  });
117
- case 16:
118
- _context.t2 = _yield$onEvent = _context.sent;
119
- _context.t1 = _context.t2 !== null;
120
- if (!_context.t1) {
121
- _context.next = 20;
122
- break;
123
- }
124
- _context.t1 = _yield$onEvent !== void 0;
125
125
  case 20:
126
- if (!_context.t1) {
127
- _context.next = 24;
128
- break;
129
- }
130
- _context.t3 = _yield$onEvent;
131
- _context.next = 25;
132
- break;
133
- case 24:
134
- _context.t3 = true;
135
- case 25:
136
- result = _context.t3;
126
+ result = _context.sent;
127
+ case 21:
137
128
  if (result && type !== 'custom') {
138
129
  _config.actions[type]((0, _objectSpread2.default)((0, _objectSpread2.default)({}, config), {}, {
139
130
  rowName: [].concat((0, _toConsumableArray2.default)(name), [index]),
@@ -143,7 +134,7 @@ var getActionColumn = function getActionColumn(config) {
143
134
  validateKeys: validateKeys
144
135
  }));
145
136
  }
146
- case 27:
137
+ case 22:
147
138
  case "end":
148
139
  return _context.stop();
149
140
  }
@@ -208,7 +199,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
208
199
  setState = config.setState,
209
200
  page = config.page;
210
201
  var isCell = mode === 'cell';
211
- var _columns = (0, _toConsumableArray2.default)(columns);
202
+ var _columns = (0, _lodash.cloneDeep)(columns);
212
203
  var _cacheMap = (0, _objectSpread2.default)({}, cacheMap.current);
213
204
  var pageNum = _utils.tools.calc(page.pageNum, '-', 1);
214
205
  var firstIndex = _utils.tools.calc(pageNum, '*', page.pageSize);
@@ -21,10 +21,8 @@ var _excluded = ["label", "onClick", "onHandle", "type"],
21
21
  var actions = {
22
22
  add: {
23
23
  onClick: function onClick(value, _ref) {
24
- var operation = _ref.operation,
25
- form = _ref.form,
26
- namePath = _ref.namePath;
27
- operation.add();
24
+ var operation = _ref.operation;
25
+ operation.add({});
28
26
  },
29
27
  label: "".concat(_locale.default.ProForm.formListActions[5]),
30
28
  icon: (0, _jsxRuntime.jsx)(_icons.PlusOutlined, {})
@@ -11,6 +11,7 @@ var _jsxRuntime = require("react/jsx-runtime");
11
11
  var _react = require("react");
12
12
  var _antd = require("antd");
13
13
  var _core = require("@dnd-kit/core");
14
+ var _lodash = require("lodash");
14
15
  var _sortable = require("@dnd-kit/sortable");
15
16
  var _utils = require("../../../utils");
16
17
  var _utils2 = require("./utils");
@@ -61,6 +62,10 @@ var FormList = function FormList(props, ref) {
61
62
  listName: [].concat((0, _toConsumableArray2.default)(namePath), [item.name]),
62
63
  label: mode === 'less' ? undefined : item.label
63
64
  });
65
+ // 可编辑表格的columns需要消除引用关系,防止串数据
66
+ if (column.type === 'ProEditTable' && !(0, _lodash.isFunction)(column.fieldProps)) {
67
+ column.fieldProps.columns = (0, _lodash.cloneDeep)(column.fieldProps.columns);
68
+ }
64
69
  return column;
65
70
  });
66
71
  }, [columns]);
@@ -6,7 +6,7 @@
6
6
  width: 100%;
7
7
 
8
8
  .@{ant-prefix}-cascader {
9
- width: 50% !important;
9
+ width: 45% !important;
10
10
 
11
11
  &.no-detail {
12
12
  width: 100% !important;
@@ -14,7 +14,7 @@
14
14
  }
15
15
 
16
16
  .pro-address-detail {
17
- width: 50%;
17
+ width: 55%;
18
18
  margin-left: 2px;
19
19
 
20
20
  .@{ant-prefix}-input-affix-wrapper {
@@ -23,7 +23,7 @@
23
23
  }
24
24
 
25
25
  .@{ant-prefix}-input-affix-wrapper {
26
- width: 50%;
26
+ width: 55%;
27
27
  margin-left: 2px;
28
28
  }
29
29
  }
@@ -414,7 +414,7 @@ var Render = function Render(props) {
414
414
  };
415
415
  }
416
416
  // 需要过滤掉的form_item的key
417
- var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl'];
417
+ var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl', 'listName'];
418
418
  if (type === 'FormList') {
419
419
  lastComponentProps.disabled = lastDisabled;
420
420
  var lessMode = lastComponentProps.mode === 'less';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.6.2-beta.9",
3
+ "version": "3.6.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",