@deephaven/grid 0.4.1-modules.0 → 0.5.2-beta.0
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 +88 -40
- package/dist/CellInputField.js.map +1 -1
- package/dist/Grid.js +1484 -1449
- package/dist/Grid.js.map +1 -1
- package/dist/GridColorUtils.js +51 -18
- package/dist/GridColorUtils.js.map +1 -1
- package/dist/GridMetricCalculator.js +994 -1017
- package/dist/GridMetricCalculator.js.map +1 -1
- package/dist/GridModel.js +286 -171
- package/dist/GridModel.js.map +1 -1
- package/dist/GridMouseHandler.js +59 -39
- package/dist/GridMouseHandler.js.map +1 -1
- package/dist/GridRange.js +630 -572
- package/dist/GridRange.js.map +1 -1
- package/dist/GridRenderer.d.ts.map +1 -1
- package/dist/GridRenderer.js +1564 -1650
- package/dist/GridRenderer.js.map +1 -1
- package/dist/GridTestUtils.js +29 -15
- package/dist/GridTestUtils.js.map +1 -1
- package/dist/GridUtils.js +717 -679
- package/dist/GridUtils.js.map +1 -1
- package/dist/KeyHandler.js +18 -6
- package/dist/KeyHandler.js.map +1 -1
- package/dist/MockGridModel.js +210 -105
- package/dist/MockGridModel.js.map +1 -1
- package/dist/MockTreeGridModel.js +183 -113
- package/dist/MockTreeGridModel.js.map +1 -1
- package/dist/errors/PasteError.js +44 -5
- 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 +75 -42
- package/dist/key-handlers/EditKeyHandler.js.map +1 -1
- package/dist/key-handlers/PasteKeyHandler.js +78 -42
- package/dist/key-handlers/PasteKeyHandler.js.map +1 -1
- package/dist/key-handlers/SelectionKeyHandler.js +234 -220
- package/dist/key-handlers/SelectionKeyHandler.js.map +1 -1
- package/dist/key-handlers/TreeKeyHandler.js +72 -42
- 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 +50 -18
- package/dist/mouse-handlers/EditMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.js +163 -141
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js +86 -47
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.js +171 -143
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowMoveMouseHandler.js +147 -125
- package/dist/mouse-handlers/GridRowMoveMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js +86 -47
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowTreeMouseHandler.js +76 -46
- package/dist/mouse-handlers/GridRowTreeMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.js +62 -31
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridSelectionMouseHandler.js +222 -200
- package/dist/mouse-handlers/GridSelectionMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridSeparatorMouseHandler.js +253 -206
- package/dist/mouse-handlers/GridSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.js +172 -144
- 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 +4 -5
package/dist/GridModel.js
CHANGED
|
@@ -1,196 +1,311 @@
|
|
|
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
|
+
|
|
1
3
|
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); } }
|
|
2
4
|
|
|
3
5
|
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); }); }; }
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
/* eslint class-methods-use-this: "off" */
|
|
7
|
-
|
|
8
|
-
/* eslint no-unused-vars: "off" */
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
8
|
|
|
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
|
-
*/
|
|
9
|
+
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); } }
|
|
15
10
|
|
|
16
|
-
|
|
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 */
|
|
11
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
22
12
|
|
|
13
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
return 0;
|
|
26
|
-
}
|
|
27
|
-
/** Count of rows that are frozen at the bottom */
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
16
|
|
|
17
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
29
18
|
|
|
30
|
-
|
|
31
|
-
return 0;
|
|
32
|
-
}
|
|
19
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
21
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
22
|
|
|
38
|
-
|
|
39
|
-
return 0;
|
|
40
|
-
}
|
|
23
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
24
|
|
|
42
|
-
|
|
43
|
-
return 0;
|
|
44
|
-
}
|
|
45
|
-
/*
|
|
46
|
-
* @returns {boolean} True if the edit functionality is available
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
}
|
|
25
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
77
26
|
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
isEditableRange(range) {
|
|
89
|
-
return this.isEditable;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
isColumnMovable(column) {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
isRowMovable(row) {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
get hasExpandableRows() {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
isRowExpandable(row) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
isRowExpanded(row) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
setRowExpanded(row, isExpanded) {}
|
|
113
|
-
|
|
114
|
-
depthForRow(row) {
|
|
115
|
-
return 0;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Get the edit text for a cell as a string
|
|
119
|
-
* @param {number} x The column to get
|
|
120
|
-
* @param {number} y The row to get
|
|
121
|
-
* @returns {string} The value to use for editing
|
|
122
|
-
*/
|
|
27
|
+
import { EventTarget } from 'event-target-shim';
|
|
28
|
+
/* eslint class-methods-use-this: "off" */
|
|
123
29
|
|
|
30
|
+
/* eslint no-unused-vars: "off" */
|
|
124
31
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
* @param {number} x The column to set
|
|
131
|
-
* @param {number} y The row to set
|
|
132
|
-
* @param {string} value The value to set
|
|
133
|
-
* @returns {Promise<void>} A promise that resolves successfully when the operation is complete, or rejects if there's an error
|
|
134
|
-
*/
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
setValueForCell(x, y, value) {
|
|
138
|
-
return _asyncToGenerator(function* () {
|
|
139
|
-
throw new Error('setValueForCell not implemented');
|
|
140
|
-
})();
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Set value in an editable table
|
|
144
|
-
* @param {GridRange[]} ranges The ranges to set
|
|
145
|
-
* @param {string} value The value to set
|
|
146
|
-
* @returns {Promise<void>} A promise that resolves successfully when the operation is complete, or rejects if there's an error
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
setValueForRanges(ranges, value) {
|
|
151
|
-
return _asyncToGenerator(function* () {
|
|
152
|
-
throw new Error('setValueForRanges not implemented');
|
|
153
|
-
})();
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Apply edits to the model
|
|
157
|
-
* @param {{
|
|
158
|
-
* x: number,
|
|
159
|
-
* y: number,
|
|
160
|
-
* text: string,
|
|
161
|
-
* }[]} edits The edits to apply to the model
|
|
162
|
-
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
setValues(edits) {
|
|
166
|
-
return _asyncToGenerator(function* () {
|
|
167
|
-
throw new Error('setValues not implemented');
|
|
168
|
-
})();
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Check if a text value is a valid edit for a cell
|
|
172
|
-
* @param {number} x The column to check
|
|
173
|
-
* @param {number} y The row to check
|
|
174
|
-
* @param {string} value The value to check if it's a valid value or not
|
|
175
|
-
* @returns {boolean} returns true if it's a valid value, false otherwise
|
|
176
|
-
*/
|
|
32
|
+
/**
|
|
33
|
+
* Model for a Grid
|
|
34
|
+
* All of these methods should return very quickly, as they will be called many times in the render cycle.
|
|
35
|
+
* If data needs to be loaded asynchronously, return something immediately, then trigger an event for the table to refresh (Not yet implemented).
|
|
36
|
+
*/
|
|
177
37
|
|
|
38
|
+
var GridModel = /*#__PURE__*/function (_EventTarget) {
|
|
39
|
+
_inherits(GridModel, _EventTarget);
|
|
178
40
|
|
|
179
|
-
|
|
180
|
-
throw new Error('isValidForCell not implemented');
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Delete ranges from an editable table
|
|
184
|
-
* @param {GridRange[]} ranges The ranges to delete
|
|
185
|
-
* @returns {unknown} The result of the delete
|
|
186
|
-
*/
|
|
41
|
+
var _super = _createSuper(GridModel);
|
|
187
42
|
|
|
43
|
+
function GridModel() {
|
|
44
|
+
_classCallCheck(this, GridModel);
|
|
188
45
|
|
|
189
|
-
|
|
190
|
-
throw new Error('delete not implemented');
|
|
46
|
+
return _super.apply(this, arguments);
|
|
191
47
|
}
|
|
192
48
|
|
|
193
|
-
|
|
49
|
+
_createClass(GridModel, [{
|
|
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);
|
|
194
309
|
|
|
195
310
|
export default GridModel;
|
|
196
311
|
//# sourceMappingURL=GridModel.js.map
|
package/dist/GridModel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/GridModel.js"],"names":["EventTarget","GridModel","
|
|
1
|
+
{"version":3,"sources":["../src/GridModel.js"],"names":["EventTarget","GridModel","column","row","theme","textColor","range","isEditable","isExpanded","x","y","Error","value","ranges","edits"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,WAAT,QAA4B,mBAA5B;AAEA;;AACA;;AACA;AACA;AACA;AACA;AACA;;IACMC,S;;;;;;;;;;;;;;AACJ;AACA,mBAAe;AACb,aAAO,CAAP;AACD;AAED;;;;SACA,eAA0B;AACxB,aAAO,CAAP;AACD;AAED;;;;SACA,eAA6B;AAC3B,aAAO,CAAP;AACD;;;SAED,eAAkB;AAChB,aAAO,CAAP;AACD;;;SAED,eAA8B;AAC5B,aAAO,CAAP;AACD;;;SAED,eAA+B;AAC7B,aAAO,CAAP;AACD;AAED;AACF;AACA;;;;SACE,eAAiB;AACf,aAAO,KAAP;AACD;;;WAED,qBAAYC,MAAZ,EAAoBC,GAApB,EAAyB;AACvB,aAAO,EAAP;AACD;;;WAED,0BAAiBD,MAAjB,EAAyBC,GAAzB,EAA8B;AAC5B,aAAO,MAAP;AACD;;;WAED,sBAAaD,MAAb,EAAqBC,GAArB,EAA0BC,KAA1B,EAAiC;AAC/B,aAAOA,KAAK,CAACC,SAAb;AACD;;;WAED,gCAAuBH,MAAvB,EAA+BC,GAA/B,EAAoCC,KAApC,EAA2C;AACzC,aAAO,IAAP;AACD;;;WAED,6BAAoBF,MAApB,EAA4B;AAC1B,aAAO,EAAP;AACD;;;WAED,0BAAiBC,GAAjB,EAAsB;AACpB,aAAO,EAAP;AACD;;;WAED,0BAAiBA,GAAjB,EAAsB;AACpB,aAAO,EAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;;WACE,yBAAgBG,KAAhB,EAAuB;AACrB,aAAO,KAAKC,UAAZ;AACD;;;WAED,yBAAgBL,MAAhB,EAAwB;AACtB,aAAO,IAAP;AACD;;;WAED,sBAAaC,GAAb,EAAkB;AAChB,aAAO,IAAP;AACD;;;SAED,eAAwB;AACtB,aAAO,KAAP;AACD;;;WAED,yBAAgBA,GA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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 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,3 +1,9 @@
|
|
|
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
|
+
|
|
1
7
|
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; }
|
|
2
8
|
|
|
3
9
|
/* eslint class-methods-use-this: "off" */
|
|
@@ -8,55 +14,69 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
8
14
|
* Define a region in the grid that interacts with the mouse on a grid.
|
|
9
15
|
* Return true from any of the events to indicate they're consumed, and stopPropagation/preventDefault will be called.
|
|
10
16
|
*/
|
|
11
|
-
|
|
17
|
+
var GridMouseHandler = /*#__PURE__*/function () {
|
|
12
18
|
// What order this mouse handler should trigger in
|
|
13
19
|
// Default to well below any of the GRID mouse handlers 100-1000+
|
|
14
|
-
|
|
20
|
+
function GridMouseHandler() {
|
|
15
21
|
var order = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 5000;
|
|
16
22
|
|
|
23
|
+
_classCallCheck(this, GridMouseHandler);
|
|
24
|
+
|
|
17
25
|
_defineProperty(this, "cursor", null);
|
|
18
26
|
|
|
19
27
|
this.order = order;
|
|
20
28
|
} // Cursor to use if this returns true from any function
|
|
21
29
|
|
|
22
30
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
31
|
+
_createClass(GridMouseHandler, [{
|
|
32
|
+
key: "onDown",
|
|
33
|
+
value: function onDown(gridPoint, grid, event) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "onMove",
|
|
38
|
+
value: function onMove(gridPoint, grid, event) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
key: "onDrag",
|
|
43
|
+
value: function onDrag(gridPoint, grid, event) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "onLeave",
|
|
48
|
+
value: function onLeave(gridPoint, grid, event) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "onClick",
|
|
53
|
+
value: function onClick(gridPoint, grid, event) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "onContextMenu",
|
|
58
|
+
value: function onContextMenu(gridPoint, grid, event) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
key: "onDoubleClick",
|
|
63
|
+
value: function onDoubleClick(gridPoint, grid, event) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
key: "onUp",
|
|
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
|
+
}();
|
|
60
80
|
|
|
61
81
|
_defineProperty(GridMouseHandler, "FUNCTION_NAMES", Object.freeze({
|
|
62
82
|
DOWN: 'onDown',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/GridMouseHandler.js"],"names":["GridMouseHandler","
|
|
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":";;;;;;;;AAAA;;A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AA,EAAE,EAAE,MARgC;AASpCC,EAAAA,KAAK,EAAE;AAT6B,CAAd,C;;AA0D1B,eAAef,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"}
|