@kne/super-select 0.1.1 → 0.1.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/dist/index.css +25 -12
- package/dist/index.css.map +1 -1
- package/dist/index.js +84 -62
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +84 -62
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -2
package/dist/index.modern.js
CHANGED
|
@@ -2410,7 +2410,7 @@ const SelectInput = p => {
|
|
|
2410
2410
|
};
|
|
2411
2411
|
const inputInnerRender = (props = {}) => /*#__PURE__*/React.createElement(Flex, _extends({}, props, {
|
|
2412
2412
|
ref: inputRef,
|
|
2413
|
-
className: classnames(className, style$3['select-input'], {
|
|
2413
|
+
className: classnames(className, style$3['select-input'], 'select-input', {
|
|
2414
2414
|
[style$3['wrap']]: labelWrap,
|
|
2415
2415
|
[style$3['disabled']]: disabled
|
|
2416
2416
|
}),
|
|
@@ -2422,7 +2422,7 @@ const SelectInput = p => {
|
|
|
2422
2422
|
setHover(false);
|
|
2423
2423
|
}
|
|
2424
2424
|
}), /*#__PURE__*/React.createElement("div", {
|
|
2425
|
-
className: style$3['select-input-inner']
|
|
2425
|
+
className: classnames(style$3['select-input-inner'], 'select-input-inner')
|
|
2426
2426
|
}, (value || []).length > 0 ? single || value[0].value === selectedAllValue.value ? value[0].label : value.map(item => {
|
|
2427
2427
|
return /*#__PURE__*/React.createElement(Tag, {
|
|
2428
2428
|
key: item.value,
|
|
@@ -2434,9 +2434,9 @@ const SelectInput = p => {
|
|
|
2434
2434
|
}
|
|
2435
2435
|
}, item.label);
|
|
2436
2436
|
}) : /*#__PURE__*/React.createElement("span", {
|
|
2437
|
-
className: style$3['placeholder']
|
|
2437
|
+
className: classnames(style$3['placeholder'], 'select-input-placeholder')
|
|
2438
2438
|
}, placeholder)), /*#__PURE__*/React.createElement("div", {
|
|
2439
|
-
className: style$3['select-input-icon']
|
|
2439
|
+
className: classnames(style$3['select-input-icon'], 'select-input-icon')
|
|
2440
2440
|
}, !disabled && allowClear && hover && (value || []).length > 0 ? /*#__PURE__*/React.createElement(CloseCircleFilled, {
|
|
2441
2441
|
onClick: e => {
|
|
2442
2442
|
e.stopPropagation();
|
|
@@ -2834,7 +2834,7 @@ function get(object, path, defaultValue) {
|
|
|
2834
2834
|
|
|
2835
2835
|
var get_1 = get;
|
|
2836
2836
|
|
|
2837
|
-
var style$2 = {"selected-all":"_prlgN"
|
|
2837
|
+
var style$2 = {"selected-all":"_prlgN"};
|
|
2838
2838
|
|
|
2839
2839
|
const SelectedAll = () => {
|
|
2840
2840
|
const {
|
|
@@ -2850,11 +2850,9 @@ const SelectedAll = () => {
|
|
|
2850
2850
|
unit: number => locale.numberOf.replace('%s', number)
|
|
2851
2851
|
}, props);
|
|
2852
2852
|
const isSelectedAll = computedIsSelectAll(value, selectedAllValue);
|
|
2853
|
-
return /*#__PURE__*/React.createElement(
|
|
2854
|
-
className: style$2['selected-all-outer']
|
|
2855
|
-
}, /*#__PURE__*/React.createElement(Flex, {
|
|
2853
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
2856
2854
|
justify: "space-between",
|
|
2857
|
-
className: style$2['selected-all']
|
|
2855
|
+
className: classnames(style$2['selected-all'], 'selected-all')
|
|
2858
2856
|
}, /*#__PURE__*/React.createElement(Flex, {
|
|
2859
2857
|
gap: 8
|
|
2860
2858
|
}, /*#__PURE__*/React.createElement("span", null, locale.selected, ":"), /*#__PURE__*/React.createElement("span", null, isSelectedAll ? selectedAllValue.label : typeof unit === 'function' ? unit(value.length) : value.length)), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
@@ -2867,13 +2865,13 @@ const SelectedAll = () => {
|
|
|
2867
2865
|
setValue([selectedAllValue]);
|
|
2868
2866
|
}
|
|
2869
2867
|
}
|
|
2870
|
-
}, locale.selectAll)))
|
|
2868
|
+
}, locale.selectAll)));
|
|
2871
2869
|
};
|
|
2872
2870
|
const computedIsSelectAll = (value, selectedAllValue) => {
|
|
2873
2871
|
return (value == null ? void 0 : value.length) === 1 && get_1(value, '[0].value') === selectedAllValue.value;
|
|
2874
2872
|
};
|
|
2875
2873
|
|
|
2876
|
-
var style$1 = {"label":"_l3KoW","tag-list":"_CCPzb","tag-
|
|
2874
|
+
var style$1 = {"label":"_l3KoW","tag-list":"_CCPzb","tag-container":"_dKZHi","tag-container-inner":"_oijCI"};
|
|
2877
2875
|
|
|
2878
2876
|
const SelectedTagList = () => {
|
|
2879
2877
|
const {
|
|
@@ -2886,14 +2884,12 @@ const SelectedTagList = () => {
|
|
|
2886
2884
|
single,
|
|
2887
2885
|
maxLength
|
|
2888
2886
|
} = Object.assign({}, props);
|
|
2889
|
-
return /*#__PURE__*/React.createElement(
|
|
2890
|
-
className: style$1['tag-list-
|
|
2891
|
-
}, /*#__PURE__*/React.createElement(Flex, {
|
|
2892
|
-
className: style$1['tag-list'],
|
|
2887
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
2888
|
+
className: classnames(style$1['tag-list'], 'selected-tag-list'),
|
|
2893
2889
|
gap: 8
|
|
2894
2890
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2895
2891
|
className: style$1['label']
|
|
2896
|
-
}, locale.selected, !single && `(${value.length}${Number.isInteger(maxLength) ? `/${maxLength}` : ''})`, ":"), /*#__PURE__*/React.createElement(SimpleBar, {
|
|
2892
|
+
}, locale.selected, !single && value.length > 0 && `(${value.length}${Number.isInteger(maxLength) ? `/${maxLength}` : ''})`, ":"), /*#__PURE__*/React.createElement(SimpleBar, {
|
|
2897
2893
|
className: style$1['tag-container']
|
|
2898
2894
|
}, /*#__PURE__*/React.createElement(Flex, {
|
|
2899
2895
|
gap: 8,
|
|
@@ -2909,7 +2905,7 @@ const SelectedTagList = () => {
|
|
|
2909
2905
|
onRemove(item);
|
|
2910
2906
|
}
|
|
2911
2907
|
}, item.label);
|
|
2912
|
-
}))))
|
|
2908
|
+
}))));
|
|
2913
2909
|
};
|
|
2914
2910
|
|
|
2915
2911
|
var defineProperty = (function() {
|
|
@@ -3828,7 +3824,7 @@ var merge = _createAssigner(function(object, source, srcIndex) {
|
|
|
3828
3824
|
|
|
3829
3825
|
var merge_1 = merge;
|
|
3830
3826
|
|
|
3831
|
-
var style = {"list":"_IsXdU","default-list":"_QD1Mz","is-selected-all":"_M-mOy","item-label":"_LLTTB","list-item":"_PKNDm","default-list-item":"_KtOsz","is-selected":"_TQhBB","default-item-label":"_gLh9e","default-item-des":"_GodU-","single-checked":"_2rUrh","is-disabled":"_NbwX5","default-item-description":"_yjSTl"};
|
|
3827
|
+
var style = {"list":"_IsXdU","is-popup":"_-dvpa","default-list":"_QD1Mz","is-selected-all":"_M-mOy","item-label":"_LLTTB","list-item":"_PKNDm","default-list-item":"_KtOsz","is-selected":"_TQhBB","default-item-label":"_gLh9e","default-item-des":"_GodU-","single-checked":"_2rUrh","is-disabled":"_NbwX5","default-item-description":"_yjSTl","selected-all":"_vN2Fx","selected-tag":"_6oITk","select-search":"_iAH9D"};
|
|
3832
3828
|
|
|
3833
3829
|
const _excluded = ["children"];
|
|
3834
3830
|
const SelectList = _ref => {
|
|
@@ -3837,11 +3833,11 @@ const SelectList = _ref => {
|
|
|
3837
3833
|
} = _ref,
|
|
3838
3834
|
p = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
3839
3835
|
const props = Object.assign({}, {
|
|
3840
|
-
|
|
3836
|
+
renderItem: ({
|
|
3837
|
+
item,
|
|
3841
3838
|
props,
|
|
3842
3839
|
isSelectedAll,
|
|
3843
3840
|
value,
|
|
3844
|
-
list,
|
|
3845
3841
|
onSelect,
|
|
3846
3842
|
setValue,
|
|
3847
3843
|
onOpenChange
|
|
@@ -3850,50 +3846,61 @@ const SelectList = _ref => {
|
|
|
3850
3846
|
single,
|
|
3851
3847
|
isPopup
|
|
3852
3848
|
} = props;
|
|
3849
|
+
const isChecked = value.some(target => target.value === item.value);
|
|
3850
|
+
return /*#__PURE__*/React.createElement(List.Item, {
|
|
3851
|
+
className: classnames(style['default-list-item'], {
|
|
3852
|
+
[style['is-selected']]: isChecked
|
|
3853
|
+
}),
|
|
3854
|
+
key: item.value,
|
|
3855
|
+
onClick: () => {
|
|
3856
|
+
if (item.disabled) {
|
|
3857
|
+
return;
|
|
3858
|
+
}
|
|
3859
|
+
if (isSelectedAll) {
|
|
3860
|
+
return;
|
|
3861
|
+
}
|
|
3862
|
+
if (single) {
|
|
3863
|
+
setValue([item]);
|
|
3864
|
+
} else {
|
|
3865
|
+
onSelect(item);
|
|
3866
|
+
}
|
|
3867
|
+
if (isPopup && single) {
|
|
3868
|
+
onOpenChange(false);
|
|
3869
|
+
}
|
|
3870
|
+
}
|
|
3871
|
+
}, !single && /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
3872
|
+
checked: isSelectedAll || isChecked,
|
|
3873
|
+
disabled: isSelectedAll || item.disabled
|
|
3874
|
+
})), /*#__PURE__*/React.createElement(Flex, {
|
|
3875
|
+
vertical: true,
|
|
3876
|
+
gag: 8,
|
|
3877
|
+
flex: 1
|
|
3878
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3879
|
+
className: style['default-item-label']
|
|
3880
|
+
}, item.label), item.description && /*#__PURE__*/React.createElement("div", {
|
|
3881
|
+
className: style['default-item-description']
|
|
3882
|
+
}, item.description)), single && /*#__PURE__*/React.createElement("div", {
|
|
3883
|
+
className: style['single-checked']
|
|
3884
|
+
}, isChecked && /*#__PURE__*/React.createElement(CheckOutlined, null)));
|
|
3885
|
+
},
|
|
3886
|
+
renderList: contextProps => {
|
|
3887
|
+
const {
|
|
3888
|
+
props,
|
|
3889
|
+
isSelectedAll,
|
|
3890
|
+
list
|
|
3891
|
+
} = contextProps;
|
|
3892
|
+
const {
|
|
3893
|
+
renderItem
|
|
3894
|
+
} = props;
|
|
3853
3895
|
return /*#__PURE__*/React.createElement(List, {
|
|
3854
3896
|
className: classnames(style['default-list'], {
|
|
3855
3897
|
[style['is-selected-all']]: isSelectedAll
|
|
3856
3898
|
}),
|
|
3857
3899
|
size: "small",
|
|
3858
3900
|
dataSource: list,
|
|
3859
|
-
renderItem: item => {
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
className: classnames(style['default-list-item'], {
|
|
3863
|
-
[style['is-selected']]: isChecked
|
|
3864
|
-
}),
|
|
3865
|
-
key: item.value,
|
|
3866
|
-
onClick: () => {
|
|
3867
|
-
if (item.disabled) {
|
|
3868
|
-
return;
|
|
3869
|
-
}
|
|
3870
|
-
if (isSelectedAll) {
|
|
3871
|
-
return;
|
|
3872
|
-
}
|
|
3873
|
-
if (single) {
|
|
3874
|
-
setValue([item]);
|
|
3875
|
-
} else {
|
|
3876
|
-
onSelect(item);
|
|
3877
|
-
}
|
|
3878
|
-
if (isPopup && single) {
|
|
3879
|
-
onOpenChange(false);
|
|
3880
|
-
}
|
|
3881
|
-
}
|
|
3882
|
-
}, !single && /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
3883
|
-
checked: isSelectedAll || isChecked,
|
|
3884
|
-
disabled: isSelectedAll || item.disabled
|
|
3885
|
-
})), /*#__PURE__*/React.createElement(Flex, {
|
|
3886
|
-
vertical: true,
|
|
3887
|
-
gag: 8,
|
|
3888
|
-
flex: 1
|
|
3889
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3890
|
-
className: style['default-item-label']
|
|
3891
|
-
}, item.label), item.description && /*#__PURE__*/React.createElement("div", {
|
|
3892
|
-
className: style['default-item-description']
|
|
3893
|
-
}, item.description)), single && /*#__PURE__*/React.createElement("div", {
|
|
3894
|
-
className: style['single-checked']
|
|
3895
|
-
}, isChecked && /*#__PURE__*/React.createElement(CheckOutlined, null)));
|
|
3896
|
-
}
|
|
3901
|
+
renderItem: item => renderItem(Object.assign({}, contextProps, {
|
|
3902
|
+
item
|
|
3903
|
+
}))
|
|
3897
3904
|
});
|
|
3898
3905
|
}
|
|
3899
3906
|
}, p);
|
|
@@ -3921,6 +3928,9 @@ const SelectList = _ref => {
|
|
|
3921
3928
|
} = props;
|
|
3922
3929
|
const components = {
|
|
3923
3930
|
search: (api && typeof getSearchProps === 'function' || options && typeof getSearchCallback === 'function') && /*#__PURE__*/React.createElement(SearchInput, {
|
|
3931
|
+
className: classnames(style['select-search'], 'select-search', {
|
|
3932
|
+
'is-popup': isPopup
|
|
3933
|
+
}),
|
|
3924
3934
|
placeholder: searchPlaceholder,
|
|
3925
3935
|
value: searchText,
|
|
3926
3936
|
onSearch: value => {
|
|
@@ -3929,9 +3939,15 @@ const SelectList = _ref => {
|
|
|
3929
3939
|
simple: isPopup,
|
|
3930
3940
|
showSearchButton: !isPopup
|
|
3931
3941
|
}),
|
|
3932
|
-
selectedAll: !single && allowSelectedAll && /*#__PURE__*/React.createElement(
|
|
3942
|
+
selectedAll: !single && allowSelectedAll && /*#__PURE__*/React.createElement("div", {
|
|
3943
|
+
className: classnames(style['selected-all'], 'selected-all', {
|
|
3944
|
+
'is-popup': isPopup
|
|
3945
|
+
})
|
|
3946
|
+
}, /*#__PURE__*/React.createElement(SelectedAll, null)),
|
|
3933
3947
|
fetchList: /*#__PURE__*/React.createElement(FetchScrollLoader, _extends({}, props, {
|
|
3934
|
-
className: style['list'],
|
|
3948
|
+
className: classnames(style['list'], 'select-list', {
|
|
3949
|
+
'is-popup': isPopup
|
|
3950
|
+
}),
|
|
3935
3951
|
api: Object.assign({}, options ? {
|
|
3936
3952
|
data: {
|
|
3937
3953
|
options,
|
|
@@ -3963,10 +3979,16 @@ const SelectList = _ref => {
|
|
|
3963
3979
|
isSelectedAll
|
|
3964
3980
|
}));
|
|
3965
3981
|
}),
|
|
3966
|
-
selectedTag: showSelectedTag && /*#__PURE__*/React.createElement(
|
|
3982
|
+
selectedTag: showSelectedTag && /*#__PURE__*/React.createElement("div", {
|
|
3983
|
+
className: classnames(style['selected-tag'], 'selected-tag', {
|
|
3984
|
+
'is-popup': isPopup
|
|
3985
|
+
})
|
|
3986
|
+
}, /*#__PURE__*/React.createElement(SelectedTagList, null))
|
|
3967
3987
|
};
|
|
3968
3988
|
if (typeof children === 'function') {
|
|
3969
|
-
return children(
|
|
3989
|
+
return children(Object.assign({}, targetProps, {
|
|
3990
|
+
components
|
|
3991
|
+
}));
|
|
3970
3992
|
}
|
|
3971
3993
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
3972
3994
|
vertical: true
|