@zat-design/sisyphus-react 3.13.4-beta.1 → 3.13.4-beta.2

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.
@@ -125,65 +125,67 @@ export var formatColumn = function formatColumn(_ref2) {
125
125
  var isInNewRowFlag = isInNewRow(record);
126
126
  var _isAddCell = isAddCell;
127
127
  otherProps.isChanged = isChanged;
128
- // 存在比对
129
- if (isFunction(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender) && (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource)) {
130
- var _originalObj$record$r;
131
- var diffResult = otherProps.viewRender({
132
- originalValue: originalValue,
133
- originalRecord: (_originalObj$record$r = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r !== void 0 ? _originalObj$record$r : {},
134
- value: value,
135
- record: record,
136
- index: index
137
- });
138
- // viewRender 返回值为 false 时,不显示对比
139
- if (isBoolean(diffResult)) {
140
- if (!diffResult) {
141
- otherProps.isChanged = false;
142
- _isAddCell = false;
143
- } else {
144
- otherProps.isChanged = true;
145
- _isAddCell = false;
128
+ if (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource) {
129
+ // 存在比对
130
+ if (isFunction(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender)) {
131
+ var _originalObj$record$r;
132
+ var diffResult = otherProps.viewRender({
133
+ originalValue: originalValue,
134
+ originalRecord: (_originalObj$record$r = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r !== void 0 ? _originalObj$record$r : {},
135
+ value: value,
136
+ record: record,
137
+ index: index
138
+ });
139
+ // viewRender 返回值为 false 时,不显示对比
140
+ if (isBoolean(diffResult)) {
141
+ if (!diffResult) {
142
+ otherProps.isChanged = false;
143
+ _isAddCell = false;
144
+ } else {
145
+ otherProps.isChanged = true;
146
+ _isAddCell = false;
147
+ }
148
+ }
149
+ // 指定返回相同了
150
+ if (typeof diffResult === 'string') {
151
+ if (diffResult === 'changed') {
152
+ _isAddCell = false;
153
+ otherProps.isChanged = true;
154
+ }
155
+ if (diffResult === 'same') {
156
+ _isAddCell = false;
157
+ otherProps.isChanged = false;
158
+ }
159
+ if (diffResult === 'add') {
160
+ _isAddCell = true;
161
+ otherProps.isChanged = false;
162
+ }
146
163
  }
164
+ originalValue = diffResult;
147
165
  }
148
- // 指定返回相同了
149
- if (typeof diffResult === 'string') {
150
- if (diffResult === 'changed') {
166
+ // 存在自定义onDiff比对
167
+ if (isFunction(onDiff)) {
168
+ var _originalObj$record$r2;
169
+ var _diffResult = onDiff({
170
+ originalValue: originalValue,
171
+ originalRecord: (_originalObj$record$r2 = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r2 !== void 0 ? _originalObj$record$r2 : {},
172
+ value: value,
173
+ record: record,
174
+ index: index
175
+ });
176
+ if (_diffResult === 'changed') {
151
177
  _isAddCell = false;
152
178
  otherProps.isChanged = true;
153
179
  }
154
- if (diffResult === 'same') {
180
+ if (_diffResult === 'same') {
155
181
  _isAddCell = false;
156
182
  otherProps.isChanged = false;
157
183
  }
158
- if (diffResult === 'add') {
184
+ if (_diffResult === 'add') {
159
185
  _isAddCell = true;
160
186
  otherProps.isChanged = false;
161
187
  }
162
188
  }
163
- originalValue = diffResult;
164
- }
165
- // 存在自定义onDiff比对
166
- if (isFunction(onDiff)) {
167
- var _originalObj$record$r2;
168
- var _diffResult = onDiff({
169
- originalValue: originalValue,
170
- originalRecord: (_originalObj$record$r2 = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r2 !== void 0 ? _originalObj$record$r2 : {},
171
- value: value,
172
- record: record,
173
- index: index
174
- });
175
- if (_diffResult === 'changed') {
176
- _isAddCell = false;
177
- otherProps.isChanged = true;
178
- }
179
- if (_diffResult === 'same') {
180
- _isAddCell = false;
181
- otherProps.isChanged = false;
182
- }
183
- if (_diffResult === 'add') {
184
- _isAddCell = true;
185
- otherProps.isChanged = false;
186
- }
187
189
  }
188
190
  return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
189
191
  valueType: valueType,
@@ -85,7 +85,17 @@ export var removeEmptyKeys = function removeEmptyKeys(obj) {
85
85
  return !isEmpty(value);
86
86
  });
87
87
  // 使用 Object.fromEntries() 将过滤后的键值对数组转换回对象
88
- return Object.fromEntries(filteredEntries);
88
+ var nextObj = Object.fromEntries(filteredEntries);
89
+ // 空对象的移除出去
90
+ Object.keys(nextObj).forEach(function (key) {
91
+ var _Object$values;
92
+ if (nextObj[key] && _typeof(nextObj[key]) === 'object' && ((_Object$values = Object.values(nextObj[key])) === null || _Object$values === void 0 ? void 0 : _Object$values.every(function (item) {
93
+ return [null, undefined, ''].includes(item);
94
+ }))) {
95
+ nextObj[key] = undefined;
96
+ }
97
+ });
98
+ return nextObj;
89
99
  };
90
100
  /** 判断是有值的对象 */
91
101
  export var isNonEmptyObject = function isNonEmptyObject(obj) {
@@ -131,65 +131,67 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
131
131
  var isInNewRowFlag = isInNewRow(record);
132
132
  var _isAddCell = isAddCell;
133
133
  otherProps.isChanged = isChanged;
134
- // 存在比对
135
- if ((0, _lodash.isFunction)(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender) && (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource)) {
136
- var _originalObj$record$r;
137
- var diffResult = otherProps.viewRender({
138
- originalValue: originalValue,
139
- originalRecord: (_originalObj$record$r = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r !== void 0 ? _originalObj$record$r : {},
140
- value: value,
141
- record: record,
142
- index: index
143
- });
144
- // viewRender 返回值为 false 时,不显示对比
145
- if ((0, _lodash.isBoolean)(diffResult)) {
146
- if (!diffResult) {
147
- otherProps.isChanged = false;
148
- _isAddCell = false;
149
- } else {
150
- otherProps.isChanged = true;
151
- _isAddCell = false;
134
+ if (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource) {
135
+ // 存在比对
136
+ if ((0, _lodash.isFunction)(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender)) {
137
+ var _originalObj$record$r;
138
+ var diffResult = otherProps.viewRender({
139
+ originalValue: originalValue,
140
+ originalRecord: (_originalObj$record$r = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r !== void 0 ? _originalObj$record$r : {},
141
+ value: value,
142
+ record: record,
143
+ index: index
144
+ });
145
+ // viewRender 返回值为 false 时,不显示对比
146
+ if ((0, _lodash.isBoolean)(diffResult)) {
147
+ if (!diffResult) {
148
+ otherProps.isChanged = false;
149
+ _isAddCell = false;
150
+ } else {
151
+ otherProps.isChanged = true;
152
+ _isAddCell = false;
153
+ }
154
+ }
155
+ // 指定返回相同了
156
+ if (typeof diffResult === 'string') {
157
+ if (diffResult === 'changed') {
158
+ _isAddCell = false;
159
+ otherProps.isChanged = true;
160
+ }
161
+ if (diffResult === 'same') {
162
+ _isAddCell = false;
163
+ otherProps.isChanged = false;
164
+ }
165
+ if (diffResult === 'add') {
166
+ _isAddCell = true;
167
+ otherProps.isChanged = false;
168
+ }
152
169
  }
170
+ originalValue = diffResult;
153
171
  }
154
- // 指定返回相同了
155
- if (typeof diffResult === 'string') {
156
- if (diffResult === 'changed') {
172
+ // 存在自定义onDiff比对
173
+ if ((0, _lodash.isFunction)(onDiff)) {
174
+ var _originalObj$record$r2;
175
+ var _diffResult = onDiff({
176
+ originalValue: originalValue,
177
+ originalRecord: (_originalObj$record$r2 = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r2 !== void 0 ? _originalObj$record$r2 : {},
178
+ value: value,
179
+ record: record,
180
+ index: index
181
+ });
182
+ if (_diffResult === 'changed') {
157
183
  _isAddCell = false;
158
184
  otherProps.isChanged = true;
159
185
  }
160
- if (diffResult === 'same') {
186
+ if (_diffResult === 'same') {
161
187
  _isAddCell = false;
162
188
  otherProps.isChanged = false;
163
189
  }
164
- if (diffResult === 'add') {
190
+ if (_diffResult === 'add') {
165
191
  _isAddCell = true;
166
192
  otherProps.isChanged = false;
167
193
  }
168
194
  }
169
- originalValue = diffResult;
170
- }
171
- // 存在自定义onDiff比对
172
- if ((0, _lodash.isFunction)(onDiff)) {
173
- var _originalObj$record$r2;
174
- var _diffResult = onDiff({
175
- originalValue: originalValue,
176
- originalRecord: (_originalObj$record$r2 = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r2 !== void 0 ? _originalObj$record$r2 : {},
177
- value: value,
178
- record: record,
179
- index: index
180
- });
181
- if (_diffResult === 'changed') {
182
- _isAddCell = false;
183
- otherProps.isChanged = true;
184
- }
185
- if (_diffResult === 'same') {
186
- _isAddCell = false;
187
- otherProps.isChanged = false;
188
- }
189
- if (_diffResult === 'add') {
190
- _isAddCell = true;
191
- otherProps.isChanged = false;
192
- }
193
195
  }
194
196
  return (0, _jsxRuntime.jsx)(_RenderColumn.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, otherProps), {}, {
195
197
  valueType: valueType,
@@ -92,7 +92,17 @@ var removeEmptyKeys = exports.removeEmptyKeys = function removeEmptyKeys(obj) {
92
92
  return !isEmpty(value);
93
93
  });
94
94
  // 使用 Object.fromEntries() 将过滤后的键值对数组转换回对象
95
- return Object.fromEntries(filteredEntries);
95
+ var nextObj = Object.fromEntries(filteredEntries);
96
+ // 空对象的移除出去
97
+ Object.keys(nextObj).forEach(function (key) {
98
+ var _Object$values;
99
+ if (nextObj[key] && (0, _typeof2.default)(nextObj[key]) === 'object' && ((_Object$values = Object.values(nextObj[key])) === null || _Object$values === void 0 ? void 0 : _Object$values.every(function (item) {
100
+ return [null, undefined, ''].includes(item);
101
+ }))) {
102
+ nextObj[key] = undefined;
103
+ }
104
+ });
105
+ return nextObj;
96
106
  };
97
107
  /** 判断是有值的对象 */
98
108
  var isNonEmptyObject = exports.isNonEmptyObject = function isNonEmptyObject(obj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.13.4-beta.1",
3
+ "version": "3.13.4-beta.2",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",