jsl-ui 9.28.3 → 9.28.4
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/lib/components/IntervalComponent.d.ts +17 -17
- package/lib/components/IntervalComponent.js +65 -65
- package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +22 -22
- package/lib/components/auto-suggest/AutoSuggestComponent.js +47 -47
- package/lib/components/button/ButtonComponent.d.ts +18 -18
- package/lib/components/button/ButtonComponent.js +29 -29
- package/lib/components/checkbox/CheckBoxComponent.d.ts +28 -28
- package/lib/components/checkbox/CheckBoxComponent.js +81 -81
- package/lib/components/date/DateComponent.d.ts +32 -32
- package/lib/components/date/DateComponent.js +89 -89
- package/lib/components/date-range/DateRangeComponent.d.ts +35 -35
- package/lib/components/date-range/DateRangeComponent.js +121 -123
- package/lib/components/date-time/DateTimeComponent.d.ts +15 -15
- package/lib/components/date-time/DateTimeComponent.js +39 -39
- package/lib/components/dialog/DialogComponent.d.ts +67 -67
- package/lib/components/dialog/DialogComponent.js +192 -198
- package/lib/components/drop-down/DropDownComponent.d.ts +27 -27
- package/lib/components/drop-down/DropDownComponent.js +60 -60
- package/lib/components/expander/ExpanderComponent.d.ts +27 -27
- package/lib/components/expander/ExpanderComponent.js +87 -89
- package/lib/components/form-field/FormComponent.d.ts +12 -12
- package/lib/components/form-field/FormComponent.js +23 -23
- package/lib/components/form-field/FormFieldComponent.d.ts +39 -39
- package/lib/components/form-field/FormFieldComponent.js +138 -138
- package/lib/components/grid/GridComponent.d.ts +26 -26
- package/lib/components/grid/GridComponent.js +110 -110
- package/lib/components/input/InputComponent.d.ts +33 -33
- package/lib/components/input/InputComponent.js +126 -126
- package/lib/components/loading/LoadingComponent.d.ts +8 -8
- package/lib/components/loading/LoadingComponent.js +20 -20
- package/lib/components/navigation/NavigationComponent.d.ts +34 -34
- package/lib/components/navigation/NavigationComponent.js +47 -45
- package/lib/components/notification/Notification.d.ts +19 -19
- package/lib/components/notification/Notification.js +65 -65
- package/lib/components/number/NumberComponent.d.ts +26 -26
- package/lib/components/number/NumberComponent.js +80 -80
- package/lib/components/overlay/OverlayComponent.d.ts +27 -27
- package/lib/components/overlay/OverlayComponent.js +134 -137
- package/lib/components/progress/ProgressComponent.d.ts +18 -18
- package/lib/components/progress/ProgressComponent.js +40 -40
- package/lib/components/ribbon-menu/RibbonMenuComponent.d.ts +12 -12
- package/lib/components/ribbon-menu/RibbonMenuComponent.js +23 -23
- package/lib/components/select/SelectComponent.d.ts +79 -79
- package/lib/components/select/SelectComponent.js +352 -356
- package/lib/components/select/SelectDDAreaComponent.d.ts +32 -32
- package/lib/components/select/SelectDDAreaComponent.js +303 -303
- package/lib/components/slider/nouislider.d.ts +44 -44
- package/lib/components/slider/nouislider.js +2158 -2158
- package/lib/components/stack-panel/SplitterComponent.d.ts +21 -21
- package/lib/components/stack-panel/SplitterComponent.js +124 -124
- package/lib/components/stack-panel/StackPanelComponent.d.ts +20 -20
- package/lib/components/stack-panel/StackPanelComponent.js +50 -50
- package/lib/components/tabs/TabsComponent.d.ts +40 -40
- package/lib/components/tabs/TabsComponent.js +191 -200
- package/lib/components/time/TimeComponent.d.ts +29 -29
- package/lib/components/time/TimeComponent.js +102 -104
- package/lib/components/tree-view/TreeViewComponent.d.ts +23 -23
- package/lib/components/tree-view/TreeViewComponent.js +42 -43
- package/lib/components/virtual-render/VirtualRenderComponent.d.ts +30 -30
- package/lib/components/virtual-render/VirtualRenderComponent.js +90 -92
- package/lib/core/culture.d.ts +5 -5
- package/lib/core/culture.js +385 -385
- package/lib/core/date.d.ts +14 -14
- package/lib/core/date.js +346 -346
- package/lib/core/helper.d.ts +13 -13
- package/lib/core/helper.js +100 -100
- package/lib/core/jq.d.ts +37 -37
- package/lib/core/jq.js +362 -362
- package/lib/core/lang.d.ts +24 -24
- package/lib/core/lang.js +24 -24
- package/lib/core/numeric.d.ts +7 -7
- package/lib/core/numeric.js +139 -139
- package/lib/core/polyfills.js +22 -22
- package/lib/core.d.ts +6 -6
- package/lib/core.js +6 -6
- package/lib/grid/filterDialogs/dateRangeFilter.d.ts +7 -7
- package/lib/grid/filterDialogs/dateRangeFilter.js +106 -106
- package/lib/grid/filterDialogs/excelFilter.d.ts +9 -9
- package/lib/grid/filterDialogs/excelFilter.js +250 -250
- package/lib/grid/plugins/ext.overlay.d.ts +2 -2
- package/lib/grid/plugins/ext.overlay.js +295 -295
- package/lib/grid/plugins/slick.cellrangedecorator.d.ts +12 -12
- package/lib/grid/plugins/slick.cellrangedecorator.js +68 -68
- package/lib/grid/plugins/slick.cellrangeselector.d.ts +1 -1
- package/lib/grid/plugins/slick.cellrangeselector.js +144 -144
- package/lib/grid/plugins/slick.cellselectionmodel.d.ts +1 -1
- package/lib/grid/plugins/slick.cellselectionmodel.js +194 -194
- package/lib/grid/plugins/slick.headerbuttons.d.ts +55 -55
- package/lib/grid/plugins/slick.headerbuttons.js +156 -156
- package/lib/grid/plugins/slick.headermenu.d.ts +74 -74
- package/lib/grid/plugins/slick.headermenu.js +260 -260
- package/lib/grid/plugins/slick.rowmovemanager.d.ts +18 -18
- package/lib/grid/plugins/slick.rowmovemanager.js +249 -249
- package/lib/grid/plugins/slick.rowselectionmodel.d.ts +1 -1
- package/lib/grid/plugins/slick.rowselectionmodel.js +167 -167
- package/lib/grid/slick.core.d.ts +91 -91
- package/lib/grid/slick.core.js +574 -574
- package/lib/grid/slick.creator.d.ts +81 -81
- package/lib/grid/slick.creator.js +726 -726
- package/lib/grid/slick.dataview.d.ts +71 -71
- package/lib/grid/slick.dataview.js +1069 -1069
- package/lib/grid/slick.editors.core.d.ts +4 -4
- package/lib/grid/slick.editors.core.js +235 -235
- package/lib/grid/slick.editors.date.d.ts +2 -2
- package/lib/grid/slick.editors.date.js +125 -125
- package/lib/grid/slick.editors.lookup.d.ts +14 -14
- package/lib/grid/slick.editors.lookup.js +352 -352
- package/lib/grid/slick.editors.nav.d.ts +6 -6
- package/lib/grid/slick.editors.nav.js +22 -22
- package/lib/grid/slick.formatters.d.ts +17 -17
- package/lib/grid/slick.formatters.js +144 -144
- package/lib/grid/slick.grid.d.ts +285 -285
- package/lib/grid/slick.grid.js +5409 -5409
- package/lib/grid/slick.groupitemmetadataprovider.d.ts +39 -39
- package/lib/grid/slick.groupitemmetadataprovider.js +165 -165
- package/lib/grid/slick.tree.d.ts +33 -33
- package/lib/grid/slick.tree.js +208 -208
- package/lib/grid.css +705 -1
- package/lib/grid.d.ts +13 -13
- package/lib/grid.js +13 -13
- package/lib/index.css +2195 -8
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +55 -56
- package/lib/index.js +61 -61
- package/lib/index.js.map +1 -1
- package/lib/interaction/dataconverter.d.ts +4 -4
- package/lib/interaction/dataconverter.js +1 -0
- package/lib/interaction/eventhandler.d.ts +13 -13
- package/lib/interaction/eventhandler.js +39 -39
- package/lib/interaction/moveable.d.ts +39 -39
- package/lib/interaction/moveable.js +160 -160
- package/lib/interaction/resizable.d.ts +37 -37
- package/lib/interaction/resizable.js +109 -109
- package/lib/ui/auto.suggest.d.ts +18 -18
- package/lib/ui/auto.suggest.js +244 -244
- package/lib/ui/date.picker/date-picker-options.d.ts +11 -11
- package/lib/ui/date.picker/date-picker-options.js +76 -76
- package/lib/ui/date.picker/lib/date-manip.d.ts +74 -74
- package/lib/ui/date.picker/lib/date-manip.js +120 -120
- package/lib/ui/date.picker/lib/dom.d.ts +23 -23
- package/lib/ui/date.picker/lib/dom.js +28 -28
- package/lib/ui/date.picker/lib/emitter.d.ts +13 -13
- package/lib/ui/date.picker/lib/emitter.js +49 -49
- package/lib/ui/date.picker/lib/fns.d.ts +23 -23
- package/lib/ui/date.picker/lib/fns.js +39 -39
- package/lib/ui/date.picker/mode/base-mode.d.ts +26 -26
- package/lib/ui/date.picker/mode/base-mode.js +248 -248
- package/lib/ui/date.picker/mode/dropdown-mode.d.ts +28 -28
- package/lib/ui/date.picker/mode/dropdown-mode.js +50 -50
- package/lib/ui/date.picker/mode/index.d.ts +28 -28
- package/lib/ui/date.picker/mode/index.js +18 -18
- package/lib/ui/date.picker/mode/modal-mode.d.ts +25 -25
- package/lib/ui/date.picker/mode/modal-mode.js +17 -17
- package/lib/ui/date.picker/mode/permanent-mode.d.ts +29 -29
- package/lib/ui/date.picker/mode/permanent-mode.js +19 -19
- package/lib/ui/date.picker/views/day-picker.d.ts +40 -40
- package/lib/ui/date.picker/views/day-picker.js +155 -155
- package/lib/ui/date.picker/views/month-picker.d.ts +26 -26
- package/lib/ui/date.picker/views/month-picker.js +65 -65
- package/lib/ui/date.picker/views/year-picker.d.ts +20 -20
- package/lib/ui/date.picker/views/year-picker.js +66 -66
- package/lib/ui/date.picker.d.ts +66 -66
- package/lib/ui/date.picker.js +32 -32
- package/lib/ui/dialog.d.ts +22 -22
- package/lib/ui/dialog.js +98 -98
- package/lib/ui/drop.down.d.ts +52 -52
- package/lib/ui/drop.down.js +2112 -2112
- package/lib/ui/number.input.d.ts +13 -13
- package/lib/ui/number.input.js +56 -56
- package/package.json +1 -1
|
@@ -1,295 +1,295 @@
|
|
|
1
|
-
import "./ext.overlay.css";
|
|
2
|
-
import { jQueryReplacement } from "../../core/jq";
|
|
3
|
-
import { Slick } from "../slick.core";
|
|
4
|
-
import { Moveable } from "../../interaction/moveable";
|
|
5
|
-
import { EventHandler } from "../../interaction/eventhandler";
|
|
6
|
-
const selectinOverlayWidth = 1;
|
|
7
|
-
let $ = jQueryReplacement;
|
|
8
|
-
// register namespace
|
|
9
|
-
$.deepExtend(window, {
|
|
10
|
-
"Ext": {
|
|
11
|
-
"Plugins": {
|
|
12
|
-
"Overlays": Overlays
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
export function Overlays(options) {
|
|
17
|
-
var $headerOverlay;
|
|
18
|
-
var $rowOverlay;
|
|
19
|
-
var selectionOverlay;
|
|
20
|
-
var currentColumn;
|
|
21
|
-
var handleDragging;
|
|
22
|
-
var grid;
|
|
23
|
-
var self = this;
|
|
24
|
-
var handler = new Slick.EventHandler();
|
|
25
|
-
var dragDecorator;
|
|
26
|
-
var defaults = {
|
|
27
|
-
buttonCssClass: null,
|
|
28
|
-
buttonImage: "../images/down.gif",
|
|
29
|
-
decoratorWidth: 2
|
|
30
|
-
};
|
|
31
|
-
function init(g) {
|
|
32
|
-
options = $.deepExtend({}, defaults, options);
|
|
33
|
-
grid = g;
|
|
34
|
-
dragDecorator = overlayRangeDecorator(grid);
|
|
35
|
-
$headerOverlay = createRowHeaderOverlay(10);
|
|
36
|
-
$rowOverlay = createRowHeaderOverlay(10);
|
|
37
|
-
selectionOverlay = createSelectionOverlay();
|
|
38
|
-
handler.subscribe(grid.onActiveCellChanged, activeCellChanged)
|
|
39
|
-
.subscribe(grid.onColumnsResized, columnResized)
|
|
40
|
-
.subscribe(grid.onScroll, gridScrolled);
|
|
41
|
-
}
|
|
42
|
-
function destroy() {
|
|
43
|
-
handler.unsubscribeAll();
|
|
44
|
-
}
|
|
45
|
-
function createRowHeaderOverlay(zIndex) {
|
|
46
|
-
return $(document.createElement("div"))
|
|
47
|
-
.addClass("header-overlay")
|
|
48
|
-
.css("position", "absolute")
|
|
49
|
-
.css("z-index", zIndex)
|
|
50
|
-
.appendTo(grid.getContainerNode());
|
|
51
|
-
}
|
|
52
|
-
function createSelectionOverlay() {
|
|
53
|
-
var canvas = grid.getCanvasNode();
|
|
54
|
-
var overlay = new Overlay(canvas, true);
|
|
55
|
-
return overlay;
|
|
56
|
-
}
|
|
57
|
-
function activeCellChanged(e, args) {
|
|
58
|
-
dragDecorator.hide();
|
|
59
|
-
moveSelectionOverlay(e, args);
|
|
60
|
-
moveHeaderRowOverlays(e, args);
|
|
61
|
-
}
|
|
62
|
-
function columnResized(e, args) {
|
|
63
|
-
moveHeaderRowOverlays(e, args);
|
|
64
|
-
moveSelectionOverlay(e, args);
|
|
65
|
-
}
|
|
66
|
-
function gridScrolled(e, args) {
|
|
67
|
-
moveHeaderRowOverlays(e, args);
|
|
68
|
-
moveSelectionOverlay(e, args);
|
|
69
|
-
}
|
|
70
|
-
function moveHeaderRowOverlays(e, args) {
|
|
71
|
-
if (typeof args.cell != 'undefined') {
|
|
72
|
-
currentColumn = args.cell;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
if (!currentColumn) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (!grid.getActiveCell()) {
|
|
80
|
-
$rowOverlay.css("display", "none");
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
$rowOverlay.css("display", "");
|
|
84
|
-
var headerHeight = grid.getContainerNode().querySelector('.slick-header').getBoundingClientRect().height;
|
|
85
|
-
var cellPosition = grid.getActiveCellPosition();
|
|
86
|
-
var gridPosition = grid.getGridPosition();
|
|
87
|
-
$rowOverlay.css("display", cellPosition.visible ? "" : "none");
|
|
88
|
-
$headerOverlay.css("display", cellPosition.visible ? "" : "none");
|
|
89
|
-
var headerWidth = cellPosition.width;
|
|
90
|
-
$headerOverlay.css("left", (cellPosition.left - gridPosition.left) + "px").css("top", (headerHeight - 2) + "px").css("width", headerWidth + "px").css("height", "2px");
|
|
91
|
-
$rowOverlay.css("left", "0px").css("top", (cellPosition.top - gridPosition.top) + "px").css("width", "2px").css("height", cellPosition.height + "px");
|
|
92
|
-
}
|
|
93
|
-
function moveSelectionOverlay(e, args) {
|
|
94
|
-
var activeCell = grid.getActiveCell();
|
|
95
|
-
if (!activeCell) {
|
|
96
|
-
selectionOverlay.toggle(false);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
var column = grid.getColumns()[activeCell.cell];
|
|
100
|
-
selectionOverlay.toggle(true);
|
|
101
|
-
// Only show the handle if the cell is editable
|
|
102
|
-
selectionOverlay.handle.style.display = (column.editor != null && !column.readonly && grid.getOptions().editable) ? "" : "none";
|
|
103
|
-
var position = grid.getCellNodeBox(activeCell.row, activeCell.cell);
|
|
104
|
-
// Not coming through on the property so re-calculated
|
|
105
|
-
position.height = position.bottom - position.top;
|
|
106
|
-
position.width = position.right - position.left;
|
|
107
|
-
selectionOverlay.$left.css({
|
|
108
|
-
left: (position.left - selectinOverlayWidth) + "px",
|
|
109
|
-
top: position.top + "px",
|
|
110
|
-
width: selectinOverlayWidth + "px",
|
|
111
|
-
height: position.height + "px"
|
|
112
|
-
});
|
|
113
|
-
selectionOverlay.$right.css({
|
|
114
|
-
left: (position.left + position.width) + "px",
|
|
115
|
-
top: position.top + "px",
|
|
116
|
-
width: selectinOverlayWidth + "px",
|
|
117
|
-
height: position.height + "px"
|
|
118
|
-
});
|
|
119
|
-
selectionOverlay.$top.css({
|
|
120
|
-
left: (position.left - selectinOverlayWidth) + "px",
|
|
121
|
-
top: (position.top - selectinOverlayWidth) + "px",
|
|
122
|
-
width: (position.width + selectinOverlayWidth + 1) + "px",
|
|
123
|
-
height: selectinOverlayWidth + "px"
|
|
124
|
-
});
|
|
125
|
-
selectionOverlay.$bottom.css({
|
|
126
|
-
left: (position.left - selectinOverlayWidth) + "px",
|
|
127
|
-
top: (position.top + position.height) + "px",
|
|
128
|
-
width: (position.width + selectinOverlayWidth + 1) + "px",
|
|
129
|
-
height: selectinOverlayWidth + "px"
|
|
130
|
-
});
|
|
131
|
-
selectionOverlay.handle.style.left = (position.left + position.width - 4) + "px";
|
|
132
|
-
selectionOverlay.handle.style.top = (position.top + position.height - 4) + "px";
|
|
133
|
-
// console.log("row: " + activeCell.row + " - cell: "+ activeCell.cell);
|
|
134
|
-
// console.log("container: " + grid.getCanvasNode(activeCell.row, activeCell.cell).className);
|
|
135
|
-
selectionOverlay.moveToContainer(grid.getCanvasNode(activeCell.cell, activeCell.row));
|
|
136
|
-
}
|
|
137
|
-
var dd_range;
|
|
138
|
-
function handleOverlayDragStart(e) {
|
|
139
|
-
var cell = grid.getActiveCell();
|
|
140
|
-
if (grid.canCellBeSelected(cell.row, cell.cell)) {
|
|
141
|
-
handleDragging = true;
|
|
142
|
-
}
|
|
143
|
-
const column = grid.getColumns()[cell.cell];
|
|
144
|
-
if (column.editor == null || column.readonly || !grid.getOptions().editable) {
|
|
145
|
-
handleDragging = false;
|
|
146
|
-
}
|
|
147
|
-
if (!handleDragging) {
|
|
148
|
-
e.cancelEvent();
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
grid.focus();
|
|
152
|
-
dd_range = { start: cell, end: {} };
|
|
153
|
-
return dragDecorator.show(new Slick.Range(cell.row, cell.cell));
|
|
154
|
-
}
|
|
155
|
-
function handleOverlayDrag(e) {
|
|
156
|
-
if (!handleDragging) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
var end = {
|
|
160
|
-
cell: dd_range.start.cell, row: grid.getCellFromPoint(0, e.y /* + grid.getCanvasNode().scrollTop*/).row - 1
|
|
161
|
-
};
|
|
162
|
-
if (!grid.canCellBeSelected(end.row, end.cell)) {
|
|
163
|
-
e.cancelEvent(); // ?
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
dd_range.end = end;
|
|
167
|
-
dragDecorator.show(new Slick.Range(dd_range.start.row, dd_range.start.cell, end.row, dd_range.start.cell));
|
|
168
|
-
}
|
|
169
|
-
function handleOverlayDragEnd(e) {
|
|
170
|
-
if (!handleDragging) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
handleDragging = false;
|
|
174
|
-
selectionOverlay.handle.style.display = "none";
|
|
175
|
-
self.onFillUpDown.notify({ "grid": grid, "range": dragDecorator.getSelectedRange(), direction: dd_range.end.row >= dd_range.start.row ? "down" : "up" }, e, self);
|
|
176
|
-
}
|
|
177
|
-
function Overlay(target, withHandel, prefix) {
|
|
178
|
-
var className = (prefix || '') + 'cell-overlay';
|
|
179
|
-
this.$left = $(document.createElement("div"))
|
|
180
|
-
.addClass(className)
|
|
181
|
-
.addClass('left')
|
|
182
|
-
.appendTo(target);
|
|
183
|
-
this.$right = $(document.createElement("div"))
|
|
184
|
-
.addClass(className)
|
|
185
|
-
.addClass('right')
|
|
186
|
-
.appendTo(target);
|
|
187
|
-
this.$top = $(document.createElement("div"))
|
|
188
|
-
.addClass(className)
|
|
189
|
-
.addClass('top')
|
|
190
|
-
.appendTo(target);
|
|
191
|
-
this.$bottom = $(document.createElement("div"))
|
|
192
|
-
.addClass(className)
|
|
193
|
-
.addClass('bottom')
|
|
194
|
-
.appendTo(target);
|
|
195
|
-
if (withHandel) {
|
|
196
|
-
this.handle = document.createElement("div");
|
|
197
|
-
this.handle.classList.add("handle-overlay");
|
|
198
|
-
target.appendChild(this.handle);
|
|
199
|
-
const gridContainer = target.closest(".slickgrid");
|
|
200
|
-
const viewports = gridContainer.querySelectorAll(".grid-canvas");
|
|
201
|
-
for (let idx = 0; idx < viewports.length; idx++) {
|
|
202
|
-
console.log(idx);
|
|
203
|
-
Moveable(viewports[idx], {
|
|
204
|
-
selector: ".handle-overlay",
|
|
205
|
-
direction: "y",
|
|
206
|
-
gridY: grid.getOptions().rowHeight,
|
|
207
|
-
containInParent: false,
|
|
208
|
-
onStart: EventHandler.Create((e) => {
|
|
209
|
-
handleOverlayDragStart(e);
|
|
210
|
-
}),
|
|
211
|
-
onMove: EventHandler.Create((e) => {
|
|
212
|
-
handleOverlayDrag(e);
|
|
213
|
-
}),
|
|
214
|
-
onStop: EventHandler.Create((e) => {
|
|
215
|
-
handleOverlayDragEnd(e);
|
|
216
|
-
})
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
this.moveToContainer = function (container) {
|
|
221
|
-
this.$left.appendTo(container);
|
|
222
|
-
this.$right.appendTo(container);
|
|
223
|
-
this.$top.appendTo(container);
|
|
224
|
-
this.$bottom.appendTo(container);
|
|
225
|
-
if (this.handle) {
|
|
226
|
-
$(this.handle).appendTo(container);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
this.toggle = function (showOrHide) {
|
|
230
|
-
this.$left.css("display", showOrHide ? "" : "none");
|
|
231
|
-
this.$right.css("display", showOrHide ? "" : "none");
|
|
232
|
-
this.$top.css("display", showOrHide ? "" : "none");
|
|
233
|
-
this.$bottom.css("display", showOrHide ? "" : "none");
|
|
234
|
-
if (this.handle) {
|
|
235
|
-
this.handle.style.display = showOrHide ? "" : "none";
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
function overlayRangeDecorator(targetGrid) {
|
|
240
|
-
var decorator;
|
|
241
|
-
var r;
|
|
242
|
-
function show(range) {
|
|
243
|
-
r = range;
|
|
244
|
-
if (!decorator) {
|
|
245
|
-
decorator = new Overlay(grid.getCanvasNode(range.fromCell, range.fromRow), false, 'selection-');
|
|
246
|
-
}
|
|
247
|
-
var from = targetGrid.getCellNodeBox(range.fromRow, range.fromCell);
|
|
248
|
-
var to = targetGrid.getCellNodeBox(range.toRow, range.toCell);
|
|
249
|
-
decorator.$left.css({
|
|
250
|
-
top: from.top - 2,
|
|
251
|
-
left: from.left - 2,
|
|
252
|
-
height: to.bottom - from.top + 2,
|
|
253
|
-
width: options.decoratorWidth
|
|
254
|
-
});
|
|
255
|
-
decorator.$right.css({
|
|
256
|
-
top: from.top - 2,
|
|
257
|
-
left: to.right - 1,
|
|
258
|
-
height: to.bottom - from.top + 2,
|
|
259
|
-
width: options.decoratorWidth
|
|
260
|
-
});
|
|
261
|
-
decorator.$top.css({
|
|
262
|
-
top: from.top - 2,
|
|
263
|
-
left: to.left - 1,
|
|
264
|
-
height: options.decoratorWidth,
|
|
265
|
-
width: to.right - from.left + 2
|
|
266
|
-
});
|
|
267
|
-
decorator.$bottom.css({
|
|
268
|
-
top: to.bottom - 1,
|
|
269
|
-
left: from.left - 2,
|
|
270
|
-
height: options.decoratorWidth,
|
|
271
|
-
width: to.right - from.left + 3
|
|
272
|
-
});
|
|
273
|
-
return decorator;
|
|
274
|
-
}
|
|
275
|
-
function getSelectedRange() {
|
|
276
|
-
return r;
|
|
277
|
-
}
|
|
278
|
-
function hide() {
|
|
279
|
-
if (decorator) {
|
|
280
|
-
decorator.toggle(false);
|
|
281
|
-
decorator = null;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return {
|
|
285
|
-
hide: hide,
|
|
286
|
-
show: show,
|
|
287
|
-
getSelectedRange: getSelectedRange
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
$.shallowExtend(this, {
|
|
291
|
-
"init": init,
|
|
292
|
-
"destroy": destroy,
|
|
293
|
-
"onFillUpDown": new Slick.Event()
|
|
294
|
-
});
|
|
295
|
-
}
|
|
1
|
+
import "./ext.overlay.css";
|
|
2
|
+
import { jQueryReplacement } from "../../core/jq";
|
|
3
|
+
import { Slick } from "../slick.core";
|
|
4
|
+
import { Moveable } from "../../interaction/moveable";
|
|
5
|
+
import { EventHandler } from "../../interaction/eventhandler";
|
|
6
|
+
const selectinOverlayWidth = 1;
|
|
7
|
+
let $ = jQueryReplacement;
|
|
8
|
+
// register namespace
|
|
9
|
+
$.deepExtend(window, {
|
|
10
|
+
"Ext": {
|
|
11
|
+
"Plugins": {
|
|
12
|
+
"Overlays": Overlays
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export function Overlays(options) {
|
|
17
|
+
var $headerOverlay;
|
|
18
|
+
var $rowOverlay;
|
|
19
|
+
var selectionOverlay;
|
|
20
|
+
var currentColumn;
|
|
21
|
+
var handleDragging;
|
|
22
|
+
var grid;
|
|
23
|
+
var self = this;
|
|
24
|
+
var handler = new Slick.EventHandler();
|
|
25
|
+
var dragDecorator;
|
|
26
|
+
var defaults = {
|
|
27
|
+
buttonCssClass: null,
|
|
28
|
+
buttonImage: "../images/down.gif",
|
|
29
|
+
decoratorWidth: 2
|
|
30
|
+
};
|
|
31
|
+
function init(g) {
|
|
32
|
+
options = $.deepExtend({}, defaults, options);
|
|
33
|
+
grid = g;
|
|
34
|
+
dragDecorator = overlayRangeDecorator(grid);
|
|
35
|
+
$headerOverlay = createRowHeaderOverlay(10);
|
|
36
|
+
$rowOverlay = createRowHeaderOverlay(10);
|
|
37
|
+
selectionOverlay = createSelectionOverlay();
|
|
38
|
+
handler.subscribe(grid.onActiveCellChanged, activeCellChanged)
|
|
39
|
+
.subscribe(grid.onColumnsResized, columnResized)
|
|
40
|
+
.subscribe(grid.onScroll, gridScrolled);
|
|
41
|
+
}
|
|
42
|
+
function destroy() {
|
|
43
|
+
handler.unsubscribeAll();
|
|
44
|
+
}
|
|
45
|
+
function createRowHeaderOverlay(zIndex) {
|
|
46
|
+
return $(document.createElement("div"))
|
|
47
|
+
.addClass("header-overlay")
|
|
48
|
+
.css("position", "absolute")
|
|
49
|
+
.css("z-index", zIndex)
|
|
50
|
+
.appendTo(grid.getContainerNode());
|
|
51
|
+
}
|
|
52
|
+
function createSelectionOverlay() {
|
|
53
|
+
var canvas = grid.getCanvasNode();
|
|
54
|
+
var overlay = new Overlay(canvas, true);
|
|
55
|
+
return overlay;
|
|
56
|
+
}
|
|
57
|
+
function activeCellChanged(e, args) {
|
|
58
|
+
dragDecorator.hide();
|
|
59
|
+
moveSelectionOverlay(e, args);
|
|
60
|
+
moveHeaderRowOverlays(e, args);
|
|
61
|
+
}
|
|
62
|
+
function columnResized(e, args) {
|
|
63
|
+
moveHeaderRowOverlays(e, args);
|
|
64
|
+
moveSelectionOverlay(e, args);
|
|
65
|
+
}
|
|
66
|
+
function gridScrolled(e, args) {
|
|
67
|
+
moveHeaderRowOverlays(e, args);
|
|
68
|
+
moveSelectionOverlay(e, args);
|
|
69
|
+
}
|
|
70
|
+
function moveHeaderRowOverlays(e, args) {
|
|
71
|
+
if (typeof args.cell != 'undefined') {
|
|
72
|
+
currentColumn = args.cell;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
if (!currentColumn) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!grid.getActiveCell()) {
|
|
80
|
+
$rowOverlay.css("display", "none");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
$rowOverlay.css("display", "");
|
|
84
|
+
var headerHeight = grid.getContainerNode().querySelector('.slick-header').getBoundingClientRect().height;
|
|
85
|
+
var cellPosition = grid.getActiveCellPosition();
|
|
86
|
+
var gridPosition = grid.getGridPosition();
|
|
87
|
+
$rowOverlay.css("display", cellPosition.visible ? "" : "none");
|
|
88
|
+
$headerOverlay.css("display", cellPosition.visible ? "" : "none");
|
|
89
|
+
var headerWidth = cellPosition.width;
|
|
90
|
+
$headerOverlay.css("left", (cellPosition.left - gridPosition.left) + "px").css("top", (headerHeight - 2) + "px").css("width", headerWidth + "px").css("height", "2px");
|
|
91
|
+
$rowOverlay.css("left", "0px").css("top", (cellPosition.top - gridPosition.top) + "px").css("width", "2px").css("height", cellPosition.height + "px");
|
|
92
|
+
}
|
|
93
|
+
function moveSelectionOverlay(e, args) {
|
|
94
|
+
var activeCell = grid.getActiveCell();
|
|
95
|
+
if (!activeCell) {
|
|
96
|
+
selectionOverlay.toggle(false);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
var column = grid.getColumns()[activeCell.cell];
|
|
100
|
+
selectionOverlay.toggle(true);
|
|
101
|
+
// Only show the handle if the cell is editable
|
|
102
|
+
selectionOverlay.handle.style.display = (column.editor != null && !column.readonly && grid.getOptions().editable) ? "" : "none";
|
|
103
|
+
var position = grid.getCellNodeBox(activeCell.row, activeCell.cell);
|
|
104
|
+
// Not coming through on the property so re-calculated
|
|
105
|
+
position.height = position.bottom - position.top;
|
|
106
|
+
position.width = position.right - position.left;
|
|
107
|
+
selectionOverlay.$left.css({
|
|
108
|
+
left: (position.left - selectinOverlayWidth) + "px",
|
|
109
|
+
top: position.top + "px",
|
|
110
|
+
width: selectinOverlayWidth + "px",
|
|
111
|
+
height: position.height + "px"
|
|
112
|
+
});
|
|
113
|
+
selectionOverlay.$right.css({
|
|
114
|
+
left: (position.left + position.width) + "px",
|
|
115
|
+
top: position.top + "px",
|
|
116
|
+
width: selectinOverlayWidth + "px",
|
|
117
|
+
height: position.height + "px"
|
|
118
|
+
});
|
|
119
|
+
selectionOverlay.$top.css({
|
|
120
|
+
left: (position.left - selectinOverlayWidth) + "px",
|
|
121
|
+
top: (position.top - selectinOverlayWidth) + "px",
|
|
122
|
+
width: (position.width + selectinOverlayWidth + 1) + "px",
|
|
123
|
+
height: selectinOverlayWidth + "px"
|
|
124
|
+
});
|
|
125
|
+
selectionOverlay.$bottom.css({
|
|
126
|
+
left: (position.left - selectinOverlayWidth) + "px",
|
|
127
|
+
top: (position.top + position.height) + "px",
|
|
128
|
+
width: (position.width + selectinOverlayWidth + 1) + "px",
|
|
129
|
+
height: selectinOverlayWidth + "px"
|
|
130
|
+
});
|
|
131
|
+
selectionOverlay.handle.style.left = (position.left + position.width - 4) + "px";
|
|
132
|
+
selectionOverlay.handle.style.top = (position.top + position.height - 4) + "px";
|
|
133
|
+
// console.log("row: " + activeCell.row + " - cell: "+ activeCell.cell);
|
|
134
|
+
// console.log("container: " + grid.getCanvasNode(activeCell.row, activeCell.cell).className);
|
|
135
|
+
selectionOverlay.moveToContainer(grid.getCanvasNode(activeCell.cell, activeCell.row));
|
|
136
|
+
}
|
|
137
|
+
var dd_range;
|
|
138
|
+
function handleOverlayDragStart(e) {
|
|
139
|
+
var cell = grid.getActiveCell();
|
|
140
|
+
if (grid.canCellBeSelected(cell.row, cell.cell)) {
|
|
141
|
+
handleDragging = true;
|
|
142
|
+
}
|
|
143
|
+
const column = grid.getColumns()[cell.cell];
|
|
144
|
+
if (column.editor == null || column.readonly || !grid.getOptions().editable) {
|
|
145
|
+
handleDragging = false;
|
|
146
|
+
}
|
|
147
|
+
if (!handleDragging) {
|
|
148
|
+
e.cancelEvent();
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
grid.focus();
|
|
152
|
+
dd_range = { start: cell, end: {} };
|
|
153
|
+
return dragDecorator.show(new Slick.Range(cell.row, cell.cell));
|
|
154
|
+
}
|
|
155
|
+
function handleOverlayDrag(e) {
|
|
156
|
+
if (!handleDragging) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
var end = {
|
|
160
|
+
cell: dd_range.start.cell, row: grid.getCellFromPoint(0, e.y /* + grid.getCanvasNode().scrollTop*/).row - 1
|
|
161
|
+
};
|
|
162
|
+
if (!grid.canCellBeSelected(end.row, end.cell)) {
|
|
163
|
+
e.cancelEvent(); // ?
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
dd_range.end = end;
|
|
167
|
+
dragDecorator.show(new Slick.Range(dd_range.start.row, dd_range.start.cell, end.row, dd_range.start.cell));
|
|
168
|
+
}
|
|
169
|
+
function handleOverlayDragEnd(e) {
|
|
170
|
+
if (!handleDragging) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
handleDragging = false;
|
|
174
|
+
selectionOverlay.handle.style.display = "none";
|
|
175
|
+
self.onFillUpDown.notify({ "grid": grid, "range": dragDecorator.getSelectedRange(), direction: dd_range.end.row >= dd_range.start.row ? "down" : "up" }, e, self);
|
|
176
|
+
}
|
|
177
|
+
function Overlay(target, withHandel, prefix) {
|
|
178
|
+
var className = (prefix || '') + 'cell-overlay';
|
|
179
|
+
this.$left = $(document.createElement("div"))
|
|
180
|
+
.addClass(className)
|
|
181
|
+
.addClass('left')
|
|
182
|
+
.appendTo(target);
|
|
183
|
+
this.$right = $(document.createElement("div"))
|
|
184
|
+
.addClass(className)
|
|
185
|
+
.addClass('right')
|
|
186
|
+
.appendTo(target);
|
|
187
|
+
this.$top = $(document.createElement("div"))
|
|
188
|
+
.addClass(className)
|
|
189
|
+
.addClass('top')
|
|
190
|
+
.appendTo(target);
|
|
191
|
+
this.$bottom = $(document.createElement("div"))
|
|
192
|
+
.addClass(className)
|
|
193
|
+
.addClass('bottom')
|
|
194
|
+
.appendTo(target);
|
|
195
|
+
if (withHandel) {
|
|
196
|
+
this.handle = document.createElement("div");
|
|
197
|
+
this.handle.classList.add("handle-overlay");
|
|
198
|
+
target.appendChild(this.handle);
|
|
199
|
+
const gridContainer = target.closest(".slickgrid");
|
|
200
|
+
const viewports = gridContainer.querySelectorAll(".grid-canvas");
|
|
201
|
+
for (let idx = 0; idx < viewports.length; idx++) {
|
|
202
|
+
console.log(idx);
|
|
203
|
+
Moveable(viewports[idx], {
|
|
204
|
+
selector: ".handle-overlay",
|
|
205
|
+
direction: "y",
|
|
206
|
+
gridY: grid.getOptions().rowHeight,
|
|
207
|
+
containInParent: false,
|
|
208
|
+
onStart: EventHandler.Create((e) => {
|
|
209
|
+
handleOverlayDragStart(e);
|
|
210
|
+
}),
|
|
211
|
+
onMove: EventHandler.Create((e) => {
|
|
212
|
+
handleOverlayDrag(e);
|
|
213
|
+
}),
|
|
214
|
+
onStop: EventHandler.Create((e) => {
|
|
215
|
+
handleOverlayDragEnd(e);
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
this.moveToContainer = function (container) {
|
|
221
|
+
this.$left.appendTo(container);
|
|
222
|
+
this.$right.appendTo(container);
|
|
223
|
+
this.$top.appendTo(container);
|
|
224
|
+
this.$bottom.appendTo(container);
|
|
225
|
+
if (this.handle) {
|
|
226
|
+
$(this.handle).appendTo(container);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
this.toggle = function (showOrHide) {
|
|
230
|
+
this.$left.css("display", showOrHide ? "" : "none");
|
|
231
|
+
this.$right.css("display", showOrHide ? "" : "none");
|
|
232
|
+
this.$top.css("display", showOrHide ? "" : "none");
|
|
233
|
+
this.$bottom.css("display", showOrHide ? "" : "none");
|
|
234
|
+
if (this.handle) {
|
|
235
|
+
this.handle.style.display = showOrHide ? "" : "none";
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function overlayRangeDecorator(targetGrid) {
|
|
240
|
+
var decorator;
|
|
241
|
+
var r;
|
|
242
|
+
function show(range) {
|
|
243
|
+
r = range;
|
|
244
|
+
if (!decorator) {
|
|
245
|
+
decorator = new Overlay(grid.getCanvasNode(range.fromCell, range.fromRow), false, 'selection-');
|
|
246
|
+
}
|
|
247
|
+
var from = targetGrid.getCellNodeBox(range.fromRow, range.fromCell);
|
|
248
|
+
var to = targetGrid.getCellNodeBox(range.toRow, range.toCell);
|
|
249
|
+
decorator.$left.css({
|
|
250
|
+
top: from.top - 2,
|
|
251
|
+
left: from.left - 2,
|
|
252
|
+
height: to.bottom - from.top + 2,
|
|
253
|
+
width: options.decoratorWidth
|
|
254
|
+
});
|
|
255
|
+
decorator.$right.css({
|
|
256
|
+
top: from.top - 2,
|
|
257
|
+
left: to.right - 1,
|
|
258
|
+
height: to.bottom - from.top + 2,
|
|
259
|
+
width: options.decoratorWidth
|
|
260
|
+
});
|
|
261
|
+
decorator.$top.css({
|
|
262
|
+
top: from.top - 2,
|
|
263
|
+
left: to.left - 1,
|
|
264
|
+
height: options.decoratorWidth,
|
|
265
|
+
width: to.right - from.left + 2
|
|
266
|
+
});
|
|
267
|
+
decorator.$bottom.css({
|
|
268
|
+
top: to.bottom - 1,
|
|
269
|
+
left: from.left - 2,
|
|
270
|
+
height: options.decoratorWidth,
|
|
271
|
+
width: to.right - from.left + 3
|
|
272
|
+
});
|
|
273
|
+
return decorator;
|
|
274
|
+
}
|
|
275
|
+
function getSelectedRange() {
|
|
276
|
+
return r;
|
|
277
|
+
}
|
|
278
|
+
function hide() {
|
|
279
|
+
if (decorator) {
|
|
280
|
+
decorator.toggle(false);
|
|
281
|
+
decorator = null;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
hide: hide,
|
|
286
|
+
show: show,
|
|
287
|
+
getSelectedRange: getSelectedRange
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
$.shallowExtend(this, {
|
|
291
|
+
"init": init,
|
|
292
|
+
"destroy": destroy,
|
|
293
|
+
"onFillUpDown": new Slick.Event()
|
|
294
|
+
});
|
|
295
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/***
|
|
2
|
-
* Displays an overlay on top of a given cell range.
|
|
3
|
-
*
|
|
4
|
-
* TODO:
|
|
5
|
-
* Currently, it blocks mouse events to DOM nodes behind it.
|
|
6
|
-
* Use FF and WebKit-specific "pointer-events" CSS style, or some kind of event forwarding.
|
|
7
|
-
* Could also construct the borders separately using 4 individual DIVs.
|
|
8
|
-
*
|
|
9
|
-
* @param {Grid} grid
|
|
10
|
-
* @param {Object} options
|
|
11
|
-
*/
|
|
12
|
-
export declare function CellRangeDecorator(grid: any, options: any): void;
|
|
1
|
+
/***
|
|
2
|
+
* Displays an overlay on top of a given cell range.
|
|
3
|
+
*
|
|
4
|
+
* TODO:
|
|
5
|
+
* Currently, it blocks mouse events to DOM nodes behind it.
|
|
6
|
+
* Use FF and WebKit-specific "pointer-events" CSS style, or some kind of event forwarding.
|
|
7
|
+
* Could also construct the borders separately using 4 individual DIVs.
|
|
8
|
+
*
|
|
9
|
+
* @param {Grid} grid
|
|
10
|
+
* @param {Object} options
|
|
11
|
+
*/
|
|
12
|
+
export declare function CellRangeDecorator(grid: any, options: any): void;
|