@byteluck-fe/model-driven-engine 2.5.0-alpha.9 → 2.6.0-alpha.1
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/dist/esm/common/ActionManager.js +63 -98
- package/dist/esm/common/DataManager.js +34 -75
- package/dist/esm/common/Engine.js +922 -1100
- package/dist/esm/common/OkWorker.js +74 -119
- package/dist/esm/common/Runtime.js +21 -38
- package/dist/esm/common/Store.js +116 -148
- package/dist/esm/common/checkerValue.js +241 -316
- package/dist/esm/plugins/CalcPlugin.js +305 -389
- package/dist/esm/plugins/ControlsEventPlugin.js +130 -169
- package/dist/esm/plugins/ES6ModulePlugin.js +31 -65
- package/dist/esm/plugins/LifecycleEventPlugin.js +83 -119
- package/dist/esm/plugins/StylePlugin.js +13 -46
- package/dist/index.umd.js +8 -8
- package/dist/types/common/ActionManager.d.ts +14 -14
- package/dist/types/common/DataManager.d.ts +10 -10
- package/dist/types/common/Engine.d.ts +180 -180
- package/dist/types/common/OkWorker.d.ts +13 -13
- package/dist/types/common/Plugin.d.ts +6 -6
- package/dist/types/common/Runtime.d.ts +25 -25
- package/dist/types/common/Store.d.ts +49 -49
- package/dist/types/common/checkerValue.d.ts +3 -3
- package/dist/types/common/index.d.ts +2 -2
- package/dist/types/common/proxyState.d.ts +30 -30
- package/dist/types/index.d.ts +3 -3
- package/dist/types/plugins/CalcPlugin.d.ts +121 -121
- package/dist/types/plugins/ControlsEventPlugin.d.ts +15 -15
- package/dist/types/plugins/ES6ModulePlugin.d.ts +26 -26
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +14 -14
- package/dist/types/plugins/StylePlugin.d.ts +12 -12
- package/dist/types/plugins/index.d.ts +5 -5
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/runtimeUtils.d.ts +5 -5
- package/package.json +4 -4
|
@@ -3,132 +3,87 @@ function _classCallCheck(instance, Constructor) {
|
|
|
3
3
|
throw new TypeError("Cannot call a class as a function");
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
function _defineProperties(target, props) {
|
|
7
|
-
for(var i = 0; i < props.length; i++){
|
|
8
|
-
var descriptor = props[i];
|
|
9
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
-
descriptor.configurable = true;
|
|
11
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
16
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
-
return Constructor;
|
|
19
|
-
}
|
|
20
|
-
function _defineProperty(obj, key, value) {
|
|
21
|
-
if (key in obj) {
|
|
22
|
-
Object.defineProperty(obj, key, {
|
|
23
|
-
value: value,
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
obj[key] = value;
|
|
30
|
-
}
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
6
|
import { log } from "@byteluck-fe/model-driven-shared";
|
|
34
7
|
var OkWorker = /*#__PURE__*/ function() {
|
|
35
8
|
"use strict";
|
|
36
9
|
function OkWorker() {
|
|
37
10
|
_classCallCheck(this, OkWorker);
|
|
38
|
-
_defineProperty(this, "worker", void 0);
|
|
39
11
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return function() {
|
|
80
|
-
var createHandler = function createHandler(parentKey) {
|
|
81
|
-
return {
|
|
82
|
-
get: function get(target, key, value) {
|
|
83
|
-
return Reflect.get(target, key, value);
|
|
84
|
-
},
|
|
85
|
-
set: function set(target, key, value) {
|
|
86
|
-
if (parentKey) {
|
|
87
|
-
_self.postMessage({
|
|
88
|
-
action: "update",
|
|
89
|
-
key: "".concat(parentKey, ".").concat(key)
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
return Reflect.set(target, key, value);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
log("\uD83D\uDE80 worker running");
|
|
97
|
-
var _self = self;
|
|
98
|
-
// function createProxy(
|
|
99
|
-
// obj: Record<string, unknown> | Array<Record<string, unknown>>,
|
|
100
|
-
// parentKey?: string
|
|
101
|
-
// ) {
|
|
102
|
-
// for (const key in obj) {
|
|
103
|
-
// if (Array.isArray(obj[key])) {
|
|
104
|
-
//
|
|
105
|
-
// }
|
|
106
|
-
// }
|
|
107
|
-
// return new Proxy(obj, createHandler(parentKey))
|
|
108
|
-
// }
|
|
109
|
-
_self.addEventListener("message", function(event) {
|
|
110
|
-
var _event_data = event.data, action = _event_data.action, payload = _event_data.payload, fn = _event_data.fn;
|
|
111
|
-
log(action, payload);
|
|
112
|
-
// 通过proxy进行代理,每次修改的时候,自动向外抛出postMessage
|
|
113
|
-
// data.key1 = 1
|
|
114
|
-
//
|
|
115
|
-
// data.key2.amount = 1
|
|
116
|
-
//
|
|
117
|
-
// data.key3[0].key1 = 2
|
|
118
|
-
//
|
|
119
|
-
// const result = fn(data, schema)
|
|
120
|
-
_self.postMessage({
|
|
121
|
-
action: "delete",
|
|
122
|
-
payload: {
|
|
123
|
-
key: "key3[0].key1",
|
|
124
|
-
value: "index"
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
});
|
|
12
|
+
var _proto = OkWorker.prototype;
|
|
13
|
+
_proto.run = function run(initState) {
|
|
14
|
+
this.worker = OkWorker.createWorker();
|
|
15
|
+
this.postMessage({
|
|
16
|
+
action: "init",
|
|
17
|
+
payload: initState
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
_proto.destroy = function destroy() {
|
|
21
|
+
var _this_worker;
|
|
22
|
+
(_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.terminate();
|
|
23
|
+
};
|
|
24
|
+
_proto.postMessage = function postMessage(message) {
|
|
25
|
+
var _this_worker;
|
|
26
|
+
(_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.postMessage(message);
|
|
27
|
+
};
|
|
28
|
+
OkWorker.createWorker = function createWorker() {
|
|
29
|
+
var blob = new Blob([
|
|
30
|
+
"(".concat(OkWorker.createWorkerFunction().toString(), ")()")
|
|
31
|
+
]);
|
|
32
|
+
var url = window.URL.createObjectURL(blob);
|
|
33
|
+
return new Worker(url);
|
|
34
|
+
};
|
|
35
|
+
OkWorker.createWorkerFunction = function createWorkerFunction() {
|
|
36
|
+
return function() {
|
|
37
|
+
var createHandler = function createHandler(parentKey) {
|
|
38
|
+
return {
|
|
39
|
+
get: function get(target, key, value) {
|
|
40
|
+
return Reflect.get(target, key, value);
|
|
41
|
+
},
|
|
42
|
+
set: function set(target, key, value) {
|
|
43
|
+
if (parentKey) {
|
|
44
|
+
_self.postMessage({
|
|
45
|
+
action: "update",
|
|
46
|
+
key: "".concat(parentKey, ".").concat(key)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return Reflect.set(target, key, value);
|
|
50
|
+
}
|
|
128
51
|
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
52
|
+
};
|
|
53
|
+
log("\uD83D\uDE80 worker running");
|
|
54
|
+
var _self = self;
|
|
55
|
+
// function createProxy(
|
|
56
|
+
// obj: Record<string, unknown> | Array<Record<string, unknown>>,
|
|
57
|
+
// parentKey?: string
|
|
58
|
+
// ) {
|
|
59
|
+
// for (const key in obj) {
|
|
60
|
+
// if (Array.isArray(obj[key])) {
|
|
61
|
+
//
|
|
62
|
+
// }
|
|
63
|
+
// }
|
|
64
|
+
// return new Proxy(obj, createHandler(parentKey))
|
|
65
|
+
// }
|
|
66
|
+
_self.addEventListener("message", function(event) {
|
|
67
|
+
var _event_data = event.data, action = _event_data.action, payload = _event_data.payload, fn = _event_data.fn;
|
|
68
|
+
log(action, payload);
|
|
69
|
+
// 通过proxy进行代理,每次修改的时候,自动向外抛出postMessage
|
|
70
|
+
// data.key1 = 1
|
|
71
|
+
//
|
|
72
|
+
// data.key2.amount = 1
|
|
73
|
+
//
|
|
74
|
+
// data.key3[0].key1 = 2
|
|
75
|
+
//
|
|
76
|
+
// const result = fn(data, schema)
|
|
77
|
+
_self.postMessage({
|
|
78
|
+
action: "delete",
|
|
79
|
+
payload: {
|
|
80
|
+
key: "key3[0].key1",
|
|
81
|
+
value: "index"
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
};
|
|
132
87
|
return OkWorker;
|
|
133
88
|
}();
|
|
134
89
|
export { OkWorker };
|
|
@@ -23,19 +23,6 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
23
23
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
24
24
|
return Constructor;
|
|
25
25
|
}
|
|
26
|
-
function _defineProperty(obj, key, value) {
|
|
27
|
-
if (key in obj) {
|
|
28
|
-
Object.defineProperty(obj, key, {
|
|
29
|
-
value: value,
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true
|
|
33
|
-
});
|
|
34
|
-
} else {
|
|
35
|
-
obj[key] = value;
|
|
36
|
-
}
|
|
37
|
-
return obj;
|
|
38
|
-
}
|
|
39
26
|
function _getPrototypeOf(o) {
|
|
40
27
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
41
28
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -107,38 +94,34 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
|
|
|
107
94
|
_classCallCheck(this, Runtime);
|
|
108
95
|
var _this;
|
|
109
96
|
_this = _super.call(this, "Runtime");
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
_defineProperty(_assertThisInitialized(_this), "_flatInstances", []);
|
|
113
|
-
_defineProperty(_assertThisInitialized(_this), "_instanceMap", {});
|
|
97
|
+
_this._flatInstances = [];
|
|
98
|
+
_this._instanceMap = {};
|
|
114
99
|
var schema = props.schema;
|
|
115
100
|
_this._schema = schema;
|
|
116
101
|
_this._instance = _this.createControl(schema, props.beforeCreateInstance);
|
|
117
102
|
_this.getFlatInstances();
|
|
118
103
|
return _this;
|
|
119
104
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (item.type === "subtable-row" || item.type === "subtable-column") {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
instances.push(item);
|
|
132
|
-
if (!instanceMap[item.id]) {
|
|
133
|
-
instanceMap[item.id] = [];
|
|
134
|
-
}
|
|
135
|
-
instanceMap[item.id].push(item);
|
|
136
|
-
});
|
|
137
|
-
this._flatInstances = instances;
|
|
138
|
-
this._instanceMap = instanceMap;
|
|
139
|
-
return this._flatInstances;
|
|
105
|
+
var _proto = Runtime.prototype;
|
|
106
|
+
_proto.getFlatInstances = function getFlatInstances() {
|
|
107
|
+
var instances = [];
|
|
108
|
+
var instanceMap = {};
|
|
109
|
+
loop(this._instance, function(item) {
|
|
110
|
+
// 3.4.1 避免将subtable-row 放到 _flatInstances 中
|
|
111
|
+
if (item.type === "subtable-row" || item.type === "subtable-column") {
|
|
112
|
+
return;
|
|
140
113
|
}
|
|
141
|
-
|
|
114
|
+
instances.push(item);
|
|
115
|
+
if (!instanceMap[item.id]) {
|
|
116
|
+
instanceMap[item.id] = [];
|
|
117
|
+
}
|
|
118
|
+
instanceMap[item.id].push(item);
|
|
119
|
+
});
|
|
120
|
+
this._flatInstances = instances;
|
|
121
|
+
this._instanceMap = instanceMap;
|
|
122
|
+
return this._flatInstances;
|
|
123
|
+
};
|
|
124
|
+
_createClass(Runtime, [
|
|
142
125
|
{
|
|
143
126
|
key: "schema",
|
|
144
127
|
get: function get() {
|
package/dist/esm/common/Store.js
CHANGED
|
@@ -3,20 +3,6 @@ function _classCallCheck(instance, Constructor) {
|
|
|
3
3
|
throw new TypeError("Cannot call a class as a function");
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
function _defineProperties(target, props) {
|
|
7
|
-
for(var i = 0; i < props.length; i++){
|
|
8
|
-
var descriptor = props[i];
|
|
9
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
-
descriptor.configurable = true;
|
|
11
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
16
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
-
return Constructor;
|
|
19
|
-
}
|
|
20
6
|
function _defineProperty(obj, key, value) {
|
|
21
7
|
if (key in obj) {
|
|
22
8
|
Object.defineProperty(obj, key, {
|
|
@@ -44,169 +30,151 @@ var Store = /*#__PURE__*/ function() {
|
|
|
44
30
|
"use strict";
|
|
45
31
|
function Store(props) {
|
|
46
32
|
_classCallCheck(this, Store);
|
|
47
|
-
_defineProperty(this, "emptyState", void 0);
|
|
48
|
-
_defineProperty(this, "state", void 0);
|
|
49
|
-
_defineProperty(this, "dataBindMapping", void 0 // 主要提供给二开使用
|
|
50
|
-
);
|
|
51
|
-
_defineProperty(this, "controlIdMapping", void 0);
|
|
52
33
|
var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping;
|
|
53
34
|
this.emptyState = emptyState;
|
|
54
35
|
this.state = state;
|
|
55
36
|
this.dataBindMapping = databindMapping;
|
|
56
37
|
this.controlIdMapping = controlidMapping;
|
|
57
38
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/**
|
|
39
|
+
var _proto = Store.prototype;
|
|
40
|
+
/**
|
|
61
41
|
* 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
|
|
62
42
|
* @param controlId 组件ID
|
|
63
43
|
* @param value
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
_this.state[dataView][subtableId][rowIndex][controlId] = value;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
44
|
+
*/ _proto.setState = function setState(controlId, value, rowIndex) {
|
|
45
|
+
var _this = this;
|
|
46
|
+
var controlInfo = this.controlIdMapping[controlId];
|
|
47
|
+
if (controlInfo !== undefined) {
|
|
48
|
+
//qiyu 按照对象赋值,Object.assign会触发多次key的change事件
|
|
49
|
+
this.state[controlInfo.dataView][controlId] = value;
|
|
50
|
+
// if (
|
|
51
|
+
// controlInfo.dataBind instanceof ObjectDataBind &&
|
|
52
|
+
// isPlainObject(value)
|
|
53
|
+
// ) {
|
|
54
|
+
// Object.assign(this.state[controlInfo.dataView][controlId], value)
|
|
55
|
+
// } else {
|
|
56
|
+
// this.state[controlInfo.dataView][controlId] = value
|
|
57
|
+
// }
|
|
58
|
+
} else {
|
|
59
|
+
if (rowIndex !== undefined) {
|
|
60
|
+
//TODO 目前只找了一层明细表,没有递归 如果是添加uid
|
|
61
|
+
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
62
|
+
var dataView = _this.controlIdMapping[subtableId].dataView;
|
|
63
|
+
var children = _this.controlIdMapping[subtableId].children;
|
|
64
|
+
if (children !== undefined) {
|
|
65
|
+
Object.keys(children).map(function(childControlId) {
|
|
66
|
+
if (childControlId === controlId) {
|
|
67
|
+
_this.state[dataView][subtableId][rowIndex][controlId] = value;
|
|
91
68
|
}
|
|
92
69
|
});
|
|
93
|
-
} else {
|
|
94
|
-
//不存在的 controlId,直接被挂载到外部key
|
|
95
|
-
this.state[controlId] = value;
|
|
96
70
|
}
|
|
97
|
-
}
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
//不存在的 controlId,直接被挂载到外部key
|
|
74
|
+
this.state[controlId] = value;
|
|
98
75
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
state = (_this_state_dataViewId_subtableId_rowIndex = _this.state[dataViewId][subtableId][rowIndex]) === null || _this_state_dataViewId_subtableId_rowIndex === void 0 ? void 0 : _this_state_dataViewId_subtableId_rowIndex[controlId];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
_proto.getState = function getState(controlId, rowIndex) {
|
|
79
|
+
var _this = this;
|
|
80
|
+
//qiyu 由于header的数据是后补充的,所以从state获取第一层值。
|
|
81
|
+
// const controlInfo = this.controlIdMapping[controlId]
|
|
82
|
+
var detection = this.state[controlId];
|
|
83
|
+
if (detection !== undefined) {
|
|
84
|
+
return this.state[controlId];
|
|
85
|
+
} else {
|
|
86
|
+
var controlInfo = this.controlIdMapping[controlId];
|
|
87
|
+
if (controlInfo !== undefined) {
|
|
88
|
+
return this.state[controlInfo.dataView][controlId];
|
|
89
|
+
} else {
|
|
90
|
+
if (rowIndex !== undefined) {
|
|
91
|
+
var state;
|
|
92
|
+
//TODO 目前只找了一层明细表,没有递归
|
|
93
|
+
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
94
|
+
var dataViewId = _this.controlIdMapping[subtableId].dataView;
|
|
95
|
+
var children = _this.controlIdMapping[subtableId].children;
|
|
96
|
+
if (children !== undefined) {
|
|
97
|
+
Object.keys(children).map(function(childControlId) {
|
|
98
|
+
if (childControlId === controlId) {
|
|
99
|
+
var _this_state_dataViewId_subtableId_rowIndex;
|
|
100
|
+
state = (_this_state_dataViewId_subtableId_rowIndex = _this.state[dataViewId][subtableId][rowIndex]) === null || _this_state_dataViewId_subtableId_rowIndex === void 0 ? void 0 : _this_state_dataViewId_subtableId_rowIndex[controlId];
|
|
127
101
|
}
|
|
128
102
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return state;
|
|
106
|
+
} else {
|
|
107
|
+
var states = [];
|
|
108
|
+
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
109
|
+
var dataViewId = _this.controlIdMapping[subtableId].dataView;
|
|
110
|
+
var children = _this.controlIdMapping[subtableId].children;
|
|
111
|
+
if (children !== undefined) {
|
|
112
|
+
Object.keys(children).map(function(childControlId) {
|
|
113
|
+
if (childControlId === controlId) {
|
|
114
|
+
_this.state[dataViewId][subtableId].map(function(item) {
|
|
115
|
+
states.push(item[controlId]);
|
|
142
116
|
});
|
|
143
117
|
}
|
|
144
118
|
});
|
|
145
|
-
return states;
|
|
146
119
|
}
|
|
147
|
-
}
|
|
120
|
+
});
|
|
121
|
+
return states;
|
|
148
122
|
}
|
|
149
123
|
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
state1 = _this.emptyState[dataViewId][subtableId][controlId];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
_proto.getEmptyState = function getEmptyState(controlId) {
|
|
127
|
+
var _this = this;
|
|
128
|
+
var detection = this.emptyState[controlId];
|
|
129
|
+
if (detection !== undefined) {
|
|
130
|
+
return this.emptyState[controlId];
|
|
131
|
+
} else {
|
|
132
|
+
var controlInfo = this.controlIdMapping[controlId];
|
|
133
|
+
if (controlInfo !== undefined) {
|
|
134
|
+
var state = this.emptyState[controlInfo.dataView][controlId];
|
|
135
|
+
//判断找到的是否是明细表的控件
|
|
136
|
+
if ("children" in controlInfo) {
|
|
137
|
+
Object.assign(state, {
|
|
138
|
+
uid: "new:" + buildUUID("uid")
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return state;
|
|
142
|
+
} else {
|
|
143
|
+
var state1;
|
|
144
|
+
//TODO 目前只找了一层明细表,没有递归
|
|
145
|
+
Object.keys(this.controlIdMapping).map(function(subtableId) {
|
|
146
|
+
var dataViewId = _this.controlIdMapping[subtableId].dataView;
|
|
147
|
+
var children = _this.controlIdMapping[subtableId].children;
|
|
148
|
+
if (children !== undefined) {
|
|
149
|
+
Object.keys(children).map(function(childControlId) {
|
|
150
|
+
if (childControlId === controlId) {
|
|
151
|
+
state1 = _this.emptyState[dataViewId][subtableId][controlId];
|
|
181
152
|
}
|
|
182
153
|
});
|
|
183
|
-
return state1;
|
|
184
154
|
}
|
|
185
|
-
}
|
|
155
|
+
});
|
|
156
|
+
return state1;
|
|
186
157
|
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
break wrapperFor;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
_proto.getDataBind = function getDataBind(controlId) {
|
|
161
|
+
var result = this.controlIdMapping[controlId];
|
|
162
|
+
if (result) {
|
|
163
|
+
return result.dataBind;
|
|
164
|
+
}
|
|
165
|
+
wrapperFor: for(var id in this.controlIdMapping){
|
|
166
|
+
var dataBindMapping = this.controlIdMapping[id];
|
|
167
|
+
if (dataBindMapping.children) {
|
|
168
|
+
for(var subId in dataBindMapping.children){
|
|
169
|
+
if (subId === controlId) {
|
|
170
|
+
result = dataBindMapping.children[subId];
|
|
171
|
+
break wrapperFor;
|
|
204
172
|
}
|
|
205
173
|
}
|
|
206
|
-
return result === null || result === void 0 ? void 0 : result.dataBind;
|
|
207
174
|
}
|
|
208
175
|
}
|
|
209
|
-
|
|
176
|
+
return result === null || result === void 0 ? void 0 : result.dataBind;
|
|
177
|
+
};
|
|
210
178
|
return Store;
|
|
211
179
|
}();
|
|
212
180
|
function init(instance) {
|