mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
@ -65,7 +65,3 @@ ion-label[floating] {
|
|||||||
|
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-select ion-label[floating] {
|
|
||||||
transform: translate3d(0, 0, 0) scale(.8);
|
|
||||||
}
|
|
||||||
|
@ -387,6 +387,21 @@ export class Select extends Ion implements AfterContentInit, ControlValueAccesso
|
|||||||
return (this._multi ? this._texts : this._texts.join());
|
return (this._multi ? this._texts : this._texts.join());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
checkHasValue(inputValue: any) {
|
||||||
|
if (this._item) {
|
||||||
|
let hasValue: boolean;
|
||||||
|
if (Array.isArray(inputValue)) {
|
||||||
|
hasValue = inputValue.length > 0;
|
||||||
|
} else {
|
||||||
|
hasValue = !isBlank(inputValue);
|
||||||
|
}
|
||||||
|
this._item.setElementClass('input-has-value', hasValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@ -445,6 +460,7 @@ export class Select extends Ion implements AfterContentInit, ControlValueAccesso
|
|||||||
console.debug('select, writeValue', val);
|
console.debug('select, writeValue', val);
|
||||||
this._values = (Array.isArray(val) ? val : isBlank(val) ? [] : [val]);
|
this._values = (Array.isArray(val) ? val : isBlank(val) ? [] : [val]);
|
||||||
this._updOpts();
|
this._updOpts();
|
||||||
|
this.checkHasValue(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -464,6 +480,7 @@ export class Select extends Ion implements AfterContentInit, ControlValueAccesso
|
|||||||
fn(val);
|
fn(val);
|
||||||
this._values = (Array.isArray(val) ? val : isBlank(val) ? [] : [val]);
|
this._values = (Array.isArray(val) ? val : isBlank(val) ? [] : [val]);
|
||||||
this._updOpts();
|
this._updOpts();
|
||||||
|
this.checkHasValue(val);
|
||||||
this.onTouched();
|
this.onTouched();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -481,6 +498,7 @@ export class Select extends Ion implements AfterContentInit, ControlValueAccesso
|
|||||||
console.debug('select, onChange w/out formControlName', val);
|
console.debug('select, onChange w/out formControlName', val);
|
||||||
this._values = (Array.isArray(val) ? val : isBlank(val) ? [] : [val]);
|
this._values = (Array.isArray(val) ? val : isBlank(val) ? [] : [val]);
|
||||||
this._updOpts();
|
this._updOpts();
|
||||||
|
this.checkHasValue(val);
|
||||||
this.onTouched();
|
this.onTouched();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,4 +83,20 @@
|
|||||||
</ion-list>
|
</ion-list>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<ion-label floating>Floating label</ion-label>
|
||||||
|
<ion-select multiple="true">
|
||||||
|
<ion-option value="bacon">Bacon</ion-option>
|
||||||
|
<ion-option value="olives">Black Olives</ion-option>
|
||||||
|
<ion-option value="xcheese">Extra Cheese</ion-option>
|
||||||
|
<ion-option value="peppers">Green Peppers</ion-option>
|
||||||
|
<ion-option value="mushrooms">Mushrooms</ion-option>
|
||||||
|
<ion-option value="onions">Onions</ion-option>
|
||||||
|
<ion-option value="pepperoni">Pepperoni</ion-option>
|
||||||
|
<ion-option value="pineapple">Pineapple</ion-option>
|
||||||
|
<ion-option value="sausage">Sausage</ion-option>
|
||||||
|
<ion-option value="Spinach">Spinach</ion-option>
|
||||||
|
</ion-select>
|
||||||
|
</ion-item>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
@ -137,4 +137,12 @@
|
|||||||
</ion-item>
|
</ion-item>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<ion-label floating>Floating label</ion-label>
|
||||||
|
<ion-select>
|
||||||
|
<ion-option value="f">Female</ion-option>
|
||||||
|
<ion-option value="m">Male</ion-option>
|
||||||
|
</ion-select>
|
||||||
|
</ion-item>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
Reference in New Issue
Block a user