@revolist/revogrid 4.2.0-next.15 → 4.2.0-next.16
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/revo-grid.js +3 -2
- package/custom-element/revogr-row-headers2.js +48 -21
- package/dist/cjs/revo-grid_11.cjs.entry.js +51 -23
- package/dist/collection/services/dimension.provider.js +2 -2
- package/dist/collection/store/dimension/dimension.store.js +1 -0
- package/dist/collection/store/viewPort/viewport.helpers.d.ts +9 -0
- package/dist/collection/store/viewPort/viewport.helpers.js +35 -0
- package/dist/collection/store/viewPort/viewport.store.d.ts +2 -1
- package/dist/collection/store/viewPort/viewport.store.js +14 -22
- package/dist/esm/revo-grid_11.entry.js +51 -23
- package/dist/revo-grid/revo-grid_11.entry.js +1 -1
- package/dist/types/store/viewPort/viewport.helpers.d.ts +9 -0
- package/dist/types/store/viewPort/viewport.store.d.ts +2 -1
- package/package.json +1 -1
|
@@ -675,6 +675,7 @@ class DimensionStore {
|
|
|
675
675
|
*/
|
|
676
676
|
setDimensionSize(sizes) {
|
|
677
677
|
const dimensionData = calculateDimensionData(this.store.get('originItemSize'), sizes);
|
|
678
|
+
console.log(sizes);
|
|
678
679
|
setStore(this.store, dimensionData);
|
|
679
680
|
return dimensionData;
|
|
680
681
|
}
|
|
@@ -718,7 +719,7 @@ class DimensionProvider {
|
|
|
718
719
|
newSizes = Object.assign(Object.assign({}, oldSizes), sizes);
|
|
719
720
|
}
|
|
720
721
|
this.stores[type].setDimensionSize(newSizes);
|
|
721
|
-
this.viewports.stores[type].
|
|
722
|
+
this.viewports.stores[type].setViewPortDimensionSizes(newSizes, !keepOld ? this.stores[type].store.get('originItemSize') : undefined);
|
|
722
723
|
}
|
|
723
724
|
setItemCount(realCount, type) {
|
|
724
725
|
this.viewports.stores[type].setViewport({ realCount });
|
|
@@ -733,7 +734,7 @@ class DimensionProvider {
|
|
|
733
734
|
const allTrimmed = gatherTrimmedItems(trimmed);
|
|
734
735
|
const dimStoreType = this.stores[type];
|
|
735
736
|
dimStoreType.setStore({ trimmed: allTrimmed });
|
|
736
|
-
this.viewports.stores[type].
|
|
737
|
+
this.viewports.stores[type].setViewPortDimensionSizes(dimStoreType.store.get('sizes'));
|
|
737
738
|
}
|
|
738
739
|
/**
|
|
739
740
|
* Sets dimension data and view port coordinate
|
|
@@ -184,6 +184,41 @@ function getFirstItem(s) {
|
|
|
184
184
|
function getLastItem(s) {
|
|
185
185
|
return s.items[s.end];
|
|
186
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Set items sizes from start index to end
|
|
189
|
+
* @param vpItems
|
|
190
|
+
* @param start
|
|
191
|
+
* @param size
|
|
192
|
+
* @param lastCoordinate
|
|
193
|
+
* @returns
|
|
194
|
+
*/
|
|
195
|
+
function setItemSizes(vpItems, initialIndex, size, lastCoordinate) {
|
|
196
|
+
const items = [...vpItems];
|
|
197
|
+
const count = items.length;
|
|
198
|
+
let pos = lastCoordinate;
|
|
199
|
+
let i = 0;
|
|
200
|
+
let start = initialIndex;
|
|
201
|
+
// viewport not inited
|
|
202
|
+
if (!count) {
|
|
203
|
+
return [];
|
|
204
|
+
}
|
|
205
|
+
// loop through array from initial item after recombination
|
|
206
|
+
while (i < count) {
|
|
207
|
+
const item = items[start];
|
|
208
|
+
item.start = pos;
|
|
209
|
+
item.size = size;
|
|
210
|
+
item.end = item.start + size;
|
|
211
|
+
pos = item.end;
|
|
212
|
+
// loop by start index
|
|
213
|
+
start++;
|
|
214
|
+
i++;
|
|
215
|
+
// if start index out of array, reset it
|
|
216
|
+
if (start === count) {
|
|
217
|
+
start = 0;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return items;
|
|
221
|
+
}
|
|
187
222
|
|
|
188
223
|
/**
|
|
189
224
|
* Store is responsible for visible
|
|
@@ -263,9 +298,10 @@ class ViewportStore {
|
|
|
263
298
|
* Update viewport sizes for existing items
|
|
264
299
|
* This method is generating new item positions based on custom sizes and original sizes
|
|
265
300
|
* @param sizes - custom sizes for each item
|
|
301
|
+
* @param dropToOriginalSize - drop to original size if requested
|
|
266
302
|
*/
|
|
267
|
-
|
|
268
|
-
|
|
303
|
+
setViewPortDimensionSizes(sizes, dropToOriginalSize) {
|
|
304
|
+
let items = [...this.store.get('items')];
|
|
269
305
|
const count = items.length;
|
|
270
306
|
// viewport not inited
|
|
271
307
|
if (!count) {
|
|
@@ -274,7 +310,12 @@ class ViewportStore {
|
|
|
274
310
|
let changedCoordinate = 0;
|
|
275
311
|
let i = 0;
|
|
276
312
|
let start = this.store.get('start');
|
|
313
|
+
// drop to original size if requested
|
|
314
|
+
if (dropToOriginalSize) {
|
|
315
|
+
items = setItemSizes(items, start, dropToOriginalSize, this.store.get('lastCoordinate'));
|
|
316
|
+
}
|
|
277
317
|
// loop through array from initial item after recombination
|
|
318
|
+
// if size change present, change position for all items after
|
|
278
319
|
while (i < count) {
|
|
279
320
|
const item = items[start];
|
|
280
321
|
// change pos if size change present before
|
|
@@ -282,7 +323,7 @@ class ViewportStore {
|
|
|
282
323
|
item.start += changedCoordinate;
|
|
283
324
|
item.end += changedCoordinate;
|
|
284
325
|
}
|
|
285
|
-
// change
|
|
326
|
+
// check if size change present
|
|
286
327
|
const size = sizes[item.itemIndex];
|
|
287
328
|
// size found
|
|
288
329
|
if (size) {
|
|
@@ -295,6 +336,7 @@ class ViewportStore {
|
|
|
295
336
|
// loop by start index
|
|
296
337
|
start++;
|
|
297
338
|
i++;
|
|
339
|
+
// if start index out of array, reset it
|
|
298
340
|
if (start === count) {
|
|
299
341
|
start = 0;
|
|
300
342
|
}
|
|
@@ -311,24 +353,9 @@ class ViewportStore {
|
|
|
311
353
|
if (!count) {
|
|
312
354
|
return;
|
|
313
355
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
// loop through array from initial item after recombination
|
|
318
|
-
while (i < count) {
|
|
319
|
-
const item = items[start];
|
|
320
|
-
item.start = pos;
|
|
321
|
-
item.size = size;
|
|
322
|
-
item.end = item.start + size;
|
|
323
|
-
pos = item.end;
|
|
324
|
-
// loop by start index
|
|
325
|
-
start++;
|
|
326
|
-
i++;
|
|
327
|
-
if (start === count) {
|
|
328
|
-
start = 0;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
setStore(this.store, { items: [...items] });
|
|
356
|
+
setStore(this.store, {
|
|
357
|
+
items: setItemSizes(items, this.store.get('start'), size, this.store.get('lastCoordinate'))
|
|
358
|
+
});
|
|
332
359
|
}
|
|
333
360
|
getItems() {
|
|
334
361
|
return {
|
|
@@ -21653,6 +21653,7 @@ class DimensionStore {
|
|
|
21653
21653
|
*/
|
|
21654
21654
|
setDimensionSize(sizes) {
|
|
21655
21655
|
const dimensionData = calculateDimensionData(this.store.get('originItemSize'), sizes);
|
|
21656
|
+
console.log(sizes);
|
|
21656
21657
|
setStore(this.store, dimensionData);
|
|
21657
21658
|
return dimensionData;
|
|
21658
21659
|
}
|
|
@@ -21718,7 +21719,7 @@ class DimensionProvider {
|
|
|
21718
21719
|
newSizes = Object.assign(Object.assign({}, oldSizes), sizes);
|
|
21719
21720
|
}
|
|
21720
21721
|
this.stores[type].setDimensionSize(newSizes);
|
|
21721
|
-
this.viewports.stores[type].
|
|
21722
|
+
this.viewports.stores[type].setViewPortDimensionSizes(newSizes, !keepOld ? this.stores[type].store.get('originItemSize') : undefined);
|
|
21722
21723
|
}
|
|
21723
21724
|
setItemCount(realCount, type) {
|
|
21724
21725
|
this.viewports.stores[type].setViewport({ realCount });
|
|
@@ -21733,7 +21734,7 @@ class DimensionProvider {
|
|
|
21733
21734
|
const allTrimmed = gatherTrimmedItems(trimmed);
|
|
21734
21735
|
const dimStoreType = this.stores[type];
|
|
21735
21736
|
dimStoreType.setStore({ trimmed: allTrimmed });
|
|
21736
|
-
this.viewports.stores[type].
|
|
21737
|
+
this.viewports.stores[type].setViewPortDimensionSizes(dimStoreType.store.get('sizes'));
|
|
21737
21738
|
}
|
|
21738
21739
|
/**
|
|
21739
21740
|
* Sets dimension data and view port coordinate
|
|
@@ -21989,6 +21990,41 @@ function getFirstItem(s) {
|
|
|
21989
21990
|
function getLastItem(s) {
|
|
21990
21991
|
return s.items[s.end];
|
|
21991
21992
|
}
|
|
21993
|
+
/**
|
|
21994
|
+
* Set items sizes from start index to end
|
|
21995
|
+
* @param vpItems
|
|
21996
|
+
* @param start
|
|
21997
|
+
* @param size
|
|
21998
|
+
* @param lastCoordinate
|
|
21999
|
+
* @returns
|
|
22000
|
+
*/
|
|
22001
|
+
function setItemSizes(vpItems, initialIndex, size, lastCoordinate) {
|
|
22002
|
+
const items = [...vpItems];
|
|
22003
|
+
const count = items.length;
|
|
22004
|
+
let pos = lastCoordinate;
|
|
22005
|
+
let i = 0;
|
|
22006
|
+
let start = initialIndex;
|
|
22007
|
+
// viewport not inited
|
|
22008
|
+
if (!count) {
|
|
22009
|
+
return [];
|
|
22010
|
+
}
|
|
22011
|
+
// loop through array from initial item after recombination
|
|
22012
|
+
while (i < count) {
|
|
22013
|
+
const item = items[start];
|
|
22014
|
+
item.start = pos;
|
|
22015
|
+
item.size = size;
|
|
22016
|
+
item.end = item.start + size;
|
|
22017
|
+
pos = item.end;
|
|
22018
|
+
// loop by start index
|
|
22019
|
+
start++;
|
|
22020
|
+
i++;
|
|
22021
|
+
// if start index out of array, reset it
|
|
22022
|
+
if (start === count) {
|
|
22023
|
+
start = 0;
|
|
22024
|
+
}
|
|
22025
|
+
}
|
|
22026
|
+
return items;
|
|
22027
|
+
}
|
|
21992
22028
|
|
|
21993
22029
|
/**
|
|
21994
22030
|
* Store is responsible for visible
|
|
@@ -22068,9 +22104,10 @@ class ViewportStore {
|
|
|
22068
22104
|
* Update viewport sizes for existing items
|
|
22069
22105
|
* This method is generating new item positions based on custom sizes and original sizes
|
|
22070
22106
|
* @param sizes - custom sizes for each item
|
|
22107
|
+
* @param dropToOriginalSize - drop to original size if requested
|
|
22071
22108
|
*/
|
|
22072
|
-
|
|
22073
|
-
|
|
22109
|
+
setViewPortDimensionSizes(sizes, dropToOriginalSize) {
|
|
22110
|
+
let items = [...this.store.get('items')];
|
|
22074
22111
|
const count = items.length;
|
|
22075
22112
|
// viewport not inited
|
|
22076
22113
|
if (!count) {
|
|
@@ -22079,7 +22116,12 @@ class ViewportStore {
|
|
|
22079
22116
|
let changedCoordinate = 0;
|
|
22080
22117
|
let i = 0;
|
|
22081
22118
|
let start = this.store.get('start');
|
|
22119
|
+
// drop to original size if requested
|
|
22120
|
+
if (dropToOriginalSize) {
|
|
22121
|
+
items = setItemSizes(items, start, dropToOriginalSize, this.store.get('lastCoordinate'));
|
|
22122
|
+
}
|
|
22082
22123
|
// loop through array from initial item after recombination
|
|
22124
|
+
// if size change present, change position for all items after
|
|
22083
22125
|
while (i < count) {
|
|
22084
22126
|
const item = items[start];
|
|
22085
22127
|
// change pos if size change present before
|
|
@@ -22087,7 +22129,7 @@ class ViewportStore {
|
|
|
22087
22129
|
item.start += changedCoordinate;
|
|
22088
22130
|
item.end += changedCoordinate;
|
|
22089
22131
|
}
|
|
22090
|
-
// change
|
|
22132
|
+
// check if size change present
|
|
22091
22133
|
const size = sizes[item.itemIndex];
|
|
22092
22134
|
// size found
|
|
22093
22135
|
if (size) {
|
|
@@ -22100,6 +22142,7 @@ class ViewportStore {
|
|
|
22100
22142
|
// loop by start index
|
|
22101
22143
|
start++;
|
|
22102
22144
|
i++;
|
|
22145
|
+
// if start index out of array, reset it
|
|
22103
22146
|
if (start === count) {
|
|
22104
22147
|
start = 0;
|
|
22105
22148
|
}
|
|
@@ -22116,24 +22159,9 @@ class ViewportStore {
|
|
|
22116
22159
|
if (!count) {
|
|
22117
22160
|
return;
|
|
22118
22161
|
}
|
|
22119
|
-
|
|
22120
|
-
|
|
22121
|
-
|
|
22122
|
-
// loop through array from initial item after recombination
|
|
22123
|
-
while (i < count) {
|
|
22124
|
-
const item = items[start];
|
|
22125
|
-
item.start = pos;
|
|
22126
|
-
item.size = size;
|
|
22127
|
-
item.end = item.start + size;
|
|
22128
|
-
pos = item.end;
|
|
22129
|
-
// loop by start index
|
|
22130
|
-
start++;
|
|
22131
|
-
i++;
|
|
22132
|
-
if (start === count) {
|
|
22133
|
-
start = 0;
|
|
22134
|
-
}
|
|
22135
|
-
}
|
|
22136
|
-
setStore(this.store, { items: [...items] });
|
|
22162
|
+
setStore(this.store, {
|
|
22163
|
+
items: setItemSizes(items, this.store.get('start'), size, this.store.get('lastCoordinate'))
|
|
22164
|
+
});
|
|
22137
22165
|
}
|
|
22138
22166
|
getItems() {
|
|
22139
22167
|
return {
|
|
@@ -46,7 +46,7 @@ export default class DimensionProvider {
|
|
|
46
46
|
newSizes = Object.assign(Object.assign({}, oldSizes), sizes);
|
|
47
47
|
}
|
|
48
48
|
this.stores[type].setDimensionSize(newSizes);
|
|
49
|
-
this.viewports.stores[type].
|
|
49
|
+
this.viewports.stores[type].setViewPortDimensionSizes(newSizes, !keepOld ? this.stores[type].store.get('originItemSize') : undefined);
|
|
50
50
|
}
|
|
51
51
|
setItemCount(realCount, type) {
|
|
52
52
|
this.viewports.stores[type].setViewport({ realCount });
|
|
@@ -61,7 +61,7 @@ export default class DimensionProvider {
|
|
|
61
61
|
const allTrimmed = gatherTrimmedItems(trimmed);
|
|
62
62
|
const dimStoreType = this.stores[type];
|
|
63
63
|
dimStoreType.setStore({ trimmed: allTrimmed });
|
|
64
|
-
this.viewports.stores[type].
|
|
64
|
+
this.viewports.stores[type].setViewPortDimensionSizes(dimStoreType.store.get('sizes'));
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Sets dimension data and view port coordinate
|
|
@@ -109,6 +109,7 @@ export default class DimensionStore {
|
|
|
109
109
|
*/
|
|
110
110
|
setDimensionSize(sizes) {
|
|
111
111
|
const dimensionData = calculateDimensionData(this.store.get('originItemSize'), sizes);
|
|
112
|
+
console.log(sizes);
|
|
112
113
|
setStore(this.store, dimensionData);
|
|
113
114
|
return dimensionData;
|
|
114
115
|
}
|
|
@@ -29,4 +29,13 @@ export declare function recombineByOffset(offset: number, data: RecombineOffsetD
|
|
|
29
29
|
export declare function isActiveRange(pos: number, item: RevoGrid.PositionItem | undefined): boolean;
|
|
30
30
|
export declare function getFirstItem(s: ItemsToUpdate): RevoGrid.VirtualPositionItem | undefined;
|
|
31
31
|
export declare function getLastItem(s: ItemsToUpdate): RevoGrid.VirtualPositionItem;
|
|
32
|
+
/**
|
|
33
|
+
* Set items sizes from start index to end
|
|
34
|
+
* @param vpItems
|
|
35
|
+
* @param start
|
|
36
|
+
* @param size
|
|
37
|
+
* @param lastCoordinate
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
export declare function setItemSizes(vpItems: RevoGrid.VirtualPositionItem[], initialIndex: number, size: number, lastCoordinate: number): RevoGrid.VirtualPositionItem[];
|
|
32
41
|
export {};
|
|
@@ -177,3 +177,38 @@ export function getFirstItem(s) {
|
|
|
177
177
|
export function getLastItem(s) {
|
|
178
178
|
return s.items[s.end];
|
|
179
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Set items sizes from start index to end
|
|
182
|
+
* @param vpItems
|
|
183
|
+
* @param start
|
|
184
|
+
* @param size
|
|
185
|
+
* @param lastCoordinate
|
|
186
|
+
* @returns
|
|
187
|
+
*/
|
|
188
|
+
export function setItemSizes(vpItems, initialIndex, size, lastCoordinate) {
|
|
189
|
+
const items = [...vpItems];
|
|
190
|
+
const count = items.length;
|
|
191
|
+
let pos = lastCoordinate;
|
|
192
|
+
let i = 0;
|
|
193
|
+
let start = initialIndex;
|
|
194
|
+
// viewport not inited
|
|
195
|
+
if (!count) {
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
// loop through array from initial item after recombination
|
|
199
|
+
while (i < count) {
|
|
200
|
+
const item = items[start];
|
|
201
|
+
item.start = pos;
|
|
202
|
+
item.size = size;
|
|
203
|
+
item.end = item.start + size;
|
|
204
|
+
pos = item.end;
|
|
205
|
+
// loop by start index
|
|
206
|
+
start++;
|
|
207
|
+
i++;
|
|
208
|
+
// if start index out of array, reset it
|
|
209
|
+
if (start === count) {
|
|
210
|
+
start = 0;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return items;
|
|
214
|
+
}
|
|
@@ -17,8 +17,9 @@ export default class ViewportStore {
|
|
|
17
17
|
* Update viewport sizes for existing items
|
|
18
18
|
* This method is generating new item positions based on custom sizes and original sizes
|
|
19
19
|
* @param sizes - custom sizes for each item
|
|
20
|
+
* @param dropToOriginalSize - drop to original size if requested
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
setViewPortDimensionSizes(sizes: RevoGrid.ViewSettingSizeProp, dropToOriginalSize?: number): void;
|
|
22
23
|
/**
|
|
23
24
|
* Set sizes for existing items
|
|
24
25
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Redraw items during scrolling
|
|
8
8
|
*/
|
|
9
9
|
import { createStore } from '@stencil/store';
|
|
10
|
-
import { addMissingItems, getFirstItem, getLastItem, getUpdatedItemsByPosition, isActiveRange, updateMissingAndRange } from './viewport.helpers';
|
|
10
|
+
import { addMissingItems, getFirstItem, getLastItem, getUpdatedItemsByPosition, isActiveRange, setItemSizes, updateMissingAndRange } from './viewport.helpers';
|
|
11
11
|
import { setStore } from '../../utils/store.utils';
|
|
12
12
|
function initialState(type) {
|
|
13
13
|
return {
|
|
@@ -82,9 +82,10 @@ export default class ViewportStore {
|
|
|
82
82
|
* Update viewport sizes for existing items
|
|
83
83
|
* This method is generating new item positions based on custom sizes and original sizes
|
|
84
84
|
* @param sizes - custom sizes for each item
|
|
85
|
+
* @param dropToOriginalSize - drop to original size if requested
|
|
85
86
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
setViewPortDimensionSizes(sizes, dropToOriginalSize) {
|
|
88
|
+
let items = [...this.store.get('items')];
|
|
88
89
|
const count = items.length;
|
|
89
90
|
// viewport not inited
|
|
90
91
|
if (!count) {
|
|
@@ -93,7 +94,12 @@ export default class ViewportStore {
|
|
|
93
94
|
let changedCoordinate = 0;
|
|
94
95
|
let i = 0;
|
|
95
96
|
let start = this.store.get('start');
|
|
97
|
+
// drop to original size if requested
|
|
98
|
+
if (dropToOriginalSize) {
|
|
99
|
+
items = setItemSizes(items, start, dropToOriginalSize, this.store.get('lastCoordinate'));
|
|
100
|
+
}
|
|
96
101
|
// loop through array from initial item after recombination
|
|
102
|
+
// if size change present, change position for all items after
|
|
97
103
|
while (i < count) {
|
|
98
104
|
const item = items[start];
|
|
99
105
|
// change pos if size change present before
|
|
@@ -101,7 +107,7 @@ export default class ViewportStore {
|
|
|
101
107
|
item.start += changedCoordinate;
|
|
102
108
|
item.end += changedCoordinate;
|
|
103
109
|
}
|
|
104
|
-
// change
|
|
110
|
+
// check if size change present
|
|
105
111
|
const size = sizes[item.itemIndex];
|
|
106
112
|
// size found
|
|
107
113
|
if (size) {
|
|
@@ -114,6 +120,7 @@ export default class ViewportStore {
|
|
|
114
120
|
// loop by start index
|
|
115
121
|
start++;
|
|
116
122
|
i++;
|
|
123
|
+
// if start index out of array, reset it
|
|
117
124
|
if (start === count) {
|
|
118
125
|
start = 0;
|
|
119
126
|
}
|
|
@@ -130,24 +137,9 @@ export default class ViewportStore {
|
|
|
130
137
|
if (!count) {
|
|
131
138
|
return;
|
|
132
139
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
// loop through array from initial item after recombination
|
|
137
|
-
while (i < count) {
|
|
138
|
-
const item = items[start];
|
|
139
|
-
item.start = pos;
|
|
140
|
-
item.size = size;
|
|
141
|
-
item.end = item.start + size;
|
|
142
|
-
pos = item.end;
|
|
143
|
-
// loop by start index
|
|
144
|
-
start++;
|
|
145
|
-
i++;
|
|
146
|
-
if (start === count) {
|
|
147
|
-
start = 0;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
setStore(this.store, { items: [...items] });
|
|
140
|
+
setStore(this.store, {
|
|
141
|
+
items: setItemSizes(items, this.store.get('start'), size, this.store.get('lastCoordinate'))
|
|
142
|
+
});
|
|
151
143
|
}
|
|
152
144
|
getItems() {
|
|
153
145
|
return {
|
|
@@ -21649,6 +21649,7 @@ class DimensionStore {
|
|
|
21649
21649
|
*/
|
|
21650
21650
|
setDimensionSize(sizes) {
|
|
21651
21651
|
const dimensionData = calculateDimensionData(this.store.get('originItemSize'), sizes);
|
|
21652
|
+
console.log(sizes);
|
|
21652
21653
|
setStore(this.store, dimensionData);
|
|
21653
21654
|
return dimensionData;
|
|
21654
21655
|
}
|
|
@@ -21714,7 +21715,7 @@ class DimensionProvider {
|
|
|
21714
21715
|
newSizes = Object.assign(Object.assign({}, oldSizes), sizes);
|
|
21715
21716
|
}
|
|
21716
21717
|
this.stores[type].setDimensionSize(newSizes);
|
|
21717
|
-
this.viewports.stores[type].
|
|
21718
|
+
this.viewports.stores[type].setViewPortDimensionSizes(newSizes, !keepOld ? this.stores[type].store.get('originItemSize') : undefined);
|
|
21718
21719
|
}
|
|
21719
21720
|
setItemCount(realCount, type) {
|
|
21720
21721
|
this.viewports.stores[type].setViewport({ realCount });
|
|
@@ -21729,7 +21730,7 @@ class DimensionProvider {
|
|
|
21729
21730
|
const allTrimmed = gatherTrimmedItems(trimmed);
|
|
21730
21731
|
const dimStoreType = this.stores[type];
|
|
21731
21732
|
dimStoreType.setStore({ trimmed: allTrimmed });
|
|
21732
|
-
this.viewports.stores[type].
|
|
21733
|
+
this.viewports.stores[type].setViewPortDimensionSizes(dimStoreType.store.get('sizes'));
|
|
21733
21734
|
}
|
|
21734
21735
|
/**
|
|
21735
21736
|
* Sets dimension data and view port coordinate
|
|
@@ -21985,6 +21986,41 @@ function getFirstItem(s) {
|
|
|
21985
21986
|
function getLastItem(s) {
|
|
21986
21987
|
return s.items[s.end];
|
|
21987
21988
|
}
|
|
21989
|
+
/**
|
|
21990
|
+
* Set items sizes from start index to end
|
|
21991
|
+
* @param vpItems
|
|
21992
|
+
* @param start
|
|
21993
|
+
* @param size
|
|
21994
|
+
* @param lastCoordinate
|
|
21995
|
+
* @returns
|
|
21996
|
+
*/
|
|
21997
|
+
function setItemSizes(vpItems, initialIndex, size, lastCoordinate) {
|
|
21998
|
+
const items = [...vpItems];
|
|
21999
|
+
const count = items.length;
|
|
22000
|
+
let pos = lastCoordinate;
|
|
22001
|
+
let i = 0;
|
|
22002
|
+
let start = initialIndex;
|
|
22003
|
+
// viewport not inited
|
|
22004
|
+
if (!count) {
|
|
22005
|
+
return [];
|
|
22006
|
+
}
|
|
22007
|
+
// loop through array from initial item after recombination
|
|
22008
|
+
while (i < count) {
|
|
22009
|
+
const item = items[start];
|
|
22010
|
+
item.start = pos;
|
|
22011
|
+
item.size = size;
|
|
22012
|
+
item.end = item.start + size;
|
|
22013
|
+
pos = item.end;
|
|
22014
|
+
// loop by start index
|
|
22015
|
+
start++;
|
|
22016
|
+
i++;
|
|
22017
|
+
// if start index out of array, reset it
|
|
22018
|
+
if (start === count) {
|
|
22019
|
+
start = 0;
|
|
22020
|
+
}
|
|
22021
|
+
}
|
|
22022
|
+
return items;
|
|
22023
|
+
}
|
|
21988
22024
|
|
|
21989
22025
|
/**
|
|
21990
22026
|
* Store is responsible for visible
|
|
@@ -22064,9 +22100,10 @@ class ViewportStore {
|
|
|
22064
22100
|
* Update viewport sizes for existing items
|
|
22065
22101
|
* This method is generating new item positions based on custom sizes and original sizes
|
|
22066
22102
|
* @param sizes - custom sizes for each item
|
|
22103
|
+
* @param dropToOriginalSize - drop to original size if requested
|
|
22067
22104
|
*/
|
|
22068
|
-
|
|
22069
|
-
|
|
22105
|
+
setViewPortDimensionSizes(sizes, dropToOriginalSize) {
|
|
22106
|
+
let items = [...this.store.get('items')];
|
|
22070
22107
|
const count = items.length;
|
|
22071
22108
|
// viewport not inited
|
|
22072
22109
|
if (!count) {
|
|
@@ -22075,7 +22112,12 @@ class ViewportStore {
|
|
|
22075
22112
|
let changedCoordinate = 0;
|
|
22076
22113
|
let i = 0;
|
|
22077
22114
|
let start = this.store.get('start');
|
|
22115
|
+
// drop to original size if requested
|
|
22116
|
+
if (dropToOriginalSize) {
|
|
22117
|
+
items = setItemSizes(items, start, dropToOriginalSize, this.store.get('lastCoordinate'));
|
|
22118
|
+
}
|
|
22078
22119
|
// loop through array from initial item after recombination
|
|
22120
|
+
// if size change present, change position for all items after
|
|
22079
22121
|
while (i < count) {
|
|
22080
22122
|
const item = items[start];
|
|
22081
22123
|
// change pos if size change present before
|
|
@@ -22083,7 +22125,7 @@ class ViewportStore {
|
|
|
22083
22125
|
item.start += changedCoordinate;
|
|
22084
22126
|
item.end += changedCoordinate;
|
|
22085
22127
|
}
|
|
22086
|
-
// change
|
|
22128
|
+
// check if size change present
|
|
22087
22129
|
const size = sizes[item.itemIndex];
|
|
22088
22130
|
// size found
|
|
22089
22131
|
if (size) {
|
|
@@ -22096,6 +22138,7 @@ class ViewportStore {
|
|
|
22096
22138
|
// loop by start index
|
|
22097
22139
|
start++;
|
|
22098
22140
|
i++;
|
|
22141
|
+
// if start index out of array, reset it
|
|
22099
22142
|
if (start === count) {
|
|
22100
22143
|
start = 0;
|
|
22101
22144
|
}
|
|
@@ -22112,24 +22155,9 @@ class ViewportStore {
|
|
|
22112
22155
|
if (!count) {
|
|
22113
22156
|
return;
|
|
22114
22157
|
}
|
|
22115
|
-
|
|
22116
|
-
|
|
22117
|
-
|
|
22118
|
-
// loop through array from initial item after recombination
|
|
22119
|
-
while (i < count) {
|
|
22120
|
-
const item = items[start];
|
|
22121
|
-
item.start = pos;
|
|
22122
|
-
item.size = size;
|
|
22123
|
-
item.end = item.start + size;
|
|
22124
|
-
pos = item.end;
|
|
22125
|
-
// loop by start index
|
|
22126
|
-
start++;
|
|
22127
|
-
i++;
|
|
22128
|
-
if (start === count) {
|
|
22129
|
-
start = 0;
|
|
22130
|
-
}
|
|
22131
|
-
}
|
|
22132
|
-
setStore(this.store, { items: [...items] });
|
|
22158
|
+
setStore(this.store, {
|
|
22159
|
+
items: setItemSizes(items, this.store.get('start'), size, this.store.get('lastCoordinate'))
|
|
22160
|
+
});
|
|
22133
22161
|
}
|
|
22134
22162
|
getItems() {
|
|
22135
22163
|
return {
|