@revolist/revogrid 3.2.13 → 3.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-element/_baseIteratee.js +2070 -0
- package/custom-element/columnService.js +743 -0
- package/custom-element/consts.js +46 -0
- package/custom-element/data.store.js +545 -0
- package/custom-element/debounce.js +217 -0
- package/custom-element/dimension.helpers.js +340 -0
- package/custom-element/each.js +180 -0
- package/custom-element/filter.button.js +36 -0
- package/custom-element/identity.js +26 -0
- package/custom-element/index.d.ts +15 -98
- package/custom-element/index.js +15 -29221
- package/custom-element/isSymbol.js +220 -0
- package/custom-element/keys.js +561 -0
- package/custom-element/localScrollService.js +86 -0
- package/custom-element/revo-grid.d.ts +11 -0
- package/custom-element/revo-grid.js +3662 -0
- package/custom-element/revogr-clipboard.d.ts +11 -0
- package/custom-element/revogr-clipboard.js +72 -0
- package/custom-element/revogr-data.d.ts +11 -0
- package/custom-element/revogr-data.js +9 -0
- package/custom-element/revogr-data2.js +171 -0
- package/custom-element/revogr-edit.d.ts +11 -0
- package/custom-element/revogr-edit.js +9 -0
- package/custom-element/revogr-edit2.js +402 -0
- package/custom-element/revogr-filter-panel.d.ts +11 -0
- package/custom-element/revogr-filter-panel.js +308 -0
- package/custom-element/revogr-focus.d.ts +11 -0
- package/custom-element/revogr-focus.js +9 -0
- package/custom-element/revogr-focus2.js +64 -0
- package/custom-element/revogr-header.d.ts +11 -0
- package/custom-element/revogr-header.js +9 -0
- package/custom-element/revogr-header2.js +591 -0
- package/custom-element/revogr-order-editor.d.ts +11 -0
- package/custom-element/revogr-order-editor.js +9 -0
- package/custom-element/revogr-order-editor2.js +190 -0
- package/custom-element/revogr-overlay-selection.d.ts +11 -0
- package/custom-element/revogr-overlay-selection.js +9 -0
- package/custom-element/revogr-overlay-selection2.js +741 -0
- package/custom-element/revogr-row-headers.d.ts +11 -0
- package/custom-element/revogr-row-headers.js +9 -0
- package/custom-element/revogr-row-headers2.js +403 -0
- package/custom-element/revogr-scroll-virtual.d.ts +11 -0
- package/custom-element/revogr-scroll-virtual.js +9 -0
- package/custom-element/revogr-scroll-virtual2.js +135 -0
- package/custom-element/revogr-temp-range.d.ts +11 -0
- package/custom-element/revogr-temp-range.js +9 -0
- package/custom-element/revogr-temp-range2.js +17275 -0
- package/custom-element/revogr-viewport-scroll.d.ts +11 -0
- package/custom-element/revogr-viewport-scroll.js +9 -0
- package/custom-element/revogr-viewport-scroll2.js +367 -0
- package/custom-element/selection.utils.js +106 -0
- package/custom-element/toInteger.js +107 -0
- package/custom-element/toNumber.js +105 -0
- package/custom-element/utils.js +69 -0
- package/package.json +2 -2
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
|
|
5
|
+
import { d as debounce_1 } from './debounce.js';
|
|
6
|
+
import { h as setItems } from './data.store.js';
|
|
7
|
+
import { g as DRAGG_TEXT } from './consts.js';
|
|
8
|
+
import { a as getItemByPosition } from './dimension.helpers.js';
|
|
9
|
+
|
|
10
|
+
class RowOrderService {
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.config = config;
|
|
13
|
+
this.currentCell = null;
|
|
14
|
+
this.previousRow = null;
|
|
15
|
+
}
|
|
16
|
+
/** Drag finished, calculate and apply changes */
|
|
17
|
+
endOrder(e, data) {
|
|
18
|
+
if (this.currentCell === null) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const newRow = this.getCell(e, data);
|
|
22
|
+
// if position changed
|
|
23
|
+
if (newRow.y !== this.currentCell.y) {
|
|
24
|
+
// rgRow dragged out table
|
|
25
|
+
if (newRow.y < 0) {
|
|
26
|
+
newRow.y = 0;
|
|
27
|
+
}
|
|
28
|
+
// rgRow dragged to the top
|
|
29
|
+
else if (newRow.y < this.currentCell.y) {
|
|
30
|
+
newRow.y++;
|
|
31
|
+
}
|
|
32
|
+
this.config.positionChanged(this.currentCell.y, newRow.y);
|
|
33
|
+
}
|
|
34
|
+
this.clear();
|
|
35
|
+
}
|
|
36
|
+
/** Drag started, reserve initial cell for farther use */
|
|
37
|
+
startOrder(e, data) {
|
|
38
|
+
this.currentCell = this.getCell(e, data);
|
|
39
|
+
return this.currentCell;
|
|
40
|
+
}
|
|
41
|
+
move(y, data) {
|
|
42
|
+
const rgRow = this.getRow(y, data);
|
|
43
|
+
// if rgRow same as previous or below range (-1 = 0) do nothing
|
|
44
|
+
if (this.previousRow === rgRow.itemIndex || rgRow.itemIndex < -1) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
this.previousRow = rgRow.itemIndex;
|
|
48
|
+
return rgRow;
|
|
49
|
+
}
|
|
50
|
+
/** Drag stopped, probably cursor outside of document area */
|
|
51
|
+
clear() {
|
|
52
|
+
this.currentCell = null;
|
|
53
|
+
this.previousRow = null;
|
|
54
|
+
}
|
|
55
|
+
/** Calculate cell based on x, y position */
|
|
56
|
+
getRow(y, { el, rows }) {
|
|
57
|
+
const { top } = el.getBoundingClientRect();
|
|
58
|
+
const topRelative = y - top;
|
|
59
|
+
const rgRow = getItemByPosition(rows, topRelative);
|
|
60
|
+
const absolutePosition = {
|
|
61
|
+
itemIndex: rgRow.itemIndex,
|
|
62
|
+
start: rgRow.start + top,
|
|
63
|
+
end: rgRow.end + top,
|
|
64
|
+
};
|
|
65
|
+
return absolutePosition;
|
|
66
|
+
}
|
|
67
|
+
/** Calculate cell based on x, y position */
|
|
68
|
+
getCell({ x, y }, { el, rows, cols }) {
|
|
69
|
+
const { top, left } = el.getBoundingClientRect();
|
|
70
|
+
const topRelative = y - top;
|
|
71
|
+
const leftRelative = x - left;
|
|
72
|
+
const rgRow = getItemByPosition(rows, topRelative);
|
|
73
|
+
const rgCol = getItemByPosition(cols, leftRelative);
|
|
74
|
+
return { x: rgCol.itemIndex, y: rgRow.itemIndex };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const OrderEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
79
|
+
constructor() {
|
|
80
|
+
super();
|
|
81
|
+
this.__registerHost();
|
|
82
|
+
this.internalRowDragStart = createEvent(this, "internalRowDragStart", 7);
|
|
83
|
+
this.internalRowDragEnd = createEvent(this, "internalRowDragEnd", 7);
|
|
84
|
+
this.internalRowDrag = createEvent(this, "internalRowDrag", 7);
|
|
85
|
+
this.internalRowMouseMove = createEvent(this, "internalRowMouseMove", 7);
|
|
86
|
+
this.initialRowDropped = createEvent(this, "initialRowDropped", 7);
|
|
87
|
+
this.rowMoveFunc = debounce_1((y) => {
|
|
88
|
+
const rgRow = this.rowOrderService.move(y, this.getData());
|
|
89
|
+
if (rgRow !== null) {
|
|
90
|
+
this.internalRowDrag.emit(rgRow);
|
|
91
|
+
}
|
|
92
|
+
}, 5);
|
|
93
|
+
}
|
|
94
|
+
// --------------------------------------------------------------------------
|
|
95
|
+
//
|
|
96
|
+
// Listeners
|
|
97
|
+
//
|
|
98
|
+
// --------------------------------------------------------------------------
|
|
99
|
+
onMouseOut() {
|
|
100
|
+
this.clearOrder();
|
|
101
|
+
}
|
|
102
|
+
/** Action finished inside of the document */
|
|
103
|
+
onMouseUp(e) {
|
|
104
|
+
this.endOrder(e);
|
|
105
|
+
}
|
|
106
|
+
// --------------------------------------------------------------------------
|
|
107
|
+
//
|
|
108
|
+
// Methods
|
|
109
|
+
//
|
|
110
|
+
// --------------------------------------------------------------------------
|
|
111
|
+
async dragStart(e) {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
// extra check if previous ended
|
|
114
|
+
if (this.moveFunc) {
|
|
115
|
+
this.clearOrder();
|
|
116
|
+
}
|
|
117
|
+
const data = this.getData();
|
|
118
|
+
const cell = this.rowOrderService.startOrder(e, data);
|
|
119
|
+
const pos = this.rowOrderService.getRow(e.y, data);
|
|
120
|
+
const dragStartEvent = this.internalRowDragStart.emit({ cell, text: DRAGG_TEXT, pos, event: e });
|
|
121
|
+
if (dragStartEvent.defaultPrevented) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.moveFunc = (e) => this.move(e);
|
|
125
|
+
document.addEventListener('mousemove', this.moveFunc);
|
|
126
|
+
}
|
|
127
|
+
async endOrder(e) {
|
|
128
|
+
this.rowOrderService.endOrder(e, this.getData());
|
|
129
|
+
this.clearOrder();
|
|
130
|
+
}
|
|
131
|
+
async clearOrder() {
|
|
132
|
+
this.rowOrderService.clear();
|
|
133
|
+
document.removeEventListener('mousemove', this.moveFunc);
|
|
134
|
+
this.moveFunc = null;
|
|
135
|
+
this.internalRowDragEnd.emit();
|
|
136
|
+
}
|
|
137
|
+
// --------------------------------------------------------------------------
|
|
138
|
+
//
|
|
139
|
+
// Component methods
|
|
140
|
+
//
|
|
141
|
+
// --------------------------------------------------------------------------
|
|
142
|
+
move({ x, y }) {
|
|
143
|
+
this.internalRowMouseMove.emit({ x, y });
|
|
144
|
+
this.rowMoveFunc(y);
|
|
145
|
+
}
|
|
146
|
+
connectedCallback() {
|
|
147
|
+
this.rowOrderService = new RowOrderService({ positionChanged: (f, t) => this.onPositionChanged(f, t) });
|
|
148
|
+
}
|
|
149
|
+
onPositionChanged(from, to) {
|
|
150
|
+
const dropEvent = this.initialRowDropped.emit({ from, to });
|
|
151
|
+
if (dropEvent.defaultPrevented) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const items = [...this.dataStore.get('items')];
|
|
155
|
+
const toMove = items.splice(from, 1);
|
|
156
|
+
items.splice(to, 0, ...toMove);
|
|
157
|
+
setItems(this.dataStore, items);
|
|
158
|
+
}
|
|
159
|
+
getData() {
|
|
160
|
+
return {
|
|
161
|
+
el: this.parent,
|
|
162
|
+
rows: this.dimensionRow.state,
|
|
163
|
+
cols: this.dimensionCol.state,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}, [0, "revogr-order-editor", {
|
|
167
|
+
"parent": [16],
|
|
168
|
+
"dimensionRow": [16],
|
|
169
|
+
"dimensionCol": [16],
|
|
170
|
+
"dataStore": [16],
|
|
171
|
+
"dragStart": [64],
|
|
172
|
+
"endOrder": [64],
|
|
173
|
+
"clearOrder": [64]
|
|
174
|
+
}, [[5, "mouseleave", "onMouseOut"], [5, "mouseup", "onMouseUp"]]]);
|
|
175
|
+
function defineCustomElement() {
|
|
176
|
+
if (typeof customElements === "undefined") {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const components = ["revogr-order-editor"];
|
|
180
|
+
components.forEach(tagName => { switch (tagName) {
|
|
181
|
+
case "revogr-order-editor":
|
|
182
|
+
if (!customElements.get(tagName)) {
|
|
183
|
+
customElements.define(tagName, OrderEditor);
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
186
|
+
} });
|
|
187
|
+
}
|
|
188
|
+
defineCustomElement();
|
|
189
|
+
|
|
190
|
+
export { OrderEditor as O, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface RevogrOverlaySelection extends Components.RevogrOverlaySelection, HTMLElement {}
|
|
4
|
+
export const RevogrOverlaySelection: {
|
|
5
|
+
prototype: RevogrOverlaySelection;
|
|
6
|
+
new (): RevogrOverlaySelection;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { O as OverlaySelection, d as defineCustomElement$1 } from './revogr-overlay-selection2.js';
|
|
5
|
+
|
|
6
|
+
const RevogrOverlaySelection = OverlaySelection;
|
|
7
|
+
const defineCustomElement = defineCustomElement$1;
|
|
8
|
+
|
|
9
|
+
export { RevogrOverlaySelection, defineCustomElement };
|