@zat-design/sisyphus-react 3.4.5 → 3.4.6-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/index.esm.css +140 -35
  2. package/dist/less.esm.css +140 -35
  3. package/es/ProConfigProvider/index.d.ts +2 -2
  4. package/es/ProConfigProvider/index.js +0 -3
  5. package/es/ProEditTable/components/RenderField/index.js +55 -48
  6. package/es/ProEditTable/index.js +3 -3
  7. package/es/ProEditTable/style/index.less +0 -5
  8. package/es/ProEditTable/utils/tools.d.ts +12 -0
  9. package/es/ProEditTable/utils/tools.js +79 -2
  10. package/es/ProForm/components/base/RangePicker/index.js +9 -9
  11. package/es/ProForm/components/combination/Container/index.js +3 -2
  12. package/es/ProForm/components/combination/Container/style/index.less +5 -1
  13. package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
  14. package/es/ProForm/components/combination/ProCascader/index.js +256 -0
  15. package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
  16. package/es/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
  17. package/es/ProForm/components/combination/ProCascader/utils/index.js +26 -0
  18. package/es/ProForm/components/combination/ProModalSelect/index.js +13 -5
  19. package/es/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
  20. package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
  21. package/es/ProForm/components/combination/ProRangeLimit/index.js +17 -10
  22. package/es/ProForm/components/index.d.ts +1 -2
  23. package/es/ProForm/components/index.js +1 -4
  24. package/es/ProForm/components/render/Render.js +18 -13
  25. package/es/ProForm/components/render/RenderFields.js +3 -1
  26. package/es/ProForm/components/render/propsType.d.ts +3 -7
  27. package/es/ProForm/index.js +6 -2
  28. package/es/ProForm/propsType.d.ts +2 -0
  29. package/es/ProForm/style/index.less +2 -1
  30. package/es/ProForm/utils/index.js +4 -1
  31. package/es/ProForm/utils/useChanged.js +1 -2
  32. package/es/ProForm/utils/useForm.js +18 -6
  33. package/es/ProForm/utils/useListChanged.js +1 -3
  34. package/es/ProIcon/config/index.d.ts +2 -0
  35. package/es/ProIcon/config/index.js +4 -2
  36. package/es/ProIcon/index.js +148 -81
  37. package/es/ProIcon/propsTypes.d.ts +6 -1
  38. package/es/ProIcon/utils/index.d.ts +5 -0
  39. package/es/ProIcon/utils/index.js +60 -0
  40. package/es/ProLayout/components/ProCollapse/index.js +6 -3
  41. package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
  42. package/es/ProSelect/index.js +1 -1
  43. package/es/ProStep/components/Step/index.js +4 -3
  44. package/es/ProStep/style/index.less +37 -0
  45. package/es/ProTable/utils.js +6 -3
  46. package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  47. package/es/ProThemeTools/component/PrdTools/index.js +16 -6
  48. package/es/ProThemeTools/component/PrdTools/style/index.less +56 -48
  49. package/es/ProTree/components/ProTree.js +96 -74
  50. package/es/ProTree/components/ProTreeSelect/index.js +3 -7
  51. package/es/ProTree/components/Tree.js +63 -41
  52. package/es/ProTree/style/index.less +24 -17
  53. package/es/ProUpload/index.js +11 -13
  54. package/es/ProUpload/propsType.d.ts +8 -3
  55. package/es/assets/view.svg +2 -2
  56. package/es/global.less +6 -6
  57. package/lib/ProConfigProvider/index.d.ts +2 -2
  58. package/lib/ProConfigProvider/index.js +0 -3
  59. package/lib/ProEditTable/components/RenderField/index.js +53 -46
  60. package/lib/ProEditTable/index.js +3 -3
  61. package/lib/ProEditTable/style/index.less +0 -5
  62. package/lib/ProEditTable/utils/tools.d.ts +12 -0
  63. package/lib/ProEditTable/utils/tools.js +80 -2
  64. package/lib/ProForm/components/base/RangePicker/index.js +9 -9
  65. package/lib/ProForm/components/combination/Container/index.js +3 -2
  66. package/lib/ProForm/components/combination/Container/style/index.less +5 -1
  67. package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
  68. package/lib/ProForm/components/combination/ProCascader/index.js +256 -0
  69. package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
  70. package/lib/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
  71. package/lib/ProForm/components/combination/ProCascader/utils/index.js +33 -0
  72. package/lib/ProForm/components/combination/ProModalSelect/index.js +12 -4
  73. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
  74. package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
  75. package/lib/ProForm/components/combination/ProRangeLimit/index.js +17 -10
  76. package/lib/ProForm/components/index.d.ts +1 -2
  77. package/lib/ProForm/components/index.js +1 -8
  78. package/lib/ProForm/components/render/Render.js +18 -13
  79. package/lib/ProForm/components/render/RenderFields.js +3 -1
  80. package/lib/ProForm/components/render/propsType.d.ts +3 -7
  81. package/lib/ProForm/index.js +5 -1
  82. package/lib/ProForm/propsType.d.ts +2 -0
  83. package/lib/ProForm/style/index.less +2 -1
  84. package/lib/ProForm/utils/index.js +4 -1
  85. package/lib/ProForm/utils/useChanged.js +1 -2
  86. package/lib/ProForm/utils/useForm.js +18 -6
  87. package/lib/ProForm/utils/useListChanged.js +1 -3
  88. package/lib/ProIcon/config/index.d.ts +2 -0
  89. package/lib/ProIcon/config/index.js +4 -2
  90. package/lib/ProIcon/index.js +144 -77
  91. package/lib/ProIcon/propsTypes.d.ts +6 -1
  92. package/lib/ProIcon/utils/index.d.ts +5 -0
  93. package/lib/ProIcon/utils/index.js +62 -1
  94. package/lib/ProLayout/components/ProCollapse/index.js +6 -3
  95. package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
  96. package/lib/ProSelect/index.js +1 -1
  97. package/lib/ProStep/components/Step/index.js +4 -3
  98. package/lib/ProStep/style/index.less +37 -0
  99. package/lib/ProTable/utils.js +6 -3
  100. package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  101. package/lib/ProThemeTools/component/PrdTools/index.js +16 -6
  102. package/lib/ProThemeTools/component/PrdTools/style/index.less +56 -48
  103. package/lib/ProTree/components/ProTree.js +96 -74
  104. package/lib/ProTree/components/ProTreeSelect/index.js +3 -7
  105. package/lib/ProTree/components/Tree.js +63 -41
  106. package/lib/ProTree/style/index.less +24 -17
  107. package/lib/ProUpload/index.js +10 -12
  108. package/lib/ProUpload/propsType.d.ts +8 -3
  109. package/lib/assets/view.svg +2 -2
  110. package/lib/global.less +6 -6
  111. package/package.json +2 -2
  112. package/es/ProForm/components/base/ProCascader/index.d.ts +0 -14
  113. package/es/ProForm/components/base/ProCascader/index.js +0 -72
  114. package/es/ProForm/components/combination/ProAddressBar/index.js +0 -437
  115. package/lib/ProForm/components/base/ProCascader/index.d.ts +0 -14
  116. package/lib/ProForm/components/base/ProCascader/index.js +0 -78
  117. package/lib/ProForm/components/combination/ProAddressBar/index.js +0 -437
  118. /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
  119. /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
  120. /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
  121. /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
@@ -276,19 +276,22 @@ var formatColumn = exports.formatColumn = function formatColumn(column, original
276
276
  'varied-cell': originalValue !== undefined,
277
277
  'empty-cell': isEmpty
278
278
  });
279
- var renderValue = (0, _jsxRuntime.jsx)(_ProForm.default.ProAddressBar, {
279
+ var renderValue = (0, _jsxRuntime.jsx)(_ProForm.default.ProCascader, {
280
280
  isView: true,
281
+ mode: "address",
281
282
  code: code,
282
283
  value: realValue
283
284
  });
284
- var originalRenderValue = (0, _jsxRuntime.jsx)(_ProForm.default.ProAddressBar, {
285
+ var originalRenderValue = (0, _jsxRuntime.jsx)(_ProForm.default.ProCascader, {
285
286
  isView: true,
287
+ mode: "address",
286
288
  code: code,
287
289
  value: originalRealValue
288
290
  });
289
- return (0, _jsxRuntime.jsx)(_ProForm.default.ProAddressBar, {
291
+ return (0, _jsxRuntime.jsx)(_ProForm.default.ProCascader, {
290
292
  className: className,
291
293
  isView: true,
294
+ mode: "address",
292
295
  code: code,
293
296
  value: realValue,
294
297
  tooltip: originalValue !== undefined ? (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -1,3 +1,3 @@
1
1
  import type { DevToolsPropsType } from '../../propsType';
2
- declare const PrdTools: ({ onReset, onClose, setState, open, state, tableBorder, tableStripe, prefixCls, }: DevToolsPropsType) => JSX.Element;
2
+ declare const PrdTools: ({ onReset, onClose, setState, open, state, tableBorder, tableStripe, }: DevToolsPropsType) => JSX.Element;
3
3
  export default PrdTools;
@@ -28,12 +28,10 @@ var PrdTools = function PrdTools(_ref) {
28
28
  open = _ref.open,
29
29
  state = _ref.state,
30
30
  tableBorder = _ref.tableBorder,
31
- tableStripe = _ref.tableStripe,
32
- prefixCls = _ref.prefixCls;
31
+ tableStripe = _ref.tableStripe;
33
32
  var _useProConfig = (0, _ProConfigProvider.useProConfig)(),
34
33
  config = _useProConfig.state,
35
34
  dispatch = _useProConfig.dispatch;
36
- var ProForm = config.ProForm;
37
35
  var _useState = (0, _react.useState)([{
38
36
  color: '#006AFF',
39
37
  active: true
@@ -46,6 +44,9 @@ var PrdTools = function PrdTools(_ref) {
46
44
  }, {
47
45
  color: '#A00F20',
48
46
  active: false
47
+ }, {
48
+ color: '#31AF96',
49
+ active: false
49
50
  }]),
50
51
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
51
52
  active = _useState2[0],
@@ -57,6 +58,7 @@ var PrdTools = function PrdTools(_ref) {
57
58
  _ref2$zauiBrand = _ref2.zauiBrand,
58
59
  zauiBrand = _ref2$zauiBrand === void 0 ? '#006AFF' : _ref2$zauiBrand;
59
60
  if (zauiBrand) {
61
+ var _config$theme;
60
62
  var newArray = active.map(function (activeItem) {
61
63
  activeItem.active = false;
62
64
  return {
@@ -69,7 +71,8 @@ var PrdTools = function PrdTools(_ref) {
69
71
  type: 'set',
70
72
  payload: {
71
73
  theme: {
72
- primaryColor: zauiBrand
74
+ primaryColor: zauiBrand,
75
+ qiankunPrimaryColor: config === null || config === void 0 ? void 0 : (_config$theme = config.theme) === null || _config$theme === void 0 ? void 0 : _config$theme.qiankunPrimaryColor
73
76
  }
74
77
  }
75
78
  });
@@ -117,7 +120,8 @@ var PrdTools = function PrdTools(_ref) {
117
120
  type: 'set',
118
121
  payload: {
119
122
  theme: {
120
- primaryColor: item.color
123
+ primaryColor: item.color,
124
+ qiankunPrimaryColor: item.color
121
125
  }
122
126
  }
123
127
  });
@@ -167,8 +171,14 @@ var PrdTools = function PrdTools(_ref) {
167
171
  }), (0, _jsxRuntime.jsx)("div", {
168
172
  className: "pro-theme-tools-item",
169
173
  children: (0, _jsxRuntime.jsxs)(_antd.Radio.Group, {
170
- value: ProForm === null || ProForm === void 0 ? void 0 : ProForm.labelAlign,
174
+ value: state.zauiFormAlign,
171
175
  onChange: function onChange(e) {
176
+ setState((0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
177
+ zauiFormAlign: e.target.value
178
+ }));
179
+ (0, _index.setThemes)({
180
+ 'zaui-form-align': e.target.value
181
+ });
172
182
  dispatch({
173
183
  type: 'setWithLocal',
174
184
  payload: {
@@ -16,20 +16,20 @@
16
16
  }
17
17
 
18
18
  p {
19
- padding-left : 12px;
20
- position : relative;
19
+ position: relative;
21
20
  margin-bottom: var(--zaui-space-size-md, 16px);
22
- font-size : var(--zaui-font-size, 14px);
21
+ padding-left: 12px;
22
+ font-size: var(--zaui-font-size, 14px);
23
23
 
24
24
  &:before {
25
- content : '';
26
- position : absolute;
27
- left : 0;
28
- top : 4px;
29
- width : 4px;
30
- height : 14px;
31
- background : var(--zaui-brand, #006aff);
25
+ position: absolute;
26
+ top: 4px;
27
+ left: 0;
28
+ width: 4px;
29
+ height: 14px;
30
+ background: var(--zaui-brand, #006aff);
32
31
  border-radius: var(zaui-border-radius-card, 4px);
32
+ content: '';
33
33
  }
34
34
  }
35
35
 
@@ -37,19 +37,19 @@
37
37
  display: flex;
38
38
 
39
39
  li {
40
- width : 38px;
41
- height : 38px;
42
- border-radius : 50%;
43
- background : #fff;
44
- display : flex;
40
+ display: flex;
41
+ align-items: center;
45
42
  justify-content: center;
46
- align-items : center;
47
- border : 6px solid #fff;
48
- color : #fff;
49
- margin-right : 34px;
43
+ width: 38px;
44
+ height: 38px;
45
+ margin-right: 34px;
46
+ color: #fff;
47
+ background: #fff;
48
+ border: 6px solid #fff;
49
+ border-radius: 50%;
50
50
 
51
51
  span {
52
- font-size : var(--zaui-font-size, 14px);
52
+ font-size: var(--zaui-font-size, 14px);
53
53
  vertical-align: -7px;
54
54
  }
55
55
 
@@ -81,8 +81,16 @@
81
81
  }
82
82
 
83
83
  &:nth-child(4) {
84
+ background: #a00f20;
85
+
86
+ &.active,
87
+ &:hover {
88
+ border-color: #f2dbdb;
89
+ }
90
+ }
91
+ &:nth-child(5) {
84
92
  margin-right: 0;
85
- background : #a00f20;
93
+ background: #31af96;
86
94
 
87
95
  &.active,
88
96
  &:hover {
@@ -98,16 +106,16 @@
98
106
 
99
107
  .copy-btn {
100
108
  position: absolute;
101
- width : calc(100% - 64px);
102
- bottom : 20px;
103
- left : 32px;
104
- z-index : 10;
109
+ bottom: 20px;
110
+ left: 32px;
111
+ z-index: 10;
112
+ width: calc(100% - 64px);
105
113
  }
106
114
 
107
115
  .pro-theme-tools-box {
108
- display : flex;
116
+ display: flex;
117
+ flex-wrap: wrap;
109
118
  justify-content: space-between;
110
- flex-wrap : wrap;
111
119
  }
112
120
 
113
121
  .pro-theme-tools-space {
@@ -129,22 +137,22 @@
129
137
  }
130
138
 
131
139
  .pro-drawer-close {
132
- position : absolute;
133
- top : 6px;
134
- left : -37px;
135
- display : flex;
136
- align-items : center;
140
+ position: absolute;
141
+ top: 6px;
142
+ left: -37px;
143
+ display: flex;
144
+ align-items: center;
137
145
  justify-content: center;
138
- width : 32px;
139
- height : 38px;
140
- color : #fff;
141
- cursor : pointer;
146
+ width: 32px;
147
+ height: 38px;
148
+ color: #fff;
149
+ cursor: pointer;
142
150
 
143
151
  .close-icon {
144
- position : relative;
145
- left : 4px;
146
- z-index : 1;
147
- color : var(--zaui-text, #343434);
152
+ position: relative;
153
+ left: 4px;
154
+ z-index: 1;
155
+ color: var(--zaui-text, #343434);
148
156
  font-size: var(--zaui-font-size-lg, 16px);
149
157
  transform: translateZ(100px);
150
158
 
@@ -155,14 +163,14 @@
155
163
  }
156
164
 
157
165
  .pro-drawer-close::after {
158
- position : absolute;
159
- top : 0;
160
- right : 0;
161
- bottom : 0;
162
- left : 0;
166
+ position: absolute;
167
+ top: 0;
168
+ right: 0;
169
+ bottom: 0;
170
+ left: 0;
163
171
  background-color: #fff;
164
- border-radius : 4px 0px 0px 4px;
165
- transform : perspective(0.15em) rotateY(-2deg);
166
- content : '';
172
+ border-radius: 4px 0px 0px 4px;
173
+ transform: perspective(0.15em) rotateY(-2deg);
174
+ content: '';
167
175
  }
168
176
  }
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
9
11
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
13
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
@@ -159,10 +161,7 @@ var ProTree = function ProTree(props) {
159
161
  }
160
162
  }, [dataSource, enumCode]);
161
163
  (0, _ahooks.useDeepCompareEffect)(function () {
162
- if (enumCode) {
163
- return undefined;
164
- }
165
- if (dataSource) {
164
+ if (enumCode || dataSource) {
166
165
  return undefined;
167
166
  }
168
167
  var _ref = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
@@ -174,56 +173,60 @@ var ProTree = function ProTree(props) {
174
173
  // 执行用户配置的枚举服务,拉取枚举数据进行更新
175
174
  fetchFunction.run(defaultParams);
176
175
  }, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
176
+ var handleSignalSelect = function handleSignalSelect(value) {
177
+ var checkedValues = [];
178
+ var innerVal = value;
179
+ if (labelInValue) {
180
+ checkedValues = innerVal[fieldNameValue];
181
+ } else {
182
+ // 单选值场景为string走到这里
183
+ checkedValues = innerVal;
184
+ }
185
+ setState({
186
+ checkedValues: checkedValues
187
+ });
188
+ };
189
+ var handleCheckSelect = function handleCheckSelect(allKeys) {
190
+ var checkedValues = [];
191
+ if (allValue && typeof value === 'string') {
192
+ // 如果value等于allValue那么全选中,否则选中value得值
193
+ if (value === allValue) {
194
+ checkedValues = allKeys;
195
+ } else {
196
+ checkedValues = [value];
197
+ }
198
+ } else {
199
+ var innerVal = value;
200
+ // 开启 labelInValue [{ label:xx, value: ""}] 形式、需要取出来 value
201
+ if (labelInValue) {
202
+ var isObjectArray = innerVal && innerVal.every(function (element) {
203
+ return (0, _typeof2.default)(element) === 'object' && element !== null;
204
+ });
205
+ if (!isObjectArray) {
206
+ console.error('Please enter an array object');
207
+ }
208
+ checkedValues = innerVal && innerVal.map(function (item) {
209
+ return item[fieldNameValue];
210
+ });
211
+ } else {
212
+ // 复选,单纯value数组场景
213
+ checkedValues = innerVal;
214
+ }
215
+ }
216
+ setState({
217
+ checkedValues: checkedValues,
218
+ checkAll: checkedValues.length === allKeys.length
219
+ });
220
+ };
177
221
  (0, _react.useEffect)(function () {
178
222
  if (value) {
179
- var checkedValues = [];
180
223
  var allKeys = state.allKeys;
181
224
  if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
182
225
  // 单选
183
- var innerVal = value;
184
- if (labelInValue) {
185
- checkedValues = innerVal[fieldNameValue];
186
- } else {
187
- // 单选值场景为string走到这里
188
- checkedValues = innerVal;
189
- }
190
- setState({
191
- checkedValues: checkedValues
192
- });
226
+ handleSignalSelect(value);
193
227
  } else {
194
228
  // 复选
195
- if (allValue && typeof value === 'string') {
196
- // 如果value等于allValue那么全选中,否则选中value得值
197
- if (value === allValue) {
198
- checkedValues = allKeys;
199
- } else {
200
- checkedValues = [value];
201
- }
202
- } else {
203
- var _innerVal = value;
204
- // 开启 labelInValue [{ label:xx, value: ""}] 形式、需要取出来 value
205
- if (labelInValue) {
206
- var isObjectArray = _innerVal && _innerVal.every(function (element) {
207
- return (0, _typeof2.default)(element) === 'object' && element !== null;
208
- });
209
- if (!isObjectArray) {
210
- console.error('Please enter an array object');
211
- checkedValues = [];
212
- }
213
- checkedValues = _innerVal && _innerVal.map(function (item) {
214
- return item[fieldNameValue];
215
- });
216
- } else {
217
- // 复选,单纯value数组场景
218
- checkedValues = _innerVal;
219
- }
220
- }
221
- // treeViewData = filterCheckedNodes(originalTreeData, checkedValues, '', fieldNames);
222
- setState({
223
- checkedValues: checkedValues,
224
- checkAll: checkedValues.length === allKeys.length
225
- // treeViewData,
226
- });
229
+ handleCheckSelect(allKeys);
227
230
  }
228
231
  } else if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
229
232
  // 单选--场景-->如果表单的value没有值,那么配置的selectedKey就起作用了,选中树节点
@@ -336,39 +339,58 @@ var ProTree = function ProTree(props) {
336
339
  handleFinish(allValue, checked, checkedValues);
337
340
  };
338
341
  /** 点击了树节点开始loading,改变自身state并将值通过onchange上传到form */
339
- var onSelectTreeNode = function onSelectTreeNode(props, info) {
340
- if (disabled || isView) {
341
- return null;
342
- }
343
- setState({
344
- clickShowLoading: loading
345
- });
346
- if (onSelect) {
347
- var _onSelect;
348
- (_onSelect = onSelect(props, info)) === null || _onSelect === void 0 ? void 0 : _onSelect.then(function () {
349
- setState({
350
- clickShowLoading: false
351
- });
352
- });
353
- }
354
- if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
355
- // 单选将选中节点值冒泡到form
356
- var values = props;
357
- if (labelInValue) {
358
- values = state.flatTreeData.filter(function (item) {
359
- return values === item[fieldNameValue];
360
- });
361
- }
362
- onChange && onChange(values);
363
- }
364
- };
342
+ var onSelectTreeNode = /*#__PURE__*/function () {
343
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(props, info) {
344
+ var values;
345
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
346
+ while (1) switch (_context.prev = _context.next) {
347
+ case 0:
348
+ if (!(disabled || isView)) {
349
+ _context.next = 2;
350
+ break;
351
+ }
352
+ return _context.abrupt("return", null);
353
+ case 2:
354
+ setState({
355
+ clickShowLoading: loading
356
+ });
357
+ if (!onSelect) {
358
+ _context.next = 7;
359
+ break;
360
+ }
361
+ _context.next = 6;
362
+ return onSelect(props, info);
363
+ case 6:
364
+ setState({
365
+ clickShowLoading: false
366
+ });
367
+ case 7:
368
+ if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
369
+ // 单选将选中节点值冒泡到form
370
+ values = props;
371
+ if (labelInValue) {
372
+ values = state.flatTreeData.filter(function (item) {
373
+ return values === item[fieldNameValue];
374
+ });
375
+ }
376
+ onChange && onChange(values);
377
+ }
378
+ case 8:
379
+ case "end":
380
+ return _context.stop();
381
+ }
382
+ }, _callee);
383
+ }));
384
+ return function onSelectTreeNode(_x, _x2) {
385
+ return _ref2.apply(this, arguments);
386
+ };
387
+ }();
365
388
  var boxClass = (0, _classnames.default)((0, _defineProperty2.default)({
366
389
  'pro-tree': true,
367
390
  'footer-shadow': footer
368
391
  }, className, className));
369
392
  var toggleExpand = function toggleExpand() {
370
393
  var _state$innerExpandKey;
371
- // expandedKeys
372
394
  if (state === null || state === void 0 ? void 0 : (_state$innerExpandKey = state.innerExpandKeys) === null || _state$innerExpandKey === void 0 ? void 0 : _state$innerExpandKey.length) {
373
395
  setState({
374
396
  innerExpandKeys: []
@@ -195,12 +195,8 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
195
195
  }
196
196
  }, [enumCode, dataSource]);
197
197
  (0, _ahooks.useDeepCompareEffect)(function () {
198
- // code存在,不执行接口请求
199
- if (enumCode) {
200
- return undefined;
201
- }
202
- // dataSource存在不执行接口请求
203
- if (dataSource) {
198
+ // code存在huo dataSource存在,不执行接口请求
199
+ if (enumCode || dataSource) {
204
200
  return undefined;
205
201
  }
206
202
  // disabled 状态时,不查询接口
@@ -413,7 +409,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
413
409
  }
414
410
  return result;
415
411
  }
416
- var handleChange = function handleChange(newVal, option) {
412
+ var handleChange = function handleChange(newVal) {
417
413
  // newVal回来得一定是label、value
418
414
  var result = newVal;
419
415
  if (props === null || props === void 0 ? void 0 : props.labelInValue) {
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
13
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
14
  var _jsxRuntime = require("react/jsx-runtime");
@@ -17,13 +19,13 @@ var _icons = require("@ant-design/icons");
17
19
  var _SearchTitle = _interopRequireDefault(require("./SearchTitle"));
18
20
  var _utils = require("../utils");
19
21
  var _locale = _interopRequireDefault(require("../../locale"));
20
- var _excluded = ["checkedValues", "disabled", "searchStr", "originalTreeData", "showCodeName", "checkStrictly", "flatTreeData", "mode", "fieldNames", "tags", "onCheck", "optionRender", "treeData", "showLine", "switcherIcon", "checkable", "menu", "innerExpandKeys", "selectedKey", "disabledMode"];
22
+ var _excluded = ["checkedValues", "disabled", "searchStr", "originalTreeData", "showCodeName", "checkStrictly", "flatTreeData", "mode", "fieldNames", "tags", "onCheck", "optionRender", "treeData", "showLine", "switcherIcon", "checkable", "menu", "innerExpandKeys", "selectedKey", "disabledMode", "isRadioSelect"];
21
23
  /*
22
24
  *@Date: 2023-07-25 13:49:35
23
25
  *@LastEditTime: 2023-07-25 13:49:35
24
26
  *@Author: liudongliang
25
27
  *@Description: 树每行节点渲染组件,复选时阻止点击事件冒泡,只有点击树节点文本会向上触发onSelect事件
26
- */
28
+ */
27
29
  /* eslint-disable no-plusplus */
28
30
  var tagsBgColors = ['rgba(0, 106, 255,0.16)', 'rgba(0, 196, 74,0.16)', 'rgba(255, 140, 0,0.16)', 'rgba(255, 80, 80,0.16)', 'rgba(97, 97, 97, 0.16)'];
29
31
  var tagsColors = ['#006AFF', '#00C44A', '#FF8C00', '#FF5050', '#616161'];
@@ -55,19 +57,22 @@ function List(props) {
55
57
  innerExpandKeys = props.innerExpandKeys,
56
58
  selectedKey = props.selectedKey,
57
59
  disabledMode = props.disabledMode,
60
+ isRadioSelect = props.isRadioSelect,
58
61
  other = (0, _objectWithoutProperties2.default)(props, _excluded);
59
62
  var fieldNameLabel = fieldNames.label;
60
63
  var fieldNameValue = fieldNames.value;
61
64
  var _useSetState = (0, _ahooks.useSetState)({
62
65
  expandedKeys: [],
63
66
  autoExpandParent: true,
64
- currentClickTreeNode: null
67
+ currentClickTreeNode: null,
68
+ handing: false
65
69
  }),
66
70
  _useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
67
71
  _useSetState2$ = _useSetState2[0],
68
72
  expandedKeys = _useSetState2$.expandedKeys,
69
73
  autoExpandParent = _useSetState2$.autoExpandParent,
70
74
  currentClickTreeNode = _useSetState2$.currentClickTreeNode,
75
+ handing = _useSetState2$.handing,
71
76
  setState = _useSetState2[1];
72
77
  (0, _react.useEffect)(function () {
73
78
  if (searchStr) {
@@ -107,18 +112,44 @@ function List(props) {
107
112
  });
108
113
  }
109
114
  }, [selectedKey]);
110
- var onSelect = function onSelect(value, item) {
111
- var _props$onSelect;
112
- var val = value;
113
- if (value === currentClickTreeNode) {
114
- // 如果当前点击了已经选中节点,那么取消选择
115
- val = '';
116
- }
117
- setState({
118
- currentClickTreeNode: val
119
- });
120
- props === null || props === void 0 ? void 0 : (_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 ? void 0 : _props$onSelect.call(props, val, item);
121
- };
115
+ var onSelect = /*#__PURE__*/function () {
116
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(value, item) {
117
+ var _props$onSelect;
118
+ var val;
119
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
120
+ while (1) switch (_context.prev = _context.next) {
121
+ case 0:
122
+ if (!handing) {
123
+ _context.next = 2;
124
+ break;
125
+ }
126
+ return _context.abrupt("return", null);
127
+ case 2:
128
+ val = value;
129
+ if (!isRadioSelect && value === currentClickTreeNode) {
130
+ // 如果当前点击了已经选中节点,那么取消选择
131
+ val = '';
132
+ }
133
+ setState({
134
+ currentClickTreeNode: val,
135
+ handing: true
136
+ });
137
+ _context.next = 7;
138
+ return props === null || props === void 0 ? void 0 : (_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 ? void 0 : _props$onSelect.call(props, val, item);
139
+ case 7:
140
+ setState({
141
+ handing: false
142
+ });
143
+ case 8:
144
+ case "end":
145
+ return _context.stop();
146
+ }
147
+ }, _callee);
148
+ }));
149
+ return function onSelect(_x, _x2) {
150
+ return _ref.apply(this, arguments);
151
+ };
152
+ }();
122
153
  var TreeNodeRow = function TreeNodeRow(props) {
123
154
  var nodeClass = props.nodeClass,
124
155
  item = props.item,
@@ -268,7 +299,6 @@ function List(props) {
268
299
  })]
269
300
  }, onlyKey);
270
301
  };
271
- // const _treeData = useMemo(() => {
272
302
  function fn() {
273
303
  var loop = function loop(data, index) {
274
304
  index++;
@@ -280,33 +310,27 @@ function List(props) {
280
310
  isChecked = true;
281
311
  }
282
312
  var title = showCodeName ? "".concat(item[fieldNameValue], "-").concat(item[fieldNameLabel]) : item[fieldNameLabel];
313
+ var nodeTitle = (0, _jsxRuntime.jsx)(TreeNodeRow, {
314
+ nodeClass: nodeClass,
315
+ item: item,
316
+ index: index,
317
+ title: (item === null || item === void 0 ? void 0 : item.title) || title,
318
+ isChecked: isChecked,
319
+ onlyKey: item[fieldNameValue]
320
+ });
283
321
  if (item[fieldNames.children]) {
284
- return {
285
- title: (0, _jsxRuntime.jsx)(TreeNodeRow, {
286
- nodeClass: nodeClass,
287
- item: item,
288
- index: index,
289
- title: title,
290
- isChecked: isChecked,
291
- onlyKey: item[fieldNameValue]
292
- }),
293
- key: item[fieldNameValue],
322
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
323
+ title: nodeTitle,
324
+ key: (item === null || item === void 0 ? void 0 : item.key) || item[fieldNameValue],
294
325
  children: loop(item[fieldNames.children], index)
295
- };
326
+ });
296
327
  }
297
- return {
298
- title: (0, _jsxRuntime.jsx)(TreeNodeRow, {
299
- nodeClass: nodeClass,
300
- item: item,
301
- index: index,
302
- title: title,
303
- isChecked: isChecked,
304
- onlyKey: item[fieldNameValue]
305
- }),
306
- key: item[fieldNameValue]
307
- };
328
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
329
+ title: nodeTitle,
330
+ key: (item === null || item === void 0 ? void 0 : item.key) || item[fieldNameValue]
331
+ });
308
332
  });
309
- return treeRow; // .filter((item) => item);
333
+ return treeRow;
310
334
  };
311
335
  if ((other === null || other === void 0 ? void 0 : other.mode) === 'view') {
312
336
  return;
@@ -317,8 +341,6 @@ function List(props) {
317
341
  }
318
342
  return loop(newTreeData, -1);
319
343
  }
320
- // return fn();
321
- // }, [searchStr, expandedKeys, showCodeName, originalTreeData, currentClickTreeNode]);
322
344
  var _treeData = fn();
323
345
  var onExpand = function onExpand(newExpandedKeys) {
324
346
  setState({