@byteluck-fe/model-driven-shared 2.2.7-beta.1 → 2.3.1-beta.18
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/EventLogic.js +10 -41
- package/dist/esm/RulesMessage.js +15 -53
- package/dist/esm/calc.js +0 -31
- package/dist/esm/entity/Department.js +0 -20
- package/dist/esm/entity/User.js +0 -74
- package/dist/esm/updateValueFromKeys.js +1 -1
- package/dist/esm/watcher.js +156 -199
- package/dist/types/updateValueFromKeys.d.ts +1 -1
- package/package.json +2 -2
package/dist/esm/EventLogic.js
CHANGED
|
@@ -3,33 +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
|
-
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
|
// type InnerEventCode = 'click' | 'click-finish' | 'change'
|
|
34
7
|
var eventMap = [
|
|
35
8
|
{
|
|
@@ -153,19 +126,15 @@ export var EventLogic = /*#__PURE__*/ function() {
|
|
|
153
126
|
function EventLogic() {
|
|
154
127
|
_classCallCheck(this, EventLogic);
|
|
155
128
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
]);
|
|
129
|
+
var _proto = EventLogic.prototype;
|
|
130
|
+
_proto.getEventsFromKeys = function getEventsFromKeys(keys) {
|
|
131
|
+
var eventKeys = typeof keys === "string" ? [
|
|
132
|
+
keys
|
|
133
|
+
] : keys;
|
|
134
|
+
return EventLogic.events.filter(function(item) {
|
|
135
|
+
return eventKeys.includes(item.key);
|
|
136
|
+
});
|
|
137
|
+
};
|
|
169
138
|
return EventLogic;
|
|
170
139
|
}();
|
|
171
|
-
|
|
140
|
+
EventLogic.events = eventMap;
|
package/dist/esm/RulesMessage.js
CHANGED
|
@@ -3,33 +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
|
-
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 OkI18n from "ok-i18n";
|
|
34
7
|
import messages from "./locales";
|
|
35
8
|
import { DEFAULT_LOCALE } from "./constant";
|
|
@@ -38,31 +11,20 @@ export var RulesMessage = /*#__PURE__*/ function() {
|
|
|
38
11
|
function RulesMessage() {
|
|
39
12
|
_classCallCheck(this, RulesMessage);
|
|
40
13
|
}
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
messages: messages
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
key: "setLocale",
|
|
61
|
-
value: function setLocale(locale) {
|
|
62
|
-
return this.$i18n.setLocale(locale);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
]);
|
|
14
|
+
RulesMessage.getMessage = function getMessage(messageKey) {
|
|
15
|
+
var variable = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
16
|
+
return this.$i18n.$t(messageKey, "", variable);
|
|
17
|
+
};
|
|
18
|
+
RulesMessage.resetI18n = function resetI18n() {
|
|
19
|
+
var locale = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_LOCALE;
|
|
20
|
+
return new OkI18n({
|
|
21
|
+
locale: locale,
|
|
22
|
+
messages: messages
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
RulesMessage.setLocale = function setLocale(locale) {
|
|
26
|
+
return this.$i18n.setLocale(locale);
|
|
27
|
+
};
|
|
66
28
|
return RulesMessage;
|
|
67
29
|
}();
|
|
68
|
-
|
|
30
|
+
RulesMessage.$i18n = RulesMessage.resetI18n();
|
package/dist/esm/calc.js
CHANGED
|
@@ -3,19 +3,6 @@ function _classCallCheck(instance, Constructor) {
|
|
|
3
3
|
throw new TypeError("Cannot call a class as a function");
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
function _defineProperty(obj, key, value) {
|
|
7
|
-
if (key in obj) {
|
|
8
|
-
Object.defineProperty(obj, key, {
|
|
9
|
-
value: value,
|
|
10
|
-
enumerable: true,
|
|
11
|
-
configurable: true,
|
|
12
|
-
writable: true
|
|
13
|
-
});
|
|
14
|
-
} else {
|
|
15
|
-
obj[key] = value;
|
|
16
|
-
}
|
|
17
|
-
return obj;
|
|
18
|
-
}
|
|
19
6
|
export var CALC_TOKEN_TYPE;
|
|
20
7
|
(function(CALC_TOKEN_TYPE) {
|
|
21
8
|
CALC_TOKEN_TYPE[/**
|
|
@@ -58,24 +45,6 @@ export var CALC_AGGREGATE_TYPE;
|
|
|
58
45
|
export var CalcScriptEchoItem = function CalcScriptEchoItem(props) {
|
|
59
46
|
"use strict";
|
|
60
47
|
_classCallCheck(this, CalcScriptEchoItem);
|
|
61
|
-
/**
|
|
62
|
-
* 变量名称或者公式符号或者数值
|
|
63
|
-
* */ _defineProperty(this, "name", void 0);
|
|
64
|
-
/**
|
|
65
|
-
* 如果是变量的话,id为控件id
|
|
66
|
-
* */ _defineProperty(this, "id", void 0);
|
|
67
|
-
/**
|
|
68
|
-
* 当前值的类型
|
|
69
|
-
* */ _defineProperty(this, "type", void 0);
|
|
70
|
-
/**
|
|
71
|
-
* 绑定的是明细子表变量时,必须有subTableId
|
|
72
|
-
* */ _defineProperty(this, "subTableId", void 0);
|
|
73
|
-
/**
|
|
74
|
-
* 绑定的是明细子表内变量时,必须有subTableName
|
|
75
|
-
* */ _defineProperty(this, "subTableName", void 0);
|
|
76
|
-
/**
|
|
77
|
-
* 绑定的是其它明细子表内变量时,必须有aggregateType
|
|
78
|
-
* */ _defineProperty(this, "aggregateType", void 0);
|
|
79
48
|
var _props_name;
|
|
80
49
|
this.name = (_props_name = props === null || props === void 0 ? void 0 : props.name) !== null && _props_name !== void 0 ? _props_name : "";
|
|
81
50
|
var _props_id;
|
|
@@ -6,27 +6,7 @@
|
|
|
6
6
|
throw new TypeError("Cannot call a class as a function");
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
function _defineProperty(obj, key, value) {
|
|
10
|
-
if (key in obj) {
|
|
11
|
-
Object.defineProperty(obj, key, {
|
|
12
|
-
value: value,
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true
|
|
16
|
-
});
|
|
17
|
-
} else {
|
|
18
|
-
obj[key] = value;
|
|
19
|
-
}
|
|
20
|
-
return obj;
|
|
21
|
-
}
|
|
22
9
|
export var DepartmentEntity = function DepartmentEntity() {
|
|
23
10
|
"use strict";
|
|
24
11
|
_classCallCheck(this, DepartmentEntity);
|
|
25
|
-
_defineProperty(this, "department_en_name", void 0);
|
|
26
|
-
/**
|
|
27
|
-
* 部门编号
|
|
28
|
-
*/ _defineProperty(this, "department_id", void 0);
|
|
29
|
-
/**
|
|
30
|
-
* 部门名称
|
|
31
|
-
*/ _defineProperty(this, "department_name", void 0);
|
|
32
12
|
};
|
package/dist/esm/entity/User.js
CHANGED
|
@@ -6,81 +6,7 @@
|
|
|
6
6
|
throw new TypeError("Cannot call a class as a function");
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
function _defineProperty(obj, key, value) {
|
|
10
|
-
if (key in obj) {
|
|
11
|
-
Object.defineProperty(obj, key, {
|
|
12
|
-
value: value,
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true
|
|
16
|
-
});
|
|
17
|
-
} else {
|
|
18
|
-
obj[key] = value;
|
|
19
|
-
}
|
|
20
|
-
return obj;
|
|
21
|
-
}
|
|
22
9
|
export var UserEntity = function UserEntity() {
|
|
23
10
|
"use strict";
|
|
24
11
|
_classCallCheck(this, UserEntity);
|
|
25
|
-
_defineProperty(this, "avatar_big", void 0);
|
|
26
|
-
_defineProperty(this, "avatar_small", void 0);
|
|
27
|
-
/**
|
|
28
|
-
* 员工头像地址
|
|
29
|
-
*/ _defineProperty(this, "avatar_url", void 0);
|
|
30
|
-
/**
|
|
31
|
-
* 归属部门英文名称
|
|
32
|
-
*/ _defineProperty(this, "belong_dept_en_name", void 0);
|
|
33
|
-
_defineProperty(this, "belong_dept_id_list", void 0);
|
|
34
|
-
/**
|
|
35
|
-
* 归属部门ID
|
|
36
|
-
*/ _defineProperty(this, "belong_dept_ids", void 0);
|
|
37
|
-
/**
|
|
38
|
-
* 归属部门名称
|
|
39
|
-
*/ _defineProperty(this, "belong_dept_name", void 0);
|
|
40
|
-
/**
|
|
41
|
-
* 当前语言版本
|
|
42
|
-
*/ _defineProperty(this, "cookie_language_enum", void 0);
|
|
43
|
-
/**
|
|
44
|
-
* 部门id
|
|
45
|
-
*/ _defineProperty(this, "department_id", void 0);
|
|
46
|
-
/**
|
|
47
|
-
* 部门名称
|
|
48
|
-
*/ _defineProperty(this, "department_name", void 0);
|
|
49
|
-
/**
|
|
50
|
-
* 员工邮箱
|
|
51
|
-
*/ _defineProperty(this, "email", void 0);
|
|
52
|
-
/**
|
|
53
|
-
* 工号
|
|
54
|
-
*/ _defineProperty(this, "employee_card", void 0);
|
|
55
|
-
/**
|
|
56
|
-
* 英文名
|
|
57
|
-
*/ _defineProperty(this, "employee_en_name", void 0);
|
|
58
|
-
/**
|
|
59
|
-
* 员工编号
|
|
60
|
-
*/ _defineProperty(this, "employee_id", void 0);
|
|
61
|
-
/**
|
|
62
|
-
* 员工姓名
|
|
63
|
-
*/ _defineProperty(this, "employee_name", void 0);
|
|
64
|
-
_defineProperty(this, "external_user", void 0);
|
|
65
|
-
/**
|
|
66
|
-
* 性别
|
|
67
|
-
*/ _defineProperty(this, "gender", void 0);
|
|
68
|
-
_defineProperty(this, "is_show_chat_group", void 0);
|
|
69
|
-
/**
|
|
70
|
-
* 负责部门英文名称
|
|
71
|
-
*/ _defineProperty(this, "manage_dept_en_name", void 0);
|
|
72
|
-
/**
|
|
73
|
-
* 负责部门ID
|
|
74
|
-
*/ _defineProperty(this, "manage_dept_ids", void 0);
|
|
75
|
-
/**
|
|
76
|
-
* 负责部门名称
|
|
77
|
-
*/ _defineProperty(this, "manage_dept_name", void 0);
|
|
78
|
-
_defineProperty(this, "msg_relation_type", void 0);
|
|
79
|
-
/**
|
|
80
|
-
* 职级
|
|
81
|
-
*/ _defineProperty(this, "sequence", void 0);
|
|
82
|
-
/**
|
|
83
|
-
* 固定电话
|
|
84
|
-
*/ _defineProperty(this, "telephone", void 0);
|
|
85
|
-
_defineProperty(this, "tenant_id", void 0);
|
|
86
12
|
};
|
|
@@ -2,7 +2,7 @@ import { warn } from "./log";
|
|
|
2
2
|
/**
|
|
3
3
|
* 通过key字符串类修改对象上边的属性
|
|
4
4
|
* @param obj 执行修改的对象
|
|
5
|
-
* @param key 修改的key
|
|
5
|
+
* @param key 修改的key,可以是 name,可以是0,可以是深层嵌套的obj.0,obj[0].name等等
|
|
6
6
|
* @param value 修改的值
|
|
7
7
|
* @return boolean 是否修改成功
|
|
8
8
|
* */ export function updateValueFromKeys(obj, key, value) {
|
package/dist/esm/watcher.js
CHANGED
|
@@ -40,33 +40,6 @@ function _classCallCheck(instance, Constructor) {
|
|
|
40
40
|
throw new TypeError("Cannot call a class as a function");
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function _defineProperties(target, props) {
|
|
44
|
-
for(var i = 0; i < props.length; i++){
|
|
45
|
-
var descriptor = props[i];
|
|
46
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
47
|
-
descriptor.configurable = true;
|
|
48
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
49
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
53
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
54
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
55
|
-
return Constructor;
|
|
56
|
-
}
|
|
57
|
-
function _defineProperty(obj, key, value) {
|
|
58
|
-
if (key in obj) {
|
|
59
|
-
Object.defineProperty(obj, key, {
|
|
60
|
-
value: value,
|
|
61
|
-
enumerable: true,
|
|
62
|
-
configurable: true,
|
|
63
|
-
writable: true
|
|
64
|
-
});
|
|
65
|
-
} else {
|
|
66
|
-
obj[key] = value;
|
|
67
|
-
}
|
|
68
|
-
return obj;
|
|
69
|
-
}
|
|
70
43
|
function _iterableToArray(iter) {
|
|
71
44
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
72
45
|
}
|
|
@@ -186,182 +159,166 @@ var Watcher = /*#__PURE__*/ function() {
|
|
|
186
159
|
function Watcher() {
|
|
187
160
|
_classCallCheck(this, Watcher);
|
|
188
161
|
// 全局事件维护
|
|
189
|
-
|
|
190
|
-
|
|
162
|
+
this._events = new Map();
|
|
163
|
+
this.debug = false;
|
|
191
164
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
6
|
|
235
|
-
];
|
|
236
|
-
}
|
|
237
|
-
_state.label = 3;
|
|
238
|
-
case 3:
|
|
239
|
-
_state.trys.push([
|
|
240
|
-
3,
|
|
241
|
-
5,
|
|
242
|
-
,
|
|
243
|
-
6
|
|
244
|
-
]);
|
|
245
|
-
_this.debug && log.apply(void 0, [
|
|
246
|
-
"正在执行 ".concat(key, " 事件: ").concat(callback.applyingPluginName ? "当前执行的插件为:" + callback.applyingPluginName : "", ", 当前执行函数的参数为").concat(payload.map(function() {
|
|
247
|
-
return "%o";
|
|
248
|
-
}).join(","), "。")
|
|
249
|
-
].concat(_toConsumableArray(payload)));
|
|
250
|
-
return [
|
|
251
|
-
4,
|
|
252
|
-
callback.apply(null, _toConsumableArray(payload))
|
|
253
|
-
];
|
|
254
|
-
case 4:
|
|
255
|
-
result = _state.sent();
|
|
256
|
-
_this.debug && log.apply(void 0, [
|
|
257
|
-
"正在执行 ".concat(key, " 事件: ").concat(callback.applyingPluginName ? "当前执行的插件为:" + callback.applyingPluginName : "", ", 当前执行函数的参数为").concat(payload.map(function() {
|
|
258
|
-
return "%o";
|
|
259
|
-
}).join(","), "; 函数的返回结果为%o")
|
|
260
|
-
].concat(_toConsumableArray(payload), [
|
|
261
|
-
result
|
|
262
|
-
]));
|
|
263
|
-
results.push(result);
|
|
264
|
-
if (result === false) {
|
|
265
|
-
return [
|
|
266
|
-
3,
|
|
267
|
-
7
|
|
268
|
-
];
|
|
269
|
-
}
|
|
270
|
-
return [
|
|
271
|
-
3,
|
|
272
|
-
6
|
|
273
|
-
];
|
|
274
|
-
case 5:
|
|
275
|
-
e = _state.sent();
|
|
276
|
-
logerror(String(e));
|
|
277
|
-
return [
|
|
278
|
-
3,
|
|
279
|
-
6
|
|
280
|
-
];
|
|
281
|
-
case 6:
|
|
282
|
-
_iteratorNormalCompletion = true;
|
|
283
|
-
return [
|
|
284
|
-
3,
|
|
285
|
-
2
|
|
286
|
-
];
|
|
287
|
-
case 7:
|
|
288
|
-
return [
|
|
289
|
-
3,
|
|
290
|
-
10
|
|
291
|
-
];
|
|
292
|
-
case 8:
|
|
293
|
-
err = _state.sent();
|
|
294
|
-
_didIteratorError = true;
|
|
295
|
-
_iteratorError = err;
|
|
296
|
-
return [
|
|
297
|
-
3,
|
|
298
|
-
10
|
|
299
|
-
];
|
|
300
|
-
case 9:
|
|
301
|
-
try {
|
|
302
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
303
|
-
_iterator.return();
|
|
304
|
-
}
|
|
305
|
-
} finally{
|
|
306
|
-
if (_didIteratorError) {
|
|
307
|
-
throw _iteratorError;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
return [
|
|
311
|
-
7
|
|
312
|
-
];
|
|
313
|
-
case 10:
|
|
314
|
-
return [
|
|
315
|
-
2,
|
|
316
|
-
results
|
|
317
|
-
];
|
|
165
|
+
var _proto = Watcher.prototype;
|
|
166
|
+
// 发布,触发事件
|
|
167
|
+
_proto.emit = function emit(key) {
|
|
168
|
+
for(var _len = arguments.length, payload = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
169
|
+
payload[_key - 1] = arguments[_key];
|
|
170
|
+
}
|
|
171
|
+
var _this = this;
|
|
172
|
+
return _asyncToGenerator(function() {
|
|
173
|
+
var callbacksOrigin, results, _callbacks, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, callback, result, e, err;
|
|
174
|
+
return __generator(this, function(_state) {
|
|
175
|
+
switch(_state.label){
|
|
176
|
+
case 0:
|
|
177
|
+
callbacksOrigin = _this._events.get(key);
|
|
178
|
+
results = [];
|
|
179
|
+
if (!callbacksOrigin) return [
|
|
180
|
+
3,
|
|
181
|
+
10
|
|
182
|
+
];
|
|
183
|
+
_callbacks = callbacksOrigin.slice();
|
|
184
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
185
|
+
_state.label = 1;
|
|
186
|
+
case 1:
|
|
187
|
+
_state.trys.push([
|
|
188
|
+
1,
|
|
189
|
+
8,
|
|
190
|
+
9,
|
|
191
|
+
10
|
|
192
|
+
]);
|
|
193
|
+
_iterator = _callbacks[Symbol.iterator]();
|
|
194
|
+
_state.label = 2;
|
|
195
|
+
case 2:
|
|
196
|
+
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
197
|
+
3,
|
|
198
|
+
7
|
|
199
|
+
];
|
|
200
|
+
callback = _step.value;
|
|
201
|
+
// 如果在执行期间卸载了对应的事件,则callback在origin里就不存在了,就不再执行
|
|
202
|
+
if (!callbacksOrigin.includes(callback)) {
|
|
203
|
+
return [
|
|
204
|
+
3,
|
|
205
|
+
6
|
|
206
|
+
];
|
|
318
207
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
208
|
+
_state.label = 3;
|
|
209
|
+
case 3:
|
|
210
|
+
_state.trys.push([
|
|
211
|
+
3,
|
|
212
|
+
5,
|
|
213
|
+
,
|
|
214
|
+
6
|
|
215
|
+
]);
|
|
216
|
+
_this.debug && log.apply(void 0, [
|
|
217
|
+
"正在执行 ".concat(key, " 事件: ").concat(callback.applyingPluginName ? "当前执行的插件为:" + callback.applyingPluginName : "", ", 当前执行函数的参数为").concat(payload.map(function() {
|
|
218
|
+
return "%o";
|
|
219
|
+
}).join(","), "。")
|
|
220
|
+
].concat(_toConsumableArray(payload)));
|
|
221
|
+
return [
|
|
222
|
+
4,
|
|
223
|
+
callback.apply(null, _toConsumableArray(payload))
|
|
224
|
+
];
|
|
225
|
+
case 4:
|
|
226
|
+
result = _state.sent();
|
|
227
|
+
_this.debug && log.apply(void 0, [
|
|
228
|
+
"正在执行 ".concat(key, " 事件: ").concat(callback.applyingPluginName ? "当前执行的插件为:" + callback.applyingPluginName : "", ", 当前执行函数的参数为").concat(payload.map(function() {
|
|
229
|
+
return "%o";
|
|
230
|
+
}).join(","), "; 函数的返回结果为%o")
|
|
231
|
+
].concat(_toConsumableArray(payload), [
|
|
232
|
+
result
|
|
233
|
+
]));
|
|
234
|
+
results.push(result);
|
|
235
|
+
if (result === false) {
|
|
236
|
+
return [
|
|
237
|
+
3,
|
|
238
|
+
7
|
|
239
|
+
];
|
|
240
|
+
}
|
|
241
|
+
return [
|
|
242
|
+
3,
|
|
243
|
+
6
|
|
244
|
+
];
|
|
245
|
+
case 5:
|
|
246
|
+
e = _state.sent();
|
|
247
|
+
logerror(String(e));
|
|
248
|
+
return [
|
|
249
|
+
3,
|
|
250
|
+
6
|
|
251
|
+
];
|
|
252
|
+
case 6:
|
|
253
|
+
_iteratorNormalCompletion = true;
|
|
254
|
+
return [
|
|
255
|
+
3,
|
|
256
|
+
2
|
|
257
|
+
];
|
|
258
|
+
case 7:
|
|
259
|
+
return [
|
|
260
|
+
3,
|
|
261
|
+
10
|
|
262
|
+
];
|
|
263
|
+
case 8:
|
|
264
|
+
err = _state.sent();
|
|
265
|
+
_didIteratorError = true;
|
|
266
|
+
_iteratorError = err;
|
|
267
|
+
return [
|
|
268
|
+
3,
|
|
269
|
+
10
|
|
270
|
+
];
|
|
271
|
+
case 9:
|
|
272
|
+
try {
|
|
273
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
274
|
+
_iterator.return();
|
|
275
|
+
}
|
|
276
|
+
} finally{
|
|
277
|
+
if (_didIteratorError) {
|
|
278
|
+
throw _iteratorError;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return [
|
|
282
|
+
7
|
|
283
|
+
];
|
|
284
|
+
case 10:
|
|
285
|
+
return [
|
|
286
|
+
2,
|
|
287
|
+
results
|
|
288
|
+
];
|
|
354
289
|
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
290
|
+
});
|
|
291
|
+
})();
|
|
292
|
+
};
|
|
293
|
+
// 订阅事件
|
|
294
|
+
_proto.on = function on(key, callback) {
|
|
295
|
+
if (this._events.has(key)) {
|
|
296
|
+
var _this__events_get;
|
|
297
|
+
(_this__events_get = this._events.get(key)) === null || _this__events_get === void 0 ? void 0 : _this__events_get.push(callback);
|
|
298
|
+
} else {
|
|
299
|
+
this._events.set(key, [
|
|
300
|
+
callback
|
|
301
|
+
]);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
// 关闭指定的订阅中某一个回调
|
|
305
|
+
_proto.off = function off(key, callback) {
|
|
306
|
+
if (this._events.has(key)) {
|
|
307
|
+
var callbacks = this._events.get(key);
|
|
308
|
+
var index = callbacks === null || callbacks === void 0 ? void 0 : callbacks.indexOf(callback);
|
|
309
|
+
callbacks === null || callbacks === void 0 ? void 0 : callbacks.splice(index, 1);
|
|
363
310
|
}
|
|
364
|
-
|
|
311
|
+
};
|
|
312
|
+
// 清空指定订阅
|
|
313
|
+
_proto.delete = function _delete(key) {
|
|
314
|
+
if (this._events.has(key)) {
|
|
315
|
+
this._events.delete(key);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
// 清空所有订阅
|
|
319
|
+
_proto.clear = function clear() {
|
|
320
|
+
this._events = new Map();
|
|
321
|
+
};
|
|
365
322
|
return Watcher;
|
|
366
323
|
}();
|
|
367
324
|
export { Watcher };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byteluck-fe/model-driven-shared",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1-beta.18",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "郝晨光 <2293885211@qq.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"humps": "^2.0.1",
|
|
31
31
|
"ok-i18n": "^3.0.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "9fac0b8211e339ed54237f7d6642a642fbf4b45e"
|
|
34
34
|
}
|