@uf_lee/leeui 1.0.19 → 1.0.20
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 +424 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @Author: 李天惊 uf_lee@163.com
|
|
3
3
|
* @Date: 2025-03-20 12:35:35
|
|
4
4
|
* @LastEditors: 李天惊 uf_lee@163.com
|
|
5
|
-
* @LastEditTime: 2025-03-
|
|
6
|
-
* @FilePath: \
|
|
5
|
+
* @LastEditTime: 2025-03-27 13:04:15
|
|
6
|
+
* @FilePath: \leeui\lee_ui\README.md
|
|
7
7
|
* Copyright (c) 2025 by ${git_name_email}, All Rights Reserved.
|
|
8
8
|
-->
|
|
9
9
|
# LeeUI
|
|
@@ -16,3 +16,425 @@
|
|
|
16
16
|
```bash
|
|
17
17
|
npm install @uf_lee/leeui
|
|
18
18
|
|
|
19
|
+
```vue3
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import { reactive, ref, onMounted } from "vue";
|
|
22
|
+
import { ElDivider } from "element-plus";
|
|
23
|
+
import { LElForm, LElFormItemCom } from "@uf_lee/leeui";
|
|
24
|
+
import type { FormSchema } from "@uf_lee/leeui/dist/types/types";
|
|
25
|
+
// import type { FormItemRule } from "element-plus";
|
|
26
|
+
// import type { FormRules } from "element-plus";
|
|
27
|
+
|
|
28
|
+
// --------------------- Autocomplete 使用的一些设置 start -------------------------
|
|
29
|
+
interface RestaurantItem {
|
|
30
|
+
value: string;
|
|
31
|
+
link: string;
|
|
32
|
+
}
|
|
33
|
+
const restaurants = ref<RestaurantItem[]>([]);
|
|
34
|
+
const querySearch = (queryString: string, cb: any) => {
|
|
35
|
+
const results = queryString
|
|
36
|
+
? restaurants.value.filter(createFilter(queryString))
|
|
37
|
+
: restaurants.value;
|
|
38
|
+
// call callback function to return suggestions
|
|
39
|
+
cb(results);
|
|
40
|
+
};
|
|
41
|
+
const createFilter = (queryString: string) => {
|
|
42
|
+
return (restaurant: RestaurantItem) => {
|
|
43
|
+
return (
|
|
44
|
+
restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
const loadAll = () => {
|
|
49
|
+
return [
|
|
50
|
+
{ value: "vue", link: "https://github.com/vuejs/vue" },
|
|
51
|
+
{ value: "element", link: "https://github.com/ElemeFE/element" },
|
|
52
|
+
{ value: "cooking", link: "https://github.com/ElemeFE/cooking" },
|
|
53
|
+
{ value: "mint-ui", link: "https://github.com/ElemeFE/mint-ui" },
|
|
54
|
+
{ value: "vuex", link: "https://github.com/vuejs/vuex" },
|
|
55
|
+
{ value: "vue-router", link: "https://github.com/vuejs/vue-router" },
|
|
56
|
+
{ value: "babel", link: "https://github.com/babel/babel" },
|
|
57
|
+
];
|
|
58
|
+
};
|
|
59
|
+
const handleSelect = (item: Record<string, any>) => {
|
|
60
|
+
console.log(item);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
onMounted(() => {
|
|
64
|
+
restaurants.value = loadAll();
|
|
65
|
+
});
|
|
66
|
+
// --------------------- Autocomplete 使用的一些设置 end -------------------------
|
|
67
|
+
|
|
68
|
+
// const aaa = (rule: any, value: any, callback: any) => {
|
|
69
|
+
// if (value === "") {
|
|
70
|
+
// callback(new Error("Please input the password again"));
|
|
71
|
+
// } else if (value !== "222") {
|
|
72
|
+
// callback(new Error("Two inputs don't match!"));
|
|
73
|
+
// } else {
|
|
74
|
+
// callback();
|
|
75
|
+
// }
|
|
76
|
+
// };
|
|
77
|
+
|
|
78
|
+
// const rules = reactive<FormRules>({
|
|
79
|
+
// Input: [
|
|
80
|
+
// {
|
|
81
|
+
// validator: aaa,
|
|
82
|
+
// trigger: "blur",
|
|
83
|
+
// },
|
|
84
|
+
// ],
|
|
85
|
+
// });
|
|
86
|
+
|
|
87
|
+
const schema: FormSchema[] = [
|
|
88
|
+
{
|
|
89
|
+
field: "undefined",
|
|
90
|
+
label: "undefined",
|
|
91
|
+
componentProps: {
|
|
92
|
+
placeholder: "默认输入框",
|
|
93
|
+
},
|
|
94
|
+
colProps: {
|
|
95
|
+
span: 24,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
field: "Radio",
|
|
100
|
+
label: "Radio",
|
|
101
|
+
component: "Radio",
|
|
102
|
+
componentProps: {
|
|
103
|
+
options: [
|
|
104
|
+
{
|
|
105
|
+
label: "选项1",
|
|
106
|
+
value: "1",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
label: "选项2",
|
|
110
|
+
value: "2",
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
colProps: {
|
|
115
|
+
span: 6,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
field: "RadioButton",
|
|
120
|
+
label: "RadioButton",
|
|
121
|
+
component: "RadioButton",
|
|
122
|
+
componentProps: {
|
|
123
|
+
options: [
|
|
124
|
+
{
|
|
125
|
+
label: "选项1",
|
|
126
|
+
value: "1",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: "选项2",
|
|
130
|
+
value: "2",
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
colProps: {
|
|
135
|
+
span: 6,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
field: "Checkbox",
|
|
140
|
+
label: "Checkbox",
|
|
141
|
+
component: "Checkbox",
|
|
142
|
+
componentProps: {
|
|
143
|
+
options: [
|
|
144
|
+
{
|
|
145
|
+
label: "选项1",
|
|
146
|
+
value: "1",
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
label: "选项2",
|
|
150
|
+
value: "2",
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
colProps: {
|
|
155
|
+
span: 6,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
field: "CheckboxButton",
|
|
160
|
+
label: "CheckboxButton",
|
|
161
|
+
component: "CheckboxButton",
|
|
162
|
+
componentProps: {
|
|
163
|
+
options: [
|
|
164
|
+
{
|
|
165
|
+
label: "选项1",
|
|
166
|
+
value: "1",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
label: "选项2",
|
|
170
|
+
value: "2",
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
colProps: {
|
|
175
|
+
span: 6,
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
field: "Input",
|
|
180
|
+
label: "Input",
|
|
181
|
+
component: "Input",
|
|
182
|
+
componentProps: {
|
|
183
|
+
placeholder: "输入框",
|
|
184
|
+
},
|
|
185
|
+
colProps: {
|
|
186
|
+
span: 8,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
field: "Autocomplete",
|
|
191
|
+
label: "Autocomplete",
|
|
192
|
+
component: "Autocomplete",
|
|
193
|
+
componentProps: {
|
|
194
|
+
placeholder: "自动补全输入框",
|
|
195
|
+
fetchSuggestions: querySearch,
|
|
196
|
+
onselect: handleSelect,
|
|
197
|
+
},
|
|
198
|
+
colProps: {
|
|
199
|
+
span: 8,
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
field: "InputNumber",
|
|
204
|
+
label: "InputNumber",
|
|
205
|
+
component: "InputNumber",
|
|
206
|
+
componentProps: {},
|
|
207
|
+
colProps: {
|
|
208
|
+
span: 8,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
field: "Select",
|
|
213
|
+
label: "Select",
|
|
214
|
+
component: "Select",
|
|
215
|
+
componentProps: {
|
|
216
|
+
placeholder: "请选择下拉框",
|
|
217
|
+
options: [
|
|
218
|
+
{
|
|
219
|
+
label: "选项1",
|
|
220
|
+
value: "1",
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
label: "选项2",
|
|
224
|
+
value: "2",
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
colProps: {
|
|
229
|
+
span: 10,
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
field: "Cascader",
|
|
234
|
+
label: "Cascader",
|
|
235
|
+
component: "Cascader",
|
|
236
|
+
componentProps: {
|
|
237
|
+
placeholder: "级联选择器",
|
|
238
|
+
options: [
|
|
239
|
+
{
|
|
240
|
+
label: "选项1",
|
|
241
|
+
value: "1",
|
|
242
|
+
children: [
|
|
243
|
+
{
|
|
244
|
+
label: "选项1-1",
|
|
245
|
+
value: "1001",
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
label: "选项1-2",
|
|
249
|
+
value: "1002",
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
label: "选项1-3",
|
|
253
|
+
value: "1003",
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
label: "选项1-4",
|
|
257
|
+
value: "1004",
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
label: "选项2",
|
|
263
|
+
value: "2",
|
|
264
|
+
children: [
|
|
265
|
+
{
|
|
266
|
+
label: "选项2-1",
|
|
267
|
+
value: "2001",
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
label: "选项2-2",
|
|
271
|
+
value: "2002",
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
label: "选项2-3",
|
|
275
|
+
value: "2003",
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
label: "选项2-4",
|
|
279
|
+
value: "2004",
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
label: "选项3",
|
|
285
|
+
value: "3",
|
|
286
|
+
children: [
|
|
287
|
+
{
|
|
288
|
+
label: "选项3-1",
|
|
289
|
+
value: "3001",
|
|
290
|
+
children: [
|
|
291
|
+
{
|
|
292
|
+
label: "选项3-1-1",
|
|
293
|
+
value: "3001001",
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
label: "选项3-1-1",
|
|
297
|
+
value: "3001--2",
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
label: "选项3-2",
|
|
303
|
+
value: "3002",
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
label: "选项4",
|
|
309
|
+
value: "4",
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
label: "选项5",
|
|
313
|
+
value: "5",
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
colProps: {
|
|
318
|
+
span: 10,
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
field: "Switch",
|
|
323
|
+
label: "Switch",
|
|
324
|
+
component: "Switch",
|
|
325
|
+
componentProps: {},
|
|
326
|
+
colProps: {
|
|
327
|
+
span: 4,
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
field: "Slider",
|
|
332
|
+
label: "Slider",
|
|
333
|
+
component: "Slider",
|
|
334
|
+
componentProps: {},
|
|
335
|
+
colProps: {
|
|
336
|
+
span: 24,
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
field: "TimePicker",
|
|
341
|
+
label: "TimePicker",
|
|
342
|
+
component: "TimePicker",
|
|
343
|
+
componentProps: {},
|
|
344
|
+
colProps: {
|
|
345
|
+
span: 6,
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
field: "DatePicker",
|
|
350
|
+
label: "DatePicker",
|
|
351
|
+
component: "DatePicker",
|
|
352
|
+
componentProps: {},
|
|
353
|
+
colProps: {
|
|
354
|
+
span: 6,
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
field: "Rate",
|
|
359
|
+
label: "Rate",
|
|
360
|
+
component: "Rate",
|
|
361
|
+
componentProps: {},
|
|
362
|
+
colProps: {
|
|
363
|
+
span: 6,
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
field: "ColorPicker",
|
|
368
|
+
label: "ColorPicker",
|
|
369
|
+
component: "ColorPicker",
|
|
370
|
+
componentProps: {},
|
|
371
|
+
colProps: {
|
|
372
|
+
span: 6,
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
field: "Transfer",
|
|
377
|
+
label: "Transfer",
|
|
378
|
+
component: "Transfer",
|
|
379
|
+
componentProps: {},
|
|
380
|
+
colProps: {
|
|
381
|
+
span: 12,
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
field: "Divider",
|
|
386
|
+
label: "Divider",
|
|
387
|
+
component: "Divider",
|
|
388
|
+
componentProps: {
|
|
389
|
+
contentPosition: "center",
|
|
390
|
+
},
|
|
391
|
+
colProps: {
|
|
392
|
+
span: 12,
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
field: "TimeSelect",
|
|
397
|
+
label: "TimeSelect",
|
|
398
|
+
component: "TimeSelect",
|
|
399
|
+
componentProps: {},
|
|
400
|
+
colProps: {
|
|
401
|
+
span: 12,
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
field: "SelectV2",
|
|
406
|
+
label: "SelectV2",
|
|
407
|
+
component: "SelectV2",
|
|
408
|
+
componentProps: {
|
|
409
|
+
options: [
|
|
410
|
+
{
|
|
411
|
+
label: "选项1",
|
|
412
|
+
value: "1",
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
label: "选项2",
|
|
416
|
+
value: "2",
|
|
417
|
+
},
|
|
418
|
+
],
|
|
419
|
+
},
|
|
420
|
+
colProps: {
|
|
421
|
+
span: 12,
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
];
|
|
425
|
+
|
|
426
|
+
// 值
|
|
427
|
+
const model: any = reactive({
|
|
428
|
+
undefined: "12312",
|
|
429
|
+
});
|
|
430
|
+
</script>
|
|
431
|
+
|
|
432
|
+
<template>
|
|
433
|
+
<el-divider content-position="left">model</el-divider>
|
|
434
|
+
{{ model }}
|
|
435
|
+
<el-divider content-position="left">LElForm</el-divider>
|
|
436
|
+
<LElForm :schema="schema" :model="model" />
|
|
437
|
+
<el-divider content-position="left">LElFormItemCom</el-divider>
|
|
438
|
+
<LElFormItemCom :data="schema[0]" v-model="model.undefined" />
|
|
439
|
+
<LElFormItemCom :data="schema[1]" v-model="model[schema[1].field]" />
|
|
440
|
+
</template>
|