render-core 1.3.36 → 1.3.38

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.
@@ -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")) {
@@ -56,6 +44,7 @@ export function resolver_array_multi(elements, index, data) {
56
44
  //检查v-for-array
57
45
  if (elements[i].hasAttribute("@list-list")) {
58
46
  elements[i].removeAttribute("@list-list");
47
+ var kk = [];
59
48
  data.forEach(function (value, index) {
60
49
  extractForArray(elements[i].parentNode, elements[i], index, value);
61
50
  i++;
@@ -65,6 +54,18 @@ export function resolver_array_multi(elements, index, data) {
65
54
  i--;
66
55
  }
67
56
  }
57
+ //解析data
58
+ if (elements[i].hasAttribute("@data")) {
59
+ elements[i].removeAttribute("@data");
60
+ // @ts-ignore
61
+ elements[i].innerText = data;
62
+ }
63
+ //解析index
64
+ if (elements[i].hasAttribute("@index")) {
65
+ elements[i].removeAttribute("@index");
66
+ // @ts-ignore
67
+ elements[i].innerText = index;
68
+ }
68
69
  if (elements[i]) {
69
70
  resolver_array_multi(elements[i].children, index, data);
70
71
  }
@@ -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")) {
@@ -56,6 +49,13 @@ export function resolver_map_multi(elements, data) {
56
49
  i--;
57
50
  }
58
51
  }
52
+ //检查v-key
53
+ if (elements[i].hasAttribute("@section")) {
54
+ var property = elements[i].getAttribute("@section");
55
+ elements[i].removeAttribute("@section");
56
+ // @ts-ignore
57
+ elements[i].innerText = data[property];
58
+ }
59
59
  //深度展开
60
60
  if (elements[i]) {
61
61
  resolver_map_multi(elements[i].children, data);
@@ -10,6 +10,11 @@ export declare function inject(controller: ComponentController): void;
10
10
  * @param controller
11
11
  */
12
12
  export declare function injectRefs(controller: ComponentController): void;
13
+ /**
14
+ *
15
+ * @param controller
16
+ */
17
+ export declare function injectRoot(controller: ComponentController): void;
13
18
  /**
14
19
  *
15
20
  * @param controller
@@ -23,6 +23,13 @@ export function injectRefs(controller) {
23
23
  resolver_Refs(controller.root.children, refs);
24
24
  getCodeSpaceForRef(controller.raw_data, refs);
25
25
  }
26
+ /**
27
+ *
28
+ * @param controller
29
+ */
30
+ export function injectRoot(controller) {
31
+ Reflect.set(controller.raw_data, "$root", controller.root);
32
+ }
26
33
  /**
27
34
  *
28
35
  * @param controller
@@ -10,7 +10,8 @@ import { Component } from "../../class/component/component";
10
10
  */
11
11
  export declare function mount(controller: ComponentController, proto: Component, parent: ParentNode, child: Element, tagTemplate: Element): void;
12
12
  /**
13
- * insert elements without div elment
13
+ * insert elements without div element
14
14
  * @param root
15
+ * @param controller
15
16
  */
16
- export declare function unBox(root: ParentNode): void;
17
+ export declare function unBox(root: ParentNode, controller: ComponentController): void;
@@ -20,12 +20,15 @@ export function mount(controller, proto, parent, child, tagTemplate) {
20
20
  }
21
21
  }
22
22
  /**
23
- * insert elements without div elment
23
+ * insert elements without div element
24
24
  * @param root
25
+ * @param controller
25
26
  */
26
- export function unBox(root) {
27
+ export function unBox(root, controller) {
27
28
  while (root.hasChildNodes()) {
28
29
  root.parentNode.insertBefore(root.firstChild, root);
29
30
  }
31
+ controller.root = root.parentNode;
32
+ Reflect.set(controller.raw_data, "$root", root.parentNode);
30
33
  root.parentNode.removeChild(root);
31
34
  }
@@ -2,7 +2,7 @@ import { ComponentController } from "../../class/controller/componentController"
2
2
  import { controllerCycleTypeTwo } from "../lifecycle/controllerCycle";
3
3
  import { afterCmd, cmdUtility } from "../utility/cmdUtility";
4
4
  import { mount, unBox } from "../lifecycle/mount";
5
- import { injectRefs } from "../inject/inject";
5
+ import { injectRefs, injectRoot } from "../inject/inject";
6
6
  import { afterMethodsTypeOne } from "../lifecycle/afterMethods";
7
7
  import { findComponent } from "./delivery";
8
8
  import { resolver_solt } from "../cmd/solt/v-solt";
@@ -27,7 +27,10 @@ export function post_render(proto, parent, child, link, tagTemplate) {
27
27
  cmdUtility(tagTemplate, proto, controller);
28
28
  //mount
29
29
  mount(controller, proto, parent, child, tagTemplate);
30
+ //注入引用
30
31
  injectRefs(controller);
32
+ //注入root
33
+ injectRoot(controller);
31
34
  //渲染后处理
32
35
  afterCmd(controller.root, controller.proto, controller);
33
36
  //后处理
@@ -37,6 +40,6 @@ export function post_render(proto, parent, child, link, tagTemplate) {
37
40
  //深度渲染
38
41
  findComponent(controller.root.children, controller);
39
42
  if (proto.getMode() === "insert") {
40
- unBox(controller.root);
43
+ unBox(controller.root, controller);
41
44
  }
42
45
  }
@@ -2,7 +2,7 @@ import { ComponentController } from "../../class/controller/componentController"
2
2
  import { controllerCycleTypeOne } from "../lifecycle/controllerCycle";
3
3
  import { afterCmd, cmdUtility } from "../utility/cmdUtility";
4
4
  import { mount, unBox } from "../lifecycle/mount";
5
- import { injectRefs } from "../inject/inject";
5
+ import { injectRefs, injectRoot } from "../inject/inject";
6
6
  import { afterMethodsTypeOne } from "../lifecycle/afterMethods";
7
7
  import { findComponent } from "./delivery";
8
8
  import { resolver_solt } from "../cmd/solt/v-solt";
@@ -27,6 +27,8 @@ export function init_render(proto, parent, child, link, tagTemplate) {
27
27
  mount(controller, proto, parent, child, tagTemplate);
28
28
  //获取
29
29
  injectRefs(controller);
30
+ //注入root
31
+ injectRoot(controller);
30
32
  //渲染后数据处理
31
33
  afterCmd(controller.root, proto, controller);
32
34
  //后处理
@@ -34,6 +36,6 @@ export function init_render(proto, parent, child, link, tagTemplate) {
34
36
  //深度渲染
35
37
  findComponent(tagTemplate.children, controller);
36
38
  if (proto.getMode() === "insert") {
37
- unBox(controller.root);
39
+ unBox(controller.root, controller);
38
40
  }
39
41
  }
@@ -2,7 +2,7 @@ import { ComponentController } from "../../class/controller/componentController"
2
2
  import { controllerCycleTypeTwo } from "../lifecycle/controllerCycle";
3
3
  import { afterCmd, cmdUtility } from "../utility/cmdUtility";
4
4
  import { mount, unBox } from "../lifecycle/mount";
5
- import { injectRefs } from "../inject/inject";
5
+ import { injectRefs, injectRoot } from "../inject/inject";
6
6
  import { afterMethodsTypeTwo } from "../lifecycle/afterMethods";
7
7
  import { findComponent } from "./delivery";
8
8
  import { resolver_solt } from "../cmd/solt/v-solt";
@@ -29,6 +29,8 @@ export function raw_render(proto, parent, child, link, tagTemplate) {
29
29
  mount(controller, proto, parent, child, tagTemplate);
30
30
  //获取注入引用资源
31
31
  injectRefs(controller);
32
+ //注入root
33
+ injectRoot(controller);
32
34
  //渲染后处理
33
35
  afterCmd(controller.root, proto, controller);
34
36
  //后处理(数据渲染)
@@ -38,6 +40,6 @@ export function raw_render(proto, parent, child, link, tagTemplate) {
38
40
  //深度渲染
39
41
  findComponent(controller.root.children, controller);
40
42
  if (proto.getMode() === "insert") {
41
- unBox(controller.root);
43
+ unBox(controller.root, controller);
42
44
  }
43
45
  }
@@ -1,5 +1,5 @@
1
1
  import { afterCmd, cmdUtility, } from "../utility/cmdUtility";
2
- import { injectRefs } from "../inject/inject";
2
+ import { injectRefs, injectRoot } from "../inject/inject";
3
3
  import { findComponent } from "./delivery";
4
4
  import { getTemplate } from "../utility/templateUtility";
5
5
  /**
@@ -21,7 +21,10 @@ export function update_Render(controller) {
21
21
  while (tagTemplate.hasChildNodes()) {
22
22
  controller.root.appendChild(tagTemplate.firstChild);
23
23
  }
24
+ //注入引用
24
25
  injectRefs(controller);
26
+ //注入root
27
+ injectRoot(controller);
25
28
  //渲染后处理
26
29
  afterCmd(controller.root, controller.proto, controller);
27
30
  //深度渲染
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "render-core",
3
- "version": "1.3.36",
3
+ "version": "1.3.38",
4
4
  "description": "The core of render-js",
5
5
  "keywords": [
6
6
  "render",