@economic/taco 2.60.1-date-fns.0 → 2.61.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/taco.cjs +2638 -518
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.css +37 -31
- package/dist/taco.d.ts +6 -1
- package/dist/taco.js +2638 -518
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.js
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
1
4
|
import * as React from "react";
|
2
5
|
import React__default, { createContext, useMemo, createElement, useContext, useCallback, useLayoutEffect, useRef, useEffect, useState, forwardRef, Children, isValidElement, cloneElement, Fragment, useReducer, memo as memo$2, PureComponent, useImperativeHandle, Component } from "react";
|
3
6
|
import * as ReactDOM from "react-dom";
|
@@ -4543,7 +4546,7 @@ var zeroGap = {
|
|
4543
4546
|
right: 0,
|
4544
4547
|
gap: 0
|
4545
4548
|
};
|
4546
|
-
var parse$
|
4549
|
+
var parse$3 = function(x2) {
|
4547
4550
|
return parseInt(x2 || "", 10) || 0;
|
4548
4551
|
};
|
4549
4552
|
var getOffset$1 = function(gapMode) {
|
@@ -4551,7 +4554,7 @@ var getOffset$1 = function(gapMode) {
|
|
4551
4554
|
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
4552
4555
|
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
4553
4556
|
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
4554
|
-
return [parse$
|
4557
|
+
return [parse$3(left), parse$3(top), parse$3(right)];
|
4555
4558
|
};
|
4556
4559
|
var getGapWidth = function(gapMode) {
|
4557
4560
|
if (gapMode === void 0) {
|
@@ -9752,7 +9755,7 @@ const useMergedRef = (ref) => {
|
|
9752
9755
|
return internalRef;
|
9753
9756
|
};
|
9754
9757
|
const FOCUSABLE_ELEMENTS = [
|
9755
|
-
|
9758
|
+
'[tabindex]:not([tabindex="-1"]):not([disabled])',
|
9756
9759
|
"input:not([disabled])",
|
9757
9760
|
"select:not([disabled])",
|
9758
9761
|
"textarea:not([disabled])",
|
@@ -9765,7 +9768,7 @@ const FOCUSABLE_ELEMENTS = [
|
|
9765
9768
|
"embed",
|
9766
9769
|
"audio[controls]",
|
9767
9770
|
"video[controls]",
|
9768
|
-
|
9771
|
+
'[contenteditable]:not([contenteditable="false"]):not([disabled])',
|
9769
9772
|
"details:not([disabled])",
|
9770
9773
|
"summary:not(:disabled)"
|
9771
9774
|
];
|
@@ -9790,14 +9793,14 @@ const getIndexOfFirstChildOverflowingParent = (element, overscan = 0) => {
|
|
9790
9793
|
}
|
9791
9794
|
return boundaryChildIndex;
|
9792
9795
|
};
|
9793
|
-
const getNextFocussableElement = (currentElement) => {
|
9796
|
+
const getNextFocussableElement = (currentElement, direction = 1) => {
|
9794
9797
|
if (!currentElement) {
|
9795
9798
|
return null;
|
9796
9799
|
}
|
9797
9800
|
let focussableElements = [...document.querySelectorAll(FOCUSABLE_ELEMENTS.join(","))];
|
9798
9801
|
const currentElementIndex = focussableElements.indexOf(currentElement);
|
9799
9802
|
if (currentElementIndex > -1) {
|
9800
|
-
focussableElements = focussableElements.slice(currentElementIndex +
|
9803
|
+
focussableElements = focussableElements.slice(currentElementIndex + direction).filter((element) => element.getAttribute("tabindex") !== "-1");
|
9801
9804
|
if (focussableElements.length) {
|
9802
9805
|
focussableElements = focussableElements.filter((element) => {
|
9803
9806
|
var _a;
|
@@ -9846,6 +9849,9 @@ function isSiblingElementInsideSameParentOverlay(element, sibling) {
|
|
9846
9849
|
var _a;
|
9847
9850
|
return !!((_a = element == null ? void 0 : element.closest("[role=dialog],[role=menu]")) == null ? void 0 : _a.contains(sibling));
|
9848
9851
|
}
|
9852
|
+
function isElementInsideExternalRelatedOverlay(element, tableRef) {
|
9853
|
+
return isElementInsideOverlay(element) && !isSiblingElementInsideSameParentOverlay(element, tableRef.current) || isElementInteractive(element) && !isElementInsideOrTriggeredFromContainer(element, tableRef.current);
|
9854
|
+
}
|
9849
9855
|
function isElementInteractive(element) {
|
9850
9856
|
if (!element) {
|
9851
9857
|
return false;
|
@@ -11868,13 +11874,16 @@ function addMonths(date2, amount) {
|
|
11868
11874
|
}
|
11869
11875
|
const millisecondsInWeek = 6048e5;
|
11870
11876
|
const millisecondsInDay = 864e5;
|
11877
|
+
const millisecondsInMinute = 6e4;
|
11878
|
+
const millisecondsInHour = 36e5;
|
11879
|
+
const millisecondsInSecond = 1e3;
|
11871
11880
|
let defaultOptions$3 = {};
|
11872
|
-
function getDefaultOptions() {
|
11881
|
+
function getDefaultOptions$1() {
|
11873
11882
|
return defaultOptions$3;
|
11874
11883
|
}
|
11875
11884
|
function startOfWeek(date2, options) {
|
11876
11885
|
var _a, _b, _c, _d;
|
11877
|
-
const defaultOptions2 = getDefaultOptions();
|
11886
|
+
const defaultOptions2 = getDefaultOptions$1();
|
11878
11887
|
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
11879
11888
|
const _date = toDate(date2);
|
11880
11889
|
const day = _date.getDay();
|
@@ -12018,7 +12027,7 @@ function startOfYear(date2) {
|
|
12018
12027
|
}
|
12019
12028
|
function endOfWeek(date2, options) {
|
12020
12029
|
var _a, _b, _c, _d;
|
12021
|
-
const defaultOptions2 = getDefaultOptions();
|
12030
|
+
const defaultOptions2 = getDefaultOptions$1();
|
12022
12031
|
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
12023
12032
|
const _date = toDate(date2);
|
12024
12033
|
const day = _date.getDay();
|
@@ -12534,7 +12543,7 @@ function getWeekYear(date2, options) {
|
|
12534
12543
|
var _a, _b, _c, _d;
|
12535
12544
|
const _date = toDate(date2);
|
12536
12545
|
const year = _date.getFullYear();
|
12537
|
-
const defaultOptions2 = getDefaultOptions();
|
12546
|
+
const defaultOptions2 = getDefaultOptions$1();
|
12538
12547
|
const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
|
12539
12548
|
const firstWeekOfNextYear = constructFrom(date2, 0);
|
12540
12549
|
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
|
@@ -12554,7 +12563,7 @@ function getWeekYear(date2, options) {
|
|
12554
12563
|
}
|
12555
12564
|
function startOfWeekYear(date2, options) {
|
12556
12565
|
var _a, _b, _c, _d;
|
12557
|
-
const defaultOptions2 = getDefaultOptions();
|
12566
|
+
const defaultOptions2 = getDefaultOptions$1();
|
12558
12567
|
const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
|
12559
12568
|
const year = getWeekYear(date2, options);
|
12560
12569
|
const firstWeek = constructFrom(date2, 0);
|
@@ -13236,222 +13245,1977 @@ const formatters$1 = {
|
|
13236
13245
|
// Long
|
13237
13246
|
case "zzzz":
|
13238
13247
|
default:
|
13239
|
-
return "GMT" + formatTimezone(timezoneOffset, ":");
|
13248
|
+
return "GMT" + formatTimezone(timezoneOffset, ":");
|
13249
|
+
}
|
13250
|
+
},
|
13251
|
+
// Seconds timestamp
|
13252
|
+
t: function(date2, token, _localize) {
|
13253
|
+
const timestamp = Math.trunc(date2.getTime() / 1e3);
|
13254
|
+
return addLeadingZeros(timestamp, token.length);
|
13255
|
+
},
|
13256
|
+
// Milliseconds timestamp
|
13257
|
+
T: function(date2, token, _localize) {
|
13258
|
+
const timestamp = date2.getTime();
|
13259
|
+
return addLeadingZeros(timestamp, token.length);
|
13260
|
+
}
|
13261
|
+
};
|
13262
|
+
function formatTimezoneShort(offset2, delimiter = "") {
|
13263
|
+
const sign2 = offset2 > 0 ? "-" : "+";
|
13264
|
+
const absOffset = Math.abs(offset2);
|
13265
|
+
const hours = Math.trunc(absOffset / 60);
|
13266
|
+
const minutes = absOffset % 60;
|
13267
|
+
if (minutes === 0) {
|
13268
|
+
return sign2 + String(hours);
|
13269
|
+
}
|
13270
|
+
return sign2 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
13271
|
+
}
|
13272
|
+
function formatTimezoneWithOptionalMinutes(offset2, delimiter) {
|
13273
|
+
if (offset2 % 60 === 0) {
|
13274
|
+
const sign2 = offset2 > 0 ? "-" : "+";
|
13275
|
+
return sign2 + addLeadingZeros(Math.abs(offset2) / 60, 2);
|
13276
|
+
}
|
13277
|
+
return formatTimezone(offset2, delimiter);
|
13278
|
+
}
|
13279
|
+
function formatTimezone(offset2, delimiter = "") {
|
13280
|
+
const sign2 = offset2 > 0 ? "-" : "+";
|
13281
|
+
const absOffset = Math.abs(offset2);
|
13282
|
+
const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
|
13283
|
+
const minutes = addLeadingZeros(absOffset % 60, 2);
|
13284
|
+
return sign2 + hours + delimiter + minutes;
|
13285
|
+
}
|
13286
|
+
const dateLongFormatter = (pattern, formatLong2) => {
|
13287
|
+
switch (pattern) {
|
13288
|
+
case "P":
|
13289
|
+
return formatLong2.date({ width: "short" });
|
13290
|
+
case "PP":
|
13291
|
+
return formatLong2.date({ width: "medium" });
|
13292
|
+
case "PPP":
|
13293
|
+
return formatLong2.date({ width: "long" });
|
13294
|
+
case "PPPP":
|
13295
|
+
default:
|
13296
|
+
return formatLong2.date({ width: "full" });
|
13297
|
+
}
|
13298
|
+
};
|
13299
|
+
const timeLongFormatter = (pattern, formatLong2) => {
|
13300
|
+
switch (pattern) {
|
13301
|
+
case "p":
|
13302
|
+
return formatLong2.time({ width: "short" });
|
13303
|
+
case "pp":
|
13304
|
+
return formatLong2.time({ width: "medium" });
|
13305
|
+
case "ppp":
|
13306
|
+
return formatLong2.time({ width: "long" });
|
13307
|
+
case "pppp":
|
13308
|
+
default:
|
13309
|
+
return formatLong2.time({ width: "full" });
|
13310
|
+
}
|
13311
|
+
};
|
13312
|
+
const dateTimeLongFormatter = (pattern, formatLong2) => {
|
13313
|
+
const matchResult = pattern.match(/(P+)(p+)?/) || [];
|
13314
|
+
const datePattern = matchResult[1];
|
13315
|
+
const timePattern = matchResult[2];
|
13316
|
+
if (!timePattern) {
|
13317
|
+
return dateLongFormatter(pattern, formatLong2);
|
13318
|
+
}
|
13319
|
+
let dateTimeFormat;
|
13320
|
+
switch (datePattern) {
|
13321
|
+
case "P":
|
13322
|
+
dateTimeFormat = formatLong2.dateTime({ width: "short" });
|
13323
|
+
break;
|
13324
|
+
case "PP":
|
13325
|
+
dateTimeFormat = formatLong2.dateTime({ width: "medium" });
|
13326
|
+
break;
|
13327
|
+
case "PPP":
|
13328
|
+
dateTimeFormat = formatLong2.dateTime({ width: "long" });
|
13329
|
+
break;
|
13330
|
+
case "PPPP":
|
13331
|
+
default:
|
13332
|
+
dateTimeFormat = formatLong2.dateTime({ width: "full" });
|
13333
|
+
break;
|
13334
|
+
}
|
13335
|
+
return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
|
13336
|
+
};
|
13337
|
+
const longFormatters = {
|
13338
|
+
p: timeLongFormatter,
|
13339
|
+
P: dateTimeLongFormatter
|
13340
|
+
};
|
13341
|
+
const dayOfYearTokenRE = /^D+$/;
|
13342
|
+
const weekYearTokenRE = /^Y+$/;
|
13343
|
+
const throwTokens = ["D", "DD", "YY", "YYYY"];
|
13344
|
+
function isProtectedDayOfYearToken(token) {
|
13345
|
+
return dayOfYearTokenRE.test(token);
|
13346
|
+
}
|
13347
|
+
function isProtectedWeekYearToken(token) {
|
13348
|
+
return weekYearTokenRE.test(token);
|
13349
|
+
}
|
13350
|
+
function warnOrThrowProtectedError(token, format2, input) {
|
13351
|
+
const _message = message(token, format2, input);
|
13352
|
+
console.warn(_message);
|
13353
|
+
if (throwTokens.includes(token)) throw new RangeError(_message);
|
13354
|
+
}
|
13355
|
+
function message(token, format2, input) {
|
13356
|
+
const subject = token[0] === "Y" ? "years" : "days of the month";
|
13357
|
+
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
13358
|
+
}
|
13359
|
+
const formattingTokensRegExp$1 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
13360
|
+
const longFormattingTokensRegExp$1 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
13361
|
+
const escapedStringRegExp$1 = /^'([^]*?)'?$/;
|
13362
|
+
const doubleQuoteRegExp$1 = /''/g;
|
13363
|
+
const unescapedLatinCharacterRegExp$1 = /[a-zA-Z]/;
|
13364
|
+
function format$2(date2, formatStr, options) {
|
13365
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
13366
|
+
const defaultOptions2 = getDefaultOptions$1();
|
13367
|
+
const locale2 = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
|
13368
|
+
const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
|
13369
|
+
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_f = (_e = options == null ? void 0 : options.locale) == null ? void 0 : _e.options) == null ? void 0 : _f.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_h = (_g = defaultOptions2.locale) == null ? void 0 : _g.options) == null ? void 0 : _h.weekStartsOn) ?? 0;
|
13370
|
+
const originalDate = toDate(date2);
|
13371
|
+
if (!isValid(originalDate)) {
|
13372
|
+
throw new RangeError("Invalid time value");
|
13373
|
+
}
|
13374
|
+
let parts = formatStr.match(longFormattingTokensRegExp$1).map((substring) => {
|
13375
|
+
const firstCharacter = substring[0];
|
13376
|
+
if (firstCharacter === "p" || firstCharacter === "P") {
|
13377
|
+
const longFormatter = longFormatters[firstCharacter];
|
13378
|
+
return longFormatter(substring, locale2.formatLong);
|
13379
|
+
}
|
13380
|
+
return substring;
|
13381
|
+
}).join("").match(formattingTokensRegExp$1).map((substring) => {
|
13382
|
+
if (substring === "''") {
|
13383
|
+
return { isToken: false, value: "'" };
|
13384
|
+
}
|
13385
|
+
const firstCharacter = substring[0];
|
13386
|
+
if (firstCharacter === "'") {
|
13387
|
+
return { isToken: false, value: cleanEscapedString$1(substring) };
|
13388
|
+
}
|
13389
|
+
if (formatters$1[firstCharacter]) {
|
13390
|
+
return { isToken: true, value: substring };
|
13391
|
+
}
|
13392
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp$1)) {
|
13393
|
+
throw new RangeError(
|
13394
|
+
"Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
|
13395
|
+
);
|
13396
|
+
}
|
13397
|
+
return { isToken: false, value: substring };
|
13398
|
+
});
|
13399
|
+
if (locale2.localize.preprocessor) {
|
13400
|
+
parts = locale2.localize.preprocessor(originalDate, parts);
|
13401
|
+
}
|
13402
|
+
const formatterOptions = {
|
13403
|
+
firstWeekContainsDate,
|
13404
|
+
weekStartsOn,
|
13405
|
+
locale: locale2
|
13406
|
+
};
|
13407
|
+
return parts.map((part) => {
|
13408
|
+
if (!part.isToken) return part.value;
|
13409
|
+
const token = part.value;
|
13410
|
+
if (!(options == null ? void 0 : options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token) || !(options == null ? void 0 : options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {
|
13411
|
+
warnOrThrowProtectedError(token, formatStr, String(date2));
|
13412
|
+
}
|
13413
|
+
const formatter = formatters$1[token[0]];
|
13414
|
+
return formatter(originalDate, token, locale2.localize, formatterOptions);
|
13415
|
+
}).join("");
|
13416
|
+
}
|
13417
|
+
function cleanEscapedString$1(input) {
|
13418
|
+
const matched = input.match(escapedStringRegExp$1);
|
13419
|
+
if (!matched) {
|
13420
|
+
return input;
|
13421
|
+
}
|
13422
|
+
return matched[1].replace(doubleQuoteRegExp$1, "'");
|
13423
|
+
}
|
13424
|
+
function getDaysInMonth(date2) {
|
13425
|
+
const _date = toDate(date2);
|
13426
|
+
const year = _date.getFullYear();
|
13427
|
+
const monthIndex = _date.getMonth();
|
13428
|
+
const lastDayOfMonth2 = constructFrom(date2, 0);
|
13429
|
+
lastDayOfMonth2.setFullYear(year, monthIndex + 1, 0);
|
13430
|
+
lastDayOfMonth2.setHours(0, 0, 0, 0);
|
13431
|
+
return lastDayOfMonth2.getDate();
|
13432
|
+
}
|
13433
|
+
function getDefaultOptions() {
|
13434
|
+
return Object.assign({}, getDefaultOptions$1());
|
13435
|
+
}
|
13436
|
+
function getISODay(date2) {
|
13437
|
+
const _date = toDate(date2);
|
13438
|
+
let day = _date.getDay();
|
13439
|
+
if (day === 0) {
|
13440
|
+
day = 7;
|
13441
|
+
}
|
13442
|
+
return day;
|
13443
|
+
}
|
13444
|
+
function getUnixTime(date2) {
|
13445
|
+
return Math.trunc(+toDate(date2) / 1e3);
|
13446
|
+
}
|
13447
|
+
function lastDayOfMonth(date2) {
|
13448
|
+
const _date = toDate(date2);
|
13449
|
+
const month = _date.getMonth();
|
13450
|
+
_date.setFullYear(_date.getFullYear(), month + 1, 0);
|
13451
|
+
_date.setHours(0, 0, 0, 0);
|
13452
|
+
return _date;
|
13453
|
+
}
|
13454
|
+
function getWeeksInMonth(date2, options) {
|
13455
|
+
return differenceInCalendarWeeks(
|
13456
|
+
lastDayOfMonth(date2),
|
13457
|
+
startOfMonth(date2),
|
13458
|
+
options
|
13459
|
+
) + 1;
|
13460
|
+
}
|
13461
|
+
function isAfter(date2, dateToCompare) {
|
13462
|
+
const _date = toDate(date2);
|
13463
|
+
const _dateToCompare = toDate(dateToCompare);
|
13464
|
+
return _date.getTime() > _dateToCompare.getTime();
|
13465
|
+
}
|
13466
|
+
function isBefore(date2, dateToCompare) {
|
13467
|
+
const _date = toDate(date2);
|
13468
|
+
const _dateToCompare = toDate(dateToCompare);
|
13469
|
+
return +_date < +_dateToCompare;
|
13470
|
+
}
|
13471
|
+
function transpose(fromDate, constructor) {
|
13472
|
+
const date2 = constructor instanceof Date ? constructFrom(constructor, 0) : new constructor(0);
|
13473
|
+
date2.setFullYear(
|
13474
|
+
fromDate.getFullYear(),
|
13475
|
+
fromDate.getMonth(),
|
13476
|
+
fromDate.getDate()
|
13477
|
+
);
|
13478
|
+
date2.setHours(
|
13479
|
+
fromDate.getHours(),
|
13480
|
+
fromDate.getMinutes(),
|
13481
|
+
fromDate.getSeconds(),
|
13482
|
+
fromDate.getMilliseconds()
|
13483
|
+
);
|
13484
|
+
return date2;
|
13485
|
+
}
|
13486
|
+
const TIMEZONE_UNIT_PRIORITY = 10;
|
13487
|
+
class Setter {
|
13488
|
+
constructor() {
|
13489
|
+
__publicField(this, "subPriority", 0);
|
13490
|
+
}
|
13491
|
+
validate(_utcDate, _options) {
|
13492
|
+
return true;
|
13493
|
+
}
|
13494
|
+
}
|
13495
|
+
class ValueSetter extends Setter {
|
13496
|
+
constructor(value, validateValue, setValue, priority, subPriority) {
|
13497
|
+
super();
|
13498
|
+
this.value = value;
|
13499
|
+
this.validateValue = validateValue;
|
13500
|
+
this.setValue = setValue;
|
13501
|
+
this.priority = priority;
|
13502
|
+
if (subPriority) {
|
13503
|
+
this.subPriority = subPriority;
|
13504
|
+
}
|
13505
|
+
}
|
13506
|
+
validate(date2, options) {
|
13507
|
+
return this.validateValue(date2, this.value, options);
|
13508
|
+
}
|
13509
|
+
set(date2, flags, options) {
|
13510
|
+
return this.setValue(date2, flags, this.value, options);
|
13511
|
+
}
|
13512
|
+
}
|
13513
|
+
class DateToSystemTimezoneSetter extends Setter {
|
13514
|
+
constructor() {
|
13515
|
+
super(...arguments);
|
13516
|
+
__publicField(this, "priority", TIMEZONE_UNIT_PRIORITY);
|
13517
|
+
__publicField(this, "subPriority", -1);
|
13518
|
+
}
|
13519
|
+
set(date2, flags) {
|
13520
|
+
if (flags.timestampIsSet) return date2;
|
13521
|
+
return constructFrom(date2, transpose(date2, Date));
|
13522
|
+
}
|
13523
|
+
}
|
13524
|
+
class Parser {
|
13525
|
+
run(dateString, token, match2, options) {
|
13526
|
+
const result = this.parse(dateString, token, match2, options);
|
13527
|
+
if (!result) {
|
13528
|
+
return null;
|
13529
|
+
}
|
13530
|
+
return {
|
13531
|
+
setter: new ValueSetter(
|
13532
|
+
result.value,
|
13533
|
+
this.validate,
|
13534
|
+
this.set,
|
13535
|
+
this.priority,
|
13536
|
+
this.subPriority
|
13537
|
+
),
|
13538
|
+
rest: result.rest
|
13539
|
+
};
|
13540
|
+
}
|
13541
|
+
validate(_utcDate, _value, _options) {
|
13542
|
+
return true;
|
13543
|
+
}
|
13544
|
+
}
|
13545
|
+
class EraParser extends Parser {
|
13546
|
+
constructor() {
|
13547
|
+
super(...arguments);
|
13548
|
+
__publicField(this, "priority", 140);
|
13549
|
+
__publicField(this, "incompatibleTokens", ["R", "u", "t", "T"]);
|
13550
|
+
}
|
13551
|
+
parse(dateString, token, match2) {
|
13552
|
+
switch (token) {
|
13553
|
+
// AD, BC
|
13554
|
+
case "G":
|
13555
|
+
case "GG":
|
13556
|
+
case "GGG":
|
13557
|
+
return match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
|
13558
|
+
// A, B
|
13559
|
+
case "GGGGG":
|
13560
|
+
return match2.era(dateString, { width: "narrow" });
|
13561
|
+
// Anno Domini, Before Christ
|
13562
|
+
case "GGGG":
|
13563
|
+
default:
|
13564
|
+
return match2.era(dateString, { width: "wide" }) || match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
|
13565
|
+
}
|
13566
|
+
}
|
13567
|
+
set(date2, flags, value) {
|
13568
|
+
flags.era = value;
|
13569
|
+
date2.setFullYear(value, 0, 1);
|
13570
|
+
date2.setHours(0, 0, 0, 0);
|
13571
|
+
return date2;
|
13572
|
+
}
|
13573
|
+
}
|
13574
|
+
const numericPatterns = {
|
13575
|
+
month: /^(1[0-2]|0?\d)/,
|
13576
|
+
// 0 to 12
|
13577
|
+
date: /^(3[0-1]|[0-2]?\d)/,
|
13578
|
+
// 0 to 31
|
13579
|
+
dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
|
13580
|
+
// 0 to 366
|
13581
|
+
week: /^(5[0-3]|[0-4]?\d)/,
|
13582
|
+
// 0 to 53
|
13583
|
+
hour23h: /^(2[0-3]|[0-1]?\d)/,
|
13584
|
+
// 0 to 23
|
13585
|
+
hour24h: /^(2[0-4]|[0-1]?\d)/,
|
13586
|
+
// 0 to 24
|
13587
|
+
hour11h: /^(1[0-1]|0?\d)/,
|
13588
|
+
// 0 to 11
|
13589
|
+
hour12h: /^(1[0-2]|0?\d)/,
|
13590
|
+
// 0 to 12
|
13591
|
+
minute: /^[0-5]?\d/,
|
13592
|
+
// 0 to 59
|
13593
|
+
second: /^[0-5]?\d/,
|
13594
|
+
// 0 to 59
|
13595
|
+
singleDigit: /^\d/,
|
13596
|
+
// 0 to 9
|
13597
|
+
twoDigits: /^\d{1,2}/,
|
13598
|
+
// 0 to 99
|
13599
|
+
threeDigits: /^\d{1,3}/,
|
13600
|
+
// 0 to 999
|
13601
|
+
fourDigits: /^\d{1,4}/,
|
13602
|
+
// 0 to 9999
|
13603
|
+
anyDigitsSigned: /^-?\d+/,
|
13604
|
+
singleDigitSigned: /^-?\d/,
|
13605
|
+
// 0 to 9, -0 to -9
|
13606
|
+
twoDigitsSigned: /^-?\d{1,2}/,
|
13607
|
+
// 0 to 99, -0 to -99
|
13608
|
+
threeDigitsSigned: /^-?\d{1,3}/,
|
13609
|
+
// 0 to 999, -0 to -999
|
13610
|
+
fourDigitsSigned: /^-?\d{1,4}/
|
13611
|
+
// 0 to 9999, -0 to -9999
|
13612
|
+
};
|
13613
|
+
const timezonePatterns = {
|
13614
|
+
basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
13615
|
+
basic: /^([+-])(\d{2})(\d{2})|Z/,
|
13616
|
+
basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
13617
|
+
extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
13618
|
+
extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
|
13619
|
+
};
|
13620
|
+
function mapValue(parseFnResult, mapFn) {
|
13621
|
+
if (!parseFnResult) {
|
13622
|
+
return parseFnResult;
|
13623
|
+
}
|
13624
|
+
return {
|
13625
|
+
value: mapFn(parseFnResult.value),
|
13626
|
+
rest: parseFnResult.rest
|
13627
|
+
};
|
13628
|
+
}
|
13629
|
+
function parseNumericPattern(pattern, dateString) {
|
13630
|
+
const matchResult = dateString.match(pattern);
|
13631
|
+
if (!matchResult) {
|
13632
|
+
return null;
|
13633
|
+
}
|
13634
|
+
return {
|
13635
|
+
value: parseInt(matchResult[0], 10),
|
13636
|
+
rest: dateString.slice(matchResult[0].length)
|
13637
|
+
};
|
13638
|
+
}
|
13639
|
+
function parseTimezonePattern(pattern, dateString) {
|
13640
|
+
const matchResult = dateString.match(pattern);
|
13641
|
+
if (!matchResult) {
|
13642
|
+
return null;
|
13643
|
+
}
|
13644
|
+
if (matchResult[0] === "Z") {
|
13645
|
+
return {
|
13646
|
+
value: 0,
|
13647
|
+
rest: dateString.slice(1)
|
13648
|
+
};
|
13649
|
+
}
|
13650
|
+
const sign2 = matchResult[1] === "+" ? 1 : -1;
|
13651
|
+
const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
|
13652
|
+
const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
|
13653
|
+
const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
|
13654
|
+
return {
|
13655
|
+
value: sign2 * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
|
13656
|
+
rest: dateString.slice(matchResult[0].length)
|
13657
|
+
};
|
13658
|
+
}
|
13659
|
+
function parseAnyDigitsSigned(dateString) {
|
13660
|
+
return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
|
13661
|
+
}
|
13662
|
+
function parseNDigits(n2, dateString) {
|
13663
|
+
switch (n2) {
|
13664
|
+
case 1:
|
13665
|
+
return parseNumericPattern(numericPatterns.singleDigit, dateString);
|
13666
|
+
case 2:
|
13667
|
+
return parseNumericPattern(numericPatterns.twoDigits, dateString);
|
13668
|
+
case 3:
|
13669
|
+
return parseNumericPattern(numericPatterns.threeDigits, dateString);
|
13670
|
+
case 4:
|
13671
|
+
return parseNumericPattern(numericPatterns.fourDigits, dateString);
|
13672
|
+
default:
|
13673
|
+
return parseNumericPattern(new RegExp("^\\d{1," + n2 + "}"), dateString);
|
13674
|
+
}
|
13675
|
+
}
|
13676
|
+
function parseNDigitsSigned(n2, dateString) {
|
13677
|
+
switch (n2) {
|
13678
|
+
case 1:
|
13679
|
+
return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
|
13680
|
+
case 2:
|
13681
|
+
return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
|
13682
|
+
case 3:
|
13683
|
+
return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
|
13684
|
+
case 4:
|
13685
|
+
return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
|
13686
|
+
default:
|
13687
|
+
return parseNumericPattern(new RegExp("^-?\\d{1," + n2 + "}"), dateString);
|
13688
|
+
}
|
13689
|
+
}
|
13690
|
+
function dayPeriodEnumToHours(dayPeriod) {
|
13691
|
+
switch (dayPeriod) {
|
13692
|
+
case "morning":
|
13693
|
+
return 4;
|
13694
|
+
case "evening":
|
13695
|
+
return 17;
|
13696
|
+
case "pm":
|
13697
|
+
case "noon":
|
13698
|
+
case "afternoon":
|
13699
|
+
return 12;
|
13700
|
+
case "am":
|
13701
|
+
case "midnight":
|
13702
|
+
case "night":
|
13703
|
+
default:
|
13704
|
+
return 0;
|
13705
|
+
}
|
13706
|
+
}
|
13707
|
+
function normalizeTwoDigitYear(twoDigitYear, currentYear) {
|
13708
|
+
const isCommonEra = currentYear > 0;
|
13709
|
+
const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
|
13710
|
+
let result;
|
13711
|
+
if (absCurrentYear <= 50) {
|
13712
|
+
result = twoDigitYear || 100;
|
13713
|
+
} else {
|
13714
|
+
const rangeEnd = absCurrentYear + 50;
|
13715
|
+
const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
|
13716
|
+
const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
|
13717
|
+
result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
|
13718
|
+
}
|
13719
|
+
return isCommonEra ? result : 1 - result;
|
13720
|
+
}
|
13721
|
+
function isLeapYearIndex$1(year) {
|
13722
|
+
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
13723
|
+
}
|
13724
|
+
class YearParser extends Parser {
|
13725
|
+
constructor() {
|
13726
|
+
super(...arguments);
|
13727
|
+
__publicField(this, "priority", 130);
|
13728
|
+
__publicField(this, "incompatibleTokens", ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]);
|
13729
|
+
}
|
13730
|
+
parse(dateString, token, match2) {
|
13731
|
+
const valueCallback = (year) => ({
|
13732
|
+
year,
|
13733
|
+
isTwoDigitYear: token === "yy"
|
13734
|
+
});
|
13735
|
+
switch (token) {
|
13736
|
+
case "y":
|
13737
|
+
return mapValue(parseNDigits(4, dateString), valueCallback);
|
13738
|
+
case "yo":
|
13739
|
+
return mapValue(
|
13740
|
+
match2.ordinalNumber(dateString, {
|
13741
|
+
unit: "year"
|
13742
|
+
}),
|
13743
|
+
valueCallback
|
13744
|
+
);
|
13745
|
+
default:
|
13746
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
13747
|
+
}
|
13748
|
+
}
|
13749
|
+
validate(_date, value) {
|
13750
|
+
return value.isTwoDigitYear || value.year > 0;
|
13751
|
+
}
|
13752
|
+
set(date2, flags, value) {
|
13753
|
+
const currentYear = date2.getFullYear();
|
13754
|
+
if (value.isTwoDigitYear) {
|
13755
|
+
const normalizedTwoDigitYear = normalizeTwoDigitYear(
|
13756
|
+
value.year,
|
13757
|
+
currentYear
|
13758
|
+
);
|
13759
|
+
date2.setFullYear(normalizedTwoDigitYear, 0, 1);
|
13760
|
+
date2.setHours(0, 0, 0, 0);
|
13761
|
+
return date2;
|
13762
|
+
}
|
13763
|
+
const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
13764
|
+
date2.setFullYear(year, 0, 1);
|
13765
|
+
date2.setHours(0, 0, 0, 0);
|
13766
|
+
return date2;
|
13767
|
+
}
|
13768
|
+
}
|
13769
|
+
class LocalWeekYearParser extends Parser {
|
13770
|
+
constructor() {
|
13771
|
+
super(...arguments);
|
13772
|
+
__publicField(this, "priority", 130);
|
13773
|
+
__publicField(this, "incompatibleTokens", [
|
13774
|
+
"y",
|
13775
|
+
"R",
|
13776
|
+
"u",
|
13777
|
+
"Q",
|
13778
|
+
"q",
|
13779
|
+
"M",
|
13780
|
+
"L",
|
13781
|
+
"I",
|
13782
|
+
"d",
|
13783
|
+
"D",
|
13784
|
+
"i",
|
13785
|
+
"t",
|
13786
|
+
"T"
|
13787
|
+
]);
|
13788
|
+
}
|
13789
|
+
parse(dateString, token, match2) {
|
13790
|
+
const valueCallback = (year) => ({
|
13791
|
+
year,
|
13792
|
+
isTwoDigitYear: token === "YY"
|
13793
|
+
});
|
13794
|
+
switch (token) {
|
13795
|
+
case "Y":
|
13796
|
+
return mapValue(parseNDigits(4, dateString), valueCallback);
|
13797
|
+
case "Yo":
|
13798
|
+
return mapValue(
|
13799
|
+
match2.ordinalNumber(dateString, {
|
13800
|
+
unit: "year"
|
13801
|
+
}),
|
13802
|
+
valueCallback
|
13803
|
+
);
|
13804
|
+
default:
|
13805
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
13806
|
+
}
|
13807
|
+
}
|
13808
|
+
validate(_date, value) {
|
13809
|
+
return value.isTwoDigitYear || value.year > 0;
|
13810
|
+
}
|
13811
|
+
set(date2, flags, value, options) {
|
13812
|
+
const currentYear = getWeekYear(date2, options);
|
13813
|
+
if (value.isTwoDigitYear) {
|
13814
|
+
const normalizedTwoDigitYear = normalizeTwoDigitYear(
|
13815
|
+
value.year,
|
13816
|
+
currentYear
|
13817
|
+
);
|
13818
|
+
date2.setFullYear(
|
13819
|
+
normalizedTwoDigitYear,
|
13820
|
+
0,
|
13821
|
+
options.firstWeekContainsDate
|
13822
|
+
);
|
13823
|
+
date2.setHours(0, 0, 0, 0);
|
13824
|
+
return startOfWeek(date2, options);
|
13825
|
+
}
|
13826
|
+
const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
13827
|
+
date2.setFullYear(year, 0, options.firstWeekContainsDate);
|
13828
|
+
date2.setHours(0, 0, 0, 0);
|
13829
|
+
return startOfWeek(date2, options);
|
13830
|
+
}
|
13831
|
+
}
|
13832
|
+
class ISOWeekYearParser extends Parser {
|
13833
|
+
constructor() {
|
13834
|
+
super(...arguments);
|
13835
|
+
__publicField(this, "priority", 130);
|
13836
|
+
__publicField(this, "incompatibleTokens", [
|
13837
|
+
"G",
|
13838
|
+
"y",
|
13839
|
+
"Y",
|
13840
|
+
"u",
|
13841
|
+
"Q",
|
13842
|
+
"q",
|
13843
|
+
"M",
|
13844
|
+
"L",
|
13845
|
+
"w",
|
13846
|
+
"d",
|
13847
|
+
"D",
|
13848
|
+
"e",
|
13849
|
+
"c",
|
13850
|
+
"t",
|
13851
|
+
"T"
|
13852
|
+
]);
|
13853
|
+
}
|
13854
|
+
parse(dateString, token) {
|
13855
|
+
if (token === "R") {
|
13856
|
+
return parseNDigitsSigned(4, dateString);
|
13857
|
+
}
|
13858
|
+
return parseNDigitsSigned(token.length, dateString);
|
13859
|
+
}
|
13860
|
+
set(date2, _flags, value) {
|
13861
|
+
const firstWeekOfYear = constructFrom(date2, 0);
|
13862
|
+
firstWeekOfYear.setFullYear(value, 0, 4);
|
13863
|
+
firstWeekOfYear.setHours(0, 0, 0, 0);
|
13864
|
+
return startOfISOWeek(firstWeekOfYear);
|
13865
|
+
}
|
13866
|
+
}
|
13867
|
+
class ExtendedYearParser extends Parser {
|
13868
|
+
constructor() {
|
13869
|
+
super(...arguments);
|
13870
|
+
__publicField(this, "priority", 130);
|
13871
|
+
__publicField(this, "incompatibleTokens", ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]);
|
13872
|
+
}
|
13873
|
+
parse(dateString, token) {
|
13874
|
+
if (token === "u") {
|
13875
|
+
return parseNDigitsSigned(4, dateString);
|
13876
|
+
}
|
13877
|
+
return parseNDigitsSigned(token.length, dateString);
|
13878
|
+
}
|
13879
|
+
set(date2, _flags, value) {
|
13880
|
+
date2.setFullYear(value, 0, 1);
|
13881
|
+
date2.setHours(0, 0, 0, 0);
|
13882
|
+
return date2;
|
13883
|
+
}
|
13884
|
+
}
|
13885
|
+
class QuarterParser extends Parser {
|
13886
|
+
constructor() {
|
13887
|
+
super(...arguments);
|
13888
|
+
__publicField(this, "priority", 120);
|
13889
|
+
__publicField(this, "incompatibleTokens", [
|
13890
|
+
"Y",
|
13891
|
+
"R",
|
13892
|
+
"q",
|
13893
|
+
"M",
|
13894
|
+
"L",
|
13895
|
+
"w",
|
13896
|
+
"I",
|
13897
|
+
"d",
|
13898
|
+
"D",
|
13899
|
+
"i",
|
13900
|
+
"e",
|
13901
|
+
"c",
|
13902
|
+
"t",
|
13903
|
+
"T"
|
13904
|
+
]);
|
13905
|
+
}
|
13906
|
+
parse(dateString, token, match2) {
|
13907
|
+
switch (token) {
|
13908
|
+
// 1, 2, 3, 4
|
13909
|
+
case "Q":
|
13910
|
+
case "QQ":
|
13911
|
+
return parseNDigits(token.length, dateString);
|
13912
|
+
// 1st, 2nd, 3rd, 4th
|
13913
|
+
case "Qo":
|
13914
|
+
return match2.ordinalNumber(dateString, { unit: "quarter" });
|
13915
|
+
// Q1, Q2, Q3, Q4
|
13916
|
+
case "QQQ":
|
13917
|
+
return match2.quarter(dateString, {
|
13918
|
+
width: "abbreviated",
|
13919
|
+
context: "formatting"
|
13920
|
+
}) || match2.quarter(dateString, {
|
13921
|
+
width: "narrow",
|
13922
|
+
context: "formatting"
|
13923
|
+
});
|
13924
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
13925
|
+
case "QQQQQ":
|
13926
|
+
return match2.quarter(dateString, {
|
13927
|
+
width: "narrow",
|
13928
|
+
context: "formatting"
|
13929
|
+
});
|
13930
|
+
// 1st quarter, 2nd quarter, ...
|
13931
|
+
case "QQQQ":
|
13932
|
+
default:
|
13933
|
+
return match2.quarter(dateString, {
|
13934
|
+
width: "wide",
|
13935
|
+
context: "formatting"
|
13936
|
+
}) || match2.quarter(dateString, {
|
13937
|
+
width: "abbreviated",
|
13938
|
+
context: "formatting"
|
13939
|
+
}) || match2.quarter(dateString, {
|
13940
|
+
width: "narrow",
|
13941
|
+
context: "formatting"
|
13942
|
+
});
|
13943
|
+
}
|
13944
|
+
}
|
13945
|
+
validate(_date, value) {
|
13946
|
+
return value >= 1 && value <= 4;
|
13947
|
+
}
|
13948
|
+
set(date2, _flags, value) {
|
13949
|
+
date2.setMonth((value - 1) * 3, 1);
|
13950
|
+
date2.setHours(0, 0, 0, 0);
|
13951
|
+
return date2;
|
13952
|
+
}
|
13953
|
+
}
|
13954
|
+
class StandAloneQuarterParser extends Parser {
|
13955
|
+
constructor() {
|
13956
|
+
super(...arguments);
|
13957
|
+
__publicField(this, "priority", 120);
|
13958
|
+
__publicField(this, "incompatibleTokens", [
|
13959
|
+
"Y",
|
13960
|
+
"R",
|
13961
|
+
"Q",
|
13962
|
+
"M",
|
13963
|
+
"L",
|
13964
|
+
"w",
|
13965
|
+
"I",
|
13966
|
+
"d",
|
13967
|
+
"D",
|
13968
|
+
"i",
|
13969
|
+
"e",
|
13970
|
+
"c",
|
13971
|
+
"t",
|
13972
|
+
"T"
|
13973
|
+
]);
|
13974
|
+
}
|
13975
|
+
parse(dateString, token, match2) {
|
13976
|
+
switch (token) {
|
13977
|
+
// 1, 2, 3, 4
|
13978
|
+
case "q":
|
13979
|
+
case "qq":
|
13980
|
+
return parseNDigits(token.length, dateString);
|
13981
|
+
// 1st, 2nd, 3rd, 4th
|
13982
|
+
case "qo":
|
13983
|
+
return match2.ordinalNumber(dateString, { unit: "quarter" });
|
13984
|
+
// Q1, Q2, Q3, Q4
|
13985
|
+
case "qqq":
|
13986
|
+
return match2.quarter(dateString, {
|
13987
|
+
width: "abbreviated",
|
13988
|
+
context: "standalone"
|
13989
|
+
}) || match2.quarter(dateString, {
|
13990
|
+
width: "narrow",
|
13991
|
+
context: "standalone"
|
13992
|
+
});
|
13993
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
13994
|
+
case "qqqqq":
|
13995
|
+
return match2.quarter(dateString, {
|
13996
|
+
width: "narrow",
|
13997
|
+
context: "standalone"
|
13998
|
+
});
|
13999
|
+
// 1st quarter, 2nd quarter, ...
|
14000
|
+
case "qqqq":
|
14001
|
+
default:
|
14002
|
+
return match2.quarter(dateString, {
|
14003
|
+
width: "wide",
|
14004
|
+
context: "standalone"
|
14005
|
+
}) || match2.quarter(dateString, {
|
14006
|
+
width: "abbreviated",
|
14007
|
+
context: "standalone"
|
14008
|
+
}) || match2.quarter(dateString, {
|
14009
|
+
width: "narrow",
|
14010
|
+
context: "standalone"
|
14011
|
+
});
|
14012
|
+
}
|
14013
|
+
}
|
14014
|
+
validate(_date, value) {
|
14015
|
+
return value >= 1 && value <= 4;
|
14016
|
+
}
|
14017
|
+
set(date2, _flags, value) {
|
14018
|
+
date2.setMonth((value - 1) * 3, 1);
|
14019
|
+
date2.setHours(0, 0, 0, 0);
|
14020
|
+
return date2;
|
14021
|
+
}
|
14022
|
+
}
|
14023
|
+
class MonthParser extends Parser {
|
14024
|
+
constructor() {
|
14025
|
+
super(...arguments);
|
14026
|
+
__publicField(this, "incompatibleTokens", [
|
14027
|
+
"Y",
|
14028
|
+
"R",
|
14029
|
+
"q",
|
14030
|
+
"Q",
|
14031
|
+
"L",
|
14032
|
+
"w",
|
14033
|
+
"I",
|
14034
|
+
"D",
|
14035
|
+
"i",
|
14036
|
+
"e",
|
14037
|
+
"c",
|
14038
|
+
"t",
|
14039
|
+
"T"
|
14040
|
+
]);
|
14041
|
+
__publicField(this, "priority", 110);
|
14042
|
+
}
|
14043
|
+
parse(dateString, token, match2) {
|
14044
|
+
const valueCallback = (value) => value - 1;
|
14045
|
+
switch (token) {
|
14046
|
+
// 1, 2, ..., 12
|
14047
|
+
case "M":
|
14048
|
+
return mapValue(
|
14049
|
+
parseNumericPattern(numericPatterns.month, dateString),
|
14050
|
+
valueCallback
|
14051
|
+
);
|
14052
|
+
// 01, 02, ..., 12
|
14053
|
+
case "MM":
|
14054
|
+
return mapValue(parseNDigits(2, dateString), valueCallback);
|
14055
|
+
// 1st, 2nd, ..., 12th
|
14056
|
+
case "Mo":
|
14057
|
+
return mapValue(
|
14058
|
+
match2.ordinalNumber(dateString, {
|
14059
|
+
unit: "month"
|
14060
|
+
}),
|
14061
|
+
valueCallback
|
14062
|
+
);
|
14063
|
+
// Jan, Feb, ..., Dec
|
14064
|
+
case "MMM":
|
14065
|
+
return match2.month(dateString, {
|
14066
|
+
width: "abbreviated",
|
14067
|
+
context: "formatting"
|
14068
|
+
}) || match2.month(dateString, { width: "narrow", context: "formatting" });
|
14069
|
+
// J, F, ..., D
|
14070
|
+
case "MMMMM":
|
14071
|
+
return match2.month(dateString, {
|
14072
|
+
width: "narrow",
|
14073
|
+
context: "formatting"
|
14074
|
+
});
|
14075
|
+
// January, February, ..., December
|
14076
|
+
case "MMMM":
|
14077
|
+
default:
|
14078
|
+
return match2.month(dateString, { width: "wide", context: "formatting" }) || match2.month(dateString, {
|
14079
|
+
width: "abbreviated",
|
14080
|
+
context: "formatting"
|
14081
|
+
}) || match2.month(dateString, { width: "narrow", context: "formatting" });
|
14082
|
+
}
|
14083
|
+
}
|
14084
|
+
validate(_date, value) {
|
14085
|
+
return value >= 0 && value <= 11;
|
14086
|
+
}
|
14087
|
+
set(date2, _flags, value) {
|
14088
|
+
date2.setMonth(value, 1);
|
14089
|
+
date2.setHours(0, 0, 0, 0);
|
14090
|
+
return date2;
|
14091
|
+
}
|
14092
|
+
}
|
14093
|
+
class StandAloneMonthParser extends Parser {
|
14094
|
+
constructor() {
|
14095
|
+
super(...arguments);
|
14096
|
+
__publicField(this, "priority", 110);
|
14097
|
+
__publicField(this, "incompatibleTokens", [
|
14098
|
+
"Y",
|
14099
|
+
"R",
|
14100
|
+
"q",
|
14101
|
+
"Q",
|
14102
|
+
"M",
|
14103
|
+
"w",
|
14104
|
+
"I",
|
14105
|
+
"D",
|
14106
|
+
"i",
|
14107
|
+
"e",
|
14108
|
+
"c",
|
14109
|
+
"t",
|
14110
|
+
"T"
|
14111
|
+
]);
|
14112
|
+
}
|
14113
|
+
parse(dateString, token, match2) {
|
14114
|
+
const valueCallback = (value) => value - 1;
|
14115
|
+
switch (token) {
|
14116
|
+
// 1, 2, ..., 12
|
14117
|
+
case "L":
|
14118
|
+
return mapValue(
|
14119
|
+
parseNumericPattern(numericPatterns.month, dateString),
|
14120
|
+
valueCallback
|
14121
|
+
);
|
14122
|
+
// 01, 02, ..., 12
|
14123
|
+
case "LL":
|
14124
|
+
return mapValue(parseNDigits(2, dateString), valueCallback);
|
14125
|
+
// 1st, 2nd, ..., 12th
|
14126
|
+
case "Lo":
|
14127
|
+
return mapValue(
|
14128
|
+
match2.ordinalNumber(dateString, {
|
14129
|
+
unit: "month"
|
14130
|
+
}),
|
14131
|
+
valueCallback
|
14132
|
+
);
|
14133
|
+
// Jan, Feb, ..., Dec
|
14134
|
+
case "LLL":
|
14135
|
+
return match2.month(dateString, {
|
14136
|
+
width: "abbreviated",
|
14137
|
+
context: "standalone"
|
14138
|
+
}) || match2.month(dateString, { width: "narrow", context: "standalone" });
|
14139
|
+
// J, F, ..., D
|
14140
|
+
case "LLLLL":
|
14141
|
+
return match2.month(dateString, {
|
14142
|
+
width: "narrow",
|
14143
|
+
context: "standalone"
|
14144
|
+
});
|
14145
|
+
// January, February, ..., December
|
14146
|
+
case "LLLL":
|
14147
|
+
default:
|
14148
|
+
return match2.month(dateString, { width: "wide", context: "standalone" }) || match2.month(dateString, {
|
14149
|
+
width: "abbreviated",
|
14150
|
+
context: "standalone"
|
14151
|
+
}) || match2.month(dateString, { width: "narrow", context: "standalone" });
|
14152
|
+
}
|
14153
|
+
}
|
14154
|
+
validate(_date, value) {
|
14155
|
+
return value >= 0 && value <= 11;
|
14156
|
+
}
|
14157
|
+
set(date2, _flags, value) {
|
14158
|
+
date2.setMonth(value, 1);
|
14159
|
+
date2.setHours(0, 0, 0, 0);
|
14160
|
+
return date2;
|
14161
|
+
}
|
14162
|
+
}
|
14163
|
+
function setWeek(date2, week, options) {
|
14164
|
+
const _date = toDate(date2);
|
14165
|
+
const diff = getWeek(_date, options) - week;
|
14166
|
+
_date.setDate(_date.getDate() - diff * 7);
|
14167
|
+
return _date;
|
14168
|
+
}
|
14169
|
+
class LocalWeekParser extends Parser {
|
14170
|
+
constructor() {
|
14171
|
+
super(...arguments);
|
14172
|
+
__publicField(this, "priority", 100);
|
14173
|
+
__publicField(this, "incompatibleTokens", [
|
14174
|
+
"y",
|
14175
|
+
"R",
|
14176
|
+
"u",
|
14177
|
+
"q",
|
14178
|
+
"Q",
|
14179
|
+
"M",
|
14180
|
+
"L",
|
14181
|
+
"I",
|
14182
|
+
"d",
|
14183
|
+
"D",
|
14184
|
+
"i",
|
14185
|
+
"t",
|
14186
|
+
"T"
|
14187
|
+
]);
|
14188
|
+
}
|
14189
|
+
parse(dateString, token, match2) {
|
14190
|
+
switch (token) {
|
14191
|
+
case "w":
|
14192
|
+
return parseNumericPattern(numericPatterns.week, dateString);
|
14193
|
+
case "wo":
|
14194
|
+
return match2.ordinalNumber(dateString, { unit: "week" });
|
14195
|
+
default:
|
14196
|
+
return parseNDigits(token.length, dateString);
|
14197
|
+
}
|
14198
|
+
}
|
14199
|
+
validate(_date, value) {
|
14200
|
+
return value >= 1 && value <= 53;
|
14201
|
+
}
|
14202
|
+
set(date2, _flags, value, options) {
|
14203
|
+
return startOfWeek(setWeek(date2, value, options), options);
|
14204
|
+
}
|
14205
|
+
}
|
14206
|
+
function setISOWeek(date2, week) {
|
14207
|
+
const _date = toDate(date2);
|
14208
|
+
const diff = getISOWeek(_date) - week;
|
14209
|
+
_date.setDate(_date.getDate() - diff * 7);
|
14210
|
+
return _date;
|
14211
|
+
}
|
14212
|
+
class ISOWeekParser extends Parser {
|
14213
|
+
constructor() {
|
14214
|
+
super(...arguments);
|
14215
|
+
__publicField(this, "priority", 100);
|
14216
|
+
__publicField(this, "incompatibleTokens", [
|
14217
|
+
"y",
|
14218
|
+
"Y",
|
14219
|
+
"u",
|
14220
|
+
"q",
|
14221
|
+
"Q",
|
14222
|
+
"M",
|
14223
|
+
"L",
|
14224
|
+
"w",
|
14225
|
+
"d",
|
14226
|
+
"D",
|
14227
|
+
"e",
|
14228
|
+
"c",
|
14229
|
+
"t",
|
14230
|
+
"T"
|
14231
|
+
]);
|
14232
|
+
}
|
14233
|
+
parse(dateString, token, match2) {
|
14234
|
+
switch (token) {
|
14235
|
+
case "I":
|
14236
|
+
return parseNumericPattern(numericPatterns.week, dateString);
|
14237
|
+
case "Io":
|
14238
|
+
return match2.ordinalNumber(dateString, { unit: "week" });
|
14239
|
+
default:
|
14240
|
+
return parseNDigits(token.length, dateString);
|
14241
|
+
}
|
14242
|
+
}
|
14243
|
+
validate(_date, value) {
|
14244
|
+
return value >= 1 && value <= 53;
|
14245
|
+
}
|
14246
|
+
set(date2, _flags, value) {
|
14247
|
+
return startOfISOWeek(setISOWeek(date2, value));
|
14248
|
+
}
|
14249
|
+
}
|
14250
|
+
const DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
14251
|
+
const DAYS_IN_MONTH_LEAP_YEAR = [
|
14252
|
+
31,
|
14253
|
+
29,
|
14254
|
+
31,
|
14255
|
+
30,
|
14256
|
+
31,
|
14257
|
+
30,
|
14258
|
+
31,
|
14259
|
+
31,
|
14260
|
+
30,
|
14261
|
+
31,
|
14262
|
+
30,
|
14263
|
+
31
|
14264
|
+
];
|
14265
|
+
class DateParser extends Parser {
|
14266
|
+
constructor() {
|
14267
|
+
super(...arguments);
|
14268
|
+
__publicField(this, "priority", 90);
|
14269
|
+
__publicField(this, "subPriority", 1);
|
14270
|
+
__publicField(this, "incompatibleTokens", [
|
14271
|
+
"Y",
|
14272
|
+
"R",
|
14273
|
+
"q",
|
14274
|
+
"Q",
|
14275
|
+
"w",
|
14276
|
+
"I",
|
14277
|
+
"D",
|
14278
|
+
"i",
|
14279
|
+
"e",
|
14280
|
+
"c",
|
14281
|
+
"t",
|
14282
|
+
"T"
|
14283
|
+
]);
|
14284
|
+
}
|
14285
|
+
parse(dateString, token, match2) {
|
14286
|
+
switch (token) {
|
14287
|
+
case "d":
|
14288
|
+
return parseNumericPattern(numericPatterns.date, dateString);
|
14289
|
+
case "do":
|
14290
|
+
return match2.ordinalNumber(dateString, { unit: "date" });
|
14291
|
+
default:
|
14292
|
+
return parseNDigits(token.length, dateString);
|
14293
|
+
}
|
14294
|
+
}
|
14295
|
+
validate(date2, value) {
|
14296
|
+
const year = date2.getFullYear();
|
14297
|
+
const isLeapYear = isLeapYearIndex$1(year);
|
14298
|
+
const month = date2.getMonth();
|
14299
|
+
if (isLeapYear) {
|
14300
|
+
return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
|
14301
|
+
} else {
|
14302
|
+
return value >= 1 && value <= DAYS_IN_MONTH[month];
|
14303
|
+
}
|
14304
|
+
}
|
14305
|
+
set(date2, _flags, value) {
|
14306
|
+
date2.setDate(value);
|
14307
|
+
date2.setHours(0, 0, 0, 0);
|
14308
|
+
return date2;
|
14309
|
+
}
|
14310
|
+
}
|
14311
|
+
class DayOfYearParser extends Parser {
|
14312
|
+
constructor() {
|
14313
|
+
super(...arguments);
|
14314
|
+
__publicField(this, "priority", 90);
|
14315
|
+
__publicField(this, "subpriority", 1);
|
14316
|
+
__publicField(this, "incompatibleTokens", [
|
14317
|
+
"Y",
|
14318
|
+
"R",
|
14319
|
+
"q",
|
14320
|
+
"Q",
|
14321
|
+
"M",
|
14322
|
+
"L",
|
14323
|
+
"w",
|
14324
|
+
"I",
|
14325
|
+
"d",
|
14326
|
+
"E",
|
14327
|
+
"i",
|
14328
|
+
"e",
|
14329
|
+
"c",
|
14330
|
+
"t",
|
14331
|
+
"T"
|
14332
|
+
]);
|
14333
|
+
}
|
14334
|
+
parse(dateString, token, match2) {
|
14335
|
+
switch (token) {
|
14336
|
+
case "D":
|
14337
|
+
case "DD":
|
14338
|
+
return parseNumericPattern(numericPatterns.dayOfYear, dateString);
|
14339
|
+
case "Do":
|
14340
|
+
return match2.ordinalNumber(dateString, { unit: "date" });
|
14341
|
+
default:
|
14342
|
+
return parseNDigits(token.length, dateString);
|
14343
|
+
}
|
14344
|
+
}
|
14345
|
+
validate(date2, value) {
|
14346
|
+
const year = date2.getFullYear();
|
14347
|
+
const isLeapYear = isLeapYearIndex$1(year);
|
14348
|
+
if (isLeapYear) {
|
14349
|
+
return value >= 1 && value <= 366;
|
14350
|
+
} else {
|
14351
|
+
return value >= 1 && value <= 365;
|
14352
|
+
}
|
14353
|
+
}
|
14354
|
+
set(date2, _flags, value) {
|
14355
|
+
date2.setMonth(0, value);
|
14356
|
+
date2.setHours(0, 0, 0, 0);
|
14357
|
+
return date2;
|
14358
|
+
}
|
14359
|
+
}
|
14360
|
+
function setDay(date2, day, options) {
|
14361
|
+
var _a, _b, _c, _d;
|
14362
|
+
const defaultOptions2 = getDefaultOptions$1();
|
14363
|
+
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
14364
|
+
const _date = toDate(date2);
|
14365
|
+
const currentDay = _date.getDay();
|
14366
|
+
const remainder = day % 7;
|
14367
|
+
const dayIndex = (remainder + 7) % 7;
|
14368
|
+
const delta = 7 - weekStartsOn;
|
14369
|
+
const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;
|
14370
|
+
return addDays(_date, diff);
|
14371
|
+
}
|
14372
|
+
class DayParser extends Parser {
|
14373
|
+
constructor() {
|
14374
|
+
super(...arguments);
|
14375
|
+
__publicField(this, "priority", 90);
|
14376
|
+
__publicField(this, "incompatibleTokens", ["D", "i", "e", "c", "t", "T"]);
|
14377
|
+
}
|
14378
|
+
parse(dateString, token, match2) {
|
14379
|
+
switch (token) {
|
14380
|
+
// Tue
|
14381
|
+
case "E":
|
14382
|
+
case "EE":
|
14383
|
+
case "EEE":
|
14384
|
+
return match2.day(dateString, {
|
14385
|
+
width: "abbreviated",
|
14386
|
+
context: "formatting"
|
14387
|
+
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14388
|
+
// T
|
14389
|
+
case "EEEEE":
|
14390
|
+
return match2.day(dateString, {
|
14391
|
+
width: "narrow",
|
14392
|
+
context: "formatting"
|
14393
|
+
});
|
14394
|
+
// Tu
|
14395
|
+
case "EEEEEE":
|
14396
|
+
return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14397
|
+
// Tuesday
|
14398
|
+
case "EEEE":
|
14399
|
+
default:
|
14400
|
+
return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
|
14401
|
+
width: "abbreviated",
|
14402
|
+
context: "formatting"
|
14403
|
+
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14404
|
+
}
|
14405
|
+
}
|
14406
|
+
validate(_date, value) {
|
14407
|
+
return value >= 0 && value <= 6;
|
14408
|
+
}
|
14409
|
+
set(date2, _flags, value, options) {
|
14410
|
+
date2 = setDay(date2, value, options);
|
14411
|
+
date2.setHours(0, 0, 0, 0);
|
14412
|
+
return date2;
|
14413
|
+
}
|
14414
|
+
}
|
14415
|
+
class LocalDayParser extends Parser {
|
14416
|
+
constructor() {
|
14417
|
+
super(...arguments);
|
14418
|
+
__publicField(this, "priority", 90);
|
14419
|
+
__publicField(this, "incompatibleTokens", [
|
14420
|
+
"y",
|
14421
|
+
"R",
|
14422
|
+
"u",
|
14423
|
+
"q",
|
14424
|
+
"Q",
|
14425
|
+
"M",
|
14426
|
+
"L",
|
14427
|
+
"I",
|
14428
|
+
"d",
|
14429
|
+
"D",
|
14430
|
+
"E",
|
14431
|
+
"i",
|
14432
|
+
"c",
|
14433
|
+
"t",
|
14434
|
+
"T"
|
14435
|
+
]);
|
14436
|
+
}
|
14437
|
+
parse(dateString, token, match2, options) {
|
14438
|
+
const valueCallback = (value) => {
|
14439
|
+
const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
|
14440
|
+
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
|
14441
|
+
};
|
14442
|
+
switch (token) {
|
14443
|
+
// 3
|
14444
|
+
case "e":
|
14445
|
+
case "ee":
|
14446
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
14447
|
+
// 3rd
|
14448
|
+
case "eo":
|
14449
|
+
return mapValue(
|
14450
|
+
match2.ordinalNumber(dateString, {
|
14451
|
+
unit: "day"
|
14452
|
+
}),
|
14453
|
+
valueCallback
|
14454
|
+
);
|
14455
|
+
// Tue
|
14456
|
+
case "eee":
|
14457
|
+
return match2.day(dateString, {
|
14458
|
+
width: "abbreviated",
|
14459
|
+
context: "formatting"
|
14460
|
+
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14461
|
+
// T
|
14462
|
+
case "eeeee":
|
14463
|
+
return match2.day(dateString, {
|
14464
|
+
width: "narrow",
|
14465
|
+
context: "formatting"
|
14466
|
+
});
|
14467
|
+
// Tu
|
14468
|
+
case "eeeeee":
|
14469
|
+
return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14470
|
+
// Tuesday
|
14471
|
+
case "eeee":
|
14472
|
+
default:
|
14473
|
+
return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
|
14474
|
+
width: "abbreviated",
|
14475
|
+
context: "formatting"
|
14476
|
+
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14477
|
+
}
|
14478
|
+
}
|
14479
|
+
validate(_date, value) {
|
14480
|
+
return value >= 0 && value <= 6;
|
14481
|
+
}
|
14482
|
+
set(date2, _flags, value, options) {
|
14483
|
+
date2 = setDay(date2, value, options);
|
14484
|
+
date2.setHours(0, 0, 0, 0);
|
14485
|
+
return date2;
|
14486
|
+
}
|
14487
|
+
}
|
14488
|
+
class StandAloneLocalDayParser extends Parser {
|
14489
|
+
constructor() {
|
14490
|
+
super(...arguments);
|
14491
|
+
__publicField(this, "priority", 90);
|
14492
|
+
__publicField(this, "incompatibleTokens", [
|
14493
|
+
"y",
|
14494
|
+
"R",
|
14495
|
+
"u",
|
14496
|
+
"q",
|
14497
|
+
"Q",
|
14498
|
+
"M",
|
14499
|
+
"L",
|
14500
|
+
"I",
|
14501
|
+
"d",
|
14502
|
+
"D",
|
14503
|
+
"E",
|
14504
|
+
"i",
|
14505
|
+
"e",
|
14506
|
+
"t",
|
14507
|
+
"T"
|
14508
|
+
]);
|
14509
|
+
}
|
14510
|
+
parse(dateString, token, match2, options) {
|
14511
|
+
const valueCallback = (value) => {
|
14512
|
+
const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
|
14513
|
+
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
|
14514
|
+
};
|
14515
|
+
switch (token) {
|
14516
|
+
// 3
|
14517
|
+
case "c":
|
14518
|
+
case "cc":
|
14519
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
14520
|
+
// 3rd
|
14521
|
+
case "co":
|
14522
|
+
return mapValue(
|
14523
|
+
match2.ordinalNumber(dateString, {
|
14524
|
+
unit: "day"
|
14525
|
+
}),
|
14526
|
+
valueCallback
|
14527
|
+
);
|
14528
|
+
// Tue
|
14529
|
+
case "ccc":
|
14530
|
+
return match2.day(dateString, {
|
14531
|
+
width: "abbreviated",
|
14532
|
+
context: "standalone"
|
14533
|
+
}) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
|
14534
|
+
// T
|
14535
|
+
case "ccccc":
|
14536
|
+
return match2.day(dateString, {
|
14537
|
+
width: "narrow",
|
14538
|
+
context: "standalone"
|
14539
|
+
});
|
14540
|
+
// Tu
|
14541
|
+
case "cccccc":
|
14542
|
+
return match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
|
14543
|
+
// Tuesday
|
14544
|
+
case "cccc":
|
14545
|
+
default:
|
14546
|
+
return match2.day(dateString, { width: "wide", context: "standalone" }) || match2.day(dateString, {
|
14547
|
+
width: "abbreviated",
|
14548
|
+
context: "standalone"
|
14549
|
+
}) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
|
14550
|
+
}
|
14551
|
+
}
|
14552
|
+
validate(_date, value) {
|
14553
|
+
return value >= 0 && value <= 6;
|
14554
|
+
}
|
14555
|
+
set(date2, _flags, value, options) {
|
14556
|
+
date2 = setDay(date2, value, options);
|
14557
|
+
date2.setHours(0, 0, 0, 0);
|
14558
|
+
return date2;
|
14559
|
+
}
|
14560
|
+
}
|
14561
|
+
function setISODay(date2, day) {
|
14562
|
+
const _date = toDate(date2);
|
14563
|
+
const currentDay = getISODay(_date);
|
14564
|
+
const diff = day - currentDay;
|
14565
|
+
return addDays(_date, diff);
|
14566
|
+
}
|
14567
|
+
class ISODayParser extends Parser {
|
14568
|
+
constructor() {
|
14569
|
+
super(...arguments);
|
14570
|
+
__publicField(this, "priority", 90);
|
14571
|
+
__publicField(this, "incompatibleTokens", [
|
14572
|
+
"y",
|
14573
|
+
"Y",
|
14574
|
+
"u",
|
14575
|
+
"q",
|
14576
|
+
"Q",
|
14577
|
+
"M",
|
14578
|
+
"L",
|
14579
|
+
"w",
|
14580
|
+
"d",
|
14581
|
+
"D",
|
14582
|
+
"E",
|
14583
|
+
"e",
|
14584
|
+
"c",
|
14585
|
+
"t",
|
14586
|
+
"T"
|
14587
|
+
]);
|
14588
|
+
}
|
14589
|
+
parse(dateString, token, match2) {
|
14590
|
+
const valueCallback = (value) => {
|
14591
|
+
if (value === 0) {
|
14592
|
+
return 7;
|
14593
|
+
}
|
14594
|
+
return value;
|
14595
|
+
};
|
14596
|
+
switch (token) {
|
14597
|
+
// 2
|
14598
|
+
case "i":
|
14599
|
+
case "ii":
|
14600
|
+
return parseNDigits(token.length, dateString);
|
14601
|
+
// 2nd
|
14602
|
+
case "io":
|
14603
|
+
return match2.ordinalNumber(dateString, { unit: "day" });
|
14604
|
+
// Tue
|
14605
|
+
case "iii":
|
14606
|
+
return mapValue(
|
14607
|
+
match2.day(dateString, {
|
14608
|
+
width: "abbreviated",
|
14609
|
+
context: "formatting"
|
14610
|
+
}) || match2.day(dateString, {
|
14611
|
+
width: "short",
|
14612
|
+
context: "formatting"
|
14613
|
+
}) || match2.day(dateString, {
|
14614
|
+
width: "narrow",
|
14615
|
+
context: "formatting"
|
14616
|
+
}),
|
14617
|
+
valueCallback
|
14618
|
+
);
|
14619
|
+
// T
|
14620
|
+
case "iiiii":
|
14621
|
+
return mapValue(
|
14622
|
+
match2.day(dateString, {
|
14623
|
+
width: "narrow",
|
14624
|
+
context: "formatting"
|
14625
|
+
}),
|
14626
|
+
valueCallback
|
14627
|
+
);
|
14628
|
+
// Tu
|
14629
|
+
case "iiiiii":
|
14630
|
+
return mapValue(
|
14631
|
+
match2.day(dateString, {
|
14632
|
+
width: "short",
|
14633
|
+
context: "formatting"
|
14634
|
+
}) || match2.day(dateString, {
|
14635
|
+
width: "narrow",
|
14636
|
+
context: "formatting"
|
14637
|
+
}),
|
14638
|
+
valueCallback
|
14639
|
+
);
|
14640
|
+
// Tuesday
|
14641
|
+
case "iiii":
|
14642
|
+
default:
|
14643
|
+
return mapValue(
|
14644
|
+
match2.day(dateString, {
|
14645
|
+
width: "wide",
|
14646
|
+
context: "formatting"
|
14647
|
+
}) || match2.day(dateString, {
|
14648
|
+
width: "abbreviated",
|
14649
|
+
context: "formatting"
|
14650
|
+
}) || match2.day(dateString, {
|
14651
|
+
width: "short",
|
14652
|
+
context: "formatting"
|
14653
|
+
}) || match2.day(dateString, {
|
14654
|
+
width: "narrow",
|
14655
|
+
context: "formatting"
|
14656
|
+
}),
|
14657
|
+
valueCallback
|
14658
|
+
);
|
14659
|
+
}
|
14660
|
+
}
|
14661
|
+
validate(_date, value) {
|
14662
|
+
return value >= 1 && value <= 7;
|
14663
|
+
}
|
14664
|
+
set(date2, _flags, value) {
|
14665
|
+
date2 = setISODay(date2, value);
|
14666
|
+
date2.setHours(0, 0, 0, 0);
|
14667
|
+
return date2;
|
14668
|
+
}
|
14669
|
+
}
|
14670
|
+
class AMPMParser extends Parser {
|
14671
|
+
constructor() {
|
14672
|
+
super(...arguments);
|
14673
|
+
__publicField(this, "priority", 80);
|
14674
|
+
__publicField(this, "incompatibleTokens", ["b", "B", "H", "k", "t", "T"]);
|
14675
|
+
}
|
14676
|
+
parse(dateString, token, match2) {
|
14677
|
+
switch (token) {
|
14678
|
+
case "a":
|
14679
|
+
case "aa":
|
14680
|
+
case "aaa":
|
14681
|
+
return match2.dayPeriod(dateString, {
|
14682
|
+
width: "abbreviated",
|
14683
|
+
context: "formatting"
|
14684
|
+
}) || match2.dayPeriod(dateString, {
|
14685
|
+
width: "narrow",
|
14686
|
+
context: "formatting"
|
14687
|
+
});
|
14688
|
+
case "aaaaa":
|
14689
|
+
return match2.dayPeriod(dateString, {
|
14690
|
+
width: "narrow",
|
14691
|
+
context: "formatting"
|
14692
|
+
});
|
14693
|
+
case "aaaa":
|
14694
|
+
default:
|
14695
|
+
return match2.dayPeriod(dateString, {
|
14696
|
+
width: "wide",
|
14697
|
+
context: "formatting"
|
14698
|
+
}) || match2.dayPeriod(dateString, {
|
14699
|
+
width: "abbreviated",
|
14700
|
+
context: "formatting"
|
14701
|
+
}) || match2.dayPeriod(dateString, {
|
14702
|
+
width: "narrow",
|
14703
|
+
context: "formatting"
|
14704
|
+
});
|
14705
|
+
}
|
14706
|
+
}
|
14707
|
+
set(date2, _flags, value) {
|
14708
|
+
date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
14709
|
+
return date2;
|
14710
|
+
}
|
14711
|
+
}
|
14712
|
+
class AMPMMidnightParser extends Parser {
|
14713
|
+
constructor() {
|
14714
|
+
super(...arguments);
|
14715
|
+
__publicField(this, "priority", 80);
|
14716
|
+
__publicField(this, "incompatibleTokens", ["a", "B", "H", "k", "t", "T"]);
|
14717
|
+
}
|
14718
|
+
parse(dateString, token, match2) {
|
14719
|
+
switch (token) {
|
14720
|
+
case "b":
|
14721
|
+
case "bb":
|
14722
|
+
case "bbb":
|
14723
|
+
return match2.dayPeriod(dateString, {
|
14724
|
+
width: "abbreviated",
|
14725
|
+
context: "formatting"
|
14726
|
+
}) || match2.dayPeriod(dateString, {
|
14727
|
+
width: "narrow",
|
14728
|
+
context: "formatting"
|
14729
|
+
});
|
14730
|
+
case "bbbbb":
|
14731
|
+
return match2.dayPeriod(dateString, {
|
14732
|
+
width: "narrow",
|
14733
|
+
context: "formatting"
|
14734
|
+
});
|
14735
|
+
case "bbbb":
|
14736
|
+
default:
|
14737
|
+
return match2.dayPeriod(dateString, {
|
14738
|
+
width: "wide",
|
14739
|
+
context: "formatting"
|
14740
|
+
}) || match2.dayPeriod(dateString, {
|
14741
|
+
width: "abbreviated",
|
14742
|
+
context: "formatting"
|
14743
|
+
}) || match2.dayPeriod(dateString, {
|
14744
|
+
width: "narrow",
|
14745
|
+
context: "formatting"
|
14746
|
+
});
|
14747
|
+
}
|
14748
|
+
}
|
14749
|
+
set(date2, _flags, value) {
|
14750
|
+
date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
14751
|
+
return date2;
|
14752
|
+
}
|
14753
|
+
}
|
14754
|
+
class DayPeriodParser extends Parser {
|
14755
|
+
constructor() {
|
14756
|
+
super(...arguments);
|
14757
|
+
__publicField(this, "priority", 80);
|
14758
|
+
__publicField(this, "incompatibleTokens", ["a", "b", "t", "T"]);
|
14759
|
+
}
|
14760
|
+
parse(dateString, token, match2) {
|
14761
|
+
switch (token) {
|
14762
|
+
case "B":
|
14763
|
+
case "BB":
|
14764
|
+
case "BBB":
|
14765
|
+
return match2.dayPeriod(dateString, {
|
14766
|
+
width: "abbreviated",
|
14767
|
+
context: "formatting"
|
14768
|
+
}) || match2.dayPeriod(dateString, {
|
14769
|
+
width: "narrow",
|
14770
|
+
context: "formatting"
|
14771
|
+
});
|
14772
|
+
case "BBBBB":
|
14773
|
+
return match2.dayPeriod(dateString, {
|
14774
|
+
width: "narrow",
|
14775
|
+
context: "formatting"
|
14776
|
+
});
|
14777
|
+
case "BBBB":
|
14778
|
+
default:
|
14779
|
+
return match2.dayPeriod(dateString, {
|
14780
|
+
width: "wide",
|
14781
|
+
context: "formatting"
|
14782
|
+
}) || match2.dayPeriod(dateString, {
|
14783
|
+
width: "abbreviated",
|
14784
|
+
context: "formatting"
|
14785
|
+
}) || match2.dayPeriod(dateString, {
|
14786
|
+
width: "narrow",
|
14787
|
+
context: "formatting"
|
14788
|
+
});
|
14789
|
+
}
|
14790
|
+
}
|
14791
|
+
set(date2, _flags, value) {
|
14792
|
+
date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
14793
|
+
return date2;
|
14794
|
+
}
|
14795
|
+
}
|
14796
|
+
class Hour1to12Parser extends Parser {
|
14797
|
+
constructor() {
|
14798
|
+
super(...arguments);
|
14799
|
+
__publicField(this, "priority", 70);
|
14800
|
+
__publicField(this, "incompatibleTokens", ["H", "K", "k", "t", "T"]);
|
14801
|
+
}
|
14802
|
+
parse(dateString, token, match2) {
|
14803
|
+
switch (token) {
|
14804
|
+
case "h":
|
14805
|
+
return parseNumericPattern(numericPatterns.hour12h, dateString);
|
14806
|
+
case "ho":
|
14807
|
+
return match2.ordinalNumber(dateString, { unit: "hour" });
|
14808
|
+
default:
|
14809
|
+
return parseNDigits(token.length, dateString);
|
14810
|
+
}
|
14811
|
+
}
|
14812
|
+
validate(_date, value) {
|
14813
|
+
return value >= 1 && value <= 12;
|
14814
|
+
}
|
14815
|
+
set(date2, _flags, value) {
|
14816
|
+
const isPM = date2.getHours() >= 12;
|
14817
|
+
if (isPM && value < 12) {
|
14818
|
+
date2.setHours(value + 12, 0, 0, 0);
|
14819
|
+
} else if (!isPM && value === 12) {
|
14820
|
+
date2.setHours(0, 0, 0, 0);
|
14821
|
+
} else {
|
14822
|
+
date2.setHours(value, 0, 0, 0);
|
14823
|
+
}
|
14824
|
+
return date2;
|
14825
|
+
}
|
14826
|
+
}
|
14827
|
+
class Hour0to23Parser extends Parser {
|
14828
|
+
constructor() {
|
14829
|
+
super(...arguments);
|
14830
|
+
__publicField(this, "priority", 70);
|
14831
|
+
__publicField(this, "incompatibleTokens", ["a", "b", "h", "K", "k", "t", "T"]);
|
14832
|
+
}
|
14833
|
+
parse(dateString, token, match2) {
|
14834
|
+
switch (token) {
|
14835
|
+
case "H":
|
14836
|
+
return parseNumericPattern(numericPatterns.hour23h, dateString);
|
14837
|
+
case "Ho":
|
14838
|
+
return match2.ordinalNumber(dateString, { unit: "hour" });
|
14839
|
+
default:
|
14840
|
+
return parseNDigits(token.length, dateString);
|
14841
|
+
}
|
14842
|
+
}
|
14843
|
+
validate(_date, value) {
|
14844
|
+
return value >= 0 && value <= 23;
|
14845
|
+
}
|
14846
|
+
set(date2, _flags, value) {
|
14847
|
+
date2.setHours(value, 0, 0, 0);
|
14848
|
+
return date2;
|
14849
|
+
}
|
14850
|
+
}
|
14851
|
+
class Hour0To11Parser extends Parser {
|
14852
|
+
constructor() {
|
14853
|
+
super(...arguments);
|
14854
|
+
__publicField(this, "priority", 70);
|
14855
|
+
__publicField(this, "incompatibleTokens", ["h", "H", "k", "t", "T"]);
|
14856
|
+
}
|
14857
|
+
parse(dateString, token, match2) {
|
14858
|
+
switch (token) {
|
14859
|
+
case "K":
|
14860
|
+
return parseNumericPattern(numericPatterns.hour11h, dateString);
|
14861
|
+
case "Ko":
|
14862
|
+
return match2.ordinalNumber(dateString, { unit: "hour" });
|
14863
|
+
default:
|
14864
|
+
return parseNDigits(token.length, dateString);
|
14865
|
+
}
|
14866
|
+
}
|
14867
|
+
validate(_date, value) {
|
14868
|
+
return value >= 0 && value <= 11;
|
14869
|
+
}
|
14870
|
+
set(date2, _flags, value) {
|
14871
|
+
const isPM = date2.getHours() >= 12;
|
14872
|
+
if (isPM && value < 12) {
|
14873
|
+
date2.setHours(value + 12, 0, 0, 0);
|
14874
|
+
} else {
|
14875
|
+
date2.setHours(value, 0, 0, 0);
|
14876
|
+
}
|
14877
|
+
return date2;
|
14878
|
+
}
|
14879
|
+
}
|
14880
|
+
class Hour1To24Parser extends Parser {
|
14881
|
+
constructor() {
|
14882
|
+
super(...arguments);
|
14883
|
+
__publicField(this, "priority", 70);
|
14884
|
+
__publicField(this, "incompatibleTokens", ["a", "b", "h", "H", "K", "t", "T"]);
|
14885
|
+
}
|
14886
|
+
parse(dateString, token, match2) {
|
14887
|
+
switch (token) {
|
14888
|
+
case "k":
|
14889
|
+
return parseNumericPattern(numericPatterns.hour24h, dateString);
|
14890
|
+
case "ko":
|
14891
|
+
return match2.ordinalNumber(dateString, { unit: "hour" });
|
14892
|
+
default:
|
14893
|
+
return parseNDigits(token.length, dateString);
|
14894
|
+
}
|
14895
|
+
}
|
14896
|
+
validate(_date, value) {
|
14897
|
+
return value >= 1 && value <= 24;
|
14898
|
+
}
|
14899
|
+
set(date2, _flags, value) {
|
14900
|
+
const hours = value <= 24 ? value % 24 : value;
|
14901
|
+
date2.setHours(hours, 0, 0, 0);
|
14902
|
+
return date2;
|
14903
|
+
}
|
14904
|
+
}
|
14905
|
+
class MinuteParser extends Parser {
|
14906
|
+
constructor() {
|
14907
|
+
super(...arguments);
|
14908
|
+
__publicField(this, "priority", 60);
|
14909
|
+
__publicField(this, "incompatibleTokens", ["t", "T"]);
|
14910
|
+
}
|
14911
|
+
parse(dateString, token, match2) {
|
14912
|
+
switch (token) {
|
14913
|
+
case "m":
|
14914
|
+
return parseNumericPattern(numericPatterns.minute, dateString);
|
14915
|
+
case "mo":
|
14916
|
+
return match2.ordinalNumber(dateString, { unit: "minute" });
|
14917
|
+
default:
|
14918
|
+
return parseNDigits(token.length, dateString);
|
14919
|
+
}
|
14920
|
+
}
|
14921
|
+
validate(_date, value) {
|
14922
|
+
return value >= 0 && value <= 59;
|
14923
|
+
}
|
14924
|
+
set(date2, _flags, value) {
|
14925
|
+
date2.setMinutes(value, 0, 0);
|
14926
|
+
return date2;
|
14927
|
+
}
|
14928
|
+
}
|
14929
|
+
class SecondParser extends Parser {
|
14930
|
+
constructor() {
|
14931
|
+
super(...arguments);
|
14932
|
+
__publicField(this, "priority", 50);
|
14933
|
+
__publicField(this, "incompatibleTokens", ["t", "T"]);
|
14934
|
+
}
|
14935
|
+
parse(dateString, token, match2) {
|
14936
|
+
switch (token) {
|
14937
|
+
case "s":
|
14938
|
+
return parseNumericPattern(numericPatterns.second, dateString);
|
14939
|
+
case "so":
|
14940
|
+
return match2.ordinalNumber(dateString, { unit: "second" });
|
14941
|
+
default:
|
14942
|
+
return parseNDigits(token.length, dateString);
|
14943
|
+
}
|
14944
|
+
}
|
14945
|
+
validate(_date, value) {
|
14946
|
+
return value >= 0 && value <= 59;
|
14947
|
+
}
|
14948
|
+
set(date2, _flags, value) {
|
14949
|
+
date2.setSeconds(value, 0);
|
14950
|
+
return date2;
|
14951
|
+
}
|
14952
|
+
}
|
14953
|
+
class FractionOfSecondParser extends Parser {
|
14954
|
+
constructor() {
|
14955
|
+
super(...arguments);
|
14956
|
+
__publicField(this, "priority", 30);
|
14957
|
+
__publicField(this, "incompatibleTokens", ["t", "T"]);
|
14958
|
+
}
|
14959
|
+
parse(dateString, token) {
|
14960
|
+
const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3));
|
14961
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
14962
|
+
}
|
14963
|
+
set(date2, _flags, value) {
|
14964
|
+
date2.setMilliseconds(value);
|
14965
|
+
return date2;
|
14966
|
+
}
|
14967
|
+
}
|
14968
|
+
class ISOTimezoneWithZParser extends Parser {
|
14969
|
+
constructor() {
|
14970
|
+
super(...arguments);
|
14971
|
+
__publicField(this, "priority", 10);
|
14972
|
+
__publicField(this, "incompatibleTokens", ["t", "T", "x"]);
|
14973
|
+
}
|
14974
|
+
parse(dateString, token) {
|
14975
|
+
switch (token) {
|
14976
|
+
case "X":
|
14977
|
+
return parseTimezonePattern(
|
14978
|
+
timezonePatterns.basicOptionalMinutes,
|
14979
|
+
dateString
|
14980
|
+
);
|
14981
|
+
case "XX":
|
14982
|
+
return parseTimezonePattern(timezonePatterns.basic, dateString);
|
14983
|
+
case "XXXX":
|
14984
|
+
return parseTimezonePattern(
|
14985
|
+
timezonePatterns.basicOptionalSeconds,
|
14986
|
+
dateString
|
14987
|
+
);
|
14988
|
+
case "XXXXX":
|
14989
|
+
return parseTimezonePattern(
|
14990
|
+
timezonePatterns.extendedOptionalSeconds,
|
14991
|
+
dateString
|
14992
|
+
);
|
14993
|
+
case "XXX":
|
14994
|
+
default:
|
14995
|
+
return parseTimezonePattern(timezonePatterns.extended, dateString);
|
13240
14996
|
}
|
13241
|
-
},
|
13242
|
-
// Seconds timestamp
|
13243
|
-
t: function(date2, token, _localize) {
|
13244
|
-
const timestamp = Math.trunc(date2.getTime() / 1e3);
|
13245
|
-
return addLeadingZeros(timestamp, token.length);
|
13246
|
-
},
|
13247
|
-
// Milliseconds timestamp
|
13248
|
-
T: function(date2, token, _localize) {
|
13249
|
-
const timestamp = date2.getTime();
|
13250
|
-
return addLeadingZeros(timestamp, token.length);
|
13251
14997
|
}
|
13252
|
-
|
13253
|
-
|
13254
|
-
|
13255
|
-
|
13256
|
-
|
13257
|
-
|
13258
|
-
if (minutes === 0) {
|
13259
|
-
return sign2 + String(hours);
|
14998
|
+
set(date2, flags, value) {
|
14999
|
+
if (flags.timestampIsSet) return date2;
|
15000
|
+
return constructFrom(
|
15001
|
+
date2,
|
15002
|
+
date2.getTime() - getTimezoneOffsetInMilliseconds(date2) - value
|
15003
|
+
);
|
13260
15004
|
}
|
13261
|
-
return sign2 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
13262
15005
|
}
|
13263
|
-
|
13264
|
-
|
13265
|
-
|
13266
|
-
|
15006
|
+
class ISOTimezoneParser extends Parser {
|
15007
|
+
constructor() {
|
15008
|
+
super(...arguments);
|
15009
|
+
__publicField(this, "priority", 10);
|
15010
|
+
__publicField(this, "incompatibleTokens", ["t", "T", "X"]);
|
13267
15011
|
}
|
13268
|
-
|
13269
|
-
|
13270
|
-
|
13271
|
-
|
13272
|
-
|
13273
|
-
|
13274
|
-
|
13275
|
-
|
13276
|
-
|
13277
|
-
|
13278
|
-
|
13279
|
-
|
13280
|
-
|
13281
|
-
|
13282
|
-
|
13283
|
-
|
13284
|
-
|
13285
|
-
|
13286
|
-
|
13287
|
-
|
15012
|
+
parse(dateString, token) {
|
15013
|
+
switch (token) {
|
15014
|
+
case "x":
|
15015
|
+
return parseTimezonePattern(
|
15016
|
+
timezonePatterns.basicOptionalMinutes,
|
15017
|
+
dateString
|
15018
|
+
);
|
15019
|
+
case "xx":
|
15020
|
+
return parseTimezonePattern(timezonePatterns.basic, dateString);
|
15021
|
+
case "xxxx":
|
15022
|
+
return parseTimezonePattern(
|
15023
|
+
timezonePatterns.basicOptionalSeconds,
|
15024
|
+
dateString
|
15025
|
+
);
|
15026
|
+
case "xxxxx":
|
15027
|
+
return parseTimezonePattern(
|
15028
|
+
timezonePatterns.extendedOptionalSeconds,
|
15029
|
+
dateString
|
15030
|
+
);
|
15031
|
+
case "xxx":
|
15032
|
+
default:
|
15033
|
+
return parseTimezonePattern(timezonePatterns.extended, dateString);
|
15034
|
+
}
|
13288
15035
|
}
|
13289
|
-
|
13290
|
-
|
13291
|
-
|
13292
|
-
|
13293
|
-
|
13294
|
-
|
13295
|
-
return formatLong2.time({ width: "medium" });
|
13296
|
-
case "ppp":
|
13297
|
-
return formatLong2.time({ width: "long" });
|
13298
|
-
case "pppp":
|
13299
|
-
default:
|
13300
|
-
return formatLong2.time({ width: "full" });
|
15036
|
+
set(date2, flags, value) {
|
15037
|
+
if (flags.timestampIsSet) return date2;
|
15038
|
+
return constructFrom(
|
15039
|
+
date2,
|
15040
|
+
date2.getTime() - getTimezoneOffsetInMilliseconds(date2) - value
|
15041
|
+
);
|
13301
15042
|
}
|
13302
|
-
}
|
13303
|
-
|
13304
|
-
|
13305
|
-
|
13306
|
-
|
13307
|
-
|
13308
|
-
return dateLongFormatter(pattern, formatLong2);
|
15043
|
+
}
|
15044
|
+
class TimestampSecondsParser extends Parser {
|
15045
|
+
constructor() {
|
15046
|
+
super(...arguments);
|
15047
|
+
__publicField(this, "priority", 40);
|
15048
|
+
__publicField(this, "incompatibleTokens", "*");
|
13309
15049
|
}
|
13310
|
-
|
13311
|
-
|
13312
|
-
|
13313
|
-
|
13314
|
-
|
13315
|
-
case "PP":
|
13316
|
-
dateTimeFormat = formatLong2.dateTime({ width: "medium" });
|
13317
|
-
break;
|
13318
|
-
case "PPP":
|
13319
|
-
dateTimeFormat = formatLong2.dateTime({ width: "long" });
|
13320
|
-
break;
|
13321
|
-
case "PPPP":
|
13322
|
-
default:
|
13323
|
-
dateTimeFormat = formatLong2.dateTime({ width: "full" });
|
13324
|
-
break;
|
15050
|
+
parse(dateString) {
|
15051
|
+
return parseAnyDigitsSigned(dateString);
|
15052
|
+
}
|
15053
|
+
set(date2, _flags, value) {
|
15054
|
+
return [constructFrom(date2, value * 1e3), { timestampIsSet: true }];
|
13325
15055
|
}
|
13326
|
-
return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
|
13327
|
-
};
|
13328
|
-
const longFormatters = {
|
13329
|
-
p: timeLongFormatter,
|
13330
|
-
P: dateTimeLongFormatter
|
13331
|
-
};
|
13332
|
-
const dayOfYearTokenRE = /^D+$/;
|
13333
|
-
const weekYearTokenRE = /^Y+$/;
|
13334
|
-
const throwTokens = ["D", "DD", "YY", "YYYY"];
|
13335
|
-
function isProtectedDayOfYearToken(token) {
|
13336
|
-
return dayOfYearTokenRE.test(token);
|
13337
|
-
}
|
13338
|
-
function isProtectedWeekYearToken(token) {
|
13339
|
-
return weekYearTokenRE.test(token);
|
13340
|
-
}
|
13341
|
-
function warnOrThrowProtectedError(token, format2, input) {
|
13342
|
-
const _message = message(token, format2, input);
|
13343
|
-
console.warn(_message);
|
13344
|
-
if (throwTokens.includes(token)) throw new RangeError(_message);
|
13345
|
-
}
|
13346
|
-
function message(token, format2, input) {
|
13347
|
-
const subject = token[0] === "Y" ? "years" : "days of the month";
|
13348
|
-
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
13349
15056
|
}
|
15057
|
+
class TimestampMillisecondsParser extends Parser {
|
15058
|
+
constructor() {
|
15059
|
+
super(...arguments);
|
15060
|
+
__publicField(this, "priority", 20);
|
15061
|
+
__publicField(this, "incompatibleTokens", "*");
|
15062
|
+
}
|
15063
|
+
parse(dateString) {
|
15064
|
+
return parseAnyDigitsSigned(dateString);
|
15065
|
+
}
|
15066
|
+
set(date2, _flags, value) {
|
15067
|
+
return [constructFrom(date2, value), { timestampIsSet: true }];
|
15068
|
+
}
|
15069
|
+
}
|
15070
|
+
const parsers = {
|
15071
|
+
G: new EraParser(),
|
15072
|
+
y: new YearParser(),
|
15073
|
+
Y: new LocalWeekYearParser(),
|
15074
|
+
R: new ISOWeekYearParser(),
|
15075
|
+
u: new ExtendedYearParser(),
|
15076
|
+
Q: new QuarterParser(),
|
15077
|
+
q: new StandAloneQuarterParser(),
|
15078
|
+
M: new MonthParser(),
|
15079
|
+
L: new StandAloneMonthParser(),
|
15080
|
+
w: new LocalWeekParser(),
|
15081
|
+
I: new ISOWeekParser(),
|
15082
|
+
d: new DateParser(),
|
15083
|
+
D: new DayOfYearParser(),
|
15084
|
+
E: new DayParser(),
|
15085
|
+
e: new LocalDayParser(),
|
15086
|
+
c: new StandAloneLocalDayParser(),
|
15087
|
+
i: new ISODayParser(),
|
15088
|
+
a: new AMPMParser(),
|
15089
|
+
b: new AMPMMidnightParser(),
|
15090
|
+
B: new DayPeriodParser(),
|
15091
|
+
h: new Hour1to12Parser(),
|
15092
|
+
H: new Hour0to23Parser(),
|
15093
|
+
K: new Hour0To11Parser(),
|
15094
|
+
k: new Hour1To24Parser(),
|
15095
|
+
m: new MinuteParser(),
|
15096
|
+
s: new SecondParser(),
|
15097
|
+
S: new FractionOfSecondParser(),
|
15098
|
+
X: new ISOTimezoneWithZParser(),
|
15099
|
+
x: new ISOTimezoneParser(),
|
15100
|
+
t: new TimestampSecondsParser(),
|
15101
|
+
T: new TimestampMillisecondsParser()
|
15102
|
+
};
|
13350
15103
|
const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
13351
15104
|
const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
13352
15105
|
const escapedStringRegExp = /^'([^]*?)'?$/;
|
13353
15106
|
const doubleQuoteRegExp = /''/g;
|
15107
|
+
const notWhitespaceRegExp = /\S/;
|
13354
15108
|
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
13355
|
-
function
|
13356
|
-
var _a, _b, _c, _d
|
15109
|
+
function parse$2(dateStr, formatStr, referenceDate, options) {
|
15110
|
+
var _a, _b, _c, _d;
|
13357
15111
|
const defaultOptions2 = getDefaultOptions();
|
13358
|
-
const locale2 =
|
13359
|
-
const firstWeekContainsDate =
|
13360
|
-
const weekStartsOn =
|
13361
|
-
|
13362
|
-
|
13363
|
-
|
15112
|
+
const locale2 = defaultOptions2.locale ?? enUS;
|
15113
|
+
const firstWeekContainsDate = defaultOptions2.firstWeekContainsDate ?? ((_b = (_a = defaultOptions2.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? 1;
|
15114
|
+
const weekStartsOn = defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
15115
|
+
if (formatStr === "") {
|
15116
|
+
if (dateStr === "") {
|
15117
|
+
return toDate(referenceDate);
|
15118
|
+
} else {
|
15119
|
+
return constructFrom(referenceDate, NaN);
|
15120
|
+
}
|
13364
15121
|
}
|
13365
|
-
|
15122
|
+
const subFnOptions = {
|
15123
|
+
firstWeekContainsDate,
|
15124
|
+
weekStartsOn,
|
15125
|
+
locale: locale2
|
15126
|
+
};
|
15127
|
+
const setters = [new DateToSystemTimezoneSetter()];
|
15128
|
+
const tokens = formatStr.match(longFormattingTokensRegExp).map((substring) => {
|
13366
15129
|
const firstCharacter = substring[0];
|
13367
|
-
if (firstCharacter
|
15130
|
+
if (firstCharacter in longFormatters) {
|
13368
15131
|
const longFormatter = longFormatters[firstCharacter];
|
13369
15132
|
return longFormatter(substring, locale2.formatLong);
|
13370
15133
|
}
|
13371
15134
|
return substring;
|
13372
|
-
}).join("").match(formattingTokensRegExp)
|
13373
|
-
|
13374
|
-
|
13375
|
-
|
13376
|
-
|
13377
|
-
|
13378
|
-
|
13379
|
-
|
13380
|
-
|
13381
|
-
|
13382
|
-
|
13383
|
-
if (
|
13384
|
-
|
13385
|
-
|
15135
|
+
}).join("").match(formattingTokensRegExp);
|
15136
|
+
const usedTokens = [];
|
15137
|
+
for (let token of tokens) {
|
15138
|
+
if (isProtectedWeekYearToken(token)) {
|
15139
|
+
warnOrThrowProtectedError(token, formatStr, dateStr);
|
15140
|
+
}
|
15141
|
+
if (isProtectedDayOfYearToken(token)) {
|
15142
|
+
warnOrThrowProtectedError(token, formatStr, dateStr);
|
15143
|
+
}
|
15144
|
+
const firstCharacter = token[0];
|
15145
|
+
const parser = parsers[firstCharacter];
|
15146
|
+
if (parser) {
|
15147
|
+
const { incompatibleTokens } = parser;
|
15148
|
+
if (Array.isArray(incompatibleTokens)) {
|
15149
|
+
const incompatibleToken = usedTokens.find(
|
15150
|
+
(usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter
|
15151
|
+
);
|
15152
|
+
if (incompatibleToken) {
|
15153
|
+
throw new RangeError(
|
15154
|
+
`The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time`
|
15155
|
+
);
|
15156
|
+
}
|
15157
|
+
} else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) {
|
15158
|
+
throw new RangeError(
|
15159
|
+
`The format string mustn't contain \`${token}\` and any other token at the same time`
|
15160
|
+
);
|
15161
|
+
}
|
15162
|
+
usedTokens.push({ token: firstCharacter, fullToken: token });
|
15163
|
+
const parseResult = parser.run(
|
15164
|
+
dateStr,
|
15165
|
+
token,
|
15166
|
+
locale2.match,
|
15167
|
+
subFnOptions
|
13386
15168
|
);
|
15169
|
+
if (!parseResult) {
|
15170
|
+
return constructFrom(referenceDate, NaN);
|
15171
|
+
}
|
15172
|
+
setters.push(parseResult.setter);
|
15173
|
+
dateStr = parseResult.rest;
|
15174
|
+
} else {
|
15175
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
15176
|
+
throw new RangeError(
|
15177
|
+
"Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
|
15178
|
+
);
|
15179
|
+
}
|
15180
|
+
if (token === "''") {
|
15181
|
+
token = "'";
|
15182
|
+
} else if (firstCharacter === "'") {
|
15183
|
+
token = cleanEscapedString(token);
|
15184
|
+
}
|
15185
|
+
if (dateStr.indexOf(token) === 0) {
|
15186
|
+
dateStr = dateStr.slice(token.length);
|
15187
|
+
} else {
|
15188
|
+
return constructFrom(referenceDate, NaN);
|
15189
|
+
}
|
13387
15190
|
}
|
13388
|
-
return { isToken: false, value: substring };
|
13389
|
-
});
|
13390
|
-
if (locale2.localize.preprocessor) {
|
13391
|
-
parts = locale2.localize.preprocessor(originalDate, parts);
|
13392
15191
|
}
|
13393
|
-
|
13394
|
-
|
13395
|
-
|
13396
|
-
|
13397
|
-
|
13398
|
-
|
13399
|
-
|
13400
|
-
|
13401
|
-
|
13402
|
-
|
15192
|
+
if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) {
|
15193
|
+
return constructFrom(referenceDate, NaN);
|
15194
|
+
}
|
15195
|
+
const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a2, b2) => b2 - a2).filter((priority, index2, array2) => array2.indexOf(priority) === index2).map(
|
15196
|
+
(priority) => setters.filter((setter) => setter.priority === priority).sort((a2, b2) => b2.subPriority - a2.subPriority)
|
15197
|
+
).map((setterArray) => setterArray[0]);
|
15198
|
+
let date2 = toDate(referenceDate);
|
15199
|
+
if (isNaN(date2.getTime())) {
|
15200
|
+
return constructFrom(referenceDate, NaN);
|
15201
|
+
}
|
15202
|
+
const flags = {};
|
15203
|
+
for (const setter of uniquePrioritySetters) {
|
15204
|
+
if (!setter.validate(date2, subFnOptions)) {
|
15205
|
+
return constructFrom(referenceDate, NaN);
|
15206
|
+
}
|
15207
|
+
const result = setter.set(date2, flags, subFnOptions);
|
15208
|
+
if (Array.isArray(result)) {
|
15209
|
+
date2 = result[0];
|
15210
|
+
Object.assign(flags, result[1]);
|
15211
|
+
} else {
|
15212
|
+
date2 = result;
|
13403
15213
|
}
|
13404
|
-
const formatter = formatters$1[token[0]];
|
13405
|
-
return formatter(originalDate, token, locale2.localize, formatterOptions);
|
13406
|
-
}).join("");
|
13407
|
-
}
|
13408
|
-
function cleanEscapedString(input) {
|
13409
|
-
const matched = input.match(escapedStringRegExp);
|
13410
|
-
if (!matched) {
|
13411
|
-
return input;
|
13412
15214
|
}
|
13413
|
-
return
|
13414
|
-
}
|
13415
|
-
function getDaysInMonth(date2) {
|
13416
|
-
const _date = toDate(date2);
|
13417
|
-
const year = _date.getFullYear();
|
13418
|
-
const monthIndex = _date.getMonth();
|
13419
|
-
const lastDayOfMonth2 = constructFrom(date2, 0);
|
13420
|
-
lastDayOfMonth2.setFullYear(year, monthIndex + 1, 0);
|
13421
|
-
lastDayOfMonth2.setHours(0, 0, 0, 0);
|
13422
|
-
return lastDayOfMonth2.getDate();
|
13423
|
-
}
|
13424
|
-
function getUnixTime(date2) {
|
13425
|
-
return Math.trunc(+toDate(date2) / 1e3);
|
13426
|
-
}
|
13427
|
-
function lastDayOfMonth(date2) {
|
13428
|
-
const _date = toDate(date2);
|
13429
|
-
const month = _date.getMonth();
|
13430
|
-
_date.setFullYear(_date.getFullYear(), month + 1, 0);
|
13431
|
-
_date.setHours(0, 0, 0, 0);
|
13432
|
-
return _date;
|
13433
|
-
}
|
13434
|
-
function getWeeksInMonth(date2, options) {
|
13435
|
-
return differenceInCalendarWeeks(
|
13436
|
-
lastDayOfMonth(date2),
|
13437
|
-
startOfMonth(date2),
|
13438
|
-
options
|
13439
|
-
) + 1;
|
13440
|
-
}
|
13441
|
-
function isAfter(date2, dateToCompare) {
|
13442
|
-
const _date = toDate(date2);
|
13443
|
-
const _dateToCompare = toDate(dateToCompare);
|
13444
|
-
return _date.getTime() > _dateToCompare.getTime();
|
13445
|
-
}
|
13446
|
-
function isBefore(date2, dateToCompare) {
|
13447
|
-
const _date = toDate(date2);
|
13448
|
-
const _dateToCompare = toDate(dateToCompare);
|
13449
|
-
return +_date < +_dateToCompare;
|
15215
|
+
return constructFrom(referenceDate, date2);
|
13450
15216
|
}
|
13451
|
-
function
|
13452
|
-
|
13453
|
-
const _dateRight = toDate(rightDate);
|
13454
|
-
return +_dateLeft === +_dateRight;
|
15217
|
+
function cleanEscapedString(input) {
|
15218
|
+
return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
|
13455
15219
|
}
|
13456
15220
|
function isSameMonth(dateLeft, dateRight) {
|
13457
15221
|
const _dateLeft = toDate(dateLeft);
|
@@ -13466,6 +15230,184 @@ function isSameYear(dateLeft, dateRight) {
|
|
13466
15230
|
function subDays(date2, amount) {
|
13467
15231
|
return addDays(date2, -amount);
|
13468
15232
|
}
|
15233
|
+
function parseISO(argument, options) {
|
15234
|
+
const additionalDigits = 2;
|
15235
|
+
const dateStrings = splitDateString(argument);
|
15236
|
+
let date2;
|
15237
|
+
if (dateStrings.date) {
|
15238
|
+
const parseYearResult = parseYear$1(dateStrings.date, additionalDigits);
|
15239
|
+
date2 = parseDate(parseYearResult.restDateString, parseYearResult.year);
|
15240
|
+
}
|
15241
|
+
if (!date2 || isNaN(date2.getTime())) {
|
15242
|
+
return /* @__PURE__ */ new Date(NaN);
|
15243
|
+
}
|
15244
|
+
const timestamp = date2.getTime();
|
15245
|
+
let time2 = 0;
|
15246
|
+
let offset2;
|
15247
|
+
if (dateStrings.time) {
|
15248
|
+
time2 = parseTime(dateStrings.time);
|
15249
|
+
if (isNaN(time2)) {
|
15250
|
+
return /* @__PURE__ */ new Date(NaN);
|
15251
|
+
}
|
15252
|
+
}
|
15253
|
+
if (dateStrings.timezone) {
|
15254
|
+
offset2 = parseTimezone(dateStrings.timezone);
|
15255
|
+
if (isNaN(offset2)) {
|
15256
|
+
return /* @__PURE__ */ new Date(NaN);
|
15257
|
+
}
|
15258
|
+
} else {
|
15259
|
+
const dirtyDate = new Date(timestamp + time2);
|
15260
|
+
const result = /* @__PURE__ */ new Date(0);
|
15261
|
+
result.setFullYear(
|
15262
|
+
dirtyDate.getUTCFullYear(),
|
15263
|
+
dirtyDate.getUTCMonth(),
|
15264
|
+
dirtyDate.getUTCDate()
|
15265
|
+
);
|
15266
|
+
result.setHours(
|
15267
|
+
dirtyDate.getUTCHours(),
|
15268
|
+
dirtyDate.getUTCMinutes(),
|
15269
|
+
dirtyDate.getUTCSeconds(),
|
15270
|
+
dirtyDate.getUTCMilliseconds()
|
15271
|
+
);
|
15272
|
+
return result;
|
15273
|
+
}
|
15274
|
+
return new Date(timestamp + time2 + offset2);
|
15275
|
+
}
|
15276
|
+
const patterns = {
|
15277
|
+
dateTimeDelimiter: /[T ]/,
|
15278
|
+
timeZoneDelimiter: /[Z ]/i,
|
15279
|
+
timezone: /([Z+-].*)$/
|
15280
|
+
};
|
15281
|
+
const dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
|
15282
|
+
const timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
|
15283
|
+
const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
15284
|
+
function splitDateString(dateString) {
|
15285
|
+
const dateStrings = {};
|
15286
|
+
const array2 = dateString.split(patterns.dateTimeDelimiter);
|
15287
|
+
let timeString;
|
15288
|
+
if (array2.length > 2) {
|
15289
|
+
return dateStrings;
|
15290
|
+
}
|
15291
|
+
if (/:/.test(array2[0])) {
|
15292
|
+
timeString = array2[0];
|
15293
|
+
} else {
|
15294
|
+
dateStrings.date = array2[0];
|
15295
|
+
timeString = array2[1];
|
15296
|
+
if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
|
15297
|
+
dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
|
15298
|
+
timeString = dateString.substr(
|
15299
|
+
dateStrings.date.length,
|
15300
|
+
dateString.length
|
15301
|
+
);
|
15302
|
+
}
|
15303
|
+
}
|
15304
|
+
if (timeString) {
|
15305
|
+
const token = patterns.timezone.exec(timeString);
|
15306
|
+
if (token) {
|
15307
|
+
dateStrings.time = timeString.replace(token[1], "");
|
15308
|
+
dateStrings.timezone = token[1];
|
15309
|
+
} else {
|
15310
|
+
dateStrings.time = timeString;
|
15311
|
+
}
|
15312
|
+
}
|
15313
|
+
return dateStrings;
|
15314
|
+
}
|
15315
|
+
function parseYear$1(dateString, additionalDigits) {
|
15316
|
+
const regex = new RegExp(
|
15317
|
+
"^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
|
15318
|
+
);
|
15319
|
+
const captures = dateString.match(regex);
|
15320
|
+
if (!captures) return { year: NaN, restDateString: "" };
|
15321
|
+
const year = captures[1] ? parseInt(captures[1]) : null;
|
15322
|
+
const century = captures[2] ? parseInt(captures[2]) : null;
|
15323
|
+
return {
|
15324
|
+
year: century === null ? year : century * 100,
|
15325
|
+
restDateString: dateString.slice((captures[1] || captures[2]).length)
|
15326
|
+
};
|
15327
|
+
}
|
15328
|
+
function parseDate(dateString, year) {
|
15329
|
+
if (year === null) return /* @__PURE__ */ new Date(NaN);
|
15330
|
+
const captures = dateString.match(dateRegex);
|
15331
|
+
if (!captures) return /* @__PURE__ */ new Date(NaN);
|
15332
|
+
const isWeekDate = !!captures[4];
|
15333
|
+
const dayOfYear = parseDateUnit(captures[1]);
|
15334
|
+
const month = parseDateUnit(captures[2]) - 1;
|
15335
|
+
const day = parseDateUnit(captures[3]);
|
15336
|
+
const week = parseDateUnit(captures[4]);
|
15337
|
+
const dayOfWeek = parseDateUnit(captures[5]) - 1;
|
15338
|
+
if (isWeekDate) {
|
15339
|
+
if (!validateWeekDate(year, week, dayOfWeek)) {
|
15340
|
+
return /* @__PURE__ */ new Date(NaN);
|
15341
|
+
}
|
15342
|
+
return dayOfISOWeekYear(year, week, dayOfWeek);
|
15343
|
+
} else {
|
15344
|
+
const date2 = /* @__PURE__ */ new Date(0);
|
15345
|
+
if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
|
15346
|
+
return /* @__PURE__ */ new Date(NaN);
|
15347
|
+
}
|
15348
|
+
date2.setUTCFullYear(year, month, Math.max(dayOfYear, day));
|
15349
|
+
return date2;
|
15350
|
+
}
|
15351
|
+
}
|
15352
|
+
function parseDateUnit(value) {
|
15353
|
+
return value ? parseInt(value) : 1;
|
15354
|
+
}
|
15355
|
+
function parseTime(timeString) {
|
15356
|
+
const captures = timeString.match(timeRegex);
|
15357
|
+
if (!captures) return NaN;
|
15358
|
+
const hours = parseTimeUnit(captures[1]);
|
15359
|
+
const minutes = parseTimeUnit(captures[2]);
|
15360
|
+
const seconds = parseTimeUnit(captures[3]);
|
15361
|
+
if (!validateTime(hours, minutes, seconds)) {
|
15362
|
+
return NaN;
|
15363
|
+
}
|
15364
|
+
return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
|
15365
|
+
}
|
15366
|
+
function parseTimeUnit(value) {
|
15367
|
+
return value && parseFloat(value.replace(",", ".")) || 0;
|
15368
|
+
}
|
15369
|
+
function parseTimezone(timezoneString) {
|
15370
|
+
if (timezoneString === "Z") return 0;
|
15371
|
+
const captures = timezoneString.match(timezoneRegex);
|
15372
|
+
if (!captures) return 0;
|
15373
|
+
const sign2 = captures[1] === "+" ? -1 : 1;
|
15374
|
+
const hours = parseInt(captures[2]);
|
15375
|
+
const minutes = captures[3] && parseInt(captures[3]) || 0;
|
15376
|
+
if (!validateTimezone(hours, minutes)) {
|
15377
|
+
return NaN;
|
15378
|
+
}
|
15379
|
+
return sign2 * (hours * millisecondsInHour + minutes * millisecondsInMinute);
|
15380
|
+
}
|
15381
|
+
function dayOfISOWeekYear(isoWeekYear, week, day) {
|
15382
|
+
const date2 = /* @__PURE__ */ new Date(0);
|
15383
|
+
date2.setUTCFullYear(isoWeekYear, 0, 4);
|
15384
|
+
const fourthOfJanuaryDay = date2.getUTCDay() || 7;
|
15385
|
+
const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
|
15386
|
+
date2.setUTCDate(date2.getUTCDate() + diff);
|
15387
|
+
return date2;
|
15388
|
+
}
|
15389
|
+
const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
15390
|
+
function isLeapYearIndex(year) {
|
15391
|
+
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
15392
|
+
}
|
15393
|
+
function validateDate(year, month, date2) {
|
15394
|
+
return month >= 0 && month <= 11 && date2 >= 1 && date2 <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
|
15395
|
+
}
|
15396
|
+
function validateDayOfYearDate(year, dayOfYear) {
|
15397
|
+
return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
|
15398
|
+
}
|
15399
|
+
function validateWeekDate(_year, week, day) {
|
15400
|
+
return week >= 1 && week <= 53 && day >= 0 && day <= 6;
|
15401
|
+
}
|
15402
|
+
function validateTime(hours, minutes, seconds) {
|
15403
|
+
if (hours === 24) {
|
15404
|
+
return minutes === 0 && seconds === 0;
|
15405
|
+
}
|
15406
|
+
return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
|
15407
|
+
}
|
15408
|
+
function validateTimezone(_hours, minutes) {
|
15409
|
+
return minutes >= 0 && minutes <= 59;
|
15410
|
+
}
|
13469
15411
|
function setMonth(date2, month) {
|
13470
15412
|
const _date = toDate(date2);
|
13471
15413
|
const year = _date.getFullYear();
|
@@ -16562,6 +18504,9 @@ const useCombobox = (props, ref) => {
|
|
16562
18504
|
};
|
16563
18505
|
const handleInputKeyDown = (event) => {
|
16564
18506
|
event.persist();
|
18507
|
+
if (isElementInsideTable3OrReport(event.currentTarget) && (event.key === "ArrowUp" || event.key === "ArrowDown") && open) {
|
18508
|
+
event.stopPropagation();
|
18509
|
+
}
|
16565
18510
|
if (!event.ctrlKey && !event.metaKey) {
|
16566
18511
|
switch (event.key) {
|
16567
18512
|
case "Backspace": {
|
@@ -16865,11 +18810,12 @@ const useDatepicker = ({ defaultValue: _, calendar: calendar2, onBlur, onChange,
|
|
16865
18810
|
);
|
16866
18811
|
const formattedValue = valueAsDate ? format$1(valueAsDate) || "" : "";
|
16867
18812
|
event.target.value = formattedValue;
|
18813
|
+
const isEmpty = !event.target.value.trim();
|
16868
18814
|
if (onChange) {
|
16869
|
-
event.detail = valueAsDate;
|
18815
|
+
event.detail = !isEmpty ? valueAsDate : null;
|
16870
18816
|
onChange(event);
|
16871
18817
|
} else {
|
16872
|
-
setInternalValue(formattedValue);
|
18818
|
+
setInternalValue(!isEmpty ? formattedValue : "");
|
16873
18819
|
}
|
16874
18820
|
if (onBlur) {
|
16875
18821
|
onBlur(event);
|
@@ -32742,6 +34688,121 @@ var TableFilterComparator = /* @__PURE__ */ ((TableFilterComparator2) => {
|
|
32742
34688
|
TableFilterComparator2[TableFilterComparator2["IsNoneOf"] = 15] = "IsNoneOf";
|
32743
34689
|
return TableFilterComparator2;
|
32744
34690
|
})(TableFilterComparator || {});
|
34691
|
+
class DataType {
|
34692
|
+
}
|
34693
|
+
const localeNumberSeparators = /* @__PURE__ */ new Map();
|
34694
|
+
class NumericDataType extends DataType {
|
34695
|
+
static format(value, locale2, options) {
|
34696
|
+
const localisedValue = new Intl.NumberFormat(locale2, options).format(value);
|
34697
|
+
return localisedValue.replace(/[\u00A0\u202F]/g, " ");
|
34698
|
+
}
|
34699
|
+
static parse(value, locale2) {
|
34700
|
+
if (value === void 0 || value === null || typeof value !== "string") {
|
34701
|
+
return void 0;
|
34702
|
+
}
|
34703
|
+
if (value === "Infinity" || value === "-Infinity") {
|
34704
|
+
return Number(value);
|
34705
|
+
}
|
34706
|
+
let sanitizedValue = value.replaceAll(" ", "").replace(/[^0-9.,-]+/g, "");
|
34707
|
+
if (!sanitizedValue.length) {
|
34708
|
+
return void 0;
|
34709
|
+
}
|
34710
|
+
const decimalSeparator = this.getSeparator(locale2);
|
34711
|
+
if (decimalSeparator === ",") {
|
34712
|
+
sanitizedValue = sanitizedValue.replaceAll(".", "").replace(",", ".");
|
34713
|
+
} else {
|
34714
|
+
sanitizedValue = sanitizedValue.replaceAll(",", "");
|
34715
|
+
}
|
34716
|
+
const output = Number(sanitizedValue);
|
34717
|
+
if (isNaN(output)) {
|
34718
|
+
return void 0;
|
34719
|
+
}
|
34720
|
+
return output;
|
34721
|
+
}
|
34722
|
+
static getSeparator(locale2) {
|
34723
|
+
var _a;
|
34724
|
+
if (localeNumberSeparators.has(locale2)) {
|
34725
|
+
return localeNumberSeparators.get(locale2);
|
34726
|
+
}
|
34727
|
+
const decimalSeparator = ((_a = new Intl.NumberFormat(locale2).formatToParts(1.1).find((part) => part.type === "decimal")) == null ? void 0 : _a.value) ?? ".";
|
34728
|
+
localeNumberSeparators.set(locale2, decimalSeparator);
|
34729
|
+
return decimalSeparator;
|
34730
|
+
}
|
34731
|
+
}
|
34732
|
+
const localeDateMasks = /* @__PURE__ */ new Map();
|
34733
|
+
class DateTimeDataType extends DataType {
|
34734
|
+
static format(value, locale2, options) {
|
34735
|
+
let date2;
|
34736
|
+
if (typeof value === "string") {
|
34737
|
+
date2 = new Date(value);
|
34738
|
+
} else if (value instanceof Date) {
|
34739
|
+
date2 = value;
|
34740
|
+
} else {
|
34741
|
+
return "";
|
34742
|
+
}
|
34743
|
+
if (isNaN(date2.getTime())) {
|
34744
|
+
return "";
|
34745
|
+
}
|
34746
|
+
return new Intl.DateTimeFormat(locale2, options).format(date2).replace(/[\u00A0\u202F]/g, " ");
|
34747
|
+
}
|
34748
|
+
static parse(value, locale2) {
|
34749
|
+
if (value === void 0 || value === null || typeof value !== "string") {
|
34750
|
+
return void 0;
|
34751
|
+
}
|
34752
|
+
const sanitizedValue = value == null ? void 0 : value.trim();
|
34753
|
+
if (!(sanitizedValue == null ? void 0 : sanitizedValue.length)) {
|
34754
|
+
return void 0;
|
34755
|
+
}
|
34756
|
+
const setHoursToMidday = (date2) => {
|
34757
|
+
date2.setHours(12 - date2.getTimezoneOffset() / 60);
|
34758
|
+
};
|
34759
|
+
try {
|
34760
|
+
const date2 = parseISO(sanitizedValue);
|
34761
|
+
if (isValid(date2)) {
|
34762
|
+
const timeRegex2 = /^\d{2}:\d{2}(?::\d{2}\.\d+|:\d{2})?(?:Z)?$/;
|
34763
|
+
const time2 = sanitizedValue.split("T")[1];
|
34764
|
+
if (!time2 || !timeRegex2.test(time2)) {
|
34765
|
+
setHoursToMidday(date2);
|
34766
|
+
}
|
34767
|
+
return date2;
|
34768
|
+
}
|
34769
|
+
} catch {
|
34770
|
+
}
|
34771
|
+
const mask = this.getMask(locale2);
|
34772
|
+
if (mask) {
|
34773
|
+
try {
|
34774
|
+
const date2 = parse$2(sanitizedValue, mask, /* @__PURE__ */ new Date());
|
34775
|
+
if (isValid(date2)) {
|
34776
|
+
setHoursToMidday(date2);
|
34777
|
+
return date2;
|
34778
|
+
}
|
34779
|
+
} catch {
|
34780
|
+
}
|
34781
|
+
}
|
34782
|
+
return void 0;
|
34783
|
+
}
|
34784
|
+
static getMask(locale2) {
|
34785
|
+
if (localeDateMasks.has(locale2)) {
|
34786
|
+
return localeDateMasks.get(locale2);
|
34787
|
+
}
|
34788
|
+
const parts = new Intl.DateTimeFormat(locale2).formatToParts(/* @__PURE__ */ new Date());
|
34789
|
+
const mask = parts.reduce((mask2, part) => {
|
34790
|
+
switch (part.type) {
|
34791
|
+
case "literal":
|
34792
|
+
return mask2 + part.value;
|
34793
|
+
case "day":
|
34794
|
+
return mask2 + "dd";
|
34795
|
+
case "month":
|
34796
|
+
return mask2 + "MM";
|
34797
|
+
case "year":
|
34798
|
+
return mask2 + "yyyy";
|
34799
|
+
}
|
34800
|
+
return mask2;
|
34801
|
+
}, "");
|
34802
|
+
localeDateMasks.set(locale2, mask);
|
34803
|
+
return mask;
|
34804
|
+
}
|
34805
|
+
}
|
32745
34806
|
const dataTypes = {
|
32746
34807
|
auto: {
|
32747
34808
|
sortingFn: "auto",
|
@@ -32806,15 +34867,13 @@ function createDatetimeDataType(defaultOptions2) {
|
|
32806
34867
|
TableFilterComparator.IsEmpty,
|
32807
34868
|
TableFilterComparator.IsNotEmpty
|
32808
34869
|
],
|
32809
|
-
getDisplayValue: (value,
|
32810
|
-
var _a;
|
34870
|
+
getDisplayValue: (value, _, options) => {
|
32811
34871
|
if (value === void 0) {
|
32812
34872
|
return "";
|
32813
34873
|
}
|
32814
|
-
return
|
32815
|
-
|
32816
|
-
|
32817
|
-
}
|
34874
|
+
return DateTimeDataType.format(value, options == null ? void 0 : options.localization.locale, defaultOptions2);
|
34875
|
+
},
|
34876
|
+
parse: (value, locale2) => DateTimeDataType.parse(value, locale2)
|
32818
34877
|
};
|
32819
34878
|
}
|
32820
34879
|
function createNumberDataType(align, defaultOptions2) {
|
@@ -32822,6 +34881,8 @@ function createNumberDataType(align, defaultOptions2) {
|
|
32822
34881
|
align,
|
32823
34882
|
sortingFn: "basic",
|
32824
34883
|
filterComparators: [
|
34884
|
+
TableFilterComparator.Contains,
|
34885
|
+
TableFilterComparator.DoesNotContain,
|
32825
34886
|
TableFilterComparator.IsEqualTo,
|
32826
34887
|
TableFilterComparator.IsNotEqualTo,
|
32827
34888
|
TableFilterComparator.IsGreaterThan,
|
@@ -32833,10 +34894,6 @@ function createNumberDataType(align, defaultOptions2) {
|
|
32833
34894
|
TableFilterComparator.IsNotEmpty
|
32834
34895
|
],
|
32835
34896
|
getDisplayValue: (value, row, options) => {
|
32836
|
-
var _a, _b;
|
32837
|
-
if (value === void 0) {
|
32838
|
-
return "";
|
32839
|
-
}
|
32840
34897
|
const dataTypeOptions = typeof (options == null ? void 0 : options.dataTypeOptions) === "function" ? options == null ? void 0 : options.dataTypeOptions(row) : options == null ? void 0 : options.dataTypeOptions;
|
32841
34898
|
const numberFormatOptions = {
|
32842
34899
|
// format
|
@@ -32852,20 +34909,14 @@ function createNumberDataType(align, defaultOptions2) {
|
|
32852
34909
|
numberFormatOptions.currency = dataTypeOptions.currency;
|
32853
34910
|
numberFormatOptions.currencyDisplay = "code";
|
32854
34911
|
}
|
32855
|
-
|
32856
|
-
|
32857
|
-
return localisedValue;
|
32858
|
-
}
|
32859
|
-
let localisedValueWithoutThousandsSeperator = new Intl.NumberFormat((_b = options == null ? void 0 : options.localization) == null ? void 0 : _b.locale, {
|
34912
|
+
const localisedValue = NumericDataType.format(value, options == null ? void 0 : options.localization.locale, numberFormatOptions);
|
34913
|
+
const localisedValueWithoutThousandsSeperator = NumericDataType.format(value, options == null ? void 0 : options.localization.locale, {
|
32860
34914
|
...numberFormatOptions,
|
32861
34915
|
useGrouping: false
|
32862
|
-
})
|
32863
|
-
if (numberFormatOptions.style === "percent" || numberFormatOptions.style === "currency") {
|
32864
|
-
localisedValue = localisedValue.replace(/\u00A0/g, " ");
|
32865
|
-
localisedValueWithoutThousandsSeperator = localisedValueWithoutThousandsSeperator.replace(/\u00A0/g, " ");
|
32866
|
-
}
|
34916
|
+
});
|
32867
34917
|
return [localisedValue, localisedValueWithoutThousandsSeperator];
|
32868
|
-
}
|
34918
|
+
},
|
34919
|
+
parse: (value, locale2) => NumericDataType.parse(value, locale2)
|
32869
34920
|
};
|
32870
34921
|
}
|
32871
34922
|
function getDataTypeProperties(dataType) {
|
@@ -32883,103 +34934,121 @@ function getSortingFn(dataType, customFnOrBuiltIn) {
|
|
32883
34934
|
const toLowerCase = (value) => String(value ?? "").toLocaleLowerCase();
|
32884
34935
|
const isWeakContains = (left, right) => toLowerCase(left).includes(toLowerCase(right));
|
32885
34936
|
const isWeakEqual = (left, right) => toLowerCase(left) === toLowerCase(right);
|
32886
|
-
function columnFilterFn(
|
34937
|
+
function columnFilterFn(row, cellValue, meta, filter2, localization) {
|
32887
34938
|
try {
|
34939
|
+
const query = filter2.value;
|
34940
|
+
const { dataType, dataTypeOptions } = meta ?? {};
|
32888
34941
|
if (filter2.comparator === TableFilterComparator.IsEmpty || filter2.comparator === TableFilterComparator.IsNotEmpty) {
|
32889
|
-
const isEmpty =
|
34942
|
+
const isEmpty = cellValue === void 0 || cellValue === null || cellValue === "";
|
32890
34943
|
return filter2.comparator === TableFilterComparator.IsEmpty ? isEmpty : !isEmpty;
|
32891
34944
|
}
|
32892
|
-
if (
|
34945
|
+
if (query === void 0 || query === null || query === "") {
|
32893
34946
|
return true;
|
32894
34947
|
}
|
32895
|
-
const
|
34948
|
+
const evaluate = (matcher) => {
|
34949
|
+
return isMatched(query, cellValue, row, dataType, dataTypeOptions, localization, matcher);
|
34950
|
+
};
|
34951
|
+
const isDateColumn = dataType === "date" || dataType === "datetime";
|
34952
|
+
const valueAsDate = new Date(cellValue);
|
34953
|
+
const isNumberColumn = dataType === "number" || dataType === "amount";
|
34954
|
+
const compareNumbers2 = (fn) => {
|
34955
|
+
const input = typeof query === "number" ? query : NumericDataType.parse(query, localization.locale);
|
34956
|
+
const value = cellValue;
|
34957
|
+
if (input === void 0) {
|
34958
|
+
return false;
|
34959
|
+
}
|
34960
|
+
return fn(input, value);
|
34961
|
+
};
|
32896
34962
|
switch (filter2.comparator) {
|
32897
34963
|
case TableFilterComparator.Contains:
|
32898
|
-
return isWeakContains
|
34964
|
+
return evaluate(isWeakContains);
|
32899
34965
|
case TableFilterComparator.DoesNotContain:
|
32900
|
-
return !isWeakContains
|
34966
|
+
return !evaluate(isWeakContains);
|
32901
34967
|
case TableFilterComparator.IsEqualTo: {
|
32902
|
-
if (
|
32903
|
-
return
|
32904
|
-
} else if (
|
32905
|
-
return
|
34968
|
+
if (dataType === "boolean") {
|
34969
|
+
return cellValue === query;
|
34970
|
+
} else if (isDateColumn) {
|
34971
|
+
return isWeakEqual$1(query, valueAsDate);
|
32906
34972
|
}
|
32907
|
-
return isWeakEqual
|
34973
|
+
return evaluate(isWeakEqual);
|
32908
34974
|
}
|
32909
34975
|
case TableFilterComparator.IsNotEqualTo: {
|
32910
|
-
if (
|
32911
|
-
return
|
32912
|
-
} else if (
|
32913
|
-
return
|
34976
|
+
if (dataType === "boolean") {
|
34977
|
+
return cellValue !== query;
|
34978
|
+
} else if (isDateColumn) {
|
34979
|
+
return !isWeakEqual$1(query, valueAsDate);
|
32914
34980
|
}
|
32915
|
-
return !isWeakEqual
|
34981
|
+
return !evaluate(isWeakEqual);
|
32916
34982
|
}
|
32917
34983
|
case TableFilterComparator.IsGreaterThan: {
|
32918
|
-
if (
|
32919
|
-
return
|
32920
|
-
} else {
|
32921
|
-
|
32922
|
-
return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber > filter2.value;
|
34984
|
+
if (isDateColumn) {
|
34985
|
+
return query.getTime() < valueAsDate.getTime();
|
34986
|
+
} else if (isNumberColumn) {
|
34987
|
+
return compareNumbers2((q, v2) => q < v2);
|
32923
34988
|
}
|
34989
|
+
return false;
|
32924
34990
|
}
|
32925
34991
|
case TableFilterComparator.IsLessThan: {
|
32926
|
-
if (
|
32927
|
-
return
|
32928
|
-
} else {
|
32929
|
-
|
32930
|
-
return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber < filter2.value;
|
34992
|
+
if (isDateColumn) {
|
34993
|
+
return query.getTime() > valueAsDate.getTime();
|
34994
|
+
} else if (isNumberColumn) {
|
34995
|
+
return compareNumbers2((q, v2) => q > v2);
|
32931
34996
|
}
|
34997
|
+
return false;
|
32932
34998
|
}
|
32933
34999
|
case TableFilterComparator.IsLessThanOrEqualTo: {
|
32934
|
-
if (
|
32935
|
-
return
|
32936
|
-
} else {
|
32937
|
-
|
32938
|
-
return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber <= filter2.value;
|
35000
|
+
if (isDateColumn) {
|
35001
|
+
return query.getTime() > valueAsDate.getTime() || isWeakEqual$1(valueAsDate, query);
|
35002
|
+
} else if (isNumberColumn) {
|
35003
|
+
return compareNumbers2((q, v2) => q >= v2);
|
32939
35004
|
}
|
35005
|
+
return false;
|
32940
35006
|
}
|
32941
35007
|
case TableFilterComparator.IsGreaterThanOrEqualTo: {
|
32942
|
-
if (
|
32943
|
-
return
|
32944
|
-
} else {
|
32945
|
-
|
32946
|
-
return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber >= filter2.value;
|
35008
|
+
if (isDateColumn) {
|
35009
|
+
return query.getTime() < valueAsDate.getTime() || isWeakEqual$1(valueAsDate, query);
|
35010
|
+
} else if (isNumberColumn) {
|
35011
|
+
return compareNumbers2((q, v2) => q <= v2);
|
32947
35012
|
}
|
35013
|
+
return false;
|
32948
35014
|
}
|
32949
35015
|
case TableFilterComparator.IsBetween: {
|
32950
|
-
const [fromValue, toValue2] =
|
32951
|
-
if (
|
32952
|
-
if (
|
35016
|
+
const [fromValue, toValue2] = query;
|
35017
|
+
if (isDateColumn) {
|
35018
|
+
if (fromValue !== void 0 && valueAsDate.getTime() < fromValue.getTime()) {
|
32953
35019
|
return false;
|
32954
|
-
} else if (
|
35020
|
+
} else if (toValue2 !== void 0 && valueAsDate.getTime() > toValue2.getTime()) {
|
32955
35021
|
return false;
|
32956
35022
|
}
|
32957
35023
|
return true;
|
32958
|
-
} else {
|
32959
|
-
|
32960
|
-
if (isNaN(valueAsNumber)) {
|
32961
|
-
return false;
|
32962
|
-
}
|
32963
|
-
if (fromValue !== void 0 && valueAsNumber < fromValue) {
|
35024
|
+
} else if (isNumberColumn) {
|
35025
|
+
if (fromValue !== void 0 && cellValue < fromValue) {
|
32964
35026
|
return false;
|
32965
|
-
} else if (toValue2 !== void 0 &&
|
35027
|
+
} else if (toValue2 !== void 0 && cellValue > toValue2) {
|
32966
35028
|
return false;
|
32967
35029
|
}
|
32968
35030
|
return true;
|
32969
35031
|
}
|
35032
|
+
return false;
|
32970
35033
|
}
|
32971
35034
|
case TableFilterComparator.HasAnyOf:
|
32972
|
-
return Array.isArray(
|
35035
|
+
return Array.isArray(query) && Array.isArray(cellValue) ? query.some((item) => cellValue.includes(item)) : false;
|
32973
35036
|
case TableFilterComparator.HasNoneOf:
|
32974
|
-
return Array.isArray(
|
35037
|
+
return Array.isArray(query) && Array.isArray(cellValue) ? query.every((item) => cellValue.includes(item) === false) : false;
|
32975
35038
|
case TableFilterComparator.HasAllOf:
|
32976
|
-
return Array.isArray(
|
32977
|
-
case TableFilterComparator.IsOneOf:
|
32978
|
-
if (!Array.isArray(
|
32979
|
-
|
32980
|
-
|
32981
|
-
|
32982
|
-
|
35039
|
+
return Array.isArray(query) && Array.isArray(cellValue) ? query.filter((v2) => cellValue.includes(v2)).length === query.length : false;
|
35040
|
+
case TableFilterComparator.IsOneOf: {
|
35041
|
+
if (!Array.isArray(query)) {
|
35042
|
+
return false;
|
35043
|
+
}
|
35044
|
+
return query.some((v2) => isWeakEqual(String(cellValue), v2));
|
35045
|
+
}
|
35046
|
+
case TableFilterComparator.IsNoneOf: {
|
35047
|
+
if (!Array.isArray(query)) {
|
35048
|
+
return false;
|
35049
|
+
}
|
35050
|
+
return query.every((v2) => !isWeakEqual(String(cellValue), v2));
|
35051
|
+
}
|
32983
35052
|
}
|
32984
35053
|
return false;
|
32985
35054
|
} catch (e3) {
|
@@ -32990,12 +35059,12 @@ function columnFilterFn(value, filter2) {
|
|
32990
35059
|
const flattenCellValue = (cellValue) => {
|
32991
35060
|
return typeof cellValue === "object" ? Object.values(cellValue).map(flattenCellValue) : cellValue;
|
32992
35061
|
};
|
32993
|
-
function isMatched(
|
35062
|
+
function isMatched(query, cellValue, rowValue, dataType, dataTypeOptions, localization, matcher = isWeakContains) {
|
32994
35063
|
if (typeof cellValue === "object") {
|
32995
|
-
return flattenCellValue(cellValue).flat(Infinity).find((y2) =>
|
35064
|
+
return flattenCellValue(cellValue).flat(Infinity).find((y2) => matcher(y2, query));
|
32996
35065
|
} else {
|
32997
35066
|
const cellValueAsString = String(cellValue ?? "");
|
32998
|
-
if (cellValueAsString !== void 0 &&
|
35067
|
+
if (cellValueAsString !== void 0 && matcher(cellValueAsString, query)) {
|
32999
35068
|
return true;
|
33000
35069
|
} else {
|
33001
35070
|
const dataTypeProperties = getDataTypeProperties(dataType);
|
@@ -33005,12 +35074,14 @@ function isMatched(searchQuery, cellValue, rowValue, dataType, dataTypeOptions,
|
|
33005
35074
|
localization
|
33006
35075
|
});
|
33007
35076
|
if (Array.isArray(cellDisplayValue)) {
|
33008
|
-
|
33009
|
-
|
33010
|
-
|
33011
|
-
|
33012
|
-
|
33013
|
-
|
35077
|
+
return cellDisplayValue.some((cdv) => matcher(cdv, query));
|
35078
|
+
} else if (cellDisplayValue !== void 0 && isWeakContains(cellDisplayValue, query)) {
|
35079
|
+
return true;
|
35080
|
+
}
|
35081
|
+
}
|
35082
|
+
if (typeof query !== typeof cellValue && dataTypeProperties.parse) {
|
35083
|
+
const parsedQuery = dataTypeProperties.parse(query, localization.locale);
|
35084
|
+
if (parsedQuery !== void 0 && matcher(cellValue, parsedQuery)) {
|
33014
35085
|
return true;
|
33015
35086
|
}
|
33016
35087
|
}
|
@@ -33456,7 +35527,11 @@ function configureReactTableOptions(options, props, localization) {
|
|
33456
35527
|
else {
|
33457
35528
|
tableOptions.getFilteredRowModel = getFilteredRowModel();
|
33458
35529
|
tableOptions.filterFns = {
|
33459
|
-
tacoFilter: (row, columnId, filter2) =>
|
35530
|
+
tacoFilter: (row, columnId, filter2) => {
|
35531
|
+
var _a;
|
35532
|
+
const meta = (_a = row._getAllCellsByColumnId()[columnId]) == null ? void 0 : _a.column.columnDef.meta;
|
35533
|
+
return columnFilterFn(row.original, row.getValue(columnId), meta, filter2, localization);
|
35534
|
+
}
|
33460
35535
|
};
|
33461
35536
|
}
|
33462
35537
|
}
|
@@ -33972,8 +36047,10 @@ function useTableRowSelection(isEnabled = false) {
|
|
33972
36047
|
lastSelectedRowIndex
|
33973
36048
|
};
|
33974
36049
|
}
|
33975
|
-
function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false) {
|
33976
|
-
const [enableGlobalFilter, _setEnableGlobalFilter] = React__default.useState(
|
36050
|
+
function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false, _experimentalDataLoader2 = false) {
|
36051
|
+
const [enableGlobalFilter, _setEnableGlobalFilter] = React__default.useState(
|
36052
|
+
_experimentalDataLoader2 || defaultEnableGlobalFilter
|
36053
|
+
);
|
33977
36054
|
function setEnableGlobalFilter(enabled, instance) {
|
33978
36055
|
_setEnableGlobalFilter(enabled);
|
33979
36056
|
const currentFilter = instance.getState().globalFilter;
|
@@ -34548,7 +36625,12 @@ function useTableManager(props, ref, meta, internalColumns) {
|
|
34548
36625
|
const rowGroups = useTableRowGroups(props.rowActionsForGroup);
|
34549
36626
|
const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
|
34550
36627
|
const rowSelection = useTableRowSelection(!!options.enableRowSelection);
|
34551
|
-
const search = useTableSearch(
|
36628
|
+
const search = useTableSearch(
|
36629
|
+
options.enableSearch,
|
36630
|
+
props.onChangeSearch,
|
36631
|
+
settings.excludeUnmatchedRecordsInSearch,
|
36632
|
+
props._experimentalDataLoader2
|
36633
|
+
);
|
34552
36634
|
const server = useTableServerLoading(
|
34553
36635
|
length,
|
34554
36636
|
data,
|
@@ -34814,10 +36896,11 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex, localShortcuts
|
|
34814
36896
|
const handleKeyDown = (event) => {
|
34815
36897
|
var _a;
|
34816
36898
|
const trigger = event.target;
|
34817
|
-
if (
|
36899
|
+
if (isElementInsideExternalRelatedOverlay(trigger, tableRef)) {
|
34818
36900
|
return;
|
34819
36901
|
}
|
34820
|
-
tableMeta.
|
36902
|
+
const reachableRows = tableMeta.length + table.getBottomRows().length;
|
36903
|
+
tableMeta.rowActive.handleKeyDown(event, reachableRows, scrollToIndex);
|
34821
36904
|
tableMeta.rowSelection.handleKeyDown(event, table);
|
34822
36905
|
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
34823
36906
|
tableMeta.rowClick.handleKeyDown(event, (_a = rows[tableMeta.rowActive.rowActiveIndex]) == null ? void 0 : _a.original);
|
@@ -35845,15 +37928,43 @@ function useTableRowActiveListener(table, tableRef) {
|
|
35845
37928
|
}, [tableMeta.rowActive.rowActiveIndex]);
|
35846
37929
|
}
|
35847
37930
|
function Actions(props) {
|
37931
|
+
var _a;
|
35848
37932
|
const { actions, actionsLength, data, isActiveRow, rowId, table } = props;
|
35849
37933
|
const { texts } = useLocalization();
|
35850
37934
|
const tableMeta = table.options.meta;
|
35851
|
-
const visibleActions = actions.map(
|
35852
|
-
|
35853
|
-
|
35854
|
-
|
35855
|
-
|
35856
|
-
|
37935
|
+
const visibleActions = actions.map(
|
37936
|
+
(action) => {
|
37937
|
+
var _a2;
|
37938
|
+
return action(data, {
|
37939
|
+
cleanup: tableMeta.rowActions.handlers["cleanup"] ?? (() => void 0),
|
37940
|
+
isEditing: ((_a2 = tableMeta.editing) == null ? void 0 : _a2.isEditing) ?? false,
|
37941
|
+
rowId,
|
37942
|
+
table
|
37943
|
+
});
|
37944
|
+
}
|
37945
|
+
).filter((action) => !!action);
|
37946
|
+
let length = actionsLength;
|
37947
|
+
if ((_a = tableMeta.editing) == null ? void 0 : _a.isEditing) {
|
37948
|
+
const lengthWithoutEditingItems = visibleActions.length - 1;
|
37949
|
+
if (lengthWithoutEditingItems < actionsLength) {
|
37950
|
+
length = lengthWithoutEditingItems;
|
37951
|
+
}
|
37952
|
+
}
|
37953
|
+
const handleMenuButtonKeyDown = (event) => {
|
37954
|
+
var _a2, _b;
|
37955
|
+
const isLastRowActive = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;
|
37956
|
+
if (event.key === "Tab" && isLastRowActive && ((_a2 = tableMeta.editing) == null ? void 0 : _a2.isEditing) && ((_b = tableMeta.editing) == null ? void 0 : _b.hasChanges())) {
|
37957
|
+
tableMeta.editing.saveChanges(table);
|
37958
|
+
}
|
37959
|
+
};
|
37960
|
+
const handleMenuContentKeyDown = (event) => {
|
37961
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
37962
|
+
event.stopPropagation();
|
37963
|
+
}
|
37964
|
+
};
|
37965
|
+
const actionsOnRow = visibleActions.length === length ? visibleActions : visibleActions.slice(0, length - 1);
|
37966
|
+
const actionsInMenu = visibleActions.slice(visibleActions.length === length ? length : length - 1);
|
37967
|
+
const className = clsx("flex justify-end text-right bg-[inherit] print:hidden");
|
35857
37968
|
return /* @__PURE__ */ React__default.createElement("span", { className }, actionsOnRow.map((button, index2) => {
|
35858
37969
|
const tooltip = String(button.props.tooltip ?? button.props["aria-label"] ?? "");
|
35859
37970
|
return React__default.cloneElement(button, {
|
@@ -35868,8 +37979,17 @@ function Actions(props) {
|
|
35868
37979
|
appearance: "transparent",
|
35869
37980
|
"aria-label": texts.table.columns.actions.tooltip,
|
35870
37981
|
icon: "more",
|
37982
|
+
onKeyDown: handleMenuButtonKeyDown,
|
35871
37983
|
tabIndex: isActiveRow ? 0 : -1,
|
35872
|
-
menu: (menuProps) => /* @__PURE__ */ React__default.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React__default.createElement(Menu$1.Content,
|
37984
|
+
menu: (menuProps) => /* @__PURE__ */ React__default.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React__default.createElement(Menu$1.Content, { onKeyDown: handleMenuContentKeyDown }, actionsInMenu.map((action, i2) => {
|
37985
|
+
var _a2;
|
37986
|
+
const item = /* @__PURE__ */ React__default.createElement(Menu$1.Item, { key: i2, ...action.props, shortcut: action.props.shortcut }, action.props["aria-label"]);
|
37987
|
+
const isFirstEditingMenuItem = ((_a2 = tableMeta.editing) == null ? void 0 : _a2.isEditing) && actionsInMenu.length > 2 && i2 === actionsInMenu.length - 2;
|
37988
|
+
if (isFirstEditingMenuItem) {
|
37989
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: i2 }, /* @__PURE__ */ React__default.createElement(Menu$1.Separator, null), item);
|
37990
|
+
}
|
37991
|
+
return item;
|
37992
|
+
})))
|
35873
37993
|
}
|
35874
37994
|
) : null);
|
35875
37995
|
}
|
@@ -35910,7 +38030,8 @@ const renderer$3 = {
|
|
35910
38030
|
'print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky right-0',
|
35911
38031
|
'group-[[data-row-active="true"][data-selected="false"]]/row:text-grey-200',
|
35912
38032
|
'group-[[data-row-selected="true"]]/row:text-blue-100',
|
35913
|
-
'group-[[data-row-selected="false"]:hover]/row:text-grey-100'
|
38033
|
+
'group-[[data-row-selected="false"]:hover]/row:text-grey-100',
|
38034
|
+
"shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]"
|
35914
38035
|
),
|
35915
38036
|
// TODO: remove when table3 is migrated, this satisfies the legacy table3 type
|
35916
38037
|
enableSearch: false,
|
@@ -36408,7 +38529,7 @@ function DisplayCell(props) {
|
|
36408
38529
|
} else {
|
36409
38530
|
content = typeof cell.column.columnDef.cell === "function" ? cell.column.columnDef.cell(cell.getContext()) : cell.getValue();
|
36410
38531
|
}
|
36411
|
-
return /* @__PURE__ */ React__default.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content);
|
38532
|
+
return /* @__PURE__ */ React__default.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content ?? columnMeta.emptyState);
|
36412
38533
|
}
|
36413
38534
|
const MemoedDisplayCell = React__default.memo(function MemoedDisplayCell2(props) {
|
36414
38535
|
const { cellRef, children, isTruncated, ...cellAttributes } = props;
|
@@ -36962,7 +39083,20 @@ function useAugmentedFocusManager() {
|
|
36962
39083
|
const focusManager = $9bf71ea28793e738$export$10c5169755ce7bd7();
|
36963
39084
|
const focusPrevious = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
|
36964
39085
|
const focusNext = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
|
36965
|
-
const focusFirst = () =>
|
39086
|
+
const focusFirst = () => {
|
39087
|
+
return focusManager == null ? void 0 : focusManager.focusFirst({
|
39088
|
+
...FOCUS_MANAGER_OPTIONS_TAB,
|
39089
|
+
accept: (element) => {
|
39090
|
+
if (!FOCUS_MANAGER_OPTIONS_TAB.accept(element)) {
|
39091
|
+
return false;
|
39092
|
+
}
|
39093
|
+
if (element.closest('[data-taco="cell-control"]')) {
|
39094
|
+
return true;
|
39095
|
+
}
|
39096
|
+
return false;
|
39097
|
+
}
|
39098
|
+
});
|
39099
|
+
};
|
36966
39100
|
const focusLast = () => focusManager == null ? void 0 : focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
|
36967
39101
|
return {
|
36968
39102
|
focusPrevious,
|
@@ -36982,7 +39116,8 @@ function Body(props) {
|
|
36982
39116
|
}
|
36983
39117
|
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
36984
39118
|
const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;
|
36985
|
-
const
|
39119
|
+
const reachableRows = tableMeta.length + table.getBottomRows().length;
|
39120
|
+
const isLastRow = tableMeta.rowActive.rowActiveIndex === reachableRows - 1;
|
36986
39121
|
if (event.key === "Tab" || enableHorizontalArrowKeyNavigation && (event.key === "ArrowLeft" || event.key === "ArrowRight")) {
|
36987
39122
|
if (event.key === "Tab" && !hasFocusableElement(event.target.closest("tr[data-row-id]"))) {
|
36988
39123
|
return;
|
@@ -37425,7 +39560,7 @@ function Search$1(props) {
|
|
37425
39560
|
tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);
|
37426
39561
|
scrollTo2(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);
|
37427
39562
|
};
|
37428
|
-
const settings = /* @__PURE__ */ React__default.createElement(
|
39563
|
+
const settings = tableMeta.server._experimentalDataLoader2 ? void 0 : /* @__PURE__ */ React__default.createElement(
|
37429
39564
|
Switch$1,
|
37430
39565
|
{
|
37431
39566
|
label: texts.table.search.excludeUnmatchedResults,
|
@@ -42335,6 +44470,9 @@ const Search = React__default.forwardRef(function ListboxSearch(props, ref) {
|
|
42335
44470
|
if (event.key === " ") {
|
42336
44471
|
return;
|
42337
44472
|
}
|
44473
|
+
if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && event.currentTarget.value.length) {
|
44474
|
+
event.stopPropagation();
|
44475
|
+
}
|
42338
44476
|
if (isAriaSelectionKey(event) || event.key === "ArrowDown" || event.key === "ArrowUp") {
|
42339
44477
|
event.preventDefault();
|
42340
44478
|
(_a = listboxRef == null ? void 0 : listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
|
@@ -42598,14 +44736,28 @@ const Select22 = React__default.forwardRef(function Select222(props, ref) {
|
|
42598
44736
|
}
|
42599
44737
|
(_a = listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
|
42600
44738
|
};
|
42601
|
-
const shouldFocusNextRef = React__default.useRef(
|
44739
|
+
const shouldFocusNextRef = React__default.useRef(void 0);
|
44740
|
+
React__default.useEffect(() => {
|
44741
|
+
const handleKeyDown2 = (event) => {
|
44742
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
44743
|
+
shouldFocusNextRef.current = event.key === "ArrowLeft" ? -1 : 1;
|
44744
|
+
setOpen(false);
|
44745
|
+
}
|
44746
|
+
};
|
44747
|
+
if (isElementInsideTable3OrReport(internalRef.current)) {
|
44748
|
+
document.addEventListener("keydown", handleKeyDown2);
|
44749
|
+
}
|
44750
|
+
return () => {
|
44751
|
+
document.removeEventListener("keydown", handleKeyDown2);
|
44752
|
+
};
|
44753
|
+
}, []);
|
42602
44754
|
const handleListboxKeyDown = (event) => {
|
42603
44755
|
if (isAriaDirectionKey(event)) {
|
42604
44756
|
setShouldPauseHoverState(true);
|
42605
44757
|
return;
|
42606
44758
|
}
|
42607
44759
|
if (event.key === "Tab") {
|
42608
|
-
shouldFocusNextRef.current =
|
44760
|
+
shouldFocusNextRef.current = event.shiftKey ? -1 : 1;
|
42609
44761
|
setOpen(false);
|
42610
44762
|
return;
|
42611
44763
|
}
|
@@ -42616,11 +44768,11 @@ const Select22 = React__default.forwardRef(function Select222(props, ref) {
|
|
42616
44768
|
};
|
42617
44769
|
const handleCloseAutoFocus = (event) => {
|
42618
44770
|
var _a, _b;
|
42619
|
-
if (shouldFocusNextRef.current) {
|
44771
|
+
if (shouldFocusNextRef.current !== void 0) {
|
42620
44772
|
event.preventDefault();
|
42621
|
-
shouldFocusNextRef.current = false;
|
42622
44773
|
(_a = otherProps.onBlur) == null ? void 0 : _a.call(otherProps, event);
|
42623
|
-
(_b = getNextFocussableElement(internalRef.current)) == null ? void 0 : _b.focus();
|
44774
|
+
(_b = getNextFocussableElement(internalRef.current, shouldFocusNextRef.current)) == null ? void 0 : _b.focus();
|
44775
|
+
shouldFocusNextRef.current = void 0;
|
42624
44776
|
return;
|
42625
44777
|
}
|
42626
44778
|
};
|
@@ -43021,8 +45173,8 @@ function FilterComparator(props) {
|
|
43021
45173
|
return /* @__PURE__ */ React__default.createElement(Select22, { ...attributes, className: "!w-32 flex-shrink-0", disabled: !column, onChange: handleChange, value }, validComparators.map((comparator) => /* @__PURE__ */ React__default.createElement(Select22.Option, { key: comparator, value: comparator }, getComparatorText(comparator, texts, column))));
|
43022
45174
|
}
|
43023
45175
|
function getComparatorText(comparator, texts, column) {
|
43024
|
-
var _a, _b;
|
43025
|
-
const isDate2 = ((
|
45176
|
+
var _a, _b, _c;
|
45177
|
+
const isDate2 = ((_a = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _a.dataType) === "date" || ((_b = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _b.dataType) === "time" || ((_c = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _c.dataType) === "datetime";
|
43026
45178
|
switch (comparator) {
|
43027
45179
|
case TableFilterComparator.Contains:
|
43028
45180
|
return texts.table.filters.comparators.contains;
|
@@ -51646,7 +53798,7 @@ function willRowMove(cell, change, rowIndex, localization) {
|
|
51646
53798
|
const { table } = cell.getContext();
|
51647
53799
|
if (willRowMoveAfterSearch(cell, change, table, localization)) {
|
51648
53800
|
return "search";
|
51649
|
-
} else if (willRowMoveAfterFilter(cell, change)) {
|
53801
|
+
} else if (willRowMoveAfterFilter(cell, change, localization)) {
|
51650
53802
|
return "filter";
|
51651
53803
|
} else if (willRowMoveAfterSorting(cell, change, rowIndex)) {
|
51652
53804
|
return "sorting";
|
@@ -51661,11 +53813,17 @@ function willRowMoveAfterSearch(cell, change, table, localization) {
|
|
51661
53813
|
const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };
|
51662
53814
|
return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);
|
51663
53815
|
}
|
51664
|
-
function willRowMoveAfterFilter(cell, change) {
|
53816
|
+
function willRowMoveAfterFilter(cell, change, localization) {
|
51665
53817
|
if (!cell.column.getIsFiltered()) {
|
51666
53818
|
return false;
|
51667
53819
|
}
|
51668
|
-
return !columnFilterFn(
|
53820
|
+
return !columnFilterFn(
|
53821
|
+
cell.row.original,
|
53822
|
+
change,
|
53823
|
+
cell.column.columnDef.meta,
|
53824
|
+
cell.column.getFilterValue(),
|
53825
|
+
localization
|
53826
|
+
);
|
51669
53827
|
}
|
51670
53828
|
function willRowMoveAfterSorting(cell, change, rowIndex) {
|
51671
53829
|
var _a;
|
@@ -51961,8 +54119,8 @@ function requireIsBuffer() {
|
|
51961
54119
|
var freeExports = exports && !exports.nodeType && exports;
|
51962
54120
|
var freeModule = freeExports && true && module && !module.nodeType && module;
|
51963
54121
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
51964
|
-
var
|
51965
|
-
var nativeIsBuffer =
|
54122
|
+
var Buffer2 = moduleExports ? root.Buffer : void 0;
|
54123
|
+
var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
|
51966
54124
|
var isBuffer2 = nativeIsBuffer || stubFalse;
|
51967
54125
|
module.exports = isBuffer2;
|
51968
54126
|
})(isBuffer, isBuffer.exports);
|
@@ -52241,7 +54399,7 @@ function require_cloneBuffer() {
|
|
52241
54399
|
var freeExports = exports && !exports.nodeType && exports;
|
52242
54400
|
var freeModule = freeExports && true && module && !module.nodeType && module;
|
52243
54401
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
52244
|
-
var
|
54402
|
+
var Buffer2 = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
|
52245
54403
|
function cloneBuffer(buffer, isDeep) {
|
52246
54404
|
if (isDeep) {
|
52247
54405
|
return buffer.slice();
|
@@ -53092,17 +55250,18 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53092
55250
|
async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
|
53093
55251
|
var _a;
|
53094
55252
|
const changes = nextValue !== void 0 ? { ...state.changes.rows[cell.row.id], [cell.column.id]: nextValue } : { ...state.changes.rows[cell.row.id] };
|
55253
|
+
const original = cell.row.original;
|
53095
55254
|
if (!Object.keys(changes).length) {
|
53096
55255
|
return;
|
53097
55256
|
}
|
53098
55257
|
let updatesForOtherCells = {};
|
53099
55258
|
if (typeof handleChange === "function" && shouldRunUpdaters) {
|
53100
55259
|
const previousRowValue = {
|
53101
|
-
...
|
55260
|
+
...original
|
53102
55261
|
//...getRowChangeset(updatersRef.current[cell.row.id], rowIdentityAccessor),
|
53103
55262
|
};
|
53104
55263
|
const nextRowValue = {
|
53105
|
-
...
|
55264
|
+
...original,
|
53106
55265
|
...changes
|
53107
55266
|
};
|
53108
55267
|
updatesForOtherCells = await handleChange(
|
@@ -53116,8 +55275,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53116
55275
|
const nextMoveReasons = { ...state.changes.moveReasons[cell.row.id] };
|
53117
55276
|
const nextCellErrors = { ...(_a = state.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
|
53118
55277
|
let validationErrors = {};
|
53119
|
-
if (validator && Object.keys(nextChanges).length &&
|
53120
|
-
const nextRowValue = { ...
|
55278
|
+
if (validator && Object.keys(nextChanges).length && original) {
|
55279
|
+
const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
|
53121
55280
|
validationErrors = await validator(nextRowValue) ?? {};
|
53122
55281
|
}
|
53123
55282
|
const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
|
@@ -53146,7 +55305,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53146
55305
|
cellErrors: nextCellErrors,
|
53147
55306
|
index: rowIndex,
|
53148
55307
|
moveReasons: nextMoveReasons,
|
53149
|
-
value: nextChanges
|
55308
|
+
value: nextChanges,
|
55309
|
+
original
|
53150
55310
|
}
|
53151
55311
|
});
|
53152
55312
|
}
|
@@ -53556,6 +55716,7 @@ function EditingControlCell(props) {
|
|
53556
55716
|
const type = columnMeta.control ?? "input";
|
53557
55717
|
const handleFocus = useEditingCellAutofocus(props);
|
53558
55718
|
const value = cell.getValue();
|
55719
|
+
const rowChanges = tableMeta.editing.getRowValue(cell.row.id);
|
53559
55720
|
const hasNonTextControl = React__default.useMemo(() => {
|
53560
55721
|
var _a;
|
53561
55722
|
return typeof type === "function" && !!((_a = cellRef.current) == null ? void 0 : _a.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
|
@@ -53571,35 +55732,22 @@ function EditingControlCell(props) {
|
|
53571
55732
|
},
|
53572
55733
|
[hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]
|
53573
55734
|
);
|
53574
|
-
const blur = React__default.useCallback(
|
53575
|
-
function blur2() {
|
53576
|
-
requestAnimationFrame(() => {
|
53577
|
-
tableMeta.editing.toggleDetailedMode(false);
|
53578
|
-
tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
|
53579
|
-
});
|
53580
|
-
},
|
53581
|
-
[hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]
|
53582
|
-
);
|
53583
55735
|
const handleBlur = React__default.useCallback(
|
53584
55736
|
(event) => {
|
53585
55737
|
if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
|
53586
55738
|
return;
|
53587
55739
|
}
|
53588
|
-
|
55740
|
+
requestAnimationFrame(() => {
|
55741
|
+
tableMeta.editing.toggleDetailedMode(false);
|
55742
|
+
tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
|
55743
|
+
});
|
53589
55744
|
},
|
53590
|
-
[
|
55745
|
+
[hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
|
53591
55746
|
);
|
53592
|
-
React__default.useEffect(() => {
|
53593
|
-
const ref = cellRef.current;
|
53594
|
-
return () => {
|
53595
|
-
if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {
|
53596
|
-
blur();
|
53597
|
-
}
|
53598
|
-
};
|
53599
|
-
}, []);
|
53600
55747
|
const error = tableMeta.editing.getCellError(cell);
|
53601
55748
|
const controlProps = {
|
53602
55749
|
dataType: columnMeta.dataType,
|
55750
|
+
disabled: tableMeta.editing.getRowStatus(cell.row.id) === "saving",
|
53603
55751
|
fontSize: tableMeta.fontSize.size,
|
53604
55752
|
id: cell.column.id,
|
53605
55753
|
invalid: !!error,
|
@@ -53627,6 +55775,7 @@ function EditingControlCell(props) {
|
|
53627
55775
|
const MemoedEditingCell = React__default.memo(function MemoedEditingCell2(props) {
|
53628
55776
|
const {
|
53629
55777
|
dataType,
|
55778
|
+
disabled,
|
53630
55779
|
fontSize,
|
53631
55780
|
id: id2,
|
53632
55781
|
invalid,
|
@@ -53644,6 +55793,7 @@ const MemoedEditingCell = React__default.memo(function MemoedEditingCell2(props)
|
|
53644
55793
|
const controlRef = React__default.useRef(null);
|
53645
55794
|
const currentValue = row[id2];
|
53646
55795
|
const commonProps = {
|
55796
|
+
disabled,
|
53647
55797
|
onBlur,
|
53648
55798
|
ref: controlRef,
|
53649
55799
|
tabIndex
|
@@ -53821,6 +55971,22 @@ function Cell$1(props) {
|
|
53821
55971
|
}
|
53822
55972
|
return /* @__PURE__ */ React__default.createElement(DisplayCell, { ...props });
|
53823
55973
|
}
|
55974
|
+
function SaveStatus(props) {
|
55975
|
+
const { rowId, table } = props;
|
55976
|
+
const { texts } = useLocalization();
|
55977
|
+
const tableMeta = table.options.meta;
|
55978
|
+
const status = tableMeta.editing.getRowStatus(rowId);
|
55979
|
+
const className = clsx(
|
55980
|
+
"col-span-full sticky ml-auto right-0 top-0 -mb-[100%] z-10 h-8 bg-[inherit] flex items-center px-1.5 shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]",
|
55981
|
+
{
|
55982
|
+
"mt-0.5": tableMeta.rowHeight.height === "short",
|
55983
|
+
"mt-1": tableMeta.rowHeight.height === "medium",
|
55984
|
+
"mt-1.5": tableMeta.rowHeight.height === "tall",
|
55985
|
+
"mt-2": tableMeta.rowHeight.height === "extra-tall"
|
55986
|
+
}
|
55987
|
+
);
|
55988
|
+
return /* @__PURE__ */ React__default.createElement("td", { className: "!contents" }, /* @__PURE__ */ React__default.createElement("span", { className }, status === "saving" ? /* @__PURE__ */ React__default.createElement(Tooltip$3, { title: texts.table3.editing.saving.progress }, /* @__PURE__ */ React__default.createElement(Spinner, { delay: 0, className: "mr-1 !h-5 !w-5" })) : /* @__PURE__ */ React__default.createElement(Tooltip$3, { title: texts.table3.editing.saving.complete }, /* @__PURE__ */ React__default.createElement(BadgeIcon, { icon: "tick", color: "green", subtle: true, className: "mr-1" }))));
|
55989
|
+
}
|
53824
55990
|
function DiscardChangesConfirmationDialog(props) {
|
53825
55991
|
const { onDiscard: handleDiscard, ...dialogProps } = props;
|
53826
55992
|
const { texts } = useLocalization();
|
@@ -53844,54 +56010,6 @@ function DiscardChangesConfirmationDialog(props) {
|
|
53844
56010
|
/* @__PURE__ */ React__default.createElement(Dialog.Footer, null, /* @__PURE__ */ React__default.createElement(Group$6, null, /* @__PURE__ */ React__default.createElement(Dialog.Close, null, /* @__PURE__ */ React__default.createElement(Button$4, { tabIndex: 0 }, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /* @__PURE__ */ React__default.createElement(Dialog.Close, null, /* @__PURE__ */ React__default.createElement(Button$4, { tabIndex: 0, appearance: "primary", onClick: handleDiscard }, texts.table3.editing.clearChangesConfirmationDialog.confirm))))
|
53845
56011
|
));
|
53846
56012
|
}
|
53847
|
-
function EditingActionsMenu(props) {
|
53848
|
-
const { hasChanges, hasErrors, onDiscard: handleDiscard, onEditingSave: handleSave, isLastRow } = props;
|
53849
|
-
const { texts } = useLocalization();
|
53850
|
-
const handleKeyDown = (event) => {
|
53851
|
-
if (isLastRow && hasChanges && event.key === "Tab") {
|
53852
|
-
handleSave();
|
53853
|
-
}
|
53854
|
-
};
|
53855
|
-
const handleMenuContentKeyDown = (event) => {
|
53856
|
-
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
53857
|
-
event.stopPropagation();
|
53858
|
-
}
|
53859
|
-
};
|
53860
|
-
return /* @__PURE__ */ React__default.createElement(
|
53861
|
-
IconButton,
|
53862
|
-
{
|
53863
|
-
appearance: "transparent",
|
53864
|
-
"aria-label": texts.table3.editing.actions.tooltip,
|
53865
|
-
icon: "more",
|
53866
|
-
onKeyDown: handleKeyDown,
|
53867
|
-
menu: (menuProps) => /* @__PURE__ */ React__default.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React__default.createElement(Menu$1.Content, { onKeyDown: handleMenuContentKeyDown }, /* @__PURE__ */ React__default.createElement(Menu$1.Item, { icon: "tick", disabled: !hasChanges || hasErrors, onClick: handleSave }, texts.table3.editing.actions.save), /* @__PURE__ */ React__default.createElement(
|
53868
|
-
Menu$1.Item,
|
53869
|
-
{
|
53870
|
-
icon: "close",
|
53871
|
-
disabled: !hasChanges,
|
53872
|
-
dialog: (props2) => /* @__PURE__ */ React__default.createElement(DiscardChangesConfirmationDialog, { ...props2, onDiscard: handleDiscard })
|
53873
|
-
},
|
53874
|
-
texts.table3.editing.actions.clear
|
53875
|
-
)))
|
53876
|
-
}
|
53877
|
-
);
|
53878
|
-
}
|
53879
|
-
function SaveStatus(props) {
|
53880
|
-
const { rowId, table } = props;
|
53881
|
-
const { texts } = useLocalization();
|
53882
|
-
const tableMeta = table.options.meta;
|
53883
|
-
const status = tableMeta.editing.getRowStatus(rowId);
|
53884
|
-
const className = clsx(
|
53885
|
-
"col-span-full sticky ml-auto right-0 top-0 -mb-[100%] z-10 h-8 bg-[inherit] flex items-center px-1.5 shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]",
|
53886
|
-
{
|
53887
|
-
"mt-0.5": tableMeta.rowHeight.height === "short",
|
53888
|
-
"mt-1": tableMeta.rowHeight.height === "medium",
|
53889
|
-
"mt-1.5": tableMeta.rowHeight.height === "tall",
|
53890
|
-
"mt-2": tableMeta.rowHeight.height === "extra-tall"
|
53891
|
-
}
|
53892
|
-
);
|
53893
|
-
return /* @__PURE__ */ React__default.createElement("td", { className: "!contents" }, /* @__PURE__ */ React__default.createElement("span", { className }, status === "saving" ? /* @__PURE__ */ React__default.createElement(Tooltip$3, { title: texts.table3.editing.saving.progress }, /* @__PURE__ */ React__default.createElement(Spinner, { delay: 0, className: "mr-1 !h-5 !w-5" })) : /* @__PURE__ */ React__default.createElement(Tooltip$3, { title: texts.table3.editing.saving.complete }, /* @__PURE__ */ React__default.createElement(BadgeIcon, { icon: "tick", color: "green", subtle: true, className: "mr-1" }))));
|
53894
|
-
}
|
53895
56013
|
function Row(props) {
|
53896
56014
|
const { row, index: index2, table } = props;
|
53897
56015
|
const focusManager = useAugmentedFocusManager();
|
@@ -53962,6 +56080,7 @@ const RENDERERS = {
|
|
53962
56080
|
cell: Cell$1
|
53963
56081
|
};
|
53964
56082
|
function useTable3(props, ref) {
|
56083
|
+
const { texts } = useLocalization();
|
53965
56084
|
const editing = useTableEditing(
|
53966
56085
|
props.enableEditing,
|
53967
56086
|
props.onEditingSave,
|
@@ -53971,7 +56090,6 @@ function useTable3(props, ref) {
|
|
53971
56090
|
props.rowIdentityAccessor,
|
53972
56091
|
props.validator
|
53973
56092
|
);
|
53974
|
-
const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
|
53975
56093
|
const data = React__default.useMemo(() => {
|
53976
56094
|
if (editing.temporaryRows.length) {
|
53977
56095
|
return (props.data ?? []).concat(editing.temporaryRows);
|
@@ -53983,31 +56101,42 @@ function useTable3(props, ref) {
|
|
53983
56101
|
data,
|
53984
56102
|
enableRowActions: editing.isEditing ? true : props.enableRowActions,
|
53985
56103
|
// Display EditingActionMenu instead of row actions while editing
|
53986
|
-
rowActions: editing.isEditing ? [
|
53987
|
-
(
|
53988
|
-
|
53989
|
-
|
53990
|
-
|
53991
|
-
|
53992
|
-
|
53993
|
-
|
53994
|
-
|
53995
|
-
editing.discardChanges(rowId, table2);
|
53996
|
-
if (editing.temporaryRows.length) {
|
53997
|
-
requestAnimationFrame(() => {
|
53998
|
-
var _a;
|
53999
|
-
return (_a = editing.createRowButtonRef.current) == null ? void 0 : _a.focus();
|
54000
|
-
});
|
54001
|
-
}
|
54002
|
-
},
|
54003
|
-
onEditingSave: async () => {
|
54004
|
-
await editing.saveChanges(table2, rowId);
|
54005
|
-
},
|
54006
|
-
isLastRow: !creationEnabled && tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1
|
56104
|
+
rowActions: editing.isEditing ? (props.rowActions ?? []).concat([
|
56105
|
+
(_1, helpers) => /* @__PURE__ */ React__default.createElement(
|
56106
|
+
IconButton,
|
56107
|
+
{
|
56108
|
+
"aria-label": texts.table3.editing.actions.save,
|
56109
|
+
icon: "tick",
|
56110
|
+
disabled: !editing.hasChanges(helpers.rowId) || editing.hasRowErrors(helpers.rowId),
|
56111
|
+
onClick: async () => {
|
56112
|
+
await editing.saveChanges(helpers.table, helpers.rowId);
|
54007
56113
|
}
|
54008
|
-
|
54009
|
-
|
54010
|
-
|
56114
|
+
}
|
56115
|
+
),
|
56116
|
+
(_1, helpers) => /* @__PURE__ */ React__default.createElement(
|
56117
|
+
IconButton,
|
56118
|
+
{
|
56119
|
+
"aria-label": texts.table3.editing.actions.clear,
|
56120
|
+
icon: "close",
|
56121
|
+
disabled: !editing.hasChanges(helpers.rowId),
|
56122
|
+
dialog: (props2) => /* @__PURE__ */ React__default.createElement(
|
56123
|
+
DiscardChangesConfirmationDialog,
|
56124
|
+
{
|
56125
|
+
...props2,
|
56126
|
+
onDiscard: () => {
|
56127
|
+
editing.discardChanges(helpers.rowId, helpers.table);
|
56128
|
+
if (editing.temporaryRows.length) {
|
56129
|
+
requestAnimationFrame(() => {
|
56130
|
+
var _a;
|
56131
|
+
return (_a = editing.createRowButtonRef.current) == null ? void 0 : _a.focus();
|
56132
|
+
});
|
56133
|
+
}
|
56134
|
+
}
|
56135
|
+
}
|
56136
|
+
)
|
56137
|
+
}
|
56138
|
+
)
|
56139
|
+
]) : props.rowActions
|
54011
56140
|
};
|
54012
56141
|
const meta = { editing };
|
54013
56142
|
const options = {
|
@@ -54153,16 +56282,15 @@ function CreateNewRow(props) {
|
|
54153
56282
|
} else {
|
54154
56283
|
tooltip = /* @__PURE__ */ React__default.createElement(Shortcut, { keys: shortcut2 });
|
54155
56284
|
}
|
54156
|
-
const className = clsx("group/row
|
56285
|
+
const className = clsx("group/row !sticky z-[21]", {
|
54157
56286
|
"bottom-10": tableMeta.footer.isEnabled,
|
54158
|
-
"bottom-0": !tableMeta.footer.isEnabled
|
54159
|
-
"border-b": !isScrolled
|
56287
|
+
"bottom-0": !tableMeta.footer.isEnabled
|
54160
56288
|
});
|
54161
|
-
return /* @__PURE__ */ React__default.createElement("tr", { "data-row-create": true, className, tabIndex: -1 }, /* @__PURE__ */ React__default.createElement("td", { className: "!bg-grey-50 col-span-full !
|
56289
|
+
return /* @__PURE__ */ React__default.createElement("tr", { "data-row-create": true, className, tabIndex: -1 }, /* @__PURE__ */ React__default.createElement("td", { className: "!bg-grey-50 col-span-full !px-1" }, /* @__PURE__ */ React__default.createElement(
|
54162
56290
|
Button$4,
|
54163
56291
|
{
|
54164
56292
|
appearance: "transparent",
|
54165
|
-
className: "group-hover:bg-grey-200 sticky left-[4px]",
|
56293
|
+
className: "group-hover:bg-grey-200 sticky left-[4px] font-bold",
|
54166
56294
|
disabled: isDisabled,
|
54167
56295
|
onClick: handleCreate,
|
54168
56296
|
ref: buttonRef,
|
@@ -54173,13 +56301,20 @@ function CreateNewRow(props) {
|
|
54173
56301
|
texts.table3.editing.buttons.create.label
|
54174
56302
|
)));
|
54175
56303
|
}
|
56304
|
+
function TemporaryRows(props) {
|
56305
|
+
return props.table.getBottomRows().map((row) => /* @__PURE__ */ React__default.createElement(TemporaryRow, { key: row.id, row, ...props }));
|
56306
|
+
}
|
54176
56307
|
function TemporaryRow(props) {
|
54177
|
-
const { createRowButtonRef,
|
56308
|
+
const { createRowButtonRef, row, table, tableMeta, tableRef } = props;
|
54178
56309
|
const handleKeyDown = async (event) => {
|
54179
|
-
var _a
|
56310
|
+
var _a;
|
56311
|
+
const target = event.target;
|
56312
|
+
if (isAriaDirectionKey(event) && isElementInsideExternalRelatedOverlay(target, tableRef)) {
|
56313
|
+
return;
|
56314
|
+
}
|
54180
56315
|
if (event.key === "ArrowDown") {
|
54181
56316
|
event.preventDefault();
|
54182
|
-
if (!isElementTriggeredFromContainer(
|
56317
|
+
if (!isElementTriggeredFromContainer(target, event.currentTarget)) {
|
54183
56318
|
const saved = await tableMeta.editing.saveChanges(table);
|
54184
56319
|
if (saved) {
|
54185
56320
|
(_a = createRowButtonRef.current) == null ? void 0 : _a.focus();
|
@@ -54188,28 +56323,15 @@ function TemporaryRow(props) {
|
|
54188
56323
|
} else if (event.key === "ArrowUp") {
|
54189
56324
|
event.preventDefault();
|
54190
56325
|
event.stopPropagation();
|
56326
|
+
const lastIndex = tableMeta.length - 1;
|
56327
|
+
tableMeta.rowActive.setRowActiveIndex(lastIndex);
|
54191
56328
|
if (tableRef.current) {
|
54192
|
-
|
54193
|
-
|
54194
|
-
|
54195
|
-
|
54196
|
-
const newRowHeight = event.currentTarget.getBoundingClientRect().height;
|
54197
|
-
const visibleHeight = tableRef.current.clientHeight - footerHeight - newRowHeight;
|
54198
|
-
const tableTopOffset = tableRef.current.getBoundingClientRect().top;
|
54199
|
-
let nextRowIndex;
|
54200
|
-
for (let index2 = availableRows.length - 1; index2 >= 0; index2--) {
|
54201
|
-
const rowRect = availableRows[index2].getBoundingClientRect();
|
54202
|
-
const topPlusHalfRow = rowRect.top + rowRect.height / 2;
|
54203
|
-
if (topPlusHalfRow - tableTopOffset <= visibleHeight) {
|
54204
|
-
nextRowIndex = index2;
|
54205
|
-
break;
|
56329
|
+
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
56330
|
+
requestAnimationFrame(() => {
|
56331
|
+
if (tableRef.current) {
|
56332
|
+
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
54206
56333
|
}
|
54207
|
-
}
|
54208
|
-
if (nextRowIndex) {
|
54209
|
-
tableMeta.rowActive.setRowActiveIndex(
|
54210
|
-
Number(availableRows[nextRowIndex < 0 ? 0 : nextRowIndex].getAttribute("data-row-index"))
|
54211
|
-
);
|
54212
|
-
}
|
56334
|
+
});
|
54213
56335
|
}
|
54214
56336
|
}
|
54215
56337
|
};
|
@@ -54224,12 +56346,11 @@ function TemporaryRow(props) {
|
|
54224
56346
|
}
|
54225
56347
|
}
|
54226
56348
|
};
|
54227
|
-
const className = clsx("group/row border-grey-300 !sticky z-[22] print:hidden", {
|
54228
|
-
"bottom-[calc(5rem_+
|
54229
|
-
"bottom-[calc(2.5rem_+
|
54230
|
-
"border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0": isScrolled
|
56349
|
+
const className = clsx("group/row border-grey-300 !sticky z-[22] print:hidden border-t-2", {
|
56350
|
+
"bottom-[calc(5rem_+_5px)] data-[row-editing-move]:bottom-[calc(5rem_+_5px)]": tableMeta.footer.isEnabled,
|
56351
|
+
"bottom-[calc(2.5rem_+_5px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_5px)]": !tableMeta.footer.isEnabled
|
54231
56352
|
});
|
54232
|
-
return /* @__PURE__ */ React__default.createElement(
|
56353
|
+
return /* @__PURE__ */ React__default.createElement(
|
54233
56354
|
Row$2,
|
54234
56355
|
{
|
54235
56356
|
key: row.id,
|
@@ -54246,7 +56367,7 @@ function TemporaryRow(props) {
|
|
54246
56367
|
hideRowActions: !tableMeta.editing.isEditing,
|
54247
56368
|
skipPageLoading: true
|
54248
56369
|
}
|
54249
|
-
)
|
56370
|
+
);
|
54250
56371
|
}
|
54251
56372
|
const Column = () => null;
|
54252
56373
|
Column.displayName = "Table3Column";
|
@@ -54299,10 +56420,9 @@ const BaseTable3 = fixedForwardRef(function BaseTable32(props, ref) {
|
|
54299
56420
|
table: table3
|
54300
56421
|
},
|
54301
56422
|
hasCreateWorkflow ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
54302
|
-
|
56423
|
+
TemporaryRows,
|
54303
56424
|
{
|
54304
56425
|
createRowButtonRef: table3.meta.editing.createRowButtonRef,
|
54305
|
-
isScrolled,
|
54306
56426
|
table: table3.instance,
|
54307
56427
|
tableMeta: table3.meta,
|
54308
56428
|
tableRef: table3.ref
|
@@ -59130,9 +61250,9 @@ _defineProperty$J(ReactFloater, "propTypes", { autoOpen: PropTypes.bool, callbac
|
|
59130
61250
|
return !props.component;
|
59131
61251
|
}), debug: PropTypes.bool, disableAnimation: PropTypes.bool, disableFlip: PropTypes.bool, disableHoverToClick: PropTypes.bool, event: PropTypes.oneOf(["hover", "click"]), eventDelay: PropTypes.number, footer: PropTypes.node, getPopper: PropTypes.func, hideArrow: PropTypes.bool, id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), offset: PropTypes.number, open: PropTypes.bool, options: PropTypes.object, placement: PropTypes.oneOf(["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end", "auto", "center"]), showCloseButton: PropTypes.bool, style: PropTypes.object, styles: PropTypes.object, target: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), title: PropTypes.node, wrapperOptions: PropTypes.shape({ offset: PropTypes.number, placement: PropTypes.oneOf(["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end", "auto"]), position: PropTypes.bool }) });
|
59132
61252
|
_defineProperty$J(ReactFloater, "defaultProps", { autoOpen: false, callback: noop$2, debug: false, disableAnimation: false, disableFlip: false, disableHoverToClick: false, event: "click", eventDelay: 0.4, getPopper: noop$2, hideArrow: false, offset: 15, placement: "bottom", showCloseButton: false, styles: {}, target: null, wrapperOptions: { position: false } });
|
59133
|
-
var
|
59134
|
-
var
|
59135
|
-
var
|
61253
|
+
var __defProp2 = Object.defineProperty;
|
61254
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
61255
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
59136
61256
|
var ACTIONS = {
|
59137
61257
|
INIT: "init",
|
59138
61258
|
START: "start",
|
@@ -59835,15 +61955,15 @@ var defaultState = {
|
|
59835
61955
|
var validKeys = objectKeys(omit(defaultState, "controlled", "size"));
|
59836
61956
|
var Store = class {
|
59837
61957
|
constructor(options) {
|
59838
|
-
|
59839
|
-
|
59840
|
-
|
59841
|
-
|
59842
|
-
|
59843
|
-
|
61958
|
+
__publicField2(this, "beaconPopper");
|
61959
|
+
__publicField2(this, "tooltipPopper");
|
61960
|
+
__publicField2(this, "data", /* @__PURE__ */ new Map());
|
61961
|
+
__publicField2(this, "listener");
|
61962
|
+
__publicField2(this, "store", /* @__PURE__ */ new Map());
|
61963
|
+
__publicField2(this, "addListener", (listener) => {
|
59844
61964
|
this.listener = listener;
|
59845
61965
|
});
|
59846
|
-
|
61966
|
+
__publicField2(this, "setSteps", (steps3) => {
|
59847
61967
|
const { size: size2, status } = this.getState();
|
59848
61968
|
const state = {
|
59849
61969
|
size: steps3.length,
|
@@ -59855,24 +61975,24 @@ var Store = class {
|
|
59855
61975
|
}
|
59856
61976
|
this.setState(state);
|
59857
61977
|
});
|
59858
|
-
|
61978
|
+
__publicField2(this, "getPopper", (name) => {
|
59859
61979
|
if (name === "beacon") {
|
59860
61980
|
return this.beaconPopper;
|
59861
61981
|
}
|
59862
61982
|
return this.tooltipPopper;
|
59863
61983
|
});
|
59864
|
-
|
61984
|
+
__publicField2(this, "setPopper", (name, popper) => {
|
59865
61985
|
if (name === "beacon") {
|
59866
61986
|
this.beaconPopper = popper;
|
59867
61987
|
} else {
|
59868
61988
|
this.tooltipPopper = popper;
|
59869
61989
|
}
|
59870
61990
|
});
|
59871
|
-
|
61991
|
+
__publicField2(this, "cleanupPoppers", () => {
|
59872
61992
|
this.beaconPopper = null;
|
59873
61993
|
this.tooltipPopper = null;
|
59874
61994
|
});
|
59875
|
-
|
61995
|
+
__publicField2(this, "close", (origin = null) => {
|
59876
61996
|
const { index: index2, status } = this.getState();
|
59877
61997
|
if (status !== STATUS.RUNNING) {
|
59878
61998
|
return;
|
@@ -59881,7 +62001,7 @@ var Store = class {
|
|
59881
62001
|
...this.getNextState({ action: ACTIONS.CLOSE, index: index2 + 1, origin })
|
59882
62002
|
});
|
59883
62003
|
});
|
59884
|
-
|
62004
|
+
__publicField2(this, "go", (nextIndex) => {
|
59885
62005
|
const { controlled, status } = this.getState();
|
59886
62006
|
if (controlled || status !== STATUS.RUNNING) {
|
59887
62007
|
return;
|
@@ -59892,15 +62012,15 @@ var Store = class {
|
|
59892
62012
|
status: step ? status : STATUS.FINISHED
|
59893
62013
|
});
|
59894
62014
|
});
|
59895
|
-
|
59896
|
-
|
62015
|
+
__publicField2(this, "info", () => this.getState());
|
62016
|
+
__publicField2(this, "next", () => {
|
59897
62017
|
const { index: index2, status } = this.getState();
|
59898
62018
|
if (status !== STATUS.RUNNING) {
|
59899
62019
|
return;
|
59900
62020
|
}
|
59901
62021
|
this.setState(this.getNextState({ action: ACTIONS.NEXT, index: index2 + 1 }));
|
59902
62022
|
});
|
59903
|
-
|
62023
|
+
__publicField2(this, "open", () => {
|
59904
62024
|
const { status } = this.getState();
|
59905
62025
|
if (status !== STATUS.RUNNING) {
|
59906
62026
|
return;
|
@@ -59909,7 +62029,7 @@ var Store = class {
|
|
59909
62029
|
...this.getNextState({ action: ACTIONS.UPDATE, lifecycle: LIFECYCLE.TOOLTIP })
|
59910
62030
|
});
|
59911
62031
|
});
|
59912
|
-
|
62032
|
+
__publicField2(this, "prev", () => {
|
59913
62033
|
const { index: index2, status } = this.getState();
|
59914
62034
|
if (status !== STATUS.RUNNING) {
|
59915
62035
|
return;
|
@@ -59918,7 +62038,7 @@ var Store = class {
|
|
59918
62038
|
...this.getNextState({ action: ACTIONS.PREV, index: index2 - 1 })
|
59919
62039
|
});
|
59920
62040
|
});
|
59921
|
-
|
62041
|
+
__publicField2(this, "reset", (restart = false) => {
|
59922
62042
|
const { controlled } = this.getState();
|
59923
62043
|
if (controlled) {
|
59924
62044
|
return;
|
@@ -59928,7 +62048,7 @@ var Store = class {
|
|
59928
62048
|
status: restart ? STATUS.RUNNING : STATUS.READY
|
59929
62049
|
});
|
59930
62050
|
});
|
59931
|
-
|
62051
|
+
__publicField2(this, "skip", () => {
|
59932
62052
|
const { status } = this.getState();
|
59933
62053
|
if (status !== STATUS.RUNNING) {
|
59934
62054
|
return;
|
@@ -59939,7 +62059,7 @@ var Store = class {
|
|
59939
62059
|
status: STATUS.SKIPPED
|
59940
62060
|
});
|
59941
62061
|
});
|
59942
|
-
|
62062
|
+
__publicField2(this, "start", (nextIndex) => {
|
59943
62063
|
const { index: index2, size: size2 } = this.getState();
|
59944
62064
|
this.setState({
|
59945
62065
|
...this.getNextState(
|
@@ -59952,7 +62072,7 @@ var Store = class {
|
|
59952
62072
|
status: size2 ? STATUS.RUNNING : STATUS.WAITING
|
59953
62073
|
});
|
59954
62074
|
});
|
59955
|
-
|
62075
|
+
__publicField2(this, "stop", (advance = false) => {
|
59956
62076
|
const { index: index2, status } = this.getState();
|
59957
62077
|
if ([STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {
|
59958
62078
|
return;
|
@@ -59962,7 +62082,7 @@ var Store = class {
|
|
59962
62082
|
status: STATUS.PAUSED
|
59963
62083
|
});
|
59964
62084
|
});
|
59965
|
-
|
62085
|
+
__publicField2(this, "update", (state) => {
|
59966
62086
|
var _a, _b;
|
59967
62087
|
if (!hasValidKeys(state, validKeys)) {
|
59968
62088
|
throw new Error(`State is not valid. Valid keys: ${validKeys.join(", ")}`);
|
@@ -60093,16 +62213,16 @@ var Spotlight_default = JoyrideSpotlight;
|
|
60093
62213
|
var JoyrideOverlay = class extends React.Component {
|
60094
62214
|
constructor() {
|
60095
62215
|
super(...arguments);
|
60096
|
-
|
60097
|
-
|
60098
|
-
|
60099
|
-
|
60100
|
-
|
62216
|
+
__publicField2(this, "isActive", false);
|
62217
|
+
__publicField2(this, "resizeTimeout");
|
62218
|
+
__publicField2(this, "scrollTimeout");
|
62219
|
+
__publicField2(this, "scrollParent");
|
62220
|
+
__publicField2(this, "state", {
|
60101
62221
|
isScrolling: false,
|
60102
62222
|
mouseOverSpotlight: false,
|
60103
62223
|
showSpotlight: true
|
60104
62224
|
});
|
60105
|
-
|
62225
|
+
__publicField2(this, "hideSpotlight", () => {
|
60106
62226
|
const { continuous: continuous2, disableOverlay, lifecycle } = this.props;
|
60107
62227
|
const hiddenLifecycles = [
|
60108
62228
|
LIFECYCLE.INIT,
|
@@ -60112,7 +62232,7 @@ var JoyrideOverlay = class extends React.Component {
|
|
60112
62232
|
];
|
60113
62233
|
return disableOverlay || (continuous2 ? hiddenLifecycles.includes(lifecycle) : lifecycle !== LIFECYCLE.TOOLTIP);
|
60114
62234
|
});
|
60115
|
-
|
62235
|
+
__publicField2(this, "handleMouseMove", (event) => {
|
60116
62236
|
const { mouseOverSpotlight } = this.state;
|
60117
62237
|
const { height, left, position, top, width } = this.spotlightStyles;
|
60118
62238
|
const offsetY = position === "fixed" ? event.clientY : event.pageY;
|
@@ -60124,7 +62244,7 @@ var JoyrideOverlay = class extends React.Component {
|
|
60124
62244
|
this.updateState({ mouseOverSpotlight: inSpotlight });
|
60125
62245
|
}
|
60126
62246
|
});
|
60127
|
-
|
62247
|
+
__publicField2(this, "handleScroll", () => {
|
60128
62248
|
const { target } = this.props;
|
60129
62249
|
const element = getElement(target);
|
60130
62250
|
if (this.scrollParent !== document) {
|
@@ -60140,7 +62260,7 @@ var JoyrideOverlay = class extends React.Component {
|
|
60140
62260
|
this.updateState({});
|
60141
62261
|
}
|
60142
62262
|
});
|
60143
|
-
|
62263
|
+
__publicField2(this, "handleResize", () => {
|
60144
62264
|
clearTimeout(this.resizeTimeout);
|
60145
62265
|
this.resizeTimeout = window.setTimeout(() => {
|
60146
62266
|
if (!this.isActive) {
|
@@ -60275,7 +62395,7 @@ var JoyrideOverlay = class extends React.Component {
|
|
60275
62395
|
var JoyridePortal = class extends React.Component {
|
60276
62396
|
constructor() {
|
60277
62397
|
super(...arguments);
|
60278
|
-
|
62398
|
+
__publicField2(this, "node", null);
|
60279
62399
|
}
|
60280
62400
|
componentDidMount() {
|
60281
62401
|
const { id: id2 } = this.props;
|
@@ -60337,29 +62457,29 @@ var JoyridePortal = class extends React.Component {
|
|
60337
62457
|
};
|
60338
62458
|
var Scope = class {
|
60339
62459
|
constructor(element, options) {
|
60340
|
-
|
60341
|
-
|
60342
|
-
|
62460
|
+
__publicField2(this, "element");
|
62461
|
+
__publicField2(this, "options");
|
62462
|
+
__publicField2(this, "canBeTabbed", (element2) => {
|
60343
62463
|
const { tabIndex } = element2;
|
60344
62464
|
if (tabIndex === null || tabIndex < 0) {
|
60345
62465
|
return false;
|
60346
62466
|
}
|
60347
62467
|
return this.canHaveFocus(element2);
|
60348
62468
|
});
|
60349
|
-
|
62469
|
+
__publicField2(this, "canHaveFocus", (element2) => {
|
60350
62470
|
const validTabNodes = /input|select|textarea|button|object/;
|
60351
62471
|
const nodeName = element2.nodeName.toLowerCase();
|
60352
62472
|
const isValid2 = validTabNodes.test(nodeName) && !element2.getAttribute("disabled") || nodeName === "a" && !!element2.getAttribute("href");
|
60353
62473
|
return isValid2 && this.isVisible(element2);
|
60354
62474
|
});
|
60355
|
-
|
60356
|
-
|
62475
|
+
__publicField2(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed));
|
62476
|
+
__publicField2(this, "handleKeyDown", (event) => {
|
60357
62477
|
const { code = "Tab" } = this.options;
|
60358
62478
|
if (event.code === code) {
|
60359
62479
|
this.interceptTab(event);
|
60360
62480
|
}
|
60361
62481
|
});
|
60362
|
-
|
62482
|
+
__publicField2(this, "interceptTab", (event) => {
|
60363
62483
|
event.preventDefault();
|
60364
62484
|
const elements = this.findValidTabElements();
|
60365
62485
|
const { shiftKey } = event;
|
@@ -60376,7 +62496,7 @@ var Scope = class {
|
|
60376
62496
|
}
|
60377
62497
|
elements[x2].focus();
|
60378
62498
|
});
|
60379
|
-
|
62499
|
+
__publicField2(this, "isHidden", (element2) => {
|
60380
62500
|
const noSize = element2.offsetWidth <= 0 && element2.offsetHeight <= 0;
|
60381
62501
|
const style = window.getComputedStyle(element2);
|
60382
62502
|
if (noSize && !element2.innerHTML) {
|
@@ -60384,7 +62504,7 @@ var Scope = class {
|
|
60384
62504
|
}
|
60385
62505
|
return noSize && style.getPropertyValue("overflow") !== "visible" || style.getPropertyValue("display") === "none";
|
60386
62506
|
});
|
60387
|
-
|
62507
|
+
__publicField2(this, "isVisible", (element2) => {
|
60388
62508
|
let parentElement = element2;
|
60389
62509
|
while (parentElement) {
|
60390
62510
|
if (parentElement instanceof HTMLElement) {
|
@@ -60399,16 +62519,16 @@ var Scope = class {
|
|
60399
62519
|
}
|
60400
62520
|
return true;
|
60401
62521
|
});
|
60402
|
-
|
62522
|
+
__publicField2(this, "removeScope", () => {
|
60403
62523
|
window.removeEventListener("keydown", this.handleKeyDown);
|
60404
62524
|
});
|
60405
|
-
|
62525
|
+
__publicField2(this, "checkFocus", (target) => {
|
60406
62526
|
if (document.activeElement !== target) {
|
60407
62527
|
target.focus();
|
60408
62528
|
window.requestAnimationFrame(() => this.checkFocus(target));
|
60409
62529
|
}
|
60410
62530
|
});
|
60411
|
-
|
62531
|
+
__publicField2(this, "setFocus", () => {
|
60412
62532
|
const { selector } = this.options;
|
60413
62533
|
if (!selector) {
|
60414
62534
|
return;
|
@@ -60430,8 +62550,8 @@ var Scope = class {
|
|
60430
62550
|
var JoyrideBeacon = class extends React.Component {
|
60431
62551
|
constructor(props) {
|
60432
62552
|
super(props);
|
60433
|
-
|
60434
|
-
|
62553
|
+
__publicField2(this, "beacon", null);
|
62554
|
+
__publicField2(this, "setBeaconRef", (c2) => {
|
60435
62555
|
this.beacon = c2;
|
60436
62556
|
});
|
60437
62557
|
if (props.beaconComponent) {
|
@@ -60613,17 +62733,17 @@ var Container_default = JoyrideTooltipContainer;
|
|
60613
62733
|
var JoyrideTooltip = class extends React.Component {
|
60614
62734
|
constructor() {
|
60615
62735
|
super(...arguments);
|
60616
|
-
|
62736
|
+
__publicField2(this, "handleClickBack", (event) => {
|
60617
62737
|
event.preventDefault();
|
60618
62738
|
const { helpers } = this.props;
|
60619
62739
|
helpers.prev();
|
60620
62740
|
});
|
60621
|
-
|
62741
|
+
__publicField2(this, "handleClickClose", (event) => {
|
60622
62742
|
event.preventDefault();
|
60623
62743
|
const { helpers } = this.props;
|
60624
62744
|
helpers.close("button_close");
|
60625
62745
|
});
|
60626
|
-
|
62746
|
+
__publicField2(this, "handleClickPrimary", (event) => {
|
60627
62747
|
event.preventDefault();
|
60628
62748
|
const { continuous: continuous2, helpers } = this.props;
|
60629
62749
|
if (!continuous2) {
|
@@ -60632,12 +62752,12 @@ var JoyrideTooltip = class extends React.Component {
|
|
60632
62752
|
}
|
60633
62753
|
helpers.next();
|
60634
62754
|
});
|
60635
|
-
|
62755
|
+
__publicField2(this, "handleClickSkip", (event) => {
|
60636
62756
|
event.preventDefault();
|
60637
62757
|
const { helpers } = this.props;
|
60638
62758
|
helpers.skip();
|
60639
62759
|
});
|
60640
|
-
|
62760
|
+
__publicField2(this, "getElementsProps", () => {
|
60641
62761
|
const { continuous: continuous2, index: index2, isLastStep, setTooltipRef, size: size2, step } = this.props;
|
60642
62762
|
const { back, close, last: last2, next, nextLabelWithProgress, skip } = step.locale;
|
60643
62763
|
const backText = getReactNodeText(back);
|
@@ -60739,19 +62859,19 @@ var JoyrideTooltip = class extends React.Component {
|
|
60739
62859
|
var JoyrideStep = class extends React.Component {
|
60740
62860
|
constructor() {
|
60741
62861
|
super(...arguments);
|
60742
|
-
|
60743
|
-
|
60744
|
-
|
62862
|
+
__publicField2(this, "scope", null);
|
62863
|
+
__publicField2(this, "tooltip", null);
|
62864
|
+
__publicField2(this, "handleClickHoverBeacon", (event) => {
|
60745
62865
|
const { step, store } = this.props;
|
60746
62866
|
if (event.type === "mouseenter" && step.event !== "hover") {
|
60747
62867
|
return;
|
60748
62868
|
}
|
60749
62869
|
store.update({ lifecycle: LIFECYCLE.TOOLTIP });
|
60750
62870
|
});
|
60751
|
-
|
62871
|
+
__publicField2(this, "setTooltipRef", (element) => {
|
60752
62872
|
this.tooltip = element;
|
60753
62873
|
});
|
60754
|
-
|
62874
|
+
__publicField2(this, "setPopper", (popper, type) => {
|
60755
62875
|
var _a;
|
60756
62876
|
const { action, lifecycle, step, store } = this.props;
|
60757
62877
|
if (type === "wrapper") {
|
@@ -60769,7 +62889,7 @@ var JoyrideStep = class extends React.Component {
|
|
60769
62889
|
step.floaterProps.getPopper(popper, type);
|
60770
62890
|
}
|
60771
62891
|
});
|
60772
|
-
|
62892
|
+
__publicField2(this, "renderTooltip", (renderProps) => {
|
60773
62893
|
const { continuous: continuous2, helpers, index: index2, size: size2, step } = this.props;
|
60774
62894
|
return /* @__PURE__ */ React.createElement(
|
60775
62895
|
JoyrideTooltip,
|
@@ -60941,15 +63061,15 @@ var JoyrideStep = class extends React.Component {
|
|
60941
63061
|
var Joyride = class extends React.Component {
|
60942
63062
|
constructor(props) {
|
60943
63063
|
super(props);
|
60944
|
-
|
60945
|
-
|
60946
|
-
|
63064
|
+
__publicField2(this, "helpers");
|
63065
|
+
__publicField2(this, "store");
|
63066
|
+
__publicField2(this, "callback", (data) => {
|
60947
63067
|
const { callback } = this.props;
|
60948
63068
|
if (src_default.function(callback)) {
|
60949
63069
|
callback(data);
|
60950
63070
|
}
|
60951
63071
|
});
|
60952
|
-
|
63072
|
+
__publicField2(this, "handleKeyboard", (event) => {
|
60953
63073
|
const { index: index2, lifecycle } = this.state;
|
60954
63074
|
const { steps: steps2 } = this.props;
|
60955
63075
|
const step = steps2[index2];
|
@@ -60959,7 +63079,7 @@ var Joyride = class extends React.Component {
|
|
60959
63079
|
}
|
60960
63080
|
}
|
60961
63081
|
});
|
60962
|
-
|
63082
|
+
__publicField2(this, "handleClickOverlay", () => {
|
60963
63083
|
const { index: index2 } = this.state;
|
60964
63084
|
const { steps: steps2 } = this.props;
|
60965
63085
|
const step = getMergedStep(this.props, steps2[index2]);
|
@@ -60967,7 +63087,7 @@ var Joyride = class extends React.Component {
|
|
60967
63087
|
this.helpers.close("overlay");
|
60968
63088
|
}
|
60969
63089
|
});
|
60970
|
-
|
63090
|
+
__publicField2(this, "syncState", (state) => {
|
60971
63091
|
this.setState(state);
|
60972
63092
|
});
|
60973
63093
|
const { debug: debug2, getHelpers, run = true, stepIndex } = props;
|
@@ -61217,7 +63337,7 @@ var Joyride = class extends React.Component {
|
|
61217
63337
|
return /* @__PURE__ */ React.createElement("div", { className: "react-joyride" }, content.step, content.overlay);
|
61218
63338
|
}
|
61219
63339
|
};
|
61220
|
-
|
63340
|
+
__publicField2(Joyride, "defaultProps", defaultProps$4);
|
61221
63341
|
var components_default = Joyride;
|
61222
63342
|
const Tooltip$2 = ({
|
61223
63343
|
continuous: continuous2,
|
@@ -86199,7 +88319,7 @@ function getDataKey(sorting, filters, hiddenColumns, search) {
|
|
86199
88319
|
function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_PAGE_SIZE$1 }) {
|
86200
88320
|
const { pageSize } = options;
|
86201
88321
|
const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
|
86202
|
-
const length = React__default.useRef(0);
|
88322
|
+
const length = React__default.useRef(void 0);
|
86203
88323
|
const [data, setData] = React__default.useState({ rows: [], pages: [], cache: {}, lastFetchedPage: void 0 });
|
86204
88324
|
const _pendingPageRequests = React__default.useRef({});
|
86205
88325
|
const _lastUsedSorting = React__default.useRef([]);
|