@byteluck-fe/model-driven-shared 1.7.0 → 1.7.2
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 +1 -1
- package/dist/esm/calc.js +12 -12
- package/dist/esm/watcher.js +191 -88
- package/dist/types/EventLogic.d.ts +1 -1
- package/dist/types/RulesMessage.d.ts +3 -3
- package/package.json +2 -2
package/dist/esm/EventLogic.js
CHANGED
package/dist/esm/calc.js
CHANGED
|
@@ -45,16 +45,16 @@ export var CALC_AGGREGATE_TYPE;
|
|
|
45
45
|
export var CalcScriptEchoItem = function CalcScriptEchoItem(props) {
|
|
46
46
|
"use strict";
|
|
47
47
|
_classCallCheck(this, CalcScriptEchoItem);
|
|
48
|
-
var
|
|
49
|
-
this.name = (
|
|
50
|
-
var
|
|
51
|
-
this.id = (
|
|
52
|
-
var
|
|
53
|
-
this.type = (
|
|
54
|
-
var
|
|
55
|
-
this.subTableId = (
|
|
56
|
-
var
|
|
57
|
-
this.subTableName = (
|
|
58
|
-
var
|
|
59
|
-
this.aggregateType = (
|
|
48
|
+
var _props_name;
|
|
49
|
+
this.name = (_props_name = props === null || props === void 0 ? void 0 : props.name) !== null && _props_name !== void 0 ? _props_name : "";
|
|
50
|
+
var _props_id;
|
|
51
|
+
this.id = (_props_id = props === null || props === void 0 ? void 0 : props.id) !== null && _props_id !== void 0 ? _props_id : "";
|
|
52
|
+
var _props_type;
|
|
53
|
+
this.type = (_props_type = props === null || props === void 0 ? void 0 : props.type) !== null && _props_type !== void 0 ? _props_type : CALC_TOKEN_TYPE.Number;
|
|
54
|
+
var _props_subTableId;
|
|
55
|
+
this.subTableId = (_props_subTableId = props === null || props === void 0 ? void 0 : props.subTableId) !== null && _props_subTableId !== void 0 ? _props_subTableId : undefined;
|
|
56
|
+
var _props_subTableId1;
|
|
57
|
+
this.subTableName = (_props_subTableId1 = props === null || props === void 0 ? void 0 : props.subTableId) !== null && _props_subTableId1 !== void 0 ? _props_subTableId1 : undefined;
|
|
58
|
+
var _props_aggregateType;
|
|
59
|
+
this.aggregateType = (_props_aggregateType = props === null || props === void 0 ? void 0 : props.aggregateType) !== null && _props_aggregateType !== void 0 ? _props_aggregateType : undefined;
|
|
60
60
|
};
|
package/dist/esm/watcher.js
CHANGED
|
@@ -57,7 +57,101 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
57
57
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
58
58
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
61
|
+
var f, y, t, g, _ = {
|
|
62
|
+
label: 0,
|
|
63
|
+
sent: function() {
|
|
64
|
+
if (t[0] & 1) throw t[1];
|
|
65
|
+
return t[1];
|
|
66
|
+
},
|
|
67
|
+
trys: [],
|
|
68
|
+
ops: []
|
|
69
|
+
};
|
|
70
|
+
return g = {
|
|
71
|
+
next: verb(0),
|
|
72
|
+
"throw": verb(1),
|
|
73
|
+
"return": verb(2)
|
|
74
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
75
|
+
return this;
|
|
76
|
+
}), g;
|
|
77
|
+
function verb(n) {
|
|
78
|
+
return function(v) {
|
|
79
|
+
return step([
|
|
80
|
+
n,
|
|
81
|
+
v
|
|
82
|
+
]);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function step(op) {
|
|
86
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
87
|
+
while(_)try {
|
|
88
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
89
|
+
if (y = 0, t) op = [
|
|
90
|
+
op[0] & 2,
|
|
91
|
+
t.value
|
|
92
|
+
];
|
|
93
|
+
switch(op[0]){
|
|
94
|
+
case 0:
|
|
95
|
+
case 1:
|
|
96
|
+
t = op;
|
|
97
|
+
break;
|
|
98
|
+
case 4:
|
|
99
|
+
_.label++;
|
|
100
|
+
return {
|
|
101
|
+
value: op[1],
|
|
102
|
+
done: false
|
|
103
|
+
};
|
|
104
|
+
case 5:
|
|
105
|
+
_.label++;
|
|
106
|
+
y = op[1];
|
|
107
|
+
op = [
|
|
108
|
+
0
|
|
109
|
+
];
|
|
110
|
+
continue;
|
|
111
|
+
case 7:
|
|
112
|
+
op = _.ops.pop();
|
|
113
|
+
_.trys.pop();
|
|
114
|
+
continue;
|
|
115
|
+
default:
|
|
116
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
117
|
+
_ = 0;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
121
|
+
_.label = op[1];
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
125
|
+
_.label = t[1];
|
|
126
|
+
t = op;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
if (t && _.label < t[2]) {
|
|
130
|
+
_.label = t[2];
|
|
131
|
+
_.ops.push(op);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
if (t[2]) _.ops.pop();
|
|
135
|
+
_.trys.pop();
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
op = body.call(thisArg, _);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
op = [
|
|
141
|
+
6,
|
|
142
|
+
e
|
|
143
|
+
];
|
|
144
|
+
y = 0;
|
|
145
|
+
} finally{
|
|
146
|
+
f = t = 0;
|
|
147
|
+
}
|
|
148
|
+
if (op[0] & 5) throw op[1];
|
|
149
|
+
return {
|
|
150
|
+
value: op[0] ? op[1] : void 0,
|
|
151
|
+
done: true
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
};
|
|
61
155
|
import { log, logerror } from "./log";
|
|
62
156
|
// 通信总线
|
|
63
157
|
var Watcher = /*#__PURE__*/ function() {
|
|
@@ -75,43 +169,61 @@ var Watcher = /*#__PURE__*/ function() {
|
|
|
75
169
|
payload[_key - 1] = arguments[_key];
|
|
76
170
|
}
|
|
77
171
|
var _this = this;
|
|
78
|
-
return _asyncToGenerator(
|
|
79
|
-
var callbacksOrigin, results, _callbacks, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, callback, result;
|
|
80
|
-
return
|
|
81
|
-
|
|
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){
|
|
82
176
|
case 0:
|
|
83
177
|
callbacksOrigin = _this._events.get(key);
|
|
84
178
|
results = [];
|
|
85
|
-
if (!callbacksOrigin)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
179
|
+
if (!callbacksOrigin) return [
|
|
180
|
+
3,
|
|
181
|
+
10
|
|
182
|
+
];
|
|
89
183
|
_callbacks = callbacksOrigin.slice();
|
|
90
184
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
91
|
-
|
|
185
|
+
_state.label = 1;
|
|
186
|
+
case 1:
|
|
187
|
+
_state.trys.push([
|
|
188
|
+
1,
|
|
189
|
+
8,
|
|
190
|
+
9,
|
|
191
|
+
10
|
|
192
|
+
]);
|
|
92
193
|
_iterator = _callbacks[Symbol.iterator]();
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
194
|
+
_state.label = 2;
|
|
195
|
+
case 2:
|
|
196
|
+
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
197
|
+
3,
|
|
198
|
+
7
|
|
199
|
+
];
|
|
98
200
|
callback = _step.value;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
201
|
+
// 如果在执行期间卸载了对应的事件,则callback在origin里就不存在了,就不再执行
|
|
202
|
+
if (!callbacksOrigin.includes(callback)) {
|
|
203
|
+
return [
|
|
204
|
+
3,
|
|
205
|
+
6
|
|
206
|
+
];
|
|
102
207
|
}
|
|
103
|
-
|
|
104
|
-
case
|
|
105
|
-
|
|
208
|
+
_state.label = 3;
|
|
209
|
+
case 3:
|
|
210
|
+
_state.trys.push([
|
|
211
|
+
3,
|
|
212
|
+
5,
|
|
213
|
+
,
|
|
214
|
+
6
|
|
215
|
+
]);
|
|
106
216
|
_this.debug && log.apply(void 0, [
|
|
107
217
|
"正在执行 ".concat(key, " 事件: ").concat(callback.applyingPluginName ? "当前执行的插件为:" + callback.applyingPluginName : "", ", 当前执行函数的参数为").concat(payload.map(function() {
|
|
108
218
|
return "%o";
|
|
109
219
|
}).join(","), "。")
|
|
110
220
|
].concat(_toConsumableArray(payload)));
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
221
|
+
return [
|
|
222
|
+
4,
|
|
223
|
+
callback.apply(null, _toConsumableArray(payload))
|
|
224
|
+
];
|
|
225
|
+
case 4:
|
|
226
|
+
result = _state.sent();
|
|
115
227
|
_this.debug && log.apply(void 0, [
|
|
116
228
|
"正在执行 ".concat(key, " 事件: ").concat(callback.applyingPluginName ? "当前执行的插件为:" + callback.applyingPluginName : "", ", 当前执行函数的参数为").concat(payload.map(function() {
|
|
117
229
|
return "%o";
|
|
@@ -120,78 +232,69 @@ var Watcher = /*#__PURE__*/ function() {
|
|
|
120
232
|
result
|
|
121
233
|
]));
|
|
122
234
|
results.push(result);
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
235
|
+
if (result === false) {
|
|
236
|
+
return [
|
|
237
|
+
3,
|
|
238
|
+
7
|
|
239
|
+
];
|
|
126
240
|
}
|
|
127
|
-
return
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
case
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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:
|
|
136
253
|
_iteratorNormalCompletion = true;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
254
|
+
return [
|
|
255
|
+
3,
|
|
256
|
+
2
|
|
257
|
+
];
|
|
258
|
+
case 7:
|
|
259
|
+
return [
|
|
260
|
+
3,
|
|
261
|
+
10
|
|
262
|
+
];
|
|
263
|
+
case 8:
|
|
264
|
+
err = _state.sent();
|
|
145
265
|
_didIteratorError = true;
|
|
146
|
-
_iteratorError =
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
+
}
|
|
152
280
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return _ctx.finish(37);
|
|
162
|
-
case 41:
|
|
163
|
-
return _ctx.finish(34);
|
|
164
|
-
case 42:
|
|
165
|
-
return _ctx.abrupt("return", results);
|
|
166
|
-
case 43:
|
|
167
|
-
case "end":
|
|
168
|
-
return _ctx.stop();
|
|
281
|
+
return [
|
|
282
|
+
7
|
|
283
|
+
];
|
|
284
|
+
case 10:
|
|
285
|
+
return [
|
|
286
|
+
2,
|
|
287
|
+
results
|
|
288
|
+
];
|
|
169
289
|
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
5,
|
|
173
|
-
30,
|
|
174
|
-
34,
|
|
175
|
-
42
|
|
176
|
-
],
|
|
177
|
-
[
|
|
178
|
-
11,
|
|
179
|
-
22
|
|
180
|
-
],
|
|
181
|
-
[
|
|
182
|
-
35,
|
|
183
|
-
,
|
|
184
|
-
37,
|
|
185
|
-
41
|
|
186
|
-
]
|
|
187
|
-
]);
|
|
188
|
-
}))();
|
|
290
|
+
});
|
|
291
|
+
})();
|
|
189
292
|
};
|
|
190
293
|
// 订阅事件
|
|
191
294
|
_proto.on = function on(key, callback) {
|
|
192
295
|
if (this._events.has(key)) {
|
|
193
|
-
var
|
|
194
|
-
(
|
|
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);
|
|
195
298
|
} else {
|
|
196
299
|
this._events.set(key, [
|
|
197
300
|
callback
|
|
@@ -93,7 +93,7 @@ declare const eventMap: readonly [{
|
|
|
93
93
|
readonly name: "行选中时";
|
|
94
94
|
readonly code: "list-rows-checked";
|
|
95
95
|
}];
|
|
96
|
-
export
|
|
96
|
+
export type InnerEventCode = typeof eventMap[number]['code'];
|
|
97
97
|
export declare class EventLogic {
|
|
98
98
|
static readonly events: readonly [{
|
|
99
99
|
readonly key: "on_click";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import OkI18n from 'ok-i18n';
|
|
2
2
|
import messages from './locales';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
type Message = Partial<typeof messages['zhCN']>;
|
|
4
|
+
type Keys = 'caption' | 'placeholder' | 'max' | 'min';
|
|
5
|
+
type Variable = {
|
|
6
6
|
[key in Keys]?: string | number;
|
|
7
7
|
};
|
|
8
8
|
export declare class RulesMessage {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byteluck-fe/model-driven-shared",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "郝晨光 <2293885211@qq.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"humps": "^2.0.1",
|
|
26
26
|
"ok-i18n": "^3.0.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "42bef5297f1cde97a497b176798d8cc3d2605af6"
|
|
29
29
|
}
|