@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.
Files changed (211) hide show
  1. package/custom-element/index.js +29213 -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} +208 -1444
  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 +28297 -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 +2227 -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 +148 -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 +253 -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 +1796 -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} +25347 -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 +5 -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/loader/cdn.js +3 -1
  179. package/loader/index.cjs.js +3 -1
  180. package/loader/index.d.ts +0 -1
  181. package/loader/index.es2017.js +3 -1
  182. package/loader/index.js +3 -1
  183. package/package.json +1 -1
  184. package/dist/revo-grid/_baseIteratee-af30b221.js +0 -2070
  185. package/dist/revo-grid/consts-ef824e6f.js +0 -46
  186. package/dist/revo-grid/css-shim-5387c708.js +0 -7
  187. package/dist/revo-grid/data.store-3263fff9.js +0 -557
  188. package/dist/revo-grid/debounce-aaa4b4da.js +0 -217
  189. package/dist/revo-grid/dimension.helpers-a7944fc4.js +0 -340
  190. package/dist/revo-grid/each-0378e5a3.js +0 -180
  191. package/dist/revo-grid/identity-c8c7d3d8.js +0 -26
  192. package/dist/revo-grid/isString-a51066b5.js +0 -34
  193. package/dist/revo-grid/isSymbol-e4b5dafe.js +0 -247
  194. package/dist/revo-grid/keyCodes.utils-bd06e3ba.js +0 -299
  195. package/dist/revo-grid/keys-70b7c240.js +0 -561
  196. package/dist/revo-grid/revo-grid.entry.js +0 -3484
  197. package/dist/revo-grid/revogr-data.entry.js +0 -152
  198. package/dist/revo-grid/revogr-edit.entry.js +0 -105
  199. package/dist/revo-grid/revogr-focus.entry.js +0 -41
  200. package/dist/revo-grid/revogr-header.entry.js +0 -560
  201. package/dist/revo-grid/revogr-order-editor.entry.js +0 -175
  202. package/dist/revo-grid/revogr-overlay-selection.entry.js +0 -711
  203. package/dist/revo-grid/revogr-row-headers.entry.js +0 -73
  204. package/dist/revo-grid/revogr-scroll-virtual.entry.js +0 -114
  205. package/dist/revo-grid/revogr-temp-range.entry.js +0 -73
  206. package/dist/revo-grid/revogr-viewport-scroll.entry.js +0 -340
  207. package/dist/revo-grid/selection.store.connector-2b613fd0.js +0 -503
  208. package/dist/revo-grid/shadow-css-602a09db.js +0 -390
  209. package/dist/revo-grid/toInteger-9e6cbfd2.js +0 -107
  210. package/dist/revo-grid/toNumber-913b0b72.js +0 -105
  211. package/dist/revo-grid/viewport.helpers-49d3f031.js +0 -16
@@ -0,0 +1,361 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { Component, Method, Event, Prop, Listen } from '@stencil/core';
5
+ import debounce from 'lodash/debounce';
6
+ import { setItems } from '../../store/dataSource/data.store';
7
+ import { DRAGG_TEXT } from '../../utils/consts';
8
+ import RowOrderService from './rowOrderService';
9
+ export class OrderEditor {
10
+ constructor() {
11
+ this.rowMoveFunc = debounce((y) => {
12
+ const rgRow = this.rowOrderService.move(y, this.getData());
13
+ if (rgRow !== null) {
14
+ this.internalRowDrag.emit(rgRow);
15
+ }
16
+ }, 5);
17
+ }
18
+ // --------------------------------------------------------------------------
19
+ //
20
+ // Listeners
21
+ //
22
+ // --------------------------------------------------------------------------
23
+ onMouseOut() {
24
+ this.clearOrder();
25
+ }
26
+ /** Action finished inside of the document */
27
+ onMouseUp(e) {
28
+ this.endOrder(e);
29
+ }
30
+ // --------------------------------------------------------------------------
31
+ //
32
+ // Methods
33
+ //
34
+ // --------------------------------------------------------------------------
35
+ async dragStart(e) {
36
+ e.preventDefault();
37
+ // extra check if previous ended
38
+ if (this.moveFunc) {
39
+ this.clearOrder();
40
+ }
41
+ const data = this.getData();
42
+ const cell = this.rowOrderService.startOrder(e, data);
43
+ const pos = this.rowOrderService.getRow(e.y, data);
44
+ const dragStartEvent = this.internalRowDragStart.emit({ cell, text: DRAGG_TEXT, pos, event: e });
45
+ if (dragStartEvent.defaultPrevented) {
46
+ return;
47
+ }
48
+ this.moveFunc = (e) => this.move(e);
49
+ document.addEventListener('mousemove', this.moveFunc);
50
+ }
51
+ async endOrder(e) {
52
+ this.rowOrderService.endOrder(e, this.getData());
53
+ this.clearOrder();
54
+ }
55
+ async clearOrder() {
56
+ this.rowOrderService.clear();
57
+ document.removeEventListener('mousemove', this.moveFunc);
58
+ this.moveFunc = null;
59
+ this.internalRowDragEnd.emit();
60
+ }
61
+ // --------------------------------------------------------------------------
62
+ //
63
+ // Component methods
64
+ //
65
+ // --------------------------------------------------------------------------
66
+ move({ x, y }) {
67
+ this.internalRowMouseMove.emit({ x, y });
68
+ this.rowMoveFunc(y);
69
+ }
70
+ connectedCallback() {
71
+ this.rowOrderService = new RowOrderService({ positionChanged: (f, t) => this.onPositionChanged(f, t) });
72
+ }
73
+ onPositionChanged(from, to) {
74
+ const dropEvent = this.initialRowDropped.emit({ from, to });
75
+ if (dropEvent.defaultPrevented) {
76
+ return;
77
+ }
78
+ const items = [...this.dataStore.get('items')];
79
+ const toMove = items.splice(from, 1);
80
+ items.splice(to, 0, ...toMove);
81
+ setItems(this.dataStore, items);
82
+ }
83
+ getData() {
84
+ return {
85
+ el: this.parent,
86
+ rows: this.dimensionRow.state,
87
+ cols: this.dimensionCol.state,
88
+ };
89
+ }
90
+ static get is() { return "revogr-order-editor"; }
91
+ static get properties() { return {
92
+ "parent": {
93
+ "type": "unknown",
94
+ "mutable": false,
95
+ "complexType": {
96
+ "original": "HTMLElement",
97
+ "resolved": "HTMLElement",
98
+ "references": {
99
+ "HTMLElement": {
100
+ "location": "global"
101
+ }
102
+ }
103
+ },
104
+ "required": false,
105
+ "optional": false,
106
+ "docs": {
107
+ "tags": [],
108
+ "text": ""
109
+ }
110
+ },
111
+ "dimensionRow": {
112
+ "type": "unknown",
113
+ "mutable": false,
114
+ "complexType": {
115
+ "original": "Observable<RevoGrid.DimensionSettingsState>",
116
+ "resolved": "ObservableMap<DimensionSettingsState>",
117
+ "references": {
118
+ "Observable": {
119
+ "location": "import",
120
+ "path": "../../interfaces"
121
+ },
122
+ "RevoGrid": {
123
+ "location": "import",
124
+ "path": "../../interfaces"
125
+ }
126
+ }
127
+ },
128
+ "required": false,
129
+ "optional": false,
130
+ "docs": {
131
+ "tags": [],
132
+ "text": ""
133
+ }
134
+ },
135
+ "dimensionCol": {
136
+ "type": "unknown",
137
+ "mutable": false,
138
+ "complexType": {
139
+ "original": "Observable<RevoGrid.DimensionSettingsState>",
140
+ "resolved": "ObservableMap<DimensionSettingsState>",
141
+ "references": {
142
+ "Observable": {
143
+ "location": "import",
144
+ "path": "../../interfaces"
145
+ },
146
+ "RevoGrid": {
147
+ "location": "import",
148
+ "path": "../../interfaces"
149
+ }
150
+ }
151
+ },
152
+ "required": false,
153
+ "optional": false,
154
+ "docs": {
155
+ "tags": [],
156
+ "text": ""
157
+ }
158
+ },
159
+ "dataStore": {
160
+ "type": "unknown",
161
+ "mutable": false,
162
+ "complexType": {
163
+ "original": "Observable<DataSourceState<RevoGrid.DataType, RevoGrid.DimensionRows>>",
164
+ "resolved": "ObservableMap<DataSourceState<DataType, DimensionRows>>",
165
+ "references": {
166
+ "Observable": {
167
+ "location": "import",
168
+ "path": "../../interfaces"
169
+ },
170
+ "DataSourceState": {
171
+ "location": "import",
172
+ "path": "../../store/dataSource/data.store"
173
+ },
174
+ "RevoGrid": {
175
+ "location": "import",
176
+ "path": "../../interfaces"
177
+ }
178
+ }
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "Static stores, not expected to change during component lifetime"
185
+ }
186
+ }
187
+ }; }
188
+ static get events() { return [{
189
+ "method": "internalRowDragStart",
190
+ "name": "internalRowDragStart",
191
+ "bubbles": true,
192
+ "cancelable": true,
193
+ "composed": true,
194
+ "docs": {
195
+ "tags": [],
196
+ "text": "Row drag started"
197
+ },
198
+ "complexType": {
199
+ "original": "{\n cell: Selection.Cell;\n text: string;\n pos: RevoGrid.PositionItem;\n event: MouseEvent;\n }",
200
+ "resolved": "{ cell: Cell; text: string; pos: PositionItem; event: MouseEvent; }",
201
+ "references": {
202
+ "Selection": {
203
+ "location": "import",
204
+ "path": "../../interfaces"
205
+ },
206
+ "RevoGrid": {
207
+ "location": "import",
208
+ "path": "../../interfaces"
209
+ },
210
+ "MouseEvent": {
211
+ "location": "global"
212
+ }
213
+ }
214
+ }
215
+ }, {
216
+ "method": "internalRowDragEnd",
217
+ "name": "internalRowDragEnd",
218
+ "bubbles": true,
219
+ "cancelable": true,
220
+ "composed": true,
221
+ "docs": {
222
+ "tags": [],
223
+ "text": "Row drag ended"
224
+ },
225
+ "complexType": {
226
+ "original": "any",
227
+ "resolved": "any",
228
+ "references": {}
229
+ }
230
+ }, {
231
+ "method": "internalRowDrag",
232
+ "name": "internalRowDrag",
233
+ "bubbles": true,
234
+ "cancelable": true,
235
+ "composed": true,
236
+ "docs": {
237
+ "tags": [],
238
+ "text": "Row move"
239
+ },
240
+ "complexType": {
241
+ "original": "RevoGrid.PositionItem",
242
+ "resolved": "PositionItem",
243
+ "references": {
244
+ "RevoGrid": {
245
+ "location": "import",
246
+ "path": "../../interfaces"
247
+ }
248
+ }
249
+ }
250
+ }, {
251
+ "method": "internalRowMouseMove",
252
+ "name": "internalRowMouseMove",
253
+ "bubbles": true,
254
+ "cancelable": true,
255
+ "composed": true,
256
+ "docs": {
257
+ "tags": [],
258
+ "text": "Row mouse move"
259
+ },
260
+ "complexType": {
261
+ "original": "Selection.Cell",
262
+ "resolved": "Cell",
263
+ "references": {
264
+ "Selection": {
265
+ "location": "import",
266
+ "path": "../../interfaces"
267
+ }
268
+ }
269
+ }
270
+ }, {
271
+ "method": "initialRowDropped",
272
+ "name": "initialRowDropped",
273
+ "bubbles": true,
274
+ "cancelable": true,
275
+ "composed": true,
276
+ "docs": {
277
+ "tags": [],
278
+ "text": "Row dragged, new range ready to be applied"
279
+ },
280
+ "complexType": {
281
+ "original": "{ from: number; to: number }",
282
+ "resolved": "{ from: number; to: number; }",
283
+ "references": {}
284
+ }
285
+ }]; }
286
+ static get methods() { return {
287
+ "dragStart": {
288
+ "complexType": {
289
+ "signature": "(e: MouseEvent) => Promise<void>",
290
+ "parameters": [{
291
+ "tags": [],
292
+ "text": ""
293
+ }],
294
+ "references": {
295
+ "Promise": {
296
+ "location": "global"
297
+ },
298
+ "MouseEvent": {
299
+ "location": "global"
300
+ }
301
+ },
302
+ "return": "Promise<void>"
303
+ },
304
+ "docs": {
305
+ "text": "",
306
+ "tags": []
307
+ }
308
+ },
309
+ "endOrder": {
310
+ "complexType": {
311
+ "signature": "(e: MouseEvent) => Promise<void>",
312
+ "parameters": [{
313
+ "tags": [],
314
+ "text": ""
315
+ }],
316
+ "references": {
317
+ "Promise": {
318
+ "location": "global"
319
+ },
320
+ "MouseEvent": {
321
+ "location": "global"
322
+ }
323
+ },
324
+ "return": "Promise<void>"
325
+ },
326
+ "docs": {
327
+ "text": "",
328
+ "tags": []
329
+ }
330
+ },
331
+ "clearOrder": {
332
+ "complexType": {
333
+ "signature": "() => Promise<void>",
334
+ "parameters": [],
335
+ "references": {
336
+ "Promise": {
337
+ "location": "global"
338
+ }
339
+ },
340
+ "return": "Promise<void>"
341
+ },
342
+ "docs": {
343
+ "text": "",
344
+ "tags": []
345
+ }
346
+ }
347
+ }; }
348
+ static get listeners() { return [{
349
+ "name": "mouseleave",
350
+ "method": "onMouseOut",
351
+ "target": "document",
352
+ "capture": false,
353
+ "passive": true
354
+ }, {
355
+ "name": "mouseup",
356
+ "method": "onMouseUp",
357
+ "target": "document",
358
+ "capture": false,
359
+ "passive": true
360
+ }]; }
361
+ }
@@ -0,0 +1,71 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { getItemByPosition } from '../../store/dimension/dimension.helpers';
5
+ export default class RowOrderService {
6
+ constructor(config) {
7
+ this.config = config;
8
+ this.currentCell = null;
9
+ this.previousRow = null;
10
+ }
11
+ /** Drag finished, calculate and apply changes */
12
+ endOrder(e, data) {
13
+ if (this.currentCell === null) {
14
+ return;
15
+ }
16
+ const newRow = this.getCell(e, data);
17
+ // if position changed
18
+ if (newRow.y !== this.currentCell.y) {
19
+ // rgRow dragged out table
20
+ if (newRow.y < 0) {
21
+ newRow.y = 0;
22
+ }
23
+ // rgRow dragged to the top
24
+ else if (newRow.y < this.currentCell.y) {
25
+ newRow.y++;
26
+ }
27
+ this.config.positionChanged(this.currentCell.y, newRow.y);
28
+ }
29
+ this.clear();
30
+ }
31
+ /** Drag started, reserve initial cell for farther use */
32
+ startOrder(e, data) {
33
+ this.currentCell = this.getCell(e, data);
34
+ return this.currentCell;
35
+ }
36
+ move(y, data) {
37
+ const rgRow = this.getRow(y, data);
38
+ // if rgRow same as previous or below range (-1 = 0) do nothing
39
+ if (this.previousRow === rgRow.itemIndex || rgRow.itemIndex < -1) {
40
+ return null;
41
+ }
42
+ this.previousRow = rgRow.itemIndex;
43
+ return rgRow;
44
+ }
45
+ /** Drag stopped, probably cursor outside of document area */
46
+ clear() {
47
+ this.currentCell = null;
48
+ this.previousRow = null;
49
+ }
50
+ /** Calculate cell based on x, y position */
51
+ getRow(y, { el, rows }) {
52
+ const { top } = el.getBoundingClientRect();
53
+ const topRelative = y - top;
54
+ const rgRow = getItemByPosition(rows, topRelative);
55
+ const absolutePosition = {
56
+ itemIndex: rgRow.itemIndex,
57
+ start: rgRow.start + top,
58
+ end: rgRow.end + top,
59
+ };
60
+ return absolutePosition;
61
+ }
62
+ /** Calculate cell based on x, y position */
63
+ getCell({ x, y }, { el, rows, cols }) {
64
+ const { top, left } = el.getBoundingClientRect();
65
+ const topRelative = y - top;
66
+ const leftRelative = x - left;
67
+ const rgRow = getItemByPosition(rows, topRelative);
68
+ const rgCol = getItemByPosition(cols, leftRelative);
69
+ return { x: rgCol.itemIndex, y: rgRow.itemIndex };
70
+ }
71
+ }
@@ -0,0 +1,185 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import debounce from 'lodash/debounce';
5
+ import each from 'lodash/each';
6
+ import slice from 'lodash/slice';
7
+ import { h } from '@stencil/core';
8
+ import { CELL_HANDLER_CLASS } from '../../utils/consts';
9
+ import { getCell, getCurrentCell, getDirectionCoordinate, getLargestAxis, isAfterLast } from './selection.utils';
10
+ import { getRange } from '../../store/selection/selection.helpers';
11
+ import { getSourceItem } from '../../store/dataSource/data.store';
12
+ var AutoFillType;
13
+ (function (AutoFillType) {
14
+ AutoFillType["selection"] = "Selection";
15
+ AutoFillType["autoFill"] = "AutoFill";
16
+ })(AutoFillType || (AutoFillType = {}));
17
+ export class AutoFillService {
18
+ constructor(sv) {
19
+ this.sv = sv;
20
+ this.autoFillType = null;
21
+ this.autoFillInitial = null;
22
+ this.autoFillStart = null;
23
+ this.autoFillLast = null;
24
+ }
25
+ /**
26
+ * Render autofill box
27
+ * @param range
28
+ * @param selectionFocus
29
+ */
30
+ renderAutofill(range, selectionFocus) {
31
+ let handlerStyle;
32
+ if (range) {
33
+ handlerStyle = getCell(range, this.sv.dimensionRow.state, this.sv.dimensionCol.state);
34
+ }
35
+ else {
36
+ handlerStyle = getCell(Object.assign(Object.assign({}, selectionFocus), { x1: selectionFocus.x, y1: selectionFocus.y }), this.sv.dimensionRow.state, this.sv.dimensionCol.state);
37
+ }
38
+ return (h("div", { class: CELL_HANDLER_CLASS, style: { left: `${handlerStyle.right}px`, top: `${handlerStyle.bottom}px` }, onMouseDown: (e) => this.selectionStart(e, this.sv.getData(), AutoFillType.autoFill) }));
39
+ }
40
+ get isAutoFill() {
41
+ return !!this.autoFillType;
42
+ }
43
+ /** Process mouse move events */
44
+ selectionMouseMove(e) {
45
+ // initiate mouse move debounce if not present
46
+ if (!this.onMouseMoveAutofill) {
47
+ this.onMouseMoveAutofill = debounce((e, data) => this.doAutofillMouseMove(e, data), 5);
48
+ }
49
+ if (this.isAutoFill) {
50
+ this.onMouseMoveAutofill(e, this.sv.getData());
51
+ }
52
+ }
53
+ getFocus() {
54
+ let focus = this.sv.selectionStoreService.focused;
55
+ const range = this.sv.selectionStoreService.ranged;
56
+ if (range) {
57
+ focus = { x: range.x, y: range.y };
58
+ }
59
+ if (!focus && !range) {
60
+ return null;
61
+ }
62
+ return focus;
63
+ }
64
+ /**
65
+ * Autofill logic:
66
+ * on mouse move apply based on previous direction (if present)
67
+ */
68
+ doAutofillMouseMove({ x, y }, data) {
69
+ if (!this.autoFillInitial) {
70
+ return;
71
+ }
72
+ let current = getCurrentCell({ x, y }, data);
73
+ let direction;
74
+ if (this.autoFillLast) {
75
+ direction = getDirectionCoordinate(this.autoFillStart, this.autoFillLast);
76
+ }
77
+ // first time or direction equal to start(same as first time)
78
+ if (!this.autoFillLast || !direction) {
79
+ direction = getLargestAxis(this.autoFillStart, current);
80
+ if (!this.autoFillLast) {
81
+ this.autoFillLast = this.autoFillStart;
82
+ }
83
+ }
84
+ // nothing changed
85
+ if (!direction) {
86
+ return;
87
+ }
88
+ each(direction, (v, k) => {
89
+ if (v) {
90
+ current = Object.assign(Object.assign({}, this.autoFillLast), { [k]: current[k] });
91
+ }
92
+ });
93
+ // check if not the latest
94
+ if (isAfterLast(current, data)) {
95
+ return;
96
+ }
97
+ this.autoFillLast = current;
98
+ this.sv.setTempRange({
99
+ area: getRange(this.autoFillInitial, this.autoFillLast),
100
+ type: this.autoFillType,
101
+ });
102
+ }
103
+ /**
104
+ * Range selection started
105
+ * Mode @param type:
106
+ * Can be triggered from MouseDown selection on element
107
+ * Or can be triggered on corner square drag
108
+ */
109
+ selectionStart(e, data, type = AutoFillType.selection) {
110
+ /** Get cell by autofill element */
111
+ const { top, left } = e.target.getBoundingClientRect();
112
+ this.autoFillInitial = this.getFocus();
113
+ this.autoFillType = type;
114
+ this.autoFillStart = getCurrentCell({ x: left, y: top }, data);
115
+ e.preventDefault();
116
+ }
117
+ /** Clear current range selection */
118
+ clearAutoFillSelection() {
119
+ // Apply autofill values on mouse up
120
+ if (this.autoFillInitial) {
121
+ // Get latest
122
+ this.autoFillInitial = this.getFocus();
123
+ if (this.autoFillType === AutoFillType.autoFill) {
124
+ this.applyRangeWithData(this.autoFillInitial, this.autoFillLast);
125
+ }
126
+ else {
127
+ this.applyRangeOnly(this.autoFillInitial, this.autoFillLast);
128
+ }
129
+ }
130
+ this.autoFillType = null;
131
+ this.autoFillInitial = null;
132
+ this.autoFillLast = null;
133
+ this.autoFillStart = null;
134
+ }
135
+ /** Trigger range apply events and handle responses */
136
+ onRangeApply(data, range) {
137
+ const models = {};
138
+ for (let rowIndex in data) {
139
+ models[rowIndex] = getSourceItem(this.sv.dataStore, parseInt(rowIndex, 10));
140
+ }
141
+ const dataEvent = this.sv.internalRangeDataApply({
142
+ data,
143
+ models,
144
+ type: this.sv.dataStore.get('type'),
145
+ });
146
+ if (!dataEvent.defaultPrevented) {
147
+ this.sv.columnService.applyRangeData(data);
148
+ }
149
+ this.sv.setRange(range);
150
+ }
151
+ /** Apply range and copy data during range application */
152
+ applyRangeWithData(start, end) {
153
+ // no changes to apply
154
+ if (!start || !end) {
155
+ return;
156
+ }
157
+ const oldRange = this.sv.selectionStoreService.ranged;
158
+ const newRange = getRange(start, end);
159
+ const columns = [...this.sv.columnService.columns];
160
+ const rangeData = {
161
+ type: this.sv.dataStore.get('type'),
162
+ newData: {},
163
+ newRange,
164
+ oldRange,
165
+ newProps: slice(columns, newRange.x, newRange.x1 + 1).map(v => v.prop),
166
+ oldProps: slice(columns, oldRange.x, oldRange.x1 + 1).map(v => v.prop),
167
+ };
168
+ rangeData.newData = this.sv.columnService.getRangeData(rangeData);
169
+ const selectionEndEvent = this.sv.internalSelectionChanged(rangeData);
170
+ if (selectionEndEvent.defaultPrevented) {
171
+ this.sv.setTempRange(null);
172
+ return;
173
+ }
174
+ this.onRangeApply(rangeData.newData, newRange);
175
+ }
176
+ /** Update range selection ony, no data change (mouse selection) */
177
+ applyRangeOnly(start, end) {
178
+ // no changes to apply
179
+ if (!start || !end) {
180
+ return;
181
+ }
182
+ const newRange = getRange(start, end);
183
+ this.sv.setRange(newRange);
184
+ }
185
+ }
@@ -0,0 +1,42 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import slice from 'lodash/slice';
5
+ import { h } from '@stencil/core';
6
+ import { getRange } from '../../store/selection/selection.helpers';
7
+ export class ClipboardService {
8
+ constructor(sv) {
9
+ this.sv = sv;
10
+ }
11
+ onCopy(e) {
12
+ const canCopy = this.sv.internalCopy();
13
+ if (canCopy.defaultPrevented) {
14
+ return false;
15
+ }
16
+ let focus = this.sv.selectionStoreService.focused;
17
+ let range = this.sv.selectionStoreService.ranged;
18
+ let data;
19
+ if (!range) {
20
+ range = getRange(focus, focus);
21
+ }
22
+ if (range) {
23
+ const columns = [...this.sv.columnService.columns];
24
+ const props = slice(columns, range.x, range.x1 + 1).map(v => v.prop);
25
+ data = this.sv.columnService.copyRangeArray(range, props, this.sv.dataStore);
26
+ }
27
+ this.clipboard.doCopy(e, data);
28
+ return true;
29
+ }
30
+ renderClipboard() {
31
+ return h("revogr-clipboard", { onCopyRegion: e => this.onCopy(e.detail), ref: e => (this.clipboard = e), onPasteRegion: e => this.onPaste(e.detail) });
32
+ }
33
+ onPaste(data) {
34
+ const focus = this.sv.selectionStoreService.focused;
35
+ const isEditing = this.sv.selectionStoreService.edited !== null;
36
+ if (!focus || isEditing) {
37
+ return;
38
+ }
39
+ const { changed, range } = this.sv.columnService.getTransformedDataToApply(focus, data);
40
+ this.sv.onRangeApply(changed, range);
41
+ }
42
+ }
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { EDIT_INPUT_WR } from '../../../utils/consts';
5
+ // is edit input
6
+ export function isEditInput(el) {
7
+ return !!(el === null || el === void 0 ? void 0 : el.closest(`.${EDIT_INPUT_WR}`));
8
+ }
@@ -0,0 +1,38 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ import { h } from '@stencil/core';
5
+ import { isEnterKey, isTab } from '../../../utils/keyCodes.utils';
6
+ import { timeout } from '../../../utils/utils';
7
+ export class TextEditor {
8
+ constructor(column, saveCallback) {
9
+ this.column = column;
10
+ this.saveCallback = saveCallback;
11
+ this.element = null;
12
+ this.editCell = null;
13
+ }
14
+ async componentDidRender() {
15
+ var _a;
16
+ if (this.editInput) {
17
+ await timeout();
18
+ (_a = this.editInput) === null || _a === void 0 ? void 0 : _a.focus();
19
+ }
20
+ }
21
+ onKeyDown(e) {
22
+ const isEnter = isEnterKey(e.code);
23
+ const isKeyTab = isTab(e.code);
24
+ if ((isKeyTab || isEnter) && e.target && this.saveCallback && !e.isComposing) {
25
+ // blur is needed to avoid autoscroll
26
+ this.editInput.blur();
27
+ // request callback which will close cell after all
28
+ this.saveCallback(e.target.value, isKeyTab);
29
+ }
30
+ }
31
+ // required
32
+ render() {
33
+ var _a;
34
+ return (h("input", { type: "text", value: ((_a = this.editCell) === null || _a === void 0 ? void 0 : _a.val) || '', ref: el => {
35
+ this.editInput = el;
36
+ }, onKeyDown: e => this.onKeyDown(e) }));
37
+ }
38
+ }