-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add possibility to set ng-templates between controls
- Loading branch information
1 parent
7ff4556
commit d842abb
Showing
76 changed files
with
1,010 additions
and
436 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,31 @@ | ||
// Karma configuration file, see link for more information | ||
// https://karma-runner.github.io/1.0/config/configuration-file.html | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
basePath: '', | ||
frameworks: ['jasmine', '@angular-devkit/build-angular'], | ||
plugins: [ | ||
require('karma-jasmine'), | ||
require('karma-chrome-launcher'), | ||
require('karma-jasmine-html-reporter'), | ||
require('karma-coverage-istanbul-reporter'), | ||
require('@angular-devkit/build-angular/plugins/karma') | ||
], | ||
client: { | ||
clearContext: false // leave Jasmine Spec Runner output visible in browser | ||
}, | ||
coverageIstanbulReporter: { | ||
dir: require('path').join(__dirname, '../../coverage'), | ||
reports: ['html', 'lcovonly'], | ||
fixWebpackSourcePaths: true | ||
}, | ||
reporters: ['progress', 'kjhtml'], | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
browsers: ['Chrome'], | ||
singleRun: false | ||
}); | ||
}; |
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,7 @@ | ||
{ | ||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json", | ||
"dest": "../../dist/bootstrap-controls", | ||
"lib": { | ||
"entryFile": "src/public_api.ts" | ||
} | ||
} |
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,9 @@ | ||
{ | ||
"name": "bootstrap-controls", | ||
"version": "0.0.1", | ||
"peerDependencies": { | ||
"@angular/common": "^7.0.0", | ||
"@angular/core": "^7.0.0", | ||
"bootstrap": "^4.2.1" | ||
} | ||
} |
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 @@ | ||
export * from './public_api'; |
14 changes: 14 additions & 0 deletions
14
projects/bootstrap-controls/src/lib/bootstrap-controls.module.ts
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,14 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; | ||
import { BootstrapDropdownComponent, BootstrapTextfieldComponent } from './components'; | ||
|
||
const controlsComponents = [BootstrapDropdownComponent, BootstrapTextfieldComponent]; | ||
|
||
@NgModule({ | ||
imports: [CommonModule, FormsModule, ReactiveFormsModule], | ||
declarations: [...controlsComponents], | ||
exports: [...controlsComponents], | ||
entryComponents: [...controlsComponents] | ||
}) | ||
export class BootstrapControlsModule {} |
9 changes: 9 additions & 0 deletions
9
projects/bootstrap-controls/src/lib/components/common-styles.scss
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,9 @@ | ||
.label { | ||
font-size: 1.25rem; | ||
} | ||
|
||
.asterik::before { | ||
color: red; | ||
content: '*'; | ||
margin-right: 8px; | ||
} |
19 changes: 19 additions & 0 deletions
19
projects/bootstrap-controls/src/lib/components/dropdown/bootstrap-dropdown.component.html
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,19 @@ | ||
<header class="label" *ngIf="label && label !== ''"> | ||
<span *ngIf="required" class="asterik"></span> <span>{{ label }}</span> | ||
</header> | ||
<div (blur)="markAsDirty()" tabindex="0" class="dropdown"> | ||
<div (click)="toggleDropdown()" class="form-control title"> | ||
{{ !value ? placeholder : displayOptionValue(value) }} | ||
</div> | ||
<ul [class.is-opened]="isDropdownOpened" class="dropdown-menu is-closed"> | ||
<li | ||
[class.active]="value === option" | ||
(click)="selectOption(option)" | ||
*ngFor="let option of options" | ||
class="dropdown-item" | ||
href="#" | ||
> | ||
{{ displayOptionValue(option) }} | ||
</li> | ||
</ul> | ||
</div> |
33 changes: 33 additions & 0 deletions
33
projects/bootstrap-controls/src/lib/components/dropdown/bootstrap-dropdown.component.scss
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,33 @@ | ||
:host { | ||
display: block; | ||
margin-bottom: 10px; | ||
} | ||
|
||
.is-closed { | ||
display: none; | ||
} | ||
|
||
.is-opened { | ||
display: block; | ||
} | ||
|
||
.dropdown { | ||
.title { | ||
cursor: pointer; | ||
} | ||
} | ||
|
||
.dropdown-menu { | ||
width: 100%; | ||
> * { | ||
cursor: pointer; | ||
} | ||
} | ||
|
||
.dropdown-item:hover { | ||
background-color: rgb(192, 145, 145); | ||
} | ||
|
||
.card { | ||
margin-bottom: 20px; | ||
} |
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,2 @@ | ||
export * from './dropdown/bootstrap-dropdown.component'; | ||
export * from './textfield/bootstrap-textfield.component'; |
28 changes: 28 additions & 0 deletions
28
projects/bootstrap-controls/src/lib/components/textfield/bootstrap-textfield.component.html
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,28 @@ | ||
<header class="label" *ngIf="label && label !== ''"> | ||
<span *ngIf="required" class="asterik"></span> <span>{{ label }}</span> | ||
</header> | ||
<div class="ms-TextField"> | ||
<input | ||
*ngIf="!multiline" | ||
[disabled]="isDisabled" | ||
type="text" | ||
class="form-control" | ||
[(ngModel)]="value" | ||
[placeholder]="placeholder" | ||
(blur)="markAsDirty()" | ||
[disabled]="isDisabled" | ||
/> | ||
<textarea | ||
*ngIf="multiline" | ||
[disabled]="isDisabled" | ||
type="text" | ||
class="form-control" | ||
[(ngModel)]="value" | ||
[placeholder]="placeholder" | ||
(blur)="markAsDirty()" | ||
[disabled]="isDisabled" | ||
></textarea> | ||
</div> | ||
<div class="errorText"> | ||
<span *ngIf="errorTexts && dirty">{{ buildErrorText() }}</span> | ||
</div> |
4 changes: 4 additions & 0 deletions
4
projects/bootstrap-controls/src/lib/components/textfield/bootstrap-textfield.component.scss
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,4 @@ | ||
:host { | ||
display: block; | ||
margin-bottom: 10px; | ||
} |
22 changes: 22 additions & 0 deletions
22
projects/bootstrap-controls/src/lib/components/textfield/bootstrap-textfield.component.ts
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,22 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { MakeProvider, AbstractValueAccessor } from 'dynamic-form'; | ||
|
||
@Component({ | ||
selector: 'lib-bootstrap-textfield', | ||
templateUrl: './bootstrap-textfield.component.html', | ||
styleUrls: ['./bootstrap-textfield.component.scss', '../common-styles.scss'], | ||
providers: [MakeProvider(BootstrapTextfieldComponent)] | ||
}) | ||
export class BootstrapTextfieldComponent extends AbstractValueAccessor { | ||
@Input() | ||
placeholder = ''; | ||
@Input() | ||
type = 'text'; | ||
@Input() | ||
multiline = false; | ||
|
||
setDisabledState(isDisabled: boolean) { | ||
console.log(isDisabled); | ||
this.isDisabled = isDisabled; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...rols/interfaces/base-control.interface.ts → ...faces/base-bootstrap-control.interface.ts
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
6 changes: 6 additions & 0 deletions
6
projects/bootstrap-controls/src/lib/interfaces/bootstrap-dropdown-control.interface.ts
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,6 @@ | ||
import { IBaseBootstrapControl } from './base-bootstrap-control.interface'; | ||
|
||
export interface IBootstrapDropdownControl<TValue> extends IBaseBootstrapControl<TValue> { | ||
options?: TValue[]; | ||
displayedProperty?: string; | ||
} |
6 changes: 6 additions & 0 deletions
6
projects/bootstrap-controls/src/lib/interfaces/bootstrap-textfield-control.interface.ts
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,6 @@ | ||
import { IBaseBootstrapControl } from './base-bootstrap-control.interface'; | ||
|
||
export interface IBootstrapTextfieldControl extends IBaseBootstrapControl<string> { | ||
type?: 'text' | 'number'; | ||
multiline?: boolean; | ||
} |
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,3 @@ | ||
export * from './base-bootstrap-control.interface'; | ||
export * from './bootstrap-dropdown-control.interface'; | ||
export * from './bootstrap-textfield-control.interface'; |
Oops, something went wrong.