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