diff --git a/package-lock.json b/package-lock.json index aea0e3b15f..8b35517c45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -690,19 +690,19 @@ } }, "@nebular/auth": { - "version": "2.0.0-rc.7", - "resolved": "https://registry.npmjs.org/@nebular/auth/-/auth-2.0.0-rc.7.tgz", - "integrity": "sha512-0REoqU771vKuF02bnBZVqDAzC5WfWfB79dl6Wk51Oau6tOJDpL3Kw3FPbPeHHDr3tzFj9UNDXGmtJ0DyUAaibQ==" + "version": "2.0.0-rc.8", + "resolved": "https://registry.npmjs.org/@nebular/auth/-/auth-2.0.0-rc.8.tgz", + "integrity": "sha512-uImudGbG2qcaTpimjJFyqRdxhjE62sQfqqzZcH//NsokXbC5+8YMfUMcX4SpPTYOpWsx4p9T4vEIUDJOoYIBnw==" }, "@nebular/security": { - "version": "2.0.0-rc.7", - "resolved": "https://registry.npmjs.org/@nebular/security/-/security-2.0.0-rc.7.tgz", - "integrity": "sha512-K2VOvgUUzd54v7VSs6pFfzdq0UhRlYhCP4EPCi3INcM7mY/dh6F6yIDZMlz0AybS5et1G4PMWUHqvUi1AnrSsQ==" + "version": "2.0.0-rc.8", + "resolved": "https://registry.npmjs.org/@nebular/security/-/security-2.0.0-rc.8.tgz", + "integrity": "sha512-aC3q1AR7jmF3Cm/TNT4Rut/ZQcmBrna0zNPxwg5cBSvWAPk3vRXVTYSFPQCNHDs2tyXJz4Xf50Sl2YJQhCiMnw==" }, "@nebular/theme": { - "version": "2.0.0-rc.7", - "resolved": "https://registry.npmjs.org/@nebular/theme/-/theme-2.0.0-rc.7.tgz", - "integrity": "sha512-I8hB+ik/1086HSx8tbJcHuZfXdfpq5lg8cDcUMW0h8Y3Gp0Na5sqpdq850SoTlcqc4HiE6CFS/fkx6ro+8HtTQ==" + "version": "2.0.0-rc.8", + "resolved": "https://registry.npmjs.org/@nebular/theme/-/theme-2.0.0-rc.8.tgz", + "integrity": "sha512-1BLG4J0ElUOHMjIJQ6lSSzMK+8iaPX1brDVPI3Ol0O0FTiyCPVXugyK09/GNX2Of4xUIZqX7VvNYGywiJ7dUTw==" }, "@ng-bootstrap/ng-bootstrap": { "version": "1.0.0", @@ -3106,16 +3106,6 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, - "cors": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", - "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", - "dev": true, - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, "cosmiconfig": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-2.2.2.tgz", @@ -3584,7 +3574,6 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, "requires": { "ms": "2.0.0" } @@ -3747,8 +3736,7 @@ "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" }, "des.js": { "version": "1.0.0", @@ -3763,8 +3751,7 @@ "destroy": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", - "dev": true + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, "detect-indent": { "version": "4.0.0", @@ -4186,8 +4173,7 @@ "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", - "dev": true + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "ejs": { "version": "2.6.1", @@ -4225,8 +4211,7 @@ "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", - "dev": true + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, "end-of-stream": { "version": "1.4.1", @@ -4429,8 +4414,7 @@ "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", - "dev": true + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" }, "escape-string-regexp": { "version": "1.0.5", @@ -4525,8 +4509,7 @@ "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", - "dev": true + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" }, "event-stream": { "version": "3.3.4", @@ -5099,8 +5082,7 @@ "fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", - "dev": true + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, "from": { "version": "0.1.7", @@ -7122,7 +7104,6 @@ "version": "1.6.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "dev": true, "requires": { "depd": "1.1.1", "inherits": "2.0.3", @@ -7133,14 +7114,12 @@ "depd": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=", - "dev": true + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" }, "setprototypeof": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=", - "dev": true + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" } } }, @@ -7639,8 +7618,7 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { "version": "1.3.5", @@ -8039,8 +8017,7 @@ "is-wsl": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", - "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", - "dev": true + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" }, "isarray": { "version": "1.0.0", @@ -8996,17 +8973,10 @@ "integrity": "sha1-pp8ObKWB4DkapXlBlw4XwwjdSGk=", "dev": true, "requires": { - "colors": "latest", "connect": "3.4.x", - "cors": "latest", - "event-stream": "latest", "faye-websocket": "0.11.x", "http-auth": "2.4.x", "morgan": "^1.6.1", - "object-assign": "latest", - "opn": "latest", - "proxy-middleware": "latest", - "send": "latest", "serve-index": "^1.7.2", "watchr": "2.6.x" }, @@ -9014,8 +8984,7 @@ "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=" }, "faye-websocket": { "version": "0.11.1", @@ -9029,20 +8998,17 @@ "mime": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", - "dev": true + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, "opn": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/opn/-/opn-5.2.0.tgz", "integrity": "sha512-Jd/GpzPyHF4P2/aNOVmS3lfMSWV9J7cOhCG1s08XCEAsPkB7lp6ddiU0J7XzyQRDUh8BqJ7PchfINjR8jyofRQ==", - "dev": true, "requires": { "is-wsl": "^1.1.0" } @@ -9051,7 +9017,6 @@ "version": "0.16.2", "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "dev": true, "requires": { "debug": "2.6.9", "depd": "~1.1.2", @@ -9071,8 +9036,7 @@ "statuses": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", - "dev": true + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" } } }, @@ -9758,8 +9722,7 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "multicast-dns": { "version": "6.2.3", @@ -10444,7 +10407,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "dev": true, "requires": { "ee-first": "1.1.1" } @@ -11440,12 +11402,6 @@ "ipaddr.js": "1.6.0" } }, - "proxy-middleware": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/proxy-middleware/-/proxy-middleware-0.15.0.tgz", - "integrity": "sha1-o/3xvvtzD5UZZYcqwvYHTGFHelY=", - "dev": true - }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -11612,8 +11568,7 @@ "range-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=", - "dev": true + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" }, "raw-body": { "version": "2.3.2", @@ -12965,8 +12920,7 @@ "statuses": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", - "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", - "dev": true + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" }, "stdout-stream": { "version": "1.4.0", diff --git a/package.json b/package.json index 4b2cfd0d1d..4db7adce78 100644 --- a/package.json +++ b/package.json @@ -40,9 +40,9 @@ "@angular/platform-browser-dynamic": "6.0.0", "@angular/router": "6.0.0", "@asymmetrik/ngx-leaflet": "3.0.1", - "@nebular/auth": "^2.0.0-rc.7", - "@nebular/security": "^2.0.0-rc.7", - "@nebular/theme": "^2.0.0-rc.7", + "@nebular/auth": "^2.0.0-rc.8", + "@nebular/security": "^2.0.0-rc.8", + "@nebular/theme": "^2.0.0-rc.8", "@ng-bootstrap/ng-bootstrap": "1.0.0", "@swimlane/ngx-charts": "7.0.1", "angular2-chartjs": "0.4.1", diff --git a/src/app/@core/data/state.service.ts b/src/app/@core/data/state.service.ts index 6f1328fbf0..3f0847d5b7 100644 --- a/src/app/@core/data/state.service.ts +++ b/src/app/@core/data/state.service.ts @@ -1,10 +1,11 @@ +import { Injectable, OnDestroy } from '@angular/core'; +import { of as observableOf, Observable, BehaviorSubject } from 'rxjs'; +import { takeWhile } from 'rxjs/operators'; -import { of as observableOf, Observable , BehaviorSubject } from 'rxjs'; -import { Injectable } from '@angular/core'; - +import { NbLayoutDirectionService, NbLayoutDirection } from '@nebular/theme'; @Injectable() -export class StateService { +export class StateService implements OnDestroy { protected layouts: any = [ { @@ -27,21 +28,44 @@ export class StateService { protected sidebars: any = [ { - name: 'Left Sidebar', + name: 'Sidebar at layout start', icon: 'nb-layout-sidebar-left', - id: 'left', + id: 'start', selected: true, }, { - name: 'Right Sidebar', + name: 'Sidebar at layout end', icon: 'nb-layout-sidebar-right', - id: 'right', + id: 'end', }, ]; protected layoutState$ = new BehaviorSubject(this.layouts[0]); protected sidebarState$ = new BehaviorSubject(this.sidebars[0]); + alive = true; + + constructor(directionService: NbLayoutDirectionService) { + directionService.onDirectionChange() + .pipe(takeWhile(() => this.alive)) + .subscribe(direction => this.updateSidebarIcons(direction)); + + this.updateSidebarIcons(directionService.getDirection()); + } + + ngOnDestroy() { + this.alive = false; + } + + private updateSidebarIcons(direction: NbLayoutDirection) { + const [ startSidebar, endSidebar ] = this.sidebars; + const isLtr = direction === NbLayoutDirection.LTR; + const startIconClass = isLtr ? 'nb-layout-sidebar-left' : 'nb-layout-sidebar-right'; + const endIconClass = isLtr ? 'nb-layout-sidebar-right' : 'nb-layout-sidebar-left'; + startSidebar.icon = startIconClass; + endSidebar.icon = endIconClass; + } + setLayoutState(state: any): any { this.layoutState$.next(state); } diff --git a/src/app/@theme/components/header/header.component.html b/src/app/@theme/components/header/header.component.html index 72ee690cfa..d1e747c10f 100644 --- a/src/app/@theme/components/header/header.component.html +++ b/src/app/@theme/components/header/header.component.html @@ -6,6 +6,7 @@