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.

NameTypStandardBeschreibung
HubTranslationServiceService-Injizierbarer Service zur Verwaltung von Übersetzungen. Methoden: getTranslation(), setTranslations()
HubOverlayServiceService-Service zum programmatischen Erstellen und Verwalten von Overlays
HubPopupServiceService-Vereinfachter Service zum Erstellen von Popup-Elementen
TooltipDirectiveDirective-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.

NameTypBeschreibung
TranslatePipePipeÜbersetzt einen Schlüssel mithilfe des HubTranslationService. Verwendung: {{ "key" | translate }}
GetPipePipeRuft den Wert einer verschachtelten Eigenschaft ab. Verwendung: {{ object | get:"path.to.property" }}
IsStringPipePipePrüft, ob der Wert ein String ist. Verwendung: {{ value | isString }}
IsObjectPipePipePrüft, ob der Wert ein Objekt ist. Verwendung: {{ value | isObject }}
IsObservablePipePipePrüft, ob der Wert ein Observable ist. Verwendung: {{ value | isObservable }}
UcfirstPipePipeSchreibt den ersten Buchstaben groß. Verwendung: {{ "hello" | ucfirst }} → "Hello"
UnwrapAsyncPipePipeEntpackt Observable- oder Promise-Werte in Templates

Templates

Mach es zu deinem — 4 Template-Slots lassen dich eigenes Markup projizieren.

NameBeschreibungBeispiel
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 ObjektinterpolateString("Hello {{name}}", { name: "World" }) → "Hello World"
getValue()Ruft eine verschachtelte Eigenschaft mithilfe der Punktnotation abgetValue(obj, "user.profile.name")
equals()Tiefer Gleichheitsvergleich für Objekte und Arraysequals({ 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.

VariableStandardTypBeschreibung
--hub-tooltip-bgvar(--hub-ref-color-black, #000)color Tooltip background colour. var(--hub-sys-color-primary)#212529
--hub-tooltip-colorvar(--hub-ref-color-white, #fff)color Tooltip text colour. #fff#f8f9fa
--hub-tooltip-opacity0.9number Opacity of the shown tooltip. 10.85
--hub-tooltip-padding-xvar(--hub-ref-space-2, 0.5rem)length Horizontal padding inside the tooltip. 0.75rem1rem
--hub-tooltip-padding-yvar(--hub-ref-space-1, 0.25rem)length Vertical padding inside the tooltip. 0.375rem0.5rem
--hub-tooltip-border-radiusvar(--hub-sys-radius-md, 0.375rem)length Corner radius of the tooltip. 0.25rem999px
--hub-tooltip-font-sizevar(--hub-ref-font-size-sm, 0.875rem)length Font size of the tooltip text. 0.75rem1rem
--hub-tooltip-font-weightvar(--hub-ref-font-weight-base, 400)number Font weight of the tooltip text. 500600
--hub-tooltip-line-heightvar(--hub-ref-line-height-base, 1.5)number Line height of the tooltip text. 1.41.6
--hub-tooltip-max-width200pxlength Maximum width before the text wraps. 160px320px
--hub-tooltip-zindexvar(--hub-sys-zindex-tooltip, 1080)number Stacking order of the tooltip element. 10802000
--hub-tooltip-transition-duration0.15stransition Fade in/out duration. 0.1s0.25s
--hub-tooltip-shadownoneshadow Box shadow of the tooltip. var(--hub-sys-shadow)0 2px 8px rgba(0,0,0,.2)
--hub-tooltip-font-familyvar(--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`).

VariableStandardTypBeschreibung
--hub-overlay-bgvar(--hub-sys-surface-elevated, #f8f9fa)color Background of the overlay panel. #fffvar(--hub-sys-surface-page)
--hub-overlay-border-radiusvar(--hub-sys-radius-sm, 0.25rem)length Corner radius of the overlay panel. 0.5rem0
--hub-overlay-shadowvar(--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-zindexvar(--hub-sys-zindex-dropdown, 1000)number Stacking order of the overlay panel. 10502000
--hub-overlay-backdrop-zindexcalc(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.