@zat-design/sisyphus-react 3.7.3 → 3.8.0-beat.10

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 (191) hide show
  1. package/dist/index.esm.css +100 -4
  2. package/dist/less.esm.css +97 -4
  3. package/es/ProAction/index.js +1 -1
  4. package/es/ProDownload/index.js +3 -3
  5. package/es/ProDownload/utils.js +3 -3
  6. package/es/ProDrawerForm/components/ProDrawer/index.js +4 -4
  7. package/es/ProDrawerForm/components/ProModal/index.js +3 -3
  8. package/es/ProEditLabel/index.js +3 -3
  9. package/es/ProEditTable/components/ActionButton/index.js +3 -3
  10. package/es/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts} +4 -3
  11. package/es/ProEditTable/components/RenderField/{ListChanged.js → ListChangedWrapper.js} +29 -14
  12. package/es/ProEditTable/components/RenderField/index.js +10 -8
  13. package/es/ProEditTable/components/RenderToolbar/index.js +1 -1
  14. package/es/ProEditTable/utils/config.js +2 -2
  15. package/es/ProEditTable/utils/index.js +5 -5
  16. package/es/ProEditTable/utils/tools.js +1 -1
  17. package/es/ProEnum/components/Group.js +10 -2
  18. package/es/ProEnum/hooks/useEnumRequest.js +2 -2
  19. package/es/ProEnum/index.js +6 -5
  20. package/es/ProEnum/style/index.less +14 -4
  21. package/es/ProEnum/utils/index.d.ts +1 -1
  22. package/es/ProEnum/utils/index.js +4 -0
  23. package/es/ProForm/components/combination/Container/index.js +5 -3
  24. package/es/ProForm/components/combination/Container/propsType.d.ts +2 -1
  25. package/es/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
  26. package/es/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
  27. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
  28. package/es/ProForm/components/combination/FormList/utils.js +6 -5
  29. package/es/ProForm/components/combination/Group/component/ComRender.js +1 -1
  30. package/es/ProForm/components/combination/Group/utils.js +8 -1
  31. package/es/ProForm/components/combination/ProCascader/index.js +6 -3
  32. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +1 -1
  33. package/es/ProForm/components/combination/ProModalSelect/index.js +57 -46
  34. package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +1 -0
  35. package/es/ProForm/components/combination/ProNumberRange/index.js +14 -5
  36. package/es/ProForm/components/combination/ProNumberRange/style/index.less +5 -1
  37. package/es/ProForm/components/old/ProAddress/index.js +1 -1
  38. package/es/ProForm/components/render/ChangedWrapper.d.ts +17 -0
  39. package/es/ProForm/components/render/ChangedWrapper.js +110 -0
  40. package/es/ProForm/components/render/ConfirmWrapper.js +1 -1
  41. package/es/ProForm/components/render/Render.js +11 -11
  42. package/es/ProForm/components/render/RenderFields.d.ts +2 -3
  43. package/es/ProForm/components/render/RenderFields.js +3 -4
  44. package/es/ProForm/components/render/propsType.d.ts +5 -4
  45. package/es/ProForm/index.js +4 -7
  46. package/es/ProForm/propsType.d.ts +13 -2
  47. package/es/ProForm/style/index.less +103 -5
  48. package/es/ProForm/utils/diffOriginal.d.ts +4 -4
  49. package/es/ProForm/utils/diffOriginal.js +18 -7
  50. package/es/ProForm/utils/transformValue.js +17 -11
  51. package/es/ProForm/utils/useForm.js +1 -1
  52. package/es/ProForm/utils/useShouldUpdate.d.ts +2 -2
  53. package/es/ProForm/utils/useShouldUpdate.js +1 -1
  54. package/es/ProSelect/index.js +12 -11
  55. package/es/ProSelect/propsType.d.ts +4 -0
  56. package/es/ProSelect/utils/index.js +5 -4
  57. package/es/ProStep/components/Listener/index.d.ts +1 -1
  58. package/es/ProStep/components/Listener/index.js +6 -3
  59. package/es/ProStep/index.d.ts +1 -1
  60. package/es/ProStep/index.js +25 -18
  61. package/es/ProTable/components/FormatColumn/index.d.ts +7 -1
  62. package/es/ProTable/components/FormatColumn/index.js +14 -8
  63. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +2 -2
  64. package/es/ProTable/hooks/useAntdTable.js +3 -3
  65. package/es/ProTable/index.js +30 -13
  66. package/es/ProTable/propsType.d.ts +14 -1
  67. package/es/ProTable/style/index.less +1 -1
  68. package/es/ProTree/components/AdaptiveTooltip.d.ts +4 -0
  69. package/es/ProTree/components/AdaptiveTooltip.js +55 -0
  70. package/es/ProTree/components/List.js +15 -3
  71. package/es/ProTree/components/ProTree.js +1 -1
  72. package/es/ProTree/components/ProTreeSelect/index.js +38 -5
  73. package/es/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
  74. package/es/ProTree/components/ProTreeSelect/style/index.less +2 -2
  75. package/es/ProTree/components/SearchTitle.d.ts +2 -0
  76. package/es/ProTree/components/SearchTitle.js +17 -8
  77. package/es/ProTree/components/Tree.js +1 -1
  78. package/es/ProTree/style/index.less +14 -0
  79. package/es/ProTreeModal/components/Tree.js +15 -17
  80. package/es/ProTreeModal/index.js +62 -7
  81. package/es/ProTreeModal/utils.d.ts +1 -0
  82. package/es/ProTreeModal/utils.js +21 -1
  83. package/es/ProUpload/components/ImageRender.js +1 -1
  84. package/es/ProViewer/index.js +2 -2
  85. package/es/old/ProEditableTable/index.js +4 -4
  86. package/es/style/theme/antd.less +5 -0
  87. package/es/style/theme/index.less +2 -1
  88. package/es/style/theme/tokens.less +1 -0
  89. package/es/utils/index.d.ts +2 -0
  90. package/es/utils/index.js +13 -0
  91. package/lib/ProAction/index.js +1 -1
  92. package/lib/ProDownload/index.js +3 -3
  93. package/lib/ProDownload/utils.js +3 -3
  94. package/lib/ProDrawerForm/components/ProDrawer/index.js +4 -4
  95. package/lib/ProDrawerForm/components/ProModal/index.js +3 -3
  96. package/lib/ProEditLabel/index.js +3 -3
  97. package/lib/ProEditTable/components/ActionButton/index.js +3 -3
  98. package/lib/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts} +4 -3
  99. package/lib/ProEditTable/components/RenderField/{ListChanged.js → ListChangedWrapper.js} +32 -15
  100. package/lib/ProEditTable/components/RenderField/index.js +10 -8
  101. package/lib/ProEditTable/components/RenderToolbar/index.js +1 -1
  102. package/lib/ProEditTable/utils/config.js +2 -2
  103. package/lib/ProEditTable/utils/index.js +5 -5
  104. package/lib/ProEditTable/utils/tools.js +1 -1
  105. package/lib/ProEnum/components/Group.js +10 -2
  106. package/lib/ProEnum/hooks/useEnumRequest.js +2 -2
  107. package/lib/ProEnum/index.js +6 -5
  108. package/lib/ProEnum/style/index.less +14 -4
  109. package/lib/ProEnum/utils/index.d.ts +1 -1
  110. package/lib/ProEnum/utils/index.js +4 -0
  111. package/lib/ProForm/components/combination/Container/index.js +5 -3
  112. package/lib/ProForm/components/combination/Container/propsType.d.ts +2 -1
  113. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
  114. package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
  115. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
  116. package/lib/ProForm/components/combination/FormList/utils.js +5 -4
  117. package/lib/ProForm/components/combination/Group/component/ComRender.js +1 -1
  118. package/lib/ProForm/components/combination/Group/utils.js +8 -1
  119. package/lib/ProForm/components/combination/ProCascader/index.js +6 -3
  120. package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +1 -1
  121. package/lib/ProForm/components/combination/ProModalSelect/index.js +56 -45
  122. package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +1 -0
  123. package/lib/ProForm/components/combination/ProNumberRange/index.js +14 -5
  124. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +5 -1
  125. package/lib/ProForm/components/old/ProAddress/index.js +1 -1
  126. package/lib/ProForm/components/render/ChangedWrapper.d.ts +17 -0
  127. package/lib/ProForm/components/render/ChangedWrapper.js +115 -0
  128. package/lib/ProForm/components/render/ConfirmWrapper.js +1 -1
  129. package/lib/ProForm/components/render/Render.js +11 -11
  130. package/lib/ProForm/components/render/RenderFields.d.ts +2 -3
  131. package/lib/ProForm/components/render/RenderFields.js +3 -4
  132. package/lib/ProForm/components/render/propsType.d.ts +5 -4
  133. package/lib/ProForm/index.js +4 -7
  134. package/lib/ProForm/propsType.d.ts +13 -2
  135. package/lib/ProForm/style/index.less +103 -5
  136. package/lib/ProForm/utils/diffOriginal.d.ts +4 -4
  137. package/lib/ProForm/utils/diffOriginal.js +18 -7
  138. package/lib/ProForm/utils/transformValue.js +17 -11
  139. package/lib/ProForm/utils/useForm.js +1 -1
  140. package/lib/ProForm/utils/useShouldUpdate.d.ts +2 -2
  141. package/lib/ProForm/utils/useShouldUpdate.js +1 -1
  142. package/lib/ProSelect/index.js +12 -11
  143. package/lib/ProSelect/propsType.d.ts +4 -0
  144. package/lib/ProSelect/utils/index.js +5 -4
  145. package/lib/ProStep/components/Listener/index.d.ts +1 -1
  146. package/lib/ProStep/components/Listener/index.js +6 -3
  147. package/lib/ProStep/index.d.ts +1 -1
  148. package/lib/ProStep/index.js +25 -18
  149. package/lib/ProTable/components/FormatColumn/index.d.ts +7 -1
  150. package/lib/ProTable/components/FormatColumn/index.js +14 -8
  151. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +2 -2
  152. package/lib/ProTable/hooks/useAntdTable.js +3 -3
  153. package/lib/ProTable/index.js +30 -13
  154. package/lib/ProTable/propsType.d.ts +14 -1
  155. package/lib/ProTable/style/index.less +1 -1
  156. package/lib/ProTree/components/AdaptiveTooltip.d.ts +4 -0
  157. package/lib/ProTree/components/AdaptiveTooltip.js +61 -0
  158. package/lib/ProTree/components/List.js +15 -3
  159. package/lib/ProTree/components/ProTree.js +1 -1
  160. package/lib/ProTree/components/ProTreeSelect/index.js +38 -5
  161. package/lib/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
  162. package/lib/ProTree/components/ProTreeSelect/style/index.less +2 -2
  163. package/lib/ProTree/components/SearchTitle.d.ts +2 -0
  164. package/lib/ProTree/components/SearchTitle.js +19 -7
  165. package/lib/ProTree/components/Tree.js +1 -1
  166. package/lib/ProTree/style/index.less +14 -0
  167. package/lib/ProTreeModal/components/Tree.js +15 -17
  168. package/lib/ProTreeModal/index.js +61 -6
  169. package/lib/ProTreeModal/utils.d.ts +1 -0
  170. package/lib/ProTreeModal/utils.js +20 -0
  171. package/lib/ProUpload/components/ImageRender.js +1 -1
  172. package/lib/ProViewer/index.js +2 -2
  173. package/lib/old/ProEditableTable/index.js +4 -4
  174. package/lib/style/theme/antd.less +5 -0
  175. package/lib/style/theme/index.less +2 -1
  176. package/lib/style/theme/tokens.less +1 -0
  177. package/lib/utils/index.d.ts +2 -0
  178. package/lib/utils/index.js +19 -0
  179. package/package.json +4 -4
  180. package/es/ProForm/components/render/Changed.d.ts +0 -14
  181. package/es/ProForm/components/render/Changed.js +0 -64
  182. package/lib/ProForm/components/render/Changed.d.ts +0 -14
  183. package/lib/ProForm/components/render/Changed.js +0 -69
  184. /package/es/ProForm/utils/{useChanged.d.ts → _useChanged.d.ts} +0 -0
  185. /package/es/ProForm/utils/{useChanged.js → _useChanged.js} +0 -0
  186. /package/es/ProForm/utils/{useListChanged.d.ts → _useListChanged.d.ts} +0 -0
  187. /package/es/ProForm/utils/{useListChanged.js → _useListChanged.js} +0 -0
  188. /package/lib/ProForm/utils/{useChanged.d.ts → _useChanged.d.ts} +0 -0
  189. /package/lib/ProForm/utils/{useChanged.js → _useChanged.js} +0 -0
  190. /package/lib/ProForm/utils/{useListChanged.d.ts → _useListChanged.d.ts} +0 -0
  191. /package/lib/ProForm/utils/{useListChanged.js → _useListChanged.js} +0 -0
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ exports.addLevelAndParentId = void 0;
7
8
  exports.filterCheckedNodes = filterCheckedNodes;
8
9
  exports.findTreeNodeByKey = findTreeNodeByKey;
9
10
  exports.getAllKeys = getAllKeys;
@@ -209,4 +210,23 @@ var transformMessage = exports.transformMessage = function transformMessage(obj,
209
210
  _message = message.replaceAll("{".concat(key, "}"), obj[key]);
210
211
  });
211
212
  return _message;
213
+ };
214
+ var _addLevelAndParentId = exports.addLevelAndParentId = function addLevelAndParentId() {
215
+ var tree = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
216
+ var fieldNames = arguments.length > 1 ? arguments[1] : undefined;
217
+ var currentLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
218
+ var currentParentId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
219
+ var _fieldNames$children = fieldNames.children,
220
+ children = _fieldNames$children === void 0 ? 'children' : _fieldNames$children,
221
+ _fieldNames$value = fieldNames.value,
222
+ value = _fieldNames$value === void 0 ? 'value' : _fieldNames$value;
223
+ return tree.map(function (node) {
224
+ var newNode = (0, _objectSpread4.default)({}, node);
225
+ newNode.level = currentLevel;
226
+ newNode.parentId = currentParentId;
227
+ if (node[children]) {
228
+ newNode[children] = _addLevelAndParentId(node[children], fieldNames, currentLevel + 1, newNode[value]);
229
+ }
230
+ return newNode;
231
+ });
212
232
  };
@@ -166,7 +166,7 @@ var ImageRender = function ImageRender(props) {
166
166
  disabled: isView || disabled,
167
167
  className: "action-item",
168
168
  onClick: function () {
169
- var _onClick = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
169
+ var _onClick = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
170
170
  var res;
171
171
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
172
172
  while (1) switch (_context.prev = _context.next) {
@@ -112,8 +112,8 @@ var ProViewer = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
112
112
  (0, _react.useEffect)(function () {
113
113
  if (previewFile) {
114
114
  try {
115
- previewFile().then( /*#__PURE__*/function () {
116
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(response) {
115
+ previewFile().then(/*#__PURE__*/function () {
116
+ var _ref3 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(response) {
117
117
  var res, blob, blobUrl;
118
118
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
119
119
  while (1) switch (_context.prev = _context.next) {
@@ -166,7 +166,7 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
166
166
  * @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
167
167
  */
168
168
  var onMultipleDelete = /*#__PURE__*/function () {
169
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
169
+ var _ref2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
170
170
  var res, values, nextList, resetFieldsIndex;
171
171
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
172
172
  while (1) switch (_context.prev = _context.next) {
@@ -272,7 +272,7 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
272
272
  * @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
273
273
  */
274
274
  var onSave = /*#__PURE__*/function () {
275
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(rowIndex, callback) {
275
+ var _ref3 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(rowIndex, callback) {
276
276
  var _form$getFieldsValue$, _form$getFieldsValue, nextValues, res, values;
277
277
  return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
278
278
  while (1) switch (_context2.prev = _context2.next) {
@@ -398,12 +398,12 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
398
398
  }, antButtonProps), {}, {
399
399
  children: buttonText
400
400
  }))]
401
- }) : ( /*#__PURE__*/(0, _react.cloneElement)(buttonText, antButtonProps))
401
+ }) : (/*#__PURE__*/(0, _react.cloneElement)(buttonText, antButtonProps))
402
402
  }) : null
403
403
  });
404
404
  };
405
405
  var validateFields = /*#__PURE__*/function () {
406
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {
406
+ var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {
407
407
  var values, nextValues, nextList, isEditing;
408
408
  return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
409
409
  while (1) switch (_context3.prev = _context3.next) {
@@ -749,3 +749,8 @@
749
749
  }
750
750
  }
751
751
  }
752
+
753
+ .@{ant-prefix}-picker.@{ant-prefix}-picker-disabled {
754
+ background: var(--zaui-disabled-bg);
755
+ }
756
+
@@ -8,7 +8,7 @@
8
8
  --zaui-brand : #006aff;
9
9
  --zaui-brand-hover : #3387ff;
10
10
  --zaui-brand-active : #005ad9;
11
- --zaui-brand-disabled : #99c3ff;
11
+ --zaui-brand-disabled : color-mix(in srgb, var(--zaui-brand) 70%, white);
12
12
  --zaui-text : #343434;
13
13
  --zaui-text-weak : #616161;
14
14
  --zaui-aide-text : #909090;
@@ -55,6 +55,7 @@
55
55
  --zaui-table-selected-hover-bg : var(--zaui-table-hover-bg); // 默认同悬停
56
56
  --zaui-table-nested-bg : #fafcfe;
57
57
  --zaui-contract-bg : #fffaa1; // 对比背景色
58
+ --zaui-contract-bg-add : #d2fff4; // 新增对比背景色
58
59
  --zaui-form-label-width : 130px; // 8个全角字符宽度
59
60
  --zaui-border-radius : 8px;
60
61
  --zaui-border-radius-card : 4px;
@@ -53,6 +53,7 @@
53
53
  @zaui-table-selected-hover-bg: var(--zaui-table-hover-bg #fafafa);
54
54
  @zaui-table-nested-bg: var(--zaui-table-nested-bg #FAFCFE);
55
55
  @zaui-contract-bg: var(--zaui-contract-bg; #fffaa1); // 对比背景色
56
+ @zaui-contract-bg-add: var(--zaui-contract-bg-add; #d2fff4); // 新增对比背景色
56
57
  @zaui-form-required-after: var(--zaui-form-required-after; inline);
57
58
  @zaui-form-required-before: var(--zaui-form-required-before; none);
58
59
  @zaui-form-label-width: var(--zaui-form-label-width; 130px);
@@ -0,0 +1,2 @@
1
+ /** 判断一个值是否是空值 */
2
+ export declare const isEmpty: (value: any) => boolean;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isEmpty = void 0;
7
+ var EMPTY_VALUE = [undefined, null, ''];
8
+ /** 判断一个值是否是空值 */
9
+ var isEmpty = exports.isEmpty = function isEmpty(value) {
10
+ if (EMPTY_VALUE.includes(value)) {
11
+ return true;
12
+ }
13
+ if (Array.isArray(value)) {
14
+ return !(value === null || value === void 0 ? void 0 : value.length) || value.every(function (item) {
15
+ return EMPTY_VALUE.includes(item);
16
+ });
17
+ }
18
+ return false;
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.7.3",
3
+ "version": "3.8.0-beat.10",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -84,7 +84,6 @@
84
84
  "@types/classnames": "^2.3.1",
85
85
  "@types/jest": "^29.5.11",
86
86
  "@types/lodash": "^4.14.171",
87
- "@types/mockjs": "^1.0.6",
88
87
  "@types/react": "^17.0.53",
89
88
  "@types/react-dom": "^17.0.0",
90
89
  "@types/react-resizable": "^1.7.4",
@@ -96,12 +95,13 @@
96
95
  "@zat-design/login-react": "1.0.25",
97
96
  "babel-eslint": "10.0.3",
98
97
  "babel-plugin-import": "^1.13.3",
99
- "commander": "<=9.2.0",
98
+ "commander": "9.2.0",
100
99
  "cross-env": "^7.0.3",
101
100
  "dumi": "^1.0.9",
102
101
  "eslint": "7.10.0",
103
102
  "eslint-config-za": "2.1.0",
104
103
  "eslint-plugin-babel": "5.3.0",
104
+ "eslint-plugin-complexity": "^1.0.2",
105
105
  "eslint-plugin-import": "^2.22.1",
106
106
  "eslint-plugin-jsx-a11y": "6.2.3",
107
107
  "eslint-plugin-react": "7.16.0",
@@ -112,7 +112,7 @@
112
112
  "husky": "^4.0.7",
113
113
  "jest-canvas-mock": "^2.5.2",
114
114
  "lint-staged": "^10.0.0",
115
- "mockjs": "^1.1.0",
115
+ "mockjs": "^1.0.0",
116
116
  "prettier": "^2.5.0",
117
117
  "pretty-quick": "^3.1.3",
118
118
  "react-json-view": "^1.21.3",
@@ -1,14 +0,0 @@
1
- import { FormInstance } from 'antd';
2
- import { NamePath } from 'antd/lib/form/interface';
3
- import React from 'react';
4
- interface Props {
5
- name?: NamePath;
6
- names?: NamePath[];
7
- namesStr?: string;
8
- originalValues?: any;
9
- form: FormInstance;
10
- equalWith?: (preValue: any, curValue: any) => boolean | undefined;
11
- [name: string]: any;
12
- }
13
- declare const Changed: React.FC<Props>;
14
- export default Changed;
@@ -1,64 +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", "originalValues", "form", "equalWith", "children", "type", "originalDiffTip"];
8
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
- import { get } from 'lodash';
10
- import React, { useMemo } from 'react';
11
- import { diffOriginal } from '../../utils/diffOriginal';
12
- var Changed = function Changed(props) {
13
- var name = props.name,
14
- names = props.names,
15
- namesStr = props.namesStr,
16
- originalValues = props.originalValues,
17
- form = props.form,
18
- equalWith = props.equalWith,
19
- children = props.children,
20
- type = props.type,
21
- originalDiffTip = props.originalDiffTip,
22
- rest = _objectWithoutProperties(props, _excluded);
23
- // 不渲染tooltip
24
- var notWatch = !originalDiffTip || ['FormList', 'ProEditTable'].includes(type);
25
- var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
26
- return get(originalValues, name);
27
- }) : get(originalValues, name);
28
- var noChange = !equalWith && (!originalValues || originalValue === undefined);
29
- var changed = useMemo(function () {
30
- if (notWatch || noChange) return false;
31
- return diffOriginal({
32
- originalValue: originalValue,
33
- value: props.value,
34
- form: form,
35
- equalWith: equalWith
36
- // name: namesStr || name,
37
- });
38
- }, [notWatch, noChange, props.value, originalValue]);
39
- var tipContent = useMemo(function () {
40
- if (notWatch || noChange) return undefined;
41
- return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, {
42
- isView: true,
43
- value: originalValue,
44
- checked: type === 'Switch' ? originalValue : undefined
45
- })) : undefined;
46
- }, [originalValue, children]);
47
- if (notWatch || noChange) {
48
- return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
49
- }
50
- return _jsx(_Tooltip, {
51
- open: changed ? undefined : false,
52
- getPopupContainer: function getPopupContainer(target) {
53
- return target.parentElement;
54
- },
55
- title: _jsxs(_Space, {
56
- children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
57
- }),
58
- children: _jsx("div", {
59
- className: changed ? 'pro-form-item-changed' : '',
60
- children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
61
- })
62
- });
63
- };
64
- export default Changed;
@@ -1,14 +0,0 @@
1
- import { FormInstance } from 'antd';
2
- import { NamePath } from 'antd/lib/form/interface';
3
- import React from 'react';
4
- interface Props {
5
- name?: NamePath;
6
- names?: NamePath[];
7
- namesStr?: string;
8
- originalValues?: any;
9
- form: FormInstance;
10
- equalWith?: (preValue: any, curValue: any) => boolean | undefined;
11
- [name: string]: any;
12
- }
13
- declare const Changed: React.FC<Props>;
14
- export default Changed;
@@ -1,69 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- var _antd = require("antd");
13
- var _lodash = require("lodash");
14
- var _react = _interopRequireWildcard(require("react"));
15
- var _diffOriginal = require("../../utils/diffOriginal");
16
- var _excluded = ["name", "names", "namesStr", "originalValues", "form", "equalWith", "children", "type", "originalDiffTip"];
17
- var Changed = function Changed(props) {
18
- var name = props.name,
19
- names = props.names,
20
- namesStr = props.namesStr,
21
- originalValues = props.originalValues,
22
- form = props.form,
23
- equalWith = props.equalWith,
24
- children = props.children,
25
- type = props.type,
26
- originalDiffTip = props.originalDiffTip,
27
- rest = (0, _objectWithoutProperties2.default)(props, _excluded);
28
- // 不渲染tooltip
29
- var notWatch = !originalDiffTip || ['FormList', 'ProEditTable'].includes(type);
30
- var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
31
- return (0, _lodash.get)(originalValues, name);
32
- }) : (0, _lodash.get)(originalValues, name);
33
- var noChange = !equalWith && (!originalValues || originalValue === undefined);
34
- var changed = (0, _react.useMemo)(function () {
35
- if (notWatch || noChange) return false;
36
- return (0, _diffOriginal.diffOriginal)({
37
- originalValue: originalValue,
38
- value: props.value,
39
- form: form,
40
- equalWith: equalWith
41
- // name: namesStr || name,
42
- });
43
- }, [notWatch, noChange, props.value, originalValue]);
44
- var tipContent = (0, _react.useMemo)(function () {
45
- if (notWatch || noChange) return undefined;
46
- return /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), {}, {
47
- isView: true,
48
- value: originalValue,
49
- checked: type === 'Switch' ? originalValue : undefined
50
- })) : undefined;
51
- }, [originalValue, children]);
52
- if (notWatch || noChange) {
53
- return /*#__PURE__*/_react.default.isValidElement(children) && /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest));
54
- }
55
- return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
56
- open: changed ? undefined : false,
57
- getPopupContainer: function getPopupContainer(target) {
58
- return target.parentElement;
59
- },
60
- title: (0, _jsxRuntime.jsxs)(_antd.Space, {
61
- children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
62
- }),
63
- children: (0, _jsxRuntime.jsx)("div", {
64
- className: changed ? 'pro-form-item-changed' : '',
65
- children: /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, children.props), rest)) : undefined
66
- })
67
- });
68
- };
69
- var _default = exports.default = Changed;