mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-12-22 21:07:07 +00:00
Compare commits
153 Commits
v1.3.4-ske
...
v6.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1acfe2dfb3 | ||
|
|
6d3cfe8ace | ||
|
|
147525d16a | ||
|
|
29f8ddda9e | ||
|
|
1f77e201a1 | ||
|
|
75b7e4e270 | ||
|
|
9efab7ed20 | ||
|
|
65523c3c95 | ||
|
|
22b3a3c799 | ||
|
|
2b4bd45ad6 | ||
|
|
1e47c79f15 | ||
|
|
58ab766edf | ||
|
|
8db1206c91 | ||
|
|
562ae61098 | ||
|
|
e43ae86a58 | ||
|
|
5459579d04 | ||
|
|
95759be710 | ||
|
|
edb4683dcb | ||
|
|
58dd3b93c3 | ||
|
|
91e8d88488 | ||
|
|
ddcf1d5483 | ||
|
|
0b5727ff15 | ||
|
|
20f80e3fe4 | ||
|
|
5bf9fd177b | ||
|
|
507fe97e84 | ||
|
|
a6a7442607 | ||
|
|
43189728e5 | ||
|
|
9c88524185 | ||
|
|
52cfeec2e7 | ||
|
|
ffb134f1ec | ||
|
|
8520ca77be | ||
|
|
a174c00072 | ||
|
|
42ab15d9e1 | ||
|
|
a87e68251e | ||
|
|
436bd0aa91 | ||
|
|
d5f1fcfefa | ||
|
|
234dec3d6a | ||
|
|
928be05725 | ||
|
|
bcf5a9e6cb | ||
|
|
e79bfb7bce | ||
|
|
86815b7737 | ||
|
|
73a81699ec | ||
|
|
c2970e34ba | ||
|
|
7d6a92fada | ||
|
|
acbed8e305 | ||
|
|
b46f81b6ac | ||
|
|
a284063d22 | ||
|
|
1c8cc35693 | ||
|
|
6cc7d03430 | ||
|
|
f8f97f8ad4 | ||
|
|
bd79830cb4 | ||
|
|
5ed04c3925 | ||
|
|
90fe94a417 | ||
|
|
a39021188e | ||
|
|
ba35ebae94 | ||
|
|
97f864bb76 | ||
|
|
ea15a8b832 | ||
|
|
5c1f2ad1e3 | ||
|
|
420d8d1a1b | ||
|
|
f693298f3a | ||
|
|
a29c4b01ad | ||
|
|
1b94d8d14e | ||
|
|
232b4de752 | ||
|
|
b918fa4122 | ||
|
|
83c395b866 | ||
|
|
387077882b | ||
|
|
70d895c6ed | ||
|
|
0ac4e6c220 | ||
|
|
850e43c653 | ||
|
|
1e6bd8139c | ||
|
|
c6969cf9df | ||
|
|
745c51878d | ||
|
|
9635165316 | ||
|
|
02f305be1f | ||
|
|
27197a55dc | ||
|
|
5d000a849d | ||
|
|
07341c5ffa | ||
|
|
742da904da | ||
|
|
880529ad62 | ||
|
|
126ba35d3d | ||
|
|
0039f44936 | ||
|
|
ced0853af8 | ||
|
|
3d483b5a4b | ||
|
|
96813406a2 | ||
|
|
7fa892d7cc | ||
|
|
832a08208a | ||
|
|
7580176042 | ||
|
|
725719317a | ||
|
|
5ce276de8e | ||
|
|
d330b42dec | ||
|
|
6bf2fe0b17 | ||
|
|
a2187e0134 | ||
|
|
a1cf7dba91 | ||
|
|
b8039899db | ||
|
|
26e55d7f3d | ||
|
|
1a9229a3ae | ||
|
|
ebf865e2c7 | ||
|
|
5fd146b8da | ||
|
|
3401a67959 | ||
|
|
10dad46d7c | ||
|
|
1c4983c756 | ||
|
|
f4636d9a37 | ||
|
|
02df48ab4e | ||
|
|
831d48f5a3 | ||
|
|
ca42f71b0e | ||
|
|
ed4a3cb8d7 | ||
|
|
5c66d95951 | ||
|
|
44663342f4 | ||
|
|
4e6207fef5 | ||
|
|
bd67b660c8 | ||
|
|
174789930d | ||
|
|
7af9c57977 | ||
|
|
874ef26f0b | ||
|
|
329fbb5a38 | ||
|
|
7db4715eb2 | ||
|
|
e57061b133 | ||
|
|
096e1b47d2 | ||
|
|
9c0f89953c | ||
|
|
20bb52df50 | ||
|
|
ddcd7c6831 | ||
|
|
30825e7927 | ||
|
|
535dbdfe57 | ||
|
|
8c4a714d39 | ||
|
|
c9168717a4 | ||
|
|
2e76bf398f | ||
|
|
2803fd6e90 | ||
|
|
681a75e683 | ||
|
|
ae6bc37664 | ||
|
|
583e74d99f | ||
|
|
82ca0329e9 | ||
|
|
7b474e54f0 | ||
|
|
ab61faaba5 | ||
|
|
863fa5cc46 | ||
|
|
2509ad4e71 | ||
|
|
6108679f46 | ||
|
|
b34f7fca20 | ||
|
|
fa53e773ae | ||
|
|
397c304ab2 | ||
|
|
3dfb79423a | ||
|
|
51bd636ba6 | ||
|
|
e55a385858 | ||
|
|
43b85ca3b6 | ||
|
|
99696cabf7 | ||
|
|
f246fab1f4 | ||
|
|
b0101a1f8c | ||
|
|
8f5e947c28 | ||
|
|
dfd430712d | ||
|
|
8431c19133 | ||
|
|
6ee6934e0d | ||
|
|
3253fbfaf4 | ||
|
|
985a8dd3a9 | ||
|
|
0c99c075f3 | ||
|
|
c79db27092 |
@@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
||||||
"project": {
|
|
||||||
"name": "fuse2"
|
|
||||||
},
|
|
||||||
"apps": [
|
|
||||||
{
|
|
||||||
"root": "src",
|
|
||||||
"outDir": "dist",
|
|
||||||
"assets": [
|
|
||||||
"assets",
|
|
||||||
"app/main/content/components/angular-material",
|
|
||||||
"favicon.ico"
|
|
||||||
],
|
|
||||||
"index": "index.html",
|
|
||||||
"main": "main.ts",
|
|
||||||
"polyfills": "polyfills.ts",
|
|
||||||
"test": "test.ts",
|
|
||||||
"tsconfig": "tsconfig.app.json",
|
|
||||||
"testTsconfig": "tsconfig.spec.json",
|
|
||||||
"prefix": "app",
|
|
||||||
"styles": [
|
|
||||||
"styles.scss"
|
|
||||||
],
|
|
||||||
"scripts": [],
|
|
||||||
"environmentSource": "environments/environment.ts",
|
|
||||||
"environments": {
|
|
||||||
"dev": "environments/environment.ts",
|
|
||||||
"hmr": "environments/environment.hmr.ts",
|
|
||||||
"prod": "environments/environment.prod.ts"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"e2e": {
|
|
||||||
"protractor": {
|
|
||||||
"config": "./protractor.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": [
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.app.json",
|
|
||||||
"exclude": [
|
|
||||||
"**/node_modules/**",
|
|
||||||
"**/src/app/fuse-fake-db/**/*",
|
|
||||||
"**/src/assets/angular-material-examples/**/*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.spec.json",
|
|
||||||
"exclude": [
|
|
||||||
"**/node_modules/**",
|
|
||||||
"**/src/app/fuse-fake-db/**/*",
|
|
||||||
"**/src/assets/angular-material-examples/**/*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "e2e/tsconfig.e2e.json",
|
|
||||||
"exclude": [
|
|
||||||
"**/node_modules/**",
|
|
||||||
"**/src/app/fuse-fake-db/**/*",
|
|
||||||
"**/src/assets/angular-material-examples/**/*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"test": {
|
|
||||||
"karma": {
|
|
||||||
"config": "./karma.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaults": {
|
|
||||||
"styleExt": "scss",
|
|
||||||
"component": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +1,6 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset=utf-8
|
||||||
indent_style = space
|
end_of_line=lf
|
||||||
indent_size = 2
|
insert_final_newline=false
|
||||||
insert_final_newline = true
|
indent_style=space
|
||||||
trim_trailing_whitespace = true
|
indent_size=4
|
||||||
|
|
||||||
[*.md]
|
|
||||||
max_line_length = off
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -30,13 +30,10 @@
|
|||||||
/coverage
|
/coverage
|
||||||
/libpeerconnection.log
|
/libpeerconnection.log
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
testem.log
|
testem.log
|
||||||
/typings
|
/typings
|
||||||
|
|
||||||
# e2e
|
|
||||||
/e2e/*.js
|
|
||||||
/e2e/*.map
|
|
||||||
|
|
||||||
# System Files
|
# System Files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -1,6 +1,12 @@
|
|||||||
# Fuse2
|
# Fuse - Angular
|
||||||
|
|
||||||
Material Design Admin Template with Angular 5+ and Angular Material 2
|
Material Design Admin Template with Angular 6+ and Angular Material
|
||||||
|
|
||||||
|
## The Community
|
||||||
|
|
||||||
|
Share your ideas, discuss Fuse and help each other.
|
||||||
|
|
||||||
|
[Click here](http://fusetheme.com/community) to see our Community page.
|
||||||
|
|
||||||
## Development server
|
## Development server
|
||||||
|
|
||||||
@@ -8,11 +14,11 @@ Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app w
|
|||||||
|
|
||||||
## Code scaffolding
|
## Code scaffolding
|
||||||
|
|
||||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|module`.
|
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
|
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
|
||||||
|
|
||||||
## Running unit tests
|
## Running unit tests
|
||||||
|
|
||||||
@@ -21,4 +27,8 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
|
|||||||
## Running end-to-end tests
|
## Running end-to-end tests
|
||||||
|
|
||||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||||
Before running the tests make sure you are serving the app via `ng serve`.
|
|
||||||
|
## Further help
|
||||||
|
|
||||||
|
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||||
|
|
||||||
|
|||||||
140
angular.json
Normal file
140
angular.json
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"fuse": {
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"projectType": "application",
|
||||||
|
"prefix": "app",
|
||||||
|
"schematics": {
|
||||||
|
"@schematics/angular:component": {
|
||||||
|
"styleext": "scss"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"main": "src/main.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "src/tsconfig.app.json",
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets",
|
||||||
|
"src/app/main/angular-material-elements"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.scss"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optimization": true,
|
||||||
|
"outputHashing": "all",
|
||||||
|
"sourceMap": false,
|
||||||
|
"extractCss": true,
|
||||||
|
"namedChunks": false,
|
||||||
|
"aot": true,
|
||||||
|
"extractLicenses": true,
|
||||||
|
"vendorChunk": false,
|
||||||
|
"buildOptimizer": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "fuse:build"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "fuse:build:production"
|
||||||
|
},
|
||||||
|
"hmr": {
|
||||||
|
"hmr": true,
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.hmr.ts"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "fuse:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"main": "src/test.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "src/tsconfig.spec.json",
|
||||||
|
"karmaConfig": "src/karma.conf.js",
|
||||||
|
"styles": [
|
||||||
|
"styles.scss"
|
||||||
|
],
|
||||||
|
"scripts": [],
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"src/tsconfig.app.json",
|
||||||
|
"src/tsconfig.spec.json"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/src/app/fake-db/**/*",
|
||||||
|
"**/src/assets/angular-material-examples/**/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fuse-e2e": {
|
||||||
|
"root": "e2e/",
|
||||||
|
"projectType": "application",
|
||||||
|
"architect": {
|
||||||
|
"e2e": {
|
||||||
|
"builder": "@angular-devkit/build-angular:protractor",
|
||||||
|
"options": {
|
||||||
|
"protractorConfig": "e2e/protractor.conf.js",
|
||||||
|
"devServerTarget": "fuse:serve"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": "e2e/tsconfig.e2e.json",
|
||||||
|
"exclude": [
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/src/app/fake-db/**/*",
|
||||||
|
"**/src/assets/angular-material-examples/**/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultProject": "fuse"
|
||||||
|
}
|
||||||
31
e2e/protractor.conf.js
Normal file
31
e2e/protractor.conf.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// Protractor configuration file, see link for more information
|
||||||
|
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||||
|
|
||||||
|
const {SpecReporter} = require('jasmine-spec-reporter');
|
||||||
|
|
||||||
|
exports.config = {
|
||||||
|
allScriptsTimeout: 11000,
|
||||||
|
specs : [
|
||||||
|
'./src/**/*.e2e-spec.ts'
|
||||||
|
],
|
||||||
|
capabilities : {
|
||||||
|
'browserName': 'chrome'
|
||||||
|
},
|
||||||
|
directConnect : true,
|
||||||
|
baseUrl : 'http://localhost:4200/',
|
||||||
|
framework : 'jasmine',
|
||||||
|
jasmineNodeOpts : {
|
||||||
|
showColors : true,
|
||||||
|
defaultTimeoutInterval: 30000,
|
||||||
|
print : function ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onPrepare()
|
||||||
|
{
|
||||||
|
require('ts-node').register({
|
||||||
|
project: require('path').join(__dirname, './tsconfig.e2e.json')
|
||||||
|
});
|
||||||
|
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -9,6 +9,6 @@ describe('Fuse2 App', () => {
|
|||||||
|
|
||||||
it('should display welcome message', () => {
|
it('should display welcome message', () => {
|
||||||
page.navigateTo();
|
page.navigateTo();
|
||||||
expect(page.getParagraphText()).toEqual('Welcome to app!');
|
expect(page.getParagraphText()).toEqual('Welcome to Fuse2!');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../out-tsc/e2e",
|
"outDir": "../out-tsc/app",
|
||||||
"baseUrl": "./",
|
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"types": [
|
"types": [
|
||||||
@@ -11,4 +10,4 @@
|
|||||||
"node"
|
"node"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
// Karma configuration file, see link for more information
|
|
||||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
||||||
|
|
||||||
module.exports = function (config) {
|
|
||||||
config.set({
|
|
||||||
basePath: '',
|
|
||||||
frameworks: ['jasmine', '@angular/cli'],
|
|
||||||
plugins: [
|
|
||||||
require('karma-jasmine'),
|
|
||||||
require('karma-chrome-launcher'),
|
|
||||||
require('karma-jasmine-html-reporter'),
|
|
||||||
require('karma-coverage-istanbul-reporter'),
|
|
||||||
require('@angular/cli/plugins/karma')
|
|
||||||
],
|
|
||||||
client:{
|
|
||||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
||||||
},
|
|
||||||
coverageIstanbulReporter: {
|
|
||||||
reports: [ 'html', 'lcovonly' ],
|
|
||||||
fixWebpackSourcePaths: true
|
|
||||||
},
|
|
||||||
angularCli: {
|
|
||||||
environment: 'dev'
|
|
||||||
},
|
|
||||||
reporters: ['progress', 'kjhtml'],
|
|
||||||
port: 9876,
|
|
||||||
colors: true,
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
autoWatch: true,
|
|
||||||
browsers: ['Chrome'],
|
|
||||||
singleRun: false
|
|
||||||
});
|
|
||||||
};
|
|
||||||
17491
package-lock.json
generated
17491
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
108
package.json
108
package.json
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "fuse2",
|
"name": "fuse",
|
||||||
"version": "1.3.4",
|
"version": "6.1.1",
|
||||||
"license": "https://themeforest.net/licenses/terms/regular",
|
"license": "https://themeforest.net/licenses/terms/regular",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve --open",
|
"start": "ng serve --open",
|
||||||
"start-hmr": "ng serve --hmr -e=hmr -sm=false",
|
"start-hmr": "ng serve --configuration hmr -sm=false",
|
||||||
"start-hmr-sourcemaps": "ng serve --hmr -e=hmr",
|
"start-hmr-sourcemaps": "ng serve --hmr -e=hmr",
|
||||||
"build": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev",
|
"build": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev",
|
||||||
"build-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev --stats-json",
|
"build-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev --stats-json",
|
||||||
@@ -18,67 +18,71 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@agm/core": "1.0.0-beta.2",
|
"@agm/core": "1.0.0-beta.3",
|
||||||
"@angular/animations": "5.2.1",
|
"@angular/animations": "6.0.5",
|
||||||
"@angular/cdk": "5.1.0",
|
"@angular/cdk": "6.2.1",
|
||||||
"@angular/common": "5.2.1",
|
"@angular/common": "6.0.5",
|
||||||
"@angular/compiler": "5.2.1",
|
"@angular/compiler": "6.0.5",
|
||||||
"@angular/core": "5.2.1",
|
"@angular/core": "6.0.5",
|
||||||
"@angular/flex-layout": "2.0.0-beta.12",
|
"@angular/flex-layout": "6.0.0-beta.16",
|
||||||
"@angular/forms": "5.2.1",
|
"@angular/forms": "6.0.5",
|
||||||
"@angular/http": "5.2.1",
|
"@angular/http": "6.0.5",
|
||||||
"@angular/material": "5.1.0",
|
"@angular/material": "6.2.1",
|
||||||
"@angular/material-moment-adapter": "5.1.0",
|
"@angular/material-moment-adapter": "6.2.1",
|
||||||
"@angular/platform-browser": "5.2.1",
|
"@angular/platform-browser": "6.0.5",
|
||||||
"@angular/platform-browser-dynamic": "5.2.1",
|
"@angular/platform-browser-dynamic": "6.0.5",
|
||||||
"@angular/router": "5.2.1",
|
"@angular/router": "6.0.5",
|
||||||
"@ngrx/effects": "4.1.1",
|
"@ngrx/effects": "6.0.1",
|
||||||
"@ngrx/router-store": "4.1.1",
|
"@ngrx/router-store": "6.0.1",
|
||||||
"@ngrx/store": "4.1.1",
|
"@ngrx/store": "6.0.1",
|
||||||
"@ngrx/store-devtools": "4.1.1",
|
"@ngrx/store-devtools": "6.0.1",
|
||||||
"@ngx-translate/core": "9.1.1",
|
"@ngx-translate/core": "10.0.2",
|
||||||
"@swimlane/ngx-charts": "7.0.1",
|
"@swimlane/ngx-charts": "8.1.0",
|
||||||
"@swimlane/ngx-datatable": "11.1.7",
|
"@swimlane/ngx-datatable": "13.0.1",
|
||||||
"@swimlane/ngx-dnd": "3.1.0",
|
"@swimlane/ngx-dnd": "4.0.0",
|
||||||
"@types/prismjs": "1.9.0",
|
"@types/prismjs": "1.9.0",
|
||||||
"angular-calendar": "0.23.2",
|
"angular-calendar": "0.25.2",
|
||||||
"angular-in-memory-web-api": "0.5.2",
|
"angular-in-memory-web-api": "0.6.0",
|
||||||
|
"chart.js": "2.7.2",
|
||||||
"classlist.js": "1.1.20150312",
|
"classlist.js": "1.1.20150312",
|
||||||
"core-js": "2.5.3",
|
"core-js": "2.5.7",
|
||||||
"d3": "4.12.2",
|
"d3": "5.4.0",
|
||||||
"hammerjs": "2.0.8",
|
"hammerjs": "2.0.8",
|
||||||
"intl": "1.2.5",
|
"lodash": "4.17.10",
|
||||||
"moment": "2.20.1",
|
"moment": "2.22.2",
|
||||||
"ngrx-store-freeze": "0.2.0",
|
"ng2-charts": "1.6.0",
|
||||||
"ngx-color-picker": "5.3.0",
|
"ngrx-store-freeze": "0.2.4",
|
||||||
|
"ngx-color-picker": "6.3.3",
|
||||||
"ngx-cookie-service": "1.0.10",
|
"ngx-cookie-service": "1.0.10",
|
||||||
"perfect-scrollbar": "1.3.0",
|
"perfect-scrollbar": "1.4.0",
|
||||||
"prismjs": "1.10.0",
|
"prismjs": "1.14.0",
|
||||||
"rxjs": "5.5.6",
|
"rxjs": "6.2.1",
|
||||||
|
"rxjs-compat": "6.2.1",
|
||||||
"web-animations-js": "2.3.1",
|
"web-animations-js": "2.3.1",
|
||||||
"zone.js": "0.8.20"
|
"zone.js": "0.8.26"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/cli": "1.6.4",
|
"@angular/cli": "6.0.8",
|
||||||
"@angular/compiler-cli": "5.2.1",
|
"@angular/compiler-cli": "6.0.5",
|
||||||
"@angular/language-service": "5.2.1",
|
"@angular/language-service": "6.0.5",
|
||||||
|
"@angular-devkit/build-angular": "0.6.8",
|
||||||
"@angularclass/hmr": "2.1.3",
|
"@angularclass/hmr": "2.1.3",
|
||||||
"@types/jasmine": "2.8.4",
|
"@types/jasmine": "2.8.8",
|
||||||
"@types/jasminewd2": "2.0.3",
|
"@types/jasminewd2": "2.0.3",
|
||||||
"@types/node": "6.0.96",
|
"@types/lodash": "4.14.109",
|
||||||
"codelyzer": "4.0.2",
|
"@types/node": "8.9.5",
|
||||||
"jasmine-core": "2.8.0",
|
"codelyzer": "4.2.1",
|
||||||
|
"jasmine-core": "2.99.1",
|
||||||
"jasmine-spec-reporter": "4.2.1",
|
"jasmine-spec-reporter": "4.2.1",
|
||||||
"karma": "2.0.0",
|
"karma": "1.7.1",
|
||||||
"karma-chrome-launcher": "2.2.0",
|
"karma-chrome-launcher": "2.2.0",
|
||||||
"karma-cli": "1.0.1",
|
"karma-coverage-istanbul-reporter": "2.0.1",
|
||||||
"karma-coverage-istanbul-reporter": "1.3.3",
|
"karma-jasmine": "1.1.2",
|
||||||
"karma-jasmine": "1.1.1",
|
|
||||||
"karma-jasmine-html-reporter": "0.2.2",
|
"karma-jasmine-html-reporter": "0.2.2",
|
||||||
"protractor": "5.1.2",
|
"protractor": "5.3.2",
|
||||||
"ts-node": "3.2.2",
|
"ts-node": "5.0.1",
|
||||||
"tslint": "5.9.1",
|
"tslint": "5.9.1",
|
||||||
"typescript": "2.5.3",
|
"typescript": "2.7.2",
|
||||||
"webpack-bundle-analyzer": "2.9.2"
|
"webpack-bundle-analyzer": "2.13.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
// Protractor configuration file, see link for more information
|
|
||||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
|
||||||
|
|
||||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
|
||||||
|
|
||||||
exports.config = {
|
|
||||||
allScriptsTimeout: 11000,
|
|
||||||
specs: [
|
|
||||||
'./e2e/**/*.e2e-spec.ts'
|
|
||||||
],
|
|
||||||
capabilities: {
|
|
||||||
'browserName': 'chrome'
|
|
||||||
},
|
|
||||||
directConnect: true,
|
|
||||||
baseUrl: 'http://localhost:4200/',
|
|
||||||
framework: 'jasmine',
|
|
||||||
jasmineNodeOpts: {
|
|
||||||
showColors: true,
|
|
||||||
defaultTimeoutInterval: 30000,
|
|
||||||
print: function() {}
|
|
||||||
},
|
|
||||||
onPrepare() {
|
|
||||||
require('ts-node').register({
|
|
||||||
project: 'e2e/tsconfig.e2e.json'
|
|
||||||
});
|
|
||||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -187,10 +187,14 @@ export const fuseAnimations = [
|
|||||||
transition('* => void', animate('300ms ease-in'))
|
transition('* => void', animate('300ms ease-in'))
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Router animations
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
trigger('routerTransitionLeft', [
|
trigger('routerTransitionLeft', [
|
||||||
|
|
||||||
transition('* => *', [
|
transition('* => *', [
|
||||||
query('fuse-content > :enter, fuse-content > :leave', [
|
query('content > :enter, content > :leave', [
|
||||||
style({
|
style({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top : 0,
|
top : 0,
|
||||||
@@ -199,7 +203,7 @@ export const fuseAnimations = [
|
|||||||
right : 0
|
right : 0
|
||||||
})
|
})
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :enter', [
|
query('content > :enter', [
|
||||||
style({
|
style({
|
||||||
transform: 'translateX(100%)',
|
transform: 'translateX(100%)',
|
||||||
opacity : 0
|
opacity : 0
|
||||||
@@ -207,7 +211,7 @@ export const fuseAnimations = [
|
|||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
sequence([
|
sequence([
|
||||||
group([
|
group([
|
||||||
query('fuse-content > :leave', [
|
query('content > :leave', [
|
||||||
style({
|
style({
|
||||||
transform: 'translateX(0)',
|
transform: 'translateX(0)',
|
||||||
opacity : 1
|
opacity : 1
|
||||||
@@ -218,7 +222,7 @@ export const fuseAnimations = [
|
|||||||
opacity : 0
|
opacity : 0
|
||||||
}))
|
}))
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :enter', [
|
query('content > :enter', [
|
||||||
style({transform: 'translateX(100%)'}),
|
style({transform: 'translateX(100%)'}),
|
||||||
animate('600ms cubic-bezier(0.0, 0.0, 0.2, 1)',
|
animate('600ms cubic-bezier(0.0, 0.0, 0.2, 1)',
|
||||||
style({
|
style({
|
||||||
@@ -227,8 +231,8 @@ export const fuseAnimations = [
|
|||||||
}))
|
}))
|
||||||
], {optional: true})
|
], {optional: true})
|
||||||
]),
|
]),
|
||||||
query('fuse-content > :leave', animateChild(), {optional: true}),
|
query('content > :leave', animateChild(), {optional: true}),
|
||||||
query('fuse-content > :enter', animateChild(), {optional: true})
|
query('content > :enter', animateChild(), {optional: true})
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
@@ -236,7 +240,7 @@ export const fuseAnimations = [
|
|||||||
trigger('routerTransitionRight', [
|
trigger('routerTransitionRight', [
|
||||||
|
|
||||||
transition('* => *', [
|
transition('* => *', [
|
||||||
query('fuse-content > :enter, fuse-content > :leave', [
|
query('content > :enter, content > :leave', [
|
||||||
style({
|
style({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top : 0,
|
top : 0,
|
||||||
@@ -245,7 +249,7 @@ export const fuseAnimations = [
|
|||||||
right : 0
|
right : 0
|
||||||
})
|
})
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :enter', [
|
query('content > :enter', [
|
||||||
style({
|
style({
|
||||||
transform: 'translateX(-100%)',
|
transform: 'translateX(-100%)',
|
||||||
opacity : 0
|
opacity : 0
|
||||||
@@ -253,7 +257,7 @@ export const fuseAnimations = [
|
|||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
sequence([
|
sequence([
|
||||||
group([
|
group([
|
||||||
query('fuse-content > :leave', [
|
query('content > :leave', [
|
||||||
style({
|
style({
|
||||||
transform: 'translateX(0)',
|
transform: 'translateX(0)',
|
||||||
opacity : 1
|
opacity : 1
|
||||||
@@ -264,7 +268,7 @@ export const fuseAnimations = [
|
|||||||
opacity : 0
|
opacity : 0
|
||||||
}))
|
}))
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :enter', [
|
query('content > :enter', [
|
||||||
style({transform: 'translateX(-100%)'}),
|
style({transform: 'translateX(-100%)'}),
|
||||||
animate('600ms cubic-bezier(0.0, 0.0, 0.2, 1)',
|
animate('600ms cubic-bezier(0.0, 0.0, 0.2, 1)',
|
||||||
style({
|
style({
|
||||||
@@ -273,8 +277,8 @@ export const fuseAnimations = [
|
|||||||
}))
|
}))
|
||||||
], {optional: true})
|
], {optional: true})
|
||||||
]),
|
]),
|
||||||
query('fuse-content > :leave', animateChild(), {optional: true}),
|
query('content > :leave', animateChild(), {optional: true}),
|
||||||
query('fuse-content > :enter', animateChild(), {optional: true})
|
query('content > :enter', animateChild(), {optional: true})
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
@@ -282,7 +286,7 @@ export const fuseAnimations = [
|
|||||||
trigger('routerTransitionUp', [
|
trigger('routerTransitionUp', [
|
||||||
|
|
||||||
transition('* => *', [
|
transition('* => *', [
|
||||||
query('fuse-content > :enter, fuse-content > :leave', [
|
query('content > :enter, content > :leave', [
|
||||||
style({
|
style({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top : 0,
|
top : 0,
|
||||||
@@ -291,14 +295,14 @@ export const fuseAnimations = [
|
|||||||
right : 0
|
right : 0
|
||||||
})
|
})
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :enter', [
|
query('content > :enter', [
|
||||||
style({
|
style({
|
||||||
transform: 'translateY(100%)',
|
transform: 'translateY(100%)',
|
||||||
opacity : 0
|
opacity : 0
|
||||||
})
|
})
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
group([
|
group([
|
||||||
query('fuse-content > :leave', [
|
query('content > :leave', [
|
||||||
style({
|
style({
|
||||||
transform: 'translateY(0)',
|
transform: 'translateY(0)',
|
||||||
opacity : 1
|
opacity : 1
|
||||||
@@ -309,7 +313,7 @@ export const fuseAnimations = [
|
|||||||
opacity : 0
|
opacity : 0
|
||||||
}))
|
}))
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :enter', [
|
query('content > :enter', [
|
||||||
style({transform: 'translateY(100%)'}),
|
style({transform: 'translateY(100%)'}),
|
||||||
animate('600ms cubic-bezier(0.0, 0.0, 0.2, 1)',
|
animate('600ms cubic-bezier(0.0, 0.0, 0.2, 1)',
|
||||||
style({
|
style({
|
||||||
@@ -318,15 +322,15 @@ export const fuseAnimations = [
|
|||||||
}))
|
}))
|
||||||
], {optional: true})
|
], {optional: true})
|
||||||
]),
|
]),
|
||||||
query('fuse-content > :leave', animateChild(), {optional: true}),
|
query('content > :leave', animateChild(), {optional: true}),
|
||||||
query('fuse-content > :enter', animateChild(), {optional: true})
|
query('content > :enter', animateChild(), {optional: true})
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
|
|
||||||
trigger('routerTransitionDown', [
|
trigger('routerTransitionDown', [
|
||||||
|
|
||||||
transition('* => *', [
|
transition('* => *', [
|
||||||
query('fuse-content > :enter, fuse-content > :leave', [
|
query('content > :enter, content > :leave', [
|
||||||
style({
|
style({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top : 0,
|
top : 0,
|
||||||
@@ -335,7 +339,7 @@ export const fuseAnimations = [
|
|||||||
right : 0
|
right : 0
|
||||||
})
|
})
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :enter', [
|
query('content > :enter', [
|
||||||
style({
|
style({
|
||||||
transform: 'translateY(-100%)',
|
transform: 'translateY(-100%)',
|
||||||
opacity : 0
|
opacity : 0
|
||||||
@@ -343,7 +347,7 @@ export const fuseAnimations = [
|
|||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
sequence([
|
sequence([
|
||||||
group([
|
group([
|
||||||
query('fuse-content > :leave', [
|
query('content > :leave', [
|
||||||
style({
|
style({
|
||||||
transform: 'translateY(0)',
|
transform: 'translateY(0)',
|
||||||
opacity : 1
|
opacity : 1
|
||||||
@@ -354,7 +358,7 @@ export const fuseAnimations = [
|
|||||||
opacity : 0
|
opacity : 0
|
||||||
}))
|
}))
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :enter', [
|
query('content > :enter', [
|
||||||
style({transform: 'translateY(-100%)'}),
|
style({transform: 'translateY(-100%)'}),
|
||||||
animate('600ms cubic-bezier(0.0, 0.0, 0.2, 1)',
|
animate('600ms cubic-bezier(0.0, 0.0, 0.2, 1)',
|
||||||
style({
|
style({
|
||||||
@@ -363,8 +367,8 @@ export const fuseAnimations = [
|
|||||||
}))
|
}))
|
||||||
], {optional: true})
|
], {optional: true})
|
||||||
]),
|
]),
|
||||||
query('fuse-content > :leave', animateChild(), {optional: true}),
|
query('content > :leave', animateChild(), {optional: true}),
|
||||||
query('fuse-content > :enter', animateChild(), {optional: true})
|
query('content > :enter', animateChild(), {optional: true})
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
@@ -373,7 +377,7 @@ export const fuseAnimations = [
|
|||||||
|
|
||||||
transition('* => *', group([
|
transition('* => *', group([
|
||||||
|
|
||||||
query('fuse-content > :enter, fuse-content > :leave ', [
|
query('content > :enter, content > :leave ', [
|
||||||
style({
|
style({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top : 0,
|
top : 0,
|
||||||
@@ -383,12 +387,12 @@ export const fuseAnimations = [
|
|||||||
})
|
})
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
|
|
||||||
query('fuse-content > :enter', [
|
query('content > :enter', [
|
||||||
style({
|
style({
|
||||||
opacity: 0
|
opacity: 0
|
||||||
})
|
})
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :leave', [
|
query('content > :leave', [
|
||||||
style({
|
style({
|
||||||
opacity: 1
|
opacity: 1
|
||||||
}),
|
}),
|
||||||
@@ -397,7 +401,7 @@ export const fuseAnimations = [
|
|||||||
opacity: 0
|
opacity: 0
|
||||||
}))
|
}))
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :enter', [
|
query('content > :enter', [
|
||||||
style({
|
style({
|
||||||
opacity: 0
|
opacity: 0
|
||||||
}),
|
}),
|
||||||
@@ -406,8 +410,8 @@ export const fuseAnimations = [
|
|||||||
opacity: 1
|
opacity: 1
|
||||||
}))
|
}))
|
||||||
], {optional: true}),
|
], {optional: true}),
|
||||||
query('fuse-content > :enter', animateChild(), {optional: true}),
|
query('content > :enter', animateChild(), {optional: true}),
|
||||||
query('fuse-content > :leave', animateChild(), {optional: true})
|
query('content > :leave', animateChild(), {optional: true})
|
||||||
]))
|
]))
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { MatDialogRef } from '@angular/material';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-confirm-dialog',
|
||||||
|
templateUrl: './confirm-dialog.component.html',
|
||||||
|
styleUrls : ['./confirm-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class FuseConfirmDialogComponent
|
||||||
|
{
|
||||||
|
public confirmMessage: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {MatDialogRef<FuseConfirmDialogComponent>} dialogRef
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
public dialogRef: MatDialogRef<FuseConfirmDialogComponent>
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
20
src/@fuse/components/confirm-dialog/confirm-dialog.module.ts
Normal file
20
src/@fuse/components/confirm-dialog/confirm-dialog.module.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { MatButtonModule, MatDialogModule } from '@angular/material';
|
||||||
|
|
||||||
|
import { FuseConfirmDialogComponent } from '@fuse/components/confirm-dialog/confirm-dialog.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseConfirmDialogComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
MatDialogModule,
|
||||||
|
MatButtonModule
|
||||||
|
],
|
||||||
|
entryComponents: [
|
||||||
|
FuseConfirmDialogComponent
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class FuseConfirmDialogModule
|
||||||
|
{
|
||||||
|
}
|
||||||
89
src/@fuse/components/countdown/countdown.component.ts
Normal file
89
src/@fuse/components/countdown/countdown.component.ts
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
import { interval, Subject } from 'rxjs';
|
||||||
|
import { map, takeUntil } from 'rxjs/operators';
|
||||||
|
import * as moment from 'moment';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-countdown',
|
||||||
|
templateUrl: './countdown.component.html',
|
||||||
|
styleUrls : ['./countdown.component.scss']
|
||||||
|
})
|
||||||
|
export class FuseCountdownComponent implements OnInit, OnDestroy
|
||||||
|
{
|
||||||
|
// Event date
|
||||||
|
@Input('eventDate')
|
||||||
|
eventDate;
|
||||||
|
|
||||||
|
countdown: any;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
// Set the defaults
|
||||||
|
this.countdown = {
|
||||||
|
days : '',
|
||||||
|
hours : '',
|
||||||
|
minutes: '',
|
||||||
|
seconds: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set the private defaults
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
const currDate = moment();
|
||||||
|
const eventDate = moment(this.eventDate);
|
||||||
|
|
||||||
|
// Get the difference in between the current date and event date
|
||||||
|
let diff = eventDate.diff(currDate, 'seconds');
|
||||||
|
|
||||||
|
// Create a subscribable interval
|
||||||
|
const countDown = interval(1000)
|
||||||
|
.pipe(
|
||||||
|
map(value => {
|
||||||
|
return diff = diff - 1;
|
||||||
|
}),
|
||||||
|
map(value => {
|
||||||
|
const timeLeft = moment.duration(value, 'seconds');
|
||||||
|
|
||||||
|
return {
|
||||||
|
days : timeLeft.asDays().toFixed(0),
|
||||||
|
hours : timeLeft.hours(),
|
||||||
|
minutes: timeLeft.minutes(),
|
||||||
|
seconds: timeLeft.seconds()
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// Subscribe to the countdown interval
|
||||||
|
countDown
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe(value => {
|
||||||
|
this.countdown = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/@fuse/components/countdown/countdown.module.ts
Normal file
15
src/@fuse/components/countdown/countdown.module.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { FuseCountdownComponent } from '@fuse/components/countdown/countdown.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseCountdownComponent
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
FuseCountdownComponent
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class FuseCountdownModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<!-- DEMO CONTENT -->
|
||||||
|
<div class="demo-content">
|
||||||
|
|
||||||
|
<img src="assets/images/beach.jpg" alt="beach" style="max-width: 640px; width: 100%;">
|
||||||
|
|
||||||
|
<h1>Early Sunrise</h1>
|
||||||
|
<h4 class="secondary-text">Demo Content</h4>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tortor nibh, convallis sed purus nec,
|
||||||
|
auctor venenatis nisl. Suspendisse potenti. Nullam sagittis nulla in diam finibus, sed pharetra velit
|
||||||
|
vestibulum. Suspendisse euismod in urna eu posuere.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<blockquote>
|
||||||
|
<p>
|
||||||
|
Nunc vel lacinia lorem. Nullam tincidunt sed purus eu placerat. Donec id dictum erat. Etiam enim ex, dapibus
|
||||||
|
et tortor id, posuere pretium est. Maecenas fringilla ipsum vitae neque elementum, at eleifend ante
|
||||||
|
sollicitudin. Donec viverra augue dolor, a venenatis tellus consectetur sit amet.
|
||||||
|
</p>
|
||||||
|
<footer>
|
||||||
|
John Doe
|
||||||
|
</footer>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Ut ornare sit amet velit vel congue. Ut nec tristique eros. Lorem ipsum dolor sit amet, consectetur adipiscing
|
||||||
|
elit. Vivamus sed lorem quis nibh porta iaculis. Vestibulum ut eleifend ante, at semper mi. Nam imperdiet est
|
||||||
|
nisi, quis hendrerit tellus convallis et. Morbi in luctus neque. Curabitur elementum ut est et gravida. In hac
|
||||||
|
habitasse platea dictumst.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
In et placerat eros, eu tempor turpis. Curabitur ac felis finibus, elementum lectus vitae, venenatis est.
|
||||||
|
Integer mollis nisl a eros scelerisque varius. Etiam venenatis lectus vel erat condimentum tristique vel vel mi.
|
||||||
|
Nulla id euismod mi, et mollis tellus.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Class aptent taciti
|
||||||
|
sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur vitae sagittis odio.
|
||||||
|
Suspendisse ullamcorper nunc non pellentesque laoreet. Curabitur eu tortor id quam pretium mattis. Proin ut quam
|
||||||
|
velit.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Quisque sit amet risus enim. Aliquam sit amet interdum justo, at ultricies sapien. Suspendisse et semper urna,
|
||||||
|
in gravida eros. Quisque id nibh iaculis, euismod urna sed, egestas nisi. Donec eros metus, congue a imperdiet
|
||||||
|
feugiat, sagittis nec ipsum. Quisque dapibus mollis felis non tristique.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Ut auctor, metus sed dapibus tempus, urna diam auctor odio, in malesuada odio risus vitae nisi. Etiam blandit
|
||||||
|
ante urna, vitae placerat massa mollis in. Duis nec urna ac purus semper dictum ut eget justo. Aenean non
|
||||||
|
sagittis augue. Sed venenatis rhoncus enim eget ornare. Donec viverra sed felis at venenatis. Mauris aliquam
|
||||||
|
fringilla nulla, sit amet congue felis dignissim at.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Quisque accumsan augue tempor ante mollis, sed placerat diam porttitor. Vestibulum dignissim sem vel velit
|
||||||
|
eleifend, non pellentesque quam convallis. Pellentesque est dolor, dignissim ac tortor tristique, hendrerit
|
||||||
|
iaculis metus. Praesent pulvinar quam eu leo consectetur faucibus. Vestibulum purus diam, gravida sagittis
|
||||||
|
feugiat sit amet, tincidunt in ligula. Sed semper vestibulum magna. Lorem ipsum dolor sit amet, consectetur
|
||||||
|
adipiscing elit. Suspendisse tortor nibh, convallis sed purus nec, auctor venenatis nisl. Suspendisse potenti.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Nullam sagittis nulla in diam finibus, sed pharetra velit vestibulum. Suspendisse euismod in urna eu posuere.
|
||||||
|
Etiam blandit nunc arcu, et consectetur orci blandit a. Aliquam condimentum pharetra quam at ultricies. Nunc vel
|
||||||
|
lacinia lorem. Nullam tincidunt sed purus eu placerat. Donec id dictum erat. Etiam enim ex, dapibus et tortor
|
||||||
|
id, posuere pretium est. Maecenas fringilla ipsum vitae neque elementum, at eleifend ante sollicitudin. Donec
|
||||||
|
viverra augue dolor, a venenatis tellus consectetur sit amet...
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<!-- / DEMO CONTENT -->
|
||||||
@@ -7,6 +7,9 @@ import { Component } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class FuseDemoContentComponent
|
export class FuseDemoContentComponent
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -1,99 +1,99 @@
|
|||||||
<div class="demo-sidenav">
|
<div class="demo-sidebar">
|
||||||
<mat-list>
|
<mat-list>
|
||||||
<h3 matSubheader>Sidenav Demo</h3>
|
<h3 matSubheader>Sidebar Demo</h3>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 1</span>
|
<span>Sidebar Item 1</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 2</span>
|
<span>Sidebar Item 2</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 3</span>
|
<span>Sidebar Item 3</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 4</span>
|
<span>Sidebar Item 4</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 5</span>
|
<span>Sidebar Item 5</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 6</span>
|
<span>Sidebar Item 6</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 7</span>
|
<span>Sidebar Item 7</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 8</span>
|
<span>Sidebar Item 8</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 9</span>
|
<span>Sidebar Item 9</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 10</span>
|
<span>Sidebar Item 10</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 11</span>
|
<span>Sidebar Item 11</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 12</span>
|
<span>Sidebar Item 12</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 13</span>
|
<span>Sidebar Item 13</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 14</span>
|
<span>Sidebar Item 14</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 15</span>
|
<span>Sidebar Item 15</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item>
|
||||||
<span>Sidenav Item 16</span>
|
<span>Sidebar Item 16</span>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
</mat-list>
|
</mat-list>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-demo-sidebar',
|
||||||
|
templateUrl: './demo-sidebar.component.html',
|
||||||
|
styleUrls : ['./demo-sidebar.component.scss']
|
||||||
|
})
|
||||||
|
export class FuseDemoSidebarComponent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +1,25 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { SharedModule } from '../../modules/shared.module';
|
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { MatDividerModule, MatListModule } from '@angular/material';
|
||||||
|
|
||||||
import { FuseDemoContentComponent } from './demo-content/demo-content.component';
|
import { FuseDemoContentComponent } from './demo-content/demo-content.component';
|
||||||
import { FuseDemoSidenavComponent } from './demo-sidenav/demo-sidenav.component';
|
import { FuseDemoSidebarComponent } from './demo-sidebar/demo-sidebar.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
FuseDemoContentComponent,
|
FuseDemoContentComponent,
|
||||||
FuseDemoSidenavComponent
|
FuseDemoSidebarComponent
|
||||||
],
|
],
|
||||||
imports : [
|
imports : [
|
||||||
SharedModule,
|
RouterModule,
|
||||||
RouterModule
|
|
||||||
|
MatDividerModule,
|
||||||
|
MatListModule
|
||||||
],
|
],
|
||||||
exports : [
|
exports : [
|
||||||
FuseDemoContentComponent,
|
FuseDemoContentComponent,
|
||||||
FuseDemoSidenavComponent
|
FuseDemoSidebarComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class FuseDemoModule
|
export class FuseDemoModule
|
||||||
@@ -3,4 +3,5 @@
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
background: #263238;
|
background: #263238;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,55 @@
|
|||||||
import { Component, ContentChild, ElementRef, Input, OnInit } from '@angular/core';
|
import { Component, ContentChild, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import * as Prism from 'prismjs/prism';
|
import * as Prism from 'prismjs/prism';
|
||||||
import './prism-languages';
|
import '@fuse/components/highlight/prism-languages';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-highlight',
|
selector : 'fuse-highlight',
|
||||||
template : ' ',
|
template : '',
|
||||||
styleUrls: ['./highlight.component.scss']
|
styleUrls: ['./highlight.component.scss']
|
||||||
})
|
})
|
||||||
export class FuseHighlightComponent implements OnInit
|
export class FuseHighlightComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@ContentChild('source') source: ElementRef;
|
// Source
|
||||||
@Input('lang') lang: string;
|
@ContentChild('source')
|
||||||
@Input('path') path: string;
|
source: ElementRef;
|
||||||
|
|
||||||
|
// Lang
|
||||||
|
@Input('lang')
|
||||||
|
lang: string;
|
||||||
|
|
||||||
|
// Path
|
||||||
|
@Input('path')
|
||||||
|
path: string;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {ElementRef} _elementRef
|
||||||
|
* @param {HttpClient} _httpClient
|
||||||
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private elementRef: ElementRef,
|
private _elementRef: ElementRef,
|
||||||
private http: HttpClient
|
private _httpClient: HttpClient
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Set the private defaults
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit()
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
{
|
{
|
||||||
// If there is no language defined, return...
|
// If there is no language defined, return...
|
||||||
if ( !this.lang )
|
if ( !this.lang )
|
||||||
@@ -34,11 +61,13 @@ export class FuseHighlightComponent implements OnInit
|
|||||||
if ( this.path )
|
if ( this.path )
|
||||||
{
|
{
|
||||||
// Get the source
|
// Get the source
|
||||||
this.http.get(this.path, {responseType: 'text'}).subscribe((response) => {
|
this._httpClient.get(this.path, {responseType: 'text'})
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe((response) => {
|
||||||
|
|
||||||
// Highlight it
|
// Highlight it
|
||||||
this.highlight(response);
|
this.highlight(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the path is not defined and the source element exists...
|
// If the path is not defined and the source element exists...
|
||||||
@@ -49,7 +78,26 @@ export class FuseHighlightComponent implements OnInit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
highlight(sourceCode)
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Highlight the given source code
|
||||||
|
*
|
||||||
|
* @param sourceCode
|
||||||
|
*/
|
||||||
|
highlight(sourceCode): void
|
||||||
{
|
{
|
||||||
// Split the source into lines
|
// Split the source into lines
|
||||||
const sourceLines = sourceCode.split('\n');
|
const sourceLines = sourceCode.split('\n');
|
||||||
@@ -94,9 +142,8 @@ export class FuseHighlightComponent implements OnInit
|
|||||||
const highlightedCode = Prism.highlight(source, Prism.languages[this.lang]);
|
const highlightedCode = Prism.highlight(source, Prism.languages[this.lang]);
|
||||||
|
|
||||||
// Replace the innerHTML of the component with the highlighted code
|
// Replace the innerHTML of the component with the highlighted code
|
||||||
this.elementRef.nativeElement.innerHTML =
|
this._elementRef.nativeElement.innerHTML =
|
||||||
'<pre><code class="highlight language-' + this.lang + '">' + highlightedCode + '</code></pre>';
|
'<pre><code class="highlight language-' + this.lang + '">' + highlightedCode + '</code></pre>';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
15
src/@fuse/components/highlight/highlight.module.ts
Normal file
15
src/@fuse/components/highlight/highlight.module.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { FuseHighlightComponent } from '@fuse/components/highlight/highlight.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseHighlightComponent
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
FuseHighlightComponent
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class FuseHighlightModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
import 'prismjs/prism';
|
import 'prismjs/prism';
|
||||||
|
import 'prismjs/components/prism-bash';
|
||||||
import 'prismjs/components/prism-c';
|
import 'prismjs/components/prism-c';
|
||||||
import 'prismjs/components/prism-cpp';
|
import 'prismjs/components/prism-cpp';
|
||||||
import 'prismjs/components/prism-csharp';
|
import 'prismjs/components/prism-csharp';
|
||||||
import 'prismjs/components/prism-css';
|
import 'prismjs/components/prism-css';
|
||||||
import 'prismjs/components/prism-diff';
|
import 'prismjs/components/prism-diff';
|
||||||
import 'prismjs/components/prism-markup';
|
import 'prismjs/components/prism-markup';
|
||||||
|
import 'prismjs/components/prism-markup-templating';
|
||||||
import 'prismjs/components/prism-java';
|
import 'prismjs/components/prism-java';
|
||||||
import 'prismjs/components/prism-javascript';
|
import 'prismjs/components/prism-javascript';
|
||||||
import 'prismjs/components/prism-json';
|
import 'prismjs/components/prism-json';
|
||||||
11
src/@fuse/components/index.ts
Normal file
11
src/@fuse/components/index.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
export * from './confirm-dialog/confirm-dialog.module';
|
||||||
|
export * from './countdown/countdown.module';
|
||||||
|
export * from './demo/demo.module';
|
||||||
|
export * from './highlight/highlight.module';
|
||||||
|
export * from './material-color-picker/material-color-picker.module';
|
||||||
|
export * from './navigation/navigation.module';
|
||||||
|
export * from './search-bar/search-bar.module';
|
||||||
|
export * from './shortcuts/shortcuts.module';
|
||||||
|
export * from './sidebar/sidebar.module';
|
||||||
|
export * from './theme-options/theme-options.module';
|
||||||
|
export * from './widget/widget.module';
|
||||||
@@ -9,10 +9,8 @@
|
|||||||
|
|
||||||
<mat-menu #colorMenu="matMenu" class="fuse-material-color-picker-menu">
|
<mat-menu #colorMenu="matMenu" class="fuse-material-color-picker-menu">
|
||||||
|
|
||||||
<header [ngClass]="selectedColor?.class || 'mat-accent-bg'"
|
<header [ngClass]="selectedColor?.class || 'mat-accent-bg'" class="mat-elevation-z4"
|
||||||
class="mat-elevation-z4"
|
fxLayout="row" fxLayoutAlign="space-between center">
|
||||||
fxLayout="row"
|
|
||||||
fxLayoutAlign="space-between center">
|
|
||||||
|
|
||||||
<button mat-icon-button
|
<button mat-icon-button
|
||||||
[style.visibility]="view==='hues'?'visible':'hidden'"
|
[style.visibility]="view==='hues'?'visible':'hidden'"
|
||||||
@@ -30,7 +28,7 @@
|
|||||||
|
|
||||||
<button mat-icon-button
|
<button mat-icon-button
|
||||||
class="remove-color-button"
|
class="remove-color-button"
|
||||||
(click)="removeColor()"
|
(click)="$event.stopPropagation();removeColor()"
|
||||||
aria-label="Remove Color">
|
aria-label="Remove Color">
|
||||||
<mat-icon class="s-20">delete</mat-icon>
|
<mat-icon class="s-20">delete</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
@@ -39,13 +37,9 @@
|
|||||||
|
|
||||||
<div [ngSwitch]="view" class="views">
|
<div [ngSwitch]="view" class="views">
|
||||||
|
|
||||||
<div class="view"
|
<div class="view" *ngSwitchCase="'palettes'">
|
||||||
*ngSwitchCase="'palettes'"
|
|
||||||
[@slideInLeft]>
|
|
||||||
|
|
||||||
<div fxLayout="row" fxLayoutWrap
|
<div fxLayout="row wrap" fxLayoutAlign="start start" class="colors" fusePerfectScrollbar>
|
||||||
fxLayoutAlign="start start"
|
|
||||||
class="colors" fusePerfectScrollbar>
|
|
||||||
<div class="color"
|
<div class="color"
|
||||||
[ngClass]="'mat-'+color.key+'-bg'"
|
[ngClass]="'mat-'+color.key+'-bg'"
|
||||||
*ngFor="let color of (colors | keys)"
|
*ngFor="let color of (colors | keys)"
|
||||||
@@ -58,18 +52,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="view"
|
<div class="view" *ngSwitchCase="'hues'" >
|
||||||
*ngSwitchCase="'hues'"
|
<div fxLayout="row wrap" fxLayoutAlign="start start" class="colors" fusePerfectScrollbar>
|
||||||
[@slideInRight]>
|
<div class="color" *ngFor="let hue of hues"
|
||||||
<div fxLayout="row" fxLayoutWrap
|
|
||||||
fxLayoutAlign="start start"
|
|
||||||
class="colors" fusePerfectScrollbar>
|
|
||||||
<div class="color"
|
|
||||||
*ngFor="let hue of hues"
|
|
||||||
[fxHide]="selectedPalette === 'white' && hue !== '500'|| selectedPalette === 'black' && hue !== '500'"
|
[fxHide]="selectedPalette === 'white' && hue !== '500'|| selectedPalette === 'black' && hue !== '500'"
|
||||||
[ngClass]="'mat-'+selectedPalette+'-'+hue+'-bg'"
|
[ngClass]="'mat-'+selectedPalette+'-'+hue+'-bg'"
|
||||||
(click)="selectHue(hue)"
|
(click)="selectHue(hue)" fxLayout="row" fxLayoutAlign="start end" mat-ink-ripple>
|
||||||
fxLayout="row" fxLayoutAlign="start end" mat-ink-ripple>
|
|
||||||
<span class="label">
|
<span class="label">
|
||||||
{{hue}}
|
{{hue}}
|
||||||
</span>
|
</span>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, Output, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatColors } from '../../matColors';
|
|
||||||
import { fuseAnimations } from '../../animations';
|
import { fuseAnimations } from '@fuse/animations';
|
||||||
|
import { MatColors } from '@fuse/mat-colors';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-material-color-picker',
|
selector : 'fuse-material-color-picker',
|
||||||
@@ -9,25 +10,81 @@ import { fuseAnimations } from '../../animations';
|
|||||||
animations : fuseAnimations,
|
animations : fuseAnimations,
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class FuseMaterialColorPickerComponent implements OnInit, OnChanges
|
export class FuseMaterialColorPickerComponent implements OnChanges
|
||||||
{
|
{
|
||||||
colors: any;
|
colors: any;
|
||||||
selectedColor: any;
|
|
||||||
hues: string[];
|
hues: string[];
|
||||||
view = 'palettes';
|
selectedColor: any;
|
||||||
|
view: string;
|
||||||
|
|
||||||
@Input() selectedPalette = '';
|
@Input()
|
||||||
@Input() selectedHue = '';
|
selectedPalette: string;
|
||||||
@Input() selectedFg = '';
|
|
||||||
@Input() value: any;
|
|
||||||
@Output() onValueChange = new EventEmitter();
|
|
||||||
@Output() selectedPaletteChange = new EventEmitter();
|
|
||||||
@Output() selectedHueChange = new EventEmitter();
|
|
||||||
@Output() selectedClassChange = new EventEmitter();
|
|
||||||
@Output() selectedBgChange = new EventEmitter();
|
|
||||||
@Output() selectedFgChange = new EventEmitter();
|
|
||||||
|
|
||||||
_selectedClass = '';
|
@Input()
|
||||||
|
selectedHue: string;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
selectedFg: string;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
value: any;
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
onValueChange: EventEmitter<any>;
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
selectedPaletteChange: EventEmitter<any>;
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
selectedHueChange: EventEmitter<any>;
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
selectedClassChange: EventEmitter<any>;
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
selectedBgChange: EventEmitter<any>;
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
selectedFgChange: EventEmitter<any>;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
_selectedClass: string;
|
||||||
|
_selectedBg: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
// Set the defaults
|
||||||
|
this.colors = MatColors.all;
|
||||||
|
this.hues = ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900', 'A100', 'A200', 'A400', 'A700'];
|
||||||
|
this.selectedFg = '';
|
||||||
|
this.selectedHue = '';
|
||||||
|
this.selectedPalette = '';
|
||||||
|
this.view = 'palettes';
|
||||||
|
|
||||||
|
this.onValueChange = new EventEmitter();
|
||||||
|
this.selectedPaletteChange = new EventEmitter();
|
||||||
|
this.selectedHueChange = new EventEmitter();
|
||||||
|
this.selectedClassChange = new EventEmitter();
|
||||||
|
this.selectedBgChange = new EventEmitter();
|
||||||
|
this.selectedFgChange = new EventEmitter();
|
||||||
|
|
||||||
|
// Set the private defaults
|
||||||
|
this._selectedClass = '';
|
||||||
|
this._selectedBg = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Accessors
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selected class
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
set selectedClass(value)
|
set selectedClass(value)
|
||||||
{
|
{
|
||||||
@@ -53,7 +110,11 @@ export class FuseMaterialColorPickerComponent implements OnInit, OnChanges
|
|||||||
return this._selectedClass;
|
return this._selectedClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
_selectedBg = '';
|
/**
|
||||||
|
* Selected bg
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
set selectedBg(value)
|
set selectedBg(value)
|
||||||
{
|
{
|
||||||
@@ -85,38 +146,72 @@ export class FuseMaterialColorPickerComponent implements OnInit, OnChanges
|
|||||||
return this._selectedBg;
|
return this._selectedBg;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor()
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On changes
|
||||||
|
*
|
||||||
|
* @param changes
|
||||||
|
*/
|
||||||
|
ngOnChanges(changes: any): void
|
||||||
{
|
{
|
||||||
this.colors = MatColors.all;
|
if ( changes.selectedBg && changes.selectedBg.currentValue === '' ||
|
||||||
this.hues = ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900', 'A100', 'A200', 'A400', 'A700'];
|
changes.selectedClass && changes.selectedClass.currentValue === '' ||
|
||||||
|
changes.selectedPalette && changes.selectedPalette.currentValue === '' )
|
||||||
|
{
|
||||||
|
this.removeColor();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( changes.selectedPalette || changes.selectedHue || changes.selectedClass || changes.selectedBg )
|
||||||
|
{
|
||||||
|
this.updateSelectedColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit()
|
// -----------------------------------------------------------------------------------------------------
|
||||||
{
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* Select palette
|
||||||
selectPalette(palette)
|
*
|
||||||
|
* @param palette
|
||||||
|
*/
|
||||||
|
selectPalette(palette): void
|
||||||
{
|
{
|
||||||
this.selectedPalette = palette;
|
this.selectedPalette = palette;
|
||||||
this.updateSelectedColor();
|
this.updateSelectedColor();
|
||||||
this.view = 'hues';
|
this.view = 'hues';
|
||||||
}
|
}
|
||||||
|
|
||||||
selectHue(hue)
|
/**
|
||||||
|
* Select hue
|
||||||
|
*
|
||||||
|
* @param hue
|
||||||
|
*/
|
||||||
|
selectHue(hue): void
|
||||||
{
|
{
|
||||||
this.selectedHue = hue;
|
this.selectedHue = hue;
|
||||||
this.updateSelectedColor();
|
this.updateSelectedColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
removeColor()
|
/**
|
||||||
|
* Remove color
|
||||||
|
*/
|
||||||
|
removeColor(): void
|
||||||
{
|
{
|
||||||
this.selectedPalette = '';
|
this.selectedPalette = '';
|
||||||
this.selectedHue = '';
|
this.selectedHue = '';
|
||||||
this.updateSelectedColor();
|
this.updateSelectedColor();
|
||||||
|
this.view = 'palettes';
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSelectedColor()
|
/**
|
||||||
|
* Update selected color
|
||||||
|
*/
|
||||||
|
updateSelectedColor(): void
|
||||||
{
|
{
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
||||||
@@ -156,12 +251,18 @@ export class FuseMaterialColorPickerComponent implements OnInit, OnChanges
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
backToPaletteSelection()
|
/**
|
||||||
|
* Go back to palette selection
|
||||||
|
*/
|
||||||
|
backToPaletteSelection(): void
|
||||||
{
|
{
|
||||||
this.view = 'palettes';
|
this.view = 'palettes';
|
||||||
}
|
}
|
||||||
|
|
||||||
onMenuOpen()
|
/**
|
||||||
|
* On menu open
|
||||||
|
*/
|
||||||
|
onMenuOpen(): void
|
||||||
{
|
{
|
||||||
if ( this.selectedPalette === '' )
|
if ( this.selectedPalette === '' )
|
||||||
{
|
{
|
||||||
@@ -172,19 +273,4 @@ export class FuseMaterialColorPickerComponent implements OnInit, OnChanges
|
|||||||
this.view = 'hues';
|
this.view = 'hues';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: any)
|
|
||||||
{
|
|
||||||
if ( changes.selectedBg && changes.selectedBg.currentValue === '' ||
|
|
||||||
changes.selectedClass && changes.selectedClass.currentValue === '' ||
|
|
||||||
changes.selectedPalette && changes.selectedPalette.currentValue === '' )
|
|
||||||
{
|
|
||||||
this.removeColor();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( changes.selectedPalette || changes.selectedHue || changes.selectedClass || changes.selectedBg )
|
|
||||||
{
|
|
||||||
this.updateSelectedColor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||||
|
import { MatButtonModule, MatIconModule, MatMenuModule, MatRippleModule } from '@angular/material';
|
||||||
|
|
||||||
|
import { FusePipesModule } from '@fuse/pipes/pipes.module';
|
||||||
|
|
||||||
|
import { FuseMaterialColorPickerComponent } from '@fuse/components/material-color-picker/material-color-picker.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseMaterialColorPickerComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
|
||||||
|
FlexLayoutModule,
|
||||||
|
|
||||||
|
MatButtonModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatMenuModule,
|
||||||
|
MatRippleModule,
|
||||||
|
|
||||||
|
FusePipesModule
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
FuseMaterialColorPickerComponent
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class FuseMaterialColorPickerModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<ng-container *ngIf="!item.hidden">
|
||||||
|
|
||||||
|
<!-- normal collapse -->
|
||||||
|
<a class="nav-link" *ngIf="!item.url && !item.function" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.url -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && !item.function"
|
||||||
|
[routerLink]="[item.url]" routerLinkActive="active"
|
||||||
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.function -->
|
||||||
|
<span class="nav-link" *ngIf="!item.url && item.function" (click)="item.function()" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- item.url && item.function -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && item.function" (click)="item.function()"
|
||||||
|
[routerLink]="[item.url]" routerLinkActive="active"
|
||||||
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<ng-template #itemContent>
|
||||||
|
<mat-icon class="nav-link-icon" *ngIf="item.icon">{{item.icon}}</mat-icon>
|
||||||
|
<span class="nav-link-title" [translate]="item.translate">{{item.title}}</span>
|
||||||
|
<span class="nav-link-badge" *ngIf="item.badge" [translate]="item.badge.translate"
|
||||||
|
[ngStyle]="{'background-color': item.badge.bg,'color': item.badge.fg}">
|
||||||
|
{{item.badge.title}}
|
||||||
|
</span>
|
||||||
|
<mat-icon class="collapsable-arrow">keyboard_arrow_right</mat-icon>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<div class="children" [ngClass]="{'open': isOpen}">
|
||||||
|
|
||||||
|
<div class="{{fuseConfig.layout.navbar.background}}">
|
||||||
|
|
||||||
|
<ng-container *ngFor="let item of item.children">
|
||||||
|
<fuse-nav-horizontal-item *ngIf="item.type=='item'" [item]="item"></fuse-nav-horizontal-item>
|
||||||
|
<fuse-nav-horizontal-collapsable *ngIf="item.type=='collapsable'"
|
||||||
|
[item]="item"></fuse-nav-horizontal-collapsable>
|
||||||
|
<fuse-nav-horizontal-collapsable *ngIf="item.type=='group'"
|
||||||
|
[item]="item"></fuse-nav-horizontal-collapsable>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ng-container>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
import { Component, HostBinding, HostListener, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { fuseAnimations } from '@fuse/animations';
|
||||||
|
import { FuseConfigService } from '@fuse/services/config.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-nav-horizontal-collapsable',
|
||||||
|
templateUrl: './collapsable.component.html',
|
||||||
|
styleUrls : ['./collapsable.component.scss'],
|
||||||
|
animations : fuseAnimations
|
||||||
|
})
|
||||||
|
export class FuseNavHorizontalCollapsableComponent implements OnInit, OnDestroy
|
||||||
|
{
|
||||||
|
fuseConfig: any;
|
||||||
|
isOpen = false;
|
||||||
|
|
||||||
|
@HostBinding('class')
|
||||||
|
classes = 'nav-collapsable nav-item';
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
item: any;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private _fuseConfigService: FuseConfigService
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Set the private defaults
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
// Subscribe to config changes
|
||||||
|
this._fuseConfigService.config
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe(
|
||||||
|
(config) => {
|
||||||
|
this.fuseConfig = config;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open
|
||||||
|
*/
|
||||||
|
@HostListener('mouseenter')
|
||||||
|
open(): void
|
||||||
|
{
|
||||||
|
this.isOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close
|
||||||
|
*/
|
||||||
|
@HostListener('mouseleave')
|
||||||
|
close(): void
|
||||||
|
{
|
||||||
|
this.isOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<ng-container *ngIf="!item.hidden">
|
||||||
|
|
||||||
|
<!-- item.url -->
|
||||||
|
<a class="nav-link" *ngIf="item.url" [routerLink]="[item.url]" routerLinkActive="active"
|
||||||
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.function -->
|
||||||
|
<span class="nav-link" *ngIf="item.function" (click)="item.function()" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- item.url && item.function -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && item.function" (click)="item.function()"
|
||||||
|
[routerLink]="[item.url]" routerLinkActive="active"
|
||||||
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<ng-template #itemContent>
|
||||||
|
<mat-icon class="nav-link-icon" *ngIf="item.icon">{{item.icon}}</mat-icon>
|
||||||
|
<span class="nav-link-title" [translate]="item.translate">{{item.title}}</span>
|
||||||
|
<span class="nav-link-badge" *ngIf="item.badge" [translate]="item.badge.translate"
|
||||||
|
[ngStyle]="{'background-color': item.badge.bg,'color': item.badge.fg}">
|
||||||
|
{{item.badge.title}}
|
||||||
|
</span>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
</ng-container>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { Component, HostBinding, Input } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-nav-horizontal-item',
|
||||||
|
templateUrl: './item.component.html',
|
||||||
|
styleUrls : ['./item.component.scss']
|
||||||
|
})
|
||||||
|
export class FuseNavHorizontalItemComponent
|
||||||
|
{
|
||||||
|
@HostBinding('class')
|
||||||
|
classes = 'nav-item';
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
item: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
<!-- Vertical Navigation Layout -->
|
<!-- Vertical Navigation Layout -->
|
||||||
<ng-container *ngIf="layout === 'vertical'">
|
<ng-container *ngIf="layout === 'vertical'">
|
||||||
|
|
||||||
<ng-container *ngFor="let item of navigationModel">
|
<ng-container *ngFor="let item of navigation">
|
||||||
|
|
||||||
<fuse-nav-vertical-group *ngIf="item.type=='group'" [item]="item"></fuse-nav-vertical-group>
|
<fuse-nav-vertical-group *ngIf="item.type=='group'" [item]="item"></fuse-nav-vertical-group>
|
||||||
<fuse-nav-vertical-collapse *ngIf="item.type=='collapse'" [item]="item"></fuse-nav-vertical-collapse>
|
<fuse-nav-vertical-collapsable *ngIf="item.type=='collapse'" [item]="item"></fuse-nav-vertical-collapsable>
|
||||||
<fuse-nav-vertical-item *ngIf="item.type=='item'" [item]="item"></fuse-nav-vertical-item>
|
<fuse-nav-vertical-item *ngIf="item.type=='item'" [item]="item"></fuse-nav-vertical-item>
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@@ -18,10 +18,10 @@
|
|||||||
<!-- Horizontal Navigation Layout -->
|
<!-- Horizontal Navigation Layout -->
|
||||||
<ng-container *ngIf="layout === 'horizontal'">
|
<ng-container *ngIf="layout === 'horizontal'">
|
||||||
|
|
||||||
<ng-container *ngFor="let item of navigationModel">
|
<ng-container *ngFor="let item of navigation">
|
||||||
|
|
||||||
<fuse-nav-horizontal-collapse *ngIf="item.type=='group'" [item]="item"></fuse-nav-horizontal-collapse>
|
<fuse-nav-horizontal-collapsable *ngIf="item.type=='group'" [item]="item"></fuse-nav-horizontal-collapsable>
|
||||||
<fuse-nav-horizontal-collapse *ngIf="item.type=='collapse'" [item]="item"></fuse-nav-horizontal-collapse>
|
<fuse-nav-horizontal-collapsable *ngIf="item.type=='collapse'" [item]="item"></fuse-nav-horizontal-collapsable>
|
||||||
<fuse-nav-horizontal-item *ngIf="item.type=='item'" [item]="item"></fuse-nav-horizontal-item>
|
<fuse-nav-horizontal-item *ngIf="item.type=='item'" [item]="item"></fuse-nav-horizontal-item>
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
12
src/@fuse/components/navigation/navigation.component.scss
Normal file
12
src/@fuse/components/navigation/navigation.component.scss
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
@import 'src/@fuse/scss/fuse';
|
||||||
|
|
||||||
|
fuse-navigation {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 0 auto;
|
||||||
|
|
||||||
|
#main-navigation {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
54
src/@fuse/components/navigation/navigation.component.ts
Normal file
54
src/@fuse/components/navigation/navigation.component.ts
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-navigation',
|
||||||
|
templateUrl : './navigation.component.html',
|
||||||
|
styleUrls : ['./navigation.component.scss'],
|
||||||
|
encapsulation: ViewEncapsulation.None
|
||||||
|
})
|
||||||
|
export class FuseNavigationComponent implements OnInit
|
||||||
|
{
|
||||||
|
@Input()
|
||||||
|
layout = 'vertical';
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
navigation: any;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _fuseNavigationService: FuseNavigationService
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Set the private defaults
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
// Load the navigation either from the input or from the service
|
||||||
|
this.navigation = this.navigation || this._fuseNavigationService.getCurrentNavigation();
|
||||||
|
|
||||||
|
// Subscribe to the current navigation changes
|
||||||
|
this._fuseNavigationService.onNavigationChanged
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe(() => {
|
||||||
|
this.navigation = this._fuseNavigationService.getCurrentNavigation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
39
src/@fuse/components/navigation/navigation.module.ts
Normal file
39
src/@fuse/components/navigation/navigation.module.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { MatIconModule, MatRippleModule } from '@angular/material';
|
||||||
|
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { FuseNavigationComponent } from './navigation.component';
|
||||||
|
import { FuseNavVerticalItemComponent } from './vertical/item/item.component';
|
||||||
|
import { FuseNavVerticalCollapsableComponent } from './vertical/collapsable/collapsable.component';
|
||||||
|
import { FuseNavVerticalGroupComponent } from './vertical/group/group.component';
|
||||||
|
import { FuseNavHorizontalItemComponent } from './horizontal/item/item.component';
|
||||||
|
import { FuseNavHorizontalCollapsableComponent } from './horizontal/collapsable/collapsable.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports : [
|
||||||
|
CommonModule,
|
||||||
|
RouterModule,
|
||||||
|
|
||||||
|
MatIconModule,
|
||||||
|
MatRippleModule,
|
||||||
|
|
||||||
|
TranslateModule.forChild()
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseNavigationComponent
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
FuseNavigationComponent,
|
||||||
|
FuseNavVerticalGroupComponent,
|
||||||
|
FuseNavVerticalItemComponent,
|
||||||
|
FuseNavVerticalCollapsableComponent,
|
||||||
|
FuseNavHorizontalItemComponent,
|
||||||
|
FuseNavHorizontalCollapsableComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseNavigationModule
|
||||||
|
{
|
||||||
|
}
|
||||||
357
src/@fuse/components/navigation/navigation.service.ts
Normal file
357
src/@fuse/components/navigation/navigation.service.ts
Normal file
@@ -0,0 +1,357 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { BehaviorSubject, Observable, Subject } from 'rxjs';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class FuseNavigationService
|
||||||
|
{
|
||||||
|
flatNavigation: any[] = [];
|
||||||
|
|
||||||
|
onItemCollapsed: Subject<any>;
|
||||||
|
onItemCollapseToggled: Subject<any>;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _onNavigationChanged: BehaviorSubject<any>;
|
||||||
|
private _onNavigationRegistered: BehaviorSubject<any>;
|
||||||
|
private _onNavigationUnregistered: BehaviorSubject<any>;
|
||||||
|
|
||||||
|
private _currentNavigationKey: string;
|
||||||
|
private _registry: { [key: string]: any } = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
// Set the defaults
|
||||||
|
this.onItemCollapsed = new Subject();
|
||||||
|
this.onItemCollapseToggled = new Subject();
|
||||||
|
|
||||||
|
// Set the private defaults
|
||||||
|
this._currentNavigationKey = null;
|
||||||
|
this._onNavigationChanged = new BehaviorSubject(null);
|
||||||
|
this._onNavigationRegistered = new BehaviorSubject(null);
|
||||||
|
this._onNavigationUnregistered = new BehaviorSubject(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Accessors
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get onNavigationChanged
|
||||||
|
*
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
get onNavigationChanged(): Observable<any>
|
||||||
|
{
|
||||||
|
return this._onNavigationChanged.asObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get onNavigationRegistered
|
||||||
|
*
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
get onNavigationRegistered(): Observable<any>
|
||||||
|
{
|
||||||
|
return this._onNavigationRegistered.asObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get onNavigationUnregistered
|
||||||
|
*
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
get onNavigationUnregistered(): Observable<any>
|
||||||
|
{
|
||||||
|
return this._onNavigationUnregistered.asObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the given navigation
|
||||||
|
* with the given key
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @param navigation
|
||||||
|
*/
|
||||||
|
register(key, navigation): void
|
||||||
|
{
|
||||||
|
// Check if the key already being used
|
||||||
|
if ( this._registry[key] )
|
||||||
|
{
|
||||||
|
console.error(`The navigation with the key '${key}' already exists. Either unregister it first or use a unique key.`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to the registry
|
||||||
|
this._registry[key] = navigation;
|
||||||
|
|
||||||
|
// Notify the subject
|
||||||
|
this._onNavigationRegistered.next([key, navigation]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregister the navigation from the registry
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
unregister(key): void
|
||||||
|
{
|
||||||
|
// Check if the navigation exists
|
||||||
|
if ( !this._registry[key] )
|
||||||
|
{
|
||||||
|
console.warn(`The navigation with the key '${key}' doesn't exist in the registry.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unregister the sidebar
|
||||||
|
delete this._registry[key];
|
||||||
|
|
||||||
|
// Notify the subject
|
||||||
|
this._onNavigationUnregistered.next(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get navigation from registry by key
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
getNavigation(key): any
|
||||||
|
{
|
||||||
|
// Check if the navigation exists
|
||||||
|
if ( !this._registry[key] )
|
||||||
|
{
|
||||||
|
console.warn(`The navigation with the key '${key}' doesn't exist in the registry.`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the sidebar
|
||||||
|
return this._registry[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get flattened navigation array
|
||||||
|
*
|
||||||
|
* @param navigation
|
||||||
|
* @returns {any[]}
|
||||||
|
*/
|
||||||
|
getFlatNavigation(navigation): any
|
||||||
|
{
|
||||||
|
for ( const navItem of navigation )
|
||||||
|
{
|
||||||
|
if ( navItem.type === 'item' )
|
||||||
|
{
|
||||||
|
this.flatNavigation.push({
|
||||||
|
id : navItem.id || null,
|
||||||
|
title : navItem.title || null,
|
||||||
|
translate : navItem.translate || null,
|
||||||
|
type : navItem.type,
|
||||||
|
icon : navItem.icon || null,
|
||||||
|
url : navItem.url || null,
|
||||||
|
function : navItem.function || null,
|
||||||
|
exactMatch: navItem.exactMatch || false,
|
||||||
|
badge : navItem.badge || null
|
||||||
|
});
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( navItem.type === 'collapse' || navItem.type === 'group' )
|
||||||
|
{
|
||||||
|
if ( navItem.children )
|
||||||
|
{
|
||||||
|
this.getFlatNavigation(navItem.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.flatNavigation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current navigation
|
||||||
|
*
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
getCurrentNavigation(): any
|
||||||
|
{
|
||||||
|
if ( !this._currentNavigationKey )
|
||||||
|
{
|
||||||
|
console.warn(`The current navigation is not set.`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.getNavigation(this._currentNavigationKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the navigation with the key
|
||||||
|
* as the current navigation
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
setCurrentNavigation(key): void
|
||||||
|
{
|
||||||
|
// Check if the sidebar exists
|
||||||
|
if ( !this._registry[key] )
|
||||||
|
{
|
||||||
|
console.warn(`The navigation with the key '${key}' doesn't exist in the registry.`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the current navigation key
|
||||||
|
this._currentNavigationKey = key;
|
||||||
|
|
||||||
|
// Notify the subject
|
||||||
|
this._onNavigationChanged.next(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get navigation item by id from the
|
||||||
|
* current navigation
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param {any} navigation
|
||||||
|
* @returns {any | boolean}
|
||||||
|
*/
|
||||||
|
getNavigationItem(id, navigation = null): any | boolean
|
||||||
|
{
|
||||||
|
if ( !navigation )
|
||||||
|
{
|
||||||
|
navigation = this.getCurrentNavigation();
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( const item of navigation )
|
||||||
|
{
|
||||||
|
if ( item.id === id )
|
||||||
|
{
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( item.children )
|
||||||
|
{
|
||||||
|
const childItem = this.getNavigationItem(id, item.children);
|
||||||
|
|
||||||
|
if ( childItem )
|
||||||
|
{
|
||||||
|
return childItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the parent of the navigation item
|
||||||
|
* with the id
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param {any} navigation
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
|
getNavigationItemParent(id, navigation = null, parent = null): any
|
||||||
|
{
|
||||||
|
if ( !navigation )
|
||||||
|
{
|
||||||
|
navigation = this.getCurrentNavigation();
|
||||||
|
parent = navigation;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( const item of navigation )
|
||||||
|
{
|
||||||
|
if ( item.id === id )
|
||||||
|
{
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( item.children )
|
||||||
|
{
|
||||||
|
const childItem = this.getNavigationItemParent(id, item.children, item);
|
||||||
|
|
||||||
|
if ( childItem )
|
||||||
|
{
|
||||||
|
return childItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a navigation item to the specified location
|
||||||
|
*
|
||||||
|
* @param item
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
addNavigationItem(item, id): void
|
||||||
|
{
|
||||||
|
// Get the current navigation
|
||||||
|
const navigation: any[] = this.getCurrentNavigation();
|
||||||
|
|
||||||
|
// Add to the end of the navigation
|
||||||
|
if ( id === 'end' )
|
||||||
|
{
|
||||||
|
navigation.push(item);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to the start of the navigation
|
||||||
|
if ( id === 'start' )
|
||||||
|
{
|
||||||
|
navigation.unshift(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add it to a specific location
|
||||||
|
const parent: any = this.getNavigationItem(id);
|
||||||
|
|
||||||
|
if ( parent )
|
||||||
|
{
|
||||||
|
// Check if parent has a children entry,
|
||||||
|
// and add it if it doesn't
|
||||||
|
if ( !parent.children )
|
||||||
|
{
|
||||||
|
parent.children = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the item
|
||||||
|
parent.children.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove navigation item with the given id
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
removeNavigationItem(id): void
|
||||||
|
{
|
||||||
|
const item = this.getNavigationItem(id);
|
||||||
|
|
||||||
|
// Return, if there is not such an item
|
||||||
|
if ( !item )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the parent of the item
|
||||||
|
let parent = this.getNavigationItemParent(id);
|
||||||
|
|
||||||
|
// This check is required because of the first level
|
||||||
|
// of the navigation, since the first level is not
|
||||||
|
// inside the 'children' array
|
||||||
|
parent = parent.children || parent;
|
||||||
|
|
||||||
|
// Remove the item
|
||||||
|
parent.splice(parent.indexOf(item), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<ng-container *ngIf="!item.hidden">
|
||||||
|
|
||||||
|
<!-- normal collapse -->
|
||||||
|
<a class="nav-link" *ngIf="!item.url && !item.function" (click)="toggleOpen($event)" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.url -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && !item.externalUrl && !item.function" (click)="toggleOpen($event)"
|
||||||
|
[routerLink]="[item.url]" [routerLinkActive]="['active', 'mat-accent-bg']"
|
||||||
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}"
|
||||||
|
[target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.externalUrl -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && item.externalUrl && !item.function" (click)="toggleOpen($event)"
|
||||||
|
[href]="item.url" [target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.function -->
|
||||||
|
<span class="nav-link" *ngIf="!item.url && item.function"
|
||||||
|
(click)="toggleOpen($event);item.function()" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- item.url && item.function -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && !item.externalUrl && item.function"
|
||||||
|
(click)="toggleOpen($event);item.function()"
|
||||||
|
[routerLink]="[item.url]" [routerLinkActive]="['active', 'mat-accent-bg']"
|
||||||
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.externalUrl && item.function -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && item.externalUrl && item.function"
|
||||||
|
(click)="toggleOpen($event);item.function()"
|
||||||
|
[href]="item.url" [target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<ng-template #itemContent>
|
||||||
|
<mat-icon class="nav-link-icon" *ngIf="item.icon">{{item.icon}}</mat-icon>
|
||||||
|
<span class="nav-link-title" [translate]="item.translate">{{item.title}}</span>
|
||||||
|
<span class="nav-link-badge" *ngIf="item.badge" [translate]="item.badge.translate"
|
||||||
|
[ngStyle]="{'background-color': item.badge.bg,'color': item.badge.fg}">
|
||||||
|
{{item.badge.title}}
|
||||||
|
</span>
|
||||||
|
<mat-icon class="collapsable-arrow">keyboard_arrow_right</mat-icon>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<div class="children" [@slideInOut]="isOpen">
|
||||||
|
<ng-container *ngFor="let item of item.children">
|
||||||
|
<fuse-nav-vertical-item *ngIf="item.type=='item'" [item]="item"></fuse-nav-vertical-item>
|
||||||
|
<fuse-nav-vertical-collapsable *ngIf="item.type=='collapsable'"
|
||||||
|
[item]="item"></fuse-nav-vertical-collapsable>
|
||||||
|
<fuse-nav-vertical-group *ngIf="item.type=='group'" [item]="item"></fuse-nav-vertical-group>
|
||||||
|
</ng-container>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ng-container>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
:host {
|
:host {
|
||||||
|
|
||||||
.folded:not(.folded-open) & {
|
.folded:not(.unfolded) & {
|
||||||
|
|
||||||
.nav-link {
|
.nav-link {
|
||||||
|
|
||||||
> span {
|
> span {
|
||||||
@@ -8,10 +9,18 @@
|
|||||||
transition: opacity 200ms ease;
|
transition: opacity 200ms ease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.open {
|
||||||
|
|
||||||
|
.children {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-link {
|
.nav-link {
|
||||||
.collapse-arrow {
|
|
||||||
|
.collapsable-arrow {
|
||||||
transition: transform .3s ease-in-out, opacity .25s ease-in-out .1s;
|
transition: transform .3s ease-in-out, opacity .25s ease-in-out .1s;
|
||||||
transform: rotate(0);
|
transform: rotate(0);
|
||||||
}
|
}
|
||||||
@@ -25,13 +34,9 @@
|
|||||||
|
|
||||||
> .nav-link {
|
> .nav-link {
|
||||||
|
|
||||||
.collapse-arrow {
|
.collapsable-arrow {
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> .children {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,46 +1,79 @@
|
|||||||
import { Component, HostBinding, Input, OnInit } from '@angular/core';
|
import { Component, HostBinding, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { FuseNavigationService } from '../../navigation.service';
|
|
||||||
import { NavigationEnd, Router } from '@angular/router';
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
import { fuseAnimations } from '../../../../animations';
|
import { Subject } from 'rxjs';
|
||||||
|
import { filter, takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { FuseNavigationItem } from '@fuse/types';
|
||||||
|
import { fuseAnimations } from '@fuse/animations';
|
||||||
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-nav-vertical-collapse',
|
selector : 'fuse-nav-vertical-collapsable',
|
||||||
templateUrl: './nav-vertical-collapse.component.html',
|
templateUrl: './collapsable.component.html',
|
||||||
styleUrls : ['./nav-vertical-collapse.component.scss'],
|
styleUrls : ['./collapsable.component.scss'],
|
||||||
animations : fuseAnimations
|
animations : fuseAnimations
|
||||||
})
|
})
|
||||||
export class FuseNavVerticalCollapseComponent implements OnInit
|
export class FuseNavVerticalCollapsableComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@Input() item: any;
|
@Input()
|
||||||
@HostBinding('class') classes = 'nav-collapse nav-item';
|
item: FuseNavigationItem;
|
||||||
@HostBinding('class.open') public isOpen = false;
|
|
||||||
|
|
||||||
|
@HostBinding('class')
|
||||||
|
classes = 'nav-collapsable nav-item';
|
||||||
|
|
||||||
|
@HostBinding('class.open')
|
||||||
|
public isOpen = false;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {FuseNavigationService} _fuseNavigationService
|
||||||
|
* @param {Router} _router
|
||||||
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private navigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService,
|
||||||
private router: Router
|
private _router: Router
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Listen for route changes
|
// Set the private defaults
|
||||||
router.events.subscribe(
|
this._unsubscribeAll = new Subject();
|
||||||
(event) => {
|
}
|
||||||
if ( event instanceof NavigationEnd )
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
// Listen for router events
|
||||||
|
this._router.events
|
||||||
|
.pipe(
|
||||||
|
filter(event => event instanceof NavigationEnd),
|
||||||
|
takeUntil(this._unsubscribeAll)
|
||||||
|
)
|
||||||
|
.subscribe((event: NavigationEnd) => {
|
||||||
|
|
||||||
|
// Check if the url can be found in
|
||||||
|
// one of the children of this item
|
||||||
|
if ( this.isUrlInChildren(this.item, event.urlAfterRedirects) )
|
||||||
{
|
{
|
||||||
// Check if the url can be found in
|
this.expand();
|
||||||
// one of the children of this item
|
|
||||||
if ( this.isUrlInChildren(this.item, event.urlAfterRedirects) )
|
|
||||||
{
|
|
||||||
this.expand();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.collapse();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
);
|
{
|
||||||
|
this.collapse();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Listen for collapsing of any navigation item
|
// Listen for collapsing of any navigation item
|
||||||
this.navigationService.onNavCollapseToggled
|
this._fuseNavigationService.onItemCollapsed
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(clickedItem) => {
|
(clickedItem) => {
|
||||||
if ( clickedItem && clickedItem.children )
|
if ( clickedItem && clickedItem.children )
|
||||||
@@ -54,7 +87,7 @@ export class FuseNavVerticalCollapseComponent implements OnInit
|
|||||||
|
|
||||||
// Check if the url can be found in
|
// Check if the url can be found in
|
||||||
// one of the children of this item
|
// one of the children of this item
|
||||||
if ( this.isUrlInChildren(this.item, this.router.url) )
|
if ( this.isUrlInChildren(this.item, this._router.url) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -67,13 +100,10 @@ export class FuseNavVerticalCollapseComponent implements OnInit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit()
|
|
||||||
{
|
|
||||||
// Check if the url can be found in
|
// Check if the url can be found in
|
||||||
// one of the children of this item
|
// one of the children of this item
|
||||||
if ( this.isUrlInChildren(this.item, this.router.url) )
|
if ( this.isUrlInChildren(this.item, this._router.url) )
|
||||||
{
|
{
|
||||||
this.expand();
|
this.expand();
|
||||||
}
|
}
|
||||||
@@ -83,26 +113,40 @@ export class FuseNavVerticalCollapseComponent implements OnInit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle collapse
|
* Toggle collapse
|
||||||
*
|
*
|
||||||
* @param ev
|
* @param ev
|
||||||
*/
|
*/
|
||||||
toggleOpen(ev)
|
toggleOpen(ev): void
|
||||||
{
|
{
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
this.isOpen = !this.isOpen;
|
this.isOpen = !this.isOpen;
|
||||||
|
|
||||||
// Navigation collapse toggled...
|
// Navigation collapse toggled...
|
||||||
this.navigationService.onNavCollapseToggled.emit(this.item);
|
this._fuseNavigationService.onItemCollapsed.next(this.item);
|
||||||
this.navigationService.onNavCollapseToggle.emit();
|
this._fuseNavigationService.onItemCollapseToggled.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expand the collapsable navigation
|
* Expand the collapsable navigation
|
||||||
*/
|
*/
|
||||||
expand()
|
expand(): void
|
||||||
{
|
{
|
||||||
if ( this.isOpen )
|
if ( this.isOpen )
|
||||||
{
|
{
|
||||||
@@ -110,13 +154,13 @@ export class FuseNavVerticalCollapseComponent implements OnInit
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
this.navigationService.onNavCollapseToggle.emit();
|
this._fuseNavigationService.onItemCollapseToggled.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collapse the collapsable navigation
|
* Collapse the collapsable navigation
|
||||||
*/
|
*/
|
||||||
collapse()
|
collapse(): void
|
||||||
{
|
{
|
||||||
if ( !this.isOpen )
|
if ( !this.isOpen )
|
||||||
{
|
{
|
||||||
@@ -124,7 +168,7 @@ export class FuseNavVerticalCollapseComponent implements OnInit
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
this.navigationService.onNavCollapseToggle.emit();
|
this._fuseNavigationService.onItemCollapseToggled.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,9 +177,9 @@ export class FuseNavVerticalCollapseComponent implements OnInit
|
|||||||
*
|
*
|
||||||
* @param parent
|
* @param parent
|
||||||
* @param item
|
* @param item
|
||||||
* @return {any}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isChildrenOf(parent, item)
|
isChildrenOf(parent, item): boolean
|
||||||
{
|
{
|
||||||
if ( !parent.children )
|
if ( !parent.children )
|
||||||
{
|
{
|
||||||
@@ -162,9 +206,9 @@ export class FuseNavVerticalCollapseComponent implements OnInit
|
|||||||
*
|
*
|
||||||
* @param parent
|
* @param parent
|
||||||
* @param url
|
* @param url
|
||||||
* @returns {any}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isUrlInChildren(parent, url)
|
isUrlInChildren(parent, url): boolean
|
||||||
{
|
{
|
||||||
if ( !parent.children )
|
if ( !parent.children )
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<ng-container *ngIf="!item.hidden">
|
||||||
|
|
||||||
|
<div class="group-title">
|
||||||
|
<span class="hint-text" [translate]="item.translate">{{ item.title }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="group-items">
|
||||||
|
<ng-container *ngFor="let item of item.children">
|
||||||
|
<fuse-nav-vertical-group *ngIf="item.type=='group'" [item]="item"></fuse-nav-vertical-group>
|
||||||
|
<fuse-nav-vertical-collapsable *ngIf="item.type=='collapsable'"
|
||||||
|
[item]="item"></fuse-nav-vertical-collapsable>
|
||||||
|
<fuse-nav-vertical-item *ngIf="item.type=='item'" [item]="item"></fuse-nav-vertical-item>
|
||||||
|
</ng-container>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ng-container>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
:host {
|
:host {
|
||||||
|
|
||||||
.folded:not(.folded-open) & {
|
.folded:not(.unfolded) & {
|
||||||
|
|
||||||
> .group-title {
|
> .group-title {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { Component, HostBinding, Input } from '@angular/core';
|
||||||
|
|
||||||
|
import { FuseNavigationItem } from '@fuse/types';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-nav-vertical-group',
|
||||||
|
templateUrl: './group.component.html',
|
||||||
|
styleUrls : ['./group.component.scss']
|
||||||
|
})
|
||||||
|
export class FuseNavVerticalGroupComponent
|
||||||
|
{
|
||||||
|
@HostBinding('class')
|
||||||
|
classes = 'nav-group nav-item';
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
item: FuseNavigationItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<ng-container *ngIf="!item.hidden">
|
||||||
|
|
||||||
|
<!-- item.url -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && !item.externalUrl && !item.function"
|
||||||
|
[routerLink]="[item.url]" [routerLinkActive]="['active', 'mat-accent-bg']"
|
||||||
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}"
|
||||||
|
[target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.externalUrl -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && item.externalUrl && !item.function"
|
||||||
|
[href]="item.url" [target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.function -->
|
||||||
|
<span class="nav-link" *ngIf="!item.url && item.function"
|
||||||
|
(click)="item.function()" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- item.url && item.function -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && !item.externalUrl && item.function" (click)="item.function()"
|
||||||
|
[routerLink]="[item.url]" [routerLinkActive]="['active', 'mat-accent-bg']"
|
||||||
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}"
|
||||||
|
[target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- item.externalUrl && item.function -->
|
||||||
|
<a class="nav-link" *ngIf="item.url && item.externalUrl && item.function" (click)="item.function()"
|
||||||
|
[href]="item.url" [target]="item.openInNewTab ? '_blank' : '_self'" matRipple>
|
||||||
|
<ng-container *ngTemplateOutlet="itemContent"></ng-container>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<ng-template #itemContent>
|
||||||
|
<mat-icon class="nav-link-icon" *ngIf="item.icon">{{item.icon}}</mat-icon>
|
||||||
|
<span class="nav-link-title" [translate]="item.translate">{{item.title}}</span>
|
||||||
|
<span class="nav-link-badge" *ngIf="item.badge" [translate]="item.badge.translate"
|
||||||
|
[ngStyle]="{'background-color': item.badge.bg,'color': item.badge.fg}">
|
||||||
|
{{item.badge.title}}
|
||||||
|
</span>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
</ng-container>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
:host {
|
:host {
|
||||||
|
|
||||||
.folded:not(.folded-open) & {
|
.folded:not(.unfolded) & {
|
||||||
|
|
||||||
.nav-link {
|
.nav-link {
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { Component, HostBinding, Input } from '@angular/core';
|
||||||
|
|
||||||
|
import { FuseNavigationItem } from '@fuse/types';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-nav-vertical-item',
|
||||||
|
templateUrl: './item.component.html',
|
||||||
|
styleUrls : ['./item.component.scss']
|
||||||
|
})
|
||||||
|
export class FuseNavVerticalItemComponent
|
||||||
|
{
|
||||||
|
@HostBinding('class')
|
||||||
|
classes = 'nav-item';
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
item: FuseNavigationItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +1,25 @@
|
|||||||
<div class="fuse-search-bar" [ngClass]="{'expanded':!collapsed}" fxFlex="0 1 auto">
|
<div class="fuse-search-bar" [ngClass]="{'expanded':!collapsed}">
|
||||||
<div [ngClass]="toolbarColor" fxLayout="row" fxLayoutAlign="start center" fxFlex>
|
|
||||||
|
<div class="fuse-search-bar-content" [ngClass]="fuseConfig.layout.toolbar.background">
|
||||||
|
|
||||||
<label for="fuse-search-bar-input">
|
<label for="fuse-search-bar-input">
|
||||||
<button mat-icon-button class="fuse-search-bar-expander" aria-label="Expand Search Bar" (click)="expand()"
|
<button mat-icon-button class="fuse-search-bar-expander" aria-label="Expand Search Bar" (click)="expand()"
|
||||||
*ngIf="collapsed">
|
*ngIf="collapsed">
|
||||||
<mat-icon class="s-24">search</mat-icon>
|
<mat-icon class="s-24 secondary-text">search</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<!--<span class="fuse-search-bar-loader" fxLayout="row" fxLayoutAlign="center center" *ngIf="!collapsed">
|
<!--<span class="fuse-search-bar-loader" fxLayout="row" fxLayoutAlign="center center" *ngIf="!collapsed">
|
||||||
<mat-progress-spinner color="mat-accent" mode="indeterminate"></mat-progress-spinner>
|
<mat-progress-spinner color="mat-accent" mode="indeterminate"></mat-progress-spinner>
|
||||||
</span>-->
|
</span>-->
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input id="fuse-search-bar-input" class="ml-24" type="text" placeholder="Search" (input)="search($event)" fxFlex>
|
<input id="fuse-search-bar-input" class="ml-24" type="text" placeholder="Search" (input)="search($event)"
|
||||||
|
fxFlex>
|
||||||
|
|
||||||
<button mat-icon-button class="fuse-search-bar-collapser mat-icon-button" (click)="collapse()"
|
<button mat-icon-button class="fuse-search-bar-collapser" (click)="collapse()"
|
||||||
aria-label="Collapse Search Bar">
|
aria-label="Collapse Search Bar">
|
||||||
<mat-icon class="s-24">close</mat-icon>
|
<mat-icon class="s-24 secondary-text">close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
91
src/@fuse/components/search-bar/search-bar.component.scss
Normal file
91
src/@fuse/components/search-bar/search-bar.component.scss
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
@import "src/@fuse/scss/fuse";
|
||||||
|
|
||||||
|
:host {
|
||||||
|
|
||||||
|
.fuse-search-bar {
|
||||||
|
display: flex;
|
||||||
|
flex: 0 1 auto;
|
||||||
|
min-width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
font-size: 13px;
|
||||||
|
|
||||||
|
@include media-breakpoint-down('sm') {
|
||||||
|
height: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fuse-search-bar-content {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
|
||||||
|
.fuse-search-bar-expander,
|
||||||
|
.fuse-search-bar-collapser {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0 20px;
|
||||||
|
margin: 0;
|
||||||
|
width: 64px !important;
|
||||||
|
height: 64px !important;
|
||||||
|
line-height: 64px !important;
|
||||||
|
|
||||||
|
@include media-breakpoint-down('sm') {
|
||||||
|
height: 56px !important;
|
||||||
|
line-height: 56px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fuse-search-bar-loader {
|
||||||
|
width: 64px !important;
|
||||||
|
height: 64px !important;
|
||||||
|
line-height: 64px !important;
|
||||||
|
|
||||||
|
@include media-breakpoint-down('sm') {
|
||||||
|
height: 56px !important;
|
||||||
|
line-height: 56px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fuse-search-bar-collapser {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#fuse-search-bar-input {
|
||||||
|
display: none;
|
||||||
|
flex: 1 0 auto;
|
||||||
|
min-height: 64px;
|
||||||
|
background-color: transparent;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.expanded {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
.fuse-search-bar-content {
|
||||||
|
|
||||||
|
#fuse-search-bar-input {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fuse-search-bar-collapser {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
|
||||||
|
&.fuse-search-bar-expanded {
|
||||||
|
|
||||||
|
#toolbar {
|
||||||
|
z-index: 999 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
99
src/@fuse/components/search-bar/search-bar.component.ts
Normal file
99
src/@fuse/components/search-bar/search-bar.component.ts
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
import { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { FuseConfigService } from '@fuse/services/config.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-search-bar',
|
||||||
|
templateUrl: './search-bar.component.html',
|
||||||
|
styleUrls : ['./search-bar.component.scss']
|
||||||
|
})
|
||||||
|
export class FuseSearchBarComponent implements OnInit, OnDestroy
|
||||||
|
{
|
||||||
|
collapsed: boolean;
|
||||||
|
fuseConfig: any;
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
input: EventEmitter<any>;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {FuseConfigService} _fuseConfigService
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _fuseConfigService: FuseConfigService
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Set the defaults
|
||||||
|
this.input = new EventEmitter();
|
||||||
|
this.collapsed = true;
|
||||||
|
|
||||||
|
// Set the private defaults
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
// Subscribe to config changes
|
||||||
|
this._fuseConfigService.config
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe(
|
||||||
|
(config) => {
|
||||||
|
this.fuseConfig = config;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collapse
|
||||||
|
*/
|
||||||
|
collapse(): void
|
||||||
|
{
|
||||||
|
this.collapsed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expand
|
||||||
|
*/
|
||||||
|
expand(): void
|
||||||
|
{
|
||||||
|
this.collapsed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
search(event): void
|
||||||
|
{
|
||||||
|
this.input.emit(event.target.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
import { SharedModule } from '../../modules/shared.module';
|
import { MatButtonModule, MatIconModule } from '@angular/material';
|
||||||
|
|
||||||
import { FuseSearchBarComponent } from './search-bar.component';
|
import { FuseSearchBarComponent } from './search-bar.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -9,8 +11,11 @@ import { FuseSearchBarComponent } from './search-bar.component';
|
|||||||
FuseSearchBarComponent
|
FuseSearchBarComponent
|
||||||
],
|
],
|
||||||
imports : [
|
imports : [
|
||||||
SharedModule,
|
CommonModule,
|
||||||
RouterModule
|
RouterModule,
|
||||||
|
|
||||||
|
MatButtonModule,
|
||||||
|
MatIconModule
|
||||||
],
|
],
|
||||||
exports : [
|
exports : [
|
||||||
FuseSearchBarComponent
|
FuseSearchBarComponent
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="shortcuts" fxHide fxShow.gt-sm [ngClass]="toolbarColor">
|
<div class="shortcuts" fxHide fxShow.gt-sm>
|
||||||
|
|
||||||
<div fxLayout="row" fxLayoutAlign="space-between center" fxFlex="0 1 auto">
|
<div fxLayout="row" fxLayoutAlign="space-between center" fxFlex="0 1 auto">
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
*ngFor="let shortcutItem of shortcutItems">
|
*ngFor="let shortcutItem of shortcutItems">
|
||||||
|
|
||||||
<a mat-icon-button matTooltip="{{shortcutItem.title}}" [routerLink]="shortcutItem.url">
|
<a mat-icon-button matTooltip="{{shortcutItem.title}}" [routerLink]="shortcutItem.url">
|
||||||
<mat-icon *ngIf="shortcutItem.icon">{{shortcutItem.icon}}</mat-icon>
|
<mat-icon class="secondary-text" *ngIf="shortcutItem.icon">{{shortcutItem.icon}}</mat-icon>
|
||||||
<span *ngIf="!shortcutItem.icon" class="h2 secondary-text text-bold">
|
<span *ngIf="!shortcutItem.icon" class="h2 secondary-text text-bold">
|
||||||
{{shortcutItem.title.substr(0, 1).toUpperCase()}}
|
{{shortcutItem.title.substr(0, 1).toUpperCase()}}
|
||||||
</span>
|
</span>
|
||||||
@@ -42,46 +42,70 @@
|
|||||||
|
|
||||||
<mat-menu #addMenu="matMenu" class="w-240">
|
<mat-menu #addMenu="matMenu" class="w-240">
|
||||||
|
|
||||||
<mat-form-field class="px-16 w-100-p" (click)="$event.stopPropagation()" floatPlaceholder="never">
|
<mat-form-field class="px-16 w-100-p" (click)="$event.stopPropagation()" floatLabel="never">
|
||||||
<input #searchInput matInput placeholder="Search for an app or a page" (input)="search($event)">
|
<input #searchInput matInput placeholder="Search for an app or a page" (input)="search($event)">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
|
|
||||||
<mat-nav-list *ngIf="!searching" style="max-height: 312px; overflow: auto" fusePerfectScrollbar>
|
<mat-nav-list *ngIf="!searching" style="max-height: 312px; overflow: auto" fusePerfectScrollbar>
|
||||||
|
|
||||||
<mat-list-item *ngFor="let shortcutItem of shortcutItems"
|
<mat-list-item *ngFor="let shortcutItem of shortcutItems"
|
||||||
(click)="toggleShortcut($event, shortcutItem)">
|
(click)="toggleShortcut($event, shortcutItem)">
|
||||||
|
|
||||||
<div class="w-100-p" fxLayout="row" fxLayoutAlign="start center">
|
<div class="w-100-p" fxLayout="row" fxLayoutAlign="start center">
|
||||||
<mat-icon mat-list-icon class="mr-8" *ngIf="shortcutItem.icon">{{shortcutItem.icon}}</mat-icon>
|
|
||||||
|
<mat-icon mat-list-icon class="mr-8 secondary-text" *ngIf="shortcutItem.icon">
|
||||||
|
{{shortcutItem.icon}}
|
||||||
|
</mat-icon>
|
||||||
|
|
||||||
<span class="h2 w-32 h-32 p-4 mr-8 secondary-text text-bold" fxLayout="row"
|
<span class="h2 w-32 h-32 p-4 mr-8 secondary-text text-bold" fxLayout="row"
|
||||||
fxLayoutAlign="center center" *ngIf="!shortcutItem.icon">
|
fxLayoutAlign="center center" *ngIf="!shortcutItem.icon">
|
||||||
{{shortcutItem.title.substr(0, 1).toUpperCase()}}
|
{{shortcutItem.title.substr(0, 1).toUpperCase()}}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<p matLine fxFlex>{{shortcutItem.title}}</p>
|
<p matLine fxFlex>{{shortcutItem.title}}</p>
|
||||||
<mat-icon class="ml-8">star</mat-icon>
|
|
||||||
|
<mat-icon class="ml-8 amber-fg">star</mat-icon>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-list-item *ngIf="shortcutItems.length === 0">
|
<mat-list-item *ngIf="shortcutItems.length === 0">
|
||||||
<p>
|
<p>
|
||||||
<small>No shortcuts yet!</small>
|
<small>No shortcuts yet!</small>
|
||||||
</p>
|
</p>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
</mat-nav-list>
|
</mat-nav-list>
|
||||||
|
|
||||||
<mat-nav-list *ngIf="searching" style="max-height: 312px; overflow: auto" fusePerfectScrollbar>
|
<mat-nav-list *ngIf="searching" style="max-height: 312px; overflow: auto" fusePerfectScrollbar>
|
||||||
|
|
||||||
<mat-list-item *ngFor="let navigationItem of filteredNavigationItems"
|
<mat-list-item *ngFor="let navigationItem of filteredNavigationItems"
|
||||||
(click)="toggleShortcut($event, navigationItem)">
|
(click)="toggleShortcut($event, navigationItem)">
|
||||||
|
|
||||||
<div class="w-100-p" fxLayout="row" fxLayoutAlign="start center">
|
<div class="w-100-p" fxLayout="row" fxLayoutAlign="start center">
|
||||||
<mat-icon mat-list-icon class="mr-8" *ngIf="navigationItem.icon">{{navigationItem.icon}}</mat-icon>
|
|
||||||
|
<mat-icon mat-list-icon class="mr-8 secondary-text" *ngIf="navigationItem.icon">
|
||||||
|
{{navigationItem.icon}}
|
||||||
|
</mat-icon>
|
||||||
|
|
||||||
<span class="h2 w-32 h-32 p-4 mr-8 secondary-text text-bold" fxLayout="row"
|
<span class="h2 w-32 h-32 p-4 mr-8 secondary-text text-bold" fxLayout="row"
|
||||||
fxLayoutAlign="center center" *ngIf="!navigationItem.icon">
|
fxLayoutAlign="center center" *ngIf="!navigationItem.icon">
|
||||||
{{navigationItem.title.substr(0, 1).toUpperCase()}}
|
{{navigationItem.title.substr(0, 1).toUpperCase()}}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<p matLine fxFlex>{{navigationItem.title}}</p>
|
<p matLine fxFlex>{{navigationItem.title}}</p>
|
||||||
<mat-icon class="ml-8" *ngIf="isInShortcuts(navigationItem)">star</mat-icon>
|
|
||||||
|
<mat-icon class="ml-8 amber-fg" *ngIf="isInShortcuts(navigationItem)">star</mat-icon>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
</mat-nav-list>
|
</mat-nav-list>
|
||||||
|
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'src/app/core/scss/fuse';
|
@import 'src/@fuse/scss/fuse';
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
|
|
||||||
227
src/@fuse/components/shortcuts/shortcuts.component.ts
Normal file
227
src/@fuse/components/shortcuts/shortcuts.component.ts
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
import { Component, ElementRef, Input, OnDestroy, OnInit, Renderer2, ViewChild } from '@angular/core';
|
||||||
|
import { ObservableMedia } from '@angular/flex-layout';
|
||||||
|
import { CookieService } from 'ngx-cookie-service';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { FuseMatchMediaService } from '@fuse/services/match-media.service';
|
||||||
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-shortcuts',
|
||||||
|
templateUrl: './shortcuts.component.html',
|
||||||
|
styleUrls : ['./shortcuts.component.scss']
|
||||||
|
})
|
||||||
|
export class FuseShortcutsComponent implements OnInit, OnDestroy
|
||||||
|
{
|
||||||
|
shortcutItems: any[];
|
||||||
|
navigationItems: any[];
|
||||||
|
filteredNavigationItems: any[];
|
||||||
|
searching: boolean;
|
||||||
|
mobileShortcutsPanelActive: boolean;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
navigation: any;
|
||||||
|
|
||||||
|
@ViewChild('searchInput')
|
||||||
|
searchInputField;
|
||||||
|
|
||||||
|
@ViewChild('shortcuts')
|
||||||
|
shortcutsEl: ElementRef;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {Renderer2} _renderer
|
||||||
|
* @param {CookieService} _cookieService
|
||||||
|
* @param {FuseMatchMediaService} _fuseMatchMediaService
|
||||||
|
* @param {FuseNavigationService} _fuseNavigationService
|
||||||
|
* @param {ObservableMedia} _observableMedia
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _cookieService: CookieService,
|
||||||
|
private _fuseMatchMediaService: FuseMatchMediaService,
|
||||||
|
private _fuseNavigationService: FuseNavigationService,
|
||||||
|
private _observableMedia: ObservableMedia,
|
||||||
|
private _renderer: Renderer2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Set the defaults
|
||||||
|
this.shortcutItems = [];
|
||||||
|
this.searching = false;
|
||||||
|
this.mobileShortcutsPanelActive = false;
|
||||||
|
|
||||||
|
// Set the private defaults
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
// Get the navigation items and flatten them
|
||||||
|
this.filteredNavigationItems = this.navigationItems = this._fuseNavigationService.getFlatNavigation(this.navigation);
|
||||||
|
|
||||||
|
const cookieExists = this._cookieService.check('FUSE2.shortcuts');
|
||||||
|
|
||||||
|
if ( cookieExists )
|
||||||
|
{
|
||||||
|
this.shortcutItems = JSON.parse(this._cookieService.get('FUSE2.shortcuts'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// User's shortcut items
|
||||||
|
this.shortcutItems = [
|
||||||
|
{
|
||||||
|
'title': 'Calendar',
|
||||||
|
'type' : 'item',
|
||||||
|
'icon' : 'today',
|
||||||
|
'url' : '/apps/calendar'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': 'Mail',
|
||||||
|
'type' : 'item',
|
||||||
|
'icon' : 'email',
|
||||||
|
'url' : '/apps/mail'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': 'Contacts',
|
||||||
|
'type' : 'item',
|
||||||
|
'icon' : 'account_box',
|
||||||
|
'url' : '/apps/contacts'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': 'To-Do',
|
||||||
|
'type' : 'item',
|
||||||
|
'icon' : 'check_box',
|
||||||
|
'url' : '/apps/todo'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
this._fuseMatchMediaService.onMediaChange
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe(() => {
|
||||||
|
if ( this._observableMedia.isActive('gt-sm') )
|
||||||
|
{
|
||||||
|
this.hideMobileShortcutsPanel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
search(event): void
|
||||||
|
{
|
||||||
|
const value = event.target.value.toLowerCase();
|
||||||
|
|
||||||
|
if ( value === '' )
|
||||||
|
{
|
||||||
|
this.searching = false;
|
||||||
|
this.filteredNavigationItems = this.navigationItems;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.searching = true;
|
||||||
|
|
||||||
|
this.filteredNavigationItems = this.navigationItems.filter((navigationItem) => {
|
||||||
|
return navigationItem.title.toLowerCase().includes(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle shortcut
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* @param itemToToggle
|
||||||
|
*/
|
||||||
|
toggleShortcut(event, itemToToggle): void
|
||||||
|
{
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
for ( let i = 0; i < this.shortcutItems.length; i++ )
|
||||||
|
{
|
||||||
|
if ( this.shortcutItems[i].url === itemToToggle.url )
|
||||||
|
{
|
||||||
|
this.shortcutItems.splice(i, 1);
|
||||||
|
|
||||||
|
// Save to the cookies
|
||||||
|
this._cookieService.set('FUSE2.shortcuts', JSON.stringify(this.shortcutItems));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.shortcutItems.push(itemToToggle);
|
||||||
|
|
||||||
|
// Save to the cookies
|
||||||
|
this._cookieService.set('FUSE2.shortcuts', JSON.stringify(this.shortcutItems));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is in shortcuts?
|
||||||
|
*
|
||||||
|
* @param navigationItem
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
isInShortcuts(navigationItem): any
|
||||||
|
{
|
||||||
|
return this.shortcutItems.find(item => {
|
||||||
|
return item.url === navigationItem.url;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On menu open
|
||||||
|
*/
|
||||||
|
onMenuOpen(): void
|
||||||
|
{
|
||||||
|
setTimeout(() => {
|
||||||
|
this.searchInputField.nativeElement.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show mobile shortcuts
|
||||||
|
*/
|
||||||
|
showMobileShortcutsPanel(): void
|
||||||
|
{
|
||||||
|
this.mobileShortcutsPanelActive = true;
|
||||||
|
this._renderer.addClass(this.shortcutsEl.nativeElement, 'show-mobile-panel');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide mobile shortcuts
|
||||||
|
*/
|
||||||
|
hideMobileShortcutsPanel(): void
|
||||||
|
{
|
||||||
|
this.mobileShortcutsPanelActive = false;
|
||||||
|
this._renderer.removeClass(this.shortcutsEl.nativeElement, 'show-mobile-panel');
|
||||||
|
}
|
||||||
|
}
|
||||||
38
src/@fuse/components/shortcuts/shortcuts.module.ts
Normal file
38
src/@fuse/components/shortcuts/shortcuts.module.ts
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||||
|
import { MatButtonModule, MatDividerModule, MatFormFieldModule, MatIconModule, MatInputModule, MatListModule, MatMenuModule, MatTooltipModule } from '@angular/material';
|
||||||
|
import { CookieService } from 'ngx-cookie-service';
|
||||||
|
|
||||||
|
import { FuseShortcutsComponent } from './shortcuts.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseShortcutsComponent
|
||||||
|
],
|
||||||
|
imports : [
|
||||||
|
CommonModule,
|
||||||
|
RouterModule,
|
||||||
|
|
||||||
|
FlexLayoutModule,
|
||||||
|
|
||||||
|
MatButtonModule,
|
||||||
|
MatDividerModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatMenuModule,
|
||||||
|
MatListModule,
|
||||||
|
MatTooltipModule
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseShortcutsComponent
|
||||||
|
],
|
||||||
|
providers : [
|
||||||
|
CookieService
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseShortcutsModule
|
||||||
|
{
|
||||||
|
}
|
||||||
1
src/@fuse/components/sidebar/sidebar.component.html
Normal file
1
src/@fuse/components/sidebar/sidebar.component.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<ng-content></ng-content>
|
||||||
68
src/@fuse/components/sidebar/sidebar.component.scss
Normal file
68
src/@fuse/components/sidebar/sidebar.component.scss
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
fuse-sidebar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1 0 auto;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
width: 280px;
|
||||||
|
min-width: 280px;
|
||||||
|
max-width: 280px;
|
||||||
|
z-index: 1000;
|
||||||
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.35);
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
&.left-positioned {
|
||||||
|
left: 0;
|
||||||
|
transform: translateX(-100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.right-positioned {
|
||||||
|
right: 0;
|
||||||
|
transform: translateX(100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.open {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.locked-open {
|
||||||
|
position: relative !important;
|
||||||
|
transform: translateX(0) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.folded {
|
||||||
|
position: absolute !important;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
|
||||||
|
&:not(.unfolded) {
|
||||||
|
width: 64px;
|
||||||
|
min-width: 64px;
|
||||||
|
max-width: 64px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.animations-enabled {
|
||||||
|
transition-property: transform, width, min-width, max-width;
|
||||||
|
transition-duration: 150ms;
|
||||||
|
transition-timing-function: ease-in-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fuse-sidebar-overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 999;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
opacity: 0;
|
||||||
|
|
||||||
|
&.fuse-sidebar-overlay-invisible {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
706
src/@fuse/components/sidebar/sidebar.component.ts
Normal file
706
src/@fuse/components/sidebar/sidebar.component.ts
Normal file
@@ -0,0 +1,706 @@
|
|||||||
|
import { ChangeDetectorRef, Component, ElementRef, HostBinding, HostListener, Input, OnDestroy, OnInit, Renderer2, RendererStyleFlags2, ViewEncapsulation } from '@angular/core';
|
||||||
|
import { animate, AnimationBuilder, AnimationPlayer, style } from '@angular/animations';
|
||||||
|
import { ObservableMedia } from '@angular/flex-layout';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/internal/operators';
|
||||||
|
|
||||||
|
import { FuseSidebarService } from './sidebar.service';
|
||||||
|
import { FuseMatchMediaService } from '@fuse/services/match-media.service';
|
||||||
|
import { FuseConfigService } from '@fuse/services/config.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-sidebar',
|
||||||
|
templateUrl : './sidebar.component.html',
|
||||||
|
styleUrls : ['./sidebar.component.scss'],
|
||||||
|
encapsulation: ViewEncapsulation.None
|
||||||
|
})
|
||||||
|
export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
|
{
|
||||||
|
// Name
|
||||||
|
@Input()
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
// Key
|
||||||
|
@Input()
|
||||||
|
key: string;
|
||||||
|
|
||||||
|
// Position
|
||||||
|
@Input()
|
||||||
|
position: 'left' | 'right';
|
||||||
|
|
||||||
|
// Open
|
||||||
|
@HostBinding('class.open')
|
||||||
|
opened: boolean;
|
||||||
|
|
||||||
|
// Locked Open
|
||||||
|
@Input()
|
||||||
|
lockedOpen: string;
|
||||||
|
|
||||||
|
// isLockedOpen
|
||||||
|
@HostBinding('class.locked-open')
|
||||||
|
isLockedOpen: boolean;
|
||||||
|
|
||||||
|
// Folded unfolded
|
||||||
|
@HostBinding('class.unfolded')
|
||||||
|
unfolded: boolean;
|
||||||
|
|
||||||
|
// Invisible overlay
|
||||||
|
@Input()
|
||||||
|
invisibleOverlay: boolean;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _folded: boolean;
|
||||||
|
private _fuseConfig: any;
|
||||||
|
private _wasActive: boolean;
|
||||||
|
private _wasFolded: boolean;
|
||||||
|
private _backdrop: HTMLElement | null = null;
|
||||||
|
private _player: AnimationPlayer;
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
@HostBinding('class.animations-enabled')
|
||||||
|
private _animationsEnabled: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {AnimationBuilder} _animationBuilder
|
||||||
|
* @param {ChangeDetectorRef} _changeDetectorRef
|
||||||
|
* @param {ElementRef} _elementRef
|
||||||
|
* @param {FuseConfigService} _fuseConfigService
|
||||||
|
* @param {FuseMatchMediaService} _fuseMatchMediaService
|
||||||
|
* @param {FuseSidebarService} _fuseSidebarService
|
||||||
|
* @param {ObservableMedia} _observableMedia
|
||||||
|
* @param {Renderer2} _renderer
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _animationBuilder: AnimationBuilder,
|
||||||
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
|
private _elementRef: ElementRef,
|
||||||
|
private _fuseConfigService: FuseConfigService,
|
||||||
|
private _fuseMatchMediaService: FuseMatchMediaService,
|
||||||
|
private _fuseSidebarService: FuseSidebarService,
|
||||||
|
private _observableMedia: ObservableMedia,
|
||||||
|
private _renderer: Renderer2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Set the defaults
|
||||||
|
this.opened = false;
|
||||||
|
// this.folded = false;
|
||||||
|
this.position = 'left';
|
||||||
|
this.invisibleOverlay = false;
|
||||||
|
|
||||||
|
// Set the private defaults
|
||||||
|
this._animationsEnabled = false;
|
||||||
|
this._folded = false;
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Accessors
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Folded
|
||||||
|
@Input()
|
||||||
|
set folded(value: boolean)
|
||||||
|
{
|
||||||
|
// Set the folded
|
||||||
|
this._folded = value;
|
||||||
|
|
||||||
|
// Return if the sidebar is closed
|
||||||
|
if ( !this.opened )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Programmatically add/remove margin to the element
|
||||||
|
// that comes after or before based on the position
|
||||||
|
let sibling,
|
||||||
|
styleRule;
|
||||||
|
|
||||||
|
const styleValue = '64px';
|
||||||
|
|
||||||
|
// Get the sibling and set the style rule
|
||||||
|
if ( this.position === 'left' )
|
||||||
|
{
|
||||||
|
sibling = this._elementRef.nativeElement.nextElementSibling;
|
||||||
|
styleRule = 'margin-left';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sibling = this._elementRef.nativeElement.previousElementSibling;
|
||||||
|
styleRule = 'margin-right';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is no sibling, return...
|
||||||
|
if ( !sibling )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If folded...
|
||||||
|
if ( value )
|
||||||
|
{
|
||||||
|
// Fold the sidebar
|
||||||
|
this.fold();
|
||||||
|
|
||||||
|
// Set the style and class
|
||||||
|
this._renderer.setStyle(sibling, styleRule, styleValue, RendererStyleFlags2.Important + RendererStyleFlags2.DashCase);
|
||||||
|
this._renderer.addClass(this._elementRef.nativeElement, 'folded');
|
||||||
|
}
|
||||||
|
// If unfolded...
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Unfold the sidebar
|
||||||
|
this.unfold();
|
||||||
|
|
||||||
|
// Remove the style and class
|
||||||
|
this._renderer.removeStyle(sibling, styleRule);
|
||||||
|
this._renderer.removeClass(this._elementRef.nativeElement, 'folded');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get folded(): boolean
|
||||||
|
{
|
||||||
|
return this._folded;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
// Subscribe to config changes
|
||||||
|
this._fuseConfigService.config
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe((config) => {
|
||||||
|
this._fuseConfig = config;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Register the sidebar
|
||||||
|
this._fuseSidebarService.register(this.name, this);
|
||||||
|
|
||||||
|
// Setup visibility
|
||||||
|
this._setupVisibility();
|
||||||
|
|
||||||
|
// Setup position
|
||||||
|
this._setupPosition();
|
||||||
|
|
||||||
|
// Setup lockedOpen
|
||||||
|
this._setupLockedOpen();
|
||||||
|
|
||||||
|
// Setup folded
|
||||||
|
this._setupFolded();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// If the sidebar is folded, unfold it to revert modifications
|
||||||
|
if ( this.folded )
|
||||||
|
{
|
||||||
|
this.unfold();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unregister the sidebar
|
||||||
|
this._fuseSidebarService.unregister(this.name);
|
||||||
|
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Private methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup the visibility of the sidebar
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _setupVisibility(): void
|
||||||
|
{
|
||||||
|
// Remove the existing box-shadow
|
||||||
|
this._renderer.setStyle(this._elementRef.nativeElement, 'box-shadow', 'none');
|
||||||
|
|
||||||
|
// Make the sidebar invisible
|
||||||
|
this._renderer.setStyle(this._elementRef.nativeElement, 'visibility', 'hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup the sidebar position
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _setupPosition(): void
|
||||||
|
{
|
||||||
|
// Add the correct class name to the sidebar
|
||||||
|
// element depending on the position attribute
|
||||||
|
if ( this.position === 'right' )
|
||||||
|
{
|
||||||
|
this._renderer.addClass(this._elementRef.nativeElement, 'right-positioned');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this._renderer.addClass(this._elementRef.nativeElement, 'left-positioned');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup the lockedOpen handler
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _setupLockedOpen(): void
|
||||||
|
{
|
||||||
|
// Return if the lockedOpen wasn't set
|
||||||
|
if ( !this.lockedOpen )
|
||||||
|
{
|
||||||
|
// Return
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the wasActive for the first time
|
||||||
|
this._wasActive = false;
|
||||||
|
|
||||||
|
// Set the wasFolded
|
||||||
|
this._wasFolded = this.folded;
|
||||||
|
|
||||||
|
// Show the sidebar
|
||||||
|
this._showSidebar();
|
||||||
|
|
||||||
|
// Act on every media change
|
||||||
|
this._fuseMatchMediaService.onMediaChange
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe(() => {
|
||||||
|
|
||||||
|
// Get the active status
|
||||||
|
const isActive = this._observableMedia.isActive(this.lockedOpen);
|
||||||
|
|
||||||
|
// If the both status are the same, don't act
|
||||||
|
if ( this._wasActive === isActive )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Activate the lockedOpen
|
||||||
|
if ( isActive )
|
||||||
|
{
|
||||||
|
// Set the lockedOpen status
|
||||||
|
this.isLockedOpen = true;
|
||||||
|
|
||||||
|
// Show the sidebar
|
||||||
|
this._showSidebar();
|
||||||
|
|
||||||
|
// Force the the opened status to true
|
||||||
|
this.opened = true;
|
||||||
|
|
||||||
|
// If the sidebar was folded, forcefully fold it again
|
||||||
|
if ( this._wasFolded )
|
||||||
|
{
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Fold
|
||||||
|
this.folded = true;
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide the backdrop if any exists
|
||||||
|
this._hideBackdrop();
|
||||||
|
}
|
||||||
|
// De-Activate the lockedOpen
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Set the lockedOpen status
|
||||||
|
this.isLockedOpen = false;
|
||||||
|
|
||||||
|
// Unfold the sidebar in case if it was folded
|
||||||
|
this.unfold();
|
||||||
|
|
||||||
|
// Force the the opened status to close
|
||||||
|
this.opened = false;
|
||||||
|
|
||||||
|
// Hide the sidebar
|
||||||
|
this._hideSidebar();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the new active status
|
||||||
|
this._wasActive = isActive;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup the initial folded status
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _setupFolded(): void
|
||||||
|
{
|
||||||
|
// Return, if sidebar is not folded
|
||||||
|
if ( !this.folded )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return if the sidebar is closed
|
||||||
|
if ( !this.opened )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Programmatically add/remove margin to the element
|
||||||
|
// that comes after or before based on the position
|
||||||
|
let sibling,
|
||||||
|
styleRule;
|
||||||
|
|
||||||
|
const styleValue = '64px';
|
||||||
|
|
||||||
|
// Get the sibling and set the style rule
|
||||||
|
if ( this.position === 'left' )
|
||||||
|
{
|
||||||
|
sibling = this._elementRef.nativeElement.nextElementSibling;
|
||||||
|
styleRule = 'margin-left';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sibling = this._elementRef.nativeElement.previousElementSibling;
|
||||||
|
styleRule = 'margin-right';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is no sibling, return...
|
||||||
|
if ( !sibling )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fold the sidebar
|
||||||
|
this.fold();
|
||||||
|
|
||||||
|
// Set the style and class
|
||||||
|
this._renderer.setStyle(sibling, styleRule, styleValue, RendererStyleFlags2.Important + RendererStyleFlags2.DashCase);
|
||||||
|
this._renderer.addClass(this._elementRef.nativeElement, 'folded');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the backdrop
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _showBackdrop(): void
|
||||||
|
{
|
||||||
|
// Create the backdrop element
|
||||||
|
this._backdrop = this._renderer.createElement('div');
|
||||||
|
|
||||||
|
// Add a class to the backdrop element
|
||||||
|
this._backdrop.classList.add('fuse-sidebar-overlay');
|
||||||
|
|
||||||
|
// Add a class depending on the invisibleOverlay option
|
||||||
|
if ( this.invisibleOverlay )
|
||||||
|
{
|
||||||
|
this._backdrop.classList.add('fuse-sidebar-overlay-invisible');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the backdrop to the parent of the sidebar
|
||||||
|
this._renderer.appendChild(this._elementRef.nativeElement.parentElement, this._backdrop);
|
||||||
|
|
||||||
|
// Create the enter animation and attach it to the player
|
||||||
|
this._player =
|
||||||
|
this._animationBuilder
|
||||||
|
.build([
|
||||||
|
animate('300ms ease', style({opacity: 1}))
|
||||||
|
]).create(this._backdrop);
|
||||||
|
|
||||||
|
// Play the animation
|
||||||
|
this._player.play();
|
||||||
|
|
||||||
|
// Add an event listener to the overlay
|
||||||
|
this._backdrop.addEventListener('click', () => {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide the backdrop
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _hideBackdrop(): void
|
||||||
|
{
|
||||||
|
if ( !this._backdrop )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the leave animation and attach it to the player
|
||||||
|
this._player =
|
||||||
|
this._animationBuilder
|
||||||
|
.build([
|
||||||
|
animate('300ms ease', style({opacity: 0}))
|
||||||
|
]).create(this._backdrop);
|
||||||
|
|
||||||
|
// Play the animation
|
||||||
|
this._player.play();
|
||||||
|
|
||||||
|
// Once the animation is done...
|
||||||
|
this._player.onDone(() => {
|
||||||
|
|
||||||
|
// If the backdrop still exists...
|
||||||
|
if ( this._backdrop )
|
||||||
|
{
|
||||||
|
// Remove the backdrop
|
||||||
|
this._backdrop.parentNode.removeChild(this._backdrop);
|
||||||
|
this._backdrop = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change some properties of the sidebar
|
||||||
|
* and make it visible
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _showSidebar(): void
|
||||||
|
{
|
||||||
|
// Remove the box-shadow style
|
||||||
|
this._renderer.removeStyle(this._elementRef.nativeElement, 'box-shadow');
|
||||||
|
|
||||||
|
// Make the sidebar invisible
|
||||||
|
this._renderer.removeStyle(this._elementRef.nativeElement, 'visibility');
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change some properties of the sidebar
|
||||||
|
* and make it invisible
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _hideSidebar(delay = true): void
|
||||||
|
{
|
||||||
|
const delayAmount = delay ? 300 : 0;
|
||||||
|
|
||||||
|
// Add a delay so close animation can play
|
||||||
|
setTimeout(() => {
|
||||||
|
|
||||||
|
// Remove the box-shadow
|
||||||
|
this._renderer.setStyle(this._elementRef.nativeElement, 'box-shadow', 'none');
|
||||||
|
|
||||||
|
// Make the sidebar invisible
|
||||||
|
this._renderer.setStyle(this._elementRef.nativeElement, 'visibility', 'hidden');
|
||||||
|
}, delayAmount);
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the animations
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _enableAnimations(): void
|
||||||
|
{
|
||||||
|
// Return if animations already enabled
|
||||||
|
if ( this._animationsEnabled )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._animationsEnabled = true;
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the sidebar
|
||||||
|
*/
|
||||||
|
open(): void
|
||||||
|
{
|
||||||
|
if ( this.opened || this.isLockedOpen )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Show the sidebar
|
||||||
|
this._showSidebar();
|
||||||
|
|
||||||
|
// Show the backdrop
|
||||||
|
this._showBackdrop();
|
||||||
|
|
||||||
|
// Set the opened status
|
||||||
|
this.opened = true;
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the sidebar
|
||||||
|
*/
|
||||||
|
close(): void
|
||||||
|
{
|
||||||
|
if ( !this.opened || this.isLockedOpen )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Hide the backdrop
|
||||||
|
this._hideBackdrop();
|
||||||
|
|
||||||
|
// Set the opened status
|
||||||
|
this.opened = false;
|
||||||
|
|
||||||
|
// Hide the sidebar
|
||||||
|
this._hideSidebar();
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle open/close the sidebar
|
||||||
|
*/
|
||||||
|
toggleOpen(): void
|
||||||
|
{
|
||||||
|
if ( this.opened )
|
||||||
|
{
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mouseenter
|
||||||
|
*/
|
||||||
|
@HostListener('mouseenter')
|
||||||
|
onMouseEnter(): void
|
||||||
|
{
|
||||||
|
// Only work if the sidebar is folded
|
||||||
|
if ( !this.folded )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Unfold the sidebar temporarily
|
||||||
|
this.unfolded = true;
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mouseleave
|
||||||
|
*/
|
||||||
|
@HostListener('mouseleave')
|
||||||
|
onMouseLeave(): void
|
||||||
|
{
|
||||||
|
// Only work if the sidebar is folded
|
||||||
|
if ( !this.folded )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Fold the sidebar back
|
||||||
|
this.unfolded = false;
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fold the sidebar permanently
|
||||||
|
*/
|
||||||
|
fold(): void
|
||||||
|
{
|
||||||
|
// Only work if the sidebar is not folded
|
||||||
|
if ( this.folded )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Fold
|
||||||
|
this.folded = true;
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unfold the sidebar permanently
|
||||||
|
*/
|
||||||
|
unfold(): void
|
||||||
|
{
|
||||||
|
// Only work if the sidebar is folded
|
||||||
|
if ( !this.folded )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Unfold
|
||||||
|
this.folded = false;
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the sidebar fold/unfold permanently
|
||||||
|
*/
|
||||||
|
toggleFold(): void
|
||||||
|
{
|
||||||
|
if ( this.folded )
|
||||||
|
{
|
||||||
|
this.unfold();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.fold();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/@fuse/components/sidebar/sidebar.module.ts
Normal file
15
src/@fuse/components/sidebar/sidebar.module.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { FuseSidebarComponent } from './sidebar.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseSidebarComponent
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseSidebarComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseSidebarModule
|
||||||
|
{
|
||||||
|
}
|
||||||
75
src/@fuse/components/sidebar/sidebar.service.ts
Normal file
75
src/@fuse/components/sidebar/sidebar.service.ts
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
import { FuseSidebarComponent } from './sidebar.component';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class FuseSidebarService
|
||||||
|
{
|
||||||
|
// Private
|
||||||
|
private _registry: { [key: string]: FuseSidebarComponent } = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the sidebar to the registry
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @param sidebar
|
||||||
|
*/
|
||||||
|
register(key, sidebar): void
|
||||||
|
{
|
||||||
|
// Check if the key already being used
|
||||||
|
if ( this._registry[key] )
|
||||||
|
{
|
||||||
|
console.error(`The sidebar with the key '${key}' already exists. Either unregister it first or use a unique key.`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to the registry
|
||||||
|
this._registry[key] = sidebar;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the sidebar from the registry
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
unregister(key): void
|
||||||
|
{
|
||||||
|
// Check if the sidebar exists
|
||||||
|
if ( !this._registry[key] )
|
||||||
|
{
|
||||||
|
console.warn(`The sidebar with the key '${key}' doesn't exist in the registry.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unregister the sidebar
|
||||||
|
delete this._registry[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the sidebar with the given key
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @returns {FuseSidebarComponent}
|
||||||
|
*/
|
||||||
|
getSidebar(key): FuseSidebarComponent
|
||||||
|
{
|
||||||
|
// Check if the sidebar exists
|
||||||
|
if ( !this._registry[key] )
|
||||||
|
{
|
||||||
|
console.warn(`The sidebar with the key '${key}' doesn't exist in the registry.`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the sidebar
|
||||||
|
return this._registry[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
372
src/@fuse/components/theme-options/theme-options.component.html
Normal file
372
src/@fuse/components/theme-options/theme-options.component.html
Normal file
@@ -0,0 +1,372 @@
|
|||||||
|
<div class="theme-options-panel" fusePerfectScrollbar>
|
||||||
|
|
||||||
|
<div class="header">
|
||||||
|
|
||||||
|
<span class="title">Theme Options</span>
|
||||||
|
|
||||||
|
<button mat-icon-button class="close-button" (click)="toggleSidebarOpen('themeOptionsPanel')">
|
||||||
|
<mat-icon>close</mat-icon>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form [formGroup]="form">
|
||||||
|
|
||||||
|
<!-- LAYOUT STYLES -->
|
||||||
|
<div class="group" formGroupName="layout">
|
||||||
|
|
||||||
|
<h2>Layout Styles</h2>
|
||||||
|
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="style">
|
||||||
|
|
||||||
|
<mat-radio-button class="mb-12" value="vertical-layout-1">
|
||||||
|
Vertical Layout #1
|
||||||
|
</mat-radio-button>
|
||||||
|
|
||||||
|
<mat-radio-button class="mb-12" value="vertical-layout-2">
|
||||||
|
Vertical Layout #2
|
||||||
|
</mat-radio-button>
|
||||||
|
|
||||||
|
<mat-radio-button class="mb-12" value="vertical-layout-3">
|
||||||
|
Vertical Layout #3
|
||||||
|
</mat-radio-button>
|
||||||
|
|
||||||
|
<mat-radio-button class="mb-12" value="horizontal-layout-1">
|
||||||
|
Horizontal Layout #1
|
||||||
|
</mat-radio-button>
|
||||||
|
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
<!-- DIFFERENT FORMS BASED ON LAYOUT STYLES -->
|
||||||
|
<ng-container [ngSwitch]="fuseConfig.layout.style">
|
||||||
|
|
||||||
|
<!-- VERTICAL LAYOUT #1 -->
|
||||||
|
<ng-container *ngSwitchCase="'vertical-layout-1'">
|
||||||
|
|
||||||
|
<!-- LAYOUT WIDTH -->
|
||||||
|
<div class="group mt-32">
|
||||||
|
|
||||||
|
<h2>Layout Width</h2>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="width">
|
||||||
|
<mat-radio-button class="mb-12" value="fullwidth">Fullwidth</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="boxed">Boxed</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- NAVBAR -->
|
||||||
|
<div class="group" formGroupName="navbar">
|
||||||
|
|
||||||
|
<h2>Navbar</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<mat-slide-toggle class="mt-24" formControlName="folded">
|
||||||
|
Folded
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-16" value="left">Left</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-16" value="right">Right</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TOOLBAR -->
|
||||||
|
<div class="group" formGroupName="toolbar">
|
||||||
|
|
||||||
|
<h2>Toolbar</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-12" value="above">Above</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="below-static">Below Static</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="below-fixed">Below Fixed</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- FOOTER -->
|
||||||
|
<div class="group" formGroupName="footer">
|
||||||
|
|
||||||
|
<h2>Footer</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-12" value="above">Above</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="below-static">Below Static</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="below-fixed">Below Fixed</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- VERTICAL LAYOUT #2 -->
|
||||||
|
<ng-container *ngSwitchCase="'vertical-layout-2'">
|
||||||
|
|
||||||
|
<!-- LAYOUT WIDTH -->
|
||||||
|
<div class="group mt-32">
|
||||||
|
|
||||||
|
<h2>Layout Width</h2>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="width">
|
||||||
|
<mat-radio-button class="mb-12" value="fullwidth">Fullwidth</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="boxed">Boxed</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- NAVBAR -->
|
||||||
|
<div class="group" formGroupName="navbar">
|
||||||
|
|
||||||
|
<h2>Navbar</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<mat-slide-toggle class="mt-24" formControlName="folded">
|
||||||
|
Folded
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-16" value="left">Left</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-16" value="right">Right</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TOOLBAR -->
|
||||||
|
<div class="group" formGroupName="toolbar">
|
||||||
|
|
||||||
|
<h2>Toolbar</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-12" value="above-static">Above Static</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="above-fixed">Above Fixed</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="below">Below</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- FOOTER -->
|
||||||
|
<div class="group" formGroupName="footer">
|
||||||
|
|
||||||
|
<h2>Footer</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-12" value="above-static">Above Static</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="above-fixed">Above Fixed</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="below">Below</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- VERTICAL LAYOUT #3 -->
|
||||||
|
<ng-container *ngSwitchCase="'vertical-layout-3'">
|
||||||
|
|
||||||
|
<!-- LAYOUT WIDTH -->
|
||||||
|
<div class="group mt-32">
|
||||||
|
|
||||||
|
<h2>Layout Width</h2>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="width">
|
||||||
|
<mat-radio-button class="mb-12" value="fullwidth">Fullwidth</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="boxed">Boxed</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- NAVBAR -->
|
||||||
|
<div class="group" formGroupName="navbar">
|
||||||
|
|
||||||
|
<h2>Navbar</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<mat-slide-toggle class="mt-24" formControlName="folded">
|
||||||
|
Folded
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-16" value="left">Left</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-16" value="right">Right</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TOOLBAR -->
|
||||||
|
<div class="group" formGroupName="toolbar">
|
||||||
|
|
||||||
|
<h2>Toolbar</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-12" value="above-static">Above Static</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="above-fixed">Above Fixed</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- FOOTER -->
|
||||||
|
<div class="group" formGroupName="footer">
|
||||||
|
|
||||||
|
<h2>Footer</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-12" value="above-static">Above Static</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="above-fixed">Above Fixed</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- HORIZONTAL LAYOUT #1 -->
|
||||||
|
<ng-container *ngSwitchCase="'horizontal-layout-1'">
|
||||||
|
|
||||||
|
<!-- LAYOUT WIDTH -->
|
||||||
|
<div class="group mt-32">
|
||||||
|
|
||||||
|
<h2>Layout Width</h2>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="width">
|
||||||
|
<mat-radio-button class="mb-12" value="fullwidth">Fullwidth</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="boxed">Boxed</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- NAVBAR -->
|
||||||
|
<div class="group" formGroupName="navbar">
|
||||||
|
|
||||||
|
<h2>Navbar</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-16" value="top">Top</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TOOLBAR -->
|
||||||
|
<div class="group" formGroupName="toolbar">
|
||||||
|
|
||||||
|
<h2>Toolbar</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-12" value="above">Above</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="below">Below</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- FOOTER -->
|
||||||
|
<div class="group" formGroupName="footer">
|
||||||
|
|
||||||
|
<h2>Footer</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle formControlName="hidden">
|
||||||
|
Hide
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
<h3 class="mt-24">Position:</h3>
|
||||||
|
<mat-radio-group fxLayout="column" fxLayoutAlign="start start" formControlName="position">
|
||||||
|
<mat-radio-button class="mb-12" value="above-fixed">Above Fixed</mat-radio-button>
|
||||||
|
<mat-radio-button class="mb-12" value="above-static">Above Static</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- CUSTOM SCROLLBARS -->
|
||||||
|
<div class="group">
|
||||||
|
|
||||||
|
<h2>Custom scrollbars</h2>
|
||||||
|
|
||||||
|
<mat-slide-toggle class="mb-12" formControlName="customScrollbars">
|
||||||
|
Enable custom scrollbars
|
||||||
|
</mat-slide-toggle>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- COLORS -->
|
||||||
|
<div class="group">
|
||||||
|
|
||||||
|
<h2>Colors</h2>
|
||||||
|
|
||||||
|
<div class="colors">
|
||||||
|
|
||||||
|
<div fxFlex fxLayout="row" fxLayoutAlign="space-between center">
|
||||||
|
<h4 class="mr-8">Toolbar Color</h4>
|
||||||
|
<fuse-material-color-picker
|
||||||
|
[(selectedClass)]="fuseConfig.layout.toolbar.background"></fuse-material-color-picker>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex fxLayout="row" fxLayoutAlign="space-between center">
|
||||||
|
<h4 class="mr-8">Navbar Color</h4>
|
||||||
|
<fuse-material-color-picker
|
||||||
|
[(selectedClass)]="fuseConfig.layout.navbar.background"></fuse-material-color-picker>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex fxLayout="row" fxLayoutAlign="space-between center">
|
||||||
|
<h4 class="mr-8">Footer Color</h4>
|
||||||
|
<fuse-material-color-picker
|
||||||
|
[(selectedClass)]="fuseConfig.layout.footer.background"></fuse-material-color-picker>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
@import "src/@fuse/scss/fuse";
|
||||||
|
|
||||||
|
@keyframes rotating {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:host {
|
||||||
|
display: flex;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.theme-options-panel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1 0 auto;
|
||||||
|
padding: 40px 24px 24px 24px;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
flex: 0 1 auto;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 500;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.group {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 0 auto;
|
||||||
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.12);
|
||||||
|
border-radius: 2px;
|
||||||
|
padding: 28px 16px 8px 16px;
|
||||||
|
margin: 16px 0;
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
position: absolute;
|
||||||
|
top: -11px;
|
||||||
|
left: 8px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
background: white;
|
||||||
|
color: rgba(0, 0, 0, 0.54);
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: rgba(0, 0, 0, 0.54);
|
||||||
|
margin: 24px 0 16px 0;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
&:first-of-type {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.colors {
|
||||||
|
display: block !important;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
298
src/@fuse/components/theme-options/theme-options.component.ts
Normal file
298
src/@fuse/components/theme-options/theme-options.component.ts
Normal file
@@ -0,0 +1,298 @@
|
|||||||
|
import { Component, HostBinding, OnDestroy, OnInit, Renderer2 } from '@angular/core';
|
||||||
|
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { fuseAnimations } from '@fuse/animations';
|
||||||
|
import { FuseConfigService } from '@fuse/services/config.service';
|
||||||
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
|
import { FuseSidebarService } from '@fuse/components/sidebar/sidebar.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-theme-options',
|
||||||
|
templateUrl: './theme-options.component.html',
|
||||||
|
styleUrls : ['./theme-options.component.scss'],
|
||||||
|
animations : fuseAnimations
|
||||||
|
})
|
||||||
|
export class FuseThemeOptionsComponent implements OnInit, OnDestroy
|
||||||
|
{
|
||||||
|
fuseConfig: any;
|
||||||
|
form: FormGroup;
|
||||||
|
|
||||||
|
@HostBinding('class.bar-closed')
|
||||||
|
barClosed: boolean;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {FormBuilder} _formBuilder
|
||||||
|
* @param {FuseConfigService} _fuseConfigService
|
||||||
|
* @param {FuseNavigationService} _fuseNavigationService
|
||||||
|
* @param {FuseSidebarService} _fuseSidebarService
|
||||||
|
* @param {Renderer2} _renderer
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _formBuilder: FormBuilder,
|
||||||
|
private _fuseConfigService: FuseConfigService,
|
||||||
|
private _fuseNavigationService: FuseNavigationService,
|
||||||
|
private _fuseSidebarService: FuseSidebarService,
|
||||||
|
private _renderer: Renderer2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Set the defaults
|
||||||
|
this.barClosed = true;
|
||||||
|
|
||||||
|
// Set the private defaults
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
// Build the config form
|
||||||
|
// noinspection TypeScriptValidateTypes
|
||||||
|
this.form = this._formBuilder.group({
|
||||||
|
layout : this._formBuilder.group({
|
||||||
|
style : new FormControl(),
|
||||||
|
width : new FormControl(),
|
||||||
|
navbar : this._formBuilder.group({
|
||||||
|
hidden : new FormControl(),
|
||||||
|
position : new FormControl(),
|
||||||
|
folded : new FormControl(),
|
||||||
|
background: new FormControl()
|
||||||
|
}),
|
||||||
|
toolbar: this._formBuilder.group({
|
||||||
|
hidden : new FormControl(),
|
||||||
|
position : new FormControl(),
|
||||||
|
background: new FormControl()
|
||||||
|
}),
|
||||||
|
footer : this._formBuilder.group({
|
||||||
|
hidden : new FormControl(),
|
||||||
|
position : new FormControl(),
|
||||||
|
background: new FormControl()
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
customScrollbars: new FormControl()
|
||||||
|
});
|
||||||
|
|
||||||
|
// Subscribe to the config changes
|
||||||
|
this._fuseConfigService.config
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe((config) => {
|
||||||
|
|
||||||
|
// Update the stored config
|
||||||
|
this.fuseConfig = config;
|
||||||
|
|
||||||
|
// Set the config form values without emitting an event
|
||||||
|
// so that we don't end up with an infinite loop
|
||||||
|
this.form.setValue(config, {emitEvent: false});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Subscribe to the specific form value changes (layout.style)
|
||||||
|
this.form.get('layout.style').valueChanges
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe((value) => {
|
||||||
|
|
||||||
|
// Reset the form values based on the
|
||||||
|
// selected layout style
|
||||||
|
this._resetFormValues(value);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Subscribe to the form value changes
|
||||||
|
this.form.valueChanges
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe((config) => {
|
||||||
|
|
||||||
|
// Update the config
|
||||||
|
this._fuseConfigService.config = config;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add customize nav item that opens the bar programmatically
|
||||||
|
const customFunctionNavItem = {
|
||||||
|
'id' : 'custom-function',
|
||||||
|
'title' : 'Custom Function',
|
||||||
|
'type' : 'group',
|
||||||
|
'icon' : 'settings',
|
||||||
|
'children': [
|
||||||
|
{
|
||||||
|
'id' : 'customize',
|
||||||
|
'title' : 'Customize',
|
||||||
|
'type' : 'item',
|
||||||
|
'icon' : 'settings',
|
||||||
|
'function': () => {
|
||||||
|
this.toggleSidebarOpen('themeOptionsPanel');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this._fuseNavigationService.addNavigationItem(customFunctionNavItem, 'end');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
|
||||||
|
// Remove the custom function menu
|
||||||
|
this._fuseNavigationService.removeNavigationItem('custom-function');
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Private methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the form values based on the
|
||||||
|
* selected layout style
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _resetFormValues(value): void
|
||||||
|
{
|
||||||
|
switch ( value )
|
||||||
|
{
|
||||||
|
// Vertical Layout #1
|
||||||
|
case 'vertical-layout-1':
|
||||||
|
{
|
||||||
|
this.form.patchValue({
|
||||||
|
layout: {
|
||||||
|
width : 'fullwidth',
|
||||||
|
navbar : {
|
||||||
|
hidden : false,
|
||||||
|
position : 'left',
|
||||||
|
folded : false,
|
||||||
|
background: 'mat-fuse-dark-700-bg'
|
||||||
|
},
|
||||||
|
toolbar: {
|
||||||
|
hidden : false,
|
||||||
|
position : 'below-static',
|
||||||
|
background: 'mat-white-500-bg'
|
||||||
|
},
|
||||||
|
footer : {
|
||||||
|
hidden : false,
|
||||||
|
position : 'below-static',
|
||||||
|
background: 'mat-fuse-dark-900-bg'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vertical Layout #2
|
||||||
|
case 'vertical-layout-2':
|
||||||
|
{
|
||||||
|
this.form.patchValue({
|
||||||
|
layout: {
|
||||||
|
width : 'fullwidth',
|
||||||
|
navbar : {
|
||||||
|
hidden : false,
|
||||||
|
position : 'left',
|
||||||
|
folded : false,
|
||||||
|
background: 'mat-fuse-dark-700-bg'
|
||||||
|
},
|
||||||
|
toolbar: {
|
||||||
|
hidden : false,
|
||||||
|
position : 'below',
|
||||||
|
background: 'mat-white-500-bg'
|
||||||
|
},
|
||||||
|
footer : {
|
||||||
|
hidden : false,
|
||||||
|
position : 'below',
|
||||||
|
background: 'mat-fuse-dark-900-bg'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vertical Layout #3
|
||||||
|
case 'vertical-layout-3':
|
||||||
|
{
|
||||||
|
this.form.patchValue({
|
||||||
|
layout: {
|
||||||
|
width : 'fullwidth',
|
||||||
|
navbar : {
|
||||||
|
hidden : false,
|
||||||
|
position : 'left',
|
||||||
|
folded : false,
|
||||||
|
background: 'mat-fuse-dark-700-bg'
|
||||||
|
},
|
||||||
|
toolbar: {
|
||||||
|
hidden : false,
|
||||||
|
position : 'above-static',
|
||||||
|
background: 'mat-white-500-bg'
|
||||||
|
},
|
||||||
|
footer : {
|
||||||
|
hidden : false,
|
||||||
|
position : 'above-static',
|
||||||
|
background: 'mat-fuse-dark-900-bg'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Horizontal Layout #1
|
||||||
|
case 'horizontal-layout-1':
|
||||||
|
{
|
||||||
|
this.form.patchValue({
|
||||||
|
layout: {
|
||||||
|
width : 'fullwidth',
|
||||||
|
navbar : {
|
||||||
|
hidden : false,
|
||||||
|
position : 'top',
|
||||||
|
folded : false,
|
||||||
|
background: 'mat-fuse-dark-700-bg'
|
||||||
|
},
|
||||||
|
toolbar: {
|
||||||
|
hidden : false,
|
||||||
|
position : 'above',
|
||||||
|
background: 'mat-white-500-bg'
|
||||||
|
},
|
||||||
|
footer : {
|
||||||
|
hidden : false,
|
||||||
|
position : 'above-fixed',
|
||||||
|
background: 'mat-fuse-dark-900-bg'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle sidebar open
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
toggleSidebarOpen(key): void
|
||||||
|
{
|
||||||
|
this._fuseSidebarService.getSidebar(key).toggleOpen();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
43
src/@fuse/components/theme-options/theme-options.module.ts
Normal file
43
src/@fuse/components/theme-options/theme-options.module.ts
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||||
|
import { MatButtonModule, MatDividerModule, MatFormFieldModule, MatIconModule, MatOptionModule, MatRadioModule, MatSelectModule, MatSlideToggleModule } from '@angular/material';
|
||||||
|
|
||||||
|
import { FuseDirectivesModule } from '@fuse/directives/directives';
|
||||||
|
import { FuseSidebarModule } from '@fuse/components/sidebar/sidebar.module';
|
||||||
|
import { FuseMaterialColorPickerModule } from '@fuse/components/material-color-picker/material-color-picker.module';
|
||||||
|
|
||||||
|
import { FuseThemeOptionsComponent } from '@fuse/components/theme-options/theme-options.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseThemeOptionsComponent
|
||||||
|
],
|
||||||
|
imports : [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
|
||||||
|
FlexLayoutModule,
|
||||||
|
|
||||||
|
MatButtonModule,
|
||||||
|
MatDividerModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatOptionModule,
|
||||||
|
MatRadioModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatSlideToggleModule,
|
||||||
|
|
||||||
|
FuseDirectivesModule,
|
||||||
|
FuseMaterialColorPickerModule,
|
||||||
|
FuseSidebarModule
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseThemeOptionsComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseThemeOptionsModule
|
||||||
|
{
|
||||||
|
}
|
||||||
18
src/@fuse/components/widget/widget-toggle.directive.ts
Normal file
18
src/@fuse/components/widget/widget-toggle.directive.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { Directive, ElementRef } from '@angular/core';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[fuseWidgetToggle]'
|
||||||
|
})
|
||||||
|
export class FuseWidgetToggleDirective
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {ElementRef} elementRef
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
public elementRef: ElementRef
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -67,16 +67,16 @@ fuse-widget {
|
|||||||
|
|
||||||
&.mat-form-field-type-mat-select {
|
&.mat-form-field-type-mat-select {
|
||||||
|
|
||||||
.mat-input-wrapper {
|
.mat-form-field-wrapper {
|
||||||
padding: 16px 0;
|
padding: 16px 0;
|
||||||
|
|
||||||
.mat-input-infix {
|
.mat-form-field-infix {
|
||||||
border: none;
|
border: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mat-input-underline {
|
.mat-form-field-underline {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
65
src/@fuse/components/widget/widget.component.ts
Normal file
65
src/@fuse/components/widget/widget.component.ts
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import { AfterContentInit, Component, ContentChildren, ElementRef, HostBinding, QueryList, Renderer2, ViewEncapsulation } from '@angular/core';
|
||||||
|
import { FuseWidgetToggleDirective } from './widget-toggle.directive';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-widget',
|
||||||
|
templateUrl : './widget.component.html',
|
||||||
|
styleUrls : ['./widget.component.scss'],
|
||||||
|
encapsulation: ViewEncapsulation.None
|
||||||
|
})
|
||||||
|
|
||||||
|
export class FuseWidgetComponent implements AfterContentInit
|
||||||
|
{
|
||||||
|
@HostBinding('class.flipped')
|
||||||
|
flipped = false;
|
||||||
|
|
||||||
|
@ContentChildren(FuseWidgetToggleDirective, {descendants: true})
|
||||||
|
toggleButtons: QueryList<FuseWidgetToggleDirective>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {ElementRef} _elementRef
|
||||||
|
* @param {Renderer2} _renderer
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _elementRef: ElementRef,
|
||||||
|
private _renderer: Renderer2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* After content init
|
||||||
|
*/
|
||||||
|
ngAfterContentInit(): void
|
||||||
|
{
|
||||||
|
// Listen for the flip button click
|
||||||
|
setTimeout(() => {
|
||||||
|
this.toggleButtons.forEach(flipButton => {
|
||||||
|
this._renderer.listen(flipButton.elementRef.nativeElement, 'click', (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
this.toggle();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the flipped status
|
||||||
|
*/
|
||||||
|
toggle(): void
|
||||||
|
{
|
||||||
|
this.flipped = !this.flipped;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,20 +1,17 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { SharedModule } from '../../modules/shared.module';
|
|
||||||
import { FuseWidgetComponent } from './widget.component';
|
import { FuseWidgetComponent } from './widget.component';
|
||||||
import { FuseWidgetToggleDirective } from './widget-toggle.directive';
|
import { FuseWidgetToggleDirective } from './widget-toggle.directive';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports : [
|
declarations: [
|
||||||
SharedModule
|
FuseWidgetComponent,
|
||||||
|
FuseWidgetToggleDirective
|
||||||
],
|
],
|
||||||
exports : [
|
exports : [
|
||||||
FuseWidgetComponent,
|
FuseWidgetComponent,
|
||||||
FuseWidgetToggleDirective
|
FuseWidgetToggleDirective
|
||||||
],
|
],
|
||||||
declarations: [
|
|
||||||
FuseWidgetComponent,
|
|
||||||
FuseWidgetToggleDirective
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
export class FuseWidgetModule
|
export class FuseWidgetModule
|
||||||
{
|
{
|
||||||
27
src/@fuse/directives/directives.ts
Normal file
27
src/@fuse/directives/directives.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { FuseIfOnDomDirective } from '@fuse/directives/fuse-if-on-dom/fuse-if-on-dom.directive';
|
||||||
|
import { FuseInnerScrollDirective } from '@fuse/directives/fuse-inner-scroll/fuse-inner-scroll.directive';
|
||||||
|
import { FusePerfectScrollbarDirective } from '@fuse/directives/fuse-perfect-scrollbar/fuse-perfect-scrollbar.directive';
|
||||||
|
import { FuseMatSidenavHelperDirective, FuseMatSidenavTogglerDirective } from '@fuse/directives/fuse-mat-sidenav/fuse-mat-sidenav.directive';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseIfOnDomDirective,
|
||||||
|
FuseInnerScrollDirective,
|
||||||
|
FuseMatSidenavHelperDirective,
|
||||||
|
FuseMatSidenavTogglerDirective,
|
||||||
|
FusePerfectScrollbarDirective
|
||||||
|
],
|
||||||
|
imports : [],
|
||||||
|
exports : [
|
||||||
|
FuseIfOnDomDirective,
|
||||||
|
FuseInnerScrollDirective,
|
||||||
|
FuseMatSidenavHelperDirective,
|
||||||
|
FuseMatSidenavTogglerDirective,
|
||||||
|
FusePerfectScrollbarDirective
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseDirectivesModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import { AfterContentChecked, Directive, ElementRef, TemplateRef, ViewContainerRef } from '@angular/core';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[fuseIfOnDom]'
|
||||||
|
})
|
||||||
|
export class FuseIfOnDomDirective implements AfterContentChecked
|
||||||
|
{
|
||||||
|
isCreated: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {ElementRef} _elementRef
|
||||||
|
* @param {TemplateRef<any>} _templateRef
|
||||||
|
* @param {ViewContainerRef} _viewContainerRef
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _elementRef: ElementRef,
|
||||||
|
private _templateRef: TemplateRef<any>,
|
||||||
|
private _viewContainerRef: ViewContainerRef
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Set the defaults
|
||||||
|
this.isCreated = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* After content checked
|
||||||
|
*/
|
||||||
|
ngAfterContentChecked(): void
|
||||||
|
{
|
||||||
|
if ( document.body.contains(this._elementRef.nativeElement) && !this.isCreated )
|
||||||
|
{
|
||||||
|
setTimeout(() => {
|
||||||
|
this._viewContainerRef.createEmbeddedView(this._templateRef);
|
||||||
|
}, 300);
|
||||||
|
this.isCreated = true;
|
||||||
|
}
|
||||||
|
else if ( this.isCreated && !document.body.contains(this._elementRef.nativeElement) )
|
||||||
|
{
|
||||||
|
this._viewContainerRef.clear();
|
||||||
|
this.isCreated = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
import { Directive, ElementRef, OnDestroy, OnInit, Renderer2 } from '@angular/core';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { FuseMatchMediaService } from '@fuse/services/match-media.service';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '.inner-scroll'
|
||||||
|
})
|
||||||
|
export class FuseInnerScrollDirective implements OnInit, OnDestroy
|
||||||
|
{
|
||||||
|
// Private
|
||||||
|
private _parent: any;
|
||||||
|
private _grandParent: any;
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {ElementRef} _elementRef
|
||||||
|
* @param {FuseMatchMediaService} _fuseMediaMatchService
|
||||||
|
* @param {Renderer2} _renderer
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _elementRef: ElementRef,
|
||||||
|
private _fuseMediaMatchService: FuseMatchMediaService,
|
||||||
|
private _renderer: Renderer2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Set the private defaults
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
// Get the parent
|
||||||
|
this._parent = this._renderer.parentNode(this._elementRef.nativeElement);
|
||||||
|
|
||||||
|
// Return, if there is no parent
|
||||||
|
if ( !this._parent )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the grand parent
|
||||||
|
this._grandParent = this._renderer.parentNode(this._parent);
|
||||||
|
|
||||||
|
// Register to the media query changes
|
||||||
|
this._fuseMediaMatchService.onMediaChange
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe((alias) => {
|
||||||
|
|
||||||
|
if ( alias === 'xs' )
|
||||||
|
{
|
||||||
|
this._removeClass();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this._addClass();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Return, if there is no parent
|
||||||
|
if ( !this._parent )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the class
|
||||||
|
this._removeClass();
|
||||||
|
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Private methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the class name
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _addClass(): void
|
||||||
|
{
|
||||||
|
// Add the inner-scroll class
|
||||||
|
this._renderer.addClass(this._grandParent, 'inner-scroll');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the class name
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _removeClass(): void
|
||||||
|
{
|
||||||
|
|
||||||
|
// Remove the inner-scroll class
|
||||||
|
this._renderer.removeClass(this._grandParent, 'inner-scroll');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
import { Directive, Input, OnInit, HostListener, OnDestroy, HostBinding } from '@angular/core';
|
||||||
|
import { MatSidenav } from '@angular/material';
|
||||||
|
import { ObservableMedia } from '@angular/flex-layout';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { FuseMatchMediaService } from '@fuse/services/match-media.service';
|
||||||
|
import { FuseMatSidenavHelperService } from '@fuse/directives/fuse-mat-sidenav/fuse-mat-sidenav.service';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[fuseMatSidenavHelper]'
|
||||||
|
})
|
||||||
|
export class FuseMatSidenavHelperDirective implements OnInit, OnDestroy
|
||||||
|
{
|
||||||
|
@HostBinding('class.mat-is-locked-open')
|
||||||
|
isLockedOpen: boolean;
|
||||||
|
|
||||||
|
@Input('fuseMatSidenavHelper')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Input('mat-is-locked-open')
|
||||||
|
matIsLockedOpenBreakpoint: string;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {FuseMatchMediaService} _fuseMatchMediaService
|
||||||
|
* @param {FuseMatSidenavHelperService} _fuseMatSidenavHelperService
|
||||||
|
* @param {MatSidenav} _matSidenav
|
||||||
|
* @param {ObservableMedia} _observableMedia
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _fuseMatchMediaService: FuseMatchMediaService,
|
||||||
|
private _fuseMatSidenavHelperService: FuseMatSidenavHelperService,
|
||||||
|
private _matSidenav: MatSidenav,
|
||||||
|
private _observableMedia: ObservableMedia
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Set the defaults
|
||||||
|
this.isLockedOpen = true;
|
||||||
|
|
||||||
|
// Set the private defaults
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
// Register the sidenav to the service
|
||||||
|
this._fuseMatSidenavHelperService.setSidenav(this.id, this._matSidenav);
|
||||||
|
|
||||||
|
if ( this._observableMedia.isActive(this.matIsLockedOpenBreakpoint) )
|
||||||
|
{
|
||||||
|
this.isLockedOpen = true;
|
||||||
|
this._matSidenav.mode = 'side';
|
||||||
|
this._matSidenav.toggle(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.isLockedOpen = false;
|
||||||
|
this._matSidenav.mode = 'over';
|
||||||
|
this._matSidenav.toggle(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._fuseMatchMediaService.onMediaChange
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe(() => {
|
||||||
|
if ( this._observableMedia.isActive(this.matIsLockedOpenBreakpoint) )
|
||||||
|
{
|
||||||
|
this.isLockedOpen = true;
|
||||||
|
this._matSidenav.mode = 'side';
|
||||||
|
this._matSidenav.toggle(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.isLockedOpen = false;
|
||||||
|
this._matSidenav.mode = 'over';
|
||||||
|
this._matSidenav.toggle(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[fuseMatSidenavToggler]'
|
||||||
|
})
|
||||||
|
export class FuseMatSidenavTogglerDirective
|
||||||
|
{
|
||||||
|
@Input('fuseMatSidenavToggler')
|
||||||
|
id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {FuseMatSidenavHelperService} _fuseMatSidenavHelperService
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _fuseMatSidenavHelperService: FuseMatSidenavHelperService)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On click
|
||||||
|
*/
|
||||||
|
@HostListener('click')
|
||||||
|
onClick()
|
||||||
|
{
|
||||||
|
this._fuseMatSidenavHelperService.getSidenav(this.id).toggle();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { MatSidenav } from '@angular/material';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class FuseMatSidenavHelperService
|
||||||
|
{
|
||||||
|
sidenavInstances: MatSidenav[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor()
|
||||||
|
{
|
||||||
|
this.sidenavInstances = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Accessors
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set sidenav
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param instance
|
||||||
|
*/
|
||||||
|
setSidenav(id, instance): void
|
||||||
|
{
|
||||||
|
this.sidenavInstances[id] = instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get sidenav
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
getSidenav(id): any
|
||||||
|
{
|
||||||
|
return this.sidenavInstances[id];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,410 @@
|
|||||||
|
import { AfterViewInit, Directive, ElementRef, HostListener, Input, OnDestroy } from '@angular/core';
|
||||||
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
|
import { Platform } from '@angular/cdk/platform';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { filter, takeUntil } from 'rxjs/operators';
|
||||||
|
import PerfectScrollbar from 'perfect-scrollbar';
|
||||||
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { FuseConfigService } from '@fuse/services/config.service';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[fusePerfectScrollbar]'
|
||||||
|
})
|
||||||
|
export class FusePerfectScrollbarDirective implements AfterViewInit, OnDestroy
|
||||||
|
{
|
||||||
|
isInitialized: boolean;
|
||||||
|
isMobile: boolean;
|
||||||
|
ps: PerfectScrollbar;
|
||||||
|
|
||||||
|
// Private
|
||||||
|
private _enabled: boolean | '';
|
||||||
|
private _debouncedUpdate: any;
|
||||||
|
private _options: any;
|
||||||
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param {ElementRef} elementRef
|
||||||
|
* @param {FuseConfigService} _fuseConfigService
|
||||||
|
* @param {Platform} _platform
|
||||||
|
* @param {Router} _router
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
public elementRef: ElementRef,
|
||||||
|
private _fuseConfigService: FuseConfigService,
|
||||||
|
private _platform: Platform,
|
||||||
|
private _router: Router
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Set the defaults
|
||||||
|
this.isInitialized = false;
|
||||||
|
this.isMobile = false;
|
||||||
|
|
||||||
|
// Set the private defaults
|
||||||
|
this._enabled = false;
|
||||||
|
this._debouncedUpdate = _.debounce(this.update, 150);
|
||||||
|
this._options = {
|
||||||
|
updateOnRouteChange: false
|
||||||
|
};
|
||||||
|
this._unsubscribeAll = new Subject();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Accessors
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perfect Scrollbar options
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
@Input()
|
||||||
|
set fusePerfectScrollbarOptions(value)
|
||||||
|
{
|
||||||
|
// Merge the options
|
||||||
|
this._options = _.merge({}, this._options, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
get fusePerfectScrollbarOptions(): any
|
||||||
|
{
|
||||||
|
// Return the options
|
||||||
|
return this._options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is enabled
|
||||||
|
*
|
||||||
|
* @param {boolean | ""} value
|
||||||
|
*/
|
||||||
|
@Input('fusePerfectScrollbar')
|
||||||
|
set enabled(value: boolean | '')
|
||||||
|
{
|
||||||
|
// If nothing is provided with the directive (empty string),
|
||||||
|
// we will take that as a true
|
||||||
|
if ( value === '' )
|
||||||
|
{
|
||||||
|
value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return, if both values are the same
|
||||||
|
if ( this.enabled === value )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the value
|
||||||
|
this._enabled = value;
|
||||||
|
|
||||||
|
// If enabled...
|
||||||
|
if ( this.enabled )
|
||||||
|
{
|
||||||
|
// Init the directive
|
||||||
|
this._init();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Otherwise destroy it
|
||||||
|
this._destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get enabled(): boolean | ''
|
||||||
|
{
|
||||||
|
// Return the enabled status
|
||||||
|
return this._enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* After view init
|
||||||
|
*/
|
||||||
|
ngAfterViewInit(): void
|
||||||
|
{
|
||||||
|
// Check if scrollbars enabled or not from the main config
|
||||||
|
this._fuseConfigService.config
|
||||||
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
|
.subscribe(
|
||||||
|
(settings) => {
|
||||||
|
this.enabled = settings.customScrollbars;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Scroll to the top on every route change
|
||||||
|
if ( this.fusePerfectScrollbarOptions.updateOnRouteChange )
|
||||||
|
{
|
||||||
|
this._router.events
|
||||||
|
.pipe(
|
||||||
|
takeUntil(this._unsubscribeAll),
|
||||||
|
filter(event => event instanceof NavigationEnd)
|
||||||
|
)
|
||||||
|
.subscribe(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.scrollToTop();
|
||||||
|
this.update();
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
this._destroy();
|
||||||
|
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Private methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_init(): void
|
||||||
|
{
|
||||||
|
// Return, if already initialized
|
||||||
|
if ( this.isInitialized )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if is mobile
|
||||||
|
if ( this._platform.ANDROID || this._platform.IOS )
|
||||||
|
{
|
||||||
|
this.isMobile = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return if it's mobile
|
||||||
|
if ( this.isMobile )
|
||||||
|
{
|
||||||
|
// Return...
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set as initialized
|
||||||
|
this.isInitialized = true;
|
||||||
|
|
||||||
|
// Initialize the perfect-scrollbar
|
||||||
|
this.ps = new PerfectScrollbar(this.elementRef.nativeElement, {
|
||||||
|
...this.fusePerfectScrollbarOptions
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_destroy(): void
|
||||||
|
{
|
||||||
|
if ( !this.isInitialized || !this.ps )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destroy the perfect-scrollbar
|
||||||
|
this.ps.destroy();
|
||||||
|
|
||||||
|
// Clean up
|
||||||
|
this.ps = null;
|
||||||
|
this.isInitialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update scrollbars on window resize
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
@HostListener('window:resize')
|
||||||
|
_updateOnResize(): void
|
||||||
|
{
|
||||||
|
this._debouncedUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document click
|
||||||
|
*
|
||||||
|
* @param {Event} event
|
||||||
|
*/
|
||||||
|
@HostListener('document:click', ['$event'])
|
||||||
|
documentClick(event: Event): void
|
||||||
|
{
|
||||||
|
if ( !this.isInitialized || !this.ps )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the scrollbar on document click..
|
||||||
|
// This isn't the most elegant solution but there is no other way
|
||||||
|
// of knowing when the contents of the scrollable container changes.
|
||||||
|
// Therefore, we update scrollbars on every document click.
|
||||||
|
this.ps.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the scrollbar
|
||||||
|
*/
|
||||||
|
update(): void
|
||||||
|
{
|
||||||
|
if ( !this.isInitialized )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the perfect-scrollbar
|
||||||
|
this.ps.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy the scrollbar
|
||||||
|
*/
|
||||||
|
destroy(): void
|
||||||
|
{
|
||||||
|
this.ngOnDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scroll to X
|
||||||
|
*
|
||||||
|
* @param {number} x
|
||||||
|
* @param {number} speed
|
||||||
|
*/
|
||||||
|
scrollToX(x: number, speed?: number): void
|
||||||
|
{
|
||||||
|
this.animateScrolling('scrollLeft', x, speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scroll to Y
|
||||||
|
*
|
||||||
|
* @param {number} y
|
||||||
|
* @param {number} speed
|
||||||
|
*/
|
||||||
|
scrollToY(y: number, speed?: number): void
|
||||||
|
{
|
||||||
|
this.animateScrolling('scrollTop', y, speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scroll to top
|
||||||
|
*
|
||||||
|
* @param {number} offset
|
||||||
|
* @param {number} speed
|
||||||
|
*/
|
||||||
|
scrollToTop(offset?: number, speed?: number): void
|
||||||
|
{
|
||||||
|
this.animateScrolling('scrollTop', (offset || 0), speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scroll to left
|
||||||
|
*
|
||||||
|
* @param {number} offset
|
||||||
|
* @param {number} speed
|
||||||
|
*/
|
||||||
|
scrollToLeft(offset?: number, speed?: number): void
|
||||||
|
{
|
||||||
|
this.animateScrolling('scrollLeft', (offset || 0), speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scroll to right
|
||||||
|
*
|
||||||
|
* @param {number} offset
|
||||||
|
* @param {number} speed
|
||||||
|
*/
|
||||||
|
scrollToRight(offset?: number, speed?: number): void
|
||||||
|
{
|
||||||
|
const width = this.elementRef.nativeElement.scrollWidth;
|
||||||
|
|
||||||
|
this.animateScrolling('scrollLeft', width - (offset || 0), speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scroll to bottom
|
||||||
|
*
|
||||||
|
* @param {number} offset
|
||||||
|
* @param {number} speed
|
||||||
|
*/
|
||||||
|
scrollToBottom(offset?: number, speed?: number): void
|
||||||
|
{
|
||||||
|
const height = this.elementRef.nativeElement.scrollHeight;
|
||||||
|
|
||||||
|
this.animateScrolling('scrollTop', height - (offset || 0), speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animate scrolling
|
||||||
|
*
|
||||||
|
* @param {string} target
|
||||||
|
* @param {number} value
|
||||||
|
* @param {number} speed
|
||||||
|
*/
|
||||||
|
animateScrolling(target: string, value: number, speed?: number): void
|
||||||
|
{
|
||||||
|
if ( !speed )
|
||||||
|
{
|
||||||
|
this.elementRef.nativeElement[target] = value;
|
||||||
|
|
||||||
|
// PS has weird event sending order, this is a workaround for that
|
||||||
|
this.update();
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
else if ( value !== this.elementRef.nativeElement[target] )
|
||||||
|
{
|
||||||
|
let newValue = 0;
|
||||||
|
let scrollCount = 0;
|
||||||
|
|
||||||
|
let oldTimestamp = performance.now();
|
||||||
|
let oldValue = this.elementRef.nativeElement[target];
|
||||||
|
|
||||||
|
const cosParameter = (oldValue - value) / 2;
|
||||||
|
|
||||||
|
const step = (newTimestamp) => {
|
||||||
|
scrollCount += Math.PI / (speed / (newTimestamp - oldTimestamp));
|
||||||
|
|
||||||
|
newValue = Math.round(value + cosParameter + cosParameter * Math.cos(scrollCount));
|
||||||
|
|
||||||
|
// Only continue animation if scroll position has not changed
|
||||||
|
if ( this.elementRef.nativeElement[target] === oldValue )
|
||||||
|
{
|
||||||
|
if ( scrollCount >= Math.PI )
|
||||||
|
{
|
||||||
|
this.elementRef.nativeElement[target] = value;
|
||||||
|
|
||||||
|
// PS has weird event sending order, this is a workaround for that
|
||||||
|
this.update();
|
||||||
|
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.elementRef.nativeElement[target] = oldValue = newValue;
|
||||||
|
|
||||||
|
oldTimestamp = newTimestamp;
|
||||||
|
|
||||||
|
window.requestAnimationFrame(step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.requestAnimationFrame(step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
47
src/@fuse/fuse.module.ts
Normal file
47
src/@fuse/fuse.module.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
||||||
|
|
||||||
|
import { FUSE_CONFIG, FuseConfigService } from '@fuse/services/config.service';
|
||||||
|
import { FuseCopierService } from '@fuse/services/copier.service';
|
||||||
|
import { FuseMatchMediaService } from '@fuse/services/match-media.service';
|
||||||
|
import { FuseMatSidenavHelperService } from '@fuse/directives/fuse-mat-sidenav/fuse-mat-sidenav.service';
|
||||||
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
|
import { FuseSidebarService } from '@fuse/components/sidebar/sidebar.service';
|
||||||
|
import { FuseSplashScreenService } from '@fuse/services/splash-screen.service';
|
||||||
|
import { FuseTranslationLoaderService } from '@fuse/services/translation-loader.service';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
entryComponents: [],
|
||||||
|
providers : [
|
||||||
|
FuseConfigService,
|
||||||
|
FuseCopierService,
|
||||||
|
FuseMatchMediaService,
|
||||||
|
FuseMatSidenavHelperService,
|
||||||
|
FuseNavigationService,
|
||||||
|
FuseSidebarService,
|
||||||
|
FuseSplashScreenService,
|
||||||
|
FuseTranslationLoaderService
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseModule
|
||||||
|
{
|
||||||
|
constructor(@Optional() @SkipSelf() parentModule: FuseModule)
|
||||||
|
{
|
||||||
|
if ( parentModule )
|
||||||
|
{
|
||||||
|
throw new Error('FuseModule is already loaded. Import it in the AppModule only!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static forRoot(config): ModuleWithProviders
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
ngModule : FuseModule,
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide : FUSE_CONFIG,
|
||||||
|
useValue: config
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,14 @@ import { Pipe, PipeTransform } from '@angular/core';
|
|||||||
@Pipe({name: 'camelCaseToDash'})
|
@Pipe({name: 'camelCaseToDash'})
|
||||||
export class CamelCaseToDashPipe implements PipeTransform
|
export class CamelCaseToDashPipe implements PipeTransform
|
||||||
{
|
{
|
||||||
transform(value: string, args: any[] = [])
|
/**
|
||||||
|
* Transform
|
||||||
|
*
|
||||||
|
* @param {string} value
|
||||||
|
* @param {any[]} args
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
transform(value: string, args: any[] = []): string
|
||||||
{
|
{
|
||||||
return value ? String(value).replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : '';
|
return value ? String(value).replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : '';
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,17 @@
|
|||||||
import { Pipe, PipeTransform } from '@angular/core';
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
import { FuseUtils } from '../fuseUtils';
|
import { FuseUtils } from '@fuse/utils';
|
||||||
|
|
||||||
@Pipe({name: 'filter'})
|
@Pipe({name: 'filter'})
|
||||||
export class FilterPipe implements PipeTransform
|
export class FilterPipe implements PipeTransform
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Transform
|
||||||
|
*
|
||||||
|
* @param {any[]} mainArr
|
||||||
|
* @param {string} searchText
|
||||||
|
* @param {string} property
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
transform(mainArr: any[], searchText: string, property: string): any
|
transform(mainArr: any[], searchText: string, property: string): any
|
||||||
{
|
{
|
||||||
return FuseUtils.filterArrayByString(mainArr, searchText);
|
return FuseUtils.filterArrayByString(mainArr, searchText);
|
||||||
@@ -6,6 +6,14 @@ import { Pipe, PipeTransform } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class GetByIdPipe implements PipeTransform
|
export class GetByIdPipe implements PipeTransform
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Transform
|
||||||
|
*
|
||||||
|
* @param {any[]} value
|
||||||
|
* @param {number} id
|
||||||
|
* @param {string} property
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
transform(value: any[], id: number, property: string): any
|
transform(value: any[], id: number, property: string): any
|
||||||
{
|
{
|
||||||
const foundItem = value.find(item => {
|
const foundItem = value.find(item => {
|
||||||
@@ -3,7 +3,14 @@ import { Pipe, PipeTransform } from '@angular/core';
|
|||||||
@Pipe({name: 'htmlToPlaintext'})
|
@Pipe({name: 'htmlToPlaintext'})
|
||||||
export class HtmlToPlaintextPipe implements PipeTransform
|
export class HtmlToPlaintextPipe implements PipeTransform
|
||||||
{
|
{
|
||||||
transform(value: string, args: any[] = [])
|
/**
|
||||||
|
* Transform
|
||||||
|
*
|
||||||
|
* @param {string} value
|
||||||
|
* @param {any[]} args
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
transform(value: string, args: any[] = []): string
|
||||||
{
|
{
|
||||||
return value ? String(value).replace(/<[^>]+>/gm, '') : '';
|
return value ? String(value).replace(/<[^>]+>/gm, '') : '';
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,13 @@ import { Pipe, PipeTransform } from '@angular/core';
|
|||||||
@Pipe({name: 'keys'})
|
@Pipe({name: 'keys'})
|
||||||
export class KeysPipe implements PipeTransform
|
export class KeysPipe implements PipeTransform
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Transform
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* @param {string[]} args
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
transform(value: any, args: string[]): any
|
transform(value: any, args: string[]): any
|
||||||
{
|
{
|
||||||
const keys: any[] = [];
|
const keys: any[] = [];
|
||||||
@@ -13,7 +13,6 @@ import { CamelCaseToDashPipe } from './camelCaseToDash.pipe';
|
|||||||
HtmlToPlaintextPipe,
|
HtmlToPlaintextPipe,
|
||||||
FilterPipe,
|
FilterPipe,
|
||||||
CamelCaseToDashPipe
|
CamelCaseToDashPipe
|
||||||
|
|
||||||
],
|
],
|
||||||
imports : [],
|
imports : [],
|
||||||
exports : [
|
exports : [
|
||||||
@@ -24,8 +23,6 @@ import { CamelCaseToDashPipe } from './camelCaseToDash.pipe';
|
|||||||
CamelCaseToDashPipe
|
CamelCaseToDashPipe
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
export class FusePipesModule
|
export class FusePipesModule
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// This file meant to be imported only once! Use fuse.scss to access
|
||||||
|
// to the core Fuse and Angular Material mixins
|
||||||
|
|
||||||
// ngx-datatable
|
// ngx-datatable
|
||||||
@import '~@swimlane/ngx-datatable/release/themes/material';
|
@import '~@swimlane/ngx-datatable/release/themes/material';
|
||||||
|
|
||||||
@@ -7,10 +10,13 @@
|
|||||||
// Fuse
|
// Fuse
|
||||||
@import "fuse";
|
@import "fuse";
|
||||||
|
|
||||||
// Theming
|
// Include core Angular Material styles
|
||||||
@include mat-core();
|
@include mat-core();
|
||||||
|
|
||||||
// Include theme styles for core and each component used in your app.
|
// Setup the typography
|
||||||
|
@include angular-material-typography($typography);
|
||||||
|
|
||||||
|
// Create an Angular Material theme from the $theme map
|
||||||
@include angular-material-theme($theme);
|
@include angular-material-theme($theme);
|
||||||
|
|
||||||
// Partials
|
// Partials
|
||||||
@@ -24,6 +30,7 @@
|
|||||||
@import "partials/material";
|
@import "partials/material";
|
||||||
@import "partials/angular-material-fix";
|
@import "partials/angular-material-fix";
|
||||||
@import "partials/typography";
|
@import "partials/typography";
|
||||||
|
@import "partials/docs";
|
||||||
@import "partials/page-layouts";
|
@import "partials/page-layouts";
|
||||||
@import "partials/cards";
|
@import "partials/cards";
|
||||||
@import "partials/navigation";
|
@import "partials/navigation";
|
||||||
5
src/@fuse/scss/fuse.scss
Normal file
5
src/@fuse/scss/fuse.scss
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// Material theming
|
||||||
|
@import "theming";
|
||||||
|
|
||||||
|
// Breakpoint mixins
|
||||||
|
@import "mixins/breakpoints";
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fix: "Inconsistent font sizes across elements"
|
// Fix: "Inconsistent font sizes across elements"
|
||||||
.mat-input-wrapper {
|
.mat-form-field-wrapper {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
&.mat-form-field-type-mat-select {
|
&.mat-form-field-type-mat-select {
|
||||||
|
|
||||||
.mat-input-infix {
|
.mat-form-field-infix {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix: "Stepper icons are broken due to Fuse's icon helpers"
|
// Fix: Stepper icons are broken due to Fuse's icon helpers
|
||||||
mat-horizontal-stepper,
|
mat-horizontal-stepper,
|
||||||
mat-vertical-stepper {
|
mat-vertical-stepper {
|
||||||
|
|
||||||
@@ -68,11 +68,25 @@ mat-vertical-stepper {
|
|||||||
width: 16px !important;
|
width: 16px !important;
|
||||||
min-width: 0 !important;
|
min-width: 0 !important;
|
||||||
min-height: 0 !important;
|
min-height: 0 !important;
|
||||||
color: rgba(255, 255, 255, 0.87) !important;
|
color: inherit !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mat-vertical-stepper {
|
mat-vertical-stepper {
|
||||||
padding: 16px 0;
|
padding: 16px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix: Chip remove icon is broken due to Fuse's icon helpers
|
||||||
|
mat-chip {
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
min-width: 0 !important;
|
||||||
|
min-height: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix: Mat-card-image requires a bigger width than 100%
|
||||||
|
.mat-card-image {
|
||||||
|
max-width: none !important;
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,11 @@
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.auto-width {
|
||||||
|
min-width: 0;
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
.mat-button {
|
.mat-button {
|
||||||
min-width: 0 !important;
|
min-width: 0 !important;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
.secondary-text,
|
.secondary-text,
|
||||||
.mat-icon,
|
.icon,
|
||||||
.icon {
|
i {
|
||||||
color: rgba(0, 0, 0, 0.54);
|
color: rgba(0, 0, 0, 0.54);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ $matColorHues: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, A100, A200, A400
|
|||||||
// If the base text color is black...
|
// If the base text color is black...
|
||||||
@if (rgba(black, 1) == rgba($baseTextColor, 1)) {
|
@if (rgba(black, 1) == rgba($baseTextColor, 1)) {
|
||||||
|
|
||||||
.mat-icon,
|
i,
|
||||||
.icon {
|
.icon {
|
||||||
color: rgba(0, 0, 0, 0.54);
|
color: rgba(0, 0, 0, 0.54);
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ $matColorHues: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, A100, A200, A400
|
|||||||
// If the base text color is white...
|
// If the base text color is white...
|
||||||
@else {
|
@else {
|
||||||
|
|
||||||
.mat-icon,
|
i,
|
||||||
.icon {
|
.icon {
|
||||||
color: rgba(255, 255, 255, 1);
|
color: rgba(255, 255, 255, 1);
|
||||||
}
|
}
|
||||||
@@ -135,11 +135,11 @@ $matColorHues: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, A100, A200, A400
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
.mat-input-placeholder {
|
.mat-form-field-label {
|
||||||
color: map_get($fuseForeground, hint-text);
|
color: map_get($fuseForeground, hint-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.mat-input-underline {
|
.mat-form-field-underline {
|
||||||
background-color: map_get($fuseForeground, divider);
|
background-color: map_get($fuseForeground, divider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,6 +227,35 @@ $matColorHues: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, A100, A200, A400
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin generateFuseColorClasses($primary, $accent, $warn) {
|
||||||
|
|
||||||
|
$colorMap: (
|
||||||
|
primary: $primary,
|
||||||
|
accent: $accent,
|
||||||
|
warn: $warn
|
||||||
|
);
|
||||||
|
|
||||||
|
// Generate the color classes...
|
||||||
|
@each $name, $map in $colorMap {
|
||||||
|
|
||||||
|
@each $hue in $matColorHues {
|
||||||
|
|
||||||
|
$color: map-get($map, $hue);
|
||||||
|
$contrastColor: map-get(map-get($map, 'contrast'), $hue);
|
||||||
|
|
||||||
|
@if ($color != null and $contrastColor != null) {
|
||||||
|
|
||||||
|
@include generateColorClasses($name, $color, $contrastColor, '-#{$hue}');
|
||||||
|
|
||||||
|
// Run the generator one more time for default values (500)
|
||||||
|
@if ($hue == 500) {
|
||||||
|
@include generateColorClasses($name, $color, $contrastColor, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Generate the color classes...
|
// Generate the color classes...
|
||||||
@each $colorName, $colorMap in $matColorsMap {
|
@each $colorName, $colorMap in $matColorsMap {
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user