@cloudbase/weda-ui 3.15.7 → 3.16.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.
@@ -69,7 +69,7 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
69
69
  }
70
70
  }, [defaultValue]);
71
71
  React.useEffect(() => {
72
- var _a, _b;
72
+ var _a;
73
73
  if (isObjectEqual(fileRef.current, fileIDList))
74
74
  return;
75
75
  // 外部 onChange 事件
@@ -79,10 +79,6 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
79
79
  if (changeTypeRef.current) {
80
80
  (_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
81
81
  }
82
- if (changeTypeRef.current === 'add') {
83
- const files = pureFileIDList.map((d) => { var _a; return (_a = fileSizeObj[d]) === null || _a === void 0 ? void 0 : _a.file; });
84
- (_b = events === null || events === void 0 ? void 0 : events.success) === null || _b === void 0 ? void 0 : _b.call(events, { value: pureFileIDList, file: files });
85
- }
86
82
  fileRef.current = fileIDList;
87
83
  }, [fileIDList]);
88
84
  // 外层组件类
@@ -99,11 +95,13 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
99
95
  }, [acceptTypes]);
100
96
  // 上传后文件列表 fileIDList 改变事件,'add'|'delete'
101
97
  const handleChange = ({ fileID, uuid, type, size, file }) => {
98
+ var _a;
102
99
  if (fileID) {
103
100
  changeTypeRef.current = type;
104
101
  if (type === 'add') {
105
102
  setFileSizeObj((obj) => ({ ...obj, [fileID]: { size, file } }));
106
103
  setfileIDList((fileIDList) => [...fileIDList, fileID]);
104
+ (_a = events === null || events === void 0 ? void 0 : events.success) === null || _a === void 0 ? void 0 : _a.call(events, { value: fileID, file });
107
105
  }
108
106
  else {
109
107
  setfileIDList((fileIDList) => fileIDList.filter((f) => f !== fileID));
@@ -71,7 +71,7 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
71
71
  }
72
72
  }, [defaultValue]);
73
73
  React.useEffect(() => {
74
- var _a, _b;
74
+ var _a;
75
75
  if (isObjectEqual(fileRef.current, fileIDList))
76
76
  return;
77
77
  // 外部 onChange 事件
@@ -81,10 +81,6 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
81
81
  if (changeTypeRef.current) {
82
82
  (_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
83
83
  }
84
- if (changeTypeRef.current === 'add') {
85
- const files = pureFileIDList.map((d) => { var _a; return (_a = fileSizeObj[d]) === null || _a === void 0 ? void 0 : _a.file; });
86
- (_b = events === null || events === void 0 ? void 0 : events.success) === null || _b === void 0 ? void 0 : _b.call(events, { value: pureFileIDList, file: files });
87
- }
88
84
  fileRef.current = fileIDList;
89
85
  }, [fileIDList]);
90
86
  // 外层组件类
@@ -168,11 +164,13 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
168
164
  };
169
165
  // 上传后文件列表 fileIDList 改变事件,'add'|'delete'
170
166
  const handleChange = ({ fileID, uuid, type, size, file }) => {
167
+ var _a;
171
168
  if (fileID) {
172
169
  changeTypeRef.current = type;
173
170
  if (type === 'add') {
174
171
  setFileSizeObj((obj) => ({ ...obj, [fileID]: { size, file } }));
175
172
  setfileIDList((list) => [...list, fileID]);
173
+ (_a = events === null || events === void 0 ? void 0 : events.success) === null || _a === void 0 ? void 0 : _a.call(events, { value: fileID, file });
176
174
  }
177
175
  else {
178
176
  setfileIDList((list) => list.filter((d) => d !== fileID));
@@ -52,7 +52,7 @@ const defaultSize = 50;
52
52
  const defaultPage = 1;
53
53
  export function RelationSelect(props) {
54
54
  var _a, _b;
55
- const { placeholder, size, disabled, onChange, value, onSearch, addRelationButton, childRef, dataSourceName, selectFields, selectFieldType, primaryField, setRefreshStatus, mode, onRelationOptionJump, enableRelationOptionJump, listWidth = 700, ignoreCase = true, where, queryCondition, supportManyRelated, sorter, } = props;
55
+ const { placeholder, size, disabled, onChange, value, onSearch, addRelationButton, childRef, dataSourceName, selectFields, selectFieldType, primaryField, setRefreshStatus, mode, onRelationOptionJump, enableRelationOptionJump, listWidth = 700, ignoreCase = true, where, queryCondition, supportManyRelated, sorter, searchable, } = props;
56
56
  const selectFieldsLength = selectFieldType === 'custom' ? selectFields === null || selectFields === void 0 ? void 0 : selectFields.length : 0;
57
57
  // 设置下拉列表与下拉按钮同宽
58
58
  // 以传入为准,未传入,在自定义展示字段少于2个时设置为 true,否则设置为false,宽度设置为700,
@@ -151,7 +151,7 @@ export function RelationSelect(props) {
151
151
  searchOptionListWithWhere(filter);
152
152
  onSearch(keyword);
153
153
  };
154
- return (_jsx(Select, { ...props, overlayClassName: isRelationSelectOption ? 'wd-relation-select-overlay' : '', searchable: true, listWidth: listWidth, listHeight: _listHeight, matchButtonWidth: _matchButtonWidth, placeholder: placeholder, appearance: 'button', filter: () => true, size: size, disabled: disabled, autoClearSearchValue: true, options: customOptions, value: value, onChange: onChange, onSearch: searchHandle, bottomTips: isLoading ? _jsx(LoadingTip, {}) : undefined, onScrollBottom: () => {
154
+ return (_jsx(Select, { ...props, overlayClassName: isRelationSelectOption ? 'wd-relation-select-overlay' : '', searchable: searchable, listWidth: listWidth, listHeight: _listHeight, matchButtonWidth: _matchButtonWidth, placeholder: placeholder, appearance: 'button', filter: () => true, size: size, disabled: disabled, autoClearSearchValue: true, options: customOptions, value: value, onChange: onChange, onSearch: searchHandle, bottomTips: isLoading ? _jsx(LoadingTip, {}) : undefined, onScrollBottom: () => {
155
155
  if (!isLoading && customOptions.length < total) {
156
156
  setQuery((query) => ({
157
157
  ...query,
@@ -3,6 +3,7 @@ import { ConfigProvider } from 'tea-component';
3
3
  import { CustomSelect } from '../relationSelect/index';
4
4
  import { SelectUI as Select } from './selectUI';
5
5
  export function SelectCom(props) {
6
- const { isRelation } = props;
7
- return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: isRelation ? _jsx(CustomSelect, { ...props }) : _jsx(Select, { ...props }) }));
6
+ const { isRelation, filterable = false } = props;
7
+ const filter = filterable ? () => true : undefined;
8
+ return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: isRelation ? _jsx(CustomSelect, { ...props }) : _jsx(Select, { ...props, filter: filter }) }));
8
9
  }
@@ -29,7 +29,7 @@ const getSelectedItem = (options = [], value) => {
29
29
  return options === null || options === void 0 ? void 0 : options.filter((i) => selectedVal.find((j) => j === i.value) !== undefined);
30
30
  };
31
31
  function SelectH5(props) {
32
- const { placeholder, name, disabled, footer, options = [], value, onChange, overlayClassName, searchable, bottomTips, onSearch, onOpen, onScrollBottom, mode, readValue, popupContainer, searchPlaceholder, } = props;
32
+ const { placeholder, name, disabled, footer, options = [], value, onChange, overlayClassName, searchable, bottomTips, onSearch, onOpen, onScrollBottom, mode, readValue, popupContainer, searchPlaceholder, filterable, onBlur, onFocus, } = props;
33
33
  const isMultiple = mode === 'multiple';
34
34
  const customPickerCls = classNames('weda-ui-custom-picker__cloumns', {
35
35
  'weda-ui-custom-picker__cloumns--select-multiple': isMultiple,
@@ -49,7 +49,7 @@ function SelectH5(props) {
49
49
  return options.filter((i) => String(i === null || i === void 0 ? void 0 : i.label).toLowerCase().includes(searchValue.toLowerCase()));
50
50
  };
51
51
  // 前端查询
52
- const customOptions = isSearch && searchValue ? getOptionList() : options;
52
+ const customOptions = isSearch && searchValue && !filterable ? getOptionList() : options;
53
53
  const handleZhStart = () => {
54
54
  // 判断是否输入中文,则停止搜索
55
55
  setIsSearch(false);
@@ -124,7 +124,7 @@ function SelectH5(props) {
124
124
  setCurrentSelected(dealSelectedItem(item));
125
125
  }
126
126
  };
127
- return (_jsxs(_Fragment, { children: [_jsx("input", { "data-testid": "form-item-select", className: inputCls, type: "text", name: name, placeholder: placeholder, autoComplete: "off", disabled: disabled, readOnly: true, value: readValue || '', onClick: handleClick }), _jsxs(Modal, { visible: visible, onClose: () => {
127
+ return (_jsxs(_Fragment, { children: [_jsx("input", { "data-testid": "form-item-select", className: inputCls, type: "text", name: name, placeholder: placeholder, autoComplete: "off", disabled: disabled, readOnly: true, value: readValue || '', onClick: handleClick, onFocus: onFocus, onBlur: onBlur }), _jsxs(Modal, { visible: visible, onClose: () => {
128
128
  if (inputFocus) {
129
129
  // 聚焦在搜索框
130
130
  setInputFocus(false);
@@ -13,4 +13,6 @@ export interface WdSelectProps extends CommonPropsType, DataType {
13
13
  viewId?: string;
14
14
  dataSourceName?: string;
15
15
  popupContainer?: AttachContainer;
16
+ ignoreCase?: boolean;
17
+ staticSearchable?: boolean;
16
18
  }
@@ -20,7 +20,7 @@ import { SelectProvider } from './contexts/selectContext';
20
20
  */
21
21
  export const WdSelect = forwardRef(function WsSelect(props, ref) {
22
22
  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, enableRelationalSetting = X_RUNTIME_DEFAULT.enableRelationalSetting, enableRelationalRefresh = X_RUNTIME_DEFAULT.enableRelationalRefresh, addRelationButtonText = X_RUNTIME_DEFAULT.addRelationButtonText, enableAddRelationButton = X_RUNTIME_DEFAULT.enableAddRelationButton, enableRelationOptionJump = X_RUNTIME_DEFAULT.enableRelationOptionJump, popupContainer, selectFields: customFields = [], // 自定义展示字段
23
- selectFieldType = 'primary', searchPlaceholder, } = props;
23
+ selectFieldType = 'primary', searchPlaceholder, searchable = X_RUNTIME_DEFAULT.searchable, filterable = X_RUNTIME_DEFAULT.filterable, } = props;
24
24
  const childRef = useRef(null);
25
25
  const [options, setOptions] = useSyncValue(range, isObjectEqual);
26
26
  const [innerHandle, setInnerHandle] = useState({});
@@ -54,6 +54,12 @@ export const WdSelect = forwardRef(function WsSelect(props, ref) {
54
54
  disabled,
55
55
  value,
56
56
  });
57
+ const onFocus = (e) => {
58
+ events.focus(null, { originEvent: e });
59
+ };
60
+ const onBlur = (e) => {
61
+ events.blur(null, { originEvent: e });
62
+ };
57
63
  const isRelation = isFormatWithRelation(format);
58
64
  const LabelAdornment = isRelation && (_jsx(RelationalSetting, { size: props.size, refresh: () => {
59
65
  var _a;
@@ -105,11 +111,11 @@ export const WdSelect = forwardRef(function WsSelect(props, ref) {
105
111
  }, [debouncedTriggerSearchEvent]);
106
112
  if (!visible)
107
113
  return null;
108
- return (_jsx(SelectProvider, { options: options, setOptions: setOptions, children: _jsx(WdFormItem, { ...formItemProps, children: _jsxs(_Fragment, { children: [_jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(Select, { ...props, style: undefined, className: undefined, onRelationTagClick: (item) => {
114
+ return (_jsx(SelectProvider, { options: options, setOptions: setOptions, children: _jsx(WdFormItem, { ...formItemProps, children: _jsxs(_Fragment, { children: [_jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(Select, { ...props, onBlur: onBlur, onFocus: onFocus, filterable: filterable, style: undefined, className: undefined, onRelationTagClick: (item) => {
109
115
  var _a;
110
116
  (_a = delayEvents === null || delayEvents === void 0 ? void 0 : delayEvents.onRelationTagClick) === null || _a === void 0 ? void 0 : _a.call(delayEvents, item);
111
117
  }, enableRelationOptionJump: enableRelationOptionJump, onRelationOptionJump: (item) => {
112
118
  var _a;
113
119
  (_a = delayEvents === null || delayEvents === void 0 ? void 0 : delayEvents.onRelationOptionJump) === null || _a === void 0 ? void 0 : _a.call(delayEvents, item);
114
- }, selectFieldType: selectFieldType, selectFields: customFields, isRelation: isRelation, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, childRef: childRef, events: delayEvents, labelVisible: false, value: value, enumName: enumName, format: format, placeholder: placeholder, primaryField: primaryField, options: options, size: "full", tipBlock: tipBlock, viewId: viewId, where: where, dataSourceName: dataSourceName, readOnly: readOnly, disabled: disabled, mode: "selector", decorator: null, ignoreCase: ignoreCase, staticSearchable: staticSearchable, onChange: handleChange, onSearch: onSearchValueInput, popupContainer: popupContainer, searchable: true, searchPlaceholder: searchPlaceholder }) }) }), layout === 'horizontal' && LabelAdornment] }) }) }));
120
+ }, selectFieldType: selectFieldType, selectFields: customFields, isRelation: isRelation, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, childRef: childRef, events: delayEvents, labelVisible: false, value: value, enumName: enumName, format: format, placeholder: placeholder, primaryField: primaryField, options: options, size: "full", tipBlock: tipBlock, viewId: viewId, where: where, dataSourceName: dataSourceName, readOnly: readOnly, disabled: disabled, mode: "selector", decorator: null, ignoreCase: ignoreCase, staticSearchable: staticSearchable, onChange: handleChange, onSearch: onSearchValueInput, popupContainer: popupContainer, searchable: searchable, searchPlaceholder: searchPlaceholder }) }) }), layout === 'horizontal' && LabelAdornment] }) }) }));
115
121
  });
@@ -18,4 +18,6 @@ export interface WdSelectMultipleProps extends CommonPropsType, DataType {
18
18
  enableAddRelationButton?: boolean;
19
19
  addRelationButtonText?: string;
20
20
  popupContainer?: AttachContainer;
21
+ ignoreCase?: boolean;
22
+ staticSearchable?: boolean;
21
23
  }
@@ -21,7 +21,7 @@ import { SelectProvider } from '../wd-select/contexts/selectContext';
21
21
  */
22
22
  export const WdSelectMultiple = forwardRef(function WdSelectMultiple(props, ref) {
23
23
  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, where = X_RUNTIME_DEFAULT.where, enableRelationalSetting = X_RUNTIME_DEFAULT.enableRelationalSetting, enableRelationalRefresh = X_RUNTIME_DEFAULT.enableRelationalRefresh, addRelationButtonText = X_RUNTIME_DEFAULT.addRelationButtonText, enableAddRelationButton = X_RUNTIME_DEFAULT.enableAddRelationButton, enableRelationOptionJump = X_RUNTIME_DEFAULT.enableRelationOptionJump, popupContainer, selectFields: customFields = [], // 自定义展示字段
24
- selectFieldType = 'primary', searchPlaceholder, } = props;
24
+ selectFieldType = 'primary', searchPlaceholder, searchable = X_RUNTIME_DEFAULT.searchable, filterable = X_RUNTIME_DEFAULT.filterable, } = props;
25
25
  const childRef = useRef(null);
26
26
  const [options, setOptions] = useSyncValue(range, isObjectEqual);
27
27
  const [innerHandle, setInnerHandle] = useState({});
@@ -56,6 +56,12 @@ export const WdSelectMultiple = forwardRef(function WdSelectMultiple(props, ref)
56
56
  onChange === null || onChange === void 0 ? void 0 : onChange(v);
57
57
  (_a = delayEvents === null || delayEvents === void 0 ? void 0 : delayEvents.change) === null || _a === void 0 ? void 0 : _a.call(delayEvents, { value: v, context });
58
58
  };
59
+ const onFocus = (e) => {
60
+ events.focus(null, { originEvent: e });
61
+ };
62
+ const onBlur = (e) => {
63
+ events.blur(null, { originEvent: e });
64
+ };
59
65
  const isRelation = isFormatWithRelation(format);
60
66
  const LabelAdornment = isRelation && (_jsx(RelationalSetting, { size: props.size, refresh: () => {
61
67
  var _a;
@@ -101,11 +107,11 @@ export const WdSelectMultiple = forwardRef(function WdSelectMultiple(props, ref)
101
107
  }, [debouncedTriggerSearchEvent]);
102
108
  if (!visible)
103
109
  return null;
104
- return (_jsx(SelectProvider, { options: options, setOptions: setOptions, children: _jsx(WdFormItem, { ...formItemProps, children: _jsxs(_Fragment, { children: [_jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(SelectMultiple, { ...props, style: undefined, className: undefined, onRelationTagClick: (item) => {
110
+ return (_jsx(SelectProvider, { options: options, setOptions: setOptions, children: _jsx(WdFormItem, { ...formItemProps, children: _jsxs(_Fragment, { children: [_jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(SelectMultiple, { ...props, onBlur: onBlur, onFocus: onFocus, filterable: filterable, style: undefined, className: undefined, onRelationTagClick: (item) => {
105
111
  var _a;
106
112
  (_a = delayEvents === null || delayEvents === void 0 ? void 0 : delayEvents.onRelationTagClick) === null || _a === void 0 ? void 0 : _a.call(delayEvents, item);
107
113
  }, enableRelationOptionJump: enableRelationOptionJump, onRelationOptionJump: (item) => {
108
114
  var _a;
109
115
  (_a = delayEvents === null || delayEvents === void 0 ? void 0 : delayEvents.onRelationOptionJump) === null || _a === void 0 ? void 0 : _a.call(delayEvents, item);
110
- }, selectFieldType: selectFieldType, selectFields: customFields, isRelation: isRelation, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, childRef: childRef, events: delayEvents, labelVisible: false, value: value, enumName: enumName, format: format, placeholder: placeholder, primaryField: primaryField, options: options, size: "full", tipBlock: tipBlock, viewId: viewId, dataSourceName: dataSourceName, readOnly: readOnly, disabled: disabled, mode: "multiple", decorator: null, ignoreCase: ignoreCase, staticSearchable: staticSearchable, where: where, onChange: handleChange, onSearch: onSearchValueInput, popupContainer: popupContainer, searchable: true, searchPlaceholder: searchPlaceholder }) }) }), layout === 'horizontal' && LabelAdornment] }) }) }));
116
+ }, selectFieldType: selectFieldType, selectFields: customFields, isRelation: isRelation, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, childRef: childRef, events: delayEvents, labelVisible: false, value: value, enumName: enumName, format: format, placeholder: placeholder, primaryField: primaryField, options: options, size: "full", tipBlock: tipBlock, viewId: viewId, dataSourceName: dataSourceName, readOnly: readOnly, disabled: disabled, mode: "multiple", decorator: null, ignoreCase: ignoreCase, staticSearchable: staticSearchable, where: where, onChange: handleChange, onSearch: onSearchValueInput, popupContainer: popupContainer, searchable: searchable, searchPlaceholder: searchPlaceholder }) }) }), layout === 'horizontal' && LabelAdornment] }) }) }));
111
117
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/weda-ui",
3
- "version": "3.15.7",
3
+ "version": "3.16.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index",
6
6
  "miniprogram": "mpdist",
@@ -147,7 +147,7 @@
147
147
  "@babel/preset-env": "^7.22.15",
148
148
  "@babel/preset-react": "^7.22.15",
149
149
  "@babel/preset-typescript": "^7.22.15",
150
- "@cloudbase/cals": "^1.2.11",
150
+ "@cloudbase/cals": "^1.2.13",
151
151
  "@cloudbase/lowcode-cli": "^0.22.1",
152
152
  "@cloudbase/weda-cloud-sdk": "^1.0.97",
153
153
  "@commitlint/cli": "^16.0.2",