mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
Segment runs (incorrectly though)
This commit is contained in:
@ -1,32 +1,28 @@
|
||||
.platform-ios {
|
||||
.segment-ios .ion-segment {
|
||||
> button,
|
||||
> [button] {
|
||||
border-width: 1px;
|
||||
|
||||
.ion-segment {
|
||||
transition: 100ms all linear;
|
||||
|
||||
> button,
|
||||
> [button] {
|
||||
border-width: 1px;
|
||||
color: get-color(primary, base);
|
||||
|
||||
transition: 100ms all linear;
|
||||
min-height: 3.3rem;
|
||||
line-height: 3.3rem;
|
||||
|
||||
color: get-color(primary, base);
|
||||
&.active {
|
||||
background-color: get-color(primary, base);
|
||||
color: white;
|
||||
}
|
||||
|
||||
min-height: 3.3rem;
|
||||
line-height: 3.3rem;
|
||||
border-style: solid;
|
||||
border-color: get-color(primary, base);
|
||||
|
||||
&.active {
|
||||
background-color: get-color(primary, base);
|
||||
color: white;
|
||||
}
|
||||
|
||||
border-style: solid;
|
||||
border-color: get-color(primary, base);
|
||||
|
||||
&:first-of-type {
|
||||
border-right-width: 0px;
|
||||
}
|
||||
&:last-of-type {
|
||||
border-left-width: 0px;
|
||||
}
|
||||
&:first-of-type {
|
||||
border-right-width: 0px;
|
||||
}
|
||||
&:last-of-type {
|
||||
border-left-width: 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import {Component, Directive, onInit} from 'angular2/src/core/annotations_impl/a
|
||||
import {Ancestor} from 'angular2/src/core/annotations_impl/visibility';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {NgControl} from 'angular2/forms';
|
||||
import {ControlGroup, ControlDirective} from 'angular2/forms'
|
||||
import {dom} from 'ionic/util';
|
||||
import {IonicComponent} from 'ionic/config/component'
|
||||
@ -22,7 +23,7 @@ export class Segment {
|
||||
static get config() {
|
||||
return {
|
||||
selector: 'ion-segment',
|
||||
appInjector: [ControlDirective],
|
||||
appInjector: [ NgControl ],
|
||||
properties: [
|
||||
'value'
|
||||
],
|
||||
@ -34,18 +35,17 @@ export class Segment {
|
||||
}
|
||||
|
||||
constructor(
|
||||
ngControl: NgControl,
|
||||
elementRef: ElementRef,
|
||||
renderer: Renderer,
|
||||
cd:ControlDirective
|
||||
renderer: Renderer
|
||||
) {
|
||||
console.log('ELEMENT REF INJECT', elementRef);
|
||||
console.log('ELEMENT REF INJECT', elementRef, ngControl);
|
||||
this.domElement = elementRef.domElement
|
||||
//this.config = Segment.config.invoke(this)
|
||||
this.elementRef = elementRef;
|
||||
this.renderer = renderer;
|
||||
this.controlDirective = cd;
|
||||
|
||||
cd.valueAccessor = this; //ControlDirective should inject CheckboxControlDirective
|
||||
this.ngControl = ngControl;
|
||||
this.ngControl.valueAccessor = this;
|
||||
|
||||
this.buttons = [];
|
||||
}
|
||||
@ -117,14 +117,14 @@ export class Segment {
|
||||
'value'
|
||||
],
|
||||
host: {
|
||||
'(click)': 'buttonClicked($event)'
|
||||
'(click)': 'buttonClicked($event)',
|
||||
'class.active': 'isActive'
|
||||
}
|
||||
})
|
||||
export class SegmentButton {
|
||||
constructor(
|
||||
@Ancestor() segment: Segment,
|
||||
elementRef: ElementRef,
|
||||
renderer: Renderer
|
||||
) {
|
||||
this.domElement = elementRef.domElement
|
||||
this.segment = segment;
|
||||
@ -133,12 +133,7 @@ export class SegmentButton {
|
||||
}
|
||||
|
||||
setActive(isActive) {
|
||||
// TODO: No domElement
|
||||
if(isActive) {
|
||||
this.domElement.classList.add('active');
|
||||
} else {
|
||||
this.domElement.classList.remove('active');
|
||||
}
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
buttonClicked(event) {
|
||||
|
@ -2,13 +2,13 @@
|
||||
<form (^submit)="doSubmit($event)" [control-group]="form">
|
||||
|
||||
<ion-segment control="mapStyle">
|
||||
<ion-segment-button value="standard" ion-button>
|
||||
<ion-segment-button value="standard" button>
|
||||
Standard
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="hybrid" ion-button>
|
||||
<ion-segment-button value="hybrid" button>
|
||||
Hybrid
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="sat" ion-button>
|
||||
<ion-segment-button value="sat" button>
|
||||
Satellite
|
||||
</ion-segment-button>
|
||||
<!--
|
||||
|
@ -31,7 +31,8 @@ export class IonicView extends View {
|
||||
Icon,
|
||||
|
||||
// Form elements
|
||||
//Checkbox, Switch, Label, Input, Segment, SegmentButton,
|
||||
Segment, SegmentButton,
|
||||
//Checkbox, Switch, Label, Input
|
||||
//RadioGroup, RadioButton, SearchBar,
|
||||
|
||||
// Nav
|
||||
@ -42,4 +43,3 @@ export class IonicView extends View {
|
||||
super(config);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user