@fangzhongya/fang-ui 0.1.38 → 0.1.39
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/components/common/css.d.ts +7 -0
- package/dist/components/common/list.d.ts +7 -0
- package/dist/components/common/urls.d.ts +6 -0
- package/dist/components/common/use.cjs +14 -33
- package/dist/components/common/use.d.ts +91 -5
- package/dist/components/common/use.js +14 -33
- package/dist/components/forms/src/setup.d.ts +10 -0
- package/dist/components/forms/src/util.cjs +2 -2
- package/dist/components/forms/src/util.d.ts +11 -6
- package/dist/components/forms/src/util.js +2 -2
- package/dist/components/forms-item/src/label.cjs +0 -1
- package/dist/components/forms-item/src/label.js +0 -1
- package/dist/components/list/src/index2.cjs +1 -11
- package/dist/components/list/src/index2.js +1 -11
- package/dist/components/list/src/util.cjs +2 -4
- package/dist/components/list/src/util.d.ts +1 -1
- package/dist/components/list/src/util.js +2 -4
- package/dist/components/tables/common/pagin.d.ts +10 -0
- package/dist/components/tables/common/util.cjs +44 -4
- package/dist/components/tables/common/util.d.ts +13 -0
- package/dist/components/tables/common/util.js +45 -5
- package/dist/components/tables/src/column.cjs +0 -1
- package/dist/components/tables/src/column.js +0 -1
- package/dist/components/tables/src/index2.cjs +1 -1
- package/dist/components/tables/src/index2.js +1 -1
- package/dist/components/tablesv/src/column.cjs +0 -1
- package/dist/components/tablesv/src/column.js +0 -1
- package/dist/components/tablesv/src/index2.cjs +1 -1
- package/dist/components/tablesv/src/index2.js +1 -1
- package/dist/icons/index.json +1 -1
- package/dist/locale/en.cjs +2 -1
- package/dist/locale/en.d.ts +1 -0
- package/dist/locale/en.js +2 -1
- package/dist/locale/zh-cn.cjs +2 -1
- package/dist/locale/zh-cn.d.ts +1 -0
- package/dist/locale/zh-cn.js +2 -1
- package/dist/utils/css.cjs +4 -0
- package/dist/utils/css.d.ts +1 -0
- package/dist/utils/css.js +4 -0
- package/package.json +1 -1
- /package/dist/components/{keep-com → draggable}/index.css +0 -0
- /package/dist/components/{forms-item → forms-items}/index.css +0 -0
- /package/dist/css/{keep-com.css → draggable.css} +0 -0
- /package/dist/css/{forms-item.css → forms-items.css} +0 -0
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 设置样式函数,用于根据配置对象生成最终的样式对象
|
|
3
|
+
* @param v - 列表对象,包含样式配置信息
|
|
4
|
+
* @param data - 数据对象,用于样式函数计算
|
|
5
|
+
* @param props - 属性对象,包含默认的样式配置
|
|
6
|
+
* @returns 返回合并后的样式对象
|
|
7
|
+
*/
|
|
1
8
|
export declare function setStyles(v: ListObj, data: ObjStr, props: ObjAny): string | {
|
|
2
9
|
[key: string]: string | number;
|
|
3
10
|
};
|
|
@@ -71,6 +71,13 @@ export declare const emits: string[];
|
|
|
71
71
|
type HandleConfig = {
|
|
72
72
|
getValue: <T>(v: T) => T;
|
|
73
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* select选择的通用处理
|
|
76
|
+
* @param props 组件属性
|
|
77
|
+
* @param emit 触发事件
|
|
78
|
+
* @param config { getValue: (v: T) => T } 获取值处理函数
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
74
81
|
export declare function comHandle(props: any, emit: any, config?: HandleConfig): {
|
|
75
82
|
setMultipleValue: (v: any) => any;
|
|
76
83
|
getMultipleValue: (v: any) => any;
|
|
@@ -51,5 +51,11 @@ export declare const props: {
|
|
|
51
51
|
};
|
|
52
52
|
export declare const emits: never[];
|
|
53
53
|
export type UrlProps = ExtractPropTypes<typeof props>;
|
|
54
|
+
/**
|
|
55
|
+
* 处理通用请求逻辑的函数
|
|
56
|
+
* @param props 包含请求配置信息的对象
|
|
57
|
+
* @param obj 额外的参数对象
|
|
58
|
+
* @returns 返回一个Promise,解析后的数据结果
|
|
59
|
+
*/
|
|
54
60
|
export declare function comHandle(props: UrlProps, obj: ObjAny): ObjAny;
|
|
55
61
|
export declare const expose: {};
|
|
@@ -318,7 +318,8 @@ const useGetDomValue = (obj, data, options, index) => {
|
|
|
318
318
|
}
|
|
319
319
|
return value;
|
|
320
320
|
};
|
|
321
|
-
const useGetDomLabel = (
|
|
321
|
+
const useGetDomLabel = (obj, data, slots, optionss, compons, emit, index) => {
|
|
322
|
+
const label = obj.label;
|
|
322
323
|
if (!label) {
|
|
323
324
|
return label;
|
|
324
325
|
}
|
|
@@ -331,32 +332,17 @@ const useGetDomLabel = (label, obj, data, slots, optionss, compons, emit, index,
|
|
|
331
332
|
if (!isObject.isObject(label)) {
|
|
332
333
|
return label;
|
|
333
334
|
}
|
|
334
|
-
return handleObjectLabel(
|
|
335
|
-
label,
|
|
336
|
-
obj,
|
|
337
|
-
data,
|
|
338
|
-
slots,
|
|
339
|
-
optionss,
|
|
340
|
-
compons,
|
|
341
|
-
emit,
|
|
342
|
-
index,
|
|
343
|
-
isComponSelected
|
|
344
|
-
);
|
|
345
|
-
};
|
|
346
|
-
const handleObjectLabel = (label, obj, data, slots, optionss, compons, emit, index, isComponSelected) => {
|
|
347
335
|
if (Array.isArray(label)) {
|
|
348
336
|
return renderLabelArray(label, data, optionss, compons, emit, index);
|
|
349
337
|
}
|
|
350
|
-
return
|
|
338
|
+
return handleObjectLabel(
|
|
351
339
|
label,
|
|
352
|
-
obj,
|
|
353
340
|
data,
|
|
354
341
|
slots,
|
|
355
342
|
optionss,
|
|
356
343
|
compons,
|
|
357
344
|
emit,
|
|
358
|
-
index
|
|
359
|
-
isComponSelected
|
|
345
|
+
index
|
|
360
346
|
);
|
|
361
347
|
};
|
|
362
348
|
const renderLabelArray = (labels, data, optionss, compons, emit, index) => {
|
|
@@ -369,15 +355,14 @@ const renderLabelArray = (labels, data, optionss, compons, emit, index) => {
|
|
|
369
355
|
})
|
|
370
356
|
);
|
|
371
357
|
};
|
|
372
|
-
const
|
|
373
|
-
const
|
|
374
|
-
const slot = useSetSlot(mergedLabel, data, slots, index);
|
|
358
|
+
const handleObjectLabel = (label, data, slots, optionss, compons, emit, index) => {
|
|
359
|
+
const slot = useSetSlot(label, data, slots, index);
|
|
375
360
|
if (slot) {
|
|
376
361
|
return slot;
|
|
377
362
|
}
|
|
378
|
-
if (
|
|
363
|
+
if (label.compon) {
|
|
379
364
|
const column = useSetCompon(
|
|
380
|
-
|
|
365
|
+
label,
|
|
381
366
|
data,
|
|
382
367
|
optionss,
|
|
383
368
|
compons,
|
|
@@ -388,7 +373,7 @@ const handleSingleObjectLabel = (label, obj, data, slots, optionss, compons, emi
|
|
|
388
373
|
return column;
|
|
389
374
|
}
|
|
390
375
|
}
|
|
391
|
-
return useGetDomValue(
|
|
376
|
+
return useGetDomValue(label, data, optionss, index);
|
|
392
377
|
};
|
|
393
378
|
function useObjComponSelected(obj, props) {
|
|
394
379
|
const arrs = [obj];
|
|
@@ -428,18 +413,14 @@ function getVNodeContent(vnode) {
|
|
|
428
413
|
vue.render(null, container);
|
|
429
414
|
return textContent;
|
|
430
415
|
}
|
|
431
|
-
function getLabelText(
|
|
432
|
-
if (
|
|
433
|
-
return
|
|
434
|
-
} else if (typeof label == "string") {
|
|
435
|
-
return label;
|
|
436
|
-
} else if (typeof label == "function") {
|
|
437
|
-
label = label();
|
|
416
|
+
function getLabelText(obj) {
|
|
417
|
+
if (obj.labelText) {
|
|
418
|
+
return obj.labelText;
|
|
438
419
|
}
|
|
420
|
+
const label = useGetDomLabel(obj, {}, {}, {}, {}, () => {
|
|
421
|
+
}, 0);
|
|
439
422
|
if (vue.isVNode(label)) {
|
|
440
423
|
return getVNodeContent(label);
|
|
441
|
-
} else if (Array.isArray(label)) {
|
|
442
|
-
return label.join("");
|
|
443
424
|
} else {
|
|
444
425
|
return (label == null ? void 0 : label.toString()) || "";
|
|
445
426
|
}
|
|
@@ -1,25 +1,111 @@
|
|
|
1
1
|
import { Component, VNode } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 根据指定的键或函数从对象中提取值
|
|
4
|
+
* @param v - 要处理的值,通常是一个对象
|
|
5
|
+
* @param key - 字符串类型的属性名或函数,用于提取值
|
|
6
|
+
* @returns 如果key是函数则返回函数执行结果,如果key是字符串则返回对象对应属性值,否则返回原值
|
|
7
|
+
*/
|
|
2
8
|
export declare function useVueValue(v: any, key: string | Function): any;
|
|
9
|
+
/**
|
|
10
|
+
* 设置对象属性值的工具函数
|
|
11
|
+
* @param v - 要设置值的目标对象
|
|
12
|
+
* @param key - 属性名或设置函数,可以是字符串或函数类型
|
|
13
|
+
* @param value - 要设置的值
|
|
14
|
+
* @returns 返回修改后的对象
|
|
15
|
+
*/
|
|
3
16
|
export declare function useSetValue(v: any, key: string | Function, value: any): any;
|
|
17
|
+
/**
|
|
18
|
+
* 获取表单规则路径
|
|
19
|
+
* @param obj - 包含属性和父子关系的对象
|
|
20
|
+
* @returns 返回格式化的属性路径字符串
|
|
21
|
+
*/
|
|
4
22
|
export declare function getFormRule(obj: ListObj): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* 设置表单默认值
|
|
25
|
+
* @param obj - 列表对象,包含表单配置信息
|
|
26
|
+
* @param value - 表单值对象,用于设置默认值的数据源
|
|
27
|
+
*/
|
|
5
28
|
export declare function setFormDefaultValue(obj: ListObj, value: ObjAny): void;
|
|
29
|
+
/**
|
|
30
|
+
* 判断列表对象是否应该隐藏
|
|
31
|
+
* @param v - 列表对象,可能包含hide属性
|
|
32
|
+
* @param form - 表单数据,可选参数,用于hide函数的计算
|
|
33
|
+
* @returns 返回是否隐藏的布尔值,如果v.hide是函数则执行函数返回结果,如果是布尔值则直接返回,否则返回false
|
|
34
|
+
*/
|
|
6
35
|
export declare function useHide(v: ListObj, form?: any): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 获取事件处理对象集合
|
|
38
|
+
* @param obj - 包含事件配置的对象
|
|
39
|
+
* @param data - 数据对象
|
|
40
|
+
* @param emit - 事件发射函数
|
|
41
|
+
* @param arrs - 额外的参数数组
|
|
42
|
+
* @returns 返回一个包含事件处理函数的对象
|
|
43
|
+
*/
|
|
7
44
|
export declare function getOnObjs(obj: ListObj, data: ObjAny, emit: Function, ...arrs: any[]): {
|
|
8
45
|
[key: string]: (...arr: any[]) => void;
|
|
9
46
|
};
|
|
10
47
|
type Compons = {
|
|
11
48
|
[key: string]: Component;
|
|
12
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* 设置并渲染插槽内容的自定义hook函数
|
|
52
|
+
*
|
|
53
|
+
* @param obj - 列表对象配置,包含插槽名称或属性名
|
|
54
|
+
* @param data - 数据对象,用于获取和设置值
|
|
55
|
+
* @param slots - 插槽映射对象,存储可用的插槽函数
|
|
56
|
+
* @param index - 可选的索引值,用于数据定位
|
|
57
|
+
* @param scope - 可选的作用域对象,传递给插槽函数
|
|
58
|
+
* @returns 插槽函数执行结果或undefined
|
|
59
|
+
*/
|
|
13
60
|
export declare function useSetSlot(obj: ListObj, data: ObjAny, slots: ObjAny, index?: number, scope?: ObjAny): any;
|
|
61
|
+
/**
|
|
62
|
+
* 根据配置对象设置组件
|
|
63
|
+
* @param obj - 列表对象配置,包含组件相关配置信息
|
|
64
|
+
* @param data - 数据对象,用于获取和设置组件值
|
|
65
|
+
* @param optionss - 选项配置对象
|
|
66
|
+
* @param compons - 组件集合
|
|
67
|
+
* @param emit - 事件发射函数
|
|
68
|
+
* @param index - 索引值,可选参数
|
|
69
|
+
* @param scope - 作用域对象,可选参数
|
|
70
|
+
* @returns 返回创建的组件节点或组件调用结果
|
|
71
|
+
*/
|
|
14
72
|
export declare function useSetCompon(obj: ListObj, data: ObjAny, optionss: ObjAny, compons: Compons, emit: Function, index?: number, scope?: ObjAny): any;
|
|
73
|
+
/**
|
|
74
|
+
* 获取DOM元素的值
|
|
75
|
+
* @param obj - 列表对象配置
|
|
76
|
+
* @param data - 数据对象
|
|
77
|
+
* @param options - 选项配置对象
|
|
78
|
+
* @param index - 可选的索引值
|
|
79
|
+
* @returns 返回处理后的值
|
|
80
|
+
*/
|
|
15
81
|
export declare const useGetDomValue: (obj: ListObj, data: ObjAny, options: ObjAny, index?: number) => any;
|
|
16
|
-
|
|
82
|
+
/**
|
|
83
|
+
* 获取DOM标签的处理函数
|
|
84
|
+
* @param obj - 包含label属性的对象
|
|
85
|
+
* @param data - 数据对象
|
|
86
|
+
* @param slots - 插槽对象
|
|
87
|
+
* @param optionss - 选项配置对象
|
|
88
|
+
* @param compons - 组件对象
|
|
89
|
+
* @param emit - 事件发射函数
|
|
90
|
+
* @param index - 索引值
|
|
91
|
+
* @returns 返回处理后的标签内容,可能是字符串、VNode或渲染后的数组/对象
|
|
92
|
+
*/
|
|
93
|
+
export declare const useGetDomLabel: (obj: ListObj, data: ObjAny, slots: ObjAny, optionss: ObjAny, compons: Compons, emit: Function, index: number) => any;
|
|
94
|
+
/**
|
|
95
|
+
* 获取对象及其父级链中选中的组件
|
|
96
|
+
* @param obj - 当前列表对象
|
|
97
|
+
* @param props - 包含组件选择状态的属性对象
|
|
98
|
+
* @returns 返回在对象层级链中找到的选中组件,如果没有则返回默认选中组件
|
|
99
|
+
*/
|
|
17
100
|
export declare function useObjComponSelected(obj: ListObj, props: ObjAny): any;
|
|
18
101
|
/**
|
|
19
102
|
* 设置获取默认值
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
103
|
+
* 创建一个代理对象,用于处理属性默认值
|
|
104
|
+
* 当访问的属性值为undefined时,会调用对应的默认值函数来获取默认值
|
|
105
|
+
*
|
|
106
|
+
* @param props 原始属性对象
|
|
107
|
+
* @param keyObj 包含属性键和对应默认值函数的对象
|
|
108
|
+
* @returns 返回一个代理对象,支持默认值处理
|
|
23
109
|
*/
|
|
24
110
|
export declare function usePropsDefault(props: any, keyObj: {
|
|
25
111
|
[key: string]: () => any;
|
|
@@ -42,5 +128,5 @@ export declare function getVNodeContent(vnode: VNode): string;
|
|
|
42
128
|
* @param label
|
|
43
129
|
* @returns
|
|
44
130
|
*/
|
|
45
|
-
export declare function getLabelText(
|
|
131
|
+
export declare function getLabelText(obj: ListObj): string;
|
|
46
132
|
export {};
|
|
@@ -316,7 +316,8 @@ const useGetDomValue = (obj, data, options, index) => {
|
|
|
316
316
|
}
|
|
317
317
|
return value;
|
|
318
318
|
};
|
|
319
|
-
const useGetDomLabel = (
|
|
319
|
+
const useGetDomLabel = (obj, data, slots, optionss, compons, emit, index) => {
|
|
320
|
+
const label = obj.label;
|
|
320
321
|
if (!label) {
|
|
321
322
|
return label;
|
|
322
323
|
}
|
|
@@ -329,32 +330,17 @@ const useGetDomLabel = (label, obj, data, slots, optionss, compons, emit, index,
|
|
|
329
330
|
if (!isObject(label)) {
|
|
330
331
|
return label;
|
|
331
332
|
}
|
|
332
|
-
return handleObjectLabel(
|
|
333
|
-
label,
|
|
334
|
-
obj,
|
|
335
|
-
data,
|
|
336
|
-
slots,
|
|
337
|
-
optionss,
|
|
338
|
-
compons,
|
|
339
|
-
emit,
|
|
340
|
-
index,
|
|
341
|
-
isComponSelected
|
|
342
|
-
);
|
|
343
|
-
};
|
|
344
|
-
const handleObjectLabel = (label, obj, data, slots, optionss, compons, emit, index, isComponSelected) => {
|
|
345
333
|
if (Array.isArray(label)) {
|
|
346
334
|
return renderLabelArray(label, data, optionss, compons, emit, index);
|
|
347
335
|
}
|
|
348
|
-
return
|
|
336
|
+
return handleObjectLabel(
|
|
349
337
|
label,
|
|
350
|
-
obj,
|
|
351
338
|
data,
|
|
352
339
|
slots,
|
|
353
340
|
optionss,
|
|
354
341
|
compons,
|
|
355
342
|
emit,
|
|
356
|
-
index
|
|
357
|
-
isComponSelected
|
|
343
|
+
index
|
|
358
344
|
);
|
|
359
345
|
};
|
|
360
346
|
const renderLabelArray = (labels, data, optionss, compons, emit, index) => {
|
|
@@ -367,15 +353,14 @@ const renderLabelArray = (labels, data, optionss, compons, emit, index) => {
|
|
|
367
353
|
})
|
|
368
354
|
);
|
|
369
355
|
};
|
|
370
|
-
const
|
|
371
|
-
const
|
|
372
|
-
const slot = useSetSlot(mergedLabel, data, slots, index);
|
|
356
|
+
const handleObjectLabel = (label, data, slots, optionss, compons, emit, index) => {
|
|
357
|
+
const slot = useSetSlot(label, data, slots, index);
|
|
373
358
|
if (slot) {
|
|
374
359
|
return slot;
|
|
375
360
|
}
|
|
376
|
-
if (
|
|
361
|
+
if (label.compon) {
|
|
377
362
|
const column = useSetCompon(
|
|
378
|
-
|
|
363
|
+
label,
|
|
379
364
|
data,
|
|
380
365
|
optionss,
|
|
381
366
|
compons,
|
|
@@ -386,7 +371,7 @@ const handleSingleObjectLabel = (label, obj, data, slots, optionss, compons, emi
|
|
|
386
371
|
return column;
|
|
387
372
|
}
|
|
388
373
|
}
|
|
389
|
-
return useGetDomValue(
|
|
374
|
+
return useGetDomValue(label, data, optionss, index);
|
|
390
375
|
};
|
|
391
376
|
function useObjComponSelected(obj, props) {
|
|
392
377
|
const arrs = [obj];
|
|
@@ -426,18 +411,14 @@ function getVNodeContent(vnode) {
|
|
|
426
411
|
render(null, container);
|
|
427
412
|
return textContent;
|
|
428
413
|
}
|
|
429
|
-
function getLabelText(
|
|
430
|
-
if (
|
|
431
|
-
return
|
|
432
|
-
} else if (typeof label == "string") {
|
|
433
|
-
return label;
|
|
434
|
-
} else if (typeof label == "function") {
|
|
435
|
-
label = label();
|
|
414
|
+
function getLabelText(obj) {
|
|
415
|
+
if (obj.labelText) {
|
|
416
|
+
return obj.labelText;
|
|
436
417
|
}
|
|
418
|
+
const label = useGetDomLabel(obj, {}, {}, {}, {}, () => {
|
|
419
|
+
}, 0);
|
|
437
420
|
if (isVNode(label)) {
|
|
438
421
|
return getVNodeContent(label);
|
|
439
|
-
} else if (Array.isArray(label)) {
|
|
440
|
-
return label.join("");
|
|
441
422
|
} else {
|
|
442
423
|
return (label == null ? void 0 : label.toString()) || "";
|
|
443
424
|
}
|
|
@@ -2,6 +2,16 @@ import { DataProps } from './data';
|
|
|
2
2
|
import { UseCssNameReturn } from '../../../hooks/cssname/index';
|
|
3
3
|
import { CSSProperties, Ref, WritableComputedRef, ComputedRef } from 'vue';
|
|
4
4
|
type Emit = (...args: any[]) => void;
|
|
5
|
+
/**
|
|
6
|
+
* 初始化表单相关配置与逻辑处理
|
|
7
|
+
*
|
|
8
|
+
* @param props 表单组件的属性对象,包含表单配置、列表项等信息
|
|
9
|
+
* @param emit 事件发射器,用于触发自定义事件(如 submit、cancel 等)
|
|
10
|
+
* @param cs CSS 类名管理工具返回值,用于动态设置样式类名
|
|
11
|
+
* @param refForm 表单引用对象,通常指向 el-form 或其他表单实例
|
|
12
|
+
* @param getLocale 国际化文本获取函数,根据 key 获取对应语言的内容
|
|
13
|
+
* @returns 返回一系列供模板或其他模块使用的响应式数据和方法
|
|
14
|
+
*/
|
|
5
15
|
export declare function setUp(props: DataProps, emit: Emit, cs: UseCssNameReturn, refForm: any, getLocale: Function): {
|
|
6
16
|
dataRules: Ref<ObjAny, ObjAny>;
|
|
7
17
|
dataForm: WritableComputedRef<Record<string, any> | undefined, Record<string, any> | undefined> | Ref<Record<string, any>, Record<string, any>>;
|
|
@@ -40,7 +40,7 @@ function getTrigger(trigger) {
|
|
|
40
40
|
}
|
|
41
41
|
function setPlaceholder(obj, triggerMap) {
|
|
42
42
|
var _a;
|
|
43
|
-
const name =
|
|
43
|
+
const name = use.getLabelText(obj);
|
|
44
44
|
let trigger = "blur";
|
|
45
45
|
if (typeof obj.compon == "string") {
|
|
46
46
|
if (config.changes.includes(lineToLargeHump.lineToLargeHump(obj.compon))) {
|
|
@@ -58,7 +58,7 @@ function getRule(obj, data, refForm, triggerMap) {
|
|
|
58
58
|
if (typeof multiple != "boolean") {
|
|
59
59
|
multiple = false;
|
|
60
60
|
}
|
|
61
|
-
const name =
|
|
61
|
+
const name = use.getLabelText(obj);
|
|
62
62
|
const param = {
|
|
63
63
|
name,
|
|
64
64
|
multiple,
|
|
@@ -6,18 +6,23 @@ type Rule = {
|
|
|
6
6
|
export type Rules = {
|
|
7
7
|
[key: string]: Array<Rule> | Rule;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* 设置对象的占位符文本
|
|
11
|
+
* @param obj - 列表对象,包含配置信息和组件类型
|
|
12
|
+
* @param triggerMap - 触发器映射对象,用于根据触发类型获取对应的提示文本前缀
|
|
13
|
+
*/
|
|
9
14
|
export declare function setPlaceholder(obj: ListObj, triggerMap: ObjStr): void;
|
|
10
15
|
/**
|
|
11
16
|
* 后期要实现 v.rule 多匹配,
|
|
12
17
|
* 错误提示自定义
|
|
13
18
|
*/
|
|
14
19
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @returns
|
|
20
|
+
* 根据传入的对象和配置生成表单验证规则数组
|
|
21
|
+
* @param obj - 包含组件配置信息的对象,如是否多选、规则等
|
|
22
|
+
* @param data - 表单数据对象,用于规则判断时使用
|
|
23
|
+
* @param refForm - 表单引用对象,可能用于联动或自定义校验逻辑
|
|
24
|
+
* @param triggerMap - 触发器映射对象,包含验证提示语等信息
|
|
25
|
+
* @returns 返回一个由 Rule 类型组成的数组,表示该字段的所有验证规则
|
|
21
26
|
*/
|
|
22
27
|
export declare function getRule(obj: ListObj, data: any, refForm: any, triggerMap: ObjStr): Rule[];
|
|
23
28
|
export {};
|
|
@@ -21,7 +21,7 @@ function getTrigger(trigger) {
|
|
|
21
21
|
}
|
|
22
22
|
function setPlaceholder(obj, triggerMap) {
|
|
23
23
|
var _a;
|
|
24
|
-
const name =
|
|
24
|
+
const name = getLabelText(obj);
|
|
25
25
|
let trigger = "blur";
|
|
26
26
|
if (typeof obj.compon == "string") {
|
|
27
27
|
if (changes.includes(lineToLargeHump(obj.compon))) {
|
|
@@ -39,7 +39,7 @@ function getRule(obj, data, refForm, triggerMap) {
|
|
|
39
39
|
if (typeof multiple != "boolean") {
|
|
40
40
|
multiple = false;
|
|
41
41
|
}
|
|
42
|
-
const name =
|
|
42
|
+
const name = getLabelText(obj);
|
|
43
43
|
const param = {
|
|
44
44
|
name,
|
|
45
45
|
multiple,
|
|
@@ -198,17 +198,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
198
198
|
width: obj.labelWidth || props.labelWidth
|
|
199
199
|
}
|
|
200
200
|
},
|
|
201
|
-
[
|
|
202
|
-
util.setLabel(
|
|
203
|
-
obj,
|
|
204
|
-
props,
|
|
205
|
-
compons,
|
|
206
|
-
emit,
|
|
207
|
-
slots,
|
|
208
|
-
isComponSelected,
|
|
209
|
-
index2
|
|
210
|
-
)
|
|
211
|
-
]
|
|
201
|
+
[util.setLabel(obj, props, compons, emit, slots, index2)]
|
|
212
202
|
)
|
|
213
203
|
]
|
|
214
204
|
);
|
|
@@ -196,17 +196,7 @@ const _sfc_main = defineComponent({
|
|
|
196
196
|
width: obj.labelWidth || props.labelWidth
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
|
-
[
|
|
200
|
-
setLabel(
|
|
201
|
-
obj,
|
|
202
|
-
props,
|
|
203
|
-
compons,
|
|
204
|
-
emit,
|
|
205
|
-
slots,
|
|
206
|
-
isComponSelected,
|
|
207
|
-
index
|
|
208
|
-
)
|
|
209
|
-
]
|
|
199
|
+
[setLabel(obj, props, compons, emit, slots, index)]
|
|
210
200
|
)
|
|
211
201
|
]
|
|
212
202
|
);
|
|
@@ -41,19 +41,17 @@ function setSslot(obj, data, props, compons, emit, slots, isComponSelected, inde
|
|
|
41
41
|
function setDomValue(domValue, table) {
|
|
42
42
|
return (util.setEmptyDisplay(domValue, table.emptyDisplay, table.isEmptyStr) || domValue) ?? "";
|
|
43
43
|
}
|
|
44
|
-
function setLabel(obj, props, compons, emit, slots,
|
|
44
|
+
function setLabel(obj, props, compons, emit, slots, index) {
|
|
45
45
|
let label = obj.label ?? "";
|
|
46
46
|
if (label) {
|
|
47
47
|
label = use.useGetDomLabel(
|
|
48
|
-
label,
|
|
49
48
|
obj,
|
|
50
49
|
props.value,
|
|
51
50
|
slots,
|
|
52
51
|
props.optionss,
|
|
53
52
|
compons,
|
|
54
53
|
emit,
|
|
55
|
-
index || 0
|
|
56
|
-
isComponSelected
|
|
54
|
+
index || 0
|
|
57
55
|
);
|
|
58
56
|
}
|
|
59
57
|
let colon = props.colon;
|
|
@@ -5,5 +5,5 @@ type Compons = {
|
|
|
5
5
|
export declare const setClass: (item: ListObj, data: ObjStr, index: number) => any;
|
|
6
6
|
export declare function setSslot(obj: ListObj, data: ObjAny, props: ObjAny, compons: Compons, emit: Function, slots: ObjAny, isComponSelected: Function, index?: number): any;
|
|
7
7
|
export declare function setDomValue(domValue: any, table: ObjAny): any;
|
|
8
|
-
export declare function setLabel(obj: ObjAny, props: ObjAny, compons: Compons, emit: Function, slots: ObjAny,
|
|
8
|
+
export declare function setLabel(obj: ObjAny, props: ObjAny, compons: Compons, emit: Function, slots: ObjAny, index?: number): any;
|
|
9
9
|
export {};
|
|
@@ -39,19 +39,17 @@ function setSslot(obj, data, props, compons, emit, slots, isComponSelected, inde
|
|
|
39
39
|
function setDomValue(domValue, table) {
|
|
40
40
|
return (setEmptyDisplay(domValue, table.emptyDisplay, table.isEmptyStr) || domValue) ?? "";
|
|
41
41
|
}
|
|
42
|
-
function setLabel(obj, props, compons, emit, slots,
|
|
42
|
+
function setLabel(obj, props, compons, emit, slots, index) {
|
|
43
43
|
let label = obj.label ?? "";
|
|
44
44
|
if (label) {
|
|
45
45
|
label = useGetDomLabel(
|
|
46
|
-
label,
|
|
47
46
|
obj,
|
|
48
47
|
props.value,
|
|
49
48
|
slots,
|
|
50
49
|
props.optionss,
|
|
51
50
|
compons,
|
|
52
51
|
emit,
|
|
53
|
-
index || 0
|
|
54
|
-
isComponSelected
|
|
52
|
+
index || 0
|
|
55
53
|
);
|
|
56
54
|
}
|
|
57
55
|
let colon = props.colon;
|
|
@@ -93,6 +93,16 @@ export declare const dataProps: {
|
|
|
93
93
|
};
|
|
94
94
|
};
|
|
95
95
|
export declare const dataEmit: string[];
|
|
96
|
+
/**
|
|
97
|
+
* 初始化表格组件的核心逻辑,包括分页、排序、选择、跨页多选等功能。
|
|
98
|
+
*
|
|
99
|
+
* @param props 组件传入的属性对象,包含配置信息和事件回调等
|
|
100
|
+
* @param emit 用于触发自定义事件的方法
|
|
101
|
+
* @param refTable 表格实例引用,用于调用表格方法(如清空选中)
|
|
102
|
+
* @param getLocale 国际化翻译函数
|
|
103
|
+
* @param defaultConfig 默认表格配置项
|
|
104
|
+
* @returns 包含各种状态、方法和响应式数据的对象
|
|
105
|
+
*/
|
|
96
106
|
export declare const useInit: (props: ExtractPropTypes<typeof dataProps>, emit: Function, refTable: Ref, getLocale: Translator, defaultConfig?: TableConfig) => {
|
|
97
107
|
height: ComputedRef<any>;
|
|
98
108
|
tableConfig: Ref<{
|
|
@@ -1,9 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("vue");
|
|
4
|
+
const use = require("../../common/use.cjs");
|
|
4
5
|
const firstUpper = require("@fangzhongya/utils/basic/string/firstUpper");
|
|
5
6
|
const splitUpper = require("@fangzhongya/utils/basic/string/splitUpper");
|
|
6
7
|
const getAttrValue = require("../../../utils/vues/getAttrValue.cjs");
|
|
8
|
+
const css = require("../../../utils/css.cjs");
|
|
9
|
+
function getVNodeWidth(vnode) {
|
|
10
|
+
const container = document.createElement("div");
|
|
11
|
+
Object.assign(container.style, {
|
|
12
|
+
position: "absolute",
|
|
13
|
+
left: "-9999px",
|
|
14
|
+
top: "-9999px",
|
|
15
|
+
whiteSpace: "pre-wrap",
|
|
16
|
+
display: "inline-block",
|
|
17
|
+
visibility: "hidden"
|
|
18
|
+
});
|
|
19
|
+
document.body.appendChild(container);
|
|
20
|
+
vue.render(vnode, container);
|
|
21
|
+
const width = container.offsetWidth;
|
|
22
|
+
container.remove();
|
|
23
|
+
vue.render(null, container);
|
|
24
|
+
return width;
|
|
25
|
+
}
|
|
26
|
+
function setLabelWidth(obj, config) {
|
|
27
|
+
let label = use.useGetDomLabel(obj, {}, {}, {}, {}, () => {
|
|
28
|
+
}, 0);
|
|
29
|
+
if (!vue.isVNode(label)) {
|
|
30
|
+
label = vue.h(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
style: {
|
|
34
|
+
whiteSpace: "pre-wrap",
|
|
35
|
+
display: "inline-block"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
label
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const width = getVNodeWidth(label);
|
|
42
|
+
const interval = config.intervalHorizon ?? config.interval;
|
|
43
|
+
return width + css.getCssNumber(interval) * 2;
|
|
44
|
+
}
|
|
7
45
|
function setMinWidth(obj, props) {
|
|
8
46
|
const config = (props == null ? void 0 : props.table) ?? {};
|
|
9
47
|
if (obj.width) {
|
|
@@ -14,16 +52,18 @@ function setMinWidth(obj, props) {
|
|
|
14
52
|
if (typeof minWidth == "function") {
|
|
15
53
|
return minWidth(obj, config);
|
|
16
54
|
} else if (typeof minWidth == "boolean") {
|
|
17
|
-
return (obj
|
|
55
|
+
return setLabelWidth(obj, config);
|
|
18
56
|
} else {
|
|
19
57
|
return minWidth;
|
|
20
58
|
}
|
|
21
59
|
} else {
|
|
22
60
|
const minWidth2 = getAttrValue.getAttrValue(config, "minWidth");
|
|
23
|
-
if (minWidth2) {
|
|
24
|
-
return minWidth2;
|
|
61
|
+
if (typeof minWidth2 == "function") {
|
|
62
|
+
return minWidth2(obj, config);
|
|
63
|
+
} else if (typeof minWidth2 == "boolean") {
|
|
64
|
+
return setLabelWidth(obj, config);
|
|
25
65
|
} else {
|
|
26
|
-
return;
|
|
66
|
+
return minWidth2;
|
|
27
67
|
}
|
|
28
68
|
}
|
|
29
69
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 设置对象的最小宽度
|
|
3
|
+
* @param obj - 需要设置最小宽度的对象
|
|
4
|
+
* @param props - 可选的配置属性对象
|
|
5
|
+
* @returns 返回设置的最小宽度值,可能为具体数值、函数执行结果或undefined
|
|
6
|
+
*/
|
|
1
7
|
export declare function setMinWidth(obj: ObjAny, props?: ObjAny): any;
|
|
2
8
|
/**
|
|
3
9
|
* 支持事件别名处理
|
|
@@ -7,4 +13,11 @@ export declare function setMinWidth(obj: ObjAny, props?: ObjAny): any;
|
|
|
7
13
|
* @param {*} $event
|
|
8
14
|
*/
|
|
9
15
|
export declare function eventAliass(callback: Function, arr: string | string[], obj: ObjAny, $event: Event): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 设置空值显示内容
|
|
18
|
+
* @param value 需要检查的值
|
|
19
|
+
* @param emptyDisplay 空值时显示的内容,默认为undefined
|
|
20
|
+
* @param isStr 是否为字符串类型检查,默认为undefined
|
|
21
|
+
* @returns 如果值为空则返回emptyDisplay,否则返回undefined
|
|
22
|
+
*/
|
|
10
23
|
export declare function setEmptyDisplay(value: any, emptyDisplay?: string, isStr?: boolean): string | undefined;
|
|
@@ -1,7 +1,45 @@
|
|
|
1
|
-
import { withModifiers } from "vue";
|
|
1
|
+
import { render, isVNode, h, withModifiers } from "vue";
|
|
2
|
+
import { useGetDomLabel } from "../../common/use.js";
|
|
2
3
|
import { firstUpper } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
3
4
|
import { splitUpper } from "@fangzhongya/utils/basic/string/splitUpper";
|
|
4
5
|
import { getAttrValue } from "../../../utils/vues/getAttrValue.js";
|
|
6
|
+
import { getCssNumber } from "../../../utils/css.js";
|
|
7
|
+
function getVNodeWidth(vnode) {
|
|
8
|
+
const container = document.createElement("div");
|
|
9
|
+
Object.assign(container.style, {
|
|
10
|
+
position: "absolute",
|
|
11
|
+
left: "-9999px",
|
|
12
|
+
top: "-9999px",
|
|
13
|
+
whiteSpace: "pre-wrap",
|
|
14
|
+
display: "inline-block",
|
|
15
|
+
visibility: "hidden"
|
|
16
|
+
});
|
|
17
|
+
document.body.appendChild(container);
|
|
18
|
+
render(vnode, container);
|
|
19
|
+
const width = container.offsetWidth;
|
|
20
|
+
container.remove();
|
|
21
|
+
render(null, container);
|
|
22
|
+
return width;
|
|
23
|
+
}
|
|
24
|
+
function setLabelWidth(obj, config) {
|
|
25
|
+
let label = useGetDomLabel(obj, {}, {}, {}, {}, () => {
|
|
26
|
+
}, 0);
|
|
27
|
+
if (!isVNode(label)) {
|
|
28
|
+
label = h(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
style: {
|
|
32
|
+
whiteSpace: "pre-wrap",
|
|
33
|
+
display: "inline-block"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
label
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const width = getVNodeWidth(label);
|
|
40
|
+
const interval = config.intervalHorizon ?? config.interval;
|
|
41
|
+
return width + getCssNumber(interval) * 2;
|
|
42
|
+
}
|
|
5
43
|
function setMinWidth(obj, props) {
|
|
6
44
|
const config = (props == null ? void 0 : props.table) ?? {};
|
|
7
45
|
if (obj.width) {
|
|
@@ -12,16 +50,18 @@ function setMinWidth(obj, props) {
|
|
|
12
50
|
if (typeof minWidth == "function") {
|
|
13
51
|
return minWidth(obj, config);
|
|
14
52
|
} else if (typeof minWidth == "boolean") {
|
|
15
|
-
return (obj
|
|
53
|
+
return setLabelWidth(obj, config);
|
|
16
54
|
} else {
|
|
17
55
|
return minWidth;
|
|
18
56
|
}
|
|
19
57
|
} else {
|
|
20
58
|
const minWidth2 = getAttrValue(config, "minWidth");
|
|
21
|
-
if (minWidth2) {
|
|
22
|
-
return minWidth2;
|
|
59
|
+
if (typeof minWidth2 == "function") {
|
|
60
|
+
return minWidth2(obj, config);
|
|
61
|
+
} else if (typeof minWidth2 == "boolean") {
|
|
62
|
+
return setLabelWidth(obj, config);
|
|
23
63
|
} else {
|
|
24
|
-
return;
|
|
64
|
+
return minWidth2;
|
|
25
65
|
}
|
|
26
66
|
}
|
|
27
67
|
}
|
|
@@ -183,7 +183,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
183
183
|
]),
|
|
184
184
|
default: vue.withCtx(() => [
|
|
185
185
|
vue.createVNode(columns_vue_vue_type_script_lang.default, {
|
|
186
|
-
table: vue.unref(attrs).assem,
|
|
186
|
+
table: { ...vue.unref(props), ...vue.unref(attrs).assem },
|
|
187
187
|
value: vue.unref(props).value,
|
|
188
188
|
list: vue.unref(props).list,
|
|
189
189
|
options: vue.unref(props).options,
|
|
@@ -181,7 +181,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
181
181
|
]),
|
|
182
182
|
default: withCtx(() => [
|
|
183
183
|
createVNode(_sfc_main$1, {
|
|
184
|
-
table: unref(attrs).assem,
|
|
184
|
+
table: { ...unref(props), ...unref(attrs).assem },
|
|
185
185
|
value: unref(props).value,
|
|
186
186
|
list: unref(props).list,
|
|
187
187
|
options: unref(props).options,
|
|
@@ -256,7 +256,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
256
256
|
]),
|
|
257
257
|
default: vue.withCtx(() => [
|
|
258
258
|
vue.createVNode(columns_vue_vue_type_script_lang.default, {
|
|
259
|
-
table: vue.unref(attrs).assem,
|
|
259
|
+
table: { ...vue.unref(props), ...vue.unref(attrs).assem },
|
|
260
260
|
vxeconfig: config$1.value,
|
|
261
261
|
value: vue.unref(props).value,
|
|
262
262
|
list: vue.unref(props).list,
|
|
@@ -254,7 +254,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
254
254
|
]),
|
|
255
255
|
default: withCtx(() => [
|
|
256
256
|
createVNode(_sfc_main$1, {
|
|
257
|
-
table: unref(attrs).assem,
|
|
257
|
+
table: { ...unref(props), ...unref(attrs).assem },
|
|
258
258
|
vxeconfig: config.value,
|
|
259
259
|
value: unref(props).value,
|
|
260
260
|
list: unref(props).list,
|
package/dist/icons/index.json
CHANGED
package/dist/locale/en.cjs
CHANGED
package/dist/locale/en.d.ts
CHANGED
package/dist/locale/en.js
CHANGED
package/dist/locale/zh-cn.cjs
CHANGED
package/dist/locale/zh-cn.d.ts
CHANGED
package/dist/locale/zh-cn.js
CHANGED
package/dist/utils/css.cjs
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const setObjStyle = require("@fangzhongya/utils/css/setObjStyle");
|
|
4
4
|
const getCss = require("@fangzhongya/utils/css/getCss");
|
|
5
|
+
function getCssNumber(str = "") {
|
|
6
|
+
return Number(String(str).replaceAll(/[^0-9.-]/g, ""));
|
|
7
|
+
}
|
|
5
8
|
Object.defineProperty(exports, "setObjStyle", {
|
|
6
9
|
enumerable: true,
|
|
7
10
|
get: () => setObjStyle.setObjStyle
|
|
@@ -10,3 +13,4 @@ Object.defineProperty(exports, "getCss", {
|
|
|
10
13
|
enumerable: true,
|
|
11
14
|
get: () => getCss.getCss
|
|
12
15
|
});
|
|
16
|
+
exports.getCssNumber = getCssNumber;
|
package/dist/utils/css.d.ts
CHANGED
package/dist/utils/css.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { setObjStyle } from "@fangzhongya/utils/css/setObjStyle";
|
|
2
2
|
import { getCss } from "@fangzhongya/utils/css/getCss";
|
|
3
|
+
function getCssNumber(str = "") {
|
|
4
|
+
return Number(String(str).replaceAll(/[^0-9.-]/g, ""));
|
|
5
|
+
}
|
|
3
6
|
export {
|
|
4
7
|
getCss,
|
|
8
|
+
getCssNumber,
|
|
5
9
|
setObjStyle
|
|
6
10
|
};
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|