@fangzhongya/fang-ui 0.1.27 → 0.1.29
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/array/index.css +4 -0
- package/dist/components/array/src/index2.cjs +5 -5
- package/dist/components/array/src/index2.js +2 -2
- package/dist/components/audios/index.css +4 -0
- package/dist/components/box/index.css +4 -0
- package/dist/components/box-adjust/index.css +4 -0
- package/dist/components/box-local/index.css +4 -0
- package/dist/components/box-mask/index.css +4 -0
- package/dist/components/box-title/index.css +4 -0
- package/dist/components/buttons/index.css +4 -0
- package/dist/components/cascaders/index.css +4 -0
- package/dist/components/checks/index.css +4 -0
- package/dist/components/common/compons/components.cjs +52 -0
- package/dist/components/common/compons/components.d.ts +27 -0
- package/dist/components/common/compons/components.js +52 -0
- package/dist/components/common/compons/index.scss +23 -0
- package/dist/components/common/compons/index2.scss +23 -0
- package/dist/components/common/use.cjs +87 -16
- package/dist/components/common/use.d.ts +28 -5
- package/dist/components/common/use.js +88 -17
- package/dist/components/dates/index.css +4 -0
- package/dist/components/dates-divide/index.css +4 -0
- package/dist/components/dates-picker/index.css +4 -0
- package/dist/components/dates2/index.css +4 -0
- package/dist/components/dialogs/index.css +4 -0
- package/dist/components/edit/index.css +4 -0
- package/dist/components/edit-float/index.css +4 -0
- package/dist/components/forms/common/config.cjs +11 -1
- package/dist/components/forms/common/config.d.ts +1 -0
- package/dist/components/forms/common/config.js +11 -1
- package/dist/components/forms/index.css +10 -6
- package/dist/components/forms/index.scss +2 -1
- package/dist/components/forms/src/data.cjs +7 -0
- package/dist/components/forms/src/data.d.ts +7 -0
- package/dist/components/forms/src/data.js +7 -0
- package/dist/components/forms/src/setup.cjs +6 -13
- package/dist/components/forms/src/setup.d.ts +1 -1
- package/dist/components/forms/src/setup.js +8 -15
- package/dist/components/forms/src/util.cjs +1 -2
- package/dist/components/forms/src/util.d.ts +1 -1
- package/dist/components/forms/src/util.js +1 -2
- package/dist/components/forms/style/index2.scss +3 -1
- package/dist/components/forms-div/index.css +4 -0
- package/dist/components/forms-div/src/index2.cjs +11 -5
- package/dist/components/forms-div/src/index2.js +10 -4
- package/dist/components/forms-item/index.css +4 -0
- package/dist/components/forms-item/src/indexts.d.ts +1 -1
- package/dist/components/forms-item/src/label.cjs +16 -29
- package/dist/components/forms-item/src/label.js +17 -30
- package/dist/components/full-screen/index.css +4 -0
- package/dist/components/global-config/index.css +4 -0
- package/dist/components/history/index.css +4 -0
- package/dist/components/icon/index.css +4 -0
- package/dist/components/icon-picker/index.css +4 -0
- package/dist/components/iframe/index.css +4 -0
- package/dist/components/images/index.css +4 -0
- package/dist/components/index.cjs +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index2.scss +2 -1
- package/dist/components/input-array/index.css +4 -0
- package/dist/components/input-history/index.css +4 -0
- package/dist/components/input-num/index.css +4 -0
- package/dist/components/input-select/index.css +4 -0
- package/dist/components/inputs/index.css +4 -0
- package/dist/components/labels/index.css +4 -0
- package/dist/components/list/index.css +4 -0
- package/dist/components/list/src/data.cjs +6 -0
- package/dist/components/list/src/data.d.ts +6 -0
- package/dist/components/list/src/data.js +6 -0
- package/dist/components/list/src/index2.cjs +6 -6
- package/dist/components/list/src/index2.js +2 -2
- package/dist/components/list/src/util.cjs +12 -26
- package/dist/components/list/src/util.d.ts +1 -1
- package/dist/components/list/src/util.js +13 -27
- package/dist/components/lists/index.css +4 -0
- package/dist/components/listsp/index.css +4 -0
- package/dist/components/listspd/index.css +4 -0
- package/dist/components/menus/index.css +4 -0
- package/dist/components/no-data/index.css +4 -0
- package/dist/components/page/index.css +10 -6
- package/dist/components/paging/index.css +4 -0
- package/dist/components/popup/index.css +4 -0
- package/dist/components/retract/index.css +4 -0
- package/dist/components/right-key/index.css +4 -0
- package/dist/components/scss/common.scss +4 -0
- package/dist/components/seamless-scroll/index.css +4 -0
- package/dist/components/select-scroll/index.css +4 -0
- package/dist/components/selector/index.css +4 -0
- package/dist/components/selects/index.css +4 -0
- package/dist/components/sliders/index.css +4 -0
- package/dist/components/switchs/index.css +4 -0
- package/dist/components/tables/common/config.cjs +1 -1
- package/dist/components/tables/common/config.js +1 -1
- package/dist/components/tables/common/pagin.cjs +74 -32
- package/dist/components/tables/common/pagin.d.ts +10 -1
- package/dist/components/tables/common/pagin.js +74 -32
- package/dist/components/tables/index.css +4 -0
- package/dist/components/tables/src/column.cjs +22 -20
- package/dist/components/tables/src/column.d.ts +1 -0
- package/dist/components/tables/src/column.js +14 -12
- package/dist/components/tables/src/data.cjs +15 -0
- package/dist/components/tables/src/data.d.ts +13 -0
- package/dist/components/tables/src/data.js +15 -0
- package/dist/components/tables/src/index2.cjs +17 -9
- package/dist/components/tables/src/index2.js +11 -3
- package/dist/components/tablesp/index.css +4 -0
- package/dist/components/tablespd/index.css +4 -0
- package/dist/components/tabless/index.css +4 -0
- package/dist/components/tablesv/index.css +4 -0
- package/dist/components/tablesv/src/column.cjs +116 -112
- package/dist/components/tablesv/src/column.js +110 -106
- package/dist/components/tablesv/src/data.cjs +44 -0
- package/dist/components/tablesv/src/data.d.ts +43 -1
- package/dist/components/tablesv/src/data.js +44 -0
- package/dist/components/tablesv/src/index2.cjs +37 -14
- package/dist/components/tablesv/src/index2.js +36 -13
- package/dist/components/tablesv/style/index2.scss +3 -1
- package/dist/components/tablesvp/index.css +10 -0
- package/dist/components/tablesvp/index.scss +8 -0
- package/dist/components/tablesvp/src/index2.cjs +15 -5
- package/dist/components/tablesvp/src/index2.js +15 -5
- package/dist/components/tablesvpd/index.cjs +9 -0
- package/dist/components/tablesvpd/index.css +157 -0
- package/dist/components/tablesvpd/index.d.ts +4 -0
- package/dist/components/tablesvpd/index.js +9 -0
- package/dist/components/tablesvpd/index.scss +41 -0
- package/dist/components/tablesvpd/src/data.cjs +13 -0
- package/dist/components/tablesvpd/src/data.d.ts +18 -0
- package/dist/components/tablesvpd/src/data.js +13 -0
- package/dist/components/tablesvpd/src/index.cjs +4 -0
- package/dist/components/tablesvpd/src/index.js +4 -0
- package/dist/components/tablesvpd/src/index2.cjs +107 -0
- package/dist/components/tablesvpd/src/index2.js +107 -0
- package/dist/components/tablesvpd/style/index2.scss +4 -0
- package/dist/components/uploads/index.css +4 -0
- package/dist/components/videos/index.css +4 -0
- package/dist/components/window/index.css +4 -0
- package/dist/css/array.css +4 -0
- package/dist/css/audios.css +4 -0
- package/dist/css/box-adjust.css +4 -0
- package/dist/css/box-local.css +4 -0
- package/dist/css/box-mask.css +4 -0
- package/dist/css/box-title.css +4 -0
- package/dist/css/box.css +4 -0
- package/dist/css/buttons.css +4 -0
- package/dist/css/cascaders.css +4 -0
- package/dist/css/checks.css +4 -0
- package/dist/css/dates-divide.css +4 -0
- package/dist/css/dates-picker.css +4 -0
- package/dist/css/dates.css +4 -0
- package/dist/css/dates2.css +4 -0
- package/dist/css/dialogs.css +4 -0
- package/dist/css/edit-float.css +4 -0
- package/dist/css/edit.css +4 -0
- package/dist/css/forms-div.css +4 -0
- package/dist/css/forms-item.css +4 -0
- package/dist/css/forms.css +10 -6
- package/dist/css/full-screen.css +4 -0
- package/dist/css/global-config.css +4 -0
- package/dist/css/history.css +4 -0
- package/dist/css/icon-picker.css +4 -0
- package/dist/css/icon.css +4 -0
- package/dist/css/iframe.css +4 -0
- package/dist/css/images.css +4 -0
- package/dist/css/index.css +16 -6
- package/dist/css/input-array.css +4 -0
- package/dist/css/input-history.css +4 -0
- package/dist/css/input-num.css +4 -0
- package/dist/css/input-select.css +4 -0
- package/dist/css/inputs.css +4 -0
- package/dist/css/labels.css +4 -0
- package/dist/css/list.css +4 -0
- package/dist/css/lists.css +4 -0
- package/dist/css/listsp.css +4 -0
- package/dist/css/listspd.css +4 -0
- package/dist/css/menus.css +4 -0
- package/dist/css/no-data.css +4 -0
- package/dist/css/page.css +10 -6
- package/dist/css/paging.css +4 -0
- package/dist/css/popup.css +4 -0
- package/dist/css/retract.css +4 -0
- package/dist/css/right-key.css +4 -0
- package/dist/css/seamless-scroll.css +4 -0
- package/dist/css/select-scroll.css +4 -0
- package/dist/css/selector.css +4 -0
- package/dist/css/selects.css +4 -0
- package/dist/css/sliders.css +4 -0
- package/dist/css/switchs.css +4 -0
- package/dist/css/tables.css +4 -0
- package/dist/css/tablesp.css +4 -0
- package/dist/css/tablespd.css +4 -0
- package/dist/css/tabless.css +4 -0
- package/dist/css/tablesv.css +4 -0
- package/dist/css/tablesvp.css +10 -0
- package/dist/css/tablesvpd.css +157 -0
- package/dist/css/uploads.css +4 -0
- package/dist/css/videos.css +4 -0
- package/dist/css/window.css +4 -0
- package/dist/expand/{chunk-MC76Q3TQ.cjs → chunk-3HP2ZDNG.cjs} +3 -1
- package/dist/expand/{chunk-CV4O5V2F.js → chunk-7C25SBCF.js} +3 -1
- package/dist/expand/components.cjs +5 -5
- package/dist/expand/components.js +1 -1
- package/dist/expand/config.cjs +2 -2
- package/dist/expand/config.js +1 -1
- package/dist/hooks/compons/index.cjs +44 -0
- package/dist/hooks/compons/index.d.ts +7 -0
- package/dist/hooks/compons/index.js +44 -0
- package/dist/icons/index.json +1 -1
- package/dist/index.cjs +24 -22
- package/dist/index.css +16 -6
- package/dist/index.js +2 -0
- package/dist/type.d.ts +4 -0
- package/package.json +12 -12
- package/dist/components/common/compons.cjs +0 -76
- package/dist/components/common/compons.d.ts +0 -9
- package/dist/components/common/compons.js +0 -76
- package/dist/components/common/compons.scss +0 -26
- package/dist/components/common/compons2.scss +0 -26
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { h, resolveComponent, computed, useAttrs } from "vue";
|
|
1
|
+
import { h, resolveComponent, computed, useAttrs, isVNode, Fragment, render } from "vue";
|
|
2
|
+
import { isHTMLTag, isSVGTag } from "@vue/shared";
|
|
2
3
|
import "../../utils/index.js";
|
|
3
4
|
import { isObject } from "@fangzhongya/utils/basic/object/isObject";
|
|
4
5
|
import { getFathers, getChildrenData } from "../../utils/util.js";
|
|
@@ -225,9 +226,13 @@ function setComponString(value, obj, componObj, data, optionss, compons) {
|
|
|
225
226
|
const compon = obj.compon;
|
|
226
227
|
const tcom = lineToLargeHump(compon);
|
|
227
228
|
if (Object.keys(compons).includes(tcom)) {
|
|
228
|
-
return h(compons[tcom], componObj);
|
|
229
|
+
return h(compons[tcom], componObj, value);
|
|
229
230
|
} else {
|
|
230
|
-
|
|
231
|
+
if (isHTMLTag(compon) || isSVGTag(compon)) {
|
|
232
|
+
return h(compon, componObj, value);
|
|
233
|
+
} else {
|
|
234
|
+
return h(resolveComponent(compon), componObj);
|
|
235
|
+
}
|
|
231
236
|
}
|
|
232
237
|
}
|
|
233
238
|
function getOnObjs(obj, data, emit, ...arrs) {
|
|
@@ -298,7 +303,13 @@ function useSetCompon(obj, data, optionss, compons, emit, index, scope) {
|
|
|
298
303
|
compons
|
|
299
304
|
);
|
|
300
305
|
} else {
|
|
301
|
-
|
|
306
|
+
if (typeof obj.compon == "function") {
|
|
307
|
+
return obj.compon(componObj);
|
|
308
|
+
} else if (isVNode(obj.compon)) {
|
|
309
|
+
return obj.compon;
|
|
310
|
+
} else {
|
|
311
|
+
return h(obj.compon, componObj);
|
|
312
|
+
}
|
|
302
313
|
}
|
|
303
314
|
}
|
|
304
315
|
}
|
|
@@ -309,11 +320,36 @@ const useGetDomValue = (obj, data, options, index) => {
|
|
|
309
320
|
}
|
|
310
321
|
return value;
|
|
311
322
|
};
|
|
312
|
-
const useGetDomLabel = (label, obj, data, slots, optionss, compons, emit, index) => {
|
|
323
|
+
const useGetDomLabel = (label, obj, data, slots, optionss, compons, emit, index, isComponSelected = (obj2) => true) => {
|
|
313
324
|
if (label) {
|
|
314
|
-
if (
|
|
325
|
+
if (typeof label == "function") {
|
|
326
|
+
return label();
|
|
327
|
+
} else if (isVNode(label)) {
|
|
328
|
+
return label;
|
|
329
|
+
} else if (isObject(label)) {
|
|
315
330
|
if (isArray(label)) {
|
|
316
|
-
return
|
|
331
|
+
return h(
|
|
332
|
+
"div",
|
|
333
|
+
{
|
|
334
|
+
class: "com-lable-array"
|
|
335
|
+
},
|
|
336
|
+
label.map((v) => {
|
|
337
|
+
if (typeof v === "string") {
|
|
338
|
+
v = {
|
|
339
|
+
value: v,
|
|
340
|
+
compon: "div"
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
return useSetCompon(
|
|
344
|
+
v,
|
|
345
|
+
data,
|
|
346
|
+
optionss,
|
|
347
|
+
compons,
|
|
348
|
+
emit,
|
|
349
|
+
index
|
|
350
|
+
);
|
|
351
|
+
})
|
|
352
|
+
);
|
|
317
353
|
} else {
|
|
318
354
|
label = Object.assign({}, obj, label);
|
|
319
355
|
const slot = useSetSlot(label, data, slots, index);
|
|
@@ -321,16 +357,18 @@ const useGetDomLabel = (label, obj, data, slots, optionss, compons, emit, index)
|
|
|
321
357
|
return slot;
|
|
322
358
|
}
|
|
323
359
|
if (label.compon) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
360
|
+
if (isComponSelected(obj)) {
|
|
361
|
+
const column = useSetCompon(
|
|
362
|
+
label,
|
|
363
|
+
data,
|
|
364
|
+
optionss,
|
|
365
|
+
compons,
|
|
366
|
+
emit,
|
|
367
|
+
index
|
|
368
|
+
);
|
|
369
|
+
if (column) {
|
|
370
|
+
return column;
|
|
371
|
+
}
|
|
334
372
|
}
|
|
335
373
|
}
|
|
336
374
|
return useGetDomValue(label, data, optionss, index);
|
|
@@ -363,10 +401,43 @@ function usePropsDefault(props, keyObj) {
|
|
|
363
401
|
}
|
|
364
402
|
});
|
|
365
403
|
}
|
|
404
|
+
function useAdditional(value, add) {
|
|
405
|
+
if (typeof value === "string" && typeof add === "string") {
|
|
406
|
+
return value + add;
|
|
407
|
+
} else {
|
|
408
|
+
return h(Fragment, {}, [value, add]);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function getVNodeContent(vnode) {
|
|
412
|
+
const container = document.createElement("div");
|
|
413
|
+
render(vnode, container);
|
|
414
|
+
const textContent = container.textContent || "";
|
|
415
|
+
render(null, container);
|
|
416
|
+
return textContent;
|
|
417
|
+
}
|
|
418
|
+
function getLabelText(label) {
|
|
419
|
+
if (typeof label == "undefined") {
|
|
420
|
+
return "";
|
|
421
|
+
} else if (typeof label == "string") {
|
|
422
|
+
return label;
|
|
423
|
+
} else if (typeof label == "function") {
|
|
424
|
+
label = label();
|
|
425
|
+
}
|
|
426
|
+
if (isVNode(label)) {
|
|
427
|
+
return getVNodeContent(label);
|
|
428
|
+
} else if (label instanceof Array) {
|
|
429
|
+
return label.join("");
|
|
430
|
+
} else {
|
|
431
|
+
return (label == null ? void 0 : label.toString()) || "";
|
|
432
|
+
}
|
|
433
|
+
}
|
|
366
434
|
export {
|
|
367
435
|
getFormRule,
|
|
436
|
+
getLabelText,
|
|
368
437
|
getOnObjs,
|
|
438
|
+
getVNodeContent,
|
|
369
439
|
setFormDefaultValue,
|
|
440
|
+
useAdditional,
|
|
370
441
|
useGetDomLabel,
|
|
371
442
|
useGetDomValue,
|
|
372
443
|
useHide,
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const provides = {
|
|
4
|
-
compons: "form
|
|
4
|
+
compons: "form",
|
|
5
5
|
form: "form-form"
|
|
6
6
|
};
|
|
7
|
+
const changes = [
|
|
8
|
+
"Select",
|
|
9
|
+
"Date",
|
|
10
|
+
"Array",
|
|
11
|
+
"Check",
|
|
12
|
+
"Labels",
|
|
13
|
+
"Switch",
|
|
14
|
+
"Cascader"
|
|
15
|
+
];
|
|
16
|
+
exports.changes = changes;
|
|
7
17
|
exports.provides = provides;
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
padding: 20px 20px;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
.com-lable-array {
|
|
22
|
+
line-height: 18px;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
.forms-div {
|
|
22
26
|
width: 100%;
|
|
23
27
|
height: 100%;
|
|
@@ -106,12 +110,6 @@
|
|
|
106
110
|
font-size: 0;
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
.dates .dates-date {
|
|
110
|
-
height: 100%;
|
|
111
|
-
width: 100%;
|
|
112
|
-
box-sizing: border-box;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
113
|
.selects-select {
|
|
116
114
|
height: 100%;
|
|
117
115
|
min-width: 60px;
|
|
@@ -121,6 +119,12 @@
|
|
|
121
119
|
height: 100%;
|
|
122
120
|
}
|
|
123
121
|
|
|
122
|
+
.dates .dates-date {
|
|
123
|
+
height: 100%;
|
|
124
|
+
width: 100%;
|
|
125
|
+
box-sizing: border-box;
|
|
126
|
+
}
|
|
127
|
+
|
|
124
128
|
.inputs-input {
|
|
125
129
|
height: 100%;
|
|
126
130
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
@use '../scss/common.scss' as *;
|
|
2
2
|
@use '../forms-div/index.scss' as *;
|
|
3
3
|
@use '../forms-item/index.scss' as *;
|
|
4
|
+
@use '../forms-items/index.scss' as *;
|
|
4
5
|
|
|
5
|
-
@use '../common/compons.scss' as *;
|
|
6
|
+
@use '../common/compons/index.scss' as *;
|
|
6
7
|
|
|
7
8
|
$forms: 'forms';
|
|
8
9
|
@include b($forms) {
|
|
@@ -54,6 +54,13 @@ export declare const dataProps: {
|
|
|
54
54
|
type: ObjectConstructor;
|
|
55
55
|
default(): {};
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* @props { Boolean } isCompons=true 是否使用默认的配置
|
|
59
|
+
*/
|
|
60
|
+
isCompons: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
57
64
|
/**
|
|
58
65
|
* @props { Object } compons
|
|
59
66
|
* 外部组件集合
|
|
@@ -7,22 +7,13 @@ require("../../../utils/css.cjs");
|
|
|
7
7
|
const use = require("../../common/use.cjs");
|
|
8
8
|
require("../../../utils/index.cjs");
|
|
9
9
|
const vue = require("vue");
|
|
10
|
-
const
|
|
10
|
+
const index$1 = require("../../../hooks/compons/index.cjs");
|
|
11
11
|
const index = require("../../forms-items/index.cjs");
|
|
12
12
|
const setObjStyle = require("@fangzhongya/utils/css/setObjStyle");
|
|
13
13
|
const lineToLargeHump = require("@fangzhongya/utils/name/lineToLargeHump");
|
|
14
14
|
const Components = {
|
|
15
15
|
Items: index.FormsItems
|
|
16
16
|
};
|
|
17
|
-
const Changes = [
|
|
18
|
-
"Select",
|
|
19
|
-
"Date",
|
|
20
|
-
"Array",
|
|
21
|
-
"Check",
|
|
22
|
-
"Labels",
|
|
23
|
-
"Switch",
|
|
24
|
-
"Cascader"
|
|
25
|
-
];
|
|
26
17
|
function setUp(props, emit, cs, refForm, getLocale) {
|
|
27
18
|
const buts = vue.computed(() => {
|
|
28
19
|
if (typeof props.buts == "undefined") {
|
|
@@ -41,7 +32,7 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
41
32
|
return props.buts || [];
|
|
42
33
|
}
|
|
43
34
|
});
|
|
44
|
-
|
|
35
|
+
index$1.useCompons(config.provides.compons, props, Components);
|
|
45
36
|
vue.provide(config.provides.form, props);
|
|
46
37
|
const defaultValue = {};
|
|
47
38
|
const getDataForm = () => {
|
|
@@ -124,13 +115,14 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
124
115
|
use.setFormDefaultValue(obj, dataForm.value);
|
|
125
116
|
let trigger = 1;
|
|
126
117
|
if (typeof obj.compon == "string") {
|
|
127
|
-
if (
|
|
118
|
+
if (config.changes.includes(lineToLargeHump.lineToLargeHump(obj.compon))) {
|
|
128
119
|
trigger = 2;
|
|
129
120
|
}
|
|
130
121
|
}
|
|
131
122
|
obj.config = obj.config ?? {};
|
|
123
|
+
const labeltext = obj.labelText ?? use.getLabelText(obj.label);
|
|
132
124
|
if (((_a = obj.config) == null ? void 0 : _a.placeholder) === void 0) {
|
|
133
|
-
obj.config.placeholder = (trigger == 1 ? getLocale("form.import") : getLocale("form.select")) +
|
|
125
|
+
obj.config.placeholder = (trigger == 1 ? getLocale("form.import") : getLocale("form.select")) + labeltext;
|
|
134
126
|
}
|
|
135
127
|
if (((_b = obj.config) == null ? void 0 : _b.clearable) === void 0) {
|
|
136
128
|
obj.config.clearable = true;
|
|
@@ -142,6 +134,7 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
142
134
|
rules[p] = obj.rules;
|
|
143
135
|
} else if (obj.rule) {
|
|
144
136
|
rules[p] = util.getRule(
|
|
137
|
+
labeltext,
|
|
145
138
|
trigger,
|
|
146
139
|
obj,
|
|
147
140
|
dataForm,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataProps } from './data';
|
|
2
2
|
import { UseCssNameReturn } from '../../../hooks/cssname';
|
|
3
|
-
import {
|
|
3
|
+
import { CSSProperties, Ref, WritableComputedRef, ComputedRef } from 'vue';
|
|
4
4
|
type Emit = (...args: any[]) => void;
|
|
5
5
|
export declare function setUp(props: DataProps, emit: Emit, cs: UseCssNameReturn, refForm: any, getLocale: Function): {
|
|
6
6
|
dataRules: Ref<ObjAny, ObjAny>;
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
import { dataHandle } from "./data.js";
|
|
2
|
-
import { provides } from "../common/config.js";
|
|
2
|
+
import { provides, changes } from "../common/config.js";
|
|
3
3
|
import { getRule } from "./util.js";
|
|
4
4
|
import "../../../utils/css.js";
|
|
5
|
-
import { setFormDefaultValue, getFormRule } from "../../common/use.js";
|
|
5
|
+
import { setFormDefaultValue, getLabelText, getFormRule } from "../../common/use.js";
|
|
6
6
|
import "../../../utils/index.js";
|
|
7
7
|
import { computed, provide, isProxy, ref, watch } from "vue";
|
|
8
|
-
import { useCompons } from "
|
|
8
|
+
import { useCompons } from "../../../hooks/compons/index.js";
|
|
9
9
|
import { FormsItems } from "../../forms-items/index.js";
|
|
10
10
|
import { setObjStyle } from "@fangzhongya/utils/css/setObjStyle";
|
|
11
11
|
import { lineToLargeHump } from "@fangzhongya/utils/name/lineToLargeHump";
|
|
12
12
|
const Components = {
|
|
13
13
|
Items: FormsItems
|
|
14
14
|
};
|
|
15
|
-
const Changes = [
|
|
16
|
-
"Select",
|
|
17
|
-
"Date",
|
|
18
|
-
"Array",
|
|
19
|
-
"Check",
|
|
20
|
-
"Labels",
|
|
21
|
-
"Switch",
|
|
22
|
-
"Cascader"
|
|
23
|
-
];
|
|
24
15
|
function setUp(props, emit, cs, refForm, getLocale) {
|
|
25
16
|
const buts = computed(() => {
|
|
26
17
|
if (typeof props.buts == "undefined") {
|
|
@@ -39,7 +30,7 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
39
30
|
return props.buts || [];
|
|
40
31
|
}
|
|
41
32
|
});
|
|
42
|
-
useCompons(provides.compons,
|
|
33
|
+
useCompons(provides.compons, props, Components);
|
|
43
34
|
provide(provides.form, props);
|
|
44
35
|
const defaultValue = {};
|
|
45
36
|
const getDataForm = () => {
|
|
@@ -122,13 +113,14 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
122
113
|
setFormDefaultValue(obj, dataForm.value);
|
|
123
114
|
let trigger = 1;
|
|
124
115
|
if (typeof obj.compon == "string") {
|
|
125
|
-
if (
|
|
116
|
+
if (changes.includes(lineToLargeHump(obj.compon))) {
|
|
126
117
|
trigger = 2;
|
|
127
118
|
}
|
|
128
119
|
}
|
|
129
120
|
obj.config = obj.config ?? {};
|
|
121
|
+
const labeltext = obj.labelText ?? getLabelText(obj.label);
|
|
130
122
|
if (((_a = obj.config) == null ? void 0 : _a.placeholder) === void 0) {
|
|
131
|
-
obj.config.placeholder = (trigger == 1 ? getLocale("form.import") : getLocale("form.select")) +
|
|
123
|
+
obj.config.placeholder = (trigger == 1 ? getLocale("form.import") : getLocale("form.select")) + labeltext;
|
|
132
124
|
}
|
|
133
125
|
if (((_b = obj.config) == null ? void 0 : _b.clearable) === void 0) {
|
|
134
126
|
obj.config.clearable = true;
|
|
@@ -140,6 +132,7 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
140
132
|
rules[p] = obj.rules;
|
|
141
133
|
} else if (obj.rule) {
|
|
142
134
|
rules[p] = getRule(
|
|
135
|
+
labeltext,
|
|
143
136
|
trigger,
|
|
144
137
|
obj,
|
|
145
138
|
dataForm,
|
|
@@ -19,9 +19,8 @@ function _interopNamespaceDefault(e) {
|
|
|
19
19
|
return Object.freeze(n);
|
|
20
20
|
}
|
|
21
21
|
const judge__namespace = /* @__PURE__ */ _interopNamespaceDefault(judge);
|
|
22
|
-
function getRule(trigger, obj, data, refForm, getLocale) {
|
|
22
|
+
function getRule(name, trigger, obj, data, refForm, getLocale) {
|
|
23
23
|
var _a;
|
|
24
|
-
const name = obj.label;
|
|
25
24
|
let multiple = obj.multiple ?? ((_a = obj.config) == null ? void 0 : _a.multiple);
|
|
26
25
|
const rule = obj.rule;
|
|
27
26
|
if (typeof multiple != "boolean") {
|
|
@@ -18,5 +18,5 @@ export type Rules = {
|
|
|
18
18
|
* @param {any} refForm 表单引用
|
|
19
19
|
* @returns {{ required: boolean, validator: Function, trigger: string }}
|
|
20
20
|
*/
|
|
21
|
-
export declare function getRule(trigger: number, obj: ListObj, data: any, refForm: any, getLocale: Function): Rule;
|
|
21
|
+
export declare function getRule(name: string, trigger: number, obj: ListObj, data: any, refForm: any, getLocale: Function): Rule;
|
|
22
22
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useHide } from "../../common/use.js";
|
|
2
2
|
import * as judge from "@fangzhongya/utils/judge/judge";
|
|
3
|
-
function getRule(trigger, obj, data, refForm, getLocale) {
|
|
3
|
+
function getRule(name, trigger, obj, data, refForm, getLocale) {
|
|
4
4
|
var _a;
|
|
5
|
-
const name = obj.label;
|
|
6
5
|
let multiple = obj.multiple ?? ((_a = obj.config) == null ? void 0 : _a.multiple);
|
|
7
6
|
const rule = obj.rule;
|
|
8
7
|
if (typeof multiple != "boolean") {
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
@use '../../forms-div/style/index2.scss' as *;
|
|
6
6
|
@use '../../forms-item/style/index2.scss' as *;
|
|
7
|
-
@use '../../
|
|
7
|
+
@use '../../forms-items/style/index2.scss' as *;
|
|
8
|
+
|
|
9
|
+
@use '../../common/compons/index2.scss' as *;
|
|
8
10
|
|
|
9
11
|
@use '../index.scss' as *;
|
|
@@ -7,7 +7,7 @@ const index = require("../../../hooks/cssname/index.cjs");
|
|
|
7
7
|
const use = require("../../common/use.cjs");
|
|
8
8
|
const isEqual = require("@fangzhongya/utils/basic/object/isEqual");
|
|
9
9
|
const index$1 = require("../../../hooks/props-default/index.cjs");
|
|
10
|
-
const
|
|
10
|
+
const index$2 = require("../../../hooks/compons/index.cjs");
|
|
11
11
|
const config = require("../../forms/common/config.cjs");
|
|
12
12
|
const objValue = require("@fangzhongya/utils/basic/object/objValue");
|
|
13
13
|
const lineToLargeHump = require("@fangzhongya/utils/name/lineToLargeHump");
|
|
@@ -22,7 +22,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
22
22
|
const prs = index$1.usePropsDefault(data.name, p, data.dataProps);
|
|
23
23
|
index$1.viewProps(prs, data.name);
|
|
24
24
|
const props = prs.listobj;
|
|
25
|
-
const compons
|
|
25
|
+
const compons = index$2.useComponsGet(config.provides.compons);
|
|
26
26
|
const formvalue = vue.computed(() => {
|
|
27
27
|
const o = {};
|
|
28
28
|
if (typeof props.formvalue === "object") {
|
|
@@ -174,13 +174,19 @@ const _sfc_main = vue.defineComponent({
|
|
|
174
174
|
};
|
|
175
175
|
if (typeof compon == "string") {
|
|
176
176
|
const tcom = lineToLargeHump.lineToLargeHump(compon);
|
|
177
|
-
if (Object.keys(compons
|
|
178
|
-
return vue.h(compons
|
|
177
|
+
if (Object.keys(compons).includes(tcom)) {
|
|
178
|
+
return vue.h(compons[tcom], componObj, slots);
|
|
179
179
|
} else {
|
|
180
180
|
return vue.h(vue.resolveComponent(compon), componObj, slots);
|
|
181
181
|
}
|
|
182
182
|
} else {
|
|
183
|
-
|
|
183
|
+
if (typeof compon == "function") {
|
|
184
|
+
return compon(componObj, slots);
|
|
185
|
+
} else if (vue.isVNode(compon)) {
|
|
186
|
+
return compon;
|
|
187
|
+
} else {
|
|
188
|
+
return vue.h(compon, componObj, slots);
|
|
189
|
+
}
|
|
184
190
|
}
|
|
185
191
|
};
|
|
186
192
|
const setSslot = () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, h, resolveComponent } from "vue";
|
|
1
|
+
import { defineComponent, computed, ref, h, resolveComponent, isVNode } from "vue";
|
|
2
2
|
import { name, dataProps, dataEmits, dataExpose } from "./data.js";
|
|
3
3
|
import "../../../utils/index.js";
|
|
4
4
|
import { useCssName } from "../../../hooks/cssname/index.js";
|
|
5
5
|
import { getOnObjs } from "../../common/use.js";
|
|
6
6
|
import { isEqual } from "@fangzhongya/utils/basic/object/isEqual";
|
|
7
7
|
import { usePropsDefault, viewProps, getProps } from "../../../hooks/props-default/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useComponsGet } from "../../../hooks/compons/index.js";
|
|
9
9
|
import { provides } from "../../forms/common/config.js";
|
|
10
10
|
import { setObjValue, getObjValue } from "@fangzhongya/utils/basic/object/objValue";
|
|
11
11
|
import { lineToLargeHump } from "@fangzhongya/utils/name/lineToLargeHump";
|
|
@@ -20,7 +20,7 @@ const _sfc_main = defineComponent({
|
|
|
20
20
|
const prs = usePropsDefault(name, p, dataProps);
|
|
21
21
|
viewProps(prs, name);
|
|
22
22
|
const props = prs.listobj;
|
|
23
|
-
const compons =
|
|
23
|
+
const compons = useComponsGet(provides.compons);
|
|
24
24
|
const formvalue = computed(() => {
|
|
25
25
|
const o = {};
|
|
26
26
|
if (typeof props.formvalue === "object") {
|
|
@@ -178,7 +178,13 @@ const _sfc_main = defineComponent({
|
|
|
178
178
|
return h(resolveComponent(compon), componObj, slots);
|
|
179
179
|
}
|
|
180
180
|
} else {
|
|
181
|
-
|
|
181
|
+
if (typeof compon == "function") {
|
|
182
|
+
return compon(componObj, slots);
|
|
183
|
+
} else if (isVNode(compon)) {
|
|
184
|
+
return compon;
|
|
185
|
+
} else {
|
|
186
|
+
return h(compon, componObj, slots);
|
|
187
|
+
}
|
|
182
188
|
}
|
|
183
189
|
};
|
|
184
190
|
const setSslot = () => {
|
|
@@ -52,7 +52,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
52
52
|
}>, {
|
|
53
53
|
modelValue: Record<string, any>;
|
|
54
54
|
listobj: ListObj;
|
|
55
|
-
optionss: ObjAny;
|
|
56
55
|
hideLabel: boolean;
|
|
56
|
+
optionss: ObjAny;
|
|
57
57
|
}, {}, {}, {}, never, ComponentProvideOptions, true, {}, any>;
|
|
58
58
|
export default _default;
|