ng-magary 0.0.5 → 0.0.7
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 +63 -213
- package/fesm2022/ng-magary.mjs +8708 -0
- package/fesm2022/ng-magary.mjs.map +1 -0
- package/package.json +19 -14
- package/types/ng-magary.d.ts +2557 -0
- package/LICENSE.md +0 -21
- package/bun.lock +0 -290
- package/ng-package.json +0 -7
- package/src/lib/Button/button/button.html +0 -29
- package/src/lib/Button/button/button.module.ts +0 -9
- package/src/lib/Button/button/button.scss +0 -196
- package/src/lib/Button/button/button.spec.ts +0 -18
- package/src/lib/Button/button/button.ts +0 -72
- package/src/lib/Button/speed-dial/speed-dial-item.interface.ts +0 -9
- package/src/lib/Button/speed-dial/speed-dial.html +0 -57
- package/src/lib/Button/speed-dial/speed-dial.module.ts +0 -8
- package/src/lib/Button/speed-dial/speed-dial.scss +0 -247
- package/src/lib/Button/speed-dial/speed-dial.spec.ts +0 -18
- package/src/lib/Button/speed-dial/speed-dial.ts +0 -106
- package/src/lib/Form/cascade-select/cascade-select.html +0 -1
- package/src/lib/Form/cascade-select/cascade-select.module.ts +0 -8
- package/src/lib/Form/cascade-select/cascade-select.scss +0 -0
- package/src/lib/Form/cascade-select/cascade-select.spec.ts +0 -18
- package/src/lib/Form/cascade-select/cascade-select.ts +0 -9
- package/src/lib/Form/input/input.html +0 -66
- package/src/lib/Form/input/input.module.ts +0 -9
- package/src/lib/Form/input/input.scss +0 -193
- package/src/lib/Form/input/input.spec.ts +0 -22
- package/src/lib/Form/input/input.ts +0 -132
- package/src/lib/Menu/panelmenu/panelmenu.html +0 -259
- package/src/lib/Menu/panelmenu/panelmenu.interface.ts +0 -13
- package/src/lib/Menu/panelmenu/panelmenu.module.ts +0 -9
- package/src/lib/Menu/panelmenu/panelmenu.scss +0 -177
- package/src/lib/Menu/panelmenu/panelmenu.spec.ts +0 -18
- package/src/lib/Menu/panelmenu/panelmenu.ts +0 -134
- package/src/lib/Menu/sidebar/sidebar.html +0 -85
- package/src/lib/Menu/sidebar/sidebar.module.ts +0 -9
- package/src/lib/Menu/sidebar/sidebar.scss +0 -153
- package/src/lib/Menu/sidebar/sidebar.spec.ts +0 -18
- package/src/lib/Menu/sidebar/sidebar.ts +0 -64
- package/src/lib/Misc/avatar/avatar.html +0 -44
- package/src/lib/Misc/avatar/avatar.module.ts +0 -9
- package/src/lib/Misc/avatar/avatar.scss +0 -167
- package/src/lib/Misc/avatar/avatar.spec.ts +0 -18
- package/src/lib/Misc/avatar/avatar.ts +0 -93
- package/src/lib/Panel/card/card.html +0 -58
- package/src/lib/Panel/card/card.module.ts +0 -9
- package/src/lib/Panel/card/card.scss +0 -290
- package/src/lib/Panel/card/card.spec.ts +0 -18
- package/src/lib/Panel/card/card.ts +0 -126
- package/src/lib/Panel/tabs/tab/tab.spec.ts +0 -18
- package/src/lib/Panel/tabs/tab/tab.ts +0 -12
- package/src/lib/Panel/tabs/tabs.html +0 -26
- package/src/lib/Panel/tabs/tabs.module.ts +0 -10
- package/src/lib/Panel/tabs/tabs.scss +0 -58
- package/src/lib/Panel/tabs/tabs.spec.ts +0 -18
- package/src/lib/Panel/tabs/tabs.ts +0 -57
- package/src/lib/ng-magary.spec.ts +0 -18
- package/src/lib/ng-magary.ts +0 -43
- package/src/public-api.ts +0 -5
- package/tsconfig.lib.json +0 -22
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -14
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import {
|
|
3
|
-
Component,
|
|
4
|
-
computed,
|
|
5
|
-
EventEmitter,
|
|
6
|
-
input,
|
|
7
|
-
output,
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
type ButtonSeverity =
|
|
10
|
-
| 'primary'
|
|
11
|
-
| 'secondary'
|
|
12
|
-
| 'success'
|
|
13
|
-
| 'info'
|
|
14
|
-
| 'warning'
|
|
15
|
-
| 'danger'
|
|
16
|
-
| 'help';
|
|
17
|
-
type ButtonVariant = 'solid' | 'text' | 'outlined';
|
|
18
|
-
type ButtonSize = 'small' | 'normal' | 'large';
|
|
19
|
-
type IconPosition = 'left' | 'right';
|
|
20
|
-
type ShadowLevel = 0 | 1 | 2 | 3 | 4 | 5;
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'magary-button',
|
|
23
|
-
imports: [CommonModule],
|
|
24
|
-
templateUrl: './button.html',
|
|
25
|
-
styleUrl: './button.scss',
|
|
26
|
-
})
|
|
27
|
-
export class MagaryButton {
|
|
28
|
-
readonly label = input<string>();
|
|
29
|
-
readonly icon = input<string>();
|
|
30
|
-
readonly shadow = input<ShadowLevel>(0);
|
|
31
|
-
readonly rounded = input<boolean>(false);
|
|
32
|
-
readonly customBackgroundColor = input<string>();
|
|
33
|
-
readonly iconPos = input<IconPosition>('left');
|
|
34
|
-
readonly severity = input<ButtonSeverity>();
|
|
35
|
-
readonly loading = input<boolean>(false);
|
|
36
|
-
readonly disabled = input<boolean>(false);
|
|
37
|
-
readonly variant = input<ButtonVariant>('solid');
|
|
38
|
-
readonly size = input<ButtonSize>('normal');
|
|
39
|
-
readonly ariaLabel = input<string>();
|
|
40
|
-
readonly buttonClick = output<Event>();
|
|
41
|
-
readonly isDisabled = computed(() => this.disabled() || this.loading());
|
|
42
|
-
readonly buttonClasses = computed(() =>
|
|
43
|
-
[
|
|
44
|
-
'p-button',
|
|
45
|
-
`shadow-${this.shadow()}`,
|
|
46
|
-
`p-button-${this.size()}`,
|
|
47
|
-
this.severity() ? `p-button-${this.severity()}` : '',
|
|
48
|
-
this.variant() === 'text' ? 'p-button-text' : '',
|
|
49
|
-
this.variant() === 'outlined' ? 'p-button-outlined' : '',
|
|
50
|
-
this.icon() && !this.label() ? 'p-button-icon-only' : '',
|
|
51
|
-
this.icon() && this.label() && this.iconPos() === 'left'
|
|
52
|
-
? 'p-button-icon-left'
|
|
53
|
-
: '',
|
|
54
|
-
this.icon() && this.label() && this.iconPos() === 'right'
|
|
55
|
-
? 'p-button-icon-right'
|
|
56
|
-
: '',
|
|
57
|
-
this.loading() ? 'p-button-loading' : '',
|
|
58
|
-
].filter(Boolean),
|
|
59
|
-
);
|
|
60
|
-
readonly buttonStyles = computed(() => ({
|
|
61
|
-
'border-radius': this.rounded() ? '22px' : '8px',
|
|
62
|
-
background: this.customBackgroundColor() || undefined,
|
|
63
|
-
}));
|
|
64
|
-
readonly effectiveAriaLabel = computed(
|
|
65
|
-
() => this.ariaLabel() || this.label() || 'Button',
|
|
66
|
-
);
|
|
67
|
-
onButtonClick(event: Event): void {
|
|
68
|
-
if (!this.isDisabled()) {
|
|
69
|
-
this.buttonClick.emit(event);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<div [ngClass]="containerClasses()" [ngStyle]="triggerStyles()">
|
|
2
|
-
@if (showMask() && isOpen()) {
|
|
3
|
-
<div class="speed-dial-mask" (click)="closeMask()" aria-hidden="true"></div>
|
|
4
|
-
}
|
|
5
|
-
<ul
|
|
6
|
-
class="speed-dial-items"
|
|
7
|
-
[attr.data-direction]="direction()"
|
|
8
|
-
[ngStyle]="itemsStyles()"
|
|
9
|
-
role="menu"
|
|
10
|
-
[attr.aria-expanded]="isOpen()"
|
|
11
|
-
[attr.aria-label]="ariaLabel()"
|
|
12
|
-
>
|
|
13
|
-
@for (item of items(); track trackByItem($index, item)) {
|
|
14
|
-
<li
|
|
15
|
-
[style.--i]="$index"
|
|
16
|
-
[style.--radius.px]="radius()"
|
|
17
|
-
[style.transition-delay]="isOpen() ? $index * 50 + 'ms' : '0ms'"
|
|
18
|
-
[class]="'item-' + type()"
|
|
19
|
-
role="presentation"
|
|
20
|
-
>
|
|
21
|
-
@if (item.tooltip) {
|
|
22
|
-
<div
|
|
23
|
-
class="action-tooltip"
|
|
24
|
-
role="tooltip"
|
|
25
|
-
[attr.id]="'tooltip-' + $index"
|
|
26
|
-
>
|
|
27
|
-
{{ item.tooltip }}
|
|
28
|
-
</div>
|
|
29
|
-
}
|
|
30
|
-
<button
|
|
31
|
-
type="button"
|
|
32
|
-
class="action-button"
|
|
33
|
-
role="menuitem"
|
|
34
|
-
[disabled]="item.disabled"
|
|
35
|
-
[attr.aria-label]="
|
|
36
|
-
item.ariaLabel || item.tooltip || 'Speed dial action'
|
|
37
|
-
"
|
|
38
|
-
[attr.aria-describedby]="item.tooltip ? 'tooltip-' + $index : null"
|
|
39
|
-
[style.background-color]="item.backgroundColor"
|
|
40
|
-
(click)="onItemClick($event, item)"
|
|
41
|
-
>
|
|
42
|
-
<i [ngClass]="item.icon" aria-hidden="true"> </i>
|
|
43
|
-
</button>
|
|
44
|
-
</li>
|
|
45
|
-
}
|
|
46
|
-
</ul>
|
|
47
|
-
<button
|
|
48
|
-
type="button"
|
|
49
|
-
class="trigger-button"
|
|
50
|
-
[attr.aria-label]="ariaLabel() + (isOpen() ? ' - Cerrar' : ' - Abrir')"
|
|
51
|
-
[attr.aria-expanded]="isOpen()"
|
|
52
|
-
[attr.aria-haspopup]="'menu'"
|
|
53
|
-
(click)="toggleSpeedDial($event)"
|
|
54
|
-
>
|
|
55
|
-
<i [ngClass]="currentIcon()" aria-hidden="true"> </i>
|
|
56
|
-
</button>
|
|
57
|
-
</div>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { MagarySpeedDial } from './speed-dial';
|
|
4
|
-
@NgModule({
|
|
5
|
-
imports: [CommonModule, MagarySpeedDial],
|
|
6
|
-
exports: [MagarySpeedDial],
|
|
7
|
-
})
|
|
8
|
-
export class SpeedDialModule {}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
--speed-dial-trigger-size: 56px;
|
|
3
|
-
--speed-dial-item-size: 40px;
|
|
4
|
-
--speed-dial-item-gap: 55px;
|
|
5
|
-
--speed-dial-transition: 0.3s ease;
|
|
6
|
-
--speed-dial-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
7
|
-
--speed-dial-shadow-item: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
8
|
-
--speed-dial-mask-bg: rgba(0, 0, 0, 0.4);
|
|
9
|
-
background: transparent;
|
|
10
|
-
display: inline-block;
|
|
11
|
-
}
|
|
12
|
-
.speed-dial-container {
|
|
13
|
-
position: relative;
|
|
14
|
-
display: inline-block;
|
|
15
|
-
background: transparent;
|
|
16
|
-
&.is-open .trigger-button {
|
|
17
|
-
transform: rotate(45deg);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
.trigger-button {
|
|
21
|
-
width: var(--speed-dial-trigger-size);
|
|
22
|
-
height: var(--speed-dial-trigger-size);
|
|
23
|
-
border-radius: 50%;
|
|
24
|
-
background-color: var(--trigger-bg, #007bff);
|
|
25
|
-
color: white;
|
|
26
|
-
border: none;
|
|
27
|
-
box-shadow: var(--speed-dial-shadow);
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
display: flex;
|
|
30
|
-
align-items: center;
|
|
31
|
-
justify-content: center;
|
|
32
|
-
font-size: 1.5rem;
|
|
33
|
-
z-index: 1001;
|
|
34
|
-
transition: transform var(--speed-dial-transition), box-shadow var(--speed-dial-transition);
|
|
35
|
-
min-height: 44px;
|
|
36
|
-
&:hover {
|
|
37
|
-
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
|
|
38
|
-
}
|
|
39
|
-
&:focus-visible {
|
|
40
|
-
outline: 2px solid #0066cc;
|
|
41
|
-
outline-offset: 2px;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
.speed-dial-mask {
|
|
45
|
-
position: fixed;
|
|
46
|
-
top: 0;
|
|
47
|
-
left: 0;
|
|
48
|
-
width: 100vw;
|
|
49
|
-
height: 100vh;
|
|
50
|
-
background: var(--speed-dial-mask-bg);
|
|
51
|
-
z-index: 999;
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
}
|
|
54
|
-
.speed-dial-items {
|
|
55
|
-
list-style: none;
|
|
56
|
-
padding: 0;
|
|
57
|
-
margin: 0;
|
|
58
|
-
position: absolute;
|
|
59
|
-
top: 20%;
|
|
60
|
-
left: 16%;
|
|
61
|
-
transform: translate(-50%, -50%);
|
|
62
|
-
z-index: 1000;
|
|
63
|
-
pointer-events: none;
|
|
64
|
-
li {
|
|
65
|
-
position: absolute;
|
|
66
|
-
top: 0;
|
|
67
|
-
left: 0;
|
|
68
|
-
transform-origin: center;
|
|
69
|
-
transition: transform var(--speed-dial-transition),
|
|
70
|
-
opacity var(--speed-dial-transition);
|
|
71
|
-
opacity: 0;
|
|
72
|
-
}
|
|
73
|
-
.action-button {
|
|
74
|
-
width: var(--speed-dial-item-size);
|
|
75
|
-
height: var(--speed-dial-item-size);
|
|
76
|
-
border-radius: 50%;
|
|
77
|
-
background-color: #6c757d;
|
|
78
|
-
color: white;
|
|
79
|
-
border: none;
|
|
80
|
-
box-shadow: var(--speed-dial-shadow-item);
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
display: flex;
|
|
83
|
-
align-items: center;
|
|
84
|
-
justify-content: center;
|
|
85
|
-
font-size: 1rem;
|
|
86
|
-
transition: background-color 0.2s, transform 0.2s;
|
|
87
|
-
min-height: 44px;
|
|
88
|
-
min-width: 44px;
|
|
89
|
-
&:hover:not(:disabled) {
|
|
90
|
-
background-color: #5a6268;
|
|
91
|
-
transform: scale(1.1);
|
|
92
|
-
}
|
|
93
|
-
&:focus-visible {
|
|
94
|
-
outline: 2px solid #0066cc;
|
|
95
|
-
outline-offset: 2px;
|
|
96
|
-
}
|
|
97
|
-
&:disabled {
|
|
98
|
-
opacity: 0.4;
|
|
99
|
-
cursor: not-allowed;
|
|
100
|
-
background-color: #adb5bd;
|
|
101
|
-
&:hover {
|
|
102
|
-
transform: none;
|
|
103
|
-
background-color: #adb5bd;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
.action-tooltip {
|
|
108
|
-
position: absolute;
|
|
109
|
-
background-color: #333;
|
|
110
|
-
color: white;
|
|
111
|
-
padding: 4px 8px;
|
|
112
|
-
border-radius: 4px;
|
|
113
|
-
font-size: 0.8rem;
|
|
114
|
-
white-space: nowrap;
|
|
115
|
-
opacity: 0;
|
|
116
|
-
transition: opacity 0.2s;
|
|
117
|
-
pointer-events: none;
|
|
118
|
-
right: 120%;
|
|
119
|
-
top: 50%;
|
|
120
|
-
transform: translateY(-50%);
|
|
121
|
-
z-index: 1002;
|
|
122
|
-
&::after {
|
|
123
|
-
content: '';
|
|
124
|
-
position: absolute;
|
|
125
|
-
left: 100%;
|
|
126
|
-
top: 50%;
|
|
127
|
-
transform: translateY(-50%);
|
|
128
|
-
border: 4px solid transparent;
|
|
129
|
-
border-left-color: #333;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
li:hover .action-tooltip {
|
|
133
|
-
opacity: 1;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
.is-open .speed-dial-items {
|
|
137
|
-
pointer-events: auto;
|
|
138
|
-
li {
|
|
139
|
-
opacity: 1;
|
|
140
|
-
}
|
|
141
|
-
&[data-direction="up"] li {
|
|
142
|
-
transform: translateY(calc(var(--speed-dial-item-gap) * (var(--i) + 1) * -1));
|
|
143
|
-
}
|
|
144
|
-
&[data-direction="down"] li {
|
|
145
|
-
transform: translateY(calc(var(--speed-dial-item-gap) * (var(--i) + 1)));
|
|
146
|
-
}
|
|
147
|
-
&[data-direction="left"] li {
|
|
148
|
-
transform: translateX(calc(var(--speed-dial-item-gap) * (var(--i) + 1) * -1));
|
|
149
|
-
}
|
|
150
|
-
&[data-direction="right"] li {
|
|
151
|
-
transform: translateX(calc(var(--speed-dial-item-gap) * (var(--i) + 1)));
|
|
152
|
-
}
|
|
153
|
-
.item-circle {
|
|
154
|
-
--angle: calc(var(--i) * (360deg / var(--item-count)));
|
|
155
|
-
transform: rotate(var(--angle))
|
|
156
|
-
translateY(calc(var(--radius) * -1))
|
|
157
|
-
rotate(calc(var(--angle) * -1));
|
|
158
|
-
}
|
|
159
|
-
&[data-direction="left"] .item-semicircle {
|
|
160
|
-
--angle: calc(var(--i) * (180deg / (var(--item-count) - 1)));
|
|
161
|
-
transform: rotate(calc(var(--angle) - 180deg))
|
|
162
|
-
translateY(calc(var(--radius) * -1))
|
|
163
|
-
rotate(calc((var(--angle) - 180deg) * -1));
|
|
164
|
-
}
|
|
165
|
-
&[data-direction="right"] .item-semicircle {
|
|
166
|
-
--angle: calc(var(--i) * (180deg / (var(--item-count) - 1)));
|
|
167
|
-
transform: rotate(var(--angle))
|
|
168
|
-
translateY(calc(var(--radius) * -1))
|
|
169
|
-
rotate(calc(var(--angle) * -1));
|
|
170
|
-
}
|
|
171
|
-
&[data-direction="down"] .item-semicircle {
|
|
172
|
-
--angle: calc(var(--i) * (180deg / (var(--item-count) - 1)));
|
|
173
|
-
transform: rotate(calc(var(--angle) + 90deg))
|
|
174
|
-
translateY(calc(var(--radius) * -1))
|
|
175
|
-
rotate(calc((var(--angle) + 90deg) * -1));
|
|
176
|
-
}
|
|
177
|
-
&[data-direction="up"] .item-semicircle {
|
|
178
|
-
--angle: calc(var(--i) * (180deg / (var(--item-count) - 1)));
|
|
179
|
-
transform: rotate(calc(var(--angle) - 90deg))
|
|
180
|
-
translateY(calc(var(--radius) * -1))
|
|
181
|
-
rotate(calc((var(--angle) - 90deg) * -1));
|
|
182
|
-
}
|
|
183
|
-
&[data-direction="up-right"] .item-quartercircle {
|
|
184
|
-
--angle: calc(var(--i) * (90deg / (var(--item-count) - 1)));
|
|
185
|
-
transform: rotate(var(--angle))
|
|
186
|
-
translateY(calc(var(--radius) * -1))
|
|
187
|
-
rotate(calc(var(--angle) * -1));
|
|
188
|
-
}
|
|
189
|
-
&[data-direction="down-right"] .item-quartercircle {
|
|
190
|
-
--angle: calc(var(--i) * (90deg / (var(--item-count) - 1)));
|
|
191
|
-
transform: rotate(calc(var(--angle) + 90deg))
|
|
192
|
-
translateY(calc(var(--radius) * -1))
|
|
193
|
-
rotate(calc((var(--angle) + 90deg) * -1));
|
|
194
|
-
}
|
|
195
|
-
&[data-direction="down-left"] .item-quartercircle {
|
|
196
|
-
--angle: calc(var(--i) * (90deg / (var(--item-count) - 1)));
|
|
197
|
-
transform: rotate(calc(var(--angle) + 180deg))
|
|
198
|
-
translateY(calc(var(--radius) * -1))
|
|
199
|
-
rotate(calc((var(--angle) + 180deg) * -1));
|
|
200
|
-
}
|
|
201
|
-
&[data-direction="up-left"] .item-quartercircle {
|
|
202
|
-
--angle: calc(var(--i) * (90deg / (var(--item-count) - 1)));
|
|
203
|
-
transform: rotate(calc(var(--angle) + 270deg))
|
|
204
|
-
translateY(calc(var(--radius) * -1))
|
|
205
|
-
rotate(calc((var(--angle) + 270deg) * -1));
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
@media (max-width: 768px) {
|
|
209
|
-
:host {
|
|
210
|
-
--speed-dial-trigger-size: 52px;
|
|
211
|
-
--speed-dial-item-size: 36px;
|
|
212
|
-
--speed-dial-item-gap: 48px;
|
|
213
|
-
}
|
|
214
|
-
.trigger-button {
|
|
215
|
-
font-size: 1.25rem;
|
|
216
|
-
}
|
|
217
|
-
.speed-dial-items .action-button {
|
|
218
|
-
font-size: 0.9rem;
|
|
219
|
-
}
|
|
220
|
-
.speed-dial-items .action-tooltip {
|
|
221
|
-
font-size: 0.75rem;
|
|
222
|
-
padding: 3px 6px;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
@media (max-width: 480px) {
|
|
226
|
-
:host {
|
|
227
|
-
--speed-dial-trigger-size: 48px;
|
|
228
|
-
--speed-dial-item-size: 32px;
|
|
229
|
-
--speed-dial-item-gap: 44px;
|
|
230
|
-
}
|
|
231
|
-
.trigger-button {
|
|
232
|
-
font-size: 1.1rem;
|
|
233
|
-
}
|
|
234
|
-
.speed-dial-items .action-button {
|
|
235
|
-
font-size: 0.8rem;
|
|
236
|
-
}
|
|
237
|
-
.speed-dial-items .action-tooltip {
|
|
238
|
-
font-size: 0.7rem;
|
|
239
|
-
padding: 2px 4px;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
@media (min-width: 1200px) {
|
|
243
|
-
.speed-dial-items .action-tooltip {
|
|
244
|
-
font-size: 0.85rem;
|
|
245
|
-
padding: 6px 10px;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { SpeedDial } from './speed-dial';
|
|
3
|
-
describe('SpeedDial', () => {
|
|
4
|
-
let component: SpeedDial;
|
|
5
|
-
let fixture: ComponentFixture<SpeedDial>;
|
|
6
|
-
beforeEach(async () => {
|
|
7
|
-
await TestBed.configureTestingModule({
|
|
8
|
-
imports: [SpeedDial]
|
|
9
|
-
})
|
|
10
|
-
.compileComponents();
|
|
11
|
-
fixture = TestBed.createComponent(SpeedDial);
|
|
12
|
-
component = fixture.componentInstance;
|
|
13
|
-
fixture.detectChanges();
|
|
14
|
-
});
|
|
15
|
-
it('should create', () => {
|
|
16
|
-
expect(component).toBeTruthy();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import {
|
|
3
|
-
Component,
|
|
4
|
-
computed,
|
|
5
|
-
input,
|
|
6
|
-
output,
|
|
7
|
-
signal,
|
|
8
|
-
ElementRef,
|
|
9
|
-
HostListener,
|
|
10
|
-
inject,
|
|
11
|
-
} from '@angular/core';
|
|
12
|
-
import { SpeedDialItem } from './speed-dial-item.interface';
|
|
13
|
-
type SpeedDialType = 'linear' | 'circle' | 'semicircle' | 'quartercircle';
|
|
14
|
-
type SpeedDialDirection =
|
|
15
|
-
| 'up'
|
|
16
|
-
| 'down'
|
|
17
|
-
| 'left'
|
|
18
|
-
| 'right'
|
|
19
|
-
| 'up-left'
|
|
20
|
-
| 'up-right'
|
|
21
|
-
| 'down-left'
|
|
22
|
-
| 'down-right';
|
|
23
|
-
@Component({
|
|
24
|
-
selector: 'magary-speed-dial',
|
|
25
|
-
imports: [CommonModule],
|
|
26
|
-
templateUrl: './speed-dial.html',
|
|
27
|
-
styleUrl: './speed-dial.scss',
|
|
28
|
-
})
|
|
29
|
-
export class MagarySpeedDial {
|
|
30
|
-
private readonly elementRef = inject(ElementRef);
|
|
31
|
-
readonly items = input.required<SpeedDialItem[]>();
|
|
32
|
-
readonly icon = input<string>('fas fa-plus');
|
|
33
|
-
readonly activeIcon = input<string>('fas fa-times');
|
|
34
|
-
readonly type = input<SpeedDialType>('linear');
|
|
35
|
-
readonly direction = input<SpeedDialDirection>();
|
|
36
|
-
readonly radius = input<number>(80);
|
|
37
|
-
readonly showMask = input<boolean>(false);
|
|
38
|
-
readonly background = input<string>('#007bff');
|
|
39
|
-
readonly ariaLabel = input<string>('Speed dial menu');
|
|
40
|
-
readonly isOpen = signal(false);
|
|
41
|
-
readonly speedDialToggle = output<boolean>();
|
|
42
|
-
readonly itemSelect = output<{ item: SpeedDialItem; event: Event }>();
|
|
43
|
-
readonly itemCount = computed(() => this.items().length);
|
|
44
|
-
readonly containerClasses = computed(() =>
|
|
45
|
-
[
|
|
46
|
-
'speed-dial-container',
|
|
47
|
-
this.isOpen() ? 'is-open' : '',
|
|
48
|
-
`type-${this.type()}`,
|
|
49
|
-
this.direction() ? `direction-${this.direction()}` : '',
|
|
50
|
-
].filter(Boolean),
|
|
51
|
-
);
|
|
52
|
-
readonly triggerStyles = computed(() => ({
|
|
53
|
-
'--trigger-bg': this.background(),
|
|
54
|
-
}));
|
|
55
|
-
readonly itemsStyles = computed(() => ({
|
|
56
|
-
'--item-count': this.itemCount().toString(),
|
|
57
|
-
'--radius': `${this.radius()}px`,
|
|
58
|
-
}));
|
|
59
|
-
readonly currentIcon = computed(() =>
|
|
60
|
-
this.isOpen() ? this.activeIcon() : this.icon(),
|
|
61
|
-
);
|
|
62
|
-
toggleSpeedDial(event: Event): void {
|
|
63
|
-
event.stopPropagation();
|
|
64
|
-
const newState = !this.isOpen();
|
|
65
|
-
this.isOpen.set(newState);
|
|
66
|
-
this.speedDialToggle.emit(newState);
|
|
67
|
-
}
|
|
68
|
-
onItemClick(event: Event, item: SpeedDialItem): void {
|
|
69
|
-
event.stopPropagation();
|
|
70
|
-
if (item.disabled) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
this.itemSelect.emit({ item, event });
|
|
74
|
-
if (item.command) {
|
|
75
|
-
item.command(event);
|
|
76
|
-
}
|
|
77
|
-
this.isOpen.set(false);
|
|
78
|
-
this.speedDialToggle.emit(false);
|
|
79
|
-
}
|
|
80
|
-
closeMask(): void {
|
|
81
|
-
this.isOpen.set(false);
|
|
82
|
-
this.speedDialToggle.emit(false);
|
|
83
|
-
}
|
|
84
|
-
trackByItem(index: number, item: SpeedDialItem): string {
|
|
85
|
-
return item.id || `${item.icon}-${index}`;
|
|
86
|
-
}
|
|
87
|
-
@HostListener('document:click', ['$event'])
|
|
88
|
-
onDocumentClick(event: Event): void {
|
|
89
|
-
if (!this.isOpen()) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const target = event.target as HTMLElement;
|
|
93
|
-
const componentElement = this.elementRef.nativeElement;
|
|
94
|
-
if (!componentElement.contains(target)) {
|
|
95
|
-
this.isOpen.set(false);
|
|
96
|
-
this.speedDialToggle.emit(false);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
@HostListener('document:keydown.escape')
|
|
100
|
-
onEscapeKeydown(): void {
|
|
101
|
-
if (this.isOpen()) {
|
|
102
|
-
this.isOpen.set(false);
|
|
103
|
-
this.speedDialToggle.emit(false);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>cascade-select works!</p>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { CascadeSelect } from './cascade-select';
|
|
4
|
-
@NgModule({
|
|
5
|
-
imports: [CommonModule, CascadeSelect],
|
|
6
|
-
exports: [CascadeSelect],
|
|
7
|
-
})
|
|
8
|
-
export class CascadeSelectModule { }
|
|
File without changes
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { CascadeSelect } from './cascade-select';
|
|
3
|
-
describe('CascadeSelect', () => {
|
|
4
|
-
let component: CascadeSelect;
|
|
5
|
-
let fixture: ComponentFixture<CascadeSelect>;
|
|
6
|
-
beforeEach(async () => {
|
|
7
|
-
await TestBed.configureTestingModule({
|
|
8
|
-
imports: [CascadeSelect]
|
|
9
|
-
})
|
|
10
|
-
.compileComponents();
|
|
11
|
-
fixture = TestBed.createComponent(CascadeSelect);
|
|
12
|
-
component = fixture.componentInstance;
|
|
13
|
-
fixture.detectChanges();
|
|
14
|
-
});
|
|
15
|
-
it('should create', () => {
|
|
16
|
-
expect(component).toBeTruthy();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<div [ngClass]="containerClasses()" [ngStyle]="inputStyles()">
|
|
2
|
-
@if (label()) {
|
|
3
|
-
<label [for]="getId()" class="input-label">
|
|
4
|
-
{{ label() }}
|
|
5
|
-
@if (required()) {
|
|
6
|
-
<span class="required-asterisk">*</span>
|
|
7
|
-
}
|
|
8
|
-
</label>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
<div class="input-wrapper">
|
|
12
|
-
@if (prefixIcon()) {
|
|
13
|
-
<i
|
|
14
|
-
[class]="prefixIcon()"
|
|
15
|
-
class="prefix-icon"
|
|
16
|
-
(click)="onPrefixIconClick()"
|
|
17
|
-
[class.clickable]="!disabled()"
|
|
18
|
-
></i>
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
<input
|
|
22
|
-
[id]="getId()"
|
|
23
|
-
[ngClass]="inputClasses()"
|
|
24
|
-
[type]="actualType()"
|
|
25
|
-
[value]="value()"
|
|
26
|
-
[placeholder]="placeholder()"
|
|
27
|
-
[disabled]="disabled()"
|
|
28
|
-
[readonly]="readonly()"
|
|
29
|
-
[required]="required()"
|
|
30
|
-
attr.maxlength="{{ maxLength() }}"
|
|
31
|
-
(input)="onInput($event)"
|
|
32
|
-
(focus)="onFocus($event)"
|
|
33
|
-
(blur)="onBlur($event)"
|
|
34
|
-
/>
|
|
35
|
-
|
|
36
|
-
@if (loading()) {
|
|
37
|
-
<i class="fas fa-spinner fa-spin suffix-icon loading-icon"></i>
|
|
38
|
-
} @else if (type() === "password") {
|
|
39
|
-
<i
|
|
40
|
-
[class]="passwordIcon()"
|
|
41
|
-
class="suffix-icon password-toggle"
|
|
42
|
-
(click)="togglePasswordVisibility()"
|
|
43
|
-
></i>
|
|
44
|
-
} @else if (suffixIcon()) {
|
|
45
|
-
<i
|
|
46
|
-
[class]="suffixIcon()"
|
|
47
|
-
class="suffix-icon"
|
|
48
|
-
(click)="onSuffixIconClick()"
|
|
49
|
-
[class.clickable]="!disabled()"
|
|
50
|
-
></i>
|
|
51
|
-
}
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
@if (error() || helpText()) {
|
|
55
|
-
<div class="input-message">
|
|
56
|
-
@if (error()) {
|
|
57
|
-
<span class="error-message">
|
|
58
|
-
<i class="fas fa-exclamation-circle"></i>
|
|
59
|
-
{{ error() }}
|
|
60
|
-
</span>
|
|
61
|
-
} @else if (helpText()) {
|
|
62
|
-
<span class="help-message">{{ helpText() }}</span>
|
|
63
|
-
}
|
|
64
|
-
</div>
|
|
65
|
-
}
|
|
66
|
-
</div>
|