@zat-design/sisyphus-react 3.6.9-beta.6 → 3.6.10-beta.1
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.
- package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
- package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
- package/coverage/lcov-report/src/.umi/core/index.html +206 -0
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
- package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
- package/coverage/lcov-report/src/.umi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
- package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
- package/dist/index.esm.css +41 -41
- package/dist/less.esm.css +41 -41
- package/es/ProEditTable/components/RenderField/index.js +46 -26
- package/es/ProForm/components/combination/ProCascader/index.js +14 -8
- package/es/ProForm/components/render/Render.js +39 -25
- package/es/ProForm/style/index.less +52 -52
- package/es/ProForm/utils/diffOriginal.d.ts +1 -0
- package/es/ProForm/utils/diffOriginal.js +27 -4
- package/es/ProForm/utils/index.d.ts +0 -6
- package/es/ProForm/utils/index.js +8 -57
- package/es/ProForm/utils/useChanged.js +2 -1
- package/es/ProForm/utils/useListChanged.js +3 -3
- package/es/ProTable/components/FormatColumn/index.js +16 -0
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +6 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +176 -40
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +20 -1
- package/es/ProTable/index.js +12 -2
- package/es/ProTable/propsType.d.ts +29 -0
- package/es/ProThemeTools/component/{ProTools → PrdTools}/index.d.ts +2 -2
- package/es/ProThemeTools/component/{ProTools → PrdTools}/index.js +2 -2
- package/es/ProThemeTools/component/index.d.ts +2 -1
- package/es/ProThemeTools/component/index.js +2 -1
- package/es/ProThemeTools/index.js +2 -2
- package/es/ProThemeTools/style/index.less +1 -1
- package/es/ProTreeModal/components/List.js +30 -4
- package/lib/ProEditTable/components/RenderField/index.js +41 -25
- package/lib/ProForm/components/combination/ProCascader/index.js +12 -6
- package/lib/ProForm/components/render/Render.js +37 -25
- package/lib/ProForm/style/index.less +52 -52
- package/lib/ProForm/utils/diffOriginal.d.ts +1 -0
- package/lib/ProForm/utils/diffOriginal.js +27 -3
- package/lib/ProForm/utils/index.d.ts +0 -6
- package/lib/ProForm/utils/index.js +8 -59
- package/lib/ProForm/utils/useChanged.js +2 -1
- package/lib/ProForm/utils/useListChanged.js +2 -2
- package/lib/ProTable/components/FormatColumn/index.js +16 -0
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +6 -1
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +176 -40
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +19 -1
- package/lib/ProTable/index.js +12 -2
- package/lib/ProTable/propsType.d.ts +29 -0
- package/lib/ProThemeTools/component/{ProTools → PrdTools}/index.d.ts +2 -2
- package/lib/ProThemeTools/component/{ProTools → PrdTools}/index.js +2 -2
- package/lib/ProThemeTools/component/index.d.ts +2 -1
- package/lib/ProThemeTools/component/index.js +3 -3
- package/lib/ProThemeTools/index.js +1 -1
- package/lib/ProThemeTools/style/index.less +1 -1
- package/lib/ProTreeModal/components/List.js +30 -4
- package/package.json +1 -1
- package/es/ProEditTable/components/RenderField/ListChanged.d.ts +0 -16
- package/es/ProEditTable/components/RenderField/ListChanged.js +0 -124
- package/es/ProForm/components/render/Changed.d.ts +0 -14
- package/es/ProForm/components/render/Changed.js +0 -64
- package/lib/ProEditTable/components/RenderField/ListChanged.d.ts +0 -16
- package/lib/ProEditTable/components/RenderField/ListChanged.js +0 -129
- package/lib/ProForm/components/render/Changed.d.ts +0 -14
- package/lib/ProForm/components/render/Changed.js +0 -69
- /package/es/ProThemeTools/component/{ProTools → PrdTools}/style/index.less +0 -0
- /package/lib/ProThemeTools/component/{ProTools → PrdTools}/style/index.less +0 -0
package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js
CHANGED
|
@@ -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,48 +77,177 @@ 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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
+
onDragMoveGuard = _ref2.onDragMoveGuard,
|
|
83
|
+
onDragOverGuard = _ref2.onDragOverGuard,
|
|
84
|
+
onDragEndGuard = _ref2.onDragEndGuard,
|
|
85
|
+
onDragCancelGuard = _ref2.onDragCancelGuard;
|
|
86
|
+
var onDragStart = /*#__PURE__*/function () {
|
|
87
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(event) {
|
|
88
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
89
|
+
while (1) switch (_context.prev = _context.next) {
|
|
90
|
+
case 0:
|
|
91
|
+
if (!(onDragStartGuard && (0, _lodash.isFunction)(onDragStartGuard))) {
|
|
92
|
+
_context.next = 3;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
_context.next = 3;
|
|
96
|
+
return onDragStartGuard({
|
|
97
|
+
event: event
|
|
101
98
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return
|
|
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
|
+
case 3:
|
|
100
|
+
case "end":
|
|
101
|
+
return _context.stop();
|
|
115
102
|
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
103
|
+
}, _callee);
|
|
104
|
+
}));
|
|
105
|
+
return function onDragStart(_x) {
|
|
106
|
+
return _ref3.apply(this, arguments);
|
|
107
|
+
};
|
|
108
|
+
}();
|
|
109
|
+
var onDragMove = /*#__PURE__*/function () {
|
|
110
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(event) {
|
|
111
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
112
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
113
|
+
case 0:
|
|
114
|
+
if (!(onDragMoveGuard && (0, _lodash.isFunction)(onDragMoveGuard))) {
|
|
115
|
+
_context2.next = 3;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
_context2.next = 3;
|
|
119
|
+
return onDragMoveGuard({
|
|
120
|
+
event: event
|
|
121
|
+
});
|
|
122
|
+
case 3:
|
|
123
|
+
case "end":
|
|
124
|
+
return _context2.stop();
|
|
125
|
+
}
|
|
126
|
+
}, _callee2);
|
|
127
|
+
}));
|
|
128
|
+
return function onDragMove(_x2) {
|
|
129
|
+
return _ref4.apply(this, arguments);
|
|
130
|
+
};
|
|
131
|
+
}();
|
|
132
|
+
var onDragOver = /*#__PURE__*/function () {
|
|
133
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3(event) {
|
|
134
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
|
|
135
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
136
|
+
case 0:
|
|
137
|
+
if (!(onDragOverGuard && (0, _lodash.isFunction)(onDragOverGuard))) {
|
|
138
|
+
_context3.next = 3;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
_context3.next = 3;
|
|
142
|
+
return onDragOverGuard({
|
|
143
|
+
event: event
|
|
144
|
+
});
|
|
145
|
+
case 3:
|
|
146
|
+
case "end":
|
|
147
|
+
return _context3.stop();
|
|
148
|
+
}
|
|
149
|
+
}, _callee3);
|
|
150
|
+
}));
|
|
151
|
+
return function onDragOver(_x3) {
|
|
152
|
+
return _ref5.apply(this, arguments);
|
|
153
|
+
};
|
|
154
|
+
}();
|
|
155
|
+
var onDragEnd = /*#__PURE__*/function () {
|
|
156
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4(_ref6) {
|
|
157
|
+
var active, over, transformedValue, activeObject, overObject, activeLevel, activeParentId, overLevel, overParentId, nextDataSource, _flatTree, activeIndex, overIndex, nextValue;
|
|
158
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
|
|
159
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
160
|
+
case 0:
|
|
161
|
+
active = _ref6.active, over = _ref6.over;
|
|
162
|
+
// 为数据源划分层级及parentId
|
|
163
|
+
transformedValue = (0, _index.addLevelAndParentId)(value, rowKey); // 同一level层级的且parentId相同的,可以互相之间拖拽替换
|
|
164
|
+
if (!(active.id !== (over === null || over === void 0 ? void 0 : over.id))) {
|
|
165
|
+
_context4.next = 15;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
activeObject = (0, _index.treeNodeFind)(transformedValue, function (t) {
|
|
169
|
+
return t.rowKey === active.id;
|
|
170
|
+
});
|
|
171
|
+
overObject = (0, _index.treeNodeFind)(transformedValue, function (t) {
|
|
172
|
+
return t.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
|
173
|
+
});
|
|
174
|
+
if (!(activeObject && overObject)) {
|
|
175
|
+
_context4.next = 15;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
activeLevel = activeObject.level, activeParentId = activeObject.parentId;
|
|
179
|
+
overLevel = overObject.level, overParentId = overObject.parentId; // 如果传了onDragEndGuard 则视为外部业务逻辑自处理
|
|
180
|
+
if (!(onDragEndGuard && (0, _lodash.isFunction)(onDragEndGuard))) {
|
|
181
|
+
_context4.next = 14;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
_context4.next = 11;
|
|
185
|
+
return onDragEndGuard({
|
|
186
|
+
activeObject: activeObject,
|
|
187
|
+
overObject: overObject,
|
|
188
|
+
currentDataSource: value,
|
|
189
|
+
transformTreeToArray: _index.transformTreeToArray,
|
|
190
|
+
arrayMove: _sortable.arrayMove,
|
|
191
|
+
createTreeFromArray: _index.createTreeFromArray
|
|
192
|
+
});
|
|
193
|
+
case 11:
|
|
194
|
+
nextDataSource = _context4.sent;
|
|
195
|
+
onChange(nextDataSource !== null && nextDataSource !== void 0 ? nextDataSource : []);
|
|
196
|
+
return _context4.abrupt("return");
|
|
197
|
+
case 14:
|
|
198
|
+
if (activeLevel === overLevel && activeParentId === overParentId) {
|
|
199
|
+
// 将树平铺
|
|
200
|
+
_flatTree = (0, _index.transformTreeToArray)(transformedValue).map(function (item) {
|
|
201
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
202
|
+
children: undefined
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
activeIndex = _flatTree.findIndex(function (i) {
|
|
206
|
+
return i.rowKey === active.id;
|
|
207
|
+
});
|
|
208
|
+
overIndex = _flatTree.findIndex(function (i) {
|
|
209
|
+
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
|
210
|
+
});
|
|
211
|
+
nextValue = (0, _sortable.arrayMove)(_flatTree, activeIndex, overIndex);
|
|
212
|
+
onChange((0, _index.createTreeFromArray)(nextValue, {
|
|
213
|
+
itemKey: 'rowKey',
|
|
214
|
+
parentKey: 'parentId',
|
|
215
|
+
childrenKey: 'children'
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
case 15:
|
|
219
|
+
case "end":
|
|
220
|
+
return _context4.stop();
|
|
221
|
+
}
|
|
222
|
+
}, _callee4);
|
|
223
|
+
}));
|
|
224
|
+
return function onDragEnd(_x4) {
|
|
225
|
+
return _ref7.apply(this, arguments);
|
|
226
|
+
};
|
|
227
|
+
}();
|
|
228
|
+
var onDragCancel = /*#__PURE__*/function () {
|
|
229
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee5(event) {
|
|
230
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {
|
|
231
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
232
|
+
case 0:
|
|
233
|
+
if (!(onDragCancelGuard && (0, _lodash.isFunction)(onDragCancelGuard))) {
|
|
234
|
+
_context5.next = 3;
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
_context5.next = 3;
|
|
238
|
+
return onDragCancelGuard({
|
|
239
|
+
event: event
|
|
240
|
+
});
|
|
241
|
+
case 3:
|
|
242
|
+
case "end":
|
|
243
|
+
return _context5.stop();
|
|
244
|
+
}
|
|
245
|
+
}, _callee5);
|
|
246
|
+
}));
|
|
247
|
+
return function onDragCancel(_x5) {
|
|
248
|
+
return _ref8.apply(this, arguments);
|
|
249
|
+
};
|
|
250
|
+
}();
|
|
119
251
|
// 将树平铺
|
|
120
252
|
var flatTree = (0, _index.transformTreeToArray)(value).map(function (item) {
|
|
121
253
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
@@ -124,6 +256,10 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
|
124
256
|
});
|
|
125
257
|
return draggable && !disabled ? (0, _jsxRuntime.jsx)(_core.DndContext, {
|
|
126
258
|
onDragEnd: onDragEnd,
|
|
259
|
+
onDragStart: onDragStart,
|
|
260
|
+
onDragMove: onDragMove,
|
|
261
|
+
onDragOver: onDragOver,
|
|
262
|
+
onDragCancel: onDragCancel,
|
|
127
263
|
collisionDetection: _core.closestCorners,
|
|
128
264
|
children: (0, _jsxRuntime.jsx)(_sortable.SortableContext, {
|
|
129
265
|
items: (flatTree === null || flatTree === void 0 ? void 0 : (_flatTree$ = flatTree[0]) === null || _flatTree$ === void 0 ? void 0 : _flatTree$.rowKey) ? flatTree.map(function (i) {
|
|
@@ -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,23 @@ 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
|
+
onDragMoveGuard = draggableProps.onDragMoveGuard,
|
|
42
|
+
onDragOverGuard = draggableProps.onDragOverGuard,
|
|
43
|
+
onDragEndGuard = draggableProps.onDragEndGuard,
|
|
44
|
+
onDragCancelGuard = draggableProps.onDragCancelGuard;
|
|
32
45
|
return (0, _jsxRuntime.jsx)(_DndWrapper.default, {
|
|
33
46
|
value: dataSource !== null && dataSource !== void 0 ? dataSource : [],
|
|
34
47
|
onChange: onChange,
|
|
35
48
|
disabled: disabled,
|
|
36
49
|
draggable: draggable,
|
|
37
50
|
rowKey: rowKey,
|
|
51
|
+
onDragStartGuard: onDragStartGuard,
|
|
52
|
+
onDragMoveGuard: onDragMoveGuard,
|
|
53
|
+
onDragOverGuard: onDragOverGuard,
|
|
54
|
+
onDragEndGuard: onDragEndGuard,
|
|
55
|
+
onDragCancelGuard: onDragCancelGuard,
|
|
38
56
|
children: (0, _jsxRuntime.jsx)(_antd.Table, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
39
57
|
className: "pro-edit-table-drag",
|
|
40
58
|
components: {
|
package/lib/ProTable/index.js
CHANGED
|
@@ -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", "onDragMove", "onDragOver", "onDragEnd", "onDragCancel"],
|
|
31
31
|
_excluded2 = ["resizeColumn", "columnConfig", "cacheTime", "storage"];
|
|
32
32
|
var defaultCacheTime = 1; // columns 配置保存时间为一天
|
|
33
33
|
// 全局上下文
|
|
@@ -60,6 +60,11 @@ 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
|
+
onDragMoveGuard = props.onDragMove,
|
|
65
|
+
onDragOverGuard = props.onDragOver,
|
|
66
|
+
onDragEndGuard = props.onDragEnd,
|
|
67
|
+
onDragCancelGuard = props.onDragCancel,
|
|
63
68
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
64
69
|
var quickTableConfig = quickConfig ? (0, _objectSpread4.default)({
|
|
65
70
|
columnConfig: true,
|
|
@@ -359,7 +364,12 @@ function ProTable(props) {
|
|
|
359
364
|
draggableProps: {
|
|
360
365
|
onChange: onDataSourceChange,
|
|
361
366
|
draggable: draggable,
|
|
362
|
-
rowKey: rowKey
|
|
367
|
+
rowKey: rowKey,
|
|
368
|
+
onDragStartGuard: onDragStartGuard,
|
|
369
|
+
onDragMoveGuard: onDragMoveGuard,
|
|
370
|
+
onDragOverGuard: onDragOverGuard,
|
|
371
|
+
onDragEndGuard: onDragEndGuard,
|
|
372
|
+
onDragCancelGuard: onDragCancelGuard
|
|
363
373
|
},
|
|
364
374
|
tableProps: {
|
|
365
375
|
value: _dataSource,
|
|
@@ -3,6 +3,7 @@ import { TableProps } from 'antd/es/table/Table';
|
|
|
3
3
|
import { ColumnType, GetRowKey, RowSelectionType } from 'antd/es/table/interface';
|
|
4
4
|
import { FormInstance } from 'antd';
|
|
5
5
|
import type { TooltipProps } from 'antd';
|
|
6
|
+
import type { DragStartEvent, DragMoveEvent, DragOverEvent, DragCancelEvent } from '@dnd-kit/core';
|
|
6
7
|
interface SummaryColumnProps {
|
|
7
8
|
key: string | string[];
|
|
8
9
|
index: number;
|
|
@@ -26,6 +27,10 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
|
|
|
26
27
|
format?: string;
|
|
27
28
|
precision?: number;
|
|
28
29
|
code?: string | string[] | ((text: any, record: any) => string);
|
|
30
|
+
codeValues?: {
|
|
31
|
+
label: string;
|
|
32
|
+
value: string | number;
|
|
33
|
+
}[];
|
|
29
34
|
copyable?: boolean;
|
|
30
35
|
originalDiffTip?: boolean;
|
|
31
36
|
prefix?: string | ReactNode | ((value: any, record?: any, index?: number) => any);
|
|
@@ -37,6 +42,22 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
|
|
|
37
42
|
toolTipProps?: TooltipProps & React.RefAttributes<unknown>;
|
|
38
43
|
transform?: (value: any, record?: any) => string[];
|
|
39
44
|
}
|
|
45
|
+
export interface CreateTreeFromArrayOptions {
|
|
46
|
+
itemKey?: string;
|
|
47
|
+
parentKey?: string;
|
|
48
|
+
childrenKey?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface DragCommonGuardProps<T> {
|
|
51
|
+
event: T;
|
|
52
|
+
}
|
|
53
|
+
export interface DragEndGuardProps {
|
|
54
|
+
activeObject: any;
|
|
55
|
+
overObject: any;
|
|
56
|
+
currentDataSource: any[];
|
|
57
|
+
transformTreeToArray: (tree: any[]) => any[];
|
|
58
|
+
arrayMove: (array: any[], from: number, to: number) => any[];
|
|
59
|
+
createTreeFromArray: (array: any[], options: CreateTreeFromArrayOptions) => any[];
|
|
60
|
+
}
|
|
40
61
|
export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary' | 'columns'> {
|
|
41
62
|
tableId?: string;
|
|
42
63
|
rowKey?: string | GetRowKey<any>;
|
|
@@ -63,6 +84,14 @@ export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary'
|
|
|
63
84
|
stripe?: boolean;
|
|
64
85
|
columns: ProTableColumn[];
|
|
65
86
|
originalDataSource?: any[];
|
|
87
|
+
/**
|
|
88
|
+
* 拖拽额外配置
|
|
89
|
+
*/
|
|
90
|
+
onDragStart?: DragCommonGuardProps<DragStartEvent>;
|
|
91
|
+
onDragMove?: DragCommonGuardProps<DragMoveEvent>;
|
|
92
|
+
onDragOver?: DragCommonGuardProps<DragOverEvent>;
|
|
93
|
+
onDragCancel?: DragCommonGuardProps<DragCancelEvent>;
|
|
94
|
+
onDragEnd?: DragEndGuardProps;
|
|
66
95
|
}
|
|
67
96
|
export type ProTableValueType = 'percentage' | 'permillage' | 'thousandth' | 'datePicker' | 'enumName' | 'enumCodeName' | 'address' | 'thousandthCNY' | 'date' | 'dateTime' | 'dateStartTime' | 'dateEndTime' | 'dateStartEndTime';
|
|
68
97
|
export interface Response<T = any> {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DevToolsPropsType } from '../../propsType';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const PrdTools: ({ onReset, onClose, setState, open, state, tableBorder, tableStripe, }: DevToolsPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default PrdTools;
|
|
@@ -21,7 +21,7 @@ var connect = function connect(Component) {
|
|
|
21
21
|
return ComponentWrapper;
|
|
22
22
|
};
|
|
23
23
|
var NewDrawer = connect(_antd.Drawer);
|
|
24
|
-
var
|
|
24
|
+
var PrdTools = function PrdTools(_ref) {
|
|
25
25
|
var onReset = _ref.onReset,
|
|
26
26
|
onClose = _ref.onClose,
|
|
27
27
|
setState = _ref.setState,
|
|
@@ -266,4 +266,4 @@ var ProTools = function ProTools(_ref) {
|
|
|
266
266
|
})]
|
|
267
267
|
});
|
|
268
268
|
};
|
|
269
|
-
var _default = exports.default =
|
|
269
|
+
var _default = exports.default = PrdTools;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="typings" />
|
|
2
|
+
export { default as PrdTools } from './PrdTools';
|
|
@@ -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, "
|
|
7
|
+
Object.defineProperty(exports, "PrdTools", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function get() {
|
|
10
|
-
return
|
|
10
|
+
return _PrdTools.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
var
|
|
13
|
+
var _PrdTools = _interopRequireDefault(require("./PrdTools"));
|
|
@@ -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.
|
|
189
|
+
}), (0, _jsxRuntime.jsx)(_component.PrdTools, {
|
|
190
190
|
prefixCls: prefixCls,
|
|
191
191
|
onReset: onReset,
|
|
192
192
|
onClose: toggle,
|
|
@@ -125,11 +125,32 @@ function List(props, ref) {
|
|
|
125
125
|
document.body.removeChild(temp);
|
|
126
126
|
return len * 20;
|
|
127
127
|
}
|
|
128
|
+
var handleCommonTitle = function handleCommonTitle(item) {
|
|
129
|
+
if (isCASCADER) {
|
|
130
|
+
return item === null || item === void 0 ? void 0 : item.title;
|
|
131
|
+
}
|
|
132
|
+
return item[fieldNameLabel];
|
|
133
|
+
};
|
|
134
|
+
var handleGetTitle = function handleGetTitle(item) {
|
|
135
|
+
if (showCodeName) {
|
|
136
|
+
if (isCASCADER) {
|
|
137
|
+
if (item[fieldNameValue] && (item === null || item === void 0 ? void 0 : item.title)) {
|
|
138
|
+
return "".concat(item[fieldNameValue], "-").concat(item.title);
|
|
139
|
+
}
|
|
140
|
+
return handleCommonTitle(item);
|
|
141
|
+
}
|
|
142
|
+
if (item[fieldNameValue] && item[fieldNameValue]) {
|
|
143
|
+
return "".concat(item[fieldNameValue], "-").concat(item[fieldNameLabel]);
|
|
144
|
+
}
|
|
145
|
+
return handleCommonTitle(item);
|
|
146
|
+
}
|
|
147
|
+
return handleCommonTitle(item);
|
|
148
|
+
};
|
|
128
149
|
var _useVirtualList = (0, _ahooks.useVirtualList)(originalList, {
|
|
129
150
|
containerTarget: containerRef,
|
|
130
151
|
wrapperTarget: wrapperRef,
|
|
131
152
|
itemHeight: function itemHeight(index, item) {
|
|
132
|
-
var title =
|
|
153
|
+
var title = handleGetTitle(item);
|
|
133
154
|
return Math.floor(getLineHeight(title, 406)) + 12;
|
|
134
155
|
}
|
|
135
156
|
}),
|
|
@@ -185,7 +206,7 @@ function List(props, ref) {
|
|
|
185
206
|
children: (0, _jsxRuntime.jsx)(_antd.Row, {
|
|
186
207
|
children: list.map(function (_item) {
|
|
187
208
|
var item = _item.data;
|
|
188
|
-
var title =
|
|
209
|
+
var title = handleGetTitle(item);
|
|
189
210
|
var content = optionRender ? optionRender(item, searchStr) : (0, _jsxRuntime.jsx)(_SearchTitle.default, {
|
|
190
211
|
label: title,
|
|
191
212
|
searchStr: searchStr
|
|
@@ -223,7 +244,7 @@ function List(props, ref) {
|
|
|
223
244
|
value: checkedValues,
|
|
224
245
|
children: (0, _jsxRuntime.jsx)(_antd.Row, {
|
|
225
246
|
children: treeData.map(function (item) {
|
|
226
|
-
var title =
|
|
247
|
+
var title = handleGetTitle(item);
|
|
227
248
|
var content = optionRender ? optionRender(item, searchStr) : (0, _jsxRuntime.jsx)(_SearchTitle.default, {
|
|
228
249
|
label: title,
|
|
229
250
|
searchStr: searchStr
|
|
@@ -260,7 +281,12 @@ function List(props, ref) {
|
|
|
260
281
|
ref: wrapperRef,
|
|
261
282
|
children: list.map(function (_item) {
|
|
262
283
|
var item = _item.data;
|
|
263
|
-
var title =
|
|
284
|
+
var title = item[fieldNameLabel];
|
|
285
|
+
if (showCodeName) {
|
|
286
|
+
if (item[fieldNameValue] && item[fieldNameLabel]) {
|
|
287
|
+
title = "".concat(item[fieldNameValue], "-").concat(item[fieldNameLabel]);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
264
290
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
265
291
|
className: "pro-tree-modal-checkbox-content",
|
|
266
292
|
children: [(0, _jsxRuntime.jsx)("div", {
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormInstance } from 'antd';
|
|
3
|
-
import { NamePath } from 'antd/lib/form/interface';
|
|
4
|
-
interface Props {
|
|
5
|
-
name?: NamePath;
|
|
6
|
-
names?: NamePath[];
|
|
7
|
-
originalName?: NamePath;
|
|
8
|
-
originalNames?: NamePath[];
|
|
9
|
-
namesStr?: NamePath;
|
|
10
|
-
originalValues?: any;
|
|
11
|
-
form: FormInstance;
|
|
12
|
-
equalWith?: (preValue: any, curValue: any) => boolean | undefined;
|
|
13
|
-
[name: string]: any;
|
|
14
|
-
}
|
|
15
|
-
declare const ListChanged: React.FC<Props>;
|
|
16
|
-
export default ListChanged;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import "antd/es/space/style";
|
|
2
|
-
import _Space from "antd/es/space";
|
|
3
|
-
import "antd/es/tooltip/style";
|
|
4
|
-
import _Tooltip from "antd/es/tooltip";
|
|
5
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
-
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type"];
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
import React, { useMemo } from 'react';
|
|
10
|
-
import { get } from 'lodash';
|
|
11
|
-
import { diffOriginal } from '../../../ProForm/utils/diffOriginal';
|
|
12
|
-
var toNamePath = function toNamePath(name) {
|
|
13
|
-
if (Array.isArray(name)) {
|
|
14
|
-
return name;
|
|
15
|
-
}
|
|
16
|
-
return [name];
|
|
17
|
-
};
|
|
18
|
-
var toNamePaths = function toNamePaths(names) {
|
|
19
|
-
return names.map(function (name) {
|
|
20
|
-
return toNamePath(name);
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
var getOriginalValue = function getOriginalValue(_ref) {
|
|
24
|
-
var namePath = _ref.namePath,
|
|
25
|
-
originalName = _ref.originalName,
|
|
26
|
-
originalNames = _ref.originalNames,
|
|
27
|
-
originalValues = _ref.originalValues,
|
|
28
|
-
rowKeyPath = _ref.rowKeyPath,
|
|
29
|
-
form = _ref.form;
|
|
30
|
-
if (!originalValues) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
if (rowKeyPath) {
|
|
34
|
-
var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
|
|
35
|
-
var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
|
|
36
|
-
var rowValue = form.getFieldValue(rowValueNamePath);
|
|
37
|
-
if (!rowValue) return undefined;
|
|
38
|
-
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
|
39
|
-
if (!keyValue) return undefined;
|
|
40
|
-
var originalValueList = get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
|
41
|
-
var originalValueRow = originalValueList.find(function (item) {
|
|
42
|
-
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
|
43
|
-
});
|
|
44
|
-
var originalValue;
|
|
45
|
-
if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
|
|
46
|
-
var originalNamesValue = originalNames.map(function (originalName) {
|
|
47
|
-
return get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
48
|
-
});
|
|
49
|
-
// 有可能出现数组中全是undefined的情况 视为没有值
|
|
50
|
-
var fillUndefined = originalNamesValue.every(function (valItem) {
|
|
51
|
-
return valItem === undefined;
|
|
52
|
-
});
|
|
53
|
-
originalValue = fillUndefined ? undefined : originalNamesValue;
|
|
54
|
-
} else {
|
|
55
|
-
originalValue = get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
56
|
-
}
|
|
57
|
-
return originalValue;
|
|
58
|
-
}
|
|
59
|
-
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
|
60
|
-
return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
|
61
|
-
return get(originalValues, originalName);
|
|
62
|
-
}) : get(originalValues, originalName);
|
|
63
|
-
};
|
|
64
|
-
var ListChanged = function ListChanged(props) {
|
|
65
|
-
var name = props.name,
|
|
66
|
-
names = props.names,
|
|
67
|
-
namesStr = props.namesStr,
|
|
68
|
-
_props$originalName = props.originalName,
|
|
69
|
-
originalName = _props$originalName === void 0 ? name : _props$originalName,
|
|
70
|
-
_props$originalNames = props.originalNames,
|
|
71
|
-
originalNames = _props$originalNames === void 0 ? names : _props$originalNames,
|
|
72
|
-
originalValues = props.originalValues,
|
|
73
|
-
form = props.form,
|
|
74
|
-
equalWith = props.equalWith,
|
|
75
|
-
rowKeyPath = props.rowKeyPath,
|
|
76
|
-
children = props.children,
|
|
77
|
-
type = props.type,
|
|
78
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
79
|
-
var namePath = toNamePath(namesStr || name);
|
|
80
|
-
var originalNamePath = toNamePath(originalName);
|
|
81
|
-
var originalNamePaths = originalNames && toNamePaths(originalNames);
|
|
82
|
-
var notWatch = !originalValues || ['FormList', 'ProEditTable'].includes(type);
|
|
83
|
-
var originalValue = !notWatch ? getOriginalValue({
|
|
84
|
-
namePath: namePath,
|
|
85
|
-
originalName: originalNamePath,
|
|
86
|
-
originalNames: originalNamePaths,
|
|
87
|
-
originalValues: originalValues,
|
|
88
|
-
rowKeyPath: rowKeyPath,
|
|
89
|
-
form: form
|
|
90
|
-
}) : undefined;
|
|
91
|
-
var noChange = !equalWith && (!originalValues || originalValue === undefined);
|
|
92
|
-
var changed = useMemo(function () {
|
|
93
|
-
if (notWatch || noChange) return false;
|
|
94
|
-
return diffOriginal({
|
|
95
|
-
value: props.value,
|
|
96
|
-
originalValue: originalValue,
|
|
97
|
-
form: form,
|
|
98
|
-
equalWith: equalWith
|
|
99
|
-
// name: isString(namesStr) ? namesStr : originalName || name,
|
|
100
|
-
});
|
|
101
|
-
}, [props.value, originalValue]);
|
|
102
|
-
if (notWatch || noChange) {
|
|
103
|
-
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
|
|
104
|
-
}
|
|
105
|
-
return _jsx(_Tooltip, {
|
|
106
|
-
open: changed ? undefined : false,
|
|
107
|
-
getPopupContainer: function getPopupContainer(target) {
|
|
108
|
-
return target.parentElement;
|
|
109
|
-
},
|
|
110
|
-
title: _jsxs(_Space, {
|
|
111
|
-
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, {
|
|
112
|
-
// @ts-ignore
|
|
113
|
-
isView: true,
|
|
114
|
-
value: originalValue,
|
|
115
|
-
checked: type === 'Switch' ? originalValue : undefined
|
|
116
|
-
})) : undefined]
|
|
117
|
-
}),
|
|
118
|
-
children: _jsx("div", {
|
|
119
|
-
className: changed ? 'pro-form-item-changed' : '',
|
|
120
|
-
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
|
|
121
|
-
})
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
export default ListChanged;
|