@revolist/revogrid 4.22.1 → 4.23.0
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-BQdEGQXP.js → cell-renderer-DWJ9Px9f.js} +9 -3
- package/dist/cjs/{column.drag.plugin-RDjQhKCH.js → column.drag.plugin-CaEBDG-Q.js} +391 -256
- package/dist/cjs/{column.service-DXYMehqK.js → column.service-f612L4ql.js} +1 -1
- package/dist/cjs/{dimension.helpers-CiiNnlLa.js → dimension.helpers-B9HgANnM.js} +14 -145
- package/dist/cjs/{edit.utils-CecCfA4E.js → edit.utils-pKeiYFLJ.js} +1 -1
- package/dist/cjs/{header-cell-renderer-DGyBrK8I.js → header-cell-renderer-4yq9_WbM.js} +1 -1
- package/dist/cjs/index-DxaSE5uZ.js +136 -0
- package/dist/cjs/index.cjs.js +37 -32
- package/dist/cjs/revo-grid.cjs.entry.js +35 -15
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +43 -25
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +10 -8
- package/dist/cjs/revogr-data_4.cjs.entry.js +26 -17
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -1
- package/dist/cjs/{text-editor-DnLZW1a-.js → text-editor-B4W-m-r-.js} +3 -3
- package/dist/cjs/{throttle-CfgQFkfR.js → throttle-BCwEuJJq.js} +59 -24
- package/dist/cjs/viewport.helpers-BND76K2j.js +140 -0
- package/dist/cjs/{viewport.store-q6YdR9mg.js → viewport.store-BlKQ4x9H.js} +16 -16
- package/dist/collection/components/data/revogr-data.js +5 -3
- package/dist/collection/components/header/header-group-renderer.js +1 -1
- package/dist/collection/components/header/header-renderer.js +1 -1
- package/dist/collection/components/header/revogr-header-style.css +13 -3
- package/dist/collection/components/header/revogr-header.js +5 -2
- package/dist/collection/components/order/order-row.service.js +6 -5
- package/dist/collection/components/overlay/keyboard.service.js +23 -1
- package/dist/collection/components/overlay/selection.utils.js +8 -6
- package/dist/collection/components/revoGrid/revo-grid.js +6 -5
- package/dist/collection/components/revoGrid/viewport.service.js +2 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +10 -6
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +4 -10
- package/dist/collection/plugins/filter/filter.panel.js +2 -1
- package/dist/collection/plugins/filter/filter.plugin.js +11 -4
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +25 -1
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js +4 -4
- package/dist/collection/plugins/sorting/sorting.func.js +173 -15
- package/dist/collection/plugins/sorting/sorting.plugin.js +167 -84
- package/dist/collection/plugins/sorting/sorting.sign.js +7 -1
- package/dist/collection/serve/controller.js +98 -37
- package/dist/collection/serve/data.js +273 -144
- package/dist/collection/services/dimension.provider.js +16 -1
- package/dist/collection/services/local.scroll.service.js +59 -24
- package/dist/collection/services/scroll.dimension.helpers.js +83 -0
- package/dist/collection/services/selection.store.connector.js +4 -1
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js +22 -9
- package/dist/collection/store/dimension/dimension.store.js +4 -2
- package/dist/collection/store/vp/viewport.helpers.js +9 -0
- package/dist/collection/store/vp/viewport.store.js +5 -16
- package/dist/collection/utils/store.utils.js +3 -3
- package/dist/{revo-grid/cell-renderer-CALsEsnh.js → esm/cell-renderer-8UiGd-s7.js} +9 -3
- package/dist/esm/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-BsfhsfmB.js} +388 -255
- package/dist/esm/{column.service-CCvAi5l4.js → column.service-DbpulTog.js} +1 -1
- package/dist/{revo-grid/debounce-BfO9dz9v.js → esm/debounce-PCRWZliA.js} +1 -1
- package/dist/{revo-grid/dimension.helpers-DmIvjIa7.js → esm/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/esm/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
- package/dist/{revo-grid/header-cell-renderer-DU8wKAbg.js → esm/header-cell-renderer-DGI2FAD8.js} +1 -1
- package/dist/esm/index-Db3qZoW5.js +127 -0
- package/dist/esm/index.js +11 -10
- package/dist/esm/revo-grid.entry.js +34 -14
- package/dist/esm/revogr-attribution_7.entry.js +42 -24
- package/dist/esm/revogr-clipboard_3.entry.js +11 -9
- package/dist/esm/revogr-data_4.entry.js +27 -18
- package/dist/esm/revogr-filter-panel.entry.js +3 -2
- package/dist/esm/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/esm/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/esm/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{revo-grid/viewport.store-CFjDW-3l.js → esm/viewport.store-COAfzAyu.js} +15 -17
- package/dist/{esm/cell-renderer-CALsEsnh.js → revo-grid/cell-renderer-8UiGd-s7.js} +9 -3
- package/dist/revo-grid/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-BsfhsfmB.js} +388 -255
- package/dist/revo-grid/{column.service-CCvAi5l4.js → column.service-DbpulTog.js} +1 -1
- package/dist/{esm/debounce-BfO9dz9v.js → revo-grid/debounce-PCRWZliA.js} +1 -1
- package/dist/{esm/dimension.helpers-DmIvjIa7.js → revo-grid/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/revo-grid/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
- package/dist/{esm/header-cell-renderer-DU8wKAbg.js → revo-grid/header-cell-renderer-DGI2FAD8.js} +1 -1
- package/dist/revo-grid/index-Db3qZoW5.js +127 -0
- package/dist/revo-grid/index.esm.js +11 -10
- package/dist/revo-grid/revo-grid.entry.js +34 -14
- package/dist/revo-grid/revogr-attribution_7.entry.js +42 -24
- package/dist/revo-grid/revogr-clipboard_3.entry.js +11 -9
- package/dist/revo-grid/revogr-data_4.entry.js +27 -18
- package/dist/revo-grid/revogr-filter-panel.entry.js +3 -2
- package/dist/revo-grid/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/revo-grid/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/revo-grid/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{esm/viewport.store-CFjDW-3l.js → revo-grid/viewport.store-COAfzAyu.js} +15 -17
- package/dist/types/components/header/header-group-renderer.d.ts +1 -0
- package/dist/types/components/header/header-renderer.d.ts +1 -0
- package/dist/types/components/overlay/keyboard.service.d.ts +5 -0
- package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +8 -0
- package/dist/types/plugins/sorting/sorting.func.d.ts +25 -2
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +84 -9
- package/dist/types/plugins/sorting/sorting.sign.d.ts +5 -1
- package/dist/types/plugins/sorting/sorting.types.d.ts +46 -1
- package/dist/types/services/local.scroll.service.d.ts +10 -2
- package/dist/types/services/scroll.dimension.helpers.d.ts +20 -0
- package/dist/types/store/vp/viewport.helpers.d.ts +2 -0
- package/dist/types/types/interfaces.d.ts +11 -0
- package/hydrate/index.js +649 -365
- package/hydrate/index.mjs +649 -365
- package/package.json +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +1 -1
- package/standalone/debounce.js +1 -1
- package/standalone/dimension.helpers.js +1 -1
- package/standalone/index.js +1 -1
- package/standalone/local.scroll.timer.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
- package/standalone/revogr-header2.js +1 -1
- package/standalone/revogr-order-editor2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +1 -1
- package/standalone/revogr-row-headers.js +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/revogr-scroll-virtual2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
- package/standalone/selection.utils.js +1 -1
- package/standalone/throttle.js +1 -1
- package/standalone/toNumber.js +1 -1
- package/dist/cjs/viewport.helpers-BAovztDd.js +0 -58
- package/dist/esm/viewport.helpers-VXhsJZtn.js +0 -52
- package/dist/revo-grid/viewport.helpers-VXhsJZtn.js +0 -52
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
var dimension_helpers = require('./dimension.helpers-
|
|
6
|
+
var dimension_helpers = require('./dimension.helpers-B9HgANnM.js');
|
|
7
7
|
|
|
8
8
|
const LETTER_BLOCK_SIZE = 10;
|
|
9
9
|
const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
|
|
@@ -11,6 +11,15 @@ const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) =>
|
|
|
11
11
|
Math.max((itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE, minWidth));
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
function getViewportMaxCoordinate(dimension, viewportSize, frameOffset = 1) {
|
|
15
|
+
if (!viewportSize || dimension.realSize <= viewportSize) {
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
return Math.max(0, dimension.realSize - viewportSize - dimension.originItemSize * frameOffset);
|
|
19
|
+
}
|
|
20
|
+
function clampViewportCoordinate(coordinate, dimension, viewportSize, frameOffset = 1) {
|
|
21
|
+
return Math.min(Math.max(0, coordinate), getViewportMaxCoordinate(dimension, viewportSize, frameOffset));
|
|
22
|
+
}
|
|
14
23
|
/**
|
|
15
24
|
* Update items based on new scroll position
|
|
16
25
|
* If viewport wasn't changed fully simple recombination of positions
|
|
@@ -276,6 +285,8 @@ function initialState() {
|
|
|
276
285
|
realCount: 0,
|
|
277
286
|
// size of viewport in px
|
|
278
287
|
clientSize: 0,
|
|
288
|
+
// logical-to-physical render offset used when scroll space is compressed
|
|
289
|
+
renderOffset: 0,
|
|
279
290
|
};
|
|
280
291
|
}
|
|
281
292
|
/**
|
|
@@ -311,21 +322,8 @@ class ViewportStore {
|
|
|
311
322
|
const outsize = singleOffsetInPx * 2;
|
|
312
323
|
// math virtual size is based on visible area + 2 items outside of visible area
|
|
313
324
|
const virtualSize = viewportSize + outsize;
|
|
314
|
-
|
|
315
|
-
let
|
|
316
|
-
// if there is nodes outside of viewport, max coordinate has to be adjusted
|
|
317
|
-
if (dimension.realSize > viewportSize) {
|
|
318
|
-
// max coordinate is real size minus virtual/rendered space
|
|
319
|
-
maxCoordinate = dimension.realSize - viewportSize - singleOffsetInPx;
|
|
320
|
-
}
|
|
321
|
-
let pos = position;
|
|
322
|
-
// limit position to max and min coordinates
|
|
323
|
-
if (pos < 0) {
|
|
324
|
-
pos = 0;
|
|
325
|
-
}
|
|
326
|
-
else if (pos > maxCoordinate) {
|
|
327
|
-
pos = maxCoordinate;
|
|
328
|
-
}
|
|
325
|
+
const maxCoordinate = getViewportMaxCoordinate(dimension, viewportSize, frameOffset);
|
|
326
|
+
let pos = clampViewportCoordinate(position, dimension, viewportSize, frameOffset);
|
|
329
327
|
// store last coordinate for further restore on redraw
|
|
330
328
|
this.lastCoordinate = pos;
|
|
331
329
|
// actual position is less than first item start based on offset
|
|
@@ -406,10 +404,12 @@ class ViewportStore {
|
|
|
406
404
|
exports.ViewportStore = ViewportStore;
|
|
407
405
|
exports.addMissingItems = addMissingItems;
|
|
408
406
|
exports.calculateRowHeaderSize = calculateRowHeaderSize;
|
|
407
|
+
exports.clampViewportCoordinate = clampViewportCoordinate;
|
|
409
408
|
exports.getFirstItem = getFirstItem;
|
|
410
409
|
exports.getItems = getItems;
|
|
411
410
|
exports.getLastItem = getLastItem;
|
|
412
411
|
exports.getUpdatedItemsByPosition = getUpdatedItemsByPosition;
|
|
412
|
+
exports.getViewportMaxCoordinate = getViewportMaxCoordinate;
|
|
413
413
|
exports.isActiveRange = isActiveRange;
|
|
414
414
|
exports.isActiveRangeOutsideLastItem = isActiveRangeOutsideLastItem;
|
|
415
415
|
exports.recombineByOffset = recombineByOffset;
|
|
@@ -102,11 +102,13 @@ export class RevogrData {
|
|
|
102
102
|
const depth = this.dataStore.get('groupingDepth');
|
|
103
103
|
const groupingCustomRenderer = this.dataStore.get('groupingCustomRenderer');
|
|
104
104
|
const groupDepth = this.columnService.hasGrouping ? depth : 0;
|
|
105
|
+
const rowRenderOffset = this.viewportRow.get('renderOffset') || 0;
|
|
106
|
+
const colRenderOffset = this.viewportCol.get('renderOffset') || 0;
|
|
105
107
|
for (let rgRow of rows) {
|
|
106
108
|
const dataItem = getSourceItem(this.dataStore, rgRow.itemIndex);
|
|
107
109
|
// #region Grouping
|
|
108
110
|
if (isGrouping(dataItem)) {
|
|
109
|
-
const gmodel = Object.assign(Object.assign({}, rgRow), { index: rgRow.itemIndex, model: dataItem, groupingCustomRenderer,
|
|
111
|
+
const gmodel = Object.assign(Object.assign({}, rgRow), { start: rgRow.start - rowRenderOffset, index: rgRow.itemIndex, model: dataItem, groupingCustomRenderer,
|
|
110
112
|
// Only show expand button if grouping is enabled and not in row headers
|
|
111
113
|
hasExpand: this.columnService.hasGrouping && this.colType !== 'rowHeaders', columnItems: cols, providers: this.providers });
|
|
112
114
|
rowsEls.push(h(GroupingRowRenderer, Object.assign({}, gmodel)));
|
|
@@ -129,7 +131,7 @@ export class RevogrData {
|
|
|
129
131
|
[DATA_ROW]: rowProps.itemIndex,
|
|
130
132
|
style: {
|
|
131
133
|
width: `${columnProps.size}px`,
|
|
132
|
-
transform: `translateX(${columnProps.start}px)`,
|
|
134
|
+
transform: `translateX(${columnProps.start - colRenderOffset}px)`,
|
|
133
135
|
height: rowProps.size ? `${rowProps.size}px` : undefined,
|
|
134
136
|
},
|
|
135
137
|
};
|
|
@@ -157,7 +159,7 @@ export class RevogrData {
|
|
|
157
159
|
if (this.rowHighlightPlugin.isRowFocused(rgRow.itemIndex)) {
|
|
158
160
|
rowClass += ` ${ROW_FOCUSED_CLASS}`;
|
|
159
161
|
}
|
|
160
|
-
const row = (h(RowRenderer, { index: rgRow.itemIndex, rowClass: rowClass, size: rgRow.size, start: rgRow.start, groupingLevel: groupDepth || undefined }, cells));
|
|
162
|
+
const row = (h(RowRenderer, { index: rgRow.itemIndex, rowClass: rowClass, size: rgRow.size, start: rgRow.start - rowRenderOffset, groupingLevel: groupDepth || undefined }, cells));
|
|
161
163
|
this.beforerowrender.emit({
|
|
162
164
|
node: row,
|
|
163
165
|
item: rgRow,
|
|
@@ -25,7 +25,7 @@ const HeaderRenderer = (p) => {
|
|
|
25
25
|
class: cellClass,
|
|
26
26
|
style: {
|
|
27
27
|
width: `${p.column.size}px`,
|
|
28
|
-
transform: `translateX(${p.column.start}px)`,
|
|
28
|
+
transform: `translateX(${p.column.start - (p.renderOffset || 0)}px)`,
|
|
29
29
|
},
|
|
30
30
|
onResize: p.onResize,
|
|
31
31
|
onDblClick(originalEvent) {
|
|
@@ -34,15 +34,25 @@ revogr-header .rgHeaderCell.align-right {
|
|
|
34
34
|
revogr-header .rgHeaderCell.sortable {
|
|
35
35
|
cursor: pointer;
|
|
36
36
|
}
|
|
37
|
-
revogr-header .rgHeaderCell
|
|
37
|
+
revogr-header .rgHeaderCell .sort-indicator {
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: flex-start;
|
|
40
|
+
gap: 1px;
|
|
41
|
+
}
|
|
42
|
+
revogr-header .rgHeaderCell .sort-indicator i.asc:after, revogr-header .rgHeaderCell .sort-indicator i.desc:after {
|
|
38
43
|
font-size: 13px;
|
|
39
44
|
}
|
|
40
|
-
revogr-header .rgHeaderCell i.asc:after {
|
|
45
|
+
revogr-header .rgHeaderCell .sort-indicator i.asc:after {
|
|
41
46
|
content: "↑";
|
|
42
47
|
}
|
|
43
|
-
revogr-header .rgHeaderCell i.desc:after {
|
|
48
|
+
revogr-header .rgHeaderCell .sort-indicator i.desc:after {
|
|
44
49
|
content: "↓";
|
|
45
50
|
}
|
|
51
|
+
revogr-header .rgHeaderCell .sort-indicator .sort-order-index {
|
|
52
|
+
font-size: 10px;
|
|
53
|
+
line-height: 1;
|
|
54
|
+
top: 0;
|
|
55
|
+
}
|
|
46
56
|
revogr-header .rgHeaderCell.active {
|
|
47
57
|
z-index: 10;
|
|
48
58
|
}
|
|
@@ -52,6 +52,7 @@ export class RevogrHeaderComponent {
|
|
|
52
52
|
}
|
|
53
53
|
renderHeaderColumns(cols, range) {
|
|
54
54
|
const columnsToRender = [];
|
|
55
|
+
const renderOffset = this.viewportCol.get('renderOffset') || 0;
|
|
55
56
|
for (let rgCol of cols) {
|
|
56
57
|
const colData = this.colData[rgCol.itemIndex];
|
|
57
58
|
const props = {
|
|
@@ -60,6 +61,7 @@ export class RevogrHeaderComponent {
|
|
|
60
61
|
data: Object.assign(Object.assign({}, colData), { index: rgCol.itemIndex, providers: this.providers }),
|
|
61
62
|
canFilter: !!this.columnFilter,
|
|
62
63
|
canResize: this.canResize,
|
|
64
|
+
renderOffset,
|
|
63
65
|
active: this.resizeHandler,
|
|
64
66
|
additionalData: this.additionalData,
|
|
65
67
|
onResize: e => this.onResize(e, rgCol.itemIndex),
|
|
@@ -112,6 +114,7 @@ export class RevogrHeaderComponent {
|
|
|
112
114
|
start: groupStart,
|
|
113
115
|
end: groupEnd,
|
|
114
116
|
group,
|
|
117
|
+
renderOffset: this.viewportCol.get('renderOffset') || 0,
|
|
115
118
|
active: this.resizeHandler,
|
|
116
119
|
canResize: this.canResize,
|
|
117
120
|
additionalData: this.additionalData,
|
|
@@ -579,7 +582,7 @@ export class RevogrHeaderComponent {
|
|
|
579
582
|
},
|
|
580
583
|
"complexType": {
|
|
581
584
|
"original": "HeaderRenderProps",
|
|
582
|
-
"resolved": "{ column: VirtualPositionItem; additionalData: any; data: ColumnTemplateProp<ColumnProp>; range?: RangeArea | null | undefined; canResize?: boolean | undefined; canFilter?: boolean | undefined; onResize?(e: ResizeEvent): void; onClick?(data: InitialHeaderClick): void; onDblClick?(data: InitialHeaderClick): void; } & Partial<Pick<ResizeProps, \"active\">>",
|
|
585
|
+
"resolved": "{ column: VirtualPositionItem; additionalData: any; data: ColumnTemplateProp<ColumnProp>; range?: RangeArea | null | undefined; canResize?: boolean | undefined; canFilter?: boolean | undefined; renderOffset?: number | undefined; onResize?(e: ResizeEvent): void; onClick?(data: InitialHeaderClick): void; onDblClick?(data: InitialHeaderClick): void; } & Partial<Pick<ResizeProps, \"active\">>",
|
|
583
586
|
"references": {
|
|
584
587
|
"HeaderRenderProps": {
|
|
585
588
|
"location": "import",
|
|
@@ -601,7 +604,7 @@ export class RevogrHeaderComponent {
|
|
|
601
604
|
},
|
|
602
605
|
"complexType": {
|
|
603
606
|
"original": "HeaderGroupRendererProps",
|
|
604
|
-
"resolved": "{ start: number; end: number; group: Group; providers: ProvidersColumns<DimensionCols | \"rowHeaders\">; additionalData: any; canResize?: boolean | undefined; onResize?(e: ResizeEvent): void; } & Partial<Pick<ResizeProps, \"active\">>",
|
|
607
|
+
"resolved": "{ start: number; end: number; group: Group; providers: ProvidersColumns<DimensionCols | \"rowHeaders\">; additionalData: any; canResize?: boolean | undefined; renderOffset?: number | undefined; onResize?(e: ResizeEvent): void; } & Partial<Pick<ResizeProps, \"active\">>",
|
|
605
608
|
"references": {
|
|
606
609
|
"HeaderGroupRendererProps": {
|
|
607
610
|
"location": "import",
|
|
@@ -51,11 +51,12 @@ export default class RowOrderService {
|
|
|
51
51
|
getRow(y, { el, rows }) {
|
|
52
52
|
const { top } = el.getBoundingClientRect();
|
|
53
53
|
const topRelative = y - top;
|
|
54
|
-
const
|
|
54
|
+
const rowOffset = rows.renderOffset || 0;
|
|
55
|
+
const rgRow = getItemByPosition(rows, topRelative + rowOffset);
|
|
55
56
|
const absolutePosition = {
|
|
56
57
|
itemIndex: rgRow.itemIndex,
|
|
57
|
-
start: rgRow.start + top,
|
|
58
|
-
end: rgRow.end + top,
|
|
58
|
+
start: rgRow.start - rowOffset + top,
|
|
59
|
+
end: rgRow.end - rowOffset + top,
|
|
59
60
|
};
|
|
60
61
|
return absolutePosition;
|
|
61
62
|
}
|
|
@@ -64,8 +65,8 @@ export default class RowOrderService {
|
|
|
64
65
|
const { top, left } = el.getBoundingClientRect();
|
|
65
66
|
const topRelative = y - top;
|
|
66
67
|
const leftRelative = x - left;
|
|
67
|
-
const rgRow = getItemByPosition(rows, topRelative);
|
|
68
|
-
const rgCol = getItemByPosition(cols, leftRelative);
|
|
68
|
+
const rgRow = getItemByPosition(rows, topRelative + (rows.renderOffset || 0));
|
|
69
|
+
const rgCol = getItemByPosition(cols, leftRelative + (cols.renderOffset || 0));
|
|
69
70
|
return { x: rgCol.itemIndex, y: rgRow.itemIndex };
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { getRange } from "../../store/index";
|
|
5
5
|
import { codesLetter, isAll, isClear, isCopy, isCut, isEnterKeyValue, isPaste, isShortcutModifier, isTab, timeout, RESIZE_INTERVAL, } from "../../utils";
|
|
6
6
|
import { getCoordinate, isAfterLast, isBeforeFirst, } from "./selection.utils";
|
|
7
|
+
import { isEditInput } from "../editors/edit.utils";
|
|
7
8
|
const DIRECTION_CODES = [
|
|
8
9
|
codesLetter.TAB,
|
|
9
10
|
codesLetter.ARROW_UP,
|
|
@@ -15,9 +16,29 @@ export class KeyboardService {
|
|
|
15
16
|
constructor(sv) {
|
|
16
17
|
this.sv = sv;
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Appends printable key input that arrives after edit mode was requested
|
|
21
|
+
* but before the editor input has mounted or received focus.
|
|
22
|
+
*/
|
|
23
|
+
appendPendingEditValue(e) {
|
|
24
|
+
if (isShortcutModifier(e) ||
|
|
25
|
+
e.key.length !== 1 ||
|
|
26
|
+
(e.target instanceof HTMLElement && isEditInput(e.target))) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const editCell = this.sv.selectionStore.get('edit');
|
|
30
|
+
if (typeof (editCell === null || editCell === void 0 ? void 0 : editCell.val) !== 'string') {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
this.sv.selectionStore.set('edit', Object.assign(Object.assign({}, editCell), { val: `${editCell.val}${e.key}` }));
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
18
36
|
async keyDown(e, canRange, isEditMode, { range, focus }) {
|
|
19
37
|
// IF EDIT MODE
|
|
20
38
|
if (isEditMode) {
|
|
39
|
+
if (this.appendPendingEditValue(e)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
21
42
|
switch (e.code) {
|
|
22
43
|
case codesLetter.ESCAPE:
|
|
23
44
|
this.sv.cancel();
|
|
@@ -111,7 +132,8 @@ export class KeyboardService {
|
|
|
111
132
|
}
|
|
112
133
|
const eData = this.sv.getData();
|
|
113
134
|
if (isMulti) {
|
|
114
|
-
|
|
135
|
+
const isOutOfBounds = [data.start, data.end].some(cell => isAfterLast(cell, eData.lastCell) || isBeforeFirst(cell));
|
|
136
|
+
if (isOutOfBounds) {
|
|
115
137
|
return false;
|
|
116
138
|
}
|
|
117
139
|
const range = getRange(data.start, data.end);
|
|
@@ -49,8 +49,8 @@ export function getCurrentCell({ x, y }, { el, rows, cols }) {
|
|
|
49
49
|
cellX = width - 1;
|
|
50
50
|
}
|
|
51
51
|
// Get the row and column items based on the cell position
|
|
52
|
-
const rgRow = getItemByPosition(rows, cellY);
|
|
53
|
-
const rgCol = getItemByPosition(cols, cellX);
|
|
52
|
+
const rgRow = getItemByPosition(rows, cellY + (rows.renderOffset || 0));
|
|
53
|
+
const rgCol = getItemByPosition(cols, cellX + (cols.renderOffset || 0));
|
|
54
54
|
// Set the row and column index to 0 if they are before the first item
|
|
55
55
|
if (rgCol.itemIndex < 0) {
|
|
56
56
|
rgCol.itemIndex = 0;
|
|
@@ -120,10 +120,12 @@ export function styleByCellProps(styles) {
|
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
export function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
const
|
|
123
|
+
const rowOffset = dimensionRow.renderOffset || 0;
|
|
124
|
+
const colOffset = dimensionCol.renderOffset || 0;
|
|
125
|
+
const top = getItemByIndex(dimensionRow, y).start - rowOffset;
|
|
126
|
+
const left = getItemByIndex(dimensionCol, x).start - colOffset;
|
|
127
|
+
const bottom = getItemByIndex(dimensionRow, y1).end - rowOffset;
|
|
128
|
+
const right = getItemByIndex(dimensionCol, x1).end - colOffset;
|
|
127
129
|
return {
|
|
128
130
|
left,
|
|
129
131
|
right,
|
|
@@ -626,12 +626,13 @@ export class RevoGridComponent {
|
|
|
626
626
|
return;
|
|
627
627
|
}
|
|
628
628
|
const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
|
|
629
|
+
const order = {};
|
|
630
|
+
for (const prop of Object.keys(beforeApplyEvent.detail.sort)) {
|
|
631
|
+
order[prop] = beforeApplyEvent.detail.sort[prop].order;
|
|
632
|
+
}
|
|
629
633
|
this.aftercolumnsset.emit({
|
|
630
634
|
columns,
|
|
631
|
-
order
|
|
632
|
-
acc[prop] = column.order;
|
|
633
|
-
return acc;
|
|
634
|
-
}, {}),
|
|
635
|
+
order,
|
|
635
636
|
});
|
|
636
637
|
}
|
|
637
638
|
disableVirtualXChanged(newVal = false, prevVal = false) {
|
|
@@ -920,7 +921,7 @@ export class RevoGridComponent {
|
|
|
920
921
|
if (Object.keys((_a = this.trimmedRows) !== null && _a !== void 0 ? _a : {}).length > 0) {
|
|
921
922
|
this.trimmedRowsChanged(this.trimmedRows);
|
|
922
923
|
}
|
|
923
|
-
this.rowDefChanged(this.rowDefinitions);
|
|
924
|
+
this.rowDefChanged(this.rowDefinitions, undefined, undefined, false);
|
|
924
925
|
// init grouping
|
|
925
926
|
if (this.grouping && Object.keys(this.grouping).length > 0) {
|
|
926
927
|
this.groupingChanged(this.grouping);
|
|
@@ -108,7 +108,8 @@ export default class ViewportService {
|
|
|
108
108
|
(_a = this.config.dimensionProvider) === null || _a === void 0 ? void 0 : _a.setCustomSizes(type, detail, true);
|
|
109
109
|
// set resize event
|
|
110
110
|
const changedItems = {};
|
|
111
|
-
for (const
|
|
111
|
+
for (const i of Object.keys(detail || {})) {
|
|
112
|
+
const size = detail[i];
|
|
112
113
|
const virtualIndex = parseInt(i, 10);
|
|
113
114
|
const item = getSourceItem(store, virtualIndex);
|
|
114
115
|
if (item) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { h, Host, } from "@stencil/core";
|
|
5
5
|
import GridResizeService from "../revoGrid/viewport.resize.service";
|
|
6
|
-
import LocalScrollService from "../../services/local.scroll.service";
|
|
6
|
+
import LocalScrollService, { getContentSize } from "../../services/local.scroll.service";
|
|
7
7
|
import { LocalScrollTimer } from "../../services/local.scroll.timer";
|
|
8
8
|
import { CONTENT_SLOT, FOOTER_SLOT, HEADER_SLOT, } from "../revoGrid/viewport.helpers";
|
|
9
9
|
/**
|
|
@@ -34,7 +34,7 @@ export class RevogrViewportScroll {
|
|
|
34
34
|
* @param e
|
|
35
35
|
*/
|
|
36
36
|
async changeScroll(e, silent = false) {
|
|
37
|
-
var _a, _b;
|
|
37
|
+
var _a, _b, _c, _d;
|
|
38
38
|
if (silent) {
|
|
39
39
|
if (e.coordinate && this.verticalScroll) {
|
|
40
40
|
switch (e.dimension) {
|
|
@@ -47,15 +47,16 @@ export class RevogrViewportScroll {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
if (e.delta) {
|
|
50
|
+
let currentPhysicalCoordinate = 0;
|
|
50
51
|
switch (e.dimension) {
|
|
51
52
|
case 'rgCol':
|
|
52
|
-
|
|
53
|
+
currentPhysicalCoordinate = this.horizontalScroll.scrollLeft;
|
|
53
54
|
break;
|
|
54
55
|
case 'rgRow':
|
|
55
|
-
|
|
56
|
+
currentPhysicalCoordinate = (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0;
|
|
56
57
|
break;
|
|
57
58
|
}
|
|
58
|
-
this.
|
|
59
|
+
return (_d = (_c = this.localScrollService) === null || _c === void 0 ? void 0 : _c.setScrollByDelta(e, currentPhysicalCoordinate)) !== null && _d !== void 0 ? _d : e;
|
|
59
60
|
}
|
|
60
61
|
return e;
|
|
61
62
|
}
|
|
@@ -207,7 +208,10 @@ export class RevogrViewportScroll {
|
|
|
207
208
|
this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
|
|
208
209
|
}
|
|
209
210
|
render() {
|
|
210
|
-
|
|
211
|
+
var _a, _b, _c, _d;
|
|
212
|
+
const physicalContentHeight = getContentSize(this.contentHeight, (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0);
|
|
213
|
+
const physicalContentWidth = getContentSize(this.contentWidth, (_d = (_c = this.horizontalScroll) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 0);
|
|
214
|
+
return (h(Host, { key: 'a0c47dede9d131dea8c8ca449e8a323f24d9b113', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, h("div", { key: '6c960e753ffe522ba4afb1c379264873b6c617f3', class: "inner-content-table", style: { width: `${physicalContentWidth}px` } }, h("div", { key: '1a6cbcbd3634e84756b54c8150aebd25c824e14a', class: "header-wrapper", ref: e => (this.header = e) }, h("slot", { key: 'e4202c687bc39b4f78f3ed9840e979b032f06af8', name: HEADER_SLOT })), h("div", { key: '651415b5b32e72735065b183317386a34042bb85', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, h("div", { key: 'e65623b78d80957d8676adb019618953ef267ec3', class: "content-wrapper", style: { height: `${physicalContentHeight}px` } }, h("slot", { key: '5af47b12ef1226587cf774233447b5252d65e836', name: CONTENT_SLOT }))), h("div", { key: 'cbc0fd64fbfb53d3b18e547bbe34e32b7bb9c043', class: "footer-wrapper", ref: e => (this.footer = e) }, h("slot", { key: 'a8e4bfaef400973121090bac3069eb85469a95f3', name: FOOTER_SLOT })))));
|
|
211
215
|
}
|
|
212
216
|
/**
|
|
213
217
|
* Extra layer for scroll event monitoring, where MouseWheel event is not passing
|
|
@@ -37,15 +37,9 @@ export class RevogrScrollVirtual {
|
|
|
37
37
|
*/
|
|
38
38
|
async changeScroll(e) {
|
|
39
39
|
if (e.delta) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
break;
|
|
44
|
-
case 'rgRow':
|
|
45
|
-
e.coordinate = this.element.scrollTop + e.delta;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
this.setScroll(e);
|
|
40
|
+
const scrollProperty = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';
|
|
41
|
+
const currentPhysicalCoordinate = this.element[scrollProperty];
|
|
42
|
+
return this.localScrollService.setScrollByDelta(e, currentPhysicalCoordinate);
|
|
49
43
|
}
|
|
50
44
|
return e;
|
|
51
45
|
}
|
|
@@ -108,7 +102,7 @@ export class RevogrScrollVirtual {
|
|
|
108
102
|
}
|
|
109
103
|
render() {
|
|
110
104
|
const size = getContentSize(this.realSize, this.dimension === 'rgRow' ? this.element.clientHeight : this.element.clientWidth, this.clientSize);
|
|
111
|
-
return (h(Host, { key: '
|
|
105
|
+
return (h(Host, { key: '7213817ef941eee4050b714266598ec0c2961ee9', onScroll: (e) => this.onScroll(e) }, h("div", { key: '501da49c63253ab943172494b9dbf5399be56cee', style: {
|
|
112
106
|
[this.dimension === 'rgRow' ? 'height' : 'width']: `${size}px`,
|
|
113
107
|
} })));
|
|
114
108
|
}
|
|
@@ -250,7 +250,8 @@ export class FilterPanel {
|
|
|
250
250
|
const options = [];
|
|
251
251
|
const prop = this.changes.prop;
|
|
252
252
|
const hidden = new Set();
|
|
253
|
-
Object.
|
|
253
|
+
Object.keys(this.filterItems).forEach((prop) => {
|
|
254
|
+
const values = this.filterItems[prop];
|
|
254
255
|
values.forEach((filter) => {
|
|
255
256
|
if (filter.hidden) {
|
|
256
257
|
hidden.add(filter.type);
|
|
@@ -152,17 +152,24 @@ export class FilterPlugin extends BasePlugin {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
if (config.collection) {
|
|
155
|
-
const
|
|
156
|
-
|
|
155
|
+
const filterCollection = {};
|
|
156
|
+
for (const prop of Object.keys(config.collection)) {
|
|
157
|
+
const item = config.collection[prop];
|
|
158
|
+
if (this.filterFunctionsIndexedByType[item.type]) {
|
|
159
|
+
filterCollection[prop] = item;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
this.filterCollection = filterCollection;
|
|
157
163
|
}
|
|
158
164
|
else {
|
|
159
165
|
this.filterCollection = {};
|
|
160
166
|
}
|
|
161
167
|
if (config.localization) {
|
|
162
168
|
if (config.localization.filterNames) {
|
|
163
|
-
|
|
169
|
+
const filterNames = config.localization.filterNames;
|
|
170
|
+
Object.keys(filterNames).forEach((k) => {
|
|
164
171
|
if (this.filterNameIndexByType[k] != void 0) {
|
|
165
|
-
this.filterNameIndexByType[k] =
|
|
172
|
+
this.filterNameIndexByType[k] = filterNames[k];
|
|
166
173
|
}
|
|
167
174
|
});
|
|
168
175
|
}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
5
|
+
var t = {};
|
|
6
|
+
for (var p in s)
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
10
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
11
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
12
|
+
t[p[i]] = s[p[i]];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
4
16
|
import { getPhysical, setItems, columnTypes, } from "../../store/index";
|
|
5
17
|
import { BasePlugin } from "../base.plugin";
|
|
6
18
|
import { FILTER_TRIMMED_TYPE } from "../filter/filter.plugin";
|
|
@@ -97,6 +109,18 @@ export class GroupingRowPlugin extends BasePlugin {
|
|
|
97
109
|
const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
|
|
98
110
|
return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
|
|
99
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns grouping options for regrouping that must preserve current UI state.
|
|
114
|
+
*
|
|
115
|
+
* `expandedAll` and config `prevExpanded` are initial/config instructions.
|
|
116
|
+
* Reusing them after sorting would reopen groups the user collapsed before
|
|
117
|
+
* sorting instead of using the current grouped source state.
|
|
118
|
+
*/
|
|
119
|
+
getCurrentExpandedOptions() {
|
|
120
|
+
var _a;
|
|
121
|
+
const _b = (_a = this.options) !== null && _a !== void 0 ? _a : {}, { expandedAll: _expandedAll, prevExpanded: _prevExpanded } = _b, options = __rest(_b, ["expandedAll", "prevExpanded"]);
|
|
122
|
+
return options;
|
|
123
|
+
}
|
|
100
124
|
/**
|
|
101
125
|
* Starts global source update with group clearing and applying new one
|
|
102
126
|
* Initiated when need to reapply grouping
|
|
@@ -199,7 +223,7 @@ export class GroupingRowPlugin extends BasePlugin {
|
|
|
199
223
|
if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
200
224
|
return;
|
|
201
225
|
}
|
|
202
|
-
this.doSourceUpdate(
|
|
226
|
+
this.doSourceUpdate(this.getCurrentExpandedOptions());
|
|
203
227
|
});
|
|
204
228
|
/**
|
|
205
229
|
* Apply logic for focus inside of grouping
|
|
@@ -68,7 +68,7 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
68
68
|
const cols = this.getDimension(data.pin || 'rgCol');
|
|
69
69
|
const gridRect = this.revogrid.getBoundingClientRect();
|
|
70
70
|
const elRect = dataEl.getBoundingClientRect();
|
|
71
|
-
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
|
|
71
|
+
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left) + (cols.renderOffset || 0));
|
|
72
72
|
this.staticDragData = {
|
|
73
73
|
startPos: event.x,
|
|
74
74
|
startItem,
|
|
@@ -93,13 +93,13 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
93
93
|
const start = this.staticDragData.startPos;
|
|
94
94
|
if (Math.abs(start - e.x) > 10) {
|
|
95
95
|
const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
|
|
96
|
-
const rgCol = getItemByPosition(this.staticDragData.cols, x);
|
|
96
|
+
const rgCol = getItemByPosition(this.staticDragData.cols, x + (this.staticDragData.cols.renderOffset || 0));
|
|
97
97
|
this.orderUi.autoscroll(x, dragData.elRect.width);
|
|
98
98
|
// prevent position change if out of bounds
|
|
99
99
|
if (rgCol.itemIndex >= this.staticDragData.cols.count) {
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
|
|
102
|
+
this.orderUi.showHandler(rgCol.end - (this.staticDragData.cols.renderOffset || 0) + dragData.scrollOffset, dragData.gridRect.width);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
move(e) {
|
|
@@ -117,7 +117,7 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
117
117
|
if (relativePos < 0) {
|
|
118
118
|
relativePos = 0;
|
|
119
119
|
}
|
|
120
|
-
const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
|
|
120
|
+
const newPosition = getItemByPosition(this.staticDragData.cols, relativePos + (this.staticDragData.cols.renderOffset || 0));
|
|
121
121
|
const store = this.providers.column.stores[this.dragData.type].store;
|
|
122
122
|
const source = store.get('source');
|
|
123
123
|
const newItems = [...store.get('items')];
|