@vuu-ui/vuu-utils 0.8.22-debug → 0.8.23-debug
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/index.js +1139 -83
- package/cjs/index.js.map +4 -4
- package/esm/index.js +1130 -74
- package/esm/index.js.map +4 -4
- package/package.json +5 -5
- package/types/column-utils.d.ts +42 -9
- package/types/date/formatter.d.ts +2 -0
- package/types/date/index.d.ts +2 -1
- package/types/date/utils.d.ts +2 -0
- package/types/filters/filterAsQuery.d.ts +5 -0
- package/types/filters/index.d.ts +2 -0
- package/types/{filter-utils.d.ts → filters/utils.d.ts} +3 -6
- package/types/formatting-utils.d.ts +1 -2
- package/types/index.d.ts +3 -1
- package/types/keyset.d.ts +4 -3
- package/types/module-utils.d.ts +9 -0
- package/types/range-utils.d.ts +2 -1
- package/types/react-utils.d.ts +2 -0
- /package/types/date/{helpers.d.ts → dateTimePattern.d.ts} +0 -0
package/esm/index.js
CHANGED
|
@@ -97,7 +97,64 @@ function boxContainsPoint(rect, x, y) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
// src/
|
|
100
|
+
// src/filters/filterAsQuery.ts
|
|
101
|
+
var filterValue = (value) => typeof value === "string" ? `"${value}"` : value;
|
|
102
|
+
var quotedStrings = (value) => typeof value === "string" ? `"${value}"` : value;
|
|
103
|
+
var removeOuterMostParentheses = (s) => s.replace(/^\((.*)\)$/, "$1");
|
|
104
|
+
var filterAsQuery = (f, opts) => {
|
|
105
|
+
return removeOuterMostParentheses(filterAsQueryCore(f, opts));
|
|
106
|
+
};
|
|
107
|
+
var filterAsQueryCore = (f, opts) => {
|
|
108
|
+
if (isMultiClauseFilter(f)) {
|
|
109
|
+
const multiClauseFilter = f.filters.map((filter) => filterAsQueryCore(filter, opts)).join(` ${f.op} `);
|
|
110
|
+
return `(${multiClauseFilter})`;
|
|
111
|
+
} else if (isMultiValueFilter(f)) {
|
|
112
|
+
return `${f.column} ${f.op} [${f.values.map(quotedStrings).join(",")}]`;
|
|
113
|
+
} else {
|
|
114
|
+
return singleValueFilterAsQuery(f, opts);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
function singleValueFilterAsQuery(f, opts) {
|
|
118
|
+
var _a;
|
|
119
|
+
const column = (_a = opts == null ? void 0 : opts.columnsByName) == null ? void 0 : _a[f.column];
|
|
120
|
+
if (column && isDateTimeColumn(column)) {
|
|
121
|
+
return dateFilterAsQuery(f);
|
|
122
|
+
} else {
|
|
123
|
+
return defaultSingleValueFilterAsQuery(f);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
var ONE_DAY_IN_MILIS = 1e3 * 60 * 60 * 24;
|
|
127
|
+
function dateFilterAsQuery(f) {
|
|
128
|
+
switch (f.op) {
|
|
129
|
+
case "=": {
|
|
130
|
+
const filters = [
|
|
131
|
+
{ op: ">=", column: f.column, value: f.value },
|
|
132
|
+
{
|
|
133
|
+
op: "<",
|
|
134
|
+
column: f.column,
|
|
135
|
+
value: f.value + ONE_DAY_IN_MILIS
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
return filterAsQueryCore({ op: "and", filters });
|
|
139
|
+
}
|
|
140
|
+
case "!=": {
|
|
141
|
+
const filters = [
|
|
142
|
+
{ op: "<", column: f.column, value: f.value },
|
|
143
|
+
{
|
|
144
|
+
op: ">=",
|
|
145
|
+
column: f.column,
|
|
146
|
+
value: f.value + ONE_DAY_IN_MILIS
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
return filterAsQueryCore({ op: "or", filters });
|
|
150
|
+
}
|
|
151
|
+
default:
|
|
152
|
+
return defaultSingleValueFilterAsQuery(f);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
var defaultSingleValueFilterAsQuery = (f) => `${f.column} ${f.op} ${filterValue(f.value)}`;
|
|
156
|
+
|
|
157
|
+
// src/filters/utils.ts
|
|
101
158
|
var singleValueFilterOps = /* @__PURE__ */ new Set([
|
|
102
159
|
"=",
|
|
103
160
|
"!=",
|
|
@@ -120,17 +177,6 @@ var isCompleteFilter = (filter) => isSingleValueFilter(filter) && filter.column
|
|
|
120
177
|
function isMultiClauseFilter(f) {
|
|
121
178
|
return f !== void 0 && (f.op === "and" || f.op === "or");
|
|
122
179
|
}
|
|
123
|
-
var filterValue = (value) => typeof value === "string" ? `"${value}"` : value;
|
|
124
|
-
var quotedStrings = (value) => typeof value === "string" ? `"${value}"` : value;
|
|
125
|
-
var filterAsQuery = (f) => {
|
|
126
|
-
if (isMultiClauseFilter(f)) {
|
|
127
|
-
return f.filters.map((filter) => filterAsQuery(filter)).join(` ${f.op} `);
|
|
128
|
-
} else if (isMultiValueFilter(f)) {
|
|
129
|
-
return `${f.column} ${f.op} [${f.values.map(quotedStrings).join(",")}]`;
|
|
130
|
-
} else {
|
|
131
|
-
return `${f.column} ${f.op} ${filterValue(f.value)}`;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
180
|
var removeColumnFromFilter = (column, filter) => {
|
|
135
181
|
if (isMultiClauseFilter(filter)) {
|
|
136
182
|
const [clause1, clause2] = filter.filters;
|
|
@@ -147,6 +193,9 @@ var removeColumnFromFilter = (column, filter) => {
|
|
|
147
193
|
// src/column-utils.ts
|
|
148
194
|
var SORT_ASC = "asc";
|
|
149
195
|
var NO_HEADINGS = [];
|
|
196
|
+
var DEFAULT_COL_WIDTH = 100;
|
|
197
|
+
var DEFAULT_MAX_WIDTH = 250;
|
|
198
|
+
var DEFAULT_MIN_WIDTH = 50;
|
|
150
199
|
var AggregationType = {
|
|
151
200
|
Average: 2,
|
|
152
201
|
Count: 3,
|
|
@@ -171,9 +220,6 @@ var numericTypes = ["int", "long", "double"];
|
|
|
171
220
|
var getDefaultAlignment = (serverDataType) => serverDataType === void 0 ? "left" : numericTypes.includes(serverDataType) ? "right" : "left";
|
|
172
221
|
var isValidColumnAlignment = (v) => v === "left" || v === "right";
|
|
173
222
|
var isValidPinLocation = (v) => isValidColumnAlignment(v) || v === "floating" || v === "";
|
|
174
|
-
var isKeyedColumn = (column) => {
|
|
175
|
-
return typeof column.key === "number";
|
|
176
|
-
};
|
|
177
223
|
var fromServerDataType = (serverDataType) => {
|
|
178
224
|
switch (serverDataType) {
|
|
179
225
|
case "double":
|
|
@@ -219,8 +265,6 @@ function buildColumnMap(columns) {
|
|
|
219
265
|
return columns.reduce((map, column, i) => {
|
|
220
266
|
if (typeof column === "string") {
|
|
221
267
|
map[column] = start + i;
|
|
222
|
-
} else if (isKeyedColumn(column)) {
|
|
223
|
-
map[column.name] = column.key;
|
|
224
268
|
} else {
|
|
225
269
|
map[column.name] = start + i;
|
|
226
270
|
}
|
|
@@ -318,7 +362,6 @@ function extractGroupColumn(columns, groupBy, confirmed = true) {
|
|
|
318
362
|
};
|
|
319
363
|
});
|
|
320
364
|
const groupCol = {
|
|
321
|
-
key: -1,
|
|
322
365
|
name: "group-col",
|
|
323
366
|
heading: ["group-col"],
|
|
324
367
|
isGroup: true,
|
|
@@ -332,9 +375,9 @@ function extractGroupColumn(columns, groupBy, confirmed = true) {
|
|
|
332
375
|
}
|
|
333
376
|
var isGroupColumn = (column) => column.isGroup === true;
|
|
334
377
|
var isJsonAttribute = (value) => typeof value === "string" && value.endsWith("+");
|
|
335
|
-
var isJsonGroup = (column, row) => {
|
|
378
|
+
var isJsonGroup = (column, row, columnMap) => {
|
|
336
379
|
var _a;
|
|
337
|
-
return ((_a = column.type) == null ? void 0 : _a.name) === "json" && isJsonAttribute(row[column.
|
|
380
|
+
return ((_a = column.type) == null ? void 0 : _a.name) === "json" && isJsonAttribute(row[columnMap[column.name]]);
|
|
338
381
|
};
|
|
339
382
|
var isJsonColumn = (column) => {
|
|
340
383
|
var _a;
|
|
@@ -387,6 +430,27 @@ var sortPinnedColumns = (columns) => {
|
|
|
387
430
|
return allColumns;
|
|
388
431
|
}
|
|
389
432
|
};
|
|
433
|
+
var measurePinnedColumns = (columns, selectionEndSize) => {
|
|
434
|
+
let pinnedWidthLeft = 0;
|
|
435
|
+
let pinnedWidthRight = 0;
|
|
436
|
+
let unpinnedWidth = 0;
|
|
437
|
+
for (const column of columns) {
|
|
438
|
+
const { hidden, pin, width } = column;
|
|
439
|
+
const visibleWidth = hidden ? 0 : width;
|
|
440
|
+
if (pin === "left") {
|
|
441
|
+
pinnedWidthLeft += visibleWidth;
|
|
442
|
+
} else if (pin === "right") {
|
|
443
|
+
pinnedWidthRight += visibleWidth;
|
|
444
|
+
} else {
|
|
445
|
+
unpinnedWidth += visibleWidth;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return {
|
|
449
|
+
pinnedWidthLeft: pinnedWidthLeft + selectionEndSize,
|
|
450
|
+
pinnedWidthRight: pinnedWidthRight + selectionEndSize,
|
|
451
|
+
unpinnedWidth
|
|
452
|
+
};
|
|
453
|
+
};
|
|
390
454
|
var getTableHeadings = (columns) => {
|
|
391
455
|
if (columns.some(hasHeadings)) {
|
|
392
456
|
const maxHeadingDepth = columns.reduce(
|
|
@@ -419,6 +483,8 @@ var getTableHeadings = (columns) => {
|
|
|
419
483
|
};
|
|
420
484
|
var getColumnStyle = ({
|
|
421
485
|
pin,
|
|
486
|
+
// the 4 is `selectionEndSize`, unfortunate if we need to be passed it from cell
|
|
487
|
+
// need to think about how to make this available
|
|
422
488
|
pinnedOffset = pin === "left" ? 0 : 4,
|
|
423
489
|
width
|
|
424
490
|
}) => pin === "left" ? {
|
|
@@ -578,25 +644,29 @@ var getColumnsInViewport = (columns, vpStart, vpEnd) => {
|
|
|
578
644
|
var _a;
|
|
579
645
|
const visibleColumns = [];
|
|
580
646
|
let preSpan = 0;
|
|
581
|
-
|
|
647
|
+
let rightPinnedOnly = false;
|
|
648
|
+
for (let columnOffset = 0, i = 0; i < columns.length; i++) {
|
|
582
649
|
const column = columns[i];
|
|
583
650
|
if (column.hidden) {
|
|
584
651
|
continue;
|
|
585
|
-
} else if (
|
|
652
|
+
} else if (rightPinnedOnly) {
|
|
653
|
+
if (column.pin === "right") {
|
|
654
|
+
visibleColumns.push(column);
|
|
655
|
+
}
|
|
656
|
+
} else if (columnOffset + column.width < vpStart) {
|
|
586
657
|
if (column.pin === "left") {
|
|
587
658
|
visibleColumns.push(column);
|
|
588
|
-
} else if (
|
|
659
|
+
} else if (columnOffset + column.width + ((_a = columns[i + 1]) == null ? void 0 : _a.width) > vpStart) {
|
|
589
660
|
visibleColumns.push(column);
|
|
590
661
|
} else {
|
|
591
662
|
preSpan += column.width;
|
|
592
663
|
}
|
|
593
|
-
} else if (
|
|
594
|
-
|
|
595
|
-
break;
|
|
664
|
+
} else if (columnOffset > vpEnd) {
|
|
665
|
+
rightPinnedOnly = true;
|
|
596
666
|
} else {
|
|
597
667
|
visibleColumns.push(column);
|
|
598
668
|
}
|
|
599
|
-
|
|
669
|
+
columnOffset += column.width;
|
|
600
670
|
}
|
|
601
671
|
return [visibleColumns, preSpan];
|
|
602
672
|
};
|
|
@@ -609,15 +679,15 @@ var visibleColumnAtIndex = (columns, index) => {
|
|
|
609
679
|
}
|
|
610
680
|
};
|
|
611
681
|
var { DEPTH, IS_LEAF } = metadataKeys;
|
|
612
|
-
var getGroupValueAndOffset = (columns, row) => {
|
|
682
|
+
var getGroupValueAndOffset = (columns, row, columnMap) => {
|
|
613
683
|
const { [DEPTH]: depth, [IS_LEAF]: isLeaf } = row;
|
|
614
684
|
if (isLeaf || depth > columns.length) {
|
|
615
685
|
return [null, depth === null ? 0 : Math.max(0, depth - 1)];
|
|
616
686
|
} else if (depth === 0) {
|
|
617
687
|
return ["$root", 0];
|
|
618
688
|
} else {
|
|
619
|
-
const {
|
|
620
|
-
const value = valueFormatter(row[
|
|
689
|
+
const { name, valueFormatter } = columns[depth - 1];
|
|
690
|
+
const value = valueFormatter(row[columnMap[name]]);
|
|
621
691
|
return [value, depth - 1];
|
|
622
692
|
}
|
|
623
693
|
};
|
|
@@ -780,6 +850,130 @@ var getColumnByName = (schema, name) => {
|
|
|
780
850
|
}
|
|
781
851
|
}
|
|
782
852
|
};
|
|
853
|
+
function applyWidthToColumns(columns, options) {
|
|
854
|
+
const {
|
|
855
|
+
availableWidth = 0,
|
|
856
|
+
columnLayout = "Static",
|
|
857
|
+
defaultWidth = DEFAULT_COL_WIDTH,
|
|
858
|
+
defaultMinWidth = DEFAULT_MIN_WIDTH,
|
|
859
|
+
defaultMaxWidth = DEFAULT_MAX_WIDTH
|
|
860
|
+
// defaultFlex = DEFAULT_FLEX,
|
|
861
|
+
} = options;
|
|
862
|
+
if (columnLayout === "Static") {
|
|
863
|
+
return columns.map((column) => {
|
|
864
|
+
if (typeof column.width === "number") {
|
|
865
|
+
return column;
|
|
866
|
+
} else {
|
|
867
|
+
return {
|
|
868
|
+
...column,
|
|
869
|
+
width: defaultWidth
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
|
+
} else if (columnLayout === "Fit") {
|
|
874
|
+
const { totalMinWidth, totalMaxWidth, totalWidth, flexCount } = columns.reduce(
|
|
875
|
+
(aggregated, column) => {
|
|
876
|
+
const { totalMinWidth: totalMinWidth2, totalMaxWidth: totalMaxWidth2, totalWidth: totalWidth2, flexCount: flexCount2 } = aggregated;
|
|
877
|
+
const {
|
|
878
|
+
minWidth = defaultMinWidth,
|
|
879
|
+
maxWidth = defaultMaxWidth,
|
|
880
|
+
width = defaultWidth,
|
|
881
|
+
flex = 0
|
|
882
|
+
} = column;
|
|
883
|
+
return {
|
|
884
|
+
totalMinWidth: totalMinWidth2 + minWidth,
|
|
885
|
+
totalMaxWidth: totalMaxWidth2 + maxWidth,
|
|
886
|
+
totalWidth: totalWidth2 + width,
|
|
887
|
+
flexCount: flexCount2 + flex
|
|
888
|
+
};
|
|
889
|
+
},
|
|
890
|
+
{ totalMinWidth: 0, totalMaxWidth: 0, totalWidth: 0, flexCount: 0 }
|
|
891
|
+
);
|
|
892
|
+
if (totalMinWidth > availableWidth || totalMaxWidth < availableWidth) {
|
|
893
|
+
return columns;
|
|
894
|
+
} else if (totalWidth > availableWidth) {
|
|
895
|
+
const excessWidth = totalWidth - availableWidth;
|
|
896
|
+
const inFlexMode = flexCount > 0;
|
|
897
|
+
let excessWidthPerColumn = excessWidth / (flexCount || columns.length);
|
|
898
|
+
let columnsNotYetAtMinWidth = columns.length;
|
|
899
|
+
let unassignedExcess = 0;
|
|
900
|
+
let newColumns = columns.map((column) => {
|
|
901
|
+
const {
|
|
902
|
+
minWidth = defaultMinWidth,
|
|
903
|
+
width = defaultWidth,
|
|
904
|
+
flex = 0
|
|
905
|
+
} = column;
|
|
906
|
+
if (inFlexMode && flex === 0) {
|
|
907
|
+
return column;
|
|
908
|
+
}
|
|
909
|
+
const adjustedWidth = width - excessWidthPerColumn;
|
|
910
|
+
if (adjustedWidth < minWidth) {
|
|
911
|
+
columnsNotYetAtMinWidth -= 1;
|
|
912
|
+
unassignedExcess += minWidth - adjustedWidth;
|
|
913
|
+
return { ...column, width: minWidth };
|
|
914
|
+
} else {
|
|
915
|
+
return { ...column, width: adjustedWidth };
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
if (unassignedExcess === 0) {
|
|
919
|
+
return newColumns;
|
|
920
|
+
} else {
|
|
921
|
+
excessWidthPerColumn = unassignedExcess / columnsNotYetAtMinWidth;
|
|
922
|
+
newColumns = newColumns.map((column) => {
|
|
923
|
+
const adjustedWidth = column.width - excessWidthPerColumn;
|
|
924
|
+
if (column.width !== column.minWidth) {
|
|
925
|
+
return { ...column, width: adjustedWidth };
|
|
926
|
+
} else {
|
|
927
|
+
return column;
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
return newColumns;
|
|
931
|
+
}
|
|
932
|
+
} else if (totalWidth < availableWidth) {
|
|
933
|
+
{
|
|
934
|
+
const additionalWidth = availableWidth - totalWidth;
|
|
935
|
+
const inFlexMode = flexCount > 0;
|
|
936
|
+
let additionalWidthPerColumn = additionalWidth / (flexCount || columns.length);
|
|
937
|
+
let newColumns = columns.map((column) => {
|
|
938
|
+
const {
|
|
939
|
+
maxWidth = defaultMaxWidth,
|
|
940
|
+
width = defaultWidth,
|
|
941
|
+
flex = 0
|
|
942
|
+
} = column;
|
|
943
|
+
if (inFlexMode && flex === 0) {
|
|
944
|
+
return column;
|
|
945
|
+
}
|
|
946
|
+
const adjustedWidth = width + additionalWidthPerColumn;
|
|
947
|
+
if (adjustedWidth > maxWidth) {
|
|
948
|
+
return { ...column, width: maxWidth };
|
|
949
|
+
} else {
|
|
950
|
+
return { ...column, width: adjustedWidth, canStretch: true };
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
const unassignedAdditionalColumnWidth = additionalWidth - newColumns.reduce((sum, col) => sum + col.width, 0);
|
|
954
|
+
const columnsNotYetAtMaxWidth = newColumns.filter(
|
|
955
|
+
(col) => col.canStretch
|
|
956
|
+
).length;
|
|
957
|
+
if (unassignedAdditionalColumnWidth > columnsNotYetAtMaxWidth) {
|
|
958
|
+
additionalWidthPerColumn = unassignedAdditionalColumnWidth / columnsNotYetAtMaxWidth;
|
|
959
|
+
newColumns = newColumns.map((column) => {
|
|
960
|
+
if (column.canStretch) {
|
|
961
|
+
const adjustedWidth = Math.min(
|
|
962
|
+
column.width + additionalWidthPerColumn
|
|
963
|
+
);
|
|
964
|
+
return { ...column, width: adjustedWidth };
|
|
965
|
+
} else {
|
|
966
|
+
return column;
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
return newColumns.map(({ canStretch, ...column }) => column);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
return columns;
|
|
975
|
+
}
|
|
976
|
+
var dataAndColumnUnchanged = (p, p1) => p.column === p1.column && p.column.valueFormatter(p.row[p.columnMap[p.column.name]]) === p1.column.valueFormatter(p1.row[p1.columnMap[p1.column.name]]);
|
|
783
977
|
|
|
784
978
|
// src/cookie-utils.ts
|
|
785
979
|
var getCookieValue = (name) => {
|
|
@@ -881,31 +1075,34 @@ function getEditRuleValidator(name) {
|
|
|
881
1075
|
|
|
882
1076
|
// src/range-utils.ts
|
|
883
1077
|
var NULL_RANGE = { from: 0, to: 0 };
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1078
|
+
var rangesAreSame = (r1, r2) => {
|
|
1079
|
+
return (r1 == null ? void 0 : r1.from) === (r2 == null ? void 0 : r2.from) && (r1 == null ? void 0 : r1.to) === (r2 == null ? void 0 : r2.to);
|
|
1080
|
+
};
|
|
1081
|
+
function getFullRange({ from, to }, bufferSize = 0, totalRowCount = Number.MAX_SAFE_INTEGER) {
|
|
1082
|
+
if (from === 0 && to === 0) {
|
|
1083
|
+
return { from, to };
|
|
1084
|
+
} else if (bufferSize === 0) {
|
|
1085
|
+
if (totalRowCount < from) {
|
|
887
1086
|
return { from: 0, to: 0 };
|
|
888
1087
|
} else {
|
|
889
|
-
return { from, to: Math.min(to,
|
|
1088
|
+
return { from, to: Math.min(to, totalRowCount) };
|
|
890
1089
|
}
|
|
891
1090
|
} else if (from === 0) {
|
|
892
|
-
return { from, to: Math.min(to + bufferSize,
|
|
1091
|
+
return { from, to: Math.min(to + bufferSize, totalRowCount) };
|
|
893
1092
|
} else {
|
|
894
|
-
const
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
if (shortfallBefore && shortFallAfter) {
|
|
899
|
-
return { from: 0, to: rowCount };
|
|
1093
|
+
const shortfallBefore = from - bufferSize < 0;
|
|
1094
|
+
const shortfallAfter = totalRowCount - (to + bufferSize) < 0;
|
|
1095
|
+
if (shortfallBefore && shortfallAfter) {
|
|
1096
|
+
return { from: 0, to: totalRowCount };
|
|
900
1097
|
} else if (shortfallBefore) {
|
|
901
|
-
return { from: 0, to:
|
|
902
|
-
} else if (
|
|
1098
|
+
return { from: 0, to: to + bufferSize };
|
|
1099
|
+
} else if (shortfallAfter) {
|
|
903
1100
|
return {
|
|
904
|
-
from: Math.max(0,
|
|
905
|
-
to:
|
|
1101
|
+
from: Math.max(0, from - bufferSize),
|
|
1102
|
+
to: totalRowCount
|
|
906
1103
|
};
|
|
907
1104
|
} else {
|
|
908
|
-
return { from: from -
|
|
1105
|
+
return { from: from - bufferSize, to: to + bufferSize };
|
|
909
1106
|
}
|
|
910
1107
|
}
|
|
911
1108
|
}
|
|
@@ -1000,7 +1197,7 @@ var DataWindow = class {
|
|
|
1000
1197
|
}
|
|
1001
1198
|
getData(from, to) {
|
|
1002
1199
|
var _a;
|
|
1003
|
-
const { from: clientFrom
|
|
1200
|
+
const { from: clientFrom } = this.range;
|
|
1004
1201
|
const startOffset = Math.max(0, from - clientFrom);
|
|
1005
1202
|
const endOffset = Math.min(to - clientFrom, (_a = this.rowCount) != null ? _a : to);
|
|
1006
1203
|
return this.data.slice(startOffset, endOffset);
|
|
@@ -1208,6 +1405,812 @@ var withConfigDefaults = (config) => {
|
|
|
1208
1405
|
}
|
|
1209
1406
|
};
|
|
1210
1407
|
|
|
1408
|
+
// ../../node_modules/@internationalized/date/node_modules/@swc/helpers/esm/_check_private_redeclaration.js
|
|
1409
|
+
function _check_private_redeclaration(obj, privateCollection) {
|
|
1410
|
+
if (privateCollection.has(obj)) {
|
|
1411
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
// ../../node_modules/@internationalized/date/node_modules/@swc/helpers/esm/_class_private_field_init.js
|
|
1416
|
+
function _class_private_field_init(obj, privateMap, value) {
|
|
1417
|
+
_check_private_redeclaration(obj, privateMap);
|
|
1418
|
+
privateMap.set(obj, value);
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
// ../../node_modules/@internationalized/date/dist/import.mjs
|
|
1422
|
+
function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
|
|
1423
|
+
return amount - numerator * Math.floor(amount / numerator);
|
|
1424
|
+
}
|
|
1425
|
+
var $3b62074eb05584b2$var$EPOCH = 1721426;
|
|
1426
|
+
function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
|
|
1427
|
+
year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
|
|
1428
|
+
let y1 = year - 1;
|
|
1429
|
+
let monthOffset = -2;
|
|
1430
|
+
if (month <= 2)
|
|
1431
|
+
monthOffset = 0;
|
|
1432
|
+
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year))
|
|
1433
|
+
monthOffset = -1;
|
|
1434
|
+
return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
|
|
1435
|
+
}
|
|
1436
|
+
function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
|
|
1437
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
1438
|
+
}
|
|
1439
|
+
function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
|
|
1440
|
+
return era === "BC" ? 1 - year : year;
|
|
1441
|
+
}
|
|
1442
|
+
function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
|
|
1443
|
+
let era = "AD";
|
|
1444
|
+
if (year <= 0) {
|
|
1445
|
+
era = "BC";
|
|
1446
|
+
year = 1 - year;
|
|
1447
|
+
}
|
|
1448
|
+
return [
|
|
1449
|
+
era,
|
|
1450
|
+
year
|
|
1451
|
+
];
|
|
1452
|
+
}
|
|
1453
|
+
var $3b62074eb05584b2$var$daysInMonth = {
|
|
1454
|
+
standard: [
|
|
1455
|
+
31,
|
|
1456
|
+
28,
|
|
1457
|
+
31,
|
|
1458
|
+
30,
|
|
1459
|
+
31,
|
|
1460
|
+
30,
|
|
1461
|
+
31,
|
|
1462
|
+
31,
|
|
1463
|
+
30,
|
|
1464
|
+
31,
|
|
1465
|
+
30,
|
|
1466
|
+
31
|
|
1467
|
+
],
|
|
1468
|
+
leapyear: [
|
|
1469
|
+
31,
|
|
1470
|
+
29,
|
|
1471
|
+
31,
|
|
1472
|
+
30,
|
|
1473
|
+
31,
|
|
1474
|
+
30,
|
|
1475
|
+
31,
|
|
1476
|
+
31,
|
|
1477
|
+
30,
|
|
1478
|
+
31,
|
|
1479
|
+
30,
|
|
1480
|
+
31
|
|
1481
|
+
]
|
|
1482
|
+
};
|
|
1483
|
+
var $3b62074eb05584b2$export$80ee6245ec4f29ec = class {
|
|
1484
|
+
fromJulianDay(jd) {
|
|
1485
|
+
let jd0 = jd;
|
|
1486
|
+
let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
|
|
1487
|
+
let quadricent = Math.floor(depoch / 146097);
|
|
1488
|
+
let dqc = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(depoch, 146097);
|
|
1489
|
+
let cent = Math.floor(dqc / 36524);
|
|
1490
|
+
let dcent = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dqc, 36524);
|
|
1491
|
+
let quad = Math.floor(dcent / 1461);
|
|
1492
|
+
let dquad = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dcent, 1461);
|
|
1493
|
+
let yindex = Math.floor(dquad / 365);
|
|
1494
|
+
let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
|
|
1495
|
+
let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
|
|
1496
|
+
let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
|
|
1497
|
+
let leapAdj = 2;
|
|
1498
|
+
if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1))
|
|
1499
|
+
leapAdj = 0;
|
|
1500
|
+
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year))
|
|
1501
|
+
leapAdj = 1;
|
|
1502
|
+
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
|
|
1503
|
+
let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
|
|
1504
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(era, year, month, day);
|
|
1505
|
+
}
|
|
1506
|
+
toJulianDay(date) {
|
|
1507
|
+
return $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, date.month, date.day);
|
|
1508
|
+
}
|
|
1509
|
+
getDaysInMonth(date) {
|
|
1510
|
+
return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1];
|
|
1511
|
+
}
|
|
1512
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1513
|
+
getMonthsInYear(date) {
|
|
1514
|
+
return 12;
|
|
1515
|
+
}
|
|
1516
|
+
getDaysInYear(date) {
|
|
1517
|
+
return $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
|
|
1518
|
+
}
|
|
1519
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1520
|
+
getYearsInEra(date) {
|
|
1521
|
+
return 9999;
|
|
1522
|
+
}
|
|
1523
|
+
getEras() {
|
|
1524
|
+
return [
|
|
1525
|
+
"BC",
|
|
1526
|
+
"AD"
|
|
1527
|
+
];
|
|
1528
|
+
}
|
|
1529
|
+
isInverseEra(date) {
|
|
1530
|
+
return date.era === "BC";
|
|
1531
|
+
}
|
|
1532
|
+
balanceDate(date) {
|
|
1533
|
+
if (date.year <= 0) {
|
|
1534
|
+
date.era = date.era === "BC" ? "AD" : "BC";
|
|
1535
|
+
date.year = 1 - date.year;
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
constructor() {
|
|
1539
|
+
this.identifier = "gregory";
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a, b) {
|
|
1543
|
+
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
|
|
1544
|
+
}
|
|
1545
|
+
function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
|
|
1546
|
+
return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
|
|
1547
|
+
}
|
|
1548
|
+
function $14e0f24ef4ac5c92$var$timeToMs(a) {
|
|
1549
|
+
return a.hour * 36e5 + a.minute * 6e4 + a.second * 1e3 + a.millisecond;
|
|
1550
|
+
}
|
|
1551
|
+
var $14e0f24ef4ac5c92$var$localTimeZone = null;
|
|
1552
|
+
function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
|
|
1553
|
+
if ($14e0f24ef4ac5c92$var$localTimeZone == null)
|
|
1554
|
+
$14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1555
|
+
return $14e0f24ef4ac5c92$var$localTimeZone;
|
|
1556
|
+
}
|
|
1557
|
+
function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) {
|
|
1558
|
+
date = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
|
|
1559
|
+
let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(date.era, date.year);
|
|
1560
|
+
return $11d87f3f76e88657$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
|
|
1561
|
+
}
|
|
1562
|
+
function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
|
|
1563
|
+
let date = /* @__PURE__ */ new Date();
|
|
1564
|
+
date.setUTCHours(hour, minute, second, millisecond);
|
|
1565
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
1566
|
+
return date.getTime();
|
|
1567
|
+
}
|
|
1568
|
+
function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) {
|
|
1569
|
+
if (timeZone === "UTC")
|
|
1570
|
+
return 0;
|
|
1571
|
+
if (ms > 0 && timeZone === (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)())
|
|
1572
|
+
return new Date(ms).getTimezoneOffset() * -6e4;
|
|
1573
|
+
let { year, month, day, hour, minute, second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone);
|
|
1574
|
+
let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0);
|
|
1575
|
+
return utc - Math.floor(ms / 1e3) * 1e3;
|
|
1576
|
+
}
|
|
1577
|
+
var $11d87f3f76e88657$var$formattersByTimeZone = /* @__PURE__ */ new Map();
|
|
1578
|
+
function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) {
|
|
1579
|
+
let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone);
|
|
1580
|
+
if (!formatter) {
|
|
1581
|
+
formatter = new Intl.DateTimeFormat("en-US", {
|
|
1582
|
+
timeZone,
|
|
1583
|
+
hour12: false,
|
|
1584
|
+
era: "short",
|
|
1585
|
+
year: "numeric",
|
|
1586
|
+
month: "numeric",
|
|
1587
|
+
day: "numeric",
|
|
1588
|
+
hour: "numeric",
|
|
1589
|
+
minute: "numeric",
|
|
1590
|
+
second: "numeric"
|
|
1591
|
+
});
|
|
1592
|
+
$11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter);
|
|
1593
|
+
}
|
|
1594
|
+
let parts = formatter.formatToParts(new Date(ms));
|
|
1595
|
+
let namedParts = {};
|
|
1596
|
+
for (let part of parts)
|
|
1597
|
+
if (part.type !== "literal")
|
|
1598
|
+
namedParts[part.type] = part.value;
|
|
1599
|
+
return {
|
|
1600
|
+
// Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
|
|
1601
|
+
year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year,
|
|
1602
|
+
month: +namedParts.month,
|
|
1603
|
+
day: +namedParts.day,
|
|
1604
|
+
hour: namedParts.hour === "24" ? 0 : +namedParts.hour,
|
|
1605
|
+
minute: +namedParts.minute,
|
|
1606
|
+
second: +namedParts.second
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
var $11d87f3f76e88657$var$DAYMILLIS = 864e5;
|
|
1610
|
+
function $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later) {
|
|
1611
|
+
let found = earlier === later ? [
|
|
1612
|
+
earlier
|
|
1613
|
+
] : [
|
|
1614
|
+
earlier,
|
|
1615
|
+
later
|
|
1616
|
+
];
|
|
1617
|
+
return found.filter((absolute) => $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute));
|
|
1618
|
+
}
|
|
1619
|
+
function $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute) {
|
|
1620
|
+
let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute, timeZone);
|
|
1621
|
+
return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
|
|
1622
|
+
}
|
|
1623
|
+
function $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation = "compatible") {
|
|
1624
|
+
let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date);
|
|
1625
|
+
if (timeZone === "UTC")
|
|
1626
|
+
return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
|
|
1627
|
+
if (timeZone === (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)() && disambiguation === "compatible") {
|
|
1628
|
+
dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
|
|
1629
|
+
let date2 = /* @__PURE__ */ new Date();
|
|
1630
|
+
let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(dateTime.era, dateTime.year);
|
|
1631
|
+
date2.setFullYear(year, dateTime.month - 1, dateTime.day);
|
|
1632
|
+
date2.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
|
|
1633
|
+
return date2.getTime();
|
|
1634
|
+
}
|
|
1635
|
+
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
|
|
1636
|
+
let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
|
|
1637
|
+
let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
|
|
1638
|
+
let valid = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
|
|
1639
|
+
if (valid.length === 1)
|
|
1640
|
+
return valid[0];
|
|
1641
|
+
if (valid.length > 1)
|
|
1642
|
+
switch (disambiguation) {
|
|
1643
|
+
case "compatible":
|
|
1644
|
+
case "earlier":
|
|
1645
|
+
return valid[0];
|
|
1646
|
+
case "later":
|
|
1647
|
+
return valid[valid.length - 1];
|
|
1648
|
+
case "reject":
|
|
1649
|
+
throw new RangeError("Multiple possible absolute times found");
|
|
1650
|
+
}
|
|
1651
|
+
switch (disambiguation) {
|
|
1652
|
+
case "earlier":
|
|
1653
|
+
return Math.min(ms - offsetBefore, ms - offsetAfter);
|
|
1654
|
+
case "compatible":
|
|
1655
|
+
case "later":
|
|
1656
|
+
return Math.max(ms - offsetBefore, ms - offsetAfter);
|
|
1657
|
+
case "reject":
|
|
1658
|
+
throw new RangeError("No such absolute time found");
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") {
|
|
1662
|
+
return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
|
|
1663
|
+
}
|
|
1664
|
+
function $11d87f3f76e88657$export$b21e0b124e224484(date, time) {
|
|
1665
|
+
let hour = 0, minute = 0, second = 0, millisecond = 0;
|
|
1666
|
+
if ("timeZone" in date)
|
|
1667
|
+
({ hour, minute, second, millisecond } = date);
|
|
1668
|
+
else if ("hour" in date && !time)
|
|
1669
|
+
return date;
|
|
1670
|
+
if (time)
|
|
1671
|
+
({ hour, minute, second, millisecond } = time);
|
|
1672
|
+
return new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
|
|
1673
|
+
}
|
|
1674
|
+
function $11d87f3f76e88657$export$b4a036af3fc0b032(date, calendar) {
|
|
1675
|
+
if (date.calendar.identifier === calendar.identifier)
|
|
1676
|
+
return date;
|
|
1677
|
+
let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
|
|
1678
|
+
let copy = date.copy();
|
|
1679
|
+
copy.calendar = calendar;
|
|
1680
|
+
copy.era = calendarDate.era;
|
|
1681
|
+
copy.year = calendarDate.year;
|
|
1682
|
+
copy.month = calendarDate.month;
|
|
1683
|
+
copy.day = calendarDate.day;
|
|
1684
|
+
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(copy);
|
|
1685
|
+
return copy;
|
|
1686
|
+
}
|
|
1687
|
+
function $735220c2d4774dd3$export$e16d8520af44a096(date, duration) {
|
|
1688
|
+
let mutableDate = date.copy();
|
|
1689
|
+
let days = "hour" in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration) : 0;
|
|
1690
|
+
$735220c2d4774dd3$var$addYears(mutableDate, duration.years || 0);
|
|
1691
|
+
if (mutableDate.calendar.balanceYearMonth)
|
|
1692
|
+
mutableDate.calendar.balanceYearMonth(mutableDate, date);
|
|
1693
|
+
mutableDate.month += duration.months || 0;
|
|
1694
|
+
$735220c2d4774dd3$var$balanceYearMonth(mutableDate);
|
|
1695
|
+
$735220c2d4774dd3$var$constrainMonthDay(mutableDate);
|
|
1696
|
+
mutableDate.day += (duration.weeks || 0) * 7;
|
|
1697
|
+
mutableDate.day += duration.days || 0;
|
|
1698
|
+
mutableDate.day += days;
|
|
1699
|
+
$735220c2d4774dd3$var$balanceDay(mutableDate);
|
|
1700
|
+
if (mutableDate.calendar.balanceDate)
|
|
1701
|
+
mutableDate.calendar.balanceDate(mutableDate);
|
|
1702
|
+
if (mutableDate.year < 1) {
|
|
1703
|
+
mutableDate.year = 1;
|
|
1704
|
+
mutableDate.month = 1;
|
|
1705
|
+
mutableDate.day = 1;
|
|
1706
|
+
}
|
|
1707
|
+
let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
|
|
1708
|
+
if (mutableDate.year > maxYear) {
|
|
1709
|
+
var _mutableDate_calendar, _mutableDate_calendar_isInverseEra;
|
|
1710
|
+
let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
|
|
1711
|
+
mutableDate.year = maxYear;
|
|
1712
|
+
mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
|
|
1713
|
+
mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
|
|
1714
|
+
}
|
|
1715
|
+
if (mutableDate.month < 1) {
|
|
1716
|
+
mutableDate.month = 1;
|
|
1717
|
+
mutableDate.day = 1;
|
|
1718
|
+
}
|
|
1719
|
+
let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
|
|
1720
|
+
if (mutableDate.month > maxMonth) {
|
|
1721
|
+
mutableDate.month = maxMonth;
|
|
1722
|
+
mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
|
|
1723
|
+
}
|
|
1724
|
+
mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
|
|
1725
|
+
return mutableDate;
|
|
1726
|
+
}
|
|
1727
|
+
function $735220c2d4774dd3$var$addYears(date, years) {
|
|
1728
|
+
var _date_calendar, _date_calendar_isInverseEra;
|
|
1729
|
+
if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date))
|
|
1730
|
+
years = -years;
|
|
1731
|
+
date.year += years;
|
|
1732
|
+
}
|
|
1733
|
+
function $735220c2d4774dd3$var$balanceYearMonth(date) {
|
|
1734
|
+
while (date.month < 1) {
|
|
1735
|
+
$735220c2d4774dd3$var$addYears(date, -1);
|
|
1736
|
+
date.month += date.calendar.getMonthsInYear(date);
|
|
1737
|
+
}
|
|
1738
|
+
let monthsInYear = 0;
|
|
1739
|
+
while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {
|
|
1740
|
+
date.month -= monthsInYear;
|
|
1741
|
+
$735220c2d4774dd3$var$addYears(date, 1);
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
function $735220c2d4774dd3$var$balanceDay(date) {
|
|
1745
|
+
while (date.day < 1) {
|
|
1746
|
+
date.month--;
|
|
1747
|
+
$735220c2d4774dd3$var$balanceYearMonth(date);
|
|
1748
|
+
date.day += date.calendar.getDaysInMonth(date);
|
|
1749
|
+
}
|
|
1750
|
+
while (date.day > date.calendar.getDaysInMonth(date)) {
|
|
1751
|
+
date.day -= date.calendar.getDaysInMonth(date);
|
|
1752
|
+
date.month++;
|
|
1753
|
+
$735220c2d4774dd3$var$balanceYearMonth(date);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
function $735220c2d4774dd3$var$constrainMonthDay(date) {
|
|
1757
|
+
date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
|
|
1758
|
+
date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
|
|
1759
|
+
}
|
|
1760
|
+
function $735220c2d4774dd3$export$c4e2ecac49351ef2(date) {
|
|
1761
|
+
if (date.calendar.constrainDate)
|
|
1762
|
+
date.calendar.constrainDate(date);
|
|
1763
|
+
date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
|
|
1764
|
+
$735220c2d4774dd3$var$constrainMonthDay(date);
|
|
1765
|
+
}
|
|
1766
|
+
function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
|
|
1767
|
+
let inverseDuration = {};
|
|
1768
|
+
for (let key in duration)
|
|
1769
|
+
if (typeof duration[key] === "number")
|
|
1770
|
+
inverseDuration[key] = -duration[key];
|
|
1771
|
+
return inverseDuration;
|
|
1772
|
+
}
|
|
1773
|
+
function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date, duration) {
|
|
1774
|
+
return $735220c2d4774dd3$export$e16d8520af44a096(date, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
|
|
1775
|
+
}
|
|
1776
|
+
function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date, fields) {
|
|
1777
|
+
let mutableDate = date.copy();
|
|
1778
|
+
if (fields.era != null)
|
|
1779
|
+
mutableDate.era = fields.era;
|
|
1780
|
+
if (fields.year != null)
|
|
1781
|
+
mutableDate.year = fields.year;
|
|
1782
|
+
if (fields.month != null)
|
|
1783
|
+
mutableDate.month = fields.month;
|
|
1784
|
+
if (fields.day != null)
|
|
1785
|
+
mutableDate.day = fields.day;
|
|
1786
|
+
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
|
|
1787
|
+
return mutableDate;
|
|
1788
|
+
}
|
|
1789
|
+
function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
|
|
1790
|
+
let mutableValue = value.copy();
|
|
1791
|
+
if (fields.hour != null)
|
|
1792
|
+
mutableValue.hour = fields.hour;
|
|
1793
|
+
if (fields.minute != null)
|
|
1794
|
+
mutableValue.minute = fields.minute;
|
|
1795
|
+
if (fields.second != null)
|
|
1796
|
+
mutableValue.second = fields.second;
|
|
1797
|
+
if (fields.millisecond != null)
|
|
1798
|
+
mutableValue.millisecond = fields.millisecond;
|
|
1799
|
+
$735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
|
|
1800
|
+
return mutableValue;
|
|
1801
|
+
}
|
|
1802
|
+
function $735220c2d4774dd3$var$balanceTime(time) {
|
|
1803
|
+
time.second += Math.floor(time.millisecond / 1e3);
|
|
1804
|
+
time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1e3);
|
|
1805
|
+
time.minute += Math.floor(time.second / 60);
|
|
1806
|
+
time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
|
|
1807
|
+
time.hour += Math.floor(time.minute / 60);
|
|
1808
|
+
time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
|
|
1809
|
+
let days = Math.floor(time.hour / 24);
|
|
1810
|
+
time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
|
|
1811
|
+
return days;
|
|
1812
|
+
}
|
|
1813
|
+
function $735220c2d4774dd3$export$7555de1e070510cb(time) {
|
|
1814
|
+
time.millisecond = Math.max(0, Math.min(time.millisecond, 1e3));
|
|
1815
|
+
time.second = Math.max(0, Math.min(time.second, 59));
|
|
1816
|
+
time.minute = Math.max(0, Math.min(time.minute, 59));
|
|
1817
|
+
time.hour = Math.max(0, Math.min(time.hour, 23));
|
|
1818
|
+
}
|
|
1819
|
+
function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
|
|
1820
|
+
let result = a % b;
|
|
1821
|
+
if (result < 0)
|
|
1822
|
+
result += b;
|
|
1823
|
+
return result;
|
|
1824
|
+
}
|
|
1825
|
+
function $735220c2d4774dd3$var$addTimeFields(time, duration) {
|
|
1826
|
+
time.hour += duration.hours || 0;
|
|
1827
|
+
time.minute += duration.minutes || 0;
|
|
1828
|
+
time.second += duration.seconds || 0;
|
|
1829
|
+
time.millisecond += duration.milliseconds || 0;
|
|
1830
|
+
return $735220c2d4774dd3$var$balanceTime(time);
|
|
1831
|
+
}
|
|
1832
|
+
function $735220c2d4774dd3$export$d52ced6badfb9a4c(value, field, amount, options) {
|
|
1833
|
+
let mutable = value.copy();
|
|
1834
|
+
switch (field) {
|
|
1835
|
+
case "era": {
|
|
1836
|
+
let eras = value.calendar.getEras();
|
|
1837
|
+
let eraIndex = eras.indexOf(value.era);
|
|
1838
|
+
if (eraIndex < 0)
|
|
1839
|
+
throw new Error("Invalid era: " + value.era);
|
|
1840
|
+
eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
|
|
1841
|
+
mutable.era = eras[eraIndex];
|
|
1842
|
+
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
|
|
1843
|
+
break;
|
|
1844
|
+
}
|
|
1845
|
+
case "year":
|
|
1846
|
+
var _mutable_calendar, _mutable_calendar_isInverseEra;
|
|
1847
|
+
if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable))
|
|
1848
|
+
amount = -amount;
|
|
1849
|
+
mutable.year = $735220c2d4774dd3$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
|
|
1850
|
+
if (mutable.year === -Infinity)
|
|
1851
|
+
mutable.year = 1;
|
|
1852
|
+
if (mutable.calendar.balanceYearMonth)
|
|
1853
|
+
mutable.calendar.balanceYearMonth(mutable, value);
|
|
1854
|
+
break;
|
|
1855
|
+
case "month":
|
|
1856
|
+
mutable.month = $735220c2d4774dd3$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round);
|
|
1857
|
+
break;
|
|
1858
|
+
case "day":
|
|
1859
|
+
mutable.day = $735220c2d4774dd3$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round);
|
|
1860
|
+
break;
|
|
1861
|
+
default:
|
|
1862
|
+
throw new Error("Unsupported field " + field);
|
|
1863
|
+
}
|
|
1864
|
+
if (value.calendar.balanceDate)
|
|
1865
|
+
value.calendar.balanceDate(mutable);
|
|
1866
|
+
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
|
|
1867
|
+
return mutable;
|
|
1868
|
+
}
|
|
1869
|
+
function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
|
|
1870
|
+
let mutable = value.copy();
|
|
1871
|
+
switch (field) {
|
|
1872
|
+
case "hour": {
|
|
1873
|
+
let hours = value.hour;
|
|
1874
|
+
let min = 0;
|
|
1875
|
+
let max = 23;
|
|
1876
|
+
if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
|
|
1877
|
+
let isPM = hours >= 12;
|
|
1878
|
+
min = isPM ? 12 : 0;
|
|
1879
|
+
max = isPM ? 23 : 11;
|
|
1880
|
+
}
|
|
1881
|
+
mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
|
|
1882
|
+
break;
|
|
1883
|
+
}
|
|
1884
|
+
case "minute":
|
|
1885
|
+
mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
|
|
1886
|
+
break;
|
|
1887
|
+
case "second":
|
|
1888
|
+
mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
|
|
1889
|
+
break;
|
|
1890
|
+
case "millisecond":
|
|
1891
|
+
mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
|
|
1892
|
+
break;
|
|
1893
|
+
default:
|
|
1894
|
+
throw new Error("Unsupported field " + field);
|
|
1895
|
+
}
|
|
1896
|
+
return mutable;
|
|
1897
|
+
}
|
|
1898
|
+
function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
|
|
1899
|
+
if (round) {
|
|
1900
|
+
value += Math.sign(amount);
|
|
1901
|
+
if (value < min)
|
|
1902
|
+
value = max;
|
|
1903
|
+
let div = Math.abs(amount);
|
|
1904
|
+
if (amount > 0)
|
|
1905
|
+
value = Math.ceil(value / div) * div;
|
|
1906
|
+
else
|
|
1907
|
+
value = Math.floor(value / div) * div;
|
|
1908
|
+
if (value > max)
|
|
1909
|
+
value = min;
|
|
1910
|
+
} else {
|
|
1911
|
+
value += amount;
|
|
1912
|
+
if (value < min)
|
|
1913
|
+
value = max - (min - value - 1);
|
|
1914
|
+
else if (value > max)
|
|
1915
|
+
value = min + (value - max - 1);
|
|
1916
|
+
}
|
|
1917
|
+
return value;
|
|
1918
|
+
}
|
|
1919
|
+
var $fae977aafc393c5c$var$requiredDurationTimeGroups = [
|
|
1920
|
+
"hours",
|
|
1921
|
+
"minutes",
|
|
1922
|
+
"seconds"
|
|
1923
|
+
];
|
|
1924
|
+
var $fae977aafc393c5c$var$requiredDurationGroups = [
|
|
1925
|
+
"years",
|
|
1926
|
+
"months",
|
|
1927
|
+
"weeks",
|
|
1928
|
+
"days",
|
|
1929
|
+
...$fae977aafc393c5c$var$requiredDurationTimeGroups
|
|
1930
|
+
];
|
|
1931
|
+
function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
|
|
1932
|
+
return `${String(time.hour).padStart(2, "0")}:${String(time.minute).padStart(2, "0")}:${String(time.second).padStart(2, "0")}${time.millisecond ? String(time.millisecond / 1e3).slice(1) : ""}`;
|
|
1933
|
+
}
|
|
1934
|
+
function $fae977aafc393c5c$export$60dfd74aa96791bd(date) {
|
|
1935
|
+
let gregorianDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
|
|
1936
|
+
return `${String(gregorianDate.year).padStart(4, "0")}-${String(gregorianDate.month).padStart(2, "0")}-${String(gregorianDate.day).padStart(2, "0")}`;
|
|
1937
|
+
}
|
|
1938
|
+
function $fae977aafc393c5c$export$4223de14708adc63(date) {
|
|
1939
|
+
return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date)}`;
|
|
1940
|
+
}
|
|
1941
|
+
function $35ea8db9cb2ccb90$var$shiftArgs(args) {
|
|
1942
|
+
let calendar = typeof args[0] === "object" ? args.shift() : new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)();
|
|
1943
|
+
let era;
|
|
1944
|
+
if (typeof args[0] === "string")
|
|
1945
|
+
era = args.shift();
|
|
1946
|
+
else {
|
|
1947
|
+
let eras = calendar.getEras();
|
|
1948
|
+
era = eras[eras.length - 1];
|
|
1949
|
+
}
|
|
1950
|
+
let year = args.shift();
|
|
1951
|
+
let month = args.shift();
|
|
1952
|
+
let day = args.shift();
|
|
1953
|
+
return [
|
|
1954
|
+
calendar,
|
|
1955
|
+
era,
|
|
1956
|
+
year,
|
|
1957
|
+
month,
|
|
1958
|
+
day
|
|
1959
|
+
];
|
|
1960
|
+
}
|
|
1961
|
+
var $35ea8db9cb2ccb90$var$_type = /* @__PURE__ */ new WeakMap();
|
|
1962
|
+
var $35ea8db9cb2ccb90$export$99faa760c7908e4f = class _$35ea8db9cb2ccb90$export$99faa760c7908e4f {
|
|
1963
|
+
/** Returns a copy of this date. */
|
|
1964
|
+
copy() {
|
|
1965
|
+
if (this.era)
|
|
1966
|
+
return new _$35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
|
|
1967
|
+
else
|
|
1968
|
+
return new _$35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
|
|
1969
|
+
}
|
|
1970
|
+
/** Returns a new `CalendarDate` with the given duration added to it. */
|
|
1971
|
+
add(duration) {
|
|
1972
|
+
return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration);
|
|
1973
|
+
}
|
|
1974
|
+
/** Returns a new `CalendarDate` with the given duration subtracted from it. */
|
|
1975
|
+
subtract(duration) {
|
|
1976
|
+
return (0, $735220c2d4774dd3$export$4e2d2ead65e5f7e3)(this, duration);
|
|
1977
|
+
}
|
|
1978
|
+
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
1979
|
+
set(fields) {
|
|
1980
|
+
return (0, $735220c2d4774dd3$export$adaa4cf7ef1b65be)(this, fields);
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
|
|
1984
|
+
* When the resulting value reaches the limits of the field, it wraps around.
|
|
1985
|
+
*/
|
|
1986
|
+
cycle(field, amount, options) {
|
|
1987
|
+
return (0, $735220c2d4774dd3$export$d52ced6badfb9a4c)(this, field, amount, options);
|
|
1988
|
+
}
|
|
1989
|
+
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
|
|
1990
|
+
toDate(timeZone) {
|
|
1991
|
+
return (0, $11d87f3f76e88657$export$e67a095c620b86fe)(this, timeZone);
|
|
1992
|
+
}
|
|
1993
|
+
/** Converts the date to an ISO 8601 formatted string. */
|
|
1994
|
+
toString() {
|
|
1995
|
+
return (0, $fae977aafc393c5c$export$60dfd74aa96791bd)(this);
|
|
1996
|
+
}
|
|
1997
|
+
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
1998
|
+
compare(b) {
|
|
1999
|
+
return (0, $14e0f24ef4ac5c92$export$68781ddf31c0090f)(this, b);
|
|
2000
|
+
}
|
|
2001
|
+
constructor(...args) {
|
|
2002
|
+
(0, _class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type, {
|
|
2003
|
+
writable: true,
|
|
2004
|
+
value: void 0
|
|
2005
|
+
});
|
|
2006
|
+
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
|
|
2007
|
+
this.calendar = calendar;
|
|
2008
|
+
this.era = era;
|
|
2009
|
+
this.year = year;
|
|
2010
|
+
this.month = month;
|
|
2011
|
+
this.day = day;
|
|
2012
|
+
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
var $35ea8db9cb2ccb90$var$_type2 = /* @__PURE__ */ new WeakMap();
|
|
2016
|
+
var $35ea8db9cb2ccb90$export$ca871e8dbb80966f = class _$35ea8db9cb2ccb90$export$ca871e8dbb80966f {
|
|
2017
|
+
/** Returns a copy of this date. */
|
|
2018
|
+
copy() {
|
|
2019
|
+
if (this.era)
|
|
2020
|
+
return new _$35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
2021
|
+
else
|
|
2022
|
+
return new _$35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
2023
|
+
}
|
|
2024
|
+
/** Returns a new `CalendarDateTime` with the given duration added to it. */
|
|
2025
|
+
add(duration) {
|
|
2026
|
+
return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration);
|
|
2027
|
+
}
|
|
2028
|
+
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
|
|
2029
|
+
subtract(duration) {
|
|
2030
|
+
return (0, $735220c2d4774dd3$export$4e2d2ead65e5f7e3)(this, duration);
|
|
2031
|
+
}
|
|
2032
|
+
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
2033
|
+
set(fields) {
|
|
2034
|
+
return (0, $735220c2d4774dd3$export$adaa4cf7ef1b65be)((0, $735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields), fields);
|
|
2035
|
+
}
|
|
2036
|
+
/**
|
|
2037
|
+
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
|
|
2038
|
+
* When the resulting value reaches the limits of the field, it wraps around.
|
|
2039
|
+
*/
|
|
2040
|
+
cycle(field, amount, options) {
|
|
2041
|
+
switch (field) {
|
|
2042
|
+
case "era":
|
|
2043
|
+
case "year":
|
|
2044
|
+
case "month":
|
|
2045
|
+
case "day":
|
|
2046
|
+
return (0, $735220c2d4774dd3$export$d52ced6badfb9a4c)(this, field, amount, options);
|
|
2047
|
+
default:
|
|
2048
|
+
return (0, $735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options);
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
/** Converts the date to a native JavaScript Date object in the given time zone. */
|
|
2052
|
+
toDate(timeZone, disambiguation) {
|
|
2053
|
+
return (0, $11d87f3f76e88657$export$e67a095c620b86fe)(this, timeZone, disambiguation);
|
|
2054
|
+
}
|
|
2055
|
+
/** Converts the date to an ISO 8601 formatted string. */
|
|
2056
|
+
toString() {
|
|
2057
|
+
return (0, $fae977aafc393c5c$export$4223de14708adc63)(this);
|
|
2058
|
+
}
|
|
2059
|
+
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
2060
|
+
compare(b) {
|
|
2061
|
+
let res = (0, $14e0f24ef4ac5c92$export$68781ddf31c0090f)(this, b);
|
|
2062
|
+
if (res === 0)
|
|
2063
|
+
return (0, $14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, (0, $11d87f3f76e88657$export$b21e0b124e224484)(b));
|
|
2064
|
+
return res;
|
|
2065
|
+
}
|
|
2066
|
+
constructor(...args) {
|
|
2067
|
+
(0, _class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type2, {
|
|
2068
|
+
writable: true,
|
|
2069
|
+
value: void 0
|
|
2070
|
+
});
|
|
2071
|
+
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
|
|
2072
|
+
this.calendar = calendar;
|
|
2073
|
+
this.era = era;
|
|
2074
|
+
this.year = year;
|
|
2075
|
+
this.month = month;
|
|
2076
|
+
this.day = day;
|
|
2077
|
+
this.hour = args.shift() || 0;
|
|
2078
|
+
this.minute = args.shift() || 0;
|
|
2079
|
+
this.second = args.shift() || 0;
|
|
2080
|
+
this.millisecond = args.shift() || 0;
|
|
2081
|
+
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
|
|
2082
|
+
}
|
|
2083
|
+
};
|
|
2084
|
+
var $7c5f6fbf42389787$var$HOUR_PARTS = 1080;
|
|
2085
|
+
var $7c5f6fbf42389787$var$DAY_PARTS = 24 * $7c5f6fbf42389787$var$HOUR_PARTS;
|
|
2086
|
+
var $7c5f6fbf42389787$var$MONTH_DAYS = 29;
|
|
2087
|
+
var $7c5f6fbf42389787$var$MONTH_FRACT = 12 * $7c5f6fbf42389787$var$HOUR_PARTS + 793;
|
|
2088
|
+
var $7c5f6fbf42389787$var$MONTH_PARTS = $7c5f6fbf42389787$var$MONTH_DAYS * $7c5f6fbf42389787$var$DAY_PARTS + $7c5f6fbf42389787$var$MONTH_FRACT;
|
|
2089
|
+
var $fb18d541ea1ad717$var$formatterCache = /* @__PURE__ */ new Map();
|
|
2090
|
+
var $fb18d541ea1ad717$export$ad991b66133851cf = class {
|
|
2091
|
+
/** Formats a date as a string according to the locale and format options passed to the constructor. */
|
|
2092
|
+
format(value) {
|
|
2093
|
+
return this.formatter.format(value);
|
|
2094
|
+
}
|
|
2095
|
+
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
|
|
2096
|
+
formatToParts(value) {
|
|
2097
|
+
return this.formatter.formatToParts(value);
|
|
2098
|
+
}
|
|
2099
|
+
/** Formats a date range as a string. */
|
|
2100
|
+
formatRange(start, end) {
|
|
2101
|
+
if (typeof this.formatter.formatRange === "function")
|
|
2102
|
+
return this.formatter.formatRange(start, end);
|
|
2103
|
+
if (end < start)
|
|
2104
|
+
throw new RangeError("End date must be >= start date");
|
|
2105
|
+
return `${this.formatter.format(start)} \u2013 ${this.formatter.format(end)}`;
|
|
2106
|
+
}
|
|
2107
|
+
/** Formats a date range as an array of parts. */
|
|
2108
|
+
formatRangeToParts(start, end) {
|
|
2109
|
+
if (typeof this.formatter.formatRangeToParts === "function")
|
|
2110
|
+
return this.formatter.formatRangeToParts(start, end);
|
|
2111
|
+
if (end < start)
|
|
2112
|
+
throw new RangeError("End date must be >= start date");
|
|
2113
|
+
let startParts = this.formatter.formatToParts(start);
|
|
2114
|
+
let endParts = this.formatter.formatToParts(end);
|
|
2115
|
+
return [
|
|
2116
|
+
...startParts.map((p) => ({
|
|
2117
|
+
...p,
|
|
2118
|
+
source: "startRange"
|
|
2119
|
+
})),
|
|
2120
|
+
{
|
|
2121
|
+
type: "literal",
|
|
2122
|
+
value: " \u2013 ",
|
|
2123
|
+
source: "shared"
|
|
2124
|
+
},
|
|
2125
|
+
...endParts.map((p) => ({
|
|
2126
|
+
...p,
|
|
2127
|
+
source: "endRange"
|
|
2128
|
+
}))
|
|
2129
|
+
];
|
|
2130
|
+
}
|
|
2131
|
+
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
2132
|
+
resolvedOptions() {
|
|
2133
|
+
let resolvedOptions = this.formatter.resolvedOptions();
|
|
2134
|
+
if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
|
|
2135
|
+
if (!this.resolvedHourCycle)
|
|
2136
|
+
this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
|
|
2137
|
+
resolvedOptions.hourCycle = this.resolvedHourCycle;
|
|
2138
|
+
resolvedOptions.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12";
|
|
2139
|
+
}
|
|
2140
|
+
if (resolvedOptions.calendar === "ethiopic-amete-alem")
|
|
2141
|
+
resolvedOptions.calendar = "ethioaa";
|
|
2142
|
+
return resolvedOptions;
|
|
2143
|
+
}
|
|
2144
|
+
constructor(locale, options = {}) {
|
|
2145
|
+
this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options);
|
|
2146
|
+
this.options = options;
|
|
2147
|
+
}
|
|
2148
|
+
};
|
|
2149
|
+
var $fb18d541ea1ad717$var$hour12Preferences = {
|
|
2150
|
+
true: {
|
|
2151
|
+
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
|
|
2152
|
+
ja: "h11"
|
|
2153
|
+
},
|
|
2154
|
+
false: {}
|
|
2155
|
+
};
|
|
2156
|
+
function $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options = {}) {
|
|
2157
|
+
if (typeof options.hour12 === "boolean" && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
|
|
2158
|
+
options = {
|
|
2159
|
+
...options
|
|
2160
|
+
};
|
|
2161
|
+
let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale.split("-")[0]];
|
|
2162
|
+
let defaultHourCycle = options.hour12 ? "h12" : "h23";
|
|
2163
|
+
options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
|
|
2164
|
+
delete options.hour12;
|
|
2165
|
+
}
|
|
2166
|
+
let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
|
|
2167
|
+
if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey))
|
|
2168
|
+
return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
|
|
2169
|
+
let numberFormatter = new Intl.DateTimeFormat(locale, options);
|
|
2170
|
+
$fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
|
|
2171
|
+
return numberFormatter;
|
|
2172
|
+
}
|
|
2173
|
+
var $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
|
|
2174
|
+
function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
|
|
2175
|
+
if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null)
|
|
2176
|
+
$fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat("en-US", {
|
|
2177
|
+
hour: "numeric",
|
|
2178
|
+
hour12: false
|
|
2179
|
+
}).format(new Date(2020, 2, 3, 0)) === "24";
|
|
2180
|
+
return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
|
|
2181
|
+
}
|
|
2182
|
+
var $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
|
|
2183
|
+
function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
|
|
2184
|
+
if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null)
|
|
2185
|
+
$fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat("fr", {
|
|
2186
|
+
hour: "numeric",
|
|
2187
|
+
hour12: false
|
|
2188
|
+
}).resolvedOptions().hourCycle === "h12";
|
|
2189
|
+
return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
|
|
2190
|
+
}
|
|
2191
|
+
function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
|
|
2192
|
+
if (!options.timeStyle && !options.hour)
|
|
2193
|
+
return void 0;
|
|
2194
|
+
locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, "");
|
|
2195
|
+
locale += (locale.includes("-u-") ? "" : "-u") + "-nu-latn";
|
|
2196
|
+
let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, {
|
|
2197
|
+
...options,
|
|
2198
|
+
timeZone: void 0
|
|
2199
|
+
// use local timezone
|
|
2200
|
+
});
|
|
2201
|
+
let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p) => p.type === "hour").value, 10);
|
|
2202
|
+
let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p) => p.type === "hour").value, 10);
|
|
2203
|
+
if (min === 0 && max === 23)
|
|
2204
|
+
return "h23";
|
|
2205
|
+
if (min === 24 && max === 23)
|
|
2206
|
+
return "h24";
|
|
2207
|
+
if (min === 0 && max === 11)
|
|
2208
|
+
return "h11";
|
|
2209
|
+
if (min === 12 && max === 11)
|
|
2210
|
+
return "h12";
|
|
2211
|
+
throw new Error("Unexpected hour cycle result");
|
|
2212
|
+
}
|
|
2213
|
+
|
|
1211
2214
|
// src/ts-utils.ts
|
|
1212
2215
|
function isNotNullOrUndefined(value) {
|
|
1213
2216
|
return value !== void 0 && value !== null;
|
|
@@ -1265,8 +2268,11 @@ function getFormatConfigs(pattern) {
|
|
|
1265
2268
|
];
|
|
1266
2269
|
}
|
|
1267
2270
|
function formatDate(pattern) {
|
|
1268
|
-
const
|
|
1269
|
-
return (d) =>
|
|
2271
|
+
const formatters = getFormatConfigs(pattern).filter(isNotNullOrUndefined).map((c) => getDateFormatter(c.locale, c.options));
|
|
2272
|
+
return (d) => formatters.map((f) => f.format(d)).join(" ");
|
|
2273
|
+
}
|
|
2274
|
+
function getDateFormatter(locale, options) {
|
|
2275
|
+
return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, options);
|
|
1270
2276
|
}
|
|
1271
2277
|
|
|
1272
2278
|
// src/date/types.ts
|
|
@@ -1288,7 +2294,12 @@ var isDatePattern = (pattern) => supportedDatePatterns.includes(pattern);
|
|
|
1288
2294
|
var isTimePattern = (pattern) => supportedTimePatterns.includes(pattern);
|
|
1289
2295
|
var isDateTimePattern = (pattern) => isDatePattern(pattern == null ? void 0 : pattern.date) || isTimePattern(pattern == null ? void 0 : pattern.time);
|
|
1290
2296
|
|
|
1291
|
-
// src/date/
|
|
2297
|
+
// src/date/utils.ts
|
|
2298
|
+
function toCalendarDate(d) {
|
|
2299
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(d.getFullYear(), d.getMonth() + 1, d.getDate());
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
// src/date/dateTimePattern.ts
|
|
1292
2303
|
var defaultPatternsByType = {
|
|
1293
2304
|
time: "hh:mm:ss",
|
|
1294
2305
|
date: "dd.mm.yyyy"
|
|
@@ -1888,60 +2899,81 @@ var Space2 = " ";
|
|
|
1888
2899
|
var Tab = "Tab";
|
|
1889
2900
|
|
|
1890
2901
|
// src/keyset.ts
|
|
2902
|
+
var EMPTY2 = [];
|
|
1891
2903
|
var KeySet = class {
|
|
1892
2904
|
constructor(range) {
|
|
1893
2905
|
this.keys = /* @__PURE__ */ new Map();
|
|
1894
|
-
this.free = [];
|
|
1895
2906
|
this.nextKeyValue = 0;
|
|
1896
|
-
this.
|
|
2907
|
+
this.range = range;
|
|
2908
|
+
this.init(range);
|
|
1897
2909
|
}
|
|
1898
|
-
next() {
|
|
1899
|
-
if (
|
|
1900
|
-
return
|
|
2910
|
+
next(free = EMPTY2) {
|
|
2911
|
+
if (free.length > 0) {
|
|
2912
|
+
return free.shift();
|
|
1901
2913
|
} else {
|
|
1902
2914
|
return this.nextKeyValue++;
|
|
1903
2915
|
}
|
|
1904
2916
|
}
|
|
1905
|
-
|
|
2917
|
+
init({ from, to }) {
|
|
2918
|
+
this.keys.clear();
|
|
2919
|
+
this.nextKeyValue = 0;
|
|
2920
|
+
for (let rowIndex = from; rowIndex < to; rowIndex++) {
|
|
2921
|
+
const nextKeyValue = this.next();
|
|
2922
|
+
this.keys.set(rowIndex, nextKeyValue);
|
|
2923
|
+
}
|
|
2924
|
+
return true;
|
|
2925
|
+
}
|
|
2926
|
+
reset(range) {
|
|
2927
|
+
const { from, to } = range;
|
|
2928
|
+
const newSize = to - from;
|
|
2929
|
+
const currentSize = this.range.to - this.range.from;
|
|
2930
|
+
this.range = range;
|
|
2931
|
+
if (currentSize > newSize) {
|
|
2932
|
+
return this.init(range);
|
|
2933
|
+
}
|
|
2934
|
+
const freeKeys = [];
|
|
1906
2935
|
this.keys.forEach((keyValue, rowIndex) => {
|
|
1907
2936
|
if (rowIndex < from || rowIndex >= to) {
|
|
1908
|
-
|
|
2937
|
+
freeKeys.push(keyValue);
|
|
1909
2938
|
this.keys.delete(rowIndex);
|
|
1910
2939
|
}
|
|
1911
2940
|
});
|
|
1912
|
-
const size2 = to - from;
|
|
1913
|
-
if (this.keys.size + this.free.length > size2) {
|
|
1914
|
-
this.free.length = Math.max(0, size2 - this.keys.size);
|
|
1915
|
-
}
|
|
1916
2941
|
for (let rowIndex = from; rowIndex < to; rowIndex++) {
|
|
1917
2942
|
if (!this.keys.has(rowIndex)) {
|
|
1918
|
-
const nextKeyValue = this.next();
|
|
2943
|
+
const nextKeyValue = this.next(freeKeys);
|
|
1919
2944
|
this.keys.set(rowIndex, nextKeyValue);
|
|
1920
2945
|
}
|
|
1921
2946
|
}
|
|
1922
|
-
|
|
1923
|
-
this.nextKeyValue = this.keys.size;
|
|
1924
|
-
}
|
|
2947
|
+
return false;
|
|
1925
2948
|
}
|
|
1926
2949
|
keyFor(rowIndex) {
|
|
1927
2950
|
const key = this.keys.get(rowIndex);
|
|
1928
2951
|
if (key === void 0) {
|
|
1929
2952
|
console.log(`key not found
|
|
1930
2953
|
keys: ${this.toDebugString()}
|
|
1931
|
-
free : ${this.free.join(",")}
|
|
1932
2954
|
`);
|
|
1933
2955
|
throw Error(`KeySet, no key found for rowIndex ${rowIndex}`);
|
|
1934
2956
|
}
|
|
1935
2957
|
return key;
|
|
1936
2958
|
}
|
|
1937
2959
|
toDebugString() {
|
|
1938
|
-
return
|
|
2960
|
+
return `${this.keys.size} keys
|
|
2961
|
+
${Array.from(this.keys.entries()).sort(([key1], [key2]) => key1 - key2).map(([k, v]) => `${k}=>${v}`).join(",")}]
|
|
2962
|
+
`;
|
|
1939
2963
|
}
|
|
1940
2964
|
};
|
|
1941
2965
|
|
|
1942
2966
|
// src/menu-utils.ts
|
|
1943
2967
|
var isGroupMenuItemDescriptor = (menuItem) => menuItem !== void 0 && "children" in menuItem;
|
|
1944
2968
|
|
|
2969
|
+
// src/module-utils.ts
|
|
2970
|
+
var isModule = (entity) => entity !== void 0 && typeof entity !== "function";
|
|
2971
|
+
var assertModuleExportsAtLeastOneComponent = (module) => {
|
|
2972
|
+
if (module && Object.values(module).every((item) => isModule(item))) {
|
|
2973
|
+
throw Error("module file, no components");
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
|
|
1945
2977
|
// src/nanoid/index.ts
|
|
1946
2978
|
var uuid = (size2 = 21) => {
|
|
1947
2979
|
let id = "";
|
|
@@ -1961,6 +2993,23 @@ var uuid = (size2 = 21) => {
|
|
|
1961
2993
|
return id;
|
|
1962
2994
|
};
|
|
1963
2995
|
|
|
2996
|
+
// src/react-utils.ts
|
|
2997
|
+
import { Children, isValidElement } from "react";
|
|
2998
|
+
var EMPTY_ARRAY = [];
|
|
2999
|
+
var asReactElements = (children) => {
|
|
3000
|
+
const isArray = Array.isArray(children);
|
|
3001
|
+
const count = isArray ? children.length : Children.count(children);
|
|
3002
|
+
if (isArray && children.every(isValidElement)) {
|
|
3003
|
+
return children;
|
|
3004
|
+
} else if (count === 1 && !isArray && isValidElement(children)) {
|
|
3005
|
+
return [children];
|
|
3006
|
+
} else if (count > 1) {
|
|
3007
|
+
return children;
|
|
3008
|
+
} else {
|
|
3009
|
+
return EMPTY_ARRAY;
|
|
3010
|
+
}
|
|
3011
|
+
};
|
|
3012
|
+
|
|
1964
3013
|
// src/perf-utils.ts
|
|
1965
3014
|
function debounce(callback, timeInterval) {
|
|
1966
3015
|
let timeout;
|
|
@@ -2000,9 +3049,9 @@ var actualRowPositioning = (rowHeight) => [
|
|
|
2000
3049
|
false
|
|
2001
3050
|
];
|
|
2002
3051
|
var virtualRowPositioning = (rowHeight, virtualisedExtent, pctScrollTop) => [
|
|
2003
|
-
(row) => {
|
|
3052
|
+
(row, offset = 0) => {
|
|
2004
3053
|
const rowOffset = pctScrollTop.current * virtualisedExtent;
|
|
2005
|
-
return row[IDX] * rowHeight - rowOffset;
|
|
3054
|
+
return (row[IDX] - offset) * rowHeight - rowOffset;
|
|
2006
3055
|
},
|
|
2007
3056
|
/*
|
|
2008
3057
|
Return index position of closest row
|
|
@@ -2335,7 +3384,7 @@ var wordify = (text) => {
|
|
|
2335
3384
|
// src/ThemeProvider.tsx
|
|
2336
3385
|
import {
|
|
2337
3386
|
createContext,
|
|
2338
|
-
isValidElement,
|
|
3387
|
+
isValidElement as isValidElement2,
|
|
2339
3388
|
cloneElement,
|
|
2340
3389
|
useContext
|
|
2341
3390
|
} from "react";
|
|
@@ -2395,7 +3444,7 @@ var useThemeAttributes = (themeAttributes) => {
|
|
|
2395
3444
|
};
|
|
2396
3445
|
var createThemedChildren = (children, theme, themeMode, density) => {
|
|
2397
3446
|
var _a;
|
|
2398
|
-
if (
|
|
3447
|
+
if (isValidElement2(children)) {
|
|
2399
3448
|
return cloneElement(children, {
|
|
2400
3449
|
className: clsx_default(
|
|
2401
3450
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
@@ -2503,11 +3552,16 @@ export {
|
|
|
2503
3552
|
applyGroupByToColumns,
|
|
2504
3553
|
applySort,
|
|
2505
3554
|
applySortToColumns,
|
|
3555
|
+
applyWidthToColumns,
|
|
3556
|
+
asReactElements,
|
|
3557
|
+
assertModuleExportsAtLeastOneComponent,
|
|
2506
3558
|
boxContainsPoint,
|
|
2507
3559
|
buildColumnMap,
|
|
2508
3560
|
columnsChanged,
|
|
2509
3561
|
configChanged,
|
|
2510
3562
|
createEl,
|
|
3563
|
+
dataAndColumnUnchanged,
|
|
3564
|
+
dateTimePattern,
|
|
2511
3565
|
debounce,
|
|
2512
3566
|
defaultPatternsByType,
|
|
2513
3567
|
defaultValueFormatter,
|
|
@@ -2520,7 +3574,6 @@ export {
|
|
|
2520
3574
|
fallbackDateTimePattern,
|
|
2521
3575
|
filterAsQuery,
|
|
2522
3576
|
filterChanged,
|
|
2523
|
-
filterValue,
|
|
2524
3577
|
findColumn,
|
|
2525
3578
|
flattenColumnGroup,
|
|
2526
3579
|
focusFirstFocusableElement,
|
|
@@ -2545,6 +3598,7 @@ export {
|
|
|
2545
3598
|
getColumnsInViewport,
|
|
2546
3599
|
getConfigurationEditor,
|
|
2547
3600
|
getCookieValue,
|
|
3601
|
+
getDateFormatter,
|
|
2548
3602
|
getDefaultAlignment,
|
|
2549
3603
|
getDefaultColumnType,
|
|
2550
3604
|
getEditRuleValidator,
|
|
@@ -2595,9 +3649,9 @@ export {
|
|
|
2595
3649
|
isJsonAttribute,
|
|
2596
3650
|
isJsonColumn,
|
|
2597
3651
|
isJsonGroup,
|
|
2598
|
-
isKeyedColumn,
|
|
2599
3652
|
isLookupRenderer,
|
|
2600
3653
|
isMappedValueTypeRenderer,
|
|
3654
|
+
isModule,
|
|
2601
3655
|
isMultiClauseFilter,
|
|
2602
3656
|
isMultiValueFilter,
|
|
2603
3657
|
isNamedFilter,
|
|
@@ -2635,6 +3689,7 @@ export {
|
|
|
2635
3689
|
lastWord,
|
|
2636
3690
|
logger,
|
|
2637
3691
|
mapSortCriteria,
|
|
3692
|
+
measurePinnedColumns,
|
|
2638
3693
|
messageHasResult,
|
|
2639
3694
|
metadataKeys,
|
|
2640
3695
|
moveColumnTo,
|
|
@@ -2643,8 +3698,8 @@ export {
|
|
|
2643
3698
|
numericFormatter,
|
|
2644
3699
|
partition,
|
|
2645
3700
|
projectUpdates,
|
|
2646
|
-
quotedStrings,
|
|
2647
3701
|
rangeNewItems,
|
|
3702
|
+
rangesAreSame,
|
|
2648
3703
|
registerComponent,
|
|
2649
3704
|
registerConfigurationEditor,
|
|
2650
3705
|
removeColumnFromFilter,
|
|
@@ -2663,6 +3718,7 @@ export {
|
|
|
2663
3718
|
subscribedOnly,
|
|
2664
3719
|
supportedDateTimePatterns,
|
|
2665
3720
|
throttle,
|
|
3721
|
+
toCalendarDate,
|
|
2666
3722
|
toColumnDescriptor,
|
|
2667
3723
|
toDataSourceColumns,
|
|
2668
3724
|
updateColumn,
|