@hi-ui/check-select 4.0.8 → 4.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ # @hi-ui/check-select
2
+
3
+ ## 4.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2304](https://github.com/XiaoMi/hiui/pull/2304) [`feaec9a67`](https://github.com/XiaoMi/hiui/commit/feaec9a67a05e315f6f3370115eaf0c8c418faf7) Thanks [@zyprepare](https://github.com/zyprepare)! - 增加 customRender api
@@ -115,7 +115,8 @@ var CheckSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
115
115
  onSearchProp = _a.onSearch,
116
116
  _a$fieldNames = _a.fieldNames,
117
117
  fieldNames = _a$fieldNames === void 0 ? DEFAULT_FIELD_NAMES : _a$fieldNames,
118
- rest = tslib.__rest(_a, ["prefixCls", "role", "className", "children", "disabled", "clearable", "showCheckAll", "showOnlyShowChecked", "placeholder", "displayRender", "onSelect", "height", "itemHeight", "virtual", "visible", "onOpen", "onClose", "appearance", "invalid", "dataSource", "filterOption", "searchable", "render", "renderExtraFooter", "onSearch", "fieldNames"]);
118
+ customRender = _a.customRender,
119
+ rest = tslib.__rest(_a, ["prefixCls", "role", "className", "children", "disabled", "clearable", "showCheckAll", "showOnlyShowChecked", "placeholder", "displayRender", "onSelect", "height", "itemHeight", "virtual", "visible", "onOpen", "onClose", "appearance", "invalid", "dataSource", "filterOption", "searchable", "render", "renderExtraFooter", "onSearch", "fieldNames", "customRender"]);
119
120
 
120
121
  var i18n = core.useLocaleContext();
121
122
  var placeholder = typeAssertion.isUndef(placeholderProp) ? i18n.get('checkSelect.placeholder') : placeholderProp; // ************************** Picker ************************* //
@@ -310,7 +311,7 @@ var CheckSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
310
311
  onSearch: funcUtils.callAllFuncs(onSearchProp, onSearch),
311
312
  loading: loading,
312
313
  footer: renderDefaultFooter(),
313
- trigger: /*#__PURE__*/React__default["default"].createElement(tagInput.TagInputMock, {
314
+ trigger: customRender ? typeof customRender === 'function' ? customRender(checkedItems) : customRender : /*#__PURE__*/React__default["default"].createElement(tagInput.TagInputMock, {
314
315
  clearable: clearable,
315
316
  placeholder: placeholder,
316
317
  // @ts-ignore
@@ -73,7 +73,8 @@ var CheckSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
73
73
  onSearchProp = _a.onSearch,
74
74
  _a$fieldNames = _a.fieldNames,
75
75
  fieldNames = _a$fieldNames === void 0 ? DEFAULT_FIELD_NAMES : _a$fieldNames,
76
- rest = __rest(_a, ["prefixCls", "role", "className", "children", "disabled", "clearable", "showCheckAll", "showOnlyShowChecked", "placeholder", "displayRender", "onSelect", "height", "itemHeight", "virtual", "visible", "onOpen", "onClose", "appearance", "invalid", "dataSource", "filterOption", "searchable", "render", "renderExtraFooter", "onSearch", "fieldNames"]);
76
+ customRender = _a.customRender,
77
+ rest = __rest(_a, ["prefixCls", "role", "className", "children", "disabled", "clearable", "showCheckAll", "showOnlyShowChecked", "placeholder", "displayRender", "onSelect", "height", "itemHeight", "virtual", "visible", "onOpen", "onClose", "appearance", "invalid", "dataSource", "filterOption", "searchable", "render", "renderExtraFooter", "onSearch", "fieldNames", "customRender"]);
77
78
 
78
79
  var i18n = useLocaleContext();
79
80
  var placeholder = isUndef(placeholderProp) ? i18n.get('checkSelect.placeholder') : placeholderProp; // ************************** Picker ************************* //
@@ -268,7 +269,7 @@ var CheckSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
268
269
  onSearch: callAllFuncs(onSearchProp, onSearch),
269
270
  loading: loading,
270
271
  footer: renderDefaultFooter(),
271
- trigger: /*#__PURE__*/React.createElement(TagInputMock, {
272
+ trigger: customRender ? typeof customRender === 'function' ? customRender(checkedItems) : customRender : /*#__PURE__*/React.createElement(TagInputMock, {
272
273
  clearable: clearable,
273
274
  placeholder: placeholder,
274
275
  // @ts-ignore
@@ -97,6 +97,10 @@ export interface CheckSelectProps extends Omit<PickerProps, 'trigger' | 'scrolla
97
97
  * 是否开启查看仅已选功能
98
98
  */
99
99
  showOnlyShowChecked?: boolean;
100
+ /**
101
+ * 自定义渲染选中的内容
102
+ */
103
+ customRender?: React.ReactNode | ((option: CheckSelectItemEventData[]) => React.ReactNode);
100
104
  }
101
105
  /**
102
106
  * TODO: What is CheckSelectOption
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/check-select",
3
- "version": "4.0.8",
3
+ "version": "4.1.0",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -50,8 +50,8 @@
50
50
  "@hi-ui/func-utils": "^4.0.1",
51
51
  "@hi-ui/highlighter": "^4.0.5",
52
52
  "@hi-ui/icons": "^4.0.4",
53
- "@hi-ui/input": "^4.0.5",
54
- "@hi-ui/picker": "^4.0.5",
53
+ "@hi-ui/input": "^4.0.6",
54
+ "@hi-ui/picker": "^4.0.6",
55
55
  "@hi-ui/popper": "^4.0.4",
56
56
  "@hi-ui/tag-input": "^4.0.5",
57
57
  "@hi-ui/times": "^4.0.1",
@@ -77,6 +77,5 @@
77
77
  "@hi-ui/hi-build": "^4.0.1",
78
78
  "react": "^17.0.1",
79
79
  "react-dom": "^17.0.1"
80
- },
81
- "gitHead": "db81f4e6bffc562f26ab0655cb71ec160c5e2c22"
80
+ }
82
81
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 Xiaomi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.