@revolist/revogrid 4.23.17 → 4.23.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/dist/cjs/revo-grid.cjs.entry.js +5 -2
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +10 -10
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +8 -8
- package/dist/cjs/revogr-data_4.cjs.entry.js +2 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +33 -9
- package/dist/cjs/{throttle-BCwEuJJq.js → throttle-fV6BUmM7.js} +4 -0
- package/dist/collection/components/order/order-row.service.js +8 -8
- package/dist/collection/components/overlay/revogr-overlay-selection.js +9 -9
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +1 -0
- package/dist/collection/plugins/filter/filter.panel.js +33 -9
- package/dist/collection/services/data.provider.js +5 -2
- package/dist/collection/services/local.scroll.timer.js +4 -0
- package/dist/esm/revo-grid.entry.js +5 -2
- package/dist/esm/revogr-attribution_7.entry.js +10 -10
- package/dist/esm/revogr-clipboard_3.entry.js +8 -8
- package/dist/esm/revogr-data_4.entry.js +2 -1
- package/dist/esm/revogr-filter-panel.entry.js +34 -10
- package/dist/esm/{throttle-CaUDyxyU.js → throttle-Cpk1LoGk.js} +4 -0
- package/dist/revo-grid/revo-grid.entry.js +5 -2
- package/dist/revo-grid/revogr-attribution_7.entry.js +10 -10
- package/dist/revo-grid/revogr-clipboard_3.entry.js +8 -8
- package/dist/revo-grid/revogr-data_4.entry.js +2 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +34 -10
- package/dist/revo-grid/{throttle-CaUDyxyU.js → throttle-Cpk1LoGk.js} +4 -0
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +1 -1
- package/dist/types/plugins/filter/filter.button.d.ts +1 -1
- package/dist/types/plugins/filter/filter.panel.d.ts +3 -0
- package/dist/types/services/local.scroll.timer.d.ts +4 -0
- package/dist/types/types/interfaces.d.ts +4 -0
- package/dist/types/types/selection.d.ts +4 -0
- package/hydrate/index.js +60 -28
- package/hydrate/index.mjs +60 -28
- package/package.json +1 -1
- package/standalone/local.scroll.timer.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
- package/standalone/revogr-order-editor2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
|
@@ -178,9 +178,12 @@ class DataProvider {
|
|
|
178
178
|
// take out
|
|
179
179
|
const toMove = newItemsOrder.splice(newItemsOrder.indexOf(prevItems[from]), // get index in proxy
|
|
180
180
|
1);
|
|
181
|
+
const targetItem = prevItems[from < to ? to + 1 : to];
|
|
182
|
+
const targetIndex = targetItem === undefined
|
|
183
|
+
? newItemsOrder.length
|
|
184
|
+
: newItemsOrder.indexOf(targetItem);
|
|
181
185
|
// insert before
|
|
182
|
-
newItemsOrder.splice(
|
|
183
|
-
0, ...toMove);
|
|
186
|
+
newItemsOrder.splice(targetIndex, 0, ...toMove);
|
|
184
187
|
storeService.setData({
|
|
185
188
|
proxyItems: newItemsOrder,
|
|
186
189
|
});
|
|
@@ -12,7 +12,7 @@ var index$1 = require('./index-DxaSE5uZ.js');
|
|
|
12
12
|
var debounce = require('./debounce-CcpHiH2p.js');
|
|
13
13
|
var viewport_store = require('./viewport.store-BscUCiUk.js');
|
|
14
14
|
var viewport_helpers = require('./viewport.helpers-BND76K2j.js');
|
|
15
|
-
var throttle = require('./throttle-
|
|
15
|
+
var throttle = require('./throttle-fV6BUmM7.js');
|
|
16
16
|
|
|
17
17
|
const Attribution = class {
|
|
18
18
|
constructor(hostRef) {
|
|
@@ -929,13 +929,13 @@ const OverlaySelection = class {
|
|
|
929
929
|
/**
|
|
930
930
|
* Executes the focus operation on the specified range of cells.
|
|
931
931
|
*/
|
|
932
|
-
doFocus(focus, end, changes) {
|
|
932
|
+
doFocus(focus, end, changes, originalEvent) {
|
|
933
933
|
// 1. Trigger beforeFocus event
|
|
934
|
-
const { defaultPrevented } = this.beforeFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
|
|
934
|
+
const { defaultPrevented } = this.beforeFocusCell.emit(Object.assign(Object.assign({}, this.columnService.getSaveData(focus.y, focus.x)), { originalEvent }));
|
|
935
935
|
if (defaultPrevented) {
|
|
936
936
|
return false;
|
|
937
937
|
}
|
|
938
|
-
const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) });
|
|
938
|
+
const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent });
|
|
939
939
|
// 2. Trigger apply focus event
|
|
940
940
|
const applyEvent = this.applyFocus.emit(evData);
|
|
941
941
|
if (applyEvent.defaultPrevented) {
|
|
@@ -951,10 +951,10 @@ const OverlaySelection = class {
|
|
|
951
951
|
y: range.y1,
|
|
952
952
|
} }, applyEvent.detail)).defaultPrevented;
|
|
953
953
|
}
|
|
954
|
-
triggerRangeEvent(range) {
|
|
954
|
+
triggerRangeEvent(range, originalEvent) {
|
|
955
955
|
const type = this.types.rowType;
|
|
956
956
|
// 1. Apply range
|
|
957
|
-
const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) }));
|
|
957
|
+
const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent }));
|
|
958
958
|
if (applyEvent.defaultPrevented) {
|
|
959
959
|
return false;
|
|
960
960
|
}
|
|
@@ -1005,7 +1005,7 @@ const OverlaySelection = class {
|
|
|
1005
1005
|
return;
|
|
1006
1006
|
}
|
|
1007
1007
|
// Set focus on the current cell
|
|
1008
|
-
this.focus(focusCell, this.range && e.shiftKey);
|
|
1008
|
+
this.focus(focusCell, this.range && e.shiftKey, e);
|
|
1009
1009
|
// Initiate autofill selection
|
|
1010
1010
|
if (this.range) {
|
|
1011
1011
|
targetElement &&
|
|
@@ -1159,7 +1159,7 @@ const OverlaySelection = class {
|
|
|
1159
1159
|
/**
|
|
1160
1160
|
* Sets the focus on a cell and optionally edits a range.
|
|
1161
1161
|
*/
|
|
1162
|
-
focus(cell, isRangeEdit = false) {
|
|
1162
|
+
focus(cell, isRangeEdit = false, originalEvent) {
|
|
1163
1163
|
if (!cell)
|
|
1164
1164
|
return false;
|
|
1165
1165
|
const end = cell;
|
|
@@ -1167,10 +1167,10 @@ const OverlaySelection = class {
|
|
|
1167
1167
|
if (isRangeEdit && start) {
|
|
1168
1168
|
const range = column_service.getRange(start, end);
|
|
1169
1169
|
if (range) {
|
|
1170
|
-
return this.triggerRangeEvent(range);
|
|
1170
|
+
return this.triggerRangeEvent(range, originalEvent);
|
|
1171
1171
|
}
|
|
1172
1172
|
}
|
|
1173
|
-
return this.doFocus(cell, end);
|
|
1173
|
+
return this.doFocus(cell, end, undefined, originalEvent);
|
|
1174
1174
|
}
|
|
1175
1175
|
get types() {
|
|
1176
1176
|
return {
|
|
@@ -298,16 +298,16 @@ class RowOrderService {
|
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
const newRow = this.getCell(e, data);
|
|
301
|
+
// rgRow dragged out table
|
|
302
|
+
if (newRow.y < 0) {
|
|
303
|
+
newRow.y = 0;
|
|
304
|
+
}
|
|
305
|
+
// rgRow dragged to the top
|
|
306
|
+
else if (newRow.y < this.currentCell.y) {
|
|
307
|
+
newRow.y++;
|
|
308
|
+
}
|
|
301
309
|
// if position changed
|
|
302
310
|
if (newRow.y !== this.currentCell.y) {
|
|
303
|
-
// rgRow dragged out table
|
|
304
|
-
if (newRow.y < 0) {
|
|
305
|
-
newRow.y = 0;
|
|
306
|
-
}
|
|
307
|
-
// rgRow dragged to the top
|
|
308
|
-
else if (newRow.y < this.currentCell.y) {
|
|
309
|
-
newRow.y++;
|
|
310
|
-
}
|
|
311
311
|
this.config.positionChanged(this.currentCell.y, newRow.y);
|
|
312
312
|
}
|
|
313
313
|
this.clear();
|
|
@@ -9,7 +9,7 @@ var dimension_helpers = require('./dimension.helpers-B9HgANnM.js');
|
|
|
9
9
|
var cellRenderer = require('./cell-renderer-DfUCisis.js');
|
|
10
10
|
var filter_button = require('./filter.button-C4xpvyyE.js');
|
|
11
11
|
var headerCellRenderer = require('./header-cell-renderer-DyjOxArm.js');
|
|
12
|
-
var throttle = require('./throttle-
|
|
12
|
+
var throttle = require('./throttle-fV6BUmM7.js');
|
|
13
13
|
var viewport_helpers = require('./viewport.helpers-BND76K2j.js');
|
|
14
14
|
require('./debounce-CcpHiH2p.js');
|
|
15
15
|
|
|
@@ -873,6 +873,7 @@ const RevogrViewportScroll = class {
|
|
|
873
873
|
const lastScrollUpdate = () => {
|
|
874
874
|
var _a;
|
|
875
875
|
(_a = this.localScrollService) === null || _a === void 0 ? void 0 : _a.scroll(coordinate, type, undefined, undefined, outside);
|
|
876
|
+
this.localScrollTimer.setCoordinateFromScroll({ dimension: type, coordinate });
|
|
876
877
|
};
|
|
877
878
|
// apply after throttling
|
|
878
879
|
if (this.localScrollTimer.isReady(type, coordinate)) {
|
|
@@ -120,7 +120,7 @@ const FilterPanel = class {
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
const path = e.composedPath();
|
|
123
|
-
const select =
|
|
123
|
+
const select = this.getAddFilterSelect();
|
|
124
124
|
if (select instanceof HTMLSelectElement) {
|
|
125
125
|
// click on select should be skipped
|
|
126
126
|
if (path.includes(select)) {
|
|
@@ -134,9 +134,8 @@ const FilterPanel = class {
|
|
|
134
134
|
}
|
|
135
135
|
this.currentFilterId = -1;
|
|
136
136
|
const isOutside = !path.includes(this.element);
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
!filter_button.isFilterBtn(e.target) &&
|
|
137
|
+
if (isOutside &&
|
|
138
|
+
!this.isOwnFilterButton(e.target) &&
|
|
140
139
|
this.closeOnOutsideClick) {
|
|
141
140
|
this.changes = undefined;
|
|
142
141
|
}
|
|
@@ -260,7 +259,7 @@ const FilterPanel = class {
|
|
|
260
259
|
this.currentFilterType = el.value;
|
|
261
260
|
this.addNewFilterToProp();
|
|
262
261
|
// reset value after adding new filter
|
|
263
|
-
const select =
|
|
262
|
+
const select = this.getAddFilterSelect();
|
|
264
263
|
if (select) {
|
|
265
264
|
select.value = defaultType;
|
|
266
265
|
this.currentFilterType = defaultType;
|
|
@@ -464,7 +463,7 @@ const FilterPanel = class {
|
|
|
464
463
|
}
|
|
465
464
|
};
|
|
466
465
|
const focusNext = () => {
|
|
467
|
-
const select =
|
|
466
|
+
const select = this.getAddFilterSelect();
|
|
468
467
|
if (select) {
|
|
469
468
|
select.value = defaultType;
|
|
470
469
|
this.currentFilterType = defaultType;
|
|
@@ -498,7 +497,7 @@ const FilterPanel = class {
|
|
|
498
497
|
}
|
|
499
498
|
}, onKeyDown: e => {
|
|
500
499
|
if (e.key.toLowerCase() === 'enter') {
|
|
501
|
-
const select =
|
|
500
|
+
const select = this.getAddFilterSelect();
|
|
502
501
|
if (select) {
|
|
503
502
|
focusNext();
|
|
504
503
|
}
|
|
@@ -508,6 +507,31 @@ const FilterPanel = class {
|
|
|
508
507
|
e.stopPropagation();
|
|
509
508
|
} }));
|
|
510
509
|
}
|
|
510
|
+
getAddFilterSelect() {
|
|
511
|
+
return this.element.querySelector(`#${FILTER_ID}`);
|
|
512
|
+
}
|
|
513
|
+
isOwnFilterButton(target) {
|
|
514
|
+
if (!(target instanceof Element)) {
|
|
515
|
+
return false;
|
|
516
|
+
}
|
|
517
|
+
if (!filter_button.isFilterBtn(target)) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
const panelGrid = this.getOwningGrid(this.element);
|
|
521
|
+
const targetGrid = this.getOwningGrid(target);
|
|
522
|
+
return !!panelGrid && panelGrid === targetGrid;
|
|
523
|
+
}
|
|
524
|
+
getOwningGrid(element) {
|
|
525
|
+
const grid = element.closest('revo-grid');
|
|
526
|
+
if (grid) {
|
|
527
|
+
return grid;
|
|
528
|
+
}
|
|
529
|
+
const root = element.getRootNode();
|
|
530
|
+
if (root instanceof ShadowRoot && root.host.localName === 'revo-grid') {
|
|
531
|
+
return root.host;
|
|
532
|
+
}
|
|
533
|
+
return undefined;
|
|
534
|
+
}
|
|
511
535
|
render() {
|
|
512
536
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
513
537
|
const style = {
|
|
@@ -515,7 +539,7 @@ const FilterPanel = class {
|
|
|
515
539
|
top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
|
|
516
540
|
};
|
|
517
541
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
518
|
-
return (index.h(index.Host, { key: '
|
|
542
|
+
return (index.h(index.Host, { key: '2a19b35adb56fb7d23385fffebc768838edee162' }, index.h("dialog", { key: '94386d7cbc4bd9c631f72928938b1d1550a3de82', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
|
|
519
543
|
e.preventDefault();
|
|
520
544
|
this.onCancel();
|
|
521
545
|
} }, this.changes && [
|
|
@@ -524,7 +548,7 @@ const FilterPanel = class {
|
|
|
524
548
|
((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
|
|
525
549
|
index.h("label", { key: "filter-title" }, capts.title),
|
|
526
550
|
index.h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
|
|
527
|
-
index.h("div", { key: "add-filter", class: "add-filter" }, index.h("select", { key: '
|
|
551
|
+
index.h("div", { key: "add-filter", class: "add-filter" }, index.h("select", { key: '4f7354e39d8e5cf9ae7b735290eff18d105ab87e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
|
|
528
552
|
],
|
|
529
553
|
index.h("slot", { key: "default-slot" }),
|
|
530
554
|
((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
|
|
@@ -189,6 +189,10 @@ class LocalScrollTimer {
|
|
|
189
189
|
setCoordinate(e) {
|
|
190
190
|
this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;
|
|
191
191
|
}
|
|
192
|
+
setCoordinateFromScroll(e) {
|
|
193
|
+
this.setCoordinate(e);
|
|
194
|
+
this.mouseWheelScrollTimestamp[e.dimension] = 0;
|
|
195
|
+
}
|
|
192
196
|
/**
|
|
193
197
|
* Remember last mw event time
|
|
194
198
|
*/
|
|
@@ -14,16 +14,16 @@ export default class RowOrderService {
|
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
const newRow = this.getCell(e, data);
|
|
17
|
+
// rgRow dragged out table
|
|
18
|
+
if (newRow.y < 0) {
|
|
19
|
+
newRow.y = 0;
|
|
20
|
+
}
|
|
21
|
+
// rgRow dragged to the top
|
|
22
|
+
else if (newRow.y < this.currentCell.y) {
|
|
23
|
+
newRow.y++;
|
|
24
|
+
}
|
|
17
25
|
// if position changed
|
|
18
26
|
if (newRow.y !== this.currentCell.y) {
|
|
19
|
-
// rgRow dragged out table
|
|
20
|
-
if (newRow.y < 0) {
|
|
21
|
-
newRow.y = 0;
|
|
22
|
-
}
|
|
23
|
-
// rgRow dragged to the top
|
|
24
|
-
else if (newRow.y < this.currentCell.y) {
|
|
25
|
-
newRow.y++;
|
|
26
|
-
}
|
|
27
27
|
this.config.positionChanged(this.currentCell.y, newRow.y);
|
|
28
28
|
}
|
|
29
29
|
this.clear();
|
|
@@ -241,13 +241,13 @@ export class OverlaySelection {
|
|
|
241
241
|
/**
|
|
242
242
|
* Executes the focus operation on the specified range of cells.
|
|
243
243
|
*/
|
|
244
|
-
doFocus(focus, end, changes) {
|
|
244
|
+
doFocus(focus, end, changes, originalEvent) {
|
|
245
245
|
// 1. Trigger beforeFocus event
|
|
246
|
-
const { defaultPrevented } = this.beforeFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
|
|
246
|
+
const { defaultPrevented } = this.beforeFocusCell.emit(Object.assign(Object.assign({}, this.columnService.getSaveData(focus.y, focus.x)), { originalEvent }));
|
|
247
247
|
if (defaultPrevented) {
|
|
248
248
|
return false;
|
|
249
249
|
}
|
|
250
|
-
const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) });
|
|
250
|
+
const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent });
|
|
251
251
|
// 2. Trigger apply focus event
|
|
252
252
|
const applyEvent = this.applyFocus.emit(evData);
|
|
253
253
|
if (applyEvent.defaultPrevented) {
|
|
@@ -263,10 +263,10 @@ export class OverlaySelection {
|
|
|
263
263
|
y: range.y1,
|
|
264
264
|
} }, applyEvent.detail)).defaultPrevented;
|
|
265
265
|
}
|
|
266
|
-
triggerRangeEvent(range) {
|
|
266
|
+
triggerRangeEvent(range, originalEvent) {
|
|
267
267
|
const type = this.types.rowType;
|
|
268
268
|
// 1. Apply range
|
|
269
|
-
const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) }));
|
|
269
|
+
const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent }));
|
|
270
270
|
if (applyEvent.defaultPrevented) {
|
|
271
271
|
return false;
|
|
272
272
|
}
|
|
@@ -317,7 +317,7 @@ export class OverlaySelection {
|
|
|
317
317
|
return;
|
|
318
318
|
}
|
|
319
319
|
// Set focus on the current cell
|
|
320
|
-
this.focus(focusCell, this.range && e.shiftKey);
|
|
320
|
+
this.focus(focusCell, this.range && e.shiftKey, e);
|
|
321
321
|
// Initiate autofill selection
|
|
322
322
|
if (this.range) {
|
|
323
323
|
targetElement &&
|
|
@@ -471,7 +471,7 @@ export class OverlaySelection {
|
|
|
471
471
|
/**
|
|
472
472
|
* Sets the focus on a cell and optionally edits a range.
|
|
473
473
|
*/
|
|
474
|
-
focus(cell, isRangeEdit = false) {
|
|
474
|
+
focus(cell, isRangeEdit = false, originalEvent) {
|
|
475
475
|
if (!cell)
|
|
476
476
|
return false;
|
|
477
477
|
const end = cell;
|
|
@@ -479,10 +479,10 @@ export class OverlaySelection {
|
|
|
479
479
|
if (isRangeEdit && start) {
|
|
480
480
|
const range = getRange(start, end);
|
|
481
481
|
if (range) {
|
|
482
|
-
return this.triggerRangeEvent(range);
|
|
482
|
+
return this.triggerRangeEvent(range, originalEvent);
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
-
return this.doFocus(cell, end);
|
|
485
|
+
return this.doFocus(cell, end, undefined, originalEvent);
|
|
486
486
|
}
|
|
487
487
|
get types() {
|
|
488
488
|
return {
|
|
@@ -262,6 +262,7 @@ export class RevogrViewportScroll {
|
|
|
262
262
|
const lastScrollUpdate = () => {
|
|
263
263
|
var _a;
|
|
264
264
|
(_a = this.localScrollService) === null || _a === void 0 ? void 0 : _a.scroll(coordinate, type, undefined, undefined, outside);
|
|
265
|
+
this.localScrollTimer.setCoordinateFromScroll({ dimension: type, coordinate });
|
|
265
266
|
};
|
|
266
267
|
// apply after throttling
|
|
267
268
|
if (this.localScrollTimer.isReady(type, coordinate)) {
|
|
@@ -60,7 +60,7 @@ export class FilterPanel {
|
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
const path = e.composedPath();
|
|
63
|
-
const select =
|
|
63
|
+
const select = this.getAddFilterSelect();
|
|
64
64
|
if (select instanceof HTMLSelectElement) {
|
|
65
65
|
// click on select should be skipped
|
|
66
66
|
if (path.includes(select)) {
|
|
@@ -74,9 +74,8 @@ export class FilterPanel {
|
|
|
74
74
|
}
|
|
75
75
|
this.currentFilterId = -1;
|
|
76
76
|
const isOutside = !path.includes(this.element);
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
!isFilterBtn(e.target) &&
|
|
77
|
+
if (isOutside &&
|
|
78
|
+
!this.isOwnFilterButton(e.target) &&
|
|
80
79
|
this.closeOnOutsideClick) {
|
|
81
80
|
this.changes = undefined;
|
|
82
81
|
}
|
|
@@ -200,7 +199,7 @@ export class FilterPanel {
|
|
|
200
199
|
this.currentFilterType = el.value;
|
|
201
200
|
this.addNewFilterToProp();
|
|
202
201
|
// reset value after adding new filter
|
|
203
|
-
const select =
|
|
202
|
+
const select = this.getAddFilterSelect();
|
|
204
203
|
if (select) {
|
|
205
204
|
select.value = defaultType;
|
|
206
205
|
this.currentFilterType = defaultType;
|
|
@@ -404,7 +403,7 @@ export class FilterPanel {
|
|
|
404
403
|
}
|
|
405
404
|
};
|
|
406
405
|
const focusNext = () => {
|
|
407
|
-
const select =
|
|
406
|
+
const select = this.getAddFilterSelect();
|
|
408
407
|
if (select) {
|
|
409
408
|
select.value = defaultType;
|
|
410
409
|
this.currentFilterType = defaultType;
|
|
@@ -438,7 +437,7 @@ export class FilterPanel {
|
|
|
438
437
|
}
|
|
439
438
|
}, onKeyDown: e => {
|
|
440
439
|
if (e.key.toLowerCase() === 'enter') {
|
|
441
|
-
const select =
|
|
440
|
+
const select = this.getAddFilterSelect();
|
|
442
441
|
if (select) {
|
|
443
442
|
focusNext();
|
|
444
443
|
}
|
|
@@ -448,6 +447,31 @@ export class FilterPanel {
|
|
|
448
447
|
e.stopPropagation();
|
|
449
448
|
} }));
|
|
450
449
|
}
|
|
450
|
+
getAddFilterSelect() {
|
|
451
|
+
return this.element.querySelector(`#${FILTER_ID}`);
|
|
452
|
+
}
|
|
453
|
+
isOwnFilterButton(target) {
|
|
454
|
+
if (!(target instanceof Element)) {
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
if (!isFilterBtn(target)) {
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
const panelGrid = this.getOwningGrid(this.element);
|
|
461
|
+
const targetGrid = this.getOwningGrid(target);
|
|
462
|
+
return !!panelGrid && panelGrid === targetGrid;
|
|
463
|
+
}
|
|
464
|
+
getOwningGrid(element) {
|
|
465
|
+
const grid = element.closest('revo-grid');
|
|
466
|
+
if (grid) {
|
|
467
|
+
return grid;
|
|
468
|
+
}
|
|
469
|
+
const root = element.getRootNode();
|
|
470
|
+
if (root instanceof ShadowRoot && root.host.localName === 'revo-grid') {
|
|
471
|
+
return root.host;
|
|
472
|
+
}
|
|
473
|
+
return undefined;
|
|
474
|
+
}
|
|
451
475
|
render() {
|
|
452
476
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
453
477
|
const style = {
|
|
@@ -455,7 +479,7 @@ export class FilterPanel {
|
|
|
455
479
|
top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
|
|
456
480
|
};
|
|
457
481
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
458
|
-
return (h(Host, { key: '
|
|
482
|
+
return (h(Host, { key: '2a19b35adb56fb7d23385fffebc768838edee162' }, h("dialog", { key: '94386d7cbc4bd9c631f72928938b1d1550a3de82', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
|
|
459
483
|
e.preventDefault();
|
|
460
484
|
this.onCancel();
|
|
461
485
|
} }, this.changes && [
|
|
@@ -464,7 +488,7 @@ export class FilterPanel {
|
|
|
464
488
|
((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
|
|
465
489
|
h("label", { key: "filter-title" }, capts.title),
|
|
466
490
|
h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
|
|
467
|
-
h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: '
|
|
491
|
+
h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: '4f7354e39d8e5cf9ae7b735290eff18d105ab87e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
|
|
468
492
|
],
|
|
469
493
|
h("slot", { key: "default-slot" }),
|
|
470
494
|
((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
|
|
@@ -52,9 +52,12 @@ export class DataProvider {
|
|
|
52
52
|
// take out
|
|
53
53
|
const toMove = newItemsOrder.splice(newItemsOrder.indexOf(prevItems[from]), // get index in proxy
|
|
54
54
|
1);
|
|
55
|
+
const targetItem = prevItems[from < to ? to + 1 : to];
|
|
56
|
+
const targetIndex = targetItem === undefined
|
|
57
|
+
? newItemsOrder.length
|
|
58
|
+
: newItemsOrder.indexOf(targetItem);
|
|
55
59
|
// insert before
|
|
56
|
-
newItemsOrder.splice(
|
|
57
|
-
0, ...toMove);
|
|
60
|
+
newItemsOrder.splice(targetIndex, 0, ...toMove);
|
|
58
61
|
storeService.setData({
|
|
59
62
|
proxyItems: newItemsOrder,
|
|
60
63
|
});
|
|
@@ -29,6 +29,10 @@ export class LocalScrollTimer {
|
|
|
29
29
|
setCoordinate(e) {
|
|
30
30
|
this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;
|
|
31
31
|
}
|
|
32
|
+
setCoordinateFromScroll(e) {
|
|
33
|
+
this.setCoordinate(e);
|
|
34
|
+
this.mouseWheelScrollTimestamp[e.dimension] = 0;
|
|
35
|
+
}
|
|
32
36
|
/**
|
|
33
37
|
* Remember last mw event time
|
|
34
38
|
*/
|
|
@@ -176,9 +176,12 @@ class DataProvider {
|
|
|
176
176
|
// take out
|
|
177
177
|
const toMove = newItemsOrder.splice(newItemsOrder.indexOf(prevItems[from]), // get index in proxy
|
|
178
178
|
1);
|
|
179
|
+
const targetItem = prevItems[from < to ? to + 1 : to];
|
|
180
|
+
const targetIndex = targetItem === undefined
|
|
181
|
+
? newItemsOrder.length
|
|
182
|
+
: newItemsOrder.indexOf(targetItem);
|
|
179
183
|
// insert before
|
|
180
|
-
newItemsOrder.splice(
|
|
181
|
-
0, ...toMove);
|
|
184
|
+
newItemsOrder.splice(targetIndex, 0, ...toMove);
|
|
182
185
|
storeService.setData({
|
|
183
186
|
proxyItems: newItemsOrder,
|
|
184
187
|
});
|
|
@@ -10,7 +10,7 @@ import { t as timeout, g as getScrollbarSize } from './index-Db3qZoW5.js';
|
|
|
10
10
|
import { d as debounce } from './debounce-PCRWZliA.js';
|
|
11
11
|
import { V as ViewportStore, j as calculateRowHeaderSize } from './viewport.store-_c579YyM.js';
|
|
12
12
|
import { H as HEADER_SLOT } from './viewport.helpers-CoCAvmZs.js';
|
|
13
|
-
import { L as LocalScrollTimer, a as LocalScrollService, g as getContentSize, t as throttle } from './throttle-
|
|
13
|
+
import { L as LocalScrollTimer, a as LocalScrollService, g as getContentSize, t as throttle } from './throttle-Cpk1LoGk.js';
|
|
14
14
|
|
|
15
15
|
const Attribution = class {
|
|
16
16
|
constructor(hostRef) {
|
|
@@ -927,13 +927,13 @@ const OverlaySelection = class {
|
|
|
927
927
|
/**
|
|
928
928
|
* Executes the focus operation on the specified range of cells.
|
|
929
929
|
*/
|
|
930
|
-
doFocus(focus, end, changes) {
|
|
930
|
+
doFocus(focus, end, changes, originalEvent) {
|
|
931
931
|
// 1. Trigger beforeFocus event
|
|
932
|
-
const { defaultPrevented } = this.beforeFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
|
|
932
|
+
const { defaultPrevented } = this.beforeFocusCell.emit(Object.assign(Object.assign({}, this.columnService.getSaveData(focus.y, focus.x)), { originalEvent }));
|
|
933
933
|
if (defaultPrevented) {
|
|
934
934
|
return false;
|
|
935
935
|
}
|
|
936
|
-
const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) });
|
|
936
|
+
const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent });
|
|
937
937
|
// 2. Trigger apply focus event
|
|
938
938
|
const applyEvent = this.applyFocus.emit(evData);
|
|
939
939
|
if (applyEvent.defaultPrevented) {
|
|
@@ -949,10 +949,10 @@ const OverlaySelection = class {
|
|
|
949
949
|
y: range.y1,
|
|
950
950
|
} }, applyEvent.detail)).defaultPrevented;
|
|
951
951
|
}
|
|
952
|
-
triggerRangeEvent(range) {
|
|
952
|
+
triggerRangeEvent(range, originalEvent) {
|
|
953
953
|
const type = this.types.rowType;
|
|
954
954
|
// 1. Apply range
|
|
955
|
-
const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) }));
|
|
955
|
+
const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent }));
|
|
956
956
|
if (applyEvent.defaultPrevented) {
|
|
957
957
|
return false;
|
|
958
958
|
}
|
|
@@ -1003,7 +1003,7 @@ const OverlaySelection = class {
|
|
|
1003
1003
|
return;
|
|
1004
1004
|
}
|
|
1005
1005
|
// Set focus on the current cell
|
|
1006
|
-
this.focus(focusCell, this.range && e.shiftKey);
|
|
1006
|
+
this.focus(focusCell, this.range && e.shiftKey, e);
|
|
1007
1007
|
// Initiate autofill selection
|
|
1008
1008
|
if (this.range) {
|
|
1009
1009
|
targetElement &&
|
|
@@ -1157,7 +1157,7 @@ const OverlaySelection = class {
|
|
|
1157
1157
|
/**
|
|
1158
1158
|
* Sets the focus on a cell and optionally edits a range.
|
|
1159
1159
|
*/
|
|
1160
|
-
focus(cell, isRangeEdit = false) {
|
|
1160
|
+
focus(cell, isRangeEdit = false, originalEvent) {
|
|
1161
1161
|
if (!cell)
|
|
1162
1162
|
return false;
|
|
1163
1163
|
const end = cell;
|
|
@@ -1165,10 +1165,10 @@ const OverlaySelection = class {
|
|
|
1165
1165
|
if (isRangeEdit && start) {
|
|
1166
1166
|
const range = getRange(start, end);
|
|
1167
1167
|
if (range) {
|
|
1168
|
-
return this.triggerRangeEvent(range);
|
|
1168
|
+
return this.triggerRangeEvent(range, originalEvent);
|
|
1169
1169
|
}
|
|
1170
1170
|
}
|
|
1171
|
-
return this.doFocus(cell, end);
|
|
1171
|
+
return this.doFocus(cell, end, undefined, originalEvent);
|
|
1172
1172
|
}
|
|
1173
1173
|
get types() {
|
|
1174
1174
|
return {
|
|
@@ -296,16 +296,16 @@ class RowOrderService {
|
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
298
|
const newRow = this.getCell(e, data);
|
|
299
|
+
// rgRow dragged out table
|
|
300
|
+
if (newRow.y < 0) {
|
|
301
|
+
newRow.y = 0;
|
|
302
|
+
}
|
|
303
|
+
// rgRow dragged to the top
|
|
304
|
+
else if (newRow.y < this.currentCell.y) {
|
|
305
|
+
newRow.y++;
|
|
306
|
+
}
|
|
299
307
|
// if position changed
|
|
300
308
|
if (newRow.y !== this.currentCell.y) {
|
|
301
|
-
// rgRow dragged out table
|
|
302
|
-
if (newRow.y < 0) {
|
|
303
|
-
newRow.y = 0;
|
|
304
|
-
}
|
|
305
|
-
// rgRow dragged to the top
|
|
306
|
-
else if (newRow.y < this.currentCell.y) {
|
|
307
|
-
newRow.y++;
|
|
308
|
-
}
|
|
309
309
|
this.config.positionChanged(this.currentCell.y, newRow.y);
|
|
310
310
|
}
|
|
311
311
|
this.clear();
|
|
@@ -7,7 +7,7 @@ import { B as ROW_FOCUSED_CLASS, b as getSourceItem, n as DATA_ROW, m as DATA_CO
|
|
|
7
7
|
import { G as GroupingRowRenderer, C as CellRenderer, R as RowRenderer, P as PADDING_DEPTH, S as SortingSign } from './cell-renderer-CLTRlCa5.js';
|
|
8
8
|
import { c as FilterButton } from './filter.button-B-RBiF67.js';
|
|
9
9
|
import { H as HeaderCellRenderer } from './header-cell-renderer-BMmXRsd_.js';
|
|
10
|
-
import { t as throttle, L as LocalScrollTimer, a as LocalScrollService, g as getContentSize } from './throttle-
|
|
10
|
+
import { t as throttle, L as LocalScrollTimer, a as LocalScrollService, g as getContentSize } from './throttle-Cpk1LoGk.js';
|
|
11
11
|
import { H as HEADER_SLOT, C as CONTENT_SLOT, F as FOOTER_SLOT } from './viewport.helpers-CoCAvmZs.js';
|
|
12
12
|
import './debounce-PCRWZliA.js';
|
|
13
13
|
|
|
@@ -871,6 +871,7 @@ const RevogrViewportScroll = class {
|
|
|
871
871
|
const lastScrollUpdate = () => {
|
|
872
872
|
var _a;
|
|
873
873
|
(_a = this.localScrollService) === null || _a === void 0 ? void 0 : _a.scroll(coordinate, type, undefined, undefined, outside);
|
|
874
|
+
this.localScrollTimer.setCoordinateFromScroll({ dimension: type, coordinate });
|
|
874
875
|
};
|
|
875
876
|
// apply after throttling
|
|
876
877
|
if (this.localScrollTimer.isReady(type, coordinate)) {
|