@zat-design/sisyphus-react 3.3.2 → 3.3.3

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 (38) hide show
  1. package/dist/index.esm.css +11 -5
  2. package/es/ProDrawerForm/components/ProModal/index.js +0 -1
  3. package/es/ProForm/components/base/TextArea/index.js +9 -5
  4. package/es/ProForm/components/combination/Container/index.js +4 -2
  5. package/es/ProForm/components/combination/Container/propsType.d.ts +2 -0
  6. package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +1 -0
  7. package/es/ProForm/components/combination/ProTimeLimit/index.js +2 -2
  8. package/es/ProForm/components/render/Render.js +1 -1
  9. package/es/ProForm/components/render/RenderFields.js +5 -0
  10. package/es/ProForm/components/render/propsType.d.ts +1 -0
  11. package/es/ProForm/components/render/propsType.js +1 -0
  12. package/es/ProForm/propsType.d.ts +1 -0
  13. package/es/ProForm/style/index.less +6 -3
  14. package/es/ProForm/utils/useChanged.js +1 -1
  15. package/es/ProForm/utils/useListChanged.js +22 -10
  16. package/es/ProLayout/components/ProCollapse/index.js +1 -0
  17. package/es/ProLayout/components/ProCollapse/style/index.less +49 -39
  18. package/es/ProTreeModal/index.js +5 -1
  19. package/es/style/theme/antd.less +1 -1
  20. package/lib/ProDrawerForm/components/ProModal/index.js +0 -1
  21. package/lib/ProForm/components/base/TextArea/index.js +9 -5
  22. package/lib/ProForm/components/combination/Container/index.js +4 -2
  23. package/lib/ProForm/components/combination/Container/propsType.d.ts +2 -0
  24. package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +1 -0
  25. package/lib/ProForm/components/combination/ProTimeLimit/index.js +2 -3
  26. package/lib/ProForm/components/render/Render.js +1 -1
  27. package/lib/ProForm/components/render/RenderFields.js +5 -0
  28. package/lib/ProForm/components/render/propsType.d.ts +1 -0
  29. package/lib/ProForm/components/render/propsType.js +2 -1
  30. package/lib/ProForm/propsType.d.ts +1 -0
  31. package/lib/ProForm/style/index.less +6 -3
  32. package/lib/ProForm/utils/useChanged.js +1 -1
  33. package/lib/ProForm/utils/useListChanged.js +22 -10
  34. package/lib/ProLayout/components/ProCollapse/index.js +1 -0
  35. package/lib/ProLayout/components/ProCollapse/style/index.less +49 -39
  36. package/lib/ProTreeModal/index.js +5 -1
  37. package/lib/style/theme/antd.less +1 -1
  38. package/package.json +3 -2
@@ -751,6 +751,9 @@
751
751
  .pro-collapse.pro-collapse-level2 .pro-collapse-level2-collapse .ant-collapse-expand-icon {
752
752
  display: block;
753
753
  }
754
+ .pro-collapse.pro-collapse-level2 .pro-collapse-level2-no-collapse .ant-collapse-expand-icon {
755
+ display: none;
756
+ }
754
757
  .pro-collapse .ant-collapse-extra .extra-info {
755
758
  margin-right: 24px;
756
759
  }
@@ -2565,20 +2568,24 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2565
2568
  }
2566
2569
  .pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper,
2567
2570
  .pro-form .ant-form-item.pro-form-item-changed .ant-select-selector,
2568
- .pro-form .ant-form-item.pro-form-item-changed .ant-picker {
2571
+ .pro-form .ant-form-item.pro-form-item-changed .ant-picker,
2572
+ .pro-form .ant-form-item.pro-form-item-changed .ant-input-number {
2569
2573
  background: var(--zaui-contract-bg, #fffaa1) !important;
2570
2574
  }
2571
2575
  .pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper input,
2572
2576
  .pro-form .ant-form-item.pro-form-item-changed .ant-select-selector input,
2573
- .pro-form .ant-form-item.pro-form-item-changed .ant-picker input {
2577
+ .pro-form .ant-form-item.pro-form-item-changed .ant-picker input,
2578
+ .pro-form .ant-form-item.pro-form-item-changed .ant-input-number input {
2574
2579
  background: var(--zaui-contract-bg, #fffaa1);
2575
2580
  }
2576
2581
  .pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
2577
2582
  .pro-form .ant-form-item.pro-form-item-changed .ant-select-selector .ant-select-selection-placeholder,
2578
- .pro-form .ant-form-item.pro-form-item-changed .ant-picker .ant-select-selection-placeholder {
2583
+ .pro-form .ant-form-item.pro-form-item-changed .ant-picker .ant-select-selection-placeholder,
2584
+ .pro-form .ant-form-item.pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
2579
2585
  z-index: 9;
2580
2586
  }
2581
- .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-form-view-container {
2587
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > span,
2588
+ .pro-form .ant-form-item.pro-form-item-changed .pro-form-view-container {
2582
2589
  padding: 4px 8px;
2583
2590
  background: var(--zaui-contract-bg, #fffaa1);
2584
2591
  border-radius: 4px;
@@ -5470,7 +5477,6 @@ input[type='button'] {
5470
5477
  width: calc(100% - 18px);
5471
5478
  margin-bottom: 0;
5472
5479
  text-align: right;
5473
- background: #fff;
5474
5480
  }
5475
5481
  .ant-space.ant-space-vertical {
5476
5482
  display: -webkit-box;
@@ -175,7 +175,6 @@ var ProModal = function ProModal(_ref) {
175
175
  footer: renderFooter(),
176
176
  okText: okText,
177
177
  cancelText: cancelText,
178
- centered: true,
179
178
  closeIcon: _jsx(ReactSVG, {
180
179
  className: "close-icon",
181
180
  src: closeSvg
@@ -9,6 +9,7 @@ import classnames from 'classnames';
9
9
  import { useProConfig } from '../../../../ProConfigProvider';
10
10
  import locale from '../../../../locale';
11
11
  import ProForm from '../../../../ProForm';
12
+ import Container from '../../Container';
12
13
  import './index.less';
13
14
  var TextArea = _Input.TextArea;
14
15
  var TextAreaDef = function TextAreaDef(props) {
@@ -18,16 +19,20 @@ var TextAreaDef = function TextAreaDef(props) {
18
19
  rest = _objectWithoutProperties(props, _excluded);
19
20
  var _ref = ProForm.useFieldProps() || {},
20
21
  label = _ref.label,
21
- isViewCon = _ref.isView;
22
+ isViewCon = _ref.isView,
23
+ viewEmpty = _ref.viewEmpty;
22
24
  var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
23
25
  var initialConfig = useProConfig('TextArea');
24
- var disabled = (initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.disabled) || rest.disabled;
25
26
  if (isView) {
26
- disabled = true;
27
+ return _jsx(Container, {
28
+ nowrap: false,
29
+ tooltip: true,
30
+ viewEmpty: viewEmpty,
31
+ children: rest.value
32
+ });
27
33
  }
28
34
  var _className = classnames({
29
35
  'pro-textarea': true,
30
- disabled: disabled,
31
36
  'pro-textarea-view': isView,
32
37
  className: className
33
38
  });
@@ -39,7 +44,6 @@ var TextAreaDef = function TextAreaDef(props) {
39
44
  minRows: 4
40
45
  }
41
46
  }, omit(initialConfig, ['trim'])), rest), {}, {
42
- disabled: disabled,
43
47
  className: _className
44
48
  }));
45
49
  };
@@ -11,11 +11,12 @@ var Container = function Container(props) {
11
11
  var children = props.children,
12
12
  otherProps = props.otherProps,
13
13
  className = props.className,
14
- container = props.container;
14
+ container = props.container,
15
+ show = props.show,
16
+ clearNotShow = props.clearNotShow;
15
17
  var _ref = ProForm.useFieldProps() || {},
16
18
  type = _ref.type,
17
19
  form = _ref.form,
18
- show = _ref.show,
19
20
  required = _ref.required,
20
21
  disabled = _ref.disabled;
21
22
  var _className = classnames(_defineProperty({
@@ -25,6 +26,7 @@ var Container = function Container(props) {
25
26
  var _children = useMemo(function () {
26
27
  var result = children.map(function (item) {
27
28
  return _objectSpread({
29
+ clearNotShow: clearNotShow,
28
30
  show: show,
29
31
  required: required,
30
32
  disabled: disabled
@@ -7,4 +7,6 @@ export interface ContainerProps {
7
7
  rowProps?: RowProps;
8
8
  className?: string;
9
9
  container?: string | React.ReactNode;
10
+ show?: boolean | (() => boolean);
11
+ clearNotShow?: boolean;
10
12
  }
@@ -3,6 +3,7 @@ import { Moment } from 'moment';
3
3
  import React from 'react';
4
4
  import { ProFormOtherProps } from '../../../propsType';
5
5
  import { Props as ProRangeLimitProps } from '../ProRangeLimit';
6
+ import { DistributiveOmit } from '../../../../ProForm/propsType';
6
7
  export type DateType = DatePickerProps['value'];
7
8
  export type ProTimeLimitProps = DistributiveOmit<DatePickerProps, 'value' | 'onChange' | 'mode'> & {
8
9
  value?: string;
@@ -12,7 +12,7 @@ var _excluded = ["format", "disabled", "foreverTime", "foreverText", "valueType"
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import classNames from 'classnames';
14
14
  import { omit } from 'lodash';
15
- import moment, { isMoment } from 'moment';
15
+ import moment from 'moment';
16
16
  import { useMemo } from 'react';
17
17
  import { useProConfig } from '../../../../ProConfigProvider';
18
18
  import Container from '../../Container';
@@ -53,7 +53,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
53
53
  onChange = _useControlled2[1];
54
54
  var initialConfig = useProConfig('ProTimeLimit');
55
55
  var isForever = useMemo(function () {
56
- if (isMoment(value)) {
56
+ if (moment.isMoment(value)) {
57
57
  return foreverMoment.format(format) === value.format(format);
58
58
  }
59
59
  return false;
@@ -175,7 +175,7 @@ var Render = function Render(props) {
175
175
  if (formItemProps.hidden === true || _show === false) {
176
176
  // 为了监听shouldUpdate 必须存在一个FormItem, 空Input解决 【[antd: Form.Item] `name` is only used for validate React element】
177
177
  return _jsx(_Form.Item, {
178
- name: _otherFormItemProps.name,
178
+ name: _otherFormItemProps.name || 'proFormItemHidden',
179
179
  shouldUpdate: _otherFormItemProps.shouldUpdate,
180
180
  className: _className,
181
181
  noStyle: true,
@@ -146,6 +146,11 @@ var RenderFields = function RenderFields(props) {
146
146
  }, _fieldProps), {}, {
147
147
  disabled: _disabled
148
148
  });
149
+ // 容器组件,额外处理show的问题
150
+ if (['ProCollapse', 'Container'].includes(_type)) {
151
+ componentProps.show = show;
152
+ componentProps.clearNotShow = clearNotShow;
153
+ }
149
154
  // switch与SwitchCheckbox单独添加valuePropName
150
155
  if (['Switch', 'SwitchCheckbox'].includes(_type)) {
151
156
  _formItemProps.valuePropName = 'checked';
@@ -32,6 +32,7 @@ import { ProUploadProps } from '../../../ProUpload/propsType';
32
32
  import { ProTreeProps } from '../../../ProTree/propsType';
33
33
  import { GroupProps } from '../combination/Group/propsType';
34
34
  import { ProCollapseProps } from '../../../ProLayout/components/ProCollapse/PropTypes';
35
+ import { DistributiveOmit } from '../../propsType';
35
36
  export type ComponentMap = keyof typeof componentMap;
36
37
  type ValidateKey = keyof typeof validate;
37
38
  type RegExpKey = keyof typeof regExp;
@@ -1 +1,2 @@
1
+ var a = {};
1
2
  export {};
@@ -73,3 +73,4 @@ export interface Transform<T = any> {
73
73
  getValueProps?: (value: StoreValue) => Record<string, unknown>;
74
74
  shouldUpdate?: ShouldUpdate<T>;
75
75
  }
76
+ export type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
@@ -126,11 +126,12 @@
126
126
  }
127
127
  }
128
128
 
129
- // 比较原始值场景下 不同时候的样式
129
+ // 比较原始值场景下 不同时的样式
130
130
  &.pro-form-item-changed {
131
131
  span.@{ant-prefix}-input-affix-wrapper,
132
132
  .@{ant-prefix}-select-selector,
133
- .@{ant-prefix}-picker {
133
+ .@{ant-prefix}-picker,
134
+ .@{ant-prefix}-input-number {
134
135
  background: @zaui-contract-bg !important;
135
136
 
136
137
  input {
@@ -141,7 +142,9 @@
141
142
  }
142
143
  }
143
144
 
144
- .@{ant-prefix}-form-item-control-input-content > .pro-form-view-container {
145
+ // 查看模式 修改容器样式
146
+ .@{ant-prefix}-form-item-control-input-content > span, // 地址组件
147
+ .pro-form-view-container {
145
148
  padding: 4px 8px;
146
149
  background: @zaui-contract-bg;
147
150
  border-radius: 4px;
@@ -12,7 +12,7 @@ export var useChanged = function useChanged(_ref) {
12
12
  var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
13
13
  return get(originalValues, name);
14
14
  }) : get(originalValues, name);
15
- var notWatch = !originalValues || originalValue === undefined;
15
+ var notWatch = !equalWith && (!originalValues || originalValue === undefined);
16
16
  if (notWatch) form = [];
17
17
  var value = _Form.useWatch(namesStr || name, form);
18
18
  if (notWatch) return [false];
@@ -33,11 +33,22 @@ var getOriginalValue = function getOriginalValue(_ref) {
33
33
  var originalValueRow = originalValueList.find(function (item) {
34
34
  return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
35
35
  });
36
- var originalValue = (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
37
- return get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
38
- }) : get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
36
+ var originalValue;
37
+ if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
38
+ var originalNamesValue = originalNames.map(function (originalName) {
39
+ return get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
40
+ });
41
+ // 有可能出现数组中全是undefined的情况 视为没有值
42
+ var fillUndefined = originalNamesValue.every(function (valItem) {
43
+ return valItem === undefined;
44
+ });
45
+ originalValue = fillUndefined ? undefined : originalNamesValue;
46
+ } else {
47
+ originalValue = get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
48
+ }
39
49
  return originalValue;
40
50
  }
51
+ // 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
41
52
  return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
42
53
  return get(originalValues, originalName);
43
54
  }) : get(originalValues, originalName);
@@ -54,23 +65,24 @@ export var useListChanged = function useListChanged(params) {
54
65
  form = params.form,
55
66
  equalWith = params.equalWith,
56
67
  rowKeyPath = params.rowKeyPath;
57
- // let _form = form;
58
68
  var namePath = toNamePath(namesStr || name);
59
69
  var originalNamePath = toNamePath(originalName);
60
70
  var originalNamePaths = originalNames && toNamePaths(originalNames);
61
- var originalValue = getOriginalValue({
71
+ var notWatch = !originalValues;
72
+ var originalValue = !notWatch ? getOriginalValue({
62
73
  namePath: namePath,
63
74
  originalName: originalNamePath,
64
75
  originalNames: originalNamePaths,
65
76
  originalValues: originalValues,
66
77
  rowKeyPath: rowKeyPath,
67
78
  form: form
68
- });
69
- var notWatch = !originalValues || originalValue === undefined;
79
+ }) : undefined;
80
+ var noChange = !equalWith && (!originalValues || originalValue === undefined);
81
+ var _form = form;
70
82
  // @ts-ignore
71
- // if (notWatch) _form = [];
72
- var value = _Form.useWatch(namePath, form);
73
- if (notWatch) return [false];
83
+ if (notWatch) _form = [];
84
+ var value = _Form.useWatch(namePath, _form);
85
+ if (notWatch || noChange) return [false];
74
86
  var changed = contrastOriginal({
75
87
  value: value,
76
88
  originalValue: originalValue,
@@ -43,6 +43,7 @@ var ProCollapse = function ProCollapse(props) {
43
43
  if (level === '2') {
44
44
  var level2Panel = classNames({
45
45
  'pro-collapse-level2-collapse': towCollapse,
46
+ 'pro-collapse-level2-no-collapse': !towCollapse,
46
47
  'pro-collapse-panel': true
47
48
  });
48
49
  var hasCollapse = {};
@@ -18,59 +18,62 @@
18
18
 
19
19
  .@{ant-prefix}-collapse-header {
20
20
  align-items: center !important;
21
- padding : 12px var(--zaui-space-size-md, 16px) !important;
22
- background : var(--zaui-area, #fafafa);
21
+ padding: 12px var(--zaui-space-size-md, 16px) !important;
22
+ background: var(--zaui-area, #fafafa);
23
23
  }
24
24
 
25
25
  .@{ant-prefix}-collapse-header-text {
26
- color : var(--zaui-text, #343434);
26
+ color: var(--zaui-text, #343434);
27
27
  font-weight: 500;
28
- font-size : var(--zaui-font-size-lg, 16px);
28
+ font-size: var(--zaui-font-size-lg, 16px);
29
29
  }
30
30
 
31
31
  .@{ant-prefix}-collapse-expand-icon {
32
32
  color: #c5c7cd;
33
33
  }
34
34
 
35
- &.@{ant-prefix}-collapse-borderless .@{ant-prefix}-collapse-item>.@{ant-prefix}-collapse-content>.@{ant-prefix}-collapse-content-box {
35
+ &.@{ant-prefix}-collapse-borderless
36
+ .@{ant-prefix}-collapse-item
37
+ > .@{ant-prefix}-collapse-content
38
+ > .@{ant-prefix}-collapse-content-box {
36
39
  padding: 0;
37
40
  }
38
41
 
39
42
  .@{ant-prefix}-collapse-content-box {
40
- padding : 0;
43
+ padding: 0;
41
44
  background: var(--zaui-base-bg, #ffffff);
42
45
 
43
46
  .pro-collapse-content {
44
- padding : var(--zaui-space-size-md, 16px);
47
+ padding: var(--zaui-space-size-md, 16px);
45
48
  padding-bottom: 0;
46
- background : var(--zaui-base-bg, #ffffff);
49
+ background: var(--zaui-base-bg, #ffffff);
47
50
  }
48
51
  }
49
52
 
50
53
  &.pro-collapse-level2 {
51
54
  margin-bottom: 0;
52
- background : var(--zaui-base-bg, #ffffff);
55
+ background: var(--zaui-base-bg, #ffffff);
53
56
 
54
57
  .@{ant-prefix}-collapse-header {
55
58
  margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
56
- padding : 0 !important;
57
- background : var(--zaui-base-bg, #ffffff);
59
+ padding: 0 !important;
60
+ background: var(--zaui-base-bg, #ffffff);
58
61
 
59
62
  .@{ant-prefix}-collapse-header-text {
60
- position : relative;
63
+ position: relative;
61
64
  padding-left: var(--zaui-space-size-sm, 8px);
62
- font-size : var(--zaui-font-size, 14px);
65
+ font-size: var(--zaui-font-size, 14px);
63
66
 
64
67
  &::before {
65
- position : absolute;
66
- top : 50%;
67
- left : 0;
68
- width : 4px;
69
- height : 14px;
70
- background : var(--zaui-brand);
68
+ position: absolute;
69
+ top: 50%;
70
+ left: 0;
71
+ width: 4px;
72
+ height: 14px;
73
+ background: var(--zaui-brand);
71
74
  border-radius: var(--zaui-border-radius-card, 2px);
72
- transform : translateY(-50%);
73
- content : '';
75
+ transform: translateY(-50%);
76
+ content: '';
74
77
  }
75
78
  }
76
79
 
@@ -93,9 +96,12 @@
93
96
  padding: 0;
94
97
  }
95
98
 
96
- &.@{ant-prefix}-collapse .@{ant-prefix}-collapse-item-disabled>.@{ant-prefix}-collapse-header,
97
- .@{ant-prefix}-collapse .@{ant-prefix}-collapse-item-disabled>.@{ant-prefix}-collapse-header>.arrow {
98
- color : var(--zaui-text, #343434);
99
+ &.@{ant-prefix}-collapse .@{ant-prefix}-collapse-item-disabled > .@{ant-prefix}-collapse-header,
100
+ .@{ant-prefix}-collapse
101
+ .@{ant-prefix}-collapse-item-disabled
102
+ > .@{ant-prefix}-collapse-header
103
+ > .arrow {
104
+ color: var(--zaui-text, #343434);
99
105
  cursor: default;
100
106
  }
101
107
 
@@ -108,6 +114,12 @@
108
114
  display: block;
109
115
  }
110
116
  }
117
+
118
+ .pro-collapse-level2-no-collapse {
119
+ .@{ant-prefix}-collapse-expand-icon {
120
+ display: none;
121
+ }
122
+ }
111
123
  }
112
124
 
113
125
  .@{ant-prefix}-collapse-extra {
@@ -117,10 +129,9 @@
117
129
  }
118
130
 
119
131
  &.pro-collapse-list {
120
-
121
- .@{ant-prefix}-descriptions-row>th,
122
- .@{ant-prefix}-descriptions-row>td {
123
- padding : var(--zaui-space-size-md, 16px) 0;
132
+ .@{ant-prefix}-descriptions-row > th,
133
+ .@{ant-prefix}-descriptions-row > td {
134
+ padding: var(--zaui-space-size-md, 16px) 0;
124
135
  background: #fafafa;
125
136
 
126
137
  &.@{ant-prefix}-descriptions-item {
@@ -133,26 +144,25 @@
133
144
  position: relative;
134
145
 
135
146
  &::before {
136
- position : absolute;
137
- top : 50%;
138
- left : 8px;
139
- width : 4px;
140
- height : 14px;
141
- background : var(--zaui-brand);
147
+ position: absolute;
148
+ top: 50%;
149
+ left: 8px;
150
+ width: 4px;
151
+ height: 14px;
152
+ background: var(--zaui-brand);
142
153
  border-radius: var(--zaui-border-radius-card, 2px);
143
- transform : translateY(-50%);
144
- content : '';
154
+ transform: translateY(-50%);
155
+ content: '';
145
156
  }
146
157
  }
147
158
  }
148
159
 
149
160
  .@{ant-prefix}-descriptions-item-container {
150
-
151
161
  .@{ant-prefix}-descriptions-item-label,
152
162
  .@{ant-prefix}-descriptions-item-content {
153
- color : #0a0a0a !important;
163
+ color: #0a0a0a !important;
154
164
  font-weight: 500 !important;
155
- font-size : var(--zaui-font-size, 14px);
165
+ font-size: var(--zaui-font-size, 14px);
156
166
  }
157
167
  }
158
168
 
@@ -491,8 +491,12 @@ var ProTreeModal = function ProTreeModal(props) {
491
491
  } else {
492
492
  onChange === null || onChange === void 0 ? void 0 : onChange([]);
493
493
  setState({
494
- checkAll: false
494
+ checkAll: false,
495
+ open: true
495
496
  });
497
+ if (appoint) {
498
+ openChange === null || openChange === void 0 ? void 0 : openChange(true);
499
+ }
496
500
  }
497
501
  };
498
502
  /**
@@ -663,7 +663,7 @@
663
663
  width: calc(100% - 18px);
664
664
  margin-bottom: 0;
665
665
  text-align: right;
666
- background: #fff;
666
+ // background: #fff;
667
667
  }
668
668
  }
669
669
  }
@@ -178,7 +178,6 @@ var ProModal = function ProModal(_ref) {
178
178
  footer: renderFooter(),
179
179
  okText: okText,
180
180
  cancelText: cancelText,
181
- centered: true,
182
181
  closeIcon: (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
183
182
  className: "close-icon",
184
183
  src: _close.default
@@ -14,6 +14,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
14
14
  var _ProConfigProvider = require("../../../../ProConfigProvider");
15
15
  var _locale = _interopRequireDefault(require("../../../../locale"));
16
16
  var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
17
+ var _Container = _interopRequireDefault(require("../../Container"));
17
18
  require("./index.less");
18
19
  var _excluded = ["placeholder", "otherProps", "className"];
19
20
  var TextArea = _antd.Input.TextArea;
@@ -24,16 +25,20 @@ var TextAreaDef = function TextAreaDef(props) {
24
25
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
25
26
  var _ref = _ProForm.default.useFieldProps() || {},
26
27
  label = _ref.label,
27
- isViewCon = _ref.isView;
28
+ isViewCon = _ref.isView,
29
+ viewEmpty = _ref.viewEmpty;
28
30
  var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
29
31
  var initialConfig = (0, _ProConfigProvider.useProConfig)('TextArea');
30
- var disabled = (initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.disabled) || rest.disabled;
31
32
  if (isView) {
32
- disabled = true;
33
+ return (0, _jsxRuntime.jsx)(_Container.default, {
34
+ nowrap: false,
35
+ tooltip: true,
36
+ viewEmpty: viewEmpty,
37
+ children: rest.value
38
+ });
33
39
  }
34
40
  var _className = (0, _classnames.default)({
35
41
  'pro-textarea': true,
36
- disabled: disabled,
37
42
  'pro-textarea-view': isView,
38
43
  className: className
39
44
  });
@@ -45,7 +50,6 @@ var TextAreaDef = function TextAreaDef(props) {
45
50
  minRows: 4
46
51
  }
47
52
  }, (0, _lodash.omit)(initialConfig, ['trim'])), rest), {}, {
48
- disabled: disabled,
49
53
  className: _className
50
54
  }));
51
55
  };
@@ -18,11 +18,12 @@ var Container = function Container(props) {
18
18
  var children = props.children,
19
19
  otherProps = props.otherProps,
20
20
  className = props.className,
21
- container = props.container;
21
+ container = props.container,
22
+ show = props.show,
23
+ clearNotShow = props.clearNotShow;
22
24
  var _ref = _ProForm.default.useFieldProps() || {},
23
25
  type = _ref.type,
24
26
  form = _ref.form,
25
- show = _ref.show,
26
27
  required = _ref.required,
27
28
  disabled = _ref.disabled;
28
29
  var _className = (0, _classnames2.default)((0, _defineProperty2.default)({
@@ -32,6 +33,7 @@ var Container = function Container(props) {
32
33
  var _children = (0, _react.useMemo)(function () {
33
34
  var result = children.map(function (item) {
34
35
  return (0, _objectSpread2.default)({
36
+ clearNotShow: clearNotShow,
35
37
  show: show,
36
38
  required: required,
37
39
  disabled: disabled
@@ -7,4 +7,6 @@ export interface ContainerProps {
7
7
  rowProps?: RowProps;
8
8
  className?: string;
9
9
  container?: string | React.ReactNode;
10
+ show?: boolean | (() => boolean);
11
+ clearNotShow?: boolean;
10
12
  }
@@ -3,6 +3,7 @@ import { Moment } from 'moment';
3
3
  import React from 'react';
4
4
  import { ProFormOtherProps } from '../../../propsType';
5
5
  import { Props as ProRangeLimitProps } from '../ProRangeLimit';
6
+ import { DistributiveOmit } from '../../../../ProForm/propsType';
6
7
  export type DateType = DatePickerProps['value'];
7
8
  export type ProTimeLimitProps = DistributiveOmit<DatePickerProps, 'value' | 'onChange' | 'mode'> & {
8
9
  value?: string;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -13,7 +12,7 @@ var _jsxRuntime = require("react/jsx-runtime");
13
12
  var _antd = require("antd");
14
13
  var _classnames = _interopRequireDefault(require("classnames"));
15
14
  var _lodash = require("lodash");
16
- var _moment = _interopRequireWildcard(require("moment"));
15
+ var _moment = _interopRequireDefault(require("moment"));
17
16
  var _react = require("react");
18
17
  var _ProConfigProvider = require("../../../../ProConfigProvider");
19
18
  var _Container = _interopRequireDefault(require("../../Container"));
@@ -56,7 +55,7 @@ var ProTimeLimit = exports.ProTimeLimit = function ProTimeLimit(props) {
56
55
  onChange = _useControlled2[1];
57
56
  var initialConfig = (0, _ProConfigProvider.useProConfig)('ProTimeLimit');
58
57
  var isForever = (0, _react.useMemo)(function () {
59
- if ((0, _moment.isMoment)(value)) {
58
+ if (_moment.default.isMoment(value)) {
60
59
  return foreverMoment.format(format) === value.format(format);
61
60
  }
62
61
  return false;
@@ -173,7 +173,7 @@ var Render = function Render(props) {
173
173
  if (formItemProps.hidden === true || _show === false) {
174
174
  // 为了监听shouldUpdate 必须存在一个FormItem, 空Input解决 【[antd: Form.Item] `name` is only used for validate React element】
175
175
  return (0, _jsxRuntime.jsx)(_antd.Form.Item, {
176
- name: _otherFormItemProps.name,
176
+ name: _otherFormItemProps.name || 'proFormItemHidden',
177
177
  shouldUpdate: _otherFormItemProps.shouldUpdate,
178
178
  className: _className,
179
179
  noStyle: true,
@@ -154,6 +154,11 @@ var RenderFields = function RenderFields(props) {
154
154
  }, _fieldProps), {}, {
155
155
  disabled: _disabled
156
156
  });
157
+ // 容器组件,额外处理show的问题
158
+ if (['ProCollapse', 'Container'].includes(_type)) {
159
+ componentProps.show = show;
160
+ componentProps.clearNotShow = clearNotShow;
161
+ }
157
162
  // switch与SwitchCheckbox单独添加valuePropName
158
163
  if (['Switch', 'SwitchCheckbox'].includes(_type)) {
159
164
  _formItemProps.valuePropName = 'checked';
@@ -32,6 +32,7 @@ import { ProUploadProps } from '../../../ProUpload/propsType';
32
32
  import { ProTreeProps } from '../../../ProTree/propsType';
33
33
  import { GroupProps } from '../combination/Group/propsType';
34
34
  import { ProCollapseProps } from '../../../ProLayout/components/ProCollapse/PropTypes';
35
+ import { DistributiveOmit } from '../../propsType';
35
36
  export type ComponentMap = keyof typeof componentMap;
36
37
  type ValidateKey = keyof typeof validate;
37
38
  type RegExpKey = keyof typeof regExp;
@@ -2,4 +2,5 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+ var a = {};
@@ -73,3 +73,4 @@ export interface Transform<T = any> {
73
73
  getValueProps?: (value: StoreValue) => Record<string, unknown>;
74
74
  shouldUpdate?: ShouldUpdate<T>;
75
75
  }
76
+ export type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
@@ -126,11 +126,12 @@
126
126
  }
127
127
  }
128
128
 
129
- // 比较原始值场景下 不同时候的样式
129
+ // 比较原始值场景下 不同时的样式
130
130
  &.pro-form-item-changed {
131
131
  span.@{ant-prefix}-input-affix-wrapper,
132
132
  .@{ant-prefix}-select-selector,
133
- .@{ant-prefix}-picker {
133
+ .@{ant-prefix}-picker,
134
+ .@{ant-prefix}-input-number {
134
135
  background: @zaui-contract-bg !important;
135
136
 
136
137
  input {
@@ -141,7 +142,9 @@
141
142
  }
142
143
  }
143
144
 
144
- .@{ant-prefix}-form-item-control-input-content > .pro-form-view-container {
145
+ // 查看模式 修改容器样式
146
+ .@{ant-prefix}-form-item-control-input-content > span, // 地址组件
147
+ .pro-form-view-container {
145
148
  padding: 4px 8px;
146
149
  background: @zaui-contract-bg;
147
150
  border-radius: 4px;
@@ -17,7 +17,7 @@ var useChanged = exports.useChanged = function useChanged(_ref) {
17
17
  var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
18
18
  return (0, _lodash.get)(originalValues, name);
19
19
  }) : (0, _lodash.get)(originalValues, name);
20
- var notWatch = !originalValues || originalValue === undefined;
20
+ var notWatch = !equalWith && (!originalValues || originalValue === undefined);
21
21
  if (notWatch) form = [];
22
22
  var value = _antd.Form.useWatch(namesStr || name, form);
23
23
  if (notWatch) return [false];
@@ -38,11 +38,22 @@ var getOriginalValue = function getOriginalValue(_ref) {
38
38
  var originalValueRow = originalValueList.find(function (item) {
39
39
  return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
40
40
  });
41
- var originalValue = (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
42
- return (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
43
- }) : (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
41
+ var originalValue;
42
+ if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
43
+ var originalNamesValue = originalNames.map(function (originalName) {
44
+ return (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
45
+ });
46
+ // 有可能出现数组中全是undefined的情况 视为没有值
47
+ var fillUndefined = originalNamesValue.every(function (valItem) {
48
+ return valItem === undefined;
49
+ });
50
+ originalValue = fillUndefined ? undefined : originalNamesValue;
51
+ } else {
52
+ originalValue = (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
53
+ }
44
54
  return originalValue;
45
55
  }
56
+ // 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
46
57
  return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
47
58
  return (0, _lodash.get)(originalValues, originalName);
48
59
  }) : (0, _lodash.get)(originalValues, originalName);
@@ -59,23 +70,24 @@ var useListChanged = exports.useListChanged = function useListChanged(params) {
59
70
  form = params.form,
60
71
  equalWith = params.equalWith,
61
72
  rowKeyPath = params.rowKeyPath;
62
- // let _form = form;
63
73
  var namePath = toNamePath(namesStr || name);
64
74
  var originalNamePath = toNamePath(originalName);
65
75
  var originalNamePaths = originalNames && toNamePaths(originalNames);
66
- var originalValue = getOriginalValue({
76
+ var notWatch = !originalValues;
77
+ var originalValue = !notWatch ? getOriginalValue({
67
78
  namePath: namePath,
68
79
  originalName: originalNamePath,
69
80
  originalNames: originalNamePaths,
70
81
  originalValues: originalValues,
71
82
  rowKeyPath: rowKeyPath,
72
83
  form: form
73
- });
74
- var notWatch = !originalValues || originalValue === undefined;
84
+ }) : undefined;
85
+ var noChange = !equalWith && (!originalValues || originalValue === undefined);
86
+ var _form = form;
75
87
  // @ts-ignore
76
- // if (notWatch) _form = [];
77
- var value = _antd.Form.useWatch(namePath, form);
78
- if (notWatch) return [false];
88
+ if (notWatch) _form = [];
89
+ var value = _antd.Form.useWatch(namePath, _form);
90
+ if (notWatch || noChange) return [false];
79
91
  var changed = (0, _contrastOriginal.contrastOriginal)({
80
92
  value: value,
81
93
  originalValue: originalValue,
@@ -47,6 +47,7 @@ var ProCollapse = function ProCollapse(props) {
47
47
  if (level === '2') {
48
48
  var level2Panel = (0, _classnames.default)({
49
49
  'pro-collapse-level2-collapse': towCollapse,
50
+ 'pro-collapse-level2-no-collapse': !towCollapse,
50
51
  'pro-collapse-panel': true
51
52
  });
52
53
  var hasCollapse = {};
@@ -18,59 +18,62 @@
18
18
 
19
19
  .@{ant-prefix}-collapse-header {
20
20
  align-items: center !important;
21
- padding : 12px var(--zaui-space-size-md, 16px) !important;
22
- background : var(--zaui-area, #fafafa);
21
+ padding: 12px var(--zaui-space-size-md, 16px) !important;
22
+ background: var(--zaui-area, #fafafa);
23
23
  }
24
24
 
25
25
  .@{ant-prefix}-collapse-header-text {
26
- color : var(--zaui-text, #343434);
26
+ color: var(--zaui-text, #343434);
27
27
  font-weight: 500;
28
- font-size : var(--zaui-font-size-lg, 16px);
28
+ font-size: var(--zaui-font-size-lg, 16px);
29
29
  }
30
30
 
31
31
  .@{ant-prefix}-collapse-expand-icon {
32
32
  color: #c5c7cd;
33
33
  }
34
34
 
35
- &.@{ant-prefix}-collapse-borderless .@{ant-prefix}-collapse-item>.@{ant-prefix}-collapse-content>.@{ant-prefix}-collapse-content-box {
35
+ &.@{ant-prefix}-collapse-borderless
36
+ .@{ant-prefix}-collapse-item
37
+ > .@{ant-prefix}-collapse-content
38
+ > .@{ant-prefix}-collapse-content-box {
36
39
  padding: 0;
37
40
  }
38
41
 
39
42
  .@{ant-prefix}-collapse-content-box {
40
- padding : 0;
43
+ padding: 0;
41
44
  background: var(--zaui-base-bg, #ffffff);
42
45
 
43
46
  .pro-collapse-content {
44
- padding : var(--zaui-space-size-md, 16px);
47
+ padding: var(--zaui-space-size-md, 16px);
45
48
  padding-bottom: 0;
46
- background : var(--zaui-base-bg, #ffffff);
49
+ background: var(--zaui-base-bg, #ffffff);
47
50
  }
48
51
  }
49
52
 
50
53
  &.pro-collapse-level2 {
51
54
  margin-bottom: 0;
52
- background : var(--zaui-base-bg, #ffffff);
55
+ background: var(--zaui-base-bg, #ffffff);
53
56
 
54
57
  .@{ant-prefix}-collapse-header {
55
58
  margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
56
- padding : 0 !important;
57
- background : var(--zaui-base-bg, #ffffff);
59
+ padding: 0 !important;
60
+ background: var(--zaui-base-bg, #ffffff);
58
61
 
59
62
  .@{ant-prefix}-collapse-header-text {
60
- position : relative;
63
+ position: relative;
61
64
  padding-left: var(--zaui-space-size-sm, 8px);
62
- font-size : var(--zaui-font-size, 14px);
65
+ font-size: var(--zaui-font-size, 14px);
63
66
 
64
67
  &::before {
65
- position : absolute;
66
- top : 50%;
67
- left : 0;
68
- width : 4px;
69
- height : 14px;
70
- background : var(--zaui-brand);
68
+ position: absolute;
69
+ top: 50%;
70
+ left: 0;
71
+ width: 4px;
72
+ height: 14px;
73
+ background: var(--zaui-brand);
71
74
  border-radius: var(--zaui-border-radius-card, 2px);
72
- transform : translateY(-50%);
73
- content : '';
75
+ transform: translateY(-50%);
76
+ content: '';
74
77
  }
75
78
  }
76
79
 
@@ -93,9 +96,12 @@
93
96
  padding: 0;
94
97
  }
95
98
 
96
- &.@{ant-prefix}-collapse .@{ant-prefix}-collapse-item-disabled>.@{ant-prefix}-collapse-header,
97
- .@{ant-prefix}-collapse .@{ant-prefix}-collapse-item-disabled>.@{ant-prefix}-collapse-header>.arrow {
98
- color : var(--zaui-text, #343434);
99
+ &.@{ant-prefix}-collapse .@{ant-prefix}-collapse-item-disabled > .@{ant-prefix}-collapse-header,
100
+ .@{ant-prefix}-collapse
101
+ .@{ant-prefix}-collapse-item-disabled
102
+ > .@{ant-prefix}-collapse-header
103
+ > .arrow {
104
+ color: var(--zaui-text, #343434);
99
105
  cursor: default;
100
106
  }
101
107
 
@@ -108,6 +114,12 @@
108
114
  display: block;
109
115
  }
110
116
  }
117
+
118
+ .pro-collapse-level2-no-collapse {
119
+ .@{ant-prefix}-collapse-expand-icon {
120
+ display: none;
121
+ }
122
+ }
111
123
  }
112
124
 
113
125
  .@{ant-prefix}-collapse-extra {
@@ -117,10 +129,9 @@
117
129
  }
118
130
 
119
131
  &.pro-collapse-list {
120
-
121
- .@{ant-prefix}-descriptions-row>th,
122
- .@{ant-prefix}-descriptions-row>td {
123
- padding : var(--zaui-space-size-md, 16px) 0;
132
+ .@{ant-prefix}-descriptions-row > th,
133
+ .@{ant-prefix}-descriptions-row > td {
134
+ padding: var(--zaui-space-size-md, 16px) 0;
124
135
  background: #fafafa;
125
136
 
126
137
  &.@{ant-prefix}-descriptions-item {
@@ -133,26 +144,25 @@
133
144
  position: relative;
134
145
 
135
146
  &::before {
136
- position : absolute;
137
- top : 50%;
138
- left : 8px;
139
- width : 4px;
140
- height : 14px;
141
- background : var(--zaui-brand);
147
+ position: absolute;
148
+ top: 50%;
149
+ left: 8px;
150
+ width: 4px;
151
+ height: 14px;
152
+ background: var(--zaui-brand);
142
153
  border-radius: var(--zaui-border-radius-card, 2px);
143
- transform : translateY(-50%);
144
- content : '';
154
+ transform: translateY(-50%);
155
+ content: '';
145
156
  }
146
157
  }
147
158
  }
148
159
 
149
160
  .@{ant-prefix}-descriptions-item-container {
150
-
151
161
  .@{ant-prefix}-descriptions-item-label,
152
162
  .@{ant-prefix}-descriptions-item-content {
153
- color : #0a0a0a !important;
163
+ color: #0a0a0a !important;
154
164
  font-weight: 500 !important;
155
- font-size : var(--zaui-font-size, 14px);
165
+ font-size: var(--zaui-font-size, 14px);
156
166
  }
157
167
  }
158
168
 
@@ -492,8 +492,12 @@ var ProTreeModal = function ProTreeModal(props) {
492
492
  } else {
493
493
  onChange === null || onChange === void 0 ? void 0 : onChange([]);
494
494
  setState({
495
- checkAll: false
495
+ checkAll: false,
496
+ open: true
496
497
  });
498
+ if (appoint) {
499
+ openChange === null || openChange === void 0 ? void 0 : openChange(true);
500
+ }
497
501
  }
498
502
  };
499
503
  /**
@@ -663,7 +663,7 @@
663
663
  width: calc(100% - 18px);
664
664
  margin-bottom: 0;
665
665
  text-align: right;
666
- background: #fff;
666
+ // background: #fff;
667
667
  }
668
668
  }
669
669
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.3.2",
3
+ "version": "3.3.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -71,7 +71,8 @@
71
71
  "peerDependencies": {
72
72
  "antd": "^4.24.8",
73
73
  "react": "17.x",
74
- "react-dom": "17.x"
74
+ "react-dom": "17.x",
75
+ "react-router-dom": "^5.1.7"
75
76
  },
76
77
  "devDependencies": {
77
78
  "@commitlint/cli": "^12.1.1",