Skip to content

Commit 2ab847c

Browse files
committed
add ViewParams
1 parent cdb97ab commit 2ab847c

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@beekeeperstudio/plugin",
3-
"version": "1.4.0-beta.2",
3+
"version": "1.4.0-beta.3",
44
"description": "A simple TypeScript wrapper to send messages from your Beekeeper Studio plugin to the main app.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/commonTypes.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,56 @@ export type TableFilter = {
4141
}
4242

4343
export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
44+
45+
export type ActiveRange = {
46+
rows: number[];
47+
columns: string[];
48+
value: JsonValue[][];
49+
};
50+
51+
export type CellMenuTarget = {
52+
type: "cell";
53+
row: number;
54+
column: string;
55+
value: JsonValue;
56+
};
57+
58+
export type ColumnMenuTarget = {
59+
type: "column";
60+
column: string;
61+
rows: number[];
62+
value: JsonValue[];
63+
};
64+
65+
export type RowMenuTarget = {
66+
type: "row";
67+
row: number;
68+
columns: string[];
69+
value: JsonValue[];
70+
};
71+
72+
export type CornerMenuTarget = {
73+
type: "corner";
74+
rows: number[];
75+
columns: string[];
76+
value: JsonValue[][];
77+
};
78+
79+
export type CellMenuParams = {
80+
target: CellMenuTarget;
81+
activeRange: ActiveRange;
82+
};
83+
84+
export type ColumnMenuParams = {
85+
target: ColumnMenuTarget;
86+
activeRange: ActiveRange;
87+
};
88+
89+
export type RowMenuParams = { target: RowMenuTarget; activeRange: ActiveRange };
90+
91+
export type CornerMenuParams = {
92+
target: CornerMenuTarget;
93+
activeRange: ActiveRange;
94+
};
95+
96+
export type LoadViewParams = CornerMenuParams | RowMenuParams | ColumnMenuParams | CellMenuParams;

src/notificationTypes.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import {
33
WindowEventInits,
44
WindowEventClass,
55
JsonValue,
6+
CellMenuParams,
7+
CornerMenuParams,
8+
RowMenuParams,
9+
ColumnMenuParams,
610
} from "./commonTypes";
711

812
export type AppTheme = {
@@ -45,7 +49,11 @@ export type ViewLoadedNotification = {
4549
name: "viewLoaded";
4650
args: {
4751
command: string;
48-
args?: JsonValue;
52+
params?:
53+
| CellMenuParams
54+
| ColumnMenuParams
55+
| RowMenuParams
56+
| CornerMenuParams;
4957
};
5058
};
5159

0 commit comments

Comments
 (0)