mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 16:16:41 +08:00
chore(tslint): fixes all JS linting issues
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
import { Component, Listen, Method } from '@stencil/core';
|
import { Component, Listen, Method } from '@stencil/core';
|
||||||
import { ActionSheetEvent, ActionSheetOptions, OverlayController } from '../../index';
|
import { ActionSheetEvent, ActionSheetOptions, OverlayController } from '../../index';
|
||||||
import { createOverlay, getTopOverlay, dismissOverlay, removeLastOverlay } from '../../utils/overlays';
|
import { createOverlay, dismissOverlay, getTopOverlay, removeLastOverlay } from '../../utils/overlays';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
tag: 'ion-action-sheet-controller'
|
tag: 'ion-action-sheet-controller'
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { Animation, AnimationBuilder, Config, CssClassMap, DomController, Overla
|
|||||||
|
|
||||||
import { domControllerAsync } from '../../utils/helpers';
|
import { domControllerAsync } from '../../utils/helpers';
|
||||||
import { createThemedClasses, getClassMap } from '../../utils/theme';
|
import { createThemedClasses, getClassMap } from '../../utils/theme';
|
||||||
import { OverlayInterface, BACKDROP, overlayAnimation } from '../../utils/overlays';
|
import { BACKDROP, OverlayInterface, overlayAnimation } from '../../utils/overlays';
|
||||||
|
|
||||||
import iosEnterAnimation from './animations/ios.enter';
|
import iosEnterAnimation from './animations/ios.enter';
|
||||||
import iosLeaveAnimation from './animations/ios.leave';
|
import iosLeaveAnimation from './animations/ios.leave';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Component, Listen, Method } from '@stencil/core';
|
import { Component, Listen, Method } from '@stencil/core';
|
||||||
import { AlertEvent, AlertOptions, OverlayController } from '../../index';
|
import { AlertEvent, AlertOptions, OverlayController } from '../../index';
|
||||||
import { createOverlay, removeLastOverlay, dismissOverlay, getTopOverlay } from '../../utils/overlays';
|
import { createOverlay, dismissOverlay, getTopOverlay, removeLastOverlay } from '../../utils/overlays';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
tag: 'ion-alert-controller'
|
tag: 'ion-alert-controller'
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { Component, Element, Event, EventEmitter, Listen, Method, Prop } from '@stencil/core';
|
import { Component, Element, Event, EventEmitter, Listen, Method, Prop } from '@stencil/core';
|
||||||
import { Animation, AnimationBuilder, Config, CssClassMap, DomController, OverlayDismissEvent, OverlayDismissEventDetail } from '../../index';
|
import { Animation, AnimationBuilder, Config, CssClassMap, DomController, OverlayDismissEvent, OverlayDismissEventDetail } from '../../index';
|
||||||
import { domControllerAsync, autoFocus } from '../../utils/helpers';
|
import { autoFocus, domControllerAsync } from '../../utils/helpers';
|
||||||
import { createThemedClasses, getClassMap } from '../../utils/theme';
|
import { createThemedClasses, getClassMap } from '../../utils/theme';
|
||||||
import { OverlayInterface, BACKDROP, overlayAnimation } from '../../utils/overlays';
|
import { BACKDROP, OverlayInterface, overlayAnimation } from '../../utils/overlays';
|
||||||
|
|
||||||
import iosEnterAnimation from './animations/ios.enter';
|
import iosEnterAnimation from './animations/ios.enter';
|
||||||
import iosLeaveAnimation from './animations/ios.leave';
|
import iosLeaveAnimation from './animations/ios.leave';
|
||||||
@ -282,7 +282,7 @@ export class Alert implements OverlayInterface {
|
|||||||
{i.label}
|
{i.label}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{this.mode==="md" ? <ion-ripple-effect /> : null}
|
{this.mode === 'md' ? <ion-ripple-effect /> : null}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@ -302,7 +302,7 @@ export class Alert implements OverlayInterface {
|
|||||||
{i.label}
|
{i.label}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{this.mode==="md" ? <ion-ripple-effect /> : null}
|
{this.mode === 'md' ? <ion-ripple-effect /> : null}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { GestureController } from "./gesture-controller";
|
import { GestureController } from './gesture-controller';
|
||||||
|
|
||||||
export class GestureDelegate {
|
export class GestureDelegate {
|
||||||
private ctrl: GestureController|null;
|
private ctrl: GestureController|null;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Component, Event, EventEmitter, Method } from '@stencil/core';
|
import { Component, Event, EventEmitter, Method } from '@stencil/core';
|
||||||
import { GestureConfig, GestureDelegate, BlockerConfig, BlockerDelegate } from './gesture-controller-utils';
|
import { BlockerConfig, BlockerDelegate, GestureConfig, GestureDelegate } from './gesture-controller-utils';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|||||||
@ -241,7 +241,7 @@ describe('gesture controller', () => {
|
|||||||
describe('BlockerDelegate', () => {
|
describe('BlockerDelegate', () => {
|
||||||
it('create one', async () => {
|
it('create one', async () => {
|
||||||
const c = new GestureController();
|
const c = new GestureController();
|
||||||
const b = await c.createBlocker({
|
const b = c.createBlocker({
|
||||||
disableScroll: true,
|
disableScroll: true,
|
||||||
disable: ['event1', 'event2', 'event3', 'event4']
|
disable: ['event1', 'event2', 'event3', 'event4']
|
||||||
});
|
});
|
||||||
@ -251,7 +251,7 @@ describe('gesture controller', () => {
|
|||||||
expect(b['ctrl']).toEqual(c);
|
expect(b['ctrl']).toEqual(c);
|
||||||
expect(b['id']).toEqual(1);
|
expect(b['id']).toEqual(1);
|
||||||
|
|
||||||
const b2 = await c.createBlocker({
|
const b2 = c.createBlocker({
|
||||||
disable: ['event2', 'event3', 'event4', 'event5']
|
disable: ['event2', 'event3', 'event4', 'event5']
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -314,11 +314,11 @@ describe('gesture controller', () => {
|
|||||||
const g2 = await c.create({ name: 'goback2' });
|
const g2 = await c.create({ name: 'goback2' });
|
||||||
expect(g2.canStart()).toEqual(true);
|
expect(g2.canStart()).toEqual(true);
|
||||||
|
|
||||||
const g3 = await c.createBlocker({
|
const g3 = c.createBlocker({
|
||||||
disable: ['range', 'goback', 'something']
|
disable: ['range', 'goback', 'something']
|
||||||
});
|
});
|
||||||
|
|
||||||
const g4 = await c.createBlocker({
|
const g4 = c.createBlocker({
|
||||||
disable: ['range']
|
disable: ['range']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Component, Event, EventEmitter, EventListenerEnable, Listen, Prop, Watch } from '@stencil/core';
|
import { Component, Event, EventEmitter, EventListenerEnable, Listen, Prop, Watch } from '@stencil/core';
|
||||||
import { ElementRef, assert, now, updateDetail } from '../../utils/helpers';
|
import { ElementRef, assert, now, updateDetail } from '../../utils/helpers';
|
||||||
import { DomController, BlockerDelegate, GestureDelegate, BlockerConfig } from '../../index';
|
import { BlockerConfig, BlockerDelegate, DomController, GestureDelegate } from '../../index';
|
||||||
import { BLOCK_ALL } from '../gesture-controller/gesture-controller-utils';
|
import { BLOCK_ALL } from '../gesture-controller/gesture-controller-utils';
|
||||||
import { PanRecognizer } from './recognizers';
|
import { PanRecognizer } from './recognizers';
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ export function relocateInput(
|
|||||||
componentEl: HTMLElement,
|
componentEl: HTMLElement,
|
||||||
inputEl: HTMLInputElement,
|
inputEl: HTMLInputElement,
|
||||||
shouldRelocate: boolean,
|
shouldRelocate: boolean,
|
||||||
inputRelativeY: number = 0
|
inputRelativeY = 0
|
||||||
) {
|
) {
|
||||||
if ((componentEl as any)[RELOCATED_KEY] === shouldRelocate) {
|
if ((componentEl as any)[RELOCATED_KEY] === shouldRelocate) {
|
||||||
return;
|
return;
|
||||||
@ -79,8 +79,6 @@ function cloneInputComponent(componentEl: HTMLElement, inputEl: HTMLInputElement
|
|||||||
|
|
||||||
const clonedInputEl = document.createElement('input');
|
const clonedInputEl = document.createElement('input');
|
||||||
clonedInputEl.classList.add(...Array.from(inputEl.classList));
|
clonedInputEl.classList.add(...Array.from(inputEl.classList));
|
||||||
// Object.assign(clonedInputEl, input);
|
|
||||||
//const clonedInputEl = <HTMLInputElement>inputEl.cloneNode(false);
|
|
||||||
clonedInputEl.value = inputEl.value;
|
clonedInputEl.value = inputEl.value;
|
||||||
clonedInputEl.type = inputEl.type;
|
clonedInputEl.type = inputEl.type;
|
||||||
clonedInputEl.placeholder = inputEl.placeholder;
|
clonedInputEl.placeholder = inputEl.placeholder;
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { isFocused, relocateInput } from "./common";
|
import { isFocused, relocateInput } from './common';
|
||||||
|
|
||||||
|
|
||||||
export default function enableHideCaretOnScroll(componentEl: HTMLElement, inputEl: HTMLInputElement, scrollEl: HTMLIonScrollElement) {
|
export default function enableHideCaretOnScroll(componentEl: HTMLElement, inputEl: HTMLInputElement, scrollEl: HTMLIonScrollElement) {
|
||||||
if (!scrollEl || !inputEl) {
|
if (!scrollEl || !inputEl) {
|
||||||
return () => {};
|
return () => { return; };
|
||||||
}
|
}
|
||||||
console.debug('Input: enableHideCaretOnScroll');
|
console.debug('Input: enableHideCaretOnScroll');
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { App } from "../../..";
|
import { App } from '../../..';
|
||||||
|
|
||||||
const SKIP_BLURRING = ['INPUT', 'TEXTAREA', 'ION-INPUT', 'ION-TEXTAREA'];
|
const SKIP_BLURRING = ['INPUT', 'TEXTAREA', 'ION-INPUT', 'ION-TEXTAREA'];
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { pointerCoord } from "../../../utils/helpers";
|
import { pointerCoord } from '../../../utils/helpers';
|
||||||
import { relocateInput, isFocused } from "./common";
|
import { isFocused, relocateInput } from './common';
|
||||||
import { getScrollData } from "./scroll-data";
|
import { getScrollData } from './scroll-data';
|
||||||
|
|
||||||
|
|
||||||
export default function enableScrollAssist(
|
export default function enableScrollAssist(
|
||||||
|
|||||||
@ -40,6 +40,6 @@ function setScrollPadding(input: HTMLElement, keyboardHeight: number) {
|
|||||||
} else {
|
} else {
|
||||||
(el as any)[PADDING_TIMER_KEY] = setTimeout(() => {
|
(el as any)[PADDING_TIMER_KEY] = setTimeout(() => {
|
||||||
el.style.paddingBottom = '';
|
el.style.paddingBottom = '';
|
||||||
}, 120)
|
}, 120);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { Component, Listen, Prop } from "@stencil/core";
|
import { Component, Listen, Prop } from '@stencil/core';
|
||||||
import { App, Config } from "../..";
|
import { App, Config } from '../..';
|
||||||
|
|
||||||
import enableHideCaretOnScroll from "./hacks/hide-caret";
|
import enableHideCaretOnScroll from './hacks/hide-caret';
|
||||||
import enableInputBlurring from "./hacks/input-blurring";
|
import enableInputBlurring from './hacks/input-blurring';
|
||||||
import enableScrollAssist from "./hacks/scroll-assist";
|
import enableScrollAssist from './hacks/scroll-assist';
|
||||||
import enableScrollPadding from "./hacks/scroll-padding";
|
import enableScrollPadding from './hacks/scroll-padding';
|
||||||
|
|
||||||
const INPUT_BLURRING = true;
|
const INPUT_BLURRING = true;
|
||||||
const SCROLL_ASSIST = true;
|
const SCROLL_ASSIST = true;
|
||||||
@ -45,7 +45,7 @@ export class InputShims {
|
|||||||
// At this point we need to look for all the ion-inputs not registered yet
|
// At this point we need to look for all the ion-inputs not registered yet
|
||||||
// and register them.
|
// and register them.
|
||||||
const inputs = Array.from(document.querySelectorAll('ion-input'));
|
const inputs = Array.from(document.querySelectorAll('ion-input'));
|
||||||
for (let input of inputs) {
|
for (const input of inputs) {
|
||||||
this.registerInput(input);
|
this.registerInput(input);
|
||||||
}
|
}
|
||||||
this.didLoad = true;
|
this.didLoad = true;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Component, Event, EventEmitter, Prop, Watch, Element } from '@stencil/core';
|
import { Component, Element, Event, EventEmitter, Prop, Watch } from '@stencil/core';
|
||||||
|
|
||||||
import { debounceEvent } from '../../utils/helpers';
|
import { debounceEvent } from '../../utils/helpers';
|
||||||
import { createThemedClasses } from '../../utils/theme';
|
import { createThemedClasses } from '../../utils/theme';
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import iosEnterAnimation from './animations/ios.enter';
|
|||||||
import iosLeaveAnimation from './animations/ios.leave';
|
import iosLeaveAnimation from './animations/ios.leave';
|
||||||
import mdEnterAnimation from './animations/md.enter';
|
import mdEnterAnimation from './animations/md.enter';
|
||||||
import mdLeaveAnimation from './animations/md.leave';
|
import mdLeaveAnimation from './animations/md.leave';
|
||||||
import { OverlayInterface, BACKDROP, overlayAnimation } from '../../utils/overlays';
|
import { BACKDROP, OverlayInterface, overlayAnimation } from '../../utils/overlays';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
tag: 'ion-loading',
|
tag: 'ion-loading',
|
||||||
|
|||||||
@ -55,7 +55,7 @@ export class MenuButton {
|
|||||||
return (
|
return (
|
||||||
<ion-menu-toggle menu={this.menu} autoHide={this.autoHide}>
|
<ion-menu-toggle menu={this.menu} autoHide={this.autoHide}>
|
||||||
<ion-button>
|
<ion-button>
|
||||||
<ion-icon slot="icon-only" name={menuIcon}></ion-icon>
|
<ion-icon slot='icon-only' name={menuIcon}></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</ion-menu-toggle>
|
</ion-menu-toggle>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { Animation, AnimationBuilder, Config, DomController, FrameworkDelegate,
|
|||||||
import { DomFrameworkDelegate } from '../../utils/dom-framework-delegate';
|
import { DomFrameworkDelegate } from '../../utils/dom-framework-delegate';
|
||||||
import { domControllerAsync } from '../../utils/helpers';
|
import { domControllerAsync } from '../../utils/helpers';
|
||||||
import { createThemedClasses } from '../../utils/theme';
|
import { createThemedClasses } from '../../utils/theme';
|
||||||
import { OverlayInterface, BACKDROP, overlayAnimation } from '../../utils/overlays';
|
import { BACKDROP, OverlayInterface, overlayAnimation } from '../../utils/overlays';
|
||||||
|
|
||||||
import iosEnterAnimation from './animations/ios.enter';
|
import iosEnterAnimation from './animations/ios.enter';
|
||||||
import iosLeaveAnimation from './animations/ios.leave';
|
import iosLeaveAnimation from './animations/ios.leave';
|
||||||
|
|||||||
@ -1127,7 +1127,8 @@ export function updateNavStacks(enteringView: ViewController, leavingView: ViewC
|
|||||||
return Promise.all(destroyQueuePromises);
|
return Promise.all(destroyQueuePromises);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
})/*.then(() => {
|
});
|
||||||
|
/* .then(() => {
|
||||||
// set which animation it should use if it wasn't set yet
|
// set which animation it should use if it wasn't set yet
|
||||||
if (ti.requiresTransition && !ti.opts.animation) {
|
if (ti.requiresTransition && !ti.opts.animation) {
|
||||||
ti.opts.animation = isDef(ti.removeStart)
|
ti.opts.animation = isDef(ti.removeStart)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Component, Listen, Method } from '@stencil/core';
|
import { Component, Listen, Method } from '@stencil/core';
|
||||||
import { OverlayController, PickerEvent, PickerOptions } from '../../index';
|
import { OverlayController, PickerEvent, PickerOptions } from '../../index';
|
||||||
import { createOverlay, getTopOverlay, removeLastOverlay, dismissOverlay } from '../../utils/overlays';
|
import { createOverlay, dismissOverlay, getTopOverlay, removeLastOverlay } from '../../utils/overlays';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|||||||
@ -81,9 +81,9 @@ export default function iosEnterAnimation(Animation: Animation, baseEl: HTMLElem
|
|||||||
(targetTop - contentHeight) > 0
|
(targetTop - contentHeight) > 0
|
||||||
) {
|
) {
|
||||||
arrowCSS.top = targetTop - (arrowHeight + 1);
|
arrowCSS.top = targetTop - (arrowHeight + 1);
|
||||||
console.log(arrowCSS)
|
console.log(arrowCSS);
|
||||||
console.log(targetTop)
|
console.log(targetTop);
|
||||||
console.log(contentHeight)
|
console.log(contentHeight);
|
||||||
popoverCSS.top = targetTop - contentHeight - (arrowHeight - 1);
|
popoverCSS.top = targetTop - contentHeight - (arrowHeight - 1);
|
||||||
|
|
||||||
baseEl.className = baseEl.className + ' popover-bottom';
|
baseEl.className = baseEl.className + ' popover-bottom';
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { Animation, AnimationBuilder, Config, DomController, FrameworkDelegate,
|
|||||||
import { DomFrameworkDelegate } from '../../utils/dom-framework-delegate';
|
import { DomFrameworkDelegate } from '../../utils/dom-framework-delegate';
|
||||||
import { domControllerAsync } from '../../utils/helpers';
|
import { domControllerAsync } from '../../utils/helpers';
|
||||||
import { createThemedClasses } from '../../utils/theme';
|
import { createThemedClasses } from '../../utils/theme';
|
||||||
import { OverlayInterface, BACKDROP, overlayAnimation } from '../../utils/overlays';
|
import { BACKDROP, OverlayInterface, overlayAnimation } from '../../utils/overlays';
|
||||||
|
|
||||||
import iosEnterAnimation from './animations/ios.enter';
|
import iosEnterAnimation from './animations/ios.enter';
|
||||||
import iosLeaveAnimation from './animations/ios.leave';
|
import iosLeaveAnimation from './animations/ios.leave';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Component, Element, Event, EventEmitter, EventListenerEnable, Listen, Method, Prop } from '@stencil/core';
|
import { Component, Element, Event, EventEmitter, EventListenerEnable, Listen, Method, Prop } from '@stencil/core';
|
||||||
import { Config, DomController, GestureDetail, GestureDelegate } from '../../index';
|
import { Config, DomController, GestureDelegate, GestureDetail } from '../../index';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -65,7 +65,7 @@ export class Scroll {
|
|||||||
priority: 100,
|
priority: 100,
|
||||||
disableScroll: false,
|
disableScroll: false,
|
||||||
}).then((gesture) => {
|
}).then((gesture) => {
|
||||||
this.gesture = gesture
|
this.gesture = gesture;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -522,7 +522,7 @@ export class Select {
|
|||||||
onBlur={this.onBlur.bind(this)}
|
onBlur={this.onBlur.bind(this)}
|
||||||
class='select-cover'>
|
class='select-cover'>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
{this.mode==="md" ? <ion-ripple-effect /> : null}
|
{this.mode === 'md' ? <ion-ripple-effect /> : null}
|
||||||
</button>,
|
</button>,
|
||||||
<input type='hidden' name={this.name} value={this.value}/>
|
<input type='hidden' name={this.name} value={this.value}/>
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { AnimationBuilder, Animation } from "..";
|
import { Animation, AnimationBuilder } from '..';
|
||||||
import { playAnimationAsync } from "./helpers";
|
import { playAnimationAsync } from './helpers';
|
||||||
|
|
||||||
let lastId = 1;
|
let lastId = 1;
|
||||||
|
|
||||||
@ -8,7 +8,7 @@ let lastId = 1;
|
|||||||
*/
|
*/
|
||||||
export type Requires<K extends string> = {
|
export type Requires<K extends string> = {
|
||||||
[P in K]: any;
|
[P in K]: any;
|
||||||
}
|
};
|
||||||
|
|
||||||
export function createOverlay
|
export function createOverlay
|
||||||
<T extends HTMLIonOverlayElement & Requires<keyof B>, B>
|
<T extends HTMLIonOverlayElement & Requires<keyof B>, B>
|
||||||
|
|||||||
Reference in New Issue
Block a user