文件操作 - autofill_event_fix.ts
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/app/core/directives/autofill_event_fix.ts
编辑文件内容
import coreModule from '../core_module'; /** @ngInject */ 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', autofillEventFix);
修改文件时间
将文件时间修改为当前时间的前一年
删除文件