@revolist/revogrid 3.1.8 → 3.1.90
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/custom-element/_baseIteratee.js +2070 -0
- package/custom-element/columnService.js +743 -0
- package/custom-element/consts.js +46 -0
- package/custom-element/data.store.js +545 -0
- package/custom-element/debounce.js +217 -0
- package/custom-element/dimension.helpers.js +340 -0
- package/custom-element/each.js +180 -0
- package/custom-element/filter.button.js +36 -0
- package/custom-element/identity.js +26 -0
- package/custom-element/index.d.ts +15 -98
- package/custom-element/index.js +18 -28962
- package/custom-element/isSymbol.js +220 -0
- package/custom-element/keys.js +561 -0
- package/custom-element/localScrollService.js +86 -0
- package/custom-element/resize-observer.js +25 -11
- package/custom-element/revo-grid.d.ts +11 -0
- package/custom-element/revo-grid.js +3662 -0
- package/custom-element/revogr-clipboard.d.ts +11 -0
- package/custom-element/revogr-clipboard.js +72 -0
- package/custom-element/revogr-data.d.ts +11 -0
- package/custom-element/revogr-data.js +9 -0
- package/custom-element/revogr-data2.js +171 -0
- package/custom-element/revogr-edit.d.ts +11 -0
- package/custom-element/revogr-edit.js +9 -0
- package/custom-element/revogr-edit2.js +402 -0
- package/custom-element/revogr-filter-panel.d.ts +11 -0
- package/custom-element/revogr-filter-panel.js +308 -0
- package/custom-element/revogr-focus.d.ts +11 -0
- package/custom-element/revogr-focus.js +9 -0
- package/custom-element/revogr-focus2.js +64 -0
- package/custom-element/revogr-header.d.ts +11 -0
- package/custom-element/revogr-header.js +9 -0
- package/custom-element/revogr-header2.js +591 -0
- package/custom-element/revogr-order-editor.d.ts +11 -0
- package/custom-element/revogr-order-editor.js +9 -0
- package/custom-element/revogr-order-editor2.js +190 -0
- package/custom-element/revogr-overlay-selection.d.ts +11 -0
- package/custom-element/revogr-overlay-selection.js +9 -0
- package/custom-element/revogr-overlay-selection2.js +741 -0
- package/custom-element/revogr-row-headers.d.ts +11 -0
- package/custom-element/revogr-row-headers.js +9 -0
- package/custom-element/revogr-row-headers2.js +403 -0
- package/custom-element/revogr-scroll-virtual.d.ts +11 -0
- package/custom-element/revogr-scroll-virtual.js +9 -0
- package/custom-element/revogr-scroll-virtual2.js +135 -0
- package/custom-element/revogr-temp-range.d.ts +11 -0
- package/custom-element/revogr-temp-range.js +9 -0
- package/custom-element/revogr-temp-range2.js +17275 -0
- package/custom-element/revogr-viewport-scroll.d.ts +11 -0
- package/custom-element/revogr-viewport-scroll.js +9 -0
- package/custom-element/revogr-viewport-scroll2.js +367 -0
- package/custom-element/selection.utils.js +106 -0
- package/custom-element/toInteger.js +107 -0
- package/custom-element/toNumber.js +105 -0
- package/custom-element/utils.js +69 -0
- package/dist/cjs/css-shim-9f5bc84d.js +9 -0
- package/dist/cjs/{debounce-e9b040d9.js → debounce-6cea2774.js} +4 -1
- package/dist/cjs/{dom-c8b6d1a7.js → dom-fcb646f0.js} +4 -1
- package/dist/cjs/{index-d3f67f2e.js → index-cb904e00.js} +214 -91
- package/dist/cjs/index.cjs.js +3 -0
- package/dist/cjs/loader.cjs.js +7 -4
- package/dist/cjs/{resize-observer-8dc80084.js → resize-observer-bf327d6a.js} +25 -10
- package/dist/cjs/revo-grid.cjs.js +13 -7
- package/dist/cjs/revo-grid_11.cjs.entry.js +277 -15
- package/dist/cjs/revogr-clipboard.cjs.entry.js +4 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +5 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/button/button.js +3 -0
- package/dist/collection/components/clipboard/revogr-clipboard.js +3 -0
- package/dist/collection/components/data/cellRenderer.js +3 -0
- package/dist/collection/components/data/columnService.js +3 -0
- package/dist/collection/components/data/revogr-data.js +3 -0
- package/dist/collection/components/data/rowRenderer.js +3 -0
- package/dist/collection/components/header/headerCellRenderer.js +11 -1
- package/dist/collection/components/header/headerRenderer.js +3 -0
- package/dist/collection/components/header/revogr-header.js +3 -0
- package/dist/collection/components/order/orderRenderer.js +3 -0
- package/dist/collection/components/order/revogr-order-editor.js +3 -0
- package/dist/collection/components/order/rowOrderService.js +3 -0
- package/dist/collection/components/overlay/autofill.service.js +3 -0
- package/dist/collection/components/overlay/clipboard.service.js +3 -0
- package/dist/collection/components/overlay/editors/edit.utils.js +3 -0
- package/dist/collection/components/overlay/editors/text.js +3 -0
- package/dist/collection/components/overlay/keyboard.service.js +3 -0
- package/dist/collection/components/overlay/revogr-edit.js +3 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js +3 -0
- package/dist/collection/components/overlay/selection.utils.js +3 -0
- package/dist/collection/components/revo-grid/revo-grid-style.css +18 -1
- package/dist/collection/components/revo-grid/revo-grid.js +72 -15
- package/dist/collection/components/revo-grid/viewport.helpers.js +3 -0
- package/dist/collection/components/revo-grid/viewport.interfaces.js +3 -0
- package/dist/collection/components/revo-grid/viewport.js +3 -0
- package/dist/collection/components/revo-grid/viewport.resize.service.js +3 -0
- package/dist/collection/components/revo-grid/viewport.scrolling.service.js +3 -0
- package/dist/collection/components/revo-grid/viewport.section.js +4 -1
- package/dist/collection/components/revo-grid/viewport.service.js +3 -0
- package/dist/collection/components/rowHeaders/revogr-row-headers.js +3 -0
- package/dist/collection/components/rowHeaders/row-header-render.js +3 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +5 -2
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +3 -0
- package/dist/collection/components/selection-focus/revogr-focus.js +79 -7
- package/dist/collection/components/selection-temp-range/revogr-temp-range.js +3 -0
- package/dist/collection/global/global.js +3 -0
- package/dist/collection/index.js +3 -0
- package/dist/collection/plugins/autoSizeColumn.js +4 -1
- package/dist/collection/plugins/basePlugin.js +3 -0
- package/dist/collection/plugins/dispatcher.js +22 -0
- package/dist/collection/plugins/export/csv.js +3 -0
- package/dist/collection/plugins/export/export.plugin.js +3 -0
- package/dist/collection/plugins/export/types.js +3 -0
- package/dist/collection/plugins/filter/conditions/equal.js +3 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThan.js +3 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +3 -0
- package/dist/collection/plugins/filter/conditions/number/lessThan.js +3 -0
- package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +3 -0
- package/dist/collection/plugins/filter/conditions/set.js +3 -0
- package/dist/collection/plugins/filter/conditions/string/beginswith.js +3 -0
- package/dist/collection/plugins/filter/conditions/string/contains.js +3 -0
- package/dist/collection/plugins/filter/filter.button.js +3 -0
- package/dist/collection/plugins/filter/filter.plugin.js +3 -0
- package/dist/collection/plugins/filter/filter.pop.js +3 -0
- package/dist/collection/plugins/filter/filter.service.js +3 -0
- package/dist/collection/plugins/filter/filter.types.js +3 -0
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +3 -0
- package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +6 -3
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +3 -0
- package/dist/collection/plugins/groupingRow/grouping.const.js +3 -0
- package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +3 -0
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +3 -0
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +3 -0
- package/dist/collection/plugins/groupingRow/grouping.row.types.js +3 -0
- package/dist/collection/plugins/groupingRow/grouping.service.js +3 -0
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +3 -0
- package/dist/collection/plugins/moveColumn/columnDragPlugin.js +163 -0
- package/dist/collection/plugins/moveColumn/columnOrderHandler.js +63 -0
- package/dist/collection/plugins/sorting/sorting.plugin.js +3 -0
- package/dist/collection/plugins/sorting/sorting.sign.js +3 -0
- package/dist/collection/plugins/stretchPlugin.js +3 -0
- package/dist/collection/plugins/trimmed/trimmed.plugin.js +3 -0
- package/dist/collection/services/cell.helpers.js +3 -0
- package/dist/collection/services/column.data.provider.js +6 -3
- package/dist/collection/services/data.provider.js +3 -0
- package/dist/collection/services/dimension.provider.js +3 -0
- package/dist/collection/services/localScrollService.js +3 -0
- package/dist/collection/services/resizable.directive.js +5 -0
- package/dist/collection/services/selection.store.connector.js +3 -0
- package/dist/collection/services/viewport.provider.js +3 -0
- package/dist/collection/store/dataSource/data.proxy.js +3 -0
- package/dist/collection/store/dataSource/data.store.js +3 -0
- package/dist/collection/store/dimension/dimension.helpers.js +3 -0
- package/dist/collection/store/dimension/dimension.store.js +3 -0
- package/dist/collection/store/selection/selection.helpers.js +3 -0
- package/dist/collection/store/selection/selection.store.js +3 -0
- package/dist/collection/store/selection/selection.store.service.js +3 -0
- package/dist/collection/store/storeTypes.js +3 -0
- package/dist/collection/store/viewPort/viewport.helpers.js +3 -0
- package/dist/collection/store/viewPort/viewport.store.js +3 -0
- package/dist/collection/themeManager/theme.compact.js +3 -0
- package/dist/collection/themeManager/theme.default.js +3 -0
- package/dist/collection/themeManager/theme.material.js +3 -0
- package/dist/collection/themeManager/themeService.js +3 -0
- package/dist/collection/utils/closestPolifill.js +3 -0
- package/dist/collection/utils/consts.js +3 -0
- package/dist/collection/utils/generateAlphabetHeader.js +3 -0
- package/dist/collection/utils/keyCodes.js +3 -0
- package/dist/collection/utils/keyCodes.utils.js +3 -0
- package/dist/collection/utils/platform.js +3 -0
- package/dist/collection/utils/resizeObserver.js +3 -0
- package/dist/collection/utils/store.utils.js +3 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/esm/css-shim-e1e1ea5e.js +7 -0
- package/dist/esm/{debounce-8dadcda7.js → debounce-e4e6dd45.js} +5 -2
- package/dist/esm/{dom-1b195079.js → dom-21bd1807.js} +4 -1
- package/dist/esm/{index-42c84e7c.js → index-6f753b3c.js} +214 -91
- package/dist/esm/index.js +3 -1
- package/dist/esm/loader.js +7 -4
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/{resize-observer-56b7b34f.js → resize-observer-00c48d78.js} +25 -11
- package/dist/esm/revo-grid.js +13 -7
- package/dist/esm/revo-grid_11.entry.js +277 -15
- package/dist/esm/revogr-clipboard.entry.js +4 -1
- package/dist/esm/revogr-filter-panel.entry.js +5 -2
- package/dist/esm-es5/css-shim-e1e1ea5e.js +4 -0
- package/dist/esm-es5/{debounce-8dadcda7.js → debounce-e4e6dd45.js} +4 -1
- package/dist/esm-es5/{dom-1b195079.js → dom-21bd1807.js} +3 -0
- package/dist/esm-es5/index-6f753b3c.js +4 -0
- package/dist/esm-es5/index.js +3 -0
- package/dist/esm-es5/loader.js +4 -1
- package/dist/esm-es5/resize-observer-00c48d78.js +4 -0
- package/dist/esm-es5/revo-grid.js +4 -1
- package/dist/esm-es5/revo-grid_11.entry.js +4 -1
- package/dist/esm-es5/revogr-clipboard.entry.js +4 -1
- package/dist/esm-es5/revogr-filter-panel.entry.js +4 -1
- package/dist/revo-grid/css-shim-bcf89cc0.system.js +4 -0
- package/dist/revo-grid/css-shim-e1e1ea5e.js +4 -0
- package/dist/revo-grid/{debounce-f40a88f6.system.js → debounce-5a33c710.system.js} +4 -1
- package/dist/revo-grid/{debounce-d097578d.js → debounce-726bdadb.js} +4 -1
- package/dist/revo-grid/{dom-1b195079.js → dom-21bd1807.js} +3 -0
- package/dist/revo-grid/{dom-ee2dd1b3.system.js → dom-726246e2.system.js} +3 -0
- package/dist/revo-grid/index-f14b41a0.system.js +5 -0
- package/dist/revo-grid/index-f30d1de1.js +5 -0
- package/dist/revo-grid/index.esm.js +3 -0
- package/dist/revo-grid/index.system.js +3 -0
- package/dist/revo-grid/resize-observer-00c48d78.js +4 -0
- package/dist/revo-grid/resize-observer-8af0bc0e.system.js +4 -0
- package/dist/revo-grid/revo-grid.esm.js +4 -1
- package/dist/revo-grid/revo-grid.js +3 -2
- package/dist/revo-grid/revo-grid.system.js +4 -1
- package/dist/revo-grid/revo-grid_11.entry.js +4 -1
- package/dist/revo-grid/revo-grid_11.system.entry.js +4 -1
- package/dist/revo-grid/revogr-clipboard.entry.js +4 -1
- package/dist/revo-grid/revogr-clipboard.system.entry.js +4 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +4 -1
- package/dist/revo-grid/revogr-filter-panel.system.entry.js +4 -1
- package/dist/types/components/revo-grid/revo-grid.d.ts +13 -0
- package/dist/types/components/selection-focus/revogr-focus.d.ts +8 -0
- package/dist/types/components.d.ts +129 -61
- package/dist/types/plugins/dispatcher.d.ts +10 -0
- package/dist/types/plugins/groupingColumn/grouping.col.plugin.d.ts +1 -1
- package/dist/types/plugins/moveColumn/columnDragPlugin.d.ts +54 -0
- package/dist/types/plugins/moveColumn/columnOrderHandler.d.ts +15 -0
- package/dist/types/services/resizable.directive.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +189 -186
- package/loader/cdn.js +3 -1
- package/loader/index.cjs.js +3 -1
- package/loader/index.d.ts +0 -1
- package/loader/index.es2017.js +3 -1
- package/loader/index.js +3 -1
- package/package.json +23 -21
- package/dist/cjs/css-shim-e33df79c.js +0 -6
- package/dist/esm/css-shim-8d75038b.js +0 -4
- package/dist/esm-es5/css-shim-8d75038b.js +0 -1
- package/dist/esm-es5/index-42c84e7c.js +0 -1
- package/dist/esm-es5/resize-observer-56b7b34f.js +0 -1
- package/dist/revo-grid/css-shim-88bfb262.system.js +0 -1
- package/dist/revo-grid/css-shim-8d75038b.js +0 -1
- package/dist/revo-grid/index-a15e7527.system.js +0 -1
- package/dist/revo-grid/index-a7f99799.js +0 -1
- package/dist/revo-grid/resize-observer-56b7b34f.js +0 -1
- package/dist/revo-grid/resize-observer-7a7b9757.system.js +0 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
1
4
|
import isArray from 'lodash/isArray';
|
|
2
5
|
import map from 'lodash/map';
|
|
3
6
|
import BasePlugin from '../basePlugin';
|
|
@@ -30,7 +33,7 @@ export default class GroupingColumnPlugin extends BasePlugin {
|
|
|
30
33
|
res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
|
|
31
34
|
return res;
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
}
|
|
37
|
+
export function isColGrouping(colData) {
|
|
38
|
+
return !!colData.children;
|
|
36
39
|
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Plugin for column manual move
|
|
6
|
+
*/
|
|
7
|
+
import debounce from 'lodash/debounce';
|
|
8
|
+
import each from 'lodash/each';
|
|
9
|
+
import { getItemByPosition } from '../../store/dimension/dimension.helpers';
|
|
10
|
+
import BasePlugin from '../basePlugin';
|
|
11
|
+
import { ColumnOrderHandler } from './columnOrderHandler';
|
|
12
|
+
import { dispatch } from '../dispatcher';
|
|
13
|
+
import { isColGrouping } from '../groupingColumn/grouping.col.plugin';
|
|
14
|
+
const COLUMN_CLICK = 'column-click';
|
|
15
|
+
const MOVE = 'column-mouse-move';
|
|
16
|
+
const DRAG_END = 'column-drag-end';
|
|
17
|
+
const BEFORE_DRAG_END = 'before-column-drag-end';
|
|
18
|
+
// use this event subscription to drop D&D for particular columns
|
|
19
|
+
const DRAG_START = 'column-drag-start';
|
|
20
|
+
export default class ColumnPlugin extends BasePlugin {
|
|
21
|
+
constructor(revogrid, providers) {
|
|
22
|
+
super(revogrid);
|
|
23
|
+
this.revogrid = revogrid;
|
|
24
|
+
this.providers = providers;
|
|
25
|
+
this.moveFunc = debounce((e) => this.doMove(e), 5);
|
|
26
|
+
this.staticDragData = null;
|
|
27
|
+
this.dragData = null;
|
|
28
|
+
this.localSubscriptions = {};
|
|
29
|
+
this.orderUi = new ColumnOrderHandler();
|
|
30
|
+
revogrid.registerVNode([this.orderUi.render()]);
|
|
31
|
+
/** Register events */
|
|
32
|
+
this.localSubscriptions['mouseleave'] = {
|
|
33
|
+
target: document,
|
|
34
|
+
callback: (e) => this.onMouseOut(e),
|
|
35
|
+
};
|
|
36
|
+
this.localSubscriptions['mouseup'] = {
|
|
37
|
+
target: document,
|
|
38
|
+
callback: (e) => this.onMouseUp(e),
|
|
39
|
+
};
|
|
40
|
+
this.localSubscriptions['mousemove'] = {
|
|
41
|
+
target: document,
|
|
42
|
+
callback: (e) => this.move(e),
|
|
43
|
+
};
|
|
44
|
+
this.addEventListener(COLUMN_CLICK, ({ detail }) => this.dragStart(detail));
|
|
45
|
+
}
|
|
46
|
+
dragStart({ event, data }) {
|
|
47
|
+
if (event.defaultPrevented) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const { defaultPrevented } = dispatch(this.revogrid, DRAG_START, data);
|
|
51
|
+
// check if allowed to drag particulat column
|
|
52
|
+
if (defaultPrevented) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.clearOrder();
|
|
56
|
+
const { mouseleave, mouseup, mousemove } = this.localSubscriptions;
|
|
57
|
+
mouseleave.target.addEventListener('mouseleave', mouseleave.callback);
|
|
58
|
+
mouseup.target.addEventListener('mouseup', mouseup.callback);
|
|
59
|
+
const dataEl = event.target.closest('revogr-header');
|
|
60
|
+
const scrollEl = event.target.closest('revogr-viewport-scroll');
|
|
61
|
+
if (!dataEl || !scrollEl) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (isColGrouping(data)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const cols = this.getDimension(data.pin || 'rgCol');
|
|
68
|
+
const gridRect = this.revogrid.getBoundingClientRect();
|
|
69
|
+
const elRect = dataEl.getBoundingClientRect();
|
|
70
|
+
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
|
|
71
|
+
this.staticDragData = {
|
|
72
|
+
startPos: event.x,
|
|
73
|
+
startItem,
|
|
74
|
+
data,
|
|
75
|
+
dataEl,
|
|
76
|
+
scrollEl,
|
|
77
|
+
gridEl: this.revogrid,
|
|
78
|
+
cols,
|
|
79
|
+
};
|
|
80
|
+
this.dragData = this.getData(this.staticDragData);
|
|
81
|
+
mousemove.target.addEventListener('mousemove', mousemove.callback);
|
|
82
|
+
this.orderUi.start(event, Object.assign(Object.assign({}, this.dragData), this.staticDragData));
|
|
83
|
+
}
|
|
84
|
+
doMove(e) {
|
|
85
|
+
if (!this.staticDragData) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const dragData = (this.dragData = this.getData(this.staticDragData));
|
|
89
|
+
if (!dragData) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const start = this.staticDragData.startPos;
|
|
93
|
+
if (Math.abs(start - e.x) > 10) {
|
|
94
|
+
const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
|
|
95
|
+
const rgCol = getItemByPosition(this.staticDragData.cols, x);
|
|
96
|
+
this.orderUi.autoscroll(x, dragData.elRect.width);
|
|
97
|
+
this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
move(e) {
|
|
101
|
+
dispatch(this.revogrid, MOVE, Object.assign({}, e));
|
|
102
|
+
// then do move
|
|
103
|
+
this.moveFunc(e);
|
|
104
|
+
}
|
|
105
|
+
onMouseOut(_) {
|
|
106
|
+
this.clearOrder();
|
|
107
|
+
}
|
|
108
|
+
onMouseUp(e) {
|
|
109
|
+
// apply new positions
|
|
110
|
+
if (this.dragData) {
|
|
111
|
+
let relativePos = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
|
|
112
|
+
if (relativePos < 0) {
|
|
113
|
+
relativePos = 0;
|
|
114
|
+
}
|
|
115
|
+
const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
|
|
116
|
+
const store = this.providers.column.stores[this.dragData.type].store;
|
|
117
|
+
const items = [...store.get('items')];
|
|
118
|
+
// prevent position change if needed
|
|
119
|
+
const { defaultPrevented: stopDrag } = dispatch(this.revogrid, BEFORE_DRAG_END, Object.assign(Object.assign({}, this.staticDragData), { startPosition: this.staticDragData.startItem, newPosition, newItem: store.get('source')[items[this.staticDragData.startItem.itemIndex]] }));
|
|
120
|
+
if (!stopDrag) {
|
|
121
|
+
// todo: if move item out of group remove item from group
|
|
122
|
+
const toMove = items.splice(this.staticDragData.startItem.itemIndex, 1);
|
|
123
|
+
items.splice(newPosition.itemIndex, 0, ...toMove);
|
|
124
|
+
store.set('items', items);
|
|
125
|
+
}
|
|
126
|
+
dispatch(this.revogrid, DRAG_END, this.dragData);
|
|
127
|
+
}
|
|
128
|
+
this.clearOrder();
|
|
129
|
+
}
|
|
130
|
+
clearLocalSubscriptions() {
|
|
131
|
+
each(this.localSubscriptions, ({ target, callback }, key) => target.removeEventListener(key, callback));
|
|
132
|
+
}
|
|
133
|
+
clearOrder() {
|
|
134
|
+
this.staticDragData = null;
|
|
135
|
+
this.dragData = null;
|
|
136
|
+
this.clearLocalSubscriptions();
|
|
137
|
+
this.orderUi.stop();
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Clearing subscription
|
|
141
|
+
*/
|
|
142
|
+
clearSubscriptions() {
|
|
143
|
+
super.clearSubscriptions();
|
|
144
|
+
this.clearLocalSubscriptions();
|
|
145
|
+
}
|
|
146
|
+
getData({ gridEl, dataEl, data, }) {
|
|
147
|
+
const gridRect = gridEl.getBoundingClientRect();
|
|
148
|
+
const elRect = dataEl.getBoundingClientRect();
|
|
149
|
+
const scrollOffset = elRect.left - gridRect.left;
|
|
150
|
+
return {
|
|
151
|
+
elRect,
|
|
152
|
+
gridRect,
|
|
153
|
+
type: data.pin || 'rgCol',
|
|
154
|
+
scrollOffset,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
getDimension(type) {
|
|
158
|
+
return this.providers.dimension.stores[type].getCurrentState();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
export function getLeftRelative(absoluteX, gridPos, offset) {
|
|
162
|
+
return absoluteX - gridPos - offset;
|
|
163
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { h } from '@stencil/core';
|
|
5
|
+
export class ColumnOrderHandler {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.offset = 0;
|
|
8
|
+
}
|
|
9
|
+
renderAutoscroll(_, parent) {
|
|
10
|
+
if (!parent) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
this.autoscrollEl = document.createElement('div');
|
|
14
|
+
this.autoscrollEl.classList.add('drag-auto-scroll-y');
|
|
15
|
+
parent.appendChild(this.autoscrollEl);
|
|
16
|
+
}
|
|
17
|
+
autoscroll(pos, dataContainerSize, direction = 'translateX') {
|
|
18
|
+
if (!this.autoscrollEl) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const helperOffset = 10;
|
|
22
|
+
// calculate current y position inside of the grid active holder
|
|
23
|
+
// 3 - size of element + border
|
|
24
|
+
const maxScroll = Math.min(pos + helperOffset, dataContainerSize - 3);
|
|
25
|
+
this.autoscrollEl.style.transform = `${direction}(${maxScroll}px)`;
|
|
26
|
+
this.autoscrollEl.scrollIntoView({
|
|
27
|
+
block: 'nearest',
|
|
28
|
+
inline: 'nearest',
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
start(e, { dataEl, gridRect, scrollEl }, dir = 'left') {
|
|
32
|
+
const scrollContainerRect = scrollEl.getBoundingClientRect();
|
|
33
|
+
if (scrollContainerRect) {
|
|
34
|
+
this.offset = scrollContainerRect[dir] - gridRect[dir];
|
|
35
|
+
}
|
|
36
|
+
this.renderAutoscroll(e, dataEl);
|
|
37
|
+
}
|
|
38
|
+
stop() {
|
|
39
|
+
var _a;
|
|
40
|
+
if (this.element) {
|
|
41
|
+
this.element.hidden = true;
|
|
42
|
+
}
|
|
43
|
+
this.offset = 0;
|
|
44
|
+
(_a = this.autoscrollEl) === null || _a === void 0 ? void 0 : _a.remove();
|
|
45
|
+
this.autoscrollEl = undefined;
|
|
46
|
+
}
|
|
47
|
+
showHandler(pos, size, direction = 'translateX') {
|
|
48
|
+
if (!this.element) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// do not allow overcross top of the scrollable area, header excluded
|
|
52
|
+
if (this.offset) {
|
|
53
|
+
pos = Math.max(pos, this.offset);
|
|
54
|
+
}
|
|
55
|
+
// can not be bigger then grid end
|
|
56
|
+
pos = Math.min(pos, size);
|
|
57
|
+
this.element.style.transform = `${direction}(${pos}px)`;
|
|
58
|
+
this.element.hidden = false;
|
|
59
|
+
}
|
|
60
|
+
render() {
|
|
61
|
+
return h("div", { class: "drag-position-y", hidden: true, ref: (el) => (this.element = el) });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
1
4
|
import reduce from 'lodash/reduce';
|
|
2
5
|
import each from 'lodash/each';
|
|
3
6
|
import find from 'lodash/find';
|
|
4
7
|
import DataStore, { getSourceItem, getSourceItemVirtualIndexByProp, setSourceByVirtualIndex } from '../store/dataSource/data.store';
|
|
5
8
|
import { columnTypes } from '../store/storeTypes';
|
|
6
|
-
import GroupingColumnPlugin from '../plugins/groupingColumn/grouping.col.plugin';
|
|
9
|
+
import GroupingColumnPlugin, { isColGrouping } from '../plugins/groupingColumn/grouping.col.plugin';
|
|
7
10
|
export default class ColumnDataProvider {
|
|
8
11
|
constructor() {
|
|
9
12
|
this.sorting = null;
|
|
@@ -135,7 +138,7 @@ export default class ColumnDataProvider {
|
|
|
135
138
|
}
|
|
136
139
|
static getColumnByProp(columns, prop) {
|
|
137
140
|
return find(columns, c => {
|
|
138
|
-
if (
|
|
141
|
+
if (isColGrouping(c)) {
|
|
139
142
|
return ColumnDataProvider.getColumnByProp(c.children, prop);
|
|
140
143
|
}
|
|
141
144
|
return c.prop === prop;
|
|
@@ -145,7 +148,7 @@ export default class ColumnDataProvider {
|
|
|
145
148
|
static getColumns(columns, level = 0, types) {
|
|
146
149
|
return reduce(columns, (res, colData) => {
|
|
147
150
|
/** Grouped column */
|
|
148
|
-
if (
|
|
151
|
+
if (isColGrouping(colData)) {
|
|
149
152
|
return GroupingColumnPlugin.gatherGroup(res, colData, ColumnDataProvider.getColumns(colData.children, level + 1, types), level);
|
|
150
153
|
}
|
|
151
154
|
/** Regular column */
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
1
4
|
import { h } from '@stencil/core';
|
|
2
5
|
var ResizeEvents;
|
|
3
6
|
(function (ResizeEvents) {
|
|
@@ -131,6 +134,8 @@ export class ResizeDirective {
|
|
|
131
134
|
if (event.defaultPrevented) {
|
|
132
135
|
return;
|
|
133
136
|
}
|
|
137
|
+
// stop other events if resize in progress
|
|
138
|
+
event.preventDefault();
|
|
134
139
|
this.dropInitial();
|
|
135
140
|
for (let elClass in RESIZE_MASK) {
|
|
136
141
|
const target = event.target;
|