@pretable/core 0.11.0 → 0.13.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 +53 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -12
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +53 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3599,7 +3599,6 @@ const EMPTY_VIEWPORT = Object.freeze({
|
|
|
3599
3599
|
height: 0,
|
|
3600
3600
|
width: 0
|
|
3601
3601
|
});
|
|
3602
|
-
const DEFAULT_COLUMN_WIDTH_PX = 160;
|
|
3603
3602
|
function sameValueZero(left, right) {
|
|
3604
3603
|
return left === right || left !== left && right !== right;
|
|
3605
3604
|
}
|
|
@@ -3621,7 +3620,7 @@ function normalizeColumns(columns) {
|
|
|
3621
3620
|
const normalized = columns.map((column) => {
|
|
3622
3621
|
var _column$widthPx;
|
|
3623
3622
|
if (ids.has(column.id)) throw new PretableGridUiError("invalid-ui-state", `Duplicate visual column id: ${column.id}`);
|
|
3624
|
-
const widthPx = (_column$widthPx = column.widthPx) !== null && _column$widthPx !== void 0 ? _column$widthPx :
|
|
3623
|
+
const widthPx = (_column$widthPx = column.widthPx) !== null && _column$widthPx !== void 0 ? _column$widthPx : 140;
|
|
3625
3624
|
if (!Number.isFinite(widthPx) || widthPx <= 0) throw new PretableGridUiError("invalid-ui-state", `Visual column width must be positive for: ${column.id}`);
|
|
3626
3625
|
ids.add(column.id);
|
|
3627
3626
|
return Object.freeze({
|
|
@@ -4471,6 +4470,58 @@ var PretableTransitionCancelledError = class extends Error {
|
|
|
4471
4470
|
}
|
|
4472
4471
|
};
|
|
4473
4472
|
|
|
4473
|
+
//#endregion
|
|
4474
|
+
//#region ../row-model/dist/query-equality.js
|
|
4475
|
+
function isRuntimeFilterGroup$1(node) {
|
|
4476
|
+
return "children" in node;
|
|
4477
|
+
}
|
|
4478
|
+
function readDateTimestamp$1(value) {
|
|
4479
|
+
try {
|
|
4480
|
+
return Date.prototype.getTime.call(value);
|
|
4481
|
+
} catch (_unused) {
|
|
4482
|
+
return;
|
|
4483
|
+
}
|
|
4484
|
+
}
|
|
4485
|
+
function isPlainObject(value) {
|
|
4486
|
+
if (value === null || typeof value !== "object") return false;
|
|
4487
|
+
const prototype = Object.getPrototypeOf(value);
|
|
4488
|
+
return prototype === Object.prototype || prototype === null;
|
|
4489
|
+
}
|
|
4490
|
+
function semanticValueEqual(left, right) {
|
|
4491
|
+
if (Object.is(left, right)) return true;
|
|
4492
|
+
if (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => semanticValueEqual(value, right[index]));
|
|
4493
|
+
if (left instanceof Date && right instanceof Date) return Object.is(readDateTimestamp$1(left), readDateTimestamp$1(right));
|
|
4494
|
+
if (isPlainObject(left) && isPlainObject(right)) {
|
|
4495
|
+
const leftKeys = Object.keys(left).sort();
|
|
4496
|
+
const rightKeys = Object.keys(right).sort();
|
|
4497
|
+
return leftKeys.length === rightKeys.length && leftKeys.every((key, index) => key === rightKeys[index] && semanticValueEqual(left[key], right[key]));
|
|
4498
|
+
}
|
|
4499
|
+
return false;
|
|
4500
|
+
}
|
|
4501
|
+
function orderingEqual(left, right) {
|
|
4502
|
+
return left.length === right.length && left.every((entry, index) => {
|
|
4503
|
+
var _right$index, _entry$direction, _right$index$directio, _right$index2, _entry$nulls, _right$index$nulls, _right$index3;
|
|
4504
|
+
return entry.columnId === ((_right$index = right[index]) === null || _right$index === void 0 ? void 0 : _right$index.columnId) && ((_entry$direction = entry.direction) !== null && _entry$direction !== void 0 ? _entry$direction : "asc") === ((_right$index$directio = (_right$index2 = right[index]) === null || _right$index2 === void 0 ? void 0 : _right$index2.direction) !== null && _right$index$directio !== void 0 ? _right$index$directio : "asc") && ((_entry$nulls = entry.nulls) !== null && _entry$nulls !== void 0 ? _entry$nulls : "last") === ((_right$index$nulls = (_right$index3 = right[index]) === null || _right$index3 === void 0 ? void 0 : _right$index3.nulls) !== null && _right$index$nulls !== void 0 ? _right$index$nulls : "last");
|
|
4505
|
+
});
|
|
4506
|
+
}
|
|
4507
|
+
function filterNodeEqual(left, right) {
|
|
4508
|
+
if (isRuntimeFilterGroup$1(left) || isRuntimeFilterGroup$1(right)) return isRuntimeFilterGroup$1(left) && isRuntimeFilterGroup$1(right) && left.op === right.op && filterNodeListEqual(left.children, right.children);
|
|
4509
|
+
return left.columnId === right.columnId && left.operator === right.operator && semanticValueEqual(left.value, right.value);
|
|
4510
|
+
}
|
|
4511
|
+
function filterNodeListEqual(left, right) {
|
|
4512
|
+
if (left.length !== right.length) return false;
|
|
4513
|
+
const used = /* @__PURE__ */ new Set();
|
|
4514
|
+
return left.every((filter) => {
|
|
4515
|
+
const index = right.findIndex((candidate, candidateIndex) => !used.has(candidateIndex) && filterNodeEqual(filter, candidate));
|
|
4516
|
+
if (index < 0) return false;
|
|
4517
|
+
used.add(index);
|
|
4518
|
+
return true;
|
|
4519
|
+
});
|
|
4520
|
+
}
|
|
4521
|
+
function queryEqual(left, right) {
|
|
4522
|
+
return filterNodeListEqual(left.filters, right.filters) && orderingEqual(left.sort, right.sort) && orderingEqual(left.rowGroups, right.rowGroups);
|
|
4523
|
+
}
|
|
4524
|
+
|
|
4474
4525
|
//#endregion
|
|
4475
4526
|
//#region ../row-model/dist/compiled-query.js
|
|
4476
4527
|
var CompiledQueryValidationError = class extends TypeError {
|
|
@@ -4880,40 +4931,6 @@ function validateQuery(query, columns) {
|
|
|
4880
4931
|
query.sort.forEach((entry, index) => validateOrdering(entry, byId, "sort", index));
|
|
4881
4932
|
query.rowGroups.forEach((entry, index) => validateOrdering(entry, byId, "rowGroups", index));
|
|
4882
4933
|
}
|
|
4883
|
-
function semanticValueEqual(left, right) {
|
|
4884
|
-
if (Object.is(left, right)) return true;
|
|
4885
|
-
if (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => semanticValueEqual(value, right[index]));
|
|
4886
|
-
if (left instanceof Date && right instanceof Date) return Object.is(readDateTimestamp(left), readDateTimestamp(right));
|
|
4887
|
-
if (isPlainObject(left) && isPlainObject(right)) {
|
|
4888
|
-
const leftKeys = Object.keys(left).sort();
|
|
4889
|
-
const rightKeys = Object.keys(right).sort();
|
|
4890
|
-
return leftKeys.length === rightKeys.length && leftKeys.every((key, index) => key === rightKeys[index] && semanticValueEqual(left[key], right[key]));
|
|
4891
|
-
}
|
|
4892
|
-
return false;
|
|
4893
|
-
}
|
|
4894
|
-
function orderingEqual(a, b) {
|
|
4895
|
-
return a.length === b.length && a.every((entry, index) => {
|
|
4896
|
-
var _entry$direction2, _b$index$direction, _entry$nulls, _b$index$nulls;
|
|
4897
|
-
return entry.columnId === b[index].columnId && ((_entry$direction2 = entry.direction) !== null && _entry$direction2 !== void 0 ? _entry$direction2 : "asc") === ((_b$index$direction = b[index].direction) !== null && _b$index$direction !== void 0 ? _b$index$direction : "asc") && ((_entry$nulls = entry.nulls) !== null && _entry$nulls !== void 0 ? _entry$nulls : "last") === ((_b$index$nulls = b[index].nulls) !== null && _b$index$nulls !== void 0 ? _b$index$nulls : "last");
|
|
4898
|
-
});
|
|
4899
|
-
}
|
|
4900
|
-
function queryEqual(left, right) {
|
|
4901
|
-
return filterNodeListEqual(left.filters, right.filters) && orderingEqual(left.sort, right.sort) && orderingEqual(left.rowGroups, right.rowGroups);
|
|
4902
|
-
}
|
|
4903
|
-
function filterNodeEqual(left, right) {
|
|
4904
|
-
if (isRuntimeFilterGroup(left) || isRuntimeFilterGroup(right)) return isRuntimeFilterGroup(left) && isRuntimeFilterGroup(right) && left.op === right.op && filterNodeListEqual(left.children, right.children);
|
|
4905
|
-
return left.columnId === right.columnId && left.operator === right.operator && semanticValueEqual(left.value, right.value);
|
|
4906
|
-
}
|
|
4907
|
-
function filterNodeListEqual(left, right) {
|
|
4908
|
-
if (left.length !== right.length) return false;
|
|
4909
|
-
const used = /* @__PURE__ */ new Set();
|
|
4910
|
-
return left.every((filter) => {
|
|
4911
|
-
const index = right.findIndex((candidate, candidateIndex) => !used.has(candidateIndex) && filterNodeEqual(filter, candidate));
|
|
4912
|
-
if (index < 0) return false;
|
|
4913
|
-
used.add(index);
|
|
4914
|
-
return true;
|
|
4915
|
-
});
|
|
4916
|
-
}
|
|
4917
4934
|
function derivationsEqualForPlan(left, right, query, filterLeaves) {
|
|
4918
4935
|
if (left.length !== right.length) return false;
|
|
4919
4936
|
const accessorIds = /* @__PURE__ */ new Set();
|
|
@@ -4937,11 +4954,6 @@ function derivationsEqualForPlan(left, right, query, filterLeaves) {
|
|
|
4937
4954
|
return true;
|
|
4938
4955
|
});
|
|
4939
4956
|
}
|
|
4940
|
-
function isPlainObject(value) {
|
|
4941
|
-
if (value === null || typeof value !== "object") return false;
|
|
4942
|
-
const prototype = Object.getPrototypeOf(value);
|
|
4943
|
-
return prototype === Object.prototype || prototype === null;
|
|
4944
|
-
}
|
|
4945
4957
|
function cloneOwnedValue(value, path, seen, columnId) {
|
|
4946
4958
|
if (value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint" || typeof value === "function") return value;
|
|
4947
4959
|
if (typeof value === "symbol") fail$1("symbols are not supported in compiled inputs", path, columnId);
|