@smartbit4all/ng-client 3.0.28 → 3.0.30

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.
Files changed (96) hide show
  1. package/esm2020/lib/session/dev-tool/smart-dev-tool-dialog/smart-dev-tool-dialog.service.mjs +3 -3
  2. package/esm2020/lib/smart-dialog/smartdialog.module.mjs +3 -4
  3. package/esm2020/lib/smart-dialog/smartdialog.service.mjs +4 -16
  4. package/esm2020/lib/smart-grid/api/grid-api/api/api.mjs +1 -1
  5. package/esm2020/lib/smart-grid/api/grid-api/api/grid.service.mjs +1 -1
  6. package/esm2020/lib/smart-grid/api/grid-api/api.module.mjs +1 -1
  7. package/esm2020/lib/smart-grid/api/grid-api/configuration.mjs +1 -1
  8. package/esm2020/lib/smart-grid/api/grid-api/encoder.mjs +1 -1
  9. package/esm2020/lib/smart-grid/api/grid-api/index.mjs +1 -1
  10. package/esm2020/lib/smart-grid/api/grid-api/model/gridColumnMeta.mjs +1 -1
  11. package/esm2020/lib/smart-grid/api/grid-api/model/gridDataAccessConfig.mjs +1 -1
  12. package/esm2020/lib/smart-grid/api/grid-api/model/gridModel.mjs +1 -1
  13. package/esm2020/lib/smart-grid/api/grid-api/model/gridPage.mjs +1 -1
  14. package/esm2020/lib/smart-grid/api/grid-api/model/gridRow.mjs +1 -1
  15. package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionMode.mjs +1 -1
  16. package/esm2020/lib/smart-grid/api/grid-api/model/gridSelectionType.mjs +1 -1
  17. package/esm2020/lib/smart-grid/api/grid-api/model/gridServerModel.mjs +1 -1
  18. package/esm2020/lib/smart-grid/api/grid-api/model/gridUpdateData.mjs +1 -1
  19. package/esm2020/lib/smart-grid/api/grid-api/model/gridView.mjs +1 -1
  20. package/esm2020/lib/smart-grid/api/grid-api/model/gridViewDescriptor.mjs +1 -1
  21. package/esm2020/lib/smart-grid/api/grid-api/model/models.mjs +1 -1
  22. package/esm2020/lib/smart-grid/api/grid-api/param.mjs +1 -1
  23. package/esm2020/lib/smart-grid/api/grid-api/variables.mjs +1 -1
  24. package/esm2020/lib/smart-grid/smart-grid.service.mjs +6 -6
  25. package/esm2020/lib/view-context/api/api/api.mjs +1 -1
  26. package/esm2020/lib/view-context/api/api/view.service.mjs +1 -1
  27. package/esm2020/lib/view-context/api/api.module.mjs +1 -1
  28. package/esm2020/lib/view-context/api/configuration.mjs +1 -1
  29. package/esm2020/lib/view-context/api/encoder.mjs +1 -1
  30. package/esm2020/lib/view-context/api/index.mjs +1 -1
  31. package/esm2020/lib/view-context/api/model/closeResult.mjs +1 -1
  32. package/esm2020/lib/view-context/api/model/componentConstraint.mjs +1 -1
  33. package/esm2020/lib/view-context/api/model/componentModel.mjs +1 -1
  34. package/esm2020/lib/view-context/api/model/componentModelChange.mjs +1 -1
  35. package/esm2020/lib/view-context/api/model/dataChange.mjs +1 -1
  36. package/esm2020/lib/view-context/api/model/dataChangeEvent.mjs +1 -1
  37. package/esm2020/lib/view-context/api/model/dataChangeKind.mjs +1 -1
  38. package/esm2020/lib/view-context/api/model/link.mjs +1 -1
  39. package/esm2020/lib/view-context/api/model/messageData.mjs +1 -1
  40. package/esm2020/lib/view-context/api/model/messageOption.mjs +1 -1
  41. package/esm2020/lib/view-context/api/model/messageOptionType.mjs +1 -1
  42. package/esm2020/lib/view-context/api/model/messageResult.mjs +1 -1
  43. package/esm2020/lib/view-context/api/model/messageType.mjs +1 -1
  44. package/esm2020/lib/view-context/api/model/models.mjs +1 -1
  45. package/esm2020/lib/view-context/api/model/openPendingData.mjs +1 -1
  46. package/esm2020/lib/view-context/api/model/smartLinkData.mjs +1 -1
  47. package/esm2020/lib/view-context/api/model/uiAction.mjs +1 -1
  48. package/esm2020/lib/view-context/api/model/uiActionButtonDescriptor.mjs +1 -1
  49. package/esm2020/lib/view-context/api/model/uiActionButtonIconPos.mjs +1 -1
  50. package/esm2020/lib/view-context/api/model/uiActionButtonType.mjs +1 -1
  51. package/esm2020/lib/view-context/api/model/uiActionConstraint.mjs +1 -1
  52. package/esm2020/lib/view-context/api/model/uiActionDescriptor.mjs +1 -1
  53. package/esm2020/lib/view-context/api/model/uiActionDialogDescriptor.mjs +1 -1
  54. package/esm2020/lib/view-context/api/model/uiActionFeedbackType.mjs +1 -1
  55. package/esm2020/lib/view-context/api/model/uiActionInputType.mjs +1 -1
  56. package/esm2020/lib/view-context/api/model/uiActionRequest.mjs +1 -1
  57. package/esm2020/lib/view-context/api/model/uiActionUploadDescriptor.mjs +1 -1
  58. package/esm2020/lib/view-context/api/model/valueSet.mjs +1 -1
  59. package/esm2020/lib/view-context/api/model/view.mjs +1 -1
  60. package/esm2020/lib/view-context/api/model/viewApiError.mjs +1 -1
  61. package/esm2020/lib/view-context/api/model/viewConstraint.mjs +1 -1
  62. package/esm2020/lib/view-context/api/model/viewContext.mjs +1 -1
  63. package/esm2020/lib/view-context/api/model/viewContextChange.mjs +1 -1
  64. package/esm2020/lib/view-context/api/model/viewContextData.mjs +1 -1
  65. package/esm2020/lib/view-context/api/model/viewContextUpdate.mjs +1 -1
  66. package/esm2020/lib/view-context/api/model/viewData.mjs +1 -1
  67. package/esm2020/lib/view-context/api/model/viewState.mjs +1 -1
  68. package/esm2020/lib/view-context/api/model/viewStateUpdate.mjs +1 -1
  69. package/esm2020/lib/view-context/api/model/viewType.mjs +1 -1
  70. package/esm2020/lib/view-context/api/param.mjs +1 -1
  71. package/esm2020/lib/view-context/api/variables.mjs +1 -1
  72. package/esm2020/lib/view-context/smart-ui-action/dialogs/ui-action-confirm-dialog/ui-action-confirm-dialog.service.mjs +3 -3
  73. package/esm2020/lib/view-context/smart-ui-action/dialogs/ui-action-file-upload-dialog/ui-action-file-upload-dialog.service.mjs +3 -3
  74. package/esm2020/lib/view-context/smart-ui-action/dialogs/ui-action-input-dialog/ui-action-input-dialog.service.mjs +3 -3
  75. package/esm2020/lib/view-context/smart-view-context-dialog.service.mjs +60 -0
  76. package/esm2020/lib/view-context/smart-view-context-error-dialog/smart-view-context-error-dialog.service.mjs +3 -3
  77. package/esm2020/lib/view-context/smart-view-context.service.mjs +2 -2
  78. package/fesm2015/smartbit4all-ng-client.mjs +3826 -3778
  79. package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
  80. package/fesm2020/smartbit4all-ng-client.mjs +3721 -3673
  81. package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
  82. package/lib/session/dev-tool/smart-dev-tool-dialog/smart-dev-tool-dialog.service.d.ts +2 -2
  83. package/lib/smart-dialog/smartdialog.service.d.ts +4 -7
  84. package/lib/smart-grid/smart-grid.service.d.ts +2 -3
  85. package/lib/view-context/smart-ui-action/dialogs/ui-action-confirm-dialog/ui-action-confirm-dialog.service.d.ts +2 -2
  86. package/lib/view-context/smart-ui-action/dialogs/ui-action-file-upload-dialog/ui-action-file-upload-dialog.service.d.ts +2 -2
  87. package/lib/view-context/smart-ui-action/dialogs/ui-action-input-dialog/ui-action-input-dialog.service.d.ts +2 -2
  88. package/lib/view-context/smart-view-context-dialog.service.d.ts +18 -0
  89. package/lib/view-context/smart-view-context-error-dialog/smart-view-context-error-dialog.service.d.ts +2 -2
  90. package/lib/view-context/smart-view-context.service.d.ts +1 -1
  91. package/package.json +1 -1
  92. package/smartbit4all-ng-client-3.0.30.tgz +0 -0
  93. package/src/lib/smart-dialog/README.md +9 -9
  94. package/src/lib/smart-grid/api/grid-api/README.md +226 -226
  95. package/src/lib/view-context/api/README.md +226 -226
  96. package/smartbit4all-ng-client-3.0.28.tgz +0 -0
@@ -2,9 +2,9 @@ import { MatDialog } from '@angular/material/dialog';
2
2
  import { Router } from '@angular/router';
3
3
  import { Subject } from 'rxjs';
4
4
  import { SmartDevToolDescriptor, SmartDevToolService } from '../smart-dev-tool.service';
5
- import { SmartdialogService } from '../../../smart-dialog/projects';
5
+ import { SmartAbstractdialogService } from '../../../smart-dialog/projects';
6
6
  import * as i0 from "@angular/core";
7
- export declare class SmartDevToolDialogService extends SmartdialogService {
7
+ export declare class SmartDevToolDialogService extends SmartAbstractdialogService {
8
8
  service: SmartDevToolService;
9
9
  update: Subject<void>;
10
10
  constructor(dialog: MatDialog, router: Router, service: SmartDevToolService);
@@ -2,19 +2,16 @@ import { ComponentType } from '@angular/cdk/portal';
2
2
  import { MatDialog, MatDialogRef } from '@angular/material/dialog';
3
3
  import { Router } from '@angular/router';
4
4
  import { SmartDialogData } from './smartdialog.model';
5
- import * as i0 from "@angular/core";
6
- export declare class SmartdialogService {
5
+ export declare abstract class SmartAbstractdialogService {
7
6
  protected dialog: MatDialog;
8
7
  protected router: Router;
9
- dialogRef?: MatDialogRef<any, any>;
10
- dialogData?: SmartDialogData;
11
8
  constructor(dialog: MatDialog, router: Router);
12
- createDialog(smartDialog: SmartDialogData, component: ComponentType<any>): void;
9
+ private dialogRef;
10
+ private dialogData;
11
+ createDialog(smartDialog: SmartDialogData, component: ComponentType<any>): MatDialogRef<any, any>;
13
12
  createDialogRef(smartDialog: SmartDialogData, component: ComponentType<any>): MatDialogRef<any, any>;
14
13
  openComponentAsDialog(component: ComponentType<any>, viewName: string): MatDialogRef<any, any>;
15
14
  handleAfterClosed(result: any): void;
16
15
  openDialog(): void;
17
16
  closeDialog(): Promise<void>;
18
- static ɵfac: i0.ɵɵFactoryDeclaration<SmartdialogService, never>;
19
- static ɵprov: i0.ɵɵInjectableDeclaration<SmartdialogService>;
20
17
  }
@@ -3,9 +3,9 @@ import { Router } from '@angular/router';
3
3
  import { Subject } from 'rxjs';
4
4
  import { GridModel, GridRow, GridService, GridUpdateData } from './api/grid-api';
5
5
  import { SmartGrid } from './projects';
6
- import { SmartdialogService } from '../smart-dialog/projects';
6
+ import { SmartAbstractdialogService } from '../smart-dialog/smartdialog.service';
7
7
  import * as i0 from "@angular/core";
8
- export declare class SmartGridService extends SmartdialogService {
8
+ export declare class SmartGridService extends SmartAbstractdialogService {
9
9
  private api;
10
10
  gridModelChanged: Subject<void>;
11
11
  gridModel: GridModel;
@@ -17,7 +17,6 @@ export declare class SmartGridService extends SmartdialogService {
17
17
  select(smartGrid: SmartGrid, gridRow: GridRow): Promise<any>;
18
18
  selectAll(smartGrid: SmartGrid, selected: boolean): Promise<any>;
19
19
  update(uuid: string, identifier: string, updateData: GridUpdateData): Promise<void>;
20
- closeDialog(): Promise<void>;
21
20
  handleAfterClosed(): void;
22
21
  private updateGrid;
23
22
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartGridService, never>;
@@ -1,10 +1,10 @@
1
1
  import { MatDialog } from '@angular/material/dialog';
2
2
  import { Router } from '@angular/router';
3
- import { SmartdialogService } from '../../../../smart-dialog/projects';
3
+ import { SmartAbstractdialogService } from '../../../../smart-dialog/projects';
4
4
  import { Subject } from 'rxjs';
5
5
  import { UiAction } from '../../../api';
6
6
  import * as i0 from "@angular/core";
7
- export declare class UiActionConfirmDialogService extends SmartdialogService {
7
+ export declare class UiActionConfirmDialogService extends SmartAbstractdialogService {
8
8
  _destroy$: Subject<void>;
9
9
  action: UiAction;
10
10
  onAction: Subject<void>;
@@ -1,10 +1,10 @@
1
1
  import { MatDialog } from '@angular/material/dialog';
2
2
  import { Router } from '@angular/router';
3
- import { SmartdialogService } from '../../../../smart-dialog/projects';
3
+ import { SmartAbstractdialogService } from '../../../../smart-dialog/projects';
4
4
  import { Subject } from 'rxjs';
5
5
  import { UiAction } from '../../../api';
6
6
  import * as i0 from "@angular/core";
7
- export declare class UiActionFileUploadDialogService extends SmartdialogService {
7
+ export declare class UiActionFileUploadDialogService extends SmartAbstractdialogService {
8
8
  _destroy$: Subject<void>;
9
9
  inputTypeName: 'inputDialog' | 'input2Dialog';
10
10
  action: UiAction;
@@ -1,10 +1,10 @@
1
1
  import { MatDialog } from '@angular/material/dialog';
2
2
  import { Router } from '@angular/router';
3
- import { SmartdialogService } from '../../../../smart-dialog/projects';
3
+ import { SmartAbstractdialogService } from '../../../../smart-dialog/projects';
4
4
  import { Subject } from 'rxjs';
5
5
  import { UiAction, UiActionRequest } from '../../../api';
6
6
  import * as i0 from "@angular/core";
7
- export declare class UiActionInputDialogService extends SmartdialogService {
7
+ export declare class UiActionInputDialogService extends SmartAbstractdialogService {
8
8
  _destroy$: Subject<void>;
9
9
  inputTypeName: 'inputDialog' | 'input2Dialog';
10
10
  action: UiAction;
@@ -0,0 +1,18 @@
1
+ import { ComponentType } from '@angular/cdk/portal';
2
+ import { MatDialog, MatDialogRef } from '@angular/material/dialog';
3
+ import { Router } from '@angular/router';
4
+ import { SmartDialogData } from '../smart-dialog/smartdialog.model';
5
+ import * as i0 from "@angular/core";
6
+ export declare class SmartdialogService {
7
+ protected dialog: MatDialog;
8
+ protected router: Router;
9
+ private constructor();
10
+ createDialog(smartDialog: SmartDialogData, component: ComponentType<any>): MatDialogRef<any, any>;
11
+ createDialogRef(smartDialog: SmartDialogData, component: ComponentType<any>): MatDialogRef<any, any>;
12
+ openComponentAsDialog(component: ComponentType<any>, viewName: string): MatDialogRef<any, any>;
13
+ handleAfterClosed(result: any): void;
14
+ openDialog(): void;
15
+ closeDialog(dialogRef: MatDialogRef<any, any>, dialogData: SmartDialogData): Promise<void>;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<SmartdialogService, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<SmartdialogService>;
18
+ }
@@ -3,9 +3,9 @@ import { Router } from '@angular/router';
3
3
  import { ViewApiError } from '../api';
4
4
  import { SmartViewContextApiError } from '../smart-view-context.model';
5
5
  import { SmartViewContextService } from '../smart-view-context.service';
6
- import { SmartdialogService } from '../../smart-dialog/projects';
6
+ import { SmartAbstractdialogService } from '../../smart-dialog/projects';
7
7
  import * as i0 from "@angular/core";
8
- export declare class SmartViewContextErrorDialogService extends SmartdialogService {
8
+ export declare class SmartViewContextErrorDialogService extends SmartAbstractdialogService {
9
9
  private viewContext;
10
10
  viewApiError?: ViewApiError;
11
11
  dialogRefs: MatDialogRef<any, any>[];
@@ -5,7 +5,7 @@ import { ComponentModel, DataChange, Link, MessageData, MessageResult, UiActionD
5
5
  import { SmartTranslateService, SmartViewContextApiError, SmartViewContextApiErrors, SmartViewHandlerModel } from './smart-view-context.model';
6
6
  import { SmartSubject } from '../smart-subject/projects';
7
7
  import { SmartNavigationService } from '../smart-navigation/projects';
8
- import { SmartdialogService } from '../smart-dialog/projects';
8
+ import { SmartdialogService } from './smart-view-context-dialog.service';
9
9
  import * as i0 from "@angular/core";
10
10
  export declare const SmartViewContextErrorDialogButtonLabel = "SmartViewContextErrorDialogButtonLabel";
11
11
  export declare const SmartViewContextErrorDialogTitle = "SmartViewContextErrorDialogTitle";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartbit4all/ng-client",
3
- "version": "3.0.28",
3
+ "version": "3.0.30",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^13.3.9",
6
6
  "@angular/common": "^13.2.0",
@@ -4,7 +4,7 @@
4
4
 
5
5
  These packages must be updated in case of a new version:
6
6
 
7
- - [_@smartbit4all/view-context_](https://www.npmjs.com/package/@smartbit4all/view-context)
7
+ - [_@smartbit4all/view-context_](https://www.npmjs.com/package/@smartbit4all/view-context)
8
8
 
9
9
  ---
10
10
 
@@ -41,11 +41,11 @@ If you **do not** use the **`SmartViewContext`** package in your project **or th
41
41
 
42
42
  Create a component for the content of the dialog. In the folder of the component create an Angular Service.
43
43
 
44
- - src/app/.../example-dialog/
45
- - example-dialog.component.css
46
- - example-dialog.component.html
47
- - example-dialog.component.ts
48
- - example-dialog.service.ts
44
+ - src/app/.../example-dialog/
45
+ - example-dialog.component.css
46
+ - example-dialog.component.html
47
+ - example-dialog.component.ts
48
+ - example-dialog.service.ts
49
49
 
50
50
  Extend your service with the `SmartdialogService`. You can see an example for a specific service belove.
51
51
 
@@ -54,7 +54,7 @@ Extend your service with the `SmartdialogService`. You can see an example for a
54
54
  @Injectable({
55
55
  providedIn: 'root'
56
56
  })
57
- export class ExampleDialogService extends SmartdialogService {
57
+ export class ExampleDialogService extends SmartAbstractdialogService {
58
58
  constructor(
59
59
  dialog: MatDialog,
60
60
  router: Router
@@ -187,8 +187,8 @@ The versions of the SmartForm and the SmartTable have been updated.
187
187
 
188
188
  **New versions:**
189
189
 
190
- - @smartbit4all/form: v0.1.1
191
- - @smartbit4all/table: v0.1.3
190
+ - @smartbit4all/form: v0.1.1
191
+ - @smartbit4all/table: v0.1.3
192
192
 
193
193
  ## @smartbit4all/dialog v0.0.1
194
194
 
@@ -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