@smallpearl/ngx-helper 20.0.3 → 21.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/smallpearl-ngx-helper-entities.mjs +3 -3
- package/fesm2022/smallpearl-ngx-helper-entities.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs +3 -3
- package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-locale.mjs +6 -6
- package/fesm2022/smallpearl-ngx-helper-locale.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs +9 -9
- package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs +3 -3
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs +17 -17
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs +30 -45
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs +21 -21
- package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs +15 -15
- package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs +106 -115
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-infinite-scroll.mjs +6 -6
- package/fesm2022/smallpearl-ngx-helper-mat-select-infinite-scroll.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs +166 -140
- package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs +38 -36
- package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs +6 -6
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-utils.mjs +23 -0
- package/fesm2022/smallpearl-ngx-helper-utils.mjs.map +1 -0
- package/fesm2022/smallpearl-ngx-helper.mjs +2 -7
- package/fesm2022/smallpearl-ngx-helper.mjs.map +1 -1
- package/package.json +35 -35
- package/{mat-select-entity/index.d.ts → types/smallpearl-ngx-helper-mat-select-entity.d.ts} +2 -1
- package/types/smallpearl-ngx-helper-utils.d.ts +6 -0
- package/types/smallpearl-ngx-helper.d.ts +3 -0
- package/core/index.d.ts +0 -3
- package/fesm2022/smallpearl-ngx-helper-core.mjs +0 -8
- package/fesm2022/smallpearl-ngx-helper-core.mjs.map +0 -1
- package/index.d.ts +0 -4
- /package/{entities/index.d.ts → types/smallpearl-ngx-helper-entities.d.ts} +0 -0
- /package/{entity-field/index.d.ts → types/smallpearl-ngx-helper-entity-field.d.ts} +0 -0
- /package/{forms/index.d.ts → types/smallpearl-ngx-helper-forms.d.ts} +0 -0
- /package/{hover-dropdown/index.d.ts → types/smallpearl-ngx-helper-hover-dropdown.d.ts} +0 -0
- /package/{locale/index.d.ts → types/smallpearl-ngx-helper-locale.d.ts} +0 -0
- /package/{mat-busy-wheel/index.d.ts → types/smallpearl-ngx-helper-mat-busy-wheel.d.ts} +0 -0
- /package/{mat-context-menu/index.d.ts → types/smallpearl-ngx-helper-mat-context-menu.d.ts} +0 -0
- /package/{mat-entity-crud/index.d.ts → types/smallpearl-ngx-helper-mat-entity-crud.d.ts} +0 -0
- /package/{mat-entity-list/index.d.ts → types/smallpearl-ngx-helper-mat-entity-list.d.ts} +0 -0
- /package/{mat-file-input/index.d.ts → types/smallpearl-ngx-helper-mat-file-input.d.ts} +0 -0
- /package/{mat-form-error/index.d.ts → types/smallpearl-ngx-helper-mat-form-error.d.ts} +0 -0
- /package/{mat-select-infinite-scroll/index.d.ts → types/smallpearl-ngx-helper-mat-select-infinite-scroll.d.ts} +0 -0
- /package/{mat-side-menu-layout/index.d.ts → types/smallpearl-ngx-helper-mat-side-menu-layout.d.ts} +0 -0
- /package/{mat-tel-input/index.d.ts → types/smallpearl-ngx-helper-mat-tel-input.d.ts} +0 -0
- /package/{sideload/index.d.ts → types/smallpearl-ngx-helper-sideload.d.ts} +0 -0
- /package/{stationary-with-line-items/index.d.ts → types/smallpearl-ngx-helper-stationary-with-line-items.d.ts} +0 -0
|
@@ -51,8 +51,7 @@ class DefaultPaginator {
|
|
|
51
51
|
// of the sideloaded responses where the main entities are stored
|
|
52
52
|
// under the plural entity name key and resp['meta'] object contains
|
|
53
53
|
// the total count.
|
|
54
|
-
if (keys.includes(entityNamePlural) &&
|
|
55
|
-
Array.isArray(resp[entityNamePlural])) {
|
|
54
|
+
if (keys.includes(entityNamePlural) && Array.isArray(resp[entityNamePlural])) {
|
|
56
55
|
let total = resp[entityNamePlural].length;
|
|
57
56
|
if (keys.includes('meta') &&
|
|
58
57
|
typeof resp['meta'] === 'object' &&
|
|
@@ -129,6 +128,7 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
129
128
|
multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
130
129
|
// Set to true to make the mat-select readonly
|
|
131
130
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
131
|
+
myInput = input('', ...(ngDevMode ? [{ debugName: "myInput" }] : []));
|
|
132
132
|
/**
|
|
133
133
|
* The entity key name that is used to classify entities into groups or
|
|
134
134
|
* a function that takes a TEntity and returns the group id (string).
|
|
@@ -191,10 +191,10 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
191
191
|
// configuration that can be shared across both mat-entity-list and
|
|
192
192
|
// mat-select-entity later.
|
|
193
193
|
// entityListConfig = getEntityListConfig();
|
|
194
|
-
// protected _paginator = computed<
|
|
194
|
+
// protected _paginator = computed<SPEntityListPaginator>(() => {
|
|
195
195
|
// const paginator = this.paginator();
|
|
196
196
|
// const entityListConfigPaginator = this.entityListConfig
|
|
197
|
-
// ?.paginator as
|
|
197
|
+
// ?.paginator as SPEntityListPaginator;
|
|
198
198
|
// return paginator
|
|
199
199
|
// ? paginator
|
|
200
200
|
// : entityListConfigPaginator ?? new DefaultPaginator();
|
|
@@ -273,10 +273,7 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
273
273
|
// load with the new filterStr as the search param.
|
|
274
274
|
//
|
|
275
275
|
// The following logic implements the above.
|
|
276
|
-
combineLatest([
|
|
277
|
-
emittedStatusObservable(store$, 0),
|
|
278
|
-
emittedStatusObservable(filter$, 1),
|
|
279
|
-
])
|
|
276
|
+
combineLatest([emittedStatusObservable(store$, 0), emittedStatusObservable(filter$, 1)])
|
|
280
277
|
.pipe(takeUntil(this.destroy), tap(([entities, filterStr]) => {
|
|
281
278
|
if (emittedObservable.every((eo) => eo)) {
|
|
282
279
|
// initial emission. This can be combined with the case immediately
|
|
@@ -342,9 +339,7 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
342
339
|
return '';
|
|
343
340
|
}
|
|
344
341
|
get selectTriggerValueAsArray() {
|
|
345
|
-
return Array.isArray(this.selectValue)
|
|
346
|
-
? this.selectValue
|
|
347
|
-
: [];
|
|
342
|
+
return Array.isArray(this.selectValue) ? this.selectValue : [];
|
|
348
343
|
}
|
|
349
344
|
entityId(entity) {
|
|
350
345
|
return entity[this.idKey()];
|
|
@@ -414,8 +409,7 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
414
409
|
this.stateChanges.next();
|
|
415
410
|
}
|
|
416
411
|
get required() {
|
|
417
|
-
return
|
|
418
|
-
this.ngControl?.control?.hasValidator(Validators.required));
|
|
412
|
+
return this._required ?? this.ngControl?.control?.hasValidator(Validators.required);
|
|
419
413
|
}
|
|
420
414
|
set required(req) {
|
|
421
415
|
this._required = coerceBooleanProperty(req);
|
|
@@ -549,6 +543,7 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
549
543
|
});
|
|
550
544
|
this.filteredValues.next(filteredEntities);
|
|
551
545
|
}
|
|
546
|
+
this.cdr.detectChanges();
|
|
552
547
|
}
|
|
553
548
|
/**
|
|
554
549
|
* Filtering grouped entities logic works like this. If the search string
|
|
@@ -699,8 +694,8 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
699
694
|
this.loadNextPage();
|
|
700
695
|
}
|
|
701
696
|
}
|
|
702
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
703
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
697
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPMatSelectEntityComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
698
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: SPMatSelectEntityComponent, isStandalone: true, selector: "sp-mat-select-entity", inputs: { labelFn: { classPropertyName: "labelFn", publicName: "labelFn", isSignal: true, isRequired: false, transformFunction: null }, filterFn: { classPropertyName: "filterFn", publicName: "filterFn", isSignal: true, isRequired: false, transformFunction: null }, inlineNew: { classPropertyName: "inlineNew", publicName: "inlineNew", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, myInput: { classPropertyName: "myInput", publicName: "myInput", isSignal: true, isRequired: false, transformFunction: null }, groupOptionsKey: { classPropertyName: "groupOptionsKey", publicName: "groupOptionsKey", isSignal: true, isRequired: false, transformFunction: null }, groupLabelFn: { classPropertyName: "groupLabelFn", publicName: "groupLabelFn", isSignal: true, isRequired: false, transformFunction: null }, searchText: { classPropertyName: "searchText", publicName: "searchText", isSignal: true, isRequired: false, transformFunction: null }, notFoundText: { classPropertyName: "notFoundText", publicName: "notFoundText", isSignal: true, isRequired: false, transformFunction: null }, createNewText: { classPropertyName: "createNewText", publicName: "createNewText", isSignal: true, isRequired: false, transformFunction: null }, optionLabelTemplate: { classPropertyName: "optionLabelTemplate", publicName: "optionLabelTemplate", isSignal: true, isRequired: false, transformFunction: null }, entities: { classPropertyName: "entities", publicName: "entities", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, userAriaDescribedBy: { classPropertyName: "userAriaDescribedBy", publicName: "aria-describedby", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange", createNewItemSelected: "createNewItemSelected" }, host: { properties: { "id": "this.id" } }, providers: [
|
|
704
699
|
provideTranslocoScope('sp-mat-select-entity'),
|
|
705
700
|
{ provide: MatFormFieldControl, useExisting: SPMatSelectEntityComponent },
|
|
706
701
|
], viewQueries: [{ propertyName: "matSelect", first: true, predicate: MatSelect, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
@@ -724,9 +719,9 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
724
719
|
<mat-select-trigger>
|
|
725
720
|
{{ selectTriggerValue }}
|
|
726
721
|
@if (selectTriggerValueAsArray.length > 1) {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
722
|
+
<span class="addl-selection-count">
|
|
723
|
+
(+{{ selectTriggerValueAsArray.length - 1 }})
|
|
724
|
+
</span>
|
|
730
725
|
}
|
|
731
726
|
</mat-select-trigger>
|
|
732
727
|
|
|
@@ -735,9 +730,7 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
735
730
|
class="flex-grow-1"
|
|
736
731
|
[(ngModel)]="filterStr"
|
|
737
732
|
(ngModelChange)="this.filter$.next($event)"
|
|
738
|
-
[placeholderLabel]="
|
|
739
|
-
searchText() ? searchText() : t('spMatSelectEntity.search')
|
|
740
|
-
"
|
|
733
|
+
[placeholderLabel]="searchText() ? searchText() : t('spMatSelectEntity.search')"
|
|
741
734
|
[noEntriesFoundLabel]="
|
|
742
735
|
notFoundText() ? notFoundText() : t('spMatSelectEntity.notFound')
|
|
743
736
|
"
|
|
@@ -749,31 +742,37 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
749
742
|
<ng-template #defaultOptionLabelTemplate let-entity>
|
|
750
743
|
{{ _entityLabelFn()(entity) }}
|
|
751
744
|
</ng-template>
|
|
752
|
-
@if (!_group()) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
<mat-optgroup [label]="group.label">
|
|
765
|
-
@for (entity of group.entities; track entityId(entity)) {
|
|
766
|
-
<mat-option class="sel-entity-option" [value]="entityId(entity)">
|
|
767
|
-
<ng-container
|
|
768
|
-
*ngTemplateOutlet="
|
|
769
|
-
optionLabelTemplate() || defaultOptionLabelTemplate;
|
|
770
|
-
context: { $implicit: entity }
|
|
771
|
-
"
|
|
772
|
-
></ng-container>
|
|
773
|
-
</mat-option>
|
|
745
|
+
@if (!_group()) {
|
|
746
|
+
@if (filteredValues | async; as entities) {
|
|
747
|
+
@for (entity of entities; track entityId(entity)) {
|
|
748
|
+
<mat-option class="sel-entity-option" [value]="entityId(entity)">
|
|
749
|
+
<ng-container
|
|
750
|
+
*ngTemplateOutlet="
|
|
751
|
+
optionLabelTemplate() || defaultOptionLabelTemplate;
|
|
752
|
+
context: { $implicit: entity }
|
|
753
|
+
"
|
|
754
|
+
></ng-container>
|
|
755
|
+
</mat-option>
|
|
756
|
+
}
|
|
774
757
|
}
|
|
775
|
-
|
|
776
|
-
|
|
758
|
+
} @else {
|
|
759
|
+
@if (filteredGroupedValues | async; as groups) {
|
|
760
|
+
@for (group of groups; track group.label) {
|
|
761
|
+
<mat-optgroup [label]="group.label">
|
|
762
|
+
@for (entity of group.entities; track entityId(entity)) {
|
|
763
|
+
<mat-option class="sel-entity-option" [value]="entityId(entity)">
|
|
764
|
+
<ng-container
|
|
765
|
+
*ngTemplateOutlet="
|
|
766
|
+
optionLabelTemplate() || defaultOptionLabelTemplate;
|
|
767
|
+
context: { $implicit: entity }
|
|
768
|
+
"
|
|
769
|
+
></ng-container>
|
|
770
|
+
</mat-option>
|
|
771
|
+
}
|
|
772
|
+
</mat-optgroup>
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
777
776
|
|
|
778
777
|
<!--
|
|
779
778
|
Create New option is displayed only if there is a filter string.
|
|
@@ -781,33 +780,27 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
781
780
|
item and when not finding one, would like to add a new one.
|
|
782
781
|
-->
|
|
783
782
|
@if (inlineNew() && loaded() && (filterStr.length > 0 || totalEntitiesAtRemote() === 0)) {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
})
|
|
795
|
-
}}
|
|
796
|
-
</mat-option>
|
|
783
|
+
<mat-option class="add-item-option" value="0" (click)="$event.stopPropagation()"
|
|
784
|
+
>⊕
|
|
785
|
+
{{
|
|
786
|
+
this.createNewText()
|
|
787
|
+
? this.createNewText()
|
|
788
|
+
: t('spMatSelectEntity.createNew', {
|
|
789
|
+
item: this._capitalizedEntityName(),
|
|
790
|
+
})
|
|
791
|
+
}}
|
|
792
|
+
</mat-option>
|
|
797
793
|
}
|
|
798
794
|
@if (loading$ | async) {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
mode="indeterminate"
|
|
803
|
-
></mat-progress-spinner>
|
|
804
|
-
</div>
|
|
795
|
+
<div class="loading-wrapper">
|
|
796
|
+
<mat-progress-spinner diameter="24" mode="indeterminate"></mat-progress-spinner>
|
|
797
|
+
</div>
|
|
805
798
|
}
|
|
806
799
|
</mat-select>
|
|
807
800
|
</div>
|
|
808
801
|
`, isInline: true, styles: [".add-item-option{padding-top:2px;border-top:1px solid var(--mat-sys-outline)}.addl-selection-count{opacity:.75;font-size:.8em}.loading-wrapper{display:flex;justify-content:center;padding:8px 0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i3.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i3.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i3.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i4.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: i5.TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: NgxMatSelectSearchModule }, { kind: "component", type: i6.MatSelectSearchComponent, selector: "ngx-mat-select-search", inputs: ["placeholderLabel", "type", "closeIcon", "closeSvgIcon", "noEntriesFoundLabel", "clearSearchInput", "searching", "disableInitialFocus", "enableClearOnEscapePressed", "preventHomeEndKeyPropagation", "disableScrollToActiveOnOptionsChanged", "ariaLabel", "showToggleAllCheckbox", "toggleAllCheckboxChecked", "toggleAllCheckboxIndeterminate", "toggleAllCheckboxTooltipMessage", "toggleAllCheckboxTooltipPosition", "hideClearSearchButton", "alwaysRestoreSelectedOptionsMulti", "recreateValuesArray"], outputs: ["toggleAll"] }, { kind: "directive", type: MatSelectInfiniteScrollDirective, selector: "[msInfiniteScroll]", inputs: ["threshold", "debounceTime", "complete"], outputs: ["infiniteScroll"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
809
802
|
}
|
|
810
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
803
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPMatSelectEntityComponent, decorators: [{
|
|
811
804
|
type: Component,
|
|
812
805
|
args: [{ selector: 'sp-mat-select-entity', template: `
|
|
813
806
|
<div
|
|
@@ -830,9 +823,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
830
823
|
<mat-select-trigger>
|
|
831
824
|
{{ selectTriggerValue }}
|
|
832
825
|
@if (selectTriggerValueAsArray.length > 1) {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
826
|
+
<span class="addl-selection-count">
|
|
827
|
+
(+{{ selectTriggerValueAsArray.length - 1 }})
|
|
828
|
+
</span>
|
|
836
829
|
}
|
|
837
830
|
</mat-select-trigger>
|
|
838
831
|
|
|
@@ -841,9 +834,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
841
834
|
class="flex-grow-1"
|
|
842
835
|
[(ngModel)]="filterStr"
|
|
843
836
|
(ngModelChange)="this.filter$.next($event)"
|
|
844
|
-
[placeholderLabel]="
|
|
845
|
-
searchText() ? searchText() : t('spMatSelectEntity.search')
|
|
846
|
-
"
|
|
837
|
+
[placeholderLabel]="searchText() ? searchText() : t('spMatSelectEntity.search')"
|
|
847
838
|
[noEntriesFoundLabel]="
|
|
848
839
|
notFoundText() ? notFoundText() : t('spMatSelectEntity.notFound')
|
|
849
840
|
"
|
|
@@ -855,31 +846,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
855
846
|
<ng-template #defaultOptionLabelTemplate let-entity>
|
|
856
847
|
{{ _entityLabelFn()(entity) }}
|
|
857
848
|
</ng-template>
|
|
858
|
-
@if (!_group()) {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
<mat-optgroup [label]="group.label">
|
|
871
|
-
@for (entity of group.entities; track entityId(entity)) {
|
|
872
|
-
<mat-option class="sel-entity-option" [value]="entityId(entity)">
|
|
873
|
-
<ng-container
|
|
874
|
-
*ngTemplateOutlet="
|
|
875
|
-
optionLabelTemplate() || defaultOptionLabelTemplate;
|
|
876
|
-
context: { $implicit: entity }
|
|
877
|
-
"
|
|
878
|
-
></ng-container>
|
|
879
|
-
</mat-option>
|
|
849
|
+
@if (!_group()) {
|
|
850
|
+
@if (filteredValues | async; as entities) {
|
|
851
|
+
@for (entity of entities; track entityId(entity)) {
|
|
852
|
+
<mat-option class="sel-entity-option" [value]="entityId(entity)">
|
|
853
|
+
<ng-container
|
|
854
|
+
*ngTemplateOutlet="
|
|
855
|
+
optionLabelTemplate() || defaultOptionLabelTemplate;
|
|
856
|
+
context: { $implicit: entity }
|
|
857
|
+
"
|
|
858
|
+
></ng-container>
|
|
859
|
+
</mat-option>
|
|
860
|
+
}
|
|
880
861
|
}
|
|
881
|
-
|
|
882
|
-
|
|
862
|
+
} @else {
|
|
863
|
+
@if (filteredGroupedValues | async; as groups) {
|
|
864
|
+
@for (group of groups; track group.label) {
|
|
865
|
+
<mat-optgroup [label]="group.label">
|
|
866
|
+
@for (entity of group.entities; track entityId(entity)) {
|
|
867
|
+
<mat-option class="sel-entity-option" [value]="entityId(entity)">
|
|
868
|
+
<ng-container
|
|
869
|
+
*ngTemplateOutlet="
|
|
870
|
+
optionLabelTemplate() || defaultOptionLabelTemplate;
|
|
871
|
+
context: { $implicit: entity }
|
|
872
|
+
"
|
|
873
|
+
></ng-container>
|
|
874
|
+
</mat-option>
|
|
875
|
+
}
|
|
876
|
+
</mat-optgroup>
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
883
880
|
|
|
884
881
|
<!--
|
|
885
882
|
Create New option is displayed only if there is a filter string.
|
|
@@ -887,27 +884,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
887
884
|
item and when not finding one, would like to add a new one.
|
|
888
885
|
-->
|
|
889
886
|
@if (inlineNew() && loaded() && (filterStr.length > 0 || totalEntitiesAtRemote() === 0)) {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
})
|
|
901
|
-
}}
|
|
902
|
-
</mat-option>
|
|
887
|
+
<mat-option class="add-item-option" value="0" (click)="$event.stopPropagation()"
|
|
888
|
+
>⊕
|
|
889
|
+
{{
|
|
890
|
+
this.createNewText()
|
|
891
|
+
? this.createNewText()
|
|
892
|
+
: t('spMatSelectEntity.createNew', {
|
|
893
|
+
item: this._capitalizedEntityName(),
|
|
894
|
+
})
|
|
895
|
+
}}
|
|
896
|
+
</mat-option>
|
|
903
897
|
}
|
|
904
898
|
@if (loading$ | async) {
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
mode="indeterminate"
|
|
909
|
-
></mat-progress-spinner>
|
|
910
|
-
</div>
|
|
899
|
+
<div class="loading-wrapper">
|
|
900
|
+
<mat-progress-spinner diameter="24" mode="indeterminate"></mat-progress-spinner>
|
|
901
|
+
</div>
|
|
911
902
|
}
|
|
912
903
|
</mat-select>
|
|
913
904
|
</div>
|
|
@@ -927,7 +918,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
927
918
|
provideTranslocoScope('sp-mat-select-entity'),
|
|
928
919
|
{ provide: MatFormFieldControl, useExisting: SPMatSelectEntityComponent },
|
|
929
920
|
], styles: [".add-item-option{padding-top:2px;border-top:1px solid var(--mat-sys-outline)}.addl-selection-count{opacity:.75;font-size:.8em}.loading-wrapper{display:flex;justify-content:center;padding:8px 0}\n"] }]
|
|
930
|
-
}], ctorParameters: () => [], propDecorators: { labelFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelFn", required: false }] }], filterFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFn", required: false }] }], inlineNew: [{ type: i0.Input, args: [{ isSignal: true, alias: "inlineNew", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], groupOptionsKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupOptionsKey", required: false }] }], groupLabelFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupLabelFn", required: false }] }], selectionChange: [{
|
|
921
|
+
}], ctorParameters: () => [], propDecorators: { labelFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelFn", required: false }] }], filterFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFn", required: false }] }], inlineNew: [{ type: i0.Input, args: [{ isSignal: true, alias: "inlineNew", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], myInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "myInput", required: false }] }], groupOptionsKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupOptionsKey", required: false }] }], groupLabelFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupLabelFn", required: false }] }], selectionChange: [{
|
|
931
922
|
type: Output
|
|
932
923
|
}], createNewItemSelected: [{
|
|
933
924
|
type: Output
|