mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-12-23 07:47:08 +00:00
Compare commits
11 Commits
dev
...
v12.3.0-st
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27b6858b76 | ||
|
|
fcfba4c9e4 | ||
|
|
40894e0aa3 | ||
|
|
8dcf21cb1a | ||
|
|
d917f03883 | ||
|
|
0f2ddbda83 | ||
|
|
fa0d74504b | ||
|
|
ad2b19a07a | ||
|
|
4bf11591a2 | ||
|
|
f45a605b4e | ||
|
|
c150a8902c |
17
.browserslistrc
Normal file
17
.browserslistrc
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||||
|
# For additional information regarding the format and rule options, please see:
|
||||||
|
# https://github.com/browserslist/browserslist#queries
|
||||||
|
|
||||||
|
# For the full list of supported browsers by the Angular framework, please see:
|
||||||
|
# https://angular.io/guide/browser-support
|
||||||
|
|
||||||
|
# You can see what browsers were selected by your queries by running:
|
||||||
|
# npx browserslist
|
||||||
|
|
||||||
|
last 1 Chrome version
|
||||||
|
last 1 Firefox version
|
||||||
|
last 2 Edge major versions
|
||||||
|
last 2 Safari major versions
|
||||||
|
last 2 iOS major versions
|
||||||
|
Firefox ESR
|
||||||
|
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
{
|
|
||||||
"root": true,
|
|
||||||
"env": {
|
|
||||||
"es6": true
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 2018
|
|
||||||
},
|
|
||||||
"ignorePatterns": [
|
|
||||||
"projects/**/*"
|
|
||||||
],
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"*.ts"
|
|
||||||
],
|
|
||||||
"parserOptions": {
|
|
||||||
"project": [
|
|
||||||
"tsconfig.json"
|
|
||||||
],
|
|
||||||
"createDefaultProgram": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"plugin:@angular-eslint/ng-cli-compat",
|
|
||||||
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
|
|
||||||
"plugin:@angular-eslint/template/process-inline-templates"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"@angular-eslint/component-selector": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"type": "element",
|
|
||||||
"prefix": "",
|
|
||||||
"style": "kebab-case"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@angular-eslint/directive-selector": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"type": "attribute",
|
|
||||||
"prefix": "",
|
|
||||||
"style": "camelCase"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@typescript-eslint/dot-notation": "off",
|
|
||||||
"@typescript-eslint/explicit-function-return-type": "error",
|
|
||||||
"@typescript-eslint/explicit-member-accessibility": [
|
|
||||||
"off",
|
|
||||||
{
|
|
||||||
"accessibility": "explicit"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@typescript-eslint/no-inferrable-types": "off",
|
|
||||||
"arrow-parens": [
|
|
||||||
"error",
|
|
||||||
"as-needed",
|
|
||||||
{
|
|
||||||
"requireForBlockBody": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"brace-style": [
|
|
||||||
"off",
|
|
||||||
"off"
|
|
||||||
],
|
|
||||||
"import/order": "off",
|
|
||||||
"max-len": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"ignorePattern": "^import |^export | implements",
|
|
||||||
"code": 180
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-underscore-dangle": "off",
|
|
||||||
"object-shorthand": "off",
|
|
||||||
"quote-props": [
|
|
||||||
"error",
|
|
||||||
"consistent"
|
|
||||||
],
|
|
||||||
"quotes": [
|
|
||||||
"error",
|
|
||||||
"single"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"*.html"
|
|
||||||
],
|
|
||||||
"extends": [
|
|
||||||
"plugin:@angular-eslint/template/recommended"
|
|
||||||
],
|
|
||||||
"rules": {}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
# profiling files
|
# profiling files
|
||||||
chrome-profiler-events*.json
|
chrome-profiler-events*.json
|
||||||
|
speed-measure-plugin*.json
|
||||||
|
|
||||||
# IDEs and editors
|
# IDEs and editors
|
||||||
/.idea
|
/.idea
|
||||||
@@ -31,7 +32,6 @@ chrome-profiler-events*.json
|
|||||||
.history/*
|
.history/*
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
/.angular/cache
|
|
||||||
/.sass-cache
|
/.sass-cache
|
||||||
/connect.lock
|
/connect.lock
|
||||||
/coverage
|
/coverage
|
||||||
|
|||||||
3
CREDITS
3
CREDITS
@@ -2,9 +2,6 @@
|
|||||||
// @ 3rd party credits
|
// @ 3rd party credits
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Flags
|
|
||||||
https://github.com/Yummygum/flagpack-core
|
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
Material - https://material.io/tools/icons
|
Material - https://material.io/tools/icons
|
||||||
Feather - https://feathericons.com/
|
Feather - https://feathericons.com/
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -1,10 +1,8 @@
|
|||||||
# Fuse - Admin template and Starter project for Angular
|
# Fuse - Admin template and Starter project for Angular
|
||||||
|
|
||||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli)
|
|
||||||
|
|
||||||
## Development server
|
## Development server
|
||||||
|
|
||||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||||
|
|
||||||
## Code scaffolding
|
## Code scaffolding
|
||||||
|
|
||||||
@@ -12,7 +10,7 @@ Run `ng generate component component-name` to generate a new component. You can
|
|||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
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
|
||||||
|
|
||||||
@@ -20,8 +18,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 a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||||
|
|
||||||
## Further help
|
## Further help
|
||||||
|
|
||||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
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).
|
||||||
|
|||||||
103
angular.json
103
angular.json
@@ -20,29 +20,20 @@
|
|||||||
"outputPath": "dist/fuse",
|
"outputPath": "dist/fuse",
|
||||||
"index": "src/index.html",
|
"index": "src/index.html",
|
||||||
"main": "src/main.ts",
|
"main": "src/main.ts",
|
||||||
"polyfills": [
|
"polyfills": "src/polyfills.ts",
|
||||||
"zone.js"
|
|
||||||
],
|
|
||||||
"tsConfig": "tsconfig.app.json",
|
"tsConfig": "tsconfig.app.json",
|
||||||
"inlineStyleLanguage": "scss",
|
"aot": true,
|
||||||
"allowedCommonJsDependencies": [
|
"allowedCommonJsDependencies": [
|
||||||
"apexcharts",
|
"apexcharts",
|
||||||
"highlight.js",
|
"highlight.js",
|
||||||
"crypto-js/enc-utf8",
|
"crypto-js/enc-utf8",
|
||||||
"crypto-js/hmac-sha256",
|
"crypto-js/hmac-sha256",
|
||||||
"crypto-js/enc-base64",
|
"crypto-js/enc-base64"
|
||||||
"flat",
|
|
||||||
"quill-delta"
|
|
||||||
],
|
],
|
||||||
"assets": [
|
"assets": [
|
||||||
"src/favicon-16x16.png",
|
"src/favicon-16x16.png",
|
||||||
"src/favicon-32x32.png",
|
"src/favicon-32x32.png",
|
||||||
"src/assets",
|
"src/assets"
|
||||||
{
|
|
||||||
"glob": "_redirects",
|
|
||||||
"input": "src",
|
|
||||||
"output": "/"
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"stylePreprocessorOptions": {
|
"stylePreprocessorOptions": {
|
||||||
"includePaths": [
|
"includePaths": [
|
||||||
@@ -61,70 +52,96 @@
|
|||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optimization": true,
|
||||||
|
"outputHashing": "all",
|
||||||
|
"sourceMap": false,
|
||||||
|
"namedChunks": false,
|
||||||
|
"extractLicenses": true,
|
||||||
|
"vendorChunk": false,
|
||||||
|
"buildOptimizer": true,
|
||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "initial",
|
"type": "initial",
|
||||||
"maximumWarning": "3mb",
|
"maximumWarning": "5mb",
|
||||||
"maximumError": "5mb"
|
"maximumError": "8mb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "anyComponentStyle",
|
"type": "anyComponentStyle",
|
||||||
"maximumWarning": "75kb",
|
"maximumWarning": "100kb",
|
||||||
"maximumError": "90kb"
|
"maximumError": "150kb"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"outputHashing": "all"
|
|
||||||
},
|
|
||||||
"development": {
|
|
||||||
"buildOptimizer": false,
|
|
||||||
"optimization": false,
|
|
||||||
"vendorChunk": true,
|
|
||||||
"extractLicenses": false,
|
|
||||||
"sourceMap": true,
|
|
||||||
"namedChunks": true
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"defaultConfiguration": "production"
|
|
||||||
},
|
},
|
||||||
"serve": {
|
"serve": {
|
||||||
"builder": "@angular-devkit/build-angular:dev-server",
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "fuse:build"
|
||||||
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
"buildTarget": "fuse:build:production"
|
"browserTarget": "fuse:build:production"
|
||||||
},
|
|
||||||
"development": {
|
|
||||||
"buildTarget": "fuse:build:development"
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"defaultConfiguration": "development"
|
|
||||||
},
|
},
|
||||||
"extract-i18n": {
|
"extract-i18n": {
|
||||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "fuse:build"
|
"browserTarget": "fuse:build"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"builder": "@angular-devkit/build-angular:karma",
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
"options": {
|
"options": {
|
||||||
"polyfills": [
|
"main": "src/test.ts",
|
||||||
"zone.js",
|
"polyfills": "src/polyfills.ts",
|
||||||
"zone.js/testing"
|
|
||||||
],
|
|
||||||
"tsConfig": "tsconfig.spec.json",
|
"tsConfig": "tsconfig.spec.json",
|
||||||
"inlineStyleLanguage": "scss",
|
"karmaConfig": "karma.conf.js",
|
||||||
"assets": [
|
"assets": [
|
||||||
"src/favicon-16x16.png",
|
"src/favicon-16x16.png",
|
||||||
"src/favicon-32x32.png",
|
"src/favicon-32x32.png",
|
||||||
"src/assets"
|
"src/assets"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
"src/styles/styles.scss"
|
"src/styles.scss"
|
||||||
],
|
],
|
||||||
"scripts": []
|
"scripts": []
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"tsconfig.app.json",
|
||||||
|
"tsconfig.spec.json",
|
||||||
|
"e2e/tsconfig.json"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"**/node_modules/**"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"e2e": {
|
||||||
|
"builder": "@angular-devkit/build-angular:protractor",
|
||||||
|
"options": {
|
||||||
|
"protractorConfig": "e2e/protractor.conf.js",
|
||||||
|
"devServerTarget": "fuse:serve"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"devServerTarget": "fuse:serve:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"defaultProject": "fuse"
|
||||||
}
|
}
|
||||||
|
|||||||
40
e2e/protractor.conf.js
Normal file
40
e2e/protractor.conf.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Protractor configuration file, see link for more information
|
||||||
|
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||||
|
|
||||||
|
const {SpecReporter, StacktraceOption} = require('jasmine-spec-reporter');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type { import("protractor").Config }
|
||||||
|
*/
|
||||||
|
exports.config = {
|
||||||
|
allScriptsTimeout : 11000,
|
||||||
|
specs : [
|
||||||
|
'./src/**/*.e2e-spec.ts'
|
||||||
|
],
|
||||||
|
capabilities : {
|
||||||
|
browserName: 'chrome'
|
||||||
|
},
|
||||||
|
directConnect : true,
|
||||||
|
SELENIUM_PROMISE_MANAGER: false,
|
||||||
|
baseUrl : 'http://localhost:4200/',
|
||||||
|
framework : 'jasmine',
|
||||||
|
jasmineNodeOpts : {
|
||||||
|
showColors : true,
|
||||||
|
defaultTimeoutInterval: 30000,
|
||||||
|
print : function ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onPrepare()
|
||||||
|
{
|
||||||
|
require('ts-node').register({
|
||||||
|
project: require('path').join(__dirname, './tsconfig.json')
|
||||||
|
});
|
||||||
|
jasmine.getEnv().addReporter(new SpecReporter({
|
||||||
|
spec: {
|
||||||
|
displayStacktrace: StacktraceOption.PRETTY
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
};
|
||||||
23
e2e/src/app.e2e-spec.ts
Normal file
23
e2e/src/app.e2e-spec.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { AppPage } from './app.po';
|
||||||
|
import { browser, logging } from 'protractor';
|
||||||
|
|
||||||
|
describe('workspace-project App', () => {
|
||||||
|
let page: AppPage;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
page = new AppPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display welcome message', async () => {
|
||||||
|
await page.navigateTo();
|
||||||
|
expect(await page.getTitleText()).toEqual('Welcome to Fuse!');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
// Assert that there are no errors emitted from the browser
|
||||||
|
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
|
||||||
|
expect(logs).not.toContain(jasmine.objectContaining({
|
||||||
|
level: logging.Level.SEVERE
|
||||||
|
} as logging.Entry));
|
||||||
|
});
|
||||||
|
});
|
||||||
14
e2e/src/app.po.ts
Normal file
14
e2e/src/app.po.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { browser, by, element } from 'protractor';
|
||||||
|
|
||||||
|
export class AppPage
|
||||||
|
{
|
||||||
|
async navigateTo(): Promise<unknown>
|
||||||
|
{
|
||||||
|
return browser.get(browser.baseUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getTitleText(): Promise<string>
|
||||||
|
{
|
||||||
|
return element(by.css('app-root h1')).getText();
|
||||||
|
}
|
||||||
|
}
|
||||||
13
e2e/tsconfig.json
Normal file
13
e2e/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../out-tsc/e2e",
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es2018",
|
||||||
|
"types": [
|
||||||
|
"jasmine",
|
||||||
|
"node"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
45
karma.conf.js
Normal file
45
karma.conf.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
// 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-devkit/build-angular'],
|
||||||
|
plugins : [
|
||||||
|
require('karma-jasmine'),
|
||||||
|
require('karma-chrome-launcher'),
|
||||||
|
require('karma-jasmine-html-reporter'),
|
||||||
|
require('karma-coverage'),
|
||||||
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
|
],
|
||||||
|
client : {
|
||||||
|
jasmine : {
|
||||||
|
// you can add configuration options for Jasmine here
|
||||||
|
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||||
|
// for example, you can disable the random execution with `random: false`
|
||||||
|
// or set a specific seed with `seed: 4321`
|
||||||
|
},
|
||||||
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
|
},
|
||||||
|
jasmineHtmlReporter: {
|
||||||
|
suppressAll: true // removes the duplicated traces
|
||||||
|
},
|
||||||
|
coverageReporter : {
|
||||||
|
dir : require('path').join(__dirname, './coverage/angular11'),
|
||||||
|
subdir : '.',
|
||||||
|
reporters: [
|
||||||
|
{type: 'html'},
|
||||||
|
{type: 'text-summary'}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
reporters : ['progress', 'kjhtml'],
|
||||||
|
port : 9876,
|
||||||
|
colors : true,
|
||||||
|
logLevel : config.LOG_INFO,
|
||||||
|
autoWatch : true,
|
||||||
|
browsers : ['Chrome'],
|
||||||
|
singleRun : false,
|
||||||
|
restartOnFileChange: true
|
||||||
|
});
|
||||||
|
};
|
||||||
24129
package-lock.json
generated
24129
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
118
package.json
118
package.json
@@ -1,65 +1,83 @@
|
|||||||
{
|
{
|
||||||
"name": "fuse-angular",
|
"name": "@fuse/demo",
|
||||||
"version": "19.1.0",
|
"version": "12.3.0",
|
||||||
"description": "Fuse - Angular Admin Template and Starter Project",
|
|
||||||
"author": "https://themeforest.net/user/srcn",
|
|
||||||
"license": "https://themeforest.net/licenses/standard",
|
"license": "https://themeforest.net/licenses/standard",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build --prod",
|
||||||
"watch": "ng build --watch --configuration development",
|
"test": "ng test",
|
||||||
"test": "ng test"
|
"lint": "ng lint",
|
||||||
|
"e2e": "ng e2e"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "17.2.4",
|
"@angular/animations": "11.2.12",
|
||||||
"@angular/cdk": "17.2.2",
|
"@angular/cdk": "11.2.11",
|
||||||
"@angular/common": "17.2.4",
|
"@angular/common": "11.2.12",
|
||||||
"@angular/compiler": "17.2.4",
|
"@angular/compiler": "11.2.12",
|
||||||
"@angular/core": "17.2.4",
|
"@angular/core": "11.2.12",
|
||||||
"@angular/forms": "17.2.4",
|
"@angular/forms": "11.2.12",
|
||||||
"@angular/material": "17.2.2",
|
"@angular/material": "11.2.11",
|
||||||
"@angular/material-luxon-adapter": "17.2.2",
|
"@angular/material-moment-adapter": "11.2.11",
|
||||||
"@angular/platform-browser": "17.2.4",
|
"@angular/platform-browser": "11.2.12",
|
||||||
"@angular/platform-browser-dynamic": "17.2.4",
|
"@angular/platform-browser-dynamic": "11.2.12",
|
||||||
"@angular/router": "17.2.4",
|
"@angular/router": "11.2.12",
|
||||||
"@ngneat/transloco": "6.0.4",
|
"@fullcalendar/angular": "4.4.5-beta",
|
||||||
"apexcharts": "3.47.0",
|
"@fullcalendar/core": "4.4.2",
|
||||||
"crypto-js": "4.2.0",
|
"@fullcalendar/daygrid": "4.4.2",
|
||||||
"highlight.js": "11.9.0",
|
"@fullcalendar/interaction": "4.4.2",
|
||||||
|
"@fullcalendar/list": "4.4.2",
|
||||||
|
"@fullcalendar/moment": "4.4.2",
|
||||||
|
"@fullcalendar/rrule": "4.4.2",
|
||||||
|
"@fullcalendar/timegrid": "4.4.2",
|
||||||
|
"apexcharts": "3.26.1",
|
||||||
|
"crypto-js": "3.3.0",
|
||||||
|
"highlight.js": "10.7.2",
|
||||||
"lodash-es": "4.17.21",
|
"lodash-es": "4.17.21",
|
||||||
"luxon": "3.4.4",
|
"moment": "2.29.1",
|
||||||
"ng-apexcharts": "1.9.0",
|
"ng-apexcharts": "1.5.9",
|
||||||
"ngx-quill": "25.1.1",
|
"ngx-markdown": "11.1.3",
|
||||||
"perfect-scrollbar": "1.5.5",
|
"ngx-quill": "13.3.1",
|
||||||
"rxjs": "7.8.1",
|
"perfect-scrollbar": "1.5.0",
|
||||||
"tslib": "2.6.2",
|
"quill": "1.3.7",
|
||||||
"zone.js": "0.14.4"
|
"rrule": "2.6.8",
|
||||||
|
"rxjs": "6.6.7",
|
||||||
|
"tslib": "2.2.0",
|
||||||
|
"web-animations-js": "2.3.2",
|
||||||
|
"zone.js": "0.11.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "17.2.3",
|
"@angular-devkit/build-angular": "0.1102.11",
|
||||||
"@angular/cli": "17.2.3",
|
"@angular/cli": "11.2.11",
|
||||||
"@angular/compiler-cli": "17.2.4",
|
"@angular/compiler-cli": "11.2.12",
|
||||||
"@tailwindcss/typography": "0.5.10",
|
"@angular/language-service": "11.2.12",
|
||||||
"@types/chroma-js": "2.4.4",
|
"@tailwindcss/aspect-ratio": "0.2.0",
|
||||||
"@types/crypto-js": "4.2.2",
|
"@tailwindcss/line-clamp": "0.2.0",
|
||||||
|
"@tailwindcss/typography": "0.4.0",
|
||||||
|
"@types/chroma-js": "2.1.3",
|
||||||
|
"@types/crypto-js": "3.1.47",
|
||||||
"@types/highlight.js": "10.1.0",
|
"@types/highlight.js": "10.1.0",
|
||||||
"@types/jasmine": "5.1.4",
|
"@types/jasmine": "3.6.9",
|
||||||
"@types/lodash": "4.14.202",
|
"@types/lodash": "4.14.168",
|
||||||
"@types/lodash-es": "4.17.12",
|
"@types/lodash-es": "4.17.4",
|
||||||
"@types/luxon": "3.4.2",
|
"@types/node": "12.20.10",
|
||||||
"autoprefixer": "10.4.18",
|
"autoprefixer": "10.2.5",
|
||||||
"chroma-js": "2.4.2",
|
"chroma-js": "2.1.1",
|
||||||
"jasmine-core": "5.1.2",
|
"codelyzer": "6.0.1",
|
||||||
"karma": "6.4.3",
|
"jasmine-core": "3.6.0",
|
||||||
"karma-chrome-launcher": "3.2.0",
|
"jasmine-spec-reporter": "5.0.2",
|
||||||
"karma-coverage": "2.2.1",
|
"karma": "6.1.2",
|
||||||
"karma-jasmine": "5.1.0",
|
"karma-chrome-launcher": "3.1.0",
|
||||||
"karma-jasmine-html-reporter": "2.1.0",
|
"karma-coverage": "2.0.3",
|
||||||
|
"karma-jasmine": "4.0.1",
|
||||||
|
"karma-jasmine-html-reporter": "1.5.4",
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
"postcss": "8.4.35",
|
"postcss": "8.2.13",
|
||||||
"tailwindcss": "3.4.1",
|
"protractor": "7.0.0",
|
||||||
"typescript": "5.3.3"
|
"tailwindcss": "2.1.2",
|
||||||
|
"ts-node": "8.3.0",
|
||||||
|
"tslint": "6.1.3",
|
||||||
|
"typescript": "4.1.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
export class FuseAnimationCurves
|
export class FuseAnimationCurves
|
||||||
{
|
{
|
||||||
static standard = 'cubic-bezier(0.4, 0.0, 0.2, 1)';
|
static STANDARD_CURVE = 'cubic-bezier(0.4, 0.0, 0.2, 1)';
|
||||||
static deceleration = 'cubic-bezier(0.0, 0.0, 0.2, 1)';
|
static DECELERATION_CURVE = 'cubic-bezier(0.0, 0.0, 0.2, 1)';
|
||||||
static acceleration = 'cubic-bezier(0.4, 0.0, 1, 1)';
|
static ACCELERATION_CURVE = 'cubic-bezier(0.4, 0.0, 1, 1)';
|
||||||
static sharp = 'cubic-bezier(0.4, 0.0, 0.6, 1)';
|
static SHARP_CURVE = 'cubic-bezier(0.4, 0.0, 0.6, 1)';
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FuseAnimationDurations
|
export class FuseAnimationDurations
|
||||||
{
|
{
|
||||||
static complex = '375ms';
|
static COMPLEX = '375ms';
|
||||||
static entering = '225ms';
|
static ENTERING = '225ms';
|
||||||
static exiting = '195ms';
|
static EXITING = '195ms';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ const expandCollapse = trigger('expandCollapse',
|
|||||||
[
|
[
|
||||||
state('void, collapsed',
|
state('void, collapsed',
|
||||||
style({
|
style({
|
||||||
height: '0',
|
height: '0'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*, expanded',
|
state('*, expanded',
|
||||||
style('*'),
|
style('*')
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -24,11 +24,11 @@ const expandCollapse = trigger('expandCollapse',
|
|||||||
animate('{{timings}}'),
|
animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
export { expandCollapse };
|
export { expandCollapse };
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ const fadeIn = trigger('fadeIn',
|
|||||||
[
|
[
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity: 0,
|
opacity: 0
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity: 1,
|
opacity: 1
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -25,11 +25,11 @@ const fadeIn = trigger('fadeIn',
|
|||||||
transition('void => *', animate('{{timings}}'),
|
transition('void => *', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -40,15 +40,15 @@ const fadeInTop = trigger('fadeInTop',
|
|||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity : 0,
|
opacity : 0,
|
||||||
transform: 'translate3d(0, -100%, 0)',
|
transform: 'translate3d(0, -100%, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity : 1,
|
opacity : 1,
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -58,11 +58,11 @@ const fadeInTop = trigger('fadeInTop',
|
|||||||
transition('void => *', animate('{{timings}}'),
|
transition('void => *', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -73,15 +73,15 @@ const fadeInBottom = trigger('fadeInBottom',
|
|||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity : 0,
|
opacity : 0,
|
||||||
transform: 'translate3d(0, 100%, 0)',
|
transform: 'translate3d(0, 100%, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity : 1,
|
opacity : 1,
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -91,11 +91,11 @@ const fadeInBottom = trigger('fadeInBottom',
|
|||||||
transition('void => *', animate('{{timings}}'),
|
transition('void => *', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -106,15 +106,15 @@ const fadeInLeft = trigger('fadeInLeft',
|
|||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity : 0,
|
opacity : 0,
|
||||||
transform: 'translate3d(-100%, 0, 0)',
|
transform: 'translate3d(-100%, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity : 1,
|
opacity : 1,
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -124,11 +124,11 @@ const fadeInLeft = trigger('fadeInLeft',
|
|||||||
transition('void => *', animate('{{timings}}'),
|
transition('void => *', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -139,15 +139,15 @@ const fadeInRight = trigger('fadeInRight',
|
|||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity : 0,
|
opacity : 0,
|
||||||
transform: 'translate3d(100%, 0, 0)',
|
transform: 'translate3d(100%, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity : 1,
|
opacity : 1,
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -157,11 +157,11 @@ const fadeInRight = trigger('fadeInRight',
|
|||||||
transition('void => *', animate('{{timings}}'),
|
transition('void => *', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -171,14 +171,14 @@ const fadeOut = trigger('fadeOut',
|
|||||||
[
|
[
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity: 1,
|
opacity: 1
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity: 0,
|
opacity: 0
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -188,11 +188,11 @@ const fadeOut = trigger('fadeOut',
|
|||||||
transition('* => void', animate('{{timings}}'),
|
transition('* => void', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`,
|
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -203,15 +203,15 @@ const fadeOutTop = trigger('fadeOutTop',
|
|||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity : 1,
|
opacity : 1,
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity : 0,
|
opacity : 0,
|
||||||
transform: 'translate3d(0, -100%, 0)',
|
transform: 'translate3d(0, -100%, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -221,11 +221,11 @@ const fadeOutTop = trigger('fadeOutTop',
|
|||||||
transition('* => void', animate('{{timings}}'),
|
transition('* => void', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`,
|
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -236,15 +236,15 @@ const fadeOutBottom = trigger('fadeOutBottom',
|
|||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity : 1,
|
opacity : 1,
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity : 0,
|
opacity : 0,
|
||||||
transform: 'translate3d(0, 100%, 0)',
|
transform: 'translate3d(0, 100%, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -254,11 +254,11 @@ const fadeOutBottom = trigger('fadeOutBottom',
|
|||||||
transition('* => void', animate('{{timings}}'),
|
transition('* => void', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`,
|
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -269,15 +269,15 @@ const fadeOutLeft = trigger('fadeOutLeft',
|
|||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity : 1,
|
opacity : 1,
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity : 0,
|
opacity : 0,
|
||||||
transform: 'translate3d(-100%, 0, 0)',
|
transform: 'translate3d(-100%, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -287,11 +287,11 @@ const fadeOutLeft = trigger('fadeOutLeft',
|
|||||||
transition('* => void', animate('{{timings}}'),
|
transition('* => void', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`,
|
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -302,15 +302,15 @@ const fadeOutRight = trigger('fadeOutRight',
|
|||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity : 1,
|
opacity : 1,
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity : 0,
|
opacity : 0,
|
||||||
transform: 'translate3d(100%, 0, 0)',
|
transform: 'translate3d(100%, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -320,11 +320,11 @@ const fadeOutRight = trigger('fadeOutRight',
|
|||||||
transition('* => void', animate('{{timings}}'),
|
transition('* => void', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`,
|
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
export { fadeIn, fadeInTop, fadeInBottom, fadeInLeft, fadeInRight, fadeOut, fadeOutTop, fadeOutBottom, fadeOutLeft, fadeOutRight };
|
export { fadeIn, fadeInTop, fadeInBottom, fadeInLeft, fadeInRight, fadeOut, fadeOutTop, fadeOutBottom, fadeOutLeft, fadeOutRight };
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export * from '@fuse/animations/public-api';
|
export * from './public-api';
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { expandCollapse } from '@fuse/animations/expand-collapse';
|
import { expandCollapse } from './expand-collapse';
|
||||||
import { fadeIn, fadeInBottom, fadeInLeft, fadeInRight, fadeInTop, fadeOut, fadeOutBottom, fadeOutLeft, fadeOutRight, fadeOutTop } from '@fuse/animations/fade';
|
import { fadeIn, fadeInBottom, fadeInLeft, fadeInRight, fadeInTop, fadeOut, fadeOutBottom, fadeOutLeft, fadeOutRight, fadeOutTop } from './fade';
|
||||||
import { shake } from '@fuse/animations/shake';
|
import { shake } from './shake';
|
||||||
import { slideInBottom, slideInLeft, slideInRight, slideInTop, slideOutBottom, slideOutLeft, slideOutRight, slideOutTop } from '@fuse/animations/slide';
|
import { slideInBottom, slideInLeft, slideInRight, slideInTop, slideOutBottom, slideOutLeft, slideOutRight, slideOutTop } from './slide';
|
||||||
import { zoomIn, zoomOut } from '@fuse/animations/zoom';
|
import { zoomIn, zoomOut } from './zoom';
|
||||||
|
|
||||||
export const fuseAnimations = [
|
export const FuseAnimations = [
|
||||||
expandCollapse,
|
expandCollapse,
|
||||||
fadeIn, fadeInTop, fadeInBottom, fadeInLeft, fadeInRight,
|
fadeIn, fadeInTop, fadeInBottom, fadeInLeft, fadeInRight,
|
||||||
fadeOut, fadeOutTop, fadeOutBottom, fadeOutLeft, fadeOutRight,
|
fadeOut, fadeOutTop, fadeOutBottom, fadeOutLeft, fadeOutRight,
|
||||||
shake,
|
shake,
|
||||||
slideInTop, slideInBottom, slideInLeft, slideInRight,
|
slideInTop, slideInBottom, slideInLeft, slideInRight,
|
||||||
slideOutTop, slideOutBottom, slideOutLeft, slideOutRight,
|
slideOutTop, slideOutBottom, slideOutLeft, slideOutRight,
|
||||||
zoomIn, zoomOut,
|
zoomIn, zoomOut
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -16,58 +16,58 @@ const shake = trigger('shake',
|
|||||||
keyframes([
|
keyframes([
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)',
|
||||||
offset : 0,
|
offset : 0
|
||||||
}),
|
}),
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(-10px, 0, 0)',
|
transform: 'translate3d(-10px, 0, 0)',
|
||||||
offset : 0.1,
|
offset : 0.1
|
||||||
}),
|
}),
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(10px, 0, 0)',
|
transform: 'translate3d(10px, 0, 0)',
|
||||||
offset : 0.2,
|
offset : 0.2
|
||||||
}),
|
}),
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(-10px, 0, 0)',
|
transform: 'translate3d(-10px, 0, 0)',
|
||||||
offset : 0.3,
|
offset : 0.3
|
||||||
}),
|
}),
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(10px, 0, 0)',
|
transform: 'translate3d(10px, 0, 0)',
|
||||||
offset : 0.4,
|
offset : 0.4
|
||||||
}),
|
}),
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(-10px, 0, 0)',
|
transform: 'translate3d(-10px, 0, 0)',
|
||||||
offset : 0.5,
|
offset : 0.5
|
||||||
}),
|
}),
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(10px, 0, 0)',
|
transform: 'translate3d(10px, 0, 0)',
|
||||||
offset : 0.6,
|
offset : 0.6
|
||||||
}),
|
}),
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(-10px, 0, 0)',
|
transform: 'translate3d(-10px, 0, 0)',
|
||||||
offset : 0.7,
|
offset : 0.7
|
||||||
}),
|
}),
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(10px, 0, 0)',
|
transform: 'translate3d(10px, 0, 0)',
|
||||||
offset : 0.8,
|
offset : 0.8
|
||||||
}),
|
}),
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(-10px, 0, 0)',
|
transform: 'translate3d(-10px, 0, 0)',
|
||||||
offset : 0.9,
|
offset : 0.9
|
||||||
}),
|
}),
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)',
|
||||||
offset : 1,
|
offset : 1
|
||||||
}),
|
})
|
||||||
]),
|
])
|
||||||
),
|
)
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: '0.8s cubic-bezier(0.455, 0.03, 0.515, 0.955)',
|
timings: '0.8s cubic-bezier(0.455, 0.03, 0.515, 0.955)'
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
export { shake };
|
export { shake };
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ const slideInTop = trigger('slideInTop',
|
|||||||
[
|
[
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, -100%, 0)',
|
transform: 'translate3d(0, -100%, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -25,11 +25,11 @@ const slideInTop = trigger('slideInTop',
|
|||||||
transition('void => *', animate('{{timings}}'),
|
transition('void => *', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -39,14 +39,14 @@ const slideInBottom = trigger('slideInBottom',
|
|||||||
[
|
[
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 100%, 0)',
|
transform: 'translate3d(0, 100%, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -56,11 +56,11 @@ const slideInBottom = trigger('slideInBottom',
|
|||||||
transition('void => *', animate('{{timings}}'),
|
transition('void => *', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -70,14 +70,14 @@ const slideInLeft = trigger('slideInLeft',
|
|||||||
[
|
[
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(-100%, 0, 0)',
|
transform: 'translate3d(-100%, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -87,11 +87,11 @@ const slideInLeft = trigger('slideInLeft',
|
|||||||
transition('void => *', animate('{{timings}}'),
|
transition('void => *', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -101,14 +101,14 @@ const slideInRight = trigger('slideInRight',
|
|||||||
[
|
[
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(100%, 0, 0)',
|
transform: 'translate3d(100%, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -118,11 +118,11 @@ const slideInRight = trigger('slideInRight',
|
|||||||
transition('void => *', animate('{{timings}}'),
|
transition('void => *', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -132,14 +132,14 @@ const slideOutTop = trigger('slideOutTop',
|
|||||||
[
|
[
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, -100%, 0)',
|
transform: 'translate3d(0, -100%, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -149,11 +149,11 @@ const slideOutTop = trigger('slideOutTop',
|
|||||||
transition('* => void', animate('{{timings}}'),
|
transition('* => void', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`,
|
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -163,14 +163,14 @@ const slideOutBottom = trigger('slideOutBottom',
|
|||||||
[
|
[
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 100%, 0)',
|
transform: 'translate3d(0, 100%, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -180,11 +180,11 @@ const slideOutBottom = trigger('slideOutBottom',
|
|||||||
transition('* => void', animate('{{timings}}'),
|
transition('* => void', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`,
|
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -194,14 +194,14 @@ const slideOutLeft = trigger('slideOutLeft',
|
|||||||
[
|
[
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(-100%, 0, 0)',
|
transform: 'translate3d(-100%, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -211,11 +211,11 @@ const slideOutLeft = trigger('slideOutLeft',
|
|||||||
transition('* => void', animate('{{timings}}'),
|
transition('* => void', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`,
|
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -225,14 +225,14 @@ const slideOutRight = trigger('slideOutRight',
|
|||||||
[
|
[
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
transform: 'translate3d(100%, 0, 0)',
|
transform: 'translate3d(100%, 0, 0)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -242,11 +242,11 @@ const slideOutRight = trigger('slideOutRight',
|
|||||||
transition('* => void', animate('{{timings}}'),
|
transition('* => void', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`,
|
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
export { slideInTop, slideInBottom, slideInLeft, slideInRight, slideOutTop, slideOutBottom, slideOutLeft, slideOutRight };
|
export { slideInTop, slideInBottom, slideInLeft, slideInRight, slideOutTop, slideOutBottom, slideOutLeft, slideOutRight };
|
||||||
|
|||||||
@@ -10,15 +10,15 @@ const zoomIn = trigger('zoomIn',
|
|||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity : 0,
|
opacity : 0,
|
||||||
transform: 'scale(0.5)',
|
transform: 'scale(0.5)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity : 1,
|
opacity : 1,
|
||||||
transform: 'scale(1)',
|
transform: 'scale(1)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -28,11 +28,11 @@ const zoomIn = trigger('zoomIn',
|
|||||||
transition('void => *', animate('{{timings}}'),
|
transition('void => *', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`,
|
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -44,15 +44,15 @@ const zoomOut = trigger('zoomOut',
|
|||||||
state('*',
|
state('*',
|
||||||
style({
|
style({
|
||||||
opacity : 1,
|
opacity : 1,
|
||||||
transform: 'scale(1)',
|
transform: 'scale(1)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
state('void',
|
state('void',
|
||||||
style({
|
style({
|
||||||
opacity : 0,
|
opacity : 0,
|
||||||
transform: 'scale(0.5)',
|
transform: 'scale(0.5)'
|
||||||
}),
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
// Prevent the transition if the state is false
|
// Prevent the transition if the state is false
|
||||||
@@ -62,11 +62,11 @@ const zoomOut = trigger('zoomOut',
|
|||||||
transition('* => void', animate('{{timings}}'),
|
transition('* => void', animate('{{timings}}'),
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`,
|
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
export { zoomIn, zoomOut };
|
export { zoomIn, zoomOut };
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
<mat-icon
|
<mat-icon
|
||||||
*ngIf="type === 'warning'"
|
*ngIf="type === 'warning'"
|
||||||
[svgIcon]="'heroicons_solid:exclamation-triangle'"></mat-icon>
|
[svgIcon]="'heroicons_solid:exclamation'"></mat-icon>
|
||||||
|
|
||||||
<mat-icon
|
<mat-icon
|
||||||
*ngIf="type === 'error'"
|
*ngIf="type === 'error'"
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
class="fuse-alert-dismiss-button"
|
class="fuse-alert-dismiss-button"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
(click)="dismiss()">
|
(click)="dismiss()">
|
||||||
<mat-icon [svgIcon]="'heroicons_solid:x-mark'"></mat-icon>
|
<mat-icon [svgIcon]="'heroicons_solid:x'"></mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
||||||
import { NgIf } from '@angular/common';
|
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, HostBinding, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, HostBinding, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { Subject } from 'rxjs';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { filter, takeUntil } from 'rxjs/operators';
|
||||||
import { fuseAnimations } from '@fuse/animations';
|
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||||
import { FuseAlertService } from '@fuse/components/alert/alert.service';
|
import { FuseAnimations } from '@fuse/animations';
|
||||||
import { FuseAlertAppearance, FuseAlertType } from '@fuse/components/alert/alert.types';
|
import { FuseAlertAppearance, FuseAlertType } from '@fuse/components/alert/alert.types';
|
||||||
|
import { FuseAlertService } from '@fuse/components/alert/alert.service';
|
||||||
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
||||||
import { filter, Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-alert',
|
selector : 'fuse-alert',
|
||||||
@@ -15,18 +13,14 @@ import { filter, Subject, takeUntil } from 'rxjs';
|
|||||||
styleUrls : ['./alert.component.scss'],
|
styleUrls : ['./alert.component.scss'],
|
||||||
encapsulation : ViewEncapsulation.None,
|
encapsulation : ViewEncapsulation.None,
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
animations : fuseAnimations,
|
animations : FuseAnimations,
|
||||||
exportAs : 'fuseAlert',
|
exportAs : 'fuseAlert'
|
||||||
standalone : true,
|
|
||||||
imports : [NgIf, MatIconModule, MatButtonModule],
|
|
||||||
})
|
})
|
||||||
export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
static ngAcceptInputType_dismissible: BooleanInput;
|
static ngAcceptInputType_dismissible: BooleanInput;
|
||||||
static ngAcceptInputType_dismissed: BooleanInput;
|
static ngAcceptInputType_dismissed: BooleanInput;
|
||||||
static ngAcceptInputType_showIcon: BooleanInput;
|
static ngAcceptInputType_showIcon: BooleanInput;
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
|
|
||||||
@Input() appearance: FuseAlertAppearance = 'soft';
|
@Input() appearance: FuseAlertAppearance = 'soft';
|
||||||
@Input() dismissed: boolean = false;
|
@Input() dismissed: boolean = false;
|
||||||
@@ -44,7 +38,7 @@ export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _fuseAlertService: FuseAlertService,
|
private _fuseAlertService: FuseAlertService,
|
||||||
private _fuseUtilsService: FuseUtilsService,
|
private _fuseUtilsService: FuseUtilsService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -58,7 +52,6 @@ export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
*/
|
*/
|
||||||
@HostBinding('class') get classList(): any
|
@HostBinding('class') get classList(): any
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
return {
|
return {
|
||||||
'fuse-alert-appearance-border' : this.appearance === 'border',
|
'fuse-alert-appearance-border' : this.appearance === 'border',
|
||||||
'fuse-alert-appearance-fill' : this.appearance === 'fill',
|
'fuse-alert-appearance-fill' : this.appearance === 'fill',
|
||||||
@@ -74,9 +67,8 @@ export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
'fuse-alert-type-info' : this.type === 'info',
|
'fuse-alert-type-info' : this.type === 'info',
|
||||||
'fuse-alert-type-success' : this.type === 'success',
|
'fuse-alert-type-success' : this.type === 'success',
|
||||||
'fuse-alert-type-warning' : this.type === 'warning',
|
'fuse-alert-type-warning' : this.type === 'warning',
|
||||||
'fuse-alert-type-error' : this.type === 'error',
|
'fuse-alert-type-error' : this.type === 'error'
|
||||||
};
|
};
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -123,11 +115,11 @@ export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
// Subscribe to the dismiss calls
|
// Subscribe to the dismiss calls
|
||||||
this._fuseAlertService.onDismiss
|
this._fuseAlertService.onDismiss
|
||||||
.pipe(
|
.pipe(
|
||||||
filter(name => this.name === name),
|
filter((name) => this.name === name),
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
)
|
)
|
||||||
.subscribe(() =>
|
.subscribe(() => {
|
||||||
{
|
|
||||||
// Dismiss the alert
|
// Dismiss the alert
|
||||||
this.dismiss();
|
this.dismiss();
|
||||||
});
|
});
|
||||||
@@ -135,11 +127,11 @@ export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
// Subscribe to the show calls
|
// Subscribe to the show calls
|
||||||
this._fuseAlertService.onShow
|
this._fuseAlertService.onShow
|
||||||
.pipe(
|
.pipe(
|
||||||
filter(name => this.name === name),
|
filter((name) => this.name === name),
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
)
|
)
|
||||||
.subscribe(() =>
|
.subscribe(() => {
|
||||||
{
|
|
||||||
// Show the alert
|
// Show the alert
|
||||||
this.show();
|
this.show();
|
||||||
});
|
});
|
||||||
@@ -151,7 +143,7 @@ export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
22
src/@fuse/components/alert/alert.module.ts
Normal file
22
src/@fuse/components/alert/alert.module.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { FuseAlertComponent } from '@fuse/components/alert/alert.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseAlertComponent
|
||||||
|
],
|
||||||
|
imports : [
|
||||||
|
CommonModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatIconModule
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseAlertComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseAlertModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, ReplaySubject } from 'rxjs';
|
import { Observable, ReplaySubject } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({providedIn: 'root'})
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
export class FuseAlertService
|
export class FuseAlertService
|
||||||
{
|
{
|
||||||
private readonly _onDismiss: ReplaySubject<string> = new ReplaySubject<string>(1);
|
private readonly _onDismiss: ReplaySubject<string> = new ReplaySubject<string>(1);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
export * from '@fuse/components/alert/alert.component';
|
export * from '@fuse/components/alert/alert.component';
|
||||||
|
export * from '@fuse/components/alert/alert.module';
|
||||||
export * from '@fuse/components/alert/alert.service';
|
export * from '@fuse/components/alert/alert.service';
|
||||||
export * from '@fuse/components/alert/alert.types';
|
export * from '@fuse/components/alert/alert.types';
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
||||||
import { NgIf } from '@angular/common';
|
|
||||||
import { Component, HostBinding, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
import { Component, HostBinding, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||||
import { fuseAnimations } from '@fuse/animations';
|
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||||
|
import { FuseAnimations } from '@fuse/animations';
|
||||||
import { FuseCardFace } from '@fuse/components/card/card.types';
|
import { FuseCardFace } from '@fuse/components/card/card.types';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -9,17 +8,13 @@ import { FuseCardFace } from '@fuse/components/card/card.types';
|
|||||||
templateUrl : './card.component.html',
|
templateUrl : './card.component.html',
|
||||||
styleUrls : ['./card.component.scss'],
|
styleUrls : ['./card.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
animations : fuseAnimations,
|
animations : FuseAnimations,
|
||||||
exportAs : 'fuseCard',
|
exportAs : 'fuseCard'
|
||||||
standalone : true,
|
|
||||||
imports : [NgIf],
|
|
||||||
})
|
})
|
||||||
export class FuseCardComponent implements OnChanges
|
export class FuseCardComponent implements OnChanges
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
static ngAcceptInputType_expanded: BooleanInput;
|
static ngAcceptInputType_expanded: BooleanInput;
|
||||||
static ngAcceptInputType_flippable: BooleanInput;
|
static ngAcceptInputType_flippable: BooleanInput;
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
|
|
||||||
@Input() expanded: boolean = false;
|
@Input() expanded: boolean = false;
|
||||||
@Input() face: FuseCardFace = 'front';
|
@Input() face: FuseCardFace = 'front';
|
||||||
@@ -41,14 +36,12 @@ export class FuseCardComponent implements OnChanges
|
|||||||
*/
|
*/
|
||||||
@HostBinding('class') get classList(): any
|
@HostBinding('class') get classList(): any
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
return {
|
return {
|
||||||
'fuse-card-expanded' : this.expanded,
|
'fuse-card-expanded' : this.expanded,
|
||||||
'fuse-card-face-back' : this.flippable && this.face === 'back',
|
'fuse-card-face-back' : this.flippable && this.face === 'back',
|
||||||
'fuse-card-face-front': this.flippable && this.face === 'front',
|
'fuse-card-face-front': this.flippable && this.face === 'front',
|
||||||
'fuse-card-flippable' : this.flippable,
|
'fuse-card-flippable' : this.flippable
|
||||||
};
|
};
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
18
src/@fuse/components/card/card.module.ts
Normal file
18
src/@fuse/components/card/card.module.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FuseCardComponent } from '@fuse/components/card/card.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseCardComponent
|
||||||
|
],
|
||||||
|
imports : [
|
||||||
|
CommonModule
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseCardComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseCardModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1 +1,2 @@
|
|||||||
export * from '@fuse/components/card/card.component';
|
export * from '@fuse/components/card/card.component';
|
||||||
|
export * from '@fuse/components/card/card.module';
|
||||||
|
|||||||
101
src/@fuse/components/date-range/date-range.component.html
Normal file
101
src/@fuse/components/date-range/date-range.component.html
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<div
|
||||||
|
class="range"
|
||||||
|
(click)="openPickerPanel()"
|
||||||
|
#pickerPanelOrigin>
|
||||||
|
|
||||||
|
<div class="start">
|
||||||
|
<div class="date">{{range.startDate}}</div>
|
||||||
|
<div
|
||||||
|
class="time"
|
||||||
|
*ngIf="range.startTime">{{range.startTime}}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="separator">-</div>
|
||||||
|
|
||||||
|
<div class="end">
|
||||||
|
<div class="date">{{range.endDate}}</div>
|
||||||
|
<div
|
||||||
|
class="time"
|
||||||
|
*ngIf="range.endTime">{{range.endTime}}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ng-template #pickerPanel>
|
||||||
|
|
||||||
|
<!-- Start -->
|
||||||
|
<div class="start">
|
||||||
|
|
||||||
|
<div class="month">
|
||||||
|
<div class="month-header">
|
||||||
|
<button
|
||||||
|
class="previous-button"
|
||||||
|
mat-icon-button
|
||||||
|
(click)="prev()"
|
||||||
|
tabindex="1">
|
||||||
|
<mat-icon [svgIcon]="'heroicons_outline:chevron-left'"></mat-icon>
|
||||||
|
</button>
|
||||||
|
<div class="month-label">{{getMonthLabel(1)}}</div>
|
||||||
|
</div>
|
||||||
|
<mat-month-view
|
||||||
|
[(activeDate)]="activeDates.month1"
|
||||||
|
[dateFilter]="dateFilter()"
|
||||||
|
[dateClass]="dateClass()"
|
||||||
|
(click)="$event.stopImmediatePropagation()"
|
||||||
|
(selectedChange)="onSelectedDateChange($event)"
|
||||||
|
#matMonthView1>
|
||||||
|
</mat-month-view>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<mat-form-field
|
||||||
|
class="fuse-mat-no-subscript time start-time"
|
||||||
|
*ngIf="timeRange">
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
[autocomplete]="'off'"
|
||||||
|
[formControl]="startTimeFormControl"
|
||||||
|
(blur)="updateStartTime($event)"
|
||||||
|
tabindex="3">
|
||||||
|
<mat-label>Start time</mat-label>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- End -->
|
||||||
|
<div class="end">
|
||||||
|
|
||||||
|
<div class="month">
|
||||||
|
<div class="month-header">
|
||||||
|
<div class="month-label">{{getMonthLabel(2)}}</div>
|
||||||
|
<button
|
||||||
|
class="next-button"
|
||||||
|
mat-icon-button
|
||||||
|
(click)="next()"
|
||||||
|
tabindex="2">
|
||||||
|
<mat-icon [svgIcon]="'heroicons_outline:chevron-right'"></mat-icon>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<mat-month-view
|
||||||
|
[(activeDate)]="activeDates.month2"
|
||||||
|
[dateFilter]="dateFilter()"
|
||||||
|
[dateClass]="dateClass()"
|
||||||
|
(click)="$event.stopImmediatePropagation()"
|
||||||
|
(selectedChange)="onSelectedDateChange($event)"
|
||||||
|
#matMonthView2>
|
||||||
|
</mat-month-view>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<mat-form-field
|
||||||
|
class="fuse-mat-no-subscript time end-time"
|
||||||
|
*ngIf="timeRange">
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
[formControl]="endTimeFormControl"
|
||||||
|
(blur)="updateEndTime($event)"
|
||||||
|
tabindex="4">
|
||||||
|
<mat-label>End time</mat-label>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ng-template>
|
||||||
292
src/@fuse/components/date-range/date-range.component.scss
Normal file
292
src/@fuse/components/date-range/date-range.component.scss
Normal file
@@ -0,0 +1,292 @@
|
|||||||
|
/* Variables */
|
||||||
|
$body-cell-padding: 2px;
|
||||||
|
|
||||||
|
fuse-date-range {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.range {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 48px;
|
||||||
|
min-height: 48px;
|
||||||
|
max-height: 48px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.start,
|
||||||
|
.end {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0 16px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border-width: 1px;
|
||||||
|
line-height: 1;
|
||||||
|
@apply shadow-sm border-gray-300 dark:bg-black dark:bg-opacity-5 dark:border-gray-500;
|
||||||
|
|
||||||
|
.date {
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
+ .time {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.separator {
|
||||||
|
margin: 0 2px;
|
||||||
|
|
||||||
|
@screen sm {
|
||||||
|
margin: 0 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fuse-date-range-panel {
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 24px;
|
||||||
|
@apply shadow-2xl bg-card;
|
||||||
|
|
||||||
|
.start,
|
||||||
|
.end {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.month {
|
||||||
|
max-width: 196px;
|
||||||
|
min-width: 196px;
|
||||||
|
width: 196px;
|
||||||
|
|
||||||
|
.month-header {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 32px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
.previous-button,
|
||||||
|
.next-button {
|
||||||
|
position: absolute;
|
||||||
|
width: 24px !important;
|
||||||
|
height: 24px !important;
|
||||||
|
min-height: 24px !important;
|
||||||
|
max-height: 24px !important;
|
||||||
|
line-height: 24px !important;
|
||||||
|
|
||||||
|
.mat-icon {
|
||||||
|
@apply icon-size-5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.previous-button {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.next-button {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.month-label {
|
||||||
|
font-weight: 500;
|
||||||
|
@apply text-secondary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-month-view {
|
||||||
|
display: flex;
|
||||||
|
min-height: 188px;
|
||||||
|
|
||||||
|
.mat-calendar-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
|
||||||
|
tbody {
|
||||||
|
|
||||||
|
tr {
|
||||||
|
|
||||||
|
&[aria-hidden=true] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
|
||||||
|
td:first-child {
|
||||||
|
|
||||||
|
&[aria-hidden=true] {
|
||||||
|
visibility: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
td,
|
||||||
|
td:hover {
|
||||||
|
|
||||||
|
&.fuse-date-range {
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
@apply bg-primary-200;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-calendar-body-cell-content {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.fuse-date-range-start,
|
||||||
|
&.fuse-date-range-end {
|
||||||
|
|
||||||
|
.mat-calendar-body-cell-content {
|
||||||
|
@apply bg-primary text-on-primary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-calendar-body-today {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
td.mat-calendar-body-cell {
|
||||||
|
width: 28px !important;
|
||||||
|
height: 28px !important;
|
||||||
|
padding: $body-cell-padding !important;
|
||||||
|
|
||||||
|
&.fuse-date-range {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: $body-cell-padding;
|
||||||
|
right: 0;
|
||||||
|
bottom: $body-cell-padding;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.fuse-date-range-start {
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
left: $body-cell-padding;
|
||||||
|
border-radius: 999px 0 0 999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.fuse-date-range-end,
|
||||||
|
&:last-child {
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
right: $body-cell-padding;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.fuse-date-range-end {
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
right: $body-cell-padding;
|
||||||
|
border-radius: 0 999px 999px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
left: $body-cell-padding;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
border-radius: 999px 0 0 999px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
border-radius: 0 999px 999px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-calendar-body-cell-content {
|
||||||
|
position: relative;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
td.mat-calendar-body-label {
|
||||||
|
|
||||||
|
+ td.mat-calendar-body-cell {
|
||||||
|
|
||||||
|
&.fuse-date-range {
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
border-radius: 999px 0 0 999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.fuse-date-range-start {
|
||||||
|
|
||||||
|
&.fuse-date-range-end {
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.fuse-date-range-end {
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
left: $body-cell-padding;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 196px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.start {
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-right: 20px;
|
||||||
|
|
||||||
|
.month {
|
||||||
|
|
||||||
|
.month-label {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.end {
|
||||||
|
align-items: flex-end;
|
||||||
|
margin-left: 20px;
|
||||||
|
|
||||||
|
.month {
|
||||||
|
|
||||||
|
.month-label {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
685
src/@fuse/components/date-range/date-range.component.ts
Normal file
685
src/@fuse/components/date-range/date-range.component.ts
Normal file
@@ -0,0 +1,685 @@
|
|||||||
|
import { ChangeDetectorRef, Component, ElementRef, EventEmitter, forwardRef, HostBinding, Input, OnDestroy, OnInit, Output, Renderer2, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
|
||||||
|
import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
|
||||||
|
import { Overlay } from '@angular/cdk/overlay';
|
||||||
|
import { TemplatePortal } from '@angular/cdk/portal';
|
||||||
|
import { MatCalendarCellCssClasses, MatMonthView } from '@angular/material/datepicker';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import * as moment from 'moment';
|
||||||
|
import { Moment } from 'moment';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector : 'fuse-date-range',
|
||||||
|
templateUrl : './date-range.component.html',
|
||||||
|
styleUrls : ['./date-range.component.scss'],
|
||||||
|
encapsulation: ViewEncapsulation.None,
|
||||||
|
exportAs : 'fuseDateRange',
|
||||||
|
providers : [
|
||||||
|
{
|
||||||
|
provide : NG_VALUE_ACCESSOR,
|
||||||
|
useExisting: forwardRef(() => FuseDateRangeComponent),
|
||||||
|
multi : true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnDestroy
|
||||||
|
{
|
||||||
|
@Output() readonly rangeChanged: EventEmitter<{ start: string, end: string }> = new EventEmitter<{ start: string; end: string }>();
|
||||||
|
@ViewChild('matMonthView1') private _matMonthView1: MatMonthView<any>;
|
||||||
|
@ViewChild('matMonthView2') private _matMonthView2: MatMonthView<any>;
|
||||||
|
@ViewChild('pickerPanelOrigin', {read: ElementRef}) private _pickerPanelOrigin: ElementRef;
|
||||||
|
@ViewChild('pickerPanel') private _pickerPanel: TemplateRef<any>;
|
||||||
|
@HostBinding('class.fuse-date-range') private _defaultClassNames = true;
|
||||||
|
|
||||||
|
activeDates: { month1: Moment | null, month2: Moment | null } = {
|
||||||
|
month1: null,
|
||||||
|
month2: null
|
||||||
|
};
|
||||||
|
setWhichDate: 'start' | 'end' = 'start';
|
||||||
|
startTimeFormControl: FormControl;
|
||||||
|
endTimeFormControl: FormControl;
|
||||||
|
private _dateFormat: string;
|
||||||
|
private _onChange: (value: any) => void;
|
||||||
|
private _onTouched: (value: any) => void;
|
||||||
|
private _programmaticChange!: boolean;
|
||||||
|
private _range: { start: Moment | null, end: Moment | null } = {
|
||||||
|
start: null,
|
||||||
|
end : null
|
||||||
|
};
|
||||||
|
private _timeFormat: string;
|
||||||
|
private _timeRange: boolean;
|
||||||
|
private readonly _timeRegExp: RegExp = new RegExp('^(0[0-9]|1[0-9]|2[0-4]|[0-9]):([0-5][0-9])(A|(?:AM)|P|(?:PM))?$', 'i');
|
||||||
|
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
|
private _elementRef: ElementRef,
|
||||||
|
private _overlay: Overlay,
|
||||||
|
private _renderer2: Renderer2,
|
||||||
|
private _viewContainerRef: ViewContainerRef
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this._onChange = () => {
|
||||||
|
};
|
||||||
|
this._onTouched = () => {
|
||||||
|
};
|
||||||
|
this.dateFormat = 'DD/MM/YYYY';
|
||||||
|
this.timeFormat = '12';
|
||||||
|
|
||||||
|
// Initialize the component
|
||||||
|
this._init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Accessors
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter & getter for dateFormat input
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
@Input()
|
||||||
|
set dateFormat(value: string)
|
||||||
|
{
|
||||||
|
// Return if the values are the same
|
||||||
|
if ( this._dateFormat === value )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the value
|
||||||
|
this._dateFormat = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
get dateFormat(): string
|
||||||
|
{
|
||||||
|
return this._dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter & getter for timeFormat input
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
@Input()
|
||||||
|
set timeFormat(value: string)
|
||||||
|
{
|
||||||
|
// Return if the values are the same
|
||||||
|
if ( this._timeFormat === value )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set format based on the time format input
|
||||||
|
this._timeFormat = value === '12' ? 'hh:mmA' : 'HH:mm';
|
||||||
|
}
|
||||||
|
|
||||||
|
get timeFormat(): string
|
||||||
|
{
|
||||||
|
return this._timeFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter & getter for timeRange input
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
@Input()
|
||||||
|
set timeRange(value: boolean)
|
||||||
|
{
|
||||||
|
// Return if the values are the same
|
||||||
|
if ( this._timeRange === value )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the value
|
||||||
|
this._timeRange = value;
|
||||||
|
|
||||||
|
// If the time range turned off...
|
||||||
|
if ( !value )
|
||||||
|
{
|
||||||
|
this.range = {
|
||||||
|
start: this._range.start.clone().startOf('day'),
|
||||||
|
end : this._range.end.clone().endOf('day')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get timeRange(): boolean
|
||||||
|
{
|
||||||
|
return this._timeRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter & getter for range input
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
@Input()
|
||||||
|
set range(value)
|
||||||
|
{
|
||||||
|
if ( !value )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the value is an object and has 'start' and 'end' values
|
||||||
|
if ( !value.start || !value.end )
|
||||||
|
{
|
||||||
|
console.error('Range input must have "start" and "end" properties!');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we are setting an individual date or both of them
|
||||||
|
const whichDate = value.whichDate || null;
|
||||||
|
|
||||||
|
// Get the start and end dates as moment
|
||||||
|
const start = moment(value.start);
|
||||||
|
const end = moment(value.end);
|
||||||
|
|
||||||
|
// If we are only setting the start date...
|
||||||
|
if ( whichDate === 'start' )
|
||||||
|
{
|
||||||
|
// Set the start date
|
||||||
|
this._range.start = start.clone();
|
||||||
|
|
||||||
|
// If the selected start date is after the end date...
|
||||||
|
if ( this._range.start.isAfter(this._range.end) )
|
||||||
|
{
|
||||||
|
// Set the end date to the start date but keep the end date's time
|
||||||
|
const endDate = start.clone().hours(this._range.end.hours()).minutes(this._range.end.minutes()).seconds(this._range.end.seconds());
|
||||||
|
|
||||||
|
// Test this new end date to see if it's ahead of the start date
|
||||||
|
if ( this._range.start.isBefore(endDate) )
|
||||||
|
{
|
||||||
|
// If it's, set the new end date
|
||||||
|
this._range.end = endDate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Otherwise, set the end date same as the start date
|
||||||
|
this._range.end = start.clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we are only setting the end date...
|
||||||
|
if ( whichDate === 'end' )
|
||||||
|
{
|
||||||
|
// Set the end date
|
||||||
|
this._range.end = end.clone();
|
||||||
|
|
||||||
|
// If the selected end date is before the start date...
|
||||||
|
if ( this._range.start.isAfter(this._range.end) )
|
||||||
|
{
|
||||||
|
// Set the start date to the end date but keep the start date's time
|
||||||
|
const startDate = end.clone().hours(this._range.start.hours()).minutes(this._range.start.minutes()).seconds(this._range.start.seconds());
|
||||||
|
|
||||||
|
// Test this new end date to see if it's ahead of the start date
|
||||||
|
if ( this._range.end.isAfter(startDate) )
|
||||||
|
{
|
||||||
|
// If it's, set the new start date
|
||||||
|
this._range.start = startDate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Otherwise, set the start date same as the end date
|
||||||
|
this._range.start = end.clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we are setting both dates...
|
||||||
|
if ( !whichDate )
|
||||||
|
{
|
||||||
|
// Set the start date
|
||||||
|
this._range.start = start.clone();
|
||||||
|
|
||||||
|
// If the start date is before the end date, set the end date as normal.
|
||||||
|
// If the start date is after the end date, set the end date same as the start date.
|
||||||
|
this._range.end = start.isBefore(end) ? end.clone() : start.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare another range object that holds the ISO formatted range dates
|
||||||
|
const range = {
|
||||||
|
start: this._range.start.clone().toISOString(),
|
||||||
|
end : this._range.end.clone().toISOString()
|
||||||
|
};
|
||||||
|
|
||||||
|
// Emit the range changed event with the range
|
||||||
|
this.rangeChanged.emit(range);
|
||||||
|
|
||||||
|
// Update the model with the range if the change was not a programmatic change
|
||||||
|
// Because programmatic changes trigger writeValue which triggers onChange and onTouched
|
||||||
|
// internally causing them to trigger twice which breaks the form's pristine and touched
|
||||||
|
// statuses.
|
||||||
|
if ( !this._programmaticChange )
|
||||||
|
{
|
||||||
|
this._onTouched(range);
|
||||||
|
this._onChange(range);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the active dates
|
||||||
|
this.activeDates = {
|
||||||
|
month1: this._range.start.clone(),
|
||||||
|
month2: this._range.start.clone().add(1, 'month')
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set the time form controls
|
||||||
|
this.startTimeFormControl.setValue(this._range.start.clone().format(this._timeFormat).toString());
|
||||||
|
this.endTimeFormControl.setValue(this._range.end.clone().format(this._timeFormat).toString());
|
||||||
|
|
||||||
|
// Run ngAfterContentInit on month views to trigger
|
||||||
|
// re-render on month views if they are available
|
||||||
|
if ( this._matMonthView1 && this._matMonthView2 )
|
||||||
|
{
|
||||||
|
this._matMonthView1.ngAfterContentInit();
|
||||||
|
this._matMonthView2.ngAfterContentInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the programmatic change status
|
||||||
|
this._programmaticChange = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
get range(): any
|
||||||
|
{
|
||||||
|
// Clone the range start and end
|
||||||
|
const start = this._range.start.clone();
|
||||||
|
const end = this._range.end.clone();
|
||||||
|
|
||||||
|
// Build and return the range object
|
||||||
|
return {
|
||||||
|
startDate: start.clone().format(this.dateFormat),
|
||||||
|
startTime: this.timeRange ? start.clone().format(this.timeFormat) : null,
|
||||||
|
endDate : end.clone().format(this.dateFormat),
|
||||||
|
endTime : this.timeRange ? end.clone().format(this.timeFormat) : null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Control Value Accessor
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the form model on change
|
||||||
|
*
|
||||||
|
* @param fn
|
||||||
|
*/
|
||||||
|
registerOnChange(fn: any): void
|
||||||
|
{
|
||||||
|
this._onChange = fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the form model on blur
|
||||||
|
*
|
||||||
|
* @param fn
|
||||||
|
*/
|
||||||
|
registerOnTouched(fn: any): void
|
||||||
|
{
|
||||||
|
this._onTouched = fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write to view from model when the form model changes programmatically
|
||||||
|
*
|
||||||
|
* @param range
|
||||||
|
*/
|
||||||
|
writeValue(range: { start: string, end: string }): void
|
||||||
|
{
|
||||||
|
// Set this change as a programmatic one
|
||||||
|
this._programmaticChange = true;
|
||||||
|
|
||||||
|
// Set the range
|
||||||
|
this.range = range;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
|
||||||
|
// @ TODO: Workaround until "angular/issues/20007" resolved
|
||||||
|
this.writeValue = () => {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the picker panel
|
||||||
|
*/
|
||||||
|
openPickerPanel(): void
|
||||||
|
{
|
||||||
|
// Create the overlay
|
||||||
|
const overlayRef = this._overlay.create({
|
||||||
|
panelClass : 'fuse-date-range-panel',
|
||||||
|
backdropClass : '',
|
||||||
|
hasBackdrop : true,
|
||||||
|
scrollStrategy : this._overlay.scrollStrategies.reposition(),
|
||||||
|
positionStrategy: this._overlay.position()
|
||||||
|
.flexibleConnectedTo(this._pickerPanelOrigin)
|
||||||
|
.withPositions([
|
||||||
|
{
|
||||||
|
originX : 'start',
|
||||||
|
originY : 'bottom',
|
||||||
|
overlayX: 'start',
|
||||||
|
overlayY: 'top',
|
||||||
|
offsetY : 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
originX : 'start',
|
||||||
|
originY : 'top',
|
||||||
|
overlayX: 'start',
|
||||||
|
overlayY: 'bottom',
|
||||||
|
offsetY : -8
|
||||||
|
}
|
||||||
|
])
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create a portal from the template
|
||||||
|
const templatePortal = new TemplatePortal(this._pickerPanel, this._viewContainerRef);
|
||||||
|
|
||||||
|
// On backdrop click
|
||||||
|
overlayRef.backdropClick().subscribe(() => {
|
||||||
|
|
||||||
|
// If template portal exists and attached...
|
||||||
|
if ( templatePortal && templatePortal.isAttached )
|
||||||
|
{
|
||||||
|
// Detach it
|
||||||
|
templatePortal.detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If overlay exists and attached...
|
||||||
|
if ( overlayRef && overlayRef.hasAttached() )
|
||||||
|
{
|
||||||
|
// Detach it
|
||||||
|
overlayRef.detach();
|
||||||
|
overlayRef.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Attach the portal to the overlay
|
||||||
|
overlayRef.attach(templatePortal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get month label
|
||||||
|
*
|
||||||
|
* @param month
|
||||||
|
*/
|
||||||
|
getMonthLabel(month: number): string
|
||||||
|
{
|
||||||
|
if ( month === 1 )
|
||||||
|
{
|
||||||
|
return this.activeDates.month1.clone().format('MMMM Y');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.activeDates.month2.clone().format('MMMM Y');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date class function to add/remove class names to calendar days
|
||||||
|
*/
|
||||||
|
dateClass(): any
|
||||||
|
{
|
||||||
|
return (date: Moment): MatCalendarCellCssClasses => {
|
||||||
|
|
||||||
|
// If the date is both start and end date...
|
||||||
|
if ( date.isSame(this._range.start, 'day') && date.isSame(this._range.end, 'day') )
|
||||||
|
{
|
||||||
|
return ['fuse-date-range', 'fuse-date-range-start', 'fuse-date-range-end'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the date is the start date...
|
||||||
|
if ( date.isSame(this._range.start, 'day') )
|
||||||
|
{
|
||||||
|
return ['fuse-date-range', 'fuse-date-range-start'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the date is the end date...
|
||||||
|
if ( date.isSame(this._range.end, 'day') )
|
||||||
|
{
|
||||||
|
return ['fuse-date-range', 'fuse-date-range-end'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the date is in between start and end dates...
|
||||||
|
if ( date.isBetween(this._range.start, this._range.end, 'day') )
|
||||||
|
{
|
||||||
|
return ['fuse-date-range', 'fuse-date-range-mid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date filter to enable/disable calendar days
|
||||||
|
*/
|
||||||
|
dateFilter(): any
|
||||||
|
{
|
||||||
|
return (date: Moment): boolean => {
|
||||||
|
|
||||||
|
// If we are selecting the end date, disable all the dates that comes before the start date
|
||||||
|
return !(this.setWhichDate === 'end' && date.isBefore(this._range.start, 'day'));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On selected date change
|
||||||
|
*
|
||||||
|
* @param date
|
||||||
|
*/
|
||||||
|
onSelectedDateChange(date: Moment): void
|
||||||
|
{
|
||||||
|
// Create a new range object
|
||||||
|
const newRange = {
|
||||||
|
start : this._range.start.clone().toISOString(),
|
||||||
|
end : this._range.end.clone().toISOString(),
|
||||||
|
whichDate: null
|
||||||
|
};
|
||||||
|
|
||||||
|
// Replace either the start or the end date with the new one
|
||||||
|
// depending on which date we are setting
|
||||||
|
if ( this.setWhichDate === 'start' )
|
||||||
|
{
|
||||||
|
newRange.start = moment(newRange.start).year(date.year()).month(date.month()).date(date.date()).toISOString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newRange.end = moment(newRange.end).year(date.year()).month(date.month()).date(date.date()).toISOString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the which date to the new range object
|
||||||
|
newRange.whichDate = this.setWhichDate;
|
||||||
|
|
||||||
|
// Switch which date to set on the next run
|
||||||
|
this.setWhichDate = this.setWhichDate === 'start' ? 'end' : 'start';
|
||||||
|
|
||||||
|
// Set the range
|
||||||
|
this.range = newRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Go to previous month on both views
|
||||||
|
*/
|
||||||
|
prev(): void
|
||||||
|
{
|
||||||
|
this.activeDates.month1 = moment(this.activeDates.month1).subtract(1, 'month');
|
||||||
|
this.activeDates.month2 = moment(this.activeDates.month2).subtract(1, 'month');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Go to next month on both views
|
||||||
|
*/
|
||||||
|
next(): void
|
||||||
|
{
|
||||||
|
this.activeDates.month1 = moment(this.activeDates.month1).add(1, 'month');
|
||||||
|
this.activeDates.month2 = moment(this.activeDates.month2).add(1, 'month');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the start time
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
updateStartTime(event): void
|
||||||
|
{
|
||||||
|
// Parse the time
|
||||||
|
const parsedTime = this._parseTime(event.target.value);
|
||||||
|
|
||||||
|
// Go back to the previous value if the form control is not valid
|
||||||
|
if ( this.startTimeFormControl.invalid )
|
||||||
|
{
|
||||||
|
// Override the time
|
||||||
|
const time = this._range.start.clone().format(this._timeFormat);
|
||||||
|
|
||||||
|
// Set the time
|
||||||
|
this.startTimeFormControl.setValue(time);
|
||||||
|
|
||||||
|
// Do not update the range
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the new time to the start date
|
||||||
|
const startDate = this._range.start.clone().hours(parsedTime.hours()).minutes(parsedTime.minutes());
|
||||||
|
|
||||||
|
// If the new start date is after the current end date,
|
||||||
|
// use the end date's time and set the start date again
|
||||||
|
if ( startDate.isAfter(this._range.end) )
|
||||||
|
{
|
||||||
|
const endDateHours = this._range.end.hours();
|
||||||
|
const endDateMinutes = this._range.end.minutes();
|
||||||
|
|
||||||
|
// Set the start date
|
||||||
|
startDate.hours(endDateHours).minutes(endDateMinutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If everything is okay, set the new date
|
||||||
|
this.range = {
|
||||||
|
start : startDate.toISOString(),
|
||||||
|
end : this._range.end.clone().toISOString(),
|
||||||
|
whichDate: 'start'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the end time
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
updateEndTime(event): void
|
||||||
|
{
|
||||||
|
// Parse the time
|
||||||
|
const parsedTime = this._parseTime(event.target.value);
|
||||||
|
|
||||||
|
// Go back to the previous value if the form control is not valid
|
||||||
|
if ( this.endTimeFormControl.invalid )
|
||||||
|
{
|
||||||
|
// Override the time
|
||||||
|
const time = this._range.end.clone().format(this._timeFormat);
|
||||||
|
|
||||||
|
// Set the time
|
||||||
|
this.endTimeFormControl.setValue(time);
|
||||||
|
|
||||||
|
// Do not update the range
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the new time to the end date
|
||||||
|
const endDate = this._range.end.clone().hours(parsedTime.hours()).minutes(parsedTime.minutes());
|
||||||
|
|
||||||
|
// If the new end date is before the current start date,
|
||||||
|
// use the start date's time and set the end date again
|
||||||
|
if ( endDate.isBefore(this._range.start) )
|
||||||
|
{
|
||||||
|
const startDateHours = this._range.start.hours();
|
||||||
|
const startDateMinutes = this._range.start.minutes();
|
||||||
|
|
||||||
|
// Set the end date
|
||||||
|
endDate.hours(startDateHours).minutes(startDateMinutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If everything is okay, set the new date
|
||||||
|
this.range = {
|
||||||
|
start : this._range.start.clone().toISOString(),
|
||||||
|
end : endDate.toISOString(),
|
||||||
|
whichDate: 'end'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Private methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _init(): void
|
||||||
|
{
|
||||||
|
// Start and end time form controls
|
||||||
|
this.startTimeFormControl = new FormControl('', [Validators.pattern(this._timeRegExp)]);
|
||||||
|
this.endTimeFormControl = new FormControl('', [Validators.pattern(this._timeRegExp)]);
|
||||||
|
|
||||||
|
// Set the default range
|
||||||
|
this._programmaticChange = true;
|
||||||
|
this.range = {
|
||||||
|
start: moment().startOf('day').toISOString(),
|
||||||
|
end : moment().add(1, 'day').endOf('day').toISOString()
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set the default time range
|
||||||
|
this._programmaticChange = true;
|
||||||
|
this.timeRange = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the time from the inputs
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _parseTime(value: string): Moment
|
||||||
|
{
|
||||||
|
// Parse the time using the time regexp
|
||||||
|
const timeArr = value.split(this._timeRegExp).filter((part) => part !== '');
|
||||||
|
|
||||||
|
// Get the meridiem
|
||||||
|
const meridiem = timeArr[2] || null;
|
||||||
|
|
||||||
|
// If meridiem exists...
|
||||||
|
if ( meridiem )
|
||||||
|
{
|
||||||
|
// Create a moment using 12-hours format and return it
|
||||||
|
return moment(value, 'hh:mmA').seconds(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If meridiem doesn't exist, create a moment using 24-hours format and return in
|
||||||
|
return moment(value, 'HH:mm').seconds(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
32
src/@fuse/components/date-range/date-range.module.ts
Normal file
32
src/@fuse/components/date-range/date-range.module.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatMomentDateModule } from '@angular/material-moment-adapter';
|
||||||
|
import { FuseDateRangeComponent } from '@fuse/components/date-range/date-range.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseDateRangeComponent
|
||||||
|
],
|
||||||
|
imports : [
|
||||||
|
CommonModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatDatepickerModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatMomentDateModule
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseDateRangeComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseDateRangeModule
|
||||||
|
{
|
||||||
|
}
|
||||||
1
src/@fuse/components/date-range/index.ts
Normal file
1
src/@fuse/components/date-range/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from '@fuse/components/date-range/public-api';
|
||||||
2
src/@fuse/components/date-range/public-api.ts
Normal file
2
src/@fuse/components/date-range/public-api.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export * from '@fuse/components/date-range/date-range.component';
|
||||||
|
export * from '@fuse/components/date-range/date-range.module';
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
/* Variables */
|
/* Variables */
|
||||||
:root {
|
$fuse-drawer-width: 320;
|
||||||
--fuse-drawer-width: 320px;
|
|
||||||
}
|
|
||||||
|
|
||||||
fuse-drawer {
|
fuse-drawer {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
width: var(--fuse-drawer-width);
|
width: #{$fuse-drawer-width}px;
|
||||||
min-width: var(--fuse-drawer-width);
|
min-width: #{$fuse-drawer-width}px;
|
||||||
max-width: var(--fuse-drawer-width);
|
max-width: #{$fuse-drawer-width}px;
|
||||||
z-index: 300;
|
z-index: 300;
|
||||||
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .35);
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .35);
|
||||||
@apply bg-card;
|
@apply bg-card;
|
||||||
@@ -45,7 +43,7 @@ fuse-drawer {
|
|||||||
|
|
||||||
/* Side mode */
|
/* Side mode */
|
||||||
&.fuse-drawer-mode-side {
|
&.fuse-drawer-mode-side {
|
||||||
margin-left: calc(var(--fuse-drawer-width) * -1);
|
margin-left: -#{$fuse-drawer-width}px;
|
||||||
|
|
||||||
&.fuse-drawer-opened {
|
&.fuse-drawer-opened {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
@@ -73,7 +71,7 @@ fuse-drawer {
|
|||||||
|
|
||||||
/* Side mode */
|
/* Side mode */
|
||||||
&.fuse-drawer-mode-side {
|
&.fuse-drawer-mode-side {
|
||||||
margin-right: calc(var(--fuse-drawer-width) * -1);
|
margin-right: -#{$fuse-drawer-width}px;
|
||||||
|
|
||||||
&.fuse-drawer-opened {
|
&.fuse-drawer-opened {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
@@ -118,7 +116,7 @@ fuse-drawer {
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 299;
|
z-index: 299;
|
||||||
opacity: 1;
|
opacity: 0;
|
||||||
background-color: rgba(0, 0, 0, 0.6);
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
|
||||||
/* Fixed mode */
|
/* Fixed mode */
|
||||||
|
|||||||
@@ -1,25 +1,22 @@
|
|||||||
import { animate, AnimationBuilder, AnimationPlayer, style } from '@angular/animations';
|
|
||||||
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
||||||
import { Component, ElementRef, EventEmitter, HostBinding, HostListener, Input, OnChanges, OnDestroy, OnInit, Output, Renderer2, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
import { Component, ElementRef, EventEmitter, HostBinding, HostListener, Input, OnChanges, OnDestroy, OnInit, Output, Renderer2, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||||
import { FuseDrawerService } from '@fuse/components/drawer/drawer.service';
|
import { animate, AnimationBuilder, AnimationPlayer, style } from '@angular/animations';
|
||||||
import { FuseDrawerMode, FuseDrawerPosition } from '@fuse/components/drawer/drawer.types';
|
import { FuseDrawerMode, FuseDrawerPosition } from '@fuse/components/drawer/drawer.types';
|
||||||
|
import { FuseDrawerService } from '@fuse/components/drawer/drawer.service';
|
||||||
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
||||||
|
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-drawer',
|
selector : 'fuse-drawer',
|
||||||
templateUrl : './drawer.component.html',
|
templateUrl : './drawer.component.html',
|
||||||
styleUrls : ['./drawer.component.scss'],
|
styleUrls : ['./drawer.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
exportAs : 'fuseDrawer',
|
exportAs : 'fuseDrawer'
|
||||||
standalone : true,
|
|
||||||
})
|
})
|
||||||
export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
static ngAcceptInputType_fixed: BooleanInput;
|
static ngAcceptInputType_fixed: BooleanInput;
|
||||||
static ngAcceptInputType_opened: BooleanInput;
|
static ngAcceptInputType_opened: BooleanInput;
|
||||||
static ngAcceptInputType_transparentOverlay: BooleanInput;
|
static ngAcceptInputType_transparentOverlay: BooleanInput;
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
|
|
||||||
@Input() fixed: boolean = false;
|
@Input() fixed: boolean = false;
|
||||||
@Input() mode: FuseDrawerMode = 'side';
|
@Input() mode: FuseDrawerMode = 'side';
|
||||||
@@ -33,7 +30,6 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
@Output() readonly positionChanged: EventEmitter<FuseDrawerPosition> = new EventEmitter<FuseDrawerPosition>();
|
@Output() readonly positionChanged: EventEmitter<FuseDrawerPosition> = new EventEmitter<FuseDrawerPosition>();
|
||||||
|
|
||||||
private _animationsEnabled: boolean = false;
|
private _animationsEnabled: boolean = false;
|
||||||
private readonly _handleOverlayClick: any;
|
|
||||||
private _hovered: boolean = false;
|
private _hovered: boolean = false;
|
||||||
private _overlay: HTMLElement;
|
private _overlay: HTMLElement;
|
||||||
private _player: AnimationPlayer;
|
private _player: AnimationPlayer;
|
||||||
@@ -46,13 +42,9 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
private _elementRef: ElementRef,
|
private _elementRef: ElementRef,
|
||||||
private _renderer2: Renderer2,
|
private _renderer2: Renderer2,
|
||||||
private _fuseDrawerService: FuseDrawerService,
|
private _fuseDrawerService: FuseDrawerService,
|
||||||
private _fuseUtilsService: FuseUtilsService,
|
private _fuseUtilsService: FuseUtilsService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this._handleOverlayClick = (): void =>
|
|
||||||
{
|
|
||||||
this.close();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -64,16 +56,14 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
*/
|
*/
|
||||||
@HostBinding('class') get classList(): any
|
@HostBinding('class') get classList(): any
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
return {
|
return {
|
||||||
'fuse-drawer-animations-enabled' : this._animationsEnabled,
|
'fuse-drawer-animations-enabled' : this._animationsEnabled,
|
||||||
'fuse-drawer-fixed' : this.fixed,
|
'fuse-drawer-fixed' : this.fixed,
|
||||||
'fuse-drawer-hover' : this._hovered,
|
'fuse-drawer-hover' : this._hovered,
|
||||||
[`fuse-drawer-mode-${this.mode}`] : true,
|
[`fuse-drawer-mode-${this.mode}`] : true,
|
||||||
'fuse-drawer-opened' : this.opened,
|
'fuse-drawer-opened' : this.opened,
|
||||||
[`fuse-drawer-position-${this.position}`]: true,
|
[`fuse-drawer-position-${this.position}`]: true
|
||||||
};
|
};
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,44 +72,10 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
@HostBinding('style') get styleList(): any
|
@HostBinding('style') get styleList(): any
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
'visibility': this.opened ? 'visible' : 'hidden',
|
'visibility': this.opened ? 'visible' : 'hidden'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
// @ Decorated methods
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On mouseenter
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
@HostListener('mouseenter')
|
|
||||||
private _onMouseenter(): void
|
|
||||||
{
|
|
||||||
// Enable the animations
|
|
||||||
this._enableAnimations();
|
|
||||||
|
|
||||||
// Set the hovered
|
|
||||||
this._hovered = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On mouseleave
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
@HostListener('mouseleave')
|
|
||||||
private _onMouseleave(): void
|
|
||||||
{
|
|
||||||
// Enable the animations
|
|
||||||
this._enableAnimations();
|
|
||||||
|
|
||||||
// Set the hovered
|
|
||||||
this._hovered = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
// @ Lifecycle hooks
|
// @ Lifecycle hooks
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -175,8 +131,7 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
// Enable the animations after a delay
|
// Enable the animations after a delay
|
||||||
// The delay must be bigger than the current transition-duration
|
// The delay must be bigger than the current transition-duration
|
||||||
// to make sure nothing will be animated while the mode is changing
|
// to make sure nothing will be animated while the mode is changing
|
||||||
setTimeout(() =>
|
setTimeout(() => {
|
||||||
{
|
|
||||||
this._enableAnimations();
|
this._enableAnimations();
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
@@ -220,12 +175,6 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
*/
|
*/
|
||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Finish the animation
|
|
||||||
if ( this._player )
|
|
||||||
{
|
|
||||||
this._player.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deregister the drawer from the registry
|
// Deregister the drawer from the registry
|
||||||
this._fuseDrawerService.deregisterComponent(this.name);
|
this._fuseDrawerService.deregisterComponent(this.name);
|
||||||
}
|
}
|
||||||
@@ -327,6 +276,12 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
// Create the backdrop element
|
// Create the backdrop element
|
||||||
this._overlay = this._renderer2.createElement('div');
|
this._overlay = this._renderer2.createElement('div');
|
||||||
|
|
||||||
|
// Return if overlay couldn't be create for some reason
|
||||||
|
if ( !this._overlay )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Add a class to the backdrop element
|
// Add a class to the backdrop element
|
||||||
this._overlay.classList.add('fuse-drawer-overlay');
|
this._overlay.classList.add('fuse-drawer-overlay');
|
||||||
|
|
||||||
@@ -345,17 +300,18 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
// Append the backdrop to the parent of the drawer
|
// Append the backdrop to the parent of the drawer
|
||||||
this._renderer2.appendChild(this._elementRef.nativeElement.parentElement, this._overlay);
|
this._renderer2.appendChild(this._elementRef.nativeElement.parentElement, this._overlay);
|
||||||
|
|
||||||
// Create enter animation and attach it to the player
|
// Create the enter animation and attach it to the player
|
||||||
this._player = this._animationBuilder.build([
|
this._player = this._animationBuilder.build([
|
||||||
style({opacity: 0}),
|
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 1}))
|
||||||
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 1})),
|
|
||||||
]).create(this._overlay);
|
]).create(this._overlay);
|
||||||
|
|
||||||
// Play the animation
|
// Play the animation
|
||||||
this._player.play();
|
this._player.play();
|
||||||
|
|
||||||
// Add an event listener to the overlay
|
// Add an event listener to the overlay
|
||||||
this._overlay.addEventListener('click', this._handleOverlayClick);
|
this._overlay.addEventListener('click', () => {
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -372,28 +328,55 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
|
|
||||||
// Create the leave animation and attach it to the player
|
// Create the leave animation and attach it to the player
|
||||||
this._player = this._animationBuilder.build([
|
this._player = this._animationBuilder.build([
|
||||||
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 0})),
|
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 0}))
|
||||||
]).create(this._overlay);
|
]).create(this._overlay);
|
||||||
|
|
||||||
// Play the animation
|
// Play the animation
|
||||||
this._player.play();
|
this._player.play();
|
||||||
|
|
||||||
// Once the animation is done...
|
// Once the animation is done...
|
||||||
this._player.onDone(() =>
|
this._player.onDone(() => {
|
||||||
{
|
|
||||||
// If the overlay still exists...
|
// If the backdrop still exists...
|
||||||
if ( this._overlay )
|
if ( this._overlay )
|
||||||
{
|
{
|
||||||
// Remove the event listener
|
// Remove the backdrop
|
||||||
this._overlay.removeEventListener('click', this._handleOverlayClick);
|
|
||||||
|
|
||||||
// Remove the overlay
|
|
||||||
this._overlay.parentNode.removeChild(this._overlay);
|
this._overlay.parentNode.removeChild(this._overlay);
|
||||||
this._overlay = null;
|
this._overlay = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On mouseenter
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
@HostListener('mouseenter')
|
||||||
|
private _onMouseenter(): void
|
||||||
|
{
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Set the hovered
|
||||||
|
this._hovered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On mouseleave
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
@HostListener('mouseleave')
|
||||||
|
private _onMouseleave(): void
|
||||||
|
{
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Set the hovered
|
||||||
|
this._hovered = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open/close the drawer
|
* Open/close the drawer
|
||||||
*
|
*
|
||||||
|
|||||||
18
src/@fuse/components/drawer/drawer.module.ts
Normal file
18
src/@fuse/components/drawer/drawer.module.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FuseDrawerComponent } from '@fuse/components/drawer/drawer.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseDrawerComponent
|
||||||
|
],
|
||||||
|
imports : [
|
||||||
|
CommonModule
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseDrawerComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseDrawerModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { FuseDrawerComponent } from '@fuse/components/drawer/drawer.component';
|
import { FuseDrawerComponent } from '@fuse/components/drawer/drawer.component';
|
||||||
|
|
||||||
@Injectable({providedIn: 'root'})
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
export class FuseDrawerService
|
export class FuseDrawerService
|
||||||
{
|
{
|
||||||
private _componentRegistry: Map<string, FuseDrawerComponent> = new Map<string, FuseDrawerComponent>();
|
private _componentRegistry: Map<string, FuseDrawerComponent> = new Map<string, FuseDrawerComponent>();
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
export * from '@fuse/components/drawer/drawer.component';
|
export * from '@fuse/components/drawer/drawer.component';
|
||||||
|
export * from '@fuse/components/drawer/drawer.module';
|
||||||
export * from '@fuse/components/drawer/drawer.service';
|
export * from '@fuse/components/drawer/drawer.service';
|
||||||
export * from '@fuse/components/drawer/drawer.types';
|
export * from '@fuse/components/drawer/drawer.types';
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
<!-- Button -->
|
<!-- Button -->
|
||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
[matTooltip]="tooltip || 'Toggle Fullscreen'"
|
[matTooltip]="'Toggle Fullscreen'"
|
||||||
(click)="toggleFullscreen()">
|
(click)="toggleFullscreen()">
|
||||||
<ng-container [ngTemplateOutlet]="iconTpl || defaultIconTpl"></ng-container>
|
<mat-icon [svgIcon]="'heroicons_outline:arrows-expand'"></mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Default icon -->
|
|
||||||
<ng-template #defaultIconTpl>
|
|
||||||
<mat-icon [svgIcon]="'heroicons_outline:arrows-pointing-out'"></mat-icon>
|
|
||||||
</ng-template>
|
|
||||||
|
|||||||
@@ -1,27 +1,39 @@
|
|||||||
import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
|
import { ChangeDetectionStrategy, Component, Inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ChangeDetectionStrategy, Component, Inject, Input, TemplateRef, ViewEncapsulation } from '@angular/core';
|
import { DOCUMENT } from '@angular/common';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { FSDocument, FSDocumentElement } from '@fuse/components/fullscreen/fullscreen.types';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fuse-fullscreen',
|
selector : 'fuse-fullscreen',
|
||||||
templateUrl: './fullscreen.component.html',
|
templateUrl : './fullscreen.component.html',
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation : ViewEncapsulation.None,
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
exportAs: 'fuseFullscreen',
|
exportAs : 'fuseFullscreen'
|
||||||
standalone: true,
|
|
||||||
imports: [MatButtonModule, MatTooltipModule, NgTemplateOutlet, MatIconModule],
|
|
||||||
})
|
})
|
||||||
export class FuseFullscreenComponent
|
export class FuseFullscreenComponent implements OnInit
|
||||||
{
|
{
|
||||||
@Input() iconTpl: TemplateRef<any>;
|
private _fsDoc: FSDocument;
|
||||||
@Input() tooltip: string;
|
private _fsDocEl: FSDocumentElement;
|
||||||
|
private _isFullscreen: boolean = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
constructor(@Inject(DOCUMENT) private _document: Document) { }
|
constructor(@Inject(DOCUMENT) private _document: Document)
|
||||||
|
{
|
||||||
|
this._fsDoc = _document as FSDocument;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
this._fsDocEl = document.documentElement as FSDocumentElement;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
// @ Public methods
|
// @ Public methods
|
||||||
@@ -32,27 +44,121 @@ export class FuseFullscreenComponent
|
|||||||
*/
|
*/
|
||||||
toggleFullscreen(): void
|
toggleFullscreen(): void
|
||||||
{
|
{
|
||||||
if (!this._document.fullscreenEnabled)
|
// Check if the fullscreen is open
|
||||||
{
|
this._isFullscreen = this._getBrowserFullscreenElement() !== null;
|
||||||
console.log('Fullscreen is not available in this browser.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the fullscreen is already open
|
|
||||||
const fullScreen = this._document.fullscreenElement;
|
|
||||||
|
|
||||||
// Toggle the fullscreen
|
// Toggle the fullscreen
|
||||||
if (fullScreen)
|
if ( this._isFullscreen )
|
||||||
{
|
{
|
||||||
this._document.exitFullscreen();
|
this._closeFullscreen();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._document.documentElement.requestFullscreen()
|
this._openFullscreen();
|
||||||
.catch(() =>
|
}
|
||||||
{
|
}
|
||||||
console.error('Entering fullscreen mode failed.');
|
|
||||||
});
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Private methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get browser's fullscreen element
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _getBrowserFullscreenElement(): Element
|
||||||
|
{
|
||||||
|
if ( typeof this._fsDoc.fullscreenElement !== 'undefined' )
|
||||||
|
{
|
||||||
|
return this._fsDoc.fullscreenElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( typeof this._fsDoc.mozFullScreenElement !== 'undefined' )
|
||||||
|
{
|
||||||
|
return this._fsDoc.mozFullScreenElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( typeof this._fsDoc.msFullscreenElement !== 'undefined' )
|
||||||
|
{
|
||||||
|
return this._fsDoc.msFullscreenElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( typeof this._fsDoc.webkitFullscreenElement !== 'undefined' )
|
||||||
|
{
|
||||||
|
return this._fsDoc.webkitFullscreenElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error('Fullscreen mode is not supported by this browser');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the fullscreen
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _openFullscreen(): void
|
||||||
|
{
|
||||||
|
if ( this._fsDocEl.requestFullscreen )
|
||||||
|
{
|
||||||
|
this._fsDocEl.requestFullscreen();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Firefox
|
||||||
|
if ( this._fsDocEl.mozRequestFullScreen )
|
||||||
|
{
|
||||||
|
this._fsDocEl.mozRequestFullScreen();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chrome, Safari and Opera
|
||||||
|
if ( this._fsDocEl.webkitRequestFullscreen )
|
||||||
|
{
|
||||||
|
this._fsDocEl.webkitRequestFullscreen();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// IE/Edge
|
||||||
|
if ( this._fsDocEl.msRequestFullscreen )
|
||||||
|
{
|
||||||
|
this._fsDocEl.msRequestFullscreen();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the fullscreen
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _closeFullscreen(): void
|
||||||
|
{
|
||||||
|
if ( this._fsDoc.exitFullscreen )
|
||||||
|
{
|
||||||
|
this._fsDoc.exitFullscreen();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Firefox
|
||||||
|
if ( this._fsDoc.mozCancelFullScreen )
|
||||||
|
{
|
||||||
|
this._fsDoc.mozCancelFullScreen();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chrome, Safari and Opera
|
||||||
|
if ( this._fsDoc.webkitExitFullscreen )
|
||||||
|
{
|
||||||
|
this._fsDoc.webkitExitFullscreen();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// IE/Edge
|
||||||
|
else if ( this._fsDoc.msExitFullscreen )
|
||||||
|
{
|
||||||
|
this._fsDoc.msExitFullscreen();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
src/@fuse/components/fullscreen/fullscreen.module.ts
Normal file
22
src/@fuse/components/fullscreen/fullscreen.module.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
import { FuseFullscreenComponent } from '@fuse/components/fullscreen/fullscreen.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseFullscreenComponent
|
||||||
|
],
|
||||||
|
imports : [
|
||||||
|
MatButtonModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatTooltipModule
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseFullscreenComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseFullscreenModule
|
||||||
|
{
|
||||||
|
}
|
||||||
16
src/@fuse/components/fullscreen/fullscreen.types.ts
Normal file
16
src/@fuse/components/fullscreen/fullscreen.types.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
export interface FSDocument extends HTMLDocument
|
||||||
|
{
|
||||||
|
mozFullScreenElement?: Element;
|
||||||
|
mozCancelFullScreen?: () => void;
|
||||||
|
msFullscreenElement?: Element;
|
||||||
|
msExitFullscreen?: () => void;
|
||||||
|
webkitFullscreenElement?: Element;
|
||||||
|
webkitExitFullscreen?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FSDocumentElement extends HTMLElement
|
||||||
|
{
|
||||||
|
mozRequestFullScreen?: () => void;
|
||||||
|
msRequestFullscreen?: () => void;
|
||||||
|
webkitRequestFullscreen?: () => void;
|
||||||
|
}
|
||||||
@@ -1 +1,3 @@
|
|||||||
export * from '@fuse/components/fullscreen/fullscreen.component';
|
export * from '@fuse/components/fullscreen/fullscreen.component';
|
||||||
|
export * from '@fuse/components/fullscreen/fullscreen.module';
|
||||||
|
export * from '@fuse/components/fullscreen/fullscreen.types';
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { NgClass } from '@angular/common';
|
|
||||||
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EmbeddedViewRef, Input, OnChanges, Renderer2, SecurityContext, SimpleChanges, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
|
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EmbeddedViewRef, Input, OnChanges, Renderer2, SecurityContext, SimpleChanges, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
|
||||||
import { DomSanitizer } from '@angular/platform-browser';
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
import { FuseHighlightService } from '@fuse/components/highlight/highlight.service';
|
import { FuseHighlightService } from '@fuse/components/highlight/highlight.service';
|
||||||
@@ -9,9 +8,7 @@ import { FuseHighlightService } from '@fuse/components/highlight/highlight.servi
|
|||||||
styleUrls : ['./highlight.component.scss'],
|
styleUrls : ['./highlight.component.scss'],
|
||||||
encapsulation : ViewEncapsulation.None,
|
encapsulation : ViewEncapsulation.None,
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
exportAs : 'fuseHighlight',
|
exportAs : 'fuseHighlight'
|
||||||
standalone : true,
|
|
||||||
imports : [NgClass],
|
|
||||||
})
|
})
|
||||||
export class FuseHighlightComponent implements OnChanges, AfterViewInit
|
export class FuseHighlightComponent implements OnChanges, AfterViewInit
|
||||||
{
|
{
|
||||||
@@ -31,7 +28,7 @@ export class FuseHighlightComponent implements OnChanges, AfterViewInit
|
|||||||
private _elementRef: ElementRef,
|
private _elementRef: ElementRef,
|
||||||
private _renderer2: Renderer2,
|
private _renderer2: Renderer2,
|
||||||
private _fuseHighlightService: FuseHighlightService,
|
private _fuseHighlightService: FuseHighlightService,
|
||||||
private _viewContainerRef: ViewContainerRef,
|
private _viewContainerRef: ViewContainerRef
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -126,7 +123,7 @@ export class FuseHighlightComponent implements OnChanges, AfterViewInit
|
|||||||
// Render and insert the template
|
// Render and insert the template
|
||||||
this._viewRef = this._viewContainerRef.createEmbeddedView(this.templateRef, {
|
this._viewRef = this._viewContainerRef.createEmbeddedView(this.templateRef, {
|
||||||
highlightedCode: this.highlightedCode,
|
highlightedCode: this.highlightedCode,
|
||||||
lang : this.lang,
|
lang : this.lang
|
||||||
});
|
});
|
||||||
|
|
||||||
// Detect the changes
|
// Detect the changes
|
||||||
|
|||||||
18
src/@fuse/components/highlight/highlight.module.ts
Normal file
18
src/@fuse/components/highlight/highlight.module.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FuseHighlightComponent } from '@fuse/components/highlight/highlight.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseHighlightComponent
|
||||||
|
],
|
||||||
|
imports : [
|
||||||
|
CommonModule
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseHighlightComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseHighlightModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import hljs from 'highlight.js';
|
import * as hljs from 'highlight.js';
|
||||||
|
|
||||||
@Injectable({providedIn: 'root'})
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
export class FuseHighlightService
|
export class FuseHighlightService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -58,23 +60,23 @@ export class FuseHighlightService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Iterate through the lines
|
// Iterate through the lines
|
||||||
lines.filter(line => line.length)
|
lines.filter((line) => line.length)
|
||||||
.forEach((line, index) =>
|
.forEach((line, index) => {
|
||||||
{
|
|
||||||
// Always get the indentation of the first line so we can
|
|
||||||
// have something to compare with
|
|
||||||
if ( index === 0 )
|
|
||||||
{
|
|
||||||
indentation = line.search(/\S|$/);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look at all the remaining lines to figure out the smallest indentation.
|
// Always get the indentation of the first line so we can
|
||||||
indentation = Math.min(line.search(/\S|$/), indentation);
|
// have something to compare with
|
||||||
});
|
if ( index === 0 )
|
||||||
|
{
|
||||||
|
indentation = line.search(/\S|$/);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look at all the remaining lines to figure out the smallest indentation.
|
||||||
|
indentation = Math.min(line.search(/\S|$/), indentation);
|
||||||
|
});
|
||||||
|
|
||||||
// Iterate through the lines one more time, remove the extra
|
// Iterate through the lines one more time, remove the extra
|
||||||
// indentation, join them together and return it
|
// indentation, join them together and return it
|
||||||
return lines.map(line => line.substring(indentation)).join('\n');
|
return lines.map((line) => line.substring(indentation)).join('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
export * from '@fuse/components/highlight/highlight.component';
|
export * from '@fuse/components/highlight/highlight.component';
|
||||||
|
export * from '@fuse/components/highlight/highlight.module';
|
||||||
export * from '@fuse/components/highlight/highlight.service';
|
export * from '@fuse/components/highlight/highlight.service';
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from '@fuse/components/loading-bar/public-api';
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<ng-container *ngIf="show">
|
|
||||||
<mat-progress-bar
|
|
||||||
[mode]="mode"
|
|
||||||
[value]="progress"></mat-progress-bar>
|
|
||||||
</ng-container>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fuse-loading-bar {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
z-index: 999;
|
|
||||||
width: 100%;
|
|
||||||
height: 6px;
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
||||||
import { NgIf } from '@angular/common';
|
|
||||||
import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
|
||||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
||||||
import { FuseLoadingService } from '@fuse/services/loading';
|
|
||||||
import { Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector : 'fuse-loading-bar',
|
|
||||||
templateUrl : './loading-bar.component.html',
|
|
||||||
styleUrls : ['./loading-bar.component.scss'],
|
|
||||||
encapsulation: ViewEncapsulation.None,
|
|
||||||
exportAs : 'fuseLoadingBar',
|
|
||||||
standalone : true,
|
|
||||||
imports : [NgIf, MatProgressBarModule],
|
|
||||||
})
|
|
||||||
export class FuseLoadingBarComponent implements OnChanges, OnInit, OnDestroy
|
|
||||||
{
|
|
||||||
@Input() autoMode: boolean = true;
|
|
||||||
mode: 'determinate' | 'indeterminate';
|
|
||||||
progress: number = 0;
|
|
||||||
show: boolean = false;
|
|
||||||
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
constructor(private _fuseLoadingService: FuseLoadingService)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
// @ Lifecycle hooks
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On changes
|
|
||||||
*
|
|
||||||
* @param changes
|
|
||||||
*/
|
|
||||||
ngOnChanges(changes: SimpleChanges): void
|
|
||||||
{
|
|
||||||
// Auto mode
|
|
||||||
if ( 'autoMode' in changes )
|
|
||||||
{
|
|
||||||
// Set the auto mode in the service
|
|
||||||
this._fuseLoadingService.setAutoMode(coerceBooleanProperty(changes.autoMode.currentValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On init
|
|
||||||
*/
|
|
||||||
ngOnInit(): void
|
|
||||||
{
|
|
||||||
// Subscribe to the service
|
|
||||||
this._fuseLoadingService.mode$
|
|
||||||
.pipe(takeUntil(this._unsubscribeAll))
|
|
||||||
.subscribe((value) =>
|
|
||||||
{
|
|
||||||
this.mode = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
this._fuseLoadingService.progress$
|
|
||||||
.pipe(takeUntil(this._unsubscribeAll))
|
|
||||||
.subscribe((value) =>
|
|
||||||
{
|
|
||||||
this.progress = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
this._fuseLoadingService.show$
|
|
||||||
.pipe(takeUntil(this._unsubscribeAll))
|
|
||||||
.subscribe((value) =>
|
|
||||||
{
|
|
||||||
this.show = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On destroy
|
|
||||||
*/
|
|
||||||
ngOnDestroy(): void
|
|
||||||
{
|
|
||||||
// Unsubscribe from all subscriptions
|
|
||||||
this._unsubscribeAll.next(null);
|
|
||||||
this._unsubscribeAll.complete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from '@fuse/components/loading-bar/loading-bar.component';
|
|
||||||
@@ -1 +1 @@
|
|||||||
export * from '@fuse/components/masonry/public-api';
|
export * from '@fuse/components/card/public-api';
|
||||||
|
|||||||
0
src/@fuse/components/masonry/masonry.component.scss
Normal file
0
src/@fuse/components/masonry/masonry.component.scss
Normal file
@@ -1,16 +1,14 @@
|
|||||||
import { NgTemplateOutlet } from '@angular/common';
|
|
||||||
import { AfterViewInit, Component, Input, OnChanges, SimpleChanges, TemplateRef, ViewEncapsulation } from '@angular/core';
|
import { AfterViewInit, Component, Input, OnChanges, SimpleChanges, TemplateRef, ViewEncapsulation } from '@angular/core';
|
||||||
import { fuseAnimations } from '@fuse/animations';
|
import { FuseAnimations } from '@fuse/animations';
|
||||||
import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
|
import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-masonry',
|
selector : 'fuse-masonry',
|
||||||
templateUrl : './masonry.component.html',
|
templateUrl : './masonry.component.html',
|
||||||
|
styleUrls : ['./masonry.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
animations : fuseAnimations,
|
animations : FuseAnimations,
|
||||||
exportAs : 'fuseMasonry',
|
exportAs : 'fuseMasonry'
|
||||||
standalone : true,
|
|
||||||
imports : [NgTemplateOutlet],
|
|
||||||
})
|
})
|
||||||
export class FuseMasonryComponent implements OnChanges, AfterViewInit
|
export class FuseMasonryComponent implements OnChanges, AfterViewInit
|
||||||
{
|
{
|
||||||
|
|||||||
18
src/@fuse/components/masonry/masonry.module.ts
Normal file
18
src/@fuse/components/masonry/masonry.module.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FuseMasonryComponent } from '@fuse/components/masonry/masonry.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseMasonryComponent
|
||||||
|
],
|
||||||
|
imports : [
|
||||||
|
CommonModule
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseMasonryComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseMasonryModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1 +1,2 @@
|
|||||||
export * from '@fuse/components/masonry/masonry.component';
|
export * from '@fuse/components/masonry/masonry.component';
|
||||||
|
export * from '@fuse/components/masonry/masonry.module';
|
||||||
|
|||||||
@@ -5,91 +5,69 @@
|
|||||||
[ngClass]="item.classes?.wrapper">
|
[ngClass]="item.classes?.wrapper">
|
||||||
|
|
||||||
<!-- Item with an internal link -->
|
<!-- Item with an internal link -->
|
||||||
<ng-container *ngIf="item.link && !item.externalLink && !item.function && !item.disabled">
|
<div
|
||||||
<div
|
class="fuse-horizontal-navigation-item"
|
||||||
class="fuse-horizontal-navigation-item"
|
*ngIf="item.link && !item.externalLink && !item.function && !item.disabled"
|
||||||
[ngClass]="{'fuse-horizontal-navigation-item-active-forced': item.active}"
|
[ngClass]="{'fuse-horizontal-navigation-item-active-forced': item.active}"
|
||||||
[routerLink]="[item.link]"
|
[routerLink]="[item.link]"
|
||||||
[fragment]="item.fragment ?? null"
|
[routerLinkActive]="'fuse-horizontal-navigation-item-active'"
|
||||||
[preserveFragment]="item.preserveFragment ?? false"
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}">
|
||||||
[queryParams]="item.queryParams ?? null"
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
[queryParamsHandling]="item.queryParamsHandling ?? null"
|
</div>
|
||||||
[routerLinkActive]="'fuse-horizontal-navigation-item-active'"
|
|
||||||
[routerLinkActiveOptions]="isActiveMatchOptions"
|
|
||||||
[matTooltip]="item.tooltip || ''">
|
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
|
||||||
</div>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item with an external link -->
|
<!-- Item with an external link -->
|
||||||
<ng-container *ngIf="item.link && item.externalLink && !item.function && !item.disabled">
|
<a
|
||||||
<a
|
class="fuse-horizontal-navigation-item"
|
||||||
class="fuse-horizontal-navigation-item"
|
*ngIf="item.link && item.externalLink && !item.function && !item.disabled"
|
||||||
[href]="item.link"
|
[href]="item.link">
|
||||||
[target]="item.target || '_self'"
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
[matTooltip]="item.tooltip || ''">
|
</a>
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
|
||||||
</a>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item with a function -->
|
<!-- Item with a function -->
|
||||||
<ng-container *ngIf="!item.link && item.function && !item.disabled">
|
<div
|
||||||
<div
|
class="fuse-horizontal-navigation-item"
|
||||||
class="fuse-horizontal-navigation-item"
|
*ngIf="!item.link && item.function && !item.disabled"
|
||||||
[ngClass]="{'fuse-horizontal-navigation-item-active-forced': item.active}"
|
[ngClass]="{'fuse-horizontal-navigation-item-active-forced': item.active}"
|
||||||
[matTooltip]="item.tooltip || ''"
|
(click)="item.function(item)">
|
||||||
(click)="item.function(item)">
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
</div>
|
||||||
</div>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item with an internal link and function -->
|
<!-- Item with an internal link and function -->
|
||||||
<ng-container *ngIf="item.link && !item.externalLink && item.function && !item.disabled">
|
<div
|
||||||
<div
|
class="fuse-horizontal-navigation-item"
|
||||||
class="fuse-horizontal-navigation-item"
|
*ngIf="item.link && !item.externalLink && item.function && !item.disabled"
|
||||||
[ngClass]="{'fuse-horizontal-navigation-item-active-forced': item.active}"
|
[ngClass]="{'fuse-horizontal-navigation-item-active-forced': item.active}"
|
||||||
[routerLink]="[item.link]"
|
[routerLink]="[item.link]"
|
||||||
[fragment]="item.fragment ?? null"
|
[routerLinkActive]="'fuse-horizontal-navigation-item-active'"
|
||||||
[preserveFragment]="item.preserveFragment ?? false"
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}"
|
||||||
[queryParams]="item.queryParams ?? null"
|
(click)="item.function(item)">
|
||||||
[queryParamsHandling]="item.queryParamsHandling ?? null"
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
[routerLinkActive]="'fuse-horizontal-navigation-item-active'"
|
</div>
|
||||||
[routerLinkActiveOptions]="isActiveMatchOptions"
|
|
||||||
[matTooltip]="item.tooltip || ''"
|
|
||||||
(click)="item.function(item)">
|
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
|
||||||
</div>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item with an external link and function -->
|
<!-- Item with an external link and function -->
|
||||||
<ng-container *ngIf="item.link && item.externalLink && item.function && !item.disabled">
|
<a
|
||||||
<a
|
class="fuse-horizontal-navigation-item"
|
||||||
class="fuse-horizontal-navigation-item"
|
*ngIf="item.link && item.externalLink && item.function && !item.disabled"
|
||||||
[href]="item.link"
|
[href]="item.link"
|
||||||
[target]="item.target || '_self'"
|
(click)="item.function(item)"
|
||||||
[matTooltip]="item.tooltip || ''"
|
mat-menu-item>
|
||||||
(click)="item.function(item)"
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
mat-menu-item>
|
</a>
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
|
||||||
</a>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item with a no link and no function -->
|
<!-- Item with a no link and no function -->
|
||||||
<ng-container *ngIf="!item.link && !item.function && !item.disabled">
|
<div
|
||||||
<div
|
class="fuse-horizontal-navigation-item"
|
||||||
class="fuse-horizontal-navigation-item"
|
*ngIf="!item.link && !item.function && !item.disabled"
|
||||||
[ngClass]="{'fuse-horizontal-navigation-item-active-forced': item.active}"
|
[ngClass]="{'fuse-horizontal-navigation-item-active-forced': item.active}">
|
||||||
[matTooltip]="item.tooltip || ''">
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
</div>
|
||||||
</div>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item is disabled -->
|
<!-- Item is disabled -->
|
||||||
<ng-container *ngIf="item.disabled">
|
<div
|
||||||
<div class="fuse-horizontal-navigation-item fuse-horizontal-navigation-item-disabled">
|
class="fuse-horizontal-navigation-item fuse-horizontal-navigation-item-disabled"
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
*ngIf="item.disabled">
|
||||||
</div>
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
</ng-container>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -97,12 +75,11 @@
|
|||||||
<ng-template #itemTemplate>
|
<ng-template #itemTemplate>
|
||||||
|
|
||||||
<!-- Icon -->
|
<!-- Icon -->
|
||||||
<ng-container *ngIf="item.icon">
|
<mat-icon
|
||||||
<mat-icon
|
class="fuse-horizontal-navigation-item-icon"
|
||||||
class="fuse-horizontal-navigation-item-icon"
|
[ngClass]="item.classes?.icon"
|
||||||
[ngClass]="item.classes?.icon"
|
*ngIf="item.icon"
|
||||||
[svgIcon]="item.icon"></mat-icon>
|
[svgIcon]="item.icon"></mat-icon>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Title & Subtitle -->
|
<!-- Title & Subtitle -->
|
||||||
<div class="fuse-horizontal-navigation-item-title-wrapper">
|
<div class="fuse-horizontal-navigation-item-title-wrapper">
|
||||||
@@ -111,24 +88,24 @@
|
|||||||
{{item.title}}
|
{{item.title}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="item.subtitle">
|
<div
|
||||||
<div class="fuse-horizontal-navigation-item-subtitle text-hint">
|
class="fuse-horizontal-navigation-item-subtitle text-hint"
|
||||||
<span [ngClass]="item.classes?.subtitle">
|
*ngIf="item.subtitle">
|
||||||
{{item.subtitle}}
|
<span [ngClass]="item.classes?.subtitle">
|
||||||
</span>
|
{{item.subtitle}}
|
||||||
</div>
|
</span>
|
||||||
</ng-container>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Badge -->
|
<!-- Badge -->
|
||||||
<ng-container *ngIf="item.badge">
|
<div
|
||||||
<div class="fuse-horizontal-navigation-item-badge">
|
class="fuse-horizontal-navigation-item-badge"
|
||||||
<div
|
*ngIf="item.badge">
|
||||||
class="fuse-horizontal-navigation-item-badge-content"
|
<div
|
||||||
[ngClass]="item.badge.classes">
|
class="fuse-horizontal-navigation-item-badge-content"
|
||||||
{{item.badge.title}}
|
[ngClass]="item.badge.classes">
|
||||||
</div>
|
{{item.badge.title}}
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</div>
|
||||||
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@@ -1,28 +1,21 @@
|
|||||||
import { NgClass, NgIf, NgTemplateOutlet } from '@angular/common';
|
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { Subject } from 'rxjs';
|
||||||
import { MatMenuModule } from '@angular/material/menu';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
||||||
import { IsActiveMatchOptions, RouterLink, RouterLinkActive } from '@angular/router';
|
|
||||||
import { FuseHorizontalNavigationComponent } from '@fuse/components/navigation/horizontal/horizontal.component';
|
import { FuseHorizontalNavigationComponent } from '@fuse/components/navigation/horizontal/horizontal.component';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
|
||||||
import { Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-horizontal-navigation-basic-item',
|
selector : 'fuse-horizontal-navigation-basic-item',
|
||||||
templateUrl : './basic.component.html',
|
templateUrl : './basic.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
styles : [],
|
||||||
standalone : true,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
imports : [NgClass, NgIf, RouterLink, RouterLinkActive, MatTooltipModule, NgTemplateOutlet, MatMenuModule, MatIconModule],
|
|
||||||
})
|
})
|
||||||
export class FuseHorizontalNavigationBasicItemComponent implements OnInit, OnDestroy
|
export class FuseHorizontalNavigationBasicItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@Input() item: FuseNavigationItem;
|
@Input() item: FuseNavigationItem;
|
||||||
@Input() name: string;
|
@Input() name: string;
|
||||||
|
|
||||||
isActiveMatchOptions: IsActiveMatchOptions;
|
|
||||||
private _fuseHorizontalNavigationComponent: FuseHorizontalNavigationComponent;
|
private _fuseHorizontalNavigationComponent: FuseHorizontalNavigationComponent;
|
||||||
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
||||||
|
|
||||||
@@ -31,15 +24,9 @@ export class FuseHorizontalNavigationBasicItemComponent implements OnInit, OnDes
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService
|
||||||
private _fuseUtilsService: FuseUtilsService,
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Set the equivalent of {exact: false} as default for active match options.
|
|
||||||
// We are not assigning the item.isActiveMatchOptions directly to the
|
|
||||||
// [routerLinkActiveOptions] because if it's "undefined" initially, the router
|
|
||||||
// will throw an error and stop working.
|
|
||||||
this.isActiveMatchOptions = this._fuseUtilsService.subsetMatchOptions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -51,25 +38,14 @@ export class FuseHorizontalNavigationBasicItemComponent implements OnInit, OnDes
|
|||||||
*/
|
*/
|
||||||
ngOnInit(): void
|
ngOnInit(): void
|
||||||
{
|
{
|
||||||
// Set the "isActiveMatchOptions" either from item's
|
|
||||||
// "isActiveMatchOptions" or the equivalent form of
|
|
||||||
// item's "exactMatch" option
|
|
||||||
this.isActiveMatchOptions =
|
|
||||||
this.item.isActiveMatchOptions ?? this.item.exactMatch
|
|
||||||
? this._fuseUtilsService.exactMatchOptions
|
|
||||||
: this._fuseUtilsService.subsetMatchOptions;
|
|
||||||
|
|
||||||
// Get the parent navigation component
|
// Get the parent navigation component
|
||||||
this._fuseHorizontalNavigationComponent = this._fuseNavigationService.getComponent(this.name);
|
this._fuseHorizontalNavigationComponent = this._fuseNavigationService.getComponent(this.name);
|
||||||
|
|
||||||
// Mark for check
|
|
||||||
this._changeDetectorRef.markForCheck();
|
|
||||||
|
|
||||||
// Subscribe to onRefreshed on the navigation component
|
// Subscribe to onRefreshed on the navigation component
|
||||||
this._fuseHorizontalNavigationComponent.onRefreshed.pipe(
|
this._fuseHorizontalNavigationComponent.onRefreshed.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
@@ -81,7 +57,7 @@ export class FuseHorizontalNavigationBasicItemComponent implements OnInit, OnDes
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,63 +1,59 @@
|
|||||||
<ng-container *ngIf="!child">
|
<div
|
||||||
<div
|
*ngIf="!child"
|
||||||
[ngClass]="{'fuse-horizontal-navigation-menu-active': trigger.menuOpen,
|
[ngClass]="{'fuse-horizontal-navigation-menu-active': trigger.menuOpen,
|
||||||
'fuse-horizontal-navigation-menu-active-forced': item.active}"
|
'fuse-horizontal-navigation-menu-active-forced': item.active}"
|
||||||
[matMenuTriggerFor]="matMenu"
|
[matMenuTriggerFor]="matMenu"
|
||||||
(onMenuOpen)="triggerChangeDetection()"
|
(onMenuOpen)="triggerChangeDetection()"
|
||||||
(onMenuClose)="triggerChangeDetection()"
|
(onMenuClose)="triggerChangeDetection()"
|
||||||
#trigger="matMenuTrigger">
|
#trigger="matMenuTrigger">
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item}"></ng-container>
|
<ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item}"></ng-container>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<mat-menu
|
<mat-menu
|
||||||
class="fuse-horizontal-navigation-menu-panel"
|
class="fuse-horizontal-navigation-menu-panel"
|
||||||
[overlapTrigger]="false"
|
[overlapTrigger]="false"
|
||||||
#matMenu="matMenu">
|
#matMenu="matMenu">
|
||||||
|
|
||||||
<ng-container *ngFor="let item of item.children; trackBy: trackByFn">
|
<ng-container *ngFor="let item of item.children">
|
||||||
|
|
||||||
<!-- Skip the hidden items -->
|
<!-- Skip the hidden items -->
|
||||||
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
||||||
|
|
||||||
<!-- Basic -->
|
<!-- Basic -->
|
||||||
<ng-container *ngIf="item.type === 'basic'">
|
<div
|
||||||
<div
|
class="fuse-horizontal-navigation-menu-item"
|
||||||
class="fuse-horizontal-navigation-menu-item"
|
*ngIf="item.type === 'basic'"
|
||||||
[disabled]="item.disabled"
|
[disabled]="item.disabled"
|
||||||
mat-menu-item>
|
mat-menu-item>
|
||||||
<fuse-horizontal-navigation-basic-item
|
<fuse-horizontal-navigation-basic-item
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-horizontal-navigation-basic-item>
|
[name]="name"></fuse-horizontal-navigation-basic-item>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Branch: aside, collapsable, group -->
|
<!-- Branch: aside, collapsable, group -->
|
||||||
<ng-container *ngIf="item.type === 'aside' || item.type === 'collapsable' || item.type === 'group'">
|
<div
|
||||||
<div
|
class="fuse-horizontal-navigation-menu-item"
|
||||||
class="fuse-horizontal-navigation-menu-item"
|
*ngIf="item.type === 'aside' || item.type === 'collapsable' || item.type === 'group'"
|
||||||
[disabled]="item.disabled"
|
[disabled]="item.disabled"
|
||||||
[matMenuTriggerFor]="branch.matMenu"
|
[matMenuTriggerFor]="branch.matMenu"
|
||||||
mat-menu-item>
|
mat-menu-item>
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item}"></ng-container>
|
<ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item}"></ng-container>
|
||||||
<fuse-horizontal-navigation-branch-item
|
<fuse-horizontal-navigation-branch-item
|
||||||
[child]="true"
|
[child]="true"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"
|
[name]="name"
|
||||||
#branch></fuse-horizontal-navigation-branch-item>
|
#branch></fuse-horizontal-navigation-branch-item>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Divider -->
|
<!-- Divider -->
|
||||||
<ng-container *ngIf="item.type === 'divider'">
|
<div
|
||||||
<div
|
class="fuse-horizontal-navigation-menu-item"
|
||||||
class="fuse-horizontal-navigation-menu-item"
|
*ngIf="item.type === 'divider'"
|
||||||
mat-menu-item>
|
mat-menu-item>
|
||||||
<fuse-horizontal-navigation-divider-item
|
<fuse-horizontal-navigation-divider-item
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-horizontal-navigation-divider-item>
|
[name]="name"></fuse-horizontal-navigation-divider-item>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
@@ -78,16 +74,14 @@
|
|||||||
<div
|
<div
|
||||||
class="fuse-horizontal-navigation-item"
|
class="fuse-horizontal-navigation-item"
|
||||||
[ngClass]="{'fuse-horizontal-navigation-item-disabled': item.disabled,
|
[ngClass]="{'fuse-horizontal-navigation-item-disabled': item.disabled,
|
||||||
'fuse-horizontal-navigation-item-active-forced': item.active}"
|
'fuse-horizontal-navigation-item-active-forced': item.active}">
|
||||||
[matTooltip]="item.tooltip || ''">
|
|
||||||
|
|
||||||
<!-- Icon -->
|
<!-- Icon -->
|
||||||
<ng-container *ngIf="item.icon">
|
<mat-icon
|
||||||
<mat-icon
|
class="fuse-horizontal-navigation-item-icon"
|
||||||
class="fuse-horizontal-navigation-item-icon"
|
[ngClass]="item.classes?.icon"
|
||||||
[ngClass]="item.classes?.icon"
|
*ngIf="item.icon"
|
||||||
[svgIcon]="item.icon"></mat-icon>
|
[svgIcon]="item.icon"></mat-icon>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Title & Subtitle -->
|
<!-- Title & Subtitle -->
|
||||||
<div class="fuse-horizontal-navigation-item-title-wrapper">
|
<div class="fuse-horizontal-navigation-item-title-wrapper">
|
||||||
@@ -96,25 +90,25 @@
|
|||||||
{{item.title}}
|
{{item.title}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="item.subtitle">
|
<div
|
||||||
<div class="fuse-horizontal-navigation-item-subtitle text-hint">
|
class="fuse-horizontal-navigation-item-subtitle text-hint"
|
||||||
<span [ngClass]="item.classes?.subtitle">
|
*ngIf="item.subtitle">
|
||||||
{{item.subtitle}}
|
<span [ngClass]="item.classes?.subtitle">
|
||||||
</span>
|
{{item.subtitle}}
|
||||||
</div>
|
</span>
|
||||||
</ng-container>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Badge -->
|
<!-- Badge -->
|
||||||
<ng-container *ngIf="item.badge">
|
<div
|
||||||
<div class="fuse-horizontal-navigation-item-badge">
|
class="fuse-horizontal-navigation-item-badge"
|
||||||
<div
|
*ngIf="item.badge">
|
||||||
class="fuse-horizontal-navigation-item-badge-content"
|
<div
|
||||||
[ngClass]="item.badge.classes">
|
class="fuse-horizontal-navigation-item-badge-content"
|
||||||
{{item.badge.title}}
|
[ngClass]="item.badge.classes">
|
||||||
</div>
|
{{item.badge.title}}
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,21 @@
|
|||||||
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||||
import { BooleanInput } from '@angular/cdk/coercion';
|
import { BooleanInput } from '@angular/cdk/coercion';
|
||||||
import { NgClass, NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
|
import { MatMenu } from '@angular/material/menu';
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
import { Subject } from 'rxjs';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { MatMenu, MatMenuModule } from '@angular/material/menu';
|
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
||||||
import { FuseHorizontalNavigationBasicItemComponent } from '@fuse/components/navigation/horizontal/components/basic/basic.component';
|
|
||||||
import { FuseHorizontalNavigationDividerItemComponent } from '@fuse/components/navigation/horizontal/components/divider/divider.component';
|
|
||||||
import { FuseHorizontalNavigationComponent } from '@fuse/components/navigation/horizontal/horizontal.component';
|
import { FuseHorizontalNavigationComponent } from '@fuse/components/navigation/horizontal/horizontal.component';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-horizontal-navigation-branch-item',
|
selector : 'fuse-horizontal-navigation-branch-item',
|
||||||
templateUrl : './branch.component.html',
|
templateUrl : './branch.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
styles : [],
|
||||||
standalone : true,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
imports : [NgIf, NgClass, MatMenuModule, NgTemplateOutlet, NgFor, FuseHorizontalNavigationBasicItemComponent, forwardRef(() => FuseHorizontalNavigationBranchItemComponent), FuseHorizontalNavigationDividerItemComponent, MatTooltipModule, MatIconModule],
|
|
||||||
})
|
})
|
||||||
export class FuseHorizontalNavigationBranchItemComponent implements OnInit, OnDestroy
|
export class FuseHorizontalNavigationBranchItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
static ngAcceptInputType_child: BooleanInput;
|
static ngAcceptInputType_child: BooleanInput;
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
|
|
||||||
@Input() child: boolean = false;
|
@Input() child: boolean = false;
|
||||||
@Input() item: FuseNavigationItem;
|
@Input() item: FuseNavigationItem;
|
||||||
@@ -37,7 +30,7 @@ export class FuseHorizontalNavigationBranchItemComponent implements OnInit, OnDe
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -56,9 +49,9 @@ export class FuseHorizontalNavigationBranchItemComponent implements OnInit, OnDe
|
|||||||
|
|
||||||
// Subscribe to onRefreshed on the navigation component
|
// Subscribe to onRefreshed on the navigation component
|
||||||
this._fuseHorizontalNavigationComponent.onRefreshed.pipe(
|
this._fuseHorizontalNavigationComponent.onRefreshed.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
@@ -70,7 +63,7 @@ export class FuseHorizontalNavigationBranchItemComponent implements OnInit, OnDe
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,15 +79,4 @@ export class FuseHorizontalNavigationBranchItemComponent implements OnInit, OnDe
|
|||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Track by function for ngFor loops
|
|
||||||
*
|
|
||||||
* @param index
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
trackByFn(index: number, item: any): any
|
|
||||||
{
|
|
||||||
return item.id || index;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import { NgClass } from '@angular/common';
|
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { FuseHorizontalNavigationComponent } from '@fuse/components/navigation/horizontal/horizontal.component';
|
import { FuseHorizontalNavigationComponent } from '@fuse/components/navigation/horizontal/horizontal.component';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-horizontal-navigation-divider-item',
|
selector : 'fuse-horizontal-navigation-divider-item',
|
||||||
templateUrl : './divider.component.html',
|
templateUrl : './divider.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
styles : [],
|
||||||
standalone : true,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
imports : [NgClass],
|
|
||||||
})
|
})
|
||||||
export class FuseHorizontalNavigationDividerItemComponent implements OnInit, OnDestroy
|
export class FuseHorizontalNavigationDividerItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@@ -25,7 +24,7 @@ export class FuseHorizontalNavigationDividerItemComponent implements OnInit, OnD
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -44,9 +43,9 @@ export class FuseHorizontalNavigationDividerItemComponent implements OnInit, OnD
|
|||||||
|
|
||||||
// Subscribe to onRefreshed on the navigation component
|
// Subscribe to onRefreshed on the navigation component
|
||||||
this._fuseHorizontalNavigationComponent.onRefreshed.pipe(
|
this._fuseHorizontalNavigationComponent.onRefreshed.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
@@ -58,7 +57,7 @@ export class FuseHorizontalNavigationDividerItemComponent implements OnInit, OnD
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import { NgClass } from '@angular/common';
|
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
import { FuseHorizontalNavigationComponent } from '@fuse/components/navigation/horizontal/horizontal.component';
|
import { FuseHorizontalNavigationComponent } from '@fuse/components/navigation/horizontal/horizontal.component';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-horizontal-navigation-spacer-item',
|
selector : 'fuse-horizontal-navigation-spacer-item',
|
||||||
templateUrl : './spacer.component.html',
|
templateUrl : './spacer.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
styles : [],
|
||||||
standalone : true,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
imports : [NgClass],
|
|
||||||
})
|
})
|
||||||
export class FuseHorizontalNavigationSpacerItemComponent implements OnInit, OnDestroy
|
export class FuseHorizontalNavigationSpacerItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@@ -25,7 +24,7 @@ export class FuseHorizontalNavigationSpacerItemComponent implements OnInit, OnDe
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -44,9 +43,9 @@ export class FuseHorizontalNavigationSpacerItemComponent implements OnInit, OnDe
|
|||||||
|
|
||||||
// Subscribe to onRefreshed on the navigation component
|
// Subscribe to onRefreshed on the navigation component
|
||||||
this._fuseHorizontalNavigationComponent.onRefreshed.pipe(
|
this._fuseHorizontalNavigationComponent.onRefreshed.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
@@ -58,7 +57,7 @@ export class FuseHorizontalNavigationSpacerItemComponent implements OnInit, OnDe
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,30 @@
|
|||||||
<div class="fuse-horizontal-navigation-wrapper">
|
<div class="fuse-horizontal-navigation-wrapper">
|
||||||
|
|
||||||
<ng-container *ngFor="let item of navigation; trackBy: trackByFn">
|
<ng-container *ngFor="let item of navigation">
|
||||||
|
|
||||||
<!-- Skip the hidden items -->
|
<!-- Skip the hidden items -->
|
||||||
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
||||||
|
|
||||||
<!-- Basic -->
|
<!-- Basic -->
|
||||||
<ng-container *ngIf="item.type === 'basic'">
|
<fuse-horizontal-navigation-basic-item
|
||||||
<fuse-horizontal-navigation-basic-item
|
class="fuse-horizontal-navigation-menu-item"
|
||||||
class="fuse-horizontal-navigation-menu-item"
|
*ngIf="item.type === 'basic'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-horizontal-navigation-basic-item>
|
[name]="name"></fuse-horizontal-navigation-basic-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Branch: aside, collapsable, group -->
|
<!-- Branch: aside, collapsable, group -->
|
||||||
<ng-container *ngIf="item.type === 'aside' || item.type === 'collapsable' || item.type === 'group'">
|
<fuse-horizontal-navigation-branch-item
|
||||||
<fuse-horizontal-navigation-branch-item
|
class="fuse-horizontal-navigation-menu-item"
|
||||||
class="fuse-horizontal-navigation-menu-item"
|
*ngIf="item.type === 'aside' || item.type === 'collapsable' || item.type === 'group'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-horizontal-navigation-branch-item>
|
[name]="name"></fuse-horizontal-navigation-branch-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Spacer -->
|
<!-- Spacer -->
|
||||||
<ng-container *ngIf="item.type === 'spacer'">
|
<fuse-horizontal-navigation-spacer-item
|
||||||
<fuse-horizontal-navigation-spacer-item
|
class="fuse-horizontal-navigation-menu-item"
|
||||||
class="fuse-horizontal-navigation-menu-item"
|
*ngIf="item.type === 'spacer'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-horizontal-navigation-spacer-item>
|
[name]="name"></fuse-horizontal-navigation-spacer-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,18 @@
|
|||||||
import { NgFor, NgIf } from '@angular/common';
|
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||||
import { fuseAnimations } from '@fuse/animations';
|
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
|
||||||
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
|
||||||
import { ReplaySubject, Subject } from 'rxjs';
|
import { ReplaySubject, Subject } from 'rxjs';
|
||||||
import { FuseHorizontalNavigationBasicItemComponent } from './components/basic/basic.component';
|
import { FuseAnimations } from '@fuse/animations';
|
||||||
import { FuseHorizontalNavigationBranchItemComponent } from './components/branch/branch.component';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { FuseHorizontalNavigationSpacerItemComponent } from './components/spacer/spacer.component';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
|
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-horizontal-navigation',
|
selector : 'fuse-horizontal-navigation',
|
||||||
templateUrl : './horizontal.component.html',
|
templateUrl : './horizontal.component.html',
|
||||||
styleUrls : ['./horizontal.component.scss'],
|
styleUrls : ['./horizontal.component.scss'],
|
||||||
animations : fuseAnimations,
|
animations : FuseAnimations,
|
||||||
encapsulation : ViewEncapsulation.None,
|
encapsulation : ViewEncapsulation.None,
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
exportAs : 'fuseHorizontalNavigation',
|
exportAs : 'fuseHorizontalNavigation'
|
||||||
standalone : true,
|
|
||||||
imports : [NgFor, NgIf, FuseHorizontalNavigationBasicItemComponent, FuseHorizontalNavigationBranchItemComponent, FuseHorizontalNavigationSpacerItemComponent],
|
|
||||||
})
|
})
|
||||||
export class FuseHorizontalNavigationComponent implements OnChanges, OnInit, OnDestroy
|
export class FuseHorizontalNavigationComponent implements OnChanges, OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@@ -34,7 +28,7 @@ export class FuseHorizontalNavigationComponent implements OnChanges, OnInit, OnD
|
|||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService,
|
||||||
private _fuseUtilsService: FuseUtilsService,
|
private _fuseUtilsService: FuseUtilsService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -82,7 +76,7 @@ export class FuseHorizontalNavigationComponent implements OnChanges, OnInit, OnD
|
|||||||
this._fuseNavigationService.deregisterComponent(this.name);
|
this._fuseNavigationService.deregisterComponent(this.name);
|
||||||
|
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
55
src/@fuse/components/navigation/navigation.module.ts
Normal file
55
src/@fuse/components/navigation/navigation.module.ts
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatDividerModule } from '@angular/material/divider';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
import { FuseScrollbarModule } from '@fuse/directives/scrollbar/public-api';
|
||||||
|
import { FuseHorizontalNavigationBasicItemComponent } from '@fuse/components/navigation/horizontal/components/basic/basic.component';
|
||||||
|
import { FuseHorizontalNavigationBranchItemComponent } from '@fuse/components/navigation/horizontal/components/branch/branch.component';
|
||||||
|
import { FuseHorizontalNavigationDividerItemComponent } from '@fuse/components/navigation/horizontal/components/divider/divider.component';
|
||||||
|
import { FuseHorizontalNavigationSpacerItemComponent } from '@fuse/components/navigation/horizontal/components/spacer/spacer.component';
|
||||||
|
import { FuseHorizontalNavigationComponent } from '@fuse/components/navigation/horizontal/horizontal.component';
|
||||||
|
import { FuseVerticalNavigationAsideItemComponent } from '@fuse/components/navigation/vertical/components/aside/aside.component';
|
||||||
|
import { FuseVerticalNavigationBasicItemComponent } from '@fuse/components/navigation/vertical/components/basic/basic.component';
|
||||||
|
import { FuseVerticalNavigationCollapsableItemComponent } from '@fuse/components/navigation/vertical/components/collapsable/collapsable.component';
|
||||||
|
import { FuseVerticalNavigationDividerItemComponent } from '@fuse/components/navigation/vertical/components/divider/divider.component';
|
||||||
|
import { FuseVerticalNavigationGroupItemComponent } from '@fuse/components/navigation/vertical/components/group/group.component';
|
||||||
|
import { FuseVerticalNavigationSpacerItemComponent } from '@fuse/components/navigation/vertical/components/spacer/spacer.component';
|
||||||
|
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseHorizontalNavigationBasicItemComponent,
|
||||||
|
FuseHorizontalNavigationBranchItemComponent,
|
||||||
|
FuseHorizontalNavigationDividerItemComponent,
|
||||||
|
FuseHorizontalNavigationSpacerItemComponent,
|
||||||
|
FuseHorizontalNavigationComponent,
|
||||||
|
FuseVerticalNavigationAsideItemComponent,
|
||||||
|
FuseVerticalNavigationBasicItemComponent,
|
||||||
|
FuseVerticalNavigationCollapsableItemComponent,
|
||||||
|
FuseVerticalNavigationDividerItemComponent,
|
||||||
|
FuseVerticalNavigationGroupItemComponent,
|
||||||
|
FuseVerticalNavigationSpacerItemComponent,
|
||||||
|
FuseVerticalNavigationComponent
|
||||||
|
],
|
||||||
|
imports : [
|
||||||
|
CommonModule,
|
||||||
|
RouterModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatDividerModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatMenuModule,
|
||||||
|
MatTooltipModule,
|
||||||
|
FuseScrollbarModule
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseHorizontalNavigationComponent,
|
||||||
|
FuseVerticalNavigationComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseNavigationModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
|
|
||||||
@Injectable({providedIn: 'root'})
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
export class FuseNavigationService
|
export class FuseNavigationService
|
||||||
{
|
{
|
||||||
private _componentRegistry: Map<string, any> = new Map<string, any>();
|
private _componentRegistry: Map<string, any> = new Map<string, any>();
|
||||||
@@ -44,7 +46,7 @@ export class FuseNavigationService
|
|||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
getComponent<T>(name: string): T
|
getComponent(name: string): any
|
||||||
{
|
{
|
||||||
return this._componentRegistry.get(name);
|
return this._componentRegistry.get(name);
|
||||||
}
|
}
|
||||||
@@ -65,6 +67,7 @@ export class FuseNavigationService
|
|||||||
* Get navigation from storage by key
|
* Get navigation from storage by key
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
getNavigation(key: string): FuseNavigationItem[]
|
getNavigation(key: string): FuseNavigationItem[]
|
||||||
{
|
{
|
||||||
@@ -94,6 +97,7 @@ export class FuseNavigationService
|
|||||||
*
|
*
|
||||||
* @param navigation
|
* @param navigation
|
||||||
* @param flatNavigation
|
* @param flatNavigation
|
||||||
|
* @returns {FuseNavigationItem[]}
|
||||||
*/
|
*/
|
||||||
getFlatNavigation(navigation: FuseNavigationItem[], flatNavigation: FuseNavigationItem[] = []): FuseNavigationItem[]
|
getFlatNavigation(navigation: FuseNavigationItem[], flatNavigation: FuseNavigationItem[] = []): FuseNavigationItem[]
|
||||||
{
|
{
|
||||||
@@ -158,7 +162,7 @@ export class FuseNavigationService
|
|||||||
getItemParent(
|
getItemParent(
|
||||||
id: string,
|
id: string,
|
||||||
navigation: FuseNavigationItem[],
|
navigation: FuseNavigationItem[],
|
||||||
parent: FuseNavigationItem[] | FuseNavigationItem,
|
parent: FuseNavigationItem[] | FuseNavigationItem
|
||||||
): FuseNavigationItem[] | FuseNavigationItem | null
|
): FuseNavigationItem[] | FuseNavigationItem | null
|
||||||
{
|
{
|
||||||
for ( const item of navigation )
|
for ( const item of navigation )
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { IsActiveMatchOptions, Params, QueryParamsHandling } from '@angular/router';
|
|
||||||
|
|
||||||
export interface FuseNavigationItem
|
export interface FuseNavigationItem
|
||||||
{
|
{
|
||||||
id?: string;
|
id?: string;
|
||||||
@@ -15,21 +13,9 @@ export interface FuseNavigationItem
|
|||||||
hidden?: (item: FuseNavigationItem) => boolean;
|
hidden?: (item: FuseNavigationItem) => boolean;
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
tooltip?: string;
|
|
||||||
link?: string;
|
link?: string;
|
||||||
fragment?: string;
|
|
||||||
preserveFragment?: boolean;
|
|
||||||
queryParams?: Params | null;
|
|
||||||
queryParamsHandling?: QueryParamsHandling | null;
|
|
||||||
externalLink?: boolean;
|
externalLink?: boolean;
|
||||||
target?:
|
|
||||||
| '_blank'
|
|
||||||
| '_self'
|
|
||||||
| '_parent'
|
|
||||||
| '_top'
|
|
||||||
| string;
|
|
||||||
exactMatch?: boolean;
|
exactMatch?: boolean;
|
||||||
isActiveMatchOptions?: IsActiveMatchOptions;
|
|
||||||
function?: (item: FuseNavigationItem) => void;
|
function?: (item: FuseNavigationItem) => void;
|
||||||
classes?: {
|
classes?: {
|
||||||
title?: string;
|
title?: string;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export * from '@fuse/components/navigation/horizontal/horizontal.component';
|
export * from '@fuse/components/navigation/horizontal/horizontal.component';
|
||||||
export * from '@fuse/components/navigation/vertical/vertical.component';
|
export * from '@fuse/components/navigation/vertical/vertical.component';
|
||||||
|
export * from '@fuse/components/navigation/navigation.module';
|
||||||
export * from '@fuse/components/navigation/navigation.service';
|
export * from '@fuse/components/navigation/navigation.service';
|
||||||
export * from '@fuse/components/navigation/navigation.types';
|
export * from '@fuse/components/navigation/navigation.types';
|
||||||
|
|||||||
@@ -7,16 +7,14 @@
|
|||||||
class="fuse-vertical-navigation-item"
|
class="fuse-vertical-navigation-item"
|
||||||
[ngClass]="{'fuse-vertical-navigation-item-active': active,
|
[ngClass]="{'fuse-vertical-navigation-item-active': active,
|
||||||
'fuse-vertical-navigation-item-disabled': item.disabled,
|
'fuse-vertical-navigation-item-disabled': item.disabled,
|
||||||
'fuse-vertical-navigation-item-active-forced': item.active}"
|
'fuse-vertical-navigation-item-active-forced': item.active}">
|
||||||
[matTooltip]="item.tooltip || ''">
|
|
||||||
|
|
||||||
<!-- Icon -->
|
<!-- Icon -->
|
||||||
<ng-container *ngIf="item.icon">
|
<mat-icon
|
||||||
<mat-icon
|
class="fuse-vertical-navigation-item-icon"
|
||||||
class="fuse-vertical-navigation-item-icon"
|
[ngClass]="item.classes?.icon"
|
||||||
[ngClass]="item.classes?.icon"
|
*ngIf="item.icon"
|
||||||
[svgIcon]="item.icon"></mat-icon>
|
[svgIcon]="item.icon"></mat-icon>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Title & Subtitle -->
|
<!-- Title & Subtitle -->
|
||||||
<div class="fuse-vertical-navigation-item-title-wrapper">
|
<div class="fuse-vertical-navigation-item-title-wrapper">
|
||||||
@@ -25,25 +23,25 @@
|
|||||||
{{item.title}}
|
{{item.title}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="item.subtitle">
|
<div
|
||||||
<div class="fuse-vertical-navigation-item-subtitle">
|
class="fuse-vertical-navigation-item-subtitle"
|
||||||
<span [ngClass]="item.classes?.subtitle">
|
*ngIf="item.subtitle">
|
||||||
{{item.subtitle}}
|
<span [ngClass]="item.classes?.subtitle">
|
||||||
</span>
|
{{item.subtitle}}
|
||||||
</div>
|
</span>
|
||||||
</ng-container>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Badge -->
|
<!-- Badge -->
|
||||||
<ng-container *ngIf="item.badge">
|
<div
|
||||||
<div class="fuse-vertical-navigation-item-badge">
|
class="fuse-vertical-navigation-item-badge"
|
||||||
<div
|
*ngIf="item.badge">
|
||||||
class="fuse-vertical-navigation-item-badge-content"
|
<div
|
||||||
[ngClass]="item.badge.classes">
|
class="fuse-vertical-navigation-item-badge-content"
|
||||||
{{item.badge.title}}
|
[ngClass]="item.badge.classes">
|
||||||
</div>
|
{{item.badge.title}}
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -59,40 +57,35 @@
|
|||||||
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
||||||
|
|
||||||
<!-- Basic -->
|
<!-- Basic -->
|
||||||
<ng-container *ngIf="item.type === 'basic'">
|
<fuse-vertical-navigation-basic-item
|
||||||
<fuse-vertical-navigation-basic-item
|
*ngIf="item.type === 'basic'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-basic-item>
|
[name]="name"></fuse-vertical-navigation-basic-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Collapsable -->
|
<!-- Collapsable -->
|
||||||
<ng-container *ngIf="item.type === 'collapsable'">
|
<fuse-vertical-navigation-collapsable-item
|
||||||
<fuse-vertical-navigation-collapsable-item
|
*ngIf="item.type === 'collapsable'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"
|
[name]="name"
|
||||||
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-collapsable-item>
|
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-collapsable-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Divider -->
|
<!-- Divider -->
|
||||||
<ng-container *ngIf="item.type === 'divider'">
|
<fuse-vertical-navigation-divider-item
|
||||||
<fuse-vertical-navigation-divider-item
|
*ngIf="item.type === 'divider'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-divider-item>
|
[name]="name"></fuse-vertical-navigation-divider-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Group -->
|
<!-- Group -->
|
||||||
<ng-container *ngIf="item.type === 'group'">
|
<fuse-vertical-navigation-group-item
|
||||||
<fuse-vertical-navigation-group-item
|
*ngIf="item.type === 'group'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-group-item>
|
[name]="name"></fuse-vertical-navigation-group-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Spacer -->
|
<!-- Spacer -->
|
||||||
<ng-container *ngIf="item.type === 'spacer'">
|
<fuse-vertical-navigation-spacer-item
|
||||||
<fuse-vertical-navigation-spacer-item
|
*ngIf="item.type === 'spacer'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-spacer-item>
|
[name]="name"></fuse-vertical-navigation-spacer-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,22 @@
|
|||||||
import { BooleanInput } from '@angular/cdk/coercion';
|
|
||||||
import { NgClass, NgFor, NgIf } from '@angular/common';
|
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
||||||
import { NavigationEnd, Router } from '@angular/router';
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
|
import { BooleanInput } from '@angular/cdk/coercion';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { filter, takeUntil } from 'rxjs/operators';
|
||||||
|
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { FuseVerticalNavigationBasicItemComponent } from '@fuse/components/navigation/vertical/components/basic/basic.component';
|
|
||||||
import { FuseVerticalNavigationCollapsableItemComponent } from '@fuse/components/navigation/vertical/components/collapsable/collapsable.component';
|
|
||||||
import { FuseVerticalNavigationDividerItemComponent } from '@fuse/components/navigation/vertical/components/divider/divider.component';
|
|
||||||
import { FuseVerticalNavigationGroupItemComponent } from '@fuse/components/navigation/vertical/components/group/group.component';
|
|
||||||
import { FuseVerticalNavigationSpacerItemComponent } from '@fuse/components/navigation/vertical/components/spacer/spacer.component';
|
|
||||||
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
|
||||||
import { filter, Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-vertical-navigation-aside-item',
|
selector : 'fuse-vertical-navigation-aside-item',
|
||||||
templateUrl : './aside.component.html',
|
templateUrl : './aside.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
styles : [],
|
||||||
standalone : true,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
imports : [NgClass, MatTooltipModule, NgIf, MatIconModule, NgFor, FuseVerticalNavigationBasicItemComponent, FuseVerticalNavigationCollapsableItemComponent, FuseVerticalNavigationDividerItemComponent, FuseVerticalNavigationGroupItemComponent, FuseVerticalNavigationSpacerItemComponent],
|
|
||||||
})
|
})
|
||||||
export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnInit, OnDestroy
|
export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
static ngAcceptInputType_autoCollapse: BooleanInput;
|
static ngAcceptInputType_autoCollapse: BooleanInput;
|
||||||
static ngAcceptInputType_skipChildren: BooleanInput;
|
static ngAcceptInputType_skipChildren: BooleanInput;
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
|
|
||||||
@Input() activeItemId: string;
|
@Input() activeItemId: string;
|
||||||
@Input() autoCollapse: boolean;
|
@Input() autoCollapse: boolean;
|
||||||
@@ -44,7 +34,7 @@ export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnIn
|
|||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _router: Router,
|
private _router: Router,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -80,10 +70,10 @@ export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnIn
|
|||||||
this._router.events
|
this._router.events
|
||||||
.pipe(
|
.pipe(
|
||||||
filter((event): event is NavigationEnd => event instanceof NavigationEnd),
|
filter((event): event is NavigationEnd => event instanceof NavigationEnd),
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
)
|
)
|
||||||
.subscribe((event: NavigationEnd) =>
|
.subscribe((event: NavigationEnd) => {
|
||||||
{
|
|
||||||
// Mark if active
|
// Mark if active
|
||||||
this._markIfActive(event.urlAfterRedirects);
|
this._markIfActive(event.urlAfterRedirects);
|
||||||
});
|
});
|
||||||
@@ -93,9 +83,9 @@ export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnIn
|
|||||||
|
|
||||||
// Subscribe to onRefreshed on the navigation component
|
// Subscribe to onRefreshed on the navigation component
|
||||||
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
@@ -107,25 +97,10 @@ export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnIn
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
// @ Public methods
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Track by function for ngFor loops
|
|
||||||
*
|
|
||||||
* @param index
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
trackByFn(index: number, item: any): any
|
|
||||||
{
|
|
||||||
return item.id || index;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
// @ Private methods
|
// @ Private methods
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -193,4 +168,19 @@ export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnIn
|
|||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Track by function for ngFor loops
|
||||||
|
*
|
||||||
|
* @param index
|
||||||
|
* @param item
|
||||||
|
*/
|
||||||
|
trackByFn(index: number, item: any): any
|
||||||
|
{
|
||||||
|
return item.id || index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,92 +5,68 @@
|
|||||||
[ngClass]="item.classes?.wrapper">
|
[ngClass]="item.classes?.wrapper">
|
||||||
|
|
||||||
<!-- Item with an internal link -->
|
<!-- Item with an internal link -->
|
||||||
<ng-container *ngIf="item.link && !item.externalLink && !item.function && !item.disabled">
|
<a
|
||||||
<a
|
class="fuse-vertical-navigation-item"
|
||||||
class="fuse-vertical-navigation-item"
|
*ngIf="item.link && !item.externalLink && !item.function && !item.disabled"
|
||||||
[ngClass]="{'fuse-vertical-navigation-item-active-forced': item.active}"
|
[ngClass]="{'fuse-vertical-navigation-item-active-forced': item.active}"
|
||||||
[routerLink]="[item.link]"
|
[routerLink]="[item.link]"
|
||||||
[fragment]="item.fragment ?? null"
|
[routerLinkActive]="'fuse-vertical-navigation-item-active'"
|
||||||
[preserveFragment]="item.preserveFragment ?? false"
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}">
|
||||||
[queryParams]="item.queryParams ?? null"
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
[queryParamsHandling]="item.queryParamsHandling ?? null"
|
</a>
|
||||||
[routerLinkActive]="'fuse-vertical-navigation-item-active'"
|
|
||||||
[routerLinkActiveOptions]="isActiveMatchOptions"
|
|
||||||
[matTooltip]="item.tooltip || ''">
|
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
|
||||||
</a>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item with an external link -->
|
<!-- Item with an external link -->
|
||||||
<ng-container *ngIf="item.link && item.externalLink && !item.function && !item.disabled">
|
<a
|
||||||
<a
|
class="fuse-vertical-navigation-item"
|
||||||
class="fuse-vertical-navigation-item"
|
*ngIf="item.link && item.externalLink && !item.function && !item.disabled"
|
||||||
[href]="item.link"
|
[href]="item.link">
|
||||||
[target]="item.target || '_self'"
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
[matTooltip]="item.tooltip || ''">
|
</a>
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
|
||||||
</a>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item with a function -->
|
<!-- Item with a function -->
|
||||||
<ng-container *ngIf="!item.link && item.function && !item.disabled">
|
<div
|
||||||
<div
|
class="fuse-vertical-navigation-item"
|
||||||
class="fuse-vertical-navigation-item"
|
*ngIf="!item.link && item.function && !item.disabled"
|
||||||
[ngClass]="{'fuse-vertical-navigation-item-active-forced': item.active}"
|
[ngClass]="{'fuse-vertical-navigation-item-active-forced': item.active}"
|
||||||
[matTooltip]="item.tooltip || ''"
|
(click)="item.function(item)">
|
||||||
(click)="item.function(item)">
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
</div>
|
||||||
</div>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item with an internal link and function -->
|
<!-- Item with an internal link and function -->
|
||||||
<ng-container *ngIf="item.link && !item.externalLink && item.function && !item.disabled">
|
<a
|
||||||
<a
|
class="fuse-vertical-navigation-item"
|
||||||
class="fuse-vertical-navigation-item"
|
*ngIf="item.link && !item.externalLink && item.function && !item.disabled"
|
||||||
[ngClass]="{'fuse-vertical-navigation-item-active-forced': item.active}"
|
[ngClass]="{'fuse-vertical-navigation-item-active-forced': item.active}"
|
||||||
[routerLink]="[item.link]"
|
[routerLink]="[item.link]"
|
||||||
[fragment]="item.fragment ?? null"
|
[routerLinkActive]="'fuse-vertical-navigation-item-active'"
|
||||||
[preserveFragment]="item.preserveFragment ?? false"
|
[routerLinkActiveOptions]="{exact: item.exactMatch || false}"
|
||||||
[queryParams]="item.queryParams ?? null"
|
(click)="item.function(item)">
|
||||||
[queryParamsHandling]="item.queryParamsHandling ?? null"
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
[routerLinkActive]="'fuse-vertical-navigation-item-active'"
|
</a>
|
||||||
[routerLinkActiveOptions]="isActiveMatchOptions"
|
|
||||||
[matTooltip]="item.tooltip || ''"
|
|
||||||
(click)="item.function(item)">
|
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
|
||||||
</a>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item with an external link and function -->
|
<!-- Item with an external link and function -->
|
||||||
<ng-container *ngIf="item.link && item.externalLink && item.function && !item.disabled">
|
<a
|
||||||
<a
|
class="fuse-vertical-navigation-item"
|
||||||
class="fuse-vertical-navigation-item"
|
*ngIf="item.link && item.externalLink && item.function && !item.disabled"
|
||||||
[href]="item.link"
|
[href]="item.link"
|
||||||
[target]="item.target || '_self'"
|
(click)="item.function(item)">
|
||||||
[matTooltip]="item.tooltip || ''"
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
(click)="item.function(item)">
|
</a>
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
|
||||||
</a>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item with a no link and no function -->
|
<!-- Item with a no link and no function -->
|
||||||
<ng-container *ngIf="!item.link && !item.function && !item.disabled">
|
<div
|
||||||
<div
|
class="fuse-vertical-navigation-item"
|
||||||
class="fuse-vertical-navigation-item"
|
*ngIf="!item.link && !item.function && !item.disabled"
|
||||||
[ngClass]="{'fuse-vertical-navigation-item-active-forced': item.active}"
|
[ngClass]="{'fuse-vertical-navigation-item-active-forced': item.active}">
|
||||||
[matTooltip]="item.tooltip || ''">
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
</div>
|
||||||
</div>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Item is disabled -->
|
<!-- Item is disabled -->
|
||||||
<ng-container *ngIf="item.disabled">
|
<div
|
||||||
<div
|
class="fuse-vertical-navigation-item fuse-vertical-navigation-item-disabled"
|
||||||
class="fuse-vertical-navigation-item fuse-vertical-navigation-item-disabled"
|
*ngIf="item.disabled">
|
||||||
[matTooltip]="item.tooltip || ''">
|
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
||||||
<ng-container *ngTemplateOutlet="itemTemplate"></ng-container>
|
</div>
|
||||||
</div>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -98,12 +74,11 @@
|
|||||||
<ng-template #itemTemplate>
|
<ng-template #itemTemplate>
|
||||||
|
|
||||||
<!-- Icon -->
|
<!-- Icon -->
|
||||||
<ng-container *ngIf="item.icon">
|
<mat-icon
|
||||||
<mat-icon
|
class="fuse-vertical-navigation-item-icon"
|
||||||
class="fuse-vertical-navigation-item-icon"
|
[ngClass]="item.classes?.icon"
|
||||||
[ngClass]="item.classes?.icon"
|
*ngIf="item.icon"
|
||||||
[svgIcon]="item.icon"></mat-icon>
|
[svgIcon]="item.icon"></mat-icon>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Title & Subtitle -->
|
<!-- Title & Subtitle -->
|
||||||
<div class="fuse-vertical-navigation-item-title-wrapper">
|
<div class="fuse-vertical-navigation-item-title-wrapper">
|
||||||
@@ -112,24 +87,24 @@
|
|||||||
{{item.title}}
|
{{item.title}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="item.subtitle">
|
<div
|
||||||
<div class="fuse-vertical-navigation-item-subtitle">
|
class="fuse-vertical-navigation-item-subtitle"
|
||||||
<span [ngClass]="item.classes?.subtitle">
|
*ngIf="item.subtitle">
|
||||||
{{item.subtitle}}
|
<span [ngClass]="item.classes?.subtitle">
|
||||||
</span>
|
{{item.subtitle}}
|
||||||
</div>
|
</span>
|
||||||
</ng-container>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Badge -->
|
<!-- Badge -->
|
||||||
<ng-container *ngIf="item.badge">
|
<div
|
||||||
<div class="fuse-vertical-navigation-item-badge">
|
class="fuse-vertical-navigation-item-badge"
|
||||||
<div
|
*ngIf="item.badge">
|
||||||
class="fuse-vertical-navigation-item-badge-content"
|
<div
|
||||||
[ngClass]="item.badge.classes">
|
class="fuse-vertical-navigation-item-badge-content"
|
||||||
{{item.badge.title}}
|
[ngClass]="item.badge.classes">
|
||||||
</div>
|
{{item.badge.title}}
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</div>
|
||||||
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@@ -1,27 +1,22 @@
|
|||||||
import { NgClass, NgIf, NgTemplateOutlet } from '@angular/common';
|
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { Subject } from 'rxjs';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { IsActiveMatchOptions, RouterLink, RouterLinkActive } from '@angular/router';
|
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
|
||||||
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
||||||
import { Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-vertical-navigation-basic-item',
|
selector : 'fuse-vertical-navigation-basic-item',
|
||||||
templateUrl : './basic.component.html',
|
templateUrl : './basic.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
styles : [],
|
||||||
standalone : true,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
imports : [NgClass, NgIf, RouterLink, RouterLinkActive, MatTooltipModule, NgTemplateOutlet, MatIconModule],
|
|
||||||
})
|
})
|
||||||
export class FuseVerticalNavigationBasicItemComponent implements OnInit, OnDestroy
|
export class FuseVerticalNavigationBasicItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@Input() item: FuseNavigationItem;
|
@Input() item: FuseNavigationItem;
|
||||||
@Input() name: string;
|
@Input() name: string;
|
||||||
|
|
||||||
isActiveMatchOptions: IsActiveMatchOptions;
|
|
||||||
private _fuseVerticalNavigationComponent: FuseVerticalNavigationComponent;
|
private _fuseVerticalNavigationComponent: FuseVerticalNavigationComponent;
|
||||||
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
||||||
|
|
||||||
@@ -31,14 +26,9 @@ export class FuseVerticalNavigationBasicItemComponent implements OnInit, OnDestr
|
|||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService,
|
||||||
private _fuseUtilsService: FuseUtilsService,
|
private _fuseUtilsService: FuseUtilsService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Set the equivalent of {exact: false} as default for active match options.
|
|
||||||
// We are not assigning the item.isActiveMatchOptions directly to the
|
|
||||||
// [routerLinkActiveOptions] because if it's "undefined" initially, the router
|
|
||||||
// will throw an error and stop working.
|
|
||||||
this.isActiveMatchOptions = this._fuseUtilsService.subsetMatchOptions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -50,25 +40,14 @@ export class FuseVerticalNavigationBasicItemComponent implements OnInit, OnDestr
|
|||||||
*/
|
*/
|
||||||
ngOnInit(): void
|
ngOnInit(): void
|
||||||
{
|
{
|
||||||
// Set the "isActiveMatchOptions" either from item's
|
|
||||||
// "isActiveMatchOptions" or the equivalent form of
|
|
||||||
// item's "exactMatch" option
|
|
||||||
this.isActiveMatchOptions =
|
|
||||||
this.item.isActiveMatchOptions ?? this.item.exactMatch
|
|
||||||
? this._fuseUtilsService.exactMatchOptions
|
|
||||||
: this._fuseUtilsService.subsetMatchOptions;
|
|
||||||
|
|
||||||
// Get the parent navigation component
|
// Get the parent navigation component
|
||||||
this._fuseVerticalNavigationComponent = this._fuseNavigationService.getComponent(this.name);
|
this._fuseVerticalNavigationComponent = this._fuseNavigationService.getComponent(this.name);
|
||||||
|
|
||||||
// Mark for check
|
|
||||||
this._changeDetectorRef.markForCheck();
|
|
||||||
|
|
||||||
// Subscribe to onRefreshed on the navigation component
|
// Subscribe to onRefreshed on the navigation component
|
||||||
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
@@ -80,7 +59,7 @@ export class FuseVerticalNavigationBasicItemComponent implements OnInit, OnDestr
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,14 @@
|
|||||||
<div
|
<div
|
||||||
class="fuse-vertical-navigation-item"
|
class="fuse-vertical-navigation-item"
|
||||||
[ngClass]="{'fuse-vertical-navigation-item-disabled': item.disabled}"
|
[ngClass]="{'fuse-vertical-navigation-item-disabled': item.disabled}"
|
||||||
[matTooltip]="item.tooltip || ''"
|
|
||||||
(click)="toggleCollapsable()">
|
(click)="toggleCollapsable()">
|
||||||
|
|
||||||
<!-- Icon -->
|
<!-- Icon -->
|
||||||
<ng-container *ngIf="item.icon">
|
<mat-icon
|
||||||
<mat-icon
|
class="fuse-vertical-navigation-item-icon"
|
||||||
class="fuse-vertical-navigation-item-icon"
|
[ngClass]="item.classes?.icon"
|
||||||
[ngClass]="item.classes?.icon"
|
*ngIf="item.icon"
|
||||||
[svgIcon]="item.icon"></mat-icon>
|
[svgIcon]="item.icon"></mat-icon>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Title & Subtitle -->
|
<!-- Title & Subtitle -->
|
||||||
<div class="fuse-vertical-navigation-item-title-wrapper">
|
<div class="fuse-vertical-navigation-item-title-wrapper">
|
||||||
@@ -24,25 +22,25 @@
|
|||||||
{{item.title}}
|
{{item.title}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="item.subtitle">
|
<div
|
||||||
<div class="fuse-vertical-navigation-item-subtitle">
|
class="fuse-vertical-navigation-item-subtitle"
|
||||||
<span [ngClass]="item.classes?.subtitle">
|
*ngIf="item.subtitle">
|
||||||
{{item.subtitle}}
|
<span [ngClass]="item.classes?.subtitle">
|
||||||
</span>
|
{{item.subtitle}}
|
||||||
</div>
|
</span>
|
||||||
</ng-container>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Badge -->
|
<!-- Badge -->
|
||||||
<ng-container *ngIf="item.badge">
|
<div
|
||||||
<div class="fuse-vertical-navigation-item-badge">
|
class="fuse-vertical-navigation-item-badge"
|
||||||
<div
|
*ngIf="item.badge">
|
||||||
class="fuse-vertical-navigation-item-badge-content"
|
<div
|
||||||
[ngClass]="item.badge.classes">
|
class="fuse-vertical-navigation-item-badge-content"
|
||||||
{{item.badge.title}}
|
[ngClass]="item.badge.classes">
|
||||||
</div>
|
{{item.badge.title}}
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</div>
|
||||||
|
|
||||||
<!-- Arrow -->
|
<!-- Arrow -->
|
||||||
<mat-icon
|
<mat-icon
|
||||||
@@ -64,40 +62,35 @@
|
|||||||
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
||||||
|
|
||||||
<!-- Basic -->
|
<!-- Basic -->
|
||||||
<ng-container *ngIf="item.type === 'basic'">
|
<fuse-vertical-navigation-basic-item
|
||||||
<fuse-vertical-navigation-basic-item
|
*ngIf="item.type === 'basic'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-basic-item>
|
[name]="name"></fuse-vertical-navigation-basic-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Collapsable -->
|
<!-- Collapsable -->
|
||||||
<ng-container *ngIf="item.type === 'collapsable'">
|
<fuse-vertical-navigation-collapsable-item
|
||||||
<fuse-vertical-navigation-collapsable-item
|
*ngIf="item.type === 'collapsable'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"
|
[name]="name"
|
||||||
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-collapsable-item>
|
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-collapsable-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Divider -->
|
<!-- Divider -->
|
||||||
<ng-container *ngIf="item.type === 'divider'">
|
<fuse-vertical-navigation-divider-item
|
||||||
<fuse-vertical-navigation-divider-item
|
*ngIf="item.type === 'divider'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-divider-item>
|
[name]="name"></fuse-vertical-navigation-divider-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Group -->
|
<!-- Group -->
|
||||||
<ng-container *ngIf="item.type === 'group'">
|
<fuse-vertical-navigation-group-item
|
||||||
<fuse-vertical-navigation-group-item
|
*ngIf="item.type === 'group'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-group-item>
|
[name]="name"></fuse-vertical-navigation-group-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Spacer -->
|
<!-- Spacer -->
|
||||||
<ng-container *ngIf="item.type === 'spacer'">
|
<fuse-vertical-navigation-spacer-item
|
||||||
<fuse-vertical-navigation-spacer-item
|
*ngIf="item.type === 'spacer'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-spacer-item>
|
[name]="name"></fuse-vertical-navigation-spacer-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,23 @@
|
|||||||
import { BooleanInput } from '@angular/cdk/coercion';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { NgClass, NgFor, NgIf } from '@angular/common';
|
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef, HostBinding, Input, OnDestroy, OnInit } from '@angular/core';
|
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
||||||
import { NavigationEnd, Router } from '@angular/router';
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
import { fuseAnimations } from '@fuse/animations';
|
import { BooleanInput } from '@angular/cdk/coercion';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { filter, takeUntil } from 'rxjs/operators';
|
||||||
|
import { FuseAnimations } from '@fuse/animations';
|
||||||
|
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { FuseVerticalNavigationBasicItemComponent } from '@fuse/components/navigation/vertical/components/basic/basic.component';
|
|
||||||
import { FuseVerticalNavigationDividerItemComponent } from '@fuse/components/navigation/vertical/components/divider/divider.component';
|
|
||||||
import { FuseVerticalNavigationGroupItemComponent } from '@fuse/components/navigation/vertical/components/group/group.component';
|
|
||||||
import { FuseVerticalNavigationSpacerItemComponent } from '@fuse/components/navigation/vertical/components/spacer/spacer.component';
|
|
||||||
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
|
||||||
import { filter, Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-vertical-navigation-collapsable-item',
|
selector : 'fuse-vertical-navigation-collapsable-item',
|
||||||
templateUrl : './collapsable.component.html',
|
templateUrl : './collapsable.component.html',
|
||||||
animations : fuseAnimations,
|
styles : [],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
animations : FuseAnimations,
|
||||||
standalone : true,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
imports : [NgClass, MatTooltipModule, NgIf, MatIconModule, NgFor, FuseVerticalNavigationBasicItemComponent, forwardRef(() => FuseVerticalNavigationCollapsableItemComponent), FuseVerticalNavigationDividerItemComponent, FuseVerticalNavigationGroupItemComponent, FuseVerticalNavigationSpacerItemComponent],
|
|
||||||
})
|
})
|
||||||
export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, OnDestroy
|
export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
static ngAcceptInputType_autoCollapse: BooleanInput;
|
static ngAcceptInputType_autoCollapse: BooleanInput;
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
|
|
||||||
@Input() autoCollapse: boolean;
|
@Input() autoCollapse: boolean;
|
||||||
@Input() item: FuseNavigationItem;
|
@Input() item: FuseNavigationItem;
|
||||||
@@ -43,7 +34,7 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
|
|||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _router: Router,
|
private _router: Router,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -57,12 +48,10 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
|
|||||||
*/
|
*/
|
||||||
@HostBinding('class') get classList(): any
|
@HostBinding('class') get classList(): any
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
return {
|
return {
|
||||||
'fuse-vertical-navigation-item-collapsed': this.isCollapsed,
|
'fuse-vertical-navigation-item-collapsed': this.isCollapsed,
|
||||||
'fuse-vertical-navigation-item-expanded' : this.isExpanded,
|
'fuse-vertical-navigation-item-expanded' : this.isExpanded
|
||||||
};
|
};
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -95,8 +84,8 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
|
|||||||
// Listen for the onCollapsableItemCollapsed from the service
|
// Listen for the onCollapsableItemCollapsed from the service
|
||||||
this._fuseVerticalNavigationComponent.onCollapsableItemCollapsed
|
this._fuseVerticalNavigationComponent.onCollapsableItemCollapsed
|
||||||
.pipe(takeUntil(this._unsubscribeAll))
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
.subscribe((collapsedItem) =>
|
.subscribe((collapsedItem) => {
|
||||||
{
|
|
||||||
// Check if the collapsed item is null
|
// Check if the collapsed item is null
|
||||||
if ( collapsedItem === null )
|
if ( collapsedItem === null )
|
||||||
{
|
{
|
||||||
@@ -115,8 +104,8 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
|
|||||||
{
|
{
|
||||||
this._fuseVerticalNavigationComponent.onCollapsableItemExpanded
|
this._fuseVerticalNavigationComponent.onCollapsableItemExpanded
|
||||||
.pipe(takeUntil(this._unsubscribeAll))
|
.pipe(takeUntil(this._unsubscribeAll))
|
||||||
.subscribe((expandedItem) =>
|
.subscribe((expandedItem) => {
|
||||||
{
|
|
||||||
// Check if the expanded item is null
|
// Check if the expanded item is null
|
||||||
if ( expandedItem === null )
|
if ( expandedItem === null )
|
||||||
{
|
{
|
||||||
@@ -150,10 +139,10 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
|
|||||||
this._router.events
|
this._router.events
|
||||||
.pipe(
|
.pipe(
|
||||||
filter((event): event is NavigationEnd => event instanceof NavigationEnd),
|
filter((event): event is NavigationEnd => event instanceof NavigationEnd),
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
)
|
)
|
||||||
.subscribe((event: NavigationEnd) =>
|
.subscribe((event: NavigationEnd) => {
|
||||||
{
|
|
||||||
// If the item has a children that has a matching url with the current url, expand...
|
// If the item has a children that has a matching url with the current url, expand...
|
||||||
if ( this._hasActiveChild(this.item, event.urlAfterRedirects) )
|
if ( this._hasActiveChild(this.item, event.urlAfterRedirects) )
|
||||||
{
|
{
|
||||||
@@ -172,9 +161,9 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
|
|||||||
|
|
||||||
// Subscribe to onRefreshed on the navigation component
|
// Subscribe to onRefreshed on the navigation component
|
||||||
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
@@ -186,10 +175,88 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Private methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given item has the given url
|
||||||
|
* in one of its children
|
||||||
|
*
|
||||||
|
* @param item
|
||||||
|
* @param currentUrl
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _hasActiveChild(item: FuseNavigationItem, currentUrl: string): boolean
|
||||||
|
{
|
||||||
|
const children = item.children;
|
||||||
|
|
||||||
|
if ( !children )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( const child of children )
|
||||||
|
{
|
||||||
|
if ( child.children )
|
||||||
|
{
|
||||||
|
if ( this._hasActiveChild(child, currentUrl) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the child has a link and is active
|
||||||
|
if ( child.link && this._router.isActive(child.link, child.exactMatch || false) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this is a children
|
||||||
|
* of the given item
|
||||||
|
*
|
||||||
|
* @param parent
|
||||||
|
* @param item
|
||||||
|
* @return {boolean}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _isChildrenOf(parent: FuseNavigationItem, item: FuseNavigationItem): boolean
|
||||||
|
{
|
||||||
|
const children = parent.children;
|
||||||
|
|
||||||
|
if ( !children )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( children.indexOf(item) > -1 )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( const child of children )
|
||||||
|
{
|
||||||
|
if ( child.children )
|
||||||
|
{
|
||||||
|
if ( this._isChildrenOf(child, item) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
// @ Public methods
|
// @ Public methods
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -276,81 +343,4 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
|
|||||||
{
|
{
|
||||||
return item.id || index;
|
return item.id || index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
// @ Private methods
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the given item has the given url
|
|
||||||
* in one of its children
|
|
||||||
*
|
|
||||||
* @param item
|
|
||||||
* @param currentUrl
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
private _hasActiveChild(item: FuseNavigationItem, currentUrl: string): boolean
|
|
||||||
{
|
|
||||||
const children = item.children;
|
|
||||||
|
|
||||||
if ( !children )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( const child of children )
|
|
||||||
{
|
|
||||||
if ( child.children )
|
|
||||||
{
|
|
||||||
if ( this._hasActiveChild(child, currentUrl) )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the child has a link and is active
|
|
||||||
if ( child.link && this._router.isActive(child.link, child.exactMatch || false) )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if this is a children
|
|
||||||
* of the given item
|
|
||||||
*
|
|
||||||
* @param parent
|
|
||||||
* @param item
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
private _isChildrenOf(parent: FuseNavigationItem, item: FuseNavigationItem): boolean
|
|
||||||
{
|
|
||||||
const children = parent.children;
|
|
||||||
|
|
||||||
if ( !children )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( children.indexOf(item) > -1 )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( const child of children )
|
|
||||||
{
|
|
||||||
if ( child.children )
|
|
||||||
{
|
|
||||||
if ( this._isChildrenOf(child, item) )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import { NgClass } from '@angular/common';
|
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
|
||||||
import { Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-vertical-navigation-divider-item',
|
selector : 'fuse-vertical-navigation-divider-item',
|
||||||
templateUrl : './divider.component.html',
|
templateUrl : './divider.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
styles : [],
|
||||||
standalone : true,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
imports : [NgClass],
|
|
||||||
})
|
})
|
||||||
export class FuseVerticalNavigationDividerItemComponent implements OnInit, OnDestroy
|
export class FuseVerticalNavigationDividerItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@@ -25,7 +24,7 @@ export class FuseVerticalNavigationDividerItemComponent implements OnInit, OnDes
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -44,9 +43,9 @@ export class FuseVerticalNavigationDividerItemComponent implements OnInit, OnDes
|
|||||||
|
|
||||||
// Subscribe to onRefreshed on the navigation component
|
// Subscribe to onRefreshed on the navigation component
|
||||||
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
@@ -58,7 +57,7 @@ export class FuseVerticalNavigationDividerItemComponent implements OnInit, OnDes
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,11 @@
|
|||||||
<div class="fuse-vertical-navigation-item">
|
<div class="fuse-vertical-navigation-item">
|
||||||
|
|
||||||
<!-- Icon -->
|
<!-- Icon -->
|
||||||
<ng-container *ngIf="item.icon">
|
<mat-icon
|
||||||
<mat-icon
|
class="fuse-vertical-navigation-item-icon"
|
||||||
class="fuse-vertical-navigation-item-icon"
|
[ngClass]="item.classes?.icon"
|
||||||
[ngClass]="item.classes?.icon"
|
*ngIf="item.icon"
|
||||||
[svgIcon]="item.icon"></mat-icon>
|
[svgIcon]="item.icon"></mat-icon>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Title & Subtitle -->
|
<!-- Title & Subtitle -->
|
||||||
<div class="fuse-vertical-navigation-item-title-wrapper">
|
<div class="fuse-vertical-navigation-item-title-wrapper">
|
||||||
@@ -21,25 +20,25 @@
|
|||||||
{{item.title}}
|
{{item.title}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="item.subtitle">
|
<div
|
||||||
<div class="fuse-vertical-navigation-item-subtitle">
|
class="fuse-vertical-navigation-item-subtitle"
|
||||||
<span [ngClass]="item.classes?.subtitle">
|
*ngIf="item.subtitle">
|
||||||
{{item.subtitle}}
|
<span [ngClass]="item.classes?.subtitle">
|
||||||
</span>
|
{{item.subtitle}}
|
||||||
</div>
|
</span>
|
||||||
</ng-container>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Badge -->
|
<!-- Badge -->
|
||||||
<ng-container *ngIf="item.badge">
|
<div
|
||||||
<div class="fuse-vertical-navigation-item-badge">
|
class="fuse-vertical-navigation-item-badge"
|
||||||
<div
|
*ngIf="item.badge">
|
||||||
class="fuse-vertical-navigation-item-badge-content"
|
<div
|
||||||
[ngClass]="item.badge.classes">
|
class="fuse-vertical-navigation-item-badge-content"
|
||||||
{{item.badge.title}}
|
[ngClass]="item.badge.classes">
|
||||||
</div>
|
{{item.badge.title}}
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -51,40 +50,35 @@
|
|||||||
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
||||||
|
|
||||||
<!-- Basic -->
|
<!-- Basic -->
|
||||||
<ng-container *ngIf="item.type === 'basic'">
|
<fuse-vertical-navigation-basic-item
|
||||||
<fuse-vertical-navigation-basic-item
|
*ngIf="item.type === 'basic'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-basic-item>
|
[name]="name"></fuse-vertical-navigation-basic-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Collapsable -->
|
<!-- Collapsable -->
|
||||||
<ng-container *ngIf="item.type === 'collapsable'">
|
<fuse-vertical-navigation-collapsable-item
|
||||||
<fuse-vertical-navigation-collapsable-item
|
*ngIf="item.type === 'collapsable'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"
|
[name]="name"
|
||||||
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-collapsable-item>
|
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-collapsable-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Divider -->
|
<!-- Divider -->
|
||||||
<ng-container *ngIf="item.type === 'divider'">
|
<fuse-vertical-navigation-divider-item
|
||||||
<fuse-vertical-navigation-divider-item
|
*ngIf="item.type === 'divider'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-divider-item>
|
[name]="name"></fuse-vertical-navigation-divider-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Group -->
|
<!-- Group -->
|
||||||
<ng-container *ngIf="item.type === 'group'">
|
<fuse-vertical-navigation-group-item
|
||||||
<fuse-vertical-navigation-group-item
|
*ngIf="item.type === 'group'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-group-item>
|
[name]="name"></fuse-vertical-navigation-group-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Spacer -->
|
<!-- Spacer -->
|
||||||
<ng-container *ngIf="item.type === 'spacer'">
|
<fuse-vertical-navigation-spacer-item
|
||||||
<fuse-vertical-navigation-spacer-item
|
*ngIf="item.type === 'spacer'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-spacer-item>
|
[name]="name"></fuse-vertical-navigation-spacer-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,20 @@
|
|||||||
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { BooleanInput } from '@angular/cdk/coercion';
|
import { BooleanInput } from '@angular/cdk/coercion';
|
||||||
import { NgClass, NgFor, NgIf } from '@angular/common';
|
import { Subject } from 'rxjs';
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { FuseVerticalNavigationBasicItemComponent } from '@fuse/components/navigation/vertical/components/basic/basic.component';
|
|
||||||
import { FuseVerticalNavigationCollapsableItemComponent } from '@fuse/components/navigation/vertical/components/collapsable/collapsable.component';
|
|
||||||
import { FuseVerticalNavigationDividerItemComponent } from '@fuse/components/navigation/vertical/components/divider/divider.component';
|
|
||||||
import { FuseVerticalNavigationSpacerItemComponent } from '@fuse/components/navigation/vertical/components/spacer/spacer.component';
|
|
||||||
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
|
||||||
import { Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-vertical-navigation-group-item',
|
selector : 'fuse-vertical-navigation-group-item',
|
||||||
templateUrl : './group.component.html',
|
templateUrl : './group.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
styles : [],
|
||||||
standalone : true,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
imports : [NgClass, NgIf, MatIconModule, NgFor, FuseVerticalNavigationBasicItemComponent, FuseVerticalNavigationCollapsableItemComponent, FuseVerticalNavigationDividerItemComponent, forwardRef(() => FuseVerticalNavigationGroupItemComponent), FuseVerticalNavigationSpacerItemComponent],
|
|
||||||
})
|
})
|
||||||
export class FuseVerticalNavigationGroupItemComponent implements OnInit, OnDestroy
|
export class FuseVerticalNavigationGroupItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
static ngAcceptInputType_autoCollapse: BooleanInput;
|
static ngAcceptInputType_autoCollapse: BooleanInput;
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
|
|
||||||
@Input() autoCollapse: boolean;
|
@Input() autoCollapse: boolean;
|
||||||
@Input() item: FuseNavigationItem;
|
@Input() item: FuseNavigationItem;
|
||||||
@@ -36,7 +28,7 @@ export class FuseVerticalNavigationGroupItemComponent implements OnInit, OnDestr
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -55,9 +47,9 @@ export class FuseVerticalNavigationGroupItemComponent implements OnInit, OnDestr
|
|||||||
|
|
||||||
// Subscribe to onRefreshed on the navigation component
|
// Subscribe to onRefreshed on the navigation component
|
||||||
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
@@ -69,7 +61,7 @@ export class FuseVerticalNavigationGroupItemComponent implements OnInit, OnDestr
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import { NgClass } from '@angular/common';
|
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||||
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
|
||||||
import { Subject, takeUntil } from 'rxjs';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-vertical-navigation-spacer-item',
|
selector : 'fuse-vertical-navigation-spacer-item',
|
||||||
templateUrl : './spacer.component.html',
|
templateUrl : './spacer.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
styles : [],
|
||||||
standalone : true,
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
imports : [NgClass],
|
|
||||||
})
|
})
|
||||||
export class FuseVerticalNavigationSpacerItemComponent implements OnInit, OnDestroy
|
export class FuseVerticalNavigationSpacerItemComponent implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@@ -25,7 +24,7 @@ export class FuseVerticalNavigationSpacerItemComponent implements OnInit, OnDest
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -44,9 +43,9 @@ export class FuseVerticalNavigationSpacerItemComponent implements OnInit, OnDest
|
|||||||
|
|
||||||
// Subscribe to onRefreshed on the navigation component
|
// Subscribe to onRefreshed on the navigation component
|
||||||
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
this._fuseVerticalNavigationComponent.onRefreshed.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
@@ -58,7 +57,7 @@ export class FuseVerticalNavigationSpacerItemComponent implements OnInit, OnDest
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,20 @@
|
|||||||
/* Variables */
|
/* Variables */
|
||||||
:root {
|
$fuse-vertical-navigation-compact-width: 112;
|
||||||
--fuse-vertical-navigation-compact-width: 112px;
|
|
||||||
}
|
|
||||||
|
|
||||||
fuse-vertical-navigation {
|
fuse-vertical-navigation {
|
||||||
|
|
||||||
/* Compact appearance overrides */
|
/* Compact appearance overrides */
|
||||||
&.fuse-vertical-navigation-appearance-compact {
|
&.fuse-vertical-navigation-appearance-compact {
|
||||||
width: var(--fuse-vertical-navigation-compact-width);
|
width: #{$fuse-vertical-navigation-compact-width}px;
|
||||||
min-width: var(--fuse-vertical-navigation-compact-width);
|
min-width: #{$fuse-vertical-navigation-compact-width}px;
|
||||||
max-width: var(--fuse-vertical-navigation-compact-width);
|
max-width: #{$fuse-vertical-navigation-compact-width}px;
|
||||||
|
|
||||||
/* Left positioned */
|
/* Left positioned */
|
||||||
&.fuse-vertical-navigation-position-left {
|
&.fuse-vertical-navigation-position-left {
|
||||||
|
|
||||||
/* Side mode */
|
/* Side mode */
|
||||||
&.fuse-vertical-navigation-mode-side {
|
&.fuse-vertical-navigation-mode-side {
|
||||||
margin-left: calc(var(--fuse-vertical-navigation-compact-width) * -1);
|
margin-left: -#{$fuse-vertical-navigation-compact-width}px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Opened */
|
/* Opened */
|
||||||
@@ -30,7 +28,7 @@ fuse-vertical-navigation {
|
|||||||
|
|
||||||
/* Side mode */
|
/* Side mode */
|
||||||
&.fuse-vertical-navigation-mode-side {
|
&.fuse-vertical-navigation-mode-side {
|
||||||
margin-right: calc(var(--fuse-vertical-navigation-compact-width) * -1);
|
margin-right: -#{$fuse-vertical-navigation-compact-width}px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Opened */
|
/* Opened */
|
||||||
@@ -41,7 +39,7 @@ fuse-vertical-navigation {
|
|||||||
/* Aside wrapper */
|
/* Aside wrapper */
|
||||||
.fuse-vertical-navigation-aside-wrapper {
|
.fuse-vertical-navigation-aside-wrapper {
|
||||||
left: auto;
|
left: auto;
|
||||||
right: var(--fuse-vertical-navigation-compact-width);
|
right: #{$fuse-vertical-navigation-compact-width}px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +104,7 @@ fuse-vertical-navigation {
|
|||||||
|
|
||||||
/* Aside wrapper */
|
/* Aside wrapper */
|
||||||
.fuse-vertical-navigation-aside-wrapper {
|
.fuse-vertical-navigation-aside-wrapper {
|
||||||
left: var(--fuse-vertical-navigation-compact-width);
|
left: #{$fuse-vertical-navigation-compact-width}px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
/* Variables */
|
/* Variables */
|
||||||
:root {
|
$fuse-vertical-navigation-width: 280;
|
||||||
--fuse-vertical-navigation-width: 280px;
|
|
||||||
}
|
|
||||||
|
|
||||||
fuse-vertical-navigation {
|
fuse-vertical-navigation {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
@@ -9,9 +7,9 @@ fuse-vertical-navigation {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex: 1 0 auto;
|
flex: 1 0 auto;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: var(--fuse-vertical-navigation-width);
|
width: #{$fuse-vertical-navigation-width}px;
|
||||||
min-width: var(--fuse-vertical-navigation-width);
|
min-width: #{$fuse-vertical-navigation-width}px;
|
||||||
max-width: var(--fuse-vertical-navigation-width);
|
max-width: #{$fuse-vertical-navigation-width}px;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
max-height: 100vh;
|
max-height: 100vh;
|
||||||
@@ -47,7 +45,7 @@ fuse-vertical-navigation {
|
|||||||
|
|
||||||
/* Side mode */
|
/* Side mode */
|
||||||
&.fuse-vertical-navigation-mode-side {
|
&.fuse-vertical-navigation-mode-side {
|
||||||
margin-left: calc(#{var(--fuse-vertical-navigation-width)} * -1);
|
margin-left: -#{$fuse-vertical-navigation-width}px;
|
||||||
|
|
||||||
&.fuse-vertical-navigation-opened {
|
&.fuse-vertical-navigation-opened {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
@@ -75,7 +73,7 @@ fuse-vertical-navigation {
|
|||||||
|
|
||||||
/* Side mode */
|
/* Side mode */
|
||||||
&.fuse-vertical-navigation-mode-side {
|
&.fuse-vertical-navigation-mode-side {
|
||||||
margin-right: calc(var(--fuse-vertical-navigation-width) * -1);
|
margin-right: -#{$fuse-vertical-navigation-width}px;
|
||||||
|
|
||||||
&.fuse-vertical-navigation-opened {
|
&.fuse-vertical-navigation-opened {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
@@ -172,8 +170,8 @@ fuse-vertical-navigation {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: var(--fuse-vertical-navigation-width);
|
left: #{$fuse-vertical-navigation-width}px;
|
||||||
width: var(--fuse-vertical-navigation-width);
|
width: #{$fuse-vertical-navigation-width}px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
@@ -198,7 +196,7 @@ fuse-vertical-navigation {
|
|||||||
|
|
||||||
.fuse-vertical-navigation-aside-wrapper {
|
.fuse-vertical-navigation-aside-wrapper {
|
||||||
left: auto;
|
left: auto;
|
||||||
right: var(--fuse-vertical-navigation-width);
|
right: #{$fuse-vertical-navigation-width}px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,10 +336,6 @@ fuse-vertical-navigation {
|
|||||||
|
|
||||||
> .fuse-vertical-navigation-item-children {
|
> .fuse-vertical-navigation-item-children {
|
||||||
|
|
||||||
> *:first-child {
|
|
||||||
margin-top: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
> *:last-child {
|
> *:last-child {
|
||||||
padding-bottom: 6px;
|
padding-bottom: 6px;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
/* Variables */
|
/* Variables */
|
||||||
:root {
|
$fuse-vertical-navigation-width: 280;
|
||||||
--fuse-vertical-navigation-width: 280px;
|
$fuse-vertical-navigation-dense-width: 80;
|
||||||
--fuse-vertical-navigation-dense-width: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
fuse-vertical-navigation {
|
fuse-vertical-navigation {
|
||||||
|
|
||||||
@@ -10,16 +8,16 @@ fuse-vertical-navigation {
|
|||||||
&.fuse-vertical-navigation-appearance-dense {
|
&.fuse-vertical-navigation-appearance-dense {
|
||||||
|
|
||||||
&:not(.fuse-vertical-navigation-mode-over) {
|
&:not(.fuse-vertical-navigation-mode-over) {
|
||||||
width: var(--fuse-vertical-navigation-dense-width);
|
width: #{$fuse-vertical-navigation-dense-width}px;
|
||||||
min-width: var(--fuse-vertical-navigation-dense-width);
|
min-width: #{$fuse-vertical-navigation-dense-width}px;
|
||||||
max-width: var(--fuse-vertical-navigation-dense-width);
|
max-width: #{$fuse-vertical-navigation-dense-width}px;
|
||||||
|
|
||||||
/* Left positioned */
|
/* Left positioned */
|
||||||
&.fuse-vertical-navigation-position-left {
|
&.fuse-vertical-navigation-position-left {
|
||||||
|
|
||||||
/* Side mode */
|
/* Side mode */
|
||||||
&.fuse-vertical-navigation-mode-side {
|
&.fuse-vertical-navigation-mode-side {
|
||||||
margin-left: calc(var(--fuse-vertical-navigation-dense-width) * -1);
|
margin-left: -#{$fuse-vertical-navigation-dense-width}px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Opened */
|
/* Opened */
|
||||||
@@ -33,7 +31,7 @@ fuse-vertical-navigation {
|
|||||||
|
|
||||||
/* Side mode */
|
/* Side mode */
|
||||||
&.fuse-vertical-navigation-mode-side {
|
&.fuse-vertical-navigation-mode-side {
|
||||||
margin-right: calc(var(--fuse-vertical-navigation-dense-width) * -1);
|
margin-right: -#{$fuse-vertical-navigation-dense-width}px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Opened */
|
/* Opened */
|
||||||
@@ -44,14 +42,14 @@ fuse-vertical-navigation {
|
|||||||
/* Aside wrapper */
|
/* Aside wrapper */
|
||||||
.fuse-vertical-navigation-aside-wrapper {
|
.fuse-vertical-navigation-aside-wrapper {
|
||||||
left: auto;
|
left: auto;
|
||||||
right: var(--fuse-vertical-navigation-dense-width);
|
right: #{$fuse-vertical-navigation-dense-width}px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.fuse-vertical-navigation-hover {
|
&.fuse-vertical-navigation-hover {
|
||||||
|
|
||||||
.fuse-vertical-navigation-aside-wrapper {
|
.fuse-vertical-navigation-aside-wrapper {
|
||||||
left: auto;
|
left: auto;
|
||||||
right: var(--fuse-vertical-navigation-width);
|
right: #{$fuse-vertical-navigation-width}px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,9 +69,9 @@ fuse-vertical-navigation {
|
|||||||
.fuse-vertical-navigation-item-wrapper {
|
.fuse-vertical-navigation-item-wrapper {
|
||||||
|
|
||||||
.fuse-vertical-navigation-item {
|
.fuse-vertical-navigation-item {
|
||||||
width: calc(var(--fuse-vertical-navigation-dense-width) - 24px);
|
width: #{$fuse-vertical-navigation-width}px - 24px;
|
||||||
min-width: calc(var(--fuse-vertical-navigation-dense-width) - 24px);
|
min-width: #{$fuse-vertical-navigation-width}px - 24px;
|
||||||
max-width: calc(var(--fuse-vertical-navigation-dense-width) - 24px);
|
max-width: #{$fuse-vertical-navigation-width}px - 24px;
|
||||||
|
|
||||||
.fuse-vertical-navigation-item-arrow,
|
.fuse-vertical-navigation-item-arrow,
|
||||||
.fuse-vertical-navigation-item-badge,
|
.fuse-vertical-navigation-item-badge,
|
||||||
@@ -144,23 +142,20 @@ fuse-vertical-navigation {
|
|||||||
|
|
||||||
/* Aside wrapper */
|
/* Aside wrapper */
|
||||||
.fuse-vertical-navigation-aside-wrapper {
|
.fuse-vertical-navigation-aside-wrapper {
|
||||||
left: var(--fuse-vertical-navigation-dense-width);
|
left: #{$fuse-vertical-navigation-dense-width}px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hover */
|
/* Hover */
|
||||||
&.fuse-vertical-navigation-hover {
|
&.fuse-vertical-navigation-hover {
|
||||||
|
|
||||||
.fuse-vertical-navigation-wrapper {
|
.fuse-vertical-navigation-wrapper {
|
||||||
width: var(--fuse-vertical-navigation-width);
|
width: #{$fuse-vertical-navigation-width}px;
|
||||||
|
|
||||||
.fuse-vertical-navigation-content {
|
.fuse-vertical-navigation-content {
|
||||||
|
|
||||||
.fuse-vertical-navigation-item-wrapper {
|
.fuse-vertical-navigation-item-wrapper {
|
||||||
|
|
||||||
.fuse-vertical-navigation-item {
|
.fuse-vertical-navigation-item {
|
||||||
width: calc(var(--fuse-vertical-navigation-width) - 24px);
|
|
||||||
min-width: calc(var(--fuse-vertical-navigation-width) - 24px);
|
|
||||||
max-width: calc(var(--fuse-vertical-navigation-width) - 24px);
|
|
||||||
|
|
||||||
.fuse-vertical-navigation-item-arrow,
|
.fuse-vertical-navigation-item-arrow,
|
||||||
.fuse-vertical-navigation-item-badge,
|
.fuse-vertical-navigation-item-badge,
|
||||||
@@ -175,7 +170,7 @@ fuse-vertical-navigation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.fuse-vertical-navigation-aside-wrapper {
|
.fuse-vertical-navigation-aside-wrapper {
|
||||||
left: var(--fuse-vertical-navigation-width);
|
left: #{$fuse-vertical-navigation-width}px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
/* Variables */
|
/* Variables */
|
||||||
:root {
|
$fuse-vertical-navigation-thin-width: 80;
|
||||||
--fuse-vertical-navigation-thin-width: 80px;
|
|
||||||
}
|
|
||||||
|
|
||||||
fuse-vertical-navigation {
|
fuse-vertical-navigation {
|
||||||
|
|
||||||
/* Thin appearance overrides */
|
/* Thin appearance overrides */
|
||||||
&.fuse-vertical-navigation-appearance-thin {
|
&.fuse-vertical-navigation-appearance-thin {
|
||||||
width: var(--fuse-vertical-navigation-thin-width);
|
width: #{$fuse-vertical-navigation-thin-width}px;
|
||||||
min-width: var(--fuse-vertical-navigation-thin-width);
|
min-width: #{$fuse-vertical-navigation-thin-width}px;
|
||||||
max-width: var(--fuse-vertical-navigation-thin-width);
|
max-width: #{$fuse-vertical-navigation-thin-width}px;
|
||||||
|
|
||||||
/* Left positioned */
|
/* Left positioned */
|
||||||
&.fuse-vertical-navigation-position-left {
|
&.fuse-vertical-navigation-position-left {
|
||||||
|
|
||||||
&.fuse-vertical-navigation-mode-side {
|
&.fuse-vertical-navigation-mode-side {
|
||||||
margin-left: calc(var(--fuse-vertical-navigation-thin-width) * -1);
|
margin-left: -#{$fuse-vertical-navigation-thin-width}px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.fuse-vertical-navigation-opened {
|
&.fuse-vertical-navigation-opened {
|
||||||
@@ -27,7 +25,7 @@ fuse-vertical-navigation {
|
|||||||
&.fuse-vertical-navigation-position-right {
|
&.fuse-vertical-navigation-position-right {
|
||||||
|
|
||||||
&.fuse-vertical-navigation-mode-side {
|
&.fuse-vertical-navigation-mode-side {
|
||||||
margin-right: calc(var(--fuse-vertical-navigation-thin-width) * -1);
|
margin-right: -#{$fuse-vertical-navigation-thin-width}px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.fuse-vertical-navigation-opened {
|
&.fuse-vertical-navigation-opened {
|
||||||
@@ -36,7 +34,7 @@ fuse-vertical-navigation {
|
|||||||
|
|
||||||
.fuse-vertical-navigation-aside-wrapper {
|
.fuse-vertical-navigation-aside-wrapper {
|
||||||
left: auto;
|
left: auto;
|
||||||
right: var(--fuse-vertical-navigation-thin-width);
|
right: #{$fuse-vertical-navigation-thin-width}px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +91,7 @@ fuse-vertical-navigation {
|
|||||||
|
|
||||||
/* Aside wrapper */
|
/* Aside wrapper */
|
||||||
.fuse-vertical-navigation-aside-wrapper {
|
.fuse-vertical-navigation-aside-wrapper {
|
||||||
left: var(--fuse-vertical-navigation-thin-width);
|
left: #{$fuse-vertical-navigation-thin-width}px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,52 +24,46 @@
|
|||||||
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
||||||
|
|
||||||
<!-- Aside -->
|
<!-- Aside -->
|
||||||
<ng-container *ngIf="item.type === 'aside'">
|
<fuse-vertical-navigation-aside-item
|
||||||
<fuse-vertical-navigation-aside-item
|
*ngIf="item.type === 'aside'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"
|
[name]="name"
|
||||||
[activeItemId]="activeAsideItemId"
|
[activeItemId]="activeAsideItemId"
|
||||||
[autoCollapse]="autoCollapse"
|
[autoCollapse]="autoCollapse"
|
||||||
[skipChildren]="true"
|
[skipChildren]="true"
|
||||||
(click)="toggleAside(item)"></fuse-vertical-navigation-aside-item>
|
(click)="toggleAside(item)"></fuse-vertical-navigation-aside-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Basic -->
|
<!-- Basic -->
|
||||||
<ng-container *ngIf="item.type === 'basic'">
|
<fuse-vertical-navigation-basic-item
|
||||||
<fuse-vertical-navigation-basic-item
|
*ngIf="item.type === 'basic'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-basic-item>
|
[name]="name"></fuse-vertical-navigation-basic-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Collapsable -->
|
<!-- Collapsable -->
|
||||||
<ng-container *ngIf="item.type === 'collapsable'">
|
<fuse-vertical-navigation-collapsable-item
|
||||||
<fuse-vertical-navigation-collapsable-item
|
*ngIf="item.type === 'collapsable'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"
|
[name]="name"
|
||||||
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-collapsable-item>
|
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-collapsable-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Divider -->
|
<!-- Divider -->
|
||||||
<ng-container *ngIf="item.type === 'divider'">
|
<fuse-vertical-navigation-divider-item
|
||||||
<fuse-vertical-navigation-divider-item
|
*ngIf="item.type === 'divider'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-divider-item>
|
[name]="name"></fuse-vertical-navigation-divider-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Group -->
|
<!-- Group -->
|
||||||
<ng-container *ngIf="item.type === 'group'">
|
<fuse-vertical-navigation-group-item
|
||||||
<fuse-vertical-navigation-group-item
|
*ngIf="item.type === 'group'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"
|
[name]="name"
|
||||||
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-group-item>
|
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-group-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Spacer -->
|
<!-- Spacer -->
|
||||||
<ng-container *ngIf="item.type === 'spacer'">
|
<fuse-vertical-navigation-spacer-item
|
||||||
<fuse-vertical-navigation-spacer-item
|
*ngIf="item.type === 'spacer'"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"></fuse-vertical-navigation-spacer-item>
|
[name]="name"></fuse-vertical-navigation-spacer-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
@@ -90,33 +84,31 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Aside -->
|
<!-- Aside -->
|
||||||
<ng-container *ngIf="activeAsideItemId">
|
<div
|
||||||
<div
|
class="fuse-vertical-navigation-aside-wrapper"
|
||||||
class="fuse-vertical-navigation-aside-wrapper"
|
*ngIf="activeAsideItemId"
|
||||||
fuseScrollbar
|
fuseScrollbar
|
||||||
[fuseScrollbarOptions]="{wheelPropagation: false, suppressScrollX: true}"
|
[fuseScrollbarOptions]="{wheelPropagation: false, suppressScrollX: true}"
|
||||||
[@fadeInLeft]="position === 'left'"
|
[@fadeInLeft]="position === 'left'"
|
||||||
[@fadeInRight]="position === 'right'"
|
[@fadeInRight]="position === 'right'"
|
||||||
[@fadeOutLeft]="position === 'left'"
|
[@fadeOutLeft]="position === 'left'"
|
||||||
[@fadeOutRight]="position === 'right'">
|
[@fadeOutRight]="position === 'right'">
|
||||||
|
|
||||||
<!-- Items -->
|
<!-- Items -->
|
||||||
<ng-container *ngFor="let item of navigation; trackBy: trackByFn">
|
<ng-container *ngFor="let item of navigation; trackBy: trackByFn">
|
||||||
|
|
||||||
<!-- Skip the hidden items -->
|
<!-- Skip the hidden items -->
|
||||||
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
<ng-container *ngIf="(item.hidden && !item.hidden(item)) || !item.hidden">
|
||||||
|
|
||||||
<!-- Aside -->
|
<!-- Aside -->
|
||||||
<ng-container *ngIf="item.type === 'aside' && item.id === activeAsideItemId">
|
<fuse-vertical-navigation-aside-item
|
||||||
<fuse-vertical-navigation-aside-item
|
*ngIf="item.type === 'aside' && item.id === activeAsideItemId"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
[name]="name"
|
[name]="name"
|
||||||
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-aside-item>
|
[autoCollapse]="autoCollapse"></fuse-vertical-navigation-aside-item>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
</div>
|
</ng-container>
|
||||||
</ng-container>
|
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@use 'styles/appearances/default';
|
@import 'styles/appearances/default';
|
||||||
@use 'styles/appearances/compact';
|
@import 'styles/appearances/compact';
|
||||||
@use 'styles/appearances/dense';
|
@import 'styles/appearances/dense';
|
||||||
@use 'styles/appearances/thin';
|
@import 'styles/appearances/thin';
|
||||||
|
|||||||
@@ -1,40 +1,30 @@
|
|||||||
|
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, HostListener, Input, OnChanges, OnDestroy, OnInit, Output, QueryList, Renderer2, SimpleChanges, ViewChild, ViewChildren, ViewEncapsulation } from '@angular/core';
|
||||||
import { animate, AnimationBuilder, AnimationPlayer, style } from '@angular/animations';
|
import { animate, AnimationBuilder, AnimationPlayer, style } from '@angular/animations';
|
||||||
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
||||||
import { ScrollStrategy, ScrollStrategyOptions } from '@angular/cdk/overlay';
|
|
||||||
import { DOCUMENT, NgFor, NgIf } from '@angular/common';
|
|
||||||
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Input, OnChanges, OnDestroy, OnInit, Output, QueryList, Renderer2, SimpleChanges, ViewChild, ViewChildren, ViewEncapsulation } from '@angular/core';
|
|
||||||
import { NavigationEnd, Router } from '@angular/router';
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
import { fuseAnimations } from '@fuse/animations';
|
import { ScrollStrategy, ScrollStrategyOptions } from '@angular/cdk/overlay';
|
||||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
import { merge, ReplaySubject, Subject, Subscription } from 'rxjs';
|
||||||
|
import { delay, filter, takeUntil } from 'rxjs/operators';
|
||||||
|
import { FuseAnimations } from '@fuse/animations';
|
||||||
import { FuseNavigationItem, FuseVerticalNavigationAppearance, FuseVerticalNavigationMode, FuseVerticalNavigationPosition } from '@fuse/components/navigation/navigation.types';
|
import { FuseNavigationItem, FuseVerticalNavigationAppearance, FuseVerticalNavigationMode, FuseVerticalNavigationPosition } from '@fuse/components/navigation/navigation.types';
|
||||||
import { FuseVerticalNavigationAsideItemComponent } from '@fuse/components/navigation/vertical/components/aside/aside.component';
|
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||||
import { FuseVerticalNavigationBasicItemComponent } from '@fuse/components/navigation/vertical/components/basic/basic.component';
|
|
||||||
import { FuseVerticalNavigationCollapsableItemComponent } from '@fuse/components/navigation/vertical/components/collapsable/collapsable.component';
|
|
||||||
import { FuseVerticalNavigationDividerItemComponent } from '@fuse/components/navigation/vertical/components/divider/divider.component';
|
|
||||||
import { FuseVerticalNavigationGroupItemComponent } from '@fuse/components/navigation/vertical/components/group/group.component';
|
|
||||||
import { FuseVerticalNavigationSpacerItemComponent } from '@fuse/components/navigation/vertical/components/spacer/spacer.component';
|
|
||||||
import { FuseScrollbarDirective } from '@fuse/directives/scrollbar/scrollbar.directive';
|
import { FuseScrollbarDirective } from '@fuse/directives/scrollbar/scrollbar.directive';
|
||||||
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
||||||
import { delay, filter, merge, ReplaySubject, Subject, Subscription, takeUntil } from 'rxjs';
|
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector : 'fuse-vertical-navigation',
|
selector : 'fuse-vertical-navigation',
|
||||||
templateUrl : './vertical.component.html',
|
templateUrl : './vertical.component.html',
|
||||||
styleUrls : ['./vertical.component.scss'],
|
styleUrls : ['./vertical.component.scss'],
|
||||||
animations : fuseAnimations,
|
animations : FuseAnimations,
|
||||||
encapsulation : ViewEncapsulation.None,
|
encapsulation : ViewEncapsulation.None,
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
exportAs : 'fuseVerticalNavigation',
|
exportAs : 'fuseVerticalNavigation'
|
||||||
standalone : true,
|
|
||||||
imports : [FuseScrollbarDirective, NgFor, NgIf, FuseVerticalNavigationAsideItemComponent, FuseVerticalNavigationBasicItemComponent, FuseVerticalNavigationCollapsableItemComponent, FuseVerticalNavigationDividerItemComponent, FuseVerticalNavigationGroupItemComponent, FuseVerticalNavigationSpacerItemComponent],
|
|
||||||
})
|
})
|
||||||
export class FuseVerticalNavigationComponent implements OnChanges, OnInit, AfterViewInit, OnDestroy
|
export class FuseVerticalNavigationComponent implements OnChanges, OnInit, AfterViewInit, OnDestroy
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
static ngAcceptInputType_inner: BooleanInput;
|
static ngAcceptInputType_inner: BooleanInput;
|
||||||
static ngAcceptInputType_opened: BooleanInput;
|
static ngAcceptInputType_opened: BooleanInput;
|
||||||
static ngAcceptInputType_transparentOverlay: BooleanInput;
|
static ngAcceptInputType_transparentOverlay: BooleanInput;
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
|
|
||||||
@Input() appearance: FuseVerticalNavigationAppearance = 'default';
|
@Input() appearance: FuseVerticalNavigationAppearance = 'default';
|
||||||
@Input() autoCollapse: boolean = true;
|
@Input() autoCollapse: boolean = true;
|
||||||
@@ -60,7 +50,6 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
private readonly _handleAsideOverlayClick: any;
|
private readonly _handleAsideOverlayClick: any;
|
||||||
private readonly _handleOverlayClick: any;
|
private readonly _handleOverlayClick: any;
|
||||||
private _hovered: boolean = false;
|
private _hovered: boolean = false;
|
||||||
private _mutationObserver: MutationObserver;
|
|
||||||
private _overlay: HTMLElement;
|
private _overlay: HTMLElement;
|
||||||
private _player: AnimationPlayer;
|
private _player: AnimationPlayer;
|
||||||
private _scrollStrategy: ScrollStrategy = this._scrollStrategyOptions.block();
|
private _scrollStrategy: ScrollStrategy = this._scrollStrategyOptions.block();
|
||||||
@@ -74,21 +63,18 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
constructor(
|
constructor(
|
||||||
private _animationBuilder: AnimationBuilder,
|
private _animationBuilder: AnimationBuilder,
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
@Inject(DOCUMENT) private _document: Document,
|
|
||||||
private _elementRef: ElementRef,
|
private _elementRef: ElementRef,
|
||||||
private _renderer2: Renderer2,
|
private _renderer2: Renderer2,
|
||||||
private _router: Router,
|
private _router: Router,
|
||||||
private _scrollStrategyOptions: ScrollStrategyOptions,
|
private _scrollStrategyOptions: ScrollStrategyOptions,
|
||||||
private _fuseNavigationService: FuseNavigationService,
|
private _fuseNavigationService: FuseNavigationService,
|
||||||
private _fuseUtilsService: FuseUtilsService,
|
private _fuseUtilsService: FuseUtilsService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this._handleAsideOverlayClick = (): void =>
|
this._handleAsideOverlayClick = () => {
|
||||||
{
|
|
||||||
this.closeAside();
|
this.closeAside();
|
||||||
};
|
};
|
||||||
this._handleOverlayClick = (): void =>
|
this._handleOverlayClick = () => {
|
||||||
{
|
|
||||||
this.close();
|
this.close();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -102,7 +88,6 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
*/
|
*/
|
||||||
@HostBinding('class') get classList(): any
|
@HostBinding('class') get classList(): any
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
return {
|
return {
|
||||||
'fuse-vertical-navigation-animations-enabled' : this._animationsEnabled,
|
'fuse-vertical-navigation-animations-enabled' : this._animationsEnabled,
|
||||||
[`fuse-vertical-navigation-appearance-${this.appearance}`]: true,
|
[`fuse-vertical-navigation-appearance-${this.appearance}`]: true,
|
||||||
@@ -112,9 +97,8 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
'fuse-vertical-navigation-mode-side' : this.mode === 'side',
|
'fuse-vertical-navigation-mode-side' : this.mode === 'side',
|
||||||
'fuse-vertical-navigation-opened' : this.opened,
|
'fuse-vertical-navigation-opened' : this.opened,
|
||||||
'fuse-vertical-navigation-position-left' : this.position === 'left',
|
'fuse-vertical-navigation-position-left' : this.position === 'left',
|
||||||
'fuse-vertical-navigation-position-right' : this.position === 'right',
|
'fuse-vertical-navigation-position-right' : this.position === 'right'
|
||||||
};
|
};
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,7 +107,7 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
@HostBinding('style') get styleList(): any
|
@HostBinding('style') get styleList(): any
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
'visibility': this.opened ? 'visible' : 'hidden',
|
'visibility': this.opened ? 'visible' : 'hidden'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,56 +136,21 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
this._fuseScrollbarDirectivesSubscription =
|
this._fuseScrollbarDirectivesSubscription =
|
||||||
merge(
|
merge(
|
||||||
this.onCollapsableItemCollapsed,
|
this.onCollapsableItemCollapsed,
|
||||||
this.onCollapsableItemExpanded,
|
this.onCollapsableItemExpanded
|
||||||
)
|
)
|
||||||
.pipe(
|
.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll),
|
||||||
delay(250),
|
delay(250)
|
||||||
)
|
)
|
||||||
.subscribe(() =>
|
.subscribe(() => {
|
||||||
{
|
|
||||||
// Loop through the scrollbars and update them
|
// Loop through the scrollbars and update them
|
||||||
fuseScrollbarDirectives.forEach((fuseScrollbarDirective) =>
|
fuseScrollbarDirectives.forEach((fuseScrollbarDirective) => {
|
||||||
{
|
|
||||||
fuseScrollbarDirective.update();
|
fuseScrollbarDirective.update();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
// @ Decorated methods
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On mouseenter
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
@HostListener('mouseenter')
|
|
||||||
private _onMouseenter(): void
|
|
||||||
{
|
|
||||||
// Enable the animations
|
|
||||||
this._enableAnimations();
|
|
||||||
|
|
||||||
// Set the hovered
|
|
||||||
this._hovered = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On mouseleave
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
@HostListener('mouseleave')
|
|
||||||
private _onMouseleave(): void
|
|
||||||
{
|
|
||||||
// Enable the animations
|
|
||||||
this._enableAnimations();
|
|
||||||
|
|
||||||
// Set the hovered
|
|
||||||
this._hovered = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
// @ Lifecycle hooks
|
// @ Lifecycle hooks
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
@@ -264,8 +213,7 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
// Enable the animations after a delay
|
// Enable the animations after a delay
|
||||||
// The delay must be bigger than the current transition-duration
|
// The delay must be bigger than the current transition-duration
|
||||||
// to make sure nothing will be animated while the mode changing
|
// to make sure nothing will be animated while the mode changing
|
||||||
setTimeout(() =>
|
setTimeout(() => {
|
||||||
{
|
|
||||||
this._enableAnimations();
|
this._enableAnimations();
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
@@ -320,10 +268,10 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
this._router.events
|
this._router.events
|
||||||
.pipe(
|
.pipe(
|
||||||
filter(event => event instanceof NavigationEnd),
|
filter(event => event instanceof NavigationEnd),
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
)
|
)
|
||||||
.subscribe(() =>
|
.subscribe(() => {
|
||||||
{
|
|
||||||
// If the mode is 'over' and the navigation is opened...
|
// If the mode is 'over' and the navigation is opened...
|
||||||
if ( this.mode === 'over' && this.opened )
|
if ( this.mode === 'over' && this.opened )
|
||||||
{
|
{
|
||||||
@@ -345,38 +293,8 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
*/
|
*/
|
||||||
ngAfterViewInit(): void
|
ngAfterViewInit(): void
|
||||||
{
|
{
|
||||||
// Fix for Firefox.
|
setTimeout(() => {
|
||||||
//
|
|
||||||
// Because 'position: sticky' doesn't work correctly inside a 'position: fixed' parent,
|
|
||||||
// adding the '.cdk-global-scrollblock' to the html element breaks the navigation's position.
|
|
||||||
// This fixes the problem by reading the 'top' value from the html element and adding it as a
|
|
||||||
// 'marginTop' to the navigation itself.
|
|
||||||
this._mutationObserver = new MutationObserver((mutations) =>
|
|
||||||
{
|
|
||||||
mutations.forEach((mutation) =>
|
|
||||||
{
|
|
||||||
const mutationTarget = mutation.target as HTMLElement;
|
|
||||||
if ( mutation.attributeName === 'class' )
|
|
||||||
{
|
|
||||||
if ( mutationTarget.classList.contains('cdk-global-scrollblock') )
|
|
||||||
{
|
|
||||||
const top = parseInt(mutationTarget.style.top, 10);
|
|
||||||
this._renderer2.setStyle(this._elementRef.nativeElement, 'margin-top', `${Math.abs(top)}px`);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this._renderer2.setStyle(this._elementRef.nativeElement, 'margin-top', null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
this._mutationObserver.observe(this._document.documentElement, {
|
|
||||||
attributes : true,
|
|
||||||
attributeFilter: ['class'],
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(() =>
|
|
||||||
{
|
|
||||||
// Return if 'navigation content' element does not exist
|
// Return if 'navigation content' element does not exist
|
||||||
if ( !this._navigationContentEl )
|
if ( !this._navigationContentEl )
|
||||||
{
|
{
|
||||||
@@ -400,8 +318,8 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Go through all the scrollbar directives
|
// Go through all the scrollbar directives
|
||||||
this._fuseScrollbarDirectives.forEach((fuseScrollbarDirective) =>
|
this._fuseScrollbarDirectives.forEach((fuseScrollbarDirective) => {
|
||||||
{
|
|
||||||
// Skip if not enabled
|
// Skip if not enabled
|
||||||
if ( !fuseScrollbarDirective.isEnabled() )
|
if ( !fuseScrollbarDirective.isEnabled() )
|
||||||
{
|
{
|
||||||
@@ -420,18 +338,11 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
*/
|
*/
|
||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Disconnect the mutation observer
|
|
||||||
this._mutationObserver.disconnect();
|
|
||||||
|
|
||||||
// Forcefully close the navigation and aside in case they are opened
|
|
||||||
this.close();
|
|
||||||
this.closeAside();
|
|
||||||
|
|
||||||
// Deregister the navigation component from the registry
|
// Deregister the navigation component from the registry
|
||||||
this._fuseNavigationService.deregisterComponent(this.name);
|
this._fuseNavigationService.deregisterComponent(this.name);
|
||||||
|
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +549,7 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
|
|
||||||
// Create the enter animation and attach it to the player
|
// Create the enter animation and attach it to the player
|
||||||
this._player = this._animationBuilder.build([
|
this._player = this._animationBuilder.build([
|
||||||
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 1})),
|
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 1}))
|
||||||
]).create(this._overlay);
|
]).create(this._overlay);
|
||||||
|
|
||||||
// Play the animation
|
// Play the animation
|
||||||
@@ -662,15 +573,15 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
|
|
||||||
// Create the leave animation and attach it to the player
|
// Create the leave animation and attach it to the player
|
||||||
this._player = this._animationBuilder.build([
|
this._player = this._animationBuilder.build([
|
||||||
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 0})),
|
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 0}))
|
||||||
]).create(this._overlay);
|
]).create(this._overlay);
|
||||||
|
|
||||||
// Play the animation
|
// Play the animation
|
||||||
this._player.play();
|
this._player.play();
|
||||||
|
|
||||||
// Once the animation is done...
|
// Once the animation is done...
|
||||||
this._player.onDone(() =>
|
this._player.onDone(() => {
|
||||||
{
|
|
||||||
// If the overlay still exists...
|
// If the overlay still exists...
|
||||||
if ( this._overlay )
|
if ( this._overlay )
|
||||||
{
|
{
|
||||||
@@ -713,7 +624,7 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
this._player =
|
this._player =
|
||||||
this._animationBuilder
|
this._animationBuilder
|
||||||
.build([
|
.build([
|
||||||
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 1})),
|
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 1}))
|
||||||
]).create(this._asideOverlay);
|
]).create(this._asideOverlay);
|
||||||
|
|
||||||
// Play the animation
|
// Play the animation
|
||||||
@@ -739,15 +650,15 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
this._player =
|
this._player =
|
||||||
this._animationBuilder
|
this._animationBuilder
|
||||||
.build([
|
.build([
|
||||||
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 0})),
|
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 0}))
|
||||||
]).create(this._asideOverlay);
|
]).create(this._asideOverlay);
|
||||||
|
|
||||||
// Play the animation
|
// Play the animation
|
||||||
this._player.play();
|
this._player.play();
|
||||||
|
|
||||||
// Once the animation is done...
|
// Once the animation is done...
|
||||||
this._player.onDone(() =>
|
this._player.onDone(() => {
|
||||||
{
|
|
||||||
// If the aside overlay still exists...
|
// If the aside overlay still exists...
|
||||||
if ( this._asideOverlay )
|
if ( this._asideOverlay )
|
||||||
{
|
{
|
||||||
@@ -761,6 +672,36 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On mouseenter
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
@HostListener('mouseenter')
|
||||||
|
private _onMouseenter(): void
|
||||||
|
{
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Set the hovered
|
||||||
|
this._hovered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On mouseleave
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
@HostListener('mouseleave')
|
||||||
|
private _onMouseleave(): void
|
||||||
|
{
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
|
// Set the hovered
|
||||||
|
this._hovered = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open/close the navigation
|
* Open/close the navigation
|
||||||
*
|
*
|
||||||
|
|||||||
114
src/@fuse/directives/autogrow/autogrow.directive.ts
Normal file
114
src/@fuse/directives/autogrow/autogrow.directive.ts
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import { ChangeDetectorRef, Directive, ElementRef, HostBinding, HostListener, Input, NgZone, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: 'textarea[fuseAutogrow]',
|
||||||
|
exportAs: 'fuseAutogrow'
|
||||||
|
})
|
||||||
|
export class FuseAutogrowDirective implements OnChanges, OnInit, OnDestroy
|
||||||
|
{
|
||||||
|
// tslint:disable-next-line:no-input-rename
|
||||||
|
@Input('fuseAutogrowVerticalPadding') padding: number = 8;
|
||||||
|
@HostBinding('rows') private _rows: number = 1;
|
||||||
|
|
||||||
|
private _height: string = 'auto';
|
||||||
|
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private _elementRef: ElementRef,
|
||||||
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
|
private _ngZone: NgZone
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Accessors
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Host binding for component inline styles
|
||||||
|
*/
|
||||||
|
@HostBinding('style') get styleList(): any
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
'height' : this._height,
|
||||||
|
'overflow': 'hidden',
|
||||||
|
'resize' : 'none'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Lifecycle hooks
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On changes
|
||||||
|
*
|
||||||
|
* @param changes
|
||||||
|
*/
|
||||||
|
ngOnChanges(changes: SimpleChanges): void
|
||||||
|
{
|
||||||
|
// Padding
|
||||||
|
if ( 'fuseAutogrowVerticalPadding' in changes )
|
||||||
|
{
|
||||||
|
// Resize
|
||||||
|
this._resize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On init
|
||||||
|
*/
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
|
// Resize for the first time
|
||||||
|
this._resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On destroy
|
||||||
|
*/
|
||||||
|
ngOnDestroy(): void
|
||||||
|
{
|
||||||
|
// Unsubscribe from all subscriptions
|
||||||
|
this._unsubscribeAll.next();
|
||||||
|
this._unsubscribeAll.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Private methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resize on 'input' and 'ngModelChange' events
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
@HostListener('input')
|
||||||
|
@HostListener('ngModelChange')
|
||||||
|
private _resize(): void
|
||||||
|
{
|
||||||
|
// This doesn't need to trigger Angular's change detection by itself
|
||||||
|
this._ngZone.runOutsideAngular(() => {
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
|
||||||
|
// Set the height to 'auto' so we can correctly read the scrollHeight
|
||||||
|
this._height = 'auto';
|
||||||
|
|
||||||
|
// Detect the changes so the height is applied
|
||||||
|
this._changeDetectorRef.detectChanges();
|
||||||
|
|
||||||
|
// Get the scrollHeight and subtract the vertical padding
|
||||||
|
this._height = `${this._elementRef.nativeElement.scrollHeight - this.padding}px`;
|
||||||
|
|
||||||
|
// Detect the changes one more time to apply the final height
|
||||||
|
this._changeDetectorRef.detectChanges();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
14
src/@fuse/directives/autogrow/autogrow.module.ts
Normal file
14
src/@fuse/directives/autogrow/autogrow.module.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { FuseAutogrowDirective } from '@fuse/directives/autogrow/autogrow.directive';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseAutogrowDirective
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseAutogrowDirective
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseAutogrowModule
|
||||||
|
{
|
||||||
|
}
|
||||||
1
src/@fuse/directives/autogrow/index.ts
Normal file
1
src/@fuse/directives/autogrow/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from '@fuse/directives/autogrow/public-api';
|
||||||
2
src/@fuse/directives/autogrow/public-api.ts
Normal file
2
src/@fuse/directives/autogrow/public-api.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export * from '@fuse/directives/autogrow/autogrow.directive';
|
||||||
|
export * from '@fuse/directives/autogrow/autogrow.module';
|
||||||
@@ -1 +1,2 @@
|
|||||||
export * from '@fuse/directives/scroll-reset/scroll-reset.directive';
|
export * from '@fuse/directives/scroll-reset/scroll-reset.directive';
|
||||||
|
export * from '@fuse/directives/scroll-reset/scroll-reset.module';
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Directive, ElementRef, OnDestroy, OnInit } from '@angular/core';
|
import { Directive, ElementRef, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { NavigationEnd, Router } from '@angular/router';
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
import { filter, Subject, takeUntil } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
import { filter, takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector : '[fuseScrollReset]',
|
selector: '[fuseScrollReset]',
|
||||||
exportAs : 'fuseScrollReset',
|
exportAs: 'fuseScrollReset'
|
||||||
standalone: true,
|
|
||||||
})
|
})
|
||||||
export class FuseScrollResetDirective implements OnInit, OnDestroy
|
export class FuseScrollResetDirective implements OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
@@ -16,7 +16,7 @@ export class FuseScrollResetDirective implements OnInit, OnDestroy
|
|||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private _elementRef: ElementRef,
|
private _elementRef: ElementRef,
|
||||||
private _router: Router,
|
private _router: Router
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -33,9 +33,9 @@ export class FuseScrollResetDirective implements OnInit, OnDestroy
|
|||||||
// Subscribe to NavigationEnd event
|
// Subscribe to NavigationEnd event
|
||||||
this._router.events.pipe(
|
this._router.events.pipe(
|
||||||
filter(event => event instanceof NavigationEnd),
|
filter(event => event instanceof NavigationEnd),
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll)
|
||||||
).subscribe(() =>
|
).subscribe(() => {
|
||||||
{
|
|
||||||
// Reset the element's scroll position to the top
|
// Reset the element's scroll position to the top
|
||||||
this._elementRef.nativeElement.scrollTop = 0;
|
this._elementRef.nativeElement.scrollTop = 0;
|
||||||
});
|
});
|
||||||
@@ -47,7 +47,7 @@ export class FuseScrollResetDirective implements OnInit, OnDestroy
|
|||||||
ngOnDestroy(): void
|
ngOnDestroy(): void
|
||||||
{
|
{
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/@fuse/directives/scroll-reset/scroll-reset.module.ts
Normal file
14
src/@fuse/directives/scroll-reset/scroll-reset.module.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { FuseScrollResetDirective } from '@fuse/directives/scroll-reset/scroll-reset.directive';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseScrollResetDirective
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseScrollResetDirective
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseScrollResetModule
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -1 +1,2 @@
|
|||||||
export * from '@fuse/directives/scrollbar/scrollbar.directive';
|
export * from '@fuse/directives/scrollbar/scrollbar.directive';
|
||||||
|
export * from '@fuse/directives/scrollbar/scrollbar.module';
|
||||||
|
|||||||
@@ -1,25 +1,23 @@
|
|||||||
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
||||||
import { Platform } from '@angular/cdk/platform';
|
|
||||||
import { Directive, ElementRef, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
import { Directive, ElementRef, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { ScrollbarGeometry, ScrollbarPosition } from '@fuse/directives/scrollbar/scrollbar.types';
|
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||||
import { merge } from 'lodash-es';
|
import { Platform } from '@angular/cdk/platform';
|
||||||
|
import { fromEvent, Subject } from 'rxjs';
|
||||||
|
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||||
import PerfectScrollbar from 'perfect-scrollbar';
|
import PerfectScrollbar from 'perfect-scrollbar';
|
||||||
import { debounceTime, fromEvent, Subject, takeUntil } from 'rxjs';
|
import { merge } from 'lodash-es';
|
||||||
|
import { ScrollbarGeometry, ScrollbarPosition } from '@fuse/directives/scrollbar/scrollbar.types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper directive for the Perfect Scrollbar: https://github.com/mdbootstrap/perfect-scrollbar
|
* Wrapper directive for the Perfect Scrollbar: https://github.com/mdbootstrap/perfect-scrollbar
|
||||||
*/
|
*/
|
||||||
@Directive({
|
@Directive({
|
||||||
selector : '[fuseScrollbar]',
|
selector: '[fuseScrollbar]',
|
||||||
exportAs : 'fuseScrollbar',
|
exportAs: 'fuseScrollbar'
|
||||||
standalone: true,
|
|
||||||
})
|
})
|
||||||
export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
||||||
{
|
{
|
||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
|
||||||
static ngAcceptInputType_fuseScrollbar: BooleanInput;
|
static ngAcceptInputType_fuseScrollbar: BooleanInput;
|
||||||
/* eslint-enable @typescript-eslint/naming-convention */
|
|
||||||
|
|
||||||
@Input() fuseScrollbar: boolean = true;
|
@Input() fuseScrollbar: boolean = true;
|
||||||
@Input() fuseScrollbarOptions: PerfectScrollbar.Options;
|
@Input() fuseScrollbarOptions: PerfectScrollbar.Options;
|
||||||
@@ -35,7 +33,7 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
constructor(
|
constructor(
|
||||||
private _elementRef: ElementRef,
|
private _elementRef: ElementRef,
|
||||||
private _platform: Platform,
|
private _platform: Platform,
|
||||||
private _router: Router,
|
private _router: Router
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -102,13 +100,11 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Destroy and re-init the PerfectScrollbar to update its options
|
// Destroy and re-init the PerfectScrollbar to update its options
|
||||||
setTimeout(() =>
|
setTimeout(() => {
|
||||||
{
|
|
||||||
this._destroy();
|
this._destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() =>
|
setTimeout(() => {
|
||||||
{
|
|
||||||
this._init();
|
this._init();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -123,10 +119,10 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
fromEvent(window, 'resize')
|
fromEvent(window, 'resize')
|
||||||
.pipe(
|
.pipe(
|
||||||
takeUntil(this._unsubscribeAll),
|
takeUntil(this._unsubscribeAll),
|
||||||
debounceTime(150),
|
debounceTime(150)
|
||||||
)
|
)
|
||||||
.subscribe(() =>
|
.subscribe(() => {
|
||||||
{
|
|
||||||
// Update the PerfectScrollbar
|
// Update the PerfectScrollbar
|
||||||
this.update();
|
this.update();
|
||||||
});
|
});
|
||||||
@@ -140,7 +136,7 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
this._destroy();
|
this._destroy();
|
||||||
|
|
||||||
// Unsubscribe from all subscriptions
|
// Unsubscribe from all subscriptions
|
||||||
this._unsubscribeAll.next(null);
|
this._unsubscribeAll.next();
|
||||||
this._unsubscribeAll.complete();
|
this._unsubscribeAll.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,14 +202,14 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
{
|
{
|
||||||
scrollbarPosition = new ScrollbarPosition(
|
scrollbarPosition = new ScrollbarPosition(
|
||||||
this._ps.reach.x || 0,
|
this._ps.reach.x || 0,
|
||||||
this._ps.reach.y || 0,
|
this._ps.reach.y || 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scrollbarPosition = new ScrollbarPosition(
|
scrollbarPosition = new ScrollbarPosition(
|
||||||
this._elementRef.nativeElement.scrollLeft,
|
this._elementRef.nativeElement.scrollLeft,
|
||||||
this._elementRef.nativeElement.scrollTop,
|
this._elementRef.nativeElement.scrollTop
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,8 +246,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
/**
|
/**
|
||||||
* Scroll to X
|
* Scroll to X
|
||||||
*
|
*
|
||||||
* @param x
|
* @param {number} x
|
||||||
* @param speed
|
* @param {number} speed
|
||||||
*/
|
*/
|
||||||
scrollToX(x: number, speed?: number): void
|
scrollToX(x: number, speed?: number): void
|
||||||
{
|
{
|
||||||
@@ -261,8 +257,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
/**
|
/**
|
||||||
* Scroll to Y
|
* Scroll to Y
|
||||||
*
|
*
|
||||||
* @param y
|
* @param {number} y
|
||||||
* @param speed
|
* @param {number} speed
|
||||||
*/
|
*/
|
||||||
scrollToY(y: number, speed?: number): void
|
scrollToY(y: number, speed?: number): void
|
||||||
{
|
{
|
||||||
@@ -272,8 +268,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
/**
|
/**
|
||||||
* Scroll to top
|
* Scroll to top
|
||||||
*
|
*
|
||||||
* @param offset
|
* @param {number} offset
|
||||||
* @param speed
|
* @param {number} speed
|
||||||
*/
|
*/
|
||||||
scrollToTop(offset: number = 0, speed?: number): void
|
scrollToTop(offset: number = 0, speed?: number): void
|
||||||
{
|
{
|
||||||
@@ -283,8 +279,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
/**
|
/**
|
||||||
* Scroll to bottom
|
* Scroll to bottom
|
||||||
*
|
*
|
||||||
* @param offset
|
* @param {number} offset
|
||||||
* @param speed
|
* @param {number} speed
|
||||||
*/
|
*/
|
||||||
scrollToBottom(offset: number = 0, speed?: number): void
|
scrollToBottom(offset: number = 0, speed?: number): void
|
||||||
{
|
{
|
||||||
@@ -295,8 +291,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
/**
|
/**
|
||||||
* Scroll to left
|
* Scroll to left
|
||||||
*
|
*
|
||||||
* @param offset
|
* @param {number} offset
|
||||||
* @param speed
|
* @param {number} speed
|
||||||
*/
|
*/
|
||||||
scrollToLeft(offset: number = 0, speed?: number): void
|
scrollToLeft(offset: number = 0, speed?: number): void
|
||||||
{
|
{
|
||||||
@@ -306,8 +302,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
/**
|
/**
|
||||||
* Scroll to right
|
* Scroll to right
|
||||||
*
|
*
|
||||||
* @param offset
|
* @param {number} offset
|
||||||
* @param speed
|
* @param {number} speed
|
||||||
*/
|
*/
|
||||||
scrollToRight(offset: number = 0, speed?: number): void
|
scrollToRight(offset: number = 0, speed?: number): void
|
||||||
{
|
{
|
||||||
@@ -318,10 +314,10 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
/**
|
/**
|
||||||
* Scroll to element
|
* Scroll to element
|
||||||
*
|
*
|
||||||
* @param qs
|
* @param {string} qs
|
||||||
* @param offset
|
* @param {number} offset
|
||||||
* @param ignoreVisible If true, scrollToElement won't happen if element is already inside the current viewport
|
* @param {boolean} ignoreVisible If true, scrollToElement won't happen if element is already inside the current viewport
|
||||||
* @param speed
|
* @param {number} speed
|
||||||
*/
|
*/
|
||||||
scrollToElement(qs: string, offset: number = 0, ignoreVisible: boolean = false, speed?: number): void
|
scrollToElement(qs: string, offset: number = 0, ignoreVisible: boolean = false, speed?: number): void
|
||||||
{
|
{
|
||||||
@@ -391,8 +387,7 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
|||||||
|
|
||||||
const cosParameter = (oldValue - value) / 2;
|
const cosParameter = (oldValue - value) / 2;
|
||||||
|
|
||||||
const step = (newTimestamp: number): void =>
|
const step = (newTimestamp: number) => {
|
||||||
{
|
|
||||||
scrollCount += Math.PI / (speed / (newTimestamp - oldTimestamp));
|
scrollCount += Math.PI / (speed / (newTimestamp - oldTimestamp));
|
||||||
newValue = Math.round(value + cosParameter + cosParameter * Math.cos(scrollCount));
|
newValue = Math.round(value + cosParameter + cosParameter * Math.cos(scrollCount));
|
||||||
|
|
||||||
|
|||||||
14
src/@fuse/directives/scrollbar/scrollbar.module.ts
Normal file
14
src/@fuse/directives/scrollbar/scrollbar.module.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { FuseScrollbarDirective } from '@fuse/directives/scrollbar/scrollbar.directive';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
FuseScrollbarDirective
|
||||||
|
],
|
||||||
|
exports : [
|
||||||
|
FuseScrollbarDirective
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseScrollbarModule
|
||||||
|
{
|
||||||
|
}
|
||||||
37
src/@fuse/fuse.module.ts
Normal file
37
src/@fuse/fuse.module.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import { NgModule, Optional, SkipSelf } from '@angular/core';
|
||||||
|
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
||||||
|
import { FuseMediaWatcherModule } from '@fuse/services/media-watcher/media-watcher.module';
|
||||||
|
import { FuseSplashScreenModule } from '@fuse/services/splash-screen/splash-screen.module';
|
||||||
|
import { FuseTailwindConfigModule } from '@fuse/services/tailwind/tailwind.module';
|
||||||
|
import { FuseUtilsModule } from '@fuse/services/utils/utils.module';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports : [
|
||||||
|
FuseMediaWatcherModule,
|
||||||
|
FuseSplashScreenModule,
|
||||||
|
FuseTailwindConfigModule,
|
||||||
|
FuseUtilsModule
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
// Use the 'fill' appearance on Angular Material form fields by default
|
||||||
|
provide : MAT_FORM_FIELD_DEFAULT_OPTIONS,
|
||||||
|
useValue: {
|
||||||
|
appearance: 'fill'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FuseModule
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor(@Optional() @SkipSelf() parentModule?: FuseModule)
|
||||||
|
{
|
||||||
|
if ( parentModule )
|
||||||
|
{
|
||||||
|
throw new Error('FuseModule has already been loaded. Import this module in the AppModule only!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user