render-core 1.3.3 → 1.3.4
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/controller/pageController.d.ts +6 -0
- package/class/controller/pageController.js +9 -0
- package/core/cmd/loop/v-index.js +12 -12
- package/core/cmd/loop/v-key.js +7 -7
- package/core/inject/inject.d.ts +1 -2
- package/core/inject/inject.js +3 -2
- package/core/lifecycle/controllerCycle.js +1 -1
- package/core/utility/styleUtility.d.ts +6 -0
- package/core/utility/styleUtility.js +21 -0
- package/meta/meta.js +1 -1
- package/package.json +1 -1
- package/runtime/tools.d.ts +1 -1
- package/runtime/tools.js +1 -1
|
@@ -10,4 +10,10 @@ export declare class PageController {
|
|
|
10
10
|
receiver(method: string, ...args: any[]): void;
|
|
11
11
|
set crtTag(element: Element);
|
|
12
12
|
get crtTag(): Element;
|
|
13
|
+
/**
|
|
14
|
+
* Change the tag theme
|
|
15
|
+
* @param tag
|
|
16
|
+
* @param style
|
|
17
|
+
*/
|
|
18
|
+
changeTheme(tag: any, style: string): void;
|
|
13
19
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { changeStyle } from "../../core/utility/styleUtility";
|
|
1
2
|
var PageController = /** @class */ (function () {
|
|
2
3
|
//构造函数
|
|
3
4
|
function PageController() {
|
|
@@ -28,6 +29,14 @@ var PageController = /** @class */ (function () {
|
|
|
28
29
|
enumerable: false,
|
|
29
30
|
configurable: true
|
|
30
31
|
});
|
|
32
|
+
/**
|
|
33
|
+
* Change the tag theme
|
|
34
|
+
* @param tag
|
|
35
|
+
* @param style
|
|
36
|
+
*/
|
|
37
|
+
PageController.prototype.changeTheme = function (tag, style) {
|
|
38
|
+
changeStyle(tag, style);
|
|
39
|
+
};
|
|
31
40
|
return PageController;
|
|
32
41
|
}());
|
|
33
42
|
export { PageController };
|
package/core/cmd/loop/v-index.js
CHANGED
|
@@ -29,18 +29,6 @@ export function resolver_array_single(element, index, data) {
|
|
|
29
29
|
*/
|
|
30
30
|
export function resolver_array_multi(elements, index, data) {
|
|
31
31
|
var _loop_1 = function (i) {
|
|
32
|
-
//解析data
|
|
33
|
-
if (elements[i].hasAttribute("@data")) {
|
|
34
|
-
elements[i].removeAttribute("@data");
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
elements[i].innerText = data;
|
|
37
|
-
}
|
|
38
|
-
//解析index
|
|
39
|
-
if (elements[i].hasAttribute("@index")) {
|
|
40
|
-
elements[i].removeAttribute("@index");
|
|
41
|
-
// @ts-ignore
|
|
42
|
-
elements[i].innerText = index;
|
|
43
|
-
}
|
|
44
32
|
if (elements[i]) {
|
|
45
33
|
//检查v-for-item,该指令不可以用在根元素上
|
|
46
34
|
if (elements[i].hasAttribute("@list-document")) {
|
|
@@ -63,6 +51,18 @@ export function resolver_array_multi(elements, index, data) {
|
|
|
63
51
|
elements[i].parentNode.removeChild(elements[i]);
|
|
64
52
|
}
|
|
65
53
|
}
|
|
54
|
+
//解析data
|
|
55
|
+
if (elements[i].hasAttribute("@data")) {
|
|
56
|
+
elements[i].removeAttribute("@data");
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
elements[i].innerText = data;
|
|
59
|
+
}
|
|
60
|
+
//解析index
|
|
61
|
+
if (elements[i].hasAttribute("@index")) {
|
|
62
|
+
elements[i].removeAttribute("@index");
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
elements[i].innerText = index;
|
|
65
|
+
}
|
|
66
66
|
if (elements[i]) {
|
|
67
67
|
resolver_array_multi(elements[i].children, index, data);
|
|
68
68
|
}
|
package/core/cmd/loop/v-key.js
CHANGED
|
@@ -23,13 +23,6 @@ export function resolver_map_single(element, data) {
|
|
|
23
23
|
*/
|
|
24
24
|
export function resolver_map_multi(elements, data) {
|
|
25
25
|
var _loop_1 = function (i) {
|
|
26
|
-
//检查v-key
|
|
27
|
-
if (elements[i].hasAttribute("@section")) {
|
|
28
|
-
var property = elements[i].getAttribute("@section");
|
|
29
|
-
elements[i].removeAttribute("@section");
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
elements[i].innerText = data[property];
|
|
32
|
-
}
|
|
33
26
|
if (elements[i]) {
|
|
34
27
|
//检查v-for-item
|
|
35
28
|
if (elements[i].hasAttribute("@document-document")) {
|
|
@@ -54,6 +47,13 @@ export function resolver_map_multi(elements, data) {
|
|
|
54
47
|
elements[i].parentNode.removeChild(elements[i]);
|
|
55
48
|
}
|
|
56
49
|
}
|
|
50
|
+
//检查v-key
|
|
51
|
+
if (elements[i].hasAttribute("@section")) {
|
|
52
|
+
var property = elements[i].getAttribute("@section");
|
|
53
|
+
elements[i].removeAttribute("@section");
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
elements[i].innerText = data[property];
|
|
56
|
+
}
|
|
57
57
|
//深度展开
|
|
58
58
|
if (elements[i]) {
|
|
59
59
|
resolver_map_multi(elements[i].children, data);
|
package/core/inject/inject.d.ts
CHANGED
|
@@ -3,9 +3,8 @@ import { Component } from "../../class/component/component";
|
|
|
3
3
|
/**
|
|
4
4
|
* 向raw_data中注入props和Query
|
|
5
5
|
* @param controller
|
|
6
|
-
* @param tagTemplate
|
|
7
6
|
*/
|
|
8
|
-
export declare function inject(controller: ComponentController
|
|
7
|
+
export declare function inject(controller: ComponentController): void;
|
|
9
8
|
/**
|
|
10
9
|
*
|
|
11
10
|
* @param controller
|
package/core/inject/inject.js
CHANGED
|
@@ -5,9 +5,10 @@ import { resolver_Refs } from "../cmd/ref/v-ref";
|
|
|
5
5
|
/**
|
|
6
6
|
* 向raw_data中注入props和Query
|
|
7
7
|
* @param controller
|
|
8
|
-
* @param tagTemplate
|
|
9
8
|
*/
|
|
10
|
-
export function inject(controller
|
|
9
|
+
export function inject(controller) {
|
|
10
|
+
//注入name
|
|
11
|
+
Reflect.set(controller.raw_data, "$name", controller.proto.getName());
|
|
11
12
|
//注入props
|
|
12
13
|
getCodeSpaceForProps(controller.raw_data, resolveProps(Reflect.get(window, "context").crtTag, controller.proto.getProps()));
|
|
13
14
|
//注入query
|
|
@@ -25,7 +25,7 @@ function cycleBridge(controller, proto, child, link, tagTemplate) {
|
|
|
25
25
|
controller.proto = proto;
|
|
26
26
|
controller.mode = proto.getMode();
|
|
27
27
|
//向raw_data中注入元数据
|
|
28
|
-
inject(controller
|
|
28
|
+
inject(controller);
|
|
29
29
|
//数据渲染代理对象
|
|
30
30
|
controller.proxyForMethods = getProxyObject(controller.raw_data, controller);
|
|
31
31
|
injectComputed(controller, proto);
|
|
@@ -20,3 +20,9 @@ export declare function styleResolve(tag: string): void;
|
|
|
20
20
|
* @param theme
|
|
21
21
|
*/
|
|
22
22
|
export declare function reloadStyle(theme: string): void;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param tag
|
|
26
|
+
* @param theme
|
|
27
|
+
*/
|
|
28
|
+
export declare function changeStyle(tag: string, theme: string): void;
|
|
@@ -73,3 +73,24 @@ export function reloadStyle(theme) {
|
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
* @param tag
|
|
79
|
+
* @param theme
|
|
80
|
+
*/
|
|
81
|
+
export function changeStyle(tag, theme) {
|
|
82
|
+
var styleTxt = Reflect.get(window, "styleLib").get(tag.toUpperCase()).get(theme);
|
|
83
|
+
if (styleTxt === undefined) {
|
|
84
|
+
console.log("Dont`t find this style!");
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
var style = document.createElement('style');
|
|
88
|
+
var text = document.createTextNode(styleTxt);
|
|
89
|
+
style.appendChild(text);
|
|
90
|
+
style.setAttribute("tag", tag.toUpperCase());
|
|
91
|
+
style.setAttribute("theme", theme);
|
|
92
|
+
var head = document.getElementsByTagName('head')[0];
|
|
93
|
+
var target = head.querySelector("style" + "[tag=" + tag.toUpperCase() + "]");
|
|
94
|
+
head.replaceChild(style, target);
|
|
95
|
+
}
|
|
96
|
+
}
|
package/meta/meta.js
CHANGED
package/package.json
CHANGED
package/runtime/tools.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { RenderJS } from "../index";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function registerTagLib(application: RenderJS, component: Component | Component[]): void;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* The entrancy of render
|
|
12
12
|
* @param renderjs
|
|
13
13
|
*/
|
|
14
14
|
export declare function render(renderjs: RenderJS): void;
|