Angular Utility-Bibliothek | ng-hub-ui-utils
Angular Utility-Bibliothek mit Pipes, Fokusmanagement, Overlays, Transitions und Übersetzungs-Helfern, die von wiederverwendbaren UI-Komponenten gemeinsam genutzt werden.
API-Referenz
Hier ist der vollständige Vertrag für utils: alles, was du binden, abhören, projizieren und gestalten kannst, an einem Ort gesammelt. Verdrahte, was du brauchst, und gestalte, was du willst — es ist standalone und Signals-freundlich.
Inputs
Stelle utils mit 4 Inputs ein. Binde sie wie jeden Angular-@Input.
| Name | Typ | Standard | Beschreibung |
|---|---|---|---|
HubTranslationService | Service | - | Injizierbarer Service zur Verwaltung von Übersetzungen. Methoden: getTranslation(), setTranslations() |
HubOverlayService | Service | - | Service zum programmatischen Erstellen und Verwalten von Overlays |
HubPopupService | Service | - | Vereinfachter Service zum Erstellen von Popup-Elementen |
TooltipDirective | Directive | - | Directive ([tooltip]) that shows a positioned, themeable tooltip on hover/focus. Inputs: tooltip (text), placement, delay, offset. |
Outputs
Reagiere darauf, was utils tut — 7 Events, an die du deine Logik anknüpfen kannst.
| Name | Typ | Beschreibung |
|---|---|---|
TranslatePipe | Pipe | Übersetzt einen Schlüssel mithilfe des HubTranslationService. Verwendung: {{ "key" | translate }} |
GetPipe | Pipe | Ruft den Wert einer verschachtelten Eigenschaft ab. Verwendung: {{ object | get:"path.to.property" }} |
IsStringPipe | Pipe | Prüft, ob der Wert ein String ist. Verwendung: {{ value | isString }} |
IsObjectPipe | Pipe | Prüft, ob der Wert ein Objekt ist. Verwendung: {{ value | isObject }} |
IsObservablePipe | Pipe | Prüft, ob der Wert ein Observable ist. Verwendung: {{ value | isObservable }} |
UcfirstPipe | Pipe | Schreibt den ersten Buchstaben groß. Verwendung: {{ "hello" | ucfirst }} → "Hello" |
UnwrapAsyncPipe | Pipe | Entpackt Observable- oder Promise-Werte in Templates |
Templates
Mach es zu deinem — 4 Template-Slots lassen dich eigenes Markup projizieren.
| Name | Beschreibung | Beispiel |
|---|---|---|
hubFocusTrap() | Fängt den Tastaturfokus innerhalb eines Elements ein. Nützlich für Modals und Dialoge. | hubFocusTrap(zone, element, stopFocusTrap$, refocusOnClick) |
interpolateString() | Ersetzt {{ placeholders }} durch Werte aus einem Objekt | interpolateString("Hello {{name}}", { name: "World" }) → "Hello World" |
getValue() | Ruft eine verschachtelte Eigenschaft mithilfe der Punktnotation ab | getValue(obj, "user.profile.name") |
equals() | Tiefer Gleichheitsvergleich für Objekte und Arrays | equals({ a: 1 }, { a: 1 }) → true |
CSS-Variablen
Gestalte jedes Pixel mit 19 CSS-Variablen. Überschreibe sie auf :root oder begrenze sie auf einen Wrapper.
Tooltip
Theming tokens for the [tooltip] directive.
| Variable | Standard | Typ | Beschreibung |
|---|---|---|---|
--hub-tooltip-bg | var(--hub-ref-color-black, #000) | color | Tooltip background colour. var(--hub-sys-color-primary)#212529 |
--hub-tooltip-color | var(--hub-ref-color-white, #fff) | color | Tooltip text colour. #fff#f8f9fa |
--hub-tooltip-opacity | 0.9 | number | Opacity of the shown tooltip. 10.85 |
--hub-tooltip-padding-x | var(--hub-ref-space-2, 0.5rem) | length | Horizontal padding inside the tooltip. 0.75rem1rem |
--hub-tooltip-padding-y | var(--hub-ref-space-1, 0.25rem) | length | Vertical padding inside the tooltip. 0.375rem0.5rem |
--hub-tooltip-border-radius | var(--hub-sys-radius-md, 0.375rem) | length | Corner radius of the tooltip. 0.25rem999px |
--hub-tooltip-font-size | var(--hub-ref-font-size-sm, 0.875rem) | length | Font size of the tooltip text. 0.75rem1rem |
--hub-tooltip-font-weight | var(--hub-ref-font-weight-base, 400) | number | Font weight of the tooltip text. 500600 |
--hub-tooltip-line-height | var(--hub-ref-line-height-base, 1.5) | number | Line height of the tooltip text. 1.41.6 |
--hub-tooltip-max-width | 200px | length | Maximum width before the text wraps. 160px320px |
--hub-tooltip-zindex | var(--hub-sys-zindex-tooltip, 1080) | number | Stacking order of the tooltip element. 10802000 |
--hub-tooltip-transition-duration | 0.15s | transition | Fade in/out duration. 0.1s0.25s |
--hub-tooltip-shadow | none | shadow | Box shadow of the tooltip. var(--hub-sys-shadow)0 2px 8px rgba(0,0,0,.2) |
--hub-tooltip-font-family | var(--hub-ref-font-family-base, inherit) | string | Font family of the tooltip text. inheritmonospace |
Overlay
CSS variables consumed by the overlay/popup system (`.hub-overlay-container` / `.hub-overlay-backdrop`).
| Variable | Standard | Typ | Beschreibung |
|---|---|---|---|
--hub-overlay-bg | var(--hub-sys-surface-elevated, #f8f9fa) | color | Background of the overlay panel. #fffvar(--hub-sys-surface-page) |
--hub-overlay-border-radius | var(--hub-sys-radius-sm, 0.25rem) | length | Corner radius of the overlay panel. 0.5rem0 |
--hub-overlay-shadow | var(--hub-sys-shadow, 0 0.5rem 1rem rgba(0,0,0,.15)) | shadow | Elevation shadow of the overlay panel. var(--hub-sys-shadow-lg)none |
--hub-overlay-zindex | var(--hub-sys-zindex-dropdown, 1000) | number | Stacking order of the overlay panel. 10502000 |
--hub-overlay-backdrop-zindex | calc(var(--hub-sys-zindex-dropdown, 1000) - 1) | number | Stacking order of the overlay backdrop (just below the panel). 10491999 |
Styling und Theming
Es sind noch keine Styling-Beispiele dokumentiert. Dieser Abschnitt wird Anpassungsrezepte und Theming-Beispiele enthalten.