efront 3.26.8 → 3.26.14

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 (66) hide show
  1. package/apps/index.jsp +2 -2
  2. package/apps/pivot/dht/list.js +53 -0
  3. package/apps/pivot/index.html +3 -1
  4. package/apps/pivot/main.js +1 -0
  5. package/apps/pivot/main.less +3 -0
  6. package/apps/pivot/wow/root.js +138 -104
  7. package/apps/pivot/wow/root.less +1 -62
  8. package/coms/basic/Task.js +51 -0
  9. package/coms/basic/cross_.js +8 -0
  10. package/coms/basic/keys.js +3 -4
  11. package/coms/basic/loader.js +42 -17
  12. package/coms/basic/submit_.js +6 -3
  13. package/coms/explorer/Explorer.js +85 -0
  14. package/coms/explorer/context.js +205 -0
  15. package/coms/explorer/deepcp.js +48 -0
  16. package/{apps/pivot/wow → coms/explorer}/edit.html +1 -1
  17. package/{apps/pivot/wow → coms/explorer}/edit.js +17 -9
  18. package/coms/explorer/fileitem.html +8 -0
  19. package/coms/explorer/fileitem.js +34 -0
  20. package/coms/explorer/fileitem.less +65 -0
  21. package/coms/explorer/filetip.js +10 -0
  22. package/coms/explorer/filetip.less +5 -0
  23. package/coms/explorer/main.html +8 -0
  24. package/coms/explorer/main.js +215 -0
  25. package/coms/explorer/main.less +78 -0
  26. package/coms/frame/route.js +1 -1
  27. package/coms/shapes/file.html +9 -0
  28. package/coms/shapes/folder.html +7 -0
  29. package/coms/zimoli/Cleanup.js +9 -8
  30. package/coms/zimoli/arriswise.js +5 -4
  31. package/coms/zimoli/attr.js +2 -0
  32. package/coms/zimoli/bindGlobalkey.js +37 -0
  33. package/coms/zimoli/confirm.js +8 -8
  34. package/coms/zimoli/confirm.less +6 -80
  35. package/coms/zimoli/container.js +19 -6
  36. package/coms/zimoli/contextmenu.js +35 -15
  37. package/coms/zimoli/drag.js +7 -3
  38. package/coms/zimoli/field.html +1 -1
  39. package/coms/zimoli/field.js +8 -2
  40. package/coms/zimoli/field.less +0 -1
  41. package/coms/zimoli/getChanges.js +1 -0
  42. package/coms/zimoli/list.js +44 -33
  43. package/coms/zimoli/menu.js +1 -24
  44. package/coms/zimoli/menuItem.html +4 -1
  45. package/coms/zimoli/menuList.js +54 -104
  46. package/coms/zimoli/menuList.less +1 -0
  47. package/coms/zimoli/moveupon.js +2 -2
  48. package/coms/zimoli/overpos.js +7 -0
  49. package/coms/zimoli/popup.js +22 -27
  50. package/coms/zimoli/prompt.js +43 -5
  51. package/coms/zimoli/prompt.less +23 -0
  52. package/coms/zimoli/render.js +149 -107
  53. package/coms/zimoli/resize.js +12 -5
  54. package/coms/zimoli/rootElements.js +15 -1
  55. package/coms/zimoli/view.js +33 -0
  56. package/coms/zimoli/view.less +8 -8
  57. package/coms/zimoli/yousure.js +53 -0
  58. package/coms/zimoli/yousure.less +4 -0
  59. package/coms/zimoli/zimoli.js +10 -6
  60. package/package.json +1 -1
  61. package/public/efront.js +1 -1
  62. package/apps/pivot/wow/root.html +0 -10
  63. package/coms/zimoli/explorer.html +0 -5
  64. package/coms/zimoli/explorer.js +0 -8
  65. package/coms/zimoli/explorer.less +0 -18
  66. package/coms/zimoli/explorer_test.js +0 -4
@@ -0,0 +1,23 @@
1
+ tip {
2
+ display: block;
3
+ font-size: 12px;
4
+ color: #c24;
5
+ }
6
+
7
+ [error] {
8
+
9
+ >input {
10
+ background: #c241;
11
+ border-color: #c24;
12
+ }
13
+ }
14
+
15
+ textarea {
16
+ width: 100%;
17
+ height: 100%;
18
+ resize: none;
19
+ }
20
+
21
+ input {
22
+ width: 100%;
23
+ }
@@ -2,10 +2,28 @@ var hasOwnProperty = {}.hasOwnProperty;
2
2
  var renderElements = Object.create(null);
3
3
  var presets = Object.create(null);
4
4
  var createTemplateNodes = function (text) {
5
- var node = document.createElement(this.parentNode.tagName || "div");
6
- node.innerHTML = text;
7
5
  remove(this.with);
8
- this.with = [].slice.call(node.childNodes, 0);
6
+ if (isEmpty(text)) return;
7
+ if (isNode(text)) {
8
+ var node = text;
9
+ if (isElement(node) && this.$struct.copys) {
10
+ for (var c of this.$struct.copys) {
11
+ if (c.name === 'class') {
12
+ addClass(node, c.value);
13
+ }
14
+ else if (c.name === 'style') {
15
+ css(node, c.value);
16
+ }
17
+ else node.setAttribute(c.name, c.value);
18
+ }
19
+ }
20
+ this.with = [node];
21
+ return;
22
+ } else {
23
+ var node = document.createElement(this.parentNode.tagName || "div");
24
+ node.innerHTML = text;
25
+ this.with = [].slice.call(node.childNodes, 0);
26
+ }
9
27
  appendChild.after(this, this.with);
10
28
  this.with = renderElement(this.with, this.$scope, this.$parentScopes, this.renderid === 9);
11
29
  };
@@ -13,7 +31,7 @@ presets.template = function (t) {
13
31
  var comment = document.createComment('template');
14
32
  comment.$scope = t.$scope;
15
33
  comment.$parentScopes = t.$parentScopes;
16
- if (!t.innerHTML) {
34
+ if (t.$struct.binds.src) {
17
35
  care(comment, createTemplateNodes)
18
36
  }
19
37
  else {
@@ -77,20 +95,13 @@ function rebuild(element) {
77
95
  }
78
96
  }
79
97
  var variableReg = /([^\:\,\+\=\-\!%\^\|\/\&\*\!\;\?\>\<~\{\}\s\[\]\(\)]|\?\s*\.(?=[^\d])|\s*\.\s*)+/g;
80
- var createGetter = function (search, isprop = true) {
98
+ var variableOnlyReg = new RegExp(`^${variableReg.source}$`);
99
+ var createGetter = function (target, search, isprop = true) {
81
100
  if (!search) return function () { };
82
101
  search = renderExpress(search);
83
- if (isprop) {
84
- return function (event) {
85
- return $eval.call(this, search, this.$scope, event);
86
- };
87
- }
88
- if (/([\=\(\+\-])/.test(search)) return function (event) {
89
- return $eval.call(this, search, this.$scope, event);
90
- }
91
- else return function (event) {
92
- $eval.call(this, search)(event);
93
- }
102
+ if (isprop) return $$eval.bind(target, search, null);
103
+ if (variableOnlyReg.test(search)) return $$eval.bind(target, search + "(event)", null);
104
+ else return $$eval.bind(target, search, null);
94
105
  };
95
106
  var createComment = function (renders, type, expression) {
96
107
  var comment = document.createComment(`${type} ${expression}`);
@@ -187,11 +198,11 @@ var createRepeat = function (search, id = 0) {
187
198
  if (!repeater) throw new Error(`不能识别循环表达式: ${expression} `);
188
199
  var { srcName, trackBy } = repeater;
189
200
  // 懒渲染
190
- var getter = createGetter(srcName).bind(this);
201
+ var getter = createGetter(this, srcName);
191
202
  var element = this, clonedElements = [], savedValue, savedOrigin;
192
203
  if (this.$struct.if) id = -7;
193
204
  var renders = [function () {
194
- var result = getter();
205
+ var result = getter(this);
195
206
  var origin = result;
196
207
  result = extend(result instanceof Array ? [] : {}, result);
197
208
  if (savedOrigin === origin && deepEqual.shallow(savedValue, result)) return;
@@ -260,7 +271,7 @@ var initIf = function (ifs) {
260
271
  };
261
272
  var createIf = function (search, id = 0) {
262
273
  // 懒渲染
263
- var getter = createGetter(search).bind(this);
274
+ var getter = createGetter(this, search);
264
275
  var element = this;
265
276
  var elements = [element, getter];
266
277
  if_top.push(elements);
@@ -273,11 +284,12 @@ var createIf = function (search, id = 0) {
273
284
  var shouldMount = -1;
274
285
  for (var cx = 0, dx = elements.length; cx < dx; cx += 2) {
275
286
  var getter = elements[cx + 1];
276
- if (!getter || getter()) {
287
+ if (!getter || getter(this)) {
277
288
  shouldMount = cx;
278
289
  break;
279
290
  }
280
291
  }
292
+ // console.log(shouldMount,savedValue,this,this.$scope)
281
293
  if (savedValue === shouldMount) return;
282
294
  savedValue = shouldMount;
283
295
  for (var cx = 0, dx = elements.length; cx < dx; cx += 2) {
@@ -400,7 +412,7 @@ var structures = {
400
412
  initIf(if_top.splice(cx + 1, if_top.length - cx - 1));
401
413
  var top = if_top[cx];
402
414
  if (search && search) {
403
- var getter = createGetter(search).bind(this);
415
+ var getter = createGetter(this, search);
404
416
  }
405
417
  var comment = createComment.call(this, undefined, search ? 'elseif' : 'else', search);
406
418
  top.push(comment, getter);
@@ -413,10 +425,10 @@ structures["else-if"] = structures.elseif = structures.else;
413
425
  structures["for-each"] = structures.foreach = structures.for = structures.each = structures.repeat;
414
426
  var createBinder = function (binder) {
415
427
  return function (search) {
416
- var getter = createGetter(`(${search})`).bind(this);
428
+ var getter = createGetter(this, `(${search})`);
417
429
  var oldValue;
418
430
  this.renders.push(function () {
419
- var value = getter();
431
+ var value = getter(this);
420
432
  if (deepEqual.shallow(value, oldValue)) return;
421
433
  oldValue = value;
422
434
  if (isNode(value) || isArray(value)) {
@@ -434,10 +446,10 @@ var createBinder = function (binder) {
434
446
  }
435
447
 
436
448
  var src2 = function (search) {
437
- var getter = createGetter(search).bind(this);
449
+ var getter = createGetter(this, search);
438
450
  var savedValue;
439
451
  this.renders.push(function () {
440
- var origin = getter();
452
+ var origin = getter(this);
441
453
  var temp = origin;
442
454
  if (origin instanceof Array) {
443
455
  temp = extend([], origin);
@@ -469,36 +481,36 @@ var directives = {
469
481
  var parsedSrc = this.$src;
470
482
  return src2.call(this, parsedSrc ? parsedSrc.srcName : src);
471
483
  },
472
- model(search) {
473
- var getter = createGetter(search).bind(this);
484
+ model(search, target) {
485
+ var getter = createGetter(this, search);
474
486
  var oldValue;
475
- var getstr = this.getValue instanceof Function ? "this.getValue()" : "";
476
- var setter = this.setValue instanceof Function ? function () {
477
- var value = getter();
487
+ var getstr = target.getValue instanceof Function ? "this.getValue()" : "";
488
+ var setter = target.setValue instanceof Function ? function () {
489
+ var value = getter(this);
478
490
  if (value === undefined) value = "";
479
491
  if (deepEqual(oldValue, value)) return;
480
492
  oldValue = value;
481
493
  this.setValue(value);
482
494
  } : null;
483
495
  var setter2 = function (key) {
484
- var value = getter();
496
+ var value = getter(this);
485
497
  if (value === undefined) value = "";
486
498
  if (deepEqual(oldValue, value)) return;
487
499
  oldValue = value;
488
500
  this[key] = value;
489
501
  };
490
- if (/^input$/i.test(this.tagName) && /^checkbox$/i.test(this.type) || /^checkbox$/i.test(this.tagName)) {
491
- this.renders.push(setter || setter2.bind(this, 'checked'));
502
+ if (/^input$/i.test(target.tagName) && /^checkbox$/i.test(target.type) || /^checkbox$/i.test(target.tagName)) {
503
+ this.renders.push(setter || setter2.bind(target, 'checked'));
492
504
  var change = getstr || "this.checked";
493
- } else if (("value" in this || this.getValue instanceof Function) && this.setValue instanceof Function) {
505
+ } else if (("value" in target || target.getValue instanceof Function) && target.setValue instanceof Function) {
494
506
  this.renders.push(setter);
495
507
  var change = getstr || "this.value";
496
- } else if (/^(select|input|textarea)$/i.test(this.tagName) || "value" in this) {
497
- this.renders.push(setter || setter2.bind(this, 'value'));
508
+ } else if (/^(select|input|textarea)$/i.test(target.tagName) || "value" in target) {
509
+ this.renders.push(setter || setter2.bind(target, 'value'));
498
510
  var change = getstr || "this.value";
499
511
  } else {
500
512
  this.renders.push(setter || function () {
501
- var value = getter();
513
+ var value = getter(this);
502
514
  if (value === undefined) value = "";
503
515
  if (deepEqual(oldValue, value)) return;
504
516
  oldValue = value;
@@ -507,24 +519,25 @@ var directives = {
507
519
  var change = getstr || "'value' in this?this.value:this.innerHTML";
508
520
  }
509
521
  setter2 = null;
522
+ var changeme = $$eval.bind(this, search + "=" + change, null);
510
523
  var onchange = function () {
511
- $eval.call(this, search + "=" + change, this.$scope);
512
- var value = getter();
524
+ changeme(this);
525
+ var value = getter(this);
513
526
  if (value === oldValue) {
514
527
  return;
515
528
  }
516
529
  oldValue = value;
517
530
  userChanged = true;
518
531
  };
519
- eventsBinders.forEach(on => on(this, onchange, true));
532
+ eventsBinders.forEach(on => on(target, onchange, true));
520
533
  },
521
534
 
522
535
  "class"(search) {
523
- var getter = createGetter(`(${search})`).bind(this);
536
+ var getter = createGetter(this, `(${search})`);
524
537
  var generatedClassNames = {};
525
538
  var oldValue;
526
539
  this.renders.push(function () {
527
- var className = getter();
540
+ var className = getter(this);
528
541
  if (deepEqual(oldValue, className)) return;
529
542
  oldValue = className;
530
543
  var originalClassNames = [];
@@ -560,10 +573,10 @@ directives.text = directives.bind;
560
573
  var binders = {
561
574
  _(attr, search) {
562
575
  attr = attr.replace(/\-(\w)/g, (_, w) => w.toUpperCase());
563
- var getter = createGetter(search).bind(this);
576
+ var getter = createGetter(this, search);
564
577
  var oldValue;
565
578
  this.renders.push(function () {
566
- var value = getter();
579
+ var value = getter(this);
567
580
  if (deepEqual(value, oldValue)) return;
568
581
  oldValue = value;
569
582
  if (this[attr] !== value) {
@@ -572,10 +585,10 @@ var binders = {
572
585
  });
573
586
  },
574
587
  ""(attr, search) {
575
- var getter = createGetter(search).bind(this);
588
+ var getter = createGetter(this, search);
576
589
  var oldValue;
577
590
  this.renders.push(function () {
578
- var value = getter();
591
+ var value = getter(this);
579
592
  if (deepEqual(value, oldValue)) return;
580
593
  oldValue = value;
581
594
  if (value === true || value === '') {
@@ -591,10 +604,12 @@ var binders = {
591
604
  }
592
605
  };
593
606
  var reject = function (e) { digest(); throw e };
594
- var createEmiter = function (on) {
595
- return function (key, search) {
596
- var parsedSrc = this.$src;
597
- var getter = createGetter(search, false);
607
+ var createEmiter = function (on, target) {
608
+ return function (target, key, search) {
609
+ /**
610
+ * @type {Repeater}
611
+ */
612
+ var getter = createGetter(this, search, false);
598
613
  var onkey;
599
614
  if (key === 'mounted' || key === 'mount') {
600
615
  onkey = on === once ? oncemount : onmounted;
@@ -605,18 +620,24 @@ var createEmiter = function (on) {
605
620
  else {
606
621
  onkey = on(key);
607
622
  }
608
- onkey(this, function (e) {
623
+ onkey(target, function (e) {
609
624
  digest();
610
- if (parsedSrc) {
611
- var target = e.currentTarget || e.target;
612
- var scopes = target && target.$parentScopes;
613
- if (scopes) {
614
- var scope = null;
615
- for (var cx = scopes.length - 1; cx >= 0; cx--) {
616
- var s = scopes[cx];
617
- if (s === this.$scope) {
618
- scope = scopes[cx + 1];
619
- break;
625
+ var parsedSrc = this.$src;
626
+ if (parsedSrc instanceof Repeater) {
627
+ var target = e.currentTarget === this ? e.target : e.currentTarget || e.target;
628
+ if (target === this) {
629
+ scope = parsedSrc.createScope();
630
+ }
631
+ else {
632
+ var scopes = target && target.$parentScopes;
633
+ if (scopes) {
634
+ var scope = null;
635
+ for (var cx = scopes.length - 1; cx >= 0; cx--) {
636
+ var s = scopes[cx];
637
+ if (s === this.$scope) {
638
+ scope = scopes[cx + 1];
639
+ break;
640
+ }
620
641
  }
621
642
  }
622
643
  }
@@ -627,12 +648,12 @@ var createEmiter = function (on) {
627
648
  var temp = this.$scope;
628
649
  this.$parentScopes.push(temp);
629
650
  this.$scope = scope;
630
- res = getter.call(this, e);
651
+ res = getter(this, e);
631
652
  this.$parentScopes.pop();
632
653
  this.$scope = temp;
633
654
  }
634
655
  else {
635
- res = getter.call(this, e);
656
+ res = getter(this, e);
636
657
  }
637
658
  if (res && isFunction(res.then)) res.then(digest, reject);
638
659
  return res;
@@ -660,6 +681,31 @@ function getFromScopes(key, scope, parentScopes) {
660
681
  }
661
682
  }
662
683
 
684
+ function renderRest(element, struct, replacer = element) {
685
+ var renders = element.renders;
686
+ element.renders = [];
687
+ var { binds, attrs, props } = struct;
688
+ for (var k in binds) {
689
+ if (k === 'src') continue;
690
+ if (directives.hasOwnProperty(k)) {
691
+ directives[k].call(element, binds[k], replacer);
692
+ }
693
+ else {
694
+ binders._.call(element, k, binds[k]);
695
+ }
696
+ }
697
+ for (var k in struct.attrs) {
698
+ binders[""].call(element, k, attrs[k]);
699
+ }
700
+ for (var k in struct.props) {
701
+ try {
702
+ if (replacer[k] !== props[k]) replacer[k] = props[k];
703
+ } catch (e) { }
704
+ }
705
+ if (binds.src) directives.src.call(element, binds.src);
706
+ if (renders.length) element.renders.push.apply(element.renders, renders);
707
+ }
708
+
663
709
  function renderElement(element, scope = element.$scope, parentScopes = element.$parentScopes, once) {
664
710
  if (isArrayLike(element)) {
665
711
  return Array.prototype.slice.call(element).map(function (element) {
@@ -691,13 +737,11 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
691
737
  if (!element || element.renderid < 0 || element.nodeType !== 1) {
692
738
  return element;
693
739
  }
694
- var elementid = element.getAttribute("renderid") || element.getAttribute("elementid") || element.getAttribute("id");
695
- if (elementid) {
696
- if (scope[elementid] && scope[elementid] !== element) throw new Error("同一个id不能使用两次:" + elementid);
697
- scope[elementid] = element;
740
+ for (var id of element.$struct.ids) {
741
+ if (scope[id] && scope[id] !== element) throw new Error("同一个id不能使用两次:" + id);
742
+ scope[id] = element;
698
743
  }
699
744
  var isFirstRender = !element.renderid;
700
-
701
745
  if (isFirstRender) {
702
746
  element.renderid = 1;
703
747
  var parentNode = element.parentNode;
@@ -705,7 +749,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
705
749
  if (parentNode.renderid > 1 || isMounted(parentNode)) element.renderid = 2;
706
750
  }
707
751
  element.renders = element.renders ? [].concat(element.renders) : [];
708
- var { ons, copys, attrs, props, binds, ids, once } = element.$struct;
752
+ var { copys, binds, once } = element.$struct;
709
753
  if (once) element.renderid = 9;
710
754
  if (binds.src) {
711
755
  element.$src = parseRepeat(binds.src);
@@ -724,6 +768,11 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
724
768
  if (isFunction(constructor)) {
725
769
  var replacer = constructor.call(scope, element, scope, parentScopes);
726
770
  if (isNode(replacer) && element !== replacer) {
771
+ if (!replacer.$scope) {
772
+ replacer.$scope = scope;
773
+ }
774
+ if (replacer.children && replacer.children.length) renderElement(replacer.children, replacer.$scope, replacer.$parentScopes || parentScopes, once);
775
+ if (!replacer.$parentScopes) replacer.$parentScopes = parentScopes;
727
776
  if (nextSibling) appendChild.before(nextSibling, replacer);
728
777
  else if (parentNode) appendChild(parentNode, replacer);
729
778
  if (element.parentNode === parentNode) remove(element);
@@ -744,42 +793,29 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
744
793
  replacer.setAttribute(name, value);
745
794
  }
746
795
  });
747
- replacer.renderid = element.renderid;
748
- var renders = element.renders;
749
- if (replacer.renders) renders = renders.concat(replacer.renders);
750
- replacer.renders = renders;
751
- if (binds.src) replacer.$src = element.$src;
752
- replacer.$eval = element.$eval;
753
- element = replacer;
754
- element.$scope = scope;
755
- element.$parentScopes = parentScopes;
796
+ if (!replacer.renderid) replacer.renderid = element.renderid;
756
797
  }
757
798
  }
758
799
  }
759
- if (element.children && element.children.length) renderElement(element.children, scope, parentScopes, once);
800
+ if (!replacer || element === replacer) {
801
+ if (element.children && element.children.length) renderElement(element.children, scope, parentScopes, once);
802
+ }
760
803
  if (!isFirstRender) return element;
761
- var renders = element.renders;
762
- element.renders = [];
763
- for (var k in binds) {
764
- if (k === 'src') continue;
765
- if (directives.hasOwnProperty(k)) {
766
- directives[k].call(element, binds[k])
804
+ renderRest(element, element.$struct, replacer);
805
+ if (replacer) {
806
+ if (!replacer.renders) replacer.renders = [];
807
+ if (isElement(replacer)) createStructure(replacer);
808
+ replacer.renders = [].concat(element.renders, replacer.renders);
809
+ for (var id of element.$struct.ids) {
810
+ scope[id] = replacer;
767
811
  }
768
- else {
769
- binders._.call(element, k, binds[k]);
812
+ if (replacer.$struct && replacer.$struct !== element.$struct) {
813
+ renderRest(replacer, replacer.$struct);
814
+ element.$struct.ons.forEach(([on, key, value]) => on.call(element, replacer, key, value));
770
815
  }
816
+ element = replacer;
771
817
  }
772
- for (var k in attrs) {
773
- binders[""].call(element, k, attrs[k]);
774
- }
775
- for (var k in props) {
776
- try {
777
- if (element[k] !== props[k]) element[k] = props[k];
778
- } catch (e) { }
779
- }
780
- if (binds.src) directives.src.call(element, binds.src);
781
- ons.forEach(([on, key, value]) => on.call(element, key, value));
782
- if (renders.length) element.renders.push.apply(element.renders, renders);
818
+ if (element.$struct) element.$struct.ons.forEach(([on, key, value]) => on.call(element, element, key, value));
783
819
  if (element.renders.length) {
784
820
  if (element.renderid !== 9) {
785
821
  onmounted(element, addRenderElement);
@@ -791,21 +827,18 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
791
827
  rebuild(element);
792
828
  }
793
829
  }
794
- if (elementid) scope[elementid] = element;
795
- for (var id of ids) {
796
- scope[id] = element;
797
- }
798
830
  return element;
799
831
  }
800
832
  var createEval = function (deep) {
801
833
  var context = [];
802
834
  while (deep-- > 0) {
803
- context[deep] = `with(this.$parentScopes[${deep}])`;
835
+ context[deep] = `with($parentScopes[${deep}])`;
804
836
  }
805
- return new Function("code", "event", `${context.join('')}with(this.$scope)return eval(code)`);
837
+ return new Function("$parentScopes", "$scope", "code", "event", `${context.join('')}with($scope)return eval(code)`);
806
838
  };
807
839
  var evalcontexts = [createEval(0)];
808
- function $eval(search, scope, event) {
840
+
841
+ function $$eval(search, scope, target = this, event) {
809
842
  var needpop = scope && scope !== this.$scope;
810
843
  if (needpop) {
811
844
  this.$parentScopes.push(this.$scope);
@@ -814,11 +847,15 @@ function $eval(search, scope, event) {
814
847
  var length = this.$parentScopes ? this.$parentScopes.length : 0;
815
848
  if (!evalcontexts[length]) evalcontexts[length] = createEval(length);
816
849
  var eval2 = evalcontexts[length];
817
- var res = eval2.call(this, search, event);
850
+ var res = eval2.call(target, this.$parentScopes, this.$scope, search, event);
818
851
  if (needpop) this.$scope = this.$parentScopes.pop();
819
852
  return res;
820
853
  }
821
854
 
855
+ function $eval(search, scope, event) {
856
+ return $$eval.call(this, search, scope, this, event);
857
+ }
858
+
822
859
  class Struct {
823
860
  constructor(ons, types, copys, binds, attrs, props, ids, once) {
824
861
  this.ons = ons;
@@ -838,6 +875,7 @@ function createStructure(element) {
838
875
  if (isArrayLike(element)) return Array.prototype.map.call(element, createStructure);
839
876
  if (element.$struct) return element.$struct;
840
877
  // 处理结构流
878
+ if (!element.attributes) console.log(element)
841
879
  var attrs = Array.prototype.slice.call(element.attributes);
842
880
  var types = {};
843
881
  var emiter_reg = /^(?:(v|ng|on|once)?\-|v\-on\:|@|once|on)/i;
@@ -850,6 +888,10 @@ function createStructure(element) {
850
888
  var ids = [];
851
889
  for (var attr of attrs) {
852
890
  var { name, value } = attr;
891
+ if (name === 'elementid' || name === 'renderid' || name === 'id') {
892
+ ids.push(value);
893
+ continue;
894
+ }
853
895
  if (/^#/.test(name)) {
854
896
  ids.push(name.slice(1));
855
897
  element.removeAttribute(name);
@@ -945,7 +987,7 @@ var digest = lazy(refresh, -{});
945
987
  render.digest = render.apply = render.refresh = digest;
946
988
  render.parseRepeat = parseRepeat;
947
989
  "fullscreenchange,resize,load,hashchange".split(",").forEach(e => on(e)(window, digest));
948
- var eventsBinders = "change,click,paste,resize,keydown,keypress,keyup,input,drop".split(",").map(k => on(k));
990
+ var eventsBinders = "change,click,paste,cut,resize,keydown,keypress,keyup,input,drop".split(",").map(k => on(k));
949
991
  var userChanged = false;
950
992
  var changeListener = function () {
951
993
  if (userChanged) {
@@ -52,10 +52,16 @@ var handle = {
52
52
  if (dragging) return;
53
53
  dragging = getResizer(event);
54
54
  if (!dragging) return;
55
- event.moveLocked = true;
56
55
  var elem = dragging.rect;
57
56
  if (elem.offsetParent && /^(absolute|fixed|relative)$/i.test(getComputedStyle(elem.offsetParent).position)) {
58
- var pos = getScreenPosition(elem.offsetParent);
57
+ var parent = elem.offsetParent;
58
+ var pos = getScreenPosition(parent);
59
+ pos.left += parent.clientLeft;
60
+ pos.top += parent.clientTop;
61
+ pos.right = parent.clientWidth + pos.left;
62
+ pos.bottom = parent.clientHeight + pos.top;
63
+ pos.width = parent.clientWidth;
64
+ pos.height = parent.clientHeight;
59
65
  } else {
60
66
  var pos = {
61
67
  left: 0,
@@ -88,8 +94,6 @@ var handle = {
88
94
  },
89
95
  move(event) {
90
96
  if (!dragging) return;
91
- if (event.moveLocked) return;
92
- event.moveLocked = true;
93
97
  var limit = dragging.limit;
94
98
  var { clientX, clientY } = event;
95
99
  var [minx, miny, maxx, maxy] = limit;
@@ -130,8 +134,11 @@ var handle = {
130
134
  dragging = null;
131
135
  }
132
136
  };
133
- function resize(elem, initialEvent) {
137
+ function resize(elem, initialEvent, limit = elem.limit) {
138
+ resizingElements.push(elem);
134
139
  moveupon(elem, handle, initialEvent);
140
+ if (limit && dragging) extendIfOccurs(dragging.limit, limit);
141
+ resizingElements.pop();
135
142
  }
136
143
  moveupon(window, handle);
137
144
 
@@ -37,4 +37,18 @@ rootElements.unmount = function (elem) {
37
37
  if (!elem.parentNode) return;
38
38
  rootElements.pop(elem);
39
39
  remove(elem);
40
- };
40
+ };
41
+ /**
42
+ * 弹出层
43
+ */
44
+ on("keydown.esc.only")(document, function (e) {
45
+ if (e.defaultPrevented) return;
46
+ if (rootElements.length) {
47
+ var r = rootElements.pop();
48
+ if (r) {
49
+ r.blur();
50
+ remove(r);
51
+ e.preventDefault();
52
+ }
53
+ }
54
+ });
@@ -90,6 +90,37 @@ var init = function () {
90
90
  marginRight: -getScrollbarWidth() + "px"
91
91
  });
92
92
  };
93
+ var isType = function (target, type) {
94
+ // 记得小时候,不论是苍蝇还是蚊子,飞起来都是有声音的。最近看到的一种像蚊子一样小的飞虫,喜欢像苍蝇一样趴在食物上,飞起来却听不到声音。
95
+ // 是我的听力下降了?还是外界太过嘈杂?还是飞虫拍打翅膀的频率超出了我的听觉范围?还是飞行可以不产生声音?
96
+ return target.hasAttribute(type) || hasClass(type);
97
+ }
98
+ var resize2 = function () {
99
+ var head, body, foot;
100
+ for (var c of this.children) {
101
+ if (isType(c, "head")) head = c;
102
+ else if (isType(c, "body")) body = c;
103
+ else if (isType(c, "foot")) foot = c;
104
+ }
105
+ if (head && body) {
106
+ var height = head.offsetHeight;
107
+ css(head, {
108
+ marginBottom: fromOffset(-height),
109
+ })
110
+ css(body, {
111
+ paddingTop: fromOffset(height)
112
+ });
113
+ }
114
+ if (foot && body) {
115
+ var height = foot.offsetHeight;
116
+ css(body, {
117
+ paddingBottom: fromOffset(height)
118
+ });
119
+ css(foot, {
120
+ marginTop: fromOffset(-height)
121
+ })
122
+ }
123
+ };
93
124
  function view(element) {
94
125
  var window = isNode(element) ? element : document.createElement("form");
95
126
  init();
@@ -104,5 +135,7 @@ function view(element) {
104
135
  })
105
136
  if (window.resizable) resize.on(window);
106
137
  }
138
+ on('resize')(window, resize2);
139
+ onmounted(window, resize2);
107
140
  return window;
108
141
  }