@deephaven/grid 0.13.3-beta.2 → 0.13.9-uuid-filter.2
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/Grid.d.ts +1 -1
- package/dist/Grid.d.ts.map +1 -1
- package/dist/Grid.js +1 -1
- package/dist/Grid.js.map +1 -1
- package/dist/GridMetricCalculator.d.ts +2 -2
- package/dist/GridMetricCalculator.d.ts.map +1 -1
- package/dist/GridMetricCalculator.js.map +1 -1
- package/dist/GridMetrics.d.ts.map +1 -1
- package/dist/GridRenderer.d.ts +2 -2
- package/dist/GridRenderer.d.ts.map +1 -1
- package/dist/GridRenderer.js.map +1 -1
- package/dist/GridUtils.d.ts +5 -21
- package/dist/GridUtils.d.ts.map +1 -1
- package/dist/GridUtils.js +68 -114
- package/dist/GridUtils.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/GridUtils.d.ts
CHANGED
|
@@ -5,12 +5,9 @@ import type { GridMetrics } from './GridMetrics';
|
|
|
5
5
|
import { GridTheme } from './GridTheme';
|
|
6
6
|
import { GridWheelEvent } from './GridMouseHandler';
|
|
7
7
|
declare type Range<T> = [start: T, end: T];
|
|
8
|
-
export declare type AxisRange = Range<
|
|
9
|
-
export declare type BoundedAxisRange = Range<
|
|
10
|
-
export declare
|
|
11
|
-
export declare function assertAxisRange(range: unknown): asserts range is AxisRange;
|
|
12
|
-
export declare function isBoundedAxisRange(range: unknown): range is BoundedAxisRange;
|
|
13
|
-
export declare function assertBoundedAxisRange(range: unknown): asserts range is BoundedAxisRange;
|
|
8
|
+
export declare type AxisRange = Range<VisibleIndex>;
|
|
9
|
+
export declare type BoundedAxisRange = Range<number>;
|
|
10
|
+
export declare type GridAxisRange = Range<GridRangeIndex>;
|
|
14
11
|
export declare type GridPoint = {
|
|
15
12
|
x: Coordinate;
|
|
16
13
|
y: Coordinate;
|
|
@@ -217,19 +214,6 @@ export declare class GridUtils {
|
|
|
217
214
|
* @returns The new reordered items
|
|
218
215
|
*/
|
|
219
216
|
static moveItem(from: VisibleIndex, to: VisibleIndex, oldMovedItems?: MoveOperation[]): MoveOperation[];
|
|
220
|
-
/**
|
|
221
|
-
* Move a visible range in the grid
|
|
222
|
-
*
|
|
223
|
-
* This will effectively slice the range out of the grid,
|
|
224
|
-
* re-index the remaining columns,
|
|
225
|
-
* then insert the range with the first element at the provided index
|
|
226
|
-
*
|
|
227
|
-
* @param from The visible axis range to move
|
|
228
|
-
* @param to The visible index to move the start of the range to
|
|
229
|
-
* @param oldMovedItems The old reordered items
|
|
230
|
-
* @returns The new reordered items
|
|
231
|
-
*/
|
|
232
|
-
static moveRange(from: BoundedAxisRange, to: VisibleIndex, oldMovedItems?: MoveOperation[]): MoveOperation[];
|
|
233
217
|
/**
|
|
234
218
|
* Retrieve the model index given the currently moved items
|
|
235
219
|
* @param visibleIndex The visible index of the item to get the model index for
|
|
@@ -264,7 +248,7 @@ export declare class GridUtils {
|
|
|
264
248
|
* @param movedItems Moved item pairs in this dimension
|
|
265
249
|
* @returns Array of start/end pairs of the indexes after transformations applied.
|
|
266
250
|
*/
|
|
267
|
-
static getModelRangeIndexes(start: GridRangeIndex, end: GridRangeIndex, movedItems: MoveOperation[]):
|
|
251
|
+
static getModelRangeIndexes(start: GridRangeIndex, end: GridRangeIndex, movedItems: MoveOperation[]): GridAxisRange[];
|
|
268
252
|
/**
|
|
269
253
|
* Translate the provided UI range into model range, using the `movedColumns` and `movedRows` to apply the necessary transforms.
|
|
270
254
|
* `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items
|
|
@@ -294,7 +278,7 @@ export declare class GridUtils {
|
|
|
294
278
|
* @param movedItems Moved item pairs in this dimension
|
|
295
279
|
* @returns Array of start/end pairs of the indexes after transformations applied.
|
|
296
280
|
*/
|
|
297
|
-
static getVisibleRangeIndexes(start: GridRangeIndex, end: GridRangeIndex, movedItems: MoveOperation[]):
|
|
281
|
+
static getVisibleRangeIndexes(start: GridRangeIndex, end: GridRangeIndex, movedItems: MoveOperation[]): GridAxisRange[];
|
|
298
282
|
/**
|
|
299
283
|
* Translate the provided UI range into model range, using the `movedColumns` and `movedRows` to apply the necessary transforms.
|
|
300
284
|
* `movedColumns` and `movedRows` are array of operations done to the UI indexes to re-order items
|
package/dist/GridUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridUtils.d.ts","sourceRoot":"","sources":["../src/GridUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,EAAE,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,aAAa,EACb,OAAO,EACR,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,aAAK,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAEnC,oBAAY,SAAS,GAAG,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"GridUtils.d.ts","sourceRoot":"","sources":["../src/GridUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,EAAE,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,aAAa,EACb,OAAO,EACR,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE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;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAC1B,OAAO,EAAE,UAAU,EAAE,EACrB,gBAAgB,EAAE,YAAY,GAC7B,OAAO;IAOV;;;;;;;OAOG;IACH,MAAM,CAAC,mBAAmB,CACxB,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,cAAc,GACrB,cAAc;IAyCjB;;;;;;;;;OASG;IACH,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,cAAc,EAC1B,SAAS,SAAO,EAChB,UAAU,SAAM,EAChB,SAAS,SAAK,EACd,UAAU,SAAK,GACd;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CA6CtC;AAED,eAAe,SAAS,CAAC"}
|
package/dist/GridUtils.js
CHANGED
|
@@ -5,22 +5,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import GridRange from "./GridRange.js";
|
|
8
|
-
export function isAxisRange(range) {
|
|
9
|
-
return Array.isArray(range) && range.length === 2 && (range[0] === null || typeof range[0] === 'number') && (range[1] === null || typeof range[1] === 'number');
|
|
10
|
-
}
|
|
11
|
-
export function assertAxisRange(range) {
|
|
12
|
-
if (!isAxisRange(range)) {
|
|
13
|
-
throw new Error("Expected axis range. Received: ".concat(range));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export function isBoundedAxisRange(range) {
|
|
17
|
-
return isAxisRange(range) && range[0] != null && range[1] != null;
|
|
18
|
-
}
|
|
19
|
-
export function assertBoundedAxisRange(range) {
|
|
20
|
-
if (!isBoundedAxisRange(range)) {
|
|
21
|
-
throw new Error("Expected bounded axis range. Received: ".concat(range));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
8
|
export class GridUtils {
|
|
25
9
|
// use same constant as chrome source for windows
|
|
26
10
|
// https://github.com/chromium/chromium/blob/973af9d461b6b5dc60208c8d3d66adc27e53da78/ui/events/blink/web_input_event_builders_win.cc#L285
|
|
@@ -661,44 +645,6 @@ export class GridUtils {
|
|
|
661
645
|
|
|
662
646
|
return movedItems;
|
|
663
647
|
}
|
|
664
|
-
/**
|
|
665
|
-
* Move a visible range in the grid
|
|
666
|
-
*
|
|
667
|
-
* This will effectively slice the range out of the grid,
|
|
668
|
-
* re-index the remaining columns,
|
|
669
|
-
* then insert the range with the first element at the provided index
|
|
670
|
-
*
|
|
671
|
-
* @param from The visible axis range to move
|
|
672
|
-
* @param to The visible index to move the start of the range to
|
|
673
|
-
* @param oldMovedItems The old reordered items
|
|
674
|
-
* @returns The new reordered items
|
|
675
|
-
*/
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
static moveRange(from, to) {
|
|
679
|
-
var oldMovedItems = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
680
|
-
|
|
681
|
-
if (from[0] === to) {
|
|
682
|
-
return oldMovedItems;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
var movedItems = [...oldMovedItems];
|
|
686
|
-
var lastMovedItem = movedItems[movedItems.length - 1];
|
|
687
|
-
|
|
688
|
-
if (lastMovedItem && isBoundedAxisRange(lastMovedItem.from) && lastMovedItem.from[1] - lastMovedItem.from[0] === from[1] - from[0] && lastMovedItem.to === from[0]) {
|
|
689
|
-
movedItems[movedItems.length - 1] = _objectSpread(_objectSpread({}, movedItems[movedItems.length - 1]), {}, {
|
|
690
|
-
to
|
|
691
|
-
});
|
|
692
|
-
} else {
|
|
693
|
-
// TODO #620
|
|
694
|
-
movedItems.push({
|
|
695
|
-
from: from,
|
|
696
|
-
to
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
return movedItems;
|
|
701
|
-
}
|
|
702
648
|
/**
|
|
703
649
|
* Retrieve the model index given the currently moved items
|
|
704
650
|
* @param visibleIndex The visible index of the item to get the model index for
|
|
@@ -726,82 +672,94 @@ export class GridUtils {
|
|
|
726
672
|
var reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
727
673
|
var result = [[start, end]];
|
|
728
674
|
|
|
729
|
-
var
|
|
675
|
+
for (var i = reverse ? movedItems.length - 1 : 0; reverse ? i >= 0 : i < movedItems.length; reverse ? i -= 1 : i += 1) {
|
|
730
676
|
var {
|
|
731
|
-
from:
|
|
677
|
+
from: fromItem,
|
|
732
678
|
to: toItem
|
|
733
679
|
} = movedItems[i];
|
|
734
|
-
var
|
|
735
|
-
var
|
|
736
|
-
|
|
737
|
-
if (isBoundedAxisRange(fromItemOrRange)) {
|
|
738
|
-
length = fromItemOrRange[1] - fromItemOrRange[0] + 1; // Ranges are inclusive
|
|
739
|
-
|
|
740
|
-
[fromItem] = fromItemOrRange;
|
|
741
|
-
} else {
|
|
742
|
-
fromItem = fromItemOrRange;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
var fromStart = reverse ? toItem : fromItem;
|
|
746
|
-
var fromEnd = fromStart + length - 1;
|
|
747
|
-
var toStart = reverse ? fromItem : toItem;
|
|
748
|
-
var moveDistance = toStart - fromStart;
|
|
680
|
+
var from = reverse ? toItem : fromItem;
|
|
681
|
+
var to = reverse ? fromItem : toItem;
|
|
749
682
|
var nextResult = [];
|
|
750
683
|
|
|
751
|
-
var
|
|
684
|
+
for (var j = 0; j < result.length; j += 1) {
|
|
752
685
|
var _result$j$, _result$j$2;
|
|
753
686
|
|
|
754
687
|
var currentStart = (_result$j$ = result[j][0]) !== null && _result$j$ !== void 0 ? _result$j$ : Number.NEGATIVE_INFINITY;
|
|
755
688
|
var currentEnd = (_result$j$2 = result[j][1]) !== null && _result$j$2 !== void 0 ? _result$j$2 : Number.POSITIVE_INFINITY;
|
|
756
|
-
var
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
if (fromStart <= s && fromEnd >= e) {
|
|
769
|
-
// Current range in moved range
|
|
770
|
-
movedRange = [s + moveDistance, e + moveDistance];
|
|
771
|
-
return movedRange;
|
|
689
|
+
var startLength = nextResult.length;
|
|
690
|
+
|
|
691
|
+
if (from < currentStart) {
|
|
692
|
+
// From before
|
|
693
|
+
if (to >= currentEnd) {
|
|
694
|
+
// To after
|
|
695
|
+
nextResult.push([currentStart - 1, currentEnd - 1]);
|
|
696
|
+
} else if (to >= currentStart) {
|
|
697
|
+
// To within
|
|
698
|
+
nextResult.push([currentStart - 1, to - 1]);
|
|
699
|
+
nextResult.push([to + 1, currentEnd]);
|
|
772
700
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
701
|
+
} else if (from > currentEnd) {
|
|
702
|
+
// From after
|
|
703
|
+
if (to <= currentStart) {
|
|
704
|
+
// To before
|
|
705
|
+
nextResult.push([currentStart + 1, currentEnd + 1]);
|
|
706
|
+
} else if (to <= currentEnd) {
|
|
707
|
+
// To within
|
|
708
|
+
nextResult.push([currentStart, to - 1]);
|
|
709
|
+
nextResult.push([to + 1, currentEnd + 1]);
|
|
710
|
+
}
|
|
711
|
+
} else if (to < currentStart) {
|
|
712
|
+
// From within to before
|
|
713
|
+
if (from > currentStart) {
|
|
714
|
+
nextResult.push([currentStart + 1, from]);
|
|
777
715
|
}
|
|
778
716
|
|
|
779
|
-
|
|
780
|
-
}).map(range => {
|
|
781
|
-
var [s, e] = range;
|
|
717
|
+
nextResult.push([to, to]);
|
|
782
718
|
|
|
783
|
-
if (
|
|
784
|
-
|
|
785
|
-
return [[s, toStart - 1], [toStart + length, e + length]];
|
|
719
|
+
if (from < currentEnd) {
|
|
720
|
+
nextResult.push([from + 1, currentEnd]);
|
|
786
721
|
}
|
|
722
|
+
} else if (to > currentEnd) {
|
|
723
|
+
// From within to after
|
|
724
|
+
if (from > currentStart) {
|
|
725
|
+
nextResult.push([currentStart, from - 1]);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
nextResult.push([to, to]);
|
|
787
729
|
|
|
788
|
-
if (
|
|
789
|
-
|
|
790
|
-
return [range];
|
|
730
|
+
if (from < currentEnd) {
|
|
731
|
+
nextResult.push([from, currentEnd - 1]);
|
|
791
732
|
}
|
|
733
|
+
} else if (from > to) {
|
|
734
|
+
// From within after to within before
|
|
735
|
+
if (to > currentStart) {
|
|
736
|
+
nextResult.push([currentStart, to - 1]);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
nextResult.push([to + 1, from]);
|
|
740
|
+
nextResult.push([to, to]);
|
|
792
741
|
|
|
793
|
-
if (
|
|
794
|
-
|
|
795
|
-
|
|
742
|
+
if (from < currentEnd) {
|
|
743
|
+
nextResult.push([from + 1, currentEnd]);
|
|
744
|
+
}
|
|
745
|
+
} else if (from < to) {
|
|
746
|
+
// From within before to within after
|
|
747
|
+
if (from > currentStart) {
|
|
748
|
+
nextResult.push([currentStart, from - 1]);
|
|
796
749
|
}
|
|
797
750
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
nextResult.push(...currentResult);
|
|
801
|
-
};
|
|
751
|
+
nextResult.push([to, to]);
|
|
752
|
+
nextResult.push([from, to - 1]);
|
|
802
753
|
|
|
803
|
-
|
|
804
|
-
|
|
754
|
+
if (to < currentEnd) {
|
|
755
|
+
nextResult.push([to + 1, currentEnd]);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
if (startLength === nextResult.length) {
|
|
760
|
+
// No modifications were made, add the original range indexes
|
|
761
|
+
nextResult.push([currentStart, currentEnd]);
|
|
762
|
+
}
|
|
805
763
|
} // Return infinity values back to null
|
|
806
764
|
|
|
807
765
|
|
|
@@ -809,10 +767,6 @@ export class GridUtils {
|
|
|
809
767
|
var [s, e] = _ref;
|
|
810
768
|
return [Number.isFinite(s) ? s : null, Number.isFinite(e) ? e : null];
|
|
811
769
|
});
|
|
812
|
-
};
|
|
813
|
-
|
|
814
|
-
for (var i = reverse ? movedItems.length - 1 : 0; reverse ? i >= 0 : i < movedItems.length; reverse ? i -= 1 : i += 1) {
|
|
815
|
-
_loop(i);
|
|
816
770
|
}
|
|
817
771
|
|
|
818
772
|
return result;
|