@falcon-ng/tailwind 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/ng-package.json +7 -0
- package/package.json +11 -0
- package/src/lib/base-control.ts +142 -0
- package/src/lib/base-form-component.ts +363 -0
- package/src/lib/component/auto-complete/auto-complete.component.html +39 -0
- package/src/lib/component/auto-complete/auto-complete.component.scss +0 -0
- package/src/lib/component/auto-complete/auto-complete.component.spec.ts +23 -0
- package/src/lib/component/auto-complete/auto-complete.component.ts +31 -0
- package/src/lib/component/bottom-sheet/bottom-sheet.component.html +9 -0
- package/src/lib/component/bottom-sheet/bottom-sheet.component.scss +0 -0
- package/src/lib/component/bottom-sheet/bottom-sheet.component.spec.ts +23 -0
- package/src/lib/component/bottom-sheet/bottom-sheet.component.ts +19 -0
- package/src/lib/component/button/button.component.css +0 -0
- package/src/lib/component/button/button.component.html +54 -0
- package/src/lib/component/button/button.component.spec.ts +23 -0
- package/src/lib/component/button/button.component.ts +17 -0
- package/src/lib/component/button-toggle/button-toggle.component.html +21 -0
- package/src/lib/component/button-toggle/button-toggle.component.scss +0 -0
- package/src/lib/component/button-toggle/button-toggle.component.spec.ts +23 -0
- package/src/lib/component/button-toggle/button-toggle.component.ts +26 -0
- package/src/lib/component/checkbox/checkbox.component.html +6 -0
- package/src/lib/component/checkbox/checkbox.component.scss +0 -0
- package/src/lib/component/checkbox/checkbox.component.spec.ts +23 -0
- package/src/lib/component/checkbox/checkbox.component.ts +17 -0
- package/src/lib/component/chips/chip.component.html +75 -0
- package/src/lib/component/chips/chip.component.scss +3 -0
- package/src/lib/component/chips/chip.component.spec.ts +23 -0
- package/src/lib/component/chips/chip.component.ts +125 -0
- package/src/lib/component/date-picker/date-picker.component.html +18 -0
- package/src/lib/component/date-picker/date-picker.component.scss +0 -0
- package/src/lib/component/date-picker/date-picker.component.spec.ts +23 -0
- package/src/lib/component/date-picker/date-picker.component.ts +13 -0
- package/src/lib/component/dialog/dialog.component.html +12 -0
- package/src/lib/component/dialog/dialog.component.scss +3 -0
- package/src/lib/component/dialog/dialog.component.spec.ts +23 -0
- package/src/lib/component/dialog/dialog.component.ts +12 -0
- package/src/lib/component/pagination/pagination.component.html +10 -0
- package/src/lib/component/pagination/pagination.component.scss +0 -0
- package/src/lib/component/pagination/pagination.component.spec.ts +23 -0
- package/src/lib/component/pagination/pagination.component.ts +86 -0
- package/src/lib/component/progress-bar/progress-bar.component.html +1 -0
- package/src/lib/component/progress-bar/progress-bar.component.scss +0 -0
- package/src/lib/component/progress-bar/progress-bar.component.spec.ts +23 -0
- package/src/lib/component/progress-bar/progress-bar.component.ts +15 -0
- package/src/lib/component/progress-spinner/progress-spinner.component.html +7 -0
- package/src/lib/component/progress-spinner/progress-spinner.component.scss +0 -0
- package/src/lib/component/progress-spinner/progress-spinner.component.spec.ts +23 -0
- package/src/lib/component/progress-spinner/progress-spinner.component.ts +16 -0
- package/src/lib/component/radio/radio.component.html +13 -0
- package/src/lib/component/radio/radio.component.scss +14 -0
- package/src/lib/component/radio/radio.component.spec.ts +23 -0
- package/src/lib/component/radio/radio.component.ts +29 -0
- package/src/lib/component/rich-text-editor/rich-text-editor.component.html +10 -0
- package/src/lib/component/rich-text-editor/rich-text-editor.component.scss +0 -0
- package/src/lib/component/rich-text-editor/rich-text-editor.component.spec.ts +23 -0
- package/src/lib/component/rich-text-editor/rich-text-editor.component.ts +13 -0
- package/src/lib/component/select/select.component.html +25 -0
- package/src/lib/component/select/select.component.scss +0 -0
- package/src/lib/component/select/select.component.spec.ts +23 -0
- package/src/lib/component/select/select.component.ts +32 -0
- package/src/lib/component/slide-toggle/slide-toggle.component.html +7 -0
- package/src/lib/component/slide-toggle/slide-toggle.component.scss +0 -0
- package/src/lib/component/slide-toggle/slide-toggle.component.spec.ts +23 -0
- package/src/lib/component/slide-toggle/slide-toggle.component.ts +13 -0
- package/src/lib/component/slider/slider.component.html +11 -0
- package/src/lib/component/slider/slider.component.scss +0 -0
- package/src/lib/component/slider/slider.component.spec.ts +23 -0
- package/src/lib/component/slider/slider.component.ts +13 -0
- package/src/lib/component/snack-bar/snack-bar.component.html +1 -0
- package/src/lib/component/snack-bar/snack-bar.component.scss +0 -0
- package/src/lib/component/snack-bar/snack-bar.component.spec.ts +23 -0
- package/src/lib/component/snack-bar/snack-bar.component.ts +10 -0
- package/src/lib/component/table/table.component.html +82 -0
- package/src/lib/component/table/table.component.scss +17 -0
- package/src/lib/component/table/table.component.spec.ts +23 -0
- package/src/lib/component/table/table.component.ts +54 -0
- package/src/lib/component/textarea/textarea.component.html +22 -0
- package/src/lib/component/textarea/textarea.component.scss +3 -0
- package/src/lib/component/textarea/textarea.component.spec.ts +23 -0
- package/src/lib/component/textarea/textarea.component.ts +13 -0
- package/src/lib/component/textbox/textbox.component.html +27 -0
- package/src/lib/component/textbox/textbox.component.scss +3 -0
- package/src/lib/component/textbox/textbox.component.spec.ts +23 -0
- package/src/lib/component/textbox/textbox.component.ts +13 -0
- package/src/lib/control-builder/control-builder.component.html +5 -0
- package/src/lib/control-builder/control-builder.component.scss +0 -0
- package/src/lib/control-builder/control-builder.component.ts +14 -0
- package/src/lib/control-type/AutoComplete.ts +6 -0
- package/src/lib/control-type/Button.ts +6 -0
- package/src/lib/control-type/ButtonToggle.ts +6 -0
- package/src/lib/control-type/CheckBox.ts +6 -0
- package/src/lib/control-type/Chip.ts +6 -0
- package/src/lib/control-type/DatePicker.ts +6 -0
- package/src/lib/control-type/Divider.ts +6 -0
- package/src/lib/control-type/Editor.ts +6 -0
- package/src/lib/control-type/Radio.ts +6 -0
- package/src/lib/control-type/RichTextEditor.ts +6 -0
- package/src/lib/control-type/SlideToggle.ts +6 -0
- package/src/lib/control-type/Slider.ts +6 -0
- package/src/lib/control-type/select.ts +6 -0
- package/src/lib/control-type/textarea.ts +6 -0
- package/src/lib/control-type/textbox.ts +6 -0
- package/src/lib/falcon-core.module.ts +141 -0
- package/src/lib/model/constant.ts +32 -0
- package/src/lib/model/enum.ts +151 -0
- package/src/lib/model/environments.ts +28 -0
- package/src/lib/model/interface.ts +310 -0
- package/src/lib/model/ivalidator.ts +18 -0
- package/src/lib/module/angularmaterial.module.ts +98 -0
- package/src/lib/reactive-field.directive.ts +24 -0
- package/src/lib/service/appsetting.service.ts +57 -0
- package/src/lib/service/http/generic-http-client.ts +205 -0
- package/src/lib/service/http/httpInterceptor.ts +36 -0
- package/src/lib/service/http/igeneric-http-client.ts +110 -0
- package/src/lib/service/logger.service.ts +75 -0
- package/src/lib/service/open-id/TokenHelperService.ts +76 -0
- package/src/lib/service/open-id/auth-guard.service.ts +25 -0
- package/src/lib/service/open-id/auth.service.ts +179 -0
- package/src/public-api.ts +35 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<mat-nav-list>
|
|
2
|
+
<ng-container *ngFor="let item of data">
|
|
3
|
+
<a [href]="item.link" mat-list-item (click)="click($event,item)">
|
|
4
|
+
<span matListItemTitle>{{item.levelOneText}}</span>
|
|
5
|
+
<span matLine>{{item.levelTwoText}}</span>
|
|
6
|
+
</a>
|
|
7
|
+
</ng-container>
|
|
8
|
+
|
|
9
|
+
</mat-nav-list>
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { BottomSheetComponent } from './bottom-sheet.component';
|
|
4
|
+
|
|
5
|
+
describe('BottomSheetComponent', () => {
|
|
6
|
+
let component: BottomSheetComponent;
|
|
7
|
+
let fixture: ComponentFixture<BottomSheetComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ BottomSheetComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(BottomSheetComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {Component, Inject} from '@angular/core';
|
|
2
|
+
import {MAT_BOTTOM_SHEET_DATA, MatBottomSheetRef} from "@angular/material/bottom-sheet";
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'lib-bottom-sheet',
|
|
6
|
+
templateUrl: './bottom-sheet.component.html',
|
|
7
|
+
styleUrls: ['./bottom-sheet.component.scss']
|
|
8
|
+
})
|
|
9
|
+
export class BottomSheetComponent {
|
|
10
|
+
constructor(private _bottomSheetRef: MatBottomSheetRef<BottomSheetComponent>, @Inject(MAT_BOTTOM_SHEET_DATA) public data: any) { }
|
|
11
|
+
|
|
12
|
+
ngOnInit(): void {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
click(event: MouseEvent, item : any): void {
|
|
16
|
+
this._bottomSheetRef.dismiss(item);
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<div [ngStyle]="control.style" [ngClass]="control.class">
|
|
2
|
+
<ng-container [ngSwitch]="control.appearance">
|
|
3
|
+
<button [disabled]="control.disabled" (click)="childBtnClick()"
|
|
4
|
+
[color]="control.color" [ngClass]="control.class"
|
|
5
|
+
[ngStyle]="control.style" mat-button *ngSwitchCase="0">
|
|
6
|
+
<mat-icon *ngIf="control?.suffix?.isIcon" style="margin-bottom: 1px;">
|
|
7
|
+
{{control.suffix.text}}</mat-icon> {{control.label}}
|
|
8
|
+
</button>
|
|
9
|
+
<button [disabled]="control.disabled" (click)="childBtnClick()"
|
|
10
|
+
[type]="control.type" [ngClass]="control.class"
|
|
11
|
+
[color]="control.color" [ngStyle]="control.style"
|
|
12
|
+
mat-raised-button *ngSwitchCase="1">
|
|
13
|
+
<mat-icon *ngIf="control.suffix?.isIcon" style="margin-bottom: 1px;">
|
|
14
|
+
{{control.suffix.text}}</mat-icon> {{control.label}}
|
|
15
|
+
</button>
|
|
16
|
+
<button [disabled]="control.disabled" (click)="childBtnClick()"
|
|
17
|
+
[type]="control.type" [ngClass]="control.class"
|
|
18
|
+
[color]="control.color" [ngStyle]="control.style"
|
|
19
|
+
mat-stroked-button *ngSwitchCase="2">
|
|
20
|
+
<mat-icon *ngIf="control.suffix?.isIcon" style="margin-bottom: 1px;">
|
|
21
|
+
{{control.suffix.text}}</mat-icon> {{control.label}}
|
|
22
|
+
</button>
|
|
23
|
+
<button [disabled]="control.disabled" (click)="childBtnClick()"
|
|
24
|
+
[type]="control.type" [ngClass]="control.class"
|
|
25
|
+
[color]="control.color" [ngStyle]="control.style"
|
|
26
|
+
mat-flat-button *ngSwitchCase="3">
|
|
27
|
+
<mat-icon *ngIf="control.suffix.isIcon" style="margin-bottom: 1px;">
|
|
28
|
+
{{control.suffix.text}}</mat-icon> {{control.label}}
|
|
29
|
+
</button>
|
|
30
|
+
<button [disabled]="control.disabled" (click)="childBtnClick()"
|
|
31
|
+
[type]="control.type" [ngClass]="control.class"
|
|
32
|
+
[color]="control.color" [ngStyle]="control.style"
|
|
33
|
+
mat-icon-button [attr.aria-label]="control.label" *ngSwitchCase="4">
|
|
34
|
+
<mat-icon>{{control.label}}</mat-icon>
|
|
35
|
+
</button>
|
|
36
|
+
<button [disabled]="control.disabled" (click)="childBtnClick()"
|
|
37
|
+
[type]="control.type" [ngClass]="control.class"
|
|
38
|
+
[color]="control.color" [ngStyle]="control.style" mat-fab
|
|
39
|
+
[attr.aria-label]="control.label" *ngSwitchCase="5">
|
|
40
|
+
<mat-icon>{{control.label}}</mat-icon>
|
|
41
|
+
</button>
|
|
42
|
+
<button [disabled]="control.disabled" (click)="childBtnClick()"
|
|
43
|
+
[type]="control.type" [ngClass]="control.class"
|
|
44
|
+
[color]="control.color" [ngStyle]="control.style" mat-mini-fab
|
|
45
|
+
[attr.aria-label]="control.label" *ngSwitchCase="6">
|
|
46
|
+
<mat-icon>{{control.label}}</mat-icon>
|
|
47
|
+
</button>
|
|
48
|
+
<a mat-stroked-button *ngSwitchCase="7" [ngClass]="control.class"
|
|
49
|
+
[ngStyle]="control.style" routerLink="[]">{{control.label}}</a>
|
|
50
|
+
<a mat-stroked-button *ngSwitchCase="8" [ngClass]="control.class"
|
|
51
|
+
[ngStyle]="control.style"
|
|
52
|
+
href="{{control.value}}">{{control.label}}</a>
|
|
53
|
+
</ng-container>
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ButtonComponent } from './button.component';
|
|
4
|
+
|
|
5
|
+
describe('ButtonComponent', () => {
|
|
6
|
+
let component: ButtonComponent;
|
|
7
|
+
let fixture: ComponentFixture<ButtonComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ ButtonComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(ButtonComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
|
2
|
+
import {FormGroup} from "@angular/forms";
|
|
3
|
+
import {BaseControl} from "../../base-control";
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'falcon-button',
|
|
7
|
+
templateUrl: './button.component.html',
|
|
8
|
+
styleUrls: ['./button.component.css']
|
|
9
|
+
})
|
|
10
|
+
export class ButtonComponent {
|
|
11
|
+
@Input() control!: BaseControl<string>;
|
|
12
|
+
@Input() formGroup!: FormGroup;
|
|
13
|
+
@Output() btnClick = new EventEmitter<string>();
|
|
14
|
+
childBtnClick() {
|
|
15
|
+
this.btnClick.emit("Button Click Event");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<div [ngStyle]="control.style" [ngClass]="control.class"
|
|
2
|
+
[formGroup]="formGroup">
|
|
3
|
+
<mat-label [ngStyle]="control.style" [ngClass]="control.class"
|
|
4
|
+
*ngIf="control.label != undefined">
|
|
5
|
+
{{control.label | titlecase}}
|
|
6
|
+
</mat-label>
|
|
7
|
+
<mat-button-toggle-group
|
|
8
|
+
[formControlName]="control.formControlName != undefined ? control.formControlName : 'default'"
|
|
9
|
+
[appearance]="control.appearance" [ngStyle]="control.style"
|
|
10
|
+
[ngClass]="control.class" [attr.aria-label]="control.label"
|
|
11
|
+
class="botton-toggle" (change)="toggleChange($event)">
|
|
12
|
+
<mat-button-toggle *ngFor="let item of control.options" [value]="item?.value"
|
|
13
|
+
[ngStyle]="control.style"
|
|
14
|
+
[ngClass]="control.class">
|
|
15
|
+
<mat-icon [ngClass]="item?.class" aria-hidden="false" aria-label="item icon" *ngIf="item?.icon != undefined">
|
|
16
|
+
{{item?.icon}}
|
|
17
|
+
</mat-icon>
|
|
18
|
+
{{item.viewValue | titlecase}}
|
|
19
|
+
</mat-button-toggle>
|
|
20
|
+
</mat-button-toggle-group>
|
|
21
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ButtonToggleComponent } from './button-toggle.component';
|
|
4
|
+
|
|
5
|
+
describe('ButtonToggleComponent', () => {
|
|
6
|
+
let component: ButtonToggleComponent;
|
|
7
|
+
let fixture: ComponentFixture<ButtonToggleComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ ButtonToggleComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(ButtonToggleComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
|
|
2
|
+
import {FormControl, FormGroup} from "@angular/forms";
|
|
3
|
+
import {BaseControl} from "../../base-control";
|
|
4
|
+
import {MatButtonToggleChange} from "@angular/material/button-toggle";
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'falcon-button-toggle',
|
|
8
|
+
templateUrl: './button-toggle.component.html',
|
|
9
|
+
styleUrls: ['./button-toggle.component.scss'],
|
|
10
|
+
})
|
|
11
|
+
export class ButtonToggleComponent implements OnInit {
|
|
12
|
+
control!: BaseControl<string>;
|
|
13
|
+
formGroup!: FormGroup;
|
|
14
|
+
@Output() toggleGroupChange: EventEmitter<MatButtonToggleChange> = new EventEmitter<MatButtonToggleChange>();
|
|
15
|
+
ngOnInit(): void {
|
|
16
|
+
if (this.formGroup === undefined) {
|
|
17
|
+
this.formGroup = new FormGroup({
|
|
18
|
+
default: new FormControl()
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
toggleChange($event: any) {
|
|
24
|
+
this.toggleGroupChange.emit($event.value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<div [formGroup]="formGroup">
|
|
2
|
+
<mat-checkbox [ngStyle]="control.style" [ngClass]="control.class"
|
|
3
|
+
[color]="control.color != null ? control.color : 'accent'" [labelPosition]="control.labelPosition"
|
|
4
|
+
[formControlName]="control.formControlName" (change)="change($event)">
|
|
5
|
+
{{control.label}}</mat-checkbox>
|
|
6
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { CheckboxComponent } from './checkbox.component';
|
|
4
|
+
|
|
5
|
+
describe('CheckboxComponent', () => {
|
|
6
|
+
let component: CheckboxComponent;
|
|
7
|
+
let fixture: ComponentFixture<CheckboxComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ CheckboxComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(CheckboxComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { FormGroup } from '@angular/forms';
|
|
3
|
+
import { BaseControl } from '../../base-control';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'falcon-checkbox',
|
|
7
|
+
templateUrl: './checkbox.component.html',
|
|
8
|
+
styleUrls: ['./checkbox.component.scss'],
|
|
9
|
+
})
|
|
10
|
+
export class CheckboxComponent {
|
|
11
|
+
control!: BaseControl<string>;
|
|
12
|
+
formGroup!: FormGroup;
|
|
13
|
+
change($event: any) {
|
|
14
|
+
if (this.control.event !== undefined)
|
|
15
|
+
this.control?.event?.change?.emit($event);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<ng-container [ngSwitch]="control.type">
|
|
2
|
+
<mat-form-field class="chip-list" *ngSwitchCase="'search'" [appearance]="control.appearance" [formGroup]="formGroup"
|
|
3
|
+
[ngStyle]="control.style" [ngClass]="control.class">
|
|
4
|
+
<mat-label>{{control.label}}</mat-label>
|
|
5
|
+
<mat-chip-grid #chipGrid aria-label="item selection">
|
|
6
|
+
<mat-chip-row *ngFor="let option of control.chipSelectedOptions" [removable]="removable"
|
|
7
|
+
(removed)="remove(option)">
|
|
8
|
+
{{option.value}}
|
|
9
|
+
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
|
|
10
|
+
</mat-chip-row>
|
|
11
|
+
|
|
12
|
+
<input matInput #chipAutoCompleteInput [formControl]="autoCompleteControl"
|
|
13
|
+
[formArrayName]="control.formControlName" [placeholder]="control.placeHolder" [ngStyle]="control.style"
|
|
14
|
+
[ngClass]="control.class" [matAutocomplete]="auto" [matChipInputFor]="chipGrid"
|
|
15
|
+
[matChipInputSeparatorKeyCodes]="separatorKeysCodes" (matChipInputTokenEnd)="add($event)"
|
|
16
|
+
[required]="formGroup.get(control.formControlName)?.errors !== null && formGroup.get(control.formControlName)?.errors?.['required']"
|
|
17
|
+
(keyup.enter)="keyboardEnterEvent($event)">
|
|
18
|
+
|
|
19
|
+
</mat-chip-grid>
|
|
20
|
+
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="optionSelected($event)">
|
|
21
|
+
<mat-option *ngFor="let item of filteredOptions | async" [value]="item.key">
|
|
22
|
+
{{item.value}}
|
|
23
|
+
</mat-option>
|
|
24
|
+
</mat-autocomplete>
|
|
25
|
+
<mat-hint>
|
|
26
|
+
<ng-container *ngIf="control.hint.link?.isLink; else elseBlock">
|
|
27
|
+
<ng-container *ngIf="control.hint.link?.queryParams !== undefined; else withoutQueryBlock">
|
|
28
|
+
<a [routerLink]="[control.hint.link?.routerLink]" [queryParams]="{ query: control.hint.link?.queryParams }"
|
|
29
|
+
routerLinkActive="router-link-active">{{control.hint.text}}</a>
|
|
30
|
+
</ng-container>
|
|
31
|
+
</ng-container>
|
|
32
|
+
<ng-template #elseBlock>
|
|
33
|
+
<span>{{control.hint.text}}</span>
|
|
34
|
+
</ng-template>
|
|
35
|
+
<ng-template #withoutQueryBlock>
|
|
36
|
+
<a [routerLink]="[control.hint.link?.routerLink]"
|
|
37
|
+
routerLinkActive="router-link-active">{{control.hint.text}}</a>
|
|
38
|
+
</ng-template>
|
|
39
|
+
</mat-hint>
|
|
40
|
+
</mat-form-field>
|
|
41
|
+
|
|
42
|
+
<mat-form-field class="chip-list" *ngSwitchCase="'text'" [appearance]="control.appearance" [formGroup]="formGroup"
|
|
43
|
+
[ngStyle]="control.style" [ngClass]="control.class">
|
|
44
|
+
<mat-label>{{control.label}}</mat-label>
|
|
45
|
+
<mat-chip-grid #chipGrid aria-label="item selection">
|
|
46
|
+
<mat-chip-row *ngFor="let option of control.chipSelectedOptions" [value]="selectable" [removable]="removable"
|
|
47
|
+
(removed)="remove(option)">
|
|
48
|
+
{{option?.value}}
|
|
49
|
+
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
|
|
50
|
+
</mat-chip-row>
|
|
51
|
+
|
|
52
|
+
<input matInput #chipTextInput [formArrayName]="control.formControlName" multiple
|
|
53
|
+
[placeholder]="control.placeHolder"
|
|
54
|
+
[matChipInputFor]="chipGrid" [ngStyle]="control.style" [ngClass]="control.class"
|
|
55
|
+
[matChipInputSeparatorKeyCodes]="separatorKeysCodes" [matChipInputAddOnBlur]="addOnBlur"
|
|
56
|
+
(matChipInputTokenEnd)="add($event)"
|
|
57
|
+
[required]="formGroup.get(control.formControlName)?.errors !== null && formGroup.get(control.formControlName)?.errors?.['required']"
|
|
58
|
+
(keyup.enter)="keyboardEnterEvent($event)">
|
|
59
|
+
|
|
60
|
+
</mat-chip-grid>
|
|
61
|
+
</mat-form-field>
|
|
62
|
+
|
|
63
|
+
<mat-chip-listbox aria-label="Chips selection" *ngSwitchDefault>
|
|
64
|
+
<mat-chip color="{{control.color}}" selected>{{control.label}}</mat-chip>
|
|
65
|
+
</mat-chip-listbox>
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
<mat-chip-set class="chip-list" cdkDropList cdkDropListOrientation="horizontal" (cdkDropListDropped)="drop($event)"
|
|
69
|
+
*ngSwitchCase="'dragDrop'" class="example-chip">
|
|
70
|
+
<mat-chip class="example-box" cdkDrag *ngFor="let option of control?.options">
|
|
71
|
+
{{option?.value}}
|
|
72
|
+
</mat-chip>
|
|
73
|
+
</mat-chip-set>
|
|
74
|
+
|
|
75
|
+
</ng-container>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ChipComponent } from './chip.component';
|
|
4
|
+
|
|
5
|
+
describe('ChipsComponent', () => {
|
|
6
|
+
let component: ChipComponent;
|
|
7
|
+
let fixture: ComponentFixture<ChipComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ ChipComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(ChipComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
|
|
2
|
+
import { BaseControl } from '../../base-control';
|
|
3
|
+
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
|
4
|
+
import { COMMA, ENTER } from '@angular/cdk/keycodes';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
import { IOptions } from '../../model/interface';
|
|
7
|
+
import {
|
|
8
|
+
MatAutocomplete,
|
|
9
|
+
MatAutocompleteSelectedEvent,
|
|
10
|
+
} from '@angular/material/autocomplete';
|
|
11
|
+
import { map, startWith } from 'rxjs/operators';
|
|
12
|
+
import { MatChipInputEvent } from '@angular/material/chips';
|
|
13
|
+
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'falcon-chip',
|
|
17
|
+
templateUrl: './chip.component.html',
|
|
18
|
+
styleUrls: ['./chip.component.scss'],
|
|
19
|
+
})
|
|
20
|
+
export class ChipComponent implements OnInit {
|
|
21
|
+
@Input() control!: BaseControl<any>;
|
|
22
|
+
@Input() formGroup!: FormGroup;
|
|
23
|
+
readonly separatorKeysCodes: number[] = [ENTER, COMMA];
|
|
24
|
+
selectable = true;
|
|
25
|
+
removable = true;
|
|
26
|
+
addOnBlur = true;
|
|
27
|
+
filteredOptions: Observable<IOptions[]>;
|
|
28
|
+
autoCompleteControl = new FormControl('');
|
|
29
|
+
private items: FormArray;
|
|
30
|
+
|
|
31
|
+
@ViewChild('chipAutoCompleteInput')
|
|
32
|
+
chipAutoCompleteInput!: ElementRef<HTMLInputElement>;
|
|
33
|
+
@ViewChild('chipTextInput') chipTextInput!: ElementRef<HTMLInputElement>;
|
|
34
|
+
@ViewChild('auto') matAutocomplete!: MatAutocomplete;
|
|
35
|
+
|
|
36
|
+
constructor(private fb: FormBuilder) {
|
|
37
|
+
this.filteredOptions = this.autoCompleteControl.valueChanges.pipe(
|
|
38
|
+
startWith(null),
|
|
39
|
+
map((value: string | null) =>
|
|
40
|
+
value ? this._filter(value) : this.control?.options.slice()
|
|
41
|
+
)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
ngOnInit() {
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
if (this.control.chipSelectedOptions.length > 0) {
|
|
49
|
+
this.items = this.formGroup.controls[
|
|
50
|
+
this.control.formControlName
|
|
51
|
+
] as FormArray;
|
|
52
|
+
this.control.chipSelectedOptions.forEach((value: any) => {
|
|
53
|
+
this.items.controls.push(this.createItem(value.value));
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
add(event: MatChipInputEvent): void {
|
|
60
|
+
const input = event.input;
|
|
61
|
+
const value = event.value;
|
|
62
|
+
if ((value || '').trim()) {
|
|
63
|
+
this.control.chipSelectedOptions.push({
|
|
64
|
+
key: value.trim(),
|
|
65
|
+
value: value.trim(),
|
|
66
|
+
});
|
|
67
|
+
this.items = this.formGroup.get(
|
|
68
|
+
this.control.formControlName
|
|
69
|
+
) as FormArray;
|
|
70
|
+
this.items.push(this.createItem(value));
|
|
71
|
+
}
|
|
72
|
+
if (input) {
|
|
73
|
+
input.value = '';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
createItem(value: String): FormGroup {
|
|
78
|
+
return this.fb.group({
|
|
79
|
+
key: value,
|
|
80
|
+
value: value,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
remove(option: IOptions): void {
|
|
85
|
+
const index = this.control.chipSelectedOptions.indexOf(option);
|
|
86
|
+
if (index >= 0) {
|
|
87
|
+
this.control.chipSelectedOptions.splice(index, 1);
|
|
88
|
+
this.items.removeAt(index);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
optionSelected(event: MatAutocompleteSelectedEvent): void {
|
|
93
|
+
this.control.chipSelectedOptions.push({
|
|
94
|
+
key: event.option.value,
|
|
95
|
+
value: event.option.value,
|
|
96
|
+
});
|
|
97
|
+
this.items = this.formGroup.get(this.control.formControlName) as FormArray;
|
|
98
|
+
this.items.push(this.createItem(event.option.value));
|
|
99
|
+
this.chipAutoCompleteInput.nativeElement.value = '';
|
|
100
|
+
this.formGroup.get(this.control.formControlName)?.setValue(null);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private _filter(value: string): any {
|
|
104
|
+
if (value !== null) {
|
|
105
|
+
const filterValue = value.toLowerCase();
|
|
106
|
+
return this.control?.options?.filter((option: IOptions) =>
|
|
107
|
+
option.value.toLowerCase().includes(filterValue)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
drop(event: CdkDragDrop<IOptions[]>) {
|
|
113
|
+
moveItemInArray(
|
|
114
|
+
this.control.options,
|
|
115
|
+
event.previousIndex,
|
|
116
|
+
event.currentIndex
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
keyboardEnterEvent(event: any): void {
|
|
121
|
+
if (this.control.event !== undefined)
|
|
122
|
+
this.control.event.keyboardEnter?.emit(event);
|
|
123
|
+
this.chipTextInput.nativeElement.value = '';
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<mat-form-field [appearance]="control.appearance" [formGroup]="formGroup"
|
|
2
|
+
[floatLabel]="control.floatLabel" [ngStyle]="control.style"
|
|
3
|
+
[ngClass]="control.class">
|
|
4
|
+
<mat-label>{{control.label}}</mat-label>
|
|
5
|
+
<input matInput [matDatepicker]="picker" [formControlName]="control.formControlName"
|
|
6
|
+
[placeholder]="control.placeHolder" [type]="control.type"
|
|
7
|
+
[ngStyle]="control.style" [ngClass]="control.class"
|
|
8
|
+
[required]="formGroup.get(control.formControlName)?.errors !== null && formGroup.get(control.formControlName)?.errors?.['required']">
|
|
9
|
+
<mat-datepicker-toggle matSuffix [for]="picker">
|
|
10
|
+
<mat-icon matDatepickerToggleIcon *ngIf="control.suffix.isIcon">keyboard_arrow_down</mat-icon>
|
|
11
|
+
</mat-datepicker-toggle>
|
|
12
|
+
<mat-datepicker #picker></mat-datepicker>
|
|
13
|
+
<mat-hint>{{control.hint.text}}</mat-hint>
|
|
14
|
+
<ng-container *ngFor="let validation of control.validations;" ngProjectAs="mat-error">
|
|
15
|
+
<mat-error *ngIf="formGroup.get(control.formControlName)?.hasError(validation.name)">{{validation.message}}
|
|
16
|
+
</mat-error>
|
|
17
|
+
</ng-container>
|
|
18
|
+
</mat-form-field>
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { DatePickerComponent } from './date-picker.component';
|
|
4
|
+
|
|
5
|
+
describe('DatePickerComponent', () => {
|
|
6
|
+
let component: DatePickerComponent;
|
|
7
|
+
let fixture: ComponentFixture<DatePickerComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ DatePickerComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(DatePickerComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import {BaseControl} from "../../base-control";
|
|
3
|
+
import {FormGroup} from "@angular/forms";
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'falcon-date-picker',
|
|
7
|
+
templateUrl: './date-picker.component.html',
|
|
8
|
+
styleUrls: ['./date-picker.component.scss'],
|
|
9
|
+
})
|
|
10
|
+
export class DatePickerComponent {
|
|
11
|
+
control!: BaseControl<string>;
|
|
12
|
+
formGroup!: FormGroup;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<span mat-dialog-title>{{data.title}}</span>
|
|
2
|
+
<mat-divider></mat-divider>
|
|
3
|
+
<div mat-dialog-content>
|
|
4
|
+
<span class="mat-h3">{{data.bodyMessage}}</span>
|
|
5
|
+
</div>
|
|
6
|
+
<mat-divider></mat-divider>
|
|
7
|
+
<div mat-dialog-actions>
|
|
8
|
+
<button mat-raised-button [mat-dialog-close]="" cdkFocusInitial>{{data.cancelBtnText}}</button>
|
|
9
|
+
<button mat-raised-button [color]="'warn'" [mat-dialog-close]="data">
|
|
10
|
+
{{data.mainbtnText}}
|
|
11
|
+
</button>
|
|
12
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { DialogComponent } from './dialog.component';
|
|
4
|
+
|
|
5
|
+
describe('DialogComponent', () => {
|
|
6
|
+
let component: DialogComponent;
|
|
7
|
+
let fixture: ComponentFixture<DialogComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ DialogComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(DialogComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {Component, Inject} from '@angular/core';
|
|
2
|
+
import {IDialogData} from "../../model/interface";
|
|
3
|
+
import {MAT_DIALOG_DATA} from "@angular/material/dialog";
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'lib-dialog',
|
|
7
|
+
templateUrl: './dialog.component.html',
|
|
8
|
+
styleUrls: ['./dialog.component.scss']
|
|
9
|
+
})
|
|
10
|
+
export class DialogComponent {
|
|
11
|
+
constructor(@Inject(MAT_DIALOG_DATA) public data: IDialogData) {}
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div class="flex justify-between">
|
|
2
|
+
<span class="mat-h3">Page {{currentPage}} of {{totalPage}}</span>
|
|
3
|
+
<mat-button-toggle-group name="fontStyle" aria-label="Font Style">
|
|
4
|
+
<mat-button-toggle value="bold" *ngFor="let item of paginationSize; index as i;"
|
|
5
|
+
(change)="receiveBtnChange(item)" [checked]="firstLoad && i ==0">
|
|
6
|
+
<span class="mat-h3">{{item}}</span>
|
|
7
|
+
</mat-button-toggle>
|
|
8
|
+
</mat-button-toggle-group>
|
|
9
|
+
|
|
10
|
+
</div>
|
|
File without changes
|