ywana-core8 0.0.139 → 0.0.143
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/dist/index.cjs +25 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +25 -16
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +25 -16
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/textfield.js +14 -14
package/dist/index.modern.js
CHANGED
@@ -929,10 +929,6 @@ var DropDown = function DropDown(props) {
|
|
929
929
|
label = _useState2[0],
|
930
930
|
setLabel = _useState2[1];
|
931
931
|
|
932
|
-
var _useState3 = useState(),
|
933
|
-
filter = _useState3[0],
|
934
|
-
setFilter = _useState3[1];
|
935
|
-
|
936
932
|
useEffect(function () {
|
937
933
|
if (Array.isArray(options)) {
|
938
934
|
var option = options.find(function (option) {
|
@@ -946,7 +942,7 @@ var DropDown = function DropDown(props) {
|
|
946
942
|
console.log('dropdown change > canFilter:', canFilter, id, value);
|
947
943
|
|
948
944
|
if (canFilter) {
|
949
|
-
|
945
|
+
setLabel(value);
|
950
946
|
} else {
|
951
947
|
if (onChange) onChange(id, value);
|
952
948
|
}
|
@@ -974,14 +970,29 @@ var DropDown = function DropDown(props) {
|
|
974
970
|
setOpen(false);
|
975
971
|
}
|
976
972
|
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
973
|
+
function renderOptions() {
|
974
|
+
var canShow = open == true && Array.isArray(options);
|
975
|
+
|
976
|
+
if (canShow) {
|
977
|
+
var filterActive = canFilter && label && label.length > 0;
|
978
|
+
var items = filterActive ? options.filter(function (option) {
|
979
|
+
return option.label.toUpperCase().indexOf(label.toUpperCase()) >= 0;
|
980
|
+
}) : options;
|
981
|
+
console.log('filterActive: ', filterActive, label, items.length);
|
982
|
+
var lis = items.map(function (option) {
|
983
|
+
return /*#__PURE__*/React.createElement("li", {
|
984
|
+
key: option.value,
|
985
|
+
value: option.value
|
986
|
+
}, option.label);
|
987
|
+
});
|
988
|
+
return /*#__PURE__*/React.createElement("menu", null, /*#__PURE__*/React.createElement("ul", {
|
989
|
+
onClick: select
|
990
|
+
}, lis));
|
991
|
+
} else {
|
992
|
+
return null;
|
993
|
+
}
|
994
|
+
}
|
995
|
+
|
985
996
|
return /*#__PURE__*/React.createElement("div", {
|
986
997
|
className: "dropdown"
|
987
998
|
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
@@ -993,9 +1004,7 @@ var DropDown = function DropDown(props) {
|
|
993
1004
|
clickable: true,
|
994
1005
|
size: "small",
|
995
1006
|
action: toggle
|
996
|
-
}),
|
997
|
-
onClick: select
|
998
|
-
}, items)) : null);
|
1007
|
+
}), renderOptions());
|
999
1008
|
};
|
1000
1009
|
|
1001
1010
|
var isFunction$1 = function isFunction(value) {
|