render-core 1.0.130 → 1.2.0
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/class/component/component.d.ts +3 -0
- package/class/component/component.js +10 -0
- package/class/tips/componentTip.d.ts +1 -0
- package/core/lifecycle/mount.d.ts +5 -0
- package/core/lifecycle/mount.js +10 -0
- package/core/render/PostRender.js +4 -1
- package/core/render/initRender.js +4 -1
- package/core/render/rawRender.js +4 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ import { RenderBase } from "../tips/componentTip";
|
|
|
5
5
|
export declare class Component implements RenderBase {
|
|
6
6
|
private readonly name;
|
|
7
7
|
private readonly template;
|
|
8
|
+
private readonly mode;
|
|
8
9
|
private readonly boxStyle?;
|
|
9
10
|
private readonly props?;
|
|
10
11
|
private readonly data?;
|
|
@@ -16,6 +17,7 @@ export declare class Component implements RenderBase {
|
|
|
16
17
|
constructor(config: {
|
|
17
18
|
name: string;
|
|
18
19
|
template: string;
|
|
20
|
+
mode?: string;
|
|
19
21
|
boxStyle?: string;
|
|
20
22
|
props?: {} | string[];
|
|
21
23
|
data?: {};
|
|
@@ -27,6 +29,7 @@ export declare class Component implements RenderBase {
|
|
|
27
29
|
});
|
|
28
30
|
getName(): string;
|
|
29
31
|
getTemplate(): string;
|
|
32
|
+
getMode(): string;
|
|
30
33
|
getBoxStyle(): string;
|
|
31
34
|
getProps(): {};
|
|
32
35
|
getData(): {};
|
|
@@ -8,6 +8,13 @@ var Component = /** @class */ (function () {
|
|
|
8
8
|
//标签模板样式
|
|
9
9
|
this.template = config.template;
|
|
10
10
|
//添加box样式
|
|
11
|
+
if (typeof config.mode === "undefined") {
|
|
12
|
+
this.mode = "box";
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
this.mode = "insert";
|
|
16
|
+
}
|
|
17
|
+
//添加box样式
|
|
11
18
|
if (typeof config.boxStyle === "undefined") {
|
|
12
19
|
this.boxStyle = "";
|
|
13
20
|
}
|
|
@@ -69,6 +76,9 @@ var Component = /** @class */ (function () {
|
|
|
69
76
|
Component.prototype.getTemplate = function () {
|
|
70
77
|
return this.template;
|
|
71
78
|
};
|
|
79
|
+
Component.prototype.getMode = function () {
|
|
80
|
+
return this.mode;
|
|
81
|
+
};
|
|
72
82
|
Component.prototype.getBoxStyle = function () {
|
|
73
83
|
return this.boxStyle;
|
|
74
84
|
};
|
|
@@ -9,3 +9,8 @@ import { Component } from "../../class/component/component";
|
|
|
9
9
|
* @param tagTemplate
|
|
10
10
|
*/
|
|
11
11
|
export declare function mount(controller: ComponentController, proto: Component, parent: ParentNode, child: Element, tagTemplate: Element): void;
|
|
12
|
+
/**
|
|
13
|
+
* insert elements without div elment
|
|
14
|
+
* @param root
|
|
15
|
+
*/
|
|
16
|
+
export declare function unBox(root: ParentNode): void;
|
package/core/lifecycle/mount.js
CHANGED
|
@@ -19,3 +19,13 @@ export function mount(controller, proto, parent, child, tagTemplate) {
|
|
|
19
19
|
renderSpace.append(tagTemplate.firstChild);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* insert elements without div elment
|
|
24
|
+
* @param root
|
|
25
|
+
*/
|
|
26
|
+
export function unBox(root) {
|
|
27
|
+
while (root.hasChildNodes()) {
|
|
28
|
+
root.parentNode.insertBefore(root.firstChild, root);
|
|
29
|
+
}
|
|
30
|
+
root.parentNode.removeChild(root);
|
|
31
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentController } from "../../class/controller/componentController";
|
|
2
2
|
import { controllerCycleTypeTwo } from "../lifecycle/controllerCycle";
|
|
3
3
|
import { afterCmd, cmdUtility } from "../utility/cmdUtility";
|
|
4
|
-
import { mount } from "../lifecycle/mount";
|
|
4
|
+
import { mount, unBox } from "../lifecycle/mount";
|
|
5
5
|
import { injectRefs } from "../inject/inject";
|
|
6
6
|
import { afterMethodsTypeOne } from "../lifecycle/afterMethods";
|
|
7
7
|
import { findComponent } from "./delivery";
|
|
@@ -38,4 +38,7 @@ export function post_render(proto, parent, child, link, tagTemplate) {
|
|
|
38
38
|
afterRender();
|
|
39
39
|
//深度渲染
|
|
40
40
|
findComponent(controller.root.children, controller);
|
|
41
|
+
if (proto.getMode() === "insert") {
|
|
42
|
+
unBox(controller.root);
|
|
43
|
+
}
|
|
41
44
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentController } from "../../class/controller/componentController";
|
|
2
2
|
import { controllerCycleTypeOne } from "../lifecycle/controllerCycle";
|
|
3
3
|
import { afterCmd, cmdUtility } from "../utility/cmdUtility";
|
|
4
|
-
import { mount } from "../lifecycle/mount";
|
|
4
|
+
import { mount, unBox } from "../lifecycle/mount";
|
|
5
5
|
import { injectRefs } from "../inject/inject";
|
|
6
6
|
import { afterMethodsTypeOne } from "../lifecycle/afterMethods";
|
|
7
7
|
import { findComponent } from "./delivery";
|
|
@@ -33,4 +33,7 @@ export function init_render(proto, parent, child, link, tagTemplate) {
|
|
|
33
33
|
afterMethodsTypeOne(controller, child, link);
|
|
34
34
|
//深度渲染
|
|
35
35
|
findComponent(tagTemplate.children, controller);
|
|
36
|
+
if (proto.getMode() === "insert") {
|
|
37
|
+
unBox(controller.root);
|
|
38
|
+
}
|
|
36
39
|
}
|
package/core/render/rawRender.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentController } from "../../class/controller/componentController";
|
|
2
2
|
import { controllerCycleTypeTwo } from "../lifecycle/controllerCycle";
|
|
3
3
|
import { afterCmd, cmdUtility } from "../utility/cmdUtility";
|
|
4
|
-
import { mount } from "../lifecycle/mount";
|
|
4
|
+
import { mount, unBox } from "../lifecycle/mount";
|
|
5
5
|
import { injectRefs } from "../inject/inject";
|
|
6
6
|
import { afterMethodsTypeTwo } from "../lifecycle/afterMethods";
|
|
7
7
|
import { findComponent } from "./delivery";
|
|
@@ -39,4 +39,7 @@ export function raw_render(proto, parent, child, link, tagTemplate) {
|
|
|
39
39
|
afterRender();
|
|
40
40
|
//深度渲染
|
|
41
41
|
findComponent(controller.root.children, controller);
|
|
42
|
+
if (proto.getMode() === "insert") {
|
|
43
|
+
unBox(controller.root);
|
|
44
|
+
}
|
|
42
45
|
}
|