@corp-products/ui-components 3.5.9 → 3.6.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.
Files changed (148) hide show
  1. package/.storybook/main.ts +12 -0
  2. package/debug-storybook.log +53 -0
  3. package/ng-package.json +7 -0
  4. package/package.json +25 -36
  5. package/src/enums/date-formatter.ts +22 -0
  6. package/src/helper/date-handler.ts +142 -0
  7. package/src/lib/alert-dialog/alert-dialog.component.html +22 -0
  8. package/src/lib/alert-dialog/alert-dialog.component.scss +0 -0
  9. package/src/lib/alert-dialog/alert-dialog.component.spec.ts +22 -0
  10. package/src/lib/alert-dialog/alert-dialog.component.ts +44 -0
  11. package/src/lib/alert-dialog/alert-dialog.interface.ts +6 -0
  12. package/src/lib/alert-dialog/alert-dialog.service.ts +33 -0
  13. package/src/lib/app-accordion/app-accordion.component.html +15 -0
  14. package/src/lib/app-accordion/app-accordion.component.scss +0 -0
  15. package/src/lib/app-accordion/app-accordion.component.spec.ts +21 -0
  16. package/src/lib/app-accordion/app-accordion.component.ts +21 -0
  17. package/src/lib/app-accordion/index.ts +2 -0
  18. package/src/lib/app-breadcrumb/app-breadcrumb.component.html +7 -0
  19. package/src/lib/app-breadcrumb/app-breadcrumb.component.scss +25 -0
  20. package/src/lib/app-breadcrumb/app-breadcrumb.component.ts +140 -0
  21. package/src/lib/app-breadcrumb/app-breadcrumb.interface.ts +15 -0
  22. package/src/lib/app-button/app-button.component.html +7 -0
  23. package/src/lib/app-button/app-button.component.scss +0 -0
  24. package/src/lib/app-button/app-button.component.ts +14 -0
  25. package/src/lib/app-button/app-button.ts +15 -0
  26. package/src/lib/app-button/index.ts +2 -0
  27. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.html +22 -0
  28. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.scss +39 -0
  29. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.spec.ts +21 -0
  30. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.ts +43 -0
  31. package/src/lib/app-dropdown-menu/app-dropdown-menu.ts +17 -0
  32. package/src/lib/app-dropdown-menu/index.ts +2 -0
  33. package/src/lib/app-dropdown-menu/menu-popup.pipe.ts +18 -0
  34. package/src/lib/app-header/app-header.component.html +26 -0
  35. package/src/lib/app-header/app-header.component.scss +0 -0
  36. package/src/lib/app-header/app-header.component.ts +43 -0
  37. package/src/lib/app-side-menu/app-side-menu.component.html +20 -0
  38. package/src/lib/app-side-menu/app-side-menu.component.ts +28 -0
  39. package/src/lib/app-side-menu/routes-names.ts +28 -0
  40. package/src/lib/app-side-menu/side-menu-items.ts +45 -0
  41. package/src/lib/app-side-menu/side-menu.ts +12 -0
  42. package/src/lib/app-tabs/app-tab.interface.ts +27 -0
  43. package/src/lib/app-tabs/app-tabs.component.html +37 -0
  44. package/src/lib/app-tabs/app-tabs.component.scss +103 -0
  45. package/src/lib/app-tabs/app-tabs.component.spec.ts +21 -0
  46. package/src/lib/app-tabs/app-tabs.component.ts +67 -0
  47. package/src/lib/app-tabs/index.ts +2 -0
  48. package/src/lib/bottom-sheet/bottom-sheet.component.html +18 -0
  49. package/src/lib/bottom-sheet/bottom-sheet.component.scss +31 -0
  50. package/src/lib/bottom-sheet/bottom-sheet.component.ts +26 -0
  51. package/src/lib/confirmation-dialog/confirmation-dialog.component.html +37 -0
  52. package/src/lib/confirmation-dialog/confirmation-dialog.component.scss +0 -0
  53. package/src/lib/confirmation-dialog/confirmation-dialog.component.spec.ts +22 -0
  54. package/src/lib/confirmation-dialog/confirmation-dialog.component.ts +64 -0
  55. package/src/lib/confirmation-dialog/confirmation-dialog.interface.ts +13 -0
  56. package/src/lib/confirmation-dialog/confirmation-dialog.service.ts +34 -0
  57. package/src/lib/dual-calender/date-picker-switcher/date-picker-switcher.component.html +27 -0
  58. package/src/lib/dual-calender/date-picker-switcher/date-picker-switcher.component.scss +22 -0
  59. package/src/lib/dual-calender/date-picker-switcher/date-picker-switcher.component.ts +64 -0
  60. package/src/lib/dual-calender/dual-calendar.component.html +30 -0
  61. package/src/lib/dual-calender/dual-calendar.component.scss +265 -0
  62. package/src/lib/dual-calender/dual-calendar.component.ts +157 -0
  63. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.html +21 -0
  64. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.scss +0 -0
  65. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.spec.ts +21 -0
  66. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.ts +65 -0
  67. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.html +10 -0
  68. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.scss +0 -0
  69. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.spec.ts +21 -0
  70. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.ts +66 -0
  71. package/src/lib/dual-calender/services/gregorian-i18n.service.ts +123 -0
  72. package/src/lib/dual-calender/services/islamic-i18n.service.ts +119 -0
  73. package/src/lib/dual-calender/utils/date-i18n.utils.ts +58 -0
  74. package/src/lib/dynamic-form/dynamic-form.component.html +84 -0
  75. package/src/lib/dynamic-form/dynamic-form.component.scss +0 -0
  76. package/src/lib/dynamic-form/dynamic-form.component.spec.ts +21 -0
  77. package/src/lib/dynamic-form/dynamic-form.component.ts +58 -0
  78. package/src/lib/dynamic-form/dynamic-form.interface.ts +96 -0
  79. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.component.html +32 -0
  80. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.component.scss +3 -0
  81. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.component.ts +82 -0
  82. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.config.ts +31 -0
  83. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.service.ts +41 -0
  84. package/src/lib/form-components/@utils/form-utils.ts +12 -0
  85. package/src/lib/form-components/@utils/validations/error-keys.enum.ts +25 -0
  86. package/src/lib/form-components/@utils/validations/form-validation.service.ts +68 -0
  87. package/src/lib/form-components/@utils/validations/index.ts +4 -0
  88. package/src/lib/form-components/@utils/validations/numbers-only.validator.ts +10 -0
  89. package/src/lib/form-components/@utils/validations/validation-message.pipe.ts +24 -0
  90. package/src/lib/form-components/components/auto-complete/auto-complete.component.html +35 -0
  91. package/src/lib/form-components/components/auto-complete/auto-complete.component.scss +12 -0
  92. package/src/lib/form-components/components/auto-complete/auto-complete.component.spec.ts +21 -0
  93. package/src/lib/form-components/components/auto-complete/auto-complete.component.ts +82 -0
  94. package/src/lib/form-components/components/base-input.component.ts +35 -0
  95. package/src/lib/form-components/components/date-picker/date-picker.component.html +40 -0
  96. package/src/lib/form-components/components/date-picker/date-picker.component.scss +32 -0
  97. package/src/lib/form-components/components/date-picker/date-picker.component.spec.ts +21 -0
  98. package/src/lib/form-components/components/date-picker/date-picker.component.ts +81 -0
  99. package/src/lib/form-components/components/date-picker/date-picker.validator.ts +38 -0
  100. package/src/lib/form-components/components/input/input.component.html +80 -0
  101. package/src/lib/form-components/components/input/input.component.scss +46 -0
  102. package/src/lib/form-components/components/input/input.component.spec.ts +21 -0
  103. package/src/lib/form-components/components/input/input.component.ts +56 -0
  104. package/src/lib/form-components/components/select/select.component.html +123 -0
  105. package/src/lib/form-components/components/select/select.component.scss +53 -0
  106. package/src/lib/form-components/components/select/select.component.spec.ts +21 -0
  107. package/src/lib/form-components/components/select/select.component.ts +87 -0
  108. package/src/lib/form-components/components/select-button/select-button.component.html +21 -0
  109. package/src/lib/form-components/components/select-button/select-button.component.scss +0 -0
  110. package/src/lib/form-components/components/select-button/select-button.component.spec.ts +21 -0
  111. package/src/lib/form-components/components/select-button/select-button.component.ts +22 -0
  112. package/src/lib/form-components/components/switcher/switch.component.html +5 -0
  113. package/src/lib/form-components/components/switcher/switch.component.scss +0 -0
  114. package/src/lib/form-components/components/switcher/switch.component.spec.ts +21 -0
  115. package/src/lib/form-components/components/switcher/switch.component.ts +25 -0
  116. package/src/lib/form-components/index.ts +9 -0
  117. package/src/lib/form-components/interfaces/index.ts +1 -0
  118. package/src/lib/form-components/interfaces/label-value.ts +4 -0
  119. package/src/lib/ico-moon-icon/ico-moon-icon.component.ts +23 -0
  120. package/src/lib/read-more/read-more.component.html +17 -0
  121. package/src/lib/read-more/read-more.component.scss +0 -0
  122. package/src/lib/read-more/read-more.component.spec.ts +21 -0
  123. package/src/lib/read-more/read-more.component.ts +21 -0
  124. package/src/lib/side-bar/side-bar.component.html +24 -0
  125. package/src/lib/side-bar/side-bar.component.scss +22 -0
  126. package/src/lib/side-bar/side-bar.component.spec.ts +21 -0
  127. package/src/lib/side-bar/side-bar.component.ts +33 -0
  128. package/src/lib/side-bar-dynamic/data-injector.pipe.ts +15 -0
  129. package/src/lib/side-bar-dynamic/dynamic-sidebar.service.ts +116 -0
  130. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.html +42 -0
  131. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.scss +5 -0
  132. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.spec.ts +21 -0
  133. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.ts +37 -0
  134. package/src/lib/side-bar-dynamic/side-bar-utils.ts +30 -0
  135. package/src/lib/side-bar-dynamic/sidebar-config.ts +48 -0
  136. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.html +20 -0
  137. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.scss +0 -0
  138. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.spec.ts +21 -0
  139. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.ts +21 -0
  140. package/src/lib/user-info/user-info.component.html +10 -0
  141. package/src/lib/user-info/user-info.component.ts +11 -0
  142. package/src/public-api.ts +29 -0
  143. package/tsconfig.lib.json +18 -0
  144. package/tsconfig.lib.prod.json +11 -0
  145. package/tsconfig.spec.json +14 -0
  146. package/fesm2022/corp-products-ui-components.mjs +0 -2253
  147. package/fesm2022/corp-products-ui-components.mjs.map +0 -1
  148. package/index.d.ts +0 -721
@@ -0,0 +1,80 @@
1
+ <div class="field flex flex-col gap-2 my-3 relative">
2
+
3
+ <!-- input text align will be handled according to lang when implemented -->
4
+
5
+ @switch (type) {
6
+ @case ('textarea') {
7
+ @if (label) {
8
+ <div class="flex items-center justify-between gap-2">
9
+ <label [for]="inputId">
10
+ {{ label }}
11
+ @if (required) {
12
+ <span [class.text-required]="required">*</span>
13
+ }
14
+ <!-- @else if (!hideOptionalLabel) {
15
+ <span span class="optional-label">{{'forms.config.optional' | translate}}</span>
16
+ } -->
17
+ </label>
18
+ <ng-content></ng-content>
19
+ </div>
20
+ }
21
+ <textarea [name]="name" [id]="inputId" [formControl]="control" [placeholder]="placeholder" [readonly]="readonly"
22
+ [disabled]="disabled" pTextarea [rows]="rows" [cols]="cols" [autoResize]="autoResize" [class]="
23
+ 'w-full border border-[' + defaultColor + '] rounded-none focus:outline-[' + defaultColor + '] focus:border-[' + defaultColor + '] hover:border-[' + defaultColor + '] disabled:opacity-50'
24
+ "
25
+ [ngClass]="{'ng-invalid ng-dirty': control.invalid && (control.dirty || control.touched), 'basic-style': basicInput, 'no-style':noStyle}">
26
+ </textarea>
27
+ }
28
+ @case ('withIcon') {
29
+ <p-iconfield class="filter-input">
30
+ <p-inputicon>
31
+ <i [class]="iconClass"></i>
32
+ </p-inputicon>
33
+ <input pInputText [id]="inputId" type="text" [placeholder]="placeholder" [formControl]="control" [readonly]="readonly"
34
+ [class]="
35
+ 'w-full border border-[' + defaultColor + '] rounded-none focus:outline-[' + defaultColor + '] focus:border-[' + defaultColor + '] hover:border-[' + defaultColor + '] disabled:opacity-50'"
36
+ [ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid, 'basic-style': basicInput, 'no-style':noStyle}" />
37
+ @if (canClear && control.value) {
38
+ <p-inputIcon (click)="clearInput()">
39
+ <i class="pi pi-times cursor-pointer text-sm text-gray-400 hover:text-gray-600"></i>
40
+ </p-inputIcon>
41
+ }
42
+
43
+ </p-iconfield>
44
+ }
45
+ @default {
46
+ <p-floatlabel [variant]="variant">
47
+ <!-- <input pInputText id="value2" [(ngModel)]="value2" [invalid]="!value2" autocomplete="off" /> -->
48
+ <input [id]="inputId" [type]="'text-float-label'" [formControl]="control" [readonly]="readonly" [pSize]="size"
49
+ [class]="
50
+ 'w-full border border-[' + defaultColor + '] rounded-none focus:outline-[' + defaultColor + '] focus:border-[' + defaultColor + '] hover:border-[' + defaultColor + '] disabled:opacity-50'
51
+ " [disabled]="disabled" [name]="name" pInputText [ngStyle]="{'direction': inputDirection || 'inherit'}"
52
+ class="w-full"
53
+ [ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid, 'basic-style': basicInput, 'no-style':noStyle}" />
54
+ <label [for]="inputId">
55
+ {{ label }}
56
+ @if (required) {
57
+ <span [class.text-required]="required">*</span>
58
+ }
59
+ </label>
60
+ </p-floatlabel>
61
+ @if (prefix) {
62
+ <span class="absolute top-[40px] font-bold text-[16px] left-[25px]">
63
+ {{ prefix }}
64
+ </span>
65
+ }
66
+
67
+
68
+ }
69
+ }
70
+ @if (hint) {
71
+ <small class="p-mt-1">{{ hint }}</small>
72
+ }
73
+ @if (isInvalid && (control.dirty || control.touched)) {
74
+ <small class="p-error">
75
+ @for (error of control.errors | validationErrors; track error) {
76
+ {{ error }}<br>
77
+ }
78
+ </small>
79
+ }
80
+ </div>
@@ -0,0 +1,46 @@
1
+ textarea {
2
+ @apply h-auto min-h-[50px] overflow-auto;
3
+ }
4
+
5
+
6
+ textarea,
7
+ .p-select, input {
8
+ border-radius: 0 ;
9
+ border-color: #DFE0E6 ;
10
+
11
+ &:enabled {
12
+ &:hover {
13
+ border-color: #DFE0E6 ;
14
+ }
15
+ }
16
+
17
+ &:not(.p-disabled).p-focus,
18
+ &:not(.p-disabled).p-focus:hover,
19
+ &:focus {
20
+ outline: #DFE0E6 ;
21
+ border-color: #DFE0E6 ;
22
+ }
23
+ }
24
+ .p-floatlabel:has(input:focus) label,
25
+ .p-floatlabel:has(input:-webkit-autofill) label,
26
+ .p-floatlabel:has(textarea:focus) label,
27
+ .p-floatlabel:has(.p-inputwrapper-focus) label {
28
+ color: #687078;
29
+
30
+ }
31
+ .p-inputtext:enabled:focus {
32
+ border-color: #DFE0E6 ;
33
+ }
34
+
35
+ .text-required {
36
+ color: red;
37
+ }
38
+
39
+ .p-error {
40
+ color: #dc2626;
41
+ }
42
+
43
+ .optional-label {
44
+ @apply text-[10px] text-gray-400;
45
+ margin-inline-start: 4px;
46
+ }
@@ -0,0 +1,21 @@
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
+ });
@@ -0,0 +1,56 @@
1
+ import { NgClass, NgStyle } from '@angular/common';
2
+ import { Component, Input } from '@angular/core';
3
+ import { ReactiveFormsModule } from '@angular/forms';
4
+ import { TranslatePipe } from '@ngx-translate/core';
5
+ import { FloatLabelModule } from 'primeng/floatlabel';
6
+ import { InputText } from 'primeng/inputtext';
7
+ import { Textarea } from 'primeng/textarea';
8
+ import { ValidationErrorsPipe } from '../../@utils/validations/validation-message.pipe';
9
+ import { BaseInputComponent } from '../base-input.component';
10
+ import { IconField } from 'primeng/iconfield';
11
+ import { InputIcon } from 'primeng/inputicon';
12
+ @Component({
13
+ selector: 'stc-input',
14
+ standalone: true,
15
+ imports: [
16
+ ReactiveFormsModule,
17
+ InputText,
18
+ Textarea,
19
+ ValidationErrorsPipe,
20
+ NgClass,
21
+ NgStyle,
22
+ TranslatePipe,
23
+ FloatLabelModule,
24
+ InputIcon,
25
+ IconField,
26
+ ],
27
+ templateUrl: './input.component.html',
28
+ styleUrl: './input.component.scss',
29
+ })
30
+ export class InputComponent extends BaseInputComponent {
31
+ @Input() type: 'text' | 'textarea' | 'withIcon' = 'text';
32
+ @Input() contentType: 'text' | 'email' | 'number' = 'text';
33
+ @Input() size: 'small' | 'large' = "small";
34
+ @Input() prefix: string;
35
+ @Input() rows = 2;
36
+ @Input() cols = 20;
37
+ @Input() autoResize = false;
38
+ @Input() basicInput!: boolean;
39
+ @Input() noStyle!: boolean;
40
+ @Input() canClear!: boolean;
41
+ @Input() hideOptionalLabel: boolean;
42
+ @Input() inputDirection: 'ltr' | 'rtl' | 'inherit' = 'inherit';
43
+ @Input() variant: 'in' | 'over' | 'on' = 'over';
44
+ @Input() defaultColor = '#DFE0E6'
45
+ @Input() iconClass?: string;
46
+ @Input() iconPosition: 'left' | 'right' = 'left';
47
+
48
+
49
+ constructor() {
50
+ super();
51
+ }
52
+
53
+ clearInput() {
54
+ this.control.reset();
55
+ }
56
+ }
@@ -0,0 +1,123 @@
1
+ <div class="field flex flex-col gap-2 my-3 relative">
2
+
3
+ @if(multiple) {
4
+ <p-floatLabel [variant]="variant">
5
+
6
+ <p-multiselect
7
+ [disabled]="disabled"
8
+ [filterBy]="filterBy"
9
+ [filter]="filter"
10
+ [formControl]="control"
11
+ [id]="inputId"
12
+ [name]="name"
13
+ [ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid }"
14
+ [optionLabel]="optionLabel"
15
+ [optionValue]="optionValue"
16
+ [options]="options"
17
+ [showToggleAll]="false"
18
+ [placeholder]="placeholder"
19
+ [emptyMessage]="emptyMessage || ('shared.no_results_found'|translate)"
20
+ [readonly]="readonly"
21
+ [showClear]="showClear"
22
+ (onClear)="onMultiSelectClear()"
23
+ class="w-full"
24
+ [size]="size"
25
+ [selectedItemsLabel]="selectedItemsLabel || ('shared.Items_Selected'| translate: {count: '{0}'})"
26
+ [class]="
27
+ 'w-full border border-[' + defaultColor + '] rounded-none focus:outline-[' + defaultColor + '] focus:border-[' + defaultColor + '] hover:border-[' + defaultColor + '] disabled:opacity-50'
28
+ "
29
+ (onChange)="onChange($event)"
30
+ [ngClass]="{ 'basic-style': basicInput }"
31
+ >
32
+
33
+ @if (selectAllLabel) {
34
+ <ng-template #filter>
35
+ <p-checkbox
36
+ binary="true"
37
+ [(ngModel)]="allSelectd"
38
+ (onChange)="toggleAll($event)"
39
+ inputId="toggleAll">
40
+ </p-checkbox>
41
+ <span>{{selectAllLabel}}</span>
42
+ </ng-template>
43
+ }
44
+
45
+ @if(optionTemplate){
46
+ <ng-template let-item #item>
47
+ <ng-container [ngTemplateOutletContext]="{ $implicit: item }" [ngTemplateOutlet]="optionTemplate" />
48
+ </ng-template>
49
+ }
50
+
51
+
52
+
53
+
54
+
55
+ </p-multiselect>
56
+ <label [for]="inputId">
57
+ {{ label }}
58
+ @if (required) {
59
+ <span [class.text-required]="required">*</span>
60
+ }
61
+ </label>
62
+
63
+ </p-floatLabel>
64
+
65
+ } @else {
66
+ <p-floatLabel [variant]="variant">
67
+ <p-select
68
+ [dataKey]="dataKey"
69
+ [checkmark]="checkmark"
70
+ [disabled]="disabled"
71
+ [editable]="editable"
72
+ [filterBy]="filterBy"
73
+ [filter]="filter"
74
+ [formControl]="control"
75
+ [id]="inputId"
76
+ [name]="name"
77
+ [ngClass]="{ 'p-invalid ng-dirty ng-invalid': isInvalid }"
78
+ [emptyMessage]="emptyMessage || ('shared.no_results_found'|translate)"
79
+ [optionLabel]="optionLabel"
80
+ [optionValue]="optionValue"
81
+ [options]="options"
82
+ [placeholder]="placeholder"
83
+ [readonly]="readonly"
84
+ [showClear]="showClear"
85
+ [size]="size"
86
+ class="w-full"
87
+ [class]="
88
+ 'w-full border border-[' + defaultColor + '] rounded-none focus:outline-[' + defaultColor + '] focus:border-[' + defaultColor + '] hover:border-[' + defaultColor + '] disabled:opacity-50'
89
+ "
90
+ (onChange)="onChange($event)"
91
+ [ngClass]="{ 'basic-style': basicInput }"
92
+ >
93
+
94
+ @if (optionTemplate) {
95
+ <ng-template let-item pTemplate="item">
96
+ <ng-container [ngTemplateOutletContext]="{ $implicit: item }" [ngTemplateOutlet]="optionTemplate" />
97
+ </ng-template>
98
+ }
99
+ @if (selectedItemTemplate) {
100
+ <ng-template let-item pTemplate="selectedItem">
101
+ <ng-container [ngTemplateOutletContext]="{ $implicit: item }" [ngTemplateOutlet]="selectedItemTemplate" />
102
+ </ng-template>
103
+ }
104
+ </p-select>
105
+ <label [for]="inputId">
106
+ {{ label }}
107
+ @if (required) {
108
+ <span [class.text-required]="required">*</span>
109
+ }
110
+ </label>
111
+ </p-floatLabel>
112
+ }
113
+
114
+ @if (hint) {
115
+ <small class="p-mt-1">{{ hint }}</small>
116
+ } @if (isInvalid && (control.dirty || control.touched)) {
117
+ <small class="p-error">
118
+ @for (error of control.errors | validationErrors; track error) {
119
+ {{ error }}<br />
120
+ }
121
+ </small>
122
+ }
123
+ </div>
@@ -0,0 +1,53 @@
1
+ textarea,
2
+ .p-select {
3
+ border-radius: 0;
4
+ border-color: #DFE0E6;
5
+
6
+ &:enabled {
7
+ &:hover {
8
+ border-color: #DFE0E6;
9
+ }
10
+ }
11
+
12
+ &:not(.p-disabled).p-focus,
13
+ &:not(.p-disabled).p-focus:hover,
14
+ &:focus {
15
+ outline: #DFE0E6;
16
+ border-color: #DFE0E6;
17
+ }
18
+ }
19
+ .p-floatlabel:has(input:focus) label,
20
+ .p-floatlabel:has(input:-webkit-autofill) label,
21
+ .p-floatlabel:has(textarea:focus) label,
22
+ .p-floatlabel:has(.p-inputwrapper-focus) label {
23
+ color: #687078;
24
+
25
+ }
26
+ .p-inputtext:enabled:focus {
27
+ border-color: #DFE0E6 ;
28
+ }
29
+ .p-select {
30
+ .p-select-label {
31
+ padding-block-end: 1rem !important;
32
+ padding-block-start: 1rem !important;
33
+ }
34
+ }
35
+
36
+ .text-required {
37
+ color: red;
38
+ }
39
+
40
+ .p-error {
41
+ color: #dc2626;
42
+ }
43
+ .edit-search {
44
+ .p-select-label {
45
+ padding: 1rem 1rem 1rem 2.2rem !important;
46
+ }
47
+ .p-floatlabel {
48
+ >label {
49
+ padding-inline-start: 25px;
50
+ }
51
+ }
52
+ }
53
+
@@ -0,0 +1,21 @@
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
+ });
@@ -0,0 +1,87 @@
1
+ import { NgClass, NgTemplateOutlet } from '@angular/common';
2
+ import {
3
+ Component,
4
+ EventEmitter,
5
+ Input,
6
+ Output,
7
+ TemplateRef,
8
+ ViewEncapsulation,
9
+ } from '@angular/core';
10
+ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
11
+ import { TranslatePipe } from '@ngx-translate/core';
12
+ import { PrimeTemplate } from 'primeng/api';
13
+ import { FloatLabelModule } from 'primeng/floatlabel';
14
+ import { MultiSelectModule } from 'primeng/multiselect';
15
+ import { Select, SelectChangeEvent } from 'primeng/select';
16
+ import { ValidationErrorsPipe } from '../../@utils/validations';
17
+ import { BaseInputComponent } from '../base-input.component';
18
+ import { CheckboxModule } from 'primeng/checkbox';
19
+
20
+ @Component({
21
+ selector: 'stc-select',
22
+ standalone: true,
23
+ imports: [
24
+ FormsModule,
25
+ Select,
26
+ ReactiveFormsModule,
27
+ NgClass,
28
+ NgTemplateOutlet,
29
+ PrimeTemplate,
30
+ ValidationErrorsPipe,
31
+ MultiSelectModule,
32
+ FloatLabelModule,
33
+ TranslatePipe,
34
+ CheckboxModule,
35
+ ],
36
+ templateUrl: './select.component.html',
37
+ styleUrl: './select.component.scss',
38
+ encapsulation: ViewEncapsulation.None,
39
+ })
40
+ export class SelectComponent extends BaseInputComponent {
41
+ @Input() selectedItemTemplate: TemplateRef<unknown> | null = null;
42
+ @Input() optionTemplate: TemplateRef<unknown> | null = null;
43
+ @Input() options: unknown[] = [];
44
+ @Input() optionLabel!: string;
45
+ @Input() optionValue!: string;
46
+ @Input() emptyMessage!: string;
47
+ @Input() checkmark = true;
48
+ @Input() showClear = false;
49
+ @Input() editable = false;
50
+ @Input() filter = false;
51
+ @Input() multiple = false;
52
+ @Input() filterBy!: string;
53
+ @Input() selectAllLabel: string;
54
+ @Input() dataKey!: string;
55
+ @Input() size: 'small' | 'large' = 'small';
56
+
57
+ @Input() selectedItemsLabel!: string;
58
+ @Input() basicInput!: boolean;
59
+ @Input() variant: 'in' | 'over' | 'on' = 'over';
60
+ // eslint-disable-next-line @angular-eslint/no-output-native
61
+ @Output() change = new EventEmitter();
62
+ @Input() defaultColor = '#DFE0E6';
63
+ allSelectd = false;
64
+
65
+ constructor() {
66
+ super();
67
+ }
68
+
69
+ toggleAll(event: any) {
70
+ if (!event.checked) {
71
+ this.control.setValue([]);
72
+ return;
73
+ }
74
+ const values = this.optionValue
75
+ ? this.options.map((o) => (o as Record<string, unknown>)[this.optionValue as string])
76
+ : this.options;
77
+ this.control.setValue([...values]);
78
+ }
79
+
80
+ onMultiSelectClear() {
81
+ this.allSelectd = false;
82
+ }
83
+
84
+ onChange(e: SelectChangeEvent) {
85
+ this.change.emit(e);
86
+ }
87
+ }
@@ -0,0 +1,21 @@
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>
@@ -0,0 +1,21 @@
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
+ });
@@ -0,0 +1,22 @@
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
+ }
@@ -0,0 +1,5 @@
1
+ <div class="flex items-center mr-2">
2
+ <p-toggleswitch [(ngModel)]="checked" [inputId]="key" (onChange)="sendUpdatedValue($event)" class="flex">
3
+ </p-toggleswitch>
4
+ <label [for]="key" class="text-[12px] mx-2">{{label}}</label>
5
+ </div>
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from "@angular/core/testing";
2
+ import { SwitchComponent } from "./switch.component";
3
+
4
+ describe("SwitchComponent", () => {
5
+ let component: SwitchComponent;
6
+ let fixture: ComponentFixture<SwitchComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [SwitchComponent]
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(SwitchComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it("should create", () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,25 @@
1
+ import { Component, EventEmitter, Input, Output } from "@angular/core";
2
+ import { CommonModule } from "@angular/common";
3
+ import { ToggleSwitchModule } from 'primeng/toggleswitch';
4
+ import { FormsModule } from "@angular/forms";
5
+
6
+ @Component({
7
+ selector: "stc-switch",
8
+ standalone: true,
9
+ imports: [CommonModule, ToggleSwitchModule, FormsModule],
10
+ templateUrl: "./switch.component.html",
11
+ styleUrl: "./switch.component.scss"
12
+ })
13
+ export class SwitchComponent {
14
+ @Input() label: string;
15
+ @Input() key: string;
16
+ @Input() checked: boolean = false;
17
+ @Output() onChange: EventEmitter<string> = new EventEmitter<string>();
18
+ // checked: boolean = false;
19
+
20
+ sendUpdatedValue(value: any) {
21
+ if (value) {
22
+ this.onChange.emit(value.checked);
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,9 @@
1
+ export * from './@utils/form-utils';
2
+ export * from './@utils/validations';
3
+ export * from './components/auto-complete/auto-complete.component';
4
+ export * from './components/date-picker/date-picker.component';
5
+ export * from './components/input/input.component';
6
+ export * from './components/select-button/select-button.component';
7
+ export * from './components/select/select.component';
8
+ export * from './components/switcher/switch.component';
9
+ export * from './interfaces';
@@ -0,0 +1 @@
1
+ export * from "./label-value";
@@ -0,0 +1,4 @@
1
+ export interface LabelValue<T> {
2
+ label: string;
3
+ value: T | any;
4
+ }
@@ -0,0 +1,23 @@
1
+ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'app-ico-moon-card',
5
+ standalone: true,
6
+ template:`
7
+ <i [class]="iconName + ' ' + iconClass">
8
+ @for (path of getPathCount; track $index) {
9
+ <i [class]="iconName + ' path'+path"></i>
10
+ }
11
+ </i>
12
+ `,
13
+ changeDetection: ChangeDetectionStrategy.OnPush
14
+ })
15
+ export class IcoMoonIconComponent {
16
+ @Input({ required: true }) iconName!: string;
17
+ @Input() iconClass!: string;
18
+ @Input() iconPathCount = 0;
19
+
20
+ get getPathCount() {
21
+ return Array.from({ length: this.iconPathCount }, (_, i) => i + 1);
22
+ }
23
+ }