@fangzhongya/page 0.0.26 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/control/config.cjs +1 -1
- package/dist/components/control/config.js +2 -2
- package/dist/components/control/design.cjs +3 -3
- package/dist/components/control/design.d.ts +3 -1
- package/dist/components/control/design.js +3 -3
- package/dist/components/design/design-drag2.cjs +15 -7
- package/dist/components/design/design-drag2.js +16 -8
- package/dist/components/design/design-el-input.cjs +4 -0
- package/dist/components/design/design-el-input.js +4 -0
- package/dist/components/design/design-el-input2.cjs +32 -0
- package/dist/components/design/design-el-input2.js +32 -0
- package/dist/components/design/design-grids2.cjs +2 -23
- package/dist/components/design/design-grids2.js +2 -23
- package/dist/components/design/design-icon.cjs +4 -0
- package/dist/components/design/design-icon.js +4 -0
- package/dist/components/design/design-icon2.cjs +18 -0
- package/dist/components/design/design-icon2.js +18 -0
- package/dist/components/design/design-operate2.cjs +19 -28
- package/dist/components/design/design-operate2.js +19 -28
- package/dist/components/design/design-resizable2.cjs +3 -3
- package/dist/components/design/design-resizable2.js +3 -3
- package/dist/components/design/resizable.cjs +1 -1
- package/dist/components/design/resizable.css +15 -15
- package/dist/components/design/resizable.js +1 -1
- package/dist/components/design/resizable2.cjs +1 -1
- package/dist/components/design/resizable2.js +1 -1
- package/dist/components/index.css +243 -36
- package/dist/components/index2.cjs +99 -88
- package/dist/components/index2.js +107 -96
- package/dist/components/left/custom2.cjs +7 -16
- package/dist/components/left/custom2.js +8 -17
- package/dist/components/left/icons2.cjs +20 -38
- package/dist/components/left/icons2.js +20 -38
- package/dist/components/left/mould2.cjs +20 -27
- package/dist/components/left/mould2.js +23 -30
- package/dist/components/left/search2.cjs +7 -18
- package/dist/components/left/search2.js +7 -18
- package/dist/components/operate/index2.cjs +6 -10
- package/dist/components/operate/index2.js +6 -10
- package/dist/components/operate/right-key.cjs +4 -0
- package/dist/components/operate/right-key.js +4 -0
- package/dist/components/operate/right-key2.cjs +111 -0
- package/dist/components/operate/right-key2.js +111 -0
- package/dist/components/operate/right2.cjs +16 -194
- package/dist/components/operate/right2.js +17 -195
- package/dist/components/operate/util.cjs +202 -0
- package/dist/components/operate/util.d.ts +6 -0
- package/dist/components/operate/util.js +202 -0
- package/dist/components/output/vue/index.cjs +10 -7
- package/dist/components/output/vue/index.d.ts +5 -1
- package/dist/components/output/vue/index.js +10 -7
- package/dist/components/props.d.ts +20 -0
- package/dist/components/right/currency/index.cjs +1 -1
- package/dist/components/right/currency/index.js +1 -1
- package/dist/components/right/currency/style2.cjs +23 -45
- package/dist/components/right/currency/style2.js +23 -45
- package/dist/components/tree/tree-drag2.cjs +2 -2
- package/dist/components/tree/tree-drag2.js +2 -2
- package/dist/config/util.cjs +2 -0
- package/dist/config/util.js +3 -1
- package/dist/design/design.cjs +0 -10
- package/dist/design/design.js +0 -10
- package/dist/design/render2.cjs +1 -2
- package/dist/design/render2.js +1 -2
- package/dist/design/util.cjs +45 -0
- package/dist/design/util.d.ts +4 -0
- package/dist/design/util.js +46 -1
- package/dist/effect/design.cjs +336 -0
- package/dist/effect/design.d.ts +11 -0
- package/dist/effect/design.js +336 -0
- package/dist/effect/draggable.cjs +191 -0
- package/dist/effect/draggable.d.ts +6 -0
- package/dist/effect/draggable.js +191 -0
- package/dist/effect/effect.cjs +54 -0
- package/dist/effect/effect.d.ts +7 -0
- package/dist/effect/effect.js +54 -0
- package/dist/effect/index.cjs +4 -0
- package/dist/effect/index.js +4 -0
- package/dist/effect/index2.cjs +40 -0
- package/dist/effect/index2.js +40 -0
- package/dist/expand/{chunk-ZJCFZ63F.cjs → chunk-IRHQSEMT.cjs} +1 -1
- package/dist/expand/{chunk-I2RMOBDW.js → chunk-ZPHCUID5.js} +1 -1
- package/dist/expand/components.cjs +4 -4
- package/dist/expand/components.js +2 -2
- package/dist/expand/config.cjs +2 -2
- package/dist/expand/config.js +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/render/common.cjs +26 -26
- package/dist/render/common.d.ts +5 -5
- package/dist/render/common.js +26 -26
- package/dist/render/render.cjs +8 -4
- package/dist/render/render.js +10 -6
- package/dist/utils/index.cjs +0 -5
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -5
- package/dist/viewer/design.cjs +76 -0
- package/dist/viewer/design.d.ts +5 -0
- package/dist/viewer/design.js +76 -0
- package/dist/viewer/draggable.cjs +87 -0
- package/dist/viewer/draggable.d.ts +3 -0
- package/dist/viewer/draggable.js +87 -0
- package/dist/viewer/index.cjs +4 -0
- package/dist/viewer/index.js +4 -0
- package/dist/viewer/index2.cjs +40 -0
- package/dist/viewer/index2.js +40 -0
- package/dist/viewer/viewer.cjs +54 -0
- package/dist/viewer/viewer.d.ts +7 -0
- package/dist/viewer/viewer.js +54 -0
- package/package.json +8 -7
- package/dist/components/editor/button-editor.cjs +0 -4
- package/dist/components/editor/button-editor.js +0 -4
- package/dist/components/editor/button-editor2.cjs +0 -131
- package/dist/components/editor/button-editor2.js +0 -131
- package/dist/components/editor/editor.cjs +0 -4
- package/dist/components/editor/editor.js +0 -4
- package/dist/components/editor/editor2.cjs +0 -233
- package/dist/components/editor/editor2.js +0 -233
- package/dist/components/right/currency/editor.cjs +0 -4
- package/dist/components/right/currency/editor.js +0 -4
- package/dist/components/right/currency/editor2.cjs +0 -64
- package/dist/components/right/currency/editor2.js +0 -64
- package/dist/components/right/currency/emits.cjs +0 -4
- package/dist/components/right/currency/emits.js +0 -4
- package/dist/components/right/currency/emits2.cjs +0 -83
- package/dist/components/right/currency/emits2.js +0 -83
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,7 @@ require("./components/index.cjs");
|
|
|
5
5
|
const index$1 = require("./components/output/vue/index.cjs");
|
|
6
6
|
const util = require("./render/util.cjs");
|
|
7
7
|
const index = require("./assemblys/index.cjs");
|
|
8
|
+
const util$1 = require("./design/util.cjs");
|
|
8
9
|
require("./page.cjs");
|
|
9
10
|
const index_vue_vue_type_script_setup_true_lang = require("./components/index2.cjs");
|
|
10
11
|
const render = require("./render/render.cjs");
|
|
@@ -22,6 +23,7 @@ exports.generVue = index$1.generVue;
|
|
|
22
23
|
exports.getDesignMinStr = util.getDesignMinStr;
|
|
23
24
|
exports.getStrValue = util.getStrValue;
|
|
24
25
|
exports.assemblys = index.default;
|
|
26
|
+
exports.getUuidControl = util$1.getUuidControl;
|
|
25
27
|
exports.createRender = render.createRender;
|
|
26
28
|
exports.getComponentNames = render$1.getComponentNames;
|
|
27
29
|
exports.FangPageSet = FangPageSet;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { Plugin } from 'vue';
|
|
|
2
2
|
import { generVue } from './components/output/vue/index';
|
|
3
3
|
import { getDesignMinStr } from './render/util';
|
|
4
4
|
import { default as assemblys } from './assemblys/index';
|
|
5
|
+
import { getUuidControl } from './design/util';
|
|
5
6
|
export * from './page';
|
|
6
7
|
declare const FangPageSet: any;
|
|
7
8
|
export declare const install: Plugin;
|
|
8
|
-
export { FangPageSet, assemblys, generVue, getDesignMinStr };
|
|
9
|
+
export { FangPageSet, assemblys, getUuidControl, generVue, getDesignMinStr };
|
|
9
10
|
export default FangPageSet;
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import "./components/index.js";
|
|
|
3
3
|
import { generVue } from "./components/output/vue/index.js";
|
|
4
4
|
import { getDesignMinStr, getStrValue } from "./render/util.js";
|
|
5
5
|
import assemblys from "./assemblys/index.js";
|
|
6
|
+
import { getUuidControl } from "./design/util.js";
|
|
6
7
|
import "./page.js";
|
|
7
8
|
import _sfc_main from "./components/index2.js";
|
|
8
9
|
import { createRender } from "./render/render.js";
|
|
@@ -25,5 +26,6 @@ export {
|
|
|
25
26
|
getComponentNames,
|
|
26
27
|
getDesignMinStr,
|
|
27
28
|
getStrValue,
|
|
29
|
+
getUuidControl,
|
|
28
30
|
install
|
|
29
31
|
};
|
package/dist/render/common.cjs
CHANGED
|
@@ -7,17 +7,16 @@ const humpToLine = require("@fangzhongya/utils/name/humpToLine");
|
|
|
7
7
|
const isObject = require("@fangzhongya/utils/basic/object/isObject");
|
|
8
8
|
const render = require("../utils/render.cjs");
|
|
9
9
|
const config = require("./config.cjs");
|
|
10
|
-
function
|
|
11
|
-
const slots = obj.slots;
|
|
10
|
+
function getSlots(slots) {
|
|
12
11
|
if (vue.isVNode(slots)) {
|
|
13
12
|
return {
|
|
14
|
-
default: () => slots
|
|
13
|
+
default: () => [slots]
|
|
15
14
|
};
|
|
16
15
|
} else if (typeof slots === "function") {
|
|
17
16
|
return {
|
|
18
17
|
default: slots
|
|
19
18
|
};
|
|
20
|
-
} else if (isObject.isObject(slots)) {
|
|
19
|
+
} else if (slots && isObject.isObject(slots) && !Array.isArray(slots)) {
|
|
21
20
|
return slots;
|
|
22
21
|
} else if (!isEmpty(slots)) {
|
|
23
22
|
return {
|
|
@@ -25,32 +24,33 @@ function setSlots(obj) {
|
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
|
-
function
|
|
27
|
+
function getComponString(name, attarObj, obj = {}, compons = {}) {
|
|
29
28
|
if (name === "Template") {
|
|
30
|
-
return vue.h(vue.Fragment, null,
|
|
29
|
+
return vue.h(vue.Fragment, null, getSlots(obj.slots)?.default?.());
|
|
31
30
|
}
|
|
32
31
|
compons = vue.inject("components", compons);
|
|
33
32
|
const tcom = humpToLine.humpToLine(name);
|
|
34
33
|
const cms = Object.keys(compons);
|
|
35
34
|
if (cms.includes(name)) {
|
|
36
|
-
return vue.h(compons[name], attarObj,
|
|
35
|
+
return vue.h(compons[name], attarObj, getSlots(obj.slots));
|
|
37
36
|
} else if (cms.includes(tcom)) {
|
|
38
|
-
return vue.h(compons[tcom], attarObj,
|
|
37
|
+
return vue.h(compons[tcom], attarObj, getSlots(obj.slots));
|
|
39
38
|
}
|
|
40
39
|
if (shared.isHTMLTag(tcom) || shared.isSVGTag(tcom)) {
|
|
41
|
-
return vue.h(tcom, attarObj,
|
|
40
|
+
return vue.h(tcom, attarObj, getSlots(obj.slots)?.default?.());
|
|
42
41
|
}
|
|
43
|
-
|
|
42
|
+
const vh = vue.resolveComponent(name);
|
|
43
|
+
return vue.h(vh, attarObj, getSlots(obj.slots));
|
|
44
44
|
}
|
|
45
45
|
function useGetCompon(name, attarObj, obj = {}, compons) {
|
|
46
46
|
if (typeof name == "string") {
|
|
47
|
-
return
|
|
47
|
+
return getComponString(name, attarObj, obj, compons);
|
|
48
48
|
} else if (typeof name == "function") {
|
|
49
|
-
return name(attarObj,
|
|
49
|
+
return name(attarObj, getSlots(obj.slots));
|
|
50
50
|
} else if (vue.isVNode(name)) {
|
|
51
51
|
return name;
|
|
52
52
|
} else {
|
|
53
|
-
return vue.h(name, attarObj,
|
|
53
|
+
return vue.h(name, attarObj, getSlots(obj.slots));
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
function getSlotsArray(obj, key = "default") {
|
|
@@ -62,7 +62,7 @@ function isEmpty(v) {
|
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function getSlotsDom(obj, callback) {
|
|
66
66
|
const slots = obj.slots || {};
|
|
67
67
|
const cs = obj.config?.scope;
|
|
68
68
|
if (Array.isArray(slots)) {
|
|
@@ -87,7 +87,7 @@ function getSlots(obj, callback) {
|
|
|
87
87
|
});
|
|
88
88
|
} else {
|
|
89
89
|
if (!isEmpty(slot)) {
|
|
90
|
-
objs[key] =
|
|
90
|
+
objs[key] = getSlots(slot)?.default;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -139,7 +139,7 @@ function getCompon(obj, config$1, params, temps) {
|
|
|
139
139
|
if (slots) {
|
|
140
140
|
return vue.h(vue.Fragment, slots(config$1));
|
|
141
141
|
} else {
|
|
142
|
-
return
|
|
142
|
+
return getRender(
|
|
143
143
|
{
|
|
144
144
|
name: "Template",
|
|
145
145
|
slots: obj.slots
|
|
@@ -149,7 +149,7 @@ function getCompon(obj, config$1, params, temps) {
|
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
} else if (name === "Component") {
|
|
152
|
-
return
|
|
152
|
+
return getRender(
|
|
153
153
|
{
|
|
154
154
|
name: config$1.is,
|
|
155
155
|
slots: obj.slots,
|
|
@@ -188,7 +188,7 @@ function getCompon(obj, config$1, params, temps) {
|
|
|
188
188
|
}
|
|
189
189
|
];
|
|
190
190
|
const ts = getTempsArr(temps, vfors, "forin");
|
|
191
|
-
return
|
|
191
|
+
return getRender(
|
|
192
192
|
{
|
|
193
193
|
name: "Template",
|
|
194
194
|
slots: obj.slots
|
|
@@ -213,7 +213,7 @@ function getCompon(obj, config$1, params, temps) {
|
|
|
213
213
|
}
|
|
214
214
|
];
|
|
215
215
|
const ts = getTempsArr(temps, vfors, "forof");
|
|
216
|
-
return
|
|
216
|
+
return getRender(
|
|
217
217
|
{
|
|
218
218
|
name: "Template",
|
|
219
219
|
slots: obj.slots
|
|
@@ -250,7 +250,7 @@ function getCompon(obj, config$1, params, temps) {
|
|
|
250
250
|
const slots = [];
|
|
251
251
|
if (vc) {
|
|
252
252
|
getSlotsArray(vc).forEach((v) => {
|
|
253
|
-
slots.push(
|
|
253
|
+
slots.push(getRender(v, params, temps));
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
return vue.h(vue.Fragment, null, slots);
|
|
@@ -263,12 +263,12 @@ function getData(obj, params = {}, temps, config$1 = {}) {
|
|
|
263
263
|
config.getAttrs(obj, config$1);
|
|
264
264
|
config.getProps(obj, config$1, params, temps);
|
|
265
265
|
config.getEmits(obj, config$1, params, temps);
|
|
266
|
-
config$1[render.getClassId(params.name)] = "";
|
|
267
266
|
}
|
|
268
267
|
function assemblyGetRender(obj, params = {}, temps, getSlots2, setCompon) {
|
|
269
268
|
if (obj) {
|
|
270
269
|
const config2 = {};
|
|
271
270
|
getData(obj, params, temps, config2);
|
|
271
|
+
config2[render.getClassId(params.name)] = "";
|
|
272
272
|
const rc = getCompon(obj, config2, params, temps);
|
|
273
273
|
if (rc !== void 0) {
|
|
274
274
|
return rc;
|
|
@@ -279,13 +279,13 @@ function assemblyGetRender(obj, params = {}, temps, getSlots2, setCompon) {
|
|
|
279
279
|
return "";
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function getRender(obj, params = {}, temps) {
|
|
283
283
|
return assemblyGetRender(
|
|
284
284
|
obj,
|
|
285
285
|
params,
|
|
286
286
|
temps,
|
|
287
287
|
(config2) => {
|
|
288
|
-
return
|
|
288
|
+
return getSlotsDom(
|
|
289
289
|
obj,
|
|
290
290
|
(slots, key, scope) => {
|
|
291
291
|
const ts = getTempsArr(temps, [scope]);
|
|
@@ -293,7 +293,7 @@ function setRender(obj, params = {}, temps) {
|
|
|
293
293
|
vue.Fragment,
|
|
294
294
|
null,
|
|
295
295
|
slots.map((v) => {
|
|
296
|
-
return
|
|
296
|
+
return getRender(v, params, ts);
|
|
297
297
|
})
|
|
298
298
|
);
|
|
299
299
|
}
|
|
@@ -312,10 +312,10 @@ function setRender(obj, params = {}, temps) {
|
|
|
312
312
|
}
|
|
313
313
|
exports.assemblyGetRender = assemblyGetRender;
|
|
314
314
|
exports.getData = getData;
|
|
315
|
+
exports.getRender = getRender;
|
|
315
316
|
exports.getSlots = getSlots;
|
|
316
317
|
exports.getSlotsArray = getSlotsArray;
|
|
318
|
+
exports.getSlotsDom = getSlotsDom;
|
|
317
319
|
exports.getTempsArr = getTempsArr;
|
|
318
320
|
exports.isEmpty = isEmpty;
|
|
319
|
-
exports.setRender = setRender;
|
|
320
|
-
exports.setSlots = setSlots;
|
|
321
321
|
exports.useGetCompon = useGetCompon;
|
package/dist/render/common.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { VNode } from 'vue';
|
|
1
|
+
import { VNode, Slots } from 'vue';
|
|
2
2
|
/**
|
|
3
3
|
* 设置插槽配置
|
|
4
4
|
* @param obj - 包含slots属性的ListObj对象
|
|
5
5
|
* @returns 返回标准化的插槽配置对象
|
|
6
6
|
*/
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function useGetCompon(name: any, attarObj: ObjAny, obj?: ObjAny, compons?: ObjAny):
|
|
7
|
+
export declare function getSlots(slots: any): Slots | undefined;
|
|
8
|
+
export declare function useGetCompon(name: any, attarObj: ObjAny, obj?: ObjAny, compons?: ObjAny): VNode | string;
|
|
9
9
|
export declare function getSlotsArray(obj: ControlRender, key?: string): ControlRender[];
|
|
10
10
|
export declare function isEmpty(v: any): true | undefined;
|
|
11
11
|
/**
|
|
@@ -14,7 +14,7 @@ export declare function isEmpty(v: any): true | undefined;
|
|
|
14
14
|
* @param is
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function getSlotsDom(obj: ControlRender, callback: (slots: ControlRender[], key: string, obj: TempsObjectKey) => void): {
|
|
18
18
|
[key: string]: any;
|
|
19
19
|
};
|
|
20
20
|
export declare function getTempsArr(temps: Array<TempsObject>, value: TempsObjectKey[], type?: string): TempsObject[];
|
|
@@ -30,4 +30,4 @@ export declare function assemblyGetRender(obj: ControlRender, params: ObjAny | u
|
|
|
30
30
|
* @param obj 数据对象
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function getRender(obj: ControlRender, params: ObjAny | undefined, temps: Array<TempsObject>): VNode | string;
|
package/dist/render/common.js
CHANGED
|
@@ -5,17 +5,16 @@ import { humpToLine } from "@fangzhongya/utils/name/humpToLine";
|
|
|
5
5
|
import { isObject } from "@fangzhongya/utils/basic/object/isObject";
|
|
6
6
|
import { getRenderSlots, getClassId } from "../utils/render.js";
|
|
7
7
|
import { getScopeObject, getForObject, getPropsValue, getConfig, getRefDom, getDirectives, getAttrs, getProps, getEmits } from "./config.js";
|
|
8
|
-
function
|
|
9
|
-
const slots = obj.slots;
|
|
8
|
+
function getSlots(slots) {
|
|
10
9
|
if (isVNode(slots)) {
|
|
11
10
|
return {
|
|
12
|
-
default: () => slots
|
|
11
|
+
default: () => [slots]
|
|
13
12
|
};
|
|
14
13
|
} else if (typeof slots === "function") {
|
|
15
14
|
return {
|
|
16
15
|
default: slots
|
|
17
16
|
};
|
|
18
|
-
} else if (isObject(slots)) {
|
|
17
|
+
} else if (slots && isObject(slots) && !Array.isArray(slots)) {
|
|
19
18
|
return slots;
|
|
20
19
|
} else if (!isEmpty(slots)) {
|
|
21
20
|
return {
|
|
@@ -23,32 +22,33 @@ function setSlots(obj) {
|
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
function
|
|
25
|
+
function getComponString(name, attarObj, obj = {}, compons = {}) {
|
|
27
26
|
if (name === "Template") {
|
|
28
|
-
return h(Fragment, null,
|
|
27
|
+
return h(Fragment, null, getSlots(obj.slots)?.default?.());
|
|
29
28
|
}
|
|
30
29
|
compons = inject("components", compons);
|
|
31
30
|
const tcom = humpToLine(name);
|
|
32
31
|
const cms = Object.keys(compons);
|
|
33
32
|
if (cms.includes(name)) {
|
|
34
|
-
return h(compons[name], attarObj,
|
|
33
|
+
return h(compons[name], attarObj, getSlots(obj.slots));
|
|
35
34
|
} else if (cms.includes(tcom)) {
|
|
36
|
-
return h(compons[tcom], attarObj,
|
|
35
|
+
return h(compons[tcom], attarObj, getSlots(obj.slots));
|
|
37
36
|
}
|
|
38
37
|
if (isHTMLTag(tcom) || isSVGTag(tcom)) {
|
|
39
|
-
return h(tcom, attarObj,
|
|
38
|
+
return h(tcom, attarObj, getSlots(obj.slots)?.default?.());
|
|
40
39
|
}
|
|
41
|
-
|
|
40
|
+
const vh = resolveComponent(name);
|
|
41
|
+
return h(vh, attarObj, getSlots(obj.slots));
|
|
42
42
|
}
|
|
43
43
|
function useGetCompon(name, attarObj, obj = {}, compons) {
|
|
44
44
|
if (typeof name == "string") {
|
|
45
|
-
return
|
|
45
|
+
return getComponString(name, attarObj, obj, compons);
|
|
46
46
|
} else if (typeof name == "function") {
|
|
47
|
-
return name(attarObj,
|
|
47
|
+
return name(attarObj, getSlots(obj.slots));
|
|
48
48
|
} else if (isVNode(name)) {
|
|
49
49
|
return name;
|
|
50
50
|
} else {
|
|
51
|
-
return h(name, attarObj,
|
|
51
|
+
return h(name, attarObj, getSlots(obj.slots));
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
function getSlotsArray(obj, key = "default") {
|
|
@@ -60,7 +60,7 @@ function isEmpty(v) {
|
|
|
60
60
|
return true;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function getSlotsDom(obj, callback) {
|
|
64
64
|
const slots = obj.slots || {};
|
|
65
65
|
const cs = obj.config?.scope;
|
|
66
66
|
if (Array.isArray(slots)) {
|
|
@@ -85,7 +85,7 @@ function getSlots(obj, callback) {
|
|
|
85
85
|
});
|
|
86
86
|
} else {
|
|
87
87
|
if (!isEmpty(slot)) {
|
|
88
|
-
objs[key] =
|
|
88
|
+
objs[key] = getSlots(slot)?.default;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -137,7 +137,7 @@ function getCompon(obj, config, params, temps) {
|
|
|
137
137
|
if (slots) {
|
|
138
138
|
return h(Fragment, slots(config));
|
|
139
139
|
} else {
|
|
140
|
-
return
|
|
140
|
+
return getRender(
|
|
141
141
|
{
|
|
142
142
|
name: "Template",
|
|
143
143
|
slots: obj.slots
|
|
@@ -147,7 +147,7 @@ function getCompon(obj, config, params, temps) {
|
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
} else if (name === "Component") {
|
|
150
|
-
return
|
|
150
|
+
return getRender(
|
|
151
151
|
{
|
|
152
152
|
name: config.is,
|
|
153
153
|
slots: obj.slots,
|
|
@@ -186,7 +186,7 @@ function getCompon(obj, config, params, temps) {
|
|
|
186
186
|
}
|
|
187
187
|
];
|
|
188
188
|
const ts = getTempsArr(temps, vfors, "forin");
|
|
189
|
-
return
|
|
189
|
+
return getRender(
|
|
190
190
|
{
|
|
191
191
|
name: "Template",
|
|
192
192
|
slots: obj.slots
|
|
@@ -211,7 +211,7 @@ function getCompon(obj, config, params, temps) {
|
|
|
211
211
|
}
|
|
212
212
|
];
|
|
213
213
|
const ts = getTempsArr(temps, vfors, "forof");
|
|
214
|
-
return
|
|
214
|
+
return getRender(
|
|
215
215
|
{
|
|
216
216
|
name: "Template",
|
|
217
217
|
slots: obj.slots
|
|
@@ -248,7 +248,7 @@ function getCompon(obj, config, params, temps) {
|
|
|
248
248
|
const slots = [];
|
|
249
249
|
if (vc) {
|
|
250
250
|
getSlotsArray(vc).forEach((v) => {
|
|
251
|
-
slots.push(
|
|
251
|
+
slots.push(getRender(v, params, temps));
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
return h(Fragment, null, slots);
|
|
@@ -261,12 +261,12 @@ function getData(obj, params = {}, temps, config = {}) {
|
|
|
261
261
|
getAttrs(obj, config);
|
|
262
262
|
getProps(obj, config, params, temps);
|
|
263
263
|
getEmits(obj, config, params, temps);
|
|
264
|
-
config[getClassId(params.name)] = "";
|
|
265
264
|
}
|
|
266
265
|
function assemblyGetRender(obj, params = {}, temps, getSlots2, setCompon) {
|
|
267
266
|
if (obj) {
|
|
268
267
|
const config = {};
|
|
269
268
|
getData(obj, params, temps, config);
|
|
269
|
+
config[getClassId(params.name)] = "";
|
|
270
270
|
const rc = getCompon(obj, config, params, temps);
|
|
271
271
|
if (rc !== void 0) {
|
|
272
272
|
return rc;
|
|
@@ -277,13 +277,13 @@ function assemblyGetRender(obj, params = {}, temps, getSlots2, setCompon) {
|
|
|
277
277
|
return "";
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function getRender(obj, params = {}, temps) {
|
|
281
281
|
return assemblyGetRender(
|
|
282
282
|
obj,
|
|
283
283
|
params,
|
|
284
284
|
temps,
|
|
285
285
|
(config) => {
|
|
286
|
-
return
|
|
286
|
+
return getSlotsDom(
|
|
287
287
|
obj,
|
|
288
288
|
(slots, key, scope) => {
|
|
289
289
|
const ts = getTempsArr(temps, [scope]);
|
|
@@ -291,7 +291,7 @@ function setRender(obj, params = {}, temps) {
|
|
|
291
291
|
Fragment,
|
|
292
292
|
null,
|
|
293
293
|
slots.map((v) => {
|
|
294
|
-
return
|
|
294
|
+
return getRender(v, params, ts);
|
|
295
295
|
})
|
|
296
296
|
);
|
|
297
297
|
}
|
|
@@ -311,11 +311,11 @@ function setRender(obj, params = {}, temps) {
|
|
|
311
311
|
export {
|
|
312
312
|
assemblyGetRender,
|
|
313
313
|
getData,
|
|
314
|
+
getRender,
|
|
314
315
|
getSlots,
|
|
315
316
|
getSlotsArray,
|
|
317
|
+
getSlotsDom,
|
|
316
318
|
getTempsArr,
|
|
317
319
|
isEmpty,
|
|
318
|
-
setRender,
|
|
319
|
-
setSlots,
|
|
320
320
|
useGetCompon
|
|
321
321
|
};
|
package/dist/render/render.cjs
CHANGED
|
@@ -5,11 +5,11 @@ const common = require("./common.cjs");
|
|
|
5
5
|
const config = require("./config.cjs");
|
|
6
6
|
const render = require("../utils/render.cjs");
|
|
7
7
|
const lineToLargeHump = require("@fangzhongya/utils/name/lineToLargeHump");
|
|
8
|
-
function
|
|
8
|
+
function getRenders(params = {}, arrs, temps) {
|
|
9
9
|
if (arrs) {
|
|
10
10
|
return vue.h(vue.Fragment, null, [
|
|
11
11
|
arrs.map((v) => {
|
|
12
|
-
return common.
|
|
12
|
+
return common.getRender(v, params, temps);
|
|
13
13
|
})
|
|
14
14
|
]);
|
|
15
15
|
} else {
|
|
@@ -57,12 +57,11 @@ function createRender(obj, imports = {}, callback = (id) => id, components = {})
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
vue.onUnmounted(() => {
|
|
60
|
-
render.unStyle(name);
|
|
61
60
|
if (obj.config?.unmounted) {
|
|
62
61
|
config.runCodeBlock(obj.config.unmounted, params);
|
|
63
62
|
}
|
|
64
63
|
});
|
|
65
|
-
return () =>
|
|
64
|
+
return () => getRenders(params, obj.list, temps);
|
|
66
65
|
}
|
|
67
66
|
});
|
|
68
67
|
}
|
|
@@ -95,6 +94,11 @@ function getComponents(obj, callback, components = {}) {
|
|
|
95
94
|
const names = render.getComponentNames(obj);
|
|
96
95
|
for (const key of names) {
|
|
97
96
|
if (!rcs[key]) {
|
|
97
|
+
const globalComponent = vue.resolveComponent(key);
|
|
98
|
+
if (typeof globalComponent !== "string" && globalComponent) {
|
|
99
|
+
rcs[key] = globalComponent;
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
98
102
|
rcs[key] = getAsyncComponent(async () => {
|
|
99
103
|
const value = await Promise.resolve(callback(key));
|
|
100
104
|
if (typeof value === "string") {
|
package/dist/render/render.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { h, Fragment, defineComponent, provide, reactive, onMounted, onActivated, onDeactivated, onUnmounted, defineAsyncComponent, resolveComponent } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { getRender } from "./common.js";
|
|
3
3
|
import { getObjProps, setCodes, runCodeBlock } from "./config.js";
|
|
4
|
-
import { setStyle,
|
|
4
|
+
import { setStyle, getComponentNames, isRenderCompon } from "../utils/render.js";
|
|
5
5
|
import { lineToLargeHump } from "@fangzhongya/utils/name/lineToLargeHump";
|
|
6
|
-
function
|
|
6
|
+
function getRenders(params = {}, arrs, temps) {
|
|
7
7
|
if (arrs) {
|
|
8
8
|
return h(Fragment, null, [
|
|
9
9
|
arrs.map((v) => {
|
|
10
|
-
return
|
|
10
|
+
return getRender(v, params, temps);
|
|
11
11
|
})
|
|
12
12
|
]);
|
|
13
13
|
} else {
|
|
@@ -55,12 +55,11 @@ function createRender(obj, imports = {}, callback = (id) => id, components = {})
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
onUnmounted(() => {
|
|
58
|
-
unStyle(name);
|
|
59
58
|
if (obj.config?.unmounted) {
|
|
60
59
|
runCodeBlock(obj.config.unmounted, params);
|
|
61
60
|
}
|
|
62
61
|
});
|
|
63
|
-
return () =>
|
|
62
|
+
return () => getRenders(params, obj.list, temps);
|
|
64
63
|
}
|
|
65
64
|
});
|
|
66
65
|
}
|
|
@@ -93,6 +92,11 @@ function getComponents(obj, callback, components = {}) {
|
|
|
93
92
|
const names = getComponentNames(obj);
|
|
94
93
|
for (const key of names) {
|
|
95
94
|
if (!rcs[key]) {
|
|
95
|
+
const globalComponent = resolveComponent(key);
|
|
96
|
+
if (typeof globalComponent !== "string" && globalComponent) {
|
|
97
|
+
rcs[key] = globalComponent;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
96
100
|
rcs[key] = getAsyncComponent(async () => {
|
|
97
101
|
const value = await Promise.resolve(callback(key));
|
|
98
102
|
if (typeof value === "string") {
|
package/dist/utils/index.cjs
CHANGED
|
@@ -79,12 +79,7 @@ function extractCssClass(formCssCode) {
|
|
|
79
79
|
}
|
|
80
80
|
return [...new Set(cssNameArray)];
|
|
81
81
|
}
|
|
82
|
-
let r = 1;
|
|
83
|
-
function getRandom() {
|
|
84
|
-
return r++;
|
|
85
|
-
}
|
|
86
82
|
exports.extractCssClass = extractCssClass;
|
|
87
83
|
exports.getClass = getClass;
|
|
88
84
|
exports.getClassName = getClassName;
|
|
89
|
-
exports.getRandom = getRandom;
|
|
90
85
|
exports.setCssSize = setCssSize;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const common = require("../render/common.cjs");
|
|
5
|
+
const draggable = require("./draggable.cjs");
|
|
6
|
+
function setCons(config, drag, obj) {
|
|
7
|
+
let c = config.class || "";
|
|
8
|
+
if (Array.isArray(c)) {
|
|
9
|
+
c = c.join(" ");
|
|
10
|
+
}
|
|
11
|
+
config.class = c + " " + drag.class?.join(" ");
|
|
12
|
+
config.onClick = drag.onClick;
|
|
13
|
+
config.onContextmenu = drag.onContextmenu;
|
|
14
|
+
}
|
|
15
|
+
function getSlotsViewerDom(obj, params = {}, temps, cons = {}) {
|
|
16
|
+
return (config) => {
|
|
17
|
+
setCons(config, cons, obj);
|
|
18
|
+
return common.getSlotsDom(obj, (slots, key, scope) => {
|
|
19
|
+
const ts = common.getTempsArr(temps, [scope]);
|
|
20
|
+
return draggable.getDraggableDiv(
|
|
21
|
+
slots,
|
|
22
|
+
obj,
|
|
23
|
+
params,
|
|
24
|
+
(v, p, c) => {
|
|
25
|
+
return setDesign(v, p, ts, c);
|
|
26
|
+
},
|
|
27
|
+
key
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function setCompon(cons) {
|
|
33
|
+
return (obj, config, slots) => {
|
|
34
|
+
setCons(config, cons, obj);
|
|
35
|
+
let name = obj.name;
|
|
36
|
+
if (name === "PageHtml") {
|
|
37
|
+
name = obj.config?.type || "div";
|
|
38
|
+
}
|
|
39
|
+
return common.useGetCompon(name, config, {
|
|
40
|
+
slots
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function setDesign(obj, params = {}, temps, cons = {}) {
|
|
45
|
+
if (!obj.design?.hide) {
|
|
46
|
+
obj.temps = [...temps];
|
|
47
|
+
return common.assemblyGetRender(
|
|
48
|
+
obj,
|
|
49
|
+
params,
|
|
50
|
+
temps,
|
|
51
|
+
getSlotsViewerDom(obj, params, temps, cons),
|
|
52
|
+
setCompon(cons)
|
|
53
|
+
);
|
|
54
|
+
} else {
|
|
55
|
+
return "";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function setDesignDag(arr, props, params = {}, temps) {
|
|
59
|
+
return draggable.getDraggableDiv(
|
|
60
|
+
arr,
|
|
61
|
+
props,
|
|
62
|
+
params,
|
|
63
|
+
(v, p, c) => {
|
|
64
|
+
return setDesign(v, params, temps, c);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function getRender(params = {}, lists, temps) {
|
|
69
|
+
if (lists) {
|
|
70
|
+
return setDesignDag(lists, {}, params, temps);
|
|
71
|
+
} else {
|
|
72
|
+
return vue.h("div", params.attrs, params.slots);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.getRender = getRender;
|
|
76
|
+
exports.setDesign = setDesign;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
export declare function setDesign(obj: ControlDesign, params: ObjAny | undefined, temps: Array<TempsObject>, cons?: ObjAny): VNode | string;
|
|
3
|
+
export declare function getRender(params: ObjAny | undefined, lists: Array<ControlDesign> | undefined, temps: Array<TempsObject>): string | VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}>;
|