@kne/super-select 0.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/README.md +111 -0
- package/dist/index.css +159 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +3157 -0
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +3149 -0
- package/dist/index.modern.js.map +1 -0
- package/package.json +97 -0
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
|
|
2
|
+
# super-select
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### 描述
|
|
6
|
+
|
|
7
|
+
用于复杂信息选择.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### 安装
|
|
11
|
+
|
|
12
|
+
```shell
|
|
13
|
+
npm i --save @kne/super-select
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### 示例
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#### 示例样式
|
|
20
|
+
|
|
21
|
+
```scss
|
|
22
|
+
.max-width-150 {
|
|
23
|
+
max-width: 150px;
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
#### 示例代码
|
|
28
|
+
|
|
29
|
+
- select-input
|
|
30
|
+
- 用于显示一个选择框,可以下拉展开选项或者以modal展示选项
|
|
31
|
+
- _SuperSelect(@kne/current-lib_super-select)[import * as _SuperSelect from "@kne/super-select"],antd(antd),(@kne/current-lib_super-select/dist/index.css)
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
const { SelectInput } = _SuperSelect;
|
|
35
|
+
const { Space, Flex } = antd;
|
|
36
|
+
|
|
37
|
+
const BaseExample = () => {
|
|
38
|
+
return <Flex vertical gap={8}>
|
|
39
|
+
<Space>
|
|
40
|
+
<SelectInput />
|
|
41
|
+
<SelectInput defaultValue={[{ value: 0, label: '第一项' }, { value: 1, label: '第二项' }]} />
|
|
42
|
+
<SelectInput defaultValue={[{ value: 'all', label: '全选' }]} />
|
|
43
|
+
<SelectInput className="max-width-150" defaultValue={Array.from({ length: 10 }).map((value, index) => {
|
|
44
|
+
return { value: index, label: `第${index}项` };
|
|
45
|
+
})} />
|
|
46
|
+
<SelectInput defaultValue={[{ value: 0, label: '第一项' }, { value: 1, label: '第二项' }]} disabled />
|
|
47
|
+
</Space>
|
|
48
|
+
<Space>
|
|
49
|
+
<SelectInput isPopup={false}/>
|
|
50
|
+
</Space>
|
|
51
|
+
</Flex>;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
render(<BaseExample />);
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- select-list
|
|
59
|
+
- 列表选择
|
|
60
|
+
- _SuperSelect(@kne/current-lib_super-select)[import * as _SuperSelect from "@kne/super-select"],antd(antd),(@kne/current-lib_super-select/dist/index.css)
|
|
61
|
+
|
|
62
|
+
```jsx
|
|
63
|
+
const { default: SuperSelect } = _SuperSelect;
|
|
64
|
+
const { Space } = antd;
|
|
65
|
+
|
|
66
|
+
const optionList = Array.from({ length: 20 }).map((item, key) => {
|
|
67
|
+
return {
|
|
68
|
+
label: `第${key + 1}项`, value: key + 1
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const BaseExample = () => {
|
|
73
|
+
return <Space wrap>
|
|
74
|
+
<SuperSelect options={optionList} />
|
|
75
|
+
<SuperSelect single options={optionList} />
|
|
76
|
+
<SuperSelect allowSelectedAll options={optionList} maxLength={10} getSearchCallback={(searchText, item) => {
|
|
77
|
+
return item.label.indexOf(searchText) > -1;
|
|
78
|
+
}} />
|
|
79
|
+
<SuperSelect allowSelectedAll options={optionList} isPopup={false} getSearchCallback={(searchText, item) => {
|
|
80
|
+
return item.label.indexOf(searchText) > -1;
|
|
81
|
+
}} />
|
|
82
|
+
<SuperSelect allowSelectedAll api={{
|
|
83
|
+
data: {}, loader: ({ data }) => {
|
|
84
|
+
const { searchText } = data;
|
|
85
|
+
if (!searchText) {
|
|
86
|
+
return {
|
|
87
|
+
pageData: optionList, totalCount: optionList.length
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const newOptionList = optionList.filter((item) => item.label.indexOf(searchText) > -1);
|
|
91
|
+
return {
|
|
92
|
+
pageData: newOptionList, totalCount: newOptionList.length
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}} isPopup={false} getSearchProps={(searchText) => {
|
|
96
|
+
return { data: { searchText } };
|
|
97
|
+
}} />
|
|
98
|
+
</Space>;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
render(<BaseExample />);
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### API
|
|
107
|
+
|
|
108
|
+
| 属性名 | 说明 | 类型 | 默认值 |
|
|
109
|
+
|-----|----|----|-----|
|
|
110
|
+
| | | | |
|
|
111
|
+
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
._d8lGc {
|
|
2
|
+
--line-height: 30px;
|
|
3
|
+
background-color: #fff;
|
|
4
|
+
font-size: var(--font-size-default);
|
|
5
|
+
border: 1px solid var(--font-color-grey-3);
|
|
6
|
+
border-radius: 2px;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
width: 100%;
|
|
9
|
+
min-width: 150px;
|
|
10
|
+
position: relative;
|
|
11
|
+
padding: 0 11px;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
}
|
|
14
|
+
._d8lGc .ant-tag {
|
|
15
|
+
background: var(--bg-color-grey-3);
|
|
16
|
+
}
|
|
17
|
+
._d8lGc:not(._3kjwO):hover {
|
|
18
|
+
border-color: var(--primary-color);
|
|
19
|
+
}
|
|
20
|
+
._d8lGc._3kjwO {
|
|
21
|
+
background: var(--bg-color-grey-2);
|
|
22
|
+
color: var(--font-color-grey-2);
|
|
23
|
+
cursor: not-allowed;
|
|
24
|
+
}
|
|
25
|
+
._d8lGc._3kjwO .ant-tag {
|
|
26
|
+
color: var(--font-color-grey-2);
|
|
27
|
+
}
|
|
28
|
+
._d8lGc._3kjwO .ant-tag-close-icon {
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
._d8lGc._dsTM2 ._NQoX9 {
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
}
|
|
34
|
+
._d8lGc._T8ZX8 {
|
|
35
|
+
--line-height: 40px;
|
|
36
|
+
}
|
|
37
|
+
._d8lGc._1B72H {
|
|
38
|
+
--line-height: 24px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
._NQoX9 {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
padding-right: 6px;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
min-height: var(--line-height);
|
|
47
|
+
}
|
|
48
|
+
._NQoX9 .ant-tag {
|
|
49
|
+
margin: 2px 4px 2px 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
._g8QC- {
|
|
53
|
+
line-height: var(--line-height);
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
color: var(--font-color-grey-2);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
._r3q69 {
|
|
59
|
+
color: var(--font-color-grey-2);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
._zEqGe {
|
|
63
|
+
min-width: 300px;
|
|
64
|
+
width: var(--overlay-width);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
._ybN30 .ant-popover-inner {
|
|
68
|
+
padding: 0;
|
|
69
|
+
}
|
|
70
|
+
._prlgN {
|
|
71
|
+
padding: 5px 12px;
|
|
72
|
+
}
|
|
73
|
+
._prlgN .ant-checkbox + span {
|
|
74
|
+
padding-inline-end: 0;
|
|
75
|
+
}
|
|
76
|
+
._prlgN .ant-checkbox-wrapper {
|
|
77
|
+
margin-inline-end: 0 !important;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
._h6RBS {
|
|
81
|
+
border-top: solid 1px var(--font-color-grey-4);
|
|
82
|
+
}
|
|
83
|
+
._l3KoW {
|
|
84
|
+
text-wrap: nowrap;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
._CCPzb {
|
|
88
|
+
padding: 12px 0 12px 12px;
|
|
89
|
+
box-sizing: border-box;
|
|
90
|
+
}
|
|
91
|
+
._CCPzb .ant-tag {
|
|
92
|
+
background: var(--bg-color-grey-3);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
._epbhk {
|
|
96
|
+
border-top: solid 1px var(--font-color-grey-4);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
._dKZHi {
|
|
100
|
+
max-height: 100px;
|
|
101
|
+
flex: 1;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
._oijCI {
|
|
105
|
+
padding-right: 12px;
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
}
|
|
108
|
+
._IsXdU {
|
|
109
|
+
max-height: 300px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
._QD1Mz._M-mOy {
|
|
113
|
+
background: var(--bg-color-grey-3);
|
|
114
|
+
cursor: not-allowed;
|
|
115
|
+
}
|
|
116
|
+
._QD1Mz._M-mOy ._LLTTB {
|
|
117
|
+
color: var(--font-color-grey-2);
|
|
118
|
+
}
|
|
119
|
+
._QD1Mz._M-mOy ._PKNDm {
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
._KtOsz {
|
|
124
|
+
padding: 5px 12px !important;
|
|
125
|
+
border-bottom: none;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
transition: background 300ms;
|
|
128
|
+
position: relative;
|
|
129
|
+
border-bottom-color: transparent !important;
|
|
130
|
+
}
|
|
131
|
+
._KtOsz:not(._TQhBB):hover {
|
|
132
|
+
background: var(--bg-color-grey-1);
|
|
133
|
+
}
|
|
134
|
+
._KtOsz._TQhBB {
|
|
135
|
+
background: var(--primary-color-1);
|
|
136
|
+
}
|
|
137
|
+
._KtOsz._TQhBB ._gLh9e,
|
|
138
|
+
._KtOsz._TQhBB ._GodU-,
|
|
139
|
+
._KtOsz._TQhBB ._2rUrh {
|
|
140
|
+
color: var(--primary-color);
|
|
141
|
+
}
|
|
142
|
+
._KtOsz._NbwX5 {
|
|
143
|
+
color: var(--font-color-grey-2);
|
|
144
|
+
cursor: not-allowed;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
._gLh9e,
|
|
148
|
+
._yjSTl {
|
|
149
|
+
transition: color 300ms;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
._yjSTl {
|
|
153
|
+
color: var(--font-color-grey-1);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
._2rUrh {
|
|
157
|
+
flex-basis: 14px;
|
|
158
|
+
}
|
|
159
|
+
/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["style.module.scss"],"names":[],"mappings":"AAAA;EACE,mBAAmB;EACnB,sBAAsB;EACtB,mCAAmC;EACnC,0CAA0C;EAC1C,kBAAkB;EAClB,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,kBAAkB;EAClB,eAAe;EACf,uBAAuB;AACzB;AACA;EACE,kCAAkC;AACpC;AACA;EACE,kCAAkC;AACpC;AACA;EACE,kCAAkC;EAClC,+BAA+B;EAC/B,mBAAmB;AACrB;AACA;EACE,+BAA+B;AACjC;AACA;EACE,aAAa;AACf;AACA;EACE,eAAe;AACjB;AACA;EACE,mBAAmB;AACrB;AACA;EACE,mBAAmB;AACrB;;AAEA;EACE,aAAa;EACb,mBAAmB;EACnB,kBAAkB;EAClB,gBAAgB;EAChB,8BAA8B;AAChC;AACA;EACE,qBAAqB;AACvB;;AAEA;EACE,+BAA+B;EAC/B,eAAe;EACf,+BAA+B;AACjC;;AAEA;EACE,+BAA+B;AACjC;;AAEA;EACE,gBAAgB;EAChB,2BAA2B;AAC7B;;AAEA;EACE,UAAU;AACZ;AApEA;EACE,iBAAiB;AACnB;AACA;EACE,qBAAqB;AACvB;AACA;EACE,+BAA+B;AACjC;;AAEA;EACE,8CAA8C;AAChD;AAZA;EACE,iBAAiB;AACnB;;AAEA;EACE,yBAAyB;EACzB,sBAAsB;AACxB;AACA;EACE,kCAAkC;AACpC;;AAEA;EACE,8CAA8C;AAChD;;AAEA;EACE,iBAAiB;EACjB,OAAO;AACT;;AAEA;EACE,mBAAmB;EACnB,sBAAsB;AACxB;AAxBA;EACE,iBAAiB;AACnB;;AAEA;EACE,kCAAkC;EAClC,mBAAmB;AACrB;AACA;EACE,+BAA+B;AACjC;AACA;EACE,oBAAoB;AACtB;;AAEA;EACE,4BAA4B;EAC5B,mBAAmB;EACnB,eAAe;EACf,4BAA4B;EAC5B,kBAAkB;EAClB,2CAA2C;AAC7C;AACA;EACE,kCAAkC;AACpC;AACA;EACE,kCAAkC;AACpC;AACA;;;EAGE,2BAA2B;AAC7B;AACA;EACE,+BAA+B;EAC/B,mBAAmB;AACrB;;AAEA;;EAEE,uBAAuB;AACzB;;AAEA;EACE,+BAA+B;AACjC;;AAEA;EACE,gBAAgB;AAClB","file":"index.css","sourcesContent":[".list {\n max-height: 300px;\n}\n\n.default-list.is-selected-all {\n background: var(--bg-color-grey-3);\n cursor: not-allowed;\n}\n.default-list.is-selected-all .item-label {\n color: var(--font-color-grey-2);\n}\n.default-list.is-selected-all .list-item {\n pointer-events: none;\n}\n\n.default-list-item {\n padding: 5px 12px !important;\n border-bottom: none;\n cursor: pointer;\n transition: background 300ms;\n position: relative;\n border-bottom-color: transparent !important;\n}\n.default-list-item:not(.is-selected):hover {\n background: var(--bg-color-grey-1);\n}\n.default-list-item.is-selected {\n background: var(--primary-color-1);\n}\n.default-list-item.is-selected .default-item-label,\n.default-list-item.is-selected .default-item-des,\n.default-list-item.is-selected .single-checked {\n color: var(--primary-color);\n}\n.default-list-item.is-disabled {\n color: var(--font-color-grey-2);\n cursor: not-allowed;\n}\n\n.default-item-label,\n.default-item-description {\n transition: color 300ms;\n}\n\n.default-item-description {\n color: var(--font-color-grey-1);\n}\n\n.single-checked {\n flex-basis: 14px;\n}"]}
|