@zat-design/sisyphus-react 3.4.5 → 3.4.6-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 (137) hide show
  1. package/dist/index.esm.css +151 -35
  2. package/dist/less.esm.css +151 -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 +56 -48
  6. package/es/ProEditTable/index.js +3 -3
  7. package/es/ProEditTable/style/index.less +5 -7
  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/base/TextArea/index.d.ts +1 -0
  12. package/es/ProForm/components/base/TextArea/index.js +4 -2
  13. package/es/ProForm/components/combination/Container/index.js +3 -2
  14. package/es/ProForm/components/combination/Container/style/index.less +5 -1
  15. package/es/ProForm/components/combination/FormList/index.js +1 -0
  16. package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
  17. package/es/ProForm/components/combination/ProCascader/index.js +256 -0
  18. package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
  19. package/es/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
  20. package/es/ProForm/components/combination/ProCascader/utils/index.js +26 -0
  21. package/es/ProForm/components/combination/ProModalSelect/index.js +47 -33
  22. package/es/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
  23. package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
  24. package/es/ProForm/components/combination/ProRangeLimit/index.js +17 -10
  25. package/es/ProForm/components/index.d.ts +1 -2
  26. package/es/ProForm/components/index.js +1 -4
  27. package/es/ProForm/components/render/Render.js +25 -20
  28. package/es/ProForm/components/render/RenderFields.js +4 -1
  29. package/es/ProForm/components/render/propsType.d.ts +5 -8
  30. package/es/ProForm/index.js +6 -2
  31. package/es/ProForm/propsType.d.ts +3 -0
  32. package/es/ProForm/style/index.less +2 -1
  33. package/es/ProForm/utils/index.d.ts +6 -1
  34. package/es/ProForm/utils/index.js +9 -6
  35. package/es/ProForm/utils/useChanged.js +1 -2
  36. package/es/ProForm/utils/useForm.js +19 -6
  37. package/es/ProForm/utils/useListChanged.js +1 -3
  38. package/es/ProIcon/config/index.d.ts +2 -0
  39. package/es/ProIcon/config/index.js +4 -2
  40. package/es/ProIcon/index.js +148 -81
  41. package/es/ProIcon/propsTypes.d.ts +6 -1
  42. package/es/ProIcon/utils/index.d.ts +5 -0
  43. package/es/ProIcon/utils/index.js +60 -0
  44. package/es/ProLayout/components/ProCollapse/index.js +6 -3
  45. package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
  46. package/es/ProSelect/index.js +15 -3
  47. package/es/ProSelect/propsType.d.ts +2 -0
  48. package/es/ProSelect/utils/index.d.ts +9 -0
  49. package/es/ProSelect/utils/index.js +60 -0
  50. package/es/ProStep/components/Step/index.js +4 -3
  51. package/es/ProStep/style/index.less +37 -0
  52. package/es/ProTable/utils.js +6 -3
  53. package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  54. package/es/ProThemeTools/component/PrdTools/index.js +16 -6
  55. package/es/ProThemeTools/component/PrdTools/style/index.less +56 -48
  56. package/es/ProTree/components/ProTree.js +96 -74
  57. package/es/ProTree/components/ProTreeSelect/index.js +5 -9
  58. package/es/ProTree/components/ProTreeSelect/style/index.less +6 -8
  59. package/es/ProTree/components/Tree.js +63 -41
  60. package/es/ProTree/style/index.less +38 -16
  61. package/es/ProUpload/index.js +11 -13
  62. package/es/ProUpload/propsType.d.ts +8 -3
  63. package/es/assets/view.svg +2 -2
  64. package/es/global.less +37 -28
  65. package/lib/ProConfigProvider/index.d.ts +2 -2
  66. package/lib/ProConfigProvider/index.js +0 -3
  67. package/lib/ProEditTable/components/RenderField/index.js +54 -46
  68. package/lib/ProEditTable/index.js +3 -3
  69. package/lib/ProEditTable/style/index.less +5 -7
  70. package/lib/ProEditTable/utils/tools.d.ts +12 -0
  71. package/lib/ProEditTable/utils/tools.js +80 -2
  72. package/lib/ProForm/components/base/RangePicker/index.js +9 -9
  73. package/lib/ProForm/components/base/TextArea/index.d.ts +1 -0
  74. package/lib/ProForm/components/base/TextArea/index.js +4 -2
  75. package/lib/ProForm/components/combination/Container/index.js +3 -2
  76. package/lib/ProForm/components/combination/Container/style/index.less +5 -1
  77. package/lib/ProForm/components/combination/FormList/index.js +1 -0
  78. package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
  79. package/lib/ProForm/components/combination/ProCascader/index.js +256 -0
  80. package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
  81. package/lib/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
  82. package/lib/ProForm/components/combination/ProCascader/utils/index.js +33 -0
  83. package/lib/ProForm/components/combination/ProModalSelect/index.js +46 -32
  84. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
  85. package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
  86. package/lib/ProForm/components/combination/ProRangeLimit/index.js +17 -10
  87. package/lib/ProForm/components/index.d.ts +1 -2
  88. package/lib/ProForm/components/index.js +1 -8
  89. package/lib/ProForm/components/render/Render.js +25 -20
  90. package/lib/ProForm/components/render/RenderFields.js +4 -1
  91. package/lib/ProForm/components/render/propsType.d.ts +5 -8
  92. package/lib/ProForm/index.js +5 -1
  93. package/lib/ProForm/propsType.d.ts +3 -0
  94. package/lib/ProForm/style/index.less +2 -1
  95. package/lib/ProForm/utils/index.d.ts +6 -1
  96. package/lib/ProForm/utils/index.js +9 -6
  97. package/lib/ProForm/utils/useChanged.js +1 -2
  98. package/lib/ProForm/utils/useForm.js +19 -6
  99. package/lib/ProForm/utils/useListChanged.js +1 -3
  100. package/lib/ProIcon/config/index.d.ts +2 -0
  101. package/lib/ProIcon/config/index.js +4 -2
  102. package/lib/ProIcon/index.js +144 -77
  103. package/lib/ProIcon/propsTypes.d.ts +6 -1
  104. package/lib/ProIcon/utils/index.d.ts +5 -0
  105. package/lib/ProIcon/utils/index.js +62 -1
  106. package/lib/ProLayout/components/ProCollapse/index.js +6 -3
  107. package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
  108. package/lib/ProSelect/index.js +15 -3
  109. package/lib/ProSelect/propsType.d.ts +2 -0
  110. package/lib/ProSelect/utils/index.d.ts +9 -0
  111. package/lib/ProSelect/utils/index.js +68 -0
  112. package/lib/ProStep/components/Step/index.js +4 -3
  113. package/lib/ProStep/style/index.less +37 -0
  114. package/lib/ProTable/utils.js +6 -3
  115. package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  116. package/lib/ProThemeTools/component/PrdTools/index.js +16 -6
  117. package/lib/ProThemeTools/component/PrdTools/style/index.less +56 -48
  118. package/lib/ProTree/components/ProTree.js +96 -74
  119. package/lib/ProTree/components/ProTreeSelect/index.js +5 -9
  120. package/lib/ProTree/components/ProTreeSelect/style/index.less +6 -8
  121. package/lib/ProTree/components/Tree.js +63 -41
  122. package/lib/ProTree/style/index.less +38 -16
  123. package/lib/ProUpload/index.js +10 -12
  124. package/lib/ProUpload/propsType.d.ts +8 -3
  125. package/lib/assets/view.svg +2 -2
  126. package/lib/global.less +37 -28
  127. package/package.json +2 -2
  128. package/es/ProForm/components/base/ProCascader/index.d.ts +0 -14
  129. package/es/ProForm/components/base/ProCascader/index.js +0 -72
  130. package/es/ProForm/components/combination/ProAddressBar/index.js +0 -437
  131. package/lib/ProForm/components/base/ProCascader/index.d.ts +0 -14
  132. package/lib/ProForm/components/base/ProCascader/index.js +0 -78
  133. package/lib/ProForm/components/combination/ProAddressBar/index.js +0 -437
  134. /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
  135. /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
  136. /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
  137. /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
@@ -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 = useProConfig(),
34
33
  config = _useProConfig.state,
35
34
  dispatch = _useProConfig.dispatch;
36
- var ProForm = config.ProForm;
37
35
  var _useState = 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 = _slicedToArray(_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
  }), _jsx("div", {
168
172
  className: "pro-theme-tools-item",
169
173
  children: _jsxs(_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(_objectSpread(_objectSpread({}, state), {}, {
177
+ zauiFormAlign: e.target.value
178
+ }));
179
+ 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
  }
@@ -5,6 +5,8 @@ import _Input from "antd/es/input";
5
5
  import "antd/es/spin/style";
6
6
  import _Spin from "antd/es/spin";
7
7
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
9
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
8
10
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
9
11
  import _typeof from "@babel/runtime/helpers/esm/typeof";
10
12
  import "antd/es/message/style";
@@ -159,10 +161,7 @@ var ProTree = function ProTree(props) {
159
161
  }
160
162
  }, [dataSource, enumCode]);
161
163
  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 _typeof(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
  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 _typeof(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 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(props, info) {
344
+ var values;
345
+ return _regeneratorRuntime().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 = classNames(_defineProperty({
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: []
@@ -193,12 +193,8 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
193
193
  }
194
194
  }, [enumCode, dataSource]);
195
195
  useDeepCompareEffect(function () {
196
- // code存在,不执行接口请求
197
- if (enumCode) {
198
- return undefined;
199
- }
200
- // dataSource存在不执行接口请求
201
- if (dataSource) {
196
+ // code存在huo dataSource存在,不执行接口请求
197
+ if (enumCode || dataSource) {
202
198
  return undefined;
203
199
  }
204
200
  // disabled 状态时,不查询接口
@@ -411,13 +407,13 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
411
407
  }
412
408
  return result;
413
409
  }
414
- var handleChange = function handleChange(newVal, option) {
410
+ var handleChange = function handleChange(newVal, label, extra) {
415
411
  // newVal回来得一定是label、value
416
412
  var result = newVal;
417
413
  if (props === null || props === void 0 ? void 0 : props.labelInValue) {
418
414
  result = getLabelByValue(selectList, newVal);
419
415
  }
420
- onChange && onChange(result, selectList, null);
416
+ onChange && onChange(result, label, extra);
421
417
  // 重置搜索
422
418
  showSearch && searchTreeEvent('');
423
419
  };
@@ -490,7 +486,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
490
486
  allowClear: allowClear || true,
491
487
  showArrow: true,
492
488
  treeNodeFilterProp: treeNodeFilterProp,
493
- virtual: false
489
+ virtual: true
494
490
  }, selectProps);
495
491
  if (value === null) {
496
492
  delete treeProps.value;
@@ -40,6 +40,12 @@
40
40
  color: red;
41
41
  }
42
42
  }
43
+ // 隐藏单选下拉树后面勾号
44
+ .@{ant-prefix}-select-tree-node-content-wrapper{
45
+ .check-mark-icon{
46
+ display: none;
47
+ }
48
+ }
43
49
  // 单选
44
50
  &.signal-tree{
45
51
  .@{ant-prefix}-select-tree{
@@ -63,14 +69,6 @@
63
69
  display: block;
64
70
  }
65
71
  }
66
- .@{ant-prefix}-select-tree-node-content-wrapper{
67
- background-color: transparent;
68
- &.@{ant-prefix}-select-tree-node-selected{
69
- .check-mark-icon{
70
- display: block;
71
- }
72
- }
73
- }
74
72
  .@{ant-prefix}-select-tree-treenode:hover{
75
73
  background-color: #f5f5f5;
76
74
  }
@@ -3,16 +3,18 @@ import _Tree from "antd/es/tree";
3
3
  import "antd/es/popover/style";
4
4
  import _Popover from "antd/es/popover";
5
5
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
7
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
6
8
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
7
9
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
8
- var _excluded = ["checkedValues", "disabled", "searchStr", "originalTreeData", "showCodeName", "checkStrictly", "flatTreeData", "mode", "fieldNames", "tags", "onCheck", "optionRender", "treeData", "showLine", "switcherIcon", "checkable", "menu", "innerExpandKeys", "selectedKey", "disabledMode"];
10
+ var _excluded = ["checkedValues", "disabled", "searchStr", "originalTreeData", "showCodeName", "checkStrictly", "flatTreeData", "mode", "fieldNames", "tags", "onCheck", "optionRender", "treeData", "showLine", "switcherIcon", "checkable", "menu", "innerExpandKeys", "selectedKey", "disabledMode", "isRadioSelect"];
9
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
12
  /*
11
13
  *@Date: 2023-07-25 13:49:35
12
14
  *@LastEditTime: 2023-07-25 13:49:35
13
15
  *@Author: liudongliang
14
16
  *@Description: 树每行节点渲染组件,复选时阻止点击事件冒泡,只有点击树节点文本会向上触发onSelect事件
15
- */
17
+ */
16
18
  /* eslint-disable no-plusplus */
17
19
  import React, { useEffect, useState } from 'react';
18
20
  import { useSetState } from 'ahooks';
@@ -50,19 +52,22 @@ function List(props) {
50
52
  innerExpandKeys = props.innerExpandKeys,
51
53
  selectedKey = props.selectedKey,
52
54
  disabledMode = props.disabledMode,
55
+ isRadioSelect = props.isRadioSelect,
53
56
  other = _objectWithoutProperties(props, _excluded);
54
57
  var fieldNameLabel = fieldNames.label;
55
58
  var fieldNameValue = fieldNames.value;
56
59
  var _useSetState = useSetState({
57
60
  expandedKeys: [],
58
61
  autoExpandParent: true,
59
- currentClickTreeNode: null
62
+ currentClickTreeNode: null,
63
+ handing: false
60
64
  }),
61
65
  _useSetState2 = _slicedToArray(_useSetState, 2),
62
66
  _useSetState2$ = _useSetState2[0],
63
67
  expandedKeys = _useSetState2$.expandedKeys,
64
68
  autoExpandParent = _useSetState2$.autoExpandParent,
65
69
  currentClickTreeNode = _useSetState2$.currentClickTreeNode,
70
+ handing = _useSetState2$.handing,
66
71
  setState = _useSetState2[1];
67
72
  useEffect(function () {
68
73
  if (searchStr) {
@@ -102,18 +107,44 @@ function List(props) {
102
107
  });
103
108
  }
104
109
  }, [selectedKey]);
105
- var onSelect = function onSelect(value, item) {
106
- var _props$onSelect;
107
- var val = value;
108
- if (value === currentClickTreeNode) {
109
- // 如果当前点击了已经选中节点,那么取消选择
110
- val = '';
111
- }
112
- setState({
113
- currentClickTreeNode: val
114
- });
115
- props === null || props === void 0 ? void 0 : (_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 ? void 0 : _props$onSelect.call(props, val, item);
116
- };
110
+ var onSelect = /*#__PURE__*/function () {
111
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value, item) {
112
+ var _props$onSelect;
113
+ var val;
114
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
115
+ while (1) switch (_context.prev = _context.next) {
116
+ case 0:
117
+ if (!handing) {
118
+ _context.next = 2;
119
+ break;
120
+ }
121
+ return _context.abrupt("return", null);
122
+ case 2:
123
+ val = value;
124
+ if (!isRadioSelect && value === currentClickTreeNode) {
125
+ // 如果当前点击了已经选中节点,那么取消选择
126
+ val = '';
127
+ }
128
+ setState({
129
+ currentClickTreeNode: val,
130
+ handing: true
131
+ });
132
+ _context.next = 7;
133
+ 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);
134
+ case 7:
135
+ setState({
136
+ handing: false
137
+ });
138
+ case 8:
139
+ case "end":
140
+ return _context.stop();
141
+ }
142
+ }, _callee);
143
+ }));
144
+ return function onSelect(_x, _x2) {
145
+ return _ref.apply(this, arguments);
146
+ };
147
+ }();
117
148
  var TreeNodeRow = function TreeNodeRow(props) {
118
149
  var nodeClass = props.nodeClass,
119
150
  item = props.item,
@@ -263,7 +294,6 @@ function List(props) {
263
294
  })]
264
295
  }, onlyKey);
265
296
  };
266
- // const _treeData = useMemo(() => {
267
297
  function fn() {
268
298
  var loop = function loop(data, index) {
269
299
  index++;
@@ -275,33 +305,27 @@ function List(props) {
275
305
  isChecked = true;
276
306
  }
277
307
  var title = showCodeName ? "".concat(item[fieldNameValue], "-").concat(item[fieldNameLabel]) : item[fieldNameLabel];
308
+ var nodeTitle = _jsx(TreeNodeRow, {
309
+ nodeClass: nodeClass,
310
+ item: item,
311
+ index: index,
312
+ title: (item === null || item === void 0 ? void 0 : item.title) || title,
313
+ isChecked: isChecked,
314
+ onlyKey: item[fieldNameValue]
315
+ });
278
316
  if (item[fieldNames.children]) {
279
- return {
280
- title: _jsx(TreeNodeRow, {
281
- nodeClass: nodeClass,
282
- item: item,
283
- index: index,
284
- title: title,
285
- isChecked: isChecked,
286
- onlyKey: item[fieldNameValue]
287
- }),
288
- key: item[fieldNameValue],
317
+ return _objectSpread(_objectSpread({}, item), {}, {
318
+ title: nodeTitle,
319
+ key: (item === null || item === void 0 ? void 0 : item.key) || item[fieldNameValue],
289
320
  children: loop(item[fieldNames.children], index)
290
- };
321
+ });
291
322
  }
292
- return {
293
- title: _jsx(TreeNodeRow, {
294
- nodeClass: nodeClass,
295
- item: item,
296
- index: index,
297
- title: title,
298
- isChecked: isChecked,
299
- onlyKey: item[fieldNameValue]
300
- }),
301
- key: item[fieldNameValue]
302
- };
323
+ return _objectSpread(_objectSpread({}, item), {}, {
324
+ title: nodeTitle,
325
+ key: (item === null || item === void 0 ? void 0 : item.key) || item[fieldNameValue]
326
+ });
303
327
  });
304
- return treeRow; // .filter((item) => item);
328
+ return treeRow;
305
329
  };
306
330
  if ((other === null || other === void 0 ? void 0 : other.mode) === 'view') {
307
331
  return;
@@ -312,8 +336,6 @@ function List(props) {
312
336
  }
313
337
  return loop(newTreeData, -1);
314
338
  }
315
- // return fn();
316
- // }, [searchStr, expandedKeys, showCodeName, originalTreeData, currentClickTreeNode]);
317
339
  var _treeData = fn();
318
340
  var onExpand = function onExpand(newExpandedKeys) {
319
341
  setState({