ghocomps 1.1.25 → 1.3.25

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.
@@ -0,0 +1,811 @@
1
+ import * as i1 from '@angular/common';
2
+ import { CommonModule, DatePipe } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { EventEmitter, HostListener, Output, Input, ChangeDetectionStrategy, Component, forwardRef } from '@angular/core';
5
+ import * as i2 from '@angular/forms';
6
+ import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
7
+ import { MatCardModule } from '@angular/material/card';
8
+ import { MatCalendar, MatDatepickerModule } from '@angular/material/datepicker';
9
+ import { provideNativeDateAdapter } from '@angular/material/core';
10
+
11
+ class GHOdropdown {
12
+ el;
13
+ cdr;
14
+ ngZone;
15
+ constructor(el, cdr, ngZone) {
16
+ this.el = el;
17
+ this.cdr = cdr;
18
+ this.ngZone = ngZone;
19
+ }
20
+ options = [];
21
+ placeholder = 'Select an option';
22
+ showclear = true;
23
+ appearance = "outline";
24
+ label = "";
25
+ filter = true;
26
+ listdata = [];
27
+ isOpen = false;
28
+ selectedtxt = "";
29
+ sharedValue = '';
30
+ sharedValueChange = new EventEmitter();
31
+ selectionchange = new EventEmitter();
32
+ onModelChange(v) {
33
+ this.sharedValue = v;
34
+ this.sharedValueChange.emit(v);
35
+ this.setlabel();
36
+ }
37
+ setlabel() {
38
+ if (this.listdata.length > 0) {
39
+ for (let i = 0; i < this.listdata.length; i++) {
40
+ if (this.sharedValue && this.listdata[i].value.toString() == this.sharedValue.toString()) {
41
+ this.selectedtxt = this.listdata[i].label;
42
+ break;
43
+ }
44
+ else {
45
+ this.selectedtxt = this.label;
46
+ }
47
+ }
48
+ }
49
+ else {
50
+ this.selectedtxt = this.label;
51
+ }
52
+ }
53
+ ngOnChanges(changes) {
54
+ if (changes['options']) {
55
+ this.listdata = [];
56
+ debugger;
57
+ const allKeys = Array.from(new Set(this.options.flatMap(item => Object.keys(item))));
58
+ for (let i = 0; i < this.options.length; i++) {
59
+ if (allKeys.length == 1) {
60
+ this.listdata.push({ label: this.options[i][allKeys[0]], value: this.options[i][allKeys[0]] });
61
+ }
62
+ else {
63
+ this.listdata.push({ label: this.options[i][allKeys[1]], value: this.options[i][allKeys[0]] });
64
+ }
65
+ }
66
+ this.setlabel();
67
+ }
68
+ if (changes['sharedValue']) {
69
+ this.setlabel();
70
+ }
71
+ }
72
+ toggleDropdown() {
73
+ this.isOpen = !this.isOpen;
74
+ }
75
+ clear() {
76
+ this.onModelChange("");
77
+ this.isOpen = false;
78
+ }
79
+ closeDropdown() {
80
+ this.isOpen = false;
81
+ }
82
+ onSelectionChange(v) {
83
+ this.isOpen = false;
84
+ this.onModelChange(v.value);
85
+ this.selectionchange.emit(v);
86
+ }
87
+ datavalid() {
88
+ if (this.label != this.selectedtxt) {
89
+ return true;
90
+ }
91
+ if (this.label == this.selectedtxt) {
92
+ return false;
93
+ }
94
+ return false;
95
+ }
96
+ onOutsideClick(event) {
97
+ if (!this.el.nativeElement.contains(event.target)) {
98
+ this.isOpen = false;
99
+ }
100
+ }
101
+ getclearclass() {
102
+ if (this.appearance == "outline") {
103
+ if (this.datavalid() && this.showclear) {
104
+ return "input-outline-filter-img";
105
+ }
106
+ }
107
+ else {
108
+ return "input-mat-img ";
109
+ }
110
+ return "input-mat";
111
+ }
112
+ getclass() {
113
+ if (this.appearance == "outline") {
114
+ let css = " d-flex gap-3";
115
+ if (!this.filter) {
116
+ css = "input-outline";
117
+ }
118
+ if (this.filter) {
119
+ if (!this.datavalid()) {
120
+ css = "input-outline";
121
+ }
122
+ }
123
+ if (this.filter) {
124
+ if (this.datavalid()) {
125
+ css = "input-outline-filter ";
126
+ }
127
+ }
128
+ if (!this.showclear) {
129
+ css = "input-outline";
130
+ }
131
+ return css + " input d-flex gap-3 ";
132
+ }
133
+ else {
134
+ return "input-mat d-flex gap-3 ";
135
+ }
136
+ }
137
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: GHOdropdown, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
138
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: GHOdropdown, isStandalone: true, selector: "gho-dropdown", inputs: { options: "options", placeholder: "placeholder", showclear: "showclear", appearance: "appearance", label: "label", filter: "filter", sharedValue: "sharedValue" }, outputs: { sharedValueChange: "sharedValueChange", selectionchange: "selectionchange" }, host: { listeners: { "document:click": "onOutsideClick($event)" } }, usesOnChanges: true, ngImport: i0, template: `
139
+ <div style="height: 55px !important;">
140
+ <div style="height: 18px !important;">
141
+ @if(datavalid())
142
+ {
143
+ <div [ngStyle]="{ margin: '-3px 5px' }" class="input-label">{{label}}
144
+ </div>
145
+ }
146
+ </div>
147
+ <table>
148
+ <tr>
149
+ <td>
150
+ <div (click)="toggleDropdown()" [ngClass]="getclass()">
151
+ <span>{{selectedtxt}}</span>
152
+ <i class="bi bi-caret-down-fill arrow-icon" [class.rotate]="isOpen"></i>
153
+ </div>
154
+ </td>
155
+ @if(filter && datavalid() )
156
+ {
157
+ <td>
158
+ <div (click)="clear()" [ngClass]="getclearclass()">
159
+ <i class="bi bi-x-lg "></i>
160
+ </div>
161
+ </td> }
162
+ </tr>
163
+ </table>
164
+ </div>
165
+ @if(isOpen){
166
+ <div class="dropdown-menu show ">
167
+ <div class="list-panel">
168
+ @for (dlitem of listdata; track dlitem) {
169
+ <div class="list-item " (click)="onSelectionChange(dlitem)" [class.list-item-selected]="dlitem.value == sharedValue">
170
+ <table class="w100">
171
+ <tr>
172
+ <td>
173
+ {{ dlitem.label }}
174
+ </td>
175
+ @if(dlitem.value == sharedValue){
176
+ <td class="right" style="width:30px;"> <i class="bi bi-check2"></i> </td>}
177
+ </tr>
178
+ </table>
179
+ </div>
180
+ }
181
+ </div>
182
+ <table class=w100>
183
+ <tr class="bt ">
184
+ <td class="p10" (click)="clear()"><span matButton class="ghoddl-btn "> Clear </span> </td>
185
+ <td class="p10" (click)="closeDropdown()"><span matButton class="ghoddl-btn "> Cancel </span> </td>
186
+ </tr>
187
+ </table>
188
+ </div>
189
+ }
190
+ `, isInline: true, styles: [".input{cursor:pointer;border:1px solid #7c7b7bdf;padding:5px!important}.input-label{background-color:transparent;position:inherit;color:#202020;font-size:12px;padding-left:5px}input:focus{border:1px solid #7c7b7bdf;outline:none}.input:hover{background:var(--hover)}.input-outline{border-radius:5px!important}.input-outline-filter{border-top-left-radius:5px!important;border-bottom-left-radius:5px!important;background:var(--filter)}.input-filter{background:var(--filter)}.input-outline-filter-img{padding:5px!important;border-top-right-radius:5px!important;border-bottom-right-radius:5px!important;background:var(--filter);border:1px solid #7c7b7bdf;cursor:pointer}.input-mat,.input-mat-img{border-bottom:1px solid #7c7b7bdf;padding:5px!important;cursor:pointer}.list-item{padding:5px 12px;cursor:pointer;font-size:14px}.filterd{background-color:var(--selected);font-weight:400;cursor:pointer}.list-item-selected{color:var(--primary);font-weight:500}.list-item:hover{background:var(--hover)}.list-panel{background-color:#fff;max-height:400px!important;overflow-y:auto}.arrow-icon{transition:transform .2s ease}.arrow-icon.rotate{transform:rotate(180deg)}.date-dropdown{min-width:280px;padding:0;border:none;border-radius:10px;transition:min-width .25s ease;overflow:hidden}.date-dropdown.custom-open{min-width:560px}.preset-panel{display:flex;flex-direction:column;background-color:#fff}.preset-item{background:transparent;border:none;text-align:left;padding:10px 14px;font-size:14px;cursor:pointer;border-radius:6px;transition:background-color .15s ease}.preset-item:hover{background-color:#f1f3f5}.clear-item{color:#e63f3f;margin-top:6px}.custom-panel{background-color:#fff;border-top:1px solid #dee2e6}@media (min-width: 992px){.custom-panel{border-top:none;border-left:1px solid #dee2e6}}.form-label{font-size:12px;font-weight:500;color:#6c757d}.form-control{font-size:14px;padding:6px 10px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
191
+ }
192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: GHOdropdown, decorators: [{
193
+ type: Component,
194
+ args: [{ selector: 'gho-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, FormsModule], template: `
195
+ <div style="height: 55px !important;">
196
+ <div style="height: 18px !important;">
197
+ @if(datavalid())
198
+ {
199
+ <div [ngStyle]="{ margin: '-3px 5px' }" class="input-label">{{label}}
200
+ </div>
201
+ }
202
+ </div>
203
+ <table>
204
+ <tr>
205
+ <td>
206
+ <div (click)="toggleDropdown()" [ngClass]="getclass()">
207
+ <span>{{selectedtxt}}</span>
208
+ <i class="bi bi-caret-down-fill arrow-icon" [class.rotate]="isOpen"></i>
209
+ </div>
210
+ </td>
211
+ @if(filter && datavalid() )
212
+ {
213
+ <td>
214
+ <div (click)="clear()" [ngClass]="getclearclass()">
215
+ <i class="bi bi-x-lg "></i>
216
+ </div>
217
+ </td> }
218
+ </tr>
219
+ </table>
220
+ </div>
221
+ @if(isOpen){
222
+ <div class="dropdown-menu show ">
223
+ <div class="list-panel">
224
+ @for (dlitem of listdata; track dlitem) {
225
+ <div class="list-item " (click)="onSelectionChange(dlitem)" [class.list-item-selected]="dlitem.value == sharedValue">
226
+ <table class="w100">
227
+ <tr>
228
+ <td>
229
+ {{ dlitem.label }}
230
+ </td>
231
+ @if(dlitem.value == sharedValue){
232
+ <td class="right" style="width:30px;"> <i class="bi bi-check2"></i> </td>}
233
+ </tr>
234
+ </table>
235
+ </div>
236
+ }
237
+ </div>
238
+ <table class=w100>
239
+ <tr class="bt ">
240
+ <td class="p10" (click)="clear()"><span matButton class="ghoddl-btn "> Clear </span> </td>
241
+ <td class="p10" (click)="closeDropdown()"><span matButton class="ghoddl-btn "> Cancel </span> </td>
242
+ </tr>
243
+ </table>
244
+ </div>
245
+ }
246
+ `, styles: [".input{cursor:pointer;border:1px solid #7c7b7bdf;padding:5px!important}.input-label{background-color:transparent;position:inherit;color:#202020;font-size:12px;padding-left:5px}input:focus{border:1px solid #7c7b7bdf;outline:none}.input:hover{background:var(--hover)}.input-outline{border-radius:5px!important}.input-outline-filter{border-top-left-radius:5px!important;border-bottom-left-radius:5px!important;background:var(--filter)}.input-filter{background:var(--filter)}.input-outline-filter-img{padding:5px!important;border-top-right-radius:5px!important;border-bottom-right-radius:5px!important;background:var(--filter);border:1px solid #7c7b7bdf;cursor:pointer}.input-mat,.input-mat-img{border-bottom:1px solid #7c7b7bdf;padding:5px!important;cursor:pointer}.list-item{padding:5px 12px;cursor:pointer;font-size:14px}.filterd{background-color:var(--selected);font-weight:400;cursor:pointer}.list-item-selected{color:var(--primary);font-weight:500}.list-item:hover{background:var(--hover)}.list-panel{background-color:#fff;max-height:400px!important;overflow-y:auto}.arrow-icon{transition:transform .2s ease}.arrow-icon.rotate{transform:rotate(180deg)}.date-dropdown{min-width:280px;padding:0;border:none;border-radius:10px;transition:min-width .25s ease;overflow:hidden}.date-dropdown.custom-open{min-width:560px}.preset-panel{display:flex;flex-direction:column;background-color:#fff}.preset-item{background:transparent;border:none;text-align:left;padding:10px 14px;font-size:14px;cursor:pointer;border-radius:6px;transition:background-color .15s ease}.preset-item:hover{background-color:#f1f3f5}.clear-item{color:#e63f3f;margin-top:6px}.custom-panel{background-color:#fff;border-top:1px solid #dee2e6}@media (min-width: 992px){.custom-panel{border-top:none;border-left:1px solid #dee2e6}}.form-label{font-size:12px;font-weight:500;color:#6c757d}.form-control{font-size:14px;padding:6px 10px}\n"] }]
247
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }], propDecorators: { options: [{
248
+ type: Input
249
+ }], placeholder: [{
250
+ type: Input
251
+ }], showclear: [{
252
+ type: Input
253
+ }], appearance: [{
254
+ type: Input
255
+ }], label: [{
256
+ type: Input
257
+ }], filter: [{
258
+ type: Input
259
+ }], sharedValue: [{
260
+ type: Input
261
+ }], sharedValueChange: [{
262
+ type: Output
263
+ }], selectionchange: [{
264
+ type: Output
265
+ }], onOutsideClick: [{
266
+ type: HostListener,
267
+ args: ['document:click', ['$event']]
268
+ }] } });
269
+
270
+ class GHOInput {
271
+ el;
272
+ cdr;
273
+ datePipe;
274
+ constructor(el, cdr, datePipe) {
275
+ this.el = el;
276
+ this.cdr = cdr;
277
+ this.datePipe = datePipe;
278
+ }
279
+ list = [];
280
+ label = "";
281
+ appearance = "outline";
282
+ filter = false;
283
+ showclear = false;
284
+ placeholder = "";
285
+ sharedValue = '';
286
+ sharedValueChange = new EventEmitter();
287
+ onInput(event) {
288
+ this.sharedValue = event.target.value;
289
+ this.sharedValueChange.emit(this.sharedValue);
290
+ this.setlabel();
291
+ }
292
+ clear() {
293
+ this.sharedValue = "";
294
+ this.sharedValueChange.emit(this.sharedValue);
295
+ this.setlabel();
296
+ }
297
+ setlabel() {
298
+ if (this.sharedValue.length > 0) {
299
+ this.placeholder = "";
300
+ }
301
+ else {
302
+ this.placeholder = this.label;
303
+ }
304
+ }
305
+ ngOnChanges(changes) {
306
+ if (changes['sharedValue']) {
307
+ this.setlabel();
308
+ }
309
+ }
310
+ getclass() {
311
+ if (this.appearance == "outline") {
312
+ let css = " d-flex gap-3";
313
+ if (!this.filter) {
314
+ css = "input-outline";
315
+ }
316
+ if (this.filter) {
317
+ if (!this.datavalid()) {
318
+ css = "input-outline";
319
+ }
320
+ }
321
+ if (this.filter) {
322
+ if (this.datavalid() && this.showclear) {
323
+ css = "input-outline-filter input-filter";
324
+ }
325
+ }
326
+ if (this.filter) {
327
+ if (this.datavalid() && !this.showclear) {
328
+ css = "input-outline input-filter ";
329
+ }
330
+ }
331
+ if (!this.showclear) {
332
+ css = "input-outline";
333
+ }
334
+ return css + " input";
335
+ }
336
+ else {
337
+ return "input-mat d-flex gap-3 ";
338
+ }
339
+ }
340
+ getclearclass() {
341
+ if (this.appearance == "outline") {
342
+ if (this.datavalid() && this.showclear) {
343
+ return "input-outline-filter-img";
344
+ }
345
+ }
346
+ else {
347
+ return "input-mat-img ";
348
+ }
349
+ return "input-mat";
350
+ }
351
+ datavalid() {
352
+ if (this.placeholder == this.label) {
353
+ return false;
354
+ }
355
+ else {
356
+ return true;
357
+ }
358
+ }
359
+ ngOnInit() {
360
+ }
361
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: GHOInput, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.DatePipe }], target: i0.ɵɵFactoryTarget.Component });
362
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: GHOInput, isStandalone: true, selector: "gho-input", inputs: { list: "list", label: "label", appearance: "appearance", filter: "filter", showclear: "showclear", sharedValue: "sharedValue" }, outputs: { sharedValueChange: "sharedValueChange" }, providers: [DatePipe], usesOnChanges: true, ngImport: i0, template: `<div style="height: 55px !important;">
363
+ <div style="height: 18px !important;">
364
+ @if(datavalid())
365
+ {
366
+ <div [ngStyle]="{ margin: '-2px 5px' }" class="input-label">{{label}}
367
+ </div>
368
+ }
369
+
370
+ </div>
371
+ <div >
372
+ <table>
373
+ <tr>
374
+ <td> <input type="text" [placeholder]="placeholder" [ngModel]="sharedValue" (input)="onInput($event)"
375
+ [ngClass]="getclass()"></td>
376
+ @if(filter && datavalid() )
377
+ {
378
+ <td>
379
+ <div (click)="clear()" [ngClass]="getclearclass()">
380
+ <i class="bi bi-x-lg "></i>
381
+ </div>
382
+ </td> }
383
+ </tr>
384
+ </table>
385
+ </div>
386
+ </div>`, isInline: true, styles: [".input{cursor:pointer;border:1px solid #7c7b7bdf;padding:5px!important}.input-label{background-color:transparent;position:inherit;color:#202020;font-size:12px;padding-left:5px}input:focus{border:1px solid #7c7b7bdf;outline:none}.input:hover{background:var(--hover)}.input-outline{border-radius:5px!important}.input-outline-filter{border-top-left-radius:5px!important;border-bottom-left-radius:5px!important;background:var(--filter)}.input-filter{background:var(--filter)}.input-outline-filter-img{padding:5px!important;border-top-right-radius:5px!important;border-bottom-right-radius:5px!important;background:var(--filter);border:1px solid #7c7b7bdf;cursor:pointer}.input-mat,.input-mat-img{border-bottom:1px solid #7c7b7bdf;padding:5px!important;cursor:pointer}.list-item{padding:5px 12px;cursor:pointer;font-size:14px}.filterd{background-color:var(--selected);font-weight:400;cursor:pointer}.list-item-selected{color:var(--primary);font-weight:500}.list-item:hover{background:var(--hover)}.list-panel{background-color:#fff;max-height:400px!important;overflow-y:auto}.arrow-icon{transition:transform .2s ease}.arrow-icon.rotate{transform:rotate(180deg)}.date-dropdown{min-width:280px;padding:0;border:none;border-radius:10px;transition:min-width .25s ease;overflow:hidden}.date-dropdown.custom-open{min-width:560px}.preset-panel{display:flex;flex-direction:column;background-color:#fff}.preset-item{background:transparent;border:none;text-align:left;padding:10px 14px;font-size:14px;cursor:pointer;border-radius:6px;transition:background-color .15s ease}.preset-item:hover{background-color:#f1f3f5}.clear-item{color:#e63f3f;margin-top:6px}.custom-panel{background-color:#fff;border-top:1px solid #dee2e6}@media (min-width: 992px){.custom-panel{border-top:none;border-left:1px solid #dee2e6}}.form-label{font-size:12px;font-weight:500;color:#6c757d}.form-control{font-size:14px;padding:6px 10px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
387
+ }
388
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: GHOInput, decorators: [{
389
+ type: Component,
390
+ args: [{ selector: 'gho-input', standalone: true, imports: [CommonModule, FormsModule,], template: `<div style="height: 55px !important;">
391
+ <div style="height: 18px !important;">
392
+ @if(datavalid())
393
+ {
394
+ <div [ngStyle]="{ margin: '-2px 5px' }" class="input-label">{{label}}
395
+ </div>
396
+ }
397
+
398
+ </div>
399
+ <div >
400
+ <table>
401
+ <tr>
402
+ <td> <input type="text" [placeholder]="placeholder" [ngModel]="sharedValue" (input)="onInput($event)"
403
+ [ngClass]="getclass()"></td>
404
+ @if(filter && datavalid() )
405
+ {
406
+ <td>
407
+ <div (click)="clear()" [ngClass]="getclearclass()">
408
+ <i class="bi bi-x-lg "></i>
409
+ </div>
410
+ </td> }
411
+ </tr>
412
+ </table>
413
+ </div>
414
+ </div>`, providers: [DatePipe], changeDetection: ChangeDetectionStrategy.OnPush, styles: [".input{cursor:pointer;border:1px solid #7c7b7bdf;padding:5px!important}.input-label{background-color:transparent;position:inherit;color:#202020;font-size:12px;padding-left:5px}input:focus{border:1px solid #7c7b7bdf;outline:none}.input:hover{background:var(--hover)}.input-outline{border-radius:5px!important}.input-outline-filter{border-top-left-radius:5px!important;border-bottom-left-radius:5px!important;background:var(--filter)}.input-filter{background:var(--filter)}.input-outline-filter-img{padding:5px!important;border-top-right-radius:5px!important;border-bottom-right-radius:5px!important;background:var(--filter);border:1px solid #7c7b7bdf;cursor:pointer}.input-mat,.input-mat-img{border-bottom:1px solid #7c7b7bdf;padding:5px!important;cursor:pointer}.list-item{padding:5px 12px;cursor:pointer;font-size:14px}.filterd{background-color:var(--selected);font-weight:400;cursor:pointer}.list-item-selected{color:var(--primary);font-weight:500}.list-item:hover{background:var(--hover)}.list-panel{background-color:#fff;max-height:400px!important;overflow-y:auto}.arrow-icon{transition:transform .2s ease}.arrow-icon.rotate{transform:rotate(180deg)}.date-dropdown{min-width:280px;padding:0;border:none;border-radius:10px;transition:min-width .25s ease;overflow:hidden}.date-dropdown.custom-open{min-width:560px}.preset-panel{display:flex;flex-direction:column;background-color:#fff}.preset-item{background:transparent;border:none;text-align:left;padding:10px 14px;font-size:14px;cursor:pointer;border-radius:6px;transition:background-color .15s ease}.preset-item:hover{background-color:#f1f3f5}.clear-item{color:#e63f3f;margin-top:6px}.custom-panel{background-color:#fff;border-top:1px solid #dee2e6}@media (min-width: 992px){.custom-panel{border-top:none;border-left:1px solid #dee2e6}}.form-label{font-size:12px;font-weight:500;color:#6c757d}.form-control{font-size:14px;padding:6px 10px}\n"] }]
415
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.DatePipe }], propDecorators: { list: [{
416
+ type: Input
417
+ }], label: [{
418
+ type: Input
419
+ }], appearance: [{
420
+ type: Input
421
+ }], filter: [{
422
+ type: Input
423
+ }], showclear: [{
424
+ type: Input
425
+ }], sharedValue: [{
426
+ type: Input
427
+ }], sharedValueChange: [{
428
+ type: Output
429
+ }] } });
430
+
431
+ class GHODate {
432
+ el;
433
+ cdr;
434
+ datePipe;
435
+ constructor(el, cdr, datePipe) {
436
+ this.el = el;
437
+ this.cdr = cdr;
438
+ this.datePipe = datePipe;
439
+ }
440
+ options = [];
441
+ placeholder = 'Select an option';
442
+ showclear = true;
443
+ appearance = "outline";
444
+ label = "";
445
+ filter = true;
446
+ value = "";
447
+ disabled = false;
448
+ listdata = [];
449
+ isOpen = false;
450
+ selectedtxt = "";
451
+ days = [];
452
+ years = [];
453
+ months = [];
454
+ currentYear = new Date().getFullYear();
455
+ d;
456
+ m;
457
+ y;
458
+ // Writes a new value to the element
459
+ writeValue(value) {
460
+ this.value = value;
461
+ if (this.value !== undefined && this.value !== null) {
462
+ const date = new Date(value);
463
+ if (!date) {
464
+ this.d = null;
465
+ this.m = null;
466
+ this.y = null;
467
+ }
468
+ else {
469
+ const formatted = this.datePipe.transform(date, 'MM/dd/yyyy');
470
+ if (formatted !== undefined && formatted !== null) {
471
+ const [month, day, year] = formatted.split('/').map(Number);
472
+ this.m = month,
473
+ this.y = year;
474
+ this.d = day;
475
+ }
476
+ }
477
+ }
478
+ }
479
+ onmodelchange(e, t) {
480
+ if (t == "d") {
481
+ this.d = e.value;
482
+ }
483
+ if (t == "m") {
484
+ this.m = e.value;
485
+ }
486
+ if (t == "y") {
487
+ this.y = e.value;
488
+ }
489
+ this.setdt();
490
+ }
491
+ ngOnInit() {
492
+ this.populateYears();
493
+ this.populateMonths();
494
+ this.populateDays(31);
495
+ }
496
+ setdt() {
497
+ if (this.d == 0 || this.m == 0 || this.y == 0) {
498
+ this.value = "";
499
+ }
500
+ else {
501
+ this.value = this.m + " - " + this.d + " - " + this.y;
502
+ }
503
+ this.onChange(this.value);
504
+ this.onTouched();
505
+ }
506
+ onDateChangeFromCalender(date) {
507
+ if (!date)
508
+ return;
509
+ const formatted = this.datePipe.transform(date, 'MM/dd/yyyy');
510
+ if (formatted !== undefined && formatted !== null) {
511
+ const [month, day, year] = formatted.split('/').map(Number);
512
+ this.m = month,
513
+ this.y = year;
514
+ this.d = day;
515
+ }
516
+ this.setdt();
517
+ this.isOpen = false;
518
+ this.cdr.detectChanges();
519
+ }
520
+ populateMonths() {
521
+ this.months = [
522
+ { value: "1", name: 'January' },
523
+ { value: "2", name: 'February' },
524
+ { value: "3", name: 'March' },
525
+ { value: "4", name: 'April' },
526
+ { value: "5", name: 'May' },
527
+ { value: "6", name: 'June' },
528
+ { value: "7", name: 'July' },
529
+ { value: "8", name: 'August' },
530
+ { value: "9", name: 'September' },
531
+ { value: "10", name: 'October' },
532
+ { value: "11", name: 'November' },
533
+ { value: "12", name: 'December' }
534
+ ];
535
+ }
536
+ populateYears(start = (this.currentYear - 95), end = 1 + new Date().getFullYear()) {
537
+ for (let year = end; year >= start; year--) {
538
+ this.years.push({ value: year.toString() });
539
+ }
540
+ }
541
+ populateDays(start = 1, end = 31) {
542
+ for (let i = 1; i < 32; i++) {
543
+ this.days.push({ value: i.toString() });
544
+ }
545
+ }
546
+ gettxt() {
547
+ if (this.datavalid()) {
548
+ return this.value;
549
+ }
550
+ else {
551
+ return this.label;
552
+ }
553
+ }
554
+ toggleDropdown() {
555
+ this.isOpen = !this.isOpen;
556
+ }
557
+ clear() {
558
+ this.value = "";
559
+ this.onChange(this.value);
560
+ this.onTouched();
561
+ }
562
+ closeDropdown() {
563
+ this.isOpen = false;
564
+ }
565
+ datavalid() {
566
+ if (this.value === undefined || this.value == null || this.value == "" || this.value == "0") {
567
+ return false;
568
+ }
569
+ else {
570
+ return true;
571
+ }
572
+ }
573
+ // Functions to call when the value changes or the control is touched
574
+ onChange = () => { };
575
+ onTouched = () => { };
576
+ // Registers a callback function that is called when the control's value changes in the UI
577
+ registerOnChange(fn) {
578
+ this.isOpen = false;
579
+ this.onChange = fn;
580
+ }
581
+ // Registers a callback function that is called whenever the control receives a touch event
582
+ registerOnTouched(fn) {
583
+ this.onTouched = fn;
584
+ }
585
+ // Sets the disabled state of the control
586
+ setDisabledState(isDisabled) {
587
+ this.disabled = isDisabled;
588
+ }
589
+ onSelectionChange(v) {
590
+ this.isOpen = false;
591
+ this.selectedtxt = v.label;
592
+ const newValue = v.value;
593
+ this.value = newValue;
594
+ this.onChange(newValue); // Notify Angular forms about the change
595
+ this.onTouched(); // Mark the control as touched
596
+ }
597
+ onOutsideClick(event) {
598
+ if (!this.el.nativeElement.contains(event.target)) {
599
+ this.isOpen = false;
600
+ }
601
+ }
602
+ getclearclass() {
603
+ if (this.appearance == "outline") {
604
+ if (this.datavalid() && this.showclear) {
605
+ return "input-outline-filter-img";
606
+ }
607
+ }
608
+ else {
609
+ return "input-mat-img ";
610
+ }
611
+ return "input-mat";
612
+ }
613
+ getclass() {
614
+ if (this.appearance == "outline") {
615
+ let css = " d-flex gap-3";
616
+ if (!this.filter) {
617
+ css = "input-outline";
618
+ }
619
+ if (this.filter) {
620
+ if (!this.datavalid()) {
621
+ css = "input-outline";
622
+ }
623
+ }
624
+ if (this.filter) {
625
+ if (this.datavalid()) {
626
+ css = "input-outline-filter ";
627
+ }
628
+ }
629
+ if (!this.showclear) {
630
+ css = "input-outline";
631
+ }
632
+ return css + " input d-flex gap-3 ";
633
+ }
634
+ else {
635
+ return "input-mat d-flex gap-3 ";
636
+ }
637
+ }
638
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: GHODate, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.DatePipe }], target: i0.ɵɵFactoryTarget.Component });
639
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: GHODate, isStandalone: true, selector: "gho-date", inputs: { options: "options", placeholder: "placeholder", showclear: "showclear", appearance: "appearance", label: "label", filter: "filter" }, host: { listeners: { "document:click": "onOutsideClick($event)" } }, providers: [provideNativeDateAdapter(), DatePipe,
640
+ {
641
+ provide: NG_VALUE_ACCESSOR,
642
+ useExisting: forwardRef(() => GHODate),
643
+ multi: true
644
+ }], ngImport: i0, template: `
645
+ <div style="height: 55px !important;">
646
+ <div style="height: 18px !important;">
647
+ @if(datavalid())
648
+ {
649
+ <div [ngStyle]="{ margin: '-3px 5px' }" class="input-label">{{label}}
650
+ </div>
651
+ }
652
+ </div>
653
+ <table>
654
+ <tr>
655
+ <td>
656
+ <div (click)="toggleDropdown()" [ngClass]="getclass()">
657
+ <span>{{ gettxt()}}</span>
658
+ <i class="bi bi-caret-down-fill arrow-icon" [class.rotate]="isOpen"></i>
659
+ </div>
660
+ </td>
661
+ @if(filter && datavalid() )
662
+ {
663
+ <td>
664
+ <div (click)="clear()" [ngClass]="getclearclass()">
665
+ <i class="bi bi-x-lg "></i>
666
+ </div>
667
+ </td> }
668
+
669
+
670
+ </tr>
671
+ </table>
672
+ </div>
673
+ @if(isOpen){
674
+ <div class="dropdown-menu show">
675
+ <table>
676
+ <tr class="bb">
677
+ <td class="pl10">
678
+ <gho-dropdown [options]="months" [(sharedValue)]="m" (selectionchange)="onmodelchange($event,'m')" [filter]=false
679
+ label="Month"></gho-dropdown>
680
+ </td>
681
+ <td class="">
682
+ <gho-dropdown [options]="days" [(sharedValue)]="d" (selectionchange)="onmodelchange($event,'d')" [filter]=false
683
+ label="Day"></gho-dropdown>
684
+ </td>
685
+ <td class="pr10">
686
+ <gho-dropdown [options]="years" [(sharedValue)]="y" (selectionchange)="onmodelchange($event,'y')" [filter]=false
687
+ label="Year"></gho-dropdown>
688
+
689
+ </td>
690
+
691
+ <td class="pr10 pointer" style="width: 30px; padding-top: 10px;">
692
+ <div (click)="isOpen=false" >
693
+ <i class="bi bi-check2 bold"></i>
694
+ </div>
695
+ </td>
696
+ </tr>
697
+
698
+ <tr>
699
+ <td colspan="5">
700
+ <mat-calendar (selectedChange)="onDateChangeFromCalender($event)">
701
+ </mat-calendar>
702
+ </td>
703
+ </tr>
704
+
705
+ </table>
706
+
707
+ </div>
708
+ }
709
+ `, isInline: true, styles: [".input{cursor:pointer;border:1px solid #7c7b7bdf;padding:5px!important}.input-label{background-color:transparent;position:inherit;color:#202020;font-size:12px;padding-left:5px}input:focus{border:1px solid #7c7b7bdf;outline:none}.input:hover{background:var(--hover)}.input-outline{border-radius:5px!important}.input-outline-filter{border-top-left-radius:5px!important;border-bottom-left-radius:5px!important;background:var(--filter)}.input-filter{background:var(--filter)}.input-outline-filter-img{padding:5px!important;border-top-right-radius:5px!important;border-bottom-right-radius:5px!important;background:var(--filter);border:1px solid #7c7b7bdf;cursor:pointer}.input-mat,.input-mat-img{border-bottom:1px solid #7c7b7bdf;padding:5px!important;cursor:pointer}.list-item{padding:5px 12px;cursor:pointer;font-size:14px}.filterd{background-color:var(--selected);font-weight:400;cursor:pointer}.list-item-selected{color:var(--primary);font-weight:500}.list-item:hover{background:var(--hover)}.list-panel{background-color:#fff;max-height:400px!important;overflow-y:auto}.arrow-icon{transition:transform .2s ease}.arrow-icon.rotate{transform:rotate(180deg)}.date-dropdown{min-width:280px;padding:0;border:none;border-radius:10px;transition:min-width .25s ease;overflow:hidden}.date-dropdown.custom-open{min-width:560px}.preset-panel{display:flex;flex-direction:column;background-color:#fff}.preset-item{background:transparent;border:none;text-align:left;padding:10px 14px;font-size:14px;cursor:pointer;border-radius:6px;transition:background-color .15s ease}.preset-item:hover{background-color:#f1f3f5}.clear-item{color:#e63f3f;margin-top:6px}.custom-panel{background-color:#fff;border-top:1px solid #dee2e6}@media (min-width: 992px){.custom-panel{border-top:none;border-left:1px solid #dee2e6}}.form-label{font-size:12px;font-weight:500;color:#6c757d}.form-control{font-size:14px;padding:6px 10px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: GHOdropdown, selector: "gho-dropdown", inputs: ["options", "placeholder", "showclear", "appearance", "label", "filter", "sharedValue"], outputs: ["sharedValueChange", "selectionchange"] }, { kind: "component", type: MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "ngmodule", type: MatCardModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
710
+ }
711
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: GHODate, decorators: [{
712
+ type: Component,
713
+ args: [{ selector: 'gho-date', standalone: true, imports: [CommonModule, FormsModule, GHOdropdown, MatCalendar, MatDatepickerModule,
714
+ MatCardModule, DatePipe], template: `
715
+ <div style="height: 55px !important;">
716
+ <div style="height: 18px !important;">
717
+ @if(datavalid())
718
+ {
719
+ <div [ngStyle]="{ margin: '-3px 5px' }" class="input-label">{{label}}
720
+ </div>
721
+ }
722
+ </div>
723
+ <table>
724
+ <tr>
725
+ <td>
726
+ <div (click)="toggleDropdown()" [ngClass]="getclass()">
727
+ <span>{{ gettxt()}}</span>
728
+ <i class="bi bi-caret-down-fill arrow-icon" [class.rotate]="isOpen"></i>
729
+ </div>
730
+ </td>
731
+ @if(filter && datavalid() )
732
+ {
733
+ <td>
734
+ <div (click)="clear()" [ngClass]="getclearclass()">
735
+ <i class="bi bi-x-lg "></i>
736
+ </div>
737
+ </td> }
738
+
739
+
740
+ </tr>
741
+ </table>
742
+ </div>
743
+ @if(isOpen){
744
+ <div class="dropdown-menu show">
745
+ <table>
746
+ <tr class="bb">
747
+ <td class="pl10">
748
+ <gho-dropdown [options]="months" [(sharedValue)]="m" (selectionchange)="onmodelchange($event,'m')" [filter]=false
749
+ label="Month"></gho-dropdown>
750
+ </td>
751
+ <td class="">
752
+ <gho-dropdown [options]="days" [(sharedValue)]="d" (selectionchange)="onmodelchange($event,'d')" [filter]=false
753
+ label="Day"></gho-dropdown>
754
+ </td>
755
+ <td class="pr10">
756
+ <gho-dropdown [options]="years" [(sharedValue)]="y" (selectionchange)="onmodelchange($event,'y')" [filter]=false
757
+ label="Year"></gho-dropdown>
758
+
759
+ </td>
760
+
761
+ <td class="pr10 pointer" style="width: 30px; padding-top: 10px;">
762
+ <div (click)="isOpen=false" >
763
+ <i class="bi bi-check2 bold"></i>
764
+ </div>
765
+ </td>
766
+ </tr>
767
+
768
+ <tr>
769
+ <td colspan="5">
770
+ <mat-calendar (selectedChange)="onDateChangeFromCalender($event)">
771
+ </mat-calendar>
772
+ </td>
773
+ </tr>
774
+
775
+ </table>
776
+
777
+ </div>
778
+ }
779
+ `, providers: [provideNativeDateAdapter(), DatePipe,
780
+ {
781
+ provide: NG_VALUE_ACCESSOR,
782
+ useExisting: forwardRef(() => GHODate),
783
+ multi: true
784
+ }], changeDetection: ChangeDetectionStrategy.OnPush, styles: [".input{cursor:pointer;border:1px solid #7c7b7bdf;padding:5px!important}.input-label{background-color:transparent;position:inherit;color:#202020;font-size:12px;padding-left:5px}input:focus{border:1px solid #7c7b7bdf;outline:none}.input:hover{background:var(--hover)}.input-outline{border-radius:5px!important}.input-outline-filter{border-top-left-radius:5px!important;border-bottom-left-radius:5px!important;background:var(--filter)}.input-filter{background:var(--filter)}.input-outline-filter-img{padding:5px!important;border-top-right-radius:5px!important;border-bottom-right-radius:5px!important;background:var(--filter);border:1px solid #7c7b7bdf;cursor:pointer}.input-mat,.input-mat-img{border-bottom:1px solid #7c7b7bdf;padding:5px!important;cursor:pointer}.list-item{padding:5px 12px;cursor:pointer;font-size:14px}.filterd{background-color:var(--selected);font-weight:400;cursor:pointer}.list-item-selected{color:var(--primary);font-weight:500}.list-item:hover{background:var(--hover)}.list-panel{background-color:#fff;max-height:400px!important;overflow-y:auto}.arrow-icon{transition:transform .2s ease}.arrow-icon.rotate{transform:rotate(180deg)}.date-dropdown{min-width:280px;padding:0;border:none;border-radius:10px;transition:min-width .25s ease;overflow:hidden}.date-dropdown.custom-open{min-width:560px}.preset-panel{display:flex;flex-direction:column;background-color:#fff}.preset-item{background:transparent;border:none;text-align:left;padding:10px 14px;font-size:14px;cursor:pointer;border-radius:6px;transition:background-color .15s ease}.preset-item:hover{background-color:#f1f3f5}.clear-item{color:#e63f3f;margin-top:6px}.custom-panel{background-color:#fff;border-top:1px solid #dee2e6}@media (min-width: 992px){.custom-panel{border-top:none;border-left:1px solid #dee2e6}}.form-label{font-size:12px;font-weight:500;color:#6c757d}.form-control{font-size:14px;padding:6px 10px}\n"] }]
785
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.DatePipe }], propDecorators: { options: [{
786
+ type: Input
787
+ }], placeholder: [{
788
+ type: Input
789
+ }], showclear: [{
790
+ type: Input
791
+ }], appearance: [{
792
+ type: Input
793
+ }], label: [{
794
+ type: Input
795
+ }], filter: [{
796
+ type: Input
797
+ }], onOutsideClick: [{
798
+ type: HostListener,
799
+ args: ['document:click', ['$event']]
800
+ }] } });
801
+
802
+ /*
803
+ * Public API Surface of ghocomps
804
+ */
805
+
806
+ /**
807
+ * Generated bundle index. Do not edit.
808
+ */
809
+
810
+ export { GHODate, GHOInput, GHOdropdown };
811
+ //# sourceMappingURL=ghocomps.mjs.map