otimus-library 0.2.45 → 0.2.47
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 +12 -0
- package/package.json +4 -13
- package/src/assets/images/loading.svg +0 -0
- package/src/assets/images/not-found-bg.jpg +0 -0
- package/src/lib/components/oc-accordion/oc-accordion.component.html +3 -0
- package/src/lib/components/oc-accordion/oc-accordion.component.scss +4 -0
- package/src/lib/components/oc-accordion/oc-accordion.component.ts +44 -0
- package/src/lib/components/oc-accordion-item/oc-accordion-item.component.html +19 -0
- package/src/lib/components/oc-accordion-item/oc-accordion-item.component.scss +86 -0
- package/src/lib/components/oc-accordion-item/oc-accordion-item.component.ts +27 -0
- package/src/lib/components/oc-accordion-item/styles/oc-accordion-item.shui-component.scss +41 -0
- package/src/lib/components/oc-autocomplete/oc-autocomplete.component.html +66 -0
- package/src/lib/components/oc-autocomplete/oc-autocomplete.component.scss +157 -0
- package/src/lib/components/oc-autocomplete/oc-autocomplete.component.ts +277 -0
- 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-checkbox/oc-checkbox.component.html +30 -0
- package/src/lib/components/oc-checkbox/oc-checkbox.component.scss +103 -0
- package/src/lib/components/oc-checkbox/oc-checkbox.component.ts +132 -0
- package/src/lib/components/oc-checkbox/styles/oc-checkbox.shui-component.scss +21 -0
- package/src/lib/components/oc-chip/oc-chip.component.html +20 -0
- package/src/lib/components/oc-chip/oc-chip.component.scss +102 -0
- package/src/lib/components/oc-chip/oc-chip.component.ts +32 -0
- package/src/lib/components/oc-filter/oc-filter.component.html +22 -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 +30 -0
- package/src/lib/components/oc-input/oc-input.component.html +21 -0
- package/src/lib/components/oc-input/oc-input.component.scss +3 -0
- package/src/lib/components/oc-input/oc-input.component.ts +100 -0
- package/src/lib/components/oc-key-value/oc-key-value.component.html +12 -0
- package/src/lib/components/oc-key-value/oc-key-value.component.scss +26 -0
- package/src/lib/components/oc-key-value/oc-key-value.component.ts +23 -0
- package/src/lib/components/oc-key-value/styles/oc-key-value.shui-component.scss +26 -0
- package/src/lib/components/oc-log/oc-log.component.html +18 -0
- package/src/lib/components/oc-log/oc-log.component.scss +61 -0
- package/src/lib/components/oc-log/oc-log.component.ts +15 -0
- package/src/lib/components/oc-menu/oc-menu.component.html +31 -0
- package/src/lib/components/oc-menu/oc-menu.component.scss +101 -0
- package/src/lib/components/oc-menu/oc-menu.component.ts +84 -0
- package/src/lib/components/oc-modal/oc-modal.component.html +54 -0
- package/src/lib/components/oc-modal/oc-modal.component.scss +204 -0
- package/src/lib/components/oc-modal/oc-modal.component.ts +82 -0
- package/src/lib/components/oc-modal/styles/oc-modal.shui-component.scss +3 -0
- package/src/lib/components/oc-modal-footer/oc-modal-footer.component.html +11 -0
- package/src/lib/components/oc-modal-footer/oc-modal-footer.component.scss +27 -0
- package/src/lib/components/oc-modal-footer/oc-modal-footer.component.ts +15 -0
- package/src/lib/components/oc-not-found/oc-not-found.component.html +14 -0
- package/src/lib/components/oc-not-found/oc-not-found.component.scss +153 -0
- package/src/lib/components/oc-not-found/oc-not-found.component.spec.ts +23 -0
- package/src/lib/components/oc-not-found/oc-not-found.component.ts +12 -0
- package/src/lib/components/oc-pagination/oc-pagination.component.html +32 -0
- package/src/lib/components/oc-pagination/oc-pagination.component.scss +80 -0
- package/src/lib/components/oc-pagination/oc-pagination.component.ts +46 -0
- package/src/lib/components/oc-profile/oc-profile.component.html +17 -0
- package/src/lib/components/oc-profile/oc-profile.component.scss +80 -0
- package/src/lib/components/oc-profile/oc-profile.component.ts +38 -0
- package/src/lib/components/oc-step/oc-step.component.html +32 -0
- package/src/lib/components/oc-step/oc-step.component.scss +106 -0
- package/src/lib/components/oc-step/oc-step.component.ts +39 -0
- package/src/lib/components/oc-step/styles/oc-step.shui-component.scss +52 -0
- package/src/lib/components/oc-stepper/oc-stepper.component.html +3 -0
- package/src/lib/components/oc-stepper/oc-stepper.component.scss +9 -0
- package/src/lib/components/oc-stepper/oc-stepper.component.ts +86 -0
- package/src/lib/components/oc-tab/oc-tab.component.html +3 -0
- package/src/lib/components/oc-tab/oc-tab.component.scss +0 -0
- package/src/lib/components/oc-tab/oc-tab.component.ts +15 -0
- package/src/lib/components/oc-table/oc-table.component.html +62 -0
- package/src/lib/components/oc-table/oc-table.component.scss +2 -0
- package/src/lib/components/oc-table/oc-table.component.ts +51 -0
- package/src/lib/components/oc-tabs/oc-tabs.component.html +13 -0
- package/src/lib/components/oc-tabs/oc-tabs.component.scss +47 -0
- package/src/lib/components/oc-tabs/oc-tabs.component.ts +46 -0
- package/src/lib/components/oc-tabs/styles/oc-tabs.shui-component.scss +25 -0
- package/src/lib/components/oc-toast/oc-toast.component.html +46 -0
- package/src/lib/components/oc-toast/oc-toast.component.scss +133 -0
- package/src/lib/components/oc-toast/oc-toast.component.ts +15 -0
- package/src/lib/components/oc-toggle/oc-toggle.component.html +4 -0
- package/src/lib/components/oc-toggle/oc-toggle.component.scss +73 -0
- package/src/lib/components/oc-toggle/oc-toggle.component.spec.ts +23 -0
- package/src/lib/components/oc-toggle/oc-toggle.component.ts +32 -0
- package/src/lib/directives/oc-tooltip/oc-tooltip.directive.ts +108 -0
- package/src/lib/interfaces/internal/languages.ts +16 -0
- package/src/lib/interfaces/oc-autocomplete.ts +6 -0
- package/src/lib/interfaces/oc-menu.ts +10 -0
- package/src/lib/interfaces/oc-style-theme.ts +3 -0
- package/src/lib/interfaces/oc-table.ts +12 -0
- package/src/lib/interfaces/oc-toast.ts +8 -0
- package/src/lib/otimus-library.component.ts +16 -0
- package/src/lib/otimus-library.service.ts +9 -0
- package/src/lib/services/internationalization.service.ts +73 -0
- package/src/lib/services/oc-toast.service.ts +107 -0
- package/src/lib/services/style-theme.service.ts +19 -0
- package/src/public-api.ts +30 -0
- package/{styles → src/styles}/colors.scss +70 -70
- package/{styles → src/styles}/components/buttons/buttons.scss +225 -225
- package/{styles → src/styles}/components/buttons/buttons.shui.scss +61 -61
- package/{styles → src/styles}/components/index.scss +2 -2
- package/{styles → src/styles}/components/inputs/inputs.scss +249 -247
- package/{styles → src/styles}/components/inputs/inputs.shui.scss +212 -212
- package/{styles → src/styles}/components/table/table.scss +69 -69
- package/{styles → src/styles}/components/table/table.shui.scss +50 -50
- package/{styles → src/styles}/components/tooltip.scss +26 -26
- package/{styles → src/styles}/grid.scss +1122 -1122
- package/{styles → src/styles}/patterns/shui/colors.shui.scss +154 -154
- package/{styles → src/styles}/patterns/shui/fonts.shui.scss +65 -65
- package/{styles → src/styles}/patterns/shui/index.shui.scss +24 -24
- package/{styles → src/styles}/patterns/shui/variables.shui.scss +22 -22
- package/{styles → src/styles}/states.scss +5 -5
- package/{styles → src/styles}/styles.scss +46 -46
- package/{styles → src/styles}/variables.scss +47 -47
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/esm2022/lib/components/oc-accordion/oc-accordion.component.mjs +0 -48
- package/esm2022/lib/components/oc-accordion-item/oc-accordion-item.component.mjs +0 -35
- package/esm2022/lib/components/oc-autocomplete/oc-autocomplete.component.mjs +0 -275
- package/esm2022/lib/components/oc-badge/oc-badge.component.mjs +0 -30
- package/esm2022/lib/components/oc-checkbox/oc-checkbox.component.mjs +0 -133
- package/esm2022/lib/components/oc-chip/oc-chip.component.mjs +0 -45
- package/esm2022/lib/components/oc-filter/oc-filter.component.mjs +0 -39
- package/esm2022/lib/components/oc-input/oc-input.component.mjs +0 -97
- package/esm2022/lib/components/oc-key-value/oc-key-value.component.mjs +0 -29
- package/esm2022/lib/components/oc-log/oc-log.component.mjs +0 -22
- package/esm2022/lib/components/oc-menu/oc-menu.component.mjs +0 -81
- package/esm2022/lib/components/oc-modal/oc-modal.component.mjs +0 -85
- package/esm2022/lib/components/oc-modal-footer/oc-modal-footer.component.mjs +0 -23
- package/esm2022/lib/components/oc-not-found/oc-not-found.component.mjs +0 -11
- package/esm2022/lib/components/oc-pagination/oc-pagination.component.mjs +0 -49
- package/esm2022/lib/components/oc-profile/oc-profile.component.mjs +0 -38
- package/esm2022/lib/components/oc-step/oc-step.component.mjs +0 -49
- package/esm2022/lib/components/oc-stepper/oc-stepper.component.mjs +0 -90
- package/esm2022/lib/components/oc-tab/oc-tab.component.mjs +0 -20
- package/esm2022/lib/components/oc-tabs/oc-tabs.component.mjs +0 -42
- package/esm2022/lib/components/oc-toast/oc-toast.component.mjs +0 -17
- package/esm2022/lib/components/oc-toggle/oc-toggle.component.mjs +0 -34
- package/esm2022/lib/directives/oc-tooltip/oc-tooltip.directive.mjs +0 -117
- package/esm2022/lib/interfaces/oc-autocomplete.mjs +0 -2
- package/esm2022/lib/interfaces/oc-menu.mjs +0 -2
- package/esm2022/lib/interfaces/oc-style-theme.mjs +0 -2
- package/esm2022/lib/interfaces/oc-toast.mjs +0 -2
- package/esm2022/lib/otimus-library.component.mjs +0 -19
- package/esm2022/lib/otimus-library.service.mjs +0 -14
- package/esm2022/lib/services/internationalization.service.mjs +0 -68
- package/esm2022/lib/services/oc-toast.service.mjs +0 -81
- package/esm2022/lib/services/style-theme.service.mjs +0 -21
- package/esm2022/otimus-library.mjs +0 -5
- package/esm2022/public-api.mjs +0 -30
- package/fesm2022/otimus-library.mjs +0 -1513
- package/fesm2022/otimus-library.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/components/oc-accordion/oc-accordion.component.d.ts +0 -18
- package/lib/components/oc-accordion-item/oc-accordion-item.component.d.ts +0 -12
- package/lib/components/oc-autocomplete/oc-autocomplete.component.d.ts +0 -68
- package/lib/components/oc-badge/oc-badge.component.d.ts +0 -11
- package/lib/components/oc-checkbox/oc-checkbox.component.d.ts +0 -35
- package/lib/components/oc-chip/oc-chip.component.d.ts +0 -14
- package/lib/components/oc-filter/oc-filter.component.d.ts +0 -17
- package/lib/components/oc-input/oc-input.component.d.ts +0 -31
- package/lib/components/oc-key-value/oc-key-value.component.d.ts +0 -14
- package/lib/components/oc-log/oc-log.component.d.ts +0 -7
- package/lib/components/oc-menu/oc-menu.component.d.ts +0 -20
- package/lib/components/oc-modal/oc-modal.component.d.ts +0 -30
- package/lib/components/oc-modal-footer/oc-modal-footer.component.d.ts +0 -8
- package/lib/components/oc-not-found/oc-not-found.component.d.ts +0 -5
- package/lib/components/oc-pagination/oc-pagination.component.d.ts +0 -14
- package/lib/components/oc-profile/oc-profile.component.d.ts +0 -12
- package/lib/components/oc-step/oc-step.component.d.ts +0 -22
- package/lib/components/oc-stepper/oc-stepper.component.d.ts +0 -24
- package/lib/components/oc-tab/oc-tab.component.d.ts +0 -8
- package/lib/components/oc-tabs/oc-tabs.component.d.ts +0 -18
- package/lib/components/oc-toast/oc-toast.component.d.ts +0 -8
- package/lib/components/oc-toggle/oc-toggle.component.d.ts +0 -12
- package/lib/directives/oc-tooltip/oc-tooltip.directive.d.ts +0 -20
- package/lib/interfaces/oc-autocomplete.d.ts +0 -5
- package/lib/interfaces/oc-menu.d.ts +0 -9
- package/lib/interfaces/oc-style-theme.d.ts +0 -2
- package/lib/interfaces/oc-toast.d.ts +0 -8
- package/lib/otimus-library.component.d.ts +0 -5
- package/lib/otimus-library.service.d.ts +0 -6
- package/lib/services/internationalization.service.d.ts +0 -17
- package/lib/services/oc-toast.service.d.ts +0 -14
- package/lib/services/style-theme.service.d.ts +0 -8
- package/public-api.d.ts +0 -26
- /package/{assets → src/assets}/fonts/siemens/SH-Bree-Headline-Oblique.woff +0 -0
- /package/{assets → src/assets}/fonts/siemens/SH-Bree-Headline-Oblique.woff2 +0 -0
- /package/{assets → src/assets}/fonts/siemens/SH-Bree-Headline-Regular.woff +0 -0
- /package/{assets → src/assets}/fonts/siemens/SH-Bree-Headline-Regular.woff2 +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-Black.woff +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-Black.woff2 +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-BlackItalic.woff +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-BlackItalic.woff2 +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-Bold.woff +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-Bold.woff2 +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-BoldItalic.woff +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-BoldItalic.woff2 +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-Italic.woff +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-Italic.woff2 +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-Roman.woff +0 -0
- /package/{assets → src/assets}/fonts/siemens/SiemensSans-Roman.woff2 +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
@use '../../../styles/variables.scss';
|
|
2
|
+
|
|
3
|
+
/* The switch - the box around the slider */
|
|
4
|
+
.switch {
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
width: 60px;
|
|
8
|
+
height: 33px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Hide default HTML checkbox */
|
|
12
|
+
.switch input {
|
|
13
|
+
opacity: 0;
|
|
14
|
+
width: 0;
|
|
15
|
+
height: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* The slider */
|
|
19
|
+
.slider {
|
|
20
|
+
position: absolute;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
right: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
box-shadow: 0px 0px 20px 0px rgba(0, 221, 163, 0.17);
|
|
27
|
+
background-color: #ccc;
|
|
28
|
+
-webkit-transition: .4s;
|
|
29
|
+
transition: .4s;
|
|
30
|
+
border: 1px solid variables.$color-white;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.slider:before {
|
|
34
|
+
position: absolute;
|
|
35
|
+
content: "";
|
|
36
|
+
height: 26px;
|
|
37
|
+
width: 26px;
|
|
38
|
+
left: 4px;
|
|
39
|
+
bottom: 1.5px;
|
|
40
|
+
background-color: white;
|
|
41
|
+
-webkit-transition: .4s;
|
|
42
|
+
transition: .4s;
|
|
43
|
+
bottom: 2.5px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
input:checked + .slider {
|
|
47
|
+
&.purple {
|
|
48
|
+
background-color: variables.$color-brand-p-1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.green {
|
|
52
|
+
background-color: variables.$color-brand-g-1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
input:focus + .slider {
|
|
57
|
+
box-shadow: 0 0 1px #2196F3;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
input:checked + .slider:before {
|
|
61
|
+
-webkit-transform: translateX(25px);
|
|
62
|
+
-ms-transform: translateX(25px);
|
|
63
|
+
transform: translateX(25px);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Rounded sliders */
|
|
67
|
+
.slider.round {
|
|
68
|
+
border-radius: 34px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.slider.round:before {
|
|
72
|
+
border-radius: 50%;
|
|
73
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { OcToggleComponent } from './oc-toggle.component';
|
|
4
|
+
|
|
5
|
+
describe('OcToggleComponent', () => {
|
|
6
|
+
let component: OcToggleComponent;
|
|
7
|
+
let fixture: ComponentFixture<OcToggleComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [OcToggleComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(OcToggleComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'oc-toggle',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [ CommonModule ],
|
|
8
|
+
templateUrl: './oc-toggle.component.html',
|
|
9
|
+
styleUrl: './oc-toggle.component.scss'
|
|
10
|
+
})
|
|
11
|
+
export class OcToggleComponent {
|
|
12
|
+
_ocChecked: boolean = false;
|
|
13
|
+
|
|
14
|
+
@Input() set ocChecked(value: boolean) {
|
|
15
|
+
this._ocChecked = value
|
|
16
|
+
this.ocCheckedChange.emit(this._ocChecked)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get ocChecked() {
|
|
20
|
+
return this._ocChecked
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@Input() ocColor: 'purple' | 'green' = 'green';
|
|
24
|
+
|
|
25
|
+
@Output() ocCheckedChange = new EventEmitter<boolean>();
|
|
26
|
+
|
|
27
|
+
toggleChecked() {
|
|
28
|
+
this.ocChecked = !this.ocChecked;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
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(
|
|
9
|
+
private elRef: ElementRef,
|
|
10
|
+
private renderer: Renderer2
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
@Input() content: string = ''
|
|
14
|
+
@Input() side: 'bottom' | 'upon' | 'left' | 'right' | 'top' | 'mouse' = 'mouse'
|
|
15
|
+
|
|
16
|
+
private created: boolean = false
|
|
17
|
+
private tooltip: HTMLElement | null = null
|
|
18
|
+
|
|
19
|
+
createToolTip(): HTMLElement | null {
|
|
20
|
+
if (this.created) {
|
|
21
|
+
return this.tooltip!
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
this.tooltip = this.renderer.createElement('div')
|
|
25
|
+
const htmlRegex = /<([a-z][a-z0-9]*)\b[^>]*>(.*?)<\/\1>/is
|
|
26
|
+
if (htmlRegex.test(this.content)) {
|
|
27
|
+
this.content = this.content.replace('>', ' style="margin: 0">')
|
|
28
|
+
this.renderer.setProperty(this.tooltip, 'innerHTML', this.content)
|
|
29
|
+
} else {
|
|
30
|
+
const text = this.renderer.createText(this.content)
|
|
31
|
+
this.renderer.appendChild(this.tooltip, text)
|
|
32
|
+
this.renderer.setStyle(this.tooltip, 'color', '#7E8485')
|
|
33
|
+
}
|
|
34
|
+
this.renderer.addClass(this.tooltip, 'oc-tooltip')
|
|
35
|
+
if (this.side === 'mouse') {
|
|
36
|
+
this.renderer.addClass(this.tooltip, 'mouse-tracking')
|
|
37
|
+
}
|
|
38
|
+
this.renderer.setStyle(this.tooltip, 'position', 'absolute')
|
|
39
|
+
this.renderer.setStyle(this.tooltip, 'pointer-events', 'none')
|
|
40
|
+
this.renderer.setStyle(this.tooltip, 'z-index', '1000')
|
|
41
|
+
|
|
42
|
+
document.body.appendChild(this.tooltip as any)
|
|
43
|
+
this.created = true
|
|
44
|
+
return this.tooltip
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@HostListener('mouseover', ['$event'])
|
|
48
|
+
onMouseOver(event: MouseEvent): void {
|
|
49
|
+
if (!this.content) {
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
this.tooltip = this.createToolTip()
|
|
53
|
+
this.updateTooltipPosition(event)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
mouseingInterval: any | null = null
|
|
57
|
+
@HostListener('mousemove', ['$event'])
|
|
58
|
+
onMouseMove(event: MouseEvent): void {
|
|
59
|
+
if (this.tooltip) {
|
|
60
|
+
if (this.side === 'mouse') {
|
|
61
|
+
this.updateTooltipPosition(event)
|
|
62
|
+
} else {
|
|
63
|
+
this.positionTooltipFixed()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private updateTooltipPosition(event: MouseEvent): void {
|
|
69
|
+
if (this.tooltip) {
|
|
70
|
+
this.renderer.setStyle(this.tooltip, 'left', `${event.pageX + 12}px`)
|
|
71
|
+
this.renderer.setStyle(this.tooltip, 'top', `${event.pageY + 12}px`)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private positionTooltipFixed(): void {
|
|
76
|
+
if (!this.tooltip) {
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
const rect = this.elRef.nativeElement.getBoundingClientRect()
|
|
80
|
+
const width = this.elRef.nativeElement.offsetWidth
|
|
81
|
+
const height = this.elRef.nativeElement.offsetHeight
|
|
82
|
+
|
|
83
|
+
if (this.side === 'right') {
|
|
84
|
+
this.renderer.setStyle(this.tooltip, 'left', `${rect.right + 10}px`)
|
|
85
|
+
this.renderer.setStyle(this.tooltip, 'top', `${rect.top + height / 2}px`)
|
|
86
|
+
} else if (this.side === 'left') {
|
|
87
|
+
this.renderer.setStyle(this.tooltip, 'left', `${rect.left - this.tooltip.offsetWidth - 10}px`)
|
|
88
|
+
this.renderer.setStyle(this.tooltip, 'top', `${rect.top + height / 2}px`)
|
|
89
|
+
} else if (this.side === 'upon' || this.side === 'top') {
|
|
90
|
+
this.renderer.setStyle(this.tooltip, 'left', `${rect.left + width / 2}px`)
|
|
91
|
+
this.renderer.setStyle(this.tooltip, 'top', `${rect.top - this.tooltip.offsetHeight - 10}px`)
|
|
92
|
+
} else if (this.side === 'bottom') {
|
|
93
|
+
this.renderer.setStyle(this.tooltip, 'left', `${rect.left + width / 2}px`)
|
|
94
|
+
this.renderer.setStyle(this.tooltip, 'top', `${rect.bottom + 10}px`)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@HostListener('mouseout')
|
|
99
|
+
onMouseOut(): void {
|
|
100
|
+
if (this.tooltip) {
|
|
101
|
+
document.body.removeChild(this.tooltip)
|
|
102
|
+
this.created = false
|
|
103
|
+
this.tooltip = null
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
this.mouseingInterval = null
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface LanguageType {
|
|
2
|
+
"id"?: number,
|
|
3
|
+
"code": string,
|
|
4
|
+
"ptbr": string,
|
|
5
|
+
"esch": string,
|
|
6
|
+
"enus": string,
|
|
7
|
+
"createdAt"?: string,
|
|
8
|
+
"updatedAt"?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type AvailableLanguagesType = 'ptbr' | 'esch' | 'enus'
|
|
12
|
+
|
|
13
|
+
export type {
|
|
14
|
+
LanguageType,
|
|
15
|
+
AvailableLanguagesType
|
|
16
|
+
}
|
|
@@ -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,73 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http'
|
|
2
|
+
import { Injectable } from '@angular/core'
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root'
|
|
6
|
+
})
|
|
7
|
+
export class InternationalizationService {
|
|
8
|
+
constructor(private http: HttpClient) { }
|
|
9
|
+
private queryLang: string | null = null
|
|
10
|
+
|
|
11
|
+
getTranslation(
|
|
12
|
+
code: string | number,
|
|
13
|
+
params?: { [key: string]: string | number } | null
|
|
14
|
+
): string {
|
|
15
|
+
code = typeof code === 'number' ? `LIB${code}` : code
|
|
16
|
+
const translations = JSON.parse(localStorage.getItem('@oc-lib-lang_words') || '{}')
|
|
17
|
+
let translation = translations[code] || code
|
|
18
|
+
|
|
19
|
+
if (params) {
|
|
20
|
+
Object.keys(params).forEach((key) => {
|
|
21
|
+
translation = translation.replace(`%{${key}}`, params[key].toString())
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return translation
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getTranslationsByLanguage() {
|
|
29
|
+
const urlParams = new URLSearchParams(window.location.search)
|
|
30
|
+
this.queryLang = urlParams.get('lang')
|
|
31
|
+
if(!this.queryLang) return
|
|
32
|
+
if (!this.canUpdateStoredLanguages()) return
|
|
33
|
+
|
|
34
|
+
return this.http.get<Object>(`https://cms-backend.otimusclinic.com/translations/language?lang=${this.queryLang}`)
|
|
35
|
+
.subscribe(resp => {
|
|
36
|
+
if (!resp || !Object.keys(resp).length) return
|
|
37
|
+
this.setLanguages(resp)
|
|
38
|
+
this.setLanguage(this.queryLang as string)
|
|
39
|
+
this.setUpdatedLastTime()
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
canUpdateStoredLanguages(): boolean {
|
|
44
|
+
const storedLastTime = localStorage.getItem('@oc-lib-stored_at')
|
|
45
|
+
const storedLanguage = localStorage.getItem('language')
|
|
46
|
+
|
|
47
|
+
if (!storedLastTime || !storedLanguage || !this.queryLang) return true
|
|
48
|
+
|
|
49
|
+
let yesterday = new Date()
|
|
50
|
+
yesterday.setDate(yesterday.getDate() - 1)
|
|
51
|
+
|
|
52
|
+
const storedDate = new Date(storedLastTime)
|
|
53
|
+
|
|
54
|
+
if (storedDate <= yesterday || (storedLanguage !== this.queryLang)) {
|
|
55
|
+
return true
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
setLanguage(language: string): void {
|
|
62
|
+
localStorage.setItem('language', language)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
setUpdatedLastTime(): void {
|
|
66
|
+
const updatedLastTime = new Date().toISOString()
|
|
67
|
+
localStorage.setItem('@oc-lib-stored_at', updatedLastTime)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
setLanguages(translations: Object): void {
|
|
71
|
+
localStorage.setItem('@oc-lib-lang_words', JSON.stringify(translations))
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ChangeDetectorRef, Injectable } from '@angular/core'
|
|
2
|
+
import { ToastType } from '../interfaces/oc-toast'
|
|
3
|
+
|
|
4
|
+
type ToastStatusType =
|
|
5
|
+
| 'erro'
|
|
6
|
+
| 'error'
|
|
7
|
+
| 'success'
|
|
8
|
+
| 'éxito'
|
|
9
|
+
| 'sucesso'
|
|
10
|
+
| 'carregando'
|
|
11
|
+
| 'cargando'
|
|
12
|
+
| 'loading'
|
|
13
|
+
| 'informação'
|
|
14
|
+
| 'información'
|
|
15
|
+
| 'information'
|
|
16
|
+
|
|
17
|
+
@Injectable({
|
|
18
|
+
providedIn: 'root',
|
|
19
|
+
})
|
|
20
|
+
export class OcToastService {
|
|
21
|
+
toastList: ToastType[] = []
|
|
22
|
+
isRunning: boolean = false
|
|
23
|
+
currentToast!: ToastType
|
|
24
|
+
|
|
25
|
+
closeToast(id: number): void {
|
|
26
|
+
this.toastList = this.toastList.map((to) => {
|
|
27
|
+
if (to.id === id) {
|
|
28
|
+
return { ...to, counter: 0 }
|
|
29
|
+
}
|
|
30
|
+
return to
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
this.currentToast = this.toastList[0]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
openToast = (
|
|
37
|
+
toastStatus: ToastStatusType,
|
|
38
|
+
toastMessage: string,
|
|
39
|
+
toastCounter?: number,
|
|
40
|
+
promiseKey?: string
|
|
41
|
+
): void => {
|
|
42
|
+
const toast = {
|
|
43
|
+
id: this.toastList.length === 0 ? 1 : this.toastList[this.toastList.length - 1].id + 1,
|
|
44
|
+
counter: toastCounter || 5,
|
|
45
|
+
status: toastStatus,
|
|
46
|
+
message: toastMessage,
|
|
47
|
+
promiseKey,
|
|
48
|
+
hasAnimation: true,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const toastExists = this.toastList.some((to) => {
|
|
52
|
+
return to.status === toastStatus && to.message === toastMessage
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
if (toastExists) {
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const keyExists = this.toastList.find((to) => to.promiseKey === toast.promiseKey)
|
|
60
|
+
|
|
61
|
+
if (keyExists) {
|
|
62
|
+
this.toastList = this.toastList.map((to) => {
|
|
63
|
+
if (to.promiseKey === promiseKey) {
|
|
64
|
+
return { ...toast, hasAnimation: false }
|
|
65
|
+
}
|
|
66
|
+
return to
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
this.toastList.push(toast)
|
|
71
|
+
|
|
72
|
+
if (!this.isRunning) {
|
|
73
|
+
this.renderToasts()
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
renderToasts(): void {
|
|
78
|
+
if (this.toastList.length === 0) {
|
|
79
|
+
this.isRunning = false
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.isRunning = true
|
|
84
|
+
this.currentToast = this.toastList[0]
|
|
85
|
+
|
|
86
|
+
const toastInterval = setInterval(() => {
|
|
87
|
+
if (this.toastList.length === 0) {
|
|
88
|
+
clearInterval(toastInterval)
|
|
89
|
+
this.isRunning = false
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
this.currentToast = this.toastList[0]
|
|
94
|
+
if (this.currentToast.status !== 'carregando') {
|
|
95
|
+
this.currentToast.counter--
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (this.currentToast.counter <= 0) {
|
|
99
|
+
this.toastList = this.toastList.filter((to) => {
|
|
100
|
+
return to.status !== this.currentToast.status && to.message !== this.currentToast.message
|
|
101
|
+
})
|
|
102
|
+
clearInterval(toastInterval)
|
|
103
|
+
this.renderToasts()
|
|
104
|
+
}
|
|
105
|
+
}, 1000)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core'
|
|
2
|
+
import { OcStyleThemeType } from '../interfaces/oc-style-theme'
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root',
|
|
6
|
+
})
|
|
7
|
+
export class StyleThemeService {
|
|
8
|
+
constructor() {}
|
|
9
|
+
|
|
10
|
+
getStyleTheme(): OcStyleThemeType | undefined {
|
|
11
|
+
const localStorageTheme = localStorage.getItem('@oc-lib-style_theme')
|
|
12
|
+
|
|
13
|
+
if (!localStorageTheme || !['otimus', 'shui', 'semantic'].includes(localStorageTheme)) {
|
|
14
|
+
return undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return localStorageTheme as OcStyleThemeType
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of otimus-library
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export * from './lib/otimus-library.service'
|
|
6
|
+
export * from './lib/otimus-library.component'
|
|
7
|
+
export * from './lib/services/oc-toast.service'
|
|
8
|
+
export * from './lib/components/oc-badge/oc-badge.component'
|
|
9
|
+
export * from './lib/components/oc-filter/oc-filter.component'
|
|
10
|
+
export * from './lib/directives/oc-tooltip/oc-tooltip.directive'
|
|
11
|
+
export * from './lib/components/oc-input/oc-input.component'
|
|
12
|
+
export * from './lib/components/oc-modal/oc-modal.component'
|
|
13
|
+
export * from './lib/components/oc-key-value/oc-key-value.component'
|
|
14
|
+
export * from './lib/components/oc-chip/oc-chip.component'
|
|
15
|
+
export * from './lib/components/oc-modal-footer/oc-modal-footer.component'
|
|
16
|
+
export * from './lib/components/oc-autocomplete/oc-autocomplete.component'
|
|
17
|
+
export * from './lib/components/oc-profile/oc-profile.component'
|
|
18
|
+
export * from './lib/components/oc-log/oc-log.component'
|
|
19
|
+
export * from './lib/components/oc-pagination/oc-pagination.component'
|
|
20
|
+
export * from './lib/components/oc-not-found/oc-not-found.component'
|
|
21
|
+
export * from './lib/components/oc-menu/oc-menu.component'
|
|
22
|
+
export * from './lib/components/oc-toast/oc-toast.component'
|
|
23
|
+
export * from './lib/components/oc-checkbox/oc-checkbox.component'
|
|
24
|
+
export * from './lib/components/oc-toggle/oc-toggle.component'
|
|
25
|
+
export * from './lib/components/oc-stepper/oc-stepper.component'
|
|
26
|
+
export * from './lib/components/oc-step/oc-step.component'
|
|
27
|
+
export * from './lib/components/oc-tabs/oc-tabs.component'
|
|
28
|
+
export * from './lib/components/oc-tab/oc-tab.component'
|
|
29
|
+
export * from './lib/components/oc-accordion/oc-accordion.component'
|
|
30
|
+
export * from './lib/components/oc-accordion-item/oc-accordion-item.component'
|