diff --git a/src/components/item/item-reorder-gesture.ts b/src/components/item/item-reorder-gesture.ts index f87dde0a4ae..f7917e12fb8 100644 --- a/src/components/item/item-reorder-gesture.ts +++ b/src/components/item/item-reorder-gesture.ts @@ -47,7 +47,7 @@ export class ItemReorderGesture { console.error('ion-reorder does not contain $ionComponent'); return false; } - this.reorderList.reorderPrepare(); + this.reorderList._reorderPrepare(); let item = reorderMark.getReorderNode(); if (!item) { @@ -63,13 +63,13 @@ export class ItemReorderGesture { this.lastToIndex = indexForItem(item); this.windowHeight = window.innerHeight - AUTO_SCROLL_MARGIN; - this.lastScrollPosition = this.reorderList.scrollContent(0); + this.lastScrollPosition = this.reorderList._scrollContent(0); this.offset = pointerCoord(ev); this.offset.y += this.lastScrollPosition; item.classList.add(ITEM_REORDER_ACTIVE); - this.reorderList.reorderStart(); + this.reorderList._reorderStart(); return true; } @@ -97,7 +97,7 @@ export class ItemReorderGesture { this.lastToIndex = toIndex; this.lastYcoord = posY; this.emptyZone = false; - this.reorderList.reorderMove(fromIndex, toIndex, this.selectedItemHeight); + this.reorderList._reorderMove(fromIndex, toIndex, this.selectedItemHeight); } } else { this.emptyZone = true; @@ -133,7 +133,7 @@ export class ItemReorderGesture { } else { reorderInactive(); } - this.reorderList.reorderEmit(fromIndex, toIndex); + this.reorderList._reorderEmit(fromIndex, toIndex); } private itemForCoord(coord: PointerCoordinates): HTMLElement { @@ -142,9 +142,9 @@ export class ItemReorderGesture { private scroll(posY: number): number { if (posY < AUTO_SCROLL_MARGIN) { - this.lastScrollPosition = this.reorderList.scrollContent(-SCROLL_JUMP); + this.lastScrollPosition = this.reorderList._scrollContent(-SCROLL_JUMP); } else if (posY > this.windowHeight) { - this.lastScrollPosition = this.reorderList.scrollContent(SCROLL_JUMP); + this.lastScrollPosition = this.reorderList._scrollContent(SCROLL_JUMP); } return this.lastScrollPosition; } diff --git a/src/components/item/item-reorder.ts b/src/components/item/item-reorder.ts index 50f7e38629e..6128c296619 100644 --- a/src/components/item/item-reorder.ts +++ b/src/components/item/item-reorder.ts @@ -133,19 +133,10 @@ export interface ReorderIndexes { }) export class ItemReorder { - /** @private */ _enableReorder: boolean = false; - - /** @private */ _visibleReorder: boolean = false; - - /** @private */ _reorderGesture: ItemReorderGesture; - - /** @private */ _lastToIndex: number = -1; - - /** @private */ _element: HTMLElement; /** @@ -196,10 +187,7 @@ export class ItemReorder { } } - /** - * @private - */ - reorderPrepare() { + _reorderPrepare() { let ele = this._element; let children: any = ele.children; for (let i = 0, ilen = children.length; i < ilen; i++) { @@ -209,18 +197,12 @@ export class ItemReorder { } } - /** - * @private - */ - reorderStart() { + _reorderStart() { this.setElementClass('reorder-list-active', true); } - /** - * @private - */ - reorderEmit(fromIndex: number, toIndex: number) { - this.reorderReset(); + _reorderEmit(fromIndex: number, toIndex: number) { + this._reorderReset(); if (fromIndex !== toIndex) { this._zone.run(() => { this.ionItemReorder.emit({ @@ -231,10 +213,7 @@ export class ItemReorder { } } - /** - * @private - */ - scrollContent(scroll: number) { + _scrollContent(scroll: number) { let scrollTop = this._content.getScrollTop() + scroll; if (scroll !== 0) { this._content.scrollTo(0, scrollTop, 0); @@ -242,10 +221,7 @@ export class ItemReorder { return scrollTop; } - /** - * @private - */ - reorderReset() { + _reorderReset() { let children = this._element.children; let len = children.length; @@ -257,10 +233,7 @@ export class ItemReorder { this._lastToIndex = -1; } - /** - * @private - */ - reorderMove(fromIndex: number, toIndex: number, itemHeight: number) { + _reorderMove(fromIndex: number, toIndex: number, itemHeight: number) { if (this._lastToIndex === -1) { this._lastToIndex = fromIndex; } diff --git a/src/components/item/item-sliding-gesture.ts b/src/components/item/item-sliding-gesture.ts index 65276ebb359..1e0f66d6479 100644 --- a/src/components/item/item-sliding-gesture.ts +++ b/src/components/item/item-sliding-gesture.ts @@ -10,6 +10,7 @@ const DRAG_THRESHOLD = 10; const MAX_ATTACK_ANGLE = 20; export class ItemSlidingGesture extends PanGesture { + private preSelectedContainer: ItemSliding = null; private selectedContainer: ItemSliding = null; private openContainer: ItemSliding = null; diff --git a/src/components/item/item.ts b/src/components/item/item.ts index 9414bc81a09..95bcf75c9f6 100644 --- a/src/components/item/item.ts +++ b/src/components/item/item.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, ContentChild, ContentChildren, Directive, ElementRef, Input, QueryList, Renderer, ViewChild, ViewEncapsulation } from '@angular/core'; +import { ChangeDetectionStrategy, Component, ContentChild, ContentChildren, Directive, ElementRef, Input, QueryList, Renderer, Optional, ViewChild, ViewEncapsulation } from '@angular/core'; import { Button } from '../button/button'; import { Config } from '../../config/config'; @@ -6,6 +6,7 @@ import { Form } from '../../util/form'; import { Icon } from '../icon/icon'; import { Ion } from '../ion'; import { Label } from '../label/label'; +import { ItemReorder } from './item-reorder'; /** @@ -283,7 +284,7 @@ import { Label } from '../label/label'; '' + '' + '' + - '' + + '' + '' + '
', host: { @@ -297,6 +298,7 @@ export class Item extends Ion { _inputs: Array = []; _label: Label; _viewLabel: boolean = true; + _shouldHaveReorder: boolean = false; /** * @private @@ -324,9 +326,15 @@ export class Item extends Ion { this._setMode('item', val); } - constructor(form: Form, config: Config, elementRef: ElementRef, renderer: Renderer) { + constructor( + form: Form, + config: Config, + elementRef: ElementRef, + renderer: Renderer, + @Optional() reorder: ItemReorder + ) { super(config, elementRef, renderer); - + this._shouldHaveReorder = !!reorder; this.mode = config.get('mode'); this.id = form.nextId().toString(); } diff --git a/src/navigation/nav-controller-base.ts b/src/navigation/nav-controller-base.ts index da14b6178a3..dcc17b179d4 100644 --- a/src/navigation/nav-controller-base.ts +++ b/src/navigation/nav-controller-base.ts @@ -24,6 +24,7 @@ import { TransitionController } from '../transitions/transition-controller'; * This class is for internal use only. It is not exported publicly. */ export class NavControllerBase extends Ion implements NavController { + _children: any[] = []; _ids: number = -1; _init = false;