@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/cjs/index.js
CHANGED
|
@@ -74,11 +74,16 @@ __export(src_exports, {
|
|
|
74
74
|
applyGroupByToColumns: () => applyGroupByToColumns,
|
|
75
75
|
applySort: () => applySort,
|
|
76
76
|
applySortToColumns: () => applySortToColumns,
|
|
77
|
+
applyWidthToColumns: () => applyWidthToColumns,
|
|
78
|
+
asReactElements: () => asReactElements,
|
|
79
|
+
assertModuleExportsAtLeastOneComponent: () => assertModuleExportsAtLeastOneComponent,
|
|
77
80
|
boxContainsPoint: () => boxContainsPoint,
|
|
78
81
|
buildColumnMap: () => buildColumnMap,
|
|
79
82
|
columnsChanged: () => columnsChanged,
|
|
80
83
|
configChanged: () => configChanged,
|
|
81
84
|
createEl: () => createEl,
|
|
85
|
+
dataAndColumnUnchanged: () => dataAndColumnUnchanged,
|
|
86
|
+
dateTimePattern: () => dateTimePattern,
|
|
82
87
|
debounce: () => debounce,
|
|
83
88
|
defaultPatternsByType: () => defaultPatternsByType,
|
|
84
89
|
defaultValueFormatter: () => defaultValueFormatter,
|
|
@@ -91,7 +96,6 @@ __export(src_exports, {
|
|
|
91
96
|
fallbackDateTimePattern: () => fallbackDateTimePattern,
|
|
92
97
|
filterAsQuery: () => filterAsQuery,
|
|
93
98
|
filterChanged: () => filterChanged,
|
|
94
|
-
filterValue: () => filterValue,
|
|
95
99
|
findColumn: () => findColumn,
|
|
96
100
|
flattenColumnGroup: () => flattenColumnGroup,
|
|
97
101
|
focusFirstFocusableElement: () => focusFirstFocusableElement,
|
|
@@ -116,6 +120,7 @@ __export(src_exports, {
|
|
|
116
120
|
getColumnsInViewport: () => getColumnsInViewport,
|
|
117
121
|
getConfigurationEditor: () => getConfigurationEditor,
|
|
118
122
|
getCookieValue: () => getCookieValue,
|
|
123
|
+
getDateFormatter: () => getDateFormatter,
|
|
119
124
|
getDefaultAlignment: () => getDefaultAlignment,
|
|
120
125
|
getDefaultColumnType: () => getDefaultColumnType,
|
|
121
126
|
getEditRuleValidator: () => getEditRuleValidator,
|
|
@@ -166,9 +171,9 @@ __export(src_exports, {
|
|
|
166
171
|
isJsonAttribute: () => isJsonAttribute,
|
|
167
172
|
isJsonColumn: () => isJsonColumn,
|
|
168
173
|
isJsonGroup: () => isJsonGroup,
|
|
169
|
-
isKeyedColumn: () => isKeyedColumn,
|
|
170
174
|
isLookupRenderer: () => isLookupRenderer,
|
|
171
175
|
isMappedValueTypeRenderer: () => isMappedValueTypeRenderer,
|
|
176
|
+
isModule: () => isModule,
|
|
172
177
|
isMultiClauseFilter: () => isMultiClauseFilter,
|
|
173
178
|
isMultiValueFilter: () => isMultiValueFilter,
|
|
174
179
|
isNamedFilter: () => isNamedFilter,
|
|
@@ -206,6 +211,7 @@ __export(src_exports, {
|
|
|
206
211
|
lastWord: () => lastWord,
|
|
207
212
|
logger: () => logger,
|
|
208
213
|
mapSortCriteria: () => mapSortCriteria,
|
|
214
|
+
measurePinnedColumns: () => measurePinnedColumns,
|
|
209
215
|
messageHasResult: () => messageHasResult,
|
|
210
216
|
metadataKeys: () => metadataKeys,
|
|
211
217
|
moveColumnTo: () => moveColumnTo,
|
|
@@ -214,8 +220,8 @@ __export(src_exports, {
|
|
|
214
220
|
numericFormatter: () => numericFormatter,
|
|
215
221
|
partition: () => partition,
|
|
216
222
|
projectUpdates: () => projectUpdates,
|
|
217
|
-
quotedStrings: () => quotedStrings,
|
|
218
223
|
rangeNewItems: () => rangeNewItems,
|
|
224
|
+
rangesAreSame: () => rangesAreSame,
|
|
219
225
|
registerComponent: () => registerComponent,
|
|
220
226
|
registerConfigurationEditor: () => registerConfigurationEditor,
|
|
221
227
|
removeColumnFromFilter: () => removeColumnFromFilter,
|
|
@@ -234,6 +240,7 @@ __export(src_exports, {
|
|
|
234
240
|
subscribedOnly: () => subscribedOnly,
|
|
235
241
|
supportedDateTimePatterns: () => supportedDateTimePatterns,
|
|
236
242
|
throttle: () => throttle,
|
|
243
|
+
toCalendarDate: () => toCalendarDate,
|
|
237
244
|
toColumnDescriptor: () => toColumnDescriptor,
|
|
238
245
|
toDataSourceColumns: () => toDataSourceColumns,
|
|
239
246
|
updateColumn: () => updateColumn,
|
|
@@ -338,7 +345,64 @@ function boxContainsPoint(rect, x, y) {
|
|
|
338
345
|
}
|
|
339
346
|
}
|
|
340
347
|
|
|
341
|
-
// src/
|
|
348
|
+
// src/filters/filterAsQuery.ts
|
|
349
|
+
var filterValue = (value) => typeof value === "string" ? `"${value}"` : value;
|
|
350
|
+
var quotedStrings = (value) => typeof value === "string" ? `"${value}"` : value;
|
|
351
|
+
var removeOuterMostParentheses = (s) => s.replace(/^\((.*)\)$/, "$1");
|
|
352
|
+
var filterAsQuery = (f, opts) => {
|
|
353
|
+
return removeOuterMostParentheses(filterAsQueryCore(f, opts));
|
|
354
|
+
};
|
|
355
|
+
var filterAsQueryCore = (f, opts) => {
|
|
356
|
+
if (isMultiClauseFilter(f)) {
|
|
357
|
+
const multiClauseFilter = f.filters.map((filter) => filterAsQueryCore(filter, opts)).join(` ${f.op} `);
|
|
358
|
+
return `(${multiClauseFilter})`;
|
|
359
|
+
} else if (isMultiValueFilter(f)) {
|
|
360
|
+
return `${f.column} ${f.op} [${f.values.map(quotedStrings).join(",")}]`;
|
|
361
|
+
} else {
|
|
362
|
+
return singleValueFilterAsQuery(f, opts);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
function singleValueFilterAsQuery(f, opts) {
|
|
366
|
+
var _a;
|
|
367
|
+
const column = (_a = opts == null ? void 0 : opts.columnsByName) == null ? void 0 : _a[f.column];
|
|
368
|
+
if (column && isDateTimeColumn(column)) {
|
|
369
|
+
return dateFilterAsQuery(f);
|
|
370
|
+
} else {
|
|
371
|
+
return defaultSingleValueFilterAsQuery(f);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
var ONE_DAY_IN_MILIS = 1e3 * 60 * 60 * 24;
|
|
375
|
+
function dateFilterAsQuery(f) {
|
|
376
|
+
switch (f.op) {
|
|
377
|
+
case "=": {
|
|
378
|
+
const filters = [
|
|
379
|
+
{ op: ">=", column: f.column, value: f.value },
|
|
380
|
+
{
|
|
381
|
+
op: "<",
|
|
382
|
+
column: f.column,
|
|
383
|
+
value: f.value + ONE_DAY_IN_MILIS
|
|
384
|
+
}
|
|
385
|
+
];
|
|
386
|
+
return filterAsQueryCore({ op: "and", filters });
|
|
387
|
+
}
|
|
388
|
+
case "!=": {
|
|
389
|
+
const filters = [
|
|
390
|
+
{ op: "<", column: f.column, value: f.value },
|
|
391
|
+
{
|
|
392
|
+
op: ">=",
|
|
393
|
+
column: f.column,
|
|
394
|
+
value: f.value + ONE_DAY_IN_MILIS
|
|
395
|
+
}
|
|
396
|
+
];
|
|
397
|
+
return filterAsQueryCore({ op: "or", filters });
|
|
398
|
+
}
|
|
399
|
+
default:
|
|
400
|
+
return defaultSingleValueFilterAsQuery(f);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
var defaultSingleValueFilterAsQuery = (f) => `${f.column} ${f.op} ${filterValue(f.value)}`;
|
|
404
|
+
|
|
405
|
+
// src/filters/utils.ts
|
|
342
406
|
var singleValueFilterOps = /* @__PURE__ */ new Set([
|
|
343
407
|
"=",
|
|
344
408
|
"!=",
|
|
@@ -361,17 +425,6 @@ var isCompleteFilter = (filter) => isSingleValueFilter(filter) && filter.column
|
|
|
361
425
|
function isMultiClauseFilter(f) {
|
|
362
426
|
return f !== void 0 && (f.op === "and" || f.op === "or");
|
|
363
427
|
}
|
|
364
|
-
var filterValue = (value) => typeof value === "string" ? `"${value}"` : value;
|
|
365
|
-
var quotedStrings = (value) => typeof value === "string" ? `"${value}"` : value;
|
|
366
|
-
var filterAsQuery = (f) => {
|
|
367
|
-
if (isMultiClauseFilter(f)) {
|
|
368
|
-
return f.filters.map((filter) => filterAsQuery(filter)).join(` ${f.op} `);
|
|
369
|
-
} else if (isMultiValueFilter(f)) {
|
|
370
|
-
return `${f.column} ${f.op} [${f.values.map(quotedStrings).join(",")}]`;
|
|
371
|
-
} else {
|
|
372
|
-
return `${f.column} ${f.op} ${filterValue(f.value)}`;
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
428
|
var removeColumnFromFilter = (column, filter) => {
|
|
376
429
|
if (isMultiClauseFilter(filter)) {
|
|
377
430
|
const [clause1, clause2] = filter.filters;
|
|
@@ -388,6 +441,9 @@ var removeColumnFromFilter = (column, filter) => {
|
|
|
388
441
|
// src/column-utils.ts
|
|
389
442
|
var SORT_ASC = "asc";
|
|
390
443
|
var NO_HEADINGS = [];
|
|
444
|
+
var DEFAULT_COL_WIDTH = 100;
|
|
445
|
+
var DEFAULT_MAX_WIDTH = 250;
|
|
446
|
+
var DEFAULT_MIN_WIDTH = 50;
|
|
391
447
|
var AggregationType = {
|
|
392
448
|
Average: 2,
|
|
393
449
|
Count: 3,
|
|
@@ -412,9 +468,6 @@ var numericTypes = ["int", "long", "double"];
|
|
|
412
468
|
var getDefaultAlignment = (serverDataType) => serverDataType === void 0 ? "left" : numericTypes.includes(serverDataType) ? "right" : "left";
|
|
413
469
|
var isValidColumnAlignment = (v) => v === "left" || v === "right";
|
|
414
470
|
var isValidPinLocation = (v) => isValidColumnAlignment(v) || v === "floating" || v === "";
|
|
415
|
-
var isKeyedColumn = (column) => {
|
|
416
|
-
return typeof column.key === "number";
|
|
417
|
-
};
|
|
418
471
|
var fromServerDataType = (serverDataType) => {
|
|
419
472
|
switch (serverDataType) {
|
|
420
473
|
case "double":
|
|
@@ -460,8 +513,6 @@ function buildColumnMap(columns) {
|
|
|
460
513
|
return columns.reduce((map, column, i) => {
|
|
461
514
|
if (typeof column === "string") {
|
|
462
515
|
map[column] = start + i;
|
|
463
|
-
} else if (isKeyedColumn(column)) {
|
|
464
|
-
map[column.name] = column.key;
|
|
465
516
|
} else {
|
|
466
517
|
map[column.name] = start + i;
|
|
467
518
|
}
|
|
@@ -559,7 +610,6 @@ function extractGroupColumn(columns, groupBy, confirmed = true) {
|
|
|
559
610
|
};
|
|
560
611
|
});
|
|
561
612
|
const groupCol = {
|
|
562
|
-
key: -1,
|
|
563
613
|
name: "group-col",
|
|
564
614
|
heading: ["group-col"],
|
|
565
615
|
isGroup: true,
|
|
@@ -573,9 +623,9 @@ function extractGroupColumn(columns, groupBy, confirmed = true) {
|
|
|
573
623
|
}
|
|
574
624
|
var isGroupColumn = (column) => column.isGroup === true;
|
|
575
625
|
var isJsonAttribute = (value) => typeof value === "string" && value.endsWith("+");
|
|
576
|
-
var isJsonGroup = (column, row) => {
|
|
626
|
+
var isJsonGroup = (column, row, columnMap) => {
|
|
577
627
|
var _a;
|
|
578
|
-
return ((_a = column.type) == null ? void 0 : _a.name) === "json" && isJsonAttribute(row[column.
|
|
628
|
+
return ((_a = column.type) == null ? void 0 : _a.name) === "json" && isJsonAttribute(row[columnMap[column.name]]);
|
|
579
629
|
};
|
|
580
630
|
var isJsonColumn = (column) => {
|
|
581
631
|
var _a;
|
|
@@ -628,6 +678,27 @@ var sortPinnedColumns = (columns) => {
|
|
|
628
678
|
return allColumns;
|
|
629
679
|
}
|
|
630
680
|
};
|
|
681
|
+
var measurePinnedColumns = (columns, selectionEndSize) => {
|
|
682
|
+
let pinnedWidthLeft = 0;
|
|
683
|
+
let pinnedWidthRight = 0;
|
|
684
|
+
let unpinnedWidth = 0;
|
|
685
|
+
for (const column of columns) {
|
|
686
|
+
const { hidden, pin, width } = column;
|
|
687
|
+
const visibleWidth = hidden ? 0 : width;
|
|
688
|
+
if (pin === "left") {
|
|
689
|
+
pinnedWidthLeft += visibleWidth;
|
|
690
|
+
} else if (pin === "right") {
|
|
691
|
+
pinnedWidthRight += visibleWidth;
|
|
692
|
+
} else {
|
|
693
|
+
unpinnedWidth += visibleWidth;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
return {
|
|
697
|
+
pinnedWidthLeft: pinnedWidthLeft + selectionEndSize,
|
|
698
|
+
pinnedWidthRight: pinnedWidthRight + selectionEndSize,
|
|
699
|
+
unpinnedWidth
|
|
700
|
+
};
|
|
701
|
+
};
|
|
631
702
|
var getTableHeadings = (columns) => {
|
|
632
703
|
if (columns.some(hasHeadings)) {
|
|
633
704
|
const maxHeadingDepth = columns.reduce(
|
|
@@ -660,6 +731,8 @@ var getTableHeadings = (columns) => {
|
|
|
660
731
|
};
|
|
661
732
|
var getColumnStyle = ({
|
|
662
733
|
pin,
|
|
734
|
+
// the 4 is `selectionEndSize`, unfortunate if we need to be passed it from cell
|
|
735
|
+
// need to think about how to make this available
|
|
663
736
|
pinnedOffset = pin === "left" ? 0 : 4,
|
|
664
737
|
width
|
|
665
738
|
}) => pin === "left" ? {
|
|
@@ -819,25 +892,29 @@ var getColumnsInViewport = (columns, vpStart, vpEnd) => {
|
|
|
819
892
|
var _a;
|
|
820
893
|
const visibleColumns = [];
|
|
821
894
|
let preSpan = 0;
|
|
822
|
-
|
|
895
|
+
let rightPinnedOnly = false;
|
|
896
|
+
for (let columnOffset = 0, i = 0; i < columns.length; i++) {
|
|
823
897
|
const column = columns[i];
|
|
824
898
|
if (column.hidden) {
|
|
825
899
|
continue;
|
|
826
|
-
} else if (
|
|
900
|
+
} else if (rightPinnedOnly) {
|
|
901
|
+
if (column.pin === "right") {
|
|
902
|
+
visibleColumns.push(column);
|
|
903
|
+
}
|
|
904
|
+
} else if (columnOffset + column.width < vpStart) {
|
|
827
905
|
if (column.pin === "left") {
|
|
828
906
|
visibleColumns.push(column);
|
|
829
|
-
} else if (
|
|
907
|
+
} else if (columnOffset + column.width + ((_a = columns[i + 1]) == null ? void 0 : _a.width) > vpStart) {
|
|
830
908
|
visibleColumns.push(column);
|
|
831
909
|
} else {
|
|
832
910
|
preSpan += column.width;
|
|
833
911
|
}
|
|
834
|
-
} else if (
|
|
835
|
-
|
|
836
|
-
break;
|
|
912
|
+
} else if (columnOffset > vpEnd) {
|
|
913
|
+
rightPinnedOnly = true;
|
|
837
914
|
} else {
|
|
838
915
|
visibleColumns.push(column);
|
|
839
916
|
}
|
|
840
|
-
|
|
917
|
+
columnOffset += column.width;
|
|
841
918
|
}
|
|
842
919
|
return [visibleColumns, preSpan];
|
|
843
920
|
};
|
|
@@ -850,15 +927,15 @@ var visibleColumnAtIndex = (columns, index) => {
|
|
|
850
927
|
}
|
|
851
928
|
};
|
|
852
929
|
var { DEPTH, IS_LEAF } = metadataKeys;
|
|
853
|
-
var getGroupValueAndOffset = (columns, row) => {
|
|
930
|
+
var getGroupValueAndOffset = (columns, row, columnMap) => {
|
|
854
931
|
const { [DEPTH]: depth, [IS_LEAF]: isLeaf } = row;
|
|
855
932
|
if (isLeaf || depth > columns.length) {
|
|
856
933
|
return [null, depth === null ? 0 : Math.max(0, depth - 1)];
|
|
857
934
|
} else if (depth === 0) {
|
|
858
935
|
return ["$root", 0];
|
|
859
936
|
} else {
|
|
860
|
-
const {
|
|
861
|
-
const value = valueFormatter(row[
|
|
937
|
+
const { name, valueFormatter } = columns[depth - 1];
|
|
938
|
+
const value = valueFormatter(row[columnMap[name]]);
|
|
862
939
|
return [value, depth - 1];
|
|
863
940
|
}
|
|
864
941
|
};
|
|
@@ -1021,6 +1098,130 @@ var getColumnByName = (schema, name) => {
|
|
|
1021
1098
|
}
|
|
1022
1099
|
}
|
|
1023
1100
|
};
|
|
1101
|
+
function applyWidthToColumns(columns, options) {
|
|
1102
|
+
const {
|
|
1103
|
+
availableWidth = 0,
|
|
1104
|
+
columnLayout = "Static",
|
|
1105
|
+
defaultWidth = DEFAULT_COL_WIDTH,
|
|
1106
|
+
defaultMinWidth = DEFAULT_MIN_WIDTH,
|
|
1107
|
+
defaultMaxWidth = DEFAULT_MAX_WIDTH
|
|
1108
|
+
// defaultFlex = DEFAULT_FLEX,
|
|
1109
|
+
} = options;
|
|
1110
|
+
if (columnLayout === "Static") {
|
|
1111
|
+
return columns.map((column) => {
|
|
1112
|
+
if (typeof column.width === "number") {
|
|
1113
|
+
return column;
|
|
1114
|
+
} else {
|
|
1115
|
+
return {
|
|
1116
|
+
...column,
|
|
1117
|
+
width: defaultWidth
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
} else if (columnLayout === "Fit") {
|
|
1122
|
+
const { totalMinWidth, totalMaxWidth, totalWidth, flexCount } = columns.reduce(
|
|
1123
|
+
(aggregated, column) => {
|
|
1124
|
+
const { totalMinWidth: totalMinWidth2, totalMaxWidth: totalMaxWidth2, totalWidth: totalWidth2, flexCount: flexCount2 } = aggregated;
|
|
1125
|
+
const {
|
|
1126
|
+
minWidth = defaultMinWidth,
|
|
1127
|
+
maxWidth = defaultMaxWidth,
|
|
1128
|
+
width = defaultWidth,
|
|
1129
|
+
flex = 0
|
|
1130
|
+
} = column;
|
|
1131
|
+
return {
|
|
1132
|
+
totalMinWidth: totalMinWidth2 + minWidth,
|
|
1133
|
+
totalMaxWidth: totalMaxWidth2 + maxWidth,
|
|
1134
|
+
totalWidth: totalWidth2 + width,
|
|
1135
|
+
flexCount: flexCount2 + flex
|
|
1136
|
+
};
|
|
1137
|
+
},
|
|
1138
|
+
{ totalMinWidth: 0, totalMaxWidth: 0, totalWidth: 0, flexCount: 0 }
|
|
1139
|
+
);
|
|
1140
|
+
if (totalMinWidth > availableWidth || totalMaxWidth < availableWidth) {
|
|
1141
|
+
return columns;
|
|
1142
|
+
} else if (totalWidth > availableWidth) {
|
|
1143
|
+
const excessWidth = totalWidth - availableWidth;
|
|
1144
|
+
const inFlexMode = flexCount > 0;
|
|
1145
|
+
let excessWidthPerColumn = excessWidth / (flexCount || columns.length);
|
|
1146
|
+
let columnsNotYetAtMinWidth = columns.length;
|
|
1147
|
+
let unassignedExcess = 0;
|
|
1148
|
+
let newColumns = columns.map((column) => {
|
|
1149
|
+
const {
|
|
1150
|
+
minWidth = defaultMinWidth,
|
|
1151
|
+
width = defaultWidth,
|
|
1152
|
+
flex = 0
|
|
1153
|
+
} = column;
|
|
1154
|
+
if (inFlexMode && flex === 0) {
|
|
1155
|
+
return column;
|
|
1156
|
+
}
|
|
1157
|
+
const adjustedWidth = width - excessWidthPerColumn;
|
|
1158
|
+
if (adjustedWidth < minWidth) {
|
|
1159
|
+
columnsNotYetAtMinWidth -= 1;
|
|
1160
|
+
unassignedExcess += minWidth - adjustedWidth;
|
|
1161
|
+
return { ...column, width: minWidth };
|
|
1162
|
+
} else {
|
|
1163
|
+
return { ...column, width: adjustedWidth };
|
|
1164
|
+
}
|
|
1165
|
+
});
|
|
1166
|
+
if (unassignedExcess === 0) {
|
|
1167
|
+
return newColumns;
|
|
1168
|
+
} else {
|
|
1169
|
+
excessWidthPerColumn = unassignedExcess / columnsNotYetAtMinWidth;
|
|
1170
|
+
newColumns = newColumns.map((column) => {
|
|
1171
|
+
const adjustedWidth = column.width - excessWidthPerColumn;
|
|
1172
|
+
if (column.width !== column.minWidth) {
|
|
1173
|
+
return { ...column, width: adjustedWidth };
|
|
1174
|
+
} else {
|
|
1175
|
+
return column;
|
|
1176
|
+
}
|
|
1177
|
+
});
|
|
1178
|
+
return newColumns;
|
|
1179
|
+
}
|
|
1180
|
+
} else if (totalWidth < availableWidth) {
|
|
1181
|
+
{
|
|
1182
|
+
const additionalWidth = availableWidth - totalWidth;
|
|
1183
|
+
const inFlexMode = flexCount > 0;
|
|
1184
|
+
let additionalWidthPerColumn = additionalWidth / (flexCount || columns.length);
|
|
1185
|
+
let newColumns = columns.map((column) => {
|
|
1186
|
+
const {
|
|
1187
|
+
maxWidth = defaultMaxWidth,
|
|
1188
|
+
width = defaultWidth,
|
|
1189
|
+
flex = 0
|
|
1190
|
+
} = column;
|
|
1191
|
+
if (inFlexMode && flex === 0) {
|
|
1192
|
+
return column;
|
|
1193
|
+
}
|
|
1194
|
+
const adjustedWidth = width + additionalWidthPerColumn;
|
|
1195
|
+
if (adjustedWidth > maxWidth) {
|
|
1196
|
+
return { ...column, width: maxWidth };
|
|
1197
|
+
} else {
|
|
1198
|
+
return { ...column, width: adjustedWidth, canStretch: true };
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1201
|
+
const unassignedAdditionalColumnWidth = additionalWidth - newColumns.reduce((sum, col) => sum + col.width, 0);
|
|
1202
|
+
const columnsNotYetAtMaxWidth = newColumns.filter(
|
|
1203
|
+
(col) => col.canStretch
|
|
1204
|
+
).length;
|
|
1205
|
+
if (unassignedAdditionalColumnWidth > columnsNotYetAtMaxWidth) {
|
|
1206
|
+
additionalWidthPerColumn = unassignedAdditionalColumnWidth / columnsNotYetAtMaxWidth;
|
|
1207
|
+
newColumns = newColumns.map((column) => {
|
|
1208
|
+
if (column.canStretch) {
|
|
1209
|
+
const adjustedWidth = Math.min(
|
|
1210
|
+
column.width + additionalWidthPerColumn
|
|
1211
|
+
);
|
|
1212
|
+
return { ...column, width: adjustedWidth };
|
|
1213
|
+
} else {
|
|
1214
|
+
return column;
|
|
1215
|
+
}
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
return newColumns.map(({ canStretch, ...column }) => column);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
return columns;
|
|
1223
|
+
}
|
|
1224
|
+
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]]);
|
|
1024
1225
|
|
|
1025
1226
|
// src/cookie-utils.ts
|
|
1026
1227
|
var getCookieValue = (name) => {
|
|
@@ -1122,31 +1323,34 @@ function getEditRuleValidator(name) {
|
|
|
1122
1323
|
|
|
1123
1324
|
// src/range-utils.ts
|
|
1124
1325
|
var NULL_RANGE = { from: 0, to: 0 };
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1326
|
+
var rangesAreSame = (r1, r2) => {
|
|
1327
|
+
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);
|
|
1328
|
+
};
|
|
1329
|
+
function getFullRange({ from, to }, bufferSize = 0, totalRowCount = Number.MAX_SAFE_INTEGER) {
|
|
1330
|
+
if (from === 0 && to === 0) {
|
|
1331
|
+
return { from, to };
|
|
1332
|
+
} else if (bufferSize === 0) {
|
|
1333
|
+
if (totalRowCount < from) {
|
|
1128
1334
|
return { from: 0, to: 0 };
|
|
1129
1335
|
} else {
|
|
1130
|
-
return { from, to: Math.min(to,
|
|
1336
|
+
return { from, to: Math.min(to, totalRowCount) };
|
|
1131
1337
|
}
|
|
1132
1338
|
} else if (from === 0) {
|
|
1133
|
-
return { from, to: Math.min(to + bufferSize,
|
|
1339
|
+
return { from, to: Math.min(to + bufferSize, totalRowCount) };
|
|
1134
1340
|
} else {
|
|
1135
|
-
const
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
if (shortfallBefore && shortFallAfter) {
|
|
1140
|
-
return { from: 0, to: rowCount };
|
|
1341
|
+
const shortfallBefore = from - bufferSize < 0;
|
|
1342
|
+
const shortfallAfter = totalRowCount - (to + bufferSize) < 0;
|
|
1343
|
+
if (shortfallBefore && shortfallAfter) {
|
|
1344
|
+
return { from: 0, to: totalRowCount };
|
|
1141
1345
|
} else if (shortfallBefore) {
|
|
1142
|
-
return { from: 0, to:
|
|
1143
|
-
} else if (
|
|
1346
|
+
return { from: 0, to: to + bufferSize };
|
|
1347
|
+
} else if (shortfallAfter) {
|
|
1144
1348
|
return {
|
|
1145
|
-
from: Math.max(0,
|
|
1146
|
-
to:
|
|
1349
|
+
from: Math.max(0, from - bufferSize),
|
|
1350
|
+
to: totalRowCount
|
|
1147
1351
|
};
|
|
1148
1352
|
} else {
|
|
1149
|
-
return { from: from -
|
|
1353
|
+
return { from: from - bufferSize, to: to + bufferSize };
|
|
1150
1354
|
}
|
|
1151
1355
|
}
|
|
1152
1356
|
}
|
|
@@ -1241,7 +1445,7 @@ var DataWindow = class {
|
|
|
1241
1445
|
}
|
|
1242
1446
|
getData(from, to) {
|
|
1243
1447
|
var _a;
|
|
1244
|
-
const { from: clientFrom
|
|
1448
|
+
const { from: clientFrom } = this.range;
|
|
1245
1449
|
const startOffset = Math.max(0, from - clientFrom);
|
|
1246
1450
|
const endOffset = Math.min(to - clientFrom, (_a = this.rowCount) != null ? _a : to);
|
|
1247
1451
|
return this.data.slice(startOffset, endOffset);
|
|
@@ -1449,6 +1653,812 @@ var withConfigDefaults = (config) => {
|
|
|
1449
1653
|
}
|
|
1450
1654
|
};
|
|
1451
1655
|
|
|
1656
|
+
// ../../node_modules/@internationalized/date/node_modules/@swc/helpers/esm/_check_private_redeclaration.js
|
|
1657
|
+
function _check_private_redeclaration(obj, privateCollection) {
|
|
1658
|
+
if (privateCollection.has(obj)) {
|
|
1659
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
// ../../node_modules/@internationalized/date/node_modules/@swc/helpers/esm/_class_private_field_init.js
|
|
1664
|
+
function _class_private_field_init(obj, privateMap, value) {
|
|
1665
|
+
_check_private_redeclaration(obj, privateMap);
|
|
1666
|
+
privateMap.set(obj, value);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
// ../../node_modules/@internationalized/date/dist/import.mjs
|
|
1670
|
+
function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
|
|
1671
|
+
return amount - numerator * Math.floor(amount / numerator);
|
|
1672
|
+
}
|
|
1673
|
+
var $3b62074eb05584b2$var$EPOCH = 1721426;
|
|
1674
|
+
function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
|
|
1675
|
+
year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
|
|
1676
|
+
let y1 = year - 1;
|
|
1677
|
+
let monthOffset = -2;
|
|
1678
|
+
if (month <= 2)
|
|
1679
|
+
monthOffset = 0;
|
|
1680
|
+
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year))
|
|
1681
|
+
monthOffset = -1;
|
|
1682
|
+
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);
|
|
1683
|
+
}
|
|
1684
|
+
function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
|
|
1685
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
1686
|
+
}
|
|
1687
|
+
function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
|
|
1688
|
+
return era === "BC" ? 1 - year : year;
|
|
1689
|
+
}
|
|
1690
|
+
function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
|
|
1691
|
+
let era = "AD";
|
|
1692
|
+
if (year <= 0) {
|
|
1693
|
+
era = "BC";
|
|
1694
|
+
year = 1 - year;
|
|
1695
|
+
}
|
|
1696
|
+
return [
|
|
1697
|
+
era,
|
|
1698
|
+
year
|
|
1699
|
+
];
|
|
1700
|
+
}
|
|
1701
|
+
var $3b62074eb05584b2$var$daysInMonth = {
|
|
1702
|
+
standard: [
|
|
1703
|
+
31,
|
|
1704
|
+
28,
|
|
1705
|
+
31,
|
|
1706
|
+
30,
|
|
1707
|
+
31,
|
|
1708
|
+
30,
|
|
1709
|
+
31,
|
|
1710
|
+
31,
|
|
1711
|
+
30,
|
|
1712
|
+
31,
|
|
1713
|
+
30,
|
|
1714
|
+
31
|
|
1715
|
+
],
|
|
1716
|
+
leapyear: [
|
|
1717
|
+
31,
|
|
1718
|
+
29,
|
|
1719
|
+
31,
|
|
1720
|
+
30,
|
|
1721
|
+
31,
|
|
1722
|
+
30,
|
|
1723
|
+
31,
|
|
1724
|
+
31,
|
|
1725
|
+
30,
|
|
1726
|
+
31,
|
|
1727
|
+
30,
|
|
1728
|
+
31
|
|
1729
|
+
]
|
|
1730
|
+
};
|
|
1731
|
+
var $3b62074eb05584b2$export$80ee6245ec4f29ec = class {
|
|
1732
|
+
fromJulianDay(jd) {
|
|
1733
|
+
let jd0 = jd;
|
|
1734
|
+
let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
|
|
1735
|
+
let quadricent = Math.floor(depoch / 146097);
|
|
1736
|
+
let dqc = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(depoch, 146097);
|
|
1737
|
+
let cent = Math.floor(dqc / 36524);
|
|
1738
|
+
let dcent = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dqc, 36524);
|
|
1739
|
+
let quad = Math.floor(dcent / 1461);
|
|
1740
|
+
let dquad = (0, $2b4dce13dd5a17fa$export$842a2cf37af977e1)(dcent, 1461);
|
|
1741
|
+
let yindex = Math.floor(dquad / 365);
|
|
1742
|
+
let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
|
|
1743
|
+
let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
|
|
1744
|
+
let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
|
|
1745
|
+
let leapAdj = 2;
|
|
1746
|
+
if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1))
|
|
1747
|
+
leapAdj = 0;
|
|
1748
|
+
else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year))
|
|
1749
|
+
leapAdj = 1;
|
|
1750
|
+
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
|
|
1751
|
+
let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
|
|
1752
|
+
return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(era, year, month, day);
|
|
1753
|
+
}
|
|
1754
|
+
toJulianDay(date) {
|
|
1755
|
+
return $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, date.month, date.day);
|
|
1756
|
+
}
|
|
1757
|
+
getDaysInMonth(date) {
|
|
1758
|
+
return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1];
|
|
1759
|
+
}
|
|
1760
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1761
|
+
getMonthsInYear(date) {
|
|
1762
|
+
return 12;
|
|
1763
|
+
}
|
|
1764
|
+
getDaysInYear(date) {
|
|
1765
|
+
return $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
|
|
1766
|
+
}
|
|
1767
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1768
|
+
getYearsInEra(date) {
|
|
1769
|
+
return 9999;
|
|
1770
|
+
}
|
|
1771
|
+
getEras() {
|
|
1772
|
+
return [
|
|
1773
|
+
"BC",
|
|
1774
|
+
"AD"
|
|
1775
|
+
];
|
|
1776
|
+
}
|
|
1777
|
+
isInverseEra(date) {
|
|
1778
|
+
return date.era === "BC";
|
|
1779
|
+
}
|
|
1780
|
+
balanceDate(date) {
|
|
1781
|
+
if (date.year <= 0) {
|
|
1782
|
+
date.era = date.era === "BC" ? "AD" : "BC";
|
|
1783
|
+
date.year = 1 - date.year;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
constructor() {
|
|
1787
|
+
this.identifier = "gregory";
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a, b) {
|
|
1791
|
+
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
|
|
1792
|
+
}
|
|
1793
|
+
function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
|
|
1794
|
+
return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
|
|
1795
|
+
}
|
|
1796
|
+
function $14e0f24ef4ac5c92$var$timeToMs(a) {
|
|
1797
|
+
return a.hour * 36e5 + a.minute * 6e4 + a.second * 1e3 + a.millisecond;
|
|
1798
|
+
}
|
|
1799
|
+
var $14e0f24ef4ac5c92$var$localTimeZone = null;
|
|
1800
|
+
function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
|
|
1801
|
+
if ($14e0f24ef4ac5c92$var$localTimeZone == null)
|
|
1802
|
+
$14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1803
|
+
return $14e0f24ef4ac5c92$var$localTimeZone;
|
|
1804
|
+
}
|
|
1805
|
+
function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date) {
|
|
1806
|
+
date = $11d87f3f76e88657$export$b4a036af3fc0b032(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
|
|
1807
|
+
let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(date.era, date.year);
|
|
1808
|
+
return $11d87f3f76e88657$var$epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
|
|
1809
|
+
}
|
|
1810
|
+
function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
|
|
1811
|
+
let date = /* @__PURE__ */ new Date();
|
|
1812
|
+
date.setUTCHours(hour, minute, second, millisecond);
|
|
1813
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
1814
|
+
return date.getTime();
|
|
1815
|
+
}
|
|
1816
|
+
function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) {
|
|
1817
|
+
if (timeZone === "UTC")
|
|
1818
|
+
return 0;
|
|
1819
|
+
if (ms > 0 && timeZone === (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)())
|
|
1820
|
+
return new Date(ms).getTimezoneOffset() * -6e4;
|
|
1821
|
+
let { year, month, day, hour, minute, second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone);
|
|
1822
|
+
let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0);
|
|
1823
|
+
return utc - Math.floor(ms / 1e3) * 1e3;
|
|
1824
|
+
}
|
|
1825
|
+
var $11d87f3f76e88657$var$formattersByTimeZone = /* @__PURE__ */ new Map();
|
|
1826
|
+
function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) {
|
|
1827
|
+
let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone);
|
|
1828
|
+
if (!formatter) {
|
|
1829
|
+
formatter = new Intl.DateTimeFormat("en-US", {
|
|
1830
|
+
timeZone,
|
|
1831
|
+
hour12: false,
|
|
1832
|
+
era: "short",
|
|
1833
|
+
year: "numeric",
|
|
1834
|
+
month: "numeric",
|
|
1835
|
+
day: "numeric",
|
|
1836
|
+
hour: "numeric",
|
|
1837
|
+
minute: "numeric",
|
|
1838
|
+
second: "numeric"
|
|
1839
|
+
});
|
|
1840
|
+
$11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter);
|
|
1841
|
+
}
|
|
1842
|
+
let parts = formatter.formatToParts(new Date(ms));
|
|
1843
|
+
let namedParts = {};
|
|
1844
|
+
for (let part of parts)
|
|
1845
|
+
if (part.type !== "literal")
|
|
1846
|
+
namedParts[part.type] = part.value;
|
|
1847
|
+
return {
|
|
1848
|
+
// Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
|
|
1849
|
+
year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year,
|
|
1850
|
+
month: +namedParts.month,
|
|
1851
|
+
day: +namedParts.day,
|
|
1852
|
+
hour: namedParts.hour === "24" ? 0 : +namedParts.hour,
|
|
1853
|
+
minute: +namedParts.minute,
|
|
1854
|
+
second: +namedParts.second
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
var $11d87f3f76e88657$var$DAYMILLIS = 864e5;
|
|
1858
|
+
function $11d87f3f76e88657$var$getValidWallTimes(date, timeZone, earlier, later) {
|
|
1859
|
+
let found = earlier === later ? [
|
|
1860
|
+
earlier
|
|
1861
|
+
] : [
|
|
1862
|
+
earlier,
|
|
1863
|
+
later
|
|
1864
|
+
];
|
|
1865
|
+
return found.filter((absolute) => $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute));
|
|
1866
|
+
}
|
|
1867
|
+
function $11d87f3f76e88657$var$isValidWallTime(date, timeZone, absolute) {
|
|
1868
|
+
let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute, timeZone);
|
|
1869
|
+
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;
|
|
1870
|
+
}
|
|
1871
|
+
function $11d87f3f76e88657$export$5107c82f94518f5c(date, timeZone, disambiguation = "compatible") {
|
|
1872
|
+
let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date);
|
|
1873
|
+
if (timeZone === "UTC")
|
|
1874
|
+
return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
|
|
1875
|
+
if (timeZone === (0, $14e0f24ef4ac5c92$export$aa8b41735afcabd2)() && disambiguation === "compatible") {
|
|
1876
|
+
dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
|
|
1877
|
+
let date2 = /* @__PURE__ */ new Date();
|
|
1878
|
+
let year = (0, $3b62074eb05584b2$export$c36e0ecb2d4fa69d)(dateTime.era, dateTime.year);
|
|
1879
|
+
date2.setFullYear(year, dateTime.month - 1, dateTime.day);
|
|
1880
|
+
date2.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
|
|
1881
|
+
return date2.getTime();
|
|
1882
|
+
}
|
|
1883
|
+
let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
|
|
1884
|
+
let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
|
|
1885
|
+
let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
|
|
1886
|
+
let valid = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
|
|
1887
|
+
if (valid.length === 1)
|
|
1888
|
+
return valid[0];
|
|
1889
|
+
if (valid.length > 1)
|
|
1890
|
+
switch (disambiguation) {
|
|
1891
|
+
case "compatible":
|
|
1892
|
+
case "earlier":
|
|
1893
|
+
return valid[0];
|
|
1894
|
+
case "later":
|
|
1895
|
+
return valid[valid.length - 1];
|
|
1896
|
+
case "reject":
|
|
1897
|
+
throw new RangeError("Multiple possible absolute times found");
|
|
1898
|
+
}
|
|
1899
|
+
switch (disambiguation) {
|
|
1900
|
+
case "earlier":
|
|
1901
|
+
return Math.min(ms - offsetBefore, ms - offsetAfter);
|
|
1902
|
+
case "compatible":
|
|
1903
|
+
case "later":
|
|
1904
|
+
return Math.max(ms - offsetBefore, ms - offsetAfter);
|
|
1905
|
+
case "reject":
|
|
1906
|
+
throw new RangeError("No such absolute time found");
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") {
|
|
1910
|
+
return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
|
|
1911
|
+
}
|
|
1912
|
+
function $11d87f3f76e88657$export$b21e0b124e224484(date, time) {
|
|
1913
|
+
let hour = 0, minute = 0, second = 0, millisecond = 0;
|
|
1914
|
+
if ("timeZone" in date)
|
|
1915
|
+
({ hour, minute, second, millisecond } = date);
|
|
1916
|
+
else if ("hour" in date && !time)
|
|
1917
|
+
return date;
|
|
1918
|
+
if (time)
|
|
1919
|
+
({ hour, minute, second, millisecond } = time);
|
|
1920
|
+
return new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
|
|
1921
|
+
}
|
|
1922
|
+
function $11d87f3f76e88657$export$b4a036af3fc0b032(date, calendar) {
|
|
1923
|
+
if (date.calendar.identifier === calendar.identifier)
|
|
1924
|
+
return date;
|
|
1925
|
+
let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
|
|
1926
|
+
let copy = date.copy();
|
|
1927
|
+
copy.calendar = calendar;
|
|
1928
|
+
copy.era = calendarDate.era;
|
|
1929
|
+
copy.year = calendarDate.year;
|
|
1930
|
+
copy.month = calendarDate.month;
|
|
1931
|
+
copy.day = calendarDate.day;
|
|
1932
|
+
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(copy);
|
|
1933
|
+
return copy;
|
|
1934
|
+
}
|
|
1935
|
+
function $735220c2d4774dd3$export$e16d8520af44a096(date, duration) {
|
|
1936
|
+
let mutableDate = date.copy();
|
|
1937
|
+
let days = "hour" in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration) : 0;
|
|
1938
|
+
$735220c2d4774dd3$var$addYears(mutableDate, duration.years || 0);
|
|
1939
|
+
if (mutableDate.calendar.balanceYearMonth)
|
|
1940
|
+
mutableDate.calendar.balanceYearMonth(mutableDate, date);
|
|
1941
|
+
mutableDate.month += duration.months || 0;
|
|
1942
|
+
$735220c2d4774dd3$var$balanceYearMonth(mutableDate);
|
|
1943
|
+
$735220c2d4774dd3$var$constrainMonthDay(mutableDate);
|
|
1944
|
+
mutableDate.day += (duration.weeks || 0) * 7;
|
|
1945
|
+
mutableDate.day += duration.days || 0;
|
|
1946
|
+
mutableDate.day += days;
|
|
1947
|
+
$735220c2d4774dd3$var$balanceDay(mutableDate);
|
|
1948
|
+
if (mutableDate.calendar.balanceDate)
|
|
1949
|
+
mutableDate.calendar.balanceDate(mutableDate);
|
|
1950
|
+
if (mutableDate.year < 1) {
|
|
1951
|
+
mutableDate.year = 1;
|
|
1952
|
+
mutableDate.month = 1;
|
|
1953
|
+
mutableDate.day = 1;
|
|
1954
|
+
}
|
|
1955
|
+
let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
|
|
1956
|
+
if (mutableDate.year > maxYear) {
|
|
1957
|
+
var _mutableDate_calendar, _mutableDate_calendar_isInverseEra;
|
|
1958
|
+
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);
|
|
1959
|
+
mutableDate.year = maxYear;
|
|
1960
|
+
mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
|
|
1961
|
+
mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
|
|
1962
|
+
}
|
|
1963
|
+
if (mutableDate.month < 1) {
|
|
1964
|
+
mutableDate.month = 1;
|
|
1965
|
+
mutableDate.day = 1;
|
|
1966
|
+
}
|
|
1967
|
+
let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
|
|
1968
|
+
if (mutableDate.month > maxMonth) {
|
|
1969
|
+
mutableDate.month = maxMonth;
|
|
1970
|
+
mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
|
|
1971
|
+
}
|
|
1972
|
+
mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
|
|
1973
|
+
return mutableDate;
|
|
1974
|
+
}
|
|
1975
|
+
function $735220c2d4774dd3$var$addYears(date, years) {
|
|
1976
|
+
var _date_calendar, _date_calendar_isInverseEra;
|
|
1977
|
+
if ((_date_calendar_isInverseEra = (_date_calendar = date.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date))
|
|
1978
|
+
years = -years;
|
|
1979
|
+
date.year += years;
|
|
1980
|
+
}
|
|
1981
|
+
function $735220c2d4774dd3$var$balanceYearMonth(date) {
|
|
1982
|
+
while (date.month < 1) {
|
|
1983
|
+
$735220c2d4774dd3$var$addYears(date, -1);
|
|
1984
|
+
date.month += date.calendar.getMonthsInYear(date);
|
|
1985
|
+
}
|
|
1986
|
+
let monthsInYear = 0;
|
|
1987
|
+
while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {
|
|
1988
|
+
date.month -= monthsInYear;
|
|
1989
|
+
$735220c2d4774dd3$var$addYears(date, 1);
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
function $735220c2d4774dd3$var$balanceDay(date) {
|
|
1993
|
+
while (date.day < 1) {
|
|
1994
|
+
date.month--;
|
|
1995
|
+
$735220c2d4774dd3$var$balanceYearMonth(date);
|
|
1996
|
+
date.day += date.calendar.getDaysInMonth(date);
|
|
1997
|
+
}
|
|
1998
|
+
while (date.day > date.calendar.getDaysInMonth(date)) {
|
|
1999
|
+
date.day -= date.calendar.getDaysInMonth(date);
|
|
2000
|
+
date.month++;
|
|
2001
|
+
$735220c2d4774dd3$var$balanceYearMonth(date);
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
function $735220c2d4774dd3$var$constrainMonthDay(date) {
|
|
2005
|
+
date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
|
|
2006
|
+
date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
|
|
2007
|
+
}
|
|
2008
|
+
function $735220c2d4774dd3$export$c4e2ecac49351ef2(date) {
|
|
2009
|
+
if (date.calendar.constrainDate)
|
|
2010
|
+
date.calendar.constrainDate(date);
|
|
2011
|
+
date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
|
|
2012
|
+
$735220c2d4774dd3$var$constrainMonthDay(date);
|
|
2013
|
+
}
|
|
2014
|
+
function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
|
|
2015
|
+
let inverseDuration = {};
|
|
2016
|
+
for (let key in duration)
|
|
2017
|
+
if (typeof duration[key] === "number")
|
|
2018
|
+
inverseDuration[key] = -duration[key];
|
|
2019
|
+
return inverseDuration;
|
|
2020
|
+
}
|
|
2021
|
+
function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date, duration) {
|
|
2022
|
+
return $735220c2d4774dd3$export$e16d8520af44a096(date, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
|
|
2023
|
+
}
|
|
2024
|
+
function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date, fields) {
|
|
2025
|
+
let mutableDate = date.copy();
|
|
2026
|
+
if (fields.era != null)
|
|
2027
|
+
mutableDate.era = fields.era;
|
|
2028
|
+
if (fields.year != null)
|
|
2029
|
+
mutableDate.year = fields.year;
|
|
2030
|
+
if (fields.month != null)
|
|
2031
|
+
mutableDate.month = fields.month;
|
|
2032
|
+
if (fields.day != null)
|
|
2033
|
+
mutableDate.day = fields.day;
|
|
2034
|
+
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
|
|
2035
|
+
return mutableDate;
|
|
2036
|
+
}
|
|
2037
|
+
function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
|
|
2038
|
+
let mutableValue = value.copy();
|
|
2039
|
+
if (fields.hour != null)
|
|
2040
|
+
mutableValue.hour = fields.hour;
|
|
2041
|
+
if (fields.minute != null)
|
|
2042
|
+
mutableValue.minute = fields.minute;
|
|
2043
|
+
if (fields.second != null)
|
|
2044
|
+
mutableValue.second = fields.second;
|
|
2045
|
+
if (fields.millisecond != null)
|
|
2046
|
+
mutableValue.millisecond = fields.millisecond;
|
|
2047
|
+
$735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
|
|
2048
|
+
return mutableValue;
|
|
2049
|
+
}
|
|
2050
|
+
function $735220c2d4774dd3$var$balanceTime(time) {
|
|
2051
|
+
time.second += Math.floor(time.millisecond / 1e3);
|
|
2052
|
+
time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1e3);
|
|
2053
|
+
time.minute += Math.floor(time.second / 60);
|
|
2054
|
+
time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
|
|
2055
|
+
time.hour += Math.floor(time.minute / 60);
|
|
2056
|
+
time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
|
|
2057
|
+
let days = Math.floor(time.hour / 24);
|
|
2058
|
+
time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
|
|
2059
|
+
return days;
|
|
2060
|
+
}
|
|
2061
|
+
function $735220c2d4774dd3$export$7555de1e070510cb(time) {
|
|
2062
|
+
time.millisecond = Math.max(0, Math.min(time.millisecond, 1e3));
|
|
2063
|
+
time.second = Math.max(0, Math.min(time.second, 59));
|
|
2064
|
+
time.minute = Math.max(0, Math.min(time.minute, 59));
|
|
2065
|
+
time.hour = Math.max(0, Math.min(time.hour, 23));
|
|
2066
|
+
}
|
|
2067
|
+
function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
|
|
2068
|
+
let result = a % b;
|
|
2069
|
+
if (result < 0)
|
|
2070
|
+
result += b;
|
|
2071
|
+
return result;
|
|
2072
|
+
}
|
|
2073
|
+
function $735220c2d4774dd3$var$addTimeFields(time, duration) {
|
|
2074
|
+
time.hour += duration.hours || 0;
|
|
2075
|
+
time.minute += duration.minutes || 0;
|
|
2076
|
+
time.second += duration.seconds || 0;
|
|
2077
|
+
time.millisecond += duration.milliseconds || 0;
|
|
2078
|
+
return $735220c2d4774dd3$var$balanceTime(time);
|
|
2079
|
+
}
|
|
2080
|
+
function $735220c2d4774dd3$export$d52ced6badfb9a4c(value, field, amount, options) {
|
|
2081
|
+
let mutable = value.copy();
|
|
2082
|
+
switch (field) {
|
|
2083
|
+
case "era": {
|
|
2084
|
+
let eras = value.calendar.getEras();
|
|
2085
|
+
let eraIndex = eras.indexOf(value.era);
|
|
2086
|
+
if (eraIndex < 0)
|
|
2087
|
+
throw new Error("Invalid era: " + value.era);
|
|
2088
|
+
eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
|
|
2089
|
+
mutable.era = eras[eraIndex];
|
|
2090
|
+
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
|
|
2091
|
+
break;
|
|
2092
|
+
}
|
|
2093
|
+
case "year":
|
|
2094
|
+
var _mutable_calendar, _mutable_calendar_isInverseEra;
|
|
2095
|
+
if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable))
|
|
2096
|
+
amount = -amount;
|
|
2097
|
+
mutable.year = $735220c2d4774dd3$var$cycleValue(value.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
|
|
2098
|
+
if (mutable.year === -Infinity)
|
|
2099
|
+
mutable.year = 1;
|
|
2100
|
+
if (mutable.calendar.balanceYearMonth)
|
|
2101
|
+
mutable.calendar.balanceYearMonth(mutable, value);
|
|
2102
|
+
break;
|
|
2103
|
+
case "month":
|
|
2104
|
+
mutable.month = $735220c2d4774dd3$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options === null || options === void 0 ? void 0 : options.round);
|
|
2105
|
+
break;
|
|
2106
|
+
case "day":
|
|
2107
|
+
mutable.day = $735220c2d4774dd3$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options === null || options === void 0 ? void 0 : options.round);
|
|
2108
|
+
break;
|
|
2109
|
+
default:
|
|
2110
|
+
throw new Error("Unsupported field " + field);
|
|
2111
|
+
}
|
|
2112
|
+
if (value.calendar.balanceDate)
|
|
2113
|
+
value.calendar.balanceDate(mutable);
|
|
2114
|
+
$735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
|
|
2115
|
+
return mutable;
|
|
2116
|
+
}
|
|
2117
|
+
function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
|
|
2118
|
+
let mutable = value.copy();
|
|
2119
|
+
switch (field) {
|
|
2120
|
+
case "hour": {
|
|
2121
|
+
let hours = value.hour;
|
|
2122
|
+
let min = 0;
|
|
2123
|
+
let max = 23;
|
|
2124
|
+
if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
|
|
2125
|
+
let isPM = hours >= 12;
|
|
2126
|
+
min = isPM ? 12 : 0;
|
|
2127
|
+
max = isPM ? 23 : 11;
|
|
2128
|
+
}
|
|
2129
|
+
mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
|
|
2130
|
+
break;
|
|
2131
|
+
}
|
|
2132
|
+
case "minute":
|
|
2133
|
+
mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
|
|
2134
|
+
break;
|
|
2135
|
+
case "second":
|
|
2136
|
+
mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
|
|
2137
|
+
break;
|
|
2138
|
+
case "millisecond":
|
|
2139
|
+
mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
|
|
2140
|
+
break;
|
|
2141
|
+
default:
|
|
2142
|
+
throw new Error("Unsupported field " + field);
|
|
2143
|
+
}
|
|
2144
|
+
return mutable;
|
|
2145
|
+
}
|
|
2146
|
+
function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
|
|
2147
|
+
if (round) {
|
|
2148
|
+
value += Math.sign(amount);
|
|
2149
|
+
if (value < min)
|
|
2150
|
+
value = max;
|
|
2151
|
+
let div = Math.abs(amount);
|
|
2152
|
+
if (amount > 0)
|
|
2153
|
+
value = Math.ceil(value / div) * div;
|
|
2154
|
+
else
|
|
2155
|
+
value = Math.floor(value / div) * div;
|
|
2156
|
+
if (value > max)
|
|
2157
|
+
value = min;
|
|
2158
|
+
} else {
|
|
2159
|
+
value += amount;
|
|
2160
|
+
if (value < min)
|
|
2161
|
+
value = max - (min - value - 1);
|
|
2162
|
+
else if (value > max)
|
|
2163
|
+
value = min + (value - max - 1);
|
|
2164
|
+
}
|
|
2165
|
+
return value;
|
|
2166
|
+
}
|
|
2167
|
+
var $fae977aafc393c5c$var$requiredDurationTimeGroups = [
|
|
2168
|
+
"hours",
|
|
2169
|
+
"minutes",
|
|
2170
|
+
"seconds"
|
|
2171
|
+
];
|
|
2172
|
+
var $fae977aafc393c5c$var$requiredDurationGroups = [
|
|
2173
|
+
"years",
|
|
2174
|
+
"months",
|
|
2175
|
+
"weeks",
|
|
2176
|
+
"days",
|
|
2177
|
+
...$fae977aafc393c5c$var$requiredDurationTimeGroups
|
|
2178
|
+
];
|
|
2179
|
+
function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
|
|
2180
|
+
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) : ""}`;
|
|
2181
|
+
}
|
|
2182
|
+
function $fae977aafc393c5c$export$60dfd74aa96791bd(date) {
|
|
2183
|
+
let gregorianDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
|
|
2184
|
+
return `${String(gregorianDate.year).padStart(4, "0")}-${String(gregorianDate.month).padStart(2, "0")}-${String(gregorianDate.day).padStart(2, "0")}`;
|
|
2185
|
+
}
|
|
2186
|
+
function $fae977aafc393c5c$export$4223de14708adc63(date) {
|
|
2187
|
+
return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date)}`;
|
|
2188
|
+
}
|
|
2189
|
+
function $35ea8db9cb2ccb90$var$shiftArgs(args) {
|
|
2190
|
+
let calendar = typeof args[0] === "object" ? args.shift() : new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)();
|
|
2191
|
+
let era;
|
|
2192
|
+
if (typeof args[0] === "string")
|
|
2193
|
+
era = args.shift();
|
|
2194
|
+
else {
|
|
2195
|
+
let eras = calendar.getEras();
|
|
2196
|
+
era = eras[eras.length - 1];
|
|
2197
|
+
}
|
|
2198
|
+
let year = args.shift();
|
|
2199
|
+
let month = args.shift();
|
|
2200
|
+
let day = args.shift();
|
|
2201
|
+
return [
|
|
2202
|
+
calendar,
|
|
2203
|
+
era,
|
|
2204
|
+
year,
|
|
2205
|
+
month,
|
|
2206
|
+
day
|
|
2207
|
+
];
|
|
2208
|
+
}
|
|
2209
|
+
var $35ea8db9cb2ccb90$var$_type = /* @__PURE__ */ new WeakMap();
|
|
2210
|
+
var $35ea8db9cb2ccb90$export$99faa760c7908e4f = class _$35ea8db9cb2ccb90$export$99faa760c7908e4f {
|
|
2211
|
+
/** Returns a copy of this date. */
|
|
2212
|
+
copy() {
|
|
2213
|
+
if (this.era)
|
|
2214
|
+
return new _$35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
|
|
2215
|
+
else
|
|
2216
|
+
return new _$35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
|
|
2217
|
+
}
|
|
2218
|
+
/** Returns a new `CalendarDate` with the given duration added to it. */
|
|
2219
|
+
add(duration) {
|
|
2220
|
+
return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration);
|
|
2221
|
+
}
|
|
2222
|
+
/** Returns a new `CalendarDate` with the given duration subtracted from it. */
|
|
2223
|
+
subtract(duration) {
|
|
2224
|
+
return (0, $735220c2d4774dd3$export$4e2d2ead65e5f7e3)(this, duration);
|
|
2225
|
+
}
|
|
2226
|
+
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
2227
|
+
set(fields) {
|
|
2228
|
+
return (0, $735220c2d4774dd3$export$adaa4cf7ef1b65be)(this, fields);
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
|
|
2232
|
+
* When the resulting value reaches the limits of the field, it wraps around.
|
|
2233
|
+
*/
|
|
2234
|
+
cycle(field, amount, options) {
|
|
2235
|
+
return (0, $735220c2d4774dd3$export$d52ced6badfb9a4c)(this, field, amount, options);
|
|
2236
|
+
}
|
|
2237
|
+
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
|
|
2238
|
+
toDate(timeZone) {
|
|
2239
|
+
return (0, $11d87f3f76e88657$export$e67a095c620b86fe)(this, timeZone);
|
|
2240
|
+
}
|
|
2241
|
+
/** Converts the date to an ISO 8601 formatted string. */
|
|
2242
|
+
toString() {
|
|
2243
|
+
return (0, $fae977aafc393c5c$export$60dfd74aa96791bd)(this);
|
|
2244
|
+
}
|
|
2245
|
+
/** 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. */
|
|
2246
|
+
compare(b) {
|
|
2247
|
+
return (0, $14e0f24ef4ac5c92$export$68781ddf31c0090f)(this, b);
|
|
2248
|
+
}
|
|
2249
|
+
constructor(...args) {
|
|
2250
|
+
(0, _class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type, {
|
|
2251
|
+
writable: true,
|
|
2252
|
+
value: void 0
|
|
2253
|
+
});
|
|
2254
|
+
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
|
|
2255
|
+
this.calendar = calendar;
|
|
2256
|
+
this.era = era;
|
|
2257
|
+
this.year = year;
|
|
2258
|
+
this.month = month;
|
|
2259
|
+
this.day = day;
|
|
2260
|
+
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
|
|
2261
|
+
}
|
|
2262
|
+
};
|
|
2263
|
+
var $35ea8db9cb2ccb90$var$_type2 = /* @__PURE__ */ new WeakMap();
|
|
2264
|
+
var $35ea8db9cb2ccb90$export$ca871e8dbb80966f = class _$35ea8db9cb2ccb90$export$ca871e8dbb80966f {
|
|
2265
|
+
/** Returns a copy of this date. */
|
|
2266
|
+
copy() {
|
|
2267
|
+
if (this.era)
|
|
2268
|
+
return new _$35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
2269
|
+
else
|
|
2270
|
+
return new _$35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
2271
|
+
}
|
|
2272
|
+
/** Returns a new `CalendarDateTime` with the given duration added to it. */
|
|
2273
|
+
add(duration) {
|
|
2274
|
+
return (0, $735220c2d4774dd3$export$e16d8520af44a096)(this, duration);
|
|
2275
|
+
}
|
|
2276
|
+
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
|
|
2277
|
+
subtract(duration) {
|
|
2278
|
+
return (0, $735220c2d4774dd3$export$4e2d2ead65e5f7e3)(this, duration);
|
|
2279
|
+
}
|
|
2280
|
+
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
2281
|
+
set(fields) {
|
|
2282
|
+
return (0, $735220c2d4774dd3$export$adaa4cf7ef1b65be)((0, $735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields), fields);
|
|
2283
|
+
}
|
|
2284
|
+
/**
|
|
2285
|
+
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
|
|
2286
|
+
* When the resulting value reaches the limits of the field, it wraps around.
|
|
2287
|
+
*/
|
|
2288
|
+
cycle(field, amount, options) {
|
|
2289
|
+
switch (field) {
|
|
2290
|
+
case "era":
|
|
2291
|
+
case "year":
|
|
2292
|
+
case "month":
|
|
2293
|
+
case "day":
|
|
2294
|
+
return (0, $735220c2d4774dd3$export$d52ced6badfb9a4c)(this, field, amount, options);
|
|
2295
|
+
default:
|
|
2296
|
+
return (0, $735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options);
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
/** Converts the date to a native JavaScript Date object in the given time zone. */
|
|
2300
|
+
toDate(timeZone, disambiguation) {
|
|
2301
|
+
return (0, $11d87f3f76e88657$export$e67a095c620b86fe)(this, timeZone, disambiguation);
|
|
2302
|
+
}
|
|
2303
|
+
/** Converts the date to an ISO 8601 formatted string. */
|
|
2304
|
+
toString() {
|
|
2305
|
+
return (0, $fae977aafc393c5c$export$4223de14708adc63)(this);
|
|
2306
|
+
}
|
|
2307
|
+
/** 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. */
|
|
2308
|
+
compare(b) {
|
|
2309
|
+
let res = (0, $14e0f24ef4ac5c92$export$68781ddf31c0090f)(this, b);
|
|
2310
|
+
if (res === 0)
|
|
2311
|
+
return (0, $14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, (0, $11d87f3f76e88657$export$b21e0b124e224484)(b));
|
|
2312
|
+
return res;
|
|
2313
|
+
}
|
|
2314
|
+
constructor(...args) {
|
|
2315
|
+
(0, _class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type2, {
|
|
2316
|
+
writable: true,
|
|
2317
|
+
value: void 0
|
|
2318
|
+
});
|
|
2319
|
+
let [calendar, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
|
|
2320
|
+
this.calendar = calendar;
|
|
2321
|
+
this.era = era;
|
|
2322
|
+
this.year = year;
|
|
2323
|
+
this.month = month;
|
|
2324
|
+
this.day = day;
|
|
2325
|
+
this.hour = args.shift() || 0;
|
|
2326
|
+
this.minute = args.shift() || 0;
|
|
2327
|
+
this.second = args.shift() || 0;
|
|
2328
|
+
this.millisecond = args.shift() || 0;
|
|
2329
|
+
(0, $735220c2d4774dd3$export$c4e2ecac49351ef2)(this);
|
|
2330
|
+
}
|
|
2331
|
+
};
|
|
2332
|
+
var $7c5f6fbf42389787$var$HOUR_PARTS = 1080;
|
|
2333
|
+
var $7c5f6fbf42389787$var$DAY_PARTS = 24 * $7c5f6fbf42389787$var$HOUR_PARTS;
|
|
2334
|
+
var $7c5f6fbf42389787$var$MONTH_DAYS = 29;
|
|
2335
|
+
var $7c5f6fbf42389787$var$MONTH_FRACT = 12 * $7c5f6fbf42389787$var$HOUR_PARTS + 793;
|
|
2336
|
+
var $7c5f6fbf42389787$var$MONTH_PARTS = $7c5f6fbf42389787$var$MONTH_DAYS * $7c5f6fbf42389787$var$DAY_PARTS + $7c5f6fbf42389787$var$MONTH_FRACT;
|
|
2337
|
+
var $fb18d541ea1ad717$var$formatterCache = /* @__PURE__ */ new Map();
|
|
2338
|
+
var $fb18d541ea1ad717$export$ad991b66133851cf = class {
|
|
2339
|
+
/** Formats a date as a string according to the locale and format options passed to the constructor. */
|
|
2340
|
+
format(value) {
|
|
2341
|
+
return this.formatter.format(value);
|
|
2342
|
+
}
|
|
2343
|
+
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
|
|
2344
|
+
formatToParts(value) {
|
|
2345
|
+
return this.formatter.formatToParts(value);
|
|
2346
|
+
}
|
|
2347
|
+
/** Formats a date range as a string. */
|
|
2348
|
+
formatRange(start, end) {
|
|
2349
|
+
if (typeof this.formatter.formatRange === "function")
|
|
2350
|
+
return this.formatter.formatRange(start, end);
|
|
2351
|
+
if (end < start)
|
|
2352
|
+
throw new RangeError("End date must be >= start date");
|
|
2353
|
+
return `${this.formatter.format(start)} \u2013 ${this.formatter.format(end)}`;
|
|
2354
|
+
}
|
|
2355
|
+
/** Formats a date range as an array of parts. */
|
|
2356
|
+
formatRangeToParts(start, end) {
|
|
2357
|
+
if (typeof this.formatter.formatRangeToParts === "function")
|
|
2358
|
+
return this.formatter.formatRangeToParts(start, end);
|
|
2359
|
+
if (end < start)
|
|
2360
|
+
throw new RangeError("End date must be >= start date");
|
|
2361
|
+
let startParts = this.formatter.formatToParts(start);
|
|
2362
|
+
let endParts = this.formatter.formatToParts(end);
|
|
2363
|
+
return [
|
|
2364
|
+
...startParts.map((p) => ({
|
|
2365
|
+
...p,
|
|
2366
|
+
source: "startRange"
|
|
2367
|
+
})),
|
|
2368
|
+
{
|
|
2369
|
+
type: "literal",
|
|
2370
|
+
value: " \u2013 ",
|
|
2371
|
+
source: "shared"
|
|
2372
|
+
},
|
|
2373
|
+
...endParts.map((p) => ({
|
|
2374
|
+
...p,
|
|
2375
|
+
source: "endRange"
|
|
2376
|
+
}))
|
|
2377
|
+
];
|
|
2378
|
+
}
|
|
2379
|
+
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
2380
|
+
resolvedOptions() {
|
|
2381
|
+
let resolvedOptions = this.formatter.resolvedOptions();
|
|
2382
|
+
if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
|
|
2383
|
+
if (!this.resolvedHourCycle)
|
|
2384
|
+
this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
|
|
2385
|
+
resolvedOptions.hourCycle = this.resolvedHourCycle;
|
|
2386
|
+
resolvedOptions.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12";
|
|
2387
|
+
}
|
|
2388
|
+
if (resolvedOptions.calendar === "ethiopic-amete-alem")
|
|
2389
|
+
resolvedOptions.calendar = "ethioaa";
|
|
2390
|
+
return resolvedOptions;
|
|
2391
|
+
}
|
|
2392
|
+
constructor(locale, options = {}) {
|
|
2393
|
+
this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options);
|
|
2394
|
+
this.options = options;
|
|
2395
|
+
}
|
|
2396
|
+
};
|
|
2397
|
+
var $fb18d541ea1ad717$var$hour12Preferences = {
|
|
2398
|
+
true: {
|
|
2399
|
+
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
|
|
2400
|
+
ja: "h11"
|
|
2401
|
+
},
|
|
2402
|
+
false: {}
|
|
2403
|
+
};
|
|
2404
|
+
function $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options = {}) {
|
|
2405
|
+
if (typeof options.hour12 === "boolean" && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
|
|
2406
|
+
options = {
|
|
2407
|
+
...options
|
|
2408
|
+
};
|
|
2409
|
+
let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale.split("-")[0]];
|
|
2410
|
+
let defaultHourCycle = options.hour12 ? "h12" : "h23";
|
|
2411
|
+
options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
|
|
2412
|
+
delete options.hour12;
|
|
2413
|
+
}
|
|
2414
|
+
let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
|
|
2415
|
+
if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey))
|
|
2416
|
+
return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
|
|
2417
|
+
let numberFormatter = new Intl.DateTimeFormat(locale, options);
|
|
2418
|
+
$fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
|
|
2419
|
+
return numberFormatter;
|
|
2420
|
+
}
|
|
2421
|
+
var $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
|
|
2422
|
+
function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
|
|
2423
|
+
if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null)
|
|
2424
|
+
$fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat("en-US", {
|
|
2425
|
+
hour: "numeric",
|
|
2426
|
+
hour12: false
|
|
2427
|
+
}).format(new Date(2020, 2, 3, 0)) === "24";
|
|
2428
|
+
return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
|
|
2429
|
+
}
|
|
2430
|
+
var $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
|
|
2431
|
+
function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
|
|
2432
|
+
if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null)
|
|
2433
|
+
$fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat("fr", {
|
|
2434
|
+
hour: "numeric",
|
|
2435
|
+
hour12: false
|
|
2436
|
+
}).resolvedOptions().hourCycle === "h12";
|
|
2437
|
+
return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
|
|
2438
|
+
}
|
|
2439
|
+
function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
|
|
2440
|
+
if (!options.timeStyle && !options.hour)
|
|
2441
|
+
return void 0;
|
|
2442
|
+
locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, "");
|
|
2443
|
+
locale += (locale.includes("-u-") ? "" : "-u") + "-nu-latn";
|
|
2444
|
+
let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, {
|
|
2445
|
+
...options,
|
|
2446
|
+
timeZone: void 0
|
|
2447
|
+
// use local timezone
|
|
2448
|
+
});
|
|
2449
|
+
let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p) => p.type === "hour").value, 10);
|
|
2450
|
+
let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p) => p.type === "hour").value, 10);
|
|
2451
|
+
if (min === 0 && max === 23)
|
|
2452
|
+
return "h23";
|
|
2453
|
+
if (min === 24 && max === 23)
|
|
2454
|
+
return "h24";
|
|
2455
|
+
if (min === 0 && max === 11)
|
|
2456
|
+
return "h11";
|
|
2457
|
+
if (min === 12 && max === 11)
|
|
2458
|
+
return "h12";
|
|
2459
|
+
throw new Error("Unexpected hour cycle result");
|
|
2460
|
+
}
|
|
2461
|
+
|
|
1452
2462
|
// src/ts-utils.ts
|
|
1453
2463
|
function isNotNullOrUndefined(value) {
|
|
1454
2464
|
return value !== void 0 && value !== null;
|
|
@@ -1506,8 +2516,11 @@ function getFormatConfigs(pattern) {
|
|
|
1506
2516
|
];
|
|
1507
2517
|
}
|
|
1508
2518
|
function formatDate(pattern) {
|
|
1509
|
-
const
|
|
1510
|
-
return (d) =>
|
|
2519
|
+
const formatters = getFormatConfigs(pattern).filter(isNotNullOrUndefined).map((c) => getDateFormatter(c.locale, c.options));
|
|
2520
|
+
return (d) => formatters.map((f) => f.format(d)).join(" ");
|
|
2521
|
+
}
|
|
2522
|
+
function getDateFormatter(locale, options) {
|
|
2523
|
+
return new $fb18d541ea1ad717$export$ad991b66133851cf(locale, options);
|
|
1511
2524
|
}
|
|
1512
2525
|
|
|
1513
2526
|
// src/date/types.ts
|
|
@@ -1529,7 +2542,12 @@ var isDatePattern = (pattern) => supportedDatePatterns.includes(pattern);
|
|
|
1529
2542
|
var isTimePattern = (pattern) => supportedTimePatterns.includes(pattern);
|
|
1530
2543
|
var isDateTimePattern = (pattern) => isDatePattern(pattern == null ? void 0 : pattern.date) || isTimePattern(pattern == null ? void 0 : pattern.time);
|
|
1531
2544
|
|
|
1532
|
-
// src/date/
|
|
2545
|
+
// src/date/utils.ts
|
|
2546
|
+
function toCalendarDate(d) {
|
|
2547
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(d.getFullYear(), d.getMonth() + 1, d.getDate());
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
// src/date/dateTimePattern.ts
|
|
1533
2551
|
var defaultPatternsByType = {
|
|
1534
2552
|
time: "hh:mm:ss",
|
|
1535
2553
|
date: "dd.mm.yyyy"
|
|
@@ -2129,60 +3147,81 @@ var Space2 = " ";
|
|
|
2129
3147
|
var Tab = "Tab";
|
|
2130
3148
|
|
|
2131
3149
|
// src/keyset.ts
|
|
3150
|
+
var EMPTY2 = [];
|
|
2132
3151
|
var KeySet = class {
|
|
2133
3152
|
constructor(range) {
|
|
2134
3153
|
this.keys = /* @__PURE__ */ new Map();
|
|
2135
|
-
this.free = [];
|
|
2136
3154
|
this.nextKeyValue = 0;
|
|
2137
|
-
this.
|
|
3155
|
+
this.range = range;
|
|
3156
|
+
this.init(range);
|
|
2138
3157
|
}
|
|
2139
|
-
next() {
|
|
2140
|
-
if (
|
|
2141
|
-
return
|
|
3158
|
+
next(free = EMPTY2) {
|
|
3159
|
+
if (free.length > 0) {
|
|
3160
|
+
return free.shift();
|
|
2142
3161
|
} else {
|
|
2143
3162
|
return this.nextKeyValue++;
|
|
2144
3163
|
}
|
|
2145
3164
|
}
|
|
2146
|
-
|
|
3165
|
+
init({ from, to }) {
|
|
3166
|
+
this.keys.clear();
|
|
3167
|
+
this.nextKeyValue = 0;
|
|
3168
|
+
for (let rowIndex = from; rowIndex < to; rowIndex++) {
|
|
3169
|
+
const nextKeyValue = this.next();
|
|
3170
|
+
this.keys.set(rowIndex, nextKeyValue);
|
|
3171
|
+
}
|
|
3172
|
+
return true;
|
|
3173
|
+
}
|
|
3174
|
+
reset(range) {
|
|
3175
|
+
const { from, to } = range;
|
|
3176
|
+
const newSize = to - from;
|
|
3177
|
+
const currentSize = this.range.to - this.range.from;
|
|
3178
|
+
this.range = range;
|
|
3179
|
+
if (currentSize > newSize) {
|
|
3180
|
+
return this.init(range);
|
|
3181
|
+
}
|
|
3182
|
+
const freeKeys = [];
|
|
2147
3183
|
this.keys.forEach((keyValue, rowIndex) => {
|
|
2148
3184
|
if (rowIndex < from || rowIndex >= to) {
|
|
2149
|
-
|
|
3185
|
+
freeKeys.push(keyValue);
|
|
2150
3186
|
this.keys.delete(rowIndex);
|
|
2151
3187
|
}
|
|
2152
3188
|
});
|
|
2153
|
-
const size2 = to - from;
|
|
2154
|
-
if (this.keys.size + this.free.length > size2) {
|
|
2155
|
-
this.free.length = Math.max(0, size2 - this.keys.size);
|
|
2156
|
-
}
|
|
2157
3189
|
for (let rowIndex = from; rowIndex < to; rowIndex++) {
|
|
2158
3190
|
if (!this.keys.has(rowIndex)) {
|
|
2159
|
-
const nextKeyValue = this.next();
|
|
3191
|
+
const nextKeyValue = this.next(freeKeys);
|
|
2160
3192
|
this.keys.set(rowIndex, nextKeyValue);
|
|
2161
3193
|
}
|
|
2162
3194
|
}
|
|
2163
|
-
|
|
2164
|
-
this.nextKeyValue = this.keys.size;
|
|
2165
|
-
}
|
|
3195
|
+
return false;
|
|
2166
3196
|
}
|
|
2167
3197
|
keyFor(rowIndex) {
|
|
2168
3198
|
const key = this.keys.get(rowIndex);
|
|
2169
3199
|
if (key === void 0) {
|
|
2170
3200
|
console.log(`key not found
|
|
2171
3201
|
keys: ${this.toDebugString()}
|
|
2172
|
-
free : ${this.free.join(",")}
|
|
2173
3202
|
`);
|
|
2174
3203
|
throw Error(`KeySet, no key found for rowIndex ${rowIndex}`);
|
|
2175
3204
|
}
|
|
2176
3205
|
return key;
|
|
2177
3206
|
}
|
|
2178
3207
|
toDebugString() {
|
|
2179
|
-
return
|
|
3208
|
+
return `${this.keys.size} keys
|
|
3209
|
+
${Array.from(this.keys.entries()).sort(([key1], [key2]) => key1 - key2).map(([k, v]) => `${k}=>${v}`).join(",")}]
|
|
3210
|
+
`;
|
|
2180
3211
|
}
|
|
2181
3212
|
};
|
|
2182
3213
|
|
|
2183
3214
|
// src/menu-utils.ts
|
|
2184
3215
|
var isGroupMenuItemDescriptor = (menuItem) => menuItem !== void 0 && "children" in menuItem;
|
|
2185
3216
|
|
|
3217
|
+
// src/module-utils.ts
|
|
3218
|
+
var isModule = (entity) => entity !== void 0 && typeof entity !== "function";
|
|
3219
|
+
var assertModuleExportsAtLeastOneComponent = (module2) => {
|
|
3220
|
+
if (module2 && Object.values(module2).every((item) => isModule(item))) {
|
|
3221
|
+
throw Error("module file, no components");
|
|
3222
|
+
}
|
|
3223
|
+
};
|
|
3224
|
+
|
|
2186
3225
|
// src/nanoid/index.ts
|
|
2187
3226
|
var uuid = (size2 = 21) => {
|
|
2188
3227
|
let id = "";
|
|
@@ -2202,6 +3241,23 @@ var uuid = (size2 = 21) => {
|
|
|
2202
3241
|
return id;
|
|
2203
3242
|
};
|
|
2204
3243
|
|
|
3244
|
+
// src/react-utils.ts
|
|
3245
|
+
var import_react = require("react");
|
|
3246
|
+
var EMPTY_ARRAY = [];
|
|
3247
|
+
var asReactElements = (children) => {
|
|
3248
|
+
const isArray = Array.isArray(children);
|
|
3249
|
+
const count = isArray ? children.length : import_react.Children.count(children);
|
|
3250
|
+
if (isArray && children.every(import_react.isValidElement)) {
|
|
3251
|
+
return children;
|
|
3252
|
+
} else if (count === 1 && !isArray && (0, import_react.isValidElement)(children)) {
|
|
3253
|
+
return [children];
|
|
3254
|
+
} else if (count > 1) {
|
|
3255
|
+
return children;
|
|
3256
|
+
} else {
|
|
3257
|
+
return EMPTY_ARRAY;
|
|
3258
|
+
}
|
|
3259
|
+
};
|
|
3260
|
+
|
|
2205
3261
|
// src/perf-utils.ts
|
|
2206
3262
|
function debounce(callback, timeInterval) {
|
|
2207
3263
|
let timeout;
|
|
@@ -2241,9 +3297,9 @@ var actualRowPositioning = (rowHeight) => [
|
|
|
2241
3297
|
false
|
|
2242
3298
|
];
|
|
2243
3299
|
var virtualRowPositioning = (rowHeight, virtualisedExtent, pctScrollTop) => [
|
|
2244
|
-
(row) => {
|
|
3300
|
+
(row, offset = 0) => {
|
|
2245
3301
|
const rowOffset = pctScrollTop.current * virtualisedExtent;
|
|
2246
|
-
return row[IDX] * rowHeight - rowOffset;
|
|
3302
|
+
return (row[IDX] - offset) * rowHeight - rowOffset;
|
|
2247
3303
|
},
|
|
2248
3304
|
/*
|
|
2249
3305
|
Return index position of closest row
|
|
@@ -2574,7 +3630,7 @@ var wordify = (text) => {
|
|
|
2574
3630
|
};
|
|
2575
3631
|
|
|
2576
3632
|
// src/ThemeProvider.tsx
|
|
2577
|
-
var
|
|
3633
|
+
var import_react2 = require("react");
|
|
2578
3634
|
|
|
2579
3635
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
2580
3636
|
function r(e) {
|
|
@@ -2602,7 +3658,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
2602
3658
|
var DEFAULT_DENSITY = "medium";
|
|
2603
3659
|
var DEFAULT_THEME = "salt-theme";
|
|
2604
3660
|
var DEFAULT_THEME_MODE = "light";
|
|
2605
|
-
var ThemeContext = (0,
|
|
3661
|
+
var ThemeContext = (0, import_react2.createContext)({
|
|
2606
3662
|
density: "high",
|
|
2607
3663
|
theme: "vuu",
|
|
2608
3664
|
themeMode: "light"
|
|
@@ -2613,7 +3669,7 @@ var DEFAULT_THEME_ATTRIBUTES = [
|
|
|
2613
3669
|
"light"
|
|
2614
3670
|
];
|
|
2615
3671
|
var useThemeAttributes = (themeAttributes) => {
|
|
2616
|
-
const context = (0,
|
|
3672
|
+
const context = (0, import_react2.useContext)(ThemeContext);
|
|
2617
3673
|
if (themeAttributes) {
|
|
2618
3674
|
return [
|
|
2619
3675
|
themeAttributes.themeClass,
|
|
@@ -2631,8 +3687,8 @@ var useThemeAttributes = (themeAttributes) => {
|
|
|
2631
3687
|
};
|
|
2632
3688
|
var createThemedChildren = (children, theme, themeMode, density) => {
|
|
2633
3689
|
var _a;
|
|
2634
|
-
if ((0,
|
|
2635
|
-
return (0,
|
|
3690
|
+
if ((0, import_react2.isValidElement)(children)) {
|
|
3691
|
+
return (0, import_react2.cloneElement)(children, {
|
|
2636
3692
|
className: clsx_default(
|
|
2637
3693
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2638
3694
|
(_a = children.props) == null ? void 0 : _a.className,
|
|
@@ -2664,7 +3720,7 @@ var ThemeProvider = ({
|
|
|
2664
3720
|
density: inheritedDensity,
|
|
2665
3721
|
themeMode: inheritedThemeMode,
|
|
2666
3722
|
theme: inheritedTheme
|
|
2667
|
-
} = (0,
|
|
3723
|
+
} = (0, import_react2.useContext)(ThemeContext);
|
|
2668
3724
|
const density = (_a = densityProp != null ? densityProp : inheritedDensity) != null ? _a : DEFAULT_DENSITY;
|
|
2669
3725
|
const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
|
|
2670
3726
|
const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
|
|
@@ -2681,15 +3737,15 @@ var getUrlParameter = (paramName, defaultValue) => {
|
|
|
2681
3737
|
var hasUrlParameter = (paramName) => new URL(document.location.href).searchParams.has(paramName);
|
|
2682
3738
|
|
|
2683
3739
|
// src/useId.ts
|
|
2684
|
-
var
|
|
3740
|
+
var import_react3 = require("react");
|
|
2685
3741
|
var vuuComponentIdCount = 0;
|
|
2686
|
-
var useId = (id) => (0,
|
|
3742
|
+
var useId = (id) => (0, import_react3.useMemo)(() => id != null ? id : `vuu-${++vuuComponentIdCount}`, [id]);
|
|
2687
3743
|
|
|
2688
3744
|
// src/useLayoutEffectSkipFirst.ts
|
|
2689
|
-
var
|
|
3745
|
+
var import_react4 = require("react");
|
|
2690
3746
|
var useLayoutEffectSkipFirst = (func, deps) => {
|
|
2691
|
-
const goodToGo = (0,
|
|
2692
|
-
(0,
|
|
3747
|
+
const goodToGo = (0, import_react4.useRef)(false);
|
|
3748
|
+
(0, import_react4.useLayoutEffect)(() => {
|
|
2693
3749
|
if (goodToGo.current) {
|
|
2694
3750
|
func();
|
|
2695
3751
|
} else {
|