sit-onyx 1.0.0-beta.45 → 1.0.0-beta.47

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.
@@ -0,0 +1,17 @@
1
+ import type { DataGridEntry, DataGridMetadata } from "../types";
2
+ import type { OnyxDataGridRendererProps } from "./types";
3
+ declare const _default: <TEntry extends DataGridEntry, TMetadata extends DataGridMetadata>(__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<{
4
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<{}> & Readonly<{}>, never>, never> & OnyxDataGridRendererProps<TEntry, TMetadata>> & import("vue").PublicProps;
5
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
6
+ attrs: any;
7
+ slots: {};
8
+ emit: {};
9
+ }>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
10
+ [key: string]: any;
11
+ }> & {
12
+ __ctx?: Awaited<typeof __VLS_setup>;
13
+ };
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = {
16
+ [K in keyof T]: T[K];
17
+ } & {};
@@ -0,0 +1,87 @@
1
+ import type { FunctionalComponent, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from "vue";
2
+ import type { WithHTMLAttributes } from "../../../types";
3
+ import type { OnyxTableProps } from "../../OnyxTable/types";
4
+ import type { DataGridEntry, DataGridMetadata } from "../types";
5
+ export type OnyxDataGridRendererProps<TEntry extends DataGridEntry = DataGridEntry, TMetadata extends DataGridMetadata = DataGridMetadata> = OnyxTableProps & {
6
+ /**
7
+ * Will define which columns and their headers are rendered in which order.
8
+ */
9
+ columns: DataGridRendererColumn<TEntry, object>[];
10
+ rows: DataGridRendererRow<TEntry, TMetadata>[];
11
+ };
12
+ /**
13
+ * Describes how a column header is rendered in the data grid.
14
+ */
15
+ export type DataGridRendererColumn<TEntry extends DataGridEntry, TProps extends object> = {
16
+ /**
17
+ * (Unique) Key of the column - usually a key of the table data.
18
+ * But can also be used for custom columns.
19
+ */
20
+ key: keyof TEntry;
21
+ /**
22
+ * The component that renders the header content and is placed into the `<th>` element.
23
+ */
24
+ component: FunctionalComponent<WithHTMLAttributes<TProps>>;
25
+ /**
26
+ * Attributes and data that is provided to the component using `v-bind`.
27
+ */
28
+ props: WithHTMLAttributes<TProps>;
29
+ /**
30
+ * Attributes that are bound directly to the `<th>` element of the column.
31
+ */
32
+ thAttributes?: ThHTMLAttributes;
33
+ };
34
+ /**
35
+ * Describes how a specific row is rendered in the data grid.
36
+ */
37
+ export type DataGridRendererRow<TEntry extends DataGridEntry, TMetadata extends DataGridMetadata = DataGridMetadata> = {
38
+ /**
39
+ * Unique id of the row.
40
+ */
41
+ id: PropertyKey;
42
+ /**
43
+ * Describes how a cell in a specific row is rendered in the data grid.
44
+ * Only cells that are defined in the columns will be rendered in the defined order.
45
+ */
46
+ cells: Partial<Record<keyof TEntry, DataGridRendererCell<TEntry, TMetadata>>>;
47
+ /**
48
+ * Attributes that are bound directly to the `<tr>` element of the row.
49
+ */
50
+ trAttributes?: HTMLAttributes;
51
+ };
52
+ /**
53
+ * Describes how a single cell in a specific row is rendered in the data grid.
54
+ */
55
+ export type DataGridRendererCell<TEntry extends DataGridEntry, TMetadata extends DataGridMetadata = DataGridMetadata> = {
56
+ /**
57
+ * The component that renders the actual cell content and is placed into the `<td>` element.
58
+ */
59
+ component: DataGridRendererCellComponent<TEntry, TMetadata>;
60
+ /**
61
+ * Attributes and data that is provided to the component using `v-bind`.
62
+ */
63
+ props: DataGridRendererCellComponentProps<TEntry, TMetadata>;
64
+ /**
65
+ * Attributes that are bound directly to the `<td>` element of the cell.
66
+ */
67
+ tdAttributes?: TdHTMLAttributes;
68
+ };
69
+ /**
70
+ * Vue component that renders the actual content of a single data grid cell.
71
+ */
72
+ export type DataGridRendererCellComponent<TEntry extends DataGridEntry, TMetadata extends DataGridMetadata = DataGridMetadata> = FunctionalComponent<WithHTMLAttributes<DataGridRendererCellComponentProps<TEntry, TMetadata>, TdHTMLAttributes>>;
73
+ export type DataGridRendererCellComponentProps<TEntry extends DataGridEntry, TMetadata extends DataGridMetadata> = {
74
+ /**
75
+ * Complete row data.
76
+ */
77
+ row: TEntry;
78
+ /**
79
+ * Cell data that is provided to the component via the `metadata` prop.
80
+ */
81
+ metadata?: TMetadata;
82
+ /**
83
+ * Cell data that is provided to the component via the `modelValue` prop.
84
+ * If the cell renders readonly, this will just be the non-editable value.
85
+ */
86
+ modelValue?: TEntry[keyof TEntry];
87
+ };
@@ -0,0 +1,8 @@
1
+ export type DataGridMetadata = Record<string, unknown>;
2
+ /**
3
+ * "Raw" user data for a data grid entry/row, e.g. fetched from a backend service.
4
+ */
5
+ export type DataGridEntry = {
6
+ id: PropertyKey;
7
+ [key: PropertyKey]: unknown;
8
+ };
@@ -15,4 +15,27 @@ export type OnyxTableProps = DensityProp & {
15
15
  * - Warning: Don't set a max-height/width on the table when `withPageScrolling` is set.
16
16
  */
17
17
  withPageScrolling?: boolean;
18
+ /**
19
+ * Optional column groups that are rendered above the table head to group columns together.
20
+ * Slot `head` must be filled for this to work and `withVerticalBorders` property should be set.
21
+ */
22
+ columnGroups?: TableColumnGroup[];
23
+ };
24
+ /**
25
+ * Table group that is rendered as `<colgroup>` and corresponding `<th scope="colgroup">` inside the table.
26
+ */
27
+ export type TableColumnGroup = {
28
+ /**
29
+ * Unique key to identify the column group.
30
+ */
31
+ key: PropertyKey;
32
+ /**
33
+ * Number of columns to span. Must be >= 1.
34
+ * Sum of all column group spans must add up to the total number of table columns.
35
+ */
36
+ span: number;
37
+ /**
38
+ * Header text to display.
39
+ */
40
+ header?: string;
18
41
  };