efront 4.24.2 → 4.25.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.
Files changed (54) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +42 -24
  2. package/apps/pivot/auth/login.js +4 -4
  3. package/apps/pivot/cert/edit.js +1 -1
  4. package/apps/pivot/cert/list.js +1 -1
  5. package/apps/pivot/cert/main.xht +2 -3
  6. package/apps/pivot/db/list.xht +5 -0
  7. package/apps/pivot/dht/list.js +6 -7
  8. package/apps/pivot/dict/edit.js +1 -1
  9. package/apps/pivot/dict/list.js +8 -6
  10. package/apps/pivot/home/welcome.html +1 -1
  11. package/apps/pivot/link/room.js +3 -3
  12. package/apps/pivot/log/count.js +22 -22
  13. package/apps/pivot/main.js +8 -2
  14. package/apps/pivot/proxy/edit.js +1 -1
  15. package/apps/pivot/proxy/list.js +4 -5
  16. package/apps/pivot/share/list.js +3 -3
  17. package/apps/pivot/task/edit.js +1 -1
  18. package/apps/pivot/task/list.js +1 -1
  19. package/apps/pivot/token/edit.js +1 -1
  20. package/apps/pivot/token/list.js +1 -1
  21. package/apps/pivot/wow/root.js +0 -3
  22. package/coms/basic/i18n.js +18 -5
  23. package/coms/basic/migrate.js +43 -0
  24. package/coms/compile/Asm.js +252 -0
  25. package/coms/compile/Asm_test.js +22 -0
  26. package/coms/compile/Html_test.js +1 -0
  27. package/coms/compile/Javascript.js +1 -143
  28. package/coms/compile/Javascript_test.js +4 -1
  29. package/coms/compile/Program.js +186 -22
  30. package/coms/compile/common.js +16 -4
  31. package/coms/compile/powermap.js +2 -2
  32. package/coms/compile/unstruct.js +5 -5
  33. package/coms/compile/unstruct_test.js +3 -1
  34. package/coms/explorer/context.js +2 -2
  35. package/coms/explorer/main.js +1 -1
  36. package/coms/frame/edit.html +1 -1
  37. package/coms/frame/edit.js +13 -6
  38. package/coms/frame/list.js +75 -42
  39. package/coms/frame/route.js +11 -6
  40. package/coms/pivot/plist.js +8 -5
  41. package/coms/zimoli/autodragchildren.js +5 -1
  42. package/coms/zimoli/moveupon.js +8 -5
  43. package/coms/zimoli/prompt.js +1 -0
  44. package/coms/zimoli/render.js +1 -0
  45. package/coms/zimoli/resize.js +3 -0
  46. package/coms/zimoli/tree.js +4 -1
  47. package/coms/zimoli/zimoli.js +13 -2
  48. package/coms//350/214/250/350/217/260//346/240/207/347/255/276/345/214/226.js +7 -3
  49. package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +6 -3
  50. package/coms//350/214/250/350/217/260//350/257/255/350/250/200.js +1 -22
  51. package/docs/main.xht +21 -17
  52. package/docs//345/221/275/344/273/244.xht +33 -32
  53. package/package.json +1 -1
  54. package/public/efront.js +1 -1
@@ -64,6 +64,46 @@ var trimDulp = function (list) {
64
64
  }
65
65
  return dist;
66
66
  }
67
+ var setObject = function (o) {
68
+ o.isObject = true;
69
+ var needproperty = true;
70
+ for (var cx = 0; cx < o.length; cx++) {
71
+ var m = o[cx];
72
+ if (!needproperty) {
73
+ if (m.type === SCOPED && m.entry === '{') {
74
+ if (!m.isObject) setObject(m);
75
+ continue;
76
+ }
77
+ if (m.type !== STAMP || m.text !== ',') continue;
78
+ }
79
+ if (m.type === STAMP && m.text === ':') {
80
+ needproperty = false;
81
+ continue;
82
+ }
83
+ if (m.type === LABEL) {
84
+ o.splice(cx, 0, o[++cx].prev = m.next = m.next.prev = {
85
+ prev: m,
86
+ text: ':',
87
+ type: STAMP,
88
+ next: m.next,
89
+ });
90
+ m.type = PROPERTY;
91
+ m.text = m.text.replace(/\:$/, '');
92
+ m.isprop = true;
93
+ m.end--;
94
+ needproperty = false;
95
+ continue;
96
+ }
97
+ m.isprop = true;
98
+ if (m.type === EXPRESS || m.type === STRAP) {
99
+ if (!/\./.test(m.text)) m.type = PROPERTY;
100
+ }
101
+ if (m.prev && m.prev.type === PROPERTY) {
102
+ m.prev.type = STRAP;
103
+ }
104
+ }
105
+ };
106
+
67
107
 
68
108
  var spaceDefined = require("../basic/spaces");
69
109
 
@@ -101,17 +141,130 @@ class Program {
101
141
  powermap = powermap;
102
142
  transive_reg = /^(new|var|let|const|yield|void|in|of|typeof|delete|case|return|await|default|instanceof|throw|extends|import|from)$/;
103
143
  straps = "if,for".split(',');
104
- forceend_reg = /^(return|break|continue)$/;
144
+ colonstrap_reg = /^(case|default)$/;
145
+ forceend_reg = /^(return|break|continue|end[psm])$/;
105
146
  funcstrap_reg = /^(class|function|fn|func|async|interface|struct|enum|impl|pub)$/;
106
147
  extends_reg = /^(extends|implements)$/;
107
148
  structstrap_reg = /^(class|interface|struct|enum)$/;
108
149
  control_reg = /^(if|else|switch|case|do|while|for|loop|break|continue|default|import|from|as|export|try|catch|finally|throw|await|yield|return)$/;
109
- type_reg = /^(var|let|const|function|fn|func|class|interface|type|struct|enum|impl)$/;
150
+ type_reg = /^(var|let|const|function|fn|func|class|interface|type|struct|enum|impl|local)$/;
110
151
  nocase = false
111
152
  keepspace = false;
112
153
  lastIndex = 0
154
+ detectLabel(o) {
155
+ var queue = o.queue;
156
+ var last = queue.last;
157
+ var m = o.text;
158
+ var type = o.type;
159
+ var end = o.end;
160
+ var inExpress = queue.inExpress;
161
+ if (type === SPACE);
162
+ else if (type !== STAMP);
163
+ else if (m === ";") {
164
+ if (last && last.isend === false) last.isend = true;
165
+ inExpress = false;
166
+ }
167
+ else if (last) check: switch (m) {
168
+ case "?":
169
+ if (last.isprop) {
170
+ o.type = EXPRESS;
171
+ o.isprop = true;
172
+ break;
173
+ }
174
+ if (last.type & (STAMP | STRAP) || last.istype) break;
175
+ inExpress = true;
176
+ if (!queue.question) queue.question = 1;
177
+ else queue.question++;
178
+ break;
179
+ case "=":
180
+ if (last.type === SCOPED && last.brace) {
181
+ if (!last.isObject) {
182
+ setObject(last);
183
+ }
184
+ }
185
+ var lp = last.prev;
186
+ if (lp?.type === STRAP && lp.text === 'type') {
187
+ o.istype = true;
188
+ }
189
+ case ",":
190
+ if (queue.isObject) {
191
+ if (last.type === PROPERTY) {
192
+ var lp = last.prev;
193
+ if (!lp || lp.type === STAMP && lp.text === ',') last.short = true;
194
+ }
195
+ }
196
+ inExpress = true;
197
+ break;
198
+ case "|":
199
+ case "&":
200
+ var p = o.prev;
201
+ if (p?.istype) o.istype = true;
202
+ inExpress = true;
203
+ break;
204
+ case ":":
205
+ if (queue.question) {
206
+ queue.question--;
207
+ if (last.type === STAMP && last.text === '?') {
208
+ inExpress = false;
209
+ o.istype = true;
210
+ last.istype = true;
211
+ last.type = EXPRESS;
212
+ }
213
+ else {
214
+ inExpress = true;
215
+ }
216
+ break;
217
+ }
218
+ if (queue.isObject) {
219
+ if (last.isprop) {
220
+ o.isExpress = false;
221
+ queue.inExpress = true;
222
+ return;
223
+ }
224
+ }
225
+ inExpress = false;
226
+ if (queue.entry && (!queue.brace || queue.isClass)) {
227
+ o.istype = true;
228
+ break;
229
+ }
230
+ var temp = last;
231
+ var colonstrap_reg = this.colonstrap_reg;
232
+ while (temp) {
233
+ if (temp.type === STRAP && colonstrap_reg.test(temp.text)) {
234
+ break check;
235
+ }
236
+ if (!temp.isExpress) break;
237
+ temp = temp.prev;
238
+ }
239
+ if (!queue.isargl && last.type & (EXPRESS | STRAP | VALUE | QUOTED)) {
240
+ // label
241
+ var lp = last.prev;
242
+ if (lp && lp.type === STAMP && lp.text === ',') {
243
+ o.istype = true;
244
+ break;
245
+ }
246
+ if (!lp || lp.type !== STRAP || !lp.transive || lp.isend) {
247
+ last.type = LABEL;
248
+ last.text += ":";
249
+ last.end = end;
250
+ queue.inExpress = false;
251
+ return o;
252
+ }
253
+ }
254
+ o.istype = true;
255
+ break;
256
+ default:
257
+ inExpress = true;
258
+ }
259
+ else {
260
+ inExpress = true;
261
+ }
262
+ if (inExpress !== queue.inExpress) {
263
+ o.isExpress = queue.inExpress = inExpress;
264
+ }
265
+ }
113
266
  twain(o1, o2) {
114
- if (o1.istype || o1.needle || o2.needle) return;
267
+ if (o1.type === STRAP || o1.istype || o1.needle || o2.needle) return;
115
268
  o2.istype = true;
116
269
  }
117
270
  compile2(s) {
@@ -144,7 +297,8 @@ class Program {
144
297
  if (source.length > 1) return new RegExp(`^(${s})$`, flag);
145
298
  return new RegExp(`^${s}$`, flag);
146
299
  }
147
- setType() {
300
+ setType(scope) {
301
+ if (this.detectLabel(scope)) return false;
148
302
  }
149
303
 
150
304
  exec(text) {
@@ -244,7 +398,7 @@ class Program {
244
398
  }
245
399
  else if (last.type === STRAP && !last.isend
246
400
  || last.type === STAMP && !last.istype && !/^(\+\+|\-\-)$/.test(last.text)
247
- || last.type === SCOPED && !last.isExpress
401
+ || last.type === SCOPED && !last.isExpress && !last.istype
248
402
  ) {
249
403
  o.unary = /^[^=;,\:]$/.test(o.text);
250
404
  if (o.unary && /^(\+|\-)$/.test(o.text) && last && last.type === STAMP && /^(\+\+|\-\-)$/.test(last.text)) o.unary = !!last.unary;
@@ -261,7 +415,7 @@ class Program {
261
415
  }
262
416
 
263
417
  if (!o.unary && /^(\.\.\.|\*)$/.test(o.text)) {
264
- if (powermap[o.text] === powermap.new) o.unary = true;
418
+ if (powermap[o.text] === powermap.void) o.unary = true;
265
419
  if (last?.isarg || last?.isargl || last?.isprop) {
266
420
  o.unary = true;
267
421
  o.istype = true;
@@ -275,7 +429,7 @@ class Program {
275
429
  o.needle = true;
276
430
  }
277
431
  if (o.needle);
278
- else if (powermap[o.text] > powermap.new && !o.unary) {
432
+ else if (powermap[o.text] > powermap.void && !o.unary) {
279
433
  o.needle = true;
280
434
  }
281
435
  queue_push(cache_stamp);
@@ -443,7 +597,7 @@ class Program {
443
597
  start = index = scope.start + scope.text.length;
444
598
  }
445
599
  var last = queue.last;
446
- if (last.type === PIECE) {
600
+ if (last?.type === PIECE) {
447
601
  this.lastIndex = 0;
448
602
  var thist = this.type;
449
603
  this.type = undefined;
@@ -467,7 +621,12 @@ class Program {
467
621
  }
468
622
  var closeTag = function () {
469
623
  queue.inTag = false;
470
- if (text.charAt(index) === m) {
624
+ a: if (text.charAt(index) === m) {
625
+ var qp = queue.prev;
626
+ if (!qp) break a;
627
+ var ptype = qp.type;
628
+ if (ptype & (ELEMENT | STRAP | PROPERTY | LABEL)) break a;
629
+ if (ptype === STAMP && !/^(\+\+|\-\-)$/.test(qp.text)) break a;
471
630
  if ((m + m) in powermap) {
472
631
  if (!parents[parents.length - 1].tag) {
473
632
  undefTag();
@@ -565,7 +724,6 @@ class Program {
565
724
  break loop;
566
725
  }
567
726
  var m = match[0];
568
-
569
727
  index = match.index + m.length;
570
728
  if (quote.tag && queue.inTag === 0) {
571
729
  if (openTag()) {
@@ -644,6 +802,7 @@ class Program {
644
802
  push_piece();
645
803
  var scope = [];
646
804
  scope.entry = m;
805
+ if (queue.istype) scope.istype = true;
647
806
  scope.type = QUOTED;
648
807
  push_parents(scope);
649
808
  continue loop;
@@ -723,6 +882,9 @@ class Program {
723
882
  case QUOTED:
724
883
  if (!last.tag) break test;
725
884
  break;
885
+ case VALUE:
886
+ case EXPRESS:
887
+ break test;
726
888
  case SCOPED:
727
889
  if (queue.inExpress && !iscomment) break test;
728
890
  break;
@@ -851,7 +1013,7 @@ class Program {
851
1013
  queue.inExpress = true;
852
1014
  if (isdigit && lasttype === STAMP) {
853
1015
  var prev = last.prev;
854
- if ((!prev || prev.type & (STAMP | STRAP) && !/^(\+\+|\-\-)$/.test(prev.text)) && /^[+\-]+$/.test(last.text)) {
1016
+ if ((!prev || prev.istype || prev.type & (STAMP | STRAP) && !/^(\+\+|\-\-)$/.test(prev.text)) && /^[+\-]+$/.test(last.text)) {
855
1017
  last.type = VALUE;
856
1018
  last.text += m;
857
1019
  lasttype = VALUE;
@@ -870,7 +1032,13 @@ class Program {
870
1032
  continue;
871
1033
  }
872
1034
 
873
- if (scope_entry[m]) {
1035
+ if (scope_entry[m]) scope: {
1036
+ if (stamp_reg.test(m)) {
1037
+ var last = queue.last;
1038
+ if (last) {
1039
+ if (last.isExpress && !last.istype) break scope;
1040
+ }
1041
+ }
874
1042
  var scope = [];
875
1043
  scope.entry = m;
876
1044
  scope.type = SCOPED;
@@ -879,8 +1047,8 @@ class Program {
879
1047
  scope.row = row;
880
1048
  if (m === "{") {
881
1049
  if (!last) {
882
- if (queue.istype) scope.isClass = true;
883
- else scope.isObject = queue.inExpress;
1050
+ scope.isObject = queue.inExpress;
1051
+ if (queue.istype) scope.istype = true;
884
1052
  }
885
1053
  else if (queue.classed) {
886
1054
  if (last.type !== STAMP || last.text !== "=>") {
@@ -893,17 +1061,12 @@ class Program {
893
1061
  scope.inExpress = false;
894
1062
  }
895
1063
  }
896
- else if (last.type === SCOPED && last.istype) {
897
- scope.isClass = true;
898
- }
899
1064
  else if (last.type === STAMP) {
900
- if (last.istype) {
901
- scope.isClass = true;
902
- }
903
- else if (last.text === ':') {
1065
+ if (last.text === ':') {
904
1066
  scope.isObject = queue.inExpress;
905
1067
  }
906
1068
  else queue.inExpress = scope.isObject = !/^(;|\+\+|\-\-|=>)$/.test(last.text);
1069
+ if (last.istype && scope.isObject) scope.istype = true;
907
1070
  }
908
1071
  else if (last.type === EXPRESS) a: {
909
1072
  if (last.text === '...') {
@@ -960,7 +1123,8 @@ class Program {
960
1123
  continue;
961
1124
  }
962
1125
  if (this.scope_leave[m]) {
963
- console.warn(
1126
+ var last = queue.last;
1127
+ if (!stamp_reg.test(m) || last && !last.isExpress) console.warn(
964
1128
  i18n`标记不匹配:`, queue.entry, m,
965
1129
  i18n`\r\n文件位置:`, this.mindpath + ":" + `${row}:${index - colstart}`,
966
1130
  i18n`\r\n摘要:\r\n`,
@@ -1328,7 +1328,10 @@ var createString = function (parsed) {
1328
1328
  || prev.type === STAMP && !prev.unary && !prev.needle && !prev.isprop
1329
1329
  ) {
1330
1330
  if (intag || prev.type === ELEMENT && o.type === ELEMENT) break a;
1331
- if ((o.type & ~(EXPRESS | PROPERTY) || !needhead_reg.test(o.text)) && (!prev.tag && !o.tag || prev.type === STAMP || o.type === STAMP)) {
1331
+ if (
1332
+ (o.type & ~(EXPRESS | PROPERTY) || !needhead_reg.test(o.text))
1333
+ && (!prev.tag && !o.tag || prev.type === STAMP || o.type === STAMP)
1334
+ ) {
1332
1335
  result.push(" ");
1333
1336
  lasttype = SPACE
1334
1337
  }
@@ -1426,6 +1429,7 @@ var createString = function (parsed) {
1426
1429
  break;
1427
1430
  case QUOTED:
1428
1431
  if (!o.length && o.text) {
1432
+ if (prev?.istype && lasttype !== SPACE) result.push(" ");
1429
1433
  if (helpcolor) o.text = color.transform(o.text);
1430
1434
  result.push(o.text);
1431
1435
  break;
@@ -1468,11 +1472,19 @@ var createString = function (parsed) {
1468
1472
  if (intag || o.needle || o.type & (EXPRESS | PROPERTY) && (needhead_reg.test(o.text) || lasttype & EXPRESS && needfoot_reg.test(prev?.text))) {
1469
1473
  if (prev?.isdigit && !/^0[\dxbo]|[mni]$|[e\.]/.test(prev.text) && lasttype & ~(SPACE | COMMENT)) result.push(" ");
1470
1474
  }
1471
- else if ((STRAP | EXPRESS | PROPERTY | COMMENT | VALUE) & lasttype && (STRAP | EXPRESS | PROPERTY | VALUE | LABEL) & o.type) {
1472
- if (autospace || o.prev?.isdigit) result.push(" ");
1475
+ else if (
1476
+ (STRAP | EXPRESS | PROPERTY | COMMENT | VALUE) & lasttype
1477
+ && (STRAP | EXPRESS | PROPERTY | VALUE | LABEL) & o.type
1478
+ ) {
1479
+ if (autospace || prev?.isdigit) result.push(" ");
1473
1480
  }
1474
1481
  else if (o.prev && o.type === STAMP && !/^[,;]/.test(o.text)) {
1475
- if (result[result.length - 1] === " " || (lasttype === PROPERTY || !o.isExpress && o.prev && o.prev.type !== LABEL) && o.text === ':') { }
1482
+ if (result[result.length - 1] === " ");
1483
+ else if (o.text === ':') {
1484
+ var p = o.prev;
1485
+ if ((lasttype === PROPERTY || p && p.isprop || !o.isExpress));
1486
+ else if (autospace) result.push(' ');
1487
+ }
1476
1488
  else if (lasttype === STAMP) {
1477
1489
  var prev = o.prev;
1478
1490
  if (autospace) if (!prev.unary || /[\+\-]$/.test(prev.text) && prev.text === o.text) result.push(" ");
@@ -7,8 +7,8 @@ var powermap = {
7
7
  'instanceof,in,==,>=,<=,>,<,!=,!==,===,!in,!instanceof'/* 6 */,
8
8
  '>>,>>>,<<'/* 7 */, '+,-'/* 8 */, '*,/,%'/* 9 */, '**'/* 10 */,
9
9
  '++,--'/* 11 */,
10
- "typeof,await,yield,new,delete,void,..."/*12*/,
11
- '!,~,#'/* 13 */,
10
+ "typeof,await,yield,delete,void,..."/*12*/,
11
+ '!,~,#,new'/* 13 */,
12
12
  "::,?.,->,."/*14*/,
13
13
  ].forEach((pp, i) => {
14
14
  pp.split(",").forEach(p => {
@@ -282,7 +282,7 @@ var isunary = function (o) {
282
282
  var f = o.first;
283
283
  if (!f) return false;
284
284
  while (f) {
285
- if (f.type & (STAMP | STRAP) && powermap[f.text] < powermap.new) return false;
285
+ if (f.type & (STAMP | STRAP) && powermap[f.text] < powermap.void) return false;
286
286
  f = f.next;
287
287
  }
288
288
  return true;
@@ -643,7 +643,7 @@ var _invoke = function (t, getname) {
643
643
  else if (t.length) {
644
644
  if (!isAequalA(t)) {
645
645
  var t0 = t[0];
646
- if ((t0.type === EXPRESS && /^[\.\[]/.test(t0.text) || t0.type & (STAMP | STRAP) && powermap[t0.text] < powermap.new) && result.length) {
646
+ if ((t0.type === EXPRESS && /^[\.\[]/.test(t0.text) || t0.type & (STAMP | STRAP) && powermap[t0.text] < powermap.void) && result.length) {
647
647
  t.unshift(...rescan`${qname}=${qname}`);
648
648
  relink(t);
649
649
  }
@@ -980,7 +980,7 @@ var _express = function (body, getname, ret) {
980
980
  continue;
981
981
  }
982
982
  if (o.type & (STRAP | STAMP)) {
983
- if (o.needle) {
983
+ if (o.needle || o.text === 'new') {
984
984
  exps.push(o);
985
985
  continue;
986
986
  }
@@ -1002,7 +1002,7 @@ var _express = function (body, getname, ret) {
1002
1002
  if (maxindex < nameindex) maxindex = nameindex;
1003
1003
  }
1004
1004
  bx = cx + 1;
1005
- if (!isor) if (!cache.length || p > cache[cache.length - 1] || p >= powermap.new) {
1005
+ if (!isor) if (!cache.length || p > cache[cache.length - 1] || p >= powermap.void) {
1006
1006
  cache.push(b, p);
1007
1007
  continue;
1008
1008
  }
@@ -1241,7 +1241,7 @@ function toqueue(body, getname, ret = false, result = []) {
1241
1241
  continue;
1242
1242
  }
1243
1243
  a: if (o.type === STRAP) {
1244
- if (/^(new|typeof|delete|await|void|debugger)$/.test(o.text)) {
1244
+ if (/^(typeof|delete|await|void|debugger)$/.test(o.text)) {
1245
1245
  break a;
1246
1246
  }
1247
1247
  if (/^(var|let|const)$/i.test(o.text)) {
@@ -165,7 +165,9 @@ test(`while (a && b);`, '_ = a; if (!_) return [1, 0]; _ = b;\r\n if (!_) return
165
165
  test(`while (a < b);`, '_ = a < b; if (!_) return [1, 0]; return [0, 0]', true);
166
166
  test(`if (a() > a+b);`, '_ = a(), _0 = a + b, _ = _ > _0; if (!_) return [1, 0]; return [1, 0]', true);
167
167
  test(`index > start && result.length < pageSize`, '_ = index > start; if (!_) return [1, 0]; _ = result.length, _ < pageSize', true);
168
- unstruct.debug = true; r++;
169
168
  test(`menus[0][str_name] += [str__v_, version[0], str__v_1][str_join]("")`, `_ = menus[0]; _0 = str__v_; _1 = version[0]; _2 = str__v_1; _0 = [_0, _1, _2]; _0 = _0[str_join](""); _1 = _[str_name], _1 = _1 + _0; _[str_name] = _1`);
170
169
  test(`a.b.c += menus[0][str_name] += [str__v_, version[0], str__v_1][str_join]("")`, `_ = menus[0]; _0 = str__v_; _1 = version[0]; _2 = str__v_1; _0 = [_0, _1, _2]; _0 = _0[str_join](""); _1 = _[str_name], _1 = _1 + _0; _[str_name] = _1; _2 = a.b.c, _2 = _2 + _1; a.b.c = _2`);
171
170
  test(`menus[0].c += menus[0][str_name] += [str__v_, version[0], str__v_1][str_join]("")`, `_ = menus[0]; _0 = menus[0]; _1 = str__v_; _2 = version[0]; _3 = str__v_1; _1 = [_1, _2, _3]; _1 = _1[str_join](""); _2 = _0[str_name], _2 = _2 + _1; _0[str_name] = _2; _3 = _.c, _3 = _3 + _2; _.c = _3`);
171
+ unstruct.debug = true; r++;
172
+ test(`new Array(2).join("") + 1`, `_0 = new Array(2); _ = _0.join(""), _ + 1`);
173
+ test(`new window.Array(2).join("") + 1`, `_0 = new window.Array(2); _ = _0.join(""), _ + 1`);
@@ -58,7 +58,7 @@ var popupEdit = function ($scope, active) {
58
58
  })
59
59
 
60
60
  };
61
- return extend([
61
+ return () => [
62
62
  {
63
63
  name: i18n`返回` + `(O)`,
64
64
  hotkey: "backspace",
@@ -213,4 +213,4 @@ return extend([
213
213
  $scope.open();
214
214
  }
215
215
  }
216
- ])
216
+ ];
@@ -220,7 +220,7 @@ function main() {
220
220
  renderWithDefaults(page, scope);
221
221
  bind('drop')(scope.listview, ondrop);
222
222
  bindkey(scope.listview);
223
- contextmenu(scope.listview, explorer$context);
223
+ contextmenu(scope.listview, explorer$context());
224
224
  on("pointerdown")(scope.listview, function () {
225
225
  if (document.activeElement !== scope.listview) scope.listview.focus();
226
226
  })
@@ -1,5 +1,5 @@
1
1
  <div head>
2
- <span v-text="origin?'${i18n`修改`}':'${i18n`添加`}'"></span><span -text="title"></span>
2
+ <span -text="title"></span>
3
3
  </div>
4
4
  <div body>
5
5
  <field v-if="!f.hidden" -repeat="f in fields" ng-src="[f,data]"></field>
@@ -1,22 +1,29 @@
1
1
  function main(title, { submit }, { data: origin, fields, }) {
2
2
  var page = view();
3
3
  var item = Object.assign({}, origin);
4
- page.innerHTML = edit;
5
- drag.on(page.firstChild, page);
6
- resize.on(page);
7
4
  page.onback = function () {
8
5
  if (page.querySelector('[dirty]')) return false;
9
6
  };
10
- renderWithDefaults(page, {
7
+ var page_scope = {
11
8
  fields,
12
- title,
9
+ get title() {
10
+ var t = title;
11
+ if (isFunction(t)) t = t();
12
+ t = (origin ? i18n`修改` : i18n`添加`) + t;
13
+ return t;
14
+ },
13
15
  origin,
14
16
  scrollbar,
15
17
  data: item,
16
18
  remove() {
17
19
  remove(page);
18
20
  },
19
- });
21
+ };
22
+ page.innerHTML = template;
23
+ renderWithDefaults(page, page_scope);
24
+ drag.on(page.firstChild, page);
25
+ resize.on(page);
26
+
20
27
  on('submit')(page, async function (e) {
21
28
  e.preventDefault();
22
29
  var res = await submit(item, fields, origin);
@@ -1,6 +1,68 @@
1
- function main(title, { fields, options: options0, load, remove, buttons }, edit_ref) {
1
+ function main(gtTitle, { fields: gtFields, options: gtOptions, load, remove, buttons: gtButtons }, edit_ref) {
2
+ var title, fields, fieldsL, options, options, buttons;
3
+ var gt = function (gt, o) {
4
+ if (isFunction(gt)) gt = gt();
5
+ if (isArray(o)) {
6
+ o.splice(0, o.length);
7
+ o.push.apply(o, gt);
8
+ }
9
+ else o = gt;
10
+ return o;
11
+ }
12
+ var update = function () {
13
+ title = gt(gtTitle, title);
14
+ var options0 = gt(gtOptions);
15
+ var options1 = [
16
+ {
17
+ name: i18n`修改`,
18
+ async do(o) {
19
+ await edit(o);
20
+ },
21
+ },
22
+ {
23
+ type: "danger",
24
+ name(o) {
25
+ return this.confirm === o ? i18n`确认删除` : i18n`删除`;
26
+ },
27
+ type(o) {
28
+ return this.confirm === o ? "dark" : "danger";
29
+ },
30
+ confirm: false,
31
+ timer: 0,
32
+ async do(o) {
33
+ if (this.confirm !== o) {
34
+ this.confirm = o;
35
+ clearTimeout(this.timer);
36
+ var that = this;
37
+ this.timer = setTimeout(function () {
38
+ that.confirm = null;
39
+ render.refresh();
40
+ }, 2000);
41
+ return;
42
+ }
43
+ await remove(o);
44
+ page_scope.load();
45
+ }
46
+ }
47
+ ];
48
+ if (options1) options1.push.apply(options1, options0);
49
+ options = gt(options1, options);
50
+ buttons = gt(gtButtons, buttons);
51
+ fields = gt(gtFields, fields);
52
+ var fields1 = fields.filter(f => !f.hidden && f.inlist !== false).concat({
53
+ name: i18n`操作`,
54
+ options
55
+ });
56
+ fieldsL = gt(fields1, fieldsL);
57
+ };
2
58
  if (isString(edit_ref)) prepare(edit_ref);
3
59
  var page = document.createElement("div");
60
+ on('append')(page, function () {
61
+ i18n.addReloader(update);
62
+ });
63
+ on('remove')(page, function () {
64
+ i18n.removeReloader(update);
65
+ });
4
66
  var edit = async function (o) {
5
67
  if (!edit_ref) {
6
68
  return;
@@ -24,58 +86,29 @@ function main(title, { fields, options: options0, load, remove, buttons }, edit_
24
86
  on("submited")(p, callback);
25
87
  })
26
88
  };
27
- page.innerHTML = template;
28
- var options = [
29
- {
30
- name: i18n`修改`,
31
- async do(o) {
32
- await edit(o);
33
- },
34
- },
35
- {
36
- type: "danger",
37
- name(o) {
38
- return this.confirm === o ? i18n`确认删除` : i18n`删除`;
39
- },
40
- type(o) {
41
- return this.confirm === o ? "dark" : "danger";
42
- },
43
- confirm: false,
44
- timer: 0,
45
- async do(o) {
46
- if (this.confirm !== o) {
47
- this.confirm = o;
48
- clearTimeout(this.timer);
49
- var that = this;
50
- this.timer = setTimeout(function () {
51
- that.confirm = null;
52
- render.refresh();
53
- }, 2000);
54
- return;
55
- }
56
- await remove(o);
57
- page_scope.load();
58
- }
59
- }
60
- ];
61
- if (options0) options = options.concat(options0);
89
+ update();
62
90
  var page_scope = {
63
- title,
91
+ get title() {
92
+ return title
93
+ },
64
94
  load() {
65
95
  this.data = load();
66
96
  },
67
- fields: fields.filter(f => !f.hidden && f.inlist !== false).concat({
68
- name: i18n`操作`,
69
- options
70
- }),
97
+ fields: fieldsL,
71
98
  buttons,
72
99
  hasedit: !!edit_ref,
73
100
  data: [],
74
101
  async add() {
75
102
  await edit();
76
103
  },
77
- }
104
+ };
105
+ page.innerHTML = template;
78
106
  renderWithDefaults(page, page_scope);
107
+ page.reload = function () {
108
+ update();
109
+ page.innerHTML = template;
110
+ renderWithDefaults(page, page_scope);
111
+ };
79
112
  on("append")(page, function () {
80
113
  page_scope.load();
81
114
  });