@smallpearl/ngx-helper 0.33.49 → 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 +347 -359
- 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 +14 -14
- 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 -43
- 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 -138
- 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 -158
- package/mat-entity-crud/src/mat-entity-crud.component.d.ts +0 -367
- 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,138 +0,0 @@
|
|
|
1
|
-
import { HttpParams } from "@angular/common/http";
|
|
2
|
-
import { SPContextMenuItem } from "@smallpearl/ngx-helper/mat-context-menu";
|
|
3
|
-
import { Observable } from "rxjs";
|
|
4
|
-
export declare const ITEM_ACTION_UPDATE = "_update_";
|
|
5
|
-
export declare const ITEM_ACTION_DELETE = "_delete_";
|
|
6
|
-
/**
|
|
7
|
-
* SPMatEntityCrudCreateEditBridge implementer uses this interface to
|
|
8
|
-
* communicate with the parent SPMatEntityCreateComponent. The bridge
|
|
9
|
-
* component would use the hideCreateEdit() to close itself, when user cancels
|
|
10
|
-
* the create/edit operation.
|
|
11
|
-
*/
|
|
12
|
-
export interface SPMatEntityCrudComponentBase<TEntity extends {
|
|
13
|
-
[P in IdKey]: PropertyKey;
|
|
14
|
-
}, IdKey extends string = 'id'> {
|
|
15
|
-
/**
|
|
16
|
-
* Wrappers around entityName & entityNamePlural properties.
|
|
17
|
-
*/
|
|
18
|
-
getEntityName(): string;
|
|
19
|
-
getEntityNamePlural(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Wrapper around idKey property.
|
|
22
|
-
*/
|
|
23
|
-
getIdKey(): string;
|
|
24
|
-
/**
|
|
25
|
-
* This method should return the entity URL for the given entity id.
|
|
26
|
-
* The entity URL should include any additional query parameters that were
|
|
27
|
-
* passed to the SPMatEntityCrudComponentBase component's `url` property.
|
|
28
|
-
* @param id
|
|
29
|
-
*/
|
|
30
|
-
getEntityUrl(id: TEntity[IdKey] | undefined): string;
|
|
31
|
-
/**
|
|
32
|
-
* FormViewHostComponent will call this to close the Create/Edit pane.
|
|
33
|
-
* SPMatEntityCrudComponentBase implementor will destroy the client form
|
|
34
|
-
* view and hide the Create/Edit form view pane and show the hidden
|
|
35
|
-
* entity list view.
|
|
36
|
-
* @returns
|
|
37
|
-
*/
|
|
38
|
-
closeCreateEdit: (cancelled: boolean) => void;
|
|
39
|
-
/**
|
|
40
|
-
* Used internally by FormViewHostComponent to determine if the client form
|
|
41
|
-
* view wants to intercept user's cancel the create/edit operation. Perhaps
|
|
42
|
-
* with the Yes/No prompt 'Lose changes?'
|
|
43
|
-
* @returns boolean indicating it's okay to cancel the create/edit operation.
|
|
44
|
-
*/
|
|
45
|
-
canCancelEdit: () => boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Client form view can register a callback that will be invoked by the
|
|
48
|
-
* framework when user cancels the create/edit operation by clicking on the
|
|
49
|
-
* close button on the top right.
|
|
50
|
-
* @param callback
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
53
|
-
registerCanCancelEditCallback: (callback: () => boolean) => void;
|
|
54
|
-
/**
|
|
55
|
-
* Initiates update on the given entity.
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
58
|
-
triggerEntityUpdate: (entity: TEntity) => void;
|
|
59
|
-
/**
|
|
60
|
-
* Initiates entity delete.
|
|
61
|
-
* @returns
|
|
62
|
-
*/
|
|
63
|
-
triggerEntityDelete: (entity: TEntity) => void;
|
|
64
|
-
/**
|
|
65
|
-
* Called by client form-view host component to close a new entity.
|
|
66
|
-
* @param entityValue The ReactiveForm.value object that the server expects
|
|
67
|
-
* to create a new object.
|
|
68
|
-
* @returns The new Entity object returned by the server. For typical REST
|
|
69
|
-
* API, this would be of the same shape as the objects returned by the
|
|
70
|
-
* REST's GET request.
|
|
71
|
-
*/
|
|
72
|
-
create: (entityValue: any) => Observable<any>;
|
|
73
|
-
/**
|
|
74
|
-
* Called by client form-view host component to close a new entity.
|
|
75
|
-
* @param id The id of the entity being edited.
|
|
76
|
-
* @param entityValue The ReactiveForm.value object that the server expects
|
|
77
|
-
* to update the new object.
|
|
78
|
-
* @returns The new Entity object returned by the server. For typical REST
|
|
79
|
-
* API, this would be of the same shape as the objects returned by the
|
|
80
|
-
* REST's GET request.
|
|
81
|
-
*/
|
|
82
|
-
update: (id: any, entityValue: any) => Observable<any>;
|
|
83
|
-
/**
|
|
84
|
-
* Load the entity with the given id from server.
|
|
85
|
-
* @param id The id of the entity to load.
|
|
86
|
-
* @param params Additional parameters for loading the entity.
|
|
87
|
-
* @returns An observable of the loaded entity.
|
|
88
|
-
*/
|
|
89
|
-
loadEntity: (id: any, params: string | HttpParams) => Observable<TEntity>;
|
|
90
|
-
/**
|
|
91
|
-
* Close the preview pane.
|
|
92
|
-
* @returns
|
|
93
|
-
*/
|
|
94
|
-
closePreview: () => void;
|
|
95
|
-
/**
|
|
96
|
-
* Returns the context menu items for the entity. This can be used to build
|
|
97
|
-
* the context menu for an entity in its preview pane toolbar.
|
|
98
|
-
* @returns
|
|
99
|
-
*/
|
|
100
|
-
getItemActions(entity?: TEntity): SPContextMenuItem[];
|
|
101
|
-
/**
|
|
102
|
-
* Returns the class to be used for the preview pane content. This interface
|
|
103
|
-
* is provided to allow the PreviewPaneComponent to access the client
|
|
104
|
-
* configured class for the preview pane content.
|
|
105
|
-
*/
|
|
106
|
-
getPreviewPaneContentClass(): string;
|
|
107
|
-
getFormPaneWrapperClass(): string;
|
|
108
|
-
getFormPaneContentClass(): string;
|
|
109
|
-
getItemLabel(): string | Observable<string>;
|
|
110
|
-
getItemLabelPlural(): string | Observable<string>;
|
|
111
|
-
removeEntity(id: TEntity[IdKey]): void;
|
|
112
|
-
/**
|
|
113
|
-
* Update the entity with the given id in the list of entities.
|
|
114
|
-
* This is typically called by the client when it has performed an update
|
|
115
|
-
* on the entity itself and want to reflect the resulting changed
|
|
116
|
-
* entity in the list view.
|
|
117
|
-
*
|
|
118
|
-
* @param id The id of the entity to update.
|
|
119
|
-
* @param data The updated entity.
|
|
120
|
-
*/
|
|
121
|
-
updateEntity(id: TEntity[IdKey], data: TEntity): void;
|
|
122
|
-
/**
|
|
123
|
-
* Perform a custom action on the entity endpoint. The action is specified
|
|
124
|
-
* by the verb argument, which will be used to derive the final URL. This
|
|
125
|
-
* is keeping in line with DRF specification where viewsets can define
|
|
126
|
-
* custom action methods, which translate into endpoints with the same name
|
|
127
|
-
* ast he action method.
|
|
128
|
-
* @param id id of the entity to perform the action on.
|
|
129
|
-
* @param verb The action verb, which will be appended to the entity URL to
|
|
130
|
-
* derive the final URL for the POST request.
|
|
131
|
-
* @param addlParams additional query parameters to include in the request.
|
|
132
|
-
* Called `additional` as these are in addition to the query params specified
|
|
133
|
-
* in the CRUD's endpoint.
|
|
134
|
-
* @param data the data to send with the request for the POST
|
|
135
|
-
* @returns Observable<TEntity>
|
|
136
|
-
*/
|
|
137
|
-
doEntityAction(id: TEntity[IdKey], verb: string, addlParams: HttpParams, data: any, busyWheelName: string): Observable<any>;
|
|
138
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { HttpParams } from "@angular/common/http";
|
|
2
|
-
import { SPContextMenuItem } from "@smallpearl/ngx-helper/mat-context-menu";
|
|
3
|
-
/**
|
|
4
|
-
* Describes an action on an item in the MatEntityCrud component. Actions are
|
|
5
|
-
* shown in the context menu for each entity in the MatEntityCrud component.
|
|
6
|
-
* The action is triggered when the user selects the corresponding menu item.
|
|
7
|
-
* There are two ways to handle the action when it is triggered (user selects
|
|
8
|
-
* the corresponding menu item):
|
|
9
|
-
*
|
|
10
|
-
* 1. If the action's 'role' property is one of the predefined roles
|
|
11
|
-
* ('_edit_', '_view_', '_delete_'), the MatEntityCrud component handles
|
|
12
|
-
* the action internally by opening the corresponding dialog (edit/view)
|
|
13
|
-
* or performing the delete operation.
|
|
14
|
-
* 2. If the action maps to a HTTP REST API endpoint on the item at the server,
|
|
15
|
-
* the MatEntityCrud component can perform the HTTP request. To enable this,
|
|
16
|
-
* the application must set the action's 'behavior' property to 'http' and
|
|
17
|
-
* if the REST request differs from the default POST to the entity's base URL
|
|
18
|
-
* with the action's 'role' appended as the URL path, provide the necessary
|
|
19
|
-
* HTTP request parameters in the 'httpRequestParameters' property.
|
|
20
|
-
* 3. For all other actions, the MatEntityCrud component emits an 'action'
|
|
21
|
-
* event with the action's 'role' and the entity as arguments. The
|
|
22
|
-
* application can listen to this event and handle the action as needed.
|
|
23
|
-
*
|
|
24
|
-
* @template TEntity The type of the entity on which the action is performed.
|
|
25
|
-
*/
|
|
26
|
-
export interface MatEntityCrudItemAction<TEntity extends {
|
|
27
|
-
[P in IdKey]: PropertyKey;
|
|
28
|
-
}, IdKey extends string = 'id'> extends SPContextMenuItem {
|
|
29
|
-
/**
|
|
30
|
-
* Optional confirmation prompt message to be shown to the user
|
|
31
|
-
* before performing the action. If specified, the user must confirm
|
|
32
|
-
* the action before it is executed.
|
|
33
|
-
*/
|
|
34
|
-
confirmPrompt?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Optional message to be shown to the user after the action is
|
|
37
|
-
* successfully performed.
|
|
38
|
-
*/
|
|
39
|
-
successMessage?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Optional error message to be shown to the user if the action fails.
|
|
42
|
-
*/
|
|
43
|
-
errorMessage?: string;
|
|
44
|
-
/**
|
|
45
|
-
* HTTP request parameters for actions that map to HTTP REST API
|
|
46
|
-
* endpoints on the item at the server. This property is used when
|
|
47
|
-
* 'actionBehavior' is set to 'http'.
|
|
48
|
-
*
|
|
49
|
-
* If not specified, and behavior is set to 'http', a POST request is
|
|
50
|
-
* made to the entity's base URL with the action's 'role' appended
|
|
51
|
-
* as the URL path.
|
|
52
|
-
*/
|
|
53
|
-
httpRequestParameters?: {
|
|
54
|
-
method: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
55
|
-
urlPath?: string;
|
|
56
|
-
params?: HttpParams;
|
|
57
|
-
body?: any;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Custom handler function to be called when the action is triggered.
|
|
61
|
-
* If provided, this function is called instead of the default handling
|
|
62
|
-
* by the MatEntityCrud component. This property takes precedence over
|
|
63
|
-
* `httpRequestParameters`.
|
|
64
|
-
*
|
|
65
|
-
* @param entity The entity on which the action is performed.
|
|
66
|
-
*/
|
|
67
|
-
action?: (entity: TEntity) => void;
|
|
68
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { HttpContextToken, HttpParams } from "@angular/common/http";
|
|
2
|
-
import { SPContextMenuItem } from "@smallpearl/ngx-helper/mat-context-menu";
|
|
3
|
-
import { Observable } from "rxjs";
|
|
4
|
-
/**
|
|
5
|
-
* Prototype of the function to parse the CRUD action response.
|
|
6
|
-
*/
|
|
7
|
-
export type SPMatEntityCrudResponseParser = (entityName: string, idKey: string, method: string, // 'create' | 'retrieve' | 'update' | 'delete',
|
|
8
|
-
resp: any) => any | undefined;
|
|
9
|
-
/**
|
|
10
|
-
* Global config for SPMatEntityList component.
|
|
11
|
-
*/
|
|
12
|
-
export interface SPMatEntityCrudConfig {
|
|
13
|
-
/**
|
|
14
|
-
* The item actions that will be shown for each item in the list.
|
|
15
|
-
* This defaults to 'Update' & 'Delete' actions, but can be customized
|
|
16
|
-
* by this property. Note the item actions can be set for individual
|
|
17
|
-
* <sp-mat-entity-crud> component through its itemActions property.
|
|
18
|
-
*/
|
|
19
|
-
defaultItemActions?: SPContextMenuItem[];
|
|
20
|
-
/**
|
|
21
|
-
* Global crud response parser.
|
|
22
|
-
*/
|
|
23
|
-
crudOpResponseParser?: SPMatEntityCrudResponseParser;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* This is the interface through which the client provided CRUD form component
|
|
27
|
-
* interacts with the 'host' SPMatEntityCrudComponent. When the form wants to
|
|
28
|
-
* submit an entity to the server (for create or update), it should call the
|
|
29
|
-
* one of the create or update methods. The interface also provides other
|
|
30
|
-
* methods for the form component to interact with SPMatEntityCrudComponent
|
|
31
|
-
* such as refresh its entities list, close the form pane, etc.
|
|
32
|
-
*
|
|
33
|
-
* The interface name has a 'Bridge' as the interface acts as a bridge between
|
|
34
|
-
* the client provided form handler component and the host
|
|
35
|
-
* SPMatEntityCrudComponent.
|
|
36
|
-
*/
|
|
37
|
-
export interface SPMatEntityCrudCreateEditBridge {
|
|
38
|
-
/**
|
|
39
|
-
* Returns the entity name as provided to the host SPMatEntityCrudComponent.
|
|
40
|
-
* @returns The entity name string.
|
|
41
|
-
*/
|
|
42
|
-
getEntityName(): string;
|
|
43
|
-
/**
|
|
44
|
-
* Returns the entity id key as provided to the host SPMatEntityCrudComponent.
|
|
45
|
-
* @returns The entity id key string.
|
|
46
|
-
*/
|
|
47
|
-
getIdKey(): string;
|
|
48
|
-
/**
|
|
49
|
-
* Get Entity url
|
|
50
|
-
* @param cancel
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
53
|
-
getEntityUrl(entityId: any): string;
|
|
54
|
-
/**
|
|
55
|
-
* Close the edit/update form pane. This WON'T call the 'cancelEditCallback'
|
|
56
|
-
* even if one is registered.
|
|
57
|
-
*/
|
|
58
|
-
close: (cancel: boolean) => void;
|
|
59
|
-
/**
|
|
60
|
-
* Client form view can register a callback that will be invoked by the
|
|
61
|
-
* framework when user cancels the create/edit operation by clicking on the
|
|
62
|
-
* close button on the top right.
|
|
63
|
-
* @param callback
|
|
64
|
-
* @returns None
|
|
65
|
-
*/
|
|
66
|
-
registerCanCancelEditCallback: (callback: () => boolean) => void;
|
|
67
|
-
/**
|
|
68
|
-
* Create a new instance of TEntity, by sending a POST request to remote.
|
|
69
|
-
* @param entityValue This is the typically the output of Reactive form's
|
|
70
|
-
* form.value. Since this value's shape may be different from TEntity and is
|
|
71
|
-
* known only to client form, we use 'any'.
|
|
72
|
-
* @returns None
|
|
73
|
-
* @inner Implementation will show a busy wheel centered on the form
|
|
74
|
-
* view while the async function to update the object remains active.
|
|
75
|
-
*/
|
|
76
|
-
create: (entityValue: any) => Observable<any>;
|
|
77
|
-
/**
|
|
78
|
-
* Update the entity with id `id` with new values in entityValue.
|
|
79
|
-
* @param id TEntity id
|
|
80
|
-
* @param entityValue Entity values to be updated.
|
|
81
|
-
* @returns None
|
|
82
|
-
* @inner Implementation will show a busy wheel centered on the form
|
|
83
|
-
* view while the async function to update the object remains active.
|
|
84
|
-
*/
|
|
85
|
-
update: (id: any, entityValue: any) => Observable<any>;
|
|
86
|
-
/**
|
|
87
|
-
* Load the entity with the given id from server.
|
|
88
|
-
* @param id The id of the entity to load.
|
|
89
|
-
* @param params Additional parameters for loading the entity. This will
|
|
90
|
-
* be passed to the underlying data service's 'get' method. This can be a
|
|
91
|
-
* query parameters string or HttpParams object.
|
|
92
|
-
* @returns Observable of the loaded entity.
|
|
93
|
-
*/
|
|
94
|
-
loadEntity: (id: any, params: string | HttpParams) => Observable<any>;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Prototype of the function that will be used instead of HttpClient for
|
|
98
|
-
* CRUD operations.
|
|
99
|
-
* @param op - the CRUD operation being requested
|
|
100
|
-
* @param entityValue - The entity or entity value upon which the operation
|
|
101
|
-
* is being requested. for 'create' & 'update' this will be the value
|
|
102
|
-
* of the reactive form. This is typically form.value or the 2nd arg to create
|
|
103
|
-
* & update methods of SPMatEntityCrudCreateEditBridge.
|
|
104
|
-
*/
|
|
105
|
-
export type CRUD_OP_FN<TEntity extends {
|
|
106
|
-
[P in IdKey]: PropertyKey;
|
|
107
|
-
}, IdKey extends string = 'id'> = (op: string, id: TEntity[IdKey] | undefined, // valid only for 'get', 'update' & 'delete'
|
|
108
|
-
entityValue: any, // valid only for 'create' & 'update'
|
|
109
|
-
entityCrudComponent: any) => Observable<TEntity | null>;
|
|
110
|
-
export type ALLOW_ITEM_ACTION_FN<TEntity> = (entity: TEntity, action: string) => boolean;
|
|
111
|
-
/**
|
|
112
|
-
* This interface is used to define sub types for the "New {{item}}" button on
|
|
113
|
-
* top of the CRUD UI. An array of these is provided as the value to the
|
|
114
|
-
* component property 'newItemSubTypes'.
|
|
115
|
-
*/
|
|
116
|
-
export interface NewItemSubType {
|
|
117
|
-
/**
|
|
118
|
-
* A role string that will be passed as argument to the (action) event
|
|
119
|
-
* handler. This string allows the event handler to distinguish the selected
|
|
120
|
-
* sub-type.
|
|
121
|
-
*
|
|
122
|
-
* The special keyword '_new_' can be used to activate the
|
|
123
|
-
* `createEditTemplate` template if one is provided. In this case the params
|
|
124
|
-
* element value (see below) can be used in the template to distinguish
|
|
125
|
-
* between different menu items.
|
|
126
|
-
*/
|
|
127
|
-
role: string;
|
|
128
|
-
/**
|
|
129
|
-
* Label displayed in the menu representing this role.
|
|
130
|
-
*/
|
|
131
|
-
label: string;
|
|
132
|
-
/**
|
|
133
|
-
* Arbitrary value that will be passed to the 'createEditTemplate' in the
|
|
134
|
-
* $implicit template context as 'params'. You can access this in the
|
|
135
|
-
* template like below (see `data.params`):-
|
|
136
|
-
```
|
|
137
|
-
<ng-template #createEdit let-data>
|
|
138
|
-
<app-create-edit-entity-demo
|
|
139
|
-
[bridge]="data.bridge"
|
|
140
|
-
[entity]="data.entity"
|
|
141
|
-
[params]="data.params"
|
|
142
|
-
></app-create-edit-entity-demo>
|
|
143
|
-
</ng-template>
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
If params is an object and it includes the key 'title', its value will be
|
|
147
|
-
used as the title for the edit form.
|
|
148
|
-
*/
|
|
149
|
-
params?: any;
|
|
150
|
-
}
|
|
151
|
-
export type CrudOp = 'create' | 'retrieve' | 'update' | 'delete' | undefined;
|
|
152
|
-
export interface SPMatEntityCrudHttpContext {
|
|
153
|
-
entityName: string;
|
|
154
|
-
entityNamePlural: string;
|
|
155
|
-
endpoint: string;
|
|
156
|
-
op: CrudOp;
|
|
157
|
-
}
|
|
158
|
-
export declare const SP_MAT_ENTITY_CRUD_HTTP_CONTEXT: HttpContextToken<SPMatEntityCrudHttpContext>;
|