@vuu-ui/vuu-utils 2.1.19-beta.4 → 2.2.0
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/cjs/packages/vuu-utils/src/index.js +1 -0
- package/cjs/packages/vuu-utils/src/index.js.map +1 -1
- package/cjs/packages/vuu-utils/src/range-utils.js +32 -7
- package/cjs/packages/vuu-utils/src/range-utils.js.map +1 -1
- package/esm/packages/vuu-utils/src/index.js +1 -1
- package/esm/packages/vuu-utils/src/range-utils.js +32 -8
- package/esm/packages/vuu-utils/src/range-utils.js.map +1 -1
- package/package.json +6 -6
- package/types/range-utils.d.ts +2 -1
|
@@ -414,6 +414,7 @@ exports.isVuuMenuRpcRequest = protocolMessageUtils.isVuuMenuRpcRequest;
|
|
|
414
414
|
exports.NULL_RANGE = rangeUtils.NULL_RANGE;
|
|
415
415
|
exports.Range = rangeUtils.Range;
|
|
416
416
|
exports.WindowRange = rangeUtils.WindowRange;
|
|
417
|
+
exports.constrainRange = rangeUtils.constrainRange;
|
|
417
418
|
exports.getFullRange = rangeUtils.getFullRange;
|
|
418
419
|
exports.rangeNewItems = rangeUtils.rangeNewItems;
|
|
419
420
|
exports.withinRange = rangeUtils.withinRange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -52,28 +52,28 @@ _baseTo = new WeakMap();
|
|
|
52
52
|
let RangeImpl = _RangeImpl;
|
|
53
53
|
const Range = (from, to, renderBufferSize) => new RangeImpl(from, to, renderBufferSize);
|
|
54
54
|
const NULL_RANGE = Range(0, 0);
|
|
55
|
-
function getFullRange({ from, to }, bufferSize = 0,
|
|
55
|
+
function getFullRange({ from, to }, bufferSize = 0, maxRangeEnd = Number.MAX_SAFE_INTEGER) {
|
|
56
56
|
if (from === 0 && to === 0) {
|
|
57
57
|
return { from, to };
|
|
58
58
|
} else if (bufferSize === 0) {
|
|
59
|
-
if (
|
|
59
|
+
if (maxRangeEnd < from) {
|
|
60
60
|
return { from: 0, to: 0 };
|
|
61
61
|
} else {
|
|
62
|
-
return { from, to: Math.min(to,
|
|
62
|
+
return { from, to: Math.min(to, maxRangeEnd) };
|
|
63
63
|
}
|
|
64
64
|
} else if (from === 0) {
|
|
65
|
-
return { from, to: Math.min(to + bufferSize,
|
|
65
|
+
return { from, to: Math.min(to + bufferSize, maxRangeEnd) };
|
|
66
66
|
} else {
|
|
67
67
|
const shortfallBefore = from - bufferSize < 0;
|
|
68
|
-
const shortfallAfter =
|
|
68
|
+
const shortfallAfter = maxRangeEnd - (to + bufferSize) < 0;
|
|
69
69
|
if (shortfallBefore && shortfallAfter) {
|
|
70
|
-
return { from: 0, to:
|
|
70
|
+
return { from: 0, to: maxRangeEnd };
|
|
71
71
|
} else if (shortfallBefore) {
|
|
72
72
|
return { from: 0, to: to + bufferSize };
|
|
73
73
|
} else if (shortfallAfter) {
|
|
74
74
|
return {
|
|
75
75
|
from: Math.max(0, from - bufferSize),
|
|
76
|
-
to:
|
|
76
|
+
to: maxRangeEnd
|
|
77
77
|
};
|
|
78
78
|
} else {
|
|
79
79
|
return { from: from - bufferSize, to: to + bufferSize };
|
|
@@ -105,10 +105,35 @@ class WindowRange {
|
|
|
105
105
|
return new WindowRange(this.from, this.to);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
+
const constrainRangeWidth = (range, maxRangeWidth = Number.MAX_SAFE_INTEGER) => {
|
|
109
|
+
if (range.to - range.from < maxRangeWidth) {
|
|
110
|
+
return range;
|
|
111
|
+
}
|
|
112
|
+
console.warn(`[range-utils] range ${range.from} - ${range.to} exceeds maxRangeWidth ${maxRangeWidth} for this table `);
|
|
113
|
+
return {
|
|
114
|
+
from: range.from,
|
|
115
|
+
to: range.from + maxRangeWidth
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
const constrainRange = (range, maxRangeEnd, maxRangeWidth) => {
|
|
119
|
+
if (maxRangeEnd > 0 && maxRangeEnd < range.to) {
|
|
120
|
+
if (maxRangeEnd > range.from) {
|
|
121
|
+
return constrainRangeWidth({
|
|
122
|
+
from: range.from,
|
|
123
|
+
to: maxRangeEnd
|
|
124
|
+
}, maxRangeWidth);
|
|
125
|
+
} else {
|
|
126
|
+
throw Error(`constrainRange: cannot apply the maxRangeEnd ${maxRangeEnd} to range ${range.from} - ${range.to}`);
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
return constrainRangeWidth(range, maxRangeWidth);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
108
132
|
|
|
109
133
|
exports.NULL_RANGE = NULL_RANGE;
|
|
110
134
|
exports.Range = Range;
|
|
111
135
|
exports.WindowRange = WindowRange;
|
|
136
|
+
exports.constrainRange = constrainRange;
|
|
112
137
|
exports.getFullRange = getFullRange;
|
|
113
138
|
exports.rangeNewItems = rangeNewItems;
|
|
114
139
|
exports.withinRange = withinRange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-utils.js","sources":["../../../../../../packages/vuu-utils/src/range-utils.ts"],"sourcesContent":["import { VuuRange } from \"@vuu-ui/vuu-protocol-types\";\n\ninterface FromToRange {\n from: number;\n to: number;\n}\n\nexport interface Range extends VuuRange {\n equals: (vuuRange: VuuRange) => boolean;\n reset: Range;\n withBuffer: VuuRange;\n}\n\nexport interface RangeOptions {\n renderBufferSize?: number;\n rowCount?: number;\n}\n\nclass RangeImpl implements Range {\n #baseFrom: number;\n #renderBufferSize = 0;\n #baseTo: number;\n\n // We have to keep from and to as simple public properties (not getters) so they survive structuredClone\n constructor(\n /** Index position of first visible row in viewport */\n public from: number,\n /** Index position of last visible row in viewport + 1 */\n public to: number,\n renderBufferSize = 0,\n ) {\n this.#baseFrom = from;\n this.#baseTo = to;\n this.#renderBufferSize = renderBufferSize;\n }\n\n get reset() {\n return new RangeImpl(\n 0,\n this.#baseTo - this.#baseFrom,\n this.#renderBufferSize,\n );\n }\n\n get withBuffer() {\n return getFullRange(this, this.#renderBufferSize);\n }\n\n equals(range: VuuRange) {\n return range.from === this.#baseFrom && range.to === this.#baseTo;\n }\n\n toJson() {\n return {\n from: this.from,\n to: this.to,\n baseFrom: this.#baseFrom,\n baseTo: this.#baseTo,\n renderBufferSize: this.#renderBufferSize,\n };\n }\n}\n\nexport const Range = (\n from: number,\n to: number,\n renderBufferSize?: number,\n): Range => new RangeImpl(from, to, renderBufferSize);\n\nexport const NULL_RANGE = Range(0, 0);\n\nexport function getFullRange(\n { from, to }: VuuRange,\n bufferSize = 0,\n
|
|
1
|
+
{"version":3,"file":"range-utils.js","sources":["../../../../../../packages/vuu-utils/src/range-utils.ts"],"sourcesContent":["import { VuuRange } from \"@vuu-ui/vuu-protocol-types\";\n\ninterface FromToRange {\n from: number;\n to: number;\n}\n\nexport interface Range extends VuuRange {\n equals: (vuuRange: VuuRange) => boolean;\n reset: Range;\n withBuffer: VuuRange;\n}\n\nexport interface RangeOptions {\n renderBufferSize?: number;\n rowCount?: number;\n}\n\nclass RangeImpl implements Range {\n #baseFrom: number;\n #renderBufferSize = 0;\n #baseTo: number;\n\n // We have to keep from and to as simple public properties (not getters) so they survive structuredClone\n constructor(\n /** Index position of first visible row in viewport */\n public from: number,\n /** Index position of last visible row in viewport + 1 */\n public to: number,\n renderBufferSize = 0,\n ) {\n this.#baseFrom = from;\n this.#baseTo = to;\n this.#renderBufferSize = renderBufferSize;\n }\n\n get reset() {\n return new RangeImpl(\n 0,\n this.#baseTo - this.#baseFrom,\n this.#renderBufferSize,\n );\n }\n\n get withBuffer() {\n return getFullRange(this, this.#renderBufferSize);\n }\n\n equals(range: VuuRange) {\n return range.from === this.#baseFrom && range.to === this.#baseTo;\n }\n\n toJson() {\n return {\n from: this.from,\n to: this.to,\n baseFrom: this.#baseFrom,\n baseTo: this.#baseTo,\n renderBufferSize: this.#renderBufferSize,\n };\n }\n}\n\nexport const Range = (\n from: number,\n to: number,\n renderBufferSize?: number,\n): Range => new RangeImpl(from, to, renderBufferSize);\n\nexport const NULL_RANGE = Range(0, 0);\n\nexport function getFullRange(\n { from, to }: VuuRange,\n bufferSize = 0,\n maxRangeEnd: number = Number.MAX_SAFE_INTEGER,\n): FromToRange {\n if (from === 0 && to === 0) {\n return { from, to };\n } else if (bufferSize === 0) {\n if (maxRangeEnd < from) {\n return { from: 0, to: 0 };\n } else {\n return { from, to: Math.min(to, maxRangeEnd) };\n }\n } else if (from === 0) {\n return { from, to: Math.min(to + bufferSize, maxRangeEnd) };\n } else {\n const shortfallBefore = from - bufferSize < 0;\n const shortfallAfter = maxRangeEnd - (to + bufferSize) < 0;\n if (shortfallBefore && shortfallAfter) {\n return { from: 0, to: maxRangeEnd };\n } else if (shortfallBefore) {\n return { from: 0, to: to + bufferSize };\n } else if (shortfallAfter) {\n return {\n from: Math.max(0, from - bufferSize),\n to: maxRangeEnd,\n };\n } else {\n return { from: from - bufferSize, to: to + bufferSize };\n }\n }\n}\n\nexport const withinRange = (value: number, { from, to }: VuuRange) =>\n value >= from && value < to;\n\nexport const rangeNewItems = (\n { from: from1, to: to1 }: VuuRange,\n newRange: VuuRange,\n): VuuRange => {\n const { from: from2, to: to2 } = newRange;\n const noOverlap = from2 >= to1 || to2 <= from1;\n const newFullySubsumesOld = from2 < from1 && to2 > to1;\n return noOverlap || newFullySubsumesOld\n ? newRange\n : to2 > to1\n ? { from: to1, to: to2 }\n : { from: from2, to: from1 };\n};\n\nexport class WindowRange {\n public from: number;\n public to: number;\n\n constructor(from: number, to: number) {\n this.from = from;\n this.to = to;\n }\n\n public isWithin(index: number) {\n return withinRange(index, this);\n }\n\n //find the overlap of this range and a new one\n public overlap(from: number, to: number): [number, number] {\n return from >= this.to || to < this.from\n ? [0, 0]\n : [Math.max(from, this.from), Math.min(to, this.to)];\n }\n\n public copy(): WindowRange {\n return new WindowRange(this.from, this.to);\n }\n}\n\n\nconst constrainRangeWidth = (range: VuuRange, maxRangeWidth = Number.MAX_SAFE_INTEGER) => {\n if (range.to - range.from < maxRangeWidth) {\n return range;\n }\n console.warn(`[range-utils] range ${range.from} - ${range.to} exceeds maxRangeWidth ${maxRangeWidth} for this table `);\n return {\n from: range.from,\n to: range.from + maxRangeWidth\n }\n}\nexport const constrainRange = (range: VuuRange, maxRangeEnd: number, maxRangeWidth?: number) => {\n if (maxRangeEnd > 0 && maxRangeEnd < range.to) {\n if (maxRangeEnd > range.from) {\n return constrainRangeWidth({\n from: range.from,\n to: maxRangeEnd\n }, maxRangeWidth);\n } else {\n throw Error(`constrainRange: cannot apply the maxRangeEnd ${maxRangeEnd} to range ${range.from} - ${range.to}`);\n }\n } else {\n return constrainRangeWidth(range, maxRangeWidth);\n }\n}"],"names":[],"mappings":";;;;;;;;;;;;AAAA,IAAA,SAAA,EAAA,iBAAA,EAAA,OAAA;AAkBA,MAAM,UAAA,GAAN,MAAM,UAA2B,CAAA;AAAA;AAAA,EAM/B,WAES,CAAA,IAAA,EAEA,EACP,EAAA,gBAAA,GAAmB,CACnB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A;AAAA,SACH,aAAa,CAAA;AAAA,KACX,MAAA;AACL,MAAM,MAAA,KAAA,CAAM,gDAAgD,WAAW,CAAA,UAAA,EAAa,MAAM,IAAI,CAAA,GAAA,EAAM,KAAM,CAAA,EAAE,CAAE,CAAA,CAAA;AAAA;AAChH,GACK,MAAA;AACL,IAAO,OAAA,mBAAA,CAAoB,OAAO,aAAa,CAAA;AAAA;AAEnD;;;;;;;;;;"}
|
|
@@ -48,7 +48,7 @@ export { uuid } from './nanoid/index.js';
|
|
|
48
48
|
export { debounce, throttle } from './perf-utils.js';
|
|
49
49
|
export { DeferredPromise } from './promise-utils.js';
|
|
50
50
|
export { INVALID_SESSION, INVALID_TOKEN, SESSION_LIMIT_EXCEEDED, TOKEN_EXPIRED, hasViewPortContext, isActionMessage, isAddRowRpcRequest, isBeginEditSessionRpcRequest, isCreateSessionTableRpcRequest, isCreateVpSuccess, isCustomComponentActionMessage, isDeleteSelectedRowsRpcRequest, isEditCellRpcRequest, isEndEditSessionRpcRequest, isErrorMessage, isLoginErrorMessage, isLoginResponse, isNumericType, isOpenDialogAction, isOpenSessionTableDialogMessage, isRequestResponse, isRpcError, isRpcServiceRequest, isRpcSuccess, isSelectRequest, isSelectSuccessWithRowCount, isSessionTable, isSessionTableActionMessage, isTypeaheadRequest, isUndoRowChangeRpcRequest, isVuuMenuRpcRequest } from './protocol-message-utils.js';
|
|
51
|
-
export { NULL_RANGE, Range, WindowRange, getFullRange, rangeNewItems, withinRange } from './range-utils.js';
|
|
51
|
+
export { NULL_RANGE, Range, WindowRange, constrainRange, getFullRange, rangeNewItems, withinRange } from './range-utils.js';
|
|
52
52
|
export { asReactElements, createSyntheticEvent, isSimpleStateValue, useIsMounted, useStableReference } from './react-utils.js';
|
|
53
53
|
export { exceedsMaxSafeInteger, roundDecimal, roundScaledDecimal } from './round-decimal.js';
|
|
54
54
|
export { actualRowPositioning, asDataSourceRowObject, virtualRowPositioning, vuuRowToDataSourceRow } from './row-utils.js';
|
|
@@ -50,28 +50,28 @@ _baseTo = new WeakMap();
|
|
|
50
50
|
let RangeImpl = _RangeImpl;
|
|
51
51
|
const Range = (from, to, renderBufferSize) => new RangeImpl(from, to, renderBufferSize);
|
|
52
52
|
const NULL_RANGE = Range(0, 0);
|
|
53
|
-
function getFullRange({ from, to }, bufferSize = 0,
|
|
53
|
+
function getFullRange({ from, to }, bufferSize = 0, maxRangeEnd = Number.MAX_SAFE_INTEGER) {
|
|
54
54
|
if (from === 0 && to === 0) {
|
|
55
55
|
return { from, to };
|
|
56
56
|
} else if (bufferSize === 0) {
|
|
57
|
-
if (
|
|
57
|
+
if (maxRangeEnd < from) {
|
|
58
58
|
return { from: 0, to: 0 };
|
|
59
59
|
} else {
|
|
60
|
-
return { from, to: Math.min(to,
|
|
60
|
+
return { from, to: Math.min(to, maxRangeEnd) };
|
|
61
61
|
}
|
|
62
62
|
} else if (from === 0) {
|
|
63
|
-
return { from, to: Math.min(to + bufferSize,
|
|
63
|
+
return { from, to: Math.min(to + bufferSize, maxRangeEnd) };
|
|
64
64
|
} else {
|
|
65
65
|
const shortfallBefore = from - bufferSize < 0;
|
|
66
|
-
const shortfallAfter =
|
|
66
|
+
const shortfallAfter = maxRangeEnd - (to + bufferSize) < 0;
|
|
67
67
|
if (shortfallBefore && shortfallAfter) {
|
|
68
|
-
return { from: 0, to:
|
|
68
|
+
return { from: 0, to: maxRangeEnd };
|
|
69
69
|
} else if (shortfallBefore) {
|
|
70
70
|
return { from: 0, to: to + bufferSize };
|
|
71
71
|
} else if (shortfallAfter) {
|
|
72
72
|
return {
|
|
73
73
|
from: Math.max(0, from - bufferSize),
|
|
74
|
-
to:
|
|
74
|
+
to: maxRangeEnd
|
|
75
75
|
};
|
|
76
76
|
} else {
|
|
77
77
|
return { from: from - bufferSize, to: to + bufferSize };
|
|
@@ -103,6 +103,30 @@ class WindowRange {
|
|
|
103
103
|
return new WindowRange(this.from, this.to);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
const constrainRangeWidth = (range, maxRangeWidth = Number.MAX_SAFE_INTEGER) => {
|
|
107
|
+
if (range.to - range.from < maxRangeWidth) {
|
|
108
|
+
return range;
|
|
109
|
+
}
|
|
110
|
+
console.warn(`[range-utils] range ${range.from} - ${range.to} exceeds maxRangeWidth ${maxRangeWidth} for this table `);
|
|
111
|
+
return {
|
|
112
|
+
from: range.from,
|
|
113
|
+
to: range.from + maxRangeWidth
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
const constrainRange = (range, maxRangeEnd, maxRangeWidth) => {
|
|
117
|
+
if (maxRangeEnd > 0 && maxRangeEnd < range.to) {
|
|
118
|
+
if (maxRangeEnd > range.from) {
|
|
119
|
+
return constrainRangeWidth({
|
|
120
|
+
from: range.from,
|
|
121
|
+
to: maxRangeEnd
|
|
122
|
+
}, maxRangeWidth);
|
|
123
|
+
} else {
|
|
124
|
+
throw Error(`constrainRange: cannot apply the maxRangeEnd ${maxRangeEnd} to range ${range.from} - ${range.to}`);
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
return constrainRangeWidth(range, maxRangeWidth);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
106
130
|
|
|
107
|
-
export { NULL_RANGE, Range, WindowRange, getFullRange, rangeNewItems, withinRange };
|
|
131
|
+
export { NULL_RANGE, Range, WindowRange, constrainRange, getFullRange, rangeNewItems, withinRange };
|
|
108
132
|
//# sourceMappingURL=range-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-utils.js","sources":["../../../../../../packages/vuu-utils/src/range-utils.ts"],"sourcesContent":["import { VuuRange } from \"@vuu-ui/vuu-protocol-types\";\n\ninterface FromToRange {\n from: number;\n to: number;\n}\n\nexport interface Range extends VuuRange {\n equals: (vuuRange: VuuRange) => boolean;\n reset: Range;\n withBuffer: VuuRange;\n}\n\nexport interface RangeOptions {\n renderBufferSize?: number;\n rowCount?: number;\n}\n\nclass RangeImpl implements Range {\n #baseFrom: number;\n #renderBufferSize = 0;\n #baseTo: number;\n\n // We have to keep from and to as simple public properties (not getters) so they survive structuredClone\n constructor(\n /** Index position of first visible row in viewport */\n public from: number,\n /** Index position of last visible row in viewport + 1 */\n public to: number,\n renderBufferSize = 0,\n ) {\n this.#baseFrom = from;\n this.#baseTo = to;\n this.#renderBufferSize = renderBufferSize;\n }\n\n get reset() {\n return new RangeImpl(\n 0,\n this.#baseTo - this.#baseFrom,\n this.#renderBufferSize,\n );\n }\n\n get withBuffer() {\n return getFullRange(this, this.#renderBufferSize);\n }\n\n equals(range: VuuRange) {\n return range.from === this.#baseFrom && range.to === this.#baseTo;\n }\n\n toJson() {\n return {\n from: this.from,\n to: this.to,\n baseFrom: this.#baseFrom,\n baseTo: this.#baseTo,\n renderBufferSize: this.#renderBufferSize,\n };\n }\n}\n\nexport const Range = (\n from: number,\n to: number,\n renderBufferSize?: number,\n): Range => new RangeImpl(from, to, renderBufferSize);\n\nexport const NULL_RANGE = Range(0, 0);\n\nexport function getFullRange(\n { from, to }: VuuRange,\n bufferSize = 0,\n
|
|
1
|
+
{"version":3,"file":"range-utils.js","sources":["../../../../../../packages/vuu-utils/src/range-utils.ts"],"sourcesContent":["import { VuuRange } from \"@vuu-ui/vuu-protocol-types\";\n\ninterface FromToRange {\n from: number;\n to: number;\n}\n\nexport interface Range extends VuuRange {\n equals: (vuuRange: VuuRange) => boolean;\n reset: Range;\n withBuffer: VuuRange;\n}\n\nexport interface RangeOptions {\n renderBufferSize?: number;\n rowCount?: number;\n}\n\nclass RangeImpl implements Range {\n #baseFrom: number;\n #renderBufferSize = 0;\n #baseTo: number;\n\n // We have to keep from and to as simple public properties (not getters) so they survive structuredClone\n constructor(\n /** Index position of first visible row in viewport */\n public from: number,\n /** Index position of last visible row in viewport + 1 */\n public to: number,\n renderBufferSize = 0,\n ) {\n this.#baseFrom = from;\n this.#baseTo = to;\n this.#renderBufferSize = renderBufferSize;\n }\n\n get reset() {\n return new RangeImpl(\n 0,\n this.#baseTo - this.#baseFrom,\n this.#renderBufferSize,\n );\n }\n\n get withBuffer() {\n return getFullRange(this, this.#renderBufferSize);\n }\n\n equals(range: VuuRange) {\n return range.from === this.#baseFrom && range.to === this.#baseTo;\n }\n\n toJson() {\n return {\n from: this.from,\n to: this.to,\n baseFrom: this.#baseFrom,\n baseTo: this.#baseTo,\n renderBufferSize: this.#renderBufferSize,\n };\n }\n}\n\nexport const Range = (\n from: number,\n to: number,\n renderBufferSize?: number,\n): Range => new RangeImpl(from, to, renderBufferSize);\n\nexport const NULL_RANGE = Range(0, 0);\n\nexport function getFullRange(\n { from, to }: VuuRange,\n bufferSize = 0,\n maxRangeEnd: number = Number.MAX_SAFE_INTEGER,\n): FromToRange {\n if (from === 0 && to === 0) {\n return { from, to };\n } else if (bufferSize === 0) {\n if (maxRangeEnd < from) {\n return { from: 0, to: 0 };\n } else {\n return { from, to: Math.min(to, maxRangeEnd) };\n }\n } else if (from === 0) {\n return { from, to: Math.min(to + bufferSize, maxRangeEnd) };\n } else {\n const shortfallBefore = from - bufferSize < 0;\n const shortfallAfter = maxRangeEnd - (to + bufferSize) < 0;\n if (shortfallBefore && shortfallAfter) {\n return { from: 0, to: maxRangeEnd };\n } else if (shortfallBefore) {\n return { from: 0, to: to + bufferSize };\n } else if (shortfallAfter) {\n return {\n from: Math.max(0, from - bufferSize),\n to: maxRangeEnd,\n };\n } else {\n return { from: from - bufferSize, to: to + bufferSize };\n }\n }\n}\n\nexport const withinRange = (value: number, { from, to }: VuuRange) =>\n value >= from && value < to;\n\nexport const rangeNewItems = (\n { from: from1, to: to1 }: VuuRange,\n newRange: VuuRange,\n): VuuRange => {\n const { from: from2, to: to2 } = newRange;\n const noOverlap = from2 >= to1 || to2 <= from1;\n const newFullySubsumesOld = from2 < from1 && to2 > to1;\n return noOverlap || newFullySubsumesOld\n ? newRange\n : to2 > to1\n ? { from: to1, to: to2 }\n : { from: from2, to: from1 };\n};\n\nexport class WindowRange {\n public from: number;\n public to: number;\n\n constructor(from: number, to: number) {\n this.from = from;\n this.to = to;\n }\n\n public isWithin(index: number) {\n return withinRange(index, this);\n }\n\n //find the overlap of this range and a new one\n public overlap(from: number, to: number): [number, number] {\n return from >= this.to || to < this.from\n ? [0, 0]\n : [Math.max(from, this.from), Math.min(to, this.to)];\n }\n\n public copy(): WindowRange {\n return new WindowRange(this.from, this.to);\n }\n}\n\n\nconst constrainRangeWidth = (range: VuuRange, maxRangeWidth = Number.MAX_SAFE_INTEGER) => {\n if (range.to - range.from < maxRangeWidth) {\n return range;\n }\n console.warn(`[range-utils] range ${range.from} - ${range.to} exceeds maxRangeWidth ${maxRangeWidth} for this table `);\n return {\n from: range.from,\n to: range.from + maxRangeWidth\n }\n}\nexport const constrainRange = (range: VuuRange, maxRangeEnd: number, maxRangeWidth?: number) => {\n if (maxRangeEnd > 0 && maxRangeEnd < range.to) {\n if (maxRangeEnd > range.from) {\n return constrainRangeWidth({\n from: range.from,\n to: maxRangeEnd\n }, maxRangeWidth);\n } else {\n throw Error(`constrainRange: cannot apply the maxRangeEnd ${maxRangeEnd} to range ${range.from} - ${range.to}`);\n }\n } else {\n return constrainRangeWidth(range, maxRangeWidth);\n }\n}"],"names":[],"mappings":";;;;;;;;;;AAAA,IAAA,SAAA,EAAA,iBAAA,EAAA,OAAA;AAkBA,MAAM,UAAA,GAAN,MAAM,UAA2B,CAAA;AAAA;AAAA,EAM/B,WAES,CAAA,IAAA,EAEA,EACP,EAAA,gBAAA,GAAmB,CACnB,EAAA;AAJO,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAEA,IAAA,IAAA,CAAA,EAAA,GAAA,EAAA;AATT,IAAA,YAAA,CAAA,IAAA,EAAA,SAAA,CAAA;AACA,IAAoB,YAAA,CAAA,IAAA,EAAA,iBAAA,EAAA,CAAA,CAAA;AACpB,IAAA,YAAA,CAAA,IAAA,EAAA,OAAA,CAAA;AAUE,IAAA,YAAA,CAAA,IAAA,EAAK,SAAY,EAAA,IAAA,CAAA;AACjB,IAAA,YAAA,CAAA,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": "2.
|
|
2
|
+
"version": "2.2.0",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
"@salt-ds/core": "1.54.1"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@vuu-ui/vuu-data-types": "2.
|
|
11
|
-
"@vuu-ui/vuu-table-types": "2.
|
|
12
|
-
"@vuu-ui/vuu-filter-types": "2.
|
|
13
|
-
"@vuu-ui/vuu-protocol-types": "2.
|
|
10
|
+
"@vuu-ui/vuu-data-types": "2.2.0",
|
|
11
|
+
"@vuu-ui/vuu-table-types": "2.2.0",
|
|
12
|
+
"@vuu-ui/vuu-filter-types": "2.2.0",
|
|
13
|
+
"@vuu-ui/vuu-protocol-types": "2.2.0"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@internationalized/date": "^3.0.0",
|
|
17
|
-
"@vuu-ui/vuu-filter-parser": "2.
|
|
17
|
+
"@vuu-ui/vuu-filter-parser": "2.2.0",
|
|
18
18
|
"clsx": "^2.0.0",
|
|
19
19
|
"react": "^19.2.3",
|
|
20
20
|
"react-dom": "^19.2.3"
|
package/types/range-utils.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface RangeOptions {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const Range: (from: number, to: number, renderBufferSize?: number) => Range;
|
|
16
16
|
export declare const NULL_RANGE: Range;
|
|
17
|
-
export declare function getFullRange({ from, to }: VuuRange, bufferSize?: number,
|
|
17
|
+
export declare function getFullRange({ from, to }: VuuRange, bufferSize?: number, maxRangeEnd?: number): FromToRange;
|
|
18
18
|
export declare const withinRange: (value: number, { from, to }: VuuRange) => boolean;
|
|
19
19
|
export declare const rangeNewItems: ({ from: from1, to: to1 }: VuuRange, newRange: VuuRange) => VuuRange;
|
|
20
20
|
export declare class WindowRange {
|
|
@@ -25,4 +25,5 @@ export declare class WindowRange {
|
|
|
25
25
|
overlap(from: number, to: number): [number, number];
|
|
26
26
|
copy(): WindowRange;
|
|
27
27
|
}
|
|
28
|
+
export declare const constrainRange: (range: VuuRange, maxRangeEnd: number, maxRangeWidth?: number) => VuuRange;
|
|
28
29
|
export {};
|