@kne/super-select 0.1.26 → 0.1.28
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 +11 -3
- package/dist/index.css +5 -51
- package/dist/index.css.map +1 -1
- package/dist/index.js +81 -131
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +77 -128
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +2 -1
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +2 -1
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +2 -1
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +2 -1
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +2 -1
package/dist/index.modern.js
CHANGED
|
@@ -15,6 +15,8 @@ import 'simplebar-react/dist/simplebar.min.css';
|
|
|
15
15
|
import SearchInput from '@kne/search-input';
|
|
16
16
|
import { FetchScrollLoader } from '@kne/scroll-loader';
|
|
17
17
|
import '@kne/scroll-loader/dist/index.css';
|
|
18
|
+
import { TableView } from '@kne/info-page';
|
|
19
|
+
import '@kne/info-page/dist/index.css';
|
|
18
20
|
import memoize from 'lodash/memoize';
|
|
19
21
|
import isNil from 'lodash/isNil';
|
|
20
22
|
import Fetch from '@kne/react-fetch';
|
|
@@ -53,7 +55,8 @@ const locale$1 = {
|
|
|
53
55
|
search: '搜索',
|
|
54
56
|
numberOf: '{number}个',
|
|
55
57
|
maxLengthError: '最大数量不能超过{maxLength}',
|
|
56
|
-
defaultChildren: '下拉内容,需要调用方实现'
|
|
58
|
+
defaultChildren: '下拉内容,需要调用方实现',
|
|
59
|
+
removeAll: '移除全部'
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
const locale = {
|
|
@@ -63,7 +66,8 @@ const locale = {
|
|
|
63
66
|
search: 'Search',
|
|
64
67
|
numberOf: '{number} items',
|
|
65
68
|
maxLengthError: 'The maximum number cannot exceed {maxLength}',
|
|
66
|
-
defaultChildren: 'Dropdown content, to be implemented by the caller'
|
|
69
|
+
defaultChildren: 'Dropdown content, to be implemented by the caller',
|
|
70
|
+
removeAll: 'Remove All'
|
|
67
71
|
};
|
|
68
72
|
|
|
69
73
|
const _excluded$2 = ["children"];
|
|
@@ -353,6 +357,9 @@ const SelectInput = createWithIntlProvider({
|
|
|
353
357
|
useImperativeHandle(ref, () => {
|
|
354
358
|
return contextProps;
|
|
355
359
|
});
|
|
360
|
+
if (props.renderContent && typeof props.renderContent === 'function') {
|
|
361
|
+
return props.renderContent(children(contextProps));
|
|
362
|
+
}
|
|
356
363
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
357
364
|
value: contextProps
|
|
358
365
|
}, isPopup ? /*#__PURE__*/React.createElement(Dropdown, {
|
|
@@ -680,7 +687,7 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
680
687
|
});
|
|
681
688
|
});
|
|
682
689
|
|
|
683
|
-
var style$1 = {"list":"_DrEYJ","is-popup":"_KgWTX","empty":"_5Tyrt","
|
|
690
|
+
var style$1 = {"list":"_DrEYJ","is-popup":"_KgWTX","empty":"_5Tyrt","table":"_zE-14","right-options":"_UXi-g","no-padding-btn":"_iaCir","tag":"_JkYqS","tag-inner":"_VZlBL","single-checked":"_Eiz-u","select-search":"_temy6","tags-search":"_7phL2","descriptions":"_ttNK9","descriptions-col-label":"_xU-i7","descriptions-col-content":"_SvfzQ","footer":"_lISfA"};
|
|
684
691
|
|
|
685
692
|
const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select')(forwardRef((p, ref) => {
|
|
686
693
|
const {
|
|
@@ -747,14 +754,14 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
747
754
|
onSelect,
|
|
748
755
|
onRemove,
|
|
749
756
|
onOpenChange,
|
|
750
|
-
searchProps
|
|
751
|
-
getSearchProps
|
|
757
|
+
searchProps
|
|
752
758
|
} = targetProps;
|
|
753
759
|
const {
|
|
754
760
|
footer,
|
|
755
761
|
filterRender,
|
|
756
762
|
columns,
|
|
757
763
|
options,
|
|
764
|
+
getSearchProps,
|
|
758
765
|
getSearchCallback,
|
|
759
766
|
getTagSearchCallback,
|
|
760
767
|
api,
|
|
@@ -786,133 +793,73 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
786
793
|
[style$1['single-body']]: single
|
|
787
794
|
}),
|
|
788
795
|
span: single ? 24 : 16
|
|
789
|
-
}, /*#__PURE__*/React.createElement("div", null, filterRender(Object.assign({}, targetProps))), /*#__PURE__*/React.createElement(
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
setValue([]);
|
|
800
|
-
} else {
|
|
801
|
-
setValue([selectedAllValue]);
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
}) : /*#__PURE__*/React.createElement(Checkbox, {
|
|
805
|
-
style: {
|
|
806
|
-
visibility: 'hidden'
|
|
807
|
-
}
|
|
808
|
-
})), /*#__PURE__*/React.createElement(Col, {
|
|
809
|
-
flex: 1
|
|
810
|
-
}, /*#__PURE__*/React.createElement(Row, {
|
|
811
|
-
wrap: false
|
|
812
|
-
}, columns.map(column => {
|
|
813
|
-
const {
|
|
814
|
-
name,
|
|
815
|
-
title,
|
|
816
|
-
span
|
|
817
|
-
} = column;
|
|
818
|
-
return /*#__PURE__*/React.createElement(Col, {
|
|
819
|
-
key: name,
|
|
820
|
-
span: span,
|
|
821
|
-
className: classnames(style$1['col'], 'select-table-list-col')
|
|
822
|
-
}, title);
|
|
823
|
-
})))), /*#__PURE__*/React.createElement(FetchScrollLoader, _extends({}, props, {
|
|
824
|
-
className: classnames(style$1['list'], 'select-table-list-scroll-list', {
|
|
825
|
-
'is-popup': isPopup
|
|
826
|
-
}),
|
|
827
|
-
searchProps: searchProps,
|
|
828
|
-
getSearchProps: getSearchProps,
|
|
829
|
-
api: Object.assign({}, options ? {
|
|
830
|
-
data: {
|
|
831
|
-
options,
|
|
832
|
-
searchProps
|
|
796
|
+
}, /*#__PURE__*/React.createElement("div", null, filterRender(Object.assign({}, targetProps))), /*#__PURE__*/React.createElement("div", {
|
|
797
|
+
className: classnames(style$1['table'], 'select-table')
|
|
798
|
+
}, /*#__PURE__*/React.createElement(TableView, {
|
|
799
|
+
columns: columns,
|
|
800
|
+
rowKey: valueKey,
|
|
801
|
+
rowSelection: {
|
|
802
|
+
allowSelectedAll,
|
|
803
|
+
isSelectedAll,
|
|
804
|
+
onIsSelectAllChange: isSelectedAll => {
|
|
805
|
+
setValue(isSelectedAll ? [selectedAllValue] : []);
|
|
833
806
|
},
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
} = data;
|
|
841
|
-
if (typeof getSearchCallback === 'function') {
|
|
842
|
-
const newOptions = options.filter(item => getSearchCallback(searchProps, item, targetProps));
|
|
843
|
-
return {
|
|
844
|
-
pageData: newOptions
|
|
845
|
-
};
|
|
807
|
+
type: single ? 'radio' : 'checkbox',
|
|
808
|
+
selectedRowKeys: (value || []).map(item => item[valueKey]),
|
|
809
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
810
|
+
setValue(selectedRows);
|
|
811
|
+
if (isPopup && single) {
|
|
812
|
+
onOpenChange(false);
|
|
846
813
|
}
|
|
847
|
-
return {
|
|
848
|
-
pageData: options
|
|
849
|
-
};
|
|
850
814
|
}
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
return
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
setValue([item]);
|
|
884
|
-
} else {
|
|
885
|
-
onSelect(item);
|
|
886
|
-
}
|
|
887
|
-
if (isPopup && single) {
|
|
888
|
-
onOpenChange(false);
|
|
815
|
+
},
|
|
816
|
+
render: ({
|
|
817
|
+
header,
|
|
818
|
+
renderBody
|
|
819
|
+
}) => {
|
|
820
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, header, /*#__PURE__*/React.createElement(FetchScrollLoader, _extends({}, props, {
|
|
821
|
+
className: classnames(style$1['list'], 'select-table-list-scroll-list', {
|
|
822
|
+
'is-popup': isPopup
|
|
823
|
+
}),
|
|
824
|
+
searchProps: searchProps,
|
|
825
|
+
getSearchProps: getSearchProps,
|
|
826
|
+
api: Object.assign({}, options ? {
|
|
827
|
+
data: {
|
|
828
|
+
options,
|
|
829
|
+
searchProps
|
|
830
|
+
},
|
|
831
|
+
loader: ({
|
|
832
|
+
data
|
|
833
|
+
}) => {
|
|
834
|
+
const {
|
|
835
|
+
options,
|
|
836
|
+
searchProps
|
|
837
|
+
} = data;
|
|
838
|
+
if (typeof getSearchCallback === 'function') {
|
|
839
|
+
const newOptions = options.filter(item => getSearchCallback(searchProps, item, targetProps));
|
|
840
|
+
return {
|
|
841
|
+
pageData: newOptions
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
return {
|
|
845
|
+
pageData: options
|
|
846
|
+
};
|
|
889
847
|
}
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
894
|
-
disabled: item.disabled || isSelectedAll,
|
|
895
|
-
checked: isSelectedAll || isChecked
|
|
896
|
-
})), /*#__PURE__*/React.createElement(Col, {
|
|
897
|
-
flex: 1
|
|
898
|
-
}, /*#__PURE__*/React.createElement(Row, {
|
|
899
|
-
wrap: false
|
|
900
|
-
}, columns.map(column => {
|
|
848
|
+
} : api),
|
|
849
|
+
ref: fetchListRef
|
|
850
|
+
}), fetchProps => {
|
|
901
851
|
const {
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
}, isChecked && /*#__PURE__*/React.createElement(CheckOutlined, null)));
|
|
914
|
-
});
|
|
915
|
-
}), single && footerEl || /*#__PURE__*/React.createElement("div", {
|
|
852
|
+
list
|
|
853
|
+
} = fetchProps;
|
|
854
|
+
if (!(list && list.length > 0)) {
|
|
855
|
+
return props.empty || /*#__PURE__*/React.createElement(Empty, {
|
|
856
|
+
className: classnames(style$1['empty'])
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
return renderBody(list);
|
|
860
|
+
}));
|
|
861
|
+
}
|
|
862
|
+
})), single && footerEl || /*#__PURE__*/React.createElement("div", {
|
|
916
863
|
className: classnames(style$1['footer'], 'select-table-footer')
|
|
917
864
|
})), !single && /*#__PURE__*/React.createElement(Col, {
|
|
918
865
|
className: classnames(style$1['right-options'], {
|
|
@@ -939,7 +886,9 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
939
886
|
onClick: () => {
|
|
940
887
|
setValue([]);
|
|
941
888
|
}
|
|
942
|
-
},
|
|
889
|
+
}, formatMessage({
|
|
890
|
+
id: 'removeAll'
|
|
891
|
+
})))), /*#__PURE__*/React.createElement(SimpleBar, null, /*#__PURE__*/React.createElement(Flex, {
|
|
943
892
|
wrap: true,
|
|
944
893
|
gap: 8
|
|
945
894
|
}, value.filter(item => getTagSearchCallback(tagSearchText, item, targetProps)).map(item => {
|