@hi-ui/tree-select 4.1.5-alpha.0 → 4.2.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.
package/CHANGELOG.md CHANGED
@@ -1,23 +1,29 @@
1
1
  # @hi-ui/tree-select
2
2
 
3
- ## 4.1.5-alpha.0
3
+ ## 4.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2823](https://github.com/XiaoMi/hiui/pull/2823) [`d2b333b6c`](https://github.com/XiaoMi/hiui/commit/d2b333b6ce737757df20149f12d5780fa19f573c) Thanks [@xiamiao1121](https://github.com/xiamiao1121)! - feat: 新增支持前置后置内容
8
+
9
+ - [#2922](https://github.com/XiaoMi/hiui/pull/2922) [`362111208`](https://github.com/XiaoMi/hiui/commit/3621112089fdefe5d6add59b5da48d6bcb72602e) Thanks [@yang-x20](https://github.com/yang-x20)! - feat: 新增自定义触发器
10
+
11
+ ## 4.1.5
4
12
 
5
13
  ### Patch Changes
6
14
 
7
- - 1a00f9fc4: build: style-inject(node 环境下有问题) 替换为 @hi-ui/style-inject
8
- - Updated dependencies [1a00f9fc4]
9
- - @hi-ui/env@4.0.5-alpha.0
10
- - @hi-ui/icons@4.0.19-alpha.0
11
- - @hi-ui/highlighter@4.0.9-alpha.0
12
- - @hi-ui/input@4.1.1-alpha.0
13
- - @hi-ui/picker@4.1.6-alpha.0
14
- - @hi-ui/popper@4.1.5-alpha.0
15
- - @hi-ui/tree@4.5.10-alpha.0
16
- - @hi-ui/array-utils@4.0.5-alpha.0
17
- - @hi-ui/classname@4.0.5-alpha.0
18
- - @hi-ui/use-search-mode@4.1.5-alpha.0
19
- - @hi-ui/core@4.0.9-alpha.0
20
- - @hi-ui/func-utils@4.0.5-alpha.0
15
+ - [#2791](https://github.com/XiaoMi/hiui/pull/2791) [`1a00f9fc4`](https://github.com/XiaoMi/hiui/commit/1a00f9fc4a44619059d7852e846b54fedbd56715) Thanks [@zyprepare](https://github.com/zyprepare)! - build: style-inject(node 环境下有问题) 替换为 @hi-ui/style-inject
16
+
17
+ - Updated dependencies [[`1a00f9fc4`](https://github.com/XiaoMi/hiui/commit/1a00f9fc4a44619059d7852e846b54fedbd56715)]:
18
+ - @hi-ui/env@4.0.5
19
+ - @hi-ui/icons@4.0.19
20
+ - @hi-ui/highlighter@4.0.9
21
+ - @hi-ui/input@4.1.1
22
+ - @hi-ui/picker@4.1.6
23
+ - @hi-ui/popper@4.1.5
24
+ - @hi-ui/tree@4.5.10
25
+ - @hi-ui/array-utils@4.0.5
26
+ - @hi-ui/classname@4.0.5
21
27
 
22
28
  ## 4.1.4
23
29
 
@@ -84,7 +84,10 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
84
84
  height = _a.height,
85
85
  _a$size = _a.size,
86
86
  size = _a$size === void 0 ? 'md' : _a$size,
87
- 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", "onSearch", "clearable", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height", "size"]);
87
+ prefix = _a.prefix,
88
+ suffix = _a.suffix,
89
+ customRender = _a.customRender,
90
+ 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", "onSearch", "clearable", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height", "size", "prefix", "suffix", "customRender"]);
88
91
  var i18n = core.useLocaleContext();
89
92
  var placeholder = typeAssertion.isUndef(placeholderProp) ? i18n.get('treeSelect.placeholder') : placeholderProp;
90
93
  var _useUncontrolledToggl = useToggle.useUncontrolledToggle({
@@ -230,7 +233,7 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
230
233
  searchable: searchable,
231
234
  onSearch: funcUtils.callAllFuncs(onSearchProp, onSearch),
232
235
  loading: rest.loading !== undefined ? rest.loading : loading,
233
- trigger: /*#__PURE__*/React__default["default"].createElement(input.MockInput
236
+ trigger: customRender ? typeof customRender === 'function' ? customRender(selectedItem) : customRender : ( /*#__PURE__*/React__default["default"].createElement(input.MockInput
234
237
  // disabled={disabled}
235
238
  , {
236
239
  // disabled={disabled}
@@ -238,7 +241,8 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
238
241
  clearable: clearable,
239
242
  placeholder: placeholder,
240
243
  displayRender: displayRenderProp,
241
- suffix: menuVisible ? /*#__PURE__*/React__default["default"].createElement(icons.UpOutlined, null) : /*#__PURE__*/React__default["default"].createElement(icons.DownOutlined, null),
244
+ prefix: prefix,
245
+ suffix: [menuVisible ? /*#__PURE__*/React__default["default"].createElement(icons.UpOutlined, null) : /*#__PURE__*/React__default["default"].createElement(icons.DownOutlined, null), suffix],
242
246
  focused: menuVisible,
243
247
  value: value,
244
248
  onChange: tryChangeValue,
@@ -246,7 +250,7 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
246
250
  // @ts-ignore
247
251
  invalid: invalid,
248
252
  appearance: appearance
249
- })
253
+ }))
250
254
  }), typeAssertion.isArrayNonEmpty(treeProps.data) ? ( /*#__PURE__*/React__default["default"].createElement(tree.Tree, Object.assign({
251
255
  size: 'md',
252
256
  className: prefixCls + "__tree",
@@ -72,7 +72,10 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
72
72
  height = _a.height,
73
73
  _a$size = _a.size,
74
74
  size = _a$size === void 0 ? 'md' : _a$size,
75
- 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", "onSearch", "clearable", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height", "size"]);
75
+ prefix = _a.prefix,
76
+ suffix = _a.suffix,
77
+ customRender = _a.customRender,
78
+ 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", "onSearch", "clearable", "invalid", "displayRender", "placeholder", "appearance", "virtual", "itemHeight", "height", "size", "prefix", "suffix", "customRender"]);
76
79
  var i18n = useLocaleContext();
77
80
  var placeholder = isUndef(placeholderProp) ? i18n.get('treeSelect.placeholder') : placeholderProp;
78
81
  var _useUncontrolledToggl = useUncontrolledToggle({
@@ -218,7 +221,7 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
218
221
  searchable: searchable,
219
222
  onSearch: callAllFuncs(onSearchProp, onSearch),
220
223
  loading: rest.loading !== undefined ? rest.loading : loading,
221
- trigger: /*#__PURE__*/React.createElement(MockInput
224
+ trigger: customRender ? typeof customRender === 'function' ? customRender(selectedItem) : customRender : ( /*#__PURE__*/React.createElement(MockInput
222
225
  // disabled={disabled}
223
226
  , {
224
227
  // disabled={disabled}
@@ -226,7 +229,8 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
226
229
  clearable: clearable,
227
230
  placeholder: placeholder,
228
231
  displayRender: displayRenderProp,
229
- suffix: menuVisible ? /*#__PURE__*/React.createElement(UpOutlined, null) : /*#__PURE__*/React.createElement(DownOutlined, null),
232
+ prefix: prefix,
233
+ suffix: [menuVisible ? /*#__PURE__*/React.createElement(UpOutlined, null) : /*#__PURE__*/React.createElement(DownOutlined, null), suffix],
230
234
  focused: menuVisible,
231
235
  value: value,
232
236
  onChange: tryChangeValue,
@@ -234,7 +238,7 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
234
238
  // @ts-ignore
235
239
  invalid: invalid,
236
240
  appearance: appearance
237
- })
241
+ }))
238
242
  }), isArrayNonEmpty(treeProps.data) ? ( /*#__PURE__*/React.createElement(Tree, Object.assign({
239
243
  size: 'md',
240
244
  className: prefixCls + "__tree",
@@ -124,4 +124,16 @@ export interface TreeSelectProps extends Omit<PickerProps, 'data' | 'onChange' |
124
124
  * 设置尺寸
125
125
  */
126
126
  size?: HiBaseSizeEnum;
127
+ /**
128
+ * 选择框前置内容
129
+ */
130
+ prefix?: React.ReactNode;
131
+ /**
132
+ * 选择框后置内容
133
+ */
134
+ suffix?: React.ReactNode;
135
+ /**
136
+ * 自定义触发器
137
+ */
138
+ customRender?: React.ReactNode | ((selectedItem: TreeSelectDataItem | null) => React.ReactNode);
127
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/tree-select",
3
- "version": "4.1.5-alpha.0",
3
+ "version": "4.2.0",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -43,30 +43,30 @@
43
43
  "url": "https://github.com/XiaoMi/hiui/issues"
44
44
  },
45
45
  "dependencies": {
46
- "@hi-ui/array-utils": "^4.0.5-alpha.0",
47
- "@hi-ui/classname": "^4.0.5-alpha.0",
48
- "@hi-ui/env": "^4.0.5-alpha.0",
49
- "@hi-ui/func-utils": "^4.0.5-alpha.0",
50
- "@hi-ui/highlighter": "^4.0.9-alpha.0",
51
- "@hi-ui/icons": "^4.0.19-alpha.0",
52
- "@hi-ui/input": "^4.1.1-alpha.0",
53
- "@hi-ui/picker": "^4.1.6-alpha.0",
54
- "@hi-ui/popper": "^4.1.5-alpha.0",
55
- "@hi-ui/tree": "^4.5.10-alpha.0",
46
+ "@hi-ui/array-utils": "^4.0.5",
47
+ "@hi-ui/classname": "^4.0.5",
48
+ "@hi-ui/env": "^4.0.5",
49
+ "@hi-ui/func-utils": "^4.0.4",
50
+ "@hi-ui/highlighter": "^4.0.9",
51
+ "@hi-ui/icons": "^4.0.19",
52
+ "@hi-ui/input": "^4.1.1",
53
+ "@hi-ui/picker": "^4.1.6",
54
+ "@hi-ui/popper": "^4.1.5",
55
+ "@hi-ui/tree": "^4.5.10",
56
56
  "@hi-ui/tree-utils": "^4.1.4",
57
57
  "@hi-ui/type-assertion": "^4.0.4",
58
58
  "@hi-ui/use-data-source": "^4.0.4",
59
- "@hi-ui/use-search-mode": "^4.1.5-alpha.0",
59
+ "@hi-ui/use-search-mode": "^4.1.4",
60
60
  "@hi-ui/use-toggle": "^4.0.4",
61
61
  "@hi-ui/use-uncontrolled-state": "^4.0.4"
62
62
  },
63
63
  "peerDependencies": {
64
- "@hi-ui/core": ">=4.0.9-alpha.0",
64
+ "@hi-ui/core": ">=4.0.8",
65
65
  "react": ">=16.8.6",
66
66
  "react-dom": ">=16.8.6"
67
67
  },
68
68
  "devDependencies": {
69
- "@hi-ui/core": "^4.0.9-alpha.0",
69
+ "@hi-ui/core": "^4.0.8",
70
70
  "@hi-ui/core-css": "^4.1.5",
71
71
  "react": "^17.0.1",
72
72
  "react-dom": "^17.0.1"