@bpost/bp-address-auto-complete-by-component 1.1.9 → 1.1.11
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/README.md +1 -1
- package/VERSION.md +209 -0
- package/esm2020/lib/lib-address-autocomplete-by-component.component.mjs +2 -2
- package/fesm2015/bpost-bp-address-auto-complete-by-component.mjs +1 -1
- package/fesm2015/bpost-bp-address-auto-complete-by-component.mjs.map +1 -1
- package/fesm2020/bpost-bp-address-auto-complete-by-component.mjs +1 -1
- package/fesm2020/bpost-bp-address-auto-complete-by-component.mjs.map +1 -1
- package/install-and-start-demo.bat +11 -0
- package/package.json +1 -1
- package/tutorial/tutorial/aacwidget-tutorial/.editorconfig +16 -0
- package/tutorial/tutorial/aacwidget-tutorial/README.md +27 -0
- package/tutorial/tutorial/aacwidget-tutorial/angular.json +128 -0
- package/tutorial/tutorial/aacwidget-tutorial/browserslist +13 -0
- package/tutorial/tutorial/aacwidget-tutorial/e2e/protractor.conf.js +32 -0
- package/tutorial/tutorial/aacwidget-tutorial/e2e/src/app.e2e-spec.ts +23 -0
- package/tutorial/tutorial/aacwidget-tutorial/e2e/src/app.po.ts +11 -0
- package/tutorial/tutorial/aacwidget-tutorial/e2e/tsconfig.json +13 -0
- package/tutorial/tutorial/aacwidget-tutorial/karma.conf.js +32 -0
- package/tutorial/tutorial/aacwidget-tutorial/package-lock.json +13314 -0
- package/tutorial/tutorial/aacwidget-tutorial/package.json +49 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/app-routing.module.ts +18 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/app.component.html +6 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/app.component.scss +0 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/app.component.spec.ts +35 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/app.component.ts +28 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/app.module.ts +47 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/widget-full/widget-full.component.html +57 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/widget-full/widget-full.component.scss +0 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/widget-full/widget-full.component.ts +160 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/widget-simple/widget-simple.component.html +20 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/widget-simple/widget-simple.component.scss +0 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/widget-simple/widget-simple.component.spec.ts +25 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/app/widget-simple/widget-simple.component.ts +49 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/assets/.gitkeep +0 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/assets/aacwidget/i18n/de.json +62 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/assets/aacwidget/i18n/en.json +62 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/assets/aacwidget/i18n/fr.json +62 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/assets/aacwidget/i18n/nl.json +62 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/assets/aacwidget/scss/aacwidget-custom.scss +81 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/assets/aacwidget/scss/aacwidget-default.scss +424 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/environments/environment.prod.ts +3 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/environments/environment.ts +16 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/favicon.ico +0 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/index.html +45 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/main.ts +12 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/polyfills.ts +63 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/styles.scss +4 -0
- package/tutorial/tutorial/aacwidget-tutorial/src/test.ts +25 -0
- package/tutorial/tutorial/aacwidget-tutorial/tsconfig.app.json +15 -0
- package/tutorial/tutorial/aacwidget-tutorial/tsconfig.json +23 -0
- package/tutorial/tutorial/aacwidget-tutorial/tsconfig.spec.json +18 -0
- package/tutorial/tutorial/aacwidget-tutorial/tslint.json +148 -0
- package/tutorial/tutorial/tutorial-videos.txt +41 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "aacwidget-demo",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"ng": "ng",
|
|
6
|
+
"start": "ng serve",
|
|
7
|
+
"build": "ng build",
|
|
8
|
+
"test": "ng test",
|
|
9
|
+
"lint": "ng lint",
|
|
10
|
+
"e2e": "ng e2e"
|
|
11
|
+
},
|
|
12
|
+
"private": true,
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@angular/animations": "~9.1.9",
|
|
15
|
+
"@angular/common": "~9.1.9",
|
|
16
|
+
"@angular/compiler": "~9.1.9",
|
|
17
|
+
"@angular/core": "~9.1.9",
|
|
18
|
+
"@angular/forms": "~9.1.9",
|
|
19
|
+
"@angular/platform-browser": "~9.1.9",
|
|
20
|
+
"@angular/platform-browser-dynamic": "~9.1.9",
|
|
21
|
+
"@angular/router": "~9.1.9",
|
|
22
|
+
"@bpost/bp-address-auto-complete-by-component": "^1.0.3",
|
|
23
|
+
"@ngx-translate/core": "^12.1.2",
|
|
24
|
+
"ngx-translate-multi-http-loader": "^3.0.0",
|
|
25
|
+
"rxjs": "~6.5.4",
|
|
26
|
+
"tslib": "^1.10.0",
|
|
27
|
+
"zone.js": "~0.10.2"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@angular-devkit/build-angular": "~0.901.7",
|
|
31
|
+
"@angular/cli": "~9.1.7",
|
|
32
|
+
"@angular/compiler-cli": "~9.1.9",
|
|
33
|
+
"@types/node": "^12.11.1",
|
|
34
|
+
"@types/jasmine": "~3.5.0",
|
|
35
|
+
"@types/jasminewd2": "~2.0.3",
|
|
36
|
+
"codelyzer": "^5.1.2",
|
|
37
|
+
"jasmine-core": "~3.5.0",
|
|
38
|
+
"jasmine-spec-reporter": "~4.2.1",
|
|
39
|
+
"karma": "~5.0.0",
|
|
40
|
+
"karma-chrome-launcher": "~3.1.0",
|
|
41
|
+
"karma-coverage-istanbul-reporter": "~2.1.0",
|
|
42
|
+
"karma-jasmine": "~3.0.1",
|
|
43
|
+
"karma-jasmine-html-reporter": "^1.4.2",
|
|
44
|
+
"protractor": "~7.0.0",
|
|
45
|
+
"ts-node": "~8.3.0",
|
|
46
|
+
"tslint": "~6.1.0",
|
|
47
|
+
"typescript": "~3.8.3"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { Routes, RouterModule } from '@angular/router';
|
|
3
|
+
import { AppComponent } from './app.component';
|
|
4
|
+
import { WidgetSimpleComponent } from './widget-simple/widget-simple.component';
|
|
5
|
+
import { WidgetFullComponent } from './widget-full/widget-full.component';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const routes: Routes = [
|
|
9
|
+
{ path: 'widgetFull', component: WidgetFullComponent},
|
|
10
|
+
{ path: 'widgetSimple', component: WidgetSimpleComponent},
|
|
11
|
+
{ path: '*.*', component: AppComponent},
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
@NgModule({
|
|
15
|
+
imports: [RouterModule.forRoot(routes)],
|
|
16
|
+
exports: [RouterModule]
|
|
17
|
+
})
|
|
18
|
+
export class AppRoutingModule { }
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TestBed, async } from '@angular/core/testing';
|
|
2
|
+
import { RouterTestingModule } from '@angular/router/testing';
|
|
3
|
+
import { AppComponent } from './app.component';
|
|
4
|
+
|
|
5
|
+
describe('AppComponent', () => {
|
|
6
|
+
beforeEach(async(() => {
|
|
7
|
+
TestBed.configureTestingModule({
|
|
8
|
+
imports: [
|
|
9
|
+
RouterTestingModule
|
|
10
|
+
],
|
|
11
|
+
declarations: [
|
|
12
|
+
AppComponent
|
|
13
|
+
],
|
|
14
|
+
}).compileComponents();
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
it('should create the app', () => {
|
|
18
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
19
|
+
const app = fixture.componentInstance;
|
|
20
|
+
expect(app).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it(`should have as title 'aacwidget-demo'`, () => {
|
|
24
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
25
|
+
const app = fixture.componentInstance;
|
|
26
|
+
expect(app.title).toEqual('aacwidget-demo');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should render title', () => {
|
|
30
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
31
|
+
fixture.detectChanges();
|
|
32
|
+
const compiled = fixture.nativeElement;
|
|
33
|
+
expect(compiled.querySelector('.content span').textContent).toContain('aacwidget-demo app is running!');
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { Router } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-root',
|
|
7
|
+
templateUrl: './app.component.html',
|
|
8
|
+
styleUrls: ['./app.component.scss']
|
|
9
|
+
})
|
|
10
|
+
export class AppComponent
|
|
11
|
+
{
|
|
12
|
+
title = 'aacwidget-demo';
|
|
13
|
+
|
|
14
|
+
constructor(
|
|
15
|
+
private router: Router,
|
|
16
|
+
) {}
|
|
17
|
+
|
|
18
|
+
onShowWidgetSimple()
|
|
19
|
+
{
|
|
20
|
+
this.router.navigate(['widgetSimple']);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onShowWidgetFull()
|
|
24
|
+
{
|
|
25
|
+
this.router.navigate(['widgetFull']);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { HttpClient } from '@angular/common/http';
|
|
4
|
+
|
|
5
|
+
import { AppRoutingModule } from './app-routing.module';
|
|
6
|
+
import { AppComponent } from './app.component';
|
|
7
|
+
import { WidgetSimpleComponent } from './widget-simple/widget-simple.component';
|
|
8
|
+
|
|
9
|
+
import { LibAddressAutocompleteByComponentModule } from '@bpost/bp-address-auto-complete-by-component';
|
|
10
|
+
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
11
|
+
import { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';
|
|
12
|
+
import { WidgetFullComponent } from './widget-full/widget-full.component';
|
|
13
|
+
|
|
14
|
+
export function HttpLoaderFactory(http: HttpClient) {
|
|
15
|
+
// const i18nResourcePath = environment.i18nResourcePath;
|
|
16
|
+
return new MultiTranslateHttpLoader(http, [
|
|
17
|
+
{prefix: './assets/i18n/', suffix: '.json'},
|
|
18
|
+
{prefix: './assets/aacwidget/i18n/', suffix: '.json'}
|
|
19
|
+
// {prefix: /*'./shared/assets/i18n/'*/ i18nResourcePath, suffix: '.json'},
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@NgModule({
|
|
24
|
+
declarations: [
|
|
25
|
+
AppComponent,
|
|
26
|
+
WidgetSimpleComponent,
|
|
27
|
+
WidgetFullComponent,
|
|
28
|
+
],
|
|
29
|
+
imports: [
|
|
30
|
+
BrowserModule,
|
|
31
|
+
|
|
32
|
+
TranslateModule.forRoot({
|
|
33
|
+
defaultLanguage: 'en',
|
|
34
|
+
loader: {
|
|
35
|
+
provide: TranslateLoader,
|
|
36
|
+
useFactory: HttpLoaderFactory,
|
|
37
|
+
deps: [HttpClient]
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
|
|
41
|
+
LibAddressAutocompleteByComponentModule,
|
|
42
|
+
AppRoutingModule
|
|
43
|
+
],
|
|
44
|
+
providers: [],
|
|
45
|
+
bootstrap: [AppComponent]
|
|
46
|
+
})
|
|
47
|
+
export class AppModule { }
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<p>widget-full works!</p>
|
|
2
|
+
|
|
3
|
+
<br>
|
|
4
|
+
<button type="button" (click)="onSelectLanguage('fr')">FR</button>
|
|
5
|
+
|
|
6
|
+
<button type="button" (click)="onSelectLanguage('nl')">NL</button>
|
|
7
|
+
|
|
8
|
+
<button type="button" (click)="onSelectLanguage('en')">EN</button>
|
|
9
|
+
|
|
10
|
+
<button type="button" (click)="onSelectLanguage('de')">DE</button>
|
|
11
|
+
|
|
12
|
+
<button type="button" (click)="onSelectLanguage('browser')">Browser</button>
|
|
13
|
+
|
|
14
|
+
<br>
|
|
15
|
+
|
|
16
|
+
<button type="button" (click)="onNotInListToggle()">Toggle 'NotInList'</button> <span>{{ notInListAllowed }}</span>
|
|
17
|
+
<br>
|
|
18
|
+
<button type="button" (click)="onPrefillWithUnstructuredData()">Prefill With Unstructured Data</button>
|
|
19
|
+
|
|
20
|
+
<button type="button" (click)="onPrefillWithStructuredData()">Prefill With structured Data</button>
|
|
21
|
+
|
|
22
|
+
<br>
|
|
23
|
+
|
|
24
|
+
<bp-lib-address-autocomplete-by-component
|
|
25
|
+
[defaultLang]="defaultLanguage"
|
|
26
|
+
[inputLang]="selectedLanguage"
|
|
27
|
+
[validationMessageOption]="validationMessageOption"
|
|
28
|
+
[notInListAllowed]="notInListAllowed"
|
|
29
|
+
[minLevel]="minLevel"
|
|
30
|
+
[addressParams]="prefilledParameters"
|
|
31
|
+
|
|
32
|
+
(addressCompleteEventEmitter)="onAddressComplete($event)"
|
|
33
|
+
(clearInputEventEmitter)="onClearInputEventMessage($event)"
|
|
34
|
+
(validationMessageEventEmitter)="onAddressValidationMessage($event)"
|
|
35
|
+
|
|
36
|
+
[localityUrl] = "localityUrl"
|
|
37
|
+
[maxSuggestionLocality]="maxSuggestionLocality"
|
|
38
|
+
[visibleSuggestionLocalityCount]="visibleSuggestionLocalityCount"
|
|
39
|
+
[sortCriteriaLocality]="sortCriteriaLocality"
|
|
40
|
+
[messageOption]="messageOption"
|
|
41
|
+
|
|
42
|
+
[streetUrl] = "streetUrl"
|
|
43
|
+
[maxSuggestionStreet]="maxSuggestionStreet"
|
|
44
|
+
[visibleSuggestionStreetCount]="visibleSuggestionStreetCount"
|
|
45
|
+
[sortCriteriaStreet]="sortCriteriaStreet"
|
|
46
|
+
|
|
47
|
+
[streetNumberUrl] = "streetNumberUrl"
|
|
48
|
+
[maxSuggestionStreetNb]="maxSuggestionStreetNb"
|
|
49
|
+
[visibleSuggestionStreetNbCount]="visibleSuggestionStreetNbCount"
|
|
50
|
+
[sortCriteriaStreetNb]="sortCriteriaStreetNb"
|
|
51
|
+
|
|
52
|
+
[boxNumberUrl] = "boxNumberUrl"
|
|
53
|
+
[maxSuggestionBoxNb]="maxSuggestionBoxNb"
|
|
54
|
+
[visibleSuggestionBoxNbCount]="visibleSuggestionBoxNbCount"
|
|
55
|
+
[sortCriteriaBoxNb]="sortCriteriaBoxNb"
|
|
56
|
+
|
|
57
|
+
></bp-lib-address-autocomplete-by-component>
|
|
File without changes
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import { PrefilledParameters, ValidationMessageOptionType } from '@bpost/bp-address-auto-complete-by-component';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-widget-full',
|
|
9
|
+
templateUrl: './widget-full.component.html',
|
|
10
|
+
styleUrls: ['./widget-full.component.scss']
|
|
11
|
+
})
|
|
12
|
+
export class WidgetFullComponent implements OnInit {
|
|
13
|
+
|
|
14
|
+
defaultLanguage = 'en';
|
|
15
|
+
|
|
16
|
+
selectedLanguage: string;
|
|
17
|
+
|
|
18
|
+
defaultValidationMessageOptionType = ValidationMessageOptionType.EMIT;
|
|
19
|
+
validationMessageOption = {validationType: this.defaultValidationMessageOptionType, timestamp: new Date() };
|
|
20
|
+
|
|
21
|
+
// The 'not in list' feature, if allowed, is only available for the street number and box number address element
|
|
22
|
+
// By default, that feature is allowed.
|
|
23
|
+
notInListAllowed = true;
|
|
24
|
+
//
|
|
25
|
+
minLevel: number;
|
|
26
|
+
prefilledParameters: PrefilledParameters;
|
|
27
|
+
|
|
28
|
+
// Imposed and mandatory values
|
|
29
|
+
// Don't change these values untill bpost ask for!
|
|
30
|
+
localityUrl = 'https://webservices-pub.bpost.be/ws/ExternalMailingAddressProofingCSREST_v1/address/autocomplete/locality';
|
|
31
|
+
streetUrl = 'https://webservices-pub.bpost.be/ws/ExternalMailingAddressProofingCSREST_v1/address/autocomplete/street';
|
|
32
|
+
streetNumberUrl = 'https://webservices-pub.bpost.be/ws/ExternalMailingAddressProofingCSREST_v1/address/autocomplete/streetNumber';
|
|
33
|
+
boxNumberUrl = 'https://webservices-pub.bpost.be/ws/ExternalMailingAddressProofingCSREST_v1/address/autocomplete/boxNumber';
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
// LOCALITY
|
|
37
|
+
maxSuggestionLocality = 5;
|
|
38
|
+
visibleSuggestionLocalityCount = 5;
|
|
39
|
+
sortCriteriaLocality = '';
|
|
40
|
+
messageOption = 'Y';
|
|
41
|
+
// Fixed enumeration
|
|
42
|
+
localitySortCriterias: Array<object> = [
|
|
43
|
+
{ id: '', name: 'Server Decides' },
|
|
44
|
+
{ id: 'P', name: 'Postal Codes' },
|
|
45
|
+
{ id: 'L', name: 'Locality' },
|
|
46
|
+
];
|
|
47
|
+
// Fixed enumerations
|
|
48
|
+
messageOptions: Array<object> = [
|
|
49
|
+
{ id: 'Y', name: 'ON' },
|
|
50
|
+
{ id: 'P', name: 'ON(P)' },
|
|
51
|
+
{ id: 'N', name: 'OFF' }
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
// STREET
|
|
56
|
+
maxSuggestionStreet = 5;
|
|
57
|
+
visibleSuggestionStreetCount = 5;
|
|
58
|
+
sortCriteriaStreet = '';
|
|
59
|
+
streetSortCriterias: Array<object> = [
|
|
60
|
+
{ id: '', name: 'Server Decides' },
|
|
61
|
+
{ id: 'S', name: 'Street Names' }
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
// STREET NUMBER
|
|
66
|
+
maxSuggestionStreetNb = 5;
|
|
67
|
+
visibleSuggestionStreetNbCount = 5;
|
|
68
|
+
sortCriteriaStreetNb = '';
|
|
69
|
+
// Fixed enumeration
|
|
70
|
+
streetNbSortCriterias: Array<object> = [
|
|
71
|
+
{ id: '', name: 'Server Decides' },
|
|
72
|
+
{ id: 'S', name: 'Street Numbers' }
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
// BOX NUMBER
|
|
77
|
+
maxSuggestionBoxNb = 5;
|
|
78
|
+
visibleSuggestionBoxNbCount = 5;
|
|
79
|
+
sortCriteriaBoxNb = '';
|
|
80
|
+
// Fixed enumeration
|
|
81
|
+
boxNbSortCriterias: Array<object> = [
|
|
82
|
+
{ id: '', name: 'Server Decides' },
|
|
83
|
+
{ id: 'B', name: 'Box Numbers' }
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
constructor(
|
|
87
|
+
private translate: TranslateService,
|
|
88
|
+
) { }
|
|
89
|
+
|
|
90
|
+
ngOnInit(): void {
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
onAddressComplete(event)
|
|
94
|
+
{
|
|
95
|
+
console.log('address complete event message', event);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
onClearInputEventMessage(event)
|
|
99
|
+
{
|
|
100
|
+
console.log('address clear input message', event);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
onAddressValidationMessage(event)
|
|
104
|
+
{
|
|
105
|
+
console.log('address system message', event);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
onSelectLanguage(lang: string)
|
|
109
|
+
{
|
|
110
|
+
if (lang === 'browser') {
|
|
111
|
+
const browserLang = this.translate.getBrowserLang();
|
|
112
|
+
this.translate.use(browserLang);
|
|
113
|
+
this.selectedLanguage = browserLang;
|
|
114
|
+
} else {
|
|
115
|
+
this.translate.use(lang);
|
|
116
|
+
this.selectedLanguage = lang;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
onNotInListToggle()
|
|
122
|
+
{
|
|
123
|
+
this.notInListAllowed = !this.notInListAllowed;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Element minLevel
|
|
127
|
+
// --------------------------
|
|
128
|
+
// Locality 4
|
|
129
|
+
// Street 3
|
|
130
|
+
// Street number 2
|
|
131
|
+
// Box number 1
|
|
132
|
+
// --------------------------
|
|
133
|
+
onPrefillWithUnstructuredData()
|
|
134
|
+
{
|
|
135
|
+
// limited to the postal code and locality as a single string
|
|
136
|
+
this.prefilledParameters = new PrefilledParameters(
|
|
137
|
+
{
|
|
138
|
+
unstructuredAddress: 'Jemelle 5580' // '5580 Jemelle'
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
this.minLevel = 4;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// volklorenlaan 21, 5 - 2610 Wilrijk
|
|
145
|
+
onPrefillWithStructuredData()
|
|
146
|
+
{
|
|
147
|
+
this.prefilledParameters = new PrefilledParameters(
|
|
148
|
+
{
|
|
149
|
+
municipalityName: 'Wilrijk',
|
|
150
|
+
postalCode: '2610',
|
|
151
|
+
streetName: 'volklorenlaan',
|
|
152
|
+
streetNumber: '',
|
|
153
|
+
boxNumber: '',
|
|
154
|
+
|
|
155
|
+
state: true
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
this.minLevel = this.prefilledParameters.minLevel;
|
|
159
|
+
}
|
|
160
|
+
}
|
package/tutorial/tutorial/aacwidget-tutorial/src/app/widget-simple/widget-simple.component.html
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<p>widget-simple works!</p>
|
|
2
|
+
|
|
3
|
+
<br>
|
|
4
|
+
<button type="button" (click)="onSelectLanguage('fr')">FR</button>
|
|
5
|
+
|
|
6
|
+
<button type="button" (click)="onSelectLanguage('nl')">NL</button>
|
|
7
|
+
|
|
8
|
+
<button type="button" (click)="onSelectLanguage('en')">EN</button>
|
|
9
|
+
|
|
10
|
+
<button type="button" (click)="onSelectLanguage('de')">DE</button>
|
|
11
|
+
|
|
12
|
+
<button type="button" (click)="onSelectLanguage('browser')">Browser</button>
|
|
13
|
+
|
|
14
|
+
<bp-lib-address-autocomplete-by-component
|
|
15
|
+
[defaultLang]="defaultLanguage"
|
|
16
|
+
[inputLang]="selectedLanguage"
|
|
17
|
+
(addressCompleteEventEmitter)="onAddressComplete($event)"
|
|
18
|
+
(clearInputEventEmitter)="onClearInputEventMessage($event)"
|
|
19
|
+
(validationMessageEventEmitter)="onAddressValidationMessage($event)"
|
|
20
|
+
></bp-lib-address-autocomplete-by-component>
|
package/tutorial/tutorial/aacwidget-tutorial/src/app/widget-simple/widget-simple.component.scss
ADDED
|
File without changes
|
package/tutorial/tutorial/aacwidget-tutorial/src/app/widget-simple/widget-simple.component.spec.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { WidgetSimpleComponent } from './widget-simple.component';
|
|
4
|
+
|
|
5
|
+
describe('WidgetSimpleComponent', () => {
|
|
6
|
+
let component: WidgetSimpleComponent;
|
|
7
|
+
let fixture: ComponentFixture<WidgetSimpleComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ WidgetSimpleComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(WidgetSimpleComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-widget-simple',
|
|
6
|
+
templateUrl: './widget-simple.component.html',
|
|
7
|
+
styleUrls: ['./widget-simple.component.scss']
|
|
8
|
+
})
|
|
9
|
+
export class WidgetSimpleComponent implements OnInit {
|
|
10
|
+
|
|
11
|
+
defaultLanguage = 'en';
|
|
12
|
+
|
|
13
|
+
selectedLanguage: string;
|
|
14
|
+
|
|
15
|
+
constructor(
|
|
16
|
+
private translate: TranslateService,
|
|
17
|
+
) { }
|
|
18
|
+
|
|
19
|
+
ngOnInit(): void {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
onAddressComplete(event)
|
|
23
|
+
{
|
|
24
|
+
console.log('address complete event message', event);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
onClearInputEventMessage(event)
|
|
28
|
+
{
|
|
29
|
+
console.log('address clear input message', event);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
onAddressValidationMessage(event)
|
|
33
|
+
{
|
|
34
|
+
console.log('address system message', event);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
onSelectLanguage(lang: string)
|
|
38
|
+
{
|
|
39
|
+
if (lang === 'browser') {
|
|
40
|
+
const browserLang = this.translate.getBrowserLang();
|
|
41
|
+
this.translate.use(browserLang);
|
|
42
|
+
this.selectedLanguage = browserLang;
|
|
43
|
+
} else {
|
|
44
|
+
this.translate.use(lang);
|
|
45
|
+
this.selectedLanguage = lang;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"common": {
|
|
3
|
+
"message": {
|
|
4
|
+
"address-not-found": "Adresse nicht erkannt.",
|
|
5
|
+
"address-validated": "Die Adresse wurde validiert",
|
|
6
|
+
"service-unavailable": "Der Dienst ist nicht verfügbar. Bitte versuchen Sie es später erneut."
|
|
7
|
+
},
|
|
8
|
+
"label": {
|
|
9
|
+
"boxNumber": "Boxnummer",
|
|
10
|
+
"streetNumber": "Hausnummer",
|
|
11
|
+
"municipalityName": "Gemeinde",
|
|
12
|
+
"postalCode": "Postleitzahl",
|
|
13
|
+
"streetName": "Straßennamen"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"locality": {
|
|
17
|
+
"placeholder": {
|
|
18
|
+
"input-placeholder": "Geben Sie eine Postleitzahl / einen Ort an ..."
|
|
19
|
+
},
|
|
20
|
+
"suggestion": {
|
|
21
|
+
"message": {
|
|
22
|
+
"subl": "<em>{{sub}}</em> ist eine Untergemeinde von <em>{{principal}}</em>"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"street": {
|
|
27
|
+
"placeholder": {
|
|
28
|
+
"input-placeholder": "Geben Sie einen Straßennamen an ..."
|
|
29
|
+
},
|
|
30
|
+
"suggestion": {
|
|
31
|
+
"message": {
|
|
32
|
+
"subl": "<em>{{sub}}</em> ist eine Untergemeinde von <em>{{principal}}</em>"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"streetNumber": {
|
|
37
|
+
"placeholder": {
|
|
38
|
+
"input-placeholder": "Geben Sie eine Hausnummer an ..."
|
|
39
|
+
},
|
|
40
|
+
"suggestion": {
|
|
41
|
+
"message": {
|
|
42
|
+
"subl": "<em>{{sub}}</em> ist eine Untergemeinde von <em>{{principal}}</em>"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"message": {
|
|
46
|
+
"not-in-list": "Die Hausnummer ist nicht in der Liste"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"boxNumber": {
|
|
50
|
+
"placeholder": {
|
|
51
|
+
"input-placeholder": "Geben Sie eine Boxnummer an ..."
|
|
52
|
+
},
|
|
53
|
+
"suggestion": {
|
|
54
|
+
"message": {
|
|
55
|
+
"subl": "<em>{{sub}}</em> ist eine Untergemeinde von <em>{{principal}}</em>"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"message": {
|
|
59
|
+
"not-in-list": "Die Boxnummer ist nicht in der Liste"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"common": {
|
|
3
|
+
"message": {
|
|
4
|
+
"address-not-found": "Address not recognized.",
|
|
5
|
+
"address-validated": "The address has been validated",
|
|
6
|
+
"service-unavailable": "The service could not be reached. Please try again later."
|
|
7
|
+
},
|
|
8
|
+
"label": {
|
|
9
|
+
"boxNumber": "box number",
|
|
10
|
+
"streetNumber": "house number",
|
|
11
|
+
"municipalityName": "municipality",
|
|
12
|
+
"postalCode": "postal code",
|
|
13
|
+
"streetName": "street name"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"locality": {
|
|
17
|
+
"placeholder": {
|
|
18
|
+
"input-placeholder": "Provide a postal code / locality..."
|
|
19
|
+
},
|
|
20
|
+
"suggestion": {
|
|
21
|
+
"message": {
|
|
22
|
+
"subl": "<em>{{sub}}</em> is a sub-municipality of <em>{{principal}}</em>"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"street": {
|
|
27
|
+
"placeholder": {
|
|
28
|
+
"input-placeholder": "Provide a streetName..."
|
|
29
|
+
},
|
|
30
|
+
"suggestion": {
|
|
31
|
+
"message": {
|
|
32
|
+
"subl": "<em>{{sub}}</em> is a sub-municipality of <em>{{principal}}</em>"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"streetNumber": {
|
|
37
|
+
"placeholder": {
|
|
38
|
+
"input-placeholder": "Provide a streetNumber..."
|
|
39
|
+
},
|
|
40
|
+
"suggestion": {
|
|
41
|
+
"message": {
|
|
42
|
+
"subl": "<em>{{sub}}</em> is a sub-municipality of <em>{{principal}}</em>"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"message": {
|
|
46
|
+
"not-in-list": "The House Number is not in the list"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"boxNumber": {
|
|
50
|
+
"placeholder": {
|
|
51
|
+
"input-placeholder": "Provide a boxNumber..."
|
|
52
|
+
},
|
|
53
|
+
"suggestion": {
|
|
54
|
+
"message": {
|
|
55
|
+
"subl": "<em>{{sub}}</em> is a sub-municipality of <em>{{principal}}</em>"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"message": {
|
|
59
|
+
"not-in-list": "The Box Number is not in the list"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|