@deephaven/grid 0.5.2-beta.0 → 0.6.1-demo.10
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/CellInputField.js +40 -88
- package/dist/CellInputField.js.map +1 -1
- package/dist/Grid.js +1449 -1484
- package/dist/Grid.js.map +1 -1
- package/dist/GridColorUtils.js +18 -51
- package/dist/GridColorUtils.js.map +1 -1
- package/dist/GridMetricCalculator.d.ts +8 -1
- package/dist/GridMetricCalculator.d.ts.map +1 -1
- package/dist/GridMetricCalculator.js +1031 -994
- package/dist/GridMetricCalculator.js.map +1 -1
- package/dist/GridModel.d.ts +4 -1
- package/dist/GridModel.d.ts.map +1 -1
- package/dist/GridModel.js +175 -286
- package/dist/GridModel.js.map +1 -1
- package/dist/GridMouseHandler.js +39 -59
- package/dist/GridMouseHandler.js.map +1 -1
- package/dist/GridRange.js +572 -630
- package/dist/GridRange.js.map +1 -1
- package/dist/GridRenderer.js +1650 -1564
- package/dist/GridRenderer.js.map +1 -1
- package/dist/GridTestUtils.js +15 -29
- package/dist/GridTestUtils.js.map +1 -1
- package/dist/GridUtils.js +679 -717
- package/dist/GridUtils.js.map +1 -1
- package/dist/KeyHandler.js +6 -18
- package/dist/KeyHandler.js.map +1 -1
- package/dist/MockGridModel.js +105 -210
- package/dist/MockGridModel.js.map +1 -1
- package/dist/MockTreeGridModel.js +113 -183
- package/dist/MockTreeGridModel.js.map +1 -1
- package/dist/errors/PasteError.js +5 -44
- package/dist/errors/PasteError.js.map +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/key-handlers/EditKeyHandler.js +42 -75
- package/dist/key-handlers/EditKeyHandler.js.map +1 -1
- package/dist/key-handlers/PasteKeyHandler.js +42 -78
- package/dist/key-handlers/PasteKeyHandler.js.map +1 -1
- package/dist/key-handlers/SelectionKeyHandler.d.ts.map +1 -1
- package/dist/key-handlers/SelectionKeyHandler.js +239 -229
- package/dist/key-handlers/SelectionKeyHandler.js.map +1 -1
- package/dist/key-handlers/TreeKeyHandler.js +42 -72
- package/dist/key-handlers/TreeKeyHandler.js.map +1 -1
- package/dist/key-handlers/index.js +4 -4
- package/dist/key-handlers/index.js.map +1 -1
- package/dist/memoizeClear.js +1 -1
- package/dist/memoizeClear.js.map +1 -1
- package/dist/mouse-handlers/EditMouseHandler.js +18 -50
- package/dist/mouse-handlers/EditMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.js +141 -163
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js +47 -86
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.js +145 -171
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowMoveMouseHandler.js +125 -147
- package/dist/mouse-handlers/GridRowMoveMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js +47 -86
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowTreeMouseHandler.js +46 -76
- package/dist/mouse-handlers/GridRowTreeMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.js +31 -62
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridSelectionMouseHandler.js +200 -222
- package/dist/mouse-handlers/GridSelectionMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridSeparatorMouseHandler.js +206 -253
- package/dist/mouse-handlers/GridSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.js +146 -172
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/index.js +10 -10
- package/dist/mouse-handlers/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -10
package/dist/GridModel.js
CHANGED
|
@@ -1,311 +1,200 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
-
|
|
3
1
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
2
|
|
|
5
3
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
import { EventTarget } from 'event-target-shim';
|
|
6
|
+
/* eslint class-methods-use-this: "off" */
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
/* eslint no-unused-vars: "off" */
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Model for a Grid
|
|
12
|
+
* All of these methods should return very quickly, as they will be called many times in the render cycle.
|
|
13
|
+
* If data needs to be loaded asynchronously, return something immediately, then trigger an event for the table to refresh (Not yet implemented).
|
|
14
|
+
*/
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
class GridModel extends EventTarget {
|
|
17
|
+
/** Count of rows in the grid */
|
|
18
|
+
get rowCount() {
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
/** Count of rows that are frozen (or 'floating') at the top */
|
|
14
22
|
|
|
15
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
get floatingTopRowCount() {
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
/** Count of rows that are frozen at the bottom */
|
|
18
28
|
|
|
19
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
20
29
|
|
|
21
|
-
|
|
30
|
+
get floatingBottomRowCount() {
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
22
33
|
|
|
23
|
-
|
|
34
|
+
get columnCount() {
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
24
37
|
|
|
25
|
-
|
|
38
|
+
get floatingLeftColumnCount() {
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
|
|
42
|
+
get floatingRightColumnCount() {
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
/*
|
|
46
|
+
* @returns {boolean} True if the edit functionality is available
|
|
47
|
+
*/
|
|
29
48
|
|
|
30
|
-
/* eslint no-unused-vars: "off" */
|
|
31
49
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
get isEditable() {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
textForCell(column, row) {
|
|
55
|
+
return '';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
textAlignForCell(column, row) {
|
|
59
|
+
return 'left';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
colorForCell(column, row, theme) {
|
|
63
|
+
return theme.textColor;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
backgroundColorForCell(column, row, theme) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
textForColumnHeader(column) {
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
textForRowHeader(row) {
|
|
75
|
+
return '';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
textForRowFooter(row) {
|
|
79
|
+
return '';
|
|
80
|
+
}
|
|
81
|
+
/*
|
|
82
|
+
* Check if a given range is editable
|
|
83
|
+
* @param {GridRange} range The range to check if it is editable
|
|
84
|
+
* @returns {boolean} True if the range is editable
|
|
85
|
+
*/
|
|
86
|
+
|
|
37
87
|
|
|
38
|
-
|
|
39
|
-
|
|
88
|
+
isEditableRange(range) {
|
|
89
|
+
return this.isEditable;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @param {number} column The column to check
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
isColumnMovable(column) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
isRowMovable(row) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get hasExpandableRows() {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
40
107
|
|
|
41
|
-
|
|
108
|
+
isRowExpandable(row) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
isRowExpanded(row) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
setRowExpanded(row, isExpanded) {}
|
|
117
|
+
|
|
118
|
+
depthForRow(row) {
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get the edit text for a cell as a string
|
|
123
|
+
* @param {number} x The column to get
|
|
124
|
+
* @param {number} y The row to get
|
|
125
|
+
* @returns {string} The value to use for editing
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
editValueForCell(x, y) {
|
|
130
|
+
throw new Error('editValueForCell not implemented');
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Set value in an editable table
|
|
134
|
+
* @param {number} x The column to set
|
|
135
|
+
* @param {number} y The row to set
|
|
136
|
+
* @param {string} value The value to set
|
|
137
|
+
* @returns {Promise<void>} A promise that resolves successfully when the operation is complete, or rejects if there's an error
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
setValueForCell(x, y, value) {
|
|
142
|
+
return _asyncToGenerator(function* () {
|
|
143
|
+
throw new Error('setValueForCell not implemented');
|
|
144
|
+
})();
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Set value in an editable table
|
|
148
|
+
* @param {GridRange[]} ranges The ranges to set
|
|
149
|
+
* @param {string} value The value to set
|
|
150
|
+
* @returns {Promise<void>} A promise that resolves successfully when the operation is complete, or rejects if there's an error
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
setValueForRanges(ranges, value) {
|
|
155
|
+
return _asyncToGenerator(function* () {
|
|
156
|
+
throw new Error('setValueForRanges not implemented');
|
|
157
|
+
})();
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Apply edits to the model
|
|
161
|
+
* @param {{
|
|
162
|
+
* x: number,
|
|
163
|
+
* y: number,
|
|
164
|
+
* text: string,
|
|
165
|
+
* }[]} edits The edits to apply to the model
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
setValues(edits) {
|
|
170
|
+
return _asyncToGenerator(function* () {
|
|
171
|
+
throw new Error('setValues not implemented');
|
|
172
|
+
})();
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Check if a text value is a valid edit for a cell
|
|
176
|
+
* @param {number} x The column to check
|
|
177
|
+
* @param {number} y The row to check
|
|
178
|
+
* @param {string} value The value to check if it's a valid value or not
|
|
179
|
+
* @returns {boolean} returns true if it's a valid value, false otherwise
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
isValidForCell(x, y, value) {
|
|
184
|
+
throw new Error('isValidForCell not implemented');
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Delete ranges from an editable table
|
|
188
|
+
* @param {GridRange[]} ranges The ranges to delete
|
|
189
|
+
* @returns {unknown} The result of the delete
|
|
190
|
+
*/
|
|
42
191
|
|
|
43
|
-
function GridModel() {
|
|
44
|
-
_classCallCheck(this, GridModel);
|
|
45
192
|
|
|
46
|
-
|
|
193
|
+
delete(ranges) {
|
|
194
|
+
throw new Error('delete not implemented');
|
|
47
195
|
}
|
|
48
196
|
|
|
49
|
-
|
|
50
|
-
key: "rowCount",
|
|
51
|
-
get:
|
|
52
|
-
/** Count of rows in the grid */
|
|
53
|
-
function get() {
|
|
54
|
-
return 0;
|
|
55
|
-
}
|
|
56
|
-
/** Count of rows that are frozen (or 'floating') at the top */
|
|
57
|
-
|
|
58
|
-
}, {
|
|
59
|
-
key: "floatingTopRowCount",
|
|
60
|
-
get: function get() {
|
|
61
|
-
return 0;
|
|
62
|
-
}
|
|
63
|
-
/** Count of rows that are frozen at the bottom */
|
|
64
|
-
|
|
65
|
-
}, {
|
|
66
|
-
key: "floatingBottomRowCount",
|
|
67
|
-
get: function get() {
|
|
68
|
-
return 0;
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
key: "columnCount",
|
|
72
|
-
get: function get() {
|
|
73
|
-
return 0;
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
key: "floatingLeftColumnCount",
|
|
77
|
-
get: function get() {
|
|
78
|
-
return 0;
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
key: "floatingRightColumnCount",
|
|
82
|
-
get: function get() {
|
|
83
|
-
return 0;
|
|
84
|
-
}
|
|
85
|
-
/*
|
|
86
|
-
* @returns {boolean} True if the edit functionality is available
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
}, {
|
|
90
|
-
key: "isEditable",
|
|
91
|
-
get: function get() {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
}, {
|
|
95
|
-
key: "textForCell",
|
|
96
|
-
value: function textForCell(column, row) {
|
|
97
|
-
return '';
|
|
98
|
-
}
|
|
99
|
-
}, {
|
|
100
|
-
key: "textAlignForCell",
|
|
101
|
-
value: function textAlignForCell(column, row) {
|
|
102
|
-
return 'left';
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
key: "colorForCell",
|
|
106
|
-
value: function colorForCell(column, row, theme) {
|
|
107
|
-
return theme.textColor;
|
|
108
|
-
}
|
|
109
|
-
}, {
|
|
110
|
-
key: "backgroundColorForCell",
|
|
111
|
-
value: function backgroundColorForCell(column, row, theme) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
key: "textForColumnHeader",
|
|
116
|
-
value: function textForColumnHeader(column) {
|
|
117
|
-
return '';
|
|
118
|
-
}
|
|
119
|
-
}, {
|
|
120
|
-
key: "textForRowHeader",
|
|
121
|
-
value: function textForRowHeader(row) {
|
|
122
|
-
return '';
|
|
123
|
-
}
|
|
124
|
-
}, {
|
|
125
|
-
key: "textForRowFooter",
|
|
126
|
-
value: function textForRowFooter(row) {
|
|
127
|
-
return '';
|
|
128
|
-
}
|
|
129
|
-
/*
|
|
130
|
-
* Check if a given range is editable
|
|
131
|
-
* @param {GridRange} range The range to check if it is editable
|
|
132
|
-
* @returns {boolean} True if the range is editable
|
|
133
|
-
*/
|
|
134
|
-
|
|
135
|
-
}, {
|
|
136
|
-
key: "isEditableRange",
|
|
137
|
-
value: function isEditableRange(range) {
|
|
138
|
-
return this.isEditable;
|
|
139
|
-
}
|
|
140
|
-
}, {
|
|
141
|
-
key: "isColumnMovable",
|
|
142
|
-
value: function isColumnMovable(column) {
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
145
|
-
}, {
|
|
146
|
-
key: "isRowMovable",
|
|
147
|
-
value: function isRowMovable(row) {
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
}, {
|
|
151
|
-
key: "hasExpandableRows",
|
|
152
|
-
get: function get() {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
}, {
|
|
156
|
-
key: "isRowExpandable",
|
|
157
|
-
value: function isRowExpandable(row) {
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
}, {
|
|
161
|
-
key: "isRowExpanded",
|
|
162
|
-
value: function isRowExpanded(row) {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
}, {
|
|
166
|
-
key: "setRowExpanded",
|
|
167
|
-
value: function setRowExpanded(row, isExpanded) {}
|
|
168
|
-
}, {
|
|
169
|
-
key: "depthForRow",
|
|
170
|
-
value: function depthForRow(row) {
|
|
171
|
-
return 0;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Get the edit text for a cell as a string
|
|
175
|
-
* @param {number} x The column to get
|
|
176
|
-
* @param {number} y The row to get
|
|
177
|
-
* @returns {string} The value to use for editing
|
|
178
|
-
*/
|
|
179
|
-
|
|
180
|
-
}, {
|
|
181
|
-
key: "editValueForCell",
|
|
182
|
-
value: function editValueForCell(x, y) {
|
|
183
|
-
throw new Error('editValueForCell not implemented');
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Set value in an editable table
|
|
187
|
-
* @param {number} x The column to set
|
|
188
|
-
* @param {number} y The row to set
|
|
189
|
-
* @param {string} value The value to set
|
|
190
|
-
* @returns {Promise<void>} A promise that resolves successfully when the operation is complete, or rejects if there's an error
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
}, {
|
|
194
|
-
key: "setValueForCell",
|
|
195
|
-
value: function () {
|
|
196
|
-
var _setValueForCell = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(x, y, value) {
|
|
197
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
198
|
-
while (1) {
|
|
199
|
-
switch (_context.prev = _context.next) {
|
|
200
|
-
case 0:
|
|
201
|
-
throw new Error('setValueForCell not implemented');
|
|
202
|
-
|
|
203
|
-
case 1:
|
|
204
|
-
case "end":
|
|
205
|
-
return _context.stop();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}, _callee);
|
|
209
|
-
}));
|
|
210
|
-
|
|
211
|
-
function setValueForCell(_x, _x2, _x3) {
|
|
212
|
-
return _setValueForCell.apply(this, arguments);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return setValueForCell;
|
|
216
|
-
}()
|
|
217
|
-
/**
|
|
218
|
-
* Set value in an editable table
|
|
219
|
-
* @param {GridRange[]} ranges The ranges to set
|
|
220
|
-
* @param {string} value The value to set
|
|
221
|
-
* @returns {Promise<void>} A promise that resolves successfully when the operation is complete, or rejects if there's an error
|
|
222
|
-
*/
|
|
223
|
-
|
|
224
|
-
}, {
|
|
225
|
-
key: "setValueForRanges",
|
|
226
|
-
value: function () {
|
|
227
|
-
var _setValueForRanges = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ranges, value) {
|
|
228
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
229
|
-
while (1) {
|
|
230
|
-
switch (_context2.prev = _context2.next) {
|
|
231
|
-
case 0:
|
|
232
|
-
throw new Error('setValueForRanges not implemented');
|
|
233
|
-
|
|
234
|
-
case 1:
|
|
235
|
-
case "end":
|
|
236
|
-
return _context2.stop();
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}, _callee2);
|
|
240
|
-
}));
|
|
241
|
-
|
|
242
|
-
function setValueForRanges(_x4, _x5) {
|
|
243
|
-
return _setValueForRanges.apply(this, arguments);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return setValueForRanges;
|
|
247
|
-
}()
|
|
248
|
-
/**
|
|
249
|
-
* Apply edits to the model
|
|
250
|
-
* @param {{
|
|
251
|
-
* x: number,
|
|
252
|
-
* y: number,
|
|
253
|
-
* text: string,
|
|
254
|
-
* }[]} edits The edits to apply to the model
|
|
255
|
-
*/
|
|
256
|
-
|
|
257
|
-
}, {
|
|
258
|
-
key: "setValues",
|
|
259
|
-
value: function () {
|
|
260
|
-
var _setValues = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(edits) {
|
|
261
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
262
|
-
while (1) {
|
|
263
|
-
switch (_context3.prev = _context3.next) {
|
|
264
|
-
case 0:
|
|
265
|
-
throw new Error('setValues not implemented');
|
|
266
|
-
|
|
267
|
-
case 1:
|
|
268
|
-
case "end":
|
|
269
|
-
return _context3.stop();
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}, _callee3);
|
|
273
|
-
}));
|
|
274
|
-
|
|
275
|
-
function setValues(_x6) {
|
|
276
|
-
return _setValues.apply(this, arguments);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
return setValues;
|
|
280
|
-
}()
|
|
281
|
-
/**
|
|
282
|
-
* Check if a text value is a valid edit for a cell
|
|
283
|
-
* @param {number} x The column to check
|
|
284
|
-
* @param {number} y The row to check
|
|
285
|
-
* @param {string} value The value to check if it's a valid value or not
|
|
286
|
-
* @returns {boolean} returns true if it's a valid value, false otherwise
|
|
287
|
-
*/
|
|
288
|
-
|
|
289
|
-
}, {
|
|
290
|
-
key: "isValidForCell",
|
|
291
|
-
value: function isValidForCell(x, y, value) {
|
|
292
|
-
throw new Error('isValidForCell not implemented');
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Delete ranges from an editable table
|
|
296
|
-
* @param {GridRange[]} ranges The ranges to delete
|
|
297
|
-
* @returns {unknown} The result of the delete
|
|
298
|
-
*/
|
|
299
|
-
|
|
300
|
-
}, {
|
|
301
|
-
key: "delete",
|
|
302
|
-
value: function _delete(ranges) {
|
|
303
|
-
throw new Error('delete not implemented');
|
|
304
|
-
}
|
|
305
|
-
}]);
|
|
306
|
-
|
|
307
|
-
return GridModel;
|
|
308
|
-
}(EventTarget);
|
|
197
|
+
}
|
|
309
198
|
|
|
310
199
|
export default GridModel;
|
|
311
200
|
//# sourceMappingURL=GridModel.js.map
|
package/dist/GridModel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/GridModel.js"],"names":["EventTarget","GridModel","column","row","theme","textColor","range","
|
|
1
|
+
{"version":3,"sources":["../src/GridModel.js"],"names":["EventTarget","GridModel","rowCount","floatingTopRowCount","floatingBottomRowCount","columnCount","floatingLeftColumnCount","floatingRightColumnCount","isEditable","textForCell","column","row","textAlignForCell","colorForCell","theme","textColor","backgroundColorForCell","textForColumnHeader","textForRowHeader","textForRowFooter","isEditableRange","range","isColumnMovable","isRowMovable","hasExpandableRows","isRowExpandable","isRowExpanded","setRowExpanded","isExpanded","depthForRow","editValueForCell","x","y","Error","setValueForCell","value","setValueForRanges","ranges","setValues","edits","isValidForCell","delete"],"mappings":"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","sourcesContent":["import { EventTarget } from 'event-target-shim';\n\n/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\n/**\n * Model for a Grid\n * All of these methods should return very quickly, as they will be called many times in the render cycle.\n * If data needs to be loaded asynchronously, return something immediately, then trigger an event for the table to refresh (Not yet implemented).\n */\nclass GridModel extends EventTarget {\n /** Count of rows in the grid */\n get rowCount() {\n return 0;\n }\n\n /** Count of rows that are frozen (or 'floating') at the top */\n get floatingTopRowCount() {\n return 0;\n }\n\n /** Count of rows that are frozen at the bottom */\n get floatingBottomRowCount() {\n return 0;\n }\n\n get columnCount() {\n return 0;\n }\n\n get floatingLeftColumnCount() {\n return 0;\n }\n\n get floatingRightColumnCount() {\n return 0;\n }\n\n /*\n * @returns {boolean} True if the edit functionality is available\n */\n get isEditable() {\n return false;\n }\n\n textForCell(column, row) {\n return '';\n }\n\n textAlignForCell(column, row) {\n return 'left';\n }\n\n colorForCell(column, row, theme) {\n return theme.textColor;\n }\n\n backgroundColorForCell(column, row, theme) {\n return null;\n }\n\n textForColumnHeader(column) {\n return '';\n }\n\n textForRowHeader(row) {\n return '';\n }\n\n textForRowFooter(row) {\n return '';\n }\n\n /*\n * Check if a given range is editable\n * @param {GridRange} range The range to check if it is editable\n * @returns {boolean} True if the range is editable\n */\n isEditableRange(range) {\n return this.isEditable;\n }\n\n /**\n * @param {number} column The column to check\n */\n isColumnMovable(column) {\n return true;\n }\n\n isRowMovable(row) {\n return true;\n }\n\n get hasExpandableRows() {\n return false;\n }\n\n isRowExpandable(row) {\n return false;\n }\n\n isRowExpanded(row) {\n return false;\n }\n\n setRowExpanded(row, isExpanded) {}\n\n depthForRow(row) {\n return 0;\n }\n\n /**\n * Get the edit text for a cell as a string\n * @param {number} x The column to get\n * @param {number} y The row to get\n * @returns {string} The value to use for editing\n */\n editValueForCell(x, y) {\n throw new Error('editValueForCell not implemented');\n }\n\n /**\n * Set value in an editable table\n * @param {number} x The column to set\n * @param {number} y The row to set\n * @param {string} value The value to set\n * @returns {Promise<void>} A promise that resolves successfully when the operation is complete, or rejects if there's an error\n */\n async setValueForCell(x, y, value) {\n throw new Error('setValueForCell not implemented');\n }\n\n /**\n * Set value in an editable table\n * @param {GridRange[]} ranges The ranges to set\n * @param {string} value The value to set\n * @returns {Promise<void>} A promise that resolves successfully when the operation is complete, or rejects if there's an error\n */\n async setValueForRanges(ranges, value) {\n throw new Error('setValueForRanges not implemented');\n }\n\n /**\n * Apply edits to the model\n * @param {{\n * x: number,\n * y: number,\n * text: string,\n * }[]} edits The edits to apply to the model\n */\n async setValues(edits) {\n throw new Error('setValues not implemented');\n }\n\n /**\n * Check if a text value is a valid edit for a cell\n * @param {number} x The column to check\n * @param {number} y The row to check\n * @param {string} value The value to check if it's a valid value or not\n * @returns {boolean} returns true if it's a valid value, false otherwise\n */\n isValidForCell(x, y, value) {\n throw new Error('isValidForCell not implemented');\n }\n\n /**\n * Delete ranges from an editable table\n * @param {GridRange[]} ranges The ranges to delete\n * @returns {unknown} The result of the delete\n */\n delete(ranges) {\n throw new Error('delete not implemented');\n }\n}\n\nexport default GridModel;\n"],"file":"GridModel.js"}
|
package/dist/GridMouseHandler.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
-
|
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4
|
-
|
|
5
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
6
|
-
|
|
7
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
2
|
|
|
9
3
|
/* eslint class-methods-use-this: "off" */
|
|
@@ -14,69 +8,55 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
14
8
|
* Define a region in the grid that interacts with the mouse on a grid.
|
|
15
9
|
* Return true from any of the events to indicate they're consumed, and stopPropagation/preventDefault will be called.
|
|
16
10
|
*/
|
|
17
|
-
|
|
11
|
+
class GridMouseHandler {
|
|
18
12
|
// What order this mouse handler should trigger in
|
|
19
13
|
// Default to well below any of the GRID mouse handlers 100-1000+
|
|
20
|
-
|
|
14
|
+
constructor() {
|
|
21
15
|
var order = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 5000;
|
|
22
16
|
|
|
23
|
-
_classCallCheck(this, GridMouseHandler);
|
|
24
|
-
|
|
25
17
|
_defineProperty(this, "cursor", null);
|
|
26
18
|
|
|
27
19
|
this.order = order;
|
|
28
20
|
} // Cursor to use if this returns true from any function
|
|
29
21
|
|
|
30
22
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
value: function onUp(gridPoint, grid, event) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
}, {
|
|
72
|
-
key: "onWheel",
|
|
73
|
-
value: function onWheel(gridPoint, grid, event) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
}]);
|
|
77
|
-
|
|
78
|
-
return GridMouseHandler;
|
|
79
|
-
}();
|
|
23
|
+
onDown(gridPoint, grid, event) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
onMove(gridPoint, grid, event) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
onDrag(gridPoint, grid, event) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
onLeave(gridPoint, grid, event) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
onClick(gridPoint, grid, event) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onContextMenu(gridPoint, grid, event) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
onDoubleClick(gridPoint, grid, event) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
onUp(gridPoint, grid, event) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
onWheel(gridPoint, grid, event) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
80
60
|
|
|
81
61
|
_defineProperty(GridMouseHandler, "FUNCTION_NAMES", Object.freeze({
|
|
82
62
|
DOWN: 'onDown',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/GridMouseHandler.js"],"names":["GridMouseHandler","order","gridPoint","grid","event","Object","freeze","DOWN","MOVE","DRAG","LEAVE","CLICK","CONTEXT_MENU","DOUBLE_CLICK","UP","WHEEL"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/GridMouseHandler.js"],"names":["GridMouseHandler","constructor","order","onDown","gridPoint","grid","event","onMove","onDrag","onLeave","onClick","onContextMenu","onDoubleClick","onUp","onWheel","Object","freeze","DOWN","MOVE","DRAG","LEAVE","CLICK","CONTEXT_MENU","DOUBLE_CLICK","UP","WHEEL"],"mappings":";;AAAA;;AACA;;AACA;AACA;AACA;AACA;AACA,MAAMA,gBAAN,CAAuB;AAarB;AACA;AACAC,EAAAA,WAAW,GAAe;AAAA,QAAdC,KAAc,uEAAN,IAAM;;AAAA,oCAKjB,IALiB;;AACxB,SAAKA,KAAL,GAAaA,KAAb;AACD,GAjBoB,CAmBrB;;;AAGAC,EAAAA,MAAM,CAACC,SAAD,EAAYC,IAAZ,EAAkBC,KAAlB,EAAyB;AAC7B,WAAO,KAAP;AACD;;AAEDC,EAAAA,MAAM,CAACH,SAAD,EAAYC,IAAZ,EAAkBC,KAAlB,EAAyB;AAC7B,WAAO,KAAP;AACD;;AAEDE,EAAAA,MAAM,CAACJ,SAAD,EAAYC,IAAZ,EAAkBC,KAAlB,EAAyB;AAC7B,WAAO,KAAP;AACD;;AAEDG,EAAAA,OAAO,CAACL,SAAD,EAAYC,IAAZ,EAAkBC,KAAlB,EAAyB;AAC9B,WAAO,KAAP;AACD;;AAEDI,EAAAA,OAAO,CAACN,SAAD,EAAYC,IAAZ,EAAkBC,KAAlB,EAAyB;AAC9B,WAAO,KAAP;AACD;;AAEDK,EAAAA,aAAa,CAACP,SAAD,EAAYC,IAAZ,EAAkBC,KAAlB,EAAyB;AACpC,WAAO,KAAP;AACD;;AAEDM,EAAAA,aAAa,CAACR,SAAD,EAAYC,IAAZ,EAAkBC,KAAlB,EAAyB;AACpC,WAAO,KAAP;AACD;;AAEDO,EAAAA,IAAI,CAACT,SAAD,EAAYC,IAAZ,EAAkBC,KAAlB,EAAyB;AAC3B,WAAO,KAAP;AACD;;AAEDQ,EAAAA,OAAO,CAACV,SAAD,EAAYC,IAAZ,EAAkBC,KAAlB,EAAyB;AAC9B,WAAO,KAAP;AACD;;AAxDoB;;gBAAjBN,gB,oBACoBe,MAAM,CAACC,MAAP,CAAc;AACpCC,EAAAA,IAAI,EAAE,QAD8B;AAEpCC,EAAAA,IAAI,EAAE,QAF8B;AAGpCC,EAAAA,IAAI,EAAE,QAH8B;AAIpCC,EAAAA,KAAK,EAAE,SAJ6B;AAKpCC,EAAAA,KAAK,EAAE,SAL6B;AAMpCC,EAAAA,YAAY,EAAE,eANsB;AAOpCC,EAAAA,YAAY,EAAE,eAPsB;AAQpCC,EAAAA,EAAE,EAAE,MARgC;AASpCC,EAAAA,KAAK,EAAE;AAT6B,CAAd,C;;AA0D1B,eAAezB,gBAAf","sourcesContent":["/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\n/**\n * Define a region in the grid that interacts with the mouse on a grid.\n * Return true from any of the events to indicate they're consumed, and stopPropagation/preventDefault will be called.\n */\nclass GridMouseHandler {\n static FUNCTION_NAMES = Object.freeze({\n DOWN: 'onDown',\n MOVE: 'onMove',\n DRAG: 'onDrag',\n LEAVE: 'onLeave',\n CLICK: 'onClick',\n CONTEXT_MENU: 'onContextMenu',\n DOUBLE_CLICK: 'onDoubleClick',\n UP: 'onUp',\n WHEEL: 'onWheel',\n });\n\n // What order this mouse handler should trigger in\n // Default to well below any of the GRID mouse handlers 100-1000+\n constructor(order = 5000) {\n this.order = order;\n }\n\n // Cursor to use if this returns true from any function\n cursor = null;\n\n onDown(gridPoint, grid, event) {\n return false;\n }\n\n onMove(gridPoint, grid, event) {\n return false;\n }\n\n onDrag(gridPoint, grid, event) {\n return false;\n }\n\n onLeave(gridPoint, grid, event) {\n return false;\n }\n\n onClick(gridPoint, grid, event) {\n return false;\n }\n\n onContextMenu(gridPoint, grid, event) {\n return false;\n }\n\n onDoubleClick(gridPoint, grid, event) {\n return false;\n }\n\n onUp(gridPoint, grid, event) {\n return false;\n }\n\n onWheel(gridPoint, grid, event) {\n return false;\n }\n}\n\nexport default GridMouseHandler;\n"],"file":"GridMouseHandler.js"}
|