source: trip-planner-front/node_modules/.cache/babel-webpack/c128ddca1273b4e34df4d6337d62aeca.json@ 6fe77af

Last change on this file since 6fe77af was 6fe77af, checked in by Ema <ema_spirova@…>, 3 years ago

add location feature

  • Property mode set to 100644
File size: 20.7 KB
Line 
1{"ast":null,"code":"import { FormControl } from '@angular/forms';\nimport { Observable, Subscription } from 'rxjs';\nimport { map, startWith } from 'rxjs/operators';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"../_services/location.service\";\nimport * as i2 from \"../_services/region.service\";\nimport * as i3 from \"@angular/router\";\n\nfunction ExploreComponent_mat_option_18_Template(rf, ctx) {\n if (rf & 1) {\n const _r4 = i0.ɵɵgetCurrentView();\n\n i0.ɵɵelementStart(0, \"mat-option\", 14);\n i0.ɵɵlistener(\"click\", function ExploreComponent_mat_option_18_Template_mat_option_click_0_listener() {\n i0.ɵɵrestoreView(_r4);\n const ctx_r3 = i0.ɵɵnextContext();\n return ctx_r3.onPlaceSelected(ctx_r3.selectedPlace);\n });\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n const option_r2 = ctx.$implicit;\n i0.ɵɵproperty(\"value\", option_r2);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", option_r2, \" \");\n }\n}\n\nexport class ExploreComponent {\n constructor(locationService, regionService, router) {\n this.locationService = locationService;\n this.regionService = regionService;\n this.router = router;\n this.loading = [false, false, false, false];\n this.regions = [];\n this.filteredOptions = new Observable();\n this.myControl = new FormControl();\n this.cityName = '';\n this.selectedPlace = '';\n this.thirdSubscription = new Subscription();\n this.text = '';\n }\n\n ngOnInit() {\n this.regionService.getAllCitiesAndRegions().subscribe(data => {\n this.regions = data;\n });\n this.filteredOptions = this.myControl.valueChanges.pipe(startWith(''), map(value => typeof value === 'string' ? value : value.name), map(name => name ? this._filter(name) : this.regions.slice()));\n }\n\n displayFn(city) {\n return city && city ? city : '';\n }\n\n _filter(name) {\n const filterValue = name.toLowerCase();\n return this.regions.filter(option => option.toLowerCase().includes(filterValue));\n }\n\n load(index) {\n this.loading[index] = true;\n setTimeout(() => this.loading[index] = false, 1000);\n this.locationService.getAllLocationsSearch(this.selectedPlace).subscribe(data => {\n this.router.navigate(['results'], {\n queryParams: {\n place: this.selectedPlace\n }\n });\n });\n }\n\n onPlaceSelected(selectedPlace) {\n console.log(this.selectedPlace); // get from view \n }\n\n}\n\nExploreComponent.ɵfac = function ExploreComponent_Factory(t) {\n return new (t || ExploreComponent)(i0.ɵɵdirectiveInject(i1.LocationService), i0.ɵɵdirectiveInject(i2.RegionService), i0.ɵɵdirectiveInject(i3.Router));\n};\n\nExploreComponent.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: ExploreComponent,\n selectors: [[\"app-explore\"]],\n decls: 21,\n vars: 8,\n consts: [[\"href\", \"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css\", \"rel\", \"stylesheet\", \"integrity\", \"sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x\", \"crossorigin\", \"anonymous\"], [\"lang\", \"en\"], [\"charset\", \"utf-8\"], [1, \"navbar\", \"navbar-expand-sm\"], [1, \"navbar-brand\"], [1, \"navbar-nav\", \"ml-auto\"], [1, \"nav-item\"], [1, \"example-form\"], [\"appearance\", \"fill\", 1, \"example-full-width\"], [\"type\", \"text\", \"matInput\", \"\", 3, \"formControl\", \"matAutocomplete\", \"ngModel\", \"ngModelChange\"], [3, \"displayWith\"], [\"auto\", \"matAutocomplete\"], [3, \"value\", \"click\", 4, \"ngFor\", \"ngForOf\"], [\"label\", \"Search\", \"icon\", \"pi pi-search\", \"id\", \"button\", 3, \"loading\", \"click\"], [3, \"value\", \"click\"]],\n template: function ExploreComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"link\", 0);\n i0.ɵɵelementStart(1, \"html\", 1);\n i0.ɵɵelementStart(2, \"head\");\n i0.ɵɵelement(3, \"meta\", 2);\n i0.ɵɵelementStart(4, \"title\");\n i0.ɵɵtext(5, \"Explore\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(6, \"body\");\n i0.ɵɵelementStart(7, \"header\");\n i0.ɵɵelementStart(8, \"nav\", 3);\n i0.ɵɵelementStart(9, \"strong\", 4);\n i0.ɵɵtext(10, \"Trivia Trip\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(11, \"ul\", 5);\n i0.ɵɵelementStart(12, \"li\", 6);\n i0.ɵɵelementStart(13, \"form\", 7);\n i0.ɵɵelementStart(14, \"mat-form-field\", 8);\n i0.ɵɵelementStart(15, \"input\", 9);\n i0.ɵɵlistener(\"ngModelChange\", function ExploreComponent_Template_input_ngModelChange_15_listener($event) {\n return ctx.selectedPlace = $event;\n });\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(16, \"mat-autocomplete\", 10, 11);\n i0.ɵɵtemplate(18, ExploreComponent_mat_option_18_Template, 2, 2, \"mat-option\", 12);\n i0.ɵɵpipe(19, \"async\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(20, \"p-button\", 13);\n i0.ɵɵlistener(\"click\", function ExploreComponent_Template_p_button_click_20_listener() {\n return ctx.load(0);\n });\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n const _r0 = i0.ɵɵreference(17);\n\n i0.ɵɵadvance(15);\n i0.ɵɵproperty(\"formControl\", ctx.myControl)(\"matAutocomplete\", _r0)(\"ngModel\", ctx.selectedPlace);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"displayWith\", ctx.displayFn);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngForOf\", i0.ɵɵpipeBind1(19, 6, ctx.filteredOptions));\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"loading\", ctx.loading[0]);\n }\n },\n styles: [\"#button[_ngcontent-%COMP%]{\\r\\n margin-left: 20px;\\r\\n}\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImV4cGxvcmUuY29tcG9uZW50LmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtJQUNJLGlCQUFpQjtBQUNyQiIsImZpbGUiOiJleHBsb3JlLmNvbXBvbmVudC5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIjYnV0dG9ue1xyXG4gICAgbWFyZ2luLWxlZnQ6IDIwcHg7XHJcbn0iXX0= */\"]\n});","map":{"version":3,"sources":["C:/Users/DELL/Desktop/bachelor-thesis/trip-planner-front/src/app/explore/explore.component.ts"],"names":["FormControl","Observable","Subscription","map","startWith","i0","i1","i2","i3","ExploreComponent_mat_option_18_Template","rf","ctx","_r4","ɵɵgetCurrentView","ɵɵelementStart","ɵɵlistener","ExploreComponent_mat_option_18_Template_mat_option_click_0_listener","ɵɵrestoreView","ctx_r3","ɵɵnextContext","onPlaceSelected","selectedPlace","ɵɵtext","ɵɵelementEnd","option_r2","$implicit","ɵɵproperty","ɵɵadvance","ɵɵtextInterpolate1","ExploreComponent","constructor","locationService","regionService","router","loading","regions","filteredOptions","myControl","cityName","thirdSubscription","text","ngOnInit","getAllCitiesAndRegions","subscribe","data","valueChanges","pipe","value","name","_filter","slice","displayFn","city","filterValue","toLowerCase","filter","option","includes","load","index","setTimeout","getAllLocationsSearch","navigate","queryParams","place","console","log","ɵfac","ExploreComponent_Factory","t","ɵɵdirectiveInject","LocationService","RegionService","Router","ɵcmp","ɵɵdefineComponent","type","selectors","decls","vars","consts","template","ExploreComponent_Template","ɵɵelement","ExploreComponent_Template_input_ngModelChange_15_listener","$event","ɵɵtemplate","ɵɵpipe","ExploreComponent_Template_p_button_click_20_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E,CAACsB,SAAH,CAAa,CAAb;AACAtB,MAAAA,EAAE,CAACqB,UAAH,CAAc,aAAd,EAA6Bf,GAAG,CAACwC,SAAjC;AACA9C,MAAAA,EAAE,CAACsB,SAAH,CAAa,CAAb;AACAtB,MAAAA,EAAE,CAACqB,UAAH,CAAc,SAAd,EAAyBrB,EAAE,CAACsF,WAAH,CAAe,EAAf,EAAmB,CAAnB,EAAsBhF,GAAG,CAACyB,eAA1B,CAAzB;AACA/B,MAAAA,EAAE,CAACsB,SAAH,CAAa,CAAb;AACAtB,MAAAA,EAAE,CAACqB,UAAH,CAAc,SAAd,EAAyBf,GAAG,CAACuB,OAAJ,CAAY,CAAZ,CAAzB;AACH;AAAE,GA/CoD;AA+ClD0D,EAAAA,MAAM,EAAE,CAAC,+WAAD;AA/C0C,CAArB,CAAtC","sourcesContent":["import { FormControl } from '@angular/forms';\r\nimport { Observable, Subscription } from 'rxjs';\r\nimport { map, startWith } from 'rxjs/operators';\r\nimport * as i0 from \"@angular/core\";\r\nimport * as i1 from \"../_services/location.service\";\r\nimport * as i2 from \"../_services/region.service\";\r\nimport * as i3 from \"@angular/router\";\r\nfunction ExploreComponent_mat_option_18_Template(rf, ctx) { if (rf & 1) {\r\n const _r4 = i0.ɵɵgetCurrentView();\r\n i0.ɵɵelementStart(0, \"mat-option\", 14);\r\n i0.ɵɵlistener(\"click\", function ExploreComponent_mat_option_18_Template_mat_option_click_0_listener() { i0.ɵɵrestoreView(_r4); const ctx_r3 = i0.ɵɵnextContext(); return ctx_r3.onPlaceSelected(ctx_r3.selectedPlace); });\r\n i0.ɵɵtext(1);\r\n i0.ɵɵelementEnd();\r\n} if (rf & 2) {\r\n const option_r2 = ctx.$implicit;\r\n i0.ɵɵproperty(\"value\", option_r2);\r\n i0.ɵɵadvance(1);\r\n i0.ɵɵtextInterpolate1(\" \", option_r2, \" \");\r\n} }\r\nexport class ExploreComponent {\r\n constructor(locationService, regionService, router) {\r\n this.locationService = locationService;\r\n this.regionService = regionService;\r\n this.router = router;\r\n this.loading = [false, false, false, false];\r\n this.regions = [];\r\n this.filteredOptions = new Observable();\r\n this.myControl = new FormControl();\r\n this.cityName = '';\r\n this.selectedPlace = '';\r\n this.thirdSubscription = new Subscription;\r\n this.text = '';\r\n }\r\n ngOnInit() {\r\n this.regionService.getAllCitiesAndRegions().subscribe(data => {\r\n this.regions = data;\r\n });\r\n this.filteredOptions = this.myControl.valueChanges.pipe(startWith(''), map(value => (typeof value === 'string' ? value : value.name)), map(name => (name ? this._filter(name) : this.regions.slice())));\r\n }\r\n displayFn(city) {\r\n return city && city ? city : '';\r\n }\r\n _filter(name) {\r\n const filterValue = name.toLowerCase();\r\n return this.regions.filter(option => option.toLowerCase().includes(filterValue));\r\n }\r\n load(index) {\r\n this.loading[index] = true;\r\n setTimeout(() => this.loading[index] = false, 1000);\r\n this.locationService.getAllLocationsSearch(this.selectedPlace).subscribe(data => {\r\n this.router.navigate(['results'], { queryParams: { place: this.selectedPlace } });\r\n });\r\n }\r\n onPlaceSelected(selectedPlace) {\r\n console.log(this.selectedPlace); // get from view \r\n }\r\n}\r\nExploreComponent.ɵfac = function ExploreComponent_Factory(t) { return new (t || ExploreComponent)(i0.ɵɵdirectiveInject(i1.LocationService), i0.ɵɵdirectiveInject(i2.RegionService), i0.ɵɵdirectiveInject(i3.Router)); };\r\nExploreComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ExploreComponent, selectors: [[\"app-explore\"]], decls: 21, vars: 8, consts: [[\"href\", \"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css\", \"rel\", \"stylesheet\", \"integrity\", \"sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x\", \"crossorigin\", \"anonymous\"], [\"lang\", \"en\"], [\"charset\", \"utf-8\"], [1, \"navbar\", \"navbar-expand-sm\"], [1, \"navbar-brand\"], [1, \"navbar-nav\", \"ml-auto\"], [1, \"nav-item\"], [1, \"example-form\"], [\"appearance\", \"fill\", 1, \"example-full-width\"], [\"type\", \"text\", \"matInput\", \"\", 3, \"formControl\", \"matAutocomplete\", \"ngModel\", \"ngModelChange\"], [3, \"displayWith\"], [\"auto\", \"matAutocomplete\"], [3, \"value\", \"click\", 4, \"ngFor\", \"ngForOf\"], [\"label\", \"Search\", \"icon\", \"pi pi-search\", \"id\", \"button\", 3, \"loading\", \"click\"], [3, \"value\", \"click\"]], template: function ExploreComponent_Template(rf, ctx) { if (rf & 1) {\r\n i0.ɵɵelement(0, \"link\", 0);\r\n i0.ɵɵelementStart(1, \"html\", 1);\r\n i0.ɵɵelementStart(2, \"head\");\r\n i0.ɵɵelement(3, \"meta\", 2);\r\n i0.ɵɵelementStart(4, \"title\");\r\n i0.ɵɵtext(5, \"Explore\");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(6, \"body\");\r\n i0.ɵɵelementStart(7, \"header\");\r\n i0.ɵɵelementStart(8, \"nav\", 3);\r\n i0.ɵɵelementStart(9, \"strong\", 4);\r\n i0.ɵɵtext(10, \"Trivia Trip\");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(11, \"ul\", 5);\r\n i0.ɵɵelementStart(12, \"li\", 6);\r\n i0.ɵɵelementStart(13, \"form\", 7);\r\n i0.ɵɵelementStart(14, \"mat-form-field\", 8);\r\n i0.ɵɵelementStart(15, \"input\", 9);\r\n i0.ɵɵlistener(\"ngModelChange\", function ExploreComponent_Template_input_ngModelChange_15_listener($event) { return ctx.selectedPlace = $event; });\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(16, \"mat-autocomplete\", 10, 11);\r\n i0.ɵɵtemplate(18, ExploreComponent_mat_option_18_Template, 2, 2, \"mat-option\", 12);\r\n i0.ɵɵpipe(19, \"async\");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(20, \"p-button\", 13);\r\n i0.ɵɵlistener(\"click\", function ExploreComponent_Template_p_button_click_20_listener() { return ctx.load(0); });\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n } if (rf & 2) {\r\n const _r0 = i0.ɵɵreference(17);\r\n i0.ɵɵadvance(15);\r\n i0.ɵɵproperty(\"formControl\", ctx.myControl)(\"matAutocomplete\", _r0)(\"ngModel\", ctx.selectedPlace);\r\n i0.ɵɵadvance(1);\r\n i0.ɵɵproperty(\"displayWith\", ctx.displayFn);\r\n i0.ɵɵadvance(2);\r\n i0.ɵɵproperty(\"ngForOf\", i0.ɵɵpipeBind1(19, 6, ctx.filteredOptions));\r\n i0.ɵɵadvance(2);\r\n i0.ɵɵproperty(\"loading\", ctx.loading[0]);\r\n } }, styles: [\"#button[_ngcontent-%COMP%]{\\r\\n margin-left: 20px;\\r\\n}\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImV4cGxvcmUuY29tcG9uZW50LmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtJQUNJLGlCQUFpQjtBQUNyQiIsImZpbGUiOiJleHBsb3JlLmNvbXBvbmVudC5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIjYnV0dG9ue1xyXG4gICAgbWFyZ2luLWxlZnQ6IDIwcHg7XHJcbn0iXX0= */\"] });\r\n"]},"metadata":{},"sourceType":"module"}
Note: See TracBrowser for help on using the repository browser.