lucid-extension-sdk 0.0.141 → 0.0.143

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.
@@ -5,11 +5,13 @@ const cardblockproxy_1 = require("./cardblockproxy");
5
5
  const customblockproxy_1 = require("./customblockproxy");
6
6
  const erdblockproxy_1 = require("./erdblockproxy");
7
7
  const linkunfurlblockproxy_1 = require("./linkunfurlblockproxy");
8
+ const tableblockproxy_1 = require("./tableblockproxy");
8
9
  const allProxyClasses = [
9
10
  erdblockproxy_1.ERDBlockProxy,
10
11
  customblockproxy_1.CustomBlockProxy,
11
12
  linkunfurlblockproxy_1.LinkUnfurlBlockProxy,
12
13
  cardblockproxy_1.CardBlockProxy,
14
+ tableblockproxy_1.TableBlockProxy,
13
15
  ];
14
16
  function findProxyClass(className) {
15
17
  return allProxyClasses.find((proxy) => proxy.classNameRegex.test(className));
@@ -0,0 +1,67 @@
1
+ import { SimpleFillStyle } from '../../core/properties/fillcolor';
2
+ import { BlockProxy } from '../blockproxy';
3
+ import { TextStyle } from '../text/textstyle';
4
+ export declare class TableCellProxy {
5
+ readonly table: TableBlockProxy;
6
+ readonly row: number;
7
+ readonly column: number;
8
+ constructor(table: TableBlockProxy, row: number, column: number);
9
+ getText(): string;
10
+ setText(text: string): undefined;
11
+ getTextStyle(): TextStyle;
12
+ setTextStyle(style: Partial<TextStyle>): void;
13
+ setFill(fill: SimpleFillStyle): void;
14
+ /**
15
+ * Cells in a table can be merged together with adjacent cells into one larger cell. In this case, the upper-
16
+ * left cell remains visible but is enlarged to cover additional cells, and the other cells are hidden.
17
+ *
18
+ * @returns the size of this cell, in how many cells horizontally and vertically have been merged into it.
19
+ * For most cells, this will be {w:1, h:1}, but if it has been merged with the cell to the right of it, it
20
+ * would be {w:2, h:1}.
21
+ */
22
+ getMergedCellSize(): {
23
+ w: number;
24
+ h: number;
25
+ };
26
+ /**
27
+ /**
28
+ * Cells in a table can be merged together with adjacent cells into one larger cell. In this case, the upper-
29
+ * left cell remains visible but is enlarged to cover additional cells, and the other cells are hidden.
30
+ *
31
+ * @param size the desired size of this cell, in how many cells horizontally and vertically are merged into it.
32
+ * This normally {w:1, h:1} for a normal cell, or {w:2, h:1} to merge a cell with the one to the right of it, etc.
33
+ */
34
+ setMergedCellSize(size: {
35
+ w: number;
36
+ h: number;
37
+ }): void;
38
+ /**
39
+ * @returns the pixel width of the cell, including any cells it is merged with.
40
+ */
41
+ getWidth(): number;
42
+ /**
43
+ * @returns the pixel height of the cell, including any cells it is merged with.
44
+ */
45
+ getHeight(): number;
46
+ }
47
+ export declare class TableRowProxy {
48
+ readonly table: TableBlockProxy;
49
+ readonly row: number;
50
+ constructor(table: TableBlockProxy, row: number);
51
+ getCells(): TableCellProxy[];
52
+ getHeight(): number;
53
+ }
54
+ export declare class TableBlockProxy extends BlockProxy {
55
+ static classNameRegex: RegExp;
56
+ getRowCount(): number;
57
+ getColumnCount(): number;
58
+ getRows(): TableRowProxy[];
59
+ getRowHeights(): number[];
60
+ getColumnWidths(): number[];
61
+ setColumnWidths(widths: number[]): void;
62
+ setRowHeights(heights: number[]): void;
63
+ getAutoResizeColumns(): boolean;
64
+ getAutoResizeRows(): boolean;
65
+ setAutoResizeColumns(auto: boolean): void;
66
+ setAutoResizeRows(auto: boolean): void;
67
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableBlockProxy = exports.TableRowProxy = exports.TableCellProxy = void 0;
4
+ const fillcolor_1 = require("../../core/properties/fillcolor");
5
+ const blockproxy_1 = require("../blockproxy");
6
+ class TableCellProxy {
7
+ constructor(table, row, column) {
8
+ this.table = table;
9
+ this.row = row;
10
+ this.column = column;
11
+ }
12
+ getText() {
13
+ return this.table.textAreas.get(`Cell_${this.row},${this.column}`);
14
+ }
15
+ setText(text) {
16
+ return this.table.textAreas.set(`Cell_${this.row},${this.column}`, text);
17
+ }
18
+ getTextStyle() {
19
+ return this.table.textStyles.get(`Cell_${this.row},${this.column}`);
20
+ }
21
+ setTextStyle(style) {
22
+ this.table.textStyles.set(`Cell_${this.row},${this.column}`, style);
23
+ }
24
+ setFill(fill) {
25
+ this.table.properties.set(`CellFill_${this.row},${this.column}`, (0, fillcolor_1.serializeSimpleFill)(fill));
26
+ }
27
+ /**
28
+ * Cells in a table can be merged together with adjacent cells into one larger cell. In this case, the upper-
29
+ * left cell remains visible but is enlarged to cover additional cells, and the other cells are hidden.
30
+ *
31
+ * @returns the size of this cell, in how many cells horizontally and vertically have been merged into it.
32
+ * For most cells, this will be {w:1, h:1}, but if it has been merged with the cell to the right of it, it
33
+ * would be {w:2, h:1}.
34
+ */
35
+ getMergedCellSize() {
36
+ var _a;
37
+ return ((_a = this.table.properties.get(`CellSize_${this.row},${this.column}`)) !== null && _a !== void 0 ? _a : { w: 1, h: 1 });
38
+ }
39
+ /**
40
+ /**
41
+ * Cells in a table can be merged together with adjacent cells into one larger cell. In this case, the upper-
42
+ * left cell remains visible but is enlarged to cover additional cells, and the other cells are hidden.
43
+ *
44
+ * @param size the desired size of this cell, in how many cells horizontally and vertically are merged into it.
45
+ * This normally {w:1, h:1} for a normal cell, or {w:2, h:1} to merge a cell with the one to the right of it, etc.
46
+ */
47
+ setMergedCellSize(size) {
48
+ this.table.properties.set(`CellSize_${this.row},${this.column}`, size);
49
+ }
50
+ /**
51
+ * @returns the pixel width of the cell, including any cells it is merged with.
52
+ */
53
+ getWidth() {
54
+ return this.table
55
+ .getColumnWidths()
56
+ .slice(this.column, this.column + this.getMergedCellSize().w)
57
+ .reduce((a, b) => a + b, 0);
58
+ }
59
+ /**
60
+ * @returns the pixel height of the cell, including any cells it is merged with.
61
+ */
62
+ getHeight() {
63
+ return this.table
64
+ .getRowHeights()
65
+ .slice(this.row, this.row + this.getMergedCellSize().h)
66
+ .reduce((a, b) => a + b, 0);
67
+ }
68
+ }
69
+ exports.TableCellProxy = TableCellProxy;
70
+ class TableRowProxy {
71
+ constructor(table, row) {
72
+ this.table = table;
73
+ this.row = row;
74
+ }
75
+ getCells() {
76
+ return this.table.getColumnWidths().map((_, index) => new TableCellProxy(this.table, this.row, index));
77
+ }
78
+ getHeight() {
79
+ var _a;
80
+ return (_a = this.table.getRowHeights()[this.row]) !== null && _a !== void 0 ? _a : 1;
81
+ }
82
+ }
83
+ exports.TableRowProxy = TableRowProxy;
84
+ class TableBlockProxy extends blockproxy_1.BlockProxy {
85
+ getRowCount() {
86
+ return this.getRowHeights().length;
87
+ }
88
+ getColumnCount() {
89
+ return this.getColumnWidths().length;
90
+ }
91
+ getRows() {
92
+ return this.getRowHeights().map((_, index) => new TableRowProxy(this, index));
93
+ }
94
+ getRowHeights() {
95
+ return this.properties.get('RowHeights');
96
+ }
97
+ getColumnWidths() {
98
+ return this.properties.get('ColWidths');
99
+ }
100
+ setColumnWidths(widths) {
101
+ this.properties.set('ColWidths', widths);
102
+ }
103
+ setRowHeights(heights) {
104
+ this.properties.set('RowHeights', heights);
105
+ }
106
+ getAutoResizeColumns() {
107
+ return this.properties.get('AutoColWidth');
108
+ }
109
+ getAutoResizeRows() {
110
+ return this.properties.get('AutoRowHeight');
111
+ }
112
+ setAutoResizeColumns(auto) {
113
+ this.properties.set('AutoColWidth', auto);
114
+ }
115
+ setAutoResizeRows(auto) {
116
+ this.properties.set('AutoRowHeight', auto);
117
+ }
118
+ }
119
+ exports.TableBlockProxy = TableBlockProxy;
120
+ TableBlockProxy.classNameRegex = /^DefaultTableBlock$/;
@@ -1,3 +1,4 @@
1
+ import { BadgeEnumPosition } from '../core/properties/datagraphic/badgeposition';
1
2
  import { SimpleStaticDataGraphicSettings } from '../core/properties/datagraphic/staticdatagraphicsettings';
2
3
  import { SimpleFillStyle } from '../core/properties/fillcolor';
3
4
  import { Shadow } from '../core/properties/shadow';
@@ -79,4 +80,9 @@ export declare class BlockProxy extends ItemProxy {
79
80
  * @param field
80
81
  */
81
82
  linkText(textAreaKey: string, referenceKey: string | number, field: string): void;
83
+ /**
84
+ * @param position The postion where the data sync state icon should be displayed on the block. If this position is
85
+ * set to undefined then the state icon position will fallback to the default position for the block.
86
+ */
87
+ setDataSyncStateIconPosition(position: BadgeEnumPosition | undefined): void;
82
88
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BlockProxy = void 0;
4
+ const badgeposition_1 = require("../core/properties/datagraphic/badgeposition");
4
5
  const staticdatagraphicsettings_1 = require("../core/properties/datagraphic/staticdatagraphicsettings");
5
6
  const fillcolor_1 = require("../core/properties/fillcolor");
6
7
  const shadow_1 = require("../core/properties/shadow");
@@ -141,5 +142,12 @@ class BlockProxy extends itemproxy_1.ItemProxy {
141
142
  'f': field,
142
143
  });
143
144
  }
145
+ /**
146
+ * @param position The postion where the data sync state icon should be displayed on the block. If this position is
147
+ * set to undefined then the state icon position will fallback to the default position for the block.
148
+ */
149
+ setDataSyncStateIconPosition(position) {
150
+ this.properties.set('DataSyncStateIconPosition', position ? (0, badgeposition_1.serializeBadgeEnumPosition)(position) : null);
151
+ }
144
152
  }
145
153
  exports.BlockProxy = BlockProxy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.141",
3
+ "version": "0.0.143",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",