canvas-datagrid 0.3.17 → 0.3.21
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/CHANGELOG.md +30 -0
- package/dist/canvas-datagrid.debug.js +883 -73
- package/dist/canvas-datagrid.debug.map +1 -1
- package/dist/canvas-datagrid.js +1 -1
- package/dist/canvas-datagrid.module.js +1 -1
- package/dist/canvas-datagrid.module.js.map +1 -1
- package/dist/types.d.ts +19 -0
- package/lib/button.js +326 -0
- package/lib/contextMenu.js +47 -8
- package/lib/defaults.js +27 -0
- package/lib/docs.js +9 -1
- package/lib/dom.js +90 -0
- package/lib/draw.js +98 -6
- package/lib/events/index.js +203 -52
- package/lib/intf.js +51 -0
- package/lib/main.js +2 -0
- package/lib/publicMethods.js +107 -5
- package/package.json +1 -1
|
@@ -11,6 +11,336 @@
|
|
|
11
11
|
return /******/ (function() { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
+
/***/ "./lib/button.js":
|
|
15
|
+
/*!***********************!*\
|
|
16
|
+
!*** ./lib/button.js ***!
|
|
17
|
+
\***********************/
|
|
18
|
+
/*! namespace exports */
|
|
19
|
+
/*! export default [provided] [no usage info] [missing usage info prevents renaming] */
|
|
20
|
+
/*! other exports [not provided] [no usage info] */
|
|
21
|
+
/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
|
|
22
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
23
|
+
|
|
24
|
+
"use strict";
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
/* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
|
|
28
|
+
/* harmony export */ });
|
|
29
|
+
/*jslint browser: true, unparam: true, todo: true*/
|
|
30
|
+
|
|
31
|
+
/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false, Event: false*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
35
|
+
|
|
36
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
37
|
+
|
|
38
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
39
|
+
|
|
40
|
+
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); }
|
|
41
|
+
|
|
42
|
+
/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(self) {
|
|
43
|
+
var zIndexTop;
|
|
44
|
+
|
|
45
|
+
function applyButtonMenuItemStyle(buttonMenuItemContainer) {
|
|
46
|
+
self.createInlineStyle(buttonMenuItemContainer, 'canvas-datagrid-button-menu-item' + (self.mobile ? '-mobile' : ''));
|
|
47
|
+
buttonMenuItemContainer.addEventListener('mouseover', function () {
|
|
48
|
+
self.createInlineStyle(buttonMenuItemContainer, 'canvas-datagrid-button-menu-item:hover');
|
|
49
|
+
});
|
|
50
|
+
buttonMenuItemContainer.addEventListener('mouseout', function () {
|
|
51
|
+
self.createInlineStyle(buttonMenuItemContainer, 'canvas-datagrid-button-menu-item');
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function applyButtonStyle(button) {
|
|
56
|
+
self.createInlineStyle(button, 'canvas-datagrid-button-wrapper');
|
|
57
|
+
button.addEventListener('mouseover', function () {
|
|
58
|
+
if (!self.buttonMenu) {
|
|
59
|
+
self.createInlineStyle(button, 'canvas-datagrid-button-wrapper:hover');
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
button.addEventListener('mouseout', function () {
|
|
63
|
+
if (!self.buttonMenu) {
|
|
64
|
+
self.createInlineStyle(button, 'canvas-datagrid-button-wrapper');
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function createButton(pos, items, imgSrc) {
|
|
70
|
+
var wrapper = document.createElement('div'),
|
|
71
|
+
buttonArrow = document.createElement('div'),
|
|
72
|
+
buttonIcon = document.createElement('div'),
|
|
73
|
+
intf = {};
|
|
74
|
+
|
|
75
|
+
if (!Array.isArray(items)) {
|
|
76
|
+
throw new Error('createButton expects an array.');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function init() {
|
|
80
|
+
var loc = {},
|
|
81
|
+
s = self.scrollOffset(self.canvas);
|
|
82
|
+
|
|
83
|
+
if (zIndexTop === undefined) {
|
|
84
|
+
zIndexTop = self.style.buttonZIndex;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
applyButtonStyle(wrapper);
|
|
88
|
+
self.createInlineStyle(buttonIcon, 'canvas-datagrid-button-icon');
|
|
89
|
+
self.createInlineStyle(buttonArrow, 'canvas-datagrid-button-arrow');
|
|
90
|
+
loc.x = pos.left - s.left;
|
|
91
|
+
loc.y = pos.top - s.top;
|
|
92
|
+
loc.height = 0;
|
|
93
|
+
zIndexTop += 1;
|
|
94
|
+
wrapper.style.position = 'absolute';
|
|
95
|
+
wrapper.style.zIndex = zIndexTop;
|
|
96
|
+
wrapper.style.left = loc.x + 'px';
|
|
97
|
+
wrapper.style.top = loc.y + 'px';
|
|
98
|
+
wrapper.left = pos.left + self.scrollBox.scrollLeft;
|
|
99
|
+
wrapper.top = pos.top + self.scrollBox.scrollTop;
|
|
100
|
+
buttonArrow.innerHTML = self.style.buttonArrowDownHTML;
|
|
101
|
+
|
|
102
|
+
if (imgSrc) {
|
|
103
|
+
var img = document.createElement('img');
|
|
104
|
+
img.setAttribute('src', imgSrc);
|
|
105
|
+
img.style.maxWidth = '100%';
|
|
106
|
+
img.style.height = '100%';
|
|
107
|
+
buttonIcon.appendChild(img);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
wrapper.appendChild(buttonIcon);
|
|
111
|
+
wrapper.appendChild(buttonArrow);
|
|
112
|
+
document.body.appendChild(wrapper);
|
|
113
|
+
wrapper.addEventListener('click', toggleButtonMenu);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
intf.wrapper = wrapper;
|
|
117
|
+
intf.items = items;
|
|
118
|
+
init();
|
|
119
|
+
|
|
120
|
+
intf.dispose = function () {
|
|
121
|
+
if (wrapper.parentNode) {
|
|
122
|
+
wrapper.parentNode.removeChild(wrapper);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return intf;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function toggleButtonMenu() {
|
|
130
|
+
function createDisposeEvent() {
|
|
131
|
+
requestAnimationFrame(function () {
|
|
132
|
+
document.addEventListener('click', self.disposeButtonMenu);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (self.buttonMenu) {
|
|
137
|
+
self.disposeButtonMenu();
|
|
138
|
+
} else {
|
|
139
|
+
var pos = {
|
|
140
|
+
left: self.button.wrapper.left - self.scrollBox.scrollLeft,
|
|
141
|
+
top: self.button.wrapper.top + self.button.wrapper.offsetHeight - self.scrollBox.scrollTop
|
|
142
|
+
};
|
|
143
|
+
self.buttonMenu = createButtonMenu(pos, self.button.items);
|
|
144
|
+
self.createInlineStyle(self.button.wrapper, 'canvas-datagrid-button-wrapper:active');
|
|
145
|
+
createDisposeEvent();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function createButtonMenu(pos, items) {
|
|
150
|
+
var buttonMenu = document.createElement('div'),
|
|
151
|
+
selectedIndex = -1,
|
|
152
|
+
intf = {},
|
|
153
|
+
rect;
|
|
154
|
+
|
|
155
|
+
function createItems() {
|
|
156
|
+
function addItem(item, menuItemContainer) {
|
|
157
|
+
function addContent(content) {
|
|
158
|
+
if (content === null) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (_typeof(content) === 'object') {
|
|
163
|
+
menuItemContainer.appendChild(content);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
applyButtonMenuItemStyle(menuItemContainer);
|
|
168
|
+
menuItemContainer.innerHTML = content;
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
addContent(item.title);
|
|
173
|
+
item.buttonMenuItemContainer = menuItemContainer;
|
|
174
|
+
|
|
175
|
+
if (item.click) {
|
|
176
|
+
menuItemContainer.addEventListener('click', function (ev) {
|
|
177
|
+
item.click.apply(self, [ev]);
|
|
178
|
+
self.disposeButton();
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
var _iterator = _createForOfIteratorHelper(items),
|
|
184
|
+
_step;
|
|
185
|
+
|
|
186
|
+
try {
|
|
187
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
188
|
+
var item = _step.value;
|
|
189
|
+
var buttonMenuItemContainer = document.createElement('div');
|
|
190
|
+
addItem(item, buttonMenuItemContainer);
|
|
191
|
+
buttonMenu.appendChild(buttonMenuItemContainer);
|
|
192
|
+
}
|
|
193
|
+
} catch (err) {
|
|
194
|
+
_iterator.e(err);
|
|
195
|
+
} finally {
|
|
196
|
+
_iterator.f();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function clickIndex(idx) {
|
|
201
|
+
items[idx].buttonMenuItemContainer.dispatchEvent(new Event('click'));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function init() {
|
|
205
|
+
var loc = {},
|
|
206
|
+
s = self.scrollOffset(self.canvas);
|
|
207
|
+
|
|
208
|
+
if (zIndexTop === undefined) {
|
|
209
|
+
zIndexTop = self.style.buttonZIndex;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
createItems();
|
|
213
|
+
self.createInlineStyle(buttonMenu, 'canvas-datagrid-button-menu' + (self.mobile ? '-mobile' : ''));
|
|
214
|
+
loc.x = pos.left - s.left;
|
|
215
|
+
loc.y = pos.top - s.top;
|
|
216
|
+
loc.height = 0;
|
|
217
|
+
zIndexTop += 1;
|
|
218
|
+
buttonMenu.style.position = 'absolute';
|
|
219
|
+
buttonMenu.style.zIndex = zIndexTop;
|
|
220
|
+
buttonMenu.style.left = loc.x + 'px';
|
|
221
|
+
buttonMenu.style.top = loc.y + 'px';
|
|
222
|
+
document.body.appendChild(buttonMenu);
|
|
223
|
+
rect = buttonMenu.getBoundingClientRect();
|
|
224
|
+
|
|
225
|
+
if (rect.bottom > window.innerHeight) {
|
|
226
|
+
loc.y = self.button.wrapper.top - buttonMenu.offsetHeight - self.scrollBox.scrollTop;
|
|
227
|
+
|
|
228
|
+
if (loc.y < 0) {
|
|
229
|
+
loc.y = self.style.buttonMenuWindowMargin;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (buttonMenu.offsetHeight > window.innerHeight - self.style.buttonMenuWindowMargin) {
|
|
233
|
+
buttonMenu.style.height = window.innerHeight - self.style.buttonMenuWindowMargin * 2 + 'px';
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (rect.right > window.innerWidth) {
|
|
238
|
+
loc.x -= rect.right - window.innerWidth + self.style.buttonMenuWindowMargin;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (loc.x < 0) {
|
|
242
|
+
loc.x = self.style.buttonMenuWindowMargin;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (loc.y < 0) {
|
|
246
|
+
loc.y = self.style.buttonMenuWindowMargin;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
buttonMenu.style.left = loc.x + 'px';
|
|
250
|
+
buttonMenu.style.top = loc.y + 'px';
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
intf.buttonMenu = buttonMenu;
|
|
254
|
+
init();
|
|
255
|
+
intf.clickIndex = clickIndex;
|
|
256
|
+
intf.rect = rect;
|
|
257
|
+
intf.items = items;
|
|
258
|
+
|
|
259
|
+
intf.dispose = function () {
|
|
260
|
+
if (buttonMenu.parentNode) {
|
|
261
|
+
buttonMenu.parentNode.removeChild(buttonMenu);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
Object.defineProperty(intf, 'selectedIndex', {
|
|
266
|
+
get: function get() {
|
|
267
|
+
return selectedIndex;
|
|
268
|
+
},
|
|
269
|
+
set: function set(value) {
|
|
270
|
+
if (typeof value !== 'number' || isNaN(value) || !isFinite(value)) {
|
|
271
|
+
throw new Error('Button menu selected index must be a sane number.');
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
selectedIndex = value;
|
|
275
|
+
|
|
276
|
+
if (selectedIndex > items.length - 1) {
|
|
277
|
+
selectedIndex = items.length - 1;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (selectedIndex < 0) {
|
|
281
|
+
selectedIndex = 0;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
items.forEach(function (item, index) {
|
|
285
|
+
if (index === selectedIndex) {
|
|
286
|
+
return self.createInlineStyle(item.buttonMenuItemContainer, 'canvas-datagrid-button-menu-item:hover');
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
self.createInlineStyle(item.buttonMenuItemContainer, 'canvas-datagrid-button-menu-item');
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
return intf;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
self.disposeButtonMenu = function () {
|
|
297
|
+
if (self.buttonMenu) {
|
|
298
|
+
document.removeEventListener('click', self.disposeButtonMenu);
|
|
299
|
+
self.buttonMenu.dispose();
|
|
300
|
+
self.buttonMenu = undefined;
|
|
301
|
+
self.createInlineStyle(self.button.wrapper, 'canvas-datagrid-button-wrapper:hover');
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
self.disposeButton = function (e) {
|
|
306
|
+
if (e && e.keyCode !== 27) return;
|
|
307
|
+
document.removeEventListener('keydown', self.disposeButton);
|
|
308
|
+
zIndexTop = self.style.buttonZIndex;
|
|
309
|
+
self.disposeButtonMenu();
|
|
310
|
+
|
|
311
|
+
if (self.button) {
|
|
312
|
+
self.button.dispose();
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
self.button = undefined;
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
self.moveButtonPos = function () {
|
|
319
|
+
self.button.wrapper.style.left = self.button.wrapper.left - self.scrollBox.scrollLeft + 'px';
|
|
320
|
+
self.button.wrapper.style.top = self.button.wrapper.top - self.scrollBox.scrollTop + 'px';
|
|
321
|
+
self.disposeButtonMenu();
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
self.attachButton = function (pos, items, imgSrc) {
|
|
325
|
+
function createDisposeEvent() {
|
|
326
|
+
requestAnimationFrame(function () {
|
|
327
|
+
document.addEventListener('keydown', self.disposeButton);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (self.button) {
|
|
332
|
+
self.disposeButton();
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
self.button = createButton(pos, items, imgSrc);
|
|
336
|
+
createDisposeEvent();
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/***/ }),
|
|
343
|
+
|
|
14
344
|
/***/ "./lib/component.js":
|
|
15
345
|
/*!**************************!*\
|
|
16
346
|
!*** ./lib/component.js ***!
|
|
@@ -467,6 +797,38 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
467
797
|
}
|
|
468
798
|
}
|
|
469
799
|
|
|
800
|
+
function fade(element) {
|
|
801
|
+
var opacity = 1;
|
|
802
|
+
var timer = setInterval(function () {
|
|
803
|
+
if (opacity <= 0.1) {
|
|
804
|
+
clearInterval(timer);
|
|
805
|
+
element.style.display = 'none';
|
|
806
|
+
|
|
807
|
+
if (element.parentNode) {
|
|
808
|
+
element.parentNode.removeChild(element);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
element.style.opacity = opacity;
|
|
813
|
+
element.style.filter = 'alpha(opacity=' + opacity * 100 + ')';
|
|
814
|
+
opacity -= opacity * 0.1;
|
|
815
|
+
}, self.attributes.animationDurationHideContextMenu * 0.1);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
function unfade(element) {
|
|
819
|
+
var opacity = 0.1;
|
|
820
|
+
element.style.display = 'block';
|
|
821
|
+
var timer = setInterval(function () {
|
|
822
|
+
if (opacity >= 1) {
|
|
823
|
+
clearInterval(timer);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
element.style.opacity = opacity;
|
|
827
|
+
element.style.filter = 'alpha(opacity=' + opacity * 100 + ')';
|
|
828
|
+
opacity += opacity * 0.1;
|
|
829
|
+
}, self.attributes.animationDurationShowContextMenu * 0.1);
|
|
830
|
+
}
|
|
831
|
+
|
|
470
832
|
function startHoverScroll(type) {
|
|
471
833
|
return function t() {
|
|
472
834
|
var a = self.attributes.contextHoverScrollAmount;
|
|
@@ -504,6 +866,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
504
866
|
loc.y = pos.top - s.top;
|
|
505
867
|
loc.height = 0;
|
|
506
868
|
zIndexTop += 1;
|
|
869
|
+
container.style.opacity = 0;
|
|
507
870
|
container.style.position = 'absolute';
|
|
508
871
|
upArrow.style.color = self.style.contextMenuArrowColor;
|
|
509
872
|
downArrow.style.color = self.style.contextMenuArrowColor;
|
|
@@ -540,6 +903,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
540
903
|
container.appendChild(upArrow);
|
|
541
904
|
document.body.appendChild(downArrow);
|
|
542
905
|
document.body.appendChild(container);
|
|
906
|
+
unfade(container);
|
|
543
907
|
rect = container.getBoundingClientRect(); // TODO: fix !(parentContextMenu && parentContextMenu.inputDropdown) state (autocomplete)
|
|
544
908
|
|
|
545
909
|
if (rect.bottom > window.innerHeight) {
|
|
@@ -600,9 +964,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
600
964
|
c.dispose();
|
|
601
965
|
});
|
|
602
966
|
[downArrow, upArrow, container].forEach(function (el) {
|
|
603
|
-
|
|
604
|
-
el.parentNode.removeChild(el);
|
|
605
|
-
}
|
|
967
|
+
fade(el);
|
|
606
968
|
});
|
|
607
969
|
};
|
|
608
970
|
|
|
@@ -923,7 +1285,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
923
1285
|
}
|
|
924
1286
|
};
|
|
925
1287
|
|
|
926
|
-
self.disposeContextMenu = function () {
|
|
1288
|
+
self.disposeContextMenu = function (event) {
|
|
927
1289
|
document.removeEventListener('click', self.disposeContextMenu);
|
|
928
1290
|
zIndexTop = self.style.contextMenuZIndex;
|
|
929
1291
|
self.disposeAutocomplete();
|
|
@@ -933,6 +1295,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
933
1295
|
}
|
|
934
1296
|
|
|
935
1297
|
self.contextMenu = undefined;
|
|
1298
|
+
|
|
1299
|
+
if (event) {
|
|
1300
|
+
self.canvas.focus();
|
|
1301
|
+
self.mousedown(event);
|
|
1302
|
+
self.mouseup(event);
|
|
1303
|
+
}
|
|
936
1304
|
};
|
|
937
1305
|
|
|
938
1306
|
self.contextmenuEvent = function (e, overridePos) {
|
|
@@ -940,10 +1308,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
940
1308
|
return;
|
|
941
1309
|
}
|
|
942
1310
|
|
|
943
|
-
function
|
|
1311
|
+
function createDisposeEvent() {
|
|
944
1312
|
requestAnimationFrame(function () {
|
|
945
1313
|
document.addEventListener('click', self.disposeContextMenu);
|
|
946
|
-
document.removeEventListener('mouseup',
|
|
1314
|
+
document.removeEventListener('mouseup', createDisposeEvent);
|
|
947
1315
|
});
|
|
948
1316
|
}
|
|
949
1317
|
|
|
@@ -960,7 +1328,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
960
1328
|
addDefaultContextMenuItem(ev);
|
|
961
1329
|
}
|
|
962
1330
|
|
|
963
|
-
if (self.dispatchEvent('contextmenu', ev)) {
|
|
1331
|
+
if (e.type !== 'mousedown' && self.dispatchEvent('contextmenu', ev)) {
|
|
964
1332
|
return;
|
|
965
1333
|
}
|
|
966
1334
|
|
|
@@ -983,8 +1351,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
983
1351
|
contextPosition.width = self.width - self.style.mobileContextMenuMargin * 2 + 'px';
|
|
984
1352
|
}
|
|
985
1353
|
|
|
1354
|
+
if (e.type == 'mousedown') {
|
|
1355
|
+
contextPosition.top += self.style.filterButtonMenuOffsetTop;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
986
1358
|
self.contextMenu = createContextMenu(ev, contextPosition, items);
|
|
987
|
-
|
|
1359
|
+
|
|
1360
|
+
if (e.type == 'mousedown') {
|
|
1361
|
+
document.addEventListener('mouseup', createDisposeEvent);
|
|
1362
|
+
} else {
|
|
1363
|
+
createDisposeEvent();
|
|
1364
|
+
}
|
|
1365
|
+
|
|
988
1366
|
e.preventDefault();
|
|
989
1367
|
}
|
|
990
1368
|
};
|
|
@@ -1016,8 +1394,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1016
1394
|
|
|
1017
1395
|
/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(self) {
|
|
1018
1396
|
self.defaults = {
|
|
1019
|
-
attributes: [['allowColumnReordering', true], ['allowColumnResize', true], ['allowColumnResizeFromCell', false], ['allowFreezingRows', false], ['allowFreezingColumns', false], ['allowMovingSelection', true], ['allowRowHeaderResize', true], ['allowRowReordering', false], ['allowRowResize', true], ['allowRowResizeFromCell', false], ['allowSorting', true], ['autoGenerateSchema', false], ['autoResizeColumns', false], ['autoResizeRows', false], ['autoScrollOnMousemove', false], ['autoScrollMargin', 5], ['blanksText', '(Blanks)'], ['borderDragBehavior', 'none'], ['borderResizeZone', 10], ['clearSettingsOptionText', 'Clear saved settings'], ['columnHeaderClickBehavior', 'sort'], ['columnSelectorHiddenText', ' '], ['columnSelectorText', 'Add/Remove columns'], ['columnSelectorVisibleText', "\u2713"], ['contextHoverScrollAmount', 2], ['contextHoverScrollRateMs', 5], ['copyHeadersOnSelectAll', true], ['copyText', 'Copy'], ['debug', false], ['editable', true], ['ellipsisText', '...'], ['filterOptionText', 'Filter %s'], ['filterTextPrefix', '(filtered) '], ['filterFrozenRows', true], ['globalRowResize', false], ['hideColumnText', 'Hide %s'], ['hoverMode', 'cell'], ['keepFocusOnMouseOut', false], ['maxAutoCompleteItems', 200], ['multiLine', false], ['name', ''], ['pageUpDownOverlap', 1], ['pasteText', 'Paste'], ['persistantSelectionMode', false], ['removeFilterOptionText', 'Remove filter on %s'], ['reorderDeadZone', 3], ['resizeScrollZone', 20], ['rowGrabZoneSize', 5], ['saveAppearance', true], ['scrollAnimationPPSThreshold', 0.75], ['scrollPointerLock', false], ['scrollRepeatRate', 75], ['selectionFollowsActiveCell', false], ['selectionHandleBehavior', 'none'], ['selectionMode', 'cell'], ['selectionScrollIncrement', 20], ['selectionScrollZone', 20], ['showClearSettingsOption', true], ['showColumnHeaders', true], ['showColumnSelector', true], ['showCopy', false], ['showFilter', true], ['showNewRow', false], ['showOrderByOption', true], ['showOrderByOptionTextAsc', 'Order by %s ascending'], ['showOrderByOptionTextDesc', 'Order by %s descending'], ['showPaste', false], ['showPerformance', false], ['showRowHeaders', true], ['showRowNumbers', true], ['showRowNumberGaps', true], ['singleSelectionMode', false], ['snapToRow', false], ['sortFrozenRows', true], ['touchContextMenuTimeMs', 800], ['touchDeadZone', 3], ['touchEasingMethod', 'easeOutQuad'], ['touchReleaseAcceleration', 1000], ['touchReleaseAnimationDurationMs', 2000], ['touchScrollZone', 20], ['touchSelectHandleZone', 20], ['touchZoomSensitivity', 0.005], ['touchZoomMin', 0.5], ['touchZoomMax', 1.75], ['maxPixelRatio', 2], ['tree', false], ['treeHorizontalScroll', false]],
|
|
1020
|
-
styles: [['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'], ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'], ['activeCellBorderWidth', 1], ['activeCellColor', 'rgba(0, 0, 0, 1)'], ['activeCellFont', '16px sans-serif'], ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'], ['activeCellHorizontalAlignment', 'left'], ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'], ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['activeCellOverlayBorderWidth', 1], ['activeCellPaddingBottom', 5], ['activeCellPaddingLeft', 5], ['activeCellPaddingRight', 5], ['activeCellPaddingTop', 5], ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'], ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'], ['activeCellVerticalAlignment', 'center'], ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'], ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'], ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'], ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'], ['autocompleteBottomMargin', 60], ['autosizeHeaderCellPadding', 8], ['autosizePadding', 5], ['cellAutoResizePadding', 13], ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'], ['cellBorderColor', 'rgba(195, 199, 202, 1)'], ['cellBorderWidth', 1], ['cellColor', 'rgba(0, 0, 0, 1)'], ['cellFont', '16px sans-serif'], ['cellGridHeight', 250], ['cellHeight', 24], ['cellHeightWithChildGrid', 150], ['cellHorizontalAlignment', 'left'], ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'], ['cellHoverColor', 'rgba(0, 0, 0, 1)'], ['cellPaddingBottom', 5], ['cellPaddingLeft', 5], ['cellPaddingRight', 5], ['cellPaddingTop', 5], ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'], ['cellSelectedColor', 'rgba(0, 0, 0, 1)'], ['cellVerticalAlignment', 'center'], ['cellWidth', 250], ['cellWidthWithChildGrid', 250], ['cellWhiteSpace', 'nowrap'], ['cellLineHeight', 1], ['cellLineSpacing', 3], ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'], ['childContextMenuArrowHTML', '►'], ['childContextMenuMarginLeft', -11], ['childContextMenuMarginTop', -6], ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['columnHeaderCellBorderColor', 'rgba(172, 172, 172, 1)'], ['columnHeaderCellBorderWidth', 1], ['columnHeaderCellCapBackgroundColor', 'rgba(240, 240, 240, 1)'], ['columnHeaderCellCapBorderColor', 'rgba(172, 172, 172, 1)'], ['columnHeaderCellCapBorderWidth', 1], ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'], ['columnHeaderCellFont', '16px sans-serif'], ['columnHeaderCellHeight', 25], ['columnHeaderCellHorizontalAlignment', 'left'], ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'], ['columnHeaderCellPaddingBottom', 5], ['columnHeaderCellPaddingLeft', 5], ['columnHeaderCellPaddingRight', 5], ['columnHeaderCellPaddingTop', 5], ['columnHeaderCellVerticalAlignment', 'center'], ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['columnHeaderOrderByArrowBorderWidth', 1], ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'], ['columnHeaderOrderByArrowHeight', 8], ['columnHeaderOrderByArrowMarginLeft', 0], ['columnHeaderOrderByArrowMarginRight', 5], ['columnHeaderOrderByArrowMarginTop', 6], ['columnHeaderOrderByArrowWidth', 13], ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextFilterButtonBorderRadius', '3px'], ['contextFilterButtonHTML', '▼'], ['contextFilterInputBackground', 'rgba(255,255,255,1)'], ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextFilterInputBorderRadius', '0'], ['contextFilterInputColor', 'rgba(0,0,0,1)'], ['contextFilterInputFontFamily', 'sans-serif'], ['contextFilterInputFontSize', '14px'], ['contextFilterInvalidRegExpBackground', 'rgba(180, 6, 1, 1)'], ['contextFilterInvalidRegExpColor', 'rgba(255, 255, 255, 1)'], ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'], ['contextMenuArrowDownHTML', '▼'], ['contextMenuArrowUpHTML', '▲'], ['contextMenuBackground', 'rgba(240, 240, 240, 1)'], ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextMenuBorderRadius', '3px'], ['contextMenuChildArrowFontSize', '12px'], ['contextMenuColor', 'rgba(43, 48, 43, 1)'], ['contextMenuCursor', 'default'], ['contextMenuFilterButtonFontFamily', 'sans-serif'], ['contextMenuFilterButtonFontSize', '10px'], ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'], ['contextMenuFontFamily', 'sans-serif'], ['contextMenuFontSize', '16px'], ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'], ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'], ['contextMenuItemBorderRadius', '3px'], ['contextMenuItemMargin', '2px'], ['contextMenuLabelDisplay', 'inline-block'], ['contextMenuLabelMargin', '0 3px 0 0'], ['contextMenuLabelMaxWidth', '700px'], ['contextMenuLabelMinWidth', '75px'], ['contextMenuMarginLeft', 3], ['contextMenuMarginTop', -3], ['contextMenuOpacity', '0.98'], ['contextMenuPadding', '2px'], ['contextMenuWindowMargin', 30], ['contextMenuZIndex', 10000], ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'], ['debugBackgroundColor', 'rgba(0, 0, 0, .0)'], ['debugColor', 'rgba(255, 15, 24, 1)'], ['debugEntitiesColor', 'rgba(76, 231, 239, 1.00)'], ['debugFont', '11px sans-serif'], ['debugPerfChartBackground', 'rgba(29, 25, 26, 1.00)'], ['debugPerfChartTextColor', 'rgba(255, 255, 255, 0.8)'], ['debugPerformanceColor', 'rgba(252, 255, 37, 1.00)'], ['debugScrollHeightColor', 'rgba(248, 33, 103, 1.00)'], ['debugScrollWidthColor', 'rgba(66, 255, 27, 1.00)'], ['debugTouchPPSXColor', 'rgba(246, 102, 24, 1.00)'], ['debugTouchPPSYColor', 'rgba(186, 0, 255, 1.00)'], ['display', 'inline-block'], ['editCellBackgroundColor', 'white'], ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'], ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'], ['editCellColor', 'black'], ['editCellFontFamily', 'sans-serif'], ['editCellFontSize', '16px'], ['editCellPaddingLeft', 4], ['editCellZIndex', 10000], ['frozenMarkerHoverColor', 'rgba(236, 243, 255, 1)'], ['frozenMarkerHoverBorderColor', 'rgba(110, 168, 255, 1)'], ['frozenMarkerActiveColor', 'rgba(236, 243, 255, 1)'], ['frozenMarkerActiveBorderColor', 'rgba(110, 168, 255, 1)'], ['frozenMarkerColor', 'rgba(222, 222, 222, 1)'], ['frozenMarkerBorderColor', 'rgba(168, 168, 168, 1)'], ['frozenMarkerBorderWidth', 1], ['frozenMarkerWidth', 2], ['gridBackgroundColor', 'rgba(240, 240, 240, 1)'], ['gridBorderCollapse', 'collapse'], ['gridBorderColor', 'rgba(202, 202, 202, 1)'], ['gridBorderWidth', 1], ['height', 'auto'], ['maxHeight', 'inherit'], ['maxWidth', 'inherit'], ['minColumnWidth', 45], ['minHeight', 'inherit'], ['minRowHeight', 24], ['minWidth', 'inherit'], ['mobileContextMenuMargin', 10], ['mobileEditInputHeight', 30], ['mobileEditFontFamily', 'sans-serif'], ['mobileEditFontSize', '16px'], ['moveOverlayBorderWidth', 1], ['moveOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['moveOverlayBorderSegments', '12, 7'], ['name', 'default'], ['overflowY', 'auto'], ['overflowX', 'auto'], ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'], ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'], ['reorderMarkerBorderWidth', 1.25], ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'], ['reorderMarkerIndexBorderWidth', 2.75], ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'], ['rowHeaderCellBorderWidth', 1], ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellFont', '16px sans-serif'], ['rowHeaderCellHeight', 25], ['rowHeaderCellHorizontalAlignment', 'left'], ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'], ['rowHeaderCellPaddingBottom', 5], ['rowHeaderCellPaddingLeft', 5], ['rowHeaderCellPaddingRight', 5], ['rowHeaderCellPaddingTop', 5], ['rowHeaderCellRowNumberGapHeight', 5], ['rowHeaderCellRowNumberGapColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'], ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellVerticalAlignment', 'center'], ['rowHeaderCellWidth', 57], ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'], ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'], ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'], ['scrollBarBorderWidth', 0.5], ['scrollBarBoxBorderRadius', 4.125], ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'], ['scrollBarBoxMargin', 2], ['scrollBarBoxMinSize', 15], ['scrollBarBoxWidth', 8], ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'], ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'], ['scrollBarWidth', 11], ['selectionHandleBorderColor', 'rgba(255, 255, 255, 1)'], ['selectionHandleBorderWidth', 1.5], ['selectionHandleColor', 'rgba(66, 133, 244, 1)'], ['selectionHandleSize', 8], ['selectionHandleType', 'square'], ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['selectionOverlayBorderWidth', 1], ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['treeArrowBorderWidth', 1], ['treeArrowClickRadius', 5], ['treeArrowColor', 'rgba(155, 155, 155, 1)'], ['treeArrowHeight', 8], ['treeArrowMarginLeft', 0], ['treeArrowMarginRight', 5], ['treeArrowMarginTop', 6], ['treeArrowWidth', 13], ['treeGridHeight', 250], ['width', 'auto']]
|
|
1397
|
+
attributes: [['allowColumnReordering', true], ['allowColumnResize', true], ['allowColumnResizeFromCell', false], ['allowFreezingRows', false], ['allowFreezingColumns', false], ['allowMovingSelection', true], ['allowRowHeaderResize', true], ['allowRowReordering', false], ['allowRowResize', true], ['allowRowResizeFromCell', false], ['allowSorting', true], ['animationDurationShowContextMenu', 50], ['animationDurationHideContextMenu', 50], ['autoGenerateSchema', false], ['autoResizeColumns', false], ['autoResizeRows', false], ['autoScrollOnMousemove', false], ['autoScrollMargin', 5], ['blanksText', '(Blanks)'], ['borderDragBehavior', 'none'], ['borderResizeZone', 10], ['clearSettingsOptionText', 'Clear saved settings'], ['columnHeaderClickBehavior', 'sort'], ['columnSelectorHiddenText', ' '], ['columnSelectorText', 'Add/Remove columns'], ['columnSelectorVisibleText', "\u2713"], ['contextHoverScrollAmount', 2], ['contextHoverScrollRateMs', 5], ['copyHeadersOnSelectAll', true], ['copyText', 'Copy'], ['debug', false], ['editable', true], ['ellipsisText', '...'], ['filterOptionText', 'Filter %s'], ['filterTextPrefix', '(filtered) '], ['filterFrozenRows', true], ['globalRowResize', false], ['hideColumnText', 'Hide %s'], ['hoverMode', 'cell'], ['keepFocusOnMouseOut', false], ['maxAutoCompleteItems', 200], ['multiLine', false], ['name', ''], ['pageUpDownOverlap', 1], ['pasteText', 'Paste'], ['persistantSelectionMode', false], ['removeFilterOptionText', 'Remove filter on %s'], ['reorderDeadZone', 3], ['resizeScrollZone', 20], ['rowGrabZoneSize', 5], ['saveAppearance', true], ['scrollAnimationPPSThreshold', 0.75], ['scrollPointerLock', false], ['scrollRepeatRate', 75], ['selectionFollowsActiveCell', false], ['selectionHandleBehavior', 'none'], ['selectionMode', 'cell'], ['selectionScrollIncrement', 20], ['selectionScrollZone', 20], ['showClearSettingsOption', true], ['showColumnHeaders', true], ['showColumnSelector', true], ['showCopy', false], ['showFilter', true], ['showFilterInCell', false], ['showNewRow', false], ['showOrderByOption', true], ['showOrderByOptionTextAsc', 'Order by %s ascending'], ['showOrderByOptionTextDesc', 'Order by %s descending'], ['showPaste', false], ['showPerformance', false], ['showRowHeaders', true], ['showRowNumbers', true], ['showRowNumberGaps', true], ['singleSelectionMode', false], ['snapToRow', false], ['sortFrozenRows', true], ['touchContextMenuTimeMs', 800], ['touchDeadZone', 3], ['touchEasingMethod', 'easeOutQuad'], ['touchReleaseAcceleration', 1000], ['touchReleaseAnimationDurationMs', 2000], ['touchScrollZone', 20], ['touchSelectHandleZone', 20], ['touchZoomSensitivity', 0.005], ['touchZoomMin', 0.5], ['touchZoomMax', 1.75], ['maxPixelRatio', 2], ['tree', false], ['treeHorizontalScroll', false]],
|
|
1398
|
+
styles: [['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'], ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'], ['activeCellBorderWidth', 1], ['activeCellColor', 'rgba(0, 0, 0, 1)'], ['activeCellFont', '16px sans-serif'], ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'], ['activeCellHorizontalAlignment', 'left'], ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'], ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['activeCellOverlayBorderWidth', 1], ['activeCellPaddingBottom', 5], ['activeCellPaddingLeft', 5], ['activeCellPaddingRight', 5], ['activeCellPaddingTop', 5], ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'], ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'], ['activeCellVerticalAlignment', 'center'], ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'], ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'], ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'], ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'], ['autocompleteBottomMargin', 60], ['autosizeHeaderCellPadding', 8], ['autosizePadding', 5], ['buttonActiveBackgroundColor', 'rgba(255, 255, 255, 1)'], ['buttonActiveBorderColor', 'rgba(110, 168, 255, 1)'], ['buttonArrowColor', 'rgba(50, 50, 50, 1)'], ['buttonArrowDownHTML', '▼'], ['buttonZIndex', 10000], ['buttonBackgroundColor', 'rgba(255, 255, 255, 1)'], ['buttonBorderColor', 'rgba(172, 172, 172, 1)'], ['buttonHoverBackgroundColor', 'rgba(240, 240, 240, 1)'], ['buttonMenuWindowMargin', 30], ['buttonPadding', '3px'], ['cellAutoResizePadding', 13], ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'], ['cellBorderColor', 'rgba(195, 199, 202, 1)'], ['cellBorderWidth', 1], ['cellColor', 'rgba(0, 0, 0, 1)'], ['cellFont', '16px sans-serif'], ['cellGridHeight', 250], ['cellHeight', 24], ['cellHeightWithChildGrid', 150], ['cellHorizontalAlignment', 'left'], ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'], ['cellHoverColor', 'rgba(0, 0, 0, 1)'], ['cellPaddingBottom', 5], ['cellPaddingLeft', 5], ['cellPaddingRight', 5], ['cellPaddingTop', 5], ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'], ['cellSelectedColor', 'rgba(0, 0, 0, 1)'], ['cellVerticalAlignment', 'center'], ['cellWidth', 250], ['cellWidthWithChildGrid', 250], ['cellWhiteSpace', 'nowrap'], ['cellLineHeight', 1], ['cellLineSpacing', 3], ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'], ['childContextMenuArrowHTML', '►'], ['childContextMenuMarginLeft', -11], ['childContextMenuMarginTop', -6], ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['columnHeaderCellBorderColor', 'rgba(172, 172, 172, 1)'], ['columnHeaderCellBorderWidth', 1], ['columnHeaderCellCapBackgroundColor', 'rgba(240, 240, 240, 1)'], ['columnHeaderCellCapBorderColor', 'rgba(172, 172, 172, 1)'], ['columnHeaderCellCapBorderWidth', 1], ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'], ['columnHeaderCellFont', '16px sans-serif'], ['columnHeaderCellHeight', 25], ['columnHeaderCellHorizontalAlignment', 'left'], ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'], ['columnHeaderCellPaddingBottom', 5], ['columnHeaderCellPaddingLeft', 5], ['columnHeaderCellPaddingRight', 5], ['columnHeaderCellPaddingTop', 5], ['columnHeaderCellVerticalAlignment', 'center'], ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['columnHeaderOrderByArrowBorderWidth', 1], ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'], ['columnHeaderOrderByArrowHeight', 8], ['columnHeaderOrderByArrowMarginLeft', 0], ['columnHeaderOrderByArrowMarginRight', 5], ['columnHeaderOrderByArrowMarginTop', 6], ['columnHeaderOrderByArrowWidth', 13], ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextFilterButtonBorderRadius', '3px'], ['contextFilterButtonHTML', '▼'], ['contextFilterInputBackground', 'rgba(255,255,255,1)'], ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextFilterInputBorderRadius', '0'], ['contextFilterInputColor', 'rgba(0,0,0,1)'], ['contextFilterInputFontFamily', 'sans-serif'], ['contextFilterInputFontSize', '14px'], ['contextFilterInvalidRegExpBackground', 'rgba(180, 6, 1, 1)'], ['contextFilterInvalidRegExpColor', 'rgba(255, 255, 255, 1)'], ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'], ['contextMenuArrowDownHTML', '▼'], ['contextMenuArrowUpHTML', '▲'], ['contextMenuBackground', 'rgba(240, 240, 240, 1)'], ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextMenuBorderRadius', '3px'], ['contextMenuChildArrowFontSize', '12px'], ['contextMenuColor', 'rgba(43, 48, 43, 1)'], ['contextMenuCursor', 'default'], ['contextMenuFilterButtonFontFamily', 'sans-serif'], ['contextMenuFilterButtonFontSize', '10px'], ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'], ['contextMenuFontFamily', 'sans-serif'], ['contextMenuFontSize', '16px'], ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'], ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'], ['contextMenuItemBorderRadius', '3px'], ['contextMenuItemMargin', '2px'], ['contextMenuLabelDisplay', 'inline-block'], ['contextMenuLabelMargin', '0 3px 0 0'], ['contextMenuLabelMaxWidth', '700px'], ['contextMenuLabelMinWidth', '75px'], ['contextMenuMarginLeft', 3], ['contextMenuMarginTop', -3], ['contextMenuOpacity', '0.98'], ['contextMenuPadding', '2px'], ['contextMenuWindowMargin', 30], ['contextMenuZIndex', 10000], ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'], ['debugBackgroundColor', 'rgba(0, 0, 0, .0)'], ['debugColor', 'rgba(255, 15, 24, 1)'], ['debugEntitiesColor', 'rgba(76, 231, 239, 1.00)'], ['debugFont', '11px sans-serif'], ['debugPerfChartBackground', 'rgba(29, 25, 26, 1.00)'], ['debugPerfChartTextColor', 'rgba(255, 255, 255, 0.8)'], ['debugPerformanceColor', 'rgba(252, 255, 37, 1.00)'], ['debugScrollHeightColor', 'rgba(248, 33, 103, 1.00)'], ['debugScrollWidthColor', 'rgba(66, 255, 27, 1.00)'], ['debugTouchPPSXColor', 'rgba(246, 102, 24, 1.00)'], ['debugTouchPPSYColor', 'rgba(186, 0, 255, 1.00)'], ['display', 'inline-block'], ['editCellBackgroundColor', 'white'], ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'], ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'], ['editCellColor', 'black'], ['editCellFontFamily', 'sans-serif'], ['editCellFontSize', '16px'], ['editCellPaddingLeft', 4], ['editCellZIndex', 10000], ['filterButtonActiveBackgroundColor', 'rgba(225, 225, 225, 1)'], ['filterButtonArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['filterButtonArrowBorderWidth', 1], ['filterButtonArrowClickRadius', 5], ['filterButtonArrowColor', 'rgba(50, 50, 50, 1)'], ['filterButtonArrowHeight', 5], ['filterButtonArrowWidth', 8], ['filterButtonBackgroundColor', 'rgba(240, 240, 240, 1)'], ['filterButtonBorderColor', 'rgba(172, 172, 172, 1)'], ['filterButtonBorderRadius', 3], ['filterButtonHeight', 20], ['filterButtonHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['filterButtonMenuOffsetTop', 10], ['filterButtonWidth', 20], ['frozenMarkerHoverColor', 'rgba(236, 243, 255, 1)'], ['frozenMarkerHoverBorderColor', 'rgba(110, 168, 255, 1)'], ['frozenMarkerActiveColor', 'rgba(236, 243, 255, 1)'], ['frozenMarkerActiveBorderColor', 'rgba(110, 168, 255, 1)'], ['frozenMarkerColor', 'rgba(222, 222, 222, 1)'], ['frozenMarkerBorderColor', 'rgba(168, 168, 168, 1)'], ['frozenMarkerBorderWidth', 1], ['frozenMarkerWidth', 2], ['gridBackgroundColor', 'rgba(240, 240, 240, 1)'], ['gridBorderCollapse', 'collapse'], ['gridBorderColor', 'rgba(202, 202, 202, 1)'], ['gridBorderWidth', 1], ['height', 'auto'], ['maxHeight', 'inherit'], ['maxWidth', 'inherit'], ['minColumnWidth', 45], ['minHeight', 'inherit'], ['minRowHeight', 24], ['minWidth', 'inherit'], ['mobileContextMenuMargin', 10], ['mobileEditInputHeight', 30], ['mobileEditFontFamily', 'sans-serif'], ['mobileEditFontSize', '16px'], ['moveOverlayBorderWidth', 1], ['moveOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['moveOverlayBorderSegments', '12, 7'], ['name', 'default'], ['overflowY', 'auto'], ['overflowX', 'auto'], ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'], ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'], ['reorderMarkerBorderWidth', 1.25], ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'], ['reorderMarkerIndexBorderWidth', 2.75], ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'], ['rowHeaderCellBorderWidth', 1], ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellFont', '16px sans-serif'], ['rowHeaderCellHeight', 25], ['rowHeaderCellHorizontalAlignment', 'left'], ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'], ['rowHeaderCellPaddingBottom', 5], ['rowHeaderCellPaddingLeft', 5], ['rowHeaderCellPaddingRight', 5], ['rowHeaderCellPaddingTop', 5], ['rowHeaderCellRowNumberGapHeight', 5], ['rowHeaderCellRowNumberGapColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'], ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellVerticalAlignment', 'center'], ['rowHeaderCellWidth', 57], ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'], ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'], ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'], ['scrollBarBorderWidth', 0.5], ['scrollBarBoxBorderRadius', 4.125], ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'], ['scrollBarBoxMargin', 2], ['scrollBarBoxMinSize', 15], ['scrollBarBoxWidth', 8], ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'], ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'], ['scrollBarWidth', 11], ['selectionHandleBorderColor', 'rgba(255, 255, 255, 1)'], ['selectionHandleBorderWidth', 1.5], ['selectionHandleColor', 'rgba(66, 133, 244, 1)'], ['selectionHandleSize', 8], ['selectionHandleType', 'square'], ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['selectionOverlayBorderWidth', 1], ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['treeArrowBorderWidth', 1], ['treeArrowClickRadius', 5], ['treeArrowColor', 'rgba(155, 155, 155, 1)'], ['treeArrowHeight', 8], ['treeArrowMarginLeft', 0], ['treeArrowMarginRight', 5], ['treeArrowMarginTop', 6], ['treeArrowWidth', 13], ['treeGridHeight', 250], ['width', 'auto']]
|
|
1021
1399
|
};
|
|
1022
1400
|
}
|
|
1023
1401
|
|
|
@@ -1494,6 +1872,96 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1494
1872
|
|
|
1495
1873
|
self.createInlineStyle = function (el, className) {
|
|
1496
1874
|
var css = {
|
|
1875
|
+
'canvas-datagrid-button-wrapper': {
|
|
1876
|
+
display: 'inline-block',
|
|
1877
|
+
padding: self.style.buttonPadding,
|
|
1878
|
+
borderWidth: '1px',
|
|
1879
|
+
borderStyle: 'solid',
|
|
1880
|
+
borderColor: self.style.buttonBorderColor,
|
|
1881
|
+
cursor: 'pointer',
|
|
1882
|
+
background: self.style.buttonBackgroundColor,
|
|
1883
|
+
userSelect: 'none'
|
|
1884
|
+
},
|
|
1885
|
+
'canvas-datagrid-button-wrapper:hover': {
|
|
1886
|
+
borderColor: self.style.buttonBorderColor,
|
|
1887
|
+
background: self.style.buttonHoverBackgroundColor
|
|
1888
|
+
},
|
|
1889
|
+
'canvas-datagrid-button-wrapper:active': {
|
|
1890
|
+
borderColor: self.style.buttonActiveBorderColor,
|
|
1891
|
+
background: self.style.buttonActiveBackgroundColor
|
|
1892
|
+
},
|
|
1893
|
+
'canvas-datagrid-button-icon': {
|
|
1894
|
+
width: '18px',
|
|
1895
|
+
height: '18px',
|
|
1896
|
+
display: 'inline-block',
|
|
1897
|
+
verticalAlign: 'middle'
|
|
1898
|
+
},
|
|
1899
|
+
'canvas-datagrid-button-arrow': {
|
|
1900
|
+
display: 'inline-block',
|
|
1901
|
+
color: self.style.buttonArrowColor,
|
|
1902
|
+
fontSize: '9px'
|
|
1903
|
+
},
|
|
1904
|
+
'canvas-datagrid-button-menu-item-mobile': {
|
|
1905
|
+
lineHeight: 'normal',
|
|
1906
|
+
fontWeight: 'normal',
|
|
1907
|
+
fontFamily: self.style.contextMenuFontFamily,
|
|
1908
|
+
fontSize: self.style.contextMenuFontSize,
|
|
1909
|
+
color: 'inherit',
|
|
1910
|
+
background: 'inherit',
|
|
1911
|
+
margin: self.style.contextMenuItemMargin,
|
|
1912
|
+
borderRadius: self.style.contextMenuItemBorderRadius,
|
|
1913
|
+
verticalAlign: 'middle'
|
|
1914
|
+
},
|
|
1915
|
+
'canvas-datagrid-button-menu-item': {
|
|
1916
|
+
lineHeight: 'normal',
|
|
1917
|
+
fontWeight: 'normal',
|
|
1918
|
+
fontFamily: self.style.contextMenuFontFamily,
|
|
1919
|
+
fontSize: self.style.contextMenuFontSize,
|
|
1920
|
+
color: 'inherit',
|
|
1921
|
+
background: 'inherit',
|
|
1922
|
+
margin: self.style.contextMenuItemMargin,
|
|
1923
|
+
borderRadius: self.style.contextMenuItemBorderRadius,
|
|
1924
|
+
verticalAlign: 'middle'
|
|
1925
|
+
},
|
|
1926
|
+
'canvas-datagrid-button-menu-item:hover': {
|
|
1927
|
+
background: self.style.contextMenuHoverBackground,
|
|
1928
|
+
color: self.style.contextMenuHoverColor
|
|
1929
|
+
},
|
|
1930
|
+
'canvas-datagrid-button-menu-label': {
|
|
1931
|
+
margin: self.style.contextMenuLabelMargin,
|
|
1932
|
+
display: self.style.contextMenuLabelDisplay,
|
|
1933
|
+
minWidth: self.style.contextMenuLabelMinWidth,
|
|
1934
|
+
maxWidth: self.style.contextMenuLabelMaxWidth
|
|
1935
|
+
},
|
|
1936
|
+
'canvas-datagrid-button-menu-mobile': {
|
|
1937
|
+
lineHeight: 'normal',
|
|
1938
|
+
fontWeight: 'normal',
|
|
1939
|
+
fontFamily: self.style.contextMenuFontFamily,
|
|
1940
|
+
fontSize: self.style.contextMenuFontSize,
|
|
1941
|
+
background: self.style.contextMenuBackground,
|
|
1942
|
+
color: self.style.contextMenuColor,
|
|
1943
|
+
border: self.style.contextMenuBorder,
|
|
1944
|
+
padding: self.style.contextMenuPadding,
|
|
1945
|
+
borderRadius: self.style.contextMenuBorderRadius,
|
|
1946
|
+
opacity: self.style.contextMenuOpacity,
|
|
1947
|
+
overflow: 'hidden',
|
|
1948
|
+
whiteSpace: 'nowrap'
|
|
1949
|
+
},
|
|
1950
|
+
'canvas-datagrid-button-menu': {
|
|
1951
|
+
lineHeight: 'normal',
|
|
1952
|
+
fontWeight: 'normal',
|
|
1953
|
+
fontFamily: self.style.contextMenuFontFamily,
|
|
1954
|
+
fontSize: self.style.contextMenuFontSize,
|
|
1955
|
+
background: self.style.contextMenuBackground,
|
|
1956
|
+
color: self.style.contextMenuColor,
|
|
1957
|
+
border: self.style.contextMenuBorder,
|
|
1958
|
+
padding: self.style.contextMenuPadding,
|
|
1959
|
+
borderRadius: self.style.contextMenuBorderRadius,
|
|
1960
|
+
opacity: self.style.contextMenuOpacity,
|
|
1961
|
+
overflow: 'hidden',
|
|
1962
|
+
whiteSpace: 'nowrap',
|
|
1963
|
+
cursor: self.style.contextMenuCursor
|
|
1964
|
+
},
|
|
1497
1965
|
'canvas-datagrid-context-menu-filter-input': {
|
|
1498
1966
|
height: '19px',
|
|
1499
1967
|
verticalAlign: 'bottom',
|
|
@@ -1939,6 +2407,27 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
1939
2407
|
return ml + aw + mr;
|
|
1940
2408
|
}
|
|
1941
2409
|
|
|
2410
|
+
function drawFilterButtonArrow(x, y) {
|
|
2411
|
+
var mt = (self.style.filterButtonHeight - self.style.filterButtonArrowHeight) / 2 * self.scale,
|
|
2412
|
+
ml = (self.style.filterButtonWidth - self.style.filterButtonArrowWidth) / 2 * self.scale,
|
|
2413
|
+
aw = self.style.filterButtonArrowWidth * self.scale,
|
|
2414
|
+
ah = self.style.filterButtonArrowHeight * self.scale;
|
|
2415
|
+
x += self.canvasOffsetLeft;
|
|
2416
|
+
y += self.canvasOffsetTop;
|
|
2417
|
+
self.ctx.fillStyle = self.style.filterButtonArrowColor;
|
|
2418
|
+
self.ctx.strokeStyle = self.style.filterButtonArrowBorderColor;
|
|
2419
|
+
self.ctx.beginPath();
|
|
2420
|
+
x = x + ml;
|
|
2421
|
+
y = y + mt;
|
|
2422
|
+
self.ctx.moveTo(x, y);
|
|
2423
|
+
self.ctx.lineTo(x + aw, y);
|
|
2424
|
+
self.ctx.lineTo(x + aw * 0.5, y + ah);
|
|
2425
|
+
self.ctx.moveTo(x, y);
|
|
2426
|
+
self.ctx.stroke();
|
|
2427
|
+
self.ctx.fill();
|
|
2428
|
+
return ml + aw;
|
|
2429
|
+
}
|
|
2430
|
+
|
|
1942
2431
|
function radiusRect(x, y, w, h, radius) {
|
|
1943
2432
|
x += self.canvasOffsetLeft;
|
|
1944
2433
|
y += self.canvasOffsetTop;
|
|
@@ -2386,8 +2875,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2386
2875
|
m = self.style.scrollBarBoxMargin * 2;
|
|
2387
2876
|
self.ctx.strokeStyle = self.style.scrollBarBorderColor;
|
|
2388
2877
|
self.ctx.lineWidth = self.style.scrollBarBorderWidth;
|
|
2389
|
-
|
|
2390
|
-
|
|
2878
|
+
|
|
2879
|
+
if (self.frozenColumn > 0) {
|
|
2880
|
+
en.horizontalBox.x = rowHeaderCellWidth + self.style.scrollBarBoxMargin + self.scrollCache.x[self.frozenColumn - 1] + (en.horizontalBar.width - self.scrollCache.x[self.frozenColumn - 1] - self.scrollBox.scrollBoxWidth) * (self.scrollBox.scrollLeft / self.scrollBox.scrollWidth);
|
|
2881
|
+
} else {
|
|
2882
|
+
en.horizontalBox.x = rowHeaderCellWidth + self.style.scrollBarBoxMargin + (en.horizontalBar.width - self.scrollBox.scrollBoxWidth) * (self.scrollBox.scrollLeft / self.scrollBox.scrollWidth);
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
en.verticalBox.y = columnHeaderCellHeight + self.style.scrollBarBoxMargin + self.scrollCache.y[self.frozenRow] + (en.verticalBar.height - self.scrollBox.scrollBoxHeight - self.scrollCache.y[self.frozenRow]) * (self.scrollBox.scrollTop / self.scrollBox.scrollHeight);
|
|
2391
2886
|
|
|
2392
2887
|
if (self.scrollBox.horizontalBarVisible) {
|
|
2393
2888
|
self.ctx.fillStyle = self.style.scrollBarBackgroundColor;
|
|
@@ -2514,9 +3009,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2514
3009
|
isCorner = /cornerCell/.test(cellStyle),
|
|
2515
3010
|
isRowHeader = 'rowHeaderCell' === cellStyle,
|
|
2516
3011
|
isColumnHeader = 'columnHeaderCell' === cellStyle,
|
|
3012
|
+
isFilterable = self.filterable.rows.includes(rowIndex) && self.filterable.columns.includes(headerIndex),
|
|
2517
3013
|
wrap = self.style.cellWhiteSpace !== 'nowrap',
|
|
2518
3014
|
selected = self.selections[rowOrderIndex] && self.selections[rowOrderIndex].indexOf(columnOrderIndex) !== -1,
|
|
2519
3015
|
hovered = self.hovers.rowIndex === rowOrderIndex && (self.attributes.hoverMode === 'row' || self.hovers.columnIndex === columnOrderIndex),
|
|
3016
|
+
openedFilter = self.selectedFilterButton.rowIndex == rowIndex && self.selectedFilterButton.columnIndex == headerIndex,
|
|
2520
3017
|
active = self.activeCell.rowIndex === rowOrderIndex && self.activeCell.columnIndex === columnOrderIndex,
|
|
2521
3018
|
isColumnHeaderCellCap = cellStyle === 'columnHeaderCellCap',
|
|
2522
3019
|
rawValue = rowData ? rowData[header.name] : undefined,
|
|
@@ -2604,6 +3101,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2604
3101
|
isColumnHeader: isColumnHeader,
|
|
2605
3102
|
isColumnHeaderCellCap: isColumnHeaderCellCap,
|
|
2606
3103
|
isRowHeader: isRowHeader,
|
|
3104
|
+
isFilterable: isFilterable,
|
|
3105
|
+
openedFilter: openedFilter,
|
|
2607
3106
|
rowOpen: rowOpen,
|
|
2608
3107
|
header: header,
|
|
2609
3108
|
columnIndex: columnOrderIndex,
|
|
@@ -2794,12 +3293,17 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2794
3293
|
createBorderOverlayArray(cell, moveBorders, 'move', self.moveOffset);
|
|
2795
3294
|
}
|
|
2796
3295
|
|
|
2797
|
-
self.ctx.restore();
|
|
3296
|
+
self.ctx.restore();
|
|
3297
|
+
|
|
3298
|
+
if (isFilterable) {
|
|
3299
|
+
drawFilterButton(cell);
|
|
3300
|
+
} // Gaps may occur in row numbers between consecutively rendered rows
|
|
2798
3301
|
// when we are filtering. We draw attention to this by drawing a thick
|
|
2799
3302
|
// border overlapping the two consecutive row headers. If sorting, visible
|
|
2800
3303
|
// row numbers stay the same (i.e. they don't correspond to the underlying
|
|
2801
3304
|
// data's row number), so we do not show row gaps in that case.
|
|
2802
3305
|
|
|
3306
|
+
|
|
2803
3307
|
var isSorting = self.orderings.columns && self.orderings.columns.length > 0;
|
|
2804
3308
|
|
|
2805
3309
|
if (isRowHeader && self.attributes.showRowNumbers && self.attributes.showRowNumberGaps && isSorting === false) {
|
|
@@ -2821,6 +3325,33 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2821
3325
|
};
|
|
2822
3326
|
}
|
|
2823
3327
|
|
|
3328
|
+
function drawFilterButton(cell, ev) {
|
|
3329
|
+
var posX = cell.x + cell.width - self.style.filterButtonWidth - 1;
|
|
3330
|
+
var posY = cell.y + cell.height - self.style.filterButtonHeight - 2;
|
|
3331
|
+
|
|
3332
|
+
if (self.dispatchEvent('beforerenderfilterbutton', ev)) {
|
|
3333
|
+
return;
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
self.ctx.save();
|
|
3337
|
+
self.ctx.strokeStyle = self.style.filterButtonBorderColor;
|
|
3338
|
+
self.ctx.fillStyle = self.style.filterButtonBackgroundColor;
|
|
3339
|
+
|
|
3340
|
+
if (cell.openedFilter) {
|
|
3341
|
+
self.ctx.fillStyle = self.style.filterButtonActiveBackgroundColor;
|
|
3342
|
+
} else if (cell.hovered && self.hovers.onFilterButton) {
|
|
3343
|
+
self.ctx.fillStyle = self.style.filterButtonHoverBackgroundColor;
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3346
|
+
radiusRect(posX, posY, self.style.filterButtonWidth, self.style.filterButtonHeight, self.style.filterButtonBorderRadius);
|
|
3347
|
+
self.ctx.stroke();
|
|
3348
|
+
self.ctx.fill();
|
|
3349
|
+
drawFilterButtonArrow(posX, posY);
|
|
3350
|
+
self.ctx.clip();
|
|
3351
|
+
self.dispatchEvent('afterrenderfilterbutton', ev);
|
|
3352
|
+
self.ctx.restore();
|
|
3353
|
+
}
|
|
3354
|
+
|
|
2824
3355
|
function drawRowHeader(rowData, rowIndex, rowOrderIndex) {
|
|
2825
3356
|
if (self.attributes.showRowHeaders) {
|
|
2826
3357
|
x = 0; // When filtering we'd like to display the actual row numbers,
|
|
@@ -3178,6 +3709,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3178
3709
|
self.ctx.strokeStyle = self.style.reorderMarkerBorderColor;
|
|
3179
3710
|
|
|
3180
3711
|
if (self.dragMode === 'row-reorder') {
|
|
3712
|
+
for (var k = 0; k < self.selections.length; k++) {
|
|
3713
|
+
if (!self.selections[k] || k == self.reorderObject.rowIndex) continue;
|
|
3714
|
+
b.height += self.getRowHeight(k);
|
|
3715
|
+
}
|
|
3716
|
+
|
|
3181
3717
|
b.width = w;
|
|
3182
3718
|
b.x = 0;
|
|
3183
3719
|
m.width = w;
|
|
@@ -3192,6 +3728,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3192
3728
|
addBorderLine(m, self.reorderTarget.sortRowIndex > self.reorderObject.sortRowIndex ? 'b' : 't');
|
|
3193
3729
|
}
|
|
3194
3730
|
} else if (self.dragMode === 'column-reorder' && self.reorderObject) {
|
|
3731
|
+
var selectedColumns = self.selections[0];
|
|
3732
|
+
|
|
3733
|
+
for (var k = 1; k < selectedColumns.length; k++) {
|
|
3734
|
+
b.width += self.getColumnWidth(self.orders.columns[selectedColumns[k]]);
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3195
3737
|
b.height = h;
|
|
3196
3738
|
b.y = 0;
|
|
3197
3739
|
m.height = h;
|
|
@@ -3809,14 +4351,20 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3809
4351
|
setScrollBoxSize();
|
|
3810
4352
|
self.scrollBox.scrollWidth = dataWidth - self.scrollBox.width;
|
|
3811
4353
|
self.scrollBox.scrollHeight = dataHeight - self.scrollBox.height;
|
|
3812
|
-
|
|
4354
|
+
|
|
4355
|
+
if (self.frozenColumn > 0) {
|
|
4356
|
+
self.scrollBox.widthBoxRatio = (self.scrollBox.width - self.scrollCache.x[self.frozenColumn - 1]) / dataWidth;
|
|
4357
|
+
} else {
|
|
4358
|
+
self.scrollBox.widthBoxRatio = self.scrollBox.width / dataWidth;
|
|
4359
|
+
}
|
|
4360
|
+
|
|
3813
4361
|
self.scrollBox.scrollBoxWidth = self.scrollBox.width * self.scrollBox.widthBoxRatio - self.style.scrollBarWidth - b - d; // TODO: This heightBoxRatio number is terribly wrong.
|
|
3814
4362
|
// They should be a result of the size of the grid/canvas?
|
|
3815
4363
|
// it being off causes the scroll bar to "slide" under
|
|
3816
4364
|
// the dragged mouse.
|
|
3817
4365
|
// https://github.com/TonyGermaneri/canvas-datagrid/issues/97
|
|
3818
4366
|
|
|
3819
|
-
self.scrollBox.heightBoxRatio = (self.scrollBox.height - columnHeaderCellHeight) / dataHeight;
|
|
4367
|
+
self.scrollBox.heightBoxRatio = (self.scrollBox.height - columnHeaderCellHeight - self.scrollCache.y[self.frozenRow]) / dataHeight;
|
|
3820
4368
|
self.scrollBox.scrollBoxHeight = self.scrollBox.height * self.scrollBox.heightBoxRatio - self.style.scrollBarWidth - b - d;
|
|
3821
4369
|
self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);
|
|
3822
4370
|
self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize); // horizontal
|
|
@@ -3831,11 +4379,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3831
4379
|
nb.height = self.style.scrollBarBoxWidth; // vertical
|
|
3832
4380
|
|
|
3833
4381
|
v.x += self.width - self.style.scrollBarWidth - self.style.scrollBarBorderWidth - d;
|
|
3834
|
-
v.y += columnHeaderCellHeight;
|
|
4382
|
+
v.y += columnHeaderCellHeight + self.scrollCache.y[self.frozenRow];
|
|
3835
4383
|
v.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;
|
|
3836
4384
|
v.height = self.height - columnHeaderCellHeight - self.style.scrollBarWidth - d - m; // vertical box
|
|
3837
4385
|
|
|
3838
4386
|
vb.x = v.x + self.style.scrollBarBoxMargin;
|
|
4387
|
+
vb.y += self.scrollCache.y[self.frozenRow];
|
|
3839
4388
|
vb.width = self.style.scrollBarBoxWidth;
|
|
3840
4389
|
vb.height = self.scrollBox.scrollBoxHeight; // corner
|
|
3841
4390
|
|
|
@@ -3993,8 +4542,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3993
4542
|
self.cursor = 'default';
|
|
3994
4543
|
self.hovers = {
|
|
3995
4544
|
rowIndex: cell.rowIndex,
|
|
3996
|
-
columnIndex: cell.columnIndex
|
|
4545
|
+
columnIndex: cell.columnIndex,
|
|
4546
|
+
onFilterButton: false
|
|
3997
4547
|
};
|
|
4548
|
+
|
|
4549
|
+
if (cell.isFilterable && x > cell.x + cell.width + self.canvasOffsetLeft - self.style.filterButtonWidth && x < cell.x + cell.width + self.canvasOffsetLeft && y > cell.y + cell.height + self.canvasOffsetTop - self.style.filterButtonHeight && y < cell.y + cell.height + self.canvasOffsetTop) {
|
|
4550
|
+
self.hovers.onFilterButton = true;
|
|
4551
|
+
self.draw();
|
|
4552
|
+
}
|
|
3998
4553
|
}
|
|
3999
4554
|
|
|
4000
4555
|
if (self.selecting || self.reorderObject) {
|
|
@@ -4033,37 +4588,75 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4033
4588
|
if ((self.attributes.selectionMode === 'row' || self.dragStartObject.columnIndex === -1) && self.rowBoundaryCrossed) {
|
|
4034
4589
|
self.selectRow(cell.rowIndex, ctrl, null, true);
|
|
4035
4590
|
} else if (self.attributes.selectionMode !== 'row') {
|
|
4036
|
-
if (
|
|
4037
|
-
if (
|
|
4038
|
-
|
|
4591
|
+
if (cell.hovered && self.hovers.onFilterButton) {
|
|
4592
|
+
if (cell.openedFilter) {
|
|
4593
|
+
cell.openedFilter = false;
|
|
4594
|
+
self.selectedFilterButton = {
|
|
4595
|
+
columnIndex: -1,
|
|
4596
|
+
rowIndex: -1
|
|
4597
|
+
};
|
|
4598
|
+
} else {
|
|
4599
|
+
self.selectedFilterButton.rowIndex = cell.rowIndex;
|
|
4600
|
+
self.selectedFilterButton.columnIndex = cell.columnIndex;
|
|
4601
|
+
self.contextmenuEvent(e, {
|
|
4602
|
+
x: cell.x + cell.width - self.style.filterButtonWidth,
|
|
4603
|
+
y: cell.y + cell.height,
|
|
4604
|
+
rect: {
|
|
4605
|
+
left: 0,
|
|
4606
|
+
top: 0
|
|
4607
|
+
}
|
|
4608
|
+
});
|
|
4039
4609
|
}
|
|
4610
|
+
|
|
4611
|
+
self.draw();
|
|
4612
|
+
return;
|
|
4040
4613
|
} else {
|
|
4041
|
-
self.
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
}
|
|
4051
|
-
|
|
4614
|
+
self.selectedFilterButton = {
|
|
4615
|
+
columnIndex: -1,
|
|
4616
|
+
rowIndex: -1
|
|
4617
|
+
};
|
|
4618
|
+
if (self.hovers.onFilterButton) return;
|
|
4619
|
+
|
|
4620
|
+
if (!self.dragAddToSelection && cell.rowIndex !== undefined) {
|
|
4621
|
+
if (self.selections[cell.rowIndex] && self.selections[cell.rowIndex].indexOf(cell.columnIndex) !== -1) {
|
|
4622
|
+
self.selections[cell.rowIndex].splice(self.selections[cell.rowIndex].indexOf(cell.columnIndex), 1);
|
|
4623
|
+
}
|
|
4624
|
+
} else {
|
|
4625
|
+
self.selections[cell.rowIndex] = self.selections[cell.rowIndex] || [];
|
|
4626
|
+
|
|
4627
|
+
if (self.selections[cell.rowIndex].indexOf(cell.columnIndex) === -1) {
|
|
4628
|
+
self.selections[cell.rowIndex].push(cell.columnIndex);
|
|
4629
|
+
var event = {
|
|
4630
|
+
selections: self.selections,
|
|
4631
|
+
selectedData: self.getSelectedData(),
|
|
4632
|
+
selectedCells: self.getSelectedCells(),
|
|
4633
|
+
selectionBounds: self.getSelectionBounds()
|
|
4634
|
+
};
|
|
4635
|
+
self.dispatchEvent('selectionchanged', event);
|
|
4636
|
+
}
|
|
4052
4637
|
}
|
|
4053
4638
|
}
|
|
4054
4639
|
}
|
|
4055
4640
|
}
|
|
4056
4641
|
|
|
4057
4642
|
if ((!self.selectionBounds || dragBounds.top !== self.selectionBounds.top || dragBounds.left !== self.selectionBounds.left || dragBounds.bottom !== self.selectionBounds.bottom || dragBounds.right !== self.selectionBounds.right) && !ctrl) {
|
|
4058
|
-
self.
|
|
4643
|
+
if (!(cell.hovered && self.hovers.onFilterButton)) {
|
|
4644
|
+
self.selections = [];
|
|
4645
|
+
}
|
|
4646
|
+
|
|
4647
|
+
if (dragBounds.top === -1) {
|
|
4648
|
+
dragBounds.top = 0;
|
|
4649
|
+
}
|
|
4650
|
+
|
|
4059
4651
|
sBounds = dragBounds;
|
|
4060
4652
|
|
|
4061
4653
|
if (self.attributes.selectionMode === 'row') {
|
|
4062
4654
|
for (i = sBounds.top; i <= sBounds.bottom; i += 1) {
|
|
4063
4655
|
self.selectRow(i, true, null, true);
|
|
4064
4656
|
}
|
|
4065
|
-
} else
|
|
4657
|
+
} else {
|
|
4066
4658
|
self.selectArea(sBounds, true);
|
|
4659
|
+
if (sBounds.left == -1 && sBounds.top !== sBounds.bottom) self.isMultiRowsSelected = true;
|
|
4067
4660
|
}
|
|
4068
4661
|
}
|
|
4069
4662
|
|
|
@@ -4138,7 +4731,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4138
4731
|
}
|
|
4139
4732
|
|
|
4140
4733
|
if (['rowHeaderCell', 'columnHeaderCell'].indexOf(self.currentCell.style) === -1 && !ctrl) {
|
|
4141
|
-
self.
|
|
4734
|
+
if (!self.hovers.onFilterButton) {
|
|
4735
|
+
self.setActiveCell(i.columnIndex, i.rowIndex);
|
|
4736
|
+
}
|
|
4142
4737
|
}
|
|
4143
4738
|
|
|
4144
4739
|
if (self.currentCell.context === 'cell') {
|
|
@@ -4161,12 +4756,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4161
4756
|
checkSelectionChange();
|
|
4162
4757
|
return;
|
|
4163
4758
|
}
|
|
4164
|
-
|
|
4165
|
-
if (self.attributes.columnHeaderClickBehavior === 'select') {
|
|
4166
|
-
self.selectColumn(i.header.index, ctrl, e.shiftKey);
|
|
4167
|
-
self.draw();
|
|
4168
|
-
return;
|
|
4169
|
-
}
|
|
4170
4759
|
}
|
|
4171
4760
|
|
|
4172
4761
|
self.selections[i.rowIndex] = self.selections[i.rowIndex] || [];
|
|
@@ -4346,6 +4935,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4346
4935
|
return;
|
|
4347
4936
|
}
|
|
4348
4937
|
|
|
4938
|
+
if ((e.ctrlKey || e.metaKey || e.shiftKey) && self.reorderObject) {
|
|
4939
|
+
if (self.dragMode === 'column-reorder' && !self.isMultiColumnsSelected(self.draggingItem.header.index)) {
|
|
4940
|
+
self.selectColumn(self.draggingItem.header.index, false, false);
|
|
4941
|
+
}
|
|
4942
|
+
}
|
|
4943
|
+
|
|
4349
4944
|
if (self.dispatchEvent('reordering', {
|
|
4350
4945
|
NativeEvent: e,
|
|
4351
4946
|
source: self.dragStartObject,
|
|
@@ -4357,6 +4952,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4357
4952
|
|
|
4358
4953
|
if (Math.abs(x) > self.attributes.reorderDeadZone || Math.abs(y) > self.attributes.reorderDeadZone) {
|
|
4359
4954
|
self.reorderObject = self.draggingItem;
|
|
4955
|
+
if (self.isMultiRowsSelected) self.reorderObject = self.getVisibleCellByIndex(-1, self.activeCell.rowIndex);
|
|
4360
4956
|
self.reorderTarget = self.currentCell;
|
|
4361
4957
|
self.reorderObject.dragOffset = {
|
|
4362
4958
|
x: x,
|
|
@@ -4369,7 +4965,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4369
4965
|
self.stopDragReorder = function (e) {
|
|
4370
4966
|
var oIndex,
|
|
4371
4967
|
tIndex,
|
|
4372
|
-
odata,
|
|
4968
|
+
odata = [],
|
|
4373
4969
|
cr = {
|
|
4374
4970
|
'row-reorder': self.orders.rows,
|
|
4375
4971
|
'column-reorder': self.orders.columns
|
|
@@ -4392,14 +4988,45 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4392
4988
|
tIndex = cr[self.dragMode].indexOf(self.reorderTarget[i]);
|
|
4393
4989
|
|
|
4394
4990
|
if (self.dragMode === 'column-reorder') {
|
|
4395
|
-
|
|
4396
|
-
|
|
4991
|
+
var sortColumnIndices = [];
|
|
4992
|
+
var seletedColumnIndices = [];
|
|
4993
|
+
|
|
4994
|
+
if (self.selections[0]) {
|
|
4995
|
+
self.selections[0].forEach(function (value) {
|
|
4996
|
+
sortColumnIndices.push(self.orders.columns[value]);
|
|
4997
|
+
});
|
|
4998
|
+
}
|
|
4999
|
+
|
|
5000
|
+
var deleteCount = sortColumnIndices.length;
|
|
5001
|
+
cr[self.dragMode].splice(oIndex, deleteCount);
|
|
5002
|
+
if (tIndex > oIndex) tIndex = tIndex - (deleteCount - 1);
|
|
5003
|
+
|
|
5004
|
+
for (var i = 0; i < sortColumnIndices.length; i++) {
|
|
5005
|
+
seletedColumnIndices.push(tIndex + i);
|
|
5006
|
+
cr[self.dragMode].splice(tIndex + i, 0, sortColumnIndices[i]);
|
|
5007
|
+
}
|
|
5008
|
+
|
|
4397
5009
|
self.orders.columns = cr[self.dragMode];
|
|
5010
|
+
self.viewData.forEach(function (row, rowIndex) {
|
|
5011
|
+
self.selections[rowIndex] = seletedColumnIndices;
|
|
5012
|
+
});
|
|
4398
5013
|
} else {
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
5014
|
+
var selectedRows = [];
|
|
5015
|
+
self.selections.forEach(function (row, rowIndex) {
|
|
5016
|
+
if (row) {
|
|
5017
|
+
selectedRows.push(row);
|
|
5018
|
+
odata.push(self.viewData[rowIndex]);
|
|
5019
|
+
}
|
|
5020
|
+
});
|
|
5021
|
+
self.viewData.splice(oIndex, odata.length);
|
|
5022
|
+
self.selections = [];
|
|
5023
|
+
if (tIndex > oIndex) tIndex = tIndex - (odata.length - 1);
|
|
5024
|
+
self.activeCell.rowIndex = tIndex;
|
|
5025
|
+
|
|
5026
|
+
for (var i = 0; i < odata.length; i++) {
|
|
5027
|
+
self.viewData.splice(tIndex + i, 0, odata[i]);
|
|
5028
|
+
self.selections[tIndex + i] = selectedRows[i];
|
|
5029
|
+
}
|
|
4403
5030
|
}
|
|
4404
5031
|
|
|
4405
5032
|
self.resize();
|
|
@@ -4465,18 +5092,36 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4465
5092
|
return;
|
|
4466
5093
|
}
|
|
4467
5094
|
|
|
4468
|
-
var pos = self.getLayerPos(e)
|
|
5095
|
+
var pos = self.getLayerPos(e),
|
|
5096
|
+
bm = self.style.gridBorderCollapse === 'collapse' ? 1 : 2,
|
|
5097
|
+
columnHeaderCellBorder = self.style.columnHeaderCellBorderWidth * bm,
|
|
5098
|
+
columnHeaderCellHeight = self.getColumnHeaderCellHeight(),
|
|
5099
|
+
rowHeaderCellWidth = self.getRowHeaderCellWidth();
|
|
4469
5100
|
self.ignoreNextClick = true;
|
|
4470
5101
|
self.freezeMarkerPosition = pos;
|
|
4471
5102
|
|
|
4472
5103
|
if (self.currentCell && self.currentCell.rowIndex !== undefined && self.dragMode === 'frozen-row-marker') {
|
|
4473
5104
|
self.scrollBox.scrollTop = 0;
|
|
4474
5105
|
self.frozenRow = self.currentCell.rowIndex + 1;
|
|
5106
|
+
self.scrollBox.bar.v.y = columnHeaderCellHeight + columnHeaderCellBorder + self.scrollCache.y[self.frozenRow];
|
|
5107
|
+
self.scrollBox.box.v.y = columnHeaderCellHeight + columnHeaderCellBorder + self.scrollCache.y[self.frozenRow];
|
|
5108
|
+
var dataHeight = self.scrollCache.y[self.scrollCache.y.length - 1];
|
|
5109
|
+
self.scrollBox.heightBoxRatio = (self.scrollBox.height - columnHeaderCellHeight - self.scrollCache.y[self.frozenRow]) / dataHeight;
|
|
5110
|
+
self.scrollBox.scrollBoxHeight = self.scrollBox.height * self.scrollBox.heightBoxRatio - self.style.scrollBarWidth;
|
|
5111
|
+
self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize);
|
|
5112
|
+
self.scrollBox.box.v.height = self.scrollBox.scrollBoxHeight;
|
|
4475
5113
|
}
|
|
4476
5114
|
|
|
4477
5115
|
if (self.currentCell && self.currentCell.columnIndex !== undefined && self.dragMode === 'frozen-column-marker') {
|
|
4478
5116
|
self.scrollBox.scrollLeft = 0;
|
|
4479
5117
|
self.frozenColumn = self.currentCell.columnIndex + 1;
|
|
5118
|
+
self.scrollBox.bar.h.x = rowHeaderCellWidth + self.scrollCache.x[self.frozenColumn - 1];
|
|
5119
|
+
self.scrollBox.box.h.x = rowHeaderCellWidth + self.scrollCache.x[self.frozenColumn - 1];
|
|
5120
|
+
var dataWidth = self.scrollCache.x[self.scrollCache.x.length - 1];
|
|
5121
|
+
self.scrollBox.widthBoxRatio = (self.scrollBox.width - self.scrollCache.x[self.frozenColumn - 1]) / dataWidth;
|
|
5122
|
+
self.scrollBox.scrollBoxWidth = self.scrollBox.width * self.scrollBox.widthBoxRatio - self.style.scrollBarWidth;
|
|
5123
|
+
self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);
|
|
5124
|
+
self.scrollBox.box.h.width = self.scrollBox.scrollBoxWidth;
|
|
4480
5125
|
}
|
|
4481
5126
|
|
|
4482
5127
|
if (Math.abs(pos.x) > self.attributes.reorderDeadZone || Math.abs(pos.y) > self.attributes.reorderDeadZone) {
|
|
@@ -4535,7 +5180,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4535
5180
|
self.dragAddToSelection = !self.dragStartObject.selected;
|
|
4536
5181
|
|
|
4537
5182
|
if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/.test(self.dragStartObject.context) && self.currentCell && !self.currentCell.isColumnHeader && !move && !freeze && !resize) {
|
|
4538
|
-
self.
|
|
5183
|
+
if (!(self.dragMode == 'row-reorder' && self.isMultiRowsSelected) && !(self.currentCell.hovered && self.hovers.onFilterButton)) {
|
|
5184
|
+
self.selections = [];
|
|
5185
|
+
}
|
|
4539
5186
|
}
|
|
4540
5187
|
|
|
4541
5188
|
if (self.dragStartObject.isGrid) {
|
|
@@ -4626,9 +5273,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4626
5273
|
if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {
|
|
4627
5274
|
self.draggingItem = self.dragStartObject;
|
|
4628
5275
|
|
|
4629
|
-
if (self.dragMode === 'column-reorder' && self.
|
|
5276
|
+
if (self.dragMode === 'column-reorder' && !self.isMultiColumnsSelected(self.currentCell.header.index)) {
|
|
4630
5277
|
self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
|
|
4631
|
-
|
|
5278
|
+
} else if (self.dragMode === 'row-reorder' && !self.isMultiRowsSelected) {
|
|
5279
|
+
self.selectRow(self.dragStartObject.rowIndex, ctrl, null);
|
|
4632
5280
|
}
|
|
4633
5281
|
|
|
4634
5282
|
document.body.addEventListener('mousemove', self.dragReorder, false);
|
|
@@ -4639,16 +5287,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4639
5287
|
|
|
4640
5288
|
self.mouseup = function (e) {
|
|
4641
5289
|
clearTimeout(self.scrollTimer);
|
|
4642
|
-
var ctrl = e.ctrlKey || e.metaKey;
|
|
4643
5290
|
self.cellBoundaryCrossed = true;
|
|
4644
5291
|
self.rowBoundaryCrossed = true;
|
|
4645
5292
|
self.columnBoundaryCrossed = true;
|
|
4646
|
-
|
|
4647
|
-
if (self.draggingItem) {
|
|
4648
|
-
self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
|
|
4649
|
-
self.draw();
|
|
4650
|
-
}
|
|
4651
|
-
|
|
4652
5293
|
self.selecting = undefined;
|
|
4653
5294
|
self.draggingItem = undefined;
|
|
4654
5295
|
self.dragStartObject = undefined;
|
|
@@ -4754,6 +5395,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4754
5395
|
self.selectNone();
|
|
4755
5396
|
} else if (ctrl && e.key === 'a') {
|
|
4756
5397
|
self.selectAll();
|
|
5398
|
+
} else if (['Backspace', 'Delete'].includes(e.key)) {
|
|
5399
|
+
self.deleteSelectedData();
|
|
4757
5400
|
} else if (e.key === 'ArrowDown') {
|
|
4758
5401
|
y += 1;
|
|
4759
5402
|
} else if (e.key === 'ArrowUp') {
|
|
@@ -4946,7 +5589,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4946
5589
|
self.fitColumnToValues(self.currentCell.header.name);
|
|
4947
5590
|
} else if (self.currentCell.context === 'ew-resize' && self.currentCell.style === 'cornerCell') {
|
|
4948
5591
|
self.autosize();
|
|
4949
|
-
} else if (['cell', 'activeCell'].
|
|
5592
|
+
} else if (['cell', 'activeCell'].includes(self.currentCell.style) && !self.hovers.onFilterButton) {
|
|
4950
5593
|
self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);
|
|
4951
5594
|
}
|
|
4952
5595
|
};
|
|
@@ -5198,6 +5841,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5198
5841
|
})) {
|
|
5199
5842
|
return;
|
|
5200
5843
|
}
|
|
5844
|
+
|
|
5845
|
+
requestAnimationFrame(function () {
|
|
5846
|
+
return self.draw();
|
|
5847
|
+
});
|
|
5201
5848
|
};
|
|
5202
5849
|
|
|
5203
5850
|
self.copy = function (e) {
|
|
@@ -5221,6 +5868,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5221
5868
|
isNeat = true; // Selected like [[0, 1], [0, 1]] of [[0, 3]] is neat; Selected like [[0, 1], [1, 2]] is untidy
|
|
5222
5869
|
|
|
5223
5870
|
function htmlSafe(v) {
|
|
5871
|
+
if (typeof v === 'number') return v;
|
|
5224
5872
|
return v.replace(/</g, '<').replace(/>/g, '>');
|
|
5225
5873
|
}
|
|
5226
5874
|
|
|
@@ -5236,8 +5884,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5236
5884
|
if (!firstRowKeys) firstRowKeys = Object.keys(row);
|
|
5237
5885
|
if (isNeat && rowKeys.length !== firstRowKeys.length) isNeat = false;
|
|
5238
5886
|
sSorted.forEach(function (column, columnIndex) {
|
|
5239
|
-
if (rowKeys.indexOf(column.name) < 0) {
|
|
5240
|
-
if (firstRowKeys.indexOf(column.name) < 0) {
|
|
5887
|
+
if (rowKeys.indexOf(String(column.name)) < 0) {
|
|
5888
|
+
if (firstRowKeys.indexOf(String(column.name)) < 0) {
|
|
5241
5889
|
return;
|
|
5242
5890
|
} else if (isNeat) {
|
|
5243
5891
|
isNeat = false;
|
|
@@ -5532,6 +6180,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5532
6180
|
trees: {}
|
|
5533
6181
|
};
|
|
5534
6182
|
self.selections = [];
|
|
6183
|
+
self.filterable = {
|
|
6184
|
+
rows: [],
|
|
6185
|
+
columns: []
|
|
6186
|
+
};
|
|
6187
|
+
self.selectedFilterButton = {
|
|
6188
|
+
columnIndex: -1,
|
|
6189
|
+
rowIndex: -1
|
|
6190
|
+
};
|
|
5535
6191
|
self.hovers = {};
|
|
5536
6192
|
self.attributes = {};
|
|
5537
6193
|
self.style = {};
|
|
@@ -5549,7 +6205,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5549
6205
|
self.openChildren = {};
|
|
5550
6206
|
self.scrollModes = ['vertical-scroll-box', 'vertical-scroll-top', 'vertical-scroll-bottom', 'horizontal-scroll-box', 'horizontal-scroll-right', 'horizontal-scroll-left'];
|
|
5551
6207
|
self.componentL1Events = {};
|
|
5552
|
-
self.eventNames = ['afterdraw', 'afterrendercell', 'attributechanged', 'beforebeginedit', 'beforecreatecellgrid', 'beforedraw', 'beforeendedit', 'beforerendercell', 'beforerendercellgrid', 'beginedit', 'cellmouseout', 'cellmouseover', 'click', 'collapsetree', 'contextmenu', 'copy', 'datachanged', 'dblclick', 'endedit', 'expandtree', 'formatcellvalue', 'keydown', 'keypress', 'keyup', 'mousedown', 'mousemove', 'mouseup', 'newrow', 'ordercolumn', 'rendercell', 'rendercellgrid', 'renderorderbyarrow', 'rendertext', 'rendertreearrow', 'reorder', 'reordering', 'resize', 'resizecolumn', 'resizerow', 'schemachanged', 'scroll', 'selectionchanged', 'stylechanged', 'touchcancel', 'touchend', 'touchmove', 'touchstart', 'wheel'];
|
|
6208
|
+
self.eventNames = ['afterdraw', 'afterrendercell', 'afterrenderfilterbutton', 'attributechanged', 'beforebeginedit', 'beforecreatecellgrid', 'beforedraw', 'beforeendedit', 'beforerendercell', 'beforerendercellgrid', 'beforerenderfilterbutton', 'beginedit', 'cellmouseout', 'cellmouseover', 'click', 'collapsetree', 'contextmenu', 'copy', 'datachanged', 'dblclick', 'endedit', 'expandtree', 'formatcellvalue', 'keydown', 'keypress', 'keyup', 'mousedown', 'mousemove', 'mouseup', 'newrow', 'ordercolumn', 'rendercell', 'rendercellgrid', 'renderorderbyarrow', 'rendertext', 'rendertreearrow', 'reorder', 'reordering', 'resize', 'resizecolumn', 'resizerow', 'schemachanged', 'scroll', 'selectionchanged', 'stylechanged', 'touchcancel', 'touchend', 'touchmove', 'touchstart', 'wheel'];
|
|
5553
6209
|
self.mouse = {
|
|
5554
6210
|
x: 0,
|
|
5555
6211
|
y: 0
|
|
@@ -5669,6 +6325,51 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5669
6325
|
return selectedCells;
|
|
5670
6326
|
};
|
|
5671
6327
|
|
|
6328
|
+
self.clearSelectedCells = function () {
|
|
6329
|
+
var schema = self.getSchema();
|
|
6330
|
+
var affectedCells = [];
|
|
6331
|
+
|
|
6332
|
+
var _iterator3 = _createForOfIteratorHelper(self.selections.entries()),
|
|
6333
|
+
_step3;
|
|
6334
|
+
|
|
6335
|
+
try {
|
|
6336
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
6337
|
+
var _step3$value = _slicedToArray(_step3.value, 2),
|
|
6338
|
+
rowIndex = _step3$value[0],
|
|
6339
|
+
row = _step3$value[1];
|
|
6340
|
+
|
|
6341
|
+
// If no cells are selected for a particular rowIndex the selections array will contain an empty element for that rowIndex.
|
|
6342
|
+
if (!row) continue;
|
|
6343
|
+
var boundRowIndex = self.getBoundRowIndexFromViewRowIndex(rowIndex);
|
|
6344
|
+
|
|
6345
|
+
var _iterator4 = _createForOfIteratorHelper(row),
|
|
6346
|
+
_step4;
|
|
6347
|
+
|
|
6348
|
+
try {
|
|
6349
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
6350
|
+
var columnIndex = _step4.value;
|
|
6351
|
+
// If the whole row is selected the columnIndex for the rowHeader is -1.
|
|
6352
|
+
if (columnIndex < 0) continue;
|
|
6353
|
+
var boundColumnIndex = self.getBoundColumnIndexFromViewColumnIndex(columnIndex);
|
|
6354
|
+
var columnName = schema[boundColumnIndex].name;
|
|
6355
|
+
self.viewData[boundRowIndex][columnName] = null;
|
|
6356
|
+
affectedCells.push([rowIndex, columnIndex, boundRowIndex, boundColumnIndex]);
|
|
6357
|
+
}
|
|
6358
|
+
} catch (err) {
|
|
6359
|
+
_iterator4.e(err);
|
|
6360
|
+
} finally {
|
|
6361
|
+
_iterator4.f();
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6364
|
+
} catch (err) {
|
|
6365
|
+
_iterator3.e(err);
|
|
6366
|
+
} finally {
|
|
6367
|
+
_iterator3.f();
|
|
6368
|
+
}
|
|
6369
|
+
|
|
6370
|
+
return affectedCells;
|
|
6371
|
+
};
|
|
6372
|
+
|
|
5672
6373
|
self.getBoundRowIndexFromViewRowIndex = function (viewRowIndex) {
|
|
5673
6374
|
if (self.boundRowIndexMap && self.boundRowIndexMap.has(viewRowIndex)) {
|
|
5674
6375
|
return self.boundRowIndexMap.get(viewRowIndex);
|
|
@@ -5839,12 +6540,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5839
6540
|
} // Apply sorting
|
|
5840
6541
|
|
|
5841
6542
|
|
|
5842
|
-
var
|
|
5843
|
-
|
|
6543
|
+
var _iterator5 = _createForOfIteratorHelper(self.orderings.columns),
|
|
6544
|
+
_step5;
|
|
5844
6545
|
|
|
5845
6546
|
try {
|
|
5846
6547
|
var _loop2 = function _loop2() {
|
|
5847
|
-
var column =
|
|
6548
|
+
var column = _step5.value;
|
|
5848
6549
|
var sortFn = column.sortFunction(column.orderBy, column.orderDirection);
|
|
5849
6550
|
newViewData.sort(function (_ref7, _ref8) {
|
|
5850
6551
|
var _ref9 = _slicedToArray(_ref7, 1),
|
|
@@ -5859,13 +6560,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5859
6560
|
});
|
|
5860
6561
|
};
|
|
5861
6562
|
|
|
5862
|
-
for (
|
|
6563
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
5863
6564
|
_loop2();
|
|
5864
6565
|
}
|
|
5865
6566
|
} catch (err) {
|
|
5866
|
-
|
|
6567
|
+
_iterator5.e(err);
|
|
5867
6568
|
} finally {
|
|
5868
|
-
|
|
6569
|
+
_iterator5.f();
|
|
5869
6570
|
}
|
|
5870
6571
|
|
|
5871
6572
|
return {
|
|
@@ -6019,6 +6720,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6019
6720
|
self.controlInput.removeEventListener('keypress', self.keypress, false);
|
|
6020
6721
|
self.controlInput.removeEventListener('keyup', self.keyup, false);
|
|
6021
6722
|
self.controlInput.removeEventListener('keydown', self.keydown, false);
|
|
6723
|
+
document.body.removeEventListener('mousemove', self.mousemove);
|
|
6022
6724
|
window.removeEventListener('resize', self.resize);
|
|
6023
6725
|
|
|
6024
6726
|
if (self.observer && self.observer.disconnect) {
|
|
@@ -6195,6 +6897,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6195
6897
|
};
|
|
6196
6898
|
Object.keys(self.style).forEach(self.parseStyleValue);
|
|
6197
6899
|
self.intf.moveSelection = self.moveSelection;
|
|
6900
|
+
self.intf.deleteSelectedData = self.deleteSelectedData;
|
|
6198
6901
|
self.intf.moveTo = self.moveTo;
|
|
6199
6902
|
self.intf.addEventListener = self.addEventListener;
|
|
6200
6903
|
self.intf.removeEventListener = self.removeEventListener;
|
|
@@ -6228,6 +6931,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6228
6931
|
self.intf.clearChangeLog = self.clearChangeLog;
|
|
6229
6932
|
self.intf.gotoCell = self.gotoCell;
|
|
6230
6933
|
self.intf.gotoRow = self.gotoRow;
|
|
6934
|
+
self.intf.addButton = self.addButton;
|
|
6231
6935
|
self.intf.getHeaderByName = self.getHeaderByName;
|
|
6232
6936
|
self.intf.findColumnScrollLeft = self.findColumnScrollLeft;
|
|
6233
6937
|
self.intf.findRowScrollTop = self.findRowScrollTop;
|
|
@@ -7036,6 +7740,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7036
7740
|
if (!preventScrollEvent) {
|
|
7037
7741
|
self.scroll();
|
|
7038
7742
|
}
|
|
7743
|
+
|
|
7744
|
+
if (self.button) {
|
|
7745
|
+
self.moveButtonPos();
|
|
7746
|
+
}
|
|
7039
7747
|
}
|
|
7040
7748
|
|
|
7041
7749
|
function setScrollLeft(value, preventScrollEvent) {
|
|
@@ -7060,6 +7768,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7060
7768
|
if (!preventScrollEvent) {
|
|
7061
7769
|
self.scroll();
|
|
7062
7770
|
}
|
|
7771
|
+
|
|
7772
|
+
if (self.button) {
|
|
7773
|
+
self.moveButtonPos();
|
|
7774
|
+
}
|
|
7063
7775
|
}
|
|
7064
7776
|
|
|
7065
7777
|
self.scrollBox.toString = function () {
|
|
@@ -7168,8 +7880,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7168
7880
|
/* harmony import */ var _touch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./touch */ "./lib/touch.js");
|
|
7169
7881
|
/* harmony import */ var _intf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intf */ "./lib/intf.js");
|
|
7170
7882
|
/* harmony import */ var _contextMenu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./contextMenu */ "./lib/contextMenu.js");
|
|
7171
|
-
/* harmony import */ var
|
|
7172
|
-
/* harmony import */ var
|
|
7883
|
+
/* harmony import */ var _button__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./button */ "./lib/button.js");
|
|
7884
|
+
/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dom */ "./lib/dom.js");
|
|
7885
|
+
/* harmony import */ var _publicMethods__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./publicMethods */ "./lib/publicMethods.js");
|
|
7173
7886
|
/*jslint browser: true, unparam: true, todo: true, evil: true*/
|
|
7174
7887
|
|
|
7175
7888
|
/*globals Reflect: false, HTMLElement: true, define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/
|
|
@@ -7186,8 +7899,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
7186
7899
|
|
|
7187
7900
|
|
|
7188
7901
|
|
|
7902
|
+
|
|
7189
7903
|
var webComponent = (0,_component__WEBPACK_IMPORTED_MODULE_0__.default)();
|
|
7190
|
-
var modules = [_defaults__WEBPACK_IMPORTED_MODULE_1__.default, _draw__WEBPACK_IMPORTED_MODULE_2__.default, _events__WEBPACK_IMPORTED_MODULE_3__.default, _touch__WEBPACK_IMPORTED_MODULE_4__.default, _intf__WEBPACK_IMPORTED_MODULE_5__.default, _contextMenu__WEBPACK_IMPORTED_MODULE_6__.default,
|
|
7904
|
+
var modules = [_defaults__WEBPACK_IMPORTED_MODULE_1__.default, _draw__WEBPACK_IMPORTED_MODULE_2__.default, _events__WEBPACK_IMPORTED_MODULE_3__.default, _touch__WEBPACK_IMPORTED_MODULE_4__.default, _intf__WEBPACK_IMPORTED_MODULE_5__.default, _contextMenu__WEBPACK_IMPORTED_MODULE_6__.default, _button__WEBPACK_IMPORTED_MODULE_7__.default, _dom__WEBPACK_IMPORTED_MODULE_8__.default, _publicMethods__WEBPACK_IMPORTED_MODULE_9__.default];
|
|
7191
7905
|
|
|
7192
7906
|
function Grid(args) {
|
|
7193
7907
|
args = args || {};
|
|
@@ -7555,6 +8269,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7555
8269
|
delete self.columnFilters[column];
|
|
7556
8270
|
} else {
|
|
7557
8271
|
self.columnFilters[column] = value;
|
|
8272
|
+
|
|
8273
|
+
if (self.attributes.showFilterInCell) {
|
|
8274
|
+
self.filterable.rows.push(0);
|
|
8275
|
+
self.orders.columns.forEach(function (value, index) {
|
|
8276
|
+
self.filterable.columns.push(index);
|
|
8277
|
+
});
|
|
8278
|
+
}
|
|
8279
|
+
}
|
|
8280
|
+
|
|
8281
|
+
if (!Object.keys(self.columnFilters).length) {
|
|
8282
|
+
self.filterable = {
|
|
8283
|
+
rows: [],
|
|
8284
|
+
columns: []
|
|
8285
|
+
};
|
|
7558
8286
|
}
|
|
7559
8287
|
|
|
7560
8288
|
self.refresh();
|
|
@@ -7648,6 +8376,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7648
8376
|
self.gotoRow = function (y) {
|
|
7649
8377
|
self.gotoCell(0, y);
|
|
7650
8378
|
};
|
|
8379
|
+
/**
|
|
8380
|
+
* Add a button into the cell.
|
|
8381
|
+
* @memberof canvasDatagrid
|
|
8382
|
+
* @name addButton
|
|
8383
|
+
* @method
|
|
8384
|
+
* @param {number} columnIndex The column index of the cell to to add a button.
|
|
8385
|
+
* @param {number} rowIndex The row index of the cell to to add a button.
|
|
8386
|
+
* @param {object} offset Offset how far go away from cell.
|
|
8387
|
+
* @param {object} items a list of items to add into button menu.
|
|
8388
|
+
* @param {string} imgSrc icon path to add into button.
|
|
8389
|
+
*/
|
|
8390
|
+
|
|
8391
|
+
|
|
8392
|
+
self.addButton = function (columnIndex, rowIndex, offset, items, imgSrc) {
|
|
8393
|
+
var cells = self.visibleCells.filter(function (c) {
|
|
8394
|
+
return c.sortColumnIndex === columnIndex && c.sortRowIndex === rowIndex;
|
|
8395
|
+
});
|
|
8396
|
+
self.attachButton({
|
|
8397
|
+
top: cells[0].y + cells[0].height + offset.y,
|
|
8398
|
+
left: cells[0].x + cells[0].width + offset.x
|
|
8399
|
+
}, items, imgSrc);
|
|
8400
|
+
};
|
|
7651
8401
|
/**
|
|
7652
8402
|
* Scrolls the cell at cell x, row y into view if it is not already.
|
|
7653
8403
|
* @memberof canvasDatagrid
|
|
@@ -7738,6 +8488,35 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7738
8488
|
|
|
7739
8489
|
self.draw();
|
|
7740
8490
|
};
|
|
8491
|
+
/**
|
|
8492
|
+
* Returns true if indices of columns next to the selected columnIndex is selected on every row.
|
|
8493
|
+
* @memberof canvasDatagrid
|
|
8494
|
+
* @name isMultiColumnsSelected
|
|
8495
|
+
* @method
|
|
8496
|
+
* @param {number} columnIndex The column index to check.
|
|
8497
|
+
*/
|
|
8498
|
+
|
|
8499
|
+
|
|
8500
|
+
self.isMultiColumnsSelected = function (columnIndex) {
|
|
8501
|
+
var multiColIsSelected = true;
|
|
8502
|
+
self.viewData.forEach(function (row, rowIndex) {
|
|
8503
|
+
var columnIndices = self.selections[rowIndex];
|
|
8504
|
+
|
|
8505
|
+
if (!columnIndices || columnIndices.length <= 1 || columnIndices.indexOf(columnIndex) === -1) {
|
|
8506
|
+
multiColIsSelected = false;
|
|
8507
|
+
} else if (columnIndices.length > 1) {
|
|
8508
|
+
if (columnIndices[0] != columnIndex) multiColIsSelected = false;else {
|
|
8509
|
+
for (var i = 0; i < columnIndices.length - 1; i++) {
|
|
8510
|
+
if (columnIndices[i] + 1 != columnIndices[i + 1]) {
|
|
8511
|
+
multiColIsSelected = false;
|
|
8512
|
+
break;
|
|
8513
|
+
}
|
|
8514
|
+
}
|
|
8515
|
+
}
|
|
8516
|
+
}
|
|
8517
|
+
});
|
|
8518
|
+
return multiColIsSelected;
|
|
8519
|
+
};
|
|
7741
8520
|
/**
|
|
7742
8521
|
* Returns true if the selected columnIndex is selected on every row.
|
|
7743
8522
|
* @memberof canvasDatagrid
|
|
@@ -7750,7 +8529,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7750
8529
|
self.isColumnSelected = function (columnIndex) {
|
|
7751
8530
|
var colIsSelected = true;
|
|
7752
8531
|
self.viewData.forEach(function (row, rowIndex) {
|
|
7753
|
-
if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(
|
|
8532
|
+
if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(columnIndex) === -1) {
|
|
7754
8533
|
colIsSelected = false;
|
|
7755
8534
|
}
|
|
7756
8535
|
});
|
|
@@ -7878,6 +8657,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7878
8657
|
st,
|
|
7879
8658
|
en,
|
|
7880
8659
|
s = self.getVisibleSchema();
|
|
8660
|
+
self.isMultiRowsSelected = false;
|
|
7881
8661
|
|
|
7882
8662
|
function de() {
|
|
7883
8663
|
if (supressEvent) {
|
|
@@ -8062,7 +8842,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8062
8842
|
return;
|
|
8063
8843
|
}
|
|
8064
8844
|
|
|
8065
|
-
|
|
8845
|
+
var columnIndex = name === 'cornerCell' ? -1 : self.getHeaderByName(name).index;
|
|
8846
|
+
var newSize = Math.max(self.findColumnMaxTextLength(name), self.style.minColumnWidth);
|
|
8847
|
+
self.sizes.columns[columnIndex] = newSize;
|
|
8848
|
+
self.dispatchEvent('resizecolumn', {
|
|
8849
|
+
x: newSize,
|
|
8850
|
+
y: self.resizingStartingHeight,
|
|
8851
|
+
draggingItem: self.currentCell
|
|
8852
|
+
});
|
|
8066
8853
|
|
|
8067
8854
|
if (!internal) {
|
|
8068
8855
|
self.resize();
|
|
@@ -8183,6 +8970,29 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8183
8970
|
});
|
|
8184
8971
|
self.selections = sel;
|
|
8185
8972
|
};
|
|
8973
|
+
/**
|
|
8974
|
+
* Deletes currently selected data.
|
|
8975
|
+
* @memberof canvasDatagrid
|
|
8976
|
+
* @name deleteSelectedData
|
|
8977
|
+
* @method
|
|
8978
|
+
* @param {boolean} dontDraw Suppress the draw method after the selection change.
|
|
8979
|
+
*/
|
|
8980
|
+
|
|
8981
|
+
|
|
8982
|
+
self.deleteSelectedData = function (dontDraw) {
|
|
8983
|
+
var affectedCells = self.clearSelectedCells();
|
|
8984
|
+
self.dispatchEvent('afterdelete', {
|
|
8985
|
+
cells: affectedCells
|
|
8986
|
+
});
|
|
8987
|
+
|
|
8988
|
+
if (dontDraw) {
|
|
8989
|
+
return;
|
|
8990
|
+
}
|
|
8991
|
+
|
|
8992
|
+
requestAnimationFrame(function () {
|
|
8993
|
+
return self.draw();
|
|
8994
|
+
});
|
|
8995
|
+
};
|
|
8186
8996
|
/**
|
|
8187
8997
|
* Moves data in the provided selection to another position in the grid. Moving data off the edge of the schema (columns/x) will truncate data.
|
|
8188
8998
|
* @memberof canvasDatagrid
|