diff --git a/.angular-cli.json b/.angular-cli.json index 8e74396f..6abee645 100644 --- a/.angular-cli.json +++ b/.angular-cli.json @@ -9,6 +9,7 @@ "outDir": "dist", "assets": [ "assets", + "app/main/content/components/angular-material", "favicon.ico" ], "index": "index.html", diff --git a/package-lock.json b/package-lock.json index 9af9e849..4fb35baf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "fuse2", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -51,9 +51,9 @@ } }, "@angular/cdk": { - "version": "2.0.0-beta.10", - "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-2.0.0-beta.10.tgz", - "integrity": "sha512-G0RvzxItfPy8JEdnyV/10GryE3zHehm3bUJ7U9dwYKhAzhye+MX0P6rs8VEmbClJb5SuZDr0ZZ53vbHhHsUh6A==", + "version": "2.0.0-beta.11", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-2.0.0-beta.11.tgz", + "integrity": "sha512-sbOqPoC439SDmpLiMq2XjidMMCJ6ofToDew4IXd9ne0jLSd0gGU20tTrRHf79HMTmlAySP7PBOq4Wv1eOFu/8A==", "requires": { "tslib": "1.7.1" } @@ -197,9 +197,9 @@ "dev": true }, "@angular/material": { - "version": "2.0.0-beta.10", - "resolved": "https://registry.npmjs.org/@angular/material/-/material-2.0.0-beta.10.tgz", - "integrity": "sha512-KAQ2t9wenI55oXkjjT6E4VGUSVu7AZmR+ytnaP96VBFk18wxcGnVaTbQmCvVm/vkbcdeoSF09D6ic94DHAE+1A==", + "version": "2.0.0-beta.11", + "resolved": "https://registry.npmjs.org/@angular/material/-/material-2.0.0-beta.11.tgz", + "integrity": "sha512-k4eyil3n8aHqqS3Fq4N77XvF3bcXA2Ttgf9ujDZwXmMd2NlR4XL+LJrguPLwNSQ6i3EYT+ovE2p4XUu2nkHVeQ==", "requires": { "tslib": "1.7.1" } @@ -446,15 +446,24 @@ "integrity": "sha1-etcMMQmUsPmA9A04Lc5ZlG/jDc8=" }, "angular-in-memory-web-api": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/angular-in-memory-web-api/-/angular-in-memory-web-api-0.3.2.tgz", - "integrity": "sha1-iDbZ4lNNN7co88taHK9v4ef7vs0=" + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/angular-in-memory-web-api/-/angular-in-memory-web-api-0.4.6.tgz", + "integrity": "sha1-EB9Zo4XrFTnH+TB1uv0MHLd061g=" }, "angular-resizable-element": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/angular-resizable-element/-/angular-resizable-element-1.2.0.tgz", "integrity": "sha512-i5xCl4n2VMgGK4gY6Jtho0K5aazbsqNw1bmPYpI9RwlKK+dIOcsMRuMl1JPWzrznHsm4qEsfYg+9KLkYsYy+/g==" }, + "angular2-markdown": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/angular2-markdown/-/angular2-markdown-1.6.0.tgz", + "integrity": "sha1-hja/narXD8NWMxJnB/+zPmhPurE=", + "requires": { + "marked": "0.3.6", + "prismjs": "1.8.1" + } + }, "ansi-html": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", @@ -1349,6 +1358,17 @@ "source-map": "0.5.6" } }, + "clipboard": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-1.7.1.tgz", + "integrity": "sha1-Ng1taUbpmnof7zleQrqStem1oWs=", + "optional": true, + "requires": { + "good-listener": "1.2.2", + "select": "1.1.2", + "tiny-emitter": "2.0.2" + } + }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -2351,6 +2371,12 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, + "delegate": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.1.3.tgz", + "integrity": "sha1-moJRp3fXAl+qVXN7w7BxdCEnqf0=", + "optional": true + }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -3469,6 +3495,15 @@ "minimatch": "3.0.4" } }, + "good-listener": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz", + "integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=", + "optional": true, + "requires": { + "delegate": "3.1.3" + } + }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -5060,6 +5095,11 @@ "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", "dev": true }, + "marked": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.6.tgz", + "integrity": "sha1-ssbGGPzOzk74bE/Gy4p8v1rtqNc=" + }, "math-expression-evaluator": { "version": "1.2.17", "resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz", @@ -6564,6 +6604,14 @@ "utila": "0.4.0" } }, + "prismjs": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.8.1.tgz", + "integrity": "sha1-vQzcMumlYcHIw8lzN2Wn8ew7VO4=", + "requires": { + "clipboard": "1.7.1" + } + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -7227,6 +7275,12 @@ } } }, + "select": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", + "integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=", + "optional": true + }, "select-hose": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", @@ -7828,15 +7882,6 @@ "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", "dev": true }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -7864,6 +7909,15 @@ } } }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -8052,6 +8106,12 @@ "setimmediate": "1.0.5" } }, + "tiny-emitter": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.0.2.tgz", + "integrity": "sha512-2NM0auVBGft5tee/OxP4PI3d8WItkDM+fPnaRAVo6xTDI2knbz9eC5ArWGqtGlYqiH3RU5yMpdyTTO7MguC4ow==", + "optional": true + }, "tmp": { "version": "0.0.31", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", diff --git a/package.json b/package.json index d1f7c5d6..5bf77528 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fuse2", - "version": "1.1.0", + "version": "1.1.1", "license": "", "scripts": { "ng": "ng", @@ -16,14 +16,14 @@ "private": true, "dependencies": { "@angular/animations": "4.4.3", - "@angular/cdk": "2.0.0-beta.10", + "@angular/cdk": "2.0.0-beta.11", "@angular/common": "4.4.3", "@angular/compiler": "4.4.3", "@angular/core": "4.4.3", "@angular/flex-layout": "2.0.0-beta.9", "@angular/forms": "4.4.3", "@angular/http": "4.4.3", - "@angular/material": "2.0.0-beta.10", + "@angular/material": "2.0.0-beta.11", "@angular/platform-browser": "4.4.3", "@angular/platform-browser-dynamic": "4.4.3", "@angular/router": "4.4.3", @@ -31,7 +31,8 @@ "@swimlane/ngx-datatable": "9.3.1", "@swimlane/ngx-dnd": "3.0.0", "angular-calendar": "0.19.0", - "angular-in-memory-web-api": "0.3.2", + "angular-in-memory-web-api": "0.4.6", + "angular2-markdown": "1.6.0", "classlist.js": "1.1.20150312", "core-js": "2.5.0", "d3": "4.10.0", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index b6cb2ff0..f47483ff 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -7,7 +7,6 @@ import { RouterModule, Routes } from '@angular/router'; import 'hammerjs'; import { SharedModule } from './core/modules/shared.module'; import { AppComponent } from './app.component'; -import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar'; import { FuseMainModule } from './main/main.module'; import { FuseSplashScreenService } from './core/services/splash-screen.service'; import { FuseConfigService } from './core/services/config.service'; @@ -32,7 +31,6 @@ const appRoutes: Routes = [ BrowserAnimationsModule, RouterModule.forRoot(appRoutes), SharedModule, - PerfectScrollbarModule.forRoot(), FuseMainModule, FuseSampleModule ], diff --git a/src/app/core/components/copier/copier.service.ts b/src/app/core/components/copier/copier.service.ts new file mode 100644 index 00000000..42ce0483 --- /dev/null +++ b/src/app/core/components/copier/copier.service.ts @@ -0,0 +1,60 @@ +/** + * This class is based on the code in the following projects: + * + * - https://github.com/zenorocha/select + * - https://github.com/zenorocha/clipboard.js/ + * + * Both released under MIT license - © Zeno Rocha + */ +import {Injectable} from '@angular/core'; + +@Injectable() +export class CopierService { + + private textarea: HTMLTextAreaElement; + + /** Copy the text value to the clipboard. */ + copyText(text: string): boolean { + this.createTextareaAndSelect(text); + + const copySuccessful = document.execCommand('copy'); + this.removeFake(); + + return copySuccessful; + } + + /** + * Creates a hidden textarea element, sets its value from `text` property, + * and makes a selection on it. + */ + private createTextareaAndSelect(text: string) { + // Create a fake element to hold the contents to copy + this.textarea = document.createElement('textarea'); + + // Prevent zooming on iOS + this.textarea.style.fontSize = '12pt'; + + // Hide the element + this.textarea.classList.add('cdk-visually-hidden'); + + // Move element to the same position vertically + const yPosition = window.pageYOffset || document.documentElement.scrollTop; + this.textarea.style.top = yPosition + 'px'; + + this.textarea.setAttribute('readonly', ''); + this.textarea.value = text; + + document.body.appendChild(this.textarea); + + this.textarea.select(); + this.textarea.setSelectionRange(0, this.textarea.value.length); + } + + /** Remove the text area from the DOM. */ + private removeFake() { + if (this.textarea) { + document.body.removeChild(this.textarea); + this.textarea = null; + } + } +} diff --git a/src/app/core/components/navigation/horizontal/nav-collapse/nav-horizontal-collapse.component.html b/src/app/core/components/navigation/horizontal/nav-collapse/nav-horizontal-collapse.component.html index 4f061e79..9fcef7d6 100644 --- a/src/app/core/components/navigation/horizontal/nav-collapse/nav-horizontal-collapse.component.html +++ b/src/app/core/components/navigation/horizontal/nav-collapse/nav-horizontal-collapse.component.html @@ -11,6 +11,7 @@ + diff --git a/src/app/core/components/navigation/navigation.component.ts b/src/app/core/components/navigation/navigation.component.ts index a812cd0c..edd2c064 100644 --- a/src/app/core/components/navigation/navigation.component.ts +++ b/src/app/core/components/navigation/navigation.component.ts @@ -26,7 +26,6 @@ export class FuseNavigationComponent implements OnDestroy ngOnDestroy() { - console.warn('destroyed'); this.navigationModelChangeSubscription.unsubscribe(); } diff --git a/src/app/core/components/navigation/navigation.service.ts b/src/app/core/components/navigation/navigation.service.ts index b468ec37..ca22f6ed 100644 --- a/src/app/core/components/navigation/navigation.service.ts +++ b/src/app/core/components/navigation/navigation.service.ts @@ -5,6 +5,7 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject'; @Injectable() export class FuseNavigationService { + onNavCollapseToggle = new EventEmitter(); onNavCollapseToggled = new EventEmitter(); onNavigationModelChange: BehaviorSubject = new BehaviorSubject({}); navigationModel: NavigationModel; diff --git a/src/app/core/components/navigation/vertical/nav-collapse/nav-vertical-collapse.component.html b/src/app/core/components/navigation/vertical/nav-collapse/nav-vertical-collapse.component.html index 2c3e9647..a55711f1 100644 --- a/src/app/core/components/navigation/vertical/nav-collapse/nav-vertical-collapse.component.html +++ b/src/app/core/components/navigation/vertical/nav-collapse/nav-vertical-collapse.component.html @@ -7,5 +7,6 @@ + diff --git a/src/app/core/components/navigation/vertical/nav-collapse/nav-vertical-collapse.component.ts b/src/app/core/components/navigation/vertical/nav-collapse/nav-vertical-collapse.component.ts index e4baa861..f215bf6a 100644 --- a/src/app/core/components/navigation/vertical/nav-collapse/nav-vertical-collapse.component.ts +++ b/src/app/core/components/navigation/vertical/nav-collapse/nav-vertical-collapse.component.ts @@ -43,7 +43,7 @@ export class FuseNavVerticalCollapseComponent implements OnInit this.navigationService.onNavCollapseToggled .subscribe( (clickedItem) => { - if ( clickedItem.children ) + if ( clickedItem && clickedItem.children ) { // Check if the clicked item is one // of the children of this item @@ -82,6 +82,7 @@ export class FuseNavVerticalCollapseComponent implements OnInit // Navigation collapse toggled... this.navigationService.onNavCollapseToggled.emit(this.item); + this.navigationService.onNavCollapseToggle.emit(); } /** @@ -95,6 +96,7 @@ export class FuseNavVerticalCollapseComponent implements OnInit } this.isOpen = true; + this.navigationService.onNavCollapseToggle.emit(); } /** @@ -107,6 +109,7 @@ export class FuseNavVerticalCollapseComponent implements OnInit return; } this.isOpen = false; + this.navigationService.onNavCollapseToggle.emit(); } /** diff --git a/src/app/core/components/navigation/vertical/nav-group/nav-vertical-group.component.ts b/src/app/core/components/navigation/vertical/nav-group/nav-vertical-group.component.ts index f429b5d1..0d5e681f 100644 --- a/src/app/core/components/navigation/vertical/nav-group/nav-vertical-group.component.ts +++ b/src/app/core/components/navigation/vertical/nav-group/nav-vertical-group.component.ts @@ -7,7 +7,7 @@ import { Component, HostBinding, Input, OnInit } from '@angular/core'; }) export class FuseNavVerticalGroupComponent implements OnInit { - @HostBinding('class') classes = 'nav-group'; + @HostBinding('class') classes = 'nav-group nav-item'; @Input() item: any; constructor() diff --git a/src/app/core/modules/material.module.ts b/src/app/core/modules/material.module.ts index dd36d87c..f4a3d895 100644 --- a/src/app/core/modules/material.module.ts +++ b/src/app/core/modules/material.module.ts @@ -8,7 +8,6 @@ import { MdTooltipModule, MdCardModule, MdChipsModule, - MdCoreModule, MdDatepickerModule, MdDialogModule, MdExpansionModule, @@ -28,6 +27,7 @@ import { MdSliderModule, MdSlideToggleModule, MdSnackBarModule, + MdStepperModule, MdSortModule, MdTableModule, MdTabsModule @@ -42,7 +42,6 @@ import { CdkTableModule } from '@angular/cdk/table'; MdCardModule, MdCheckboxModule, MdChipsModule, - MdCoreModule, MdDatepickerModule, MdDialogModule, MdExpansionModule, @@ -62,6 +61,7 @@ import { CdkTableModule } from '@angular/cdk/table'; MdSliderModule, MdSlideToggleModule, MdSnackBarModule, + MdStepperModule, MdSortModule, MdTableModule, MdTabsModule, @@ -76,7 +76,6 @@ import { CdkTableModule } from '@angular/cdk/table'; MdCardModule, MdCheckboxModule, MdChipsModule, - MdCoreModule, MdDatepickerModule, MdDialogModule, MdExpansionModule, @@ -96,6 +95,7 @@ import { CdkTableModule } from '@angular/cdk/table'; MdSliderModule, MdSlideToggleModule, MdSnackBarModule, + MdStepperModule, MdSortModule, MdTableModule, MdTabsModule, diff --git a/src/app/core/modules/shared.module.ts b/src/app/core/modules/shared.module.ts index 8e83073b..472dbfbe 100644 --- a/src/app/core/modules/shared.module.ts +++ b/src/app/core/modules/shared.module.ts @@ -21,6 +21,7 @@ import { FuseIfOnDomDirective } from '../directives/fuse-if-on-dom/fuse-if-on-do import { FuseMaterialColorPickerComponent } from '../components/material-color-picker/material-color-picker.component'; import { Md2Module } from 'md2'; import { CookieService } from 'ngx-cookie-service'; +import { MarkdownModule } from 'angular2-markdown'; @NgModule({ declarations : [ @@ -43,7 +44,8 @@ import { CookieService } from 'ngx-cookie-service'; ColorPickerModule, NgxDnDModule, NgxDatatableModule, - Md2Module + Md2Module, + MarkdownModule ], exports : [ FlexLayoutModule, @@ -62,7 +64,8 @@ import { CookieService } from 'ngx-cookie-service'; NgxDatatableModule, FuseIfOnDomDirective, FuseMaterialColorPickerComponent, - Md2Module + Md2Module, + MarkdownModule ], entryComponents: [ FuseConfirmDialogComponent diff --git a/src/app/core/scss/partials/_navigation.scss b/src/app/core/scss/partials/_navigation.scss index 0c8e8607..ef6cbe13 100644 --- a/src/app/core/scss/partials/_navigation.scss +++ b/src/app/core/scss/partials/_navigation.scss @@ -12,6 +12,7 @@ } .nav-group { + display: block; > .group-title { position: relative; @@ -103,7 +104,9 @@ > .nav-item { - > .nav-link { + > .nav-link, + &.nav-group > .group-title, + &.nav-group > .group-items > .nav-item > .nav-link { padding-left: 56px; } @@ -111,7 +114,9 @@ > .nav-item { - > .nav-link { + > .nav-link, + &.nav-group > .group-title, + &.nav-group > .group-items > .nav-item > .nav-link { padding-left: 72px; } } diff --git a/src/app/core/scss/partials/plugins/_plugins.scss b/src/app/core/scss/partials/plugins/_plugins.scss index 6e4ef192..f9d4c979 100644 --- a/src/app/core/scss/partials/plugins/_plugins.scss +++ b/src/app/core/scss/partials/plugins/_plugins.scss @@ -1,4 +1,5 @@ @import "highlight"; +@import "prism"; @import "perfect-scrollbar"; @import "ngx-datatable"; @import "ngx-color-picker"; diff --git a/src/app/main/navbar/vertical/navbar-vertical.component.ts b/src/app/main/navbar/vertical/navbar-vertical.component.ts index 71c7b8bf..1c20080b 100644 --- a/src/app/main/navbar/vertical/navbar-vertical.component.ts +++ b/src/app/main/navbar/vertical/navbar-vertical.component.ts @@ -43,8 +43,7 @@ export class FuseNavbarVerticalComponent implements OnInit, OnDestroy { navBarService.setNavBar(this); - this.fuseNavigationService.onNavCollapseToggled.subscribe(() => { - + this.fuseNavigationService.onNavCollapseToggle.subscribe(() => { setTimeout(() => { this.fusePerfectScrollbarDirective.update(); }, 310);