@revolist/revogrid 3.1.6 → 3.2.4
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/revo-grid/_baseIteratee-af30b221.js +2070 -0
- package/dist/{collection/global/global.js → revo-grid/app-globals-7e6866ba.js} +11 -2
- package/dist/{collection/components/data/columnService.js → revo-grid/columnService-91e552ba.js} +11 -6
- package/dist/revo-grid/consts-ef824e6f.js +46 -0
- package/dist/revo-grid/css-shim-5387c708.js +7 -0
- package/dist/revo-grid/data.store-3263fff9.js +557 -0
- package/dist/revo-grid/debounce-aaa4b4da.js +217 -0
- package/dist/revo-grid/dimension.helpers-a7944fc4.js +340 -0
- package/dist/revo-grid/dispatcher-891af82e.js +24 -0
- package/dist/{cjs/dom-c8b6d1a7.js → revo-grid/dom-21bd1807.js} +4 -3
- package/dist/revo-grid/each-0378e5a3.js +180 -0
- package/dist/{collection/plugins/filter/filter.button.js → revo-grid/filter.button-74c1cd9c.js} +16 -10
- package/dist/revo-grid/identity-c8c7d3d8.js +26 -0
- package/dist/revo-grid/index-8a604c17.js +3067 -0
- package/dist/revo-grid/index.esm.js +3 -0
- package/dist/revo-grid/isString-a51066b5.js +34 -0
- package/dist/revo-grid/isSymbol-e4b5dafe.js +247 -0
- package/dist/revo-grid/keyCodes.utils-bd06e3ba.js +299 -0
- package/dist/revo-grid/keys-70b7c240.js +561 -0
- package/dist/{collection/services/localScrollService.js → revo-grid/localScrollService-e9b73323.js} +8 -2
- package/dist/{esm/revo-grid_11.entry.js → revo-grid/lodash-a0ab4cdd.js} +13773 -24597
- package/dist/{cjs/resize-observer-8dc80084.js → revo-grid/resize-observer-00c48d78.js} +25 -14
- package/dist/revo-grid/revo-grid.entry.js +3484 -0
- package/dist/revo-grid/revo-grid.esm.js +133 -1
- package/dist/revo-grid/revogr-clipboard.entry.js +52 -1
- package/dist/revo-grid/revogr-data.entry.js +152 -0
- package/dist/revo-grid/revogr-edit.entry.js +105 -0
- package/dist/revo-grid/revogr-filter-panel.entry.js +277 -1
- package/dist/revo-grid/revogr-focus.entry.js +41 -0
- package/dist/revo-grid/revogr-header.entry.js +560 -0
- package/dist/revo-grid/revogr-order-editor.entry.js +175 -0
- package/dist/revo-grid/revogr-overlay-selection.entry.js +711 -0
- package/dist/revo-grid/revogr-row-headers.entry.js +73 -0
- package/dist/revo-grid/revogr-scroll-virtual.entry.js +114 -0
- package/dist/revo-grid/revogr-temp-range.entry.js +73 -0
- package/dist/revo-grid/revogr-viewport-scroll.entry.js +340 -0
- package/dist/revo-grid/selection.store.connector-2b613fd0.js +503 -0
- package/dist/{collection/components/overlay/selection.utils.js → revo-grid/selection.utils-a9932db6.js} +15 -9
- package/dist/revo-grid/shadow-css-602a09db.js +390 -0
- package/dist/{collection/themeManager/themeService.js → revo-grid/themeService-ddaaa364.js} +26 -6
- package/dist/revo-grid/toInteger-9e6cbfd2.js +107 -0
- package/dist/revo-grid/toNumber-913b0b72.js +105 -0
- package/dist/{collection/utils/utils.js → revo-grid/utils-2c3b3857.js} +13 -8
- package/dist/revo-grid/viewport.helpers-49d3f031.js +16 -0
- package/dist/{collection/store/viewPort/viewport.helpers.js → revo-grid/viewport.store-ffaaab6d.js} +135 -9
- package/dist/types/components/revo-grid/revo-grid.d.ts +6 -0
- package/dist/types/components.d.ts +110 -58
- package/dist/types/plugins/dispatcher.d.ts +10 -0
- package/dist/types/plugins/moveColumn/columnDragPlugin.d.ts +66 -0
- package/dist/types/plugins/moveColumn/columnOrderHandler.d.ts +12 -0
- package/dist/types/services/resizable.directive.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +189 -186
- package/package.json +22 -20
- package/custom-element/index.js +0 -28972
- package/custom-element/resize-observer.js +0 -489
- package/dist/cjs/css-shim-e33df79c.js +0 -6
- package/dist/cjs/debounce-e9b040d9.js +0 -575
- package/dist/cjs/index-d3f67f2e.js +0 -1729
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -35
- package/dist/cjs/revo-grid.cjs.js +0 -73
- package/dist/cjs/revo-grid_11.cjs.entry.js +0 -28056
- package/dist/cjs/revogr-clipboard.cjs.entry.js +0 -53
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +0 -275
- package/dist/collection/collection-manifest.json +0 -25
- package/dist/collection/components/button/button.js +0 -4
- package/dist/collection/components/clipboard/revogr-clipboard.js +0 -121
- package/dist/collection/components/data/cellRenderer.js +0 -24
- package/dist/collection/components/data/revogr-data-style.css +0 -135
- package/dist/collection/components/data/revogr-data.js +0 -322
- package/dist/collection/components/data/rowRenderer.js +0 -6
- package/dist/collection/components/header/headerCellRenderer.js +0 -19
- package/dist/collection/components/header/headerRenderer.js +0 -45
- package/dist/collection/components/header/revogr-header-style.css +0 -198
- package/dist/collection/components/header/revogr-header.js +0 -297
- package/dist/collection/components/order/orderRenderer.js +0 -50
- package/dist/collection/components/order/revogr-order-editor.js +0 -358
- package/dist/collection/components/order/rowOrderService.js +0 -68
- package/dist/collection/components/overlay/autofill.service.js +0 -182
- package/dist/collection/components/overlay/clipboard.service.js +0 -39
- package/dist/collection/components/overlay/editors/edit.utils.js +0 -5
- package/dist/collection/components/overlay/editors/text.js +0 -35
- package/dist/collection/components/overlay/keyboard.service.js +0 -128
- package/dist/collection/components/overlay/revogr-edit-style.css +0 -86
- package/dist/collection/components/overlay/revogr-edit.js +0 -159
- package/dist/collection/components/overlay/revogr-overlay-selection.js +0 -726
- package/dist/collection/components/overlay/revogr-overlay-style.css +0 -98
- package/dist/collection/components/revo-grid/revo-grid-style.css +0 -527
- package/dist/collection/components/revo-grid/revo-grid.js +0 -2186
- package/dist/collection/components/revo-grid/viewport.helpers.js +0 -11
- package/dist/collection/components/revo-grid/viewport.interfaces.js +0 -1
- package/dist/collection/components/revo-grid/viewport.js +0 -18
- package/dist/collection/components/revo-grid/viewport.resize.service.js +0 -21
- package/dist/collection/components/revo-grid/viewport.scrolling.service.js +0 -60
- package/dist/collection/components/revo-grid/viewport.section.js +0 -28
- package/dist/collection/components/revo-grid/viewport.service.js +0 -209
- package/dist/collection/components/rowHeaders/revogr-row-headers.js +0 -210
- package/dist/collection/components/rowHeaders/row-header-render.js +0 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +0 -137
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +0 -399
- package/dist/collection/components/scrollable/revogr-scroll-style.css +0 -104
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +0 -253
- package/dist/collection/components/selection-focus/revogr-focus-style.css +0 -77
- package/dist/collection/components/selection-focus/revogr-focus.js +0 -103
- package/dist/collection/components/selection-temp-range/revogr-temp-range-style.css +0 -98
- package/dist/collection/components/selection-temp-range/revogr-temp-range.js +0 -138
- package/dist/collection/index.js +0 -1
- package/dist/collection/plugins/autoSizeColumn.js +0 -230
- package/dist/collection/plugins/basePlugin.js +0 -27
- package/dist/collection/plugins/export/csv.js +0 -68
- package/dist/collection/plugins/export/export.plugin.js +0 -165
- package/dist/collection/plugins/export/types.js +0 -1
- package/dist/collection/plugins/filter/conditions/equal.js +0 -17
- package/dist/collection/plugins/filter/conditions/number/greaterThan.js +0 -10
- package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +0 -7
- package/dist/collection/plugins/filter/conditions/number/lessThan.js +0 -12
- package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +0 -7
- package/dist/collection/plugins/filter/conditions/set.js +0 -3
- package/dist/collection/plugins/filter/conditions/string/beginswith.js +0 -17
- package/dist/collection/plugins/filter/conditions/string/contains.js +0 -18
- package/dist/collection/plugins/filter/filter.plugin.js +0 -256
- package/dist/collection/plugins/filter/filter.pop.js +0 -485
- package/dist/collection/plugins/filter/filter.service.js +0 -44
- package/dist/collection/plugins/filter/filter.style.css +0 -239
- package/dist/collection/plugins/filter/filter.types.js +0 -1
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +0 -30
- package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +0 -36
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +0 -21
- package/dist/collection/plugins/groupingRow/grouping.const.js +0 -10
- package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +0 -76
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +0 -258
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +0 -29
- package/dist/collection/plugins/groupingRow/grouping.row.types.js +0 -1
- package/dist/collection/plugins/groupingRow/grouping.service.js +0 -155
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +0 -57
- package/dist/collection/plugins/sorting/sorting.plugin.js +0 -181
- package/dist/collection/plugins/sorting/sorting.sign.js +0 -6
- package/dist/collection/plugins/stretchPlugin.js +0 -68
- package/dist/collection/plugins/trimmed/trimmed.plugin.js +0 -32
- package/dist/collection/services/cell.helpers.js +0 -7
- package/dist/collection/services/column.data.provider.js +0 -188
- package/dist/collection/services/data.provider.js +0 -47
- package/dist/collection/services/dimension.provider.js +0 -78
- package/dist/collection/services/resizable.directive.js +0 -250
- package/dist/collection/services/selection.store.connector.js +0 -213
- package/dist/collection/services/viewport.provider.js +0 -14
- package/dist/collection/store/dataSource/data.proxy.js +0 -34
- package/dist/collection/store/dataSource/data.store.js +0 -127
- package/dist/collection/store/dimension/dimension.helpers.js +0 -107
- package/dist/collection/store/dimension/dimension.store.js +0 -59
- package/dist/collection/store/selection/selection.helpers.js +0 -53
- package/dist/collection/store/selection/selection.store.js +0 -68
- package/dist/collection/store/selection/selection.store.service.js +0 -35
- package/dist/collection/store/storeTypes.js +0 -5
- package/dist/collection/store/viewPort/viewport.store.js +0 -121
- package/dist/collection/themeManager/theme.compact.js +0 -5
- package/dist/collection/themeManager/theme.default.js +0 -5
- package/dist/collection/themeManager/theme.material.js +0 -5
- package/dist/collection/utils/closestPolifill.js +0 -18
- package/dist/collection/utils/consts.js +0 -19
- package/dist/collection/utils/generateAlphabetHeader.js +0 -20
- package/dist/collection/utils/keyCodes.js +0 -70
- package/dist/collection/utils/keyCodes.utils.js +0 -64
- package/dist/collection/utils/platform.js +0 -5
- package/dist/collection/utils/resizeObserver.js +0 -6
- package/dist/collection/utils/store.utils.js +0 -7
- package/dist/collection/utilsExternal/generate-data.js +0 -132
- package/dist/esm/css-shim-8d75038b.js +0 -4
- package/dist/esm/debounce-8dadcda7.js +0 -558
- package/dist/esm/dom-1b195079.js +0 -73
- package/dist/esm/index-42c84e7c.js +0 -1694
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -31
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/resize-observer-56b7b34f.js +0 -489
- package/dist/esm/revo-grid.js +0 -71
- package/dist/esm/revogr-clipboard.entry.js +0 -49
- package/dist/esm/revogr-filter-panel.entry.js +0 -271
- package/dist/esm-es5/css-shim-8d75038b.js +0 -1
- package/dist/esm-es5/debounce-8dadcda7.js +0 -1
- package/dist/esm-es5/dom-1b195079.js +0 -21
- package/dist/esm-es5/index-42c84e7c.js +0 -1
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +0 -1
- package/dist/esm-es5/resize-observer-56b7b34f.js +0 -1
- package/dist/esm-es5/revo-grid.js +0 -1
- package/dist/esm-es5/revo-grid_11.entry.js +0 -1
- package/dist/esm-es5/revogr-clipboard.entry.js +0 -1
- package/dist/esm-es5/revogr-filter-panel.entry.js +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.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/debounce-d097578d.js +0 -1
- package/dist/revo-grid/debounce-f40a88f6.system.js +0 -1
- package/dist/revo-grid/dom-1b195079.js +0 -19
- package/dist/revo-grid/dom-ee2dd1b3.system.js +0 -21
- package/dist/revo-grid/index-a15e7527.system.js +0 -1
- package/dist/revo-grid/index-a7f99799.js +0 -1
- package/dist/revo-grid/index.system.js +0 -1
- package/dist/revo-grid/resize-observer-56b7b34f.js +0 -1
- package/dist/revo-grid/resize-observer-7a7b9757.system.js +0 -1
- package/dist/revo-grid/revo-grid.js +0 -132
- package/dist/revo-grid/revo-grid.system.js +0 -1
- package/dist/revo-grid/revo-grid_11.entry.js +0 -1
- package/dist/revo-grid/revo-grid_11.system.entry.js +0 -1
- package/dist/revo-grid/revogr-clipboard.system.entry.js +0 -1
- package/dist/revo-grid/revogr-filter-panel.system.entry.js +0 -1
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import reduce from 'lodash/reduce';
|
|
2
|
-
import each from 'lodash/each';
|
|
3
|
-
import find from 'lodash/find';
|
|
4
|
-
import DataStore, { getSourceItem, getSourceItemVirtualIndexByProp, setSourceByVirtualIndex } from '../store/dataSource/data.store';
|
|
5
|
-
import { columnTypes } from '../store/storeTypes';
|
|
6
|
-
import GroupingColumnPlugin from '../plugins/groupingColumn/grouping.col.plugin';
|
|
7
|
-
export default class ColumnDataProvider {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.sorting = null;
|
|
10
|
-
this.dataSources = reduce(columnTypes, (sources, k) => {
|
|
11
|
-
sources[k] = new DataStore(k);
|
|
12
|
-
return sources;
|
|
13
|
-
}, {});
|
|
14
|
-
}
|
|
15
|
-
get order() {
|
|
16
|
-
return reduce(this.sorting, (r, c, prop) => {
|
|
17
|
-
r[prop] = c.order;
|
|
18
|
-
return r;
|
|
19
|
-
}, {});
|
|
20
|
-
}
|
|
21
|
-
get stores() {
|
|
22
|
-
return this.dataSources;
|
|
23
|
-
}
|
|
24
|
-
column(c, pin) {
|
|
25
|
-
return this.getColumn(c, pin || 'rgCol');
|
|
26
|
-
}
|
|
27
|
-
getColumn(virtualIndex, type) {
|
|
28
|
-
return getSourceItem(this.dataSources[type].store, virtualIndex);
|
|
29
|
-
}
|
|
30
|
-
getRawColumns() {
|
|
31
|
-
return reduce(this.dataSources, (result, item, type) => {
|
|
32
|
-
result[type] = item.store.get('source');
|
|
33
|
-
return result;
|
|
34
|
-
}, {
|
|
35
|
-
rgCol: [],
|
|
36
|
-
colPinStart: [],
|
|
37
|
-
colPinEnd: []
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
getColumns(type = 'all') {
|
|
41
|
-
if (type !== 'all') {
|
|
42
|
-
return this.dataSources[type].store.get('source');
|
|
43
|
-
}
|
|
44
|
-
return columnTypes.reduce((r, t) => {
|
|
45
|
-
r.push(...this.dataSources[t].store.get('source'));
|
|
46
|
-
return r;
|
|
47
|
-
}, []);
|
|
48
|
-
}
|
|
49
|
-
getColumnIndexByProp(prop, type) {
|
|
50
|
-
return getSourceItemVirtualIndexByProp(this.dataSources[type].store, prop);
|
|
51
|
-
}
|
|
52
|
-
getColumnByProp(prop, type) {
|
|
53
|
-
const items = this.dataSources[type].store.get('source');
|
|
54
|
-
return find(items, { prop });
|
|
55
|
-
}
|
|
56
|
-
refreshByType(type) {
|
|
57
|
-
this.dataSources[type].refresh();
|
|
58
|
-
}
|
|
59
|
-
setColumns(data) {
|
|
60
|
-
each(columnTypes, k => {
|
|
61
|
-
// set columns data
|
|
62
|
-
this.dataSources[k].updateData(data.columns[k], {
|
|
63
|
-
// max depth level
|
|
64
|
-
depth: data.maxLevel,
|
|
65
|
-
// groups
|
|
66
|
-
groups: reduce(data.columnGrouping[k], (res, g) => {
|
|
67
|
-
if (!res[g.level]) {
|
|
68
|
-
res[g.level] = [];
|
|
69
|
-
}
|
|
70
|
-
res[g.level].push(g);
|
|
71
|
-
return res;
|
|
72
|
-
}, {}),
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
this.sorting = data.sort;
|
|
76
|
-
return data;
|
|
77
|
-
}
|
|
78
|
-
updateColumns(cols) {
|
|
79
|
-
// collect column by type and propert
|
|
80
|
-
const columnByKey = cols.reduce((res, c) => {
|
|
81
|
-
const type = ColumnDataProvider.getColumnType(c);
|
|
82
|
-
if (!res[type]) {
|
|
83
|
-
res[type] = {};
|
|
84
|
-
}
|
|
85
|
-
res[type][c.prop] = c;
|
|
86
|
-
return res;
|
|
87
|
-
}, {});
|
|
88
|
-
// find indexes in source
|
|
89
|
-
const colByIndex = {};
|
|
90
|
-
each(columnByKey, (colsToUpdate, type) => {
|
|
91
|
-
const items = this.dataSources[type].store.get('source');
|
|
92
|
-
colByIndex[type] = items.reduce((result, rgCol, index) => {
|
|
93
|
-
const colToUpdateIfExists = colsToUpdate[rgCol.prop];
|
|
94
|
-
if (colToUpdateIfExists) {
|
|
95
|
-
result[index] = colToUpdateIfExists;
|
|
96
|
-
}
|
|
97
|
-
return result;
|
|
98
|
-
}, {});
|
|
99
|
-
});
|
|
100
|
-
each(colByIndex, (colsToUpdate, type) => setSourceByVirtualIndex(this.dataSources[type].store, colsToUpdate));
|
|
101
|
-
}
|
|
102
|
-
updateColumn(column, index) {
|
|
103
|
-
const type = ColumnDataProvider.getColumnType(column);
|
|
104
|
-
setSourceByVirtualIndex(this.dataSources[type].store, { [index]: column });
|
|
105
|
-
}
|
|
106
|
-
updateColumnSorting(column, index, sorting, additive) {
|
|
107
|
-
if (!additive) {
|
|
108
|
-
this.clearSorting();
|
|
109
|
-
}
|
|
110
|
-
column.order = sorting;
|
|
111
|
-
this.sorting[column.prop] = column;
|
|
112
|
-
this.updateColumn(column, index);
|
|
113
|
-
return column;
|
|
114
|
-
}
|
|
115
|
-
clearSorting() {
|
|
116
|
-
const types = reduce(this.sorting, (r, c) => {
|
|
117
|
-
const k = ColumnDataProvider.getColumnType(c);
|
|
118
|
-
r[k] = true;
|
|
119
|
-
return r;
|
|
120
|
-
}, {});
|
|
121
|
-
each(types, (_, type) => {
|
|
122
|
-
const cols = this.dataSources[type].store.get('source');
|
|
123
|
-
each(cols, (c) => (c.order = undefined));
|
|
124
|
-
this.dataSources[type].setData({ source: [...cols] });
|
|
125
|
-
});
|
|
126
|
-
this.sorting = {};
|
|
127
|
-
}
|
|
128
|
-
static getSizes(cols) {
|
|
129
|
-
return reduce(cols, (res, c, i) => {
|
|
130
|
-
if (c.size) {
|
|
131
|
-
res[i] = c.size;
|
|
132
|
-
}
|
|
133
|
-
return res;
|
|
134
|
-
}, {});
|
|
135
|
-
}
|
|
136
|
-
static getColumnByProp(columns, prop) {
|
|
137
|
-
return find(columns, c => {
|
|
138
|
-
if (GroupingColumnPlugin.isColGrouping(c)) {
|
|
139
|
-
return ColumnDataProvider.getColumnByProp(c.children, prop);
|
|
140
|
-
}
|
|
141
|
-
return c.prop === prop;
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
// columns processing
|
|
145
|
-
static getColumns(columns, level = 0, types) {
|
|
146
|
-
return reduce(columns, (res, colData) => {
|
|
147
|
-
/** Grouped column */
|
|
148
|
-
if (GroupingColumnPlugin.isColGrouping(colData)) {
|
|
149
|
-
return GroupingColumnPlugin.gatherGroup(res, colData, ColumnDataProvider.getColumns(colData.children, level + 1, types), level);
|
|
150
|
-
}
|
|
151
|
-
/** Regular column */
|
|
152
|
-
const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
|
|
153
|
-
// not pin
|
|
154
|
-
if (!regularColumn.pin) {
|
|
155
|
-
res.columns.rgCol.push(regularColumn);
|
|
156
|
-
// pin
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
res.columns[regularColumn.pin].push(regularColumn);
|
|
160
|
-
}
|
|
161
|
-
if (regularColumn.order) {
|
|
162
|
-
res.sort[regularColumn.prop] = regularColumn;
|
|
163
|
-
}
|
|
164
|
-
// trigger setup hook if present
|
|
165
|
-
regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
|
|
166
|
-
return res;
|
|
167
|
-
}, {
|
|
168
|
-
columns: {
|
|
169
|
-
rgCol: [],
|
|
170
|
-
colPinStart: [],
|
|
171
|
-
colPinEnd: [],
|
|
172
|
-
},
|
|
173
|
-
columnGrouping: {
|
|
174
|
-
rgCol: [],
|
|
175
|
-
colPinStart: [],
|
|
176
|
-
colPinEnd: [],
|
|
177
|
-
},
|
|
178
|
-
maxLevel: level,
|
|
179
|
-
sort: {},
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
static getColumnType(rgCol) {
|
|
183
|
-
if (rgCol.pin) {
|
|
184
|
-
return rgCol.pin;
|
|
185
|
-
}
|
|
186
|
-
return 'rgCol';
|
|
187
|
-
}
|
|
188
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import reduce from 'lodash/reduce';
|
|
2
|
-
import DataStore, { getSourceItem, getVisibleSourceItem, setSourceByVirtualIndex } from '../store/dataSource/data.store';
|
|
3
|
-
import { isRowType, rowTypes } from '../store/storeTypes';
|
|
4
|
-
export class DataProvider {
|
|
5
|
-
constructor(dimensionProvider) {
|
|
6
|
-
this.dimensionProvider = dimensionProvider;
|
|
7
|
-
this.stores = reduce(rowTypes, (sources, k) => {
|
|
8
|
-
sources[k] = new DataStore(k);
|
|
9
|
-
return sources;
|
|
10
|
-
}, {});
|
|
11
|
-
}
|
|
12
|
-
setData(data, type = 'rgRow', grouping, silent = false) {
|
|
13
|
-
// set rgRow data
|
|
14
|
-
this.stores[type].updateData([...data], grouping, silent);
|
|
15
|
-
this.dimensionProvider.setData(data, type, type !== 'rgRow');
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
getModel(virtualIndex, type = 'rgRow') {
|
|
19
|
-
const store = this.stores[type].store;
|
|
20
|
-
return getSourceItem(store, virtualIndex);
|
|
21
|
-
}
|
|
22
|
-
setCellData({ type, rowIndex, prop, val }) {
|
|
23
|
-
const model = this.getModel(rowIndex, type);
|
|
24
|
-
model[prop] = val;
|
|
25
|
-
setSourceByVirtualIndex(this.stores[type].store, { [rowIndex]: model });
|
|
26
|
-
}
|
|
27
|
-
refresh(type = 'all') {
|
|
28
|
-
if (isRowType(type)) {
|
|
29
|
-
this.refreshItems(type);
|
|
30
|
-
}
|
|
31
|
-
rowTypes.forEach((t) => this.refreshItems(t));
|
|
32
|
-
}
|
|
33
|
-
refreshItems(type = 'rgRow') {
|
|
34
|
-
const items = this.stores[type].store.get('items');
|
|
35
|
-
this.stores[type].setData({ items: [...items] });
|
|
36
|
-
}
|
|
37
|
-
setGrouping({ depth }, type = 'rgRow') {
|
|
38
|
-
this.stores[type].setData({ groupingDepth: depth });
|
|
39
|
-
}
|
|
40
|
-
setTrimmed(trimmed, type = 'rgRow') {
|
|
41
|
-
const store = this.stores[type];
|
|
42
|
-
store.addTrimmed(trimmed);
|
|
43
|
-
if (type === 'rgRow') {
|
|
44
|
-
this.dimensionProvider.setData(getVisibleSourceItem(store.store), type);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import reduce from 'lodash/reduce';
|
|
2
|
-
import { columnTypes, rowTypes } from '../store/storeTypes';
|
|
3
|
-
import DimensionStore from '../store/dimension/dimension.store';
|
|
4
|
-
import { getItemByIndex } from '../store/dimension/dimension.helpers';
|
|
5
|
-
export default class DimensionProvider {
|
|
6
|
-
constructor(viewports) {
|
|
7
|
-
this.viewports = viewports;
|
|
8
|
-
this.stores = reduce([...rowTypes, ...columnTypes], (sources, k) => {
|
|
9
|
-
sources[k] = new DimensionStore();
|
|
10
|
-
return sources;
|
|
11
|
-
}, {});
|
|
12
|
-
}
|
|
13
|
-
setDimensionSize(dimensionType, sizes) {
|
|
14
|
-
this.stores[dimensionType].setDimensionSize(sizes);
|
|
15
|
-
this.viewports.stores[dimensionType].setViewPortDimension(sizes);
|
|
16
|
-
}
|
|
17
|
-
setRealSize(realCount, type) {
|
|
18
|
-
this.viewports.stores[type].setViewport({ realCount });
|
|
19
|
-
this.stores[type].setRealSize(realCount);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Sets dimension data and view port coordinate
|
|
23
|
-
* @param items - data/column items
|
|
24
|
-
* @param type - dimension type
|
|
25
|
-
*/
|
|
26
|
-
setData(items, type, noVirtual = false) {
|
|
27
|
-
this.setRealSize(items.length, type);
|
|
28
|
-
if (noVirtual) {
|
|
29
|
-
this.setNoVirtual(type);
|
|
30
|
-
}
|
|
31
|
-
this.setViewPortCoordinate({
|
|
32
|
-
coordinate: this.viewports.stores[type].store.get('lastCoordinate'),
|
|
33
|
-
type,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
setNoVirtual(type) {
|
|
37
|
-
const dimension = this.stores[type].getCurrentState();
|
|
38
|
-
this.viewports.stores[type].setViewport({ virtualSize: dimension.realSize });
|
|
39
|
-
}
|
|
40
|
-
drop() {
|
|
41
|
-
for (let type of columnTypes) {
|
|
42
|
-
this.stores[type].drop();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
setColumns(type, sizes, noVirtual = false) {
|
|
46
|
-
this.stores[type].setDimensionSize(sizes);
|
|
47
|
-
if (noVirtual) {
|
|
48
|
-
this.setNoVirtual(type);
|
|
49
|
-
}
|
|
50
|
-
this.setViewPortCoordinate({
|
|
51
|
-
coordinate: this.viewports.stores[type].store.get('lastCoordinate'),
|
|
52
|
-
type,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
setViewPortCoordinate({ coordinate, type }) {
|
|
56
|
-
const dimension = this.stores[type].getCurrentState();
|
|
57
|
-
this.viewports.stores[type].setViewPortCoordinate(coordinate, dimension);
|
|
58
|
-
}
|
|
59
|
-
getViewPortPos(e) {
|
|
60
|
-
const dimension = this.stores[e.dimension].getCurrentState();
|
|
61
|
-
const item = getItemByIndex(dimension, e.coordinate);
|
|
62
|
-
return item.start;
|
|
63
|
-
}
|
|
64
|
-
setSettings(data, dimensionType) {
|
|
65
|
-
let stores = [];
|
|
66
|
-
switch (dimensionType) {
|
|
67
|
-
case 'rgCol':
|
|
68
|
-
stores = columnTypes;
|
|
69
|
-
break;
|
|
70
|
-
case 'rgRow':
|
|
71
|
-
stores = rowTypes;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
for (let s of stores) {
|
|
75
|
-
this.stores[s].setStore(data);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
2
|
-
var ResizeEvents;
|
|
3
|
-
(function (ResizeEvents) {
|
|
4
|
-
ResizeEvents["start"] = "resize:start";
|
|
5
|
-
ResizeEvents["move"] = "resize:move";
|
|
6
|
-
ResizeEvents["end"] = "resize:end";
|
|
7
|
-
})(ResizeEvents || (ResizeEvents = {}));
|
|
8
|
-
const RESIZE_MASK = {
|
|
9
|
-
'resizable-r': { bit: 0b0001, cursor: 'ew-resize' },
|
|
10
|
-
'resizable-rb': { bit: 0b0011, cursor: 'se-resize' },
|
|
11
|
-
'resizable-b': { bit: 0b0010, cursor: 's-resize' },
|
|
12
|
-
'resizable-lb': { bit: 0b0110, cursor: 'sw-resize' },
|
|
13
|
-
'resizable-l': { bit: 0b0100, cursor: 'w-resize' },
|
|
14
|
-
'resizable-lt': { bit: 0b1100, cursor: 'nw-resize' },
|
|
15
|
-
'resizable-t': { bit: 0b1000, cursor: 'n-resize' },
|
|
16
|
-
'resizable-rt': { bit: 0b1001, cursor: 'ne-resize' },
|
|
17
|
-
};
|
|
18
|
-
const DISABLE_MASK = {
|
|
19
|
-
l: 0b0001,
|
|
20
|
-
t: 0b0010,
|
|
21
|
-
w: 0b0100,
|
|
22
|
-
h: 0b1000,
|
|
23
|
-
};
|
|
24
|
-
const defaultProps = (props) => {
|
|
25
|
-
return Object.assign(Object.assign({}, props), { fitParent: props.fitParent || false, active: props.active || [], disableAttributes: props.disableAttributes || [], minWidth: props.minWidth || 0, minHeight: props.minHeight || 0 });
|
|
26
|
-
};
|
|
27
|
-
export class ResizeDirective {
|
|
28
|
-
constructor(initialProps, $event) {
|
|
29
|
-
this.initialProps = initialProps;
|
|
30
|
-
this.$event = $event;
|
|
31
|
-
this.mouseX = 0;
|
|
32
|
-
this.mouseY = 0;
|
|
33
|
-
this.width = 0;
|
|
34
|
-
this.height = 0;
|
|
35
|
-
this.changeX = 0;
|
|
36
|
-
this.changeY = 0;
|
|
37
|
-
this.disableCalcMap = 0b1111;
|
|
38
|
-
this.props = defaultProps(initialProps);
|
|
39
|
-
this.mouseMoveFunc = this.handleMove.bind(this);
|
|
40
|
-
this.mouseUpFunc = this.handleUp.bind(this);
|
|
41
|
-
this.minW = this.props.minWidth;
|
|
42
|
-
this.minH = this.props.minHeight;
|
|
43
|
-
this.maxW = this.props.maxWidth;
|
|
44
|
-
this.maxH = this.props.maxHeight;
|
|
45
|
-
this.parent = { width: 0, height: 0 };
|
|
46
|
-
this.resizeState = 0;
|
|
47
|
-
}
|
|
48
|
-
set($el) {
|
|
49
|
-
this.$el = $el;
|
|
50
|
-
this.props.disableAttributes.forEach(attr => {
|
|
51
|
-
switch (attr) {
|
|
52
|
-
case 'l':
|
|
53
|
-
this.disableCalcMap &= ~DISABLE_MASK.l;
|
|
54
|
-
break;
|
|
55
|
-
case 't':
|
|
56
|
-
this.disableCalcMap &= ~DISABLE_MASK.t;
|
|
57
|
-
break;
|
|
58
|
-
case 'w':
|
|
59
|
-
this.disableCalcMap &= ~DISABLE_MASK.w;
|
|
60
|
-
break;
|
|
61
|
-
case 'h':
|
|
62
|
-
this.disableCalcMap &= ~DISABLE_MASK.h;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
emitEvent(eventName, additionalOptions) {
|
|
67
|
-
if (!this.$event) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
this.$event(Object.assign({ eventName, width: this.width + this.changeX, height: this.height + this.changeY, changedX: this.changeX, changedY: this.changeY }, additionalOptions));
|
|
71
|
-
}
|
|
72
|
-
static isTouchEvent(e) {
|
|
73
|
-
var _a;
|
|
74
|
-
const event = e;
|
|
75
|
-
return ((_a = event.touches) === null || _a === void 0 ? void 0 : _a.length) >= 0;
|
|
76
|
-
}
|
|
77
|
-
handleMove(event) {
|
|
78
|
-
if (!this.resizeState) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
let eventY, eventX;
|
|
82
|
-
if (ResizeDirective.isTouchEvent(event)) {
|
|
83
|
-
eventY = event.touches[0].clientY;
|
|
84
|
-
eventX = event.touches[0].clientX;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
eventY = event.clientY;
|
|
88
|
-
eventX = event.clientX;
|
|
89
|
-
}
|
|
90
|
-
let isX = this.resizeState & RESIZE_MASK['resizable-r'].bit || this.resizeState & RESIZE_MASK['resizable-l'].bit;
|
|
91
|
-
let isY = this.resizeState & RESIZE_MASK['resizable-t'].bit || this.resizeState & RESIZE_MASK['resizable-b'].bit;
|
|
92
|
-
if (isY && this.disableCalcMap & DISABLE_MASK.h) {
|
|
93
|
-
let diffY = eventY - this.mouseY;
|
|
94
|
-
let changedY = this.changeY + diffY;
|
|
95
|
-
const newHeight = this.height + changedY;
|
|
96
|
-
// if overcrossed min height
|
|
97
|
-
if (newHeight < this.minH) {
|
|
98
|
-
changedY = -(this.height - this.minH);
|
|
99
|
-
}
|
|
100
|
-
// if overcrossed max heiht
|
|
101
|
-
if (this.maxH && newHeight > this.maxH) {
|
|
102
|
-
changedY = this.maxH - this.height;
|
|
103
|
-
}
|
|
104
|
-
this.changeY = changedY;
|
|
105
|
-
this.mouseY = eventY;
|
|
106
|
-
if (this.activeResizer) {
|
|
107
|
-
this.activeResizer.style.bottom = `${-this.changeY}px`;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (isX && this.disableCalcMap & DISABLE_MASK.w) {
|
|
111
|
-
let diffX = eventX - this.mouseX;
|
|
112
|
-
let changedX = this.changeX + diffX;
|
|
113
|
-
const newWidth = this.width + changedX;
|
|
114
|
-
// if overcrossed min width
|
|
115
|
-
if (newWidth < this.minW) {
|
|
116
|
-
changedX = -(this.width - this.minW);
|
|
117
|
-
}
|
|
118
|
-
// if overcrossed max width
|
|
119
|
-
if (this.maxW && newWidth > this.maxW) {
|
|
120
|
-
changedX = this.maxW - this.width;
|
|
121
|
-
}
|
|
122
|
-
this.changeX = changedX;
|
|
123
|
-
this.mouseX = eventX;
|
|
124
|
-
if (this.activeResizer) {
|
|
125
|
-
this.activeResizer.style.right = `${-this.changeX}px`;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
this.emitEvent(ResizeEvents.move);
|
|
129
|
-
}
|
|
130
|
-
handleDown(event) {
|
|
131
|
-
if (event.defaultPrevented) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
this.dropInitial();
|
|
135
|
-
for (let elClass in RESIZE_MASK) {
|
|
136
|
-
const target = event.target;
|
|
137
|
-
if (this.$el.contains(target) && (target === null || target === void 0 ? void 0 : target.classList.contains(elClass))) {
|
|
138
|
-
document.body.style.cursor = RESIZE_MASK[elClass].cursor;
|
|
139
|
-
if (ResizeDirective.isTouchEvent(event)) {
|
|
140
|
-
this.setInitials(event.touches[0], target);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
event.preventDefault && event.preventDefault();
|
|
144
|
-
this.setInitials(event, target);
|
|
145
|
-
}
|
|
146
|
-
this.resizeState = RESIZE_MASK[elClass].bit;
|
|
147
|
-
const eventName = ResizeEvents.start;
|
|
148
|
-
this.emitEvent(eventName);
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
this.bindMove();
|
|
153
|
-
}
|
|
154
|
-
handleUp(e) {
|
|
155
|
-
e.preventDefault();
|
|
156
|
-
if (this.resizeState !== 0) {
|
|
157
|
-
this.resizeState = 0;
|
|
158
|
-
document.body.style.cursor = '';
|
|
159
|
-
const eventName = ResizeEvents.end;
|
|
160
|
-
this.emitEvent(eventName);
|
|
161
|
-
}
|
|
162
|
-
this.dropInitial();
|
|
163
|
-
this.unbindMove();
|
|
164
|
-
}
|
|
165
|
-
setInitials({ clientX, clientY }, target) {
|
|
166
|
-
const computedStyle = getComputedStyle(this.$el);
|
|
167
|
-
this.$el.classList.add('active');
|
|
168
|
-
this.activeResizer = target;
|
|
169
|
-
if (this.disableCalcMap & DISABLE_MASK.w) {
|
|
170
|
-
this.mouseX = clientX;
|
|
171
|
-
this.width = this.$el.clientWidth;
|
|
172
|
-
this.parent.width = this.$el.parentElement.clientWidth;
|
|
173
|
-
// min width
|
|
174
|
-
const minPaddingX = parseFloat(computedStyle.paddingLeft) + parseFloat(computedStyle.paddingRight);
|
|
175
|
-
this.minW = Math.max(minPaddingX, this.initialProps.minWidth || 0);
|
|
176
|
-
// max width
|
|
177
|
-
if (this.initialProps.maxWidth) {
|
|
178
|
-
this.maxW = Math.max(this.width, this.initialProps.maxWidth);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (this.disableCalcMap & DISABLE_MASK.h) {
|
|
182
|
-
this.mouseY = clientY;
|
|
183
|
-
this.height = this.$el.clientHeight;
|
|
184
|
-
this.parent.height = this.$el.parentElement.clientHeight;
|
|
185
|
-
// min height
|
|
186
|
-
const minPaddingY = parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
|
|
187
|
-
this.minH = Math.max(minPaddingY, this.initialProps.minHeight || 0);
|
|
188
|
-
// max height
|
|
189
|
-
if (this.initialProps.maxHeight) {
|
|
190
|
-
this.maxH = Math.max(this.height, this.initialProps.maxHeight);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
dropInitial() {
|
|
195
|
-
this.changeX = this.changeY = this.minW = this.minH;
|
|
196
|
-
this.width = this.height = 0;
|
|
197
|
-
if (this.activeResizer) {
|
|
198
|
-
this.activeResizer.removeAttribute('style');
|
|
199
|
-
}
|
|
200
|
-
this.$el.classList.remove('active');
|
|
201
|
-
this.activeResizer = null;
|
|
202
|
-
}
|
|
203
|
-
bindMove() {
|
|
204
|
-
document.documentElement.addEventListener('mouseup', this.mouseUpFunc, true);
|
|
205
|
-
document.documentElement.addEventListener('touchend', this.mouseUpFunc, true);
|
|
206
|
-
document.documentElement.addEventListener('mousemove', this.mouseMoveFunc, true);
|
|
207
|
-
document.documentElement.addEventListener('touchmove', this.mouseMoveFunc, true);
|
|
208
|
-
document.documentElement.addEventListener('mouseleave', this.mouseUpFunc);
|
|
209
|
-
}
|
|
210
|
-
unbindMove() {
|
|
211
|
-
document.documentElement.removeEventListener('mouseup', this.mouseUpFunc, true);
|
|
212
|
-
document.documentElement.removeEventListener('touchend', this.mouseUpFunc, true);
|
|
213
|
-
document.documentElement.removeEventListener('mousemove', this.mouseMoveFunc, true);
|
|
214
|
-
document.documentElement.removeEventListener('touchmove', this.mouseMoveFunc, true);
|
|
215
|
-
document.documentElement.removeEventListener('mouseleave', this.mouseUpFunc);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
export const ResizableElement = (props, children) => {
|
|
219
|
-
const resizeEls = [];
|
|
220
|
-
const directive = (props.canResize &&
|
|
221
|
-
new ResizeDirective(props, e => {
|
|
222
|
-
if (e.eventName === ResizeEvents.end) {
|
|
223
|
-
props.onResize && props.onResize(e);
|
|
224
|
-
}
|
|
225
|
-
})) ||
|
|
226
|
-
null;
|
|
227
|
-
if (props.canResize) {
|
|
228
|
-
if (props.active) {
|
|
229
|
-
for (let p in props.active) {
|
|
230
|
-
resizeEls.push(h("div", { onClick: e => e.preventDefault(), onDblClick: e => {
|
|
231
|
-
e.preventDefault();
|
|
232
|
-
props.onDoubleClick && props.onDoubleClick();
|
|
233
|
-
}, 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]}` }));
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
if (props.active) {
|
|
239
|
-
for (let p in props.active) {
|
|
240
|
-
resizeEls.push(h("div", { onClick: e => e.preventDefault(), onDblClick: e => {
|
|
241
|
-
e.preventDefault();
|
|
242
|
-
props.onDoubleClick && props.onDoubleClick();
|
|
243
|
-
}, class: `no-resize resizable resizable-${props.active[p]}` }));
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return (h("div", Object.assign({}, props, { ref: (e) => directive === null || directive === void 0 ? void 0 : directive.set(e) }),
|
|
248
|
-
children,
|
|
249
|
-
resizeEls));
|
|
250
|
-
};
|