mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-10 04:25:08 +00:00
Added lodash for convenience
+ Removed the default settings from the settings service - this means the user must provide the default settings at all time
This commit is contained in:
parent
ed4a3cb8d7
commit
ca42f71b0e
45
package-lock.json
generated
45
package-lock.json
generated
|
@ -108,7 +108,7 @@
|
||||||
"less-loader": "4.0.6",
|
"less-loader": "4.0.6",
|
||||||
"license-webpack-plugin": "1.2.3",
|
"license-webpack-plugin": "1.2.3",
|
||||||
"loader-utils": "1.1.0",
|
"loader-utils": "1.1.0",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"memory-fs": "0.4.1",
|
"memory-fs": "0.4.1",
|
||||||
"minimatch": "3.0.4",
|
"minimatch": "3.0.4",
|
||||||
"node-modules-path": "1.0.1",
|
"node-modules-path": "1.0.1",
|
||||||
|
@ -373,6 +373,12 @@
|
||||||
"@types/jasmine": "2.8.6"
|
"@types/jasmine": "2.8.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/lodash": {
|
||||||
|
"version": "4.14.106",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.106.tgz",
|
||||||
|
"integrity": "sha512-tOSvCVrvSqFZ4A/qrqqm6p37GZoawsZtoR0SJhlF7EonNZUgrn8FfT+RNQ11h+NUpMt6QVe36033f3qEKBwfWA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "6.0.101",
|
"version": "6.0.101",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.101.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.101.tgz",
|
||||||
|
@ -845,7 +851,7 @@
|
||||||
"integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==",
|
"integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"lodash": "4.17.4"
|
"lodash": "4.17.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"async-each": {
|
"async-each": {
|
||||||
|
@ -969,7 +975,7 @@
|
||||||
"babel-types": "6.26.0",
|
"babel-types": "6.26.0",
|
||||||
"detect-indent": "4.0.0",
|
"detect-indent": "4.0.0",
|
||||||
"jsesc": "1.3.0",
|
"jsesc": "1.3.0",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"source-map": "0.5.7",
|
"source-map": "0.5.7",
|
||||||
"trim-right": "1.0.1"
|
"trim-right": "1.0.1"
|
||||||
},
|
},
|
||||||
|
@ -1011,7 +1017,7 @@
|
||||||
"babel-traverse": "6.26.0",
|
"babel-traverse": "6.26.0",
|
||||||
"babel-types": "6.26.0",
|
"babel-types": "6.26.0",
|
||||||
"babylon": "6.18.0",
|
"babylon": "6.18.0",
|
||||||
"lodash": "4.17.4"
|
"lodash": "4.17.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"babel-traverse": {
|
"babel-traverse": {
|
||||||
|
@ -1028,7 +1034,7 @@
|
||||||
"debug": "2.6.9",
|
"debug": "2.6.9",
|
||||||
"globals": "9.18.0",
|
"globals": "9.18.0",
|
||||||
"invariant": "2.2.3",
|
"invariant": "2.2.3",
|
||||||
"lodash": "4.17.4"
|
"lodash": "4.17.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"babel-types": {
|
"babel-types": {
|
||||||
|
@ -1039,7 +1045,7 @@
|
||||||
"requires": {
|
"requires": {
|
||||||
"babel-runtime": "6.26.0",
|
"babel-runtime": "6.26.0",
|
||||||
"esutils": "2.0.2",
|
"esutils": "2.0.2",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"to-fast-properties": "1.0.3"
|
"to-fast-properties": "1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2050,7 +2056,7 @@
|
||||||
"integrity": "sha1-RYwH4J4NkA/Ci3Cj/sLazR0st/Y=",
|
"integrity": "sha1-RYwH4J4NkA/Ci3Cj/sLazR0st/Y=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"lodash": "4.17.4"
|
"lodash": "4.17.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"combine-source-map": {
|
"combine-source-map": {
|
||||||
|
@ -5220,7 +5226,7 @@
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"glob": "7.1.2",
|
"glob": "7.1.2",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"minimatch": "3.0.4"
|
"minimatch": "3.0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5527,7 +5533,7 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"request": "2.81.0"
|
"request": "2.81.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5614,7 +5620,7 @@
|
||||||
"bluebird": "3.5.1",
|
"bluebird": "3.5.1",
|
||||||
"html-minifier": "3.5.10",
|
"html-minifier": "3.5.10",
|
||||||
"loader-utils": "0.2.17",
|
"loader-utils": "0.2.17",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"pretty-error": "2.1.1",
|
"pretty-error": "2.1.1",
|
||||||
"toposort": "1.0.6"
|
"toposort": "1.0.6"
|
||||||
},
|
},
|
||||||
|
@ -5753,7 +5759,7 @@
|
||||||
"requires": {
|
"requires": {
|
||||||
"http-proxy": "1.16.2",
|
"http-proxy": "1.16.2",
|
||||||
"is-glob": "3.1.0",
|
"is-glob": "3.1.0",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"micromatch": "2.3.11"
|
"micromatch": "2.3.11"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -6712,7 +6718,7 @@
|
||||||
"graceful-fs": "4.1.11",
|
"graceful-fs": "4.1.11",
|
||||||
"http-proxy": "1.16.2",
|
"http-proxy": "1.16.2",
|
||||||
"isbinaryfile": "3.0.2",
|
"isbinaryfile": "3.0.2",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"log4js": "2.5.2",
|
"log4js": "2.5.2",
|
||||||
"mime": "1.6.0",
|
"mime": "1.6.0",
|
||||||
"minimatch": "3.0.4",
|
"minimatch": "3.0.4",
|
||||||
|
@ -6964,10 +6970,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.4",
|
"version": "4.17.5",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz",
|
||||||
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=",
|
"integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"lodash.assign": {
|
"lodash.assign": {
|
||||||
"version": "4.2.0",
|
"version": "4.2.0",
|
||||||
|
@ -7244,7 +7249,7 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"lodash": "4.17.4"
|
"lodash": "4.17.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"debug": {
|
"debug": {
|
||||||
|
@ -9561,7 +9566,7 @@
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"extend": "3.0.1",
|
"extend": "3.0.1",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"request": "2.81.0",
|
"request": "2.81.0",
|
||||||
"when": "3.7.8"
|
"when": "3.7.8"
|
||||||
},
|
},
|
||||||
|
@ -9708,7 +9713,7 @@
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"glob": "7.1.2",
|
"glob": "7.1.2",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"scss-tokenizer": "0.2.3",
|
"scss-tokenizer": "0.2.3",
|
||||||
"yargs": "7.1.0"
|
"yargs": "7.1.0"
|
||||||
}
|
}
|
||||||
|
@ -12498,7 +12503,7 @@
|
||||||
"express": "4.16.2",
|
"express": "4.16.2",
|
||||||
"filesize": "3.6.0",
|
"filesize": "3.6.0",
|
||||||
"gzip-size": "4.1.0",
|
"gzip-size": "4.1.0",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.5",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"opener": "1.4.3",
|
"opener": "1.4.3",
|
||||||
"ws": "4.1.0"
|
"ws": "4.1.0"
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
"d3": "4.13.0",
|
"d3": "4.13.0",
|
||||||
"hammerjs": "2.0.8",
|
"hammerjs": "2.0.8",
|
||||||
"intl": "1.2.5",
|
"intl": "1.2.5",
|
||||||
|
"lodash": "4.17.5",
|
||||||
"moment": "2.21.0",
|
"moment": "2.21.0",
|
||||||
"ng2-charts": "1.6.0",
|
"ng2-charts": "1.6.0",
|
||||||
"ngrx-store-freeze": "0.2.1",
|
"ngrx-store-freeze": "0.2.1",
|
||||||
|
@ -67,6 +68,7 @@
|
||||||
"@angularclass/hmr": "2.1.3",
|
"@angularclass/hmr": "2.1.3",
|
||||||
"@types/jasmine": "2.8.6",
|
"@types/jasmine": "2.8.6",
|
||||||
"@types/jasminewd2": "2.0.3",
|
"@types/jasminewd2": "2.0.3",
|
||||||
|
"@types/lodash": "4.14.106",
|
||||||
"@types/node": "6.0.101",
|
"@types/node": "6.0.101",
|
||||||
"codelyzer": "4.2.1",
|
"codelyzer": "4.2.1",
|
||||||
"jasmine-core": "2.8.0",
|
"jasmine-core": "2.8.0",
|
||||||
|
|
|
@ -1,25 +1,8 @@
|
||||||
import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
|
import { Inject, Injectable, InjectionToken } from '@angular/core';
|
||||||
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
|
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
|
||||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||||
import { Platform } from '@angular/cdk/platform';
|
import { Platform } from '@angular/cdk/platform';
|
||||||
|
import * as _ from 'lodash';
|
||||||
// Define the default config
|
|
||||||
const DEFAULT_CONFIG = {
|
|
||||||
layout : {
|
|
||||||
navigation : 'left', // 'right', 'left', 'top', 'none'
|
|
||||||
navigationFolded: false, // true, false
|
|
||||||
toolbar : 'below', // 'above', 'below', 'none'
|
|
||||||
footer : 'below', // 'above', 'below', 'none'
|
|
||||||
mode : 'fullwidth' // 'boxed', 'fullwidth'
|
|
||||||
},
|
|
||||||
colorClasses : {
|
|
||||||
toolbar: 'mat-white-500-bg',
|
|
||||||
navbar : 'mat-fuse-dark-700-bg',
|
|
||||||
footer : 'mat-fuse-dark-900-bg'
|
|
||||||
},
|
|
||||||
customScrollbars: true,
|
|
||||||
routerAnimation : 'fadeIn' // fadeIn, slideUp, slideDown, slideRight, slideLeft, none
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create the injection token for the custom config
|
// Create the injection token for the custom config
|
||||||
export const FUSE_CONFIG = new InjectionToken('fuseCustomConfig');
|
export const FUSE_CONFIG = new InjectionToken('fuseCustomConfig');
|
||||||
|
@ -43,18 +26,11 @@ export class FuseConfigService
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
public platform: Platform,
|
public platform: Platform,
|
||||||
@Inject(FUSE_CONFIG) @Optional() config
|
@Inject(FUSE_CONFIG) config
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Set the default settings from the constant
|
// Set the default config from the user provided one (forRoot)
|
||||||
this.defaultConfig = DEFAULT_CONFIG;
|
this.defaultConfig = config;
|
||||||
|
|
||||||
// If custom config provided with forRoot,
|
|
||||||
// use them as default config...
|
|
||||||
if ( config )
|
|
||||||
{
|
|
||||||
this.defaultConfig = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable Custom Scrollbars if Browser is Mobile
|
* Disable Custom Scrollbars if Browser is Mobile
|
||||||
|
@ -65,7 +41,7 @@ export class FuseConfigService
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the config from the default config
|
// Set the config from the default config
|
||||||
this.config = {...this.defaultConfig};
|
this.config = _.cloneDeep(this.defaultConfig);
|
||||||
|
|
||||||
// Reload the default settings for the
|
// Reload the default settings for the
|
||||||
// layout on every navigation start
|
// layout on every navigation start
|
||||||
|
@ -106,20 +82,8 @@ export class FuseConfigService
|
||||||
// Set the SetConfigRan true
|
// Set the SetConfigRan true
|
||||||
this.isSetConfigRan = true;
|
this.isSetConfigRan = true;
|
||||||
|
|
||||||
// Set the config from the given object
|
// Merge the config
|
||||||
// Ugly, but works for now...
|
this.config = _.merge({}, this.config, config);
|
||||||
this.config = {
|
|
||||||
...this.config,
|
|
||||||
...config,
|
|
||||||
layout : {
|
|
||||||
...this.config.layout,
|
|
||||||
...config.layout
|
|
||||||
},
|
|
||||||
colorClasses: {
|
|
||||||
...this.config.colorClasses,
|
|
||||||
...config.colorClasses
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Trigger the event
|
// Trigger the event
|
||||||
this.onConfigChanged.next(this.config);
|
this.onConfigChanged.next(this.config);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user