sit-onyx 1.0.0-beta.145 → 1.0.0-beta.147

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,2 +1,4 @@
1
+ export * from "./selection/types";
1
2
  export * from "./sorting/types";
3
+ export { useSelection } from "./selection/selection";
2
4
  export { useSorting } from "./sorting/sorting";
@@ -0,0 +1,21 @@
1
+ import type { OnyxDataGridProps } from "../../../..";
2
+ import { DataGridFeatures } from "../../../..";
3
+ export type TransferableEmit = Omit<DataGridFeatures.SelectionState, "contingent"> & {
4
+ contingent: PropertyKey[];
5
+ };
6
+ type __VLS_Props = {
7
+ /**
8
+ * props passed through to DataGrid
9
+ */
10
+ dataGrid: Pick<OnyxDataGridProps<any, any, any, any>, "columns" | "data">;
11
+ /**
12
+ * props passed through to the feature
13
+ */
14
+ selectionOption: DataGridFeatures.SelectionOptions;
15
+ };
16
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ selectionChange: (selectionState: TransferableEmit) => any;
18
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
19
+ onSelectionChange?: ((selectionState: TransferableEmit) => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,35 @@
1
+ import { type Ref } from "vue";
2
+ import type { DataGridEntry } from "../../types";
3
+ import "./selection.scss";
4
+ import type { SelectionOptions, SelectionState } from "./types";
5
+ export declare const SELECTION_FEATURE: unique symbol;
6
+ export declare const SELECTION_COLUMN: unique symbol;
7
+ export declare const useSelection: <TEntry extends DataGridEntry>(options?: SelectionOptions) => {
8
+ name: symbol;
9
+ watch: (Readonly<Ref<boolean, boolean>> | Ref<SelectionState, SelectionState>)[];
10
+ modifyColumns: {
11
+ func: (columnConfig: readonly import("..").NormalizedColumnConfig<TEntry, PropertyKey>[]) => import("..").NormalizedColumnConfig<TEntry, PropertyKey>[];
12
+ };
13
+ typeRenderer: {
14
+ [SELECTION_COLUMN]: {
15
+ header: {
16
+ thAttributes: {
17
+ class: string;
18
+ };
19
+ component: () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
20
+ [key: string]: any;
21
+ }>;
22
+ };
23
+ cell: {
24
+ tdAttributes: {
25
+ class: {
26
+ "onyx-data-grid-selection-cell": boolean;
27
+ };
28
+ };
29
+ component: ({ row }: import("vue").TdHTMLAttributes & import("../../OnyxDataGridRenderer/types.ts").DataGridRendererCellComponentProps<any, import("../../types").DataGridMetadata> & {}) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
30
+ [key: string]: any;
31
+ }>;
32
+ };
33
+ };
34
+ };
35
+ };
@@ -0,0 +1,42 @@
1
+ import { type MaybeRef, type MaybeRefOrGetter } from "vue";
2
+ import type { DataGridEntry } from "../../types";
3
+ export type SelectionState = {
4
+ /**
5
+ * If the `contingent` set refers to entries that are included in the final selection or excluded from it.
6
+ * The `selectMode` is closely coupled with the `HeaderSelectionCheckbox` which is used to "select all" or "deselect all".
7
+ * It allows for tracking selections even when not all rows are known.
8
+ * This especially useful in case of pagination or asynchronous data loading.
9
+ *
10
+ * Based on this there are the following scenarios:
11
+ *
12
+ * | selectMode | selected.size | result | HeaderSelectionCheckbox |
13
+ * |------------|:-------------:|:----------------:|-------------------------|
14
+ * | "include" | == 0 | nothing selected | unchecked |
15
+ * | "include" | > 0 | some selected | indeterminate |
16
+ * | "exclude" | == 0 | all selected | checked |
17
+ * | "exclude" | > 0 | some selected | indeterminate |
18
+ *
19
+ */
20
+ selectMode: "include" | "exclude";
21
+ /**
22
+ * The entries that are included or excluded from the selection, based on `selectMode`.
23
+ */
24
+ contingent: Set<DataGridEntry["id"]>;
25
+ };
26
+ /**
27
+ * The options of the selection feature for the OnyxDataGrid component.
28
+ */
29
+ export type SelectionOptions = {
30
+ /**
31
+ * The currently active selection.
32
+ */
33
+ selectionState?: MaybeRef<SelectionState>;
34
+ /**
35
+ * If the row selection column is shown or not.
36
+ */
37
+ disabled?: MaybeRefOrGetter<boolean>;
38
+ /**
39
+ * If `true` the selection checkbox of a row will only be shown if the row is hovered or selected.
40
+ */
41
+ hover?: MaybeRefOrGetter<boolean>;
42
+ };
@@ -0,0 +1,13 @@
1
+ import { DataGridFeatures } from "../../..";
2
+ import type { SelectionState } from "../../OnyxDataGrid/features/selection/types";
3
+ type __VLS_Props = {
4
+ hover?: boolean;
5
+ disabled?: boolean;
6
+ selectionState?: SelectionState;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ "update:selectionState": (data: DataGridFeatures.SelectionState) => any;
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ "onUpdate:selectionState"?: ((data: DataGridFeatures.SelectionState) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ export default _default;
@@ -6,6 +6,12 @@
6
6
  "close": "Schließen",
7
7
  "dataGrid": {
8
8
  "head": {
9
+ "selection": {
10
+ "selectAll": "Alle Zeilen auswählen",
11
+ "deselectAll": "Alle Zeilen abwählen",
12
+ "select": "Hinzufügen der Zeile mit ID '{id}' zu der Auswahl.",
13
+ "deselect": "Entfernen der Zeile mit ID '{id}' von der Auswahl."
14
+ },
9
15
  "sorting": {
10
16
  "action": {
11
17
  "asc": "Tabelle aufsteigend nach der Spalte {field} sortieren.",
@@ -6,6 +6,12 @@
6
6
  "close": "Close",
7
7
  "dataGrid": {
8
8
  "head": {
9
+ "selection": {
10
+ "selectAll": "Select all rows",
11
+ "deselectAll": "Deselect all rows",
12
+ "select": "Add row with ID '{id}' to the selection.",
13
+ "deselect": "Remove row with ID '{id}' from the selection."
14
+ },
9
15
  "sorting": {
10
16
  "action": {
11
17
  "asc": "Sort the table ascending by the {field} column.",