@zat-design/sisyphus-react 3.8.1 → 3.8.2-beta.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 (63) hide show
  1. package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
  2. package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
  3. package/coverage/lcov-report/src/.umi/core/index.html +206 -0
  4. package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
  5. package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
  6. package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
  7. package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
  8. package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
  9. package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
  10. package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
  11. package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
  12. package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
  13. package/coverage/lcov-report/src/.umi/index.html +116 -0
  14. package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
  15. package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
  16. package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
  17. package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
  18. package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
  19. package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
  20. package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
  21. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
  22. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
  23. package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
  24. package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
  25. package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
  26. package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
  27. package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
  28. package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
  29. package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
  30. package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
  31. package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
  32. package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
  33. package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
  34. package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
  35. package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
  36. package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
  37. package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
  38. package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
  39. package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
  40. package/dist/index.esm.css +10 -8
  41. package/dist/less.esm.css +10 -8
  42. package/es/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
  43. package/es/ProForm/components/combination/Group/component/ComRender.js +4 -2
  44. package/es/ProForm/components/combination/Group/index.js +6 -3
  45. package/es/ProForm/components/render/Render.js +2 -2
  46. package/es/ProForm/components/render/propsType.d.ts +4 -0
  47. package/es/ProForm/style/index.less +2 -2
  48. package/es/ProForm/utils/useShouldUpdate.js +21 -6
  49. package/es/ProTable/components/FormatColumn/index.js +22 -0
  50. package/es/ProTable/index.js +12 -2
  51. package/es/ProTable/style/index.less +8 -6
  52. package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
  53. package/lib/ProForm/components/combination/Group/component/ComRender.js +4 -2
  54. package/lib/ProForm/components/combination/Group/index.js +6 -3
  55. package/lib/ProForm/components/render/Render.js +2 -2
  56. package/lib/ProForm/components/render/propsType.d.ts +4 -0
  57. package/lib/ProForm/style/index.less +2 -2
  58. package/lib/ProForm/utils/useShouldUpdate.js +19 -4
  59. package/lib/ProTable/components/FormatColumn/index.js +22 -0
  60. package/lib/ProTable/index.js +12 -2
  61. package/lib/ProTable/style/index.less +8 -6
  62. package/package.json +4 -3
  63. package/.vscode/extensions.json +0 -5
@@ -14,6 +14,7 @@ interface Props {
14
14
  name?: NamePath;
15
15
  valueType: string;
16
16
  valuePropName?: string;
17
+ isView?: boolean;
17
18
  getValueProps?: (value: any) => Record<string, unknown>;
18
19
  }
19
20
  /** 渲染组件 */
@@ -15,7 +15,7 @@ var _ConfirmWrapper = _interopRequireDefault(require("../../../../components/ren
15
15
  var _useFieldProps = require("../../../../utils/useFieldProps");
16
16
  var componentMap = _interopRequireWildcard(require("../../../../../index"));
17
17
  var _AddonWrapper = _interopRequireDefault(require("./AddonWrapper"));
18
- var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after", "getValueProps", "valuePropName", "valueType"];
18
+ var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after", "getValueProps", "valuePropName", "valueType", "isView"];
19
19
  // 这里的key与组件内参数一致, 决定使用哪个包裹组件
20
20
  var wrapperMap = {
21
21
  confirm: _ConfirmWrapper.default,
@@ -49,6 +49,7 @@ var ComRender = function ComRender(props) {
49
49
  _props$valuePropName = props.valuePropName,
50
50
  valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
51
51
  valueType = props.valueType,
52
+ isView = props.isView,
52
53
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
53
54
  var TypeComponent = componentMap[type];
54
55
  var mergedGetValueProps = getValueProps || function (val) {
@@ -61,7 +62,8 @@ var ComRender = function ComRender(props) {
61
62
  return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
62
63
  value: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, contextProps), {}, {
63
64
  valueType: valueType,
64
- type: type
65
+ type: type,
66
+ isView: isView
65
67
  }),
66
68
  children: Com
67
69
  });
@@ -33,7 +33,8 @@ var Group = function Group(props) {
33
33
  onChange = props.onChange,
34
34
  otherProps = props.otherProps,
35
35
  disabled = props.disabled,
36
- id = props.id;
36
+ id = props.id,
37
+ isView = props.isView;
37
38
  var contextProps = _ProForm.default.useFieldProps() || {};
38
39
  var names = contextProps.names,
39
40
  name = contextProps.name,
@@ -76,7 +77,8 @@ var Group = function Group(props) {
76
77
  children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? (0, _jsxRuntime.jsx)(_antd.Space.Compact, {
77
78
  children: columns.map(function (column, index) {
78
79
  return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
79
- contextProps: contextProps
80
+ contextProps: contextProps,
81
+ isView: isView
80
82
  }, column), {}, {
81
83
  otherProps: otherProps
82
84
  }), column.name);
@@ -86,7 +88,8 @@ var Group = function Group(props) {
86
88
  }, (0, _lodash.omit)(space, ['separator', 'compact'])), {}, {
87
89
  children: columns.map(function (column, index) {
88
90
  return (0, _jsxRuntime.jsx)(_ComRender.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
89
- contextProps: contextProps
91
+ contextProps: contextProps,
92
+ isView: isView
90
93
  }, column), {}, {
91
94
  otherProps: otherProps
92
95
  }), column.name);
@@ -155,7 +155,7 @@ var Render = function Render(props) {
155
155
  };
156
156
  }
157
157
  /** 移除多余参数,防止透传给formItem报错 */
158
- var _otherFormItemProps = (0, _lodash.omit)(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow']);
158
+ var _otherFormItemProps = (0, _lodash.omit)(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow', 'dependNames']);
159
159
  /**
160
160
  * globalControl 全局控制优先
161
161
  * globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
@@ -426,7 +426,7 @@ var Render = function Render(props) {
426
426
  span: 24 // 默认占一行
427
427
  });
428
428
  }
429
- if (diffConfig) {
429
+ if (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues) {
430
430
  child = (0, _jsxRuntime.jsx)(_ChangedWrapper.default, {
431
431
  name: formItemProps.name,
432
432
  names: otherProps.names,
@@ -182,6 +182,8 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
182
182
  }) => React.ReactElement<any, any> | string | undefined | null;
183
183
  viewType?: ViewType;
184
184
  colProps?: ColProps;
185
+ /** 依赖刷新字段列表 */
186
+ dependNames?: NamePath[];
185
187
  /**
186
188
  * @description 表单item的props属性
187
189
  * @deprecated 将于下个版本 4.0.0 被弃用
@@ -190,6 +192,8 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
190
192
  formItemProps?: FormItemProps<Values> & {
191
193
  index?: number;
192
194
  namePath?: NamePath;
195
+ /** 依赖刷新字段列表 */
196
+ dependNames?: NamePath[];
193
197
  };
194
198
  /**
195
199
  * @description 表单props属性
@@ -387,7 +387,7 @@
387
387
 
388
388
  // textArea
389
389
  .@{ant-prefix}-input-textarea > textarea {
390
- background: @zaui-contract-bg;
390
+ background: @zaui-contract-bg !important;
391
391
  }
392
392
 
393
393
  .pro-form-view-container {
@@ -461,7 +461,7 @@
461
461
 
462
462
  // textArea
463
463
  .@{ant-prefix}-input-textarea > textarea {
464
- background: @zaui-contract-bg-add;
464
+ background: @zaui-contract-bg-add !important;
465
465
  }
466
466
 
467
467
 
@@ -27,7 +27,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
27
27
  index = formItemProps.index,
28
28
  namePath = formItemProps.namePath,
29
29
  names = formItemProps.names,
30
- dependencies = formItemProps.dependencies;
30
+ dependNames = formItemProps.dependNames;
31
31
  var timerRef = (0, _react.useRef)();
32
32
  var needClear = (0, _react.useRef)(); // 是否需要执行清值操作
33
33
  var showRef = (0, _react.useRef)();
@@ -36,13 +36,14 @@ var useShouldUpdate = function useShouldUpdate(props) {
36
36
  var rulesRef = (0, _react.useRef)();
37
37
  var fieldPropsRef = (0, _react.useRef)();
38
38
  var originComponentRef = (0, _react.useRef)();
39
+ var dependNamesRef = (0, _react.useRef)();
39
40
  var newComponent = originComponent || component; // 解决component默认赋值污染问题,需要使用originComponent
40
41
  var _useState = (0, _react.useState)({}),
41
42
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
42
43
  reRender = _useState2[1];
43
44
  var values = {};
44
45
  // 不是动态函数直接返回
45
- if (!(0, _lodash.isFunction)(show) && !(0, _lodash.isFunction)(disabled) && !(0, _lodash.isFunction)(required) && !(0, _lodash.isFunction)(rules) && !(0, _lodash.isFunction)(fieldProps) && !(0, _lodash.isFunction)(originComponent)) {
46
+ if (!(dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) && !(0, _lodash.isFunction)(show) && !(0, _lodash.isFunction)(disabled) && !(0, _lodash.isFunction)(required) && !(0, _lodash.isFunction)(rules) && !(0, _lodash.isFunction)(fieldProps) && !(0, _lodash.isFunction)(originComponent)) {
46
47
  return {
47
48
  shouldUpdate: _shouldUpdate,
48
49
  show: show,
@@ -126,9 +127,22 @@ var useShouldUpdate = function useShouldUpdate(props) {
126
127
  } else {
127
128
  fieldPropsRef.current = fieldProps;
128
129
  }
130
+ if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
131
+ dependNamesRef.current = dependNames.map(function (name) {
132
+ return (0, _lodash.get)(values, name);
133
+ });
134
+ }
129
135
  return {
130
136
  shouldUpdate: function shouldUpdate(prevValues, currentValues) {
131
137
  // @ts-ignore formList场景取当前行数据,不取shouldUpdate变更后值
138
+ if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
139
+ var curDependNamesValue = dependNames.map(function (name) {
140
+ return (0, _lodash.get)(currentValues, name);
141
+ });
142
+ var dependNamesChanged = !(0, _lodash.isEqualWith)(dependNamesRef.current, curDependNamesValue, _index.customEqualForFun);
143
+ dependNamesRef.current = curDependNamesValue;
144
+ if (!dependNamesChanged) return false;
145
+ }
132
146
  var _currentValues;
133
147
  if (namePath) {
134
148
  // formList场景values取当前行数据
@@ -189,11 +203,12 @@ var useShouldUpdate = function useShouldUpdate(props) {
189
203
  }
190
204
  var equalRes = (0, _lodash.isEqualWith)(rulesRef.current, _rules, _index.customEqualForFun);
191
205
  var proEqualRes = (0, _lodash.isEqualWith)(fieldPropsRef.current, _fieldProps, _index.customEqualForFun);
192
- if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes ||
206
+ if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes
193
207
  // 值变更,需要同步更新函数式的fieldProps
194
208
  // (isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues)) ||
195
209
  // !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
196
- (0, _index.equalDependencies)(dependencies, prevValues, _currentValues)) {
210
+ // equalDependencies(dependencies, prevValues, _currentValues)
211
+ ) {
197
212
  showRef.current = _show;
198
213
  disabledRef.current = _disabled;
199
214
  requiredRef.current = _required;
@@ -71,6 +71,28 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref) {
71
71
  }
72
72
  };
73
73
  if (column === null || column === void 0 ? void 0 : column.render) {
74
+ if (!originalObj && Object.keys(originalObj !== null && originalObj !== void 0 ? originalObj : {}).length === 0) {
75
+ return;
76
+ }
77
+ var originalRender = column.render; // 保存原始的 render 方法
78
+ // 自定义render 手动重载下
79
+ column.render = function (value, record, index) {
80
+ var isFn = (0, _lodash.isFunction)(originalRender);
81
+ var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record !== null && record !== void 0 ? record : {}, index) : undefined;
82
+ var originalValue = (0, _utils2.getOriginalValue)(value, record !== null && record !== void 0 ? record : {}, originalObj, rowKey, dataIndex);
83
+ var originalRenderValue = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(originalValue, originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]], index) : undefined;
84
+ return (0, _jsxRuntime.jsx)(_RenderColumn.default, {
85
+ valueType: valueType,
86
+ originalValue: originalValue === undefined ? undefined : originalRenderValue,
87
+ ellipsis: ellipsis,
88
+ width: width,
89
+ value: _value,
90
+ node: _value,
91
+ currentValue: _value,
92
+ originalDiffTip: _originalDiffTip,
93
+ toolTipProps: _toolTipProps
94
+ });
95
+ };
74
96
  return;
75
97
  }
76
98
  if (tooltip) {
@@ -37,7 +37,7 @@ var defaultPage = exports.defaultPage = {
37
37
  pageSize: 10
38
38
  };
39
39
  function ProTable(props) {
40
- var _locale$ProTable, _curTableConfig$pathK;
40
+ var _locale$ProTable, _props$scroll, _curTableConfig$pathK;
41
41
  var _ref = (0, _index.useProConfig)('globalConfig') || {},
42
42
  configStorage = _ref.storage; // 获取全局缓存位置配置
43
43
  var _ref2 = (0, _index.useProConfig)('ProTable') || {},
@@ -65,6 +65,9 @@ function ProTable(props) {
65
65
  restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
66
66
  var _props$scrollFollowPa = props.scrollFollowParent,
67
67
  scrollFollowParent = _props$scrollFollowPa === void 0 ? true : _props$scrollFollowPa;
68
+ var _scroll = (_props$scroll = props === null || props === void 0 ? void 0 : props.scroll) !== null && _props$scroll !== void 0 ? _props$scroll : {
69
+ x: 'max-content'
70
+ };
68
71
  var wrapToolTipProps = {
69
72
  getPopupContainer: scrollFollowParent ? function (triggerNode) {
70
73
  return triggerNode.parentNode;
@@ -232,6 +235,12 @@ function ProTable(props) {
232
235
  return true;
233
236
  });
234
237
  }, [columns]);
238
+ var isExistPercentWidth = !!_columns.find(function (item) {
239
+ return item.width && typeof item.width === 'string' && item.width.endsWith('%');
240
+ });
241
+ if (isExistPercentWidth) {
242
+ _scroll = props === null || props === void 0 ? void 0 : props.scroll;
243
+ }
235
244
  var handleColumnConfig = /*#__PURE__*/function () {
236
245
  var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(checkList) {
237
246
  var newColumns, _columnConfig$onColum, catchColumns;
@@ -422,7 +431,8 @@ function ProTable(props) {
422
431
  summary: summary,
423
432
  dataSource: _dataSource
424
433
  },
425
- dataSource: _dataSource
434
+ dataSource: _dataSource,
435
+ scroll: _scroll
426
436
  })), (0, _jsxRuntime.jsx)("span", {
427
437
  className: "pro-table-resizable-line",
428
438
  style: {
@@ -257,12 +257,14 @@
257
257
  }
258
258
  }
259
259
 
260
- .@{ant-prefix}-table-body {
261
- .@{ant-prefix}-table-tbody .@{ant-prefix}-table-row:nth-child(odd).new-cell {
262
- background: #d2fff4 !important;
263
-
264
- td {
265
- background: #d2fff4 !important;
260
+ tbody.@{ant-prefix}-table-tbody {
261
+ tr.@{ant-prefix}-table-row.new-cell {
262
+ background: var(--zaui-contract-bg-add; #d2fff4) !important;
263
+ background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
264
+
265
+ td.@{ant-prefix}-table-cell {
266
+ background: var(--zaui-contract-bg-add; #d2fff4) !important;
267
+ background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
266
268
  border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
267
269
  }
268
270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.8.1",
3
+ "version": "3.8.2-beta.10",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -49,7 +49,8 @@
49
49
  "Android >= 4"
50
50
  ],
51
51
  "resolutions": {
52
- "@types/react": "^17.0.53"
52
+ "@types/react": "^17.0.53",
53
+ "mockjs/commander": "9.2.0"
53
54
  },
54
55
  "dependencies": {
55
56
  "@ant-design/icons": "^4.2.2",
@@ -58,7 +59,7 @@
58
59
  "@dnd-kit/sortable": "^7.0.2",
59
60
  "@dnd-kit/utilities": "^3.2.1",
60
61
  "@pansy/react-watermark": "^3.1.13",
61
- "@zat-design/utils": "^1.1.33",
62
+ "@zat-design/utils": "1.1.35",
62
63
  "ahooks": "3.7.4",
63
64
  "antd": "4.24.8",
64
65
  "big.js": "^6.2.1",
@@ -1,5 +0,0 @@
1
- {
2
- "recommendations": [
3
- "kisstkondoros.vscode-codemetrics"
4
- ]
5
- }