@ecodev/natural 65.0.0 → 65.0.1
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/ecodev-natural.mjs +74 -48
- package/fesm2022/ecodev-natural.mjs.map +1 -1
- package/index.d.ts +8 -10
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Component, Injectable, DestroyRef, HostListener, HostBinding, Directive, InjectionToken, ElementRef, viewChild, ViewEncapsulation, Injector, Input, input, PLATFORM_ID, signal, computed, effect, output, Pipe, DOCUMENT, LOCALE_ID, provideAppInitializer, contentChild, TemplateRef, EnvironmentInjector, createEnvironmentInjector, createComponent,
|
|
2
|
+
import { inject, Component, Injectable, DestroyRef, HostListener, HostBinding, Directive, InjectionToken, ElementRef, viewChild, ViewEncapsulation, Injector, Input, input, PLATFORM_ID, signal, computed, effect, output, Pipe, DOCUMENT, LOCALE_ID, provideAppInitializer, contentChild, TemplateRef, EnvironmentInjector, createEnvironmentInjector, createComponent, runInInjectionContext, ChangeDetectionStrategy, linkedSignal, ErrorHandler, importProvidersFrom } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/forms';
|
|
4
4
|
import { FormGroup, FormArray, Validators, UntypedFormGroup, UntypedFormArray, FormControl, FormsModule, ReactiveFormsModule, UntypedFormControl, NgControl, FormControlDirective, FormControlName } from '@angular/forms';
|
|
5
5
|
import { NavigationStart, NavigationEnd, ActivatedRoute, Router, RouteConfigLoadStart, RouteConfigLoadEnd, PRIMARY_OUTLET, RouterLink, NavigationError, DefaultUrlSerializer, UrlTree } from '@angular/router';
|
|
@@ -193,12 +193,10 @@ function formatIsoDate(date) {
|
|
|
193
193
|
* So something like: "2021-09-23T17:57:16+09:00"
|
|
194
194
|
*/
|
|
195
195
|
function formatIsoDateTime(date) {
|
|
196
|
-
const timezoneOffsetInMinutes = date.getTimezoneOffset();
|
|
196
|
+
const timezoneOffsetInMinutes = Math.round(date.getTimezoneOffset());
|
|
197
197
|
const timezoneOffsetInHours = -Math.trunc(timezoneOffsetInMinutes / 60); // UTC minus local time
|
|
198
198
|
const sign = timezoneOffsetInHours >= 0 ? '+' : '-';
|
|
199
|
-
const hoursLeadingZero = Math.abs(timezoneOffsetInHours) < 10 ? '0' : '';
|
|
200
199
|
const remainderMinutes = -(timezoneOffsetInMinutes % 60);
|
|
201
|
-
const minutesLeadingZero = Math.abs(remainderMinutes) < 10 ? '0' : '';
|
|
202
200
|
// It's a bit unfortunate that we need to construct a new Date instance,
|
|
203
201
|
// but we don't want the original Date instance to be modified
|
|
204
202
|
const correctedDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
@@ -207,13 +205,9 @@ function formatIsoDateTime(date) {
|
|
|
207
205
|
.toISOString()
|
|
208
206
|
.replace(/\.\d{3}Z/, '')
|
|
209
207
|
.replace('Z', '');
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
Math.abs(timezoneOffsetInHours).toString() +
|
|
214
|
-
':' +
|
|
215
|
-
minutesLeadingZero +
|
|
216
|
-
remainderMinutes);
|
|
208
|
+
const hours = Math.abs(timezoneOffsetInHours).toString().padStart(2, '0');
|
|
209
|
+
const minutes = remainderMinutes.toString().padStart(2, '0');
|
|
210
|
+
return iso + sign + hours + ':' + minutes;
|
|
217
211
|
}
|
|
218
212
|
/**
|
|
219
213
|
* Relations to full objects are converted to their IDs only.
|
|
@@ -8526,7 +8520,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
|
|
|
8526
8520
|
}], ctorParameters: () => [] });
|
|
8527
8521
|
|
|
8528
8522
|
class TypeOptionsComponent {
|
|
8529
|
-
data;
|
|
8530
8523
|
renderedValue = new BehaviorSubject('');
|
|
8531
8524
|
formControl = new FormControl({}, { nonNullable: true });
|
|
8532
8525
|
configuration;
|
|
@@ -8534,10 +8527,8 @@ class TypeOptionsComponent {
|
|
|
8534
8527
|
options: [],
|
|
8535
8528
|
};
|
|
8536
8529
|
dropdownRef = inject(NaturalDropdownRef);
|
|
8537
|
-
constructor(
|
|
8538
|
-
|
|
8539
|
-
data) {
|
|
8540
|
-
this.data = data;
|
|
8530
|
+
constructor() {
|
|
8531
|
+
const data = inject(NATURAL_DROPDOWN_DATA);
|
|
8541
8532
|
this.configuration = { ...this.defaults, ...data.configuration };
|
|
8542
8533
|
if (!this.configuration.options.length) {
|
|
8543
8534
|
throw new Error('TypeOptions need options, empty array or null given');
|
|
@@ -8570,46 +8561,72 @@ class TypeOptionsComponent {
|
|
|
8570
8561
|
isDirty() {
|
|
8571
8562
|
return this.formControl.dirty;
|
|
8572
8563
|
}
|
|
8573
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeOptionsComponent, deps: [
|
|
8564
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeOptionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8574
8565
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.7", type: TypeOptionsComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<mat-button-toggle-group [formControl]=\"formControl\">\n @for (option of configuration.options; track option) {\n <mat-button-toggle [value]=\"option\">{{ option.display }}</mat-button-toggle>\n }\n</mat-button-toggle-group>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }] });
|
|
8575
8566
|
}
|
|
8576
8567
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeOptionsComponent, decorators: [{
|
|
8577
8568
|
type: Component,
|
|
8578
8569
|
args: [{ imports: [FormsModule, ReactiveFormsModule, MatButtonToggleGroup, MatButtonToggle], template: "<mat-button-toggle-group [formControl]=\"formControl\">\n @for (option of configuration.options; track option) {\n <mat-button-toggle [value]=\"option\">{{ option.display }}</mat-button-toggle>\n }\n</mat-button-toggle-group>\n" }]
|
|
8579
|
-
}], ctorParameters: () => [
|
|
8580
|
-
type: Inject,
|
|
8581
|
-
args: [NATURAL_DROPDOWN_DATA]
|
|
8582
|
-
}] }] });
|
|
8570
|
+
}], ctorParameters: () => [] });
|
|
8583
8571
|
|
|
8584
8572
|
class TypeBooleanComponent extends TypeOptionsComponent {
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8573
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeBooleanComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
8574
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.7", type: TypeBooleanComponent, isStandalone: true, selector: "ng-component", providers: [
|
|
8575
|
+
{
|
|
8576
|
+
provide: NATURAL_DROPDOWN_DATA,
|
|
8577
|
+
useFactory: () => {
|
|
8578
|
+
const data = inject(NATURAL_DROPDOWN_DATA, {
|
|
8579
|
+
skipSelf: true,
|
|
8580
|
+
});
|
|
8581
|
+
// Set up options from hardcoded conditions with custom labels from config
|
|
8582
|
+
return {
|
|
8583
|
+
...data,
|
|
8584
|
+
configuration: {
|
|
8585
|
+
options: [
|
|
8586
|
+
{
|
|
8587
|
+
display: data.configuration.displayWhenActive,
|
|
8588
|
+
condition: { equal: { value: true } },
|
|
8589
|
+
},
|
|
8590
|
+
{
|
|
8591
|
+
display: data.configuration.displayWhenInactive,
|
|
8592
|
+
condition: { equal: { value: false } },
|
|
8593
|
+
},
|
|
8594
|
+
],
|
|
8595
|
+
},
|
|
8596
|
+
};
|
|
8597
8597
|
},
|
|
8598
|
-
|
|
8599
|
-
};
|
|
8600
|
-
const typeOptionsData = {
|
|
8601
|
-
...data,
|
|
8602
|
-
...{ configuration: configuration },
|
|
8603
|
-
};
|
|
8604
|
-
super(typeOptionsData);
|
|
8605
|
-
}
|
|
8606
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeBooleanComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8607
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.7", type: TypeBooleanComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<mat-button-toggle-group [formControl]=\"formControl\">\n @for (option of configuration.options; track option) {\n <mat-button-toggle [value]=\"option\">{{ option.display }}</mat-button-toggle>\n }\n</mat-button-toggle-group>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }] });
|
|
8598
|
+
},
|
|
8599
|
+
], usesInheritance: true, ngImport: i0, template: "<mat-button-toggle-group [formControl]=\"formControl\">\n @for (option of configuration.options; track option) {\n <mat-button-toggle [value]=\"option\">{{ option.display }}</mat-button-toggle>\n }\n</mat-button-toggle-group>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }] });
|
|
8608
8600
|
}
|
|
8609
8601
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeBooleanComponent, decorators: [{
|
|
8610
8602
|
type: Component,
|
|
8611
|
-
args: [{ imports: [FormsModule, ReactiveFormsModule, MatButtonToggleGroup, MatButtonToggle],
|
|
8612
|
-
|
|
8603
|
+
args: [{ imports: [FormsModule, ReactiveFormsModule, MatButtonToggleGroup, MatButtonToggle], providers: [
|
|
8604
|
+
{
|
|
8605
|
+
provide: NATURAL_DROPDOWN_DATA,
|
|
8606
|
+
useFactory: () => {
|
|
8607
|
+
const data = inject(NATURAL_DROPDOWN_DATA, {
|
|
8608
|
+
skipSelf: true,
|
|
8609
|
+
});
|
|
8610
|
+
// Set up options from hardcoded conditions with custom labels from config
|
|
8611
|
+
return {
|
|
8612
|
+
...data,
|
|
8613
|
+
configuration: {
|
|
8614
|
+
options: [
|
|
8615
|
+
{
|
|
8616
|
+
display: data.configuration.displayWhenActive,
|
|
8617
|
+
condition: { equal: { value: true } },
|
|
8618
|
+
},
|
|
8619
|
+
{
|
|
8620
|
+
display: data.configuration.displayWhenInactive,
|
|
8621
|
+
condition: { equal: { value: false } },
|
|
8622
|
+
},
|
|
8623
|
+
],
|
|
8624
|
+
},
|
|
8625
|
+
};
|
|
8626
|
+
},
|
|
8627
|
+
},
|
|
8628
|
+
], template: "<mat-button-toggle-group [formControl]=\"formControl\">\n @for (option of configuration.options; track option) {\n <mat-button-toggle [value]=\"option\">{{ option.display }}</mat-button-toggle>\n }\n</mat-button-toggle-group>\n" }]
|
|
8629
|
+
}] });
|
|
8613
8630
|
|
|
8614
8631
|
/*
|
|
8615
8632
|
* Public API Surface of natural-search dropdown components
|
|
@@ -8622,13 +8639,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
|
|
|
8622
8639
|
*/
|
|
8623
8640
|
const commonImageMimeTypes = 'image/avif,image/bmp,image/x-ms-bmp,image/gif,image/heic,image/heif,image/jpeg,image/pjpeg,image/png,image/svg+xml,image/svg,image/webp';
|
|
8624
8641
|
function acceptType(accept, type, filename) {
|
|
8625
|
-
|
|
8642
|
+
const mimeAndExtensions = accept
|
|
8643
|
+
.trim()
|
|
8644
|
+
.toLowerCase()
|
|
8645
|
+
.split(',')
|
|
8646
|
+
.map(s => s.trim())
|
|
8647
|
+
.filter(s => s);
|
|
8648
|
+
if (!mimeAndExtensions.length) {
|
|
8626
8649
|
return true;
|
|
8627
8650
|
}
|
|
8628
8651
|
type = type.toLowerCase();
|
|
8629
8652
|
filename = filename.toLowerCase();
|
|
8630
|
-
|
|
8631
|
-
|
|
8653
|
+
const mimeAsExtensions = mimeAndExtensions
|
|
8654
|
+
.map(s => /^[^/]+\/(.*)$/.exec(s)?.[1])
|
|
8655
|
+
.filter(s => s)
|
|
8656
|
+
.map(s => '.' + s);
|
|
8657
|
+
return [...mimeAndExtensions, ...mimeAsExtensions].some(mimeOrExtension => {
|
|
8632
8658
|
if (mimeOrExtension.startsWith('.')) {
|
|
8633
8659
|
return filename.endsWith(mimeOrExtension);
|
|
8634
8660
|
}
|