@jooler/inputs 0.0.55 → 0.0.57

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 (25) hide show
  1. package/esm2022/lib/choose-general-item/choose-general-item.component.mjs +75 -14
  2. package/esm2022/lib/choose-general-item-renderer/choose-general-item-renderer-change-event.interface.mjs +2 -0
  3. package/esm2022/lib/choose-general-item-renderer/choose-general-item-renderer-validation-type.enum.mjs +6 -0
  4. package/esm2022/lib/choose-general-item-renderer/choose-general-item-renderer.component.mjs +112 -18
  5. package/esm2022/lib/formcontrol-validation-msg-for-ng-select.directive.mjs +126 -0
  6. package/esm2022/lib/general-input-renderer/general-input-renderer-change-event.interface.mjs +2 -0
  7. package/esm2022/lib/general-input-renderer/general-input-renderer.component.mjs +36 -23
  8. package/esm2022/lib/inputs.module.mjs +21 -15
  9. package/esm2022/lib/tooltip-msg-error/tooltip-message-type.enum.mjs +8 -0
  10. package/esm2022/lib/tooltip-msg-error/tooltip-msg-error.component.mjs +213 -0
  11. package/esm2022/public-api.mjs +17 -12
  12. package/fesm2022/inputs.mjs +979 -470
  13. package/fesm2022/inputs.mjs.map +1 -1
  14. package/lib/choose-general-item/choose-general-item.component.d.ts +8 -3
  15. package/lib/choose-general-item-renderer/choose-general-item-renderer-change-event.interface.d.ts +9 -0
  16. package/lib/choose-general-item-renderer/choose-general-item-renderer-validation-type.enum.d.ts +4 -0
  17. package/lib/choose-general-item-renderer/choose-general-item-renderer.component.d.ts +19 -4
  18. package/lib/formcontrol-validation-msg-for-ng-select.directive.d.ts +23 -0
  19. package/lib/general-input-renderer/general-input-renderer-change-event.interface.d.ts +6 -0
  20. package/lib/general-input-renderer/general-input-renderer.component.d.ts +9 -4
  21. package/lib/inputs.module.d.ts +9 -7
  22. package/lib/tooltip-msg-error/tooltip-message-type.enum.d.ts +6 -0
  23. package/lib/tooltip-msg-error/tooltip-msg-error.component.d.ts +49 -0
  24. package/package.json +2 -2
  25. package/public-api.d.ts +16 -11
@@ -1,24 +1,98 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, forwardRef, Component, Input, Output, Injectable, Inject, ContentChild, Pipe, Directive, HostListener, NgModule } from '@angular/core';
3
- import * as i2$1 from '@angular/forms';
4
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS, NgModel, FormsModule, ReactiveFormsModule } from '@angular/forms';
2
+ import { EventEmitter, forwardRef, Component, Input, Output, Injectable, Inject, ContentChild, HostListener, Directive, Pipe, NgModule } from '@angular/core';
5
3
  import * as i1 from '@angular/common';
6
4
  import { CurrencyPipe, DecimalPipe, CommonModule } from '@angular/common';
5
+ import * as i2$1 from '@angular/forms';
6
+ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, NgModel, FormsModule, ReactiveFormsModule } from '@angular/forms';
7
7
  import * as i2 from '@ng-select/ng-select';
8
8
  import { NgSelectModule } from '@ng-select/ng-select';
9
9
  import * as i4 from '@jooler/shared-general-components';
10
10
  import { ChipInputType, SharedGeneralComponentsModule } from '@jooler/shared-general-components';
11
- import * as i2$2 from '@fortawesome/angular-fontawesome';
12
- import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
11
+ import { Subject, tap, switchMap, filter } from 'rxjs';
13
12
  import * as i1$1 from '@angular/common/http';
14
13
  import { HttpParams, HttpHeaders } from '@angular/common/http';
15
14
  import * as i2$3 from '@angular/material/dialog';
16
15
  import * as i6 from '@angular/material/card';
17
16
  import * as i1$2 from '@angular/router';
18
17
  import * as i3 from '@angular/material/menu';
18
+ import * as i2$2 from '@fortawesome/angular-fontawesome';
19
+ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
19
20
  import * as i3$1 from '@angular/material/button';
20
21
  import { AppMaterialModule } from '@jooler/app-material';
21
22
 
23
+ class AgGridSelectMixin {
24
+ params;
25
+ key;
26
+ value;
27
+ rowId;
28
+ isEdit;
29
+ index;
30
+ arrayKey = 'entries';
31
+ rowLevelFG;
32
+ width;
33
+ selectedItemId;
34
+ agInit(params) {
35
+ this.initializeRenderer(params);
36
+ }
37
+ initializeRenderer(params) {
38
+ this.params = params;
39
+ this.width = params.width;
40
+ this.key = params.context.createKey(params.columnApi, params.column);
41
+ this.value = params.value;
42
+ this.rowId = params.node.id;
43
+ this.index = params.node.rowIndex;
44
+ if (params.context.arrayKey) {
45
+ this.arrayKey = params.context.arrayKey;
46
+ }
47
+ this.setRowLevelFG();
48
+ }
49
+ setRowLevelFG() {
50
+ this.index = this.params.node.rowIndex;
51
+ let tableFG = this.params.context.formGroup;
52
+ let fa = tableFG.get(this.arrayKey);
53
+ let rowLevelFG = fa.at(this.index);
54
+ this.rowLevelFG = rowLevelFG;
55
+ }
56
+ getFormControl() {
57
+ let fc = this.rowLevelFG.get(this.key);
58
+ return fc;
59
+ }
60
+ updateValue(params, value) {
61
+ this.setRowLevelFG();
62
+ this.getFormControl().setValue(value);
63
+ let rowNode = params.node;
64
+ rowNode.setDataValue(this.key, value);
65
+ }
66
+ // $event here is an object.
67
+ onSelection($event) {
68
+ this.selectedItemId = $event?.id;
69
+ this.updateValue(this.params, $event?.id);
70
+ if (this.params.onSelection instanceof Function) {
71
+ const params = {
72
+ object: $event,
73
+ rowData: this.params.node.data,
74
+ value: $event.id,
75
+ rowNode: this.params.node,
76
+ };
77
+ this.params.onSelection(params);
78
+ }
79
+ }
80
+ onEnumSelected($event) {
81
+ this.updateValue(this.params, $event);
82
+ if (this.params.onSelection instanceof Function) {
83
+ const params = {
84
+ rowData: this.params.node.data,
85
+ value: $event,
86
+ rowNode: this.params.node,
87
+ };
88
+ this.params.onSelection(params);
89
+ }
90
+ }
91
+ refresh(param) {
92
+ return false;
93
+ }
94
+ }
95
+
22
96
  class CustomTheme {
23
97
  static $joolerBlue = [
24
98
  '#e3ecfa',
@@ -405,100 +479,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
405
479
  type: Output
406
480
  }] } });
407
481
 
408
- class ShowTableErrorsComponent {
409
- message;
410
- showDetails;
411
- ngOnInit() {
412
- }
413
- onMouseEnter() {
414
- this.showDetails = true;
415
- }
416
- onMouseLeave() {
417
- this.showDetails = false;
418
- }
419
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ShowTableErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
420
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ShowTableErrorsComponent, selector: "show-table-errors", inputs: { message: "message" }, ngImport: i0, template: "<div (mouseenter)=\"onMouseEnter()\"(mouseleave)=\"onMouseLeave()\" class=\"icon\">\r\n <fa-icon class=\"icon\" icon=\"info-circle\" ></fa-icon>\r\n <span *ngIf=\"message\" class=\"message\"\r\n [ngClass]=\"{'no-details' : !showDetails , 'details': showDetails}\">{{message}}</span>\r\n</div>", styles: [".icon{color:#a80002;cursor:pointer;display:inline-block}.no-details{display:none}.details{display:block;z-index:100;background-color:#ffdbdb;color:#a80002;border-radius:.5rem;border:.1rem solid #A80002;border-left:.5rem solid #A80002;position:fixed;padding:1rem;bottom:45%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$2.FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "classes", "transform", "a11yRole"] }] });
421
- }
422
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ShowTableErrorsComponent, decorators: [{
423
- type: Component,
424
- args: [{ selector: 'show-table-errors', template: "<div (mouseenter)=\"onMouseEnter()\"(mouseleave)=\"onMouseLeave()\" class=\"icon\">\r\n <fa-icon class=\"icon\" icon=\"info-circle\" ></fa-icon>\r\n <span *ngIf=\"message\" class=\"message\"\r\n [ngClass]=\"{'no-details' : !showDetails , 'details': showDetails}\">{{message}}</span>\r\n</div>", styles: [".icon{color:#a80002;cursor:pointer;display:inline-block}.no-details{display:none}.details{display:block;z-index:100;background-color:#ffdbdb;color:#a80002;border-radius:.5rem;border:.1rem solid #A80002;border-left:.5rem solid #A80002;position:fixed;padding:1rem;bottom:45%}\n"] }]
425
- }], propDecorators: { message: [{
426
- type: Input
427
- }] } });
428
-
429
- class AgGridSelectMixin {
430
- params;
431
- key;
432
- value;
433
- rowId;
434
- isEdit;
435
- index;
436
- arrayKey = 'entries';
437
- rowLevelFG;
438
- width;
439
- selectedItemId;
440
- agInit(params) {
441
- this.initializeRenderer(params);
442
- }
443
- initializeRenderer(params) {
444
- this.params = params;
445
- this.width = params.width;
446
- this.key = params.context.createKey(params.columnApi, params.column);
447
- this.value = params.value;
448
- this.rowId = params.node.id;
449
- this.index = params.node.rowIndex;
450
- if (params.context.arrayKey) {
451
- this.arrayKey = params.context.arrayKey;
452
- }
453
- this.setRowLevelFG();
454
- }
455
- setRowLevelFG() {
456
- this.index = this.params.node.rowIndex;
457
- let tableFG = this.params.context.formGroup;
458
- let fa = tableFG.get(this.arrayKey);
459
- let rowLevelFG = fa.at(this.index);
460
- this.rowLevelFG = rowLevelFG;
461
- }
462
- getFormControl() {
463
- let fc = this.rowLevelFG.get(this.key);
464
- return fc;
465
- }
466
- updateValue(params, value) {
467
- this.setRowLevelFG();
468
- this.getFormControl().setValue(value);
469
- let rowNode = params.node;
470
- rowNode.setDataValue(this.key, value);
471
- }
472
- // $event here is an object.
473
- onSelection($event) {
474
- this.selectedItemId = $event?.id;
475
- this.updateValue(this.params, $event?.id);
476
- if (this.params.onSelection instanceof Function) {
477
- const params = {
478
- object: $event,
479
- rowData: this.params.node.data,
480
- value: $event.id,
481
- rowNode: this.params.node,
482
- };
483
- this.params.onSelection(params);
484
- }
485
- }
486
- onEnumSelected($event) {
487
- this.updateValue(this.params, $event);
488
- if (this.params.onSelection instanceof Function) {
489
- const params = {
490
- rowData: this.params.node.data,
491
- value: $event,
492
- rowNode: this.params.node,
493
- };
494
- this.params.onSelection(params);
495
- }
496
- }
497
- refresh(param) {
498
- return false;
499
- }
500
- }
501
-
502
482
  class ChooseEnumRendererComponent extends AgGridSelectMixin {
503
483
  valuesToDisable = [];
504
484
  valuesToHide = [];
@@ -538,6 +518,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
538
518
  args: [{ selector: 'choose-enum-renderer', template: "<div class=\"all\" [ngClass]=\"{ single: !showError, double: showError }\" *ngIf=\"rowLevelFG\" [formGroup]=\"rowLevelFG\">\r\n <choose-enum [clearable]=\"clearable\" [formControlName]=\"key\" [appendTo]=\"'body'\" [label]=\"params.label\"\r\n [labelTextAlign]=\"params.labelTextAlign\" [labelTextFontWeight]=\"params.labelTextFontWeight\"\r\n [labelTextFontSize]=\"params.labelTextFontSize\" [selectedItem]=\"params.value\" [valuesToHide]=\"valuesToHide\"\r\n [valuesToDisable]=\"valuesToDisable\" [isDropdownDisabled]=\"params.isDropdownDisabled\"\r\n [enumChoices]=\"params.enumChoices\" [placeholder]=\"params.placeholder\" [width]=\"params.width\" [isChip]=\"isChip\"\r\n [paddingTop]=\"params.paddingTop\" [customColors]=\"params.customColors\" (change)=\"onEnumSelected($event)\">\r\n </choose-enum>\r\n</div>", styles: [".all{display:grid;gap:.5rem;align-items:center;margin:auto}.single{grid-template-columns:auto}.double{grid-template-columns:auto max-content}\n"] }]
539
519
  }], ctorParameters: function () { return []; } });
540
520
 
521
+ var ChooseItemRendererValidationType;
522
+ (function (ChooseItemRendererValidationType) {
523
+ ChooseItemRendererValidationType[ChooseItemRendererValidationType["NONE"] = 0] = "NONE";
524
+ ChooseItemRendererValidationType[ChooseItemRendererValidationType["ROW_LEVEL_UNIQUE"] = 1] = "ROW_LEVEL_UNIQUE";
525
+ })(ChooseItemRendererValidationType || (ChooseItemRendererValidationType = {}));
526
+
527
+ var ChooseItemFullObjectControlConfig;
528
+ (function (ChooseItemFullObjectControlConfig) {
529
+ ChooseItemFullObjectControlConfig[ChooseItemFullObjectControlConfig["OBJECT"] = 1] = "OBJECT";
530
+ ChooseItemFullObjectControlConfig[ChooseItemFullObjectControlConfig["ID"] = 2] = "ID";
531
+ })(ChooseItemFullObjectControlConfig || (ChooseItemFullObjectControlConfig = {}));
532
+
541
533
  class PrimaryColors {
542
534
  static $primaryBlueColor = '#155ED4';
543
535
  static $primaryPinkColor = '#F0509C';
@@ -565,12 +557,6 @@ var ChooseObjectTemplateType;
565
557
  ChooseObjectTemplateType[ChooseObjectTemplateType["CONTENT_PROJECTION"] = 2] = "CONTENT_PROJECTION";
566
558
  })(ChooseObjectTemplateType || (ChooseObjectTemplateType = {}));
567
559
 
568
- var ChooseItemFullObjectControlConfig;
569
- (function (ChooseItemFullObjectControlConfig) {
570
- ChooseItemFullObjectControlConfig[ChooseItemFullObjectControlConfig["OBJECT"] = 1] = "OBJECT";
571
- ChooseItemFullObjectControlConfig[ChooseItemFullObjectControlConfig["ID"] = 2] = "ID";
572
- })(ChooseItemFullObjectControlConfig || (ChooseItemFullObjectControlConfig = {}));
573
-
574
560
  class DictionaryToHttpParamsConverter {
575
561
  static dictionaryToHttpParamsConverter(form_dictionary) {
576
562
  let queryParams = new HttpParams();
@@ -767,6 +753,8 @@ class ChooseGeneralItemComponent {
767
753
  customOptionTemplate;
768
754
  ChooseObjectTemplateType = ChooseObjectTemplateType;
769
755
  chipInputTypes = ChipInputType;
756
+ fetchTrigger$ = new Subject();
757
+ fetchSub;
770
758
  constructor(_ChooseGeneralItemService, dialog, _cdr) {
771
759
  this._ChooseGeneralItemService = _ChooseGeneralItemService;
772
760
  this.dialog = dialog;
@@ -776,26 +764,78 @@ class ChooseGeneralItemComponent {
776
764
  if (this.templateType == ChooseObjectTemplateType.BASIC) {
777
765
  this.setupBasicTemplate();
778
766
  }
767
+ this.fetchTrigger$
768
+ .pipe(tap(() => (this.isLoading = true)), switchMap(({ apiPath, filterParams }) => this._ChooseGeneralItemService.getData(apiPath, filterParams)))
769
+ .subscribe(data => {
770
+ this.items = data;
771
+ this.isLoading = false;
772
+ console.log("response: items from '", this.apiPath, "' found: ", this.items);
773
+ });
774
+ }
775
+ triggerFetch() {
776
+ this.isLoading = true;
777
+ this.fetchTrigger$.next({
778
+ apiPath: this.apiPath,
779
+ filterParams: this.filterParams,
780
+ });
779
781
  }
780
782
  setupBasicTemplate() { }
781
783
  ngOnChanges(changes) {
782
- if (changes['items'] && !changes.items) {
783
- this.items = undefined;
784
- }
785
- if (changes['apiPath'] && !changes.apiPath) {
786
- this.apiPath = undefined;
787
- }
784
+ // console.log('changes: ', changes);
788
785
  this.validateInputs(changes);
789
786
  if (this.showAdd) {
790
787
  this.validateAddConfiguration();
791
788
  }
792
- if (!changes['items'] || !changes['items'].currentValue) {
793
- this.isLoading = true;
794
- this.getData();
789
+ // 1️⃣ Manually assign input updates immediately
790
+ if (changes['filterParams']) {
791
+ this.filterParams = changes['filterParams'].currentValue;
792
+ }
793
+ // CASE A — apiPath changed and items not provided
794
+ if (changes['apiPath'] && !changes['items']) {
795
+ const newApiPath = changes['apiPath'].currentValue;
796
+ // If apiPath becomes undefined → tear down subscription
797
+ if (!newApiPath) {
798
+ this.cleanupFetchSubscription();
799
+ return; // Do NOT subscribe and do NOT fetch
800
+ }
801
+ // apiPath is now defined → create subscription if missing
802
+ if (!this.fetchSub) {
803
+ this.setupFetchSubscription();
804
+ }
805
+ // And trigger the fetch if items not provided
806
+ if (!this.items && this.fetchSub) {
807
+ // console.log('FETTCCHNNG 3');
808
+ this.triggerFetch();
809
+ }
795
810
  }
796
- else {
797
- this.isLoading = false;
811
+ // CASE B — Parent passed items → use them and never fetch
812
+ if (changes['items']) {
813
+ if (changes['items'].currentValue && changes['items'].currentValue.length > 0) {
814
+ this.isLoading = false;
815
+ this.items = changes['items'].currentValue;
816
+ return;
817
+ }
798
818
  }
819
+ // FROM HERE → items is not provided → backend fetch required
820
+ // CASE C — initial load (items missing)
821
+ if (changes['items'] && !changes['items'].currentValue && this.fetchSub) {
822
+ // console.log('FETTCCHNNG 1');
823
+ this.triggerFetch();
824
+ }
825
+ // CASE D — filterParams changed and items not provided
826
+ if (changes['filterParams'] && this.fetchSub) {
827
+ // console.log('FETTCCHNNG 2');
828
+ this.triggerFetch();
829
+ }
830
+ }
831
+ setupFetchSubscription() {
832
+ this.fetchSub = this.fetchTrigger$
833
+ .pipe(filter(trigger => trigger !== null), tap(() => (this.isLoading = true)), switchMap(({ apiPath, filterParams }) => this._ChooseGeneralItemService.getData(apiPath, filterParams)))
834
+ .subscribe(data => {
835
+ this.items = data;
836
+ this.isLoading = false;
837
+ // console.log('fetched items from ', this.apiPath, data);
838
+ });
799
839
  }
800
840
  validateAddConfiguration() {
801
841
  if ((this.addRoute == '' || this.addRoute == null || this.addRoute == undefined) &&
@@ -913,6 +953,12 @@ class ChooseGeneralItemComponent {
913
953
  registerOnValidatorChange(fn) {
914
954
  this.onValidationChange = fn;
915
955
  }
956
+ cleanupFetchSubscription() {
957
+ if (this.fetchSub) {
958
+ this.fetchSub.unsubscribe();
959
+ this.fetchSub = undefined;
960
+ }
961
+ }
916
962
  validate(control) {
917
963
  return null;
918
964
  if (control) {
@@ -1031,54 +1077,646 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1031
1077
  args: ['customOption']
1032
1078
  }] } });
1033
1079
 
1034
- class ChooseGeneralItemRendererComponent {
1035
- params;
1036
- formControlValue;
1037
- key;
1038
- itemId;
1039
- rowId;
1040
- constructor() { }
1041
- agInit(params) {
1042
- this.params = params;
1043
- this.itemId = params.data.id;
1044
- this.key = params.context.createKey(params.columnApi, params.column);
1045
- this.rowId = params.node.id;
1080
+ class ShowTableErrorsComponent {
1081
+ message;
1082
+ showDetails;
1083
+ ngOnInit() {
1046
1084
  }
1047
- onCellDataChanged($event) {
1048
- let value = $event;
1049
- this.formControlValue = this.params.context.formGroup.get("entries").at(this.rowId);
1050
- this.formControlValue.get(this.key).setValue(value);
1051
- const params = {
1052
- value: value,
1053
- rowNode: this.params.node,
1054
- };
1055
- this.params.onCellValueChanged(params);
1085
+ onMouseEnter() {
1086
+ this.showDetails = true;
1056
1087
  }
1057
- refresh(params) {
1058
- return true;
1088
+ onMouseLeave() {
1089
+ this.showDetails = false;
1059
1090
  }
1060
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChooseGeneralItemRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1061
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ChooseGeneralItemRendererComponent, selector: "choose-general-item-renderer", ngImport: i0, template: "<choose-general-item [label]=\"params.label\" [appendTo]=\"'body'\" [placeholder]=\"params.placeholder\"\r\n [apiPath]=\"params.apiPath\" [isMultiple]=\"params.isMultiple\" [objects]=\"params.objects\"\r\n [showLabel]=\"params.showLabel\" [separator]=\"params.separator\" [width]=\"params.width\" [isChip]=\"params.isChip\"\r\n [isTypeDate]=\"params.isTypeDate\" [chipColor]=\"params.chipColor\" [chipTextColor]=\"params.chipTextColor\"\r\n [chipWidth]=\"params.chipWidth\" [selectedItemId]=\"itemId\" [disabled]=\"params.disabled\"\r\n (change)=\"onCellDataChanged($event)\">\r\n</choose-general-item>", styles: [".all{display:grid;gap:.5rem;align-items:center;margin:auto}.single{grid-template-columns:auto}.double{grid-template-columns:auto max-content}\n"], dependencies: [{ kind: "component", type: ChooseGeneralItemComponent, selector: "choose-general-item", inputs: ["items", "label", "appendTo", "placeholder", "apiPath", "isMultiple", "hideSelectedItem", "objects", "showLabel", "separator", "width", "isChip", "isTypeDate", "chipColor", "chipTextColor", "chipWidth", "selectedItemId", "disabled", "readOnly", "useFullObject", "showAdd", "dialogComponentClass", "showDialogDefaultButtons", "dialogComponentInputs", "bindValueKey", "addRoute", "canActionsRoute", "dialogTitle", "clearable", "filterParams", "templateType", "basicTemplateData", "contentProjectionLabelKey", "fullObjectControlConfig"], outputs: ["change", "blur"] }] });
1091
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ShowTableErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1092
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ShowTableErrorsComponent, selector: "show-table-errors", inputs: { message: "message" }, ngImport: i0, template: "<div (mouseenter)=\"onMouseEnter()\"(mouseleave)=\"onMouseLeave()\" class=\"icon\">\r\n <fa-icon class=\"icon\" icon=\"info-circle\" ></fa-icon>\r\n <span *ngIf=\"message\" class=\"message\"\r\n [ngClass]=\"{'no-details' : !showDetails , 'details': showDetails}\">{{message}}</span>\r\n</div>", styles: [".icon{color:#a80002;cursor:pointer;display:inline-block}.no-details{display:none}.details{display:block;z-index:100;background-color:#ffdbdb;color:#a80002;border-radius:.5rem;border:.1rem solid #A80002;border-left:.5rem solid #A80002;position:fixed;padding:1rem;bottom:45%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$2.FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "classes", "transform", "a11yRole"] }] });
1062
1093
  }
1063
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChooseGeneralItemRendererComponent, decorators: [{
1094
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ShowTableErrorsComponent, decorators: [{
1064
1095
  type: Component,
1065
- args: [{ selector: 'choose-general-item-renderer', template: "<choose-general-item [label]=\"params.label\" [appendTo]=\"'body'\" [placeholder]=\"params.placeholder\"\r\n [apiPath]=\"params.apiPath\" [isMultiple]=\"params.isMultiple\" [objects]=\"params.objects\"\r\n [showLabel]=\"params.showLabel\" [separator]=\"params.separator\" [width]=\"params.width\" [isChip]=\"params.isChip\"\r\n [isTypeDate]=\"params.isTypeDate\" [chipColor]=\"params.chipColor\" [chipTextColor]=\"params.chipTextColor\"\r\n [chipWidth]=\"params.chipWidth\" [selectedItemId]=\"itemId\" [disabled]=\"params.disabled\"\r\n (change)=\"onCellDataChanged($event)\">\r\n</choose-general-item>", styles: [".all{display:grid;gap:.5rem;align-items:center;margin:auto}.single{grid-template-columns:auto}.double{grid-template-columns:auto max-content}\n"] }]
1066
- }], ctorParameters: function () { return []; } });
1096
+ args: [{ selector: 'show-table-errors', template: "<div (mouseenter)=\"onMouseEnter()\"(mouseleave)=\"onMouseLeave()\" class=\"icon\">\r\n <fa-icon class=\"icon\" icon=\"info-circle\" ></fa-icon>\r\n <span *ngIf=\"message\" class=\"message\"\r\n [ngClass]=\"{'no-details' : !showDetails , 'details': showDetails}\">{{message}}</span>\r\n</div>", styles: [".icon{color:#a80002;cursor:pointer;display:inline-block}.no-details{display:none}.details{display:block;z-index:100;background-color:#ffdbdb;color:#a80002;border-radius:.5rem;border:.1rem solid #A80002;border-left:.5rem solid #A80002;position:fixed;padding:1rem;bottom:45%}\n"] }]
1097
+ }], propDecorators: { message: [{
1098
+ type: Input
1099
+ }] } });
1067
1100
 
1068
- var LineType;
1069
- (function (LineType) {
1070
- LineType[LineType["INCLUDE"] = 0] = "INCLUDE";
1071
- LineType[LineType["DO_NOT_INCLUDE"] = 1] = "DO_NOT_INCLUDE";
1072
- })(LineType || (LineType = {}));
1101
+ var ToolTipMessageType;
1102
+ (function (ToolTipMessageType) {
1103
+ ToolTipMessageType[ToolTipMessageType["ERROR"] = 0] = "ERROR";
1104
+ ToolTipMessageType[ToolTipMessageType["WARNING"] = 1] = "WARNING";
1105
+ ToolTipMessageType[ToolTipMessageType["HELP"] = 2] = "HELP";
1106
+ ToolTipMessageType[ToolTipMessageType["DEFAULT"] = 3] = "DEFAULT";
1107
+ })(ToolTipMessageType || (ToolTipMessageType = {}));
1073
1108
 
1074
- class LineTypeModelHelper {
1075
- static label;
1076
- static color;
1077
- static description;
1078
- static value;
1079
- static getItems() {
1080
- let items = [];
1081
- let values = Object.values(LineType);
1109
+ class TooltipMsgError {
1110
+ cdr;
1111
+ _El;
1112
+ width;
1113
+ control = null;
1114
+ messageType = ToolTipMessageType.ERROR;
1115
+ message;
1116
+ iconElId;
1117
+ messageElId;
1118
+ isLeft = true;
1119
+ showDetails;
1120
+ tooltipIcon;
1121
+ tooltipMessage;
1122
+ iconStyle;
1123
+ isDictionary;
1124
+ onScrollY() {
1125
+ this.onMouseLeave();
1126
+ }
1127
+ constructor(cdr, _El) {
1128
+ this.cdr = cdr;
1129
+ this._El = _El;
1130
+ }
1131
+ ngOnInit() {
1132
+ this.iconElId = this.generateRandomString();
1133
+ this.messageElId = this.generateRandomString();
1134
+ this.setIconStyle();
1135
+ this.checkErrorType();
1136
+ }
1137
+ ngOnChanges(changes) {
1138
+ this.checkErrorType();
1139
+ }
1140
+ ngOnDestroy() {
1141
+ if (document.getElementById(this.messageElId)) {
1142
+ document.getElementById(this.messageElId).remove();
1143
+ }
1144
+ }
1145
+ checkErrorType() {
1146
+ if (this.message) {
1147
+ if (this.message.constructor == Object) {
1148
+ this.isDictionary = true;
1149
+ }
1150
+ else if (typeof this.message === 'string') {
1151
+ this.isDictionary = false;
1152
+ }
1153
+ else {
1154
+ this.isDictionary = false;
1155
+ }
1156
+ }
1157
+ }
1158
+ getThemedMessageStyle() {
1159
+ let backgroundColor;
1160
+ let fontBorderColor;
1161
+ switch (this.messageType) {
1162
+ case ToolTipMessageType.ERROR:
1163
+ backgroundColor = '#fde5f0';
1164
+ fontBorderColor = PrimaryColors.$primaryPinkColor;
1165
+ break;
1166
+ case ToolTipMessageType.WARNING:
1167
+ backgroundColor = '#fdefdd';
1168
+ fontBorderColor = PrimaryColors.$primaryOrangeColor;
1169
+ break;
1170
+ case ToolTipMessageType.HELP:
1171
+ backgroundColor = '#d1f9f2';
1172
+ fontBorderColor = PrimaryColors.$primaryTealColor;
1173
+ break;
1174
+ default:
1175
+ backgroundColor = PrimaryColors.$primaryLightGrayColor;
1176
+ fontBorderColor = PrimaryColors.$primaryGrayColor;
1177
+ break;
1178
+ }
1179
+ let style = {
1180
+ 'background-color': backgroundColor,
1181
+ 'font-weight': 'bold',
1182
+ color: fontBorderColor,
1183
+ border: '0.2rem solid ' + fontBorderColor,
1184
+ 'border-left': '0.5rem solid ' + fontBorderColor,
1185
+ };
1186
+ return style;
1187
+ }
1188
+ setMessageStyle() {
1189
+ let style = {};
1190
+ if (this.width) {
1191
+ style['width'] = this.width;
1192
+ }
1193
+ }
1194
+ get messageStyle() {
1195
+ let commonMessageStyle = {};
1196
+ if (this.width) {
1197
+ commonMessageStyle['width'] = this.width;
1198
+ }
1199
+ return {
1200
+ ...commonMessageStyle,
1201
+ ...(this.showDetails ? this.getThemedMessageStyle() : {}),
1202
+ };
1203
+ }
1204
+ setIconStyle() {
1205
+ let backgroundColor;
1206
+ switch (this.messageType) {
1207
+ case ToolTipMessageType.ERROR:
1208
+ backgroundColor = PrimaryColors.$primaryPinkColor;
1209
+ break;
1210
+ case ToolTipMessageType.WARNING:
1211
+ backgroundColor = PrimaryColors.$primaryOrangeColor;
1212
+ break;
1213
+ case ToolTipMessageType.HELP:
1214
+ backgroundColor = PrimaryColors.$primaryTealColor;
1215
+ break;
1216
+ default:
1217
+ backgroundColor = PrimaryColors.$primaryGrayColor;
1218
+ break;
1219
+ }
1220
+ let style = {
1221
+ color: backgroundColor,
1222
+ };
1223
+ this.iconStyle = style;
1224
+ }
1225
+ onMouseEnter() {
1226
+ this.showDetails = true;
1227
+ // CDR is needed to let the DOM know the box error has a width
1228
+ this.cdr.detectChanges();
1229
+ this.tooltipMessage = document.getElementById(this.messageElId);
1230
+ if (this.message) {
1231
+ this.getDirection(this.tooltipMessage);
1232
+ document.body.appendChild(this.tooltipMessage);
1233
+ let messageElement = document.getElementById(this.messageElId);
1234
+ let icon = document.getElementById(this.iconElId);
1235
+ let rect = icon.getBoundingClientRect();
1236
+ let top = rect.top;
1237
+ let left = rect.left;
1238
+ let right = rect.right;
1239
+ let appendedLeft;
1240
+ let appendedRight;
1241
+ let appendedTop = top - messageElement.offsetHeight;
1242
+ this.tooltipMessage.style.top = appendedTop + 'px';
1243
+ this.tooltipMessage.style.zIndex = '1000';
1244
+ if (this.isLeft) {
1245
+ appendedLeft = left + icon.offsetWidth - 5;
1246
+ this.tooltipMessage.style.left = appendedLeft + 'px';
1247
+ }
1248
+ else {
1249
+ appendedRight = window.innerWidth - right + 5;
1250
+ this.tooltipMessage.style.right = appendedRight + 'px';
1251
+ }
1252
+ }
1253
+ }
1254
+ onMouseLeave() {
1255
+ this.showDetails = false;
1256
+ }
1257
+ getDirection(element) {
1258
+ // Calculating the width difference between screen width minus the poistion of the icon from left to right (getBoundingClientRect().right)
1259
+ let difference = window.innerWidth - element.getBoundingClientRect().right;
1260
+ // hard coded + 12 is for the padding that has been added to router-outlet
1261
+ // The if statment here check if there is enough space for the box error to show from left to right , if not enough space, the box error will pop up from right to left
1262
+ if (difference <= element.offsetWidth + 12) {
1263
+ this.isLeft = false;
1264
+ }
1265
+ else {
1266
+ this.isLeft = true;
1267
+ }
1268
+ }
1269
+ generateRandomString() {
1270
+ let charsAndNumbs = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
1271
+ let text = '';
1272
+ for (let i = 0; i < 8; i++) {
1273
+ text += charsAndNumbs.charAt(Math.floor(Math.random() * charsAndNumbs.length));
1274
+ }
1275
+ return text;
1276
+ }
1277
+ // Helper to decide how to display the value
1278
+ formatValue(value) {
1279
+ if (!value)
1280
+ return '';
1281
+ // 1. If it's an array (like your jurisdiction error)
1282
+ if (Array.isArray(value)) {
1283
+ // Map through the array and extract 'message' if it exists, otherwise stringify
1284
+ return value
1285
+ .map(item => {
1286
+ return typeof item === 'object' && item.message ? item.message : JSON.stringify(item);
1287
+ })
1288
+ .join(', ');
1289
+ }
1290
+ // 2. If it's a single object (but not an array)
1291
+ if (typeof value === 'object') {
1292
+ return value.message || JSON.stringify(value);
1293
+ }
1294
+ // 3. It's a string or number
1295
+ return value;
1296
+ }
1297
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipMsgError, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1298
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TooltipMsgError, selector: "tooltip-msg-error", inputs: { width: "width", control: "control", messageType: "messageType", message: "message" }, host: { listeners: { "document:scroll ": "onScrollY()" } }, usesOnChanges: true, ngImport: i0, template: "<div\r\n *ngIf=\"message && !control\"\r\n class=\"container\"\r\n (mouseenter)=\"onMouseEnter()\"\r\n (mouseleave)=\"onMouseLeave()\">\r\n <fa-icon [id]=\"iconElId\" [ngStyle]=\"iconStyle\" icon=\"circle-exclamation\" class=\"icon\"></fa-icon>\r\n <div\r\n *ngIf=\"!isDictionary\"\r\n [ngStyle]=\"messageStyle\"\r\n [id]=\"messageElId\"\r\n class=\"message\"\r\n [ngClass]=\"{ 'no-details': !showDetails, details: showDetails }\">\r\n {{ message }}\r\n </div>\r\n\r\n <div\r\n *ngIf=\"isDictionary\"\r\n [ngStyle]=\"messageStyle\"\r\n [id]=\"messageElId\"\r\n class=\"message\"\r\n [ngClass]=\"{ 'no-details': !showDetails, details: showDetails }\">\r\n <div class=\"dict-cont\" *ngFor=\"let entry of message | keyvalue\">\r\n <strong>{{ entry.key }}: </strong>\r\n <span>{{ formatValue(entry.value) }}</span>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<div\r\n *ngIf=\"control?.touched && control.errors\"\r\n class=\"container\"\r\n (mouseenter)=\"onMouseEnter()\"\r\n (mouseleave)=\"onMouseLeave()\">\r\n <fa-icon [ngStyle]=\"iconStyle\" [id]=\"iconElId\" icon=\"circle-exclamation\" class=\"icon\"></fa-icon>\r\n <div\r\n [ngStyle]=\"messageStyle\"\r\n [id]=\"messageElId\"\r\n class=\"message\"\r\n [ngClass]=\"{ 'no-details': !showDetails, details: showDetails }\">\r\n <div class=\"dict-cont\" *ngFor=\"let entry of message | keyvalue\">\r\n <strong>{{ entry.key }}: </strong>\r\n <span>{{ formatValue(entry.value) }}</span>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".no-details{display:none;position:unset}.icon{cursor:pointer;display:inline-block}.container{position:relative}.details{position:fixed;display:block;z-index:1000;border-radius:.5rem;padding:.75rem 1rem;width:max-content;max-width:500px;font-size:1.2rem;line-height:1.4}@media (max-width: 1024px){.details{max-width:320px}}@media (max-width: 768px){.details{max-width:90vw}}.right-section{right:0}.message{width:max-content;white-space:pre-line;pointer-events:none}.dict-cont{line-height:normal}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2$2.FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "classes", "transform", "a11yRole"] }, { kind: "pipe", type: i1.KeyValuePipe, name: "keyvalue" }] });
1299
+ }
1300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipMsgError, decorators: [{
1301
+ type: Component,
1302
+ args: [{ selector: 'tooltip-msg-error', template: "<div\r\n *ngIf=\"message && !control\"\r\n class=\"container\"\r\n (mouseenter)=\"onMouseEnter()\"\r\n (mouseleave)=\"onMouseLeave()\">\r\n <fa-icon [id]=\"iconElId\" [ngStyle]=\"iconStyle\" icon=\"circle-exclamation\" class=\"icon\"></fa-icon>\r\n <div\r\n *ngIf=\"!isDictionary\"\r\n [ngStyle]=\"messageStyle\"\r\n [id]=\"messageElId\"\r\n class=\"message\"\r\n [ngClass]=\"{ 'no-details': !showDetails, details: showDetails }\">\r\n {{ message }}\r\n </div>\r\n\r\n <div\r\n *ngIf=\"isDictionary\"\r\n [ngStyle]=\"messageStyle\"\r\n [id]=\"messageElId\"\r\n class=\"message\"\r\n [ngClass]=\"{ 'no-details': !showDetails, details: showDetails }\">\r\n <div class=\"dict-cont\" *ngFor=\"let entry of message | keyvalue\">\r\n <strong>{{ entry.key }}: </strong>\r\n <span>{{ formatValue(entry.value) }}</span>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<div\r\n *ngIf=\"control?.touched && control.errors\"\r\n class=\"container\"\r\n (mouseenter)=\"onMouseEnter()\"\r\n (mouseleave)=\"onMouseLeave()\">\r\n <fa-icon [ngStyle]=\"iconStyle\" [id]=\"iconElId\" icon=\"circle-exclamation\" class=\"icon\"></fa-icon>\r\n <div\r\n [ngStyle]=\"messageStyle\"\r\n [id]=\"messageElId\"\r\n class=\"message\"\r\n [ngClass]=\"{ 'no-details': !showDetails, details: showDetails }\">\r\n <div class=\"dict-cont\" *ngFor=\"let entry of message | keyvalue\">\r\n <strong>{{ entry.key }}: </strong>\r\n <span>{{ formatValue(entry.value) }}</span>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".no-details{display:none;position:unset}.icon{cursor:pointer;display:inline-block}.container{position:relative}.details{position:fixed;display:block;z-index:1000;border-radius:.5rem;padding:.75rem 1rem;width:max-content;max-width:500px;font-size:1.2rem;line-height:1.4}@media (max-width: 1024px){.details{max-width:320px}}@media (max-width: 768px){.details{max-width:90vw}}.right-section{right:0}.message{width:max-content;white-space:pre-line;pointer-events:none}.dict-cont{line-height:normal}\n"] }]
1303
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { width: [{
1304
+ type: Input
1305
+ }], control: [{
1306
+ type: Input
1307
+ }], messageType: [{
1308
+ type: Input
1309
+ }], message: [{
1310
+ type: Input
1311
+ }], onScrollY: [{
1312
+ type: HostListener,
1313
+ args: ['document:scroll ']
1314
+ }] } });
1315
+
1316
+ class AddAsteriskDirective {
1317
+ elem;
1318
+ show = true;
1319
+ constructor(elem) {
1320
+ this.elem = elem;
1321
+ }
1322
+ ngOnInit() {
1323
+ this.toggleAsterisk();
1324
+ }
1325
+ ngOnChanges(changes) {
1326
+ this.toggleAsterisk();
1327
+ }
1328
+ toggleAsterisk() {
1329
+ const existingAsterisk = this.elem.nativeElement.querySelector('.custom-asterisk');
1330
+ if (this.show) {
1331
+ if (!existingAsterisk) {
1332
+ const customAsterisk = `<span class="custom-asterisk" style="color:${PrimaryColors.$primaryRedColor};"> *</span> `;
1333
+ this.elem.nativeElement.insertAdjacentHTML('beforeend', customAsterisk);
1334
+ }
1335
+ }
1336
+ else {
1337
+ if (existingAsterisk) {
1338
+ existingAsterisk.remove();
1339
+ }
1340
+ }
1341
+ }
1342
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AddAsteriskDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1343
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AddAsteriskDirective, selector: "[addAsterisk]", inputs: { show: "show" }, usesOnChanges: true, ngImport: i0 });
1344
+ }
1345
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AddAsteriskDirective, decorators: [{
1346
+ type: Directive,
1347
+ args: [{
1348
+ selector: '[addAsterisk]'
1349
+ }]
1350
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { show: [{
1351
+ type: Input,
1352
+ args: ['show']
1353
+ }] } });
1354
+
1355
+ class ValidationMessageService {
1356
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ValidationMessageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1357
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ValidationMessageService, providedIn: 'root' });
1358
+ }
1359
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ValidationMessageService, decorators: [{
1360
+ type: Injectable,
1361
+ args: [{
1362
+ providedIn: 'root'
1363
+ }]
1364
+ }] });
1365
+ class MinLengthValidationError {
1366
+ requirement;
1367
+ constructor(requirement) {
1368
+ this.requirement = requirement;
1369
+ }
1370
+ buildMessage() {
1371
+ return "Must be a minimum length of " + this.requirement + " letters!";
1372
+ }
1373
+ }
1374
+ class InvalidIntegerNumberValidatorEerror {
1375
+ buildMessage() {
1376
+ return "Must only contain numbers, no decimals or words allowed";
1377
+ }
1378
+ }
1379
+ class PositiveIntegerNumberValidatorError {
1380
+ buildMessage() {
1381
+ return "Must be a positive integer";
1382
+ }
1383
+ }
1384
+ class MaxLengthValidationError {
1385
+ requirement;
1386
+ constructor(requirement) {
1387
+ this.requirement = requirement;
1388
+ }
1389
+ buildMessage() {
1390
+ return "Must be a maximum length of " + this.requirement + " letters!";
1391
+ }
1392
+ }
1393
+ class MaxValidationError {
1394
+ requirement;
1395
+ constructor(requirement) {
1396
+ this.requirement = requirement;
1397
+ }
1398
+ buildMessage() {
1399
+ return "The largest acceptable input is " + this.requirement;
1400
+ }
1401
+ }
1402
+ class MinValidationError {
1403
+ requirement;
1404
+ constructor(requirement) {
1405
+ this.requirement = requirement;
1406
+ }
1407
+ buildMessage() {
1408
+ return "The smallest acceptable input is " + this.requirement;
1409
+ }
1410
+ }
1411
+ class PatternValidatorError {
1412
+ requirement;
1413
+ constructor(requirement) {
1414
+ this.requirement = requirement;
1415
+ }
1416
+ buildMessage() {
1417
+ if (this.requirement == '^[a-zA-Z ]*$') {
1418
+ return "This field must only contain words ";
1419
+ }
1420
+ else if (this.requirement == '/[0-9]-[0-9]+$/') {
1421
+ return "This field must only contain numbers and a - " + "<br>" + "Example: 71-716971";
1422
+ }
1423
+ else if (this.requirement = 'forDate') {
1424
+ return "Date needs to be DD/MM/YYYY";
1425
+ }
1426
+ }
1427
+ }
1428
+ class RequiredValidatorError {
1429
+ buildMessage() {
1430
+ return "This Field Is Required";
1431
+ }
1432
+ }
1433
+ class EmailValidatorError {
1434
+ buildMessage() {
1435
+ return "Make Sure It Is An Email Format" + "<br>" + "example@jooler.io";
1436
+ }
1437
+ }
1438
+ class ValidationError {
1439
+ static getRelevantError(validationType, validationValue) {
1440
+ let validationMessage;
1441
+ validationMessage = this.MessageDictionary(validationValue, validationType);
1442
+ return validationMessage;
1443
+ }
1444
+ static MessageDictionary(value, validationType) {
1445
+ let ValidationMessageForInput = {
1446
+ 'minlength': new MinLengthValidationError(value).buildMessage(),
1447
+ 'maxlength': new MaxLengthValidationError(value).buildMessage(),
1448
+ 'max': new MaxValidationError(value).buildMessage(),
1449
+ 'min': new MinValidationError(value).buildMessage(),
1450
+ 'pattern': new PatternValidatorError(value).buildMessage(),
1451
+ 'required': new RequiredValidatorError().buildMessage(),
1452
+ 'email': new EmailValidatorError().buildMessage(),
1453
+ 'invalidIntegerNumber': new InvalidIntegerNumberValidatorEerror().buildMessage(),
1454
+ 'invalidPositiveInteger': new PositiveIntegerNumberValidatorError().buildMessage(),
1455
+ };
1456
+ return ValidationMessageForInput[validationType];
1457
+ }
1458
+ static validationMessageForDate = {
1459
+ 'required': new RequiredValidatorError().buildMessage(),
1460
+ 'pattern': new PatternValidatorError('forDate').buildMessage(),
1461
+ };
1462
+ }
1463
+
1464
+ class FormControlValidationMsgDirectiveForNgSelect {
1465
+ elRef;
1466
+ control;
1467
+ errorMessage;
1468
+ showDot;
1469
+ errorDivId;
1470
+ afterEnd = true;
1471
+ showBoxError = true;
1472
+ validationError = ValidationError;
1473
+ statusChangeSubscription;
1474
+ constructor(elRef, control) {
1475
+ this.elRef = elRef;
1476
+ this.control = control;
1477
+ }
1478
+ ngOnInit() {
1479
+ if (!this.errorDivId) {
1480
+ this.errorDivId = this.control.name;
1481
+ }
1482
+ this.statusChangeSubscription = this.control.statusChanges.subscribe(status => {
1483
+ if (status == 'INVALID' && this.control.touched) {
1484
+ this.showNgSelectError();
1485
+ }
1486
+ else {
1487
+ this.removeError();
1488
+ }
1489
+ });
1490
+ this.control.valueChanges.subscribe({
1491
+ next: () => {
1492
+ if (this.control.errors && this.control.touched) {
1493
+ this.showNgSelectError();
1494
+ }
1495
+ else {
1496
+ this.removeError();
1497
+ }
1498
+ },
1499
+ });
1500
+ }
1501
+ onFocusout() {
1502
+ if (this.control.errors && this.control.touched) {
1503
+ this.showNgSelectError();
1504
+ }
1505
+ else {
1506
+ this.removeError();
1507
+ }
1508
+ }
1509
+ removeError() {
1510
+ this.errorMessage = '';
1511
+ const errorElement = document.getElementById(this.errorDivId);
1512
+ if (errorElement)
1513
+ errorElement.remove();
1514
+ }
1515
+ showNgSelectError() {
1516
+ this.removeError();
1517
+ const valErrors = this.control.errors;
1518
+ if (this.control.errors.length > 1) {
1519
+ this.showDot = true;
1520
+ }
1521
+ else {
1522
+ this.showDot = false;
1523
+ }
1524
+ if (valErrors) {
1525
+ const keys = Object.keys(valErrors);
1526
+ for (let i = 0; i < keys.length; i++) {
1527
+ switch (keys[i]) {
1528
+ case 'required': {
1529
+ let message = this.validationError.getRelevantError(keys[i], valErrors);
1530
+ this.errorMessage += ` ${this.errorMessage ? '<br>' : ''}${this.showDot ? '\u25CF ' + message : message}`;
1531
+ this.control.control.setErrors({ required: true, message: message }, { emitEvent: false });
1532
+ break;
1533
+ }
1534
+ case 'validatePhoneNumber': {
1535
+ let message = this.validationError.getRelevantError(keys[i], valErrors);
1536
+ this.errorMessage += ` ${this.errorMessage ? '<br>' : ''}${this.showDot ? '\u25CF ' + message : message}`;
1537
+ this.control.control.setErrors({ validatePhoneNumber: true, message: message }, { emitEvent: false });
1538
+ break;
1539
+ }
1540
+ case 'customMessage': {
1541
+ console.log('valErrors', valErrors);
1542
+ let message = valErrors.message;
1543
+ this.errorMessage += ` ${this.errorMessage ? '<br>' : ''}${this.showDot ? '\u25CF ' + message : message}`;
1544
+ }
1545
+ }
1546
+ }
1547
+ if (this.showBoxError) {
1548
+ const errDiv = `<div style="color:${PrimaryColors.$primaryRedColor}; width: ${this.afterEnd ? this.elRef.nativeElement.offsetWidth + 'px' : '100%'}; min-width: 100%; background-color: ${PrimaryColors.$primaryLightRedColor}; padding: .5rem; border-radius: .5rem; border: .1rem solid ${PrimaryColors.$primaryRedColor} ;border-left: .75rem solid ${PrimaryColors.$primaryRedColor}; margin-top:.5rem; font-size: 1.2rem; " id="` +
1549
+ this.errorDivId +
1550
+ '">' +
1551
+ `<h3 style= " font-size: 1.3rem; margin-bottom:.5rem; margin:0; color: ${PrimaryColors.$primaryRedColor}; font-weight: 700; line-height: 1.6rem;">` +
1552
+ 'Please Complete all details' +
1553
+ '</h3>' +
1554
+ this.errorMessage +
1555
+ '</div>';
1556
+ if (!this.afterEnd)
1557
+ this.elRef.nativeElement.parentElement.insertAdjacentHTML('afterend', errDiv);
1558
+ else {
1559
+ this.elRef.nativeElement.insertAdjacentHTML('afterend', errDiv);
1560
+ }
1561
+ }
1562
+ }
1563
+ }
1564
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormControlValidationMsgDirectiveForNgSelect, deps: [{ token: i0.ElementRef }, { token: i2$1.NgControl }], target: i0.ɵɵFactoryTarget.Directive });
1565
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: FormControlValidationMsgDirectiveForNgSelect, selector: "[appFormControlValidationMsgForNgSelect]", inputs: { afterEnd: "afterEnd", showBoxError: "showBoxError" }, host: { listeners: { "focusout": "onFocusout()" } }, providers: [NgModel], ngImport: i0 });
1566
+ }
1567
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormControlValidationMsgDirectiveForNgSelect, decorators: [{
1568
+ type: Directive,
1569
+ args: [{
1570
+ selector: '[appFormControlValidationMsgForNgSelect]',
1571
+ providers: [NgModel],
1572
+ }]
1573
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.NgControl }]; }, propDecorators: { afterEnd: [{
1574
+ type: Input,
1575
+ args: ['afterEnd']
1576
+ }], showBoxError: [{
1577
+ type: Input,
1578
+ args: ['showBoxError']
1579
+ }], onFocusout: [{
1580
+ type: HostListener,
1581
+ args: ['focusout']
1582
+ }] } });
1583
+
1584
+ class ChooseGeneralItemRendererComponent {
1585
+ arrayKey = 'entries';
1586
+ formGroup;
1587
+ items;
1588
+ key;
1589
+ params;
1590
+ validationType = ChooseItemRendererValidationType.NONE;
1591
+ validationTypes = ChooseItemRendererValidationType;
1592
+ clearable = true;
1593
+ templateType = ChooseObjectTemplateType.DEFAULT;
1594
+ basicTemplateData;
1595
+ valueToBind = 'id'; // or null for full object
1596
+ showDropdown = true;
1597
+ constructor() { }
1598
+ agInit(params) {
1599
+ this.params = params;
1600
+ if (params.context.arrayKey) {
1601
+ this.arrayKey = params.context.arrayKey;
1602
+ }
1603
+ this.setupRenderer(params);
1604
+ this.formGroup = params.context.formGroup.get(this.arrayKey).at(params.node.rowIndex);
1605
+ this.key = params.context.createKey(params.columnApi, params.column);
1606
+ }
1607
+ onCellDataChanged($event) {
1608
+ let object = $event;
1609
+ this.formGroup.get(this.key);
1610
+ let rowNode = this.params.node;
1611
+ let valueToBind;
1612
+ if (this.valueToBind === null) {
1613
+ // Case 1: Bind the entire object
1614
+ valueToBind = object;
1615
+ }
1616
+ else if (this.valueToBind && object) {
1617
+ // Case 2: Bind a specific property using dynamic access
1618
+ valueToBind = object[this.valueToBind];
1619
+ }
1620
+ else {
1621
+ // Case 3: Handle null/cleared selection
1622
+ valueToBind = null;
1623
+ }
1624
+ rowNode.setDataValue(this.key, valueToBind);
1625
+ if (this.params.onCellValueChanged instanceof Function) {
1626
+ const params = {
1627
+ value: object?.[this.valueToBind],
1628
+ object: object,
1629
+ rowNode: rowNode,
1630
+ colId: this.params.column.colId,
1631
+ lineFormGroup: this.params.context.formGroup.get(this.arrayKey).at(rowNode.rowIndex),
1632
+ };
1633
+ this.params.onCellValueChanged(params);
1634
+ }
1635
+ if (this.validationType == ChooseItemRendererValidationType.ROW_LEVEL_UNIQUE) {
1636
+ this.setRowLevelUniqueItems(this.params);
1637
+ }
1638
+ }
1639
+ setupRenderer(params) {
1640
+ if (params.showDropdown === true || params.showDropdown === false) {
1641
+ this.showDropdown = params.showDropdown;
1642
+ }
1643
+ if (params.bindValueKey != undefined) {
1644
+ this.valueToBind = params.bindValueKey;
1645
+ }
1646
+ if (params.clearable != null && params.clearable != undefined) {
1647
+ this.clearable = params.clearable;
1648
+ }
1649
+ if (params.templateType) {
1650
+ this.templateType = params.templateType;
1651
+ }
1652
+ if (params.basicTemplateData) {
1653
+ this.basicTemplateData = params.basicTemplateData;
1654
+ }
1655
+ if (params.chooseItemValidationType != null && params.chooseItemValidationType != undefined) {
1656
+ this.validationType = params.chooseItemValidationType;
1657
+ }
1658
+ if (this.validationType == ChooseItemRendererValidationType.ROW_LEVEL_UNIQUE) {
1659
+ this.setRowLevelUniqueItems(params);
1660
+ }
1661
+ else if (this.validationType == ChooseItemRendererValidationType.NONE) {
1662
+ this.setAllItems(params);
1663
+ }
1664
+ else {
1665
+ throw Error('ChooseGeneralItemRendererValidationType is not recognized.');
1666
+ }
1667
+ }
1668
+ setAllItems(params) {
1669
+ if (params.items) {
1670
+ this.items = params.items;
1671
+ }
1672
+ }
1673
+ setRowLevelUniqueItems(params) {
1674
+ let items;
1675
+ if (params.items) {
1676
+ items = params.items;
1677
+ if (params.value && !items.includes(item => item?.[this.valueToBind] !== params.value)) {
1678
+ let appendedItems = [...items];
1679
+ appendedItems.push(params.allItems.find(item => item?.[this.valueToBind] === params.value));
1680
+ items = appendedItems;
1681
+ }
1682
+ this.items = items;
1683
+ }
1684
+ }
1685
+ refresh(params) {
1686
+ this.formGroup = this.params.context.formGroup.get(this.arrayKey).at(params.node.rowIndex);
1687
+ this.setupRenderer(params);
1688
+ return true;
1689
+ }
1690
+ get showError() {
1691
+ if (this.formGroup.get(this.key).errors && this.formGroup.get(this.key).touched) {
1692
+ return true;
1693
+ }
1694
+ else {
1695
+ return false;
1696
+ }
1697
+ }
1698
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChooseGeneralItemRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1699
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ChooseGeneralItemRendererComponent, selector: "choose-general-item-renderer", ngImport: i0, template: "<div class=\"all\" [ngClass]=\"{ single: !showError, double: showError }\"\r\n *ngIf=\"formGroup && showDropdown\" [formGroup]=\"formGroup\">\r\n <choose-general-item [bindValueKey]=\"valueToBind\" [clearable]=\"clearable\"\r\n [items]=\"items\" appFormControlValidationMsgForNgSelect [formControlName]=\"key\"\r\n [label]=\"params.label\" [appendTo]=\"'body'\" [placeholder]=\"params.placeholder\"\r\n [isMultiple]=\"params.isMultiple\" [objects]=\"params.objects\"\r\n [showLabel]=\"params.showLabel\" [separator]=\"params.separator\"\r\n [width]=\"params.width\" [isChip]=\"params.isChip\" [isTypeDate]=\"params.isTypeDate\"\r\n [chipColor]=\"params.chipColor\" [chipTextColor]=\"params.chipTextColor\"\r\n [basicTemplateData]=\"basicTemplateData\" [templateType]=\"templateType\"\r\n [chipWidth]=\"params.chipWidth\" (change)=\"onCellDataChanged($event)\"\r\n [showBoxError]=\"false\">\r\n </choose-general-item>\r\n <tooltip-msg-error [control]=\"formGroup.get(this.key)\" *ngIf=\"showError\"\r\n [message]=\"formGroup.get(key).errors.message\"></tooltip-msg-error>\r\n</div>\r\n<div class=\"center\" *ngIf=\"!showDropdown\">-</div>", styles: [".center{display:grid;align-items:center;justify-items:center}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: ChooseGeneralItemComponent, selector: "choose-general-item", inputs: ["items", "label", "appendTo", "placeholder", "apiPath", "isMultiple", "hideSelectedItem", "objects", "showLabel", "separator", "width", "isChip", "isTypeDate", "chipColor", "chipTextColor", "chipWidth", "selectedItemId", "disabled", "readOnly", "useFullObject", "showAdd", "dialogComponentClass", "showDialogDefaultButtons", "dialogComponentInputs", "bindValueKey", "addRoute", "canActionsRoute", "dialogTitle", "clearable", "filterParams", "templateType", "basicTemplateData", "contentProjectionLabelKey", "fullObjectControlConfig"], outputs: ["change", "blur"] }, { kind: "directive", type: FormControlValidationMsgDirectiveForNgSelect, selector: "[appFormControlValidationMsgForNgSelect]", inputs: ["afterEnd", "showBoxError"] }, { kind: "component", type: TooltipMsgError, selector: "tooltip-msg-error", inputs: ["width", "control", "messageType", "message"] }] });
1700
+ }
1701
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChooseGeneralItemRendererComponent, decorators: [{
1702
+ type: Component,
1703
+ args: [{ selector: 'choose-general-item-renderer', template: "<div class=\"all\" [ngClass]=\"{ single: !showError, double: showError }\"\r\n *ngIf=\"formGroup && showDropdown\" [formGroup]=\"formGroup\">\r\n <choose-general-item [bindValueKey]=\"valueToBind\" [clearable]=\"clearable\"\r\n [items]=\"items\" appFormControlValidationMsgForNgSelect [formControlName]=\"key\"\r\n [label]=\"params.label\" [appendTo]=\"'body'\" [placeholder]=\"params.placeholder\"\r\n [isMultiple]=\"params.isMultiple\" [objects]=\"params.objects\"\r\n [showLabel]=\"params.showLabel\" [separator]=\"params.separator\"\r\n [width]=\"params.width\" [isChip]=\"params.isChip\" [isTypeDate]=\"params.isTypeDate\"\r\n [chipColor]=\"params.chipColor\" [chipTextColor]=\"params.chipTextColor\"\r\n [basicTemplateData]=\"basicTemplateData\" [templateType]=\"templateType\"\r\n [chipWidth]=\"params.chipWidth\" (change)=\"onCellDataChanged($event)\"\r\n [showBoxError]=\"false\">\r\n </choose-general-item>\r\n <tooltip-msg-error [control]=\"formGroup.get(this.key)\" *ngIf=\"showError\"\r\n [message]=\"formGroup.get(key).errors.message\"></tooltip-msg-error>\r\n</div>\r\n<div class=\"center\" *ngIf=\"!showDropdown\">-</div>", styles: [".center{display:grid;align-items:center;justify-items:center}\n"] }]
1704
+ }], ctorParameters: function () { return []; } });
1705
+
1706
+ var LineType;
1707
+ (function (LineType) {
1708
+ LineType[LineType["INCLUDE"] = 0] = "INCLUDE";
1709
+ LineType[LineType["DO_NOT_INCLUDE"] = 1] = "DO_NOT_INCLUDE";
1710
+ })(LineType || (LineType = {}));
1711
+
1712
+ class LineTypeModelHelper {
1713
+ static label;
1714
+ static color;
1715
+ static description;
1716
+ static value;
1717
+ static getItems() {
1718
+ let items = [];
1719
+ let values = Object.values(LineType);
1082
1720
  let types = values.filter(value => typeof value === 'number');
1083
1721
  for (let value of types) {
1084
1722
  this.setStringValueAndColor(value);
@@ -1291,283 +1929,116 @@ class EditableSavableInputComponent {
1291
1929
  showUnit = false;
1292
1930
  unit;
1293
1931
  unitType;
1294
- isEditable = true;
1295
- showHeader = true;
1296
- value = "";
1297
- isAddClickedOn = false;
1298
- isUpdated = false;
1299
- showEdit = false;
1300
- constructor() { }
1301
- ngOnInit() {
1302
- this.initialize();
1303
- }
1304
- initialize() {
1305
- if (this.value == "") {
1306
- this.isUpdated = false;
1307
- }
1308
- else {
1309
- this.isUpdated = true;
1310
- }
1311
- }
1312
- onClickAdd() {
1313
- this.isAddClickedOn = true;
1314
- }
1315
- onClickCancel() {
1316
- this.isAddClickedOn = false;
1317
- }
1318
- onClickSave(input) {
1319
- this.isAddClickedOn = false;
1320
- let value = input.value;
1321
- if (value.trim().length == 0) {
1322
- this.isUpdated = false;
1323
- }
1324
- else {
1325
- this.isUpdated = true;
1326
- }
1327
- this.value = value;
1328
- this.saveWasClicked.emit(value);
1329
- this.propagateChange(this.value);
1330
- }
1331
- onClickEdit() {
1332
- this.isAddClickedOn = true;
1333
- }
1334
- onMouseEnter() {
1335
- this.showEdit = true;
1336
- }
1337
- onMouseLeave() {
1338
- this.showEdit = false;
1339
- }
1340
- writeValue(value) {
1341
- if (value) {
1342
- this.value = value;
1343
- this.isUpdated = true;
1344
- }
1345
- }
1346
- // registers 'fn' that will be fired wheb changes are made
1347
- // this is how we emit the changes back to the form
1348
- registerOnChange(fn) {
1349
- this.propagateChange = fn;
1350
- }
1351
- registerOnTouched(fn) {
1352
- this.propogateTouch = fn;
1353
- }
1354
- // the method set in registerOnChange to emit changes back to the form
1355
- propagateChange = (_) => { };
1356
- propogateTouch = () => { };
1357
- onChange($event) {
1358
- //this.propagateChange(this.value);
1359
- }
1360
- updateBlur() {
1361
- this.propogateTouch();
1362
- }
1363
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditableSavableInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1364
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: EditableSavableInputComponent, selector: "editable-savable-input", inputs: { defaultvalue: "defaultvalue", inputType: "inputType", newLabel: "newLabel", headerLabel: "headerLabel", showUnit: "showUnit", unit: "unit", unitType: "unitType", isEditable: "isEditable", showHeader: "showHeader", value: "value" }, outputs: { saveWasClicked: "saveWasClicked" }, providers: [DynamicPipe,
1365
- {
1366
- provide: NG_VALUE_ACCESSOR,
1367
- useExisting: forwardRef(() => EditableSavableInputComponent),
1368
- multi: true
1369
- }
1370
- ], ngImport: i0, template: "<div *ngIf=\"showHeader\" class=\"header\">\r\n {{headerLabel}}\r\n</div>\r\n<div class=\"container\" [ngClass]=\"{'closed':!isAddClickedOn, 'open': isAddClickedOn}\">\r\n <div class=\"content\">\r\n <div class=\"default-content\" *ngIf=\"!isAddClickedOn && !isUpdated && isEditable\">\r\n <div class=\"add\" (click)=\"onClickAdd()\">\r\n {{defaultvalue}} </div>\r\n </div>\r\n <div class=\"edit-content\" *ngIf=\"isAddClickedOn\">\r\n <label class=\"input-label\" for=\"input\">{{newLabel}}</label>\r\n <div class=\"input \" [ngClass]=\"{'input-with-appended-unit': showUnit}\">\r\n <span *ngIf=\"showUnit\">{{unit}}</span>\r\n <input (change)=\"onChange($event)\" (blur)=\"updateBlur()\" [ngModel]=\"value\" [value]=\"value\" id=\"input\" #input\r\n class=\"form-control\" [ngClass]=\"{'input-box': showUnit}\" [type]=\"inputType\">\r\n </div>\r\n <div class=\"edit-actions\">\r\n <button type=\"button\" class=\"btn cancel\" (click)=\"onClickCancel()\" mat-raised-button>Cancel</button>\r\n <button type=\"button\" class=\"save\" (click)=\"onClickSave(input)\" mat-raised-button color=\"primary\">Save</button>\r\n </div>\r\n </div>\r\n <div class=\"updated-content closed\" *ngIf=\"!isAddClickedOn && isUpdated\" (mouseenter)=\"onMouseEnter()\"\r\n (mouseleave)=\"onMouseLeave()\">\r\n <div class=\"edit-icon-container\" *ngIf=\"showEdit && isEditable\" (click)=\"onClickEdit()\">\r\n <i class=\"fas fa-pencil-alt\"></i>\r\n </div>\r\n <div class=\"updated\">\r\n <span class=\"updated-label\">\r\n <label for=\"input\">{{newLabel}}</label>\r\n </span>\r\n <span *ngIf=\"!showUnit\">{{value}}</span>\r\n <span *ngIf=\"showUnit\" class=\"updated-value\">\r\n {{value | dynamicPipe: unitType}}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".container{display:block;width:100%}.open{height:120px}.closed{height:40px}.edit-icon-container{position:absolute;right:0%;transform:translate(0);top:0;cursor:pointer}.edit-icon-container:hover{background-color:gray;color:#fff;padding:2px}label,.updated-label{color:gray;margin-right:5px}#input{display:inline}.cancel{grid-column:1;grid-row:2;height:80%;width:80px}.save{grid-column:2;grid-row:2;height:80%;width:80px}.default-content{position:absolute}.input{width:280px;grid-column:2;grid-row:1}.input-box{width:200px}.input-label{grid-column:1;grid-row:1}.updated{position:absolute}.add{color:#00f}.add:hover{text-decoration:underline;cursor:pointer}.content{position:relative}.btn:focus{outline:none!important}.edit-content{position:absolute;left:50%;transform:translate(-50%);display:grid;grid-template-columns:150px 200px;grid-template-rows:50px 50px}.updated-content{display:block}.header{color:gray;border-bottom:1px solid grey;height:30px;font-size:20px;margin-bottom:10px;margin-top:10px}.input-with-appended-unit input{padding-left:20px;text-align:left}.input-with-appended-unit span{position:relative;left:20px;color:gray}.edit-actions{grid-column:2;grid-row:2;display:grid;grid-template-columns:50% 50%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: DynamicPipe, name: "dynamicPipe" }] });
1371
- }
1372
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditableSavableInputComponent, decorators: [{
1373
- type: Component,
1374
- args: [{ selector: 'editable-savable-input', providers: [DynamicPipe,
1375
- {
1376
- provide: NG_VALUE_ACCESSOR,
1377
- useExisting: forwardRef(() => EditableSavableInputComponent),
1378
- multi: true
1379
- }
1380
- ], template: "<div *ngIf=\"showHeader\" class=\"header\">\r\n {{headerLabel}}\r\n</div>\r\n<div class=\"container\" [ngClass]=\"{'closed':!isAddClickedOn, 'open': isAddClickedOn}\">\r\n <div class=\"content\">\r\n <div class=\"default-content\" *ngIf=\"!isAddClickedOn && !isUpdated && isEditable\">\r\n <div class=\"add\" (click)=\"onClickAdd()\">\r\n {{defaultvalue}} </div>\r\n </div>\r\n <div class=\"edit-content\" *ngIf=\"isAddClickedOn\">\r\n <label class=\"input-label\" for=\"input\">{{newLabel}}</label>\r\n <div class=\"input \" [ngClass]=\"{'input-with-appended-unit': showUnit}\">\r\n <span *ngIf=\"showUnit\">{{unit}}</span>\r\n <input (change)=\"onChange($event)\" (blur)=\"updateBlur()\" [ngModel]=\"value\" [value]=\"value\" id=\"input\" #input\r\n class=\"form-control\" [ngClass]=\"{'input-box': showUnit}\" [type]=\"inputType\">\r\n </div>\r\n <div class=\"edit-actions\">\r\n <button type=\"button\" class=\"btn cancel\" (click)=\"onClickCancel()\" mat-raised-button>Cancel</button>\r\n <button type=\"button\" class=\"save\" (click)=\"onClickSave(input)\" mat-raised-button color=\"primary\">Save</button>\r\n </div>\r\n </div>\r\n <div class=\"updated-content closed\" *ngIf=\"!isAddClickedOn && isUpdated\" (mouseenter)=\"onMouseEnter()\"\r\n (mouseleave)=\"onMouseLeave()\">\r\n <div class=\"edit-icon-container\" *ngIf=\"showEdit && isEditable\" (click)=\"onClickEdit()\">\r\n <i class=\"fas fa-pencil-alt\"></i>\r\n </div>\r\n <div class=\"updated\">\r\n <span class=\"updated-label\">\r\n <label for=\"input\">{{newLabel}}</label>\r\n </span>\r\n <span *ngIf=\"!showUnit\">{{value}}</span>\r\n <span *ngIf=\"showUnit\" class=\"updated-value\">\r\n {{value | dynamicPipe: unitType}}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".container{display:block;width:100%}.open{height:120px}.closed{height:40px}.edit-icon-container{position:absolute;right:0%;transform:translate(0);top:0;cursor:pointer}.edit-icon-container:hover{background-color:gray;color:#fff;padding:2px}label,.updated-label{color:gray;margin-right:5px}#input{display:inline}.cancel{grid-column:1;grid-row:2;height:80%;width:80px}.save{grid-column:2;grid-row:2;height:80%;width:80px}.default-content{position:absolute}.input{width:280px;grid-column:2;grid-row:1}.input-box{width:200px}.input-label{grid-column:1;grid-row:1}.updated{position:absolute}.add{color:#00f}.add:hover{text-decoration:underline;cursor:pointer}.content{position:relative}.btn:focus{outline:none!important}.edit-content{position:absolute;left:50%;transform:translate(-50%);display:grid;grid-template-columns:150px 200px;grid-template-rows:50px 50px}.updated-content{display:block}.header{color:gray;border-bottom:1px solid grey;height:30px;font-size:20px;margin-bottom:10px;margin-top:10px}.input-with-appended-unit input{padding-left:20px;text-align:left}.input-with-appended-unit span{position:relative;left:20px;color:gray}.edit-actions{grid-column:2;grid-row:2;display:grid;grid-template-columns:50% 50%}\n"] }]
1381
- }], ctorParameters: function () { return []; }, propDecorators: { saveWasClicked: [{
1382
- type: Output
1383
- }], defaultvalue: [{
1384
- type: Input
1385
- }], inputType: [{
1386
- type: Input
1387
- }], newLabel: [{
1388
- type: Input
1389
- }], headerLabel: [{
1390
- type: Input
1391
- }], showUnit: [{
1392
- type: Input
1393
- }], unit: [{
1394
- type: Input
1395
- }], unitType: [{
1396
- type: Input
1397
- }], isEditable: [{
1398
- type: Input
1399
- }], showHeader: [{
1400
- type: Input
1401
- }], value: [{
1402
- type: Input
1403
- }] } });
1404
-
1405
- class CustomDecimalPointTwoDigitsDirective {
1406
- control;
1407
- valueSubscription;
1408
- constructor(control) {
1409
- this.control = control;
1410
- }
1411
- ngOnInit() {
1412
- if (this.control.value) {
1413
- this.control.valueAccessor.writeValue(this.transformToCommasAndPoint(this.control.value));
1414
- }
1415
- this.valueSubscription = this.control.control.valueChanges.subscribe(value => {
1416
- if (value.length > 0) {
1417
- let removeCommas = this.control.value.replace(/,/g, '');
1418
- this.control.control.setValue(removeCommas, { emitEvent: false, emitModelToViewChange: false });
1419
- }
1420
- else {
1421
- this.control.control.setValue(null, { emitEvent: false, emitModelToViewChange: false });
1422
- }
1423
- });
1424
- }
1425
- onEvent($event) {
1426
- if (this.control.value) {
1427
- const item = $event.target;
1428
- item.value = this.transformToCommasAndPoint(this.control.value);
1429
- let removeCommas = this.control.value.replace(/,/g, '');
1430
- this.control.control.setValue(removeCommas, { emitEvent: false, emitModelToViewChange: false });
1431
- }
1432
- }
1433
- transformToCommasAndPoint(value) {
1434
- if (value.indexOf(".") == -1) {
1435
- value = value.toString().replace(/\D/g, "")
1436
- .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1437
- return value;
1438
- }
1439
- else {
1440
- let val = value.split(".");
1441
- let valueBeforeDecimal = val[0];
1442
- let valueAfterDecimal = val[1];
1443
- valueBeforeDecimal = valueBeforeDecimal.toString().replace(/\D/g, "")
1444
- .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1445
- let newValue = `${valueBeforeDecimal}.${valueAfterDecimal}`;
1446
- return newValue;
1447
- }
1448
- }
1449
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomDecimalPointTwoDigitsDirective, deps: [{ token: i2$1.NgControl }], target: i0.ɵɵFactoryTarget.Directive });
1450
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: CustomDecimalPointTwoDigitsDirective, selector: "[customDecimalPointTwoDigits]", host: { listeners: { "input": "onEvent($event)" } }, providers: [NgModel, DecimalPipe], ngImport: i0 });
1451
- }
1452
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomDecimalPointTwoDigitsDirective, decorators: [{
1453
- type: Directive,
1454
- args: [{
1455
- selector: '[customDecimalPointTwoDigits]',
1456
- providers: [NgModel, DecimalPipe],
1457
- }]
1458
- }], ctorParameters: function () { return [{ type: i2$1.NgControl }]; }, propDecorators: { onEvent: [{
1459
- type: HostListener,
1460
- args: ["input", ["$event"]]
1461
- }] } });
1462
-
1463
- class ValidationMessageService {
1464
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ValidationMessageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1465
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ValidationMessageService, providedIn: 'root' });
1466
- }
1467
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ValidationMessageService, decorators: [{
1468
- type: Injectable,
1469
- args: [{
1470
- providedIn: 'root'
1471
- }]
1472
- }] });
1473
- class MinLengthValidationError {
1474
- requirement;
1475
- constructor(requirement) {
1476
- this.requirement = requirement;
1477
- }
1478
- buildMessage() {
1479
- return "Must be a minimum length of " + this.requirement + " letters!";
1480
- }
1481
- }
1482
- class InvalidIntegerNumberValidatorEerror {
1483
- buildMessage() {
1484
- return "Must only contain numbers, no decimals or words allowed";
1485
- }
1486
- }
1487
- class PositiveIntegerNumberValidatorError {
1488
- buildMessage() {
1489
- return "Must be a positive integer";
1932
+ isEditable = true;
1933
+ showHeader = true;
1934
+ value = "";
1935
+ isAddClickedOn = false;
1936
+ isUpdated = false;
1937
+ showEdit = false;
1938
+ constructor() { }
1939
+ ngOnInit() {
1940
+ this.initialize();
1490
1941
  }
1491
- }
1492
- class MaxLengthValidationError {
1493
- requirement;
1494
- constructor(requirement) {
1495
- this.requirement = requirement;
1942
+ initialize() {
1943
+ if (this.value == "") {
1944
+ this.isUpdated = false;
1945
+ }
1946
+ else {
1947
+ this.isUpdated = true;
1948
+ }
1496
1949
  }
1497
- buildMessage() {
1498
- return "Must be a maximum length of " + this.requirement + " letters!";
1950
+ onClickAdd() {
1951
+ this.isAddClickedOn = true;
1499
1952
  }
1500
- }
1501
- class MaxValidationError {
1502
- requirement;
1503
- constructor(requirement) {
1504
- this.requirement = requirement;
1953
+ onClickCancel() {
1954
+ this.isAddClickedOn = false;
1505
1955
  }
1506
- buildMessage() {
1507
- return "The largest acceptable input is " + this.requirement;
1956
+ onClickSave(input) {
1957
+ this.isAddClickedOn = false;
1958
+ let value = input.value;
1959
+ if (value.trim().length == 0) {
1960
+ this.isUpdated = false;
1961
+ }
1962
+ else {
1963
+ this.isUpdated = true;
1964
+ }
1965
+ this.value = value;
1966
+ this.saveWasClicked.emit(value);
1967
+ this.propagateChange(this.value);
1508
1968
  }
1509
- }
1510
- class MinValidationError {
1511
- requirement;
1512
- constructor(requirement) {
1513
- this.requirement = requirement;
1969
+ onClickEdit() {
1970
+ this.isAddClickedOn = true;
1514
1971
  }
1515
- buildMessage() {
1516
- return "The smallest acceptable input is " + this.requirement;
1972
+ onMouseEnter() {
1973
+ this.showEdit = true;
1517
1974
  }
1518
- }
1519
- class PatternValidatorError {
1520
- requirement;
1521
- constructor(requirement) {
1522
- this.requirement = requirement;
1975
+ onMouseLeave() {
1976
+ this.showEdit = false;
1523
1977
  }
1524
- buildMessage() {
1525
- if (this.requirement == '^[a-zA-Z ]*$') {
1526
- return "This field must only contain words ";
1527
- }
1528
- else if (this.requirement == '/[0-9]-[0-9]+$/') {
1529
- return "This field must only contain numbers and a - " + "<br>" + "Example: 71-716971";
1530
- }
1531
- else if (this.requirement = 'forDate') {
1532
- return "Date needs to be DD/MM/YYYY";
1978
+ writeValue(value) {
1979
+ if (value) {
1980
+ this.value = value;
1981
+ this.isUpdated = true;
1533
1982
  }
1534
1983
  }
1535
- }
1536
- class RequiredValidatorError {
1537
- buildMessage() {
1538
- return "This Field Is Required";
1984
+ // registers 'fn' that will be fired wheb changes are made
1985
+ // this is how we emit the changes back to the form
1986
+ registerOnChange(fn) {
1987
+ this.propagateChange = fn;
1539
1988
  }
1540
- }
1541
- class EmailValidatorError {
1542
- buildMessage() {
1543
- return "Make Sure It Is An Email Format" + "<br>" + "example@jooler.io";
1989
+ registerOnTouched(fn) {
1990
+ this.propogateTouch = fn;
1544
1991
  }
1545
- }
1546
- class ValidationError {
1547
- static getRelevantError(validationType, validationValue) {
1548
- let validationMessage;
1549
- validationMessage = this.MessageDictionary(validationValue, validationType);
1550
- return validationMessage;
1992
+ // the method set in registerOnChange to emit changes back to the form
1993
+ propagateChange = (_) => { };
1994
+ propogateTouch = () => { };
1995
+ onChange($event) {
1996
+ //this.propagateChange(this.value);
1551
1997
  }
1552
- static MessageDictionary(value, validationType) {
1553
- let ValidationMessageForInput = {
1554
- 'minlength': new MinLengthValidationError(value).buildMessage(),
1555
- 'maxlength': new MaxLengthValidationError(value).buildMessage(),
1556
- 'max': new MaxValidationError(value).buildMessage(),
1557
- 'min': new MinValidationError(value).buildMessage(),
1558
- 'pattern': new PatternValidatorError(value).buildMessage(),
1559
- 'required': new RequiredValidatorError().buildMessage(),
1560
- 'email': new EmailValidatorError().buildMessage(),
1561
- 'invalidIntegerNumber': new InvalidIntegerNumberValidatorEerror().buildMessage(),
1562
- 'invalidPositiveInteger': new PositiveIntegerNumberValidatorError().buildMessage(),
1563
- };
1564
- return ValidationMessageForInput[validationType];
1998
+ updateBlur() {
1999
+ this.propogateTouch();
1565
2000
  }
1566
- static validationMessageForDate = {
1567
- 'required': new RequiredValidatorError().buildMessage(),
1568
- 'pattern': new PatternValidatorError('forDate').buildMessage(),
1569
- };
2001
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditableSavableInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2002
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: EditableSavableInputComponent, selector: "editable-savable-input", inputs: { defaultvalue: "defaultvalue", inputType: "inputType", newLabel: "newLabel", headerLabel: "headerLabel", showUnit: "showUnit", unit: "unit", unitType: "unitType", isEditable: "isEditable", showHeader: "showHeader", value: "value" }, outputs: { saveWasClicked: "saveWasClicked" }, providers: [DynamicPipe,
2003
+ {
2004
+ provide: NG_VALUE_ACCESSOR,
2005
+ useExisting: forwardRef(() => EditableSavableInputComponent),
2006
+ multi: true
2007
+ }
2008
+ ], ngImport: i0, template: "<div *ngIf=\"showHeader\" class=\"header\">\r\n {{headerLabel}}\r\n</div>\r\n<div class=\"container\" [ngClass]=\"{'closed':!isAddClickedOn, 'open': isAddClickedOn}\">\r\n <div class=\"content\">\r\n <div class=\"default-content\" *ngIf=\"!isAddClickedOn && !isUpdated && isEditable\">\r\n <div class=\"add\" (click)=\"onClickAdd()\">\r\n {{defaultvalue}} </div>\r\n </div>\r\n <div class=\"edit-content\" *ngIf=\"isAddClickedOn\">\r\n <label class=\"input-label\" for=\"input\">{{newLabel}}</label>\r\n <div class=\"input \" [ngClass]=\"{'input-with-appended-unit': showUnit}\">\r\n <span *ngIf=\"showUnit\">{{unit}}</span>\r\n <input (change)=\"onChange($event)\" (blur)=\"updateBlur()\" [ngModel]=\"value\" [value]=\"value\" id=\"input\" #input\r\n class=\"form-control\" [ngClass]=\"{'input-box': showUnit}\" [type]=\"inputType\">\r\n </div>\r\n <div class=\"edit-actions\">\r\n <button type=\"button\" class=\"btn cancel\" (click)=\"onClickCancel()\" mat-raised-button>Cancel</button>\r\n <button type=\"button\" class=\"save\" (click)=\"onClickSave(input)\" mat-raised-button color=\"primary\">Save</button>\r\n </div>\r\n </div>\r\n <div class=\"updated-content closed\" *ngIf=\"!isAddClickedOn && isUpdated\" (mouseenter)=\"onMouseEnter()\"\r\n (mouseleave)=\"onMouseLeave()\">\r\n <div class=\"edit-icon-container\" *ngIf=\"showEdit && isEditable\" (click)=\"onClickEdit()\">\r\n <i class=\"fas fa-pencil-alt\"></i>\r\n </div>\r\n <div class=\"updated\">\r\n <span class=\"updated-label\">\r\n <label for=\"input\">{{newLabel}}</label>\r\n </span>\r\n <span *ngIf=\"!showUnit\">{{value}}</span>\r\n <span *ngIf=\"showUnit\" class=\"updated-value\">\r\n {{value | dynamicPipe: unitType}}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".container{display:block;width:100%}.open{height:120px}.closed{height:40px}.edit-icon-container{position:absolute;right:0%;transform:translate(0);top:0;cursor:pointer}.edit-icon-container:hover{background-color:gray;color:#fff;padding:2px}label,.updated-label{color:gray;margin-right:5px}#input{display:inline}.cancel{grid-column:1;grid-row:2;height:80%;width:80px}.save{grid-column:2;grid-row:2;height:80%;width:80px}.default-content{position:absolute}.input{width:280px;grid-column:2;grid-row:1}.input-box{width:200px}.input-label{grid-column:1;grid-row:1}.updated{position:absolute}.add{color:#00f}.add:hover{text-decoration:underline;cursor:pointer}.content{position:relative}.btn:focus{outline:none!important}.edit-content{position:absolute;left:50%;transform:translate(-50%);display:grid;grid-template-columns:150px 200px;grid-template-rows:50px 50px}.updated-content{display:block}.header{color:gray;border-bottom:1px solid grey;height:30px;font-size:20px;margin-bottom:10px;margin-top:10px}.input-with-appended-unit input{padding-left:20px;text-align:left}.input-with-appended-unit span{position:relative;left:20px;color:gray}.edit-actions{grid-column:2;grid-row:2;display:grid;grid-template-columns:50% 50%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: DynamicPipe, name: "dynamicPipe" }] });
1570
2009
  }
2010
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditableSavableInputComponent, decorators: [{
2011
+ type: Component,
2012
+ args: [{ selector: 'editable-savable-input', providers: [DynamicPipe,
2013
+ {
2014
+ provide: NG_VALUE_ACCESSOR,
2015
+ useExisting: forwardRef(() => EditableSavableInputComponent),
2016
+ multi: true
2017
+ }
2018
+ ], template: "<div *ngIf=\"showHeader\" class=\"header\">\r\n {{headerLabel}}\r\n</div>\r\n<div class=\"container\" [ngClass]=\"{'closed':!isAddClickedOn, 'open': isAddClickedOn}\">\r\n <div class=\"content\">\r\n <div class=\"default-content\" *ngIf=\"!isAddClickedOn && !isUpdated && isEditable\">\r\n <div class=\"add\" (click)=\"onClickAdd()\">\r\n {{defaultvalue}} </div>\r\n </div>\r\n <div class=\"edit-content\" *ngIf=\"isAddClickedOn\">\r\n <label class=\"input-label\" for=\"input\">{{newLabel}}</label>\r\n <div class=\"input \" [ngClass]=\"{'input-with-appended-unit': showUnit}\">\r\n <span *ngIf=\"showUnit\">{{unit}}</span>\r\n <input (change)=\"onChange($event)\" (blur)=\"updateBlur()\" [ngModel]=\"value\" [value]=\"value\" id=\"input\" #input\r\n class=\"form-control\" [ngClass]=\"{'input-box': showUnit}\" [type]=\"inputType\">\r\n </div>\r\n <div class=\"edit-actions\">\r\n <button type=\"button\" class=\"btn cancel\" (click)=\"onClickCancel()\" mat-raised-button>Cancel</button>\r\n <button type=\"button\" class=\"save\" (click)=\"onClickSave(input)\" mat-raised-button color=\"primary\">Save</button>\r\n </div>\r\n </div>\r\n <div class=\"updated-content closed\" *ngIf=\"!isAddClickedOn && isUpdated\" (mouseenter)=\"onMouseEnter()\"\r\n (mouseleave)=\"onMouseLeave()\">\r\n <div class=\"edit-icon-container\" *ngIf=\"showEdit && isEditable\" (click)=\"onClickEdit()\">\r\n <i class=\"fas fa-pencil-alt\"></i>\r\n </div>\r\n <div class=\"updated\">\r\n <span class=\"updated-label\">\r\n <label for=\"input\">{{newLabel}}</label>\r\n </span>\r\n <span *ngIf=\"!showUnit\">{{value}}</span>\r\n <span *ngIf=\"showUnit\" class=\"updated-value\">\r\n {{value | dynamicPipe: unitType}}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".container{display:block;width:100%}.open{height:120px}.closed{height:40px}.edit-icon-container{position:absolute;right:0%;transform:translate(0);top:0;cursor:pointer}.edit-icon-container:hover{background-color:gray;color:#fff;padding:2px}label,.updated-label{color:gray;margin-right:5px}#input{display:inline}.cancel{grid-column:1;grid-row:2;height:80%;width:80px}.save{grid-column:2;grid-row:2;height:80%;width:80px}.default-content{position:absolute}.input{width:280px;grid-column:2;grid-row:1}.input-box{width:200px}.input-label{grid-column:1;grid-row:1}.updated{position:absolute}.add{color:#00f}.add:hover{text-decoration:underline;cursor:pointer}.content{position:relative}.btn:focus{outline:none!important}.edit-content{position:absolute;left:50%;transform:translate(-50%);display:grid;grid-template-columns:150px 200px;grid-template-rows:50px 50px}.updated-content{display:block}.header{color:gray;border-bottom:1px solid grey;height:30px;font-size:20px;margin-bottom:10px;margin-top:10px}.input-with-appended-unit input{padding-left:20px;text-align:left}.input-with-appended-unit span{position:relative;left:20px;color:gray}.edit-actions{grid-column:2;grid-row:2;display:grid;grid-template-columns:50% 50%}\n"] }]
2019
+ }], ctorParameters: function () { return []; }, propDecorators: { saveWasClicked: [{
2020
+ type: Output
2021
+ }], defaultvalue: [{
2022
+ type: Input
2023
+ }], inputType: [{
2024
+ type: Input
2025
+ }], newLabel: [{
2026
+ type: Input
2027
+ }], headerLabel: [{
2028
+ type: Input
2029
+ }], showUnit: [{
2030
+ type: Input
2031
+ }], unit: [{
2032
+ type: Input
2033
+ }], unitType: [{
2034
+ type: Input
2035
+ }], isEditable: [{
2036
+ type: Input
2037
+ }], showHeader: [{
2038
+ type: Input
2039
+ }], value: [{
2040
+ type: Input
2041
+ }] } });
1571
2042
 
1572
2043
  class FormControlValidationMsgDirectiveForInput {
1573
2044
  elRef;
@@ -1715,89 +2186,118 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1715
2186
  }] } });
1716
2187
 
1717
2188
  class GeneralInputRendererComponent {
1718
- params;
1719
- key;
1720
- value;
2189
+ arrayKey = 'entries';
1721
2190
  formGroup;
1722
- formControlName;
2191
+ key;
2192
+ params;
2193
+ isEdit = true;
2194
+ uniquenessApiPath;
2195
+ uniquenessSubscriber;
2196
+ readonly = false;
1723
2197
  constructor() { }
1724
2198
  agInit(params) {
1725
2199
  this.params = params;
1726
- this.formGroup = this.params.context.formGroup.get('entries').at(params.node.rowIndex);
2200
+ if (params.context.arrayKey) {
2201
+ this.arrayKey = params.context.arrayKey;
2202
+ }
2203
+ this.formGroup = this.params.context.formGroup
2204
+ .get(this.arrayKey)
2205
+ .at(params.node.rowIndex);
1727
2206
  this.key = params.context.createKey(params.columnApi, params.column);
1728
- if (params.isTypeNumber) {
1729
- if (params.value) {
1730
- this.value = new DecimalPipe("en-US").transform(+params.value, "1.0-0");
1731
- }
2207
+ if (params.context.isEdit != undefined && params.context.isEdit != null) {
2208
+ this.isEdit = params.context.isEdit;
1732
2209
  }
1733
- else {
1734
- this.value = params.value;
2210
+ if (params.readonly != undefined && params.readonly != null) {
2211
+ this.readonly = params.readonly;
2212
+ }
2213
+ if (this.params.uniquenessApiPath != undefined && this.params.uniquenessApiPath != null) {
2214
+ this.uniquenessApiPath = this.params.uniquenessApiPath;
1735
2215
  }
1736
2216
  }
1737
2217
  onCellDataChanged($event) {
1738
2218
  let value = $event.target.value;
1739
- let newAndOldValue = {
2219
+ let changeEvent = {
1740
2220
  newValue: value,
1741
- oldValue: this.params?.value
2221
+ oldValue: this.params?.value,
2222
+ rowNode: this.params.node,
1742
2223
  };
1743
- if (this.params.allowUpdateRowData) {
1744
- this.params.onChange(newAndOldValue);
2224
+ let rowNode = this.params.node;
2225
+ rowNode.setDataValue(this.key, value);
2226
+ if (this.params.onChange instanceof Function) {
2227
+ this.params.onChange(changeEvent);
1745
2228
  }
1746
2229
  }
1747
2230
  refresh(params) {
1748
- this.formGroup = this.params.context.formGroup.get('entries').at(params.node.rowIndex);
2231
+ this.formGroup = params.context.formGroup.get(this.arrayKey).at(params.node.rowIndex);
2232
+ if (params.context.isEdit != undefined && params.context.isEdit != null) {
2233
+ this.isEdit = params.context.isEdit;
2234
+ }
1749
2235
  return true;
1750
2236
  }
1751
2237
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GeneralInputRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1752
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GeneralInputRendererComponent, selector: "general-input-renderer-test", ngImport: i0, template: "<div *ngIf=\"formGroup\" [formGroup]=\"formGroup\">\r\n <div *ngIf=\"params.isTypeText\">\r\n <input [placeholder]=\"params.fieldLabel\"appFormControlValidationMsgForInputs [showBoxError]=\"false\"\r\n [errorDivId]=\"'text'\" \r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\" />\r\n <span *ngIf=\"params.showSymbol\"\r\n style=\"margin-left:-20px ;\">{{params.symbol}}</span>\r\n <show-table-errors\r\n *ngIf=\"formGroup.get(this.key).errors && formGroup.get(this.key) && formGroup.get(this.key).touched\"\r\n [message]=\"formGroup.get(this.key).errors.message\"></show-table-errors>\r\n </div>\r\n <div *ngIf=\"params.isTypeNumber\">\r\n <input customDecimalPointTwoDigits appFormControlValidationMsgForInputs [showBoxError]=\"false\"\r\n [errorDivId]=\"'number'\" [placeholder]=\"params.fieldLabel\"\r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\" />\r\n <span *ngIf=\"params.showSymbol\"\r\n style=\"margin-left:-20px ;\">{{params.symbol}}</span>\r\n <show-table-errors\r\n *ngIf=\"formGroup.get(this.key).errors && formGroup.get(this.key).touched\"\r\n [message]=\"formGroup.get(this.key).errors.message\"></show-table-errors>\r\n </div>\r\n <div *ngIf=\"params.isTypeIntegerNumber\">\r\n <input appFormControlValidationMsgForInputs [showBoxError]=\"false\"type=\"number\"\r\n [errorDivId]=\"'integer'\" [placeholder]=\"params.fieldLabel\"\r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\" />\r\n <span *ngIf=\"params.showSymbol\"\r\n style=\"margin-left:-20px ;\">{{params.symbol}}</span>\r\n <show-table-errors\r\n *ngIf=\"formGroup.get(this.key).errors && formGroup.get(this.key).touched\"\r\n [message]=\"formGroup.get(this.key).errors.message\"></show-table-errors>\r\n </div>\r\n <div *ngIf=\"params.isTypeTextArea\">\r\n <textarea class=\"text-area\" (change)=\"onCellDataChanged($event)\"\r\n [placeholder]=\"params.fieldLabel\" class=\"main-height\"\r\n [formControlName]=\"key\"></textarea>\r\n </div>\r\n</div>", styles: ["textarea{padding-left:.5rem;border-radius:.3rem;height:3.5rem;font-size:1.2rem;border:solid #BEBEBE .1rem}textarea:focus{outline:none}textarea::placeholder{color:#676767}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.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$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: CustomDecimalPointTwoDigitsDirective, selector: "[customDecimalPointTwoDigits]" }, { kind: "component", type: ShowTableErrorsComponent, selector: "show-table-errors", inputs: ["message"] }, { kind: "directive", type: FormControlValidationMsgDirectiveForInput, selector: "[appFormControlValidationMsgForInputs]", inputs: ["showBoxError", "errorDivId", "beforeBegin", "afterEnd"] }] });
2238
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GeneralInputRendererComponent, selector: "general-input-renderer-test", ngImport: i0, template: "<ng-container *ngIf=\"formGroup\" [formGroup]=\"formGroup\">\r\n <div [ngClass]=\"{ 'ag-description': params.isTypeTextArea }\" *ngIf=\"!isEdit\">\r\n <span>{{ formGroup.get(key).value }}</span>\r\n </div>\r\n\r\n <ng-container *ngIf=\"params.isTypeTextArea\">\r\n <div *ngIf=\"isEdit\" class=\"input-wrapper\">\r\n <textarea [readonly]=\"readonly\" appFormControlValidationMsgForInputs\r\n [showBoxError]=\"false\"\r\n [style.width.px]=\"params.column.getActualWidth() - 20\"\r\n [style.height.px]=\" params.node.rowHeight - 20\"\r\n (change)=\"onCellDataChanged($event)\" [placeholder]=\"params.placeholder\"\r\n [formControlName]=\"key\"></textarea>\r\n <tooltip-msg-error [control]=\"formGroup.get(this.key)\" *ngIf=\"\r\n formGroup.get(this.key).errors && formGroup.get(this.key).touched\r\n \"></tooltip-msg-error>\r\n </div>\r\n </ng-container>\r\n\r\n <div *ngIf=\"params.isTypeText && isEdit\" class=\"cont\">\r\n <input [readonly]=\"readonly\" [placeholder]=\"params.placeholder\"\r\n appFormControlValidationMsgForInputs [showBoxError]=\"false\"\r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\" />\r\n <span *ngIf=\"params.showSymbol\" style=\"margin-left: -2.2rem\">{{ params.symbol\r\n }}</span>\r\n <tooltip-msg-error\r\n *ngIf=\"formGroup.get(key).errors && formGroup.get(key) && formGroup.get(key).touched\"\r\n [message]=\"formGroup.get(key).errors.message\"></tooltip-msg-error>\r\n </div>\r\n\r\n <div *ngIf=\"params.isTypeNumber && isEdit\" class=\"input-wrapper\">\r\n <div class=\"input-symbol-group\">\r\n <input [readonly]=\"readonly\" appFormControlValidationMsgForInputs\r\n [showBoxError]=\"false\" [placeholder]=\"params.placeholder\"\r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\"\r\n type=\"number\" />\r\n <span class=\"symbol\" *ngIf=\"params.showSymbol\">{{ params.symbol }}</span>\r\n </div>\r\n\r\n <tooltip-msg-error\r\n *ngIf=\"formGroup.get(key)?.errors && formGroup.get(key)?.touched\"\r\n [message]=\"formGroup.get(key)?.errors.message\"></tooltip-msg-error>\r\n </div>\r\n <div *ngIf=\"params.isTypeIntegerNumber && isEdit\" class=\"cont\">\r\n <input [readonly]=\"readonly\" appFormControlValidationMsgForInputs\r\n [showBoxError]=\"false\" [placeholder]=\"params.placeholder\"\r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\" type=\"number\" />\r\n <span class=\"symbol\" *ngIf=\"params.showSymbol\" style=\"margin-left: -2.2rem\">{{\r\n params.symbol\r\n }}</span>\r\n <tooltip-msg-error *ngIf=\"formGroup.get(key).errors && formGroup.get(key).touched\"\r\n [message]=\"formGroup.get(key).errors.message\"></tooltip-msg-error>\r\n </div>\r\n</ng-container>", styles: [".symbol{color:#155ed4}textarea{height:98%}.cont{display:flex;align-items:center;gap:.5rem}.input-wrapper{display:flex;align-items:center;gap:.25rem}.input-symbol-group{display:flex;align-items:center;position:relative}.input-symbol-group input{padding-right:1.5rem}.symbol{position:absolute;right:1rem;pointer-events:none;color:#155ed4;z-index:2}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.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$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: FormControlValidationMsgDirectiveForInput, selector: "[appFormControlValidationMsgForInputs]", inputs: ["showBoxError", "errorDivId", "beforeBegin", "afterEnd"] }, { kind: "component", type: TooltipMsgError, selector: "tooltip-msg-error", inputs: ["width", "control", "messageType", "message"] }] });
1753
2239
  }
1754
2240
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GeneralInputRendererComponent, decorators: [{
1755
2241
  type: Component,
1756
- args: [{ selector: 'general-input-renderer-test', template: "<div *ngIf=\"formGroup\" [formGroup]=\"formGroup\">\r\n <div *ngIf=\"params.isTypeText\">\r\n <input [placeholder]=\"params.fieldLabel\"appFormControlValidationMsgForInputs [showBoxError]=\"false\"\r\n [errorDivId]=\"'text'\" \r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\" />\r\n <span *ngIf=\"params.showSymbol\"\r\n style=\"margin-left:-20px ;\">{{params.symbol}}</span>\r\n <show-table-errors\r\n *ngIf=\"formGroup.get(this.key).errors && formGroup.get(this.key) && formGroup.get(this.key).touched\"\r\n [message]=\"formGroup.get(this.key).errors.message\"></show-table-errors>\r\n </div>\r\n <div *ngIf=\"params.isTypeNumber\">\r\n <input customDecimalPointTwoDigits appFormControlValidationMsgForInputs [showBoxError]=\"false\"\r\n [errorDivId]=\"'number'\" [placeholder]=\"params.fieldLabel\"\r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\" />\r\n <span *ngIf=\"params.showSymbol\"\r\n style=\"margin-left:-20px ;\">{{params.symbol}}</span>\r\n <show-table-errors\r\n *ngIf=\"formGroup.get(this.key).errors && formGroup.get(this.key).touched\"\r\n [message]=\"formGroup.get(this.key).errors.message\"></show-table-errors>\r\n </div>\r\n <div *ngIf=\"params.isTypeIntegerNumber\">\r\n <input appFormControlValidationMsgForInputs [showBoxError]=\"false\"type=\"number\"\r\n [errorDivId]=\"'integer'\" [placeholder]=\"params.fieldLabel\"\r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\" />\r\n <span *ngIf=\"params.showSymbol\"\r\n style=\"margin-left:-20px ;\">{{params.symbol}}</span>\r\n <show-table-errors\r\n *ngIf=\"formGroup.get(this.key).errors && formGroup.get(this.key).touched\"\r\n [message]=\"formGroup.get(this.key).errors.message\"></show-table-errors>\r\n </div>\r\n <div *ngIf=\"params.isTypeTextArea\">\r\n <textarea class=\"text-area\" (change)=\"onCellDataChanged($event)\"\r\n [placeholder]=\"params.fieldLabel\" class=\"main-height\"\r\n [formControlName]=\"key\"></textarea>\r\n </div>\r\n</div>", styles: ["textarea{padding-left:.5rem;border-radius:.3rem;height:3.5rem;font-size:1.2rem;border:solid #BEBEBE .1rem}textarea:focus{outline:none}textarea::placeholder{color:#676767}\n"] }]
2242
+ args: [{ selector: 'general-input-renderer-test', template: "<ng-container *ngIf=\"formGroup\" [formGroup]=\"formGroup\">\r\n <div [ngClass]=\"{ 'ag-description': params.isTypeTextArea }\" *ngIf=\"!isEdit\">\r\n <span>{{ formGroup.get(key).value }}</span>\r\n </div>\r\n\r\n <ng-container *ngIf=\"params.isTypeTextArea\">\r\n <div *ngIf=\"isEdit\" class=\"input-wrapper\">\r\n <textarea [readonly]=\"readonly\" appFormControlValidationMsgForInputs\r\n [showBoxError]=\"false\"\r\n [style.width.px]=\"params.column.getActualWidth() - 20\"\r\n [style.height.px]=\" params.node.rowHeight - 20\"\r\n (change)=\"onCellDataChanged($event)\" [placeholder]=\"params.placeholder\"\r\n [formControlName]=\"key\"></textarea>\r\n <tooltip-msg-error [control]=\"formGroup.get(this.key)\" *ngIf=\"\r\n formGroup.get(this.key).errors && formGroup.get(this.key).touched\r\n \"></tooltip-msg-error>\r\n </div>\r\n </ng-container>\r\n\r\n <div *ngIf=\"params.isTypeText && isEdit\" class=\"cont\">\r\n <input [readonly]=\"readonly\" [placeholder]=\"params.placeholder\"\r\n appFormControlValidationMsgForInputs [showBoxError]=\"false\"\r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\" />\r\n <span *ngIf=\"params.showSymbol\" style=\"margin-left: -2.2rem\">{{ params.symbol\r\n }}</span>\r\n <tooltip-msg-error\r\n *ngIf=\"formGroup.get(key).errors && formGroup.get(key) && formGroup.get(key).touched\"\r\n [message]=\"formGroup.get(key).errors.message\"></tooltip-msg-error>\r\n </div>\r\n\r\n <div *ngIf=\"params.isTypeNumber && isEdit\" class=\"input-wrapper\">\r\n <div class=\"input-symbol-group\">\r\n <input [readonly]=\"readonly\" appFormControlValidationMsgForInputs\r\n [showBoxError]=\"false\" [placeholder]=\"params.placeholder\"\r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\"\r\n type=\"number\" />\r\n <span class=\"symbol\" *ngIf=\"params.showSymbol\">{{ params.symbol }}</span>\r\n </div>\r\n\r\n <tooltip-msg-error\r\n *ngIf=\"formGroup.get(key)?.errors && formGroup.get(key)?.touched\"\r\n [message]=\"formGroup.get(key)?.errors.message\"></tooltip-msg-error>\r\n </div>\r\n <div *ngIf=\"params.isTypeIntegerNumber && isEdit\" class=\"cont\">\r\n <input [readonly]=\"readonly\" appFormControlValidationMsgForInputs\r\n [showBoxError]=\"false\" [placeholder]=\"params.placeholder\"\r\n (change)=\"onCellDataChanged($event)\" [formControlName]=\"key\" type=\"number\" />\r\n <span class=\"symbol\" *ngIf=\"params.showSymbol\" style=\"margin-left: -2.2rem\">{{\r\n params.symbol\r\n }}</span>\r\n <tooltip-msg-error *ngIf=\"formGroup.get(key).errors && formGroup.get(key).touched\"\r\n [message]=\"formGroup.get(key).errors.message\"></tooltip-msg-error>\r\n </div>\r\n</ng-container>", styles: [".symbol{color:#155ed4}textarea{height:98%}.cont{display:flex;align-items:center;gap:.5rem}.input-wrapper{display:flex;align-items:center;gap:.25rem}.input-symbol-group{display:flex;align-items:center;position:relative}.input-symbol-group input{padding-right:1.5rem}.symbol{position:absolute;right:1rem;pointer-events:none;color:#155ed4;z-index:2}\n"] }]
1757
2243
  }], ctorParameters: function () { return []; } });
1758
2244
 
1759
- class LabelAndField {
1760
- label;
1761
- field;
1762
- }
1763
-
1764
- class AddAsteriskDirective {
1765
- elem;
1766
- show = true;
1767
- constructor(elem) {
1768
- this.elem = elem;
2245
+ class CustomDecimalPointTwoDigitsDirective {
2246
+ control;
2247
+ valueSubscription;
2248
+ constructor(control) {
2249
+ this.control = control;
1769
2250
  }
1770
2251
  ngOnInit() {
1771
- this.toggleAsterisk();
2252
+ if (this.control.value) {
2253
+ this.control.valueAccessor.writeValue(this.transformToCommasAndPoint(this.control.value));
2254
+ }
2255
+ this.valueSubscription = this.control.control.valueChanges.subscribe(value => {
2256
+ if (value.length > 0) {
2257
+ let removeCommas = this.control.value.replace(/,/g, '');
2258
+ this.control.control.setValue(removeCommas, { emitEvent: false, emitModelToViewChange: false });
2259
+ }
2260
+ else {
2261
+ this.control.control.setValue(null, { emitEvent: false, emitModelToViewChange: false });
2262
+ }
2263
+ });
1772
2264
  }
1773
- ngOnChanges(changes) {
1774
- this.toggleAsterisk();
2265
+ onEvent($event) {
2266
+ if (this.control.value) {
2267
+ const item = $event.target;
2268
+ item.value = this.transformToCommasAndPoint(this.control.value);
2269
+ let removeCommas = this.control.value.replace(/,/g, '');
2270
+ this.control.control.setValue(removeCommas, { emitEvent: false, emitModelToViewChange: false });
2271
+ }
1775
2272
  }
1776
- toggleAsterisk() {
1777
- const existingAsterisk = this.elem.nativeElement.querySelector('.custom-asterisk');
1778
- if (this.show) {
1779
- if (!existingAsterisk) {
1780
- const customAsterisk = `<span class="custom-asterisk" style="color:${PrimaryColors.$primaryRedColor};"> *</span> `;
1781
- this.elem.nativeElement.insertAdjacentHTML('beforeend', customAsterisk);
1782
- }
2273
+ transformToCommasAndPoint(value) {
2274
+ if (value.indexOf(".") == -1) {
2275
+ value = value.toString().replace(/\D/g, "")
2276
+ .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
2277
+ return value;
1783
2278
  }
1784
2279
  else {
1785
- if (existingAsterisk) {
1786
- existingAsterisk.remove();
1787
- }
2280
+ let val = value.split(".");
2281
+ let valueBeforeDecimal = val[0];
2282
+ let valueAfterDecimal = val[1];
2283
+ valueBeforeDecimal = valueBeforeDecimal.toString().replace(/\D/g, "")
2284
+ .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
2285
+ let newValue = `${valueBeforeDecimal}.${valueAfterDecimal}`;
2286
+ return newValue;
1788
2287
  }
1789
2288
  }
1790
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AddAsteriskDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1791
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AddAsteriskDirective, selector: "[addAsterisk]", inputs: { show: "show" }, usesOnChanges: true, ngImport: i0 });
2289
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomDecimalPointTwoDigitsDirective, deps: [{ token: i2$1.NgControl }], target: i0.ɵɵFactoryTarget.Directive });
2290
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: CustomDecimalPointTwoDigitsDirective, selector: "[customDecimalPointTwoDigits]", host: { listeners: { "input": "onEvent($event)" } }, providers: [NgModel, DecimalPipe], ngImport: i0 });
1792
2291
  }
1793
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AddAsteriskDirective, decorators: [{
2292
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomDecimalPointTwoDigitsDirective, decorators: [{
1794
2293
  type: Directive,
1795
2294
  args: [{
1796
- selector: '[addAsterisk]'
2295
+ selector: '[customDecimalPointTwoDigits]',
2296
+ providers: [NgModel, DecimalPipe],
1797
2297
  }]
1798
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { show: [{
1799
- type: Input,
1800
- args: ['show']
2298
+ }], ctorParameters: function () { return [{ type: i2$1.NgControl }]; }, propDecorators: { onEvent: [{
2299
+ type: HostListener,
2300
+ args: ["input", ["$event"]]
1801
2301
  }] } });
1802
2302
 
1803
2303
  class InputsModule {
@@ -1828,7 +2328,9 @@ class InputsModule {
1828
2328
  ShowTableErrorsComponent,
1829
2329
  FormControlValidationMsgDirectiveForInput,
1830
2330
  DropdownActionsComponent,
1831
- AddAsteriskDirective], imports: [CommonModule,
2331
+ AddAsteriskDirective,
2332
+ FormControlValidationMsgDirectiveForNgSelect,
2333
+ TooltipMsgError], imports: [CommonModule,
1832
2334
  NgSelectModule,
1833
2335
  FormsModule,
1834
2336
  ReactiveFormsModule,
@@ -1871,7 +2373,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1871
2373
  ShowTableErrorsComponent,
1872
2374
  FormControlValidationMsgDirectiveForInput,
1873
2375
  DropdownActionsComponent,
1874
- AddAsteriskDirective
2376
+ AddAsteriskDirective,
2377
+ FormControlValidationMsgDirectiveForNgSelect,
2378
+ TooltipMsgError
1875
2379
  ],
1876
2380
  imports: [
1877
2381
  CommonModule,
@@ -1898,6 +2402,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1898
2402
  }]
1899
2403
  }] });
1900
2404
 
2405
+ class LabelAndField {
2406
+ label;
2407
+ field;
2408
+ }
2409
+
1901
2410
  /*
1902
2411
  * Public API Surface of inputs
1903
2412
  */
@@ -1906,5 +2415,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1906
2415
  * Generated bundle index. Do not edit.
1907
2416
  */
1908
2417
 
1909
- export { AddAsteriskDirective, ChooseEnumComponent, ChooseEnumRendererComponent, ChooseGeneralItemComponent, ChooseGeneralItemRendererComponent, ChooseGeneralItemService, ChooseLineTypeComponent, ChooseYesOrNoComponent, ChooseYesOrNoRendererComponent, DropdownActionType, DropdownActionsComponent, DynamicPipe, EditableSavableInputComponent, FormControlValidationMsgDirectiveForInput, GeneralInputRendererComponent, InputsModule, LabelAndField, PrimaryColors, ShowTableErrorsComponent };
2418
+ export { AddAsteriskDirective, ChooseEnumComponent, ChooseEnumRendererComponent, ChooseGeneralItemComponent, ChooseGeneralItemRendererComponent, ChooseGeneralItemService, ChooseItemRendererValidationType, ChooseLineTypeComponent, ChooseYesOrNoComponent, ChooseYesOrNoRendererComponent, DropdownActionType, DropdownActionsComponent, DynamicPipe, EditableSavableInputComponent, FormControlValidationMsgDirectiveForInput, GeneralInputRendererComponent, InputsModule, LabelAndField, PrimaryColors, ShowTableErrorsComponent, ToolTipMessageType, TooltipMsgError };
1910
2419
  //# sourceMappingURL=inputs.mjs.map