@pepperi-addons/ngx-lib 0.2.58-beta.1 → 0.2.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/attachment/attachment.component.d.ts +0 -1
- package/attachment/pepperi-addons-ngx-lib-attachment.metadata.json +1 -1
- package/bundles/pepperi-addons-ngx-lib-attachment.umd.js +1 -6
- package/bundles/pepperi-addons-ngx-lib-attachment.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-checkbox.umd.js +0 -3
- package/bundles/pepperi-addons-ngx-lib-checkbox.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-color.umd.js +1 -6
- package/bundles/pepperi-addons-ngx-lib-color.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-date.umd.js +0 -3
- package/bundles/pepperi-addons-ngx-lib-date.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-form.umd.js +15 -18
- package/bundles/pepperi-addons-ngx-lib-form.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-image.umd.js +1 -6
- package/bundles/pepperi-addons-ngx-lib-image.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-images-filmstrip.umd.js +1 -6
- package/bundles/pepperi-addons-ngx-lib-images-filmstrip.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-quantity-selector.umd.js +1 -6
- package/bundles/pepperi-addons-ngx-lib-quantity-selector.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-rich-html-textarea.umd.js +1 -6
- package/bundles/pepperi-addons-ngx-lib-rich-html-textarea.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-select.umd.js +1 -6
- package/bundles/pepperi-addons-ngx-lib-select.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-separator.umd.js +0 -8
- package/bundles/pepperi-addons-ngx-lib-separator.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-signature.umd.js +1 -6
- package/bundles/pepperi-addons-ngx-lib-signature.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-smart-filters.umd.js +173 -1432
- package/bundles/pepperi-addons-ngx-lib-smart-filters.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-textarea.umd.js +1 -6
- package/bundles/pepperi-addons-ngx-lib-textarea.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib-textbox.umd.js +2 -4
- package/bundles/pepperi-addons-ngx-lib-textbox.umd.js.map +1 -1
- package/bundles/pepperi-addons-ngx-lib.umd.js +101 -85
- package/bundles/pepperi-addons-ngx-lib.umd.js.map +1 -1
- package/color/color.component.d.ts +0 -1
- package/color/pepperi-addons-ngx-lib-color.metadata.json +1 -1
- package/core/common/services/color.service.d.ts +3 -3
- package/core/customization/customization.service.d.ts +0 -1
- package/esm2015/attachment/attachment.component.js +2 -7
- package/esm2015/checkbox/checkbox.component.js +1 -4
- package/esm2015/color/color.component.js +2 -7
- package/esm2015/color/public-api.js +1 -2
- package/esm2015/core/common/services/color.service.js +101 -83
- package/esm2015/core/customization/customization.service.js +2 -4
- package/esm2015/date/date.component.js +1 -4
- package/esm2015/form/internal-button.component.js +17 -20
- package/esm2015/image/image.component.js +2 -7
- package/esm2015/images-filmstrip/images-filmstrip.component.js +2 -7
- package/esm2015/quantity-selector/quantity-selector.component.js +2 -7
- package/esm2015/rich-html-textarea/rich-html-textarea.component.js +2 -7
- package/esm2015/select/select.component.js +2 -7
- package/esm2015/separator/separator.component.js +1 -9
- package/esm2015/signature/signature.component.js +2 -7
- package/esm2015/smart-filters/boolean-filter/boolean-filter.component.js +2 -12
- package/esm2015/smart-filters/common/model/base-filter-component.js +10 -40
- package/esm2015/smart-filters/common/model/creator.js +2 -8
- package/esm2015/smart-filters/common/model/field.js +1 -12
- package/esm2015/smart-filters/common/model/operator.js +8 -8
- package/esm2015/smart-filters/common/model/type.js +1 -1
- package/esm2015/smart-filters/date-filter/date-filter.component.js +2 -45
- package/esm2015/smart-filters/multi-select-filter/multi-select-filter.component.js +14 -53
- package/esm2015/smart-filters/number-filter/number-filter.component.js +2 -25
- package/esm2015/smart-filters/pepperi-addons-ngx-lib-smart-filters.js +1 -8
- package/esm2015/smart-filters/public-api.js +1 -2
- package/esm2015/smart-filters/smart-filters.module.js +2 -14
- package/esm2015/textarea/textarea.component.js +2 -7
- package/esm2015/textbox/textbox.component.js +3 -5
- package/fesm2015/pepperi-addons-ngx-lib-attachment.js +1 -6
- package/fesm2015/pepperi-addons-ngx-lib-attachment.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-checkbox.js +0 -3
- package/fesm2015/pepperi-addons-ngx-lib-checkbox.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-color.js +1 -6
- package/fesm2015/pepperi-addons-ngx-lib-color.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-date.js +0 -3
- package/fesm2015/pepperi-addons-ngx-lib-date.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-form.js +15 -18
- package/fesm2015/pepperi-addons-ngx-lib-form.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-image.js +1 -6
- package/fesm2015/pepperi-addons-ngx-lib-image.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.js +1 -6
- package/fesm2015/pepperi-addons-ngx-lib-images-filmstrip.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.js +1 -6
- package/fesm2015/pepperi-addons-ngx-lib-quantity-selector.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.js +1 -6
- package/fesm2015/pepperi-addons-ngx-lib-rich-html-textarea.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-select.js +1 -6
- package/fesm2015/pepperi-addons-ngx-lib-select.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-separator.js +0 -8
- package/fesm2015/pepperi-addons-ngx-lib-separator.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-signature.js +1 -6
- package/fesm2015/pepperi-addons-ngx-lib-signature.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-smart-filters.js +128 -1293
- package/fesm2015/pepperi-addons-ngx-lib-smart-filters.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-textarea.js +1 -6
- package/fesm2015/pepperi-addons-ngx-lib-textarea.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib-textbox.js +2 -4
- package/fesm2015/pepperi-addons-ngx-lib-textbox.js.map +1 -1
- package/fesm2015/pepperi-addons-ngx-lib.js +101 -85
- package/fesm2015/pepperi-addons-ngx-lib.js.map +1 -1
- package/form/internal-button.component.d.ts +1 -0
- package/image/image.component.d.ts +0 -1
- package/image/pepperi-addons-ngx-lib-image.metadata.json +1 -1
- package/images-filmstrip/images-filmstrip.component.d.ts +0 -1
- package/images-filmstrip/pepperi-addons-ngx-lib-images-filmstrip.metadata.json +1 -1
- package/package.json +1 -1
- package/pepperi-addons-ngx-lib.metadata.json +1 -1
- package/quantity-selector/pepperi-addons-ngx-lib-quantity-selector.metadata.json +1 -1
- package/quantity-selector/quantity-selector.component.d.ts +0 -1
- package/rich-html-textarea/pepperi-addons-ngx-lib-rich-html-textarea.metadata.json +1 -1
- package/rich-html-textarea/rich-html-textarea.component.d.ts +0 -1
- package/select/pepperi-addons-ngx-lib-select.metadata.json +1 -1
- package/select/select.component.d.ts +0 -1
- package/separator/pepperi-addons-ngx-lib-separator.metadata.json +1 -1
- package/signature/pepperi-addons-ngx-lib-signature.metadata.json +1 -1
- package/signature/signature.component.d.ts +0 -1
- package/smart-filters/boolean-filter/boolean-filter.component.d.ts +1 -5
- package/smart-filters/common/model/base-filter-component.d.ts +1 -10
- package/smart-filters/common/model/field.d.ts +0 -4
- package/smart-filters/common/model/operator.d.ts +0 -1
- package/smart-filters/common/model/type.d.ts +2 -2
- package/smart-filters/date-filter/date-filter.component.d.ts +1 -8
- package/smart-filters/multi-select-filter/multi-select-filter.component.d.ts +0 -6
- package/smart-filters/number-filter/number-filter.component.d.ts +0 -5
- package/smart-filters/pepperi-addons-ngx-lib-smart-filters.d.ts +0 -7
- package/smart-filters/pepperi-addons-ngx-lib-smart-filters.metadata.json +1 -1
- package/smart-filters/public-api.d.ts +0 -1
- package/src/assets/i18n/en.ngx-lib.json +1 -2
- package/src/core/style/abstracts/mixins.scss +3 -3
- package/src/core/style/components/general.scss +2 -4
- package/textarea/pepperi-addons-ngx-lib-textarea.metadata.json +1 -1
- package/textarea/textarea.component.d.ts +0 -1
- package/theming.scss +0 -4
- package/esm2015/smart-filters/filter-builder/common/model/filter.js +0 -2
- package/esm2015/smart-filters/filter-builder/common/model/legacy.js +0 -2
- package/esm2015/smart-filters/filter-builder/common/model/operator-unit.js +0 -42
- package/esm2015/smart-filters/filter-builder/common/model/operator.js +0 -207
- package/esm2015/smart-filters/filter-builder/common/model/type-map.js +0 -27
- package/esm2015/smart-filters/filter-builder/common/model/type.js +0 -6
- package/esm2015/smart-filters/filter-builder/common/pipes/filter-item-counter.pipe.js +0 -18
- package/esm2015/smart-filters/filter-builder/common/services/output-filter.service.js +0 -132
- package/esm2015/smart-filters/filter-builder/common/services/type-convertor.service.js +0 -44
- package/esm2015/smart-filters/filter-builder/filter-builder-item/filter-builder-item.component.js +0 -106
- package/esm2015/smart-filters/filter-builder/filter-builder-section/filter-builder-section.component.js +0 -50
- package/esm2015/smart-filters/filter-builder/filter-builder.component.js +0 -65
- package/esm2015/smart-filters/filter-builder/filter-builder.service.js +0 -261
- package/esm2015/smart-filters/index.js +0 -5
- package/esm2015/smart-filters/text-filter/text-filter.component.js +0 -79
- package/smart-filters/filter-builder/common/model/filter.d.ts +0 -6
- package/smart-filters/filter-builder/common/model/legacy.d.ts +0 -23
- package/smart-filters/filter-builder/common/model/operator-unit.d.ts +0 -13
- package/smart-filters/filter-builder/common/model/operator.d.ts +0 -21
- package/smart-filters/filter-builder/common/model/type-map.d.ts +0 -12
- package/smart-filters/filter-builder/common/model/type.d.ts +0 -4
- package/smart-filters/filter-builder/common/pipes/filter-item-counter.pipe.d.ts +0 -5
- package/smart-filters/filter-builder/common/services/output-filter.service.d.ts +0 -52
- package/smart-filters/filter-builder/common/services/type-convertor.service.d.ts +0 -10
- package/smart-filters/filter-builder/filter-builder-item/filter-builder-item.component.d.ts +0 -32
- package/smart-filters/filter-builder/filter-builder-section/filter-builder-section.component.d.ts +0 -22
- package/smart-filters/filter-builder/filter-builder-section/filter-builder-section.component.theme.scss +0 -6
- package/smart-filters/filter-builder/filter-builder.component.d.ts +0 -22
- package/smart-filters/filter-builder/filter-builder.service.d.ts +0 -90
- package/smart-filters/index.d.ts +0 -1
- package/smart-filters/text-filter/text-filter.component.d.ts +0 -17
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
this.form = null;
|
|
26
26
|
this.isActive = false;
|
|
27
27
|
this.showTitle = true;
|
|
28
|
-
this.renderTitle = true;
|
|
29
28
|
this._layoutType = 'form';
|
|
30
29
|
this.valueChange = new core.EventEmitter();
|
|
31
30
|
this.fieldHeight = '';
|
|
@@ -90,9 +89,6 @@
|
|
|
90
89
|
this.setFieldHeight();
|
|
91
90
|
this.setDefaultForm();
|
|
92
91
|
this.renderer.addClass(this.element.nativeElement, ngxLib.PepCustomizationService.STAND_ALONE_FIELD_CLASS_NAME);
|
|
93
|
-
if (!this.renderTitle) {
|
|
94
|
-
this.renderer.addClass(this.element.nativeElement, ngxLib.PepCustomizationService.STAND_ALONE_FIELD_NO_SPACING_CLASS_NAME);
|
|
95
|
-
}
|
|
96
92
|
}
|
|
97
93
|
};
|
|
98
94
|
PepTextareaComponent.prototype.ngOnChanges = function (changes) {
|
|
@@ -146,7 +142,7 @@
|
|
|
146
142
|
PepTextareaComponent.decorators = [
|
|
147
143
|
{ type: core.Component, args: [{
|
|
148
144
|
selector: 'pep-textarea',
|
|
149
|
-
template: "<ng-container [formGroup]=\"form\">\n <ng-template #pepTemplate let-isFormView=\"isFormView\">\n <div class=\"pep-textarea-container\" [ngClass]=\"{ 'stand-alone': standAlone,\n 'right-alignment': xAlignment == 'right', 'one-row': rowSpan === 1,\n 'pep-textarea-card-container': layoutType === 'card'}\">\n <pep-field-title *ngIf=\"
|
|
145
|
+
template: "<ng-container [formGroup]=\"form\">\n <ng-template #pepTemplate let-isFormView=\"isFormView\">\n <div class=\"pep-textarea-container\" [ngClass]=\"{ 'stand-alone': standAlone,\n 'right-alignment': xAlignment == 'right', 'one-row': rowSpan === 1,\n 'pep-textarea-card-container': layoutType === 'card'}\">\n <pep-field-title *ngIf=\"isFormView\" [label]=\"label\" [mandatory]=\"mandatory\" [disabled]=\"disabled\"\n [maxFieldCharacters]=\"disabled || readonly ? 0 : maxFieldCharacters\" [xAlignment]=\"xAlignment\"\n [showTitle]=\"showTitle\" [inputLength]=\"input.value?.length\">\n </pep-field-title>\n <mat-form-field appearance=\"outline\" dir=\"{{ xAlignment == 'right' ? 'rtl' : 'ltr' }}\"\n [ngClass]=\"{ 'pep-table-textarea': layoutType === 'table' }\">\n <textarea #input [hidden]=\"readonly\" [id]=\"key\" class=\"body-sm\" matInput (blur)=\"onBlur($event)\"\n title=\"{{ value }}\" [value]=\"value\"\n maxlength=\"{{ maxFieldCharacters > 0 ? maxFieldCharacters : 99999 }}\"\n [ngStyle]=\"{ color: textColor, 'text-align': xAlignment == 'right' ? 'right' : 'left' }\"\n [formControlName]=\"key\" [style.height]=\"fieldHeight\">\n </textarea>\n <div *ngIf=\"readonly\" class=\"body-sm disable-text-div\" title=\"{{ value }}\"\n [ngStyle]=\"{ color: textColor, 'text-align': xAlignment == 'right' ? 'right' : 'left' }\"\n [innerHtml]=\"value | pepSafeHtml\" [style.height]=\"fieldHeight\">\n </div>\n <!-- <pep-textbox-icon *ngIf=\"xAlignment == 'right'\" matPrefix [value]=\"value\" [label]=\"label\" [type]=\"controlType\" [disabled]=\"disabled\"\n [ngClass]=\"{ 'card-one-row-icon': layoutType === 'card' && rowSpan === 1 }\" (iconClick)=\"openDialog()\">\n </pep-textbox-icon> -->\n <pep-textbox-icon matSuffix [value]=\"value\" [label]=\"label\" [type]=\"controlType\"\n [disabled]=\"disabled || readonly\"\n [ngClass]=\"{ 'card-one-row-icon': layoutType === 'card' && rowSpan === 1 }\"\n (iconClick)=\"openDialog()\">\n </pep-textbox-icon>\n <mat-error>\n <span class=\"body-xs\"\n [title]=\"mandatory && value.length == 0 ? ('MESSAGES.ERROR_IS_REQUIRED' | translate: { field: label }) : ('MESSAGES.ERROR_IS_NOT_VALID' | translate: { field: label })\"\n [innerText]=\"mandatory && value.length == 0 ? ('MESSAGES.ERROR_IS_REQUIRED' | translate: { field: label }) : ('MESSAGES.ERROR_IS_NOT_VALID' | translate: { field: label })\"></span>\n </mat-error>\n </mat-form-field>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"layoutType === 'form'\">\n <ng-container *ngTemplateOutlet=\"pepTemplate; context: { isFormView: true }\"></ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"layoutType === 'card'\">\n <ng-container *ngIf=\"isInEditMode; then editBlock; else readOnlyBlock\"></ng-container>\n <ng-template #editBlock>\n <ng-container *ngTemplateOutlet=\"pepTemplate; context: { isFormView: false }\"></ng-container>\n </ng-template>\n <ng-template #readOnlyBlock>\n <div class=\"pep-textarea-card-container card-flex-container\"\n [ngClass]=\"{'one-row': rowSpan === 1, 'pep-button weak': isActive && !disabled}\"\n [ngStyle]=\"{ color: textColor, '-webkit-line-clamp': rowSpan }\" [class]=\"'text-align-' + xAlignment\"\n (click)=\"!disabled ? cardTemplateClicked($event) : ''\" [style.height]=\"fieldHeight\">\n <span *ngIf=\" showTitle && label !=''\" class=\" body-xs title no-shrink\" title=\"{{ label }}\">{{ label\n }} </span>\n <span [id]=\"key\" title=\"{{ value }}\" class=\"body-sm value wrap\">{{ value }}</span>\n <button *ngIf=\"isActive && !disabled\" class=\"pep-button weak card-edit-button self-start\"\n [ngClass]=\"{'self-end' : value && value !== ''}\" mat-button>\n <mat-icon>\n <pep-icon name=\"system_edit\">\n </pep-icon>\n </mat-icon>\n </button>\n </div>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"layoutType === 'table'\">\n <ng-container *ngIf=\"isActive && !disabled; then selectedBlock; else notSelectedBlock\"></ng-container>\n <ng-template #selectedBlock>\n <ng-container *ngTemplateOutlet=\"pepTemplate; context: { isFormView: false }\"></ng-container>\n </ng-template>\n <ng-template #notSelectedBlock>\n <ng-container *ngIf=\"value?.length > 0; then notEmptyBlock; else emptyBlock\"></ng-container>\n <ng-template #notEmptyBlock>\n <mat-form-field appearance=\"outline\" dir=\"{{ xAlignment == 'right' ? 'rtl' : 'ltr' }}\"\n class=\"pep-report-textarea\" [ngClass]=\"{ readonly: disabled }\">\n <input matInput [id]=\"key\" class=\"body-sm pep-report-input\" [ngClass]=\"{ readonly: disabled}\"\n [ngStyle]=\"{ color: textColor, 'text-align': xAlignment == 'center' ? 'center' : xAlignment == 'right' ? 'right' : 'left' }\"\n title=\"{{ value }}\" [formControlName]=\"key\" type=\"text\" [value]=\"value\" [disabled]=\"true\" />\n <pep-textbox-icon *ngIf=\"disabled && xAlignment == 'right'\" matPrefix [value]=\"value\"\n [label]=\"label\" [type]=\"controlType\" [disabled]=\"disabled\" (iconClick)=\"openDialog()\">\n </pep-textbox-icon>\n <pep-textbox-icon *ngIf=\"disabled && (xAlignment == 'left')\" matSuffix [value]=\"value\"\n [label]=\"label\" [type]=\"controlType\" [disabled]=\"disabled\" (iconClick)=\"openDialog()\">\n </pep-textbox-icon>\n </mat-form-field>\n </ng-template>\n <ng-template #emptyBlock>\n <span> </span>\n </ng-template>\n </ng-template>\n </ng-container>\n</ng-container>\n\n<ng-template #textAreaDialogTemplate>\n <pep-dialog class=\"dialog-textarea-container\" [title]=\"label\">\n <ng-container pep-dialog-content>\n <textarea #dialogTextarea [readonly]=\"disabled || readonly\">{{ value }}</textarea>\n </ng-container>\n <div pep-dialog-actions class=\"pep-spacing-element-negative\">\n <ng-container *ngIf=\"disabled || readonly; then notEditableBlock; else editableBlock\">\n </ng-container>\n <ng-template #editableBlock>\n <button mat-button (click)=\"closeDialog()\" class=\"pep-spacing-element pep-button md weak\">\n {{ 'ACTIONS.CANCEL' | translate }}\n </button>\n <button mat-button class=\"pep-spacing-element pep-button md strong\"\n (click)=\"closeDialog(dialogTextarea.value)\">\n {{ 'ACTIONS.SAVE' | translate }}\n </button>\n </ng-template>\n <ng-template #notEditableBlock>\n <button mat-button (click)=\"closeDialog()\" class=\"pep-spacing-element pep-button md weak\">\n {{ 'ACTIONS.CLOSE' | translate }}\n </button>\n </ng-template>\n </div>\n </pep-dialog>\n</ng-template>",
|
|
150
146
|
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
151
147
|
styles: [":host{height:inherit;display:grid}:host>*{align-self:center}.disable-text-div{display:inline-block;vertical-align:middle;margin:0;padding:.5rem 1.5rem .5rem 0;overflow-y:hidden}.right-alignment .disable-text-div{padding:.5rem 0 .5rem 1.5rem}.dialog-textarea-container textarea{border:none;resize:none;width:25rem;height:13rem}.dialog-textarea-container textarea:focus{outline:none}"]
|
|
152
148
|
},] }
|
|
@@ -172,7 +168,6 @@
|
|
|
172
168
|
form: [{ type: core.Input }],
|
|
173
169
|
isActive: [{ type: core.Input }],
|
|
174
170
|
showTitle: [{ type: core.Input }],
|
|
175
|
-
renderTitle: [{ type: core.Input }],
|
|
176
171
|
layoutType: [{ type: core.Input }],
|
|
177
172
|
valueChange: [{ type: core.Output }],
|
|
178
173
|
textAreaDialogTemplate: [{ type: core.ViewChild, args: ['textAreaDialogTemplate', { read: core.TemplateRef },] }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pepperi-addons-ngx-lib-textarea.umd.js","sources":["../../../projects/ngx-lib/textarea/textarea.component.ts","../../../projects/ngx-lib/textarea/textarea.module.ts","../../../projects/ngx-lib/textarea/public-api.ts","../../../projects/ngx-lib/textarea/pepperi-addons-ngx-lib-textarea.ts"],"sourcesContent":["import {\n Component,\n OnInit,\n OnChanges,\n Input,\n Output,\n EventEmitter,\n ChangeDetectionStrategy,\n ElementRef,\n ViewChild,\n OnDestroy,\n Renderer2,\n TemplateRef,\n} from '@angular/core';\nimport { FormGroup } from '@angular/forms';\nimport { MatDialogRef } from '@angular/material/dialog';\nimport {\n PepLayoutType,\n PepCustomizationService,\n PepHorizontalAlignment,\n DEFAULT_HORIZONTAL_ALIGNMENT,\n PepTextareaField,\n} from '@pepperi-addons/ngx-lib';\nimport { PepDialogService } from '@pepperi-addons/ngx-lib/dialog';\n\n@Component({\n selector: 'pep-textarea',\n templateUrl: './textarea.component.html',\n styleUrls: ['./textarea.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PepTextareaComponent implements OnChanges, OnInit, OnDestroy {\n @Input() key = '';\n @Input() value = '';\n @Input() label = '';\n @Input() mandatory = false;\n @Input() disabled = false;\n @Input() readonly = false;\n @Input() maxFieldCharacters: number;\n @Input() textColor = '';\n @Input() xAlignment: PepHorizontalAlignment = DEFAULT_HORIZONTAL_ALIGNMENT;\n\n private _rowSpan = 1;\n @Input()\n set rowSpan(value) {\n this._rowSpan = value;\n this.setFieldHeight();\n }\n get rowSpan(): number {\n return this._rowSpan;\n }\n\n private _visible = true;\n @Input()\n set visible(visible: boolean) {\n this._visible = visible;\n if (visible) {\n this.renderer.removeClass(\n this.element.nativeElement,\n 'hidden-element'\n );\n } else {\n this.renderer.addClass(\n this.element.nativeElement,\n 'hidden-element'\n );\n }\n }\n get visible(): boolean {\n return this._visible;\n }\n\n // @Input() lastFocusField: any;\n\n controlType = 'textarea';\n\n @Input() form: FormGroup = null;\n @Input() isActive = false;\n @Input() showTitle = true;\n @Input() renderTitle = true;\n\n private _layoutType: PepLayoutType = 'form';\n @Input()\n set layoutType(value: PepLayoutType) {\n this._layoutType = value;\n this.setFieldHeight();\n }\n get layoutType(): PepLayoutType {\n return this._layoutType;\n }\n\n @Output()\n valueChange: EventEmitter<string> = new EventEmitter<string>();\n\n // @ViewChild('input') input: ElementRef;\n @ViewChild('textAreaDialogTemplate', { read: TemplateRef })\n textAreaDialogTemplate: TemplateRef<any>;\n\n fieldHeight = '';\n standAlone = false;\n isInEditMode = false;\n\n dialogRef: MatDialogRef<any>;\n\n constructor(\n private dialogService: PepDialogService,\n private customizationService: PepCustomizationService,\n private renderer: Renderer2,\n private element: ElementRef\n ) { }\n\n private setFieldHeight(): void {\n this.fieldHeight = this.customizationService.calculateFieldHeight(\n this.layoutType,\n this.rowSpan,\n this.standAlone\n );\n }\n\n private setDefaultForm(): void {\n const pepField = new PepTextareaField({\n key: this.key,\n value: this.value,\n mandatory: this.mandatory,\n readonly: this.readonly,\n disabled: this.disabled,\n maxFieldCharacters: this.maxFieldCharacters,\n });\n this.form = this.customizationService.getDefaultFromGroup(pepField);\n }\n\n ngOnInit(): void {\n if (this.form === null) {\n this.standAlone = true;\n this.setFieldHeight();\n this.setDefaultForm();\n\n this.renderer.addClass(\n this.element.nativeElement,\n PepCustomizationService.STAND_ALONE_FIELD_CLASS_NAME\n );\n\n if (!this.renderTitle) {\n this.renderer.addClass(\n this.element.nativeElement,\n PepCustomizationService.STAND_ALONE_FIELD_NO_SPACING_CLASS_NAME\n );\n }\n }\n }\n\n ngOnChanges(changes: any): void {\n if (this.standAlone) {\n this.setDefaultForm();\n }\n }\n\n ngOnDestroy(): void {\n //\n }\n\n onBlur(event: any): void {\n const value = event.target ? event.target.value : event;\n this.changeValue(value);\n\n setTimeout(() => {\n if (this.isInEditMode) {\n this.isInEditMode = false;\n }\n }, 0);\n }\n\n changeValue(value: any): void {\n if (value !== this.value) {\n this.value = value;\n this.customizationService.updateFormFieldValue(\n this.form,\n this.key,\n value\n );\n this.valueChange.emit(value);\n }\n }\n\n cardTemplateClicked(event: any): void {\n this.openDialog();\n }\n\n openDialog(): void {\n const config = this.dialogService.getDialogConfig(\n {\n // maxWidth: '90vw',\n // maxHeight: '90vh'\n },\n 'regular'\n );\n\n this.dialogRef = this.dialogService.openDialog(\n this.textAreaDialogTemplate,\n {},\n config\n );\n\n this.dialogRef.afterClosed().subscribe((value) => {\n if (value !== undefined && value !== null) {\n this.changeValue(value);\n }\n });\n }\n\n closeDialog(data: any = null): void {\n this.dialogRef?.close(data);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { MatCommonModule } from '@angular/material/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatDialogModule } from '@angular/material/dialog';\n\nimport { PepNgxLibModule } from '@pepperi-addons/ngx-lib';\nimport {\n PepIconModule,\n PepIconRegistry,\n pepIconSystemEdit,\n pepIconSystemClose,\n} from '@pepperi-addons/ngx-lib/icon';\nimport { PepTextboxIconModule } from '@pepperi-addons/ngx-lib/textbox-icon';\nimport { PepFieldTitleModule } from '@pepperi-addons/ngx-lib/field-title';\nimport { PepDialogModule } from '@pepperi-addons/ngx-lib/dialog';\n\nimport { PepTextareaComponent } from './textarea.component';\n\n@NgModule({\n imports: [\n CommonModule,\n ReactiveFormsModule,\n // Material modules,\n MatCommonModule,\n MatButtonModule,\n MatFormFieldModule,\n MatInputModule,\n MatIconModule,\n MatDialogModule,\n // ngx-lib modules\n PepNgxLibModule,\n PepIconModule,\n PepFieldTitleModule,\n PepTextboxIconModule,\n PepDialogModule,\n ],\n exports: [PepTextareaComponent],\n declarations: [PepTextareaComponent],\n})\nexport class PepTextareaModule {\n constructor(private pepIconRegistry: PepIconRegistry) {\n this.pepIconRegistry.registerIcons([\n pepIconSystemEdit,\n pepIconSystemClose,\n ]);\n }\n}\n","/*\n * Public API Surface of ngx-lib/textarea\n */\nexport * from './textarea.module';\nexport * from './textarea.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["DEFAULT_HORIZONTAL_ALIGNMENT","EventEmitter","PepTextareaField","PepCustomizationService","Component","ChangeDetectionStrategy","PepDialogService","Renderer2","ElementRef","Input","Output","ViewChild","TemplateRef","pepIconSystemEdit","pepIconSystemClose","NgModule","CommonModule","ReactiveFormsModule","MatCommonModule","MatButtonModule","MatFormFieldModule","MatInputModule","MatIconModule","MatDialogModule","PepNgxLibModule","PepIconModule","PepFieldTitleModule","PepTextboxIconModule","PepDialogModule","PepIconRegistry"],"mappings":";;;;;;;QAwGI,8BACY,aAA+B,EAC/B,oBAA6C,EAC7C,QAAmB,EACnB,OAAmB;YAHnB,kBAAa,GAAb,aAAa,CAAkB;YAC/B,yBAAoB,GAApB,oBAAoB,CAAyB;YAC7C,aAAQ,GAAR,QAAQ,CAAW;YACnB,YAAO,GAAP,OAAO,CAAY;YA5EtB,QAAG,GAAG,EAAE,CAAC;YACT,UAAK,GAAG,EAAE,CAAC;YACX,UAAK,GAAG,EAAE,CAAC;YACX,cAAS,GAAG,KAAK,CAAC;YAClB,aAAQ,GAAG,KAAK,CAAC;YACjB,aAAQ,GAAG,KAAK,CAAC;YAEjB,cAAS,GAAG,EAAE,CAAC;YACf,eAAU,GAA2BA,mCAA4B,CAAC;YAEnE,aAAQ,GAAG,CAAC,CAAC;YAUb,aAAQ,GAAG,IAAI,CAAC;;YAsBxB,gBAAW,GAAG,UAAU,CAAC;YAEhB,SAAI,GAAc,IAAI,CAAC;YACvB,aAAQ,GAAG,KAAK,CAAC;YACjB,cAAS,GAAG,IAAI,CAAC;YACjB,gBAAW,GAAG,IAAI,CAAC;YAEpB,gBAAW,GAAkB,MAAM,CAAC;YAW5C,gBAAW,GAAyB,IAAIC,iBAAY,EAAU,CAAC;YAM/D,gBAAW,GAAG,EAAE,CAAC;YACjB,eAAU,GAAG,KAAK,CAAC;YACnB,iBAAY,GAAG,KAAK,CAAC;SAShB;QAlEL,sBACI,yCAAO;iBAIX;gBACI,OAAO,IAAI,CAAC,QAAQ,CAAC;aACxB;iBAPD,UACY,KAAK;gBACb,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC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B;YAChD,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;gBAC/BC,sBAAiB;gBACjBC,uBAAkB;aACrB,CAAC,CAAC;SACN;;;;gBA3BJC,aAAQ,SAAC;oBACN,OAAO,EAAE;wBACLC,mBAAY;wBACZC,yBAAmB;;wBAEnBC,sBAAe;wBACfC,sBAAe;wBACfC,4BAAkB;wBAClBC,oBAAc;wBACdC,oBAAa;wBACbC,wBAAe;;wBAEfC,sBAAe;wBACfC,kBAAa;wBACbC,8BAAmB;wBACnBC,gCAAoB;wBACpBC,sBAAe;qBAClB;oBACD,OAAO,EAAE,CAAC,oBAAoB,CAAC;oBAC/B,YAAY,EAAE,CAAC,oBAAoB,CAAC;iBACvC;;;gBA9BGC,oBAAe;;;ICdnB;;;;ICAA;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"pepperi-addons-ngx-lib-textarea.umd.js","sources":["../../../projects/ngx-lib/textarea/textarea.component.ts","../../../projects/ngx-lib/textarea/textarea.module.ts","../../../projects/ngx-lib/textarea/public-api.ts","../../../projects/ngx-lib/textarea/pepperi-addons-ngx-lib-textarea.ts"],"sourcesContent":["import {\n Component,\n OnInit,\n OnChanges,\n Input,\n Output,\n EventEmitter,\n ChangeDetectionStrategy,\n ElementRef,\n ViewChild,\n OnDestroy,\n Renderer2,\n TemplateRef,\n} from '@angular/core';\nimport { FormGroup } from '@angular/forms';\nimport { MatDialogRef } from '@angular/material/dialog';\nimport {\n PepLayoutType,\n PepCustomizationService,\n PepHorizontalAlignment,\n DEFAULT_HORIZONTAL_ALIGNMENT,\n PepTextareaField,\n} from '@pepperi-addons/ngx-lib';\nimport { PepDialogService } from '@pepperi-addons/ngx-lib/dialog';\n\n@Component({\n selector: 'pep-textarea',\n templateUrl: './textarea.component.html',\n styleUrls: ['./textarea.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PepTextareaComponent implements OnChanges, OnInit, OnDestroy {\n @Input() key = '';\n @Input() value = '';\n @Input() label = '';\n @Input() mandatory = false;\n @Input() disabled = false;\n @Input() readonly = false;\n @Input() maxFieldCharacters: number;\n @Input() textColor = '';\n @Input() xAlignment: PepHorizontalAlignment = DEFAULT_HORIZONTAL_ALIGNMENT;\n\n private _rowSpan = 1;\n @Input()\n set rowSpan(value) {\n this._rowSpan = value;\n this.setFieldHeight();\n }\n get rowSpan(): number {\n return this._rowSpan;\n }\n\n private _visible = true;\n @Input()\n set visible(visible: boolean) {\n this._visible = visible;\n if (visible) {\n this.renderer.removeClass(\n this.element.nativeElement,\n 'hidden-element'\n );\n } else {\n this.renderer.addClass(\n this.element.nativeElement,\n 'hidden-element'\n );\n }\n }\n get visible(): boolean {\n return this._visible;\n }\n\n // @Input() lastFocusField: any;\n\n controlType = 'textarea';\n\n @Input() form: FormGroup = null;\n @Input() isActive = false;\n @Input() showTitle = true;\n\n private _layoutType: PepLayoutType = 'form';\n @Input()\n set layoutType(value: PepLayoutType) {\n this._layoutType = value;\n this.setFieldHeight();\n }\n get layoutType(): PepLayoutType {\n return this._layoutType;\n }\n\n @Output()\n valueChange: EventEmitter<string> = new EventEmitter<string>();\n\n // @ViewChild('input') input: ElementRef;\n @ViewChild('textAreaDialogTemplate', { read: TemplateRef })\n textAreaDialogTemplate: TemplateRef<any>;\n\n fieldHeight = '';\n standAlone = false;\n isInEditMode = false;\n\n dialogRef: MatDialogRef<any>;\n\n constructor(\n private dialogService: PepDialogService,\n private customizationService: PepCustomizationService,\n private renderer: Renderer2,\n private element: ElementRef\n ) {}\n\n private setFieldHeight(): void {\n this.fieldHeight = this.customizationService.calculateFieldHeight(\n this.layoutType,\n this.rowSpan,\n this.standAlone\n );\n }\n\n private setDefaultForm(): void {\n const pepField = new PepTextareaField({\n key: this.key,\n value: this.value,\n mandatory: this.mandatory,\n readonly: this.readonly,\n disabled: this.disabled,\n maxFieldCharacters: this.maxFieldCharacters,\n });\n this.form = this.customizationService.getDefaultFromGroup(pepField);\n }\n\n ngOnInit(): void {\n if (this.form === null) {\n this.standAlone = true;\n this.setFieldHeight();\n this.setDefaultForm();\n\n this.renderer.addClass(\n this.element.nativeElement,\n PepCustomizationService.STAND_ALONE_FIELD_CLASS_NAME\n );\n }\n }\n\n ngOnChanges(changes: any): void {\n if (this.standAlone) {\n this.setDefaultForm();\n }\n }\n\n ngOnDestroy(): void {\n //\n }\n\n onBlur(event: any): void {\n const value = event.target ? event.target.value : event;\n this.changeValue(value);\n\n setTimeout(() => {\n if (this.isInEditMode) {\n this.isInEditMode = false;\n }\n }, 0);\n }\n\n changeValue(value: any): void {\n if (value !== this.value) {\n this.value = value;\n this.customizationService.updateFormFieldValue(\n this.form,\n this.key,\n value\n );\n this.valueChange.emit(value);\n }\n }\n\n cardTemplateClicked(event: any): void {\n this.openDialog();\n }\n\n openDialog(): void {\n const config = this.dialogService.getDialogConfig(\n {\n // maxWidth: '90vw',\n // maxHeight: '90vh'\n },\n 'regular'\n );\n\n this.dialogRef = this.dialogService.openDialog(\n this.textAreaDialogTemplate,\n {},\n config\n );\n\n this.dialogRef.afterClosed().subscribe((value) => {\n if (value !== undefined && value !== null) {\n this.changeValue(value);\n }\n });\n }\n\n closeDialog(data: any = null): void {\n this.dialogRef?.close(data);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { MatCommonModule } from '@angular/material/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatDialogModule } from '@angular/material/dialog';\n\nimport { PepNgxLibModule } from '@pepperi-addons/ngx-lib';\nimport {\n PepIconModule,\n PepIconRegistry,\n pepIconSystemEdit,\n pepIconSystemClose,\n} from '@pepperi-addons/ngx-lib/icon';\nimport { PepTextboxIconModule } from '@pepperi-addons/ngx-lib/textbox-icon';\nimport { PepFieldTitleModule } from '@pepperi-addons/ngx-lib/field-title';\nimport { PepDialogModule } from '@pepperi-addons/ngx-lib/dialog';\n\nimport { PepTextareaComponent } from './textarea.component';\n\n@NgModule({\n imports: [\n CommonModule,\n ReactiveFormsModule,\n // Material modules,\n MatCommonModule,\n MatButtonModule,\n MatFormFieldModule,\n MatInputModule,\n MatIconModule,\n MatDialogModule,\n // ngx-lib modules\n PepNgxLibModule,\n PepIconModule,\n PepFieldTitleModule,\n PepTextboxIconModule,\n PepDialogModule,\n ],\n exports: [PepTextareaComponent],\n declarations: [PepTextareaComponent],\n})\nexport class PepTextareaModule {\n constructor(private pepIconRegistry: PepIconRegistry) {\n this.pepIconRegistry.registerIcons([\n pepIconSystemEdit,\n pepIconSystemClose,\n ]);\n }\n}\n","/*\n * Public API Surface of ngx-lib/textarea\n */\nexport * from './textarea.module';\nexport * from './textarea.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["DEFAULT_HORIZONTAL_ALIGNMENT","EventEmitter","PepTextareaField","PepCustomizationService","Component","ChangeDetectionStrategy","PepDialogService","Renderer2","ElementRef","Input","Output","ViewChild","TemplateRef","pepIconSystemEdit","pepIconSystemClose","NgModule","CommonModule","ReactiveFormsModule","MatCommonModule","MatButtonModule","MatFormFieldModule","MatInputModule","MatIconModule","MatDialogModule","PepNgxLibModule","PepIconModule","PepFieldTitleModule","PepTextboxIconModule","PepDialogModule","PepIconRegistry"],"mappings":";;;;;;;QAuGI,8BACY,aAA+B,EAC/B,oBAA6C,EAC7C,QAAmB,EACnB,OAAmB;YAHnB,kBAAa,GAAb,aAAa,CAAkB;YAC/B,yBAAoB,GAApB,oBAAoB,CAAyB;YAC7C,aAAQ,GAAR,QAAQ,CAAW;YACnB,YAAO,GAAP,OAAO,CAAY;YA3EtB,QAAG,GAAG,EAAE,CAAC;YACT,UAAK,GAAG,EAAE,CAAC;YACX,UAAK,GAAG,EAAE,CAAC;YACX,cAAS,GAAG,KAAK,CAAC;YAClB,aAAQ,GAAG,KAAK,CAAC;YACjB,aAAQ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APQC,uBAAgB;gBALrBH,8BAAuB;gBAPvBI,cAAS;gBAHTC,eAAU;;;sBAwBTC,UAAK;wBACLA,UAAK;wBACLA,UAAK;4BACLA,UAAK;2BACLA,UAAK;2BACLA,UAAK;qCACLA,UAAK;4BACLA,UAAK;6BACLA,UAAK;0BAGLA,UAAK;0BAULA,UAAK;uBAuBLA,UAAK;2BACLA,UAAK;4BACLA,UAAK;6BAGLA,UAAK;8BASLC,WAAM;yCAINC,cAAS,SAAC,wBAAwB,EAAE,EAAE,IAAI,EAAEC,gBAAW,EAAE;;;;QChD1D,2BAAoB,eAAgC;YAAhC,oBAAe,GAAf,eAAe,CAAiB;YAChD,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;gBAC/BC,sBAAiB;gBACjBC,uBAAkB;aACrB,CAAC,CAAC;SACN;;;;gBA3BJC,aAAQ,SAAC;oBACN,OAAO,EAAE;wBACLC,mBAAY;wBACZC,yBAAmB;;wBAEnBC,sBAAe;wBACfC,sBAAe;wBACfC,4BAAkB;wBAClBC,oBAAc;wBACdC,oBAAa;wBACbC,wBAAe;;wBAEfC,sBAAe;wBACfC,kBAAa;wBACbC,8BAAmB;wBACnBC,gCAAoB;wBACpBC,sBAAe;qBAClB;oBACD,OAAO,EAAE,CAAC,oBAAoB,CAAC;oBAC/B,YAAY,EAAE,CAAC,oBAAoB,CAAC;iBACvC;;;gBA9BGC,oBAAe;;;ICdnB;;;;ICAA;;;;;;;;;;;;;"}
|
|
@@ -228,9 +228,6 @@
|
|
|
228
228
|
: this.maxValue;
|
|
229
229
|
this.setDefaultForm();
|
|
230
230
|
this.renderer.addClass(this.element.nativeElement, ngxLib.PepCustomizationService.STAND_ALONE_FIELD_CLASS_NAME);
|
|
231
|
-
if (!this.renderTitle) {
|
|
232
|
-
this.renderer.addClass(this.element.nativeElement, ngxLib.PepCustomizationService.STAND_ALONE_FIELD_NO_SPACING_CLASS_NAME);
|
|
233
|
-
}
|
|
234
231
|
}
|
|
235
232
|
this.readonly = this.type === 'duration' ? true : this.readonly; // Hack until we develop Timer UI for editing Duration field
|
|
236
233
|
this.updateFormFieldValue();
|
|
@@ -298,7 +295,8 @@
|
|
|
298
295
|
};
|
|
299
296
|
PepTextboxComponent.prototype.onChange = function (e) {
|
|
300
297
|
var value = e.target ? e.target.value : e;
|
|
301
|
-
|
|
298
|
+
// TODO: uncomment
|
|
299
|
+
// this.valueChange.emit(value);
|
|
302
300
|
};
|
|
303
301
|
PepTextboxComponent.prototype.onBlur = function (e) {
|
|
304
302
|
this.isInFocus = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pepperi-addons-ngx-lib-textbox.umd.js","sources":["../../../projects/ngx-lib/textbox/textbox.component.ts","../../../projects/ngx-lib/textbox/textbox-validation.directive.ts","../../../projects/ngx-lib/textbox/textbox.module.ts","../../../projects/ngx-lib/textbox/public-api.ts","../../../projects/ngx-lib/textbox/pepperi-addons-ngx-lib-textbox.ts"],"sourcesContent":["import {\n Component,\n OnInit,\n OnChanges,\n Input,\n Output,\n EventEmitter,\n ChangeDetectionStrategy,\n ElementRef,\n ViewChild,\n Renderer2,\n OnDestroy,\n ChangeDetectorRef,\n HostBinding,\n} from '@angular/core';\nimport { FormGroup, FormBuilder } from '@angular/forms';\nimport { TranslateService } from '@ngx-translate/core';\nimport {\n PepLayoutType,\n PepCustomizationService,\n PepHorizontalAlignment,\n DEFAULT_HORIZONTAL_ALIGNMENT,\n PepTextboxFieldType,\n PepTextboxField,\n PepFieldBase,\n PepUtilitiesService,\n} from '@pepperi-addons/ngx-lib';\n\n/**\n * This is a text box input component that can be use to\n *\n * @export\n * @class PepTextboxComponent\n * @implements {OnChanges}\n * @implements {OnInit}\n * @implements {OnDestroy}\n */\n@Component({\n selector: 'pep-textbox',\n templateUrl: './textbox.component.html',\n styleUrls: ['./textbox.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PepTextboxComponent implements OnChanges, OnInit, OnDestroy {\n\n @HostBinding('attr.data-qa') dataQa = '';\n\n private _key = '';\n /**\n * The text box key\n *\n * @memberof PepTextboxComponent\n */\n @Input()\n set key(value) {\n this._key = value;\n this.dataQa = value;\n }\n get key(): string {\n return this._key;\n }\n\n private _value = '';\n /**\n * The value of the text box.\n *\n * @memberof PepTextboxComponent\n */\n @Input()\n set value(value: string) {\n if (!value) {\n value = '';\n }\n\n this._value = value;\n\n if (this._calculateFormattedValue) {\n this.setFormattedValue(value);\n }\n }\n get value(): string {\n return this._value;\n }\n\n private _formattedValue = null;\n /**\n * The formatted value.\n *\n * @memberof PepTextboxComponent\n */\n @Input()\n set formattedValue(value: string) {\n if (!value) {\n value = '';\n }\n\n if (this._calculateFormattedValue) {\n this._calculateFormattedValue = false;\n }\n\n this.setFormattedValue(value);\n }\n get formattedValue(): string {\n return this._formattedValue;\n }\n\n /**\n * The title of the textbox.\n *\n * @memberof PepTextboxComponent\n */\n @Input() label = '';\n\n /**\n * The placeholder (relevant only for children - if parent isn't null).\n *\n * @memberof PepTextboxComponent\n */\n @Input() placeholder = '';\n\n /**\n * The type of the textbox.\n *\n * @type {PepTextboxFieldType}\n * @memberof PepTextboxComponent\n */\n @Input() type: PepTextboxFieldType = 'text';\n\n /**\n * If the textbox is mandatory\n *\n * @memberof PepTextboxComponent\n */\n @Input() mandatory = false;\n\n // TODO: Check if should remove disabled and keep only readonly.\n /**\n * If the textbox is disabled.\n *\n * @memberof PepTextboxComponent\n */\n @Input() disabled = false;\n\n /**\n * If the textbox is readonly\n *\n * @memberof PepTextboxComponent\n */\n @Input() readonly = false;\n @Input() maxFieldCharacters: number;\n @Input() textColor = '';\n @Input() xAlignment: PepHorizontalAlignment = DEFAULT_HORIZONTAL_ALIGNMENT;\n @Input() rowSpan = 1;\n // @Input() lastFocusField: any;\n @Input() minValue = NaN;\n @Input() maxValue = NaN;\n\n private _visible = true;\n @Input()\n set visible(visible: boolean) {\n this._visible = visible;\n if (visible) {\n this.renderer.removeClass(\n this.element.nativeElement,\n 'hidden-element'\n );\n } else {\n this.renderer.addClass(\n this.element.nativeElement,\n 'hidden-element'\n );\n }\n }\n get visible(): boolean {\n return this._visible;\n }\n\n @Input() form: FormGroup = null;\n @Input() isActive = false;\n @Input() showTitle = true;\n @Input() renderTitle = true;\n @Input() renderError = true;\n @Input() renderSymbol = true;\n @Input() layoutType: PepLayoutType = 'form';\n @Input() parentFieldKey: string = null;\n\n /**\n * The value change event.\n *\n * @type {EventEmitter<string>}\n * @memberof PepTextboxComponent\n */\n @Output()\n valueChange: EventEmitter<string> = new EventEmitter<string>();\n\n @Output()\n formValidationChange: EventEmitter<boolean> = new EventEmitter<boolean>();\n\n @ViewChild('input') input: ElementRef;\n\n private _calculateFormattedValue = true;\n get calculateFormattedValue(): boolean {\n return this._calculateFormattedValue;\n }\n\n controlType = 'textbox';\n\n standAlone = false;\n isInEditMode = false;\n isInFocus: boolean;\n\n constructor(\n public fb: FormBuilder,\n private customizationService: PepCustomizationService,\n private renderer: Renderer2,\n private element: ElementRef,\n private translate: TranslateService,\n private utilitiesService: PepUtilitiesService\n ) {\n this.isInFocus = false;\n }\n\n private setFormattedValue(value: string) {\n if (this._calculateFormattedValue) {\n this._formattedValue = this.isNumberType()\n ? this.utilitiesService.formatNumber(value)\n : value;\n } else {\n this._formattedValue = value;\n }\n\n this.updateFormFieldValue();\n }\n\n private updateFormFieldValue() {\n this.customizationService.updateFormFieldValue(\n this.form,\n this.key,\n this.formattedValue,\n this.parentFieldKey\n );\n }\n\n get displayValue(): string {\n let res = '';\n\n if (this.type == 'link') {\n res = this.formattedValue;\n } else {\n res = this.isInFocus ? this.value : this.formattedValue;\n }\n\n return res;\n }\n\n private setDefaultForm(): void {\n const pepField = new PepTextboxField({\n key: this.key,\n value: this.value,\n mandatory: this.mandatory,\n readonly: this.readonly,\n disabled: this.disabled,\n maxFieldCharacters: this.maxFieldCharacters,\n type: this.type,\n minValue: this.minValue,\n maxValue: this.maxValue,\n });\n this.form = this.customizationService.getDefaultFromGroup(\n pepField,\n this.renderError\n );\n }\n\n ngOnInit(): void {\n if (this.form === null) {\n this.standAlone = true;\n\n this.minValue =\n isNaN(this.minValue) && !isNaN(this.maxValue)\n ? 0\n : this.minValue;\n this.maxValue =\n isNaN(this.maxValue) && !isNaN(this.minValue)\n ? 99999\n : this.maxValue;\n\n this.setDefaultForm();\n\n this.renderer.addClass(\n this.element.nativeElement,\n PepCustomizationService.STAND_ALONE_FIELD_CLASS_NAME\n );\n\n if (!this.renderTitle) {\n this.renderer.addClass(\n this.element.nativeElement,\n PepCustomizationService.STAND_ALONE_FIELD_NO_SPACING_CLASS_NAME\n );\n }\n }\n\n this.readonly = this.type === 'duration' ? true : this.readonly; // Hack until we develop Timer UI for editing Duration field\n\n this.updateFormFieldValue();\n }\n\n ngOnChanges(changes: any): void {\n if (this.standAlone) {\n this.setDefaultForm();\n }\n\n this.readonly = this.type === 'duration' ? true : this.readonly; // Hack until we develop Timer UI for editing Duration field\n }\n\n ngOnDestroy(): void {\n //\n }\n\n onFocus(event: any): void {\n this.isInFocus = true;\n\n // select the value in focus (DI-18246 improvement)\n setTimeout(() => {\n const eventTarget = event.target || event.srcElement;\n if (eventTarget) {\n eventTarget.select();\n }\n }, 0);\n }\n\n isNumberType(): boolean {\n return (\n this.type === 'percentage' ||\n this.type === 'currency' ||\n this.type === 'int' ||\n this.type === 'real'\n );\n }\n\n isValueValid(value: string): boolean {\n let res = false;\n\n if (this.isNumberType()) {\n if (value === '') {\n res = this.mandatory ? false : true;\n } else {\n const numberValue = this.utilitiesService.coerceNumberProperty(\n value\n );\n res =\n numberValue >= this.minValue &&\n numberValue <= this.maxValue;\n }\n } else {\n // TODO: Maybe need to check other types.\n res = true;\n }\n\n return res;\n }\n\n isDifferentValue(value: string): boolean {\n let res = false;\n\n if (this.isNumberType()) {\n if (this.value === '' || value === '') {\n res = true;\n } else {\n const currentValue = this.utilitiesService.coerceNumberProperty(\n this.value\n );\n const newValue = this.utilitiesService.coerceNumberProperty(\n value\n );\n\n res = currentValue !== newValue;\n }\n } else {\n res = true;\n }\n\n return res;\n }\n\n onChange(e: any): void {\n const value = e.target ? e.target.value : e;\n\n this.valueChange.emit(value);\n }\n\n onBlur(e: any): void {\n this.isInFocus = false;\n const value = e.target ? e.target.value : e;\n if (value !== this.value && this.isDifferentValue(value)) {\n // If renderError is false and the new value is not valid.\n if (!this.renderError && !this.isValueValid(value)) {\n this.renderer.setProperty(\n this.input.nativeElement,\n 'value',\n this.value\n );\n } else {\n this.value = value;\n\n // If the user is setting the formatted value then set the value till the user format it and return it back.\n if (!this._calculateFormattedValue) {\n this._formattedValue = value;\n }\n\n this.valueChange.emit(value);\n }\n }\n\n if (this.isInEditMode) {\n this.isInEditMode = false;\n }\n }\n\n anchorClicked(): void {\n const currentValue = this.value;\n if (currentValue.trim().length > 0) {\n switch (this.type) {\n case 'email':\n window.open('mailto:' + currentValue, 'email');\n break;\n case 'phone':\n window.open('tel:' + currentValue, 'tel');\n break;\n case 'link':\n window.open(currentValue);\n break;\n default:\n break;\n }\n }\n }\n\n cardTemplateClicked(event: any): void {\n this.isInEditMode = true;\n\n setTimeout(() => {\n this.input.nativeElement.focus();\n }, 0);\n }\n}\n","import {\n Directive,\n ElementRef,\n HostListener,\n Input,\n OnInit,\n} from '@angular/core';\nimport {\n PepTextboxFieldType,\n PepValidatorService,\n} from '@pepperi-addons/ngx-lib';\n\n@Directive({\n selector: '[pepTextboxValidation]',\n})\nexport class PepTextboxValidationDirective implements OnInit {\n @Input() type: PepTextboxFieldType = 'text';\n\n previousValue = '';\n\n constructor(\n private hostElement: ElementRef,\n private validatorService: PepValidatorService\n ) {}\n\n ngOnInit() {\n //\n }\n\n private isNumber(): boolean {\n return this.isInteger() || this.isDecimal();\n }\n\n private isInteger(): boolean {\n return this.type === 'int';\n }\n\n private isDecimal(): boolean {\n return (\n this.type === 'currency' ||\n this.type === 'percentage' ||\n this.type === 'real'\n );\n }\n\n private isPhone(): boolean {\n return this.type === 'phone';\n }\n\n private isText(): boolean {\n return (\n this.type === 'email' ||\n this.type === 'link' ||\n this.type === 'text'\n );\n }\n\n @HostListener('change', ['$event'])\n onChange(e) {\n this.validateValue(this.hostElement.nativeElement.value);\n }\n\n @HostListener('keydown', ['$event'])\n onKeyDown(e: KeyboardEvent) {\n const originalValue: string = e.target['value'];\n\n if (this.isNumber()) {\n // save value before keydown event\n this.previousValue = originalValue;\n const isNumber = this.validatorService.isNumber(\n e,\n this.isDecimal()\n );\n\n if (isNumber) return;\n else e.preventDefault();\n } else if (this.isPhone()) {\n const isPhone = this.validatorService.isPhone(e);\n if (isPhone) return;\n else e.preventDefault();\n }\n }\n\n validateValue(value: string): void {\n if (this.isNumber()) {\n const newValue = this.validatorService.validateNumber(\n value,\n this.isDecimal()\n );\n this.hostElement.nativeElement['value'] = newValue ? newValue : 0;\n } else if (this.isPhone()) {\n // test phone with regular expression, when\n // phone is invalid, replace it with the previousValue\n const valid = this.validatorService.validatePhone(value);\n this.hostElement.nativeElement['value'] = valid\n ? value\n : this.previousValue;\n } else if (this.isText()) {\n this.hostElement.nativeElement['value'] = value;\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { MatCommonModule } from '@angular/material/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatIconModule } from '@angular/material/icon';\n\nimport { PepNgxLibModule } from '@pepperi-addons/ngx-lib';\nimport {\n PepIconModule,\n PepIconRegistry,\n pepIconSystemEdit,\n} from '@pepperi-addons/ngx-lib/icon';\nimport { PepTextboxIconModule } from '@pepperi-addons/ngx-lib/textbox-icon';\nimport { PepFieldTitleModule } from '@pepperi-addons/ngx-lib/field-title';\n\nimport { PepTextboxComponent } from './textbox.component';\nimport { PepTextboxValidationDirective } from './textbox-validation.directive';\n\n@NgModule({\n imports: [\n CommonModule,\n ReactiveFormsModule,\n // Material modules,\n MatCommonModule,\n MatButtonModule,\n MatFormFieldModule,\n MatInputModule,\n MatIconModule,\n // ngx-lib modules\n PepNgxLibModule,\n PepIconModule,\n PepFieldTitleModule,\n PepTextboxIconModule,\n ],\n exports: [PepTextboxComponent],\n declarations: [PepTextboxComponent, PepTextboxValidationDirective],\n})\nexport class PepTextboxModule {\n constructor(private pepIconRegistry: PepIconRegistry) {\n this.pepIconRegistry.registerIcons([pepIconSystemEdit]);\n }\n}\n","/*\n * Public API Surface of ngx-lib/textbox\n */\nexport * from './textbox.module';\nexport * from './textbox.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {PepTextboxValidationDirective as ɵa} from './textbox-validation.directive';"],"names":["DEFAULT_HORIZONTAL_ALIGNMENT","EventEmitter","PepTextboxField","PepCustomizationService","Component","ChangeDetectionStrategy","FormBuilder","Renderer2","ElementRef","TranslateService","PepUtilitiesService","HostBinding","Input","Output","ViewChild","Directive","PepValidatorService","HostListener","pepIconSystemEdit","NgModule","CommonModule","ReactiveFormsModule","MatCommonModule","MatButtonModule","MatFormFieldModule","MatInputModule","MatIconModule","PepNgxLibModule","PepIconModule","PepFieldTitleModule","PepTextboxIconModule","PepIconRegistry"],"mappings":";;;;;;IA4BA;;;;;;;;;;QAuLI,6BACW,EAAe,EACd,oBAA6C,EAC7C,QAAmB,EACnB,OAAmB,EACnB,SAA2B,EAC3B,gBAAqC;YALtC,OAAE,GAAF,EAAE,CAAa;YACd,yBAAoB,GAApB,oBAAoB,CAAyB;YAC7C,aAAQ,GAAR,QAAQ,CAAW;YACnB,YAAO,GAAP,OAAO,CAAY;YACnB,cAAS,GAAT,SAAS,CAAkB;YAC3B,qBAAgB,GAAhB,gBAAgB,CAAqB;YA5KpB,WAAM,GAAG,EAAE,CAAC;YAEjC,SAAI,GAAG,EAAE,CAAC;YAeV,WAAM,GAAG,EAAE,CAAC;YAsBZ,oBAAe,GAAG,IAAI,CAAC;;;;;;YA2BtB,UAAK,GAAG,EAAE,CAAC;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,mBAAY;wBACZC,yBAAmB;;wBAEnBC,sBAAe;wBACfC,sBAAe;wBACfC,4BAAkB;wBAClBC,oBAAc;wBACdC,oBAAa;;wBAEbC,sBAAe;wBACfC,kBAAa;wBACbC,8BAAmB;wBACnBC,gCAAoB;qBACvB;oBACD,OAAO,EAAE,CAAC,mBAAmB,CAAC;oBAC9B,YAAY,EAAE,CAAC,mBAAmB,EAAE,6BAA6B,CAAC;iBACrE;;;gBA3BGC,oBAAe;;;ICbnB;;;;ICAA;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"pepperi-addons-ngx-lib-textbox.umd.js","sources":["../../../projects/ngx-lib/textbox/textbox.component.ts","../../../projects/ngx-lib/textbox/textbox-validation.directive.ts","../../../projects/ngx-lib/textbox/textbox.module.ts","../../../projects/ngx-lib/textbox/public-api.ts","../../../projects/ngx-lib/textbox/pepperi-addons-ngx-lib-textbox.ts"],"sourcesContent":["import {\n Component,\n OnInit,\n OnChanges,\n Input,\n Output,\n EventEmitter,\n ChangeDetectionStrategy,\n ElementRef,\n ViewChild,\n Renderer2,\n OnDestroy,\n ChangeDetectorRef,\n HostBinding,\n} from '@angular/core';\nimport { FormGroup, FormBuilder } from '@angular/forms';\nimport { TranslateService } from '@ngx-translate/core';\nimport {\n PepLayoutType,\n PepCustomizationService,\n PepHorizontalAlignment,\n DEFAULT_HORIZONTAL_ALIGNMENT,\n PepTextboxFieldType,\n PepTextboxField,\n PepFieldBase,\n PepUtilitiesService,\n} from '@pepperi-addons/ngx-lib';\n\n/**\n * This is a text box input component that can be use to\n *\n * @export\n * @class PepTextboxComponent\n * @implements {OnChanges}\n * @implements {OnInit}\n * @implements {OnDestroy}\n */\n@Component({\n selector: 'pep-textbox',\n templateUrl: './textbox.component.html',\n styleUrls: ['./textbox.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PepTextboxComponent implements OnChanges, OnInit, OnDestroy {\n\n @HostBinding('attr.data-qa') dataQa = '';\n\n private _key = '';\n /**\n * The text box key\n *\n * @memberof PepTextboxComponent\n */\n @Input()\n set key(value) {\n this._key = value;\n this.dataQa = value;\n }\n get key(): string {\n return this._key;\n }\n\n private _value = '';\n /**\n * The value of the text box.\n *\n * @memberof PepTextboxComponent\n */\n @Input()\n set value(value: string) {\n if (!value) {\n value = '';\n }\n\n this._value = value;\n\n if (this._calculateFormattedValue) {\n this.setFormattedValue(value);\n }\n }\n get value(): string {\n return this._value;\n }\n\n private _formattedValue = null;\n /**\n * The formatted value.\n *\n * @memberof PepTextboxComponent\n */\n @Input()\n set formattedValue(value: string) {\n if (!value) {\n value = '';\n }\n\n if (this._calculateFormattedValue) {\n this._calculateFormattedValue = false;\n }\n\n this.setFormattedValue(value);\n }\n get formattedValue(): string {\n return this._formattedValue;\n }\n\n /**\n * The title of the textbox.\n *\n * @memberof PepTextboxComponent\n */\n @Input() label = '';\n\n /**\n * The placeholder (relevant only for children - if parent isn't null).\n *\n * @memberof PepTextboxComponent\n */\n @Input() placeholder = '';\n\n /**\n * The type of the textbox.\n *\n * @type {PepTextboxFieldType}\n * @memberof PepTextboxComponent\n */\n @Input() type: PepTextboxFieldType = 'text';\n\n /**\n * If the textbox is mandatory\n *\n * @memberof PepTextboxComponent\n */\n @Input() mandatory = false;\n\n // TODO: Check if should remove disabled and keep only readonly.\n /**\n * If the textbox is disabled.\n *\n * @memberof PepTextboxComponent\n */\n @Input() disabled = false;\n\n /**\n * If the textbox is readonly\n *\n * @memberof PepTextboxComponent\n */\n @Input() readonly = false;\n @Input() maxFieldCharacters: number;\n @Input() textColor = '';\n @Input() xAlignment: PepHorizontalAlignment = DEFAULT_HORIZONTAL_ALIGNMENT;\n @Input() rowSpan = 1;\n // @Input() lastFocusField: any;\n @Input() minValue = NaN;\n @Input() maxValue = NaN;\n\n private _visible = true;\n @Input()\n set visible(visible: boolean) {\n this._visible = visible;\n if (visible) {\n this.renderer.removeClass(\n this.element.nativeElement,\n 'hidden-element'\n );\n } else {\n this.renderer.addClass(\n this.element.nativeElement,\n 'hidden-element'\n );\n }\n }\n get visible(): boolean {\n return this._visible;\n }\n\n @Input() form: FormGroup = null;\n @Input() isActive = false;\n @Input() showTitle = true;\n @Input() renderTitle = true;\n @Input() renderError = true;\n @Input() renderSymbol = true;\n @Input() layoutType: PepLayoutType = 'form';\n @Input() parentFieldKey: string = null;\n\n /**\n * The value change event.\n *\n * @type {EventEmitter<string>}\n * @memberof PepTextboxComponent\n */\n @Output()\n valueChange: EventEmitter<string> = new EventEmitter<string>();\n\n @Output()\n formValidationChange: EventEmitter<boolean> = new EventEmitter<boolean>();\n\n @ViewChild('input') input: ElementRef;\n\n private _calculateFormattedValue = true;\n get calculateFormattedValue(): boolean {\n return this._calculateFormattedValue;\n }\n\n controlType = 'textbox';\n\n standAlone = false;\n isInEditMode = false;\n isInFocus: boolean;\n\n constructor(\n public fb: FormBuilder,\n private customizationService: PepCustomizationService,\n private renderer: Renderer2,\n private element: ElementRef,\n private translate: TranslateService,\n private utilitiesService: PepUtilitiesService\n ) {\n this.isInFocus = false;\n }\n\n private setFormattedValue(value: string) {\n if (this._calculateFormattedValue) {\n this._formattedValue = this.isNumberType()\n ? this.utilitiesService.formatNumber(value)\n : value;\n } else {\n this._formattedValue = value;\n }\n\n this.updateFormFieldValue();\n }\n\n private updateFormFieldValue() {\n this.customizationService.updateFormFieldValue(\n this.form,\n this.key,\n this.formattedValue,\n this.parentFieldKey\n );\n }\n\n get displayValue(): string {\n let res = '';\n\n if (this.type == 'link') {\n res = this.formattedValue;\n } else {\n res = this.isInFocus ? this.value : this.formattedValue;\n }\n\n return res;\n }\n\n private setDefaultForm(): void {\n const pepField = new PepTextboxField({\n key: this.key,\n value: this.value,\n mandatory: this.mandatory,\n readonly: this.readonly,\n disabled: this.disabled,\n maxFieldCharacters: this.maxFieldCharacters,\n type: this.type,\n minValue: this.minValue,\n maxValue: this.maxValue,\n });\n this.form = this.customizationService.getDefaultFromGroup(\n pepField,\n this.renderError\n );\n }\n\n ngOnInit(): void {\n if (this.form === null) {\n this.standAlone = true;\n\n this.minValue =\n isNaN(this.minValue) && !isNaN(this.maxValue)\n ? 0\n : this.minValue;\n this.maxValue =\n isNaN(this.maxValue) && !isNaN(this.minValue)\n ? 99999\n : this.maxValue;\n\n this.setDefaultForm();\n\n this.renderer.addClass(\n this.element.nativeElement,\n PepCustomizationService.STAND_ALONE_FIELD_CLASS_NAME\n );\n }\n\n this.readonly = this.type === 'duration' ? true : this.readonly; // Hack until we develop Timer UI for editing Duration field\n\n this.updateFormFieldValue();\n }\n\n ngOnChanges(changes: any): void {\n if (this.standAlone) {\n this.setDefaultForm();\n }\n\n this.readonly = this.type === 'duration' ? true : this.readonly; // Hack until we develop Timer UI for editing Duration field\n }\n\n ngOnDestroy(): void {\n //\n }\n\n onFocus(event: any): void {\n this.isInFocus = true;\n\n // select the value in focus (DI-18246 improvement)\n setTimeout(() => {\n const eventTarget = event.target || event.srcElement;\n if (eventTarget) {\n eventTarget.select();\n }\n }, 0);\n }\n\n isNumberType(): boolean {\n return (\n this.type === 'percentage' ||\n this.type === 'currency' ||\n this.type === 'int' ||\n this.type === 'real'\n );\n }\n\n isValueValid(value: string): boolean {\n let res = false;\n\n if (this.isNumberType()) {\n if (value === '') {\n res = this.mandatory ? false : true;\n } else {\n const numberValue = this.utilitiesService.coerceNumberProperty(\n value\n );\n res =\n numberValue >= this.minValue &&\n numberValue <= this.maxValue;\n }\n } else {\n // TODO: Maybe need to check other types.\n res = true;\n }\n\n return res;\n }\n\n isDifferentValue(value: string): boolean {\n let res = false;\n\n if (this.isNumberType()) {\n if (this.value === '' || value === '') {\n res = true;\n } else {\n const currentValue = this.utilitiesService.coerceNumberProperty(\n this.value\n );\n const newValue = this.utilitiesService.coerceNumberProperty(\n value\n );\n\n res = currentValue !== newValue;\n }\n } else {\n res = true;\n }\n\n return res;\n }\n\n onChange(e: any): void {\n const value = e.target ? e.target.value : e;\n\n // TODO: uncomment\n // this.valueChange.emit(value);\n }\n\n onBlur(e: any): void {\n this.isInFocus = false;\n const value = e.target ? e.target.value : e;\n if (value !== this.value && this.isDifferentValue(value)) {\n // If renderError is false and the new value is not valid.\n if (!this.renderError && !this.isValueValid(value)) {\n this.renderer.setProperty(\n this.input.nativeElement,\n 'value',\n this.value\n );\n } else {\n this.value = value;\n\n // If the user is setting the formatted value then set the value till the user format it and return it back.\n if (!this._calculateFormattedValue) {\n this._formattedValue = value;\n }\n\n this.valueChange.emit(value);\n }\n }\n\n if (this.isInEditMode) {\n this.isInEditMode = false;\n }\n }\n\n anchorClicked(): void {\n const currentValue = this.value;\n if (currentValue.trim().length > 0) {\n switch (this.type) {\n case 'email':\n window.open('mailto:' + currentValue, 'email');\n break;\n case 'phone':\n window.open('tel:' + currentValue, 'tel');\n break;\n case 'link':\n window.open(currentValue);\n break;\n default:\n break;\n }\n }\n }\n\n cardTemplateClicked(event: any): void {\n this.isInEditMode = true;\n\n setTimeout(() => {\n this.input.nativeElement.focus();\n }, 0);\n }\n}\n","import {\n Directive,\n ElementRef,\n HostListener,\n Input,\n OnInit,\n} from '@angular/core';\nimport {\n PepTextboxFieldType,\n PepValidatorService,\n} from '@pepperi-addons/ngx-lib';\n\n@Directive({\n selector: '[pepTextboxValidation]',\n})\nexport class PepTextboxValidationDirective implements OnInit {\n @Input() type: PepTextboxFieldType = 'text';\n\n previousValue = '';\n\n constructor(\n private hostElement: ElementRef,\n private validatorService: PepValidatorService\n ) {}\n\n ngOnInit() {\n //\n }\n\n private isNumber(): boolean {\n return this.isInteger() || this.isDecimal();\n }\n\n private isInteger(): boolean {\n return this.type === 'int';\n }\n\n private isDecimal(): boolean {\n return (\n this.type === 'currency' ||\n this.type === 'percentage' ||\n this.type === 'real'\n );\n }\n\n private isPhone(): boolean {\n return this.type === 'phone';\n }\n\n private isText(): boolean {\n return (\n this.type === 'email' ||\n this.type === 'link' ||\n this.type === 'text'\n );\n }\n\n @HostListener('change', ['$event'])\n onChange(e) {\n this.validateValue(this.hostElement.nativeElement.value);\n }\n\n @HostListener('keydown', ['$event'])\n onKeyDown(e: KeyboardEvent) {\n const originalValue: string = e.target['value'];\n\n if (this.isNumber()) {\n // save value before keydown event\n this.previousValue = originalValue;\n const isNumber = this.validatorService.isNumber(\n e,\n this.isDecimal()\n );\n\n if (isNumber) return;\n else e.preventDefault();\n } else if (this.isPhone()) {\n const isPhone = this.validatorService.isPhone(e);\n if (isPhone) return;\n else e.preventDefault();\n }\n }\n\n validateValue(value: string): void {\n if (this.isNumber()) {\n const newValue = this.validatorService.validateNumber(\n value,\n this.isDecimal()\n );\n this.hostElement.nativeElement['value'] = newValue ? newValue : 0;\n } else if (this.isPhone()) {\n // test phone with regular expression, when\n // phone is invalid, replace it with the previousValue\n const valid = this.validatorService.validatePhone(value);\n this.hostElement.nativeElement['value'] = valid\n ? value\n : this.previousValue;\n } else if (this.isText()) {\n this.hostElement.nativeElement['value'] = value;\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { MatCommonModule } from '@angular/material/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatIconModule } from '@angular/material/icon';\n\nimport { PepNgxLibModule } from '@pepperi-addons/ngx-lib';\nimport {\n PepIconModule,\n PepIconRegistry,\n pepIconSystemEdit,\n} from '@pepperi-addons/ngx-lib/icon';\nimport { PepTextboxIconModule } from '@pepperi-addons/ngx-lib/textbox-icon';\nimport { PepFieldTitleModule } from '@pepperi-addons/ngx-lib/field-title';\n\nimport { PepTextboxComponent } from './textbox.component';\nimport { PepTextboxValidationDirective } from './textbox-validation.directive';\n\n@NgModule({\n imports: [\n CommonModule,\n ReactiveFormsModule,\n // Material modules,\n MatCommonModule,\n MatButtonModule,\n MatFormFieldModule,\n MatInputModule,\n MatIconModule,\n // ngx-lib modules\n PepNgxLibModule,\n PepIconModule,\n PepFieldTitleModule,\n PepTextboxIconModule,\n ],\n exports: [PepTextboxComponent],\n declarations: [PepTextboxComponent, PepTextboxValidationDirective],\n})\nexport class PepTextboxModule {\n constructor(private pepIconRegistry: PepIconRegistry) {\n this.pepIconRegistry.registerIcons([pepIconSystemEdit]);\n }\n}\n","/*\n * Public API Surface of ngx-lib/textbox\n */\nexport * from './textbox.module';\nexport * from './textbox.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {PepTextboxValidationDirective as ɵa} from './textbox-validation.directive';"],"names":["DEFAULT_HORIZONTAL_ALIGNMENT","EventEmitter","PepTextboxField","PepCustomizationService","Component","ChangeDetectionStrategy","FormBuilder","Renderer2","ElementRef","TranslateService","PepUtilitiesService","HostBinding","Input","Output","ViewChild","Directive","PepValidatorService","HostListener","pepIconSystemEdit","NgModule","CommonModule","ReactiveFormsModule","MatCommonModule","MatButtonModule","MatFormFieldModule","MatInputModule","MatIconModule","PepNgxLibModule","PepIconModule","PepFieldTitleModule","PepTextboxIconModule","PepIconRegistry"],"mappings":";;;;;;IA4BA;;;;;;;;;;QAuLI,6BACW,EAAe,EACd,oBAA6C,EAC7C,QAAmB,EACnB,OAAmB,EACnB,SAA2B,EAC3B,gBAAqC;YALtC,OAAE,GAAF,EAAE,CAAa;YACd,yBAAoB,GAApB,oBAAoB,CAAyB;YAC7C,aAAQ,GAAR,QAAQ,CAAW;YACnB,YAAO,GAAP,OAAO,CAAY;YACnB,cAAS,GAAT,SAAS,CAAkB;YAC3B,qBAAgB,GAAhB,gBAAgB,CAAqB;YA5KpB,WAAM,GAAG,EAAE,CAAC;YAEjC,SAAI,GAAG,EAAE,CAAC;YAeV,WAAM,GAAG,EAAE,CAAC;YAsBZ,oBAAe,GAAG,IAAI,CAAC;;;;;;YA2BtB,UAAK,GAAG,EAAE,CAAC;;;;;;YAOX,gBAAW,GAAG,EAAE,CAAC;;;;;;;YAQjB,SAAI,GAAwB,MAAM,CAAC;;;;;;YAOnC,cAAS,GAAG,KAAK,CAAC;;;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,6 +2734,88 @@
|
|
|
2734
2734
|
this.SIX_DIGIT_HEX_COLOR_REGEX = /^[0-9a-fA-F]{6}$/;
|
|
2735
2735
|
this.SIX_DIGIT_HEX_COLOR_WITH_HASH_REGEX = /^#[0-9a-fA-F]{6}$/;
|
|
2736
2736
|
}
|
|
2737
|
+
PepColorService.prototype.contrast = function (str1, str2) {
|
|
2738
|
+
var L1 = this.relativeLuminance(this.hex2rgb(str1));
|
|
2739
|
+
var L2 = this.relativeLuminance(this.hex2rgb(str2));
|
|
2740
|
+
if (L1 < L2) {
|
|
2741
|
+
return (L2 + 0.05) / (L1 + 0.05);
|
|
2742
|
+
}
|
|
2743
|
+
return (L1 + 0.05) / (L2 + 0.05);
|
|
2744
|
+
};
|
|
2745
|
+
PepColorService.prototype.findClosestAccessibleDarkerColor = function (adjustableColor, otherColor, contrastRatio) {
|
|
2746
|
+
var _a = this.hex2hsl(adjustableColor), h = _a.h, s = _a.s, l = _a.l;
|
|
2747
|
+
if (this.contrast(adjustableColor, otherColor) >= contrastRatio) {
|
|
2748
|
+
return {
|
|
2749
|
+
color: adjustableColor,
|
|
2750
|
+
lightness: l,
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2753
|
+
var minColor = this.hsl2hex({ h: h, s: s, l: 0 });
|
|
2754
|
+
if (this.contrast(minColor, otherColor) < contrastRatio) {
|
|
2755
|
+
return null;
|
|
2756
|
+
}
|
|
2757
|
+
var min = 0;
|
|
2758
|
+
var max = l;
|
|
2759
|
+
var maxColor = this.hsl2hex({ h: h, s: s, l: l });
|
|
2760
|
+
var lastMinColor;
|
|
2761
|
+
var lastMaxColor;
|
|
2762
|
+
var lTemp;
|
|
2763
|
+
while (minColor !== lastMinColor || maxColor !== lastMaxColor) {
|
|
2764
|
+
lastMinColor = minColor;
|
|
2765
|
+
lastMaxColor = maxColor;
|
|
2766
|
+
lTemp = (min + max) / 2;
|
|
2767
|
+
adjustableColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
2768
|
+
if (this.contrast(adjustableColor, otherColor) < contrastRatio) {
|
|
2769
|
+
max = lTemp;
|
|
2770
|
+
maxColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
2771
|
+
}
|
|
2772
|
+
else {
|
|
2773
|
+
min = lTemp;
|
|
2774
|
+
minColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
return {
|
|
2778
|
+
color: minColor,
|
|
2779
|
+
lightness: min,
|
|
2780
|
+
};
|
|
2781
|
+
};
|
|
2782
|
+
PepColorService.prototype.findClosestAccessibleLighterColor = function (adjustableColor, otherColor, contrastRatio) {
|
|
2783
|
+
var _a = this.hex2hsl(adjustableColor), h = _a.h, s = _a.s, l = _a.l;
|
|
2784
|
+
if (this.contrast(adjustableColor, otherColor) >= contrastRatio) {
|
|
2785
|
+
return {
|
|
2786
|
+
color: adjustableColor,
|
|
2787
|
+
lightness: l,
|
|
2788
|
+
};
|
|
2789
|
+
}
|
|
2790
|
+
var maxColor = this.hsl2hex({ h: h, s: s, l: 100 });
|
|
2791
|
+
if (this.contrast(maxColor, otherColor) < contrastRatio) {
|
|
2792
|
+
return null;
|
|
2793
|
+
}
|
|
2794
|
+
var min = l;
|
|
2795
|
+
var max = 100;
|
|
2796
|
+
var minColor = this.hsl2hex({ h: h, s: s, l: l });
|
|
2797
|
+
var lastMinColor;
|
|
2798
|
+
var lastMaxColor;
|
|
2799
|
+
var lTemp;
|
|
2800
|
+
while (minColor !== lastMinColor || maxColor !== lastMaxColor) {
|
|
2801
|
+
lastMinColor = minColor;
|
|
2802
|
+
lastMaxColor = maxColor;
|
|
2803
|
+
lTemp = (min + max) / 2;
|
|
2804
|
+
adjustableColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
2805
|
+
if (this.contrast(adjustableColor, otherColor) < contrastRatio) {
|
|
2806
|
+
min = lTemp;
|
|
2807
|
+
minColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
2808
|
+
}
|
|
2809
|
+
else {
|
|
2810
|
+
max = lTemp;
|
|
2811
|
+
maxColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
return {
|
|
2815
|
+
color: maxColor,
|
|
2816
|
+
lightness: max,
|
|
2817
|
+
};
|
|
2818
|
+
};
|
|
2737
2819
|
/**
|
|
2738
2820
|
* Convert hex string to 6 digits hex string.
|
|
2739
2821
|
* @param str The string to convert.
|
|
@@ -2762,6 +2844,9 @@
|
|
|
2762
2844
|
* @param color The rgb color to convert.
|
|
2763
2845
|
*/
|
|
2764
2846
|
PepColorService.prototype.rgb2sixDigitHex = function (color) {
|
|
2847
|
+
if (!color) {
|
|
2848
|
+
return null;
|
|
2849
|
+
}
|
|
2765
2850
|
color.r = color.r.toString(16);
|
|
2766
2851
|
color.g = color.g.toString(16);
|
|
2767
2852
|
color.b = color.b.toString(16);
|
|
@@ -2781,6 +2866,9 @@
|
|
|
2781
2866
|
* @param str The hex string to convert.
|
|
2782
2867
|
*/
|
|
2783
2868
|
PepColorService.prototype.hex2rgb = function (str) {
|
|
2869
|
+
if (!str) {
|
|
2870
|
+
return null;
|
|
2871
|
+
}
|
|
2784
2872
|
var sixDigitHex = this.hex2sixDigitHex(str);
|
|
2785
2873
|
if (sixDigitHex === null) {
|
|
2786
2874
|
return null;
|
|
@@ -2792,6 +2880,9 @@
|
|
|
2792
2880
|
};
|
|
2793
2881
|
};
|
|
2794
2882
|
PepColorService.prototype.rgbString2hsl = function (str) {
|
|
2883
|
+
if (!str) {
|
|
2884
|
+
return null;
|
|
2885
|
+
}
|
|
2795
2886
|
var sep = str.indexOf(',') > -1 ? ',' : ' ';
|
|
2796
2887
|
var rgbArr = str.substr(4).split(')')[0].split(sep);
|
|
2797
2888
|
var r = rgbArr[0];
|
|
@@ -2834,6 +2925,9 @@
|
|
|
2834
2925
|
return { h: h, s: s, l: l };
|
|
2835
2926
|
};
|
|
2836
2927
|
PepColorService.prototype.hslString2hsl = function (str) {
|
|
2928
|
+
if (!str) {
|
|
2929
|
+
return null;
|
|
2930
|
+
}
|
|
2837
2931
|
var sep = str.indexOf(',') > -1 ? ',' : ' ';
|
|
2838
2932
|
var hslArr = str.substr(4).split(')')[0].split(sep);
|
|
2839
2933
|
var h = hslArr[0];
|
|
@@ -2923,6 +3017,9 @@
|
|
|
2923
3017
|
return { r: r, g: g, b: b };
|
|
2924
3018
|
};
|
|
2925
3019
|
PepColorService.prototype.hex2hsl = function (str) {
|
|
3020
|
+
if (!str) {
|
|
3021
|
+
return null;
|
|
3022
|
+
}
|
|
2926
3023
|
var sixDigitHex = this.hex2sixDigitHex(str);
|
|
2927
3024
|
if (sixDigitHex === null) {
|
|
2928
3025
|
return null;
|
|
@@ -2934,6 +3031,9 @@
|
|
|
2934
3031
|
return this.rgb2hsl(rgb);
|
|
2935
3032
|
};
|
|
2936
3033
|
PepColorService.prototype.hsl2hex = function (hsl) {
|
|
3034
|
+
if (!hsl) {
|
|
3035
|
+
return null;
|
|
3036
|
+
}
|
|
2937
3037
|
var rgb = this.hsl2rgb(hsl);
|
|
2938
3038
|
return this.rgb2sixDigitHex(rgb);
|
|
2939
3039
|
};
|
|
@@ -2949,88 +3049,6 @@
|
|
|
2949
3049
|
}), 3), r = _b[0], g = _b[1], b = _b[2];
|
|
2950
3050
|
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
2951
3051
|
};
|
|
2952
|
-
PepColorService.prototype.contrast = function (str1, str2) {
|
|
2953
|
-
var L1 = this.relativeLuminance(this.hex2rgb(str1));
|
|
2954
|
-
var L2 = this.relativeLuminance(this.hex2rgb(str2));
|
|
2955
|
-
if (L1 < L2) {
|
|
2956
|
-
return (L2 + 0.05) / (L1 + 0.05);
|
|
2957
|
-
}
|
|
2958
|
-
return (L1 + 0.05) / (L2 + 0.05);
|
|
2959
|
-
};
|
|
2960
|
-
PepColorService.prototype.findClosestAccessibleDarkerColor = function (adjustableColor, otherColor, contrastRatio) {
|
|
2961
|
-
var _a = this.hex2hsl(adjustableColor), h = _a.h, s = _a.s, l = _a.l;
|
|
2962
|
-
if (this.contrast(adjustableColor, otherColor) >= contrastRatio) {
|
|
2963
|
-
return {
|
|
2964
|
-
color: adjustableColor,
|
|
2965
|
-
lightness: l,
|
|
2966
|
-
};
|
|
2967
|
-
}
|
|
2968
|
-
var minColor = this.hsl2hex({ h: h, s: s, l: 0 });
|
|
2969
|
-
if (this.contrast(minColor, otherColor) < contrastRatio) {
|
|
2970
|
-
return null;
|
|
2971
|
-
}
|
|
2972
|
-
var min = 0;
|
|
2973
|
-
var max = l;
|
|
2974
|
-
var maxColor = this.hsl2hex({ h: h, s: s, l: l });
|
|
2975
|
-
var lastMinColor;
|
|
2976
|
-
var lastMaxColor;
|
|
2977
|
-
var lTemp;
|
|
2978
|
-
while (minColor !== lastMinColor || maxColor !== lastMaxColor) {
|
|
2979
|
-
lastMinColor = minColor;
|
|
2980
|
-
lastMaxColor = maxColor;
|
|
2981
|
-
lTemp = (min + max) / 2;
|
|
2982
|
-
adjustableColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
2983
|
-
if (this.contrast(adjustableColor, otherColor) < contrastRatio) {
|
|
2984
|
-
max = lTemp;
|
|
2985
|
-
maxColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
2986
|
-
}
|
|
2987
|
-
else {
|
|
2988
|
-
min = lTemp;
|
|
2989
|
-
minColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
2990
|
-
}
|
|
2991
|
-
}
|
|
2992
|
-
return {
|
|
2993
|
-
color: minColor,
|
|
2994
|
-
lightness: min,
|
|
2995
|
-
};
|
|
2996
|
-
};
|
|
2997
|
-
PepColorService.prototype.findClosestAccessibleLighterColor = function (adjustableColor, otherColor, contrastRatio) {
|
|
2998
|
-
var _a = this.hex2hsl(adjustableColor), h = _a.h, s = _a.s, l = _a.l;
|
|
2999
|
-
if (this.contrast(adjustableColor, otherColor) >= contrastRatio) {
|
|
3000
|
-
return {
|
|
3001
|
-
color: adjustableColor,
|
|
3002
|
-
lightness: l,
|
|
3003
|
-
};
|
|
3004
|
-
}
|
|
3005
|
-
var maxColor = this.hsl2hex({ h: h, s: s, l: 100 });
|
|
3006
|
-
if (this.contrast(maxColor, otherColor) < contrastRatio) {
|
|
3007
|
-
return null;
|
|
3008
|
-
}
|
|
3009
|
-
var min = l;
|
|
3010
|
-
var max = 100;
|
|
3011
|
-
var minColor = this.hsl2hex({ h: h, s: s, l: l });
|
|
3012
|
-
var lastMinColor;
|
|
3013
|
-
var lastMaxColor;
|
|
3014
|
-
var lTemp;
|
|
3015
|
-
while (minColor !== lastMinColor || maxColor !== lastMaxColor) {
|
|
3016
|
-
lastMinColor = minColor;
|
|
3017
|
-
lastMaxColor = maxColor;
|
|
3018
|
-
lTemp = (min + max) / 2;
|
|
3019
|
-
adjustableColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
3020
|
-
if (this.contrast(adjustableColor, otherColor) < contrastRatio) {
|
|
3021
|
-
min = lTemp;
|
|
3022
|
-
minColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
3023
|
-
}
|
|
3024
|
-
else {
|
|
3025
|
-
max = lTemp;
|
|
3026
|
-
maxColor = this.hsl2hex({ h: h, s: s, l: lTemp });
|
|
3027
|
-
}
|
|
3028
|
-
}
|
|
3029
|
-
return {
|
|
3030
|
-
color: maxColor,
|
|
3031
|
-
lightness: max,
|
|
3032
|
-
};
|
|
3033
|
-
};
|
|
3034
3052
|
PepColorService.prototype.findClosestAccessibleColor = function (adjustableColor, otherColor, contrastRatio) {
|
|
3035
3053
|
var closestDarkerColor = this.findClosestAccessibleDarkerColor(adjustableColor, otherColor, contrastRatio);
|
|
3036
3054
|
var closestLighterColor = this.findClosestAccessibleLighterColor(adjustableColor, otherColor, contrastRatio);
|
|
@@ -3881,14 +3899,13 @@
|
|
|
3881
3899
|
};
|
|
3882
3900
|
PepCustomizationService.prototype.getFormControl = function (form, fieldKey, parentFieldKey) {
|
|
3883
3901
|
if (parentFieldKey === void 0) { parentFieldKey = null; }
|
|
3884
|
-
var _a;
|
|
3885
3902
|
var formControl = null;
|
|
3886
3903
|
if (form && form.controls) {
|
|
3887
3904
|
if (parentFieldKey === null) {
|
|
3888
3905
|
formControl = form.controls[fieldKey];
|
|
3889
3906
|
}
|
|
3890
3907
|
else {
|
|
3891
|
-
formControl =
|
|
3908
|
+
formControl = form.controls[parentFieldKey].get(fieldKey);
|
|
3892
3909
|
}
|
|
3893
3910
|
}
|
|
3894
3911
|
return formControl;
|
|
@@ -4521,7 +4538,6 @@
|
|
|
4521
4538
|
return PepCustomizationService;
|
|
4522
4539
|
}());
|
|
4523
4540
|
PepCustomizationService.STAND_ALONE_FIELD_CLASS_NAME = 'pep-field';
|
|
4524
|
-
PepCustomizationService.STAND_ALONE_FIELD_NO_SPACING_CLASS_NAME = 'pep-field-no-spacing';
|
|
4525
4541
|
PepCustomizationService.REM_STRING = 'rem';
|
|
4526
4542
|
PepCustomizationService.PX_STRING = 'px';
|
|
4527
4543
|
PepCustomizationService.USER_THEME = 'user_theme';
|