import {NgElement, Component, View} from 'angular2/angular2'
import {dom} from 'ionic/util'
import {IonicComponent} from 'ionic/config/component'
import {
ItemPrimaryOptions, ItemSecondaryOptions
} from 'ionic/components/item/item-options'
import {
ItemPrimarySwipeButtons, ItemSecondarySwipeButtons
} from 'ionic/components/item/item-swipe-buttons'
@Component({
selector: 'ion-item,[ion-item]'
})
@View({
template: `
`,
directives: [
ItemPrimarySwipeButtons,
// ItemSecondarySwipeButtons,
// ItemPrimaryOptions,
// ItemSecondaryOptions
]
})
export class Item {
constructor(
@NgElement() ele:NgElement
) {
this._isOpen = false
this._isSlideActive = false
this._isTransitioning = false
this._transform = ''
this.domElement = ele.domElement
this.swipeButtons = {}
this.optionButtons = {}
Item.config.invoke(this)
}
}
new IonicComponent(Item, {
propClasses: ['full']
})
function clsSetter(el, name) {
return (isSet) => el.classList[isSet?'add':'remove'](name)
}
class Slideable {
constructor(slideElement: Element) {
}
// override
onTransform(str: String) {}
// override
onTransitionActive(active: Boolean) {}
//override
onSlideActive(active: boolean) {}
transform(str: String) {
if (arguments.length && str !== this._transform) {
this.onTransform()
}
}
isTransitionActive(active: Boolean) {
if (arguments.length && active !== this._isTransitionActive) {
this._isTransitionActive = active
this.onSetTransitionActive(active)
}
return this._isTransitioning
}
isSlideActive(active: Boolean) {
if (arguments.length && active !== this._isSlideActive) {
this._isSlideActive = active
this.onSetDragActive(active)
}
return this._isSlideActive
}
isOpen(open: Boolean) {
if (arguments.length && open !== this._isOpen) {
this.isTransitionActive(true)
dom.rafPromise().then(() => {
this.isOpen = isOpen
this.onSetIsOpen(open)
})
}
}
}
class ItemSlideGesture {
}