render-core 1.4.32 → 1.4.34

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/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import { HooksGeneric } from "./tension/generic/plugin/hooks/HooksGeneric";
5
5
  import { AbstractComponent } from "./system/generic/component/instance/AbstractComponent";
6
6
  import { PrefaceGeneric } from "./tension/generic/plugin/preface/PrefaceGeneric";
7
7
  import { RouterGeneric } from "./tension/generic/router/RouterGeneric";
8
+ import { RenderOfficialRouter } from "render-router";
8
9
  /**
9
10
  * This class is used to prototype the properties type
10
11
  */
@@ -105,8 +106,8 @@ export declare class PageComponent extends AbstractComponent {
105
106
  */
106
107
  export declare class RenderJS implements RenderGeneric {
107
108
  contextController: ContextController;
108
- renderRouter: AbstractRouter;
109
- constructor(router: AbstractRouter);
109
+ renderRouter: RenderOfficialRouter;
110
+ constructor(router: RenderOfficialRouter);
110
111
  /**
111
112
  * This unc is used to register component to system
112
113
  * @param component
package/index.js CHANGED
@@ -21,6 +21,8 @@ import { AbstractComponent } from "./system/generic/component/instance/AbstractC
21
21
  import { set_context_controller } from "./system/recorder/table0/system_func_0";
22
22
  import { PrefaceAction } from "./tension/prototype/PrefaceAction";
23
23
  import { SystemInitPlugin } from "./tension/SystemInitPlugin";
24
+ import { set_system_ext_router } from "./system/recorder/table3/system_func_3";
25
+ import { registerEvent } from "./tension/function/system_func";
24
26
  /**
25
27
  * This class is used to prototype the properties type
26
28
  */
@@ -112,6 +114,8 @@ var RenderJS = /** @class */ (function () {
112
114
  this.renderRouter = router;
113
115
  /* init the basis extension */
114
116
  this.use_plugin(new SystemInitPlugin());
117
+ set_system_ext_router(this.renderRouter);
118
+ registerEvent("route:change");
115
119
  /* init the event */
116
120
  window.addEventListener("route:change", function () {
117
121
  _this.listen();
@@ -135,8 +139,7 @@ var RenderJS = /** @class */ (function () {
135
139
  */
136
140
  RenderJS.prototype.listen = function () {
137
141
  set_context_controller(this.contextController);
138
- var component = this.renderRouter.getComponent();
139
- component.component.render_method_for_listen(component.params, component.pathParams);
142
+ this.renderRouter.listen();
140
143
  };
141
144
  return RenderJS;
142
145
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "render-core",
3
- "version": "1.4.32",
3
+ "version": "1.4.34",
4
4
  "description": "The extendable javascript web framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,6 +1,7 @@
1
1
  import { HttpAction } from "../../generic/controller/prototype/HttpAction";
2
2
  import { RouterGeneric } from "../../../tension/generic/router/RouterGeneric";
3
- export declare function set_system_ext_router(router: RouterGeneric): void;
3
+ import { RenderOfficialRouter } from "render-router";
4
+ export declare function set_system_ext_router(router: RenderOfficialRouter): void;
4
5
  export declare function get_system_ext_router(): RouterGeneric;
5
6
  export declare function get_user_ext_http(): HttpAction;
6
7
  export declare function set_user_ext_http(http: HttpAction): void;
@@ -0,0 +1 @@
1
+ export declare function registerEvent(name: string): void;
@@ -0,0 +1,6 @@
1
+ export function registerEvent(name) {
2
+ window.addEventListener(name, function (evt) {
3
+ // @ts-ignore
4
+ evt.detail.component.render_method_for_listen(evt.detail.params, evt.detail.pathParams);
5
+ });
6
+ }
@@ -1,8 +1,8 @@
1
1
  import { HttpAction } from "../../../../system/generic/controller/prototype/HttpAction";
2
2
  import { AdjustComponent, ControlComponent } from "../../../../index";
3
- import { RouterGeneric } from "../../router/RouterGeneric";
3
+ import { RenderOfficialRouter } from "render-router";
4
4
  export interface PrefaceGeneric {
5
- add_system_router(router: RouterGeneric): void;
5
+ add_system_router(router: RenderOfficialRouter): void;
6
6
  add_user_http(http: HttpAction): void;
7
7
  add_anonymous_extension(name: string, plugin: object): void;
8
8
  add_anonymous_filed(name: string, value: any): void;
@@ -1,11 +1,11 @@
1
1
  import { PrefaceGeneric } from "../generic/plugin/preface/PrefaceGeneric";
2
2
  import { AdjustComponent, ControlComponent } from "../../index";
3
3
  import { HttpAction } from "../../system/generic/controller/prototype/HttpAction";
4
- import { RouterGeneric } from "../generic/router/RouterGeneric";
4
+ import { RenderOfficialRouter } from "render-router";
5
5
  export declare class PrefaceAction implements PrefaceGeneric {
6
6
  add_anonymous_extension(name: string, plugin: object): void;
7
7
  add_anonymous_filed(name: string, value: any): void;
8
- add_system_router(router: RouterGeneric): void;
8
+ add_system_router(router: RenderOfficialRouter): void;
9
9
  add_user_http(http: HttpAction): void;
10
10
  register_component(component: AdjustComponent | ControlComponent): void;
11
11
  set_field_route_mode(value: boolean): void;
@@ -1,13 +0,0 @@
1
- import { ContextController } from "../../../system/prototype/ContextController";
2
- /**
3
- * 此函数用于解析自定义元素salt
4
- * @param tagTemplate
5
- * @param controller
6
- */
7
- export declare function parse_directive_salt_collect(tagTemplate: ChildNode, controller: ContextController): void;
8
- /**
9
- * 此函数用于展开salt
10
- * @param elements
11
- * @param controller
12
- */
13
- export declare function parse_directive_salt_extract(elements: HTMLCollection, controller: ContextController): void;
@@ -1,46 +0,0 @@
1
- /**
2
- * 此函数用于解析自定义元素salt
3
- * @param tagTemplate
4
- * @param controller
5
- */
6
- export function parse_directive_salt_collect(tagTemplate, controller) {
7
- if (tagTemplate.hasChildNodes()) {
8
- // @ts-ignore
9
- var list = tagTemplate.querySelectorAll("salt");
10
- if (list.length !== 0) {
11
- list.forEach(function (value) {
12
- if (value.hasAttribute("name"))
13
- controller.salt.set(value.getAttribute("name"), value.innerHTML);
14
- else
15
- controller.salt.set("default", value.innerHTML);
16
- });
17
- }
18
- else {
19
- // @ts-ignore
20
- controller.salt.set("default", tagTemplate.innerHTML);
21
- }
22
- }
23
- }
24
- /**
25
- * 此函数用于展开salt
26
- * @param elements
27
- * @param controller
28
- */
29
- export function parse_directive_salt_extract(elements, controller) {
30
- for (var i = 0; i < elements.length; i++) {
31
- var result = elements[i].hasAttribute("@salt");
32
- if (result) {
33
- var dataName = elements[i].getAttribute("@salt");
34
- elements[i].removeAttribute("@salt");
35
- if (!dataName) {
36
- elements[i].innerHTML = controller.salt.get("default");
37
- }
38
- else {
39
- // @ts-ignore
40
- elements[i].innerHTML = controller.solt.get(dataName);
41
- }
42
- }
43
- //深度解析
44
- parse_directive_salt_extract(elements[i].children, controller);
45
- }
46
- }
@@ -1,30 +0,0 @@
1
- import { ControllerGeneric } from "../generic/controller/ControllerGeneric";
2
- import { Component } from "../../index";
3
- import { OriginalDataGeneric } from "../generic/data/OriginalDataGeneric";
4
- import { ComputedDataGeneric } from "../generic/data/ComputedDataGeneric";
5
- import { WatcherDataGeneric } from "../generic/data/WatcherDataGeneric";
6
- export declare class ContextController implements ControllerGeneric {
7
- componentAttachedRootElement: ParentNode | Element;
8
- prototypeOfComponent: Component;
9
- parentController: ContextController;
10
- anchorBegin: HTMLElement;
11
- anchorEnd: HTMLElement;
12
- componentConfig: {
13
- boxMode: boolean;
14
- plugins?: Map<string, any>;
15
- };
16
- originalData: OriginalDataGeneric;
17
- dataForMethod: OriginalDataGeneric;
18
- dataForComputed: ComputedDataGeneric;
19
- dataForWatcher: WatcherDataGeneric;
20
- salt: Map<string, any>;
21
- lazyComponent: Map<string, {}>;
22
- slaveComponent: ContextController[];
23
- method: {};
24
- computed: {};
25
- watcher: {};
26
- constructor(config: {
27
- boxMode: boolean;
28
- });
29
- receiver(method: string, ...args: any[]): any;
30
- }
@@ -1,17 +0,0 @@
1
- var ContextController = /** @class */ (function () {
2
- function ContextController(config) {
3
- this.componentConfig = config;
4
- this.lazyComponent = new Map();
5
- this.slaveComponent = Array();
6
- this.salt = new Map();
7
- }
8
- ContextController.prototype.receiver = function (method) {
9
- var args = [];
10
- for (var _i = 1; _i < arguments.length; _i++) {
11
- args[_i - 1] = arguments[_i];
12
- }
13
- return this.prototypeOfComponent.getMethods()[method].apply(this.dataForMethod, args);
14
- };
15
- return ContextController;
16
- }());
17
- export { ContextController };
@@ -1,9 +0,0 @@
1
- import { HttpGeneric } from "../generic/http/HttpGeneric";
2
- export declare class HttpAction implements HttpGeneric {
3
- redirect(url: string, parameters: {}): void;
4
- /**
5
- * locate the position
6
- * @param position
7
- */
8
- relocate(position: string): void;
9
- }
@@ -1,37 +0,0 @@
1
- var HttpAction = /** @class */ (function () {
2
- function HttpAction() {
3
- }
4
- HttpAction.prototype.redirect = function (url, parameters) {
5
- if (parameters !== null) {
6
- var params = Object.getOwnPropertyNames(parameters);
7
- if (params.length !== 0) {
8
- var queries_1 = "";
9
- params.forEach(function (value) {
10
- if (queries_1 === "") {
11
- queries_1 = queries_1 + value + "=" + parameters[value].toString();
12
- }
13
- else {
14
- queries_1 = queries_1 + "&" + value + "=" + parameters[value].toString();
15
- }
16
- });
17
- queries_1 = encodeURI(queries_1);
18
- location.href = url + "?" + queries_1;
19
- }
20
- else {
21
- location.href = url;
22
- }
23
- }
24
- else {
25
- location.href = url;
26
- }
27
- };
28
- /**
29
- * locate the position
30
- * @param position
31
- */
32
- HttpAction.prototype.relocate = function (position) {
33
- location.hash = position;
34
- };
35
- return HttpAction;
36
- }());
37
- export { HttpAction };
@@ -1,43 +0,0 @@
1
- import { ComponentGeneric } from "../../system/generic/component/ComponentGeneric";
2
- /**
3
- * This is the component prototype.
4
- */
5
- export declare abstract class AbstractComponent implements ComponentGeneric {
6
- private readonly name;
7
- private readonly template;
8
- private readonly config;
9
- private readonly boxStyle?;
10
- private readonly props?;
11
- private readonly data?;
12
- private readonly methods?;
13
- private readonly computed?;
14
- private readonly watcher?;
15
- private readonly beforeRender?;
16
- private readonly afterRender?;
17
- protected constructor(config: {
18
- name: string;
19
- template: string;
20
- config?: {
21
- boxMode: boolean;
22
- };
23
- boxStyle?: string;
24
- props?: {} | string[];
25
- data?: {};
26
- computed?: {};
27
- methods?: {};
28
- watcher?: {};
29
- beforeRender?: () => void;
30
- afterRender?: () => void;
31
- });
32
- getName(): string;
33
- getTemplate(): string;
34
- getConfig(): {};
35
- getBoxStyle(): string;
36
- getProps(): {};
37
- getData(): {};
38
- getMethods(): {};
39
- getComputed(): {};
40
- getWatcher(): {};
41
- getBeforeRender(): () => void;
42
- getAfterRender(): () => void;
43
- }
@@ -1,113 +0,0 @@
1
- /**
2
- * This is the component prototype.
3
- */
4
- var AbstractComponent = /** @class */ (function () {
5
- function AbstractComponent(config) {
6
- //标签名称
7
- this.name = config.name;
8
- //标签模板样式
9
- this.template = config.template;
10
- //添加box样式
11
- if (typeof config === "undefined") {
12
- this.config = {
13
- boxMode: true
14
- };
15
- }
16
- else {
17
- this.config = config.config;
18
- }
19
- //添加box样式
20
- if (typeof config.boxStyle === "undefined") {
21
- this.boxStyle = "";
22
- }
23
- else {
24
- this.boxStyle = config.boxStyle.replace(/^{/, "");
25
- this.boxStyle = this.boxStyle.replace(/}$/, "");
26
- this.boxStyle = this.boxStyle.replace(/\n/, "");
27
- this.boxStyle = this.boxStyle.trim();
28
- }
29
- //props validate
30
- if (typeof config.props === "undefined") {
31
- this.props = [];
32
- }
33
- else {
34
- this.props = config.props;
35
- }
36
- //添加数据
37
- if (typeof config.data === "undefined") {
38
- this.data = {};
39
- }
40
- else {
41
- this.data = config.data;
42
- }
43
- //添加计算属性
44
- if (typeof config.computed === "undefined") {
45
- this.computed = {};
46
- }
47
- else {
48
- this.computed = config.computed;
49
- }
50
- //添加方法属性
51
- if (typeof config.methods === "undefined") {
52
- this.methods = {};
53
- }
54
- else {
55
- this.methods = config.methods;
56
- }
57
- //添加监控属性
58
- if (typeof config.watcher === "undefined") {
59
- this.watcher = {};
60
- }
61
- else {
62
- this.watcher = config.watcher;
63
- }
64
- //生命周期函数
65
- if (typeof config.beforeRender === "undefined") {
66
- this.beforeRender = function () { };
67
- }
68
- else {
69
- this.beforeRender = config.beforeRender;
70
- }
71
- if (typeof config.afterRender === "undefined") {
72
- this.afterRender = function () { };
73
- }
74
- else {
75
- this.afterRender = config.afterRender;
76
- }
77
- }
78
- AbstractComponent.prototype.getName = function () {
79
- return this.name;
80
- };
81
- AbstractComponent.prototype.getTemplate = function () {
82
- return this.template;
83
- };
84
- AbstractComponent.prototype.getConfig = function () {
85
- return this.config;
86
- };
87
- AbstractComponent.prototype.getBoxStyle = function () {
88
- return this.boxStyle;
89
- };
90
- AbstractComponent.prototype.getProps = function () {
91
- return this.props;
92
- };
93
- AbstractComponent.prototype.getData = function () {
94
- return this.data;
95
- };
96
- AbstractComponent.prototype.getMethods = function () {
97
- return this.methods;
98
- };
99
- AbstractComponent.prototype.getComputed = function () {
100
- return this.computed;
101
- };
102
- AbstractComponent.prototype.getWatcher = function () {
103
- return this.watcher;
104
- };
105
- AbstractComponent.prototype.getBeforeRender = function () {
106
- return this.beforeRender;
107
- };
108
- AbstractComponent.prototype.getAfterRender = function () {
109
- return this.afterRender;
110
- };
111
- return AbstractComponent;
112
- }());
113
- export { AbstractComponent };