mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
3a7623753b
* build(webpack): replace babel-loader with esbuild-loader * build(webpack): add esbuild minifier to production builds * Wip * Removed ngInject and replaced with manual inject params * chore: bump esbuild to 0.15.13 * Fixed angular issues * build(frontend): update esbuild to 0.16.16 * chore(webpack): support browserslist for esbuild * build(esbuild): unify versions of esbuild to 0.16.17 and esbuild-loader to 2.21.0 Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import coreModule from './core_module';
|
|
|
|
export function autofillEventFix($compile: any) {
|
|
return {
|
|
link: ($scope: any, elem: any) => {
|
|
const input = elem[0];
|
|
const dispatchChangeEvent = () => {
|
|
const event = new Event('change');
|
|
return input.dispatchEvent(event);
|
|
};
|
|
const onAnimationStart = ({ animationName }: AnimationEvent) => {
|
|
switch (animationName) {
|
|
case 'onAutoFillStart':
|
|
return dispatchChangeEvent();
|
|
case 'onAutoFillCancel':
|
|
return dispatchChangeEvent();
|
|
}
|
|
return null;
|
|
};
|
|
|
|
// const onChange = (evt: Event) => console.log(evt);
|
|
|
|
input.addEventListener('animationstart', onAnimationStart);
|
|
// input.addEventListener('change', onChange);
|
|
|
|
$scope.$on('$destroy', () => {
|
|
input.removeEventListener('animationstart', onAnimationStart);
|
|
// input.removeEventListener('change', onChange);
|
|
});
|
|
},
|
|
};
|
|
}
|
|
|
|
coreModule.directive('autofillEventFix', ['$compile', autofillEventFix]);
|