lucid-extension-sdk 0.0.215 → 0.0.217

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/commandtypes.d.ts CHANGED
@@ -28,6 +28,8 @@ export declare const enum CommandName {
28
28
  AddMenuItem = "ami",
29
29
  AddShapeData = "asd",
30
30
  AddSpreadsheetIntegration = "asi",
31
+ AddTableColumn = "atc",
32
+ AddTableRow = "atr",
31
33
  Alert = "a",
32
34
  AnimateViewport = "av",
33
35
  AwaitDataSourceImport = "adi",
@@ -50,6 +52,8 @@ export declare const enum CommandName {
50
52
  DeleteItem = "di",
51
53
  DeletePage = "dp",
52
54
  DeleteShapeData = "dsd",
55
+ DeleteTableColumn = "dtc",
56
+ DeleteTableRow = "dtr",
53
57
  Download = "d",
54
58
  DragPointerMove = "dpm",
55
59
  DragPointerUp = "dpu",
@@ -174,6 +178,14 @@ export type CommandArgs = {
174
178
  query: AddSpreadsheetIntegrationQuery;
175
179
  result: AddSpreadsheetIntegrationResult;
176
180
  };
181
+ [CommandName.AddTableColumn]: {
182
+ query: AddTableColumnQuery;
183
+ result: AddTableColumnResult;
184
+ };
185
+ [CommandName.AddTableRow]: {
186
+ query: AddTableRowQuery;
187
+ result: AddTableRowResult;
188
+ };
177
189
  [CommandName.Alert]: {
178
190
  query: AlertQuery;
179
191
  result: AlertResult;
@@ -262,6 +274,14 @@ export type CommandArgs = {
262
274
  query: DeleteShapeDataQuery;
263
275
  result: DeleteShapeDataResult;
264
276
  };
277
+ [CommandName.DeleteTableColumn]: {
278
+ query: DeleteTableColumnQuery;
279
+ result: DeleteTableColumnResult;
280
+ };
281
+ [CommandName.DeleteTableRow]: {
282
+ query: DeleteTableRowQuery;
283
+ result: DeleteTableRowResult;
284
+ };
265
285
  [CommandName.Download]: {
266
286
  query: DownloadQuery;
267
287
  result: DownloadResult;
@@ -747,6 +767,30 @@ export type AddSpreadsheetIntegrationQuery = {
747
767
  };
748
768
  /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
749
769
  export type AddSpreadsheetIntegrationResult = undefined;
770
+ export type AddTableColumnQuery = {
771
+ /** ID of the table to add this column to */
772
+ 'id': string;
773
+ /** Row of the reference cell that the column should be added next to */
774
+ 'r': number;
775
+ /** Column of the reference cell that the column should be added next to */
776
+ 'c': number;
777
+ /** True if the column should be added before the reference cell */
778
+ 'b': boolean;
779
+ };
780
+ /** The index of the newly created column */
781
+ export type AddTableColumnResult = number;
782
+ export type AddTableRowQuery = {
783
+ /** ID of the table to add this row to */
784
+ 'id': string;
785
+ /** Row of the reference cell that the row should be added next to */
786
+ 'r': number;
787
+ /** Column of the reference cell that the row should be added next to */
788
+ 'c': number;
789
+ /** True if the row should be added before the reference cell */
790
+ 'b': boolean;
791
+ };
792
+ /** The index of the newly created row */
793
+ export type AddTableRowResult = number;
750
794
  export type AlertQuery = {
751
795
  /** Title; defaults to extension title */
752
796
  't'?: string | undefined;
@@ -926,6 +970,20 @@ export type DeleteShapeDataQuery = {
926
970
  'n': string;
927
971
  };
928
972
  export type DeleteShapeDataResult = undefined;
973
+ export type DeleteTableColumnQuery = {
974
+ /** ID of the table to delete this column from */
975
+ 'id': string;
976
+ /** Index of the column to delete */
977
+ 'i': number;
978
+ };
979
+ export type DeleteTableColumnResult = void;
980
+ export type DeleteTableRowQuery = {
981
+ /** ID of the table to delete this row from */
982
+ 'id': string;
983
+ /** Index of the row to delete */
984
+ 'i': number;
985
+ };
986
+ export type DeleteTableRowResult = void;
929
987
  export type DownloadQuery = {
930
988
  /** Filename of the download */
931
989
  'f': string;
package/commandtypes.js CHANGED
@@ -9,6 +9,8 @@ exports.commandTitles = new Map([
9
9
  ["ami" /* CommandName.AddMenuItem */, 'AddMenuItem'],
10
10
  ["asd" /* CommandName.AddShapeData */, 'AddShapeData'],
11
11
  ["asi" /* CommandName.AddSpreadsheetIntegration */, 'AddSpreadsheetIntegration'],
12
+ ["atc" /* CommandName.AddTableColumn */, 'AddTableColumn'],
13
+ ["atr" /* CommandName.AddTableRow */, 'AddTableRow'],
12
14
  ["a" /* CommandName.Alert */, 'Alert'],
13
15
  ["av" /* CommandName.AnimateViewport */, 'AnimateViewport'],
14
16
  ["adi" /* CommandName.AwaitDataSourceImport */, 'AwaitDataSourceImport'],
@@ -28,6 +30,8 @@ exports.commandTitles = new Map([
28
30
  ["di" /* CommandName.DeleteItem */, 'DeleteItem'],
29
31
  ["dp" /* CommandName.DeletePage */, 'DeletePage'],
30
32
  ["dsd" /* CommandName.DeleteShapeData */, 'DeleteShapeData'],
33
+ ["dtc" /* CommandName.DeleteTableColumn */, 'DeleteTableColumn'],
34
+ ["dtr" /* CommandName.DeleteTableRow */, 'DeleteTableRow'],
31
35
  ["d" /* CommandName.Download */, 'Download'],
32
36
  ["dpm" /* CommandName.DragPointerMove */, 'DragPointerMove'],
33
37
  ["dpu" /* CommandName.DragPointerUp */, 'DragPointerUp'],
@@ -9,11 +9,23 @@
9
9
  export declare const DEFAULT_IFRAME_WIDTH: number;
10
10
  export declare const DEFAULT_IFRAME_HEIGHT: number;
11
11
  /** @ignore */
12
- export interface IframeAttributes {
12
+ export type IframeAttributes =
13
+ /**
14
+ * This type syntax makes it so either src or srcdoc is always provided, but never both.
15
+ */
16
+ ({
13
17
  /**
14
18
  * The source url
15
19
  */
16
20
  src: string;
21
+ srcdoc?: undefined;
22
+ } | {
23
+ /**
24
+ * The html content of the iframe if not using a source url
25
+ */
26
+ srcdoc: string;
27
+ src?: undefined;
28
+ }) & {
17
29
  /**
18
30
  * The iFrame height
19
31
  */
@@ -26,7 +38,7 @@ export interface IframeAttributes {
26
38
  * The iFrame title for accessibility
27
39
  */
28
40
  title?: string;
29
- }
41
+ };
30
42
  /**
31
43
  * Generate iframe HTML from the IFrameAttributes object
32
44
  * @returns the generated iframe HTML
@@ -54,6 +54,13 @@ exports.generateIFrameHTML = generateIFrameHTML;
54
54
  */
55
55
  function parseIFrameAttributesFromHTML(iframeHTML) {
56
56
  var _a, _b, _c, _d, _e, _f;
57
+ if (!iframeHTML.startsWith('<iframe')) {
58
+ return {
59
+ srcdoc: iframeHTML,
60
+ height: exports.DEFAULT_IFRAME_HEIGHT,
61
+ width: exports.DEFAULT_IFRAME_WIDTH,
62
+ };
63
+ }
57
64
  const src = (_b = (_a = iframeHTML.match(iframeRegExps.src)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
58
65
  const height = (_c = iframeHTML.match(iframeRegExps.height)) === null || _c === void 0 ? void 0 : _c[1];
59
66
  const width = (_d = iframeHTML.match(iframeRegExps.width)) === null || _d === void 0 ? void 0 : _d[1];
@@ -53,8 +53,37 @@ export declare class TableRowProxy {
53
53
  getCells(): TableCellProxy[];
54
54
  getHeight(): number;
55
55
  }
56
+ export declare class TableColumnProxy {
57
+ readonly table: TableBlockProxy;
58
+ readonly col: number;
59
+ constructor(table: TableBlockProxy, col: number);
60
+ getCells(): TableCellProxy[];
61
+ getWidth(): number;
62
+ }
56
63
  export declare class TableBlockProxy extends BlockProxy {
57
64
  static classNameRegex: RegExp;
65
+ /**
66
+ *
67
+ * @param referenceCell The cell to add the new column before or after.
68
+ * @param before If true, the new column will be added before the reference cell, otherwise it will be added after.
69
+ * @returns The TableColumnProxy for the newly added column.
70
+ */
71
+ addColumn(referenceCell: TableCellProxy, before?: boolean): TableColumnProxy;
72
+ /**
73
+ *
74
+ * @param referenceCell The cell to add the new row before or after.
75
+ * @param before If true, the new row will be added before the reference cell, otherwise it will be added after.
76
+ * @returns The TableRowProxy for the newly added row.
77
+ */
78
+ addRow(referenceCell: TableCellProxy, before?: boolean): TableRowProxy;
79
+ /**
80
+ * @param column The index of the column to delete.
81
+ */
82
+ deleteColumn(column: number): void;
83
+ /**
84
+ * @param row The index of the row to delete.
85
+ */
86
+ deleteRow(row: number): void;
58
87
  getRowCount(): number;
59
88
  getColumnCount(): number;
60
89
  getRows(): TableRowProxy[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TableBlockProxy = exports.TableRowProxy = exports.TableCellProxy = void 0;
3
+ exports.TableBlockProxy = exports.TableColumnProxy = exports.TableRowProxy = exports.TableCellProxy = void 0;
4
4
  const fillcolor_1 = require("../../core/properties/fillcolor");
5
5
  const blockproxy_1 = require("../blockproxy");
6
6
  class TableCellProxy {
@@ -95,7 +95,63 @@ class TableRowProxy {
95
95
  }
96
96
  }
97
97
  exports.TableRowProxy = TableRowProxy;
98
+ class TableColumnProxy {
99
+ constructor(table, col) {
100
+ this.table = table;
101
+ this.col = col;
102
+ }
103
+ getCells() {
104
+ return this.table.getRowHeights().map((_, index) => new TableCellProxy(this.table, this.col, index));
105
+ }
106
+ getWidth() {
107
+ var _a;
108
+ return (_a = this.table.getColumnWidths()[this.col]) !== null && _a !== void 0 ? _a : 1;
109
+ }
110
+ }
111
+ exports.TableColumnProxy = TableColumnProxy;
98
112
  class TableBlockProxy extends blockproxy_1.BlockProxy {
113
+ /**
114
+ *
115
+ * @param referenceCell The cell to add the new column before or after.
116
+ * @param before If true, the new column will be added before the reference cell, otherwise it will be added after.
117
+ * @returns The TableColumnProxy for the newly added column.
118
+ */
119
+ addColumn(referenceCell, before = false) {
120
+ const col = this.client.sendCommand("atc" /* CommandName.AddTableColumn */, {
121
+ 'id': this.id,
122
+ 'r': referenceCell.row,
123
+ 'c': referenceCell.column,
124
+ 'b': before,
125
+ });
126
+ return new TableColumnProxy(this, col);
127
+ }
128
+ /**
129
+ *
130
+ * @param referenceCell The cell to add the new row before or after.
131
+ * @param before If true, the new row will be added before the reference cell, otherwise it will be added after.
132
+ * @returns The TableRowProxy for the newly added row.
133
+ */
134
+ addRow(referenceCell, before = false) {
135
+ const row = this.client.sendCommand("atr" /* CommandName.AddTableRow */, {
136
+ 'id': this.id,
137
+ 'r': referenceCell.row,
138
+ 'c': referenceCell.column,
139
+ 'b': before,
140
+ });
141
+ return new TableRowProxy(this, row);
142
+ }
143
+ /**
144
+ * @param column The index of the column to delete.
145
+ */
146
+ deleteColumn(column) {
147
+ return this.client.sendCommand("dtc" /* CommandName.DeleteTableColumn */, { 'id': this.id, 'i': column });
148
+ }
149
+ /**
150
+ * @param row The index of the row to delete.
151
+ */
152
+ deleteRow(row) {
153
+ return this.client.sendCommand("dtr" /* CommandName.DeleteTableRow */, { 'id': this.id, 'i': row });
154
+ }
99
155
  getRowCount() {
100
156
  return this.getRowHeights().length;
101
157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.215",
3
+ "version": "0.0.217",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",