mirror of
https://github.com/valitydev/dashboard.git
synced 2024-11-06 02:25:23 +00:00
Add sections module (#17)
This commit is contained in:
parent
18b96140f6
commit
a4293a7646
6
.gitignore
vendored
6
.gitignore
vendored
@ -45,7 +45,7 @@ Thumbs.db
|
|||||||
|
|
||||||
# Swagger Codegen
|
# Swagger Codegen
|
||||||
swagger-codegen-cli.jar
|
swagger-codegen-cli.jar
|
||||||
src/app/api/**/swagger-codegen
|
src/app/**/swagger-codegen
|
||||||
|
|
||||||
# Kontur.Focus Model
|
# Generated models
|
||||||
src/app/kontur-focus/**/gen-model
|
src/app/**/gen-model
|
||||||
|
@ -4,7 +4,6 @@ node_modules
|
|||||||
dist
|
dist
|
||||||
build_utils
|
build_utils
|
||||||
coverage
|
coverage
|
||||||
src/app/api/**/swagger-codegen
|
|
||||||
schemes
|
schemes
|
||||||
|
src/app/**/swagger-codegen
|
||||||
src/app/**/gen-model
|
src/app/**/gen-model
|
||||||
|
|
||||||
|
1975
package-lock.json
generated
1975
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
72
package.json
72
package.json
@ -6,26 +6,28 @@
|
|||||||
"start": "ng serve --port 8000",
|
"start": "ng serve --port 8000",
|
||||||
"build": "ng build --prod --extraWebpackConfig webpack.extra.js",
|
"build": "ng build --prod --extraWebpackConfig webpack.extra.js",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
|
"test-silent": "ng test --watch=false --browsers ChromeHeadless",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e",
|
"e2e": "ng e2e",
|
||||||
"prettier": "prettier \"**/*.{html,js,ts,css,md,json,prettierrc,svg}\" --write",
|
"prettier": "prettier \"**/*.{html,js,ts,css,scss,md,json,prettierrc,svg}\"",
|
||||||
"check": "prettier \"**/*.{html,js,ts,css,md,json,prettierrc,svg}\" --list-different",
|
"prettify": "npm run prettier -- --write",
|
||||||
|
"check": "npm run prettier -- --list-different",
|
||||||
"quicktype": "quicktype -s schema --just-types"
|
"quicktype": "quicktype -s schema --just-types"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "~7.1.0",
|
"@angular/animations": "~7.2.14",
|
||||||
"@angular/cdk": "~7.1.0",
|
"@angular/cdk": "~7.3.7",
|
||||||
"@angular/common": "~7.1.0",
|
"@angular/common": "~7.2.14",
|
||||||
"@angular/compiler": "~7.1.0",
|
"@angular/compiler": "~7.2.14",
|
||||||
"@angular/core": "~7.1.0",
|
"@angular/core": "~7.2.14",
|
||||||
"@angular/flex-layout": "^7.0.0-beta.19",
|
"@angular/flex-layout": "^7.0.0-beta.24",
|
||||||
"@angular/forms": "~7.1.0",
|
"@angular/forms": "~7.2.14",
|
||||||
"@angular/material": "~7.1.0",
|
"@angular/material": "~7.3.7",
|
||||||
"@angular/material-moment-adapter": "~7.1.0",
|
"@angular/material-moment-adapter": "~7.3.7",
|
||||||
"@angular/platform-browser": "~7.1.0",
|
"@angular/platform-browser": "~7.2.14",
|
||||||
"@angular/platform-browser-dynamic": "~7.1.0",
|
"@angular/platform-browser-dynamic": "~7.2.14",
|
||||||
"@angular/router": "~7.1.0",
|
"@angular/router": "~7.2.14",
|
||||||
"core-js": "^2.5.4",
|
"core-js": "^2.5.4",
|
||||||
"d3-axis": "^1.0.12",
|
"d3-axis": "^1.0.12",
|
||||||
"d3-scale": "^2.1.2",
|
"d3-scale": "^2.1.2",
|
||||||
@ -34,39 +36,39 @@
|
|||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
"keycloak-angular": "^6.1.0",
|
"keycloak-angular": "^6.1.0",
|
||||||
"lodash.get": "^4.4.2",
|
"lodash.get": "^4.4.2",
|
||||||
"moment": "^2.22.2",
|
"moment": "^2.24.0",
|
||||||
"pdfmake": "^0.1.54",
|
"pdfmake": "^0.1.56",
|
||||||
"rxjs": "~6.3.3",
|
"rxjs": "~6.5.1",
|
||||||
"ts-keycode-enum": "^1.0.6",
|
"ts-keycode-enum": "^1.0.6",
|
||||||
"tslib": "^1.9.0",
|
"tslib": "^1.9.0",
|
||||||
"zone.js": "~0.8.26"
|
"zone.js": "~0.8.26"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "~0.11.0",
|
"@angular-devkit/build-angular": "~0.13.8",
|
||||||
"@angular/cli": "~7.1.0",
|
"@angular/cli": "~7.3.8",
|
||||||
"@angular/compiler-cli": "~7.1.0",
|
"@angular/compiler-cli": "~7.2.14",
|
||||||
"@angular/language-service": "~7.1.0",
|
"@angular/language-service": "~7.2.14",
|
||||||
"@types/d3": "^5.7.0",
|
"@types/d3": "^5.7.0",
|
||||||
"@types/jasmine": "~2.8.8",
|
"@types/jasmine": "~3.3.12",
|
||||||
"@types/jasminewd2": "~2.0.3",
|
"@types/jasminewd2": "~2.0.6",
|
||||||
"@types/lodash.get": "^4.4.6",
|
"@types/lodash.get": "^4.4.6",
|
||||||
"@types/moment": "^2.13.0",
|
"@types/moment": "^2.13.0",
|
||||||
"@types/node": "~8.9.4",
|
"@types/node": "^11.13.10",
|
||||||
"@types/pdfmake": "^0.1.3",
|
"@types/pdfmake": "^0.1.5",
|
||||||
"codelyzer": "~4.5.0",
|
"codelyzer": "~4.5.0",
|
||||||
"jasmine-core": "~2.99.1",
|
"jasmine-core": "~3.4.0",
|
||||||
"jasmine-spec-reporter": "~4.2.1",
|
"jasmine-spec-reporter": "~4.2.1",
|
||||||
"karma": "~3.1.1",
|
"karma": "~4.1.0",
|
||||||
"karma-chrome-launcher": "~2.2.0",
|
"karma-chrome-launcher": "~2.2.0",
|
||||||
"karma-coverage-istanbul-reporter": "~2.0.1",
|
"karma-coverage-istanbul-reporter": "~2.0.5",
|
||||||
"karma-jasmine": "~1.1.2",
|
"karma-jasmine": "~2.0.1",
|
||||||
"karma-jasmine-html-reporter": "^0.2.2",
|
"karma-jasmine-html-reporter": "^1.4.2",
|
||||||
"ngx-build-plus": "^7.2.3",
|
"ngx-build-plus": "^7.2.3",
|
||||||
"prettier": "~1.15.2",
|
"prettier": "~1.17.0",
|
||||||
"protractor": "~5.4.0",
|
"protractor": "~5.4.2",
|
||||||
"quicktype": "^15.0.184",
|
"quicktype": "^15.0.187",
|
||||||
"ts-node": "~7.0.0",
|
"ts-node": "~7.0.0",
|
||||||
"tslint": "~5.11.0",
|
"tslint": "~5.16.0",
|
||||||
"typescript": "~3.1.6"
|
"typescript": "~3.2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Component, ViewChild } from '@angular/core';
|
import { Component, ViewChild } from '@angular/core';
|
||||||
|
|
||||||
import { DropdownTriggerDirective } from '../dropdown/dropdown-trigger.directive';
|
import { DropdownTriggerDirective } from '../dropdown/dropdown-trigger.directive';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
@import '../../styles/variables.scss';
|
|
||||||
@import '../../styles/mixins.scss';
|
|
||||||
|
|
||||||
.container {
|
|
||||||
@include fullscreen();
|
|
||||||
background-color: $background-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
@include content($content-padding, $content-max-width);
|
|
||||||
}
|
|
@ -3,36 +3,18 @@ import { NgModule, APP_INITIALIZER } from '@angular/core';
|
|||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { KeycloakService } from './auth/keycloak-stub';
|
import { KeycloakService } from './auth/keycloak-stub';
|
||||||
|
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { MainModule } from './main';
|
|
||||||
import { PartyMngModule } from './party-mgt';
|
|
||||||
import { DetailsModule } from './details';
|
|
||||||
import { PageNotFoundModule } from './page-not-found';
|
|
||||||
import { IconRegistryService } from './icon-registry.service';
|
import { IconRegistryService } from './icon-registry.service';
|
||||||
import { AnalyticsModule } from './analytics/analytics.module';
|
|
||||||
import { AuthModule } from './auth';
|
import { AuthModule } from './auth';
|
||||||
import { initializer } from './initializer';
|
import { initializer } from './initializer';
|
||||||
import { TableModule } from './table';
|
|
||||||
import { APIModule } from './api/api.module';
|
import { APIModule } from './api/api.module';
|
||||||
import { ConfigService } from './config/config.service';
|
import { ConfigService } from './config/config.service';
|
||||||
|
import { SectionsModule } from './sections/sections.module';
|
||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [AppComponent],
|
declarations: [AppComponent],
|
||||||
imports: [
|
imports: [BrowserModule, BrowserAnimationsModule, RouterModule, SectionsModule, APIModule, AuthModule],
|
||||||
BrowserModule,
|
|
||||||
BrowserAnimationsModule,
|
|
||||||
AppRoutingModule,
|
|
||||||
MainModule,
|
|
||||||
PartyMngModule,
|
|
||||||
AnalyticsModule,
|
|
||||||
DetailsModule,
|
|
||||||
PageNotFoundModule,
|
|
||||||
TableModule,
|
|
||||||
PageNotFoundModule,
|
|
||||||
APIModule,
|
|
||||||
AuthModule
|
|
||||||
],
|
|
||||||
providers: [
|
providers: [
|
||||||
IconRegistryService,
|
IconRegistryService,
|
||||||
ConfigService,
|
ConfigService,
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
$background: map-get($theme, background);
|
$background: map-get($theme, background);
|
||||||
$foreground: map-get($theme, foreground);
|
$foreground: map-get($theme, foreground);
|
||||||
|
|
||||||
.x.axis > .tick:first-of-type > text, .x.axis > .tick:last-of-type > text, .tick > line {
|
.x.axis > .tick:first-of-type > text,
|
||||||
|
.x.axis > .tick:last-of-type > text,
|
||||||
|
.tick > line {
|
||||||
color: mat-color($foreground, divider);
|
color: mat-color($foreground, divider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
@import '../../../styles/variables';
|
@import '../../../styles/variables';
|
||||||
|
|
||||||
.y.axis > path, .x.axis > path {
|
.y.axis > path,
|
||||||
|
.x.axis > path {
|
||||||
color: transparent;
|
color: transparent;
|
||||||
}
|
}
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
@import '~@angular/material/theming';
|
|
||||||
|
|
||||||
@mixin dsh-table-theme($theme) {
|
|
||||||
$background: map-get($theme, background);
|
|
||||||
$foreground: map-get($theme, foreground);
|
|
||||||
|
|
||||||
.dsh {
|
|
||||||
&-table {
|
|
||||||
background: mat-color($background, card);
|
|
||||||
|
|
||||||
& thead, & tbody, & tfoot,
|
|
||||||
mat-header-row, mat-row, mat-footer-row,
|
|
||||||
[dsh-header-row], [dsh-row], [dsh-footer-row],
|
|
||||||
.dsh-table-sticky {
|
|
||||||
background: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
& thead {
|
|
||||||
background: mat-color($background, background);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-header-cell {
|
|
||||||
color: mat-color($foreground, secondary-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
&-cell, &-footer-cell {
|
|
||||||
color: mat-color($foreground, text);
|
|
||||||
}
|
|
||||||
|
|
||||||
&-row, &-header-row, &-footer-row {
|
|
||||||
border-bottom-color: mat-color($foreground, divider);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin dsh-table-typography($config) {
|
|
||||||
.dsh {
|
|
||||||
&-table {
|
|
||||||
font-family: mat-font-family($config);
|
|
||||||
}
|
|
||||||
|
|
||||||
&-header-cell {
|
|
||||||
font-size: mat-font-size($config, caption);
|
|
||||||
font-weight: mat-font-weight($config, body-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
&-cell, &-footer-cell {
|
|
||||||
font-size: mat-font-size($config, body-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
export * from './public-api';
|
|
@ -1,46 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { DshTableComponent } from './table';
|
|
||||||
import { CdkTableModule } from '@angular/cdk/table';
|
|
||||||
import {
|
|
||||||
DshCellDefDirective,
|
|
||||||
DshCellDirective,
|
|
||||||
DshColumnDefDirective,
|
|
||||||
DshFooterCellDefDirective,
|
|
||||||
DshFooterCellDirective,
|
|
||||||
DshHeaderCellDefDirective,
|
|
||||||
DshHeaderCellDirective
|
|
||||||
} from './cell';
|
|
||||||
import {
|
|
||||||
DshFooterRowComponent,
|
|
||||||
DshFooterRowDefDirective,
|
|
||||||
DshHeaderRowComponent,
|
|
||||||
DshHeaderRowDefDirective,
|
|
||||||
DshRowComponent,
|
|
||||||
DshRowDefDirective
|
|
||||||
} from './row';
|
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { MatTableModule } from '@angular/material';
|
|
||||||
|
|
||||||
const EXPORTED_DECLARATIONS = [
|
|
||||||
DshTableComponent,
|
|
||||||
DshHeaderCellDefDirective,
|
|
||||||
DshHeaderRowDefDirective,
|
|
||||||
DshColumnDefDirective,
|
|
||||||
DshCellDefDirective,
|
|
||||||
DshRowDefDirective,
|
|
||||||
DshFooterCellDefDirective,
|
|
||||||
DshFooterRowDefDirective,
|
|
||||||
DshHeaderCellDirective,
|
|
||||||
DshCellDirective,
|
|
||||||
DshFooterCellDirective,
|
|
||||||
DshHeaderRowComponent,
|
|
||||||
DshRowComponent,
|
|
||||||
DshFooterRowComponent
|
|
||||||
];
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [CdkTableModule, CommonModule, MatTableModule],
|
|
||||||
exports: EXPORTED_DECLARATIONS,
|
|
||||||
declarations: EXPORTED_DECLARATIONS
|
|
||||||
})
|
|
||||||
export class DshTableModule {}
|
|
@ -1,94 +0,0 @@
|
|||||||
@import '../../../styles/variables';
|
|
||||||
|
|
||||||
$dsh-header-row-height: 56px;
|
|
||||||
$dsh-row-height: 48px;
|
|
||||||
$dsh-row-horizontal-padding: 24px;
|
|
||||||
|
|
||||||
.dsh {
|
|
||||||
&-table {
|
|
||||||
display: block;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 0;
|
|
||||||
border-spacing: 0;
|
|
||||||
|
|
||||||
thead,
|
|
||||||
tbody,
|
|
||||||
tfoot {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
thead {
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-header-row {
|
|
||||||
min-height: $dsh-header-row-height;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-row, &-footer-row {
|
|
||||||
min-height: $dsh-row-height;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-row, &-header-row, &-footer-row {
|
|
||||||
display: flex;
|
|
||||||
border-width: 0;
|
|
||||||
align-items: center;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
display: inline-block;
|
|
||||||
min-height: inherit;
|
|
||||||
content: '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-row, &-footer-row {
|
|
||||||
border-bottom-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-cell:first-of-type, &-header-cell:first-of-type, &-footer-cell:first-of-type {
|
|
||||||
padding-left: $dsh-row-horizontal-padding;
|
|
||||||
|
|
||||||
[dir='rtl'] & {
|
|
||||||
padding-left: 0;
|
|
||||||
padding-right: $dsh-row-horizontal-padding;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-cell:last-of-type, &-header-cell:last-of-type, &-footer-cell:last-of-type {
|
|
||||||
padding-right: $dsh-row-horizontal-padding;
|
|
||||||
|
|
||||||
[dir='rtl'] & {
|
|
||||||
padding-right: 0;
|
|
||||||
padding-left: $dsh-row-horizontal-padding;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-cell, &-header-cell, &-footer-cell {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
overflow: hidden;
|
|
||||||
word-wrap: break-word;
|
|
||||||
min-height: inherit;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-header-row {
|
|
||||||
height: $dsh-header-row-height;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-row, &-footer-row {
|
|
||||||
height: $dsh-row-height;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-header-cell {
|
|
||||||
text-align: left;
|
|
||||||
|
|
||||||
[dir='rtl'] & {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
19
src/app/config/config-stub.service.ts
Normal file
19
src/app/config/config-stub.service.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
import { config as appConfig } from './config-stub';
|
||||||
|
import { Config } from './config';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class ConfigStubService implements Config {
|
||||||
|
api: Config['api'];
|
||||||
|
daData: Config['daData'];
|
||||||
|
konturFocus: Config['konturFocus'];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
for (const [name, config] of Object.entries(appConfig)) {
|
||||||
|
this[name] = config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async init() {}
|
||||||
|
}
|
22
src/app/config/config-stub.ts
Normal file
22
src/app/config/config-stub.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { HttpTestingController } from '@angular/common/http/testing';
|
||||||
|
|
||||||
|
import { Config } from './config';
|
||||||
|
|
||||||
|
export const config: Config = {
|
||||||
|
api: {
|
||||||
|
capiEndpoint: 'http://localhost:8000'
|
||||||
|
},
|
||||||
|
daData: {
|
||||||
|
token: 'Token XXX',
|
||||||
|
suggestionsApiUrl: 'https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest'
|
||||||
|
},
|
||||||
|
konturFocus: {
|
||||||
|
apiV3Url: 'https://focus-api.kontur.ru/api3'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export function mockConfig(httpMock: HttpTestingController) {
|
||||||
|
const req = httpMock.expectOne('/assets/appConfig.json');
|
||||||
|
req.flush(config);
|
||||||
|
return req;
|
||||||
|
}
|
@ -1,9 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
type AppConfig = typeof import('../../assets/appConfig.json');
|
import { Config } from './config';
|
||||||
// tslint:disable-next-line:no-empty-interface
|
|
||||||
interface Config extends AppConfig {}
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ConfigService implements Config {
|
export class ConfigService implements Config {
|
||||||
|
29
src/app/config/config.spec.ts
Normal file
29
src/app/config/config.spec.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { TestBed, getTestBed } from '@angular/core/testing';
|
||||||
|
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||||
|
|
||||||
|
import { ConfigService } from './config.service.js';
|
||||||
|
import { mockConfig, config } from './config-stub.js';
|
||||||
|
|
||||||
|
describe('ConfigService', () => {
|
||||||
|
function createService() {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [HttpClientTestingModule],
|
||||||
|
providers: [ConfigService]
|
||||||
|
});
|
||||||
|
const injector = getTestBed();
|
||||||
|
const service: ConfigService = injector.get(ConfigService);
|
||||||
|
const httpMock: HttpTestingController = injector.get(HttpTestingController);
|
||||||
|
return { injector, service, httpMock };
|
||||||
|
}
|
||||||
|
|
||||||
|
it('should load config', () => {
|
||||||
|
const { service, httpMock } = createService();
|
||||||
|
service.init().then(() => {
|
||||||
|
for (const [k, v] of Object.entries(config)) {
|
||||||
|
expect(service[k]).toEqual(v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const req = mockConfig(httpMock);
|
||||||
|
expect(req.request.method).toBe('GET');
|
||||||
|
});
|
||||||
|
});
|
5
src/app/config/config.ts
Normal file
5
src/app/config/config.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
type AppConfig = typeof import('../../assets/appConfig.json');
|
||||||
|
|
||||||
|
// Interface is needed so that you can implement in the class
|
||||||
|
// tslint:disable-next-line:no-empty-interface
|
||||||
|
export interface Config extends AppConfig {}
|
@ -8,6 +8,8 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|||||||
import { DaDataModule } from './dadata.module';
|
import { DaDataModule } from './dadata.module';
|
||||||
import { DaDataService } from './dadata.service';
|
import { DaDataService } from './dadata.service';
|
||||||
import { SuggestionType } from './model/type';
|
import { SuggestionType } from './model/type';
|
||||||
|
import { ConfigService } from '../config/config.service';
|
||||||
|
import { ConfigStubService } from '../config/config-stub.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: `
|
template: `
|
||||||
@ -30,11 +32,6 @@ class SimpleDaDataAutocompleteComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('DshDadata', () => {
|
describe('DshDadata', () => {
|
||||||
const config = {
|
|
||||||
token: 'Token AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
||||||
suggestionsApiUrl: 'https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest'
|
|
||||||
};
|
|
||||||
|
|
||||||
const suggestions = {
|
const suggestions = {
|
||||||
suggestions: [
|
suggestions: [
|
||||||
{
|
{
|
||||||
@ -93,7 +90,7 @@ describe('DshDadata', () => {
|
|||||||
function createDaDataService() {
|
function createDaDataService() {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [HttpClientTestingModule],
|
imports: [HttpClientTestingModule],
|
||||||
providers: [DaDataService]
|
providers: [DaDataService, { provide: ConfigService, useClass: ConfigStubService }]
|
||||||
});
|
});
|
||||||
const injector = getTestBed();
|
const injector = getTestBed();
|
||||||
const service: DaDataService = injector.get(DaDataService);
|
const service: DaDataService = injector.get(DaDataService);
|
||||||
@ -109,17 +106,15 @@ describe('DshDadata', () => {
|
|||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [DaDataModule, MatFormFieldModule, ReactiveFormsModule, NoopAnimationsModule],
|
imports: [DaDataModule, MatFormFieldModule, ReactiveFormsModule, NoopAnimationsModule],
|
||||||
declarations: [component, ...declarations],
|
declarations: [component, ...declarations],
|
||||||
providers: [{ provide: ComponentFixtureAutoDetect, useValue: true }, ...providers]
|
providers: [
|
||||||
|
{ provide: ComponentFixtureAutoDetect, useValue: true },
|
||||||
|
{ provide: ConfigService, useClass: ConfigStubService },
|
||||||
|
...providers
|
||||||
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
return TestBed.createComponent<T>(component);
|
return TestBed.createComponent<T>(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mockConfig(httpMock: HttpTestingController) {
|
|
||||||
const req = httpMock.expectOne('/assets/dadata-config.json');
|
|
||||||
req.flush(config);
|
|
||||||
return req;
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('Component', () => {
|
describe('Component', () => {
|
||||||
it('should init value', () => {
|
it('should init value', () => {
|
||||||
const fixture = createComponent(SimpleDaDataAutocompleteComponent);
|
const fixture = createComponent(SimpleDaDataAutocompleteComponent);
|
||||||
@ -128,26 +123,14 @@ describe('DshDadata', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Service', () => {
|
describe('Service', () => {
|
||||||
it('should load config', () => {
|
|
||||||
const { service, httpMock } = createDaDataService();
|
|
||||||
service.config$.subscribe(c => {
|
|
||||||
expect(c).toEqual(config);
|
|
||||||
});
|
|
||||||
const req = mockConfig(httpMock);
|
|
||||||
expect(req.request.method).toBe('GET');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should load suggestions', () => {
|
it('should load suggestions', () => {
|
||||||
const { service, httpMock } = createDaDataService();
|
const { service, httpMock } = createDaDataService();
|
||||||
service.config$.subscribe(() => {
|
service.getSuggestions(SuggestionType.party, 'тест').subscribe(s => {
|
||||||
service.getSuggestions(SuggestionType.party, 'тест').subscribe(s => {
|
expect(s).toEqual(suggestions.suggestions as any);
|
||||||
expect(s).toEqual(suggestions.suggestions as any);
|
|
||||||
});
|
|
||||||
const req = httpMock.expectOne('https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/party');
|
|
||||||
req.flush(suggestions);
|
|
||||||
expect(req.request.method).toBe('POST');
|
|
||||||
});
|
});
|
||||||
mockConfig(httpMock);
|
const req = httpMock.expectOne('https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/party');
|
||||||
|
req.flush(suggestions);
|
||||||
|
expect(req.request.method).toBe('POST');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -112,12 +112,12 @@ export class DropdownTriggerDirective implements OnDestroy {
|
|||||||
}
|
}
|
||||||
]),
|
]),
|
||||||
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
||||||
width: this.dropdown.correctedWidth
|
width: this.dropdown.getCorrectedWidth()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private updatePosition = () => {
|
private updatePosition = () => {
|
||||||
this.overlayRef.updateSize({ width: this.dropdown.correctedWidth });
|
this.overlayRef.updateSize({ width: this.dropdown.getCorrectedWidth() });
|
||||||
this.dropdown.triangleLeftOffset = this.getTriangleLeftOffset();
|
this.dropdown.triangleLeftOffset = this.getTriangleLeftOffset();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@ export class DropdownComponent {
|
|||||||
triangleLeftOffset: string;
|
triangleLeftOffset: string;
|
||||||
animationDone$ = new Subject();
|
animationDone$ = new Subject();
|
||||||
|
|
||||||
get correctedWidth() {
|
getCorrectedWidth() {
|
||||||
if (this.width === '100%') {
|
if (this.width === '100%') {
|
||||||
return FULL_WIDTH;
|
return FULL_WIDTH;
|
||||||
}
|
}
|
||||||
if (!this.width || (typeof this.width === 'string' && this.width.slice(-1) === '%')) {
|
if (this.isAutoSize(this.width)) {
|
||||||
return this.width;
|
return this.width;
|
||||||
}
|
}
|
||||||
const widthPx: number = typeof this.width === 'string' ? parseFloat(this.width) : this.width;
|
const widthPx: number = typeof this.width === 'string' ? parseFloat(this.width) : this.width;
|
||||||
@ -38,4 +38,8 @@ export class DropdownComponent {
|
|||||||
}
|
}
|
||||||
return widthPx;
|
return widthPx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isAutoSize(size: string | number) {
|
||||||
|
return !size || (typeof size === 'string' && size.slice(-1) === '%');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,4 +3,4 @@
|
|||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: $card-header-margin;
|
margin-bottom: $card-header-margin;
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
background-color: $card-background-color;
|
background-color: $card-background-color;
|
||||||
padding: $card-padding;
|
padding: $card-padding;
|
||||||
border-radius: $card-border-radius;
|
border-radius: $card-border-radius;
|
||||||
box-shadow: $card-shadow
|
box-shadow: $card-shadow;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
@import '../../styles/variables.scss';
|
|
||||||
@import '../../styles/mixins.scss';
|
|
||||||
|
|
||||||
.content {
|
|
||||||
@include content($content-padding, $content-max-width);
|
|
||||||
}
|
|
11
src/app/sections/analytics/analytics.component.scss
Normal file
11
src/app/sections/analytics/analytics.component.scss
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
@import '../../../styles/variables.scss';
|
||||||
|
@import '../../../styles/mixins.scss';
|
||||||
|
|
||||||
|
.container {
|
||||||
|
@include fullscreen();
|
||||||
|
background-color: $background-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
@include content($content-padding, $content-max-width);
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { PeriodData, SegmentData } from '../charts/models/chart-data-models';
|
|
||||||
import { ChartsService } from '../charts/charts.service';
|
import { PeriodData, SegmentData } from '../../charts/models/chart-data-models';
|
||||||
|
import { ChartsService } from '../../charts/charts.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dsh-app-analytics',
|
selector: 'dsh-app-analytics',
|
@ -3,11 +3,11 @@ import { CommonModule } from '@angular/common';
|
|||||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||||
|
|
||||||
import { AnalyticsComponent } from './analytics.component';
|
import { AnalyticsComponent } from './analytics.component';
|
||||||
import { ToolbarModule } from '../toolbar';
|
import { ToolbarModule } from '../../toolbar';
|
||||||
import { BrandModule } from '../brand';
|
import { BrandModule } from '../../brand';
|
||||||
import { ActionbarModule } from '../actionbar';
|
import { ActionbarModule } from '../../actionbar';
|
||||||
import { LayoutModule } from '../layout';
|
import { LayoutModule } from '../../layout';
|
||||||
import { ChartsModule } from '../charts';
|
import { ChartsModule } from '../../charts';
|
||||||
import { AnalyticsService } from './analytics.service';
|
import { AnalyticsService } from './analytics.service';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
2
src/app/sections/analytics/index.ts
Normal file
2
src/app/sections/analytics/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './analytics.module';
|
||||||
|
export * from './analytics.component';
|
@ -1,5 +1,5 @@
|
|||||||
@import '../../styles/variables.scss';
|
@import '../../../styles/variables.scss';
|
||||||
@import '../../styles/mixins.scss';
|
@import '../../../styles/mixins.scss';
|
||||||
|
|
||||||
mat-sidenav-container {
|
mat-sidenav-container {
|
||||||
@include fullscreen();
|
@include fullscreen();
|
@ -1,6 +1,6 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { toolbarOffset } from '../layout-settings';
|
import { toolbarOffset } from '../../layout-settings';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dsh-details',
|
selector: 'dsh-details',
|
@ -3,9 +3,9 @@ import { MatSidenavModule } from '@angular/material/sidenav';
|
|||||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||||
|
|
||||||
import { DetailsComponent } from './details.component';
|
import { DetailsComponent } from './details.component';
|
||||||
import { BrandModule } from '../brand';
|
import { BrandModule } from '../../brand';
|
||||||
import { ToolbarModule } from '../toolbar';
|
import { ToolbarModule } from '../../toolbar';
|
||||||
import { ActionbarModule } from '../actionbar';
|
import { ActionbarModule } from '../../actionbar';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [DetailsComponent],
|
declarations: [DetailsComponent],
|
6
src/app/sections/main/main.component.scss
Normal file
6
src/app/sections/main/main.component.scss
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
@import '../../../styles/variables.scss';
|
||||||
|
@import '../../../styles/mixins.scss';
|
||||||
|
|
||||||
|
.content {
|
||||||
|
@include content($content-padding, $content-max-width);
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { DocumentService } from '../document/document.service';
|
import { DocumentService } from '../../document/document.service';
|
||||||
import { Family } from '../document/document-fonts-config';
|
import { Family } from '../../document/document-fonts-config';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dsh-main',
|
selector: 'dsh-main',
|
@ -2,10 +2,10 @@ import { NgModule } from '@angular/core';
|
|||||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||||
|
|
||||||
import { MainComponent } from './main.component';
|
import { MainComponent } from './main.component';
|
||||||
import { BrandModule } from '../brand';
|
import { BrandModule } from '../../brand';
|
||||||
import { ToolbarModule } from '../toolbar';
|
import { ToolbarModule } from '../../toolbar';
|
||||||
import { ActionbarModule } from '../actionbar';
|
import { ActionbarModule } from '../../actionbar';
|
||||||
import { DocumentModule } from '../document/document.module';
|
import { DocumentModule } from '../../document/document.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [MainComponent],
|
declarations: [MainComponent],
|
@ -1,5 +1,5 @@
|
|||||||
@import '../../styles/variables.scss';
|
@import '../../../styles/variables.scss';
|
||||||
@import '../../styles/mixins.scss';
|
@import '../../../styles/mixins.scss';
|
||||||
|
|
||||||
.display-2 {
|
.display-2 {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
@ -5,12 +5,12 @@ import { FlexLayoutModule } from '@angular/flex-layout';
|
|||||||
import { MatButtonModule, MatFormFieldModule, MatAutocompleteModule, MatInputModule } from '@angular/material';
|
import { MatButtonModule, MatFormFieldModule, MatAutocompleteModule, MatInputModule } from '@angular/material';
|
||||||
|
|
||||||
import { PartyMngComponent } from './party-mgt.component';
|
import { PartyMngComponent } from './party-mgt.component';
|
||||||
import { BrandModule } from '../brand';
|
import { BrandModule } from '../../brand';
|
||||||
import { ToolbarModule } from '../toolbar';
|
import { ToolbarModule } from '../../toolbar';
|
||||||
import { ActionbarModule } from '../actionbar';
|
import { ActionbarModule } from '../../actionbar';
|
||||||
import { FormControlsModule } from '../form-controls';
|
import { FormControlsModule } from '../../form-controls';
|
||||||
import { LayoutModule } from '../layout';
|
import { LayoutModule } from '../../layout';
|
||||||
import { DaDataModule } from '../dadata/dadata.module';
|
import { DaDataModule } from '../../dadata/dadata.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [PartyMngComponent],
|
declarations: [PartyMngComponent],
|
@ -5,7 +5,7 @@ import { MainComponent } from './main';
|
|||||||
import { PageNotFoundComponent } from './page-not-found';
|
import { PageNotFoundComponent } from './page-not-found';
|
||||||
import { PartyMngComponent } from './party-mgt';
|
import { PartyMngComponent } from './party-mgt';
|
||||||
import { DetailsComponent } from './details';
|
import { DetailsComponent } from './details';
|
||||||
import { AnalyticsComponent } from './analytics/analytics.component';
|
import { AnalyticsComponent } from './analytics';
|
||||||
import { TableComponent } from './table';
|
import { TableComponent } from './table';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
@ -39,4 +39,4 @@ const routes: Routes = [
|
|||||||
imports: [RouterModule.forRoot(routes)],
|
imports: [RouterModule.forRoot(routes)],
|
||||||
exports: [RouterModule]
|
exports: [RouterModule]
|
||||||
})
|
})
|
||||||
export class AppRoutingModule {}
|
export class SectionsRoutingModule {}
|
25
src/app/sections/sections.module.ts
Normal file
25
src/app/sections/sections.module.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { SectionsRoutingModule } from './sections-routing.module';
|
||||||
|
import { MainModule } from './main';
|
||||||
|
import { PartyMngModule } from './party-mgt';
|
||||||
|
import { AnalyticsModule } from './analytics';
|
||||||
|
import { DetailsModule } from './details';
|
||||||
|
import { PageNotFoundModule } from './page-not-found';
|
||||||
|
import { TableModule } from './table';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
SectionsRoutingModule,
|
||||||
|
MainModule,
|
||||||
|
PartyMngModule,
|
||||||
|
AnalyticsModule,
|
||||||
|
DetailsModule,
|
||||||
|
PageNotFoundModule,
|
||||||
|
TableModule
|
||||||
|
],
|
||||||
|
declarations: [],
|
||||||
|
entryComponents: [],
|
||||||
|
providers: []
|
||||||
|
})
|
||||||
|
export class SectionsModule {}
|
2
src/app/sections/table/index.ts
Normal file
2
src/app/sections/table/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './table.module';
|
||||||
|
export * from './table.component';
|
@ -1,5 +1,5 @@
|
|||||||
@import '../../styles/variables.scss';
|
@import '../../../styles/variables.scss';
|
||||||
@import '../../styles/mixins.scss';
|
@import '../../../styles/mixins.scss';
|
||||||
|
|
||||||
mat-sidenav-container {
|
mat-sidenav-container {
|
||||||
@include fullscreen();
|
@include fullscreen();
|
||||||
@ -27,4 +27,3 @@ mat-sidenav-container {
|
|||||||
height: 400px;
|
height: 400px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
|
|
||||||
import { toolbarOffset } from '../layout-settings';
|
|
||||||
import { MatPaginator, MatTableDataSource } from '@angular/material';
|
import { MatPaginator, MatTableDataSource } from '@angular/material';
|
||||||
|
|
||||||
|
import { toolbarOffset } from '../../layout-settings';
|
||||||
|
|
||||||
export interface PeriodicElement {
|
export interface PeriodicElement {
|
||||||
name: string;
|
name: string;
|
||||||
position: number;
|
position: number;
|
25
src/app/sections/table/table.module.ts
Normal file
25
src/app/sections/table/table.module.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||||
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||||
|
import { MatPaginatorModule, MatTableModule } from '@angular/material';
|
||||||
|
|
||||||
|
import { TableComponent } from './table.component';
|
||||||
|
import { BrandModule } from '../../brand';
|
||||||
|
import { ToolbarModule } from '../../toolbar';
|
||||||
|
import { ActionbarModule } from '../../actionbar';
|
||||||
|
import { DshTableModule } from '../../table';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [TableComponent],
|
||||||
|
imports: [
|
||||||
|
FlexLayoutModule,
|
||||||
|
MatSidenavModule,
|
||||||
|
BrandModule,
|
||||||
|
ToolbarModule,
|
||||||
|
ActionbarModule,
|
||||||
|
DshTableModule,
|
||||||
|
MatTableModule,
|
||||||
|
MatPaginatorModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class TableModule {}
|
62
src/app/table/_table-theme.scss
Normal file
62
src/app/table/_table-theme.scss
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
@import '~@angular/material/theming';
|
||||||
|
|
||||||
|
@mixin dsh-table-theme($theme) {
|
||||||
|
$background: map-get($theme, background);
|
||||||
|
$foreground: map-get($theme, foreground);
|
||||||
|
|
||||||
|
.dsh {
|
||||||
|
&-table {
|
||||||
|
background: mat-color($background, card);
|
||||||
|
|
||||||
|
& thead,
|
||||||
|
& tbody,
|
||||||
|
& tfoot,
|
||||||
|
mat-header-row,
|
||||||
|
mat-row,
|
||||||
|
mat-footer-row,
|
||||||
|
[dsh-header-row],
|
||||||
|
[dsh-row],
|
||||||
|
[dsh-footer-row],
|
||||||
|
.dsh-table-sticky {
|
||||||
|
background: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
& thead {
|
||||||
|
background: mat-color($background, background);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-header-cell {
|
||||||
|
color: mat-color($foreground, secondary-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-cell,
|
||||||
|
&-footer-cell {
|
||||||
|
color: mat-color($foreground, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-row,
|
||||||
|
&-header-row,
|
||||||
|
&-footer-row {
|
||||||
|
border-bottom-color: mat-color($foreground, divider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin dsh-table-typography($config) {
|
||||||
|
.dsh {
|
||||||
|
&-table {
|
||||||
|
font-family: mat-font-family($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-header-cell {
|
||||||
|
font-size: mat-font-size($config, caption);
|
||||||
|
font-weight: mat-font-weight($config, body-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-cell,
|
||||||
|
&-footer-cell {
|
||||||
|
font-size: mat-font-size($config, body-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,2 +1 @@
|
|||||||
export * from './table.module';
|
export * from './public-api';
|
||||||
export * from './table.component';
|
|
||||||
|
@ -1,25 +1,46 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { MatSidenavModule } from '@angular/material/sidenav';
|
import { DshTableComponent } from './table';
|
||||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
import { CdkTableModule } from '@angular/cdk/table';
|
||||||
import { MatPaginatorModule, MatTableModule } from '@angular/material';
|
import {
|
||||||
|
DshCellDefDirective,
|
||||||
|
DshCellDirective,
|
||||||
|
DshColumnDefDirective,
|
||||||
|
DshFooterCellDefDirective,
|
||||||
|
DshFooterCellDirective,
|
||||||
|
DshHeaderCellDefDirective,
|
||||||
|
DshHeaderCellDirective
|
||||||
|
} from './cell';
|
||||||
|
import {
|
||||||
|
DshFooterRowComponent,
|
||||||
|
DshFooterRowDefDirective,
|
||||||
|
DshHeaderRowComponent,
|
||||||
|
DshHeaderRowDefDirective,
|
||||||
|
DshRowComponent,
|
||||||
|
DshRowDefDirective
|
||||||
|
} from './row';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { MatTableModule } from '@angular/material';
|
||||||
|
|
||||||
import { TableComponent } from './table.component';
|
const EXPORTED_DECLARATIONS = [
|
||||||
import { BrandModule } from '../brand';
|
DshTableComponent,
|
||||||
import { ToolbarModule } from '../toolbar';
|
DshHeaderCellDefDirective,
|
||||||
import { ActionbarModule } from '../actionbar';
|
DshHeaderRowDefDirective,
|
||||||
import { DshTableModule } from '../components/table';
|
DshColumnDefDirective,
|
||||||
|
DshCellDefDirective,
|
||||||
|
DshRowDefDirective,
|
||||||
|
DshFooterCellDefDirective,
|
||||||
|
DshFooterRowDefDirective,
|
||||||
|
DshHeaderCellDirective,
|
||||||
|
DshCellDirective,
|
||||||
|
DshFooterCellDirective,
|
||||||
|
DshHeaderRowComponent,
|
||||||
|
DshRowComponent,
|
||||||
|
DshFooterRowComponent
|
||||||
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [TableComponent],
|
imports: [CdkTableModule, CommonModule, MatTableModule],
|
||||||
imports: [
|
exports: EXPORTED_DECLARATIONS,
|
||||||
FlexLayoutModule,
|
declarations: EXPORTED_DECLARATIONS
|
||||||
MatSidenavModule,
|
|
||||||
BrandModule,
|
|
||||||
ToolbarModule,
|
|
||||||
ActionbarModule,
|
|
||||||
DshTableModule,
|
|
||||||
MatTableModule,
|
|
||||||
MatPaginatorModule
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
export class TableModule {}
|
export class DshTableModule {}
|
||||||
|
105
src/app/table/table.scss
Normal file
105
src/app/table/table.scss
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
@import '../../styles/variables';
|
||||||
|
|
||||||
|
$dsh-header-row-height: 56px;
|
||||||
|
$dsh-row-height: 48px;
|
||||||
|
$dsh-row-horizontal-padding: 24px;
|
||||||
|
|
||||||
|
.dsh {
|
||||||
|
&-table {
|
||||||
|
display: block;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 0;
|
||||||
|
border-spacing: 0;
|
||||||
|
|
||||||
|
thead,
|
||||||
|
tbody,
|
||||||
|
tfoot {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead {
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-header-row {
|
||||||
|
min-height: $dsh-header-row-height;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-row,
|
||||||
|
&-footer-row {
|
||||||
|
min-height: $dsh-row-height;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-row,
|
||||||
|
&-header-row,
|
||||||
|
&-footer-row {
|
||||||
|
display: flex;
|
||||||
|
border-width: 0;
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
display: inline-block;
|
||||||
|
min-height: inherit;
|
||||||
|
content: '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-row,
|
||||||
|
&-footer-row {
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
border-style: solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-cell:first-of-type,
|
||||||
|
&-header-cell:first-of-type,
|
||||||
|
&-footer-cell:first-of-type {
|
||||||
|
padding-left: $dsh-row-horizontal-padding;
|
||||||
|
|
||||||
|
[dir='rtl'] & {
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: $dsh-row-horizontal-padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-cell:last-of-type,
|
||||||
|
&-header-cell:last-of-type,
|
||||||
|
&-footer-cell:last-of-type {
|
||||||
|
padding-right: $dsh-row-horizontal-padding;
|
||||||
|
|
||||||
|
[dir='rtl'] & {
|
||||||
|
padding-right: 0;
|
||||||
|
padding-left: $dsh-row-horizontal-padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-cell,
|
||||||
|
&-header-cell,
|
||||||
|
&-footer-cell {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
overflow: hidden;
|
||||||
|
word-wrap: break-word;
|
||||||
|
min-height: inherit;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-header-row {
|
||||||
|
height: $dsh-header-row-height;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-row,
|
||||||
|
&-footer-row {
|
||||||
|
height: $dsh-row-height;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-header-cell {
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
[dir='rtl'] & {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,18 @@
|
|||||||
// Dependencies
|
|
||||||
@import '~@angular/material/theming';
|
@import '~@angular/material/theming';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
@import './styles/functions';
|
@import './styles/functions';
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
@import './styles/variables';
|
@import './styles/variables';
|
||||||
@import "./styles/palletes";
|
@import './styles/palletes';
|
||||||
|
|
||||||
|
// Theme
|
||||||
|
@import './styles/main-theme';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
@import "./styles/main-theme";
|
|
||||||
@import './app/dropdown/dropdown-theme';
|
@import './app/dropdown/dropdown-theme';
|
||||||
@import './app/components/table/table-theme';
|
@import './app/table/table-theme';
|
||||||
@import './app/charts/bar-chart/bar-chart-theme';
|
@import './app/charts/bar-chart/bar-chart-theme';
|
||||||
|
|
||||||
@include mat-core();
|
@include mat-core();
|
||||||
@ -23,5 +27,5 @@ $mat-theme: mat-light-theme($primary, $accent, $warn);
|
|||||||
@include angular-material-theme($mat-theme);
|
@include angular-material-theme($mat-theme);
|
||||||
@include dsh-main-theme($theme);
|
@include dsh-main-theme($theme);
|
||||||
@include dsh-dropdown-theme($theme);
|
@include dsh-dropdown-theme($theme);
|
||||||
@include dsh-table-theme($theme)
|
@include dsh-table-theme($theme);
|
||||||
@include dsh-bar-chart-theme($theme)
|
@include dsh-bar-chart-theme($theme);
|
||||||
|
20
src/styles/_functions.scss
Normal file
20
src/styles/_functions.scss
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
@import '~@angular/material/theming';
|
||||||
|
@import 'variables';
|
||||||
|
@import 'palletes';
|
||||||
|
|
||||||
|
@function dsh-light-theme(
|
||||||
|
$primary,
|
||||||
|
$accent,
|
||||||
|
$warn: mat-palette($mat-red),
|
||||||
|
$foreground: $dsh-light-theme-foreground,
|
||||||
|
$background: $dsh-light-theme-background
|
||||||
|
) {
|
||||||
|
@return (
|
||||||
|
primary: $primary,
|
||||||
|
accent: $accent,
|
||||||
|
warn: $warn,
|
||||||
|
is-dark: false,
|
||||||
|
foreground: $foreground,
|
||||||
|
background: $background
|
||||||
|
);
|
||||||
|
}
|
@ -1,13 +1,12 @@
|
|||||||
@import '~@angular/material/theming';
|
@import '~@angular/material/theming';
|
||||||
|
|
||||||
@mixin dsh-main-theme($theme) {
|
@mixin dsh-main-theme($theme) {
|
||||||
$background: map-get($theme, background);
|
$background: map-get($theme, background);
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-family: 'Roboto', sans-serif;
|
font-family: 'Roboto', sans-serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background-color: mat-color($background, background);;
|
background-color: mat-color($background, background);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
108
src/styles/_palletes.scss
Normal file
108
src/styles/_palletes.scss
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
@import 'variables';
|
||||||
|
|
||||||
|
// Background palette for light themes.
|
||||||
|
$dsh-light-theme-background: (
|
||||||
|
background: $background-color,
|
||||||
|
card: $white
|
||||||
|
);
|
||||||
|
|
||||||
|
// Background palette for dark themes.
|
||||||
|
$dsh-dark-theme-background: (
|
||||||
|
background: #303030,
|
||||||
|
card: $black
|
||||||
|
);
|
||||||
|
|
||||||
|
// Foreground palette for light themes.
|
||||||
|
$dsh-light-theme-foreground: (
|
||||||
|
base: black,
|
||||||
|
disabled-button: rgba($black, 0.26),
|
||||||
|
elevation: black,
|
||||||
|
divider: rgba($black, 0.27),
|
||||||
|
icon: rgba($black, 0.54),
|
||||||
|
icons: rgba($black, 0.54),
|
||||||
|
text: rgba($black, 0.87),
|
||||||
|
secondary-text: rgba($black, 0.67),
|
||||||
|
slider-min: rgba($black, 0.87),
|
||||||
|
slider-off: rgba($black, 0.26),
|
||||||
|
slider-off-active: rgba($black, 0.38)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Foreground palette for dark themes.
|
||||||
|
$dsh-dark-theme-foreground: (
|
||||||
|
base: white,
|
||||||
|
disabled-button: rgba($white, 0.3),
|
||||||
|
elevation: black,
|
||||||
|
divider: rgba($white, 0.27),
|
||||||
|
icon: white,
|
||||||
|
icons: white,
|
||||||
|
text: white,
|
||||||
|
secondary-text: rgba($white, 0.67),
|
||||||
|
slider-min: white,
|
||||||
|
slider-off: rgba($white, 0.3),
|
||||||
|
slider-off-active: rgba($white, 0.3)
|
||||||
|
);
|
||||||
|
|
||||||
|
$dsh-slateblue: (
|
||||||
|
50: #f4f0ff,
|
||||||
|
100: #f3f0ff,
|
||||||
|
200: #ded6ff,
|
||||||
|
300: #baadff,
|
||||||
|
400: #9385ff,
|
||||||
|
500: #685bff,
|
||||||
|
600: #4b43d9,
|
||||||
|
700: #312eb3,
|
||||||
|
800: #1d1f8c,
|
||||||
|
900: #141866,
|
||||||
|
A100: #ffffff,
|
||||||
|
A200: #ffffff,
|
||||||
|
A400: #dcdaff,
|
||||||
|
A700: #c4c1ff,
|
||||||
|
contrast: (
|
||||||
|
50: $dark-primary-text,
|
||||||
|
100: $dark-primary-text,
|
||||||
|
200: $dark-primary-text,
|
||||||
|
300: $light-primary-text,
|
||||||
|
400: $light-primary-text,
|
||||||
|
500: $light-primary-text,
|
||||||
|
600: $light-primary-text,
|
||||||
|
700: $light-primary-text,
|
||||||
|
800: $light-primary-text,
|
||||||
|
900: $light-primary-text,
|
||||||
|
A100: $dark-primary-text,
|
||||||
|
A200: $light-primary-text,
|
||||||
|
A400: $light-primary-text,
|
||||||
|
A700: $light-primary-text
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$dsh-palegreen: (
|
||||||
|
50: #f0fff6,
|
||||||
|
100: #e8fff2,
|
||||||
|
200: #b6f2d3,
|
||||||
|
300: #87e6b8,
|
||||||
|
400: #5dd9a1,
|
||||||
|
500: #38cd8f,
|
||||||
|
600: #24a674,
|
||||||
|
700: #16805a,
|
||||||
|
800: #0b5940,
|
||||||
|
900: #063326,
|
||||||
|
A100: #e2ffef,
|
||||||
|
A200: #afffd3,
|
||||||
|
A400: #7cffb7,
|
||||||
|
A700: #63ffa9,
|
||||||
|
contrast: (
|
||||||
|
50: $dark-primary-text,
|
||||||
|
100: $dark-primary-text,
|
||||||
|
200: $dark-primary-text,
|
||||||
|
300: $light-primary-text,
|
||||||
|
400: $light-primary-text,
|
||||||
|
500: $light-primary-text,
|
||||||
|
600: $light-primary-text,
|
||||||
|
700: $light-primary-text,
|
||||||
|
800: $light-primary-text,
|
||||||
|
900: $light-primary-text,
|
||||||
|
A100: $dark-primary-text,
|
||||||
|
A200: $light-primary-text,
|
||||||
|
A400: $light-primary-text,
|
||||||
|
A700: $light-primary-text
|
||||||
|
)
|
||||||
|
);
|
@ -1,14 +0,0 @@
|
|||||||
@import '~@angular/material/theming';
|
|
||||||
@import 'variables';
|
|
||||||
@import 'palletes';
|
|
||||||
|
|
||||||
@function dsh-light-theme($primary, $accent, $warn: mat-palette($mat-red), $foreground: $dsh-light-theme-foreground, $background: $dsh-light-theme-background) {
|
|
||||||
@return (
|
|
||||||
primary: $primary,
|
|
||||||
accent: $accent,
|
|
||||||
warn: $warn,
|
|
||||||
is-dark: false,
|
|
||||||
foreground: $foreground,
|
|
||||||
background: $background
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
@import 'variables';
|
|
||||||
|
|
||||||
// Background palette for light themes.
|
|
||||||
$dsh-light-theme-background: (
|
|
||||||
background: $background-color,
|
|
||||||
card: $white
|
|
||||||
);
|
|
||||||
|
|
||||||
// Background palette for dark themes.
|
|
||||||
$dsh-dark-theme-background: (
|
|
||||||
background: #303030,
|
|
||||||
card: $black
|
|
||||||
);
|
|
||||||
|
|
||||||
// Foreground palette for light themes.
|
|
||||||
$dsh-light-theme-foreground: (
|
|
||||||
base: black,
|
|
||||||
disabled-button: rgba($black, 0.26),
|
|
||||||
elevation: black,
|
|
||||||
divider: rgba($black, 0.27),
|
|
||||||
icon: rgba($black, 0.54),
|
|
||||||
icons: rgba($black, 0.54),
|
|
||||||
text: rgba($black, 0.87),
|
|
||||||
secondary-text: rgba($black, 0.67),
|
|
||||||
slider-min: rgba($black, 0.87),
|
|
||||||
slider-off: rgba($black, 0.26),
|
|
||||||
slider-off-active: rgba($black, 0.38)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Foreground palette for dark themes.
|
|
||||||
$dsh-dark-theme-foreground: (
|
|
||||||
base: white,
|
|
||||||
disabled-button: rgba($white, 0.3),
|
|
||||||
elevation: black,
|
|
||||||
divider: rgba($white, 0.27),
|
|
||||||
icon: white,
|
|
||||||
icons: white,
|
|
||||||
text: white,
|
|
||||||
secondary-text: rgba($white, 0.67),
|
|
||||||
slider-min: white,
|
|
||||||
slider-off: rgba($white, 0.3),
|
|
||||||
slider-off-active: rgba($white, 0.3)
|
|
||||||
);
|
|
||||||
|
|
||||||
$dsh-slateblue: (
|
|
||||||
50: #f4f0ff,
|
|
||||||
100: #f3f0ff,
|
|
||||||
200: #ded6ff,
|
|
||||||
300: #baadff,
|
|
||||||
400: #9385ff,
|
|
||||||
500: #685bff,
|
|
||||||
600: #4b43d9,
|
|
||||||
700: #312eb3,
|
|
||||||
800: #1d1f8c,
|
|
||||||
900: #141866,
|
|
||||||
A100: #ffffff,
|
|
||||||
A200: #ffffff,
|
|
||||||
A400: #dcdaff,
|
|
||||||
A700: #c4c1ff,
|
|
||||||
contrast: (
|
|
||||||
50: $dark-primary-text,
|
|
||||||
100: $dark-primary-text,
|
|
||||||
200: $dark-primary-text,
|
|
||||||
300: $light-primary-text,
|
|
||||||
400: $light-primary-text,
|
|
||||||
500: $light-primary-text,
|
|
||||||
600: $light-primary-text,
|
|
||||||
700: $light-primary-text,
|
|
||||||
800: $light-primary-text,
|
|
||||||
900: $light-primary-text,
|
|
||||||
A100: $dark-primary-text,
|
|
||||||
A200: $light-primary-text,
|
|
||||||
A400: $light-primary-text,
|
|
||||||
A700: $light-primary-text
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$dsh-palegreen: (
|
|
||||||
50: #f0fff6,
|
|
||||||
100: #e8fff2,
|
|
||||||
200: #b6f2d3,
|
|
||||||
300: #87e6b8,
|
|
||||||
400: #5dd9a1,
|
|
||||||
500: #38cd8f,
|
|
||||||
600: #24a674,
|
|
||||||
700: #16805a,
|
|
||||||
800: #0b5940,
|
|
||||||
900: #063326,
|
|
||||||
A100: #e2ffef,
|
|
||||||
A200: #afffd3,
|
|
||||||
A400: #7cffb7,
|
|
||||||
A700: #63ffa9,
|
|
||||||
contrast: (
|
|
||||||
50: $dark-primary-text,
|
|
||||||
100: $dark-primary-text,
|
|
||||||
200: $dark-primary-text,
|
|
||||||
300: $light-primary-text,
|
|
||||||
400: $light-primary-text,
|
|
||||||
500: $light-primary-text,
|
|
||||||
600: $light-primary-text,
|
|
||||||
700: $light-primary-text,
|
|
||||||
800: $light-primary-text,
|
|
||||||
900: $light-primary-text,
|
|
||||||
A100: $dark-primary-text,
|
|
||||||
A200: $light-primary-text,
|
|
||||||
A400: $light-primary-text,
|
|
||||||
A700: $light-primary-text
|
|
||||||
)
|
|
||||||
);
|
|
Loading…
Reference in New Issue
Block a user