@cloudbase/weda-ui 3.7.4 → 3.7.5

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 (44) hide show
  1. package/dist/configs/components/wd-form-arr.d.ts +6 -18
  2. package/dist/configs/components/wd-form-arr.js +12 -23
  3. package/dist/configs/components/wd-form-obj.d.ts +7 -17
  4. package/dist/configs/components/wd-form-obj.js +10 -22
  5. package/dist/configs/components/wd-select-multiple.d.ts +2 -0
  6. package/dist/configs/components/wd-select-multiple.js +1 -0
  7. package/dist/configs/components/wd-select.d.ts +2 -0
  8. package/dist/configs/components/wd-select.js +1 -0
  9. package/dist/configs/index.d.ts +28 -70
  10. package/dist/configs/type-utils/type-form.d.ts +6 -0
  11. package/dist/configs/type-utils/type-form.js +22 -1
  12. package/dist/configs/type-utils/x-runtime-default.d.ts +1 -0
  13. package/dist/configs/type-utils/x-runtime-default.js +1 -0
  14. package/dist/style/index.scss +1 -1
  15. package/dist/web/components/customer-service/customer-service.js +0 -2
  16. package/dist/web/components/form/select/dropdown-select/index.d.ts +2 -1
  17. package/dist/web/components/form/select/dropdown-select/index.js +12 -4
  18. package/dist/web/components/form/select/dropdown-select/ui.d.ts +1 -0
  19. package/dist/web/components/form/select/dropdown-select/ui.js +4 -4
  20. package/dist/web/components/form/select/h5.d.ts +1 -1
  21. package/dist/web/components/form/select/h5.js +2 -2
  22. package/dist/web/components/form/select/index.d.ts +1 -0
  23. package/dist/web/components/form/select/index.js +2 -2
  24. package/dist/web/components/form/selectMultiple/dropdown-select/index.d.ts +2 -1
  25. package/dist/web/components/form/selectMultiple/dropdown-select/index.js +8 -3
  26. package/dist/web/components/form/selectMultiple/dropdown-select/ui.d.ts +1 -0
  27. package/dist/web/components/form/selectMultiple/dropdown-select/ui.js +4 -4
  28. package/dist/web/components/form/selectMultiple/h5.d.ts +1 -1
  29. package/dist/web/components/form/selectMultiple/h5.js +2 -2
  30. package/dist/web/components/form/selectMultiple/index.d.ts +1 -0
  31. package/dist/web/components/form/selectMultiple/index.js +2 -2
  32. package/dist/web/components/phone/index.js +0 -2
  33. package/dist/web/components/share/index.js +0 -2
  34. package/dist/web/components/table/BaseTable.js +1 -0
  35. package/dist/web/components/wd-form-arr/wd-form-arr.js +1 -1
  36. package/dist/web/components/wd-form-item/wd-form-item.js +13 -6
  37. package/dist/web/components/wd-form-obj/base-form-obj.d.ts +1 -0
  38. package/dist/web/components/wd-form-obj/base-form-obj.js +7 -3
  39. package/dist/web/components/wd-official-account/index.js +0 -2
  40. package/dist/web/components/wd-select/wd-select.js +2 -2
  41. package/dist/web/components/wd-select-multiple/wd-select-multiple.js +2 -2
  42. package/dist/web/components/wd-table/utils/index.js +9 -8
  43. package/dist/web/utils/hooks/useCanPreview.js +0 -1
  44. package/package.json +5 -3
@@ -2,8 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { forwardRef } from 'react';
3
3
  import { Bubble, ConfigProvider } from 'tea-component';
4
4
  import { emptyObject } from '../../utils/constant';
5
- // @ts-ignore忽略ts交验
6
- // eslint-disable-next-line rulesdir/no-phantom-deps
7
5
  import { autorun } from 'mobx';
8
6
  import '../style';
9
7
  export const CustomerService = forwardRef(function CustomerService(props, ref) {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, onSearchValueInput, ignoreCase, }: {
2
+ export declare function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, onSearchValueInput, ignoreCase, staticSearchable, }: {
3
3
  params: any;
4
4
  selectedValue: any;
5
5
  updateValue: any;
@@ -9,4 +9,5 @@ export declare function PureSelect({ params, selectedValue, updateValue, placeho
9
9
  isShow: any;
10
10
  onSearchValueInput: any;
11
11
  ignoreCase?: boolean;
12
+ staticSearchable?: boolean;
12
13
  }): JSX.Element;
@@ -8,7 +8,7 @@ import { Status } 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, }) {
11
+ export function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, onSearchValueInput, ignoreCase = true, staticSearchable = true, }) {
12
12
  const isRequestingRef = useRef(false);
13
13
  const [status, setStatus] = useState(Status.ALl_EMPTY);
14
14
  const [options, setOptions] = useState([]);
@@ -129,12 +129,17 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
129
129
  return isSearch ? searchStatus : status;
130
130
  }, [isSearch, searchStatus, status]);
131
131
  const currentOption = useMemo(() => {
132
- const option = isSearch ? searchOptions : options;
132
+ const option = isSearch && staticSearchable ? searchOptions : options;
133
133
  return platform === 'h5' ? option : transFormatTeaSelectKey(option);
134
- }, [isSearch, searchOptions, options, platform]);
134
+ }, [isSearch, searchOptions, options, platform, staticSearchable]);
135
135
  const handleSearch = () => {
136
136
  // 本地搜索
137
137
  if (!isTurnPages || options.length < PAGE_SIZE) {
138
+ // 不启用前端查询
139
+ if (!staticSearchable) {
140
+ setSearchStatus(Status.FINISH);
141
+ return;
142
+ }
138
143
  const searchOpt = options.filter((item) => {
139
144
  if (item.label) {
140
145
  if (ignoreCase) {
@@ -205,9 +210,12 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
205
210
  if (v === searchValue)
206
211
  return;
207
212
  setSearchPage(1);
208
- setSearchStatus(Status.LOADING);
209
213
  setSearchOptions([]);
210
214
  setSearchValue(v);
215
+ if (staticSearchable) {
216
+ // 启用前端查询时,添加loading
217
+ setSearchStatus(Status.LOADING);
218
+ }
211
219
  };
212
220
  /**
213
221
  * 精确查找
@@ -10,6 +10,7 @@ interface IPureSelectProps extends Pick<SelectProps, 'size' | 'disabled' | 'valu
10
10
  readOnly?: boolean;
11
11
  onSearchValueInput?: (value: string) => void;
12
12
  ignoreCase?: boolean;
13
+ staticSearchable?: boolean;
13
14
  }
14
15
  export declare function PureSelectPc(props: IPureSelectProps): JSX.Element;
15
16
  export declare function PureSelectH5(props: IPureSelectProps): JSX.Element;
@@ -8,9 +8,9 @@ import { isNil } from '../../../../utils/lodash';
8
8
  import { WdFormItemReadOnly } from '../../../wd-form-item';
9
9
  import lodashGet from 'lodash.get';
10
10
  export function PureSelectPc(props) {
11
- const { size, onChange = noop, value, placeholder, params, disabled, onSearchValueInput, ignoreCase, } = props;
11
+ const { size, onChange = noop, value, placeholder, params, disabled, onSearchValueInput, ignoreCase, staticSearchable, } = props;
12
12
  const previousValueRef = useRef();
13
- return (_jsx(PureSelect, { ignoreCase: ignoreCase, isShow: false, params: params, placeholder: placeholder, size: size, selectedValue: value, disabled: disabled, onSearchValueInput: onSearchValueInput, updateValue: (value, triggerEvent) => {
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) => {
14
14
  if (previousValueRef.current !== value) {
15
15
  onChange(value, triggerEvent);
16
16
  previousValueRef.current = value;
@@ -18,7 +18,7 @@ export function PureSelectPc(props) {
18
18
  } }));
19
19
  }
20
20
  export function PureSelectH5(props) {
21
- const { placeholder, name, disabled, onChange = noop, layout, className, params, onSearchValueInput, ignoreCase, } = props;
21
+ const { placeholder, name, disabled, onChange = noop, layout, className, params, onSearchValueInput, ignoreCase, staticSearchable, } = props;
22
22
  const [value, setValue] = useSyncValue(props.value);
23
23
  const [currentLabel, setCurrentLabel] = useState('');
24
24
  const [isShow, setIsShow] = useState(false);
@@ -55,5 +55,5 @@ export function PureSelectH5(props) {
55
55
  const onClick = () => {
56
56
  setIsShow(true);
57
57
  };
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, { ignoreCase: ignoreCase, params: params, updateValue: onChooseCallback, selectedValue: value, isShow: isShow, size: undefined, disabled: undefined, onSearchValueInput: onSearchValueInput, placeholder: undefined })] }));
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 })] }));
59
59
  }
@@ -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, }: 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, }: PropsType): JSX.Element;
4
4
  export declare function decodeIsoDatetime(isoStringOrTimesnap: any, type: any, dateMode?: string): any;
5
5
  /**
6
6
  * 根据时间模式,构造 new Date()的传参格式单个日期和时间组件值
@@ -27,7 +27,7 @@ startDate, endDate, defaultDate,
27
27
  // time mode
28
28
  startTime, endTime, defaultTime,
29
29
  // region mode
30
- defaultRegion, defaultMutiRegion, separator, regionType, clearable = false, onChange, onSearchValueInput, readOnly, ignoreCase, }) {
30
+ defaultRegion, defaultMutiRegion, separator, regionType, clearable = false, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, }) {
31
31
  var _a;
32
32
  const { classPrefix } = useConfig();
33
33
  const [date, setDate] = React.useState(decodeIsoDatetime(defaultDate, 'date', dateMode));
@@ -339,7 +339,7 @@ defaultRegion, defaultMutiRegion, separator, regionType, clearable = false, onCh
339
339
  };
340
340
  }
341
341
  if (mode === 'selector') {
342
- return (_jsx(PureSelectH5, { ignoreCase: ignoreCase, className: "weda-ui weda-picker", name: name, value: selectedValue, placeholder: placeholder, disabled: disabled, readOnly: readOnly, params: params, onChange: (value, triggerEvent = false) => {
342
+ return (_jsx(PureSelectH5, { staticSearchable: staticSearchable, ignoreCase: ignoreCase, className: "weda-ui weda-picker", name: name, value: selectedValue, placeholder: placeholder, disabled: disabled, readOnly: readOnly, params: params, onChange: (value, triggerEvent = false) => {
343
343
  var _a;
344
344
  setSelectedValue(value);
345
345
  onChange === null || onChange === void 0 ? void 0 : onChange(value);
@@ -56,6 +56,7 @@ export interface PropsType extends CommonFormPropsType {
56
56
  clearable?: boolean;
57
57
  readOnly?: boolean;
58
58
  ignoreCase?: boolean;
59
+ staticSearchable?: boolean;
59
60
  }
60
61
  export declare const defaultProps: {
61
62
  events: {};
@@ -70,7 +70,7 @@ export const defaultProps = {
70
70
  separator: ',',
71
71
  };
72
72
  // const button = <Button type="icon" icon="more" />;
73
- function SelectPc({ name, where, dataSourceName, viewId, format, primaryField, enumName, defaultValue, placeholder = '请选择', mode = 'selector', dateMode = 'day', events = emptyObject, disabled = false, range = defaultProps.range, startDate, endDate, defaultDate, defaultTime, startTime, endTime, defaultRegion, defaultMutiRegion, regionType, separator = defaultProps.separator, size = defaultProps.size, clearable = false, onChange, onSearchValueInput, readOnly, ignoreCase, }) {
73
+ function SelectPc({ name, where, dataSourceName, viewId, format, primaryField, enumName, defaultValue, placeholder = '请选择', mode = 'selector', dateMode = 'day', events = emptyObject, disabled = false, range = defaultProps.range, startDate, endDate, defaultDate, defaultTime, startTime, endTime, defaultRegion, defaultMutiRegion, regionType, separator = defaultProps.separator, size = defaultProps.size, clearable = false, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, }) {
74
74
  const { classPrefix } = useConfig();
75
75
  // 两次默认值不同, 需要刷新
76
76
  const prevDefaultRef = React.useRef();
@@ -187,7 +187,7 @@ function SelectPc({ name, where, dataSourceName, viewId, format, primaryField, e
187
187
  const createDropdown = () => {
188
188
  switch (mode) {
189
189
  case 'selector':
190
- return (_jsx(PureSelectPc, { ignoreCase: ignoreCase, button: '', name: name, params: params, disabled: disabled, placeholder: placeholder, size: size, value: selectedValue, onChange: (value, triggerEvent = false) => {
190
+ return (_jsx(PureSelectPc, { ignoreCase: ignoreCase, staticSearchable: staticSearchable, button: '', name: name, params: params, disabled: disabled, placeholder: placeholder, size: size, value: selectedValue, onChange: (value, triggerEvent = false) => {
191
191
  var _a;
192
192
  onChange === null || onChange === void 0 ? void 0 : onChange(value);
193
193
  if (triggerEvent) {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, closeModal, allOption, onSearchValueInput, ignoreCase, }: {
2
+ export declare function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, closeModal, allOption, onSearchValueInput, ignoreCase, staticSearchable, }: {
3
3
  params: any;
4
4
  selectedValue: any;
5
5
  updateValue: any;
@@ -11,4 +11,5 @@ export declare function PureSelect({ params, selectedValue, updateValue, placeho
11
11
  allOption: any;
12
12
  onSearchValueInput: any;
13
13
  ignoreCase?: boolean;
14
+ staticSearchable?: boolean;
14
15
  }): JSX.Element;
@@ -7,7 +7,7 @@ import { usePlatform } from '../../../../utils/platform';
7
7
  import { Status } from '../status';
8
8
  import { useDeepCompareEffect } from '@react-hookz/web';
9
9
  import { useRecycle } from '../../../../utils/hooks/useRecycle';
10
- export function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, closeModal, allOption, onSearchValueInput, ignoreCase = true, }) {
10
+ export function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, closeModal, allOption, onSearchValueInput, ignoreCase = true, staticSearchable = true, }) {
11
11
  const isRequestingRef = useRef(false);
12
12
  const [status, setStatus] = useState(Status.ALl_EMPTY);
13
13
  const [options, setOptions] = useState([]);
@@ -98,9 +98,9 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
98
98
  return isSearch ? searchStatus : status;
99
99
  }, [isSearch, searchStatus, status]);
100
100
  const currentOption = useMemo(() => {
101
- const option = isSearch ? searchOptions : options;
101
+ const option = isSearch && staticSearchable ? searchOptions : options;
102
102
  return platform === 'h5' ? option : transFormatTeaSelectKey(option);
103
- }, [isSearch, searchOptions, options, platform]);
103
+ }, [isSearch, searchOptions, options, platform, staticSearchable]);
104
104
  const allOptions = useMemo(() => {
105
105
  return transFormatTeaSelectKey(options);
106
106
  }, [options]);
@@ -111,6 +111,11 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
111
111
  useEffect(() => {
112
112
  // 本地搜索
113
113
  if (!isTurnPages || options.length < PAGE_SIZE) {
114
+ // 不启用前端查询
115
+ if (!staticSearchable) {
116
+ setSearchStatus(Status.FINISH);
117
+ return;
118
+ }
114
119
  const searchOpt = options.filter((item) => {
115
120
  if (item.label) {
116
121
  if (ignoreCase) {
@@ -11,6 +11,7 @@ interface IPureSelectProps extends Pick<SelectProps, 'size' | 'disabled' | 'plac
11
11
  readOnly?: boolean;
12
12
  onSearchValueInput?: (value: string) => void;
13
13
  ignoreCase?: boolean;
14
+ staticSearchable?: boolean;
14
15
  }
15
16
  export declare function PureSelectPc(props: IPureSelectProps): JSX.Element;
16
17
  export declare function PureSelectH5(props: IPureSelectProps): JSX.Element;
@@ -11,12 +11,12 @@ import lodashGet from 'lodash.get';
11
11
  import equal from '../../../../utils/isObjectEqual';
12
12
  import { arrayToMap } from '../../../../utils/tool';
13
13
  export function PureSelectPc(props) {
14
- const { size, onChange, value, placeholder, params, disabled, ignoreCase, onSearchValueInput, } = props;
14
+ const { size, onChange, value, placeholder, params, disabled, ignoreCase, staticSearchable, onSearchValueInput, } = props;
15
15
  const previousValueRef = useRef(value);
16
16
  useEffect(() => {
17
17
  previousValueRef.current = props.value;
18
18
  }, [props.value]);
19
- return (_jsx(PureSelect, { ignoreCase: ignoreCase, isShow: false, params: params, placeholder: placeholder, size: size, selectedValue: value, disabled: disabled, onSearchValueInput: onSearchValueInput, updateValue: (v, triggerEvent) => {
19
+ return (_jsx(PureSelect, { staticSearchable: staticSearchable, ignoreCase: ignoreCase, isShow: false, params: params, placeholder: placeholder, size: size, selectedValue: value, disabled: disabled, onSearchValueInput: onSearchValueInput, updateValue: (v, triggerEvent) => {
20
20
  if (previousValueRef.current != v) {
21
21
  if (Array.isArray(v) && v.length > 50) {
22
22
  alertErrorMessage({ message: '最多选择50条数据' });
@@ -29,7 +29,7 @@ export function PureSelectPc(props) {
29
29
  }, closeModal: undefined, allOption: () => { } }));
30
30
  }
31
31
  export function PureSelectH5(props) {
32
- const { placeholder, name, disabled, onChange = noop, layout, className, params, ignoreCase, onSearchValueInput, } = props;
32
+ const { placeholder, name, disabled, onChange = noop, layout, className, params, ignoreCase, onSearchValueInput, staticSearchable, } = props;
33
33
  const [value, setValue] = useSyncValue(props.value);
34
34
  const previousValueRef = useRef(value);
35
35
  const [currentMultiLabels, setCurrentMultiLabels] = useState([]);
@@ -109,5 +109,5 @@ export function PureSelectH5(props) {
109
109
  type: "select", name: name, placeholder: placeholder, value: currentMultiLabels, disabled: disabled, autoComplete: 'off', readOnly: true, "data-testid": "form-item-select-multiple" }) }), Array.isArray(currentMultiLabels) &&
110
110
  currentMultiLabels.length > 0 && (_jsx("span", { className: 'weui-input-clear', onClick: () => {
111
111
  onChooseCallback(null);
112
- } })), _jsx("span", { className: 'weui-input-arrow' })] }) }) }), _jsx(PureSelect, { ignoreCase: ignoreCase, params: params, updateValue: onChooseCallback, selectedValue: value, isShow: isShow, size: undefined, disabled: undefined, placeholder: undefined, onSearchValueInput: onSearchValueInput, closeModal: close, allOption: getAllOption })] }));
112
+ } })), _jsx("span", { className: 'weui-input-arrow' })] }) }) }), _jsx(PureSelect, { staticSearchable: staticSearchable, ignoreCase: ignoreCase, params: params, updateValue: onChooseCallback, selectedValue: value, isShow: isShow, size: undefined, disabled: undefined, placeholder: undefined, onSearchValueInput: onSearchValueInput, closeModal: close, allOption: getAllOption })] }));
113
113
  }
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { PropsType } from './index';
3
- export default function SelectH5({ events, name, placeholder, disabled, range, primaryField, dataSourceName, format, onChange, onSearchValueInput, defaultValue, readOnly, ignoreCase, }: PropsType): JSX.Element;
3
+ export default function SelectH5({ events, name, placeholder, disabled, range, primaryField, dataSourceName, format, onChange, onSearchValueInput, defaultValue, readOnly, ignoreCase, staticSearchable, }: PropsType): JSX.Element;
@@ -3,7 +3,7 @@ import { defaultProps } from './index';
3
3
  import { emptyObject } from '../../../utils/constant';
4
4
  import { PureSelectH5 } from './dropdown-select/ui';
5
5
  import { useSyncValue } from '../../../utils/hooks/useSyncValue';
6
- export default function SelectH5({ events = emptyObject, name, placeholder, disabled = false, range = defaultProps.range, primaryField, dataSourceName, format, onChange, onSearchValueInput, defaultValue, readOnly, ignoreCase, }) {
6
+ export default function SelectH5({ events = emptyObject, name, placeholder, disabled = false, range = defaultProps.range, primaryField, dataSourceName, format, onChange, onSearchValueInput, defaultValue, readOnly, ignoreCase, staticSearchable, }) {
7
7
  const [selectedValue, setSelectedValue] = useSyncValue(defaultValue);
8
8
  let params = { controlledValue: range };
9
9
  if (format === 'many-many' || format === 'one-many') {
@@ -14,7 +14,7 @@ export default function SelectH5({ events = emptyObject, name, placeholder, disa
14
14
  controlledValue: range,
15
15
  };
16
16
  }
17
- return (_jsx(PureSelectH5, { ignoreCase: ignoreCase, className: "weda-ui weda-picker", name: name, value: selectedValue, placeholder: placeholder, disabled: disabled, readOnly: readOnly, params: params, onChange: (value) => {
17
+ return (_jsx(PureSelectH5, { staticSearchable: staticSearchable, ignoreCase: ignoreCase, className: "weda-ui weda-picker", name: name, value: selectedValue, placeholder: placeholder, disabled: disabled, readOnly: readOnly, params: params, onChange: (value) => {
18
18
  var _a;
19
19
  setSelectedValue(value);
20
20
  onChange === null || onChange === void 0 ? void 0 : onChange(value);
@@ -40,6 +40,7 @@ export interface PropsType extends CommonFormPropsType {
40
40
  isTurnPages?: boolean;
41
41
  readOnly?: boolean;
42
42
  ignoreCase?: boolean;
43
+ staticSearchable?: boolean;
43
44
  }
44
45
  export declare const defaultProps: {
45
46
  events: {};
@@ -54,7 +54,7 @@ export const defaultProps = {
54
54
  requiredFlag: false,
55
55
  range: [],
56
56
  };
57
- function SelectPc({ dataSourceName, format, primaryField, defaultValue, placeholder = '请选择', events = emptyObject, disabled = false, range = defaultProps.range, size = defaultProps.size, onChange, onSearchValueInput, readOnly, ignoreCase, }) {
57
+ function SelectPc({ dataSourceName, format, primaryField, defaultValue, placeholder = '请选择', events = emptyObject, disabled = false, range = defaultProps.range, size = defaultProps.size, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, }) {
58
58
  const [selectedValue, setSelectedValue] = useSyncValue(defaultValue);
59
59
  let params = { controlledValue: range };
60
60
  if (format === 'many-many' || format === 'one-many') {
@@ -66,7 +66,7 @@ function SelectPc({ dataSourceName, format, primaryField, defaultValue, placehol
66
66
  };
67
67
  }
68
68
  const createDropdown = () => {
69
- return (_jsx(PureSelectPc, { ignoreCase: ignoreCase, params: params, disabled: disabled, readOnly: readOnly, placeholder: placeholder, size: size, value: selectedValue, onChange: (value, triggerEvent) => {
69
+ return (_jsx(PureSelectPc, { ignoreCase: ignoreCase, staticSearchable: staticSearchable, params: params, disabled: disabled, readOnly: readOnly, placeholder: placeholder, size: size, value: selectedValue, onChange: (value, triggerEvent) => {
70
70
  var _a;
71
71
  onChange && onChange(value);
72
72
  setSelectedValue(value);
@@ -8,8 +8,6 @@ import * as React from 'react';
8
8
  import Button from '../../components/button';
9
9
  import { Bubble, ConfigProvider, ExternalLink } from 'tea-component';
10
10
  import '../style';
11
- // @ts-ignore忽略ts交验
12
- // eslint-disable-next-line rulesdir/no-phantom-deps
13
11
  import { autorun } from 'mobx';
14
12
  const Phone = (props) => {
15
13
  var _a, _b;
@@ -8,8 +8,6 @@ import * as React from 'react';
8
8
  import { Bubble, ConfigProvider } from 'tea-component';
9
9
  import Button from '../../components/button';
10
10
  import '../style';
11
- // @ts-ignore忽略ts交验
12
- // eslint-disable-next-line rulesdir/no-phantom-deps
13
11
  import { autorun } from 'mobx';
14
12
  const Share = (props) => {
15
13
  var _a, _b;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /* eslint-disable react-hooks/exhaustive-deps */
2
3
  import React, { useMemo, useEffect, useRef, useImperativeHandle, useState, } from 'react';
3
4
  import { Icon, Table, Button, Justify, Modal, message, TagSearchBox, useClassNames, Card, Row, Col, Checkbox, LoadingTip, Dropdown, List, Radio, Collapse, Form, } from 'tea-component';
4
5
  import InfiniteScroll from 'react-infinite-scroll-component';
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import { BaseFormObj } from '../wd-form-obj/base-form-obj';
4
4
  export const WdFormArr = forwardRef(function WdFormArr(props, ref) {
5
- return _jsx(BaseFormObj, { objType: "arr", ...props, ref: ref });
5
+ return _jsx(BaseFormObj, { objType: "arr", isRoot: true, ...props, ref: ref });
6
6
  });
@@ -11,16 +11,17 @@ import { X_RUNTIME_DEFAULT } from '../../../configs/type-utils/x-runtime-default
11
11
  * 表单项包裹,包括标题、文本提示、校验
12
12
  */
13
13
  export function WdFormItem(props) {
14
- const { id, className, style, label, labelVisible = X_RUNTIME_DEFAULT.labelVisible, labelTips = X_RUNTIME_DEFAULT.labelTips, labelWidth: _labelWidth = X_RUNTIME_DEFAULT.labelWidth, labelWrap = X_RUNTIME_DEFAULT.labelWrap, extra = X_RUNTIME_DEFAULT.extra, required = X_RUNTIME_DEFAULT.required, readOnly, children, testId, requiredFlag = X_RUNTIME_DEFAULT.requiredFlag, validateState, validateErrorMsg, readValue, borderedH5 = X_RUNTIME_DEFAULT.borderedH5, borderedPc = X_RUNTIME_DEFAULT.borderedPc, classRoot, controlAlign, inputId, isWdFormDetail, before, after, readBeforeAfter = true, visible = true, LabelContainer = null, } = props;
14
+ const { id, className, style, label, labelVisible = X_RUNTIME_DEFAULT.labelVisible, labelTips = X_RUNTIME_DEFAULT.labelTips, labelWidth: _labelWidth = X_RUNTIME_DEFAULT.labelWidth, labelWrap = X_RUNTIME_DEFAULT.labelWrap, extra = X_RUNTIME_DEFAULT.extra, required = X_RUNTIME_DEFAULT.required, readOnly, children, testId, requiredFlag = X_RUNTIME_DEFAULT.requiredFlag, validateState, validateErrorMsg, readValue, borderedH5 = X_RUNTIME_DEFAULT.borderedH5, borderedPc = X_RUNTIME_DEFAULT.borderedPc, classRoot, controlAlign, inputId, isWdFormDetail, before, after, readBeforeAfter = true, visible = true, LabelContainer = null, isRoot = true, } = props;
15
15
  const { classPrefix } = useConfig();
16
16
  const platform = usePlatform();
17
+ const isH5 = platform === 'h5';
17
18
  const labelAlign = useLabelAlign(props);
18
19
  const layout = useLayout(props);
19
20
  const labelWidth = convertPx(_labelWidth);
20
21
  const labelStyle = labelWidth ? { width: labelWidth } : {};
21
22
  const size = useSize(props);
22
23
  const iconSize = convertIconSize(size);
23
- const heightSize = size === 'xs' ? 'xs' : platform === 'h5' ? 'lg' : size;
24
+ const heightSize = size === 'xs' ? 'xs' : isH5 ? 'lg' : size;
24
25
  const widthSize = size === 'xs' ? 'lg' : size; // xs 没有宽度值,用 lg 来替代
25
26
  // 样式前缀定义
26
27
  const root = `${classPrefix}-${classRoot}`;
@@ -31,12 +32,14 @@ export function WdFormItem(props) {
31
32
  const itemWrap = `${classPrefix}-form-item-wrap`;
32
33
  const labelRoot = `${root}__label`;
33
34
  // 表单项样式
34
- const cls = classNames(item, className, `${classPrefix}-${platform}-form-item`, `${root}-root`, `${classPrefix}-${platform}-${classRoot}-root`, `item-size-height-${heightSize}`, `${itemLayout}-layout-${layout}`, `${item}--label-${labelAlign}`, {
35
+ const cls = classNames(item, className, `${classPrefix}-${platform}-form-item`, `item-size-height-${heightSize}`, `${itemLayout}-layout-${layout}`, `${item}--label-${labelAlign}`, {
36
+ [`${root}-root`]: isRoot,
37
+ [`${classPrefix}-${platform}-${classRoot}-root`]: isRoot,
35
38
  [`size-width-${widthSize}`]: !!widthSize && platform === 'pc',
36
39
  'size-width-hundred': true,
37
40
  'is-required': requiredFlag && required,
38
- 'is-borderless': platform === 'h5' ? !borderedH5 : !borderedPc,
39
- [`${item}--weui`]: platform === 'h5',
41
+ 'is-borderless': isH5 ? !borderedH5 : !borderedPc,
42
+ [`${item}--weui`]: isH5,
40
43
  [`${itemLayout}-horizontal-left`]: layout === 'horizontal' && labelAlign === 'left',
41
44
  [`${itemLayout}-horizontal-right`]: layout === 'horizontal' && labelAlign === 'right',
42
45
  [`${itemLayout}-vertical-left`]: layout === 'vertical' && labelAlign === 'left',
@@ -62,5 +65,9 @@ export function WdFormItem(props) {
62
65
  const Message = validateErrorMsg && (_jsx("p", { className: `${item}__help`, children: _jsx("span", { className: `${classPrefix}-g-text-${validateState} ${root}__error`, children: textToString(validateErrorMsg) }) }));
63
66
  if (!visible)
64
67
  return null;
65
- return (_jsxs("div", { className: cls, id: id, style: style, children: [_jsx("div", { className: itemWrap, children: LabelContainer ? (_jsx(LabelContainer, { Label: Label, Item: Item })) : (_jsxs(_Fragment, { children: [Label, Item] })) }), Message, Help] }));
68
+ return (_jsxs("div", { className: cls, id: isRoot ? id : null, style: style, children: [_jsx("div", { className: itemWrap, children: LabelContainer ? (_jsx(LabelContainerComp, { LabelContainer: LabelContainer, isRoot: isRoot, isH5: isH5, Label: Label, Item: Item })) : (_jsxs(_Fragment, { children: [Label, Item] })) }), Message, Help] }));
66
69
  }
70
+ const LabelContainerComp = ({ isRoot, isH5, Label, Item, LabelContainer }) => {
71
+ const showLabel = isRoot && !isH5;
72
+ return (_jsxs(_Fragment, { children: [showLabel && Label, _jsx(LabelContainer, { isRoot: isRoot, Label: Label, Item: Item })] }));
73
+ };
@@ -9,5 +9,6 @@ export interface BaseFormObjProps extends CommonPropsType, DataType {
9
9
  disabled: boolean;
10
10
  readOnly: boolean;
11
11
  objType: 'arr' | 'obj';
12
+ isRoot?: boolean;
12
13
  }
13
14
  export {};
@@ -43,7 +43,6 @@ export const BaseFormObj = forwardRef(function BaseFormObj(props, ref) {
43
43
  const cls = classNames({
44
44
  [`${classPrefix}-form-obj`]: true,
45
45
  [`${classPrefix}-${platform}-form-obj`]: true,
46
- [props.className]: true,
47
46
  });
48
47
  const formItemProps = {
49
48
  ...props,
@@ -166,7 +165,8 @@ export const BaseFormObj = forwardRef(function BaseFormObj(props, ref) {
166
165
  else if (props.objType === 'obj') {
167
166
  value = dealObjChange(params, objValue) || value;
168
167
  }
169
- if (isObjectEqual(value, objValue)) {
168
+ if (isObjectEqual(value, objValue) ||
169
+ (value === null && isObjectEqual(initValue, objValue))) {
170
170
  return;
171
171
  }
172
172
  setObjValue(value || initValue);
@@ -201,6 +201,9 @@ export const BaseFormObj = forwardRef(function BaseFormObj(props, ref) {
201
201
  parentForm,
202
202
  props.objType,
203
203
  ]);
204
+ const changeDebounce = useDebouncedCallback(useCallback((value, option) => {
205
+ change(value, option);
206
+ }, [change]), 500);
204
207
  /**
205
208
  * 子组件默认值变更,触发嵌套表单值更新
206
209
  */
@@ -223,6 +226,7 @@ export const BaseFormObj = forwardRef(function BaseFormObj(props, ref) {
223
226
  (_b = parentFormObj === null || parentFormObj === void 0 ? void 0 : parentFormObj.__setValueImmediate__) === null || _b === void 0 ? void 0 : _b.call(parentFormObj, { name, value });
224
227
  }
225
228
  setObjValue(value || initValue);
229
+ triggerOnDataChange(value || initValue);
226
230
  },
227
231
  // eslint-disable-next-line react-hooks/exhaustive-deps
228
232
  [objValue, name, parentFormObj]);
@@ -236,7 +240,7 @@ export const BaseFormObj = forwardRef(function BaseFormObj(props, ref) {
236
240
  * @param value
237
241
  */
238
242
  setValue: (value) => {
239
- change({ name: '', value }, { isUpdateParentForm: true });
243
+ changeDebounce({ name: '', value }, { isUpdateParentForm: true });
240
244
  },
241
245
  getValue() {
242
246
  return objValue;
@@ -8,8 +8,6 @@ import * as React from 'react';
8
8
  import { Text, Justify, ConfigProvider, Bubble } from 'tea-component';
9
9
  import classNames from '../../utils/classnames';
10
10
  import { WdButton } from '../../components/wd-button';
11
- // @ts-ignore忽略ts交验
12
- // eslint-disable-next-line rulesdir/no-phantom-deps
13
11
  import { autorun } from 'mobx';
14
12
  import './style';
15
13
  export default function WdOfficialAccount(props) {
@@ -16,7 +16,7 @@ import './style';
16
16
  * 下拉单选-标准化
17
17
  */
18
18
  export const WdSelect = forwardRef(function WsSelect(props, ref) {
19
- const { classRoot = 'select', clearable = X_RUNTIME_DEFAULT.clearable, placeholder, range, format, tipBlock = X_RUNTIME_DEFAULT.tipBlock, where = X_RUNTIME_DEFAULT.where, enumName, primaryField, viewId, dataSourceName, events = emptyObject, ignoreCase = X_RUNTIME_DEFAULT.ignoreCase, } = props;
19
+ const { classRoot = 'select', clearable = X_RUNTIME_DEFAULT.clearable, placeholder, range, format, tipBlock = X_RUNTIME_DEFAULT.tipBlock, where = X_RUNTIME_DEFAULT.where, enumName, primaryField, viewId, dataSourceName, events = emptyObject, ignoreCase = X_RUNTIME_DEFAULT.ignoreCase, staticSearchable = X_RUNTIME_DEFAULT.staticSearchable, } = props;
20
20
  const [options, setOptions] = useState([]);
21
21
  const [innerHandle, setInnerHandle] = useState({});
22
22
  const traitProps = { ...props, inputRef: ref, setInnerHandle };
@@ -79,5 +79,5 @@ export const WdSelect = forwardRef(function WsSelect(props, ref) {
79
79
  }, [debouncedTriggerSearchEvent]);
80
80
  if (!visible)
81
81
  return null;
82
- return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(RecycleProvider, { readOnly: readOnly, recycleBack: setOptions, children: _jsx(Select, { events: delayEvents, labelVisible: false, defaultValue: value, enumName: enumName, format: format, placeholder: placeholder, primaryField: primaryField, range: range, size: "full", tipBlock: tipBlock, viewId: viewId, where: where, dataSourceName: dataSourceName, readOnly: readOnly, disabled: disabled, mode: "selector", decorator: null, ignoreCase: ignoreCase, onChange: onChange, onSearchValueInput: onSearchValueInput }) }) }) }) }));
82
+ return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(RecycleProvider, { readOnly: readOnly, recycleBack: setOptions, children: _jsx(Select, { events: delayEvents, labelVisible: false, defaultValue: value, enumName: enumName, format: format, placeholder: placeholder, primaryField: primaryField, range: range, size: "full", tipBlock: tipBlock, viewId: viewId, where: where, dataSourceName: dataSourceName, readOnly: readOnly, disabled: disabled, mode: "selector", decorator: null, ignoreCase: ignoreCase, staticSearchable: staticSearchable, onChange: onChange, onSearchValueInput: onSearchValueInput }) }) }) }) }));
83
83
  });
@@ -16,7 +16,7 @@ import { useDebouncedCallback, useSyncedRef } from '@react-hookz/web';
16
16
  * 下拉多选-标准化
17
17
  */
18
18
  export const WdSelectMultiple = forwardRef(function WdSelectMultiple(props, ref) {
19
- const { classRoot = 'select-multiple', clearable = X_RUNTIME_DEFAULT.clearable, placeholder, range, enumName, format, primaryField, tipBlock = X_RUNTIME_DEFAULT.tipBlock, viewId, dataSourceName, events = emptyObject, ignoreCase = X_RUNTIME_DEFAULT.ignoreCase, } = props;
19
+ const { classRoot = 'select-multiple', clearable = X_RUNTIME_DEFAULT.clearable, placeholder, range, enumName, format, primaryField, tipBlock = X_RUNTIME_DEFAULT.tipBlock, viewId, dataSourceName, events = emptyObject, ignoreCase = X_RUNTIME_DEFAULT.ignoreCase, staticSearchable = X_RUNTIME_DEFAULT.staticSearchable, } = props;
20
20
  const [options, setOptions] = useState([]);
21
21
  const [innerHandle, setInnerHandle] = useState({});
22
22
  const traitProps = { ...props, inputRef: ref, setInnerHandle };
@@ -74,5 +74,5 @@ export const WdSelectMultiple = forwardRef(function WdSelectMultiple(props, ref)
74
74
  }, [debouncedTriggerSearchEvent]);
75
75
  if (!visible)
76
76
  return null;
77
- return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(RecycleProvider, { readOnly: readOnly, recycleBack: setOptions, children: _jsx(SelectMultiple, { events: delayEvents, labelVisible: false, defaultValue: value, enumName: enumName, format: format, placeholder: placeholder, primaryField: primaryField, range: range, size: "full", tipBlock: tipBlock, viewId: viewId, dataSourceName: dataSourceName, readOnly: readOnly, disabled: disabled, mode: "selector", decorator: null, ignoreCase: ignoreCase, onChange: onChange, onSearchValueInput: onSearchValueInput }) }) }) }) }));
77
+ return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(RecycleProvider, { readOnly: readOnly, recycleBack: setOptions, children: _jsx(SelectMultiple, { events: delayEvents, labelVisible: false, defaultValue: value, enumName: enumName, format: format, placeholder: placeholder, primaryField: primaryField, range: range, size: "full", tipBlock: tipBlock, viewId: viewId, dataSourceName: dataSourceName, readOnly: readOnly, disabled: disabled, mode: "selector", decorator: null, ignoreCase: ignoreCase, staticSearchable: staticSearchable, onChange: onChange, onSearchValueInput: onSearchValueInput }) }) }) }) }));
78
78
  });
@@ -184,22 +184,23 @@ const getSearchValues = (searchValues) => {
184
184
  };
185
185
  });
186
186
  };
187
+ const orderByFieldKey = (key, columns) => {
188
+ var _a;
189
+ return ((_a = columns === null || columns === void 0 ? void 0 : columns.find((i) => key === (i === null || i === void 0 ? void 0 : i.slotKey))) === null || _a === void 0 ? void 0 : _a.fieldKey) || key;
190
+ };
187
191
  const getPageParam = ({ defaultSort, sort: _sort, params, _defaultPageSize, _defaultPageIndex, supportManyRelated, columns, isSupportMultipleSort, }) => {
188
192
  let sort = defaultSort || [];
189
193
  // 运行态有值,以运行态为准
190
194
  if ((_sort === null || _sort === void 0 ? void 0 : _sort.length) && _sort[0].order) {
191
- params.orderBy = _sort[0].by;
195
+ params.orderBy = orderByFieldKey(_sort[0].by, columns);
192
196
  params.orderType = _sort[0].order;
193
197
  sort = _sort;
194
198
  }
195
199
  // 后端根据业务字段排序
196
- sort = sort === null || sort === void 0 ? void 0 : sort.map((n) => {
197
- var _a;
198
- return ({
199
- ...n,
200
- by: ((_a = columns === null || columns === void 0 ? void 0 : columns.find((i) => n.by === i.slotKey)) === null || _a === void 0 ? void 0 : _a.fieldKey) || n.by,
201
- });
202
- });
200
+ sort = sort === null || sort === void 0 ? void 0 : sort.map((n) => ({
201
+ ...n,
202
+ by: orderByFieldKey(n.by, columns),
203
+ }));
203
204
  const _pageSize = parseInt(`${params.pageSize}`);
204
205
  params.pageSize = isNaN(_pageSize) ? _defaultPageSize : _pageSize;
205
206
  const _pageNo = parseInt(`${params.pageNo}`);
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- // eslint-disable-next-line rulesdir/no-phantom-deps
3
2
  import { autorun } from 'mobx';
4
3
  // 小程序组件能否在编辑器中渲染
5
4
  export function useCanPreview() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/weda-ui",
3
- "version": "3.7.4",
3
+ "version": "3.7.5",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index",
6
6
  "miniprogram": "mpdist",
@@ -81,6 +81,7 @@
81
81
  "description": "腾讯云微搭低代码组件库模板",
82
82
  "dependencies": {
83
83
  "@antv/g6": "^4.8.5",
84
+ "@cloudbase/weda-client": "^1.1.4",
84
85
  "@codemirror/autocomplete": "^6.16.0",
85
86
  "@codemirror/lang-javascript": "^6.2.2",
86
87
  "@codemirror/lang-sql": "^6.6.4",
@@ -135,8 +136,7 @@
135
136
  "@babel/preset-react": "^7.22.15",
136
137
  "@babel/preset-typescript": "^7.22.15",
137
138
  "@cloudbase/cals": "^1.0.35",
138
- "@cloudbase/lowcode-cli": "^0.19.1",
139
- "@cloudbase/weda-client": "^1.0.21",
139
+ "@cloudbase/lowcode-cli": "^0.21.8",
140
140
  "@cloudbase/weda-cloud-sdk": "^1.0.26",
141
141
  "@commitlint/cli": "^16.0.2",
142
142
  "@commitlint/config-conventional": "^17.7.0",
@@ -179,6 +179,7 @@
179
179
  "cypress-wait-until": "^1.7.2",
180
180
  "eslint": "^8.45.0",
181
181
  "eslint-config-prettier": "^8.5.0",
182
+ "eslint-import-resolver-alias": "^1.1.2",
182
183
  "eslint-import-resolver-typescript": "^3.5.2",
183
184
  "eslint-plugin-cypress": "^2.12.1",
184
185
  "eslint-plugin-import": "^2.27.5",
@@ -209,6 +210,7 @@
209
210
  "markdown-to-jsx": "^7.2.1",
210
211
  "miniprogram-simulate": "^1.5.9",
211
212
  "mkdirp": "^1.0.4",
213
+ "mobx": "^5.15.4",
212
214
  "mochawesome": "^7.1.3",
213
215
  "mochawesome-merge": "^4.2.1",
214
216
  "mochawesome-report-generator": "^6.2.0",