@revolist/revogrid 3.1.6 → 3.2.4

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