@sarasanalytics-com/design-system 0.0.9 → 0.0.10
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/esm2022/interfaces/avatar-interface.mjs +2 -0
- package/esm2022/interfaces/button-interface.mjs +2 -0
- package/esm2022/interfaces/chip-interface.mjs +2 -0
- package/esm2022/interfaces/grid-interface.mjs +2 -0
- package/esm2022/interfaces/select-interface.mjs +2 -0
- package/esm2022/interfaces/tab-interface.mjs +2 -0
- package/esm2022/lib/avatar/avatar.component.mjs +56 -0
- package/esm2022/lib/button/button.component.mjs +84 -0
- package/esm2022/lib/calendar-header/calendar-header.component.mjs +168 -0
- package/esm2022/lib/card/card-footer-actions/card-footer-actions.component.mjs +11 -0
- package/esm2022/lib/card/card-icon/card-icon.component.mjs +11 -0
- package/esm2022/lib/card/card-title-actions/card-title-actions.component.mjs +11 -0
- package/esm2022/lib/card/card.component.mjs +53 -0
- package/esm2022/lib/chips/chips.component.mjs +62 -0
- package/esm2022/lib/component-library.component.mjs +19 -0
- package/esm2022/lib/component-library.service.mjs +14 -0
- package/esm2022/lib/datepicker/datepicker.component.mjs +40 -0
- package/esm2022/lib/form-input/form-input.component.mjs +152 -0
- package/esm2022/lib/form-select/form-select.component.mjs +59 -0
- package/esm2022/lib/grid-cell/grid-cell.component.mjs +84 -0
- package/esm2022/lib/header/header.component.mjs +37 -0
- package/esm2022/lib/icon/icon.component.mjs +50 -0
- package/esm2022/lib/icon/icon.service.mjs +29 -0
- package/esm2022/lib/left-nav/left-nav.component.mjs +117 -0
- package/esm2022/lib/stepper/stepper.component.mjs +64 -0
- package/esm2022/lib/tabs/tabs.component.mjs +38 -0
- package/esm2022/lib/toast/toast.component.mjs +100 -0
- package/esm2022/lib/tool-tip/tool-tip.component.mjs +41 -0
- package/esm2022/public-api.mjs +30 -0
- package/esm2022/sarasanalytics-com-design-system.mjs +5 -0
- package/esm2022/utils/validators.mjs +70 -0
- package/fesm2022/sarasanalytics-com-design-system.mjs +1274 -0
- package/fesm2022/sarasanalytics-com-design-system.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/interfaces/avatar-interface.d.ts +6 -0
- package/interfaces/button-interface.d.ts +12 -0
- package/interfaces/chip-interface.d.ts +11 -0
- package/interfaces/grid-interface.d.ts +24 -0
- package/interfaces/select-interface.d.ts +20 -0
- package/interfaces/tab-interface.d.ts +6 -0
- package/lib/avatar/avatar.component.d.ts +18 -0
- package/lib/button/button.component.d.ts +26 -0
- package/lib/calendar-header/calendar-header.component.d.ts +31 -0
- package/lib/card/card-footer-actions/card-footer-actions.component.d.ts +5 -0
- package/lib/card/card-icon/card-icon.component.d.ts +5 -0
- package/lib/card/card-title-actions/card-title-actions.component.d.ts +5 -0
- package/lib/card/card.component.d.ts +17 -0
- package/lib/chips/chips.component.d.ts +22 -0
- package/lib/component-library.component.d.ts +5 -0
- package/lib/component-library.service.d.ts +6 -0
- package/lib/datepicker/datepicker.component.d.ts +9 -0
- package/lib/form-input/form-input.component.d.ts +62 -0
- package/lib/form-select/form-select.component.d.ts +17 -0
- package/lib/grid-cell/grid-cell.component.d.ts +20 -0
- package/lib/header/header.component.d.ts +14 -0
- package/lib/icon/icon.component.d.ts +16 -0
- package/lib/icon/icon.service.d.ts +11 -0
- package/lib/left-nav/left-nav.component.d.ts +38 -0
- package/lib/stepper/stepper.component.d.ts +17 -0
- package/lib/tabs/tabs.component.d.ts +15 -0
- package/lib/toast/toast.component.d.ts +33 -0
- package/lib/tool-tip/tool-tip.component.d.ts +15 -0
- package/package.json +15 -2
- package/{src/public-api.ts → public-api.d.ts} +1 -8
- package/utils/validators.d.ts +3 -0
- package/ng-package.json +0 -8
- package/src/interfaces/avatar-interface.ts +0 -6
- package/src/interfaces/button-interface.ts +0 -12
- package/src/interfaces/chip-interface.ts +0 -11
- package/src/interfaces/grid-interface.ts +0 -24
- package/src/interfaces/select-interface.ts +0 -20
- package/src/interfaces/tab-interface.ts +0 -6
- package/src/lib/avatar/avatar.component.css +0 -48
- package/src/lib/avatar/avatar.component.html +0 -5
- package/src/lib/avatar/avatar.component.spec.ts +0 -23
- package/src/lib/avatar/avatar.component.ts +0 -50
- package/src/lib/button/button.component.css +0 -145
- package/src/lib/button/button.component.html +0 -11
- package/src/lib/button/button.component.spec.ts +0 -23
- package/src/lib/button/button.component.ts +0 -68
- package/src/lib/calendar-header/calendar-header.component.css +0 -67
- package/src/lib/calendar-header/calendar-header.component.html +0 -20
- package/src/lib/calendar-header/calendar-header.component.spec.ts +0 -23
- package/src/lib/calendar-header/calendar-header.component.ts +0 -191
- package/src/lib/card/card-body/card-body.component.css +0 -0
- package/src/lib/card/card-body/card-body.component.html +0 -1
- package/src/lib/card/card-body/card-body.component.spec.ts +0 -23
- package/src/lib/card/card-body/card-body.component.ts +0 -12
- package/src/lib/card/card-footer-actions/card-footer-actions.component.css +0 -4
- package/src/lib/card/card-footer-actions/card-footer-actions.component.html +0 -3
- package/src/lib/card/card-footer-actions/card-footer-actions.component.spec.ts +0 -23
- package/src/lib/card/card-footer-actions/card-footer-actions.component.ts +0 -12
- package/src/lib/card/card-icon/card-icon.component.css +0 -0
- package/src/lib/card/card-icon/card-icon.component.html +0 -1
- package/src/lib/card/card-icon/card-icon.component.spec.ts +0 -23
- package/src/lib/card/card-icon/card-icon.component.ts +0 -12
- package/src/lib/card/card-title-actions/card-title-actions.component.css +0 -3
- package/src/lib/card/card-title-actions/card-title-actions.component.html +0 -1
- package/src/lib/card/card-title-actions/card-title-actions.component.spec.ts +0 -23
- package/src/lib/card/card-title-actions/card-title-actions.component.ts +0 -12
- package/src/lib/card/card.component.css +0 -84
- package/src/lib/card/card.component.html +0 -34
- package/src/lib/card/card.component.spec.ts +0 -23
- package/src/lib/card/card.component.ts +0 -33
- package/src/lib/chips/chips.component.css +0 -129
- package/src/lib/chips/chips.component.html +0 -17
- package/src/lib/chips/chips.component.spec.ts +0 -23
- package/src/lib/chips/chips.component.ts +0 -54
- package/src/lib/component-library.component.spec.ts +0 -23
- package/src/lib/component-library.component.ts +0 -16
- package/src/lib/component-library.service.spec.ts +0 -16
- package/src/lib/component-library.service.ts +0 -9
- package/src/lib/datepicker/datepicker.component.css +0 -33
- package/src/lib/datepicker/datepicker.component.html +0 -11
- package/src/lib/datepicker/datepicker.component.spec.ts +0 -23
- package/src/lib/datepicker/datepicker.component.ts +0 -36
- package/src/lib/form-input/form-input.component.css +0 -109
- package/src/lib/form-input/form-input.component.html +0 -27
- package/src/lib/form-input/form-input.component.spec.ts +0 -23
- package/src/lib/form-input/form-input.component.ts +0 -196
- package/src/lib/form-select/form-select.component.css +0 -157
- package/src/lib/form-select/form-select.component.html +0 -38
- package/src/lib/form-select/form-select.component.spec.ts +0 -23
- package/src/lib/form-select/form-select.component.ts +0 -54
- package/src/lib/grid-cell/grid-cell.component.css +0 -78
- package/src/lib/grid-cell/grid-cell.component.html +0 -31
- package/src/lib/grid-cell/grid-cell.component.spec.ts +0 -23
- package/src/lib/grid-cell/grid-cell.component.ts +0 -89
- package/src/lib/header/header.component.css +0 -62
- package/src/lib/header/header.component.html +0 -23
- package/src/lib/header/header.component.spec.ts +0 -23
- package/src/lib/header/header.component.ts +0 -28
- package/src/lib/icon/icon.component.css +0 -21
- package/src/lib/icon/icon.component.html +0 -5
- package/src/lib/icon/icon.component.ts +0 -49
- package/src/lib/icon/icon.service.ts +0 -27
- package/src/lib/left-nav/left-nav.component.css +0 -106
- package/src/lib/left-nav/left-nav.component.html +0 -48
- package/src/lib/left-nav/left-nav.component.spec.ts +0 -23
- package/src/lib/left-nav/left-nav.component.ts +0 -146
- package/src/lib/stepper/stepper.component.css +0 -96
- package/src/lib/stepper/stepper.component.html +0 -14
- package/src/lib/stepper/stepper.component.spec.ts +0 -23
- package/src/lib/stepper/stepper.component.ts +0 -61
- package/src/lib/tabs/tabs.component.css +0 -100
- package/src/lib/tabs/tabs.component.html +0 -16
- package/src/lib/tabs/tabs.component.spec.ts +0 -23
- package/src/lib/tabs/tabs.component.ts +0 -37
- package/src/lib/toast/toast.component.css +0 -107
- package/src/lib/toast/toast.component.html +0 -29
- package/src/lib/toast/toast.component.spec.ts +0 -23
- package/src/lib/toast/toast.component.ts +0 -87
- package/src/lib/tool-tip/tool-tip.component.css +0 -139
- package/src/lib/tool-tip/tool-tip.component.html +0 -31
- package/src/lib/tool-tip/tool-tip.component.spec.ts +0 -23
- package/src/lib/tool-tip/tool-tip.component.ts +0 -37
- package/src/utils/validators.ts +0 -68
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
* {
|
|
2
|
-
--error-red: #e25c61
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.idle {
|
|
6
|
-
--border: 1px solid var(--grey-50);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.focus {
|
|
10
|
-
--border: 1px solid var(--primary-300);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.disabled,
|
|
14
|
-
[disabled] {
|
|
15
|
-
border: 1px solid var(--grey-50) !important;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/* .sa-input-field>input:focus-visible, .sa-input-field>input:focus-visible {
|
|
19
|
-
--border: 1px solid var(--primary-300);
|
|
20
|
-
} */
|
|
21
|
-
.sa-input-field>input,
|
|
22
|
-
.sa-input-field>input:focus-visible {
|
|
23
|
-
--border: 1px solid var(--primary-300);
|
|
24
|
-
border: none;
|
|
25
|
-
outline: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.sa-input-field:hover {
|
|
29
|
-
--border: 1px solid var(--primary-300);
|
|
30
|
-
--font-color: var(--text-highemphasis);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.sa-input-field>input:focus-visible~sa-icon,
|
|
35
|
-
.sa-input-field:hover sa-icon {
|
|
36
|
-
color: var(--primary-300);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.sa-input-field.invalid>input,
|
|
40
|
-
.sa-input-field.invalid sa-icon {
|
|
41
|
-
color: #e25c61 !important;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.sa-input-field.invalid {
|
|
45
|
-
--border: 1px solid #e25c61;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.sa-input {
|
|
49
|
-
position: relative;
|
|
50
|
-
padding: 8px 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.sa-input-field {
|
|
54
|
-
width: 100%;
|
|
55
|
-
box-sizing: border-box;
|
|
56
|
-
position: relative;
|
|
57
|
-
display: inline-flex;
|
|
58
|
-
padding: 0px var(--small-12px);
|
|
59
|
-
height: 40px;
|
|
60
|
-
justify-content: center;
|
|
61
|
-
align-items: center;
|
|
62
|
-
border: var(--border);
|
|
63
|
-
border-radius: var(--small-4px);
|
|
64
|
-
font-size: 14px;
|
|
65
|
-
font-style: normal;
|
|
66
|
-
font-weight: 400;
|
|
67
|
-
line-height: 20px;
|
|
68
|
-
letter-spacing: 0.25px;
|
|
69
|
-
--font-color: var(--text-lowemphasis);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.sa-input-field input {
|
|
73
|
-
width: inherit;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.sa-input-tag {
|
|
77
|
-
position: absolute;
|
|
78
|
-
background: #fff;
|
|
79
|
-
padding: 2px 6px;
|
|
80
|
-
top: -1px;
|
|
81
|
-
left: 12px;
|
|
82
|
-
z-index: 2;
|
|
83
|
-
font-size: 11px;
|
|
84
|
-
font-weight: 500;
|
|
85
|
-
line-height: 16px;
|
|
86
|
-
letter-spacing: 0.5px;
|
|
87
|
-
text-align: left;
|
|
88
|
-
color: var(--text-lowemphasis);
|
|
89
|
-
/*989DA3*/
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.support-label {
|
|
93
|
-
font-family: var(--font);
|
|
94
|
-
font-size: 11px;
|
|
95
|
-
font-style: normal;
|
|
96
|
-
font-weight: 400;
|
|
97
|
-
line-height: 16px;
|
|
98
|
-
letter-spacing: 0.5px;
|
|
99
|
-
color: var(--text-lowemphasis);
|
|
100
|
-
padding: var(--small-4px) var(--small-16px) 0px var(--small-16px);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.support-label.invalid {
|
|
104
|
-
color: var(--error-red);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.hide {
|
|
108
|
-
display: none;
|
|
109
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<div class="sa-input">
|
|
2
|
-
@if(!!inputVal.length && !!params?.placeholder){
|
|
3
|
-
<span class="sa-input-tag">{{params?.placeholder}}</span>
|
|
4
|
-
}
|
|
5
|
-
<div class="sa-input-field" [ngClass]="inputState" (click)="onInputFieldClick($event)">
|
|
6
|
-
<input matInput [type]="type" value="" [pattern]="type==='tel' ? '[0-9]' : '' "
|
|
7
|
-
[placeholder]="params?.placeholder || '' " (focus)="onFocus()" (blur)="onBlur()" (input)="onInput($event)"
|
|
8
|
-
[(ngModel)]="inputVal" #formInput />
|
|
9
|
-
@if(params?.type === 'password'){
|
|
10
|
-
<sa-icon icon="eye" size="24" (click)="inputIconClick()"
|
|
11
|
-
[ngClass]="!icon.name || icon.name === 'eye' ? '' : 'hide'"></sa-icon>
|
|
12
|
-
<sa-icon icon="eye_filled" size="24" (click)="inputIconClick()"
|
|
13
|
-
[ngClass]="icon.name === 'eye_filled' ? '' : 'hide'"></sa-icon>
|
|
14
|
-
} @else if(icon.name){
|
|
15
|
-
<sa-icon [icon]="icon.name" [size]="icon.size || '24'" [color]="icon.color || ''"
|
|
16
|
-
[ngClass]="icon.show ? '' : 'hide'"></sa-icon>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<!-- <sa-icon [icon]="icon" size="24" (click)="inputIconClick()"></sa-icon> -->
|
|
21
|
-
</div>
|
|
22
|
-
@if((inputState === 'invalid') || (params && params.supportText)){
|
|
23
|
-
<div class="support-label" [ngClass]="inputState === 'invalid' ? inputState : '' ">
|
|
24
|
-
{{inputState === 'invalid' ? inputErrorText : params.supportText}}
|
|
25
|
-
</div>
|
|
26
|
-
}
|
|
27
|
-
</div>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { FormInputComponent } from './form-input.component';
|
|
4
|
-
|
|
5
|
-
describe('FormInputComponent', () => {
|
|
6
|
-
let component: FormInputComponent;
|
|
7
|
-
let fixture: ComponentFixture<FormInputComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [FormInputComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(FormInputComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { Component, ElementRef, Input, ViewChild } from '@angular/core';
|
|
2
|
-
import { AbstractControl, FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
3
|
-
import { FormlyModule } from '@ngx-formly/core';
|
|
4
|
-
import { FieldType, FieldTypeConfig } from '@ngx-formly/core';
|
|
5
|
-
import { NgSelectModule } from '@ng-select/ng-select';
|
|
6
|
-
import { CommonModule } from '@angular/common';
|
|
7
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
8
|
-
import { getValidationMessage, phoneNumberValidator } from '../../utils/validators';
|
|
9
|
-
import { IconComponent } from '../icon/icon.component';
|
|
10
|
-
|
|
11
|
-
@Component({
|
|
12
|
-
selector: 'sa-input',
|
|
13
|
-
standalone: true,
|
|
14
|
-
imports: [
|
|
15
|
-
CommonModule,
|
|
16
|
-
FormsModule,
|
|
17
|
-
ReactiveFormsModule,
|
|
18
|
-
FormlyModule,
|
|
19
|
-
IconComponent
|
|
20
|
-
],
|
|
21
|
-
templateUrl: './form-input.component.html',
|
|
22
|
-
styleUrl: './form-input.component.css'
|
|
23
|
-
})
|
|
24
|
-
export class FormInputComponent extends FieldType<FieldTypeConfig> {
|
|
25
|
-
|
|
26
|
-
@ViewChild('formInput') formInput!: ElementRef;
|
|
27
|
-
|
|
28
|
-
@Input('icon') icon: IInputIcon;
|
|
29
|
-
|
|
30
|
-
inputState = 'idle';
|
|
31
|
-
inputVal = '';
|
|
32
|
-
params: IInputParam | null;
|
|
33
|
-
dependent: AbstractControl<any, any> | null;
|
|
34
|
-
dependentVal: any = null;
|
|
35
|
-
// dynamicIcon: DynamicIcon | null;
|
|
36
|
-
// icon: IInputIcon | null;
|
|
37
|
-
|
|
38
|
-
type: string = '';
|
|
39
|
-
validators: any[];
|
|
40
|
-
asyncValidators: any[];
|
|
41
|
-
|
|
42
|
-
inputErrorText: string = 'invalid input';
|
|
43
|
-
|
|
44
|
-
private suppressOnBlur = false;
|
|
45
|
-
|
|
46
|
-
constructor() {
|
|
47
|
-
super();
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
ngOnInit() {
|
|
52
|
-
this.inputVal = this.field.props['value'];
|
|
53
|
-
this.formControl?.setValue(this.inputVal);
|
|
54
|
-
|
|
55
|
-
this.params = this.field.props['params'];
|
|
56
|
-
this.icon = this.field.props['icon'] || {};
|
|
57
|
-
this.type = this.params?.type || '';
|
|
58
|
-
|
|
59
|
-
// this.dynamicIcon = this.field.props['dynamicIcon'];
|
|
60
|
-
this.setValidators();
|
|
61
|
-
this.setDependents();
|
|
62
|
-
|
|
63
|
-
this.formControl.statusChanges.subscribe((state) => {
|
|
64
|
-
// console.log(state, this.formControl.pending, this.formControl.valid);
|
|
65
|
-
})
|
|
66
|
-
this.formControl.valueChanges.subscribe((val) => {
|
|
67
|
-
this.formInput.nativeElement.value = val;
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
setValidators() {
|
|
72
|
-
this.validators = this.params?.validators || [];
|
|
73
|
-
this.asyncValidators = this.params?.asyncValidators || [];
|
|
74
|
-
this.formControl?.setValidators([...(this.type ? this.predefinedValidators[this.type] || [] : []), ...this.validators]);
|
|
75
|
-
if (this.asyncValidators)
|
|
76
|
-
this.formControl?.setAsyncValidators(this.asyncValidators);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/*
|
|
80
|
-
Assuming dependent field is a single select dropdown
|
|
81
|
-
*/
|
|
82
|
-
setDependents() {
|
|
83
|
-
if (this.params?.dependent) {
|
|
84
|
-
this.dependent = this.form.get([this.params?.dependent]);
|
|
85
|
-
|
|
86
|
-
this.dependent?.valueChanges.subscribe((val) => {
|
|
87
|
-
this.dependentVal = val.length ? val[0] : null;
|
|
88
|
-
this.formControl.reset();
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
checkValidity(defaultInputState = 'focus') {
|
|
94
|
-
if (this.formControl && !this.formControl.valid && this.formControl.touched && !this.formControl.pending) {
|
|
95
|
-
this.inputState = 'invalid';
|
|
96
|
-
this.inputErrorText = getValidationMessage(this.formControl.errors) || 'invalid input';
|
|
97
|
-
} else {
|
|
98
|
-
this.inputState = defaultInputState;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
onFocus() {
|
|
103
|
-
if (this.formControl.valid)
|
|
104
|
-
this.inputState = 'focus'
|
|
105
|
-
}
|
|
106
|
-
onBlur() {
|
|
107
|
-
setTimeout(() => {
|
|
108
|
-
if (!this.suppressOnBlur) {
|
|
109
|
-
this.formControl.markAsTouched();
|
|
110
|
-
this.checkValidity('idle');
|
|
111
|
-
}
|
|
112
|
-
this.suppressOnBlur = false;
|
|
113
|
-
}, 200)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
onInput(event: any) {
|
|
117
|
-
if (this.params?.type === 'tel') {
|
|
118
|
-
this.inputVal = this.inputVal.replace(/[^0-9()+\- ]/g, '');
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
this.formControl?.setValue(this.inputVal);
|
|
122
|
-
this.checkValidity();
|
|
123
|
-
if (this.params?.eventListener) {
|
|
124
|
-
this.params?.eventListener({
|
|
125
|
-
type: IInputEventType.INPUT_CHANGE,
|
|
126
|
-
value: this.inputVal,
|
|
127
|
-
formControl: this.formControl
|
|
128
|
-
} as IInputEvent).then(this.onFieldCallback.bind(this));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
onInputFieldClick(event: any = 'input') {
|
|
133
|
-
if (event === 'input' || event.target.classList.contains('sa-input-field')) {
|
|
134
|
-
this.formInput.nativeElement.focus();
|
|
135
|
-
if (this.params?.type !== 'email') setTimeout(() => {
|
|
136
|
-
this.formInput.nativeElement.setSelectionRange(this.inputVal.length, this.inputVal.length)
|
|
137
|
-
}, 10)
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
inputIconClick() {
|
|
142
|
-
if (this.params?.type === 'password') {
|
|
143
|
-
this.suppressOnBlur = true;
|
|
144
|
-
if (this.type === 'password') {
|
|
145
|
-
this.type = 'text';
|
|
146
|
-
this.icon.name = 'eye_filled';
|
|
147
|
-
} else {
|
|
148
|
-
this.type = 'password';
|
|
149
|
-
this.icon.name = 'eye';
|
|
150
|
-
}
|
|
151
|
-
this.onInputFieldClick();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
onFieldCallback(param: IInputParam) {
|
|
156
|
-
console.log(this.icon, param.icon);
|
|
157
|
-
this.icon = param.icon || this.icon;
|
|
158
|
-
this.checkValidity();
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
predefinedValidators: any = {
|
|
162
|
-
email: [Validators.email, Validators.required],
|
|
163
|
-
password: [Validators.minLength(8), Validators.required],
|
|
164
|
-
tel: [Validators.pattern('^[0-9 +\\-()]*$')]
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export interface IInputIcon {
|
|
169
|
-
name: string;
|
|
170
|
-
show?: boolean;
|
|
171
|
-
color?: string;
|
|
172
|
-
size?: string;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export interface IInputParam {
|
|
176
|
-
validators?: any[];
|
|
177
|
-
asyncValidators?: any[];
|
|
178
|
-
supportText?: string,
|
|
179
|
-
placeholder?: string,
|
|
180
|
-
type?: string,
|
|
181
|
-
dependent?: string,
|
|
182
|
-
eventListener?: Function,
|
|
183
|
-
icon?: IInputIcon
|
|
184
|
-
errors?: { [key: string]: any }
|
|
185
|
-
}
|
|
186
|
-
export interface IInputEvent {
|
|
187
|
-
type: IInputEventType;
|
|
188
|
-
value: string;
|
|
189
|
-
callBack: any;
|
|
190
|
-
formControl: FormControl
|
|
191
|
-
}
|
|
192
|
-
export enum IInputEventType {
|
|
193
|
-
INPUT_CHANGE = 'INPUT_CHANGE',
|
|
194
|
-
STATE_CHANGE = 'STATE_CHANGE',
|
|
195
|
-
ICON_CLICK = 'ICON_CLICK'
|
|
196
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
.idle {
|
|
2
|
-
--border: 1px solid var(--grey-50);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.activated {
|
|
6
|
-
--border: 1px solid var(--primary-300);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.disabled {
|
|
10
|
-
border: 1px solid var(--grey-50) !important;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.ng-select-field:hover {
|
|
14
|
-
--border: 1px solid var(--primary-300);
|
|
15
|
-
--font-color: var(--text-highemphasis);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.ng-select-field {
|
|
19
|
-
width: 100%;
|
|
20
|
-
box-sizing: border-box;
|
|
21
|
-
position: relative;
|
|
22
|
-
display: inline-flex;
|
|
23
|
-
padding: 0px var(--small-12px);
|
|
24
|
-
height: 40px;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
align-items: center;
|
|
27
|
-
border: var(--border);
|
|
28
|
-
border-radius: var(--small-4px);
|
|
29
|
-
font-family: var(--font);
|
|
30
|
-
font-size: 14px;
|
|
31
|
-
font-style: normal;
|
|
32
|
-
font-weight: 400;
|
|
33
|
-
line-height: 20px;
|
|
34
|
-
letter-spacing: 0.25px;
|
|
35
|
-
--font-color: var(--text-lowemphasis);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.ng-select {
|
|
39
|
-
width: inherit;
|
|
40
|
-
display: inline-flex;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
align-items: center;
|
|
43
|
-
flex-shrink: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.ng-select ::ng-deep .ng-select-container {
|
|
47
|
-
display: inline-flex;
|
|
48
|
-
|
|
49
|
-
justify-content: center;
|
|
50
|
-
align-items: center;
|
|
51
|
-
flex-shrink: 0;
|
|
52
|
-
font-family: var(--font);
|
|
53
|
-
box-sizing: border-box;
|
|
54
|
-
border: none;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.ng-select ::ng-deep .ng-dropdown-panel {
|
|
58
|
-
margin-top: 2px;
|
|
59
|
-
border: 1px solid var(--grey-50);
|
|
60
|
-
box-shadow: none !important;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.ng-select ::ng-deep .ng-select-container {
|
|
64
|
-
box-shadow: none !important;
|
|
65
|
-
position: relative !important;
|
|
66
|
-
z-index: 1 !important;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.ng-select ::ng-deep .ng-value-container {
|
|
70
|
-
padding: 0 !important;
|
|
71
|
-
flex-wrap: nowrap !important;
|
|
72
|
-
display: flex;
|
|
73
|
-
justify-content: flex-start;
|
|
74
|
-
gap: 5px;
|
|
75
|
-
overflow-x: hidden;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.ng-select ::ng-deep .ng-value {
|
|
79
|
-
flex: none;
|
|
80
|
-
margin: 0 !important;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.overflow-label {
|
|
84
|
-
padding: 0px 5px;
|
|
85
|
-
cursor: pointer;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.ng-select ::ng-deep .ng-placeholder {
|
|
89
|
-
padding: 0 !important;
|
|
90
|
-
position: inherit !important;
|
|
91
|
-
color: var(--text-lowemphasis);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.ng-select ::ng-deep .ng-input {
|
|
95
|
-
padding: 0 !important;
|
|
96
|
-
position: inherit !important;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.ng-select ::ng-deep .ng-clear-wrapper {
|
|
100
|
-
z-index: 9;
|
|
101
|
-
display: flex;
|
|
102
|
-
margin-left: 5px;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
.ng-select ::ng-deep .ng-arrow {
|
|
107
|
-
border-color: none !important;
|
|
108
|
-
border-style: none !important;
|
|
109
|
-
border-width: 0 !important;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.svg-icon {
|
|
113
|
-
mask-size: contain;
|
|
114
|
-
width: 20px;
|
|
115
|
-
height: 20px;
|
|
116
|
-
background-color: grey;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.svg-icon:hover {
|
|
120
|
-
cursor: pointer;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.ng-select ::ng-deep .ng-arrow-wrapper {
|
|
124
|
-
display: none;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.support-label {
|
|
128
|
-
font-family: var(--font);
|
|
129
|
-
font-size: 11px;
|
|
130
|
-
font-style: normal;
|
|
131
|
-
font-weight: 400;
|
|
132
|
-
line-height: 16px;
|
|
133
|
-
letter-spacing: 0.5px;
|
|
134
|
-
color: var(--text-lowemphasis);
|
|
135
|
-
padding: var(--small-4px) var(--small-16px) 0px var(--small-16px);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.clicked-label {
|
|
139
|
-
position: relative;
|
|
140
|
-
width: max-content;
|
|
141
|
-
|
|
142
|
-
font-family: var(--font);
|
|
143
|
-
font-size: 11px;
|
|
144
|
-
font-style: normal;
|
|
145
|
-
font-weight: 500;
|
|
146
|
-
line-height: 16px;
|
|
147
|
-
letter-spacing: 0.5px;
|
|
148
|
-
|
|
149
|
-
color: var(--text-lowemphasis);
|
|
150
|
-
|
|
151
|
-
padding: 0 var(--small-8px);
|
|
152
|
-
margin-left: 12px;
|
|
153
|
-
margin-bottom: -8px;
|
|
154
|
-
z-index: 99;
|
|
155
|
-
|
|
156
|
-
background-color: white;
|
|
157
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<div [style.visibility]="(openState || topLabel) ? 'visible' : 'hidden'" class="clicked-label">{{params.label}}</div>
|
|
2
|
-
<div class="ng-select-field {{openState ? 'activated' : 'idle'}} {{field.props.disabled ? 'disabled' : ''}}">
|
|
3
|
-
|
|
4
|
-
<div role="button" title="drop-button" tabindex="0" class="left-icon svg-icon" [style]="svgStyle"
|
|
5
|
-
(click)="openClose(true)" (blur)="openClose(false)"
|
|
6
|
-
*ngIf="(params.dropIconPosition == 'left' || params.dropIconPosition == 'both')">
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<ng-select (change)="checkForZero($event)" (remove)="shiftLabel('removed')" (clear)="shiftLabel('cleared')"
|
|
10
|
-
(search)="openClose(true)" (focus)="openClose(true)" (blur)=" openClose(false)" [isOpen]="openState"
|
|
11
|
-
placeholder={{params.label}} bindLabel="name" [items]="selectables" [multiple]="params.multiple"
|
|
12
|
-
[formControl]="formControl" [style] [formlyAttributes]="field">
|
|
13
|
-
<ng-template ng-multi-label-tmp let-items="items" let-clear="clear">
|
|
14
|
-
<div *ngFor="let item of (items ? items.slice(startInd,startInd+labelLimit): [])">
|
|
15
|
-
<sa-chip (onClickEvent)=" (!field.props.disabled) ? clear(item) : null" [id]="item.id"
|
|
16
|
-
[iconPath]="params.iconPath" [text]="item.name" [type]="params.type"
|
|
17
|
-
[state]="field.props.disabled ? 'neutral' : params.state" [filling]="params.filling"
|
|
18
|
-
[iconPosition]="params.iconPosition">
|
|
19
|
-
</sa-chip>
|
|
20
|
-
</div>
|
|
21
|
-
<div (click)="shiftLabel('clicked')" class="ng-value overflow-label" *ngIf="items.length > (startInd+labelLimit)">
|
|
22
|
-
<sa-chip text="+{{items.length-(startInd+labelLimit)}}" type="regular" state="default" filling="filled">
|
|
23
|
-
</sa-chip>
|
|
24
|
-
</div>
|
|
25
|
-
<div (click)="shiftLabel('cleared')" *ngIf="startInd == items.length-labelLimit" class="ng-value overflow-label">
|
|
26
|
-
<sa-chip text="..." type="regular" state="default" filling="filled">
|
|
27
|
-
</sa-chip>
|
|
28
|
-
</div>
|
|
29
|
-
</ng-template>
|
|
30
|
-
</ng-select>
|
|
31
|
-
|
|
32
|
-
<div role="button" title="drop-button" tabindex="0" class="right-icon svg-icon" [style]="svgStyle"
|
|
33
|
-
(click)="openClose(true)" (blur)="openClose(false)"
|
|
34
|
-
*ngIf="(params.dropIconPosition == 'right' || params.dropIconPosition == 'both')">
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
</div>
|
|
38
|
-
<div class="support-label">{{params.supportText}}</div>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { FormSelectComponent } from './form-select.component';
|
|
4
|
-
|
|
5
|
-
describe('FormSelectComponent', () => {
|
|
6
|
-
let component: FormSelectComponent;
|
|
7
|
-
let fixture: ComponentFixture<FormSelectComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [FormSelectComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(FormSelectComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
3
|
-
import { FormlyModule } from '@ngx-formly/core';
|
|
4
|
-
import { FieldType, FieldTypeConfig } from '@ngx-formly/core';
|
|
5
|
-
import { NgSelectModule } from '@ng-select/ng-select';
|
|
6
|
-
import { ChipsComponent } from '../chips/chips.component';
|
|
7
|
-
import { NgIf, NgFor } from '@angular/common';
|
|
8
|
-
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'lib-form-select',
|
|
11
|
-
standalone: true,
|
|
12
|
-
imports: [
|
|
13
|
-
ReactiveFormsModule,
|
|
14
|
-
FormlyModule,
|
|
15
|
-
ReactiveFormsModule,
|
|
16
|
-
NgSelectModule,
|
|
17
|
-
ChipsComponent,
|
|
18
|
-
NgIf,
|
|
19
|
-
NgFor
|
|
20
|
-
],
|
|
21
|
-
templateUrl: './form-select.component.html',
|
|
22
|
-
styleUrl: './form-select.component.css'
|
|
23
|
-
})
|
|
24
|
-
export class FormSelectComponent extends FieldType<FieldTypeConfig> {
|
|
25
|
-
selectables: any;
|
|
26
|
-
params: any;
|
|
27
|
-
|
|
28
|
-
svgStyle = {};
|
|
29
|
-
openState: boolean = false;
|
|
30
|
-
topLabel: boolean;
|
|
31
|
-
startInd: number = 0;
|
|
32
|
-
labelLimit: number = 2;
|
|
33
|
-
|
|
34
|
-
ngOnInit() {
|
|
35
|
-
this.selectables = this.field.props.options;
|
|
36
|
-
this.params = this.field.props['params'];
|
|
37
|
-
this.svgStyle = {
|
|
38
|
-
'-webkit-mask-image': `url(${this.params.dropIcon})})`,
|
|
39
|
-
'mask-image': `url(${this.params.dropIcon})`,
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
openClose(state: boolean) {
|
|
43
|
-
if (this.field.props.disabled) return;
|
|
44
|
-
this.openState = state;
|
|
45
|
-
}
|
|
46
|
-
shiftLabel(action: string) {
|
|
47
|
-
if (action == 'clicked') this.startInd++;
|
|
48
|
-
if (action == 'cleared') this.startInd = 0;
|
|
49
|
-
if (action == 'removed' && this.startInd > 0) this.startInd--;
|
|
50
|
-
}
|
|
51
|
-
checkForZero(selected: any) {
|
|
52
|
-
this.topLabel = selected.length == 0 ? false : true;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
.header {
|
|
2
|
-
--bg: var(--primary-50);
|
|
3
|
-
--color: var(--text-highemphasis);
|
|
4
|
-
--border: none;
|
|
5
|
-
--flex-direction: left;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.header:hover {
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.row {
|
|
13
|
-
--color: var(--text-highemphasis);
|
|
14
|
-
--cursor: default;
|
|
15
|
-
--border: var(--grey-50);
|
|
16
|
-
--flex-direction: left;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.numeric {
|
|
20
|
-
--color: var(--text-highemphasis);
|
|
21
|
-
--cursor: default;
|
|
22
|
-
--border: var(--grey-50);
|
|
23
|
-
--flex-direction: right;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.interactive {
|
|
27
|
-
--color: var(--primary-500);
|
|
28
|
-
--cursor: pointer;
|
|
29
|
-
--border: var(--grey-50);
|
|
30
|
-
--flex-direction: left;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.grid-cell {
|
|
34
|
-
display: flex;
|
|
35
|
-
height: 48px;
|
|
36
|
-
padding: var(--small-12px);
|
|
37
|
-
justify-content: var(--flex-direction);
|
|
38
|
-
align-items: center;
|
|
39
|
-
gap: var(--small-8px);
|
|
40
|
-
flex-shrink: 0;
|
|
41
|
-
|
|
42
|
-
font-family: var(--font);
|
|
43
|
-
box-sizing: border-box;
|
|
44
|
-
border-bottom: 1px solid var(--border);
|
|
45
|
-
|
|
46
|
-
width: calc(100% - 20px);
|
|
47
|
-
background-color: var(--bg);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.grid-text {
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.main-text {
|
|
56
|
-
color: var(--color);
|
|
57
|
-
font-size: 14px;
|
|
58
|
-
font-weight: 400;
|
|
59
|
-
height: 20px;
|
|
60
|
-
line-height: 20px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.main-text:hover {
|
|
64
|
-
cursor: var(--cursor);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.sub-text {
|
|
68
|
-
font-size: 11px;
|
|
69
|
-
font-weight: 400;
|
|
70
|
-
height: 16px;
|
|
71
|
-
line-height: 16px;
|
|
72
|
-
color: var(--text-mediumemphasis);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.icons {
|
|
76
|
-
width: var(--medium-20px);
|
|
77
|
-
height: var(--medium-20px);
|
|
78
|
-
}
|