efront 3.15.2 → 3.16.0
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/apps/pivot/log/boot.js +32 -3
- package/coms/basic/JSAM.js +54 -15
- package/coms/basic/cross_.js +6 -1
- package/coms/basic/loader.js +2 -2
- package/coms/basic/matrix.js +51 -28
- package/coms/basic/parseYML.js +1 -1
- package/coms/basic/renderExpress.js +3 -3
- package/coms/frame/route.js +54 -17
- package/coms/zimoli/data.js +1 -6
- package/coms/zimoli/dispatch.js +13 -1
- package/coms/zimoli/getValue.js +1 -1
- package/coms/zimoli/menu.js +24 -0
- package/coms/zimoli/menuItem.html +4 -1
- package/coms/zimoli/menuItem.js +7 -0
- package/coms/zimoli/menuItem.less +23 -2
- package/coms/zimoli/menuList.js +24 -18
- package/coms/zimoli/moveupon.js +6 -4
- package/coms/zimoli/on.js +173 -162
- package/coms/zimoli/picture_.js +2 -0
- package/coms/zimoli/render.js +7 -3
- package/data/packexe-setup.sfx +0 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/apps/pivot/log/boot.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
cross.addDirect(/^https?\:\/\/([[a-z\.\d\:\/%]+\]|[\d\.]+)(\:\d+)?\//);
|
|
1
2
|
var fields = refilm`
|
|
2
3
|
地址/ip
|
|
3
4
|
地理位置/ip ${function (e) {
|
|
@@ -20,9 +21,37 @@ var fields = refilm`
|
|
|
20
21
|
启动时间/time ${function (e) {
|
|
21
22
|
e.innerHTML = filterTime(e.data[e.field.key]);
|
|
22
23
|
}}
|
|
23
|
-
端口/port
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
端口/port ${async function (e) {
|
|
25
|
+
var { data, field } = e;
|
|
26
|
+
var ports = data[field.key].split(/,/);
|
|
27
|
+
var loaded = [];
|
|
28
|
+
for (var p of ports) {
|
|
29
|
+
var p0 = p;
|
|
30
|
+
var protocol = /^https/.test(p) ? "https://" : "http://";
|
|
31
|
+
p = p.replace(/[^\d]+/g, '');
|
|
32
|
+
if (p) p = ":" + p;
|
|
33
|
+
try {
|
|
34
|
+
var ip = data.ip;
|
|
35
|
+
if (/^::ffff:\d+\.\d+\.\d+\.\d+$/i.test(ip)) {
|
|
36
|
+
ip = ip.slice(7);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
ip = `[${ip}]`;
|
|
40
|
+
}
|
|
41
|
+
var xhr = await cross("options", `${protocol}${ip}${p}/:version`);
|
|
42
|
+
if (xhr.responseText === 'efront ' + data.version) {
|
|
43
|
+
loaded.push(`<span style="color:green">${p0}</span>`);
|
|
44
|
+
} else {
|
|
45
|
+
loaded.push(`<span style="color:red">${p0}</span>`);
|
|
46
|
+
}
|
|
47
|
+
} catch (e) {
|
|
48
|
+
loaded.push(`<span style="color:gray">${p0}</span>`);
|
|
49
|
+
}
|
|
50
|
+
e.innerHTML = loaded.join('');
|
|
51
|
+
}
|
|
52
|
+
}}
|
|
53
|
+
版本 / version text
|
|
54
|
+
进程 / pid
|
|
26
55
|
`;
|
|
27
56
|
function main() {
|
|
28
57
|
var page = div();
|
package/coms/basic/JSAM.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var isEmpty = require("./isEmpty");
|
|
1
2
|
var convertReg = /^(?:object|function)$/;
|
|
2
3
|
var check = function (o) {
|
|
3
4
|
return o === null || typeof o === 'bigint' || o instanceof BigInt || typeof o === 'number' || typeof o === "boolean";
|
|
@@ -24,16 +25,23 @@ var join = function (o) {
|
|
|
24
25
|
if (o instanceof RegExp) return regexp(o);
|
|
25
26
|
var arr = o[""];
|
|
26
27
|
delete o[""];
|
|
28
|
+
var typeid = o._;
|
|
29
|
+
delete o._;
|
|
27
30
|
var pairs = [].concat(arr);
|
|
28
31
|
for (var k in o) {
|
|
29
32
|
pairs.push(k + ':' + o[k]);
|
|
30
33
|
}
|
|
34
|
+
var s;
|
|
31
35
|
if (o instanceof Array) {
|
|
32
|
-
|
|
36
|
+
s = `[${pairs.join(',')}]`;
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
38
|
+
else {
|
|
39
|
+
s = `{${pairs.join(',')}}`;
|
|
40
|
+
}
|
|
41
|
+
if (typeid > 0) s = typeid + s;
|
|
42
|
+
return s;
|
|
43
|
+
};
|
|
44
|
+
function stringify(memery, preload) {
|
|
37
45
|
if (memery === undefined) return '';
|
|
38
46
|
if (check(memery)) return String(memery);
|
|
39
47
|
if (typeof memery === 'symbol') return symbol(memery);
|
|
@@ -48,15 +56,18 @@ function stringify(memery) {
|
|
|
48
56
|
var rest = [memery];
|
|
49
57
|
var trimed = [memery instanceof Array ? [] : {}];
|
|
50
58
|
var objects = [trimed[0]];
|
|
59
|
+
if (!isEmpty(preload)) dist = dist.concat(preload);
|
|
51
60
|
while (rest.length) {
|
|
52
61
|
var memery = rest.shift();
|
|
53
62
|
var o = objects.shift();
|
|
54
63
|
var inc = 0, arr = [];
|
|
55
64
|
o[""] = arr;
|
|
65
|
+
o._ = dist.indexOf(memery.constructor);
|
|
56
66
|
for (var k in memery) {
|
|
57
67
|
var m = memery[k];
|
|
58
68
|
f: if (typeof m === 'function') {
|
|
59
69
|
for (var k in m) break f;
|
|
70
|
+
if (dist.indexOf(m) >= 0) break f;
|
|
60
71
|
continue;
|
|
61
72
|
}
|
|
62
73
|
if (inc === +k && k !== '') {
|
|
@@ -101,7 +112,9 @@ function stringify(memery) {
|
|
|
101
112
|
}
|
|
102
113
|
}
|
|
103
114
|
}
|
|
104
|
-
|
|
115
|
+
var result = trimed.map(join).join(',');
|
|
116
|
+
if (trimed.length === 1) result += ',';
|
|
117
|
+
return result;
|
|
105
118
|
}
|
|
106
119
|
var create = function (a, dst) {
|
|
107
120
|
if (!a) return;
|
|
@@ -117,9 +130,10 @@ var create = function (a, dst) {
|
|
|
117
130
|
}
|
|
118
131
|
dst[""] = rest;
|
|
119
132
|
};
|
|
120
|
-
function parse(string) {
|
|
133
|
+
function parse(string, preload) {
|
|
121
134
|
string = String(string);
|
|
122
135
|
var trimed = [];
|
|
136
|
+
var reg0 = /\d+/g;
|
|
123
137
|
var reg1 = /\}/g;
|
|
124
138
|
var reg2 = /\]/g;
|
|
125
139
|
var reg3 = /\\[\s\S]|"/g;
|
|
@@ -130,6 +144,18 @@ function parse(string) {
|
|
|
130
144
|
for (var cx = 0, dx = string.length; cx < dx; cx++) {
|
|
131
145
|
var s = string.charAt(cx);
|
|
132
146
|
var reg = null, o = null;
|
|
147
|
+
reg0.lastIndex = 0;
|
|
148
|
+
var typeid = 0;
|
|
149
|
+
var m = reg0.test(string.charAt(cx));
|
|
150
|
+
if (m) {
|
|
151
|
+
reg0.lastIndex = cx;
|
|
152
|
+
var m = reg0.exec(string);
|
|
153
|
+
if (/^[\[\{]$/.test(string.charAt(reg0.lastIndex))) {
|
|
154
|
+
typeid = +m[0];
|
|
155
|
+
cx = reg0.lastIndex;
|
|
156
|
+
s = string.charAt(reg0.lastIndex);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
133
159
|
switch (s) {
|
|
134
160
|
case ",":
|
|
135
161
|
trimed.push(undefined);
|
|
@@ -148,6 +174,15 @@ function parse(string) {
|
|
|
148
174
|
marked.push(trimed.length);
|
|
149
175
|
trimed.push(o);
|
|
150
176
|
cx = reg.lastIndex;
|
|
177
|
+
if (typeid) {
|
|
178
|
+
o._ = typeid;
|
|
179
|
+
}
|
|
180
|
+
if (/\d/.test(string.charAt(cx))) {
|
|
181
|
+
reg4.lastIndex = cx;
|
|
182
|
+
var m = reg4.exec(string);
|
|
183
|
+
o._ = typeid || string.slice(cx, m.index);
|
|
184
|
+
cx = reg4.lastIndex;
|
|
185
|
+
}
|
|
151
186
|
break;
|
|
152
187
|
case "/":
|
|
153
188
|
reg = reg5;
|
|
@@ -176,8 +211,6 @@ function parse(string) {
|
|
|
176
211
|
}
|
|
177
212
|
trimed.push(s);
|
|
178
213
|
break;
|
|
179
|
-
case "/":
|
|
180
|
-
break;
|
|
181
214
|
default:
|
|
182
215
|
reg4.lastIndex = cx + 1;
|
|
183
216
|
var match = reg4.exec(string);
|
|
@@ -213,15 +246,21 @@ function parse(string) {
|
|
|
213
246
|
trimed.push(s);
|
|
214
247
|
}
|
|
215
248
|
}
|
|
216
|
-
var dist = trimed
|
|
249
|
+
var dist = [trimed[0]];
|
|
250
|
+
if (!isEmpty(preload)) dist = dist.concat(preload);
|
|
251
|
+
var preloads_length = dist.length - 1;
|
|
252
|
+
dist = dist.concat(trimed.slice(1, trimed.length));
|
|
217
253
|
for (var cx = 0, dx = marked.length; cx < dx; cx++) {
|
|
218
254
|
var index = marked[cx];
|
|
219
255
|
var o = trimed[index];
|
|
220
|
-
|
|
256
|
+
if (index > 0) index += preloads_length;
|
|
257
|
+
if (o._ > 0) dist[index] = Object.create(dist[o._].prototype);
|
|
258
|
+
else dist[index] = o instanceof Array ? [] : {};
|
|
221
259
|
}
|
|
222
260
|
for (var cx = 0, dx = marked.length; cx < dx; cx++) {
|
|
223
261
|
var index = marked[cx];
|
|
224
262
|
var o = trimed[index];
|
|
263
|
+
if (index > 0) index += preloads_length;
|
|
225
264
|
var t = dist[index];
|
|
226
265
|
var arr = o[""];
|
|
227
266
|
delete o[""];
|
|
@@ -237,10 +276,10 @@ function parse(string) {
|
|
|
237
276
|
}
|
|
238
277
|
module.exports = {
|
|
239
278
|
stringify,
|
|
240
|
-
parse(data) {
|
|
241
|
-
if (!/^\s*([\[\{]|\[\s*\]|\{\s*\})/.test(data)) return parse(data);
|
|
242
|
-
if (/^\s*\{[\d\,\:\s]*\}\s*,/.test(data)) return parse(data);
|
|
243
|
-
if (/^\s*\[[\d\,\:\s]*\]\s*,/.test(data)) return parse(data);
|
|
244
|
-
return JSON.parse(data);
|
|
279
|
+
parse(data, preload) {
|
|
280
|
+
if (!/^\s*([\[\{]|\[\s*\]|\{\s*\})/.test(data)) return parse(data, preload);
|
|
281
|
+
if (/^\s*\{[\d\,\:\s]*\}\s*,/.test(data)) return parse(data, preload);
|
|
282
|
+
if (/^\s*\[[\d\,\:\s]*\]\s*,/.test(data)) return parse(data, preload);
|
|
283
|
+
return JSON.parse(data, preload);
|
|
245
284
|
}
|
|
246
285
|
};
|
package/coms/basic/cross_.js
CHANGED
|
@@ -114,7 +114,7 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
114
114
|
else {
|
|
115
115
|
var nocross = notCross(url);
|
|
116
116
|
var callback = function () {
|
|
117
|
-
var exposeHeaders = xhr.getResponseHeader("access-control-expose-headers");
|
|
117
|
+
var exposeHeaders = !nocross && xhr.getResponseHeader("access-control-expose-headers");
|
|
118
118
|
var exposeMap = {};
|
|
119
119
|
if (exposeHeaders) exposeHeaders.split(",").forEach(h => exposeMap[h.toLowerCase()] = true);
|
|
120
120
|
if (xhr.getResponseHeader) {
|
|
@@ -132,6 +132,11 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
132
132
|
}
|
|
133
133
|
case 200:
|
|
134
134
|
case 201:
|
|
135
|
+
case 202:
|
|
136
|
+
case 203:
|
|
137
|
+
case 204:
|
|
138
|
+
case 205:
|
|
139
|
+
case 206:
|
|
135
140
|
case 304:
|
|
136
141
|
onload(xhr);
|
|
137
142
|
break;
|
package/coms/basic/loader.js
CHANGED
|
@@ -230,7 +230,7 @@ var killCircle = function () {
|
|
|
230
230
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
231
231
|
var loadModule = function (name, then, prebuilds = {}) {
|
|
232
232
|
if (/^(?:module|exports|define|require|window|global|undefined|__dirname|__filename)$/.test(name)) return then();
|
|
233
|
-
if ((name in prebuilds) || hasOwnProperty.call(modules, name) || (window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name))
|
|
233
|
+
if ((name in prebuilds) || hasOwnProperty.call(modules, name) || (!/^on/.test(name) && window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name))
|
|
234
234
|
) return then();
|
|
235
235
|
preLoad(name);
|
|
236
236
|
var key = keyprefix + name;
|
|
@@ -545,7 +545,7 @@ var init = function (name, then, prebuilds) {
|
|
|
545
545
|
if (then) then(modules[name]);
|
|
546
546
|
return modules[name];
|
|
547
547
|
}
|
|
548
|
-
if (window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name)) {
|
|
548
|
+
if (!/^on/.test(name) && window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name)) {
|
|
549
549
|
modules[name] = window[name]
|
|
550
550
|
if (then) then(modules[name]);
|
|
551
551
|
return modules[name];
|
package/coms/basic/matrix.js
CHANGED
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
// end
|
|
33
33
|
// end
|
|
34
34
|
"use strict";
|
|
35
|
-
|
|
36
35
|
var notMatchLength = new Error("矩阵长度不一致");
|
|
37
|
-
|
|
36
|
+
|
|
37
|
+
function transform(B, dots) {
|
|
38
38
|
var dimention = Math.sqrt(B.length - 1) | 0;
|
|
39
39
|
if (dots.length % dimention !== 0) throw notMatchLength;
|
|
40
40
|
if (dots === B) B = B.slice(0);
|
|
@@ -43,10 +43,11 @@ function transform(dots, B) {
|
|
|
43
43
|
for (var cx = 0, dx = dots.length; cx < dx; cx += dimention) {
|
|
44
44
|
for (var cy = 0, dy = dimention; cy < dy; cy++) {
|
|
45
45
|
var sum = 0;
|
|
46
|
+
var start = dim2 * cy;
|
|
46
47
|
for (var ct = 0, dt = dimention; ct < dt; ct++) {
|
|
47
|
-
sum += ds[cx + ct] * B[
|
|
48
|
+
sum += ds[cx + ct] * B[start + ct];
|
|
48
49
|
}
|
|
49
|
-
sum += B[
|
|
50
|
+
sum += B[start + dimention];
|
|
50
51
|
dots[cx + cy] = sum;
|
|
51
52
|
}
|
|
52
53
|
}
|
|
@@ -56,13 +57,12 @@ function transform(dots, B) {
|
|
|
56
57
|
function translate(A, delta) {
|
|
57
58
|
var [dim2, dim] = size(A);
|
|
58
59
|
var inc = 0;
|
|
59
|
-
for (var cx = dim
|
|
60
|
+
for (var cx = dim, dx = dim * dim2; cx < dx; cx += dim2) {
|
|
60
61
|
A[cx] = (A[cx] || 0) + delta[inc++];
|
|
61
62
|
}
|
|
62
63
|
return A;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
|
|
66
66
|
function 负(a) {
|
|
67
67
|
return -a;
|
|
68
68
|
}
|
|
@@ -76,7 +76,7 @@ function multiply(A, B) {
|
|
|
76
76
|
for (var cy = 0, dy = dim; cy < dy; cy++) {
|
|
77
77
|
var sum = 0;
|
|
78
78
|
for (var ct = 0, dt = dim; ct < dt; ct++) {
|
|
79
|
-
sum +=
|
|
79
|
+
sum += B[cx + ct] * X[ct * dim + cy];
|
|
80
80
|
}
|
|
81
81
|
A[cx + cy] = sum;
|
|
82
82
|
}
|
|
@@ -132,15 +132,17 @@ function olinde(v, vector) {
|
|
|
132
132
|
}
|
|
133
133
|
return v;
|
|
134
134
|
}
|
|
135
|
+
|
|
135
136
|
function matrix2d(theta) {
|
|
136
137
|
var cosa = Math.cos(theta);
|
|
137
138
|
var sina = Math.sin(theta);
|
|
138
139
|
return new Matrix(
|
|
139
|
-
cosa, sina, 0,
|
|
140
|
-
|
|
140
|
+
cosa, -sina, 0,
|
|
141
|
+
sina, cosa, 0,
|
|
141
142
|
0, 0, 1
|
|
142
143
|
);
|
|
143
|
-
}
|
|
144
|
+
}
|
|
145
|
+
|
|
144
146
|
function matrix3d(factor) {
|
|
145
147
|
var theta = norm(factor);
|
|
146
148
|
var vec = times(factor, 1 / theta);
|
|
@@ -150,9 +152,9 @@ function matrix3d(factor) {
|
|
|
150
152
|
var [x_u, y_u, z_u] = factor ? [0, 0, 1] : vec;
|
|
151
153
|
|
|
152
154
|
return new Matrix(
|
|
153
|
-
cosa + x_u * x_u * vera, x_u * y_u * vera
|
|
154
|
-
x_u * y_u * vera
|
|
155
|
-
x_u * z_u * vera
|
|
155
|
+
cosa + x_u * x_u * vera, x_u * y_u * vera + z_u * sina, x_u * z_u * vera - y_u * sina, 0,
|
|
156
|
+
x_u * y_u * vera - z_u * sina, cosa + y_u * y_u * vera, y_u * z_u * vera + x_u * sina, 0,
|
|
157
|
+
x_u * z_u * vera + y_u * sina, y_u * z_u * vera - x_u * sina, cosa + z_u * z_u * vera, 0,
|
|
156
158
|
0, 0, 0, 1
|
|
157
159
|
);
|
|
158
160
|
}
|
|
@@ -173,42 +175,47 @@ var 逆 = function (A) {
|
|
|
173
175
|
A.push.apply(A, E);
|
|
174
176
|
for (var cx = 0, dx = dim; cx < dx; cx++) {
|
|
175
177
|
var start = cx * dim + cx;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
var max_ct, v = 0;
|
|
179
|
+
for (var ct = start, dt = cx * dim + dim; ct < dt; ct++) {
|
|
180
|
+
var v0 = Math.abs(X[ct]);
|
|
181
|
+
if (v0 > v) {
|
|
182
|
+
max_ct = ct;
|
|
183
|
+
v = v0;
|
|
184
|
+
}
|
|
178
185
|
}
|
|
186
|
+
ct = max_ct;
|
|
179
187
|
if (ct !== start) {
|
|
180
188
|
var delta = ct - start;
|
|
181
|
-
var ratio = 1 / X[ct];
|
|
182
|
-
for (var cy = cx
|
|
189
|
+
var ratio = (1 - X[start]) / X[ct];
|
|
190
|
+
for (var cy = cx, dy = X.length; cy < dy; cy += dim) {
|
|
183
191
|
X[cy] += X[cy + delta] * ratio;
|
|
184
192
|
A[cy] += A[cy + delta] * ratio;
|
|
185
193
|
}
|
|
186
194
|
}
|
|
187
195
|
if (X[start] !== 1) {
|
|
188
|
-
var delta = ct - start;
|
|
189
196
|
var ratio = 1 / X[start];
|
|
190
|
-
for (var cy = cx
|
|
197
|
+
for (var cy = cx, dy = X.length; cy < dy; cy += dim) {
|
|
191
198
|
X[cy] *= ratio;
|
|
192
199
|
A[cy] *= ratio;
|
|
193
200
|
}
|
|
194
201
|
}
|
|
195
|
-
for (var ct = start +
|
|
202
|
+
for (var ct = start + 1, dt = start + dim - cx; ct < dt; ct++) {
|
|
196
203
|
if (X[ct] === 0) continue;
|
|
197
204
|
var ratio = -X[ct];
|
|
198
205
|
var delta = start - ct;
|
|
199
|
-
for (var cy = ct -
|
|
206
|
+
for (var cy = cx + ct - start, dy = X.length; cy < dy; cy += dim) {
|
|
200
207
|
X[cy] += X[cy + delta] * ratio;
|
|
201
208
|
A[cy] += A[cy + delta] * ratio;
|
|
202
209
|
}
|
|
203
210
|
}
|
|
204
211
|
}
|
|
205
|
-
for (var cx = dim -
|
|
206
|
-
var start = cx * dim + cx
|
|
207
|
-
for (var ct = start; ct >=
|
|
212
|
+
for (var cx = dim - 1; cx >= 0; cx--) {
|
|
213
|
+
var start = cx * dim + cx;
|
|
214
|
+
for (var ct = start - 1, dt = start - cx; ct >= dt; ct--) {
|
|
208
215
|
if (X[ct] === 0) continue;
|
|
209
216
|
var ratio = -X[ct];
|
|
210
|
-
var delta =
|
|
211
|
-
for (var cy = cx
|
|
217
|
+
var delta = start - ct;
|
|
218
|
+
for (var cy = cx + ct - start, dy = X.length; cy < dy; cy += dim) {
|
|
212
219
|
X[cy] += X[cy + delta] * ratio;
|
|
213
220
|
A[cy] += A[cy + delta] * ratio;
|
|
214
221
|
}
|
|
@@ -245,6 +252,19 @@ class Matrix extends Array {
|
|
|
245
252
|
if (this._invert) return this._invert;
|
|
246
253
|
return this._invert = this.slice().inverse();
|
|
247
254
|
}
|
|
255
|
+
transpose() {
|
|
256
|
+
var [size] = this.size();
|
|
257
|
+
for (var cx = 0, dx = size; cx < dx; cx++) {
|
|
258
|
+
for (var cy = cx + 1, dy = dx; cy < dy; cy++) {
|
|
259
|
+
var i = cx * size + cy;
|
|
260
|
+
var j = cy * size + cx;
|
|
261
|
+
var tmp = this[i];
|
|
262
|
+
this[i] = this[j];
|
|
263
|
+
this[j] = tmp;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
248
268
|
inverse() {
|
|
249
269
|
this.dirty();
|
|
250
270
|
return 逆(this);
|
|
@@ -276,8 +296,11 @@ class Matrix extends Array {
|
|
|
276
296
|
return multiply(this, a);
|
|
277
297
|
}
|
|
278
298
|
transform(dots) {
|
|
279
|
-
if (dots instanceof Array) return transform(
|
|
280
|
-
if (
|
|
299
|
+
if (dots instanceof Array) return transform(this, dots);
|
|
300
|
+
if (arguments.length > 1) {
|
|
301
|
+
var a = Array.prototype.slice.apply(arguments, 0);
|
|
302
|
+
return transform(this, a);
|
|
303
|
+
}
|
|
281
304
|
return dots;
|
|
282
305
|
}
|
|
283
306
|
}
|
package/coms/basic/parseYML.js
CHANGED
|
@@ -11,8 +11,8 @@ function createSeek(express) {
|
|
|
11
11
|
return dist;
|
|
12
12
|
}
|
|
13
13
|
function main(express) {
|
|
14
|
-
if (!/\?\s*\.(?=[^\d])
|
|
15
|
-
var reg = /\\[\s\S]|\?\s*(\.(?!\d))|[\:\,\+\=\-\!%\^\|\/\&\*\!\;\?\>\<~\{\}\[\]\(\)'"`\s]/g;
|
|
14
|
+
if (!/\?\s*\.(?=[^\d])|\?$/.test(express)) return express;
|
|
15
|
+
var reg = /\\[\s\S]|\?\s*(\.(?!\d)|\s*$)|[\:\,\+\=\-\!%\^\|\/\&\*\!\;\?\>\<~\{\}\[\]\(\)'"`\s]/g;
|
|
16
16
|
var cache = [], queue = [];
|
|
17
17
|
var exp = [];
|
|
18
18
|
var instr = false;
|
|
@@ -81,7 +81,7 @@ function main(express) {
|
|
|
81
81
|
add_exp(str);
|
|
82
82
|
}
|
|
83
83
|
lastIndex = match.index + m.length;
|
|
84
|
-
if (match[1]) {
|
|
84
|
+
if (match[1] !== undefined) {
|
|
85
85
|
exp.push(match[1]);
|
|
86
86
|
}
|
|
87
87
|
else if (/[\[\{\(]/.test(m)) {
|
package/coms/frame/route.js
CHANGED
|
@@ -3,6 +3,50 @@
|
|
|
3
3
|
var menuid = 0;
|
|
4
4
|
var savedChildren = Object.create(null);
|
|
5
5
|
var savedMenus = Object.create(null);
|
|
6
|
+
var keymap = {};
|
|
7
|
+
var parseName = function (k) {
|
|
8
|
+
var icon, name, hotkey;
|
|
9
|
+
if (/(^|\s+)\./.test(k)) {
|
|
10
|
+
k = k.replace(/(?:^|\s+)\.([^\s,"'`]+)/, (_, m) => {
|
|
11
|
+
icon = m;
|
|
12
|
+
return '';
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
if (/(^|\s+)[\/\\]/.test(k)) {
|
|
16
|
+
k = k.replace(/(?:^|\s+)[\/\\]([\s\S]+)$/, (_, m) => {
|
|
17
|
+
hotkey = m;
|
|
18
|
+
return '';
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (/^(["'`])[\s\S]*\1/.test(k)) {
|
|
22
|
+
k = k.replace(/(['"`])[\s\S]\1/, (m) => {
|
|
23
|
+
name = strings.decode(m);
|
|
24
|
+
return '';
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (/,/.test(k)) {
|
|
28
|
+
var [k, ...roles] = k.split(',');
|
|
29
|
+
}
|
|
30
|
+
if (!icon && /\s+|\./.test(k)) {
|
|
31
|
+
[icon] = k.split(/\s+/);
|
|
32
|
+
k = k.slice(icon.length).trim();
|
|
33
|
+
}
|
|
34
|
+
if (!name) name = k;
|
|
35
|
+
var item = {};
|
|
36
|
+
if (icon) item.icon = icon.replace(/\./g, ' ');
|
|
37
|
+
if (name) item.name = name;
|
|
38
|
+
if (hotkey) {
|
|
39
|
+
hotkey = hotkey.split(',');
|
|
40
|
+
for (var k of hotkey) {
|
|
41
|
+
k = k.trim().toLowerCase().replace(/[\+\_\s]+/g, '.');
|
|
42
|
+
if (keymap[k]) console.warn("检查到两个项菜单使用了相同的快捷键", item, keymap[k]);
|
|
43
|
+
keymap[k] = item;
|
|
44
|
+
}
|
|
45
|
+
item.hotkey = hotkey;
|
|
46
|
+
}
|
|
47
|
+
if (roles) item.roles = roles;
|
|
48
|
+
return item;
|
|
49
|
+
}
|
|
6
50
|
var getChildren = function (menu) {
|
|
7
51
|
if (!menu.id) {
|
|
8
52
|
menu.id = ++menuid;
|
|
@@ -52,29 +96,17 @@
|
|
|
52
96
|
|
|
53
97
|
items = keys.map(k => {
|
|
54
98
|
var c = items[k];
|
|
55
|
-
var item =
|
|
99
|
+
var item = parseName(k);
|
|
56
100
|
if (c instanceof Object) {
|
|
57
101
|
item.children = parseMenuList(c);
|
|
58
102
|
}
|
|
59
103
|
else if (typeof c === 'string') {
|
|
60
104
|
var [path, data] = c.split(/\?/);
|
|
105
|
+
if (data) data = data.trim();
|
|
61
106
|
}
|
|
62
|
-
|
|
63
|
-
if (icon.length < k.length) {
|
|
64
|
-
item.icon = icon;
|
|
65
|
-
var name = k.slice(icon.length).trim();
|
|
66
|
-
} else name = k;
|
|
67
|
-
if (/,/.test(name)) {
|
|
68
|
-
var [name, ...roles] = name.split(',');
|
|
69
|
-
}
|
|
70
|
-
if (/^\-+$/.test(name)) item.line = true;
|
|
71
|
-
else item.name = name;
|
|
72
|
-
if (roles) item.roles = roles;
|
|
107
|
+
if (/^\-+$/.test(item.name)) item.line = true;
|
|
73
108
|
if (path) item.path = path;
|
|
74
109
|
if (data) item.params = parseKV(data);
|
|
75
|
-
if (/,/.test(name)) {
|
|
76
|
-
|
|
77
|
-
}
|
|
78
110
|
item.closed = true;
|
|
79
111
|
return item;
|
|
80
112
|
});
|
|
@@ -85,7 +117,7 @@
|
|
|
85
117
|
result.update = function (items) {
|
|
86
118
|
delete result.loading_promise;
|
|
87
119
|
delete result.then;
|
|
88
|
-
items =
|
|
120
|
+
items = result.parse(items);
|
|
89
121
|
items.map(getChildren);
|
|
90
122
|
var opened = data.getInstance("menu-opened");
|
|
91
123
|
var historys = zimoli.getCurrentHistory();
|
|
@@ -198,7 +230,12 @@
|
|
|
198
230
|
result.then = then;
|
|
199
231
|
return result;
|
|
200
232
|
};
|
|
201
|
-
result.parse =
|
|
233
|
+
result.parse = function (items) {
|
|
234
|
+
keymap = {};
|
|
235
|
+
items = parseMenuList(items);
|
|
236
|
+
items.keymap = keymap;
|
|
237
|
+
return items;
|
|
238
|
+
};
|
|
202
239
|
var then = function (ok, oh) {
|
|
203
240
|
if (this.loading_promise) {
|
|
204
241
|
return this.loading_promise.then(ok, oh);
|
package/coms/zimoli/data.js
CHANGED
|
@@ -571,10 +571,8 @@ var privates = {
|
|
|
571
571
|
headers = seekFromSource(headers, api.base);
|
|
572
572
|
}
|
|
573
573
|
cross(realmethod, uri, headers).send(params).done(e => {
|
|
574
|
-
updateLoadingCount();
|
|
575
574
|
ok(e.response || e.responseText);
|
|
576
575
|
}).error(xhr => {
|
|
577
|
-
updateLoadingCount();
|
|
578
576
|
try {
|
|
579
577
|
var e = getErrorMessage(parseData(xhr.response || xhr.responseText || xhr.statusText || xhr.status));
|
|
580
578
|
oh({ status: xhr.status, api, params: params1, error: e, toString: getErrorMessage })
|
|
@@ -582,7 +580,6 @@ var privates = {
|
|
|
582
580
|
oh(error);
|
|
583
581
|
}
|
|
584
582
|
});
|
|
585
|
-
updateLoadingCount();
|
|
586
583
|
});
|
|
587
584
|
promise.search = search;
|
|
588
585
|
promise.params = temp;
|
|
@@ -652,6 +649,7 @@ var getData = function () { return this.data };
|
|
|
652
649
|
var updateLoadingCount = function () {
|
|
653
650
|
data.loading_count = cross.requests.length;
|
|
654
651
|
};
|
|
652
|
+
on('render')(window, updateLoadingCount, true);
|
|
655
653
|
var data = {
|
|
656
654
|
decodeStructure,
|
|
657
655
|
encodeStructure,
|
|
@@ -883,12 +881,10 @@ var data = {
|
|
|
883
881
|
headers = seekFromSource(headers, api.base);
|
|
884
882
|
}
|
|
885
883
|
instance.loading = cross(method, uri, headers).send(params).done(xhr => {
|
|
886
|
-
updateLoadingCount();
|
|
887
884
|
if (instance.loading !== xhr) return oh(aborted);
|
|
888
885
|
instance.loading = null;
|
|
889
886
|
ok(xhr.responseText || xhr.response);
|
|
890
887
|
}).error(xhr => {
|
|
891
|
-
updateLoadingCount();
|
|
892
888
|
if (instance.loading !== xhr) return oh(aborted);
|
|
893
889
|
instance.loading = null;
|
|
894
890
|
try {
|
|
@@ -898,7 +894,6 @@ var data = {
|
|
|
898
894
|
oh(error);
|
|
899
895
|
}
|
|
900
896
|
});
|
|
901
|
-
updateLoadingCount();
|
|
902
897
|
}).then(function (response) {
|
|
903
898
|
return transpile(seekResponse(parseData(response), selector), api.transpile, api.root);
|
|
904
899
|
});
|
package/coms/zimoli/dispatch.js
CHANGED
|
@@ -8,6 +8,18 @@ var dispatch = "dispatchEvent" in document ? function dispatchEvent(target, even
|
|
|
8
8
|
return target[fire] && target[fire](event);
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* @param {Event} e
|
|
13
|
+
*/
|
|
14
|
+
function dispatch2(t, e) {
|
|
15
|
+
var on = 'on' + e.type;
|
|
16
|
+
var f = t[on];
|
|
17
|
+
var res = dispatch(t, e);
|
|
18
|
+
if (f && (t.nodeType !== 1 || t.constructor === window.HTMLUnknownElement)) {
|
|
19
|
+
return f.call(t, e) !== false;
|
|
20
|
+
}
|
|
21
|
+
return res;
|
|
22
|
+
}
|
|
11
23
|
function main() {
|
|
12
24
|
var target, event, value;
|
|
13
25
|
for (var cx = 0, dx = arguments.length; cx < dx; cx++) {
|
|
@@ -27,7 +39,7 @@ function main() {
|
|
|
27
39
|
event.value = arg;
|
|
28
40
|
}
|
|
29
41
|
}
|
|
30
|
-
if (
|
|
42
|
+
if (dispatch2(target || window, event)) {
|
|
31
43
|
return event;
|
|
32
44
|
};
|
|
33
45
|
return false;
|
package/coms/zimoli/getValue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
2
2
|
function getValue(o = this) {
|
|
3
|
-
if (!o) return o;
|
|
3
|
+
if (!isObject(o) && !isFunction(o)) return o;
|
|
4
4
|
if (isFunction(o.getValue)) return o.getValue();
|
|
5
5
|
if (hasOwnProperty.call(o, 'valueOf')) return o.valueOf();
|
|
6
6
|
if ("key" in o) return o.key;
|