@energycap/components 0.28.6 → 0.28.7-ECAP-11994-Wizard-Updates.20220428-1313

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.
@@ -8591,6 +8591,7 @@
8591
8591
  this.nextLabel = 'Next_TC';
8592
8592
  this.backLabel = 'Back_TC';
8593
8593
  this.cancelLabel = 'Cancel';
8594
+ this.saveLabel = 'Save';
8594
8595
  this.cancelId = 'cancelWizardDialog';
8595
8596
  this.saveId = 'saveWizardDialog';
8596
8597
  this.tabindex = 0;
@@ -8616,7 +8617,7 @@
8616
8617
  WizardButtonsComponent.decorators = [
8617
8618
  { type: i0.Component, args: [{
8618
8619
  selector: 'ec-wizard-buttons',
8619
- template: "<ec-button id=\"{{saveId}}\"\r\n class=\"ml-2\"\r\n *ngIf=\"!hideNextSaveButton\"\r\n type=\"primary\"\r\n [label]=\"(!showSave ? nextLabel : 'Save')\"\r\n [tabindex]=\"!tabindex ? 0 : tabindex\"\r\n (clicked)=\"!showSave ? onNextTab() : onSave($event)\"\r\n [disabled]=\"status?.status === 'pending' || status?.status === 'error'\">\r\n</ec-button>\r\n<ec-button id=\"previousTab\"\r\n class=\"ml-2\"\r\n *ngIf=\"showBack\"\r\n type=\"secondary\"\r\n [label]=\"backLabel\"\r\n [tabindex]=\"!tabindex ? 0 : tabindex+1\"\r\n (clicked)=\"onPreviousTab()\">\r\n</ec-button>\r\n<ec-button id=\"{{cancelId}}\"\r\n type=\"secondary\"\r\n [label]=\"cancelLabel\"\r\n [tabindex]=\"!tabindex ? 0 : tabindex+2\"\r\n (clicked)=\"onCancel()\">\r\n</ec-button>\r\n",
8620
+ template: "<ec-button id=\"{{saveId}}\"\r\n class=\"ml-2\"\r\n *ngIf=\"!hideNextSaveButton\"\r\n type=\"primary\"\r\n [label]=\"(!showSave ? nextLabel : saveLabel)\"\r\n [tabindex]=\"!tabindex ? 0 : tabindex\"\r\n (clicked)=\"!showSave ? onNextTab() : onSave($event)\"\r\n [disabled]=\"status?.status === 'pending' || status?.status === 'error'\">\r\n</ec-button>\r\n<ec-button id=\"previousTab\"\r\n class=\"ml-2\"\r\n *ngIf=\"showBack\"\r\n type=\"secondary\"\r\n [label]=\"backLabel\"\r\n [tabindex]=\"!tabindex ? 0 : tabindex+1\"\r\n (clicked)=\"onPreviousTab()\">\r\n</ec-button>\r\n<ec-button id=\"{{cancelId}}\"\r\n type=\"secondary\"\r\n [label]=\"cancelLabel\"\r\n [tabindex]=\"!tabindex ? 0 : tabindex+2\"\r\n (clicked)=\"onCancel()\">\r\n</ec-button>\r\n",
8620
8621
  styles: [":host{display:flex;flex-direction:row-reverse}:host-context(ec-page-view .titlebar>.actions){flex-direction:row}"]
8621
8622
  },] }
8622
8623
  ];
@@ -8625,6 +8626,7 @@
8625
8626
  nextLabel: [{ type: i0.Input }],
8626
8627
  backLabel: [{ type: i0.Input }],
8627
8628
  cancelLabel: [{ type: i0.Input }],
8629
+ saveLabel: [{ type: i0.Input }],
8628
8630
  cancelId: [{ type: i0.Input }],
8629
8631
  saveId: [{ type: i0.Input }],
8630
8632
  tabindex: [{ type: i0.Input }],
@@ -8646,8 +8648,8 @@
8646
8648
  WizardProgressComponent.decorators = [
8647
8649
  { type: i0.Component, args: [{
8648
8650
  selector: 'ec-wizard-progress',
8649
- template: "<div *ngFor=\"let tab of tabGroup?.items; index as index\"\r\n class=\"progress-tab font-color-secondary mx-3\"\r\n [class.is-active]=\"currentTab?.id === tab.id\">\r\n <i class=\"ec-icon icon-circle-o mr-1\"\r\n *ngIf=\"!tab.completed\"></i>\r\n <i class=\"ec-icon icon-check-circle mr-1\"\r\n *ngIf=\"tab.completed\"></i>\r\n <span>{{index+1}}. {{tab.label | translate}}</span>\r\n</div>",
8650
- styles: [".progress-tab,:host{align-items:center;display:flex}.progress-tab.is-active{font-weight:700}.progress-tab:not(.is-active)>i{opacity:.4}"]
8651
+ template: "<div *ngFor=\"let tab of tabGroup?.items; index as index; last as isLast\"\r\n class=\"progress-tab ml-2\"\r\n [class.is-active]=\"currentTab?.id === tab.id\">\r\n\r\n <i *ngIf=\"tab.completed\"\r\n class=\"ec-icon icon-check-circle mr-1 font-color-success\"></i>\r\n <span *ngIf=\"!tab.completed\">{{index+1}}.&nbsp;</span>\r\n <span>{{tab.label | translate}}</span>\r\n <i *ngIf=\"!isLast\" class=\"ec-icon icon-angle-down rotate-270 ml-2\"></i>\r\n</div>",
8652
+ styles: [":host{padding:0 1rem}.progress-tab,:host{align-items:center;display:flex}.progress-tab.is-active{font-weight:700}"]
8651
8653
  },] }
8652
8654
  ];
8653
8655
  WizardProgressComponent.ctorParameters = function () { return []; };
@@ -8656,6 +8658,151 @@
8656
8658
  currentTab: [{ type: i0.Input }]
8657
8659
  };
8658
8660
 
8661
+ var FormControlLabelComponent = /** @class */ (function () {
8662
+ function FormControlLabelComponent(validationMessageService, translateService) {
8663
+ this.validationMessageService = validationMessageService;
8664
+ this.translateService = translateService;
8665
+ /**
8666
+ * The form control label
8667
+ */
8668
+ this.label = '';
8669
+ /**
8670
+ * The position of the form control label (top|bottom|left)
8671
+ */
8672
+ this.labelPosition = "top";
8673
+ /**An optional string to show if any of the underlying controls has an error. If falsy, one of the
8674
+ * errors from the underlying controls will be used.
8675
+ */
8676
+ this.overrideValidationError = "";
8677
+ /**An optional flag to hide the validation messages.
8678
+ */
8679
+ this.hideValidationMessage = false;
8680
+ /**
8681
+ * All current validation errors
8682
+ *
8683
+ * @type {string}
8684
+ * @memberof FormControlBase
8685
+ */
8686
+ this.validationErrors = "";
8687
+ this.allControlsTouched = false;
8688
+ this.componentDestroyed = new rxjs.Subject();
8689
+ }
8690
+ FormControlLabelComponent.prototype.ngOnInit = function () {
8691
+ return __awaiter(this, void 0, void 0, function () {
8692
+ var _this = this;
8693
+ return __generator(this, function (_a) {
8694
+ // subscribe to statusChanges Observable to take any errors and translate them
8695
+ if (this.control) {
8696
+ this.control.statusChanges
8697
+ .pipe(operators.takeUntil(this.componentDestroyed))
8698
+ .subscribe(function () {
8699
+ _this.translateValidationMessages(_this.getErrors(_this.control));
8700
+ });
8701
+ // (re)set validation messages
8702
+ this.translateValidationMessages(this.getErrors(this.control));
8703
+ }
8704
+ if (this.id) {
8705
+ this.attrId = this.id;
8706
+ }
8707
+ return [2 /*return*/];
8708
+ });
8709
+ });
8710
+ };
8711
+ /**
8712
+ * Angular onDestroy lifecyle hook.
8713
+ * Unsubscribe from any observables
8714
+ *
8715
+ * @see https://angular.io/guide/lifecycle-hooks
8716
+ * @memberof FormControlBase
8717
+ */
8718
+ FormControlLabelComponent.prototype.ngOnDestroy = function () {
8719
+ this.componentDestroyed.next();
8720
+ this.componentDestroyed.unsubscribe();
8721
+ };
8722
+ FormControlLabelComponent.prototype.getErrors = function (control) {
8723
+ var _this = this;
8724
+ control.markAsUntouched();
8725
+ var errors = null;
8726
+ var allTouched = true;
8727
+ var controlFound = false;
8728
+ forEachFormControl(control, function (control) {
8729
+ errors = _this.assignErrors(control, errors);
8730
+ if (control.untouched) {
8731
+ allTouched = false;
8732
+ }
8733
+ controlFound = true;
8734
+ });
8735
+ if (control.errors) {
8736
+ errors = Object.assign(errors || {}, control.errors);
8737
+ }
8738
+ if (allTouched && controlFound) {
8739
+ control.markAsTouched();
8740
+ }
8741
+ return errors;
8742
+ };
8743
+ FormControlLabelComponent.prototype.assignErrors = function (control, errors) {
8744
+ if (control.errors) {
8745
+ errors = Object.assign(errors || {}, control.errors);
8746
+ }
8747
+ return errors;
8748
+ };
8749
+ /**
8750
+ * Function that subscribes to the controls valueChanges Observable
8751
+ * to take any erros and translate them
8752
+ *
8753
+ * @param {*} [data]
8754
+ * @returns
8755
+ * @memberof FormControlBase
8756
+ */
8757
+ FormControlLabelComponent.prototype.translateValidationMessages = function (errors) {
8758
+ return __awaiter(this, void 0, void 0, function () {
8759
+ var messages;
8760
+ return __generator(this, function (_a) {
8761
+ switch (_a.label) {
8762
+ case 0:
8763
+ if (!errors) return [3 /*break*/, 4];
8764
+ if (!this.overrideValidationError) return [3 /*break*/, 1];
8765
+ this.validationErrors = this.translateService.instant(this.overrideValidationError);
8766
+ return [3 /*break*/, 3];
8767
+ case 1: return [4 /*yield*/, this.validationMessageService.getErrorMessages(errors)];
8768
+ case 2:
8769
+ messages = _a.sent();
8770
+ if (messages) {
8771
+ this.validationErrors = messages.join('; ');
8772
+ }
8773
+ _a.label = 3;
8774
+ case 3: return [3 /*break*/, 5];
8775
+ case 4:
8776
+ this.validationErrors = '';
8777
+ _a.label = 5;
8778
+ case 5: return [2 /*return*/];
8779
+ }
8780
+ });
8781
+ });
8782
+ };
8783
+ return FormControlLabelComponent;
8784
+ }());
8785
+ FormControlLabelComponent.decorators = [
8786
+ { type: i0.Component, args: [{
8787
+ selector: 'ec-form-control-label',
8788
+ template: "<div class=\"control control-label-{{labelPosition}}\" [class.ec-untouched]=\"control?.untouched\">\r\n <label *ngIf=\"label\" ngPreserveWhitespaces>\r\n\r\n <span id=\"{{id}}_label\">{{label | translate}}</span>\r\n\r\n <span *ngIf=\"!hideValidationMessage && validationErrors && control?.touched && control?.invalid\">{{validationErrors | translate}}</span>\r\n </label>\r\n</div>",
8789
+ styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}:host{color:#1a1a23;display:block;font-family:Roboto,-apple-system,BlinkMacSystemFont,Segoe UI,Oxygen,Ubuntu,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:1rem;margin-bottom:1rem;width:100%}:host :host-context(.form-condensed){margin-bottom:.5rem}:host .control{display:flex;flex-direction:column;width:100%}:host .control.control-label-bottom{flex-direction:column-reverse}:host .control.control-label-left{flex-direction:row}:host .control.control-label-left label{margin-right:.25rem}:host .control.control-label-right{flex-direction:row-reverse}:host .control.control-label-right label{margin-left:.25rem}:host .control.control-label-left,:host .control.control-label-right{align-items:center}:host .control.control-label-left label,:host .control.control-label-right label{flex:1 1;margin-bottom:0;margin-top:0}:host .control.control-label-left .control-input,:host .control.control-label-right .control-input{flex:2 2}:host .control.is-readonly input,:host .control.is-readonly select{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;background-clip:border-box;background-color:rgba(26,26,35,.12);background-image:none;border-color:transparent;color:#1a1a23;opacity:1;overflow:hidden;pointer-events:none;user-select:none;white-space:nowrap}:host .control.invalid .textbox-group-input ::ng-deep .control input.ng-invalid,:host .control.invalid .textbox-group-input ::ng-deep .control input.ng-valid{background-color:#fff8cc;background-image:url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"><path fill=\"rgba(26, 26, 35, 0.66)\" d=\"M20.21 20.21h-8.42L10.95 0h10.1l-.84 20.21zm-8.42 3.37h8.42V32h-8.42z\"/></svg>');background-position:.25em;background-repeat:no-repeat;background-size:1em 1em;padding-left:1.5em}:host .control.invalid .textbox-group-input ::ng-deep .control input.ng-invalid:not(:focus),:host .control.invalid .textbox-group-input ::ng-deep .control input.ng-valid:not(:focus){border-color:#ffe433}:host .control.invalid:not(.open) .textbox-group-btn-right ::ng-deep button{background-color:#fff8cc}:host .control.invalid:not(.open) .textbox-group-btn-right ::ng-deep button:not(:focus){border-color:#ffe433}:host .textbox-group{display:flex;position:relative}:host input:focus,:host select:focus,:host textarea:focus{outline:none}label{color:rgba(26,26,35,.66);display:block;font-size:.75rem;line-height:1;margin:.375rem 0}.control.ec-untouched ::ng-deep input.ng-invalid.ng-touched{background-image:none;padding-left:.5rem}.control.ec-untouched ::ng-deep input.ng-invalid.ng-touched:not(.is-empty)~.units-left{left:0}.control.ec-untouched ::ng-deep input:required:not(:disabled).is-empty{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"><path fill=\"%23ffe433\" d=\"M31.32 21.69l-.09.18-2.48 4.35c-.36.54-.77.62-1.25.27-.12 0-.2 0-.2-.09L19.53 22v9.37a1.26 1.26 0 0 1-.72.67h-5.26c-.59 0-.83-.3-.83-.89 0-.12.15-.21.15-.27V22l-8 4.71h-.12c-.42.66-.8.21-1.16-.27L1 21.82a.82.82 0 0 1 .35-1.26l.18-.1L9 16 .87 11.47v-.09c0-.36-.39-.74-.09-1.16l2.75-4.35v-.09c0-.42.82-.54 1.29-.36l8 4.62V.89c0-.59.18-.89.77-.89h5c.65 0 .91.3.91.89V10l7.94-4.53c.48-.29.72-.21 1.08.27l2.32 4.35v.09c.66.48.45.89-.08 1.25L23 16l7.91 4.53v.09c-.04.18.53.54.41 1.07z\"/></svg>');background-position:.25em;background-repeat:no-repeat;background-size:1em 1em;border-color:#d2d7d9;padding-left:1.5em}.control.ec-untouched ::ng-deep input:required:not(:disabled).is-empty:focus{border-color:#0084a9;box-shadow:0 0 0 1px #0084a9;position:relative;z-index:1}.control-label-left{display:flex}"]
8790
+ },] }
8791
+ ];
8792
+ FormControlLabelComponent.ctorParameters = function () { return [
8793
+ { type: ValidationMessageService },
8794
+ { type: i1.TranslateService }
8795
+ ]; };
8796
+ FormControlLabelComponent.propDecorators = {
8797
+ id: [{ type: i0.Input }],
8798
+ attrId: [{ type: i0.HostBinding, args: ['attr.id',] }],
8799
+ label: [{ type: i0.Input }],
8800
+ control: [{ type: i0.Input }],
8801
+ labelPosition: [{ type: i0.Input }],
8802
+ overrideValidationError: [{ type: i0.Input }],
8803
+ hideValidationMessage: [{ type: i0.Input }]
8804
+ };
8805
+
8659
8806
  var ComponentsModule = /** @class */ (function () {
8660
8807
  function ComponentsModule() {
8661
8808
  }
@@ -8736,7 +8883,8 @@
8736
8883
  TreeComponent,
8737
8884
  RelativeDatePipe,
8738
8885
  ResizableComponent,
8739
- HighlightTextPipe
8886
+ HighlightTextPipe,
8887
+ FormControlLabelComponent
8740
8888
  ],
8741
8889
  imports: [
8742
8890
  common.CommonModule,
@@ -8811,7 +8959,8 @@
8811
8959
  TreeComponent,
8812
8960
  RelativeDatePipe,
8813
8961
  ResizableComponent,
8814
- HighlightTextPipe
8962
+ HighlightTextPipe,
8963
+ FormControlLabelComponent
8815
8964
  ]
8816
8965
  },] }
8817
8966
  ];
@@ -9971,6 +10120,7 @@
9971
10120
  exports.FileUploadComponent = FileUploadComponent;
9972
10121
  exports.FormControlBase = FormControlBase;
9973
10122
  exports.FormControlComponent = FormControlComponent;
10123
+ exports.FormControlLabelComponent = FormControlLabelComponent;
9974
10124
  exports.FormGroupComponent = FormGroupComponent;
9975
10125
  exports.FormGroupHelper = FormGroupHelper;
9976
10126
  exports.HierarchyBase = HierarchyBase;