@alfresco/adf-core 8.4.0-18836740311 → 8.4.0-18876786165
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/fesm2022/adf-core.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Input, ChangeDetectionStrategy, ViewEncapsulation, Component, inject, Injectable, TemplateRef, ContentChild, Directive, ContentChildren, RendererFactory2, Optional, Inject, NgModule, HostBinding, Pipe, InjectionToken, provideAppInitializer, EventEmitter, HostListener, ViewChild, Output, ViewChildren, DestroyRef, QueryList, DEFAULT_CURRENCY_CODE, SecurityContext, ElementRef, ViewContainerRef, forwardRef, Compiler, Injector } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
|
-
import { CommonModule, DOCUMENT, NgIf, NgClass, NgForOf, AsyncPipe, NgTemplateOutlet, NgStyle, DecimalPipe, DatePipe, NgFor } from '@angular/common';
|
|
4
|
+
import { CommonModule, DOCUMENT, NgIf, NgClass, NgForOf, AsyncPipe, NgTemplateOutlet, NgStyle, DecimalPipe, DatePipe, CurrencyPipe, NgFor } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/material/table';
|
|
6
6
|
import { MatTableModule, MatTableDataSource } from '@angular/material/table';
|
|
7
7
|
import * as i1$1 from '@ngx-translate/core';
|
|
8
8
|
import { TranslatePipe, provideTranslateService, TranslateLoader } from '@ngx-translate/core';
|
|
9
9
|
import * as i1$8 from '@angular/common/http';
|
|
10
10
|
import { HttpClient, HttpHeaders, HttpResponse, provideHttpClient, HTTP_INTERCEPTORS, withInterceptorsFromDi, withXsrfConfiguration } from '@angular/common/http';
|
|
11
|
-
import { ReplaySubject, BehaviorSubject, of, Subject, switchMap as switchMap$1, from, fromEvent, Observable, throwError, firstValueFrom, combineLatest, defer, EMPTY, race, forkJoin, merge } from 'rxjs';
|
|
11
|
+
import { ReplaySubject, BehaviorSubject, of, Subject, switchMap as switchMap$1, from, fromEvent, Observable, throwError, firstValueFrom, combineLatest, defer, EMPTY, race, forkJoin, merge, isObservable } from 'rxjs';
|
|
12
12
|
import { map, distinctUntilChanged, take, switchMap, delay, catchError, skipWhile, filter, first, timeout, shareReplay, mergeMap, tap, retry, takeUntil, debounceTime, share, pairwise, buffer } from 'rxjs/operators';
|
|
13
13
|
import * as i1$4 from '@alfresco/adf-extensions';
|
|
14
14
|
import { ExtensionService, mergeObjects, ExtensionsModule, PreviewExtensionComponent } from '@alfresco/adf-extensions';
|
|
@@ -22588,25 +22588,91 @@ class AmountWidgetComponent extends WidgetComponent {
|
|
|
22588
22588
|
get placeholder() {
|
|
22589
22589
|
return this.showPlaceholder ? this.field.placeholder : '';
|
|
22590
22590
|
}
|
|
22591
|
-
constructor(formService, settings) {
|
|
22591
|
+
constructor(formService, settings, currencyPipe) {
|
|
22592
22592
|
super(formService);
|
|
22593
22593
|
this.formService = formService;
|
|
22594
|
-
this.
|
|
22594
|
+
this.currencyPipe = currencyPipe;
|
|
22595
22595
|
this.showPlaceholder = true;
|
|
22596
22596
|
this.currency = AmountWidgetComponent.DEFAULT_CURRENCY;
|
|
22597
|
+
this.currencyDisplay = 'symbol';
|
|
22598
|
+
this.notShowDecimalDigits = '1.0-0';
|
|
22599
|
+
this.showDecimalDigits = '1.2-2';
|
|
22600
|
+
if (isObservable(settings)) {
|
|
22601
|
+
settings.pipe(takeUntilDestroyed()).subscribe((data) => {
|
|
22602
|
+
this.updateSettingsBasedProperties(data);
|
|
22603
|
+
});
|
|
22604
|
+
}
|
|
22605
|
+
else {
|
|
22606
|
+
this.updateSettingsBasedProperties(settings);
|
|
22607
|
+
}
|
|
22597
22608
|
}
|
|
22598
22609
|
ngOnInit() {
|
|
22599
22610
|
if (this.field) {
|
|
22600
22611
|
if (this.field.currency) {
|
|
22601
22612
|
this.currency = this.field.currency;
|
|
22602
22613
|
}
|
|
22614
|
+
else {
|
|
22615
|
+
if (this.enableDisplayBasedOnLocale) {
|
|
22616
|
+
this.currency = '';
|
|
22617
|
+
this.currencyDisplay = '';
|
|
22618
|
+
}
|
|
22619
|
+
}
|
|
22603
22620
|
if (this.field.readOnly) {
|
|
22604
|
-
this.showPlaceholder = this.
|
|
22621
|
+
this.showPlaceholder = this.showReadonlyPlaceholder;
|
|
22622
|
+
}
|
|
22623
|
+
this.setInitialValues();
|
|
22624
|
+
}
|
|
22625
|
+
}
|
|
22626
|
+
amountWidgetOnBlur() {
|
|
22627
|
+
if (this.enableDisplayBasedOnLocale) {
|
|
22628
|
+
if (this.amountWidgetValue) {
|
|
22629
|
+
this.valueAsNumber = parseFloat(this.amountWidgetValue);
|
|
22630
|
+
this.amountWidgetValue = this.currencyPipe.transform(this.amountWidgetValue, this.currency, this.currencyDisplay, this.decimalProperty);
|
|
22605
22631
|
}
|
|
22632
|
+
else {
|
|
22633
|
+
this.valueAsNumber = null;
|
|
22634
|
+
this.amountWidgetValue = null;
|
|
22635
|
+
}
|
|
22636
|
+
}
|
|
22637
|
+
this.markAsTouched();
|
|
22638
|
+
}
|
|
22639
|
+
amountWidgetOnFocus() {
|
|
22640
|
+
if (this.enableDisplayBasedOnLocale) {
|
|
22641
|
+
const hasValue = this.valueAsNumber === 0 || this.valueAsNumber;
|
|
22642
|
+
this.amountWidgetValue = hasValue ? this.valueAsNumber.toString() : null;
|
|
22643
|
+
}
|
|
22644
|
+
}
|
|
22645
|
+
getLocale() {
|
|
22646
|
+
const defaultLocale = 'en-US';
|
|
22647
|
+
if (typeof window?.navigator === 'undefined') {
|
|
22648
|
+
return defaultLocale;
|
|
22649
|
+
}
|
|
22650
|
+
const wn = window.navigator;
|
|
22651
|
+
let lang = wn.languages ? wn.languages[0] : defaultLocale;
|
|
22652
|
+
lang = lang || wn.language;
|
|
22653
|
+
return lang;
|
|
22654
|
+
}
|
|
22655
|
+
onFieldChangedAmountWidget() {
|
|
22656
|
+
this.field.value = this.amountWidgetValue;
|
|
22657
|
+
super.onFieldChanged(this.field);
|
|
22658
|
+
}
|
|
22659
|
+
setInitialValues() {
|
|
22660
|
+
if (this.enableDisplayBasedOnLocale) {
|
|
22661
|
+
this.decimalProperty = this.field.enableFractions ? this.showDecimalDigits : this.notShowDecimalDigits;
|
|
22662
|
+
this.locale = this.getLocale();
|
|
22663
|
+
this.valueAsNumber = this.field.value;
|
|
22664
|
+
this.amountWidgetValue = this.currencyPipe.transform(this.field.value, this.currency, this.currencyDisplay, this.decimalProperty, this.locale);
|
|
22665
|
+
}
|
|
22666
|
+
else {
|
|
22667
|
+
this.amountWidgetValue = this.field.value;
|
|
22606
22668
|
}
|
|
22607
22669
|
}
|
|
22608
|
-
|
|
22609
|
-
|
|
22670
|
+
updateSettingsBasedProperties(data) {
|
|
22671
|
+
this.enableDisplayBasedOnLocale = data?.enableDisplayBasedOnLocale ?? false;
|
|
22672
|
+
this.showReadonlyPlaceholder = data?.showReadonlyPlaceholder;
|
|
22673
|
+
}
|
|
22674
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: AmountWidgetComponent, deps: [{ token: FormService }, { token: ADF_AMOUNT_SETTINGS, optional: true }, { token: i1.CurrencyPipe }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
22675
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.6", type: AmountWidgetComponent, isStandalone: true, selector: "amount-widget", host: { listeners: { "click": "event($event)", "blur": "event($event)", "change": "event($event)", "focus": "event($event)", "focusin": "event($event)", "focusout": "event($event)", "input": "event($event)", "invalid": "event($event)", "select": "event($event)" } }, providers: [CurrencyPipe], usesInheritance: true, ngImport: i0, template: "<div\n class=\"adf-amount-widget__container adf-amount-widget {{field.className}}\"\n [class.adf-invalid]=\"!field.isValid && isTouched()\"\n [class.adf-readonly]=\"field.readOnly\"\n [class.adf-left-label-input-container]=\"field.leftLabels\"\n>\n <div *ngIf=\"field.leftLabels\">\n <label class=\"adf-label adf-left-label\" [attr.for]=\"field.id\"\n >{{field.name | translate }}<span class=\"adf-asterisk\" [style.visibility]=\"isRequired() ? 'visible' : 'hidden'\">*</span></label\n >\n </div>\n <div class=\"adf-amount-widget-container\">\n <mat-form-field class=\"adf-amount-widget__input adf-form-field-input\" [floatLabel]=\"placeholder ? 'always' : null\">\n @if ( (field.name || field?.required) && !field.leftLabels) { <mat-label class=\"adf-label\" [attr.for]=\"field.id\">{{field.name | translate }}</mat-label> }\n @if(!enableDisplayBasedOnLocale) {\n <span matTextPrefix class=\"adf-amount-widget__prefix-spacing\">{{ currency }} </span>\n }\n <input\n matInput\n [title]=\"field.tooltip\"\n class=\"adf-input\"\n type=\"text\"\n [id]=\"field.id\"\n [required]=\"field.required && field.isVisible\"\n [placeholder]=\"placeholder\"\n [value]=\"amountWidgetValue\"\n [(ngModel)]=\"amountWidgetValue\"\n (ngModelChange)=\"onFieldChangedAmountWidget()\"\n [disabled]=\"field.readOnly\"\n (focus)=\"amountWidgetOnFocus()\"\n (blur)=\"amountWidgetOnBlur()\"\n />\n </mat-form-field>\n <div class=\"adf-error-messages-container\">\n <error-widget [error]=\"field.validationSummary\" />\n <error-widget\n *ngIf=\"isInvalidFieldRequired() && isTouched()\"\n required=\"{{ 'FORM.FIELD.REQUIRED' | translate }}\"\n />\n </div>\n </div>\n</div>\n", styles: [".adf-amount-widget{width:100%}.adf-amount-widget .adf-left-label{line-height:36px}.adf-amount-widget-container{display:grid;align-items:flex-start}.adf-amount-widget__input .mat-focused{transition:none}.adf-amount-widget__input .adf-input{margin-top:3px}.adf-amount-widget__input:not(.mat-focused):not(.mat-form-field-invalid) .adf-amount-widget__prefix-spacing{color:var(--adf-theme-foreground-secondary-text-color)}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$3.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ErrorWidgetComponent, selector: "error-widget", inputs: ["error", "required"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
22610
22676
|
}
|
|
22611
22677
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: AmountWidgetComponent, decorators: [{
|
|
22612
22678
|
type: Component,
|
|
@@ -22620,13 +22686,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
|
|
|
22620
22686
|
'(input)': 'event($event)',
|
|
22621
22687
|
'(invalid)': 'event($event)',
|
|
22622
22688
|
'(select)': 'event($event)'
|
|
22623
|
-
}, imports: [MatFormFieldModule, MatInputModule, FormsModule, ErrorWidgetComponent, TranslatePipe, NgIf], encapsulation: ViewEncapsulation.None, template: "<div\n class=\"adf-amount-widget__container adf-amount-widget {{field.className}}\"\n [class.adf-invalid]=\"!field.isValid && isTouched()\"\n [class.adf-readonly]=\"field.readOnly\"\n [class.adf-left-label-input-container]=\"field.leftLabels\"\n>\n <div *ngIf=\"field.leftLabels\">\n <label class=\"adf-label adf-left-label\" [attr.for]=\"field.id\"\n >{{field.name | translate }}<span class=\"adf-asterisk\" [style.visibility]=\"isRequired() ? 'visible' : 'hidden'\">*</span></label\n >\n </div>\n <div class=\"adf-amount-widget-container\">\n <mat-form-field class=\"adf-amount-widget__input adf-form-field-input\" [floatLabel]=\"placeholder ? 'always' : null\">\n @if ( (field.name || field?.required) && !field.leftLabels) { <mat-label class=\"adf-label\" [attr.for]=\"field.id\">{{field.name | translate }}</mat-label> }\n <span matTextPrefix class=\"adf-amount-widget__prefix-spacing\">{{ currency }} </span>\n <input\n matInput\n [title]=\"field.tooltip\"\n class=\"adf-input\"\n type=\"text\"\n [id]=\"field.id\"\n [required]=\"field.required && field.isVisible\"\n [placeholder]=\"placeholder\"\n [value]=\"
|
|
22689
|
+
}, imports: [MatFormFieldModule, MatInputModule, FormsModule, ErrorWidgetComponent, TranslatePipe, NgIf], providers: [CurrencyPipe], encapsulation: ViewEncapsulation.None, template: "<div\n class=\"adf-amount-widget__container adf-amount-widget {{field.className}}\"\n [class.adf-invalid]=\"!field.isValid && isTouched()\"\n [class.adf-readonly]=\"field.readOnly\"\n [class.adf-left-label-input-container]=\"field.leftLabels\"\n>\n <div *ngIf=\"field.leftLabels\">\n <label class=\"adf-label adf-left-label\" [attr.for]=\"field.id\"\n >{{field.name | translate }}<span class=\"adf-asterisk\" [style.visibility]=\"isRequired() ? 'visible' : 'hidden'\">*</span></label\n >\n </div>\n <div class=\"adf-amount-widget-container\">\n <mat-form-field class=\"adf-amount-widget__input adf-form-field-input\" [floatLabel]=\"placeholder ? 'always' : null\">\n @if ( (field.name || field?.required) && !field.leftLabels) { <mat-label class=\"adf-label\" [attr.for]=\"field.id\">{{field.name | translate }}</mat-label> }\n @if(!enableDisplayBasedOnLocale) {\n <span matTextPrefix class=\"adf-amount-widget__prefix-spacing\">{{ currency }} </span>\n }\n <input\n matInput\n [title]=\"field.tooltip\"\n class=\"adf-input\"\n type=\"text\"\n [id]=\"field.id\"\n [required]=\"field.required && field.isVisible\"\n [placeholder]=\"placeholder\"\n [value]=\"amountWidgetValue\"\n [(ngModel)]=\"amountWidgetValue\"\n (ngModelChange)=\"onFieldChangedAmountWidget()\"\n [disabled]=\"field.readOnly\"\n (focus)=\"amountWidgetOnFocus()\"\n (blur)=\"amountWidgetOnBlur()\"\n />\n </mat-form-field>\n <div class=\"adf-error-messages-container\">\n <error-widget [error]=\"field.validationSummary\" />\n <error-widget\n *ngIf=\"isInvalidFieldRequired() && isTouched()\"\n required=\"{{ 'FORM.FIELD.REQUIRED' | translate }}\"\n />\n </div>\n </div>\n</div>\n", styles: [".adf-amount-widget{width:100%}.adf-amount-widget .adf-left-label{line-height:36px}.adf-amount-widget-container{display:grid;align-items:flex-start}.adf-amount-widget__input .mat-focused{transition:none}.adf-amount-widget__input .adf-input{margin-top:3px}.adf-amount-widget__input:not(.mat-focused):not(.mat-form-field-invalid) .adf-amount-widget__prefix-spacing{color:var(--adf-theme-foreground-secondary-text-color)}\n"] }]
|
|
22624
22690
|
}], ctorParameters: () => [{ type: FormService }, { type: undefined, decorators: [{
|
|
22691
|
+
type: Optional
|
|
22692
|
+
}, {
|
|
22625
22693
|
type: Inject,
|
|
22626
22694
|
args: [ADF_AMOUNT_SETTINGS]
|
|
22627
|
-
}, {
|
|
22628
|
-
type: Optional
|
|
22629
|
-
}] }] });
|
|
22695
|
+
}] }, { type: i1.CurrencyPipe }] });
|
|
22630
22696
|
|
|
22631
22697
|
/*!
|
|
22632
22698
|
* @license
|