@revolist/revogrid 4.9.9 → 4.9.11
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/dist/cjs/column.drag.plugin-e636b5af.js +1686 -0
- package/dist/cjs/column.drag.plugin-e636b5af.js.map +1 -0
- package/dist/cjs/{column.service-bfaba0e0.js → column.service-15c8352d.js} +443 -56
- package/dist/cjs/column.service-15c8352d.js.map +1 -0
- package/dist/cjs/{toNumber-838e6ff5.js → debounce-cb5f4e35.js} +229 -12
- package/dist/cjs/debounce-cb5f4e35.js.map +1 -0
- package/dist/cjs/{edit.utils-983f1a82.js → edit.utils-1172677c.js} +2 -2
- package/dist/cjs/{edit.utils-983f1a82.js.map → edit.utils-1172677c.js.map} +1 -1
- package/dist/cjs/{header-cell-renderer-53e4fd75.js → header-cell-renderer-375a879f.js} +42 -4
- package/dist/cjs/header-cell-renderer-375a879f.js.map +1 -0
- package/dist/cjs/{index-464d1aaf.js → index-28b6fdfb.js} +31 -31
- package/dist/cjs/{index-464d1aaf.js.map → index-28b6fdfb.js.map} +1 -1
- package/dist/cjs/index.cjs.js +39 -28
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{key.utils-12715159.js → key.utils-c62ab1e1.js} +2 -12
- package/dist/cjs/key.utils-c62ab1e1.js.map +1 -0
- package/dist/cjs/revo-grid.cjs.entry.js +704 -2034
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-attribution_6.cjs.entry.js +17 -18
- package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +6 -77
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +117 -123
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +1 -2
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/{row-header-utils-e71dc7bf.js → row-header-utils-22ffee54.js} +2 -2
- package/dist/cjs/{row-header-utils-e71dc7bf.js.map → row-header-utils-22ffee54.js.map} +1 -1
- package/dist/cjs/sorting.sign-8bf92449.js +19 -0
- package/dist/cjs/sorting.sign-8bf92449.js.map +1 -0
- package/dist/cjs/text-editor-91a9f5b5.js +82 -0
- package/dist/cjs/text-editor-91a9f5b5.js.map +1 -0
- package/dist/cjs/{throttle-c893457e.js → throttle-5da5df51.js} +4 -5
- package/dist/cjs/throttle-5da5df51.js.map +1 -0
- package/dist/cjs/viewport.helpers-e59a544e.js +58 -0
- package/dist/cjs/viewport.helpers-e59a544e.js.map +1 -0
- package/dist/collection/components/editors/text-editor.js.map +1 -1
- package/dist/collection/components/header/revogr-header.js +1 -1
- package/dist/collection/components/overlay/keyboard.service.js +2 -2
- package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid-style.css +6 -0
- package/dist/collection/index.js +2 -2
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/plugins/index.js +16 -0
- package/dist/collection/plugins/index.js.map +1 -0
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -1
- package/dist/collection/types/selection.js.map +1 -1
- package/dist/collection/utils/key.utils.js +0 -9
- package/dist/collection/utils/key.utils.js.map +1 -1
- package/dist/esm/column.drag.plugin-30dc4e24.js +1665 -0
- package/dist/esm/column.drag.plugin-30dc4e24.js.map +1 -0
- package/dist/esm/{column.service-6f1faf2d.js → column.service-414e9cba.js} +435 -51
- package/dist/esm/column.service-414e9cba.js.map +1 -0
- package/dist/esm/{toNumber-8de324a7.js → debounce-e8e9464a.js} +229 -13
- package/dist/esm/debounce-e8e9464a.js.map +1 -0
- package/dist/esm/{edit.utils-c3f5c9f4.js → edit.utils-0666e5bd.js} +2 -2
- package/dist/esm/{edit.utils-c3f5c9f4.js.map → edit.utils-0666e5bd.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-66d01daa.js → header-cell-renderer-ca570fcf.js} +40 -4
- package/dist/esm/header-cell-renderer-ca570fcf.js.map +1 -0
- package/dist/esm/{index-c428acf6.js → index-74b9801b.js} +3 -3
- package/dist/esm/{index-c428acf6.js.map → index-74b9801b.js.map} +1 -1
- package/dist/esm/index.js +10 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{key.utils-b1f93f7e.js → key.utils-d3df5db8.js} +3 -12
- package/dist/esm/key.utils-d3df5db8.js.map +1 -0
- package/dist/esm/revo-grid.entry.js +675 -2005
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revogr-attribution_6.entry.js +9 -10
- package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
- package/dist/esm/revogr-clipboard_3.entry.js +5 -76
- package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +50 -56
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +1 -2
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{row-header-utils-3a6f6adc.js → row-header-utils-c7e3e2d5.js} +2 -2
- package/dist/esm/{row-header-utils-3a6f6adc.js.map → row-header-utils-c7e3e2d5.js.map} +1 -1
- package/dist/esm/sorting.sign-1afddea1.js +15 -0
- package/dist/esm/sorting.sign-1afddea1.js.map +1 -0
- package/dist/esm/text-editor-96d69516.js +80 -0
- package/dist/esm/text-editor-96d69516.js.map +1 -0
- package/dist/esm/{throttle-f9cda5b0.js → throttle-262c3ed2.js} +3 -4
- package/dist/esm/throttle-262c3ed2.js.map +1 -0
- package/dist/esm/viewport.helpers-7e7f9dad.js +52 -0
- package/dist/esm/viewport.helpers-7e7f9dad.js.map +1 -0
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js +5 -0
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js.map +1 -0
- package/dist/revo-grid/column.service-414e9cba.js +5 -0
- package/dist/revo-grid/column.service-414e9cba.js.map +1 -0
- package/dist/revo-grid/debounce-e8e9464a.js +5 -0
- package/dist/revo-grid/debounce-e8e9464a.js.map +1 -0
- package/dist/revo-grid/{edit.utils-c3f5c9f4.js → edit.utils-0666e5bd.js} +2 -2
- package/dist/revo-grid/header-cell-renderer-ca570fcf.js +5 -0
- package/dist/revo-grid/header-cell-renderer-ca570fcf.js.map +1 -0
- package/dist/revo-grid/{index-c428acf6.js → index-74b9801b.js} +2 -2
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/key.utils-d3df5db8.js +5 -0
- package/dist/revo-grid/key.utils-d3df5db8.js.map +1 -0
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/{row-header-utils-3a6f6adc.js → row-header-utils-c7e3e2d5.js} +2 -2
- package/dist/revo-grid/sorting.sign-1afddea1.js +5 -0
- package/dist/revo-grid/sorting.sign-1afddea1.js.map +1 -0
- package/dist/revo-grid/text-editor-96d69516.js +5 -0
- package/dist/revo-grid/text-editor-96d69516.js.map +1 -0
- package/dist/revo-grid/throttle-262c3ed2.js +5 -0
- package/dist/revo-grid/{throttle-f9cda5b0.js.map → throttle-262c3ed2.js.map} +1 -1
- package/dist/revo-grid/viewport.helpers-7e7f9dad.js +5 -0
- package/dist/revo-grid/viewport.helpers-7e7f9dad.js.map +1 -0
- package/dist/types/components/editors/text-editor.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugins/index.d.ts +12 -0
- package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +1 -13
- package/dist/types/types/selection.d.ts +1 -1
- package/dist/types/utils/key.utils.d.ts +0 -1
- package/hydrate/index.js +2 -11
- package/hydrate/index.mjs +2 -11
- package/package.json +1 -1
- package/standalone/_stringToPath.js +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +2 -2
- package/standalone/debounce.js +1 -1
- package/standalone/dimension.helpers.js +1 -1
- package/standalone/index.js +7 -5
- package/standalone/index.js.map +1 -1
- package/standalone/isObjectLike.js +1 -1
- package/standalone/revo-grid.js +1948 -1948
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-edit.js +1 -1
- package/standalone/revogr-edit2.js +1 -10
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-header.js +1 -1
- package/standalone/revogr-header2.js +54 -52
- package/standalone/revogr-header2.js.map +1 -1
- package/standalone/revogr-overlay-selection2.js +2 -2
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/throttle.js +1 -1
- package/standalone/toNumber.js +1 -1
- package/dist/cjs/column.service-bfaba0e0.js.map +0 -1
- package/dist/cjs/column.utils-4a450d27.js +0 -345
- package/dist/cjs/column.utils-4a450d27.js.map +0 -1
- package/dist/cjs/debounce-e2b7c6fb.js +0 -226
- package/dist/cjs/debounce-e2b7c6fb.js.map +0 -1
- package/dist/cjs/dispatcher-998aa470.js +0 -46
- package/dist/cjs/dispatcher-998aa470.js.map +0 -1
- package/dist/cjs/header-cell-renderer-53e4fd75.js.map +0 -1
- package/dist/cjs/key.utils-12715159.js.map +0 -1
- package/dist/cjs/selection.helpers-2c90d546.js +0 -450
- package/dist/cjs/selection.helpers-2c90d546.js.map +0 -1
- package/dist/cjs/throttle-c893457e.js.map +0 -1
- package/dist/cjs/toNumber-838e6ff5.js.map +0 -1
- package/dist/esm/column.service-6f1faf2d.js.map +0 -1
- package/dist/esm/column.utils-1a402ff9.js +0 -333
- package/dist/esm/column.utils-1a402ff9.js.map +0 -1
- package/dist/esm/debounce-7781346d.js +0 -224
- package/dist/esm/debounce-7781346d.js.map +0 -1
- package/dist/esm/dispatcher-ea08404f.js +0 -43
- package/dist/esm/dispatcher-ea08404f.js.map +0 -1
- package/dist/esm/header-cell-renderer-66d01daa.js.map +0 -1
- package/dist/esm/key.utils-b1f93f7e.js.map +0 -1
- package/dist/esm/selection.helpers-ac4368b0.js +0 -441
- package/dist/esm/selection.helpers-ac4368b0.js.map +0 -1
- package/dist/esm/throttle-f9cda5b0.js.map +0 -1
- package/dist/esm/toNumber-8de324a7.js.map +0 -1
- package/dist/revo-grid/column.service-6f1faf2d.js +0 -5
- package/dist/revo-grid/column.service-6f1faf2d.js.map +0 -1
- package/dist/revo-grid/column.utils-1a402ff9.js +0 -5
- package/dist/revo-grid/column.utils-1a402ff9.js.map +0 -1
- package/dist/revo-grid/debounce-7781346d.js +0 -5
- package/dist/revo-grid/debounce-7781346d.js.map +0 -1
- package/dist/revo-grid/dispatcher-ea08404f.js +0 -5
- package/dist/revo-grid/dispatcher-ea08404f.js.map +0 -1
- package/dist/revo-grid/header-cell-renderer-66d01daa.js +0 -5
- package/dist/revo-grid/header-cell-renderer-66d01daa.js.map +0 -1
- package/dist/revo-grid/key.utils-b1f93f7e.js +0 -5
- package/dist/revo-grid/key.utils-b1f93f7e.js.map +0 -1
- package/dist/revo-grid/selection.helpers-ac4368b0.js +0 -5
- package/dist/revo-grid/selection.helpers-ac4368b0.js.map +0 -1
- package/dist/revo-grid/throttle-f9cda5b0.js +0 -5
- package/dist/revo-grid/toNumber-8de324a7.js +0 -5
- package/dist/revo-grid/toNumber-8de324a7.js.map +0 -1
- /package/dist/revo-grid/{edit.utils-c3f5c9f4.js.map → edit.utils-0666e5bd.js.map} +0 -0
- /package/dist/revo-grid/{index-c428acf6.js.map → index-74b9801b.js.map} +0 -0
- /package/dist/revo-grid/{row-header-utils-3a6f6adc.js.map → row-header-utils-c7e3e2d5.js.map} +0 -0
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Built by Revolist OU ❤️
|
|
3
|
-
*/
|
|
4
|
-
import { V as createStore, v as setStore } from './index-c428acf6.js';
|
|
5
|
-
import './toNumber-8de324a7.js';
|
|
6
|
-
import './index-a61f225b.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Selection store
|
|
10
|
-
*/
|
|
11
|
-
function defaultState() {
|
|
12
|
-
return {
|
|
13
|
-
range: null,
|
|
14
|
-
tempRange: null,
|
|
15
|
-
tempRangeType: null,
|
|
16
|
-
focus: null,
|
|
17
|
-
edit: null,
|
|
18
|
-
lastCell: null,
|
|
19
|
-
nextFocus: null,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
class SelectionStore {
|
|
23
|
-
constructor() {
|
|
24
|
-
this.unsubscribe = [];
|
|
25
|
-
this.store = createStore(defaultState());
|
|
26
|
-
this.store.on('set', (key, newVal) => {
|
|
27
|
-
if (key === 'tempRange' && !newVal) {
|
|
28
|
-
this.store.set('tempRangeType', null);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
onChange(propName, cb) {
|
|
33
|
-
this.unsubscribe.push(this.store.onChange(propName, cb));
|
|
34
|
-
}
|
|
35
|
-
clearFocus() {
|
|
36
|
-
setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });
|
|
37
|
-
}
|
|
38
|
-
setFocus(focus, end) {
|
|
39
|
-
if (!end) {
|
|
40
|
-
setStore(this.store, { focus });
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
setStore(this.store, {
|
|
44
|
-
focus,
|
|
45
|
-
range: getRange(focus, end),
|
|
46
|
-
edit: null,
|
|
47
|
-
tempRange: null,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
setNextFocus(focus) {
|
|
52
|
-
setStore(this.store, { nextFocus: focus });
|
|
53
|
-
}
|
|
54
|
-
setTempArea(range) {
|
|
55
|
-
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 });
|
|
56
|
-
}
|
|
57
|
-
clearTemp() {
|
|
58
|
-
setStore(this.store, { tempRange: null });
|
|
59
|
-
}
|
|
60
|
-
/** Can be applied from selection change or from simple keyboard change clicks */
|
|
61
|
-
setRangeArea(range) {
|
|
62
|
-
setStore(this.store, { range, edit: null, tempRange: null });
|
|
63
|
-
}
|
|
64
|
-
setRange(start, end) {
|
|
65
|
-
const range = getRange(start, end);
|
|
66
|
-
this.setRangeArea(range);
|
|
67
|
-
}
|
|
68
|
-
setLastCell(lastCell) {
|
|
69
|
-
setStore(this.store, { lastCell });
|
|
70
|
-
}
|
|
71
|
-
setEdit(val) {
|
|
72
|
-
const focus = this.store.get('focus');
|
|
73
|
-
if (focus && typeof val === 'string') {
|
|
74
|
-
setStore(this.store, {
|
|
75
|
-
edit: { x: focus.x, y: focus.y, val },
|
|
76
|
-
});
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
setStore(this.store, { edit: null });
|
|
80
|
-
}
|
|
81
|
-
dispose() {
|
|
82
|
-
this.unsubscribe.forEach(f => f());
|
|
83
|
-
this.store.dispose();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const EMPTY_INDEX = -1;
|
|
88
|
-
class SelectionStoreConnector {
|
|
89
|
-
constructor() {
|
|
90
|
-
// dirty flag required to cleanup whole store in case visibility of panels changed
|
|
91
|
-
this.dirty = false;
|
|
92
|
-
this.stores = {};
|
|
93
|
-
this.columnStores = {};
|
|
94
|
-
this.rowStores = {};
|
|
95
|
-
/**
|
|
96
|
-
* Helpers for data conversion
|
|
97
|
-
*/
|
|
98
|
-
this.storesByType = {};
|
|
99
|
-
this.storesXToType = {};
|
|
100
|
-
this.storesYToType = {};
|
|
101
|
-
this.sections = [];
|
|
102
|
-
}
|
|
103
|
-
get focusedStore() {
|
|
104
|
-
var _a;
|
|
105
|
-
for (let y in this.stores) {
|
|
106
|
-
for (let x in this.stores[y]) {
|
|
107
|
-
const focused = (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.store.get('focus');
|
|
108
|
-
if (focused) {
|
|
109
|
-
return {
|
|
110
|
-
entity: this.stores[y][x],
|
|
111
|
-
cell: focused,
|
|
112
|
-
position: {
|
|
113
|
-
x: parseInt(x, 10),
|
|
114
|
-
y: parseInt(y, 10),
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
get edit() {
|
|
123
|
-
var _a;
|
|
124
|
-
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('edit');
|
|
125
|
-
}
|
|
126
|
-
get focused() {
|
|
127
|
-
var _a;
|
|
128
|
-
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('focus');
|
|
129
|
-
}
|
|
130
|
-
get selectedRange() {
|
|
131
|
-
var _a;
|
|
132
|
-
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
|
|
133
|
-
}
|
|
134
|
-
registerSection(e) {
|
|
135
|
-
if (!e) {
|
|
136
|
-
this.sections.length = 0;
|
|
137
|
-
// some elements removed, rebuild stores
|
|
138
|
-
this.dirty = true;
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (this.sections.indexOf(e) === -1) {
|
|
142
|
-
this.sections.push(e);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
// check if require to cleanup all stores
|
|
146
|
-
beforeUpdate() {
|
|
147
|
-
if (this.dirty) {
|
|
148
|
-
for (let y in this.stores) {
|
|
149
|
-
for (let x in this.stores[y]) {
|
|
150
|
-
this.stores[y][x].dispose();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
this.dirty = false;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
registerColumn(x, type) {
|
|
157
|
-
// if hidden just create store but no operations needed
|
|
158
|
-
if (isHiddenStore(x)) {
|
|
159
|
-
return new SelectionStore();
|
|
160
|
-
}
|
|
161
|
-
if (this.columnStores[x]) {
|
|
162
|
-
return this.columnStores[x];
|
|
163
|
-
}
|
|
164
|
-
this.columnStores[x] = new SelectionStore();
|
|
165
|
-
// build cross-linking type to position
|
|
166
|
-
this.storesByType[type] = x;
|
|
167
|
-
this.storesXToType[x] = type;
|
|
168
|
-
return this.columnStores[x];
|
|
169
|
-
}
|
|
170
|
-
registerRow(y, type) {
|
|
171
|
-
// if hidden just create store
|
|
172
|
-
if (isHiddenStore(y)) {
|
|
173
|
-
return new SelectionStore();
|
|
174
|
-
}
|
|
175
|
-
if (this.rowStores[y]) {
|
|
176
|
-
return this.rowStores[y];
|
|
177
|
-
}
|
|
178
|
-
this.rowStores[y] = new SelectionStore();
|
|
179
|
-
// build cross linking type to position
|
|
180
|
-
this.storesByType[type] = y;
|
|
181
|
-
this.storesYToType[y] = type;
|
|
182
|
-
return this.rowStores[y];
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Cross store proxy, based on multiple dimensions
|
|
186
|
-
*/
|
|
187
|
-
register({ x, y }) {
|
|
188
|
-
var _a, _b;
|
|
189
|
-
// if hidden just create store
|
|
190
|
-
if (isHiddenStore(x) || isHiddenStore(y)) {
|
|
191
|
-
return new SelectionStore();
|
|
192
|
-
}
|
|
193
|
-
if (!this.stores[y]) {
|
|
194
|
-
this.stores[y] = {};
|
|
195
|
-
}
|
|
196
|
-
if (this.stores[y][x]) {
|
|
197
|
-
// Store already registered. Do not register twice
|
|
198
|
-
return this.stores[y][x];
|
|
199
|
-
}
|
|
200
|
-
this.stores[y][x] = new SelectionStore();
|
|
201
|
-
// proxy update, column store trigger only range area
|
|
202
|
-
(_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.onChange('range', c => {
|
|
203
|
-
this.columnStores[x].setRangeArea(c);
|
|
204
|
-
this.rowStores[y].setRangeArea(c);
|
|
205
|
-
});
|
|
206
|
-
// clean up on remove
|
|
207
|
-
(_b = this.stores[y][x]) === null || _b === void 0 ? void 0 : _b.store.on('dispose', () => this.destroy(x, y));
|
|
208
|
-
return this.stores[y][x];
|
|
209
|
-
}
|
|
210
|
-
destroy(x, y) {
|
|
211
|
-
var _a, _b;
|
|
212
|
-
(_a = this.columnStores[x]) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
213
|
-
(_b = this.rowStores[y]) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
214
|
-
delete this.rowStores[y];
|
|
215
|
-
delete this.columnStores[x];
|
|
216
|
-
// clear x cross-link
|
|
217
|
-
if (this.storesXToType[x]) {
|
|
218
|
-
const type = this.storesXToType[x];
|
|
219
|
-
delete this.storesXToType[x];
|
|
220
|
-
delete this.storesByType[type];
|
|
221
|
-
}
|
|
222
|
-
// clear y cross-link
|
|
223
|
-
if (this.storesYToType[y]) {
|
|
224
|
-
const type = this.storesYToType[y];
|
|
225
|
-
delete this.storesYToType[y];
|
|
226
|
-
delete this.storesByType[type];
|
|
227
|
-
}
|
|
228
|
-
if (this.stores[y]) {
|
|
229
|
-
delete this.stores[y][x];
|
|
230
|
-
}
|
|
231
|
-
// clear empty rows
|
|
232
|
-
if (!Object.keys(this.stores[y] || {}).length) {
|
|
233
|
-
delete this.stores[y];
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
setEditByCell(storePos, editCell) {
|
|
237
|
-
this.focusByCell(storePos, editCell, editCell);
|
|
238
|
-
this.setEdit('');
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Sets the next focus cell before the current one.
|
|
242
|
-
*
|
|
243
|
-
* @param focus - The cell to set as the next focus.
|
|
244
|
-
*/
|
|
245
|
-
beforeNextFocusCell(focus) {
|
|
246
|
-
var _a;
|
|
247
|
-
// If there is no focused store, return early.
|
|
248
|
-
if (!this.focusedStore) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
// Get the next store based on the current focus and the last cell.
|
|
252
|
-
const lastCell = this.focusedStore.entity.store.get('lastCell');
|
|
253
|
-
const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);
|
|
254
|
-
// Set the next focus cell in the store.
|
|
255
|
-
(_a = next === null || next === void 0 ? void 0 : next.store) === null || _a === void 0 ? void 0 : _a.setNextFocus(Object.assign(Object.assign({}, focus), next.item));
|
|
256
|
-
}
|
|
257
|
-
focusByCell(storePos, start, end) {
|
|
258
|
-
const store = this.stores[storePos.y][storePos.x];
|
|
259
|
-
this.focus(store, { focus: start, end });
|
|
260
|
-
}
|
|
261
|
-
focus(store, { focus, end }) {
|
|
262
|
-
const currentStorePointer = this.getCurrentStorePointer(store);
|
|
263
|
-
if (!currentStorePointer) {
|
|
264
|
-
return null;
|
|
265
|
-
}
|
|
266
|
-
// check for the focus in nearby store/viewport
|
|
267
|
-
const lastCell = store.store.get('lastCell');
|
|
268
|
-
const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);
|
|
269
|
-
// if next store present - update
|
|
270
|
-
if (next === null || next === void 0 ? void 0 : next.store) {
|
|
271
|
-
const item = Object.assign(Object.assign({}, focus), next.item);
|
|
272
|
-
this.focus(next.store, { focus: item, end: item });
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
275
|
-
if (lastCell) {
|
|
276
|
-
focus = cropCellToMax(focus, lastCell);
|
|
277
|
-
end = cropCellToMax(end, lastCell);
|
|
278
|
-
}
|
|
279
|
-
store.setFocus(focus, end);
|
|
280
|
-
return focus;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Retrieves the current store pointer based on the active store.
|
|
284
|
-
* Clears focus from all stores except the active one.
|
|
285
|
-
*/
|
|
286
|
-
getCurrentStorePointer(store) {
|
|
287
|
-
let currentStorePointer;
|
|
288
|
-
// Iterate through all stores
|
|
289
|
-
for (let y in this.stores) {
|
|
290
|
-
for (let x in this.stores[y]) {
|
|
291
|
-
const s = this.stores[y][x];
|
|
292
|
-
// Clear focus from stores other than the active one
|
|
293
|
-
if (s !== store) {
|
|
294
|
-
s.clearFocus();
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
// Update the current store pointer with the active store coordinates
|
|
298
|
-
currentStorePointer = {
|
|
299
|
-
x: parseInt(x, 10),
|
|
300
|
-
y: parseInt(y, 10)
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return currentStorePointer;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Retrieves the next store based on the focus cell and current store pointer.
|
|
309
|
-
* If the next store exists, returns an object with the next store and the item in the new store.
|
|
310
|
-
* If the next store does not exist, returns null.
|
|
311
|
-
*/
|
|
312
|
-
getNextStore(focus, currentStorePointer, lastCell) {
|
|
313
|
-
// item in new store
|
|
314
|
-
const nextItem = nextCell(focus, lastCell);
|
|
315
|
-
let nextStore;
|
|
316
|
-
if (nextItem) {
|
|
317
|
-
Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
|
|
318
|
-
let stores;
|
|
319
|
-
switch (type) {
|
|
320
|
-
case 'x':
|
|
321
|
-
// Get the X stores for the current Y coordinate of the current store pointer
|
|
322
|
-
stores = this.getXStores(currentStorePointer.y);
|
|
323
|
-
break;
|
|
324
|
-
case 'y':
|
|
325
|
-
// Get the Y stores for the current X coordinate of the current store pointer
|
|
326
|
-
stores = this.getYStores(currentStorePointer.x);
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
// Get the next store based on the item in the new store
|
|
330
|
-
if (nextItemCoord >= 0) {
|
|
331
|
-
nextStore = stores[++currentStorePointer[type]];
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
334
|
-
nextStore = stores[--currentStorePointer[type]];
|
|
335
|
-
const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
|
|
336
|
-
if (nextLastCell) {
|
|
337
|
-
nextItem[type] = nextLastCell[type] + nextItemCoord;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
return {
|
|
343
|
-
store: nextStore,
|
|
344
|
-
item: nextItem,
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
clearAll() {
|
|
348
|
-
var _a;
|
|
349
|
-
for (let y in this.stores) {
|
|
350
|
-
for (let x in this.stores[y]) {
|
|
351
|
-
(_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
setEdit(val) {
|
|
356
|
-
if (!this.focusedStore) {
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
this.focusedStore.entity.setEdit(val);
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Select all cells across all stores
|
|
363
|
-
*/
|
|
364
|
-
selectAll() {
|
|
365
|
-
for (let y in this.stores) {
|
|
366
|
-
for (let x in this.stores[y]) {
|
|
367
|
-
const store = this.stores[y][x];
|
|
368
|
-
if (!store) {
|
|
369
|
-
continue;
|
|
370
|
-
}
|
|
371
|
-
const lastCell = store.store.get('lastCell');
|
|
372
|
-
if (lastCell) {
|
|
373
|
-
store.setRange({ x: 0, y: 0 }, { x: lastCell.x - 1, y: lastCell.y - 1 });
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
getXStores(y) {
|
|
379
|
-
return this.stores[y];
|
|
380
|
-
}
|
|
381
|
-
getYStores(x) {
|
|
382
|
-
const stores = {};
|
|
383
|
-
for (let i in this.stores) {
|
|
384
|
-
stores[i] = this.stores[i][x];
|
|
385
|
-
}
|
|
386
|
-
return stores;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
function isHiddenStore(pos) {
|
|
391
|
-
return pos === EMPTY_INDEX;
|
|
392
|
-
}
|
|
393
|
-
function nextCell(cell, lastCell) {
|
|
394
|
-
const nextItem = {};
|
|
395
|
-
let types = ['x', 'y'];
|
|
396
|
-
// previous item check
|
|
397
|
-
for (let t of types) {
|
|
398
|
-
if (cell[t] < 0) {
|
|
399
|
-
nextItem[t] = cell[t];
|
|
400
|
-
return nextItem;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
// next item check
|
|
404
|
-
for (let t of types) {
|
|
405
|
-
if (cell[t] >= lastCell[t]) {
|
|
406
|
-
nextItem[t] = cell[t] - lastCell[t];
|
|
407
|
-
return nextItem;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
return null;
|
|
411
|
-
}
|
|
412
|
-
function cropCellToMax(cell, lastCell) {
|
|
413
|
-
const croppedCell = Object.assign({}, cell);
|
|
414
|
-
const cellCoordinates = ['x', 'y'];
|
|
415
|
-
for (const coordinate of cellCoordinates) {
|
|
416
|
-
if (cell[coordinate] < 0) {
|
|
417
|
-
croppedCell[coordinate] = 0;
|
|
418
|
-
}
|
|
419
|
-
else if (cell[coordinate] >= lastCell[coordinate]) {
|
|
420
|
-
croppedCell[coordinate] = lastCell[coordinate] - 1;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return croppedCell;
|
|
424
|
-
}
|
|
425
|
-
function getRange(start, end) {
|
|
426
|
-
return start && end
|
|
427
|
-
? {
|
|
428
|
-
x: Math.min(start.x, end.x),
|
|
429
|
-
y: Math.min(start.y, end.y),
|
|
430
|
-
x1: Math.max(start.x, end.x),
|
|
431
|
-
y1: Math.max(start.y, end.y),
|
|
432
|
-
}
|
|
433
|
-
: null;
|
|
434
|
-
}
|
|
435
|
-
function isRangeSingleCell(a) {
|
|
436
|
-
return a.x === a.x1 && a.y === a.y1;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
export { EMPTY_INDEX as E, SelectionStore as S, isRangeSingleCell as a, SelectionStoreConnector as b, cropCellToMax as c, getRange as g, isHiddenStore as i, n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,EAAE,GAAG,CAAC,CAAC;IAEnD,KAAK,MAAM,UAAU,IAAI,eAAe,EAAE;QACxC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACxB,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SAC7B;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,EAAE;YACnD,WAAW,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SACpD;KACF;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;SAEe,QAAQ,CAAC,KAAmB,EAAE,GAAiB;IAC7D,OAAO,KAAK,IAAI,GAAG;UACf;YACE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3B,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3B,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC5B,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;SAC7B;UACD,IAAI,CAAC;AACX,CAAC;SAEe,iBAAiB,CAAC,CAAY;IAC5C,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AACtC;;;;","names":[],"sources":["src/store/selection/selection.store.ts","src/services/selection.store.connector.ts","src/store/selection/selection.helpers.ts"],"sourcesContent":["/**\n * Selection store\n */\n\nimport { setStore, Observable } from '../../utils/store.utils';\nimport { getRange } from '@store';\nimport { SelectionStoreState, Cell, TempRange, RangeArea, Nullable } from '@type';\nimport { createStore } from '@stencil/store';\n\nfunction defaultState(): SelectionStoreState {\n return {\n range: null,\n tempRange: null,\n tempRangeType: null,\n focus: null,\n edit: null,\n lastCell: null,\n nextFocus: null,\n };\n}\n\nexport class SelectionStore {\n readonly store: Observable<SelectionStoreState>;\n private unsubscribe: { (): void }[] = [];\n constructor() {\n this.store = createStore(defaultState());\n this.store.on('set', (key, newVal) => {\n if (key === 'tempRange' && !newVal) {\n this.store.set('tempRangeType', null);\n }\n });\n }\n\n onChange<Key extends keyof SelectionStoreState>(propName: Key, cb: (newValue: SelectionStoreState[Key]) => void) {\n this.unsubscribe.push(this.store.onChange(propName, cb));\n }\n\n clearFocus() {\n setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });\n }\n\n setFocus(focus: Cell, end?: Cell) {\n if (!end) {\n setStore(this.store, { focus });\n } else {\n setStore(this.store, {\n focus,\n range: getRange(focus, end),\n edit: null,\n tempRange: null,\n });\n }\n }\n\n setNextFocus(focus: Cell) {\n setStore(this.store, { nextFocus: focus });\n }\n\n setTempArea(range: Nullable<TempRange> | null) {\n setStore(this.store, { tempRange: range?.area, tempRangeType: range?.type, edit: null });\n }\n\n clearTemp() {\n setStore(this.store, { tempRange: null });\n }\n\n /** Can be applied from selection change or from simple keyboard change clicks */\n setRangeArea(range: RangeArea | null) {\n setStore(this.store, { range, edit: null, tempRange: null });\n }\n setRange(start: Cell, end: Cell) {\n const range = getRange(start, end);\n this.setRangeArea(range);\n }\n\n setLastCell(lastCell: Cell) {\n setStore(this.store, { lastCell });\n }\n\n setEdit(val?: string | boolean) {\n const focus = this.store.get('focus');\n if (focus && typeof val === 'string') {\n setStore(this.store, {\n edit: { x: focus.x, y: focus.y, val },\n });\n return;\n }\n setStore(this.store, { edit: null });\n }\n\n dispose() {\n this.unsubscribe.forEach(f => f());\n this.store.dispose();\n }\n}\n","import { cropCellToMax, isHiddenStore, nextCell, SelectionStore } from '@store';\nimport type {\n MultiDimensionType,\n DimensionCols,\n DimensionRows,\n Cell,\n} from '@type';\n\ntype StoreByDimension = Record<number, SelectionStore>;\ntype FocusedStore = {\n entity: SelectionStore;\n cell: Cell;\n position: Cell;\n};\n\ntype StoresMapping<T> = { [xOrY: number]: Partial<T> };\n\nexport const EMPTY_INDEX = -1;\n\nexport default class SelectionStoreConnector {\n // dirty flag required to cleanup whole store in case visibility of panels changed\n private dirty = false;\n readonly stores: { [y: number]: { [x: number]: SelectionStore } } = {};\n\n readonly columnStores: StoreByDimension = {};\n readonly rowStores: { [y: number]: SelectionStore } = {};\n\n /**\n * Helpers for data conversion\n */\n readonly storesByType: Partial<Record<MultiDimensionType, number>> = {};\n readonly storesXToType: StoresMapping<DimensionCols> = {};\n readonly storesYToType: StoresMapping<DimensionRows> = {};\n\n get focusedStore(): FocusedStore | null {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const focused = this.stores[y][x]?.store.get('focus');\n if (focused) {\n return {\n entity: this.stores[y][x],\n cell: focused,\n position: {\n x: parseInt(x, 10),\n y: parseInt(y, 10),\n },\n };\n }\n }\n }\n return null;\n }\n\n get edit() {\n return this.focusedStore?.entity.store.get('edit');\n }\n\n get focused() {\n return this.focusedStore?.entity.store.get('focus');\n }\n\n get selectedRange() {\n return this.focusedStore?.entity.store.get('range');\n }\n\n private readonly sections: Element[] = [];\n\n registerSection(e?: Element) {\n if (!e) {\n this.sections.length = 0;\n // some elements removed, rebuild stores\n this.dirty = true;\n return;\n }\n if (this.sections.indexOf(e) === -1) {\n this.sections.push(e);\n }\n }\n\n // check if require to cleanup all stores\n beforeUpdate() {\n if (this.dirty) {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n this.stores[y][x].dispose();\n }\n }\n this.dirty = false;\n }\n }\n\n registerColumn(x: number, type: DimensionCols): SelectionStore {\n // if hidden just create store but no operations needed\n if (isHiddenStore(x)) {\n return new SelectionStore();\n }\n if (this.columnStores[x]) {\n return this.columnStores[x];\n }\n this.columnStores[x] = new SelectionStore();\n // build cross-linking type to position\n this.storesByType[type] = x;\n this.storesXToType[x] = type;\n return this.columnStores[x];\n }\n\n registerRow(y: number, type: DimensionRows): SelectionStore {\n // if hidden just create store\n if (isHiddenStore(y)) {\n return new SelectionStore();\n }\n if (this.rowStores[y]) {\n return this.rowStores[y];\n }\n this.rowStores[y] = new SelectionStore();\n // build cross linking type to position\n this.storesByType[type] = y;\n this.storesYToType[y] = type;\n return this.rowStores[y];\n }\n\n /**\n * Cross store proxy, based on multiple dimensions\n */\n register({ x, y }: Cell): SelectionStore {\n // if hidden just create store\n if (isHiddenStore(x) || isHiddenStore(y)) {\n return new SelectionStore();\n }\n if (!this.stores[y]) {\n this.stores[y] = {};\n }\n if (this.stores[y][x]) {\n // Store already registered. Do not register twice\n return this.stores[y][x];\n }\n this.stores[y][x] = new SelectionStore();\n // proxy update, column store trigger only range area\n this.stores[y][x]?.onChange('range', c => {\n this.columnStores[x].setRangeArea(c);\n this.rowStores[y].setRangeArea(c);\n });\n // clean up on remove\n this.stores[y][x]?.store.on('dispose', () => this.destroy(x, y));\n return this.stores[y][x];\n }\n\n private destroy(x: number, y: number) {\n this.columnStores[x]?.dispose();\n this.rowStores[y]?.dispose();\n\n delete this.rowStores[y];\n delete this.columnStores[x];\n // clear x cross-link\n if (this.storesXToType[x]) {\n const type = this.storesXToType[x];\n delete this.storesXToType[x];\n delete this.storesByType[type];\n }\n // clear y cross-link\n if (this.storesYToType[y]) {\n const type = this.storesYToType[y];\n delete this.storesYToType[y];\n delete this.storesByType[type];\n }\n if (this.stores[y]) {\n delete this.stores[y][x];\n }\n // clear empty rows\n if (!Object.keys(this.stores[y] || {}).length) {\n delete this.stores[y];\n }\n }\n\n setEditByCell<T extends Cell>(storePos: T, editCell: T) {\n this.focusByCell(storePos, editCell, editCell);\n this.setEdit('');\n }\n\n /**\n * Sets the next focus cell before the current one.\n * \n * @param focus - The cell to set as the next focus.\n */\n beforeNextFocusCell(focus: Cell) {\n // If there is no focused store, return early.\n if (!this.focusedStore) {\n return;\n }\n\n // Get the next store based on the current focus and the last cell.\n const lastCell = this.focusedStore.entity.store.get('lastCell');\n const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);\n\n // Set the next focus cell in the store.\n next?.store?.setNextFocus({ ...focus, ...next.item });\n }\n\n focusByCell<T extends Cell>(storePos: T, start: T, end: T) {\n const store = this.stores[storePos.y][storePos.x];\n this.focus(store, { focus: start, end });\n }\n\n focus(store: SelectionStore, { focus, end }: { focus: Cell; end: Cell }) {\n const currentStorePointer = this.getCurrentStorePointer(store);\n if (!currentStorePointer) {\n return null;\n }\n\n // check for the focus in nearby store/viewport\n const lastCell = store.store.get('lastCell');\n const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);\n\n // if next store present - update\n if (next?.store) {\n const item = { ...focus, ...next.item };\n this.focus(next.store, { focus: item, end: item });\n return null;\n }\n\n if (lastCell) {\n focus = cropCellToMax(focus, lastCell);\n end = cropCellToMax(end, lastCell); \n }\n store.setFocus(focus, end);\n return focus;\n }\n\n /**\n * Retrieves the current store pointer based on the active store.\n * Clears focus from all stores except the active one.\n */\n getCurrentStorePointer(store: SelectionStore) {\n let currentStorePointer: Cell | undefined;\n\n // Iterate through all stores\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const s = this.stores[y][x];\n\n // Clear focus from stores other than the active one\n if (s !== store) {\n s.clearFocus();\n } else {\n // Update the current store pointer with the active store coordinates\n currentStorePointer = { \n x: parseInt(x, 10), \n y: parseInt(y, 10) \n };\n }\n }\n }\n\n return currentStorePointer;\n }\n\n /**\n * Retrieves the next store based on the focus cell and current store pointer.\n * If the next store exists, returns an object with the next store and the item in the new store.\n * If the next store does not exist, returns null.\n */\n getNextStore(\n focus: Cell,\n currentStorePointer: Cell,\n lastCell: Cell,\n ) {\n // item in new store\n const nextItem: Partial<Cell> | null = nextCell(focus, lastCell);\n\n let nextStore: SelectionStore | undefined;\n if (nextItem) {\n Object.entries(nextItem).forEach(([type, nextItemCoord]: [keyof Cell, number]) => {\n let stores;\n switch (type) {\n case 'x':\n // Get the X stores for the current Y coordinate of the current store pointer\n stores = this.getXStores(currentStorePointer.y);\n break;\n case 'y':\n // Get the Y stores for the current X coordinate of the current store pointer\n stores = this.getYStores(currentStorePointer.x);\n break;\n }\n\n // Get the next store based on the item in the new store\n if (nextItemCoord >= 0) {\n nextStore = stores[++currentStorePointer[type]];\n } else {\n nextStore = stores[--currentStorePointer[type]];\n const nextLastCell = nextStore?.store.get('lastCell');\n if (nextLastCell) {\n nextItem[type] = nextLastCell[type] + nextItemCoord;\n }\n }\n });\n }\n return {\n store: nextStore,\n item: nextItem,\n };\n }\n\n clearAll() {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n this.stores[y][x]?.clearFocus();\n }\n }\n }\n\n setEdit(val?: string | boolean) {\n if (!this.focusedStore) {\n return;\n }\n this.focusedStore.entity.setEdit(val);\n }\n\n /**\n * Select all cells across all stores\n */\n selectAll() {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const store = this.stores[y][x];\n if (!store) {\n continue;\n }\n const lastCell = store.store.get('lastCell');\n if (lastCell) {\n store.setRange(\n { x: 0, y: 0 },\n { x: lastCell.x - 1, y: lastCell.y - 1 },\n );\n }\n }\n }\n }\n\n private getXStores(y: number) {\n return this.stores[y];\n }\n\n private getYStores(x: number) {\n const stores: { [p: number]: SelectionStore } = {};\n for (let i in this.stores) {\n stores[i] = this.stores[i][x];\n }\n return stores;\n }\n}\n","import { EMPTY_INDEX } from '../../services/selection.store.connector';\nimport { Cell, RangeArea } from '@type';\n\nexport function isHiddenStore(pos: number) {\n return pos === EMPTY_INDEX;\n}\n\nexport function nextCell(cell: Cell, lastCell: Cell): Partial<Cell> | null {\n const nextItem: Partial<Cell> = {};\n let types: (keyof Cell)[] = ['x', 'y'];\n\n // previous item check\n for (let t of types) {\n if (cell[t] < 0) {\n nextItem[t] = cell[t];\n return nextItem;\n }\n }\n // next item check\n for (let t of types) {\n if (cell[t] >= lastCell[t]) {\n nextItem[t] = cell[t] - lastCell[t];\n return nextItem;\n }\n }\n return null;\n}\n\nexport function cropCellToMax(cell: Cell, lastCell: Cell): Cell {\n const croppedCell: Cell = { ...cell };\n const cellCoordinates: (keyof Cell)[] = ['x', 'y'];\n\n for (const coordinate of cellCoordinates) {\n if (cell[coordinate] < 0) {\n croppedCell[coordinate] = 0;\n } else if (cell[coordinate] >= lastCell[coordinate]) {\n croppedCell[coordinate] = lastCell[coordinate] - 1;\n }\n }\n\n return croppedCell;\n}\n\nexport function getRange(start?: Cell | null, end?: Cell | null): RangeArea | null {\n return start && end\n ? {\n x: Math.min(start.x, end.x),\n y: Math.min(start.y, end.y),\n x1: Math.max(start.x, end.x),\n y1: Math.max(start.y, end.y),\n }\n : null;\n}\n\nexport function isRangeSingleCell(a: RangeArea): boolean {\n return a.x === a.x1 && a.y === a.y1;\n}\n"],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"throttle-f9cda5b0.js","mappings":";;;;;;;AAqBA,MAAM,aAAa,GAAW;IAC5B,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,CAAC;CACX,CAAC;AACF,MAAM,aAAa,GAAG,CAAC,CAAC,CAAC;AAEzB;;;;SAIgB,cAAc,CAC5B,WAAmB,EACnB,UAAkB,EAClB,WAAW,GAAG,CAAC;IAEf,OAAO,WAAW,IAAI,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC;AACpE,CAAC;MAEoB,kBAAkB;IAerC,YAAoB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAdvB,4BAAuB,GAA+C;YAC5E,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI;SACZ,CAAC;;QAEM,mBAAc,GAAkC;YACtD,KAAK,EAAE,aAAa;YACpB,KAAK,EAAE,aAAa;SACrB,CAAC;QACM,WAAM,GAAkC;YAC9C,KAAK,oBAAO,aAAa,CAAE;YAC3B,KAAK,oBAAO,aAAa,CAAE;SAC5B,CAAC;KAEiC;IAEnC,S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local.scroll.service.ts","src/services/local.scroll.timer.ts","node_modules/lodash/throttle.js"],"sourcesContent":["import type { DimensionType, ViewPortScrollEvent } from '@type';\nimport { scaleValue } from '../utils';\n\ninterface Config {\n skipAnimationFrame?: boolean;\n // scroll event inited and direction cached\n // scrollingService.proxyScroll get tiggered\n // setScroll event called from scrollingService\n runScroll(e: ViewPortScrollEvent): void;\n // all operation finished, apply scroll values\n applyScroll(e: ViewPortScrollEvent): void;\n}\n\ntype Params = {\n contentSize: number;\n virtualContentSize?: number;\n clientSize: number;\n virtualSize: number;\n maxSize?: number;\n};\n\nconst initialParams: Params = {\n contentSize: 0,\n clientSize: 0,\n virtualSize: 0,\n maxSize: 0,\n};\nconst NO_COORDINATE = -1;\n\n/**\n * Based on content size, client size and virtual size\n * return full size\n */\nexport function getContentSize(\n contentSize: number,\n clientSize: number,\n virtualSize = 0,\n): number {\n return contentSize + (virtualSize ? clientSize - virtualSize : 0);\n}\n\nexport default class LocalScrollService {\n private preventArtificialScroll: Record<DimensionType, (() => void) | null> = {\n rgRow: null,\n rgCol: null,\n };\n // to check if scroll changed\n private previousScroll: Record<DimensionType, number> = {\n rgRow: NO_COORDINATE,\n rgCol: NO_COORDINATE,\n };\n private params: Record<DimensionType, Params> = {\n rgRow: { ...initialParams },\n rgCol: { ...initialParams },\n };\n\n constructor(private cfg: Config) {}\n\n setParams(params: Params, dimension: DimensionType) {\n const virtualContentSize = getContentSize(\n params.contentSize,\n params.clientSize,\n params.virtualSize,\n );\n this.params[dimension] = {\n ...params,\n maxSize: virtualContentSize - params.clientSize,\n virtualContentSize,\n };\n }\n\n // apply scroll values after scroll done\n async setScroll(e: ViewPortScrollEvent) {\n this.cancelScroll(e.dimension);\n\n // start frame animation\n const frameAnimation = new Promise<void>((resolve, reject) => {\n // for example safari desktop has issues with animation frame\n if (this.cfg.skipAnimationFrame) {\n return resolve();\n }\n const animationId = window.requestAnimationFrame(() => {\n resolve();\n });\n this.preventArtificialScroll[e.dimension] = reject.bind(\n null,\n animationId,\n );\n });\n\n try {\n await frameAnimation;\n const params = this.getParams(e.dimension);\n e.coordinate = Math.ceil(e.coordinate);\n this.previousScroll[e.dimension] = this.wrapCoordinate(\n e.coordinate,\n params,\n );\n this.preventArtificialScroll[e.dimension] = null;\n this.cfg.applyScroll({\n ...e,\n coordinate: params.virtualSize\n ? this.convert(e.coordinate, params, false)\n : e.coordinate,\n });\n } catch (id) {\n window.cancelAnimationFrame(id);\n }\n }\n\n /**\n * On scroll event started\n */\n scroll(\n coordinate: number,\n dimension: DimensionType,\n force = false,\n delta?: number,\n outside = false,\n ) {\n // cancel all previous scrolls for same dimension\n this.cancelScroll(dimension);\n\n // drop if no change\n if (!force && this.previousScroll[dimension] === coordinate) {\n this.previousScroll[dimension] = NO_COORDINATE;\n return;\n }\n\n const param = this.getParams(dimension);\n // let component know about scroll event started\n this.cfg.runScroll({\n dimension: dimension,\n coordinate: param.virtualSize\n ? this.convert(coordinate, param)\n : coordinate,\n delta,\n outside,\n });\n }\n\n private getParams(dimension: DimensionType): Params {\n return this.params[dimension];\n }\n\n // check if scroll outside of region to avoid looping\n private wrapCoordinate(c: number, param: Params): number {\n if (c < 0) {\n return NO_COORDINATE;\n }\n\n if (typeof param.maxSize === 'number' && c > param.maxSize) {\n return param.maxSize;\n }\n return c;\n }\n\n // prevent already started scroll, performance optimization\n private cancelScroll(dimension: DimensionType) {\n this.preventArtificialScroll[dimension]?.();\n this.preventArtificialScroll[dimension] = null;\n }\n\n /* convert virtual to real and back, scale range */\n private convert(pos: number, param: Params, toReal = true): number {\n const minRange = param.clientSize;\n const from: [number, number] = [0, (param.virtualContentSize ?? minRange) - minRange];\n const to: [number, number] = [0, param.contentSize - param.virtualSize];\n if (toReal) {\n return scaleValue(pos, from, to);\n }\n return scaleValue(pos, to, from);\n }\n}\n","import type { DimensionType } from '@type';\n/**\n * Apply changes only if mousewheel event happened some time ago (scrollThrottling)\n */\nexport class LocalScrollTimer {\n /**\n * Last mw event time for trigger scroll function below\n * If mousewheel function was ignored we still need to trigger render\n */\n private mouseWheelScrollTimestamp: Record<DimensionType, number> = {\n rgCol: 0,\n rgRow: 0,\n };\n private lastKnownScrollCoordinate: Record<DimensionType, number> = {\n rgCol: 0,\n rgRow: 0,\n };\n\n constructor(private scrollThrottling = 10) {}\n\n setCoordinate(e: { dimension: DimensionType; coordinate: number }) {\n this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;\n }\n\n /**\n * Remember last mw event time\n */\n latestScrollUpdate(dimension: DimensionType) {\n this.mouseWheelScrollTimestamp[dimension] = new Date().getTime();\n }\n\n /**\n * Check if scroll is ready to accept new value\n */\n isReady(type: DimensionType, coordinate: number) {\n const change = new Date().getTime() - this.mouseWheelScrollTimestamp[type];\n // apply after throttling\n return (\n change > this.scrollThrottling &&\n coordinate !== this.lastKnownScrollCoordinate[type]\n );\n }\n}\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n"],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"toNumber-8de324a7.js","mappings":";;;;;;;AACA,IAAIA,YAAU,GAAG,OAAOC,cAAM,IAAI,QAAQ,IAAIA,cAAM,IAAIA,cAAM,CAAC,MAAM,KAAK,MAAM,IAAIA,cAAM,CAAC;AAC3F;IACA,WAAc,GAAGD;;ACHjB,IAAI,UAAU,GAAGE,WAAwB,CAAC;AAC1C;AACA;AACA,IAAI,QAAQ,GAAG,OAAO,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC;AACjF;AACA;AACA,IAAIC,MAAI,GAAG,UAAU,IAAI,QAAQ,IAAI,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;AAC/D;IACA,KAAc,GAAGA;;ACRjB,IAAI,IAAI,GAAGD,KAAkB,CAAC;AAC9B;AACA;AACA,IAAIE,QAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AACzB;I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,CAAC,KAAK,CAAC;AAC3C,MAAM,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC;AACpD,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;AACD;IACA,UAAc,GAAG;;;;","names":["freeGlobal","global","require$$0","root","Symbol","objectProto","nativeObjectToString","symToStringTag","getRawTag","objectToString","require$$1","require$$2","baseGetTag","isObject","isObjectLike","isSymbol","trimmedEndIndex","baseTrim"],"sources":["node_modules/lodash/_freeGlobal.js","node_modules/lodash/_root.js","node_modules/lodash/_Symbol.js","node_modules/lodash/_getRawTag.js","node_modules/lodash/_objectToString.js","node_modules/lodash/_baseGetTag.js","node_modules/lodash/isObject.js","node_modules/lodash/isObjectLike.js","node_modules/lodash/isSymbol.js","node_modules/lodash/_trimmedEndIndex.js","node_modules/lodash/_baseTrim.js","node_modules/lodash/toNumber.js"],"sourcesContent":["/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n"],"version":3}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Built by Revolist OU ❤️
|
|
3
|
-
*/
|
|
4
|
-
import{O as t,a8 as n,a7 as e,a as o,C as s,y as r,b as i}from"./index-c428acf6.js";import"./toNumber-8de324a7.js";import"./index-a61f225b.js";import{g as c}from"./selection.helpers-ac4368b0.js";const a=`${t}-depth`;const u=`${t}-name`;const l=`${t}-id`;const f=`${t}-value`;const d=`${t}-column`;const p=`${t}-expanded`;const h=`${t}-original-index`;const y=`group-expand`;const v=`groupexpandclick`;const g="rgRow";function m(t,n){return t[n]||null}function x(t,n,{prevExpanded:e,expandedAll:o,getGroupValue:s=m}){const r=new Map;t.forEach(((t,e)=>{const o=n.map((n=>s(t,n)));const i=o.pop();let c=r;o.forEach((t=>{if(!c.has(t)){c.set(t,new Map)}c=c.get(t)}));if(!c.has(i)){c.set(i,[])}const a=c.get(i);a.push(Object.assign(Object.assign({},t),{[h]:e}))}));let i=-1;const c=n.length;const d={};const y={};const v={};const g=[];function x(t,n,s){const r=n.length;t.forEach(((t,c)=>{const m=[...n,c];const b=m.join(",");const j=s&&(!!o||!!(e===null||e===void 0?void 0:e[b]));g.push({[u]:c,[a]:r,[l]:JSON.stringify(m),[f]:b,[p]:j});i+=1;if(!j&&r){d[i]=true}if(Array.isArray(t)){t.forEach((t=>{i+=1;if(!j){d[i]=true}y[t[h]]=i;const n=m.map(((t,n)=>m.slice(0,n+1).join(",")));n.forEach((t=>{if(!v[t]){v[t]=[]}v[t].push(i)}))}));g.push(...t)}else{x(t,m,j)}}))}x(r,[],true);return{sourceWithGroups:g,depth:c,trimmed:d,oldNewIndexMap:y,childrenByGroup:v}}function b(t){return t&&t[u]}function j(t){return typeof(t===null||t===void 0?void 0:t[u])!=="undefined"}function w(t){return t&&typeof t[d]!=="undefined"}function O(t,n){const e=t.length;let o=0;for(;o<e;o++){if(t[o]!==n[o]){return o}}return o}function C(t){const n=JSON.parse(t);if(!Array.isArray(n)){return null}return n}function D(t,n,e){const o=C(e[l]);if(!o){return false}const s=O(t,o);return n[a]<s}const I="header";const R="footer";const $="content";const T="data";function A(t,n){const e=t.viewports[t.colType].store.get("realCount");const o=t.viewports[n].store.get("realCount");return{x:e,y:o}}function S(t,n,e,o){return{colData:t.colStore,viewportCol:t.viewports[t.colType].store,viewportRow:t.viewports[n].store,lastCell:A(t,n),slot:e,type:n,canDrag:!o,position:t.position,dataStore:t.rowStores[n].store,dimensionCol:t.dimensions[t.colType].store,dimensionRow:t.dimensions[n].store,style:o?{height:`${t.dimensions[n].store.get("realSize")}px`}:undefined}}function G(t,n,e){var o=-1,s=t.length;if(n<0){n=-n>s?0:s+n}e=e>s?s:e;if(e<0){e+=s}s=n>e?0:e-n>>>0;n>>>=0;var r=Array(s);while(++o<s){r[o]=t[o+n]}return r}var M=G;var N=M,P=n,k=e;function E(t,n,e){var o=t==null?0:t.length;if(!o){return[]}if(e&&typeof e!="number"&&P(t,n,e)){n=0;e=o}else{n=n==null?0:k(n);e=e===undefined?o:k(e)}return N(t,n,e)}var J=E;class q{get columns(){return o(this.source)}constructor(t,n){this.dataStore=t;this.source=n;this.unsubscribe=[];this.hasGrouping=false;this.unsubscribe.push(n.onChange("source",(t=>this.checkGrouping(t))));this.checkGrouping(n.get("source"));this.type=n.get("type")}checkGrouping(t){for(let n of t){if(w(n)){this.hasGrouping=true;return}this.hasGrouping=false}}isReadOnly(t,n){var e;const o=(e=this.columns[n])===null||e===void 0?void 0:e.readonly;if(typeof o==="function"){const e=this.rowDataModel(t,n);return o(e)}return!!o}mergeProperties(t,n,e,o,i){const c={[s]:true,[r]:this.isReadOnly(t,n)};let a=Object.assign(Object.assign({},e),{class:c});const u=i===null||i===void 0?void 0:i(o);if(!u){return a}return F(a,u)}getRowClass(t,n){const e=i(this.dataStore,t)||{};return e[n]||""}getCellData(t,n){const e=this.rowDataModel(t,n);return z(e.model[e.prop])}getSaveData(t,n,e){if(typeof e==="undefined"){e=this.getCellData(t,n)}const o=this.rowDataModel(t,n);return{prop:o.prop,rowIndex:t,colIndex:n,val:e,model:o.model,colType:this.type,type:this.dataStore.get("type")}}getCellEditor(t,n,e){var o;const s=(o=this.columns[n])===null||o===void 0?void 0:o.editor;if(!s){return undefined}if(typeof s==="string"){return e[s]}return s}rowDataModel(t,n){const e=this.columns[n];const o=e===null||e===void 0?void 0:e.prop;const s=i(this.dataStore,t)||{};const r=s[o];const c=this.dataStore.get("type");return{prop:o,model:s,data:this.dataStore.get("source"),column:e,rowIndex:t,colIndex:n,colType:this.type,type:c,value:r}}getRangeData(t,n){var e;const o={};const s=t.oldRange.x1-t.oldRange.x+1;const r=t.oldRange.y1-t.oldRange.y+1;const c={};for(let a=t.newRange.y,u=0;a<t.newRange.y1+1;a++,u++){const l=t.oldRange.y+u%r;const f=i(this.dataStore,l)||{};for(let r=t.newRange.x,i=0;r<t.newRange.x1+1;r++,i++){if(a>=t.oldRange.y&&a<=t.oldRange.y1&&r>=t.oldRange.x&&r<=t.oldRange.x1){continue}if(!this.columns[r]){continue}const u=(e=this.columns[r])===null||e===void 0?void 0:e.prop;const d=t.oldRange.x+i%s;const p=n[d].prop;if(!this.isReadOnly(a,r)){if(!o[a]){o[a]={}}o[a][u]=f[p];if(!c[a]){c[a]={}}c[a][u]={colIndex:d,colProp:p,rowIndex:l}}}}return{changed:o,mapping:c}}getTransformedDataToApply(t,n){const e={};const o=n.length;const s=this.columns.length;const r=this.dataStore.get("items").length;let i=t.y;let a=0;for(let c=0;i<r&&c<o;i++,c++){const r=n[c%o];const u=(r===null||r===void 0?void 0:r.length)||0;let l=t.x;for(let t=0;l<s&&t<u;l++,t++){const n=this.columns[l].prop;const o=t%s;if(!this.isReadOnly(i,l)){if(!e[i]){e[i]={}}e[i][n]=r[o]}}a=Math.max(a,l-1)}const u=c(t,{y:i-1,x:a});return{changed:e,range:u}}getRangeStaticData(t,n){const e={};for(let o=t.y,s=0;o<t.y1+1;o++,s++){for(let s=t.x,r=0;s<t.x1+1;s++,r++){if(!this.columns[s]){continue}const t=this.columns[s].prop;if(!this.isReadOnly(o,s)){if(!e[o]){e[o]={}}e[o][t]=n}}}return e}getRangeTransformedToProps(t,n){var e;const o=[];const s=this.dataStore.get("type");for(let r=t.y,c=0;r<t.y1+1;r++,c++){for(let c=t.x,a=0;c<t.x1+1;c++,a++){const t=(e=this.columns[c])===null||e===void 0?void 0:e.prop;o.push({prop:t,rowIndex:r,colIndex:c,model:i(n,r),type:s,colType:this.type})}}return o}copyRangeArray(t,n){const e=[...this.columns];const o=J(e,t.x,t.x1+1).map((t=>t.prop));const s=[];const r={};for(let e=t.y;e<=t.y1;e++){const t=[];r[e]={};for(let s of o){const o=i(n,e);if(!o){continue}const c=o[s];t.push(c);r[e][s]=c}s.push(t)}return{data:s,mapping:r}}destroy(){this.unsubscribe.forEach((t=>t()))}}function z(t){if(typeof t==="undefined"||t===null){return""}return t}function B(t,n){if(typeof t==="function"){return t(n)}return!!t}function F(t,n){let e=Object.assign(Object.assign({},n),t);if(n.class){if(typeof n.class==="object"&&typeof e.class==="object"){e.class=Object.assign(Object.assign({},n.class),e.class)}else if(typeof n.class==="string"&&typeof e.class==="object"){e.class[n.class]=true}else if(typeof e.class==="string"){e.class+=" "+n.class}}if(n.style){e.style=Object.assign(Object.assign({},n.style),e.style)}return e}export{$ as C,T as D,R as F,p as G,I as H,f as P,C as a,D as b,a as c,l as d,g as e,d as f,b as g,v as h,j as i,x as j,w as k,F as l,q as m,y as n,u as o,B as p,z as q,S as v};
|
|
5
|
-
//# sourceMappingURL=column.service-6f1faf2d.js.map
|