@pretable/core 0.13.1 → 0.14.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/dist/index.cjs +103 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -20
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +46 -20
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +103 -115
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -4376,6 +4376,69 @@ function isPretableFilterGroup(node) {
|
|
|
4376
4376
|
return typeof node === "object" && node !== null && "children" in node && (node.op === "and" || node.op === "or");
|
|
4377
4377
|
}
|
|
4378
4378
|
|
|
4379
|
+
//#endregion
|
|
4380
|
+
//#region ../calendar-date/dist/calendar-date.js
|
|
4381
|
+
const ASCII_ZERO = 48;
|
|
4382
|
+
const ASCII_NINE = 57;
|
|
4383
|
+
const ASCII_HYPHEN = 45;
|
|
4384
|
+
const isLeapYear = (year) => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
4385
|
+
const getDaysInMonth = (year, month) => {
|
|
4386
|
+
if (month === 2) return isLeapYear(year) ? 29 : 28;
|
|
4387
|
+
if (month === 4 || month === 6 || month === 9 || month === 11) return 30;
|
|
4388
|
+
return 31;
|
|
4389
|
+
};
|
|
4390
|
+
const isAsciiDigitAt = (value, index) => {
|
|
4391
|
+
const code = value.charCodeAt(index);
|
|
4392
|
+
return code >= ASCII_ZERO && code <= ASCII_NINE;
|
|
4393
|
+
};
|
|
4394
|
+
const hasDateValueShape = (value) => value.length === 10 && isAsciiDigitAt(value, 0) && isAsciiDigitAt(value, 1) && isAsciiDigitAt(value, 2) && isAsciiDigitAt(value, 3) && value.charCodeAt(4) === ASCII_HYPHEN && isAsciiDigitAt(value, 5) && isAsciiDigitAt(value, 6) && value.charCodeAt(7) === ASCII_HYPHEN && isAsciiDigitAt(value, 8) && isAsciiDigitAt(value, 9);
|
|
4395
|
+
const readTwoDigits = (value, offset) => (value.charCodeAt(offset) - ASCII_ZERO) * 10 + value.charCodeAt(offset + 1) - ASCII_ZERO;
|
|
4396
|
+
const readFourDigits = (value) => (value.charCodeAt(0) - ASCII_ZERO) * 1e3 + (value.charCodeAt(1) - ASCII_ZERO) * 100 + (value.charCodeAt(2) - ASCII_ZERO) * 10 + value.charCodeAt(3) - ASCII_ZERO;
|
|
4397
|
+
const hasValidDateParts = (year, month, day) => month >= 1 && month <= 12 && day >= 1 && day <= getDaysInMonth(year, month);
|
|
4398
|
+
/** @public */
|
|
4399
|
+
function isValidDateValue(value) {
|
|
4400
|
+
if (typeof value !== "string" || !hasDateValueShape(value)) return false;
|
|
4401
|
+
const year = readFourDigits(value);
|
|
4402
|
+
const month = readTwoDigits(value, 5);
|
|
4403
|
+
const day = readTwoDigits(value, 8);
|
|
4404
|
+
return hasValidDateParts(year, month, day);
|
|
4405
|
+
}
|
|
4406
|
+
function compareDateValues(left, right) {
|
|
4407
|
+
if (left < right) return -1;
|
|
4408
|
+
if (left > right) return 1;
|
|
4409
|
+
return 0;
|
|
4410
|
+
}
|
|
4411
|
+
|
|
4412
|
+
//#endregion
|
|
4413
|
+
//#region ../row-model/dist/calendar-date-aggregates.js
|
|
4414
|
+
function calendarDateExtremum(kind) {
|
|
4415
|
+
return Object.freeze({
|
|
4416
|
+
init: () => null,
|
|
4417
|
+
accumulate: (accumulator, value) => {
|
|
4418
|
+
if (!isValidDateValue(value)) return accumulator;
|
|
4419
|
+
if (accumulator === null) return value;
|
|
4420
|
+
return kind === "min" ? value < accumulator ? value : accumulator : value > accumulator ? value : accumulator;
|
|
4421
|
+
},
|
|
4422
|
+
merge: (left, right) => {
|
|
4423
|
+
if (left === null) return right;
|
|
4424
|
+
if (right === null) return left;
|
|
4425
|
+
return kind === "min" ? left < right ? left : right : left > right ? left : right;
|
|
4426
|
+
},
|
|
4427
|
+
finalize: (accumulator) => accumulator
|
|
4428
|
+
});
|
|
4429
|
+
}
|
|
4430
|
+
const calendarDateMin = calendarDateExtremum("min");
|
|
4431
|
+
const calendarDateMax = calendarDateExtremum("max");
|
|
4432
|
+
function lowerCalendarDateAggregate(columnType, aggregate) {
|
|
4433
|
+
if (columnType !== "date") return aggregate;
|
|
4434
|
+
if (aggregate === "min") return calendarDateMin;
|
|
4435
|
+
if (aggregate === "max") return calendarDateMax;
|
|
4436
|
+
return aggregate;
|
|
4437
|
+
}
|
|
4438
|
+
function isCalendarDateAggregate(aggregate) {
|
|
4439
|
+
return aggregate === calendarDateMin || aggregate === calendarDateMax;
|
|
4440
|
+
}
|
|
4441
|
+
|
|
4379
4442
|
//#endregion
|
|
4380
4443
|
//#region ../row-model/dist/errors.js
|
|
4381
4444
|
/** @public */
|
|
@@ -4446,7 +4509,7 @@ var PretableUnsupportedRowUpdateError = class extends PretableRowModelError {
|
|
|
4446
4509
|
};
|
|
4447
4510
|
/** @public */
|
|
4448
4511
|
var PretableInvalidGroupKeyError = class extends PretableRowModelError {
|
|
4449
|
-
constructor(operation, rowId, columnId, value, cause = /* @__PURE__ */ new TypeError("Group keys must be strings, numbers, bigints, booleans,
|
|
4512
|
+
constructor(operation, rowId, columnId, value, cause = /* @__PURE__ */ new TypeError("Group keys must be strings, numbers, bigints, booleans, null, or undefined.")) {
|
|
4450
4513
|
super("invalid-group-key", `Column ${columnId} produced an unsupported group key.`, {
|
|
4451
4514
|
operation,
|
|
4452
4515
|
rowId,
|
|
@@ -4667,12 +4730,8 @@ const BUILTIN_AGGREGATES = /* @__PURE__ */ new Set([
|
|
|
4667
4730
|
"max",
|
|
4668
4731
|
"count"
|
|
4669
4732
|
]);
|
|
4670
|
-
const
|
|
4671
|
-
|
|
4672
|
-
"avg",
|
|
4673
|
-
"min",
|
|
4674
|
-
"max"
|
|
4675
|
-
]);
|
|
4733
|
+
const NUMBER_ONLY_AGGREGATES = /* @__PURE__ */ new Set(["sum", "avg"]);
|
|
4734
|
+
const EXTREMA_AGGREGATES = /* @__PURE__ */ new Set(["min", "max"]);
|
|
4676
4735
|
const COLUMN_TYPES = /* @__PURE__ */ new Set([
|
|
4677
4736
|
"text",
|
|
4678
4737
|
"number",
|
|
@@ -4858,7 +4917,8 @@ function validateAggregate(column, path) {
|
|
|
4858
4917
|
if (aggregate === void 0) return;
|
|
4859
4918
|
if (typeof aggregate === "string") {
|
|
4860
4919
|
if (!BUILTIN_AGGREGATES.has(aggregate)) fail$1(`unknown aggregate ${aggregate}`, path, column.id);
|
|
4861
|
-
if (
|
|
4920
|
+
if (NUMBER_ONLY_AGGREGATES.has(aggregate) && column.type !== "number") fail$1(`numeric aggregate ${aggregate} requires a number column`, path, column.id);
|
|
4921
|
+
if (EXTREMA_AGGREGATES.has(aggregate) && column.type !== "number" && column.type !== "date") fail$1(`aggregate ${aggregate} requires a number or date column`, path, column.id);
|
|
4862
4922
|
return;
|
|
4863
4923
|
}
|
|
4864
4924
|
if (!aggregate || typeof aggregate !== "object") fail$1("aggregate must be a built-in name or object", path, column.id);
|
|
@@ -4908,8 +4968,9 @@ function validateFilterOperand(column, filter, path) {
|
|
|
4908
4968
|
return;
|
|
4909
4969
|
}
|
|
4910
4970
|
if (column.type === "date") {
|
|
4911
|
-
|
|
4912
|
-
|
|
4971
|
+
if (filter.operator === "dateBetween") {
|
|
4972
|
+
if (!Array.isArray(value) || value.length !== 2 || value.some((entry) => typeof entry !== "string")) fail$1("date range must contain exactly two strings", path, column.id);
|
|
4973
|
+
} else if (typeof value !== "string") fail$1("date operand must be a string", path, column.id);
|
|
4913
4974
|
return;
|
|
4914
4975
|
}
|
|
4915
4976
|
if (column.type === "text") {
|
|
@@ -5087,41 +5148,6 @@ function booleanValue(value) {
|
|
|
5087
5148
|
if (value === "false" || value === 0 || value === "0") return false;
|
|
5088
5149
|
return Boolean(value);
|
|
5089
5150
|
}
|
|
5090
|
-
const ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
5091
|
-
const ISO_DATETIME_RE = /^(\d{4}-\d{2}-\d{2})[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?$/i;
|
|
5092
|
-
const GREGORIAN_400Y_MS = 146097 * 864e5;
|
|
5093
|
-
function utcMs(year, month, day) {
|
|
5094
|
-
return year >= 0 && year < 100 ? Date.UTC(year + 400, month, day) - GREGORIAN_400Y_MS : Date.UTC(year, month, day);
|
|
5095
|
-
}
|
|
5096
|
-
function utcDayOf(value) {
|
|
5097
|
-
const date = new Date(value);
|
|
5098
|
-
const year = date.getUTCFullYear();
|
|
5099
|
-
if (Number.isNaN(date.getTime()) || year < 0 || year > 9999) return NaN;
|
|
5100
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
5101
|
-
return date.getTime();
|
|
5102
|
-
}
|
|
5103
|
-
function isoDayMs(value) {
|
|
5104
|
-
if (!ISO_DATE_RE.test(value)) return NaN;
|
|
5105
|
-
const [year, month, day] = value.split("-").map(Number);
|
|
5106
|
-
const result = utcMs(year, month - 1, day);
|
|
5107
|
-
const roundTrip = new Date(result);
|
|
5108
|
-
return roundTrip.getUTCFullYear() === year && roundTrip.getUTCMonth() === month - 1 && roundTrip.getUTCDate() === day ? result : NaN;
|
|
5109
|
-
}
|
|
5110
|
-
/** Deterministic UTC calendar-day policy shared with the frozen legacy oracle. */
|
|
5111
|
-
function toDayMs(value) {
|
|
5112
|
-
if (value instanceof Date) {
|
|
5113
|
-
const timestamp = readDateTimestamp(value);
|
|
5114
|
-
return timestamp === void 0 ? NaN : utcDayOf(timestamp);
|
|
5115
|
-
}
|
|
5116
|
-
if (typeof value === "number") return utcDayOf(value);
|
|
5117
|
-
if (typeof value !== "string") return NaN;
|
|
5118
|
-
const trimmed = value.trim();
|
|
5119
|
-
const dateOnly = isoDayMs(trimmed);
|
|
5120
|
-
if (!Number.isNaN(dateOnly)) return dateOnly;
|
|
5121
|
-
const parts = ISO_DATETIME_RE.exec(trimmed);
|
|
5122
|
-
if (!parts || Number.isNaN(isoDayMs(parts[1]))) return NaN;
|
|
5123
|
-
return parts[2] ? utcDayOf(Date.parse(trimmed.replace(" ", "T"))) : isoDayMs(parts[1]);
|
|
5124
|
-
}
|
|
5125
5151
|
const alwaysTrue = () => true;
|
|
5126
5152
|
const alwaysFalse = () => false;
|
|
5127
5153
|
function isNumberCell(value) {
|
|
@@ -5153,21 +5179,16 @@ function compileNumberPredicate(operator, operand) {
|
|
|
5153
5179
|
function compileDatePredicate(operator, operand) {
|
|
5154
5180
|
if (operator === "dateBetween") {
|
|
5155
5181
|
const range = operand;
|
|
5156
|
-
const a =
|
|
5157
|
-
const b =
|
|
5158
|
-
if (
|
|
5159
|
-
const lower =
|
|
5160
|
-
|
|
5161
|
-
return (value) => {
|
|
5162
|
-
const cell = toDayMs(value);
|
|
5163
|
-
return cell >= lower && cell <= upper;
|
|
5164
|
-
};
|
|
5182
|
+
const a = range[0];
|
|
5183
|
+
const b = range[1];
|
|
5184
|
+
if (!isValidDateValue(a) || !isValidDateValue(b)) return alwaysFalse;
|
|
5185
|
+
const [lower, upper] = compareDateValues(a, b) <= 0 ? [a, b] : [b, a];
|
|
5186
|
+
return (value) => isValidDateValue(value) && compareDateValues(value, lower) >= 0 && compareDateValues(value, upper) <= 0;
|
|
5165
5187
|
}
|
|
5166
|
-
|
|
5167
|
-
if (
|
|
5168
|
-
if (operator === "
|
|
5169
|
-
|
|
5170
|
-
return (value) => toDayMs(value) > other;
|
|
5188
|
+
if (!isValidDateValue(operand)) return alwaysFalse;
|
|
5189
|
+
if (operator === "on") return (value) => isValidDateValue(value) && compareDateValues(value, operand) === 0;
|
|
5190
|
+
if (operator === "before") return (value) => isValidDateValue(value) && compareDateValues(value, operand) < 0;
|
|
5191
|
+
return (value) => isValidDateValue(value) && compareDateValues(value, operand) > 0;
|
|
5171
5192
|
}
|
|
5172
5193
|
function compileSelectionPredicate(operator, operand, coerce) {
|
|
5173
5194
|
const entries = operand;
|
|
@@ -5215,6 +5236,17 @@ function isNullSortValue(value) {
|
|
|
5215
5236
|
return value === null || value === void 0 || typeof value === "number" && Number.isNaN(value);
|
|
5216
5237
|
}
|
|
5217
5238
|
function compareValues(left, right, column, ordering) {
|
|
5239
|
+
if (!column.compare && column.type === "date") {
|
|
5240
|
+
const leftValid = isValidDateValue(left);
|
|
5241
|
+
const rightValid = isValidDateValue(right);
|
|
5242
|
+
if (leftValid || rightValid) {
|
|
5243
|
+
if (!leftValid) return 1;
|
|
5244
|
+
if (!rightValid) return -1;
|
|
5245
|
+
const result = compareDateValues(left, right);
|
|
5246
|
+
return ordering.direction === "desc" ? -result : result;
|
|
5247
|
+
}
|
|
5248
|
+
return 0;
|
|
5249
|
+
}
|
|
5218
5250
|
const leftNull = isNullSortValue(left);
|
|
5219
5251
|
const rightNull = isNullSortValue(right);
|
|
5220
5252
|
if (leftNull || rightNull) {
|
|
@@ -5576,7 +5608,7 @@ function _finalizeMetadata(input) {
|
|
|
5576
5608
|
});
|
|
5577
5609
|
const aggregateLeaves = Object.freeze(_classPrivateFieldGet2(_aggregateColumns, this).map((column) => Object.freeze({
|
|
5578
5610
|
columnId: column.id,
|
|
5579
|
-
aggregate: column.aggregate,
|
|
5611
|
+
aggregate: lowerCalendarDateAggregate(column.type, column.aggregate),
|
|
5580
5612
|
allLeaf: Object.freeze({
|
|
5581
5613
|
id: input.rowId,
|
|
5582
5614
|
row: input.row,
|
|
@@ -7487,7 +7519,7 @@ function escape(raw) {
|
|
|
7487
7519
|
}
|
|
7488
7520
|
/** Canonical equality/identity key. Null and undefined intentionally share the legacy blank group. */
|
|
7489
7521
|
function encodeGroupValue(value, context) {
|
|
7490
|
-
var _context$
|
|
7522
|
+
var _context$operation, _context$columnId;
|
|
7491
7523
|
if (value === null || value === void 0) return "~";
|
|
7492
7524
|
if (typeof value === "string") return `s:${value}`;
|
|
7493
7525
|
if (typeof value === "number") {
|
|
@@ -7497,27 +7529,11 @@ function encodeGroupValue(value, context) {
|
|
|
7497
7529
|
}
|
|
7498
7530
|
if (typeof value === "boolean") return `b:${String(value)}`;
|
|
7499
7531
|
if (typeof value === "bigint") return `i:${String(value)}`;
|
|
7500
|
-
|
|
7501
|
-
const time = Date.prototype.getTime.call(value);
|
|
7502
|
-
return Number.isNaN(time) ? "d:Invalid" : `d:${String(time)}`;
|
|
7503
|
-
} catch (brandCause) {
|
|
7504
|
-
var _context$operation2, _context$columnId2;
|
|
7505
|
-
try {
|
|
7506
|
-
value instanceof Date;
|
|
7507
|
-
} catch (cause) {
|
|
7508
|
-
var _context$operation, _context$columnId;
|
|
7509
|
-
throw new PretableInvalidGroupKeyError((_context$operation = context === null || context === void 0 ? void 0 : context.operation) !== null && _context$operation !== void 0 ? _context$operation : "set-query", context === null || context === void 0 ? void 0 : context.rowId, (_context$columnId = context === null || context === void 0 ? void 0 : context.columnId) !== null && _context$columnId !== void 0 ? _context$columnId : "<unknown>", value, cause);
|
|
7510
|
-
}
|
|
7511
|
-
throw new PretableInvalidGroupKeyError((_context$operation2 = context === null || context === void 0 ? void 0 : context.operation) !== null && _context$operation2 !== void 0 ? _context$operation2 : "set-query", context === null || context === void 0 ? void 0 : context.rowId, (_context$columnId2 = context === null || context === void 0 ? void 0 : context.columnId) !== null && _context$columnId2 !== void 0 ? _context$columnId2 : "<unknown>", value, brandCause);
|
|
7512
|
-
}
|
|
7513
|
-
throw new PretableInvalidGroupKeyError((_context$operation3 = context === null || context === void 0 ? void 0 : context.operation) !== null && _context$operation3 !== void 0 ? _context$operation3 : "set-query", context === null || context === void 0 ? void 0 : context.rowId, (_context$columnId3 = context === null || context === void 0 ? void 0 : context.columnId) !== null && _context$columnId3 !== void 0 ? _context$columnId3 : "<unknown>", value);
|
|
7532
|
+
throw new PretableInvalidGroupKeyError((_context$operation = context === null || context === void 0 ? void 0 : context.operation) !== null && _context$operation !== void 0 ? _context$operation : "set-query", context === null || context === void 0 ? void 0 : context.rowId, (_context$columnId = context === null || context === void 0 ? void 0 : context.columnId) !== null && _context$columnId !== void 0 ? _context$columnId : "<unknown>", value);
|
|
7514
7533
|
}
|
|
7515
7534
|
function makeGroupId(path) {
|
|
7516
7535
|
return `__group__:${path.map((entry) => `${escape(entry.columnId)}=${escape(encodeGroupValue(entry.value))}`).join("/")}`;
|
|
7517
7536
|
}
|
|
7518
|
-
function sameValue(left, right) {
|
|
7519
|
-
return Object.is(left, right) || left instanceof Date && right instanceof Date && Object.is(left.getTime(), right.getTime());
|
|
7520
|
-
}
|
|
7521
7537
|
function combineCounts(left, right) {
|
|
7522
7538
|
const length = Math.max(left.throughDepth.length, right.throughDepth.length);
|
|
7523
7539
|
const throughDepth = Array.from({ length }, (_, index) => {
|
|
@@ -7928,7 +7944,7 @@ function aggregateRecord(roots, allPopulation, previous, operation, rowId, group
|
|
|
7928
7944
|
return same ? previous : Object.freeze(values);
|
|
7929
7945
|
}
|
|
7930
7946
|
function makePublicGroup(source, expanded, previous) {
|
|
7931
|
-
if (previous !== void 0 && previous.expanded === expanded && previous.childCount === source.childCount && previous.aggregates === source.aggregates &&
|
|
7947
|
+
if (previous !== void 0 && previous.expanded === expanded && previous.childCount === source.childCount && previous.aggregates === source.aggregates && Object.is(previous.value, source.value)) return previous;
|
|
7932
7948
|
return Object.freeze({
|
|
7933
7949
|
...source,
|
|
7934
7950
|
expanded
|
|
@@ -9710,13 +9726,6 @@ function captureQueryOptions(options) {
|
|
|
9710
9726
|
blankOrder
|
|
9711
9727
|
});
|
|
9712
9728
|
}
|
|
9713
|
-
function dateTimestamp(value) {
|
|
9714
|
-
try {
|
|
9715
|
-
return Date.prototype.getTime.call(value);
|
|
9716
|
-
} catch (_unused) {
|
|
9717
|
-
return;
|
|
9718
|
-
}
|
|
9719
|
-
}
|
|
9720
9729
|
function describeValue(value) {
|
|
9721
9730
|
if (value === null) return {
|
|
9722
9731
|
id: "null",
|
|
@@ -9755,22 +9764,10 @@ function describeValue(value) {
|
|
|
9755
9764
|
blank: false,
|
|
9756
9765
|
blankRank: 0
|
|
9757
9766
|
};
|
|
9758
|
-
|
|
9759
|
-
const timestamp = dateTimestamp(value);
|
|
9760
|
-
if (timestamp !== void 0) return {
|
|
9761
|
-
id: `date:${Number.isNaN(timestamp) ? "nan" : String(timestamp)}`,
|
|
9762
|
-
blank: Number.isNaN(timestamp),
|
|
9763
|
-
blankRank: 4
|
|
9764
|
-
};
|
|
9765
|
-
}
|
|
9766
|
-
throw new TypeError("Distinct values must be strings, numbers, bigints, booleans, Dates, null, or undefined.");
|
|
9767
|
+
throw new TypeError("Distinct values must be strings, numbers, bigints, booleans, null, or undefined.");
|
|
9767
9768
|
}
|
|
9768
9769
|
function snapshotDistinctValue(value) {
|
|
9769
9770
|
if (typeof value === "number" && value === 0) return 0;
|
|
9770
|
-
if (value !== null && typeof value === "object") {
|
|
9771
|
-
const timestamp = dateTimestamp(value);
|
|
9772
|
-
if (timestamp !== void 0) return new Date(timestamp);
|
|
9773
|
-
}
|
|
9774
9771
|
return value;
|
|
9775
9772
|
}
|
|
9776
9773
|
const collator = new Intl.Collator(void 0, {
|
|
@@ -9781,11 +9778,6 @@ function defaultCompare(left, right) {
|
|
|
9781
9778
|
if (typeof left === "number" && typeof right === "number") return left === right ? 0 : left < right ? -1 : 1;
|
|
9782
9779
|
if (typeof left === "bigint" && typeof right === "bigint") return left === right ? 0 : left < right ? -1 : 1;
|
|
9783
9780
|
if (typeof left === "boolean" && typeof right === "boolean") return left === right ? 0 : left ? 1 : -1;
|
|
9784
|
-
if (typeof left === "object" && left !== null && typeof right === "object" && right !== null) {
|
|
9785
|
-
const leftTime = dateTimestamp(left);
|
|
9786
|
-
const rightTime = dateTimestamp(right);
|
|
9787
|
-
if (leftTime !== void 0 && rightTime !== void 0) return leftTime === rightTime ? 0 : leftTime < rightTime ? -1 : 1;
|
|
9788
|
-
}
|
|
9789
9781
|
return collator.compare(String(left), String(right));
|
|
9790
9782
|
}
|
|
9791
9783
|
function createValueTree(column, options) {
|
|
@@ -9816,11 +9808,7 @@ function frame(tag, payload = "") {
|
|
|
9816
9808
|
}
|
|
9817
9809
|
function semanticValueKey(value) {
|
|
9818
9810
|
if (Array.isArray(value)) return frame("a", value.map(semanticValueKey).join(""));
|
|
9819
|
-
if (value && typeof value === "object")
|
|
9820
|
-
const timestamp = dateTimestamp(value);
|
|
9821
|
-
if (timestamp !== void 0) return Number.isNaN(timestamp) ? frame("dN") : frame("d", String(timestamp));
|
|
9822
|
-
return frame("o", Object.keys(value).sort().map((key) => frame("k", key) + frame("v", semanticValueKey(value[key]))).join(""));
|
|
9823
|
-
}
|
|
9811
|
+
if (value && typeof value === "object") return frame("o", Object.keys(value).sort().map((key) => frame("k", key) + frame("v", semanticValueKey(value[key]))).join(""));
|
|
9824
9812
|
if (value === null) return frame("l");
|
|
9825
9813
|
if (value === void 0) return frame("u");
|
|
9826
9814
|
if (typeof value === "string") return frame("s", value);
|
|
@@ -9837,13 +9825,13 @@ function filterSemanticKey(root) {
|
|
|
9837
9825
|
const derivations = root.queryPlan.derivations;
|
|
9838
9826
|
const byId = new Map(derivations.map((column) => [column.id, column]));
|
|
9839
9827
|
const nodeKey = (node) => {
|
|
9840
|
-
var _byId$get;
|
|
9828
|
+
var _byId$get$type, _byId$get, _byId$get2;
|
|
9841
9829
|
if (isPretableFilterGroup(node)) {
|
|
9842
9830
|
const group = node;
|
|
9843
9831
|
return frame("g", frame("p", group.op) + frame("k", group.children.map(nodeKey).sort().join("")));
|
|
9844
9832
|
}
|
|
9845
9833
|
const runtime = node;
|
|
9846
|
-
return frame("f", frame("c", runtime.columnId) + frame("i", String(identityId((_byId$
|
|
9834
|
+
return frame("f", frame("c", runtime.columnId) + frame("t", (_byId$get$type = (_byId$get = byId.get(runtime.columnId)) === null || _byId$get === void 0 ? void 0 : _byId$get.type) !== null && _byId$get$type !== void 0 ? _byId$get$type : "") + frame("i", String(identityId((_byId$get2 = byId.get(runtime.columnId)) === null || _byId$get2 === void 0 ? void 0 : _byId$get2.accessor))) + frame("p", runtime.operator) + frame("v", semanticValueKey(runtime.value)));
|
|
9847
9835
|
};
|
|
9848
9836
|
return [...root.queryPlan.query.filters].map(nodeKey).sort().join("");
|
|
9849
9837
|
}
|
|
@@ -9857,7 +9845,7 @@ function columnForDerivations(derivations, columnId) {
|
|
|
9857
9845
|
}
|
|
9858
9846
|
function cacheKey(root, column, options) {
|
|
9859
9847
|
const filterKey = options.population === "filtered" ? filterSemanticKey(root) : "";
|
|
9860
|
-
return frame("K", frame("c", column.id) + frame("p", options.population) + frame("a", String(identityId(column.accessor))) + frame("o", String(identityId(column.compare))) + frame(options.includeBlanks ? "b1" : "b0") + frame("n", options.blankOrder) + frame("f", filterKey));
|
|
9848
|
+
return frame("K", frame("c", column.id) + frame("t", column.type) + frame("p", options.population) + frame("a", String(identityId(column.accessor))) + frame("o", String(identityId(column.compare))) + frame(options.includeBlanks ? "b1" : "b0") + frame("n", options.blankOrder) + frame("f", filterKey));
|
|
9861
9849
|
}
|
|
9862
9850
|
function callbackError(code, operation, columnId, rowId, cause) {
|
|
9863
9851
|
return new PretableRowModelError(code, `Distinct-value ${code === "accessor-failed" ? "accessor" : "comparator"} failed for column ${columnId}.`, {
|
|
@@ -10047,7 +10035,7 @@ function createDistinctValueManager(options) {
|
|
|
10047
10035
|
const bestEffortCancel = (cancel) => {
|
|
10048
10036
|
try {
|
|
10049
10037
|
cancel === null || cancel === void 0 || cancel();
|
|
10050
|
-
} catch (
|
|
10038
|
+
} catch (_unused) {}
|
|
10051
10039
|
};
|
|
10052
10040
|
const releaseProjection = (projection) => {
|
|
10053
10041
|
const cancelScheduled = projection.cancelScheduled;
|
|
@@ -11006,7 +10994,7 @@ function sameGroupIndexContribution(previousPlan, nextPlan, previous, next, prev
|
|
|
11006
10994
|
return previousLeaves.length === nextLeaves.length && previousLeaves.every((previousLeaf, index) => {
|
|
11007
10995
|
const nextLeaf = nextLeaves[index];
|
|
11008
10996
|
if (nextLeaf === void 0 || previousLeaf.columnId !== nextLeaf.columnId || previousLeaf.aggregate !== nextLeaf.aggregate) return false;
|
|
11009
|
-
if (typeof previousLeaf.aggregate !== "string") return Object.is(previousLeaf.allLeaf.row, nextLeaf.allLeaf.row) && Object.is(previousLeaf.allLeaf.value, nextLeaf.allLeaf.value) && Object.is(previousLeaf.allLeaf.dependency, nextLeaf.allLeaf.dependency);
|
|
10997
|
+
if (typeof previousLeaf.aggregate !== "string" && !isCalendarDateAggregate(previousLeaf.aggregate)) return Object.is(previousLeaf.allLeaf.row, nextLeaf.allLeaf.row) && Object.is(previousLeaf.allLeaf.value, nextLeaf.allLeaf.value) && Object.is(previousLeaf.allLeaf.dependency, nextLeaf.allLeaf.dependency);
|
|
11010
10998
|
return (previousLeaf.aggregate === "count" || Object.is(previousLeaf.allLeaf.value, nextLeaf.allLeaf.value)) && previousLeaf.allLeaf.dependency.sourceOrder === nextLeaf.allLeaf.dependency.sourceOrder;
|
|
11011
10999
|
});
|
|
11012
11000
|
}
|
|
@@ -12779,6 +12767,7 @@ exports.createGrid = createGrid;
|
|
|
12779
12767
|
exports.createLocalRowModel = createLocalRowModel;
|
|
12780
12768
|
exports.describeRowSelection = describeRowSelection;
|
|
12781
12769
|
exports.isPretableFilterGroup = isPretableFilterGroup;
|
|
12770
|
+
exports.isValidDateValue = isValidDateValue;
|
|
12782
12771
|
exports.mergeColumnAggregateOverrides = mergeColumnAggregateOverrides;
|
|
12783
12772
|
exports.numberFormats = numberFormats;
|
|
12784
12773
|
exports.ɵHEADER_FOCUS_REF = HEADER_FOCUS_REF;
|