@zat-design/sisyphus-react 3.6.10 → 3.6.11

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.
Files changed (65) hide show
  1. package/dist/index.esm.css +52 -54
  2. package/dist/less.esm.css +52 -54
  3. package/es/ProEditTable/components/RenderField/ListChanged.d.ts +16 -0
  4. package/es/ProEditTable/components/RenderField/ListChanged.js +124 -0
  5. package/es/ProEditTable/components/RenderField/index.js +27 -46
  6. package/es/ProEditTable/style/index.less +2 -1
  7. package/es/ProEditTable/utils/index.d.ts +1 -1
  8. package/es/ProEditTable/utils/index.js +19 -13
  9. package/es/ProEditTable/utils/tools.d.ts +6 -0
  10. package/es/ProEditTable/utils/tools.js +15 -2
  11. package/es/ProForm/components/combination/ProCascader/index.js +8 -14
  12. package/es/ProForm/components/render/Changed.d.ts +14 -0
  13. package/es/ProForm/components/render/Changed.js +64 -0
  14. package/es/ProForm/components/render/Render.js +17 -37
  15. package/es/ProForm/style/index.less +52 -52
  16. package/es/ProForm/utils/diffOriginal.d.ts +0 -1
  17. package/es/ProForm/utils/diffOriginal.js +4 -27
  18. package/es/ProForm/utils/useChanged.js +1 -2
  19. package/es/ProForm/utils/useListChanged.js +3 -3
  20. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +3 -1
  21. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +108 -41
  22. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +14 -1
  23. package/es/ProTable/index.js +6 -2
  24. package/es/ProTable/propsType.d.ts +22 -0
  25. package/es/ProTable/style/index.less +27 -32
  26. package/es/ProThemeTools/component/{PrdTools → ProTools}/index.d.ts +2 -2
  27. package/es/ProThemeTools/component/{PrdTools → ProTools}/index.js +2 -2
  28. package/es/ProThemeTools/component/index.d.ts +1 -2
  29. package/es/ProThemeTools/component/index.js +1 -2
  30. package/es/ProThemeTools/index.js +2 -2
  31. package/es/ProThemeTools/style/index.less +1 -1
  32. package/es/ProTreeModal/components/List.js +30 -4
  33. package/lib/ProEditTable/components/RenderField/ListChanged.d.ts +16 -0
  34. package/lib/ProEditTable/components/RenderField/ListChanged.js +129 -0
  35. package/lib/ProEditTable/components/RenderField/index.js +26 -41
  36. package/lib/ProEditTable/style/index.less +2 -1
  37. package/lib/ProEditTable/utils/index.d.ts +1 -1
  38. package/lib/ProEditTable/utils/index.js +17 -11
  39. package/lib/ProEditTable/utils/tools.d.ts +6 -0
  40. package/lib/ProEditTable/utils/tools.js +15 -1
  41. package/lib/ProForm/components/combination/ProCascader/index.js +6 -12
  42. package/lib/ProForm/components/render/Changed.d.ts +14 -0
  43. package/lib/ProForm/components/render/Changed.js +69 -0
  44. package/lib/ProForm/components/render/Render.js +17 -35
  45. package/lib/ProForm/style/index.less +52 -52
  46. package/lib/ProForm/utils/diffOriginal.d.ts +0 -1
  47. package/lib/ProForm/utils/diffOriginal.js +3 -27
  48. package/lib/ProForm/utils/useChanged.js +1 -2
  49. package/lib/ProForm/utils/useListChanged.js +2 -2
  50. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +3 -1
  51. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +108 -41
  52. package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +13 -1
  53. package/lib/ProTable/index.js +6 -2
  54. package/lib/ProTable/propsType.d.ts +22 -0
  55. package/lib/ProTable/style/index.less +27 -32
  56. package/lib/ProThemeTools/component/{PrdTools → ProTools}/index.d.ts +2 -2
  57. package/lib/ProThemeTools/component/{PrdTools → ProTools}/index.js +2 -2
  58. package/lib/ProThemeTools/component/index.d.ts +1 -2
  59. package/lib/ProThemeTools/component/index.js +3 -3
  60. package/lib/ProThemeTools/index.js +1 -1
  61. package/lib/ProThemeTools/style/index.less +1 -1
  62. package/lib/ProTreeModal/components/List.js +30 -4
  63. package/package.json +1 -1
  64. /package/es/ProThemeTools/component/{PrdTools → ProTools}/style/index.less +0 -0
  65. /package/lib/ProThemeTools/component/{PrdTools → ProTools}/style/index.less +0 -0
@@ -116,58 +116,6 @@
116
116
  }
117
117
  }
118
118
 
119
- // 比较原始值场景下 不同时的样式
120
- &.pro-form-item-changed {
121
- span.@{ant-prefix}-input-affix-wrapper,
122
- .@{ant-prefix}-select .@{ant-prefix}-select-selector,
123
- .@{ant-prefix}-picker,
124
- .@{ant-prefix}-input-number {
125
- background: @zaui-contract-bg !important;
126
-
127
- input {
128
- background: transparent;
129
- }
130
- .@{ant-prefix}-select-selection-placeholder {
131
- z-index: 9;
132
- }
133
- }
134
-
135
- .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
136
- .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
137
- background: @zaui-contract-bg;
138
- border-radius: 4px;
139
- }
140
-
141
- // 地址组件
142
- .@{ant-prefix}-form-item-control-input-content {
143
- // 查看模式
144
- & > span {
145
- border-radius: 4px;
146
- padding: 5px 8px;
147
- background: @zaui-contract-bg;
148
- }
149
-
150
- & > .pro-address {
151
- .@{ant-prefix}-select-selector,
152
- .@{ant-prefix}-input-affix-wrapper,
153
- .@{ant-prefix}-input-disabled {
154
- background: @zaui-contract-bg;
155
- }
156
- }
157
- & > .@{ant-prefix}-input-group {
158
- .forever-checkbox {
159
- background: @zaui-contract-bg;
160
- }
161
- }
162
- }
163
-
164
- .pro-form-view-container {
165
- padding: 4px 8px;
166
- background: @zaui-contract-bg;
167
- border-radius: 4px;
168
- }
169
- }
170
-
171
119
  .@{ant-prefix}-row {
172
120
  width: 100%;
173
121
  }
@@ -373,4 +321,56 @@
373
321
  }
374
322
  }
375
323
  }
324
+
325
+ // 比较原始值场景下 不同时的样式
326
+ .pro-form-item-changed {
327
+ span.@{ant-prefix}-input-affix-wrapper,
328
+ .@{ant-prefix}-select .@{ant-prefix}-select-selector,
329
+ .@{ant-prefix}-picker,
330
+ .@{ant-prefix}-input-number {
331
+ background: @zaui-contract-bg !important;
332
+
333
+ input {
334
+ background: transparent !important;
335
+ }
336
+ .@{ant-prefix}-select-selection-placeholder {
337
+ z-index: 9;
338
+ }
339
+ }
340
+
341
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
342
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
343
+ background: @zaui-contract-bg;
344
+ border-radius: 4px;
345
+ }
346
+
347
+ // 地址组件
348
+ .@{ant-prefix}-form-item-control-input-content {
349
+ // 查看模式
350
+ & > span {
351
+ border-radius: 4px;
352
+ padding: 5px 8px;
353
+ background: @zaui-contract-bg;
354
+ }
355
+
356
+ & > .pro-address {
357
+ .@{ant-prefix}-select-selector,
358
+ .@{ant-prefix}-input-affix-wrapper,
359
+ .@{ant-prefix}-input-disabled {
360
+ background: @zaui-contract-bg;
361
+ }
362
+ }
363
+ & > .@{ant-prefix}-input-group {
364
+ .forever-checkbox {
365
+ background: @zaui-contract-bg;
366
+ }
367
+ }
368
+ }
369
+
370
+ .pro-form-view-container {
371
+ padding: 4px 8px;
372
+ background: @zaui-contract-bg;
373
+ border-radius: 4px;
374
+ }
375
+ }
376
376
  }
@@ -3,7 +3,6 @@ interface Params {
3
3
  originalValue: any;
4
4
  value: any;
5
5
  form: FormInstance;
6
- name?: string | any[];
7
6
  equalWith?: (originalValue: any, currentValue: any) => boolean;
8
7
  }
9
8
  export declare const diffOriginal: (params: Params) => boolean;
@@ -1,38 +1,15 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.diffOriginal = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
7
  var _lodash = require("lodash");
10
8
  var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
11
- /** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
12
- var extractValues = function extractValues(form, pathString) {
13
- var _pathString;
14
- var result = [];
15
- var PrefixesName = (0, _lodash.isString)(pathString) ? [] : pathString.slice(0, -1);
16
- if ((0, _lodash.isString)(pathString)) {
17
- pathString.split('-').forEach(function (item) {
18
- result.push(form.getFieldValue([].concat((0, _toConsumableArray2.default)(PrefixesName), [item])));
19
- });
20
- return result;
21
- }
22
- (_pathString = pathString[pathString.length - 1]) === null || _pathString === void 0 ? void 0 : _pathString.split('-').forEach(function (item) {
23
- result.push(form.getFieldValue([].concat((0, _toConsumableArray2.default)(PrefixesName), [item])));
24
- });
25
- return result;
26
- };
27
9
  var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
28
- var _name$join;
29
10
  var originalValue = params.originalValue,
30
- _value = params.value,
31
- equalWith = params.equalWith,
32
- form = params.form,
33
- name = params.name;
34
- var isNames = Array.isArray(name) && ((_name$join = name.join(',')) === null || _name$join === void 0 ? void 0 : _name$join.includes('-')) || (name === null || name === void 0 ? void 0 : name.includes('-'));
35
- var value = !isNames ? _value : extractValues(form, name);
11
+ value = params.value,
12
+ equalWith = params.equalWith;
36
13
  // 支持传入自定义比较事件
37
14
  if ((0, _lodash.isFunction)(equalWith)) {
38
15
  return !equalWith(originalValue, value);
@@ -47,8 +24,7 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
47
24
  });
48
25
  }
49
26
  if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
50
- var res = !(0, _lodash.isEqual)(value, originalValue);
51
- return res;
27
+ return !(0, _lodash.isEqual)(value, originalValue);
52
28
  }
53
29
  return false;
54
30
  };
@@ -24,8 +24,7 @@ var useChanged = exports.useChanged = function useChanged(_ref) {
24
24
  originalValue: originalValue,
25
25
  value: value,
26
26
  form: form,
27
- equalWith: equalWith,
28
- name: namesStr || name
27
+ equalWith: equalWith
29
28
  });
30
29
  return [changed, originalValue];
31
30
  };
@@ -91,8 +91,8 @@ var useListChanged = exports.useListChanged = function useListChanged(params) {
91
91
  value: value,
92
92
  originalValue: originalValue,
93
93
  form: form,
94
- equalWith: equalWith,
95
- name: (0, _lodash.isString)(namesStr) ? namesStr : originalName || name
94
+ equalWith: equalWith
95
+ // name: isString(namesStr) ? namesStr : originalName || name,
96
96
  });
97
97
  return [changed, originalValue];
98
98
  };
@@ -5,12 +5,14 @@ interface RowProps extends React.HTMLAttributes<HTMLTableRowElement> {
5
5
  disabled?: boolean;
6
6
  }
7
7
  export declare const Row: FC<RowProps>;
8
- declare const DndWrapper: ({ draggable, value, onChange, disabled, children, rowKey }: {
8
+ declare const DndWrapper: ({ draggable, value, onChange, disabled, children, rowKey, onDragStartGuard, onDragEndGuard, }: {
9
9
  draggable: any;
10
10
  value: any;
11
11
  onChange: any;
12
12
  disabled: any;
13
13
  children: any;
14
14
  rowKey: any;
15
+ onDragStartGuard: any;
16
+ onDragEndGuard: any;
15
17
  }) => any;
16
18
  export default DndWrapper;
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = exports.Row = void 0;
8
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
12
  var _jsxRuntime = require("react/jsx-runtime");
@@ -12,6 +14,7 @@ var _react = _interopRequireDefault(require("react"));
12
14
  var _core = require("@dnd-kit/core");
13
15
  var _sortable = require("@dnd-kit/sortable");
14
16
  var _utilities = require("@dnd-kit/utilities");
17
+ var _lodash = require("lodash");
15
18
  var _index = require("./utils/index");
16
19
  var _ProIcon = _interopRequireDefault(require("../../../../../../../ProIcon"));
17
20
  var _excluded = ["disabled", "children"];
@@ -74,55 +77,119 @@ var DndWrapper = function DndWrapper(_ref2) {
74
77
  onChange = _ref2.onChange,
75
78
  disabled = _ref2.disabled,
76
79
  children = _ref2.children,
77
- rowKey = _ref2.rowKey;
78
- var onDragEnd = function onDragEnd(_ref3) {
79
- var active = _ref3.active,
80
- over = _ref3.over;
81
- // 为数据源划分层级及parentId
82
- var transformedValue = (0, _index.addLevelAndParentId)(value, rowKey);
83
- // 同一level层级的且parentId相同的,可以互相之间拖拽替换
84
- if (active.id !== (over === null || over === void 0 ? void 0 : over.id)) {
85
- var activeObject = (0, _index.treeNodeFind)(transformedValue, function (t) {
86
- return t.rowKey === active.id;
87
- });
88
- var overObject = (0, _index.treeNodeFind)(transformedValue, function (t) {
89
- return t.rowKey === (over === null || over === void 0 ? void 0 : over.id);
90
- });
91
- if (activeObject && overObject) {
92
- var activeLevel = activeObject.level,
93
- activeParentId = activeObject.parentId;
94
- var overLevel = overObject.level,
95
- overParentId = overObject.parentId;
96
- if (activeLevel === overLevel && activeParentId === overParentId) {
97
- // 将树平铺
98
- var _flatTree = (0, _index.transformTreeToArray)(transformedValue).map(function (item) {
99
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
100
- children: undefined
80
+ rowKey = _ref2.rowKey,
81
+ onDragStartGuard = _ref2.onDragStartGuard,
82
+ onDragEndGuard = _ref2.onDragEndGuard;
83
+ var onDragStart = /*#__PURE__*/function () {
84
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(_ref3) {
85
+ var active, _transformedValue, activeObject;
86
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
87
+ while (1) switch (_context.prev = _context.next) {
88
+ case 0:
89
+ active = _ref3.active;
90
+ if (!(onDragStartGuard && (0, _lodash.isFunction)(onDragStartGuard))) {
91
+ _context.next = 6;
92
+ break;
93
+ }
94
+ // 为数据源划分层级及parentId
95
+ _transformedValue = (0, _index.addLevelAndParentId)(value, rowKey);
96
+ activeObject = (0, _index.treeNodeFind)(_transformedValue, function (t) {
97
+ return t.rowKey === active.id;
101
98
  });
102
- });
103
- var activeIndex = _flatTree.findIndex(function (i) {
104
- return i.rowKey === active.id;
105
- });
106
- var overIndex = _flatTree.findIndex(function (i) {
107
- return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
108
- });
109
- var nextValue = (0, _sortable.arrayMove)(_flatTree, activeIndex, overIndex);
110
- onChange((0, _index.createTreeFromArray)(nextValue, {
111
- itemKey: 'rowKey',
112
- parentKey: 'parentId',
113
- childrenKey: 'children'
114
- }));
99
+ _context.next = 6;
100
+ return onDragStartGuard({
101
+ activeObject: activeObject,
102
+ currentDataSource: value
103
+ });
104
+ case 6:
105
+ case "end":
106
+ return _context.stop();
115
107
  }
116
- }
117
- }
118
- };
108
+ }, _callee);
109
+ }));
110
+ return function onDragStart(_x) {
111
+ return _ref4.apply(this, arguments);
112
+ };
113
+ }();
114
+ var onDragEnd = /*#__PURE__*/function () {
115
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(_ref5) {
116
+ var active, over, transformedValue, activeObject, overObject, activeLevel, activeParentId, overLevel, overParentId, nextDataSource, _flatTree, activeIndex, overIndex, nextValue;
117
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
118
+ while (1) switch (_context2.prev = _context2.next) {
119
+ case 0:
120
+ active = _ref5.active, over = _ref5.over;
121
+ // 为数据源划分层级及parentId
122
+ transformedValue = (0, _index.addLevelAndParentId)(value, rowKey); // 同一level层级的且parentId相同的,可以互相之间拖拽替换
123
+ if (!(active.id !== (over === null || over === void 0 ? void 0 : over.id))) {
124
+ _context2.next = 15;
125
+ break;
126
+ }
127
+ activeObject = (0, _index.treeNodeFind)(transformedValue, function (t) {
128
+ return t.rowKey === active.id;
129
+ });
130
+ overObject = (0, _index.treeNodeFind)(transformedValue, function (t) {
131
+ return t.rowKey === (over === null || over === void 0 ? void 0 : over.id);
132
+ });
133
+ if (!(activeObject && overObject)) {
134
+ _context2.next = 15;
135
+ break;
136
+ }
137
+ activeLevel = activeObject.level, activeParentId = activeObject.parentId;
138
+ overLevel = overObject.level, overParentId = overObject.parentId; // 如果传了onDragEndGuard 则视为外部业务逻辑自处理
139
+ if (!(onDragEndGuard && (0, _lodash.isFunction)(onDragEndGuard))) {
140
+ _context2.next = 14;
141
+ break;
142
+ }
143
+ _context2.next = 11;
144
+ return onDragEndGuard({
145
+ activeObject: activeObject,
146
+ overObject: overObject,
147
+ currentDataSource: value
148
+ });
149
+ case 11:
150
+ nextDataSource = _context2.sent;
151
+ onChange(nextDataSource !== null && nextDataSource !== void 0 ? nextDataSource : []);
152
+ return _context2.abrupt("return");
153
+ case 14:
154
+ if (activeLevel === overLevel && activeParentId === overParentId) {
155
+ // 将树平铺
156
+ _flatTree = (0, _index.transformTreeToArray)(transformedValue).map(function (item) {
157
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
158
+ children: undefined
159
+ });
160
+ });
161
+ activeIndex = _flatTree.findIndex(function (i) {
162
+ return i.rowKey === active.id;
163
+ });
164
+ overIndex = _flatTree.findIndex(function (i) {
165
+ return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
166
+ });
167
+ nextValue = (0, _sortable.arrayMove)(_flatTree, activeIndex, overIndex);
168
+ onChange((0, _index.createTreeFromArray)(nextValue, {
169
+ itemKey: 'rowKey',
170
+ parentKey: 'parentId',
171
+ childrenKey: 'children'
172
+ }));
173
+ }
174
+ case 15:
175
+ case "end":
176
+ return _context2.stop();
177
+ }
178
+ }, _callee2);
179
+ }));
180
+ return function onDragEnd(_x2) {
181
+ return _ref6.apply(this, arguments);
182
+ };
183
+ }();
184
+ var transformedValue = (0, _index.addLevelAndParentId)(value, rowKey);
119
185
  // 将树平铺
120
- var flatTree = (0, _index.transformTreeToArray)(value).map(function (item) {
186
+ var flatTree = (0, _index.transformTreeToArray)(transformedValue).map(function (item) {
121
187
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
122
188
  children: undefined
123
189
  });
124
190
  });
125
191
  return draggable && !disabled ? (0, _jsxRuntime.jsx)(_core.DndContext, {
192
+ onDragStart: onDragStart,
126
193
  onDragEnd: onDragEnd,
127
194
  collisionDetection: _core.closestCorners,
128
195
  children: (0, _jsxRuntime.jsx)(_sortable.SortableContext, {
@@ -15,6 +15,14 @@ var _DndWrapper = _interopRequireWildcard(require("./components/DndWrapper"));
15
15
  var _index = require("../../../index");
16
16
  require("../../../../style/index.less");
17
17
  var _excluded = ["dataSource", "tableProps", "draggableProps", "summaryProps", "emptyTextProps"];
18
+ /*
19
+ * @Author: za-xuwenli xuwenli@zhongan.io
20
+ * @Date: 2024-08-09 13:48:59
21
+ * @LastEditors: za-xuwenli xuwenli@zhongan.io
22
+ * @LastEditTime: 2024-08-20 19:31:24
23
+ * @FilePath: /za-material-warehouse/src/ProTable/components/RcTable/components/DraggableTable/index.tsx
24
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
25
+ */
18
26
  var DraggableTable = function DraggableTable(_ref) {
19
27
  var dataSource = _ref.dataSource,
20
28
  tableProps = _ref.tableProps,
@@ -28,13 +36,17 @@ var DraggableTable = function DraggableTable(_ref) {
28
36
  disabled = tableProps.disabled;
29
37
  var onChange = draggableProps.onChange,
30
38
  draggable = draggableProps.draggable,
31
- rowKey = draggableProps.rowKey;
39
+ rowKey = draggableProps.rowKey,
40
+ onDragStartGuard = draggableProps.onDragStartGuard,
41
+ onDragEndGuard = draggableProps.onDragEndGuard;
32
42
  return (0, _jsxRuntime.jsx)(_DndWrapper.default, {
33
43
  value: dataSource !== null && dataSource !== void 0 ? dataSource : [],
34
44
  onChange: onChange,
35
45
  disabled: disabled,
36
46
  draggable: draggable,
37
47
  rowKey: rowKey,
48
+ onDragStartGuard: onDragStartGuard,
49
+ onDragEndGuard: onDragEndGuard,
38
50
  children: (0, _jsxRuntime.jsx)(_antd.Table, (0, _objectSpread2.default)((0, _objectSpread2.default)({
39
51
  className: "pro-edit-table-drag",
40
52
  components: {
@@ -27,7 +27,7 @@ var _reset = _interopRequireDefault(require("../assets/reset.svg"));
27
27
  var _customColumn = _interopRequireDefault(require("../assets/customColumn.svg"));
28
28
  var _utils = require("./utils");
29
29
  var _locale = _interopRequireDefault(require("../locale"));
30
- var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "draggable", "disabled", "isView", "rowDisabled", "summary", "emptyText", "originalDataSource"],
30
+ var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "draggable", "disabled", "isView", "rowDisabled", "summary", "emptyText", "originalDataSource", "onDragStart", "onDragEnd"],
31
31
  _excluded2 = ["resizeColumn", "columnConfig", "cacheTime", "storage"];
32
32
  var defaultCacheTime = 1; // columns 配置保存时间为一天
33
33
  // 全局上下文
@@ -60,6 +60,8 @@ function ProTable(props) {
60
60
  _props$emptyText = props.emptyText,
61
61
  emptyText = _props$emptyText === void 0 ? _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable = _locale.default.ProTable) === null || _locale$ProTable === void 0 ? void 0 : _locale$ProTable.noData : _props$emptyText,
62
62
  originalDataSource = props.originalDataSource,
63
+ onDragStartGuard = props.onDragStart,
64
+ onDragEndGuard = props.onDragEnd,
63
65
  restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
64
66
  var quickTableConfig = quickConfig ? (0, _objectSpread4.default)({
65
67
  columnConfig: true,
@@ -359,7 +361,9 @@ function ProTable(props) {
359
361
  draggableProps: {
360
362
  onChange: onDataSourceChange,
361
363
  draggable: draggable,
362
- rowKey: rowKey
364
+ rowKey: rowKey,
365
+ onDragStartGuard: onDragStartGuard,
366
+ onDragEndGuard: onDragEndGuard
363
367
  },
364
368
  tableProps: {
365
369
  value: _dataSource,
@@ -41,6 +41,23 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
41
41
  toolTipProps?: TooltipProps & React.RefAttributes<unknown>;
42
42
  transform?: (value: any, record?: any) => string[];
43
43
  }
44
+ export interface CreateTreeFromArrayOptions {
45
+ itemKey?: string;
46
+ parentKey?: string;
47
+ childrenKey?: string;
48
+ }
49
+ export interface DragCommonGuardProps<T> {
50
+ event: T;
51
+ }
52
+ export interface DragEndGuardProps {
53
+ activeObject: any;
54
+ overObject?: any;
55
+ currentDataSource: any[];
56
+ }
57
+ export interface DragStartGuardProps {
58
+ activeObject: any;
59
+ currentDataSource: any[];
60
+ }
44
61
  export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary' | 'columns'> {
45
62
  tableId?: string;
46
63
  rowKey?: string | GetRowKey<any>;
@@ -67,6 +84,11 @@ export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary'
67
84
  stripe?: boolean;
68
85
  columns: ProTableColumn[];
69
86
  originalDataSource?: any[];
87
+ /**
88
+ * 拖拽额外配置
89
+ */
90
+ onDragStart?: DragStartGuardProps;
91
+ onDragEnd?: DragEndGuardProps;
70
92
  }
71
93
  export type ProTableValueType = 'percentage' | 'permillage' | 'thousandth' | 'datePicker' | 'enumName' | 'enumCodeName' | 'address' | 'thousandthCNY' | 'date' | 'dateTime' | 'dateStartTime' | 'dateEndTime' | 'dateStartEndTime';
72
94
  export interface Response<T = any> {
@@ -2,17 +2,17 @@
2
2
  @import (reference) '~antd/es/style/themes/index.less';
3
3
 
4
4
  .pro-table {
5
- &.pro-table-draggable-only{
6
- .ant-table-tbody{
5
+ &.pro-table-draggable-only {
6
+ .ant-table-tbody {
7
7
  .anticon {
8
8
  margin-right: 0;
9
9
  }
10
10
  }
11
11
  }
12
12
  .@{ant-prefix}-table-cell-with-append {
13
- white-space: nowrap;
14
13
  position: relative;
15
14
  z-index: 100;
15
+ white-space: nowrap;
16
16
  }
17
17
  .@{ant-prefix}-table-row-expand-icon {
18
18
  position: absolute;
@@ -20,16 +20,15 @@
20
20
  }
21
21
 
22
22
  .@{ant-prefix}-table-content {
23
- >table {
23
+ > table {
24
24
  .@{ant-prefix}-table-summary {
25
+ color: var(--zaui-text, #343434);
26
+ font-weight: 600;
25
27
  background-color: var(--zaui-table-header-bg, #f2f3f5);
26
- color : var(--zaui-text, #343434);
27
- font-weight : 600;
28
28
 
29
29
  .@{ant-prefix}-table-cell-fix-left,
30
30
  .@{ant-prefix}-table-cell-fix-right {
31
31
  background-color: var(--zaui-table-header-bg, #f2f3f5);
32
-
33
32
  }
34
33
  }
35
34
 
@@ -43,33 +42,37 @@
43
42
  }
44
43
  }
45
44
 
46
- .@{ant-prefix}-table-thead>tr>th:not(.@{ant-prefix}-table-selection-column):not(.@{ant-prefix}-table-row-expand-icon-cell):not([colspan]).is-required {
45
+ .@{ant-prefix}-table-thead
46
+ > tr
47
+ > th:not(.@{ant-prefix}-table-selection-column):not(
48
+ .@{ant-prefix}-table-row-expand-icon-cell
49
+ ):not([colspan]).is-required {
47
50
  &.is-required-right {
48
51
  .pro-edit-table-title {
49
52
  &::before {
50
- position : static;
51
- top : 0;
52
- display : inline-block;
53
- text-indent: -8px;
54
- color : #ff5050;
55
- font-size : var(--zaui-font-size-md, 14px);
53
+ position: static;
54
+ top: 0;
55
+ display: inline-block;
56
+ color: #ff5050;
57
+ font-size: var(--zaui-font-size-md, 14px);
56
58
  line-height: 1;
57
- content : "*";
59
+ text-indent: -8px;
60
+ content: '*';
58
61
  }
59
62
  }
60
63
  }
61
64
  &.is-required-left {
62
65
  .pro-edit-table-title {
63
66
  &::after {
67
+ position: static;
68
+ top: 0;
69
+ display: inline-block;
64
70
  width: auto;
65
- position : static;
66
- top : 0;
67
- display : inline-block;
68
71
  margin-left: var(--zaui-space-size-xs, 4px);
69
- color : #ff5050;
70
- font-size : 14px;
72
+ color: #ff5050;
73
+ font-size: 14px;
71
74
  line-height: 1;
72
- content : "*";
75
+ content: '*';
73
76
  }
74
77
  }
75
78
  }
@@ -80,9 +83,9 @@
80
83
  display: flex;
81
84
  width: 20px;
82
85
  .anticon {
83
- cursor: pointer;
84
86
  margin-right: 12px;
85
- .drag-icon{
87
+ cursor: pointer;
88
+ .drag-icon {
86
89
  margin-right: 0;
87
90
  }
88
91
  }
@@ -93,8 +96,6 @@
93
96
  }
94
97
  }
95
98
 
96
-
97
-
98
99
  &.pro-table-bordered {
99
100
  .@{ant-prefix}-table .@{ant-prefix}-table-thead > tr > th {
100
101
  border-bottom: 1px solid #f0f0f0;
@@ -557,10 +558,4 @@
557
558
  }
558
559
  }
559
560
  }
560
- }
561
-
562
- .pro-edit-table-drag {
563
- table tr th.@{ant-prefix}-table-selection-column.@{ant-prefix}-table-cell-fix-left{
564
- text-align: right;
565
- }
566
- }
561
+ }
@@ -1,3 +1,3 @@
1
1
  import type { DevToolsPropsType } from '../../propsType';
2
- declare const PrdTools: ({ onReset, onClose, setState, open, state, tableBorder, tableStripe, }: DevToolsPropsType) => import("react/jsx-runtime").JSX.Element;
3
- export default PrdTools;
2
+ declare const ProTools: ({ onReset, onClose, setState, open, state, tableBorder, tableStripe, }: DevToolsPropsType) => import("react/jsx-runtime").JSX.Element;
3
+ export default ProTools;
@@ -21,7 +21,7 @@ var connect = function connect(Component) {
21
21
  return ComponentWrapper;
22
22
  };
23
23
  var NewDrawer = connect(_antd.Drawer);
24
- var PrdTools = function PrdTools(_ref) {
24
+ var ProTools = function ProTools(_ref) {
25
25
  var onReset = _ref.onReset,
26
26
  onClose = _ref.onClose,
27
27
  setState = _ref.setState,
@@ -266,4 +266,4 @@ var PrdTools = function PrdTools(_ref) {
266
266
  })]
267
267
  });
268
268
  };
269
- var _default = exports.default = PrdTools;
269
+ var _default = exports.default = ProTools;
@@ -1,2 +1 @@
1
- /// <reference types="typings" />
2
- export { default as PrdTools } from './PrdTools';
1
+ export { default as ProTools } from './ProTools';
@@ -4,10 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- Object.defineProperty(exports, "PrdTools", {
7
+ Object.defineProperty(exports, "ProTools", {
8
8
  enumerable: true,
9
9
  get: function get() {
10
- return _PrdTools.default;
10
+ return _ProTools.default;
11
11
  }
12
12
  });
13
- var _PrdTools = _interopRequireDefault(require("./PrdTools"));
13
+ var _ProTools = _interopRequireDefault(require("./ProTools"));
@@ -186,7 +186,7 @@ var ProThemeTools = function ProThemeTools(_ref) {
186
186
  className: "setting-icon",
187
187
  src: _setting.default
188
188
  })
189
- }), (0, _jsxRuntime.jsx)(_component.PrdTools, {
189
+ }), (0, _jsxRuntime.jsx)(_component.ProTools, {
190
190
  prefixCls: prefixCls,
191
191
  onReset: onReset,
192
192
  onClose: toggle,