@dskripchenko/ui 1.5.0 → 1.6.0

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.
@@ -1,7 +1,21 @@
1
1
  export interface UidBreadcrumbProps {
2
2
  label?: string;
3
3
  separator?: string;
4
+ /** Keep the trail on one line: crumbs do not wrap and long ones truncate with an ellipsis. */
5
+ nowrap?: boolean;
6
+ /**
7
+ * Implies `nowrap`. When the trail does not fit, the middle crumbs (from the
8
+ * second one on) collapse into "…" until it fits; the first and the last crumb stay.
9
+ */
10
+ collapse?: boolean;
11
+ /** `collapse` mode: the "…" is a button that opens a menu of the collapsed crumbs. Set `false` for a plain "…". */
12
+ collapseMenu?: boolean;
4
13
  }
14
+ /**
15
+ * Lay every crumb out at its natural width, then hide middle crumbs (second
16
+ * one first) until the rest plus the "…" fits the list.
17
+ */
18
+ declare function recompute(): Promise<void>;
5
19
  declare function __VLS_template(): {
6
20
  attrs: Partial<{}>;
7
21
  slots: Readonly<{
@@ -9,14 +23,29 @@ declare function __VLS_template(): {
9
23
  }> & {
10
24
  default(): unknown;
11
25
  };
12
- refs: {};
26
+ refs: {
27
+ navRef: HTMLElement;
28
+ listRef: HTMLOListElement;
29
+ probeRef: HTMLSpanElement;
30
+ menuRef: HTMLDivElement;
31
+ };
13
32
  rootEl: HTMLElement;
14
33
  };
15
34
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
16
- declare const __VLS_component: import('vue').DefineComponent<UidBreadcrumbProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UidBreadcrumbProps> & Readonly<{}>, {
35
+ declare const __VLS_component: import('vue').DefineComponent<UidBreadcrumbProps, {
36
+ recompute: typeof recompute;
37
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UidBreadcrumbProps> & Readonly<{}>, {
17
38
  label: string;
18
39
  separator: string;
19
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
40
+ nowrap: boolean;
41
+ collapse: boolean;
42
+ collapseMenu: boolean;
43
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
44
+ navRef: HTMLElement;
45
+ listRef: HTMLOListElement;
46
+ probeRef: HTMLSpanElement;
47
+ menuRef: HTMLDivElement;
48
+ }, HTMLElement>;
20
49
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
21
50
  export default _default;
22
51
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -2,5 +2,18 @@ import { InjectionKey, Ref } from 'vue';
2
2
  export interface BreadcrumbContext {
3
3
  /** Bumped after every UidBreadcrumb update so items can re-check whether they are last. */
4
4
  tick: Ref<number>;
5
+ /**
6
+ * `collapse` mode: the `<li>` elements of the crumbs collapsed into "…", in DOM order.
7
+ * The first one stays in the layout and shows the "…" in place of its content.
8
+ */
9
+ hidden: Ref<readonly HTMLElement[]>;
10
+ /** Whether the "…" opens a menu of the collapsed crumbs. */
11
+ menu: Ref<boolean>;
12
+ /** The menu's element id (for `aria-controls`). */
13
+ menuId: string;
14
+ /** Whether that menu is open. */
15
+ menuOpen: Ref<boolean>;
16
+ /** Toggle the menu of collapsed crumbs, anchored to the "…" button. */
17
+ toggleMenu: (trigger: HTMLElement) => void;
5
18
  }
6
19
  export declare const BREADCRUMB_KEY: InjectionKey<BreadcrumbContext>;
@@ -5,7 +5,15 @@ export interface SelectOption {
5
5
  group?: string;
6
6
  }
7
7
  export type SelectValue = string | number;
8
- export interface UidSelectProps {
8
+ /**
9
+ * The v-model type for a given `multiple` flag: `SelectValue | null` in single
10
+ * mode, `SelectValue[]` with `multiple: true`. A non-literal `boolean` (for
11
+ * example `:multiple="isMulti"`) gives the union of both.
12
+ */
13
+ export type SelectModelValue<M extends boolean = false> = M extends true ? SelectValue[] : SelectValue | null;
14
+ export interface UidSelectProps<M extends boolean = boolean> {
15
+ /** v-model value: `SelectValue | null` in single mode, `SelectValue[]` with `multiple`. */
16
+ modelValue?: SelectModelValue<M>;
9
17
  options: SelectOption[];
10
18
  placeholder?: string;
11
19
  disabled?: boolean;
@@ -15,33 +23,27 @@ export interface UidSelectProps {
15
23
  /**
16
24
  * Multi-value mode: v-model is an array, the selected options are shown as
17
25
  * removable chips, and picking an option toggles it without closing the dropdown.
26
+ * The type parameter `M` follows this flag, so `v-model` and the
27
+ * `update:modelValue` / `change` payloads are typed per mode.
28
+ * (`boolean & M` keeps the runtime prop a Boolean, so a bare `multiple` attribute works.)
18
29
  */
19
- multiple?: boolean;
30
+ multiple?: boolean & M;
20
31
  /** Multiple mode: show at most this many chips and collapse the rest into "+N". */
21
32
  maxTagCount?: number;
22
33
  }
23
- type __VLS_Props = UidSelectProps;
24
- type __VLS_PublicProps = {
25
- modelValue?: SelectValue | SelectValue[] | null;
26
- } & __VLS_Props;
27
- declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
28
- "update:modelValue": (value: SelectValue | SelectValue[] | null) => any;
29
- change: (value: SelectValue | SelectValue[] | null) => any;
30
- }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
31
- "onUpdate:modelValue"?: ((value: SelectValue | SelectValue[] | null) => any) | undefined;
32
- onChange?: ((value: SelectValue | SelectValue[] | null) => any) | undefined;
33
- }>, {
34
- size: "sm" | "md" | "lg";
35
- disabled: boolean;
36
- multiple: boolean;
37
- searchable: boolean;
38
- clearable: boolean;
39
- maxTagCount: number;
40
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
41
- containerRef: HTMLDivElement;
42
- triggerRef: HTMLDivElement;
43
- dropdownRef: HTMLDivElement;
44
- searchRef: HTMLInputElement;
45
- listRef: HTMLDivElement;
46
- }, HTMLDivElement>;
34
+ declare const _default: <M extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
35
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
36
+ readonly "onUpdate:modelValue"?: ((value: SelectModelValue<M>) => any) | undefined;
37
+ readonly onChange?: ((value: SelectModelValue<M>) => any) | undefined;
38
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onChange" | "onUpdate:modelValue"> & UidSelectProps<M> & Partial<{}>> & import('vue').PublicProps;
39
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
40
+ attrs: any;
41
+ slots: {};
42
+ emit: ((evt: "update:modelValue", value: SelectModelValue<M>) => void) & ((evt: "change", value: SelectModelValue<M>) => void);
43
+ }>) => import('vue').VNode & {
44
+ __ctx?: Awaited<typeof __VLS_setup>;
45
+ };
47
46
  export default _default;
47
+ type __VLS_PrettifyLocal<T> = {
48
+ [K in keyof T]: T[K];
49
+ } & {};
@@ -1,2 +1,2 @@
1
1
  export { default as UidSelect } from './UidSelect.vue';
2
- export type { UidSelectProps, SelectOption, SelectValue } from './UidSelect.vue';
2
+ export type { UidSelectProps, SelectOption, SelectValue, SelectModelValue } from './UidSelect.vue';
@@ -22,6 +22,12 @@ export interface UidTableProps {
22
22
  bordered?: boolean;
23
23
  /** Switch on the checkbox column on the left (the header plus every row). */
24
24
  selectable?: boolean;
25
+ /**
26
+ * Pin the selection column to the left edge while the table scrolls horizontally.
27
+ * By default it is pinned only together with `fixed: 'left'` columns;
28
+ * `true` pins it on its own, `false` never pins it.
29
+ */
30
+ selectionFixed?: boolean;
25
31
  /** The set of ids of the selected rows. */
26
32
  selection?: Set<string | number>;
27
33
  /** The row's id field. `id` by default. */
@@ -59,6 +65,7 @@ declare const __VLS_component: import('vue').DefineComponent<UidTableProps, {},
59
65
  striped: boolean;
60
66
  bordered: boolean;
61
67
  selectable: boolean;
68
+ selectionFixed: boolean;
62
69
  selection: Set<string | number>;
63
70
  rowKey: string | ((row: Record<string, unknown>) => string | number);
64
71
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
@@ -0,0 +1,18 @@
1
+ import { Component, ComputedRef } from 'vue';
2
+ export type RouterLocation = string | Record<string, unknown>;
3
+ export interface UseRouterLinkSource {
4
+ href?: string;
5
+ to?: RouterLocation;
6
+ }
7
+ export interface UseRouterLink {
8
+ /** The app's globally registered `RouterLink`, or `null` when `to` is unset or vue-router is not installed. */
9
+ routerLink: ComputedRef<Component | null>;
10
+ /** Plain `href` for the `<a>` fallback: explicit `href`, else a string `to`. */
11
+ fallbackHref: ComputedRef<string | undefined>;
12
+ }
13
+ /**
14
+ * Resolves `to` against a globally registered RouterLink without warning or rendering a
15
+ * broken `<routerlink>` element when vue-router is absent; callers fall back to `<a href>`.
16
+ * Must be called during component setup.
17
+ */
18
+ export declare function useRouterLink(source: UseRouterLinkSource): UseRouterLink;