@smartbit4all/ng-client 3.3.197 → 3.3.199
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/esm2020/lib/session/api/api/session.service.mjs +1 -1
- package/esm2020/lib/session/api/configuration.mjs +1 -1
- package/esm2020/lib/session/api/encoder.mjs +1 -1
- package/esm2020/lib/session/api/model/accountInfo.mjs +1 -1
- package/esm2020/lib/session/api/model/apiError.mjs +1 -1
- package/esm2020/lib/session/api/model/authenticationProviderData.mjs +1 -1
- package/esm2020/lib/session/api/model/getAuthenticationProvidersResponse.mjs +1 -1
- package/esm2020/lib/session/api/model/models.mjs +1 -1
- package/esm2020/lib/session/api/model/refreshSessionRequest.mjs +1 -1
- package/esm2020/lib/session/api/model/session.mjs +1 -1
- package/esm2020/lib/session/api/model/sessionInfoData.mjs +1 -1
- package/esm2020/lib/session/api/model/userActivityLog.mjs +1 -1
- package/esm2020/lib/session/api/param.mjs +1 -1
- package/esm2020/lib/session/api/variables.mjs +1 -1
- package/esm2020/lib/smart-client/smart-component-api-client.mjs +1 -1
- package/esm2020/lib/smart-form/api/api/api.mjs +1 -1
- package/esm2020/lib/smart-form/api/api/default.service.mjs +1 -1
- package/esm2020/lib/smart-form/api/api.module.mjs +1 -1
- package/esm2020/lib/smart-form/api/configuration.mjs +1 -1
- package/esm2020/lib/smart-form/api/encoder.mjs +1 -1
- package/esm2020/lib/smart-form/api/index.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/models.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/propertyMapping.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/selectionDefinition.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/smartFormWidgetDirection.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/smartFormWidgetType.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/smartLayoutDefinition.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/smartMatrixModel.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/smartWidgetDefinition.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/smartWidgetHint.mjs +1 -1
- package/esm2020/lib/smart-form/api/model/valueChangeMode.mjs +1 -1
- package/esm2020/lib/smart-form/api/param.mjs +1 -1
- package/esm2020/lib/smart-form/api/variables.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/api/api.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/api/grid.service.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/api.module.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/configuration.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/encoder.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/index.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridColumnContentType.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridDataAccessConfig.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridModel.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridPage.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridRow.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionChange.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionMode.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionType.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridServerModel.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridUpdateData.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridView.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/gridViewDescriptor.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/model/models.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/param.mjs +1 -1
- package/esm2020/lib/smart-grid/api/grid-api/variables.mjs +1 -1
- package/esm2020/lib/smart-table/components/default-actions-popup/default-actions-popup.component.mjs +20 -15
- package/esm2020/lib/smart-table/directives/mat-context-menu-trigger-for.directive.mjs +52 -0
- package/esm2020/lib/smart-table/smarttable.module.mjs +5 -2
- package/esm2020/lib/smart-table/tables/material-table/material-table.component.mjs +3 -3
- package/esm2020/lib/smart-table/tables/mobile-table/mobile-table.component.mjs +3 -3
- package/esm2020/lib/smart-table/tables/table.mjs +11 -8
- package/esm2020/lib/view-context/api/api/api.mjs +1 -1
- package/esm2020/lib/view-context/api/api/view.service.mjs +1 -1
- package/esm2020/lib/view-context/api/api.module.mjs +1 -1
- package/esm2020/lib/view-context/api/configuration.mjs +1 -1
- package/esm2020/lib/view-context/api/encoder.mjs +1 -1
- package/esm2020/lib/view-context/api/index.mjs +1 -1
- package/esm2020/lib/view-context/api/model/closeResult.mjs +1 -1
- package/esm2020/lib/view-context/api/model/componentConstraint.mjs +1 -1
- package/esm2020/lib/view-context/api/model/componentModelChange.mjs +1 -1
- package/esm2020/lib/view-context/api/model/dataChange.mjs +1 -1
- package/esm2020/lib/view-context/api/model/dataChangeEvent.mjs +1 -1
- package/esm2020/lib/view-context/api/model/dataChangeKind.mjs +1 -1
- package/esm2020/lib/view-context/api/model/downloadedFile.mjs +1 -1
- package/esm2020/lib/view-context/api/model/iconPosition.mjs +1 -1
- package/esm2020/lib/view-context/api/model/imageResource.mjs +1 -1
- package/esm2020/lib/view-context/api/model/link.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageData.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageOption.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageOptionType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageResult.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageTextType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/messageType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/openPendingData.mjs +1 -1
- package/esm2020/lib/view-context/api/model/smartLinkData.mjs +1 -1
- package/esm2020/lib/view-context/api/model/style.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiAction.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionButtonDescriptor.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionButtonType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionConstraint.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionDescriptor.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionDialogDescriptor.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionFeedbackType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionInputType.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionRequest.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionTooltip.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiActionUploadDescriptor.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uploadedFile.mjs +1 -1
- package/esm2020/lib/view-context/api/model/valueSet.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewApiError.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewConstraint.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewContextChange.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewContextData.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewContextUpdate.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewData.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewEventHandler.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewState.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewStateUpdate.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewType.mjs +1 -1
- package/esm2020/lib/view-context/api/param.mjs +1 -1
- package/esm2020/lib/view-context/api/variables.mjs +1 -1
- package/esm2020/lib/view-context/value-api/api/api.mjs +1 -1
- package/esm2020/lib/view-context/value-api/api/value.service.mjs +1 -1
- package/esm2020/lib/view-context/value-api/api.module.mjs +1 -1
- package/esm2020/lib/view-context/value-api/configuration.mjs +1 -1
- package/esm2020/lib/view-context/value-api/encoder.mjs +1 -1
- package/esm2020/lib/view-context/value-api/index.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/value.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetDefinition.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetOperand.mjs +1 -1
- package/esm2020/lib/view-context/value-api/param.mjs +1 -1
- package/esm2020/lib/view-context/value-api/variables.mjs +1 -1
- package/fesm2015/smartbit4all-ng-client.mjs +85 -32
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +87 -31
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/smart-client/smart-component-api-client.d.ts +2 -2
- package/lib/smart-table/components/default-actions-popup/default-actions-popup.component.d.ts +10 -6
- package/lib/smart-table/directives/mat-context-menu-trigger-for.directive.d.ts +10 -0
- package/lib/smart-table/smarttable.module.d.ts +18 -17
- package/lib/smart-table/tables/table.d.ts +4 -4
- package/package.json +1 -1
- package/smartbit4all-ng-client-3.3.199.tgz +0 -0
- package/src/lib/session/api/README.md +226 -226
- package/src/lib/smart-form/api/README.md +226 -226
- package/src/lib/smart-grid/api/grid-api/README.md +226 -226
- package/src/lib/view-context/api/README.md +226 -226
- package/src/lib/view-context/value-api/README.md +226 -226
- package/smartbit4all-ng-client-3.3.197.tgz +0 -0
|
@@ -18,7 +18,7 @@ export declare abstract class SmartComponentApiClient<T> implements UseUiAction2
|
|
|
18
18
|
private detectChange;
|
|
19
19
|
private _uuid?;
|
|
20
20
|
private uuidOfPageHasBeenChangedSubscription?;
|
|
21
|
-
|
|
21
|
+
protected componentModelLoaded: boolean;
|
|
22
22
|
get uuid(): string | undefined;
|
|
23
23
|
set uuid(uuid: string | undefined);
|
|
24
24
|
private _model;
|
|
@@ -92,7 +92,7 @@ export declare abstract class SmartComponentApiClient<T> implements UseUiAction2
|
|
|
92
92
|
addFileUploader(uiActionCode: string, fileFormats?: string[], maxSizeMb?: number, isMultiple?: boolean): SmartComponentFileUploader;
|
|
93
93
|
private handleValueChanges;
|
|
94
94
|
protected handleChanges(change: ComponentModelChange): void;
|
|
95
|
-
|
|
95
|
+
protected handleChangeWidgets(changedWidgets: string[], skipLoad?: boolean): void;
|
|
96
96
|
private setValueDeeply;
|
|
97
97
|
private handleDataChange;
|
|
98
98
|
private handleLayoutChange;
|
package/lib/smart-table/components/default-actions-popup/default-actions-popup.component.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { MatMenuTrigger } from '@angular/material/menu';
|
|
2
1
|
import { SmartTableButton, SmartTableButtonType } from '../../smarttable.model';
|
|
3
2
|
import { GridRow } from '../../../smart-grid/api/grid-api/model/models';
|
|
3
|
+
import { UiAction } from '../../../view-context/api/model/models';
|
|
4
|
+
import { MatContextMenuTriggerForDirective } from '../../directives/mat-context-menu-trigger-for.directive';
|
|
5
|
+
import { KeyValue } from '@angular/common';
|
|
4
6
|
import * as i0 from "@angular/core";
|
|
5
7
|
export declare class DefaultActionsPopupComponent {
|
|
6
|
-
trigger:
|
|
8
|
+
trigger: MatContextMenuTriggerForDirective;
|
|
7
9
|
readonly ACTION_SEPERATOR = SmartTableButtonType.SEPARATOR;
|
|
8
|
-
buttons: SmartTableButton
|
|
10
|
+
buttons: Map<SmartTableButton, UiAction>;
|
|
9
11
|
row: GridRow;
|
|
12
|
+
colIdx?: number;
|
|
13
|
+
smartTableButtonType: typeof SmartTableButtonType;
|
|
10
14
|
constructor();
|
|
11
|
-
openDefaultActionsMenu(): void;
|
|
12
|
-
defaultActionButtonClicked(button: SmartTableButton): void;
|
|
15
|
+
openDefaultActionsMenu(e: MouseEvent): void;
|
|
16
|
+
defaultActionButtonClicked(button: KeyValue<SmartTableButton, UiAction>): void;
|
|
13
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultActionsPopupComponent, never>;
|
|
14
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DefaultActionsPopupComponent, "lib-default-actions-popup", never, { "buttons": "buttons"; "row": "row"; }, {}, never, never>;
|
|
18
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DefaultActionsPopupComponent, "lib-default-actions-popup", never, { "buttons": "buttons"; "row": "row"; "colIdx": "colIdx"; }, {}, never, never>;
|
|
15
19
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MatMenuPanel, _MatMenuTriggerBase } from '@angular/material/menu';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class MatContextMenuTriggerForDirective extends _MatMenuTriggerBase {
|
|
4
|
+
lastMouseEvent: MouseEvent | null;
|
|
5
|
+
get menu_again(): MatMenuPanel;
|
|
6
|
+
set menu_again(menu: MatMenuPanel);
|
|
7
|
+
ngAfterContentInit(): void;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MatContextMenuTriggerForDirective, never>;
|
|
9
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MatContextMenuTriggerForDirective, "[matContextMenuTriggerFor]", ["matContextMenuTriggerDirective"], { "menu_again": "matContextMenuTriggerFor"; }, {}, never>;
|
|
10
|
+
}
|
|
@@ -4,24 +4,25 @@ import * as i2 from "./components/loading/loading.component";
|
|
|
4
4
|
import * as i3 from "./tables/material-table/material-table.component";
|
|
5
5
|
import * as i4 from "./tables/mobile-table/mobile-table.component";
|
|
6
6
|
import * as i5 from "./components/default-actions-popup/default-actions-popup.component";
|
|
7
|
-
import * as i6 from "
|
|
8
|
-
import * as i7 from "
|
|
9
|
-
import * as i8 from "@angular/
|
|
10
|
-
import * as i9 from "@angular/
|
|
11
|
-
import * as i10 from "@angular/
|
|
12
|
-
import * as i11 from "@angular/material/
|
|
13
|
-
import * as i12 from "@angular/material/
|
|
14
|
-
import * as i13 from "@angular/material/
|
|
15
|
-
import * as i14 from "@angular/material/
|
|
16
|
-
import * as i15 from "@angular/material/
|
|
17
|
-
import * as i16 from "@angular/material/
|
|
18
|
-
import * as i17 from "
|
|
19
|
-
import * as i18 from "../
|
|
20
|
-
import * as i19 from "
|
|
21
|
-
import * as i20 from "@angular/material/
|
|
22
|
-
import * as i21 from "@angular/
|
|
7
|
+
import * as i6 from "./directives/mat-context-menu-trigger-for.directive";
|
|
8
|
+
import * as i7 from "../shared/shared.module";
|
|
9
|
+
import * as i8 from "@angular/platform-browser";
|
|
10
|
+
import * as i9 from "@angular/material/core";
|
|
11
|
+
import * as i10 from "@angular/forms";
|
|
12
|
+
import * as i11 from "@angular/material/form-field";
|
|
13
|
+
import * as i12 from "@angular/material/checkbox";
|
|
14
|
+
import * as i13 from "@angular/material/button";
|
|
15
|
+
import * as i14 from "@angular/material/table";
|
|
16
|
+
import * as i15 from "@angular/material/icon";
|
|
17
|
+
import * as i16 from "@angular/material/menu";
|
|
18
|
+
import * as i17 from "@angular/material/progress-spinner";
|
|
19
|
+
import * as i18 from "../component-factory-service/component-factory-service.module";
|
|
20
|
+
import * as i19 from "../smart-icon/smart-icon.module";
|
|
21
|
+
import * as i20 from "@angular/material/divider";
|
|
22
|
+
import * as i21 from "@angular/material/tooltip";
|
|
23
|
+
import * as i22 from "@angular/common";
|
|
23
24
|
export declare class SmarttableModule {
|
|
24
25
|
static ɵfac: i0.ɵɵFactoryDeclaration<SmarttableModule, never>;
|
|
25
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<SmarttableModule, [typeof i1.SmarttableComponent, typeof i2.LoadingComponent, typeof i3.MaterialTableComponent, typeof i4.MobileTableComponent, typeof i5.DefaultActionsPopupComponent], [typeof
|
|
26
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SmarttableModule, [typeof i1.SmarttableComponent, typeof i2.LoadingComponent, typeof i3.MaterialTableComponent, typeof i4.MobileTableComponent, typeof i5.DefaultActionsPopupComponent, typeof i6.MatContextMenuTriggerForDirective], [typeof i7.SharedModule, typeof i8.BrowserModule, typeof i9.MatCommonModule, typeof i10.FormsModule, typeof i10.ReactiveFormsModule, typeof i11.MatFormFieldModule, typeof i12.MatCheckboxModule, typeof i13.MatButtonModule, typeof i14.MatTableModule, typeof i15.MatIconModule, typeof i16.MatMenuModule, typeof i17.MatProgressSpinnerModule, typeof i18.ComponentFactoryServiceModule, typeof i19.SmartIconModule, typeof i20.MatDividerModule, typeof i21.MatTooltipModule, typeof i22.CommonModule, typeof i7.SharedModule], [typeof i1.SmarttableComponent]>;
|
|
26
27
|
static ɵinj: i0.ɵɵInjectorDeclaration<SmarttableModule>;
|
|
27
28
|
}
|
|
@@ -4,7 +4,7 @@ import { MatMenuTrigger } from '@angular/material/menu';
|
|
|
4
4
|
import { MatTable } from '@angular/material/table';
|
|
5
5
|
import { Subject } from 'rxjs';
|
|
6
6
|
import { ComponentFactoryService } from '../../component-factory-service/projects';
|
|
7
|
-
import { ImageResource, UiActionTooltip } from '../../view-context/api/model/models';
|
|
7
|
+
import { ImageResource, UiAction, UiActionTooltip } from '../../view-context/api/model/models';
|
|
8
8
|
import { DefaultActionsPopupComponent } from '../components/default-actions-popup/default-actions-popup.component';
|
|
9
9
|
import { SmartTable, SmartTableButton, SmartTableButtonType, SmartTableHeader, SmartTableHeaderPropertyType, SmartTableOptionButtonDirection, SmartTableType } from '../smarttable.model';
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
@@ -32,7 +32,7 @@ export declare class Table implements OnInit, OnDestroy {
|
|
|
32
32
|
handleOnRowClick(element: any): void;
|
|
33
33
|
updateSmartTable(smartTable: SmartTable<any>): void;
|
|
34
34
|
renderRows(): void;
|
|
35
|
-
handleOnRowDoubleClick(element: any): void;
|
|
35
|
+
handleOnRowDoubleClick(event: any, element: any): void;
|
|
36
36
|
type(): typeof SmartTableHeaderPropertyType;
|
|
37
37
|
sortButtonClicked(event: any, header: SmartTableHeader): void;
|
|
38
38
|
customButtonClicked(event: any, button: SmartTableButton, element: any, btn?: any, close?: boolean): void;
|
|
@@ -78,8 +78,8 @@ export declare class Table implements OnInit, OnDestroy {
|
|
|
78
78
|
getImageResourceIcon(element: any, header: string): any;
|
|
79
79
|
getImageResourceColor(element: any, header: string): any;
|
|
80
80
|
getImageResourceStyle(resource: ImageResource): any;
|
|
81
|
-
openDefaultActionsMenu(row: any): void;
|
|
82
|
-
getDefaultActionsForRow(element: any): SmartTableButton
|
|
81
|
+
openDefaultActionsMenu(event: any, row: any): void;
|
|
82
|
+
getDefaultActionsForRow(element: any): Map<SmartTableButton, UiAction> | undefined;
|
|
83
83
|
static ɵfac: i0.ɵɵFactoryDeclaration<Table, never>;
|
|
84
84
|
static ɵcmp: i0.ɵɵComponentDeclaration<Table, "ng-component", never, { "smartTable": "smartTable"; }, {}, never, never>;
|
|
85
85
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -1,226 +1,226 @@
|
|
|
1
|
-
## @
|
|
2
|
-
|
|
3
|
-
### Building
|
|
4
|
-
|
|
5
|
-
To install the required dependencies and to build the typescript sources run:
|
|
6
|
-
```
|
|
7
|
-
npm install
|
|
8
|
-
npm run build
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### publishing
|
|
12
|
-
|
|
13
|
-
First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!)
|
|
14
|
-
|
|
15
|
-
### consuming
|
|
16
|
-
|
|
17
|
-
Navigate to the folder of your consuming project and run one of next commands.
|
|
18
|
-
|
|
19
|
-
_published:_
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
npm install @ --save
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
_without publishing (not recommended):_
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
|
32
|
-
|
|
33
|
-
_using `npm link`:_
|
|
34
|
-
|
|
35
|
-
In PATH_TO_GENERATED_PACKAGE/dist:
|
|
36
|
-
```
|
|
37
|
-
npm link
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
In your project:
|
|
41
|
-
```
|
|
42
|
-
npm link
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
|
|
46
|
-
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
|
|
47
|
-
Published packages are not effected by this issue.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
#### General usage
|
|
51
|
-
|
|
52
|
-
In your Angular project:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
// without configuring providers
|
|
57
|
-
import { ApiModule } from '';
|
|
58
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
59
|
-
|
|
60
|
-
@NgModule({
|
|
61
|
-
imports: [
|
|
62
|
-
ApiModule,
|
|
63
|
-
// make sure to import the HttpClientModule in the AppModule only,
|
|
64
|
-
// see https://github.com/angular/angular/issues/20575
|
|
65
|
-
HttpClientModule
|
|
66
|
-
],
|
|
67
|
-
declarations: [ AppComponent ],
|
|
68
|
-
providers: [],
|
|
69
|
-
bootstrap: [ AppComponent ]
|
|
70
|
-
})
|
|
71
|
-
export class AppModule {}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
// configuring providers
|
|
76
|
-
import { ApiModule, Configuration, ConfigurationParameters } from '';
|
|
77
|
-
|
|
78
|
-
export function apiConfigFactory (): Configuration {
|
|
79
|
-
const params: ConfigurationParameters = {
|
|
80
|
-
// set configuration parameters here.
|
|
81
|
-
}
|
|
82
|
-
return new Configuration(params);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@NgModule({
|
|
86
|
-
imports: [ ApiModule.forRoot(apiConfigFactory) ],
|
|
87
|
-
declarations: [ AppComponent ],
|
|
88
|
-
providers: [],
|
|
89
|
-
bootstrap: [ AppComponent ]
|
|
90
|
-
})
|
|
91
|
-
export class AppModule {}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
// configuring providers with an authentication service that manages your access tokens
|
|
96
|
-
import { ApiModule, Configuration } from '';
|
|
97
|
-
|
|
98
|
-
@NgModule({
|
|
99
|
-
imports: [ ApiModule ],
|
|
100
|
-
declarations: [ AppComponent ],
|
|
101
|
-
providers: [
|
|
102
|
-
{
|
|
103
|
-
provide: Configuration,
|
|
104
|
-
useFactory: (authService: AuthService) => new Configuration(
|
|
105
|
-
{
|
|
106
|
-
basePath: environment.apiUrl,
|
|
107
|
-
accessToken: authService.getAccessToken.bind(authService)
|
|
108
|
-
}
|
|
109
|
-
),
|
|
110
|
-
deps: [AuthService],
|
|
111
|
-
multi: false
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
bootstrap: [ AppComponent ]
|
|
115
|
-
})
|
|
116
|
-
export class AppModule {}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
import { DefaultApi } from '';
|
|
121
|
-
|
|
122
|
-
export class AppComponent {
|
|
123
|
-
constructor(private apiGateway: DefaultApi) { }
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Note: The ApiModule is restricted to being instantiated once app wide.
|
|
128
|
-
This is to ensure that all services are treated as singletons.
|
|
129
|
-
|
|
130
|
-
#### Using multiple OpenAPI files / APIs / ApiModules
|
|
131
|
-
In order to use multiple `ApiModules` generated from different OpenAPI files,
|
|
132
|
-
you can create an alias name when importing the modules
|
|
133
|
-
in order to avoid naming conflicts:
|
|
134
|
-
```
|
|
135
|
-
import { ApiModule } from 'my-api-path';
|
|
136
|
-
import { ApiModule as OtherApiModule } from 'my-other-api-path';
|
|
137
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
138
|
-
|
|
139
|
-
@NgModule({
|
|
140
|
-
imports: [
|
|
141
|
-
ApiModule,
|
|
142
|
-
OtherApiModule,
|
|
143
|
-
// make sure to import the HttpClientModule in the AppModule only,
|
|
144
|
-
// see https://github.com/angular/angular/issues/20575
|
|
145
|
-
HttpClientModule
|
|
146
|
-
]
|
|
147
|
-
})
|
|
148
|
-
export class AppModule {
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
### Set service base path
|
|
155
|
-
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
|
|
156
|
-
|
|
157
|
-
```
|
|
158
|
-
import { BASE_PATH } from '';
|
|
159
|
-
|
|
160
|
-
bootstrap(AppComponent, [
|
|
161
|
-
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
|
|
162
|
-
]);
|
|
163
|
-
```
|
|
164
|
-
or
|
|
165
|
-
|
|
166
|
-
```
|
|
167
|
-
import { BASE_PATH } from '';
|
|
168
|
-
|
|
169
|
-
@NgModule({
|
|
170
|
-
imports: [],
|
|
171
|
-
declarations: [ AppComponent ],
|
|
172
|
-
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
|
|
173
|
-
bootstrap: [ AppComponent ]
|
|
174
|
-
})
|
|
175
|
-
export class AppModule {}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
#### Using @angular/cli
|
|
180
|
-
First extend your `src/environments/*.ts` files by adding the corresponding base path:
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
export const environment = {
|
|
184
|
-
production: false,
|
|
185
|
-
API_BASE_PATH: 'http://127.0.0.1:8080'
|
|
186
|
-
};
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
In the src/app/app.module.ts:
|
|
190
|
-
```
|
|
191
|
-
import { BASE_PATH } from '';
|
|
192
|
-
import { environment } from '../environments/environment';
|
|
193
|
-
|
|
194
|
-
@NgModule({
|
|
195
|
-
declarations: [
|
|
196
|
-
AppComponent
|
|
197
|
-
],
|
|
198
|
-
imports: [ ],
|
|
199
|
-
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
|
|
200
|
-
bootstrap: [ AppComponent ]
|
|
201
|
-
})
|
|
202
|
-
export class AppModule { }
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Customizing path parameter encoding
|
|
206
|
-
|
|
207
|
-
Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
|
|
208
|
-
and Dates for format 'date-time' are encoded correctly.
|
|
209
|
-
|
|
210
|
-
Other styles (e.g. "matrix") are not that easy to encode
|
|
211
|
-
and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
|
|
212
|
-
|
|
213
|
-
To implement your own parameter encoding (or call another library),
|
|
214
|
-
pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
|
|
215
|
-
(see [General Usage](#general-usage) above).
|
|
216
|
-
|
|
217
|
-
Example value for use in your Configuration-Provider:
|
|
218
|
-
```typescript
|
|
219
|
-
new Configuration({
|
|
220
|
-
encodeParam: (param: Param) => myFancyParamEncoder(param),
|
|
221
|
-
})
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
|
|
225
|
-
[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
|
|
226
|
-
[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander
|
|
1
|
+
## @
|
|
2
|
+
|
|
3
|
+
### Building
|
|
4
|
+
|
|
5
|
+
To install the required dependencies and to build the typescript sources run:
|
|
6
|
+
```
|
|
7
|
+
npm install
|
|
8
|
+
npm run build
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### publishing
|
|
12
|
+
|
|
13
|
+
First build the package then run ```npm publish dist``` (don't forget to specify the `dist` folder!)
|
|
14
|
+
|
|
15
|
+
### consuming
|
|
16
|
+
|
|
17
|
+
Navigate to the folder of your consuming project and run one of next commands.
|
|
18
|
+
|
|
19
|
+
_published:_
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
npm install @ --save
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
_without publishing (not recommended):_
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
|
32
|
+
|
|
33
|
+
_using `npm link`:_
|
|
34
|
+
|
|
35
|
+
In PATH_TO_GENERATED_PACKAGE/dist:
|
|
36
|
+
```
|
|
37
|
+
npm link
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
In your project:
|
|
41
|
+
```
|
|
42
|
+
npm link
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
|
|
46
|
+
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
|
|
47
|
+
Published packages are not effected by this issue.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
#### General usage
|
|
51
|
+
|
|
52
|
+
In your Angular project:
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
// without configuring providers
|
|
57
|
+
import { ApiModule } from '';
|
|
58
|
+
import { HttpClientModule } from '@angular/common/http';
|
|
59
|
+
|
|
60
|
+
@NgModule({
|
|
61
|
+
imports: [
|
|
62
|
+
ApiModule,
|
|
63
|
+
// make sure to import the HttpClientModule in the AppModule only,
|
|
64
|
+
// see https://github.com/angular/angular/issues/20575
|
|
65
|
+
HttpClientModule
|
|
66
|
+
],
|
|
67
|
+
declarations: [ AppComponent ],
|
|
68
|
+
providers: [],
|
|
69
|
+
bootstrap: [ AppComponent ]
|
|
70
|
+
})
|
|
71
|
+
export class AppModule {}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
// configuring providers
|
|
76
|
+
import { ApiModule, Configuration, ConfigurationParameters } from '';
|
|
77
|
+
|
|
78
|
+
export function apiConfigFactory (): Configuration {
|
|
79
|
+
const params: ConfigurationParameters = {
|
|
80
|
+
// set configuration parameters here.
|
|
81
|
+
}
|
|
82
|
+
return new Configuration(params);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@NgModule({
|
|
86
|
+
imports: [ ApiModule.forRoot(apiConfigFactory) ],
|
|
87
|
+
declarations: [ AppComponent ],
|
|
88
|
+
providers: [],
|
|
89
|
+
bootstrap: [ AppComponent ]
|
|
90
|
+
})
|
|
91
|
+
export class AppModule {}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
// configuring providers with an authentication service that manages your access tokens
|
|
96
|
+
import { ApiModule, Configuration } from '';
|
|
97
|
+
|
|
98
|
+
@NgModule({
|
|
99
|
+
imports: [ ApiModule ],
|
|
100
|
+
declarations: [ AppComponent ],
|
|
101
|
+
providers: [
|
|
102
|
+
{
|
|
103
|
+
provide: Configuration,
|
|
104
|
+
useFactory: (authService: AuthService) => new Configuration(
|
|
105
|
+
{
|
|
106
|
+
basePath: environment.apiUrl,
|
|
107
|
+
accessToken: authService.getAccessToken.bind(authService)
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
deps: [AuthService],
|
|
111
|
+
multi: false
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
bootstrap: [ AppComponent ]
|
|
115
|
+
})
|
|
116
|
+
export class AppModule {}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
import { DefaultApi } from '';
|
|
121
|
+
|
|
122
|
+
export class AppComponent {
|
|
123
|
+
constructor(private apiGateway: DefaultApi) { }
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Note: The ApiModule is restricted to being instantiated once app wide.
|
|
128
|
+
This is to ensure that all services are treated as singletons.
|
|
129
|
+
|
|
130
|
+
#### Using multiple OpenAPI files / APIs / ApiModules
|
|
131
|
+
In order to use multiple `ApiModules` generated from different OpenAPI files,
|
|
132
|
+
you can create an alias name when importing the modules
|
|
133
|
+
in order to avoid naming conflicts:
|
|
134
|
+
```
|
|
135
|
+
import { ApiModule } from 'my-api-path';
|
|
136
|
+
import { ApiModule as OtherApiModule } from 'my-other-api-path';
|
|
137
|
+
import { HttpClientModule } from '@angular/common/http';
|
|
138
|
+
|
|
139
|
+
@NgModule({
|
|
140
|
+
imports: [
|
|
141
|
+
ApiModule,
|
|
142
|
+
OtherApiModule,
|
|
143
|
+
// make sure to import the HttpClientModule in the AppModule only,
|
|
144
|
+
// see https://github.com/angular/angular/issues/20575
|
|
145
|
+
HttpClientModule
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
export class AppModule {
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Set service base path
|
|
155
|
+
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
import { BASE_PATH } from '';
|
|
159
|
+
|
|
160
|
+
bootstrap(AppComponent, [
|
|
161
|
+
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
|
|
162
|
+
]);
|
|
163
|
+
```
|
|
164
|
+
or
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
import { BASE_PATH } from '';
|
|
168
|
+
|
|
169
|
+
@NgModule({
|
|
170
|
+
imports: [],
|
|
171
|
+
declarations: [ AppComponent ],
|
|
172
|
+
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
|
|
173
|
+
bootstrap: [ AppComponent ]
|
|
174
|
+
})
|
|
175
|
+
export class AppModule {}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
#### Using @angular/cli
|
|
180
|
+
First extend your `src/environments/*.ts` files by adding the corresponding base path:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
export const environment = {
|
|
184
|
+
production: false,
|
|
185
|
+
API_BASE_PATH: 'http://127.0.0.1:8080'
|
|
186
|
+
};
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
In the src/app/app.module.ts:
|
|
190
|
+
```
|
|
191
|
+
import { BASE_PATH } from '';
|
|
192
|
+
import { environment } from '../environments/environment';
|
|
193
|
+
|
|
194
|
+
@NgModule({
|
|
195
|
+
declarations: [
|
|
196
|
+
AppComponent
|
|
197
|
+
],
|
|
198
|
+
imports: [ ],
|
|
199
|
+
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
|
|
200
|
+
bootstrap: [ AppComponent ]
|
|
201
|
+
})
|
|
202
|
+
export class AppModule { }
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Customizing path parameter encoding
|
|
206
|
+
|
|
207
|
+
Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
|
|
208
|
+
and Dates for format 'date-time' are encoded correctly.
|
|
209
|
+
|
|
210
|
+
Other styles (e.g. "matrix") are not that easy to encode
|
|
211
|
+
and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
|
|
212
|
+
|
|
213
|
+
To implement your own parameter encoding (or call another library),
|
|
214
|
+
pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
|
|
215
|
+
(see [General Usage](#general-usage) above).
|
|
216
|
+
|
|
217
|
+
Example value for use in your Configuration-Provider:
|
|
218
|
+
```typescript
|
|
219
|
+
new Configuration({
|
|
220
|
+
encodeParam: (param: Param) => myFancyParamEncoder(param),
|
|
221
|
+
})
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
|
|
225
|
+
[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
|
|
226
|
+
[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander
|