@zat-design/sisyphus-react 3.9.4 → 3.9.5-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/.vscode/extensions.json +5 -0
- package/dist/index.esm.css +42 -1
- package/dist/less.esm.css +38 -0
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +13 -10
- package/es/ProEditTable/components/RenderField/index.js +42 -32
- package/es/ProEditTable/propsType.d.ts +1 -0
- package/es/ProEditTable/style/index.less +41 -0
- package/es/ProEditTable/utils/diffOriginal.d.ts +21 -0
- package/es/ProEditTable/utils/diffOriginal.js +65 -0
- package/es/ProEnum/index.js +1 -1
- package/es/ProForm/components/combination/Group/component/ComRender.js +9 -1
- package/es/ProForm/components/combination/Group/index.js +1 -1
- package/es/ProForm/components/combination/Group/utils.js +1 -1
- package/es/ProForm/style/index.less +8 -0
- package/es/ProForm/utils/diffOriginal.js +11 -8
- package/es/ProTable/components/FormatColumn/index.js +1 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +36 -32
- package/es/ProTable/index.js +22 -15
- package/es/ProTable/propsType.d.ts +3 -2
- package/es/style/theme/antd.less +4 -1
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +1 -1
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +13 -10
- package/lib/ProEditTable/components/RenderField/index.js +42 -32
- package/lib/ProEditTable/propsType.d.ts +1 -0
- package/lib/ProEditTable/style/index.less +41 -0
- package/lib/ProEditTable/utils/diffOriginal.d.ts +21 -0
- package/lib/ProEditTable/utils/diffOriginal.js +71 -0
- package/lib/ProEnum/index.js +1 -1
- package/lib/ProForm/components/combination/Group/component/ComRender.js +8 -0
- package/lib/ProForm/components/combination/Group/index.js +1 -1
- package/lib/ProForm/components/combination/Group/utils.js +1 -1
- package/lib/ProForm/style/index.less +8 -0
- package/lib/ProForm/utils/diffOriginal.js +11 -8
- package/lib/ProTable/components/FormatColumn/index.js +1 -1
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +36 -32
- package/lib/ProTable/index.js +22 -15
- package/lib/ProTable/propsType.d.ts +3 -2
- package/lib/style/theme/antd.less +4 -1
- package/package.json +1 -1
@@ -341,6 +341,10 @@
|
|
341
341
|
background: @zaui-contract-bg !important;
|
342
342
|
}
|
343
343
|
|
344
|
+
.ant-picker-clear {
|
345
|
+
background: @zaui-contract-bg;
|
346
|
+
}
|
347
|
+
|
344
348
|
span.@{ant-prefix}-input-affix-wrapper,
|
345
349
|
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
346
350
|
.@{ant-prefix}-picker,
|
@@ -419,6 +423,10 @@
|
|
419
423
|
background: @zaui-contract-bg-add !important;
|
420
424
|
}
|
421
425
|
|
426
|
+
.ant-picker-clear {
|
427
|
+
background: @zaui-contract-bg-add;
|
428
|
+
}
|
429
|
+
|
422
430
|
span.@{ant-prefix}-input-affix-wrapper,
|
423
431
|
.@{ant-prefix}-select .@{ant-prefix}-select-selector,
|
424
432
|
.@{ant-prefix}-picker,
|
@@ -42,14 +42,17 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
42
42
|
return 'add';
|
43
43
|
}
|
44
44
|
if (Array.isArray(_originalValue)) {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
if ((_originalValue === null || _originalValue === void 0 ? void 0 : _originalValue.length) === (_value === null || _value === void 0 ? void 0 : _value.length)) {
|
46
|
+
var isSame = _originalValue.every(function (valueItem, index) {
|
47
|
+
// 如果两个值有一个不是空值, 则进行深比较
|
48
|
+
if (!(0, _utils.isEmpty)(value === null || value === void 0 ? void 0 : value[index]) || !(0, _utils.isEmpty)(valueItem)) {
|
49
|
+
return (0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
50
|
+
}
|
51
|
+
return true;
|
52
|
+
});
|
53
|
+
return isSame ? 'same' : 'changed';
|
54
|
+
}
|
55
|
+
return 'changed';
|
53
56
|
}
|
54
57
|
if (!(0, _utils.isEmpty)(_originalValue) || !(0, _utils.isEmpty)(_value)) {
|
55
58
|
return (0, _lodash.isEqual)(_value, _originalValue) ? 'same' : 'changed';
|
@@ -145,7 +145,7 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
|
|
145
145
|
index: index
|
146
146
|
});
|
147
147
|
// viewRender 返回值为 false 时,不显示对比
|
148
|
-
if ((0, _lodash.isBoolean)(diffResult)) {
|
148
|
+
if ((0, _lodash.isBoolean)(diffResult) && !diffResult) {
|
149
149
|
otherProps.isChanged = false;
|
150
150
|
}
|
151
151
|
originalValue = diffResult;
|
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
|
}
|
package/lib/ProTable/index.js
CHANGED
@@ -194,6 +194,26 @@ var ProTable = function ProTable(props) {
|
|
194
194
|
return 'new-cell';
|
195
195
|
}
|
196
196
|
};
|
197
|
+
var _formatColumns = function formatColumns(nextColumns) {
|
198
|
+
nextColumns === null || nextColumns === void 0 ? void 0 : nextColumns.forEach(function (item, index) {
|
199
|
+
(0, _FormatColumn.formatColumn)({
|
200
|
+
column: item,
|
201
|
+
originalObj: originalObj,
|
202
|
+
rowKey: props.rowKey,
|
203
|
+
diffConfig: diffConfig,
|
204
|
+
wrapToolTipProps: wrapToolTipProps,
|
205
|
+
scroll: _scroll,
|
206
|
+
onUpdateMinWidth: function onUpdateMinWidth(w) {
|
207
|
+
curColumns[index].minWidth = w;
|
208
|
+
},
|
209
|
+
isInNewRow: _rowClassName
|
210
|
+
});
|
211
|
+
if (item.children && Array.isArray(item.children)) {
|
212
|
+
_formatColumns(item.children);
|
213
|
+
}
|
214
|
+
});
|
215
|
+
return nextColumns;
|
216
|
+
};
|
197
217
|
var columns = (0, _react.useMemo)(function () {
|
198
218
|
var newColumns = curColumns.map(function (item, index) {
|
199
219
|
var _propsColumnObj$getCo2;
|
@@ -215,21 +235,8 @@ var ProTable = function ProTable(props) {
|
|
215
235
|
}).filter(function (item) {
|
216
236
|
return !(item === null || item === void 0 ? void 0 : item.delete);
|
217
237
|
});
|
218
|
-
|
219
|
-
|
220
|
-
column: item,
|
221
|
-
originalObj: originalObj,
|
222
|
-
rowKey: props.rowKey,
|
223
|
-
diffConfig: diffConfig,
|
224
|
-
wrapToolTipProps: wrapToolTipProps,
|
225
|
-
scroll: _scroll,
|
226
|
-
onUpdateMinWidth: function onUpdateMinWidth(w) {
|
227
|
-
curColumns[index].minWidth = w;
|
228
|
-
},
|
229
|
-
isInNewRow: _rowClassName
|
230
|
-
});
|
231
|
-
});
|
232
|
-
return newColumns;
|
238
|
+
var nextColumns = _formatColumns(newColumns);
|
239
|
+
return nextColumns;
|
233
240
|
}, [curColumns, handleResize, _scroll, originalDataSource, originalObj, _rowClassName]);
|
234
241
|
var _columns = (0, _react.useMemo)(function () {
|
235
242
|
return columns === null || columns === void 0 ? void 0 : columns.filter(function (item, index) {
|
@@ -19,7 +19,7 @@ export interface ProTableSummaryProps {
|
|
19
19
|
fixed?: boolean;
|
20
20
|
}
|
21
21
|
export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
|
22
|
-
dataIndex
|
22
|
+
dataIndex?: string | string[];
|
23
23
|
width?: number | string;
|
24
24
|
minWidth?: number;
|
25
25
|
valueType?: ProTableValueType;
|
@@ -43,8 +43,9 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
|
|
43
43
|
/** 自定义比对函数, 触发条件必须写render */
|
44
44
|
onDiff?: ({ value, record, index, originalValue, originalRecord }: any) => any;
|
45
45
|
/** 自定义提示render, 触发条件必须写render */
|
46
|
-
viewRender?: ({ value, record, index, originalValue, originalRecord }: any) => 'same' | 'changed' | 'add' | undefined;
|
46
|
+
viewRender?: ({ value, record, index, originalValue, originalRecord, }: any) => 'same' | 'changed' | 'add' | undefined;
|
47
47
|
isChanged?: boolean | null;
|
48
|
+
children?: ProTableColumn[];
|
48
49
|
}
|
49
50
|
export interface CreateTreeFromArrayOptions {
|
50
51
|
itemKey?: string;
|
@@ -753,6 +753,9 @@
|
|
753
753
|
}
|
754
754
|
|
755
755
|
.@{ant-prefix}-picker.@{ant-prefix}-picker-disabled {
|
756
|
-
background: var(--zaui-disabled-bg);
|
756
|
+
background: var(--zaui-disabled-bg) !important;
|
757
757
|
}
|
758
758
|
|
759
|
+
.@{ant-prefix}-input-affix-wrapper-disabled {
|
760
|
+
background: var(--zaui-disabled-bg) !important;
|
761
|
+
}
|