nuance-ui 0.1.25 → 0.1.27

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.
Files changed (29) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/app-shell/app-shell.d.vue.ts +19 -9
  3. package/dist/runtime/components/app-shell/app-shell.vue +20 -16
  4. package/dist/runtime/components/app-shell/app-shell.vue.d.ts +19 -9
  5. package/dist/runtime/components/app-shell/context.d.ts +5 -5
  6. package/dist/runtime/components/checkbox/checkbox.d.vue.ts +3 -4
  7. package/dist/runtime/components/checkbox/checkbox.vue +4 -6
  8. package/dist/runtime/components/checkbox/checkbox.vue.d.ts +3 -4
  9. package/dist/runtime/components/index.d.ts +1 -0
  10. package/dist/runtime/components/index.js +1 -0
  11. package/dist/runtime/components/table/_ui/table-row.d.vue.ts +35 -0
  12. package/dist/runtime/components/table/_ui/table-row.vue +74 -0
  13. package/dist/runtime/components/table/_ui/table-row.vue.d.ts +35 -0
  14. package/dist/runtime/components/table/index.d.ts +1 -0
  15. package/dist/runtime/components/table/index.js +1 -0
  16. package/dist/runtime/components/table/lib.d.ts +6 -0
  17. package/dist/runtime/components/table/lib.js +24 -0
  18. package/dist/runtime/components/table/model.d.ts +150 -0
  19. package/dist/runtime/components/table/model.js +0 -0
  20. package/dist/runtime/components/table/table.d.ts +30 -0
  21. package/dist/runtime/components/table/table.d.vue.ts +48 -0
  22. package/dist/runtime/components/table/table.vue +520 -0
  23. package/dist/runtime/components/table/table.vue.d.ts +48 -0
  24. package/dist/runtime/components/tree/_ui/tree-root.d.vue.ts +2 -2
  25. package/dist/runtime/components/tree/_ui/tree-root.vue.d.ts +2 -2
  26. package/dist/runtime/components/tree/lib/item-handlers.js +2 -2
  27. package/dist/runtime/components/tree/tree.d.vue.ts +2 -2
  28. package/dist/runtime/components/tree/tree.vue.d.ts +2 -2
  29. package/package.json +7 -5
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^4.0.0"
6
6
  },
7
- "version": "0.1.25",
7
+ "version": "0.1.27",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -1,22 +1,32 @@
1
1
  import type { BoxProps } from '../box.vue.js';
2
2
  export interface AppShellProps extends BoxProps {
3
- /** AppShellNavbar collapsed state. Required if you use AppShellNavbar component. */
4
- navbar?: boolean;
5
- /** AppShellAside collapsed state. Required if you use AppShellAside component. */
6
- aside?: boolean;
7
- /** AppShellHeader collapsed state. Required if you use AppShellHeader component. */
8
- header?: boolean;
9
- /** AppShellFooter collapsed state. Required if you use AppShellFooter component. */
10
- footer?: boolean;
11
3
  /** Determines how Navbar/Aside are arranged relative to Header/Footer, `default` by default */
12
4
  layout?: 'default' | 'alt';
13
5
  withBorder?: boolean;
14
6
  }
7
+ type __VLS_Props = AppShellProps;
8
+ type __VLS_ModelProps = {
9
+ 'aside'?: boolean;
10
+ 'header'?: boolean;
11
+ 'navbar'?: boolean;
12
+ 'footer'?: boolean;
13
+ };
14
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
15
15
  declare var __VLS_6: {};
16
16
  type __VLS_Slots = {} & {
17
17
  default?: (props: typeof __VLS_6) => any;
18
18
  };
19
- declare const __VLS_base: import("vue").DefineComponent<AppShellProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AppShellProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ "update:aside": (value: boolean) => any;
21
+ "update:header": (value: boolean) => any;
22
+ "update:navbar": (value: boolean) => any;
23
+ "update:footer": (value: boolean) => any;
24
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
25
+ "onUpdate:aside"?: ((value: boolean) => any) | undefined;
26
+ "onUpdate:header"?: ((value: boolean) => any) | undefined;
27
+ "onUpdate:navbar"?: ((value: boolean) => any) | undefined;
28
+ "onUpdate:footer"?: ((value: boolean) => any) | undefined;
29
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
30
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
21
31
  declare const _default: typeof __VLS_export;
22
32
  export default _default;
@@ -1,28 +1,32 @@
1
1
  <script setup>
2
- import { computed, toRefs } from "vue";
2
+ import { computed } from "vue";
3
3
  import Box from "../box.vue";
4
4
  import { useProvideAppShell } from "./context";
5
- const { is, mod, layout = "default", withBorder = false, ...rest } = defineProps({
6
- navbar: { type: Boolean, required: false },
7
- aside: { type: Boolean, required: false },
8
- header: { type: Boolean, required: false },
9
- footer: { type: Boolean, required: false },
5
+ const {
6
+ is,
7
+ mod,
8
+ layout = "default",
9
+ withBorder = false
10
+ } = defineProps({
10
11
  layout: { type: String, required: false },
11
12
  withBorder: { type: Boolean, required: false },
12
13
  is: { type: null, required: false },
13
14
  mod: { type: [Object, Array, null], required: false }
14
15
  });
15
- const flags = toRefs(rest);
16
- useProvideAppShell(flags);
16
+ const aside = defineModel("aside", { type: Boolean, ...{ default: false } });
17
+ const header = defineModel("header", { type: Boolean, ...{ default: false } });
18
+ const navbar = defineModel("navbar", { type: Boolean, ...{ default: false } });
19
+ const footer = defineModel("footer", { type: Boolean, ...{ default: false } });
20
+ useProvideAppShell({ aside, footer, header, navbar });
17
21
  const style = computed(() => ({
18
- "--app-shell-navbar-transform": flags.navbar.value ? "translateX(calc(-1 * var(--app-shell-navbar-width)))" : void 0,
19
- "--app-shell-navbar-offset": flags.navbar.value ? "0rem" : void 0,
20
- "--app-shell-aside-transform": flags.aside.value ? "translateX(var(--app-shell-aside-width))" : void 0,
21
- "--app-shell-aside-offset": flags.aside.value ? "0rem" : void 0,
22
- "--app-shell-header-transform": flags.header.value ? "translateY(calc(-1 * var(--app-shell-header-height)))" : void 0,
23
- "--app-shell-header-offset": flags.header.value ? "0rem" : void 0,
24
- "--app-shell-footer-transform": flags.footer.value ? "translateY(var(--app-shell-footer-height))" : void 0,
25
- "--app-shell-footer-offset": flags.footer.value ? "0rem" : void 0
22
+ "--app-shell-navbar-transform": navbar.value ? "translateX(calc(-1 * var(--app-shell-navbar-width)))" : void 0,
23
+ "--app-shell-navbar-offset": navbar.value ? "0rem" : void 0,
24
+ "--app-shell-aside-transform": aside.value ? "translateX(var(--app-shell-aside-width))" : void 0,
25
+ "--app-shell-aside-offset": aside.value ? "0rem" : void 0,
26
+ "--app-shell-header-transform": header.value ? "translateY(calc(-1 * var(--app-shell-header-height)))" : void 0,
27
+ "--app-shell-header-offset": header.value ? "0rem" : void 0,
28
+ "--app-shell-footer-transform": footer.value ? "translateY(var(--app-shell-footer-height))" : void 0,
29
+ "--app-shell-footer-offset": footer.value ? "0rem" : void 0
26
30
  }));
27
31
  </script>
28
32
 
@@ -1,22 +1,32 @@
1
1
  import type { BoxProps } from '../box.vue.js';
2
2
  export interface AppShellProps extends BoxProps {
3
- /** AppShellNavbar collapsed state. Required if you use AppShellNavbar component. */
4
- navbar?: boolean;
5
- /** AppShellAside collapsed state. Required if you use AppShellAside component. */
6
- aside?: boolean;
7
- /** AppShellHeader collapsed state. Required if you use AppShellHeader component. */
8
- header?: boolean;
9
- /** AppShellFooter collapsed state. Required if you use AppShellFooter component. */
10
- footer?: boolean;
11
3
  /** Determines how Navbar/Aside are arranged relative to Header/Footer, `default` by default */
12
4
  layout?: 'default' | 'alt';
13
5
  withBorder?: boolean;
14
6
  }
7
+ type __VLS_Props = AppShellProps;
8
+ type __VLS_ModelProps = {
9
+ 'aside'?: boolean;
10
+ 'header'?: boolean;
11
+ 'navbar'?: boolean;
12
+ 'footer'?: boolean;
13
+ };
14
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
15
15
  declare var __VLS_6: {};
16
16
  type __VLS_Slots = {} & {
17
17
  default?: (props: typeof __VLS_6) => any;
18
18
  };
19
- declare const __VLS_base: import("vue").DefineComponent<AppShellProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AppShellProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ "update:aside": (value: boolean) => any;
21
+ "update:header": (value: boolean) => any;
22
+ "update:navbar": (value: boolean) => any;
23
+ "update:footer": (value: boolean) => any;
24
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
25
+ "onUpdate:aside"?: ((value: boolean) => any) | undefined;
26
+ "onUpdate:header"?: ((value: boolean) => any) | undefined;
27
+ "onUpdate:navbar"?: ((value: boolean) => any) | undefined;
28
+ "onUpdate:footer"?: ((value: boolean) => any) | undefined;
29
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
30
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
21
31
  declare const _default: typeof __VLS_export;
22
32
  export default _default;
@@ -1,9 +1,9 @@
1
- import type { Ref } from 'vue';
1
+ import type { ModelRef } from 'vue';
2
2
  interface AppShellState {
3
- header: Ref<boolean>;
4
- navbar: Ref<boolean>;
5
- aside: Ref<boolean>;
6
- footer: Ref<boolean>;
3
+ header: ModelRef<boolean>;
4
+ navbar: ModelRef<boolean>;
5
+ aside: ModelRef<boolean>;
6
+ footer: ModelRef<boolean>;
7
7
  }
8
8
  export declare const useProvideAppShell: (args_0: AppShellState) => AppShellState;
9
9
  export declare const useAppShell: () => AppShellState | undefined;
@@ -6,12 +6,11 @@ export interface CheckboxProps extends Omit<InlineInputProps, 'id'> {
6
6
  variant?: 'filled' | 'outline';
7
7
  radius?: NuanceSize;
8
8
  size?: NuanceSize;
9
- indeterminate?: boolean;
10
9
  value?: string;
11
10
  }
12
11
  type __VLS_Props = CheckboxProps;
13
12
  type __VLS_ModelProps = {
14
- modelValue?: boolean;
13
+ modelValue?: boolean | 'indeterminate';
15
14
  };
16
15
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
17
16
  declare var __VLS_10: {
@@ -22,9 +21,9 @@ type __VLS_Slots = {} & {
22
21
  icon?: (props: typeof __VLS_10) => any;
23
22
  };
24
23
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
- "update:modelValue": (value: boolean | undefined) => any;
24
+ "update:modelValue": (value: boolean | "indeterminate" | undefined) => any;
26
25
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
- "onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
26
+ "onUpdate:modelValue"?: ((value: boolean | "indeterminate" | undefined) => any) | undefined;
28
27
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
28
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
29
  declare const _default: typeof __VLS_export;
@@ -11,7 +11,6 @@ const {
11
11
  variant = "filled",
12
12
  color,
13
13
  iconColor,
14
- indeterminate,
15
14
  value,
16
15
  ...rest
17
16
  } = defineProps({
@@ -20,7 +19,6 @@ const {
20
19
  variant: { type: String, required: false },
21
20
  radius: { type: String, required: false },
22
21
  size: { type: String, required: false },
23
- indeterminate: { type: Boolean, required: false },
24
22
  value: { type: String, required: false },
25
23
  label: { type: String, required: false },
26
24
  description: { type: String, required: false },
@@ -31,12 +29,12 @@ const {
31
29
  mod: { type: [Object, Array, null], required: false }
32
30
  });
33
31
  const id = useId();
34
- const modelValue = defineModel({ type: Boolean });
32
+ const modelValue = defineModel({ type: [Boolean, String] });
35
33
  const ctx = useCheckboxGroupState();
36
34
  const checked = computed(() => {
37
35
  if (ctx?.value && value)
38
36
  return ctx?.value.value.includes(value);
39
- return modelValue.value;
37
+ return !!modelValue.value;
40
38
  });
41
39
  const size = ctx?.size ?? _size;
42
40
  const toggle = () => modelValue.value = !modelValue.value;
@@ -64,8 +62,8 @@ const style = computed(() => useStyleResolver((theme) => {
64
62
  @change='() => value && ctx ? ctx.onUpdate(value) : toggle()'
65
63
  >
66
64
 
67
- <slot name='icon' :indeterminate='indeterminate' :class='$style.icon'>
68
- <Icon v-if='!indeterminate' name='gravity-ui:check' :class='$style.icon' />
65
+ <slot name='icon' :indeterminate='modelValue === "indeterminate"' :class='$style.icon'>
66
+ <Icon v-if='modelValue !== "indeterminate"' name='gravity-ui:check' :class='$style.icon' />
69
67
  <Icon v-else name='gravity-ui:minus' :class='$style.icon' />
70
68
  </slot>
71
69
  </Box>
@@ -6,12 +6,11 @@ export interface CheckboxProps extends Omit<InlineInputProps, 'id'> {
6
6
  variant?: 'filled' | 'outline';
7
7
  radius?: NuanceSize;
8
8
  size?: NuanceSize;
9
- indeterminate?: boolean;
10
9
  value?: string;
11
10
  }
12
11
  type __VLS_Props = CheckboxProps;
13
12
  type __VLS_ModelProps = {
14
- modelValue?: boolean;
13
+ modelValue?: boolean | 'indeterminate';
15
14
  };
16
15
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
17
16
  declare var __VLS_10: {
@@ -22,9 +21,9 @@ type __VLS_Slots = {} & {
22
21
  icon?: (props: typeof __VLS_10) => any;
23
22
  };
24
23
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
- "update:modelValue": (value: boolean | undefined) => any;
24
+ "update:modelValue": (value: boolean | "indeterminate" | undefined) => any;
26
25
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
- "onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
26
+ "onUpdate:modelValue"?: ((value: boolean | "indeterminate" | undefined) => any) | undefined;
28
27
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
28
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
29
  declare const _default: typeof __VLS_export;
@@ -22,6 +22,7 @@ export * from './popover/index.js';
22
22
  export * from './progress/index.js';
23
23
  export * from './roving-focus/index.js';
24
24
  export * from './select/index.js';
25
+ export * from './table/index.js';
25
26
  export * from './tabs/index.js';
26
27
  export * from './text.vue.js';
27
28
  export * from './textarea.vue.js';
@@ -21,6 +21,7 @@ export * from "./popover/index.js";
21
21
  export * from "./progress/index.js";
22
22
  export * from "./roving-focus/index.js";
23
23
  export * from "./select/index.js";
24
+ export * from "./table/index.js";
24
25
  export * from "./tabs/index.js";
25
26
  export * from "./text.vue";
26
27
  export * from "./textarea.vue";
@@ -0,0 +1,35 @@
1
+ import type { Row } from '@tanstack/vue-table';
2
+ import type { TableData, TableRow } from '../model.js';
3
+ export interface TableRowProps<T extends TableData> {
4
+ row: Row<T>;
5
+ onSelect?: (e: Event, row: TableRow<T>) => void;
6
+ onHover?: (e: Event, row: TableRow<T> | null) => void;
7
+ onContextmenu?: ((e: Event, row: TableRow<T>) => void) | Array<((e: Event, row: TableRow<T>) => void)>;
8
+ }
9
+ declare const __VLS_export: <T extends TableData>(__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<{
10
+ props: __VLS_PrettifyLocal<TableRowProps<T>> & import("vue").PublicProps;
11
+ expose: (exposed: {}) => void;
12
+ attrs: any;
13
+ slots: {
14
+ [x: `${string}-cell`]: ((props: {
15
+ cell: import("@tanstack/table-core").Cell<T, unknown>;
16
+ column: import("@tanstack/table-core").Column<T, unknown>;
17
+ getValue: import("@tanstack/table-core").Getter<unknown>;
18
+ renderValue: import("@tanstack/table-core").Getter<unknown>;
19
+ row: Row<T>;
20
+ table: import("@tanstack/table-core").Table<T>;
21
+ }) => any) | undefined;
22
+ } & {
23
+ expanded?: (props: {
24
+ row: Row<T>;
25
+ }) => any;
26
+ };
27
+ emit: {};
28
+ }>) => import("vue").VNode & {
29
+ __ctx?: Awaited<typeof __VLS_setup>;
30
+ };
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
33
+ type __VLS_PrettifyLocal<T> = {
34
+ [K in keyof T as K]: T[K];
35
+ } & {};
@@ -0,0 +1,74 @@
1
+ <script setup>
2
+ import { FlexRender } from "@tanstack/vue-table";
3
+ import Box from "../../box.vue";
4
+ import { resolveValue } from "../lib";
5
+ const { row, onSelect, onHover, onContextmenu } = defineProps({
6
+ row: { type: Object, required: true },
7
+ onSelect: { type: Function, required: false },
8
+ onHover: { type: Function, required: false },
9
+ onContextmenu: { type: [Function, Array], required: false }
10
+ });
11
+ function onRowSelect(e, row2) {
12
+ if (!onSelect)
13
+ return;
14
+ const target = e.target;
15
+ const isInteractive = target.closest("button") || target.closest("a");
16
+ if (isInteractive)
17
+ return;
18
+ e.preventDefault();
19
+ e.stopPropagation();
20
+ onSelect(e, row2);
21
+ }
22
+ function onRowHover(e, row2) {
23
+ if (!onHover)
24
+ return;
25
+ onHover(e, row2);
26
+ }
27
+ function onRowContextmenu(e, row2) {
28
+ if (!onContextmenu)
29
+ return;
30
+ if (Array.isArray(onContextmenu))
31
+ onContextmenu.forEach((fn) => fn(e, row2));
32
+ else
33
+ onContextmenu(e, row2);
34
+ }
35
+ </script>
36
+
37
+ <template>
38
+ <Box
39
+ is='tr'
40
+ v-bind='$attrs'
41
+ :mod='{
42
+ selected: row.getIsSelected(),
43
+ expanded: row.getIsExpanded(),
44
+ selectable: !!onSelect || !!onHover || !!onContextmenu
45
+ }'
46
+ :role="onSelect ? 'button' : void 0"
47
+ :tabindex='onSelect ? 0 : void 0'
48
+ @click='onRowSelect($event, row)'
49
+ @pointerenter='onRowHover($event, row)'
50
+ @pointerleave='onRowHover($event, null)'
51
+ @contextmenu='onRowContextmenu($event, row)'
52
+ >
53
+ <Box
54
+ is='td'
55
+ v-for='cell in row.getVisibleCells()'
56
+ :key='cell.id'
57
+ :mod='{ pinned: cell.column.getIsPinned() }'
58
+ :colspan='resolveValue(cell.column.columnDef.meta?.colspan?.td, cell)'
59
+ :rowspan='resolveValue(cell.column.columnDef.meta?.rowspan?.td, cell)'
60
+ :class='resolveValue(cell.column.columnDef.meta?.class?.td, cell)'
61
+ :style='resolveValue(cell.column.columnDef.meta?.style?.td, cell)'
62
+ >
63
+ <slot :name='`${cell.column.id}-cell`' v-bind='cell.getContext()'>
64
+ <FlexRender :render='cell.column.columnDef.cell' :props='cell.getContext()' />
65
+ </slot>
66
+ </Box>
67
+ </Box>
68
+
69
+ <tr v-if='row.getIsExpanded()'>
70
+ <td :colspan='row.getAllCells().length'>
71
+ <slot name='expanded' :row='row' />
72
+ </td>
73
+ </tr>
74
+ </template>
@@ -0,0 +1,35 @@
1
+ import type { Row } from '@tanstack/vue-table';
2
+ import type { TableData, TableRow } from '../model.js';
3
+ export interface TableRowProps<T extends TableData> {
4
+ row: Row<T>;
5
+ onSelect?: (e: Event, row: TableRow<T>) => void;
6
+ onHover?: (e: Event, row: TableRow<T> | null) => void;
7
+ onContextmenu?: ((e: Event, row: TableRow<T>) => void) | Array<((e: Event, row: TableRow<T>) => void)>;
8
+ }
9
+ declare const __VLS_export: <T extends TableData>(__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<{
10
+ props: __VLS_PrettifyLocal<TableRowProps<T>> & import("vue").PublicProps;
11
+ expose: (exposed: {}) => void;
12
+ attrs: any;
13
+ slots: {
14
+ [x: `${string}-cell`]: ((props: {
15
+ cell: import("@tanstack/table-core").Cell<T, unknown>;
16
+ column: import("@tanstack/table-core").Column<T, unknown>;
17
+ getValue: import("@tanstack/table-core").Getter<unknown>;
18
+ renderValue: import("@tanstack/table-core").Getter<unknown>;
19
+ row: Row<T>;
20
+ table: import("@tanstack/table-core").Table<T>;
21
+ }) => any) | undefined;
22
+ } & {
23
+ expanded?: (props: {
24
+ row: Row<T>;
25
+ }) => any;
26
+ };
27
+ emit: {};
28
+ }>) => import("vue").VNode & {
29
+ __ctx?: Awaited<typeof __VLS_setup>;
30
+ };
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
33
+ type __VLS_PrettifyLocal<T> = {
34
+ [K in keyof T as K]: T[K];
35
+ } & {};
@@ -0,0 +1 @@
1
+ export * from './model.js';
@@ -0,0 +1 @@
1
+ export * from "./model.js";
@@ -0,0 +1,6 @@
1
+ import type { Updater } from '@tanstack/vue-table';
2
+ import type { Ref } from 'vue';
3
+ import type { TableColumn, TableData } from './model.js';
4
+ export declare function processColumns<T extends TableData>(columns: TableColumn<T>[]): TableColumn<T>[];
5
+ export declare function valueUpdater<T extends Updater<any>>(updaterOrValue: T, ref: Ref): void;
6
+ export declare function resolveValue<T, A = undefined>(prop: T | ((arg: A) => T), arg?: A): T | undefined;
@@ -0,0 +1,24 @@
1
+ export function processColumns(columns) {
2
+ return columns.map((column) => {
3
+ const col = { ...column };
4
+ if ("columns" in col && col.columns)
5
+ col.columns = processColumns(col.columns);
6
+ if (!col.cell) {
7
+ col.cell = ({ getValue }) => {
8
+ const value = getValue();
9
+ if (value === "" || value === null || value === void 0)
10
+ return "\xA0";
11
+ return String(value);
12
+ };
13
+ }
14
+ return col;
15
+ });
16
+ }
17
+ export function valueUpdater(updaterOrValue, ref) {
18
+ ref.value = typeof updaterOrValue === "function" ? updaterOrValue(ref.value) : updaterOrValue;
19
+ }
20
+ export function resolveValue(prop, arg) {
21
+ if (typeof prop === "function")
22
+ return prop(arg);
23
+ return prop;
24
+ }
@@ -0,0 +1,150 @@
1
+ import type { RowData, TableMeta } from '@tanstack/table-core';
2
+ import type { CellContext, ColumnDef, ColumnFiltersOptions, ColumnPinningOptions, ColumnSizingOptions, CoreOptions, ExpandedOptions, FacetedOptions, GlobalFilterOptions, GroupingOptions, HeaderContext, PaginationOptions, Row, RowPinningOptions, RowSelectionOptions, SortingOptions, VisibilityOptions } from '@tanstack/vue-table';
3
+ import type { VirtualizerOptions } from '@tanstack/vue-virtual';
4
+ import type { TableHTMLAttributes, WatchOptions } from 'vue';
5
+ import type { NuanceColor } from '../../types/index.js';
6
+ export type TableRow<T> = Row<T>;
7
+ export type TableData = RowData;
8
+ export type TableColumn<T extends TableData, D = unknown> = ColumnDef<T, D>;
9
+ export interface TableOptions<T extends TableData = TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
10
+ state?: CoreOptions<T>['state'];
11
+ onStateChange?: CoreOptions<T>['onStateChange'];
12
+ renderFallbackValue?: CoreOptions<T>['renderFallbackValue'];
13
+ }
14
+ type DynamicHeaderSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-header`, (props: HeaderContext<T, unknown>) => any>;
15
+ type DynamicFooterSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-footer`, (props: HeaderContext<T, unknown>) => any>;
16
+ type DynamicCellSlots<T, K = keyof T> = Record<string, (props: CellContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-cell`, (props: CellContext<T, unknown>) => any>;
17
+ export type TableSlots<T extends TableData = TableData> = {
18
+ 'expanded': (props: {
19
+ row: Row<T>;
20
+ }) => any;
21
+ 'empty': (props?: object) => any;
22
+ 'loading': (props?: object) => any;
23
+ 'caption': (props?: object) => any;
24
+ 'body-top': (props?: object) => any;
25
+ 'body-bottom': (props?: object) => any;
26
+ } & DynamicHeaderSlots<T> & DynamicFooterSlots<T> & DynamicCellSlots<T>;
27
+ export interface TableProps<T extends TableData = TableData> extends TableOptions<T>, /** @vue-ignore */ Omit<TableHTMLAttributes, 'columns' | 'onSelect' | 'onContextmenu'> {
28
+ data?: T[];
29
+ columns?: TableColumn<T>[];
30
+ caption?: string;
31
+ meta?: TableMeta<T>;
32
+ /**
33
+ * Enable virtualization for large datasets.
34
+ * Note: when enabled, the divider between rows and sticky properties are not supported.
35
+ * @see https://tanstack.com/virtual/latest/docs/api/virtualizer#options
36
+ * @defaultValue false
37
+ */
38
+ virtualize?: boolean | (Partial<Omit<VirtualizerOptions<Element, Element>, 'getScrollElement' | 'count' | 'estimateSize' | 'overscan'>> & {
39
+ /**
40
+ * Number of items rendered outside the visible area
41
+ * @defaultValue 12
42
+ */
43
+ overscan?: number;
44
+ /**
45
+ * Estimated size (in px) of each item, or a function that returns the size for a given index
46
+ * @defaultValue 65
47
+ */
48
+ estimateSize?: number | ((index: number) => number);
49
+ });
50
+ /**
51
+ * The text to display when the table is empty.
52
+ */
53
+ empty?: string;
54
+ /**
55
+ * Whether the table should have a sticky header or footer. True for both, 'header' for header only, 'footer' for footer only.
56
+ * Note: this prop is not supported when `virtualize` is true.
57
+ * @defaultValue false
58
+ */
59
+ sticky?: boolean | 'header' | 'footer';
60
+ /** Whether the table should be in loading state. */
61
+ loading?: boolean;
62
+ /**
63
+ * @defaultValue 'primary'
64
+ */
65
+ loadingColor?: NuanceColor | string;
66
+ onSelect?: (e: Event, row: TableRow<T>) => void;
67
+ onHover?: (e: Event, row: TableRow<T> | null) => void;
68
+ onContextmenu?: ((e: Event, row: TableRow<T>) => void) | Array<((e: Event, row: TableRow<T>) => void)>;
69
+ classes?: {
70
+ root?: string;
71
+ table?: string;
72
+ thead?: string;
73
+ th?: string;
74
+ tr?: string;
75
+ tbody?: string;
76
+ tfoot?: string;
77
+ caption?: string;
78
+ loading?: string;
79
+ empty?: string;
80
+ separator?: string;
81
+ };
82
+ /**
83
+ * Use the `watchOptions` prop to customize reactivity (for ex: disable deep watching for changes in your data or limiting the max traversal depth). This can improve performance by reducing unnecessary re-renders, but it should be used with caution as it may lead to unexpected behavior if not managed properly.
84
+ * @see [API](https://vuejs.org/api/options-state.html#watch)
85
+ * @see [Guide](https://vuejs.org/guide/essentials/watchers.html)
86
+ * @defaultValue { deep: true }
87
+ */
88
+ watchOptions?: WatchOptions;
89
+ /**
90
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/global-filtering#table-options)
91
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)
92
+ */
93
+ globalFilterOptions?: Omit<GlobalFilterOptions<T>, 'onGlobalFilterChange'>;
94
+ /**
95
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/column-filtering#table-options)
96
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
97
+ */
98
+ columnFiltersOptions?: Omit<ColumnFiltersOptions<T>, 'getFilteredRowModel' | 'onColumnFiltersChange'>;
99
+ /**
100
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/column-pinning#table-options)
101
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)
102
+ */
103
+ columnPinningOptions?: Omit<ColumnPinningOptions, 'onColumnPinningChange'>;
104
+ /**
105
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/column-sizing#table-options)
106
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)
107
+ */
108
+ columnSizingOptions?: Omit<ColumnSizingOptions, 'onColumnSizingChange' | 'onColumnSizingInfoChange'>;
109
+ /**
110
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/column-visibility#table-options)
111
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
112
+ */
113
+ visibilityOptions?: Omit<VisibilityOptions, 'onColumnVisibilityChange'>;
114
+ /**
115
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/sorting#table-options)
116
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
117
+ */
118
+ sortingOptions?: Omit<SortingOptions<T>, 'getSortedRowModel' | 'onSortingChange'>;
119
+ /**
120
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/grouping#table-options)
121
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
122
+ */
123
+ groupingOptions?: Omit<GroupingOptions, 'onGroupingChange'>;
124
+ /**
125
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/expanding#table-options)
126
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/expanding)
127
+ */
128
+ expandedOptions?: Omit<ExpandedOptions<T>, 'getExpandedRowModel' | 'onExpandedChange'>;
129
+ /**
130
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/row-selection#table-options)
131
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
132
+ */
133
+ rowSelectionOptions?: Omit<RowSelectionOptions<T>, 'onRowSelectionChange'>;
134
+ /**
135
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/row-pinning#table-options)
136
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)
137
+ */
138
+ rowPinningOptions?: Omit<RowPinningOptions<T>, 'onRowPinningChange'>;
139
+ /**
140
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/pagination#table-options)
141
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/pagination)
142
+ */
143
+ paginationOptions?: Omit<PaginationOptions, 'onPaginationChange'>;
144
+ /**
145
+ * @see [API](https://tanstack.com/table/v8/docs/api/features/column-faceting#table-options)
146
+ * @see [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)
147
+ */
148
+ facetedOptions?: FacetedOptions<T>;
149
+ }
150
+ export {};
File without changes
@@ -0,0 +1,30 @@
1
+ import type { Cell, Header, RowData } from '@tanstack/vue-table'
2
+
3
+
4
+ declare module '@tanstack/table-core' {
5
+ interface ColumnMeta<TData extends RowData, TValue> {
6
+ class?: {
7
+ th?: string | ((cell: Header<TData, TValue>) => string)
8
+ td?: string | ((cell: Cell<TData, TValue>) => string)
9
+ }
10
+ style?: {
11
+ th?: string | Record<string, string> | ((cell: Header<TData, TValue>) => string | Record<string, string>)
12
+ td?: string | Record<string, string> | ((cell: Cell<TData, TValue>) => string | Record<string, string>)
13
+ }
14
+ colspan?: {
15
+ td?: string | ((cell: Cell<TData, TValue>) => string)
16
+ }
17
+ rowspan?: {
18
+ td?: string | ((cell: Cell<TData, TValue>) => string)
19
+ }
20
+ }
21
+
22
+ interface TableMeta<TData> {
23
+ class?: {
24
+ tr?: string | ((row: Row<TData>) => string)
25
+ }
26
+ style?: {
27
+ tr?: string | Record<string, string> | ((row: Row<TData>) => string | Record<string, string>)
28
+ }
29
+ }
30
+ }