Commit 06a997f11596909d69240aa4d0dc11b5b632f977
Merge
Showing
6 changed files
with
57 additions
and
56 deletions
Show diff stats
angular-cli.json
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | "../node_modules/@covalent/core/common/platform.css", |
| 24 | 24 | "../node_modules/@swimlane/ngx-charts/release/ngx-charts.css", |
| 25 | 25 | "../node_modules/ag-grid/dist/styles/ag-grid.css", |
| 26 | - "../node_modules/ag-grid/dist/styles/theme-dark.css" | |
| 26 | + "../node_modules/ag-grid/dist/styles/theme-blue.css" | |
| 27 | 27 | ], |
| 28 | 28 | "scripts": [ |
| 29 | 29 | "../node_modules/hammerjs/hammer.min.js", | ... | ... |
src/animations/router.animation.ts
| 1 | 1 | import {trigger, state, animate, style, transition} from '@angular/core'; |
| 2 | 2 | |
| 3 | +// tslint:disable-next-line:typedef | |
| 3 | 4 | export function routerTransition() { |
| 4 | 5 | return trigger('routerTransition', [ |
| 5 | - state('void', style({position:'absolute', width:'1000px', height:'1000px'}) ), | |
| 6 | - state('*', style({position:'absolute', width:'1000px', height:'1000px'}) ), | |
| 6 | + state('void', style({position: 'absolute', width: '100%', height: '100%', opacity: '1'}) ), | |
| 7 | + state('*', style({position: 'absolute', width: '100%', height: '100%', opacity: '1'}) ), | |
| 7 | 8 | transition(':enter', [ |
| 8 | - style({transform: 'translateY(-100%)'}), | |
| 9 | - animate('0.5s ease-in-out', style({transform: 'translateY(0%)'})) | |
| 9 | + style({opacity: '0.5'}), | |
| 10 | + animate('0.6s ease-in-out', style({opacity: '1'})), | |
| 10 | 11 | ]), |
| 11 | 12 | transition(':leave', [ |
| 12 | - style({transform: 'translateY(0%)'}), | |
| 13 | - animate('0.5s ease-in-out', style({transform: 'translateY(100%)'})) | |
| 14 | - ]) | |
| 13 | + style({transform: 'translateX(0%)', opacity: '1'}), | |
| 14 | + animate('0.6s ease-in-out', style({transform: 'translateX(100%)', opacity: '0.5'})), | |
| 15 | + ]), | |
| 15 | 16 | ]); |
| 16 | 17 | } | ... | ... |
src/app/data/bus-stop/bus-stop.component.html
| 1 | 1 | <div class="grid_containert" *ngIf="showGrid"> |
| 2 | - <ag-grid-ng2 #agGrid style="width: 100%; height: 100%;" class="ag-dark" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups | |
| 2 | + <ag-grid-ng2 #agGrid style="width: 100%; height: 100%;" class="ag-blue" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups | |
| 3 | 3 | toolPanelSuppressValues debug rowHeight="22" rowSelection="multiple" (cellClicked)="onCellClicked($event)" (cellDoubleClicked)="onCellDoubleClicked($event)" (cellContextMenu)="onCellContextMenu($event)" (cellValueChanged)="onCellValueChanged($event)" |
| 4 | 4 | (cellFocused)="onCellFocused($event)" (rowSelected)="onRowSelected($event)" (selectionChanged)="onSelectionChanged()" (beforeFilterChanged)="onBeforeFilterChanged()" (afterFilterChanged)="onAfterFilterChanged()" (filterModified)="onFilterModified()" |
| 5 | 5 | (beforeSortChanged)="onBeforeSortChanged()" (afterSortChanged)="onAfterSortChanged()" (virtualRowRemoved)="onVirtualRowRemoved($event)" (rowClicked)="onRowClicked($event)"> | ... | ... |
src/app/data/bus-stop/bus-stop.component.ts
| ... | ... | @@ -20,6 +20,7 @@ import { routerTransition } from '../../../animations/router.animation'; |
| 20 | 20 | // only import this if you are using the ag-Grid-Enterprise |
| 21 | 21 | |
| 22 | 22 | @Component({ |
| 23 | + // tslint:disable-next-line:component-selector | |
| 23 | 24 | selector: 'bus-grid', |
| 24 | 25 | templateUrl: 'bus-stop.component.html', |
| 25 | 26 | styleUrls: ['bus-stop.scss'], |
| ... | ... | @@ -53,7 +54,7 @@ export class BusStopComponent { |
| 53 | 54 | this.showGrid = true; |
| 54 | 55 | this.gridOptions.rowModelType = 'virtual'; |
| 55 | 56 | this.booleanService.getModels().then((models) => this.boolean = models); |
| 56 | - this.dataService.getModels().then(models => { | |
| 57 | + this.dataService.getModels().then((models) => { | |
| 57 | 58 | this.regions = models.regionSelectListDsM as RegionSelectList[]; |
| 58 | 59 | this.states = models.stateCommonSelectListDsM as StateCommonSelectList[]; |
| 59 | 60 | this.surfaceTypes = models.surfaceTypeSelectListDsM as SurfaceTypeSelectList[]; |
| ... | ... | @@ -75,10 +76,10 @@ export class BusStopComponent { |
| 75 | 76 | }); |
| 76 | 77 | } |
| 77 | 78 | setRowData(allOfTheData) { |
| 79 | + // tslint:disable-next-line:typedef | |
| 78 | 80 | let dataSource = { |
| 79 | 81 | rowCount: null, // behave as infinite scroll |
| 80 | 82 | getRows: function (params) { |
| 81 | - console.log('asking for ' + params.startRow + ' to ' + params.endRow); | |
| 82 | 83 | // At this point in your code, you would call the server, using $http if in AngularJS. |
| 83 | 84 | // To make the demo look real, wait for 500ms before returning |
| 84 | 85 | // take a slice of the total rows |
| ... | ... | @@ -90,7 +91,7 @@ export class BusStopComponent { |
| 90 | 91 | } |
| 91 | 92 | // call the success callback |
| 92 | 93 | params.successCallback(rowsThisPage, lastRow); |
| 93 | - } | |
| 94 | + }, | |
| 94 | 95 | }; |
| 95 | 96 | return dataSource; |
| 96 | 97 | } |
| ... | ... | @@ -127,7 +128,7 @@ export class BusStopComponent { |
| 127 | 128 | checkboxSelection: true, |
| 128 | 129 | suppressSorting: true, |
| 129 | 130 | suppressMenu: true, |
| 130 | - pinned: true | |
| 131 | + pinned: true, | |
| 131 | 132 | }, |
| 132 | 133 | { |
| 133 | 134 | headerName: 'ID', |
| ... | ... | @@ -142,8 +143,8 @@ export class BusStopComponent { |
| 142 | 143 | cellEditorParams: { |
| 143 | 144 | data: this.roads, |
| 144 | 145 | valueCol: 'roadId', |
| 145 | - labelCol: 'name' | |
| 146 | - } | |
| 146 | + labelCol: 'name', | |
| 147 | + }, | |
| 147 | 148 | }, |
| 148 | 149 | { |
| 149 | 150 | headerName: 'Область', |
| ... | ... | @@ -154,8 +155,8 @@ export class BusStopComponent { |
| 154 | 155 | cellEditorParams: { |
| 155 | 156 | data: this.regions, |
| 156 | 157 | valueCol: 'regionId', |
| 157 | - labelCol: 'name' | |
| 158 | - } | |
| 158 | + labelCol: 'name', | |
| 159 | + }, | |
| 159 | 160 | }, |
| 160 | 161 | { |
| 161 | 162 | headerName: 'Місцезнаходження, км+ справа', |
| ... | ... | @@ -176,8 +177,8 @@ export class BusStopComponent { |
| 176 | 177 | cellEditorParams: { |
| 177 | 178 | data: this.surfaceTypes, |
| 178 | 179 | valueCol: 'surfaceTypeId', |
| 179 | - labelCol: 'name' | |
| 180 | - } | |
| 180 | + labelCol: 'name', | |
| 181 | + }, | |
| 181 | 182 | }, |
| 182 | 183 | { |
| 183 | 184 | headerName: 'Технічний стан', |
| ... | ... | @@ -188,8 +189,8 @@ export class BusStopComponent { |
| 188 | 189 | cellEditorParams: { |
| 189 | 190 | data: this.states, |
| 190 | 191 | valueCol: 'stateCommonId', |
| 191 | - labelCol: 'value' | |
| 192 | - } | |
| 192 | + labelCol: 'value', | |
| 193 | + }, | |
| 193 | 194 | }, |
| 194 | 195 | , |
| 195 | 196 | { |
| ... | ... | @@ -201,8 +202,8 @@ export class BusStopComponent { |
| 201 | 202 | cellEditorParams: { |
| 202 | 203 | data: this.boolean, |
| 203 | 204 | valueCol: 'value', |
| 204 | - labelCol: 'label' | |
| 205 | - } | |
| 205 | + labelCol: 'label', | |
| 206 | + }, | |
| 206 | 207 | }, |
| 207 | 208 | { |
| 208 | 209 | headerName: 'Наявність елементів посад. майдан', |
| ... | ... | @@ -213,8 +214,8 @@ export class BusStopComponent { |
| 213 | 214 | cellEditorParams: { |
| 214 | 215 | data: this.boolean, |
| 215 | 216 | valueCol: 'value', |
| 216 | - labelCol: 'label' | |
| 217 | - } | |
| 217 | + labelCol: 'label', | |
| 218 | + }, | |
| 218 | 219 | }, |
| 219 | 220 | { |
| 220 | 221 | headerName: 'Наявність елементів заїзна кишеня', |
| ... | ... | @@ -225,8 +226,8 @@ export class BusStopComponent { |
| 225 | 226 | cellEditorParams: { |
| 226 | 227 | data: this.boolean, |
| 227 | 228 | valueCol: 'value', |
| 228 | - labelCol: 'label' | |
| 229 | - } | |
| 229 | + labelCol: 'label', | |
| 230 | + }, | |
| 230 | 231 | }, |
| 231 | 232 | { |
| 232 | 233 | headerName: 'Наявність туалету', |
| ... | ... | @@ -237,8 +238,8 @@ export class BusStopComponent { |
| 237 | 238 | cellEditorParams: { |
| 238 | 239 | data: this.boolean, |
| 239 | 240 | valueCol: 'value', |
| 240 | - labelCol: 'label' | |
| 241 | - } | |
| 241 | + labelCol: 'label', | |
| 242 | + }, | |
| 242 | 243 | }, |
| 243 | 244 | { |
| 244 | 245 | headerName: 'Рік будівництва', |
| ... | ... | @@ -249,7 +250,7 @@ export class BusStopComponent { |
| 249 | 250 | headerName: 'Рік ремонту', |
| 250 | 251 | field: 'yearRepair', |
| 251 | 252 | editable: true, |
| 252 | - } | |
| 253 | + }, | |
| 253 | 254 | ]; |
| 254 | 255 | } |
| 255 | 256 | |
| ... | ... | @@ -286,7 +287,7 @@ export class BusStopComponent { |
| 286 | 287 | if (!rows.length) { |
| 287 | 288 | return ; |
| 288 | 289 | } |
| 289 | - rows.forEach(element => { | |
| 290 | + rows.forEach((element) => { | |
| 290 | 291 | let id = element.data.busStopId; |
| 291 | 292 | if (id) { |
| 292 | 293 | this.enableLoader(); |
| ... | ... | @@ -301,7 +302,7 @@ export class BusStopComponent { |
| 301 | 302 | return 1; |
| 302 | 303 | } |
| 303 | 304 | }); |
| 304 | - sorted.forEach(item => { | |
| 305 | + sorted.forEach((item) => { | |
| 305 | 306 | this.rowData.splice(item.rowIndex, 1); |
| 306 | 307 | }); |
| 307 | 308 | this.gridOptions.api.setDatasource(this.setRowData(this.rowData)); | ... | ... |
src/app/data/service-object/service-object.component.html
| 1 | 1 | <div class="grid_containert" *ngIf="showGrid"> |
| 2 | - <ag-grid-ng2 #agGrid style="width: 100%; height: 100%;" class="ag-dark" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups | |
| 2 | + <ag-grid-ng2 #agGrid style="width: 100%; height: 100%;" class="ag-blue" [gridOptions]="gridOptions" [columnDefs]="columnDefs" [rowData]="rowData" enableColResize enableSorting enableFilter groupHeaders suppressRowClickSelection toolPanelSuppressGroups | |
| 3 | 3 | toolPanelSuppressValues debug rowHeight="22" rowSelection="multiple" (cellClicked)="onCellClicked($event)" (cellDoubleClicked)="onCellDoubleClicked($event)" (cellContextMenu)="onCellContextMenu($event)" (cellValueChanged)="onCellValueChanged($event)" |
| 4 | 4 | (cellFocused)="onCellFocused($event)" (rowSelected)="onRowSelected($event)" (selectionChanged)="onSelectionChanged()" (beforeFilterChanged)="onBeforeFilterChanged()" (afterFilterChanged)="onAfterFilterChanged()" (filterModified)="onFilterModified()" |
| 5 | 5 | (beforeSortChanged)="onBeforeSortChanged()" (afterSortChanged)="onAfterSortChanged()" (virtualRowRemoved)="onVirtualRowRemoved($event)" (rowClicked)="onRowClicked($event)"> | ... | ... |
src/app/data/service-object/service-object.component.ts
| 1 | -import {Component, ViewEncapsulation} from "@angular/core"; | |
| 2 | -import {GridOptions} from "ag-grid/main"; | |
| 1 | +import {Component, ViewEncapsulation} from '@angular/core'; | |
| 2 | +import {GridOptions} from 'ag-grid/main'; | |
| 3 | 3 | |
| 4 | 4 | import { ServiceObjectService } from '../../../services/service-object.service'; |
| 5 | 5 | import { ServiceObject } from '../../../models/service-object'; |
| ... | ... | @@ -44,14 +44,14 @@ export class ServiceObjectComponent { |
| 44 | 44 | constructor( |
| 45 | 45 | protected service: ServiceObjectService, |
| 46 | 46 | private dataService: ServiceObjectCreateService, |
| 47 | - private booleanService: BooleanSelectListService | |
| 47 | + private booleanService: BooleanSelectListService, | |
| 48 | 48 | ) { |
| 49 | 49 | this.gridOptions = <GridOptions>{}; |
| 50 | - this.gridOptions.enableSorting = true; | |
| 51 | - this.showGrid = true; | |
| 52 | - this.gridOptions.rowModelType = 'virtual'; | |
| 53 | - this.booleanService.getModels().then((models) => this.boolean = models); | |
| 54 | - this.dataService.getModels().then(models => { | |
| 50 | + this.gridOptions.enableSorting = true; | |
| 51 | + this.showGrid = true; | |
| 52 | + this.gridOptions.rowModelType = 'virtual'; | |
| 53 | + this.booleanService.getModels().then((models) => this.boolean = models); | |
| 54 | + this.dataService.getModels().then((models) => { | |
| 55 | 55 | this.regions = models.regionSelectListDsM as RegionSelectList[]; |
| 56 | 56 | this.states = models.stateCommonSelectListDsM as StateCommonSelectList[]; |
| 57 | 57 | this.departmentAffiliation = models.departmentAffiliationListDsM as DepartmentAffiliationList[]; |
| ... | ... | @@ -61,7 +61,7 @@ export class ServiceObjectComponent { |
| 61 | 61 | this.createColumnDefs(); |
| 62 | 62 | this.isBootstrapping = false; |
| 63 | 63 | }); |
| 64 | - this.service.getData().then((data) => { | |
| 64 | + this.service.getData().then((data) => { | |
| 65 | 65 | if (data.length){ |
| 66 | 66 | this.rowData = data; |
| 67 | 67 | } else { |
| ... | ... | @@ -88,7 +88,7 @@ export class ServiceObjectComponent { |
| 88 | 88 | } |
| 89 | 89 | // call the success callback |
| 90 | 90 | params.successCallback(rowsThisPage, lastRow); |
| 91 | - } | |
| 91 | + }, | |
| 92 | 92 | }; |
| 93 | 93 | return dataSource; |
| 94 | 94 | |
| ... | ... | @@ -114,7 +114,7 @@ export class ServiceObjectComponent { |
| 114 | 114 | checkboxSelection: true, |
| 115 | 115 | suppressSorting: true, |
| 116 | 116 | suppressMenu: true, |
| 117 | - pinned: true | |
| 117 | + pinned: true, | |
| 118 | 118 | }, |
| 119 | 119 | { |
| 120 | 120 | headerName: 'ID', |
| ... | ... | @@ -129,8 +129,8 @@ export class ServiceObjectComponent { |
| 129 | 129 | cellEditorParams: { |
| 130 | 130 | data: this.roads, |
| 131 | 131 | valueCol: 'roadId', |
| 132 | - labelCol: 'name' | |
| 133 | - } | |
| 132 | + labelCol: 'name', | |
| 133 | + }, | |
| 134 | 134 | }, |
| 135 | 135 | { |
| 136 | 136 | headerName: 'Область', |
| ... | ... | @@ -141,8 +141,8 @@ export class ServiceObjectComponent { |
| 141 | 141 | cellEditorParams: { |
| 142 | 142 | data: this.regions, |
| 143 | 143 | valueCol: 'regionId', |
| 144 | - labelCol: 'name' | |
| 145 | - } | |
| 144 | + labelCol: 'name', | |
| 145 | + }, | |
| 146 | 146 | }, |
| 147 | 147 | { |
| 148 | 148 | headerName: 'Місцезнаходження, км+ справа', |
| ... | ... | @@ -153,7 +153,7 @@ export class ServiceObjectComponent { |
| 153 | 153 | headerName: 'Місцезнаходження, км+ зліва', |
| 154 | 154 | field: 'locationLeft', |
| 155 | 155 | editable: true, |
| 156 | - } | |
| 156 | + }, | |
| 157 | 157 | ]; |
| 158 | 158 | } |
| 159 | 159 | |
| ... | ... | @@ -164,7 +164,7 @@ export class ServiceObjectComponent { |
| 164 | 164 | private onCellValueChanged($event) { |
| 165 | 165 | if ($event.oldValue !== $event.newValue) { |
| 166 | 166 | let data = JSON.stringify($event.data); |
| 167 | - let id = $event.data.serviceObjectId; | |
| 167 | + let id = $event.data.busStopId; | |
| 168 | 168 | let result = null; |
| 169 | 169 | if (id) { |
| 170 | 170 | this.isLoading = true; |
| ... | ... | @@ -175,8 +175,8 @@ export class ServiceObjectComponent { |
| 175 | 175 | return ; |
| 176 | 176 | } |
| 177 | 177 | this.isLoading = true; |
| 178 | - result = this.service.create(data).then((serviceObject) => { | |
| 179 | - this.rowData[$event.node.rowIndex] = serviceObject; | |
| 178 | + result = this.service.create(data).then((busStop) => { | |
| 179 | + this.rowData[$event.node.rowIndex] = busStop; | |
| 180 | 180 | this.gridOptions.api.setDatasource(this.setRowData(this.rowData)); |
| 181 | 181 | this.gridOptions.api.refreshVirtualPageCache(); |
| 182 | 182 | this.isLoading = false; |
| ... | ... | @@ -190,8 +190,8 @@ export class ServiceObjectComponent { |
| 190 | 190 | if (!rows.length) { |
| 191 | 191 | return ; |
| 192 | 192 | } |
| 193 | - rows.forEach(element => { | |
| 194 | - let id = element.data.serviceObjectId; | |
| 193 | + rows.forEach((element) => { | |
| 194 | + let id = element.data.busStopId; | |
| 195 | 195 | if (id) { |
| 196 | 196 | this.isLoading = true; |
| 197 | 197 | this.service.delete(id).then(() => this.isLoading = false); |
| ... | ... | @@ -205,7 +205,7 @@ export class ServiceObjectComponent { |
| 205 | 205 | return 1; |
| 206 | 206 | } |
| 207 | 207 | }); |
| 208 | - sorted.forEach(item => { | |
| 208 | + sorted.forEach((item) => { | |
| 209 | 209 | this.rowData.splice(item.rowIndex, 1); |
| 210 | 210 | }); |
| 211 | 211 | this.gridOptions.api.setDatasource(this.setRowData(this.rowData)); |
| ... | ... | @@ -273,4 +273,3 @@ export class ServiceObjectComponent { |
| 273 | 273 | console.log('onColumnEvent: ' + $event); |
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | -ServiceObject | |
| 277 | 276 | \ No newline at end of file | ... | ... |