canvas-datagrid 0.3.16 → 0.3.20
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 +24 -0
- package/dist/canvas-datagrid.debug.js +798 -68
- 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 +14 -0
- package/lib/button.js +325 -0
- package/lib/contextMenu.js +47 -8
- package/lib/defaults.js +27 -0
- package/lib/dom.js +90 -0
- package/lib/draw.js +106 -8
- package/lib/events/index.js +191 -52
- package/lib/intf.js +17 -0
- package/lib/main.js +2 -0
- package/lib/publicMethods.js +70 -2
- package/package.json +1 -1
|
@@ -11,6 +11,335 @@
|
|
|
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
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
var _iterator = _createForOfIteratorHelper(items),
|
|
183
|
+
_step;
|
|
184
|
+
|
|
185
|
+
try {
|
|
186
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
187
|
+
var item = _step.value;
|
|
188
|
+
var buttonMenuItemContainer = document.createElement('div');
|
|
189
|
+
addItem(item, buttonMenuItemContainer);
|
|
190
|
+
buttonMenu.appendChild(buttonMenuItemContainer);
|
|
191
|
+
}
|
|
192
|
+
} catch (err) {
|
|
193
|
+
_iterator.e(err);
|
|
194
|
+
} finally {
|
|
195
|
+
_iterator.f();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function clickIndex(idx) {
|
|
200
|
+
items[idx].buttonMenuItemContainer.dispatchEvent(new Event('click'));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function init() {
|
|
204
|
+
var loc = {},
|
|
205
|
+
s = self.scrollOffset(self.canvas);
|
|
206
|
+
|
|
207
|
+
if (zIndexTop === undefined) {
|
|
208
|
+
zIndexTop = self.style.buttonZIndex;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
createItems();
|
|
212
|
+
self.createInlineStyle(buttonMenu, 'canvas-datagrid-button-menu' + (self.mobile ? '-mobile' : ''));
|
|
213
|
+
loc.x = pos.left - s.left;
|
|
214
|
+
loc.y = pos.top - s.top;
|
|
215
|
+
loc.height = 0;
|
|
216
|
+
zIndexTop += 1;
|
|
217
|
+
buttonMenu.style.position = 'absolute';
|
|
218
|
+
buttonMenu.style.zIndex = zIndexTop;
|
|
219
|
+
buttonMenu.style.left = loc.x + 'px';
|
|
220
|
+
buttonMenu.style.top = loc.y + 'px';
|
|
221
|
+
document.body.appendChild(buttonMenu);
|
|
222
|
+
rect = buttonMenu.getBoundingClientRect();
|
|
223
|
+
|
|
224
|
+
if (rect.bottom > window.innerHeight) {
|
|
225
|
+
loc.y = self.button.wrapper.top - buttonMenu.offsetHeight - self.scrollBox.scrollTop;
|
|
226
|
+
|
|
227
|
+
if (loc.y < 0) {
|
|
228
|
+
loc.y = self.style.buttonMenuWindowMargin;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (buttonMenu.offsetHeight > window.innerHeight - self.style.buttonMenuWindowMargin) {
|
|
232
|
+
buttonMenu.style.height = window.innerHeight - self.style.buttonMenuWindowMargin * 2 + 'px';
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (rect.right > window.innerWidth) {
|
|
237
|
+
loc.x -= rect.right - window.innerWidth + self.style.buttonMenuWindowMargin;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (loc.x < 0) {
|
|
241
|
+
loc.x = self.style.buttonMenuWindowMargin;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (loc.y < 0) {
|
|
245
|
+
loc.y = self.style.buttonMenuWindowMargin;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
buttonMenu.style.left = loc.x + 'px';
|
|
249
|
+
buttonMenu.style.top = loc.y + 'px';
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
intf.buttonMenu = buttonMenu;
|
|
253
|
+
init();
|
|
254
|
+
intf.clickIndex = clickIndex;
|
|
255
|
+
intf.rect = rect;
|
|
256
|
+
intf.items = items;
|
|
257
|
+
|
|
258
|
+
intf.dispose = function () {
|
|
259
|
+
if (buttonMenu.parentNode) {
|
|
260
|
+
buttonMenu.parentNode.removeChild(buttonMenu);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
Object.defineProperty(intf, 'selectedIndex', {
|
|
265
|
+
get: function get() {
|
|
266
|
+
return selectedIndex;
|
|
267
|
+
},
|
|
268
|
+
set: function set(value) {
|
|
269
|
+
if (typeof value !== 'number' || isNaN(value) || !isFinite(value)) {
|
|
270
|
+
throw new Error('Button menu selected index must be a sane number.');
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
selectedIndex = value;
|
|
274
|
+
|
|
275
|
+
if (selectedIndex > items.length - 1) {
|
|
276
|
+
selectedIndex = items.length - 1;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (selectedIndex < 0) {
|
|
280
|
+
selectedIndex = 0;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
items.forEach(function (item, index) {
|
|
284
|
+
if (index === selectedIndex) {
|
|
285
|
+
return self.createInlineStyle(item.buttonMenuItemContainer, 'canvas-datagrid-button-menu-item:hover');
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
self.createInlineStyle(item.buttonMenuItemContainer, 'canvas-datagrid-button-menu-item');
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
return intf;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
self.disposeButtonMenu = function () {
|
|
296
|
+
if (self.buttonMenu) {
|
|
297
|
+
document.removeEventListener('click', self.disposeButtonMenu);
|
|
298
|
+
self.buttonMenu.dispose();
|
|
299
|
+
self.buttonMenu = undefined;
|
|
300
|
+
self.createInlineStyle(self.button.wrapper, 'canvas-datagrid-button-wrapper:hover');
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
self.disposeButton = function (e) {
|
|
305
|
+
if (e && e.keyCode !== 27) return;
|
|
306
|
+
document.removeEventListener('keydown', self.disposeButton);
|
|
307
|
+
zIndexTop = self.style.buttonZIndex;
|
|
308
|
+
self.disposeButtonMenu();
|
|
309
|
+
|
|
310
|
+
if (self.button) {
|
|
311
|
+
self.button.dispose();
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
self.button = undefined;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
self.moveButtonPos = function () {
|
|
318
|
+
self.button.wrapper.style.left = self.button.wrapper.left - self.scrollBox.scrollLeft + 'px';
|
|
319
|
+
self.button.wrapper.style.top = self.button.wrapper.top - self.scrollBox.scrollTop + 'px';
|
|
320
|
+
self.disposeButtonMenu();
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
self.attachButton = function (pos, items, imgSrc) {
|
|
324
|
+
function createDisposeEvent() {
|
|
325
|
+
requestAnimationFrame(function () {
|
|
326
|
+
document.addEventListener('keydown', self.disposeButton);
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (self.button) {
|
|
331
|
+
self.disposeButton();
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
self.button = createButton(pos, items, imgSrc);
|
|
335
|
+
createDisposeEvent();
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/***/ }),
|
|
342
|
+
|
|
14
343
|
/***/ "./lib/component.js":
|
|
15
344
|
/*!**************************!*\
|
|
16
345
|
!*** ./lib/component.js ***!
|
|
@@ -467,6 +796,38 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
467
796
|
}
|
|
468
797
|
}
|
|
469
798
|
|
|
799
|
+
function fade(element) {
|
|
800
|
+
var opacity = 1;
|
|
801
|
+
var timer = setInterval(function () {
|
|
802
|
+
if (opacity <= 0.1) {
|
|
803
|
+
clearInterval(timer);
|
|
804
|
+
element.style.display = 'none';
|
|
805
|
+
|
|
806
|
+
if (element.parentNode) {
|
|
807
|
+
element.parentNode.removeChild(element);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
element.style.opacity = opacity;
|
|
812
|
+
element.style.filter = 'alpha(opacity=' + opacity * 100 + ')';
|
|
813
|
+
opacity -= opacity * 0.1;
|
|
814
|
+
}, self.attributes.animationDurationHideContextMenu * 0.1);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
function unfade(element) {
|
|
818
|
+
var opacity = 0.1;
|
|
819
|
+
element.style.display = 'block';
|
|
820
|
+
var timer = setInterval(function () {
|
|
821
|
+
if (opacity >= 1) {
|
|
822
|
+
clearInterval(timer);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
element.style.opacity = opacity;
|
|
826
|
+
element.style.filter = 'alpha(opacity=' + opacity * 100 + ')';
|
|
827
|
+
opacity += opacity * 0.1;
|
|
828
|
+
}, self.attributes.animationDurationShowContextMenu * 0.1);
|
|
829
|
+
}
|
|
830
|
+
|
|
470
831
|
function startHoverScroll(type) {
|
|
471
832
|
return function t() {
|
|
472
833
|
var a = self.attributes.contextHoverScrollAmount;
|
|
@@ -504,6 +865,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
504
865
|
loc.y = pos.top - s.top;
|
|
505
866
|
loc.height = 0;
|
|
506
867
|
zIndexTop += 1;
|
|
868
|
+
container.style.opacity = 0;
|
|
507
869
|
container.style.position = 'absolute';
|
|
508
870
|
upArrow.style.color = self.style.contextMenuArrowColor;
|
|
509
871
|
downArrow.style.color = self.style.contextMenuArrowColor;
|
|
@@ -540,6 +902,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
540
902
|
container.appendChild(upArrow);
|
|
541
903
|
document.body.appendChild(downArrow);
|
|
542
904
|
document.body.appendChild(container);
|
|
905
|
+
unfade(container);
|
|
543
906
|
rect = container.getBoundingClientRect(); // TODO: fix !(parentContextMenu && parentContextMenu.inputDropdown) state (autocomplete)
|
|
544
907
|
|
|
545
908
|
if (rect.bottom > window.innerHeight) {
|
|
@@ -600,9 +963,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
600
963
|
c.dispose();
|
|
601
964
|
});
|
|
602
965
|
[downArrow, upArrow, container].forEach(function (el) {
|
|
603
|
-
|
|
604
|
-
el.parentNode.removeChild(el);
|
|
605
|
-
}
|
|
966
|
+
fade(el);
|
|
606
967
|
});
|
|
607
968
|
};
|
|
608
969
|
|
|
@@ -923,7 +1284,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
923
1284
|
}
|
|
924
1285
|
};
|
|
925
1286
|
|
|
926
|
-
self.disposeContextMenu = function () {
|
|
1287
|
+
self.disposeContextMenu = function (event) {
|
|
927
1288
|
document.removeEventListener('click', self.disposeContextMenu);
|
|
928
1289
|
zIndexTop = self.style.contextMenuZIndex;
|
|
929
1290
|
self.disposeAutocomplete();
|
|
@@ -933,6 +1294,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
933
1294
|
}
|
|
934
1295
|
|
|
935
1296
|
self.contextMenu = undefined;
|
|
1297
|
+
|
|
1298
|
+
if (event) {
|
|
1299
|
+
self.canvas.focus();
|
|
1300
|
+
self.mousedown(event);
|
|
1301
|
+
self.mouseup(event);
|
|
1302
|
+
}
|
|
936
1303
|
};
|
|
937
1304
|
|
|
938
1305
|
self.contextmenuEvent = function (e, overridePos) {
|
|
@@ -940,10 +1307,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
940
1307
|
return;
|
|
941
1308
|
}
|
|
942
1309
|
|
|
943
|
-
function
|
|
1310
|
+
function createDisposeEvent() {
|
|
944
1311
|
requestAnimationFrame(function () {
|
|
945
1312
|
document.addEventListener('click', self.disposeContextMenu);
|
|
946
|
-
document.removeEventListener('mouseup',
|
|
1313
|
+
document.removeEventListener('mouseup', createDisposeEvent);
|
|
947
1314
|
});
|
|
948
1315
|
}
|
|
949
1316
|
|
|
@@ -960,7 +1327,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
960
1327
|
addDefaultContextMenuItem(ev);
|
|
961
1328
|
}
|
|
962
1329
|
|
|
963
|
-
if (self.dispatchEvent('contextmenu', ev)) {
|
|
1330
|
+
if (e.type !== 'mousedown' && self.dispatchEvent('contextmenu', ev)) {
|
|
964
1331
|
return;
|
|
965
1332
|
}
|
|
966
1333
|
|
|
@@ -983,8 +1350,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
983
1350
|
contextPosition.width = self.width - self.style.mobileContextMenuMargin * 2 + 'px';
|
|
984
1351
|
}
|
|
985
1352
|
|
|
1353
|
+
if (e.type == 'mousedown') {
|
|
1354
|
+
contextPosition.top += self.style.filterButtonMenuOffsetTop;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
986
1357
|
self.contextMenu = createContextMenu(ev, contextPosition, items);
|
|
987
|
-
|
|
1358
|
+
|
|
1359
|
+
if (e.type == 'mousedown') {
|
|
1360
|
+
document.addEventListener('mouseup', createDisposeEvent);
|
|
1361
|
+
} else {
|
|
1362
|
+
createDisposeEvent();
|
|
1363
|
+
}
|
|
1364
|
+
|
|
988
1365
|
e.preventDefault();
|
|
989
1366
|
}
|
|
990
1367
|
};
|
|
@@ -1016,8 +1393,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1016
1393
|
|
|
1017
1394
|
/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(self) {
|
|
1018
1395
|
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']]
|
|
1396
|
+
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]],
|
|
1397
|
+
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
1398
|
};
|
|
1022
1399
|
}
|
|
1023
1400
|
|
|
@@ -1494,6 +1871,96 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1494
1871
|
|
|
1495
1872
|
self.createInlineStyle = function (el, className) {
|
|
1496
1873
|
var css = {
|
|
1874
|
+
'canvas-datagrid-button-wrapper': {
|
|
1875
|
+
display: 'inline-block',
|
|
1876
|
+
padding: self.style.buttonPadding,
|
|
1877
|
+
borderWidth: '1px',
|
|
1878
|
+
borderStyle: 'solid',
|
|
1879
|
+
borderColor: self.style.buttonBorderColor,
|
|
1880
|
+
cursor: 'pointer',
|
|
1881
|
+
background: self.style.buttonBackgroundColor,
|
|
1882
|
+
userSelect: 'none'
|
|
1883
|
+
},
|
|
1884
|
+
'canvas-datagrid-button-wrapper:hover': {
|
|
1885
|
+
borderColor: self.style.buttonBorderColor,
|
|
1886
|
+
background: self.style.buttonHoverBackgroundColor
|
|
1887
|
+
},
|
|
1888
|
+
'canvas-datagrid-button-wrapper:active': {
|
|
1889
|
+
borderColor: self.style.buttonActiveBorderColor,
|
|
1890
|
+
background: self.style.buttonActiveBackgroundColor
|
|
1891
|
+
},
|
|
1892
|
+
'canvas-datagrid-button-icon': {
|
|
1893
|
+
width: '18px',
|
|
1894
|
+
height: '18px',
|
|
1895
|
+
display: 'inline-block',
|
|
1896
|
+
verticalAlign: 'middle'
|
|
1897
|
+
},
|
|
1898
|
+
'canvas-datagrid-button-arrow': {
|
|
1899
|
+
display: 'inline-block',
|
|
1900
|
+
color: self.style.buttonArrowColor,
|
|
1901
|
+
fontSize: '9px'
|
|
1902
|
+
},
|
|
1903
|
+
'canvas-datagrid-button-menu-item-mobile': {
|
|
1904
|
+
lineHeight: 'normal',
|
|
1905
|
+
fontWeight: 'normal',
|
|
1906
|
+
fontFamily: self.style.contextMenuFontFamily,
|
|
1907
|
+
fontSize: self.style.contextMenuFontSize,
|
|
1908
|
+
color: 'inherit',
|
|
1909
|
+
background: 'inherit',
|
|
1910
|
+
margin: self.style.contextMenuItemMargin,
|
|
1911
|
+
borderRadius: self.style.contextMenuItemBorderRadius,
|
|
1912
|
+
verticalAlign: 'middle'
|
|
1913
|
+
},
|
|
1914
|
+
'canvas-datagrid-button-menu-item': {
|
|
1915
|
+
lineHeight: 'normal',
|
|
1916
|
+
fontWeight: 'normal',
|
|
1917
|
+
fontFamily: self.style.contextMenuFontFamily,
|
|
1918
|
+
fontSize: self.style.contextMenuFontSize,
|
|
1919
|
+
color: 'inherit',
|
|
1920
|
+
background: 'inherit',
|
|
1921
|
+
margin: self.style.contextMenuItemMargin,
|
|
1922
|
+
borderRadius: self.style.contextMenuItemBorderRadius,
|
|
1923
|
+
verticalAlign: 'middle'
|
|
1924
|
+
},
|
|
1925
|
+
'canvas-datagrid-button-menu-item:hover': {
|
|
1926
|
+
background: self.style.contextMenuHoverBackground,
|
|
1927
|
+
color: self.style.contextMenuHoverColor
|
|
1928
|
+
},
|
|
1929
|
+
'canvas-datagrid-button-menu-label': {
|
|
1930
|
+
margin: self.style.contextMenuLabelMargin,
|
|
1931
|
+
display: self.style.contextMenuLabelDisplay,
|
|
1932
|
+
minWidth: self.style.contextMenuLabelMinWidth,
|
|
1933
|
+
maxWidth: self.style.contextMenuLabelMaxWidth
|
|
1934
|
+
},
|
|
1935
|
+
'canvas-datagrid-button-menu-mobile': {
|
|
1936
|
+
lineHeight: 'normal',
|
|
1937
|
+
fontWeight: 'normal',
|
|
1938
|
+
fontFamily: self.style.contextMenuFontFamily,
|
|
1939
|
+
fontSize: self.style.contextMenuFontSize,
|
|
1940
|
+
background: self.style.contextMenuBackground,
|
|
1941
|
+
color: self.style.contextMenuColor,
|
|
1942
|
+
border: self.style.contextMenuBorder,
|
|
1943
|
+
padding: self.style.contextMenuPadding,
|
|
1944
|
+
borderRadius: self.style.contextMenuBorderRadius,
|
|
1945
|
+
opacity: self.style.contextMenuOpacity,
|
|
1946
|
+
overflow: 'hidden',
|
|
1947
|
+
whiteSpace: 'nowrap'
|
|
1948
|
+
},
|
|
1949
|
+
'canvas-datagrid-button-menu': {
|
|
1950
|
+
lineHeight: 'normal',
|
|
1951
|
+
fontWeight: 'normal',
|
|
1952
|
+
fontFamily: self.style.contextMenuFontFamily,
|
|
1953
|
+
fontSize: self.style.contextMenuFontSize,
|
|
1954
|
+
background: self.style.contextMenuBackground,
|
|
1955
|
+
color: self.style.contextMenuColor,
|
|
1956
|
+
border: self.style.contextMenuBorder,
|
|
1957
|
+
padding: self.style.contextMenuPadding,
|
|
1958
|
+
borderRadius: self.style.contextMenuBorderRadius,
|
|
1959
|
+
opacity: self.style.contextMenuOpacity,
|
|
1960
|
+
overflow: 'hidden',
|
|
1961
|
+
whiteSpace: 'nowrap',
|
|
1962
|
+
cursor: self.style.contextMenuCursor
|
|
1963
|
+
},
|
|
1497
1964
|
'canvas-datagrid-context-menu-filter-input': {
|
|
1498
1965
|
height: '19px',
|
|
1499
1966
|
verticalAlign: 'bottom',
|
|
@@ -1939,6 +2406,27 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
1939
2406
|
return ml + aw + mr;
|
|
1940
2407
|
}
|
|
1941
2408
|
|
|
2409
|
+
function drawFilterButtonArrow(x, y) {
|
|
2410
|
+
var mt = (self.style.filterButtonHeight - self.style.filterButtonArrowHeight) / 2 * self.scale,
|
|
2411
|
+
ml = (self.style.filterButtonWidth - self.style.filterButtonArrowWidth) / 2 * self.scale,
|
|
2412
|
+
aw = self.style.filterButtonArrowWidth * self.scale,
|
|
2413
|
+
ah = self.style.filterButtonArrowHeight * self.scale;
|
|
2414
|
+
x += self.canvasOffsetLeft;
|
|
2415
|
+
y += self.canvasOffsetTop;
|
|
2416
|
+
self.ctx.fillStyle = self.style.filterButtonArrowColor;
|
|
2417
|
+
self.ctx.strokeStyle = self.style.filterButtonArrowBorderColor;
|
|
2418
|
+
self.ctx.beginPath();
|
|
2419
|
+
x = x + ml;
|
|
2420
|
+
y = y + mt;
|
|
2421
|
+
self.ctx.moveTo(x, y);
|
|
2422
|
+
self.ctx.lineTo(x + aw, y);
|
|
2423
|
+
self.ctx.lineTo(x + aw * 0.5, y + ah);
|
|
2424
|
+
self.ctx.moveTo(x, y);
|
|
2425
|
+
self.ctx.stroke();
|
|
2426
|
+
self.ctx.fill();
|
|
2427
|
+
return ml + aw;
|
|
2428
|
+
}
|
|
2429
|
+
|
|
1942
2430
|
function radiusRect(x, y, w, h, radius) {
|
|
1943
2431
|
x += self.canvasOffsetLeft;
|
|
1944
2432
|
y += self.canvasOffsetTop;
|
|
@@ -2386,8 +2874,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2386
2874
|
m = self.style.scrollBarBoxMargin * 2;
|
|
2387
2875
|
self.ctx.strokeStyle = self.style.scrollBarBorderColor;
|
|
2388
2876
|
self.ctx.lineWidth = self.style.scrollBarBorderWidth;
|
|
2389
|
-
|
|
2390
|
-
|
|
2877
|
+
|
|
2878
|
+
if (self.frozenColumn > 0) {
|
|
2879
|
+
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);
|
|
2880
|
+
} else {
|
|
2881
|
+
en.horizontalBox.x = rowHeaderCellWidth + self.style.scrollBarBoxMargin + (en.horizontalBar.width - self.scrollBox.scrollBoxWidth) * (self.scrollBox.scrollLeft / self.scrollBox.scrollWidth);
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
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
2885
|
|
|
2392
2886
|
if (self.scrollBox.horizontalBarVisible) {
|
|
2393
2887
|
self.ctx.fillStyle = self.style.scrollBarBackgroundColor;
|
|
@@ -2514,9 +3008,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2514
3008
|
isCorner = /cornerCell/.test(cellStyle),
|
|
2515
3009
|
isRowHeader = 'rowHeaderCell' === cellStyle,
|
|
2516
3010
|
isColumnHeader = 'columnHeaderCell' === cellStyle,
|
|
3011
|
+
isFilterable = self.filterable.rows.includes(rowIndex) && self.filterable.columns.includes(headerIndex),
|
|
2517
3012
|
wrap = self.style.cellWhiteSpace !== 'nowrap',
|
|
2518
3013
|
selected = self.selections[rowOrderIndex] && self.selections[rowOrderIndex].indexOf(columnOrderIndex) !== -1,
|
|
2519
3014
|
hovered = self.hovers.rowIndex === rowOrderIndex && (self.attributes.hoverMode === 'row' || self.hovers.columnIndex === columnOrderIndex),
|
|
3015
|
+
openedFilter = self.selectedFilterButton.rowIndex == rowIndex && self.selectedFilterButton.columnIndex == headerIndex,
|
|
2520
3016
|
active = self.activeCell.rowIndex === rowOrderIndex && self.activeCell.columnIndex === columnOrderIndex,
|
|
2521
3017
|
isColumnHeaderCellCap = cellStyle === 'columnHeaderCellCap',
|
|
2522
3018
|
rawValue = rowData ? rowData[header.name] : undefined,
|
|
@@ -2604,6 +3100,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2604
3100
|
isColumnHeader: isColumnHeader,
|
|
2605
3101
|
isColumnHeaderCellCap: isColumnHeaderCellCap,
|
|
2606
3102
|
isRowHeader: isRowHeader,
|
|
3103
|
+
isFilterable: isFilterable,
|
|
3104
|
+
openedFilter: openedFilter,
|
|
2607
3105
|
rowOpen: rowOpen,
|
|
2608
3106
|
header: header,
|
|
2609
3107
|
columnIndex: columnOrderIndex,
|
|
@@ -2794,11 +3292,20 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2794
3292
|
createBorderOverlayArray(cell, moveBorders, 'move', self.moveOffset);
|
|
2795
3293
|
}
|
|
2796
3294
|
|
|
2797
|
-
self.ctx.restore();
|
|
3295
|
+
self.ctx.restore();
|
|
3296
|
+
|
|
3297
|
+
if (isFilterable) {
|
|
3298
|
+
drawFilterButton(cell);
|
|
3299
|
+
} // Gaps may occur in row numbers between consecutively rendered rows
|
|
2798
3300
|
// when we are filtering. We draw attention to this by drawing a thick
|
|
2799
|
-
// border overlapping the two consecutive row headers.
|
|
3301
|
+
// border overlapping the two consecutive row headers. If sorting, visible
|
|
3302
|
+
// row numbers stay the same (i.e. they don't correspond to the underlying
|
|
3303
|
+
// data's row number), so we do not show row gaps in that case.
|
|
3304
|
+
|
|
2800
3305
|
|
|
2801
|
-
|
|
3306
|
+
var isSorting = self.orderings.columns && self.orderings.columns.length > 0;
|
|
3307
|
+
|
|
3308
|
+
if (isRowHeader && self.attributes.showRowNumbers && self.attributes.showRowNumberGaps && isSorting === false) {
|
|
2802
3309
|
var previousRowNumber = self.getBoundRowIndexFromViewRowIndex(rowOrderIndex - 1);
|
|
2803
3310
|
var hasRowGap = previousRowNumber !== undefined && cell.boundRowIndex > 0 && cell.boundRowIndex - previousRowNumber > 1;
|
|
2804
3311
|
|
|
@@ -2817,6 +3324,33 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2817
3324
|
};
|
|
2818
3325
|
}
|
|
2819
3326
|
|
|
3327
|
+
function drawFilterButton(cell, ev) {
|
|
3328
|
+
var posX = cell.x + cell.width - self.style.filterButtonWidth - 1;
|
|
3329
|
+
var posY = cell.y + cell.height - self.style.filterButtonHeight - 2;
|
|
3330
|
+
|
|
3331
|
+
if (self.dispatchEvent('beforerenderfilterbutton', ev)) {
|
|
3332
|
+
return;
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3335
|
+
self.ctx.save();
|
|
3336
|
+
self.ctx.strokeStyle = self.style.filterButtonBorderColor;
|
|
3337
|
+
self.ctx.fillStyle = self.style.filterButtonBackgroundColor;
|
|
3338
|
+
|
|
3339
|
+
if (cell.openedFilter) {
|
|
3340
|
+
self.ctx.fillStyle = self.style.filterButtonActiveBackgroundColor;
|
|
3341
|
+
} else if (cell.hovered && self.hovers.onFilterButton) {
|
|
3342
|
+
self.ctx.fillStyle = self.style.filterButtonHoverBackgroundColor;
|
|
3343
|
+
}
|
|
3344
|
+
|
|
3345
|
+
radiusRect(posX, posY, self.style.filterButtonWidth, self.style.filterButtonHeight, self.style.filterButtonBorderRadius);
|
|
3346
|
+
self.ctx.stroke();
|
|
3347
|
+
self.ctx.fill();
|
|
3348
|
+
drawFilterButtonArrow(posX, posY);
|
|
3349
|
+
self.ctx.clip();
|
|
3350
|
+
self.dispatchEvent('afterrenderfilterbutton', ev);
|
|
3351
|
+
self.ctx.restore();
|
|
3352
|
+
}
|
|
3353
|
+
|
|
2820
3354
|
function drawRowHeader(rowData, rowIndex, rowOrderIndex) {
|
|
2821
3355
|
if (self.attributes.showRowHeaders) {
|
|
2822
3356
|
x = 0; // When filtering we'd like to display the actual row numbers,
|
|
@@ -3174,6 +3708,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3174
3708
|
self.ctx.strokeStyle = self.style.reorderMarkerBorderColor;
|
|
3175
3709
|
|
|
3176
3710
|
if (self.dragMode === 'row-reorder') {
|
|
3711
|
+
for (var k = 0; k < self.selections.length; k++) {
|
|
3712
|
+
if (!self.selections[k] || k == self.reorderObject.rowIndex) continue;
|
|
3713
|
+
b.height += self.getRowHeight(k);
|
|
3714
|
+
}
|
|
3715
|
+
|
|
3177
3716
|
b.width = w;
|
|
3178
3717
|
b.x = 0;
|
|
3179
3718
|
m.width = w;
|
|
@@ -3188,6 +3727,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3188
3727
|
addBorderLine(m, self.reorderTarget.sortRowIndex > self.reorderObject.sortRowIndex ? 'b' : 't');
|
|
3189
3728
|
}
|
|
3190
3729
|
} else if (self.dragMode === 'column-reorder' && self.reorderObject) {
|
|
3730
|
+
var selectedColumns = self.selections[0];
|
|
3731
|
+
|
|
3732
|
+
for (var k = 1; k < selectedColumns.length; k++) {
|
|
3733
|
+
b.width += self.getColumnWidth(self.orders.columns[selectedColumns[k]]);
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3191
3736
|
b.height = h;
|
|
3192
3737
|
b.y = 0;
|
|
3193
3738
|
m.height = h;
|
|
@@ -3805,14 +4350,20 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3805
4350
|
setScrollBoxSize();
|
|
3806
4351
|
self.scrollBox.scrollWidth = dataWidth - self.scrollBox.width;
|
|
3807
4352
|
self.scrollBox.scrollHeight = dataHeight - self.scrollBox.height;
|
|
3808
|
-
|
|
4353
|
+
|
|
4354
|
+
if (self.frozenColumn > 0) {
|
|
4355
|
+
self.scrollBox.widthBoxRatio = (self.scrollBox.width - self.scrollCache.x[self.frozenColumn - 1]) / dataWidth;
|
|
4356
|
+
} else {
|
|
4357
|
+
self.scrollBox.widthBoxRatio = self.scrollBox.width / dataWidth;
|
|
4358
|
+
}
|
|
4359
|
+
|
|
3809
4360
|
self.scrollBox.scrollBoxWidth = self.scrollBox.width * self.scrollBox.widthBoxRatio - self.style.scrollBarWidth - b - d; // TODO: This heightBoxRatio number is terribly wrong.
|
|
3810
4361
|
// They should be a result of the size of the grid/canvas?
|
|
3811
4362
|
// it being off causes the scroll bar to "slide" under
|
|
3812
4363
|
// the dragged mouse.
|
|
3813
4364
|
// https://github.com/TonyGermaneri/canvas-datagrid/issues/97
|
|
3814
4365
|
|
|
3815
|
-
self.scrollBox.heightBoxRatio = (self.scrollBox.height - columnHeaderCellHeight) / dataHeight;
|
|
4366
|
+
self.scrollBox.heightBoxRatio = (self.scrollBox.height - columnHeaderCellHeight - self.scrollCache.y[self.frozenRow]) / dataHeight;
|
|
3816
4367
|
self.scrollBox.scrollBoxHeight = self.scrollBox.height * self.scrollBox.heightBoxRatio - self.style.scrollBarWidth - b - d;
|
|
3817
4368
|
self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);
|
|
3818
4369
|
self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize); // horizontal
|
|
@@ -3827,11 +4378,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3827
4378
|
nb.height = self.style.scrollBarBoxWidth; // vertical
|
|
3828
4379
|
|
|
3829
4380
|
v.x += self.width - self.style.scrollBarWidth - self.style.scrollBarBorderWidth - d;
|
|
3830
|
-
v.y += columnHeaderCellHeight;
|
|
4381
|
+
v.y += columnHeaderCellHeight + self.scrollCache.y[self.frozenRow];
|
|
3831
4382
|
v.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;
|
|
3832
4383
|
v.height = self.height - columnHeaderCellHeight - self.style.scrollBarWidth - d - m; // vertical box
|
|
3833
4384
|
|
|
3834
4385
|
vb.x = v.x + self.style.scrollBarBoxMargin;
|
|
4386
|
+
vb.y += self.scrollCache.y[self.frozenRow];
|
|
3835
4387
|
vb.width = self.style.scrollBarBoxWidth;
|
|
3836
4388
|
vb.height = self.scrollBox.scrollBoxHeight; // corner
|
|
3837
4389
|
|
|
@@ -3989,8 +4541,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
3989
4541
|
self.cursor = 'default';
|
|
3990
4542
|
self.hovers = {
|
|
3991
4543
|
rowIndex: cell.rowIndex,
|
|
3992
|
-
columnIndex: cell.columnIndex
|
|
4544
|
+
columnIndex: cell.columnIndex,
|
|
4545
|
+
onFilterButton: false
|
|
3993
4546
|
};
|
|
4547
|
+
|
|
4548
|
+
if (cell.isFilterable && x > cell.x + cell.width - self.style.filterButtonWidth && x < cell.x + cell.width && y > cell.y + cell.height - self.style.filterButtonHeight && y < cell.y + cell.height) {
|
|
4549
|
+
self.hovers.onFilterButton = true;
|
|
4550
|
+
self.draw();
|
|
4551
|
+
}
|
|
3994
4552
|
}
|
|
3995
4553
|
|
|
3996
4554
|
if (self.selecting || self.reorderObject) {
|
|
@@ -4029,37 +4587,75 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4029
4587
|
if ((self.attributes.selectionMode === 'row' || self.dragStartObject.columnIndex === -1) && self.rowBoundaryCrossed) {
|
|
4030
4588
|
self.selectRow(cell.rowIndex, ctrl, null, true);
|
|
4031
4589
|
} else if (self.attributes.selectionMode !== 'row') {
|
|
4032
|
-
if (
|
|
4033
|
-
if (
|
|
4034
|
-
|
|
4590
|
+
if (cell.hovered && self.hovers.onFilterButton) {
|
|
4591
|
+
if (cell.openedFilter) {
|
|
4592
|
+
cell.openedFilter = false;
|
|
4593
|
+
self.selectedFilterButton = {
|
|
4594
|
+
columnIndex: -1,
|
|
4595
|
+
rowIndex: -1
|
|
4596
|
+
};
|
|
4597
|
+
} else {
|
|
4598
|
+
self.selectedFilterButton.rowIndex = cell.rowIndex;
|
|
4599
|
+
self.selectedFilterButton.columnIndex = cell.columnIndex;
|
|
4600
|
+
self.contextmenuEvent(e, {
|
|
4601
|
+
x: cell.x + cell.width - self.style.filterButtonWidth,
|
|
4602
|
+
y: cell.y + cell.height,
|
|
4603
|
+
rect: {
|
|
4604
|
+
left: 0,
|
|
4605
|
+
top: 0
|
|
4606
|
+
}
|
|
4607
|
+
});
|
|
4035
4608
|
}
|
|
4609
|
+
|
|
4610
|
+
self.draw();
|
|
4611
|
+
return;
|
|
4036
4612
|
} else {
|
|
4037
|
-
self.
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
}
|
|
4047
|
-
|
|
4613
|
+
self.selectedFilterButton = {
|
|
4614
|
+
columnIndex: -1,
|
|
4615
|
+
rowIndex: -1
|
|
4616
|
+
};
|
|
4617
|
+
if (self.hovers.onFilterButton) return;
|
|
4618
|
+
|
|
4619
|
+
if (!self.dragAddToSelection && cell.rowIndex !== undefined) {
|
|
4620
|
+
if (self.selections[cell.rowIndex] && self.selections[cell.rowIndex].indexOf(cell.columnIndex) !== -1) {
|
|
4621
|
+
self.selections[cell.rowIndex].splice(self.selections[cell.rowIndex].indexOf(cell.columnIndex), 1);
|
|
4622
|
+
}
|
|
4623
|
+
} else {
|
|
4624
|
+
self.selections[cell.rowIndex] = self.selections[cell.rowIndex] || [];
|
|
4625
|
+
|
|
4626
|
+
if (self.selections[cell.rowIndex].indexOf(cell.columnIndex) === -1) {
|
|
4627
|
+
self.selections[cell.rowIndex].push(cell.columnIndex);
|
|
4628
|
+
var event = {
|
|
4629
|
+
selections: self.selections,
|
|
4630
|
+
selectedData: self.getSelectedData(),
|
|
4631
|
+
selectedCells: self.getSelectedCells(),
|
|
4632
|
+
selectionBounds: self.getSelectionBounds()
|
|
4633
|
+
};
|
|
4634
|
+
self.dispatchEvent('selectionchanged', event);
|
|
4635
|
+
}
|
|
4048
4636
|
}
|
|
4049
4637
|
}
|
|
4050
4638
|
}
|
|
4051
4639
|
}
|
|
4052
4640
|
|
|
4053
4641
|
if ((!self.selectionBounds || dragBounds.top !== self.selectionBounds.top || dragBounds.left !== self.selectionBounds.left || dragBounds.bottom !== self.selectionBounds.bottom || dragBounds.right !== self.selectionBounds.right) && !ctrl) {
|
|
4054
|
-
self.
|
|
4642
|
+
if (!(cell.hovered && self.hovers.onFilterButton)) {
|
|
4643
|
+
self.selections = [];
|
|
4644
|
+
}
|
|
4645
|
+
|
|
4646
|
+
if (dragBounds.top === -1) {
|
|
4647
|
+
dragBounds.top = 0;
|
|
4648
|
+
}
|
|
4649
|
+
|
|
4055
4650
|
sBounds = dragBounds;
|
|
4056
4651
|
|
|
4057
4652
|
if (self.attributes.selectionMode === 'row') {
|
|
4058
4653
|
for (i = sBounds.top; i <= sBounds.bottom; i += 1) {
|
|
4059
4654
|
self.selectRow(i, true, null, true);
|
|
4060
4655
|
}
|
|
4061
|
-
} else
|
|
4656
|
+
} else {
|
|
4062
4657
|
self.selectArea(sBounds, true);
|
|
4658
|
+
if (sBounds.left == -1 && sBounds.top !== sBounds.bottom) self.isMultiRowsSelected = true;
|
|
4063
4659
|
}
|
|
4064
4660
|
}
|
|
4065
4661
|
|
|
@@ -4134,7 +4730,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4134
4730
|
}
|
|
4135
4731
|
|
|
4136
4732
|
if (['rowHeaderCell', 'columnHeaderCell'].indexOf(self.currentCell.style) === -1 && !ctrl) {
|
|
4137
|
-
self.
|
|
4733
|
+
if (!self.hovers.onFilterButton) {
|
|
4734
|
+
self.setActiveCell(i.columnIndex, i.rowIndex);
|
|
4735
|
+
}
|
|
4138
4736
|
}
|
|
4139
4737
|
|
|
4140
4738
|
if (self.currentCell.context === 'cell') {
|
|
@@ -4157,12 +4755,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4157
4755
|
checkSelectionChange();
|
|
4158
4756
|
return;
|
|
4159
4757
|
}
|
|
4160
|
-
|
|
4161
|
-
if (self.attributes.columnHeaderClickBehavior === 'select') {
|
|
4162
|
-
self.selectColumn(i.header.index, ctrl, e.shiftKey);
|
|
4163
|
-
self.draw();
|
|
4164
|
-
return;
|
|
4165
|
-
}
|
|
4166
4758
|
}
|
|
4167
4759
|
|
|
4168
4760
|
self.selections[i.rowIndex] = self.selections[i.rowIndex] || [];
|
|
@@ -4342,6 +4934,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4342
4934
|
return;
|
|
4343
4935
|
}
|
|
4344
4936
|
|
|
4937
|
+
if ((e.ctrlKey || e.metaKey || e.shiftKey) && self.reorderObject) {
|
|
4938
|
+
if (self.dragMode === 'column-reorder' && !self.isMultiColumnsSelected(self.draggingItem.header.index)) {
|
|
4939
|
+
self.selectColumn(self.draggingItem.header.index, false, false);
|
|
4940
|
+
}
|
|
4941
|
+
}
|
|
4942
|
+
|
|
4345
4943
|
if (self.dispatchEvent('reordering', {
|
|
4346
4944
|
NativeEvent: e,
|
|
4347
4945
|
source: self.dragStartObject,
|
|
@@ -4353,6 +4951,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4353
4951
|
|
|
4354
4952
|
if (Math.abs(x) > self.attributes.reorderDeadZone || Math.abs(y) > self.attributes.reorderDeadZone) {
|
|
4355
4953
|
self.reorderObject = self.draggingItem;
|
|
4954
|
+
if (self.isMultiRowsSelected) self.reorderObject = self.getVisibleCellByIndex(-1, self.activeCell.rowIndex);
|
|
4356
4955
|
self.reorderTarget = self.currentCell;
|
|
4357
4956
|
self.reorderObject.dragOffset = {
|
|
4358
4957
|
x: x,
|
|
@@ -4365,7 +4964,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4365
4964
|
self.stopDragReorder = function (e) {
|
|
4366
4965
|
var oIndex,
|
|
4367
4966
|
tIndex,
|
|
4368
|
-
odata,
|
|
4967
|
+
odata = [],
|
|
4369
4968
|
cr = {
|
|
4370
4969
|
'row-reorder': self.orders.rows,
|
|
4371
4970
|
'column-reorder': self.orders.columns
|
|
@@ -4388,14 +4987,45 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4388
4987
|
tIndex = cr[self.dragMode].indexOf(self.reorderTarget[i]);
|
|
4389
4988
|
|
|
4390
4989
|
if (self.dragMode === 'column-reorder') {
|
|
4391
|
-
|
|
4392
|
-
|
|
4990
|
+
var sortColumnIndices = [];
|
|
4991
|
+
var seletedColumnIndices = [];
|
|
4992
|
+
|
|
4993
|
+
if (self.selections[0]) {
|
|
4994
|
+
self.selections[0].forEach(function (value) {
|
|
4995
|
+
sortColumnIndices.push(self.orders.columns[value]);
|
|
4996
|
+
});
|
|
4997
|
+
}
|
|
4998
|
+
|
|
4999
|
+
var deleteCount = sortColumnIndices.length;
|
|
5000
|
+
cr[self.dragMode].splice(oIndex, deleteCount);
|
|
5001
|
+
if (tIndex > oIndex) tIndex = tIndex - (deleteCount - 1);
|
|
5002
|
+
|
|
5003
|
+
for (var i = 0; i < sortColumnIndices.length; i++) {
|
|
5004
|
+
seletedColumnIndices.push(tIndex + i);
|
|
5005
|
+
cr[self.dragMode].splice(tIndex + i, 0, sortColumnIndices[i]);
|
|
5006
|
+
}
|
|
5007
|
+
|
|
4393
5008
|
self.orders.columns = cr[self.dragMode];
|
|
5009
|
+
self.viewData.forEach(function (row, rowIndex) {
|
|
5010
|
+
self.selections[rowIndex] = seletedColumnIndices;
|
|
5011
|
+
});
|
|
4394
5012
|
} else {
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
5013
|
+
var selectedRows = [];
|
|
5014
|
+
self.selections.forEach(function (row, rowIndex) {
|
|
5015
|
+
if (row) {
|
|
5016
|
+
selectedRows.push(row);
|
|
5017
|
+
odata.push(self.viewData[rowIndex]);
|
|
5018
|
+
}
|
|
5019
|
+
});
|
|
5020
|
+
self.viewData.splice(oIndex, odata.length);
|
|
5021
|
+
self.selections = [];
|
|
5022
|
+
if (tIndex > oIndex) tIndex = tIndex - (odata.length - 1);
|
|
5023
|
+
self.activeCell.rowIndex = tIndex;
|
|
5024
|
+
|
|
5025
|
+
for (var i = 0; i < odata.length; i++) {
|
|
5026
|
+
self.viewData.splice(tIndex + i, 0, odata[i]);
|
|
5027
|
+
self.selections[tIndex + i] = selectedRows[i];
|
|
5028
|
+
}
|
|
4399
5029
|
}
|
|
4400
5030
|
|
|
4401
5031
|
self.resize();
|
|
@@ -4461,18 +5091,36 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4461
5091
|
return;
|
|
4462
5092
|
}
|
|
4463
5093
|
|
|
4464
|
-
var pos = self.getLayerPos(e)
|
|
5094
|
+
var pos = self.getLayerPos(e),
|
|
5095
|
+
bm = self.style.gridBorderCollapse === 'collapse' ? 1 : 2,
|
|
5096
|
+
columnHeaderCellBorder = self.style.columnHeaderCellBorderWidth * bm,
|
|
5097
|
+
columnHeaderCellHeight = self.getColumnHeaderCellHeight(),
|
|
5098
|
+
rowHeaderCellWidth = self.getRowHeaderCellWidth();
|
|
4465
5099
|
self.ignoreNextClick = true;
|
|
4466
5100
|
self.freezeMarkerPosition = pos;
|
|
4467
5101
|
|
|
4468
5102
|
if (self.currentCell && self.currentCell.rowIndex !== undefined && self.dragMode === 'frozen-row-marker') {
|
|
4469
5103
|
self.scrollBox.scrollTop = 0;
|
|
4470
5104
|
self.frozenRow = self.currentCell.rowIndex + 1;
|
|
5105
|
+
self.scrollBox.bar.v.y = columnHeaderCellHeight + columnHeaderCellBorder + self.scrollCache.y[self.frozenRow];
|
|
5106
|
+
self.scrollBox.box.v.y = columnHeaderCellHeight + columnHeaderCellBorder + self.scrollCache.y[self.frozenRow];
|
|
5107
|
+
var dataHeight = self.scrollCache.y[self.scrollCache.y.length - 1];
|
|
5108
|
+
self.scrollBox.heightBoxRatio = (self.scrollBox.height - columnHeaderCellHeight - self.scrollCache.y[self.frozenRow]) / dataHeight;
|
|
5109
|
+
self.scrollBox.scrollBoxHeight = self.scrollBox.height * self.scrollBox.heightBoxRatio - self.style.scrollBarWidth;
|
|
5110
|
+
self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize);
|
|
5111
|
+
self.scrollBox.box.v.height = self.scrollBox.scrollBoxHeight;
|
|
4471
5112
|
}
|
|
4472
5113
|
|
|
4473
5114
|
if (self.currentCell && self.currentCell.columnIndex !== undefined && self.dragMode === 'frozen-column-marker') {
|
|
4474
5115
|
self.scrollBox.scrollLeft = 0;
|
|
4475
5116
|
self.frozenColumn = self.currentCell.columnIndex + 1;
|
|
5117
|
+
self.scrollBox.bar.h.x = rowHeaderCellWidth + self.scrollCache.x[self.frozenColumn - 1];
|
|
5118
|
+
self.scrollBox.box.h.x = rowHeaderCellWidth + self.scrollCache.x[self.frozenColumn - 1];
|
|
5119
|
+
var dataWidth = self.scrollCache.x[self.scrollCache.x.length - 1];
|
|
5120
|
+
self.scrollBox.widthBoxRatio = (self.scrollBox.width - self.scrollCache.x[self.frozenColumn - 1]) / dataWidth;
|
|
5121
|
+
self.scrollBox.scrollBoxWidth = self.scrollBox.width * self.scrollBox.widthBoxRatio - self.style.scrollBarWidth;
|
|
5122
|
+
self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);
|
|
5123
|
+
self.scrollBox.box.h.width = self.scrollBox.scrollBoxWidth;
|
|
4476
5124
|
}
|
|
4477
5125
|
|
|
4478
5126
|
if (Math.abs(pos.x) > self.attributes.reorderDeadZone || Math.abs(pos.y) > self.attributes.reorderDeadZone) {
|
|
@@ -4531,7 +5179,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4531
5179
|
self.dragAddToSelection = !self.dragStartObject.selected;
|
|
4532
5180
|
|
|
4533
5181
|
if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/.test(self.dragStartObject.context) && self.currentCell && !self.currentCell.isColumnHeader && !move && !freeze && !resize) {
|
|
4534
|
-
self.
|
|
5182
|
+
if (!(self.dragMode == 'row-reorder' && self.isMultiRowsSelected) && !(self.currentCell.hovered && self.hovers.onFilterButton)) {
|
|
5183
|
+
self.selections = [];
|
|
5184
|
+
}
|
|
4535
5185
|
}
|
|
4536
5186
|
|
|
4537
5187
|
if (self.dragStartObject.isGrid) {
|
|
@@ -4622,9 +5272,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4622
5272
|
if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {
|
|
4623
5273
|
self.draggingItem = self.dragStartObject;
|
|
4624
5274
|
|
|
4625
|
-
if (self.dragMode === 'column-reorder' && self.
|
|
5275
|
+
if (self.dragMode === 'column-reorder' && !self.isMultiColumnsSelected(self.currentCell.header.index)) {
|
|
4626
5276
|
self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
|
|
4627
|
-
|
|
5277
|
+
} else if (self.dragMode === 'row-reorder' && !self.isMultiRowsSelected) {
|
|
5278
|
+
self.selectRow(self.dragStartObject.rowIndex, ctrl, null);
|
|
4628
5279
|
}
|
|
4629
5280
|
|
|
4630
5281
|
document.body.addEventListener('mousemove', self.dragReorder, false);
|
|
@@ -4635,16 +5286,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4635
5286
|
|
|
4636
5287
|
self.mouseup = function (e) {
|
|
4637
5288
|
clearTimeout(self.scrollTimer);
|
|
4638
|
-
var ctrl = e.ctrlKey || e.metaKey;
|
|
4639
5289
|
self.cellBoundaryCrossed = true;
|
|
4640
5290
|
self.rowBoundaryCrossed = true;
|
|
4641
5291
|
self.columnBoundaryCrossed = true;
|
|
4642
|
-
|
|
4643
|
-
if (self.draggingItem) {
|
|
4644
|
-
self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
|
|
4645
|
-
self.draw();
|
|
4646
|
-
}
|
|
4647
|
-
|
|
4648
5292
|
self.selecting = undefined;
|
|
4649
5293
|
self.draggingItem = undefined;
|
|
4650
5294
|
self.dragStartObject = undefined;
|
|
@@ -4942,7 +5586,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4942
5586
|
self.fitColumnToValues(self.currentCell.header.name);
|
|
4943
5587
|
} else if (self.currentCell.context === 'ew-resize' && self.currentCell.style === 'cornerCell') {
|
|
4944
5588
|
self.autosize();
|
|
4945
|
-
} else if (['cell', 'activeCell'].
|
|
5589
|
+
} else if (['cell', 'activeCell'].includes(self.currentCell.style) && !self.hovers.onFilterButton) {
|
|
4946
5590
|
self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);
|
|
4947
5591
|
}
|
|
4948
5592
|
};
|
|
@@ -5217,6 +5861,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5217
5861
|
isNeat = true; // Selected like [[0, 1], [0, 1]] of [[0, 3]] is neat; Selected like [[0, 1], [1, 2]] is untidy
|
|
5218
5862
|
|
|
5219
5863
|
function htmlSafe(v) {
|
|
5864
|
+
if (typeof v === 'number') return v;
|
|
5220
5865
|
return v.replace(/</g, '<').replace(/>/g, '>');
|
|
5221
5866
|
}
|
|
5222
5867
|
|
|
@@ -5232,8 +5877,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5232
5877
|
if (!firstRowKeys) firstRowKeys = Object.keys(row);
|
|
5233
5878
|
if (isNeat && rowKeys.length !== firstRowKeys.length) isNeat = false;
|
|
5234
5879
|
sSorted.forEach(function (column, columnIndex) {
|
|
5235
|
-
if (rowKeys.indexOf(column.name) < 0) {
|
|
5236
|
-
if (firstRowKeys.indexOf(column.name) < 0) {
|
|
5880
|
+
if (rowKeys.indexOf(String(column.name)) < 0) {
|
|
5881
|
+
if (firstRowKeys.indexOf(String(column.name)) < 0) {
|
|
5237
5882
|
return;
|
|
5238
5883
|
} else if (isNeat) {
|
|
5239
5884
|
isNeat = false;
|
|
@@ -5528,6 +6173,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5528
6173
|
trees: {}
|
|
5529
6174
|
};
|
|
5530
6175
|
self.selections = [];
|
|
6176
|
+
self.filterable = {
|
|
6177
|
+
rows: [],
|
|
6178
|
+
columns: []
|
|
6179
|
+
};
|
|
6180
|
+
self.selectedFilterButton = {
|
|
6181
|
+
columnIndex: -1,
|
|
6182
|
+
rowIndex: -1
|
|
6183
|
+
};
|
|
5531
6184
|
self.hovers = {};
|
|
5532
6185
|
self.attributes = {};
|
|
5533
6186
|
self.style = {};
|
|
@@ -5545,7 +6198,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5545
6198
|
self.openChildren = {};
|
|
5546
6199
|
self.scrollModes = ['vertical-scroll-box', 'vertical-scroll-top', 'vertical-scroll-bottom', 'horizontal-scroll-box', 'horizontal-scroll-right', 'horizontal-scroll-left'];
|
|
5547
6200
|
self.componentL1Events = {};
|
|
5548
|
-
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'];
|
|
6201
|
+
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'];
|
|
5549
6202
|
self.mouse = {
|
|
5550
6203
|
x: 0,
|
|
5551
6204
|
y: 0
|
|
@@ -6224,6 +6877,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6224
6877
|
self.intf.clearChangeLog = self.clearChangeLog;
|
|
6225
6878
|
self.intf.gotoCell = self.gotoCell;
|
|
6226
6879
|
self.intf.gotoRow = self.gotoRow;
|
|
6880
|
+
self.intf.addButton = self.addButton;
|
|
6227
6881
|
self.intf.getHeaderByName = self.getHeaderByName;
|
|
6228
6882
|
self.intf.findColumnScrollLeft = self.findColumnScrollLeft;
|
|
6229
6883
|
self.intf.findRowScrollTop = self.findRowScrollTop;
|
|
@@ -7032,6 +7686,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7032
7686
|
if (!preventScrollEvent) {
|
|
7033
7687
|
self.scroll();
|
|
7034
7688
|
}
|
|
7689
|
+
|
|
7690
|
+
if (self.button) {
|
|
7691
|
+
self.moveButtonPos();
|
|
7692
|
+
}
|
|
7035
7693
|
}
|
|
7036
7694
|
|
|
7037
7695
|
function setScrollLeft(value, preventScrollEvent) {
|
|
@@ -7056,6 +7714,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7056
7714
|
if (!preventScrollEvent) {
|
|
7057
7715
|
self.scroll();
|
|
7058
7716
|
}
|
|
7717
|
+
|
|
7718
|
+
if (self.button) {
|
|
7719
|
+
self.moveButtonPos();
|
|
7720
|
+
}
|
|
7059
7721
|
}
|
|
7060
7722
|
|
|
7061
7723
|
self.scrollBox.toString = function () {
|
|
@@ -7164,8 +7826,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7164
7826
|
/* harmony import */ var _touch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./touch */ "./lib/touch.js");
|
|
7165
7827
|
/* harmony import */ var _intf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intf */ "./lib/intf.js");
|
|
7166
7828
|
/* harmony import */ var _contextMenu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./contextMenu */ "./lib/contextMenu.js");
|
|
7167
|
-
/* harmony import */ var
|
|
7168
|
-
/* harmony import */ var
|
|
7829
|
+
/* harmony import */ var _button__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./button */ "./lib/button.js");
|
|
7830
|
+
/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dom */ "./lib/dom.js");
|
|
7831
|
+
/* harmony import */ var _publicMethods__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./publicMethods */ "./lib/publicMethods.js");
|
|
7169
7832
|
/*jslint browser: true, unparam: true, todo: true, evil: true*/
|
|
7170
7833
|
|
|
7171
7834
|
/*globals Reflect: false, HTMLElement: true, define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/
|
|
@@ -7182,8 +7845,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
7182
7845
|
|
|
7183
7846
|
|
|
7184
7847
|
|
|
7848
|
+
|
|
7185
7849
|
var webComponent = (0,_component__WEBPACK_IMPORTED_MODULE_0__.default)();
|
|
7186
|
-
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,
|
|
7850
|
+
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];
|
|
7187
7851
|
|
|
7188
7852
|
function Grid(args) {
|
|
7189
7853
|
args = args || {};
|
|
@@ -7551,6 +8215,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7551
8215
|
delete self.columnFilters[column];
|
|
7552
8216
|
} else {
|
|
7553
8217
|
self.columnFilters[column] = value;
|
|
8218
|
+
|
|
8219
|
+
if (self.attributes.showFilterInCell) {
|
|
8220
|
+
self.filterable.rows.push(0);
|
|
8221
|
+
self.orders.columns.forEach(function (value, index) {
|
|
8222
|
+
self.filterable.columns.push(index);
|
|
8223
|
+
});
|
|
8224
|
+
}
|
|
8225
|
+
}
|
|
8226
|
+
|
|
8227
|
+
if (!Object.keys(self.columnFilters).length) {
|
|
8228
|
+
self.filterable = {
|
|
8229
|
+
rows: [],
|
|
8230
|
+
columns: []
|
|
8231
|
+
};
|
|
7554
8232
|
}
|
|
7555
8233
|
|
|
7556
8234
|
self.refresh();
|
|
@@ -7644,6 +8322,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7644
8322
|
self.gotoRow = function (y) {
|
|
7645
8323
|
self.gotoCell(0, y);
|
|
7646
8324
|
};
|
|
8325
|
+
/**
|
|
8326
|
+
* Add a button into the cell.
|
|
8327
|
+
* @memberof canvasDatagrid
|
|
8328
|
+
* @name addButton
|
|
8329
|
+
* @method
|
|
8330
|
+
* @param {number} columnIndex The column index of the cell to to add a button.
|
|
8331
|
+
* @param {number} rowIndex The row index of the cell to to add a button.
|
|
8332
|
+
* @param {object} offset Offset how far go away from cell.
|
|
8333
|
+
* @param {object} items a list of items to add into button menu.
|
|
8334
|
+
* @param {string} imgSrc icon path to add into button.
|
|
8335
|
+
*/
|
|
8336
|
+
|
|
8337
|
+
|
|
8338
|
+
self.addButton = function (columnIndex, rowIndex, offset, items, imgSrc) {
|
|
8339
|
+
var cells = self.visibleCells.filter(function (c) {
|
|
8340
|
+
return c.sortColumnIndex === columnIndex && c.sortRowIndex === rowIndex;
|
|
8341
|
+
});
|
|
8342
|
+
self.attachButton({
|
|
8343
|
+
top: cells[0].y + cells[0].height + offset.y,
|
|
8344
|
+
left: cells[0].x + cells[0].width + offset.x
|
|
8345
|
+
}, items, imgSrc);
|
|
8346
|
+
};
|
|
7647
8347
|
/**
|
|
7648
8348
|
* Scrolls the cell at cell x, row y into view if it is not already.
|
|
7649
8349
|
* @memberof canvasDatagrid
|
|
@@ -7734,6 +8434,35 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7734
8434
|
|
|
7735
8435
|
self.draw();
|
|
7736
8436
|
};
|
|
8437
|
+
/**
|
|
8438
|
+
* Returns true if indices of columns next to the selected columnIndex is selected on every row.
|
|
8439
|
+
* @memberof canvasDatagrid
|
|
8440
|
+
* @name isMultiColumnsSelected
|
|
8441
|
+
* @method
|
|
8442
|
+
* @param {number} columnIndex The column index to check.
|
|
8443
|
+
*/
|
|
8444
|
+
|
|
8445
|
+
|
|
8446
|
+
self.isMultiColumnsSelected = function (columnIndex) {
|
|
8447
|
+
var multiColIsSelected = true;
|
|
8448
|
+
self.viewData.forEach(function (row, rowIndex) {
|
|
8449
|
+
var columnIndices = self.selections[rowIndex];
|
|
8450
|
+
|
|
8451
|
+
if (!columnIndices || columnIndices.length <= 1 || columnIndices.indexOf(columnIndex) === -1) {
|
|
8452
|
+
multiColIsSelected = false;
|
|
8453
|
+
} else if (columnIndices.length > 1) {
|
|
8454
|
+
if (columnIndices[0] != columnIndex) multiColIsSelected = false;else {
|
|
8455
|
+
for (var i = 0; i < columnIndices.length - 1; i++) {
|
|
8456
|
+
if (columnIndices[i] + 1 != columnIndices[i + 1]) {
|
|
8457
|
+
multiColIsSelected = false;
|
|
8458
|
+
break;
|
|
8459
|
+
}
|
|
8460
|
+
}
|
|
8461
|
+
}
|
|
8462
|
+
}
|
|
8463
|
+
});
|
|
8464
|
+
return multiColIsSelected;
|
|
8465
|
+
};
|
|
7737
8466
|
/**
|
|
7738
8467
|
* Returns true if the selected columnIndex is selected on every row.
|
|
7739
8468
|
* @memberof canvasDatagrid
|
|
@@ -7746,7 +8475,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7746
8475
|
self.isColumnSelected = function (columnIndex) {
|
|
7747
8476
|
var colIsSelected = true;
|
|
7748
8477
|
self.viewData.forEach(function (row, rowIndex) {
|
|
7749
|
-
if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(
|
|
8478
|
+
if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(columnIndex) === -1) {
|
|
7750
8479
|
colIsSelected = false;
|
|
7751
8480
|
}
|
|
7752
8481
|
});
|
|
@@ -7874,6 +8603,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7874
8603
|
st,
|
|
7875
8604
|
en,
|
|
7876
8605
|
s = self.getVisibleSchema();
|
|
8606
|
+
self.isMultiRowsSelected = false;
|
|
7877
8607
|
|
|
7878
8608
|
function de() {
|
|
7879
8609
|
if (supressEvent) {
|