@hi-ui/tree-select 5.0.0-canary.0 → 5.0.0-canary.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @hi-ui/tree-select
2
2
 
3
+ ## 5.0.0-canary.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 6c4bf35af: feat: 下拉选择类组件 appearance 参数增加 contained 类型 (5.0)
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [6c4bf35af]
12
+ - @hi-ui/input@5.0.0-canary.2
13
+
3
14
  ## 5.0.0-canary.0
4
15
 
5
16
  ### Major Changes
@@ -88,7 +88,8 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
88
88
  prefix = _a.prefix,
89
89
  suffix = _a.suffix,
90
90
  customRender = _a.customRender,
91
- rest = tslib.__rest(_a, ["prefixCls", "role", "className", "data", "dataSource", "disabled", "visible", "onOpen", "onClose", "fieldNames", "defaultExpandAll", "expandedIds", "defaultExpandedIds", "onExpand", "defaultValue", "value", "onChange", "searchable", "searchMode", "onLoadChildren", "render", "filterOption", "keyword", "onSearch", "clearable", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height", "size", "prefix", "suffix", "customRender"]);
91
+ label = _a.label,
92
+ rest = tslib.__rest(_a, ["prefixCls", "role", "className", "data", "dataSource", "disabled", "visible", "onOpen", "onClose", "fieldNames", "defaultExpandAll", "expandedIds", "defaultExpandedIds", "onExpand", "defaultValue", "value", "onChange", "searchable", "searchMode", "onLoadChildren", "render", "filterOption", "keyword", "onSearch", "clearable", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height", "size", "prefix", "suffix", "customRender", "label"]);
92
93
  var i18n = core.useLocaleContext();
93
94
  var placeholder = typeAssertion.isUndef(placeholderProp) ? i18n.get('treeSelect.placeholder') : placeholderProp;
94
95
  var _useUncontrolledToggl = useToggle.useUncontrolledToggle({
@@ -236,9 +237,10 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
236
237
  keyword: keywordProp,
237
238
  onSearch: funcUtils.callAllFuncs(onSearchProp, onSearch),
238
239
  loading: rest.loading !== undefined ? rest.loading : loading,
239
- trigger: customRender ? typeof customRender === 'function' ? customRender(selectedItem) : customRender : ( /*#__PURE__*/React__default["default"].createElement(input.MockInput
240
- // disabled={disabled}
241
- , {
240
+ trigger: customRender ? typeof customRender === 'function' ? customRender(selectedItem) : customRender : ( /*#__PURE__*/React__default["default"].createElement(input.MockInput, {
241
+ style: {
242
+ maxWidth: appearance === 'contained' ? '360px' : undefined
243
+ },
242
244
  // disabled={disabled}
243
245
  size: size,
244
246
  clearable: clearable,
@@ -252,7 +254,8 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
252
254
  data: mergedData,
253
255
  // @ts-ignore
254
256
  invalid: invalid,
255
- appearance: appearance
257
+ appearance: appearance,
258
+ label: label
256
259
  }))
257
260
  }), typeAssertion.isArrayNonEmpty(treeProps.data) ? ( /*#__PURE__*/React__default["default"].createElement(tree.Tree, Object.assign({
258
261
  size: 'md',
@@ -76,7 +76,8 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
76
76
  prefix = _a.prefix,
77
77
  suffix = _a.suffix,
78
78
  customRender = _a.customRender,
79
- rest = __rest(_a, ["prefixCls", "role", "className", "data", "dataSource", "disabled", "visible", "onOpen", "onClose", "fieldNames", "defaultExpandAll", "expandedIds", "defaultExpandedIds", "onExpand", "defaultValue", "value", "onChange", "searchable", "searchMode", "onLoadChildren", "render", "filterOption", "keyword", "onSearch", "clearable", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height", "size", "prefix", "suffix", "customRender"]);
79
+ label = _a.label,
80
+ rest = __rest(_a, ["prefixCls", "role", "className", "data", "dataSource", "disabled", "visible", "onOpen", "onClose", "fieldNames", "defaultExpandAll", "expandedIds", "defaultExpandedIds", "onExpand", "defaultValue", "value", "onChange", "searchable", "searchMode", "onLoadChildren", "render", "filterOption", "keyword", "onSearch", "clearable", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height", "size", "prefix", "suffix", "customRender", "label"]);
80
81
  var i18n = useLocaleContext();
81
82
  var placeholder = isUndef(placeholderProp) ? i18n.get('treeSelect.placeholder') : placeholderProp;
82
83
  var _useUncontrolledToggl = useUncontrolledToggle({
@@ -224,9 +225,10 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
224
225
  keyword: keywordProp,
225
226
  onSearch: callAllFuncs(onSearchProp, onSearch),
226
227
  loading: rest.loading !== undefined ? rest.loading : loading,
227
- trigger: customRender ? typeof customRender === 'function' ? customRender(selectedItem) : customRender : ( /*#__PURE__*/React.createElement(MockInput
228
- // disabled={disabled}
229
- , {
228
+ trigger: customRender ? typeof customRender === 'function' ? customRender(selectedItem) : customRender : ( /*#__PURE__*/React.createElement(MockInput, {
229
+ style: {
230
+ maxWidth: appearance === 'contained' ? '360px' : undefined
231
+ },
230
232
  // disabled={disabled}
231
233
  size: size,
232
234
  clearable: clearable,
@@ -240,7 +242,8 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
240
242
  data: mergedData,
241
243
  // @ts-ignore
242
244
  invalid: invalid,
243
- appearance: appearance
245
+ appearance: appearance,
246
+ label: label
244
247
  }))
245
248
  }), isArrayNonEmpty(treeProps.data) ? ( /*#__PURE__*/React.createElement(Tree, Object.assign({
246
249
  size: 'md',
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { TreeSelectDataItem } from './types';
2
+ import { TreeSelectDataItem, TreeSelectAppearanceEnum } from './types';
3
3
  import { TreeNodeEventData } from '@hi-ui/tree';
4
4
  import { PickerProps } from '@hi-ui/picker';
5
- import { HiBaseAppearanceEnum, HiBaseSizeEnum } from '@hi-ui/core';
5
+ import { HiBaseSizeEnum } from '@hi-ui/core';
6
6
  import { UseDataSource } from '@hi-ui/use-data-source';
7
7
  /**
8
8
  * 树形选择器
@@ -105,7 +105,11 @@ export interface TreeSelectProps extends Omit<PickerProps, 'data' | 'onChange' |
105
105
  /**
106
106
  * 设置展现形式
107
107
  */
108
- appearance?: HiBaseAppearanceEnum;
108
+ appearance?: TreeSelectAppearanceEnum;
109
+ /**
110
+ * 设置输入框 label 内容,仅在 appearance 为 contained 时生效
111
+ */
112
+ label?: React.ReactNode;
109
113
  /**
110
114
  * 设置虚拟滚动容器的可视高度。暂不对外暴露
111
115
  * @private
@@ -1,4 +1,4 @@
1
- import { HiBaseDataItem } from '@hi-ui/core';
1
+ import { HiBaseAppearanceEnum, HiBaseDataItem } from '@hi-ui/core';
2
2
  import React from 'react';
3
3
  export interface TreeSelectDataItem extends HiBaseDataItem {
4
4
  /**
@@ -48,3 +48,4 @@ export interface TreeSelectDataSource<T = any> {
48
48
  */
49
49
  transformResponse?: (response: object) => T;
50
50
  }
51
+ export declare type TreeSelectAppearanceEnum = HiBaseAppearanceEnum | 'contained' | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/tree-select",
3
- "version": "5.0.0-canary.0",
3
+ "version": "5.0.0-canary.1",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -50,7 +50,7 @@
50
50
  "@hi-ui/func-utils": "^5.0.0-canary.0",
51
51
  "@hi-ui/highlighter": "^5.0.0-canary.0",
52
52
  "@hi-ui/icons": "^5.0.0-canary.0",
53
- "@hi-ui/input": "^5.0.0-canary.0",
53
+ "@hi-ui/input": "^5.0.0-canary.2",
54
54
  "@hi-ui/picker": "^5.0.0-canary.0",
55
55
  "@hi-ui/popper": "^5.0.0-canary.0",
56
56
  "@hi-ui/tree": "^5.0.0-canary.0",