@next-bricks/form 0.17.19 → 0.18.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/dist/bricks.json +17 -15
- package/dist/chunks/6160.ae8e3d5c.js +2 -0
- package/dist/chunks/6160.ae8e3d5c.js.map +1 -0
- package/dist/chunks/eo-form-item.be078872.js +3 -0
- package/dist/chunks/eo-form-item.be078872.js.map +1 -0
- package/dist/chunks/eo-select.e39fa166.js +3 -0
- package/dist/chunks/eo-select.e39fa166.js.map +1 -0
- package/dist/chunks/{main.d65cf41d.js → main.2fe5a694.js} +2 -2
- package/dist/chunks/{main.d65cf41d.js.map → main.2fe5a694.js.map} +1 -1
- package/dist/examples.json +7 -7
- package/dist/index.fa49b25f.js +2 -0
- package/dist/index.fa49b25f.js.map +1 -0
- package/dist/manifest.json +246 -208
- package/dist/types.json +700 -513
- package/dist-types/select/index.d.ts +54 -9
- package/docs/eo-select.md +141 -1
- package/package.json +2 -2
- package/dist/chunks/6160.0a12986f.js +0 -2
- package/dist/chunks/6160.0a12986f.js.map +0 -1
- package/dist/chunks/eo-form-item.cd5cfb7a.js +0 -3
- package/dist/chunks/eo-form-item.cd5cfb7a.js.map +0 -1
- package/dist/chunks/eo-select.dc7674e9.js +0 -3
- package/dist/chunks/eo-select.dc7674e9.js.map +0 -1
- package/dist/index.0682e27a.js +0 -2
- package/dist/index.0682e27a.js.map +0 -1
- /package/dist/chunks/{eo-form-item.cd5cfb7a.js.LICENSE.txt → eo-form-item.be078872.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-select.dc7674e9.js.LICENSE.txt → eo-select.e39fa166.js.LICENSE.txt} +0 -0
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FormItemElementBase } from "@next-shared/form";
|
|
3
|
-
import type { GeneralComplexOption
|
|
3
|
+
import type { GeneralComplexOption } from "../interface.js";
|
|
4
4
|
import "@next-core/theme";
|
|
5
5
|
import type { FormItemProps } from "../form-item/index.jsx";
|
|
6
|
+
import { UseSingleBrickConf } from "@next-core/types";
|
|
7
|
+
interface UseBackendConf {
|
|
8
|
+
provider: string;
|
|
9
|
+
args: any[] | ((...args: any[]) => any[]);
|
|
10
|
+
transform?: (data: any) => void;
|
|
11
|
+
}
|
|
6
12
|
export interface SelectProps extends FormItemProps {
|
|
7
13
|
value?: any;
|
|
8
|
-
options: GeneralComplexOption[]
|
|
14
|
+
options: GeneralComplexOption[];
|
|
9
15
|
placeholder?: string;
|
|
10
|
-
|
|
16
|
+
mode?: "tags" | "multiple";
|
|
17
|
+
tokenSeparators?: string[];
|
|
18
|
+
maxTagCount?: number;
|
|
19
|
+
groupBy?: string;
|
|
20
|
+
suffix?: UseSingleBrickConf;
|
|
21
|
+
fields?: {
|
|
22
|
+
label?: string;
|
|
23
|
+
value?: string;
|
|
24
|
+
};
|
|
25
|
+
useBackend?: UseBackendConf & {
|
|
26
|
+
onValueChangeArgs?: any[] | ((...args: any[]) => any[]);
|
|
27
|
+
};
|
|
28
|
+
debounceSearchDelay?: number;
|
|
11
29
|
clearable?: boolean;
|
|
12
30
|
disabled?: boolean;
|
|
13
31
|
inputStyle?: React.CSSProperties;
|
|
14
32
|
validateState?: string;
|
|
15
|
-
onChange?: (value: any) => void;
|
|
33
|
+
onChange?: (value: any, options: GeneralComplexOption[]) => void;
|
|
16
34
|
onValueChange?: (value: any) => void;
|
|
17
35
|
optionsChange?: (options: any, name: string) => void;
|
|
18
36
|
onFocus?: () => void;
|
|
@@ -20,7 +38,7 @@ export interface SelectProps extends FormItemProps {
|
|
|
20
38
|
}
|
|
21
39
|
/**
|
|
22
40
|
* 通用下拉选择构件
|
|
23
|
-
* @author
|
|
41
|
+
* @author sailorshe
|
|
24
42
|
*/
|
|
25
43
|
declare class Select extends FormItemElementBase {
|
|
26
44
|
#private;
|
|
@@ -40,7 +58,7 @@ declare class Select extends FormItemElementBase {
|
|
|
40
58
|
* 选项列表
|
|
41
59
|
* @required
|
|
42
60
|
*/
|
|
43
|
-
accessor options: GeneralComplexOption[]
|
|
61
|
+
accessor options: GeneralComplexOption[];
|
|
44
62
|
/**
|
|
45
63
|
* 值
|
|
46
64
|
*/
|
|
@@ -58,19 +76,46 @@ declare class Select extends FormItemElementBase {
|
|
|
58
76
|
*/
|
|
59
77
|
accessor disabled: boolean | undefined;
|
|
60
78
|
/**
|
|
61
|
-
*
|
|
79
|
+
* 类型
|
|
80
|
+
*/
|
|
81
|
+
accessor mode: "tags" | "multiple" | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* 自动分词的分隔符,仅在 mode="tags" 时生效
|
|
84
|
+
*/
|
|
85
|
+
accessor tokenSeparators: string[] | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* 最多显示多少个 tag, 剩余的 tag 将被隐藏
|
|
88
|
+
*/
|
|
89
|
+
accessor maxTagCount: number | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* 分组字段
|
|
62
92
|
*/
|
|
63
|
-
accessor
|
|
93
|
+
accessor groupBy: string | undefined;
|
|
94
|
+
/**
|
|
95
|
+
*/
|
|
96
|
+
accessor suffix: UseSingleBrickConf | undefined;
|
|
64
97
|
/**
|
|
65
98
|
* 是否支持清除
|
|
66
99
|
* @default true
|
|
67
100
|
*/
|
|
68
101
|
accessor clearable: boolean | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* 列表指定字段作为 label 和 value
|
|
104
|
+
*/
|
|
105
|
+
accessor fields: {
|
|
106
|
+
label?: string;
|
|
107
|
+
value?: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* 后端搜索
|
|
111
|
+
*/
|
|
112
|
+
accessor useBackend: UseBackendConf | undefined;
|
|
113
|
+
accessor debounceSearchDelay: number | undefined;
|
|
69
114
|
/**
|
|
70
115
|
* 输入框样式
|
|
71
116
|
*/
|
|
72
117
|
accessor inputStyle: React.CSSProperties | undefined;
|
|
73
|
-
handleChange: (value: string | string[]) => void;
|
|
118
|
+
handleChange: (value: string | string[], options: GeneralComplexOption[]) => void;
|
|
74
119
|
private _handleOptionsChange;
|
|
75
120
|
handleSearch: (value: string) => void;
|
|
76
121
|
handleFocus: () => void;
|
package/docs/eo-select.md
CHANGED
|
@@ -115,7 +115,29 @@
|
|
|
115
115
|
- brick: eo-select
|
|
116
116
|
properties:
|
|
117
117
|
label: multiple
|
|
118
|
-
|
|
118
|
+
mode: multiple
|
|
119
|
+
value:
|
|
120
|
+
- Beijing
|
|
121
|
+
- Guangzhou
|
|
122
|
+
options:
|
|
123
|
+
- Beijing
|
|
124
|
+
- Shanghai
|
|
125
|
+
- Guangzhou
|
|
126
|
+
- Shenzhen
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Tags & TokenSeparators & MaxTagCount
|
|
130
|
+
|
|
131
|
+
```yaml preview
|
|
132
|
+
- brick: eo-select
|
|
133
|
+
properties:
|
|
134
|
+
label: tags
|
|
135
|
+
mode: tags
|
|
136
|
+
tokenSeparators:
|
|
137
|
+
- " "
|
|
138
|
+
- ";"
|
|
139
|
+
- ";"
|
|
140
|
+
maxTagCount: 3
|
|
119
141
|
options:
|
|
120
142
|
- Beijing
|
|
121
143
|
- Shanghai
|
|
@@ -136,6 +158,124 @@
|
|
|
136
158
|
- Shenzhen
|
|
137
159
|
```
|
|
138
160
|
|
|
161
|
+
### Suffix
|
|
162
|
+
|
|
163
|
+
```yaml preview
|
|
164
|
+
- brick: eo-select
|
|
165
|
+
properties:
|
|
166
|
+
placeholder: This is placeholder...
|
|
167
|
+
options:
|
|
168
|
+
- label: Beijing
|
|
169
|
+
value: 1
|
|
170
|
+
color: red
|
|
171
|
+
tag: 京
|
|
172
|
+
- label: Shanghai
|
|
173
|
+
value: 2
|
|
174
|
+
color: green
|
|
175
|
+
tag: 沪
|
|
176
|
+
- label: Guangzhou
|
|
177
|
+
value: 3
|
|
178
|
+
color: blue
|
|
179
|
+
tag: 粤
|
|
180
|
+
- label: Shenzhen
|
|
181
|
+
value: 4
|
|
182
|
+
color: yellow
|
|
183
|
+
tag: 粤
|
|
184
|
+
suffix:
|
|
185
|
+
brick: eo-tag
|
|
186
|
+
properties:
|
|
187
|
+
textContent: <% DATA.tag %>
|
|
188
|
+
color: <% DATA.color %>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### GroupBy
|
|
192
|
+
|
|
193
|
+
```yaml preview
|
|
194
|
+
- brick: eo-select
|
|
195
|
+
properties:
|
|
196
|
+
placeholder: This is placeholder...
|
|
197
|
+
groupBy: tag
|
|
198
|
+
options:
|
|
199
|
+
- label: Beijing
|
|
200
|
+
value: 1
|
|
201
|
+
color: red
|
|
202
|
+
tag: 京
|
|
203
|
+
- label: Shanghai
|
|
204
|
+
value: 2
|
|
205
|
+
color: green
|
|
206
|
+
tag: 沪
|
|
207
|
+
- label: Guangzhou
|
|
208
|
+
value: 3
|
|
209
|
+
color: blue
|
|
210
|
+
tag: 粤
|
|
211
|
+
- label: Shenzhen
|
|
212
|
+
value: 4
|
|
213
|
+
color: yellow
|
|
214
|
+
tag: 粤
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Fields
|
|
218
|
+
|
|
219
|
+
```yaml preview
|
|
220
|
+
- brick: eo-select
|
|
221
|
+
properties:
|
|
222
|
+
placeholder: This is placeholder...
|
|
223
|
+
fields:
|
|
224
|
+
label: name
|
|
225
|
+
value: city
|
|
226
|
+
value: 3
|
|
227
|
+
options:
|
|
228
|
+
- name: Beijing
|
|
229
|
+
city: 1
|
|
230
|
+
color: red
|
|
231
|
+
tag: 京
|
|
232
|
+
- name: Shanghai
|
|
233
|
+
city: 2
|
|
234
|
+
color: green
|
|
235
|
+
tag: 沪
|
|
236
|
+
- name: Guangzhou
|
|
237
|
+
city: 3
|
|
238
|
+
color: blue
|
|
239
|
+
tag: 粤
|
|
240
|
+
- name: Shenzhen
|
|
241
|
+
city: 4
|
|
242
|
+
color: yellow
|
|
243
|
+
tag: 粤
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### UseBackend
|
|
247
|
+
|
|
248
|
+
```yaml preview
|
|
249
|
+
- brick: eo-select
|
|
250
|
+
properties:
|
|
251
|
+
label: useBackend
|
|
252
|
+
placeholder: 后端搜索
|
|
253
|
+
value: Shenzhen
|
|
254
|
+
useBackend:
|
|
255
|
+
provider: basic.http-request
|
|
256
|
+
transform: |
|
|
257
|
+
<% (data) => data %>
|
|
258
|
+
onValueChangeArgs:
|
|
259
|
+
- |
|
|
260
|
+
<%
|
|
261
|
+
(q) =>
|
|
262
|
+
`//api.weatherapi.com/v1/search.json?q=${q}&key=${MISC.weather_api_key}`
|
|
263
|
+
%>
|
|
264
|
+
args:
|
|
265
|
+
- |
|
|
266
|
+
<%
|
|
267
|
+
(q) =>
|
|
268
|
+
`//api.weatherapi.com/v1/search.json?q=${q ? q : "China"}&key=${MISC.weather_api_key}`
|
|
269
|
+
%>
|
|
270
|
+
fields:
|
|
271
|
+
label: name
|
|
272
|
+
value: name
|
|
273
|
+
suffix:
|
|
274
|
+
brick: eo-tag
|
|
275
|
+
properties:
|
|
276
|
+
textContent: <% DATA.country %>
|
|
277
|
+
```
|
|
278
|
+
|
|
139
279
|
### Input Style
|
|
140
280
|
|
|
141
281
|
```yaml preview
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-bricks/form",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/form",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"@next-core/build-next-bricks": "^1.14.2",
|
|
38
38
|
"@next-core/test-next": "^1.0.10"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "6b8fa644f42e1a97c3b09c3dd029be922a5e58cc"
|
|
41
41
|
}
|