|
@@ -1,16 +1,24 @@
|
|
import _ from 'lodash'
|
|
import _ from 'lodash'
|
|
import {lookupFn, lookupScope} from "./lib/lib"
|
|
import {lookupFn, lookupScope} from "./lib/lib"
|
|
import initCols from './controls/cols'
|
|
import initCols from './controls/cols'
|
|
|
|
+import * as SystemLib from './lib/systemLib'
|
|
|
|
+import './lib/fix'
|
|
|
|
|
|
export function init() {
|
|
export function init() {
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * 改变事件的获取方式.
|
|
|
|
- * 具体见: ext-all-debug.js:23216 addListener
|
|
|
|
- * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
|
|
|
|
- * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
|
|
|
|
|
|
+ * 改变事件的触发方式
|
|
*/
|
|
*/
|
|
- const _doAddListener = Ext.mixin.Observable.prototype.doAddListener
|
|
|
|
- Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
|
|
|
|
|
|
+ const _getFireInfo = Ext.util.Event.prototype.getFireInfo
|
|
|
|
+ Ext.util.Event.prototype.getFireInfo = function (listener, fromWrapped) {
|
|
|
|
+ var observable = this.observable,
|
|
|
|
+ fireFn = listener.fireFn,
|
|
|
|
+ scope = listener.scope,
|
|
|
|
+ namedScope = listener.namedScope,
|
|
|
|
+ fn, origin;
|
|
|
|
+
|
|
|
|
+ fn = fromWrapped ? listener.fn : fireFn;
|
|
|
|
+
|
|
if (typeof fn === 'string' &&
|
|
if (typeof fn === 'string' &&
|
|
(_.startsWith(fn, 'scope.') ||
|
|
(_.startsWith(fn, 'scope.') ||
|
|
_.startsWith(fn, 'system.') ||
|
|
_.startsWith(fn, 'system.') ||
|
|
@@ -20,19 +28,61 @@ export function init() {
|
|
if (window["IS_DESIGN_MODE"]) {
|
|
if (window["IS_DESIGN_MODE"]) {
|
|
fn = Ext.emptyFn
|
|
fn = Ext.emptyFn
|
|
} else {
|
|
} else {
|
|
- // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
|
|
|
|
- // const vm = this.lookupViewModel()
|
|
|
|
- // if (vm && vm.yvanScope) {
|
|
|
|
- // scope = vm.yvanScope
|
|
|
|
- // fn = scope[fn.substr('scope.'.length)]
|
|
|
|
- // }
|
|
|
|
- scope = lookupScope(this)
|
|
|
|
|
|
+ scope = lookupScope(observable)
|
|
fn = lookupFn(scope, fn)
|
|
fn = lookupFn(scope, fn)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ return {scope, fn}
|
|
}
|
|
}
|
|
|
|
|
|
- _doAddListener.call(this, ename, fn, scope, options, order, caller, manager)
|
|
|
|
|
|
+ return _getFireInfo.call(this, listener, fromWrapped)
|
|
|
|
+ }
|
|
|
|
+ // const _addListener = Ext.mixin.Observable.prototype.addListener
|
|
|
|
+ // Ext.mixin.Observable.prototype.addListener = function (eventName, fn, scope, options, order, caller) {
|
|
|
|
+ // console.log('addListener', eventName, fn, scope, options, order, caller)
|
|
|
|
+ // // const scope = lookupScope(this)
|
|
|
|
+ // // const fn = lookupFn(scope, fn)
|
|
|
|
+ //
|
|
|
|
+ // return _addListener.call(this, eventName, fn, scope, options, order, caller)
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 改变事件的获取方式.
|
|
|
|
+ * 具体见: ext-all-debug.js:23216 addListener
|
|
|
|
+ * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
|
|
|
|
+ * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
|
|
|
|
+ */
|
|
|
|
+ // const _doAddListener = Ext.mixin.Observable.prototype.doAddListener
|
|
|
|
+ // Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
|
|
|
|
+ // console.log('doAddListener', ename, fn, scope)
|
|
|
|
+ // if (typeof fn === 'string' &&
|
|
|
|
+ // (_.startsWith(fn, 'scope.') ||
|
|
|
|
+ // _.startsWith(fn, 'system.') ||
|
|
|
|
+ // _.startsWith(fn, 'format.')
|
|
|
|
+ // )) {
|
|
|
|
+ //
|
|
|
|
+ // if (window["IS_DESIGN_MODE"]) {
|
|
|
|
+ // fn = Ext.emptyFn
|
|
|
|
+ // } else {
|
|
|
|
+ // // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
|
|
|
|
+ // // const vm = this.lookupViewModel()
|
|
|
|
+ // // if (vm && vm.yvanScope) {
|
|
|
|
+ // // scope = vm.yvanScope
|
|
|
|
+ // // fn = scope[fn.substr('scope.'.length)]
|
|
|
|
+ // // }
|
|
|
|
+ // scope = lookupScope(this)
|
|
|
|
+ // fn = lookupFn(scope, fn)
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // _doAddListener.call(this, ename, fn, scope, options, order, caller, manager)
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // 将 SystemLib 扩展到 window.system 下
|
|
|
|
+ if (!window['system']) {
|
|
|
|
+ window['system'] = {}
|
|
}
|
|
}
|
|
|
|
+ _.extend(window['system'], SystemLib)
|
|
|
|
|
|
initCols()
|
|
initCols()
|
|
}
|
|
}
|