efront 3.10.5 → 3.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -527,25 +527,51 @@ var binders = {
527
527
  });
528
528
  }
529
529
  };
530
- var emiters = {
531
- on(key, search) {
530
+ var createEmiter = function (on) {
531
+ return function (key, search) {
532
+ if (this.$src) {
533
+ var parsedSrc = this.$src;
534
+ var scopes = this.$parentScopes;
535
+ search = search.slice();
536
+ search[0] += `with(this.$parentScopes[${scopes.length}])`;
537
+ this.$parentScopes = scopes.concat(this.$scope);
538
+ }
532
539
  var getter = createGetter(search, false);
533
540
  on(key)(this, function (e) {
534
- var res = getter.call(this, e);
535
- if (res && isFunction(res.then)) res.then(digest, digest);
536
- digest();
537
- return res;
538
- });
539
- },
540
- once(key, search) {
541
- var getter = createGetter(search, false);
542
- once(key)(this, function (e) {
543
- var res = getter.call(this, e);
541
+ if (parsedSrc) {
542
+ var target = e.currentTarget || e.target;
543
+ var scopes = target && target.$parentScopes;
544
+ if (scopes) {
545
+ var scope = null;
546
+ for (var cx = scopes.length - 1; cx >= 0; cx--) {
547
+ var s = scopes[cx];
548
+ if (s === this.$scope) {
549
+ scope = scopes[cx + 1];
550
+ break;
551
+ }
552
+ }
553
+ }
554
+ if (!scope && target.$scope !== this.$scope) scope = target.$scope;
555
+ }
556
+ var res;
557
+ if (scope) {
558
+ var temp = this.$scope;
559
+ this.$scope = scope;
560
+ res = getter.call(this, e);
561
+ this.$scope = temp;
562
+ }
563
+ else {
564
+ res = getter.call(this, e);
565
+ }
544
566
  if (res && isFunction(res.then)) res.then(digest, digest);
545
567
  digest();
546
568
  return res;
547
569
  });
548
- }
570
+ };
571
+ };
572
+ var emiters = {
573
+ on: createEmiter(on),
574
+ once: createEmiter(once),
549
575
  };
550
576
  emiters.v = emiters.ng = emiters.on;
551
577
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.10.5",
3
+ "version": "3.11.2",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {