render-core 1.0.120 → 1.0.122
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 +16 -2
- package/class/controller/appController.js +22 -12
- package/class/controller/contextController.d.ts +14 -2
- package/class/controller/contextController.js +19 -9
- package/class/controller/pageController.js +2 -1
- package/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { AppTip } from "../tips/appTip";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* This class is associated with localStorage.
|
|
4
|
+
*/
|
|
3
5
|
export declare class AppController implements AppTip {
|
|
4
6
|
private fileds;
|
|
5
7
|
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* This method is used to add customed data.
|
|
10
|
+
* @param fileds
|
|
11
|
+
*/
|
|
6
12
|
saveFileds(fileds: {}): void;
|
|
7
|
-
|
|
13
|
+
/**
|
|
14
|
+
* 更新数据
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
loadFileds(): void;
|
|
8
18
|
setFiled(filed: string, value: any): void;
|
|
19
|
+
/**
|
|
20
|
+
* 获取数据
|
|
21
|
+
* @param filed
|
|
22
|
+
*/
|
|
9
23
|
getFiled(filed: string): any;
|
|
10
24
|
}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
2
|
import { status_read, status_write } from "render-status";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* This class is associated with localStorage.
|
|
5
|
+
*/
|
|
4
6
|
var AppController = /** @class */ (function () {
|
|
7
|
+
//系统变量
|
|
5
8
|
function AppController() {
|
|
6
9
|
this.fileds = {
|
|
7
|
-
|
|
10
|
+
system_theme: {
|
|
8
11
|
data: "default",
|
|
9
12
|
react: true,
|
|
10
13
|
callback: function (value, context) {
|
|
11
|
-
reloadStyle(value);
|
|
12
14
|
context.setFiled("theme", value);
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
};
|
|
16
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* This method is used to add customed data.
|
|
21
|
+
* @param fileds
|
|
22
|
+
*/
|
|
17
23
|
AppController.prototype.saveFileds = function (fileds) {
|
|
18
24
|
for (var filedsKey in fileds) {
|
|
19
25
|
if (Reflect.has(this.fileds, filedsKey)) {
|
|
@@ -24,7 +30,11 @@ var AppController = /** @class */ (function () {
|
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
};
|
|
27
|
-
|
|
33
|
+
/**
|
|
34
|
+
* 更新数据
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
AppController.prototype.loadFileds = function () {
|
|
28
38
|
for (var filedsKey in this.fileds) {
|
|
29
39
|
if (this.fileds[filedsKey].react) {
|
|
30
40
|
if (status_read({
|
|
@@ -37,29 +47,29 @@ var AppController = /** @class */ (function () {
|
|
|
37
47
|
})[filedsKey];
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
if (this.fileds[filedsKey].callback) {
|
|
42
|
-
this.fileds[filedsKey].callback(this.fileds[filedsKey], context);
|
|
43
|
-
}
|
|
44
50
|
}
|
|
45
51
|
};
|
|
46
52
|
AppController.prototype.setFiled = function (filed, value) {
|
|
53
|
+
//写入数
|
|
47
54
|
status_write({
|
|
48
55
|
type: "local",
|
|
49
56
|
fields: {
|
|
50
57
|
theme: value
|
|
51
58
|
}
|
|
52
59
|
});
|
|
53
|
-
|
|
54
|
-
this.loadFileds(
|
|
60
|
+
//更新数据
|
|
61
|
+
this.loadFileds();
|
|
62
|
+
//执行回调
|
|
55
63
|
if (this.fileds[filed].callback) {
|
|
56
64
|
// @ts-ignore
|
|
57
65
|
this.fileds[filed].callback(value, window.context);
|
|
58
66
|
}
|
|
59
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* 获取数据
|
|
70
|
+
* @param filed
|
|
71
|
+
*/
|
|
60
72
|
AppController.prototype.getFiled = function (filed) {
|
|
61
|
-
// @ts-ignore
|
|
62
|
-
this.loadFileds(window.context);
|
|
63
73
|
if (this.fileds[filed]) {
|
|
64
74
|
return this.fileds[filed].data;
|
|
65
75
|
}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
import { AppController } from "./appController";
|
|
2
1
|
export declare class ContextController {
|
|
3
2
|
private fileds;
|
|
4
3
|
private mixinData;
|
|
5
4
|
constructor();
|
|
6
5
|
saveFileds(fileds: {}): void;
|
|
7
|
-
loadFileds(
|
|
6
|
+
loadFileds(): void;
|
|
7
|
+
/**
|
|
8
|
+
* 写入数据
|
|
9
|
+
* @param filed
|
|
10
|
+
* @param value
|
|
11
|
+
*/
|
|
8
12
|
setFiled(filed: string, value: any): void;
|
|
13
|
+
/**
|
|
14
|
+
* 获取数据
|
|
15
|
+
* @param filed
|
|
16
|
+
*/
|
|
9
17
|
getFiled(filed: string): any;
|
|
18
|
+
/**
|
|
19
|
+
* 混入数据
|
|
20
|
+
* @param mix
|
|
21
|
+
*/
|
|
10
22
|
mixin(mix: {}): void;
|
|
11
23
|
}
|
|
@@ -5,7 +5,7 @@ var ContextController = /** @class */ (function () {
|
|
|
5
5
|
function ContextController() {
|
|
6
6
|
this.mixinData = {};
|
|
7
7
|
this.fileds = {
|
|
8
|
-
|
|
8
|
+
system_theme: {
|
|
9
9
|
data: "default",
|
|
10
10
|
react: true,
|
|
11
11
|
callback: function (value) {
|
|
@@ -24,7 +24,7 @@ var ContextController = /** @class */ (function () {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
ContextController.prototype.loadFileds = function (
|
|
27
|
+
ContextController.prototype.loadFileds = function () {
|
|
28
28
|
for (var filedsKey in this.fileds) {
|
|
29
29
|
if (this.fileds[filedsKey].react) {
|
|
30
30
|
if (status_read({
|
|
@@ -37,29 +37,35 @@ var ContextController = /** @class */ (function () {
|
|
|
37
37
|
})[filedsKey];
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
if (this.fileds[filedsKey].callback) {
|
|
42
|
-
this.fileds[filedsKey].callback(this.fileds[filedsKey], appSite);
|
|
43
|
-
}
|
|
44
40
|
}
|
|
45
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* 写入数据
|
|
44
|
+
* @param filed
|
|
45
|
+
* @param value
|
|
46
|
+
*/
|
|
46
47
|
ContextController.prototype.setFiled = function (filed, value) {
|
|
48
|
+
//写入数据
|
|
47
49
|
status_write({
|
|
48
50
|
type: "session",
|
|
49
51
|
fields: {
|
|
50
52
|
theme: value
|
|
51
53
|
}
|
|
52
54
|
});
|
|
55
|
+
//更新数据
|
|
53
56
|
// @ts-ignore
|
|
54
|
-
this.loadFileds(
|
|
57
|
+
this.loadFileds();
|
|
58
|
+
//数据回调
|
|
55
59
|
if (this.fileds[filed]) {
|
|
56
60
|
// @ts-ignore
|
|
57
61
|
this.fileds[filed].callback(value, window.appSite);
|
|
58
62
|
}
|
|
59
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* 获取数据
|
|
66
|
+
* @param filed
|
|
67
|
+
*/
|
|
60
68
|
ContextController.prototype.getFiled = function (filed) {
|
|
61
|
-
// @ts-ignore
|
|
62
|
-
this.loadFileds(window.appSite);
|
|
63
69
|
if (this.fileds[filed]) {
|
|
64
70
|
return this.fileds[filed].data;
|
|
65
71
|
}
|
|
@@ -67,6 +73,10 @@ var ContextController = /** @class */ (function () {
|
|
|
67
73
|
return null;
|
|
68
74
|
}
|
|
69
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* 混入数据
|
|
78
|
+
* @param mix
|
|
79
|
+
*/
|
|
70
80
|
ContextController.prototype.mixin = function (mix) {
|
|
71
81
|
this.mixinData = mix;
|
|
72
82
|
};
|
|
@@ -15,9 +15,10 @@ var PageController = /** @class */ (function () {
|
|
|
15
15
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
16
16
|
args[_i - 1] = arguments[_i];
|
|
17
17
|
}
|
|
18
|
-
this.methods[method].call(args);
|
|
18
|
+
this.methods[method].call(window, args);
|
|
19
19
|
};
|
|
20
20
|
PageController.prototype.mixin = function (mix) {
|
|
21
|
+
this.mixinData = mix;
|
|
21
22
|
};
|
|
22
23
|
Object.defineProperty(PageController.prototype, "crtTag", {
|
|
23
24
|
//返回当前页面的渲染元素
|
package/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var RenderJS = /** @class */ (function () {
|
|
|
26
26
|
*/
|
|
27
27
|
RenderJS.prototype.configApp = function (config) {
|
|
28
28
|
this.application.saveFileds(config);
|
|
29
|
-
this.application.loadFileds(
|
|
29
|
+
this.application.loadFileds();
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
@@ -34,7 +34,7 @@ var RenderJS = /** @class */ (function () {
|
|
|
34
34
|
*/
|
|
35
35
|
RenderJS.prototype.configContext = function (cinfig) {
|
|
36
36
|
this.context.saveFileds(cinfig);
|
|
37
|
-
this.context.loadFileds(
|
|
37
|
+
this.context.loadFileds();
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
*
|