@revolist/revogrid 3.2.4 → 3.2.7
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/index.js +29217 -0
- package/custom-element/resize-observer.js +503 -0
- package/dist/cjs/css-shim-9f5bc84d.js +9 -0
- package/dist/cjs/debounce-6cea2774.js +578 -0
- package/dist/cjs/dom-fcb646f0.js +78 -0
- package/dist/{revo-grid/index-8a604c17.js → cjs/index-cb904e00.js} +230 -1445
- package/dist/cjs/index.cjs.js +5 -0
- package/dist/cjs/loader.cjs.js +38 -0
- package/dist/cjs/resize-observer-bf327d6a.js +507 -0
- package/dist/cjs/revo-grid.cjs.js +79 -0
- package/dist/cjs/revo-grid_11.cjs.entry.js +28301 -0
- package/dist/cjs/revogr-clipboard.cjs.entry.js +56 -0
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +278 -0
- package/dist/collection/collection-manifest.json +25 -0
- package/dist/collection/components/button/button.js +7 -0
- package/dist/collection/components/clipboard/revogr-clipboard.js +124 -0
- package/dist/collection/components/data/cellRenderer.js +27 -0
- package/dist/{revo-grid/columnService-91e552ba.js → collection/components/data/columnService.js} +6 -8
- package/dist/collection/components/data/revogr-data-style.css +135 -0
- package/dist/collection/components/data/revogr-data.js +325 -0
- package/dist/collection/components/data/rowRenderer.js +9 -0
- package/dist/collection/components/header/headerCellRenderer.js +29 -0
- package/dist/collection/components/header/headerRenderer.js +48 -0
- package/dist/collection/components/header/revogr-header-style.css +198 -0
- package/dist/collection/components/header/revogr-header.js +300 -0
- package/dist/collection/components/order/orderRenderer.js +53 -0
- package/dist/collection/components/order/revogr-order-editor.js +361 -0
- package/dist/collection/components/order/rowOrderService.js +71 -0
- package/dist/collection/components/overlay/autofill.service.js +185 -0
- package/dist/collection/components/overlay/clipboard.service.js +42 -0
- package/dist/collection/components/overlay/editors/edit.utils.js +8 -0
- package/dist/collection/components/overlay/editors/text.js +38 -0
- package/dist/collection/components/overlay/keyboard.service.js +131 -0
- package/dist/collection/components/overlay/revogr-edit-style.css +86 -0
- package/dist/collection/components/overlay/revogr-edit.js +162 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js +729 -0
- package/dist/collection/components/overlay/revogr-overlay-style.css +98 -0
- package/dist/{revo-grid/selection.utils-a9932db6.js → collection/components/overlay/selection.utils.js} +9 -12
- package/dist/collection/components/revo-grid/revo-grid-style.css +544 -0
- package/dist/collection/components/revo-grid/revo-grid.js +2226 -0
- package/dist/collection/components/revo-grid/viewport.helpers.js +14 -0
- package/dist/collection/components/revo-grid/viewport.interfaces.js +4 -0
- package/dist/collection/components/revo-grid/viewport.js +21 -0
- package/dist/collection/components/revo-grid/viewport.resize.service.js +24 -0
- package/dist/collection/components/revo-grid/viewport.scrolling.service.js +63 -0
- package/dist/collection/components/revo-grid/viewport.section.js +31 -0
- package/dist/collection/components/revo-grid/viewport.service.js +212 -0
- package/dist/collection/components/rowHeaders/revogr-row-headers.js +213 -0
- package/dist/collection/components/rowHeaders/row-header-render.js +4 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +137 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +402 -0
- package/dist/collection/components/scrollable/revogr-scroll-style.css +104 -0
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +256 -0
- package/dist/collection/components/selection-focus/revogr-focus-style.css +77 -0
- package/dist/collection/components/selection-focus/revogr-focus.js +106 -0
- package/dist/collection/components/selection-temp-range/revogr-temp-range-style.css +98 -0
- package/dist/collection/components/selection-temp-range/revogr-temp-range.js +141 -0
- package/dist/{revo-grid/app-globals-7e6866ba.js → collection/global/global.js} +2 -8
- package/dist/collection/index.js +4 -0
- package/dist/collection/plugins/autoSizeColumn.js +233 -0
- package/dist/collection/plugins/basePlugin.js +30 -0
- package/dist/{revo-grid/dispatcher-891af82e.js → collection/plugins/dispatcher.js} +2 -4
- package/dist/collection/plugins/export/csv.js +71 -0
- package/dist/collection/plugins/export/export.plugin.js +168 -0
- package/dist/collection/plugins/export/types.js +4 -0
- package/dist/collection/plugins/filter/conditions/equal.js +20 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThan.js +13 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +10 -0
- package/dist/collection/plugins/filter/conditions/number/lessThan.js +15 -0
- package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +10 -0
- package/dist/collection/plugins/filter/conditions/set.js +6 -0
- package/dist/collection/plugins/filter/conditions/string/beginswith.js +20 -0
- package/dist/collection/plugins/filter/conditions/string/contains.js +21 -0
- package/dist/{revo-grid/filter.button-74c1cd9c.js → collection/plugins/filter/filter.button.js} +10 -13
- package/dist/collection/plugins/filter/filter.plugin.js +259 -0
- package/dist/collection/plugins/filter/filter.pop.js +488 -0
- package/dist/collection/plugins/filter/filter.service.js +47 -0
- package/dist/collection/plugins/filter/filter.style.css +239 -0
- package/dist/collection/plugins/filter/filter.types.js +4 -0
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +33 -0
- package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +39 -0
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +24 -0
- package/dist/collection/plugins/groupingRow/grouping.const.js +13 -0
- package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +79 -0
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +261 -0
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +32 -0
- package/dist/collection/plugins/groupingRow/grouping.row.types.js +4 -0
- package/dist/collection/plugins/groupingRow/grouping.service.js +158 -0
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +60 -0
- package/dist/collection/plugins/moveColumn/columnDragPlugin.js +151 -0
- package/dist/collection/plugins/moveColumn/columnOrderHandler.js +63 -0
- package/dist/collection/plugins/sorting/sorting.plugin.js +184 -0
- package/dist/collection/plugins/sorting/sorting.sign.js +9 -0
- package/dist/collection/plugins/stretchPlugin.js +71 -0
- package/dist/collection/plugins/trimmed/trimmed.plugin.js +35 -0
- package/dist/collection/services/cell.helpers.js +10 -0
- package/dist/collection/services/column.data.provider.js +191 -0
- package/dist/collection/services/data.provider.js +50 -0
- package/dist/collection/services/dimension.provider.js +81 -0
- package/dist/{revo-grid/localScrollService-e9b73323.js → collection/services/localScrollService.js} +2 -5
- package/dist/collection/services/resizable.directive.js +255 -0
- package/dist/collection/services/selection.store.connector.js +216 -0
- package/dist/collection/services/viewport.provider.js +17 -0
- package/dist/collection/store/dataSource/data.proxy.js +37 -0
- package/dist/collection/store/dataSource/data.store.js +130 -0
- package/dist/collection/store/dimension/dimension.helpers.js +110 -0
- package/dist/collection/store/dimension/dimension.store.js +62 -0
- package/dist/collection/store/selection/selection.helpers.js +56 -0
- package/dist/collection/store/selection/selection.store.js +71 -0
- package/dist/collection/store/selection/selection.store.service.js +38 -0
- package/dist/collection/store/storeTypes.js +8 -0
- package/dist/{revo-grid/viewport.store-ffaaab6d.js → collection/store/viewPort/viewport.helpers.js} +9 -132
- package/dist/collection/store/viewPort/viewport.store.js +124 -0
- package/dist/collection/themeManager/theme.compact.js +8 -0
- package/dist/collection/themeManager/theme.default.js +8 -0
- package/dist/collection/themeManager/theme.material.js +8 -0
- package/dist/{revo-grid/themeService-ddaaa364.js → collection/themeManager/themeService.js} +6 -23
- package/dist/collection/utils/closestPolifill.js +21 -0
- package/dist/collection/utils/consts.js +22 -0
- package/dist/collection/utils/generateAlphabetHeader.js +23 -0
- package/dist/collection/utils/keyCodes.js +73 -0
- package/dist/collection/utils/keyCodes.utils.js +67 -0
- package/dist/collection/utils/platform.js +8 -0
- package/dist/collection/utils/resizeObserver.js +9 -0
- package/dist/collection/utils/store.utils.js +10 -0
- package/dist/{revo-grid/utils-2c3b3857.js → collection/utils/utils.js} +8 -10
- package/dist/collection/utilsExternal/generate-data.js +132 -0
- package/dist/esm/css-shim-e1e1ea5e.js +7 -0
- package/dist/esm/debounce-e4e6dd45.js +561 -0
- package/dist/esm/dom-21bd1807.js +76 -0
- package/dist/esm/index-6f753b3c.js +1817 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/loader.js +34 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/resize-observer-00c48d78.js +503 -0
- package/dist/esm/revo-grid.js +77 -0
- package/dist/{revo-grid/lodash-a0ab4cdd.js → esm/revo-grid_11.entry.js} +25351 -14282
- package/dist/esm/revogr-clipboard.entry.js +52 -0
- package/dist/esm/revogr-filter-panel.entry.js +274 -0
- package/dist/esm-es5/css-shim-e1e1ea5e.js +4 -0
- package/dist/esm-es5/debounce-e4e6dd45.js +4 -0
- package/dist/esm-es5/dom-21bd1807.js +24 -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 -0
- package/dist/esm-es5/resize-observer-00c48d78.js +4 -0
- package/dist/esm-es5/revo-grid.js +4 -0
- package/dist/esm-es5/revo-grid_11.entry.js +4 -0
- package/dist/esm-es5/revogr-clipboard.entry.js +4 -0
- package/dist/esm-es5/revogr-filter-panel.entry.js +4 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- 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-5a33c710.system.js +4 -0
- package/dist/revo-grid/debounce-726bdadb.js +4 -0
- package/dist/revo-grid/dom-21bd1807.js +5 -59
- package/dist/revo-grid/dom-726246e2.system.js +24 -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.system.js +4 -0
- package/dist/revo-grid/resize-observer-00c48d78.js +1 -500
- package/dist/revo-grid/resize-observer-8af0bc0e.system.js +4 -0
- package/dist/revo-grid/revo-grid.esm.js +1 -130
- package/dist/revo-grid/revo-grid.js +133 -0
- package/dist/revo-grid/revo-grid.system.js +4 -0
- package/dist/revo-grid/revo-grid_11.entry.js +4 -0
- package/dist/revo-grid/revo-grid_11.system.entry.js +4 -0
- package/dist/revo-grid/revogr-clipboard.entry.js +1 -49
- package/dist/revo-grid/revogr-clipboard.system.entry.js +4 -0
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -274
- package/dist/revo-grid/revogr-filter-panel.system.entry.js +4 -0
- package/dist/types/components/revo-grid/revo-grid.d.ts +0 -1
- package/dist/types/components.d.ts +2 -2
- 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 +1 -1
- package/dist/revo-grid/_baseIteratee-af30b221.js +0 -2070
- package/dist/revo-grid/consts-ef824e6f.js +0 -46
- package/dist/revo-grid/css-shim-5387c708.js +0 -7
- package/dist/revo-grid/data.store-3263fff9.js +0 -557
- package/dist/revo-grid/debounce-aaa4b4da.js +0 -217
- package/dist/revo-grid/dimension.helpers-a7944fc4.js +0 -340
- package/dist/revo-grid/each-0378e5a3.js +0 -180
- package/dist/revo-grid/identity-c8c7d3d8.js +0 -26
- package/dist/revo-grid/isString-a51066b5.js +0 -34
- package/dist/revo-grid/isSymbol-e4b5dafe.js +0 -247
- package/dist/revo-grid/keyCodes.utils-bd06e3ba.js +0 -299
- package/dist/revo-grid/keys-70b7c240.js +0 -561
- package/dist/revo-grid/revo-grid.entry.js +0 -3484
- package/dist/revo-grid/revogr-data.entry.js +0 -152
- package/dist/revo-grid/revogr-edit.entry.js +0 -105
- package/dist/revo-grid/revogr-focus.entry.js +0 -41
- package/dist/revo-grid/revogr-header.entry.js +0 -560
- package/dist/revo-grid/revogr-order-editor.entry.js +0 -175
- package/dist/revo-grid/revogr-overlay-selection.entry.js +0 -711
- package/dist/revo-grid/revogr-row-headers.entry.js +0 -73
- package/dist/revo-grid/revogr-scroll-virtual.entry.js +0 -114
- package/dist/revo-grid/revogr-temp-range.entry.js +0 -73
- package/dist/revo-grid/revogr-viewport-scroll.entry.js +0 -340
- package/dist/revo-grid/selection.store.connector-2b613fd0.js +0 -503
- package/dist/revo-grid/shadow-css-602a09db.js +0 -390
- package/dist/revo-grid/toInteger-9e6cbfd2.js +0 -107
- package/dist/revo-grid/toNumber-913b0b72.js +0 -105
- package/dist/revo-grid/viewport.helpers-49d3f031.js +0 -16
package/dist/{revo-grid/localScrollService-e9b73323.js → collection/services/localScrollService.js}
RENAMED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { scaleValue } from '../utils/utils';
|
|
6
5
|
const initialParams = {
|
|
7
6
|
contentSize: 0,
|
|
8
7
|
clientSize: 0,
|
|
9
8
|
virtualSize: 0,
|
|
10
9
|
maxSize: 0,
|
|
11
10
|
};
|
|
12
|
-
class LocalScrollService {
|
|
11
|
+
export default class LocalScrollService {
|
|
13
12
|
constructor(cfg) {
|
|
14
13
|
this.cfg = cfg;
|
|
15
14
|
this.preventArtificialScroll = { rgRow: null, rgCol: null };
|
|
@@ -82,5 +81,3 @@ class LocalScrollService {
|
|
|
82
81
|
return scaleValue(pos, to, from);
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
|
-
|
|
86
|
-
export { LocalScrollService as L };
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { h } from '@stencil/core';
|
|
5
|
+
var ResizeEvents;
|
|
6
|
+
(function (ResizeEvents) {
|
|
7
|
+
ResizeEvents["start"] = "resize:start";
|
|
8
|
+
ResizeEvents["move"] = "resize:move";
|
|
9
|
+
ResizeEvents["end"] = "resize:end";
|
|
10
|
+
})(ResizeEvents || (ResizeEvents = {}));
|
|
11
|
+
const RESIZE_MASK = {
|
|
12
|
+
'resizable-r': { bit: 0b0001, cursor: 'ew-resize' },
|
|
13
|
+
'resizable-rb': { bit: 0b0011, cursor: 'se-resize' },
|
|
14
|
+
'resizable-b': { bit: 0b0010, cursor: 's-resize' },
|
|
15
|
+
'resizable-lb': { bit: 0b0110, cursor: 'sw-resize' },
|
|
16
|
+
'resizable-l': { bit: 0b0100, cursor: 'w-resize' },
|
|
17
|
+
'resizable-lt': { bit: 0b1100, cursor: 'nw-resize' },
|
|
18
|
+
'resizable-t': { bit: 0b1000, cursor: 'n-resize' },
|
|
19
|
+
'resizable-rt': { bit: 0b1001, cursor: 'ne-resize' },
|
|
20
|
+
};
|
|
21
|
+
const DISABLE_MASK = {
|
|
22
|
+
l: 0b0001,
|
|
23
|
+
t: 0b0010,
|
|
24
|
+
w: 0b0100,
|
|
25
|
+
h: 0b1000,
|
|
26
|
+
};
|
|
27
|
+
const defaultProps = (props) => {
|
|
28
|
+
return Object.assign(Object.assign({}, props), { fitParent: props.fitParent || false, active: props.active || [], disableAttributes: props.disableAttributes || [], minWidth: props.minWidth || 0, minHeight: props.minHeight || 0 });
|
|
29
|
+
};
|
|
30
|
+
export class ResizeDirective {
|
|
31
|
+
constructor(initialProps, $event) {
|
|
32
|
+
this.initialProps = initialProps;
|
|
33
|
+
this.$event = $event;
|
|
34
|
+
this.mouseX = 0;
|
|
35
|
+
this.mouseY = 0;
|
|
36
|
+
this.width = 0;
|
|
37
|
+
this.height = 0;
|
|
38
|
+
this.changeX = 0;
|
|
39
|
+
this.changeY = 0;
|
|
40
|
+
this.disableCalcMap = 0b1111;
|
|
41
|
+
this.props = defaultProps(initialProps);
|
|
42
|
+
this.mouseMoveFunc = this.handleMove.bind(this);
|
|
43
|
+
this.mouseUpFunc = this.handleUp.bind(this);
|
|
44
|
+
this.minW = this.props.minWidth;
|
|
45
|
+
this.minH = this.props.minHeight;
|
|
46
|
+
this.maxW = this.props.maxWidth;
|
|
47
|
+
this.maxH = this.props.maxHeight;
|
|
48
|
+
this.parent = { width: 0, height: 0 };
|
|
49
|
+
this.resizeState = 0;
|
|
50
|
+
}
|
|
51
|
+
set($el) {
|
|
52
|
+
this.$el = $el;
|
|
53
|
+
this.props.disableAttributes.forEach(attr => {
|
|
54
|
+
switch (attr) {
|
|
55
|
+
case 'l':
|
|
56
|
+
this.disableCalcMap &= ~DISABLE_MASK.l;
|
|
57
|
+
break;
|
|
58
|
+
case 't':
|
|
59
|
+
this.disableCalcMap &= ~DISABLE_MASK.t;
|
|
60
|
+
break;
|
|
61
|
+
case 'w':
|
|
62
|
+
this.disableCalcMap &= ~DISABLE_MASK.w;
|
|
63
|
+
break;
|
|
64
|
+
case 'h':
|
|
65
|
+
this.disableCalcMap &= ~DISABLE_MASK.h;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
emitEvent(eventName, additionalOptions) {
|
|
70
|
+
if (!this.$event) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.$event(Object.assign({ eventName, width: this.width + this.changeX, height: this.height + this.changeY, changedX: this.changeX, changedY: this.changeY }, additionalOptions));
|
|
74
|
+
}
|
|
75
|
+
static isTouchEvent(e) {
|
|
76
|
+
var _a;
|
|
77
|
+
const event = e;
|
|
78
|
+
return ((_a = event.touches) === null || _a === void 0 ? void 0 : _a.length) >= 0;
|
|
79
|
+
}
|
|
80
|
+
handleMove(event) {
|
|
81
|
+
if (!this.resizeState) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
let eventY, eventX;
|
|
85
|
+
if (ResizeDirective.isTouchEvent(event)) {
|
|
86
|
+
eventY = event.touches[0].clientY;
|
|
87
|
+
eventX = event.touches[0].clientX;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
eventY = event.clientY;
|
|
91
|
+
eventX = event.clientX;
|
|
92
|
+
}
|
|
93
|
+
let isX = this.resizeState & RESIZE_MASK['resizable-r'].bit || this.resizeState & RESIZE_MASK['resizable-l'].bit;
|
|
94
|
+
let isY = this.resizeState & RESIZE_MASK['resizable-t'].bit || this.resizeState & RESIZE_MASK['resizable-b'].bit;
|
|
95
|
+
if (isY && this.disableCalcMap & DISABLE_MASK.h) {
|
|
96
|
+
let diffY = eventY - this.mouseY;
|
|
97
|
+
let changedY = this.changeY + diffY;
|
|
98
|
+
const newHeight = this.height + changedY;
|
|
99
|
+
// if overcrossed min height
|
|
100
|
+
if (newHeight < this.minH) {
|
|
101
|
+
changedY = -(this.height - this.minH);
|
|
102
|
+
}
|
|
103
|
+
// if overcrossed max heiht
|
|
104
|
+
if (this.maxH && newHeight > this.maxH) {
|
|
105
|
+
changedY = this.maxH - this.height;
|
|
106
|
+
}
|
|
107
|
+
this.changeY = changedY;
|
|
108
|
+
this.mouseY = eventY;
|
|
109
|
+
if (this.activeResizer) {
|
|
110
|
+
this.activeResizer.style.bottom = `${-this.changeY}px`;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (isX && this.disableCalcMap & DISABLE_MASK.w) {
|
|
114
|
+
let diffX = eventX - this.mouseX;
|
|
115
|
+
let changedX = this.changeX + diffX;
|
|
116
|
+
const newWidth = this.width + changedX;
|
|
117
|
+
// if overcrossed min width
|
|
118
|
+
if (newWidth < this.minW) {
|
|
119
|
+
changedX = -(this.width - this.minW);
|
|
120
|
+
}
|
|
121
|
+
// if overcrossed max width
|
|
122
|
+
if (this.maxW && newWidth > this.maxW) {
|
|
123
|
+
changedX = this.maxW - this.width;
|
|
124
|
+
}
|
|
125
|
+
this.changeX = changedX;
|
|
126
|
+
this.mouseX = eventX;
|
|
127
|
+
if (this.activeResizer) {
|
|
128
|
+
this.activeResizer.style.right = `${-this.changeX}px`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
this.emitEvent(ResizeEvents.move);
|
|
132
|
+
}
|
|
133
|
+
handleDown(event) {
|
|
134
|
+
if (event.defaultPrevented) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// stop other events if resize in progress
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
this.dropInitial();
|
|
140
|
+
for (let elClass in RESIZE_MASK) {
|
|
141
|
+
const target = event.target;
|
|
142
|
+
if (this.$el.contains(target) && (target === null || target === void 0 ? void 0 : target.classList.contains(elClass))) {
|
|
143
|
+
document.body.style.cursor = RESIZE_MASK[elClass].cursor;
|
|
144
|
+
if (ResizeDirective.isTouchEvent(event)) {
|
|
145
|
+
this.setInitials(event.touches[0], target);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
event.preventDefault && event.preventDefault();
|
|
149
|
+
this.setInitials(event, target);
|
|
150
|
+
}
|
|
151
|
+
this.resizeState = RESIZE_MASK[elClass].bit;
|
|
152
|
+
const eventName = ResizeEvents.start;
|
|
153
|
+
this.emitEvent(eventName);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
this.bindMove();
|
|
158
|
+
}
|
|
159
|
+
handleUp(e) {
|
|
160
|
+
e.preventDefault();
|
|
161
|
+
if (this.resizeState !== 0) {
|
|
162
|
+
this.resizeState = 0;
|
|
163
|
+
document.body.style.cursor = '';
|
|
164
|
+
const eventName = ResizeEvents.end;
|
|
165
|
+
this.emitEvent(eventName);
|
|
166
|
+
}
|
|
167
|
+
this.dropInitial();
|
|
168
|
+
this.unbindMove();
|
|
169
|
+
}
|
|
170
|
+
setInitials({ clientX, clientY }, target) {
|
|
171
|
+
const computedStyle = getComputedStyle(this.$el);
|
|
172
|
+
this.$el.classList.add('active');
|
|
173
|
+
this.activeResizer = target;
|
|
174
|
+
if (this.disableCalcMap & DISABLE_MASK.w) {
|
|
175
|
+
this.mouseX = clientX;
|
|
176
|
+
this.width = this.$el.clientWidth;
|
|
177
|
+
this.parent.width = this.$el.parentElement.clientWidth;
|
|
178
|
+
// min width
|
|
179
|
+
const minPaddingX = parseFloat(computedStyle.paddingLeft) + parseFloat(computedStyle.paddingRight);
|
|
180
|
+
this.minW = Math.max(minPaddingX, this.initialProps.minWidth || 0);
|
|
181
|
+
// max width
|
|
182
|
+
if (this.initialProps.maxWidth) {
|
|
183
|
+
this.maxW = Math.max(this.width, this.initialProps.maxWidth);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (this.disableCalcMap & DISABLE_MASK.h) {
|
|
187
|
+
this.mouseY = clientY;
|
|
188
|
+
this.height = this.$el.clientHeight;
|
|
189
|
+
this.parent.height = this.$el.parentElement.clientHeight;
|
|
190
|
+
// min height
|
|
191
|
+
const minPaddingY = parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
|
|
192
|
+
this.minH = Math.max(minPaddingY, this.initialProps.minHeight || 0);
|
|
193
|
+
// max height
|
|
194
|
+
if (this.initialProps.maxHeight) {
|
|
195
|
+
this.maxH = Math.max(this.height, this.initialProps.maxHeight);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
dropInitial() {
|
|
200
|
+
this.changeX = this.changeY = this.minW = this.minH;
|
|
201
|
+
this.width = this.height = 0;
|
|
202
|
+
if (this.activeResizer) {
|
|
203
|
+
this.activeResizer.removeAttribute('style');
|
|
204
|
+
}
|
|
205
|
+
this.$el.classList.remove('active');
|
|
206
|
+
this.activeResizer = null;
|
|
207
|
+
}
|
|
208
|
+
bindMove() {
|
|
209
|
+
document.documentElement.addEventListener('mouseup', this.mouseUpFunc, true);
|
|
210
|
+
document.documentElement.addEventListener('touchend', this.mouseUpFunc, true);
|
|
211
|
+
document.documentElement.addEventListener('mousemove', this.mouseMoveFunc, true);
|
|
212
|
+
document.documentElement.addEventListener('touchmove', this.mouseMoveFunc, true);
|
|
213
|
+
document.documentElement.addEventListener('mouseleave', this.mouseUpFunc);
|
|
214
|
+
}
|
|
215
|
+
unbindMove() {
|
|
216
|
+
document.documentElement.removeEventListener('mouseup', this.mouseUpFunc, true);
|
|
217
|
+
document.documentElement.removeEventListener('touchend', this.mouseUpFunc, true);
|
|
218
|
+
document.documentElement.removeEventListener('mousemove', this.mouseMoveFunc, true);
|
|
219
|
+
document.documentElement.removeEventListener('touchmove', this.mouseMoveFunc, true);
|
|
220
|
+
document.documentElement.removeEventListener('mouseleave', this.mouseUpFunc);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
export const ResizableElement = (props, children) => {
|
|
224
|
+
const resizeEls = [];
|
|
225
|
+
const directive = (props.canResize &&
|
|
226
|
+
new ResizeDirective(props, e => {
|
|
227
|
+
if (e.eventName === ResizeEvents.end) {
|
|
228
|
+
props.onResize && props.onResize(e);
|
|
229
|
+
}
|
|
230
|
+
})) ||
|
|
231
|
+
null;
|
|
232
|
+
if (props.canResize) {
|
|
233
|
+
if (props.active) {
|
|
234
|
+
for (let p in props.active) {
|
|
235
|
+
resizeEls.push(h("div", { onClick: e => e.preventDefault(), onDblClick: e => {
|
|
236
|
+
e.preventDefault();
|
|
237
|
+
props.onDoubleClick && props.onDoubleClick();
|
|
238
|
+
}, onMouseDown: (e) => directive === null || directive === void 0 ? void 0 : directive.handleDown(e), onTouchStart: (e) => directive === null || directive === void 0 ? void 0 : directive.handleDown(e), class: `resizable resizable-${props.active[p]}` }));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
if (props.active) {
|
|
244
|
+
for (let p in props.active) {
|
|
245
|
+
resizeEls.push(h("div", { onClick: e => e.preventDefault(), onDblClick: e => {
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
props.onDoubleClick && props.onDoubleClick();
|
|
248
|
+
}, class: `no-resize resizable resizable-${props.active[p]}` }));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return (h("div", Object.assign({}, props, { ref: (e) => directive === null || directive === void 0 ? void 0 : directive.set(e) }),
|
|
253
|
+
children,
|
|
254
|
+
resizeEls));
|
|
255
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { cropCellToMax, isHiddenStore, nextCell } from '../store/selection/selection.helpers';
|
|
5
|
+
import { SelectionStore } from '../store/selection/selection.store';
|
|
6
|
+
export const EMPTY_INDEX = -1;
|
|
7
|
+
export default class SelectionStoreConnector {
|
|
8
|
+
constructor() {
|
|
9
|
+
// dirty flag required to cleanup whole store in case visibility of panels changed
|
|
10
|
+
this.dirty = false;
|
|
11
|
+
this.stores = {};
|
|
12
|
+
this.columnStores = {};
|
|
13
|
+
this.rowStores = {};
|
|
14
|
+
this.sections = [];
|
|
15
|
+
}
|
|
16
|
+
get focusedStore() {
|
|
17
|
+
var _a;
|
|
18
|
+
for (let y in this.stores) {
|
|
19
|
+
for (let x in this.stores[y]) {
|
|
20
|
+
const focused = (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.store.get('focus');
|
|
21
|
+
if (focused) {
|
|
22
|
+
return {
|
|
23
|
+
entity: this.stores[y][x],
|
|
24
|
+
cell: focused,
|
|
25
|
+
position: {
|
|
26
|
+
x: parseInt(x, 10),
|
|
27
|
+
y: parseInt(y, 10)
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
get edit() {
|
|
36
|
+
var _a;
|
|
37
|
+
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('edit');
|
|
38
|
+
}
|
|
39
|
+
get focused() {
|
|
40
|
+
var _a;
|
|
41
|
+
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('focus');
|
|
42
|
+
}
|
|
43
|
+
get selectedRange() {
|
|
44
|
+
var _a;
|
|
45
|
+
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
|
|
46
|
+
}
|
|
47
|
+
registerSection(e) {
|
|
48
|
+
if (!e) {
|
|
49
|
+
this.sections.length = 0;
|
|
50
|
+
// some elements removed, rebuild stores
|
|
51
|
+
this.dirty = true;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (this.sections.indexOf(e) === -1) {
|
|
55
|
+
this.sections.push(e);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// check if require to cleanup all stores
|
|
59
|
+
beforeUpdate() {
|
|
60
|
+
if (this.dirty) {
|
|
61
|
+
for (let y in this.stores) {
|
|
62
|
+
for (let x in this.stores[y]) {
|
|
63
|
+
this.stores[y][x].dispose();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this.dirty = false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
registerColumn(x) {
|
|
70
|
+
// if hidden just create store
|
|
71
|
+
if (isHiddenStore(x)) {
|
|
72
|
+
return new SelectionStore();
|
|
73
|
+
}
|
|
74
|
+
if (this.columnStores[x]) {
|
|
75
|
+
return this.columnStores[x];
|
|
76
|
+
}
|
|
77
|
+
this.columnStores[x] = new SelectionStore();
|
|
78
|
+
return this.columnStores[x];
|
|
79
|
+
}
|
|
80
|
+
registerRow(y) {
|
|
81
|
+
// if hidden just create store
|
|
82
|
+
if (isHiddenStore(y)) {
|
|
83
|
+
return new SelectionStore();
|
|
84
|
+
}
|
|
85
|
+
if (this.rowStores[y]) {
|
|
86
|
+
return this.rowStores[y];
|
|
87
|
+
}
|
|
88
|
+
this.rowStores[y] = new SelectionStore();
|
|
89
|
+
return this.rowStores[y];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Cross store proxy, based on multiple dimensions
|
|
93
|
+
*/
|
|
94
|
+
register({ x, y }) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
// if hidden just create store
|
|
97
|
+
if (isHiddenStore(x) || isHiddenStore(y)) {
|
|
98
|
+
return new SelectionStore();
|
|
99
|
+
}
|
|
100
|
+
if (!this.stores[y]) {
|
|
101
|
+
this.stores[y] = {};
|
|
102
|
+
}
|
|
103
|
+
if (this.stores[y][x]) {
|
|
104
|
+
// Store already registered. Do not register twice
|
|
105
|
+
return this.stores[y][x];
|
|
106
|
+
}
|
|
107
|
+
this.stores[y][x] = new SelectionStore();
|
|
108
|
+
// proxy update
|
|
109
|
+
(_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.onChange('range', c => {
|
|
110
|
+
this.columnStores[x].setRangeArea(c);
|
|
111
|
+
this.rowStores[y].setRangeArea(c);
|
|
112
|
+
});
|
|
113
|
+
// clean up on remove
|
|
114
|
+
(_b = this.stores[y][x]) === null || _b === void 0 ? void 0 : _b.store.on('dispose', () => {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
(_a = this.columnStores[x]) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
117
|
+
(_b = this.rowStores[y]) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
118
|
+
delete this.rowStores[y];
|
|
119
|
+
delete this.columnStores[x];
|
|
120
|
+
if (this.stores[y]) {
|
|
121
|
+
delete this.stores[y][x];
|
|
122
|
+
}
|
|
123
|
+
// clear empty rows
|
|
124
|
+
if (!Object.keys(this.stores[y] || {}).length) {
|
|
125
|
+
delete this.stores[y];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return this.stores[y][x];
|
|
129
|
+
}
|
|
130
|
+
setEditByCell({ x, y }, editCell) {
|
|
131
|
+
const store = this.stores[y][x];
|
|
132
|
+
this.focus(store, { focus: editCell, end: editCell });
|
|
133
|
+
this.setEdit('');
|
|
134
|
+
}
|
|
135
|
+
focus(store, { focus, end }) {
|
|
136
|
+
let currentStorePointer;
|
|
137
|
+
// clear all stores focus leave only active one
|
|
138
|
+
for (let y in this.stores) {
|
|
139
|
+
for (let x in this.stores[y]) {
|
|
140
|
+
const s = this.stores[y][x];
|
|
141
|
+
// clear other stores, only one area can be selected
|
|
142
|
+
if (s !== store) {
|
|
143
|
+
s.clearFocus();
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
currentStorePointer = { x: parseInt(x, 10), y: parseInt(y, 10) };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (!currentStorePointer) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
// check is focus in next store
|
|
154
|
+
const lastCell = store.store.get('lastCell');
|
|
155
|
+
// item in new store
|
|
156
|
+
const nextItem = nextCell(focus, lastCell);
|
|
157
|
+
let nextStore;
|
|
158
|
+
if (nextItem) {
|
|
159
|
+
for (let i in nextItem) {
|
|
160
|
+
let type = i;
|
|
161
|
+
let stores;
|
|
162
|
+
switch (type) {
|
|
163
|
+
case 'x':
|
|
164
|
+
stores = this.getXStores(currentStorePointer.y);
|
|
165
|
+
break;
|
|
166
|
+
case 'y':
|
|
167
|
+
stores = this.getYStores(currentStorePointer.x);
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
if (nextItem[type] >= 0) {
|
|
171
|
+
nextStore = stores[++currentStorePointer[type]];
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
nextStore = stores[--currentStorePointer[type]];
|
|
175
|
+
const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
|
|
176
|
+
if (nextLastCell) {
|
|
177
|
+
nextItem[type] = nextLastCell[type] + nextItem[type];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// if next store present - update
|
|
183
|
+
if (nextStore) {
|
|
184
|
+
let item = Object.assign(Object.assign({}, focus), nextItem);
|
|
185
|
+
this.focus(nextStore, { focus: item, end: item });
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
focus = cropCellToMax(focus, lastCell);
|
|
189
|
+
end = cropCellToMax(focus, lastCell);
|
|
190
|
+
store.setFocus(focus, end);
|
|
191
|
+
}
|
|
192
|
+
clearAll() {
|
|
193
|
+
var _a;
|
|
194
|
+
for (let y in this.stores) {
|
|
195
|
+
for (let x in this.stores[y]) {
|
|
196
|
+
(_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
setEdit(val) {
|
|
201
|
+
if (!this.focusedStore) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.focusedStore.entity.setEdit(val);
|
|
205
|
+
}
|
|
206
|
+
getXStores(y) {
|
|
207
|
+
return this.stores[y];
|
|
208
|
+
}
|
|
209
|
+
getYStores(x) {
|
|
210
|
+
const stores = {};
|
|
211
|
+
for (let i in this.stores) {
|
|
212
|
+
stores[i] = this.stores[i][x];
|
|
213
|
+
}
|
|
214
|
+
return stores;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import reduce from 'lodash/reduce';
|
|
5
|
+
import { columnTypes, rowTypes } from '../store/storeTypes';
|
|
6
|
+
import ViewportStore from '../store/viewPort/viewport.store';
|
|
7
|
+
export default class ViewportProvider {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.stores = reduce([...rowTypes, ...columnTypes], (sources, k) => {
|
|
10
|
+
sources[k] = new ViewportStore();
|
|
11
|
+
return sources;
|
|
12
|
+
}, {});
|
|
13
|
+
}
|
|
14
|
+
setViewport(dimensionType, data) {
|
|
15
|
+
this.stores[dimensionType].setViewport(data);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* All items
|
|
6
|
+
* Used as proxy for sorting
|
|
7
|
+
* Keep order but do not modify final source
|
|
8
|
+
*/
|
|
9
|
+
export const proxyPlugin = (store) => ({
|
|
10
|
+
set(k, newVal) {
|
|
11
|
+
if (!isProxy(k)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Getting existing collection of items
|
|
16
|
+
* Mark indexes as visible
|
|
17
|
+
*/
|
|
18
|
+
const oldItems = store.get('items').reduce((r, v) => {
|
|
19
|
+
r[v] = true;
|
|
20
|
+
return r;
|
|
21
|
+
}, {});
|
|
22
|
+
/**
|
|
23
|
+
* Check if new values where present in items
|
|
24
|
+
* Filter item collection according presense
|
|
25
|
+
*/
|
|
26
|
+
const newItems = newVal.reduce((r, i) => {
|
|
27
|
+
if (oldItems[i]) {
|
|
28
|
+
r.push(i);
|
|
29
|
+
}
|
|
30
|
+
return r;
|
|
31
|
+
}, []);
|
|
32
|
+
store.set('items', newItems);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
function isProxy(k) {
|
|
36
|
+
return k === 'proxyItems';
|
|
37
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { createStore } from '@stencil/store';
|
|
5
|
+
import findIndex from 'lodash/findIndex';
|
|
6
|
+
import range from 'lodash/range';
|
|
7
|
+
import { trimmedPlugin } from '../../plugins/trimmed/trimmed.plugin';
|
|
8
|
+
import { setStore } from '../../utils/store.utils';
|
|
9
|
+
import { proxyPlugin } from './data.proxy';
|
|
10
|
+
export default class DataStore {
|
|
11
|
+
constructor(type) {
|
|
12
|
+
const store = (this.dataStore = createStore({
|
|
13
|
+
items: [],
|
|
14
|
+
proxyItems: [],
|
|
15
|
+
source: [],
|
|
16
|
+
groupingDepth: 0,
|
|
17
|
+
groups: {},
|
|
18
|
+
type,
|
|
19
|
+
trimmed: {},
|
|
20
|
+
}));
|
|
21
|
+
store.use(proxyPlugin(store));
|
|
22
|
+
store.use(trimmedPlugin(store));
|
|
23
|
+
}
|
|
24
|
+
get store() {
|
|
25
|
+
return this.dataStore;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* full data source update
|
|
29
|
+
* @param source - data column/rgRow source
|
|
30
|
+
* @param grouping - grouping information if present
|
|
31
|
+
*/
|
|
32
|
+
updateData(source, grouping, silent = false) {
|
|
33
|
+
// during full update we do drop trim
|
|
34
|
+
if (!silent) {
|
|
35
|
+
this.store.set('trimmed', {});
|
|
36
|
+
}
|
|
37
|
+
// clear items
|
|
38
|
+
this.store.set('items', []);
|
|
39
|
+
const items = range(0, (source === null || source === void 0 ? void 0 : source.length) || 0);
|
|
40
|
+
// set proxy first
|
|
41
|
+
setStore(this.store, {
|
|
42
|
+
source,
|
|
43
|
+
proxyItems: [...items],
|
|
44
|
+
});
|
|
45
|
+
// update data items
|
|
46
|
+
this.store.set('items', items);
|
|
47
|
+
// apply grooping if present
|
|
48
|
+
if (grouping) {
|
|
49
|
+
setStore(this.store, {
|
|
50
|
+
groupingDepth: grouping.depth,
|
|
51
|
+
groups: grouping.groups,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
addTrimmed(some) {
|
|
56
|
+
let trimmed = this.store.get('trimmed');
|
|
57
|
+
trimmed = Object.assign(Object.assign({}, trimmed), some);
|
|
58
|
+
setStore(this.store, { trimmed });
|
|
59
|
+
}
|
|
60
|
+
// local data update
|
|
61
|
+
setData(input) {
|
|
62
|
+
const data = Object.assign({}, input);
|
|
63
|
+
setStore(this.store, data);
|
|
64
|
+
}
|
|
65
|
+
refresh() {
|
|
66
|
+
const source = this.store.get('source');
|
|
67
|
+
this.store.set('source', [...source]);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* get physical index by virtual
|
|
72
|
+
* @param store - store to process
|
|
73
|
+
*/
|
|
74
|
+
export function getPhysical(store, virtualIndex) {
|
|
75
|
+
const items = store.get('items');
|
|
76
|
+
return items[virtualIndex];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* get all visible items
|
|
80
|
+
* @param store - store to process
|
|
81
|
+
*/
|
|
82
|
+
export function getVisibleSourceItem(store) {
|
|
83
|
+
const source = store.get('source');
|
|
84
|
+
return store.get('items').map(v => source[v]);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* get mapped item from source
|
|
88
|
+
* @param store - store to process
|
|
89
|
+
* @param virtualIndex - virtual index to process
|
|
90
|
+
*/
|
|
91
|
+
export function getSourceItem(store, virtualIndex) {
|
|
92
|
+
const items = store.get('items');
|
|
93
|
+
const source = store.get('source');
|
|
94
|
+
return source[items[virtualIndex]];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* set item to source
|
|
98
|
+
* @param store - store to process
|
|
99
|
+
* @param modelByIndex - collection of rows with virtual indexes to setup
|
|
100
|
+
*/
|
|
101
|
+
export function setSourceByVirtualIndex(store, modelByIndex) {
|
|
102
|
+
const items = store.get('items');
|
|
103
|
+
const source = store.get('source');
|
|
104
|
+
for (let virtualIndex in modelByIndex) {
|
|
105
|
+
const realIndex = items[virtualIndex];
|
|
106
|
+
source[realIndex] = modelByIndex[virtualIndex];
|
|
107
|
+
}
|
|
108
|
+
store.set('source', [...source]);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* set item to source
|
|
112
|
+
* @param store - store to process
|
|
113
|
+
* @param modelByIndex - collection of rows with physical indexes to setup
|
|
114
|
+
*/
|
|
115
|
+
export function setSourceByPhysicalIndex(store, modelByIndex) {
|
|
116
|
+
const source = store.get('source');
|
|
117
|
+
for (let index in modelByIndex) {
|
|
118
|
+
source[index] = modelByIndex[index];
|
|
119
|
+
}
|
|
120
|
+
store.set('source', [...source]);
|
|
121
|
+
}
|
|
122
|
+
export function setItems(store, items) {
|
|
123
|
+
store.set('items', items);
|
|
124
|
+
}
|
|
125
|
+
export function getSourceItemVirtualIndexByProp(store, prop) {
|
|
126
|
+
const items = store.get('items');
|
|
127
|
+
const source = store.get('source');
|
|
128
|
+
const physicalIndex = findIndex(source, { prop });
|
|
129
|
+
return items.indexOf(physicalIndex);
|
|
130
|
+
}
|