chrv-components 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chr-theme.scss +97 -0
- package/ng-package.json +7 -0
- package/package.json +7 -23
- package/src/lib/chr-breadcrumb/chr-breadcrumb.component.html +9 -0
- package/src/lib/chr-breadcrumb/chr-breadcrumb.component.scss +0 -0
- package/src/lib/chr-breadcrumb/chr-breadcrumb.component.spec.ts +22 -0
- package/src/lib/chr-breadcrumb/chr-breadcrumb.component.ts +23 -0
- package/src/lib/chr-button/chr-button.component.html +20 -0
- package/src/lib/chr-button/chr-button.component.scss +0 -0
- package/src/lib/chr-button/chr-button.component.spec.ts +23 -0
- package/src/lib/chr-button/chr-button.component.ts +36 -0
- package/src/lib/chr-checkbox/chr-checkbox.component.html +4 -0
- package/src/lib/chr-checkbox/chr-checkbox.component.scss +15 -0
- package/src/lib/chr-checkbox/chr-checkbox.component.spec.ts +23 -0
- package/src/lib/chr-checkbox/chr-checkbox.component.ts +30 -0
- package/src/lib/chr-components.module.ts +69 -0
- package/src/lib/chr-delete-modal/chr-delete-modal.component.html +26 -0
- package/src/lib/chr-delete-modal/chr-delete-modal.component.scss +0 -0
- package/src/lib/chr-delete-modal/chr-delete-modal.component.spec.ts +23 -0
- package/src/lib/chr-delete-modal/chr-delete-modal.component.ts +19 -0
- package/src/lib/chr-form/chr-form.component.html +98 -0
- package/src/lib/chr-form/chr-form.component.scss +37 -0
- package/src/lib/chr-form/chr-form.component.spec.ts +23 -0
- package/src/lib/chr-form/chr-form.component.ts +173 -0
- package/src/lib/chr-form/chr-validators/decimal-validator.ts +54 -0
- package/src/lib/chr-form/chr-validators/max-date-validator.ts +48 -0
- package/src/lib/chr-form/chr-validators/type-validator.ts +47 -0
- package/src/lib/chr-search-select/chr-search-select.component.html +19 -0
- package/src/lib/chr-search-select/chr-search-select.component.scss +3 -0
- package/src/lib/chr-search-select/chr-search-select.component.spec.ts +23 -0
- package/src/lib/chr-search-select/chr-search-select.component.ts +164 -0
- package/src/lib/chr-searchbar/chr-searchbar.component.html +10 -0
- package/src/lib/chr-searchbar/chr-searchbar.component.scss +0 -0
- package/src/lib/chr-searchbar/chr-searchbar.component.spec.ts +23 -0
- package/src/lib/chr-searchbar/chr-searchbar.component.ts +23 -0
- package/src/lib/chr-separator/chr-separator.component.html +3 -0
- package/src/lib/chr-separator/chr-separator.component.scss +24 -0
- package/src/lib/chr-separator/chr-separator.component.spec.ts +23 -0
- package/src/lib/chr-separator/chr-separator.component.ts +10 -0
- package/src/lib/chr-table/chr-table.component.html +88 -0
- package/src/lib/chr-table/chr-table.component.scss +53 -0
- package/src/lib/chr-table/chr-table.component.spec.ts +23 -0
- package/src/lib/chr-table/chr-table.component.ts +72 -0
- package/src/lib/chr-table-header-cell/chr-table-header-cell.component.html +9 -0
- package/src/lib/chr-table-header-cell/chr-table-header-cell.component.scss +31 -0
- package/src/lib/chr-table-header-cell/chr-table-header-cell.component.spec.ts +23 -0
- package/src/lib/chr-table-header-cell/chr-table-header-cell.component.ts +39 -0
- package/src/lib/services/dialog.service.ts +23 -0
- package/{public-api.d.ts → src/public-api.ts} +21 -15
- package/styles.scss +93 -0
- package/tailwind.config.js +30 -0
- package/theme.scss +59 -0
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/chrv-components-1.0.0.tgz +0 -0
- package/esm2020/chrv-components.mjs +0 -5
- package/esm2020/lib/chr-breadcrumb/chr-breadcrumb.component.mjs +0 -22
- package/esm2020/lib/chr-button/chr-button.component.mjs +0 -46
- package/esm2020/lib/chr-checkbox/chr-checkbox.component.mjs +0 -37
- package/esm2020/lib/chr-components.module.mjs +0 -117
- package/esm2020/lib/chr-delete-modal/chr-delete-modal.component.mjs +0 -22
- package/esm2020/lib/chr-form/chr-form.component.mjs +0 -132
- package/esm2020/lib/chr-form/chr-validators/decimal-validator.mjs +0 -58
- package/esm2020/lib/chr-form/chr-validators/max-date-validator.mjs +0 -54
- package/esm2020/lib/chr-form/chr-validators/type-validator.mjs +0 -52
- package/esm2020/lib/chr-search-select/chr-search-select.component.mjs +0 -136
- package/esm2020/lib/chr-searchbar/chr-searchbar.component.mjs +0 -29
- package/esm2020/lib/chr-separator/chr-separator.component.mjs +0 -11
- package/esm2020/lib/chr-table/chr-table.component.mjs +0 -58
- package/esm2020/lib/chr-table-header-cell/chr-table-header-cell.component.mjs +0 -49
- package/esm2020/lib/services/dialog.service.mjs +0 -29
- package/esm2020/public-api.mjs +0 -19
- package/fesm2015/chrv-components.mjs +0 -799
- package/fesm2015/chrv-components.mjs.map +0 -1
- package/fesm2020/chrv-components.mjs +0 -793
- package/fesm2020/chrv-components.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/chr-breadcrumb/chr-breadcrumb.component.d.ts +0 -15
- package/lib/chr-button/chr-button.component.d.ts +0 -17
- package/lib/chr-checkbox/chr-checkbox.component.d.ts +0 -13
- package/lib/chr-components.module.d.ts +0 -28
- package/lib/chr-delete-modal/chr-delete-modal.component.d.ts +0 -11
- package/lib/chr-form/chr-form.component.d.ts +0 -57
- package/lib/chr-form/chr-validators/decimal-validator.d.ts +0 -10
- package/lib/chr-form/chr-validators/max-date-validator.d.ts +0 -10
- package/lib/chr-form/chr-validators/type-validator.d.ts +0 -10
- package/lib/chr-search-select/chr-search-select.component.d.ts +0 -44
- package/lib/chr-searchbar/chr-searchbar.component.d.ts +0 -14
- package/lib/chr-separator/chr-separator.component.d.ts +0 -5
- package/lib/chr-table/chr-table.component.d.ts +0 -38
- package/lib/chr-table-header-cell/chr-table-header-cell.component.d.ts +0 -16
- package/lib/services/dialog.service.d.ts +0 -10
package/chr-theme.scss
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
@use '@angular/material' as mat;
|
|
2
|
+
@include mat.core();
|
|
3
|
+
|
|
4
|
+
$StockManager-warn: mat.define-palette(mat.$red-palette);
|
|
5
|
+
|
|
6
|
+
$chr-primary-map: (
|
|
7
|
+
50 : #e0e8f2,
|
|
8
|
+
100 : #b3c5dd,
|
|
9
|
+
200 : #809fc7,
|
|
10
|
+
300 : #4d78b1,
|
|
11
|
+
400 : #265ba0,
|
|
12
|
+
500 : #003e8f,
|
|
13
|
+
600 : #003887,
|
|
14
|
+
700 : #00307c,
|
|
15
|
+
800 : #002872,
|
|
16
|
+
900 : #001b60,
|
|
17
|
+
A100 : #90a5ff,
|
|
18
|
+
A200 : #5d7cff,
|
|
19
|
+
A400 : #2a52ff,
|
|
20
|
+
A700 : #113eff,
|
|
21
|
+
contrast: (
|
|
22
|
+
50 : #000000,
|
|
23
|
+
100 : #000000,
|
|
24
|
+
200 : #000000,
|
|
25
|
+
300 : #ffffff,
|
|
26
|
+
400 : #ffffff,
|
|
27
|
+
500 : #ffffff,
|
|
28
|
+
600 : #ffffff,
|
|
29
|
+
700 : #ffffff,
|
|
30
|
+
800 : #ffffff,
|
|
31
|
+
900 : #ffffff,
|
|
32
|
+
A100 : #000000,
|
|
33
|
+
A200 : #000000,
|
|
34
|
+
A400 : #ffffff,
|
|
35
|
+
A700 : #ffffff,
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
$chr-accent-map: (
|
|
39
|
+
50 : #e0f2fb,
|
|
40
|
+
100 : #b3e0f5,
|
|
41
|
+
200 : #80cbee,
|
|
42
|
+
300 : #4db6e7,
|
|
43
|
+
400 : #26a6e1,
|
|
44
|
+
500 : #0096dc,
|
|
45
|
+
600 : #008ed8,
|
|
46
|
+
700 : #0083d3,
|
|
47
|
+
800 : #0079ce,
|
|
48
|
+
900 : #0068c5,
|
|
49
|
+
A100 : #edf5ff,
|
|
50
|
+
A200 : #badaff,
|
|
51
|
+
A400 : #87bfff,
|
|
52
|
+
A700 : #6eb1ff,
|
|
53
|
+
contrast: (
|
|
54
|
+
50 : #000000,
|
|
55
|
+
100 : #000000,
|
|
56
|
+
200 : #000000,
|
|
57
|
+
300 : #000000,
|
|
58
|
+
400 : #000000,
|
|
59
|
+
500 : #ffffff,
|
|
60
|
+
600 : #ffffff,
|
|
61
|
+
700 : #ffffff,
|
|
62
|
+
800 : #ffffff,
|
|
63
|
+
900 : #ffffff,
|
|
64
|
+
A100 : #000000,
|
|
65
|
+
A200 : #000000,
|
|
66
|
+
A400 : #000000,
|
|
67
|
+
A700 : #000000,
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
$chr-primary: mat.define-palette($chr-primary-map);
|
|
71
|
+
$chr-accent: mat.define-palette($chr-accent-map, A200, A100, A400);
|
|
72
|
+
|
|
73
|
+
$chr-theme: mat.define-light-theme((
|
|
74
|
+
color: (
|
|
75
|
+
primary: $chr-primary,
|
|
76
|
+
accent: $chr-accent,
|
|
77
|
+
warn: $StockManager-warn,
|
|
78
|
+
)
|
|
79
|
+
));
|
|
80
|
+
|
|
81
|
+
$chr-dark-theme: mat.define-light-theme((
|
|
82
|
+
color: (
|
|
83
|
+
primary: $chr-primary,
|
|
84
|
+
accent: $chr-accent,
|
|
85
|
+
warn: $StockManager-warn,
|
|
86
|
+
)
|
|
87
|
+
));
|
|
88
|
+
|
|
89
|
+
@mixin color($chr-theme) {
|
|
90
|
+
// Get the color config from the theme.
|
|
91
|
+
$color-config: mat.get-color-config($chr-theme);
|
|
92
|
+
|
|
93
|
+
// Get the primary color palette from the color-config.
|
|
94
|
+
$primary-palette: map.get($color-config, 'primary');
|
|
95
|
+
// Get the primary color palette from the color-config.
|
|
96
|
+
$accent-palette: map.get($color-config, 'accent');
|
|
97
|
+
}
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,31 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrv-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^15.1.0",
|
|
6
|
-
"@angular/core": "^15.1.0"
|
|
6
|
+
"@angular/core": "^15.1.0",
|
|
7
|
+
"@angular/forms": "^15.1.0",
|
|
8
|
+
"@angular/material": "^15.1.3",
|
|
9
|
+
"tailwindcss": "^3.2.4"
|
|
7
10
|
},
|
|
8
11
|
"dependencies": {
|
|
9
12
|
"tslib": "^2.3.0"
|
|
10
13
|
},
|
|
11
|
-
"sideEffects": false
|
|
12
|
-
|
|
13
|
-
"es2020": "fesm2020/chrv-components.mjs",
|
|
14
|
-
"esm2020": "esm2020/chrv-components.mjs",
|
|
15
|
-
"fesm2020": "fesm2020/chrv-components.mjs",
|
|
16
|
-
"fesm2015": "fesm2015/chrv-components.mjs",
|
|
17
|
-
"typings": "index.d.ts",
|
|
18
|
-
"exports": {
|
|
19
|
-
"./package.json": {
|
|
20
|
-
"default": "./package.json"
|
|
21
|
-
},
|
|
22
|
-
".": {
|
|
23
|
-
"types": "./index.d.ts",
|
|
24
|
-
"esm2020": "./esm2020/chrv-components.mjs",
|
|
25
|
-
"es2020": "./fesm2020/chrv-components.mjs",
|
|
26
|
-
"es2015": "./fesm2015/chrv-components.mjs",
|
|
27
|
-
"node": "./fesm2015/chrv-components.mjs",
|
|
28
|
-
"default": "./fesm2020/chrv-components.mjs"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
14
|
+
"sideEffects": false
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<div class="w-full flex flex-row flex-wrap dark:!text-gray-400">
|
|
2
|
+
<div *ngFor="let crumb of crumbs" class="w-fit min-w-fit">
|
|
3
|
+
<button class="dark:!text-gray-400" [disabled]="!crumb.link && !crumb.callback" mat-button
|
|
4
|
+
(click)="crumb.callback?.() || crumb.link && navigateTo(crumb.link)">
|
|
5
|
+
{{ crumb.display }}
|
|
6
|
+
</button>
|
|
7
|
+
{{ (crumb.link || crumb.callback) && ">" }}
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { BreadcrumbComponent } from './chr-breadcrumb.component';
|
|
4
|
+
|
|
5
|
+
describe('BreadcrumbComponent', () => {
|
|
6
|
+
let component: BreadcrumbComponent;
|
|
7
|
+
let fixture: ComponentFixture<BreadcrumbComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [BreadcrumbComponent],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
|
|
14
|
+
fixture = TestBed.createComponent(BreadcrumbComponent);
|
|
15
|
+
component = fixture.componentInstance;
|
|
16
|
+
fixture.detectChanges();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should create', () => {
|
|
20
|
+
expect(component).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { Router } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
export interface Breadcrumb {
|
|
5
|
+
display: string;
|
|
6
|
+
link?: string;
|
|
7
|
+
callback?: Function;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'app-chr-breadcrumb',
|
|
12
|
+
templateUrl: './chr-breadcrumb.component.html',
|
|
13
|
+
styleUrls: ['./chr-breadcrumb.component.scss'],
|
|
14
|
+
})
|
|
15
|
+
export class BreadcrumbComponent {
|
|
16
|
+
@Input() crumbs: Breadcrumb[];
|
|
17
|
+
|
|
18
|
+
constructor(public router: Router) {}
|
|
19
|
+
|
|
20
|
+
navigateTo = (uri: string, data?: any) => {
|
|
21
|
+
this.router.navigate([uri], { state: data });
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<div class="grid">
|
|
2
|
+
<a mat-button mat-flat-button *ngIf="predicate" [disabled]="disabled" [ngClass]="
|
|
3
|
+
type == 'full'
|
|
4
|
+
? 'grid grid-cols-1 flex-1 self-end content-end items-center justify-center !w-full'
|
|
5
|
+
: ' '
|
|
6
|
+
" [ngClass]="type == 'table' ? 'h-14 grid grid-cols-1' : ''"
|
|
7
|
+
[ngClass]="type == 'fixed' ? 'h-14 grid grid-cols-1 w-36' : ''" color="{{ color }}" (click)="click?.()"
|
|
8
|
+
[attr.href]="href && href" [attr.target]="target && target" [matTooltip]="tooltip||''"
|
|
9
|
+
[matTooltipPosition]="tooltipPosition||'above'">
|
|
10
|
+
{{ display }}
|
|
11
|
+
<mat-icon *ngIf="icon">{{ icon }}</mat-icon>
|
|
12
|
+
</a>
|
|
13
|
+
</div>
|
|
14
|
+
<!--
|
|
15
|
+
IF
|
|
16
|
+
Click
|
|
17
|
+
color
|
|
18
|
+
type: table : full
|
|
19
|
+
icon
|
|
20
|
+
-->
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ChrButtonComponent } from './chr-button.component';
|
|
4
|
+
|
|
5
|
+
describe('ChrButtonComponent', () => {
|
|
6
|
+
let component: ChrButtonComponent;
|
|
7
|
+
let fixture: ComponentFixture<ChrButtonComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ ChrButtonComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(ChrButtonComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'app-chr-button',
|
|
5
|
+
templateUrl: './chr-button.component.html',
|
|
6
|
+
styleUrls: ['./chr-button.component.scss'],
|
|
7
|
+
})
|
|
8
|
+
export class ChrButtonComponent {
|
|
9
|
+
@Input() display: string = '';
|
|
10
|
+
@Input() icon: string = '';
|
|
11
|
+
@Input() click?: Function;
|
|
12
|
+
@Input() color: 'primary' | 'accent' | 'warn' | 'none' = 'none';
|
|
13
|
+
@Input() predicate?: boolean = true;
|
|
14
|
+
@Input() type: 'table' | 'full' | 'fixed' | 'none' = 'none';
|
|
15
|
+
@Input() href?: string;
|
|
16
|
+
@Input() target: '_blank' | '_parent' | '_self' | '_top';
|
|
17
|
+
@Input() disabled: boolean = false;
|
|
18
|
+
@Input() tooltip?: string;
|
|
19
|
+
@Input() tooltipPosition?:
|
|
20
|
+
| 'above'
|
|
21
|
+
| 'below'
|
|
22
|
+
| 'left'
|
|
23
|
+
| 'right'
|
|
24
|
+
| 'before'
|
|
25
|
+
| 'after';
|
|
26
|
+
|
|
27
|
+
constructor() {}
|
|
28
|
+
|
|
29
|
+
setDisabled = (is: boolean) => {
|
|
30
|
+
this.disabled = is;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
doClick = () => {
|
|
34
|
+
this.click?.();
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<div *ngIf="checked" (click)="check(false)" [class.info]="type=='info'&&!disabled" [class.bg-green-100]="type=='success'&&!disabled" [class.cursor-pointer]="!disabled" [class.bg-grey-400]="disabled" class="box-border rounded-lg p-3 h-12 text-center border-bottom-accent sm:border-none"><div class="flex justify-center items-center"><mat-icon>check-circle</mat-icon></div></div>
|
|
3
|
+
<div *ngIf="!checked" (click)="check(true)" [class.cursor-pointer]="!disabled" [class.disabled]="disabled" [class.bg-gray-200]="disabled" [class.bg-red-100]="!disabled" class="box-border p-3 h-12 text-center rounded-lg border-bottom-accent sm:border-none"><div class="flex justify-center items-center"><mat-icon>close</mat-icon></div></div>
|
|
4
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '@angular/material' as mat;
|
|
3
|
+
@import '../../../styles.scss';
|
|
4
|
+
|
|
5
|
+
$color-config: mat.get-color-config($chr-theme);
|
|
6
|
+
$primary-palette: map.get($color-config, 'primary');
|
|
7
|
+
$accent-palette: map.get($color-config, 'accent');
|
|
8
|
+
|
|
9
|
+
.bg-accent {
|
|
10
|
+
background-color: mat.get-color-from-palette($accent-palette, A200);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.info {
|
|
14
|
+
background-color: mat.get-color-from-palette($accent-palette, A200);
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ChrCheckboxComponent } from './chr-checkbox.component';
|
|
4
|
+
|
|
5
|
+
describe('ChrCheckboxComponent', () => {
|
|
6
|
+
let component: ChrCheckboxComponent;
|
|
7
|
+
let fixture: ComponentFixture<ChrCheckboxComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ ChrCheckboxComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(ChrCheckboxComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { MatIcon } from '@angular/material/icon';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-chr-checkbox',
|
|
6
|
+
templateUrl: './chr-checkbox.component.html',
|
|
7
|
+
styleUrls: ['./chr-checkbox.component.scss']
|
|
8
|
+
})
|
|
9
|
+
export class ChrCheckboxComponent {
|
|
10
|
+
|
|
11
|
+
public checked:boolean = false
|
|
12
|
+
|
|
13
|
+
@Input() type:'info'|'success' = 'info'
|
|
14
|
+
|
|
15
|
+
@Input() disabled:boolean = false
|
|
16
|
+
|
|
17
|
+
@Output() change: EventEmitter<{checked:boolean}> = new EventEmitter<{checked:boolean}>();
|
|
18
|
+
|
|
19
|
+
check(end:boolean){
|
|
20
|
+
if(this.disabled)
|
|
21
|
+
return
|
|
22
|
+
if(end){
|
|
23
|
+
this.checked = true;
|
|
24
|
+
this.change.emit({checked:true})
|
|
25
|
+
} else {
|
|
26
|
+
this.checked = false;
|
|
27
|
+
this.change.emit({checked:false})
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { PipeModule } from 'chrv-pipes';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { ChrCheckboxComponent } from './chr-checkbox/chr-checkbox.component';
|
|
4
|
+
import { BreadcrumbComponent } from './chr-breadcrumb/chr-breadcrumb.component';
|
|
5
|
+
import { ChrButtonComponent } from './chr-button/chr-button.component';
|
|
6
|
+
import { ChrSearchSelectComponent } from './chr-search-select/chr-search-select.component';
|
|
7
|
+
import { ChrSearchbarComponent } from './chr-searchbar/chr-searchbar.component';
|
|
8
|
+
import { ChrTableComponent } from './chr-table/chr-table.component';
|
|
9
|
+
import { ChrTableHeaderCellComponent } from './chr-table-header-cell/chr-table-header-cell.component';
|
|
10
|
+
import { ChrFormComponent } from './chr-form/chr-form.component';
|
|
11
|
+
import { ChrSeparatorComponent } from './chr-separator/chr-separator.component';
|
|
12
|
+
import { ChrDeleteModalComponent } from './chr-delete-modal/chr-delete-modal.component';
|
|
13
|
+
import { TypeValidatorDirective } from './chr-form/chr-validators/type-validator';
|
|
14
|
+
import { DecimalValidatorDirective } from './chr-form/chr-validators/decimal-validator';
|
|
15
|
+
import { MaxDateValidatorDirective } from './chr-form/chr-validators/max-date-validator';
|
|
16
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
17
|
+
import { CommonModule, DatePipe } from '@angular/common';
|
|
18
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
19
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
20
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
21
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
22
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
23
|
+
import { MatDialogModule } from '@angular/material/dialog';
|
|
24
|
+
|
|
25
|
+
@NgModule({
|
|
26
|
+
declarations: [
|
|
27
|
+
ChrCheckboxComponent,
|
|
28
|
+
BreadcrumbComponent,
|
|
29
|
+
ChrButtonComponent,
|
|
30
|
+
ChrSearchSelectComponent,
|
|
31
|
+
ChrSearchbarComponent,
|
|
32
|
+
ChrTableComponent,
|
|
33
|
+
ChrTableHeaderCellComponent,
|
|
34
|
+
ChrFormComponent,
|
|
35
|
+
ChrSeparatorComponent,
|
|
36
|
+
ChrDeleteModalComponent,
|
|
37
|
+
TypeValidatorDirective,
|
|
38
|
+
DecimalValidatorDirective,
|
|
39
|
+
MaxDateValidatorDirective,
|
|
40
|
+
],
|
|
41
|
+
imports: [
|
|
42
|
+
CommonModule,
|
|
43
|
+
MatIconModule,
|
|
44
|
+
MatButtonModule,
|
|
45
|
+
MatAutocompleteModule,
|
|
46
|
+
ReactiveFormsModule,
|
|
47
|
+
MatFormFieldModule,
|
|
48
|
+
MatTooltipModule,
|
|
49
|
+
MatDialogModule,
|
|
50
|
+
PipeModule,
|
|
51
|
+
],
|
|
52
|
+
exports: [
|
|
53
|
+
ChrCheckboxComponent,
|
|
54
|
+
BreadcrumbComponent,
|
|
55
|
+
ChrButtonComponent,
|
|
56
|
+
ChrSearchSelectComponent,
|
|
57
|
+
ChrSearchbarComponent,
|
|
58
|
+
ChrTableComponent,
|
|
59
|
+
ChrTableHeaderCellComponent,
|
|
60
|
+
ChrFormComponent,
|
|
61
|
+
ChrSeparatorComponent,
|
|
62
|
+
ChrDeleteModalComponent,
|
|
63
|
+
TypeValidatorDirective,
|
|
64
|
+
DecimalValidatorDirective,
|
|
65
|
+
MaxDateValidatorDirective,
|
|
66
|
+
],
|
|
67
|
+
providers: [DatePipe],
|
|
68
|
+
})
|
|
69
|
+
export class ChrComponentsModule {}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<div class="dark:bg-slate-800">
|
|
2
|
+
<h2 mat-dialog-title class="dark:!text-gray-400">Supprimer un élément</h2>
|
|
3
|
+
<mat-dialog-content class="dark:!text-gray-400">
|
|
4
|
+
Attention:
|
|
5
|
+
<hr>
|
|
6
|
+
<br>
|
|
7
|
+
La suppression d'un élément est irréversible.
|
|
8
|
+
<hr>
|
|
9
|
+
<br>
|
|
10
|
+
Vous allez supprimer un élément et sa référence sera effacée dans toute l'application.
|
|
11
|
+
<hr>
|
|
12
|
+
Si d'autres éléments y sont liés, il est possible qu'ils soient supprimés en même temps.
|
|
13
|
+
<hr>
|
|
14
|
+
<br>
|
|
15
|
+
En effectuant cette action et cliquant sur "Confirmer" vous certifiez que vous avez pris connaissance des
|
|
16
|
+
conséquences possibles et souhaitez tout de même poursuivre.
|
|
17
|
+
|
|
18
|
+
</mat-dialog-content>
|
|
19
|
+
<mat-dialog-actions>
|
|
20
|
+
<div class="w-full flex flex-row justify-between">
|
|
21
|
+
<app-chr-button class="w-36" display="Annuler" color="accent" mat-dialog-close></app-chr-button>
|
|
22
|
+
<app-chr-button class="w-36" display="Confirmer" color="warn" [click]="close"
|
|
23
|
+
[matTooltip]="'Attention: cette action est irréversible !'" matTooltipPosition="above"></app-chr-button>
|
|
24
|
+
</div>
|
|
25
|
+
</mat-dialog-actions>
|
|
26
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ChrDeleteModalComponent } from './chr-delete-modal.component';
|
|
4
|
+
|
|
5
|
+
describe('ChrDeleteModalComponent', () => {
|
|
6
|
+
let component: ChrDeleteModalComponent;
|
|
7
|
+
let fixture: ComponentFixture<ChrDeleteModalComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ ChrDeleteModalComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(ChrDeleteModalComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { MatDialogRef } from '@angular/material/dialog';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-chr-delete-modal',
|
|
6
|
+
templateUrl: './chr-delete-modal.component.html',
|
|
7
|
+
styleUrls: ['./chr-delete-modal.component.scss'],
|
|
8
|
+
})
|
|
9
|
+
export class ChrDeleteModalComponent {
|
|
10
|
+
public valid: boolean = false;
|
|
11
|
+
|
|
12
|
+
constructor(public dialogRef: MatDialogRef<ChrDeleteModalComponent>) {}
|
|
13
|
+
|
|
14
|
+
ngOnInit() {}
|
|
15
|
+
|
|
16
|
+
public close = () => {
|
|
17
|
+
this.dialogRef.close(true);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<div class="flex flex-col justify-center min-h-5/6">
|
|
2
|
+
<form [formGroup]="form">
|
|
3
|
+
<fieldset [disabled]="disabled">
|
|
4
|
+
<div *ngFor="let section of sections; let index = index">
|
|
5
|
+
<h2 *ngIf="section.title" class="font-bold text-xl">
|
|
6
|
+
{{ section.title }}
|
|
7
|
+
</h2>
|
|
8
|
+
<div class="grid gap-6 mb-6 sm:grid-cols-2">
|
|
9
|
+
<div *ngFor="let control of section.controls; let index = index" class="relative"
|
|
10
|
+
[ngClass]="control.width == 'row' ? 'sm:col-span-2' : 'col-span-1'">
|
|
11
|
+
<label *ngIf="control.label"
|
|
12
|
+
class="form-control block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{
|
|
13
|
+
control.label
|
|
14
|
+
}}
|
|
15
|
+
<span class="text-red-500" *ngIf="isControlRequired(control)">*</span>
|
|
16
|
+
:
|
|
17
|
+
</label>
|
|
18
|
+
<!-- Here we will *ngIf each type of input cause it's the cleanest way I can imagine-->
|
|
19
|
+
<!--TEXT-->
|
|
20
|
+
<input class="relative"
|
|
21
|
+
[ngClass]="(form.controls[control.name].touched && form.controls[control.name].errors) ? 'bg-red-100 dark:bg-red-800':''"
|
|
22
|
+
*ngIf="control.type == 'text'" type="text" id="{{ control.name }}_{{ index }}" name="{{ control.name }}"
|
|
23
|
+
[formControlName]="control.name" placeholder="{{ control.placeholder }}" [(ngModel)]="
|
|
24
|
+
control.value ? control.value : model && model[control.name]
|
|
25
|
+
"
|
|
26
|
+
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" />
|
|
27
|
+
<!--PASSWORD-->
|
|
28
|
+
<input class="relative"
|
|
29
|
+
[ngClass]="(form.controls[control.name].touched && form.controls[control.name].errors) ? 'bg-red-100 dark:bg-red-800':''"
|
|
30
|
+
*ngIf="control.type == 'password'" type="password" id="{{ control.name }}_{{ index }}"
|
|
31
|
+
name="{{ control.name }}" [formControlName]="control.name" placeholder="{{ control.placeholder }}"
|
|
32
|
+
[(ngModel)]="
|
|
33
|
+
control.value ? control.value : model && model[control.name]
|
|
34
|
+
"
|
|
35
|
+
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" />
|
|
36
|
+
|
|
37
|
+
<!--TEXT AREA-->
|
|
38
|
+
<textarea class="relative"
|
|
39
|
+
[ngClass]="(form.controls[control.name].touched && form.controls[control.name].errors) ? 'bg-red-100 dark:bg-red-800':''"
|
|
40
|
+
*ngIf="control.type == 'textArea'" id="{{ control.name }}_{{ index }}" name="{{ control.name }}"
|
|
41
|
+
[formControlName]="control.name" placeholder="{{ control.placeholder }}" [(ngModel)]="
|
|
42
|
+
control.value ? control.value : model && model[control.name]
|
|
43
|
+
"
|
|
44
|
+
class="h-11 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"></textarea>
|
|
45
|
+
<!--NUMBER-->
|
|
46
|
+
<input class="relative"
|
|
47
|
+
[ngClass]="(form.controls[control.name].touched && form.controls[control.name].errors) ? 'bg-red-100 dark:bg-red-800':''"
|
|
48
|
+
*ngIf="control.type == 'number'" type="number" id="{{ control.name }}_{{ index }}"
|
|
49
|
+
name="{{ control.name }}" [formControlName]="control.name" placeholder="{{ control.placeholder }}"
|
|
50
|
+
[(ngModel)]="
|
|
51
|
+
control.value ? control.value : model && model[control.name]
|
|
52
|
+
"
|
|
53
|
+
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" />
|
|
54
|
+
<!--DATE-->
|
|
55
|
+
<input class="relative"
|
|
56
|
+
[ngClass]="(form.controls[control.name].touched && form.controls[control.name].errors) ? 'bg-red-200 dark:bg-red-800':''"
|
|
57
|
+
*ngIf="control.type == 'date'" type="date" id="{{ control.name }}_{{ index }}" name="{{ control.name }}"
|
|
58
|
+
[formControlName]="control.name" placeholder="{{ control.placeholder }}" [ngModel]="
|
|
59
|
+
control.value
|
|
60
|
+
? (control.value | date : 'yyyy-MM-dd')
|
|
61
|
+
: (model && model[control.name] | date : 'yyyy-MM-dd')
|
|
62
|
+
" (ngModelChange)="
|
|
63
|
+
control.value
|
|
64
|
+
? (control.value = $event)
|
|
65
|
+
: (model[control.name] = $event)
|
|
66
|
+
"
|
|
67
|
+
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" />
|
|
68
|
+
<!--SearchSelect-->
|
|
69
|
+
<app-chr-search-select class="relative"
|
|
70
|
+
[ngClass]="(form.controls[control.name].touched && form.controls[control.name].errors) ? '[&_input]:!bg-red-100 dark:[&_input]:!bg-red-800':''"
|
|
71
|
+
*ngIf="control.type == 'searchSelect'" id="{{ control.name }}_{{ index }}" [data]="control.data || []"
|
|
72
|
+
[display]="control.fn!" [placeholder]="control.placeholder" [(model)]="
|
|
73
|
+
control.value ? control.value : model && model[control.name]
|
|
74
|
+
" [filters]="control.filters" [formControlName]="control.name"></app-chr-search-select>
|
|
75
|
+
<span *ngIf="control.icon"
|
|
76
|
+
[ngClass]="control.iconCallbackDisabled ? 'text-gray-400 dark:text-gray-500':'text-gray-900 dark:text-white'"
|
|
77
|
+
class="absolute p-2.5 bottom-0 right-0" [matTooltip]="control.iconTooltip || ''"
|
|
78
|
+
matTooltipPosition="above"
|
|
79
|
+
(click)="!control.iconCallbackDisabled && control.iconCallback?.(form.controls[control.name].value)"><mat-icon
|
|
80
|
+
class="flex justify-center align-middle items-center content-center text-lg">{{control.icon}}</mat-icon></span>
|
|
81
|
+
<div *ngFor="let validation of control.validations" class="h-0">
|
|
82
|
+
<mat-error *ngIf="
|
|
83
|
+
form.controls[control.name].touched &&
|
|
84
|
+
form.hasError(validation.rule.toLowerCase(), control.name)
|
|
85
|
+
">{{ validation.display }}</mat-error>
|
|
86
|
+
</div>
|
|
87
|
+
<span *ngIf="control.span && (!form.controls[control.name].errors || !form.controls[control.name].touched)"
|
|
88
|
+
class="h-0 text-xs text-gray-600 dark:text-gray-300">{{ control.span
|
|
89
|
+
}}</span>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div class="py-4" *ngIf="index != sections.length - 1">
|
|
93
|
+
<hr class="" />
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</fieldset>
|
|
97
|
+
</form>
|
|
98
|
+
</div>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '@angular/material' as mat;
|
|
3
|
+
@import '../../../styles.scss';
|
|
4
|
+
|
|
5
|
+
$color-config: mat.get-color-config($chr-theme);
|
|
6
|
+
$primary-palette: map.get($color-config, 'primary');
|
|
7
|
+
$accent-palette: map.get($color-config, 'accent');
|
|
8
|
+
|
|
9
|
+
table {
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.mat-column-actions {
|
|
14
|
+
text-align: right;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.mat-mdc-header-row {
|
|
18
|
+
background-color: mat.get-color-from-palette($accent-palette, A200);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
::ng-deep .arrow-color .mat-sort-header-arrow {
|
|
22
|
+
color: black;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.bg-primary {
|
|
26
|
+
background-color: mat.get-color-from-palette($primary-palette);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.bg-accent {
|
|
30
|
+
background-color: mat.get-color-from-palette($accent-palette, A200);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
input[type="number"]::-webkit-inner-spin-button,
|
|
34
|
+
input[type="number"]::-webkit-outer-spin-button {
|
|
35
|
+
-webkit-appearance: none !important;
|
|
36
|
+
margin: 0 !important;
|
|
37
|
+
}
|