@corp-products/ui-components 0.0.1 → 1.0.0
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/corp-products-ui-components.mjs +5 -0
- package/esm2022/index.mjs +14 -0
- package/esm2022/lib/app-accordion/app-accordion.component.mjs +35 -0
- package/esm2022/lib/app-button/app-button.component.mjs +43 -0
- package/esm2022/lib/app-button/app-button.mjs +2 -0
- package/esm2022/lib/app-button/index.mjs +3 -0
- package/esm2022/lib/app-dropdown-menu/app-dropdown-menu.component.mjs +54 -0
- package/esm2022/lib/app-dropdown-menu/app-dropdown-menu.mjs +2 -0
- package/esm2022/lib/app-dropdown-menu/index.mjs +3 -0
- package/esm2022/lib/app-dropdown-menu/menu-popup.pipe.mjs +23 -0
- package/esm2022/lib/app-tabs/app-tab.interface.mjs +2 -0
- package/esm2022/lib/app-tabs/app-tabs.component.mjs +57 -0
- package/esm2022/lib/app-tabs/index.mjs +3 -0
- package/esm2022/lib/confirmation-dialog/confirmation-dialog.component.mjs +44 -0
- package/esm2022/lib/dynamic-form/dynamic-form.component.mjs +31 -0
- package/esm2022/lib/dynamic-form/dynamic-form.interface.mjs +6 -0
- package/esm2022/lib/form-components/@utils/form-utils.mjs +11 -0
- package/esm2022/lib/form-components/@utils/validations/error-keys.enum.mjs +27 -0
- package/esm2022/lib/form-components/@utils/validations/form-validation.service.mjs +50 -0
- package/esm2022/lib/form-components/@utils/validations/index.mjs +4 -0
- package/esm2022/lib/form-components/@utils/validations/validation-message.pipe.mjs +30 -0
- package/esm2022/lib/form-components/components/auto-complete/auto-complete.component.mjs +59 -0
- package/esm2022/lib/form-components/components/base-input.component.mjs +57 -0
- package/esm2022/lib/form-components/components/date-picker/date-picker.component.mjs +58 -0
- package/esm2022/lib/form-components/components/input/input.component.mjs +48 -0
- package/esm2022/lib/form-components/components/select/select.component.mjs +72 -0
- package/esm2022/lib/form-components/components/select-button/select-button.component.mjs +29 -0
- package/esm2022/lib/form-components/components/switcher/switch.component.mjs +34 -0
- package/esm2022/lib/form-components/index.mjs +10 -0
- package/esm2022/lib/form-components/interfaces/index.mjs +2 -0
- package/esm2022/lib/form-components/interfaces/label-value.mjs +2 -0
- package/esm2022/lib/ico-moon-icon/ico-moon-icon.component.mjs +41 -0
- package/esm2022/lib/read-more/read-more.component.mjs +30 -0
- package/esm2022/lib/side-bar/side-bar.component.mjs +51 -0
- package/esm2022/lib/user-autocomplete-card/user-autocomplete-card.component.mjs +32 -0
- package/esm2022/lib/user-info/user-info.component.mjs +15 -0
- package/fesm2022/corp-products-ui-components.mjs +840 -0
- package/fesm2022/corp-products-ui-components.mjs.map +1 -0
- package/{src/index.ts → index.d.ts} +13 -13
- package/lib/app-accordion/app-accordion.component.d.ts +11 -0
- package/lib/app-button/app-button.component.d.ts +18 -0
- package/{src/lib/app-button/app-button.ts → lib/app-button/app-button.d.ts} +4 -15
- package/{src/lib/app-button/index.ts → lib/app-button/index.d.ts} +2 -2
- package/lib/app-dropdown-menu/app-dropdown-menu.component.d.ts +20 -0
- package/lib/app-dropdown-menu/app-dropdown-menu.d.ts +15 -0
- package/{src/lib/app-dropdown-menu/index.ts → lib/app-dropdown-menu/index.d.ts} +2 -2
- package/lib/app-dropdown-menu/menu-popup.pipe.d.ts +8 -0
- package/lib/app-tabs/app-tab.interface.d.ts +23 -0
- package/lib/app-tabs/app-tabs.component.d.ts +18 -0
- package/{src/lib/app-tabs/index.ts → lib/app-tabs/index.d.ts} +2 -2
- package/lib/confirmation-dialog/confirmation-dialog.component.d.ts +19 -0
- package/lib/dynamic-form/dynamic-form.component.d.ts +16 -0
- package/lib/dynamic-form/dynamic-form.interface.d.ts +44 -0
- package/lib/form-components/@utils/form-utils.d.ts +4 -0
- package/lib/form-components/@utils/validations/error-keys.enum.d.ts +24 -0
- package/lib/form-components/@utils/validations/form-validation.service.d.ts +11 -0
- package/{src/lib/form-components/@utils/validations/index.ts → lib/form-components/@utils/validations/index.d.ts} +3 -3
- package/lib/form-components/@utils/validations/validation-message.pipe.d.ts +9 -0
- package/lib/form-components/components/auto-complete/auto-complete.component.d.ts +18 -0
- package/lib/form-components/components/base-input.component.d.ts +21 -0
- package/lib/form-components/components/date-picker/date-picker.component.d.ts +21 -0
- package/lib/form-components/components/input/input.component.d.ts +17 -0
- package/lib/form-components/components/select/select.component.d.ts +23 -0
- package/lib/form-components/components/select-button/select-button.component.d.ts +13 -0
- package/lib/form-components/components/switcher/switch.component.d.ts +11 -0
- package/{src/lib/form-components/index.ts → lib/form-components/index.d.ts} +9 -9
- package/{src/lib/form-components/interfaces/index.ts → lib/form-components/interfaces/index.d.ts} +1 -1
- package/lib/form-components/interfaces/label-value.d.ts +4 -0
- package/lib/ico-moon-icon/ico-moon-icon.component.d.ts +9 -0
- package/lib/read-more/read-more.component.d.ts +10 -0
- package/lib/side-bar/side-bar.component.d.ts +18 -0
- package/lib/user-autocomplete-card/user-autocomplete-card.component.d.ts +12 -0
- package/lib/user-info/user-info.component.d.ts +7 -0
- package/package.json +35 -19
- package/eslint.config.js +0 -34
- package/ng-package.json +0 -7
- package/project.json +0 -29
- package/src/lib/app-accordion/app-accordion.component.html +0 -15
- package/src/lib/app-accordion/app-accordion.component.scss +0 -0
- package/src/lib/app-accordion/app-accordion.component.spec.ts +0 -21
- package/src/lib/app-accordion/app-accordion.component.ts +0 -21
- package/src/lib/app-accordion/index.ts +0 -2
- package/src/lib/app-button/app-button.component.html +0 -13
- package/src/lib/app-button/app-button.component.scss +0 -0
- package/src/lib/app-button/app-button.component.ts +0 -28
- package/src/lib/app-dropdown-menu/app-dropdown-menu.component.html +0 -25
- package/src/lib/app-dropdown-menu/app-dropdown-menu.component.scss +0 -39
- package/src/lib/app-dropdown-menu/app-dropdown-menu.component.spec.ts +0 -21
- package/src/lib/app-dropdown-menu/app-dropdown-menu.component.ts +0 -43
- package/src/lib/app-dropdown-menu/app-dropdown-menu.ts +0 -17
- package/src/lib/app-dropdown-menu/menu-popup.pipe.ts +0 -18
- package/src/lib/app-tabs/app-tab.interface.ts +0 -26
- package/src/lib/app-tabs/app-tabs.component.html +0 -35
- package/src/lib/app-tabs/app-tabs.component.scss +0 -103
- package/src/lib/app-tabs/app-tabs.component.spec.ts +0 -21
- package/src/lib/app-tabs/app-tabs.component.ts +0 -48
- package/src/lib/confirmation-dialog/confirmation-dialog.component.html +0 -54
- package/src/lib/confirmation-dialog/confirmation-dialog.component.scss +0 -0
- package/src/lib/confirmation-dialog/confirmation-dialog.component.spec.ts +0 -22
- package/src/lib/confirmation-dialog/confirmation-dialog.component.ts +0 -51
- package/src/lib/dynamic-form/dynamic-form.component.html +0 -39
- package/src/lib/dynamic-form/dynamic-form.component.scss +0 -0
- package/src/lib/dynamic-form/dynamic-form.component.spec.ts +0 -21
- package/src/lib/dynamic-form/dynamic-form.component.ts +0 -29
- package/src/lib/dynamic-form/dynamic-form.interface.ts +0 -56
- package/src/lib/form-components/@utils/form-utils.ts +0 -12
- package/src/lib/form-components/@utils/validations/error-keys.enum.ts +0 -24
- package/src/lib/form-components/@utils/validations/form-validation.service.ts +0 -53
- package/src/lib/form-components/@utils/validations/validation-message.pipe.ts +0 -24
- package/src/lib/form-components/components/auto-complete/auto-complete.component.html +0 -48
- package/src/lib/form-components/components/auto-complete/auto-complete.component.scss +0 -0
- package/src/lib/form-components/components/auto-complete/auto-complete.component.spec.ts +0 -21
- package/src/lib/form-components/components/auto-complete/auto-complete.component.ts +0 -48
- package/src/lib/form-components/components/base-input.component.ts +0 -41
- package/src/lib/form-components/components/date-picker/date-picker.component.html +0 -53
- package/src/lib/form-components/components/date-picker/date-picker.component.scss +0 -4
- package/src/lib/form-components/components/date-picker/date-picker.component.spec.ts +0 -23
- package/src/lib/form-components/components/date-picker/date-picker.component.ts +0 -45
- package/src/lib/form-components/components/input/input.component.html +0 -59
- package/src/lib/form-components/components/input/input.component.scss +0 -3
- package/src/lib/form-components/components/input/input.component.spec.ts +0 -21
- package/src/lib/form-components/components/input/input.component.ts +0 -32
- package/src/lib/form-components/components/select/select.component.html +0 -90
- package/src/lib/form-components/components/select/select.component.scss +0 -0
- package/src/lib/form-components/components/select/select.component.spec.ts +0 -21
- package/src/lib/form-components/components/select/select.component.ts +0 -51
- package/src/lib/form-components/components/select-button/select-button.component.html +0 -21
- package/src/lib/form-components/components/select-button/select-button.component.scss +0 -0
- package/src/lib/form-components/components/select-button/select-button.component.spec.ts +0 -21
- package/src/lib/form-components/components/select-button/select-button.component.ts +0 -22
- package/src/lib/form-components/components/switcher/switch.component.html +0 -5
- package/src/lib/form-components/components/switcher/switch.component.scss +0 -0
- package/src/lib/form-components/components/switcher/switch.component.spec.ts +0 -21
- package/src/lib/form-components/components/switcher/switch.component.ts +0 -25
- package/src/lib/form-components/interfaces/label-value.ts +0 -4
- package/src/lib/ico-moon-icon/ico-moon-icon.component.ts +0 -23
- package/src/lib/read-more/read-more.component.html +0 -17
- package/src/lib/read-more/read-more.component.scss +0 -0
- package/src/lib/read-more/read-more.component.spec.ts +0 -21
- package/src/lib/read-more/read-more.component.ts +0 -21
- package/src/lib/side-bar/side-bar.component.html +0 -25
- package/src/lib/side-bar/side-bar.component.scss +0 -5
- package/src/lib/side-bar/side-bar.component.spec.ts +0 -21
- package/src/lib/side-bar/side-bar.component.ts +0 -32
- package/src/lib/side-bar-dynamic/data-injector.pipe.ts +0 -15
- package/src/lib/side-bar-dynamic/dynamic-sidebar.service.ts +0 -116
- package/src/lib/side-bar-dynamic/side-bar-dynamic.component.html +0 -51
- package/src/lib/side-bar-dynamic/side-bar-dynamic.component.scss +0 -5
- package/src/lib/side-bar-dynamic/side-bar-dynamic.component.spec.ts +0 -21
- package/src/lib/side-bar-dynamic/side-bar-dynamic.component.ts +0 -37
- package/src/lib/side-bar-dynamic/side-bar-utils.ts +0 -30
- package/src/lib/side-bar-dynamic/sidebar-config.ts +0 -48
- package/src/lib/user-autocomplete-card/user-autocomplete-card.component.html +0 -20
- package/src/lib/user-autocomplete-card/user-autocomplete-card.component.scss +0 -0
- package/src/lib/user-autocomplete-card/user-autocomplete-card.component.spec.ts +0 -21
- package/src/lib/user-autocomplete-card/user-autocomplete-card.component.ts +0 -21
- package/src/lib/user-info/user-info.component.html +0 -10
- package/src/lib/user-info/user-info.component.ts +0 -11
- package/tsconfig.json +0 -25
- package/tsconfig.lib.json +0 -12
- package/tsconfig.lib.prod.json +0 -9
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<div class="field flex flex-col gap-2 my-3 relative">
|
|
2
|
-
@if (label) {
|
|
3
|
-
<label [for]="inputId">
|
|
4
|
-
{{ label }}
|
|
5
|
-
@if (required) {
|
|
6
|
-
<span [class.text-red-700]="isInvalid">*</span>
|
|
7
|
-
}
|
|
8
|
-
</label>
|
|
9
|
-
}
|
|
10
|
-
@if (!required) {
|
|
11
|
-
<span class="absolute top-[6px] left-0 text-[10px] text-gray-400">{{'forms.config.optional' | translate}}</span>
|
|
12
|
-
}
|
|
13
|
-
<p-auto-complete
|
|
14
|
-
(completeMethod)="search($event)"
|
|
15
|
-
(onSelect)="onSelect($event)"
|
|
16
|
-
[delay]="delay"
|
|
17
|
-
[disabled]="disabled"
|
|
18
|
-
[formControl]="control"
|
|
19
|
-
[id]="inputId"
|
|
20
|
-
[inputStyleClass]="'reset-default-styles w-full' + (basicInput ? ' basic-style': ' ')"
|
|
21
|
-
[minLength]="minLengthToSearch"
|
|
22
|
-
[name]="name"
|
|
23
|
-
[ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid}"
|
|
24
|
-
[placeholder]="placeholder"
|
|
25
|
-
[styleClass]="'w-full'"
|
|
26
|
-
[suggestions]="items">
|
|
27
|
-
<ng-template let-item pTemplate="item">
|
|
28
|
-
@if (selectedItemTemplate) {
|
|
29
|
-
<ng-container
|
|
30
|
-
[ngTemplateOutletContext]="{ $implicit: item }"
|
|
31
|
-
[ngTemplateOutlet]="selectedItemTemplate"
|
|
32
|
-
/>
|
|
33
|
-
}
|
|
34
|
-
</ng-template>
|
|
35
|
-
</p-auto-complete>
|
|
36
|
-
|
|
37
|
-
@if (hint) {
|
|
38
|
-
<small class="p-mt-1">{{ hint }}</small>
|
|
39
|
-
}
|
|
40
|
-
@if (isInvalid && (control.dirty || control.touched)) {
|
|
41
|
-
<small class="p-error text-red-700">
|
|
42
|
-
@for (error of control.errors | validationErrors; track error) {
|
|
43
|
-
{{ error }}<br>
|
|
44
|
-
}
|
|
45
|
-
</small>
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
</div>
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { AutoCompleteComponent } from './auto-complete.component';
|
|
3
|
-
|
|
4
|
-
describe('AutoCompleteComponent', () => {
|
|
5
|
-
let component: AutoCompleteComponent;
|
|
6
|
-
let fixture: ComponentFixture<AutoCompleteComponent>;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await TestBed.configureTestingModule({
|
|
10
|
-
imports: [AutoCompleteComponent],
|
|
11
|
-
}).compileComponents();
|
|
12
|
-
|
|
13
|
-
fixture = TestBed.createComponent(AutoCompleteComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { JsonPipe, NgClass, NgIf, NgTemplateOutlet } from "@angular/common";
|
|
2
|
-
import { Component, EventEmitter, Input, Output, TemplateRef } from "@angular/core";
|
|
3
|
-
import { ReactiveFormsModule } from "@angular/forms";
|
|
4
|
-
import { ValidationErrorsPipe } from "../../@utils/validations/validation-message.pipe";
|
|
5
|
-
import { PrimeTemplate } from "primeng/api";
|
|
6
|
-
import { AutoComplete, AutoCompleteCompleteEvent, AutoCompleteSelectEvent } from "primeng/autocomplete";
|
|
7
|
-
import { BaseInputComponent } from "../base-input.component";
|
|
8
|
-
import {TranslatePipe} from "@ngx-translate/core";
|
|
9
|
-
|
|
10
|
-
@Component({
|
|
11
|
-
selector: "stc-auto-complete",
|
|
12
|
-
standalone: true,
|
|
13
|
-
imports: [
|
|
14
|
-
ReactiveFormsModule,
|
|
15
|
-
AutoComplete,
|
|
16
|
-
PrimeTemplate,
|
|
17
|
-
NgIf,
|
|
18
|
-
NgTemplateOutlet,
|
|
19
|
-
NgClass,
|
|
20
|
-
JsonPipe,
|
|
21
|
-
ValidationErrorsPipe,
|
|
22
|
-
TranslatePipe
|
|
23
|
-
],
|
|
24
|
-
templateUrl: "./auto-complete.component.html",
|
|
25
|
-
styleUrl: "./auto-complete.component.scss"
|
|
26
|
-
})
|
|
27
|
-
export class AutoCompleteComponent extends BaseInputComponent {
|
|
28
|
-
@Input() selectedItemTemplate: TemplateRef<unknown> | null = null;
|
|
29
|
-
// eslint-disable-next-line @angular-eslint/no-output-on-prefix
|
|
30
|
-
@Output() onSearch: EventEmitter<string> = new EventEmitter<string>();
|
|
31
|
-
@Output() selectOption: EventEmitter<AutoCompleteSelectEvent> = new EventEmitter<AutoCompleteSelectEvent>();
|
|
32
|
-
@Input() items: any[] = [];
|
|
33
|
-
@Input() minLengthToSearch = 3;
|
|
34
|
-
@Input() delay = 300; // default value
|
|
35
|
-
@Input() basicInput!: boolean;
|
|
36
|
-
|
|
37
|
-
constructor() {
|
|
38
|
-
super();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
search(event: AutoCompleteCompleteEvent) {
|
|
42
|
-
this.onSearch.emit(event.query);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
onSelect(event: AutoCompleteSelectEvent) {
|
|
46
|
-
this.selectOption.emit(event);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnDestroy, OnInit } from "@angular/core";
|
|
2
|
-
import { FormControl, Validators } from "@angular/forms";
|
|
3
|
-
import { Subject, takeUntil } from "rxjs";
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
template: ""
|
|
7
|
-
})
|
|
8
|
-
export abstract class BaseInputComponent implements OnInit, OnDestroy {
|
|
9
|
-
@Input({ required: true }) control!: FormControl;
|
|
10
|
-
@Input() name: string = "";
|
|
11
|
-
@Input() label?: string;
|
|
12
|
-
@Input() placeholder: string = "";
|
|
13
|
-
@Input() inputId!: string;
|
|
14
|
-
@Input() readonly: boolean = false;
|
|
15
|
-
@Input() disabled: boolean = false;
|
|
16
|
-
@Input() hint?: string;
|
|
17
|
-
|
|
18
|
-
protected destroy$ = new Subject<void>();
|
|
19
|
-
|
|
20
|
-
get required(): boolean {
|
|
21
|
-
return this.control.hasValidator(Validators.required);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get isInvalid(): boolean {
|
|
25
|
-
return this.control.invalid && this.control.touched;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
ngOnInit() {
|
|
29
|
-
this.inputId = `input-${this.name + "-" + Math.random().toString(36).substring(7)}`;
|
|
30
|
-
this.control.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((v) => {
|
|
31
|
-
if (v) {
|
|
32
|
-
this.control.markAsTouched();
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ngOnDestroy(): void {
|
|
38
|
-
this.destroy$.next();
|
|
39
|
-
this.destroy$.complete();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<div class="field flex flex-col gap-2 my-3 relative" >
|
|
2
|
-
@if (label) {
|
|
3
|
-
<label [for]="inputId">
|
|
4
|
-
{{ label }}
|
|
5
|
-
@if (required) {
|
|
6
|
-
<span [class.text-red-700]="isInvalid">*</span>
|
|
7
|
-
}
|
|
8
|
-
</label>
|
|
9
|
-
}
|
|
10
|
-
@if (!required) {
|
|
11
|
-
<span class="absolute top-[6px] left-0 text-[10px] text-gray-400">{{'forms.config.optional' | translate}}</span>
|
|
12
|
-
}
|
|
13
|
-
<p-datepicker
|
|
14
|
-
[selectionMode]="selectionMode"
|
|
15
|
-
[disabled]="disabled"
|
|
16
|
-
[formControl]="control"
|
|
17
|
-
[iconDisplay]="'input'"
|
|
18
|
-
[showClear]="showClear"
|
|
19
|
-
(onClear)="afterClearDate()"
|
|
20
|
-
[id]="inputId"
|
|
21
|
-
[inputStyleClass]="'reset-default-styles ' + (basicInput ? 'basic-style' : '')"
|
|
22
|
-
[ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid }"
|
|
23
|
-
[placeholder]="placeholder"
|
|
24
|
-
[showIcon]="showIcon" [styleClass]="'w-full'"
|
|
25
|
-
appendTo="body"
|
|
26
|
-
[timeOnly]="isTimeOnly"
|
|
27
|
-
[hourFormat]="hourFormat"
|
|
28
|
-
[minDate]="minDate"
|
|
29
|
-
[maxDate]="maxDate">
|
|
30
|
-
@if (isTimeOnly) {
|
|
31
|
-
<ng-template #inputicon let-clickCallBack="clickCallBack">
|
|
32
|
-
<i class="text-[18px] font-icon-time-clock" (click)="clickCallBack($event)"></i>
|
|
33
|
-
</ng-template>
|
|
34
|
-
<ng-template pTemplate="footer">
|
|
35
|
-
<div class="p-datepicker-buttonbar">
|
|
36
|
-
<button pButton type="button" class="p-button-text" (click)="selectCurrentTime($event)">الان
|
|
37
|
-
</button>
|
|
38
|
-
<button pButton type="button" class="p-button-text" (click)="clearButtonClick($event)"> الغاء</button>
|
|
39
|
-
</div>
|
|
40
|
-
</ng-template>
|
|
41
|
-
}
|
|
42
|
-
</p-datepicker>
|
|
43
|
-
@if (hint) {
|
|
44
|
-
<small class="p-mt-1">{{ hint }}</small>
|
|
45
|
-
}
|
|
46
|
-
@if (isInvalid && (control.dirty || control.touched)) {
|
|
47
|
-
<small class="p-error text-red-700">
|
|
48
|
-
@for (error of control.errors | validationErrors; track error) {
|
|
49
|
-
{{ error }}<br>
|
|
50
|
-
}
|
|
51
|
-
</small>
|
|
52
|
-
}
|
|
53
|
-
</div>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
|
2
|
-
import {
|
|
3
|
-
DatePickerComponent
|
|
4
|
-
} from 'nx-BOD-workspace/libs/ui-components/src/lib/form-components/components/date-picker/date-picker.component';
|
|
5
|
-
|
|
6
|
-
describe('DatePickerComponent', () => {
|
|
7
|
-
let component: DatePickerComponent;
|
|
8
|
-
let fixture: ComponentFixture<DatePickerComponent>;
|
|
9
|
-
|
|
10
|
-
beforeEach(async () => {
|
|
11
|
-
await TestBed.configureTestingModule({
|
|
12
|
-
imports: [DatePickerComponent],
|
|
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
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { NgClass } from "@angular/common";
|
|
2
|
-
import { Component, EventEmitter, Input, Output, ViewEncapsulation } from "@angular/core";
|
|
3
|
-
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
|
4
|
-
import { ValidationErrorsPipe } from "../../@utils/validations/validation-message.pipe";
|
|
5
|
-
import { DatePicker } from "primeng/datepicker";
|
|
6
|
-
import { BaseInputComponent } from "../base-input.component";
|
|
7
|
-
import { CalendarModule } from "primeng/calendar";
|
|
8
|
-
import {TranslatePipe} from "@ngx-translate/core";
|
|
9
|
-
@Component({
|
|
10
|
-
selector: "stc-date-picker",
|
|
11
|
-
standalone: true,
|
|
12
|
-
imports: [FormsModule, DatePicker, ReactiveFormsModule, NgClass, CalendarModule, ValidationErrorsPipe, TranslatePipe],
|
|
13
|
-
templateUrl: "./date-picker.component.html",
|
|
14
|
-
styleUrl: "./date-picker.component.scss",
|
|
15
|
-
encapsulation: ViewEncapsulation.None
|
|
16
|
-
})
|
|
17
|
-
export class DatePickerComponent extends BaseInputComponent {
|
|
18
|
-
@Input() showIcon: boolean = false;
|
|
19
|
-
@Input() showClear: boolean = false;
|
|
20
|
-
@Input() basicInput!: boolean;
|
|
21
|
-
@Input() isTimeOnly: boolean = false;
|
|
22
|
-
@Input() minDate: Date | undefined | null;
|
|
23
|
-
@Input() maxDate: Date | undefined | null;
|
|
24
|
-
@Input() hourFormat: "12" | "24" = "12";
|
|
25
|
-
nowTime = new Date();
|
|
26
|
-
@Input() selectionMode: "single" | "range" = "single";
|
|
27
|
-
@Output() onAfterClearDate = new EventEmitter<void>();
|
|
28
|
-
|
|
29
|
-
constructor() {
|
|
30
|
-
super();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
selectCurrentTime(e: any) {
|
|
34
|
-
this.control.setValue(this.nowTime);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
clearButtonClick(e: any) {
|
|
38
|
-
this.control.setValue(null);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
afterClearDate() {
|
|
42
|
-
this.control.reset();
|
|
43
|
-
this.onAfterClearDate.emit();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<div class="field flex flex-col gap-2 my-3 relative">
|
|
2
|
-
@if (label) {
|
|
3
|
-
<label [for]="inputId">
|
|
4
|
-
{{ label }}
|
|
5
|
-
@if (required) {
|
|
6
|
-
<span [class.text-red-700]="isInvalid">*</span>
|
|
7
|
-
}
|
|
8
|
-
</label>
|
|
9
|
-
}
|
|
10
|
-
@if (!required && !hideOptionalLabel) {
|
|
11
|
-
<span class="absolute top-[6px] left-0 text-[10px] text-gray-400">{{'forms.config.optional' | translate}}</span>
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
<!-- input text align will be handled according to lang when implemented -->
|
|
15
|
-
|
|
16
|
-
@if (type !== 'textarea') {
|
|
17
|
-
<input
|
|
18
|
-
[id]="inputId"
|
|
19
|
-
[type]="contentType"
|
|
20
|
-
[formControl]="control"
|
|
21
|
-
[placeholder]="placeholder"
|
|
22
|
-
[readonly]="readonly"
|
|
23
|
-
[disabled]="disabled"
|
|
24
|
-
[name]="name"
|
|
25
|
-
pInputText
|
|
26
|
-
[ngStyle]="{'direction': inputDirection || 'inherit', 'text-align': 'right'}"
|
|
27
|
-
[ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid, 'basic-style': basicInput, 'no-style':noStyle}"
|
|
28
|
-
/>
|
|
29
|
-
@if (prefix) {
|
|
30
|
-
<span class="absolute top-[40px] font-bold text-[16px] left-[25px]">
|
|
31
|
-
{{ prefix }}
|
|
32
|
-
</span>
|
|
33
|
-
}
|
|
34
|
-
} @else {
|
|
35
|
-
<textarea
|
|
36
|
-
[name]="name"
|
|
37
|
-
[id]="inputId"
|
|
38
|
-
[formControl]="control"
|
|
39
|
-
[placeholder]="placeholder"
|
|
40
|
-
[readonly]="readonly"
|
|
41
|
-
[disabled]="disabled"
|
|
42
|
-
pTextarea
|
|
43
|
-
[rows]="rows"
|
|
44
|
-
[cols]="cols"
|
|
45
|
-
[autoResize]="autoResize"
|
|
46
|
-
[ngClass]="{'ng-invalid ng-dirty': control.invalid && (control.dirty || control.touched), 'basic-style': basicInput, 'no-style':noStyle}"
|
|
47
|
-
></textarea>
|
|
48
|
-
}
|
|
49
|
-
@if (hint) {
|
|
50
|
-
<small class="p-mt-1">{{ hint }}</small>
|
|
51
|
-
}
|
|
52
|
-
@if (isInvalid && (control.dirty || control.touched)) {
|
|
53
|
-
<small class="p-error text-red-700">
|
|
54
|
-
@for (error of control.errors | validationErrors; track error) {
|
|
55
|
-
{{ error }}<br>
|
|
56
|
-
}
|
|
57
|
-
</small>
|
|
58
|
-
}
|
|
59
|
-
</div>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { InputComponent } from './input.component';
|
|
3
|
-
|
|
4
|
-
describe('InputComponent', () => {
|
|
5
|
-
let component: InputComponent;
|
|
6
|
-
let fixture: ComponentFixture<InputComponent>;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await TestBed.configureTestingModule({
|
|
10
|
-
imports: [InputComponent],
|
|
11
|
-
}).compileComponents();
|
|
12
|
-
|
|
13
|
-
fixture = TestBed.createComponent(InputComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { NgClass, NgStyle } from "@angular/common";
|
|
2
|
-
import { Component, Input } from "@angular/core";
|
|
3
|
-
import { ReactiveFormsModule } from "@angular/forms";
|
|
4
|
-
import { ValidationErrorsPipe } from "../../@utils/validations/validation-message.pipe";
|
|
5
|
-
import { InputText } from "primeng/inputtext";
|
|
6
|
-
import { Textarea } from "primeng/textarea";
|
|
7
|
-
import { BaseInputComponent } from "../base-input.component";
|
|
8
|
-
import {TranslatePipe} from "@ngx-translate/core";
|
|
9
|
-
|
|
10
|
-
@Component({
|
|
11
|
-
selector: "stc-input",
|
|
12
|
-
standalone: true,
|
|
13
|
-
imports: [ReactiveFormsModule, InputText, Textarea, ValidationErrorsPipe, NgClass, NgStyle, TranslatePipe],
|
|
14
|
-
templateUrl: "./input.component.html",
|
|
15
|
-
styleUrl: "./input.component.scss"
|
|
16
|
-
})
|
|
17
|
-
export class InputComponent extends BaseInputComponent {
|
|
18
|
-
@Input() type: "text" | "textarea" = "text";
|
|
19
|
-
@Input() contentType: "text" | "email" | "number" = "text";
|
|
20
|
-
@Input() prefix: string;
|
|
21
|
-
@Input() rows = 2;
|
|
22
|
-
@Input() cols = 20;
|
|
23
|
-
@Input() autoResize = true;
|
|
24
|
-
@Input() basicInput!: boolean;
|
|
25
|
-
@Input() noStyle!: boolean;
|
|
26
|
-
@Input() hideOptionalLabel: boolean;
|
|
27
|
-
@Input() inputDirection: "ltr" | "rtl" | "inherit" = "inherit";
|
|
28
|
-
|
|
29
|
-
constructor() {
|
|
30
|
-
super();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<div class="field flex flex-col gap-2 my-3 relative">
|
|
2
|
-
@if (label) {
|
|
3
|
-
<label [for]="inputId">
|
|
4
|
-
{{ label }}
|
|
5
|
-
@if (required) {
|
|
6
|
-
<span [class.text-red-700]="isInvalid">*</span>
|
|
7
|
-
}
|
|
8
|
-
</label>
|
|
9
|
-
} @if (!required) {
|
|
10
|
-
<span class="absolute top-[6px] left-0 text-[10px] text-gray-400">{{'forms.config.optional' | translate}}</span>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@if(multiple) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<p-multiselect
|
|
18
|
-
[disabled]="disabled"
|
|
19
|
-
[filterBy]="filterBy"
|
|
20
|
-
[filter]="filter"
|
|
21
|
-
[formControl]="control"
|
|
22
|
-
[id]="inputId"
|
|
23
|
-
[name]="name"
|
|
24
|
-
[ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid }"
|
|
25
|
-
[optionLabel]="optionLabel"
|
|
26
|
-
[options]="options"
|
|
27
|
-
[placeholder]="placeholder"
|
|
28
|
-
[readonly]="readonly"
|
|
29
|
-
[showClear]="showClear"
|
|
30
|
-
class="w-full"
|
|
31
|
-
[selectedItemsLabel]="selectedItemsLabel"
|
|
32
|
-
(onChange)="onChange($event)"
|
|
33
|
-
[ngClass]="{ 'basic-style': basicInput }"
|
|
34
|
-
>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
@if(optionTemplate){
|
|
38
|
-
<ng-template let-item #item>
|
|
39
|
-
<ng-container [ngTemplateOutletContext]="{ $implicit: item }" [ngTemplateOutlet]="optionTemplate" />
|
|
40
|
-
</ng-template>
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<ng-template #dropdownicon>
|
|
45
|
-
<i class="pi pi-map"></i>
|
|
46
|
-
</ng-template>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</p-multiselect>
|
|
50
|
-
|
|
51
|
-
} @else {
|
|
52
|
-
<p-select
|
|
53
|
-
[checkmark]="checkmark"
|
|
54
|
-
[disabled]="disabled"
|
|
55
|
-
[editable]="editable"
|
|
56
|
-
[filterBy]="filterBy"
|
|
57
|
-
[filter]="filter"
|
|
58
|
-
[formControl]="control"
|
|
59
|
-
[id]="inputId"
|
|
60
|
-
[name]="name"
|
|
61
|
-
[ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid }"
|
|
62
|
-
[optionLabel]="optionLabel"
|
|
63
|
-
[options]="options"
|
|
64
|
-
[placeholder]="placeholder"
|
|
65
|
-
[readonly]="readonly"
|
|
66
|
-
[showClear]="showClear"
|
|
67
|
-
class="w-full"
|
|
68
|
-
(onChange)="onChange($event)"
|
|
69
|
-
[ngClass]="{ 'basic-style': basicInput }"
|
|
70
|
-
>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@if (selectedItemTemplate) {
|
|
74
|
-
<ng-template let-item pTemplate="item">
|
|
75
|
-
<ng-container [ngTemplateOutletContext]="{ $implicit: item }" [ngTemplateOutlet]="selectedItemTemplate" />
|
|
76
|
-
</ng-template>
|
|
77
|
-
}
|
|
78
|
-
</p-select>
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@if (hint) {
|
|
82
|
-
<small class="p-mt-1">{{ hint }}</small>
|
|
83
|
-
} @if (isInvalid && (control.dirty || control.touched)) {
|
|
84
|
-
<small class="p-error text-red-700">
|
|
85
|
-
@for (error of control.errors | validationErrors; track error) {
|
|
86
|
-
{{ error }}<br />
|
|
87
|
-
}
|
|
88
|
-
</small>
|
|
89
|
-
}
|
|
90
|
-
</div>
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { SelectComponent } from './select.component';
|
|
3
|
-
|
|
4
|
-
describe('SelectComponent', () => {
|
|
5
|
-
let component: SelectComponent;
|
|
6
|
-
let fixture: ComponentFixture<SelectComponent>;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await TestBed.configureTestingModule({
|
|
10
|
-
imports: [SelectComponent],
|
|
11
|
-
}).compileComponents();
|
|
12
|
-
|
|
13
|
-
fixture = TestBed.createComponent(SelectComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { NgClass, NgTemplateOutlet } from '@angular/common';
|
|
2
|
-
import { Component, EventEmitter, Input, Output, TemplateRef } from '@angular/core';
|
|
3
|
-
import { PrimeTemplate } from 'primeng/api';
|
|
4
|
-
import { ValidationErrorsPipe } from "../../@utils/validations";
|
|
5
|
-
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
|
6
|
-
import { Select, SelectChangeEvent } from "primeng/select";
|
|
7
|
-
import { BaseInputComponent } from "../base-input.component";
|
|
8
|
-
import { MultiSelectModule } from 'primeng/multiselect';
|
|
9
|
-
import {TranslatePipe} from "@ngx-translate/core";
|
|
10
|
-
|
|
11
|
-
@Component({
|
|
12
|
-
selector: "stc-select",
|
|
13
|
-
standalone: true,
|
|
14
|
-
imports: [
|
|
15
|
-
FormsModule,
|
|
16
|
-
Select,
|
|
17
|
-
ReactiveFormsModule,
|
|
18
|
-
NgClass,
|
|
19
|
-
NgTemplateOutlet,
|
|
20
|
-
PrimeTemplate,
|
|
21
|
-
ValidationErrorsPipe,
|
|
22
|
-
MultiSelectModule,
|
|
23
|
-
TranslatePipe
|
|
24
|
-
],
|
|
25
|
-
templateUrl: "./select.component.html",
|
|
26
|
-
styleUrl: "./select.component.scss"
|
|
27
|
-
})
|
|
28
|
-
export class SelectComponent extends BaseInputComponent {
|
|
29
|
-
@Input() selectedItemTemplate: TemplateRef<unknown> | null = null;
|
|
30
|
-
@Input() optionTemplate: TemplateRef<unknown> | null = null;
|
|
31
|
-
@Input() options: unknown[];
|
|
32
|
-
@Input() optionLabel!: string;
|
|
33
|
-
@Input() checkmark = true;
|
|
34
|
-
@Input() showClear = false;
|
|
35
|
-
@Input() editable = false;
|
|
36
|
-
@Input() filter = false;
|
|
37
|
-
@Input() multiple = false;
|
|
38
|
-
@Input() filterBy!: string;
|
|
39
|
-
@Input() selectedItemsLabel!: string;
|
|
40
|
-
@Input() basicInput!: boolean;
|
|
41
|
-
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
42
|
-
@Output() change = new EventEmitter();
|
|
43
|
-
|
|
44
|
-
constructor() {
|
|
45
|
-
super();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
onChange(e: SelectChangeEvent) {
|
|
49
|
-
this.change.emit(e);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<div class="grid grid-cols-12 gap-x-4 gap-y-0 items-end">
|
|
2
|
-
<div class="col-span-12">
|
|
3
|
-
<div class="text-[14px] font-bold mb-1">{{ title }}</div>
|
|
4
|
-
<div class="grid w-100 bg-gray-100 rounded drop-shadow-basic">
|
|
5
|
-
<p-selectButton [disabled]="disabled"
|
|
6
|
-
[options]="options"
|
|
7
|
-
[formControl]="control"
|
|
8
|
-
optionLabel="label"
|
|
9
|
-
optionValue="value"
|
|
10
|
-
class="rounded"
|
|
11
|
-
[styleClass]="'full-width'"
|
|
12
|
-
(onChange)="changeValue($event)">
|
|
13
|
-
<ng-template let-item class="flex w-100">
|
|
14
|
-
<div class="col-span-4">
|
|
15
|
-
<span>{{ item.value }}</span>
|
|
16
|
-
</div>
|
|
17
|
-
</ng-template>
|
|
18
|
-
</p-selectButton>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from "@angular/core/testing";
|
|
2
|
-
import { SelectButtonComponent } from "./select-button.component";
|
|
3
|
-
|
|
4
|
-
describe("AppSelectButtonComponent", () => {
|
|
5
|
-
let component: SelectButtonComponent;
|
|
6
|
-
let fixture: ComponentFixture<SelectButtonComponent>;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await TestBed.configureTestingModule({
|
|
10
|
-
imports: [SelectButtonComponent]
|
|
11
|
-
}).compileComponents();
|
|
12
|
-
|
|
13
|
-
fixture = TestBed.createComponent(SelectButtonComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("should create", () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
|
2
|
-
import { SelectButtonChangeEvent, SelectButtonModule } from 'primeng/selectbutton';
|
|
3
|
-
import { BaseInputComponent } from "../base-input.component";
|
|
4
|
-
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
|
5
|
-
import {LabelValue} from "../../interfaces";
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: "stc-select-button",
|
|
9
|
-
standalone: true,
|
|
10
|
-
imports: [ReactiveFormsModule, SelectButtonModule, FormsModule],
|
|
11
|
-
templateUrl: "./select-button.component.html",
|
|
12
|
-
styleUrl: "./select-button.component.scss"
|
|
13
|
-
})
|
|
14
|
-
export class SelectButtonComponent extends BaseInputComponent {
|
|
15
|
-
@Output() onChange: EventEmitter<any> = new EventEmitter<string>();
|
|
16
|
-
@Input() options: LabelValue<any>[];
|
|
17
|
-
@Input() title: string;
|
|
18
|
-
|
|
19
|
-
changeValue(e: SelectButtonChangeEvent) {
|
|
20
|
-
this.onChange.emit(e.value);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
File without changes
|