@smallpearl/ngx-helper 20.0.3 → 20.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/smallpearl-ngx-helper-entities.mjs +3 -3
- package/fesm2022/smallpearl-ngx-helper-entities.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs +3 -3
- package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-locale.mjs +6 -6
- package/fesm2022/smallpearl-ngx-helper-locale.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs +9 -9
- package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs +3 -3
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs +17 -17
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs +30 -45
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs +21 -21
- package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs +15 -15
- package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs +106 -115
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-infinite-scroll.mjs +6 -6
- package/fesm2022/smallpearl-ngx-helper-mat-select-infinite-scroll.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs +166 -140
- package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs +38 -36
- package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs +6 -6
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-utils.mjs +23 -0
- package/fesm2022/smallpearl-ngx-helper-utils.mjs.map +1 -0
- package/fesm2022/smallpearl-ngx-helper.mjs +2 -7
- package/fesm2022/smallpearl-ngx-helper.mjs.map +1 -1
- package/package.json +24 -24
- package/{mat-select-entity/index.d.ts → types/smallpearl-ngx-helper-mat-select-entity.d.ts} +2 -1
- package/types/smallpearl-ngx-helper-utils.d.ts +6 -0
- package/types/smallpearl-ngx-helper.d.ts +3 -0
- package/core/index.d.ts +0 -3
- package/fesm2022/smallpearl-ngx-helper-core.mjs +0 -8
- package/fesm2022/smallpearl-ngx-helper-core.mjs.map +0 -1
- package/index.d.ts +0 -4
- /package/{entities/index.d.ts → types/smallpearl-ngx-helper-entities.d.ts} +0 -0
- /package/{entity-field/index.d.ts → types/smallpearl-ngx-helper-entity-field.d.ts} +0 -0
- /package/{forms/index.d.ts → types/smallpearl-ngx-helper-forms.d.ts} +0 -0
- /package/{hover-dropdown/index.d.ts → types/smallpearl-ngx-helper-hover-dropdown.d.ts} +0 -0
- /package/{locale/index.d.ts → types/smallpearl-ngx-helper-locale.d.ts} +0 -0
- /package/{mat-busy-wheel/index.d.ts → types/smallpearl-ngx-helper-mat-busy-wheel.d.ts} +0 -0
- /package/{mat-context-menu/index.d.ts → types/smallpearl-ngx-helper-mat-context-menu.d.ts} +0 -0
- /package/{mat-entity-crud/index.d.ts → types/smallpearl-ngx-helper-mat-entity-crud.d.ts} +0 -0
- /package/{mat-entity-list/index.d.ts → types/smallpearl-ngx-helper-mat-entity-list.d.ts} +0 -0
- /package/{mat-file-input/index.d.ts → types/smallpearl-ngx-helper-mat-file-input.d.ts} +0 -0
- /package/{mat-form-error/index.d.ts → types/smallpearl-ngx-helper-mat-form-error.d.ts} +0 -0
- /package/{mat-select-infinite-scroll/index.d.ts → types/smallpearl-ngx-helper-mat-select-infinite-scroll.d.ts} +0 -0
- /package/{mat-side-menu-layout/index.d.ts → types/smallpearl-ngx-helper-mat-side-menu-layout.d.ts} +0 -0
- /package/{mat-tel-input/index.d.ts → types/smallpearl-ngx-helper-mat-tel-input.d.ts} +0 -0
- /package/{sideload/index.d.ts → types/smallpearl-ngx-helper-sideload.d.ts} +0 -0
- /package/{stationary-with-line-items/index.d.ts → types/smallpearl-ngx-helper-stationary-with-line-items.d.ts} +0 -0
|
@@ -562,10 +562,10 @@ class SPPagedEntityLoader {
|
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
566
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
565
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPPagedEntityLoader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
566
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.2", type: SPPagedEntityLoader, isStandalone: true, selector: "**spPagedEntityLoader**", inputs: { entityName: { classPropertyName: "entityName", publicName: "entityName", isSignal: true, isRequired: true, transformFunction: null }, url: { classPropertyName: "url", publicName: "url", isSignal: true, isRequired: true, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, paginator: { classPropertyName: "paginator", publicName: "paginator", isSignal: true, isRequired: false, transformFunction: null }, searchParamName: { classPropertyName: "searchParamName", publicName: "searchParamName", isSignal: true, isRequired: false, transformFunction: null }, idKey: { classPropertyName: "idKey", publicName: "idKey", isSignal: true, isRequired: false, transformFunction: null }, pluralEntityName: { classPropertyName: "pluralEntityName", publicName: "pluralEntityName", isSignal: true, isRequired: false, transformFunction: null }, httpReqContext: { classPropertyName: "httpReqContext", publicName: "httpReqContext", isSignal: true, isRequired: false, transformFunction: null }, httpParams: { classPropertyName: "httpParams", publicName: "httpParams", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
567
567
|
}
|
|
568
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPPagedEntityLoader, decorators: [{
|
|
569
569
|
type: Directive,
|
|
570
570
|
args: [{
|
|
571
571
|
selector: '**spPagedEntityLoader**',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smallpearl-ngx-helper-entities.mjs","sources":["../../../../projects/smallpearl/ngx-helper/entities/src/paged-loader.ts","../../../../projects/smallpearl/ngx-helper/entities/smallpearl-ngx-helper-entities.ts"],"sourcesContent":["import {\n HttpClient,\n HttpContext,\n HttpContextToken,\n HttpParams,\n} from '@angular/common/http';\nimport { computed, Directive, inject, input } from '@angular/core';\nimport { createStore, select, setProps, withProps } from '@ngneat/elf';\nimport { getAllEntities, getEntitiesCount, getEntity, upsertEntities, withEntities } from '@ngneat/elf-entities';\nimport { getPaginationData, setPage, skipWhilePageExists, updatePaginationData, withPagination } from '@ngneat/elf-pagination';\nimport { SP_MAT_ENTITY_LIST_CONFIG, SPMatEntityListPaginator, SPPageParams } from '@smallpearl/ngx-helper/mat-entity-list';\nimport { capitalize } from 'lodash';\nimport { plural } from 'pluralize';\nimport {\n distinctUntilChanged,\n filter,\n finalize,\n Observable,\n of,\n Subject,\n Subscription,\n switchMap,\n tap\n} from 'rxjs';\n\n/**\n * A type representing an entity loader function that takes page number,\n * page size, and an optional search value and returns an Observable of\n * the response. This is similar the http.get() method of HttpClient but\n * with pagination parameters. The return value is deliberately kept generic\n * (Observable<any>) to allow flexibility in the response type. This reponse\n * will be parsed by the provided paginator's parseRequestResponse() method.\n * So as long as the function return type and paginator are compatible,\n * any response type can be handled.\n *\n * Ideally the response should contain the total number of entities available\n * at the remote and the array of entities for the requested page.\n */\nexport type SPEntityLoaderFn = (\n page: number,\n pageSize: number,\n searchValue: string | undefined\n) => Observable<any>;\n\n/**\n * Represents a request to load entities from the remote. This is used to\n * compare two requests to determine if they are equal. This is useful to\n * prevent duplicate requests being sent to the remote.\n */\nclass LoadRequest {\n constructor(\n public endpoint: string | SPEntityLoaderFn,\n public pageNumber: number,\n public searchStr: string | undefined,\n public force = false\n ) {}\n\n // Returns true if two LoadRequest objects are equal and this object's\n // 'force' is not set to true.\n isEqualToAndNotForced(prev: LoadRequest): boolean {\n // console.log(\n // `isEqualToAndNotForced - ${this.endpoint}, ${this.params.toString()} ${\n // this.force\n // }, other: ${prev.endpoint}, ${prev.params.toString()}, ${prev.force}`\n // );\n return this.force\n ? false\n : (typeof this.endpoint === 'function' ||\n this.endpoint.localeCompare(prev.endpoint as string) === 0) &&\n this.pageNumber === prev.pageNumber &&\n this.searchStr === prev.searchStr;\n }\n}\n\ntype StateProps = {\n allEntitiesLoaded: boolean;\n loading: boolean;\n loaded: boolean\n};\n\nconst DEFAULT_STATE_PROPS: StateProps = {\n allEntitiesLoaded: false,\n loading: false,\n loaded: false\n}\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 * An abstract class that you can use wherever you would like to load entities\n * from a remote endpoint in a paged manner. Entities can be loaded in one of\n * two ways:\n *\n * 1. By providing an entityLoaderFn that takes an endpoint and HttpParams\n * and returns a Observable of entities.\n * 2. Or by providing a URL and using the default loader that uses HttpClient\n * to load entities.\n * This class uses RxJS to manage the loading of entities and provides\n * signals to track the loading state, entity count, page index, page size,\n * and whether more entities are available to load.\n *\n * How to use this class:\n *\n * 1. Dervice your component from SPPagedEntityLoader.\n * 2. After your component is initialized, call the startLoader() method to\n * get the component going. This sets up the necessary subscriptions to\n * listen for load requests. Load requests are triggered by calling the\n * loadPage() or loadNextPage() methods.\n * 3. If your component supports infinite scrolling, call loadMoreEntities()\n * method to load the next page of entities when it detects a scroll event.\n * 4. If you component needs to load a specific page (via a pagination control),\n * call the loadPage(pageNumber) method to load the specified page.\n * 5. Entities are stored in an internal entities store which is an @ngneat/elf\n * store. You can subscribe to the store's query to get the list of entities.\n * 6. When your component is destroyed, call the stopLoader() method to clean up\n * internal subscriptions.\n *\n * The class is decorated with Angular's @Directive decorator so that we can\n * use signals for the input properties and dependency injection for HttpClient.\n * There are no abstract methods as such, but the class is meant to be extended\n * by your component to provide the necessary configuration via input properties.\n * This is why it is declared as abstract.\n */\n@Directive({\n selector: '**spPagedEntityLoader**',\n})\nexport abstract class SPPagedEntityLoader<\n TEntity extends { [P in IdKey]: PropertyKey },\n IdKey extends string = 'id'\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<string, { refCount: number; resp: any }>();\n // cache keys for this instance\n cacheKeys = new Set<string>();\n\n // Current search parameter value. This is used to load entities\n // matching the search string.\n searchParamValue: string | undefined;\n\n //** REQUIRED ATTRIBUTES **//\n /**\n * Entity name, that is used to form the \"New { item }\" menu item if\n * inlineNew=true. This is also used as the key of the object in GET response\n * if the reponse JSON is an object (sideloaded response), where the values\n * are stored indexed by the server model name. For eg:-\n *\n * {\n * 'customers': [\n * {...},\n * {...},\n * {...},\n * ]\n * }\n */\n entityName = input.required<string>();\n url = input.required<string | SPEntityLoaderFn>();\n\n //** OPTIONAL ATTRIBUTES **//\n // Number of entities to be loaded per page from the server. This will be\n // passed to PagedEntityLoader to load entities in pages. Defaults to 50.\n // Adjust this accordingly based on the average size of your entities to\n // optimize server round-trips and memory usage.\n pageSize = input<number>(50);\n\n // Paginator for the remote entity list. This is used to determine the\n // pagination parameters for the API request. If not specified, the global\n // paginator specified in SPMatEntityListConfig will be used. If that too is\n // not specified, a default paginator will be used. Default paginator can\n // handle DRF native PageNumberPagination and dynamic-rest style pagination.\n paginator = input<SPMatEntityListPaginator>();\n\n // Search parameter name to be used in the HTTP request.\n // Defaults to 'search'. That is when a search string is specified and\n // the entire entity list has not been fetched, a fresh HTTP request is made\n // to the remote server with `?<searchParamName>=<search string>` parameter.\n searchParamName = input<string>('search');\n\n // Entity idKey, if idKey is different from the default 'id'.\n idKey = input<string>('id');\n\n // Plural entity name, used when grouping options. If not specified, it is\n // derived by pluralizing the entityName.\n pluralEntityName = input<string | undefined>(undefined); // defaults to pluralized entityName\n\n httpReqContext = input<\n [[HttpContextToken<any>, any]] | [HttpContextToken<any>, any] | HttpContext | undefined\n >(undefined); // defaults to empty context\n\n // Parameters to be added to the HTTP request to retrieve data from\n // remote. This won't be used if `loadFromRemoteFn` is specified.\n httpParams = input<HttpParams | undefined>(undefined); // defaults to empty params\n\n // Mechanism to default pageSize to last entities length.\n protected loadRequest$ = new Subject<LoadRequest>();\n protected sub$: Subscription | undefined;\n protected _pageSize = computed<number>(() =>\n this.pageSize() ? this.pageSize() : 50\n );\n\n protected _pluralEntityName = computed<string>(() => {\n const pluralEntityName = this.pluralEntityName();\n return pluralEntityName ? pluralEntityName : plural(this.entityName());\n });\n\n protected _capitalizedEntityName = computed<string>(() =>\n capitalize(this.entityName())\n );\n\n protected _httpReqContext = computed(() => {\n let reqContext = this.httpReqContext();\n const context = new HttpContext();\n if (reqContext instanceof HttpContext) {\n // Copy existing context values\n for (const key of reqContext.keys()) {\n context.set(key, reqContext.get(key));\n }\n } else {\n // Likely to be array of `(HttpContextToken, value)` pairs.\n if (reqContext && Array.isArray(reqContext)) {\n if (reqContext.length == 2 && !Array.isArray(reqContext[0])) {\n // one dimensional array of a key, value pair.\n context.set(reqContext[0], reqContext[1]);\n } else {\n reqContext.forEach(([k, v]) => context.set(k, v));\n }\n }\n }\n\n // Give subclasses a chance to add their own context tokens.\n this.addAddlContextTokens(context);\n\n return context;\n });\n\n entityListConfig = inject(SP_MAT_ENTITY_LIST_CONFIG, {\n optional: true,\n });\n protected _paginator = computed<SPMatEntityListPaginator>(() => {\n const paginator = this.paginator();\n const entityListConfigPaginator = this.entityListConfig\n ? (this.entityListConfig.paginator as SPMatEntityListPaginator)\n : undefined;\n return paginator\n ? paginator\n : entityListConfigPaginator\n ? entityListConfigPaginator\n : new DefaultPaginator();\n });\n\n // We create it here so that store member variable will have the correct\n // type. Unfortunately elf doesn't have a simple generic type that we can\n // use to declare the type of the store and then initialize it later.\n // We will recreate it in the constructor to have the correct idKey.\n protected store = createStore(\n { name: Math.random().toString(36).slice(2) },\n withEntities<TEntity, IdKey>({ idKey: 'id' as IdKey }),\n withProps<StateProps>(DEFAULT_STATE_PROPS),\n withPagination({\n initialPage: 0,\n })\n );\n\n protected http = inject(HttpClient);\n\n constructor() {}\n\n /**\n * Starts listening for load requests and processes them. Call this from your\n * component's ngOnInit() or ngAfterViewInit() method.\n */\n startLoader() {\n // Recreate store with the correct idKey. We have to do this after\n // the idKey is available from the constructor argument.\n const entities = this.store.query(getAllEntities());\n this.store = createStore(\n { name: Math.random().toString(36).slice(2) },\n withEntities<TEntity, IdKey>({\n initialValue: entities,\n idKey: this.idKey() as IdKey,\n }),\n withProps<StateProps>(DEFAULT_STATE_PROPS),\n withPagination({\n initialPage: 0,\n })\n );\n\n this.sub$ = this.loadRequest$\n .pipe(\n filter((lr) => lr.endpoint !== '' || lr.force === true),\n distinctUntilChanged((prev, current) =>\n current.isEqualToAndNotForced(prev)\n ),\n switchMap((lr: LoadRequest) => this.doActualLoad(lr))\n )\n .subscribe();\n }\n\n /**\n * Stops listening for load requests and cleans up subscriptions.\n */\n stopLoader() {\n if (this.sub$) {\n this.sub$.unsubscribe();\n this.sub$ = undefined;\n }\n // Remove references to this component's pages from the cache. If this\n // is the only component using those cached pages, they will be cleared\n // from the cache.\n this.removeFromCache();\n }\n\n hasStarted(): boolean {\n return this.sub$ !== undefined;\n }\n\n /**\n * Returns a boolean indicating whether all entities at the remote have been\n * loaded. All entities are considered loaded when there are no more entities\n * to load from the remote (that is all pages have been loaded without\n * a search filter).\n * @returns\n */\n allEntitiesLoaded(): boolean {\n return this.store.query((state) => state.allEntitiesLoaded);\n }\n\n /**\n * Returns the total number of entities at the remote as reported by the\n * server (or load fn) during each load.\n * @returns\n */\n totalEntitiesAtRemote(): number {\n return this.store.query(getPaginationData()).total;\n }\n\n /**\n * Returns number of entities currently stored in the internal store.\n * @returns\n */\n totalEntitiesCount(): number {\n return this.store.query(getEntitiesCount());\n }\n\n /**\n * Returns true if there are more entities to load from the remote.\n * This is computed based on the total entities count and the number of\n * entities loaded so far. For this method to work correctly, an initial\n * load must have been performed to get the total count from the remote.\n * @returns\n */\n hasMore(): boolean {\n const paginationData = this.store.query(getPaginationData());\n return (\n Object.keys(paginationData.pages).length * paginationData.perPage <\n paginationData.total\n );\n // return this.store.query((state) => state.hasMore);\n }\n\n /**\n * Returns true if a load operation is in progress. The load async operation\n * method turns the loading state to true when a load operation starts and\n * turns it to false when the operation completes.\n * @returns\n */\n loading(): boolean {\n return this.store.query((state) => state.loading);\n }\n\n /**\n * Returns the loading state as an Observable that emits when the state changes.\n * @returns\n */\n get loading$() {\n return this.store.pipe(\n select((state) => state.loading),\n distinctUntilChanged()\n );\n }\n\n /**\n * Boolean indicates whether the loader has completed at least one load\n * operation.\n */\n loaded(): boolean {\n return this.store.query((state) => state.loaded);\n }\n\n /**\n * Returns the endpoint URL if the loader was created with an endpoint.\n * If the loader was created with a loader function, an empty string is\n * returned.\n * @returns\n */\n endpoint(): string {\n return this.url() instanceof Function ? '' : (this.url() as string);\n }\n\n /**\n * Loads the specified page number of entities from the remote.\n * @param pageNumber\n */\n loadPage(pageNumber: number) {\n this.loadRequest$.next(\n new LoadRequest(this.url(), pageNumber, this.searchParamValue, false)\n );\n }\n\n /**\n * Returns the total number of pages available at the remote.\n * @returns\n */\n totalPages(): number {\n const paginationData = this.store.query(getPaginationData());\n return Math.ceil(paginationData.total / paginationData.perPage);\n }\n\n /**\n * Loads the next page of entities from the remote.\n *\n * @param searchParamValue Optional search parameter value. If specified\n * and is different from the current search parameter value, the internal\n * store is reset and entities are loaded from page 0 with the new search\n * parameter value. Otherwise, the next page of entities is loaded.\n */\n loadNextPage() {\n if (\n this.store.query(getPaginationData()).currentPage >= this.totalPages() &&\n this.loaded()\n ) {\n return;\n }\n\n const paginationData = this.store.query(getPaginationData());\n // console.log(`Loading page - forceRefresh: ${forceRefresh}, currentPage: ${paginationData.currentPage}...`);\n this.loadRequest$.next(\n new LoadRequest(\n this.url(),\n paginationData.currentPage,\n this.searchParamValue,\n false\n )\n );\n }\n\n // Sets the search parameter value to be used in subsequent loads.\n // If the search parameter value is different from the current value,\n // the internal store is reset to clear any previously loaded entities.\n setSearchParamValue(searchStr: string) {\n if (searchStr !== this.searchParamValue) {\n this.searchParamValue = searchStr;\n this.store.reset();\n }\n }\n\n setEntities(entities: TEntity[]) {\n this.store.update(upsertEntities(entities as any));\n }\n\n getEntities(): TEntity[] {\n return this.store.query(getAllEntities());\n }\n\n getEntity(id: TEntity[IdKey]): TEntity | undefined {\n return this.store.query(getEntity(id));\n }\n\n protected addAddlContextTokens(context: HttpContext): void {\n // Add any additional context tokens required for this request.\n // Note that context is a mutable object. Subclasses can override\n // this method to add their own context tokens.\n }\n\n // Does the actual loading of entities from the remote or the loader\n // function. Once loaded, the entities are stored in the internal store and\n // pagination properties are updated.\n protected doActualLoad(lr: LoadRequest) {\n const loaderFn =\n typeof this.url() === 'function'\n ? (this.url() as SPEntityLoaderFn)\n : undefined;\n let obs: Observable<any>;\n let paramsObj: any = {};\n const pageSize = this._pageSize();\n if (loaderFn) {\n obs = (loaderFn as SPEntityLoaderFn)(\n lr.pageNumber,\n pageSize,\n lr.searchStr\n );\n paramsObj = {\n page: lr.pageNumber,\n pageSize,\n };\n if (lr.searchStr) {\n paramsObj[this.searchParamName()] = lr.searchStr || '';\n }\n } else {\n // Form the HttpParams which consists of pagination params and any\n // embedded params in the URL which doesn't conflict with the page\n // params.\n const urlParts = (this.url() as string).split('?');\n const pageParams = this._paginator().getRequestPageParams(\n urlParts[0],\n lr.pageNumber,\n pageSize\n );\n if (lr.searchStr) {\n pageParams[this.searchParamName()] = lr.searchStr || '';\n }\n let httpParams = new HttpParams({ fromObject: pageParams });\n if (this.httpParams()) {\n this.httpParams()!\n .keys()\n .forEach((key) => {\n const value = this.httpParams()!.getAll(key);\n (value || []).forEach((v) => {\n httpParams = httpParams.append(key, v);\n });\n });\n }\n if (urlParts.length > 1) {\n const embeddedParams = new HttpParams({ fromString: urlParts[1] });\n embeddedParams.keys().forEach((key) => {\n const value = embeddedParams.getAll(key);\n (value || []).forEach((v) => {\n if (!httpParams.has(key)) {\n httpParams = httpParams.append(key, v);\n }\n });\n });\n }\n const cacheKey = this.getCacheKey(urlParts[0], httpParams);\n if (this.existsInCache(cacheKey)) {\n obs = of(this.getFromCache(cacheKey));\n } else {\n obs = this.http\n .get<any>(urlParts[0], {\n context: this._httpReqContext(),\n params: httpParams,\n })\n .pipe(tap((resp) => this.addToCache(cacheKey, resp)));\n }\n\n // Convert HttpParams to JS object\n httpParams.keys().forEach((key) => {\n paramsObj[key] = httpParams.get(key);\n });\n }\n\n this.store.update(\n setProps((state) => ({\n ...state,\n loading: true,\n }))\n );\n return obs.pipe(\n // skipWhilePageExistsInCacheOrCache(cacheKey, resp),\n skipWhilePageExists(this.store, lr.pageNumber),\n tap((resp) => {\n let hasMore = false;\n\n let entities: TEntity[] = [];\n let total = 0;\n\n if (Array.isArray(resp)) {\n // If the response is an array, we assume it's the array of entities.\n // Obviously, in this case, there's no pagination and therefore\n // set the total number of entities to the length of the array.\n total = resp.length;\n entities = resp;\n } else {\n const result = this._paginator().parseRequestResponse(\n this.entityName(),\n this._pluralEntityName()!,\n this.endpoint(),\n paramsObj,\n resp\n );\n total = result.total;\n entities = result.entities as unknown as TEntity[];\n }\n\n this.store.update(\n upsertEntities(entities as any),\n setProps((state) => ({\n ...state,\n totalCount: total,\n })),\n updatePaginationData({\n total: total,\n perPage: this.pageSize(),\n lastPage: lr.pageNumber,\n currentPage: lr.pageNumber + 1,\n }),\n setPage(\n lr.pageNumber,\n entities.map((e) => (e as any)[this.idKey()])\n )\n );\n }),\n finalize(() => {\n this.store.update(\n setProps((state) => ({\n ...state,\n allEntitiesLoaded: !this.hasMore() && !this.searchParamValue,\n loading: false,\n loaded: true,\n }))\n );\n })\n );\n }\n\n private existsInCache(cacheKey: string): boolean {\n return SPPagedEntityLoader._entitiesCache.has(cacheKey);\n }\n\n private getCacheKey(url: string, params?: HttpParams): string {\n if (params) {\n return `${url}?${params.toString()}`;\n }\n return url;\n }\n\n private getFromCache(cacheKey: string): any {\n if (cacheKey && SPPagedEntityLoader._entitiesCache.has(cacheKey)) {\n return SPPagedEntityLoader._entitiesCache.get(cacheKey)?.resp;\n }\n return [];\n }\n\n addToCache(cacheKey: string, resp: any) {\n if (!SPPagedEntityLoader._entitiesCache.has(cacheKey)) {\n SPPagedEntityLoader._entitiesCache.set(cacheKey, {\n refCount: 0,\n resp,\n });\n }\n const cacheEntry = SPPagedEntityLoader._entitiesCache.get(cacheKey);\n cacheEntry!.refCount += 1;\n this.cacheKeys.add(cacheKey);\n }\n\n private removeFromCache() {\n for (const cacheKey of this.cacheKeys) {\n const cacheEntry = SPPagedEntityLoader._entitiesCache.get(cacheKey);\n if (cacheEntry) {\n cacheEntry!.refCount -= 1;\n if (cacheEntry.refCount <= 0) {\n SPPagedEntityLoader._entitiesCache.delete(cacheKey);\n }\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AA4CA;;;;AAIG;AACH,MAAM,WAAW,CAAA;AAEN,IAAA,QAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,KAAA;AAJT,IAAA,WAAA,CACS,QAAmC,EACnC,UAAkB,EAClB,SAA6B,EAC7B,QAAQ,KAAK,EAAA;QAHb,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAA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,IAAA,EAAA,EAAA,eAAA,EAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,gBAAA,EAAA,EAAA,iBAAA,EAAA,kBAAA,EAAA,UAAA,EAAA,kBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,EAAA,iBAAA,EAAA,gBAAA,EAAA,UAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAHxC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,yBAAyB;AACpC,iBAAA;;;AChND;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"smallpearl-ngx-helper-entities.mjs","sources":["../../../../projects/smallpearl/ngx-helper/entities/src/paged-loader.ts","../../../../projects/smallpearl/ngx-helper/entities/smallpearl-ngx-helper-entities.ts"],"sourcesContent":["import {\n HttpClient,\n HttpContext,\n HttpContextToken,\n HttpParams,\n} from '@angular/common/http';\nimport { computed, Directive, inject, input } from '@angular/core';\nimport { createStore, select, setProps, withProps } from '@ngneat/elf';\nimport { getAllEntities, getEntitiesCount, getEntity, upsertEntities, withEntities } from '@ngneat/elf-entities';\nimport { getPaginationData, setPage, skipWhilePageExists, updatePaginationData, withPagination } from '@ngneat/elf-pagination';\nimport { SP_MAT_ENTITY_LIST_CONFIG, SPMatEntityListPaginator, SPPageParams } from '@smallpearl/ngx-helper/mat-entity-list';\nimport { capitalize } from 'lodash';\nimport { plural } from 'pluralize';\nimport {\n distinctUntilChanged,\n filter,\n finalize,\n Observable,\n of,\n Subject,\n Subscription,\n switchMap,\n tap\n} from 'rxjs';\n\n/**\n * A type representing an entity loader function that takes page number,\n * page size, and an optional search value and returns an Observable of\n * the response. This is similar the http.get() method of HttpClient but\n * with pagination parameters. The return value is deliberately kept generic\n * (Observable<any>) to allow flexibility in the response type. This reponse\n * will be parsed by the provided paginator's parseRequestResponse() method.\n * So as long as the function return type and paginator are compatible,\n * any response type can be handled.\n *\n * Ideally the response should contain the total number of entities available\n * at the remote and the array of entities for the requested page.\n */\nexport type SPEntityLoaderFn = (\n page: number,\n pageSize: number,\n searchValue: string | undefined\n) => Observable<any>;\n\n/**\n * Represents a request to load entities from the remote. This is used to\n * compare two requests to determine if they are equal. This is useful to\n * prevent duplicate requests being sent to the remote.\n */\nclass LoadRequest {\n constructor(\n public endpoint: string | SPEntityLoaderFn,\n public pageNumber: number,\n public searchStr: string | undefined,\n public force = false\n ) {}\n\n // Returns true if two LoadRequest objects are equal and this object's\n // 'force' is not set to true.\n isEqualToAndNotForced(prev: LoadRequest): boolean {\n // console.log(\n // `isEqualToAndNotForced - ${this.endpoint}, ${this.params.toString()} ${\n // this.force\n // }, other: ${prev.endpoint}, ${prev.params.toString()}, ${prev.force}`\n // );\n return this.force\n ? false\n : (typeof this.endpoint === 'function' ||\n this.endpoint.localeCompare(prev.endpoint as string) === 0) &&\n this.pageNumber === prev.pageNumber &&\n this.searchStr === prev.searchStr;\n }\n}\n\ntype StateProps = {\n allEntitiesLoaded: boolean;\n loading: boolean;\n loaded: boolean\n};\n\nconst DEFAULT_STATE_PROPS: StateProps = {\n allEntitiesLoaded: false,\n loading: false,\n loaded: false\n}\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 * An abstract class that you can use wherever you would like to load entities\n * from a remote endpoint in a paged manner. Entities can be loaded in one of\n * two ways:\n *\n * 1. By providing an entityLoaderFn that takes an endpoint and HttpParams\n * and returns a Observable of entities.\n * 2. Or by providing a URL and using the default loader that uses HttpClient\n * to load entities.\n * This class uses RxJS to manage the loading of entities and provides\n * signals to track the loading state, entity count, page index, page size,\n * and whether more entities are available to load.\n *\n * How to use this class:\n *\n * 1. Dervice your component from SPPagedEntityLoader.\n * 2. After your component is initialized, call the startLoader() method to\n * get the component going. This sets up the necessary subscriptions to\n * listen for load requests. Load requests are triggered by calling the\n * loadPage() or loadNextPage() methods.\n * 3. If your component supports infinite scrolling, call loadMoreEntities()\n * method to load the next page of entities when it detects a scroll event.\n * 4. If you component needs to load a specific page (via a pagination control),\n * call the loadPage(pageNumber) method to load the specified page.\n * 5. Entities are stored in an internal entities store which is an @ngneat/elf\n * store. You can subscribe to the store's query to get the list of entities.\n * 6. When your component is destroyed, call the stopLoader() method to clean up\n * internal subscriptions.\n *\n * The class is decorated with Angular's @Directive decorator so that we can\n * use signals for the input properties and dependency injection for HttpClient.\n * There are no abstract methods as such, but the class is meant to be extended\n * by your component to provide the necessary configuration via input properties.\n * This is why it is declared as abstract.\n */\n@Directive({\n selector: '**spPagedEntityLoader**',\n})\nexport abstract class SPPagedEntityLoader<\n TEntity extends { [P in IdKey]: PropertyKey },\n IdKey extends string = 'id'\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<string, { refCount: number; resp: any }>();\n // cache keys for this instance\n cacheKeys = new Set<string>();\n\n // Current search parameter value. This is used to load entities\n // matching the search string.\n searchParamValue: string | undefined;\n\n //** REQUIRED ATTRIBUTES **//\n /**\n * Entity name, that is used to form the \"New { item }\" menu item if\n * inlineNew=true. This is also used as the key of the object in GET response\n * if the reponse JSON is an object (sideloaded response), where the values\n * are stored indexed by the server model name. For eg:-\n *\n * {\n * 'customers': [\n * {...},\n * {...},\n * {...},\n * ]\n * }\n */\n entityName = input.required<string>();\n url = input.required<string | SPEntityLoaderFn>();\n\n //** OPTIONAL ATTRIBUTES **//\n // Number of entities to be loaded per page from the server. This will be\n // passed to PagedEntityLoader to load entities in pages. Defaults to 50.\n // Adjust this accordingly based on the average size of your entities to\n // optimize server round-trips and memory usage.\n pageSize = input<number>(50);\n\n // Paginator for the remote entity list. This is used to determine the\n // pagination parameters for the API request. If not specified, the global\n // paginator specified in SPMatEntityListConfig will be used. If that too is\n // not specified, a default paginator will be used. Default paginator can\n // handle DRF native PageNumberPagination and dynamic-rest style pagination.\n paginator = input<SPMatEntityListPaginator>();\n\n // Search parameter name to be used in the HTTP request.\n // Defaults to 'search'. That is when a search string is specified and\n // the entire entity list has not been fetched, a fresh HTTP request is made\n // to the remote server with `?<searchParamName>=<search string>` parameter.\n searchParamName = input<string>('search');\n\n // Entity idKey, if idKey is different from the default 'id'.\n idKey = input<string>('id');\n\n // Plural entity name, used when grouping options. If not specified, it is\n // derived by pluralizing the entityName.\n pluralEntityName = input<string | undefined>(undefined); // defaults to pluralized entityName\n\n httpReqContext = input<\n [[HttpContextToken<any>, any]] | [HttpContextToken<any>, any] | HttpContext | undefined\n >(undefined); // defaults to empty context\n\n // Parameters to be added to the HTTP request to retrieve data from\n // remote. This won't be used if `loadFromRemoteFn` is specified.\n httpParams = input<HttpParams | undefined>(undefined); // defaults to empty params\n\n // Mechanism to default pageSize to last entities length.\n protected loadRequest$ = new Subject<LoadRequest>();\n protected sub$: Subscription | undefined;\n protected _pageSize = computed<number>(() =>\n this.pageSize() ? this.pageSize() : 50\n );\n\n protected _pluralEntityName = computed<string>(() => {\n const pluralEntityName = this.pluralEntityName();\n return pluralEntityName ? pluralEntityName : plural(this.entityName());\n });\n\n protected _capitalizedEntityName = computed<string>(() =>\n capitalize(this.entityName())\n );\n\n protected _httpReqContext = computed(() => {\n let reqContext = this.httpReqContext();\n const context = new HttpContext();\n if (reqContext instanceof HttpContext) {\n // Copy existing context values\n for (const key of reqContext.keys()) {\n context.set(key, reqContext.get(key));\n }\n } else {\n // Likely to be array of `(HttpContextToken, value)` pairs.\n if (reqContext && Array.isArray(reqContext)) {\n if (reqContext.length == 2 && !Array.isArray(reqContext[0])) {\n // one dimensional array of a key, value pair.\n context.set(reqContext[0], reqContext[1]);\n } else {\n reqContext.forEach(([k, v]) => context.set(k, v));\n }\n }\n }\n\n // Give subclasses a chance to add their own context tokens.\n this.addAddlContextTokens(context);\n\n return context;\n });\n\n entityListConfig = inject(SP_MAT_ENTITY_LIST_CONFIG, {\n optional: true,\n });\n protected _paginator = computed<SPMatEntityListPaginator>(() => {\n const paginator = this.paginator();\n const entityListConfigPaginator = this.entityListConfig\n ? (this.entityListConfig.paginator as SPMatEntityListPaginator)\n : undefined;\n return paginator\n ? paginator\n : entityListConfigPaginator\n ? entityListConfigPaginator\n : new DefaultPaginator();\n });\n\n // We create it here so that store member variable will have the correct\n // type. Unfortunately elf doesn't have a simple generic type that we can\n // use to declare the type of the store and then initialize it later.\n // We will recreate it in the constructor to have the correct idKey.\n protected store = createStore(\n { name: Math.random().toString(36).slice(2) },\n withEntities<TEntity, IdKey>({ idKey: 'id' as IdKey }),\n withProps<StateProps>(DEFAULT_STATE_PROPS),\n withPagination({\n initialPage: 0,\n })\n );\n\n protected http = inject(HttpClient);\n\n constructor() {}\n\n /**\n * Starts listening for load requests and processes them. Call this from your\n * component's ngOnInit() or ngAfterViewInit() method.\n */\n startLoader() {\n // Recreate store with the correct idKey. We have to do this after\n // the idKey is available from the constructor argument.\n const entities = this.store.query(getAllEntities());\n this.store = createStore(\n { name: Math.random().toString(36).slice(2) },\n withEntities<TEntity, IdKey>({\n initialValue: entities,\n idKey: this.idKey() as IdKey,\n }),\n withProps<StateProps>(DEFAULT_STATE_PROPS),\n withPagination({\n initialPage: 0,\n })\n );\n\n this.sub$ = this.loadRequest$\n .pipe(\n filter((lr) => lr.endpoint !== '' || lr.force === true),\n distinctUntilChanged((prev, current) =>\n current.isEqualToAndNotForced(prev)\n ),\n switchMap((lr: LoadRequest) => this.doActualLoad(lr))\n )\n .subscribe();\n }\n\n /**\n * Stops listening for load requests and cleans up subscriptions.\n */\n stopLoader() {\n if (this.sub$) {\n this.sub$.unsubscribe();\n this.sub$ = undefined;\n }\n // Remove references to this component's pages from the cache. If this\n // is the only component using those cached pages, they will be cleared\n // from the cache.\n this.removeFromCache();\n }\n\n hasStarted(): boolean {\n return this.sub$ !== undefined;\n }\n\n /**\n * Returns a boolean indicating whether all entities at the remote have been\n * loaded. All entities are considered loaded when there are no more entities\n * to load from the remote (that is all pages have been loaded without\n * a search filter).\n * @returns\n */\n allEntitiesLoaded(): boolean {\n return this.store.query((state) => state.allEntitiesLoaded);\n }\n\n /**\n * Returns the total number of entities at the remote as reported by the\n * server (or load fn) during each load.\n * @returns\n */\n totalEntitiesAtRemote(): number {\n return this.store.query(getPaginationData()).total;\n }\n\n /**\n * Returns number of entities currently stored in the internal store.\n * @returns\n */\n totalEntitiesCount(): number {\n return this.store.query(getEntitiesCount());\n }\n\n /**\n * Returns true if there are more entities to load from the remote.\n * This is computed based on the total entities count and the number of\n * entities loaded so far. For this method to work correctly, an initial\n * load must have been performed to get the total count from the remote.\n * @returns\n */\n hasMore(): boolean {\n const paginationData = this.store.query(getPaginationData());\n return (\n Object.keys(paginationData.pages).length * paginationData.perPage <\n paginationData.total\n );\n // return this.store.query((state) => state.hasMore);\n }\n\n /**\n * Returns true if a load operation is in progress. The load async operation\n * method turns the loading state to true when a load operation starts and\n * turns it to false when the operation completes.\n * @returns\n */\n loading(): boolean {\n return this.store.query((state) => state.loading);\n }\n\n /**\n * Returns the loading state as an Observable that emits when the state changes.\n * @returns\n */\n get loading$() {\n return this.store.pipe(\n select((state) => state.loading),\n distinctUntilChanged()\n );\n }\n\n /**\n * Boolean indicates whether the loader has completed at least one load\n * operation.\n */\n loaded(): boolean {\n return this.store.query((state) => state.loaded);\n }\n\n /**\n * Returns the endpoint URL if the loader was created with an endpoint.\n * If the loader was created with a loader function, an empty string is\n * returned.\n * @returns\n */\n endpoint(): string {\n return this.url() instanceof Function ? '' : (this.url() as string);\n }\n\n /**\n * Loads the specified page number of entities from the remote.\n * @param pageNumber\n */\n loadPage(pageNumber: number) {\n this.loadRequest$.next(\n new LoadRequest(this.url(), pageNumber, this.searchParamValue, false)\n );\n }\n\n /**\n * Returns the total number of pages available at the remote.\n * @returns\n */\n totalPages(): number {\n const paginationData = this.store.query(getPaginationData());\n return Math.ceil(paginationData.total / paginationData.perPage);\n }\n\n /**\n * Loads the next page of entities from the remote.\n *\n * @param searchParamValue Optional search parameter value. If specified\n * and is different from the current search parameter value, the internal\n * store is reset and entities are loaded from page 0 with the new search\n * parameter value. Otherwise, the next page of entities is loaded.\n */\n loadNextPage() {\n if (\n this.store.query(getPaginationData()).currentPage >= this.totalPages() &&\n this.loaded()\n ) {\n return;\n }\n\n const paginationData = this.store.query(getPaginationData());\n // console.log(`Loading page - forceRefresh: ${forceRefresh}, currentPage: ${paginationData.currentPage}...`);\n this.loadRequest$.next(\n new LoadRequest(\n this.url(),\n paginationData.currentPage,\n this.searchParamValue,\n false\n )\n );\n }\n\n // Sets the search parameter value to be used in subsequent loads.\n // If the search parameter value is different from the current value,\n // the internal store is reset to clear any previously loaded entities.\n setSearchParamValue(searchStr: string) {\n if (searchStr !== this.searchParamValue) {\n this.searchParamValue = searchStr;\n this.store.reset();\n }\n }\n\n setEntities(entities: TEntity[]) {\n this.store.update(upsertEntities(entities as any));\n }\n\n getEntities(): TEntity[] {\n return this.store.query(getAllEntities());\n }\n\n getEntity(id: TEntity[IdKey]): TEntity | undefined {\n return this.store.query(getEntity(id));\n }\n\n protected addAddlContextTokens(context: HttpContext): void {\n // Add any additional context tokens required for this request.\n // Note that context is a mutable object. Subclasses can override\n // this method to add their own context tokens.\n }\n\n // Does the actual loading of entities from the remote or the loader\n // function. Once loaded, the entities are stored in the internal store and\n // pagination properties are updated.\n protected doActualLoad(lr: LoadRequest) {\n const loaderFn =\n typeof this.url() === 'function'\n ? (this.url() as SPEntityLoaderFn)\n : undefined;\n let obs: Observable<any>;\n let paramsObj: any = {};\n const pageSize = this._pageSize();\n if (loaderFn) {\n obs = (loaderFn as SPEntityLoaderFn)(\n lr.pageNumber,\n pageSize,\n lr.searchStr\n );\n paramsObj = {\n page: lr.pageNumber,\n pageSize,\n };\n if (lr.searchStr) {\n paramsObj[this.searchParamName()] = lr.searchStr || '';\n }\n } else {\n // Form the HttpParams which consists of pagination params and any\n // embedded params in the URL which doesn't conflict with the page\n // params.\n const urlParts = (this.url() as string).split('?');\n const pageParams = this._paginator().getRequestPageParams(\n urlParts[0],\n lr.pageNumber,\n pageSize\n );\n if (lr.searchStr) {\n pageParams[this.searchParamName()] = lr.searchStr || '';\n }\n let httpParams = new HttpParams({ fromObject: pageParams });\n if (this.httpParams()) {\n this.httpParams()!\n .keys()\n .forEach((key) => {\n const value = this.httpParams()!.getAll(key);\n (value || []).forEach((v) => {\n httpParams = httpParams.append(key, v);\n });\n });\n }\n if (urlParts.length > 1) {\n const embeddedParams = new HttpParams({ fromString: urlParts[1] });\n embeddedParams.keys().forEach((key) => {\n const value = embeddedParams.getAll(key);\n (value || []).forEach((v) => {\n if (!httpParams.has(key)) {\n httpParams = httpParams.append(key, v);\n }\n });\n });\n }\n const cacheKey = this.getCacheKey(urlParts[0], httpParams);\n if (this.existsInCache(cacheKey)) {\n obs = of(this.getFromCache(cacheKey));\n } else {\n obs = this.http\n .get<any>(urlParts[0], {\n context: this._httpReqContext(),\n params: httpParams,\n })\n .pipe(tap((resp) => this.addToCache(cacheKey, resp)));\n }\n\n // Convert HttpParams to JS object\n httpParams.keys().forEach((key) => {\n paramsObj[key] = httpParams.get(key);\n });\n }\n\n this.store.update(\n setProps((state) => ({\n ...state,\n loading: true,\n }))\n );\n return obs.pipe(\n // skipWhilePageExistsInCacheOrCache(cacheKey, resp),\n skipWhilePageExists(this.store, lr.pageNumber),\n tap((resp) => {\n let hasMore = false;\n\n let entities: TEntity[] = [];\n let total = 0;\n\n if (Array.isArray(resp)) {\n // If the response is an array, we assume it's the array of entities.\n // Obviously, in this case, there's no pagination and therefore\n // set the total number of entities to the length of the array.\n total = resp.length;\n entities = resp;\n } else {\n const result = this._paginator().parseRequestResponse(\n this.entityName(),\n this._pluralEntityName()!,\n this.endpoint(),\n paramsObj,\n resp\n );\n total = result.total;\n entities = result.entities as unknown as TEntity[];\n }\n\n this.store.update(\n upsertEntities(entities as any),\n setProps((state) => ({\n ...state,\n totalCount: total,\n })),\n updatePaginationData({\n total: total,\n perPage: this.pageSize(),\n lastPage: lr.pageNumber,\n currentPage: lr.pageNumber + 1,\n }),\n setPage(\n lr.pageNumber,\n entities.map((e) => (e as any)[this.idKey()])\n )\n );\n }),\n finalize(() => {\n this.store.update(\n setProps((state) => ({\n ...state,\n allEntitiesLoaded: !this.hasMore() && !this.searchParamValue,\n loading: false,\n loaded: true,\n }))\n );\n })\n );\n }\n\n private existsInCache(cacheKey: string): boolean {\n return SPPagedEntityLoader._entitiesCache.has(cacheKey);\n }\n\n private getCacheKey(url: string, params?: HttpParams): string {\n if (params) {\n return `${url}?${params.toString()}`;\n }\n return url;\n }\n\n private getFromCache(cacheKey: string): any {\n if (cacheKey && SPPagedEntityLoader._entitiesCache.has(cacheKey)) {\n return SPPagedEntityLoader._entitiesCache.get(cacheKey)?.resp;\n }\n return [];\n }\n\n addToCache(cacheKey: string, resp: any) {\n if (!SPPagedEntityLoader._entitiesCache.has(cacheKey)) {\n SPPagedEntityLoader._entitiesCache.set(cacheKey, {\n refCount: 0,\n resp,\n });\n }\n const cacheEntry = SPPagedEntityLoader._entitiesCache.get(cacheKey);\n cacheEntry!.refCount += 1;\n this.cacheKeys.add(cacheKey);\n }\n\n private removeFromCache() {\n for (const cacheKey of this.cacheKeys) {\n const cacheEntry = SPPagedEntityLoader._entitiesCache.get(cacheKey);\n if (cacheEntry) {\n cacheEntry!.refCount -= 1;\n if (cacheEntry.refCount <= 0) {\n SPPagedEntityLoader._entitiesCache.delete(cacheKey);\n }\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AA4CA;;;;AAIG;AACH,MAAM,WAAW,CAAA;AAEN,IAAA,QAAA;AACA,IAAA,UAAA;AACA,IAAA,SAAA;AACA,IAAA,KAAA;AAJT,IAAA,WAAA,CACS,QAAmC,EACnC,UAAkB,EAClB,SAA6B,EAC7B,QAAQ,KAAK,EAAA;QAHb,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,SAAS,GAAT,SAAS;QACT,IAAA,CAAA,KAAK,GAAL,KAAK;IACX;;;AAIH,IAAA,qBAAqB,CAAC,IAAiB,EAAA;;;;;;QAMrC,OAAO,IAAI,CAAC;AACV,cAAE;AACF,cAAE,CAAC,OAAO,IAAI,CAAC,QAAQ,KAAK,UAAU;gBAClC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAkB,CAAC,KAAK,CAAC;AAC1D,gBAAA,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU;AACnC,gBAAA,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS;IACzC;AACD;AAQD,MAAM,mBAAmB,GAAe;AACtC,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,MAAM,EAAE;CACT;AAED;AACA;AACA;AACA,MAAM,gBAAgB,CAAA;AACpB,IAAA,oBAAoB,CAClB,QAAgB,EAChB,IAAY,EACZ,QAAgB,EAAA;QAEhB,OAAO;YACL,IAAI,EAAE,IAAI,GAAG,CAAC;YACd,QAAQ;SACT;IACH;IAEA,oBAAoB,CAIlB,UAAkB,EAClB,gBAAwB,EACxB,QAAgB,EAChB,MAAoB,EACpB,IAAS,EAAA;AAET,QAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE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AA;AACT,oBAAA,QAAQ,EAAE,yBAAyB;AACpC,iBAAA;;;AChND;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smallpearl-ngx-helper-entity-field.mjs","sources":["../../../../projects/smallpearl/ngx-helper/entity-field/src/entity-field.ts","../../../../projects/smallpearl/ngx-helper/entity-field/src/provider.ts","../../../../projects/smallpearl/ngx-helper/entity-field/smallpearl-ngx-helper-entity-field.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"smallpearl-ngx-helper-entity-field.mjs","sources":["../../../../projects/smallpearl/ngx-helper/entity-field/src/entity-field.ts","../../../../projects/smallpearl/ngx-helper/entity-field/src/provider.ts","../../../../projects/smallpearl/ngx-helper/entity-field/smallpearl-ngx-helper-entity-field.ts"],"sourcesContent":["import { spFormatCurrency, spFormatDate } from '@smallpearl/ngx-helper/locale';\nimport { Observable, of } from 'rxjs';\nimport { SPEntityFieldSpec } from './entity-field-spec';\nimport { SPEntityFieldConfig } from './provider';\n\ntype FieldValueTypes = string | number | Date | boolean;\n\n/**\n * A class that represents a SPEntityFieldSpec<>. This is typically used\n * by the library to evaluate a SPEntityFieldSpec<> object.\n */\nexport class SPEntityField<\n TEntity extends { [P in IdKey]: PropertyKey },\n IdKey extends string = 'id',\n> {\n public _fieldSpec!: SPEntityFieldSpec<TEntity, IdKey>;\n\n constructor(\n spec: SPEntityFieldSpec<TEntity, IdKey> | string,\n public fieldConfig?: SPEntityFieldConfig,\n ) {\n if (typeof spec === 'string') {\n this._fieldSpec = {\n name: spec,\n };\n } else {\n this._fieldSpec = spec;\n }\n }\n\n get spec() {\n return this._fieldSpec;\n }\n\n /**\n * Returns the effective fieldValueOptions by merging the global field\n * options (if one has been spefified) with the local field value options.\n * @returns SPEntityFieldSpec<any>['valueOptions']\n */\n get options() {\n let globalFieldValueOptions: SPEntityFieldSpec<any>['valueOptions'] = {};\n if (\n this.fieldConfig &&\n this.fieldConfig?.fieldValueOptions &&\n this.fieldConfig.fieldValueOptions.has(this._fieldSpec.name)\n ) {\n globalFieldValueOptions = this.fieldConfig.fieldValueOptions.get(\n this._fieldSpec.name,\n );\n }\n return {\n ...globalFieldValueOptions,\n ...(this._fieldSpec?.valueOptions ?? {}),\n };\n }\n /**\n * @returns the label for the field.\n */\n label(): Observable<string> {\n const label = this._fieldSpec.label;\n if (label) {\n if (label instanceof Observable) {\n return label;\n } else {\n if (typeof label === 'string') {\n return of(label);\n }\n }\n }\n return of(this._fieldSpec.name);\n }\n\n /**\n * Given an entity, returns the value of the field matching the\n * SPEntityFieldSpec<> in fieldSpec.\n * @param entity TEntity instance which will be evaluated for\n * SPEntityFieldSpec<>.\n * @returns\n */\n value(entity: TEntity) {\n let val = undefined;\n if (!this._fieldSpec.valueFn) {\n if (\n this.fieldConfig &&\n this.fieldConfig?.fieldValueFns &&\n this.fieldConfig.fieldValueFns.has(this._fieldSpec.name)\n ) {\n val = this.fieldConfig.fieldValueFns.get(this._fieldSpec.name)!(\n entity,\n this._fieldSpec.name,\n );\n } else {\n val = (entity as any)[this._fieldSpec.name];\n }\n } else {\n val = this._fieldSpec.valueFn(entity);\n }\n const valueOptions = this.options;\n if (val instanceof Date) {\n val = spFormatDate(val);\n } else if (typeof val === 'number' && valueOptions?.isCurrency) {\n val = spFormatCurrency(val, this._fieldSpec?.valueOptions?.currency);\n } else if (typeof val === 'boolean') {\n val = val ? '✔' : '✖';\n }\n return val;\n }\n\n /**\n * If specified, will be added to the CSS classes of the field's wrapper\n * element.\n */\n get class() {\n return this._fieldSpec?.valueOptions?.class ?? '';\n }\n\n hasRouterLink(entity: TEntity) {\n return !!this._fieldSpec?.valueOptions?.routerLink;\n }\n\n getRouterLink(entity: TEntity) {\n const rl = this._fieldSpec?.valueOptions?.routerLink;\n if (rl) {\n if (typeof rl == 'function') {\n return rl(entity);\n }\n return rl;\n }\n return [];\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { SPEntityFieldSpec } from './entity-field-spec';\n\nexport type FIELD_VALUE_FN = (\n entity: any,\n fieldName: string,\n) => string | number | Date | boolean;\n\n/**\n * Global config for SPEntityField component.\n */\nexport interface SPEntityFieldConfig {\n /**\n * These are global field value functions.\n *\n * If a value function for a field is not explicitly specified, this map is\n * looked up with the field name. If an entry exists in this table, it will\n * be used to render the field's value.\n *\n * This is useful for formatting certain fields which tend to have the\n * same name across the app. For instance fields such as 'amount', 'total'\n * or 'balance'. Or 'date', 'timestamp', etc.\n */\n fieldValueFns?: Map<string, FIELD_VALUE_FN>;\n /**\n * Similar to above, but allows setting the options for certain fields\n * globally. As in the case of `fieldValueFns`, the per field specification,\n * if one exists, takes precedence over the global setting.\n */\n fieldValueOptions?: Map<string, SPEntityFieldSpec<any>['valueOptions']>;\n}\n\nexport const SP_ENTITY_FIELD_CONFIG = new InjectionToken<SPEntityFieldConfig>(\n 'SPEntityFieldConfig',\n);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAOA;;;AAGG;MACU,aAAa,CAAA;AAQf,IAAA,WAAA;AAJF,IAAA,UAAU;IAEjB,WAAA,CACE,IAAgD,EACzC,WAAiC,EAAA;QAAjC,IAAA,CAAA,WAAW,GAAX,WAAW;AAElB,QAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,IAAI,CAAC,UAAU,GAAG;AAChB,gBAAA,IAAI,EAAE,IAAI;aACX;QACH;aAAO;AACL,YAAA,IAAI,CAAC,UAAU,GAAG,IAAI;QACxB;IACF;AAEA,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,UAAU;IACxB;AAEA;;;;AAIG;AACH,IAAA,IAAI,OAAO,GAAA;QACT,IAAI,uBAAuB,GAA2C,EAAE;QACxE,IACE,IAAI,CAAC,WAAW;YAChB,IAAI,CAAC,WAAW,EAAE,iBAAiB;AACnC,YAAA,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAA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ocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
92
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HoverDropDownDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
93
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.2", type: HoverDropDownDirective, isStandalone: true, selector: "[hoverDropDown]", inputs: { hoverTrigger: { classPropertyName: "hoverTrigger", publicName: "hoverTrigger", isSignal: true, isRequired: false, transformFunction: null }, menu: { classPropertyName: "menu", publicName: "menu", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
94
94
|
}
|
|
95
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
95
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HoverDropDownDirective, decorators: [{
|
|
96
96
|
type: Directive,
|
|
97
97
|
args: [{
|
|
98
98
|
standalone: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smallpearl-ngx-helper-hover-dropdown.mjs","sources":["../../../../projects/smallpearl/ngx-helper/hover-dropdown/src/hover-dropdown.directive.ts","../../../../projects/smallpearl/ngx-helper/hover-dropdown/smallpearl-ngx-helper-hover-dropdown.ts"],"sourcesContent":["import { Directive, ElementRef, input, OnInit } from '@angular/core';\nimport { MatMenuTrigger } from '@angular/material/menu';\n\n/**\n * A directive to make a button triggered mat-menu open during mouse hover.\n * Use it like this:\n\n <button #menuTrigger=\"matMenuTrigger\"\n mat-icon-button\n [matMenuTriggerFor]=\"children\"\n hoverDropDown\n [menu]=\"children\"\n [hoverTrigger]=\"menuTrigger\">\n <mat-icon>menu</mat-icon>\n </button>\n <mat-menu #children=\"matMenu\" hasBackdrop=\"false\">\n <button mat-menu-item (click)=\"onEdit()\">Edit</button>\n <button mat-menu-item (click)=\"onDelete()\">Delete</button>\n </mat-menu>\n\n Note how hoverDropDown and [hoverTrigger] are used to wire up the button\n and the associated mat-menu to the directive. Once setup like this, the\n mat-menu will be opened whenever the mouse cursor hovers over the menu\n trigger button.\n\n Copied from:\n https://stackoverflow.com/questions/54301126/how-to-show-the-angular-material-drop-down-on-mouse-over\n */\n@Directive({\n standalone: true,\n selector: '[hoverDropDown]',\n})\nexport class HoverDropDownDirective implements OnInit {\n static _menuClicked = false;\n isInHoverBlock = false;\n\n constructor(private el: ElementRef) {}\n\n hoverTrigger = input<MatMenuTrigger|null>();\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n menu = input<any>();\n\n ngOnInit() {\n const ht = this.hoverTrigger();\n if (ht) {\n this.el.nativeElement.addEventListener('mouseenter', () => {\n if (HoverDropDownDirective._menuClicked) {\n // console.log(`menu clicked state set, ignoring mouse enter..`);\n return;\n }\n this.setHoverState(true);\n ht.openMenu();\n // KLUDGE!\n // this.menu._elementRef.nativeElement.className can return multiple\n // class names, delimited by a space. Use the first class as the\n // definitive selector for the menu. this could potentially fail in\n // new Angular Material versions if the MatMenu implementation changes.\n const openMenu = document.querySelector(\n `.mat-menu-after.${\n this.menu()._elementRef.nativeElement.className.split(' ')[0]\n }`\n );\n if (!openMenu) {\n ht.closeMenu();\n return;\n }\n openMenu.addEventListener('mouseenter', () => {\n this.setHoverState(true);\n });\n openMenu.addEventListener('mouseleave', () => {\n this.setHoverState(false);\n });\n openMenu.addEventListener('click', () => {\n // console.log(`menu clicked, setting state..`);\n HoverDropDownDirective._menuClicked = true;\n setTimeout(() => {\n // console.log(`menu clicked, clearing state..`);\n HoverDropDownDirective._menuClicked = false;\n }, 180);\n });\n });\n this.el.nativeElement.addEventListener('mouseleave', () => {\n this.setHoverState(false);\n });\n }\n }\n\n private setHoverState(isInBlock: boolean) {\n this.isInHoverBlock = isInBlock;\n if (!isInBlock) {\n this.checkHover();\n }\n }\n\n private checkHover() {\n setTimeout(() => {\n if (!this.isInHoverBlock && this.hoverTrigger()!.menuOpen) {\n this.hoverTrigger()!.closeMenu();\n }\n }, 50);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MAKU,sBAAsB,CAAA;AAIb,IAAA,EAAA;AAHpB,IAAA,OAAO,YAAY,GAAG,KAAK;IAC3B,cAAc,GAAG,KAAK;AAEtB,IAAA,WAAA,CAAoB,EAAc,EAAA;QAAd,IAAA,CAAA,EAAE,GAAF,EAAE;IAAe;IAErC,YAAY,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,cAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAuB;;IAG3C,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAO;IAEnB,QAAQ,GAAA;AACN,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE;QAC9B,IAAI,EAAE,EAAE;YACN,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAK;AACxD,gBAAA,IAAI,sBAAsB,CAAC,YAAY,EAAE;;oBAEvC;gBACF;AACA,gBAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;gBACxB,EAAE,CAAC,QAAQ,EAAE;;;;;;gBAMb,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CACrC,CAAA,gBAAA,EACE,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAC9D,CAAA,CAAE,CACH;gBACD,IAAI,CAAC,QAAQ,EAAE;oBACb,EAAE,CAAC,SAAS,EAAE;oBACd;gBACF;AACA,gBAAA,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAK;AAC3C,oBAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;AAC1B,gBAAA,CAAC,CAAC;AACF,gBAAA,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAK;AAC3C,oBAAA,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;AAC3B,gBAAA,CAAC,CAAC;AACF,gBAAA,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAK;;AAEtC,oBAAA,sBAAsB,CAAC,YAAY,GAAG,IAAI;oBAC1C,UAAU,CAAC,MAAK;;AAEd,wBAAA,sBAAsB,CAAC,YAAY,GAAG,KAAK;oBAC7C,CAAC,EAAE,GAAG,CAAC;AACT,gBAAA,CAAC,CAAC;AACJ,YAAA,CAAC,CAAC;YACF,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAK;AACxD,gBAAA,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;AAC3B,YAAA,CAAC,CAAC;QACJ;IACF;AAEQ,IAAA,aAAa,CAAC,SAAkB,EAAA;AACtC,QAAA,IAAI,CAAC,cAAc,GAAG,SAAS;QAC/B,IAAI,CAAC,SAAS,EAAE;YACd,IAAI,CAAC,UAAU,EAAE;QACnB;IACF;IAEQ,UAAU,GAAA;QAChB,UAAU,CAAC,MAAK;AACd,YAAA,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,YAAY,EAAG,CAAC,QAAQ,EAAE;AACzD,gBAAA,IAAI,CAAC,YAAY,EAAG,CAAC,SAAS,EAAE;YAClC;QACF,CAAC,EAAE,EAAE,CAAC;IACR;
|
|
1
|
+
{"version":3,"file":"smallpearl-ngx-helper-hover-dropdown.mjs","sources":["../../../../projects/smallpearl/ngx-helper/hover-dropdown/src/hover-dropdown.directive.ts","../../../../projects/smallpearl/ngx-helper/hover-dropdown/smallpearl-ngx-helper-hover-dropdown.ts"],"sourcesContent":["import { Directive, ElementRef, input, OnInit } from '@angular/core';\nimport { MatMenuTrigger } from '@angular/material/menu';\n\n/**\n * A directive to make a button triggered mat-menu open during mouse hover.\n * Use it like this:\n\n <button #menuTrigger=\"matMenuTrigger\"\n mat-icon-button\n [matMenuTriggerFor]=\"children\"\n hoverDropDown\n [menu]=\"children\"\n [hoverTrigger]=\"menuTrigger\">\n <mat-icon>menu</mat-icon>\n </button>\n <mat-menu #children=\"matMenu\" hasBackdrop=\"false\">\n <button mat-menu-item (click)=\"onEdit()\">Edit</button>\n <button mat-menu-item (click)=\"onDelete()\">Delete</button>\n </mat-menu>\n\n Note how hoverDropDown and [hoverTrigger] are used to wire up the button\n and the associated mat-menu to the directive. Once setup like this, the\n mat-menu will be opened whenever the mouse cursor hovers over the menu\n trigger button.\n\n Copied from:\n https://stackoverflow.com/questions/54301126/how-to-show-the-angular-material-drop-down-on-mouse-over\n */\n@Directive({\n standalone: true,\n selector: '[hoverDropDown]',\n})\nexport class HoverDropDownDirective implements OnInit {\n static _menuClicked = false;\n isInHoverBlock = false;\n\n constructor(private el: ElementRef) {}\n\n hoverTrigger = input<MatMenuTrigger|null>();\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n menu = input<any>();\n\n ngOnInit() {\n const ht = this.hoverTrigger();\n if (ht) {\n this.el.nativeElement.addEventListener('mouseenter', () => {\n if (HoverDropDownDirective._menuClicked) {\n // console.log(`menu clicked state set, ignoring mouse enter..`);\n return;\n }\n this.setHoverState(true);\n ht.openMenu();\n // KLUDGE!\n // this.menu._elementRef.nativeElement.className can return multiple\n // class names, delimited by a space. Use the first class as the\n // definitive selector for the menu. this could potentially fail in\n // new Angular Material versions if the MatMenu implementation changes.\n const openMenu = document.querySelector(\n `.mat-menu-after.${\n this.menu()._elementRef.nativeElement.className.split(' ')[0]\n }`\n );\n if (!openMenu) {\n ht.closeMenu();\n return;\n }\n openMenu.addEventListener('mouseenter', () => {\n this.setHoverState(true);\n });\n openMenu.addEventListener('mouseleave', () => {\n this.setHoverState(false);\n });\n openMenu.addEventListener('click', () => {\n // console.log(`menu clicked, setting state..`);\n HoverDropDownDirective._menuClicked = true;\n setTimeout(() => {\n // console.log(`menu clicked, clearing state..`);\n HoverDropDownDirective._menuClicked = false;\n }, 180);\n });\n });\n this.el.nativeElement.addEventListener('mouseleave', () => {\n this.setHoverState(false);\n });\n }\n }\n\n private setHoverState(isInBlock: boolean) {\n this.isInHoverBlock = isInBlock;\n if (!isInBlock) {\n this.checkHover();\n }\n }\n\n private checkHover() {\n setTimeout(() => {\n if (!this.isInHoverBlock && this.hoverTrigger()!.menuOpen) {\n this.hoverTrigger()!.closeMenu();\n }\n }, 50);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MAKU,sBAAsB,CAAA;AAIb,IAAA,EAAA;AAHpB,IAAA,OAAO,YAAY,GAAG,KAAK;IAC3B,cAAc,GAAG,KAAK;AAEtB,IAAA,WAAA,CAAoB,EAAc,EAAA;QAAd,IAAA,CAAA,EAAE,GAAF,EAAE;IAAe;IAErC,YAAY,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,cAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAuB;;IAG3C,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAO;IAEnB,QAAQ,GAAA;AACN,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE;QAC9B,IAAI,EAAE,EAAE;YACN,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAK;AACxD,gBAAA,IAAI,sBAAsB,CAAC,YAAY,EAAE;;oBAEvC;gBACF;AACA,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K;AACd,YAAA,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,YAAY,EAAG,CAAC,QAAQ,EAAE;AACzD,gBAAA,IAAI,CAAC,YAAY,EAAG,CAAC,SAAS,EAAE;YAClC;QACF,CAAC,EAAE,EAAE,CAAC;IACR;0HArEW,sBAAsB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;8GAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,YAAA,EAAA,EAAA,iBAAA,EAAA,cAAA,EAAA,UAAA,EAAA,cAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,iBAAiB;AAC5B,iBAAA;;;AC/BD;;AAEG;;;;"}
|
|
@@ -237,10 +237,10 @@ class SPDatePipe {
|
|
|
237
237
|
// });
|
|
238
238
|
// return dateTimeFormatter.format(date);
|
|
239
239
|
}
|
|
240
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
241
|
-
/** @nocollapse */ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
240
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
241
|
+
/** @nocollapse */ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.2", ngImport: i0, type: SPDatePipe, isStandalone: true, name: "spDate" });
|
|
242
242
|
}
|
|
243
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
243
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPDatePipe, decorators: [{
|
|
244
244
|
type: Pipe,
|
|
245
245
|
args: [{
|
|
246
246
|
standalone: true,
|
|
@@ -277,10 +277,10 @@ class SPCurrencyPipe {
|
|
|
277
277
|
transform(value, currency) {
|
|
278
278
|
return spFormatCurrency(value, currency);
|
|
279
279
|
}
|
|
280
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
281
|
-
/** @nocollapse */ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
280
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPCurrencyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
281
|
+
/** @nocollapse */ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.2", ngImport: i0, type: SPCurrencyPipe, isStandalone: true, name: "spCurrency" });
|
|
282
282
|
}
|
|
283
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPCurrencyPipe, decorators: [{
|
|
284
284
|
type: Pipe,
|
|
285
285
|
args: [{
|
|
286
286
|
name: 'spCurrency',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smallpearl-ngx-helper-locale.mjs","sources":["../../../../projects/smallpearl/ngx-helper/locale/src/providers.ts","../../../../projects/smallpearl/ngx-helper/locale/src/is-empty.ts","../../../../projects/smallpearl/ngx-helper/locale/src/format-date.ts","../../../../projects/smallpearl/ngx-helper/locale/src/date.pipe.ts","../../../../projects/smallpearl/ngx-helper/locale/src/format-currency.ts","../../../../projects/smallpearl/ngx-helper/locale/src/currency.pipe.ts","../../../../projects/smallpearl/ngx-helper/locale/smallpearl-ngx-helper-locale.ts"],"sourcesContent":["export type SPIntlDateFormat = 'short'|'medium'|'long'|'full'|'shortDate'|'mediumDate'|'longDate'|'fullDate'|'shortTime'|'mediumTime'|'longTime'|'fullTime';\n\nexport interface SPNgxI18nConfig {\n locale: string;\n currency: string;\n timezone: string;\n datetimeFormat: SPIntlDateFormat;\n}\n\n/**\n * Default mini library config.\n */\nconst DEFAULT_SP_NGX_I18N_CONFIG: SPNgxI18nConfig = {\n locale: 'en-US',\n currency: 'USD',\n timezone: 'UTC',\n datetimeFormat: 'mediumDate'\n};\n\n/**\n * The object that will hold the mini library config.\n */\nexport let _config: SPNgxI18nConfig = DEFAULT_SP_NGX_I18N_CONFIG;\n\n/**\n * Call this function update the _config dynamically as the need arises.\n * @param config\n */\nexport function setSPLocaleConfig(config: Partial<SPNgxI18nConfig>) {\n _config = {..._config, ...config };\n}\n\n/**\n * @returns Current config object.\n */\nexport function getSPLocaleConfig() {\n return _config;\n}\n","export const isEmpty = (value: any): boolean => {\n return (\n value == null || value === '' || value !== value // Check for NaN.\n );\n};\n","import { isEmpty } from \"./is-empty\";\nimport { getSPLocaleConfig, SPIntlDateFormat } from \"./providers\";\n\nconst formatOptions: Record<SPIntlDateFormat, Intl.DateTimeFormatOptions> = {\n short: {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n medium: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short'\n },\n full: {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'longOffset'\n },\n shortDate: {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n },\n mediumDate: { // Equal to the \"mediumDate\" format in Angular.\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n longDate: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n },\n fullDate: {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n },\n shortTime: {\n hour: 'numeric',\n minute: 'numeric',\n },\n mediumTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n longTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short'\n },\n fullTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'longOffset'\n },\n};\n\nexport function spFormatDate(value: Date | number | string, format?: SPIntlDateFormat, timeZone?: string) {\n if (isEmpty(value)) {\n return '';\n }\n\n const date = new Date(value);\n\n if (isNaN(date.valueOf())) {\n return '******';\n // throw new Error(`Unable to convert \"${value}\" into a date.`);\n }\n const config = getSPLocaleConfig();\n format = format ?? config.datetimeFormat;\n const validFormatStrings = Object.keys(formatOptions);\n if (!validFormatStrings.find(formatStr => formatStr === format)) {\n format = 'mediumDate';\n }\n timeZone = timeZone ?? config.timezone;\n const dateTimeFormatter = new Intl.DateTimeFormat(config.locale, {\n ...formatOptions[format],\n timeZone,\n });\n\n return dateTimeFormatter.format(date);\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { spFormatDate } from './format-date';\nimport { SPIntlDateFormat } from './providers';\n\n/**\n * An alternative to the Angular built-in `DatePipe` based on the native `Intl.DateTimeFormat` API.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat\n * https://angular.io/api/common/DatePipe\n */\n@Pipe({\n standalone: true,\n name: 'spDate',\n})\nexport class SPDatePipe implements PipeTransform {\n readonly #formatOptions: Record<SPIntlDateFormat, Intl.DateTimeFormatOptions> = {\n short: {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n medium: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short'\n },\n full: {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'longOffset'\n },\n shortDate: {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n },\n mediumDate: { // Equal to the \"mediumDate\" format in Angular.\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n longDate: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n },\n fullDate: {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n },\n shortTime: {\n hour: 'numeric',\n minute: 'numeric',\n },\n mediumTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n longTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short'\n },\n fullTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'longOffset'\n },\n };\n\n transform(\n value: Date | number | string,\n format?: SPIntlDateFormat,\n timeZone?: string\n ): string | null {\n\n return spFormatDate(value, format, timeZone);\n // if (isEmpty(value)) {\n // return '';\n // }\n\n // const date = new Date(value);\n\n // if (isNaN(date.valueOf())) {\n // return '******';\n // // throw new Error(`Unable to convert \"${value}\" into a date.`);\n // }\n // const config = getSPI18nConfig();\n // format = format ?? config.datetimeFormat;\n // timeZone = timeZone ?? config.timezone;\n // const dateTimeFormatter = new Intl.DateTimeFormat(config.locale, {\n // ...this.#formatOptions[format],\n // timeZone,\n // });\n\n // return dateTimeFormatter.format(date);\n }\n}\n","import { isEmpty } from \"./is-empty\";\nimport { getSPLocaleConfig } from \"./providers\";\n\nexport function spFormatCurrency(value: number | bigint | string, currency?: string): string | null {\n\n if (isEmpty(value)) {\n return '';\n }\n\n const number =\n typeof value === 'string' ? parseFloat(value) : (value as number);\n\n if (isNaN(number)) {\n return \"****.**\";\n // throw new Error(`\"${value}\" is not a number.`);\n }\n\n const config = getSPLocaleConfig();\n // TODO: change to community locale read from this.currentCommunity.locale\n const currencyFormatter = new Intl.NumberFormat(config.locale, {\n currency: currency ?? config.currency,\n style: 'currency',\n });\n\n return currencyFormatter.format(number);\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { spFormatCurrency } from './format-currency';\n\n/**\n * This is a replacement for Angular's native currency pipe. This uses\n * web standardized Intl.NumberFormat() API to format currency. The advantage\n * of this over Angular's version is that this pipe allows the locale and\n * currency parameters to be dynamically changed during runtime.\n */\n@Pipe({\n name: 'spCurrency',\n standalone: true,\n})\nexport class SPCurrencyPipe implements PipeTransform {\n constructor() {}\n\n transform(value: number | bigint | string, currency?: string): string | null {\n return spFormatCurrency(value, currency);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AASA;;AAEG;AACH,MAAM,0BAA0B,GAAoB;AAClD,IAAA,MAAM,EAAE,OAAO;AACf,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,cAAc,EAAE;CACjB;AAED;;AAEG;AACI,IAAI,OAAO,GAAoB;AAEtC;;;AAGG;AACG,SAAU,iBAAiB,CAAC,MAAgC,EAAA;IAChE,OAAO,GAAG,EAAC,GAAG,OAAO,EAAE,GAAG,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,KAA+B,EAAE,QAAiB,EAAA;AAC1D,QAAA,OAAO,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC;IAC1C;2HALW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA;yHAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA;;4FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAJ1B,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,YAAY;AAClB,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACZD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"smallpearl-ngx-helper-locale.mjs","sources":["../../../../projects/smallpearl/ngx-helper/locale/src/providers.ts","../../../../projects/smallpearl/ngx-helper/locale/src/is-empty.ts","../../../../projects/smallpearl/ngx-helper/locale/src/format-date.ts","../../../../projects/smallpearl/ngx-helper/locale/src/date.pipe.ts","../../../../projects/smallpearl/ngx-helper/locale/src/format-currency.ts","../../../../projects/smallpearl/ngx-helper/locale/src/currency.pipe.ts","../../../../projects/smallpearl/ngx-helper/locale/smallpearl-ngx-helper-locale.ts"],"sourcesContent":["export type SPIntlDateFormat = 'short'|'medium'|'long'|'full'|'shortDate'|'mediumDate'|'longDate'|'fullDate'|'shortTime'|'mediumTime'|'longTime'|'fullTime';\n\nexport interface SPNgxI18nConfig {\n locale: string;\n currency: string;\n timezone: string;\n datetimeFormat: SPIntlDateFormat;\n}\n\n/**\n * Default mini library config.\n */\nconst DEFAULT_SP_NGX_I18N_CONFIG: SPNgxI18nConfig = {\n locale: 'en-US',\n currency: 'USD',\n timezone: 'UTC',\n datetimeFormat: 'mediumDate'\n};\n\n/**\n * The object that will hold the mini library config.\n */\nexport let _config: SPNgxI18nConfig = DEFAULT_SP_NGX_I18N_CONFIG;\n\n/**\n * Call this function update the _config dynamically as the need arises.\n * @param config\n */\nexport function setSPLocaleConfig(config: Partial<SPNgxI18nConfig>) {\n _config = {..._config, ...config };\n}\n\n/**\n * @returns Current config object.\n */\nexport function getSPLocaleConfig() {\n return _config;\n}\n","export const isEmpty = (value: any): boolean => {\n return (\n value == null || value === '' || value !== value // Check for NaN.\n );\n};\n","import { isEmpty } from \"./is-empty\";\nimport { getSPLocaleConfig, SPIntlDateFormat } from \"./providers\";\n\nconst formatOptions: Record<SPIntlDateFormat, Intl.DateTimeFormatOptions> = {\n short: {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n medium: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short'\n },\n full: {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'longOffset'\n },\n shortDate: {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n },\n mediumDate: { // Equal to the \"mediumDate\" format in Angular.\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n longDate: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n },\n fullDate: {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n },\n shortTime: {\n hour: 'numeric',\n minute: 'numeric',\n },\n mediumTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n longTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short'\n },\n fullTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'longOffset'\n },\n};\n\nexport function spFormatDate(value: Date | number | string, format?: SPIntlDateFormat, timeZone?: string) {\n if (isEmpty(value)) {\n return '';\n }\n\n const date = new Date(value);\n\n if (isNaN(date.valueOf())) {\n return '******';\n // throw new Error(`Unable to convert \"${value}\" into a date.`);\n }\n const config = getSPLocaleConfig();\n format = format ?? config.datetimeFormat;\n const validFormatStrings = Object.keys(formatOptions);\n if (!validFormatStrings.find(formatStr => formatStr === format)) {\n format = 'mediumDate';\n }\n timeZone = timeZone ?? config.timezone;\n const dateTimeFormatter = new Intl.DateTimeFormat(config.locale, {\n ...formatOptions[format],\n timeZone,\n });\n\n return dateTimeFormatter.format(date);\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { spFormatDate } from './format-date';\nimport { SPIntlDateFormat } from './providers';\n\n/**\n * An alternative to the Angular built-in `DatePipe` based on the native `Intl.DateTimeFormat` API.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat\n * https://angular.io/api/common/DatePipe\n */\n@Pipe({\n standalone: true,\n name: 'spDate',\n})\nexport class SPDatePipe implements PipeTransform {\n readonly #formatOptions: Record<SPIntlDateFormat, Intl.DateTimeFormatOptions> = {\n short: {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n medium: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short'\n },\n full: {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'longOffset'\n },\n shortDate: {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n },\n mediumDate: { // Equal to the \"mediumDate\" format in Angular.\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n longDate: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n },\n fullDate: {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n },\n shortTime: {\n hour: 'numeric',\n minute: 'numeric',\n },\n mediumTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n longTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short'\n },\n fullTime: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'longOffset'\n },\n };\n\n transform(\n value: Date | number | string,\n format?: SPIntlDateFormat,\n timeZone?: string\n ): string | null {\n\n return spFormatDate(value, format, timeZone);\n // if (isEmpty(value)) {\n // return '';\n // }\n\n // const date = new Date(value);\n\n // if (isNaN(date.valueOf())) {\n // return '******';\n // // throw new Error(`Unable to convert \"${value}\" into a date.`);\n // }\n // const config = getSPI18nConfig();\n // format = format ?? config.datetimeFormat;\n // timeZone = timeZone ?? config.timezone;\n // const dateTimeFormatter = new Intl.DateTimeFormat(config.locale, {\n // ...this.#formatOptions[format],\n // timeZone,\n // });\n\n // return dateTimeFormatter.format(date);\n }\n}\n","import { isEmpty } from \"./is-empty\";\nimport { getSPLocaleConfig } from \"./providers\";\n\nexport function spFormatCurrency(value: number | bigint | string, currency?: string): string | null {\n\n if (isEmpty(value)) {\n return '';\n }\n\n const number =\n typeof value === 'string' ? parseFloat(value) : (value as number);\n\n if (isNaN(number)) {\n return \"****.**\";\n // throw new Error(`\"${value}\" is not a number.`);\n }\n\n const config = getSPLocaleConfig();\n // TODO: change to community locale read from this.currentCommunity.locale\n const currencyFormatter = new Intl.NumberFormat(config.locale, {\n currency: currency ?? config.currency,\n style: 'currency',\n });\n\n return currencyFormatter.format(number);\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { spFormatCurrency } from './format-currency';\n\n/**\n * This is a replacement for Angular's native currency pipe. This uses\n * web standardized Intl.NumberFormat() API to format currency. The advantage\n * of this over Angular's version is that this pipe allows the locale and\n * currency parameters to be dynamically changed during runtime.\n */\n@Pipe({\n name: 'spCurrency',\n standalone: true,\n})\nexport class SPCurrencyPipe implements PipeTransform {\n constructor() {}\n\n transform(value: number | bigint | string, currency?: string): string | null {\n return spFormatCurrency(value, currency);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AASA;;AAEG;AACH,MAAM,0BAA0B,GAAoB;AAClD,IAAA,MAAM,EAAE,OAAO;AACf,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,cAAc,EAAE;CACjB;AAED;;AAEG;AACI,IAAI,OAAO,GAAoB;AAEtC;;;AAGG;AACG,SAAU,iBAAiB,CAAC,MAAgC,EAAA;IAChE,OAAO,GAAG,EAAC,GAAG,OAAO,EAAE,GAAG,MAAM,EAAE;AACpC;AAEA;;AAEG;SACa,iBAAiB,GAAA;AAC/B,IAAA,OAAO,OAAO;AAChB;;ACrCO,MAAM,OAAO,GAAG,CAAC,KAAU,KAAa;AAC7C,IAAA,QACE,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,KAAK;;AAEpD,CAAC;;ACDD,MAAM,aAAa,GAAyD;AAC1E,IAAA,KAAK,EAAE;AACL,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,GAAG,EAAE,SAAS;AACd,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,MAAM,EAAE,SAAS;AAClB,KAAA;AACD,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,GAAG,EAAE,SAAS;AACd,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,MAAM,EAAE,SAAS;AAClB,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,GAAG,EAAE,SAAS;AACd,QAAA,IAAI,EAAE,SAA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AA,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;AACjB,QAAA,OAAO,SAAS;;IAElB;AAEA,IAAA,MAAM,MAAM,GAAG,iBAAiB,EAAE;;IAElC,MAAM,iBAAiB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE;AAC7D,QAAA,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ;AACrC,QAAA,KAAK,EAAE,UAAU;AAClB,KAAA,CAAC;AAEF,IAAA,OAAO,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC;AACzC;;ACtBA;;;;;AAKG;MAKU,cAAc,CAAA;AACzB,IAAA,WAAA,GAAA,EAAe;IAEf,SAAS,CAAC,KAA+B,EAAE,QAAiB,EAAA;AAC1D,QAAA,OAAO,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC;IAC1C;0HALW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA;wHAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA;;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAJ1B,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,YAAY;AAClB,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACZD;;AAEG;;;;"}
|
|
@@ -13,8 +13,8 @@ class SPMatBusyWheelComponent {
|
|
|
13
13
|
}
|
|
14
14
|
ngOnInit() { }
|
|
15
15
|
ngOnDestroy() { }
|
|
16
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
17
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
16
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPMatBusyWheelComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
17
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.2", type: SPMatBusyWheelComponent, isStandalone: true, selector: "sp-mat-busy-wheel", inputs: { wheelId: { classPropertyName: "wheelId", publicName: "wheelId", isSignal: true, isRequired: false, transformFunction: null }, viewport: { classPropertyName: "viewport", publicName: "viewport", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
18
18
|
<div class="busy-wheel-wrapper">
|
|
19
19
|
<span>
|
|
20
20
|
<div class="busy-wheel-container" id="{{ wheelId() }}">
|
|
@@ -30,7 +30,7 @@ class SPMatBusyWheelComponent {
|
|
|
30
30
|
</div>
|
|
31
31
|
`, isInline: true, styles: [".busy-wheel-wrapper{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;z-index:9999999;background-color:#ffffff59}.busy-wheel-container{display:flex;position:relative;top:0;height:100%;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] });
|
|
32
32
|
}
|
|
33
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
33
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPMatBusyWheelComponent, decorators: [{
|
|
34
34
|
type: Component,
|
|
35
35
|
args: [{ selector: 'sp-mat-busy-wheel', imports: [MatProgressSpinnerModule], template: `
|
|
36
36
|
<div class="busy-wheel-wrapper">
|
|
@@ -335,10 +335,10 @@ class BusyWheelService {
|
|
|
335
335
|
busyWheelStyle.remove();
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
339
|
-
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
338
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BusyWheelService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
339
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BusyWheelService, providedIn: 'root' });
|
|
340
340
|
}
|
|
341
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
341
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BusyWheelService, decorators: [{
|
|
342
342
|
type: Injectable,
|
|
343
343
|
args: [{ providedIn: 'root' }]
|
|
344
344
|
}], ctorParameters: () => [] });
|
|
@@ -511,10 +511,10 @@ class SPMatHostBusyWheelDirective extends SPMatHostBusyWheelDirectiveBase {
|
|
|
511
511
|
getRenderer2() {
|
|
512
512
|
return this.renderer2;
|
|
513
513
|
}
|
|
514
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
515
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
514
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPMatHostBusyWheelDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
515
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.2", type: SPMatHostBusyWheelDirective, isStandalone: true, selector: "[spHostBusyWheel]", inputs: { spHostBusyWheel: { classPropertyName: "spHostBusyWheel", publicName: "spHostBusyWheel", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
516
516
|
}
|
|
517
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
517
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SPMatHostBusyWheelDirective, decorators: [{
|
|
518
518
|
type: Directive,
|
|
519
519
|
args: [{
|
|
520
520
|
selector: '[spHostBusyWheel]',
|