@hi-ui/check-cascader 4.0.0-alpha.8 → 4.0.0-beta.2
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/README.md +95 -7
- package/lib/cjs/CheckCascader.js +201 -67
- package/lib/cjs/CheckCascader.js.map +1 -1
- package/lib/cjs/CheckCascaderMenu.js +8 -1
- package/lib/cjs/CheckCascaderMenu.js.map +1 -1
- package/lib/cjs/CheckCascaderMenus.js +13 -5
- package/lib/cjs/CheckCascaderMenus.js.map +1 -1
- package/lib/cjs/context.js.map +1 -1
- package/lib/cjs/hooks/use-async-switch.js +4 -1
- package/lib/cjs/hooks/use-async-switch.js.map +1 -1
- package/lib/cjs/hooks/use-check.js +3 -12
- package/lib/cjs/hooks/use-check.js.map +1 -1
- package/lib/cjs/hooks/use-search.js +13 -71
- package/lib/cjs/hooks/use-search.js.map +1 -1
- package/lib/cjs/icons/index.js +3 -34
- package/lib/cjs/icons/index.js.map +1 -1
- package/lib/cjs/index.js +0 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/cjs/utils/index.js +0 -36
- package/lib/cjs/utils/index.js.map +1 -1
- package/lib/esm/CheckCascader.js +192 -67
- package/lib/esm/CheckCascader.js.map +1 -1
- package/lib/esm/CheckCascaderMenu.js +8 -1
- package/lib/esm/CheckCascaderMenu.js.map +1 -1
- package/lib/esm/CheckCascaderMenus.js +13 -5
- package/lib/esm/CheckCascaderMenus.js.map +1 -1
- package/lib/esm/context.js.map +1 -1
- package/lib/esm/hooks/use-async-switch.js +5 -2
- package/lib/esm/hooks/use-async-switch.js.map +1 -1
- package/lib/esm/hooks/use-check.js +3 -10
- package/lib/esm/hooks/use-check.js.map +1 -1
- package/lib/esm/hooks/use-search.js +13 -72
- package/lib/esm/hooks/use-search.js.map +1 -1
- package/lib/esm/icons/index.js +2 -34
- package/lib/esm/icons/index.js.map +1 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/styles/index.scss.js +1 -1
- package/lib/esm/utils/index.js +1 -36
- package/lib/esm/utils/index.js.map +1 -1
- package/lib/types/CheckCascader.d.ts +23 -33
- package/lib/types/CheckCascaderMenus.d.ts +1 -1
- package/lib/types/context.d.ts +1 -1
- package/lib/types/hooks/index.d.ts +0 -1
- package/lib/types/hooks/use-async-switch.d.ts +1 -1
- package/lib/types/hooks/use-search.d.ts +4 -0
- package/lib/types/index.d.ts +0 -1
- package/package.json +30 -21
- package/lib/cjs/CheckCascaderPanel.js +0 -189
- package/lib/cjs/CheckCascaderPanel.js.map +0 -1
- package/lib/cjs/TagInput.js +0 -183
- package/lib/cjs/TagInput.js.map +0 -1
- package/lib/cjs/hooks/use-tag-input.js +0 -122
- package/lib/cjs/hooks/use-tag-input.js.map +0 -1
- package/lib/esm/CheckCascaderPanel.js +0 -156
- package/lib/esm/CheckCascaderPanel.js.map +0 -1
- package/lib/esm/TagInput.js +0 -153
- package/lib/esm/TagInput.js.map +0 -1
- package/lib/esm/hooks/use-tag-input.js +0 -113
- package/lib/esm/hooks/use-tag-input.js.map +0 -1
- package/lib/types/CheckCascaderPanel.d.ts +0 -88
- package/lib/types/TagInput.d.ts +0 -68
- package/lib/types/hooks/use-tag-input.d.ts +0 -3
@@ -7,84 +7,25 @@
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
|
-
import
|
11
|
-
import
|
10
|
+
import 'react';
|
11
|
+
import '@hi-ui/use-latest';
|
12
|
+
import { __DEV__ } from '@hi-ui/env';
|
12
13
|
/**
|
13
|
-
*
|
14
|
+
* 返回 -1 表示匹配失败
|
14
15
|
*/
|
15
16
|
|
16
|
-
var
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
var _useState2 = useState([]),
|
22
|
-
matchedNodes = _useState2[0],
|
23
|
-
setMatchedNodes = _useState2[1];
|
24
|
-
|
25
|
-
var flattedDataRef = useLatestRef(flattedData);
|
26
|
-
var handleChange = useCallback(function (evt) {
|
27
|
-
var nextSearchValue = evt.target.value;
|
28
|
-
setSearchValue(nextSearchValue); // 匹配到搜索的节点,将这些节点进行展开显示,其它均隐藏
|
29
|
-
|
30
|
-
var matchedNodes = upMatch ? getMatchedUpMatchNodes(flattedDataRef.current, nextSearchValue) : getMatchedNodes(flattedDataRef.current, nextSearchValue);
|
31
|
-
setMatchedNodes(matchedNodes);
|
32
|
-
}, [upMatch]);
|
33
|
-
var inputProps = {
|
34
|
-
value: searchValue,
|
35
|
-
onChange: handleChange
|
36
|
-
};
|
37
|
-
var isSearch = !!searchValue;
|
38
|
-
var isEmpty = isSearch && matchedNodes.length === 0;
|
39
|
-
return [isSearch, matchedNodes, inputProps, isEmpty];
|
40
|
-
};
|
41
|
-
/**
|
42
|
-
* 从 value 中 找到指定的 options(逐层查找)
|
43
|
-
*/
|
44
|
-
|
45
|
-
|
46
|
-
var getMatchedNodes = function getMatchedNodes(flattedData, searchValue) {
|
47
|
-
if (!searchValue) return [];
|
48
|
-
return flattedData.filter(function (node) {
|
49
|
-
var _a, _b;
|
50
|
-
|
51
|
-
if (typeof node.title !== 'string') return false;
|
52
|
-
if (!node.checkable) return false; // 匹配策略:`String.include`
|
53
|
-
|
54
|
-
return (_b = (_a = node.title).includes) === null || _b === void 0 ? void 0 : _b.call(_a, searchValue);
|
55
|
-
});
|
56
|
-
};
|
57
|
-
/**
|
58
|
-
* 从 value 中 找到指定的 options(逐层并向上查找)
|
59
|
-
*/
|
60
|
-
|
61
|
-
|
62
|
-
var getMatchedUpMatchNodes = function getMatchedUpMatchNodes(flattedData, searchValue) {
|
63
|
-
if (!searchValue) return [];
|
64
|
-
var visitedResultSet = new Set();
|
65
|
-
return flattedData.filter(function (node) {
|
66
|
-
var _a, _b;
|
67
|
-
|
68
|
-
if (!node.checkable) return false;
|
69
|
-
|
70
|
-
while (node.parent) {
|
71
|
-
if (visitedResultSet.has(node.id)) {
|
72
|
-
return true;
|
73
|
-
}
|
17
|
+
var matchStrategy = function matchStrategy(content, keyword) {
|
18
|
+
if (typeof content !== 'string') {
|
19
|
+
if (__DEV__) {
|
20
|
+
console.warn('Warning: must be string type when enable searchable.');
|
21
|
+
}
|
74
22
|
|
75
|
-
|
76
|
-
|
77
|
-
visitedResultSet.add(node.id);
|
78
|
-
return true;
|
79
|
-
}
|
80
|
-
}
|
23
|
+
return -1;
|
24
|
+
} // 忽略大小写匹配
|
81
25
|
|
82
|
-
node = node.parent;
|
83
|
-
}
|
84
26
|
|
85
|
-
|
86
|
-
});
|
27
|
+
return content.toLowerCase().indexOf(keyword.toLowerCase());
|
87
28
|
};
|
88
29
|
|
89
|
-
export {
|
30
|
+
export { matchStrategy };
|
90
31
|
//# sourceMappingURL=use-search.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-search.js","sources":["../../../src/hooks/use-search.ts"],"sourcesContent":[null],"names":["
|
1
|
+
{"version":3,"file":"use-search.js","sources":["../../../src/hooks/use-search.ts"],"sourcesContent":[null],"names":["matchStrategy","content","keyword","__DEV__","console","warn","toLowerCase","indexOf"],"mappings":";;;;;;;;;;;;AAwFA;;;;IAGaA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,OAAD,EAAmBC,OAAnB;MACvB,OAAOD,OAAP,KAAmB,UAAU;QAC3BE,SAAS;AACXC,MAAAA,OAAO,CAACC,IAARD,CAAa,sDAAbA;;;WAEK,CAAC;;;;SAGHH,OAAO,CAACK,WAARL,GAAsBM,OAAtBN,CAA8BC,OAAO,CAACI,WAARJ,EAA9BD;;;"}
|
package/lib/esm/icons/index.js
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
*/
|
10
10
|
import React from 'react';
|
11
11
|
import { DownOutlined } from '@hi-ui/icons';
|
12
|
+
import { Spinner } from '@hi-ui/spinner';
|
12
13
|
var defaultSuffixIcon = /*#__PURE__*/React.createElement(DownOutlined, null);
|
13
14
|
var defaultLeafIcon = /*#__PURE__*/React.createElement("span", {
|
14
15
|
style: {
|
@@ -16,39 +17,6 @@ var defaultLeafIcon = /*#__PURE__*/React.createElement("span", {
|
|
16
17
|
width: 16
|
17
18
|
}
|
18
19
|
});
|
19
|
-
var defaultLoadingIcon = /*#__PURE__*/React.createElement(
|
20
|
-
className: "hi-v4-tree--icon-loading",
|
21
|
-
viewBox: "0 0 16 16",
|
22
|
-
version: "1.1",
|
23
|
-
xmlns: "http://www.w3.org/2000/svg"
|
24
|
-
}, /*#__PURE__*/React.createElement("g", {
|
25
|
-
stroke: "none",
|
26
|
-
strokeWidth: "1",
|
27
|
-
fill: "none",
|
28
|
-
fillRule: "evenodd"
|
29
|
-
}, /*#__PURE__*/React.createElement("g", {
|
30
|
-
transform: "translate(-365.000000, -6110.000000)",
|
31
|
-
fill: "currentColor",
|
32
|
-
fillRule: "nonzero"
|
33
|
-
}, /*#__PURE__*/React.createElement("g", {
|
34
|
-
transform: "translate(40.000000, 5974.000000)"
|
35
|
-
}, /*#__PURE__*/React.createElement("g", {
|
36
|
-
transform: "translate(320.000000, 74.000000)"
|
37
|
-
}, /*#__PURE__*/React.createElement("g", {
|
38
|
-
transform: "translate(0.000000, 50.000000)"
|
39
|
-
}, /*#__PURE__*/React.createElement("g", {
|
40
|
-
transform: "translate(0.000000, 4.000000)"
|
41
|
-
}, /*#__PURE__*/React.createElement("g", {
|
42
|
-
transform: "translate(5.000000, 4.000000)"
|
43
|
-
}, /*#__PURE__*/React.createElement("g", {
|
44
|
-
transform: "translate(0.000000, 4.000000)"
|
45
|
-
}, /*#__PURE__*/React.createElement("g", {
|
46
|
-
transform: "translate(1.000000, 1.000000)"
|
47
|
-
}, /*#__PURE__*/React.createElement("path", {
|
48
|
-
d: "M7,14 C10.8659932,14 14,10.8659932 14,7 C14,3.13400675 10.8659932,0 7,0 C3.13400675,0 0,3.13400675 0,7 C0,10.8659932 3.13400675,14 7,14 Z M7,12 C4.23857625,12 2,9.76142375 2,7 C2,4.23857625 4.23857625,2 7,2 C9.76142375,2 12,4.23857625 12,7 C12,9.76142375 9.76142375,12 7,12 Z",
|
49
|
-
fillOpacity: "0.2"
|
50
|
-
}), /*#__PURE__*/React.createElement("path", {
|
51
|
-
d: "M1.7016758,2.42516242 C0.611099326,3.68724484 0,5.29767398 0,7 C0,10.8659932 3.13400675,14 7,14 C7.55228475,14 8,13.5522847 8,13 C8,12.4477153 7.55228475,12 7,12 C4.23857625,12 2,9.76142375 2,7 C2,5.78244469 2.43544044,4.63492915 3.21496813,3.73281158 C3.57606547,3.31492744 3.53003068,2.68343818 3.11214655,2.32234084 C2.69426241,1.96124349 2.06277315,2.00727828 1.7016758,2.42516242 Z"
|
52
|
-
})))))))))));
|
20
|
+
var defaultLoadingIcon = /*#__PURE__*/React.createElement(Spinner, null);
|
53
21
|
export { defaultLeafIcon, defaultLoadingIcon, defaultSuffixIcon };
|
54
22
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/icons/index.tsx"],"sourcesContent":[null],"names":["defaultSuffixIcon","React","DownOutlined","defaultLeafIcon","style","display","width","defaultLoadingIcon","
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/icons/index.tsx"],"sourcesContent":[null],"names":["defaultSuffixIcon","React","DownOutlined","defaultLeafIcon","style","display","width","defaultLoadingIcon","Spinner"],"mappings":";;;;;;;;;;;;IAIaA,iBAAiB,gBAAGC,mBAAAA,CAACC,YAADD,MAAAA;IAEpBE,eAAe,gBAAGF,mBAAAA,OAAAA;AAAMG,EAAAA,KAAK,EAAE;AAAEC,IAAAA,OAAO,EAAE,cAAX;AAA2BC,IAAAA,KAAK,EAAE;AAAlC;CAAbL;IAElBM,kBAAkB,gBAAGN,mBAAAA,CAACO,OAADP,MAAAA;"}
|
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
|
-
var css_248z = ".hi-v4-tag-input {\n position: relative;\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n width: 100%;\n min-width: 160px;\n font-size: 14px;\n vertical-align: middle;\n color: var(--color-black);\n border: 1px solid transparent;\n background-color: var(--color-white);\n -webkit-transition: all 0.3s;\n transition: all 0.3s;\n padding: 4px 10px;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n min-height: 32px;\n overflow: hidden;\n border-color: var(--color-gray-30);\n border-radius: 4px; }\n .hi-v4-tag-input:not(.disabled):hover {\n border-color: var(--color-primary); }\n .hi-v4-tag-input:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 1px var(--color-primary);\n box-shadow: 0 0 0 1px var(--color-primary);\n border-color: var(--color-primary); }\n .hi-v4-tag-input.disabled {\n cursor: not-allowed;\n color: var(--color-gray-50);\n background-color: var(--color-gray-10); }\n .hi-v4-tag-input__placeholder {\n color: var(--color-gray-50); }\n .hi-v4-tag-input__suffix {\n font-size: 16px;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center; }\n .hi-v4-tag-input__clear {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n width: 16px;\n height: 16px;\n font-size: 14px;\n color: var(--color-gray-50);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n cursor: pointer;\n -webkit-transition: all 0.3s;\n transition: all 0.3s; }\n .hi-v4-tag-input__clear:hover {\n color: var(--color-black); }\n .hi-v4-tag-input__value {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n width: 100%;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n height: 22px;\n line-height: 22px; }\n .hi-v4-tag-input__tags {\n -webkit-box-flex: 0;\n -ms-flex: 0 1 auto;\n flex: 0 1 auto;\n display: inline-block;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n white-space: nowrap;\n height: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin-top: -4px; }\n .hi-v4-tag-input__tag, .hi-v4-tag-input__tag--left {\n display: inline-block;\n margin-right: 4px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: 0 8px;\n vertical-align: middle;\n font-size: 12px;\n color: #333;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background: #f2f2f2;\n border-radius: 4px; }\n .hi-v4-tag-input__tag--total {\n display: inline-block;\n margin-right: 6px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: 0 8px;\n vertical-align: middle;\n font-size: 12px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n background-color: var(--color-primary-20);\n color: var(--color-primary);\n border-radius: 4px;\n line-height: 22px; }\n .hi-v4-tag-input__tag {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center; }\n .hi-v4-tag-input__tag-content {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n -webkit-box-sizing: border-box;\n box-sizing: border-box; }\n .hi-v4-tag-input__tag-closed {\n margin-left: 8px;\n font-size: 12px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: #8e8e8e;\n cursor: pointer; }\n .disabled .hi-v4-tag-input__tag-closed {\n cursor: not-allowed; }\n .hi-v4-tag-input__tag--left {\n margin: 0;\n max-width: 54px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n vertical-align: middle; }\n .hi-v4-tag-input--nowrap .hi-v4-tag-input__value {\n width: calc(100% - 64px);\n overflow-x: overlay; }\n .hi-v4-tag-input--wrap .hi-v4-tag-input__value {\n height: auto; }\n .hi-v4-tag-input--wrap .hi-v4-tag-input__tags {\n white-space: normal;\n margin-top: -4px; }\n .hi-v4-tag-input--wrap .hi-v4-tag-input__tag {\n margin-top: 4px; }\n .hi-v4-check-cascader {\n color: #333; }\n .hi-v4-check-cascader__suffix {\n font-size: 16px;\n -webkit-transform: rotate(0);\n transform: rotate(0); }\n .hi-v4-check-cascader--open .hi-v4-check-cascader__suffix {\n -webkit-transform: rotate(-180deg);\n transform: rotate(-180deg); }\n .hi-v4-check-cascader--open .hi-v4-tag-input {\n border-color: var(--color-primary); }\n .hi-v4-check-cascader-panel {\n white-space: nowrap;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding-top: 10px; }\n .hi-v4-check-cascader-panel-search {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: 0 10px 10px;\n position: relative; }\n .hi-v4-check-cascader-panel-search .hi-v4-input__prefix {\n font-size: 16px;\n padding-left: 0; }\n .hi-v4-check-cascader-panel-search__empty {\n display: inline-block;\n margin-top: 20px;\n font-size: 14px;\n font-weight: 400;\n color: #999;\n line-height: 20px; }\n .hi-v4-check-cascader-menus {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n overflow-x: auto; }\n .hi-v4-check-cascader-menus--flatted .hi-v4-check-cascader-menu {\n -ms-flex-preferred-size: 100%;\n flex-basis: 100%; }\n .hi-v4-check-cascader-menu {\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n font-size: 14px;\n vertical-align: middle;\n list-style: none;\n width: auto;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n display: inline-block;\n min-width: 160px;\n min-height: 160px;\n max-height: 260px;\n overflow: auto;\n padding-bottom: 10px; }\n .hi-v4-check-cascader-menu--checkable .title__text {\n padding-left: 24px; }\n .hi-v4-check-cascader-menu--checkable .hi-v4-check-cascader-menu-checkbox + .title__text {\n padding-left: 0px; }\n .hi-v4-check-cascader-menu-item {\n width: 100%;\n padding: 4px 0;\n position: relative;\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex; }\n .hi-v4-check-cascader-menu-checkbox {\n position: relative; }\n .hi-v4-check-cascader-menu-checkbox::after {\n right: 0;\n top: -8px;\n bottom: -8px;\n left: -8px;\n content: \"\";\n position: absolute;\n display: block; }\n .hi-v4-check-cascader-menu-option {\n padding: 0 10px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n min-height: 32px;\n width: 100%;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n position: relative;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between; }\n .hi-v4-check-cascader-menu-option:hover {\n background-color: var(--color-primary-20); }\n .hi-v4-check-cascader-menus--selectchange .hi-v4-check-cascader-menu-option:hover .hi-v4-checkbox__icon {\n border-color: var(--color-primary); }\n .hi-v4-check-cascader-menu-option--selected {\n background-color: var(--color-primary-20);\n font-weight: 700; }\n .hi-v4-check-cascader-menu-option--focused {\n background-color: var(--color-primary-10); }\n .hi-v4-check-cascader-menu-option--checked {\n font-weight: 700; }\n .hi-v4-check-cascader-menu-option--disabled {\n cursor: not-allowed;\n color: var(--color-gray-50);\n font-weight: 400; }\n .hi-v4-check-cascader-menu-option--disabled .hi-v4-check-cascader-menu-switcher {\n color: var(--color-gray-50); }\n .hi-v4-check-cascader-menu .title__text {\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1; }\n .hi-v4-check-cascader-menu .title__text--cols {\n display: block;\n width: 100%;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n font-size: 14px;\n vertical-align: middle;\n list-style: none; }\n .hi-v4-check-cascader-menu .title__text--col {\n display: inline-block; }\n .hi-v4-check-cascader-menu .title__text--col::after {\n content: \"\\00a0/\\00a0\"; }\n .hi-v4-check-cascader-menu .title__text--col:last-child:after {\n content: none; }\n .hi-v4-check-cascader-menu .title__text--matched {\n color: var(--color-primary); }\n .hi-v4-check-cascader-menu-switcher {\n -ms-flex-negative: 0;\n flex-shrink: 0;\n font-size: 16px;\n color: #666; }\n .hi-v4-check-cascader-menu-switcher svg {\n width: 1em;\n height: 1em;\n fill: currentColor;\n stroke: currentColor;\n display: inline-block;\n vertical-align: -0.15em; }\n .hi-v4-check-cascader-menu-switcher--loading {\n color: var(--color-primary); }\n .hi-v4-tree--icon-loading {\n -webkit-animation-name: hi-rotate;\n animation-name: hi-rotate;\n -webkit-animation-duration: 2s;\n animation-duration: 2s;\n -webkit-animation-iteration-count: infinite;\n animation-iteration-count: infinite; }\n @-webkit-keyframes hi-rotate {\n from {\n -webkit-transform: rotate(0);\n transform: rotate(0); }\n to {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n @keyframes hi-rotate {\n from {\n -webkit-transform: rotate(0);\n transform: rotate(0); }\n to {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n";
|
10
|
+
var css_248z = "@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n.hi-v4-check-cascader__popper .hi-v4-picker__body {\n padding-left: 0;\n padding-right: 0; }\n.hi-v4-check-cascader-panel {\n white-space: nowrap;\n -webkit-box-sizing: border-box;\n box-sizing: border-box; }\n.hi-v4-check-cascader-panel-search {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n padding: 0 10px 10px;\n position: relative; }\n.hi-v4-check-cascader-panel-search .hi-v4-input__prefix {\n font-size: 16px;\n padding-left: 0; }\n.hi-v4-check-cascader-panel-search__empty {\n display: inline-block;\n margin-top: 20px;\n font-size: 14px;\n font-weight: 400;\n color: #999;\n line-height: 20px; }\n.hi-v4-check-cascader-menus {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n overflow-x: auto; }\n.hi-v4-check-cascader-menus--flatted .hi-v4-check-cascader-menu {\n -ms-flex-preferred-size: 100%;\n flex-basis: 100%; }\n.hi-v4-check-cascader-menu {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n font-size: 0.875rem;\n font-size: var(--hi-v4-text-size-normal, 0.875rem);\n vertical-align: middle;\n list-style: none;\n width: auto;\n box-sizing: border-box;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n display: inline-block;\n min-width: 140px;\n max-height: 256px;\n overflow: auto;\n padding: 0 8px;\n padding: 0 var(--hi-v4-spacing-4, 8px);\n border-right: 1px solid #ebedf0;\n border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0); }\n.hi-v4-check-cascader-menu:last-of-type {\n border: none; }\n.hi-v4-check-cascader-menu--checkable .hi-v4-check-cascader-menu-checkbox + .title__text {\n padding-left: 8px; }\n.hi-v4-check-cascader-menu-item {\n width: 100%;\n padding: 4px 0;\n padding: var(--hi-v4-spacing-2, 4px) 0;\n position: relative;\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex; }\n.hi-v4-check-cascader-menu-checkbox {\n position: relative; }\n.hi-v4-check-cascader-menu-checkbox::after {\n right: 0;\n top: -8px;\n bottom: -8px;\n left: -8px;\n content: '';\n position: absolute;\n display: block; }\n.hi-v4-check-cascader-menu-option {\n padding: 0 8px;\n padding: 0 var(--hi-v4-spacing-4, 8px);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n height: 32px;\n width: 100%;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n position: relative;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n border-radius: 4px;\n border-radius: var(--hi-v4-border-radius-normal, 4px); }\n.hi-v4-check-cascader-menu-option:hover {\n background-color: #f2f4f7;\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n.hi-v4-check-cascader-menus--selectchange .hi-v4-check-cascader-menu-option:hover .hi-v4-checkbox__icon {\n border-color: #237ffa;\n border-color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-check-cascader-menu-option.hi-v4-check-cascader-menu-option--selected {\n background: #e2f3fe;\n background: var(--hi-v4-color-brandblue-50, #e2f3fe);\n color: #237ffa;\n color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-check-cascader-menu-option.hi-v4-check-cascader-menu-option--selected .hi-v4-check-cascader-menu-switcher {\n color: #237ffa;\n color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-check-cascader-menu-option--focused {\n background-color: #e2f3fe;\n background-color: var(--hi-v4-color-brandblue-50, #e2f3fe); }\n.hi-v4-check-cascader-menu-option--disabled {\n cursor: not-allowed;\n color: #929aa6;\n color: var(--hi-v4-color-gray-500, #929aa6);\n background: transparent; }\n.hi-v4-check-cascader-menu-option--disabled .hi-v4-check-cascader-menu-switcher {\n color: #c9ced6;\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-check-cascader-menu .title__text {\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1; }\n.hi-v4-check-cascader-menu .title__text--cols {\n display: block;\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n font-size: 0.875rem;\n font-size: var(--hi-v4-text-size-normal, 0.875rem);\n vertical-align: middle;\n list-style: none; }\n.hi-v4-check-cascader-menu .title__text--col {\n display: inline-block; }\n.hi-v4-check-cascader-menu .title__text--col::after {\n content: '\\00a0/\\00a0'; }\n.hi-v4-check-cascader-menu .title__text--col:last-child::after {\n content: none; }\n.hi-v4-check-cascader-menu .title__text--matched {\n color: #237ffa;\n color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-check-cascader-menu-switcher {\n -ms-flex-negative: 0;\n flex-shrink: 0;\n font-size: 16px;\n color: #929aa6;\n color: var(--hi-v4-color-gray-500, #929aa6); }\n.hi-v4-check-cascader-menu-switcher--loading {\n color: #237ffa;\n color: var(--hi-v4-color-brandblue-500, #237ffa); }\n.hi-v4-tree--icon-loading {\n -webkit-animation-name: hi-rotate;\n animation-name: hi-rotate;\n -webkit-animation-duration: 2s;\n animation-duration: 2s;\n -webkit-animation-iteration-count: infinite;\n animation-iteration-count: infinite; }\n@-webkit-keyframes hi-rotate {\n from {\n -webkit-transform: rotate(0);\n transform: rotate(0); }\n to {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n@keyframes hi-rotate {\n from {\n -webkit-transform: rotate(0);\n transform: rotate(0); }\n to {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n";
|
11
11
|
|
12
12
|
var __styleInject__ = require('style-inject/dist/style-inject.es.js')["default"];
|
13
13
|
|
package/lib/esm/utils/index.js
CHANGED
@@ -129,44 +129,9 @@ var getActiveMenuIds = function getActiveMenuIds(data, selectedIds) {
|
|
129
129
|
}).reverse();
|
130
130
|
};
|
131
131
|
|
132
|
-
var debounce = function debounce(func, delay) {
|
133
|
-
if (delay === void 0) {
|
134
|
-
delay = 150;
|
135
|
-
}
|
136
|
-
|
137
|
-
var timer = 0;
|
138
|
-
|
139
|
-
var cancel = function cancel() {
|
140
|
-
if (timer) {
|
141
|
-
window.clearTimeout(timer);
|
142
|
-
timer = 0;
|
143
|
-
}
|
144
|
-
};
|
145
|
-
|
146
|
-
var debounceFn = function debounceFn() {
|
147
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
148
|
-
args[_key] = arguments[_key];
|
149
|
-
}
|
150
|
-
|
151
|
-
if (timer) {
|
152
|
-
cancel();
|
153
|
-
}
|
154
|
-
|
155
|
-
if (func) {
|
156
|
-
timer = window.setTimeout(function () {
|
157
|
-
func.apply(null, args);
|
158
|
-
timer = 0;
|
159
|
-
}, delay);
|
160
|
-
}
|
161
|
-
};
|
162
|
-
|
163
|
-
debounceFn.cancel = cancel;
|
164
|
-
return debounceFn;
|
165
|
-
};
|
166
|
-
|
167
132
|
function getCascaderItemEventData(node, requiredProps) {
|
168
133
|
return Object.assign(Object.assign({}, node), requiredProps);
|
169
134
|
}
|
170
135
|
|
171
|
-
export {
|
136
|
+
export { flattenTreeData, getActiveMenuIds, getActiveMenus, getCascaderItemEventData, getFlattedMenus, getNodeAncestors };
|
172
137
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/utils/index.ts"],"sourcesContent":[null],"names":["flattenTreeData","treeData","flattedTreeData","dig","node","depth","parent","id","title","children","checkable","isLeaf","disabled","disabledCheckbox","flattedNode","raw","push","childDepth","map","child","treeRoot","getTreeRoot","getNodeAncestors","ancestors","getActiveMenus","data","selectedIds","length","root","menu","selectedOption","find","reverse","getFlattedMenus","filter","getActiveMenuIds","
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/index.ts"],"sourcesContent":[null],"names":["flattenTreeData","treeData","flattedTreeData","dig","node","depth","parent","id","title","children","checkable","isLeaf","disabled","disabledCheckbox","flattedNode","raw","push","childDepth","map","child","treeRoot","getTreeRoot","getNodeAncestors","ancestors","getActiveMenus","data","selectedIds","length","root","menu","selectedOption","find","reverse","getFlattedMenus","filter","getActiveMenuIds","getCascaderItemEventData","requiredProps"],"mappings":"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"}
|
@@ -1,27 +1,12 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { PopperJS } from '@hi-ui/popper';
|
3
2
|
import { CheckCascaderItem, ExpandTrigger, CheckCascaderItemEventData, FlattedCheckCascaderItem } from './types';
|
3
|
+
import { PickerProps } from '@hi-ui/picker';
|
4
|
+
import { HiBaseAppearanceEnum } from '@hi-ui/core';
|
4
5
|
/**
|
5
6
|
* TODO: What is CheckCascader
|
6
7
|
*/
|
7
8
|
export declare const CheckCascader: React.ForwardRefExoticComponent<CheckCascaderProps & React.RefAttributes<HTMLDivElement | null>>;
|
8
|
-
export interface CheckCascaderProps {
|
9
|
-
/**
|
10
|
-
* 组件默认的选择器类
|
11
|
-
*/
|
12
|
-
prefixCls?: string;
|
13
|
-
/**
|
14
|
-
* 组件的语义化 Role 属性
|
15
|
-
*/
|
16
|
-
role?: string;
|
17
|
-
/**
|
18
|
-
* 组件的注入选择器类
|
19
|
-
*/
|
20
|
-
className?: string;
|
21
|
-
/**
|
22
|
-
* 组件的注入样式
|
23
|
-
*/
|
24
|
-
style?: React.CSSProperties;
|
9
|
+
export interface CheckCascaderProps extends Omit<PickerProps, 'trigger'> {
|
25
10
|
/**
|
26
11
|
* 设置选择项数据源
|
27
12
|
*/
|
@@ -29,18 +14,19 @@ export interface CheckCascaderProps {
|
|
29
14
|
/**
|
30
15
|
* 设置当前多选值
|
31
16
|
*/
|
32
|
-
value?: React.ReactText[];
|
17
|
+
value?: React.ReactText[][];
|
33
18
|
/**
|
34
19
|
* 设置当前多选值默认值
|
35
20
|
*/
|
36
|
-
defaultValue?: React.ReactText[];
|
21
|
+
defaultValue?: React.ReactText[][];
|
37
22
|
/**
|
38
23
|
* 多选值改变时的回调
|
39
24
|
* TODO: 是否有这样的需求:暴露操作的原始数据对象?包括 点击 checkbox、点击 tag 删除按钮、点击清空按钮
|
40
25
|
*/
|
41
|
-
onChange?: (values: React.ReactText[]) => void;
|
26
|
+
onChange?: (values: React.ReactText[][]) => void;
|
42
27
|
/**
|
43
|
-
*
|
28
|
+
* 选项被点击时的回调。暂不对外暴露
|
29
|
+
* @private
|
44
30
|
*/
|
45
31
|
onSelect?: (selectedId: React.ReactText, selectedOption: CheckCascaderItemEventData) => void;
|
46
32
|
/**
|
@@ -70,7 +56,7 @@ export interface CheckCascaderProps {
|
|
70
56
|
/**
|
71
57
|
* 自定义渲染节点的 title 内容
|
72
58
|
*/
|
73
|
-
|
59
|
+
render?: (item: CheckCascaderItemEventData) => React.ReactNode;
|
74
60
|
/**
|
75
61
|
* 自定义选择后触发器所展示的内容
|
76
62
|
*/
|
@@ -80,13 +66,10 @@ export interface CheckCascaderProps {
|
|
80
66
|
*/
|
81
67
|
checkCascaded?: boolean;
|
82
68
|
/**
|
83
|
-
* 将 check
|
84
|
-
|
85
|
-
flatted?: boolean;
|
86
|
-
/**
|
87
|
-
* 开启全量搜索,默认只对开启 checkable 的选项进行搜索,不向上查找路径
|
69
|
+
* 将 check 子项拍平展示。暂不对外暴露
|
70
|
+
* @private
|
88
71
|
*/
|
89
|
-
|
72
|
+
type?: 'flatted' | 'tree';
|
90
73
|
/**
|
91
74
|
* 触发器输入框占位符
|
92
75
|
*/
|
@@ -98,13 +81,20 @@ export interface CheckCascaderProps {
|
|
98
81
|
/**
|
99
82
|
* 异步请求更新数据
|
100
83
|
*/
|
101
|
-
onLoadChildren?: (item: CheckCascaderItemEventData) => Promise<CheckCascaderItem[] | void> | void;
|
84
|
+
onLoadChildren?: (item: CheckCascaderItemEventData, idPaths: React.ReactText[]) => Promise<CheckCascaderItem[] | void> | void;
|
102
85
|
/**
|
103
|
-
* 是否单行展示,超出 +1
|
86
|
+
* 是否单行展示,超出 +1。暂不对外暴露
|
87
|
+
* @private
|
104
88
|
*/
|
105
89
|
wrap?: boolean;
|
106
90
|
/**
|
107
|
-
*
|
91
|
+
* 设置展现形式
|
92
|
+
*/
|
93
|
+
appearance?: HiBaseAppearanceEnum;
|
94
|
+
/**
|
95
|
+
* 自定义搜索过滤器,仅在 searchable 为 true 时有效
|
96
|
+
* 第一个参数为输入的关键字,
|
97
|
+
* 第二个为数据项,返回值为 true 时将出现在结果项
|
108
98
|
*/
|
109
|
-
|
99
|
+
filterOption?: (keyword: string, item: any) => boolean;
|
110
100
|
}
|
@@ -73,5 +73,5 @@ export interface CascaderMenusProps {
|
|
73
73
|
* 将 check 子项拍平展示
|
74
74
|
*/
|
75
75
|
flatted?: boolean;
|
76
|
-
onLoadChildren?: (item: CheckCascaderItemEventData) => Promise<CheckCascaderItem[] | void> | void;
|
76
|
+
onLoadChildren?: (item: CheckCascaderItemEventData, idPaths: React.ReactText[]) => Promise<CheckCascaderItem[] | void> | void;
|
77
77
|
}
|
package/lib/types/context.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ExpandTrigger, CheckCascaderItemEventData, CheckCascaderItem, FlattedCheckCascaderItem, CheckCascaderItemRequiredProps } from './types';
|
3
3
|
interface CheckCascaderContext {
|
4
|
-
onLoadChildren?: (item: CheckCascaderItemEventData) => Promise<CheckCascaderItem[] | void> | void;
|
4
|
+
onLoadChildren?: (item: CheckCascaderItemEventData, idPaths: React.ReactText[]) => Promise<CheckCascaderItem[] | void> | void;
|
5
5
|
disabled?: boolean;
|
6
6
|
expandTrigger?: ExpandTrigger;
|
7
7
|
onCheck?: (option: CheckCascaderItemEventData, shouldChecked: boolean) => void;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { CheckCascaderItem, CheckCascaderItemEventData } from '../types';
|
3
|
-
export declare const useAsyncSwitch: (setCascaderData: React.Dispatch<React.SetStateAction<CheckCascaderItem[]>>, onExpand?: ((selectedOption: CheckCascaderItemEventData) => void) | undefined, onLoadChildren?: ((item: CheckCascaderItemEventData) => Promise<CheckCascaderItem[] | void> | void) | undefined) => readonly [(id: React.ReactText) => boolean, (node: CheckCascaderItemEventData) => Promise<void>];
|
3
|
+
export declare const useAsyncSwitch: (setCascaderData: React.Dispatch<React.SetStateAction<CheckCascaderItem[]>>, onExpand?: ((selectedOption: CheckCascaderItemEventData) => void) | undefined, onLoadChildren?: ((item: CheckCascaderItemEventData, idPaths: React.ReactText[]) => Promise<CheckCascaderItem[] | void> | void) | undefined) => readonly [(id: React.ReactText) => boolean, (node: CheckCascaderItemEventData) => Promise<void>];
|
@@ -7,3 +7,7 @@ export declare const useSearch: (flattedData: FlattedCheckCascaderItem[], upMatc
|
|
7
7
|
value: string;
|
8
8
|
onChange: (evt: React.ChangeEvent<HTMLInputElement>) => void;
|
9
9
|
}, boolean];
|
10
|
+
/**
|
11
|
+
* 返回 -1 表示匹配失败
|
12
|
+
*/
|
13
|
+
export declare const matchStrategy: (content: unknown, keyword: string) => number;
|
package/lib/types/index.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hi-ui/check-cascader",
|
3
|
-
"version": "4.0.0-
|
3
|
+
"version": "4.0.0-beta.2",
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
5
5
|
"keywords": [],
|
6
6
|
"author": "HIUI <mi-hiui@xiaomi.com>",
|
@@ -37,38 +37,47 @@
|
|
37
37
|
"build:esm": "hi-build ./src/index.ts --format esm -d ./lib/esm",
|
38
38
|
"build:cjs": "hi-build ./src/index.ts --format cjs -d ./lib/cjs",
|
39
39
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib/types",
|
40
|
-
"build": "concurrently yarn:build:*"
|
40
|
+
"build": "concurrently yarn:build:*",
|
41
|
+
"start": "nodemon --watch src --exec yarn build -e ts,tsx"
|
41
42
|
},
|
42
43
|
"bugs": {
|
43
44
|
"url": "https://github.com/XiaoMi/hiui/issues"
|
44
45
|
},
|
45
46
|
"dependencies": {
|
46
|
-
"@hi-ui/checkbox": "^4.0.0-
|
47
|
-
"@hi-ui/classname": "^4.0.0-
|
48
|
-
"@hi-ui/core-css": "^4.0.0-
|
49
|
-
"@hi-ui/env": "^4.0.0-
|
50
|
-
"@hi-ui/icons": "^4.0.0-
|
51
|
-
"@hi-ui/input": "^4.0.0-
|
52
|
-
"@hi-ui/
|
53
|
-
"@hi-ui/
|
54
|
-
"@hi-ui/
|
55
|
-
"@hi-ui/
|
56
|
-
"@hi-ui/
|
57
|
-
"@hi-ui/
|
58
|
-
"@hi-ui/
|
59
|
-
"@hi-ui/
|
60
|
-
"@hi-ui/use-
|
47
|
+
"@hi-ui/checkbox": "^4.0.0-beta.0",
|
48
|
+
"@hi-ui/classname": "^4.0.0-beta.0",
|
49
|
+
"@hi-ui/core-css": "^4.0.0-beta.0",
|
50
|
+
"@hi-ui/env": "^4.0.0-beta.0",
|
51
|
+
"@hi-ui/icons": "^4.0.0-beta.0",
|
52
|
+
"@hi-ui/input": "^4.0.0-beta.0",
|
53
|
+
"@hi-ui/locale-context": "^4.0.0-beta.1",
|
54
|
+
"@hi-ui/picker": "^4.0.0-beta.2",
|
55
|
+
"@hi-ui/popper": "^4.0.0-beta.0",
|
56
|
+
"@hi-ui/spinner": "^4.0.0-beta.0",
|
57
|
+
"@hi-ui/tag-input": "^4.0.0-beta.0",
|
58
|
+
"@hi-ui/times": "^4.0.0-beta.0",
|
59
|
+
"@hi-ui/tree-utils": "^4.0.0-beta.0",
|
60
|
+
"@hi-ui/type-assertion": "^4.0.0-beta.0",
|
61
|
+
"@hi-ui/use-check": "^4.0.0-beta.0",
|
62
|
+
"@hi-ui/use-data-source": "^4.0.0-beta.0",
|
63
|
+
"@hi-ui/use-latest": "^4.0.0-beta.0",
|
64
|
+
"@hi-ui/use-merge-refs": "^4.0.0-beta.0",
|
65
|
+
"@hi-ui/use-outside-click": "^4.0.0-beta.0",
|
66
|
+
"@hi-ui/use-search-mode": "^4.0.0-beta.1",
|
67
|
+
"@hi-ui/use-toggle": "^4.0.0-beta.0",
|
68
|
+
"@hi-ui/use-uncontrolled-state": "^4.0.0-beta.0",
|
61
69
|
"@popperjs/core": "^2.9.3",
|
70
|
+
"lodash": "^4.17.21",
|
62
71
|
"react-popper": "^2.2.5"
|
63
72
|
},
|
64
73
|
"peerDependencies": {
|
65
|
-
"react": "
|
66
|
-
"react-dom": "
|
74
|
+
"react": ">=16.8.6",
|
75
|
+
"react-dom": ">=16.8.6"
|
67
76
|
},
|
68
77
|
"devDependencies": {
|
69
|
-
"@hi-ui/hi-build": "^4.0.0-
|
78
|
+
"@hi-ui/hi-build": "^4.0.0-beta.0",
|
70
79
|
"react": "^17.0.1",
|
71
80
|
"react-dom": "^17.0.1"
|
72
81
|
},
|
73
|
-
"gitHead": "
|
82
|
+
"gitHead": "c1dbc0c574e70ef14c6dec6494bafaf2c4f1b865"
|
74
83
|
}
|