-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bootstrap): support floating labels
fix #3265 BREAKING CHANGE: To customize style of bootstrap types rely on `formly-wrapper-form-field` instead of the following selectors: - `formly-wrapper-addons` - `formly-field-checkbox` - `formly-field-input` - `formly-field-multicheckbox` - `formly-field-radio` - `formly-field-select` - `formly-field-textarea`
- Loading branch information
Showing
13 changed files
with
208 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
<div class="input-group" [class.has-validation]="showError"> | ||
<div | ||
class="input-group-text" | ||
*ngIf="props.addonLeft" | ||
[class.input-group-btn]="props.addonLeft.onClick" | ||
(click)="addonLeftClick($event)" | ||
> | ||
<i [ngClass]="props.addonLeft.class" *ngIf="props.addonLeft.class"></i> | ||
<span *ngIf="props.addonLeft.text">{{ props.addonLeft.text }}</span> | ||
</div> | ||
<div class="input-addons"> | ||
<ng-template #fieldTypeTemplate> | ||
<div class="input-group" [class.has-validation]="showError"> | ||
<div | ||
class="input-group-text" | ||
*ngIf="props.addonLeft" | ||
[class.input-group-btn]="props.addonLeft.onClick" | ||
(click)="addonLeftClick($event)" | ||
> | ||
<i [ngClass]="props.addonLeft.class" *ngIf="props.addonLeft.class"></i> | ||
<span *ngIf="props.addonLeft.text">{{ props.addonLeft.text }}</span> | ||
</div> | ||
<ng-container #fieldComponent></ng-container> | ||
<div | ||
class="input-group-text" | ||
*ngIf="props.addonRight" | ||
[class.input-group-btn]="props.addonRight.onClick" | ||
(click)="addonRightClick($event)" | ||
> | ||
<i [ngClass]="props.addonRight.class" *ngIf="props.addonRight.class"></i> | ||
<span *ngIf="props.addonRight.text">{{ props.addonRight.text }}</span> | ||
</div> | ||
</div> | ||
<div | ||
class="input-group-text" | ||
*ngIf="props.addonRight" | ||
[class.input-group-btn]="props.addonRight.onClick" | ||
(click)="addonRightClick($event)" | ||
> | ||
<i [ngClass]="props.addonRight.class" *ngIf="props.addonRight.class"></i> | ||
<span *ngIf="props.addonRight.text">{{ props.addonRight.text }}</span> | ||
</div> | ||
</div> | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,3 @@ | ||
:host ::ng-deep .input-group > { | ||
.input-group-btn { | ||
cursor: pointer; | ||
} | ||
|
||
:not(:first-child) .form-control { | ||
border-top-left-radius: 0; | ||
border-bottom-left-radius: 0; | ||
} | ||
:not(:last-child) .form-control { | ||
border-top-right-radius: 0; | ||
border-bottom-right-radius: 0; | ||
} | ||
.input-addons { | ||
position: relative; | ||
flex: 1 1 auto; | ||
width: 1%; | ||
margin-bottom: 0; | ||
} | ||
formly-wrapper-form-field .input-group-btn { | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Directive, Optional, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core'; | ||
import { FieldType as CoreFieldType, FormlyFieldConfig } from '@ngx-formly/core'; | ||
|
||
@Directive() | ||
export abstract class FieldType<F extends FormlyFieldConfig = FormlyFieldConfig> extends CoreFieldType<F> { | ||
@ViewChild('fieldTypeTemplate', { static: true }) set content(templateRef: TemplateRef<any>) { | ||
if (templateRef && this.hostContainerRef) { | ||
this.hostContainerRef.createEmbeddedView(templateRef); | ||
} | ||
} | ||
|
||
constructor(@Optional() private hostContainerRef?: ViewContainerRef) { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { FormlyBootstrapFormFieldModule } from './form-field.module'; | ||
export { FormlyFieldProps } from './form-field.wrapper'; | ||
export { FieldType } from './field.type'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.