render-core 1.4.22 → 1.4.25
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.js +9 -11
- package/kernel/directive/loop/v-array-utility.d.ts +14 -0
- package/kernel/directive/loop/v-array-utility.js +58 -0
- package/kernel/directive/loop/v-array.d.ts +22 -0
- package/kernel/directive/loop/v-array.js +64 -0
- package/kernel/directive/loop/v-map-utility.js +1 -1
- package/kernel/proxyer/getProxy.js +19 -42
- package/package.json +1 -1
- package/system/utility/directive/cmdUtility.js +1 -1
package/index.js
CHANGED
|
@@ -21,8 +21,6 @@ import { AbstractComponent } from "./tension/prototype/AbstractComponent";
|
|
|
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 { lintComponent } from "./verify/directive-linter";
|
|
25
|
-
import { errorDisplay } from "./system/output/errorUtility";
|
|
26
24
|
/**
|
|
27
25
|
* This class is used to prototype the properties type
|
|
28
26
|
*/
|
|
@@ -97,15 +95,15 @@ var RenderJS = /** @class */ (function () {
|
|
|
97
95
|
* @param component
|
|
98
96
|
*/
|
|
99
97
|
RenderJS.prototype.add_tag = function (component) {
|
|
100
|
-
|
|
101
|
-
if (errors.length > 0) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
// let errors:LintError[] = lintComponent(component);
|
|
99
|
+
// if (errors.length > 0) {
|
|
100
|
+
// errors.map(error => {
|
|
101
|
+
// errorDisplay(component.getName(), error);
|
|
102
|
+
// })
|
|
103
|
+
// }else {
|
|
104
|
+
// registerTagLib(component);
|
|
105
|
+
// }
|
|
106
|
+
registerTagLib(component);
|
|
109
107
|
};
|
|
110
108
|
/**
|
|
111
109
|
* This func is used to work under the route mode
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 遍历根元素
|
|
3
|
+
* @param element
|
|
4
|
+
* @param index
|
|
5
|
+
* @param data
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolver_array_single(element: Element, index: number, data: any): void;
|
|
8
|
+
/**
|
|
9
|
+
* 遍历根元素的子元素
|
|
10
|
+
* @param elements
|
|
11
|
+
* @param index
|
|
12
|
+
* @param data
|
|
13
|
+
*/
|
|
14
|
+
export declare function parse_directive_array_multi(elements: HTMLCollection, index: number, data: any): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { resolver_map_single } from "./v-map-utility";
|
|
2
|
+
/**
|
|
3
|
+
* 遍历根元素
|
|
4
|
+
* @param element
|
|
5
|
+
* @param index
|
|
6
|
+
* @param data
|
|
7
|
+
*/
|
|
8
|
+
export function resolver_array_single(element, index, data) {
|
|
9
|
+
//解析data
|
|
10
|
+
if (element.hasAttribute("@data")) {
|
|
11
|
+
element.removeAttribute("@data");
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
element.innerText = data;
|
|
14
|
+
}
|
|
15
|
+
//解析index
|
|
16
|
+
if (element.hasAttribute("@index")) {
|
|
17
|
+
element.removeAttribute("@index");
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
element.innerText = index;
|
|
20
|
+
}
|
|
21
|
+
parse_directive_array_multi(element.children, index, data);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 遍历根元素的子元素
|
|
25
|
+
* @param elements
|
|
26
|
+
* @param index
|
|
27
|
+
* @param data
|
|
28
|
+
*/
|
|
29
|
+
export function parse_directive_array_multi(elements, index, data) {
|
|
30
|
+
//渲染模板子元素
|
|
31
|
+
for (var i = 0; i < elements.length; i++) {
|
|
32
|
+
//渲染文档
|
|
33
|
+
if (elements[i].hasAttribute("@array-document")) {
|
|
34
|
+
elements[i].removeAttribute("@array-document");
|
|
35
|
+
resolver_map_single(elements[i], data);
|
|
36
|
+
}
|
|
37
|
+
//渲染信息
|
|
38
|
+
if (elements[i].hasAttribute("@array-message")) {
|
|
39
|
+
var data_index = elements[i].getAttribute("@array-message");
|
|
40
|
+
elements[i].removeAttribute("@array-message");
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
elements[i].innerText = data[data_index];
|
|
43
|
+
}
|
|
44
|
+
//解析data
|
|
45
|
+
if (elements[i].hasAttribute("@data")) {
|
|
46
|
+
elements[i].removeAttribute("@data");
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
elements[i].innerText = data;
|
|
49
|
+
}
|
|
50
|
+
//解析index
|
|
51
|
+
if (elements[i].hasAttribute("@index")) {
|
|
52
|
+
elements[i].removeAttribute("@index");
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
elements[i].innerText = index;
|
|
55
|
+
}
|
|
56
|
+
parse_directive_array_multi(elements[i].children, index, data);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 展开数据
|
|
3
|
+
* @param elements
|
|
4
|
+
* @param data
|
|
5
|
+
*/
|
|
6
|
+
export declare function parse_directive_for_of(elements: HTMLCollection, data: {}): void;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param baseRoot
|
|
10
|
+
* @param temp
|
|
11
|
+
* @param index
|
|
12
|
+
* @param data
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractForArray(baseRoot: ParentNode, temp: Node, index: number, data: any): void;
|
|
15
|
+
/**
|
|
16
|
+
* 该函数用于处理数组类型数据的展开
|
|
17
|
+
* @param baseRoot
|
|
18
|
+
* @param temp
|
|
19
|
+
* @param index
|
|
20
|
+
* @param data
|
|
21
|
+
*/
|
|
22
|
+
export declare function part_render_array(baseRoot: ParentNode, temp: Node, index: number, data: any): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { resolver_array_single } from "./v-array-utility";
|
|
2
|
+
/**
|
|
3
|
+
* 展开数据
|
|
4
|
+
* @param elements
|
|
5
|
+
* @param data
|
|
6
|
+
*/
|
|
7
|
+
export function parse_directive_for_of(elements, data) {
|
|
8
|
+
var _loop_1 = function (i) {
|
|
9
|
+
var result = elements[i].hasAttribute("@array");
|
|
10
|
+
if (result) {
|
|
11
|
+
var dataName = elements[i].getAttribute("@array");
|
|
12
|
+
elements[i].removeAttribute("@array");
|
|
13
|
+
if (data[dataName] instanceof Array) {
|
|
14
|
+
data[dataName].forEach(function (value, index) {
|
|
15
|
+
//从数组中取出一条信息,然后开始渲染
|
|
16
|
+
extractForArray(elements[i].parentNode, elements[i], index, value);
|
|
17
|
+
i++;
|
|
18
|
+
});
|
|
19
|
+
//将模板节点删除
|
|
20
|
+
elements[i].parentNode.removeChild(elements[i]);
|
|
21
|
+
//重新回到原来的索引值
|
|
22
|
+
i--;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
console.log("Instruction @for need an array datatype to extract!");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (elements[i]) {
|
|
29
|
+
parse_directive_for_of(elements[i].children, data);
|
|
30
|
+
}
|
|
31
|
+
out_i_1 = i;
|
|
32
|
+
};
|
|
33
|
+
var out_i_1;
|
|
34
|
+
for (var i = 0; i < elements.length; i++) {
|
|
35
|
+
_loop_1(i);
|
|
36
|
+
i = out_i_1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param baseRoot
|
|
42
|
+
* @param temp
|
|
43
|
+
* @param index
|
|
44
|
+
* @param data
|
|
45
|
+
*/
|
|
46
|
+
export function extractForArray(baseRoot, temp, index, data) {
|
|
47
|
+
//将渲染出来的数据模板插入到根元素下
|
|
48
|
+
part_render_array(baseRoot, temp, index, data);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 该函数用于处理数组类型数据的展开
|
|
52
|
+
* @param baseRoot
|
|
53
|
+
* @param temp
|
|
54
|
+
* @param index
|
|
55
|
+
* @param data
|
|
56
|
+
*/
|
|
57
|
+
export function part_render_array(baseRoot, temp, index, data) {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
var clone = temp.cloneNode(true);
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
resolver_array_single(clone, index, data);
|
|
62
|
+
//插入模板节点
|
|
63
|
+
baseRoot.insertBefore(clone, temp);
|
|
64
|
+
}
|
|
@@ -5,50 +5,27 @@ import { locateInputAddress } from "../../system/utility/react/sectionUtility";
|
|
|
5
5
|
* @param updater
|
|
6
6
|
*/
|
|
7
7
|
export function get_proxy_for_method(data, updater) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (isPlainObject(obj) && existed) {
|
|
22
|
-
update_Render(updater);
|
|
23
|
-
try {
|
|
24
|
-
if (updater.watcher && typeof updater.watcher[prop] === 'function') {
|
|
25
|
-
updater.watcher[prop](obj[prop], value);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
// silently ignore missing watchers
|
|
30
|
-
}
|
|
31
|
-
locateInputAddress(updater);
|
|
32
|
-
Reflect.deleteProperty(updater, 'origin');
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function wrapObject(target) {
|
|
39
|
-
if (!isPlainObject(target)) {
|
|
40
|
-
return target;
|
|
8
|
+
var handel = {};
|
|
9
|
+
handel["set"] = get_setter_for_method_proxy(updater);
|
|
10
|
+
return new Proxy(data, handel);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @param updater
|
|
14
|
+
*/
|
|
15
|
+
function get_setter_for_method_proxy(updater) {
|
|
16
|
+
var setter = function (obj, prop, value) {
|
|
17
|
+
Reflect.set(obj, prop, value);
|
|
18
|
+
update_Render(this);
|
|
19
|
+
try {
|
|
20
|
+
this.watcher[prop](obj[prop], value);
|
|
41
21
|
}
|
|
42
|
-
|
|
43
|
-
var key = _a[_i];
|
|
44
|
-
var value = target[key];
|
|
45
|
-
if (isPlainObject(value)) {
|
|
46
|
-
target[key] = wrapObject(value);
|
|
47
|
-
}
|
|
22
|
+
catch (error) {
|
|
48
23
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
24
|
+
locateInputAddress(this);
|
|
25
|
+
Reflect.deleteProperty(this, "origin");
|
|
26
|
+
return true;
|
|
27
|
+
};
|
|
28
|
+
return setter.bind(updater);
|
|
52
29
|
}
|
|
53
30
|
/**
|
|
54
31
|
* @param origin
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import { parse_directive_show } from "../../../kernel/directive/justify/v-show";
|
|
|
8
8
|
import { parse_directive_render } from "../../../kernel/directive/justify/v-render";
|
|
9
9
|
import { parse_directive_if } from "../../../kernel/directive/justify/v-if";
|
|
10
10
|
import { parse_directive_switch } from "../../../kernel/directive/justify/v-switch";
|
|
11
|
-
import { parse_directive_for_of } from "../../../kernel/directive/loop/v-
|
|
11
|
+
import { parse_directive_for_of } from "../../../kernel/directive/loop/v-array";
|
|
12
12
|
import { parse_directive_salt_extract } from "../../../kernel/directive/salt/v-solt";
|
|
13
13
|
import { parse_directive_expression } from "../../../kernel/directive/data/v-el";
|
|
14
14
|
import { parse_directive_for_map } from "../../../kernel/directive/loop/v-map";
|