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

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

search all locations by city or region

  • Property mode set to 100644
File size: 25.2 KB
RevLine 
[76712b2]1{"ast":null,"code":"import { FormControl } from '@angular/forms';\nimport { Observable } from 'rxjs';\nimport { map, startWith } from 'rxjs/operators';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"../_services/city.service\";\nimport * as i2 from \"../_services/location.service\";\nimport * as i3 from \"../_services/region.service\";\nimport * as i4 from \"primeng/autocomplete\";\nimport * as i5 from \"@angular/forms\";\nimport * as i6 from \"primeng/button\";\nimport * as i7 from \"@angular/material/form-field\";\nimport * as i8 from \"@angular/material/input\";\nimport * as i9 from \"@angular/material/autocomplete\";\nimport * as i10 from \"@angular/common\";\nimport * as i11 from \"@angular/material/core\";\n\nfunction ExploreComponent_mat_option_23_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"mat-option\", 15);\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.name, \" \");\n }\n}\n\nexport class ExploreComponent {\n constructor(cityService, locationService, regionService) {\n this.cityService = cityService;\n this.locationService = locationService;\n this.regionService = regionService;\n this.loading = [false, false, false, false];\n this.regions = [];\n this.filteredOptions = new Observable();\n this.myControl = new FormControl();\n this.cities = [];\n this.filteredCountries = [];\n this.text = '';\n }\n\n ngOnInit() {\n this.cityService.getAllCities().subscribe(cities => {\n this.cities = cities;\n });\n this.regionService.getAllRegions().subscribe(regions => {\n this.regions = regions;\n });\n this.filteredOptions = this.myControl.valueChanges.pipe(startWith(''), map(value => typeof value === 'string' ? value : value.name), map(name => name ? this._filter(name) : this.cities.slice()));\n }\n\n displayFn(city) {\n return city && city.name ? user.name : '';\n }\n\n _filter(name) {\n const filterValue = name.toLowerCase();\n return this.cities.filter(option => option.name.toLowerCase().includes(filterValue));\n }\n\n search(event) {\n let filtered = [];\n let query = event.query;\n\n for (let i = 0; i < this.cities.length; i++) {\n let city = this.cities[i];\n\n if (city.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {\n filtered.push(city);\n }\n }\n\n for (let i = 0; i < this.regions.length; i++) {\n let region = this.regions[i];\n\n if (region.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {\n filtered.push(region);\n }\n }\n\n this.filteredCountries = filtered;\n }\n\n load(index, event) {\n this.loading[index] = true;\n setTimeout(() => this.loading[index] = false, 1000);\n console.log(event.value);\n }\n\n}\n\nExploreComponent.ɵfac = function ExploreComponent_Factory(t) {\n return new (t || ExploreComponent)(i0.ɵɵdirectiveInject(i1.CityService), i0.ɵɵdirectiveInject(i2.LocationService), i0.ɵɵdirectiveInject(i3.RegionService));\n};\n\nExploreComponent.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: ExploreComponent,\n selectors: [[\"app-explore\"]],\n decls: 25,\n vars: 10,\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\"], [\"field\", \"name\", 3, \"ngModel\", \"suggestions\", \"minLength\", \"ngModelChange\", \"completeMethod\"], [\"label\", \"Search\", \"icon\", \"pi pi-search\", \"id\", \"button\", 3, \"loading\", \"click\"], [1, \"example-form\"], [\"appearance\", \"fill\", 1, \"example-full-width\"], [\"type\", \"text\", \"matInput\", \"\", 3, \"formControl\", \"matAutocomplete\"], [3, \"displayWith\"], [\"auto\", \"matAutocomplete\"], [3, \"value\", 4, \"ngFor\", \"ngForOf\"], [3, \"value\"]],\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, \"p-autoComplete\", 7);\n i0.ɵɵlistener(\"ngModelChange\", function ExploreComponent_Template_p_autoComplete_ngModelChange_13_listener($event) {\n return ctx.text = $event;\n })(\"completeMethod\", function ExploreComponent_Template_p_autoComplete_completeMethod_13_listener($event) {\n return ctx.search($event);\n });\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(14, \"p-button\", 8);\n i0.ɵɵlistener(\"click\", function ExploreComponent_Template_p_button_click_14_listener($event) {\n return ctx.load(0, $event);\n });\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelement(15, \"li\", 6);\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(16, \"form\", 9);\n i0.ɵɵelementStart(17, \"mat-form-field\", 10);\n i0.ɵɵelementStart(18, \"mat-label\");\n i0.ɵɵtext(19, \"Assignee\");\n i0.ɵɵelementEnd();\n i0.ɵɵelement(20, \"input\", 11);\n i0.ɵɵelementStart(21, \"mat-autocomplete\", 12, 13);\n i0.ɵɵtemplate(23, ExploreComponent_mat_option_23_Template, 2, 2, \"mat-option\", 14);\n i0.ɵɵpipe(24, \"async\");\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(22);\n\n i0.ɵɵadvance(13);\n i0.ɵɵproperty(\"ngModel\", ctx.text)(\"suggestions\", ctx.filteredCountries)(\"minLength\", 1);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"loading\", ctx.loading[0]);\n i0.ɵɵadvance(6);\n i0.ɵɵproperty(\"formControl\", ctx.myControl)(\"matAutocomplete\", _r0);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"displayWith\", ctx.displayFn);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngForOf\", i0.ɵɵpipeBind1(24, 8, ctx.filteredOptions));\n }\n },\n directives: [i4.AutoComplete, i5.NgControlStatus, i5.NgModel, i6.Button, i5.ɵNgNoValidate, i5.NgControlStatusGroup, i5.NgForm, i7.MatFormField, i7.MatLabel, i8.MatInput, i5.DefaultValueAccessor, i9.MatAutocompleteTrigger, i5.FormControlDirective, i9.MatAutocomplete, i10.NgForOf, i11.MatOption],\n pipes: [i10.AsyncPipe],\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","map","startWith","i0","i1","i2","i3","i4","i5","i6","i7","i8","i9","i10","i11","ExploreComponent_mat_option_23_Template","rf","ctx","ɵɵelementStart","ɵɵtext","ɵɵelementEnd","option_r2","$implicit","ɵɵproperty","ɵɵadvance","ɵɵtextInterpolate1","name","ExploreComponent","constructor","cityService","locationService","regionService","loading","regions","filteredOptions","myControl","cities","filteredCountries","text","ngOnInit","getAllCities","subscribe","getAllRegions","valueChanges","pipe","value","_filter","slice","displayFn","city","user","filterValue","toLowerCase","filter","option","includes","search","event","filtered","query","i","length","indexOf","push","region","load","index","setTimeout","console","log","ɵfac","ExploreComponent_Factory","t","ɵɵdirectiveInject","CityService","LocationService","RegionService","ɵcmp","ɵɵdefineComponent","type","selectors","decls","vars","consts","template","ExploreComponent_Template","ɵɵelement","ɵɵlistener","ExploreComponent_Template_p_autoComplete_ngModelChange_13_listener","$event","ExploreComponent_Template_p_autoComplete_completeMethod_13_listener","ExploreComponent_Template_p_button_click_14_listener","ɵɵtemplate","ɵɵpipe","_r0","ɵɵreference","ɵɵpipeBind1","directives","AutoComplete","NgControlStatus","NgModel","Button","ɵNgNoValidate","NgControlStatusGroup","NgForm","MatFormField","MatLabel","MatInput","DefaultValueAccessor","MatAutocompleteTrigger","FormControlDirective","MatAutocomplete","NgForOf","MatOption","pipes","AsyncPipe","styles"],"mappings":"AAAA,SAASA,WAAT,QAA4B,gBAA5B;AACA,SAASC,UAAT,QAA2B,MAA3B;AACA,SAASC,GAAT,EAAcC,SAAd,QAA+B,gBAA/B;AACA,OAAO,KAAKC,EAAZ,MAAoB,eAApB;AACA,OAAO,KAAKC,EAAZ,MAAoB,2BAApB;AACA,OAAO,KAAKC,EAAZ,MAAoB,+BAApB;AACA,OAAO,KAAKC,EAAZ,MAAoB,6BAApB;AACA,OAAO,KAAKC,EAAZ,MAAoB,sBAApB;AACA,OAAO,KAA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c,aAAd,EAA6BN,GAAG,CAAC+B,SAAjC;AACA7C,MAAAA,EAAE,CAACqB,SAAH,CAAa,CAAb;AACArB,MAAAA,EAAE,CAACoB,UAAH,CAAc,SAAd,EAAyBpB,EAAE,CAAC6F,WAAH,CAAe,EAAf,EAAmB,CAAnB,EAAsB/E,GAAG,CAACiB,eAA1B,CAAzB;AACH;AAAE,GAtDoD;AAsDlD+D,EAAAA,UAAU,EAAE,CAAC1F,EAAE,CAAC2F,YAAJ,EAAkB1F,EAAE,CAAC2F,eAArB,EAAsC3F,EAAE,CAAC4F,OAAzC,EAAkD3F,EAAE,CAAC4F,MAArD,EAA6D7F,EAAE,CAAC8F,aAAhE,EAA+E9F,EAAE,CAAC+F,oBAAlF,EAAwG/F,EAAE,CAACgG,MAA3G,EAAmH9F,EAAE,CAAC+F,YAAtH,EAAoI/F,EAAE,CAACgG,QAAvI,EAAiJ/F,EAAE,CAACgG,QAApJ,EAA8JnG,EAAE,CAACoG,oBAAjK,EAAuLhG,EAAE,CAACiG,sBAA1L,EAAkNrG,EAAE,CAACsG,oBAArN,EAA2OlG,EAAE,CAACmG,eAA9O,EAA+PlG,GAAG,CAACmG,OAAnQ,EAA4QlG,GAAG,CAACmG,SAAhR,CAtDsC;AAsDsPC,EAAAA,KAAK,EAAE,CAACrG,GAAG,CAACsG,SAAL,CAtD7P;AAsD8QC,EAAAA,MAAM,EAAE,CAAC,+WAAD;AAtDtR,CAArB,CAAtC","sourcesContent":["import { FormControl } from '@angular/forms';\r\nimport { Observable } from 'rxjs';\r\nimport { map, startWith } from 'rxjs/operators';\r\nimport * as i0 from \"@angular/core\";\r\nimport * as i1 from \"../_services/city.service\";\r\nimport * as i2 from \"../_services/location.service\";\r\nimport * as i3 from \"../_services/region.service\";\r\nimport * as i4 from \"primeng/autocomplete\";\r\nimport * as i5 from \"@angular/forms\";\r\nimport * as i6 from \"primeng/button\";\r\nimport * as i7 from \"@angular/material/form-field\";\r\nimport * as i8 from \"@angular/material/input\";\r\nimport * as i9 from \"@angular/material/autocomplete\";\r\nimport * as i10 from \"@angular/common\";\r\nimport * as i11 from \"@angular/material/core\";\r\nfunction ExploreComponent_mat_option_23_Template(rf, ctx) { if (rf & 1) {\r\n i0.ɵɵelementStart(0, \"mat-option\", 15);\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.name, \" \");\r\n} }\r\nexport class ExploreComponent {\r\n constructor(cityService, locationService, regionService) {\r\n this.cityService = cityService;\r\n this.locationService = locationService;\r\n this.regionService = regionService;\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.cities = [];\r\n this.filteredCountries = [];\r\n this.text = '';\r\n }\r\n ngOnInit() {\r\n this.cityService.getAllCities().subscribe(cities => {\r\n this.cities = cities;\r\n });\r\n this.regionService.getAllRegions().subscribe(regions => {\r\n this.regions = regions;\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.cities.slice())));\r\n }\r\n displayFn(city) {\r\n return city && city.name ? user.name : '';\r\n }\r\n _filter(name) {\r\n const filterValue = name.toLowerCase();\r\n return this.cities.filter(option => option.name.toLowerCase().includes(filterValue));\r\n }\r\n search(event) {\r\n let filtered = [];\r\n let query = event.query;\r\n for (let i = 0; i < this.cities.length; i++) {\r\n let city = this.cities[i];\r\n if (city.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {\r\n filtered.push(city);\r\n }\r\n }\r\n for (let i = 0; i < this.regions.length; i++) {\r\n let region = this.regions[i];\r\n if (region.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {\r\n filtered.push(region);\r\n }\r\n }\r\n this.filteredCountries = filtered;\r\n }\r\n load(index, event) {\r\n this.loading[index] = true;\r\n setTimeout(() => this.loading[index] = false, 1000);\r\n console.log(event.value);\r\n }\r\n}\r\nExploreComponent.ɵfac = function ExploreComponent_Factory(t) { return new (t || ExploreComponent)(i0.ɵɵdirectiveInject(i1.CityService), i0.ɵɵdirectiveInject(i2.LocationService), i0.ɵɵdirectiveInject(i3.RegionService)); };\r\nExploreComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ExploreComponent, selectors: [[\"app-explore\"]], decls: 25, vars: 10, 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\"], [\"field\", \"name\", 3, \"ngModel\", \"suggestions\", \"minLength\", \"ngModelChange\", \"completeMethod\"], [\"label\", \"Search\", \"icon\", \"pi pi-search\", \"id\", \"button\", 3, \"loading\", \"click\"], [1, \"example-form\"], [\"appearance\", \"fill\", 1, \"example-full-width\"], [\"type\", \"text\", \"matInput\", \"\", 3, \"formControl\", \"matAutocomplete\"], [3, \"displayWith\"], [\"auto\", \"matAutocomplete\"], [3, \"value\", 4, \"ngFor\", \"ngForOf\"], [3, \"value\"]], 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, \"p-autoComplete\", 7);\r\n i0.ɵɵlistener(\"ngModelChange\", function ExploreComponent_Template_p_autoComplete_ngModelChange_13_listener($event) { return ctx.text = $event; })(\"completeMethod\", function ExploreComponent_Template_p_autoComplete_completeMethod_13_listener($event) { return ctx.search($event); });\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(14, \"p-button\", 8);\r\n i0.ɵɵlistener(\"click\", function ExploreComponent_Template_p_button_click_14_listener($event) { return ctx.load(0, $event); });\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelement(15, \"li\", 6);\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(16, \"form\", 9);\r\n i0.ɵɵelementStart(17, \"mat-form-field\", 10);\r\n i0.ɵɵelementStart(18, \"mat-label\");\r\n i0.ɵɵtext(19, \"Assignee\");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelement(20, \"input\", 11);\r\n i0.ɵɵelementStart(21, \"mat-autocomplete\", 12, 13);\r\n i0.ɵɵtemplate(23, ExploreComponent_mat_option_23_Template, 2, 2, \"mat-option\", 14);\r\n i0.ɵɵpipe(24, \"async\");\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(22);\r\n i0.ɵɵadvance(13);\r\n i0.ɵɵproperty(\"ngModel\", ctx.text)(\"suggestions\", ctx.filteredCountries)(\"minLength\", 1);\r\n i0.ɵɵadvance(1);\r\n i0.ɵɵproperty(\"loading\", ctx.loading[0]);\r\n i0.ɵɵadvance(6);\r\n i0.ɵɵproperty(\"formControl\", ctx.myControl)(\"matAutocomplete\", _r0);\r\n i0.ɵɵadvance(1);\r\n i0.ɵɵproperty(\"displayWith\", ctx.displayFn);\r\n i0.ɵɵadvance(2);\r\n i0.ɵɵproperty(\"ngForOf\", i0.ɵɵpipeBind1(24, 8, ctx.filteredOptions));\r\n } }, directives: [i4.AutoComplete, i5.NgControlStatus, i5.NgModel, i6.Button, i5.ɵNgNoValidate, i5.NgControlStatusGroup, i5.NgForm, i7.MatFormField, i7.MatLabel, i8.MatInput, i5.DefaultValueAccessor, i9.MatAutocompleteTrigger, i5.FormControlDirective, i9.MatAutocomplete, i10.NgForOf, i11.MatOption], pipes: [i10.AsyncPipe], 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.