@smallpearl/ngx-helper 0.29.39 → 0.29.40
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/assets/i18n/sp-mat-entity-crud/en.json +5 -3
- package/assets/i18n/sp-mat-entity-crud/zh-hant.json +3 -1
- package/assets/i18n/sp-mat-select-entity/en.json +5 -0
- package/assets/i18n/sp-mat-select-entity/zh-hant.json +5 -0
- package/core/index.d.ts +0 -1
- package/entity-field/src/entity-field-spec.d.ts +1 -3
- package/fesm2022/smallpearl-ngx-helper-core.mjs +1 -16
- package/fesm2022/smallpearl-ngx-helper-core.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs +2 -4
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs +6 -14
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs +198 -178
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs +48 -55
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs +145 -166
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs +1 -4
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs.map +1 -1
- package/mat-entity-crud/src/form-view-host.component.d.ts +2 -0
- package/mat-entity-crud/src/mat-entity-crud-form-base.d.ts +2 -0
- package/mat-entity-crud/src/mat-entity-crud-internal-types.d.ts +6 -0
- package/mat-entity-crud/src/mat-entity-crud-types.d.ts +6 -15
- package/mat-entity-crud/src/mat-entity-crud.component.d.ts +16 -5
- package/mat-entity-crud/src/preview-pane.component.d.ts +1 -4
- package/mat-entity-list/src/mat-entity-list.component.d.ts +2 -1
- package/mat-select-entity/index.d.ts +0 -1
- package/mat-select-entity/src/mat-select-entity.component.d.ts +6 -8
- package/package.json +13 -13
- package/stationary-with-line-items/src/stationary-with-line-items.component.d.ts +0 -2
- package/core/src/ngx-helper.d.ts +0 -7
- package/mat-select-entity/src/providers.d.ts +0 -9
|
@@ -1,36 +1,28 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, input, EventEmitter, computed, inject, ChangeDetectorRef, ElementRef, Component, ChangeDetectionStrategy, ViewChild, Input, Output, HostBinding } from '@angular/core';
|
|
3
1
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
4
2
|
import * as i1 from '@angular/common';
|
|
5
3
|
import { CommonModule, NgTemplateOutlet } from '@angular/common';
|
|
6
4
|
import { HttpContextToken, HttpClient, HttpParams, HttpContext } from '@angular/common/http';
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { input, EventEmitter, computed, inject, ChangeDetectorRef, ElementRef, Component, ChangeDetectionStrategy, ViewChild, Input, Output, HostBinding } from '@angular/core';
|
|
7
7
|
import * as i2 from '@angular/forms';
|
|
8
8
|
import { NgControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
9
9
|
import { MAT_FORM_FIELD, MatFormFieldControl } from '@angular/material/form-field';
|
|
10
10
|
import * as i3 from '@angular/material/select';
|
|
11
11
|
import { MatSelect, MatSelectModule } from '@angular/material/select';
|
|
12
|
-
import { getNgxHelperConfig } from '@smallpearl/ngx-helper/core';
|
|
13
12
|
import { camelCase } from 'lodash';
|
|
14
|
-
import * as
|
|
13
|
+
import * as i6 from 'ngx-mat-select-search';
|
|
15
14
|
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
|
|
16
15
|
import { plural } from 'pluralize';
|
|
17
16
|
import { Subject, BehaviorSubject, combineLatest, debounceTime, takeUntil, switchMap, of, tap } from 'rxjs';
|
|
17
|
+
import * as i5 from '@jsverse/transloco';
|
|
18
|
+
import { TranslocoService, provideTranslocoScope, TranslocoModule } from '@jsverse/transloco';
|
|
18
19
|
import * as i4 from '@angular/material/core';
|
|
19
20
|
|
|
20
|
-
const SP_MAT_SELECT_ENTITY_CONFIG = new InjectionToken('SPMatSelectEntityConfig');
|
|
21
|
-
|
|
22
21
|
const SP_MAT_SELECT_ENTITY_HTTP_CONTEXT = new HttpContextToken(() => ({
|
|
23
22
|
entityName: '',
|
|
24
23
|
entityNamePlural: '',
|
|
25
24
|
endpoint: '',
|
|
26
25
|
}));
|
|
27
|
-
const DEFAULT_SP_MAT_SELECT_ENTITY_CONFIG = {
|
|
28
|
-
i18n: {
|
|
29
|
-
search: 'Search',
|
|
30
|
-
notFound: 'Not found',
|
|
31
|
-
addItem: 'New Item',
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
26
|
/**
|
|
35
27
|
* This is a generic component to display a <mat-select> for a FK field
|
|
36
28
|
* where the select's options are dynamically loaded from the server using
|
|
@@ -143,9 +135,9 @@ class SPMatSelectEntityComponent {
|
|
|
143
135
|
selectionChange = new EventEmitter();
|
|
144
136
|
createNewItemSelected = new EventEmitter();
|
|
145
137
|
// allow per component customization
|
|
146
|
-
searchText;
|
|
147
|
-
notFoundText;
|
|
148
|
-
addItemText;
|
|
138
|
+
searchText = input();
|
|
139
|
+
notFoundText = input();
|
|
140
|
+
addItemText = input();
|
|
149
141
|
/**
|
|
150
142
|
* Template for the option label. If not provided, the default label
|
|
151
143
|
* function will be used. Option label is what is placed inside the
|
|
@@ -199,20 +191,18 @@ class SPMatSelectEntityComponent {
|
|
|
199
191
|
static nextId = 0;
|
|
200
192
|
id = `sp-select-entity-${SPMatSelectEntityComponent.nextId++}`;
|
|
201
193
|
_placeholder;
|
|
202
|
-
ngxHelperConfig = getNgxHelperConfig();
|
|
203
194
|
http = inject(HttpClient);
|
|
204
195
|
cdr = inject(ChangeDetectorRef);
|
|
205
196
|
_elementRef = inject((ElementRef));
|
|
206
197
|
_formField = inject(MAT_FORM_FIELD, { optional: true });
|
|
207
|
-
config = inject(SP_MAT_SELECT_ENTITY_CONFIG, { optional: true });
|
|
208
198
|
ngControl = inject(NgControl, { optional: true });
|
|
199
|
+
transloco = inject(TranslocoService);
|
|
209
200
|
constructor() {
|
|
210
201
|
if (this.ngControl != null) {
|
|
211
202
|
this.ngControl.valueAccessor = this;
|
|
212
203
|
}
|
|
213
204
|
}
|
|
214
205
|
ngOnInit() {
|
|
215
|
-
this._initStrings();
|
|
216
206
|
combineLatest([this.filter$.pipe(debounceTime(400)), this.load$])
|
|
217
207
|
.pipe(takeUntil(this.destroy), switchMap(([str, load]) => {
|
|
218
208
|
if (load && !this.loaded) {
|
|
@@ -249,18 +239,6 @@ class SPMatSelectEntityComponent {
|
|
|
249
239
|
// }
|
|
250
240
|
// }
|
|
251
241
|
}
|
|
252
|
-
_initStrings() {
|
|
253
|
-
const config = this.config ?? DEFAULT_SP_MAT_SELECT_ENTITY_CONFIG;
|
|
254
|
-
if (!this.searchText) {
|
|
255
|
-
this.searchText = config.i18n.search;
|
|
256
|
-
}
|
|
257
|
-
if (!this.notFoundText) {
|
|
258
|
-
this.notFoundText = config.i18n.notFound;
|
|
259
|
-
}
|
|
260
|
-
if (!this.addItemText) {
|
|
261
|
-
this.addItemText = config.i18n.addItem.replace(/\{\{\s*item\s*}}/, this.entityName ?? '**Item');
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
242
|
addEntity(entity) {
|
|
265
243
|
this._entities.set(entity[this.idKey], entity);
|
|
266
244
|
// So that the newly added entity will be added to the <mat-option> list.
|
|
@@ -679,164 +657,171 @@ class SPMatSelectEntityComponent {
|
|
|
679
657
|
return context;
|
|
680
658
|
}
|
|
681
659
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatSelectEntityComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
682
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: SPMatSelectEntityComponent, isStandalone: true, selector: "sp-mat-select-entity", inputs: { entityLabelFn: { classPropertyName: "entityLabelFn", publicName: "entityLabelFn", isSignal: false, isRequired: true, transformFunction: null }, entityFilterFn: { classPropertyName: "entityFilterFn", publicName: "entityFilterFn", isSignal: false, isRequired: false, transformFunction: null }, idKey: { classPropertyName: "idKey", publicName: "idKey", isSignal: false, isRequired: false, transformFunction: null }, url: { classPropertyName: "url", publicName: "url", isSignal: false, isRequired: false, transformFunction: null }, httpParams: { classPropertyName: "httpParams", publicName: "httpParams", isSignal: false, isRequired: false, transformFunction: null }, loadFromRemoteFn: { classPropertyName: "loadFromRemoteFn", publicName: "loadFromRemoteFn", isSignal: false, isRequired: false, transformFunction: null }, inlineNew: { classPropertyName: "inlineNew", publicName: "inlineNew", isSignal: false, isRequired: false, transformFunction: null }, entityName: { classPropertyName: "entityName", publicName: "entityName", isSignal: false, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: false, isRequired: false, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: false, isRequired: false, transformFunction: null }, groupOptionsKey: { classPropertyName: "groupOptionsKey", publicName: "groupOptionsKey", isSignal: false, isRequired: false, transformFunction: null }, groupLabelFn: { classPropertyName: "groupLabelFn", publicName: "groupLabelFn", isSignal: false, isRequired: false, transformFunction: null }, sideloadDataKey: { classPropertyName: "sideloadDataKey", publicName: "sideloadDataKey", isSignal: true, isRequired: false, transformFunction: null }, responseParserFn: { classPropertyName: "responseParserFn", publicName: "responseParserFn", isSignal: true, isRequired: false, transformFunction: null }, searchText: { classPropertyName: "searchText", publicName: "searchText", isSignal:
|
|
660
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: SPMatSelectEntityComponent, isStandalone: true, selector: "sp-mat-select-entity", inputs: { entityLabelFn: { classPropertyName: "entityLabelFn", publicName: "entityLabelFn", isSignal: false, isRequired: true, transformFunction: null }, entityFilterFn: { classPropertyName: "entityFilterFn", publicName: "entityFilterFn", isSignal: false, isRequired: false, transformFunction: null }, idKey: { classPropertyName: "idKey", publicName: "idKey", isSignal: false, isRequired: false, transformFunction: null }, url: { classPropertyName: "url", publicName: "url", isSignal: false, isRequired: false, transformFunction: null }, httpParams: { classPropertyName: "httpParams", publicName: "httpParams", isSignal: false, isRequired: false, transformFunction: null }, loadFromRemoteFn: { classPropertyName: "loadFromRemoteFn", publicName: "loadFromRemoteFn", isSignal: false, isRequired: false, transformFunction: null }, inlineNew: { classPropertyName: "inlineNew", publicName: "inlineNew", isSignal: false, isRequired: false, transformFunction: null }, entityName: { classPropertyName: "entityName", publicName: "entityName", isSignal: false, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: false, isRequired: false, transformFunction: null }, group: { classPropertyName: "group", publicName: "group", isSignal: false, isRequired: false, transformFunction: null }, groupOptionsKey: { classPropertyName: "groupOptionsKey", publicName: "groupOptionsKey", isSignal: false, isRequired: false, transformFunction: null }, groupLabelFn: { classPropertyName: "groupLabelFn", publicName: "groupLabelFn", isSignal: false, isRequired: false, transformFunction: null }, sideloadDataKey: { classPropertyName: "sideloadDataKey", publicName: "sideloadDataKey", isSignal: true, isRequired: false, transformFunction: null }, responseParserFn: { classPropertyName: "responseParserFn", publicName: "responseParserFn", 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 }, addItemText: { classPropertyName: "addItemText", publicName: "addItemText", 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: [
|
|
661
|
+
provideTranslocoScope('sp-mat-select-entity'),
|
|
683
662
|
{ provide: MatFormFieldControl, useExisting: SPMatSelectEntityComponent },
|
|
684
663
|
], viewQueries: [{ propertyName: "matSel", first: true, predicate: MatSelect, descendants: true }, { propertyName: "matSelect", first: true, predicate: MatSelect, descendants: true }], ngImport: i0, template: `
|
|
685
|
-
<mat-select
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
664
|
+
<ng-container *transloco="let t; scope: 'sp-mat-select-entity'">
|
|
665
|
+
<mat-select
|
|
666
|
+
[placeholder]="placeholder"
|
|
667
|
+
(opened)="onSelectOpened($event)"
|
|
668
|
+
(selectionChange)="onSelectionChange($event)"
|
|
669
|
+
[multiple]="multiple"
|
|
670
|
+
[(ngModel)]="selectValue"
|
|
671
|
+
>
|
|
672
|
+
<mat-select-trigger>
|
|
673
|
+
{{ selectTriggerValue }}
|
|
674
|
+
@if (selectTriggerValueAsArray.length > 1) {
|
|
675
|
+
<span class="addl-selection-count">
|
|
676
|
+
(+{{ selectTriggerValueAsArray.length - 1 }})
|
|
677
|
+
</span>
|
|
678
|
+
}
|
|
679
|
+
</mat-select-trigger>
|
|
700
680
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
681
|
+
<mat-option>
|
|
682
|
+
<ngx-mat-select-search
|
|
683
|
+
[(ngModel)]="filterStr"
|
|
684
|
+
(ngModelChange)="this.filter$.next($event)"
|
|
685
|
+
[placeholderLabel]="searchText() ? searchText() : t('spMatSelectEntity.search')"
|
|
686
|
+
[noEntriesFoundLabel]="notFoundText() ? notFoundText() : t('spMatSelectEntity.notFound')"
|
|
687
|
+
[searching]="searching"
|
|
688
|
+
>
|
|
689
|
+
</ngx-mat-select-search>
|
|
690
|
+
</mat-option>
|
|
711
691
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
692
|
+
<ng-container *ngIf="!group; else groupedOptions">
|
|
693
|
+
<span *ngIf="filteredValues | async as entities">
|
|
694
|
+
<ng-template #defaultOptionLabelTemplate let-entity>
|
|
695
|
+
{{ entityLabelFn(entity) }}
|
|
696
|
+
</ng-template>
|
|
697
|
+
@for (entity of entities; track entityId(entity)) {
|
|
698
|
+
<mat-option class="sel-entity-option" [value]="entityId(entity)">
|
|
699
|
+
<ng-container
|
|
700
|
+
*ngTemplateOutlet="
|
|
701
|
+
optionLabelTemplate() || defaultOptionLabelTemplate;
|
|
702
|
+
context: { $implicit: entity }
|
|
703
|
+
"
|
|
704
|
+
></ng-container>
|
|
705
|
+
</mat-option>
|
|
706
|
+
}
|
|
727
707
|
|
|
728
|
-
|
|
708
|
+
<!-- <mat-option class="sel-entity-option" *ngFor="let entity of entities" [value]="entityId(entity)">
|
|
729
709
|
{{ entityLabelFn(entity) }}
|
|
730
710
|
</mat-option> -->
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
711
|
+
</span>
|
|
712
|
+
</ng-container>
|
|
713
|
+
<ng-template #groupedOptions>
|
|
714
|
+
<span *ngIf="filteredGroupedValues | async as groups">
|
|
715
|
+
@for (group of groups; track groupLabel(group)) {
|
|
716
|
+
<mat-optgroup [label]="groupLabel(group)">
|
|
717
|
+
@for (entity of group.__items__; track entityId(entity)) {
|
|
738
718
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
719
|
+
<mat-option class="sel-entity-option" [value]="entityId(entity)">
|
|
720
|
+
{{ entityLabelFn(entity) }}
|
|
721
|
+
</mat-option>
|
|
722
|
+
}
|
|
723
|
+
</mat-optgroup>
|
|
742
724
|
}
|
|
743
|
-
</
|
|
744
|
-
|
|
745
|
-
</span>
|
|
746
|
-
</ng-template>
|
|
725
|
+
</span>
|
|
726
|
+
</ng-template>
|
|
747
727
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
728
|
+
<mat-option
|
|
729
|
+
*ngIf="!multiple && inlineNew"
|
|
730
|
+
class="add-item-option"
|
|
731
|
+
value="0"
|
|
732
|
+
(click)="$event.stopPropagation()"
|
|
733
|
+
>⊕ {{ this.addItemText() ? this.addItemText() : t('spMatSelectEntity.addItem', { item: this.entityName }) }}</mat-option
|
|
734
|
+
>
|
|
735
|
+
</mat-select>
|
|
736
|
+
</ng-container>
|
|
737
|
+
`, isInline: true, styles: [".add-item-option{padding-top:2px;border-top:1px solid gray}.addl-selection-count{opacity:.75;font-size:.8em}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { 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: i4.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i4.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
757
738
|
}
|
|
758
739
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatSelectEntityComponent, decorators: [{
|
|
759
740
|
type: Component,
|
|
760
741
|
args: [{ selector: 'sp-mat-select-entity', template: `
|
|
761
|
-
<mat-select
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
742
|
+
<ng-container *transloco="let t; scope: 'sp-mat-select-entity'">
|
|
743
|
+
<mat-select
|
|
744
|
+
[placeholder]="placeholder"
|
|
745
|
+
(opened)="onSelectOpened($event)"
|
|
746
|
+
(selectionChange)="onSelectionChange($event)"
|
|
747
|
+
[multiple]="multiple"
|
|
748
|
+
[(ngModel)]="selectValue"
|
|
749
|
+
>
|
|
750
|
+
<mat-select-trigger>
|
|
751
|
+
{{ selectTriggerValue }}
|
|
752
|
+
@if (selectTriggerValueAsArray.length > 1) {
|
|
753
|
+
<span class="addl-selection-count">
|
|
754
|
+
(+{{ selectTriggerValueAsArray.length - 1 }})
|
|
755
|
+
</span>
|
|
756
|
+
}
|
|
757
|
+
</mat-select-trigger>
|
|
776
758
|
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
759
|
+
<mat-option>
|
|
760
|
+
<ngx-mat-select-search
|
|
761
|
+
[(ngModel)]="filterStr"
|
|
762
|
+
(ngModelChange)="this.filter$.next($event)"
|
|
763
|
+
[placeholderLabel]="searchText() ? searchText() : t('spMatSelectEntity.search')"
|
|
764
|
+
[noEntriesFoundLabel]="notFoundText() ? notFoundText() : t('spMatSelectEntity.notFound')"
|
|
765
|
+
[searching]="searching"
|
|
766
|
+
>
|
|
767
|
+
</ngx-mat-select-search>
|
|
768
|
+
</mat-option>
|
|
787
769
|
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
770
|
+
<ng-container *ngIf="!group; else groupedOptions">
|
|
771
|
+
<span *ngIf="filteredValues | async as entities">
|
|
772
|
+
<ng-template #defaultOptionLabelTemplate let-entity>
|
|
773
|
+
{{ entityLabelFn(entity) }}
|
|
774
|
+
</ng-template>
|
|
775
|
+
@for (entity of entities; track entityId(entity)) {
|
|
776
|
+
<mat-option class="sel-entity-option" [value]="entityId(entity)">
|
|
777
|
+
<ng-container
|
|
778
|
+
*ngTemplateOutlet="
|
|
779
|
+
optionLabelTemplate() || defaultOptionLabelTemplate;
|
|
780
|
+
context: { $implicit: entity }
|
|
781
|
+
"
|
|
782
|
+
></ng-container>
|
|
783
|
+
</mat-option>
|
|
784
|
+
}
|
|
803
785
|
|
|
804
|
-
|
|
786
|
+
<!-- <mat-option class="sel-entity-option" *ngFor="let entity of entities" [value]="entityId(entity)">
|
|
805
787
|
{{ entityLabelFn(entity) }}
|
|
806
788
|
</mat-option> -->
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
789
|
+
</span>
|
|
790
|
+
</ng-container>
|
|
791
|
+
<ng-template #groupedOptions>
|
|
792
|
+
<span *ngIf="filteredGroupedValues | async as groups">
|
|
793
|
+
@for (group of groups; track groupLabel(group)) {
|
|
794
|
+
<mat-optgroup [label]="groupLabel(group)">
|
|
795
|
+
@for (entity of group.__items__; track entityId(entity)) {
|
|
814
796
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
797
|
+
<mat-option class="sel-entity-option" [value]="entityId(entity)">
|
|
798
|
+
{{ entityLabelFn(entity) }}
|
|
799
|
+
</mat-option>
|
|
800
|
+
}
|
|
801
|
+
</mat-optgroup>
|
|
818
802
|
}
|
|
819
|
-
</
|
|
820
|
-
|
|
821
|
-
</span>
|
|
822
|
-
</ng-template>
|
|
803
|
+
</span>
|
|
804
|
+
</ng-template>
|
|
823
805
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
806
|
+
<mat-option
|
|
807
|
+
*ngIf="!multiple && inlineNew"
|
|
808
|
+
class="add-item-option"
|
|
809
|
+
value="0"
|
|
810
|
+
(click)="$event.stopPropagation()"
|
|
811
|
+
>⊕ {{ this.addItemText() ? this.addItemText() : t('spMatSelectEntity.addItem', { item: this.entityName }) }}</mat-option
|
|
812
|
+
>
|
|
813
|
+
</mat-select>
|
|
814
|
+
</ng-container>
|
|
832
815
|
`, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
833
816
|
CommonModule,
|
|
834
817
|
NgTemplateOutlet,
|
|
835
818
|
FormsModule,
|
|
836
819
|
ReactiveFormsModule,
|
|
837
820
|
MatSelectModule,
|
|
821
|
+
TranslocoModule,
|
|
838
822
|
NgxMatSelectSearchModule,
|
|
839
823
|
], providers: [
|
|
824
|
+
provideTranslocoScope('sp-mat-select-entity'),
|
|
840
825
|
{ provide: MatFormFieldControl, useExisting: SPMatSelectEntityComponent },
|
|
841
826
|
], styles: [".add-item-option{padding-top:2px;border-top:1px solid gray}.addl-selection-count{opacity:.75;font-size:.8em}\n"] }]
|
|
842
827
|
}], ctorParameters: () => [], propDecorators: { matSel: [{
|
|
@@ -882,12 +867,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
882
867
|
type: Output
|
|
883
868
|
}], createNewItemSelected: [{
|
|
884
869
|
type: Output
|
|
885
|
-
}], searchText: [{
|
|
886
|
-
type: Input
|
|
887
|
-
}], notFoundText: [{
|
|
888
|
-
type: Input
|
|
889
|
-
}], addItemText: [{
|
|
890
|
-
type: Input
|
|
891
870
|
}], matSelect: [{
|
|
892
871
|
type: ViewChild,
|
|
893
872
|
args: [MatSelect]
|
|
@@ -912,5 +891,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
912
891
|
* Generated bundle index. Do not edit.
|
|
913
892
|
*/
|
|
914
893
|
|
|
915
|
-
export { SPMatSelectEntityComponent,
|
|
894
|
+
export { SPMatSelectEntityComponent, SP_MAT_SELECT_ENTITY_HTTP_CONTEXT };
|
|
916
895
|
//# sourceMappingURL=smallpearl-ngx-helper-mat-select-entity.mjs.map
|