@economic/taco 2.60.1-date-fns.0 → 2.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/taco.cjs +2632 -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 +2632 -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
|
15215
|
+
return constructFrom(referenceDate, date2);
|
13414
15216
|
}
|
13415
|
-
function
|
13416
|
-
|
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;
|
13450
|
-
}
|
13451
|
-
function isEqual$2(leftDate, rightDate) {
|
13452
|
-
const _dateLeft = toDate(leftDate);
|
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);
|
@@ -35848,12 +37931,35 @@ function Actions(props) {
|
|
35848
37931
|
const { actions, actionsLength, data, isActiveRow, rowId, table } = props;
|
35849
37932
|
const { texts } = useLocalization();
|
35850
37933
|
const tableMeta = table.options.meta;
|
35851
|
-
const visibleActions = actions.map(
|
35852
|
-
|
35853
|
-
|
35854
|
-
|
35855
|
-
|
35856
|
-
|
37934
|
+
const visibleActions = actions.map(
|
37935
|
+
(action) => action(data, {
|
37936
|
+
cleanup: tableMeta.rowActions.handlers["cleanup"] ?? (() => void 0),
|
37937
|
+
isEditing: tableMeta.editing.isEditing,
|
37938
|
+
rowId,
|
37939
|
+
table
|
37940
|
+
})
|
37941
|
+
).filter((action) => !!action);
|
37942
|
+
let length = actionsLength;
|
37943
|
+
if (tableMeta.editing.isEditing) {
|
37944
|
+
const lengthWithoutEditingItems = visibleActions.length - 1;
|
37945
|
+
if (lengthWithoutEditingItems < actionsLength) {
|
37946
|
+
length = lengthWithoutEditingItems;
|
37947
|
+
}
|
37948
|
+
}
|
37949
|
+
const handleMenuButtonKeyDown = (event) => {
|
37950
|
+
const isLastRowActive = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;
|
37951
|
+
if (event.key === "Tab" && isLastRowActive && tableMeta.editing.isEditing && tableMeta.editing.hasChanges()) {
|
37952
|
+
tableMeta.editing.saveChanges(table);
|
37953
|
+
}
|
37954
|
+
};
|
37955
|
+
const handleMenuContentKeyDown = (event) => {
|
37956
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
37957
|
+
event.stopPropagation();
|
37958
|
+
}
|
37959
|
+
};
|
37960
|
+
const actionsOnRow = visibleActions.length === length ? visibleActions : visibleActions.slice(0, length - 1);
|
37961
|
+
const actionsInMenu = visibleActions.slice(visibleActions.length === length ? length : length - 1);
|
37962
|
+
const className = clsx("flex justify-end text-right bg-[inherit] print:hidden");
|
35857
37963
|
return /* @__PURE__ */ React__default.createElement("span", { className }, actionsOnRow.map((button, index2) => {
|
35858
37964
|
const tooltip = String(button.props.tooltip ?? button.props["aria-label"] ?? "");
|
35859
37965
|
return React__default.cloneElement(button, {
|
@@ -35868,8 +37974,16 @@ function Actions(props) {
|
|
35868
37974
|
appearance: "transparent",
|
35869
37975
|
"aria-label": texts.table.columns.actions.tooltip,
|
35870
37976
|
icon: "more",
|
37977
|
+
onKeyDown: handleMenuButtonKeyDown,
|
35871
37978
|
tabIndex: isActiveRow ? 0 : -1,
|
35872
|
-
menu: (menuProps) => /* @__PURE__ */ React__default.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React__default.createElement(Menu$1.Content,
|
37979
|
+
menu: (menuProps) => /* @__PURE__ */ React__default.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React__default.createElement(Menu$1.Content, { onKeyDown: handleMenuContentKeyDown }, actionsInMenu.map((action, i2) => {
|
37980
|
+
const item = /* @__PURE__ */ React__default.createElement(Menu$1.Item, { key: i2, ...action.props, shortcut: action.props.shortcut }, action.props["aria-label"]);
|
37981
|
+
const isFirstEditingMenuItem = tableMeta.editing.isEditing && actionsInMenu.length > 2 && i2 === actionsInMenu.length - 2;
|
37982
|
+
if (isFirstEditingMenuItem) {
|
37983
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: i2 }, /* @__PURE__ */ React__default.createElement(Menu$1.Separator, null), item);
|
37984
|
+
}
|
37985
|
+
return item;
|
37986
|
+
})))
|
35873
37987
|
}
|
35874
37988
|
) : null);
|
35875
37989
|
}
|
@@ -35910,7 +38024,8 @@ const renderer$3 = {
|
|
35910
38024
|
'print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky right-0',
|
35911
38025
|
'group-[[data-row-active="true"][data-selected="false"]]/row:text-grey-200',
|
35912
38026
|
'group-[[data-row-selected="true"]]/row:text-blue-100',
|
35913
|
-
'group-[[data-row-selected="false"]:hover]/row:text-grey-100'
|
38027
|
+
'group-[[data-row-selected="false"]:hover]/row:text-grey-100',
|
38028
|
+
"shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]"
|
35914
38029
|
),
|
35915
38030
|
// TODO: remove when table3 is migrated, this satisfies the legacy table3 type
|
35916
38031
|
enableSearch: false,
|
@@ -36408,7 +38523,7 @@ function DisplayCell(props) {
|
|
36408
38523
|
} else {
|
36409
38524
|
content = typeof cell.column.columnDef.cell === "function" ? cell.column.columnDef.cell(cell.getContext()) : cell.getValue();
|
36410
38525
|
}
|
36411
|
-
return /* @__PURE__ */ React__default.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content);
|
38526
|
+
return /* @__PURE__ */ React__default.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content ?? columnMeta.emptyState);
|
36412
38527
|
}
|
36413
38528
|
const MemoedDisplayCell = React__default.memo(function MemoedDisplayCell2(props) {
|
36414
38529
|
const { cellRef, children, isTruncated, ...cellAttributes } = props;
|
@@ -36962,7 +39077,20 @@ function useAugmentedFocusManager() {
|
|
36962
39077
|
const focusManager = $9bf71ea28793e738$export$10c5169755ce7bd7();
|
36963
39078
|
const focusPrevious = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
|
36964
39079
|
const focusNext = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
|
36965
|
-
const focusFirst = () =>
|
39080
|
+
const focusFirst = () => {
|
39081
|
+
return focusManager == null ? void 0 : focusManager.focusFirst({
|
39082
|
+
...FOCUS_MANAGER_OPTIONS_TAB,
|
39083
|
+
accept: (element) => {
|
39084
|
+
if (!FOCUS_MANAGER_OPTIONS_TAB.accept(element)) {
|
39085
|
+
return false;
|
39086
|
+
}
|
39087
|
+
if (element.closest('[data-taco="cell-control"]')) {
|
39088
|
+
return true;
|
39089
|
+
}
|
39090
|
+
return false;
|
39091
|
+
}
|
39092
|
+
});
|
39093
|
+
};
|
36966
39094
|
const focusLast = () => focusManager == null ? void 0 : focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
|
36967
39095
|
return {
|
36968
39096
|
focusPrevious,
|
@@ -36982,7 +39110,8 @@ function Body(props) {
|
|
36982
39110
|
}
|
36983
39111
|
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
36984
39112
|
const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;
|
36985
|
-
const
|
39113
|
+
const reachableRows = tableMeta.length + table.getBottomRows().length;
|
39114
|
+
const isLastRow = tableMeta.rowActive.rowActiveIndex === reachableRows - 1;
|
36986
39115
|
if (event.key === "Tab" || enableHorizontalArrowKeyNavigation && (event.key === "ArrowLeft" || event.key === "ArrowRight")) {
|
36987
39116
|
if (event.key === "Tab" && !hasFocusableElement(event.target.closest("tr[data-row-id]"))) {
|
36988
39117
|
return;
|
@@ -37425,7 +39554,7 @@ function Search$1(props) {
|
|
37425
39554
|
tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);
|
37426
39555
|
scrollTo2(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);
|
37427
39556
|
};
|
37428
|
-
const settings = /* @__PURE__ */ React__default.createElement(
|
39557
|
+
const settings = tableMeta.server._experimentalDataLoader2 ? void 0 : /* @__PURE__ */ React__default.createElement(
|
37429
39558
|
Switch$1,
|
37430
39559
|
{
|
37431
39560
|
label: texts.table.search.excludeUnmatchedResults,
|
@@ -42335,6 +44464,9 @@ const Search = React__default.forwardRef(function ListboxSearch(props, ref) {
|
|
42335
44464
|
if (event.key === " ") {
|
42336
44465
|
return;
|
42337
44466
|
}
|
44467
|
+
if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && event.currentTarget.value.length) {
|
44468
|
+
event.stopPropagation();
|
44469
|
+
}
|
42338
44470
|
if (isAriaSelectionKey(event) || event.key === "ArrowDown" || event.key === "ArrowUp") {
|
42339
44471
|
event.preventDefault();
|
42340
44472
|
(_a = listboxRef == null ? void 0 : listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
|
@@ -42598,14 +44730,28 @@ const Select22 = React__default.forwardRef(function Select222(props, ref) {
|
|
42598
44730
|
}
|
42599
44731
|
(_a = listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
|
42600
44732
|
};
|
42601
|
-
const shouldFocusNextRef = React__default.useRef(
|
44733
|
+
const shouldFocusNextRef = React__default.useRef(void 0);
|
44734
|
+
React__default.useEffect(() => {
|
44735
|
+
const handleKeyDown2 = (event) => {
|
44736
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
44737
|
+
shouldFocusNextRef.current = event.key === "ArrowLeft" ? -1 : 1;
|
44738
|
+
setOpen(false);
|
44739
|
+
}
|
44740
|
+
};
|
44741
|
+
if (isElementInsideTable3OrReport(internalRef.current)) {
|
44742
|
+
document.addEventListener("keydown", handleKeyDown2);
|
44743
|
+
}
|
44744
|
+
return () => {
|
44745
|
+
document.removeEventListener("keydown", handleKeyDown2);
|
44746
|
+
};
|
44747
|
+
}, []);
|
42602
44748
|
const handleListboxKeyDown = (event) => {
|
42603
44749
|
if (isAriaDirectionKey(event)) {
|
42604
44750
|
setShouldPauseHoverState(true);
|
42605
44751
|
return;
|
42606
44752
|
}
|
42607
44753
|
if (event.key === "Tab") {
|
42608
|
-
shouldFocusNextRef.current =
|
44754
|
+
shouldFocusNextRef.current = event.shiftKey ? -1 : 1;
|
42609
44755
|
setOpen(false);
|
42610
44756
|
return;
|
42611
44757
|
}
|
@@ -42616,11 +44762,11 @@ const Select22 = React__default.forwardRef(function Select222(props, ref) {
|
|
42616
44762
|
};
|
42617
44763
|
const handleCloseAutoFocus = (event) => {
|
42618
44764
|
var _a, _b;
|
42619
|
-
if (shouldFocusNextRef.current) {
|
44765
|
+
if (shouldFocusNextRef.current !== void 0) {
|
42620
44766
|
event.preventDefault();
|
42621
|
-
shouldFocusNextRef.current = false;
|
42622
44767
|
(_a = otherProps.onBlur) == null ? void 0 : _a.call(otherProps, event);
|
42623
|
-
(_b = getNextFocussableElement(internalRef.current)) == null ? void 0 : _b.focus();
|
44768
|
+
(_b = getNextFocussableElement(internalRef.current, shouldFocusNextRef.current)) == null ? void 0 : _b.focus();
|
44769
|
+
shouldFocusNextRef.current = void 0;
|
42624
44770
|
return;
|
42625
44771
|
}
|
42626
44772
|
};
|
@@ -43021,8 +45167,8 @@ function FilterComparator(props) {
|
|
43021
45167
|
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
45168
|
}
|
43023
45169
|
function getComparatorText(comparator, texts, column) {
|
43024
|
-
var _a, _b;
|
43025
|
-
const isDate2 = ((
|
45170
|
+
var _a, _b, _c;
|
45171
|
+
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
45172
|
switch (comparator) {
|
43027
45173
|
case TableFilterComparator.Contains:
|
43028
45174
|
return texts.table.filters.comparators.contains;
|
@@ -51646,7 +53792,7 @@ function willRowMove(cell, change, rowIndex, localization) {
|
|
51646
53792
|
const { table } = cell.getContext();
|
51647
53793
|
if (willRowMoveAfterSearch(cell, change, table, localization)) {
|
51648
53794
|
return "search";
|
51649
|
-
} else if (willRowMoveAfterFilter(cell, change)) {
|
53795
|
+
} else if (willRowMoveAfterFilter(cell, change, localization)) {
|
51650
53796
|
return "filter";
|
51651
53797
|
} else if (willRowMoveAfterSorting(cell, change, rowIndex)) {
|
51652
53798
|
return "sorting";
|
@@ -51661,11 +53807,17 @@ function willRowMoveAfterSearch(cell, change, table, localization) {
|
|
51661
53807
|
const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };
|
51662
53808
|
return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);
|
51663
53809
|
}
|
51664
|
-
function willRowMoveAfterFilter(cell, change) {
|
53810
|
+
function willRowMoveAfterFilter(cell, change, localization) {
|
51665
53811
|
if (!cell.column.getIsFiltered()) {
|
51666
53812
|
return false;
|
51667
53813
|
}
|
51668
|
-
return !columnFilterFn(
|
53814
|
+
return !columnFilterFn(
|
53815
|
+
cell.row.original,
|
53816
|
+
change,
|
53817
|
+
cell.column.columnDef.meta,
|
53818
|
+
cell.column.getFilterValue(),
|
53819
|
+
localization
|
53820
|
+
);
|
51669
53821
|
}
|
51670
53822
|
function willRowMoveAfterSorting(cell, change, rowIndex) {
|
51671
53823
|
var _a;
|
@@ -51961,8 +54113,8 @@ function requireIsBuffer() {
|
|
51961
54113
|
var freeExports = exports && !exports.nodeType && exports;
|
51962
54114
|
var freeModule = freeExports && true && module && !module.nodeType && module;
|
51963
54115
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
51964
|
-
var
|
51965
|
-
var nativeIsBuffer =
|
54116
|
+
var Buffer2 = moduleExports ? root.Buffer : void 0;
|
54117
|
+
var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
|
51966
54118
|
var isBuffer2 = nativeIsBuffer || stubFalse;
|
51967
54119
|
module.exports = isBuffer2;
|
51968
54120
|
})(isBuffer, isBuffer.exports);
|
@@ -52241,7 +54393,7 @@ function require_cloneBuffer() {
|
|
52241
54393
|
var freeExports = exports && !exports.nodeType && exports;
|
52242
54394
|
var freeModule = freeExports && true && module && !module.nodeType && module;
|
52243
54395
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
52244
|
-
var
|
54396
|
+
var Buffer2 = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
|
52245
54397
|
function cloneBuffer(buffer, isDeep) {
|
52246
54398
|
if (isDeep) {
|
52247
54399
|
return buffer.slice();
|
@@ -53092,17 +55244,18 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53092
55244
|
async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
|
53093
55245
|
var _a;
|
53094
55246
|
const changes = nextValue !== void 0 ? { ...state.changes.rows[cell.row.id], [cell.column.id]: nextValue } : { ...state.changes.rows[cell.row.id] };
|
55247
|
+
const original = cell.row.original;
|
53095
55248
|
if (!Object.keys(changes).length) {
|
53096
55249
|
return;
|
53097
55250
|
}
|
53098
55251
|
let updatesForOtherCells = {};
|
53099
55252
|
if (typeof handleChange === "function" && shouldRunUpdaters) {
|
53100
55253
|
const previousRowValue = {
|
53101
|
-
...
|
55254
|
+
...original
|
53102
55255
|
//...getRowChangeset(updatersRef.current[cell.row.id], rowIdentityAccessor),
|
53103
55256
|
};
|
53104
55257
|
const nextRowValue = {
|
53105
|
-
...
|
55258
|
+
...original,
|
53106
55259
|
...changes
|
53107
55260
|
};
|
53108
55261
|
updatesForOtherCells = await handleChange(
|
@@ -53116,8 +55269,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53116
55269
|
const nextMoveReasons = { ...state.changes.moveReasons[cell.row.id] };
|
53117
55270
|
const nextCellErrors = { ...(_a = state.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
|
53118
55271
|
let validationErrors = {};
|
53119
|
-
if (validator && Object.keys(nextChanges).length &&
|
53120
|
-
const nextRowValue = { ...
|
55272
|
+
if (validator && Object.keys(nextChanges).length && original) {
|
55273
|
+
const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
|
53121
55274
|
validationErrors = await validator(nextRowValue) ?? {};
|
53122
55275
|
}
|
53123
55276
|
const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
|
@@ -53146,7 +55299,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53146
55299
|
cellErrors: nextCellErrors,
|
53147
55300
|
index: rowIndex,
|
53148
55301
|
moveReasons: nextMoveReasons,
|
53149
|
-
value: nextChanges
|
55302
|
+
value: nextChanges,
|
55303
|
+
original
|
53150
55304
|
}
|
53151
55305
|
});
|
53152
55306
|
}
|
@@ -53556,6 +55710,7 @@ function EditingControlCell(props) {
|
|
53556
55710
|
const type = columnMeta.control ?? "input";
|
53557
55711
|
const handleFocus = useEditingCellAutofocus(props);
|
53558
55712
|
const value = cell.getValue();
|
55713
|
+
const rowChanges = tableMeta.editing.getRowValue(cell.row.id);
|
53559
55714
|
const hasNonTextControl = React__default.useMemo(() => {
|
53560
55715
|
var _a;
|
53561
55716
|
return typeof type === "function" && !!((_a = cellRef.current) == null ? void 0 : _a.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
|
@@ -53571,35 +55726,22 @@ function EditingControlCell(props) {
|
|
53571
55726
|
},
|
53572
55727
|
[hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]
|
53573
55728
|
);
|
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
55729
|
const handleBlur = React__default.useCallback(
|
53584
55730
|
(event) => {
|
53585
55731
|
if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
|
53586
55732
|
return;
|
53587
55733
|
}
|
53588
|
-
|
55734
|
+
requestAnimationFrame(() => {
|
55735
|
+
tableMeta.editing.toggleDetailedMode(false);
|
55736
|
+
tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
|
55737
|
+
});
|
53589
55738
|
},
|
53590
|
-
[
|
55739
|
+
[hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
|
53591
55740
|
);
|
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
55741
|
const error = tableMeta.editing.getCellError(cell);
|
53601
55742
|
const controlProps = {
|
53602
55743
|
dataType: columnMeta.dataType,
|
55744
|
+
disabled: tableMeta.editing.getRowStatus(cell.row.id) === "saving",
|
53603
55745
|
fontSize: tableMeta.fontSize.size,
|
53604
55746
|
id: cell.column.id,
|
53605
55747
|
invalid: !!error,
|
@@ -53627,6 +55769,7 @@ function EditingControlCell(props) {
|
|
53627
55769
|
const MemoedEditingCell = React__default.memo(function MemoedEditingCell2(props) {
|
53628
55770
|
const {
|
53629
55771
|
dataType,
|
55772
|
+
disabled,
|
53630
55773
|
fontSize,
|
53631
55774
|
id: id2,
|
53632
55775
|
invalid,
|
@@ -53644,6 +55787,7 @@ const MemoedEditingCell = React__default.memo(function MemoedEditingCell2(props)
|
|
53644
55787
|
const controlRef = React__default.useRef(null);
|
53645
55788
|
const currentValue = row[id2];
|
53646
55789
|
const commonProps = {
|
55790
|
+
disabled,
|
53647
55791
|
onBlur,
|
53648
55792
|
ref: controlRef,
|
53649
55793
|
tabIndex
|
@@ -53821,6 +55965,22 @@ function Cell$1(props) {
|
|
53821
55965
|
}
|
53822
55966
|
return /* @__PURE__ */ React__default.createElement(DisplayCell, { ...props });
|
53823
55967
|
}
|
55968
|
+
function SaveStatus(props) {
|
55969
|
+
const { rowId, table } = props;
|
55970
|
+
const { texts } = useLocalization();
|
55971
|
+
const tableMeta = table.options.meta;
|
55972
|
+
const status = tableMeta.editing.getRowStatus(rowId);
|
55973
|
+
const className = clsx(
|
55974
|
+
"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)]",
|
55975
|
+
{
|
55976
|
+
"mt-0.5": tableMeta.rowHeight.height === "short",
|
55977
|
+
"mt-1": tableMeta.rowHeight.height === "medium",
|
55978
|
+
"mt-1.5": tableMeta.rowHeight.height === "tall",
|
55979
|
+
"mt-2": tableMeta.rowHeight.height === "extra-tall"
|
55980
|
+
}
|
55981
|
+
);
|
55982
|
+
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" }))));
|
55983
|
+
}
|
53824
55984
|
function DiscardChangesConfirmationDialog(props) {
|
53825
55985
|
const { onDiscard: handleDiscard, ...dialogProps } = props;
|
53826
55986
|
const { texts } = useLocalization();
|
@@ -53844,54 +56004,6 @@ function DiscardChangesConfirmationDialog(props) {
|
|
53844
56004
|
/* @__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
56005
|
));
|
53846
56006
|
}
|
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
56007
|
function Row(props) {
|
53896
56008
|
const { row, index: index2, table } = props;
|
53897
56009
|
const focusManager = useAugmentedFocusManager();
|
@@ -53962,6 +56074,7 @@ const RENDERERS = {
|
|
53962
56074
|
cell: Cell$1
|
53963
56075
|
};
|
53964
56076
|
function useTable3(props, ref) {
|
56077
|
+
const { texts } = useLocalization();
|
53965
56078
|
const editing = useTableEditing(
|
53966
56079
|
props.enableEditing,
|
53967
56080
|
props.onEditingSave,
|
@@ -53971,7 +56084,6 @@ function useTable3(props, ref) {
|
|
53971
56084
|
props.rowIdentityAccessor,
|
53972
56085
|
props.validator
|
53973
56086
|
);
|
53974
|
-
const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
|
53975
56087
|
const data = React__default.useMemo(() => {
|
53976
56088
|
if (editing.temporaryRows.length) {
|
53977
56089
|
return (props.data ?? []).concat(editing.temporaryRows);
|
@@ -53983,31 +56095,42 @@ function useTable3(props, ref) {
|
|
53983
56095
|
data,
|
53984
56096
|
enableRowActions: editing.isEditing ? true : props.enableRowActions,
|
53985
56097
|
// 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
|
56098
|
+
rowActions: editing.isEditing ? (props.rowActions ?? []).concat([
|
56099
|
+
(_1, helpers) => /* @__PURE__ */ React__default.createElement(
|
56100
|
+
IconButton,
|
56101
|
+
{
|
56102
|
+
"aria-label": texts.table3.editing.actions.save,
|
56103
|
+
icon: "tick",
|
56104
|
+
disabled: !editing.hasChanges(helpers.rowId) || editing.hasRowErrors(helpers.rowId),
|
56105
|
+
onClick: async () => {
|
56106
|
+
await editing.saveChanges(helpers.table, helpers.rowId);
|
54007
56107
|
}
|
54008
|
-
|
54009
|
-
|
54010
|
-
|
56108
|
+
}
|
56109
|
+
),
|
56110
|
+
(_1, helpers) => /* @__PURE__ */ React__default.createElement(
|
56111
|
+
IconButton,
|
56112
|
+
{
|
56113
|
+
"aria-label": texts.table3.editing.actions.clear,
|
56114
|
+
icon: "close",
|
56115
|
+
disabled: !editing.hasChanges(helpers.rowId),
|
56116
|
+
dialog: (props2) => /* @__PURE__ */ React__default.createElement(
|
56117
|
+
DiscardChangesConfirmationDialog,
|
56118
|
+
{
|
56119
|
+
...props2,
|
56120
|
+
onDiscard: () => {
|
56121
|
+
editing.discardChanges(helpers.rowId, helpers.table);
|
56122
|
+
if (editing.temporaryRows.length) {
|
56123
|
+
requestAnimationFrame(() => {
|
56124
|
+
var _a;
|
56125
|
+
return (_a = editing.createRowButtonRef.current) == null ? void 0 : _a.focus();
|
56126
|
+
});
|
56127
|
+
}
|
56128
|
+
}
|
56129
|
+
}
|
56130
|
+
)
|
56131
|
+
}
|
56132
|
+
)
|
56133
|
+
]) : props.rowActions
|
54011
56134
|
};
|
54012
56135
|
const meta = { editing };
|
54013
56136
|
const options = {
|
@@ -54153,16 +56276,15 @@ function CreateNewRow(props) {
|
|
54153
56276
|
} else {
|
54154
56277
|
tooltip = /* @__PURE__ */ React__default.createElement(Shortcut, { keys: shortcut2 });
|
54155
56278
|
}
|
54156
|
-
const className = clsx("group/row
|
56279
|
+
const className = clsx("group/row !sticky z-[21]", {
|
54157
56280
|
"bottom-10": tableMeta.footer.isEnabled,
|
54158
|
-
"bottom-0": !tableMeta.footer.isEnabled
|
54159
|
-
"border-b": !isScrolled
|
56281
|
+
"bottom-0": !tableMeta.footer.isEnabled
|
54160
56282
|
});
|
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 !
|
56283
|
+
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
56284
|
Button$4,
|
54163
56285
|
{
|
54164
56286
|
appearance: "transparent",
|
54165
|
-
className: "group-hover:bg-grey-200 sticky left-[4px]",
|
56287
|
+
className: "group-hover:bg-grey-200 sticky left-[4px] font-bold",
|
54166
56288
|
disabled: isDisabled,
|
54167
56289
|
onClick: handleCreate,
|
54168
56290
|
ref: buttonRef,
|
@@ -54173,13 +56295,20 @@ function CreateNewRow(props) {
|
|
54173
56295
|
texts.table3.editing.buttons.create.label
|
54174
56296
|
)));
|
54175
56297
|
}
|
56298
|
+
function TemporaryRows(props) {
|
56299
|
+
return props.table.getBottomRows().map((row) => /* @__PURE__ */ React__default.createElement(TemporaryRow, { key: row.id, row, ...props }));
|
56300
|
+
}
|
54176
56301
|
function TemporaryRow(props) {
|
54177
|
-
const { createRowButtonRef,
|
56302
|
+
const { createRowButtonRef, row, table, tableMeta, tableRef } = props;
|
54178
56303
|
const handleKeyDown = async (event) => {
|
54179
|
-
var _a
|
56304
|
+
var _a;
|
56305
|
+
const target = event.target;
|
56306
|
+
if (isAriaDirectionKey(event) && isElementInsideExternalRelatedOverlay(target, tableRef)) {
|
56307
|
+
return;
|
56308
|
+
}
|
54180
56309
|
if (event.key === "ArrowDown") {
|
54181
56310
|
event.preventDefault();
|
54182
|
-
if (!isElementTriggeredFromContainer(
|
56311
|
+
if (!isElementTriggeredFromContainer(target, event.currentTarget)) {
|
54183
56312
|
const saved = await tableMeta.editing.saveChanges(table);
|
54184
56313
|
if (saved) {
|
54185
56314
|
(_a = createRowButtonRef.current) == null ? void 0 : _a.focus();
|
@@ -54188,28 +56317,15 @@ function TemporaryRow(props) {
|
|
54188
56317
|
} else if (event.key === "ArrowUp") {
|
54189
56318
|
event.preventDefault();
|
54190
56319
|
event.stopPropagation();
|
56320
|
+
const lastIndex = tableMeta.length - 1;
|
56321
|
+
tableMeta.rowActive.setRowActiveIndex(lastIndex);
|
54191
56322
|
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;
|
56323
|
+
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
56324
|
+
requestAnimationFrame(() => {
|
56325
|
+
if (tableRef.current) {
|
56326
|
+
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
54206
56327
|
}
|
54207
|
-
}
|
54208
|
-
if (nextRowIndex) {
|
54209
|
-
tableMeta.rowActive.setRowActiveIndex(
|
54210
|
-
Number(availableRows[nextRowIndex < 0 ? 0 : nextRowIndex].getAttribute("data-row-index"))
|
54211
|
-
);
|
54212
|
-
}
|
56328
|
+
});
|
54213
56329
|
}
|
54214
56330
|
}
|
54215
56331
|
};
|
@@ -54224,12 +56340,11 @@ function TemporaryRow(props) {
|
|
54224
56340
|
}
|
54225
56341
|
}
|
54226
56342
|
};
|
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
|
56343
|
+
const className = clsx("group/row border-grey-300 !sticky z-[22] print:hidden border-t-2", {
|
56344
|
+
"bottom-[calc(5rem_+_5px)] data-[row-editing-move]:bottom-[calc(5rem_+_5px)]": tableMeta.footer.isEnabled,
|
56345
|
+
"bottom-[calc(2.5rem_+_5px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_5px)]": !tableMeta.footer.isEnabled
|
54231
56346
|
});
|
54232
|
-
return /* @__PURE__ */ React__default.createElement(
|
56347
|
+
return /* @__PURE__ */ React__default.createElement(
|
54233
56348
|
Row$2,
|
54234
56349
|
{
|
54235
56350
|
key: row.id,
|
@@ -54246,7 +56361,7 @@ function TemporaryRow(props) {
|
|
54246
56361
|
hideRowActions: !tableMeta.editing.isEditing,
|
54247
56362
|
skipPageLoading: true
|
54248
56363
|
}
|
54249
|
-
)
|
56364
|
+
);
|
54250
56365
|
}
|
54251
56366
|
const Column = () => null;
|
54252
56367
|
Column.displayName = "Table3Column";
|
@@ -54299,10 +56414,9 @@ const BaseTable3 = fixedForwardRef(function BaseTable32(props, ref) {
|
|
54299
56414
|
table: table3
|
54300
56415
|
},
|
54301
56416
|
hasCreateWorkflow ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
54302
|
-
|
56417
|
+
TemporaryRows,
|
54303
56418
|
{
|
54304
56419
|
createRowButtonRef: table3.meta.editing.createRowButtonRef,
|
54305
|
-
isScrolled,
|
54306
56420
|
table: table3.instance,
|
54307
56421
|
tableMeta: table3.meta,
|
54308
56422
|
tableRef: table3.ref
|
@@ -59130,9 +61244,9 @@ _defineProperty$J(ReactFloater, "propTypes", { autoOpen: PropTypes.bool, callbac
|
|
59130
61244
|
return !props.component;
|
59131
61245
|
}), 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
61246
|
_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
|
61247
|
+
var __defProp2 = Object.defineProperty;
|
61248
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
61249
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
59136
61250
|
var ACTIONS = {
|
59137
61251
|
INIT: "init",
|
59138
61252
|
START: "start",
|
@@ -59835,15 +61949,15 @@ var defaultState = {
|
|
59835
61949
|
var validKeys = objectKeys(omit(defaultState, "controlled", "size"));
|
59836
61950
|
var Store = class {
|
59837
61951
|
constructor(options) {
|
59838
|
-
|
59839
|
-
|
59840
|
-
|
59841
|
-
|
59842
|
-
|
59843
|
-
|
61952
|
+
__publicField2(this, "beaconPopper");
|
61953
|
+
__publicField2(this, "tooltipPopper");
|
61954
|
+
__publicField2(this, "data", /* @__PURE__ */ new Map());
|
61955
|
+
__publicField2(this, "listener");
|
61956
|
+
__publicField2(this, "store", /* @__PURE__ */ new Map());
|
61957
|
+
__publicField2(this, "addListener", (listener) => {
|
59844
61958
|
this.listener = listener;
|
59845
61959
|
});
|
59846
|
-
|
61960
|
+
__publicField2(this, "setSteps", (steps3) => {
|
59847
61961
|
const { size: size2, status } = this.getState();
|
59848
61962
|
const state = {
|
59849
61963
|
size: steps3.length,
|
@@ -59855,24 +61969,24 @@ var Store = class {
|
|
59855
61969
|
}
|
59856
61970
|
this.setState(state);
|
59857
61971
|
});
|
59858
|
-
|
61972
|
+
__publicField2(this, "getPopper", (name) => {
|
59859
61973
|
if (name === "beacon") {
|
59860
61974
|
return this.beaconPopper;
|
59861
61975
|
}
|
59862
61976
|
return this.tooltipPopper;
|
59863
61977
|
});
|
59864
|
-
|
61978
|
+
__publicField2(this, "setPopper", (name, popper) => {
|
59865
61979
|
if (name === "beacon") {
|
59866
61980
|
this.beaconPopper = popper;
|
59867
61981
|
} else {
|
59868
61982
|
this.tooltipPopper = popper;
|
59869
61983
|
}
|
59870
61984
|
});
|
59871
|
-
|
61985
|
+
__publicField2(this, "cleanupPoppers", () => {
|
59872
61986
|
this.beaconPopper = null;
|
59873
61987
|
this.tooltipPopper = null;
|
59874
61988
|
});
|
59875
|
-
|
61989
|
+
__publicField2(this, "close", (origin = null) => {
|
59876
61990
|
const { index: index2, status } = this.getState();
|
59877
61991
|
if (status !== STATUS.RUNNING) {
|
59878
61992
|
return;
|
@@ -59881,7 +61995,7 @@ var Store = class {
|
|
59881
61995
|
...this.getNextState({ action: ACTIONS.CLOSE, index: index2 + 1, origin })
|
59882
61996
|
});
|
59883
61997
|
});
|
59884
|
-
|
61998
|
+
__publicField2(this, "go", (nextIndex) => {
|
59885
61999
|
const { controlled, status } = this.getState();
|
59886
62000
|
if (controlled || status !== STATUS.RUNNING) {
|
59887
62001
|
return;
|
@@ -59892,15 +62006,15 @@ var Store = class {
|
|
59892
62006
|
status: step ? status : STATUS.FINISHED
|
59893
62007
|
});
|
59894
62008
|
});
|
59895
|
-
|
59896
|
-
|
62009
|
+
__publicField2(this, "info", () => this.getState());
|
62010
|
+
__publicField2(this, "next", () => {
|
59897
62011
|
const { index: index2, status } = this.getState();
|
59898
62012
|
if (status !== STATUS.RUNNING) {
|
59899
62013
|
return;
|
59900
62014
|
}
|
59901
62015
|
this.setState(this.getNextState({ action: ACTIONS.NEXT, index: index2 + 1 }));
|
59902
62016
|
});
|
59903
|
-
|
62017
|
+
__publicField2(this, "open", () => {
|
59904
62018
|
const { status } = this.getState();
|
59905
62019
|
if (status !== STATUS.RUNNING) {
|
59906
62020
|
return;
|
@@ -59909,7 +62023,7 @@ var Store = class {
|
|
59909
62023
|
...this.getNextState({ action: ACTIONS.UPDATE, lifecycle: LIFECYCLE.TOOLTIP })
|
59910
62024
|
});
|
59911
62025
|
});
|
59912
|
-
|
62026
|
+
__publicField2(this, "prev", () => {
|
59913
62027
|
const { index: index2, status } = this.getState();
|
59914
62028
|
if (status !== STATUS.RUNNING) {
|
59915
62029
|
return;
|
@@ -59918,7 +62032,7 @@ var Store = class {
|
|
59918
62032
|
...this.getNextState({ action: ACTIONS.PREV, index: index2 - 1 })
|
59919
62033
|
});
|
59920
62034
|
});
|
59921
|
-
|
62035
|
+
__publicField2(this, "reset", (restart = false) => {
|
59922
62036
|
const { controlled } = this.getState();
|
59923
62037
|
if (controlled) {
|
59924
62038
|
return;
|
@@ -59928,7 +62042,7 @@ var Store = class {
|
|
59928
62042
|
status: restart ? STATUS.RUNNING : STATUS.READY
|
59929
62043
|
});
|
59930
62044
|
});
|
59931
|
-
|
62045
|
+
__publicField2(this, "skip", () => {
|
59932
62046
|
const { status } = this.getState();
|
59933
62047
|
if (status !== STATUS.RUNNING) {
|
59934
62048
|
return;
|
@@ -59939,7 +62053,7 @@ var Store = class {
|
|
59939
62053
|
status: STATUS.SKIPPED
|
59940
62054
|
});
|
59941
62055
|
});
|
59942
|
-
|
62056
|
+
__publicField2(this, "start", (nextIndex) => {
|
59943
62057
|
const { index: index2, size: size2 } = this.getState();
|
59944
62058
|
this.setState({
|
59945
62059
|
...this.getNextState(
|
@@ -59952,7 +62066,7 @@ var Store = class {
|
|
59952
62066
|
status: size2 ? STATUS.RUNNING : STATUS.WAITING
|
59953
62067
|
});
|
59954
62068
|
});
|
59955
|
-
|
62069
|
+
__publicField2(this, "stop", (advance = false) => {
|
59956
62070
|
const { index: index2, status } = this.getState();
|
59957
62071
|
if ([STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {
|
59958
62072
|
return;
|
@@ -59962,7 +62076,7 @@ var Store = class {
|
|
59962
62076
|
status: STATUS.PAUSED
|
59963
62077
|
});
|
59964
62078
|
});
|
59965
|
-
|
62079
|
+
__publicField2(this, "update", (state) => {
|
59966
62080
|
var _a, _b;
|
59967
62081
|
if (!hasValidKeys(state, validKeys)) {
|
59968
62082
|
throw new Error(`State is not valid. Valid keys: ${validKeys.join(", ")}`);
|
@@ -60093,16 +62207,16 @@ var Spotlight_default = JoyrideSpotlight;
|
|
60093
62207
|
var JoyrideOverlay = class extends React.Component {
|
60094
62208
|
constructor() {
|
60095
62209
|
super(...arguments);
|
60096
|
-
|
60097
|
-
|
60098
|
-
|
60099
|
-
|
60100
|
-
|
62210
|
+
__publicField2(this, "isActive", false);
|
62211
|
+
__publicField2(this, "resizeTimeout");
|
62212
|
+
__publicField2(this, "scrollTimeout");
|
62213
|
+
__publicField2(this, "scrollParent");
|
62214
|
+
__publicField2(this, "state", {
|
60101
62215
|
isScrolling: false,
|
60102
62216
|
mouseOverSpotlight: false,
|
60103
62217
|
showSpotlight: true
|
60104
62218
|
});
|
60105
|
-
|
62219
|
+
__publicField2(this, "hideSpotlight", () => {
|
60106
62220
|
const { continuous: continuous2, disableOverlay, lifecycle } = this.props;
|
60107
62221
|
const hiddenLifecycles = [
|
60108
62222
|
LIFECYCLE.INIT,
|
@@ -60112,7 +62226,7 @@ var JoyrideOverlay = class extends React.Component {
|
|
60112
62226
|
];
|
60113
62227
|
return disableOverlay || (continuous2 ? hiddenLifecycles.includes(lifecycle) : lifecycle !== LIFECYCLE.TOOLTIP);
|
60114
62228
|
});
|
60115
|
-
|
62229
|
+
__publicField2(this, "handleMouseMove", (event) => {
|
60116
62230
|
const { mouseOverSpotlight } = this.state;
|
60117
62231
|
const { height, left, position, top, width } = this.spotlightStyles;
|
60118
62232
|
const offsetY = position === "fixed" ? event.clientY : event.pageY;
|
@@ -60124,7 +62238,7 @@ var JoyrideOverlay = class extends React.Component {
|
|
60124
62238
|
this.updateState({ mouseOverSpotlight: inSpotlight });
|
60125
62239
|
}
|
60126
62240
|
});
|
60127
|
-
|
62241
|
+
__publicField2(this, "handleScroll", () => {
|
60128
62242
|
const { target } = this.props;
|
60129
62243
|
const element = getElement(target);
|
60130
62244
|
if (this.scrollParent !== document) {
|
@@ -60140,7 +62254,7 @@ var JoyrideOverlay = class extends React.Component {
|
|
60140
62254
|
this.updateState({});
|
60141
62255
|
}
|
60142
62256
|
});
|
60143
|
-
|
62257
|
+
__publicField2(this, "handleResize", () => {
|
60144
62258
|
clearTimeout(this.resizeTimeout);
|
60145
62259
|
this.resizeTimeout = window.setTimeout(() => {
|
60146
62260
|
if (!this.isActive) {
|
@@ -60275,7 +62389,7 @@ var JoyrideOverlay = class extends React.Component {
|
|
60275
62389
|
var JoyridePortal = class extends React.Component {
|
60276
62390
|
constructor() {
|
60277
62391
|
super(...arguments);
|
60278
|
-
|
62392
|
+
__publicField2(this, "node", null);
|
60279
62393
|
}
|
60280
62394
|
componentDidMount() {
|
60281
62395
|
const { id: id2 } = this.props;
|
@@ -60337,29 +62451,29 @@ var JoyridePortal = class extends React.Component {
|
|
60337
62451
|
};
|
60338
62452
|
var Scope = class {
|
60339
62453
|
constructor(element, options) {
|
60340
|
-
|
60341
|
-
|
60342
|
-
|
62454
|
+
__publicField2(this, "element");
|
62455
|
+
__publicField2(this, "options");
|
62456
|
+
__publicField2(this, "canBeTabbed", (element2) => {
|
60343
62457
|
const { tabIndex } = element2;
|
60344
62458
|
if (tabIndex === null || tabIndex < 0) {
|
60345
62459
|
return false;
|
60346
62460
|
}
|
60347
62461
|
return this.canHaveFocus(element2);
|
60348
62462
|
});
|
60349
|
-
|
62463
|
+
__publicField2(this, "canHaveFocus", (element2) => {
|
60350
62464
|
const validTabNodes = /input|select|textarea|button|object/;
|
60351
62465
|
const nodeName = element2.nodeName.toLowerCase();
|
60352
62466
|
const isValid2 = validTabNodes.test(nodeName) && !element2.getAttribute("disabled") || nodeName === "a" && !!element2.getAttribute("href");
|
60353
62467
|
return isValid2 && this.isVisible(element2);
|
60354
62468
|
});
|
60355
|
-
|
60356
|
-
|
62469
|
+
__publicField2(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed));
|
62470
|
+
__publicField2(this, "handleKeyDown", (event) => {
|
60357
62471
|
const { code = "Tab" } = this.options;
|
60358
62472
|
if (event.code === code) {
|
60359
62473
|
this.interceptTab(event);
|
60360
62474
|
}
|
60361
62475
|
});
|
60362
|
-
|
62476
|
+
__publicField2(this, "interceptTab", (event) => {
|
60363
62477
|
event.preventDefault();
|
60364
62478
|
const elements = this.findValidTabElements();
|
60365
62479
|
const { shiftKey } = event;
|
@@ -60376,7 +62490,7 @@ var Scope = class {
|
|
60376
62490
|
}
|
60377
62491
|
elements[x2].focus();
|
60378
62492
|
});
|
60379
|
-
|
62493
|
+
__publicField2(this, "isHidden", (element2) => {
|
60380
62494
|
const noSize = element2.offsetWidth <= 0 && element2.offsetHeight <= 0;
|
60381
62495
|
const style = window.getComputedStyle(element2);
|
60382
62496
|
if (noSize && !element2.innerHTML) {
|
@@ -60384,7 +62498,7 @@ var Scope = class {
|
|
60384
62498
|
}
|
60385
62499
|
return noSize && style.getPropertyValue("overflow") !== "visible" || style.getPropertyValue("display") === "none";
|
60386
62500
|
});
|
60387
|
-
|
62501
|
+
__publicField2(this, "isVisible", (element2) => {
|
60388
62502
|
let parentElement = element2;
|
60389
62503
|
while (parentElement) {
|
60390
62504
|
if (parentElement instanceof HTMLElement) {
|
@@ -60399,16 +62513,16 @@ var Scope = class {
|
|
60399
62513
|
}
|
60400
62514
|
return true;
|
60401
62515
|
});
|
60402
|
-
|
62516
|
+
__publicField2(this, "removeScope", () => {
|
60403
62517
|
window.removeEventListener("keydown", this.handleKeyDown);
|
60404
62518
|
});
|
60405
|
-
|
62519
|
+
__publicField2(this, "checkFocus", (target) => {
|
60406
62520
|
if (document.activeElement !== target) {
|
60407
62521
|
target.focus();
|
60408
62522
|
window.requestAnimationFrame(() => this.checkFocus(target));
|
60409
62523
|
}
|
60410
62524
|
});
|
60411
|
-
|
62525
|
+
__publicField2(this, "setFocus", () => {
|
60412
62526
|
const { selector } = this.options;
|
60413
62527
|
if (!selector) {
|
60414
62528
|
return;
|
@@ -60430,8 +62544,8 @@ var Scope = class {
|
|
60430
62544
|
var JoyrideBeacon = class extends React.Component {
|
60431
62545
|
constructor(props) {
|
60432
62546
|
super(props);
|
60433
|
-
|
60434
|
-
|
62547
|
+
__publicField2(this, "beacon", null);
|
62548
|
+
__publicField2(this, "setBeaconRef", (c2) => {
|
60435
62549
|
this.beacon = c2;
|
60436
62550
|
});
|
60437
62551
|
if (props.beaconComponent) {
|
@@ -60613,17 +62727,17 @@ var Container_default = JoyrideTooltipContainer;
|
|
60613
62727
|
var JoyrideTooltip = class extends React.Component {
|
60614
62728
|
constructor() {
|
60615
62729
|
super(...arguments);
|
60616
|
-
|
62730
|
+
__publicField2(this, "handleClickBack", (event) => {
|
60617
62731
|
event.preventDefault();
|
60618
62732
|
const { helpers } = this.props;
|
60619
62733
|
helpers.prev();
|
60620
62734
|
});
|
60621
|
-
|
62735
|
+
__publicField2(this, "handleClickClose", (event) => {
|
60622
62736
|
event.preventDefault();
|
60623
62737
|
const { helpers } = this.props;
|
60624
62738
|
helpers.close("button_close");
|
60625
62739
|
});
|
60626
|
-
|
62740
|
+
__publicField2(this, "handleClickPrimary", (event) => {
|
60627
62741
|
event.preventDefault();
|
60628
62742
|
const { continuous: continuous2, helpers } = this.props;
|
60629
62743
|
if (!continuous2) {
|
@@ -60632,12 +62746,12 @@ var JoyrideTooltip = class extends React.Component {
|
|
60632
62746
|
}
|
60633
62747
|
helpers.next();
|
60634
62748
|
});
|
60635
|
-
|
62749
|
+
__publicField2(this, "handleClickSkip", (event) => {
|
60636
62750
|
event.preventDefault();
|
60637
62751
|
const { helpers } = this.props;
|
60638
62752
|
helpers.skip();
|
60639
62753
|
});
|
60640
|
-
|
62754
|
+
__publicField2(this, "getElementsProps", () => {
|
60641
62755
|
const { continuous: continuous2, index: index2, isLastStep, setTooltipRef, size: size2, step } = this.props;
|
60642
62756
|
const { back, close, last: last2, next, nextLabelWithProgress, skip } = step.locale;
|
60643
62757
|
const backText = getReactNodeText(back);
|
@@ -60739,19 +62853,19 @@ var JoyrideTooltip = class extends React.Component {
|
|
60739
62853
|
var JoyrideStep = class extends React.Component {
|
60740
62854
|
constructor() {
|
60741
62855
|
super(...arguments);
|
60742
|
-
|
60743
|
-
|
60744
|
-
|
62856
|
+
__publicField2(this, "scope", null);
|
62857
|
+
__publicField2(this, "tooltip", null);
|
62858
|
+
__publicField2(this, "handleClickHoverBeacon", (event) => {
|
60745
62859
|
const { step, store } = this.props;
|
60746
62860
|
if (event.type === "mouseenter" && step.event !== "hover") {
|
60747
62861
|
return;
|
60748
62862
|
}
|
60749
62863
|
store.update({ lifecycle: LIFECYCLE.TOOLTIP });
|
60750
62864
|
});
|
60751
|
-
|
62865
|
+
__publicField2(this, "setTooltipRef", (element) => {
|
60752
62866
|
this.tooltip = element;
|
60753
62867
|
});
|
60754
|
-
|
62868
|
+
__publicField2(this, "setPopper", (popper, type) => {
|
60755
62869
|
var _a;
|
60756
62870
|
const { action, lifecycle, step, store } = this.props;
|
60757
62871
|
if (type === "wrapper") {
|
@@ -60769,7 +62883,7 @@ var JoyrideStep = class extends React.Component {
|
|
60769
62883
|
step.floaterProps.getPopper(popper, type);
|
60770
62884
|
}
|
60771
62885
|
});
|
60772
|
-
|
62886
|
+
__publicField2(this, "renderTooltip", (renderProps) => {
|
60773
62887
|
const { continuous: continuous2, helpers, index: index2, size: size2, step } = this.props;
|
60774
62888
|
return /* @__PURE__ */ React.createElement(
|
60775
62889
|
JoyrideTooltip,
|
@@ -60941,15 +63055,15 @@ var JoyrideStep = class extends React.Component {
|
|
60941
63055
|
var Joyride = class extends React.Component {
|
60942
63056
|
constructor(props) {
|
60943
63057
|
super(props);
|
60944
|
-
|
60945
|
-
|
60946
|
-
|
63058
|
+
__publicField2(this, "helpers");
|
63059
|
+
__publicField2(this, "store");
|
63060
|
+
__publicField2(this, "callback", (data) => {
|
60947
63061
|
const { callback } = this.props;
|
60948
63062
|
if (src_default.function(callback)) {
|
60949
63063
|
callback(data);
|
60950
63064
|
}
|
60951
63065
|
});
|
60952
|
-
|
63066
|
+
__publicField2(this, "handleKeyboard", (event) => {
|
60953
63067
|
const { index: index2, lifecycle } = this.state;
|
60954
63068
|
const { steps: steps2 } = this.props;
|
60955
63069
|
const step = steps2[index2];
|
@@ -60959,7 +63073,7 @@ var Joyride = class extends React.Component {
|
|
60959
63073
|
}
|
60960
63074
|
}
|
60961
63075
|
});
|
60962
|
-
|
63076
|
+
__publicField2(this, "handleClickOverlay", () => {
|
60963
63077
|
const { index: index2 } = this.state;
|
60964
63078
|
const { steps: steps2 } = this.props;
|
60965
63079
|
const step = getMergedStep(this.props, steps2[index2]);
|
@@ -60967,7 +63081,7 @@ var Joyride = class extends React.Component {
|
|
60967
63081
|
this.helpers.close("overlay");
|
60968
63082
|
}
|
60969
63083
|
});
|
60970
|
-
|
63084
|
+
__publicField2(this, "syncState", (state) => {
|
60971
63085
|
this.setState(state);
|
60972
63086
|
});
|
60973
63087
|
const { debug: debug2, getHelpers, run = true, stepIndex } = props;
|
@@ -61217,7 +63331,7 @@ var Joyride = class extends React.Component {
|
|
61217
63331
|
return /* @__PURE__ */ React.createElement("div", { className: "react-joyride" }, content.step, content.overlay);
|
61218
63332
|
}
|
61219
63333
|
};
|
61220
|
-
|
63334
|
+
__publicField2(Joyride, "defaultProps", defaultProps$4);
|
61221
63335
|
var components_default = Joyride;
|
61222
63336
|
const Tooltip$2 = ({
|
61223
63337
|
continuous: continuous2,
|
@@ -86199,7 +88313,7 @@ function getDataKey(sorting, filters, hiddenColumns, search) {
|
|
86199
88313
|
function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_PAGE_SIZE$1 }) {
|
86200
88314
|
const { pageSize } = options;
|
86201
88315
|
const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
|
86202
|
-
const length = React__default.useRef(0);
|
88316
|
+
const length = React__default.useRef(void 0);
|
86203
88317
|
const [data, setData] = React__default.useState({ rows: [], pages: [], cache: {}, lastFetchedPage: void 0 });
|
86204
88318
|
const _pendingPageRequests = React__default.useRef({});
|
86205
88319
|
const _lastUsedSorting = React__default.useRef([]);
|