diff --git a/packages/core/src/components/datetime/test/basic.html b/packages/core/src/components/datetime/test/basic.html index c36450ac29..db09942f64 100644 --- a/packages/core/src/components/datetime/test/basic.html +++ b/packages/core/src/components/datetime/test/basic.html @@ -4,7 +4,7 @@ Ionic DateTime - + diff --git a/packages/core/src/components/item/item.tsx b/packages/core/src/components/item/item.tsx index 6a1ed88d5e..de49905001 100644 --- a/packages/core/src/components/item/item.tsx +++ b/packages/core/src/components/item/item.tsx @@ -1,7 +1,10 @@ -import { Component, Element, HostElement, Method, Prop, Listen } from '@stencil/core'; -import { CssClassMap } from '../../index'; +import { Component, Element, HostElement, Listen, Method, Prop, State } from '@stencil/core'; + import { createThemedClasses } from '../../utils/theme'; +import { CssClassMap } from '../../index'; + +import { RadioEvent } from '../radio/radio'; @Component({ tag: 'ion-item', @@ -14,10 +17,14 @@ import { createThemedClasses } from '../../utils/theme'; export class Item { private ids: number = -1; private id: string; + private inputs: any = []; private childStyles: CssClassMap = Object.create(null); private label: any; + // TODO get reorder from a parent list/group + @State() reorder: boolean = false; + @Element() private el: HTMLElement; @Prop() mode: string; @@ -42,11 +49,25 @@ export class Item { return hasChildStyleChange; } + // TODO? this loads after radio group + // @Listen('ionRadioDidLoad') + // protected radioDidLoad(ev: RadioEvent) { + // const radio = ev.detail.radio; + // // register the input inside of the item + // // reset to the item's id instead of the radiogroup id + // radio.id = 'rb-' + this.registerInput('radio'); + // radio.labelId = 'lbl-' + this.id; + // } + @Method() getLabelText(): string { return this.label ? this.label.getText() : ''; } + ionViewWillLoad() { + this.id = (++itemId).toString(); + } + ionViewDidLoad() { // Add item-button classes to each ion-button in the item const buttons = this.el.querySelectorAll('ion-button') as any; @@ -64,14 +85,22 @@ export class Item { // } // this.viewLabel = false; // } + + // if (this._viewLabel && this.inputs.length) { + // let labelText = this.getLabelText().trim(); + // this._viewLabel = (labelText.length > 0); + // } + + // if (this.inputs.length > 1) { + // this.setElementClass('item-multiple-inputs', true); + // } } /** * @hidden */ - @Method() registerInput(type: string) { - // this.inputs.push(type); + this.inputs.push(type); return this.id + '-' + (++this.ids); } @@ -93,53 +122,18 @@ export class Item { + { this.reorder + ? + : null + } +
); - - // template: - // '' + - // '
' + - // '
' + - // '' + - // '' + - // '' + - // '' + - // '' + - // '
' + - // '' + - // '' + - // '
' + - // '
', } - // _ids: number = -1; - // _inputs: Array = []; - // _label: Label; - // _viewLabel: boolean = true; - // _name: string = 'item'; - // _hasReorder: boolean; - - // /** - // * @hidden - // */ - // id: string; - - // /** - // * @hidden - // */ - // labelId: string = null; - - // constructor( - // form: Form, - // config: Config, - // elementRef: ElementRef, - // renderer: Renderer, - // @Optional() reorder: ItemReorder - // ) { - // super(config, elementRef, renderer, 'item'); - + // constructor() { // this._setName(elementRef); // this._hasReorder = !!reorder; // this.id = form.nextId().toString(); @@ -156,48 +150,6 @@ export class Item { // } // } - // /** - // * @hidden - // */ - // registerInput(type: string) { - // this._inputs.push(type); - // return this.id + '-' + (++this._ids); - // } - - // /** - // * @hidden - // */ - // ngAfterContentInit() { - // if (this._viewLabel && this._inputs.length) { - // let labelText = this.getLabelText().trim(); - // this._viewLabel = (labelText.length > 0); - // } - - // if (this._inputs.length > 1) { - // this.setElementClass('item-multiple-inputs', true); - // } - // } - - // /** - // * @hidden - // */ - // _updateColor(newColor: string, componentName?: string) { - // componentName = componentName || 'item'; // item-radio - // this._setColor(newColor, componentName); - // } - - // /** - // * @hidden - // */ - // _setName(elementRef: ElementRef) { - // let nodeName = elementRef.nativeElement.nodeName.replace('ION-', ''); - - // if (nodeName === 'LIST-HEADER' || nodeName === 'ITEM-DIVIDER') { - // this._name = nodeName; - // } - // } - - // /** // * @hidden // */ @@ -223,18 +175,6 @@ export class Item { // } // } - // /** - // * @hidden - // */ - // @ContentChildren(Button) - // set _buttons(buttons: QueryList