@smallpearl/ngx-helper 0.33.21 → 0.33.24
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.
|
@@ -128,6 +128,8 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
128
128
|
// Set to true to allow multiple option selection. The returned value
|
|
129
129
|
// would be an array of entity ids.
|
|
130
130
|
multiple = input(false);
|
|
131
|
+
// Set to true to make the mat-select readonly
|
|
132
|
+
readonly = input(false);
|
|
131
133
|
/**
|
|
132
134
|
* The entity key name that is used to classify entities into groups or
|
|
133
135
|
* a function that takes a TEntity and returns the group id (string).
|
|
@@ -699,7 +701,7 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
699
701
|
}
|
|
700
702
|
}
|
|
701
703
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatSelectEntityComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
702
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", 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 }, 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
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", 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 }, 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: [
|
|
703
705
|
provideTranslocoScope('sp-mat-select-entity'),
|
|
704
706
|
{ provide: MatFormFieldControl, useExisting: SPMatSelectEntityComponent },
|
|
705
707
|
], viewQueries: [{ propertyName: "matSelect", first: true, predicate: MatSelect, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
@@ -718,6 +720,7 @@ class SPMatSelectEntityComponent extends SPPagedEntityLoader {
|
|
|
718
720
|
[(ngModel)]="selectValue"
|
|
719
721
|
msInfiniteScroll
|
|
720
722
|
(infiniteScroll)="onInfiniteScroll()"
|
|
723
|
+
[disabled]="disabled || readonly()"
|
|
721
724
|
>
|
|
722
725
|
<mat-select-trigger>
|
|
723
726
|
{{ selectTriggerValue }}
|
|
@@ -823,6 +826,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
823
826
|
[(ngModel)]="selectValue"
|
|
824
827
|
msInfiniteScroll
|
|
825
828
|
(infiniteScroll)="onInfiniteScroll()"
|
|
829
|
+
[disabled]="disabled || readonly()"
|
|
826
830
|
>
|
|
827
831
|
<mat-select-trigger>
|
|
828
832
|
{{ selectTriggerValue }}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smallpearl-ngx-helper-mat-select-entity.mjs","sources":["../../../../projects/smallpearl/ngx-helper/mat-select-entity/src/mat-select-entity.component.ts","../../../../projects/smallpearl/ngx-helper/mat-select-entity/smallpearl-ngx-helper-mat-select-entity.ts"],"sourcesContent":["import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { CommonModule, NgTemplateOutlet } from '@angular/common';\nimport {\n HttpContext,\n HttpContextToken\n} from '@angular/common/http';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n computed,\n ElementRef,\n EventEmitter,\n HostBinding,\n inject,\n input,\n Input,\n OnDestroy,\n OnInit,\n Output,\n TemplateRef,\n viewChild,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n ReactiveFormsModule,\n Validators,\n} from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport {\n MAT_FORM_FIELD,\n MatFormFieldControl,\n} from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport {\n MatSelect,\n MatSelectChange,\n MatSelectModule,\n} from '@angular/material/select';\nimport {\n provideTranslocoScope,\n TranslocoModule,\n TranslocoService,\n} from '@jsverse/transloco';\nimport { getEntity, hasEntity, selectAllEntities, upsertEntities } from '@ngneat/elf-entities';\nimport {\n SPPagedEntityLoader\n} from '@smallpearl/ngx-helper/entities';\nimport {\n SPMatEntityListPaginator,\n SPPageParams,\n} from '@smallpearl/ngx-helper/mat-entity-list';\nimport { MatSelectInfiniteScrollDirective } from '@smallpearl/ngx-helper/mat-select-infinite-scroll';\nimport { NgxMatSelectSearchModule } from 'ngx-mat-select-search';\nimport {\n combineLatest,\n debounceTime,\n distinctUntilChanged,\n Observable,\n startWith,\n Subject,\n takeUntil,\n tap\n} from 'rxjs';\n\n\nexport interface SPMatSelectEntityHttpContext {\n entityName: string;\n entityNamePlural: string;\n endpoint: string;\n}\n\nexport const SP_MAT_SELECT_ENTITY_HTTP_CONTEXT =\n new HttpContextToken<SPMatSelectEntityHttpContext>(() => ({\n entityName: '',\n entityNamePlural: '',\n endpoint: '',\n }));\n\n// Internal type to represent a group of entities. Used when grouping is enabled.\ntype EntityGroup<TEntity> = {\n label: string;\n entities: TEntity[];\n};\n\nexport type SPMatSelectEntityResponseParser = <\n TEntity extends { [P in IdKey]: PropertyKey },\n IdKey extends string = 'id'\n>(\n response: any\n) => Array<TEntity>;\n\n// Default paginator implementation. This can handle dynamic-rest and DRF\n// native pagination schemes. It also has a fallback to handle response conists\n// of an array of entities.\nclass DefaultPaginator implements SPMatEntityListPaginator {\n getRequestPageParams(\n endpoint: string,\n page: number,\n pageSize: number\n ): SPPageParams {\n return {\n page: page + 1,\n pageSize,\n };\n }\n\n parseRequestResponse<\n TEntity extends { [P in IdKey]: PropertyKey },\n IdKey extends string = 'id'\n >(\n entityName: string,\n entityNamePlural: string,\n endpoint: string,\n params: SPPageParams,\n resp: any\n ) {\n if (Array.isArray(resp)) {\n return {\n total: resp.length,\n entities: resp,\n };\n }\n\n if (typeof resp === 'object') {\n const keys = Object.keys(resp);\n // Handle dynamic-rest sideloaded response\n // Rudimentary sideloaded response support. This should work for most\n // of the sideloaded responses where the main entities are stored\n // under the plural entity name key and resp['meta'] object contains\n // the total count.\n if (\n keys.includes(entityNamePlural) &&\n Array.isArray(resp[entityNamePlural])\n ) {\n let total = resp[entityNamePlural].length;\n if (\n keys.includes('meta') &&\n typeof resp['meta'] === 'object' &&\n typeof resp['meta']['total'] === 'number'\n ) {\n total = resp['meta']['total'];\n }\n return {\n total,\n entities: resp[entityNamePlural],\n };\n }\n\n // Handle django-rest-framework style response\n if (keys.includes('results') && Array.isArray(resp['results'])) {\n let total = resp['results'].length;\n if (keys.includes('count') && typeof resp['count'] === 'number') {\n total = resp['count'];\n }\n return {\n total,\n entities: resp['results'],\n };\n }\n\n // Finally, look for \"items\" key\n if (keys.includes('items') && Array.isArray(resp['items'])) {\n return {\n total: resp['items'].length,\n entities: resp['items'],\n };\n }\n }\n\n return {\n total: 0,\n entities: [],\n };\n }\n}\n\n/**\n * This is a generic component to display a <mat-select> for a FK field\n * where the select's options are dynamically loaded from the server using\n * the given url (or URL). The objects thus retrieved should have a\n * unique 'id' field that will be used as the value of each `option` element.\n * Therefore upon selection of an `option` element, the `select` value will\n * be set to the object's `id` property. By default 'id' is used as its id,\n * but this can be customized by specifying the `idKey' property value.\n */\n@Component({\n selector: 'sp-mat-select-entity',\n template: `\n <div\n *transloco=\"let t; scope: 'sp-mat-select-entity'\"\n (focusin)=\"onFocusIn($event)\"\n (focusout)=\"onFocusOut($event)\"\n role=\"group\"\n [attr.aria-labelledby]=\"_formField?.getLabelId()\"\n >\n <mat-select\n [placeholder]=\"placeholder\"\n (opened)=\"onSelectOpened($event)\"\n (selectionChange)=\"onSelectionChange($event)\"\n [multiple]=\"multiple()\"\n [(ngModel)]=\"selectValue\"\n msInfiniteScroll\n (infiniteScroll)=\"onInfiniteScroll()\"\n >\n <mat-select-trigger>\n {{ selectTriggerValue }}\n @if (selectTriggerValueAsArray.length > 1) {\n <span class=\"addl-selection-count\">\n (+{{ selectTriggerValueAsArray.length - 1 }})\n </span>\n }\n </mat-select-trigger>\n\n <mat-option [disabled]=\"totalEntitiesCount() === 0\">\n <ngx-mat-select-search\n class=\"flex-grow-1\"\n [(ngModel)]=\"filterStr\"\n (ngModelChange)=\"this.filter$.next($event)\"\n [placeholderLabel]=\"\n searchText() ? searchText() : t('spMatSelectEntity.search')\n \"\n [noEntriesFoundLabel]=\"\n notFoundText() ? notFoundText() : t('spMatSelectEntity.notFound')\n \"\n [searching]=\"searching\"\n >\n </ngx-mat-select-search>\n </mat-option>\n\n <ng-template #defaultOptionLabelTemplate let-entity>\n {{ _entityLabelFn()(entity) }}\n </ng-template>\n @if (!_group()) { @if (filteredValues | async; as entities) { @for\n (entity of entities; track entityId(entity)) {\n <mat-option class=\"sel-entity-option\" [value]=\"entityId(entity)\">\n <ng-container\n *ngTemplateOutlet=\"\n optionLabelTemplate() || defaultOptionLabelTemplate;\n context: { $implicit: entity }\n \"\n ></ng-container>\n </mat-option>\n } } } @else { @if (filteredGroupedValues | async; as groups) { @for\n (group of groups; track group.label) {\n <mat-optgroup [label]=\"group.label\">\n @for (entity of group.entities; track entityId(entity)) {\n <mat-option class=\"sel-entity-option\" [value]=\"entityId(entity)\">\n <ng-container\n *ngTemplateOutlet=\"\n optionLabelTemplate() || defaultOptionLabelTemplate;\n context: { $implicit: entity }\n \"\n ></ng-container>\n </mat-option>\n }\n </mat-optgroup>\n } } }\n\n <!--\n Create New option is displayed only if there is a filter string.\n The logic behind this behavior being that user searches for a matching\n item and when not finding one, would like to add a new one.\n -->\n @if (inlineNew() && loaded() && (filterStr.length > 0 || totalEntitiesAtRemote() === 0)) {\n <mat-option\n class=\"add-item-option\"\n value=\"0\"\n (click)=\"$event.stopPropagation()\"\n >⊕\n {{\n this.createNewText()\n ? this.createNewText()\n : t('spMatSelectEntity.createNew', {\n item: this._capitalizedEntityName()\n })\n }}\n </mat-option>\n }\n @if (loading$ | async) {\n <div class=\"loading-wrapper\">\n <mat-progress-spinner\n diameter=\"24\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n </div>\n }\n </mat-select>\n </div>\n `,\n styles: [\n `\n .add-item-option {\n padding-top: 2px;\n border-top: 1px solid var(--mat-sys-outline);\n }\n .addl-selection-count {\n opacity: 0.75;\n font-size: 0.8em;\n }\n .loading-wrapper {\n display: flex;\n justify-content: center;\n padding: 8px 0;\n }\n `,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n CommonModule,\n NgTemplateOutlet,\n FormsModule,\n ReactiveFormsModule,\n MatSelectModule,\n MatButtonModule,\n MatIconModule,\n MatProgressSpinnerModule,\n TranslocoModule,\n NgxMatSelectSearchModule,\n MatSelectInfiniteScrollDirective,\n ],\n providers: [\n provideTranslocoScope('sp-mat-select-entity'),\n { provide: MatFormFieldControl, useExisting: SPMatSelectEntityComponent },\n ],\n})\nexport class SPMatSelectEntityComponent<\n TEntity extends { [P in IdKey]: PropertyKey },\n IdKey extends string = 'id'\n >\n extends SPPagedEntityLoader<TEntity, IdKey>\n implements\n OnInit,\n OnDestroy,\n AfterViewInit,\n ControlValueAccessor,\n MatFormFieldControl<string | number | string[] | number[]>\n{\n // We cache the entities that we fetch from remote here. Cache is indexed\n // by the endpoint. Each endpoint also keeps a refCount, which is incremented\n // for each instance of the component using the same endpoint. When this\n // refcount reaches 0, the endpoint is removed from the cache.\n //\n // This mechanism is to suppress multiple fetches from the remote from the\n // same endpoint as that can occur if a form has multiple instances of\n // this component with the same url.\n // static _entitiesCache = new Map<\n // string,\n // { refCount: number; entities: Array<any> }\n // >();\n\n //**** OPTIONAL ATTRIBUTES ****//\n\n // Entity label function - function that takes an entity object and returns\n // a string label for it. If not specified, a default label function is used\n // that returns the value of 'name' or 'label' or 'title' property. If\n // none of these properties are present, the entity's id is returned as\n // string.\n labelFn = input<(entity: TEntity) => string>();\n\n // Entity filter function - return a boolean if the entity is to be included\n // in the filtered entities list.\n filterFn = input<(entity: TEntity, search: string) => boolean>();\n\n // Set to true to show \"Add { item }\" option in the select dropdown.\n // Selecting this option, will emit `createNewItemSelected` event.\n inlineNew = input<boolean>(false);\n\n // Set to true to allow multiple option selection. The returned value\n // would be an array of entity ids.\n multiple = input<boolean>(false);\n\n /**\n * The entity key name that is used to classify entities into groups or\n * a function that takes a TEntity and returns the group id (string).\n * Entities with the same key value will be grouped together. If this is\n * specified, grouping will be enabled.\n * @see groupByFn\n */\n groupOptionsKey = input<string | ((entity: TEntity) => string)>();\n\n /**\n * A function that a group id (string/number) and returns the label (string).\n * Defaults to a function that returns the group id as string.\n */\n groupLabelFn = input<(groupId: string|number) => string>((groupId) => groupId.toString());\n\n @Output() selectionChange = new EventEmitter<TEntity | TEntity[]>();\n @Output() createNewItemSelected = new EventEmitter<void>();\n\n // i18n localization support toallow per component customization of\n // some strings used.\n readonly searchText = input<string>();\n readonly notFoundText = input<string>();\n readonly createNewText = input<string>();\n\n controlType = 'sp-mat-select-entity';\n\n /**\n * Template for the option label. If not provided, the default label\n * function will be used. Option label is what is placed inside the\n * <mat-option> tag. The template gets an implicit 'entity' variable\n * in the context, value for which is the entity object.\n *\n * For example:\n * ```\n * <sp-mat-select-entity\n * [url]=\"'/api/v1/customers/'\"\n * [labelFn]=\"entity => entity.name\"\n * [optionLabelTemplate]=\"optionLabelTemplate\"\n * ></sp-mat-select-entity>\n * <ng-template #optionLabelTemplate let-entity>\n * {{ entity.name }} - {{ entity.description }}\n * </ng-template>\n * ```\n */\n optionLabelTemplate = input<TemplateRef<any>>();\n\n // a computed version of labelFn that provides a default implementation\n protected _entityLabelFn = computed<(entity: TEntity) => string>(() => {\n const fn = this.labelFn();\n if (fn) {\n return fn;\n }\n return (entity: TEntity) => {\n return (\n (entity as any)['name'] ||\n (entity as any)['label'] ||\n (entity as any)['title'] ||\n String((entity as any)[this.idKey()])\n );\n };\n });\n\n // Whether to group options. Grouping is enabled when either groupOptionsKey\n // or groupByFn is specified.\n protected _group = computed<boolean>(() => {\n return !!this.groupOptionsKey();\n });\n\n // For the global paginator. We'll abstract this into an independent\n // configuration that can be shared across both mat-entity-list and\n // mat-select-entity later.\n // entityListConfig = getEntityListConfig();\n\n // protected _paginator = computed<SPMatEntityListPaginator>(() => {\n // const paginator = this.paginator();\n // const entityListConfigPaginator = this.entityListConfig\n // ?.paginator as SPMatEntityListPaginator;\n // return paginator\n // ? paginator\n // : entityListConfigPaginator ?? new DefaultPaginator();\n // });\n\n stateChanges = new Subject<void>();\n focused = false;\n touched = false;\n\n selectValue!: string | number | string[] | number[];\n // To store initial value when writeValue() is called before entities are\n // loaded, either by entities() input or via paged loader. This is especially\n // necessary when the elf store uses an idKey other than 'id'.\n _initialValue: string | number | string[] | number[] | undefined = undefined;\n\n // For storing last select value, which we use to restore the select's value\n // to when New Item is selected. This ensures that when New Item is selected,\n // the select's value remains the same. If the newly created item is to be\n // set as the select's value, the corresponding TEntity has to be added\n // to _entities (via addEntity()) and then selected by setting the\n // corresponding formControl's value to the entity's id.\n lastSelectValue!: string | number | string[] | number[];\n searching = false;\n filterStr: string = '';\n\n filter$ = new Subject<string>();\n\n // ControlValueAccessor callbacks\n onChanged = (_: any) => {};\n onTouched = () => {};\n\n // @ViewChild(MatSelect) matSelect!: MatSelect;\n matSelect = viewChild(MatSelect);\n\n filteredValues = new Subject<TEntity[]>();\n filteredGroupedValues = new Subject<EntityGroup<TEntity>[]>();\n\n destroy = new Subject<void>();\n\n static nextId = 0;\n @HostBinding() id = `sp-select-entity-${SPMatSelectEntityComponent.nextId++}`;\n private _placeholder!: string;\n //protected http = inject(HttpClient);\n protected cdr = inject(ChangeDetectorRef);\n protected _elementRef = inject(ElementRef<HTMLElement>);\n protected _formField = inject(MAT_FORM_FIELD, { optional: true });\n public ngControl = inject(NgControl, { optional: true });\n transloco = inject(TranslocoService);\n\n // pagedEntityLoader!: SPPagedEntityLoader<TEntity, IdKey>;\n\n constructor() {\n super();\n if (this.ngControl != null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n /**\n * Conditions for loading entities:\n *\n * 1. When the select is opened, if entities have not already been loaded.\n * 2. When the search string changes.\n * 3. When the scroll reaches the bottom and more entities are available\n * to be loaded.\n *\n * We need to create an 'observer-loop' that can handle the above.\n */\n\n ngOnInit() {\n this.startLoader();\n // A rudimentary mechanism to detect which of the two observables\n // emitted the latest value. We reset this array to 'false' after\n // processing every combined emission.\n const emittedObservable = [false, false];\n const store$ = this.store.pipe(selectAllEntities());\n const filter$ = this.filter$.pipe(\n startWith(''),\n distinctUntilChanged(),\n debounceTime(400)\n );\n\n const emittedStatusObservable = (obs: Observable<any>, index: number) =>\n obs.pipe(tap(() => (emittedObservable[index] = true)));\n\n // We need to determine if the emission is owing to a change in\n // filterStr or a change in the entities in pagedEntityLoader.store$.\n //\n // 1. If entities in pagedEntityLoader.store$ have changed, we just need\n // to filter the entities in local store using the current filterStr.\n // 2. If filterStr has changed, there are two cases to handle:-\n // a. If all entities have been loaded, we don't need to reload\n // entities. Instead we just have to filter the entities in\n // local store using the filterStr.\n // b. If all entities have not been loaded, we trigger a server\n // load with the new filterStr as the search param.\n //\n // The following logic implements the above.\n combineLatest([\n emittedStatusObservable(store$, 0),\n emittedStatusObservable(filter$, 1),\n ])\n .pipe(\n takeUntil(this.destroy),\n tap(([entities, filterStr]) => {\n if (emittedObservable.every((eo) => eo)) {\n // initial emission. This can be combined with the case immediately\n // below it. But we keep it separate for clarity.\n emittedObservable[0] = emittedObservable[1] = false;\n this.filterEntities(entities, filterStr);\n } else if (emittedObservable[0]) {\n emittedObservable[0] = false;\n this.filterEntities(entities, filterStr);\n } else {\n emittedObservable[1] = false;\n if (this.allEntitiesLoaded()) {\n this.filterEntities(entities, filterStr);\n } else {\n // If filterStr has changed and not all entities have been loaded\n // store will be reset and entities reloaded from remote with\n // the new filterStr as the search param.\n this.setSearchParamValue(filterStr);\n this.loadNextPage();\n }\n }\n })\n )\n .subscribe();\n\n if (this._initialValue !== undefined) {\n this.writeValue(this._initialValue);\n this._initialValue = undefined;\n }\n }\n\n ngOnDestroy(): void {\n this.destroy.next();\n this.destroy.complete();\n this.stopLoader();\n // this.removeFromCache();\n this.stateChanges.complete();\n }\n\n ngAfterViewInit(): void {\n // I'm not sure this is how this logic is right, but this seems to work.\n // if (this.ngControl && this.ngControl.control?.validator) {\n // const validator = this.ngControl.control.validator;\n // const res = validator(this.ngControl.control);\n // if (res && res['required']) {\n // this.required = true;\n // }\n // }\n // load first page\n // this.loadMoreEntities();\n }\n\n addEntity(entity: TEntity) {\n this.store.update(upsertEntities(entity));\n this.cdr.detectChanges();\n }\n\n get selectTriggerValue() {\n if (this.selectValue) {\n const firstSelected = Array.isArray(this.selectValue)\n ? this.selectValue[0]\n : this.selectValue;\n const selectedEntity = this.getEntity(firstSelected as TEntity[IdKey]);\n return selectedEntity ? this._entityLabelFn()(selectedEntity) : '';\n }\n return '';\n }\n\n get selectTriggerValueAsArray() {\n return Array.isArray(this.selectValue)\n ? (this.selectValue as Array<string | number>)\n : [];\n }\n\n entityId(entity: TEntity) {\n return (entity as any)[this.idKey()];\n }\n\n writeValue(entityId: string | number | string[] | number[]): void {\n // If the component has not yet started (calling startLoader()), we store\n // the initial value in _initialValue and return. The actual setting of\n // the value will happen after startLoader() is called from ngOnInit().\n if (!this.hasStarted()) {\n this._initialValue = entityId;\n return;\n }\n\n const store = this.store;\n const entities = this.getEntities();\n if (Array.isArray(entityId)) {\n if (this.multiple()) {\n const selectedValues: any[] = [];\n entityId.forEach((id) => {\n if (store.query(hasEntity(id as TEntity[IdKey]))) {\n selectedValues.push(id);\n }\n });\n this.selectValue = selectedValues;\n this.cdr.detectChanges();\n }\n } else {\n if (store.query(hasEntity(entityId as TEntity[IdKey]))) {\n // if (this._entities.has(entityId)) {\n this.selectValue = entityId;\n if (this.filterStr) {\n this.filterStr = '';\n // this.filterNonGroupedEntities(entities, this.filterStr);\n }\n this.cdr.detectChanges();\n }\n }\n }\n\n registerOnChange(fn: any): void {\n this.onChanged = fn;\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n @Input()\n get entities(): TEntity[] {\n return this.getEntities();\n }\n\n set entities(items: TEntity[]) {\n this.setEntities(items);\n }\n\n @Input()\n get value(): string | number | string[] | number[] {\n return this.selectValue;\n }\n set value(val: string | number | string[] | number[]) {\n this.selectValue = val;\n this.stateChanges.next();\n }\n get shouldLabelFloat() {\n return this.focused || !this.empty;\n }\n\n @Input('aria-describedby') userAriaDescribedBy!: string;\n\n @Input()\n get placeholder(): string {\n return this._placeholder;\n }\n set placeholder(value: string) {\n this._placeholder = value;\n this.stateChanges.next();\n }\n\n @Input()\n get required() {\n return (\n this._required ??\n this.ngControl?.control?.hasValidator(Validators.required)\n );\n }\n set required(req: boolean) {\n this._required = coerceBooleanProperty(req);\n this.stateChanges.next();\n }\n // Deliberately 'undefined' so that `get required()` will return the state\n // from ngControl's validators.\n private _required!: boolean;\n\n @Input()\n get disabled(): boolean {\n return this._disabled ?? this.ngControl?.control?.disabled;\n }\n set disabled(value: BooleanInput) {\n const disabled = coerceBooleanProperty(value);\n if (disabled !== this._disabled) {\n this.setDisabledState(disabled);\n this.stateChanges.next();\n }\n }\n // Same as `_required`, deliberately `undefined` by default.\n private _disabled!: boolean;\n\n get empty() {\n return !this.value;\n }\n\n get errorState(): boolean {\n return !!this.ngControl?.invalid && this.touched;\n }\n\n onFocusIn(event: FocusEvent) {\n if (!this.focused) {\n this.focused = true;\n this.stateChanges.next();\n }\n }\n\n onFocusOut(event: FocusEvent) {\n if (\n !this._elementRef.nativeElement.contains(event.relatedTarget as Element)\n ) {\n this.touched = true;\n this.focused = false;\n this.onTouched();\n this.stateChanges.next();\n }\n }\n\n setDescribedByIds(ids: string[]) {}\n\n onContainerClick(event: MouseEvent) {\n if ((event.target as Element).tagName.toLowerCase() != 'mat-select') {\n this._elementRef.nativeElement.querySelector('mat-select').focus();\n }\n }\n\n setDisabledState(isDisabled: boolean): void {\n this._disabled = isDisabled;\n const matSelect = this.matSelect();\n if (matSelect) {\n matSelect.setDisabledState(isDisabled);\n this.cdr.detectChanges();\n }\n }\n\n onSelectOpened(ev: any) {\n // Store the current select value so that we can restore it if user\n // eventually selects 'New Item' option.\n this.lastSelectValue = this.selectValue;\n // If values have not been loaded from remote, trigger a load.\n if (this.totalEntitiesAtRemote() === 0) {\n // first load\n this.loadNextPage();\n }\n }\n\n onSelectionChange(ev: MatSelectChange) {\n // console.log('SelectionChange - sel:', ev);\n if (Array.isArray(ev.value)) {\n this.selectValue = ev.value;\n this.onTouched();\n this.onChanged(ev.value);\n const selectedEntities: TEntity[] = ev.value.map((id) =>\n this.store.query(getEntity(id))\n ) as TEntity[];\n this.selectionChange.emit(selectedEntities);\n } else {\n if (ev.value !== '0') {\n this.selectValue = ev.value;\n this.onTouched();\n this.onChanged(ev.value);\n this.selectionChange.emit(this.store.query(getEntity(ev.value)));\n } else {\n // New Item activated, return value to previous value. We track\n // previous value via 'lastSelectValue' member which is updated\n // whenever the select is opened.\n if (this.ngControl) {\n this.ngControl.control?.setValue(this.lastSelectValue);\n }\n ev.source.value = this.lastSelectValue;\n this.createNewItemSelected.emit();\n this.cdr.detectChanges();\n }\n }\n }\n\n /**\n * Wrapper to filter entities based on whether grouping is enabled or not.\n * Calls one of the two filtering methods -- filterGroupedEntities() or\n * filterNonGroupedEntities().\n * @param entities\n * @param filterStr\n * @returns\n */\n filterEntities(entities: TEntity[], filterStr: string) {\n this.searching = true;\n let retval: number | undefined;\n if (this._group()) {\n this.filterGroupedEntities(entities, filterStr);\n } else {\n this.filterNonGroupedEntities(entities, filterStr);\n }\n this.searching = false;\n }\n\n /**\n * Filters the entities based on the search string.\n * @param search The search string to filter entities.\n * @returns The number of entities in the filtered result set or undefined.\n */\n filterNonGroupedEntities(entities: TEntity[], search: string) {\n const searchLwr = search.toLocaleLowerCase();\n if (!search) {\n this.filteredValues.next(entities.slice());\n } else {\n const filteredEntities = entities.filter((member) => {\n const filterFn = this.filterFn();\n if (filterFn) {\n return filterFn(member, search);\n }\n const labelFn = this._entityLabelFn();\n return labelFn(member).toLocaleLowerCase().includes(searchLwr);\n });\n this.filteredValues.next(filteredEntities);\n }\n }\n\n /**\n * Filtering grouped entities logic works like this. If the search string\n * matches a group label, the entire group is to be included in the results.\n * However, if the search string only matches certain entities, only those\n * groups are to be included and within those groups, only entities whose\n * label matches the search string are to be included in the result set.\n * @param search\n * @returns number of groups in the filtered result set.\n */\n filterGroupedEntities(entities: TEntity[], search: string) {\n const searchLwr = search.toLocaleLowerCase();\n // First filter entities by the search string, if it's specified\n let filteredEntities: TEntity[];\n if (!search) {\n filteredEntities = entities;\n } else {\n filteredEntities = entities.filter((member) => {\n const filterFn = this.filterFn();\n if (filterFn) {\n return filterFn(member, search);\n }\n const labelFn = this._entityLabelFn();\n return labelFn(member).toLocaleLowerCase().includes(searchLwr);\n });\n }\n this.filteredGroupedValues.next(this.groupEntities(filteredEntities));\n }\n\n /**\n * Helper to arrange the given array of entities into groups based on the\n * value for `groupOptionsKey`.\n * @param entities\n * @returns EntityGroup<TEntity>[]\n */\n protected groupEntities(entities: TEntity[]): EntityGroup<TEntity>[] {\n const groupOptionsKey = this.groupOptionsKey();\n\n // Normalize the groupOptionsKey into a function that takes a TEntity\n // and returns the group id (string).\n let groupByFn!: (entity: TEntity) => string;\n if (typeof groupOptionsKey === 'string') {\n groupByFn = (entity: TEntity) => {\n return (entity as any)[groupOptionsKey] ?? '???';\n };\n } else if (typeof groupOptionsKey === 'function') {\n groupByFn = groupOptionsKey;\n }\n // if (this.groupByFn()) {\n // groupByFn = this.groupByFn()!;\n // } else if (this.groupOptionsKey()) {\n // groupByFn = (entity: TEntity) => {\n // const key = this.groupOptionsKey()!;\n // return (entity as any)[key] ?? '???';\n // };\n // }\n\n const groupedEntitiesMap = new Map<string | number, TEntity[]>();\n entities.forEach((entity) => {\n const groupId = groupByFn!(entity);\n if (!groupedEntitiesMap.has(groupId)) {\n groupedEntitiesMap.set(groupId, []);\n }\n groupedEntitiesMap.get(groupId)!.push(entity);\n });\n let entityGroups: EntityGroup<TEntity>[] = [];\n groupedEntitiesMap.forEach((entities, groupId) => {\n entityGroups.push({\n label: this.groupLabelFn()(groupId),\n entities,\n });\n });\n return entityGroups;\n }\n\n // private existsInCache() {\n // const cacheKey = this.getCacheKey();\n // if (cacheKey) {\n // return SPMatSelectEntityComponent._entitiesCache.has(cacheKey);\n // }\n // return false;\n // }\n\n // private getCacheKey() {\n // if (typeof this.url() !== 'function') {\n // let params!: HttpParams;\n // if (this.httpParams) {\n // params = new HttpParams({\n // fromString: this.httpParams.toString(),\n // });\n // } else {\n // params = new HttpParams();\n // }\n // // params = params.set('paginate', false)\n // return `${this.url}?${params.toString()}`;\n // }\n // return ''; // empty string evalutes to boolean(false)\n // }\n\n // private getFromCache() {\n // const cacheKey = this.getCacheKey();\n // if (cacheKey && SPMatSelectEntityComponent._entitiesCache.has(cacheKey)) {\n // return SPMatSelectEntityComponent._entitiesCache.get(cacheKey)\n // ?.entities as TEntity[];\n // }\n // return [];\n // }\n\n // private addToCache(entities: TEntity[]) {\n // const cacheKey = this.getCacheKey();\n // if (cacheKey) {\n // if (!SPMatSelectEntityComponent._entitiesCache.has(cacheKey)) {\n // SPMatSelectEntityComponent._entitiesCache.set(cacheKey, {\n // refCount: 0,\n // entities,\n // });\n // }\n // const cacheEntry =\n // SPMatSelectEntityComponent._entitiesCache.get(cacheKey);\n // cacheEntry!.refCount += 1;\n // }\n // }\n\n // private removeFromCache() {\n // const cacheKey = this.getCacheKey();\n // if (cacheKey) {\n // const cacheEntry =\n // SPMatSelectEntityComponent._entitiesCache.get(cacheKey);\n // if (cacheEntry) {\n // cacheEntry!.refCount -= 1;\n // if (cacheEntry.refCount <= 0) {\n // SPMatSelectEntityComponent._entitiesCache.delete(cacheKey);\n // }\n // }\n // }\n // }\n\n private getHttpReqContext() {\n const context = new HttpContext();\n const entityName = this.entityName;\n context.set(SP_MAT_SELECT_ENTITY_HTTP_CONTEXT, {\n entityName: this.entityName(),\n entityNamePlural: this._pluralEntityName(),\n endpoint: this.url() as string,\n });\n return context;\n }\n\n /**\n * If more entities are available, load the next page of entities.\n * This method is triggered when user scrolls to the bottom of the options\n * list. Well almost to the bottom of the options list. :)\n */\n onInfiniteScroll() {\n if (this.hasMore() && !this.loading()) {\n this.loadNextPage();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4Ea,MAAA,iCAAiC,GAC5C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gBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAOvB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBA5ItC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,sBAAsB,EACtB,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGT,EAkBgB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EACtC,OAAA,EAAA;wBACP,YAAY;wBACZ,gBAAgB;wBAChB,WAAW;wBACX,mBAAmB;wBACnB,eAAe;wBACf,eAAe;wBACf,aAAa;wBACb,wBAAwB;wBACxB,eAAe;wBACf,wBAAwB;wBACxB,gCAAgC;qBACjC,EACU,SAAA,EAAA;wBACT,qBAAqB,CAAC,sBAAsB,CAAC;AAC7C,wBAAA,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,4BAA4B,EAAE;AAC1E,qBAAA,EAAA,MAAA,EAAA,CAAA,qMAAA,CAAA,EAAA;wDA+DS,eAAe,EAAA,CAAA;sBAAxB;gBACS,qBAAqB,EAAA,CAAA;sBAA9B;gBAqGc,EAAE,EAAA,CAAA;sBAAhB;gBA0LG,QAAQ,EAAA,CAAA;sBADX;gBAUG,KAAK,EAAA,CAAA;sBADR;gBAY0B,mBAAmB,EAAA,CAAA;sBAA7C,KAAK;uBAAC,kBAAkB;gBAGrB,WAAW,EAAA,CAAA;sBADd;gBAUG,QAAQ,EAAA,CAAA;sBADX;gBAgBG,QAAQ,EAAA,CAAA;sBADX;;;ACrtBH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"smallpearl-ngx-helper-mat-select-entity.mjs","sources":["../../../../projects/smallpearl/ngx-helper/mat-select-entity/src/mat-select-entity.component.ts","../../../../projects/smallpearl/ngx-helper/mat-select-entity/smallpearl-ngx-helper-mat-select-entity.ts"],"sourcesContent":["import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { CommonModule, NgTemplateOutlet } from '@angular/common';\nimport {\n HttpContext,\n HttpContextToken\n} from '@angular/common/http';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n computed,\n ElementRef,\n EventEmitter,\n HostBinding,\n inject,\n input,\n Input,\n OnDestroy,\n OnInit,\n Output,\n TemplateRef,\n viewChild,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n ReactiveFormsModule,\n Validators,\n} from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport {\n MAT_FORM_FIELD,\n MatFormFieldControl,\n} from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport {\n MatSelect,\n MatSelectChange,\n MatSelectModule,\n} from '@angular/material/select';\nimport {\n provideTranslocoScope,\n TranslocoModule,\n TranslocoService,\n} from '@jsverse/transloco';\nimport { getEntity, hasEntity, selectAllEntities, upsertEntities } from '@ngneat/elf-entities';\nimport {\n SPPagedEntityLoader\n} from '@smallpearl/ngx-helper/entities';\nimport {\n SPMatEntityListPaginator,\n SPPageParams,\n} from '@smallpearl/ngx-helper/mat-entity-list';\nimport { MatSelectInfiniteScrollDirective } from '@smallpearl/ngx-helper/mat-select-infinite-scroll';\nimport { NgxMatSelectSearchModule } from 'ngx-mat-select-search';\nimport {\n combineLatest,\n debounceTime,\n distinctUntilChanged,\n Observable,\n startWith,\n Subject,\n takeUntil,\n tap\n} from 'rxjs';\n\n\nexport interface SPMatSelectEntityHttpContext {\n entityName: string;\n entityNamePlural: string;\n endpoint: string;\n}\n\nexport const SP_MAT_SELECT_ENTITY_HTTP_CONTEXT =\n new HttpContextToken<SPMatSelectEntityHttpContext>(() => ({\n entityName: '',\n entityNamePlural: '',\n endpoint: '',\n }));\n\n// Internal type to represent a group of entities. Used when grouping is enabled.\ntype EntityGroup<TEntity> = {\n label: string;\n entities: TEntity[];\n};\n\nexport type SPMatSelectEntityResponseParser = <\n TEntity extends { [P in IdKey]: PropertyKey },\n IdKey extends string = 'id'\n>(\n response: any\n) => Array<TEntity>;\n\n// Default paginator implementation. This can handle dynamic-rest and DRF\n// native pagination schemes. It also has a fallback to handle response conists\n// of an array of entities.\nclass DefaultPaginator implements SPMatEntityListPaginator {\n getRequestPageParams(\n endpoint: string,\n page: number,\n pageSize: number\n ): SPPageParams {\n return {\n page: page + 1,\n pageSize,\n };\n }\n\n parseRequestResponse<\n TEntity extends { [P in IdKey]: PropertyKey },\n IdKey extends string = 'id'\n >(\n entityName: string,\n entityNamePlural: string,\n endpoint: string,\n params: SPPageParams,\n resp: any\n ) {\n if (Array.isArray(resp)) {\n return {\n total: resp.length,\n entities: resp,\n };\n }\n\n if (typeof resp === 'object') {\n const keys = Object.keys(resp);\n // Handle dynamic-rest sideloaded response\n // Rudimentary sideloaded response support. This should work for most\n // of the sideloaded responses where the main entities are stored\n // under the plural entity name key and resp['meta'] object contains\n // the total count.\n if (\n keys.includes(entityNamePlural) &&\n Array.isArray(resp[entityNamePlural])\n ) {\n let total = resp[entityNamePlural].length;\n if (\n keys.includes('meta') &&\n typeof resp['meta'] === 'object' &&\n typeof resp['meta']['total'] === 'number'\n ) {\n total = resp['meta']['total'];\n }\n return {\n total,\n entities: resp[entityNamePlural],\n };\n }\n\n // Handle django-rest-framework style response\n if (keys.includes('results') && Array.isArray(resp['results'])) {\n let total = resp['results'].length;\n if (keys.includes('count') && typeof resp['count'] === 'number') {\n total = resp['count'];\n }\n return {\n total,\n entities: resp['results'],\n };\n }\n\n // Finally, look for \"items\" key\n if (keys.includes('items') && Array.isArray(resp['items'])) {\n return {\n total: resp['items'].length,\n entities: resp['items'],\n };\n }\n }\n\n return {\n total: 0,\n entities: [],\n };\n }\n}\n\n/**\n * This is a generic component to display a <mat-select> for a FK field\n * where the select's options are dynamically loaded from the server using\n * the given url (or URL). The objects thus retrieved should have a\n * unique 'id' field that will be used as the value of each `option` element.\n * Therefore upon selection of an `option` element, the `select` value will\n * be set to the object's `id` property. By default 'id' is used as its id,\n * but this can be customized by specifying the `idKey' property value.\n */\n@Component({\n selector: 'sp-mat-select-entity',\n template: `\n <div\n *transloco=\"let t; scope: 'sp-mat-select-entity'\"\n (focusin)=\"onFocusIn($event)\"\n (focusout)=\"onFocusOut($event)\"\n role=\"group\"\n [attr.aria-labelledby]=\"_formField?.getLabelId()\"\n >\n <mat-select\n [placeholder]=\"placeholder\"\n (opened)=\"onSelectOpened($event)\"\n (selectionChange)=\"onSelectionChange($event)\"\n [multiple]=\"multiple()\"\n [(ngModel)]=\"selectValue\"\n msInfiniteScroll\n (infiniteScroll)=\"onInfiniteScroll()\"\n [disabled]=\"disabled || readonly()\"\n >\n <mat-select-trigger>\n {{ selectTriggerValue }}\n @if (selectTriggerValueAsArray.length > 1) {\n <span class=\"addl-selection-count\">\n (+{{ selectTriggerValueAsArray.length - 1 }})\n </span>\n }\n </mat-select-trigger>\n\n <mat-option [disabled]=\"totalEntitiesCount() === 0\">\n <ngx-mat-select-search\n class=\"flex-grow-1\"\n [(ngModel)]=\"filterStr\"\n (ngModelChange)=\"this.filter$.next($event)\"\n [placeholderLabel]=\"\n searchText() ? searchText() : t('spMatSelectEntity.search')\n \"\n [noEntriesFoundLabel]=\"\n notFoundText() ? notFoundText() : t('spMatSelectEntity.notFound')\n \"\n [searching]=\"searching\"\n >\n </ngx-mat-select-search>\n </mat-option>\n\n <ng-template #defaultOptionLabelTemplate let-entity>\n {{ _entityLabelFn()(entity) }}\n </ng-template>\n @if (!_group()) { @if (filteredValues | async; as entities) { @for\n (entity of entities; track entityId(entity)) {\n <mat-option class=\"sel-entity-option\" [value]=\"entityId(entity)\">\n <ng-container\n *ngTemplateOutlet=\"\n optionLabelTemplate() || defaultOptionLabelTemplate;\n context: { $implicit: entity }\n \"\n ></ng-container>\n </mat-option>\n } } } @else { @if (filteredGroupedValues | async; as groups) { @for\n (group of groups; track group.label) {\n <mat-optgroup [label]=\"group.label\">\n @for (entity of group.entities; track entityId(entity)) {\n <mat-option class=\"sel-entity-option\" [value]=\"entityId(entity)\">\n <ng-container\n *ngTemplateOutlet=\"\n optionLabelTemplate() || defaultOptionLabelTemplate;\n context: { $implicit: entity }\n \"\n ></ng-container>\n </mat-option>\n }\n </mat-optgroup>\n } } }\n\n <!--\n Create New option is displayed only if there is a filter string.\n The logic behind this behavior being that user searches for a matching\n item and when not finding one, would like to add a new one.\n -->\n @if (inlineNew() && loaded() && (filterStr.length > 0 || totalEntitiesAtRemote() === 0)) {\n <mat-option\n class=\"add-item-option\"\n value=\"0\"\n (click)=\"$event.stopPropagation()\"\n >⊕\n {{\n this.createNewText()\n ? this.createNewText()\n : t('spMatSelectEntity.createNew', {\n item: this._capitalizedEntityName()\n })\n }}\n </mat-option>\n }\n @if (loading$ | async) {\n <div class=\"loading-wrapper\">\n <mat-progress-spinner\n diameter=\"24\"\n mode=\"indeterminate\"\n ></mat-progress-spinner>\n </div>\n }\n </mat-select>\n </div>\n `,\n styles: [\n `\n .add-item-option {\n padding-top: 2px;\n border-top: 1px solid var(--mat-sys-outline);\n }\n .addl-selection-count {\n opacity: 0.75;\n font-size: 0.8em;\n }\n .loading-wrapper {\n display: flex;\n justify-content: center;\n padding: 8px 0;\n }\n `,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n CommonModule,\n NgTemplateOutlet,\n FormsModule,\n ReactiveFormsModule,\n MatSelectModule,\n MatButtonModule,\n MatIconModule,\n MatProgressSpinnerModule,\n TranslocoModule,\n NgxMatSelectSearchModule,\n MatSelectInfiniteScrollDirective,\n ],\n providers: [\n provideTranslocoScope('sp-mat-select-entity'),\n { provide: MatFormFieldControl, useExisting: SPMatSelectEntityComponent },\n ],\n})\nexport class SPMatSelectEntityComponent<\n TEntity extends { [P in IdKey]: PropertyKey },\n IdKey extends string = 'id'\n >\n extends SPPagedEntityLoader<TEntity, IdKey>\n implements\n OnInit,\n OnDestroy,\n AfterViewInit,\n ControlValueAccessor,\n MatFormFieldControl<string | number | string[] | number[]>\n{\n // We cache the entities that we fetch from remote here. Cache is indexed\n // by the endpoint. Each endpoint also keeps a refCount, which is incremented\n // for each instance of the component using the same endpoint. When this\n // refcount reaches 0, the endpoint is removed from the cache.\n //\n // This mechanism is to suppress multiple fetches from the remote from the\n // same endpoint as that can occur if a form has multiple instances of\n // this component with the same url.\n // static _entitiesCache = new Map<\n // string,\n // { refCount: number; entities: Array<any> }\n // >();\n\n //**** OPTIONAL ATTRIBUTES ****//\n\n // Entity label function - function that takes an entity object and returns\n // a string label for it. If not specified, a default label function is used\n // that returns the value of 'name' or 'label' or 'title' property. If\n // none of these properties are present, the entity's id is returned as\n // string.\n labelFn = input<(entity: TEntity) => string>();\n\n // Entity filter function - return a boolean if the entity is to be included\n // in the filtered entities list.\n filterFn = input<(entity: TEntity, search: string) => boolean>();\n\n // Set to true to show \"Add { item }\" option in the select dropdown.\n // Selecting this option, will emit `createNewItemSelected` event.\n inlineNew = input<boolean>(false);\n\n // Set to true to allow multiple option selection. The returned value\n // would be an array of entity ids.\n multiple = input<boolean>(false);\n\n // Set to true to make the mat-select readonly\n readonly = input<boolean>(false);\n\n /**\n * The entity key name that is used to classify entities into groups or\n * a function that takes a TEntity and returns the group id (string).\n * Entities with the same key value will be grouped together. If this is\n * specified, grouping will be enabled.\n * @see groupByFn\n */\n groupOptionsKey = input<string | ((entity: TEntity) => string)>();\n\n /**\n * A function that a group id (string/number) and returns the label (string).\n * Defaults to a function that returns the group id as string.\n */\n groupLabelFn = input<(groupId: string|number) => string>((groupId) => groupId.toString());\n\n @Output() selectionChange = new EventEmitter<TEntity | TEntity[]>();\n @Output() createNewItemSelected = new EventEmitter<void>();\n\n // i18n localization support toallow per component customization of\n // some strings used.\n readonly searchText = input<string>();\n readonly notFoundText = input<string>();\n readonly createNewText = input<string>();\n\n controlType = 'sp-mat-select-entity';\n\n /**\n * Template for the option label. If not provided, the default label\n * function will be used. Option label is what is placed inside the\n * <mat-option> tag. The template gets an implicit 'entity' variable\n * in the context, value for which is the entity object.\n *\n * For example:\n * ```\n * <sp-mat-select-entity\n * [url]=\"'/api/v1/customers/'\"\n * [labelFn]=\"entity => entity.name\"\n * [optionLabelTemplate]=\"optionLabelTemplate\"\n * ></sp-mat-select-entity>\n * <ng-template #optionLabelTemplate let-entity>\n * {{ entity.name }} - {{ entity.description }}\n * </ng-template>\n * ```\n */\n optionLabelTemplate = input<TemplateRef<any>>();\n\n // a computed version of labelFn that provides a default implementation\n protected _entityLabelFn = computed<(entity: TEntity) => string>(() => {\n const fn = this.labelFn();\n if (fn) {\n return fn;\n }\n return (entity: TEntity) => {\n return (\n (entity as any)['name'] ||\n (entity as any)['label'] ||\n (entity as any)['title'] ||\n String((entity as any)[this.idKey()])\n );\n };\n });\n\n // Whether to group options. Grouping is enabled when either groupOptionsKey\n // or groupByFn is specified.\n protected _group = computed<boolean>(() => {\n return !!this.groupOptionsKey();\n });\n\n // For the global paginator. We'll abstract this into an independent\n // configuration that can be shared across both mat-entity-list and\n // mat-select-entity later.\n // entityListConfig = getEntityListConfig();\n\n // protected _paginator = computed<SPMatEntityListPaginator>(() => {\n // const paginator = this.paginator();\n // const entityListConfigPaginator = this.entityListConfig\n // ?.paginator as SPMatEntityListPaginator;\n // return paginator\n // ? paginator\n // : entityListConfigPaginator ?? new DefaultPaginator();\n // });\n\n stateChanges = new Subject<void>();\n focused = false;\n touched = false;\n\n selectValue!: string | number | string[] | number[];\n // To store initial value when writeValue() is called before entities are\n // loaded, either by entities() input or via paged loader. This is especially\n // necessary when the elf store uses an idKey other than 'id'.\n _initialValue: string | number | string[] | number[] | undefined = undefined;\n\n // For storing last select value, which we use to restore the select's value\n // to when New Item is selected. This ensures that when New Item is selected,\n // the select's value remains the same. If the newly created item is to be\n // set as the select's value, the corresponding TEntity has to be added\n // to _entities (via addEntity()) and then selected by setting the\n // corresponding formControl's value to the entity's id.\n lastSelectValue!: string | number | string[] | number[];\n searching = false;\n filterStr: string = '';\n\n filter$ = new Subject<string>();\n\n // ControlValueAccessor callbacks\n onChanged = (_: any) => {};\n onTouched = () => {};\n\n // @ViewChild(MatSelect) matSelect!: MatSelect;\n matSelect = viewChild(MatSelect);\n\n filteredValues = new Subject<TEntity[]>();\n filteredGroupedValues = new Subject<EntityGroup<TEntity>[]>();\n\n destroy = new Subject<void>();\n\n static nextId = 0;\n @HostBinding() id = `sp-select-entity-${SPMatSelectEntityComponent.nextId++}`;\n private _placeholder!: string;\n //protected http = inject(HttpClient);\n protected cdr = inject(ChangeDetectorRef);\n protected _elementRef = inject(ElementRef<HTMLElement>);\n protected _formField = inject(MAT_FORM_FIELD, { optional: true });\n public ngControl = inject(NgControl, { optional: true });\n transloco = inject(TranslocoService);\n\n // pagedEntityLoader!: SPPagedEntityLoader<TEntity, IdKey>;\n\n constructor() {\n super();\n if (this.ngControl != null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n /**\n * Conditions for loading entities:\n *\n * 1. When the select is opened, if entities have not already been loaded.\n * 2. When the search string changes.\n * 3. When the scroll reaches the bottom and more entities are available\n * to be loaded.\n *\n * We need to create an 'observer-loop' that can handle the above.\n */\n\n ngOnInit() {\n this.startLoader();\n // A rudimentary mechanism to detect which of the two observables\n // emitted the latest value. We reset this array to 'false' after\n // processing every combined emission.\n const emittedObservable = [false, false];\n const store$ = this.store.pipe(selectAllEntities());\n const filter$ = this.filter$.pipe(\n startWith(''),\n distinctUntilChanged(),\n debounceTime(400)\n );\n\n const emittedStatusObservable = (obs: Observable<any>, index: number) =>\n obs.pipe(tap(() => (emittedObservable[index] = true)));\n\n // We need to determine if the emission is owing to a change in\n // filterStr or a change in the entities in pagedEntityLoader.store$.\n //\n // 1. If entities in pagedEntityLoader.store$ have changed, we just need\n // to filter the entities in local store using the current filterStr.\n // 2. If filterStr has changed, there are two cases to handle:-\n // a. If all entities have been loaded, we don't need to reload\n // entities. Instead we just have to filter the entities in\n // local store using the filterStr.\n // b. If all entities have not been loaded, we trigger a server\n // load with the new filterStr as the search param.\n //\n // The following logic implements the above.\n combineLatest([\n emittedStatusObservable(store$, 0),\n emittedStatusObservable(filter$, 1),\n ])\n .pipe(\n takeUntil(this.destroy),\n tap(([entities, filterStr]) => {\n if (emittedObservable.every((eo) => eo)) {\n // initial emission. This can be combined with the case immediately\n // below it. But we keep it separate for clarity.\n emittedObservable[0] = emittedObservable[1] = false;\n this.filterEntities(entities, filterStr);\n } else if (emittedObservable[0]) {\n emittedObservable[0] = false;\n this.filterEntities(entities, filterStr);\n } else {\n emittedObservable[1] = false;\n if (this.allEntitiesLoaded()) {\n this.filterEntities(entities, filterStr);\n } else {\n // If filterStr has changed and not all entities have been loaded\n // store will be reset and entities reloaded from remote with\n // the new filterStr as the search param.\n this.setSearchParamValue(filterStr);\n this.loadNextPage();\n }\n }\n })\n )\n .subscribe();\n\n if (this._initialValue !== undefined) {\n this.writeValue(this._initialValue);\n this._initialValue = undefined;\n }\n }\n\n ngOnDestroy(): void {\n this.destroy.next();\n this.destroy.complete();\n this.stopLoader();\n // this.removeFromCache();\n this.stateChanges.complete();\n }\n\n ngAfterViewInit(): void {\n // I'm not sure this is how this logic is right, but this seems to work.\n // if (this.ngControl && this.ngControl.control?.validator) {\n // const validator = this.ngControl.control.validator;\n // const res = validator(this.ngControl.control);\n // if (res && res['required']) {\n // this.required = true;\n // }\n // }\n // load first page\n // this.loadMoreEntities();\n }\n\n addEntity(entity: TEntity) {\n this.store.update(upsertEntities(entity));\n this.cdr.detectChanges();\n }\n\n get selectTriggerValue() {\n if (this.selectValue) {\n const firstSelected = Array.isArray(this.selectValue)\n ? this.selectValue[0]\n : this.selectValue;\n const selectedEntity = this.getEntity(firstSelected as TEntity[IdKey]);\n return selectedEntity ? this._entityLabelFn()(selectedEntity) : '';\n }\n return '';\n }\n\n get selectTriggerValueAsArray() {\n return Array.isArray(this.selectValue)\n ? (this.selectValue as Array<string | number>)\n : [];\n }\n\n entityId(entity: TEntity) {\n return (entity as any)[this.idKey()];\n }\n\n writeValue(entityId: string | number | string[] | number[]): void {\n // If the component has not yet started (calling startLoader()), we store\n // the initial value in _initialValue and return. The actual setting of\n // the value will happen after startLoader() is called from ngOnInit().\n if (!this.hasStarted()) {\n this._initialValue = entityId;\n return;\n }\n\n const store = this.store;\n const entities = this.getEntities();\n if (Array.isArray(entityId)) {\n if (this.multiple()) {\n const selectedValues: any[] = [];\n entityId.forEach((id) => {\n if (store.query(hasEntity(id as TEntity[IdKey]))) {\n selectedValues.push(id);\n }\n });\n this.selectValue = selectedValues;\n this.cdr.detectChanges();\n }\n } else {\n if (store.query(hasEntity(entityId as TEntity[IdKey]))) {\n // if (this._entities.has(entityId)) {\n this.selectValue = entityId;\n if (this.filterStr) {\n this.filterStr = '';\n // this.filterNonGroupedEntities(entities, this.filterStr);\n }\n this.cdr.detectChanges();\n }\n }\n }\n\n registerOnChange(fn: any): void {\n this.onChanged = fn;\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n @Input()\n get entities(): TEntity[] {\n return this.getEntities();\n }\n\n set entities(items: TEntity[]) {\n this.setEntities(items);\n }\n\n @Input()\n get value(): string | number | string[] | number[] {\n return this.selectValue;\n }\n set value(val: string | number | string[] | number[]) {\n this.selectValue = val;\n this.stateChanges.next();\n }\n get shouldLabelFloat() {\n return this.focused || !this.empty;\n }\n\n @Input('aria-describedby') userAriaDescribedBy!: string;\n\n @Input()\n get placeholder(): string {\n return this._placeholder;\n }\n set placeholder(value: string) {\n this._placeholder = value;\n this.stateChanges.next();\n }\n\n @Input()\n get required() {\n return (\n this._required ??\n this.ngControl?.control?.hasValidator(Validators.required)\n );\n }\n set required(req: boolean) {\n this._required = coerceBooleanProperty(req);\n this.stateChanges.next();\n }\n // Deliberately 'undefined' so that `get required()` will return the state\n // from ngControl's validators.\n private _required!: boolean;\n\n @Input()\n get disabled(): boolean {\n return this._disabled ?? this.ngControl?.control?.disabled;\n }\n set disabled(value: BooleanInput) {\n const disabled = coerceBooleanProperty(value);\n if (disabled !== this._disabled) {\n this.setDisabledState(disabled);\n this.stateChanges.next();\n }\n }\n // Same as `_required`, deliberately `undefined` by default.\n private _disabled!: boolean;\n\n get empty() {\n return !this.value;\n }\n\n get errorState(): boolean {\n return !!this.ngControl?.invalid && this.touched;\n }\n\n onFocusIn(event: FocusEvent) {\n if (!this.focused) {\n this.focused = true;\n this.stateChanges.next();\n }\n }\n\n onFocusOut(event: FocusEvent) {\n if (\n !this._elementRef.nativeElement.contains(event.relatedTarget as Element)\n ) {\n this.touched = true;\n this.focused = false;\n this.onTouched();\n this.stateChanges.next();\n }\n }\n\n setDescribedByIds(ids: string[]) {}\n\n onContainerClick(event: MouseEvent) {\n if ((event.target as Element).tagName.toLowerCase() != 'mat-select') {\n this._elementRef.nativeElement.querySelector('mat-select').focus();\n }\n }\n\n setDisabledState(isDisabled: boolean): void {\n this._disabled = isDisabled;\n const matSelect = this.matSelect();\n if (matSelect) {\n matSelect.setDisabledState(isDisabled);\n this.cdr.detectChanges();\n }\n }\n\n onSelectOpened(ev: any) {\n // Store the current select value so that we can restore it if user\n // eventually selects 'New Item' option.\n this.lastSelectValue = this.selectValue;\n // If values have not been loaded from remote, trigger a load.\n if (this.totalEntitiesAtRemote() === 0) {\n // first load\n this.loadNextPage();\n }\n }\n\n onSelectionChange(ev: MatSelectChange) {\n // console.log('SelectionChange - sel:', ev);\n if (Array.isArray(ev.value)) {\n this.selectValue = ev.value;\n this.onTouched();\n this.onChanged(ev.value);\n const selectedEntities: TEntity[] = ev.value.map((id) =>\n this.store.query(getEntity(id))\n ) as TEntity[];\n this.selectionChange.emit(selectedEntities);\n } else {\n if (ev.value !== '0') {\n this.selectValue = ev.value;\n this.onTouched();\n this.onChanged(ev.value);\n this.selectionChange.emit(this.store.query(getEntity(ev.value)));\n } else {\n // New Item activated, return value to previous value. We track\n // previous value via 'lastSelectValue' member which is updated\n // whenever the select is opened.\n if (this.ngControl) {\n this.ngControl.control?.setValue(this.lastSelectValue);\n }\n ev.source.value = this.lastSelectValue;\n this.createNewItemSelected.emit();\n this.cdr.detectChanges();\n }\n }\n }\n\n /**\n * Wrapper to filter entities based on whether grouping is enabled or not.\n * Calls one of the two filtering methods -- filterGroupedEntities() or\n * filterNonGroupedEntities().\n * @param entities\n * @param filterStr\n * @returns\n */\n filterEntities(entities: TEntity[], filterStr: string) {\n this.searching = true;\n let retval: number | undefined;\n if (this._group()) {\n this.filterGroupedEntities(entities, filterStr);\n } else {\n this.filterNonGroupedEntities(entities, filterStr);\n }\n this.searching = false;\n }\n\n /**\n * Filters the entities based on the search string.\n * @param search The search string to filter entities.\n * @returns The number of entities in the filtered result set or undefined.\n */\n filterNonGroupedEntities(entities: TEntity[], search: string) {\n const searchLwr = search.toLocaleLowerCase();\n if (!search) {\n this.filteredValues.next(entities.slice());\n } else {\n const filteredEntities = entities.filter((member) => {\n const filterFn = this.filterFn();\n if (filterFn) {\n return filterFn(member, search);\n }\n const labelFn = this._entityLabelFn();\n return labelFn(member).toLocaleLowerCase().includes(searchLwr);\n });\n this.filteredValues.next(filteredEntities);\n }\n }\n\n /**\n * Filtering grouped entities logic works like this. If the search string\n * matches a group label, the entire group is to be included in the results.\n * However, if the search string only matches certain entities, only those\n * groups are to be included and within those groups, only entities whose\n * label matches the search string are to be included in the result set.\n * @param search\n * @returns number of groups in the filtered result set.\n */\n filterGroupedEntities(entities: TEntity[], search: string) {\n const searchLwr = search.toLocaleLowerCase();\n // First filter entities by the search string, if it's specified\n let filteredEntities: TEntity[];\n if (!search) {\n filteredEntities = entities;\n } else {\n filteredEntities = entities.filter((member) => {\n const filterFn = this.filterFn();\n if (filterFn) {\n return filterFn(member, search);\n }\n const labelFn = this._entityLabelFn();\n return labelFn(member).toLocaleLowerCase().includes(searchLwr);\n });\n }\n this.filteredGroupedValues.next(this.groupEntities(filteredEntities));\n }\n\n /**\n * Helper to arrange the given array of entities into groups based on the\n * value for `groupOptionsKey`.\n * @param entities\n * @returns EntityGroup<TEntity>[]\n */\n protected groupEntities(entities: TEntity[]): EntityGroup<TEntity>[] {\n const groupOptionsKey = this.groupOptionsKey();\n\n // Normalize the groupOptionsKey into a function that takes a TEntity\n // and returns the group id (string).\n let groupByFn!: (entity: TEntity) => string;\n if (typeof groupOptionsKey === 'string') {\n groupByFn = (entity: TEntity) => {\n return (entity as any)[groupOptionsKey] ?? '???';\n };\n } else if (typeof groupOptionsKey === 'function') {\n groupByFn = groupOptionsKey;\n }\n // if (this.groupByFn()) {\n // groupByFn = this.groupByFn()!;\n // } else if (this.groupOptionsKey()) {\n // groupByFn = (entity: TEntity) => {\n // const key = this.groupOptionsKey()!;\n // return (entity as any)[key] ?? '???';\n // };\n // }\n\n const groupedEntitiesMap = new Map<string | number, TEntity[]>();\n entities.forEach((entity) => {\n const groupId = groupByFn!(entity);\n if (!groupedEntitiesMap.has(groupId)) {\n groupedEntitiesMap.set(groupId, []);\n }\n groupedEntitiesMap.get(groupId)!.push(entity);\n });\n let entityGroups: EntityGroup<TEntity>[] = [];\n groupedEntitiesMap.forEach((entities, groupId) => {\n entityGroups.push({\n label: this.groupLabelFn()(groupId),\n entities,\n });\n });\n return entityGroups;\n }\n\n // private existsInCache() {\n // const cacheKey = this.getCacheKey();\n // if (cacheKey) {\n // return SPMatSelectEntityComponent._entitiesCache.has(cacheKey);\n // }\n // return false;\n // }\n\n // private getCacheKey() {\n // if (typeof this.url() !== 'function') {\n // let params!: HttpParams;\n // if (this.httpParams) {\n // params = new HttpParams({\n // fromString: this.httpParams.toString(),\n // });\n // } else {\n // params = new HttpParams();\n // }\n // // params = params.set('paginate', false)\n // return `${this.url}?${params.toString()}`;\n // }\n // return ''; // empty string evalutes to boolean(false)\n // }\n\n // private getFromCache() {\n // const cacheKey = this.getCacheKey();\n // if (cacheKey && SPMatSelectEntityComponent._entitiesCache.has(cacheKey)) {\n // return SPMatSelectEntityComponent._entitiesCache.get(cacheKey)\n // ?.entities as TEntity[];\n // }\n // return [];\n // }\n\n // private addToCache(entities: TEntity[]) {\n // const cacheKey = this.getCacheKey();\n // if (cacheKey) {\n // if (!SPMatSelectEntityComponent._entitiesCache.has(cacheKey)) {\n // SPMatSelectEntityComponent._entitiesCache.set(cacheKey, {\n // refCount: 0,\n // entities,\n // });\n // }\n // const cacheEntry =\n // SPMatSelectEntityComponent._entitiesCache.get(cacheKey);\n // cacheEntry!.refCount += 1;\n // }\n // }\n\n // private removeFromCache() {\n // const cacheKey = this.getCacheKey();\n // if (cacheKey) {\n // const cacheEntry =\n // SPMatSelectEntityComponent._entitiesCache.get(cacheKey);\n // if (cacheEntry) {\n // cacheEntry!.refCount -= 1;\n // if (cacheEntry.refCount <= 0) {\n // SPMatSelectEntityComponent._entitiesCache.delete(cacheKey);\n // }\n // }\n // }\n // }\n\n private getHttpReqContext() {\n const context = new HttpContext();\n const entityName = this.entityName;\n context.set(SP_MAT_SELECT_ENTITY_HTTP_CONTEXT, {\n entityName: this.entityName(),\n entityNamePlural: this._pluralEntityName(),\n endpoint: this.url() as string,\n });\n return context;\n }\n\n /**\n * If more entities are available, load the next page of entities.\n * This method is triggered when user scrolls to the bottom of the options\n * list. Well almost to the bottom of the options list. :)\n */\n onInfiniteScroll() {\n if (this.hasMore() && !this.loading()) {\n this.loadNextPage();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4Ea,MAAA,iCAAiC,GAC5C,IAAI,gBAAgB,CAA+B,OAAO;AACxD,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,gBAAgB,EAAE,EAAE;AACpB,IAAA,QAAQ,EAAE,EAAE;AACb,CAAA,CAAC;AAeJ;AACA;AACA;AACA,MAAM,gBAAgB,CAAA;AACpB,IAAA,oBAAoB,CAClB,QAAgB,EAChB,IAAY,EACZ,QAAgB,EAAA;QAEhB,OAAO;YACL,IAAI,EAAE,IAAI,GAAG,CAA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AOvB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBA7ItC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,sBAAsB,EACtB,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGT,EAkBgB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EACtC,OAAA,EAAA;wBACP,YAAY;wBACZ,gBAAgB;wBAChB,WAAW;wBACX,mBAAmB;wBACnB,eAAe;wBACf,eAAe;wBACf,aAAa;wBACb,wBAAwB;wBACxB,eAAe;wBACf,wBAAwB;wBACxB,gCAAgC;qBACjC,EACU,SAAA,EAAA;wBACT,qBAAqB,CAAC,sBAAsB,CAAC;AAC7C,wBAAA,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,4BAA4B,EAAE;AAC1E,qBAAA,EAAA,MAAA,EAAA,CAAA,qMAAA,CAAA,EAAA;wDAkES,eAAe,EAAA,CAAA;sBAAxB;gBACS,qBAAqB,EAAA,CAAA;sBAA9B;gBAqGc,EAAE,EAAA,CAAA;sBAAhB;gBA0LG,QAAQ,EAAA,CAAA;sBADX;gBAUG,KAAK,EAAA,CAAA;sBADR;gBAY0B,mBAAmB,EAAA,CAAA;sBAA7C,KAAK;uBAAC,kBAAkB;gBAGrB,WAAW,EAAA,CAAA;sBADd;gBAUG,QAAQ,EAAA,CAAA;sBADX;gBAgBG,QAAQ,EAAA,CAAA;sBADX;;;ACztBH;;AAEG;;;;"}
|
|
@@ -37,6 +37,7 @@ export declare class SPMatSelectEntityComponent<TEntity extends {
|
|
|
37
37
|
filterFn: import("@angular/core").InputSignal<((entity: TEntity, search: string) => boolean) | undefined>;
|
|
38
38
|
inlineNew: import("@angular/core").InputSignal<boolean>;
|
|
39
39
|
multiple: import("@angular/core").InputSignal<boolean>;
|
|
40
|
+
readonly: import("@angular/core").InputSignal<boolean>;
|
|
40
41
|
/**
|
|
41
42
|
* The entity key name that is used to classify entities into groups or
|
|
42
43
|
* a function that takes a TEntity and returns the group id (string).
|
|
@@ -184,6 +185,6 @@ export declare class SPMatSelectEntityComponent<TEntity extends {
|
|
|
184
185
|
*/
|
|
185
186
|
onInfiniteScroll(): void;
|
|
186
187
|
static ɵfac: i0.ɵɵFactoryDeclaration<SPMatSelectEntityComponent<any, any>, never>;
|
|
187
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SPMatSelectEntityComponent<any, any>, "sp-mat-select-entity", never, { "labelFn": { "alias": "labelFn"; "required": false; "isSignal": true; }; "filterFn": { "alias": "filterFn"; "required": false; "isSignal": true; }; "inlineNew": { "alias": "inlineNew"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "groupOptionsKey": { "alias": "groupOptionsKey"; "required": false; "isSignal": true; }; "groupLabelFn": { "alias": "groupLabelFn"; "required": false; "isSignal": true; }; "searchText": { "alias": "searchText"; "required": false; "isSignal": true; }; "notFoundText": { "alias": "notFoundText"; "required": false; "isSignal": true; }; "createNewText": { "alias": "createNewText"; "required": false; "isSignal": true; }; "optionLabelTemplate": { "alias": "optionLabelTemplate"; "required": false; "isSignal": true; }; "entities": { "alias": "entities"; "required": false; }; "value": { "alias": "value"; "required": false; }; "userAriaDescribedBy": { "alias": "aria-describedby"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "selectionChange": "selectionChange"; "createNewItemSelected": "createNewItemSelected"; }, never, never, true, never>;
|
|
188
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SPMatSelectEntityComponent<any, any>, "sp-mat-select-entity", never, { "labelFn": { "alias": "labelFn"; "required": false; "isSignal": true; }; "filterFn": { "alias": "filterFn"; "required": false; "isSignal": true; }; "inlineNew": { "alias": "inlineNew"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "groupOptionsKey": { "alias": "groupOptionsKey"; "required": false; "isSignal": true; }; "groupLabelFn": { "alias": "groupLabelFn"; "required": false; "isSignal": true; }; "searchText": { "alias": "searchText"; "required": false; "isSignal": true; }; "notFoundText": { "alias": "notFoundText"; "required": false; "isSignal": true; }; "createNewText": { "alias": "createNewText"; "required": false; "isSignal": true; }; "optionLabelTemplate": { "alias": "optionLabelTemplate"; "required": false; "isSignal": true; }; "entities": { "alias": "entities"; "required": false; }; "value": { "alias": "value"; "required": false; }; "userAriaDescribedBy": { "alias": "aria-describedby"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "selectionChange": "selectionChange"; "createNewItemSelected": "createNewItemSelected"; }, never, never, true, never>;
|
|
188
189
|
}
|
|
189
190
|
export {};
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"path": "src/assets/i18n/"
|
|
7
7
|
}
|
|
8
8
|
],
|
|
9
|
-
"version": "0.33.
|
|
9
|
+
"version": "0.33.24",
|
|
10
10
|
"peerDependencies": {
|
|
11
11
|
"@angular/common": "^19.1.0",
|
|
12
12
|
"@angular/core": "^19.1.0",
|
|
@@ -48,25 +48,25 @@
|
|
|
48
48
|
"types": "./entities/index.d.ts",
|
|
49
49
|
"default": "./fesm2022/smallpearl-ngx-helper-entities.mjs"
|
|
50
50
|
},
|
|
51
|
-
"./
|
|
52
|
-
"types": "./
|
|
53
|
-
"default": "./fesm2022/smallpearl-ngx-helper-
|
|
54
|
-
},
|
|
55
|
-
"./forms": {
|
|
56
|
-
"types": "./forms/index.d.ts",
|
|
57
|
-
"default": "./fesm2022/smallpearl-ngx-helper-forms.mjs"
|
|
51
|
+
"./entity-field": {
|
|
52
|
+
"types": "./entity-field/index.d.ts",
|
|
53
|
+
"default": "./fesm2022/smallpearl-ngx-helper-entity-field.mjs"
|
|
58
54
|
},
|
|
59
55
|
"./hover-dropdown": {
|
|
60
56
|
"types": "./hover-dropdown/index.d.ts",
|
|
61
57
|
"default": "./fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs"
|
|
62
58
|
},
|
|
59
|
+
"./forms": {
|
|
60
|
+
"types": "./forms/index.d.ts",
|
|
61
|
+
"default": "./fesm2022/smallpearl-ngx-helper-forms.mjs"
|
|
62
|
+
},
|
|
63
63
|
"./mat-busy-wheel": {
|
|
64
64
|
"types": "./mat-busy-wheel/index.d.ts",
|
|
65
65
|
"default": "./fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs"
|
|
66
66
|
},
|
|
67
|
-
"./
|
|
68
|
-
"types": "./
|
|
69
|
-
"default": "./fesm2022/smallpearl-ngx-helper-
|
|
67
|
+
"./locale": {
|
|
68
|
+
"types": "./locale/index.d.ts",
|
|
69
|
+
"default": "./fesm2022/smallpearl-ngx-helper-locale.mjs"
|
|
70
70
|
},
|
|
71
71
|
"./mat-context-menu": {
|
|
72
72
|
"types": "./mat-context-menu/index.d.ts",
|