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