@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.
Files changed (213) hide show
  1. package/custom-element/index.js +29217 -0
  2. package/custom-element/resize-observer.js +503 -0
  3. package/dist/cjs/css-shim-9f5bc84d.js +9 -0
  4. package/dist/cjs/debounce-6cea2774.js +578 -0
  5. package/dist/cjs/dom-fcb646f0.js +78 -0
  6. package/dist/{revo-grid/index-8a604c17.js → cjs/index-cb904e00.js} +230 -1445
  7. package/dist/cjs/index.cjs.js +5 -0
  8. package/dist/cjs/loader.cjs.js +38 -0
  9. package/dist/cjs/resize-observer-bf327d6a.js +507 -0
  10. package/dist/cjs/revo-grid.cjs.js +79 -0
  11. package/dist/cjs/revo-grid_11.cjs.entry.js +28301 -0
  12. package/dist/cjs/revogr-clipboard.cjs.entry.js +56 -0
  13. package/dist/cjs/revogr-filter-panel.cjs.entry.js +278 -0
  14. package/dist/collection/collection-manifest.json +25 -0
  15. package/dist/collection/components/button/button.js +7 -0
  16. package/dist/collection/components/clipboard/revogr-clipboard.js +124 -0
  17. package/dist/collection/components/data/cellRenderer.js +27 -0
  18. package/dist/{revo-grid/columnService-91e552ba.js → collection/components/data/columnService.js} +6 -8
  19. package/dist/collection/components/data/revogr-data-style.css +135 -0
  20. package/dist/collection/components/data/revogr-data.js +325 -0
  21. package/dist/collection/components/data/rowRenderer.js +9 -0
  22. package/dist/collection/components/header/headerCellRenderer.js +29 -0
  23. package/dist/collection/components/header/headerRenderer.js +48 -0
  24. package/dist/collection/components/header/revogr-header-style.css +198 -0
  25. package/dist/collection/components/header/revogr-header.js +300 -0
  26. package/dist/collection/components/order/orderRenderer.js +53 -0
  27. package/dist/collection/components/order/revogr-order-editor.js +361 -0
  28. package/dist/collection/components/order/rowOrderService.js +71 -0
  29. package/dist/collection/components/overlay/autofill.service.js +185 -0
  30. package/dist/collection/components/overlay/clipboard.service.js +42 -0
  31. package/dist/collection/components/overlay/editors/edit.utils.js +8 -0
  32. package/dist/collection/components/overlay/editors/text.js +38 -0
  33. package/dist/collection/components/overlay/keyboard.service.js +131 -0
  34. package/dist/collection/components/overlay/revogr-edit-style.css +86 -0
  35. package/dist/collection/components/overlay/revogr-edit.js +162 -0
  36. package/dist/collection/components/overlay/revogr-overlay-selection.js +729 -0
  37. package/dist/collection/components/overlay/revogr-overlay-style.css +98 -0
  38. package/dist/{revo-grid/selection.utils-a9932db6.js → collection/components/overlay/selection.utils.js} +9 -12
  39. package/dist/collection/components/revo-grid/revo-grid-style.css +544 -0
  40. package/dist/collection/components/revo-grid/revo-grid.js +2226 -0
  41. package/dist/collection/components/revo-grid/viewport.helpers.js +14 -0
  42. package/dist/collection/components/revo-grid/viewport.interfaces.js +4 -0
  43. package/dist/collection/components/revo-grid/viewport.js +21 -0
  44. package/dist/collection/components/revo-grid/viewport.resize.service.js +24 -0
  45. package/dist/collection/components/revo-grid/viewport.scrolling.service.js +63 -0
  46. package/dist/collection/components/revo-grid/viewport.section.js +31 -0
  47. package/dist/collection/components/revo-grid/viewport.service.js +212 -0
  48. package/dist/collection/components/rowHeaders/revogr-row-headers.js +213 -0
  49. package/dist/collection/components/rowHeaders/row-header-render.js +4 -0
  50. package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +137 -0
  51. package/dist/collection/components/scroll/revogr-viewport-scroll.js +402 -0
  52. package/dist/collection/components/scrollable/revogr-scroll-style.css +104 -0
  53. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +256 -0
  54. package/dist/collection/components/selection-focus/revogr-focus-style.css +77 -0
  55. package/dist/collection/components/selection-focus/revogr-focus.js +106 -0
  56. package/dist/collection/components/selection-temp-range/revogr-temp-range-style.css +98 -0
  57. package/dist/collection/components/selection-temp-range/revogr-temp-range.js +141 -0
  58. package/dist/{revo-grid/app-globals-7e6866ba.js → collection/global/global.js} +2 -8
  59. package/dist/collection/index.js +4 -0
  60. package/dist/collection/plugins/autoSizeColumn.js +233 -0
  61. package/dist/collection/plugins/basePlugin.js +30 -0
  62. package/dist/{revo-grid/dispatcher-891af82e.js → collection/plugins/dispatcher.js} +2 -4
  63. package/dist/collection/plugins/export/csv.js +71 -0
  64. package/dist/collection/plugins/export/export.plugin.js +168 -0
  65. package/dist/collection/plugins/export/types.js +4 -0
  66. package/dist/collection/plugins/filter/conditions/equal.js +20 -0
  67. package/dist/collection/plugins/filter/conditions/number/greaterThan.js +13 -0
  68. package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +10 -0
  69. package/dist/collection/plugins/filter/conditions/number/lessThan.js +15 -0
  70. package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +10 -0
  71. package/dist/collection/plugins/filter/conditions/set.js +6 -0
  72. package/dist/collection/plugins/filter/conditions/string/beginswith.js +20 -0
  73. package/dist/collection/plugins/filter/conditions/string/contains.js +21 -0
  74. package/dist/{revo-grid/filter.button-74c1cd9c.js → collection/plugins/filter/filter.button.js} +10 -13
  75. package/dist/collection/plugins/filter/filter.plugin.js +259 -0
  76. package/dist/collection/plugins/filter/filter.pop.js +488 -0
  77. package/dist/collection/plugins/filter/filter.service.js +47 -0
  78. package/dist/collection/plugins/filter/filter.style.css +239 -0
  79. package/dist/collection/plugins/filter/filter.types.js +4 -0
  80. package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +33 -0
  81. package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +39 -0
  82. package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +24 -0
  83. package/dist/collection/plugins/groupingRow/grouping.const.js +13 -0
  84. package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +79 -0
  85. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +261 -0
  86. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +32 -0
  87. package/dist/collection/plugins/groupingRow/grouping.row.types.js +4 -0
  88. package/dist/collection/plugins/groupingRow/grouping.service.js +158 -0
  89. package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +60 -0
  90. package/dist/collection/plugins/moveColumn/columnDragPlugin.js +151 -0
  91. package/dist/collection/plugins/moveColumn/columnOrderHandler.js +63 -0
  92. package/dist/collection/plugins/sorting/sorting.plugin.js +184 -0
  93. package/dist/collection/plugins/sorting/sorting.sign.js +9 -0
  94. package/dist/collection/plugins/stretchPlugin.js +71 -0
  95. package/dist/collection/plugins/trimmed/trimmed.plugin.js +35 -0
  96. package/dist/collection/services/cell.helpers.js +10 -0
  97. package/dist/collection/services/column.data.provider.js +191 -0
  98. package/dist/collection/services/data.provider.js +50 -0
  99. package/dist/collection/services/dimension.provider.js +81 -0
  100. package/dist/{revo-grid/localScrollService-e9b73323.js → collection/services/localScrollService.js} +2 -5
  101. package/dist/collection/services/resizable.directive.js +255 -0
  102. package/dist/collection/services/selection.store.connector.js +216 -0
  103. package/dist/collection/services/viewport.provider.js +17 -0
  104. package/dist/collection/store/dataSource/data.proxy.js +37 -0
  105. package/dist/collection/store/dataSource/data.store.js +130 -0
  106. package/dist/collection/store/dimension/dimension.helpers.js +110 -0
  107. package/dist/collection/store/dimension/dimension.store.js +62 -0
  108. package/dist/collection/store/selection/selection.helpers.js +56 -0
  109. package/dist/collection/store/selection/selection.store.js +71 -0
  110. package/dist/collection/store/selection/selection.store.service.js +38 -0
  111. package/dist/collection/store/storeTypes.js +8 -0
  112. package/dist/{revo-grid/viewport.store-ffaaab6d.js → collection/store/viewPort/viewport.helpers.js} +9 -132
  113. package/dist/collection/store/viewPort/viewport.store.js +124 -0
  114. package/dist/collection/themeManager/theme.compact.js +8 -0
  115. package/dist/collection/themeManager/theme.default.js +8 -0
  116. package/dist/collection/themeManager/theme.material.js +8 -0
  117. package/dist/{revo-grid/themeService-ddaaa364.js → collection/themeManager/themeService.js} +6 -23
  118. package/dist/collection/utils/closestPolifill.js +21 -0
  119. package/dist/collection/utils/consts.js +22 -0
  120. package/dist/collection/utils/generateAlphabetHeader.js +23 -0
  121. package/dist/collection/utils/keyCodes.js +73 -0
  122. package/dist/collection/utils/keyCodes.utils.js +67 -0
  123. package/dist/collection/utils/platform.js +8 -0
  124. package/dist/collection/utils/resizeObserver.js +9 -0
  125. package/dist/collection/utils/store.utils.js +10 -0
  126. package/dist/{revo-grid/utils-2c3b3857.js → collection/utils/utils.js} +8 -10
  127. package/dist/collection/utilsExternal/generate-data.js +132 -0
  128. package/dist/esm/css-shim-e1e1ea5e.js +7 -0
  129. package/dist/esm/debounce-e4e6dd45.js +561 -0
  130. package/dist/esm/dom-21bd1807.js +76 -0
  131. package/dist/esm/index-6f753b3c.js +1817 -0
  132. package/dist/esm/index.js +3 -0
  133. package/dist/esm/loader.js +34 -0
  134. package/dist/esm/polyfills/core-js.js +11 -0
  135. package/dist/esm/polyfills/css-shim.js +1 -0
  136. package/dist/esm/polyfills/dom.js +79 -0
  137. package/dist/esm/polyfills/es5-html-element.js +1 -0
  138. package/dist/esm/polyfills/index.js +34 -0
  139. package/dist/esm/polyfills/system.js +6 -0
  140. package/dist/esm/resize-observer-00c48d78.js +503 -0
  141. package/dist/esm/revo-grid.js +77 -0
  142. package/dist/{revo-grid/lodash-a0ab4cdd.js → esm/revo-grid_11.entry.js} +25351 -14282
  143. package/dist/esm/revogr-clipboard.entry.js +52 -0
  144. package/dist/esm/revogr-filter-panel.entry.js +274 -0
  145. package/dist/esm-es5/css-shim-e1e1ea5e.js +4 -0
  146. package/dist/esm-es5/debounce-e4e6dd45.js +4 -0
  147. package/dist/esm-es5/dom-21bd1807.js +24 -0
  148. package/dist/esm-es5/index-6f753b3c.js +4 -0
  149. package/dist/esm-es5/index.js +3 -0
  150. package/dist/esm-es5/loader.js +4 -0
  151. package/dist/esm-es5/resize-observer-00c48d78.js +4 -0
  152. package/dist/esm-es5/revo-grid.js +4 -0
  153. package/dist/esm-es5/revo-grid_11.entry.js +4 -0
  154. package/dist/esm-es5/revogr-clipboard.entry.js +4 -0
  155. package/dist/esm-es5/revogr-filter-panel.entry.js +4 -0
  156. package/dist/index.cjs.js +1 -0
  157. package/dist/index.js +1 -0
  158. package/dist/revo-grid/css-shim-bcf89cc0.system.js +4 -0
  159. package/dist/revo-grid/css-shim-e1e1ea5e.js +4 -0
  160. package/dist/revo-grid/debounce-5a33c710.system.js +4 -0
  161. package/dist/revo-grid/debounce-726bdadb.js +4 -0
  162. package/dist/revo-grid/dom-21bd1807.js +5 -59
  163. package/dist/revo-grid/dom-726246e2.system.js +24 -0
  164. package/dist/revo-grid/index-f14b41a0.system.js +5 -0
  165. package/dist/revo-grid/index-f30d1de1.js +5 -0
  166. package/dist/revo-grid/index.system.js +4 -0
  167. package/dist/revo-grid/resize-observer-00c48d78.js +1 -500
  168. package/dist/revo-grid/resize-observer-8af0bc0e.system.js +4 -0
  169. package/dist/revo-grid/revo-grid.esm.js +1 -130
  170. package/dist/revo-grid/revo-grid.js +133 -0
  171. package/dist/revo-grid/revo-grid.system.js +4 -0
  172. package/dist/revo-grid/revo-grid_11.entry.js +4 -0
  173. package/dist/revo-grid/revo-grid_11.system.entry.js +4 -0
  174. package/dist/revo-grid/revogr-clipboard.entry.js +1 -49
  175. package/dist/revo-grid/revogr-clipboard.system.entry.js +4 -0
  176. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -274
  177. package/dist/revo-grid/revogr-filter-panel.system.entry.js +4 -0
  178. package/dist/types/components/revo-grid/revo-grid.d.ts +0 -1
  179. package/dist/types/components.d.ts +2 -2
  180. package/loader/cdn.js +3 -1
  181. package/loader/index.cjs.js +3 -1
  182. package/loader/index.d.ts +0 -1
  183. package/loader/index.es2017.js +3 -1
  184. package/loader/index.js +3 -1
  185. package/package.json +1 -1
  186. package/dist/revo-grid/_baseIteratee-af30b221.js +0 -2070
  187. package/dist/revo-grid/consts-ef824e6f.js +0 -46
  188. package/dist/revo-grid/css-shim-5387c708.js +0 -7
  189. package/dist/revo-grid/data.store-3263fff9.js +0 -557
  190. package/dist/revo-grid/debounce-aaa4b4da.js +0 -217
  191. package/dist/revo-grid/dimension.helpers-a7944fc4.js +0 -340
  192. package/dist/revo-grid/each-0378e5a3.js +0 -180
  193. package/dist/revo-grid/identity-c8c7d3d8.js +0 -26
  194. package/dist/revo-grid/isString-a51066b5.js +0 -34
  195. package/dist/revo-grid/isSymbol-e4b5dafe.js +0 -247
  196. package/dist/revo-grid/keyCodes.utils-bd06e3ba.js +0 -299
  197. package/dist/revo-grid/keys-70b7c240.js +0 -561
  198. package/dist/revo-grid/revo-grid.entry.js +0 -3484
  199. package/dist/revo-grid/revogr-data.entry.js +0 -152
  200. package/dist/revo-grid/revogr-edit.entry.js +0 -105
  201. package/dist/revo-grid/revogr-focus.entry.js +0 -41
  202. package/dist/revo-grid/revogr-header.entry.js +0 -560
  203. package/dist/revo-grid/revogr-order-editor.entry.js +0 -175
  204. package/dist/revo-grid/revogr-overlay-selection.entry.js +0 -711
  205. package/dist/revo-grid/revogr-row-headers.entry.js +0 -73
  206. package/dist/revo-grid/revogr-scroll-virtual.entry.js +0 -114
  207. package/dist/revo-grid/revogr-temp-range.entry.js +0 -73
  208. package/dist/revo-grid/revogr-viewport-scroll.entry.js +0 -340
  209. package/dist/revo-grid/selection.store.connector-2b613fd0.js +0 -503
  210. package/dist/revo-grid/shadow-css-602a09db.js +0 -390
  211. package/dist/revo-grid/toInteger-9e6cbfd2.js +0 -107
  212. package/dist/revo-grid/toNumber-913b0b72.js +0 -105
  213. package/dist/revo-grid/viewport.helpers-49d3f031.js +0 -16
@@ -0,0 +1,110 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import each from 'lodash/each';
5
+ import sortedIndex from 'lodash/sortedIndex';
6
+ import reduce from 'lodash/reduce';
7
+ import { mergeSortedArray } from '../../utils/utils';
8
+ /**
9
+ * Pre-calculation
10
+ * Dimension sizes for each cell
11
+ */
12
+ export function calculateDimensionData(state, newSizes) {
13
+ let positionIndexes = [];
14
+ const positionIndexToItem = {};
15
+ const indexToItem = {};
16
+ // to compare how real width changed
17
+ let newTotal = 0;
18
+ // combine all sizes
19
+ const sizes = Object.assign(Object.assign({}, state.sizes), newSizes);
20
+ // prepare order sorted new sizes and calculate changed real size
21
+ let newIndexes = [];
22
+ each(newSizes, (size, index) => {
23
+ // if first introduced custom size
24
+ if (!state.sizes[index]) {
25
+ newTotal += size - (state.realSize ? state.originItemSize : 0);
26
+ newIndexes.splice(sortedIndex(newIndexes, parseInt(index, 10)), 0, parseInt(index, 10));
27
+ }
28
+ else {
29
+ newTotal += size - state.sizes[index];
30
+ }
31
+ });
32
+ // add order to cached order collection for faster linking
33
+ const updatedIndexesCache = mergeSortedArray(state.indexes, newIndexes);
34
+ // fill new coordinates
35
+ reduce(updatedIndexesCache, (previous, itemIndex, i) => {
36
+ const newItem = {
37
+ itemIndex,
38
+ start: 0,
39
+ end: 0,
40
+ };
41
+ if (previous) {
42
+ newItem.start = (itemIndex - previous.itemIndex - 1) * state.originItemSize + previous.end;
43
+ }
44
+ else {
45
+ newItem.start = itemIndex * state.originItemSize;
46
+ }
47
+ newItem.end = newItem.start + sizes[itemIndex];
48
+ positionIndexes.push(newItem.start);
49
+ indexToItem[itemIndex] = positionIndexToItem[i] = newItem;
50
+ return newItem;
51
+ }, undefined);
52
+ return {
53
+ indexes: updatedIndexesCache,
54
+ positionIndexes: [...positionIndexes],
55
+ positionIndexToItem: Object.assign({}, positionIndexToItem),
56
+ indexToItem,
57
+ realSize: state.realSize + newTotal,
58
+ sizes,
59
+ };
60
+ }
61
+ export function getItemByPosition({ indexes, positionIndexes, originItemSize, positionIndexToItem }, pos) {
62
+ const item = {
63
+ itemIndex: 0,
64
+ start: 0,
65
+ end: 0,
66
+ };
67
+ const currentPlace = indexes.length ? sortedIndex(positionIndexes, pos) : 0;
68
+ // not found or first index
69
+ if (!currentPlace) {
70
+ item.itemIndex = Math.floor(pos / originItemSize);
71
+ item.start = item.itemIndex * originItemSize;
72
+ item.end = item.start + originItemSize;
73
+ return item;
74
+ }
75
+ const positionItem = positionIndexToItem[currentPlace - 1];
76
+ // if item has specified size
77
+ if (positionItem.end > pos) {
78
+ return positionItem;
79
+ }
80
+ // special size item was present before
81
+ const relativePos = pos - positionItem.end;
82
+ const relativeIndex = Math.floor(relativePos / originItemSize);
83
+ item.itemIndex = positionItem.itemIndex + 1 + relativeIndex;
84
+ item.start = positionItem.end + relativeIndex * originItemSize;
85
+ item.end = item.start + originItemSize;
86
+ return item;
87
+ }
88
+ export function getItemByIndex(dimension, index) {
89
+ let item = {
90
+ itemIndex: index,
91
+ start: 0,
92
+ end: 0,
93
+ };
94
+ // if item has specified size
95
+ if (dimension.indexToItem[index]) {
96
+ return dimension.indexToItem[index];
97
+ }
98
+ const currentPlace = dimension.indexes.length ? sortedIndex(dimension.indexes, index) : 0;
99
+ // not found or first index
100
+ if (!currentPlace) {
101
+ item.start = item.itemIndex * dimension.originItemSize;
102
+ item.end = item.start + dimension.originItemSize;
103
+ return item;
104
+ }
105
+ // special size item was present before
106
+ const positionItem = dimension.indexToItem[dimension.indexes[currentPlace - 1]];
107
+ item.start = positionItem.end + (index - positionItem.itemIndex - 1) * dimension.originItemSize;
108
+ item.end = item.start + dimension.originItemSize;
109
+ return item;
110
+ }
@@ -0,0 +1,62 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ /**
5
+ * Storing pre-calculated
6
+ * Dimension information and sizes
7
+ */
8
+ import { createStore } from '@stencil/store';
9
+ import reduce from 'lodash/reduce';
10
+ import { setStore } from '../../utils/store.utils';
11
+ import { calculateDimensionData } from './dimension.helpers';
12
+ function initialBase() {
13
+ return {
14
+ indexes: [],
15
+ // item index to size
16
+ sizes: {},
17
+ // order in indexes[] to coordinate
18
+ positionIndexToItem: {},
19
+ // initial element to coordinate ^
20
+ indexToItem: {},
21
+ positionIndexes: []
22
+ };
23
+ }
24
+ function initialState() {
25
+ return Object.assign(Object.assign({}, initialBase()), {
26
+ // size which all items can take
27
+ realSize: 0,
28
+ // initial item size if it wasn't changed
29
+ originItemSize: 0, frameOffset: 0 });
30
+ }
31
+ export default class DimensionStore {
32
+ constructor() {
33
+ this.store = createStore(initialState());
34
+ }
35
+ getCurrentState() {
36
+ const state = initialState();
37
+ const keys = Object.keys(state);
38
+ return reduce(keys, (r, k) => {
39
+ const data = this.store.get(k);
40
+ r[k] = data;
41
+ return r;
42
+ }, state);
43
+ }
44
+ setRealSize(count) {
45
+ let realSize = 0;
46
+ for (let i = 0; i < count; i++) {
47
+ realSize += this.store.get('sizes')[i] || this.store.get('originItemSize');
48
+ }
49
+ setStore(this.store, { realSize });
50
+ }
51
+ setStore(data) {
52
+ setStore(this.store, data);
53
+ }
54
+ drop() {
55
+ setStore(this.store, initialBase());
56
+ }
57
+ setDimensionSize(sizes) {
58
+ const dimensionData = calculateDimensionData(this.getCurrentState(), sizes);
59
+ setStore(this.store, dimensionData);
60
+ return dimensionData;
61
+ }
62
+ }
@@ -0,0 +1,56 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { EMPTY_INDEX } from '../../services/selection.store.connector';
5
+ export function isHiddenStore(pos) {
6
+ return pos === EMPTY_INDEX;
7
+ }
8
+ export function nextCell(cell, lastCell) {
9
+ const nextItem = {};
10
+ let types = ['x', 'y'];
11
+ // previous item check
12
+ for (let t of types) {
13
+ if (cell[t] < 0) {
14
+ nextItem[t] = cell[t];
15
+ return nextItem;
16
+ }
17
+ }
18
+ // next item check
19
+ for (let t of types) {
20
+ if (cell[t] >= lastCell[t]) {
21
+ nextItem[t] = cell[t] - lastCell[t];
22
+ return nextItem;
23
+ }
24
+ }
25
+ return null;
26
+ }
27
+ export function cropCellToMax(cell, lastCell) {
28
+ const newCell = Object.assign({}, cell);
29
+ let types = ['x', 'y'];
30
+ // previous item check
31
+ for (let t of types) {
32
+ if (cell[t] < 0) {
33
+ newCell[t] = 0;
34
+ }
35
+ }
36
+ // next item check
37
+ for (let t of types) {
38
+ if (cell[t] >= lastCell[t]) {
39
+ newCell[t] = lastCell[t] - 1;
40
+ }
41
+ }
42
+ return newCell;
43
+ }
44
+ export function getRange(start, end) {
45
+ return start && end
46
+ ? {
47
+ x: Math.min(start.x, end.x),
48
+ y: Math.min(start.y, end.y),
49
+ x1: Math.max(start.x, end.x),
50
+ y1: Math.max(start.y, end.y),
51
+ }
52
+ : null;
53
+ }
54
+ export function isRangeSingleCell(a) {
55
+ return a.x === a.x1 && a.y === a.y1;
56
+ }
@@ -0,0 +1,71 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { createStore } from '@stencil/store';
5
+ import { setStore } from '../../utils/store.utils';
6
+ import { getRange } from './selection.helpers';
7
+ function defaultState() {
8
+ return {
9
+ range: null,
10
+ tempRange: null,
11
+ tempRangeType: null,
12
+ focus: null,
13
+ edit: null,
14
+ lastCell: null,
15
+ };
16
+ }
17
+ export class SelectionStore {
18
+ constructor() {
19
+ this.unsubscribe = [];
20
+ this.store = createStore(defaultState());
21
+ this.store.on('set', (key, newVal) => {
22
+ if (key === 'tempRange' && !newVal) {
23
+ this.store.set('tempRangeType', null);
24
+ }
25
+ });
26
+ }
27
+ onChange(propName, cb) {
28
+ this.unsubscribe.push(this.store.onChange(propName, cb));
29
+ }
30
+ clearFocus() {
31
+ setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });
32
+ }
33
+ setFocus(focus, end) {
34
+ setStore(this.store, {
35
+ focus,
36
+ range: getRange(focus, end),
37
+ edit: null,
38
+ tempRange: null,
39
+ });
40
+ }
41
+ setTempArea(range) {
42
+ setStore(this.store, { tempRange: range === null || range === void 0 ? void 0 : range.area, tempRangeType: range === null || range === void 0 ? void 0 : range.type, edit: null });
43
+ }
44
+ clearTemp() {
45
+ setStore(this.store, { tempRange: null });
46
+ }
47
+ /** Can be applied from selection change or from simple keyboard change clicks */
48
+ setRangeArea(range) {
49
+ setStore(this.store, { range, edit: null, tempRange: null });
50
+ }
51
+ setRange(start, end) {
52
+ this.setRangeArea(getRange(start, end));
53
+ }
54
+ setLastCell(lastCell) {
55
+ setStore(this.store, { lastCell });
56
+ }
57
+ setEdit(val) {
58
+ const focus = this.store.get('focus');
59
+ if (focus && typeof val === 'string') {
60
+ setStore(this.store, {
61
+ edit: { x: focus.x, y: focus.y, val },
62
+ });
63
+ return;
64
+ }
65
+ setStore(this.store, { edit: null });
66
+ }
67
+ dispose() {
68
+ this.unsubscribe.forEach(f => f());
69
+ this.store.dispose();
70
+ }
71
+ }
@@ -0,0 +1,38 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { getRange } from './selection.helpers';
5
+ export default class SelectionStoreService {
6
+ constructor(store, config) {
7
+ this.store = store;
8
+ this.config = config;
9
+ this.store = store;
10
+ }
11
+ get edited() {
12
+ return this.store.get('edit');
13
+ }
14
+ get focused() {
15
+ return this.store.get('focus');
16
+ }
17
+ get ranged() {
18
+ return this.store.get('range');
19
+ }
20
+ changeRange(range) {
21
+ return this.config.changeRange(range);
22
+ }
23
+ focus(cell, isMulti = false) {
24
+ if (!cell) {
25
+ return false;
26
+ }
27
+ let end = cell;
28
+ // range edit
29
+ if (isMulti) {
30
+ let start = this.store.get('focus');
31
+ if (start) {
32
+ return this.config.changeRange(getRange(start, end));
33
+ }
34
+ }
35
+ // single focus
36
+ return this.config.focus(cell, end);
37
+ }
38
+ }
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ export const rowTypes = ['rowPinStart', 'rgRow', 'rowPinEnd'];
5
+ export const columnTypes = ['colPinStart', 'rgCol', 'colPinEnd'];
6
+ export function isRowType(type) {
7
+ return rowTypes.indexOf(type) > -1;
8
+ }
@@ -1,15 +1,13 @@
1
1
  /*!
2
2
  * Built by Revolist
3
3
  */
4
- import { c as createStore, d as setStore } from './data.store-3263fff9.js';
5
- import { a as getItemByPosition } from './dimension.helpers-a7944fc4.js';
6
-
4
+ import { getItemByPosition } from '../dimension/dimension.helpers';
7
5
  /**
8
6
  * Update items based on new scroll position
9
7
  * If viewport wasn't changed fully simple recombination of positions
10
8
  * Otherwise rebuild viewport items
11
9
  */
12
- function getUpdatedItemsByPosition(pos, items, realCount, virtualSize, dimension) {
10
+ export function getUpdatedItemsByPosition(pos, items, realCount, virtualSize, dimension) {
13
11
  const activeItem = getItemByPosition(dimension, pos);
14
12
  const firstItem = getFirstItem(items);
15
13
  let toUpdate;
@@ -50,7 +48,7 @@ function getUpdatedItemsByPosition(pos, items, realCount, virtualSize, dimension
50
48
  }
51
49
  return toUpdate;
52
50
  }
53
- function updateMissingAndRange(items, missing, range) {
51
+ export function updateMissingAndRange(items, missing, range) {
54
52
  items.splice(range.end + 1, 0, ...missing);
55
53
  // update range if start larger after recombination
56
54
  if (range.start >= range.end && !(range.start === range.end && range.start === 0)) {
@@ -59,7 +57,7 @@ function updateMissingAndRange(items, missing, range) {
59
57
  range.end += missing.length;
60
58
  }
61
59
  // if partial replacement add items if revo-viewport has some space left
62
- function addMissingItems(firstItem, realCount, virtualSize, existingCollection, dimension) {
60
+ export function addMissingItems(firstItem, realCount, virtualSize, existingCollection, dimension) {
63
61
  const lastItem = getLastItem(existingCollection);
64
62
  const items = getItems({
65
63
  sizes: dimension.sizes,
@@ -72,7 +70,7 @@ function addMissingItems(firstItem, realCount, virtualSize, existingCollection,
72
70
  return items;
73
71
  }
74
72
  // get revo-viewport items parameters, caching position and calculating items count in revo-viewport
75
- function getItems(opt, currentSize = 0) {
73
+ export function getItems(opt, currentSize = 0) {
76
74
  const items = [];
77
75
  let index = opt.startIndex;
78
76
  let size = currentSize;
@@ -93,7 +91,7 @@ function getItems(opt, currentSize = 0) {
93
91
  * Do batch items recombination
94
92
  * If items not overlapped with existing viewport returns null
95
93
  */
96
- function recombineByOffset(offset, data) {
94
+ export function recombineByOffset(offset, data) {
97
95
  const newItems = [...data.items];
98
96
  const itemsCount = newItems.length;
99
97
  let newRange = {
@@ -174,133 +172,12 @@ function getItemSize(index, sizes, origSize = 0) {
174
172
  }
175
173
  return origSize;
176
174
  }
177
- function isActiveRange(pos, item) {
175
+ export function isActiveRange(pos, item) {
178
176
  return item && pos >= item.start && pos <= item.end;
179
177
  }
180
- function getFirstItem(s) {
178
+ export function getFirstItem(s) {
181
179
  return s.items[s.start];
182
180
  }
183
- function getLastItem(s) {
181
+ export function getLastItem(s) {
184
182
  return s.items[s.end];
185
183
  }
186
-
187
- /**
188
- * Store is responsible for visible
189
- * Viewport information for each dimension
190
- * Redraw items during scrolling
191
- */
192
- function initialState() {
193
- return {
194
- // virtual item information per rendered item
195
- items: [],
196
- // virtual dom item order to render
197
- start: 0,
198
- end: 0,
199
- // size of viewport in px
200
- virtualSize: 0,
201
- // total number of items
202
- realCount: 0,
203
- // last coordinate for store position restore
204
- lastCoordinate: 0,
205
- };
206
- }
207
- class ViewportStore {
208
- constructor() {
209
- this.store = createStore(initialState());
210
- this.store.onChange('realCount', () => this.clear());
211
- }
212
- /** Render viewport based on coordinate, this is main method for draw */
213
- setViewPortCoordinate(position, dimension) {
214
- let virtualSize = this.store.get('virtualSize');
215
- // no visible data to calculate
216
- if (!virtualSize) {
217
- return;
218
- }
219
- const frameOffset = dimension.frameOffset;
220
- const outsize = frameOffset * 2 * dimension.originItemSize;
221
- virtualSize += outsize;
222
- let maxCoordinate = virtualSize;
223
- if (dimension.realSize > virtualSize) {
224
- maxCoordinate = dimension.realSize - virtualSize;
225
- }
226
- let toUpdate = {
227
- lastCoordinate: position,
228
- };
229
- let pos = position;
230
- pos -= frameOffset * dimension.originItemSize;
231
- pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate;
232
- const firstItem = getFirstItem(this.getItems());
233
- const lastItem = getLastItem(this.getItems());
234
- // left position changed
235
- if (!isActiveRange(pos, firstItem)) {
236
- toUpdate = Object.assign(Object.assign({}, toUpdate), getUpdatedItemsByPosition(pos, this.getItems(), this.store.get('realCount'), virtualSize, dimension));
237
- setStore(this.store, Object.assign({}, toUpdate));
238
- // right position changed
239
- }
240
- else if (firstItem && this.store.get('virtualSize') + pos > (lastItem === null || lastItem === void 0 ? void 0 : lastItem.end)) {
241
- // check is any item missing for full fill content
242
- const missing = addMissingItems(firstItem, this.store.get('realCount'), virtualSize + pos - firstItem.start, this.getItems(), dimension);
243
- if (missing.length) {
244
- const items = [...this.store.get('items')];
245
- const range = {
246
- start: this.store.get('start'),
247
- end: this.store.get('end'),
248
- };
249
- updateMissingAndRange(items, missing, range);
250
- toUpdate = Object.assign(Object.assign(Object.assign({}, toUpdate), { items: [...items] }), range);
251
- setStore(this.store, Object.assign({}, toUpdate));
252
- }
253
- }
254
- }
255
- /** Update viewport sizes */
256
- setViewPortDimension(sizes) {
257
- const items = this.store.get('items');
258
- const count = items.length;
259
- // viewport not inited
260
- if (!count) {
261
- return;
262
- }
263
- let changedCoordinate = 0;
264
- let i = 0;
265
- let start = this.store.get('start');
266
- // loop through array from initial item after recombination
267
- while (i < count) {
268
- const item = items[start];
269
- // change pos if size change present before
270
- if (changedCoordinate) {
271
- item.start += changedCoordinate;
272
- item.end += changedCoordinate;
273
- }
274
- // change size
275
- const size = sizes[item.itemIndex];
276
- if (size) {
277
- const changedSize = size - item.size;
278
- changedCoordinate += changedSize;
279
- item.size = size;
280
- item.end = item.start + size;
281
- }
282
- // loop by start index
283
- start++;
284
- i++;
285
- if (start === count) {
286
- start = 0;
287
- }
288
- }
289
- setStore(this.store, { items: [...items] });
290
- }
291
- getItems() {
292
- return {
293
- items: this.store.get('items'),
294
- start: this.store.get('start'),
295
- end: this.store.get('end'),
296
- };
297
- }
298
- setViewport(data) {
299
- setStore(this.store, data);
300
- }
301
- clear() {
302
- this.store.set('items', []);
303
- }
304
- }
305
-
306
- export { ViewportStore as V };
@@ -0,0 +1,124 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ /**
5
+ * Store is responsible for visible
6
+ * Viewport information for each dimension
7
+ * Redraw items during scrolling
8
+ */
9
+ import { createStore } from '@stencil/store';
10
+ import { addMissingItems, getFirstItem, getLastItem, getUpdatedItemsByPosition, isActiveRange, updateMissingAndRange } from './viewport.helpers';
11
+ import { setStore } from '../../utils/store.utils';
12
+ function initialState() {
13
+ return {
14
+ // virtual item information per rendered item
15
+ items: [],
16
+ // virtual dom item order to render
17
+ start: 0,
18
+ end: 0,
19
+ // size of viewport in px
20
+ virtualSize: 0,
21
+ // total number of items
22
+ realCount: 0,
23
+ // last coordinate for store position restore
24
+ lastCoordinate: 0,
25
+ };
26
+ }
27
+ export default class ViewportStore {
28
+ constructor() {
29
+ this.store = createStore(initialState());
30
+ this.store.onChange('realCount', () => this.clear());
31
+ }
32
+ /** Render viewport based on coordinate, this is main method for draw */
33
+ setViewPortCoordinate(position, dimension) {
34
+ let virtualSize = this.store.get('virtualSize');
35
+ // no visible data to calculate
36
+ if (!virtualSize) {
37
+ return;
38
+ }
39
+ const frameOffset = dimension.frameOffset;
40
+ const outsize = frameOffset * 2 * dimension.originItemSize;
41
+ virtualSize += outsize;
42
+ let maxCoordinate = virtualSize;
43
+ if (dimension.realSize > virtualSize) {
44
+ maxCoordinate = dimension.realSize - virtualSize;
45
+ }
46
+ let toUpdate = {
47
+ lastCoordinate: position,
48
+ };
49
+ let pos = position;
50
+ pos -= frameOffset * dimension.originItemSize;
51
+ pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate;
52
+ const firstItem = getFirstItem(this.getItems());
53
+ const lastItem = getLastItem(this.getItems());
54
+ // left position changed
55
+ if (!isActiveRange(pos, firstItem)) {
56
+ toUpdate = Object.assign(Object.assign({}, toUpdate), getUpdatedItemsByPosition(pos, this.getItems(), this.store.get('realCount'), virtualSize, dimension));
57
+ setStore(this.store, Object.assign({}, toUpdate));
58
+ // right position changed
59
+ }
60
+ else if (firstItem && this.store.get('virtualSize') + pos > (lastItem === null || lastItem === void 0 ? void 0 : lastItem.end)) {
61
+ // check is any item missing for full fill content
62
+ const missing = addMissingItems(firstItem, this.store.get('realCount'), virtualSize + pos - firstItem.start, this.getItems(), dimension);
63
+ if (missing.length) {
64
+ const items = [...this.store.get('items')];
65
+ const range = {
66
+ start: this.store.get('start'),
67
+ end: this.store.get('end'),
68
+ };
69
+ updateMissingAndRange(items, missing, range);
70
+ toUpdate = Object.assign(Object.assign(Object.assign({}, toUpdate), { items: [...items] }), range);
71
+ setStore(this.store, Object.assign({}, toUpdate));
72
+ }
73
+ }
74
+ }
75
+ /** Update viewport sizes */
76
+ setViewPortDimension(sizes) {
77
+ const items = this.store.get('items');
78
+ const count = items.length;
79
+ // viewport not inited
80
+ if (!count) {
81
+ return;
82
+ }
83
+ let changedCoordinate = 0;
84
+ let i = 0;
85
+ let start = this.store.get('start');
86
+ // loop through array from initial item after recombination
87
+ while (i < count) {
88
+ const item = items[start];
89
+ // change pos if size change present before
90
+ if (changedCoordinate) {
91
+ item.start += changedCoordinate;
92
+ item.end += changedCoordinate;
93
+ }
94
+ // change size
95
+ const size = sizes[item.itemIndex];
96
+ if (size) {
97
+ const changedSize = size - item.size;
98
+ changedCoordinate += changedSize;
99
+ item.size = size;
100
+ item.end = item.start + size;
101
+ }
102
+ // loop by start index
103
+ start++;
104
+ i++;
105
+ if (start === count) {
106
+ start = 0;
107
+ }
108
+ }
109
+ setStore(this.store, { items: [...items] });
110
+ }
111
+ getItems() {
112
+ return {
113
+ items: this.store.get('items'),
114
+ start: this.store.get('start'),
115
+ end: this.store.get('end'),
116
+ };
117
+ }
118
+ setViewport(data) {
119
+ setStore(this.store, data);
120
+ }
121
+ clear() {
122
+ this.store.set('items', []);
123
+ }
124
+ }
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ export default class ThemeCompact {
5
+ constructor() {
6
+ this.defaultRowSize = 32;
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ export default class ThemeDefault {
5
+ constructor() {
6
+ this.defaultRowSize = 27;
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ export default class ThemeMaterial {
5
+ constructor() {
6
+ this.defaultRowSize = 42;
7
+ }
8
+ }