render-core 1.0.101 → 1.0.102
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/appController.d.ts +5 -2
- package/class/controller/appController.js +49 -8
- package/class/controller/contextController.d.ts +7 -1
- package/class/controller/contextController.js +60 -1
- package/class/controller/pageController.d.ts +2 -1
- package/class/controller/pageController.js +3 -1
- package/class/tips/appTip.d.ts +0 -1
- package/class/tips/renderTip.d.ts +2 -1
- package/core/utility/styleUtility.js +2 -3
- package/index.d.ts +6 -1
- package/index.js +16 -6
- package/package.json +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { AppTip } from "../tips/appTip";
|
|
2
2
|
export declare class AppController implements AppTip {
|
|
3
|
+
private fileds;
|
|
3
4
|
constructor();
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
saveFileds(fileds: {}): void;
|
|
6
|
+
loadFileds(): void;
|
|
7
|
+
setFiled(filed: string, value: any): void;
|
|
8
|
+
getFiled(filed: string): any;
|
|
6
9
|
}
|
|
@@ -1,21 +1,62 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
|
-
import { status_write } from "render-status";
|
|
2
|
+
import { status_read, status_write } from "render-status";
|
|
3
3
|
import { reloadStyle } from "../../core/utility/styleUtility";
|
|
4
4
|
var AppController = /** @class */ (function () {
|
|
5
5
|
function AppController() {
|
|
6
|
+
this.fileds = {
|
|
7
|
+
them: {
|
|
8
|
+
data: "default",
|
|
9
|
+
react: true,
|
|
10
|
+
callback: function (value, context) {
|
|
11
|
+
reloadStyle(value);
|
|
12
|
+
context.setFiled("theme", value);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
6
16
|
}
|
|
7
|
-
|
|
8
|
-
|
|
17
|
+
AppController.prototype.saveFileds = function (fileds) {
|
|
18
|
+
for (var filedsKey in fileds) {
|
|
19
|
+
if (Reflect.has(this.fileds, filedsKey)) {
|
|
20
|
+
console.log("This filed is a systemed filed, please have a new name for the filed:" + filedsKey);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
Reflect.set(this.fileds, filedsKey, fileds[filedsKey]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
AppController.prototype.loadFileds = function () {
|
|
28
|
+
for (var filedsKey in this.fileds) {
|
|
29
|
+
if (this.fileds[filedsKey].react) {
|
|
30
|
+
if (status_read({
|
|
31
|
+
type: "local",
|
|
32
|
+
fields: [filedsKey]
|
|
33
|
+
})[filedsKey]) {
|
|
34
|
+
this.fileds[filedsKey].data = status_read({
|
|
35
|
+
type: "local",
|
|
36
|
+
fields: [filedsKey]
|
|
37
|
+
})[filedsKey];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
AppController.prototype.setFiled = function (filed, value) {
|
|
9
43
|
status_write({
|
|
10
|
-
type: "
|
|
44
|
+
type: "local",
|
|
11
45
|
fields: {
|
|
12
|
-
theme:
|
|
46
|
+
theme: JSON.stringify(value)
|
|
13
47
|
}
|
|
14
48
|
});
|
|
15
|
-
|
|
49
|
+
this.loadFileds();
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
this.fileds[filed].callback(value, window.context);
|
|
16
52
|
};
|
|
17
|
-
AppController.prototype.
|
|
18
|
-
|
|
53
|
+
AppController.prototype.getFiled = function (filed) {
|
|
54
|
+
if (this.fileds[filed]) {
|
|
55
|
+
return this.fileds[filed].data;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
19
60
|
};
|
|
20
61
|
return AppController;
|
|
21
62
|
}());
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export declare class ContextController {
|
|
2
|
-
|
|
2
|
+
private fileds;
|
|
3
|
+
private mixinData;
|
|
3
4
|
constructor();
|
|
5
|
+
saveFileds(fileds: {}): void;
|
|
6
|
+
loadFileds(): void;
|
|
7
|
+
setFiled(filed: string, value: any): void;
|
|
8
|
+
getFiled(filed: string): any;
|
|
9
|
+
mixin(mix: {}): void;
|
|
4
10
|
}
|
|
@@ -1,7 +1,66 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import { status_read, status_write } from "render-status";
|
|
3
|
+
import { reloadStyle } from "../../core/utility/styleUtility";
|
|
1
4
|
var ContextController = /** @class */ (function () {
|
|
2
5
|
function ContextController() {
|
|
3
|
-
this.
|
|
6
|
+
this.mixinData = {};
|
|
7
|
+
this.fileds = {
|
|
8
|
+
them: {
|
|
9
|
+
data: "default",
|
|
10
|
+
react: true,
|
|
11
|
+
callback: function (value, context) {
|
|
12
|
+
reloadStyle(value);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
4
16
|
}
|
|
17
|
+
ContextController.prototype.saveFileds = function (fileds) {
|
|
18
|
+
for (var filedsKey in fileds) {
|
|
19
|
+
if (Reflect.has(this.fileds, filedsKey)) {
|
|
20
|
+
console.log("This filed is a systemed filed, please have a new name for the filed:" + filedsKey);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
Reflect.set(this.fileds, filedsKey, fileds[filedsKey]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
ContextController.prototype.loadFileds = function () {
|
|
28
|
+
for (var filedsKey in this.fileds) {
|
|
29
|
+
if (this.fileds[filedsKey].react) {
|
|
30
|
+
if (status_read({
|
|
31
|
+
type: "session",
|
|
32
|
+
fields: [filedsKey]
|
|
33
|
+
})[filedsKey]) {
|
|
34
|
+
this.fileds[filedsKey].data = status_read({
|
|
35
|
+
type: "session",
|
|
36
|
+
fields: [filedsKey]
|
|
37
|
+
})[filedsKey];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
ContextController.prototype.setFiled = function (filed, value) {
|
|
43
|
+
status_write({
|
|
44
|
+
type: "session",
|
|
45
|
+
fields: {
|
|
46
|
+
theme: JSON.stringify(value)
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
this.loadFileds();
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
this.fileds[filed].callback(value, window.context);
|
|
52
|
+
};
|
|
53
|
+
ContextController.prototype.getFiled = function (filed) {
|
|
54
|
+
if (this.fileds[filed]) {
|
|
55
|
+
return this.fileds[filed].data;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
ContextController.prototype.mixin = function (mix) {
|
|
62
|
+
this.mixinData = mix;
|
|
63
|
+
};
|
|
5
64
|
return ContextController;
|
|
6
65
|
}());
|
|
7
66
|
export { ContextController };
|
|
@@ -4,11 +4,12 @@ export declare class PageController {
|
|
|
4
4
|
private currentTag;
|
|
5
5
|
solt: Map<string, any>;
|
|
6
6
|
raw_data: {};
|
|
7
|
-
|
|
7
|
+
private mixinData;
|
|
8
8
|
to: ComponentController[];
|
|
9
9
|
link: Map<string, {}>;
|
|
10
10
|
constructor();
|
|
11
11
|
receiver(method: string, ...args: any[]): void;
|
|
12
|
+
mixin(mix: {}): void;
|
|
12
13
|
set crtTag(element: Element);
|
|
13
14
|
get crtTag(): Element;
|
|
14
15
|
}
|
|
@@ -7,7 +7,7 @@ var PageController = /** @class */ (function () {
|
|
|
7
7
|
this.to = Array();
|
|
8
8
|
this.crtTag = null;
|
|
9
9
|
this.solt = new Map();
|
|
10
|
-
this.
|
|
10
|
+
this.mixinData = {};
|
|
11
11
|
}
|
|
12
12
|
//接收器
|
|
13
13
|
PageController.prototype.receiver = function (method) {
|
|
@@ -17,6 +17,8 @@ var PageController = /** @class */ (function () {
|
|
|
17
17
|
}
|
|
18
18
|
this.methods[method].call(args);
|
|
19
19
|
};
|
|
20
|
+
PageController.prototype.mixin = function (mix) {
|
|
21
|
+
};
|
|
20
22
|
Object.defineProperty(PageController.prototype, "crtTag", {
|
|
21
23
|
//返回当前页面的渲染元素
|
|
22
24
|
get: function () {
|
package/class/tips/appTip.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { loadStyle } from "../loader/loader";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import { sessionStorageEngin_read } from "render-status/read/read";
|
|
4
2
|
/**
|
|
5
3
|
*
|
|
6
4
|
* @param tag
|
|
@@ -38,7 +36,8 @@ export function themeStyle(component, styleLib) {
|
|
|
38
36
|
* @param tag
|
|
39
37
|
*/
|
|
40
38
|
export function styleResolve(tag) {
|
|
41
|
-
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
var theme = window.context.getFiled("theme");
|
|
42
41
|
if (Reflect.get(window, "styleLib").get(tag.toUpperCase()).get(theme) === undefined) {
|
|
43
42
|
console.log("tag:" + tag + " has no theme " + theme);
|
|
44
43
|
}
|
package/index.d.ts
CHANGED
|
@@ -33,7 +33,12 @@ export declare class RenderJS implements RenderTip {
|
|
|
33
33
|
*
|
|
34
34
|
* @param mix
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
contextMixin(mix: {}): void;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param mix
|
|
40
|
+
*/
|
|
41
|
+
pageMixin(mix: {}): void;
|
|
37
42
|
/**
|
|
38
43
|
* If you want to hava a permission control to your application,you can
|
|
39
44
|
* use our extra router moudle to define the router.
|
package/index.js
CHANGED
|
@@ -13,6 +13,7 @@ var RenderJS = /** @class */ (function () {
|
|
|
13
13
|
this.styleLib = new Map();
|
|
14
14
|
//initiate the application controller
|
|
15
15
|
this.application = new AppController();
|
|
16
|
+
//initiate the context controller
|
|
16
17
|
this.context = new ContextController();
|
|
17
18
|
//initiate the page controller
|
|
18
19
|
this.page = new PageController();
|
|
@@ -24,14 +25,16 @@ var RenderJS = /** @class */ (function () {
|
|
|
24
25
|
* @param config
|
|
25
26
|
*/
|
|
26
27
|
RenderJS.prototype.configApp = function (config) {
|
|
27
|
-
|
|
28
|
+
this.application.saveFileds(config);
|
|
29
|
+
this.application.loadFileds();
|
|
28
30
|
};
|
|
29
31
|
/**
|
|
30
32
|
*
|
|
31
33
|
* @param cinfig
|
|
32
34
|
*/
|
|
33
35
|
RenderJS.prototype.configContext = function (cinfig) {
|
|
34
|
-
|
|
36
|
+
this.context.saveFileds(cinfig);
|
|
37
|
+
this.context.loadFileds();
|
|
35
38
|
};
|
|
36
39
|
/**
|
|
37
40
|
*
|
|
@@ -44,8 +47,15 @@ var RenderJS = /** @class */ (function () {
|
|
|
44
47
|
*
|
|
45
48
|
* @param mix
|
|
46
49
|
*/
|
|
47
|
-
RenderJS.prototype.
|
|
48
|
-
this.
|
|
50
|
+
RenderJS.prototype.contextMixin = function (mix) {
|
|
51
|
+
this.context.mixin(mix);
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param mix
|
|
56
|
+
*/
|
|
57
|
+
RenderJS.prototype.pageMixin = function (mix) {
|
|
58
|
+
this.page.mixin(mix);
|
|
49
59
|
};
|
|
50
60
|
/**
|
|
51
61
|
* If you want to hava a permission control to your application,you can
|
|
@@ -68,9 +78,9 @@ var RenderJS = /** @class */ (function () {
|
|
|
68
78
|
RenderJS.prototype.mount = function () {
|
|
69
79
|
Reflect.set(window, "tagLib", this.tagLib);
|
|
70
80
|
Reflect.set(window, "styleLib", this.styleLib);
|
|
71
|
-
Reflect.set(window, "appSite", this.application);
|
|
72
|
-
Reflect.set(window, "context", this.context);
|
|
73
81
|
Reflect.set(window, "page", this.page);
|
|
82
|
+
Reflect.set(window, "context", this.context);
|
|
83
|
+
Reflect.set(window, "appSite", this.application);
|
|
74
84
|
if (this.router) {
|
|
75
85
|
Reflect.set(window, "router", this.router);
|
|
76
86
|
}
|