@cloudbase/weda-ui 3.1.1 → 3.1.4

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 (49) hide show
  1. package/dist/asset-manifest.json +17 -0
  2. package/dist/configs/components/carousel.json +2 -2
  3. package/dist/configs/components/form/checkbox.json +1 -0
  4. package/dist/configs/components/form/form.json +39 -15
  5. package/dist/configs/components/form/location.json +0 -32
  6. package/dist/configs/components/form/select.json +1 -0
  7. package/dist/index.html +88 -0
  8. package/dist/static/js/bundle.js +963 -0
  9. package/dist/static/js/bundle.js.map +1 -0
  10. package/dist/static/js/main.chunk.js +8841 -0
  11. package/dist/static/js/main.chunk.js.map +1 -0
  12. package/dist/static/js/vendors~main.chunk.js +247885 -0
  13. package/dist/static/js/vendors~main.chunk.js.map +1 -0
  14. package/dist/static/media/ef6fa527e24e354765d806b826b41391.fa67580a.svg +627 -0
  15. package/dist/web/components/chart/common/core/eChartBar.d.ts +36 -0
  16. package/dist/web/components/chart/common/core/eChartBar.js +3 -1
  17. package/dist/web/components/chart/common/core/eChartLine.d.ts +34 -0
  18. package/dist/web/components/chart/common/core/eChartLine.js +3 -1
  19. package/dist/web/components/chart/common/core/eChartPie.d.ts +22 -0
  20. package/dist/web/components/form/checkbox/index.js +1 -1
  21. package/dist/web/components/form/form/index.css +4 -0
  22. package/dist/web/components/form/form/index.d.ts +21 -2
  23. package/dist/web/components/form/form/index.js +90 -16
  24. package/dist/web/components/form/location/common/mapChoose.js +97 -35
  25. package/dist/web/components/form/location/common/propsConfig.d.ts +1 -4
  26. package/dist/web/components/form/location/common/propsConfig.js +0 -2
  27. package/dist/web/components/form/location/common/useLocationInfo.d.ts +2 -0
  28. package/dist/web/components/form/location/common/useLocationInfo.js +19 -3
  29. package/dist/web/components/form/location/components/LocationH5/index.css +1 -1
  30. package/dist/web/components/form/location/components/LocationH5/location.h5.js +30 -54
  31. package/dist/web/components/form/location/components/LocationPC/location.PC.js +16 -51
  32. package/dist/web/components/form/select/dropdown-select/ui.d.ts +15 -0
  33. package/dist/web/components/form/select/dropdown-select/ui.js +55 -0
  34. package/dist/web/components/form/select/h5.d.ts +1 -1
  35. package/dist/web/components/form/select/h5.js +54 -150
  36. package/dist/web/components/form/select/index.d.ts +1 -1
  37. package/dist/web/components/form/select/index.js +33 -94
  38. package/dist/web/components/form/select/use-options.d.ts +26 -0
  39. package/dist/web/components/form/select/use-options.js +103 -0
  40. package/dist/web/components/form/uploader/index.css +10 -3
  41. package/dist/web/components/form/uploader/uploader.h5.d.ts +1 -1
  42. package/dist/web/components/form/uploader/uploader.h5.js +18 -19
  43. package/dist/web/components/form/uploader/uploader.pc.js +6 -3
  44. package/dist/web/components/richText/index.js +20 -17
  45. package/dist/web/utils/isObjectEqual.d.ts +1 -1
  46. package/dist/web/utils/tcb.d.ts +5 -1
  47. package/dist/web/utils/tcb.js +26 -3
  48. package/package.json +41 -39
  49. package/CHANGELOG.md +0 -7
@@ -16,7 +16,7 @@ export default function LocationH5(props) {
16
16
  // 系统属性
17
17
  id, className, style, events,
18
18
  // 组件属性
19
- value, label, labelVisible, showLngLat, showMap, drag, zoom, disabled, requiredFlag, decorator, customLocation, locationType, dataSource, layout, locationRange, customRange, } = props;
19
+ value, label, labelVisible, showLngLat, showMap, drag, zoom, disabled, requiredFlag, decorator, locationType, dataSource, layout, locationRange, customRange, } = props;
20
20
  const cls = classNames({
21
21
  'weda-ui': true,
22
22
  cloudbase_standard: true,
@@ -39,6 +39,7 @@ export default function LocationH5(props) {
39
39
  latlng: { lat: 39.98410411, lng: 116.307503 },
40
40
  });
41
41
  const currentLocations = useRef();
42
+ const customLocation = useRef();
42
43
  useEffect(() => {
43
44
  if (value || !currentLocations.current)
44
45
  return;
@@ -78,46 +79,24 @@ export default function LocationH5(props) {
78
79
  detailedAddress: '',
79
80
  locationType,
80
81
  };
81
- switch (locationType) {
82
- case 3:
83
- if (checkCustomLocation(customLocation)) {
84
- showToast('位置输入格式错误请检查');
85
- return;
86
- }
87
- else {
88
- loc = {
89
- latlng: {
90
- lat: customLocation.latitude,
91
- lng: customLocation.longitude,
92
- },
93
- poiname: customLocation.poiname,
94
- };
95
- }
96
- break;
97
- }
98
82
  setLocation(loc);
99
83
  // 暂不支持自定位置,初始化表单值都是{}
100
84
  events.change({ value: {} });
101
85
  }, [locationType]);
102
86
  useEffect(() => {
103
- if (locationType != 3) {
104
- return;
105
- }
106
- if (checkCustomLocation(customLocation)) {
107
- showToast('位置输入格式错误请检查');
108
- return;
87
+ if (checkCustomLocation(value)) {
88
+ // 表单为新增时回传点位信息
89
+ const { address, detailedAddress, geopoint } = value;
90
+ const coordinates = (geopoint === null || geopoint === void 0 ? void 0 : geopoint.coordinates) || [];
91
+ let loc = {
92
+ poiname: address,
93
+ detailedAddress: detailedAddress,
94
+ latlng: { lng: coordinates[0], lat: coordinates[1] },
95
+ };
96
+ customLocation.current = value;
97
+ setLocation(loc);
109
98
  }
110
- let { latitude, longitude, poiname } = customLocation;
111
- let loc = {
112
- latlng: {
113
- lat: latitude,
114
- lng: longitude,
115
- },
116
- poiname: poiname,
117
- detailedAddress: '',
118
- };
119
- setLocation(loc);
120
- }, [customLocation, locationType]);
99
+ }, [value]);
121
100
  // 获取定位信息
122
101
  useEffect(() => {
123
102
  if (!dataSourceStatus.status ||
@@ -138,6 +117,11 @@ export default function LocationH5(props) {
138
117
  let getLocationType = inH5IsMobile() ? 'getLocation' : 'getIpLocation';
139
118
  geolocation[getLocationType]((ipLocation) => {
140
119
  const { city, lat, lng, addr } = ipLocation;
120
+ setApiKeyStatus({
121
+ status: true,
122
+ message: '',
123
+ });
124
+ setCurrentLocStatus(true);
141
125
  let loc = {
142
126
  poiname: city + addr,
143
127
  detailedAddress: city + addr,
@@ -146,10 +130,12 @@ export default function LocationH5(props) {
146
130
  if (locationType === 1) {
147
131
  loc.locationType = 1;
148
132
  }
149
- setLocation(loc);
150
133
  currentLocations.current = loc;
134
+ // 表单为新增时检查是否为回传点位信息
135
+ if (checkCustomLocation(customLocation.current))
136
+ return;
137
+ setLocation(loc);
151
138
  if (locationType === 2) {
152
- loc.locationType = 1;
153
139
  events.change &&
154
140
  events.change({
155
141
  value: {
@@ -162,11 +148,6 @@ export default function LocationH5(props) {
162
148
  },
163
149
  });
164
150
  }
165
- setApiKeyStatus({
166
- status: true,
167
- message: '',
168
- });
169
- setCurrentLocStatus(true);
170
151
  }, (error) => {
171
152
  console.log('error loc', error);
172
153
  currentLocations.current = null;
@@ -233,20 +214,15 @@ export default function LocationH5(props) {
233
214
  }
234
215
  }, [dataSource]);
235
216
  const checkCustomLocation = (params) => {
236
- let { latitude, longitude } = params;
237
- let message = '';
238
- if (Object.prototype.toString.call(params) !== '[object Object]') {
239
- return (message = '位置输入格式错误 请检查');
240
- }
241
- else if (!latitude || !Number(latitude)) {
242
- return (message = '位置输入格式错误 请检查');
243
- }
244
- else if (!longitude || !Number(longitude)) {
245
- return (message = '位置输入格式错误 请检查');
217
+ var _a;
218
+ let status = true;
219
+ if (!(params === null || params === void 0 ? void 0 : params.address) || !(params === null || params === void 0 ? void 0 : params.detailedAddress)) {
220
+ status = false;
246
221
  }
247
- else if (!params) {
248
- return (message = '位置输入格式错误 请检查');
222
+ else if (((_a = params === null || params === void 0 ? void 0 : params.geopoint) === null || _a === void 0 ? void 0 : _a.type) != 'Point') {
223
+ status = false;
249
224
  }
225
+ return status;
250
226
  };
251
227
  const showToast = (message) => {
252
228
  weui.toast(message, {
@@ -19,7 +19,7 @@ export default function LocationPC(props) {
19
19
  // 系统属性
20
20
  id, className, style, events,
21
21
  // 组件属性
22
- value, label, labelVisible, customLocation, locationType, showLngLat, showMap, drag, zoom, disabled, requiredFlag, decorator, dataSource, layout, locationRange, customRange, } = props;
22
+ value, label, labelVisible, locationType, showLngLat, showMap, drag, zoom, disabled, requiredFlag, decorator, dataSource, layout, locationRange, customRange, } = props;
23
23
  const cls = classNames({
24
24
  'weda-ui': true,
25
25
  cloudbase_standard: true,
@@ -47,12 +47,26 @@ export default function LocationPC(props) {
47
47
  value: noaddr ? {} : res,
48
48
  });
49
49
  };
50
- const { location, setLocation, apiKeyStatus, setApiKeyStatus, currentLocStatus, currentLocations, } = useLocationInfo({
50
+ const { location, setLocation, apiKeyStatus, setApiKeyStatus, currentLocStatus, currentLocations, customLocation, checkCustomLocation, } = useLocationInfo({
51
51
  apiKey: APIKEY,
52
52
  locationType,
53
53
  dataSourceStatus,
54
54
  eventsChange,
55
55
  });
56
+ useEffect(() => {
57
+ if (checkCustomLocation(value)) {
58
+ // 表单为新增时回传点位信息
59
+ const { address, detailedAddress, geopoint } = value;
60
+ const coordinates = (geopoint === null || geopoint === void 0 ? void 0 : geopoint.coordinates) || [];
61
+ let loc = {
62
+ poiname: address,
63
+ detailedAddress: detailedAddress,
64
+ latlng: { lng: coordinates[0], lat: coordinates[1] },
65
+ };
66
+ customLocation.current = value;
67
+ setLocation(loc);
68
+ }
69
+ }, [value]);
56
70
  useEffect(() => {
57
71
  if (value || !currentLocations.current)
58
72
  return;
@@ -164,20 +178,6 @@ export default function LocationPC(props) {
164
178
  detailedAddress: location.detailedAddress,
165
179
  };
166
180
  break;
167
- case 3:
168
- if (checkCustomLocation(customLocation)) {
169
- showToast('位置输入格式错误 请检查');
170
- }
171
- else {
172
- loc = {
173
- latlng: {
174
- lat: customLocation.latitude,
175
- lng: customLocation.longitude,
176
- },
177
- poiname: customLocation.poiname,
178
- };
179
- }
180
- break;
181
181
  }
182
182
  setLocation(loc);
183
183
  // 暂不支持自定位置,初始化表单值都是{}
@@ -188,41 +188,6 @@ export default function LocationPC(props) {
188
188
  detailedAddress: loc.detailedAddress,
189
189
  }, true);
190
190
  }, [locationType]);
191
- useEffect(() => {
192
- if (locationType != 3) {
193
- return;
194
- }
195
- if (checkCustomLocation(customLocation)) {
196
- showToast('位置输入格式错误 请检查');
197
- return;
198
- }
199
- let { latitude, longitude, poiname, detailedAddress } = customLocation;
200
- let loc = {
201
- latlng: {
202
- lat: latitude,
203
- lng: longitude,
204
- },
205
- poiname,
206
- detailedAddress,
207
- };
208
- setLocation(loc);
209
- }, [customLocation, locationType]);
210
- const checkCustomLocation = (params) => {
211
- let { latitude, longitude } = params;
212
- let message = '';
213
- if (Object.prototype.toString.call(params) !== '[object Object]') {
214
- return (message = '位置输入格式错误 请检查');
215
- }
216
- else if (!latitude || !Number(latitude)) {
217
- return (message = '位置输入格式错误 请检查');
218
- }
219
- else if (!longitude || !Number(longitude)) {
220
- return (message = '位置输入格式错误 请检查');
221
- }
222
- else if (!params) {
223
- return (message = '位置输入格式错误 请检查');
224
- }
225
- };
226
191
  const getIsShowMap = () => {
227
192
  let status = showMap;
228
193
  if (locationType === 1 && location.locationType === 1) {
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { SelectProps } from 'tea-component';
3
+ interface IPureSelectProps extends Pick<SelectProps, 'size' | 'disabled' | 'value' | 'placeholder'> {
4
+ name?: string;
5
+ options: {
6
+ label: string;
7
+ value: string;
8
+ }[];
9
+ onChange: (v: string) => void;
10
+ layout?: 'horizontal' | 'vertical';
11
+ className?: string;
12
+ }
13
+ export declare function PureSelectPc(props: IPureSelectProps): JSX.Element;
14
+ export declare function PureSelectH5(props: IPureSelectProps): JSX.Element;
15
+ export {};
@@ -0,0 +1,55 @@
1
+ import React, { useMemo } from 'react';
2
+ import { ConfigProvider, Select as TeaSelect, } from 'tea-component';
3
+ import classNames from '../../../../utils/classnames';
4
+ import { noop } from '../../../../utils/constant';
5
+ import { useSyncValue } from '../../../../utils/useSyncValue';
6
+ import weui from '../../../../utils/weui';
7
+ export function PureSelectPc(props) {
8
+ const { size, onChange = noop, disabled, placeholder } = props;
9
+ const [value, setValue] = useSyncValue(props.value);
10
+ const options = useMemo(() => {
11
+ var _a;
12
+ return ((_a = props.options) !== null && _a !== void 0 ? _a : []).map((opt) => ({
13
+ text: opt.label,
14
+ value: opt.value,
15
+ }));
16
+ }, [props.options]);
17
+ return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
18
+ React.createElement("div", { "data-testid": "form-select" },
19
+ React.createElement(TeaSelect, { matchButtonWidth: true, size: size, onChange: (v) => {
20
+ onChange(v);
21
+ setValue(v);
22
+ }, disabled: disabled, value: value, type: "simulate", appearance: "button", placeholder: placeholder, options: options }))));
23
+ }
24
+ export function PureSelectH5(props) {
25
+ const { placeholder, name, disabled, onChange = noop, options, layout, className, } = props;
26
+ const [value, setValue] = useSyncValue(props.value);
27
+ const subCls = classNames({
28
+ 'weui-cell': true,
29
+ 'weui-cell_active': true,
30
+ 'weui-cell_form': true,
31
+ 'weui-flex__item': layout !== 'vertical',
32
+ 'weui-cell_disabled': disabled,
33
+ });
34
+ const onClick = () => {
35
+ weui.picker(options, {
36
+ id: String(Date.now()),
37
+ defaultValue: [value || options[0].value],
38
+ onConfirm(result) {
39
+ const item = result[0];
40
+ setValue(item.value);
41
+ onChange(item.value);
42
+ },
43
+ className,
44
+ });
45
+ };
46
+ const currentLabel = useMemo(() => {
47
+ const currentOpt = options.find((opt) => opt.value === value);
48
+ if (!currentOpt)
49
+ return '';
50
+ return currentOpt.label;
51
+ }, [options, value]);
52
+ return (React.createElement("div", { className: subCls },
53
+ React.createElement("div", { className: "weui-cell__bd weui-flex" },
54
+ React.createElement("input", { onClick: onClick, className: "weui-input", type: "select", name: name, placeholder: placeholder, value: currentLabel, disabled: disabled, autoComplete: 'off', readOnly: true, "data-testid": "form-item-select" }))));
55
+ }
@@ -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, tipBlock, enumName, dataSourceName, viewId, format, defaultValue, startDate, endDate, defaultDate, startTime, endTime, defaultTime, defaultRegion, defaultMutiRegion, regionType, separator, onChange, }: 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, onChange, }: PropsType): JSX.Element;
4
4
  export declare function decodeIsoDatetime(isoStringOrTimesnap: any, type: any, dateMode?: string): any;
5
5
  /**
6
6
  * 根据时间模式,构造 new Date()的传参格式单个日期和时间组件值
@@ -5,35 +5,32 @@ import isObjectEqual from '../../../utils/isObjectEqual';
5
5
  import { regionPicker, getRegionTree, getAreaCode } from './region/index';
6
6
  import { defaultProps, moment } from './index';
7
7
  import { timePicker, yearPicker, monthPicker } from './time';
8
- import { callDataSource, callWedaApi } from '../../../utils/tcb';
9
- import destr from 'destr';
10
8
  import { emptyObject } from '../../../utils/constant';
11
- import { getWhereList } from '../../../utils/platform';
9
+ import { PureSelectH5 } from './dropdown-select/ui';
10
+ import { useOptions } from './use-options';
12
11
  export default function Select({
13
12
  // 系统属性
14
13
  events = emptyObject,
15
14
  // 组件属性
16
15
  name, placeholder, layout, mode, dateMode = 'day', disabled = false,
17
16
  // selector mode
18
- range = defaultProps.range, where, primaryField, tipBlock, enumName, dataSourceName, viewId, format, defaultValue,
17
+ range = defaultProps.range, where, primaryField, enumName, dataSourceName, viewId, format, defaultValue,
19
18
  // date mode
20
19
  startDate, endDate, defaultDate,
21
20
  // time mode
22
21
  startTime, endTime, defaultTime,
23
22
  // region mode
24
- defaultRegion, defaultMutiRegion, regionType, separator, onChange, }) {
23
+ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
25
24
  var _a;
26
25
  const [date, setDate] = React.useState(decodeIsoDatetime(defaultDate, 'date', dateMode));
27
26
  const [time, setTime] = React.useState(decodeIsoDatetime(defaultTime, 'time'));
28
27
  const [regioDepth, setRegionDepth] = React.useState(3);
29
28
  const [regionData, setRegionData] = React.useState([]);
30
29
  const [regionTree, setRegionTree] = React.useState([]);
30
+ const [typeRegion, setTypeRegion] = React.useState(regionType);
31
31
  const [region, setRegion] = React.useState(defaultRegion);
32
32
  const [mutiRegion, setMutiRegion] = React.useState([]);
33
- const [typeRegion, setTypeRegion] = React.useState(regionType);
34
33
  const [selectedValue, setSelectedValue] = React.useState(defaultValue);
35
- const [option, setOption] = React.useState([{ label: '', value: '' }]);
36
- const [records, setRecords] = React.useState([]);
37
34
  // 两次默认值不同, 需要刷新
38
35
  const prevDefaultRef = React.useRef({});
39
36
  React.useEffect(() => {
@@ -95,7 +92,7 @@ defaultRegion, defaultMutiRegion, regionType, separator, onChange, }) {
95
92
  (_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: defaultMutiRegion, result: changeValue });
96
93
  }
97
94
  };
98
- const regionTreeMode = React.useMemo(() => {
95
+ React.useEffect(() => {
99
96
  if (mode == 'region' || mode == 'mutiRegion') {
100
97
  if (regionData.length < 1) {
101
98
  getAreaCode().then((value) => {
@@ -130,95 +127,6 @@ defaultRegion, defaultMutiRegion, regionType, separator, onChange, }) {
130
127
  }
131
128
  }
132
129
  }, [regionType, mode, regionData]);
133
- React.useEffect(() => {
134
- // tcb过滤参数
135
- const whereEffected = [].concat(getWhereList(where));
136
- if ((format === 'father-son' || format === 'related') &&
137
- dataSourceName &&
138
- viewId) {
139
- fetchData({
140
- dataSourceName: dataSourceName,
141
- viewId: viewId,
142
- methodName: 'wedaGetRecords',
143
- params: whereEffected,
144
- });
145
- }
146
- }, [where]);
147
- // 获取数据列表中主列字段,将其作为选项
148
- React.useEffect(() => {
149
- var _a;
150
- if (records && records.length !== 0 && primaryField) {
151
- const option = records.map((item) => {
152
- return {
153
- label: item[primaryField] || item._id,
154
- value: item._id,
155
- };
156
- });
157
- setOption(option);
158
- }
159
- else {
160
- setOption([{ label: '', value: '' }]);
161
- setSelectedValue('');
162
- (_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: '' });
163
- }
164
- }, [records]);
165
- // 获取数据列表
166
- const fetchData = async (param) => {
167
- let pageNo = 1;
168
- const pageSize = 200;
169
- let records = [];
170
- let total = 99999;
171
- for (let index = 0; index < Math.floor(total / pageSize) + 1; index++) {
172
- const data = await callDataSource({
173
- dataSourceName: param.dataSourceName,
174
- viewId: param.viewId,
175
- methodName: param.methodName,
176
- params: {
177
- where: param.params,
178
- pageNo: pageNo,
179
- pageSize: pageSize,
180
- },
181
- });
182
- pageNo = pageNo + 1;
183
- if (data === null || data === void 0 ? void 0 : data.records) {
184
- total = (data === null || data === void 0 ? void 0 : data.total) || 0;
185
- records = records.concat(data === null || data === void 0 ? void 0 : data.records);
186
- }
187
- }
188
- if (records) {
189
- setRecords(records);
190
- }
191
- };
192
- React.useEffect(() => {
193
- // 如果绑定字段类型为枚举,且传入自定义选项集的名称则默认使用自定义选项集的内容作为选项
194
- if (format === 'x-enum' && enumName) {
195
- fetchEnumData({ OptNameList: [enumName], PageIndex: 1, PageSize: 10 });
196
- }
197
- }, [enumName]);
198
- // 获取自定义选项集
199
- const fetchEnumData = async (param) => {
200
- var _a, _b;
201
- const data = await callWedaApi({
202
- action: 'DescribeGeneralOptionsDetailList',
203
- data: param,
204
- });
205
- const config = (_b = destr((_a = data === null || data === void 0 ? void 0 : data.Items[0]) === null || _a === void 0 ? void 0 : _a.Config)) !== null && _b !== void 0 ? _b : [];
206
- const enumOption = config.map((item) => {
207
- return {
208
- label: item.value,
209
- value: item.key,
210
- };
211
- });
212
- setOption(enumOption);
213
- };
214
- const isFlex = layout !== 'vertical';
215
- const subCls = classNames({
216
- 'weui-cell': true,
217
- 'weui-cell_active': true,
218
- 'weui-cell_form': true,
219
- 'weui-flex__item': isFlex,
220
- 'weui-cell_disabled': disabled,
221
- });
222
130
  const onDateclick = function () {
223
131
  const options = {
224
132
  className: 'weda-ui weda-picker',
@@ -272,48 +180,20 @@ defaultRegion, defaultMutiRegion, regionType, separator, onChange, }) {
272
180
  },
273
181
  });
274
182
  };
275
- const onSelect = function () {
276
- if (format === 'father-son' ||
277
- format === 'related' ||
278
- format === 'x-enum') {
279
- weui.picker(option, {
280
- id: String(Date.now()),
281
- defaultValue: [selectedValue || option[0].value],
282
- onConfirm(result) {
283
- var _a;
284
- const item = result[0];
285
- setSelectedValue(item === null || item === void 0 ? void 0 : item.value);
286
- (_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: item === null || item === void 0 ? void 0 : item.value });
287
- },
288
- className: 'weda-ui weda-picker',
289
- });
290
- }
291
- else {
292
- weui.picker(range, {
293
- id: String(Date.now()),
294
- defaultValue: [selectedValue || range[0].value],
295
- onConfirm(result) {
296
- var _a;
297
- const item = result[0];
298
- setSelectedValue(item === null || item === void 0 ? void 0 : item.value);
299
- (_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: item === null || item === void 0 ? void 0 : item.value });
300
- },
301
- className: 'weda-ui weda-picker',
302
- });
303
- }
304
- };
305
183
  let regionTimer;
306
184
  const momentClick = async () => {
307
- regionTimer = setInterval(() => {
308
- setTimeout(() => {
309
- if (regionTree.length != 0) {
310
- onRegionClick();
311
- }
312
- }, 0);
313
- }, regionTree.length == 0 ? 500 : 0);
185
+ const cb = () => {
186
+ clearTimeout(regionTimer);
187
+ if (regionTree.length > 0) {
188
+ onRegionClick();
189
+ }
190
+ else {
191
+ setTimeout(cb, 200);
192
+ }
193
+ };
194
+ regionTimer = setTimeout(cb, 200);
314
195
  };
315
196
  const onRegionClick = function () {
316
- clearInterval(regionTimer);
317
197
  let defaultValue = [];
318
198
  if (mode == 'region') {
319
199
  defaultRegion && defaultRegion.length <= 0
@@ -363,10 +243,6 @@ defaultRegion, defaultMutiRegion, regionType, separator, onChange, }) {
363
243
  onTimeClick();
364
244
  break;
365
245
  }
366
- case 'selector': {
367
- onSelect();
368
- break;
369
- }
370
246
  case 'region': {
371
247
  momentClick();
372
248
  break;
@@ -381,16 +257,9 @@ defaultRegion, defaultMutiRegion, regionType, separator, onChange, }) {
381
257
  }
382
258
  };
383
259
  const result = React.useMemo(() => {
384
- var _a, _b;
260
+ var _a;
385
261
  let selectLabel = '';
386
- if (format === 'father-son' ||
387
- format === 'related' ||
388
- format === 'x-enum') {
389
- selectLabel = (_a = (option !== null && option !== void 0 ? option : []).find((item) => item.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label;
390
- }
391
- else {
392
- selectLabel = (_b = (range !== null && range !== void 0 ? range : []).find((item) => item.value === selectedValue)) === null || _b === void 0 ? void 0 : _b.label;
393
- }
262
+ selectLabel = (_a = (range !== null && range !== void 0 ? range : []).find((item) => item.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label;
394
263
  return {
395
264
  selector: selectLabel,
396
265
  date: date,
@@ -398,7 +267,42 @@ defaultRegion, defaultMutiRegion, regionType, separator, onChange, }) {
398
267
  region: (region || []).join(separator),
399
268
  mutiRegion: mutiRegion,
400
269
  };
401
- }, [range, selectedValue, date, time, region, separator, mutiRegion, option]);
270
+ }, [range, selectedValue, date, time, region, separator, mutiRegion]);
271
+ const subCls = classNames({
272
+ 'weui-cell': true,
273
+ 'weui-cell_active': true,
274
+ 'weui-cell_form': true,
275
+ 'weui-flex__item': layout !== 'vertical',
276
+ 'weui-cell_disabled': disabled,
277
+ });
278
+ let params = {
279
+ controlledValue: range,
280
+ };
281
+ if (format === 'father-son' || format === 'related') {
282
+ params = {
283
+ format,
284
+ dataSourceName,
285
+ viewId,
286
+ where,
287
+ primaryField,
288
+ controlledValue: range,
289
+ };
290
+ }
291
+ else if (format === 'x-enum') {
292
+ params = {
293
+ format,
294
+ enumName,
295
+ controlledValue: range,
296
+ };
297
+ }
298
+ const [options] = useOptions(params);
299
+ if (mode === 'selector') {
300
+ return (React.createElement(PureSelectH5, { className: "weda-ui weda-picker", name: name, value: selectedValue, placeholder: placeholder, disabled: disabled, options: options, onChange: (value) => {
301
+ var _a;
302
+ setSelectedValue(value);
303
+ (_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
304
+ } }));
305
+ }
402
306
  return (React.createElement("div", { className: subCls },
403
307
  React.createElement("div", { className: "weui-cell__bd weui-flex" },
404
308
  React.createElement("input", { onClick: onClick, className: "weui-input", type: "select", name: name, placeholder: placeholder, value: (_a = result[mode]) !== null && _a !== void 0 ? _a : '', disabled: disabled, autoComplete: 'off', readOnly: true, "data-testid": "form-item-select" }))));
@@ -12,7 +12,7 @@ export interface PropsType extends CommonFormPropsType {
12
12
  dataSourceName?: string;
13
13
  viewId?: string;
14
14
  enumName?: string;
15
- format?: string;
15
+ format?: 'father-son' | 'related' | 'x-enum';
16
16
  primaryField?: string;
17
17
  tipBlock?: any;
18
18
  where?: {