@revolist/revogrid 3.2.4 → 3.2.5
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 +29213 -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} +208 -1444
- 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 +28297 -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 +2227 -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 +148 -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 +253 -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 +1796 -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} +25347 -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 +5 -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/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
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { Component, Prop, h, Host } from '@stencil/core';
|
|
5
|
+
import { throttle } from 'lodash';
|
|
6
|
+
import { TMP_SELECTION_BG_CLASS } from '../../utils/consts';
|
|
7
|
+
import { getElStyle } from '../overlay/selection.utils';
|
|
8
|
+
export class RevogrFocus {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.onChange = throttle((e) => this.doChange(e), 300);
|
|
11
|
+
}
|
|
12
|
+
doChange(e) {
|
|
13
|
+
e === null || e === void 0 ? void 0 : e.scrollIntoView({
|
|
14
|
+
block: 'nearest',
|
|
15
|
+
inline: 'nearest',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
componentDidRender() {
|
|
19
|
+
if (this.el) {
|
|
20
|
+
this.onChange(this.el);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
const data = this.selectionStore.get('tempRange');
|
|
25
|
+
const type = this.selectionStore.get('tempRangeType');
|
|
26
|
+
if (!data) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let directionY = 'bottom';
|
|
30
|
+
let derectionX = 'right';
|
|
31
|
+
const range = this.getRange();
|
|
32
|
+
if (!range) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (data.y < range.y) {
|
|
36
|
+
directionY = 'top';
|
|
37
|
+
}
|
|
38
|
+
if (data.x < range.x) {
|
|
39
|
+
derectionX = 'left';
|
|
40
|
+
}
|
|
41
|
+
const directionClass = `${derectionX} ${directionY}`;
|
|
42
|
+
const style = getElStyle(data, this.dimensionRow.state, this.dimensionCol.state);
|
|
43
|
+
return (h(Host, { class: {
|
|
44
|
+
[TMP_SELECTION_BG_CLASS]: true,
|
|
45
|
+
[type || '']: true,
|
|
46
|
+
}, style: style },
|
|
47
|
+
h("div", { class: directionClass, ref: (e) => (this.el = e) })));
|
|
48
|
+
}
|
|
49
|
+
getRange() {
|
|
50
|
+
const range = this.selectionStore.get('range');
|
|
51
|
+
if (range) {
|
|
52
|
+
return range;
|
|
53
|
+
}
|
|
54
|
+
const focus = this.selectionStore.get('focus');
|
|
55
|
+
if (!focus) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return Object.assign(Object.assign({}, focus), { x1: focus.x, y1: focus.y });
|
|
59
|
+
}
|
|
60
|
+
static get is() { return "revogr-temp-range"; }
|
|
61
|
+
static get originalStyleUrls() { return {
|
|
62
|
+
"$": ["revogr-temp-range-style.scss"]
|
|
63
|
+
}; }
|
|
64
|
+
static get styleUrls() { return {
|
|
65
|
+
"$": ["revogr-temp-range-style.css"]
|
|
66
|
+
}; }
|
|
67
|
+
static get properties() { return {
|
|
68
|
+
"selectionStore": {
|
|
69
|
+
"type": "unknown",
|
|
70
|
+
"mutable": false,
|
|
71
|
+
"complexType": {
|
|
72
|
+
"original": "Observable<Selection.SelectionStoreState>",
|
|
73
|
+
"resolved": "ObservableMap<SelectionStoreState>",
|
|
74
|
+
"references": {
|
|
75
|
+
"Observable": {
|
|
76
|
+
"location": "import",
|
|
77
|
+
"path": "../../interfaces"
|
|
78
|
+
},
|
|
79
|
+
"Selection": {
|
|
80
|
+
"location": "import",
|
|
81
|
+
"path": "../../interfaces"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"required": false,
|
|
86
|
+
"optional": false,
|
|
87
|
+
"docs": {
|
|
88
|
+
"tags": [],
|
|
89
|
+
"text": "Dynamic stores"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"dimensionRow": {
|
|
93
|
+
"type": "unknown",
|
|
94
|
+
"mutable": false,
|
|
95
|
+
"complexType": {
|
|
96
|
+
"original": "Observable<RevoGrid.DimensionSettingsState>",
|
|
97
|
+
"resolved": "ObservableMap<DimensionSettingsState>",
|
|
98
|
+
"references": {
|
|
99
|
+
"Observable": {
|
|
100
|
+
"location": "import",
|
|
101
|
+
"path": "../../interfaces"
|
|
102
|
+
},
|
|
103
|
+
"RevoGrid": {
|
|
104
|
+
"location": "import",
|
|
105
|
+
"path": "../../interfaces"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": ""
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"dimensionCol": {
|
|
117
|
+
"type": "unknown",
|
|
118
|
+
"mutable": false,
|
|
119
|
+
"complexType": {
|
|
120
|
+
"original": "Observable<RevoGrid.DimensionSettingsState>",
|
|
121
|
+
"resolved": "ObservableMap<DimensionSettingsState>",
|
|
122
|
+
"references": {
|
|
123
|
+
"Observable": {
|
|
124
|
+
"location": "import",
|
|
125
|
+
"path": "../../interfaces"
|
|
126
|
+
},
|
|
127
|
+
"RevoGrid": {
|
|
128
|
+
"location": "import",
|
|
129
|
+
"path": "../../interfaces"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": false,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": ""
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}; }
|
|
141
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
4
|
+
import { setMode } from '@stencil/core';
|
|
5
|
+
import ThemeService from '../themeManager/themeService';
|
|
7
6
|
setMode(elm => {
|
|
8
7
|
let theme = elm.theme || elm.getAttribute('theme');
|
|
9
8
|
if (typeof theme === 'string') {
|
|
@@ -15,8 +14,3 @@ setMode(elm => {
|
|
|
15
14
|
}
|
|
16
15
|
return parsedTheme;
|
|
17
16
|
});
|
|
18
|
-
const globalFn = () => { };
|
|
19
|
-
|
|
20
|
-
const globalScripts = globalFn;
|
|
21
|
-
|
|
22
|
-
export { globalScripts as g };
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Plugin module for revo-grid grid system
|
|
6
|
+
* Add support for automatic column resize
|
|
7
|
+
*/
|
|
8
|
+
import each from 'lodash/each';
|
|
9
|
+
import reduce from 'lodash/reduce';
|
|
10
|
+
import BasePlugin from './basePlugin';
|
|
11
|
+
import ColumnDataProvider from '../services/column.data.provider';
|
|
12
|
+
import { columnTypes } from '../store/storeTypes';
|
|
13
|
+
import { getSourceItem } from '../store/dataSource/data.store';
|
|
14
|
+
const LETTER_BLOCK_SIZE = 7;
|
|
15
|
+
var ColumnAutoSizeMode;
|
|
16
|
+
(function (ColumnAutoSizeMode) {
|
|
17
|
+
// increases column width on header click according the largest text value
|
|
18
|
+
ColumnAutoSizeMode["headerClickAutosize"] = "headerClickAutoSize";
|
|
19
|
+
// increases column width on data set and text edit, decreases performance
|
|
20
|
+
ColumnAutoSizeMode["autoSizeOnTextOverlap"] = "autoSizeOnTextOverlap";
|
|
21
|
+
// increases and decreases column width based on all items sizes, worst for performance
|
|
22
|
+
ColumnAutoSizeMode["autoSizeAll"] = "autoSizeAll";
|
|
23
|
+
})(ColumnAutoSizeMode || (ColumnAutoSizeMode = {}));
|
|
24
|
+
export default class AutoSizeColumn extends BasePlugin {
|
|
25
|
+
constructor(revogrid, providers, config) {
|
|
26
|
+
super(revogrid);
|
|
27
|
+
this.providers = providers;
|
|
28
|
+
this.config = config;
|
|
29
|
+
this.autoSizeColumns = null;
|
|
30
|
+
/** for edge case when no columns defined before data */
|
|
31
|
+
this.dataResolve = null;
|
|
32
|
+
this.dataReject = null;
|
|
33
|
+
this.letterBlockSize = (config === null || config === void 0 ? void 0 : config.letterBlockSize) || LETTER_BLOCK_SIZE;
|
|
34
|
+
// create test container to check text width
|
|
35
|
+
if (config === null || config === void 0 ? void 0 : config.preciseSize) {
|
|
36
|
+
this.precsizeCalculationArea = this.initiatePresizeElement();
|
|
37
|
+
revogrid.appendChild(this.precsizeCalculationArea);
|
|
38
|
+
}
|
|
39
|
+
const aftersourceset = ({ detail: { source } }) => {
|
|
40
|
+
this.setSource(source);
|
|
41
|
+
};
|
|
42
|
+
const afteredit = ({ detail }) => {
|
|
43
|
+
this.afteredit(detail);
|
|
44
|
+
};
|
|
45
|
+
const afterEditAll = ({ detail }) => {
|
|
46
|
+
this.afterEditAll(detail);
|
|
47
|
+
};
|
|
48
|
+
const beforecolumnsset = ({ detail: { columns } }) => {
|
|
49
|
+
this.columnSet(columns);
|
|
50
|
+
};
|
|
51
|
+
const headerDblClick = ({ detail }) => {
|
|
52
|
+
const type = ColumnDataProvider.getColumnType(detail);
|
|
53
|
+
const size = this.getColumnSize(detail.index, type);
|
|
54
|
+
if (size) {
|
|
55
|
+
this.providers.dimensionProvider.setDimensionSize(type, {
|
|
56
|
+
[detail.index]: size,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
this.addEventListener('beforecolumnsset', beforecolumnsset);
|
|
61
|
+
switch (config === null || config === void 0 ? void 0 : config.mode) {
|
|
62
|
+
case ColumnAutoSizeMode.autoSizeOnTextOverlap:
|
|
63
|
+
this.addEventListener('aftersourceset', aftersourceset);
|
|
64
|
+
this.addEventListener('afteredit', afteredit);
|
|
65
|
+
break;
|
|
66
|
+
case ColumnAutoSizeMode.autoSizeAll:
|
|
67
|
+
this.addEventListener('aftersourceset', aftersourceset);
|
|
68
|
+
this.addEventListener('afteredit', afterEditAll);
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
this.addEventListener('headerdblClick', headerDblClick);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async setSource(source) {
|
|
76
|
+
let autoSize = this.autoSizeColumns;
|
|
77
|
+
if (this.dataReject) {
|
|
78
|
+
this.dataReject();
|
|
79
|
+
this.clearPromise();
|
|
80
|
+
}
|
|
81
|
+
/** If data set first and no column provided await until get one */
|
|
82
|
+
if (!autoSize) {
|
|
83
|
+
const request = new Promise((resolve, reject) => {
|
|
84
|
+
this.dataResolve = resolve;
|
|
85
|
+
this.dataReject = reject;
|
|
86
|
+
});
|
|
87
|
+
try {
|
|
88
|
+
autoSize = await request;
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// calculate sizes
|
|
95
|
+
each(autoSize, (_v, type) => {
|
|
96
|
+
const sizes = {};
|
|
97
|
+
each(autoSize[type], rgCol => {
|
|
98
|
+
// calculate size
|
|
99
|
+
rgCol.size = sizes[rgCol.index] = source.reduce((prev, rgRow) => Math.max(prev, this.getLength(rgRow[rgCol.prop])), 0);
|
|
100
|
+
});
|
|
101
|
+
this.providers.dimensionProvider.setDimensionSize(type, sizes);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
getLength(len) {
|
|
105
|
+
var _a;
|
|
106
|
+
const padding = 15;
|
|
107
|
+
if (!len) {
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
const str = len.toString();
|
|
112
|
+
/**if exact calculation required proxy with html element, slow operation */
|
|
113
|
+
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.preciseSize) {
|
|
114
|
+
this.precsizeCalculationArea.innerText = str;
|
|
115
|
+
return this.precsizeCalculationArea.scrollWidth + padding * 2;
|
|
116
|
+
}
|
|
117
|
+
return str.length * this.letterBlockSize + padding * 2;
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
afteredit(e) {
|
|
124
|
+
let data;
|
|
125
|
+
if (this.isRangeEdit(e)) {
|
|
126
|
+
data = e.data;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
data = { 0: { [e.prop]: e.val } };
|
|
130
|
+
}
|
|
131
|
+
each(this.autoSizeColumns, (columns, type) => {
|
|
132
|
+
const sizes = {};
|
|
133
|
+
each(columns, rgCol => {
|
|
134
|
+
// calculate size
|
|
135
|
+
const size = reduce(data, (prev, rgRow) => {
|
|
136
|
+
if (typeof rgRow[rgCol.prop] === 'undefined') {
|
|
137
|
+
return prev;
|
|
138
|
+
}
|
|
139
|
+
return Math.max(prev || 0, this.getLength(rgRow[rgCol.prop]));
|
|
140
|
+
}, undefined);
|
|
141
|
+
if (size && rgCol.size < size) {
|
|
142
|
+
rgCol.size = sizes[rgCol.index] = size;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
this.providers.dimensionProvider.setDimensionSize(type, sizes);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
afterEditAll(e) {
|
|
149
|
+
const props = {};
|
|
150
|
+
if (this.isRangeEdit(e)) {
|
|
151
|
+
each(e.data, r => each(r, (_v, p) => (props[p] = true)));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
props[e.prop] = true;
|
|
155
|
+
}
|
|
156
|
+
each(this.autoSizeColumns, (columns, type) => {
|
|
157
|
+
const sizes = {};
|
|
158
|
+
each(columns, rgCol => {
|
|
159
|
+
if (props[rgCol.prop]) {
|
|
160
|
+
const size = this.getColumnSize(rgCol.index, type);
|
|
161
|
+
if (size) {
|
|
162
|
+
sizes[rgCol.index] = size;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
this.providers.dimensionProvider.setDimensionSize(type, sizes);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
getColumnSize(index, type) {
|
|
170
|
+
const rgCol = this.autoSizeColumns[type][index];
|
|
171
|
+
if (!rgCol) {
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
174
|
+
return reduce(this.providers.dataProvider.stores, (r, s) => {
|
|
175
|
+
const perStore = reduce(s.store.get('items'), (prev, _row, i) => {
|
|
176
|
+
const item = getSourceItem(s.store, i);
|
|
177
|
+
return Math.max(prev || 0, this.getLength(item[rgCol.prop]));
|
|
178
|
+
}, 0);
|
|
179
|
+
return Math.max(r, perStore);
|
|
180
|
+
}, rgCol.size || 0);
|
|
181
|
+
}
|
|
182
|
+
columnSet(columns) {
|
|
183
|
+
var _a;
|
|
184
|
+
for (let t of columnTypes) {
|
|
185
|
+
const type = t;
|
|
186
|
+
const cols = columns[type];
|
|
187
|
+
for (let i in cols) {
|
|
188
|
+
if (cols[i].autoSize || ((_a = this.config) === null || _a === void 0 ? void 0 : _a.allColumns)) {
|
|
189
|
+
if (!this.autoSizeColumns) {
|
|
190
|
+
this.autoSizeColumns = {};
|
|
191
|
+
}
|
|
192
|
+
if (!this.autoSizeColumns[type]) {
|
|
193
|
+
this.autoSizeColumns[type] = {};
|
|
194
|
+
}
|
|
195
|
+
this.autoSizeColumns[type][i] = Object.assign(Object.assign({}, cols[i]), { index: parseInt(i, 10) });
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (this.dataResolve) {
|
|
200
|
+
this.dataResolve(this.autoSizeColumns);
|
|
201
|
+
this.clearPromise();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
clearPromise() {
|
|
205
|
+
this.dataResolve = null;
|
|
206
|
+
this.dataReject = null;
|
|
207
|
+
}
|
|
208
|
+
isRangeEdit(e) {
|
|
209
|
+
return !!e.data;
|
|
210
|
+
}
|
|
211
|
+
initiatePresizeElement() {
|
|
212
|
+
const styleForFontTest = {
|
|
213
|
+
position: 'absolute',
|
|
214
|
+
fontSize: '14px',
|
|
215
|
+
height: '0',
|
|
216
|
+
width: '0',
|
|
217
|
+
whiteSpace: 'nowrap',
|
|
218
|
+
top: '0',
|
|
219
|
+
overflowX: 'scroll',
|
|
220
|
+
};
|
|
221
|
+
const el = document.createElement('div');
|
|
222
|
+
for (let s in styleForFontTest) {
|
|
223
|
+
el.style[s] = styleForFontTest[s];
|
|
224
|
+
}
|
|
225
|
+
el.classList.add('revo-test-container');
|
|
226
|
+
return el;
|
|
227
|
+
}
|
|
228
|
+
destroy() {
|
|
229
|
+
var _a;
|
|
230
|
+
super.destroy();
|
|
231
|
+
(_a = this.precsizeCalculationArea) === null || _a === void 0 ? void 0 : _a.remove();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
export default class BasePlugin {
|
|
5
|
+
constructor(revogrid) {
|
|
6
|
+
this.revogrid = revogrid;
|
|
7
|
+
this.subscriptions = {};
|
|
8
|
+
}
|
|
9
|
+
addEventListener(name, func) {
|
|
10
|
+
this.revogrid.addEventListener(name, func);
|
|
11
|
+
this.subscriptions[name] = func;
|
|
12
|
+
}
|
|
13
|
+
removeEventListener(type) {
|
|
14
|
+
this.revogrid.removeEventListener(type, this.subscriptions[type]);
|
|
15
|
+
delete this.subscriptions[type];
|
|
16
|
+
}
|
|
17
|
+
emit(eventName, detail) {
|
|
18
|
+
const event = new CustomEvent(eventName, { detail: detail, cancelable: true });
|
|
19
|
+
this.revogrid.dispatchEvent(event);
|
|
20
|
+
return event;
|
|
21
|
+
}
|
|
22
|
+
clearSubscriptions() {
|
|
23
|
+
for (let type in this.subscriptions) {
|
|
24
|
+
this.removeEventListener(type);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
destroy() {
|
|
28
|
+
this.clearSubscriptions();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Dispatch custom event to element
|
|
6
6
|
*/
|
|
7
|
-
function dispatch(target, eventName, detail) {
|
|
7
|
+
export function dispatch(target, eventName, detail) {
|
|
8
8
|
const event = new CustomEvent(eventName, {
|
|
9
9
|
detail,
|
|
10
10
|
cancelable: true,
|
|
@@ -16,9 +16,7 @@ function dispatch(target, eventName, detail) {
|
|
|
16
16
|
/**
|
|
17
17
|
* Dispatch event by other event target
|
|
18
18
|
*/
|
|
19
|
-
function dispatchOnEvent(e, eventName, detail) {
|
|
19
|
+
export function dispatchOnEvent(e, eventName, detail) {
|
|
20
20
|
e.preventDefault();
|
|
21
21
|
return dispatch(e.target, eventName, detail);
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
export { dispatch as d };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { getGroupingName, isGrouping } from '../groupingRow/grouping.service';
|
|
5
|
+
const INITIAL = {
|
|
6
|
+
mime: 'text/csv',
|
|
7
|
+
fileKind: 'csv',
|
|
8
|
+
// BOM signature
|
|
9
|
+
bom: true,
|
|
10
|
+
columnDelimiter: ',',
|
|
11
|
+
rowDelimiter: '\r\n',
|
|
12
|
+
encoding: '',
|
|
13
|
+
};
|
|
14
|
+
// The ASCII character code 13 is called a Carriage Return or CR.
|
|
15
|
+
const CARRIAGE_RETURN = String.fromCharCode(13);
|
|
16
|
+
// Chr(13) followed by a Chr(10) that compose a proper CRLF.
|
|
17
|
+
const LINE_FEED = String.fromCharCode(10);
|
|
18
|
+
const DOUBLE_QT = String.fromCharCode(34);
|
|
19
|
+
const NO_BREAK_SPACE = String.fromCharCode(0xfeff);
|
|
20
|
+
const escapeRegex = new RegExp('"', 'g');
|
|
21
|
+
export default class ExportCsv {
|
|
22
|
+
constructor(options = {}) {
|
|
23
|
+
this.options = Object.assign(Object.assign({}, INITIAL), options);
|
|
24
|
+
}
|
|
25
|
+
doExport({ data, headers, props }) {
|
|
26
|
+
let result = this.options.bom ? NO_BREAK_SPACE : '';
|
|
27
|
+
// any header
|
|
28
|
+
if ((headers === null || headers === void 0 ? void 0 : headers.length) > 0) {
|
|
29
|
+
headers.forEach(header => {
|
|
30
|
+
// ignore empty
|
|
31
|
+
if (!header.length) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
result += this.prepareHeader(header, this.options.columnDelimiter);
|
|
35
|
+
result += this.options.rowDelimiter;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
data.forEach((rgRow, index) => {
|
|
39
|
+
if (index > 0) {
|
|
40
|
+
result += this.options.rowDelimiter;
|
|
41
|
+
}
|
|
42
|
+
// support grouping
|
|
43
|
+
if (isGrouping(rgRow)) {
|
|
44
|
+
result += this.parseCell(getGroupingName(rgRow), this.options.columnDelimiter);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
result += props.map(p => this.parseCell(rgRow[p], this.options.columnDelimiter)).join(this.options.columnDelimiter);
|
|
48
|
+
});
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
prepareHeader(columnHeaders, columnDelimiter) {
|
|
52
|
+
let result = '';
|
|
53
|
+
const newColumnHeaders = columnHeaders.map(v => this.parseCell(v, columnDelimiter, true));
|
|
54
|
+
result += newColumnHeaders.join(columnDelimiter);
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
parseCell(value, columnDelimiter, force = false) {
|
|
58
|
+
let escape = value;
|
|
59
|
+
if (typeof value !== 'string') {
|
|
60
|
+
escape = JSON.stringify(value);
|
|
61
|
+
}
|
|
62
|
+
const toEscape = [CARRIAGE_RETURN, DOUBLE_QT, LINE_FEED, columnDelimiter];
|
|
63
|
+
if (typeof escape === 'undefined') {
|
|
64
|
+
return '';
|
|
65
|
+
}
|
|
66
|
+
if (escape !== '' && (force || toEscape.some(i => escape.indexOf(i) >= 0))) {
|
|
67
|
+
return `"${escape.replace(escapeRegex, '""')}"`;
|
|
68
|
+
}
|
|
69
|
+
return escape;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import fill from 'lodash/fill';
|
|
5
|
+
import { columnTypes, rowTypes } from '../../store/storeTypes';
|
|
6
|
+
import { timeout } from '../../utils/utils';
|
|
7
|
+
import BasePlugin from '../basePlugin';
|
|
8
|
+
import ExportCsv from './csv';
|
|
9
|
+
var ExportTypes;
|
|
10
|
+
(function (ExportTypes) {
|
|
11
|
+
ExportTypes["csv"] = "csv";
|
|
12
|
+
})(ExportTypes || (ExportTypes = {}));
|
|
13
|
+
export default class ExportFilePlugin extends BasePlugin {
|
|
14
|
+
/** Exports string */
|
|
15
|
+
async exportString(options = {}, t = ExportTypes.csv) {
|
|
16
|
+
const data = await this.beforeexport();
|
|
17
|
+
if (!data) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return this.formatter(t, options).doExport(data);
|
|
21
|
+
}
|
|
22
|
+
/** Exports Blob */
|
|
23
|
+
async exportBlob(options = {}, t = ExportTypes.csv) {
|
|
24
|
+
return await this.getBlob(this.formatter(t, options));
|
|
25
|
+
}
|
|
26
|
+
/** Export file */
|
|
27
|
+
async exportFile(options = {}, t = ExportTypes.csv) {
|
|
28
|
+
const formatter = this.formatter(t, options);
|
|
29
|
+
const blob = await this.getBlob(formatter);
|
|
30
|
+
// url
|
|
31
|
+
const URL = window.URL || window.webkitURL;
|
|
32
|
+
const a = document.createElement('a');
|
|
33
|
+
const { filename, fileKind } = formatter.options;
|
|
34
|
+
const name = `${filename}.${fileKind}`;
|
|
35
|
+
const url = URL.createObjectURL(blob);
|
|
36
|
+
a.style.display = 'none';
|
|
37
|
+
a.setAttribute('href', url);
|
|
38
|
+
a.setAttribute('download', name);
|
|
39
|
+
this.revogrid.appendChild(a);
|
|
40
|
+
a.dispatchEvent(new MouseEvent('click'));
|
|
41
|
+
this.revogrid.removeChild(a);
|
|
42
|
+
// delay for revoke, correct for some browsers
|
|
43
|
+
await timeout(120);
|
|
44
|
+
URL.revokeObjectURL(url);
|
|
45
|
+
}
|
|
46
|
+
/** Blob object */
|
|
47
|
+
async getBlob(formatter) {
|
|
48
|
+
const type = `${formatter.options.mime};charset=${formatter.options.encoding}`;
|
|
49
|
+
if (typeof Blob !== 'undefined') {
|
|
50
|
+
const data = await this.beforeexport();
|
|
51
|
+
if (!data) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return new Blob([formatter.doExport(data)], { type });
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
// before event
|
|
59
|
+
async beforeexport() {
|
|
60
|
+
let data = await this.getData();
|
|
61
|
+
const event = this.emit('beforeexport', { data });
|
|
62
|
+
if (event.defaultPrevented) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return event.detail.data;
|
|
66
|
+
}
|
|
67
|
+
async getData() {
|
|
68
|
+
const data = await this.getSource();
|
|
69
|
+
const colSource = [];
|
|
70
|
+
const colPromises = [];
|
|
71
|
+
columnTypes.forEach((t, i) => {
|
|
72
|
+
colPromises.push(this.getColPerSource(t).then(s => (colSource[i] = s)));
|
|
73
|
+
});
|
|
74
|
+
await Promise.all(colPromises);
|
|
75
|
+
const columns = {
|
|
76
|
+
headers: [],
|
|
77
|
+
props: [],
|
|
78
|
+
};
|
|
79
|
+
for (let source of colSource) {
|
|
80
|
+
source.headers.forEach((h, i) => {
|
|
81
|
+
if (!columns.headers[i]) {
|
|
82
|
+
columns.headers[i] = [];
|
|
83
|
+
}
|
|
84
|
+
columns.headers[i].push(...h);
|
|
85
|
+
});
|
|
86
|
+
columns.props.push(...source.props);
|
|
87
|
+
}
|
|
88
|
+
return Object.assign({ data }, columns);
|
|
89
|
+
}
|
|
90
|
+
async getColPerSource(t) {
|
|
91
|
+
const store = await this.revogrid.getColumnStore(t);
|
|
92
|
+
const source = store.get('source');
|
|
93
|
+
const virtualIndexes = store.get('items');
|
|
94
|
+
const depth = store.get('groupingDepth');
|
|
95
|
+
const groups = store.get('groups');
|
|
96
|
+
const colNames = [];
|
|
97
|
+
const colProps = [];
|
|
98
|
+
const visibleItems = virtualIndexes.reduce((r, v, virtualIndex) => {
|
|
99
|
+
const prop = source[v].prop;
|
|
100
|
+
colNames.push(source[v].name || '');
|
|
101
|
+
colProps.push(prop);
|
|
102
|
+
r[prop] = virtualIndex;
|
|
103
|
+
return r;
|
|
104
|
+
}, {});
|
|
105
|
+
const rows = this.getGroupHeaders(depth, groups, virtualIndexes, visibleItems);
|
|
106
|
+
rows.push(colNames);
|
|
107
|
+
return {
|
|
108
|
+
headers: rows,
|
|
109
|
+
props: colProps,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
getGroupHeaders(depth, groups, items, visibleItems) {
|
|
113
|
+
const rows = [];
|
|
114
|
+
const template = fill(new Array(items.length), '');
|
|
115
|
+
for (let d = 0; d < depth; d++) {
|
|
116
|
+
const rgRow = [...template];
|
|
117
|
+
rows.push(rgRow);
|
|
118
|
+
if (!groups[d]) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const levelGroups = groups[d];
|
|
122
|
+
// add names of groups
|
|
123
|
+
levelGroups.forEach((group) => {
|
|
124
|
+
const minIndex = this.findGroupStartIndex(group.ids, visibleItems);
|
|
125
|
+
if (typeof minIndex === 'number') {
|
|
126
|
+
rgRow[minIndex] = group.name;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return rows;
|
|
131
|
+
}
|
|
132
|
+
findGroupStartIndex(ids, visibleItems) {
|
|
133
|
+
let min;
|
|
134
|
+
ids.forEach(id => {
|
|
135
|
+
const current = visibleItems[id];
|
|
136
|
+
if (typeof current === 'number') {
|
|
137
|
+
if (typeof min !== 'number' || min > current) {
|
|
138
|
+
min = current;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return min;
|
|
143
|
+
}
|
|
144
|
+
async getSource() {
|
|
145
|
+
const data = [];
|
|
146
|
+
const promisesData = [];
|
|
147
|
+
rowTypes.forEach(t => {
|
|
148
|
+
const dataPart = [];
|
|
149
|
+
data.push(dataPart);
|
|
150
|
+
const promise = this.revogrid.getVisibleSource(t).then((d) => dataPart.push(...d));
|
|
151
|
+
promisesData.push(promise);
|
|
152
|
+
});
|
|
153
|
+
await Promise.all(promisesData);
|
|
154
|
+
return data.reduce((r, v) => {
|
|
155
|
+
r.push(...v);
|
|
156
|
+
return r;
|
|
157
|
+
}, []);
|
|
158
|
+
}
|
|
159
|
+
// get correct class for future multiple types support
|
|
160
|
+
formatter(type, options = {}) {
|
|
161
|
+
switch (type) {
|
|
162
|
+
case ExportTypes.csv:
|
|
163
|
+
return new ExportCsv(options);
|
|
164
|
+
default:
|
|
165
|
+
throw new Error('Unknown format');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|