@uf_lee/leeui 1.0.26 → 1.0.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 CHANGED
@@ -1,3 +1,11 @@
1
+ <!--
2
+ * @Author: 李天惊 uf_lee@163.com
3
+ * @Date: 2025-04-09 12:39:11
4
+ * @LastEditors: 李天惊 uf_lee@163.com
5
+ * @LastEditTime: 2025-04-09 12:58:22
6
+ * @FilePath: \leeui\lee-ui\README.md
7
+ * Copyright (c) 2025 by ${git_name_email}, All Rights Reserved.
8
+ -->
1
9
 
2
10
  # LeeUI
3
11
 
@@ -41,409 +49,10 @@ app.use(LeeUI);
41
49
  app.mount("#app");
42
50
  ``` -->
43
51
 
44
- ### 示例代码
52
+ ### 示例及测试代码
45
53
 
46
- ```vue
47
- <script setup lang="ts">
48
- import { reactive, ref, onMounted } from "vue";
49
- import { ElDivider } from "element-plus";
50
- import { LElForm, LElFormItemCom } from "@uf_lee/leeui";
51
- import type { FormSchema } from "@uf_lee/leeui/dist/types/types";
52
-
53
- // --------------------- Autocomplete 使用的一些设置 start -------------------------
54
- interface RestaurantItem {
55
- value: string;
56
- link: string;
57
- }
58
- const restaurants = ref<RestaurantItem[]>([]);
59
- const querySearch = (queryString: string, cb: any) => {
60
- const results = queryString
61
- ? restaurants.value.filter(createFilter(queryString))
62
- : restaurants.value;
63
- // call callback function to return suggestions
64
- cb(results);
65
- };
66
- const createFilter = (queryString: string) => {
67
- return (restaurant: RestaurantItem) => {
68
- return (
69
- restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
70
- );
71
- };
72
- };
73
- const loadAll = () => {
74
- return [
75
- { value: "vue", link: "https://github.com/vuejs/vue" },
76
- { value: "element", link: "https://github.com/ElemeFE/element" },
77
- { value: "cooking", link: "https://github.com/ElemeFE/cooking" },
78
- { value: "mint-ui", link: "https://github.com/ElemeFE/mint-ui" },
79
- { value: "vuex", link: "https://github.com/vuejs/vuex" },
80
- { value: "vue-router", link: "https://github.com/vuejs/vue-router" },
81
- { value: "babel", link: "https://github.com/babel/babel" },
82
- ];
83
- };
84
- const handleSelect = (item: Record<string, any>) => {
85
- console.log(item);
86
- };
87
-
88
- onMounted(() => {
89
- restaurants.value = loadAll();
90
- });
91
- // --------------------- Autocomplete 使用的一些设置 end -------------------------
92
-
93
- const schema: FormSchema[] = [
94
- {
95
- field: "undefined",
96
- label: "undefined",
97
- componentProps: {
98
- placeholder: "默认输入框",
99
- },
100
- colProps: {
101
- span: 24,
102
- },
103
- },
104
- {
105
- field: "Radio",
106
- label: "Radio",
107
- component: "Radio",
108
- componentProps: {
109
- options: [
110
- {
111
- label: "选项1",
112
- value: "1",
113
- },
114
- {
115
- label: "选项2",
116
- value: "2",
117
- },
118
- ],
119
- },
120
- colProps: {
121
- span: 6,
122
- },
123
- },
124
- {
125
- field: "RadioButton",
126
- label: "RadioButton",
127
- component: "RadioButton",
128
- componentProps: {
129
- options: [
130
- {
131
- label: "选项1",
132
- value: "1",
133
- },
134
- {
135
- label: "选项2",
136
- value: "2",
137
- },
138
- ],
139
- },
140
- colProps: {
141
- span: 6,
142
- },
143
- },
144
- {
145
- field: "Checkbox",
146
- label: "Checkbox",
147
- component: "Checkbox",
148
- componentProps: {
149
- options: [
150
- {
151
- label: "选项1",
152
- value: "1",
153
- },
154
- {
155
- label: "选项2",
156
- value: "2",
157
- },
158
- ],
159
- },
160
- colProps: {
161
- span: 6,
162
- },
163
- },
164
- {
165
- field: "CheckboxButton",
166
- label: "CheckboxButton",
167
- component: "CheckboxButton",
168
- componentProps: {
169
- options: [
170
- {
171
- label: "选项1",
172
- value: "1",
173
- },
174
- {
175
- label: "选项2",
176
- value: "2",
177
- },
178
- ],
179
- },
180
- colProps: {
181
- span: 6,
182
- },
183
- },
184
- {
185
- field: "Input",
186
- label: "Input",
187
- component: "Input",
188
- componentProps: {
189
- placeholder: "输入框",
190
- },
191
- colProps: {
192
- span: 8,
193
- },
194
- },
195
- {
196
- field: "Autocomplete",
197
- label: "Autocomplete",
198
- component: "Autocomplete",
199
- componentProps: {
200
- placeholder: "自动补全输入框",
201
- fetchSuggestions: querySearch,
202
- onselect: handleSelect,
203
- },
204
- colProps: {
205
- span: 8,
206
- },
207
- },
208
- {
209
- field: "InputNumber",
210
- label: "InputNumber",
211
- component: "InputNumber",
212
- componentProps: {},
213
- colProps: {
214
- span: 8,
215
- },
216
- },
217
- {
218
- field: "Select",
219
- label: "Select",
220
- component: "Select",
221
- componentProps: {
222
- placeholder: "请选择下拉框",
223
- options: [
224
- {
225
- label: "选项1",
226
- value: "1",
227
- },
228
- {
229
- label: "选项2",
230
- value: "2",
231
- },
232
- ],
233
- },
234
- colProps: {
235
- span: 10,
236
- },
237
- },
238
- {
239
- field: "Cascader",
240
- label: "Cascader",
241
- component: "Cascader",
242
- componentProps: {
243
- placeholder: "级联选择器",
244
- options: [
245
- {
246
- label: "选项1",
247
- value: "1",
248
- children: [
249
- {
250
- label: "选项1-1",
251
- value: "1001",
252
- },
253
- {
254
- label: "选项1-2",
255
- value: "1002",
256
- },
257
- {
258
- label: "选项1-3",
259
- value: "1003",
260
- },
261
- {
262
- label: "选项1-4",
263
- value: "1004",
264
- },
265
- ],
266
- },
267
- {
268
- label: "选项2",
269
- value: "2",
270
- children: [
271
- {
272
- label: "选项2-1",
273
- value: "2001",
274
- },
275
- {
276
- label: "选项2-2",
277
- value: "2002",
278
- },
279
- {
280
- label: "选项2-3",
281
- value: "2003",
282
- },
283
- {
284
- label: "选项2-4",
285
- value: "2004",
286
- },
287
- ],
288
- },
289
- {
290
- label: "选项3",
291
- value: "3",
292
- children: [
293
- {
294
- label: "选项3-1",
295
- value: "3001",
296
- children: [
297
- {
298
- label: "选项3-1-1",
299
- value: "3001001",
300
- },
301
- {
302
- label: "选项3-1-1",
303
- value: "3001--2",
304
- },
305
- ],
306
- },
307
- {
308
- label: "选项3-2",
309
- value: "3002",
310
- },
311
- ],
312
- },
313
- {
314
- label: "选项4",
315
- value: "4",
316
- },
317
- {
318
- label: "选项5",
319
- value: "5",
320
- },
321
- ],
322
- },
323
- colProps: {
324
- span: 10,
325
- },
326
- },
327
- {
328
- field: "Switch",
329
- label: "Switch",
330
- component: "Switch",
331
- componentProps: {},
332
- colProps: {
333
- span: 4,
334
- },
335
- },
336
- {
337
- field: "Slider",
338
- label: "Slider",
339
- component: "Slider",
340
- componentProps: {},
341
- colProps: {
342
- span: 24,
343
- },
344
- },
345
- {
346
- field: "TimePicker",
347
- label: "TimePicker",
348
- component: "TimePicker",
349
- componentProps: {},
350
- colProps: {
351
- span: 6,
352
- },
353
- },
354
- {
355
- field: "DatePicker",
356
- label: "DatePicker",
357
- component: "DatePicker",
358
- componentProps: {},
359
- colProps: {
360
- span: 6,
361
- },
362
- },
363
- {
364
- field: "Rate",
365
- label: "Rate",
366
- component: "Rate",
367
- componentProps: {},
368
- colProps: {
369
- span: 6,
370
- },
371
- },
372
- {
373
- field: "ColorPicker",
374
- label: "ColorPicker",
375
- component: "ColorPicker",
376
- componentProps: {},
377
- colProps: {
378
- span: 6,
379
- },
380
- },
381
- {
382
- field: "Transfer",
383
- label: "Transfer",
384
- component: "Transfer",
385
- componentProps: {},
386
- colProps: {
387
- span: 12,
388
- },
389
- },
390
- {
391
- field: "Divider",
392
- label: "Divider",
393
- component: "Divider",
394
- componentProps: {
395
- contentPosition: "center",
396
- },
397
- colProps: {
398
- span: 12,
399
- },
400
- },
401
- {
402
- field: "TimeSelect",
403
- label: "TimeSelect",
404
- component: "TimeSelect",
405
- componentProps: {},
406
- colProps: {
407
- span: 12,
408
- },
409
- },
410
- {
411
- field: "SelectV2",
412
- label: "SelectV2",
413
- component: "SelectV2",
414
- componentProps: {
415
- options: [
416
- {
417
- label: "选项1",
418
- value: "1",
419
- },
420
- {
421
- label: "选项2",
422
- value: "2",
423
- },
424
- ],
425
- },
426
- colProps: {
427
- span: 12,
428
- },
429
- },
430
- ];
431
-
432
- // 值
433
- const model: any = reactive({
434
- undefined: "12312",
435
- });
436
- </script>
437
-
438
- <template>
439
- <el-divider content-position="left">model</el-divider>
440
- {{ model }}
441
- <el-divider content-position="left">LElForm</el-divider>
442
- <LElForm :schema="schema" :model="model" />
443
- <el-divider content-position="left">LElFormItemCom</el-divider>
444
- <LElFormItemCom :data="schema[0]" v-model="model.undefined" />
445
- <LElFormItemCom :data="schema[1]" v-model="model[schema[1].field]" />
446
- </template>
54
+ ```bash
55
+ git clone https://gitee.com/uf_lee/lee-ui-test.git
447
56
  ```
448
57
 
449
58
  ## 📖 API 说明
@@ -466,11 +75,11 @@ const model: any = reactive({
466
75
 
467
76
  欢迎贡献代码!请提交 PR 或 Issue 进行讨论。
468
77
 
469
- <!-- 1. Fork 本仓库。
78
+ 1. Fork 本仓库。
470
79
  2. 创建新分支:`git checkout -b feature-branch`。
471
80
  3. 提交更改:`git commit -m 'Add some feature'`。
472
81
  4. 推送分支:`git push origin feature-branch`。
473
- 5. 提交 Pull Request。 -->
82
+ 5. 提交 Pull Request。
474
83
 
475
84
  ## 📜 License
476
85
 
@@ -1,3 +1,5 @@
1
1
  import type { Component } from "vue";
2
+ import type { ComponentName } from "./types";
3
+ import type { Recordable } from "../../../global";
2
4
  declare const componentMap: Recordable<Component, ComponentName>;
3
5
  export { componentMap };
@@ -1,6 +1,8 @@
1
1
  import { Slots } from "vue";
2
+ import type { Recordable } from "../../../global";
2
3
  import type { ComData } from "./types";
3
- import type { FormSchema, TableSchema } from "@/types";
4
+ import type { FormSchema } from "../../LElForm/src/types";
5
+ import type { TableSchema } from "../../LElTable/src/types";
4
6
  /**
5
7
  *
6
8
  * @param item 传入的组件属性
@@ -1,3 +1,22 @@
1
+ import type { Recordable } from "../../../global";
2
+ import type { FormValueType } from "../../LElForm/src/types";
3
+ export type ComponentOptions = {
4
+ label?: string;
5
+ value?: FormValueType;
6
+ disabled?: boolean;
7
+ key?: string | number;
8
+ children?: ComponentOptions[];
9
+ options?: ComponentOptions[];
10
+ } & Recordable;
11
+ declare type ComponentOptionsAlias = {
12
+ labelField?: string;
13
+ valueField?: string;
14
+ };
15
+ export type ComponentProps = {
16
+ optionsAlias?: ComponentOptionsAlias;
17
+ options?: ComponentOptions[];
18
+ optionsSlot?: boolean;
19
+ } & Recordable;
1
20
  export type ComData = {
2
21
  field: string;
3
22
  component?: ComponentName;
@@ -6,3 +25,5 @@ export type ComData = {
6
25
  } & ComponentProps;
7
26
  slots?: Recordable;
8
27
  };
28
+ export type ComponentName = "Text" | "Link" | "Button" | "Icon" | "Avatar" | "Image" | "Divider" | "Badge" | "Radio" | "RadioButton" | "Checkbox" | "CheckboxButton" | "Input" | "Autocomplete" | "InputNumber" | "Select" | "Cascader" | "Switch" | "Slider" | "TimePicker" | "DatePicker" | "Rate" | "ColorPicker" | "Transfer" | "TimeSelect" | "SelectV2" | "Mention" | "InputTag";
29
+ export {};
@@ -1,5 +1,7 @@
1
1
  import { PropType } from "vue";
2
2
  import { FormRules } from "element-plus";
3
+ import type { FormSchema } from "./types";
4
+ import type { Recordable } from "../../../global";
3
5
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
6
  schema: {
5
7
  type: PropType<FormSchema[]>;
@@ -30,7 +32,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
30
32
  onRegister?: ((...args: any[]) => any) | undefined;
31
33
  }>, {
32
34
  schema: FormSchema[];
33
- model: Recordable<any, string>;
35
+ model: Recordable;
34
36
  rules: Partial<Record<string, import("element-plus/es/utils").Arrayable<import("element-plus").FormItemRule>>>;
35
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
36
38
  export default _default;
@@ -1,3 +1,5 @@
1
+ import { ColProps, FormSchema } from "./types";
2
+ import type { Recordable } from "../../../global";
1
3
  /**
2
4
  *
3
5
  * @param col 内置栅格
@@ -12,4 +14,4 @@ export declare const setGridProp: (col?: ColProps) => ColProps;
12
14
  * @returns FormMoel
13
15
  * @description 生成对应的formModel
14
16
  */
15
- export declare const initModel: (schema: FormSchema[], formModel: Recordable) => Recordable<any, string>;
17
+ export declare const initModel: (schema: FormSchema[], formModel: Recordable) => Recordable;
@@ -1,4 +1,7 @@
1
- import { AxiosPromise } from "axios";
1
+ import type { Recordable } from "../../../global";
2
+ import type { AxiosPromise } from "axios";
3
+ import type { ComponentName, ComponentProps } from "../../LElCom/src/types";
4
+ import type { CSSProperties } from "vue";
2
5
  export type FormProps = {
3
6
  schema?: FormSchema[];
4
7
  isCol?: boolean;
@@ -22,3 +25,22 @@ export type FormSchema = {
22
25
  hidden?: boolean;
23
26
  api?: <T = any>() => AxiosPromise<T>;
24
27
  };
28
+ export type ColProps = {
29
+ span?: number;
30
+ xs?: number;
31
+ sm?: number;
32
+ md?: number;
33
+ lg?: number;
34
+ xl?: number;
35
+ tag?: string;
36
+ };
37
+ export type FormItemProps = {
38
+ labelWidth?: string | number;
39
+ required?: boolean;
40
+ rules?: Recordable;
41
+ error?: string;
42
+ showMessage?: boolean;
43
+ inlineMessage?: boolean;
44
+ style?: CSSProperties;
45
+ };
46
+ export type FormValueType = string | number | string[] | number[] | boolean | undefined | null;
@@ -1,4 +1,5 @@
1
1
  import { PropType } from "vue";
2
+ import type { Recordable } from "../../../global";
2
3
  import type { TableSchema } from "./types.ts";
3
4
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
5
  data: {
@@ -19,7 +20,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
19
20
  default: () => never[];
20
21
  };
21
22
  }>> & Readonly<{}>, {
22
- data: Recordable<any, string>[];
23
+ data: Recordable[];
23
24
  schema: TableSchema[];
24
25
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
25
26
  export default _default;
@@ -1,4 +1,5 @@
1
1
  import { TableSchema } from "./types";
2
+ import type { Recordable } from "../../../global";
2
3
  /**
3
4
  *
4
5
  * @param item 传入的组件属性
@@ -1,3 +1,6 @@
1
+ import type { ComponentProps, ComponentName } from "../../LElCom/src/types";
2
+ import type { FormValueType } from "../../LElForm/src/types";
3
+ import type { Recordable } from "../../../global";
1
4
  export type TableSchema = {
2
5
  field: string;
3
6
  label?: string;
@@ -0,0 +1,2 @@
1
+ export type Recordable<T = any, K extends keyof any = string> = Record<K, T>;
2
+ export type ComponentRef<T extends new (...args: any) => any> = InstanceType<T>;
@@ -1,4 +1,8 @@
1
1
  import { LElForm } from "./components/LElForm";
2
2
  import { LElCom } from "./components/LElCom";
3
3
  import { LElTable } from "./components/LElTable";
4
- export { LElForm, LElCom, LElTable };
4
+ import type { FormProps } from "./components/LElForm/src/types";
5
+ import type { FormSchema } from "./components/LElForm/src/types";
6
+ import type { TableSchema } from "./components/LElTable/src/types";
7
+ import type { ComData } from "./components/LElCom/src/types";
8
+ export { LElForm, LElCom, LElTable, FormProps, FormSchema, TableSchema, ComData, };
@@ -1,4 +1,5 @@
1
1
  import { Slots } from "vue";
2
+ import type { Recordable } from "../global";
2
3
  export declare const getSlot: (slots: Slots, slot?: string, data?: Recordable) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
3
4
  [key: string]: any;
4
5
  }>[] | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uf_lee/leeui",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "自己的组件库",
5
5
  "main": "dist/leeui.umd.js",
6
6
  "module": "dist/leeui.es.js",
@@ -40,4 +40,4 @@
40
40
  "peerDependencies": {
41
41
  "vue": ">=3.0.0"
42
42
  }
43
- }
43
+ }
@@ -1,5 +0,0 @@
1
- import { FormProps } from "@/components/LElForm/src/types";
2
- import { FormSchema } from "@/components/LElForm/src/types";
3
- import { TableSchema } from "@/components/LElTable/src/types";
4
- import { ComData } from "@/components/LElCom/src/types";
5
- export { FormProps, FormSchema, TableSchema, ComData };