@fangzhongya/fang-ui 0.1.38 → 0.1.40
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 +153 -125
- package/dist/components/common/use.d.ts +114 -8
- package/dist/components/common/use.js +154 -126
- package/dist/components/company-select/src/index2.cjs +1 -2
- package/dist/components/company-select/src/index2.js +1 -2
- package/dist/components/double/src/index2.cjs +2 -2
- package/dist/components/double/src/index2.js +2 -2
- package/dist/components/forms/index.css +18 -0
- package/dist/components/forms/src/index2.cjs +9 -6
- package/dist/components/forms/src/index2.js +9 -6
- package/dist/components/forms/src/setup.cjs +9 -12
- package/dist/components/forms/src/setup.d.ts +10 -0
- package/dist/components/forms/src/setup.js +9 -12
- package/dist/components/forms/src/util.cjs +8 -10
- package/dist/components/forms/src/util.d.ts +11 -6
- package/dist/components/forms/src/util.js +8 -10
- package/dist/components/forms-div/src/data.cjs +8 -5
- package/dist/components/forms-div/src/data.d.ts +21 -3
- package/dist/components/forms-div/src/data.js +8 -5
- package/dist/components/forms-div/src/index2.cjs +41 -70
- package/dist/components/forms-div/src/index2.js +43 -72
- package/dist/components/forms-item/src/data.cjs +6 -0
- package/dist/components/forms-item/src/data.d.ts +19 -0
- package/dist/components/forms-item/src/data.js +6 -0
- package/dist/components/forms-item/src/index2.cjs +11 -7
- package/dist/components/forms-item/src/index2.js +11 -7
- package/dist/components/forms-item/src/indexts.d.ts +40 -1
- package/dist/components/forms-item/src/label.cjs +7 -2
- package/dist/components/forms-item/src/label.d.ts +40 -1
- package/dist/components/forms-item/src/label.js +7 -2
- package/dist/components/forms-items/index.css +67 -0
- package/dist/components/forms-items/index.scss +21 -0
- package/dist/components/forms-items/src/data.cjs +9 -0
- package/dist/components/forms-items/src/data.d.ts +22 -0
- package/dist/components/forms-items/src/data.js +9 -0
- package/dist/components/forms-items/src/index2.cjs +22 -10
- package/dist/components/forms-items/src/index2.js +22 -10
- package/dist/components/forms-items/style/index2.scss +1 -0
- package/dist/components/icon/src/index2.cjs +1 -2
- package/dist/components/icon/src/index2.js +1 -2
- package/dist/components/input-history/src/index2.cjs +1 -1
- package/dist/components/input-history/src/index2.js +1 -1
- package/dist/components/input-select/src/index2.cjs +0 -2
- package/dist/components/input-select/src/index2.js +0 -2
- package/dist/components/inputs/src/index2.cjs +1 -1
- package/dist/components/inputs/src/index2.js +1 -1
- package/dist/components/list/src/index2.cjs +5 -19
- package/dist/components/list/src/index2.js +5 -19
- package/dist/components/list/src/util.cjs +9 -9
- package/dist/components/list/src/util.d.ts +30 -2
- package/dist/components/list/src/util.js +9 -9
- package/dist/components/lists/src/index2.cjs +1 -2
- package/dist/components/lists/src/index2.js +1 -2
- package/dist/components/menus/src/util.cjs +8 -24
- package/dist/components/menus/src/util.js +9 -25
- package/dist/components/page/index.css +18 -0
- package/dist/components/right-key/src/index2.cjs +3 -3
- package/dist/components/right-key/src/index2.js +3 -3
- package/dist/components/seamless-scroll/src/index2.cjs +1 -1
- package/dist/components/seamless-scroll/src/index2.js +1 -1
- package/dist/components/selects/src/index2.cjs +2 -2
- package/dist/components/selects/src/index2.js +2 -2
- package/dist/components/stick-edge/src/index2.cjs +2 -2
- package/dist/components/stick-edge/src/index2.js +2 -2
- package/dist/components/switchs/src/index2.cjs +1 -1
- package/dist/components/switchs/src/index2.js +1 -1
- package/dist/components/tables/common/com-color2.cjs +0 -3
- package/dist/components/tables/common/com-color2.js +0 -3
- package/dist/components/tables/common/com-lis2.cjs +0 -1
- package/dist/components/tables/common/com-lis2.js +0 -1
- package/dist/components/tables/common/pagin.d.ts +16 -0
- package/dist/components/tables/common/tooltip.cjs +1 -1
- package/dist/components/tables/common/tooltip.js +1 -1
- package/dist/components/tables/common/util.cjs +46 -8
- package/dist/components/tables/common/util.d.ts +13 -0
- package/dist/components/tables/common/util.js +47 -9
- package/dist/components/tables/src/column.cjs +11 -4
- package/dist/components/tables/src/column.d.ts +29 -0
- package/dist/components/tables/src/column.js +11 -4
- package/dist/components/tables/src/columns.d.ts +7 -0
- package/dist/components/tables/src/columns3.cjs +1 -7
- package/dist/components/tables/src/columns3.js +1 -7
- package/dist/components/tables/src/index2.cjs +3 -3
- package/dist/components/tables/src/index2.js +3 -3
- package/dist/components/tablesv/src/column.cjs +11 -4
- package/dist/components/tablesv/src/column.d.ts +25 -0
- package/dist/components/tablesv/src/column.js +11 -4
- package/dist/components/tablesv/src/columns.d.ts +7 -0
- package/dist/components/tablesv/src/columns3.cjs +1 -7
- package/dist/components/tablesv/src/columns3.js +1 -7
- package/dist/components/tablesv/src/index2.cjs +3 -3
- package/dist/components/tablesv/src/index2.js +3 -3
- package/dist/components/uploads/src/util.cjs +2 -3
- package/dist/components/uploads/src/util.d.ts +7 -0
- package/dist/components/uploads/src/util.js +2 -3
- package/dist/css/forms-items.css +67 -0
- package/dist/css/forms.css +18 -0
- package/dist/css/index.css +18 -0
- package/dist/css/page.css +18 -0
- package/dist/directives/adjust/index.cjs +4 -8
- package/dist/directives/adjust/index.js +4 -8
- package/dist/directives/drag/index.cjs +6 -1
- package/dist/directives/drag/index.js +6 -1
- package/dist/directives/expose/index.cjs +6 -0
- package/dist/directives/expose/index.js +6 -0
- package/dist/directives/inserted/index.cjs +5 -0
- package/dist/directives/inserted/index.js +5 -0
- package/dist/directives/locus/index.cjs +5 -0
- package/dist/directives/locus/index.js +5 -0
- package/dist/directives/scroll/index.cjs +10 -0
- package/dist/directives/scroll/index.d.ts +0 -5
- package/dist/directives/scroll/index.js +10 -0
- package/dist/directives/sortable/index.cjs +5 -0
- package/dist/directives/sortable/index.js +5 -0
- package/dist/directives/stick/index.cjs +13 -8
- package/dist/directives/stick/index.js +13 -8
- package/dist/hooks/attrs-default/index.d.ts +5 -3
- package/dist/hooks/compons/index.d.ts +13 -0
- package/dist/hooks/cssname/index.cjs +1 -1
- package/dist/hooks/cssname/index.d.ts +22 -1
- package/dist/hooks/cssname/index.js +1 -1
- package/dist/hooks/default-config/index.d.ts +10 -0
- package/dist/hooks/expose/index.cjs +2 -0
- package/dist/hooks/expose/index.d.ts +6 -0
- package/dist/hooks/expose/index.js +2 -0
- package/dist/hooks/full-screen/index.d.ts +6 -0
- package/dist/hooks/global-config/index.d.ts +16 -0
- package/dist/hooks/inherit/index.cjs +2 -0
- package/dist/hooks/inherit/index.d.ts +8 -0
- package/dist/hooks/inherit/index.js +2 -0
- package/dist/hooks/locale/index.d.ts +24 -0
- package/dist/hooks/props-default/index.d.ts +14 -5
- package/dist/icons/iconify.d.ts +7 -0
- package/dist/icons/iconifyCss.d.ts +6 -0
- package/dist/icons/index.json +1 -1
- package/dist/index.css +18 -0
- 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/type.d.ts +8 -0
- package/dist/utils/css.cjs +4 -0
- package/dist/utils/css.d.ts +1 -0
- package/dist/utils/css.js +4 -0
- package/dist/utils/local.cjs +12 -6
- package/dist/utils/local.js +12 -6
- package/dist/utils/util.cjs +7 -5
- package/dist/utils/util.js +7 -5
- package/package.json +1 -1
|
@@ -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: {};
|
|
@@ -90,17 +90,26 @@ function handleComputedWithoutDefault(obj, v) {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
function setFormDefaultValue(obj, value) {
|
|
93
|
-
let v = util.getChildrenData(obj, value
|
|
93
|
+
let v = util.getChildrenData(obj, value);
|
|
94
94
|
if (obj.orig) {
|
|
95
|
-
v = value;
|
|
95
|
+
v = value ?? {};
|
|
96
96
|
}
|
|
97
97
|
setComputed(obj, v);
|
|
98
98
|
const prop = obj.prop;
|
|
99
99
|
if (prop) {
|
|
100
|
-
if (
|
|
101
|
-
|
|
100
|
+
if (v) {
|
|
101
|
+
if (obj.pars) {
|
|
102
|
+
objValue.setObjValue(v, prop, objValue.getObjValue(prop, v) ?? obj.default);
|
|
103
|
+
} else {
|
|
104
|
+
v[prop] = v[prop] ?? obj.default;
|
|
105
|
+
}
|
|
102
106
|
} else {
|
|
103
|
-
v
|
|
107
|
+
v = util.getChildrenData(obj, value, true);
|
|
108
|
+
if (obj.pars) {
|
|
109
|
+
objValue.setObjValue(v, prop, objValue.getObjValue(prop, v) ?? obj.default);
|
|
110
|
+
} else {
|
|
111
|
+
v[prop] = v[prop] ?? obj.default;
|
|
112
|
+
}
|
|
104
113
|
}
|
|
105
114
|
}
|
|
106
115
|
}
|
|
@@ -150,48 +159,46 @@ function getValueObjs(value, multiple, options, config) {
|
|
|
150
159
|
return value;
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
|
-
function setOptionsValue(value, obj, data,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
options = value2(optionss, value2, obj, data) || [];
|
|
161
|
-
} else {
|
|
162
|
-
options = value2 || [];
|
|
163
|
-
}
|
|
164
|
-
} else if (typeof opt == "function") {
|
|
165
|
-
options = opt(optionss, value, obj, data) || [];
|
|
166
|
-
} else {
|
|
167
|
-
options = opt || [];
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return getValueObjs(value, obj.multiple, options, obj.config);
|
|
162
|
+
function setOptionsValue(value, obj, data, options = {}) {
|
|
163
|
+
return getValueObjs(
|
|
164
|
+
value,
|
|
165
|
+
obj.multiple,
|
|
166
|
+
processOptions(value, obj, data, options),
|
|
167
|
+
obj.config
|
|
168
|
+
);
|
|
171
169
|
}
|
|
172
170
|
function setValue(value, obj, data) {
|
|
173
|
-
let v = util.getChildrenData(obj, data)
|
|
171
|
+
let v = util.getChildrenData(obj, data);
|
|
174
172
|
if (obj.orig) {
|
|
175
173
|
v = data ?? {};
|
|
176
174
|
}
|
|
177
175
|
const prop = obj.prop;
|
|
178
176
|
if (prop) {
|
|
179
|
-
if (
|
|
180
|
-
|
|
177
|
+
if (v) {
|
|
178
|
+
if (obj.pars) {
|
|
179
|
+
objValue.setObjValue(v, prop, value);
|
|
180
|
+
} else {
|
|
181
|
+
v[prop] = value;
|
|
182
|
+
}
|
|
181
183
|
} else {
|
|
182
|
-
v
|
|
184
|
+
v = util.getChildrenData(obj, data, true);
|
|
185
|
+
if (obj.pars) {
|
|
186
|
+
objValue.setObjValue(v, prop, value);
|
|
187
|
+
} else {
|
|
188
|
+
v[prop] = value;
|
|
189
|
+
}
|
|
183
190
|
}
|
|
184
191
|
}
|
|
185
192
|
}
|
|
186
193
|
function getValue(obj, data, index) {
|
|
187
194
|
const prop = obj.prop;
|
|
188
|
-
const cdata = util.getChildrenData(obj, data
|
|
195
|
+
const cdata = util.getChildrenData(obj, data);
|
|
189
196
|
let cellValue;
|
|
190
197
|
if (prop) {
|
|
191
198
|
if (obj.pars) {
|
|
192
199
|
cellValue = objValue.getObjValue(prop, cdata);
|
|
193
200
|
} else {
|
|
194
|
-
cellValue = cdata[prop];
|
|
201
|
+
cellValue = cdata == null ? void 0 : cdata[prop];
|
|
195
202
|
}
|
|
196
203
|
} else {
|
|
197
204
|
cellValue = obj.value;
|
|
@@ -202,36 +209,51 @@ function getValue(obj, data, index) {
|
|
|
202
209
|
return cellValue ?? obj.default;
|
|
203
210
|
}
|
|
204
211
|
}
|
|
205
|
-
function setComponString(value, obj, componObj,
|
|
206
|
-
processOptions(obj, componObj, optionss, value, data);
|
|
212
|
+
function setComponString(value, obj, componObj, compons) {
|
|
207
213
|
const compon = obj.compon;
|
|
208
214
|
const tcom = lineToLargeHump.lineToLargeHump(compon);
|
|
209
|
-
return renderComponent(tcom, compon, componObj, value, compons);
|
|
215
|
+
return renderComponent(obj, tcom, compon, componObj, value, compons);
|
|
210
216
|
}
|
|
211
|
-
function processOptions(
|
|
212
|
-
if (!(obj == null ? void 0 : obj.options)) return;
|
|
213
|
-
let
|
|
217
|
+
function processOptions(value, obj, data, options) {
|
|
218
|
+
if (!(obj == null ? void 0 : obj.options)) return [];
|
|
219
|
+
let option = [];
|
|
214
220
|
const opt = obj.options;
|
|
215
221
|
if (typeof opt === "string") {
|
|
216
|
-
const optionsvalue =
|
|
217
|
-
|
|
222
|
+
const optionsvalue = options[opt];
|
|
223
|
+
option = typeof optionsvalue == "function" ? optionsvalue(options, value, obj, data) || [] : optionsvalue || [];
|
|
218
224
|
} else if (typeof opt == "function") {
|
|
219
|
-
|
|
225
|
+
option = opt(options, value, obj, data) || [];
|
|
220
226
|
} else {
|
|
221
|
-
|
|
227
|
+
option = opt || [];
|
|
222
228
|
}
|
|
223
|
-
|
|
224
|
-
|
|
229
|
+
return option;
|
|
230
|
+
}
|
|
231
|
+
function setSlots(obj) {
|
|
232
|
+
const slots = obj.slots;
|
|
233
|
+
if (vue.isVNode(slots)) {
|
|
234
|
+
return {
|
|
235
|
+
default: () => slots
|
|
236
|
+
};
|
|
237
|
+
} else if (typeof slots === "function") {
|
|
238
|
+
return {
|
|
239
|
+
default: slots
|
|
240
|
+
};
|
|
241
|
+
} else if (isObject.isObject(slots)) {
|
|
242
|
+
return slots;
|
|
243
|
+
} else if (slots) {
|
|
244
|
+
return {
|
|
245
|
+
default: () => slots
|
|
246
|
+
};
|
|
225
247
|
}
|
|
226
248
|
}
|
|
227
|
-
function renderComponent(tcom, compon, componObj, value, compons) {
|
|
249
|
+
function renderComponent(obj, tcom, compon, componObj, value, compons) {
|
|
228
250
|
if (Object.keys(compons).includes(tcom)) {
|
|
229
|
-
return vue.h(compons[tcom], componObj);
|
|
251
|
+
return vue.h(compons[tcom], componObj, setSlots(obj));
|
|
230
252
|
}
|
|
231
253
|
if (shared.isHTMLTag(compon) || shared.isSVGTag(compon)) {
|
|
232
254
|
return vue.h(compon, componObj, value);
|
|
233
255
|
}
|
|
234
|
-
return vue.h(vue.resolveComponent(compon), componObj);
|
|
256
|
+
return vue.h(vue.resolveComponent(compon), componObj, setSlots(obj));
|
|
235
257
|
}
|
|
236
258
|
function getOnObjs(obj, data, emit, ...arrs) {
|
|
237
259
|
const objs = {};
|
|
@@ -252,7 +274,7 @@ function getOnObjs(obj, data, emit, ...arrs) {
|
|
|
252
274
|
}
|
|
253
275
|
return objs;
|
|
254
276
|
}
|
|
255
|
-
function useSetSlot(obj, data, slots, index, scope) {
|
|
277
|
+
function useSetSlot(obj, data, slots, options, emit, index, scope) {
|
|
256
278
|
const slotname = obj.slot ?? obj.prop;
|
|
257
279
|
if (slotname) {
|
|
258
280
|
const slot = slots[slotname];
|
|
@@ -265,50 +287,61 @@ function useSetSlot(obj, data, slots, index, scope) {
|
|
|
265
287
|
setValue(value2, obj, data);
|
|
266
288
|
}
|
|
267
289
|
});
|
|
290
|
+
const componObj = getComponObj(
|
|
291
|
+
value.value,
|
|
292
|
+
obj,
|
|
293
|
+
data,
|
|
294
|
+
options,
|
|
295
|
+
emit,
|
|
296
|
+
scope
|
|
297
|
+
);
|
|
268
298
|
return slot({
|
|
269
|
-
comscope: scope,
|
|
270
299
|
column: obj,
|
|
271
300
|
row: data,
|
|
272
301
|
value,
|
|
273
|
-
index
|
|
302
|
+
index,
|
|
303
|
+
...componObj
|
|
274
304
|
});
|
|
275
305
|
}
|
|
276
306
|
}
|
|
277
307
|
}
|
|
278
|
-
function
|
|
308
|
+
function getComponObj(value, obj, data, options, emit, scope) {
|
|
309
|
+
const componValueName = obj.componValueName || "modelValue";
|
|
310
|
+
const componObj = {
|
|
311
|
+
// ...attrs,
|
|
312
|
+
[componValueName]: value,
|
|
313
|
+
["onUpdate:" + componValueName]: (v) => setValue(v, obj, data),
|
|
314
|
+
listobj: obj,
|
|
315
|
+
valueobj: data,
|
|
316
|
+
comscope: scope,
|
|
317
|
+
...obj.config,
|
|
318
|
+
...getOnObjs(obj, data, emit, scope)
|
|
319
|
+
};
|
|
320
|
+
if (obj.multiple) {
|
|
321
|
+
componObj.multiple = obj.multiple;
|
|
322
|
+
}
|
|
323
|
+
const option = processOptions(value, obj, data, options);
|
|
324
|
+
if (option.length > 0) {
|
|
325
|
+
componObj.options = option;
|
|
326
|
+
}
|
|
327
|
+
return componObj;
|
|
328
|
+
}
|
|
329
|
+
function useSetCompon(obj, data, options, compons, emit, index, scope) {
|
|
279
330
|
if (obj.compon) {
|
|
280
331
|
const value = getValue(obj, data, index);
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
componObj.multiple = obj.multiple;
|
|
295
|
-
}
|
|
296
|
-
if (typeof obj.compon == "string") {
|
|
297
|
-
return setComponString(
|
|
298
|
-
value,
|
|
299
|
-
obj,
|
|
300
|
-
componObj,
|
|
301
|
-
data,
|
|
302
|
-
optionss,
|
|
303
|
-
compons
|
|
304
|
-
);
|
|
305
|
-
} else if (typeof obj.compon == "function") {
|
|
306
|
-
return obj.compon(componObj);
|
|
307
|
-
} else if (vue.isVNode(obj.compon)) {
|
|
308
|
-
return obj.compon;
|
|
309
|
-
} else {
|
|
310
|
-
return vue.h(obj.compon, componObj);
|
|
311
|
-
}
|
|
332
|
+
const componObj = getComponObj(value, obj, data, options, emit, scope);
|
|
333
|
+
return useGetCompon(obj.compon, componObj, obj, compons, value);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function useGetCompon(compon, componObj, obj, compons, value) {
|
|
337
|
+
if (typeof compon == "string") {
|
|
338
|
+
return setComponString(value, obj, componObj, compons);
|
|
339
|
+
} else if (typeof compon == "function") {
|
|
340
|
+
return compon(componObj, setSlots(obj));
|
|
341
|
+
} else if (vue.isVNode(compon)) {
|
|
342
|
+
return compon;
|
|
343
|
+
} else {
|
|
344
|
+
return vue.h(compon, componObj, setSlots(obj));
|
|
312
345
|
}
|
|
313
346
|
}
|
|
314
347
|
const useGetDomValue = (obj, data, options, index) => {
|
|
@@ -318,7 +351,8 @@ const useGetDomValue = (obj, data, options, index) => {
|
|
|
318
351
|
}
|
|
319
352
|
return value;
|
|
320
353
|
};
|
|
321
|
-
const useGetDomLabel = (
|
|
354
|
+
const useGetDomLabel = (obj, data, slots, options, compons, emit, index) => {
|
|
355
|
+
const label = obj.label;
|
|
322
356
|
if (!label) {
|
|
323
357
|
return label;
|
|
324
358
|
}
|
|
@@ -331,65 +365,47 @@ const useGetDomLabel = (label, obj, data, slots, optionss, compons, emit, index,
|
|
|
331
365
|
if (!isObject.isObject(label)) {
|
|
332
366
|
return label;
|
|
333
367
|
}
|
|
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
368
|
if (Array.isArray(label)) {
|
|
348
|
-
return renderLabelArray(label, data,
|
|
349
|
-
}
|
|
350
|
-
return
|
|
351
|
-
|
|
352
|
-
obj,
|
|
353
|
-
data,
|
|
354
|
-
slots,
|
|
355
|
-
optionss,
|
|
369
|
+
return renderLabelArray(label, data, options, compons, emit, index);
|
|
370
|
+
}
|
|
371
|
+
return useVNodeComponDom(label, data, slots, emit, {
|
|
372
|
+
options,
|
|
356
373
|
compons,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
isComponSelected
|
|
360
|
-
);
|
|
374
|
+
index
|
|
375
|
+
});
|
|
361
376
|
};
|
|
362
|
-
const renderLabelArray = (labels, data,
|
|
377
|
+
const renderLabelArray = (labels, data, options, compons, emit, index) => {
|
|
363
378
|
return vue.h(
|
|
364
379
|
"div",
|
|
365
380
|
{ class: "com-lable-array" },
|
|
366
381
|
labels.map((v) => {
|
|
367
382
|
const labelObj = typeof v === "string" ? { value: v, compon: "div" } : v;
|
|
368
|
-
return useSetCompon(labelObj, data,
|
|
383
|
+
return useSetCompon(labelObj, data, options, compons, emit, index);
|
|
369
384
|
})
|
|
370
385
|
);
|
|
371
386
|
};
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
const slot = useSetSlot(
|
|
387
|
+
function useVNodeComponDom(obj, data, slots, emit, config) {
|
|
388
|
+
const { options, compons, index, scope } = config;
|
|
389
|
+
const slot = useSetSlot(obj, data, slots, options, emit, index, scope);
|
|
375
390
|
if (slot) {
|
|
376
391
|
return slot;
|
|
377
392
|
}
|
|
378
|
-
if (
|
|
393
|
+
if (obj.compon) {
|
|
379
394
|
const column = useSetCompon(
|
|
380
|
-
|
|
395
|
+
obj,
|
|
381
396
|
data,
|
|
382
|
-
|
|
397
|
+
options,
|
|
383
398
|
compons,
|
|
384
399
|
emit,
|
|
385
|
-
index
|
|
400
|
+
index,
|
|
401
|
+
scope
|
|
386
402
|
);
|
|
387
403
|
if (column) {
|
|
388
404
|
return column;
|
|
389
405
|
}
|
|
390
406
|
}
|
|
391
|
-
return useGetDomValue(
|
|
392
|
-
}
|
|
407
|
+
return useGetDomValue(obj, data, options, index);
|
|
408
|
+
}
|
|
393
409
|
function useObjComponSelected(obj, props) {
|
|
394
410
|
const arrs = [obj];
|
|
395
411
|
util.getFathers(obj, arrs);
|
|
@@ -428,27 +444,38 @@ function getVNodeContent(vnode) {
|
|
|
428
444
|
vue.render(null, container);
|
|
429
445
|
return textContent;
|
|
430
446
|
}
|
|
431
|
-
function getLabelText(
|
|
432
|
-
if (
|
|
433
|
-
return
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
447
|
+
function getLabelText(obj) {
|
|
448
|
+
if (obj.labelText) {
|
|
449
|
+
return obj.labelText;
|
|
450
|
+
}
|
|
451
|
+
if (!obj.label) {
|
|
452
|
+
const farrs = [];
|
|
453
|
+
util.getFathers(obj, farrs);
|
|
454
|
+
farrs.reverse();
|
|
455
|
+
for (const v of farrs) {
|
|
456
|
+
if (v.labelText) {
|
|
457
|
+
return v.labelText;
|
|
458
|
+
} else if (v.label) {
|
|
459
|
+
obj = v;
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
438
463
|
}
|
|
464
|
+
const label = useGetDomLabel(obj, {}, {}, {}, {}, () => {
|
|
465
|
+
}, 0);
|
|
439
466
|
if (vue.isVNode(label)) {
|
|
440
467
|
return getVNodeContent(label);
|
|
441
|
-
} else if (Array.isArray(label)) {
|
|
442
|
-
return label.join("");
|
|
443
468
|
} else {
|
|
444
469
|
return (label == null ? void 0 : label.toString()) || "";
|
|
445
470
|
}
|
|
446
471
|
}
|
|
472
|
+
exports.getComponObj = getComponObj;
|
|
447
473
|
exports.getFormRule = getFormRule;
|
|
448
474
|
exports.getLabelText = getLabelText;
|
|
449
475
|
exports.getOnObjs = getOnObjs;
|
|
450
476
|
exports.getVNodeContent = getVNodeContent;
|
|
451
477
|
exports.setFormDefaultValue = setFormDefaultValue;
|
|
478
|
+
exports.useGetCompon = useGetCompon;
|
|
452
479
|
exports.useGetDomLabel = useGetDomLabel;
|
|
453
480
|
exports.useGetDomValue = useGetDomValue;
|
|
454
481
|
exports.useHide = useHide;
|
|
@@ -458,4 +485,5 @@ exports.usePropsDefault = usePropsDefault;
|
|
|
458
485
|
exports.useSetCompon = useSetCompon;
|
|
459
486
|
exports.useSetSlot = useSetSlot;
|
|
460
487
|
exports.useSetValue = useSetValue;
|
|
488
|
+
exports.useVNodeComponDom = useVNodeComponDom;
|
|
461
489
|
exports.useVueValue = useVueValue;
|
|
@@ -1,25 +1,131 @@
|
|
|
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
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
50
|
+
/**
|
|
51
|
+
* 设置并渲染插槽内容的自定义hook函数
|
|
52
|
+
*
|
|
53
|
+
* @param obj - 列表对象配置,包含插槽名称或属性名
|
|
54
|
+
* @param data - 数据对象,用于获取和设置值
|
|
55
|
+
* @param slots - 插槽映射对象,存储可用的插槽函数
|
|
56
|
+
* @param index - 可选的索引值,用于数据定位
|
|
57
|
+
* @param scope - 可选的作用域对象,传递给插槽函数
|
|
58
|
+
* @returns 插槽函数执行结果或undefined
|
|
59
|
+
*/
|
|
60
|
+
export declare function useSetSlot(obj: ListObj, data: ObjAny, slots: ObjAny, options: ObjAny, emit: Function, index?: number | number[], scope?: ObjAny): any;
|
|
61
|
+
export declare function getComponObj(value: any, obj: ListObj, data: ObjAny, options: ObjAny, emit: Function, scope?: ObjAny): {
|
|
62
|
+
[x: string]: any;
|
|
63
|
+
listobj: ListObj;
|
|
64
|
+
valueobj: ObjAny;
|
|
65
|
+
comscope: ObjAny | undefined;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* 根据配置对象设置组件
|
|
69
|
+
* @param obj - 列表对象配置,包含组件相关配置信息
|
|
70
|
+
* @param data - 数据对象,用于获取和设置组件值
|
|
71
|
+
* @param options - 选项配置对象
|
|
72
|
+
* @param compons - 组件集合
|
|
73
|
+
* @param emit - 事件发射函数
|
|
74
|
+
* @param index - 索引值,可选参数
|
|
75
|
+
* @param scope - 作用域对象,可选参数
|
|
76
|
+
* @returns 返回创建的组件节点或组件调用结果
|
|
77
|
+
*/
|
|
78
|
+
export declare function useSetCompon(obj: ListObj, data: ObjAny, options: ObjAny, compons: Compons, emit: Function, index?: number | number[], scope?: ObjAny): any;
|
|
79
|
+
export declare function useGetCompon(compon: any, componObj: ObjAny, obj: ListObj, compons: Compons, value: any): any;
|
|
80
|
+
/**
|
|
81
|
+
* 获取DOM元素的值
|
|
82
|
+
* @param obj - 列表对象配置
|
|
83
|
+
* @param data - 数据对象
|
|
84
|
+
* @param options - 选项配置对象
|
|
85
|
+
* @param index - 可选的索引值
|
|
86
|
+
* @returns 返回处理后的值
|
|
87
|
+
*/
|
|
88
|
+
export declare const useGetDomValue: (obj: ListObj, data: ObjAny, options: ObjAny, index?: number | number[]) => any;
|
|
89
|
+
/**
|
|
90
|
+
* 获取DOM标签的处理函数
|
|
91
|
+
* @param obj - 包含label属性的对象
|
|
92
|
+
* @param data - 数据对象
|
|
93
|
+
* @param slots - 插槽对象
|
|
94
|
+
* @param options - 选项配置对象
|
|
95
|
+
* @param compons - 组件对象
|
|
96
|
+
* @param emit - 事件发射函数
|
|
97
|
+
* @param index - 索引值
|
|
98
|
+
* @returns 返回处理后的标签内容,可能是字符串、VNode或渲染后的数组/对象
|
|
99
|
+
*/
|
|
100
|
+
export declare const useGetDomLabel: (obj: ListObj, data: ObjAny, slots: ObjAny, options: ObjAny, compons: Compons, emit: Function, index: number) => any;
|
|
101
|
+
/**
|
|
102
|
+
* 根据配置对象处理虚拟节点的组件或DOM渲染
|
|
103
|
+
* @param obj - 列表对象配置,包含标签和组件信息
|
|
104
|
+
* @param data - 数据对象,用于渲染的数据源
|
|
105
|
+
* @param slots - 插槽配置对象
|
|
106
|
+
* @param options - 选项配置对象
|
|
107
|
+
* @param compons - 组件集合
|
|
108
|
+
* @param emit - 事件发射函数
|
|
109
|
+
* @param index - 当前项的索引
|
|
110
|
+
* @param config - 可选的额外配置对象
|
|
111
|
+
* @returns 处理后的虚拟节点、组件或DOM值
|
|
112
|
+
*/
|
|
113
|
+
export declare function useVNodeComponDom(obj: ListObj, data: ObjAny, slots: ObjAny, emit: Function, config: ObjAny): any;
|
|
114
|
+
/**
|
|
115
|
+
* 获取对象及其父级链中选中的组件
|
|
116
|
+
* @param obj - 当前列表对象
|
|
117
|
+
* @param props - 包含组件选择状态的属性对象
|
|
118
|
+
* @returns 返回在对象层级链中找到的选中组件,如果没有则返回默认选中组件
|
|
119
|
+
*/
|
|
17
120
|
export declare function useObjComponSelected(obj: ListObj, props: ObjAny): any;
|
|
18
121
|
/**
|
|
19
122
|
* 设置获取默认值
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
123
|
+
* 创建一个代理对象,用于处理属性默认值
|
|
124
|
+
* 当访问的属性值为undefined时,会调用对应的默认值函数来获取默认值
|
|
125
|
+
*
|
|
126
|
+
* @param props 原始属性对象
|
|
127
|
+
* @param keyObj 包含属性键和对应默认值函数的对象
|
|
128
|
+
* @returns 返回一个代理对象,支持默认值处理
|
|
23
129
|
*/
|
|
24
130
|
export declare function usePropsDefault(props: any, keyObj: {
|
|
25
131
|
[key: string]: () => any;
|
|
@@ -42,5 +148,5 @@ export declare function getVNodeContent(vnode: VNode): string;
|
|
|
42
148
|
* @param label
|
|
43
149
|
* @returns
|
|
44
150
|
*/
|
|
45
|
-
export declare function getLabelText(
|
|
151
|
+
export declare function getLabelText(obj: ListObj): string;
|
|
46
152
|
export {};
|