mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-12-24 08:37:05 +00:00
Compare commits
39 Commits
v12.2.0
...
v13.0.0-st
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d146a92c79 | ||
|
|
ee1caef303 | ||
|
|
cad136c0e5 | ||
|
|
d159ae1458 | ||
|
|
0c5f5b9165 | ||
|
|
f4ca06a9a8 | ||
|
|
6a86deaeec | ||
|
|
44e7401310 | ||
|
|
6d1dee8d0d | ||
|
|
b8b3d1daab | ||
|
|
c3ed184853 | ||
|
|
a9ada174b4 | ||
|
|
57ba071fa5 | ||
|
|
cc761d58e5 | ||
|
|
5c3db88908 | ||
|
|
039eef98ee | ||
|
|
83e67e1286 | ||
|
|
2bea991ba3 | ||
|
|
7e430a269c | ||
|
|
27b6858b76 | ||
|
|
4ccce1b423 | ||
|
|
f6b4ca0880 | ||
|
|
77014174e8 | ||
|
|
5ac7002a98 | ||
|
|
b0f1e1de95 | ||
|
|
cf01383358 | ||
|
|
e4442d683b | ||
|
|
623b43a94c | ||
|
|
e7a1d386a6 | ||
|
|
fcfba4c9e4 | ||
|
|
40894e0aa3 | ||
|
|
8dcf21cb1a | ||
|
|
d917f03883 | ||
|
|
0f2ddbda83 | ||
|
|
fa0d74504b | ||
|
|
ad2b19a07a | ||
|
|
4bf11591a2 | ||
|
|
f45a605b4e | ||
|
|
c150a8902c |
95
.eslintrc.json
Normal file
95
.eslintrc.json
Normal file
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"root": true,
|
||||
"env": {
|
||||
"es6": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
"ignorePatterns": [
|
||||
"projects/**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts"
|
||||
],
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"tsconfig.json",
|
||||
"e2e/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-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": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,7 +12,6 @@
|
||||
|
||||
# profiling files
|
||||
chrome-profiler-events*.json
|
||||
speed-measure-plugin*.json
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Fuse - Admin template and Starter project for Angular
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli)
|
||||
|
||||
## Development server
|
||||
|
||||
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.
|
||||
@@ -18,8 +20,8 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice.
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||
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.
|
||||
|
||||
69
angular.json
69
angular.json
@@ -22,7 +22,7 @@
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"aot": true,
|
||||
"inlineStyleLanguage": "scss",
|
||||
"allowedCommonJsDependencies": [
|
||||
"apexcharts",
|
||||
"highlight.js",
|
||||
@@ -33,7 +33,12 @@
|
||||
"assets": [
|
||||
"src/favicon-16x16.png",
|
||||
"src/favicon-32x32.png",
|
||||
"src/assets"
|
||||
"src/assets",
|
||||
{
|
||||
"glob": "_redirects",
|
||||
"input": "src",
|
||||
"output": "/"
|
||||
}
|
||||
],
|
||||
"stylePreprocessorOptions": {
|
||||
"includePaths": [
|
||||
@@ -52,19 +57,6 @@
|
||||
},
|
||||
"configurations": {
|
||||
"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": [
|
||||
{
|
||||
"type": "initial",
|
||||
@@ -76,20 +68,37 @@
|
||||
"maximumWarning": "100kb",
|
||||
"maximumError": "150kb"
|
||||
}
|
||||
]
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "fuse:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "fuse:build:production"
|
||||
},
|
||||
"development": {
|
||||
"browserTarget": "fuse:build:development"
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
@@ -104,6 +113,7 @@
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"karmaConfig": "karma.conf.js",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon-16x16.png",
|
||||
"src/favicon-32x32.png",
|
||||
@@ -116,15 +126,11 @@
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"builder": "@angular-eslint/builder:lint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"tsconfig.app.json",
|
||||
"tsconfig.spec.json",
|
||||
"e2e/tsconfig.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
"lintFilePatterns": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.html"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -143,5 +149,8 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "fuse"
|
||||
"defaultProject": "fuse",
|
||||
"cli": {
|
||||
"defaultCollection": "@angular-eslint/schematics"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
// @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
|
||||
}
|
||||
}));
|
||||
}
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
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));
|
||||
});
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/* 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"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ module.exports = function (config)
|
||||
suppressAll: true // removes the duplicated traces
|
||||
},
|
||||
coverageReporter : {
|
||||
dir : require('path').join(__dirname, './coverage/angular11'),
|
||||
dir : require('path').join(__dirname, './coverage/angular12'),
|
||||
subdir : '.',
|
||||
reporters: [
|
||||
{type: 'html'},
|
||||
|
||||
8034
package-lock.json
generated
8034
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
70
package.json
70
package.json
@@ -1,28 +1,28 @@
|
||||
{
|
||||
"name": "@fuse/demo",
|
||||
"version": "12.2.0",
|
||||
"version": "13.0.0",
|
||||
"license": "https://themeforest.net/licenses/standard",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build --prod",
|
||||
"build": "ng build",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular/animations": "11.2.12",
|
||||
"@angular/cdk": "11.2.11",
|
||||
"@angular/common": "11.2.12",
|
||||
"@angular/compiler": "11.2.12",
|
||||
"@angular/core": "11.2.12",
|
||||
"@angular/forms": "11.2.12",
|
||||
"@angular/material": "11.2.11",
|
||||
"@angular/material-moment-adapter": "11.2.11",
|
||||
"@angular/platform-browser": "11.2.12",
|
||||
"@angular/platform-browser-dynamic": "11.2.12",
|
||||
"@angular/router": "11.2.12",
|
||||
"@angular/animations": "12.0.0",
|
||||
"@angular/cdk": "12.0.0",
|
||||
"@angular/common": "12.0.0",
|
||||
"@angular/compiler": "12.0.0",
|
||||
"@angular/core": "12.0.0",
|
||||
"@angular/forms": "12.0.0",
|
||||
"@angular/material": "12.0.0",
|
||||
"@angular/material-moment-adapter": "12.0.0",
|
||||
"@angular/platform-browser": "12.0.0",
|
||||
"@angular/platform-browser-dynamic": "12.0.0",
|
||||
"@angular/router": "12.0.0",
|
||||
"@fullcalendar/angular": "4.4.5-beta",
|
||||
"@fullcalendar/core": "4.4.2",
|
||||
"@fullcalendar/daygrid": "4.4.2",
|
||||
@@ -31,15 +31,15 @@
|
||||
"@fullcalendar/moment": "4.4.2",
|
||||
"@fullcalendar/rrule": "4.4.2",
|
||||
"@fullcalendar/timegrid": "4.4.2",
|
||||
"apexcharts": "3.26.1",
|
||||
"apexcharts": "3.26.2",
|
||||
"crypto-js": "3.3.0",
|
||||
"highlight.js": "10.7.2",
|
||||
"lodash-es": "4.17.21",
|
||||
"moment": "2.29.1",
|
||||
"ng-apexcharts": "1.5.9",
|
||||
"ngx-markdown": "11.1.3",
|
||||
"ngx-quill": "13.3.1",
|
||||
"perfect-scrollbar": "1.5.0",
|
||||
"ngx-quill": "14.0.0",
|
||||
"perfect-scrollbar": "1.5.1",
|
||||
"quill": "1.3.7",
|
||||
"rrule": "2.6.8",
|
||||
"rxjs": "6.6.7",
|
||||
@@ -48,36 +48,44 @@
|
||||
"zone.js": "0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "0.1102.11",
|
||||
"@angular/cli": "11.2.11",
|
||||
"@angular/compiler-cli": "11.2.12",
|
||||
"@angular/language-service": "11.2.12",
|
||||
"@angular-devkit/build-angular": "12.0.0",
|
||||
"@angular-eslint/builder": "12.0.0",
|
||||
"@angular-eslint/eslint-plugin": "12.0.0",
|
||||
"@angular-eslint/eslint-plugin-template": "12.0.0",
|
||||
"@angular-eslint/schematics": "12.0.0",
|
||||
"@angular-eslint/template-parser": "12.0.0",
|
||||
"@angular/cli": "12.0.0",
|
||||
"@angular/compiler-cli": "12.0.0",
|
||||
"@angular/language-service": "12.0.0",
|
||||
"@tailwindcss/aspect-ratio": "0.2.0",
|
||||
"@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/jasmine": "3.6.9",
|
||||
"@types/lodash": "4.14.168",
|
||||
"@types/jasmine": "3.6.11",
|
||||
"@types/lodash": "4.14.169",
|
||||
"@types/lodash-es": "4.17.4",
|
||||
"@types/node": "12.20.10",
|
||||
"@types/node": "12.20.13",
|
||||
"@typescript-eslint/eslint-plugin": "4.23.0",
|
||||
"@typescript-eslint/parser": "4.23.0",
|
||||
"autoprefixer": "10.2.5",
|
||||
"chroma-js": "2.1.1",
|
||||
"codelyzer": "6.0.1",
|
||||
"jasmine-core": "3.6.0",
|
||||
"eslint": "7.26.0",
|
||||
"eslint-plugin-import": "2.23.0",
|
||||
"eslint-plugin-jsdoc": "34.2.2",
|
||||
"eslint-plugin-prefer-arrow": "1.2.3",
|
||||
"jasmine-core": "3.7.1",
|
||||
"jasmine-spec-reporter": "5.0.2",
|
||||
"karma": "6.1.2",
|
||||
"karma": "6.3.2",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-coverage": "2.0.3",
|
||||
"karma-jasmine": "4.0.1",
|
||||
"karma-jasmine-html-reporter": "1.5.4",
|
||||
"karma-jasmine-html-reporter": "1.6.0",
|
||||
"lodash": "4.17.21",
|
||||
"postcss": "8.2.13",
|
||||
"postcss": "8.2.15",
|
||||
"protractor": "7.0.0",
|
||||
"tailwindcss": "2.1.2",
|
||||
"ts-node": "8.3.0",
|
||||
"tslint": "6.1.3",
|
||||
"typescript": "4.1.5"
|
||||
"typescript": "4.2.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
export class FuseAnimationCurves
|
||||
{
|
||||
static STANDARD_CURVE = 'cubic-bezier(0.4, 0.0, 0.2, 1)';
|
||||
static DECELERATION_CURVE = 'cubic-bezier(0.0, 0.0, 0.2, 1)';
|
||||
static ACCELERATION_CURVE = 'cubic-bezier(0.4, 0.0, 1, 1)';
|
||||
static SHARP_CURVE = 'cubic-bezier(0.4, 0.0, 0.6, 1)';
|
||||
static standard = 'cubic-bezier(0.4, 0.0, 0.2, 1)';
|
||||
static deceleration = 'cubic-bezier(0.0, 0.0, 0.2, 1)';
|
||||
static acceleration = 'cubic-bezier(0.4, 0.0, 1, 1)';
|
||||
static sharp = 'cubic-bezier(0.4, 0.0, 0.6, 1)';
|
||||
}
|
||||
|
||||
export class FuseAnimationDurations
|
||||
{
|
||||
static COMPLEX = '375ms';
|
||||
static ENTERING = '225ms';
|
||||
static EXITING = '195ms';
|
||||
static complex = '375ms';
|
||||
static entering = '225ms';
|
||||
static exiting = '195ms';
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ const expandCollapse = trigger('expandCollapse',
|
||||
animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ const fadeIn = trigger('fadeIn',
|
||||
transition('void => *', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -58,7 +58,7 @@ const fadeInTop = trigger('fadeInTop',
|
||||
transition('void => *', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -91,7 +91,7 @@ const fadeInBottom = trigger('fadeInBottom',
|
||||
transition('void => *', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -124,7 +124,7 @@ const fadeInLeft = trigger('fadeInLeft',
|
||||
transition('void => *', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -157,7 +157,7 @@ const fadeInRight = trigger('fadeInRight',
|
||||
transition('void => *', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -188,7 +188,7 @@ const fadeOut = trigger('fadeOut',
|
||||
transition('* => void', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -221,7 +221,7 @@ const fadeOutTop = trigger('fadeOutTop',
|
||||
transition('* => void', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -254,7 +254,7 @@ const fadeOutBottom = trigger('fadeOutBottom',
|
||||
transition('* => void', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -287,7 +287,7 @@ const fadeOutLeft = trigger('fadeOutLeft',
|
||||
transition('* => void', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -320,7 +320,7 @@ const fadeOutRight = trigger('fadeOutRight',
|
||||
transition('* => void', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import { shake } from './shake';
|
||||
import { slideInBottom, slideInLeft, slideInRight, slideInTop, slideOutBottom, slideOutLeft, slideOutRight, slideOutTop } from './slide';
|
||||
import { zoomIn, zoomOut } from './zoom';
|
||||
|
||||
export const FuseAnimations = [
|
||||
export const fuseAnimations = [
|
||||
expandCollapse,
|
||||
fadeIn, fadeInTop, fadeInBottom, fadeInLeft, fadeInRight,
|
||||
fadeOut, fadeOutTop, fadeOutBottom, fadeOutLeft, fadeOutRight,
|
||||
|
||||
@@ -25,7 +25,7 @@ const slideInTop = trigger('slideInTop',
|
||||
transition('void => *', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -56,7 +56,7 @@ const slideInBottom = trigger('slideInBottom',
|
||||
transition('void => *', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -87,7 +87,7 @@ const slideInLeft = trigger('slideInLeft',
|
||||
transition('void => *', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -118,7 +118,7 @@ const slideInRight = trigger('slideInRight',
|
||||
transition('void => *', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -149,7 +149,7 @@ const slideOutTop = trigger('slideOutTop',
|
||||
transition('* => void', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -180,7 +180,7 @@ const slideOutBottom = trigger('slideOutBottom',
|
||||
transition('* => void', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -211,7 +211,7 @@ const slideOutLeft = trigger('slideOutLeft',
|
||||
transition('* => void', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -242,7 +242,7 @@ const slideOutRight = trigger('slideOutRight',
|
||||
transition('* => void', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ const zoomIn = trigger('zoomIn',
|
||||
transition('void => *', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.ENTERING} ${FuseAnimationCurves.DECELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.entering} ${FuseAnimationCurves.deceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -62,7 +62,7 @@ const zoomOut = trigger('zoomOut',
|
||||
transition('* => void', animate('{{timings}}'),
|
||||
{
|
||||
params: {
|
||||
timings: `${FuseAnimationDurations.EXITING} ${FuseAnimationCurves.ACCELERATION_CURVE}`
|
||||
timings: `${FuseAnimationDurations.exiting} ${FuseAnimationCurves.acceleration}`
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Ho
|
||||
import { Subject } from 'rxjs';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||
import { FuseAnimations } from '@fuse/animations';
|
||||
import { fuseAnimations } from '@fuse/animations';
|
||||
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';
|
||||
@@ -13,14 +13,16 @@ import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
||||
styleUrls : ['./alert.component.scss'],
|
||||
encapsulation : ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
animations : FuseAnimations,
|
||||
animations : fuseAnimations,
|
||||
exportAs : 'fuseAlert'
|
||||
})
|
||||
export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
static ngAcceptInputType_dismissible: BooleanInput;
|
||||
static ngAcceptInputType_dismissed: BooleanInput;
|
||||
static ngAcceptInputType_showIcon: BooleanInput;
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
@Input() appearance: FuseAlertAppearance = 'soft';
|
||||
@Input() dismissed: boolean = false;
|
||||
@@ -115,7 +117,7 @@ export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
||||
// Subscribe to the dismiss calls
|
||||
this._fuseAlertService.onDismiss
|
||||
.pipe(
|
||||
filter((name) => this.name === name),
|
||||
filter(name => this.name === name),
|
||||
takeUntil(this._unsubscribeAll)
|
||||
)
|
||||
.subscribe(() => {
|
||||
@@ -127,7 +129,7 @@ export class FuseAlertComponent implements OnChanges, OnInit, OnDestroy
|
||||
// Subscribe to the show calls
|
||||
this._fuseAlertService.onShow
|
||||
.pipe(
|
||||
filter((name) => this.name === name),
|
||||
filter(name => this.name === name),
|
||||
takeUntil(this._unsubscribeAll)
|
||||
)
|
||||
.subscribe(() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, HostBinding, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||
import { FuseAnimations } from '@fuse/animations';
|
||||
import { fuseAnimations } from '@fuse/animations';
|
||||
import { FuseCardFace } from '@fuse/components/card/card.types';
|
||||
|
||||
@Component({
|
||||
@@ -8,13 +8,15 @@ import { FuseCardFace } from '@fuse/components/card/card.types';
|
||||
templateUrl : './card.component.html',
|
||||
styleUrls : ['./card.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
animations : FuseAnimations,
|
||||
animations : fuseAnimations,
|
||||
exportAs : 'fuseCard'
|
||||
})
|
||||
export class FuseCardComponent implements OnChanges
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
static ngAcceptInputType_expanded: BooleanInput;
|
||||
static ngAcceptInputType_flippable: BooleanInput;
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
@Input() expanded: boolean = false;
|
||||
@Input() face: FuseCardFace = 'front';
|
||||
|
||||
@@ -23,14 +23,14 @@ import { Moment } from 'moment';
|
||||
})
|
||||
export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnDestroy
|
||||
{
|
||||
@Output() readonly rangeChanged: EventEmitter<{ start: string, end: string }> = new EventEmitter<{ start: string; end: string }>();
|
||||
@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 } = {
|
||||
activeDates: { month1: Moment | null; month2: Moment | null } = {
|
||||
month1: null,
|
||||
month2: null
|
||||
};
|
||||
@@ -41,7 +41,7 @@ export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnD
|
||||
private _onChange: (value: any) => void;
|
||||
private _onTouched: (value: any) => void;
|
||||
private _programmaticChange!: boolean;
|
||||
private _range: { start: Moment | null, end: Moment | null } = {
|
||||
private _range: { start: Moment | null; end: Moment | null } = {
|
||||
start: null,
|
||||
end : null
|
||||
};
|
||||
@@ -330,7 +330,7 @@ export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnD
|
||||
*
|
||||
* @param range
|
||||
*/
|
||||
writeValue(range: { start: string, end: string }): void
|
||||
writeValue(range: { start: string; end: string }): void
|
||||
{
|
||||
// Set this change as a programmatic one
|
||||
this._programmaticChange = true;
|
||||
@@ -481,11 +481,8 @@ export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnD
|
||||
*/
|
||||
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'));
|
||||
};
|
||||
// If we are selecting the end date, disable all the dates that comes before the start date
|
||||
return (date: Moment): boolean => !(this.setWhichDate === 'end' && date.isBefore(this._range.start, 'day'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -667,7 +664,7 @@ export class FuseDateRangeComponent implements ControlValueAccessor, OnInit, OnD
|
||||
private _parseTime(value: string): Moment
|
||||
{
|
||||
// Parse the time using the time regexp
|
||||
const timeArr = value.split(this._timeRegExp).filter((part) => part !== '');
|
||||
const timeArr = value.split(this._timeRegExp).filter(part => part !== '');
|
||||
|
||||
// Get the meridiem
|
||||
const meridiem = timeArr[2] || null;
|
||||
|
||||
@@ -14,9 +14,11 @@ import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||
})
|
||||
export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
static ngAcceptInputType_fixed: BooleanInput;
|
||||
static ngAcceptInputType_opened: BooleanInput;
|
||||
static ngAcceptInputType_transparentOverlay: BooleanInput;
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
@Input() fixed: boolean = false;
|
||||
@Input() mode: FuseDrawerMode = 'side';
|
||||
@@ -76,6 +78,40 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
||||
};
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ 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
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
@@ -347,36 +383,6 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
@@ -60,7 +60,7 @@ export class FuseHighlightService
|
||||
}
|
||||
|
||||
// Iterate through the lines
|
||||
lines.filter((line) => line.length)
|
||||
lines.filter(line => line.length)
|
||||
.forEach((line, index) => {
|
||||
|
||||
// Always get the indentation of the first line so we can
|
||||
@@ -77,6 +77,6 @@ export class FuseHighlightService
|
||||
|
||||
// Iterate through the lines one more time, remove the extra
|
||||
// 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
src/@fuse/components/masonry/index.ts
Normal file
1
src/@fuse/components/masonry/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from '@fuse/components/card/public-api';
|
||||
3
src/@fuse/components/masonry/masonry.component.html
Normal file
3
src/@fuse/components/masonry/masonry.component.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="flex">
|
||||
<ng-container *ngTemplateOutlet="columnsTemplate; context: { $implicit: distributedColumns }"></ng-container>
|
||||
</div>
|
||||
0
src/@fuse/components/masonry/masonry.component.scss
Normal file
0
src/@fuse/components/masonry/masonry.component.scss
Normal file
87
src/@fuse/components/masonry/masonry.component.ts
Normal file
87
src/@fuse/components/masonry/masonry.component.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import { AfterViewInit, Component, Input, OnChanges, SimpleChanges, TemplateRef, ViewEncapsulation } from '@angular/core';
|
||||
import { fuseAnimations } from '@fuse/animations';
|
||||
import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
|
||||
|
||||
@Component({
|
||||
selector : 'fuse-masonry',
|
||||
templateUrl : './masonry.component.html',
|
||||
styleUrls : ['./masonry.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
animations : fuseAnimations,
|
||||
exportAs : 'fuseMasonry'
|
||||
})
|
||||
export class FuseMasonryComponent implements OnChanges, AfterViewInit
|
||||
{
|
||||
@Input() columnsTemplate: TemplateRef<any>;
|
||||
@Input() columns: number;
|
||||
@Input() items: any[] = [];
|
||||
distributedColumns: any[] = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(private _fuseMediaWatcherService: FuseMediaWatcherService)
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Lifecycle hooks
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* On changes
|
||||
*
|
||||
* @param changes
|
||||
*/
|
||||
ngOnChanges(changes: SimpleChanges): void
|
||||
{
|
||||
// Columns
|
||||
if ( 'columns' in changes )
|
||||
{
|
||||
// Distribute the items
|
||||
this._distributeItems();
|
||||
}
|
||||
|
||||
// Items
|
||||
if ( 'items' in changes )
|
||||
{
|
||||
// Distribute the items
|
||||
this._distributeItems();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* After view init
|
||||
*/
|
||||
ngAfterViewInit(): void
|
||||
{
|
||||
// Distribute the items for the first time
|
||||
this._distributeItems();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Private methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Distribute items into columns
|
||||
*/
|
||||
private _distributeItems(): void
|
||||
{
|
||||
// Return an empty array if there are no items
|
||||
if ( this.items.length === 0 )
|
||||
{
|
||||
this.distributedColumns = [];
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare the distributed columns array
|
||||
this.distributedColumns = Array.from(Array(this.columns), item => ({items: []}));
|
||||
|
||||
// Distribute the items to columns
|
||||
for ( let i = 0; i < this.items.length; i++ )
|
||||
{
|
||||
this.distributedColumns[i % this.columns].items.push(this.items[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
{
|
||||
}
|
||||
2
src/@fuse/components/masonry/public-api.ts
Normal file
2
src/@fuse/components/masonry/public-api.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from '@fuse/components/masonry/masonry.component';
|
||||
export * from '@fuse/components/masonry/masonry.module';
|
||||
@@ -15,7 +15,9 @@ import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types
|
||||
})
|
||||
export class FuseHorizontalNavigationBranchItemComponent implements OnInit, OnDestroy
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
static ngAcceptInputType_child: BooleanInput;
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
@Input() child: boolean = false;
|
||||
@Input() item: FuseNavigationItem;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||
import { ReplaySubject, Subject } from 'rxjs';
|
||||
import { FuseAnimations } from '@fuse/animations';
|
||||
import { fuseAnimations } from '@fuse/animations';
|
||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||
import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
||||
@@ -9,7 +9,7 @@ import { FuseUtilsService } from '@fuse/services/utils/utils.service';
|
||||
selector : 'fuse-horizontal-navigation',
|
||||
templateUrl : './horizontal.component.html',
|
||||
styleUrls : ['./horizontal.component.scss'],
|
||||
animations : FuseAnimations,
|
||||
animations : fuseAnimations,
|
||||
encapsulation : ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
exportAs : 'fuseHorizontalNavigation'
|
||||
|
||||
@@ -67,7 +67,6 @@ export class FuseNavigationService
|
||||
* Get navigation from storage by key
|
||||
*
|
||||
* @param key
|
||||
* @returns {any}
|
||||
*/
|
||||
getNavigation(key: string): FuseNavigationItem[]
|
||||
{
|
||||
@@ -97,7 +96,6 @@ export class FuseNavigationService
|
||||
*
|
||||
* @param navigation
|
||||
* @param flatNavigation
|
||||
* @returns {FuseNavigationItem[]}
|
||||
*/
|
||||
getFlatNavigation(navigation: FuseNavigationItem[], flatNavigation: FuseNavigationItem[] = []): FuseNavigationItem[]
|
||||
{
|
||||
|
||||
@@ -15,8 +15,10 @@ import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types
|
||||
})
|
||||
export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnInit, OnDestroy
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
static ngAcceptInputType_autoCollapse: BooleanInput;
|
||||
static ngAcceptInputType_skipChildren: BooleanInput;
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
@Input() activeItemId: string;
|
||||
@Input() autoCollapse: boolean;
|
||||
@@ -101,6 +103,21 @@ export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnIn
|
||||
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
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
@@ -168,19 +185,4 @@ export class FuseVerticalNavigationAsideItemComponent implements OnChanges, OnIn
|
||||
// Mark for check
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { NavigationEnd, Router } from '@angular/router';
|
||||
import { BooleanInput } from '@angular/cdk/coercion';
|
||||
import { Subject } from 'rxjs';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { FuseAnimations } from '@fuse/animations';
|
||||
import { fuseAnimations } from '@fuse/animations';
|
||||
import { FuseVerticalNavigationComponent } from '@fuse/components/navigation/vertical/vertical.component';
|
||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||
import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types';
|
||||
@@ -12,12 +12,14 @@ import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types
|
||||
selector : 'fuse-vertical-navigation-collapsable-item',
|
||||
templateUrl : './collapsable.component.html',
|
||||
styles : [],
|
||||
animations : FuseAnimations,
|
||||
animations : fuseAnimations,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, OnDestroy
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
static ngAcceptInputType_autoCollapse: BooleanInput;
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
@Input() autoCollapse: boolean;
|
||||
@Input() item: FuseNavigationItem;
|
||||
@@ -179,84 +181,6 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
|
||||
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
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
@@ -343,4 +267,81 @@ export class FuseVerticalNavigationCollapsableItemComponent implements OnInit, O
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,9 @@ import { FuseNavigationItem } from '@fuse/components/navigation/navigation.types
|
||||
})
|
||||
export class FuseVerticalNavigationGroupItemComponent implements OnInit, OnDestroy
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
static ngAcceptInputType_autoCollapse: BooleanInput;
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
@Input() autoCollapse: boolean;
|
||||
@Input() item: FuseNavigationItem;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { NavigationEnd, Router } from '@angular/router';
|
||||
import { ScrollStrategy, ScrollStrategyOptions } from '@angular/cdk/overlay';
|
||||
import { merge, ReplaySubject, Subject, Subscription } from 'rxjs';
|
||||
import { delay, filter, takeUntil } from 'rxjs/operators';
|
||||
import { FuseAnimations } from '@fuse/animations';
|
||||
import { fuseAnimations } from '@fuse/animations';
|
||||
import { FuseNavigationItem, FuseVerticalNavigationAppearance, FuseVerticalNavigationMode, FuseVerticalNavigationPosition } from '@fuse/components/navigation/navigation.types';
|
||||
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
|
||||
import { FuseScrollbarDirective } from '@fuse/directives/scrollbar/scrollbar.directive';
|
||||
@@ -15,16 +15,18 @@ import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||
selector : 'fuse-vertical-navigation',
|
||||
templateUrl : './vertical.component.html',
|
||||
styleUrls : ['./vertical.component.scss'],
|
||||
animations : FuseAnimations,
|
||||
animations : fuseAnimations,
|
||||
encapsulation : ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
exportAs : 'fuseVerticalNavigation'
|
||||
})
|
||||
export class FuseVerticalNavigationComponent implements OnChanges, OnInit, AfterViewInit, OnDestroy
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
static ngAcceptInputType_inner: BooleanInput;
|
||||
static ngAcceptInputType_opened: BooleanInput;
|
||||
static ngAcceptInputType_transparentOverlay: BooleanInput;
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
@Input() appearance: FuseVerticalNavigationAppearance = 'default';
|
||||
@Input() autoCollapse: boolean = true;
|
||||
@@ -151,6 +153,40 @@ export class FuseVerticalNavigationComponent implements OnChanges, OnInit, After
|
||||
});
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ 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
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
@@ -672,36 +708,6 @@ 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
|
||||
*
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Subject } from 'rxjs';
|
||||
})
|
||||
export class FuseAutogrowDirective implements OnChanges, OnInit, OnDestroy
|
||||
{
|
||||
// tslint:disable-next-line:no-input-rename
|
||||
// eslint-disable-next-line @angular-eslint/no-input-rename
|
||||
@Input('fuseAutogrowVerticalPadding') padding: number = 8;
|
||||
@HostBinding('rows') private _rows: number = 1;
|
||||
|
||||
@@ -41,6 +41,39 @@ export class FuseAutogrowDirective implements OnChanges, OnInit, OnDestroy
|
||||
};
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Decorated 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();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Lifecycle hooks
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
@@ -78,37 +111,4 @@ export class FuseAutogrowDirective implements OnChanges, OnInit, OnDestroy
|
||||
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();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ import { ScrollbarGeometry, ScrollbarPosition } from '@fuse/directives/scrollbar
|
||||
})
|
||||
export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
static ngAcceptInputType_fuseScrollbar: BooleanInput;
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
@Input() fuseScrollbar: boolean = true;
|
||||
@Input() fuseScrollbarOptions: PerfectScrollbar.Options;
|
||||
@@ -246,8 +248,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
||||
/**
|
||||
* Scroll to X
|
||||
*
|
||||
* @param {number} x
|
||||
* @param {number} speed
|
||||
* @param x
|
||||
* @param speed
|
||||
*/
|
||||
scrollToX(x: number, speed?: number): void
|
||||
{
|
||||
@@ -257,8 +259,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
||||
/**
|
||||
* Scroll to Y
|
||||
*
|
||||
* @param {number} y
|
||||
* @param {number} speed
|
||||
* @param y
|
||||
* @param speed
|
||||
*/
|
||||
scrollToY(y: number, speed?: number): void
|
||||
{
|
||||
@@ -268,8 +270,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
||||
/**
|
||||
* Scroll to top
|
||||
*
|
||||
* @param {number} offset
|
||||
* @param {number} speed
|
||||
* @param offset
|
||||
* @param speed
|
||||
*/
|
||||
scrollToTop(offset: number = 0, speed?: number): void
|
||||
{
|
||||
@@ -279,8 +281,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
||||
/**
|
||||
* Scroll to bottom
|
||||
*
|
||||
* @param {number} offset
|
||||
* @param {number} speed
|
||||
* @param offset
|
||||
* @param speed
|
||||
*/
|
||||
scrollToBottom(offset: number = 0, speed?: number): void
|
||||
{
|
||||
@@ -291,8 +293,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
||||
/**
|
||||
* Scroll to left
|
||||
*
|
||||
* @param {number} offset
|
||||
* @param {number} speed
|
||||
* @param offset
|
||||
* @param speed
|
||||
*/
|
||||
scrollToLeft(offset: number = 0, speed?: number): void
|
||||
{
|
||||
@@ -302,8 +304,8 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
||||
/**
|
||||
* Scroll to right
|
||||
*
|
||||
* @param {number} offset
|
||||
* @param {number} speed
|
||||
* @param offset
|
||||
* @param speed
|
||||
*/
|
||||
scrollToRight(offset: number = 0, speed?: number): void
|
||||
{
|
||||
@@ -314,10 +316,10 @@ export class FuseScrollbarDirective implements OnChanges, OnInit, OnDestroy
|
||||
/**
|
||||
* Scroll to element
|
||||
*
|
||||
* @param {string} qs
|
||||
* @param {number} offset
|
||||
* @param {boolean} ignoreVisible If true, scrollToElement won't happen if element is already inside the current viewport
|
||||
* @param {number} speed
|
||||
* @param qs
|
||||
* @param offset
|
||||
* @param ignoreVisible If true, scrollToElement won't happen if element is already inside the current viewport
|
||||
* @param speed
|
||||
*/
|
||||
scrollToElement(qs: string, offset: number = 0, ignoreVisible: boolean = false, speed?: number): void
|
||||
{
|
||||
|
||||
@@ -9,11 +9,11 @@ import { FuseMockApiMethods } from '@fuse/lib/mock-api/mock-api.types';
|
||||
export class FuseMockApiService
|
||||
{
|
||||
private _handlers: { [key: string]: Map<string, FuseMockApiHandler> } = {
|
||||
DELETE: new Map<string, FuseMockApiHandler>(),
|
||||
GET : new Map<string, FuseMockApiHandler>(),
|
||||
PATCH : new Map<string, FuseMockApiHandler>(),
|
||||
POST : new Map<string, FuseMockApiHandler>(),
|
||||
PUT : new Map<string, FuseMockApiHandler>()
|
||||
'delete': new Map<string, FuseMockApiHandler>(),
|
||||
'get' : new Map<string, FuseMockApiHandler>(),
|
||||
'patch' : new Map<string, FuseMockApiHandler>(),
|
||||
'post' : new Map<string, FuseMockApiHandler>(),
|
||||
'put' : new Map<string, FuseMockApiHandler>()
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -34,10 +34,10 @@ export class FuseMockApiService
|
||||
* @param method
|
||||
* @param url
|
||||
*/
|
||||
findHandler(method: string, url: string): { handler: FuseMockApiHandler | undefined, urlParams: { [key: string]: string } }
|
||||
findHandler(method: string, url: string): { handler: FuseMockApiHandler | undefined; urlParams: { [key: string]: string } }
|
||||
{
|
||||
// Prepare the return object
|
||||
const matchingHandler: { handler: FuseMockApiHandler | undefined, urlParams: { [key: string]: string } } = {
|
||||
const matchingHandler: { handler: FuseMockApiHandler | undefined; urlParams: { [key: string]: string } } = {
|
||||
handler : undefined,
|
||||
urlParams: {}
|
||||
};
|
||||
@@ -46,7 +46,7 @@ export class FuseMockApiService
|
||||
const urlParts = url.split('/');
|
||||
|
||||
// Get all related request handlers
|
||||
const handlers = this._handlers[method.toUpperCase()];
|
||||
const handlers = this._handlers[method.toLowerCase()];
|
||||
|
||||
// Iterate through the handlers
|
||||
handlers.forEach((handler, handlerUrl) => {
|
||||
@@ -93,7 +93,7 @@ export class FuseMockApiService
|
||||
*/
|
||||
onDelete(url: string, delay?: number): FuseMockApiHandler
|
||||
{
|
||||
return this._registerHandler('DELETE', url, delay);
|
||||
return this._registerHandler('delete', url, delay);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ export class FuseMockApiService
|
||||
*/
|
||||
onGet(url: string, delay?: number): FuseMockApiHandler
|
||||
{
|
||||
return this._registerHandler('GET', url, delay);
|
||||
return this._registerHandler('get', url, delay);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ export class FuseMockApiService
|
||||
*/
|
||||
onPatch(url: string, delay?: number): FuseMockApiHandler
|
||||
{
|
||||
return this._registerHandler('PATCH', url, delay);
|
||||
return this._registerHandler('patch', url, delay);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,7 +126,7 @@ export class FuseMockApiService
|
||||
*/
|
||||
onPost(url: string, delay?: number): FuseMockApiHandler
|
||||
{
|
||||
return this._registerHandler('POST', url, delay);
|
||||
return this._registerHandler('post', url, delay);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ export class FuseMockApiService
|
||||
*/
|
||||
onPut(url: string, delay?: number): FuseMockApiHandler
|
||||
{
|
||||
return this._registerHandler('PUT', url, delay);
|
||||
return this._registerHandler('put', url, delay);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -6,8 +6,8 @@ export type FuseMockApiReplyCallback =
|
||||
| undefined;
|
||||
|
||||
export type FuseMockApiMethods =
|
||||
| 'GET'
|
||||
| 'POST'
|
||||
| 'PUT'
|
||||
| 'PATCH'
|
||||
| 'DELETE';
|
||||
| 'get'
|
||||
| 'post'
|
||||
| 'put'
|
||||
| 'patch'
|
||||
| 'delete';
|
||||
|
||||
@@ -16,7 +16,7 @@ export class FuseMockApiUtils
|
||||
*/
|
||||
static guid(): string
|
||||
{
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
let d = new Date().getTime();
|
||||
|
||||
@@ -32,6 +32,6 @@ export class FuseMockApiUtils
|
||||
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
||||
});
|
||||
|
||||
/* tslint:enable */
|
||||
/* eslint-enable */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,7 @@ export class FuseFindByKeyPipe implements PipeTransform
|
||||
// If the given value is an array of strings...
|
||||
if ( Array.isArray(value) )
|
||||
{
|
||||
return value.map((item) => {
|
||||
return source.find((sourceItem) => sourceItem[key] === item);
|
||||
});
|
||||
return value.map(item => source.find(sourceItem => sourceItem[key] === item));
|
||||
}
|
||||
|
||||
// If the value is a string...
|
||||
|
||||
@@ -7,7 +7,7 @@ import { FuseTailwindService } from '@fuse/services/tailwind/tailwind.service';
|
||||
@Injectable()
|
||||
export class FuseMediaWatcherService
|
||||
{
|
||||
private _onMediaChange: ReplaySubject<{ matchingAliases: string[], matchingQueries: any }> = new ReplaySubject<{ matchingAliases: string[], matchingQueries: any }>(1);
|
||||
private _onMediaChange: ReplaySubject<{ matchingAliases: string[]; matchingQueries: any }> = new ReplaySubject<{ matchingAliases: string[]; matchingQueries: any }>(1);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -18,7 +18,7 @@ export class FuseMediaWatcherService
|
||||
)
|
||||
{
|
||||
this._fuseTailwindConfigService.tailwindConfig$.pipe(
|
||||
switchMap((config) => this._breakpointObserver.observe(Object.values(config.breakpoints)).pipe(
|
||||
switchMap(config => this._breakpointObserver.observe(Object.values(config.breakpoints)).pipe(
|
||||
map((state) => {
|
||||
|
||||
// Prepare the observable values and set their defaults
|
||||
@@ -57,7 +57,7 @@ export class FuseMediaWatcherService
|
||||
/**
|
||||
* Getter for _onMediaChange
|
||||
*/
|
||||
get onMediaChange$(): Observable<{ matchingAliases: string[], matchingQueries: any }>
|
||||
get onMediaChange$(): Observable<{ matchingAliases: string[]; matchingQueries: any }>
|
||||
{
|
||||
return this._onMediaChange.asObservable();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
.mat-tab-body-content {
|
||||
|
||||
.fuse-highlight {
|
||||
margin: -24px;
|
||||
|
||||
pre {
|
||||
margin: 0;
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
@use '~@angular/material' as mat;
|
||||
@use "sass:map";
|
||||
@import '~@angular/material/theming';
|
||||
|
||||
/** Include the core Angular Material styles */
|
||||
@include mat-core();
|
||||
@include mat.core();
|
||||
|
||||
/** Configure the Angular Material typography */
|
||||
@include angular-material-typography(
|
||||
mat-typography-config(
|
||||
@include mat.all-component-typographies(
|
||||
mat.define-typography-config(
|
||||
$font-family: theme('fontFamily.sans'),
|
||||
$title: mat-typography-level(1.25rem, 2rem, 600),
|
||||
$body-2: mat-typography-level(0.875rem, 1.5rem, 600),
|
||||
$button: mat-typography-level(0.875rem, 0.875rem, 500),
|
||||
$input: mat-typography-level(0.875rem, 1.2857142857, 400) // line-height: 20px
|
||||
$title: mat.define-typography-level(1.25rem, 2rem, 600),
|
||||
$body-2: mat.define-typography-level(0.875rem, 1.5rem, 600),
|
||||
$button: mat.define-typography-level(0.875rem, 0.875rem, 500),
|
||||
$input: mat.define-typography-level(0.875rem, 1.2857142857, 400) // line-height: 20px
|
||||
)
|
||||
);
|
||||
|
||||
/** Configure the Angular Material density **/
|
||||
@include angular-material-density(-2);
|
||||
|
||||
/** Prepare the Background and Foreground maps */
|
||||
$background-light: (
|
||||
status-bar: #CBD5E1, /* blueGray.300 */
|
||||
@@ -135,7 +132,7 @@ $palettes: ();
|
||||
CSS Custom Properties to dynamically switch the colors. */
|
||||
body.light,
|
||||
body .light {
|
||||
$base-light-theme: mat-light-theme((
|
||||
$base-light-theme: mat.define-light-theme((
|
||||
color: ($palettes)
|
||||
));
|
||||
|
||||
@@ -148,22 +145,15 @@ body .light {
|
||||
foreground: $foreground-light,
|
||||
background: $background-light
|
||||
),
|
||||
typography: null,
|
||||
density: null,
|
||||
primary: map.get(map.get($base-light-theme, color), primary),
|
||||
accent: map.get(map.get($base-light-theme, color), accent),
|
||||
warn: map.get(map.get($base-light-theme, color), warn),
|
||||
is-dark: map.get(map.get($base-light-theme, color), is-dark),
|
||||
foreground: $foreground-light,
|
||||
background: $background-light
|
||||
density: -2
|
||||
);
|
||||
|
||||
@include angular-material-theme($light-theme);
|
||||
@include mat.all-component-themes($light-theme);
|
||||
}
|
||||
|
||||
body.dark,
|
||||
body .dark {
|
||||
$base-dark-theme: mat-dark-theme((
|
||||
$base-dark-theme: mat.define-dark-theme((
|
||||
color: ($palettes)
|
||||
));
|
||||
|
||||
@@ -176,15 +166,8 @@ body .dark {
|
||||
foreground: $foreground-dark,
|
||||
background: $background-dark
|
||||
),
|
||||
typography: null,
|
||||
density: null,
|
||||
primary: map.get(map.get($base-dark-theme, color), primary),
|
||||
accent: map.get(map.get($base-dark-theme, color), accent),
|
||||
warn: map.get(map.get($base-dark-theme, color), warn),
|
||||
is-dark: map.get(map.get($base-dark-theme, color), is-dark),
|
||||
foreground: $foreground-dark,
|
||||
background: $background-dark
|
||||
density: -2
|
||||
);
|
||||
|
||||
@include angular-material-theme($dark-theme);
|
||||
@include mat.all-component-colors($dark-theme);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Version } from '@fuse/version/version';
|
||||
|
||||
const __FUSE_VERSION__ = '12.2.0';
|
||||
export const FUSE_VERSION = new Version(__FUSE_VERSION__).full;
|
||||
export const FUSE_VERSION = new Version('13.0.0').full;
|
||||
|
||||
1
src/_redirects
Normal file
1
src/_redirects
Normal file
@@ -0,0 +1 @@
|
||||
/* /index.html 200
|
||||
@@ -15,8 +15,7 @@ import { appRoutes } from 'app/app.routing';
|
||||
|
||||
const routerConfig: ExtraOptions = {
|
||||
scrollPositionRestoration: 'enabled',
|
||||
preloadingStrategy : PreloadAllModules,
|
||||
relativeLinkResolution : 'legacy'
|
||||
preloadingStrategy : PreloadAllModules
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
|
||||
@@ -8,15 +8,15 @@ import { InitialDataResolver } from 'app/app.resolvers';
|
||||
// tslint:disable:max-line-length
|
||||
export const appRoutes: Route[] = [
|
||||
|
||||
// Redirect empty path to '/dashboards/project'
|
||||
{path: '', pathMatch : 'full', redirectTo: 'dashboards/project'},
|
||||
// Redirect empty path to '/example'
|
||||
{path: '', pathMatch : 'full', redirectTo: 'example'},
|
||||
|
||||
// Redirect signed in user to the '/dashboards/project'
|
||||
// Redirect signed in user to the '/example'
|
||||
//
|
||||
// After the user signs in, the sign in page will redirect the user to the 'signed-in-redirect'
|
||||
// path. Below is another redirection for that path to redirect the user to the desired
|
||||
// location. This is a small convenience to keep all main routes together here on this file.
|
||||
{path: 'signed-in-redirect', pathMatch : 'full', redirectTo: 'dashboards/project'},
|
||||
{path: 'signed-in-redirect', pathMatch : 'full', redirectTo: 'example'},
|
||||
|
||||
// Auth routes for guests
|
||||
{
|
||||
@@ -73,121 +73,7 @@ export const appRoutes: Route[] = [
|
||||
initialData: InitialDataResolver,
|
||||
},
|
||||
children : [
|
||||
|
||||
// Dashboards
|
||||
{path: 'dashboards', children: [
|
||||
{path: 'project', loadChildren: () => import('app/modules/admin/dashboards/project/project.module').then(m => m.ProjectModule)},
|
||||
{path: 'analytics', loadChildren: () => import('app/modules/admin/dashboards/analytics/analytics.module').then(m => m.AnalyticsModule)},
|
||||
]},
|
||||
|
||||
// Apps
|
||||
{path: 'apps', children: [
|
||||
{path: 'academy', loadChildren: () => import('app/modules/admin/apps/academy/academy.module').then(m => m.AcademyModule)},
|
||||
{path: 'calendar', loadChildren: () => import('app/modules/admin/apps/calendar/calendar.module').then(m => m.CalendarModule)},
|
||||
{path: 'chat', loadChildren: () => import('app/modules/admin/apps/chat/chat.module').then(m => m.ChatModule)},
|
||||
{path: 'contacts', loadChildren: () => import('app/modules/admin/apps/contacts/contacts.module').then(m => m.ContactsModule)},
|
||||
{path: 'ecommerce', loadChildren: () => import('app/modules/admin/apps/ecommerce/ecommerce.module').then(m => m.ECommerceModule)},
|
||||
{path: 'file-manager', loadChildren: () => import('app/modules/admin/apps/file-manager/file-manager.module').then(m => m.FileManagerModule)},
|
||||
{path: 'help-center', loadChildren: () => import('app/modules/admin/apps/help-center/help-center.module').then(m => m.HelpCenterModule)},
|
||||
{path: 'mailbox', loadChildren: () => import('app/modules/admin/apps/mailbox/mailbox.module').then(m => m.MailboxModule)},
|
||||
{path: 'tasks', loadChildren: () => import('app/modules/admin/apps/tasks/tasks.module').then(m => m.TasksModule)},
|
||||
]},
|
||||
|
||||
// Pages
|
||||
{path: 'pages', children: [
|
||||
|
||||
// Authentication
|
||||
{path: 'authentication', loadChildren: () => import('app/modules/admin/pages/authentication/authentication.module').then(m => m.AuthenticationModule)},
|
||||
|
||||
// Coming soon
|
||||
{path: 'coming-soon', loadChildren: () => import('app/modules/admin/pages/coming-soon/coming-soon.module').then(m => m.ComingSoonModule)},
|
||||
|
||||
// Error
|
||||
{path: 'error', children: [
|
||||
{path: '404', loadChildren: () => import('app/modules/admin/pages/error/error-404/error-404.module').then(m => m.Error404Module)},
|
||||
{path: '500', loadChildren: () => import('app/modules/admin/pages/error/error-500/error-500.module').then(m => m.Error500Module)}
|
||||
]},
|
||||
|
||||
// Invoice
|
||||
{path: 'invoice', children: [
|
||||
{path: 'printable', children: [
|
||||
{path: 'compact', loadChildren: () => import('app/modules/admin/pages/invoice/printable/compact/compact.module').then(m => m.CompactModule)},
|
||||
{path: 'modern', loadChildren: () => import('app/modules/admin/pages/invoice/printable/modern/modern.module').then(m => m.ModernModule)}
|
||||
]}
|
||||
]},
|
||||
|
||||
// Maintenance
|
||||
{path: 'maintenance', loadChildren: () => import('app/modules/admin/pages/maintenance/maintenance.module').then(m => m.MaintenanceModule)},
|
||||
|
||||
// Pricing
|
||||
{path: 'pricing', children: [
|
||||
{path: 'modern', loadChildren: () => import('app/modules/admin/pages/pricing/modern/modern.module').then(m => m.PricingModernModule)},
|
||||
{path: 'simple', loadChildren: () => import('app/modules/admin/pages/pricing/simple/simple.module').then(m => m.PricingSimpleModule)},
|
||||
{path: 'single', loadChildren: () => import('app/modules/admin/pages/pricing/single/single.module').then(m => m.PricingSingleModule)},
|
||||
{path: 'table', loadChildren: () => import('app/modules/admin/pages/pricing/table/table.module').then(m => m.PricingTableModule)}
|
||||
]},
|
||||
|
||||
// Profile
|
||||
{path: 'profile', loadChildren: () => import('app/modules/admin/pages/profile/profile.module').then(m => m.ProfileModule)},
|
||||
]},
|
||||
|
||||
// User interface
|
||||
{path: 'ui', children: [
|
||||
|
||||
// Angular Material
|
||||
{path: 'angular-material', loadChildren: () => import('app/modules/admin/ui/angular-material/angular-material.module').then(m => m.AngularMaterialModule)},
|
||||
|
||||
// TailwindCSS
|
||||
{path: 'tailwindcss', loadChildren: () => import('app/modules/admin/ui/tailwindcss/tailwindcss.module').then(m => m.TailwindCSSModule)},
|
||||
|
||||
// Animations
|
||||
{path: 'animations', loadChildren: () => import('app/modules/admin/ui/animations/animations.module').then(m => m.AnimationsModule)},
|
||||
|
||||
// Cards
|
||||
{path: 'cards', loadChildren: () => import('app/modules/admin/ui/cards/cards.module').then(m => m.CardsModule)},
|
||||
|
||||
// Colors
|
||||
{path: 'colors', loadChildren: () => import('app/modules/admin/ui/colors/colors.module').then(m => m.ColorsModule)},
|
||||
|
||||
// Datatable
|
||||
{path: 'datatable', loadChildren: () => import('app/modules/admin/ui/datatable/datatable.module').then(m => m.DatatableModule)},
|
||||
|
||||
// Forms
|
||||
{path: 'forms', children: [
|
||||
{path: 'fields', loadChildren: () => import('app/modules/admin/ui/forms/fields/fields.module').then(m => m.FormsFieldsModule)},
|
||||
{path: 'layouts', loadChildren: () => import('app/modules/admin/ui/forms/layouts/layouts.module').then(m => m.FormsLayoutsModule)},
|
||||
{path: 'wizards', loadChildren: () => import('app/modules/admin/ui/forms/wizards/wizards.module').then(m => m.FormsWizardsModule)}
|
||||
]},
|
||||
|
||||
// Icons
|
||||
{path: 'icons', loadChildren: () => import('app/modules/admin/ui/icons/icons.module').then(m => m.IconsModule)},
|
||||
|
||||
// Page layouts
|
||||
{path: 'page-layouts', loadChildren: () => import('app/modules/admin/ui/page-layouts/page-layouts.module').then(m => m.PageLayoutsModule)},
|
||||
|
||||
// Typography
|
||||
{path: 'typography', loadChildren: () => import('app/modules/admin/ui/typography/typography.module').then(m => m.TypographyModule)}
|
||||
]},
|
||||
|
||||
// Documentation
|
||||
{path: 'docs', children: [
|
||||
|
||||
// Changelog
|
||||
{path: 'changelog', loadChildren: () => import('app/modules/admin/docs/changelog/changelog.module').then(m => m.ChangelogModule)},
|
||||
|
||||
// Guides
|
||||
{path: 'guides', loadChildren: () => import('app/modules/admin/docs/guides/guides.module').then(m => m.GuidesModule)},
|
||||
|
||||
// Core features
|
||||
{path: 'core-features', loadChildren: () => import('app/modules/admin/docs/core-features/core-features.module').then(m => m.CoreFeaturesModule)},
|
||||
|
||||
// Other components
|
||||
{path: 'other-components', loadChildren: () => import('app/modules/admin/docs/other-components/other-components.module').then(m => m.OtherComponentsModule)},
|
||||
]},
|
||||
|
||||
// 404 & Catch all
|
||||
{path: '404-not-found', pathMatch: 'full', loadChildren: () => import('app/modules/admin/pages/error/error-404/error-404.module').then(m => m.Error404Module)},
|
||||
{path: '**', redirectTo: '404-not-found'}
|
||||
{path: 'example', loadChildren: () => import('app/modules/admin/example/example.module').then(m => m.ExampleModule)},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@@ -8,10 +8,10 @@ export interface InitialData
|
||||
{
|
||||
messages: Message[];
|
||||
navigation: {
|
||||
compact: FuseNavigationItem[],
|
||||
default: FuseNavigationItem[],
|
||||
futuristic: FuseNavigationItem[],
|
||||
horizontal: FuseNavigationItem[]
|
||||
compact: FuseNavigationItem[];
|
||||
default: FuseNavigationItem[];
|
||||
futuristic: FuseNavigationItem[];
|
||||
horizontal: FuseNavigationItem[];
|
||||
};
|
||||
notifications: Notification[];
|
||||
shortcuts: Shortcut[];
|
||||
|
||||
@@ -29,12 +29,12 @@ export class AuthService
|
||||
*/
|
||||
set accessToken(token: string)
|
||||
{
|
||||
localStorage.setItem('access_token', token);
|
||||
localStorage.setItem('accessToken', token);
|
||||
}
|
||||
|
||||
get accessToken(): string
|
||||
{
|
||||
return localStorage.getItem('access_token') ?? '';
|
||||
return localStorage.getItem('accessToken') ?? '';
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
@@ -66,7 +66,7 @@ export class AuthService
|
||||
*
|
||||
* @param credentials
|
||||
*/
|
||||
signIn(credentials: { email: string, password: string }): Observable<any>
|
||||
signIn(credentials: { email: string; password: string }): Observable<any>
|
||||
{
|
||||
// Throw error, if the user is already logged in
|
||||
if ( this._authenticated )
|
||||
@@ -78,7 +78,7 @@ export class AuthService
|
||||
switchMap((response: any) => {
|
||||
|
||||
// Store the access token in the local storage
|
||||
this.accessToken = response.access_token;
|
||||
this.accessToken = response.accessToken;
|
||||
|
||||
// Set the authenticated flag to true
|
||||
this._authenticated = true;
|
||||
@@ -99,17 +99,17 @@ export class AuthService
|
||||
{
|
||||
// Renew token
|
||||
return this._httpClient.post('api/auth/refresh-access-token', {
|
||||
access_token: this.accessToken
|
||||
accessToken: this.accessToken
|
||||
}).pipe(
|
||||
catchError(() => {
|
||||
catchError(() =>
|
||||
|
||||
// Return false
|
||||
return of(false);
|
||||
}),
|
||||
of(false)
|
||||
),
|
||||
switchMap((response: any) => {
|
||||
|
||||
// Store the access token in the local storage
|
||||
this.accessToken = response.access_token;
|
||||
this.accessToken = response.accessToken;
|
||||
|
||||
// Set the authenticated flag to true
|
||||
this._authenticated = true;
|
||||
@@ -129,7 +129,7 @@ export class AuthService
|
||||
signOut(): Observable<any>
|
||||
{
|
||||
// Remove the access token from the local storage
|
||||
localStorage.removeItem('access_token');
|
||||
localStorage.removeItem('accessToken');
|
||||
|
||||
// Set the authenticated flag to false
|
||||
this._authenticated = false;
|
||||
@@ -143,7 +143,7 @@ export class AuthService
|
||||
*
|
||||
* @param user
|
||||
*/
|
||||
signUp(user: { name: string, email: string, password: string, company: string }): Observable<any>
|
||||
signUp(user: { name: string; email: string; password: string; company: string }): Observable<any>
|
||||
{
|
||||
return this._httpClient.post('api/auth/sign-up', user);
|
||||
}
|
||||
@@ -153,7 +153,7 @@ export class AuthService
|
||||
*
|
||||
* @param credentials
|
||||
*/
|
||||
unlockSession(credentials: { email: string, password: string }): Observable<any>
|
||||
unlockSession(credentials: { email: string; password: string }): Observable<any>
|
||||
{
|
||||
return this._httpClient.post('api/auth/unlock-session', credentials);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,38 @@ export class AuthUtils
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Is token expired?
|
||||
*
|
||||
* @param token
|
||||
* @param offsetSeconds
|
||||
*/
|
||||
static isTokenExpired(token: string, offsetSeconds?: number): boolean
|
||||
{
|
||||
// Return if there is no token
|
||||
if ( !token || token === '' )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get the expiration date
|
||||
const date = this._getTokenExpirationDate(token);
|
||||
|
||||
offsetSeconds = offsetSeconds || 0;
|
||||
|
||||
if ( date === null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the token is expired
|
||||
return !(date.valueOf() > new Date().valueOf() + offsetSeconds * 1000);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Private methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
@@ -39,7 +71,7 @@ export class AuthUtils
|
||||
);
|
||||
}
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
for (
|
||||
// initialize result and counters
|
||||
let bc = 0, bs: any, buffer: any, idx = 0;
|
||||
@@ -60,7 +92,7 @@ export class AuthUtils
|
||||
// try to find character in table (0-63, not found => -1)
|
||||
buffer = chars.indexOf(buffer);
|
||||
}
|
||||
/* tslint:enable */
|
||||
/* eslint-enable */
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -75,9 +107,7 @@ export class AuthUtils
|
||||
{
|
||||
return decodeURIComponent(
|
||||
Array.prototype.map
|
||||
.call(this._b64decode(str), (c: any) => {
|
||||
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
||||
})
|
||||
.call(this._b64decode(str), (c: any) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))
|
||||
.join('')
|
||||
);
|
||||
}
|
||||
@@ -171,36 +201,4 @@ export class AuthUtils
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Is token expired?
|
||||
*
|
||||
* @param token
|
||||
* @param offsetSeconds
|
||||
*/
|
||||
static isTokenExpired(token: string, offsetSeconds?: number): boolean
|
||||
{
|
||||
// Return if there is no token
|
||||
if ( !token || token === '' )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get the expiration date
|
||||
const date = this._getTokenExpirationDate(token);
|
||||
|
||||
offsetSeconds = offsetSeconds || 0;
|
||||
|
||||
if ( date === null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the token is expired
|
||||
return !(date.valueOf() > new Date().valueOf() + offsetSeconds * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,39 +19,6 @@ export class AuthGuard implements CanActivate, CanActivateChild, CanLoad
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Private methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Check the authenticated status
|
||||
*
|
||||
* @param redirectURL
|
||||
* @private
|
||||
*/
|
||||
private _check(redirectURL: string): Observable<boolean>
|
||||
{
|
||||
// Check the authentication status
|
||||
return this._authService.check()
|
||||
.pipe(
|
||||
switchMap((authenticated) => {
|
||||
|
||||
// If the user is not authenticated...
|
||||
if ( !authenticated )
|
||||
{
|
||||
// Redirect to the sign-in page
|
||||
this._router.navigate(['sign-in'], {queryParams: {redirectURL}});
|
||||
|
||||
// Prevent the access
|
||||
return of(false);
|
||||
}
|
||||
|
||||
// Allow the access
|
||||
return of(true);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
@@ -90,4 +57,37 @@ export class AuthGuard implements CanActivate, CanActivateChild, CanLoad
|
||||
{
|
||||
return this._check('/');
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Private methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Check the authenticated status
|
||||
*
|
||||
* @param redirectURL
|
||||
* @private
|
||||
*/
|
||||
private _check(redirectURL: string): Observable<boolean>
|
||||
{
|
||||
// Check the authentication status
|
||||
return this._authService.check()
|
||||
.pipe(
|
||||
switchMap((authenticated) => {
|
||||
|
||||
// If the user is not authenticated...
|
||||
if ( !authenticated )
|
||||
{
|
||||
// Redirect to the sign-in page
|
||||
this._router.navigate(['sign-in'], {queryParams: {redirectURL}});
|
||||
|
||||
// Prevent the access
|
||||
return of(false);
|
||||
}
|
||||
|
||||
// Allow the access
|
||||
return of(true);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,38 +19,6 @@ export class NoAuthGuard implements CanActivate, CanActivateChild, CanLoad
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Private methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Check the authenticated status
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
private _check(): Observable<boolean>
|
||||
{
|
||||
// Check the authentication status
|
||||
return this._authService.check()
|
||||
.pipe(
|
||||
switchMap((authenticated) => {
|
||||
|
||||
// If the user is authenticated...
|
||||
if ( authenticated )
|
||||
{
|
||||
// Redirect to the root
|
||||
this._router.navigate(['']);
|
||||
|
||||
// Prevent the access
|
||||
return of(false);
|
||||
}
|
||||
|
||||
// Allow the access
|
||||
return of(true);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
@@ -87,4 +55,36 @@ export class NoAuthGuard implements CanActivate, CanActivateChild, CanLoad
|
||||
{
|
||||
return this._check();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Private methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Check the authenticated status
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
private _check(): Observable<boolean>
|
||||
{
|
||||
// Check the authentication status
|
||||
return this._authService.check()
|
||||
.pipe(
|
||||
switchMap((authenticated) => {
|
||||
|
||||
// If the user is authenticated...
|
||||
if ( authenticated )
|
||||
{
|
||||
// Redirect to the root
|
||||
this._router.navigate(['']);
|
||||
|
||||
// Prevent the access
|
||||
return of(false);
|
||||
}
|
||||
|
||||
// Allow the access
|
||||
return of(true);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,15 @@
|
||||
*ngIf="results && !results.length">
|
||||
No results found!
|
||||
</mat-option>
|
||||
<mat-option
|
||||
class="group relative h-14 px-6 py-0 sm:px-8 text-md"
|
||||
*ngFor="let result of results"
|
||||
[routerLink]="result.link">
|
||||
<ng-container
|
||||
[ngTemplateOutlet]="searchResult"
|
||||
[ngTemplateOutletContext]="{$implicit: result}"></ng-container>
|
||||
</mat-option>
|
||||
<ng-container *ngFor="let result of results">
|
||||
<mat-option
|
||||
class="group relative h-14 px-6 py-0 sm:px-8 text-md"
|
||||
[routerLink]="result.link">
|
||||
<ng-container
|
||||
[ngTemplateOutlet]="searchResult"
|
||||
[ngTemplateOutletContext]="{$implicit: result}"></ng-container>
|
||||
</mat-option>
|
||||
</ng-container>
|
||||
</mat-autocomplete>
|
||||
<button
|
||||
class="absolute top-1/2 right-5 sm:right-7 flex-shrink-0 w-10 h-10 -mt-5"
|
||||
@@ -72,14 +73,15 @@
|
||||
*ngIf="results && !results.length">
|
||||
No results found!
|
||||
</mat-option>
|
||||
<mat-option
|
||||
class="group relative h-14 px-5 py-0 text-md"
|
||||
*ngFor="let result of results"
|
||||
[routerLink]="result.link">
|
||||
<ng-container
|
||||
[ngTemplateOutlet]="searchResult"
|
||||
[ngTemplateOutletContext]="{$implicit: result}"></ng-container>
|
||||
</mat-option>
|
||||
<ng-container *ngFor="let result of results">
|
||||
<mat-option
|
||||
class="group relative h-14 px-5 py-0 text-md"
|
||||
[routerLink]="result.link">
|
||||
<ng-container
|
||||
[ngTemplateOutlet]="searchResult"
|
||||
[ngTemplateOutletContext]="{$implicit: result}"></ng-container>
|
||||
</mat-option>
|
||||
</ng-container>
|
||||
</mat-autocomplete>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
@@ -3,14 +3,14 @@ import { FormControl } from '@angular/forms';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Subject } from 'rxjs';
|
||||
import { debounceTime, filter, map, takeUntil } from 'rxjs/operators';
|
||||
import { FuseAnimations } from '@fuse/animations/public-api';
|
||||
import { fuseAnimations } from '@fuse/animations/public-api';
|
||||
|
||||
@Component({
|
||||
selector : 'search',
|
||||
templateUrl : './search.component.html',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
exportAs : 'fuseSearch',
|
||||
animations : FuseAnimations
|
||||
animations : fuseAnimations
|
||||
})
|
||||
export class SearchComponent implements OnChanges, OnInit, OnDestroy
|
||||
{
|
||||
@@ -115,12 +115,9 @@ export class SearchComponent implements OnChanges, OnInit, OnDestroy
|
||||
// Continue
|
||||
return value;
|
||||
}),
|
||||
filter((value) => {
|
||||
|
||||
// Filter out undefined/null/false statements and also
|
||||
// filter out the values that are smaller than minLength
|
||||
return value && value.length >= this.minLength;
|
||||
})
|
||||
// Filter out undefined/null/false statements and also
|
||||
// filter out the values that are smaller than minLength
|
||||
filter(value => value && value.length >= this.minLength)
|
||||
)
|
||||
.subscribe((value) => {
|
||||
this._httpClient.post('api/common/search', {query: value})
|
||||
|
||||
@@ -28,9 +28,7 @@ import { SearchComponent } from 'app/layout/common/search/search.component';
|
||||
providers : [
|
||||
{
|
||||
provide : MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
|
||||
useFactory: (overlay: Overlay) => {
|
||||
return () => overlay.scrollStrategies.block();
|
||||
},
|
||||
useFactory: (overlay: Overlay) => () => overlay.scrollStrategies.block(),
|
||||
deps : [Overlay]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -15,7 +15,9 @@ import { UserService } from 'app/core/user/user.service';
|
||||
})
|
||||
export class UserMenuComponent implements OnInit, OnDestroy
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
static ngAcceptInputType_showAvatar: BooleanInput;
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
@Input() showAvatar: boolean = true;
|
||||
user: User;
|
||||
|
||||
@@ -74,7 +74,7 @@ export class AcademyMockApi
|
||||
const steps = cloneDeep(this._demoCourseSteps);
|
||||
|
||||
// Find the course and attach steps to it
|
||||
const course = courses.find((item) => item.id === id);
|
||||
const course = courses.find(item => item.id === id);
|
||||
if ( course )
|
||||
{
|
||||
course.steps = steps;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const categories = [
|
||||
{
|
||||
id : '9a67dff7-3c38-4052-a335-0cef93438ff6',
|
||||
|
||||
@@ -110,11 +110,11 @@ export class CalendarMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the calendar and delete it
|
||||
const index = this._calendars.findIndex((calendar) => calendar.id === id);
|
||||
const index = this._calendars.findIndex(calendar => calendar.id === id);
|
||||
this._calendars.splice(index, 1);
|
||||
|
||||
// Find the events that belong to the calendar and remove them as well
|
||||
this._events = this._events.filter((event) => event.calendarId !== id);
|
||||
this._events = this._events.filter(event => event.calendarId !== id);
|
||||
|
||||
// Return the response
|
||||
return [200, true];
|
||||
@@ -287,7 +287,7 @@ export class CalendarMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the event and delete it
|
||||
const index = this._events.findIndex((item) => item.id === id);
|
||||
const index = this._events.findIndex(item => item.id === id);
|
||||
this._events.splice(index, 1);
|
||||
|
||||
// Return the response
|
||||
@@ -307,7 +307,7 @@ export class CalendarMockApi
|
||||
const mode = request.body.mode;
|
||||
|
||||
// Find the original recurring event from db
|
||||
const recurringEvent = this._events.find((item) => item.id === event.recurringEventId);
|
||||
const recurringEvent = this._events.find(item => item.id === event.recurringEventId);
|
||||
|
||||
// Single
|
||||
if ( mode === 'single' )
|
||||
@@ -406,7 +406,7 @@ export class CalendarMockApi
|
||||
if ( mode === 'all' )
|
||||
{
|
||||
// Find the event index
|
||||
const eventIndex = this._events.findIndex((item) => item.id === event.recurringEventId);
|
||||
const eventIndex = this._events.findIndex(item => item.id === event.recurringEventId);
|
||||
|
||||
// Update the recurring event
|
||||
this._events[eventIndex] = assign({}, this._events[eventIndex], omit(event, ['id', 'recurringEventId', 'range']));
|
||||
@@ -428,7 +428,7 @@ export class CalendarMockApi
|
||||
const mode = request.params.get('mode');
|
||||
|
||||
// Find the recurring event
|
||||
const recurringEvent = this._events.find((item) => item.id === event.recurringEventId);
|
||||
const recurringEvent = this._events.find(item => item.id === event.recurringEventId);
|
||||
|
||||
// Single
|
||||
if ( mode === 'single' )
|
||||
@@ -495,7 +495,7 @@ export class CalendarMockApi
|
||||
if ( mode === 'all' )
|
||||
{
|
||||
// Find the event and delete it
|
||||
const index = this._events.findIndex((item) => item.id === event.recurringEventId);
|
||||
const index = this._events.findIndex(item => item.id === event.recurringEventId);
|
||||
this._events.splice(index, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import * as moment from 'moment';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export const calendars = [
|
||||
{
|
||||
id : '1a470c8e-40ed-4c2d-b590-a4f1f6ead6cc',
|
||||
|
||||
@@ -22,12 +22,12 @@ export class ChatMockApi
|
||||
this.registerHandlers();
|
||||
|
||||
// Modify the chats array to attach certain data to it
|
||||
this._chats = this._chats.map((chat) => ({
|
||||
this._chats = this._chats.map(chat => ({
|
||||
...chat,
|
||||
// Get the actual contact object from the id and attach it to the chat
|
||||
contact: this._contacts.find((contact) => contact.id === chat.contactId),
|
||||
contact: this._contacts.find(contact => contact.id === chat.contactId),
|
||||
// Since we use same set of messages on all chats, we assign them here.
|
||||
messages: this._messages.map((message) => ({
|
||||
messages: this._messages.map(message => ({
|
||||
...message,
|
||||
chatId : chat.id,
|
||||
contactId: message.contactId === 'me' ? this._profile.id : chat.contactId,
|
||||
@@ -73,7 +73,7 @@ export class ChatMockApi
|
||||
const chats = cloneDeep(this._chats);
|
||||
|
||||
// Find the chat we need
|
||||
const chat = chats.find((item) => item.id === id);
|
||||
const chat = chats.find(item => item.id === id);
|
||||
|
||||
// Return the response
|
||||
return [200, chat];
|
||||
@@ -124,7 +124,7 @@ export class ChatMockApi
|
||||
contacts.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
// Omit details and attachments from contacts
|
||||
contacts = contacts.map((contact) => omit(contact, ['details', 'attachments']));
|
||||
contacts = contacts.map(contact => omit(contact, ['details', 'attachments']));
|
||||
|
||||
// Return the response
|
||||
return [200, contacts];
|
||||
@@ -144,7 +144,7 @@ export class ChatMockApi
|
||||
const contacts = cloneDeep(this._contacts);
|
||||
|
||||
// Find the contact
|
||||
const contact = contacts.find((item) => item.id === id);
|
||||
const contact = contacts.find(item => item.id === id);
|
||||
|
||||
// Return the response
|
||||
return [200, contact];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -66,7 +66,7 @@ export class ContactsMockApi
|
||||
if ( query )
|
||||
{
|
||||
// Filter the contacts
|
||||
contacts = contacts.filter((contact) => contact.name && contact.name.toLowerCase().includes(query.toLowerCase()));
|
||||
contacts = contacts.filter(contact => contact.name && contact.name.toLowerCase().includes(query.toLowerCase()));
|
||||
}
|
||||
|
||||
// Sort the contacts by the name field by default
|
||||
@@ -90,9 +90,7 @@ export class ContactsMockApi
|
||||
const contacts = cloneDeep(this._contacts);
|
||||
|
||||
// Find the contact
|
||||
const contact = contacts.find((item) => {
|
||||
return item.id === id;
|
||||
});
|
||||
const contact = contacts.find(item => item.id === id);
|
||||
|
||||
// Return the response
|
||||
return [200, contact];
|
||||
@@ -288,10 +286,10 @@ export class ContactsMockApi
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
const readAsDataURL = (file: File): Promise<any> => {
|
||||
const readAsDataURL = (file: File): Promise<any> =>
|
||||
|
||||
// Return a new promise
|
||||
return new Promise((resolve, reject) => {
|
||||
new Promise((resolve, reject) => {
|
||||
|
||||
// Create a new reader
|
||||
const reader = new FileReader();
|
||||
@@ -308,8 +306,8 @@ export class ContactsMockApi
|
||||
|
||||
// Read the file as the
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
};
|
||||
})
|
||||
;
|
||||
|
||||
this._fuseMockApiService
|
||||
.onPost('api/apps/contacts/avatar')
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -81,9 +81,7 @@ export class ECommerceInventoryMockApi
|
||||
if ( search )
|
||||
{
|
||||
// Filter the products
|
||||
products = products.filter((contact) => {
|
||||
return contact.name && contact.name.toLowerCase().includes(search.toLowerCase());
|
||||
});
|
||||
products = products.filter(contact => contact.name && contact.name.toLowerCase().includes(search.toLowerCase()));
|
||||
}
|
||||
|
||||
// Paginate - Start
|
||||
@@ -148,9 +146,7 @@ export class ECommerceInventoryMockApi
|
||||
const products = cloneDeep(this._products);
|
||||
|
||||
// Find the product
|
||||
const product = products.find((item) => {
|
||||
return item.id === id;
|
||||
});
|
||||
const product = products.find(item => item.id === id);
|
||||
|
||||
// Return the response
|
||||
return [200, product];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const categories = [
|
||||
{
|
||||
id : 'b899ec30-b85a-40ab-bb1f-18a596d5c6de',
|
||||
|
||||
@@ -39,8 +39,8 @@ export class FileManagerMockApi
|
||||
const items = cloneDeep(this._items);
|
||||
|
||||
// Separate the items by folders and files
|
||||
const folders = items.filter((item) => item.type === 'folder');
|
||||
const files = items.filter((item) => item.type !== 'folder');
|
||||
const folders = items.filter(item => item.type === 'folder');
|
||||
const files = items.filter(item => item.type !== 'folder');
|
||||
|
||||
// Sort the folders and files alphabetically by filename
|
||||
folders.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const items = [
|
||||
{
|
||||
id : 'cd6897cb-acfd-4016-8b53-3f66a5b5fc68',
|
||||
@@ -175,5 +175,5 @@ export const items = [
|
||||
type : 'XLS',
|
||||
contents : null,
|
||||
description: null
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const faqCategories = [
|
||||
{
|
||||
id : '28924eab-97cc-465a-ba21-f232bb95843f',
|
||||
|
||||
@@ -69,7 +69,7 @@ export class MailboxMockApi
|
||||
this._folders.forEach((folder) => {
|
||||
|
||||
// Get the mails of this folder
|
||||
const mails = this._mails.filter((mail) => mail.folder === folder.id);
|
||||
const mails = this._mails.filter(mail => mail.folder === folder.id);
|
||||
|
||||
// If we are counting the 'sent' or the 'trash' folder...
|
||||
if ( folder.slug === 'sent' || folder.slug === 'trash' )
|
||||
@@ -148,9 +148,7 @@ export class MailboxMockApi
|
||||
|
||||
do
|
||||
{
|
||||
sameSlug = this._labels.filter((item) => {
|
||||
return item.slug === label.slug;
|
||||
});
|
||||
sameSlug = this._labels.filter(item => item.slug === label.slug);
|
||||
|
||||
if ( sameSlug.length > 0 )
|
||||
{
|
||||
@@ -215,13 +213,11 @@ export class MailboxMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the label and delete it
|
||||
const index = this._labels.findIndex((item) => item.id === id);
|
||||
const index = this._labels.findIndex(item => item.id === id);
|
||||
this._labels.splice(index, 1);
|
||||
|
||||
// Get all the mails that have the label
|
||||
const mailsWithLabel = this._mails.filter((mail) => {
|
||||
return mail.labels.indexOf(id) > -1;
|
||||
});
|
||||
const mailsWithLabel = this._mails.filter(mail => mail.labels.indexOf(id) > -1);
|
||||
|
||||
// Iterate through them and remove the label
|
||||
mailsWithLabel.forEach((mail) => {
|
||||
@@ -267,9 +263,7 @@ export class MailboxMockApi
|
||||
});
|
||||
|
||||
// Sort by date - descending
|
||||
mails.sort((a, b) => {
|
||||
return new Date(b.date).getTime() - new Date(a.date).getTime();
|
||||
});
|
||||
mails.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
|
||||
|
||||
// Figure out the cc and bcc counts
|
||||
mails.forEach((mail) => {
|
||||
@@ -343,7 +337,7 @@ export class MailboxMockApi
|
||||
const mails = cloneDeep(this._mails);
|
||||
|
||||
// Find the mail
|
||||
const mail = mails.find((item) => item.id === id);
|
||||
const mail = mails.find(item => item.id === id);
|
||||
|
||||
return [
|
||||
200,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import * as moment from 'moment';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export const folders = [
|
||||
{
|
||||
id : '7c004a19-4506-48ef-93ab-f16381302e3b',
|
||||
|
||||
261
src/app/mock-api/apps/notes/api.ts
Normal file
261
src/app/mock-api/apps/notes/api.ts
Normal file
@@ -0,0 +1,261 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { FuseMockApiService } from '@fuse/lib/mock-api/mock-api.service';
|
||||
import { labels as labelsData, notes as notesData } from 'app/mock-api/apps/notes/data';
|
||||
import { FuseMockApiUtils } from '@fuse/lib/mock-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class NotesMockApi
|
||||
{
|
||||
private _labels: any[] = labelsData;
|
||||
private _notes: any[] = notesData;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(private _fuseMockApiService: FuseMockApiService)
|
||||
{
|
||||
// Register Mock API handlers
|
||||
this.registerHandlers();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Register Mock API handlers
|
||||
*/
|
||||
registerHandlers(): void
|
||||
{
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Labels - GET
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onGet('api/apps/notes/labels')
|
||||
.reply(() => [
|
||||
200,
|
||||
cloneDeep(this._labels)
|
||||
]);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Labels - POST
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPost('api/apps/notes/labels')
|
||||
.reply(({request}) => {
|
||||
|
||||
// Create a new label
|
||||
const label = {
|
||||
id : FuseMockApiUtils.guid(),
|
||||
title: request.body.title
|
||||
};
|
||||
|
||||
// Update the labels
|
||||
this._labels.push(label);
|
||||
|
||||
return [
|
||||
200,
|
||||
cloneDeep(this._labels)
|
||||
];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Labels - PATCH
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPatch('api/apps/notes/labels')
|
||||
.reply(({request}) => {
|
||||
|
||||
// Get label
|
||||
const updatedLabel = request.body.label;
|
||||
|
||||
// Update the label
|
||||
this._labels = this._labels.map((label) => {
|
||||
if ( label.id === updatedLabel.id )
|
||||
{
|
||||
return {
|
||||
...label,
|
||||
title: updatedLabel.title
|
||||
};
|
||||
}
|
||||
|
||||
return label;
|
||||
});
|
||||
|
||||
return [
|
||||
200,
|
||||
cloneDeep(this._labels)
|
||||
];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Labels - DELETE
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onDelete('api/apps/notes/labels')
|
||||
.reply(({request}) => {
|
||||
|
||||
// Get label id
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Delete the label
|
||||
this._labels = this._labels.filter(label => label.id !== id);
|
||||
|
||||
// Go through notes and delete the label
|
||||
this._notes = this._notes.map(note => ({
|
||||
...note,
|
||||
labels: note.labels.filter(item => item !== id)
|
||||
}));
|
||||
|
||||
return [
|
||||
200,
|
||||
cloneDeep(this._labels)
|
||||
];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Note Tasks - POST
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPost('api/apps/notes/tasks')
|
||||
.reply(({request}) => {
|
||||
|
||||
// Get note and task
|
||||
let updatedNote = request.body.note;
|
||||
const task = request.body.task;
|
||||
|
||||
// Update the note
|
||||
this._notes = this._notes.map((note) => {
|
||||
if ( note.id === updatedNote.id )
|
||||
{
|
||||
// Update the tasks
|
||||
if ( !note.tasks )
|
||||
{
|
||||
note.tasks = [];
|
||||
}
|
||||
|
||||
note.tasks.push({
|
||||
id : FuseMockApiUtils.guid(),
|
||||
content : task,
|
||||
completed: false
|
||||
});
|
||||
|
||||
// Update the updatedNote with the new task
|
||||
updatedNote = cloneDeep(note);
|
||||
|
||||
return {
|
||||
...note
|
||||
};
|
||||
}
|
||||
|
||||
return note;
|
||||
});
|
||||
|
||||
return [
|
||||
200,
|
||||
updatedNote
|
||||
];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Notes - GET
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onGet('api/apps/notes/all')
|
||||
.reply(() => {
|
||||
|
||||
// Clone the labels and notes
|
||||
const labels = cloneDeep(this._labels);
|
||||
let notes = cloneDeep(this._notes);
|
||||
|
||||
// Attach the labels to the notes
|
||||
notes = notes.map(note => (
|
||||
{
|
||||
...note,
|
||||
labels: note.labels.map(labelId => labels.find(label => label.id === labelId))
|
||||
}
|
||||
));
|
||||
|
||||
return [
|
||||
200,
|
||||
notes
|
||||
];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Notes - POST
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPost('api/apps/notes')
|
||||
.reply(({request}) => {
|
||||
|
||||
// Get note
|
||||
const note = request.body.note;
|
||||
|
||||
// Add an id
|
||||
note.id = FuseMockApiUtils.guid();
|
||||
|
||||
// Push the note
|
||||
this._notes.push(note);
|
||||
|
||||
return [
|
||||
200,
|
||||
note
|
||||
];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Notes - PATCH
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPatch('api/apps/notes')
|
||||
.reply(({request}) => {
|
||||
|
||||
// Get note
|
||||
const updatedNote = request.body.updatedNote;
|
||||
|
||||
// Update the note
|
||||
this._notes = this._notes.map((note) => {
|
||||
if ( note.id === updatedNote.id )
|
||||
{
|
||||
return {
|
||||
...updatedNote
|
||||
};
|
||||
}
|
||||
|
||||
return note;
|
||||
});
|
||||
|
||||
return [
|
||||
200,
|
||||
updatedNote
|
||||
];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Notes - DELETE
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onDelete('api/apps/notes')
|
||||
.reply(({request}) => {
|
||||
|
||||
// Get the id
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the note and delete it
|
||||
this._notes.forEach((item, index) => {
|
||||
|
||||
if ( item.id === id )
|
||||
{
|
||||
this._notes.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
// Return the response
|
||||
return [200, true];
|
||||
});
|
||||
}
|
||||
}
|
||||
314
src/app/mock-api/apps/notes/data.ts
Normal file
314
src/app/mock-api/apps/notes/data.ts
Normal file
@@ -0,0 +1,314 @@
|
||||
/* eslint-disable */
|
||||
import moment from 'moment';
|
||||
|
||||
export const labels = [
|
||||
{
|
||||
id : 'f47c92e5-20b9-44d9-917f-9ff4ad25dfd0',
|
||||
title: 'Family'
|
||||
},
|
||||
{
|
||||
id : 'e2f749f5-41ed-49d0-a92a-1c83d879e371',
|
||||
title: 'Work'
|
||||
},
|
||||
{
|
||||
id : 'b1cde9ee-e54d-4142-ad8b-cf55dafc9528',
|
||||
title: 'Tasks'
|
||||
},
|
||||
{
|
||||
id : '6c288794-47eb-4605-8bdf-785b61a449d3',
|
||||
title: 'Priority'
|
||||
},
|
||||
{
|
||||
id : 'bbc73458-940b-421c-8d5f-8dcd23a9b0d6',
|
||||
title: 'Personal'
|
||||
},
|
||||
{
|
||||
id : '2dc11344-3507-48e0-83d6-1c047107f052',
|
||||
title: 'Friends'
|
||||
}
|
||||
];
|
||||
|
||||
export const notes = [
|
||||
{
|
||||
id : '8f011ac5-b71c-4cd7-a317-857dcd7d85e0',
|
||||
title : '',
|
||||
content : 'Find a new company name',
|
||||
tasks : null,
|
||||
image : null,
|
||||
reminder : null,
|
||||
labels : ['e2f749f5-41ed-49d0-a92a-1c83d879e371'],
|
||||
archived : false,
|
||||
createdAt: moment().hour(10).minute(19).subtract(98, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : 'ced0a1ce-051d-41a3-b080-e2161e4ae621',
|
||||
title : '',
|
||||
content : 'Send the photos of last summer to John',
|
||||
tasks : null,
|
||||
image : 'assets/images/cards/14-640x480.jpg',
|
||||
reminder : null,
|
||||
labels : [
|
||||
'bbc73458-940b-421c-8d5f-8dcd23a9b0d6',
|
||||
'b1cde9ee-e54d-4142-ad8b-cf55dafc9528'
|
||||
],
|
||||
archived : false,
|
||||
createdAt: moment().hour(15).minute(37).subtract(80, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : 'd3ac02a9-86e4-4187-bbd7-2c965518b3a3',
|
||||
title : '',
|
||||
content : 'Update the design of the theme',
|
||||
tasks : null,
|
||||
image : null,
|
||||
reminder : null,
|
||||
labels : ['6c288794-47eb-4605-8bdf-785b61a449d3'],
|
||||
archived : false,
|
||||
createdAt: moment().hour(19).minute(27).subtract(74, 'day').toISOString(),
|
||||
updatedAt: moment().hour(15).minute(36).subtract(50, 'day').toISOString()
|
||||
},
|
||||
{
|
||||
id : '89861bd4-0144-4bb4-8b39-332ca10371d5',
|
||||
title : '',
|
||||
content : 'Theming support for all apps',
|
||||
tasks : null,
|
||||
image : null,
|
||||
reminder : moment().hour(12).minute(34).add(50, 'day').toISOString(),
|
||||
labels : ['e2f749f5-41ed-49d0-a92a-1c83d879e371'],
|
||||
archived : false,
|
||||
createdAt: moment().hour(12).minute(34).subtract(59, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : 'ffd20f3c-2d43-4c6b-8021-278032fc9e92',
|
||||
title : 'Gift Ideas',
|
||||
content : 'Stephanie\'s birthday is coming and I need to pick a present for her. Take a look at the below list and buy one of them (or all of them)',
|
||||
tasks : [
|
||||
{
|
||||
id : '330a924f-fb51-48f6-a374-1532b1dd353d',
|
||||
content : 'Scarf',
|
||||
completed: false
|
||||
},
|
||||
{
|
||||
id : '781855a6-2ad2-4df4-b0af-c3cb5f302b40',
|
||||
content : 'A new bike helmet',
|
||||
completed: true
|
||||
},
|
||||
{
|
||||
id : 'bcb8923b-33cd-42c2-9203-170994fa24f5',
|
||||
content : 'Necklace',
|
||||
completed: false
|
||||
},
|
||||
{
|
||||
id : '726bdf6e-5cd7-408a-9a4f-0d7bb98c1c4b',
|
||||
content : 'Flowers',
|
||||
completed: false
|
||||
}
|
||||
],
|
||||
image : null,
|
||||
reminder : null,
|
||||
labels : ['f47c92e5-20b9-44d9-917f-9ff4ad25dfd0'],
|
||||
archived : false,
|
||||
createdAt: moment().hour(16).minute(4).subtract(47, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : '71d223bb-abab-4183-8919-cd3600a950b4',
|
||||
title : 'Shopping list',
|
||||
content : '',
|
||||
tasks : [
|
||||
{
|
||||
id : 'e3cbc986-641c-4448-bc26-7ecfa0549c22',
|
||||
content : 'Bread',
|
||||
completed: true
|
||||
},
|
||||
{
|
||||
id : '34013111-ab2c-4b2f-9352-d2ae282f57d3',
|
||||
content : 'Milk',
|
||||
completed: false
|
||||
},
|
||||
{
|
||||
id : '0fbdea82-cc79-4433-8ee4-54fd542c380d',
|
||||
content : 'Onions',
|
||||
completed: false
|
||||
},
|
||||
{
|
||||
id : '66490222-743e-4262-ac91-773fcd98a237',
|
||||
content : 'Coffee',
|
||||
completed: true
|
||||
},
|
||||
{
|
||||
id : 'ab367215-d06a-48b0-a7b8-e161a63b07bd',
|
||||
content : 'Toilet Paper',
|
||||
completed: true
|
||||
}
|
||||
],
|
||||
image : null,
|
||||
reminder : moment().hour(10).minute(44).subtract(35, 'day').toISOString(),
|
||||
labels : ['b1cde9ee-e54d-4142-ad8b-cf55dafc9528'],
|
||||
archived : false,
|
||||
createdAt: moment().hour(10).minute(44).subtract(35, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : '11fbeb98-ae5e-41ad-bed6-330886fd7906',
|
||||
title : 'Keynote Schedule',
|
||||
content : '',
|
||||
tasks : [
|
||||
{
|
||||
id : '2711bac1-7d8a-443a-a4fe-506ef51d3fcb',
|
||||
content : 'Breakfast',
|
||||
completed: true
|
||||
},
|
||||
{
|
||||
id : 'e3a2d675-a3e5-4cef-9205-feeccaf949d7',
|
||||
content : 'Opening ceremony',
|
||||
completed: true
|
||||
},
|
||||
{
|
||||
id : '7a721b6d-9d85-48e0-b6c3-f927079af582',
|
||||
content : 'Talk 1: How we did it!',
|
||||
completed: true
|
||||
},
|
||||
{
|
||||
id : 'bdb4d5cd-5bb8-45e2-9186-abfd8307e429',
|
||||
content : 'Talk 2: How can you do it!',
|
||||
completed: false
|
||||
},
|
||||
{
|
||||
id : 'c8293bb4-8ab4-4310-bbc2-52ecf8ec0c54',
|
||||
content : 'Lunch break',
|
||||
completed: false
|
||||
}
|
||||
],
|
||||
image : null,
|
||||
reminder : moment().hour(11).minute(27).subtract(14, 'day').toISOString(),
|
||||
labels : [
|
||||
'b1cde9ee-e54d-4142-ad8b-cf55dafc9528',
|
||||
'e2f749f5-41ed-49d0-a92a-1c83d879e371'
|
||||
],
|
||||
archived : false,
|
||||
createdAt: moment().hour(11).minute(27).subtract(24, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : 'd46dee8b-8761-4b6d-a1df-449d6e6feb6a',
|
||||
title : '',
|
||||
content : 'Organize the dad\'s surprise retirement party',
|
||||
tasks : null,
|
||||
image : null,
|
||||
reminder : moment().hour(14).minute(56).subtract(25, 'day').toISOString(),
|
||||
labels : ['f47c92e5-20b9-44d9-917f-9ff4ad25dfd0'],
|
||||
archived : false,
|
||||
createdAt: moment().hour(14).minute(56).subtract(20, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : '6bc9f002-1675-417c-93c4-308fba39023e',
|
||||
title : 'Plan the road trip',
|
||||
content : '',
|
||||
tasks : null,
|
||||
image : 'assets/images/cards/17-640x480.jpg',
|
||||
reminder : null,
|
||||
labels : [
|
||||
'2dc11344-3507-48e0-83d6-1c047107f052',
|
||||
'b1cde9ee-e54d-4142-ad8b-cf55dafc9528'
|
||||
],
|
||||
archived : false,
|
||||
createdAt: moment().hour(9).minute(32).subtract(15, 'day').toISOString(),
|
||||
updatedAt: moment().hour(17).minute(6).subtract(12, 'day').toISOString()
|
||||
},
|
||||
{
|
||||
id : '15188348-78aa-4ed6-b5c2-028a214ba987',
|
||||
title : 'Office Address',
|
||||
content : '933 8th Street Stamford, CT 06902',
|
||||
tasks : null,
|
||||
image : null,
|
||||
reminder : null,
|
||||
labels : ['e2f749f5-41ed-49d0-a92a-1c83d879e371'],
|
||||
archived : false,
|
||||
createdAt: moment().hour(20).minute(5).subtract(12, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : '1dbfc685-1a0a-4070-9ca7-ed896c523037',
|
||||
title : 'Tasks',
|
||||
content : '',
|
||||
tasks : [
|
||||
{
|
||||
id : '004638bf-3ee6-47a5-891c-3be7b9f3df09',
|
||||
content : 'Wash the dishes',
|
||||
completed: true
|
||||
},
|
||||
{
|
||||
id : '86e6820b-1ae3-4c14-a13e-35605a0d654b',
|
||||
content : 'Walk the dog',
|
||||
completed: false
|
||||
}
|
||||
],
|
||||
image : null,
|
||||
reminder : moment().hour(13).minute(43).subtract(2, 'day').toISOString(),
|
||||
labels : ['bbc73458-940b-421c-8d5f-8dcd23a9b0d6'],
|
||||
archived : false,
|
||||
createdAt: moment().hour(13).minute(43).subtract(7, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : '49548409-90a3-44d4-9a9a-f5af75aa9a66',
|
||||
title : '',
|
||||
content : 'Dinner with parents',
|
||||
tasks : null,
|
||||
image : null,
|
||||
reminder : null,
|
||||
labels : [
|
||||
'f47c92e5-20b9-44d9-917f-9ff4ad25dfd0',
|
||||
'6c288794-47eb-4605-8bdf-785b61a449d3'
|
||||
],
|
||||
archived : false,
|
||||
createdAt: moment().hour(7).minute(12).subtract(2, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : 'c6d13a35-500d-4491-a3f3-6ca05d6632d3',
|
||||
title : '',
|
||||
content : 'Re-fill the medicine cabinet',
|
||||
tasks : null,
|
||||
image : null,
|
||||
reminder : null,
|
||||
labels : [
|
||||
'bbc73458-940b-421c-8d5f-8dcd23a9b0d6',
|
||||
'6c288794-47eb-4605-8bdf-785b61a449d3'
|
||||
],
|
||||
archived : true,
|
||||
createdAt: moment().hour(17).minute(14).subtract(100, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : 'c6d13a35-500d-4491-a3f3-6ca05d6632d3',
|
||||
title : '',
|
||||
content : 'Update the icons pack',
|
||||
tasks : null,
|
||||
image : null,
|
||||
reminder : null,
|
||||
labels : ['e2f749f5-41ed-49d0-a92a-1c83d879e371'],
|
||||
archived : true,
|
||||
createdAt: moment().hour(10).minute(29).subtract(85, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
},
|
||||
{
|
||||
id : '46214383-f8e7-44da-aa2e-0b685e0c5027',
|
||||
title : 'Team Meeting',
|
||||
content : 'Talk about the future of the web apps',
|
||||
tasks : null,
|
||||
image : null,
|
||||
reminder : null,
|
||||
labels : [
|
||||
'e2f749f5-41ed-49d0-a92a-1c83d879e371',
|
||||
'b1cde9ee-e54d-4142-ad8b-cf55dafc9528'
|
||||
],
|
||||
archived : true,
|
||||
createdAt: moment().hour(15).minute(30).subtract(69, 'day').toISOString(),
|
||||
updatedAt: null
|
||||
}
|
||||
];
|
||||
@@ -35,13 +35,10 @@ export class TasksMockApi
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onGet('api/apps/tasks/tags')
|
||||
.reply(() => {
|
||||
|
||||
return [
|
||||
200,
|
||||
cloneDeep(this._tags)
|
||||
];
|
||||
});
|
||||
.reply(() => [
|
||||
200,
|
||||
cloneDeep(this._tags)
|
||||
]);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Tags - POST
|
||||
@@ -109,7 +106,7 @@ export class TasksMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the tag and delete it
|
||||
const index = this._tags.findIndex((item) => item.id === id);
|
||||
const index = this._tags.findIndex(item => item.id === id);
|
||||
this._tags.splice(index, 1);
|
||||
|
||||
// Get the tasks that have the tag
|
||||
@@ -165,9 +162,8 @@ export class TasksMockApi
|
||||
let tasks = cloneDeep(this._tasks);
|
||||
|
||||
// Filter the tasks
|
||||
tasks = tasks.filter((task) => {
|
||||
return task.title && task.title.toLowerCase().includes(query.toLowerCase()) || task.notes && task.notes.toLowerCase().includes(query.toLowerCase());
|
||||
});
|
||||
tasks = tasks.filter(task => task.title && task.title.toLowerCase().includes(query.toLowerCase()) || task.notes && task.notes.toLowerCase()
|
||||
.includes(query.toLowerCase()));
|
||||
|
||||
// Mark the found chars
|
||||
tasks.forEach((task) => {
|
||||
@@ -231,7 +227,7 @@ export class TasksMockApi
|
||||
const tasks = cloneDeep(this._tasks);
|
||||
|
||||
// Find the task
|
||||
const task = tasks.find((item) => item.id === id);
|
||||
const task = tasks.find(item => item.id === id);
|
||||
|
||||
return [
|
||||
200,
|
||||
@@ -317,7 +313,7 @@ export class TasksMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the task and delete it
|
||||
const index = this._tasks.findIndex((item) => item.id === id);
|
||||
const index = this._tasks.findIndex(item => item.id === id);
|
||||
this._tasks.splice(index, 1);
|
||||
|
||||
return [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const tags = [
|
||||
{
|
||||
id : 'a0bf42ca-c3a5-47be-8341-b9c0bb8ef270',
|
||||
|
||||
@@ -40,28 +40,24 @@ export class AuthMockApi
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPost('api/auth/forgot-password', 1000)
|
||||
.reply(() => {
|
||||
|
||||
// Simply return true
|
||||
return [
|
||||
.reply(() =>
|
||||
[
|
||||
200,
|
||||
true
|
||||
];
|
||||
});
|
||||
]
|
||||
);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Reset password - POST
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPost('api/auth/reset-password', 1000)
|
||||
.reply(() => {
|
||||
|
||||
// Simply return true
|
||||
return [
|
||||
.reply(() =>
|
||||
[
|
||||
200,
|
||||
true
|
||||
];
|
||||
});
|
||||
]
|
||||
);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Sign in - POST
|
||||
@@ -76,9 +72,9 @@ export class AuthMockApi
|
||||
return [
|
||||
200,
|
||||
{
|
||||
user : cloneDeep(this._user),
|
||||
access_token: this._generateJWTToken(),
|
||||
token_type : 'bearer'
|
||||
user : cloneDeep(this._user),
|
||||
accessToken: this._generateJWTToken(),
|
||||
tokenType : 'bearer'
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -98,7 +94,7 @@ export class AuthMockApi
|
||||
.reply(({request}) => {
|
||||
|
||||
// Get the access token
|
||||
const accessToken = request.body.access_token;
|
||||
const accessToken = request.body.accessToken;
|
||||
|
||||
// Verify the token
|
||||
if ( this._verifyJWTToken(accessToken) )
|
||||
@@ -106,9 +102,9 @@ export class AuthMockApi
|
||||
return [
|
||||
200,
|
||||
{
|
||||
user : cloneDeep(this._user),
|
||||
access_token: this._generateJWTToken(),
|
||||
token_type : 'bearer'
|
||||
user : cloneDeep(this._user),
|
||||
accessToken: this._generateJWTToken(),
|
||||
tokenType : 'bearer'
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -127,14 +123,14 @@ export class AuthMockApi
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onPost('api/auth/sign-up', 1500)
|
||||
.reply(() => {
|
||||
.reply(() =>
|
||||
|
||||
// Simply return true
|
||||
return [
|
||||
[
|
||||
200,
|
||||
true
|
||||
];
|
||||
});
|
||||
]
|
||||
);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Unlock session - POST
|
||||
@@ -149,9 +145,9 @@ export class AuthMockApi
|
||||
return [
|
||||
200,
|
||||
{
|
||||
user : cloneDeep(this._user),
|
||||
access_token: this._generateJWTToken(),
|
||||
token_type : 'bearer'
|
||||
user : cloneDeep(this._user),
|
||||
accessToken: this._generateJWTToken(),
|
||||
tokenType : 'bearer'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable */
|
||||
import * as moment from 'moment';
|
||||
import { Message } from 'app/layout/common/messages/messages.types';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export const messages: Message[] = [
|
||||
{
|
||||
id : '832276cc-c5e9-4fcc-8e23-d38e2e267bc9',
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable */
|
||||
import * as moment from 'moment';
|
||||
import { Notification } from 'app/layout/common/notifications/notifications.types';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export const notifications: Notification[] = [
|
||||
{
|
||||
id : '493190c9-5b61-4912-afe5-78c21f1044d7',
|
||||
|
||||
@@ -55,14 +55,10 @@ export class SearchMockApi
|
||||
}
|
||||
|
||||
// Filter the navigation
|
||||
const navigationResults = cloneDeep(flatNavigation).filter((item) => {
|
||||
return (item.title?.toLowerCase().includes(query) || (item.subtitle && item.subtitle.includes(query)));
|
||||
});
|
||||
const navigationResults = cloneDeep(flatNavigation).filter(item => (item.title?.toLowerCase().includes(query) || (item.subtitle && item.subtitle.includes(query))));
|
||||
|
||||
// Filter the contacts
|
||||
const contactsResults = cloneDeep(this._contacts).filter((user) => {
|
||||
return user.name.toLowerCase().includes(query);
|
||||
});
|
||||
const contactsResults = cloneDeep(this._contacts).filter(user => user.name.toLowerCase().includes(query));
|
||||
|
||||
// Create the results array
|
||||
const results = [];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import { Shortcut } from 'app/layout/common/shortcuts/shortcuts.types';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export const shortcuts: Shortcut[] = [
|
||||
{
|
||||
id : 'a1ae91d3-e2cb-459b-9be9-a184694f548b',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const user: any = {
|
||||
id : 'cfaad35d-07a3-4447-a6c3-d8c3d54fd5df',
|
||||
name : 'Brian Hughes',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import * as moment from 'moment';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export const analytics = {
|
||||
visitors : {
|
||||
series: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import * as moment from 'moment';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export const project = {
|
||||
githubIssues : {
|
||||
overview: {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { IconsMockApi } from 'app/mock-api/ui/icons/api';
|
||||
import { MailboxMockApi } from 'app/mock-api/apps/mailbox/api';
|
||||
import { MessagesMockApi } from 'app/mock-api/common/messages/api';
|
||||
import { NavigationMockApi } from 'app/mock-api/common/navigation/api';
|
||||
import { NotesMockApi } from 'app/mock-api/apps/notes/api';
|
||||
import { NotificationsMockApi } from 'app/mock-api/common/notifications/api';
|
||||
import { ProjectMockApi } from 'app/mock-api/dashboards/project/api';
|
||||
import { SearchMockApi } from 'app/mock-api/common/search/api';
|
||||
@@ -32,6 +33,7 @@ export const mockApiServices = [
|
||||
MailboxMockApi,
|
||||
MessagesMockApi,
|
||||
NavigationMockApi,
|
||||
NotesMockApi,
|
||||
NotificationsMockApi,
|
||||
ProjectMockApi,
|
||||
SearchMockApi,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
|
||||
// Updated at: 20210425 - 1792 icons
|
||||
export const material = [
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<router-outlet></router-outlet>
|
||||
@@ -1,17 +0,0 @@
|
||||
import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector : 'academy',
|
||||
templateUrl : './academy.component.html',
|
||||
encapsulation : ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class AcademyComponent
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { FuseFindByKeyPipeModule } from '@fuse/pipes/find-by-key';
|
||||
import { SharedModule } from 'app/shared/shared.module';
|
||||
import { academyRoutes } from 'app/modules/admin/apps/academy/academy.routing';
|
||||
import { AcademyComponent } from 'app/modules/admin/apps/academy/academy.component';
|
||||
import { AcademyDetailsComponent } from 'app/modules/admin/apps/academy/details/details.component';
|
||||
import { AcademyListComponent } from 'app/modules/admin/apps/academy/list/list.component';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AcademyComponent,
|
||||
AcademyDetailsComponent,
|
||||
AcademyListComponent
|
||||
],
|
||||
imports: [
|
||||
RouterModule.forChild(academyRoutes),
|
||||
MatButtonModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatProgressBarModule,
|
||||
MatSelectModule,
|
||||
MatSidenavModule,
|
||||
MatSlideToggleModule,
|
||||
MatTooltipModule,
|
||||
FuseFindByKeyPipeModule,
|
||||
SharedModule,
|
||||
MatTabsModule
|
||||
]
|
||||
})
|
||||
export class AcademyModule
|
||||
{
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { Category, Course } from 'app/modules/admin/apps/academy/academy.types';
|
||||
import { AcademyService } from 'app/modules/admin/apps/academy/academy.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AcademyCategoriesResolver implements Resolve<any>
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(private _academyService: AcademyService)
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Resolver
|
||||
*
|
||||
* @param route
|
||||
* @param state
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Category[]>
|
||||
{
|
||||
return this._academyService.getCategories();
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AcademyCoursesResolver implements Resolve<any>
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(private _academyService: AcademyService)
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Resolver
|
||||
*
|
||||
* @param route
|
||||
* @param state
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Course[]>
|
||||
{
|
||||
return this._academyService.getCourses();
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AcademyCourseResolver implements Resolve<any>
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(
|
||||
private _router: Router,
|
||||
private _academyService: AcademyService
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Resolver
|
||||
*
|
||||
* @param route
|
||||
* @param state
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Course>
|
||||
{
|
||||
return this._academyService.getCourseById(route.paramMap.get('id'))
|
||||
.pipe(
|
||||
// Error here means the requested task is not available
|
||||
catchError((error) => {
|
||||
|
||||
// Log the error
|
||||
console.error(error);
|
||||
|
||||
// Get the parent url
|
||||
const parentUrl = state.url.split('/').slice(0, -1).join('/');
|
||||
|
||||
// Navigate to there
|
||||
this._router.navigateByUrl(parentUrl);
|
||||
|
||||
// Throw an error
|
||||
return throwError(error);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import { Route } from '@angular/router';
|
||||
import { AcademyComponent } from 'app/modules/admin/apps/academy/academy.component';
|
||||
import { AcademyListComponent } from 'app/modules/admin/apps/academy/list/list.component';
|
||||
import { AcademyDetailsComponent } from 'app/modules/admin/apps/academy/details/details.component';
|
||||
import { AcademyCategoriesResolver, AcademyCourseResolver, AcademyCoursesResolver } from 'app/modules/admin/apps/academy/academy.resolvers';
|
||||
|
||||
export const academyRoutes: Route[] = [
|
||||
{
|
||||
path : '',
|
||||
component: AcademyComponent,
|
||||
resolve : {
|
||||
categories: AcademyCategoriesResolver
|
||||
},
|
||||
children : [
|
||||
{
|
||||
path : '',
|
||||
pathMatch: 'full',
|
||||
component: AcademyListComponent,
|
||||
resolve : {
|
||||
courses: AcademyCoursesResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path : ':id',
|
||||
component: AcademyDetailsComponent,
|
||||
resolve : {
|
||||
course: AcademyCourseResolver
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -1,105 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { BehaviorSubject, Observable, of, throwError } from 'rxjs';
|
||||
import { map, switchMap, tap } from 'rxjs/operators';
|
||||
import { Category, Course } from 'app/modules/admin/apps/academy/academy.types';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AcademyService
|
||||
{
|
||||
// Private
|
||||
private _categories: BehaviorSubject<Category[] | null> = new BehaviorSubject(null);
|
||||
private _course: BehaviorSubject<Course | null> = new BehaviorSubject(null);
|
||||
private _courses: BehaviorSubject<Course[] | null> = new BehaviorSubject(null);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(private _httpClient: HttpClient)
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Accessors
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Getter for categories
|
||||
*/
|
||||
get categories$(): Observable<Category[]>
|
||||
{
|
||||
return this._categories.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for courses
|
||||
*/
|
||||
get courses$(): Observable<Course[]>
|
||||
{
|
||||
return this._courses.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for course
|
||||
*/
|
||||
get course$(): Observable<Course>
|
||||
{
|
||||
return this._course.asObservable();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get categories
|
||||
*/
|
||||
getCategories(): Observable<Category[]>
|
||||
{
|
||||
return this._httpClient.get<Category[]>('api/apps/academy/categories').pipe(
|
||||
tap((response: any) => {
|
||||
this._categories.next(response);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get courses
|
||||
*/
|
||||
getCourses(): Observable<Course[]>
|
||||
{
|
||||
return this._httpClient.get<Course[]>('api/apps/academy/courses').pipe(
|
||||
tap((response: any) => {
|
||||
this._courses.next(response);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get course by id
|
||||
*/
|
||||
getCourseById(id: string): Observable<Course>
|
||||
{
|
||||
return this._httpClient.get<Course>('api/apps/academy/courses/course', {params: {id}}).pipe(
|
||||
map((course) => {
|
||||
|
||||
// Update the course
|
||||
this._course.next(course);
|
||||
|
||||
// Return the course
|
||||
return course;
|
||||
}),
|
||||
switchMap((course) => {
|
||||
|
||||
if ( !course )
|
||||
{
|
||||
return throwError('Could not found course with id of ' + id + '!');
|
||||
}
|
||||
|
||||
return of(course);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
export interface Category
|
||||
{
|
||||
id?: string;
|
||||
title?: string;
|
||||
slug?: string;
|
||||
}
|
||||
|
||||
export interface Course
|
||||
{
|
||||
id?: string;
|
||||
title?: string;
|
||||
slug?: string;
|
||||
description?: string;
|
||||
category?: string;
|
||||
duration?: number;
|
||||
steps?: {
|
||||
order?: number;
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
content?: string;
|
||||
}[];
|
||||
totalSteps?: number;
|
||||
updatedAt?: number;
|
||||
featured?: boolean;
|
||||
progress?: {
|
||||
currentStep?: number;
|
||||
completed?: number;
|
||||
};
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
<div class="absolute inset-0 flex flex-col min-w-0 overflow-hidden">
|
||||
|
||||
<mat-drawer-container class="flex-auto h-full">
|
||||
|
||||
<!-- Drawer -->
|
||||
<mat-drawer
|
||||
class="w-90 dark:bg-gray-900"
|
||||
[autoFocus]="false"
|
||||
[mode]="drawerMode"
|
||||
[opened]="drawerOpened"
|
||||
#matDrawer>
|
||||
<div class="flex flex-col items-start p-8 border-b">
|
||||
<!-- Back to courses -->
|
||||
<a
|
||||
class="inline-flex items-center leading-6 text-primary hover:underline"
|
||||
[routerLink]="['..']">
|
||||
<span class="inline-flex items-center">
|
||||
<mat-icon
|
||||
class="icon-size-5 text-current"
|
||||
[svgIcon]="'heroicons_solid:arrow-sm-left'"></mat-icon>
|
||||
<span class="ml-1.5 font-medium leading-5">Back to courses</span>
|
||||
</span>
|
||||
</a>
|
||||
<!-- Course category -->
|
||||
<ng-container *ngIf="(course.category | fuseFindByKey:'slug':categories) as category">
|
||||
<div
|
||||
class="mt-7 py-0.5 px-3 rounded-full text-sm font-semibold"
|
||||
[ngClass]="{'text-blue-800 bg-blue-100 dark:text-blue-50 dark:bg-blue-500': category.slug === 'web',
|
||||
'text-green-800 bg-green-100 dark:text-green-50 dark:bg-green-500': category.slug === 'android',
|
||||
'text-pink-800 bg-pink-100 dark:text-pink-50 dark:bg-pink-500': category.slug === 'cloud',
|
||||
'text-amber-800 bg-amber-100 dark:text-amber-50 dark:bg-amber-500': category.slug === 'firebase'}">
|
||||
{{category.title}}
|
||||
</div>
|
||||
</ng-container>
|
||||
<!-- Course title & description -->
|
||||
<div class="mt-3 text-2xl font-semibold">{{course.title}}</div>
|
||||
<div class="text-secondary">{{course.description}}</div>
|
||||
<!-- Course time -->
|
||||
<div class="mt-6 flex items-center leading-5 text-md text-secondary">
|
||||
<mat-icon
|
||||
class="icon-size-5 text-hint"
|
||||
[svgIcon]="'heroicons_solid:clock'"></mat-icon>
|
||||
<div class="ml-1.5">{{course.duration}} minutes</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Steps -->
|
||||
<div class="py-2 px-8">
|
||||
<ol>
|
||||
<ng-container *ngFor="let step of course.steps; let last = last; trackBy: trackByFn">
|
||||
<li class="relative group py-6"
|
||||
[class.current-step]="step.order === currentStep">
|
||||
<ng-container *ngIf="!last">
|
||||
<div
|
||||
class="absolute top-6 left-4 w-0.5 h-full -ml-px"
|
||||
[ngClass]="{'bg-primary': step.order < currentStep,
|
||||
'bg-gray-300 dark:bg-gray-600': step.order >= currentStep}"></div>
|
||||
</ng-container>
|
||||
<div
|
||||
class="relative flex items-start cursor-pointer"
|
||||
(click)="goToStep(step.order)">
|
||||
<div
|
||||
class="flex flex-0 items-center justify-center w-8 h-8 rounded-full ring-2 ring-inset ring-transparent bg-card dark:bg-default"
|
||||
[ngClass]="{'bg-primary dark:bg-primary text-on-primary group-hover:bg-primary-800': step.order < currentStep,
|
||||
'ring-primary': step.order === currentStep,
|
||||
'ring-gray-300 dark:ring-gray-600 group-hover:ring-gray-400': step.order > currentStep}">
|
||||
<!-- Check icon, show if the step is completed -->
|
||||
<ng-container *ngIf="step.order < currentStep">
|
||||
<mat-icon
|
||||
class="icon-size-5 text-current"
|
||||
[svgIcon]="'heroicons_solid:check'"></mat-icon>
|
||||
</ng-container>
|
||||
<!-- Step order, show if the step is the current step -->
|
||||
<ng-container *ngIf="step.order === currentStep">
|
||||
<div class="text-md font-semibold text-primary dark:text-primary-500">{{step.order + 1}}</div>
|
||||
</ng-container>
|
||||
<!-- Step order, show if the step is not completed -->
|
||||
<ng-container *ngIf="step.order > currentStep">
|
||||
<div class="text-md font-semibold text-hint group-hover:text-secondary">{{step.order + 1}}</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div class="ml-4">
|
||||
<div class="font-medium leading-4">{{step.title}}</div>
|
||||
<div class="mt-1.5 text-md leading-4 text-secondary">{{step.subtitle}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ng-container>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
</mat-drawer>
|
||||
|
||||
<!-- Drawer content -->
|
||||
<mat-drawer-content class="flex flex-col overflow-hidden">
|
||||
|
||||
<!-- Header -->
|
||||
<div class="lg:hidden flex flex-0 items-center py-2 pl-4 pr-6 sm:py-4 md:pl-6 md:pr-8 border-b lg:border-b-0 bg-card dark:bg-transparent">
|
||||
<!-- Title & Actions -->
|
||||
<button
|
||||
mat-icon-button
|
||||
[routerLink]="['..']">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:arrow-sm-left'"></mat-icon>
|
||||
</button>
|
||||
<h2 class="ml-2.5 text-md sm:text-xl font-medium tracking-tight truncate">
|
||||
{{course.title}}
|
||||
</h2>
|
||||
</div>
|
||||
<mat-progress-bar
|
||||
class="hidden lg:block flex-0 h-0.5 w-full"
|
||||
[value]="100 * (currentStep + 1) / course.totalSteps"></mat-progress-bar>
|
||||
|
||||
<!-- Main -->
|
||||
<div
|
||||
class="flex-auto overflow-y-auto"
|
||||
cdkScrollable>
|
||||
|
||||
<!-- Steps -->
|
||||
<mat-tab-group
|
||||
class="fuse-mat-no-header"
|
||||
[animationDuration]="'200'"
|
||||
#courseSteps>
|
||||
<ng-container *ngFor="let step of course.steps; trackBy: trackByFn">
|
||||
<mat-tab>
|
||||
<ng-template matTabContent>
|
||||
<div
|
||||
class="prose prose-sm max-w-3xl mx-auto sm:my-2 lg:mt-4 p-6 sm:p-10 sm:py-12 rounded-2xl shadow overflow-hidden bg-card"
|
||||
[innerHTML]="step.content"></div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
</ng-container>
|
||||
</mat-tab-group>
|
||||
|
||||
<!-- Navigation - Desktop -->
|
||||
<div class="z-10 sticky hidden lg:flex bottom-4 p-4">
|
||||
<div class="flex items-center justify-center mx-auto p-2 rounded-full shadow-lg bg-primary">
|
||||
<button
|
||||
class="flex-0"
|
||||
mat-flat-button
|
||||
[color]="'primary'"
|
||||
(click)="goToPreviousStep()">
|
||||
<mat-icon
|
||||
class="mr-2"
|
||||
[svgIcon]="'heroicons_outline:arrow-narrow-left'"></mat-icon>
|
||||
<span class="mr-1">Prev</span>
|
||||
</button>
|
||||
<div class="flex items-center justify-center mx-2.5 font-medium leading-5 text-on-primary">
|
||||
<span>{{currentStep + 1}}</span>
|
||||
<span class="mx-0.5 text-hint">/</span>
|
||||
<span>{{course.totalSteps}}</span>
|
||||
</div>
|
||||
<button
|
||||
class="flex-0"
|
||||
mat-flat-button
|
||||
[color]="'primary'"
|
||||
(click)="goToNextStep()">
|
||||
<span class="ml-1">Next</span>
|
||||
<mat-icon
|
||||
class="ml-2"
|
||||
[svgIcon]="'heroicons_outline:arrow-narrow-right'"></mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Progress & Navigation - Mobile -->
|
||||
<div class="lg:hidden flex items-center p-4 border-t bg-card">
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="matDrawer.toggle()">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:view-list'"></mat-icon>
|
||||
</button>
|
||||
<div class="flex items-center justify-center ml-1 lg:ml-2 font-medium leading-5">
|
||||
<span>{{currentStep + 1}}</span>
|
||||
<span class="mx-0.5 text-hint">/</span>
|
||||
<span>{{course.totalSteps}}</span>
|
||||
</div>
|
||||
<mat-progress-bar
|
||||
class="flex-auto ml-6 rounded-full"
|
||||
[value]="100 * (currentStep + 1) / course.totalSteps"></mat-progress-bar>
|
||||
<button
|
||||
class="ml-4"
|
||||
mat-icon-button
|
||||
(click)="goToPreviousStep()">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:arrow-narrow-left'"></mat-icon>
|
||||
</button>
|
||||
<button
|
||||
class="ml-0.5"
|
||||
mat-icon-button
|
||||
(click)="goToNextStep()">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:arrow-narrow-right'"></mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</mat-drawer-content>
|
||||
|
||||
</mat-drawer-container>
|
||||
|
||||
</div>
|
||||
@@ -1,204 +0,0 @@
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Inject, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import { MatTabGroup } from '@angular/material/tabs';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
|
||||
import { Category, Course } from 'app/modules/admin/apps/academy/academy.types';
|
||||
import { AcademyService } from 'app/modules/admin/apps/academy/academy.service';
|
||||
|
||||
@Component({
|
||||
selector : 'academy-details',
|
||||
templateUrl : './details.component.html',
|
||||
encapsulation : ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class AcademyDetailsComponent implements OnInit, OnDestroy
|
||||
{
|
||||
@ViewChild('courseSteps', {static: true}) courseSteps: MatTabGroup;
|
||||
categories: Category[];
|
||||
course: Course;
|
||||
currentStep: number = 0;
|
||||
drawerMode: 'over' | 'side' = 'side';
|
||||
drawerOpened: boolean = true;
|
||||
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(
|
||||
@Inject(DOCUMENT) private _document: Document,
|
||||
private _academyService: AcademyService,
|
||||
private _changeDetectorRef: ChangeDetectorRef,
|
||||
private _elementRef: ElementRef,
|
||||
private _fuseMediaWatcherService: FuseMediaWatcherService
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Lifecycle hooks
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* On init
|
||||
*/
|
||||
ngOnInit(): void
|
||||
{
|
||||
// Get the categories
|
||||
this._academyService.categories$
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe((categories: Category[]) => {
|
||||
|
||||
// Get the categories
|
||||
this.categories = categories;
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Get the course
|
||||
this._academyService.course$
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe((course: Course) => {
|
||||
|
||||
// Get the course
|
||||
this.course = course;
|
||||
|
||||
// Go to step
|
||||
this.goToStep(course.progress.currentStep);
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Subscribe to media changes
|
||||
this._fuseMediaWatcherService.onMediaChange$
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe(({matchingAliases}) => {
|
||||
|
||||
// Set the drawerMode and drawerOpened
|
||||
if ( matchingAliases.includes('lg') )
|
||||
{
|
||||
this.drawerMode = 'side';
|
||||
this.drawerOpened = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drawerMode = 'over';
|
||||
this.drawerOpened = false;
|
||||
}
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* On destroy
|
||||
*/
|
||||
ngOnDestroy(): void
|
||||
{
|
||||
// Unsubscribe from all subscriptions
|
||||
this._unsubscribeAll.next();
|
||||
this._unsubscribeAll.complete();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Go to given step
|
||||
*
|
||||
* @param step
|
||||
*/
|
||||
goToStep(step: number): void
|
||||
{
|
||||
// Set the current step
|
||||
this.currentStep = step;
|
||||
|
||||
// Go to the step
|
||||
this.courseSteps.selectedIndex = this.currentStep;
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to previous step
|
||||
*/
|
||||
goToPreviousStep(): void
|
||||
{
|
||||
// Return if we already on the first step
|
||||
if ( this.currentStep === 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Go to step
|
||||
this.goToStep(this.currentStep - 1);
|
||||
|
||||
// Scroll the current step selector from sidenav into view
|
||||
this._scrollCurrentStepElementIntoView();
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to next step
|
||||
*/
|
||||
goToNextStep(): void
|
||||
{
|
||||
// Return if we already on the last step
|
||||
if ( this.currentStep === this.course.totalSteps - 1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Go to step
|
||||
this.goToStep(this.currentStep + 1);
|
||||
|
||||
// Scroll the current step selector from sidenav into view
|
||||
this._scrollCurrentStepElementIntoView();
|
||||
}
|
||||
|
||||
/**
|
||||
* Track by function for ngFor loops
|
||||
*
|
||||
* @param index
|
||||
* @param item
|
||||
*/
|
||||
trackByFn(index: number, item: any): any
|
||||
{
|
||||
return item.id || index;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Private methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Scrolls the current step element from
|
||||
* sidenav into the view. This only happens when
|
||||
* previous/next buttons pressed as we don't want
|
||||
* to change the scroll position of the sidebar
|
||||
* when the user actually clicks around the sidebar.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
private _scrollCurrentStepElementIntoView(): void
|
||||
{
|
||||
// Wrap everything into setTimeout so we can make sure that the 'current-step' class points to correct element
|
||||
setTimeout(() => {
|
||||
|
||||
// Get the current step element and scroll it into view
|
||||
const currentStepElement = this._document.getElementsByClassName('current-step')[0];
|
||||
if ( currentStepElement )
|
||||
{
|
||||
currentStepElement.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block : 'start'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
<div
|
||||
class="absolute inset-0 flex flex-col min-w-0 overflow-y-auto"
|
||||
cdkScrollable>
|
||||
|
||||
<!-- Header -->
|
||||
<div class="relative flex-0 py-8 px-4 sm:p-16 overflow-hidden bg-gray-800 dark">
|
||||
<!-- Background - @formatter:off -->
|
||||
<!-- Rings -->
|
||||
<svg class="absolute inset-0 pointer-events-none"
|
||||
viewBox="0 0 960 540" width="100%" height="100%" preserveAspectRatio="xMidYMax slice" xmlns="http://www.w3.org/2000/svg">
|
||||
<g class="text-gray-700 opacity-25" fill="none" stroke="currentColor" stroke-width="100">
|
||||
<circle r="234" cx="196" cy="23"></circle>
|
||||
<circle r="234" cx="790" cy="491"></circle>
|
||||
</g>
|
||||
</svg>
|
||||
<!-- @formatter:on -->
|
||||
<div class="z-10 relative flex flex-col items-center">
|
||||
<h2 class="text-xl font-semibold">FUSE ACADEMY</h2>
|
||||
<div class="mt-1 text-4xl sm:text-7xl font-extrabold tracking-tight leading-tight text-center">
|
||||
What do you want to learn today?
|
||||
</div>
|
||||
<div class="max-w-2xl mt-6 sm:text-2xl text-center tracking-tight text-secondary">
|
||||
Our courses will step you through the process of a building small applications, or adding new features to existing applications.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main -->
|
||||
<div class="flex flex-auto p-6 sm:p-10">
|
||||
|
||||
<div class="flex flex-col flex-auto w-full max-w-xs sm:max-w-5xl mx-auto">
|
||||
<!-- Filters -->
|
||||
<div class="flex flex-col sm:flex-row items-center justify-between w-full max-w-xs sm:max-w-none">
|
||||
<mat-form-field class="fuse-mat-no-subscript w-full sm:w-36">
|
||||
<mat-select
|
||||
[value]="'all'"
|
||||
(selectionChange)="filterByCategory($event)">
|
||||
<mat-option [value]="'all'">All</mat-option>
|
||||
<ng-container *ngFor="let category of categories; trackBy: trackByFn">
|
||||
<mat-option [value]="category.slug">{{category.title}}</mat-option>
|
||||
</ng-container>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field
|
||||
class="fuse-mat-no-subscript w-full sm:w-72 mt-4 sm:mt-0 sm:ml-4"
|
||||
[floatLabel]="'always'">
|
||||
<mat-icon
|
||||
matPrefix
|
||||
class="icon-size-5"
|
||||
[svgIcon]="'heroicons_solid:search'"></mat-icon>
|
||||
<input
|
||||
(input)="filterByQuery(query.value)"
|
||||
placeholder="Search by title or description"
|
||||
matInput
|
||||
#query>
|
||||
</mat-form-field>
|
||||
<mat-slide-toggle
|
||||
class="mt-8 sm:mt-0 sm:ml-auto"
|
||||
[color]="'primary'"
|
||||
(change)="toggleCompleted($event)">
|
||||
Hide completed
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
<!-- Courses -->
|
||||
<ng-container *ngIf="this.filteredCourses.length; else noCourses">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8 mt-8 sm:mt-10">
|
||||
<ng-container *ngFor="let course of filteredCourses; trackBy: trackByFn">
|
||||
<!-- Course -->
|
||||
<div class="flex flex-col h-96 shadow rounded-2xl overflow-hidden bg-card">
|
||||
<div class="flex flex-col p-6">
|
||||
<div class="flex items-center justify-between">
|
||||
<!-- Course category -->
|
||||
<ng-container *ngIf="(course.category | fuseFindByKey:'slug':categories) as category">
|
||||
<div
|
||||
class="py-0.5 px-3 rounded-full text-sm font-semibold"
|
||||
[ngClass]="{'text-blue-800 bg-blue-100 dark:text-blue-50 dark:bg-blue-500': category.slug === 'web',
|
||||
'text-green-800 bg-green-100 dark:text-green-50 dark:bg-green-500': category.slug === 'android',
|
||||
'text-pink-800 bg-pink-100 dark:text-pink-50 dark:bg-pink-500': category.slug === 'cloud',
|
||||
'text-amber-800 bg-amber-100 dark:text-amber-50 dark:bg-amber-500': category.slug === 'firebase'}">
|
||||
{{category.title}}
|
||||
</div>
|
||||
</ng-container>
|
||||
<!-- Completed at least once -->
|
||||
<div class="flex items-center">
|
||||
<ng-container *ngIf="course.progress.completed > 0">
|
||||
<mat-icon
|
||||
class="icon-size-5 text-green-600"
|
||||
[svgIcon]="'heroicons_solid:badge-check'"
|
||||
[matTooltip]="'You completed this course at least once'"></mat-icon>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Course title & description -->
|
||||
<div class="mt-4 text-lg font-medium">{{course.title}}</div>
|
||||
<div class="mt-0.5 line-clamp-2 text-secondary">{{course.description}}</div>
|
||||
<div class="w-12 h-1 my-6 border-t-2"></div>
|
||||
<!-- Course time -->
|
||||
<div class="flex items-center leading-5 text-md text-secondary">
|
||||
<mat-icon
|
||||
class="icon-size-5 text-hint"
|
||||
[svgIcon]="'heroicons_solid:clock'"></mat-icon>
|
||||
<div class="ml-1.5">{{course.duration}} minutes</div>
|
||||
</div>
|
||||
<!-- Course completion -->
|
||||
<div class="flex items-center mt-2 leading-5 text-md text-secondary">
|
||||
<mat-icon
|
||||
class="icon-size-5 text-hint"
|
||||
[svgIcon]="'heroicons_solid:academic-cap'"></mat-icon>
|
||||
<ng-container *ngIf="course.progress.completed === 0">
|
||||
<div class="ml-1.5">Never completed</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="course.progress.completed > 0">
|
||||
<div class="ml-1.5">
|
||||
<span>Completed</span>
|
||||
<span class="ml-1">
|
||||
<!-- Once -->
|
||||
<ng-container *ngIf="course.progress.completed === 1">once</ng-container>
|
||||
<!-- Twice -->
|
||||
<ng-container *ngIf="course.progress.completed === 2">twice</ng-container>
|
||||
<!-- Others -->
|
||||
<ng-container *ngIf="course.progress.completed > 2">{{course.progress.completed}}
|
||||
{{course.progress.completed | i18nPlural: {
|
||||
'=0' : 'time',
|
||||
'=1' : 'time',
|
||||
'other': 'times'
|
||||
} }}
|
||||
</ng-container>
|
||||
</span>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Footer -->
|
||||
<div class="flex flex-col w-full mt-auto">
|
||||
<!-- Course progress -->
|
||||
<div class="relative h-0.5">
|
||||
<div
|
||||
class="z-10 absolute inset-x-0 h-6 -mt-3"
|
||||
[matTooltip]="course.progress.currentStep / course.totalSteps | percent"
|
||||
[matTooltipPosition]="'above'"
|
||||
[matTooltipClass]="'-mb-0.5'"></div>
|
||||
<mat-progress-bar
|
||||
class="h-0.5"
|
||||
[value]="(100 * course.progress.currentStep) / course.totalSteps"></mat-progress-bar>
|
||||
</div>
|
||||
|
||||
<!-- Course launch button -->
|
||||
<div class="px-6 py-4 text-right bg-gray-50 dark:bg-transparent">
|
||||
<button
|
||||
mat-stroked-button
|
||||
[routerLink]="[course.id]">
|
||||
<span class="inline-flex items-center">
|
||||
|
||||
<!-- Not started -->
|
||||
<ng-container *ngIf="course.progress.currentStep === 0">
|
||||
<!-- Never completed -->
|
||||
<ng-container *ngIf="course.progress.completed === 0">
|
||||
<span>Start</span>
|
||||
</ng-container>
|
||||
<!-- Completed before -->
|
||||
<ng-container *ngIf="course.progress.completed > 0">
|
||||
<span>Start again</span>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
||||
<!-- Started -->
|
||||
<ng-container *ngIf="course.progress.currentStep > 0">
|
||||
<span>Continue</span>
|
||||
</ng-container>
|
||||
|
||||
<mat-icon
|
||||
class="ml-1.5 icon-size-5"
|
||||
[svgIcon]="'heroicons_solid:arrow-sm-right'"></mat-icon>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<!-- No courses -->
|
||||
<ng-template #noCourses>
|
||||
<div class="flex flex-auto flex-col items-center justify-center bg-gray-100 dark:bg-transparent">
|
||||
<mat-icon
|
||||
class="icon-size-20"
|
||||
[svgIcon]="'iconsmind:file_search'"></mat-icon>
|
||||
<div class="mt-6 text-2xl font-semibold tracking-tight text-secondary">No courses found!</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -1,159 +0,0 @@
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatSelectChange } from '@angular/material/select';
|
||||
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
|
||||
import { BehaviorSubject, combineLatest, Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { AcademyService } from 'app/modules/admin/apps/academy/academy.service';
|
||||
import { Category, Course } from 'app/modules/admin/apps/academy/academy.types';
|
||||
|
||||
@Component({
|
||||
selector : 'academy-list',
|
||||
templateUrl : './list.component.html',
|
||||
encapsulation : ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class AcademyListComponent implements OnInit, OnDestroy
|
||||
{
|
||||
categories: Category[];
|
||||
courses: Course[];
|
||||
filteredCourses: Course[];
|
||||
filters: {
|
||||
categorySlug$: BehaviorSubject<string>;
|
||||
query$: BehaviorSubject<string>;
|
||||
hideCompleted$: BehaviorSubject<boolean>;
|
||||
} = {
|
||||
categorySlug$ : new BehaviorSubject('all'),
|
||||
query$ : new BehaviorSubject(''),
|
||||
hideCompleted$: new BehaviorSubject(false)
|
||||
};
|
||||
|
||||
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(
|
||||
private _activatedRoute: ActivatedRoute,
|
||||
private _changeDetectorRef: ChangeDetectorRef,
|
||||
private _router: Router,
|
||||
private _academyService: AcademyService
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Lifecycle hooks
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* On init
|
||||
*/
|
||||
ngOnInit(): void
|
||||
{
|
||||
// Get the categories
|
||||
this._academyService.categories$
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe((categories: Category[]) => {
|
||||
this.categories = categories;
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Get the courses
|
||||
this._academyService.courses$
|
||||
.pipe(takeUntil(this._unsubscribeAll))
|
||||
.subscribe((courses: Course[]) => {
|
||||
this.courses = this.filteredCourses = courses;
|
||||
|
||||
// Mark for check
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
|
||||
// Filter the courses
|
||||
combineLatest([this.filters.categorySlug$, this.filters.query$, this.filters.hideCompleted$])
|
||||
.subscribe(([categorySlug, query, hideCompleted]) => {
|
||||
|
||||
// Reset the filtered courses
|
||||
this.filteredCourses = this.courses;
|
||||
|
||||
// Filter by category
|
||||
if ( categorySlug !== 'all' )
|
||||
{
|
||||
this.filteredCourses = this.filteredCourses.filter((course) => course.category === categorySlug);
|
||||
}
|
||||
|
||||
// Filter by search query
|
||||
if ( query !== '' )
|
||||
{
|
||||
this.filteredCourses = this.filteredCourses.filter((course) => {
|
||||
return course.title.toLowerCase().includes(query.toLowerCase())
|
||||
|| course.description.toLowerCase().includes(query.toLowerCase())
|
||||
|| course.category.toLowerCase().includes(query.toLowerCase());
|
||||
});
|
||||
}
|
||||
|
||||
// Filter by completed
|
||||
if ( hideCompleted )
|
||||
{
|
||||
this.filteredCourses = this.filteredCourses.filter((course) => course.progress.completed === 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* On destroy
|
||||
*/
|
||||
ngOnDestroy(): void
|
||||
{
|
||||
// Unsubscribe from all subscriptions
|
||||
this._unsubscribeAll.next();
|
||||
this._unsubscribeAll.complete();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Filter by search query
|
||||
*
|
||||
* @param query
|
||||
*/
|
||||
filterByQuery(query: string): void
|
||||
{
|
||||
this.filters.query$.next(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by category
|
||||
*
|
||||
* @param change
|
||||
*/
|
||||
filterByCategory(change: MatSelectChange): void
|
||||
{
|
||||
this.filters.categorySlug$.next(change.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show/hide completed courses
|
||||
*
|
||||
* @param change
|
||||
*/
|
||||
toggleCompleted(change: MatSlideToggleChange): void
|
||||
{
|
||||
this.filters.hideCompleted$.next(change.checked);
|
||||
}
|
||||
|
||||
/**
|
||||
* Track by function for ngFor loops
|
||||
*
|
||||
* @param index
|
||||
* @param item
|
||||
*/
|
||||
trackByFn(index: number, item: any): any
|
||||
{
|
||||
return item.id || index;
|
||||
}
|
||||
}
|
||||
@@ -1,386 +0,0 @@
|
||||
<div class="absolute inset-0 flex flex-col min-w-0 overflow-hidden dark:bg-gray-900">
|
||||
|
||||
<mat-drawer-container class="flex-auto h-full bg-transparent">
|
||||
|
||||
<!-- Drawer -->
|
||||
<mat-drawer
|
||||
class="w-60 dark:bg-gray-900"
|
||||
[autoFocus]="false"
|
||||
[mode]="drawerMode"
|
||||
[opened]="drawerOpened"
|
||||
#drawer>
|
||||
<calendar-sidebar (calendarUpdated)="onCalendarUpdated($event)"></calendar-sidebar>
|
||||
</mat-drawer>
|
||||
|
||||
<mat-drawer-content class="flex">
|
||||
|
||||
<!-- Main -->
|
||||
<div class="flex flex-col flex-auto">
|
||||
|
||||
<!-- Header -->
|
||||
<div class="flex flex-0 flex-wrap items-center p-4 border-b bg-card">
|
||||
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="toggleDrawer()">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:menu'"></mat-icon>
|
||||
</button>
|
||||
|
||||
<div class="ml-4 text-2xl font-semibold tracking-tight whitespace-nowrap">
|
||||
{{viewTitle}}
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="ml-5"
|
||||
mat-icon-button
|
||||
(click)="previous()">
|
||||
<mat-icon
|
||||
class="icon-size-5"
|
||||
[svgIcon]="'heroicons_solid:chevron-left'"></mat-icon>
|
||||
</button>
|
||||
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="next()">
|
||||
<mat-icon
|
||||
class="icon-size-5"
|
||||
[svgIcon]="'heroicons_solid:chevron-right'"></mat-icon>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="hidden md:inline-flex"
|
||||
mat-icon-button
|
||||
(click)="today()">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:calendar'"></mat-icon>
|
||||
</button>
|
||||
|
||||
<div class="hidden md:block ml-auto">
|
||||
<mat-form-field class="fuse-mat-dense fuse-mat-no-subscript w-30 ml-2">
|
||||
<mat-select
|
||||
(selectionChange)="changeView(viewChanger.value)"
|
||||
[value]="view"
|
||||
#viewChanger="matSelect">
|
||||
<mat-option [value]="'dayGridMonth'">Month</mat-option>
|
||||
<mat-option [value]="'timeGridWeek'">Week</mat-option>
|
||||
<mat-option [value]="'timeGridDay'">Day</mat-option>
|
||||
<mat-option [value]="'listYear'">Schedule</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<!-- Mobile menu -->
|
||||
<div class="md:hidden ml-auto">
|
||||
<button
|
||||
class=""
|
||||
[matMenuTriggerFor]="actionsMenu"
|
||||
mat-icon-button>
|
||||
<mat-icon [svgIcon]="'heroicons_outline:dots-vertical'"></mat-icon>
|
||||
|
||||
<mat-menu #actionsMenu="matMenu">
|
||||
<button
|
||||
mat-menu-item
|
||||
(click)="today()">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:calendar'"></mat-icon>
|
||||
<span>Go to today</span>
|
||||
</button>
|
||||
<button
|
||||
[matMenuTriggerFor]="actionsViewsMenu"
|
||||
mat-menu-item>
|
||||
<mat-icon [svgIcon]="'heroicons_outline:view-grid'"></mat-icon>
|
||||
<span>View</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
|
||||
<mat-menu #actionsViewsMenu="matMenu">
|
||||
<button
|
||||
mat-menu-item
|
||||
[disabled]="view === 'dayGridMonth'"
|
||||
(click)="changeView('dayGridMonth')">
|
||||
<span>Month</span>
|
||||
</button>
|
||||
<button
|
||||
mat-menu-item
|
||||
[disabled]="view === 'timeGridWeek'"
|
||||
(click)="changeView('timeGridWeek')">
|
||||
<span>Week</span>
|
||||
</button>
|
||||
<button
|
||||
mat-menu-item
|
||||
[disabled]="view === 'timeGridDay'"
|
||||
(click)="changeView('timeGridDay')">
|
||||
<span>Day</span>
|
||||
</button>
|
||||
<button
|
||||
mat-menu-item
|
||||
[disabled]="view === 'listYear'"
|
||||
(click)="changeView('listYear')">
|
||||
<span>Schedule</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- FullCalendar -->
|
||||
<div class="flex flex-col flex-auto">
|
||||
<full-calendar
|
||||
[defaultView]="view"
|
||||
[events]="events"
|
||||
[firstDay]="settings.startWeekOn"
|
||||
[handleWindowResize]="false"
|
||||
[header]="false"
|
||||
[height]="'parent'"
|
||||
[plugins]="calendarPlugins"
|
||||
[views]="views"
|
||||
(dateClick)="onDateClick($event)"
|
||||
(eventClick)="onEventClick($event)"
|
||||
(eventRender)="onEventRender($event)"
|
||||
#fullCalendar></full-calendar>
|
||||
</div>
|
||||
|
||||
<!-- Event panel -->
|
||||
<ng-template #eventPanel>
|
||||
|
||||
<!-- Preview mode -->
|
||||
<ng-container *ngIf="panelMode === 'view'">
|
||||
<div class="flex-auto p-8">
|
||||
<!-- Info -->
|
||||
<div class="flex">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:information-circle'"></mat-icon>
|
||||
<div class="flex flex-auto justify-between ml-6">
|
||||
<!-- Info -->
|
||||
<div>
|
||||
<div class="text-3xl font-semibold tracking-tight leading-none">{{event.title || '(No title)'}}</div>
|
||||
<div class="mt-0.5 text-secondary">{{event.start | date:'EEEE, MMMM d'}}</div>
|
||||
<div class="text-secondary">{{recurrenceStatus}}</div>
|
||||
</div>
|
||||
<!-- Actions -->
|
||||
<div class="flex -mt-2 -mr-2 ml-10">
|
||||
|
||||
<!-- Non-recurring event -->
|
||||
<ng-container *ngIf="!event.recurrence">
|
||||
<!-- Edit -->
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="changeEventPanelMode('edit', 'single')">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:pencil-alt'"></mat-icon>
|
||||
</button>
|
||||
<!-- Delete -->
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="deleteEvent(event)">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:trash'"></mat-icon>
|
||||
</button>
|
||||
</ng-container>
|
||||
|
||||
<!-- Recurring event -->
|
||||
<ng-container *ngIf="event.recurrence">
|
||||
<!-- Edit -->
|
||||
<button
|
||||
mat-icon-button
|
||||
[matMenuTriggerFor]="editMenu">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:pencil-alt'"></mat-icon>
|
||||
</button>
|
||||
<mat-menu #editMenu="matMenu">
|
||||
<button
|
||||
mat-menu-item
|
||||
(click)="changeEventPanelMode('edit', 'single')">
|
||||
This event
|
||||
</button>
|
||||
<button
|
||||
mat-menu-item
|
||||
*ngIf="!event.isFirstInstance"
|
||||
(click)="changeEventPanelMode('edit', 'future')">
|
||||
This and following events
|
||||
</button>
|
||||
<button
|
||||
mat-menu-item
|
||||
(click)="changeEventPanelMode('edit', 'all')">
|
||||
All events
|
||||
</button>
|
||||
</mat-menu>
|
||||
<!-- Delete -->
|
||||
<button
|
||||
mat-icon-button
|
||||
[matMenuTriggerFor]="deleteMenu">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:trash'"></mat-icon>
|
||||
</button>
|
||||
<mat-menu #deleteMenu="matMenu">
|
||||
<button
|
||||
mat-menu-item
|
||||
(click)="deleteEvent(event, 'single')">
|
||||
This event
|
||||
</button>
|
||||
<button
|
||||
mat-menu-item
|
||||
*ngIf="!event.isFirstInstance"
|
||||
(click)="deleteEvent(event, 'future')">
|
||||
This and following events
|
||||
</button>
|
||||
<button
|
||||
mat-menu-item
|
||||
(click)="deleteEvent(event, 'all')">
|
||||
All events
|
||||
</button>
|
||||
</mat-menu>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Description -->
|
||||
<div
|
||||
class="flex mt-6"
|
||||
*ngIf="event.description">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:menu-alt-2'"></mat-icon>
|
||||
<div class="flex-auto ml-6">{{event.description}}</div>
|
||||
</div>
|
||||
|
||||
<!-- Calendar -->
|
||||
<div class="flex mt-6">
|
||||
<mat-icon [svgIcon]="'heroicons_outline:calendar'"></mat-icon>
|
||||
<div class="flex flex-auto items-center ml-6">
|
||||
<div
|
||||
class="w-2 h-2 rounded-full"
|
||||
[ngClass]="getCalendar(event.calendarId).color"></div>
|
||||
<div class="ml-3 leading-none">{{getCalendar(event.calendarId).title}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<!-- Add / Edit mode -->
|
||||
<ng-container *ngIf="panelMode === 'add' || panelMode === 'edit'">
|
||||
<form
|
||||
class="flex flex-col w-full p-6 pt-8 sm:pt-10 sm:pr-8"
|
||||
[formGroup]="eventForm">
|
||||
|
||||
<!-- Title -->
|
||||
<div class="flex items-center">
|
||||
<mat-icon
|
||||
class="hidden sm:inline-flex mr-6"
|
||||
[svgIcon]="'heroicons_outline:pencil-alt'"></mat-icon>
|
||||
<mat-form-field class="fuse-mat-no-subscript flex-auto">
|
||||
<input
|
||||
matInput
|
||||
[formControlName]="'title'"
|
||||
[placeholder]="'Event title'">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<!-- Dates -->
|
||||
<div class="flex items-start mt-6">
|
||||
<mat-icon
|
||||
class="hidden sm:inline-flex mt-3 mr-6"
|
||||
[svgIcon]="'heroicons_outline:calendar'"></mat-icon>
|
||||
<div class="flex-auto">
|
||||
<fuse-date-range
|
||||
[formControlName]="'range'"
|
||||
[dateFormat]="settings.dateFormat"
|
||||
[timeRange]="!eventForm.get('allDay').value"
|
||||
[timeFormat]="settings.timeFormat"></fuse-date-range>
|
||||
<mat-checkbox
|
||||
class="mt-4"
|
||||
[color]="'primary'"
|
||||
[formControlName]="'allDay'">
|
||||
All day
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Recurrence -->
|
||||
<div
|
||||
class="flex items-center mt-6"
|
||||
*ngIf="!event.recurrence || eventEditMode !== 'single'">
|
||||
<mat-icon
|
||||
class="hidden sm:inline-flex mr-6 transform -scale-x-1"
|
||||
[svgIcon]="'heroicons_outline:refresh'"></mat-icon>
|
||||
<div
|
||||
class="flex flex-auto items-center h-12 px-4 rounded-md border cursor-pointer shadow-sm border-gray-300 dark:bg-black dark:bg-opacity-5 dark:border-gray-500"
|
||||
(click)="openRecurrenceDialog()">
|
||||
<div class="flex-auto">
|
||||
{{recurrenceStatus || 'Does not repeat'}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Calendar -->
|
||||
<div class="flex items-center mt-6">
|
||||
<mat-icon
|
||||
class="hidden sm:inline-flex mr-6"
|
||||
[svgIcon]="'heroicons_outline:tag'"></mat-icon>
|
||||
<mat-form-field class="fuse-mat-no-subscript flex-auto">
|
||||
<mat-select
|
||||
[formControlName]="'calendarId'"
|
||||
(change)="$event.stopImmediatePropagation()">
|
||||
<mat-select-trigger class="inline-flex items-center leading-none">
|
||||
<span
|
||||
class="w-3 h-3 rounded-full"
|
||||
[ngClass]="getCalendar(eventForm.get('calendarId').value)?.color"></span>
|
||||
<span class="ml-3">{{getCalendar(eventForm.get('calendarId').value)?.title}}</span>
|
||||
</mat-select-trigger>
|
||||
<mat-option
|
||||
*ngFor="let calendar of calendars"
|
||||
[value]="calendar.id">
|
||||
<div class="inline-flex items-center">
|
||||
<span
|
||||
class="w-3 h-3 rounded-full"
|
||||
[ngClass]="calendar.color"></span>
|
||||
<span class="ml-3">{{calendar.title}}</span>
|
||||
</div>
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<!-- Description -->
|
||||
<div class="flex items-start mt-6">
|
||||
<mat-icon
|
||||
class="hidden sm:inline-flex mr-6 mt-3"
|
||||
[svgIcon]="'heroicons_outline:menu-alt-2'"></mat-icon>
|
||||
<mat-form-field class="fuse-mat-textarea fuse-mat-no-subscript flex-auto">
|
||||
<textarea
|
||||
matInput
|
||||
cdkTextareaAutosize
|
||||
[cdkAutosizeMinRows]="1"
|
||||
[formControlName]="'description'"
|
||||
[placeholder]="'Event description'">
|
||||
</textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="ml-auto mt-6">
|
||||
<button
|
||||
class="add"
|
||||
*ngIf="panelMode === 'add'"
|
||||
mat-flat-button
|
||||
type="button"
|
||||
[color]="'primary'"
|
||||
(click)="addEvent()">
|
||||
Add
|
||||
</button>
|
||||
<button
|
||||
class="save"
|
||||
*ngIf="panelMode === 'edit'"
|
||||
mat-flat-button
|
||||
type="button"
|
||||
[color]="'primary'"
|
||||
(click)="updateEvent()">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</ng-container>
|
||||
|
||||
</ng-template>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-drawer-content>
|
||||
|
||||
</mat-drawer-container>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
calendar {
|
||||
|
||||
/* Tweak: FullCalendar CSS only height to improve resize performance */
|
||||
/* With this tweak, we can disable "handleWindowResize" option of FullCalendar */
|
||||
/* which disables the height calculations on window resize and increases the */
|
||||
/* overall performance. */
|
||||
/* This tweak only affects the Calendar app's FullCalendar. */
|
||||
full-calendar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 0 auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.fc-view-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 0 auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.fc-view {
|
||||
|
||||
/* Day grid - Month view */
|
||||
/* Time grid - Week view */
|
||||
/* Time grid - Day view */
|
||||
&.fc-dayGridMonth-view,
|
||||
&.fc-timeGridWeek-view,
|
||||
&.fc-timeGridDay-view {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 0 auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
> table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 0 auto;
|
||||
height: 100%;
|
||||
|
||||
> thead {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
> tbody {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
overflow: hidden;
|
||||
|
||||
> tr {
|
||||
display: flex;
|
||||
|
||||
> td {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.fc-scroller {
|
||||
flex: 1 1 auto;
|
||||
overflow: hidden scroll !important;
|
||||
height: auto !important;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Day grid - Month view */
|
||||
&.fc-dayGridMonth-view {
|
||||
|
||||
> table {
|
||||
|
||||
> tbody {
|
||||
|
||||
> tr {
|
||||
|
||||
> td {
|
||||
|
||||
.fc-scroller {
|
||||
display: flex;
|
||||
|
||||
> .fc-day-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 580px;
|
||||
|
||||
> .fc-row {
|
||||
flex: 1 0 0;
|
||||
height: auto !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* List - Year view */
|
||||
&.fc-listYear-view {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.fc-scroller {
|
||||
width: 100%;
|
||||
height: 100% !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Event panel */
|
||||
.calendar-event-panel {
|
||||
border-radius: 8px;
|
||||
@apply shadow-2xl bg-card;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user