@zat-design/sisyphus-react 3.9.4-beta.2 → 3.9.4-beta.4
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/es/ProEnum/index.js +1 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +36 -32
- package/lib/ProEnum/index.js +1 -1
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +36 -32
- package/package.json +1 -1
package/es/ProEnum/index.js
CHANGED
@@ -230,7 +230,7 @@ var ProEnum = function ProEnum(props) {
|
|
230
230
|
};
|
231
231
|
if (!code && !dataSource && !useRequest) {
|
232
232
|
var _locale$ProEnum4;
|
233
|
-
_message.error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum4 = locale.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.errorNoEnumType);
|
233
|
+
_message.error("".concat(otherProps === null || otherProps === void 0 ? void 0 : otherProps.label, "-").concat(otherProps === null || otherProps === void 0 ? void 0 : otherProps.name, "-").concat(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum4 = locale.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.errorNoEnumType));
|
234
234
|
}
|
235
235
|
var transToLabel = function transToLabel(value) {
|
236
236
|
var list = dataList && dataList.length ? dataList : enumLists;
|
package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js
CHANGED
@@ -106,7 +106,7 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
106
106
|
}();
|
107
107
|
var onDragEnd = /*#__PURE__*/function () {
|
108
108
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
|
109
|
-
var active, over, transformedValue, activeObject, overObject, activeLevel, activeParentId, overLevel, overParentId, nextDataSource, _flatTree, activeIndex, overIndex, nextValue;
|
109
|
+
var active, over, transformedValue, activeObject, overObject, activeLevel, activeParentId, overLevel, overParentId, nextDataSource, _nextDataSource, _flatTree, activeIndex, overIndex, nextValue;
|
110
110
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
111
111
|
while (1) switch (_context2.prev = _context2.next) {
|
112
112
|
case 0:
|
@@ -114,7 +114,7 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
114
114
|
// 为数据源划分层级及parentId
|
115
115
|
transformedValue = addLevelAndParentId(value, rowKey); // 同一level层级的且parentId相同的,可以互相之间拖拽替换
|
116
116
|
if (!(active.id !== (over === null || over === void 0 ? void 0 : over.id))) {
|
117
|
-
_context2.next =
|
117
|
+
_context2.next = 20;
|
118
118
|
break;
|
119
119
|
}
|
120
120
|
activeObject = treeNodeFind(transformedValue, function (t) {
|
@@ -124,47 +124,51 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
124
124
|
return t.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
125
125
|
});
|
126
126
|
if (!(activeObject && overObject)) {
|
127
|
-
_context2.next =
|
127
|
+
_context2.next = 20;
|
128
128
|
break;
|
129
129
|
}
|
130
130
|
activeLevel = activeObject.level, activeParentId = activeObject.parentId;
|
131
|
-
overLevel = overObject.level, overParentId = overObject.parentId;
|
131
|
+
overLevel = overObject.level, overParentId = overObject.parentId;
|
132
|
+
nextDataSource = value;
|
133
|
+
if (!(activeLevel === overLevel && activeParentId === overParentId)) {
|
134
|
+
_context2.next = 20;
|
135
|
+
break;
|
136
|
+
}
|
137
|
+
// 将树平铺
|
138
|
+
_flatTree = transformTreeToArray(transformedValue).map(function (item) {
|
139
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
140
|
+
children: undefined
|
141
|
+
});
|
142
|
+
});
|
143
|
+
activeIndex = _flatTree.findIndex(function (i) {
|
144
|
+
return i.rowKey === active.id;
|
145
|
+
});
|
146
|
+
overIndex = _flatTree.findIndex(function (i) {
|
147
|
+
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
148
|
+
});
|
149
|
+
nextValue = arrayMove(_flatTree, activeIndex, overIndex);
|
150
|
+
nextDataSource = createTreeFromArray(nextValue, {
|
151
|
+
itemKey: 'rowKey',
|
152
|
+
parentKey: 'parentId',
|
153
|
+
childrenKey: 'children'
|
154
|
+
});
|
155
|
+
// 如果传了onDragEndGuard 则视为外部业务逻辑自处理
|
132
156
|
if (!(onDragEndGuard && isFunction(onDragEndGuard))) {
|
133
|
-
_context2.next =
|
157
|
+
_context2.next = 19;
|
134
158
|
break;
|
135
159
|
}
|
136
|
-
_context2.next =
|
160
|
+
_context2.next = 18;
|
137
161
|
return onDragEndGuard({
|
138
162
|
activeObject: activeObject,
|
139
163
|
overObject: overObject,
|
140
|
-
|
164
|
+
originDataSource: value,
|
165
|
+
currentDataSource: nextDataSource
|
141
166
|
});
|
142
|
-
case
|
167
|
+
case 18:
|
143
168
|
nextDataSource = _context2.sent;
|
144
|
-
|
145
|
-
|
146
|
-
case
|
147
|
-
if (activeLevel === overLevel && activeParentId === overParentId) {
|
148
|
-
// 将树平铺
|
149
|
-
_flatTree = transformTreeToArray(transformedValue).map(function (item) {
|
150
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
151
|
-
children: undefined
|
152
|
-
});
|
153
|
-
});
|
154
|
-
activeIndex = _flatTree.findIndex(function (i) {
|
155
|
-
return i.rowKey === active.id;
|
156
|
-
});
|
157
|
-
overIndex = _flatTree.findIndex(function (i) {
|
158
|
-
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
159
|
-
});
|
160
|
-
nextValue = arrayMove(_flatTree, activeIndex, overIndex);
|
161
|
-
onChange(createTreeFromArray(nextValue, {
|
162
|
-
itemKey: 'rowKey',
|
163
|
-
parentKey: 'parentId',
|
164
|
-
childrenKey: 'children'
|
165
|
-
}));
|
166
|
-
}
|
167
|
-
case 15:
|
169
|
+
case 19:
|
170
|
+
onChange((_nextDataSource = nextDataSource) !== null && _nextDataSource !== void 0 ? _nextDataSource : []);
|
171
|
+
case 20:
|
168
172
|
case "end":
|
169
173
|
return _context2.stop();
|
170
174
|
}
|
package/lib/ProEnum/index.js
CHANGED
@@ -231,7 +231,7 @@ var ProEnum = function ProEnum(props) {
|
|
231
231
|
};
|
232
232
|
if (!code && !dataSource && !useRequest) {
|
233
233
|
var _locale$ProEnum4;
|
234
|
-
_antd.message.error(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum4 = _locale.default.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.errorNoEnumType);
|
234
|
+
_antd.message.error("".concat(otherProps === null || otherProps === void 0 ? void 0 : otherProps.label, "-").concat(otherProps === null || otherProps === void 0 ? void 0 : otherProps.name, "-").concat(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum4 = _locale.default.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.errorNoEnumType));
|
235
235
|
}
|
236
236
|
var transToLabel = function transToLabel(value) {
|
237
237
|
var list = dataList && dataList.length ? dataList : enumLists;
|
package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js
CHANGED
@@ -113,7 +113,7 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
113
113
|
}();
|
114
114
|
var onDragEnd = /*#__PURE__*/function () {
|
115
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;
|
116
|
+
var active, over, transformedValue, activeObject, overObject, activeLevel, activeParentId, overLevel, overParentId, nextDataSource, _nextDataSource, _flatTree, activeIndex, overIndex, nextValue;
|
117
117
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
118
118
|
while (1) switch (_context2.prev = _context2.next) {
|
119
119
|
case 0:
|
@@ -121,7 +121,7 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
121
121
|
// 为数据源划分层级及parentId
|
122
122
|
transformedValue = (0, _index.addLevelAndParentId)(value, rowKey); // 同一level层级的且parentId相同的,可以互相之间拖拽替换
|
123
123
|
if (!(active.id !== (over === null || over === void 0 ? void 0 : over.id))) {
|
124
|
-
_context2.next =
|
124
|
+
_context2.next = 20;
|
125
125
|
break;
|
126
126
|
}
|
127
127
|
activeObject = (0, _index.treeNodeFind)(transformedValue, function (t) {
|
@@ -131,47 +131,51 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
131
131
|
return t.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
132
132
|
});
|
133
133
|
if (!(activeObject && overObject)) {
|
134
|
-
_context2.next =
|
134
|
+
_context2.next = 20;
|
135
135
|
break;
|
136
136
|
}
|
137
137
|
activeLevel = activeObject.level, activeParentId = activeObject.parentId;
|
138
|
-
overLevel = overObject.level, overParentId = overObject.parentId;
|
138
|
+
overLevel = overObject.level, overParentId = overObject.parentId;
|
139
|
+
nextDataSource = value;
|
140
|
+
if (!(activeLevel === overLevel && activeParentId === overParentId)) {
|
141
|
+
_context2.next = 20;
|
142
|
+
break;
|
143
|
+
}
|
144
|
+
// 将树平铺
|
145
|
+
_flatTree = (0, _index.transformTreeToArray)(transformedValue).map(function (item) {
|
146
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
147
|
+
children: undefined
|
148
|
+
});
|
149
|
+
});
|
150
|
+
activeIndex = _flatTree.findIndex(function (i) {
|
151
|
+
return i.rowKey === active.id;
|
152
|
+
});
|
153
|
+
overIndex = _flatTree.findIndex(function (i) {
|
154
|
+
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
155
|
+
});
|
156
|
+
nextValue = (0, _sortable.arrayMove)(_flatTree, activeIndex, overIndex);
|
157
|
+
nextDataSource = (0, _index.createTreeFromArray)(nextValue, {
|
158
|
+
itemKey: 'rowKey',
|
159
|
+
parentKey: 'parentId',
|
160
|
+
childrenKey: 'children'
|
161
|
+
});
|
162
|
+
// 如果传了onDragEndGuard 则视为外部业务逻辑自处理
|
139
163
|
if (!(onDragEndGuard && (0, _lodash.isFunction)(onDragEndGuard))) {
|
140
|
-
_context2.next =
|
164
|
+
_context2.next = 19;
|
141
165
|
break;
|
142
166
|
}
|
143
|
-
_context2.next =
|
167
|
+
_context2.next = 18;
|
144
168
|
return onDragEndGuard({
|
145
169
|
activeObject: activeObject,
|
146
170
|
overObject: overObject,
|
147
|
-
|
171
|
+
originDataSource: value,
|
172
|
+
currentDataSource: nextDataSource
|
148
173
|
});
|
149
|
-
case
|
174
|
+
case 18:
|
150
175
|
nextDataSource = _context2.sent;
|
151
|
-
|
152
|
-
|
153
|
-
case
|
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:
|
176
|
+
case 19:
|
177
|
+
onChange((_nextDataSource = nextDataSource) !== null && _nextDataSource !== void 0 ? _nextDataSource : []);
|
178
|
+
case 20:
|
175
179
|
case "end":
|
176
180
|
return _context2.stop();
|
177
181
|
}
|