mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 18:17:31 +08:00
feat(angular): angular 9 support (#19515)
* init ivy support * chore(): angular prerelease * chore: update * updates * angular 8 deps * chore(angular): update sync script * updates * chore(): remove console log * chore(): updates * chore(): update release script * fix(): remove comments * fix(): remove test version * fix(): failing angular test * fix(): failing angular tests * fix(): update ci steps * fix(): fix sync script * chore(): refactor angular proxies * chore(): updates * chore(): updates * chore(): lint * chore(): updates * chore(ssr): check for window * chore(): fix virtual scroll angular tests * chore(): lint * chore(): add server to link * chore(scripts): update release script * chore(): bump version check * style(scripts): spacing
This commit is contained in:
@ -5,10 +5,12 @@ export const proxyInputs = (Cmp: any, inputs: string[]) => {
|
||||
const Prototype = Cmp.prototype;
|
||||
inputs.forEach(item => {
|
||||
Object.defineProperty(Prototype, item, {
|
||||
get() { return this.el[item]; },
|
||||
set(val: any) {
|
||||
this.z.runOutsideAngular(() => this.el[item] = val);
|
||||
get() {
|
||||
return this.el[item];
|
||||
},
|
||||
set(val: any) {
|
||||
this.z.runOutsideAngular(() => (this.el[item] = val));
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -16,13 +18,29 @@ export const proxyInputs = (Cmp: any, inputs: string[]) => {
|
||||
export const proxyMethods = (Cmp: any, methods: string[]) => {
|
||||
const Prototype = Cmp.prototype;
|
||||
methods.forEach(methodName => {
|
||||
Prototype[methodName] = function() {
|
||||
Prototype[methodName] = function () {
|
||||
const args = arguments;
|
||||
return this.z.runOutsideAngular(() => this.el[methodName].apply(this.el, args));
|
||||
return this.z.runOutsideAngular(() =>
|
||||
this.el[methodName].apply(this.el, args)
|
||||
);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
export const proxyOutputs = (instance: any, el: any, events: string[]) => {
|
||||
events.forEach(eventName => instance[eventName] = fromEvent(el, eventName));
|
||||
};
|
||||
}
|
||||
|
||||
// tslint:disable-next-line: only-arrow-functions
|
||||
export function ProxyCmp(opts: { inputs?: any; methods?: any }) {
|
||||
const decorator = function(cls: any){
|
||||
if (opts.inputs) {
|
||||
proxyInputs(cls, opts.inputs);
|
||||
}
|
||||
if (opts.methods) {
|
||||
proxyMethods(cls, opts.methods);
|
||||
}
|
||||
return cls;
|
||||
};
|
||||
return decorator;
|
||||
}
|
||||
|
Reference in New Issue
Block a user