@cloudbase/weda-ui 3.9.7 → 3.10.0

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 (205) hide show
  1. package/dist/configs/components/dataView.d.ts +31 -0
  2. package/dist/configs/components/dataView.js +53 -16
  3. package/dist/configs/components/grid/col.d.ts +1 -1
  4. package/dist/configs/components/grid/col.js +1 -1
  5. package/dist/configs/components/grid/grid.d.ts +1 -1
  6. package/dist/configs/components/grid/grid.js +1 -1
  7. package/dist/configs/components/grid/row.d.ts +1 -1
  8. package/dist/configs/components/grid/row.js +1 -1
  9. package/dist/configs/components/listView.d.ts +148 -444
  10. package/dist/configs/components/listView.js +991 -703
  11. package/dist/configs/components/wd-bubble.d.ts +6 -6
  12. package/dist/configs/components/wd-cascader.d.ts +1 -1
  13. package/dist/configs/components/wd-checkbox.d.ts +1 -1
  14. package/dist/configs/components/wd-code-editor.d.ts +1 -1
  15. package/dist/configs/components/wd-date-range.d.ts +1 -1
  16. package/dist/configs/components/wd-date.d.ts +1 -1
  17. package/dist/configs/components/wd-department.d.ts +1 -1
  18. package/dist/configs/components/wd-form-arr.d.ts +1 -1
  19. package/dist/configs/components/wd-form-detail.d.ts +1 -1
  20. package/dist/configs/components/wd-form-obj.d.ts +1 -1
  21. package/dist/configs/components/wd-form.js +2 -1
  22. package/dist/configs/components/wd-input-email.d.ts +4 -3
  23. package/dist/configs/components/wd-input-number.d.ts +2 -2
  24. package/dist/configs/components/wd-input-phone.d.ts +4 -3
  25. package/dist/configs/components/wd-input-url.d.ts +4 -3
  26. package/dist/configs/components/wd-input.d.ts +3 -1
  27. package/dist/configs/components/wd-location.d.ts +1 -1
  28. package/dist/configs/components/wd-member.d.ts +1 -1
  29. package/dist/configs/components/wd-modal.js +2 -0
  30. package/dist/configs/components/wd-progress.d.ts +2 -2
  31. package/dist/configs/components/wd-radio.d.ts +1 -1
  32. package/dist/configs/components/wd-rating.d.ts +2 -2
  33. package/dist/configs/components/wd-region.d.ts +1 -1
  34. package/dist/configs/components/wd-rich-text.d.ts +1 -1
  35. package/dist/configs/components/wd-select-multiple.d.ts +18 -1
  36. package/dist/configs/components/wd-select-multiple.js +17 -1
  37. package/dist/configs/components/wd-select.d.ts +18 -1
  38. package/dist/configs/components/wd-select.js +16 -0
  39. package/dist/configs/components/wd-side-tab.d.ts +12 -0
  40. package/dist/configs/components/wd-side-tab.js +47 -3
  41. package/dist/configs/components/wd-switch.d.ts +2 -2
  42. package/dist/configs/components/wd-table.d.ts +4 -4
  43. package/dist/configs/components/wd-table.js +2 -1
  44. package/dist/configs/components/wd-tag-select.d.ts +3 -3
  45. package/dist/configs/components/wd-tag.d.ts +21 -21
  46. package/dist/configs/components/wd-textarea.d.ts +8 -1
  47. package/dist/configs/components/wd-textarea.js +1 -0
  48. package/dist/configs/components/wd-time.d.ts +1 -1
  49. package/dist/configs/components/wd-top-tab.d.ts +12 -0
  50. package/dist/configs/components/wd-top-tab.js +47 -3
  51. package/dist/configs/components/wd-upload-file.d.ts +5 -1
  52. package/dist/configs/components/wd-upload-file.js +15 -0
  53. package/dist/configs/components/wd-upload-image.d.ts +1 -1
  54. package/dist/configs/index.d.ts +883 -1407
  55. package/dist/configs/type-utils/index.d.ts +1 -1
  56. package/dist/configs/type-utils/type-form.d.ts +29 -14
  57. package/dist/configs/type-utils/type-form.js +43 -10
  58. package/dist/configs/type-utils/x-runtime-default.d.ts +6 -0
  59. package/dist/configs/type-utils/x-runtime-default.js +6 -0
  60. package/dist/configs/utils/constants.d.ts +2 -0
  61. package/dist/configs/utils/constants.js +3 -0
  62. package/dist/configs/utils/get-combinations.d.ts +1 -0
  63. package/dist/configs/utils/get-combinations.js +13 -0
  64. package/dist/style/components/grid/grid.css +1288 -0
  65. package/dist/style/index.css +10478 -0
  66. package/dist/style/index.scss +1 -1
  67. package/dist/style/weda-ui.min.css +4 -0
  68. package/dist/web/actions/showMessage/index.js +5 -0
  69. package/dist/web/components/carousel/index.js +5 -0
  70. package/dist/web/components/chart/common/core/eChartBase.js +5 -0
  71. package/dist/web/components/chart/statisticsCard/index.js +6 -1
  72. package/dist/web/components/form/form/index.js +9 -1
  73. package/dist/web/components/form/location/common/mapChoose.js +17 -3
  74. package/dist/web/components/form/location/common/mapView.js +18 -5
  75. package/dist/web/components/form/select/dropdown-select/h5.d.ts +3 -1
  76. package/dist/web/components/form/select/dropdown-select/h5.js +20 -20
  77. package/dist/web/components/form/select/dropdown-select/index.css +8 -0
  78. package/dist/web/components/form/select/dropdown-select/index.d.ts +6 -1
  79. package/dist/web/components/form/select/dropdown-select/index.js +64 -30
  80. package/dist/web/components/form/select/dropdown-select/pc.d.ts +2 -1
  81. package/dist/web/components/form/select/dropdown-select/pc.js +3 -3
  82. package/dist/web/components/form/select/dropdown-select/ui.d.ts +5 -0
  83. package/dist/web/components/form/select/dropdown-select/ui.js +8 -4
  84. package/dist/web/components/form/select/formats-util.d.ts +1 -0
  85. package/dist/web/components/form/select/formats-util.js +8 -0
  86. package/dist/web/components/form/select/h5.d.ts +1 -1
  87. package/dist/web/components/form/select/h5.js +6 -3
  88. package/dist/web/components/form/select/index.css +34 -3
  89. package/dist/web/components/form/select/index.d.ts +3 -0
  90. package/dist/web/components/form/select/index.js +6 -3
  91. package/dist/web/components/form/select/region/index.js +5 -1
  92. package/dist/web/components/form/select/request.js +2 -1
  93. package/dist/web/components/form/select/status/index.d.ts +2 -0
  94. package/dist/web/components/form/select/status/index.js +2 -0
  95. package/dist/web/components/form/selectMultiple/dropdown-select/h5.d.ts +3 -1
  96. package/dist/web/components/form/selectMultiple/dropdown-select/h5.js +31 -31
  97. package/dist/web/components/form/selectMultiple/dropdown-select/index.css +23 -0
  98. package/dist/web/components/form/selectMultiple/dropdown-select/index.d.ts +6 -1
  99. package/dist/web/components/form/selectMultiple/dropdown-select/index.js +58 -24
  100. package/dist/web/components/form/selectMultiple/dropdown-select/pc.d.ts +2 -1
  101. package/dist/web/components/form/selectMultiple/dropdown-select/pc.js +2 -2
  102. package/dist/web/components/form/selectMultiple/dropdown-select/ui.d.ts +5 -0
  103. package/dist/web/components/form/selectMultiple/dropdown-select/ui.js +7 -5
  104. package/dist/web/components/form/selectMultiple/h5.d.ts +1 -1
  105. package/dist/web/components/form/selectMultiple/h5.js +6 -3
  106. package/dist/web/components/form/selectMultiple/index.d.ts +5 -0
  107. package/dist/web/components/form/selectMultiple/index.js +7 -4
  108. package/dist/web/components/form/selectMultiple/request.js +2 -1
  109. package/dist/web/components/form/selectMultiple/status/index.d.ts +2 -0
  110. package/dist/web/components/form/selectMultiple/status/index.js +2 -0
  111. package/dist/web/components/form/uploader/index.css +26 -0
  112. package/dist/web/components/form/uploader/uploader.h5.d.ts +11 -3
  113. package/dist/web/components/form/uploader/uploader.h5.js +32 -96
  114. package/dist/web/components/form/uploader/uploader.pc.d.ts +9 -1
  115. package/dist/web/components/form/uploader/uploader.pc.js +36 -100
  116. package/dist/web/components/form/uploader/useUploadFile.d.ts +16 -0
  117. package/dist/web/components/form/uploader/useUploadFile.js +99 -0
  118. package/dist/web/components/form/uploader/util.d.ts +2 -0
  119. package/dist/web/components/form/uploader/util.js +87 -0
  120. package/dist/web/components/form/uploaderFile/uploadFile.h5.d.ts +2 -1
  121. package/dist/web/components/form/uploaderFile/uploadFile.h5.js +14 -4
  122. package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +2 -1
  123. package/dist/web/components/form/uploaderFile/uploadFile.pc.js +21 -5
  124. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +5 -0
  125. package/dist/web/components/form/userOrgSelect/component/userOrgSelect.css +8 -0
  126. package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +6 -0
  127. package/dist/web/components/form-date/index.d.ts +9 -10
  128. package/dist/web/components/form-depart-tree-select/index.d.ts +8 -8
  129. package/dist/web/components/form-email/index.d.ts +12 -19
  130. package/dist/web/components/form-image-uploader/index.d.ts +10 -13
  131. package/dist/web/components/form-input/index.d.ts +4 -4
  132. package/dist/web/components/form-input-hooks/index.js +7 -1
  133. package/dist/web/components/form-location/index.d.ts +8 -7
  134. package/dist/web/components/form-multi-region/index.d.ts +9 -10
  135. package/dist/web/components/form-phone/index.d.ts +12 -19
  136. package/dist/web/components/form-radio/index.d.ts +7 -6
  137. package/dist/web/components/form-region/index.d.ts +9 -10
  138. package/dist/web/components/form-rich-text/index.d.ts +8 -9
  139. package/dist/web/components/form-select/index.d.ts +12 -16
  140. package/dist/web/components/form-select-multiple/index.d.ts +9 -10
  141. package/dist/web/components/form-switch/index.d.ts +8 -7
  142. package/dist/web/components/form-text-area/index.d.ts +12 -19
  143. package/dist/web/components/form-time/index.d.ts +9 -10
  144. package/dist/web/components/form-upload-file/index.d.ts +10 -13
  145. package/dist/web/components/form-url/index.d.ts +12 -19
  146. package/dist/web/components/form-user-tree-select/index.d.ts +8 -8
  147. package/dist/web/components/grid/col.d.ts +6 -9
  148. package/dist/web/components/grid/grid.d.ts +6 -14
  149. package/dist/web/components/grid/row.d.ts +6 -12
  150. package/dist/web/components/listView/index.d.ts +21 -2
  151. package/dist/web/components/listView/index.js +0 -3
  152. package/dist/web/components/listView/interface.d.ts +4 -4
  153. package/dist/web/components/lottery/index.d.ts +13 -15
  154. package/dist/web/components/navigationBar/index.css +2 -1
  155. package/dist/web/components/richText/index.js +6 -0
  156. package/dist/web/components/richTextView/useImgTransform.js +6 -1
  157. package/dist/web/components/table/ImportFileModalByApi/index.js +6 -1
  158. package/dist/web/components/table/ImportFileModalByApi/uploadCSVFile.js +6 -1
  159. package/dist/web/components/wd-audio/wd-audio.js +5 -0
  160. package/dist/web/components/wd-canvas/wd-canvas.js +6 -1
  161. package/dist/web/components/wd-code-editor/wd-code-editor.js +7 -2
  162. package/dist/web/components/wd-date/elements/WheelPicker.js +7 -1
  163. package/dist/web/components/wd-form/index.d.ts +26 -40
  164. package/dist/web/components/wd-form/index.js +9 -2
  165. package/dist/web/components/wd-form-item/wd-form-item-read-only.d.ts +2 -0
  166. package/dist/web/components/wd-form-item/wd-form-item-read-only.js +15 -2
  167. package/dist/web/components/wd-form-item/wd-form-item.js +4 -3
  168. package/dist/web/components/wd-input/wd-input.d.ts +20 -42
  169. package/dist/web/components/wd-input-email/wd-input-email.d.ts +19 -41
  170. package/dist/web/components/wd-input-phone/wd-input-phone.d.ts +20 -42
  171. package/dist/web/components/wd-input-url/wd-input-url.d.ts +19 -41
  172. package/dist/web/components/wd-markdown/wd-markdown.js +5 -2
  173. package/dist/web/components/wd-select/relationalSetting.d.ts +7 -0
  174. package/dist/web/components/wd-select/relationalSetting.js +15 -0
  175. package/dist/web/components/wd-select/wd-select.css +43 -0
  176. package/dist/web/components/wd-select/wd-select.d.ts +2 -0
  177. package/dist/web/components/wd-select/wd-select.js +25 -6
  178. package/dist/web/components/wd-select-multiple/wd-select-multiple.css +4 -0
  179. package/dist/web/components/wd-select-multiple/wd-select-multiple.d.ts +6 -0
  180. package/dist/web/components/wd-select-multiple/wd-select-multiple.js +25 -6
  181. package/dist/web/components/wd-table/components/FieldRender/Form/Enum.js +18 -4
  182. package/dist/web/components/wd-table/components/FieldRender/index.js +34 -5
  183. package/dist/web/components/wd-table/utils/index.js +18 -4
  184. package/dist/web/components/wd-tabs/tabs-h5.js +2 -3
  185. package/dist/web/components/wd-tabs/tabs-pc.js +2 -3
  186. package/dist/web/components/wd-tabs/util.d.ts +1 -0
  187. package/dist/web/components/wd-tabs/util.js +21 -0
  188. package/dist/web/components/wd-textarea/wd-textarea.js +11 -1
  189. package/dist/web/components/wd-unified-link/utils.js +1 -1
  190. package/dist/web/components/wd-upload-file/wd-upload-file.js +2 -2
  191. package/dist/web/components/web-view/web-view.d.ts +14 -20
  192. package/dist/web/utils/color.js +5 -0
  193. package/dist/web/utils/datasource.js +30 -20
  194. package/dist/web/utils/error.d.ts +3 -1
  195. package/dist/web/utils/error.js +9 -4
  196. package/dist/web/utils/file.js +4 -1
  197. package/dist/web/utils/getModelParams.js +27 -2
  198. package/dist/web/utils/hooks/EnumHoc.js +3 -1
  199. package/dist/web/utils/hooks/useRecycle.d.ts +4 -0
  200. package/dist/web/utils/loadIconCss.js +2 -1
  201. package/dist/web/utils/moment.js +2 -1
  202. package/dist/web/utils/platform.js +5 -2
  203. package/dist/web/utils/tcb.js +5 -3
  204. package/dist/web/weda-ui.css +8 -4
  205. package/package.json +8 -3
@@ -1,4 +1,5 @@
1
1
  import { isH5Platform } from '../../utils/platform';
2
+ import { errorHandler } from '../../utils/error';
2
3
  import { message, setConfig } from 'tea-component';
3
4
  import './style';
4
5
  const iconType = {
@@ -38,5 +39,9 @@ export default function showMessage(props) {
38
39
  }
39
40
  catch (error) {
40
41
  console.error('showMessage error', error);
42
+ errorHandler({
43
+ code: 'ShowMessageError',
44
+ error,
45
+ });
41
46
  }
42
47
  }
@@ -6,6 +6,7 @@ import { useDebouncedCallback, useEventListener, useResizeObserver, } from '@rea
6
6
  import Image from '../image';
7
7
  import { emptyObject } from '../../utils/constant';
8
8
  import WdLink from '../wd-link';
9
+ import { errorHandler } from '../../utils/error';
9
10
  import './style';
10
11
  export default function Carousel({ className, style, autoplay, circular, vertical, indicatorDots, indicatorColor, indicatorActiveColor, duration, interval, current, events = emptyObject, id, images: defalutImages, }) {
11
12
  const isCorrectDatas = Array.isArray(defalutImages);
@@ -186,6 +187,10 @@ const SwiperItem = ({ setHeight, children, currentIndex, index, imagesValue }) =
186
187
  }
187
188
  }
188
189
  catch (e) {
190
+ errorHandler({
191
+ code: 'Carousel.invalidUrl',
192
+ error: e,
193
+ });
189
194
  // 非法 url
190
195
  isAbosolutePath = true;
191
196
  href = url;
@@ -1,5 +1,6 @@
1
1
  import { callDataSource, callWedaApi } from '../../../../utils/tcb';
2
2
  import getConfig from '../config/global';
3
+ import { errorHandler } from '../../../../utils/error';
3
4
  export class AbstractEchartBaseModal {
4
5
  }
5
6
  /**
@@ -122,6 +123,10 @@ class EchartBase extends AbstractEchartBaseModal {
122
123
  return (_d = res.result) !== null && _d !== void 0 ? _d : [];
123
124
  }
124
125
  catch (err) {
126
+ errorHandler({
127
+ code: 'Chart',
128
+ error: err,
129
+ });
125
130
  return [];
126
131
  }
127
132
  }
@@ -6,6 +6,7 @@ import { usePlatform } from '../../../utils/platform';
6
6
  import { useDeepCompareEffect, useIsMounted } from '@react-hookz/web';
7
7
  import { callDataSource, callWedaApi } from '../../../utils/tcb';
8
8
  import { getUuid } from '../../../utils/tool';
9
+ import { errorHandler } from '../../../utils/error';
9
10
  import './style';
10
11
  const CLASS_PREFIX = 'weda-statistics-card';
11
12
  // 默认显示值
@@ -158,7 +159,11 @@ export default function StatisticsCard({ dataSource, filterData, field, operatio
158
159
  methodName: dataSource === null || dataSource === void 0 ? void 0 : dataSource.methodName,
159
160
  }));
160
161
  }
161
- catch {
162
+ catch (e) {
163
+ errorHandler({
164
+ code: 'Chart.statisticsCard',
165
+ error: e,
166
+ });
162
167
  return [];
163
168
  }
164
169
  }
@@ -6,6 +6,7 @@ import { usePlatform, isInIde } from '../../../utils/platform';
6
6
  import { callDataSource, callConnector } from '../../../utils/tcb';
7
7
  import isObjectEqual from '../../../utils/isObjectEqual';
8
8
  import { getDataSourceByName } from '../../../utils/datasource';
9
+ import { errorHandler } from '../../../utils/error';
9
10
  import './style';
10
11
  const formTypeWithInitValue = ['edit', 'read'];
11
12
  /**
@@ -65,6 +66,10 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
65
66
  }
66
67
  catch (e) {
67
68
  alertError(platform, '表单容器数据查询失败');
69
+ errorHandler({
70
+ code: 'Form.initValue',
71
+ error: e,
72
+ });
68
73
  }
69
74
  };
70
75
  if (dataSourceName && formTypeWithInitValue.includes(formType)) {
@@ -121,7 +126,10 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
121
126
  catch (err) {
122
127
  (_e = events === null || events === void 0 ? void 0 : events.onInitDataSourceFieldsWithAuth) === null || _e === void 0 ? void 0 : _e.call(events, authValue);
123
128
  alertError(platform, `获取数据源字段权限信息失败,字段权限可能无法正确展示,错误信息:${err === null || err === void 0 ? void 0 : err.message}`);
124
- console.error('getDataSourceFieldsWithAuth err', err);
129
+ errorHandler({
130
+ code: 'Form.getDataSourceFieldsWithAuth',
131
+ error: err,
132
+ });
125
133
  }
126
134
  };
127
135
  if (isDataModel && dataSourceName) {
@@ -6,6 +6,7 @@ import classNames from '../../../../utils/classnames';
6
6
  import debounce from '../../../../utils/debounce';
7
7
  import { tmapApiUrl } from '../constants';
8
8
  import { getTMap, calculateDistance, base64LocationIcon, } from '../../../../utils/tmap';
9
+ import { errorHandler } from '../../../../utils/error';
9
10
  import { Icon } from 'tea-component';
10
11
  import { inH5IsMobile } from '../../../../utils/platform';
11
12
  import './style';
@@ -235,7 +236,10 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
235
236
  .catch((error) => {
236
237
  setSearchLoadingStatus(false);
237
238
  setRealLocation({ lat, lng }, []);
238
- console.error('explore error', error);
239
+ errorHandler({
240
+ code: 'WdLocation.exploreNear',
241
+ error,
242
+ });
239
243
  });
240
244
  }, 500);
241
245
  // 逆解析查询当前经纬度地址
@@ -266,7 +270,10 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
266
270
  }
267
271
  })
268
272
  .catch((error) => {
269
- console.error('getAddress error', error);
273
+ errorHandler({
274
+ code: 'WdLocation.getAddress',
275
+ error,
276
+ });
270
277
  let item = {
271
278
  id: 'current-location',
272
279
  location: {
@@ -316,7 +323,10 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
316
323
  }
317
324
  })
318
325
  .catch((error) => {
319
- console.error('error', error);
326
+ errorHandler({
327
+ code: 'WdLocation.getSuggestion',
328
+ error,
329
+ });
320
330
  });
321
331
  }
322
332
  else {
@@ -457,6 +467,10 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
457
467
  });
458
468
  }
459
469
  catch (e) {
470
+ errorHandler({
471
+ code: 'WdLocation.getLatestLocation',
472
+ error: e,
473
+ });
460
474
  resolve(null);
461
475
  }
462
476
  });
@@ -5,6 +5,7 @@ import * as React from 'react';
5
5
  import * as PropTypes from 'prop-types';
6
6
  import { tmapApiUrl } from '../constants';
7
7
  import { getTMap } from '../../../../utils/tmap';
8
+ import { errorHandler } from '../../../../utils/error';
8
9
  const { useEffect, useRef, useState } = React;
9
10
  const defaultLatLng = {
10
11
  lat: null,
@@ -37,7 +38,10 @@ export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng
37
38
  setMapStatus(true);
38
39
  }
39
40
  catch (error) {
40
- console.error('initMap error', error);
41
+ errorHandler({
42
+ code: 'WdLocation.mapView.initMap',
43
+ error,
44
+ });
41
45
  }
42
46
  };
43
47
  const initMarker = () => {
@@ -64,8 +68,11 @@ export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng
64
68
  });
65
69
  }
66
70
  }
67
- catch (err) {
68
- console.error('initMarker err', err);
71
+ catch (error) {
72
+ errorHandler({
73
+ code: 'WdLocation.mapView.initMarker',
74
+ error,
75
+ });
69
76
  }
70
77
  };
71
78
  useEffect(() => {
@@ -122,7 +129,10 @@ export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng
122
129
  ]);
123
130
  }
124
131
  catch (error) {
125
- console.error('updateGeometries error view', error);
132
+ errorHandler({
133
+ code: 'WdLocation.mapView.updateGeometries',
134
+ error,
135
+ });
126
136
  }
127
137
  }
128
138
  }, [lat, lng, mapStatus]);
@@ -145,7 +155,10 @@ export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng
145
155
  }
146
156
  }
147
157
  catch (error) {
148
- console.error('removeOrAddZoom error', error);
158
+ errorHandler({
159
+ code: 'WdLocation.mapView.removeOrAddZoom',
160
+ error,
161
+ });
149
162
  }
150
163
  };
151
164
  // 移除缩放控件
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import './style';
3
- export declare function SelectPickerH5({ updateValue, selectedValue, options, isTurnPages, loadMore, onSearchValue, reTry, status, isShow, params, onSearchValueInput, }: {
3
+ export declare function SelectPickerH5({ updateValue, selectedValue, options, isTurnPages, loadMore, onSearchValue, reTry, status, isShow, params, onSearchValueInput, addRelationButton, portalContainer, }: {
4
4
  updateValue: any;
5
5
  selectedValue: any;
6
6
  options: any;
@@ -12,4 +12,6 @@ export declare function SelectPickerH5({ updateValue, selectedValue, options, is
12
12
  isShow: any;
13
13
  params: any;
14
14
  onSearchValueInput: any;
15
+ addRelationButton: any;
16
+ portalContainer: any;
15
17
  }): JSX.Element;
@@ -10,7 +10,7 @@ import AllEmpty from '../status/allEmpty';
10
10
  import { PAGE_SIZE, requestFatherRelatedOption, RequestOptionType, } from '../request';
11
11
  import classNames from '../../../../utils/classnames';
12
12
  import './style';
13
- export function SelectPickerH5({ updateValue, selectedValue, options, isTurnPages, loadMore, onSearchValue, reTry, status, isShow, params, onSearchValueInput, }) {
13
+ export function SelectPickerH5({ updateValue, selectedValue, options, isTurnPages, loadMore, onSearchValue, reTry, status, isShow, params, onSearchValueInput, addRelationButton, portalContainer, }) {
14
14
  const focusRef = useRef();
15
15
  const contentRef = useRef();
16
16
  const heightRef = useRef(0);
@@ -91,7 +91,7 @@ export function SelectPickerH5({ updateValue, selectedValue, options, isTurnPage
91
91
  loadMore();
92
92
  }
93
93
  };
94
- return isShow ? (_jsx(Portal, { type: "div", disableOutsidePointerEvents: true, disableOutsideScroll: true, children: _jsxs("div", { className: "weda-ui-custom-picker", children: [_jsx("div", { className: "weda-ui-custom-backdrop", onClick: onClose }), _jsxs("div", { className: "weda-ui-custom-picker__inner", style: inputFocus ? { height: 'calc(100vh - 96px)' } : null, children: [!inputFocus && (_jsx("div", { className: "weda-ui-custom-picker__header", children: _jsx("div", { className: "weda-ui-custom-picker__header-cancle", onClick: onClose, children: "\u53D6\u6D88" }) })), _jsxs("div", { className: "weda-ui-custom-picker__body", children: [_jsxs("div", { style: { margin: inputFocus ? '16px 16px 8px 16px' : '8px 16px' }, className: `weda-ui-custom-search
94
+ return isShow ? (_jsx(Portal, { type: "div", disableOutsidePointerEvents: true, disableOutsideScroll: true, portalContainer: portalContainer, children: _jsxs("div", { className: "weda-ui-custom-picker", children: [_jsx("div", { className: "weda-ui-custom-backdrop", onClick: onClose }), _jsxs("div", { className: "weda-ui-custom-picker__inner", style: inputFocus ? { height: 'calc(100vh - 96px)' } : null, children: [!inputFocus && (_jsx("div", { className: "weda-ui-custom-picker__header", children: _jsx("div", { className: "weda-ui-custom-picker__header-cancle", onClick: onClose, children: "\u53D6\u6D88" }) })), _jsxs("div", { className: "weda-ui-custom-picker__body", children: [_jsxs("div", { style: { margin: inputFocus ? '16px 16px 8px 16px' : '8px 16px' }, className: `weda-ui-custom-search
95
95
  ${inputFocus ? 'is-focused' : ''}`, children: [_jsxs("div", { className: "weda-ui-custom-search-box ", "data-testid": "weda-ui-custom-search-box", onClick: () => {
96
96
  setInputFocus(true);
97
97
  }, children: [inputFocus ? (_jsx("input", { className: "weda-ui-input", ref: focusRef, value: searchValue, autoFocus: true, onChange: (e) => {
@@ -106,23 +106,23 @@ export function SelectPickerH5({ updateValue, selectedValue, options, isTurnPage
106
106
  } }))] }), _jsx("button", { className: "weda-ui-custom-search__btn-cancle", onClick: () => {
107
107
  setInputFocus(false);
108
108
  setSearchValue('');
109
- }, children: "\u53D6\u6D88" })] }), status === Status.ALl_EMPTY ? (_jsx(AllEmpty, { height: inputFocus ? 'calc(100vh - 160px)' : '280px' })) : (_jsx("div", { className: "weda-ui-custom-picker__cloumns weda-ui-custom-picker__cloumns--select ", "data-testid": "weda-ui-custom-picker__cloumns", style: {
109
+ }, children: "\u53D6\u6D88" })] }), status === Status.ALl_EMPTY ? (_jsx(AllEmpty, { height: inputFocus ? 'calc(100vh - 160px)' : '280px' })) : (_jsxs("div", { className: "weda-ui-custom-picker__cloumns weda-ui-custom-picker__cloumns--select ", "data-testid": "weda-ui-custom-picker__cloumns", style: {
110
110
  height: inputFocus ? 'calc(100vh - 160px)' : '280px',
111
- }, onScroll: contentScroll, ref: contentRef, children: _jsxs("ul", { className: "weda-ui-custom-picker__cloumn", style: {
112
- height: inputFocus ? 'calc(100vh - 190px)' : '250px',
113
- }, children: [options === null || options === void 0 ? void 0 : options.map((item, index) => {
114
- // is-selected 选中态
115
- // is-disabled 禁用态,该状态备用,暂时不让生效index === -1
116
- const itemCls = classNames('weda-ui-custom-picker__cloumn-item', {
117
- 'is-selected': index === clickIndex && !inputFocus,
118
- 'is-disabled': index === -1 || item.disabled,
119
- });
120
- return (_jsx("li", { className: itemCls, onClick: () => {
121
- if (item.disabled)
122
- return;
123
- setInputFocus(false);
124
- setSearchValue('');
125
- updateValue(item, true, true, true);
126
- }, children: _jsx("p", { className: 'weda-ui-custom-picker__cloumn-item-text', children: item.label }) }, index));
127
- }), status === Status.LOADING && (_jsx("li", { children: _jsx(Loading, {}) }, 'loading')), status === Status.ERROR && (_jsx("li", { children: _jsx(Retry, { reTry: reTry }) }, 'retry')), status === Status.EMPTY && (_jsx("li", { children: _jsx(Empty, {}) }, 'empty'))] }) }))] })] })] }) })) : null;
111
+ }, onScroll: contentScroll, ref: contentRef, children: [_jsxs("ul", { className: "weda-ui-custom-picker__cloumn", style: {
112
+ height: inputFocus ? 'calc(100vh - 190px)' : '250px',
113
+ }, children: [options === null || options === void 0 ? void 0 : options.map((item, index) => {
114
+ // is-selected 选中态
115
+ // is-disabled 禁用态,该状态备用,暂时不让生效index === -1
116
+ const itemCls = classNames('weda-ui-custom-picker__cloumn-item', {
117
+ 'is-selected': index === clickIndex && !inputFocus,
118
+ 'is-disabled': index === -1 || item.disabled,
119
+ });
120
+ return (_jsx("li", { className: itemCls, onClick: () => {
121
+ if (item.disabled)
122
+ return;
123
+ setInputFocus(false);
124
+ setSearchValue('');
125
+ updateValue(item, true, true, true);
126
+ }, children: _jsx("p", { className: 'weda-ui-custom-picker__cloumn-item-text', children: item.label }) }, index));
127
+ }), status === Status.LOADING && (_jsx("li", { children: _jsx(Loading, {}) }, 'loading')), status === Status.ERROR && (_jsx("li", { children: _jsx(Retry, { reTry: reTry }) }, 'retry')), status === Status.EMPTY && (_jsx("li", { children: _jsx(Empty, {}) }, 'empty'))] }), addRelationButton] }))] })] })] }) })) : null;
128
128
  }
@@ -172,3 +172,11 @@
172
172
  white-space: nowrap;
173
173
  margin-right: 40px;
174
174
  }
175
+
176
+ .weda-ui-custom-picker__cloumns {
177
+ display: flex;
178
+ flex-direction: column;
179
+ }
180
+ .weda-ui-custom-picker__cloumn {
181
+ width: 100%;
182
+ }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, onSearchValueInput, ignoreCase, staticSearchable, }: {
2
+ export declare function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, onSearchValueInput, ignoreCase, staticSearchable, childRef, updateStatus, addRelationButtonText, enableAddRelationButton, onAddRelationButtonClick, }: {
3
3
  params: any;
4
4
  selectedValue: any;
5
5
  updateValue: any;
@@ -10,4 +10,9 @@ export declare function PureSelect({ params, selectedValue, updateValue, placeho
10
10
  onSearchValueInput: any;
11
11
  ignoreCase?: boolean;
12
12
  staticSearchable?: boolean;
13
+ childRef: any;
14
+ updateStatus?: any;
15
+ addRelationButtonText: any;
16
+ enableAddRelationButton: any;
17
+ onAddRelationButtonClick: any;
13
18
  }): JSX.Element;
@@ -1,50 +1,33 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useRef, useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useRef, useState, useImperativeHandle, useCallback, } from 'react';
3
3
  import { SelectPickerH5 } from './h5';
4
4
  import { PAGE_SIZE, requestEnumOption, requestFatherRelatedOption, RequestOptionType, transFormatTeaSelectKey, } from '../request';
5
5
  import SelectPickerPc from './pc';
6
6
  import { usePlatform } from '../../../../utils/platform';
7
- import { Status } from '../status';
7
+ import { Status, Loading } from '../status';
8
8
  import { isFormatNeedFetch, isSingleForeignFormat } from '../formats-util';
9
9
  import { useDebouncedEffect, useDeepCompareEffect } from '@react-hookz/web';
10
10
  import { useRecycle } from '../../../../utils/hooks/useRecycle';
11
- export function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, onSearchValueInput, ignoreCase = true, staticSearchable = true, }) {
11
+ import WdIcon from '../../../wd-icon';
12
+ export function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, onSearchValueInput, ignoreCase = true, staticSearchable = true, childRef, updateStatus = undefined, addRelationButtonText, enableAddRelationButton, onAddRelationButtonClick, }) {
12
13
  const isRequestingRef = useRef(false);
13
14
  const [status, setStatus] = useState(Status.ALl_EMPTY);
15
+ const [refreshStatus, setRefreshStatus] = useState(false);
14
16
  const [options, setOptions] = useState([]);
15
17
  const [page, setPage] = useState(1);
16
18
  const [searchOptions, setSearchOptions] = useState([]);
17
19
  const [searchPage, setSearchPage] = useState(1);
18
20
  const [searchValue, setSearchValue] = useState('');
19
21
  const [searchStatus, setSearchStatus] = useState(Status.FINISH);
20
- const [format, setFormat] = useState('');
22
+ const { recycleBack, format: _format, portalContainer } = useRecycle();
23
+ const [format, setFormat] = useState(_format);
21
24
  const [isTurnPages, setIsTurnPages] = useState(false);
22
25
  const platform = usePlatform();
23
26
  const isSearch = useMemo(() => searchValue !== '', [searchValue]);
24
- const { recycleBack } = useRecycle();
25
- useDeepCompareEffect(() => {
26
- const { format, controlledValue } = params || {
27
- format: '',
28
- controlledValue: [],
29
- };
30
- const isTurnPages = isSingleForeignFormat(format);
31
- setFormat(format);
32
- setIsTurnPages(isTurnPages);
33
- // 手动配置
34
- if (!isFormatNeedFetch(format)) {
35
- if (controlledValue.length === 0) {
36
- setStatus(Status.ALl_EMPTY);
37
- }
38
- else {
39
- setStatus(Status.FINISH);
40
- }
41
- setOptions(controlledValue);
42
- return;
43
- }
44
- // 接口请求
27
+ const getOptionsByRequest = useCallback((isTurnPages, format = _format) => {
45
28
  if (isTurnPages) {
46
29
  setStatus(Status.LOADING);
47
- requestFatherRelatedOption(params, 1, RequestOptionType.ALL)
30
+ return requestFatherRelatedOption(params, 1, RequestOptionType.ALL)
48
31
  .then((value) => {
49
32
  setOptions(value.option);
50
33
  if (value.option.length === 0) {
@@ -53,14 +36,16 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
53
36
  else {
54
37
  setStatus(value.isLoadMore ? Status.LOADING : Status.FINISH);
55
38
  }
39
+ return { status: Status.FINISH, value };
56
40
  })
57
41
  .catch(() => {
58
42
  setStatus(Status.ERROR);
43
+ return { status: Status.ERROR };
59
44
  })
60
45
  .finally(() => (isRequestingRef.current = false));
61
46
  }
62
47
  else if (format === 'x-enum') {
63
- requestEnumOption(params)
48
+ return requestEnumOption(params)
64
49
  .then((value) => {
65
50
  setOptions(value);
66
51
  if (value.length === 0) {
@@ -69,12 +54,36 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
69
54
  else {
70
55
  setStatus(Status.FINISH);
71
56
  }
57
+ return { status: Status.FINISH, value };
72
58
  })
73
59
  .catch(() => {
74
60
  setStatus(Status.ERROR);
61
+ return { status: Status.FINISH };
75
62
  })
76
63
  .finally(() => (isRequestingRef.current = false));
77
64
  }
65
+ }, [_format, params, platform]);
66
+ useDeepCompareEffect(() => {
67
+ const { format, controlledValue } = params || {
68
+ format: '',
69
+ controlledValue: [],
70
+ };
71
+ const isTurnPages = isSingleForeignFormat(format);
72
+ setFormat(format);
73
+ setIsTurnPages(isTurnPages);
74
+ // 手动配置
75
+ if (!isFormatNeedFetch(format)) {
76
+ if (controlledValue.length === 0) {
77
+ setStatus(Status.ALl_EMPTY);
78
+ }
79
+ else {
80
+ setStatus(Status.FINISH);
81
+ }
82
+ setOptions(controlledValue);
83
+ return;
84
+ }
85
+ // 接口请求
86
+ getOptionsByRequest(isTurnPages, format);
78
87
  }, [params]);
79
88
  useEffect(() => {
80
89
  if (page > 1) {
@@ -119,7 +128,9 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
119
128
  }
120
129
  }
121
130
  })
122
- .catch(() => isSearch ? setSearchStatus(Status.ERROR) : setStatus(Status.ERROR))
131
+ .catch(() => {
132
+ isSearch ? setSearchStatus(Status.ERROR) : setStatus(Status.ERROR);
133
+ })
123
134
  .finally(() => (isRequestingRef.current = false));
124
135
  };
125
136
  const currentStatus = useMemo(() => {
@@ -238,5 +249,28 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
238
249
  }
239
250
  });
240
251
  };
241
- return platform === 'h5' ? (_jsx(SelectPickerH5, { updateValue: updateValue, options: currentOption, loadMore: loadMore, reTry: reTry, isTurnPages: isTurnPages, status: currentStatus, onSearchValue: onSearchValue, isShow: isShow, params: params, selectedValue: selectedValue, onSearchValueInput: onSearchValueInput })) : (_jsx(SelectPickerPc, { placeholder: placeholder, size: size, selectedValue: selectedValue, disabled: disabled, updateValue: updateValue, reTry: reTry, loadMore: loadMore, format: format, status: currentStatus, options: currentOption, onSearchValue: onSearchValue, defaultSearchValue: '', findData: findData, onSearchValueInput: onSearchValueInput }));
252
+ useImperativeHandle(childRef, () => {
253
+ return {
254
+ refresh: async () => {
255
+ setRefreshStatus(true);
256
+ updateStatus === null || updateStatus === void 0 ? void 0 : updateStatus(true);
257
+ await getOptionsByRequest(isTurnPages);
258
+ // eslint-disable-next-line rulesdir/no-timer
259
+ const timer = setTimeout(() => {
260
+ setRefreshStatus(false);
261
+ updateStatus === null || updateStatus === void 0 ? void 0 : updateStatus(false);
262
+ clearTimeout(timer);
263
+ }, 500);
264
+ },
265
+ };
266
+ }, [getOptionsByRequest, isTurnPages, updateStatus]);
267
+ const addRelationButton = isFormatNeedFetch(format) &&
268
+ enableAddRelationButton && (_jsxs("span", { className: "wd-add-relation-button-wrap", onClick: onAddRelationButtonClick, children: [_jsx(WdIcon, { size: 'xs', name: 'td:add-circle' }), addRelationButtonText] }));
269
+ if (refreshStatus && platform === 'pc') {
270
+ return _jsx(Loading, {});
271
+ }
272
+ if (refreshStatus && platform === 'h5') {
273
+ return null;
274
+ }
275
+ return platform === 'h5' ? (_jsx(SelectPickerH5, { portalContainer: portalContainer, addRelationButton: addRelationButton, updateValue: updateValue, options: currentOption, loadMore: loadMore, reTry: reTry, isTurnPages: isTurnPages, status: currentStatus, onSearchValue: onSearchValue, isShow: isShow, params: params, selectedValue: selectedValue, onSearchValueInput: onSearchValueInput })) : (_jsx(SelectPickerPc, { placeholder: placeholder, size: size, selectedValue: selectedValue, disabled: disabled, updateValue: updateValue, reTry: reTry, loadMore: loadMore, format: format, status: currentStatus, options: currentOption, onSearchValue: onSearchValue, defaultSearchValue: '', findData: findData, onSearchValueInput: onSearchValueInput, footer: addRelationButton }));
242
276
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import './style';
3
- export default function SelectPickerPc({ format, selectedValue, updateValue: _updateValue, placeholder, size, disabled, reTry, loadMore, status, options, onSearchValue, defaultSearchValue, findData, onSearchValueInput, }: {
3
+ export default function SelectPickerPc({ format, selectedValue, updateValue: _updateValue, placeholder, size, disabled, reTry, loadMore, status, options, onSearchValue, defaultSearchValue, findData, onSearchValueInput, footer, }: {
4
4
  format: any;
5
5
  selectedValue: any;
6
6
  updateValue: any;
@@ -15,4 +15,5 @@ export default function SelectPickerPc({ format, selectedValue, updateValue: _up
15
15
  defaultSearchValue: any;
16
16
  findData: any;
17
17
  onSearchValueInput: any;
18
+ footer: any;
18
19
  }): JSX.Element;
@@ -9,7 +9,7 @@ import Empty from '../status/empty';
9
9
  import { WdFormItemReadOnly } from '../../../wd-form-item';
10
10
  import lodashGet from 'lodash.get';
11
11
  import './style';
12
- export default function SelectPickerPc({ format, selectedValue, updateValue: _updateValue, placeholder, size, disabled, reTry, loadMore, status, options, onSearchValue, defaultSearchValue, findData, onSearchValueInput, }) {
12
+ export default function SelectPickerPc({ format, selectedValue, updateValue: _updateValue, placeholder, size, disabled, reTry, loadMore, status, options, onSearchValue, defaultSearchValue, findData, onSearchValueInput, footer, }) {
13
13
  const [showDelete, setShowDelete] = useState(false);
14
14
  const [optList, setOptList] = useState(options);
15
15
  const [readValue, setReadValue] = useState('');
@@ -84,11 +84,11 @@ export default function SelectPickerPc({ format, selectedValue, updateValue: _up
84
84
  return '';
85
85
  }
86
86
  }, [format, status, optList]);
87
- return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(WdFormItemReadOnly, { readValue: readValue, children: _jsx("div", { "data-testid": "form-select", className: 'form-select-pc', onMouseEnter: () => {
87
+ return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(WdFormItemReadOnly, { readValue: readValue, format: format, value: selectedValue, children: _jsx("div", { "data-testid": "form-select", className: 'form-select-pc', onMouseEnter: () => {
88
88
  setShowDelete(true);
89
89
  }, onMouseLeave: () => {
90
90
  setShowDelete(false);
91
- }, children: _jsx(Select, { searchable: true, matchButtonWidth: true, defaultSearchValue: defaultSearchValue, placeholder: placeholder, appearance: 'button', size: size, tips: "", disabled: disabled, autoClearSearchValue: true, options: optList, value: selectedValue, bottomTips: isShowBottomTips, onChange: (value) => updateValue(value, true), onScrollBottom: loadMore, onOpen: () => {
91
+ }, children: _jsx(Select, { footer: footer, searchable: true, matchButtonWidth: true, defaultSearchValue: defaultSearchValue, placeholder: placeholder, appearance: 'button', size: size, tips: "", disabled: disabled, autoClearSearchValue: true, options: optList, value: selectedValue, bottomTips: isShowBottomTips, onChange: (value) => updateValue(value, true), onScrollBottom: loadMore, onOpen: () => {
92
92
  onSearchValue('');
93
93
  }, onSearch: (value, context) => {
94
94
  const tValue = value.trim();
@@ -11,6 +11,11 @@ interface IPureSelectProps extends Pick<SelectProps, 'size' | 'disabled' | 'valu
11
11
  onSearchValueInput?: (value: string) => void;
12
12
  ignoreCase?: boolean;
13
13
  staticSearchable?: boolean;
14
+ childRef?: any;
15
+ enableAddRelationButton?: boolean;
16
+ addRelationButtonText?: string;
17
+ onAddRelationButtonClick?: () => void;
18
+ format?: boolean;
14
19
  }
15
20
  export declare function PureSelectPc(props: IPureSelectProps): JSX.Element;
16
21
  export declare function PureSelectH5(props: IPureSelectProps): JSX.Element;
@@ -7,10 +7,12 @@ import { PureSelect } from './index';
7
7
  import { isNil } from '../../../../utils/lodash';
8
8
  import { WdFormItemReadOnly } from '../../../wd-form-item';
9
9
  import lodashGet from 'lodash.get';
10
+ import Loading from '../status/loading';
11
+ import { useRecycle } from '../../../../utils/hooks/useRecycle';
10
12
  export function PureSelectPc(props) {
11
- const { size, onChange = noop, value, placeholder, params, disabled, onSearchValueInput, ignoreCase, staticSearchable, } = props;
13
+ const { size, onChange = noop, value, placeholder, params, disabled, onSearchValueInput, ignoreCase, staticSearchable, childRef, addRelationButtonText, enableAddRelationButton, onAddRelationButtonClick, } = props;
12
14
  const previousValueRef = useRef();
13
- return (_jsx(PureSelect, { ignoreCase: ignoreCase, staticSearchable: staticSearchable, isShow: false, params: params, placeholder: placeholder, size: size, selectedValue: value, disabled: disabled, onSearchValueInput: onSearchValueInput, updateValue: (value, triggerEvent) => {
15
+ return (_jsx(PureSelect, { childRef: childRef, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, ignoreCase: ignoreCase, staticSearchable: staticSearchable, isShow: false, params: params, placeholder: placeholder, size: size, selectedValue: value, disabled: disabled, onAddRelationButtonClick: onAddRelationButtonClick, onSearchValueInput: onSearchValueInput, updateValue: (value, triggerEvent) => {
14
16
  if (previousValueRef.current !== value) {
15
17
  onChange(value, triggerEvent);
16
18
  previousValueRef.current = value;
@@ -18,11 +20,13 @@ export function PureSelectPc(props) {
18
20
  } }));
19
21
  }
20
22
  export function PureSelectH5(props) {
21
- const { placeholder, name, disabled, onChange = noop, layout, className, params, onSearchValueInput, ignoreCase, staticSearchable, } = props;
23
+ const { placeholder, name, disabled, onChange = noop, layout, className, params, onSearchValueInput, ignoreCase, staticSearchable, childRef, addRelationButtonText, enableAddRelationButton, onAddRelationButtonClick, } = props;
22
24
  const [value, setValue] = useSyncValue(props.value);
23
25
  const [currentLabel, setCurrentLabel] = useState('');
24
26
  const [isShow, setIsShow] = useState(false);
27
+ const [status, setStatus] = useState(false);
25
28
  const previousValueRef = useRef(value);
29
+ const { format } = useRecycle();
26
30
  useEffect(() => {
27
31
  if (isNil(props.value)) {
28
32
  setValue('');
@@ -55,5 +59,5 @@ export function PureSelectH5(props) {
55
59
  const onClick = () => {
56
60
  setIsShow(true);
57
61
  };
58
- return (_jsxs(_Fragment, { children: [_jsx(WdFormItemReadOnly, { readValue: currentLabel, children: _jsx("div", { className: subCls, children: _jsxs("div", { className: "weui-cell__bd weui-flex select-picker", onClick: disabled ? null : onClick, children: [_jsx("input", { className: "weui-input", type: "select", name: name, placeholder: placeholder, value: currentLabel, disabled: disabled, autoComplete: 'off', readOnly: true, "data-testid": "form-item-select" }), _jsx("span", { className: 'weui-input-arrow' })] }) }) }), _jsx(PureSelect, { staticSearchable: staticSearchable, ignoreCase: ignoreCase, params: params, updateValue: onChooseCallback, selectedValue: value, isShow: isShow, size: undefined, disabled: undefined, onSearchValueInput: onSearchValueInput, placeholder: undefined })] }));
62
+ return (_jsxs(_Fragment, { children: [status ? (_jsx(Loading, {})) : (_jsx(WdFormItemReadOnly, { readValue: currentLabel, format: format, value: value, children: _jsx("div", { className: subCls, children: _jsxs("div", { className: "weui-cell__bd weui-flex select-picker", onClick: disabled ? null : onClick, children: [_jsx("input", { className: "weui-input", type: "select", name: name, placeholder: placeholder, value: currentLabel, disabled: disabled, autoComplete: 'off', readOnly: true, "data-testid": "form-item-select" }), _jsx("span", { className: 'weui-input-arrow' })] }) }) })), _jsx(PureSelect, { onAddRelationButtonClick: onAddRelationButtonClick, childRef: childRef, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, staticSearchable: staticSearchable, ignoreCase: ignoreCase, params: params, updateValue: onChooseCallback, selectedValue: value, isShow: isShow, size: undefined, disabled: undefined, onSearchValueInput: onSearchValueInput, placeholder: undefined, updateStatus: setStatus })] }));
59
63
  }
@@ -2,4 +2,5 @@ declare const SINGLE_FOREIGN_FORMATS: readonly ["father-son", "related", "many-o
2
2
  export type TSingleForeignFormat = typeof SINGLE_FOREIGN_FORMATS[number];
3
3
  export declare function isSingleForeignFormat(format: string): format is TSingleForeignFormat;
4
4
  export declare function isFormatNeedFetch(format: string): boolean;
5
+ export declare function isFormatWithRelation(format: string): boolean;
5
6
  export {};
@@ -13,3 +13,11 @@ export function isSingleForeignFormat(format) {
13
13
  export function isFormatNeedFetch(format) {
14
14
  return formatNeedDataFetch.includes(format);
15
15
  }
16
+ const formatWithRelation = [
17
+ ...SINGLE_FOREIGN_FORMATS,
18
+ 'x-enum',
19
+ 'one-many',
20
+ ];
21
+ export function isFormatWithRelation(format) {
22
+ return formatWithRelation.includes(format);
23
+ }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { PropsType } from './index';
3
- export default function Select({ events, name, placeholder, layout, mode, dateMode, disabled, range, where, primaryField, enumName, dataSourceName, viewId, format, defaultValue, startDate, endDate, defaultDate, startTime, endTime, defaultTime, defaultRegion, defaultMutiRegion, separator, regionType, clearable, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, }: PropsType): JSX.Element;
3
+ export default function Select({ events, name, placeholder, layout, mode, dateMode, disabled, range, where, primaryField, enumName, dataSourceName, viewId, format, defaultValue, startDate, endDate, defaultDate, startTime, endTime, defaultTime, defaultRegion, defaultMutiRegion, separator, regionType, clearable, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, childRef, addRelationButtonText, enableAddRelationButton, }: PropsType): JSX.Element;
4
4
  export declare function decodeIsoDatetime(isoStringOrTimesnap: any, type: any, dateMode?: string): any;
5
5
  /**
6
6
  * 根据时间模式,构造 new Date()的传参格式单个日期和时间组件值