@smallpearl/ngx-helper 0.33.50 → 20.0.2
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/core/index.d.ts +3 -1
- package/entities/index.d.ts +313 -2
- package/entity-field/index.d.ts +101 -2
- package/fesm2022/smallpearl-ngx-helper-entities.mjs +18 -18
- package/fesm2022/smallpearl-ngx-helper-entities.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs +5 -4
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-forms.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs +6 -6
- 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 +57 -31
- package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs +15 -15
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs +346 -334
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs +152 -146
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs +5 -5
- package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs +19 -19
- package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs +25 -26
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-infinite-scroll.mjs +7 -7
- package/fesm2022/smallpearl-ngx-helper-mat-select-infinite-scroll.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs +24 -24
- package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs +8 -9
- package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-sideload.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs +35 -35
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs.map +1 -1
- package/forms/index.d.ts +55 -1
- package/hover-dropdown/index.d.ts +44 -1
- package/index.d.ts +4 -5
- package/locale/index.d.ts +55 -5
- package/mat-busy-wheel/index.d.ts +165 -4
- package/mat-context-menu/index.d.ts +65 -1
- package/mat-entity-crud/index.d.ts +1075 -6
- package/mat-entity-list/index.d.ts +394 -3
- package/mat-file-input/index.d.ts +61 -1
- package/mat-form-error/index.d.ts +184 -6
- package/mat-select-entity/index.d.ts +194 -1
- package/mat-select-infinite-scroll/index.d.ts +45 -2
- package/mat-side-menu-layout/index.d.ts +180 -6
- package/mat-tel-input/index.d.ts +169 -2
- package/package.json +8 -8
- package/sideload/index.d.ts +20 -1
- package/stationary-with-line-items/index.d.ts +78 -1
- package/core/src/version.d.ts +0 -1
- package/entities/src/paged-loader.d.ts +0 -219
- package/entities/src/paginator.d.ts +0 -87
- package/entity-field/src/entity-field.d.ts +0 -70
- package/entity-field/src/provider.d.ts +0 -27
- package/forms/src/validation-error-handler.d.ts +0 -52
- package/hover-dropdown/src/hover-dropdown.directive.d.ts +0 -41
- package/locale/src/currency.pipe.d.ts +0 -14
- package/locale/src/date.pipe.d.ts +0 -14
- package/locale/src/format-currency.d.ts +0 -1
- package/locale/src/format-date.d.ts +0 -2
- package/locale/src/is-empty.d.ts +0 -1
- package/locale/src/providers.d.ts +0 -20
- package/mat-busy-wheel/src/busy-wheel-op.d.ts +0 -65
- package/mat-busy-wheel/src/busy-wheel.component.d.ts +0 -12
- package/mat-busy-wheel/src/busy-wheel.service.d.ts +0 -42
- package/mat-busy-wheel/src/host-busy-wheel.directive.d.ts +0 -35
- package/mat-context-menu/src/mat-context-menu.component.d.ts +0 -61
- package/mat-entity-crud/src/convert-context-input-to-http-context.d.ts +0 -11
- package/mat-entity-crud/src/default-config.d.ts +0 -9
- package/mat-entity-crud/src/form-view-host.component.d.ts +0 -41
- package/mat-entity-crud/src/mat-entity-crud-form-base.d.ts +0 -277
- package/mat-entity-crud/src/mat-entity-crud-internal-types.d.ts +0 -131
- package/mat-entity-crud/src/mat-entity-crud-item-action.d.ts +0 -68
- package/mat-entity-crud/src/mat-entity-crud-types.d.ts +0 -149
- package/mat-entity-crud/src/mat-entity-crud.component.d.ts +0 -366
- package/mat-entity-crud/src/preview-host.component.d.ts +0 -21
- package/mat-entity-crud/src/preview-pane.component.d.ts +0 -31
- package/mat-entity-crud/src/providers.d.ts +0 -3
- package/mat-entity-list/src/config.d.ts +0 -6
- package/mat-entity-list/src/mat-entity-list-types.d.ts +0 -128
- package/mat-entity-list/src/mat-entity-list.component.d.ts +0 -259
- package/mat-entity-list/src/providers.d.ts +0 -3
- package/mat-file-input/src/mat-file-input.component.d.ts +0 -58
- package/mat-form-error/src/locales/en.d.ts +0 -4
- package/mat-form-error/src/locales/hu.d.ts +0 -4
- package/mat-form-error/src/locales/index.d.ts +0 -5
- package/mat-form-error/src/locales/pt-br.d.ts +0 -4
- package/mat-form-error/src/locales/zh-hans.d.ts +0 -4
- package/mat-form-error/src/locales/zh-hant.d.ts +0 -4
- package/mat-form-error/src/ngx-error-list.component.d.ts +0 -9
- package/mat-form-error/src/ngx-mat-error-control.d.ts +0 -17
- package/mat-form-error/src/ngx-mat-error-def.directive.d.ts +0 -30
- package/mat-form-error/src/ngx-mat-errors-for-date-range-picker.directive.d.ts +0 -8
- package/mat-form-error/src/ngx-mat-errors.component.d.ts +0 -44
- package/mat-form-error/src/types.d.ts +0 -68
- package/mat-form-error/src/utils/coerce-to-observable.d.ts +0 -3
- package/mat-form-error/src/utils/distinct-until-error-changed.d.ts +0 -2
- package/mat-form-error/src/utils/find-error-for-control.d.ts +0 -9
- package/mat-form-error/src/utils/get-abstract-controls.d.ts +0 -3
- package/mat-form-error/src/utils/get-control-with-error.d.ts +0 -3
- package/mat-select-entity/src/mat-select-entity.component.d.ts +0 -190
- package/mat-select-infinite-scroll/src/mat-select-infinite-scroll.directive.d.ts +0 -19
- package/mat-select-infinite-scroll/src/mat-select-infinite-scroll.service.d.ts +0 -25
- package/mat-side-menu-layout/src/layout.service.d.ts +0 -23
- package/mat-side-menu-layout/src/mat-menu-layout.component.d.ts +0 -39
- package/mat-side-menu-layout/src/mat-menu-layout.module.d.ts +0 -18
- package/mat-side-menu-layout/src/mat-menu-list-item.component.d.ts +0 -36
- package/mat-side-menu-layout/src/mat-menu-pane.component.d.ts +0 -66
- package/mat-side-menu-layout/src/nav-item.d.ts +0 -10
- package/mat-tel-input/src/country-codes.d.ts +0 -5
- package/mat-tel-input/src/mat-telephone.component.d.ts +0 -129
- package/mat-tel-input/src/providers.d.ts +0 -38
- package/ngx-helper.d.ts +0 -2
- package/public-api.d.ts +0 -1
- package/sideload/src/sideload.d.ts +0 -18
- package/stationary-with-line-items/src/stationary-with-line-items.component.d.ts +0 -74
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
/**
|
|
3
|
-
* Returns an rxjs operator that would track an http request status
|
|
4
|
-
* and would use the request status to hide the global busy wheel. The wheel
|
|
5
|
-
* would be hidden when the request completes or errors.
|
|
6
|
-
*
|
|
7
|
-
* Use it like below:
|
|
8
|
-
*
|
|
9
|
-
* this.http.get<User>('https://google.com/..').pipe(
|
|
10
|
-
* trackBusyWheelStatus(),
|
|
11
|
-
* tap(user => this.user = user)
|
|
12
|
-
* ).subscribe();
|
|
13
|
-
*
|
|
14
|
-
* Note that the function internally uses a timer to delay showing the busy
|
|
15
|
-
* wheel. This helps avoid needless screen flicker that can occur when quickly
|
|
16
|
-
* showing & hiding the wheel when the network connection and server response
|
|
17
|
-
* are so good that it can exceed natural user reaction time. We set this
|
|
18
|
-
* delay to 150 milliseconds for now.
|
|
19
|
-
*
|
|
20
|
-
* @param id A string value that uniquely identities the the busy wheel host
|
|
21
|
-
* container within the page. This allows multiple busy wheels to be hosted
|
|
22
|
-
* within a page, each for a distinct network (or time-consuming) operation.
|
|
23
|
-
* This is optional and if not specified, will create a busy wheel that
|
|
24
|
-
* covers the entire app viewport.
|
|
25
|
-
* @param show A boolean value that says whether to show the wheel as
|
|
26
|
-
* part of the operator setup. If set to false, the caller is expected
|
|
27
|
-
* to have displayed the busy wheel explicitly.
|
|
28
|
-
* @param showImmediate A boolean value that decides whether to show the
|
|
29
|
-
* busy wheel immediately. If set to false (default), the busy wheel will
|
|
30
|
-
* only be shown when the HTTP request has not completed within 200ms.
|
|
31
|
-
* @param hideOnNthEmit Number of emits upon which the busy wheel is to
|
|
32
|
-
* be hidden. A value of 0 for this means the wheel is hidden only when
|
|
33
|
-
* the observable completes (errorneously or otherwise).
|
|
34
|
-
* @returns An rxjs op that can be added to the pipe() arg list.
|
|
35
|
-
*/
|
|
36
|
-
export declare function trackBusyWheelStatus(id?: string, show?: boolean, showImmediate?: boolean, hideOnNthEmit?: number): <T>(source: Observable<T>) => Observable<T>;
|
|
37
|
-
/**
|
|
38
|
-
* Show a busy wheel until the observable is complete. Busy wheel is shown is either viewport global
|
|
39
|
-
* or localized to the element with the the given id.
|
|
40
|
-
*
|
|
41
|
-
* An example use case for this operator are HTTP requests which will complete no matter
|
|
42
|
-
* what. Either successfully or with an error. Either case will mark the observer as completed.
|
|
43
|
-
*
|
|
44
|
-
* See trackBusyWheelStatus() for explanations on arguments
|
|
45
|
-
*
|
|
46
|
-
* @param id
|
|
47
|
-
* @param showImmediate
|
|
48
|
-
* @returns
|
|
49
|
-
*/
|
|
50
|
-
export declare function showBusyWheelUntilComplete(id?: string, showImmediate?: boolean): <T>(source: Observable<T>) => Observable<T>;
|
|
51
|
-
/**
|
|
52
|
-
* Show a busy wheel until the observable emits n number of values. Busy wheel is shown is
|
|
53
|
-
* either viewport global or localized to the element with the the given id.
|
|
54
|
-
*
|
|
55
|
-
* An example use case for this operator are observables that emit but which do not necessarily
|
|
56
|
-
* complete.
|
|
57
|
-
*
|
|
58
|
-
* See trackBusyWheelStatus() for explanations on arguments
|
|
59
|
-
*
|
|
60
|
-
* @param numEmits
|
|
61
|
-
* @param id
|
|
62
|
-
* @param showImmediate
|
|
63
|
-
* @returns
|
|
64
|
-
*/
|
|
65
|
-
export declare function showBusyWheelUntilEmits(numEmits: number, id?: string, showImmediate?: boolean): <T>(source: Observable<T>) => Observable<T>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ElementRef, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class SPMatBusyWheelComponent implements OnInit, OnDestroy {
|
|
4
|
-
elRef: ElementRef;
|
|
5
|
-
wheelId: import("@angular/core").InputSignal<string>;
|
|
6
|
-
viewport: import("@angular/core").InputSignal<boolean>;
|
|
7
|
-
constructor(elRef: ElementRef);
|
|
8
|
-
ngOnInit(): void;
|
|
9
|
-
ngOnDestroy(): void;
|
|
10
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SPMatBusyWheelComponent, never>;
|
|
11
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SPMatBusyWheelComponent, "sp-mat-busy-wheel", never, { "wheelId": { "alias": "wheelId"; "required": false; "isSignal": true; }; "viewport": { "alias": "viewport"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
12
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { SPMatHostBusyWheelDirective } from './host-busy-wheel.directive';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class BusyWheelService {
|
|
4
|
-
private defaultBusyWheelDir;
|
|
5
|
-
private namedBusyWheelDirs;
|
|
6
|
-
private wheelComponents;
|
|
7
|
-
static s_instance: BusyWheelService;
|
|
8
|
-
constructor();
|
|
9
|
-
static getInstance(): BusyWheelService;
|
|
10
|
-
show(id?: string): void;
|
|
11
|
-
hide(id?: string): void;
|
|
12
|
-
registerBusyWheelHost(busyWheelDir: SPMatHostBusyWheelDirective): void;
|
|
13
|
-
deregisterBusyWheelHost(busyWheelDir: SPMatHostBusyWheelDirective): void;
|
|
14
|
-
/**
|
|
15
|
-
* Creates a div fragment that hosts the busy wheel. The fragment has the following
|
|
16
|
-
* structure:
|
|
17
|
-
*
|
|
18
|
-
* <div id="id_busy-wheel_{id}">
|
|
19
|
-
* <div class="{containerClass}">
|
|
20
|
-
* <!-- <div class="busy-wheel"></div> -->
|
|
21
|
-
* <mat-spinner></mat-spinner>
|
|
22
|
-
* </div>
|
|
23
|
-
* </div>
|
|
24
|
-
* @param containerClass
|
|
25
|
-
* @param id
|
|
26
|
-
* @returns
|
|
27
|
-
*/
|
|
28
|
-
private createViewportBusyWheel;
|
|
29
|
-
/**
|
|
30
|
-
* Creates a backdrop overlay, of the same size as the container that it
|
|
31
|
-
* covers, on which the busy wheel will be positioned.
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
private createBackdrop;
|
|
35
|
-
private removeViewportBusyWheel;
|
|
36
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BusyWheelService, never>;
|
|
37
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<BusyWheelService>;
|
|
38
|
-
}
|
|
39
|
-
export declare function registerBusyWheelHost(busyWheelDir: SPMatHostBusyWheelDirective): void;
|
|
40
|
-
export declare function deregisterBusyWheelHost(busyWheelDir: SPMatHostBusyWheelDirective): void;
|
|
41
|
-
export declare function showBusyWheel(id?: string): void;
|
|
42
|
-
export declare function hideBusyWheel(id?: string): void;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { OnDestroy, OnInit, Renderer2, ViewContainerRef } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* Use this directive with a unique value assigned to it to display a busy
|
|
5
|
-
* wheel over it. This can be used as:-
|
|
6
|
-
*
|
|
7
|
-
* import {showBusyWheelUntilComplete} from '@smallpearl/ngx-helper/mat-busy-wheel';
|
|
8
|
-
*
|
|
9
|
-
* <div spHostBusyWheel='myDivBusyWheel'>
|
|
10
|
-
* ..content
|
|
11
|
-
* </div>
|
|
12
|
-
*
|
|
13
|
-
* Then in your code:
|
|
14
|
-
*
|
|
15
|
-
* obs.pipe(
|
|
16
|
-
* showBusyWheelUntilComplete('myDivBusyWheel'),
|
|
17
|
-
* tap((resp) => {
|
|
18
|
-
* ...
|
|
19
|
-
* })
|
|
20
|
-
* ).subscribe();
|
|
21
|
-
*
|
|
22
|
-
* This will cover the 'div' above when the obs is waiting to be completed.
|
|
23
|
-
* (or error). Note that you can also use the trackBusyWheelStatus() function
|
|
24
|
-
* if you want more control over the busy wheel.
|
|
25
|
-
*/
|
|
26
|
-
export declare class SPMatHostBusyWheelDirective implements OnInit, OnDestroy {
|
|
27
|
-
viewContainerRef: ViewContainerRef;
|
|
28
|
-
renderer2: Renderer2;
|
|
29
|
-
spHostBusyWheel: import("@angular/core").InputSignal<string | undefined>;
|
|
30
|
-
constructor(viewContainerRef: ViewContainerRef, renderer2: Renderer2);
|
|
31
|
-
ngOnInit(): void;
|
|
32
|
-
ngOnDestroy(): void;
|
|
33
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SPMatHostBusyWheelDirective, never>;
|
|
34
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<SPMatHostBusyWheelDirective, "[spHostBusyWheel]", never, { "spHostBusyWheel": { "alias": "spHostBusyWheel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
35
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
-
import { MatMenuTrigger } from '@angular/material/menu';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* Describes each item in the context menu.
|
|
6
|
-
*/
|
|
7
|
-
export interface SPContextMenuItem {
|
|
8
|
-
label: string;
|
|
9
|
-
icon?: string;
|
|
10
|
-
route?: string | string[];
|
|
11
|
-
role?: string;
|
|
12
|
-
disable?: (arg: any) => boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare class SPMatContextMenuComponent implements OnInit {
|
|
15
|
-
/**
|
|
16
|
-
* The menu items to display. Refer to ContextMenuItem doc for details
|
|
17
|
-
* on the menu items. This can be an array ofSPContextMenuItem objects or
|
|
18
|
-
* a function that returns an array of SPContextMenuItem objects.
|
|
19
|
-
* If it is a function, the function will be called with the contextData
|
|
20
|
-
* as the argument when the user clicks on the menu trigger button.
|
|
21
|
-
*/
|
|
22
|
-
menuItems: import("@angular/core").InputSignal<SPContextMenuItem[] | ((contextData?: any) => SPContextMenuItem[])>;
|
|
23
|
-
_menuItems: import("@angular/core").WritableSignal<SPContextMenuItem[]>;
|
|
24
|
-
/**
|
|
25
|
-
* Label to display for the context menu. If omitted will just show the
|
|
26
|
-
* menuIcon.
|
|
27
|
-
*/
|
|
28
|
-
label: import("@angular/core").InputSignal<string>;
|
|
29
|
-
/**
|
|
30
|
-
* Button icon. defaults to more_vert.
|
|
31
|
-
*/
|
|
32
|
-
menuIconName: import("@angular/core").InputSignal<string>;
|
|
33
|
-
/**
|
|
34
|
-
* By default the context menu is activated whenever the mouse cursor hovers
|
|
35
|
-
* over the button. Set this to 'true' to disable this feature.
|
|
36
|
-
*/
|
|
37
|
-
enableHover: import("@angular/core").InputSignal<boolean>;
|
|
38
|
-
/**
|
|
39
|
-
* Context data for menu item disabled callback
|
|
40
|
-
*/
|
|
41
|
-
contextData: import("@angular/core").InputSignal<any>;
|
|
42
|
-
/**
|
|
43
|
-
* enable menu backdrop
|
|
44
|
-
*/
|
|
45
|
-
hasBackdrop: import("@angular/core").InputSignal<boolean>;
|
|
46
|
-
/**
|
|
47
|
-
* Event generated when use selects an item in the context menu. This event
|
|
48
|
-
* is generated only if the context menu item does not specify a route to
|
|
49
|
-
* activate. The string event parameter is ContextMenuItem.role property
|
|
50
|
-
* value.
|
|
51
|
-
*/
|
|
52
|
-
selected: EventEmitter<string>;
|
|
53
|
-
menuTrigger: import("@angular/core").Signal<MatMenuTrigger | undefined>;
|
|
54
|
-
constructor();
|
|
55
|
-
ngOnInit(): void;
|
|
56
|
-
showMenu(): void;
|
|
57
|
-
onSelectMenuItem(item: SPContextMenuItem): void;
|
|
58
|
-
itemDisabled(menuItem: SPContextMenuItem): boolean | undefined;
|
|
59
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SPMatContextMenuComponent, never>;
|
|
60
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SPMatContextMenuComponent, "sp-mat-context-menu", never, { "menuItems": { "alias": "menuItems"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "menuIconName": { "alias": "menuIconName"; "required": false; "isSignal": true; }; "enableHover": { "alias": "enableHover"; "required": false; "isSignal": true; }; "contextData": { "alias": "contextData"; "required": false; "isSignal": true; }; "hasBackdrop": { "alias": "hasBackdrop"; "required": false; "isSignal": true; }; }, { "selected": "selected"; }, never, never, true, never>;
|
|
61
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HttpContext, HttpContextToken } from '@angular/common/http';
|
|
2
|
-
export type HttpContextInput = [[HttpContextToken<any>, any]] | [HttpContextToken<any>, any] | HttpContext;
|
|
3
|
-
/**
|
|
4
|
-
* Converts array of HttpContextToken key, value pairs to HttpContext
|
|
5
|
-
* object in argument 'context'.
|
|
6
|
-
* @param context HTTP context to which the key, value pairs are added
|
|
7
|
-
* @param reqContext HttpContextToken key, value pairs array
|
|
8
|
-
* @returns HttpContext object, with the key, value pairs added. This is
|
|
9
|
-
* the same object as the 'context' argument.
|
|
10
|
-
*/
|
|
11
|
-
export declare function convertHttpContextInputToHttpContext(context: HttpContext, reqContext: HttpContextInput): HttpContext;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SPMatEntityCrudConfig } from "./mat-entity-crud-types";
|
|
2
|
-
export declare const DefaultSPMatEntityCrudConfig: SPMatEntityCrudConfig;
|
|
3
|
-
/**
|
|
4
|
-
* To be called from an object constructor as it internally calls Angular's
|
|
5
|
-
* inject() API.
|
|
6
|
-
* @param userConfig
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
export declare function getEntityCrudConfig(): SPMatEntityCrudConfig;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { EmbeddedViewRef, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
-
import { TranslocoService } from '@jsverse/transloco';
|
|
3
|
-
import { Observable, Subscription } from 'rxjs';
|
|
4
|
-
import { SPMatEntityCrudComponentBase } from './mat-entity-crud-internal-types';
|
|
5
|
-
import { SPMatEntityCrudConfig, SPMatEntityCrudCreateEditBridge } from './mat-entity-crud-types';
|
|
6
|
-
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class FormViewHostComponent<TEntity extends {
|
|
8
|
-
[P in IdKey]: PropertyKey;
|
|
9
|
-
}, IdKey extends string = 'id'> implements SPMatEntityCrudCreateEditBridge, OnInit, OnDestroy {
|
|
10
|
-
entityCrudComponentBase: import("@angular/core").InputSignal<SPMatEntityCrudComponentBase<TEntity, IdKey>>;
|
|
11
|
-
clientViewTemplate: import("@angular/core").InputSignal<TemplateRef<any> | null>;
|
|
12
|
-
_itemLabel: import("@angular/core").Signal<Observable<string>>;
|
|
13
|
-
_itemLabelPlural: import("@angular/core").Signal<Observable<string>>;
|
|
14
|
-
entity: import("@angular/core").WritableSignal<TEntity | undefined>;
|
|
15
|
-
title: import("@angular/core").WritableSignal<Observable<string> | undefined>;
|
|
16
|
-
params: import("@angular/core").WritableSignal<any>;
|
|
17
|
-
clientFormView: EmbeddedViewRef<any> | null;
|
|
18
|
-
vc: import("@angular/core").Signal<ViewContainerRef | undefined>;
|
|
19
|
-
config: SPMatEntityCrudConfig;
|
|
20
|
-
sub$: Subscription;
|
|
21
|
-
transloco: TranslocoService;
|
|
22
|
-
constructor();
|
|
23
|
-
ngOnInit(): void;
|
|
24
|
-
ngOnDestroy(): void;
|
|
25
|
-
show(entity: TEntity | undefined, params?: any): void;
|
|
26
|
-
getEntityName(): string;
|
|
27
|
-
getIdKey(): string;
|
|
28
|
-
getEntityUrl(entityId: any): string;
|
|
29
|
-
close(cancel: boolean): void;
|
|
30
|
-
registerCanCancelEditCallback(callback: () => boolean): void;
|
|
31
|
-
create(entityValue: any): Observable<any>;
|
|
32
|
-
update(id: any, entityValue: any): Observable<any>;
|
|
33
|
-
/**
|
|
34
|
-
* Creates the client view provided via template
|
|
35
|
-
*/
|
|
36
|
-
createClientView(): void;
|
|
37
|
-
destroyClientView(): void;
|
|
38
|
-
onClose(): void;
|
|
39
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<FormViewHostComponent<any, any>, never>;
|
|
40
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FormViewHostComponent<any, any>, "sp-create-edit-entity-host", never, { "entityCrudComponentBase": { "alias": "entityCrudComponentBase"; "required": true; "isSignal": true; }; "clientViewTemplate": { "alias": "clientViewTemplate"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
41
|
-
}
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import { HttpClient, HttpContext, HttpParams } from '@angular/common/http';
|
|
2
|
-
import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
|
|
3
|
-
import { AbstractControl } from '@angular/forms';
|
|
4
|
-
import { TranslocoService } from '@jsverse/transloco';
|
|
5
|
-
import { Observable, Subscription } from 'rxjs';
|
|
6
|
-
import { HttpContextInput } from './convert-context-input-to-http-context';
|
|
7
|
-
import { SPMatEntityCrudCreateEditBridge } from './mat-entity-crud-types';
|
|
8
|
-
import * as i0 from "@angular/core";
|
|
9
|
-
/**
|
|
10
|
-
* This is a convenience base class that clients can derive from to implement
|
|
11
|
-
* their CRUD form component. Particularly this class registers the change
|
|
12
|
-
* detection hook which will be called when the user attempts to close the
|
|
13
|
-
* form's parent container pane via the Close button on the top right.
|
|
14
|
-
*
|
|
15
|
-
* This button behaves like a Cancel button in a desktop app and therefore if
|
|
16
|
-
* the user has entered any data in the form's controls, (determined by
|
|
17
|
-
* checking form.touched), then a 'Lose Changes' prompt is displayed allowing
|
|
18
|
-
* the user to cancel the closure.
|
|
19
|
-
*
|
|
20
|
-
* The `@Component` decorator is fake to keep the VSCode angular linter quiet.
|
|
21
|
-
*
|
|
22
|
-
* This class can be used in two modes:
|
|
23
|
-
*
|
|
24
|
-
* I. SPMatEntityCrudComponent mode
|
|
25
|
-
* This mode relies on a bridge interface that implements the
|
|
26
|
-
* SPMatEntityCrudCreateEditBridge interface to perform the entity
|
|
27
|
-
* load/create/update operations. This is the intended mode when the
|
|
28
|
-
* component is used as a part of the SPMatEntityCrudComponent to
|
|
29
|
-
* create/update an entity. This mode requires the following properties
|
|
30
|
-
* to be set:
|
|
31
|
-
* - entity: TEntity | TEntity[IdKey] | undefined (for create)
|
|
32
|
-
* - bridge: SPMatEntityCrudCreateEditBridge
|
|
33
|
-
*
|
|
34
|
-
* II. Standalone mode
|
|
35
|
-
* This mode does not rely on the bridge interface and the component
|
|
36
|
-
* itself performs the entity load/create/update operations. However, if
|
|
37
|
-
* the `bridge` input is set, then it will be used to close the create/edit
|
|
38
|
-
* form pane when create/update is successful.
|
|
39
|
-
*
|
|
40
|
-
* This mode requires the following properties to be set:
|
|
41
|
-
* - entity: TEntity | TEntity[IdKey] | undefined (for create)
|
|
42
|
-
* - baseUrl: string - Base URL for CRUD operations. This URL does not
|
|
43
|
-
* include the entity id. The entity id will be appended to this URL
|
|
44
|
-
* for entity load and update operations. For create operation, this
|
|
45
|
-
* URL is used as is.
|
|
46
|
-
* - entityName: string - Name of the entity, used to parse sideloaded
|
|
47
|
-
* entity responses.
|
|
48
|
-
* - httpReqContext?: HttpContextInput - Optional HTTP context to be
|
|
49
|
-
* passed to the HTTP requests. For instance, if your app has a HTTP
|
|
50
|
-
* interceptor that adds authentication tokens to the requests based
|
|
51
|
-
* on a HttpContextToken, then you can pass that token here.
|
|
52
|
-
*
|
|
53
|
-
* I. SPMatEntityCrudComponent mode:
|
|
54
|
-
*
|
|
55
|
-
* 1. Declare a FormGroup<> type as
|
|
56
|
-
*
|
|
57
|
-
* ```
|
|
58
|
-
* type MyForm = FormGroup<{
|
|
59
|
-
* name: FormControl<string>;
|
|
60
|
-
* type: FormControl<string>;
|
|
61
|
-
* notes: FormControl<string>;
|
|
62
|
-
* }>;
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* 2. Derive your form's component class from this and implement the
|
|
66
|
-
* createForm() method returing the FormGroup<> instance that matches
|
|
67
|
-
* the FormGroup concrete type above.
|
|
68
|
-
*
|
|
69
|
-
* ```
|
|
70
|
-
* class MyFormComponent extends SPMatEntityCrudFormBase<MyForm, MyEntity> {
|
|
71
|
-
* constructor() {
|
|
72
|
-
* super()
|
|
73
|
-
* }
|
|
74
|
-
* createForm() {
|
|
75
|
-
* return new FormGroup([...])
|
|
76
|
-
* }
|
|
77
|
-
* }
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* 3. If your form's value requires manipulation before being sent to the
|
|
81
|
-
* server, override `getFormValue()` method and do it there before returning
|
|
82
|
-
* the modified values.
|
|
83
|
-
*
|
|
84
|
-
* 4. Wire up the form in the template as below
|
|
85
|
-
*
|
|
86
|
-
* ```html
|
|
87
|
-
* @if (loadEntity$ | async) {
|
|
88
|
-
* <form [formGroup]='form'.. (ngSubmit)="onSubmit()">
|
|
89
|
-
* <button type="submit">Submit</button>
|
|
90
|
-
* </form>
|
|
91
|
-
* } @else {
|
|
92
|
-
* <div>Loading...</div>
|
|
93
|
-
* }
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* Here `loadEntity$` is an Observable<boolean> that upon emission of `true`
|
|
97
|
-
* indicates that the entity has been loaded from server (in case of edit)
|
|
98
|
-
* and the form is ready to be displayed. Note that if the full entity was
|
|
99
|
-
* passed in the `entity` input property, then no server load is necessary
|
|
100
|
-
* and the form will be created immediately.
|
|
101
|
-
*
|
|
102
|
-
* 5. In the parent component that hosts the SPMatEntityCrudComponent, set
|
|
103
|
-
* the `entity` and `bridge` input properties of this component to
|
|
104
|
-
* appropriate values. For instance, if your form component has the
|
|
105
|
-
* selector `app-my-entity-form`, then the parent component's template
|
|
106
|
-
* will have:
|
|
107
|
-
*
|
|
108
|
-
* ```html
|
|
109
|
-
* <sp-mat-entity-crud
|
|
110
|
-
* ...
|
|
111
|
-
* createEditFormTemplate="entityFormTemplate"
|
|
112
|
-
* ></sp-mat-entity-crud>
|
|
113
|
-
* <ng-template #entityFormTemplate let-data="data">
|
|
114
|
-
* <app-my-entity-form
|
|
115
|
-
* [entity]="data.entity"
|
|
116
|
-
* [bridge]="data.bridge"
|
|
117
|
-
* ></app-my-entity-form>
|
|
118
|
-
* </ng-template>
|
|
119
|
-
* ```
|
|
120
|
-
*
|
|
121
|
-
* II. Standalone mode
|
|
122
|
-
*
|
|
123
|
-
* 1..4. Same as above, except set the required `bridge` input to `undefined`.
|
|
124
|
-
* 5. Initialize the component's inputs `baseUrl` and `entityName` with the
|
|
125
|
-
* appropriate values. If you would like to pass additional HTTP context to
|
|
126
|
-
* the HTTP requests, then set the `httpReqContext` input as well.
|
|
127
|
-
* If the entity uses an id key other than 'id', then set the `idKey` input
|
|
128
|
-
* to the appropriate id key name.
|
|
129
|
-
* 6. If you want to retrieve the created/updated entity after the create/update
|
|
130
|
-
* operation, override the `onPostCreate()` and/or `onPostUpdate()` methods
|
|
131
|
-
* respectively.
|
|
132
|
-
*/
|
|
133
|
-
export declare abstract class SPMatEntityCrudFormBase<TFormGroup extends AbstractControl, TEntity extends {
|
|
134
|
-
[P in IdKey]: PropertyKey;
|
|
135
|
-
}, IdKey extends string = 'id'> implements OnInit, OnDestroy {
|
|
136
|
-
entity: import("@angular/core").InputSignal<TEntity | TEntity[IdKey] | undefined>;
|
|
137
|
-
bridge: import("@angular/core").InputSignal<SPMatEntityCrudCreateEditBridge | undefined>;
|
|
138
|
-
params: import("@angular/core").InputSignal<any>;
|
|
139
|
-
entityName: import("@angular/core").InputSignal<string | undefined>;
|
|
140
|
-
baseUrl: import("@angular/core").InputSignal<string | undefined>;
|
|
141
|
-
httpReqContext: import("@angular/core").InputSignal<HttpContextInput | undefined>;
|
|
142
|
-
idKey: import("@angular/core").InputSignal<string>;
|
|
143
|
-
loadEntity$: Observable<boolean>;
|
|
144
|
-
loadResponse: import("@angular/core").WritableSignal<any>;
|
|
145
|
-
_entity: import("@angular/core").WritableSignal<TEntity | undefined>;
|
|
146
|
-
sub$: Subscription;
|
|
147
|
-
_form: import("@angular/core").WritableSignal<TFormGroup | undefined>;
|
|
148
|
-
form: import("@angular/core").Signal<TFormGroup>;
|
|
149
|
-
transloco: TranslocoService;
|
|
150
|
-
cdr: ChangeDetectorRef;
|
|
151
|
-
http: HttpClient;
|
|
152
|
-
canCancelEdit: () => boolean;
|
|
153
|
-
_canCancelEdit(): boolean;
|
|
154
|
-
ngOnInit(): void;
|
|
155
|
-
ngOnDestroy(): void;
|
|
156
|
-
/**
|
|
157
|
-
* Additional parameters for loading the entity, in case this.entity() value
|
|
158
|
-
* is of type TEntity[IdKey].
|
|
159
|
-
* @returns
|
|
160
|
-
*/
|
|
161
|
-
getLoadEntityParams(): string | HttpParams;
|
|
162
|
-
/**
|
|
163
|
-
* Returns true if the entity needs to be loaded from server. The default
|
|
164
|
-
* implementation returns true if the `entity` parameter is not an object,
|
|
165
|
-
* indicating that it's of type 'TEntity[IdKey]' or is undefined. Derived
|
|
166
|
-
* classes can override this method to provide custom logic.
|
|
167
|
-
* @param entityOrId
|
|
168
|
-
* @returns Whether the entity needs to be loaded from server.
|
|
169
|
-
*/
|
|
170
|
-
loadEntityRequired(entityOrId: TEntity | TEntity[IdKey] | undefined): boolean | undefined;
|
|
171
|
-
/**
|
|
172
|
-
* Return the TEntity object from the response returned by the
|
|
173
|
-
* load() method. Typically entity load returns the actual
|
|
174
|
-
* entity object itself. In some cases, where response is sideloaded, the
|
|
175
|
-
* default implementation here uses the `sideloadToComposite()` utility to
|
|
176
|
-
* extract the entity from the response after merging (inplace) the
|
|
177
|
-
* sideloaded data into a composite.
|
|
178
|
-
*
|
|
179
|
-
* If you have a different response shape, or if your sideloaded object
|
|
180
|
-
* response requires custom custom `sideloadDataMap`, override this method
|
|
181
|
-
* and implement your custom logic to extract the TEntity object from the
|
|
182
|
-
* response.
|
|
183
|
-
* @param resp
|
|
184
|
-
* @returns
|
|
185
|
-
*/
|
|
186
|
-
getEntityFromLoadResponse(resp: any): TEntity | undefined;
|
|
187
|
-
/**
|
|
188
|
-
* Create the TFormGroup FormGroup class that will be used for the reactive
|
|
189
|
-
* form.
|
|
190
|
-
* @param entity
|
|
191
|
-
*/
|
|
192
|
-
abstract createForm(entity: TEntity | undefined): TFormGroup;
|
|
193
|
-
/**
|
|
194
|
-
* Override to customize the id key name if it's not 'id'
|
|
195
|
-
* @returns The name of the unique identifier key that will be used to
|
|
196
|
-
* extract the entity's id for UPDATE operation.
|
|
197
|
-
*/
|
|
198
|
-
getIdKey(): string;
|
|
199
|
-
getBusyWheelName(): string;
|
|
200
|
-
/**
|
|
201
|
-
* Return the form's value to be sent to server as Create/Update CRUD
|
|
202
|
-
* operation data.
|
|
203
|
-
* @returns
|
|
204
|
-
*/
|
|
205
|
-
getFormValue(): any;
|
|
206
|
-
onSubmit(): void;
|
|
207
|
-
/**
|
|
208
|
-
* Reset the form to its initial state. This is a generic implementation
|
|
209
|
-
* that recursively resets all FormGroup and FormArray controls.
|
|
210
|
-
*/
|
|
211
|
-
onReset(): void;
|
|
212
|
-
onPostCreate(entity: TEntity): void;
|
|
213
|
-
onPostUpdate(entity: TEntity): void;
|
|
214
|
-
/**
|
|
215
|
-
* Loads the entity if `this.entity()` is of type TEntity[IdKey]. If `bridge`
|
|
216
|
-
* input is defined, then it's `loadEntity()` method is used to load the
|
|
217
|
-
* entity. Otherwise, then this method attempts to load the entity using
|
|
218
|
-
* HTTP GET from the URL derived from `baseUrl` input.
|
|
219
|
-
* @param entityOrId Can be full entity or just the entity id.
|
|
220
|
-
* @returns
|
|
221
|
-
*/
|
|
222
|
-
load(entityOrId: any): Observable<TEntity>;
|
|
223
|
-
/**
|
|
224
|
-
* Loads the entity using HTTP GET from the URL derived from `baseUrl` input.
|
|
225
|
-
*/
|
|
226
|
-
protected loadEntity(entityId: any): Observable<TEntity>;
|
|
227
|
-
/**
|
|
228
|
-
* Create a new entity using the bridge if defined, otherwise using HTTP
|
|
229
|
-
* POST to the `baseUrl`.
|
|
230
|
-
* @param values
|
|
231
|
-
* @returns
|
|
232
|
-
*/
|
|
233
|
-
protected create(values: any): Observable<TEntity>;
|
|
234
|
-
protected createEntity(values: any): Observable<TEntity>;
|
|
235
|
-
/**
|
|
236
|
-
* Update an existing entity using the bridge if defined, otherwise using HTTP
|
|
237
|
-
* PATCH to the URL derived from `baseUrl` and the entity id.
|
|
238
|
-
* @param id
|
|
239
|
-
* @param values
|
|
240
|
-
* @returns
|
|
241
|
-
*/
|
|
242
|
-
protected update(id: any, values: any): Observable<TEntity>;
|
|
243
|
-
protected updateEntity(id: any, values: any): Observable<TEntity>;
|
|
244
|
-
/**
|
|
245
|
-
* Override to get the standalone mode indicator. Standalone mode is
|
|
246
|
-
* when both `baseUrl` and `entityName` inputs are defined. This is indication
|
|
247
|
-
* that the component should perform the CRUD operations itself instead
|
|
248
|
-
* of relying on the `bridge` input.
|
|
249
|
-
* @returns
|
|
250
|
-
*/
|
|
251
|
-
protected getStandaloneMode(): boolean;
|
|
252
|
-
/**
|
|
253
|
-
* Wrapper around entityName input to get the entity name. If `bridge` input
|
|
254
|
-
* is defined, then its `getEntityName()` method is used. This allows
|
|
255
|
-
* derived classes to override this method to provide custom logic to
|
|
256
|
-
* determine the entity name.
|
|
257
|
-
* @returns
|
|
258
|
-
*/
|
|
259
|
-
protected getEntityName(): string | undefined;
|
|
260
|
-
/**
|
|
261
|
-
* Returns the baseUrl. Derived classes can override this to provide custom
|
|
262
|
-
* logic to determine the baseUrl.
|
|
263
|
-
* @returns
|
|
264
|
-
*/
|
|
265
|
-
protected getBaseUrl(): string | undefined;
|
|
266
|
-
/**
|
|
267
|
-
* Returns the entity URL for the given entity id. If `bridge` input is
|
|
268
|
-
* defined, then its `getEntityUrl()` method is used. Otherwise, the URL is
|
|
269
|
-
* derived from `baseUrl` input.
|
|
270
|
-
* @param entityId
|
|
271
|
-
* @returns
|
|
272
|
-
*/
|
|
273
|
-
protected getEntityUrl(entityId: any): string;
|
|
274
|
-
protected getRequestContext(): HttpContext;
|
|
275
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SPMatEntityCrudFormBase<any, any, any>, never>;
|
|
276
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SPMatEntityCrudFormBase<any, any, any>, "_#_sp-mat-entity-crud-form-base_#_", never, { "entity": { "alias": "entity"; "required": false; "isSignal": true; }; "bridge": { "alias": "bridge"; "required": false; "isSignal": true; }; "params": { "alias": "params"; "required": false; "isSignal": true; }; "entityName": { "alias": "entityName"; "required": false; "isSignal": true; }; "baseUrl": { "alias": "baseUrl"; "required": false; "isSignal": true; }; "httpReqContext": { "alias": "httpReqContext"; "required": false; "isSignal": true; }; "idKey": { "alias": "idKey"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
277
|
-
}
|