otimus-library 0.0.18 → 0.0.20
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/README.md +26 -26
- package/ng-package.json +11 -0
- package/package.json +19 -28
- package/src/lib/components/oc-badge/oc-badge.component.html +7 -0
- package/src/lib/components/oc-badge/oc-badge.component.scss +125 -0
- package/src/lib/components/oc-badge/oc-badge.component.ts +22 -0
- package/src/lib/components/oc-chip/oc-chip.component.html +19 -0
- package/src/lib/components/oc-chip/oc-chip.component.scss +88 -0
- package/src/lib/components/oc-chip/oc-chip.component.ts +21 -0
- package/src/lib/components/oc-filter/oc-filter.component.html +20 -0
- package/src/lib/components/oc-filter/oc-filter.component.scss +78 -0
- package/src/lib/components/oc-filter/oc-filter.component.spec.ts +23 -0
- package/src/lib/components/oc-filter/oc-filter.component.ts +21 -0
- package/src/lib/components/oc-input/oc-input.component.html +12 -0
- package/src/lib/components/oc-input/oc-input.component.scss +114 -0
- package/src/lib/components/oc-input/oc-input.component.ts +31 -0
- package/src/lib/components/oc-key-value/oc-key-value.component.html +10 -0
- package/src/lib/components/oc-key-value/oc-key-value.component.scss +24 -0
- package/src/lib/components/oc-key-value/oc-key-value.component.spec.ts +23 -0
- package/src/lib/components/oc-key-value/oc-key-value.component.ts +14 -0
- package/src/lib/components/oc-menu/oc-menu.component.html +12 -0
- package/src/lib/components/oc-menu/oc-menu.component.scss +49 -0
- package/src/lib/components/oc-menu/oc-menu.component.spec.ts +23 -0
- package/src/lib/components/oc-menu/oc-menu.component.ts +24 -0
- package/src/lib/components/oc-modal/oc-modal.component.html +16 -0
- package/src/lib/components/oc-modal/oc-modal.component.scss +159 -0
- package/src/lib/components/oc-modal/oc-modal.component.spec.ts +23 -0
- package/src/lib/components/oc-modal/oc-modal.component.ts +29 -0
- package/src/lib/components/oc-table/oc-table.component.html +10 -0
- package/src/lib/components/oc-table/oc-table.component.scss +3 -0
- package/src/lib/components/oc-table/oc-table.component.ts +24 -0
- package/src/lib/directives/oc-tooltip/oc-tooltip.directive.ts +67 -0
- package/src/lib/otimus-library.component.ts +16 -0
- package/src/lib/otimus-library.service.ts +9 -0
- package/src/public-api.ts +15 -0
- package/{styles → src/styles}/components/buttons.scss +201 -201
- package/src/styles/styles.scss +1 -0
- package/{styles → src/styles}/variables.scss +46 -46
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/assets/iconfont/MaterialIcons-Outlined.woff2 +0 -0
- package/assets/iconfont/MaterialIcons-Regular.eot +0 -0
- package/assets/iconfont/MaterialIcons-Regular.ijmap +0 -1
- package/assets/iconfont/MaterialIcons-Regular.svg +0 -2373
- package/assets/iconfont/MaterialIcons-Regular.ttf +0 -0
- package/assets/iconfont/MaterialIcons-Regular.woff +0 -0
- package/assets/iconfont/MaterialIcons-Regular.woff2 +0 -0
- package/assets/iconfont/README.md +0 -9
- package/assets/iconfont/material-icons.scss +0 -51
- package/esm2022/lib/components/oc-badge/oc-badge.component.mjs +0 -30
- package/esm2022/lib/components/oc-filter/oc-filter.component.mjs +0 -29
- package/esm2022/lib/components/oc-input/oc-input.component.mjs +0 -33
- package/esm2022/lib/components/oc-key-value/oc-key-value.component.mjs +0 -19
- package/esm2022/lib/components/oc-modal/oc-modal.component.mjs +0 -35
- package/esm2022/lib/components/oc-table/oc-table.component.mjs +0 -29
- package/esm2022/lib/directives/oc-tooltip/oc-tooltip.directive.mjs +0 -76
- package/esm2022/lib/otimus-library.component.mjs +0 -19
- package/esm2022/lib/otimus-library.service.mjs +0 -14
- package/esm2022/otimus-library.mjs +0 -5
- package/esm2022/public-api.mjs +0 -13
- package/fesm2022/otimus-library.mjs +0 -270
- package/fesm2022/otimus-library.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/components/oc-badge/oc-badge.component.d.ts +0 -11
- package/lib/components/oc-filter/oc-filter.component.d.ts +0 -10
- package/lib/components/oc-input/oc-input.component.d.ts +0 -10
- package/lib/components/oc-key-value/oc-key-value.component.d.ts +0 -7
- package/lib/components/oc-modal/oc-modal.component.d.ts +0 -10
- package/lib/components/oc-table/oc-table.component.d.ts +0 -10
- package/lib/directives/oc-tooltip/oc-tooltip.directive.d.ts +0 -15
- package/lib/otimus-library.component.d.ts +0 -5
- package/lib/otimus-library.service.d.ts +0 -6
- package/public-api.d.ts +0 -9
- package/styles/styles.scss +0 -2
- /package/{styles → src/styles}/components/index.scss +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { AfterViewInit, Component, ElementRef, Input, Renderer2, ViewEncapsulation } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'oc-input',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [CommonModule],
|
|
8
|
+
templateUrl: './oc-input.component.html',
|
|
9
|
+
styleUrls: ['./oc-input.component.scss'],
|
|
10
|
+
encapsulation: ViewEncapsulation.None
|
|
11
|
+
})
|
|
12
|
+
export class OcInputComponent implements AfterViewInit {
|
|
13
|
+
@Input() ocError?: string;
|
|
14
|
+
@Input() ocSize?: 'small' | 'medium' | 'large' = 'medium';
|
|
15
|
+
@Input() ocPlaceholder: string = '';
|
|
16
|
+
inputId: string = `oc-${Math.random()}`;
|
|
17
|
+
|
|
18
|
+
constructor(private el: ElementRef, private renderer: Renderer2) {}
|
|
19
|
+
|
|
20
|
+
ngAfterViewInit() {
|
|
21
|
+
const inputBox = this.el.nativeElement;
|
|
22
|
+
|
|
23
|
+
if (inputBox) {
|
|
24
|
+
const inputElement = inputBox.querySelector('input');
|
|
25
|
+
|
|
26
|
+
if (inputElement) {
|
|
27
|
+
this.renderer.setAttribute(inputElement, 'placeholder', '');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@use '../../../styles/variables.scss';
|
|
2
|
+
|
|
3
|
+
.oc-key-value{
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: 0.5rem;
|
|
7
|
+
|
|
8
|
+
font-size: 1rem;
|
|
9
|
+
|
|
10
|
+
p{
|
|
11
|
+
color: variables.$color-gray-2;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
span{
|
|
16
|
+
color: variables.$color-brand-p-1;
|
|
17
|
+
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.material-symbols-outlined{
|
|
22
|
+
color: variables.$color-brand-p-1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { OcKeyValueComponent } from './oc-key-value.component';
|
|
4
|
+
|
|
5
|
+
describe('OcKeyValueComponent', () => {
|
|
6
|
+
let component: OcKeyValueComponent;
|
|
7
|
+
let fixture: ComponentFixture<OcKeyValueComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [OcKeyValueComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(OcKeyValueComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'oc-key-value',
|
|
5
|
+
standalone: true,
|
|
6
|
+
imports: [],
|
|
7
|
+
templateUrl: './oc-key-value.component.html',
|
|
8
|
+
styleUrl: './oc-key-value.component.scss',
|
|
9
|
+
encapsulation: ViewEncapsulation.None
|
|
10
|
+
})
|
|
11
|
+
export class OcKeyValueComponent {
|
|
12
|
+
@Input() ocKey: string = ''
|
|
13
|
+
@Input() ocValue: string = ''
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<div class="oc-menu-container">
|
|
2
|
+
<div [cdkMenuTriggerFor]="menu" class="oc-menu-btn">
|
|
3
|
+
<ng-content select="[trigger]"></ng-content>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<ng-template #menu>
|
|
7
|
+
<div class="oc-menu" cdkMenu>
|
|
8
|
+
<ng-content select="[menu]">
|
|
9
|
+
</ng-content>
|
|
10
|
+
</div>
|
|
11
|
+
</ng-template>
|
|
12
|
+
</div>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@use '../../../styles/variables.scss';
|
|
2
|
+
|
|
3
|
+
.oc-menu-btn{
|
|
4
|
+
padding: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
::ng-deep {
|
|
11
|
+
.oc-menu{
|
|
12
|
+
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
border-radius: 0px 8px 8px 8px;
|
|
16
|
+
background-color: variables.$color-gray-6;
|
|
17
|
+
border: 1px solid variables.$color-white;
|
|
18
|
+
max-width: 400px;
|
|
19
|
+
|
|
20
|
+
position: absolute;
|
|
21
|
+
|
|
22
|
+
box-shadow: 0px 4px 8.7px 0px rgba(0, 0, 0, 0.13);
|
|
23
|
+
|
|
24
|
+
>div {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
a, button, p, span, b, small, h1,h2,h3,h4,h5,h6 {
|
|
30
|
+
color: variables.$color-gray-3 ;
|
|
31
|
+
|
|
32
|
+
font-size: 1rem;
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
text-align: left;
|
|
35
|
+
|
|
36
|
+
border: none;
|
|
37
|
+
padding: 0.6rem;
|
|
38
|
+
padding-right: 1.5rem;
|
|
39
|
+
background-color: transparent ;
|
|
40
|
+
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
|
|
43
|
+
&:hover{
|
|
44
|
+
filter: brightness(0.8);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { OcMenuComponent } from './oc-menu.component';
|
|
4
|
+
|
|
5
|
+
describe('OcMenuComponent', () => {
|
|
6
|
+
let component: OcMenuComponent;
|
|
7
|
+
let fixture: ComponentFixture<OcMenuComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [OcMenuComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(OcMenuComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AfterContentInit, Component, ContentChildren, QueryList, ElementRef, Renderer2 } from '@angular/core';
|
|
2
|
+
import { CdkMenuItem, CdkMenuModule } from '@angular/cdk/menu';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'oc-menu',
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [CommonModule, CdkMenuModule],
|
|
9
|
+
templateUrl: './oc-menu.component.html',
|
|
10
|
+
styleUrls: ['./oc-menu.component.scss']
|
|
11
|
+
})
|
|
12
|
+
export class OcMenuComponent implements AfterContentInit {
|
|
13
|
+
@ContentChildren(CdkMenuItem, { descendants: true }) menuItems!: QueryList<CdkMenuItem>;
|
|
14
|
+
|
|
15
|
+
constructor(private renderer: Renderer2, private el: ElementRef) {}
|
|
16
|
+
|
|
17
|
+
ngAfterContentInit() {
|
|
18
|
+
if (this.menuItems) {
|
|
19
|
+
this.menuItems.forEach(item => {
|
|
20
|
+
this.renderer.setAttribute(item._elementRef.nativeElement, 'cdkMenuItem', '');
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<div class="oc-modal-bg" *ngIf="isOpen" [ngClass]="{'closing-bg': closing}">
|
|
2
|
+
<div class="oc-modal" [ngClass]="{large: ocSize === 'large', medium: ocSize === 'medium', small: ocSize === 'small', closing: closing}">
|
|
3
|
+
<header class="oc-modal-header">
|
|
4
|
+
<h3 *ngIf="ocTitle.trim().length > 0">{{ocTitle}}</h3>
|
|
5
|
+
<button (click)="close()" class="oc-close-btn">
|
|
6
|
+
<span class="material-symbols-outlined md-18" title="Fechar">close</span>
|
|
7
|
+
</button>
|
|
8
|
+
</header>
|
|
9
|
+
<div class="oc-modal-content">
|
|
10
|
+
<ng-content></ng-content>
|
|
11
|
+
</div>
|
|
12
|
+
<footer class="oc-modal-footer">
|
|
13
|
+
<ng-content select="[footer]"></ng-content>
|
|
14
|
+
</footer>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
@use '../../../styles/variables.scss';
|
|
2
|
+
@import '../../../styles/styles.scss';
|
|
3
|
+
|
|
4
|
+
*{
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.oc-modal-bg{
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
|
|
13
|
+
padding: 1rem;
|
|
14
|
+
|
|
15
|
+
background-color: rgba($color: #000000, $alpha: 0.5);
|
|
16
|
+
|
|
17
|
+
position: fixed;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
|
|
23
|
+
z-index: 20;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
.oc-modal{
|
|
28
|
+
animation: show-up-modal 0.3s ease;
|
|
29
|
+
|
|
30
|
+
width: 100%;
|
|
31
|
+
|
|
32
|
+
padding: 1rem;
|
|
33
|
+
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
justify-content: space-between;
|
|
37
|
+
|
|
38
|
+
background-color: variables.$color-gray-6;
|
|
39
|
+
|
|
40
|
+
border-radius: 1rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.oc-modal-footer {
|
|
44
|
+
width: 100%;
|
|
45
|
+
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: flex-end;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: .5rem;
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.oc-modal-content{
|
|
54
|
+
margin: 0;
|
|
55
|
+
padding: 0;
|
|
56
|
+
margin-bottom: 2rem;
|
|
57
|
+
|
|
58
|
+
max-height: 80vh;
|
|
59
|
+
overflow-y: auto;
|
|
60
|
+
overflow-x: hidden;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.oc-modal-header{
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: space-between;
|
|
67
|
+
|
|
68
|
+
padding: 0;
|
|
69
|
+
margin: 0;
|
|
70
|
+
|
|
71
|
+
position: sticky;
|
|
72
|
+
top: 0;
|
|
73
|
+
width: 100%;
|
|
74
|
+
|
|
75
|
+
h3{
|
|
76
|
+
margin: 0;
|
|
77
|
+
padding: 0;
|
|
78
|
+
margin-bottom: 2rem;
|
|
79
|
+
|
|
80
|
+
font-size: 1.5rem;
|
|
81
|
+
color: variables.$color-gray-1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.oc-close-btn{
|
|
85
|
+
margin: 0;
|
|
86
|
+
margin-right: .5rem;
|
|
87
|
+
padding: 0;
|
|
88
|
+
border: none;
|
|
89
|
+
border-radius: 50%;
|
|
90
|
+
|
|
91
|
+
background-color: transparent;
|
|
92
|
+
|
|
93
|
+
transition: 0.15s ease;
|
|
94
|
+
|
|
95
|
+
color: variables.$color-gray-4;
|
|
96
|
+
|
|
97
|
+
width: 15px;
|
|
98
|
+
height: 15px;
|
|
99
|
+
|
|
100
|
+
border-radius: 50%;
|
|
101
|
+
transition: 0.15s ease;
|
|
102
|
+
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
|
|
105
|
+
span{
|
|
106
|
+
transition: .15s ease;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&:hover{
|
|
110
|
+
span{
|
|
111
|
+
color: variables.$color-gray-3;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
position: absolute;
|
|
116
|
+
top: 0;
|
|
117
|
+
right: 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.small {
|
|
122
|
+
width: 400px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.medium {
|
|
126
|
+
width: 600px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.large {
|
|
130
|
+
width: 800px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.closing{
|
|
134
|
+
animation: closeModal .15s ease;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.closing-bg{
|
|
138
|
+
transition: .1s ease;
|
|
139
|
+
opacity: 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@keyframes show-up-modal {
|
|
143
|
+
from{
|
|
144
|
+
opacity: 0.5;
|
|
145
|
+
transform: scale(0.8);
|
|
146
|
+
}to {
|
|
147
|
+
opacity: 1;
|
|
148
|
+
transform: scale(1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@keyframes closeModal {
|
|
153
|
+
from{
|
|
154
|
+
opacity: 1;
|
|
155
|
+
}to{
|
|
156
|
+
opacity: 0.5;
|
|
157
|
+
transform: scale(0.5);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { OcModalComponent } from './oc-modal.component';
|
|
4
|
+
|
|
5
|
+
describe('OcModalComponent', () => {
|
|
6
|
+
let component: OcModalComponent;
|
|
7
|
+
let fixture: ComponentFixture<OcModalComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [OcModalComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(OcModalComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, ContentChild, ElementRef, Input } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'oc-modal',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [CommonModule],
|
|
8
|
+
templateUrl: './oc-modal.component.html',
|
|
9
|
+
styleUrl: './oc-modal.component.scss'
|
|
10
|
+
})
|
|
11
|
+
export class OcModalComponent {
|
|
12
|
+
@Input() ocTitle: string = ''
|
|
13
|
+
@Input() ocSize: 'small' | 'medium' |'large' = 'medium'
|
|
14
|
+
|
|
15
|
+
isOpen: boolean = false
|
|
16
|
+
|
|
17
|
+
closing: boolean = false
|
|
18
|
+
|
|
19
|
+
open() {
|
|
20
|
+
this.isOpen = true
|
|
21
|
+
}
|
|
22
|
+
close() {
|
|
23
|
+
this.closing = true
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
this.isOpen = false
|
|
26
|
+
this.closing = false
|
|
27
|
+
},100)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<table cdk-table [dataSource]="dataSource">
|
|
2
|
+
|
|
3
|
+
<ng-container *ngFor="let column of columns; let i = index" [cdkColumnDef]="column">
|
|
4
|
+
<th cdk-header-cell *cdkHeaderCellDef> {{column}} </th>
|
|
5
|
+
<td cdk-cell *cdkCellDef="let row"> {{row[keys[i]]}} </td>
|
|
6
|
+
</ng-container>
|
|
7
|
+
|
|
8
|
+
<tr cdk-header-row *cdkHeaderRowDef="columns"></tr>
|
|
9
|
+
<tr cdk-row *cdkRowDef="let row; columns: columns"></tr>
|
|
10
|
+
</table>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import {CdkTableModule} from '@angular/cdk/table'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'oc-table',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [CommonModule, CdkTableModule],
|
|
10
|
+
templateUrl: './oc-table.component.html',
|
|
11
|
+
styleUrls: ['./oc-table.component.scss']
|
|
12
|
+
})
|
|
13
|
+
export class OcTableComponent implements OnInit {
|
|
14
|
+
|
|
15
|
+
@Input() columns: string[] = []
|
|
16
|
+
@Input() dataSource: any[] = []
|
|
17
|
+
keys: string[] = []
|
|
18
|
+
|
|
19
|
+
ngOnInit(): void {
|
|
20
|
+
if(!this.dataSource.length) return
|
|
21
|
+
|
|
22
|
+
this.keys = Object.keys(this.dataSource[0])
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Directive, ElementRef, HostListener, Input, Renderer2 } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Directive({
|
|
4
|
+
selector: '[ocTooltip]',
|
|
5
|
+
standalone: true
|
|
6
|
+
})
|
|
7
|
+
export class OcTooltipDirective {
|
|
8
|
+
constructor(private elRef: ElementRef, private renderer: Renderer2) { }
|
|
9
|
+
|
|
10
|
+
@Input() content: string = ''
|
|
11
|
+
@Input() side: 'bottom' | 'upon' | 'left' | 'right' = 'bottom'
|
|
12
|
+
|
|
13
|
+
created:boolean = false
|
|
14
|
+
|
|
15
|
+
createToolTip() {
|
|
16
|
+
if(this.created) return
|
|
17
|
+
|
|
18
|
+
const tooltip = this.renderer.createElement('div')
|
|
19
|
+
const text = this.renderer.createText(this.content)
|
|
20
|
+
|
|
21
|
+
this.renderer.appendChild(tooltip, text)
|
|
22
|
+
this.renderer.setStyle(tooltip, 'margin', '0')
|
|
23
|
+
this.renderer.addClass(tooltip, 'oc-tooltip')
|
|
24
|
+
this.renderer.setStyle(tooltip, 'position', 'absolute')
|
|
25
|
+
this.renderer.setStyle(tooltip, 'padding', '0.4rem 0.8rem')
|
|
26
|
+
this.renderer.setStyle(tooltip, 'font-size', '0.9rem')
|
|
27
|
+
this.renderer.setStyle(tooltip, 'font-weight', '600')
|
|
28
|
+
this.renderer.setStyle(tooltip, 'color', '#7E8485')
|
|
29
|
+
this.renderer.setStyle(tooltip, 'border', '1px solid #FFFFFF')
|
|
30
|
+
this.renderer.setStyle(tooltip, 'background-color', '#F8F9FF')
|
|
31
|
+
this.renderer.setStyle(tooltip, 'border-radius','1rem')
|
|
32
|
+
this.renderer.setStyle(tooltip, 'box-shadow', '0px 3px 6.5px 0px rgba(0, 0, 0, 0.20)')
|
|
33
|
+
this.renderer.setStyle(tooltip, 'transition', '0.1s ease')
|
|
34
|
+
this.renderer.setStyle(tooltip, 'max-width', '400px')
|
|
35
|
+
|
|
36
|
+
const width = this.elRef.nativeElement.offsetWidth
|
|
37
|
+
const height = this.elRef.nativeElement.offsetHeight
|
|
38
|
+
|
|
39
|
+
this.renderer.setStyle(tooltip, 'transform', `translateY(${height - 10}px)`)
|
|
40
|
+
|
|
41
|
+
if (this.side === 'right') {
|
|
42
|
+
this.renderer.setStyle(tooltip, 'transform', `translateX(${width + 20}px) translateY(-50%)`)
|
|
43
|
+
} else if (this.side === 'left') {
|
|
44
|
+
this.renderer.setStyle(tooltip, 'transform', `translateX(-${width + 20}px) translateY(-50%)`)
|
|
45
|
+
} else if (this.side === 'upon') {
|
|
46
|
+
this.renderer.setStyle(tooltip, 'transform', `translateY(-${height + 40}px)`)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
this.created = true
|
|
50
|
+
return tooltip
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@HostListener('mouseover')
|
|
54
|
+
onMouseOver() {
|
|
55
|
+
const tooltip = this.createToolTip()
|
|
56
|
+
this.renderer.appendChild(this.elRef.nativeElement, tooltip)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@HostListener('mouseout')
|
|
60
|
+
onMouseOut() {
|
|
61
|
+
const tooltip = this.elRef.nativeElement.querySelector('.oc-tooltip')
|
|
62
|
+
if(tooltip){
|
|
63
|
+
this.renderer.removeChild(this.elRef.nativeElement, tooltip)
|
|
64
|
+
this.created = false
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'lib-otimus-library',
|
|
5
|
+
standalone: true,
|
|
6
|
+
imports: [],
|
|
7
|
+
template: `
|
|
8
|
+
<p>
|
|
9
|
+
otimus-library works!
|
|
10
|
+
</p>
|
|
11
|
+
`,
|
|
12
|
+
styles: ``
|
|
13
|
+
})
|
|
14
|
+
export class OtimusLibraryComponent {
|
|
15
|
+
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* Public API Surface of otimus-library
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export * from './lib/otimus-library.service'
|
|
7
|
+
export * from './lib/otimus-library.component'
|
|
8
|
+
export * from './lib/components/oc-table/oc-table.component'
|
|
9
|
+
export * from './lib/components/oc-badge/oc-badge.component'
|
|
10
|
+
export * from './lib/components/oc-filter/oc-filter.component'
|
|
11
|
+
export * from './lib/directives/oc-tooltip/oc-tooltip.directive'
|
|
12
|
+
export * from './lib/components/oc-input/oc-input.component'
|
|
13
|
+
export * from './lib/components/oc-modal/oc-modal.component'
|
|
14
|
+
export * from './lib/components/oc-key-value/oc-key-value.component'
|
|
15
|
+
export * from './lib/components/oc-chip/oc-chip.component'
|