@revolist/revogrid 4.23.7 → 4.23.9
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/{cell-renderer-Dcz022q7.js → cell-renderer-Dl9kKeKp.js} +1 -1
- package/dist/cjs/{column.drag.plugin-yUSx3qoN.js → column.drag.plugin-BRraLvz3.js} +34 -5
- package/dist/cjs/{column.service-C1Qvcf5l.js → column.service-BNWNiJW3.js} +62 -23
- package/dist/cjs/{header-cell-renderer-vVr4IWNV.js → header-cell-renderer-DyjOxArm.js} +1 -1
- package/dist/cjs/index.cjs.js +5 -4
- package/dist/cjs/revo-grid.cjs.entry.js +5 -5
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +40 -4
- package/dist/cjs/revogr-data_4.cjs.entry.js +3 -3
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -2
- package/dist/collection/components/data/column.service.js +62 -23
- package/dist/collection/components/overlay/clipboard.utils.js +26 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js +27 -7
- package/dist/collection/components/revoGrid/revo-grid.js +14 -7
- package/dist/collection/plugins/filter/filter.panel.js +2 -2
- package/dist/collection/plugins/filter/filter.plugin.js +1 -1
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js +30 -2
- package/dist/collection/serve/controller.js +1 -0
- package/dist/esm/{cell-renderer-BtN-NGCk.js → cell-renderer-CdF2Jm3B.js} +1 -1
- package/dist/esm/{column.drag.plugin-Cg2U-91C.js → column.drag.plugin-V9DDE3mU.js} +34 -6
- package/dist/esm/{column.service-CC_SD8W3.js → column.service-C6hByxPy.js} +62 -23
- package/dist/esm/{header-cell-renderer-B-LX2sgu.js → header-cell-renderer-BMmXRsd_.js} +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/revo-grid.entry.js +5 -5
- package/dist/esm/revogr-attribution_7.entry.js +40 -4
- package/dist/esm/revogr-data_4.entry.js +3 -3
- package/dist/esm/revogr-filter-panel.entry.js +2 -2
- package/dist/revo-grid/{cell-renderer-BtN-NGCk.js → cell-renderer-CdF2Jm3B.js} +1 -1
- package/dist/revo-grid/{column.drag.plugin-Cg2U-91C.js → column.drag.plugin-V9DDE3mU.js} +34 -6
- package/dist/revo-grid/{column.service-CC_SD8W3.js → column.service-C6hByxPy.js} +62 -23
- package/dist/revo-grid/{header-cell-renderer-B-LX2sgu.js → header-cell-renderer-BMmXRsd_.js} +1 -1
- package/dist/revo-grid/index.esm.js +5 -5
- package/dist/revo-grid/revo-grid.entry.js +5 -5
- package/dist/revo-grid/revogr-attribution_7.entry.js +40 -4
- package/dist/revo-grid/revogr-data_4.entry.js +3 -3
- package/dist/revo-grid/revogr-filter-panel.entry.js +2 -2
- package/dist/types/components/data/column.service.d.ts +10 -1
- package/dist/types/components/overlay/clipboard.utils.d.ts +3 -0
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +4 -3
- package/dist/types/components/revoGrid/revo-grid.d.ts +4 -4
- package/dist/types/components.d.ts +14 -14
- package/dist/types/plugins/filter/filter.plugin.d.ts +1 -0
- package/dist/types/plugins/filter/filter.types.d.ts +1 -0
- package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +4 -0
- package/dist/types/types/interfaces.d.ts +8 -0
- package/hydrate/index.js +136 -33
- package/hydrate/index.mjs +136 -33
- package/package.json +1 -1
- package/readme.md +20 -1
- package/standalone/column.service.js +1 -1
- package/standalone/index.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
- package/standalone/revogr-overlay-selection2.js +1 -1
|
@@ -64,7 +64,7 @@ export class RevoGridComponent {
|
|
|
64
64
|
this.rowSize = 0;
|
|
65
65
|
/** Indicates default column size. */
|
|
66
66
|
this.colSize = 100;
|
|
67
|
-
/** When true, user can range
|
|
67
|
+
/** When true, user can select a cell range. Required for range-based clipboard fill. */
|
|
68
68
|
this.range = false;
|
|
69
69
|
/** When true, grid in read only mode. */
|
|
70
70
|
this.readonly = false;
|
|
@@ -76,7 +76,7 @@ export class RevoGridComponent {
|
|
|
76
76
|
this.noHorizontalScrollTransfer = false;
|
|
77
77
|
/** When true cell focus appear. */
|
|
78
78
|
this.canFocus = true;
|
|
79
|
-
/** When true enable clipboard. */
|
|
79
|
+
/** When true enable clipboard. Can be boolean or clipboard config. */
|
|
80
80
|
this.useClipboard = true;
|
|
81
81
|
/**
|
|
82
82
|
* Columns - defines an array of grid columns.
|
|
@@ -1202,7 +1202,7 @@ export class RevoGridComponent {
|
|
|
1202
1202
|
"optional": false,
|
|
1203
1203
|
"docs": {
|
|
1204
1204
|
"tags": [],
|
|
1205
|
-
"text": "When true, user can range
|
|
1205
|
+
"text": "When true, user can select a cell range. Required for range-based clipboard fill."
|
|
1206
1206
|
},
|
|
1207
1207
|
"getter": false,
|
|
1208
1208
|
"setter": false,
|
|
@@ -1294,15 +1294,22 @@ export class RevoGridComponent {
|
|
|
1294
1294
|
"type": "boolean",
|
|
1295
1295
|
"mutable": false,
|
|
1296
1296
|
"complexType": {
|
|
1297
|
-
"original": "boolean",
|
|
1298
|
-
"resolved": "boolean",
|
|
1299
|
-
"references": {
|
|
1297
|
+
"original": "boolean | ClipboardConfig",
|
|
1298
|
+
"resolved": "ClipboardConfig | boolean",
|
|
1299
|
+
"references": {
|
|
1300
|
+
"ClipboardConfig": {
|
|
1301
|
+
"location": "import",
|
|
1302
|
+
"path": "@type",
|
|
1303
|
+
"id": "src/types/index.ts::ClipboardConfig",
|
|
1304
|
+
"referenceLocation": "ClipboardConfig"
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1300
1307
|
},
|
|
1301
1308
|
"required": false,
|
|
1302
1309
|
"optional": false,
|
|
1303
1310
|
"docs": {
|
|
1304
1311
|
"tags": [],
|
|
1305
|
-
"text": "When true enable clipboard."
|
|
1312
|
+
"text": "When true enable clipboard. Can be boolean or clipboard config."
|
|
1306
1313
|
},
|
|
1307
1314
|
"getter": false,
|
|
1308
1315
|
"setter": false,
|
|
@@ -329,7 +329,7 @@ export class FilterPanel {
|
|
|
329
329
|
} }));
|
|
330
330
|
}
|
|
331
331
|
render() {
|
|
332
|
-
var _a, _b, _c;
|
|
332
|
+
var _a, _b, _c, _d, _e;
|
|
333
333
|
if (!this.changes) {
|
|
334
334
|
return h(Host, { style: { display: 'none' } });
|
|
335
335
|
}
|
|
@@ -346,7 +346,7 @@ export class FilterPanel {
|
|
|
346
346
|
h("label", null, capts.title),
|
|
347
347
|
h("div", { class: "filter-holder" }, this.getFilterItemsList()),
|
|
348
348
|
h("div", { class: "add-filter" }, h("select", { id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType)))
|
|
349
|
-
]), h("slot", null), h("div", { class: "filter-actions" }, this.disableDynamicFiltering && [
|
|
349
|
+
]), h("slot", null), ((_e = (_d = this.changes).extraBottomContent) === null || _e === void 0 ? void 0 : _e.call(_d, this.changes)) || '', h("div", { class: "filter-actions" }, this.disableDynamicFiltering && [
|
|
350
350
|
h("button", { id: "revo-button-save", "aria-label": "save", class: "revo-button green", onClick: () => this.onSave() }, capts.save),
|
|
351
351
|
h("button", { id: "revo-button-ok", "aria-label": "ok", class: "revo-button green", onClick: () => this.onCancel() }, capts.cancel),
|
|
352
352
|
], !this.disableDynamicFiltering && [
|
|
@@ -194,7 +194,7 @@ export class FilterPlugin extends BasePlugin {
|
|
|
194
194
|
// filter button clicked, open filter dialog
|
|
195
195
|
const gridPos = this.revogrid.getBoundingClientRect();
|
|
196
196
|
const buttonPos = el.getBoundingClientRect();
|
|
197
|
-
const data = Object.assign(Object.assign(Object.assign({}, e.detail), this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, filterTypes: this.getColumnFilter(e.detail.filter), filterItems: this.multiFilterItems, extraContent: this.extraHyperContent });
|
|
197
|
+
const data = Object.assign(Object.assign(Object.assign({}, e.detail), this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, filterTypes: this.getColumnFilter(e.detail.filter), filterItems: this.multiFilterItems, extraContent: this.extraHyperContent, extraBottomContent: this.extraBottomHyperContent });
|
|
198
198
|
(_b = this.beforeshow) === null || _b === void 0 ? void 0 : _b.call(this, data);
|
|
199
199
|
this.pop.show(data);
|
|
200
200
|
}
|
|
@@ -22,8 +22,17 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
22
22
|
constructor(revogrid, providers) {
|
|
23
23
|
super(revogrid, providers);
|
|
24
24
|
this.moveFunc = debounce((e) => this.doMove(e), 5);
|
|
25
|
+
this.preventHeaderClickAfterDrag = (event) => {
|
|
26
|
+
if (!this.preventNextHeaderClick) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.preventNextHeaderClick = false;
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
};
|
|
25
32
|
this.staticDragData = null;
|
|
26
33
|
this.dragData = null;
|
|
34
|
+
this.columnDragMoved = false;
|
|
35
|
+
this.preventNextHeaderClick = false;
|
|
27
36
|
this.localSubscriptions = {};
|
|
28
37
|
this.orderUi = new ColumnOrderHandler();
|
|
29
38
|
revogrid.appendChild(this.orderUi.render());
|
|
@@ -42,11 +51,13 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
42
51
|
callback: (e) => this.move(e),
|
|
43
52
|
};
|
|
44
53
|
this.addEventListener(COLUMN_CLICK, ({ detail }) => this.dragStart(detail));
|
|
54
|
+
this.revogrid.addEventListener('beforeheaderclick', this.preventHeaderClickAfterDrag, { capture: true });
|
|
45
55
|
}
|
|
46
56
|
dragStart({ event, data }) {
|
|
47
57
|
if (event.defaultPrevented) {
|
|
48
58
|
return;
|
|
49
59
|
}
|
|
60
|
+
this.preventNextHeaderClick = false;
|
|
50
61
|
const { defaultPrevented } = dispatch(this.revogrid, COLUMN_DRAG_START_EVENT, data);
|
|
51
62
|
// check if allowed to drag particulat column
|
|
52
63
|
if (defaultPrevented) {
|
|
@@ -68,7 +79,8 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
68
79
|
const cols = this.getDimension(data.pin || 'rgCol');
|
|
69
80
|
const gridRect = this.revogrid.getBoundingClientRect();
|
|
70
81
|
const elRect = dataEl.getBoundingClientRect();
|
|
71
|
-
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left) +
|
|
82
|
+
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left) +
|
|
83
|
+
(cols.renderOffset || 0));
|
|
72
84
|
this.staticDragData = {
|
|
73
85
|
startPos: event.x,
|
|
74
86
|
startItem,
|
|
@@ -99,10 +111,14 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
99
111
|
if (rgCol.itemIndex >= this.staticDragData.cols.count) {
|
|
100
112
|
return;
|
|
101
113
|
}
|
|
102
|
-
this.orderUi.showHandler(rgCol.
|
|
114
|
+
this.orderUi.showHandler(getColumnDragPosition(rgCol, this.staticDragData.startItem, this.staticDragData.cols.renderOffset || 0, dragData.scrollOffset), dragData.gridRect.width);
|
|
103
115
|
}
|
|
104
116
|
}
|
|
105
117
|
move(e) {
|
|
118
|
+
if (this.staticDragData &&
|
|
119
|
+
Math.abs(this.staticDragData.startPos - e.x) > 10) {
|
|
120
|
+
this.columnDragMoved = true;
|
|
121
|
+
}
|
|
106
122
|
dispatch(this.revogrid, COLUMN_DRAG_MOVE_EVENT, e);
|
|
107
123
|
// then do move
|
|
108
124
|
this.moveFunc(e);
|
|
@@ -111,6 +127,7 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
111
127
|
this.clearOrder();
|
|
112
128
|
}
|
|
113
129
|
onMouseUp(e) {
|
|
130
|
+
const suppressClick = this.columnDragMoved;
|
|
114
131
|
// apply new positions
|
|
115
132
|
if (this.dragData && this.staticDragData) {
|
|
116
133
|
let relativePos = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
|
|
@@ -133,6 +150,9 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
133
150
|
}
|
|
134
151
|
dispatch(this.revogrid, COLUMN_DRAG_END_EVENT, this.getData(this.staticDragData, newItems, source));
|
|
135
152
|
}
|
|
153
|
+
if (suppressClick) {
|
|
154
|
+
this.preventNextHeaderClick = !!e.target.closest('revogr-header');
|
|
155
|
+
}
|
|
136
156
|
this.clearOrder();
|
|
137
157
|
}
|
|
138
158
|
clearLocalSubscriptions() {
|
|
@@ -141,6 +161,7 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
141
161
|
clearOrder() {
|
|
142
162
|
this.staticDragData = null;
|
|
143
163
|
this.dragData = null;
|
|
164
|
+
this.columnDragMoved = false;
|
|
144
165
|
this.clearLocalSubscriptions();
|
|
145
166
|
this.orderUi.stop(this.revogrid);
|
|
146
167
|
}
|
|
@@ -150,6 +171,7 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
150
171
|
clearSubscriptions() {
|
|
151
172
|
super.clearSubscriptions();
|
|
152
173
|
this.clearLocalSubscriptions();
|
|
174
|
+
this.revogrid.removeEventListener('beforeheaderclick', this.preventHeaderClickAfterDrag, { capture: true });
|
|
153
175
|
}
|
|
154
176
|
getData({ gridEl, dataEl, pin }, order, source = []) {
|
|
155
177
|
const gridRect = gridEl.getBoundingClientRect();
|
|
@@ -171,3 +193,9 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
171
193
|
export function getLeftRelative(absoluteX, gridPos, offset) {
|
|
172
194
|
return absoluteX - gridPos - offset;
|
|
173
195
|
}
|
|
196
|
+
export function getColumnDragPosition(targetItem, startItem, renderOffset, scrollOffset) {
|
|
197
|
+
const insertionEdge = startItem.itemIndex > targetItem.itemIndex
|
|
198
|
+
? targetItem.start
|
|
199
|
+
: targetItem.end;
|
|
200
|
+
return insertionEdge - renderOffset + scrollOffset;
|
|
201
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { h, f as Build } from './index-Chp_81rd.js';
|
|
5
5
|
import { n as DATA_ROW, w as DRAG_ICON_CLASS, x as DRAGGABLE_CLASS } from './dimension.helpers-CGKwSvw6.js';
|
|
6
|
-
import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-
|
|
6
|
+
import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-C6hByxPy.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders sorting direction and optional additive sorting rank.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import { J as reduce, g as getRange, K as baseEach, C as getColumnType, c as columnTypes, L as toInteger, u as isGrouping, t as getGroupingName, r as rowTypes, B as getCellDataParsed, A as getCellRaw, j as GROUP_COLUMN_PROP, I as getColumnByProp, h as GROUP_EXPANDED, x as getParsedGroup, y as isSameGroup, G as GROUP_DEPTH, e as PSEUDO_GROUP_ITEM_VALUE, d as PSEUDO_GROUP_ITEM_ID, o as GROUPING_ROW_TYPE, p as getSource, f as PSEUDO_GROUP_COLUMN, s as gatherGrouping, m as GROUP_EXPAND_EVENT, v as isGroupingColumn, q as getExpanded, E as isColGrouping } from './column.service-
|
|
4
|
+
import { J as reduce, g as getRange, K as baseEach, C as getColumnType, c as columnTypes, L as toInteger, u as isGrouping, t as getGroupingName, r as rowTypes, B as getCellDataParsed, A as getCellRaw, j as GROUP_COLUMN_PROP, I as getColumnByProp, h as GROUP_EXPANDED, x as getParsedGroup, y as isSameGroup, G as GROUP_DEPTH, e as PSEUDO_GROUP_ITEM_VALUE, d as PSEUDO_GROUP_ITEM_ID, o as GROUPING_ROW_TYPE, p as getSource, f as PSEUDO_GROUP_COLUMN, s as gatherGrouping, m as GROUP_EXPAND_EVENT, v as isGroupingColumn, q as getExpanded, E as isColGrouping } from './column.service-C6hByxPy.js';
|
|
5
5
|
import { K as createStore, l as setStore, i as calculateDimensionData, L as identity, N as isArray, b as getSourceItem, g as getPhysical, e as setItems, j as getItemByPosition } from './dimension.helpers-CGKwSvw6.js';
|
|
6
6
|
import { j as calculateRowHeaderSize } from './viewport.store-_c579YyM.js';
|
|
7
7
|
import { g as getScrollbarSize, t as timeout } from './index-Db3qZoW5.js';
|
|
8
8
|
import { h } from './index-Chp_81rd.js';
|
|
9
9
|
import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-C8XTWPU2.js';
|
|
10
10
|
import { d as debounce } from './debounce-PCRWZliA.js';
|
|
11
|
-
import { O as ON_COLUMN_CLICK, d as dispatch } from './header-cell-renderer-
|
|
11
|
+
import { O as ON_COLUMN_CLICK, d as dispatch } from './header-cell-renderer-BMmXRsd_.js';
|
|
12
12
|
|
|
13
13
|
function calculateRealSize({ count, originItemSize, sizes, }) {
|
|
14
14
|
const safeCount = Math.max(0, count);
|
|
@@ -1416,7 +1416,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1416
1416
|
// filter button clicked, open filter dialog
|
|
1417
1417
|
const gridPos = this.revogrid.getBoundingClientRect();
|
|
1418
1418
|
const buttonPos = el.getBoundingClientRect();
|
|
1419
|
-
const data = Object.assign(Object.assign(Object.assign({}, e.detail), this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, filterTypes: this.getColumnFilter(e.detail.filter), filterItems: this.multiFilterItems, extraContent: this.extraHyperContent });
|
|
1419
|
+
const data = Object.assign(Object.assign(Object.assign({}, e.detail), this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, filterTypes: this.getColumnFilter(e.detail.filter), filterItems: this.multiFilterItems, extraContent: this.extraHyperContent, extraBottomContent: this.extraBottomHyperContent });
|
|
1420
1420
|
(_b = this.beforeshow) === null || _b === void 0 ? void 0 : _b.call(this, data);
|
|
1421
1421
|
this.pop.show(data);
|
|
1422
1422
|
}
|
|
@@ -2670,8 +2670,17 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
2670
2670
|
constructor(revogrid, providers) {
|
|
2671
2671
|
super(revogrid, providers);
|
|
2672
2672
|
this.moveFunc = debounce((e) => this.doMove(e), 5);
|
|
2673
|
+
this.preventHeaderClickAfterDrag = (event) => {
|
|
2674
|
+
if (!this.preventNextHeaderClick) {
|
|
2675
|
+
return;
|
|
2676
|
+
}
|
|
2677
|
+
this.preventNextHeaderClick = false;
|
|
2678
|
+
event.preventDefault();
|
|
2679
|
+
};
|
|
2673
2680
|
this.staticDragData = null;
|
|
2674
2681
|
this.dragData = null;
|
|
2682
|
+
this.columnDragMoved = false;
|
|
2683
|
+
this.preventNextHeaderClick = false;
|
|
2675
2684
|
this.localSubscriptions = {};
|
|
2676
2685
|
this.orderUi = new ColumnOrderHandler();
|
|
2677
2686
|
revogrid.appendChild(this.orderUi.render());
|
|
@@ -2690,11 +2699,13 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
2690
2699
|
callback: (e) => this.move(e),
|
|
2691
2700
|
};
|
|
2692
2701
|
this.addEventListener(COLUMN_CLICK, ({ detail }) => this.dragStart(detail));
|
|
2702
|
+
this.revogrid.addEventListener('beforeheaderclick', this.preventHeaderClickAfterDrag, { capture: true });
|
|
2693
2703
|
}
|
|
2694
2704
|
dragStart({ event, data }) {
|
|
2695
2705
|
if (event.defaultPrevented) {
|
|
2696
2706
|
return;
|
|
2697
2707
|
}
|
|
2708
|
+
this.preventNextHeaderClick = false;
|
|
2698
2709
|
const { defaultPrevented } = dispatch(this.revogrid, COLUMN_DRAG_START_EVENT, data);
|
|
2699
2710
|
// check if allowed to drag particulat column
|
|
2700
2711
|
if (defaultPrevented) {
|
|
@@ -2716,7 +2727,8 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
2716
2727
|
const cols = this.getDimension(data.pin || 'rgCol');
|
|
2717
2728
|
const gridRect = this.revogrid.getBoundingClientRect();
|
|
2718
2729
|
const elRect = dataEl.getBoundingClientRect();
|
|
2719
|
-
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left) +
|
|
2730
|
+
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left) +
|
|
2731
|
+
(cols.renderOffset || 0));
|
|
2720
2732
|
this.staticDragData = {
|
|
2721
2733
|
startPos: event.x,
|
|
2722
2734
|
startItem,
|
|
@@ -2747,10 +2759,14 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
2747
2759
|
if (rgCol.itemIndex >= this.staticDragData.cols.count) {
|
|
2748
2760
|
return;
|
|
2749
2761
|
}
|
|
2750
|
-
this.orderUi.showHandler(rgCol.
|
|
2762
|
+
this.orderUi.showHandler(getColumnDragPosition(rgCol, this.staticDragData.startItem, this.staticDragData.cols.renderOffset || 0, dragData.scrollOffset), dragData.gridRect.width);
|
|
2751
2763
|
}
|
|
2752
2764
|
}
|
|
2753
2765
|
move(e) {
|
|
2766
|
+
if (this.staticDragData &&
|
|
2767
|
+
Math.abs(this.staticDragData.startPos - e.x) > 10) {
|
|
2768
|
+
this.columnDragMoved = true;
|
|
2769
|
+
}
|
|
2754
2770
|
dispatch(this.revogrid, COLUMN_DRAG_MOVE_EVENT, e);
|
|
2755
2771
|
// then do move
|
|
2756
2772
|
this.moveFunc(e);
|
|
@@ -2759,6 +2775,7 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
2759
2775
|
this.clearOrder();
|
|
2760
2776
|
}
|
|
2761
2777
|
onMouseUp(e) {
|
|
2778
|
+
const suppressClick = this.columnDragMoved;
|
|
2762
2779
|
// apply new positions
|
|
2763
2780
|
if (this.dragData && this.staticDragData) {
|
|
2764
2781
|
let relativePos = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
|
|
@@ -2781,6 +2798,9 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
2781
2798
|
}
|
|
2782
2799
|
dispatch(this.revogrid, COLUMN_DRAG_END_EVENT, this.getData(this.staticDragData, newItems, source));
|
|
2783
2800
|
}
|
|
2801
|
+
if (suppressClick) {
|
|
2802
|
+
this.preventNextHeaderClick = !!e.target.closest('revogr-header');
|
|
2803
|
+
}
|
|
2784
2804
|
this.clearOrder();
|
|
2785
2805
|
}
|
|
2786
2806
|
clearLocalSubscriptions() {
|
|
@@ -2789,6 +2809,7 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
2789
2809
|
clearOrder() {
|
|
2790
2810
|
this.staticDragData = null;
|
|
2791
2811
|
this.dragData = null;
|
|
2812
|
+
this.columnDragMoved = false;
|
|
2792
2813
|
this.clearLocalSubscriptions();
|
|
2793
2814
|
this.orderUi.stop(this.revogrid);
|
|
2794
2815
|
}
|
|
@@ -2798,6 +2819,7 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
2798
2819
|
clearSubscriptions() {
|
|
2799
2820
|
super.clearSubscriptions();
|
|
2800
2821
|
this.clearLocalSubscriptions();
|
|
2822
|
+
this.revogrid.removeEventListener('beforeheaderclick', this.preventHeaderClickAfterDrag, { capture: true });
|
|
2801
2823
|
}
|
|
2802
2824
|
getData({ gridEl, dataEl, pin }, order, source = []) {
|
|
2803
2825
|
const gridRect = gridEl.getBoundingClientRect();
|
|
@@ -2819,5 +2841,11 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
2819
2841
|
function getLeftRelative(absoluteX, gridPos, offset) {
|
|
2820
2842
|
return absoluteX - gridPos - offset;
|
|
2821
2843
|
}
|
|
2844
|
+
function getColumnDragPosition(targetItem, startItem, renderOffset, scrollOffset) {
|
|
2845
|
+
const insertionEdge = startItem.itemIndex > targetItem.itemIndex
|
|
2846
|
+
? targetItem.start
|
|
2847
|
+
: targetItem.end;
|
|
2848
|
+
return insertionEdge - renderOffset + scrollOffset;
|
|
2849
|
+
}
|
|
2822
2850
|
|
|
2823
|
-
export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnAutoSizeMode as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, SelectionStore as S, StretchColumn as a, ExportCsv as b, FILTER_CONFIG_CHANGED_EVENT as c, FILTE_PANEL as d, FilterPlugin as e, filterCoreFunctionsIndexedByType as f, filterTypes as g, filterNames as h, isStretchPlugin as i, doCollapse as j, doExpand as k, COLUMN_DRAG_MOVE_EVENT as l, COLUMN_DRAG_END_EVENT as m, BEFORE_COLUMN_DRAG_END_EVENT as n, COLUMN_DRAG_START_EVENT as o, ColumnMovePlugin as p, getLeftRelative as q,
|
|
2851
|
+
export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnAutoSizeMode as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, SelectionStore as S, StretchColumn as a, ExportCsv as b, FILTER_CONFIG_CHANGED_EVENT as c, FILTE_PANEL as d, FilterPlugin as e, filterCoreFunctionsIndexedByType as f, filterTypes as g, filterNames as h, isStretchPlugin as i, doCollapse as j, doExpand as k, COLUMN_DRAG_MOVE_EVENT as l, COLUMN_DRAG_END_EVENT as m, BEFORE_COLUMN_DRAG_END_EVENT as n, COLUMN_DRAG_START_EVENT as o, ColumnMovePlugin as p, getLeftRelative as q, getColumnDragPosition as r, SortingPlugin as s, hasActiveSorting as t, getSortingIndex as u, sortIndexByItems as v, defaultCellCompare as w, descCellCompare as x, getNextOrder as y, getComparer as z };
|
|
@@ -817,43 +817,82 @@ class ColumnService {
|
|
|
817
817
|
mapping,
|
|
818
818
|
};
|
|
819
819
|
}
|
|
820
|
-
getTransformedDataToApply(start, data) {
|
|
820
|
+
getTransformedDataToApply({ start, data, targetRange, }) {
|
|
821
821
|
const changed = {};
|
|
822
822
|
const copyRowLength = data.length;
|
|
823
|
+
if (!copyRowLength) {
|
|
824
|
+
return {
|
|
825
|
+
changed,
|
|
826
|
+
range: null,
|
|
827
|
+
};
|
|
828
|
+
}
|
|
823
829
|
const colLength = this.columns.length;
|
|
824
830
|
const rowLength = this.dataStore.get('items').length;
|
|
831
|
+
const bounds = this.getDataApplyBounds(start, targetRange, copyRowLength, rowLength, colLength);
|
|
832
|
+
if (!bounds) {
|
|
833
|
+
return {
|
|
834
|
+
changed,
|
|
835
|
+
range: null,
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
const { startRow, startCol, endRow } = bounds;
|
|
839
|
+
let maxCol = startCol - 1;
|
|
840
|
+
let lastRow = startRow - 1;
|
|
825
841
|
// rows
|
|
826
|
-
let rowIndex =
|
|
827
|
-
let maxCol = 0;
|
|
828
|
-
for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
|
|
842
|
+
for (let rowIndex = startRow, i = 0; rowIndex <= endRow; rowIndex++, i++) {
|
|
829
843
|
// copy original data link
|
|
830
844
|
const copyRow = data[i % copyRowLength];
|
|
831
845
|
const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
|
|
835
|
-
const p = this.columns[colIndex].prop;
|
|
836
|
-
const currentCol = j % colLength;
|
|
837
|
-
/** if can write */
|
|
838
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
839
|
-
/** to show before save */
|
|
840
|
-
if (!changed[rowIndex]) {
|
|
841
|
-
changed[rowIndex] = {};
|
|
842
|
-
}
|
|
843
|
-
changed[rowIndex][p] = copyRow[currentCol];
|
|
844
|
-
}
|
|
846
|
+
if (!copyColLength) {
|
|
847
|
+
continue;
|
|
845
848
|
}
|
|
846
|
-
maxCol = Math.max(maxCol,
|
|
849
|
+
maxCol = Math.max(maxCol, this.applyClipboardRow(changed, {
|
|
850
|
+
bounds,
|
|
851
|
+
copyColLength,
|
|
852
|
+
copyRow,
|
|
853
|
+
rowIndex,
|
|
854
|
+
start,
|
|
855
|
+
targetRange,
|
|
856
|
+
}));
|
|
857
|
+
lastRow = rowIndex;
|
|
847
858
|
}
|
|
848
|
-
const range = getRange(start, {
|
|
849
|
-
y: rowIndex - 1,
|
|
850
|
-
x: maxCol,
|
|
851
|
-
});
|
|
852
859
|
return {
|
|
853
860
|
changed,
|
|
854
|
-
range,
|
|
861
|
+
range: this.getAppliedRange(bounds, lastRow, maxCol),
|
|
855
862
|
};
|
|
856
863
|
}
|
|
864
|
+
getDataApplyBounds(start, targetRange, copyRowLength, rowLength, colLength) {
|
|
865
|
+
var _a, _b, _c;
|
|
866
|
+
const startRow = (_a = targetRange === null || targetRange === void 0 ? void 0 : targetRange.y) !== null && _a !== void 0 ? _a : start.y;
|
|
867
|
+
const startCol = (_b = targetRange === null || targetRange === void 0 ? void 0 : targetRange.x) !== null && _b !== void 0 ? _b : start.x;
|
|
868
|
+
const endRow = Math.min(rowLength - 1, (_c = targetRange === null || targetRange === void 0 ? void 0 : targetRange.y1) !== null && _c !== void 0 ? _c : start.y + copyRowLength - 1);
|
|
869
|
+
if (endRow < startRow || startCol >= colLength) {
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
return { startRow, startCol, endRow, colLength };
|
|
873
|
+
}
|
|
874
|
+
applyClipboardRow(changed, { bounds, copyColLength, copyRow, rowIndex, start, targetRange, }) {
|
|
875
|
+
var _a;
|
|
876
|
+
const endCol = Math.min(bounds.colLength - 1, (_a = targetRange === null || targetRange === void 0 ? void 0 : targetRange.x1) !== null && _a !== void 0 ? _a : start.x + copyColLength - 1);
|
|
877
|
+
for (let colIndex = bounds.startCol, j = 0; colIndex <= endCol; colIndex++, j++) {
|
|
878
|
+
if (this.isReadOnly(rowIndex, colIndex)) {
|
|
879
|
+
continue;
|
|
880
|
+
}
|
|
881
|
+
const prop = this.columns[colIndex].prop;
|
|
882
|
+
changed[rowIndex] = changed[rowIndex] || {};
|
|
883
|
+
changed[rowIndex][prop] = copyRow[j % copyColLength];
|
|
884
|
+
}
|
|
885
|
+
return endCol;
|
|
886
|
+
}
|
|
887
|
+
getAppliedRange({ startRow, startCol }, lastRow, maxCol) {
|
|
888
|
+
if (lastRow < startRow || maxCol < startCol) {
|
|
889
|
+
return null;
|
|
890
|
+
}
|
|
891
|
+
return getRange({ x: startCol, y: startRow }, {
|
|
892
|
+
y: lastRow,
|
|
893
|
+
x: maxCol,
|
|
894
|
+
});
|
|
895
|
+
}
|
|
857
896
|
getRangeStaticData(d, value) {
|
|
858
897
|
const changed = {};
|
|
859
898
|
// rows
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
4
|
import { h } from './index-Chp_81rd.js';
|
|
5
|
-
import { Q as doPropMerge } from './column.service-
|
|
5
|
+
import { Q as doPropMerge } from './column.service-C6hByxPy.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Dispatches a custom event to a specified target element.
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
export { o as GROUPING_ROW_TYPE, j as GROUP_COLUMN_PROP, G as GROUP_DEPTH, h as GROUP_EXPANDED, l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, k as GROUP_ORIGINAL_INDEX, f as PSEUDO_GROUP_COLUMN, P as PSEUDO_GROUP_ITEM, d as PSEUDO_GROUP_ITEM_ID, e as PSEUDO_GROUP_ITEM_VALUE, c as columnTypes, a as cropCellToMax, H as gatherGroup, s as gatherGrouping, z as getCellData, B as getCellDataParsed, A as getCellRaw, I as getColumnByProp, D as getColumnSizes, C as getColumnType, F as getColumns, q as getExpanded, t as getGroupingName, x as getParsedGroup, g as getRange, p as getSource, E as isColGrouping, u as isGrouping, v as isGroupingColumn, b as isRangeSingleCell, i as isRowType, y as isSameGroup, w as measureEqualDepth, n as nextCell, r as rowTypes } from './column.service-
|
|
5
|
-
import { B as BasePlugin } from './column.drag.plugin-
|
|
6
|
-
export { A as AutoSizeColumnPlugin, n as BEFORE_COLUMN_DRAG_END_EVENT, m as COLUMN_DRAG_END_EVENT, l as COLUMN_DRAG_MOVE_EVENT, o as COLUMN_DRAG_START_EVENT, C as ColumnAutoSizeMode, p as ColumnMovePlugin, D as DimensionStore, b as ExportCsv, E as ExportFilePlugin, c as FILTER_CONFIG_CHANGED_EVENT, F as FILTER_TRIMMED_TYPE, d as FILTE_PANEL, e as FilterPlugin, G as GroupingRowPlugin, S as SelectionStore,
|
|
7
|
-
export { d as dispatch, a as dispatchByEvent } from './header-cell-renderer-
|
|
8
|
-
export { C as CellRenderer, G as GroupingRowRenderer, S as SortingSign, e as expandEvent, a as expandSvgIconVNode } from './cell-renderer-
|
|
4
|
+
export { o as GROUPING_ROW_TYPE, j as GROUP_COLUMN_PROP, G as GROUP_DEPTH, h as GROUP_EXPANDED, l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, k as GROUP_ORIGINAL_INDEX, f as PSEUDO_GROUP_COLUMN, P as PSEUDO_GROUP_ITEM, d as PSEUDO_GROUP_ITEM_ID, e as PSEUDO_GROUP_ITEM_VALUE, c as columnTypes, a as cropCellToMax, H as gatherGroup, s as gatherGrouping, z as getCellData, B as getCellDataParsed, A as getCellRaw, I as getColumnByProp, D as getColumnSizes, C as getColumnType, F as getColumns, q as getExpanded, t as getGroupingName, x as getParsedGroup, g as getRange, p as getSource, E as isColGrouping, u as isGrouping, v as isGroupingColumn, b as isRangeSingleCell, i as isRowType, y as isSameGroup, w as measureEqualDepth, n as nextCell, r as rowTypes } from './column.service-C6hByxPy.js';
|
|
5
|
+
import { B as BasePlugin } from './column.drag.plugin-V9DDE3mU.js';
|
|
6
|
+
export { A as AutoSizeColumnPlugin, n as BEFORE_COLUMN_DRAG_END_EVENT, m as COLUMN_DRAG_END_EVENT, l as COLUMN_DRAG_MOVE_EVENT, o as COLUMN_DRAG_START_EVENT, C as ColumnAutoSizeMode, p as ColumnMovePlugin, D as DimensionStore, b as ExportCsv, E as ExportFilePlugin, c as FILTER_CONFIG_CHANGED_EVENT, F as FILTER_TRIMMED_TYPE, d as FILTE_PANEL, e as FilterPlugin, G as GroupingRowPlugin, S as SelectionStore, s as SortingPlugin, a as StretchColumn, w as defaultCellCompare, x as descCellCompare, j as doCollapse, k as doExpand, f as filterCoreFunctionsIndexedByType, h as filterNames, g as filterTypes, r as getColumnDragPosition, z as getComparer, q as getLeftRelative, y as getNextOrder, u as getSortingIndex, t as hasActiveSorting, i as isStretchPlugin, v as sortIndexByItems } from './column.drag.plugin-V9DDE3mU.js';
|
|
7
|
+
export { d as dispatch, a as dispatchByEvent } from './header-cell-renderer-BMmXRsd_.js';
|
|
8
|
+
export { C as CellRenderer, G as GroupingRowRenderer, S as SortingSign, e as expandEvent, a as expandSvgIconVNode } from './cell-renderer-CdF2Jm3B.js';
|
|
9
9
|
export { a as applyMixins, f as findPositionInArray, g as getScrollbarSize, m as mergeSortedArray, p as pushSorted, r as range, s as scaleValue, t as timeout } from './index-Db3qZoW5.js';
|
|
10
10
|
export { T as TextEditor } from './text-editor-C3RUSwH5.js';
|
|
11
11
|
export { k as isAll, c as isClear, h as isCopy, a as isCtrlKey, b as isCtrlMetaKey, g as isCut, m as isEditInput, n as isEditorCtrConstructible, f as isEnterKeyValue, i as isMetaKey, j as isPaste, l as isShortcutModifier, d as isTab, e as isTabKeyValue } from './edit.utils-Dnnbd0xG.js';
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
4
|
import { h, r as registerInstance, d as createEvent, e as Host, g as getElement } from './index-Chp_81rd.js';
|
|
5
|
-
import { c as columnTypes, J as reduce, C as getColumnType, r as rowTypes, i as isRowType, D as getColumnSizes, a as cropCellToMax, n as nextCell, I as getColumnByProp, F as getColumns } from './column.service-
|
|
5
|
+
import { c as columnTypes, J as reduce, C as getColumnType, r as rowTypes, i as isRowType, D as getColumnSizes, a as cropCellToMax, n as nextCell, I as getColumnByProp, F as getColumns } from './column.service-C6hByxPy.js';
|
|
6
6
|
import { D as DataStore, b as getSourceItem, f as getSourceItemVirtualIndexByProp, d as setSourceByPhysicalIndex, s as setSourceByVirtualIndex, a as getVisibleSourceItem, h as gatherTrimmedItems, k as getItemByIndex, R as RESIZE_INTERVAL } from './dimension.helpers-CGKwSvw6.js';
|
|
7
7
|
import { d as debounce } from './debounce-PCRWZliA.js';
|
|
8
8
|
import { g as getScrollDimension, v as viewportDataPartition, F as FOOTER_SLOT, C as CONTENT_SLOT, H as HEADER_SLOT, D as DATA_SLOT } from './viewport.helpers-CoCAvmZs.js';
|
|
9
|
-
import { D as DimensionStore, S as SelectionStore, B as BasePlugin, G as GroupingRowPlugin, a as StretchColumn, i as isStretchPlugin, A as AutoSizeColumnPlugin, e as FilterPlugin, E as ExportFilePlugin,
|
|
9
|
+
import { D as DimensionStore, S as SelectionStore, B as BasePlugin, G as GroupingRowPlugin, a as StretchColumn, i as isStretchPlugin, A as AutoSizeColumnPlugin, e as FilterPlugin, E as ExportFilePlugin, s as SortingPlugin, p as ColumnMovePlugin } from './column.drag.plugin-V9DDE3mU.js';
|
|
10
10
|
import { V as ViewportStore } from './viewport.store-_c579YyM.js';
|
|
11
11
|
import { T as ThemeService } from './theme.service-BmnDvr6P.js';
|
|
12
12
|
import { t as timeout } from './index-Db3qZoW5.js';
|
|
13
13
|
import { g as getPropertyFromEvent } from './events-BvSmBueA.js';
|
|
14
14
|
import './filter.button-C8XTWPU2.js';
|
|
15
|
-
import './header-cell-renderer-
|
|
15
|
+
import './header-cell-renderer-BMmXRsd_.js';
|
|
16
16
|
|
|
17
17
|
class ColumnDataProvider {
|
|
18
18
|
get stores() {
|
|
@@ -1445,7 +1445,7 @@ const RevoGridComponent = class {
|
|
|
1445
1445
|
this.rowSize = 0;
|
|
1446
1446
|
/** Indicates default column size. */
|
|
1447
1447
|
this.colSize = 100;
|
|
1448
|
-
/** When true, user can range
|
|
1448
|
+
/** When true, user can select a cell range. Required for range-based clipboard fill. */
|
|
1449
1449
|
this.range = false;
|
|
1450
1450
|
/** When true, grid in read only mode. */
|
|
1451
1451
|
this.readonly = false;
|
|
@@ -1457,7 +1457,7 @@ const RevoGridComponent = class {
|
|
|
1457
1457
|
this.noHorizontalScrollTransfer = false;
|
|
1458
1458
|
/** When true cell focus appear. */
|
|
1459
1459
|
this.canFocus = true;
|
|
1460
|
-
/** When true enable clipboard. */
|
|
1460
|
+
/** When true enable clipboard. Can be boolean or clipboard config. */
|
|
1461
1461
|
this.useClipboard = true;
|
|
1462
1462
|
/**
|
|
1463
1463
|
* Columns - defines an array of grid columns.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { r as registerInstance, h, e as Host, d as createEvent, g as getElement } from './index-Chp_81rd.js';
|
|
5
5
|
import { k as getItemByIndex, b as getSourceItem, j as getItemByPosition, F as FOCUS_CLASS, I as codesLetter, R as RESIZE_INTERVAL, y as MOBILE_CLASS, z as CELL_HANDLER_CLASS, S as SELECTION_BORDER_CLASS, D as DataStore, q as ROW_HEADER_TYPE, T as TMP_SELECTION_BG_CLASS } from './dimension.helpers-CGKwSvw6.js';
|
|
6
6
|
import { g as getPropertyFromEvent, v as verifyTouchTarget } from './events-BvSmBueA.js';
|
|
7
|
-
import { g as getRange, M as ColumnService, z as getCellData, N as getCellEditor, b as isRangeSingleCell } from './column.service-
|
|
7
|
+
import { g as getRange, M as ColumnService, z as getCellData, N as getCellEditor, b as isRangeSingleCell } from './column.service-C6hByxPy.js';
|
|
8
8
|
import { l as isShortcutModifier, m as isEditInput, c as isClear, d as isTab, f as isEnterKeyValue, h as isCopy, g as isCut, j as isPaste, k as isAll } from './edit.utils-Dnnbd0xG.js';
|
|
9
9
|
import { t as timeout, g as getScrollbarSize } from './index-Db3qZoW5.js';
|
|
10
10
|
import { d as debounce } from './debounce-PCRWZliA.js';
|
|
@@ -649,6 +649,30 @@ class AutoFillService {
|
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
|
|
652
|
+
function getRangeFillClipboardData(data, useClipboard) {
|
|
653
|
+
var _a;
|
|
654
|
+
if (!isClipboardRangeFillEnabled(useClipboard)) {
|
|
655
|
+
return null;
|
|
656
|
+
}
|
|
657
|
+
const normalized = trimTrailingEmptyClipboardRows(data);
|
|
658
|
+
return normalized.length === 1 && ((_a = normalized[0]) === null || _a === void 0 ? void 0 : _a.length) === 1
|
|
659
|
+
? normalized
|
|
660
|
+
: null;
|
|
661
|
+
}
|
|
662
|
+
function isClipboardRangeFillEnabled(useClipboard) {
|
|
663
|
+
return (typeof useClipboard === 'object' && useClipboard.rangeFill === true);
|
|
664
|
+
}
|
|
665
|
+
function trimTrailingEmptyClipboardRows(data) {
|
|
666
|
+
const rows = [...data];
|
|
667
|
+
while (rows.length > 1 && isEmptyClipboardRow(rows[rows.length - 1])) {
|
|
668
|
+
rows.pop();
|
|
669
|
+
}
|
|
670
|
+
return rows;
|
|
671
|
+
}
|
|
672
|
+
function isEmptyClipboardRow(row) {
|
|
673
|
+
return !row || row.every(cell => cell === '');
|
|
674
|
+
}
|
|
675
|
+
|
|
652
676
|
const revogrOverlayStyleCss = () => `revogr-overlay-selection{display:block;position:relative;width:100%}revogr-overlay-selection .autofill-handle{position:absolute;width:14px;height:14px;margin-left:-13px;margin-top:-13px;z-index:10;cursor:crosshair}revogr-overlay-selection .autofill-handle::before{content:"";position:absolute;right:0;bottom:0;width:10px;height:10px;background:#0d63e8;border:1px solid white;box-sizing:border-box}revogr-overlay-selection.mobile .autofill-handle{position:absolute;width:30px;height:30px;margin-left:-29px;margin-top:-29px;z-index:10;cursor:crosshair}revogr-overlay-selection.mobile .autofill-handle::before{content:"";position:absolute;right:0;bottom:0;width:12px;height:12px;background:#0d63e8;border:1px solid white;box-sizing:border-box}revogr-overlay-selection .selection-border-range{position:absolute;pointer-events:none;z-index:9;box-shadow:-1px 0 0 #0d63e8 inset, 1px 0 0 #0d63e8 inset, 0 -1px 0 #0d63e8 inset, 0 1px 0 #0d63e8 inset}revogr-overlay-selection .selection-border-range .range-handlers{height:100%;background-color:transparent;width:75%;max-width:50px;min-width:20px;left:50%;transform:translateX(-50%);position:absolute}revogr-overlay-selection .selection-border-range .range-handlers>span{pointer-events:auto;height:20px;width:20px;position:absolute;left:50%;transform:translateX(-50%)}revogr-overlay-selection .selection-border-range .range-handlers>span:before,revogr-overlay-selection .selection-border-range .range-handlers>span:after{position:absolute;border-radius:5px;width:15px;height:5px;left:50%;transform:translateX(-50%);background-color:rgba(0, 0, 0, 0.2)}revogr-overlay-selection .selection-border-range .range-handlers>span:first-child{top:-7px}revogr-overlay-selection .selection-border-range .range-handlers>span:first-child:before{content:"";top:0}revogr-overlay-selection .selection-border-range .range-handlers>span:last-child{bottom:-7px}revogr-overlay-selection .selection-border-range .range-handlers>span:last-child:after{content:"";bottom:0}revogr-overlay-selection revogr-edit{z-index:10}`;
|
|
653
677
|
|
|
654
678
|
const OverlaySelection = class {
|
|
@@ -896,9 +920,9 @@ const OverlaySelection = class {
|
|
|
896
920
|
nodes.push(h("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, rowType: this.types.rowType, onRowdragstartinit: e => this.rowDragStart(e) }));
|
|
897
921
|
}
|
|
898
922
|
}
|
|
899
|
-
return (h(Host, { key: '
|
|
923
|
+
return (h(Host, { key: 'ff303c39d59e4ef217421fa11b9a80de07311b07', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true), onCloseedit: (e) => this.closeEdit(e),
|
|
900
924
|
// it's done to be able to throw events from different levels, not just from editor
|
|
901
|
-
onCelledit: (e) => this.onEditCell(e) }, nodes, h("slot", { key: '
|
|
925
|
+
onCelledit: (e) => this.onEditCell(e) }, nodes, h("slot", { key: '3cbe4c3ad7d447f779e9e20f73eec2e3107275e0', name: "data" })));
|
|
902
926
|
}
|
|
903
927
|
/**
|
|
904
928
|
* Executes the focus operation on the specified range of cells.
|
|
@@ -1063,13 +1087,25 @@ const OverlaySelection = class {
|
|
|
1063
1087
|
if (!focus || isEditing) {
|
|
1064
1088
|
return;
|
|
1065
1089
|
}
|
|
1066
|
-
|
|
1090
|
+
const rangeFillData = getRangeFillClipboardData(data, this.useClipboard);
|
|
1091
|
+
const targetRange = rangeFillData
|
|
1092
|
+
? this.getClipboardPasteTargetRange()
|
|
1093
|
+
: null;
|
|
1094
|
+
let { changed, range } = this.columnService.getTransformedDataToApply({
|
|
1095
|
+
start: focus,
|
|
1096
|
+
data: rangeFillData || data,
|
|
1097
|
+
targetRange,
|
|
1098
|
+
});
|
|
1067
1099
|
const { defaultPrevented: canPaste } = this.rangeClipboardPaste.emit(Object.assign({ data: changed, models: collectModelsOfRange(changed, this.dataStore), range }, this.types));
|
|
1068
1100
|
if (canPaste) {
|
|
1069
1101
|
return;
|
|
1070
1102
|
}
|
|
1071
1103
|
(_a = this.autoFillService) === null || _a === void 0 ? void 0 : _a.onRangeApply(changed, range, range);
|
|
1072
1104
|
}
|
|
1105
|
+
getClipboardPasteTargetRange() {
|
|
1106
|
+
const range = this.selectionStore.get('range');
|
|
1107
|
+
return range && !isRangeSingleCell(range) ? range : null;
|
|
1108
|
+
}
|
|
1073
1109
|
async focusNext() {
|
|
1074
1110
|
var _a;
|
|
1075
1111
|
const canFocus = await ((_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyChangeSelection(new KeyboardEvent('keydown', {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
4
|
import { r as registerInstance, d as createEvent, h, e as Host, g as getElement } from './index-Chp_81rd.js';
|
|
5
|
-
import { M as ColumnService, u as isGrouping } from './column.service-
|
|
5
|
+
import { M as ColumnService, u as isGrouping } from './column.service-C6hByxPy.js';
|
|
6
6
|
import { B as ROW_FOCUSED_CLASS, b as getSourceItem, n as DATA_ROW, m as DATA_COL, M as MIN_COL_SIZE, r as HEADER_SORTABLE_CLASS, H as HEADER_CLASS, F as FOCUS_CLASS, k as getItemByIndex, u as HEADER_ROW_CLASS, v as HEADER_ACTUAL_ROW_CLASS } from './dimension.helpers-CGKwSvw6.js';
|
|
7
|
-
import { G as GroupingRowRenderer, C as CellRenderer, R as RowRenderer, P as PADDING_DEPTH, S as SortingSign } from './cell-renderer-
|
|
7
|
+
import { G as GroupingRowRenderer, C as CellRenderer, R as RowRenderer, P as PADDING_DEPTH, S as SortingSign } from './cell-renderer-CdF2Jm3B.js';
|
|
8
8
|
import { c as FilterButton } from './filter.button-C8XTWPU2.js';
|
|
9
|
-
import { H as HeaderCellRenderer } from './header-cell-renderer-
|
|
9
|
+
import { H as HeaderCellRenderer } from './header-cell-renderer-BMmXRsd_.js';
|
|
10
10
|
import { t as throttle, L as LocalScrollTimer, a as LocalScrollService, g as getContentSize } from './throttle-CaUDyxyU.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';
|
|
@@ -346,7 +346,7 @@ const FilterPanel = class {
|
|
|
346
346
|
} }));
|
|
347
347
|
}
|
|
348
348
|
render() {
|
|
349
|
-
var _a, _b, _c;
|
|
349
|
+
var _a, _b, _c, _d, _e;
|
|
350
350
|
if (!this.changes) {
|
|
351
351
|
return h(Host, { style: { display: 'none' } });
|
|
352
352
|
}
|
|
@@ -363,7 +363,7 @@ const FilterPanel = class {
|
|
|
363
363
|
h("label", null, capts.title),
|
|
364
364
|
h("div", { class: "filter-holder" }, this.getFilterItemsList()),
|
|
365
365
|
h("div", { class: "add-filter" }, h("select", { id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType)))
|
|
366
|
-
]), h("slot", null), h("div", { class: "filter-actions" }, this.disableDynamicFiltering && [
|
|
366
|
+
]), h("slot", null), ((_e = (_d = this.changes).extraBottomContent) === null || _e === void 0 ? void 0 : _e.call(_d, this.changes)) || '', h("div", { class: "filter-actions" }, this.disableDynamicFiltering && [
|
|
367
367
|
h("button", { id: "revo-button-save", "aria-label": "save", class: "revo-button green", onClick: () => this.onSave() }, capts.save),
|
|
368
368
|
h("button", { id: "revo-button-ok", "aria-label": "ok", class: "revo-button green", onClick: () => this.onCancel() }, capts.cancel),
|
|
369
369
|
], !this.disableDynamicFiltering && [
|