canvas-datagrid 0.3.19 → 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 +6 -0
- package/dist/canvas-datagrid.debug.js +661 -35
- 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 +9 -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 +68 -0
- package/lib/events/index.js +79 -27
- package/lib/intf.js +17 -0
- package/lib/main.js +2 -0
- package/lib/publicMethods.js +37 -0
- 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;
|
|
@@ -2520,9 +3008,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2520
3008
|
isCorner = /cornerCell/.test(cellStyle),
|
|
2521
3009
|
isRowHeader = 'rowHeaderCell' === cellStyle,
|
|
2522
3010
|
isColumnHeader = 'columnHeaderCell' === cellStyle,
|
|
3011
|
+
isFilterable = self.filterable.rows.includes(rowIndex) && self.filterable.columns.includes(headerIndex),
|
|
2523
3012
|
wrap = self.style.cellWhiteSpace !== 'nowrap',
|
|
2524
3013
|
selected = self.selections[rowOrderIndex] && self.selections[rowOrderIndex].indexOf(columnOrderIndex) !== -1,
|
|
2525
3014
|
hovered = self.hovers.rowIndex === rowOrderIndex && (self.attributes.hoverMode === 'row' || self.hovers.columnIndex === columnOrderIndex),
|
|
3015
|
+
openedFilter = self.selectedFilterButton.rowIndex == rowIndex && self.selectedFilterButton.columnIndex == headerIndex,
|
|
2526
3016
|
active = self.activeCell.rowIndex === rowOrderIndex && self.activeCell.columnIndex === columnOrderIndex,
|
|
2527
3017
|
isColumnHeaderCellCap = cellStyle === 'columnHeaderCellCap',
|
|
2528
3018
|
rawValue = rowData ? rowData[header.name] : undefined,
|
|
@@ -2610,6 +3100,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2610
3100
|
isColumnHeader: isColumnHeader,
|
|
2611
3101
|
isColumnHeaderCellCap: isColumnHeaderCellCap,
|
|
2612
3102
|
isRowHeader: isRowHeader,
|
|
3103
|
+
isFilterable: isFilterable,
|
|
3104
|
+
openedFilter: openedFilter,
|
|
2613
3105
|
rowOpen: rowOpen,
|
|
2614
3106
|
header: header,
|
|
2615
3107
|
columnIndex: columnOrderIndex,
|
|
@@ -2800,12 +3292,17 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2800
3292
|
createBorderOverlayArray(cell, moveBorders, 'move', self.moveOffset);
|
|
2801
3293
|
}
|
|
2802
3294
|
|
|
2803
|
-
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
|
|
2804
3300
|
// when we are filtering. We draw attention to this by drawing a thick
|
|
2805
3301
|
// border overlapping the two consecutive row headers. If sorting, visible
|
|
2806
3302
|
// row numbers stay the same (i.e. they don't correspond to the underlying
|
|
2807
3303
|
// data's row number), so we do not show row gaps in that case.
|
|
2808
3304
|
|
|
3305
|
+
|
|
2809
3306
|
var isSorting = self.orderings.columns && self.orderings.columns.length > 0;
|
|
2810
3307
|
|
|
2811
3308
|
if (isRowHeader && self.attributes.showRowNumbers && self.attributes.showRowNumberGaps && isSorting === false) {
|
|
@@ -2827,6 +3324,33 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
2827
3324
|
};
|
|
2828
3325
|
}
|
|
2829
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
|
+
|
|
2830
3354
|
function drawRowHeader(rowData, rowIndex, rowOrderIndex) {
|
|
2831
3355
|
if (self.attributes.showRowHeaders) {
|
|
2832
3356
|
x = 0; // When filtering we'd like to display the actual row numbers,
|
|
@@ -4017,8 +4541,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4017
4541
|
self.cursor = 'default';
|
|
4018
4542
|
self.hovers = {
|
|
4019
4543
|
rowIndex: cell.rowIndex,
|
|
4020
|
-
columnIndex: cell.columnIndex
|
|
4544
|
+
columnIndex: cell.columnIndex,
|
|
4545
|
+
onFilterButton: false
|
|
4021
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
|
+
}
|
|
4022
4552
|
}
|
|
4023
4553
|
|
|
4024
4554
|
if (self.selecting || self.reorderObject) {
|
|
@@ -4057,36 +4587,73 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4057
4587
|
if ((self.attributes.selectionMode === 'row' || self.dragStartObject.columnIndex === -1) && self.rowBoundaryCrossed) {
|
|
4058
4588
|
self.selectRow(cell.rowIndex, ctrl, null, true);
|
|
4059
4589
|
} else if (self.attributes.selectionMode !== 'row') {
|
|
4060
|
-
if (
|
|
4061
|
-
if (
|
|
4062
|
-
|
|
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
|
+
});
|
|
4063
4608
|
}
|
|
4609
|
+
|
|
4610
|
+
self.draw();
|
|
4611
|
+
return;
|
|
4064
4612
|
} else {
|
|
4065
|
-
self.
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
}
|
|
4075
|
-
|
|
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
|
+
}
|
|
4076
4636
|
}
|
|
4077
4637
|
}
|
|
4078
4638
|
}
|
|
4079
4639
|
}
|
|
4080
4640
|
|
|
4081
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) {
|
|
4082
|
-
self.
|
|
4642
|
+
if (!(cell.hovered && self.hovers.onFilterButton)) {
|
|
4643
|
+
self.selections = [];
|
|
4644
|
+
}
|
|
4645
|
+
|
|
4646
|
+
if (dragBounds.top === -1) {
|
|
4647
|
+
dragBounds.top = 0;
|
|
4648
|
+
}
|
|
4649
|
+
|
|
4083
4650
|
sBounds = dragBounds;
|
|
4084
4651
|
|
|
4085
4652
|
if (self.attributes.selectionMode === 'row') {
|
|
4086
4653
|
for (i = sBounds.top; i <= sBounds.bottom; i += 1) {
|
|
4087
4654
|
self.selectRow(i, true, null, true);
|
|
4088
4655
|
}
|
|
4089
|
-
} else
|
|
4656
|
+
} else {
|
|
4090
4657
|
self.selectArea(sBounds, true);
|
|
4091
4658
|
if (sBounds.left == -1 && sBounds.top !== sBounds.bottom) self.isMultiRowsSelected = true;
|
|
4092
4659
|
}
|
|
@@ -4163,7 +4730,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4163
4730
|
}
|
|
4164
4731
|
|
|
4165
4732
|
if (['rowHeaderCell', 'columnHeaderCell'].indexOf(self.currentCell.style) === -1 && !ctrl) {
|
|
4166
|
-
self.
|
|
4733
|
+
if (!self.hovers.onFilterButton) {
|
|
4734
|
+
self.setActiveCell(i.columnIndex, i.rowIndex);
|
|
4735
|
+
}
|
|
4167
4736
|
}
|
|
4168
4737
|
|
|
4169
4738
|
if (self.currentCell.context === 'cell') {
|
|
@@ -4610,7 +5179,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
4610
5179
|
self.dragAddToSelection = !self.dragStartObject.selected;
|
|
4611
5180
|
|
|
4612
5181
|
if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/.test(self.dragStartObject.context) && self.currentCell && !self.currentCell.isColumnHeader && !move && !freeze && !resize) {
|
|
4613
|
-
if (!(self.dragMode == 'row-reorder' && self.isMultiRowsSelected)
|
|
5182
|
+
if (!(self.dragMode == 'row-reorder' && self.isMultiRowsSelected) && !(self.currentCell.hovered && self.hovers.onFilterButton)) {
|
|
5183
|
+
self.selections = [];
|
|
5184
|
+
}
|
|
4614
5185
|
}
|
|
4615
5186
|
|
|
4616
5187
|
if (self.dragStartObject.isGrid) {
|
|
@@ -5015,7 +5586,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5015
5586
|
self.fitColumnToValues(self.currentCell.header.name);
|
|
5016
5587
|
} else if (self.currentCell.context === 'ew-resize' && self.currentCell.style === 'cornerCell') {
|
|
5017
5588
|
self.autosize();
|
|
5018
|
-
} else if (['cell', 'activeCell'].
|
|
5589
|
+
} else if (['cell', 'activeCell'].includes(self.currentCell.style) && !self.hovers.onFilterButton) {
|
|
5019
5590
|
self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);
|
|
5020
5591
|
}
|
|
5021
5592
|
};
|
|
@@ -5602,6 +6173,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5602
6173
|
trees: {}
|
|
5603
6174
|
};
|
|
5604
6175
|
self.selections = [];
|
|
6176
|
+
self.filterable = {
|
|
6177
|
+
rows: [],
|
|
6178
|
+
columns: []
|
|
6179
|
+
};
|
|
6180
|
+
self.selectedFilterButton = {
|
|
6181
|
+
columnIndex: -1,
|
|
6182
|
+
rowIndex: -1
|
|
6183
|
+
};
|
|
5605
6184
|
self.hovers = {};
|
|
5606
6185
|
self.attributes = {};
|
|
5607
6186
|
self.style = {};
|
|
@@ -5619,7 +6198,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5619
6198
|
self.openChildren = {};
|
|
5620
6199
|
self.scrollModes = ['vertical-scroll-box', 'vertical-scroll-top', 'vertical-scroll-bottom', 'horizontal-scroll-box', 'horizontal-scroll-right', 'horizontal-scroll-left'];
|
|
5621
6200
|
self.componentL1Events = {};
|
|
5622
|
-
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'];
|
|
5623
6202
|
self.mouse = {
|
|
5624
6203
|
x: 0,
|
|
5625
6204
|
y: 0
|
|
@@ -6298,6 +6877,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
6298
6877
|
self.intf.clearChangeLog = self.clearChangeLog;
|
|
6299
6878
|
self.intf.gotoCell = self.gotoCell;
|
|
6300
6879
|
self.intf.gotoRow = self.gotoRow;
|
|
6880
|
+
self.intf.addButton = self.addButton;
|
|
6301
6881
|
self.intf.getHeaderByName = self.getHeaderByName;
|
|
6302
6882
|
self.intf.findColumnScrollLeft = self.findColumnScrollLeft;
|
|
6303
6883
|
self.intf.findRowScrollTop = self.findRowScrollTop;
|
|
@@ -7106,6 +7686,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7106
7686
|
if (!preventScrollEvent) {
|
|
7107
7687
|
self.scroll();
|
|
7108
7688
|
}
|
|
7689
|
+
|
|
7690
|
+
if (self.button) {
|
|
7691
|
+
self.moveButtonPos();
|
|
7692
|
+
}
|
|
7109
7693
|
}
|
|
7110
7694
|
|
|
7111
7695
|
function setScrollLeft(value, preventScrollEvent) {
|
|
@@ -7130,6 +7714,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7130
7714
|
if (!preventScrollEvent) {
|
|
7131
7715
|
self.scroll();
|
|
7132
7716
|
}
|
|
7717
|
+
|
|
7718
|
+
if (self.button) {
|
|
7719
|
+
self.moveButtonPos();
|
|
7720
|
+
}
|
|
7133
7721
|
}
|
|
7134
7722
|
|
|
7135
7723
|
self.scrollBox.toString = function () {
|
|
@@ -7238,8 +7826,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7238
7826
|
/* harmony import */ var _touch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./touch */ "./lib/touch.js");
|
|
7239
7827
|
/* harmony import */ var _intf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intf */ "./lib/intf.js");
|
|
7240
7828
|
/* harmony import */ var _contextMenu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./contextMenu */ "./lib/contextMenu.js");
|
|
7241
|
-
/* harmony import */ var
|
|
7242
|
-
/* 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");
|
|
7243
7832
|
/*jslint browser: true, unparam: true, todo: true, evil: true*/
|
|
7244
7833
|
|
|
7245
7834
|
/*globals Reflect: false, HTMLElement: true, define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/
|
|
@@ -7256,8 +7845,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
7256
7845
|
|
|
7257
7846
|
|
|
7258
7847
|
|
|
7848
|
+
|
|
7259
7849
|
var webComponent = (0,_component__WEBPACK_IMPORTED_MODULE_0__.default)();
|
|
7260
|
-
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];
|
|
7261
7851
|
|
|
7262
7852
|
function Grid(args) {
|
|
7263
7853
|
args = args || {};
|
|
@@ -7625,6 +8215,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7625
8215
|
delete self.columnFilters[column];
|
|
7626
8216
|
} else {
|
|
7627
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
|
+
};
|
|
7628
8232
|
}
|
|
7629
8233
|
|
|
7630
8234
|
self.refresh();
|
|
@@ -7718,6 +8322,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7718
8322
|
self.gotoRow = function (y) {
|
|
7719
8323
|
self.gotoCell(0, y);
|
|
7720
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
|
+
};
|
|
7721
8347
|
/**
|
|
7722
8348
|
* Scrolls the cell at cell x, row y into view if it is not already.
|
|
7723
8349
|
* @memberof canvasDatagrid
|