import { KbqSidebarModule } from '@koobiq/components/sidebar';

KbqSidebar

componentСкопировать ссылку на KbqSidebar
@Component({ selector: 'kbq-sidebar', exportAs: 'kbqSidebar' })
class KbqSidebar {
    opened = input<boolean | undefined>();
    readonly position = input<SidebarPositions>();
    readonly stateChanged = output<boolean>();
    get hasSavedState(): boolean;
    saveState(): void;
    clearSavedState(): void;
    toggle(): void;
}
useStateSavinginputСкопировать ссылку на useStateSavingboolean

Whether the component remembers its state across reloads and restores it on the next render. Defaults to true, or to whatever KBQ_STATE_SAVING_ENABLED is provided as.

stateSavingKeyinputСкопировать ссылку на stateSavingKeystring

The key the state is persisted under. While it is empty the key is derived from where the component sits in the document, which moves when the surrounding markup is restructured — an id on the component or any ancestor pins it just as well as this input does.

hasSavedStateСкопировать ссылку на hasSavedStateboolean

Whether state is currently persisted for this sidebar — restored on init, or written since. Always false while useStateSaving is unset, and false again after clearSavedState().

saveState()Скопировать ссылку на saveState()void

Persists whether the sidebar is open and the width it was last left at.

Called whenever opened changes. The width is only captured as the sidebar closes, so dragging it wider and reloading without closing it keeps the previous width — the same as before persistence.

clearSavedState()Скопировать ссылку на clearSavedState()void

Removes the state persisted for this sidebar.

Persistence itself stays on — the next change is written again. Unset useStateSaving to stop it.

KbqSidebarClosed

directiveСкопировать ссылку на KbqSidebarClosed
@Directive({ selector: '[kbq-sidebar-closed]', exportAs: 'kbqSidebarClosed' })
class KbqSidebarClosed {
    readonly width = input<string>();
}

KbqSidebarOpened

directiveСкопировать ссылку на KbqSidebarOpened
@Directive({ selector: '[kbq-sidebar-opened]', exportAs: 'kbqSidebarOpened' })
class KbqSidebarOpened {
    readonly minWidth = input<string>();
    readonly width = input<string>();
    readonly maxWidth = input<string>();
}

KbqSidebarState

interfaceСкопировать ссылку на KbqSidebarState

The persisted state of a sidebar — whether it was open, and the width it was last left at.

interface KbqSidebarState {
    opened: boolean;
    width?: string;
}
widthoptionalСкопировать ссылку на widthstring

Absent while the sidebar has never been resized away from the width its content declares.

SidebarPositions

enumСкопировать ссылку на SidebarPositions
enum SidebarPositions {
    Left = 'left',
    Right = 'right'
}
Предложения по улучшению
Если вы нашли ошибку или хотите доработать статью, создайте запрос на GitHub.