@affino/datagrid-vue-app 0.1.21 → 0.1.23

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.
package/dist/internal.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { d as t, r } from "./chunks/dataGridOverlayThemeVars-vzY74EIz.js";
2
2
  import { buildDataGridChromePaneModel as o, buildDataGridChromeRenderModel as d } from "@affino/datagrid-chrome";
3
- import { D as l, a as n, r as G, u as D, b as S, c as u } from "./chunks/useDataGridAppRowModel-g0AWogvz.js";
4
- import { _ as b, a as T, c as p, b as m, d as c, p as x, u as R, e as f, f as C, g as M, h as v, i as h, j as w, k as y, l as F, m as P, n as A, o as O } from "./chunks/DataGridGanttStageEntry-Def2lt1S.js";
3
+ import { D as l, a as n, r as G, u as D, b as S, c as u } from "./chunks/useDataGridAppRowModel-qRa5om5I.js";
4
+ import { _ as b, a as T, c as p, b as m, d as c, p as x, u as R, e as f, f as C, g as M, h as v, i as h, j as w, k as y, l as F, m as P, n as A, o as O } from "./chunks/DataGridGanttStageEntry-C888labI.js";
5
5
  import { _ as E } from "./chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DhdOikY0.js";
6
6
  import { _ as K } from "./chunks/DataGridFindReplacePopover.vue_vue_type_script_setup_true_lang-DfHFHhUf.js";
7
7
  import { buildDataGridTimelineRenderModels as j, normalizeDataGridGanttOptions as k, resolveDataGridTimelineRange as z } from "@affino/datagrid-gantt";
@@ -1,4 +1,4 @@
1
- import type { DataGridColumnMenuActionOptions, DataGridColumnMenuDisabledReasons, DataGridColumnMenuItemKey, DataGridColumnMenuItemLabels } from "./dataGridColumnMenu";
1
+ import type { DataGridColumnMenuActionOptions, DataGridColumnMenuCustomItem, DataGridColumnMenuDisabledReasons, DataGridColumnMenuItemKey, DataGridColumnMenuItemLabels, DataGridColumnMenuTriggerMode } from "./dataGridColumnMenu";
2
2
  type DataGridColumnPin = "left" | "right" | "none";
3
3
  type __VLS_Props = {
4
4
  rows: readonly Record<string, unknown>[];
@@ -7,6 +7,8 @@ type __VLS_Props = {
7
7
  disabledReasons: DataGridColumnMenuDisabledReasons;
8
8
  labels: DataGridColumnMenuItemLabels;
9
9
  actionOptions: DataGridColumnMenuActionOptions;
10
+ customItems: readonly DataGridColumnMenuCustomItem[];
11
+ triggerMode: DataGridColumnMenuTriggerMode;
10
12
  columnKey: string;
11
13
  columnLabel: string;
12
14
  columnDataType?: string;
@@ -28,9 +30,14 @@ declare function toggleMenuFromElement(element: HTMLElement | null): void;
28
30
  declare var __VLS_15: {
29
31
  open: boolean;
30
32
  toggleMenuFromElement: typeof toggleMenuFromElement;
33
+ }, __VLS_17: {
34
+ open: boolean;
35
+ toggleMenuFromElement: typeof toggleMenuFromElement;
31
36
  };
32
37
  type __VLS_Slots = {} & {
33
38
  default?: (props: typeof __VLS_15) => any;
39
+ } & {
40
+ default?: (props: typeof __VLS_17) => any;
34
41
  };
35
42
  declare const __VLS_base: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
36
43
  sort: (direction: "asc" | "desc" | null) => void;
@@ -1,5 +1,8 @@
1
1
  export declare const DATAGRID_COLUMN_MENU_ITEM_KEYS: readonly ["sort", "group", "pin", "filter"];
2
2
  export type DataGridColumnMenuItemKey = (typeof DATAGRID_COLUMN_MENU_ITEM_KEYS)[number];
3
+ export declare const DATAGRID_COLUMN_MENU_TRIGGER_MODES: readonly ["button", "contextmenu", "button+contextmenu"];
4
+ export type DataGridColumnMenuTriggerMode = (typeof DATAGRID_COLUMN_MENU_TRIGGER_MODES)[number];
5
+ export type DataGridColumnMenuCustomItemPlacement = "start" | "end" | `before:${DataGridColumnMenuItemKey}` | `after:${DataGridColumnMenuItemKey}`;
3
6
  export type DataGridColumnMenuItemLabels = Readonly<Partial<Record<DataGridColumnMenuItemKey, string>>>;
4
7
  export type DataGridColumnMenuDisabledReasons = Readonly<Partial<Record<DataGridColumnMenuItemKey, string>>>;
5
8
  export declare const DATAGRID_COLUMN_MENU_ACTION_KEYS: readonly ["sortAsc", "sortDesc", "clearSort", "toggleGroup", "pinMenu", "pinLeft", "pinRight", "unpin", "clearFilter", "addCurrentSelectionToFilter", "selectAllValues", "clearAllValues", "applyFilter", "cancelFilter"];
@@ -11,6 +14,20 @@ export interface DataGridColumnMenuActionOption {
11
14
  label?: string;
12
15
  }
13
16
  export type DataGridColumnMenuActionOptions = Readonly<Partial<Record<DataGridColumnMenuActionKey, DataGridColumnMenuActionOption>>>;
17
+ export interface DataGridColumnMenuCustomItemContext {
18
+ columnKey: string;
19
+ columnLabel: string;
20
+ closeMenu: () => void;
21
+ }
22
+ export interface DataGridColumnMenuCustomItem {
23
+ key: string;
24
+ label: string;
25
+ placement?: DataGridColumnMenuCustomItemPlacement;
26
+ hidden?: boolean;
27
+ disabled?: boolean;
28
+ disabledReason?: string;
29
+ onSelect?: (context: DataGridColumnMenuCustomItemContext) => void | Promise<void>;
30
+ }
14
31
  export interface DataGridColumnMenuColumnOptions {
15
32
  items?: readonly DataGridColumnMenuItemKey[];
16
33
  hide?: readonly DataGridColumnMenuItemKey[];
@@ -18,25 +35,30 @@ export interface DataGridColumnMenuColumnOptions {
18
35
  disabledReasons?: DataGridColumnMenuDisabledReasons;
19
36
  labels?: DataGridColumnMenuItemLabels;
20
37
  actions?: DataGridColumnMenuActionOptions;
38
+ customItems?: readonly DataGridColumnMenuCustomItem[];
21
39
  }
22
40
  export interface DataGridColumnMenuOptions {
23
41
  enabled: boolean;
42
+ trigger: DataGridColumnMenuTriggerMode;
24
43
  maxFilterValues: number;
25
44
  items: readonly DataGridColumnMenuItemKey[];
26
45
  disabled: readonly DataGridColumnMenuItemKey[];
27
46
  disabledReasons: DataGridColumnMenuDisabledReasons;
28
47
  labels: DataGridColumnMenuItemLabels;
29
48
  actions: DataGridColumnMenuActionOptions;
49
+ customItems: readonly DataGridColumnMenuCustomItem[];
30
50
  columns: Readonly<Record<string, DataGridColumnMenuColumnOptions>>;
31
51
  }
32
52
  export type DataGridColumnMenuProp = boolean | {
33
53
  enabled?: boolean;
54
+ trigger?: DataGridColumnMenuTriggerMode;
34
55
  maxFilterValues?: number;
35
56
  items?: readonly DataGridColumnMenuItemKey[];
36
57
  disabled?: readonly DataGridColumnMenuItemKey[];
37
58
  disabledReasons?: DataGridColumnMenuDisabledReasons;
38
59
  labels?: DataGridColumnMenuItemLabels;
39
60
  actions?: DataGridColumnMenuActionOptions;
61
+ customItems?: readonly DataGridColumnMenuCustomItem[];
40
62
  columns?: Readonly<Record<string, DataGridColumnMenuColumnOptions>>;
41
63
  } | null;
42
64
  export declare function resolveDataGridColumnMenu(input: DataGridColumnMenuProp | undefined): DataGridColumnMenuOptions;
@@ -45,3 +67,4 @@ export declare function resolveDataGridColumnMenuDisabledItems(options: DataGrid
45
67
  export declare function resolveDataGridColumnMenuLabels(options: DataGridColumnMenuOptions, columnKey: string): DataGridColumnMenuItemLabels;
46
68
  export declare function resolveDataGridColumnMenuDisabledReasons(options: DataGridColumnMenuOptions, columnKey: string): DataGridColumnMenuDisabledReasons;
47
69
  export declare function resolveDataGridColumnMenuActionOptions(options: DataGridColumnMenuOptions, columnKey: string): DataGridColumnMenuActionOptions;
70
+ export declare function resolveDataGridColumnMenuCustomItems(options: DataGridColumnMenuOptions, columnKey: string): readonly DataGridColumnMenuCustomItem[];
@@ -2,7 +2,7 @@ import type { ComponentPublicInstance, CSSProperties, Ref } from "vue";
2
2
  import type { DataGridColumnPin, DataGridColumnSnapshot, DataGridOverlayRange, DataGridRowNode } from "@affino/datagrid-vue";
3
3
  import type { DataGridFillBehavior } from "@affino/datagrid-vue/advanced";
4
4
  import type { DataGridLayoutMode } from "../config/dataGridLayout";
5
- import type { DataGridColumnMenuActionOptions, DataGridColumnMenuDisabledReasons, DataGridColumnMenuItemKey, DataGridColumnMenuItemLabels } from "../overlays/dataGridColumnMenu";
5
+ import type { DataGridColumnMenuActionOptions, DataGridColumnMenuCustomItem, DataGridColumnMenuDisabledReasons, DataGridColumnMenuItemKey, DataGridColumnMenuItemLabels, DataGridColumnMenuTriggerMode } from "../overlays/dataGridColumnMenu";
6
6
  export type DataGridTableMode = "base" | "tree" | "pivot" | "worker";
7
7
  export type DataGridPendingEdge = "top" | "right" | "bottom" | "left";
8
8
  export type DataGridTableRow<TRow extends Record<string, unknown>> = DataGridRowNode<TRow>;
@@ -43,6 +43,7 @@ export interface DataGridTableStageColumnsSection {
43
43
  sortIndicator: (columnKey: string) => string;
44
44
  setColumnFilterText: (columnKey: string, value: string) => void;
45
45
  columnMenuEnabled?: boolean;
46
+ columnMenuTrigger?: DataGridColumnMenuTriggerMode;
46
47
  columnMenuValueFilterEnabled?: boolean;
47
48
  columnMenuValueFilterRowLimit?: number;
48
49
  columnMenuMaxFilterValues?: number;
@@ -51,6 +52,7 @@ export interface DataGridTableStageColumnsSection {
51
52
  resolveColumnMenuDisabledReasons?: (columnKey: string) => DataGridColumnMenuDisabledReasons;
52
53
  resolveColumnMenuLabels?: (columnKey: string) => DataGridColumnMenuItemLabels;
53
54
  resolveColumnMenuActionOptions?: (columnKey: string) => DataGridColumnMenuActionOptions;
55
+ resolveColumnMenuCustomItems?: (columnKey: string) => readonly DataGridColumnMenuCustomItem[];
54
56
  isColumnFilterActive?: (columnKey: string) => boolean;
55
57
  isColumnGrouped?: (columnKey: string) => boolean;
56
58
  resolveColumnGroupOrder?: (columnKey: string) => number | null;
@@ -116,7 +118,7 @@ export interface DataGridTableStageEditingSection<TRow extends Record<string, un
116
118
  updateEditingCellValue: (value: string) => void;
117
119
  handleEditorKeydown: (event: KeyboardEvent) => void;
118
120
  handleEditorBlur: () => void;
119
- commitInlineEdit: (target?: "stay" | "next" | "previous") => void;
121
+ commitInlineEdit: (target?: "stay" | "next" | "previous" | "none") => void;
120
122
  cancelInlineEdit: () => void;
121
123
  }
122
124
  export interface DataGridTableStageCellsSection<TRow extends Record<string, unknown>> {
@@ -1,4 +1,5 @@
1
1
  import type { DataGridCopyRange } from "@affino/datagrid-vue/advanced";
2
+ import type { DataGridHistoryController } from "../dataGridHistory";
2
3
  export interface DataGridTableStageHistoryAdapter {
3
4
  captureSnapshot: () => unknown;
4
5
  captureSnapshotForRowIds?: (rowIds: readonly (string | number)[]) => unknown;
@@ -15,9 +16,11 @@ export interface UseDataGridTableStageHistoryOptions<TRow extends Record<string,
15
16
  runtime: Pick<import("@affino/datagrid-vue").UseDataGridRuntimeResult<TRow>, "api" | "getBodyRowAtIndex" | "resolveBodyRowIndexById">;
16
17
  cloneRowData: (row: TRow) => TRow;
17
18
  syncViewport: () => void;
19
+ enabled?: boolean;
20
+ maxHistoryDepth?: number;
18
21
  history?: DataGridTableStageHistoryAdapter;
19
22
  }
20
- export interface UseDataGridTableStageHistoryResult {
23
+ export interface UseDataGridTableStageHistoryResult extends DataGridHistoryController {
21
24
  captureHistorySnapshot: () => unknown;
22
25
  captureHistorySnapshotForRowIds: (rowIds: readonly (string | number)[]) => unknown;
23
26
  recordHistoryIntentTransaction: (descriptor: {
@@ -2,7 +2,8 @@ import { type ComputedRef, type Ref } from "vue";
2
2
  import type { DataGridColumnSnapshot, DataGridRowSelectionSnapshot, DataGridSelectionSnapshot } from "@affino/datagrid-vue";
3
3
  import type { DataGridCopyRange } from "@affino/datagrid-vue/advanced";
4
4
  import type { DataGridCellEditablePredicate } from "../dataGridEditability";
5
- import type { DataGridColumnMenuActionOptions, DataGridColumnMenuDisabledReasons, DataGridColumnMenuItemKey, DataGridColumnMenuItemLabels } from "../overlays/dataGridColumnMenu";
5
+ import type { DataGridHistoryController } from "../dataGridHistory";
6
+ import type { DataGridColumnMenuActionOptions, DataGridColumnMenuCustomItem, DataGridColumnMenuDisabledReasons, DataGridColumnMenuItemKey, DataGridColumnMenuItemLabels, DataGridColumnMenuTriggerMode } from "../overlays/dataGridColumnMenu";
6
7
  import type { DataGridLayoutMode } from "../config/dataGridLayout";
7
8
  import type { DataGridVirtualizationOptions } from "../config/dataGridVirtualization";
8
9
  import type { DataGridTableStageContext } from "./dataGridTableStageContext";
@@ -59,6 +60,7 @@ export interface UseDataGridTableStageRuntimeOptions<TRow extends Record<string,
59
60
  sortIndicator: (columnKey: string) => string;
60
61
  setColumnFilterText: (columnKey: string, value: string) => void;
61
62
  columnMenuEnabled?: Ref<boolean>;
63
+ columnMenuTrigger?: Ref<DataGridColumnMenuTriggerMode>;
62
64
  columnMenuValueFilterEnabled?: Ref<boolean>;
63
65
  columnMenuValueFilterRowLimit?: Ref<number>;
64
66
  columnMenuMaxFilterValues?: Ref<number>;
@@ -67,6 +69,7 @@ export interface UseDataGridTableStageRuntimeOptions<TRow extends Record<string,
67
69
  resolveColumnMenuDisabledReasons?: (columnKey: string) => DataGridColumnMenuDisabledReasons;
68
70
  resolveColumnMenuLabels?: (columnKey: string) => DataGridColumnMenuItemLabels;
69
71
  resolveColumnMenuActionOptions?: (columnKey: string) => DataGridColumnMenuActionOptions;
72
+ resolveColumnMenuCustomItems?: (columnKey: string) => readonly DataGridColumnMenuCustomItem[];
70
73
  isColumnFilterActive?: (columnKey: string) => boolean;
71
74
  isColumnGrouped?: (columnKey: string) => boolean;
72
75
  resolveColumnGroupOrder?: (columnKey: string) => number | null;
@@ -87,6 +90,9 @@ export interface UseDataGridTableStageRuntimeOptions<TRow extends Record<string,
87
90
  applyRangeMove?: (baseRange: DataGridCopyRange, targetRange: DataGridCopyRange) => boolean;
88
91
  isCellEditable?: DataGridCellEditablePredicate<TRow>;
89
92
  history?: DataGridTableStageHistoryAdapter;
93
+ historyEnabled?: Ref<boolean>;
94
+ historyMaxDepth?: Ref<number | undefined>;
95
+ historyShortcuts?: Ref<false | "grid" | "window">;
90
96
  isContextMenuVisible?: () => boolean;
91
97
  closeContextMenu?: () => void;
92
98
  openContextMenuFromCurrentCell?: () => void;
@@ -97,6 +103,7 @@ export interface UseDataGridTableStageRuntimeOptions<TRow extends Record<string,
97
103
  export interface UseDataGridTableStageRuntimeResult<TRow extends Record<string, unknown>> {
98
104
  tableStageProps: ComputedRef<DataGridTableStageProps<TRow>>;
99
105
  tableStageContext: DataGridTableStageContext<TRow>;
106
+ historyController: DataGridHistoryController;
100
107
  syncViewportFromDom: () => void;
101
108
  copySelectedCells: (trigger?: "keyboard" | "context-menu") => Promise<boolean>;
102
109
  pasteSelectedCells: (trigger?: "keyboard" | "context-menu") => Promise<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@affino/datagrid-vue-app",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "Declarative Vue DataGrid component for Affino",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -37,10 +37,10 @@
37
37
  "dependencies": {
38
38
  "@affino/menu-vue": "^2.1.1",
39
39
  "@affino/popover-vue": "^1.1.0",
40
- "@affino/datagrid-vue": "0.3.13",
40
+ "@affino/datagrid-vue": "0.3.15",
41
41
  "@affino/datagrid-chrome": "0.1.1",
42
- "@affino/datagrid-gantt": "0.1.1",
43
- "@affino/datagrid-theme": "0.2.2"
42
+ "@affino/datagrid-theme": "0.2.2",
43
+ "@affino/datagrid-gantt": "0.1.1"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "vue": "^3.3.0"