@smartbit4all/ng-client 3.1.58 → 3.1.60
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/smart-filter-editor/api/api/filter.service.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/configuration.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/encoder.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBoolOperator.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderApiConfig.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderField.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderGroup.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderModel.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionBuilderUiModel.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionData.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionDataType.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionField.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldEditor.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldList.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionFieldWidgetType.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionList.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionOperandData.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/model/filterExpressionOperation.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/param.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/api/variables.mjs +1 -1
- package/esm2020/lib/smart-filter-editor/smart-filter-params/smart-filter-params.component.mjs +3 -3
- 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/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/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/gridColumnMeta.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/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 +3 -2
- 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-grid/models/model.mjs +8 -1
- package/esm2020/lib/smart-grid/smart-grid.component.mjs +143 -5
- package/esm2020/lib/smart-grid/smart-grid.module.mjs +9 -1
- package/esm2020/lib/view-context/api/api/view.service.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uploadedFile.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewEventHandler.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/genericValue.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/models.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/value.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetData.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetDefinition.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetDefinitionData.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetDefinitionIdentifier.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetDefinitionKind.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetExpression.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetOperand.mjs +1 -1
- package/esm2020/lib/view-context/value-api/model/valueSetOperation.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 +162 -10
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +156 -9
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/smart-grid/api/grid-api/model/gridRow.d.ts +12 -0
- package/lib/smart-grid/api/grid-api/model/gridViewDescriptor.d.ts +5 -1
- package/lib/smart-grid/models/model.d.ts +2 -1
- package/lib/smart-grid/smart-grid.component.d.ts +24 -0
- package/lib/smart-grid/smart-grid.module.d.ts +7 -5
- package/package.json +1 -1
- package/smartbit4all-ng-client-3.1.60.tgz +0 -0
- package/src/lib/smart-filter-editor/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/value-api/README.md +226 -226
- package/smartbit4all-ng-client-3.1.58.tgz +0 -0
|
@@ -23,4 +23,16 @@ export interface GridRow {
|
|
|
23
23
|
icons: {
|
|
24
24
|
[key: string]: ImageResource;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* If the grid can be hierarchical then the parent contains the identifiers of the parent row.
|
|
28
|
+
*/
|
|
29
|
+
parent?: string;
|
|
30
|
+
/**
|
|
31
|
+
* If the grid can be hierarchical then the children list contains the identifiers of the children rows. The rows are not necessarily included in the page but the client can ask for this. The children is not required to see if it is empty or not set.
|
|
32
|
+
*/
|
|
33
|
+
children?: Array<string>;
|
|
34
|
+
/**
|
|
35
|
+
* If the grid can be hierarchical then this property shows this row\'s level. It\'s not necessary to fill this value on the server side, client will calculate it.
|
|
36
|
+
*/
|
|
37
|
+
level?: number;
|
|
26
38
|
}
|
|
@@ -19,6 +19,9 @@ export interface GridViewDescriptor {
|
|
|
19
19
|
label?: string;
|
|
20
20
|
icon?: string;
|
|
21
21
|
kind?: GridViewDescriptor.KindEnum;
|
|
22
|
+
/**
|
|
23
|
+
* In the table the columns are the columns of the table. In the tree the columns can be used to append the title of a tree node.
|
|
24
|
+
*/
|
|
22
25
|
columns: Array<GridColumnMeta>;
|
|
23
26
|
selectionMode?: GridSelectionMode;
|
|
24
27
|
selectionType?: GridSelectionType;
|
|
@@ -26,9 +29,10 @@ export interface GridViewDescriptor {
|
|
|
26
29
|
showEditColumns?: boolean;
|
|
27
30
|
}
|
|
28
31
|
export declare namespace GridViewDescriptor {
|
|
29
|
-
type KindEnum = 'TABLE' | 'EXPANDABLECARDS1';
|
|
32
|
+
type KindEnum = 'TABLE' | 'EXPANDABLECARDS1' | 'TREE';
|
|
30
33
|
const KindEnum: {
|
|
31
34
|
Table: KindEnum;
|
|
32
35
|
Expandablecards1: KindEnum;
|
|
36
|
+
Tree: KindEnum;
|
|
33
37
|
};
|
|
34
38
|
}
|
|
@@ -9,6 +9,8 @@ import { SmartGridService } from './smart-grid.service';
|
|
|
9
9
|
import { ExpandableSection } from '../smart-expandable-section/projects';
|
|
10
10
|
import { ComponentFactoryService } from '../component-factory-service/projects';
|
|
11
11
|
import { MatDialog } from '@angular/material/dialog';
|
|
12
|
+
import { FlatTreeControl } from '@angular/cdk/tree';
|
|
13
|
+
import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
|
|
12
14
|
import * as i0 from "@angular/core";
|
|
13
15
|
export declare class SmartGridComponent implements AfterViewInit, OnDestroy, OnChanges {
|
|
14
16
|
private service;
|
|
@@ -35,6 +37,10 @@ export declare class SmartGridComponent implements AfterViewInit, OnDestroy, OnC
|
|
|
35
37
|
uiActionDescriptors: Map<string, any>;
|
|
36
38
|
afterViewInitExecuted: boolean;
|
|
37
39
|
isBlocked: boolean;
|
|
40
|
+
treeControl?: FlatTreeControl<GridRow>;
|
|
41
|
+
treeFlattener?: MatTreeFlattener<GridRow, GridRow>;
|
|
42
|
+
treeDataSource?: MatTreeFlatDataSource<GridRow, GridRow>;
|
|
43
|
+
treeChecklistSelection?: SelectionModel<GridRow>;
|
|
38
44
|
constructor(service: SmartGridService, cfService: ComponentFactoryService, dialog: MatDialog);
|
|
39
45
|
ngOnChanges(changes: SimpleChanges): void;
|
|
40
46
|
ngOnDestroy(): void;
|
|
@@ -55,6 +61,22 @@ export declare class SmartGridComponent implements AfterViewInit, OnDestroy, OnC
|
|
|
55
61
|
expandAsync(rowIndex: number): Promise<any>;
|
|
56
62
|
private renderExpandableSections;
|
|
57
63
|
private renderCards;
|
|
64
|
+
private renderTree;
|
|
65
|
+
getLevel: (node: GridRow) => number;
|
|
66
|
+
isExpandable: (node: GridRow) => boolean;
|
|
67
|
+
getChildren: (node: GridRow) => GridRow[];
|
|
68
|
+
hasChild: (_: number, _nodeData: GridRow) => boolean;
|
|
69
|
+
transformer: (row: GridRow, level: number) => GridRow;
|
|
70
|
+
getTreeItem(row: GridRow): string;
|
|
71
|
+
/** Toggle the treeNode selection. Select/deselect all the descendants node */
|
|
72
|
+
treeNodeSelectionToggle(node: GridRow): void;
|
|
73
|
+
checkAllParentsSelection(node: GridRow): void;
|
|
74
|
+
checkParentNodeSelection(node: GridRow): void;
|
|
75
|
+
getParentNode(node: GridRow): GridRow | null;
|
|
76
|
+
/** Whether all the descendants of the node are selected. */
|
|
77
|
+
descendantsAllSelected(node: GridRow): boolean;
|
|
78
|
+
/** Whether part of the descendants are selected */
|
|
79
|
+
descendantsPartiallySelected(node: GridRow): boolean;
|
|
58
80
|
private constructHeader;
|
|
59
81
|
onChangePage(event: PageEvent): Promise<void>;
|
|
60
82
|
private execute;
|
|
@@ -64,6 +86,8 @@ export declare class SmartGridComponent implements AfterViewInit, OnDestroy, OnC
|
|
|
64
86
|
onDoubleClick(gridRow: GridRow): void;
|
|
65
87
|
private handleOnClick;
|
|
66
88
|
private onSelect;
|
|
89
|
+
private onSelectInternal;
|
|
90
|
+
private onSelectList;
|
|
67
91
|
private onSelectAll;
|
|
68
92
|
editColumns(): void;
|
|
69
93
|
static ɵfac: i0.ɵɵFactoryDeclaration<SmartGridComponent, never>;
|
|
@@ -9,12 +9,14 @@ import * as i7 from "../smart-table/smarttable.module";
|
|
|
9
9
|
import * as i8 from "@angular/material/icon";
|
|
10
10
|
import * as i9 from "@angular/material/button";
|
|
11
11
|
import * as i10 from "@angular/material/paginator";
|
|
12
|
-
import * as i11 from "
|
|
13
|
-
import * as i12 from "@angular/
|
|
14
|
-
import * as i13 from "../smart-
|
|
15
|
-
import * as i14 from "@angular/
|
|
12
|
+
import * as i11 from "@angular/material/tree";
|
|
13
|
+
import * as i12 from "@angular/material/checkbox";
|
|
14
|
+
import * as i13 from "../smart-expandable-section/smart-expandable-section.module";
|
|
15
|
+
import * as i14 from "@angular/cdk/drag-drop";
|
|
16
|
+
import * as i15 from "../smart-form/smartform.module";
|
|
17
|
+
import * as i16 from "@angular/material/select";
|
|
16
18
|
export declare class SmartGridModule {
|
|
17
19
|
static ɵfac: i0.ɵɵFactoryDeclaration<SmartGridModule, never>;
|
|
18
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<SmartGridModule, [typeof i1.SmartGridComponent, typeof i2.SmartGridCardComponent, typeof i3.ExpandableGridComponent, typeof i4.TableLayoutDefinerComponent], [typeof i5.BrowserModule, typeof i6.SmartIconModule, typeof i7.SmarttableModule, typeof i8.MatIconModule, typeof i9.MatButtonModule, typeof i10.MatPaginatorModule, typeof i11.
|
|
20
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SmartGridModule, [typeof i1.SmartGridComponent, typeof i2.SmartGridCardComponent, typeof i3.ExpandableGridComponent, typeof i4.TableLayoutDefinerComponent], [typeof i5.BrowserModule, typeof i6.SmartIconModule, typeof i7.SmarttableModule, typeof i8.MatIconModule, typeof i9.MatButtonModule, typeof i10.MatPaginatorModule, typeof i11.MatTreeModule, typeof i12.MatCheckboxModule, typeof i13.SmartExpandableSectionModule, typeof i14.DragDropModule, typeof i15.SmartformModule, typeof i16.MatSelectModule], [typeof i1.SmartGridComponent]>;
|
|
19
21
|
static ɵinj: i0.ɵɵInjectorDeclaration<SmartGridModule>;
|
|
20
22
|
}
|
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
|