@hyalo/angular 0.1.0 → 0.3.1
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/CHANGELOG.md +95 -41
- package/README.md +46 -32
- package/fesm2022/hyalo-angular-accordion.mjs +6 -6
- package/fesm2022/hyalo-angular-accordion.mjs.map +1 -1
- package/fesm2022/hyalo-angular-alert.mjs +171 -0
- package/fesm2022/hyalo-angular-alert.mjs.map +1 -0
- package/fesm2022/hyalo-angular-aspect-ratio.mjs +64 -0
- package/fesm2022/hyalo-angular-aspect-ratio.mjs.map +1 -0
- package/fesm2022/hyalo-angular-avatar.mjs +169 -0
- package/fesm2022/hyalo-angular-avatar.mjs.map +1 -0
- package/fesm2022/hyalo-angular-badge.mjs +268 -0
- package/fesm2022/hyalo-angular-badge.mjs.map +1 -0
- package/fesm2022/hyalo-angular-bento.mjs +132 -0
- package/fesm2022/hyalo-angular-bento.mjs.map +1 -0
- package/fesm2022/hyalo-angular-blocks.mjs +985 -0
- package/fesm2022/hyalo-angular-blocks.mjs.map +1 -0
- package/fesm2022/hyalo-angular-border-beam.mjs +73 -0
- package/fesm2022/hyalo-angular-border-beam.mjs.map +1 -0
- package/fesm2022/hyalo-angular-breadcrumb.mjs +77 -0
- package/fesm2022/hyalo-angular-breadcrumb.mjs.map +1 -0
- package/fesm2022/hyalo-angular-button-group.mjs +90 -0
- package/fesm2022/hyalo-angular-button-group.mjs.map +1 -0
- package/fesm2022/hyalo-angular-button.mjs +4 -3
- package/fesm2022/hyalo-angular-button.mjs.map +1 -1
- package/fesm2022/hyalo-angular-card.mjs +2 -2
- package/fesm2022/hyalo-angular-card.mjs.map +1 -1
- package/fesm2022/hyalo-angular-carousel.mjs +709 -0
- package/fesm2022/hyalo-angular-carousel.mjs.map +1 -0
- package/fesm2022/hyalo-angular-chapter-nav.mjs +336 -0
- package/fesm2022/hyalo-angular-chapter-nav.mjs.map +1 -0
- package/fesm2022/hyalo-angular-chart-engine-DSJop6He.mjs +5 -0
- package/fesm2022/hyalo-angular-chart-engine-DSJop6He.mjs.map +1 -0
- package/fesm2022/hyalo-angular-chart.mjs +391 -0
- package/fesm2022/hyalo-angular-chart.mjs.map +1 -0
- package/fesm2022/hyalo-angular-choice.mjs +2 -1
- package/fesm2022/hyalo-angular-choice.mjs.map +1 -1
- package/fesm2022/hyalo-angular-code-block-highlight-B20d5C76.mjs +40 -0
- package/fesm2022/hyalo-angular-code-block-highlight-B20d5C76.mjs.map +1 -0
- package/fesm2022/hyalo-angular-code-block.mjs +161 -0
- package/fesm2022/hyalo-angular-code-block.mjs.map +1 -0
- package/fesm2022/hyalo-angular-command.mjs +193 -0
- package/fesm2022/hyalo-angular-command.mjs.map +1 -0
- package/fesm2022/hyalo-angular-copy.mjs +138 -0
- package/fesm2022/hyalo-angular-copy.mjs.map +1 -0
- package/fesm2022/hyalo-angular-core.mjs +424 -0
- package/fesm2022/hyalo-angular-core.mjs.map +1 -0
- package/fesm2022/hyalo-angular-description-list.mjs +57 -0
- package/fesm2022/hyalo-angular-description-list.mjs.map +1 -0
- package/fesm2022/hyalo-angular-dialog.mjs +51 -22
- package/fesm2022/hyalo-angular-dialog.mjs.map +1 -1
- package/fesm2022/hyalo-angular-divider.mjs +66 -0
- package/fesm2022/hyalo-angular-divider.mjs.map +1 -0
- package/fesm2022/hyalo-angular-empty-state.mjs +123 -0
- package/fesm2022/hyalo-angular-empty-state.mjs.map +1 -0
- package/fesm2022/hyalo-angular-field.mjs +41 -9
- package/fesm2022/hyalo-angular-field.mjs.map +1 -1
- package/fesm2022/hyalo-angular-filter.mjs +309 -0
- package/fesm2022/hyalo-angular-filter.mjs.map +1 -0
- package/fesm2022/hyalo-angular-hotspot.mjs +225 -0
- package/fesm2022/hyalo-angular-hotspot.mjs.map +1 -0
- package/fesm2022/hyalo-angular-hover-card.mjs +233 -0
- package/fesm2022/hyalo-angular-hover-card.mjs.map +1 -0
- package/fesm2022/hyalo-angular-icon.mjs +42 -0
- package/fesm2022/hyalo-angular-icon.mjs.map +1 -1
- package/fesm2022/hyalo-angular-image-compare.mjs +168 -0
- package/fesm2022/hyalo-angular-image-compare.mjs.map +1 -0
- package/fesm2022/hyalo-angular-interaction.mjs +32 -41
- package/fesm2022/hyalo-angular-interaction.mjs.map +1 -1
- package/fesm2022/hyalo-angular-kbd.mjs +41 -0
- package/fesm2022/hyalo-angular-kbd.mjs.map +1 -0
- package/fesm2022/hyalo-angular-lightbox.mjs +228 -0
- package/fesm2022/hyalo-angular-lightbox.mjs.map +1 -0
- package/fesm2022/hyalo-angular-link.mjs +42 -0
- package/fesm2022/hyalo-angular-link.mjs.map +1 -0
- package/fesm2022/hyalo-angular-list.mjs +131 -0
- package/fesm2022/hyalo-angular-list.mjs.map +1 -0
- package/fesm2022/hyalo-angular-marquee.mjs +197 -0
- package/fesm2022/hyalo-angular-marquee.mjs.map +1 -0
- package/fesm2022/hyalo-angular-menu.mjs +423 -0
- package/fesm2022/hyalo-angular-menu.mjs.map +1 -0
- package/fesm2022/hyalo-angular-mesh.mjs +126 -0
- package/fesm2022/hyalo-angular-mesh.mjs.map +1 -0
- package/fesm2022/hyalo-angular-motion.mjs +620 -0
- package/fesm2022/hyalo-angular-motion.mjs.map +1 -0
- package/fesm2022/hyalo-angular-navbar.mjs +1 -1
- package/fesm2022/hyalo-angular-navbar.mjs.map +1 -1
- package/fesm2022/hyalo-angular-navigation-menu.mjs +222 -0
- package/fesm2022/hyalo-angular-navigation-menu.mjs.map +1 -0
- package/fesm2022/hyalo-angular-number-ticker.mjs +174 -0
- package/fesm2022/hyalo-angular-number-ticker.mjs.map +1 -0
- package/fesm2022/hyalo-angular-overlay.mjs +71 -2
- package/fesm2022/hyalo-angular-overlay.mjs.map +1 -1
- package/fesm2022/hyalo-angular-pagination.mjs +187 -0
- package/fesm2022/hyalo-angular-pagination.mjs.map +1 -0
- package/fesm2022/hyalo-angular-popover.mjs +34 -5
- package/fesm2022/hyalo-angular-popover.mjs.map +1 -1
- package/fesm2022/hyalo-angular-progress.mjs +209 -0
- package/fesm2022/hyalo-angular-progress.mjs.map +1 -0
- package/fesm2022/hyalo-angular-progressive-blur.mjs +73 -0
- package/fesm2022/hyalo-angular-progressive-blur.mjs.map +1 -0
- package/fesm2022/hyalo-angular-refraction-renderer-5ZA-kfsA.mjs +186 -0
- package/fesm2022/hyalo-angular-refraction-renderer-5ZA-kfsA.mjs.map +1 -0
- package/fesm2022/hyalo-angular-refraction.mjs +178 -0
- package/fesm2022/hyalo-angular-refraction.mjs.map +1 -0
- package/fesm2022/hyalo-angular-scroll-area.mjs +93 -0
- package/fesm2022/hyalo-angular-scroll-area.mjs.map +1 -0
- package/fesm2022/hyalo-angular-scroll-to-top.mjs +127 -0
- package/fesm2022/hyalo-angular-scroll-to-top.mjs.map +1 -0
- package/fesm2022/hyalo-angular-segmented.mjs +1 -1
- package/fesm2022/hyalo-angular-segmented.mjs.map +1 -1
- package/fesm2022/hyalo-angular-select.mjs +112 -15
- package/fesm2022/hyalo-angular-select.mjs.map +1 -1
- package/fesm2022/hyalo-angular-sidebar.mjs +241 -0
- package/fesm2022/hyalo-angular-sidebar.mjs.map +1 -0
- package/fesm2022/hyalo-angular-skeleton.mjs +131 -0
- package/fesm2022/hyalo-angular-skeleton.mjs.map +1 -0
- package/fesm2022/hyalo-angular-sparkline.mjs +110 -0
- package/fesm2022/hyalo-angular-sparkline.mjs.map +1 -0
- package/fesm2022/hyalo-angular-split-text.mjs +126 -0
- package/fesm2022/hyalo-angular-split-text.mjs.map +1 -0
- package/fesm2022/hyalo-angular-stat.mjs +193 -0
- package/fesm2022/hyalo-angular-stat.mjs.map +1 -0
- package/fesm2022/hyalo-angular-stepper.mjs +254 -0
- package/fesm2022/hyalo-angular-stepper.mjs.map +1 -0
- package/fesm2022/hyalo-angular-table.mjs +335 -0
- package/fesm2022/hyalo-angular-table.mjs.map +1 -0
- package/fesm2022/hyalo-angular-tabs.mjs +1 -1
- package/fesm2022/hyalo-angular-tabs.mjs.map +1 -1
- package/fesm2022/hyalo-angular-theme.mjs +1 -1
- package/fesm2022/hyalo-angular-theme.mjs.map +1 -1
- package/fesm2022/hyalo-angular-timeline.mjs +157 -0
- package/fesm2022/hyalo-angular-timeline.mjs.map +1 -0
- package/fesm2022/hyalo-angular-toast.mjs +2 -1
- package/fesm2022/hyalo-angular-toast.mjs.map +1 -1
- package/fesm2022/hyalo-angular.mjs +2 -473
- package/package.json +198 -2
- package/styles/parts/field.css +44 -36
- package/styles/parts/glass.css +2 -0
- package/styles/parts/motion.css +19 -0
- package/styles/parts/typography.css +17 -0
- package/types/hyalo-angular-accordion.d.ts +1 -1
- package/types/hyalo-angular-alert.d.ts +47 -0
- package/types/hyalo-angular-aspect-ratio.d.ts +13 -0
- package/types/hyalo-angular-avatar.d.ts +39 -0
- package/types/hyalo-angular-badge.d.ts +82 -0
- package/types/hyalo-angular-bento.d.ts +25 -0
- package/types/hyalo-angular-blocks.d.ts +272 -0
- package/types/hyalo-angular-border-beam.d.ts +15 -0
- package/types/hyalo-angular-breadcrumb.d.ts +22 -0
- package/types/hyalo-angular-button-group.d.ts +19 -0
- package/types/hyalo-angular-button.d.ts +4 -3
- package/types/hyalo-angular-card.d.ts +1 -1
- package/types/hyalo-angular-carousel.d.ts +147 -0
- package/types/hyalo-angular-chapter-nav.d.ts +79 -0
- package/types/hyalo-angular-chart.d.ts +90 -0
- package/types/hyalo-angular-code-block.d.ts +46 -0
- package/types/hyalo-angular-command.d.ts +41 -0
- package/types/hyalo-angular-copy.d.ts +39 -0
- package/types/hyalo-angular-core.d.ts +210 -0
- package/types/hyalo-angular-description-list.d.ts +16 -0
- package/types/hyalo-angular-dialog.d.ts +2 -1
- package/types/hyalo-angular-divider.d.ts +12 -0
- package/types/hyalo-angular-empty-state.d.ts +30 -0
- package/types/hyalo-angular-field.d.ts +10 -4
- package/types/hyalo-angular-filter.d.ts +122 -0
- package/types/hyalo-angular-hotspot.d.ts +70 -0
- package/types/hyalo-angular-hover-card.d.ts +47 -0
- package/types/hyalo-angular-image-compare.d.ts +55 -0
- package/types/hyalo-angular-kbd.d.ts +5 -0
- package/types/hyalo-angular-lightbox.d.ts +67 -0
- package/types/hyalo-angular-link.d.ts +5 -0
- package/types/hyalo-angular-list.d.ts +30 -0
- package/types/hyalo-angular-marquee.d.ts +48 -0
- package/types/hyalo-angular-menu.d.ts +105 -0
- package/types/hyalo-angular-mesh.d.ts +36 -0
- package/types/hyalo-angular-motion.d.ts +218 -0
- package/types/hyalo-angular-navigation-menu.d.ts +47 -0
- package/types/hyalo-angular-number-ticker.d.ts +52 -0
- package/types/hyalo-angular-overlay.d.ts +9 -0
- package/types/hyalo-angular-pagination.d.ts +59 -0
- package/types/hyalo-angular-popover.d.ts +10 -0
- package/types/hyalo-angular-progress.d.ts +46 -0
- package/types/hyalo-angular-progressive-blur.d.ts +14 -0
- package/types/hyalo-angular-refraction.d.ts +46 -0
- package/types/hyalo-angular-scroll-area.d.ts +18 -0
- package/types/hyalo-angular-scroll-to-top.d.ts +31 -0
- package/types/hyalo-angular-segmented.d.ts +1 -1
- package/types/hyalo-angular-select.d.ts +49 -3
- package/types/hyalo-angular-sidebar.d.ts +57 -0
- package/types/hyalo-angular-skeleton.d.ts +34 -0
- package/types/hyalo-angular-sparkline.d.ts +19 -0
- package/types/hyalo-angular-split-text.d.ts +24 -0
- package/types/hyalo-angular-stat.d.ts +56 -0
- package/types/hyalo-angular-stepper.d.ts +63 -0
- package/types/hyalo-angular-table.d.ts +125 -0
- package/types/hyalo-angular-timeline.d.ts +36 -0
- package/types/hyalo-angular.d.ts +2 -345
- package/fesm2022/hyalo-angular.mjs.map +0 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, Injector, afterNextRender, booleanAttribute, computed, contentChildren, inject, input, model } from "@angular/core";
|
|
3
|
+
import { injectId } from "@hyalo/angular/core";
|
|
4
|
+
var HyStep = class HyStep {
|
|
5
|
+
stepper = inject(HyStepper);
|
|
6
|
+
label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
7
|
+
completed = input(false, {
|
|
8
|
+
...ngDevMode ? { debugName: "completed" } : /* istanbul ignore next */ {},
|
|
9
|
+
transform: booleanAttribute
|
|
10
|
+
});
|
|
11
|
+
disabled = input(false, {
|
|
12
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
13
|
+
transform: booleanAttribute
|
|
14
|
+
});
|
|
15
|
+
id = injectId("step");
|
|
16
|
+
active = computed(() => this.stepper.steps()[this.stepper.activeIndex()] === this, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
|
|
17
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
18
|
+
minVersion: "12.0.0",
|
|
19
|
+
version: "22.2.3",
|
|
20
|
+
ngImport: i0,
|
|
21
|
+
type: HyStep,
|
|
22
|
+
deps: [],
|
|
23
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
24
|
+
});
|
|
25
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
26
|
+
minVersion: "17.1.0",
|
|
27
|
+
version: "22.2.3",
|
|
28
|
+
type: HyStep,
|
|
29
|
+
isStandalone: true,
|
|
30
|
+
selector: "hy-step",
|
|
31
|
+
inputs: {
|
|
32
|
+
label: {
|
|
33
|
+
classPropertyName: "label",
|
|
34
|
+
publicName: "label",
|
|
35
|
+
isSignal: true,
|
|
36
|
+
isRequired: true,
|
|
37
|
+
transformFunction: null
|
|
38
|
+
},
|
|
39
|
+
completed: {
|
|
40
|
+
classPropertyName: "completed",
|
|
41
|
+
publicName: "completed",
|
|
42
|
+
isSignal: true,
|
|
43
|
+
isRequired: false,
|
|
44
|
+
transformFunction: null
|
|
45
|
+
},
|
|
46
|
+
disabled: {
|
|
47
|
+
classPropertyName: "disabled",
|
|
48
|
+
publicName: "disabled",
|
|
49
|
+
isSignal: true,
|
|
50
|
+
isRequired: false,
|
|
51
|
+
transformFunction: null
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
host: {
|
|
55
|
+
attributes: { "role": "group" },
|
|
56
|
+
properties: {
|
|
57
|
+
"id": "id + \"-panel\"",
|
|
58
|
+
"attr.aria-labelledby": "id",
|
|
59
|
+
"hidden": "!active()",
|
|
60
|
+
"attr.inert": "active() ? null : \"\""
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
ngImport: i0,
|
|
64
|
+
template: "<ng-content />",
|
|
65
|
+
isInline: true,
|
|
66
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
70
|
+
minVersion: "12.0.0",
|
|
71
|
+
version: "22.2.3",
|
|
72
|
+
ngImport: i0,
|
|
73
|
+
type: HyStep,
|
|
74
|
+
decorators: [{
|
|
75
|
+
type: Component,
|
|
76
|
+
args: [{
|
|
77
|
+
selector: "hy-step",
|
|
78
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
79
|
+
template: "<ng-content />",
|
|
80
|
+
host: {
|
|
81
|
+
role: "group",
|
|
82
|
+
"[id]": "id + \"-panel\"",
|
|
83
|
+
"[attr.aria-labelledby]": "id",
|
|
84
|
+
"[hidden]": "!active()",
|
|
85
|
+
"[attr.inert]": "active() ? null : \"\""
|
|
86
|
+
}
|
|
87
|
+
}]
|
|
88
|
+
}],
|
|
89
|
+
propDecorators: {
|
|
90
|
+
label: [{
|
|
91
|
+
type: i0.Input,
|
|
92
|
+
args: [{
|
|
93
|
+
isSignal: true,
|
|
94
|
+
alias: "label",
|
|
95
|
+
required: true
|
|
96
|
+
}]
|
|
97
|
+
}],
|
|
98
|
+
completed: [{
|
|
99
|
+
type: i0.Input,
|
|
100
|
+
args: [{
|
|
101
|
+
isSignal: true,
|
|
102
|
+
alias: "completed",
|
|
103
|
+
required: false
|
|
104
|
+
}]
|
|
105
|
+
}],
|
|
106
|
+
disabled: [{
|
|
107
|
+
type: i0.Input,
|
|
108
|
+
args: [{
|
|
109
|
+
isSignal: true,
|
|
110
|
+
alias: "disabled",
|
|
111
|
+
required: false
|
|
112
|
+
}]
|
|
113
|
+
}]
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
var HyStepper = class HyStepper {
|
|
117
|
+
el = inject(ElementRef).nativeElement;
|
|
118
|
+
injector = inject(Injector);
|
|
119
|
+
label = input("Steps", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
120
|
+
linear = input(true, {
|
|
121
|
+
...ngDevMode ? { debugName: "linear" } : /* istanbul ignore next */ {},
|
|
122
|
+
transform: booleanAttribute
|
|
123
|
+
});
|
|
124
|
+
selected = model(0, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
125
|
+
steps = contentChildren(HyStep, ...ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []);
|
|
126
|
+
available = computed(() => this.steps().map((step, i, steps) => !step.disabled() && (!this.linear() || steps.slice(0, i).every((previous) => previous.completed()))), ...ngDevMode ? [{ debugName: "available" }] : /* istanbul ignore next */ []);
|
|
127
|
+
activeIndex = computed(() => {
|
|
128
|
+
const requested = Math.trunc(this.selected());
|
|
129
|
+
if (this.available()[requested]) return requested;
|
|
130
|
+
return this.available().findIndex(Boolean);
|
|
131
|
+
}, ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
|
|
132
|
+
select(index) {
|
|
133
|
+
if (!this.available()[index]) return;
|
|
134
|
+
this.selected.set(index);
|
|
135
|
+
afterNextRender(() => this.el.querySelectorAll("nav button")[this.activeIndex()]?.focus(), { injector: this.injector });
|
|
136
|
+
}
|
|
137
|
+
next() {
|
|
138
|
+
this.select(this.activeIndex() + 1);
|
|
139
|
+
}
|
|
140
|
+
previous() {
|
|
141
|
+
this.select(this.activeIndex() - 1);
|
|
142
|
+
}
|
|
143
|
+
onKey(event, index) {
|
|
144
|
+
const rtl = this.el.ownerDocument.defaultView?.getComputedStyle(this.el).direction === "rtl";
|
|
145
|
+
let delta = 0;
|
|
146
|
+
if (event.key === "ArrowRight") delta = rtl ? -1 : 1;
|
|
147
|
+
else if (event.key === "ArrowLeft") delta = rtl ? 1 : -1;
|
|
148
|
+
else if (event.key !== "Home" && event.key !== "End") return;
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
const indices = this.available().flatMap((enabled, i) => enabled ? [i] : []);
|
|
151
|
+
const target = event.key === "Home" ? indices[0] : event.key === "End" ? indices.at(-1) : indices[indices.indexOf(index) + delta];
|
|
152
|
+
if (target !== void 0) this.el.querySelectorAll("nav button")[target]?.focus();
|
|
153
|
+
}
|
|
154
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
155
|
+
minVersion: "12.0.0",
|
|
156
|
+
version: "22.2.3",
|
|
157
|
+
ngImport: i0,
|
|
158
|
+
type: HyStepper,
|
|
159
|
+
deps: [],
|
|
160
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
161
|
+
});
|
|
162
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
163
|
+
minVersion: "17.0.0",
|
|
164
|
+
version: "22.2.3",
|
|
165
|
+
type: HyStepper,
|
|
166
|
+
isStandalone: true,
|
|
167
|
+
selector: "hy-stepper",
|
|
168
|
+
inputs: {
|
|
169
|
+
label: {
|
|
170
|
+
classPropertyName: "label",
|
|
171
|
+
publicName: "label",
|
|
172
|
+
isSignal: true,
|
|
173
|
+
isRequired: false,
|
|
174
|
+
transformFunction: null
|
|
175
|
+
},
|
|
176
|
+
linear: {
|
|
177
|
+
classPropertyName: "linear",
|
|
178
|
+
publicName: "linear",
|
|
179
|
+
isSignal: true,
|
|
180
|
+
isRequired: false,
|
|
181
|
+
transformFunction: null
|
|
182
|
+
},
|
|
183
|
+
selected: {
|
|
184
|
+
classPropertyName: "selected",
|
|
185
|
+
publicName: "selected",
|
|
186
|
+
isSignal: true,
|
|
187
|
+
isRequired: false,
|
|
188
|
+
transformFunction: null
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
outputs: { selected: "selectedChange" },
|
|
192
|
+
queries: [{
|
|
193
|
+
propertyName: "steps",
|
|
194
|
+
predicate: HyStep,
|
|
195
|
+
isSignal: true
|
|
196
|
+
}],
|
|
197
|
+
ngImport: i0,
|
|
198
|
+
template: "<nav [attr.aria-label]=\"label()\">\r\n <ol>\r\n @for (step of steps(); track step; let i = $index) {\r\n <li>\r\n <button\r\n type=\"button\"\r\n [id]=\"step.id\"\r\n [disabled]=\"!available()[i]\"\r\n [attr.aria-current]=\"activeIndex() === i ? 'step' : null\"\r\n [attr.aria-controls]=\"step.id + '-panel'\"\r\n (click)=\"select(i)\"\r\n (keydown)=\"onKey($event, i)\"\r\n >\r\n <span aria-hidden=\"true\">{{ step.completed() ? '✓' : i + 1 }}</span\r\n >{{ step.label() }}\r\n </button>\r\n </li>\r\n }\r\n </ol>\r\n</nav>\r\n<ng-content />\r\n",
|
|
199
|
+
styles: [":host{display:block;color:var(--hy-ink)}ol{display:flex;flex-wrap:wrap;list-style:none;padding:0;margin-block:0 var(--hy-space-6);gap:var(--hy-space-2)}li{flex:1}button{display:flex;align-items:center;gap:var(--hy-space-2);inline-size:100%;padding:var(--hy-space-3);background:var(--hy-surface-2);color:var(--hy-ink-2);border:1px solid var(--hy-line);border-radius:var(--hy-radius-m);font:inherit;cursor:pointer;text-align:start}button[aria-current]{color:var(--hy-primary);border-color:currentColor;background:var(--hy-primary-wash)}button:disabled{opacity:.6;cursor:default}button:focus-visible{outline:2px solid var(--hy-primary);outline-offset:2px}button span{display:grid;place-items:center;inline-size:2rem;block-size:2rem;flex-shrink:0;border:1px solid currentColor;border-radius:50%}\n"],
|
|
200
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
204
|
+
minVersion: "12.0.0",
|
|
205
|
+
version: "22.2.3",
|
|
206
|
+
ngImport: i0,
|
|
207
|
+
type: HyStepper,
|
|
208
|
+
decorators: [{
|
|
209
|
+
type: Component,
|
|
210
|
+
args: [{
|
|
211
|
+
selector: "hy-stepper",
|
|
212
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
213
|
+
template: "<nav [attr.aria-label]=\"label()\">\r\n <ol>\r\n @for (step of steps(); track step; let i = $index) {\r\n <li>\r\n <button\r\n type=\"button\"\r\n [id]=\"step.id\"\r\n [disabled]=\"!available()[i]\"\r\n [attr.aria-current]=\"activeIndex() === i ? 'step' : null\"\r\n [attr.aria-controls]=\"step.id + '-panel'\"\r\n (click)=\"select(i)\"\r\n (keydown)=\"onKey($event, i)\"\r\n >\r\n <span aria-hidden=\"true\">{{ step.completed() ? '✓' : i + 1 }}</span\r\n >{{ step.label() }}\r\n </button>\r\n </li>\r\n }\r\n </ol>\r\n</nav>\r\n<ng-content />\r\n",
|
|
214
|
+
styles: [":host{display:block;color:var(--hy-ink)}ol{display:flex;flex-wrap:wrap;list-style:none;padding:0;margin-block:0 var(--hy-space-6);gap:var(--hy-space-2)}li{flex:1}button{display:flex;align-items:center;gap:var(--hy-space-2);inline-size:100%;padding:var(--hy-space-3);background:var(--hy-surface-2);color:var(--hy-ink-2);border:1px solid var(--hy-line);border-radius:var(--hy-radius-m);font:inherit;cursor:pointer;text-align:start}button[aria-current]{color:var(--hy-primary);border-color:currentColor;background:var(--hy-primary-wash)}button:disabled{opacity:.6;cursor:default}button:focus-visible{outline:2px solid var(--hy-primary);outline-offset:2px}button span{display:grid;place-items:center;inline-size:2rem;block-size:2rem;flex-shrink:0;border:1px solid currentColor;border-radius:50%}\n"]
|
|
215
|
+
}]
|
|
216
|
+
}],
|
|
217
|
+
propDecorators: {
|
|
218
|
+
label: [{
|
|
219
|
+
type: i0.Input,
|
|
220
|
+
args: [{
|
|
221
|
+
isSignal: true,
|
|
222
|
+
alias: "label",
|
|
223
|
+
required: false
|
|
224
|
+
}]
|
|
225
|
+
}],
|
|
226
|
+
linear: [{
|
|
227
|
+
type: i0.Input,
|
|
228
|
+
args: [{
|
|
229
|
+
isSignal: true,
|
|
230
|
+
alias: "linear",
|
|
231
|
+
required: false
|
|
232
|
+
}]
|
|
233
|
+
}],
|
|
234
|
+
selected: [{
|
|
235
|
+
type: i0.Input,
|
|
236
|
+
args: [{
|
|
237
|
+
isSignal: true,
|
|
238
|
+
alias: "selected",
|
|
239
|
+
required: false
|
|
240
|
+
}]
|
|
241
|
+
}, {
|
|
242
|
+
type: i0.Output,
|
|
243
|
+
args: ["selectedChange"]
|
|
244
|
+
}],
|
|
245
|
+
steps: [{
|
|
246
|
+
type: i0.ContentChildren,
|
|
247
|
+
args: [i0.forwardRef(() => HyStep), { isSignal: true }]
|
|
248
|
+
}]
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
const HY_STEPPER = [HyStepper, HyStep];
|
|
252
|
+
export { HY_STEPPER, HyStep, HyStepper };
|
|
253
|
+
|
|
254
|
+
//# sourceMappingURL=hyalo-angular-stepper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyalo-angular-stepper.mjs","names":[],"sources":["../../../projects/hyalo/stepper/stepper.ts","../../../projects/hyalo/stepper/stepper.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n Injector,\r\n afterNextRender,\r\n booleanAttribute,\r\n computed,\r\n contentChildren,\r\n inject,\r\n input,\r\n model,\r\n} from '@angular/core';\r\nimport { injectId } from '@hyalo/angular/core';\r\n\r\n@Component({\r\n selector: 'hy-step',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n template: '<ng-content />',\r\n host: {\r\n role: 'group',\r\n '[id]': 'id + \"-panel\"',\r\n '[attr.aria-labelledby]': 'id',\r\n '[hidden]': '!active()',\r\n '[attr.inert]': 'active() ? null : \"\"',\r\n },\r\n})\r\nexport class HyStep {\r\n private readonly stepper = inject(HyStepper);\r\n readonly label = input.required<string>();\r\n readonly completed = input(false, { transform: booleanAttribute });\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n readonly id = injectId('step');\r\n protected readonly active = computed(\r\n () => this.stepper.steps()[this.stepper.activeIndex()] === this,\r\n );\r\n}\r\n\r\n/** Linear steps require each preceding step to be completed before advancing. */\r\n@Component({\r\n selector: 'hy-stepper',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n templateUrl: './stepper.html',\r\n styleUrl: './stepper.css',\r\n})\r\nexport class HyStepper {\r\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\r\n private readonly injector = inject(Injector);\r\n readonly label = input('Steps');\r\n readonly linear = input(true, { transform: booleanAttribute });\r\n readonly selected = model(0);\r\n readonly steps = contentChildren(HyStep);\r\n protected readonly available = computed(() =>\r\n this.steps().map(\r\n (step, i, steps) =>\r\n !step.disabled() &&\r\n (!this.linear() || steps.slice(0, i).every((previous) => previous.completed())),\r\n ),\r\n );\r\n readonly activeIndex = computed(() => {\r\n const requested = Math.trunc(this.selected());\r\n if (this.available()[requested]) return requested;\r\n return this.available().findIndex(Boolean);\r\n });\r\n\r\n select(index: number): void {\r\n if (!this.available()[index]) return;\r\n this.selected.set(index);\r\n afterNextRender(\r\n () => this.el.querySelectorAll<HTMLButtonElement>('nav button')[this.activeIndex()]?.focus(),\r\n { injector: this.injector },\r\n );\r\n }\r\n next(): void {\r\n this.select(this.activeIndex() + 1);\r\n }\r\n previous(): void {\r\n this.select(this.activeIndex() - 1);\r\n }\r\n\r\n protected onKey(event: KeyboardEvent, index: number): void {\r\n const rtl = this.el.ownerDocument.defaultView?.getComputedStyle(this.el).direction === 'rtl';\r\n let delta = 0;\r\n if (event.key === 'ArrowRight') delta = rtl ? -1 : 1;\r\n else if (event.key === 'ArrowLeft') delta = rtl ? 1 : -1;\r\n else if (event.key !== 'Home' && event.key !== 'End') return;\r\n event.preventDefault();\r\n const indices = this.available().flatMap((enabled, i) => (enabled ? [i] : []));\r\n const target =\r\n event.key === 'Home'\r\n ? indices[0]\r\n : event.key === 'End'\r\n ? indices.at(-1)\r\n : indices[indices.indexOf(index) + delta];\r\n if (target !== undefined)\r\n this.el.querySelectorAll<HTMLButtonElement>('nav button')[target]?.focus();\r\n }\r\n}\r\nexport const HY_STEPPER = [HyStepper, HyStep] as const;\r\n","<nav [attr.aria-label]=\"label()\">\r\n <ol>\r\n @for (step of steps(); track step; let i = $index) {\r\n <li>\r\n <button\r\n type=\"button\"\r\n [id]=\"step.id\"\r\n [disabled]=\"!available()[i]\"\r\n [attr.aria-current]=\"activeIndex() === i ? 'step' : null\"\r\n [attr.aria-controls]=\"step.id + '-panel'\"\r\n (click)=\"select(i)\"\r\n (keydown)=\"onKey($event, i)\"\r\n >\r\n <span aria-hidden=\"true\">{{ step.completed() ? '✓' : i + 1 }}</span\r\n >{{ step.label() }}\r\n </button>\r\n </li>\r\n }\r\n </ol>\r\n</nav>\r\n<ng-content />\r\n"],"mappings":";;;AA2BA,IAAa,SAAb,MAAa,OAAM;CACA,UAAU,OAAO,SAAS;CAClC,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,YAAY,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,YAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACtD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACrD,KAAK,SAAS,MAAM;CACV,SAAS,eACpB,KAAK,QAAQ,MAAK,CAAE,CAAC,KAAK,QAAQ,YAAW,OAAQ,MAC5D,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CARU,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAM,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;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A,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,gBAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,MAAM,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA;AA+CzC,MAAa,aAAa,CAAC,WAAW,MAAM"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { HyLocale } from "@hyalo/angular/core";
|
|
2
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ChangeDetectionStrategy, Component, booleanAttribute, computed, inject, input, model } from "@angular/core";
|
|
5
|
+
var HyTable = class HyTable {
|
|
6
|
+
data = input.required(...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
7
|
+
columns = input.required(...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
|
|
8
|
+
rowKey = input.required(...ngDevMode ? [{ debugName: "rowKey" }] : /* istanbul ignore next */ []);
|
|
9
|
+
caption = input.required(...ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []);
|
|
10
|
+
locale = input(...ngDevMode ? [void 0, { debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
11
|
+
globalLocale = inject(HyLocale);
|
|
12
|
+
effectiveLocale = computed(() => this.locale() ?? this.globalLocale.locale(), ...ngDevMode ? [{ debugName: "effectiveLocale" }] : /* istanbul ignore next */ []);
|
|
13
|
+
selectable = input(false, {
|
|
14
|
+
...ngDevMode ? { debugName: "selectable" } : /* istanbul ignore next */ {},
|
|
15
|
+
transform: booleanAttribute
|
|
16
|
+
});
|
|
17
|
+
stickyHeader = input(false, {
|
|
18
|
+
...ngDevMode ? { debugName: "stickyHeader" } : /* istanbul ignore next */ {},
|
|
19
|
+
transform: booleanAttribute
|
|
20
|
+
});
|
|
21
|
+
loading = input(false, {
|
|
22
|
+
...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
|
|
23
|
+
transform: booleanAttribute
|
|
24
|
+
});
|
|
25
|
+
emptyLabel = input("No results", ...ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []);
|
|
26
|
+
selectionLabel = input("Select all visible rows", ...ngDevMode ? [{ debugName: "selectionLabel" }] : /* istanbul ignore next */ []);
|
|
27
|
+
rowLabel = input(() => "Select row", ...ngDevMode ? [{ debugName: "rowLabel" }] : /* istanbul ignore next */ []);
|
|
28
|
+
selected = model([], ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
29
|
+
sort = model(null, ...ngDevMode ? [{ debugName: "sort" }] : /* istanbul ignore next */ []);
|
|
30
|
+
selectedSet = computed(() => new Set(this.selected()), ...ngDevMode ? [{ debugName: "selectedSet" }] : /* istanbul ignore next */ []);
|
|
31
|
+
sorted = computed(() => {
|
|
32
|
+
const rows = [...this.data()], sort = this.sort(), col = this.columns().find((c) => c.id === sort?.column);
|
|
33
|
+
if (!sort || !col?.sortable) return rows;
|
|
34
|
+
const collator = new Intl.Collator(this.effectiveLocale(), {
|
|
35
|
+
numeric: true,
|
|
36
|
+
sensitivity: "base"
|
|
37
|
+
});
|
|
38
|
+
return rows.sort((a, b) => {
|
|
39
|
+
const av = col.cell(a), bv = col.cell(b);
|
|
40
|
+
const result = col.compare ? col.compare(a, b) : av == null ? bv == null ? 0 : -1 : bv == null ? 1 : typeof av === "number" && typeof bv === "number" ? av - bv : collator.compare(String(av), String(bv));
|
|
41
|
+
return (Number.isFinite(result) ? result : 0) * (sort.direction === "asc" ? 1 : -1);
|
|
42
|
+
});
|
|
43
|
+
}, ...ngDevMode ? [{ debugName: "sorted" }] : /* istanbul ignore next */ []);
|
|
44
|
+
view = computed(() => this.sorted().map((row) => ({
|
|
45
|
+
row,
|
|
46
|
+
key: this.rowKey()(row),
|
|
47
|
+
label: this.rowLabel()(row),
|
|
48
|
+
selected: this.selectedSet().has(this.rowKey()(row)),
|
|
49
|
+
cells: this.columns().map((column) => ({
|
|
50
|
+
column,
|
|
51
|
+
value: column.cell(row)
|
|
52
|
+
}))
|
|
53
|
+
})), ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
|
|
54
|
+
allSelected = computed(() => this.view().length > 0 && this.view().every((row) => row.selected), ...ngDevMode ? [{ debugName: "allSelected" }] : /* istanbul ignore next */ []);
|
|
55
|
+
someSelected = computed(() => this.view().some((row) => row.selected) && !this.allSelected(), ...ngDevMode ? [{ debugName: "someSelected" }] : /* istanbul ignore next */ []);
|
|
56
|
+
toggleSort(column) {
|
|
57
|
+
const current = this.sort();
|
|
58
|
+
this.sort.set(current?.column === column.id ? current.direction === "asc" ? {
|
|
59
|
+
column: column.id,
|
|
60
|
+
direction: "desc"
|
|
61
|
+
} : null : {
|
|
62
|
+
column: column.id,
|
|
63
|
+
direction: "asc"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
toggleRow(key) {
|
|
67
|
+
const selected = new Set(this.selected());
|
|
68
|
+
if (selected.has(key)) selected.delete(key);
|
|
69
|
+
else selected.add(key);
|
|
70
|
+
this.selected.set([...selected]);
|
|
71
|
+
}
|
|
72
|
+
toggleAll() {
|
|
73
|
+
const selected = new Set(this.selected()), all = this.allSelected();
|
|
74
|
+
for (const row of this.view()) if (all) selected.delete(row.key);
|
|
75
|
+
else selected.add(row.key);
|
|
76
|
+
this.selected.set([...selected]);
|
|
77
|
+
}
|
|
78
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
79
|
+
minVersion: "12.0.0",
|
|
80
|
+
version: "22.2.3",
|
|
81
|
+
ngImport: i0,
|
|
82
|
+
type: HyTable,
|
|
83
|
+
deps: [],
|
|
84
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
85
|
+
});
|
|
86
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
87
|
+
minVersion: "17.0.0",
|
|
88
|
+
version: "22.2.3",
|
|
89
|
+
type: HyTable,
|
|
90
|
+
isStandalone: true,
|
|
91
|
+
selector: "hy-table",
|
|
92
|
+
inputs: {
|
|
93
|
+
data: {
|
|
94
|
+
classPropertyName: "data",
|
|
95
|
+
publicName: "data",
|
|
96
|
+
isSignal: true,
|
|
97
|
+
isRequired: true,
|
|
98
|
+
transformFunction: null
|
|
99
|
+
},
|
|
100
|
+
columns: {
|
|
101
|
+
classPropertyName: "columns",
|
|
102
|
+
publicName: "columns",
|
|
103
|
+
isSignal: true,
|
|
104
|
+
isRequired: true,
|
|
105
|
+
transformFunction: null
|
|
106
|
+
},
|
|
107
|
+
rowKey: {
|
|
108
|
+
classPropertyName: "rowKey",
|
|
109
|
+
publicName: "rowKey",
|
|
110
|
+
isSignal: true,
|
|
111
|
+
isRequired: true,
|
|
112
|
+
transformFunction: null
|
|
113
|
+
},
|
|
114
|
+
caption: {
|
|
115
|
+
classPropertyName: "caption",
|
|
116
|
+
publicName: "caption",
|
|
117
|
+
isSignal: true,
|
|
118
|
+
isRequired: true,
|
|
119
|
+
transformFunction: null
|
|
120
|
+
},
|
|
121
|
+
locale: {
|
|
122
|
+
classPropertyName: "locale",
|
|
123
|
+
publicName: "locale",
|
|
124
|
+
isSignal: true,
|
|
125
|
+
isRequired: false,
|
|
126
|
+
transformFunction: null
|
|
127
|
+
},
|
|
128
|
+
selectable: {
|
|
129
|
+
classPropertyName: "selectable",
|
|
130
|
+
publicName: "selectable",
|
|
131
|
+
isSignal: true,
|
|
132
|
+
isRequired: false,
|
|
133
|
+
transformFunction: null
|
|
134
|
+
},
|
|
135
|
+
stickyHeader: {
|
|
136
|
+
classPropertyName: "stickyHeader",
|
|
137
|
+
publicName: "stickyHeader",
|
|
138
|
+
isSignal: true,
|
|
139
|
+
isRequired: false,
|
|
140
|
+
transformFunction: null
|
|
141
|
+
},
|
|
142
|
+
loading: {
|
|
143
|
+
classPropertyName: "loading",
|
|
144
|
+
publicName: "loading",
|
|
145
|
+
isSignal: true,
|
|
146
|
+
isRequired: false,
|
|
147
|
+
transformFunction: null
|
|
148
|
+
},
|
|
149
|
+
emptyLabel: {
|
|
150
|
+
classPropertyName: "emptyLabel",
|
|
151
|
+
publicName: "emptyLabel",
|
|
152
|
+
isSignal: true,
|
|
153
|
+
isRequired: false,
|
|
154
|
+
transformFunction: null
|
|
155
|
+
},
|
|
156
|
+
selectionLabel: {
|
|
157
|
+
classPropertyName: "selectionLabel",
|
|
158
|
+
publicName: "selectionLabel",
|
|
159
|
+
isSignal: true,
|
|
160
|
+
isRequired: false,
|
|
161
|
+
transformFunction: null
|
|
162
|
+
},
|
|
163
|
+
rowLabel: {
|
|
164
|
+
classPropertyName: "rowLabel",
|
|
165
|
+
publicName: "rowLabel",
|
|
166
|
+
isSignal: true,
|
|
167
|
+
isRequired: false,
|
|
168
|
+
transformFunction: null
|
|
169
|
+
},
|
|
170
|
+
selected: {
|
|
171
|
+
classPropertyName: "selected",
|
|
172
|
+
publicName: "selected",
|
|
173
|
+
isSignal: true,
|
|
174
|
+
isRequired: false,
|
|
175
|
+
transformFunction: null
|
|
176
|
+
},
|
|
177
|
+
sort: {
|
|
178
|
+
classPropertyName: "sort",
|
|
179
|
+
publicName: "sort",
|
|
180
|
+
isSignal: true,
|
|
181
|
+
isRequired: false,
|
|
182
|
+
transformFunction: null
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
outputs: {
|
|
186
|
+
selected: "selectedChange",
|
|
187
|
+
sort: "sortChange"
|
|
188
|
+
},
|
|
189
|
+
ngImport: i0,
|
|
190
|
+
template: "<div\r\n class=\"viewport\"\r\n tabindex=\"0\"\r\n role=\"region\"\r\n [attr.aria-label]=\"caption()\"\r\n [attr.aria-busy]=\"loading()\"\r\n [class.sticky]=\"stickyHeader()\"\r\n>\r\n <table>\r\n <caption>\r\n {{\r\n caption()\r\n }}\r\n </caption>\r\n <thead>\r\n <tr>\r\n @if (selectable()) {\r\n <th scope=\"col\" class=\"selection\">\r\n <label class=\"check\"\r\n ><input\r\n type=\"checkbox\"\r\n [attr.aria-label]=\"selectionLabel()\"\r\n [checked]=\"allSelected()\"\r\n [indeterminate]=\"someSelected()\"\r\n [disabled]=\"!view().length\"\r\n (change)=\"toggleAll()\"\r\n /></label>\r\n </th>\r\n }\r\n @for (column of columns(); track column.id) {\r\n <th\r\n scope=\"col\"\r\n [style.text-align]=\"column.align ?? 'start'\"\r\n [attr.aria-sort]=\"\r\n column.sortable\r\n ? sort()?.column === column.id\r\n ? sort()?.direction === 'asc'\r\n ? 'ascending'\r\n : 'descending'\r\n : 'none'\r\n : null\r\n \"\r\n >\r\n @if (column.sortable) {\r\n <button type=\"button\" (click)=\"toggleSort(column)\">\r\n {{ column.header\r\n }}<span aria-hidden=\"true\">{{\r\n sort()?.column === column.id ? (sort()?.direction === 'asc' ? '↑' : '↓') : '↑↓'\r\n }}</span>\r\n </button>\r\n } @else {\r\n {{ column.header }}\r\n }\r\n </th>\r\n }\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (item of view(); track item.key) {\r\n <tr [class.selected]=\"item.selected\">\r\n @if (selectable()) {\r\n <td class=\"selection\">\r\n <label class=\"check\"\r\n ><input\r\n type=\"checkbox\"\r\n [attr.aria-label]=\"item.label\"\r\n [checked]=\"item.selected\"\r\n (change)=\"toggleRow(item.key)\"\r\n /></label>\r\n </td>\r\n }\r\n @for (cell of item.cells; track cell.column.id) {\r\n <td [style.text-align]=\"cell.column.align ?? 'start'\">\r\n @if (cell.column.template) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"cell.column.template\"\r\n [ngTemplateOutletContext]=\"{ $implicit: item.row, value: cell.value }\"\r\n />\r\n } @else {\r\n {{ cell.value }}\r\n }\r\n </td>\r\n }\r\n </tr>\r\n } @empty {\r\n <tr>\r\n <td [attr.colspan]=\"columns().length + (selectable() ? 1 : 0)\">\r\n {{ loading() ? 'Loading' : emptyLabel() }}\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n</div>\r\n",
|
|
191
|
+
styles: [":host{display:block;min-inline-size:0}.viewport{overflow:auto;max-block-size:var(--hy-table-max-height, 32rem);border:1px solid var(--hy-line);border-radius:var(--hy-radius-m);background:var(--hy-surface-1);color:var(--hy-ink)}table{inline-size:100%;border-collapse:separate;border-spacing:0;text-align:start;font-size:.875rem}caption{text-align:start;font-weight:600;padding:1rem}th{font-weight:600;background:var(--hy-surface-2);white-space:nowrap}th,td{padding:.75rem 1rem;border-block-end:1px solid var(--hy-line)}.sticky th{position:sticky;inset-block-start:0;z-index:1}th button{display:inline-flex;align-items:center;justify-content:inherit;gap:.5rem;min-block-size:44px;padding:0;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer}.selection{inline-size:44px;padding:.25rem}.check{display:grid;place-items:center;inline-size:44px;block-size:44px;cursor:pointer}.check input{inline-size:18px;block-size:18px;margin:0;accent-color:var(--hy-primary);cursor:pointer}tr.selected{background:var(--hy-primary-wash)}tbody tr:last-child td{border-block-end:0}.viewport:focus-visible{outline:2px solid var(--hy-primary);outline-offset:3px}:is(button,a,input):focus-visible{outline:2px solid var(--hy-primary);outline-offset:3px}\n"],
|
|
192
|
+
dependencies: [{
|
|
193
|
+
kind: "directive",
|
|
194
|
+
type: NgTemplateOutlet,
|
|
195
|
+
selector: "[ngTemplateOutlet]",
|
|
196
|
+
inputs: [
|
|
197
|
+
"ngTemplateOutletContext",
|
|
198
|
+
"ngTemplateOutlet",
|
|
199
|
+
"ngTemplateOutletInjector"
|
|
200
|
+
]
|
|
201
|
+
}],
|
|
202
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
206
|
+
minVersion: "12.0.0",
|
|
207
|
+
version: "22.2.3",
|
|
208
|
+
ngImport: i0,
|
|
209
|
+
type: HyTable,
|
|
210
|
+
decorators: [{
|
|
211
|
+
type: Component,
|
|
212
|
+
args: [{
|
|
213
|
+
selector: "hy-table",
|
|
214
|
+
imports: [NgTemplateOutlet],
|
|
215
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
216
|
+
template: "<div\r\n class=\"viewport\"\r\n tabindex=\"0\"\r\n role=\"region\"\r\n [attr.aria-label]=\"caption()\"\r\n [attr.aria-busy]=\"loading()\"\r\n [class.sticky]=\"stickyHeader()\"\r\n>\r\n <table>\r\n <caption>\r\n {{\r\n caption()\r\n }}\r\n </caption>\r\n <thead>\r\n <tr>\r\n @if (selectable()) {\r\n <th scope=\"col\" class=\"selection\">\r\n <label class=\"check\"\r\n ><input\r\n type=\"checkbox\"\r\n [attr.aria-label]=\"selectionLabel()\"\r\n [checked]=\"allSelected()\"\r\n [indeterminate]=\"someSelected()\"\r\n [disabled]=\"!view().length\"\r\n (change)=\"toggleAll()\"\r\n /></label>\r\n </th>\r\n }\r\n @for (column of columns(); track column.id) {\r\n <th\r\n scope=\"col\"\r\n [style.text-align]=\"column.align ?? 'start'\"\r\n [attr.aria-sort]=\"\r\n column.sortable\r\n ? sort()?.column === column.id\r\n ? sort()?.direction === 'asc'\r\n ? 'ascending'\r\n : 'descending'\r\n : 'none'\r\n : null\r\n \"\r\n >\r\n @if (column.sortable) {\r\n <button type=\"button\" (click)=\"toggleSort(column)\">\r\n {{ column.header\r\n }}<span aria-hidden=\"true\">{{\r\n sort()?.column === column.id ? (sort()?.direction === 'asc' ? '↑' : '↓') : '↑↓'\r\n }}</span>\r\n </button>\r\n } @else {\r\n {{ column.header }}\r\n }\r\n </th>\r\n }\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (item of view(); track item.key) {\r\n <tr [class.selected]=\"item.selected\">\r\n @if (selectable()) {\r\n <td class=\"selection\">\r\n <label class=\"check\"\r\n ><input\r\n type=\"checkbox\"\r\n [attr.aria-label]=\"item.label\"\r\n [checked]=\"item.selected\"\r\n (change)=\"toggleRow(item.key)\"\r\n /></label>\r\n </td>\r\n }\r\n @for (cell of item.cells; track cell.column.id) {\r\n <td [style.text-align]=\"cell.column.align ?? 'start'\">\r\n @if (cell.column.template) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"cell.column.template\"\r\n [ngTemplateOutletContext]=\"{ $implicit: item.row, value: cell.value }\"\r\n />\r\n } @else {\r\n {{ cell.value }}\r\n }\r\n </td>\r\n }\r\n </tr>\r\n } @empty {\r\n <tr>\r\n <td [attr.colspan]=\"columns().length + (selectable() ? 1 : 0)\">\r\n {{ loading() ? 'Loading' : emptyLabel() }}\r\n </td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n</div>\r\n",
|
|
217
|
+
styles: [":host{display:block;min-inline-size:0}.viewport{overflow:auto;max-block-size:var(--hy-table-max-height, 32rem);border:1px solid var(--hy-line);border-radius:var(--hy-radius-m);background:var(--hy-surface-1);color:var(--hy-ink)}table{inline-size:100%;border-collapse:separate;border-spacing:0;text-align:start;font-size:.875rem}caption{text-align:start;font-weight:600;padding:1rem}th{font-weight:600;background:var(--hy-surface-2);white-space:nowrap}th,td{padding:.75rem 1rem;border-block-end:1px solid var(--hy-line)}.sticky th{position:sticky;inset-block-start:0;z-index:1}th button{display:inline-flex;align-items:center;justify-content:inherit;gap:.5rem;min-block-size:44px;padding:0;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer}.selection{inline-size:44px;padding:.25rem}.check{display:grid;place-items:center;inline-size:44px;block-size:44px;cursor:pointer}.check input{inline-size:18px;block-size:18px;margin:0;accent-color:var(--hy-primary);cursor:pointer}tr.selected{background:var(--hy-primary-wash)}tbody tr:last-child td{border-block-end:0}.viewport:focus-visible{outline:2px solid var(--hy-primary);outline-offset:3px}:is(button,a,input):focus-visible{outline:2px solid var(--hy-primary);outline-offset:3px}\n"]
|
|
218
|
+
}]
|
|
219
|
+
}],
|
|
220
|
+
propDecorators: {
|
|
221
|
+
data: [{
|
|
222
|
+
type: i0.Input,
|
|
223
|
+
args: [{
|
|
224
|
+
isSignal: true,
|
|
225
|
+
alias: "data",
|
|
226
|
+
required: true
|
|
227
|
+
}]
|
|
228
|
+
}],
|
|
229
|
+
columns: [{
|
|
230
|
+
type: i0.Input,
|
|
231
|
+
args: [{
|
|
232
|
+
isSignal: true,
|
|
233
|
+
alias: "columns",
|
|
234
|
+
required: true
|
|
235
|
+
}]
|
|
236
|
+
}],
|
|
237
|
+
rowKey: [{
|
|
238
|
+
type: i0.Input,
|
|
239
|
+
args: [{
|
|
240
|
+
isSignal: true,
|
|
241
|
+
alias: "rowKey",
|
|
242
|
+
required: true
|
|
243
|
+
}]
|
|
244
|
+
}],
|
|
245
|
+
caption: [{
|
|
246
|
+
type: i0.Input,
|
|
247
|
+
args: [{
|
|
248
|
+
isSignal: true,
|
|
249
|
+
alias: "caption",
|
|
250
|
+
required: true
|
|
251
|
+
}]
|
|
252
|
+
}],
|
|
253
|
+
locale: [{
|
|
254
|
+
type: i0.Input,
|
|
255
|
+
args: [{
|
|
256
|
+
isSignal: true,
|
|
257
|
+
alias: "locale",
|
|
258
|
+
required: false
|
|
259
|
+
}]
|
|
260
|
+
}],
|
|
261
|
+
selectable: [{
|
|
262
|
+
type: i0.Input,
|
|
263
|
+
args: [{
|
|
264
|
+
isSignal: true,
|
|
265
|
+
alias: "selectable",
|
|
266
|
+
required: false
|
|
267
|
+
}]
|
|
268
|
+
}],
|
|
269
|
+
stickyHeader: [{
|
|
270
|
+
type: i0.Input,
|
|
271
|
+
args: [{
|
|
272
|
+
isSignal: true,
|
|
273
|
+
alias: "stickyHeader",
|
|
274
|
+
required: false
|
|
275
|
+
}]
|
|
276
|
+
}],
|
|
277
|
+
loading: [{
|
|
278
|
+
type: i0.Input,
|
|
279
|
+
args: [{
|
|
280
|
+
isSignal: true,
|
|
281
|
+
alias: "loading",
|
|
282
|
+
required: false
|
|
283
|
+
}]
|
|
284
|
+
}],
|
|
285
|
+
emptyLabel: [{
|
|
286
|
+
type: i0.Input,
|
|
287
|
+
args: [{
|
|
288
|
+
isSignal: true,
|
|
289
|
+
alias: "emptyLabel",
|
|
290
|
+
required: false
|
|
291
|
+
}]
|
|
292
|
+
}],
|
|
293
|
+
selectionLabel: [{
|
|
294
|
+
type: i0.Input,
|
|
295
|
+
args: [{
|
|
296
|
+
isSignal: true,
|
|
297
|
+
alias: "selectionLabel",
|
|
298
|
+
required: false
|
|
299
|
+
}]
|
|
300
|
+
}],
|
|
301
|
+
rowLabel: [{
|
|
302
|
+
type: i0.Input,
|
|
303
|
+
args: [{
|
|
304
|
+
isSignal: true,
|
|
305
|
+
alias: "rowLabel",
|
|
306
|
+
required: false
|
|
307
|
+
}]
|
|
308
|
+
}],
|
|
309
|
+
selected: [{
|
|
310
|
+
type: i0.Input,
|
|
311
|
+
args: [{
|
|
312
|
+
isSignal: true,
|
|
313
|
+
alias: "selected",
|
|
314
|
+
required: false
|
|
315
|
+
}]
|
|
316
|
+
}, {
|
|
317
|
+
type: i0.Output,
|
|
318
|
+
args: ["selectedChange"]
|
|
319
|
+
}],
|
|
320
|
+
sort: [{
|
|
321
|
+
type: i0.Input,
|
|
322
|
+
args: [{
|
|
323
|
+
isSignal: true,
|
|
324
|
+
alias: "sort",
|
|
325
|
+
required: false
|
|
326
|
+
}]
|
|
327
|
+
}, {
|
|
328
|
+
type: i0.Output,
|
|
329
|
+
args: ["sortChange"]
|
|
330
|
+
}]
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
export { HyTable };
|
|
334
|
+
|
|
335
|
+
//# sourceMappingURL=hyalo-angular-table.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyalo-angular-table.mjs","names":[],"sources":["../../../projects/hyalo/table/table.ts","../../../projects/hyalo/table/table.html"],"sourcesContent":["import { HyLocale } from '@hyalo/angular/core';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport {\r\n ChangeDetectionStrategy,\r\n Component,\r\n TemplateRef,\r\n booleanAttribute,\r\n computed,\r\n input,\r\n inject,\r\n model,\r\n} from '@angular/core';\r\nexport type HyRowKey = string | number;\r\nexport interface HyTableCellContext<T> {\r\n readonly $implicit: T;\r\n readonly value: string | number | null;\r\n}\r\nexport interface HyTableColumn<T> {\r\n readonly id: string;\r\n readonly header: string;\r\n readonly cell: (row: T) => string | number | null;\r\n readonly sortable?: boolean;\r\n readonly compare?: (a: T, b: T) => number;\r\n readonly align?: 'start' | 'end' | 'center';\r\n readonly template?: TemplateRef<HyTableCellContext<T>>;\r\n}\r\nexport interface HyTableSort {\r\n readonly column: string;\r\n readonly direction: 'asc' | 'desc';\r\n}\r\n@Component({\r\n selector: 'hy-table',\r\n imports: [NgTemplateOutlet],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n templateUrl: './table.html',\r\n styleUrl: './table.css',\r\n})\r\nexport class HyTable<T> {\r\n readonly data = input.required<readonly T[]>();\r\n readonly columns = input.required<readonly HyTableColumn<T>[]>();\r\n readonly rowKey = input.required<(row: T) => HyRowKey>();\r\n readonly caption = input.required<string>();\r\n readonly locale = input<string>();\r\n private readonly globalLocale = inject(HyLocale);\r\n private readonly effectiveLocale = computed(() => this.locale() ?? this.globalLocale.locale());\r\n readonly selectable = input(false, { transform: booleanAttribute });\r\n readonly stickyHeader = input(false, { transform: booleanAttribute });\r\n readonly loading = input(false, { transform: booleanAttribute });\r\n readonly emptyLabel = input('No results');\r\n readonly selectionLabel = input('Select all visible rows');\r\n readonly rowLabel = input<(row: T) => string>(() => 'Select row');\r\n readonly selected = model<readonly HyRowKey[]>([]);\r\n readonly sort = model<HyTableSort | null>(null);\r\n private readonly selectedSet = computed(() => new Set(this.selected()));\r\n private readonly sorted = computed(() => {\r\n const rows = [...this.data()],\r\n sort = this.sort(),\r\n col = this.columns().find((c) => c.id === sort?.column);\r\n if (!sort || !col?.sortable) return rows;\r\n const collator = new Intl.Collator(this.effectiveLocale(), {\r\n numeric: true,\r\n sensitivity: 'base',\r\n });\r\n return rows.sort((a, b) => {\r\n const av = col.cell(a),\r\n bv = col.cell(b);\r\n const result = col.compare\r\n ? col.compare(a, b)\r\n : av == null\r\n ? bv == null\r\n ? 0\r\n : -1\r\n : bv == null\r\n ? 1\r\n : typeof av === 'number' && typeof bv === 'number'\r\n ? av - bv\r\n : collator.compare(String(av), String(bv));\r\n return (Number.isFinite(result) ? result : 0) * (sort.direction === 'asc' ? 1 : -1);\r\n });\r\n });\r\n readonly view = computed(() =>\r\n this.sorted().map((row) => ({\r\n row,\r\n key: this.rowKey()(row),\r\n label: this.rowLabel()(row),\r\n selected: this.selectedSet().has(this.rowKey()(row)),\r\n cells: this.columns().map((column) => ({ column, value: column.cell(row) })),\r\n })),\r\n );\r\n readonly allSelected = computed(\r\n () => this.view().length > 0 && this.view().every((row) => row.selected),\r\n );\r\n readonly someSelected = computed(\r\n () => this.view().some((row) => row.selected) && !this.allSelected(),\r\n );\r\n toggleSort(column: HyTableColumn<T>): void {\r\n const current = this.sort();\r\n this.sort.set(\r\n current?.column === column.id\r\n ? current.direction === 'asc'\r\n ? { column: column.id, direction: 'desc' }\r\n : null\r\n : { column: column.id, direction: 'asc' },\r\n );\r\n }\r\n toggleRow(key: HyRowKey): void {\r\n const selected = new Set(this.selected());\r\n if (selected.has(key)) selected.delete(key);\r\n else selected.add(key);\r\n this.selected.set([...selected]);\r\n }\r\n toggleAll(): void {\r\n const selected = new Set(this.selected()),\r\n all = this.allSelected();\r\n for (const row of this.view()) {\r\n if (all) selected.delete(row.key);\r\n else selected.add(row.key);\r\n }\r\n this.selected.set([...selected]);\r\n }\r\n}\r\n","<div\r\n class=\"viewport\"\r\n tabindex=\"0\"\r\n role=\"region\"\r\n [attr.aria-label]=\"caption()\"\r\n [attr.aria-busy]=\"loading()\"\r\n [class.sticky]=\"stickyHeader()\"\r\n>\r\n <table>\r\n <caption>\r\n {{\r\n caption()\r\n }}\r\n </caption>\r\n <thead>\r\n <tr>\r\n @if (selectable()) {\r\n <th scope=\"col\" class=\"selection\">\r\n <label class=\"check\"\r\n ><input\r\n type=\"checkbox\"\r\n [attr.aria-label]=\"selectionLabel()\"\r\n [checked]=\"allSelected()\"\r\n [indeterminate]=\"someSelected()\"\r\n [disabled]=\"!view().length\"\r\n (change)=\"toggleAll()\"\r\n /></label>\r\n </th>\r\n }\r\n @for (column of columns(); track column.id) {\r\n <th\r\n scope=\"col\"\r\n [style.text-align]=\"column.align ?? 'start'\"\r\n [attr.aria-sort]=\"\r\n column.sortable\r\n ? sort()?.column === column.id\r\n ? sort()?.direction === 'asc'\r\n ? 'ascending'\r\n : 'descending'\r\n : 'none'\r\n : null\r\n \"\r\n >\r\n @if (column.sortable) {\r\n <button type=\"button\" (click)=\"toggleSort(column)\">\r\n {{ column.header\r\n }}<span aria-hidden=\"true\">{{\r\n sort()?.column === column.id ? (sort()?.direction === 'asc' ? '↑' : '↓') : '↑↓'\r\n }}</span>\r\n </button>\r\n } @else {\r\n {{ column.header }}\r\n }\r\n </th>\r\n }\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (item of view(); track item.key) {\r\n <tr [class.selected]=\"item.selected\">\r\n @if (selectable()) {\r\n <td class=\"selection\">\r\n <label class=\"check\"\r\n ><input\r\n type=\"checkbox\"\r\n [attr.aria-label]=\"item.label\"\r\n [checked]=\"item.selected\"\r\n (change)=\"toggleRow(item.key)\"\r\n /></label>\r\n </td>\r\n }\r\n @for (cell of item.cells; track cell.column.id) {\r\n <td [style.text-align]=\"cell.column.align ?? 'start'\">\r\n @if (cell.column.template) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"cell.column.template\"\r\n [ngTemplateOutletContext]=\"{ $implicit: item.row, value: cell.value }\"\r\n />\r\n } @else {\r\n {{ cell.value }}\r\n }\r\n </td>\r\n }\r\n </tr>\r\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AA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,UAAA;GAAA,MAAA;EAAA;EAAA,UAAA;EAAA,UCrCpB;EA8FA,QAAA,CAAA,quCAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MD9DY;GAAgB,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;GAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAKf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EAPnB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAU,SACX,CAAC,gBAAgB;GAAC,iBACV,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,quCAAA;EAAA,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { ChangeDetectionStrategy, Component, ElementRef, booleanAttribute, compu
|
|
|
3
3
|
import * as i1 from "@angular/aria/tabs";
|
|
4
4
|
import { Tab, TabList, TabPanel, Tabs } from "@angular/aria/tabs";
|
|
5
5
|
import { HyIcon } from "@hyalo/angular/icon";
|
|
6
|
-
import { ɵtrackIndicator } from "@hyalo/angular";
|
|
6
|
+
import { ɵtrackIndicator } from "@hyalo/angular/core";
|
|
7
7
|
var HyTab = class HyTab {
|
|
8
8
|
panel = inject(TabPanel);
|
|
9
9
|
label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|