efront 4.21.3 → 4.22.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/#/345/233/275/351/231/205/345/214/226.yml +117 -66
- package/apps/blank/index.html +1 -1
- package/apps/index.jsp +76 -27
- package/apps/pay/alipay-query.jsp +1 -1
- package/apps/pay/alipay.jsp +1 -1
- package/apps/pivot/auth/login.js +2 -2
- package/apps/pivot/cert/main.xht +18 -5
- package/apps/pivot/db/act.xht +53 -0
- package/apps/pivot/db/config.xht +56 -16
- package/apps/pivot/home/welcome.html +12 -13
- package/apps/pivot/home/welcome.js +6 -6
- package/apps/pivot/home/welcome.less +12 -3
- package/apps/pivot/link/room.js +1 -1
- package/apps/pivot/main.js +3 -2
- package/apps/pivot/task/invoke.js +3 -3
- package/apps/pivot/task/rsync.js +2 -2
- package/apps/pivot/wow/root.js +8 -8
- package/coms/basic/#loader.js +9 -8
- package/coms/basic/Item.js +2 -2
- package/coms/basic/Tree.js +14 -2
- package/coms/basic/crc.js +5 -1
- package/coms/basic/cross_.js +2 -2
- package/coms/basic/decode62S.js +44 -0
- package/coms/basic/encode62S.js +40 -0
- package/coms/basic/encode62S_test.js +18 -0
- package/coms/basic/enrich.js +6 -1
- package/coms/basic/parseNumber.js +12 -7
- package/coms/basic/percent.js +28 -0
- package/coms/basic/refilm.js +24 -5
- package/coms/basic/refilm_decode.js +46 -22
- package/coms/basic/refilm_decode_test.js +5 -0
- package/coms/basic/valid.js +4 -0
- package/coms/basic_/&Array.js +64 -49
- package/coms/basic_/&extends.js +9 -2
- package/coms/compile/Html_test.js +5 -0
- package/coms/compile/Javascript.js +13 -3
- package/coms/compile/Javascript_test.js +3 -0
- package/coms/compile/Program.js +119 -43
- package/coms/compile/audit.js +23 -1
- package/coms/compile/cloneNode.js +3 -1
- package/coms/compile/common.js +7 -1
- package/coms/compile/downLevel.js +21 -11
- package/coms/compile/downLevel_test.js +52 -14
- package/coms/compile/rescan.js +8 -2
- package/coms/compile/scanner2.js +53 -7
- package/coms/compile/translate.js +1 -1
- package/coms/compile/unstruct.js +9 -9
- package/coms/crypt/encode62.js +36 -6
- package/coms/crypt/encode62_test.js +8 -48
- package/coms/explorer/main.less +1 -5
- package/coms/frame/chat.js +2 -2
- package/coms/frame/left.html +5 -4
- package/coms/frame/left.js +1 -0
- package/coms/frame/left.less +5 -3
- package/coms/frame/payment.js +2 -2
- package/coms/pivot/acme2.js +7 -4
- package/coms/pivot/left-footer.xht +25 -0
- package/coms/pivot/pedit.js +3 -3
- package/coms/pivot/plist.js +2 -2
- package/coms/pivot/qrcode.xht +3 -0
- package/coms/zimoli/XMLHttpRequest.js +16 -13
- package/coms/zimoli/container.js +34 -34
- package/coms/zimoli/design.html +6 -13
- package/coms/zimoli/design.js +49 -13
- package/coms/zimoli/design.less +62 -25
- package/coms/zimoli/drag.js +8 -3
- package/coms/zimoli/encode62.js +40 -12
- package/coms/zimoli/lattice.js +0 -1
- package/coms/zimoli/list.js +0 -8
- package/coms/zimoli/menu.js +29 -5
- package/coms/zimoli/model.js +150 -195
- package/coms/zimoli/model.less +4 -8
- package/coms/zimoli/on.js +14 -12
- package/coms/zimoli/padding.less +1 -0
- package/coms/zimoli/progbar.xht +9 -8
- package/coms/zimoli/prompt.less +0 -3
- package/coms/zimoli/render.js +210 -125
- package/coms/zimoli/select.js +9 -4
- package/coms/zimoli/select.less +3 -14
- package/coms/zimoli/selectList.js +5 -1
- package/coms/zimoli/selectList.less +3 -0
- package/coms/zimoli/table.html +7 -7
- package/coms/zimoli/table.js +12 -9
- package/coms/zimoli/table.less +5 -0
- package/coms/zimoli/user.js +2 -2
- package/coms/zimoli/view.js +3 -4
- package/coms/zimoli/watch.js +3 -1
- package/coms/zimoli/zimoli.js +6 -2
- package/coms//350/214/250/350/217/260/tab.js +26 -2
- package/coms//350/214/250/350/217/260//346/240/207/347/255/276/345/214/226.js +1 -1
- package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +183 -20
- package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +5 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/readme-en.md +3 -5
- package/readme.md +3 -4
package/coms/basic/refilm.js
CHANGED
|
@@ -35,7 +35,10 @@ var writeField = refilm.writeField = function (data, field, value, offset = fiel
|
|
|
35
35
|
var limit = byteLimit;
|
|
36
36
|
while (limit-- > 0) {
|
|
37
37
|
v.push(value & 0xff);
|
|
38
|
-
|
|
38
|
+
if (limit >= 4) {
|
|
39
|
+
value = value / 256;
|
|
40
|
+
}
|
|
41
|
+
else value = value >>> 8;
|
|
39
42
|
}
|
|
40
43
|
if (value) throw new Error(i18n`数据过大`);
|
|
41
44
|
value = v;
|
|
@@ -56,21 +59,37 @@ var writeFields = refilm.writeFields = function (data, fields, values, offset =
|
|
|
56
59
|
};
|
|
57
60
|
var toint = function (buf) {
|
|
58
61
|
var n = 0;
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
if (buf.length >= 7 && (buf[7] || buf[6] > 0x1f)) return buf;
|
|
63
|
+
switch (buf.length) {
|
|
64
|
+
default:
|
|
65
|
+
case 3:
|
|
66
|
+
n |= buf[2] << 16;
|
|
67
|
+
case 2:
|
|
68
|
+
n |= buf[1] << 8;
|
|
69
|
+
case 1:
|
|
70
|
+
n |= buf[0];
|
|
71
|
+
case 0:
|
|
72
|
+
}
|
|
73
|
+
for (var cx = 3, dx = buf.length; cx < dx; cx++) {
|
|
74
|
+
n += buf[cx] * 2 ** (cx << 3);
|
|
61
75
|
}
|
|
62
76
|
return n;
|
|
63
77
|
};
|
|
64
|
-
var
|
|
78
|
+
var readBuffer = refilm.readBuffer = function (data, field, offset = field.offset, size = field.size * field.ratio) {
|
|
65
79
|
return data.slice(offset, offset + size);
|
|
66
80
|
};
|
|
67
81
|
|
|
82
|
+
var readField = refilm.readField = function (data, field, offset, size) {
|
|
83
|
+
var v = readBuffer(data, field, offset, size);
|
|
84
|
+
if (/^([us]?int|byte|word|dword|qword|long)/i.test(field.type)) v = toint(v);
|
|
85
|
+
return v;
|
|
86
|
+
};
|
|
87
|
+
|
|
68
88
|
refilm.readFields = function (data, fields, offset = fields.offset || 0) {
|
|
69
89
|
var res = Object.create(null);
|
|
70
90
|
for (var f of fields) {
|
|
71
91
|
var size = f.size * f.ratio;
|
|
72
92
|
var v = readField(data, f, offset, size);
|
|
73
|
-
if (size <= 4) v = toint(v);
|
|
74
93
|
res[f.key] = v;
|
|
75
94
|
offset += size;
|
|
76
95
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use ./KMGT.txt"
|
|
2
2
|
function scanBlock(piece) {
|
|
3
3
|
if (!piece) return [];
|
|
4
|
-
var reg = /\\[\s\S]|^\s*[#\-]\s*|\s+|"|'
|
|
4
|
+
var reg = /\\[\s\S]|^\s*[#\-]\s*|\s+|"|'|\^/mg;
|
|
5
5
|
var res = [];
|
|
6
6
|
var lastIndex = 0;
|
|
7
7
|
var save = function (a) {
|
|
@@ -18,13 +18,19 @@ function scanBlock(piece) {
|
|
|
18
18
|
});
|
|
19
19
|
res.push(a);
|
|
20
20
|
};
|
|
21
|
+
var avoid = false;
|
|
21
22
|
for (var cx = 0, dx = piece.length; cx < dx; cx++) {
|
|
22
23
|
reg.lastIndex = cx;
|
|
23
24
|
var m = reg.exec(piece);
|
|
24
25
|
if (m) {
|
|
25
26
|
var s = m[0];
|
|
26
|
-
if (
|
|
27
|
-
|
|
27
|
+
if (/^(\s+|\^)$/.test(s)) {
|
|
28
|
+
if (s === '^') {
|
|
29
|
+
avoid = res.length;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
save(piece.slice(lastIndex, reg.lastIndex));
|
|
33
|
+
}
|
|
28
34
|
lastIndex = reg.lastIndex;
|
|
29
35
|
} else if (/^["']$/i.test(s)) {
|
|
30
36
|
var i = piece.indexOf(s, cx + 1);
|
|
@@ -39,6 +45,7 @@ function scanBlock(piece) {
|
|
|
39
45
|
break;
|
|
40
46
|
}
|
|
41
47
|
}
|
|
48
|
+
if (avoid !== false) res.avoid = avoid;
|
|
42
49
|
return res;
|
|
43
50
|
}
|
|
44
51
|
|
|
@@ -262,7 +269,22 @@ function spreadkey(name) {
|
|
|
262
269
|
}
|
|
263
270
|
return [name, key, needs, holder];
|
|
264
271
|
}
|
|
272
|
+
function parseOptions(options) {
|
|
273
|
+
if (typeof options === "string" && !/^[\$#]+\d+$/.test(options)) {
|
|
274
|
+
var needUnfold = /^\[|\]$/.test(options);
|
|
275
|
+
options = options.replace(/^\[|\]$/g, '');
|
|
276
|
+
if (needUnfold || /,/.test(options)) options = scanSlant(options, ',');
|
|
277
|
+
else options = scanSlant(options, "");
|
|
278
|
+
if (needUnfold) unfoldOptions(size, options);
|
|
279
|
+
}
|
|
280
|
+
return options;
|
|
281
|
+
}
|
|
265
282
|
function parse(piece) {
|
|
283
|
+
var avoid1 = null;
|
|
284
|
+
if (piece.avoid != null) {
|
|
285
|
+
avoid1 = piece[piece.avoid];
|
|
286
|
+
piece.splice(piece.avoid, 1);
|
|
287
|
+
}
|
|
266
288
|
if (/^[\-#]+$/.test(piece[0])) {
|
|
267
289
|
var piece0 = piece.pop();
|
|
268
290
|
piece[0] = piece0 + (piece[0] || '').trim();
|
|
@@ -293,7 +315,8 @@ function parse(piece) {
|
|
|
293
315
|
holder,
|
|
294
316
|
do: action,
|
|
295
317
|
editable,
|
|
296
|
-
|
|
318
|
+
avoid,
|
|
319
|
+
needs, valid, repeat, endwith,
|
|
297
320
|
required, inlist, hidden, readonly,
|
|
298
321
|
delete_onempty, delete_onsubmit,
|
|
299
322
|
} = name;
|
|
@@ -338,9 +361,13 @@ function parse(piece) {
|
|
|
338
361
|
[name, key, needs, holder] = spreadkey(name);
|
|
339
362
|
if (key === undefined && !/^(title|label|headline)$/i.test(type)) key = name;
|
|
340
363
|
}
|
|
341
|
-
|
|
364
|
+
var value = /\/?\=([^\/\\]+)/.exec(type);
|
|
365
|
+
if (value) type = type.slice(0, value.index) + type.slice(value.index + value[0].length), value = parseValue(value[1]);
|
|
366
|
+
if (/^[a-z]+(\d+|\d*\/\d+)$/i.test(type)) {
|
|
342
367
|
let [_, t, d] = /^(\w*?)\/?(\d+)$/.exec(type);
|
|
343
|
-
|
|
368
|
+
if (_.length === t.length + d.length) t = _;
|
|
369
|
+
if (d & 0b111 === 0) type = (d >>> 3) + 'byte/' + t;
|
|
370
|
+
else type = d + 'bit/' + t;
|
|
344
371
|
}
|
|
345
372
|
var sizematch = /^(\-?\d+|\-?\d*\.\d+)?([YZEPTGMK]i?b?|bytes?|bits?|words?|dword|real[48]|long|B|[^\/]*)([\/]|$|\s|\=)/i.exec(type);
|
|
346
373
|
if (!sizematch[1] && /^\$\d/.test(sizematch[2])) sizematch = null;
|
|
@@ -412,18 +439,12 @@ function parse(piece) {
|
|
|
412
439
|
} else if (/^[\/]/.test(type)) {
|
|
413
440
|
type = type.slice(1);
|
|
414
441
|
}
|
|
415
|
-
if (typeof options ===
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
editable = true;
|
|
419
|
-
options = options.replace(/^[\+\-\*]|[\+\*\-]$/g, '');
|
|
420
|
-
}
|
|
421
|
-
var needUnfold = /^\[|\]$/.test(options);
|
|
422
|
-
options = options.replace(/^\[|\]$/g, '');
|
|
423
|
-
if (needUnfold || /,/.test(options)) options = scanSlant(options, ',');
|
|
424
|
-
else options = scanSlant(options, "");
|
|
425
|
-
if (needUnfold) unfoldOptions(size, options);
|
|
442
|
+
if (typeof options === 'string' && /^[\+\-\*]|[\+\-\*]$/.test(options)) {
|
|
443
|
+
editable = true;
|
|
444
|
+
options = options.replace(/^[\+\-\*]|[\+\*\-]$/g, '');
|
|
426
445
|
}
|
|
446
|
+
options = parseOptions(options);
|
|
447
|
+
avoid = parseOptions(avoid1 || avoid);
|
|
427
448
|
name = is(name);
|
|
428
449
|
key = is(key);
|
|
429
450
|
}
|
|
@@ -436,8 +457,9 @@ function parse(piece) {
|
|
|
436
457
|
name, type, key, value, comment, options,
|
|
437
458
|
editable,
|
|
438
459
|
size, unit, ratio, holder,
|
|
439
|
-
needs,
|
|
460
|
+
needs, valid, repeat, endwith,
|
|
440
461
|
required, inlist, hidden, readonly,
|
|
462
|
+
avoid,
|
|
441
463
|
do: action,
|
|
442
464
|
delete_onempty, delete_onsubmit,
|
|
443
465
|
};
|
|
@@ -477,11 +499,13 @@ function refilm_decode(str) {
|
|
|
477
499
|
if (!m) break;
|
|
478
500
|
var piece = s.slice(lastIndex, m.index);
|
|
479
501
|
piece = scanBlock(piece);
|
|
502
|
+
if (piece.avoid != null) {
|
|
503
|
+
rest.avoid = rest.length + piece.avoid;
|
|
504
|
+
}
|
|
505
|
+
if (piece) rest.push.apply(rest, piece);
|
|
480
506
|
if (m[0].length || cx + 1 === dx) {
|
|
481
|
-
result.push(rest
|
|
482
|
-
rest
|
|
483
|
-
} else {
|
|
484
|
-
if (piece) rest.push.apply(rest, piece);
|
|
507
|
+
result.push(rest);
|
|
508
|
+
rest = [];
|
|
485
509
|
}
|
|
486
510
|
lastIndex = m.index + m[0].length;
|
|
487
511
|
} while (lastIndex < s.length);
|
|
@@ -6,6 +6,7 @@ var test = function (fields, key, expect) {
|
|
|
6
6
|
if (!valid) console.log(fields)
|
|
7
7
|
};
|
|
8
8
|
test(refilm`启动时间/time $1`, 'key', 'time');
|
|
9
|
+
test(refilm`启动时间/time int64/=1`, 'type', 'int64');
|
|
9
10
|
test(refilm`启动时间/time $1`, 'type', '$1');
|
|
10
11
|
test(refilm`启动时间/time ${test}`, 'key', "time");
|
|
11
12
|
test(refilm`启动时间/time ${test}`, 'type', test);
|
|
@@ -17,3 +18,7 @@ test(refilm`连城剑法 别名 [唐诗剑法,躺尸剑法]`, ['options', 1, 'na
|
|
|
17
18
|
test(refilm`连城剑法 别名 [唐诗剑法,躺尸剑法]`, ['options', 1, 'key'], "躺尸剑法");
|
|
18
19
|
test(refilm`连城剑法 别名 [唐诗剑法,躺尸剑法]`, ['options', 1, 'value'], 1);
|
|
19
20
|
test(refilm`连城剑法 别名 [唐诗剑法/0,躺尸剑法/1]`, ['options', 1, 'key'], 1);
|
|
21
|
+
test(refilm`连城剑法 别名 ^[唐诗剑法/0,躺尸剑法/1]`, ['avoid', 1, 'key'], 1);
|
|
22
|
+
test(refilm`连城剑法 别名 [唐诗剑法/0,躺尸剑法/1] ^[a,b]`, ['options', 1, 'key'], 1);
|
|
23
|
+
test(refilm`连城剑法 别名 [唐诗剑法/0,躺尸剑法/1] ^[a,b]`, ['avoid', 1, 'key'], 'b');
|
|
24
|
+
test(refilm`连城剑法 别名 [唐诗剑法/0,躺尸剑法/1] ^${[{ key: 'a' }, { key: 'c' }]}`, ['avoid', 1, 'key'], 'c');
|
package/coms/basic/valid.js
CHANGED
|
@@ -14,6 +14,10 @@ function valid(field, data) {
|
|
|
14
14
|
}
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
+
if (field.avoid) for (var a of field.avoid) {
|
|
18
|
+
if (a === data) continue;
|
|
19
|
+
if (a[field.key] === data[field.key]) return i18n`已存在${field.name}为${data[field.key]}的项`;
|
|
20
|
+
}
|
|
17
21
|
var tmp = validators[field.type];
|
|
18
22
|
if (tmp) {
|
|
19
23
|
var value = data[field.key];
|
package/coms/basic_/&Array.js
CHANGED
|
@@ -1,67 +1,82 @@
|
|
|
1
|
-
var hasOwnProperty = {}.__proto__ === Object ? function (k) {
|
|
1
|
+
var hasOwnProperty = {}.__proto__ === Object.prototype ? function (k) {
|
|
2
2
|
var proto = this.__proto__;
|
|
3
3
|
return k in this && (!proto || !(k in proto));
|
|
4
4
|
} : Object.prototype.hasOwnProperty;
|
|
5
5
|
var setPrototypeOf = Object.setPrototypeOf;
|
|
6
|
+
var wrapMethod = function (f) {
|
|
7
|
+
return function () {
|
|
8
|
+
var res = f.apply(this, arguments);
|
|
9
|
+
setPrototypeOf(res, this.constructor.prototype);
|
|
10
|
+
return res;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
6
13
|
a: if (!setPrototypeOf) {
|
|
7
|
-
|
|
8
|
-
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
9
|
-
var defineProperty = Object.defineProperty;
|
|
10
|
-
try {
|
|
11
|
-
if (!getOwnPropertyNames) throw i18n`不支持`;
|
|
12
|
-
defineProperty({}, 'o', { value: 0 });
|
|
14
|
+
if ({}.__proto__ === Object.prototype) {
|
|
13
15
|
setPrototypeOf = function (obj, proto) {
|
|
14
|
-
|
|
15
|
-
for (var n of names) {
|
|
16
|
-
var d = getOwnPropertyDescriptor(proto, n);
|
|
17
|
-
defineProperty(obj, n, d);
|
|
18
|
-
}
|
|
19
|
-
return obj;
|
|
16
|
+
obj.__proto__ = proto;
|
|
20
17
|
}
|
|
21
|
-
break a;
|
|
22
|
-
} catch (e) {
|
|
23
|
-
getOwnPropertyDescriptor = null;
|
|
24
|
-
defineProperty = null;
|
|
25
|
-
getOwnPropertyNames = null;
|
|
26
18
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
obj.constructor = proto.constructor;
|
|
33
|
-
return obj;
|
|
19
|
+
else if (Object.getOwnPropertyDescriptors) {
|
|
20
|
+
setPrototypeOf = function (obj, proto) {
|
|
21
|
+
var descriptors = Object.getOwnPropertyDescriptors(proto);
|
|
22
|
+
Object.defineProperties(obj, descriptors);
|
|
23
|
+
}
|
|
34
24
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
else {
|
|
26
|
+
|
|
27
|
+
if (Object.getOwnPropertyNames) {
|
|
28
|
+
setPrototypeOf = function (obj, proto) {
|
|
29
|
+
var keys = Object.getOwnPropertyNames(proto);
|
|
30
|
+
methods.forEach(k => {
|
|
31
|
+
obj[k] = wrapMethod(proto[k]);
|
|
32
|
+
});
|
|
33
|
+
keys.forEach(k => {
|
|
34
|
+
var dp = Object.getOwnPropertyDescriptor(proto, k);
|
|
35
|
+
Object.defineProperty(obj, k, dp);
|
|
36
|
+
})
|
|
37
|
+
obj.constructor = proto.constructor;
|
|
38
|
+
return obj;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// <!--
|
|
43
|
+
console.error(i18n`当前运行环境使用class extends Array会有难以解决的不兼容性问题,请更换代码的实现方式!`);
|
|
44
|
+
// -->
|
|
45
|
+
setPrototypeOf = function (obj, proto) {
|
|
46
|
+
var keys = Object.keys(proto);
|
|
47
|
+
methods.forEach(k => {
|
|
48
|
+
obj[k] = wrapMethod(proto[k]);
|
|
49
|
+
});
|
|
50
|
+
obj.constructor = proto.constructor;
|
|
51
|
+
keys.forEach(k => {
|
|
52
|
+
if (!(k in obj)) obj[k] = proto[k];
|
|
53
|
+
})
|
|
54
|
+
return obj;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
44
57
|
}
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
var map = wrapMethod([].map);
|
|
48
|
-
var slice = wrapMethod([].slice);
|
|
49
|
-
var filter = wrapMethod([].filter);
|
|
50
|
-
var splice = wrapMethod([].splice);
|
|
51
|
-
var concat = wrapMethod([].concat);
|
|
58
|
+
}
|
|
52
59
|
|
|
53
60
|
function Array2() {
|
|
54
|
-
var
|
|
61
|
+
var res = Array.apply(this, arguments);
|
|
55
62
|
/**
|
|
56
63
|
* @type {PropertyDescriptor}
|
|
57
64
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (!hasOwnProperty.call(proto, 'filter')) proto.filter = filter;
|
|
61
|
-
if (!hasOwnProperty.call(proto, 'splice')) proto.splice = splice;
|
|
62
|
-
if (!hasOwnProperty.call(proto, 'concat')) proto.concat = concat;
|
|
63
|
-
var obj = setPrototypeOf(Array.apply(this, arguments), proto);
|
|
64
|
-
return obj;
|
|
65
|
+
setPrototypeOf(res, this.constructor.prototype);
|
|
66
|
+
return res;
|
|
65
67
|
}
|
|
68
|
+
var methods = [
|
|
69
|
+
'concat',
|
|
70
|
+
'slice',
|
|
71
|
+
'splice',
|
|
72
|
+
'filter',
|
|
73
|
+
'flat',
|
|
74
|
+
'flatMap',
|
|
75
|
+
'map',
|
|
76
|
+
'toReversed',
|
|
77
|
+
'toSorted',
|
|
78
|
+
'toSpliced',
|
|
79
|
+
'with',
|
|
80
|
+
].filter(k => k in Array.prototype);
|
|
66
81
|
Array2.prototype = Array.prototype;
|
|
67
82
|
return Array2;
|
package/coms/basic_/&extends.js
CHANGED
|
@@ -2,14 +2,21 @@ var __static = Object.setPrototypeOf || { __proto__: [] } instanceof Array && fu
|
|
|
2
2
|
d.__proto__ = b;
|
|
3
3
|
} || extend;
|
|
4
4
|
var setConstructor = Object.defineProperty ? function (a, c) {
|
|
5
|
-
|
|
5
|
+
try {
|
|
6
|
+
Object.defineProperty(a, "constructor", { value: c });
|
|
7
|
+
} catch (e) {
|
|
8
|
+
setConstructor = function (a, c) {
|
|
9
|
+
a.constructor = c;
|
|
10
|
+
};
|
|
11
|
+
setConstructor(a, c);
|
|
12
|
+
}
|
|
6
13
|
} : function (a, c) {
|
|
7
14
|
a.constructor = c;
|
|
8
15
|
};
|
|
9
16
|
// class A extends B {}
|
|
10
17
|
function extends_(A, B) {
|
|
18
|
+
A.prototype = B === null ? Object.create(null) : (_ = new B, setConstructor(_, A), _);
|
|
11
19
|
__static(A, B);
|
|
12
|
-
A.prototype = B === null ? Object.create(null) : new (_ = function () { setConstructor(this, A) }, _.prototype = B.prototype, _);
|
|
13
20
|
var _;
|
|
14
21
|
}
|
|
15
22
|
return extends_;
|
|
@@ -37,6 +37,11 @@ test('${i18n`加载中..`}<div class="loader"></div>');
|
|
|
37
37
|
test('${a +typeof i18n`加载中..`}<div class="loader"></div>', '${a + typeof i18n`加载中..`}<div class="loader"></div>');
|
|
38
38
|
test('${a > 1}');
|
|
39
39
|
test('a>1', 'a > 1');
|
|
40
|
+
test('a<1>>1', 'a < 1 >> 1');
|
|
41
|
+
test('a<b>>1', 'a < b >> 1');
|
|
42
|
+
test('a < b >> 1', '1.type', 8);
|
|
43
|
+
test('a < z >> 1', '2.type', 128);
|
|
44
|
+
test('a<<z>1', 'a << z > 1');
|
|
40
45
|
test(`<meta charset="utf-8" />`);
|
|
41
46
|
test('a><a></a>', 'a > <a></a>');
|
|
42
47
|
test('X', 'X');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var strings = require("../basic/strings");
|
|
3
3
|
var Program = require("./Program");
|
|
4
4
|
var backEach = require("../basic/backEach");
|
|
5
|
-
|
|
5
|
+
var parseNumber = require('../basic/parseNumber');
|
|
6
6
|
const {
|
|
7
7
|
/* 1 */COMMENT,
|
|
8
8
|
/* 2 */SPACE,
|
|
@@ -43,7 +43,7 @@ instanceof`.trim().split(/[,\s]+/);
|
|
|
43
43
|
var colonstrap_reg = /^(case|default)$/;
|
|
44
44
|
class Javascript extends Program {
|
|
45
45
|
straps = straps;
|
|
46
|
-
value_reg = /^(false|true|null|Infinity|NaN|undefined|eval)$/
|
|
46
|
+
value_reg = /^(false|true|null|Infinity|NaN|undefined|eval|this|arguments)$/
|
|
47
47
|
transive_reg = /^(new|var|let|const|yield|void|in|of|typeof|delete|case|return|await|instanceof|throw|extends|import|from)$/
|
|
48
48
|
strapexp_reg = /^(new|void|typeof|delete|class|function|await)/;
|
|
49
49
|
forceend_reg = /^(return|yield|break|continue|debugger|async)$/;
|
|
@@ -172,7 +172,9 @@ var fixType = function (o) {
|
|
|
172
172
|
if (last && last.type === EXPRESS && /[^\.]\.$/.test(last.text)) {
|
|
173
173
|
type = EXPRESS;
|
|
174
174
|
}
|
|
175
|
-
else if (isProperty(o))
|
|
175
|
+
else if (isProperty(o)) {
|
|
176
|
+
if (!o.isdigit) type = PROPERTY;
|
|
177
|
+
}
|
|
176
178
|
else if (m === 'from') {
|
|
177
179
|
if (!last || last.type === STRAP && !/^(im|ex)port$/.test(last.text)) {
|
|
178
180
|
type = EXPRESS;
|
|
@@ -621,6 +623,14 @@ function detour(o, ie) {
|
|
|
621
623
|
if (/^0[0-7]+$/.test(o.text)) {
|
|
622
624
|
o.text = '0o' + o.text.slice(1);
|
|
623
625
|
}
|
|
626
|
+
if (o.isprop) {
|
|
627
|
+
if ((o.isdigit)) {
|
|
628
|
+
var value = parseNumber(o.text);
|
|
629
|
+
if (Number.isNaN(value) || value < 0)
|
|
630
|
+
console.warn(i18n`发现异常属性:${`<yellow>${o.text}</yellow>`}`);
|
|
631
|
+
else o.text = String(value);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
624
634
|
break;
|
|
625
635
|
case QUOTED:
|
|
626
636
|
if (o.length) {
|
|
@@ -26,6 +26,9 @@ var testDetour = function (a, e) {
|
|
|
26
26
|
c.break();
|
|
27
27
|
assert(c.toString(), e);
|
|
28
28
|
}
|
|
29
|
+
testDetour('={0x1:1}', '= { 1: 1 }')
|
|
30
|
+
testDetour('={-0x1:1}', '= { -0x1: 1 }')
|
|
31
|
+
testDetour('={false:1}', '= { ["false"]: 1 }')
|
|
29
32
|
testDetour('1.1', '1.1')
|
|
30
33
|
testDetour('1.1.a', '1.1["a"]')
|
|
31
34
|
testDetour('-1e10.a', '-1e10["a"]')
|