@economic/taco 2.60.1-date-fns.0 → 2.61.0-combobox-search.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 +2375 -269
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.css +37 -31
- package/dist/taco.d.ts +2 -0
- package/dist/taco.js +2375 -269
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
2
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
6
|
const React = require("react");
|
4
7
|
const ReactDOM = require("react-dom");
|
@@ -4561,7 +4564,7 @@ var zeroGap = {
|
|
4561
4564
|
right: 0,
|
4562
4565
|
gap: 0
|
4563
4566
|
};
|
4564
|
-
var parse$
|
4567
|
+
var parse$3 = function(x2) {
|
4565
4568
|
return parseInt(x2 || "", 10) || 0;
|
4566
4569
|
};
|
4567
4570
|
var getOffset$1 = function(gapMode) {
|
@@ -4569,7 +4572,7 @@ var getOffset$1 = function(gapMode) {
|
|
4569
4572
|
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
4570
4573
|
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
4571
4574
|
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
4572
|
-
return [parse$
|
4575
|
+
return [parse$3(left), parse$3(top), parse$3(right)];
|
4573
4576
|
};
|
4574
4577
|
var getGapWidth = function(gapMode) {
|
4575
4578
|
if (gapMode === void 0) {
|
@@ -9770,7 +9773,7 @@ const useMergedRef = (ref) => {
|
|
9770
9773
|
return internalRef;
|
9771
9774
|
};
|
9772
9775
|
const FOCUSABLE_ELEMENTS = [
|
9773
|
-
|
9776
|
+
'[tabindex]:not([tabindex="-1"]):not([disabled])',
|
9774
9777
|
"input:not([disabled])",
|
9775
9778
|
"select:not([disabled])",
|
9776
9779
|
"textarea:not([disabled])",
|
@@ -9783,7 +9786,7 @@ const FOCUSABLE_ELEMENTS = [
|
|
9783
9786
|
"embed",
|
9784
9787
|
"audio[controls]",
|
9785
9788
|
"video[controls]",
|
9786
|
-
|
9789
|
+
'[contenteditable]:not([contenteditable="false"]):not([disabled])',
|
9787
9790
|
"details:not([disabled])",
|
9788
9791
|
"summary:not(:disabled)"
|
9789
9792
|
];
|
@@ -9808,14 +9811,14 @@ const getIndexOfFirstChildOverflowingParent = (element, overscan = 0) => {
|
|
9808
9811
|
}
|
9809
9812
|
return boundaryChildIndex;
|
9810
9813
|
};
|
9811
|
-
const getNextFocussableElement = (currentElement) => {
|
9814
|
+
const getNextFocussableElement = (currentElement, direction = 1) => {
|
9812
9815
|
if (!currentElement) {
|
9813
9816
|
return null;
|
9814
9817
|
}
|
9815
9818
|
let focussableElements = [...document.querySelectorAll(FOCUSABLE_ELEMENTS.join(","))];
|
9816
9819
|
const currentElementIndex = focussableElements.indexOf(currentElement);
|
9817
9820
|
if (currentElementIndex > -1) {
|
9818
|
-
focussableElements = focussableElements.slice(currentElementIndex +
|
9821
|
+
focussableElements = focussableElements.slice(currentElementIndex + direction).filter((element) => element.getAttribute("tabindex") !== "-1");
|
9819
9822
|
if (focussableElements.length) {
|
9820
9823
|
focussableElements = focussableElements.filter((element) => {
|
9821
9824
|
var _a;
|
@@ -9864,6 +9867,9 @@ function isSiblingElementInsideSameParentOverlay(element, sibling) {
|
|
9864
9867
|
var _a;
|
9865
9868
|
return !!((_a = element == null ? void 0 : element.closest("[role=dialog],[role=menu]")) == null ? void 0 : _a.contains(sibling));
|
9866
9869
|
}
|
9870
|
+
function isElementInsideExternalRelatedOverlay(element, tableRef) {
|
9871
|
+
return isElementInsideOverlay(element) && !isSiblingElementInsideSameParentOverlay(element, tableRef.current) || isElementInteractive(element) && !isElementInsideOrTriggeredFromContainer(element, tableRef.current);
|
9872
|
+
}
|
9867
9873
|
function isElementInteractive(element) {
|
9868
9874
|
if (!element) {
|
9869
9875
|
return false;
|
@@ -11886,13 +11892,16 @@ function addMonths(date2, amount) {
|
|
11886
11892
|
}
|
11887
11893
|
const millisecondsInWeek = 6048e5;
|
11888
11894
|
const millisecondsInDay = 864e5;
|
11895
|
+
const millisecondsInMinute = 6e4;
|
11896
|
+
const millisecondsInHour = 36e5;
|
11897
|
+
const millisecondsInSecond = 1e3;
|
11889
11898
|
let defaultOptions$3 = {};
|
11890
|
-
function getDefaultOptions() {
|
11899
|
+
function getDefaultOptions$1() {
|
11891
11900
|
return defaultOptions$3;
|
11892
11901
|
}
|
11893
11902
|
function startOfWeek(date2, options) {
|
11894
11903
|
var _a, _b, _c, _d;
|
11895
|
-
const defaultOptions2 = getDefaultOptions();
|
11904
|
+
const defaultOptions2 = getDefaultOptions$1();
|
11896
11905
|
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;
|
11897
11906
|
const _date = toDate(date2);
|
11898
11907
|
const day = _date.getDay();
|
@@ -12036,7 +12045,7 @@ function startOfYear(date2) {
|
|
12036
12045
|
}
|
12037
12046
|
function endOfWeek(date2, options) {
|
12038
12047
|
var _a, _b, _c, _d;
|
12039
|
-
const defaultOptions2 = getDefaultOptions();
|
12048
|
+
const defaultOptions2 = getDefaultOptions$1();
|
12040
12049
|
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;
|
12041
12050
|
const _date = toDate(date2);
|
12042
12051
|
const day = _date.getDay();
|
@@ -12552,7 +12561,7 @@ function getWeekYear(date2, options) {
|
|
12552
12561
|
var _a, _b, _c, _d;
|
12553
12562
|
const _date = toDate(date2);
|
12554
12563
|
const year = _date.getFullYear();
|
12555
|
-
const defaultOptions2 = getDefaultOptions();
|
12564
|
+
const defaultOptions2 = getDefaultOptions$1();
|
12556
12565
|
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;
|
12557
12566
|
const firstWeekOfNextYear = constructFrom(date2, 0);
|
12558
12567
|
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
|
@@ -12572,7 +12581,7 @@ function getWeekYear(date2, options) {
|
|
12572
12581
|
}
|
12573
12582
|
function startOfWeekYear(date2, options) {
|
12574
12583
|
var _a, _b, _c, _d;
|
12575
|
-
const defaultOptions2 = getDefaultOptions();
|
12584
|
+
const defaultOptions2 = getDefaultOptions$1();
|
12576
12585
|
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;
|
12577
12586
|
const year = getWeekYear(date2, options);
|
12578
12587
|
const firstWeek = constructFrom(date2, 0);
|
@@ -13365,14 +13374,14 @@ function message(token, format2, input) {
|
|
13365
13374
|
const subject = token[0] === "Y" ? "years" : "days of the month";
|
13366
13375
|
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`;
|
13367
13376
|
}
|
13368
|
-
const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
13369
|
-
const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
13370
|
-
const escapedStringRegExp = /^'([^]*?)'?$/;
|
13371
|
-
const doubleQuoteRegExp = /''/g;
|
13372
|
-
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
13377
|
+
const formattingTokensRegExp$1 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
13378
|
+
const longFormattingTokensRegExp$1 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
13379
|
+
const escapedStringRegExp$1 = /^'([^]*?)'?$/;
|
13380
|
+
const doubleQuoteRegExp$1 = /''/g;
|
13381
|
+
const unescapedLatinCharacterRegExp$1 = /[a-zA-Z]/;
|
13373
13382
|
function format$2(date2, formatStr, options) {
|
13374
13383
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
13375
|
-
const defaultOptions2 = getDefaultOptions();
|
13384
|
+
const defaultOptions2 = getDefaultOptions$1();
|
13376
13385
|
const locale2 = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
|
13377
13386
|
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;
|
13378
13387
|
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;
|
@@ -13380,25 +13389,25 @@ function format$2(date2, formatStr, options) {
|
|
13380
13389
|
if (!isValid(originalDate)) {
|
13381
13390
|
throw new RangeError("Invalid time value");
|
13382
13391
|
}
|
13383
|
-
let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
|
13392
|
+
let parts = formatStr.match(longFormattingTokensRegExp$1).map((substring) => {
|
13384
13393
|
const firstCharacter = substring[0];
|
13385
13394
|
if (firstCharacter === "p" || firstCharacter === "P") {
|
13386
13395
|
const longFormatter = longFormatters[firstCharacter];
|
13387
13396
|
return longFormatter(substring, locale2.formatLong);
|
13388
13397
|
}
|
13389
13398
|
return substring;
|
13390
|
-
}).join("").match(formattingTokensRegExp).map((substring) => {
|
13399
|
+
}).join("").match(formattingTokensRegExp$1).map((substring) => {
|
13391
13400
|
if (substring === "''") {
|
13392
13401
|
return { isToken: false, value: "'" };
|
13393
13402
|
}
|
13394
13403
|
const firstCharacter = substring[0];
|
13395
13404
|
if (firstCharacter === "'") {
|
13396
|
-
return { isToken: false, value: cleanEscapedString(substring) };
|
13405
|
+
return { isToken: false, value: cleanEscapedString$1(substring) };
|
13397
13406
|
}
|
13398
13407
|
if (formatters$1[firstCharacter]) {
|
13399
13408
|
return { isToken: true, value: substring };
|
13400
13409
|
}
|
13401
|
-
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
13410
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp$1)) {
|
13402
13411
|
throw new RangeError(
|
13403
13412
|
"Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
|
13404
13413
|
);
|
@@ -13423,12 +13432,12 @@ function format$2(date2, formatStr, options) {
|
|
13423
13432
|
return formatter(originalDate, token, locale2.localize, formatterOptions);
|
13424
13433
|
}).join("");
|
13425
13434
|
}
|
13426
|
-
function cleanEscapedString(input) {
|
13427
|
-
const matched = input.match(escapedStringRegExp);
|
13435
|
+
function cleanEscapedString$1(input) {
|
13436
|
+
const matched = input.match(escapedStringRegExp$1);
|
13428
13437
|
if (!matched) {
|
13429
13438
|
return input;
|
13430
13439
|
}
|
13431
|
-
return matched[1].replace(doubleQuoteRegExp, "'");
|
13440
|
+
return matched[1].replace(doubleQuoteRegExp$1, "'");
|
13432
13441
|
}
|
13433
13442
|
function getDaysInMonth(date2) {
|
13434
13443
|
const _date = toDate(date2);
|
@@ -13439,6 +13448,17 @@ function getDaysInMonth(date2) {
|
|
13439
13448
|
lastDayOfMonth2.setHours(0, 0, 0, 0);
|
13440
13449
|
return lastDayOfMonth2.getDate();
|
13441
13450
|
}
|
13451
|
+
function getDefaultOptions() {
|
13452
|
+
return Object.assign({}, getDefaultOptions$1());
|
13453
|
+
}
|
13454
|
+
function getISODay(date2) {
|
13455
|
+
const _date = toDate(date2);
|
13456
|
+
let day = _date.getDay();
|
13457
|
+
if (day === 0) {
|
13458
|
+
day = 7;
|
13459
|
+
}
|
13460
|
+
return day;
|
13461
|
+
}
|
13442
13462
|
function getUnixTime(date2) {
|
13443
13463
|
return Math.trunc(+toDate(date2) / 1e3);
|
13444
13464
|
}
|
@@ -13466,10 +13486,1754 @@ function isBefore(date2, dateToCompare) {
|
|
13466
13486
|
const _dateToCompare = toDate(dateToCompare);
|
13467
13487
|
return +_date < +_dateToCompare;
|
13468
13488
|
}
|
13469
|
-
function
|
13470
|
-
const
|
13471
|
-
|
13472
|
-
|
13489
|
+
function transpose(fromDate, constructor) {
|
13490
|
+
const date2 = constructor instanceof Date ? constructFrom(constructor, 0) : new constructor(0);
|
13491
|
+
date2.setFullYear(
|
13492
|
+
fromDate.getFullYear(),
|
13493
|
+
fromDate.getMonth(),
|
13494
|
+
fromDate.getDate()
|
13495
|
+
);
|
13496
|
+
date2.setHours(
|
13497
|
+
fromDate.getHours(),
|
13498
|
+
fromDate.getMinutes(),
|
13499
|
+
fromDate.getSeconds(),
|
13500
|
+
fromDate.getMilliseconds()
|
13501
|
+
);
|
13502
|
+
return date2;
|
13503
|
+
}
|
13504
|
+
const TIMEZONE_UNIT_PRIORITY = 10;
|
13505
|
+
class Setter {
|
13506
|
+
constructor() {
|
13507
|
+
__publicField(this, "subPriority", 0);
|
13508
|
+
}
|
13509
|
+
validate(_utcDate, _options) {
|
13510
|
+
return true;
|
13511
|
+
}
|
13512
|
+
}
|
13513
|
+
class ValueSetter extends Setter {
|
13514
|
+
constructor(value, validateValue, setValue, priority, subPriority) {
|
13515
|
+
super();
|
13516
|
+
this.value = value;
|
13517
|
+
this.validateValue = validateValue;
|
13518
|
+
this.setValue = setValue;
|
13519
|
+
this.priority = priority;
|
13520
|
+
if (subPriority) {
|
13521
|
+
this.subPriority = subPriority;
|
13522
|
+
}
|
13523
|
+
}
|
13524
|
+
validate(date2, options) {
|
13525
|
+
return this.validateValue(date2, this.value, options);
|
13526
|
+
}
|
13527
|
+
set(date2, flags, options) {
|
13528
|
+
return this.setValue(date2, flags, this.value, options);
|
13529
|
+
}
|
13530
|
+
}
|
13531
|
+
class DateToSystemTimezoneSetter extends Setter {
|
13532
|
+
constructor() {
|
13533
|
+
super(...arguments);
|
13534
|
+
__publicField(this, "priority", TIMEZONE_UNIT_PRIORITY);
|
13535
|
+
__publicField(this, "subPriority", -1);
|
13536
|
+
}
|
13537
|
+
set(date2, flags) {
|
13538
|
+
if (flags.timestampIsSet) return date2;
|
13539
|
+
return constructFrom(date2, transpose(date2, Date));
|
13540
|
+
}
|
13541
|
+
}
|
13542
|
+
class Parser {
|
13543
|
+
run(dateString, token, match2, options) {
|
13544
|
+
const result = this.parse(dateString, token, match2, options);
|
13545
|
+
if (!result) {
|
13546
|
+
return null;
|
13547
|
+
}
|
13548
|
+
return {
|
13549
|
+
setter: new ValueSetter(
|
13550
|
+
result.value,
|
13551
|
+
this.validate,
|
13552
|
+
this.set,
|
13553
|
+
this.priority,
|
13554
|
+
this.subPriority
|
13555
|
+
),
|
13556
|
+
rest: result.rest
|
13557
|
+
};
|
13558
|
+
}
|
13559
|
+
validate(_utcDate, _value, _options) {
|
13560
|
+
return true;
|
13561
|
+
}
|
13562
|
+
}
|
13563
|
+
class EraParser extends Parser {
|
13564
|
+
constructor() {
|
13565
|
+
super(...arguments);
|
13566
|
+
__publicField(this, "priority", 140);
|
13567
|
+
__publicField(this, "incompatibleTokens", ["R", "u", "t", "T"]);
|
13568
|
+
}
|
13569
|
+
parse(dateString, token, match2) {
|
13570
|
+
switch (token) {
|
13571
|
+
// AD, BC
|
13572
|
+
case "G":
|
13573
|
+
case "GG":
|
13574
|
+
case "GGG":
|
13575
|
+
return match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
|
13576
|
+
// A, B
|
13577
|
+
case "GGGGG":
|
13578
|
+
return match2.era(dateString, { width: "narrow" });
|
13579
|
+
// Anno Domini, Before Christ
|
13580
|
+
case "GGGG":
|
13581
|
+
default:
|
13582
|
+
return match2.era(dateString, { width: "wide" }) || match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
|
13583
|
+
}
|
13584
|
+
}
|
13585
|
+
set(date2, flags, value) {
|
13586
|
+
flags.era = value;
|
13587
|
+
date2.setFullYear(value, 0, 1);
|
13588
|
+
date2.setHours(0, 0, 0, 0);
|
13589
|
+
return date2;
|
13590
|
+
}
|
13591
|
+
}
|
13592
|
+
const numericPatterns = {
|
13593
|
+
month: /^(1[0-2]|0?\d)/,
|
13594
|
+
// 0 to 12
|
13595
|
+
date: /^(3[0-1]|[0-2]?\d)/,
|
13596
|
+
// 0 to 31
|
13597
|
+
dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
|
13598
|
+
// 0 to 366
|
13599
|
+
week: /^(5[0-3]|[0-4]?\d)/,
|
13600
|
+
// 0 to 53
|
13601
|
+
hour23h: /^(2[0-3]|[0-1]?\d)/,
|
13602
|
+
// 0 to 23
|
13603
|
+
hour24h: /^(2[0-4]|[0-1]?\d)/,
|
13604
|
+
// 0 to 24
|
13605
|
+
hour11h: /^(1[0-1]|0?\d)/,
|
13606
|
+
// 0 to 11
|
13607
|
+
hour12h: /^(1[0-2]|0?\d)/,
|
13608
|
+
// 0 to 12
|
13609
|
+
minute: /^[0-5]?\d/,
|
13610
|
+
// 0 to 59
|
13611
|
+
second: /^[0-5]?\d/,
|
13612
|
+
// 0 to 59
|
13613
|
+
singleDigit: /^\d/,
|
13614
|
+
// 0 to 9
|
13615
|
+
twoDigits: /^\d{1,2}/,
|
13616
|
+
// 0 to 99
|
13617
|
+
threeDigits: /^\d{1,3}/,
|
13618
|
+
// 0 to 999
|
13619
|
+
fourDigits: /^\d{1,4}/,
|
13620
|
+
// 0 to 9999
|
13621
|
+
anyDigitsSigned: /^-?\d+/,
|
13622
|
+
singleDigitSigned: /^-?\d/,
|
13623
|
+
// 0 to 9, -0 to -9
|
13624
|
+
twoDigitsSigned: /^-?\d{1,2}/,
|
13625
|
+
// 0 to 99, -0 to -99
|
13626
|
+
threeDigitsSigned: /^-?\d{1,3}/,
|
13627
|
+
// 0 to 999, -0 to -999
|
13628
|
+
fourDigitsSigned: /^-?\d{1,4}/
|
13629
|
+
// 0 to 9999, -0 to -9999
|
13630
|
+
};
|
13631
|
+
const timezonePatterns = {
|
13632
|
+
basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
13633
|
+
basic: /^([+-])(\d{2})(\d{2})|Z/,
|
13634
|
+
basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
13635
|
+
extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
13636
|
+
extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
|
13637
|
+
};
|
13638
|
+
function mapValue(parseFnResult, mapFn) {
|
13639
|
+
if (!parseFnResult) {
|
13640
|
+
return parseFnResult;
|
13641
|
+
}
|
13642
|
+
return {
|
13643
|
+
value: mapFn(parseFnResult.value),
|
13644
|
+
rest: parseFnResult.rest
|
13645
|
+
};
|
13646
|
+
}
|
13647
|
+
function parseNumericPattern(pattern, dateString) {
|
13648
|
+
const matchResult = dateString.match(pattern);
|
13649
|
+
if (!matchResult) {
|
13650
|
+
return null;
|
13651
|
+
}
|
13652
|
+
return {
|
13653
|
+
value: parseInt(matchResult[0], 10),
|
13654
|
+
rest: dateString.slice(matchResult[0].length)
|
13655
|
+
};
|
13656
|
+
}
|
13657
|
+
function parseTimezonePattern(pattern, dateString) {
|
13658
|
+
const matchResult = dateString.match(pattern);
|
13659
|
+
if (!matchResult) {
|
13660
|
+
return null;
|
13661
|
+
}
|
13662
|
+
if (matchResult[0] === "Z") {
|
13663
|
+
return {
|
13664
|
+
value: 0,
|
13665
|
+
rest: dateString.slice(1)
|
13666
|
+
};
|
13667
|
+
}
|
13668
|
+
const sign2 = matchResult[1] === "+" ? 1 : -1;
|
13669
|
+
const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
|
13670
|
+
const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
|
13671
|
+
const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
|
13672
|
+
return {
|
13673
|
+
value: sign2 * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
|
13674
|
+
rest: dateString.slice(matchResult[0].length)
|
13675
|
+
};
|
13676
|
+
}
|
13677
|
+
function parseAnyDigitsSigned(dateString) {
|
13678
|
+
return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
|
13679
|
+
}
|
13680
|
+
function parseNDigits(n2, dateString) {
|
13681
|
+
switch (n2) {
|
13682
|
+
case 1:
|
13683
|
+
return parseNumericPattern(numericPatterns.singleDigit, dateString);
|
13684
|
+
case 2:
|
13685
|
+
return parseNumericPattern(numericPatterns.twoDigits, dateString);
|
13686
|
+
case 3:
|
13687
|
+
return parseNumericPattern(numericPatterns.threeDigits, dateString);
|
13688
|
+
case 4:
|
13689
|
+
return parseNumericPattern(numericPatterns.fourDigits, dateString);
|
13690
|
+
default:
|
13691
|
+
return parseNumericPattern(new RegExp("^\\d{1," + n2 + "}"), dateString);
|
13692
|
+
}
|
13693
|
+
}
|
13694
|
+
function parseNDigitsSigned(n2, dateString) {
|
13695
|
+
switch (n2) {
|
13696
|
+
case 1:
|
13697
|
+
return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
|
13698
|
+
case 2:
|
13699
|
+
return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
|
13700
|
+
case 3:
|
13701
|
+
return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
|
13702
|
+
case 4:
|
13703
|
+
return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
|
13704
|
+
default:
|
13705
|
+
return parseNumericPattern(new RegExp("^-?\\d{1," + n2 + "}"), dateString);
|
13706
|
+
}
|
13707
|
+
}
|
13708
|
+
function dayPeriodEnumToHours(dayPeriod) {
|
13709
|
+
switch (dayPeriod) {
|
13710
|
+
case "morning":
|
13711
|
+
return 4;
|
13712
|
+
case "evening":
|
13713
|
+
return 17;
|
13714
|
+
case "pm":
|
13715
|
+
case "noon":
|
13716
|
+
case "afternoon":
|
13717
|
+
return 12;
|
13718
|
+
case "am":
|
13719
|
+
case "midnight":
|
13720
|
+
case "night":
|
13721
|
+
default:
|
13722
|
+
return 0;
|
13723
|
+
}
|
13724
|
+
}
|
13725
|
+
function normalizeTwoDigitYear(twoDigitYear, currentYear) {
|
13726
|
+
const isCommonEra = currentYear > 0;
|
13727
|
+
const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
|
13728
|
+
let result;
|
13729
|
+
if (absCurrentYear <= 50) {
|
13730
|
+
result = twoDigitYear || 100;
|
13731
|
+
} else {
|
13732
|
+
const rangeEnd = absCurrentYear + 50;
|
13733
|
+
const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
|
13734
|
+
const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
|
13735
|
+
result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
|
13736
|
+
}
|
13737
|
+
return isCommonEra ? result : 1 - result;
|
13738
|
+
}
|
13739
|
+
function isLeapYearIndex$1(year) {
|
13740
|
+
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
13741
|
+
}
|
13742
|
+
class YearParser extends Parser {
|
13743
|
+
constructor() {
|
13744
|
+
super(...arguments);
|
13745
|
+
__publicField(this, "priority", 130);
|
13746
|
+
__publicField(this, "incompatibleTokens", ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]);
|
13747
|
+
}
|
13748
|
+
parse(dateString, token, match2) {
|
13749
|
+
const valueCallback = (year) => ({
|
13750
|
+
year,
|
13751
|
+
isTwoDigitYear: token === "yy"
|
13752
|
+
});
|
13753
|
+
switch (token) {
|
13754
|
+
case "y":
|
13755
|
+
return mapValue(parseNDigits(4, dateString), valueCallback);
|
13756
|
+
case "yo":
|
13757
|
+
return mapValue(
|
13758
|
+
match2.ordinalNumber(dateString, {
|
13759
|
+
unit: "year"
|
13760
|
+
}),
|
13761
|
+
valueCallback
|
13762
|
+
);
|
13763
|
+
default:
|
13764
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
13765
|
+
}
|
13766
|
+
}
|
13767
|
+
validate(_date, value) {
|
13768
|
+
return value.isTwoDigitYear || value.year > 0;
|
13769
|
+
}
|
13770
|
+
set(date2, flags, value) {
|
13771
|
+
const currentYear = date2.getFullYear();
|
13772
|
+
if (value.isTwoDigitYear) {
|
13773
|
+
const normalizedTwoDigitYear = normalizeTwoDigitYear(
|
13774
|
+
value.year,
|
13775
|
+
currentYear
|
13776
|
+
);
|
13777
|
+
date2.setFullYear(normalizedTwoDigitYear, 0, 1);
|
13778
|
+
date2.setHours(0, 0, 0, 0);
|
13779
|
+
return date2;
|
13780
|
+
}
|
13781
|
+
const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
13782
|
+
date2.setFullYear(year, 0, 1);
|
13783
|
+
date2.setHours(0, 0, 0, 0);
|
13784
|
+
return date2;
|
13785
|
+
}
|
13786
|
+
}
|
13787
|
+
class LocalWeekYearParser extends Parser {
|
13788
|
+
constructor() {
|
13789
|
+
super(...arguments);
|
13790
|
+
__publicField(this, "priority", 130);
|
13791
|
+
__publicField(this, "incompatibleTokens", [
|
13792
|
+
"y",
|
13793
|
+
"R",
|
13794
|
+
"u",
|
13795
|
+
"Q",
|
13796
|
+
"q",
|
13797
|
+
"M",
|
13798
|
+
"L",
|
13799
|
+
"I",
|
13800
|
+
"d",
|
13801
|
+
"D",
|
13802
|
+
"i",
|
13803
|
+
"t",
|
13804
|
+
"T"
|
13805
|
+
]);
|
13806
|
+
}
|
13807
|
+
parse(dateString, token, match2) {
|
13808
|
+
const valueCallback = (year) => ({
|
13809
|
+
year,
|
13810
|
+
isTwoDigitYear: token === "YY"
|
13811
|
+
});
|
13812
|
+
switch (token) {
|
13813
|
+
case "Y":
|
13814
|
+
return mapValue(parseNDigits(4, dateString), valueCallback);
|
13815
|
+
case "Yo":
|
13816
|
+
return mapValue(
|
13817
|
+
match2.ordinalNumber(dateString, {
|
13818
|
+
unit: "year"
|
13819
|
+
}),
|
13820
|
+
valueCallback
|
13821
|
+
);
|
13822
|
+
default:
|
13823
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
13824
|
+
}
|
13825
|
+
}
|
13826
|
+
validate(_date, value) {
|
13827
|
+
return value.isTwoDigitYear || value.year > 0;
|
13828
|
+
}
|
13829
|
+
set(date2, flags, value, options) {
|
13830
|
+
const currentYear = getWeekYear(date2, options);
|
13831
|
+
if (value.isTwoDigitYear) {
|
13832
|
+
const normalizedTwoDigitYear = normalizeTwoDigitYear(
|
13833
|
+
value.year,
|
13834
|
+
currentYear
|
13835
|
+
);
|
13836
|
+
date2.setFullYear(
|
13837
|
+
normalizedTwoDigitYear,
|
13838
|
+
0,
|
13839
|
+
options.firstWeekContainsDate
|
13840
|
+
);
|
13841
|
+
date2.setHours(0, 0, 0, 0);
|
13842
|
+
return startOfWeek(date2, options);
|
13843
|
+
}
|
13844
|
+
const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
13845
|
+
date2.setFullYear(year, 0, options.firstWeekContainsDate);
|
13846
|
+
date2.setHours(0, 0, 0, 0);
|
13847
|
+
return startOfWeek(date2, options);
|
13848
|
+
}
|
13849
|
+
}
|
13850
|
+
class ISOWeekYearParser extends Parser {
|
13851
|
+
constructor() {
|
13852
|
+
super(...arguments);
|
13853
|
+
__publicField(this, "priority", 130);
|
13854
|
+
__publicField(this, "incompatibleTokens", [
|
13855
|
+
"G",
|
13856
|
+
"y",
|
13857
|
+
"Y",
|
13858
|
+
"u",
|
13859
|
+
"Q",
|
13860
|
+
"q",
|
13861
|
+
"M",
|
13862
|
+
"L",
|
13863
|
+
"w",
|
13864
|
+
"d",
|
13865
|
+
"D",
|
13866
|
+
"e",
|
13867
|
+
"c",
|
13868
|
+
"t",
|
13869
|
+
"T"
|
13870
|
+
]);
|
13871
|
+
}
|
13872
|
+
parse(dateString, token) {
|
13873
|
+
if (token === "R") {
|
13874
|
+
return parseNDigitsSigned(4, dateString);
|
13875
|
+
}
|
13876
|
+
return parseNDigitsSigned(token.length, dateString);
|
13877
|
+
}
|
13878
|
+
set(date2, _flags, value) {
|
13879
|
+
const firstWeekOfYear = constructFrom(date2, 0);
|
13880
|
+
firstWeekOfYear.setFullYear(value, 0, 4);
|
13881
|
+
firstWeekOfYear.setHours(0, 0, 0, 0);
|
13882
|
+
return startOfISOWeek(firstWeekOfYear);
|
13883
|
+
}
|
13884
|
+
}
|
13885
|
+
class ExtendedYearParser extends Parser {
|
13886
|
+
constructor() {
|
13887
|
+
super(...arguments);
|
13888
|
+
__publicField(this, "priority", 130);
|
13889
|
+
__publicField(this, "incompatibleTokens", ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]);
|
13890
|
+
}
|
13891
|
+
parse(dateString, token) {
|
13892
|
+
if (token === "u") {
|
13893
|
+
return parseNDigitsSigned(4, dateString);
|
13894
|
+
}
|
13895
|
+
return parseNDigitsSigned(token.length, dateString);
|
13896
|
+
}
|
13897
|
+
set(date2, _flags, value) {
|
13898
|
+
date2.setFullYear(value, 0, 1);
|
13899
|
+
date2.setHours(0, 0, 0, 0);
|
13900
|
+
return date2;
|
13901
|
+
}
|
13902
|
+
}
|
13903
|
+
class QuarterParser extends Parser {
|
13904
|
+
constructor() {
|
13905
|
+
super(...arguments);
|
13906
|
+
__publicField(this, "priority", 120);
|
13907
|
+
__publicField(this, "incompatibleTokens", [
|
13908
|
+
"Y",
|
13909
|
+
"R",
|
13910
|
+
"q",
|
13911
|
+
"M",
|
13912
|
+
"L",
|
13913
|
+
"w",
|
13914
|
+
"I",
|
13915
|
+
"d",
|
13916
|
+
"D",
|
13917
|
+
"i",
|
13918
|
+
"e",
|
13919
|
+
"c",
|
13920
|
+
"t",
|
13921
|
+
"T"
|
13922
|
+
]);
|
13923
|
+
}
|
13924
|
+
parse(dateString, token, match2) {
|
13925
|
+
switch (token) {
|
13926
|
+
// 1, 2, 3, 4
|
13927
|
+
case "Q":
|
13928
|
+
case "QQ":
|
13929
|
+
return parseNDigits(token.length, dateString);
|
13930
|
+
// 1st, 2nd, 3rd, 4th
|
13931
|
+
case "Qo":
|
13932
|
+
return match2.ordinalNumber(dateString, { unit: "quarter" });
|
13933
|
+
// Q1, Q2, Q3, Q4
|
13934
|
+
case "QQQ":
|
13935
|
+
return match2.quarter(dateString, {
|
13936
|
+
width: "abbreviated",
|
13937
|
+
context: "formatting"
|
13938
|
+
}) || match2.quarter(dateString, {
|
13939
|
+
width: "narrow",
|
13940
|
+
context: "formatting"
|
13941
|
+
});
|
13942
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
13943
|
+
case "QQQQQ":
|
13944
|
+
return match2.quarter(dateString, {
|
13945
|
+
width: "narrow",
|
13946
|
+
context: "formatting"
|
13947
|
+
});
|
13948
|
+
// 1st quarter, 2nd quarter, ...
|
13949
|
+
case "QQQQ":
|
13950
|
+
default:
|
13951
|
+
return match2.quarter(dateString, {
|
13952
|
+
width: "wide",
|
13953
|
+
context: "formatting"
|
13954
|
+
}) || match2.quarter(dateString, {
|
13955
|
+
width: "abbreviated",
|
13956
|
+
context: "formatting"
|
13957
|
+
}) || match2.quarter(dateString, {
|
13958
|
+
width: "narrow",
|
13959
|
+
context: "formatting"
|
13960
|
+
});
|
13961
|
+
}
|
13962
|
+
}
|
13963
|
+
validate(_date, value) {
|
13964
|
+
return value >= 1 && value <= 4;
|
13965
|
+
}
|
13966
|
+
set(date2, _flags, value) {
|
13967
|
+
date2.setMonth((value - 1) * 3, 1);
|
13968
|
+
date2.setHours(0, 0, 0, 0);
|
13969
|
+
return date2;
|
13970
|
+
}
|
13971
|
+
}
|
13972
|
+
class StandAloneQuarterParser extends Parser {
|
13973
|
+
constructor() {
|
13974
|
+
super(...arguments);
|
13975
|
+
__publicField(this, "priority", 120);
|
13976
|
+
__publicField(this, "incompatibleTokens", [
|
13977
|
+
"Y",
|
13978
|
+
"R",
|
13979
|
+
"Q",
|
13980
|
+
"M",
|
13981
|
+
"L",
|
13982
|
+
"w",
|
13983
|
+
"I",
|
13984
|
+
"d",
|
13985
|
+
"D",
|
13986
|
+
"i",
|
13987
|
+
"e",
|
13988
|
+
"c",
|
13989
|
+
"t",
|
13990
|
+
"T"
|
13991
|
+
]);
|
13992
|
+
}
|
13993
|
+
parse(dateString, token, match2) {
|
13994
|
+
switch (token) {
|
13995
|
+
// 1, 2, 3, 4
|
13996
|
+
case "q":
|
13997
|
+
case "qq":
|
13998
|
+
return parseNDigits(token.length, dateString);
|
13999
|
+
// 1st, 2nd, 3rd, 4th
|
14000
|
+
case "qo":
|
14001
|
+
return match2.ordinalNumber(dateString, { unit: "quarter" });
|
14002
|
+
// Q1, Q2, Q3, Q4
|
14003
|
+
case "qqq":
|
14004
|
+
return match2.quarter(dateString, {
|
14005
|
+
width: "abbreviated",
|
14006
|
+
context: "standalone"
|
14007
|
+
}) || match2.quarter(dateString, {
|
14008
|
+
width: "narrow",
|
14009
|
+
context: "standalone"
|
14010
|
+
});
|
14011
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
14012
|
+
case "qqqqq":
|
14013
|
+
return match2.quarter(dateString, {
|
14014
|
+
width: "narrow",
|
14015
|
+
context: "standalone"
|
14016
|
+
});
|
14017
|
+
// 1st quarter, 2nd quarter, ...
|
14018
|
+
case "qqqq":
|
14019
|
+
default:
|
14020
|
+
return match2.quarter(dateString, {
|
14021
|
+
width: "wide",
|
14022
|
+
context: "standalone"
|
14023
|
+
}) || match2.quarter(dateString, {
|
14024
|
+
width: "abbreviated",
|
14025
|
+
context: "standalone"
|
14026
|
+
}) || match2.quarter(dateString, {
|
14027
|
+
width: "narrow",
|
14028
|
+
context: "standalone"
|
14029
|
+
});
|
14030
|
+
}
|
14031
|
+
}
|
14032
|
+
validate(_date, value) {
|
14033
|
+
return value >= 1 && value <= 4;
|
14034
|
+
}
|
14035
|
+
set(date2, _flags, value) {
|
14036
|
+
date2.setMonth((value - 1) * 3, 1);
|
14037
|
+
date2.setHours(0, 0, 0, 0);
|
14038
|
+
return date2;
|
14039
|
+
}
|
14040
|
+
}
|
14041
|
+
class MonthParser extends Parser {
|
14042
|
+
constructor() {
|
14043
|
+
super(...arguments);
|
14044
|
+
__publicField(this, "incompatibleTokens", [
|
14045
|
+
"Y",
|
14046
|
+
"R",
|
14047
|
+
"q",
|
14048
|
+
"Q",
|
14049
|
+
"L",
|
14050
|
+
"w",
|
14051
|
+
"I",
|
14052
|
+
"D",
|
14053
|
+
"i",
|
14054
|
+
"e",
|
14055
|
+
"c",
|
14056
|
+
"t",
|
14057
|
+
"T"
|
14058
|
+
]);
|
14059
|
+
__publicField(this, "priority", 110);
|
14060
|
+
}
|
14061
|
+
parse(dateString, token, match2) {
|
14062
|
+
const valueCallback = (value) => value - 1;
|
14063
|
+
switch (token) {
|
14064
|
+
// 1, 2, ..., 12
|
14065
|
+
case "M":
|
14066
|
+
return mapValue(
|
14067
|
+
parseNumericPattern(numericPatterns.month, dateString),
|
14068
|
+
valueCallback
|
14069
|
+
);
|
14070
|
+
// 01, 02, ..., 12
|
14071
|
+
case "MM":
|
14072
|
+
return mapValue(parseNDigits(2, dateString), valueCallback);
|
14073
|
+
// 1st, 2nd, ..., 12th
|
14074
|
+
case "Mo":
|
14075
|
+
return mapValue(
|
14076
|
+
match2.ordinalNumber(dateString, {
|
14077
|
+
unit: "month"
|
14078
|
+
}),
|
14079
|
+
valueCallback
|
14080
|
+
);
|
14081
|
+
// Jan, Feb, ..., Dec
|
14082
|
+
case "MMM":
|
14083
|
+
return match2.month(dateString, {
|
14084
|
+
width: "abbreviated",
|
14085
|
+
context: "formatting"
|
14086
|
+
}) || match2.month(dateString, { width: "narrow", context: "formatting" });
|
14087
|
+
// J, F, ..., D
|
14088
|
+
case "MMMMM":
|
14089
|
+
return match2.month(dateString, {
|
14090
|
+
width: "narrow",
|
14091
|
+
context: "formatting"
|
14092
|
+
});
|
14093
|
+
// January, February, ..., December
|
14094
|
+
case "MMMM":
|
14095
|
+
default:
|
14096
|
+
return match2.month(dateString, { width: "wide", context: "formatting" }) || match2.month(dateString, {
|
14097
|
+
width: "abbreviated",
|
14098
|
+
context: "formatting"
|
14099
|
+
}) || match2.month(dateString, { width: "narrow", context: "formatting" });
|
14100
|
+
}
|
14101
|
+
}
|
14102
|
+
validate(_date, value) {
|
14103
|
+
return value >= 0 && value <= 11;
|
14104
|
+
}
|
14105
|
+
set(date2, _flags, value) {
|
14106
|
+
date2.setMonth(value, 1);
|
14107
|
+
date2.setHours(0, 0, 0, 0);
|
14108
|
+
return date2;
|
14109
|
+
}
|
14110
|
+
}
|
14111
|
+
class StandAloneMonthParser extends Parser {
|
14112
|
+
constructor() {
|
14113
|
+
super(...arguments);
|
14114
|
+
__publicField(this, "priority", 110);
|
14115
|
+
__publicField(this, "incompatibleTokens", [
|
14116
|
+
"Y",
|
14117
|
+
"R",
|
14118
|
+
"q",
|
14119
|
+
"Q",
|
14120
|
+
"M",
|
14121
|
+
"w",
|
14122
|
+
"I",
|
14123
|
+
"D",
|
14124
|
+
"i",
|
14125
|
+
"e",
|
14126
|
+
"c",
|
14127
|
+
"t",
|
14128
|
+
"T"
|
14129
|
+
]);
|
14130
|
+
}
|
14131
|
+
parse(dateString, token, match2) {
|
14132
|
+
const valueCallback = (value) => value - 1;
|
14133
|
+
switch (token) {
|
14134
|
+
// 1, 2, ..., 12
|
14135
|
+
case "L":
|
14136
|
+
return mapValue(
|
14137
|
+
parseNumericPattern(numericPatterns.month, dateString),
|
14138
|
+
valueCallback
|
14139
|
+
);
|
14140
|
+
// 01, 02, ..., 12
|
14141
|
+
case "LL":
|
14142
|
+
return mapValue(parseNDigits(2, dateString), valueCallback);
|
14143
|
+
// 1st, 2nd, ..., 12th
|
14144
|
+
case "Lo":
|
14145
|
+
return mapValue(
|
14146
|
+
match2.ordinalNumber(dateString, {
|
14147
|
+
unit: "month"
|
14148
|
+
}),
|
14149
|
+
valueCallback
|
14150
|
+
);
|
14151
|
+
// Jan, Feb, ..., Dec
|
14152
|
+
case "LLL":
|
14153
|
+
return match2.month(dateString, {
|
14154
|
+
width: "abbreviated",
|
14155
|
+
context: "standalone"
|
14156
|
+
}) || match2.month(dateString, { width: "narrow", context: "standalone" });
|
14157
|
+
// J, F, ..., D
|
14158
|
+
case "LLLLL":
|
14159
|
+
return match2.month(dateString, {
|
14160
|
+
width: "narrow",
|
14161
|
+
context: "standalone"
|
14162
|
+
});
|
14163
|
+
// January, February, ..., December
|
14164
|
+
case "LLLL":
|
14165
|
+
default:
|
14166
|
+
return match2.month(dateString, { width: "wide", context: "standalone" }) || match2.month(dateString, {
|
14167
|
+
width: "abbreviated",
|
14168
|
+
context: "standalone"
|
14169
|
+
}) || match2.month(dateString, { width: "narrow", context: "standalone" });
|
14170
|
+
}
|
14171
|
+
}
|
14172
|
+
validate(_date, value) {
|
14173
|
+
return value >= 0 && value <= 11;
|
14174
|
+
}
|
14175
|
+
set(date2, _flags, value) {
|
14176
|
+
date2.setMonth(value, 1);
|
14177
|
+
date2.setHours(0, 0, 0, 0);
|
14178
|
+
return date2;
|
14179
|
+
}
|
14180
|
+
}
|
14181
|
+
function setWeek(date2, week, options) {
|
14182
|
+
const _date = toDate(date2);
|
14183
|
+
const diff = getWeek(_date, options) - week;
|
14184
|
+
_date.setDate(_date.getDate() - diff * 7);
|
14185
|
+
return _date;
|
14186
|
+
}
|
14187
|
+
class LocalWeekParser extends Parser {
|
14188
|
+
constructor() {
|
14189
|
+
super(...arguments);
|
14190
|
+
__publicField(this, "priority", 100);
|
14191
|
+
__publicField(this, "incompatibleTokens", [
|
14192
|
+
"y",
|
14193
|
+
"R",
|
14194
|
+
"u",
|
14195
|
+
"q",
|
14196
|
+
"Q",
|
14197
|
+
"M",
|
14198
|
+
"L",
|
14199
|
+
"I",
|
14200
|
+
"d",
|
14201
|
+
"D",
|
14202
|
+
"i",
|
14203
|
+
"t",
|
14204
|
+
"T"
|
14205
|
+
]);
|
14206
|
+
}
|
14207
|
+
parse(dateString, token, match2) {
|
14208
|
+
switch (token) {
|
14209
|
+
case "w":
|
14210
|
+
return parseNumericPattern(numericPatterns.week, dateString);
|
14211
|
+
case "wo":
|
14212
|
+
return match2.ordinalNumber(dateString, { unit: "week" });
|
14213
|
+
default:
|
14214
|
+
return parseNDigits(token.length, dateString);
|
14215
|
+
}
|
14216
|
+
}
|
14217
|
+
validate(_date, value) {
|
14218
|
+
return value >= 1 && value <= 53;
|
14219
|
+
}
|
14220
|
+
set(date2, _flags, value, options) {
|
14221
|
+
return startOfWeek(setWeek(date2, value, options), options);
|
14222
|
+
}
|
14223
|
+
}
|
14224
|
+
function setISOWeek(date2, week) {
|
14225
|
+
const _date = toDate(date2);
|
14226
|
+
const diff = getISOWeek(_date) - week;
|
14227
|
+
_date.setDate(_date.getDate() - diff * 7);
|
14228
|
+
return _date;
|
14229
|
+
}
|
14230
|
+
class ISOWeekParser extends Parser {
|
14231
|
+
constructor() {
|
14232
|
+
super(...arguments);
|
14233
|
+
__publicField(this, "priority", 100);
|
14234
|
+
__publicField(this, "incompatibleTokens", [
|
14235
|
+
"y",
|
14236
|
+
"Y",
|
14237
|
+
"u",
|
14238
|
+
"q",
|
14239
|
+
"Q",
|
14240
|
+
"M",
|
14241
|
+
"L",
|
14242
|
+
"w",
|
14243
|
+
"d",
|
14244
|
+
"D",
|
14245
|
+
"e",
|
14246
|
+
"c",
|
14247
|
+
"t",
|
14248
|
+
"T"
|
14249
|
+
]);
|
14250
|
+
}
|
14251
|
+
parse(dateString, token, match2) {
|
14252
|
+
switch (token) {
|
14253
|
+
case "I":
|
14254
|
+
return parseNumericPattern(numericPatterns.week, dateString);
|
14255
|
+
case "Io":
|
14256
|
+
return match2.ordinalNumber(dateString, { unit: "week" });
|
14257
|
+
default:
|
14258
|
+
return parseNDigits(token.length, dateString);
|
14259
|
+
}
|
14260
|
+
}
|
14261
|
+
validate(_date, value) {
|
14262
|
+
return value >= 1 && value <= 53;
|
14263
|
+
}
|
14264
|
+
set(date2, _flags, value) {
|
14265
|
+
return startOfISOWeek(setISOWeek(date2, value));
|
14266
|
+
}
|
14267
|
+
}
|
14268
|
+
const DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
14269
|
+
const DAYS_IN_MONTH_LEAP_YEAR = [
|
14270
|
+
31,
|
14271
|
+
29,
|
14272
|
+
31,
|
14273
|
+
30,
|
14274
|
+
31,
|
14275
|
+
30,
|
14276
|
+
31,
|
14277
|
+
31,
|
14278
|
+
30,
|
14279
|
+
31,
|
14280
|
+
30,
|
14281
|
+
31
|
14282
|
+
];
|
14283
|
+
class DateParser extends Parser {
|
14284
|
+
constructor() {
|
14285
|
+
super(...arguments);
|
14286
|
+
__publicField(this, "priority", 90);
|
14287
|
+
__publicField(this, "subPriority", 1);
|
14288
|
+
__publicField(this, "incompatibleTokens", [
|
14289
|
+
"Y",
|
14290
|
+
"R",
|
14291
|
+
"q",
|
14292
|
+
"Q",
|
14293
|
+
"w",
|
14294
|
+
"I",
|
14295
|
+
"D",
|
14296
|
+
"i",
|
14297
|
+
"e",
|
14298
|
+
"c",
|
14299
|
+
"t",
|
14300
|
+
"T"
|
14301
|
+
]);
|
14302
|
+
}
|
14303
|
+
parse(dateString, token, match2) {
|
14304
|
+
switch (token) {
|
14305
|
+
case "d":
|
14306
|
+
return parseNumericPattern(numericPatterns.date, dateString);
|
14307
|
+
case "do":
|
14308
|
+
return match2.ordinalNumber(dateString, { unit: "date" });
|
14309
|
+
default:
|
14310
|
+
return parseNDigits(token.length, dateString);
|
14311
|
+
}
|
14312
|
+
}
|
14313
|
+
validate(date2, value) {
|
14314
|
+
const year = date2.getFullYear();
|
14315
|
+
const isLeapYear = isLeapYearIndex$1(year);
|
14316
|
+
const month = date2.getMonth();
|
14317
|
+
if (isLeapYear) {
|
14318
|
+
return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
|
14319
|
+
} else {
|
14320
|
+
return value >= 1 && value <= DAYS_IN_MONTH[month];
|
14321
|
+
}
|
14322
|
+
}
|
14323
|
+
set(date2, _flags, value) {
|
14324
|
+
date2.setDate(value);
|
14325
|
+
date2.setHours(0, 0, 0, 0);
|
14326
|
+
return date2;
|
14327
|
+
}
|
14328
|
+
}
|
14329
|
+
class DayOfYearParser extends Parser {
|
14330
|
+
constructor() {
|
14331
|
+
super(...arguments);
|
14332
|
+
__publicField(this, "priority", 90);
|
14333
|
+
__publicField(this, "subpriority", 1);
|
14334
|
+
__publicField(this, "incompatibleTokens", [
|
14335
|
+
"Y",
|
14336
|
+
"R",
|
14337
|
+
"q",
|
14338
|
+
"Q",
|
14339
|
+
"M",
|
14340
|
+
"L",
|
14341
|
+
"w",
|
14342
|
+
"I",
|
14343
|
+
"d",
|
14344
|
+
"E",
|
14345
|
+
"i",
|
14346
|
+
"e",
|
14347
|
+
"c",
|
14348
|
+
"t",
|
14349
|
+
"T"
|
14350
|
+
]);
|
14351
|
+
}
|
14352
|
+
parse(dateString, token, match2) {
|
14353
|
+
switch (token) {
|
14354
|
+
case "D":
|
14355
|
+
case "DD":
|
14356
|
+
return parseNumericPattern(numericPatterns.dayOfYear, dateString);
|
14357
|
+
case "Do":
|
14358
|
+
return match2.ordinalNumber(dateString, { unit: "date" });
|
14359
|
+
default:
|
14360
|
+
return parseNDigits(token.length, dateString);
|
14361
|
+
}
|
14362
|
+
}
|
14363
|
+
validate(date2, value) {
|
14364
|
+
const year = date2.getFullYear();
|
14365
|
+
const isLeapYear = isLeapYearIndex$1(year);
|
14366
|
+
if (isLeapYear) {
|
14367
|
+
return value >= 1 && value <= 366;
|
14368
|
+
} else {
|
14369
|
+
return value >= 1 && value <= 365;
|
14370
|
+
}
|
14371
|
+
}
|
14372
|
+
set(date2, _flags, value) {
|
14373
|
+
date2.setMonth(0, value);
|
14374
|
+
date2.setHours(0, 0, 0, 0);
|
14375
|
+
return date2;
|
14376
|
+
}
|
14377
|
+
}
|
14378
|
+
function setDay(date2, day, options) {
|
14379
|
+
var _a, _b, _c, _d;
|
14380
|
+
const defaultOptions2 = getDefaultOptions$1();
|
14381
|
+
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;
|
14382
|
+
const _date = toDate(date2);
|
14383
|
+
const currentDay = _date.getDay();
|
14384
|
+
const remainder = day % 7;
|
14385
|
+
const dayIndex = (remainder + 7) % 7;
|
14386
|
+
const delta = 7 - weekStartsOn;
|
14387
|
+
const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;
|
14388
|
+
return addDays(_date, diff);
|
14389
|
+
}
|
14390
|
+
class DayParser extends Parser {
|
14391
|
+
constructor() {
|
14392
|
+
super(...arguments);
|
14393
|
+
__publicField(this, "priority", 90);
|
14394
|
+
__publicField(this, "incompatibleTokens", ["D", "i", "e", "c", "t", "T"]);
|
14395
|
+
}
|
14396
|
+
parse(dateString, token, match2) {
|
14397
|
+
switch (token) {
|
14398
|
+
// Tue
|
14399
|
+
case "E":
|
14400
|
+
case "EE":
|
14401
|
+
case "EEE":
|
14402
|
+
return match2.day(dateString, {
|
14403
|
+
width: "abbreviated",
|
14404
|
+
context: "formatting"
|
14405
|
+
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14406
|
+
// T
|
14407
|
+
case "EEEEE":
|
14408
|
+
return match2.day(dateString, {
|
14409
|
+
width: "narrow",
|
14410
|
+
context: "formatting"
|
14411
|
+
});
|
14412
|
+
// Tu
|
14413
|
+
case "EEEEEE":
|
14414
|
+
return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14415
|
+
// Tuesday
|
14416
|
+
case "EEEE":
|
14417
|
+
default:
|
14418
|
+
return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
|
14419
|
+
width: "abbreviated",
|
14420
|
+
context: "formatting"
|
14421
|
+
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14422
|
+
}
|
14423
|
+
}
|
14424
|
+
validate(_date, value) {
|
14425
|
+
return value >= 0 && value <= 6;
|
14426
|
+
}
|
14427
|
+
set(date2, _flags, value, options) {
|
14428
|
+
date2 = setDay(date2, value, options);
|
14429
|
+
date2.setHours(0, 0, 0, 0);
|
14430
|
+
return date2;
|
14431
|
+
}
|
14432
|
+
}
|
14433
|
+
class LocalDayParser extends Parser {
|
14434
|
+
constructor() {
|
14435
|
+
super(...arguments);
|
14436
|
+
__publicField(this, "priority", 90);
|
14437
|
+
__publicField(this, "incompatibleTokens", [
|
14438
|
+
"y",
|
14439
|
+
"R",
|
14440
|
+
"u",
|
14441
|
+
"q",
|
14442
|
+
"Q",
|
14443
|
+
"M",
|
14444
|
+
"L",
|
14445
|
+
"I",
|
14446
|
+
"d",
|
14447
|
+
"D",
|
14448
|
+
"E",
|
14449
|
+
"i",
|
14450
|
+
"c",
|
14451
|
+
"t",
|
14452
|
+
"T"
|
14453
|
+
]);
|
14454
|
+
}
|
14455
|
+
parse(dateString, token, match2, options) {
|
14456
|
+
const valueCallback = (value) => {
|
14457
|
+
const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
|
14458
|
+
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
|
14459
|
+
};
|
14460
|
+
switch (token) {
|
14461
|
+
// 3
|
14462
|
+
case "e":
|
14463
|
+
case "ee":
|
14464
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
14465
|
+
// 3rd
|
14466
|
+
case "eo":
|
14467
|
+
return mapValue(
|
14468
|
+
match2.ordinalNumber(dateString, {
|
14469
|
+
unit: "day"
|
14470
|
+
}),
|
14471
|
+
valueCallback
|
14472
|
+
);
|
14473
|
+
// Tue
|
14474
|
+
case "eee":
|
14475
|
+
return match2.day(dateString, {
|
14476
|
+
width: "abbreviated",
|
14477
|
+
context: "formatting"
|
14478
|
+
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14479
|
+
// T
|
14480
|
+
case "eeeee":
|
14481
|
+
return match2.day(dateString, {
|
14482
|
+
width: "narrow",
|
14483
|
+
context: "formatting"
|
14484
|
+
});
|
14485
|
+
// Tu
|
14486
|
+
case "eeeeee":
|
14487
|
+
return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14488
|
+
// Tuesday
|
14489
|
+
case "eeee":
|
14490
|
+
default:
|
14491
|
+
return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
|
14492
|
+
width: "abbreviated",
|
14493
|
+
context: "formatting"
|
14494
|
+
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
14495
|
+
}
|
14496
|
+
}
|
14497
|
+
validate(_date, value) {
|
14498
|
+
return value >= 0 && value <= 6;
|
14499
|
+
}
|
14500
|
+
set(date2, _flags, value, options) {
|
14501
|
+
date2 = setDay(date2, value, options);
|
14502
|
+
date2.setHours(0, 0, 0, 0);
|
14503
|
+
return date2;
|
14504
|
+
}
|
14505
|
+
}
|
14506
|
+
class StandAloneLocalDayParser extends Parser {
|
14507
|
+
constructor() {
|
14508
|
+
super(...arguments);
|
14509
|
+
__publicField(this, "priority", 90);
|
14510
|
+
__publicField(this, "incompatibleTokens", [
|
14511
|
+
"y",
|
14512
|
+
"R",
|
14513
|
+
"u",
|
14514
|
+
"q",
|
14515
|
+
"Q",
|
14516
|
+
"M",
|
14517
|
+
"L",
|
14518
|
+
"I",
|
14519
|
+
"d",
|
14520
|
+
"D",
|
14521
|
+
"E",
|
14522
|
+
"i",
|
14523
|
+
"e",
|
14524
|
+
"t",
|
14525
|
+
"T"
|
14526
|
+
]);
|
14527
|
+
}
|
14528
|
+
parse(dateString, token, match2, options) {
|
14529
|
+
const valueCallback = (value) => {
|
14530
|
+
const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
|
14531
|
+
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
|
14532
|
+
};
|
14533
|
+
switch (token) {
|
14534
|
+
// 3
|
14535
|
+
case "c":
|
14536
|
+
case "cc":
|
14537
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
14538
|
+
// 3rd
|
14539
|
+
case "co":
|
14540
|
+
return mapValue(
|
14541
|
+
match2.ordinalNumber(dateString, {
|
14542
|
+
unit: "day"
|
14543
|
+
}),
|
14544
|
+
valueCallback
|
14545
|
+
);
|
14546
|
+
// Tue
|
14547
|
+
case "ccc":
|
14548
|
+
return match2.day(dateString, {
|
14549
|
+
width: "abbreviated",
|
14550
|
+
context: "standalone"
|
14551
|
+
}) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
|
14552
|
+
// T
|
14553
|
+
case "ccccc":
|
14554
|
+
return match2.day(dateString, {
|
14555
|
+
width: "narrow",
|
14556
|
+
context: "standalone"
|
14557
|
+
});
|
14558
|
+
// Tu
|
14559
|
+
case "cccccc":
|
14560
|
+
return match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
|
14561
|
+
// Tuesday
|
14562
|
+
case "cccc":
|
14563
|
+
default:
|
14564
|
+
return match2.day(dateString, { width: "wide", context: "standalone" }) || match2.day(dateString, {
|
14565
|
+
width: "abbreviated",
|
14566
|
+
context: "standalone"
|
14567
|
+
}) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
|
14568
|
+
}
|
14569
|
+
}
|
14570
|
+
validate(_date, value) {
|
14571
|
+
return value >= 0 && value <= 6;
|
14572
|
+
}
|
14573
|
+
set(date2, _flags, value, options) {
|
14574
|
+
date2 = setDay(date2, value, options);
|
14575
|
+
date2.setHours(0, 0, 0, 0);
|
14576
|
+
return date2;
|
14577
|
+
}
|
14578
|
+
}
|
14579
|
+
function setISODay(date2, day) {
|
14580
|
+
const _date = toDate(date2);
|
14581
|
+
const currentDay = getISODay(_date);
|
14582
|
+
const diff = day - currentDay;
|
14583
|
+
return addDays(_date, diff);
|
14584
|
+
}
|
14585
|
+
class ISODayParser extends Parser {
|
14586
|
+
constructor() {
|
14587
|
+
super(...arguments);
|
14588
|
+
__publicField(this, "priority", 90);
|
14589
|
+
__publicField(this, "incompatibleTokens", [
|
14590
|
+
"y",
|
14591
|
+
"Y",
|
14592
|
+
"u",
|
14593
|
+
"q",
|
14594
|
+
"Q",
|
14595
|
+
"M",
|
14596
|
+
"L",
|
14597
|
+
"w",
|
14598
|
+
"d",
|
14599
|
+
"D",
|
14600
|
+
"E",
|
14601
|
+
"e",
|
14602
|
+
"c",
|
14603
|
+
"t",
|
14604
|
+
"T"
|
14605
|
+
]);
|
14606
|
+
}
|
14607
|
+
parse(dateString, token, match2) {
|
14608
|
+
const valueCallback = (value) => {
|
14609
|
+
if (value === 0) {
|
14610
|
+
return 7;
|
14611
|
+
}
|
14612
|
+
return value;
|
14613
|
+
};
|
14614
|
+
switch (token) {
|
14615
|
+
// 2
|
14616
|
+
case "i":
|
14617
|
+
case "ii":
|
14618
|
+
return parseNDigits(token.length, dateString);
|
14619
|
+
// 2nd
|
14620
|
+
case "io":
|
14621
|
+
return match2.ordinalNumber(dateString, { unit: "day" });
|
14622
|
+
// Tue
|
14623
|
+
case "iii":
|
14624
|
+
return mapValue(
|
14625
|
+
match2.day(dateString, {
|
14626
|
+
width: "abbreviated",
|
14627
|
+
context: "formatting"
|
14628
|
+
}) || match2.day(dateString, {
|
14629
|
+
width: "short",
|
14630
|
+
context: "formatting"
|
14631
|
+
}) || match2.day(dateString, {
|
14632
|
+
width: "narrow",
|
14633
|
+
context: "formatting"
|
14634
|
+
}),
|
14635
|
+
valueCallback
|
14636
|
+
);
|
14637
|
+
// T
|
14638
|
+
case "iiiii":
|
14639
|
+
return mapValue(
|
14640
|
+
match2.day(dateString, {
|
14641
|
+
width: "narrow",
|
14642
|
+
context: "formatting"
|
14643
|
+
}),
|
14644
|
+
valueCallback
|
14645
|
+
);
|
14646
|
+
// Tu
|
14647
|
+
case "iiiiii":
|
14648
|
+
return mapValue(
|
14649
|
+
match2.day(dateString, {
|
14650
|
+
width: "short",
|
14651
|
+
context: "formatting"
|
14652
|
+
}) || match2.day(dateString, {
|
14653
|
+
width: "narrow",
|
14654
|
+
context: "formatting"
|
14655
|
+
}),
|
14656
|
+
valueCallback
|
14657
|
+
);
|
14658
|
+
// Tuesday
|
14659
|
+
case "iiii":
|
14660
|
+
default:
|
14661
|
+
return mapValue(
|
14662
|
+
match2.day(dateString, {
|
14663
|
+
width: "wide",
|
14664
|
+
context: "formatting"
|
14665
|
+
}) || match2.day(dateString, {
|
14666
|
+
width: "abbreviated",
|
14667
|
+
context: "formatting"
|
14668
|
+
}) || match2.day(dateString, {
|
14669
|
+
width: "short",
|
14670
|
+
context: "formatting"
|
14671
|
+
}) || match2.day(dateString, {
|
14672
|
+
width: "narrow",
|
14673
|
+
context: "formatting"
|
14674
|
+
}),
|
14675
|
+
valueCallback
|
14676
|
+
);
|
14677
|
+
}
|
14678
|
+
}
|
14679
|
+
validate(_date, value) {
|
14680
|
+
return value >= 1 && value <= 7;
|
14681
|
+
}
|
14682
|
+
set(date2, _flags, value) {
|
14683
|
+
date2 = setISODay(date2, value);
|
14684
|
+
date2.setHours(0, 0, 0, 0);
|
14685
|
+
return date2;
|
14686
|
+
}
|
14687
|
+
}
|
14688
|
+
class AMPMParser extends Parser {
|
14689
|
+
constructor() {
|
14690
|
+
super(...arguments);
|
14691
|
+
__publicField(this, "priority", 80);
|
14692
|
+
__publicField(this, "incompatibleTokens", ["b", "B", "H", "k", "t", "T"]);
|
14693
|
+
}
|
14694
|
+
parse(dateString, token, match2) {
|
14695
|
+
switch (token) {
|
14696
|
+
case "a":
|
14697
|
+
case "aa":
|
14698
|
+
case "aaa":
|
14699
|
+
return match2.dayPeriod(dateString, {
|
14700
|
+
width: "abbreviated",
|
14701
|
+
context: "formatting"
|
14702
|
+
}) || match2.dayPeriod(dateString, {
|
14703
|
+
width: "narrow",
|
14704
|
+
context: "formatting"
|
14705
|
+
});
|
14706
|
+
case "aaaaa":
|
14707
|
+
return match2.dayPeriod(dateString, {
|
14708
|
+
width: "narrow",
|
14709
|
+
context: "formatting"
|
14710
|
+
});
|
14711
|
+
case "aaaa":
|
14712
|
+
default:
|
14713
|
+
return match2.dayPeriod(dateString, {
|
14714
|
+
width: "wide",
|
14715
|
+
context: "formatting"
|
14716
|
+
}) || match2.dayPeriod(dateString, {
|
14717
|
+
width: "abbreviated",
|
14718
|
+
context: "formatting"
|
14719
|
+
}) || match2.dayPeriod(dateString, {
|
14720
|
+
width: "narrow",
|
14721
|
+
context: "formatting"
|
14722
|
+
});
|
14723
|
+
}
|
14724
|
+
}
|
14725
|
+
set(date2, _flags, value) {
|
14726
|
+
date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
14727
|
+
return date2;
|
14728
|
+
}
|
14729
|
+
}
|
14730
|
+
class AMPMMidnightParser extends Parser {
|
14731
|
+
constructor() {
|
14732
|
+
super(...arguments);
|
14733
|
+
__publicField(this, "priority", 80);
|
14734
|
+
__publicField(this, "incompatibleTokens", ["a", "B", "H", "k", "t", "T"]);
|
14735
|
+
}
|
14736
|
+
parse(dateString, token, match2) {
|
14737
|
+
switch (token) {
|
14738
|
+
case "b":
|
14739
|
+
case "bb":
|
14740
|
+
case "bbb":
|
14741
|
+
return match2.dayPeriod(dateString, {
|
14742
|
+
width: "abbreviated",
|
14743
|
+
context: "formatting"
|
14744
|
+
}) || match2.dayPeriod(dateString, {
|
14745
|
+
width: "narrow",
|
14746
|
+
context: "formatting"
|
14747
|
+
});
|
14748
|
+
case "bbbbb":
|
14749
|
+
return match2.dayPeriod(dateString, {
|
14750
|
+
width: "narrow",
|
14751
|
+
context: "formatting"
|
14752
|
+
});
|
14753
|
+
case "bbbb":
|
14754
|
+
default:
|
14755
|
+
return match2.dayPeriod(dateString, {
|
14756
|
+
width: "wide",
|
14757
|
+
context: "formatting"
|
14758
|
+
}) || match2.dayPeriod(dateString, {
|
14759
|
+
width: "abbreviated",
|
14760
|
+
context: "formatting"
|
14761
|
+
}) || match2.dayPeriod(dateString, {
|
14762
|
+
width: "narrow",
|
14763
|
+
context: "formatting"
|
14764
|
+
});
|
14765
|
+
}
|
14766
|
+
}
|
14767
|
+
set(date2, _flags, value) {
|
14768
|
+
date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
14769
|
+
return date2;
|
14770
|
+
}
|
14771
|
+
}
|
14772
|
+
class DayPeriodParser extends Parser {
|
14773
|
+
constructor() {
|
14774
|
+
super(...arguments);
|
14775
|
+
__publicField(this, "priority", 80);
|
14776
|
+
__publicField(this, "incompatibleTokens", ["a", "b", "t", "T"]);
|
14777
|
+
}
|
14778
|
+
parse(dateString, token, match2) {
|
14779
|
+
switch (token) {
|
14780
|
+
case "B":
|
14781
|
+
case "BB":
|
14782
|
+
case "BBB":
|
14783
|
+
return match2.dayPeriod(dateString, {
|
14784
|
+
width: "abbreviated",
|
14785
|
+
context: "formatting"
|
14786
|
+
}) || match2.dayPeriod(dateString, {
|
14787
|
+
width: "narrow",
|
14788
|
+
context: "formatting"
|
14789
|
+
});
|
14790
|
+
case "BBBBB":
|
14791
|
+
return match2.dayPeriod(dateString, {
|
14792
|
+
width: "narrow",
|
14793
|
+
context: "formatting"
|
14794
|
+
});
|
14795
|
+
case "BBBB":
|
14796
|
+
default:
|
14797
|
+
return match2.dayPeriod(dateString, {
|
14798
|
+
width: "wide",
|
14799
|
+
context: "formatting"
|
14800
|
+
}) || match2.dayPeriod(dateString, {
|
14801
|
+
width: "abbreviated",
|
14802
|
+
context: "formatting"
|
14803
|
+
}) || match2.dayPeriod(dateString, {
|
14804
|
+
width: "narrow",
|
14805
|
+
context: "formatting"
|
14806
|
+
});
|
14807
|
+
}
|
14808
|
+
}
|
14809
|
+
set(date2, _flags, value) {
|
14810
|
+
date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
14811
|
+
return date2;
|
14812
|
+
}
|
14813
|
+
}
|
14814
|
+
class Hour1to12Parser extends Parser {
|
14815
|
+
constructor() {
|
14816
|
+
super(...arguments);
|
14817
|
+
__publicField(this, "priority", 70);
|
14818
|
+
__publicField(this, "incompatibleTokens", ["H", "K", "k", "t", "T"]);
|
14819
|
+
}
|
14820
|
+
parse(dateString, token, match2) {
|
14821
|
+
switch (token) {
|
14822
|
+
case "h":
|
14823
|
+
return parseNumericPattern(numericPatterns.hour12h, dateString);
|
14824
|
+
case "ho":
|
14825
|
+
return match2.ordinalNumber(dateString, { unit: "hour" });
|
14826
|
+
default:
|
14827
|
+
return parseNDigits(token.length, dateString);
|
14828
|
+
}
|
14829
|
+
}
|
14830
|
+
validate(_date, value) {
|
14831
|
+
return value >= 1 && value <= 12;
|
14832
|
+
}
|
14833
|
+
set(date2, _flags, value) {
|
14834
|
+
const isPM = date2.getHours() >= 12;
|
14835
|
+
if (isPM && value < 12) {
|
14836
|
+
date2.setHours(value + 12, 0, 0, 0);
|
14837
|
+
} else if (!isPM && value === 12) {
|
14838
|
+
date2.setHours(0, 0, 0, 0);
|
14839
|
+
} else {
|
14840
|
+
date2.setHours(value, 0, 0, 0);
|
14841
|
+
}
|
14842
|
+
return date2;
|
14843
|
+
}
|
14844
|
+
}
|
14845
|
+
class Hour0to23Parser extends Parser {
|
14846
|
+
constructor() {
|
14847
|
+
super(...arguments);
|
14848
|
+
__publicField(this, "priority", 70);
|
14849
|
+
__publicField(this, "incompatibleTokens", ["a", "b", "h", "K", "k", "t", "T"]);
|
14850
|
+
}
|
14851
|
+
parse(dateString, token, match2) {
|
14852
|
+
switch (token) {
|
14853
|
+
case "H":
|
14854
|
+
return parseNumericPattern(numericPatterns.hour23h, dateString);
|
14855
|
+
case "Ho":
|
14856
|
+
return match2.ordinalNumber(dateString, { unit: "hour" });
|
14857
|
+
default:
|
14858
|
+
return parseNDigits(token.length, dateString);
|
14859
|
+
}
|
14860
|
+
}
|
14861
|
+
validate(_date, value) {
|
14862
|
+
return value >= 0 && value <= 23;
|
14863
|
+
}
|
14864
|
+
set(date2, _flags, value) {
|
14865
|
+
date2.setHours(value, 0, 0, 0);
|
14866
|
+
return date2;
|
14867
|
+
}
|
14868
|
+
}
|
14869
|
+
class Hour0To11Parser extends Parser {
|
14870
|
+
constructor() {
|
14871
|
+
super(...arguments);
|
14872
|
+
__publicField(this, "priority", 70);
|
14873
|
+
__publicField(this, "incompatibleTokens", ["h", "H", "k", "t", "T"]);
|
14874
|
+
}
|
14875
|
+
parse(dateString, token, match2) {
|
14876
|
+
switch (token) {
|
14877
|
+
case "K":
|
14878
|
+
return parseNumericPattern(numericPatterns.hour11h, dateString);
|
14879
|
+
case "Ko":
|
14880
|
+
return match2.ordinalNumber(dateString, { unit: "hour" });
|
14881
|
+
default:
|
14882
|
+
return parseNDigits(token.length, dateString);
|
14883
|
+
}
|
14884
|
+
}
|
14885
|
+
validate(_date, value) {
|
14886
|
+
return value >= 0 && value <= 11;
|
14887
|
+
}
|
14888
|
+
set(date2, _flags, value) {
|
14889
|
+
const isPM = date2.getHours() >= 12;
|
14890
|
+
if (isPM && value < 12) {
|
14891
|
+
date2.setHours(value + 12, 0, 0, 0);
|
14892
|
+
} else {
|
14893
|
+
date2.setHours(value, 0, 0, 0);
|
14894
|
+
}
|
14895
|
+
return date2;
|
14896
|
+
}
|
14897
|
+
}
|
14898
|
+
class Hour1To24Parser extends Parser {
|
14899
|
+
constructor() {
|
14900
|
+
super(...arguments);
|
14901
|
+
__publicField(this, "priority", 70);
|
14902
|
+
__publicField(this, "incompatibleTokens", ["a", "b", "h", "H", "K", "t", "T"]);
|
14903
|
+
}
|
14904
|
+
parse(dateString, token, match2) {
|
14905
|
+
switch (token) {
|
14906
|
+
case "k":
|
14907
|
+
return parseNumericPattern(numericPatterns.hour24h, dateString);
|
14908
|
+
case "ko":
|
14909
|
+
return match2.ordinalNumber(dateString, { unit: "hour" });
|
14910
|
+
default:
|
14911
|
+
return parseNDigits(token.length, dateString);
|
14912
|
+
}
|
14913
|
+
}
|
14914
|
+
validate(_date, value) {
|
14915
|
+
return value >= 1 && value <= 24;
|
14916
|
+
}
|
14917
|
+
set(date2, _flags, value) {
|
14918
|
+
const hours = value <= 24 ? value % 24 : value;
|
14919
|
+
date2.setHours(hours, 0, 0, 0);
|
14920
|
+
return date2;
|
14921
|
+
}
|
14922
|
+
}
|
14923
|
+
class MinuteParser extends Parser {
|
14924
|
+
constructor() {
|
14925
|
+
super(...arguments);
|
14926
|
+
__publicField(this, "priority", 60);
|
14927
|
+
__publicField(this, "incompatibleTokens", ["t", "T"]);
|
14928
|
+
}
|
14929
|
+
parse(dateString, token, match2) {
|
14930
|
+
switch (token) {
|
14931
|
+
case "m":
|
14932
|
+
return parseNumericPattern(numericPatterns.minute, dateString);
|
14933
|
+
case "mo":
|
14934
|
+
return match2.ordinalNumber(dateString, { unit: "minute" });
|
14935
|
+
default:
|
14936
|
+
return parseNDigits(token.length, dateString);
|
14937
|
+
}
|
14938
|
+
}
|
14939
|
+
validate(_date, value) {
|
14940
|
+
return value >= 0 && value <= 59;
|
14941
|
+
}
|
14942
|
+
set(date2, _flags, value) {
|
14943
|
+
date2.setMinutes(value, 0, 0);
|
14944
|
+
return date2;
|
14945
|
+
}
|
14946
|
+
}
|
14947
|
+
class SecondParser extends Parser {
|
14948
|
+
constructor() {
|
14949
|
+
super(...arguments);
|
14950
|
+
__publicField(this, "priority", 50);
|
14951
|
+
__publicField(this, "incompatibleTokens", ["t", "T"]);
|
14952
|
+
}
|
14953
|
+
parse(dateString, token, match2) {
|
14954
|
+
switch (token) {
|
14955
|
+
case "s":
|
14956
|
+
return parseNumericPattern(numericPatterns.second, dateString);
|
14957
|
+
case "so":
|
14958
|
+
return match2.ordinalNumber(dateString, { unit: "second" });
|
14959
|
+
default:
|
14960
|
+
return parseNDigits(token.length, dateString);
|
14961
|
+
}
|
14962
|
+
}
|
14963
|
+
validate(_date, value) {
|
14964
|
+
return value >= 0 && value <= 59;
|
14965
|
+
}
|
14966
|
+
set(date2, _flags, value) {
|
14967
|
+
date2.setSeconds(value, 0);
|
14968
|
+
return date2;
|
14969
|
+
}
|
14970
|
+
}
|
14971
|
+
class FractionOfSecondParser extends Parser {
|
14972
|
+
constructor() {
|
14973
|
+
super(...arguments);
|
14974
|
+
__publicField(this, "priority", 30);
|
14975
|
+
__publicField(this, "incompatibleTokens", ["t", "T"]);
|
14976
|
+
}
|
14977
|
+
parse(dateString, token) {
|
14978
|
+
const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3));
|
14979
|
+
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
14980
|
+
}
|
14981
|
+
set(date2, _flags, value) {
|
14982
|
+
date2.setMilliseconds(value);
|
14983
|
+
return date2;
|
14984
|
+
}
|
14985
|
+
}
|
14986
|
+
class ISOTimezoneWithZParser extends Parser {
|
14987
|
+
constructor() {
|
14988
|
+
super(...arguments);
|
14989
|
+
__publicField(this, "priority", 10);
|
14990
|
+
__publicField(this, "incompatibleTokens", ["t", "T", "x"]);
|
14991
|
+
}
|
14992
|
+
parse(dateString, token) {
|
14993
|
+
switch (token) {
|
14994
|
+
case "X":
|
14995
|
+
return parseTimezonePattern(
|
14996
|
+
timezonePatterns.basicOptionalMinutes,
|
14997
|
+
dateString
|
14998
|
+
);
|
14999
|
+
case "XX":
|
15000
|
+
return parseTimezonePattern(timezonePatterns.basic, dateString);
|
15001
|
+
case "XXXX":
|
15002
|
+
return parseTimezonePattern(
|
15003
|
+
timezonePatterns.basicOptionalSeconds,
|
15004
|
+
dateString
|
15005
|
+
);
|
15006
|
+
case "XXXXX":
|
15007
|
+
return parseTimezonePattern(
|
15008
|
+
timezonePatterns.extendedOptionalSeconds,
|
15009
|
+
dateString
|
15010
|
+
);
|
15011
|
+
case "XXX":
|
15012
|
+
default:
|
15013
|
+
return parseTimezonePattern(timezonePatterns.extended, dateString);
|
15014
|
+
}
|
15015
|
+
}
|
15016
|
+
set(date2, flags, value) {
|
15017
|
+
if (flags.timestampIsSet) return date2;
|
15018
|
+
return constructFrom(
|
15019
|
+
date2,
|
15020
|
+
date2.getTime() - getTimezoneOffsetInMilliseconds(date2) - value
|
15021
|
+
);
|
15022
|
+
}
|
15023
|
+
}
|
15024
|
+
class ISOTimezoneParser extends Parser {
|
15025
|
+
constructor() {
|
15026
|
+
super(...arguments);
|
15027
|
+
__publicField(this, "priority", 10);
|
15028
|
+
__publicField(this, "incompatibleTokens", ["t", "T", "X"]);
|
15029
|
+
}
|
15030
|
+
parse(dateString, token) {
|
15031
|
+
switch (token) {
|
15032
|
+
case "x":
|
15033
|
+
return parseTimezonePattern(
|
15034
|
+
timezonePatterns.basicOptionalMinutes,
|
15035
|
+
dateString
|
15036
|
+
);
|
15037
|
+
case "xx":
|
15038
|
+
return parseTimezonePattern(timezonePatterns.basic, dateString);
|
15039
|
+
case "xxxx":
|
15040
|
+
return parseTimezonePattern(
|
15041
|
+
timezonePatterns.basicOptionalSeconds,
|
15042
|
+
dateString
|
15043
|
+
);
|
15044
|
+
case "xxxxx":
|
15045
|
+
return parseTimezonePattern(
|
15046
|
+
timezonePatterns.extendedOptionalSeconds,
|
15047
|
+
dateString
|
15048
|
+
);
|
15049
|
+
case "xxx":
|
15050
|
+
default:
|
15051
|
+
return parseTimezonePattern(timezonePatterns.extended, dateString);
|
15052
|
+
}
|
15053
|
+
}
|
15054
|
+
set(date2, flags, value) {
|
15055
|
+
if (flags.timestampIsSet) return date2;
|
15056
|
+
return constructFrom(
|
15057
|
+
date2,
|
15058
|
+
date2.getTime() - getTimezoneOffsetInMilliseconds(date2) - value
|
15059
|
+
);
|
15060
|
+
}
|
15061
|
+
}
|
15062
|
+
class TimestampSecondsParser extends Parser {
|
15063
|
+
constructor() {
|
15064
|
+
super(...arguments);
|
15065
|
+
__publicField(this, "priority", 40);
|
15066
|
+
__publicField(this, "incompatibleTokens", "*");
|
15067
|
+
}
|
15068
|
+
parse(dateString) {
|
15069
|
+
return parseAnyDigitsSigned(dateString);
|
15070
|
+
}
|
15071
|
+
set(date2, _flags, value) {
|
15072
|
+
return [constructFrom(date2, value * 1e3), { timestampIsSet: true }];
|
15073
|
+
}
|
15074
|
+
}
|
15075
|
+
class TimestampMillisecondsParser extends Parser {
|
15076
|
+
constructor() {
|
15077
|
+
super(...arguments);
|
15078
|
+
__publicField(this, "priority", 20);
|
15079
|
+
__publicField(this, "incompatibleTokens", "*");
|
15080
|
+
}
|
15081
|
+
parse(dateString) {
|
15082
|
+
return parseAnyDigitsSigned(dateString);
|
15083
|
+
}
|
15084
|
+
set(date2, _flags, value) {
|
15085
|
+
return [constructFrom(date2, value), { timestampIsSet: true }];
|
15086
|
+
}
|
15087
|
+
}
|
15088
|
+
const parsers = {
|
15089
|
+
G: new EraParser(),
|
15090
|
+
y: new YearParser(),
|
15091
|
+
Y: new LocalWeekYearParser(),
|
15092
|
+
R: new ISOWeekYearParser(),
|
15093
|
+
u: new ExtendedYearParser(),
|
15094
|
+
Q: new QuarterParser(),
|
15095
|
+
q: new StandAloneQuarterParser(),
|
15096
|
+
M: new MonthParser(),
|
15097
|
+
L: new StandAloneMonthParser(),
|
15098
|
+
w: new LocalWeekParser(),
|
15099
|
+
I: new ISOWeekParser(),
|
15100
|
+
d: new DateParser(),
|
15101
|
+
D: new DayOfYearParser(),
|
15102
|
+
E: new DayParser(),
|
15103
|
+
e: new LocalDayParser(),
|
15104
|
+
c: new StandAloneLocalDayParser(),
|
15105
|
+
i: new ISODayParser(),
|
15106
|
+
a: new AMPMParser(),
|
15107
|
+
b: new AMPMMidnightParser(),
|
15108
|
+
B: new DayPeriodParser(),
|
15109
|
+
h: new Hour1to12Parser(),
|
15110
|
+
H: new Hour0to23Parser(),
|
15111
|
+
K: new Hour0To11Parser(),
|
15112
|
+
k: new Hour1To24Parser(),
|
15113
|
+
m: new MinuteParser(),
|
15114
|
+
s: new SecondParser(),
|
15115
|
+
S: new FractionOfSecondParser(),
|
15116
|
+
X: new ISOTimezoneWithZParser(),
|
15117
|
+
x: new ISOTimezoneParser(),
|
15118
|
+
t: new TimestampSecondsParser(),
|
15119
|
+
T: new TimestampMillisecondsParser()
|
15120
|
+
};
|
15121
|
+
const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
15122
|
+
const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
15123
|
+
const escapedStringRegExp = /^'([^]*?)'?$/;
|
15124
|
+
const doubleQuoteRegExp = /''/g;
|
15125
|
+
const notWhitespaceRegExp = /\S/;
|
15126
|
+
const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
15127
|
+
function parse$2(dateStr, formatStr, referenceDate, options) {
|
15128
|
+
var _a, _b, _c, _d;
|
15129
|
+
const defaultOptions2 = getDefaultOptions();
|
15130
|
+
const locale2 = defaultOptions2.locale ?? enUS;
|
15131
|
+
const firstWeekContainsDate = defaultOptions2.firstWeekContainsDate ?? ((_b = (_a = defaultOptions2.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? 1;
|
15132
|
+
const weekStartsOn = defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
15133
|
+
if (formatStr === "") {
|
15134
|
+
if (dateStr === "") {
|
15135
|
+
return toDate(referenceDate);
|
15136
|
+
} else {
|
15137
|
+
return constructFrom(referenceDate, NaN);
|
15138
|
+
}
|
15139
|
+
}
|
15140
|
+
const subFnOptions = {
|
15141
|
+
firstWeekContainsDate,
|
15142
|
+
weekStartsOn,
|
15143
|
+
locale: locale2
|
15144
|
+
};
|
15145
|
+
const setters = [new DateToSystemTimezoneSetter()];
|
15146
|
+
const tokens = formatStr.match(longFormattingTokensRegExp).map((substring) => {
|
15147
|
+
const firstCharacter = substring[0];
|
15148
|
+
if (firstCharacter in longFormatters) {
|
15149
|
+
const longFormatter = longFormatters[firstCharacter];
|
15150
|
+
return longFormatter(substring, locale2.formatLong);
|
15151
|
+
}
|
15152
|
+
return substring;
|
15153
|
+
}).join("").match(formattingTokensRegExp);
|
15154
|
+
const usedTokens = [];
|
15155
|
+
for (let token of tokens) {
|
15156
|
+
if (isProtectedWeekYearToken(token)) {
|
15157
|
+
warnOrThrowProtectedError(token, formatStr, dateStr);
|
15158
|
+
}
|
15159
|
+
if (isProtectedDayOfYearToken(token)) {
|
15160
|
+
warnOrThrowProtectedError(token, formatStr, dateStr);
|
15161
|
+
}
|
15162
|
+
const firstCharacter = token[0];
|
15163
|
+
const parser = parsers[firstCharacter];
|
15164
|
+
if (parser) {
|
15165
|
+
const { incompatibleTokens } = parser;
|
15166
|
+
if (Array.isArray(incompatibleTokens)) {
|
15167
|
+
const incompatibleToken = usedTokens.find(
|
15168
|
+
(usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter
|
15169
|
+
);
|
15170
|
+
if (incompatibleToken) {
|
15171
|
+
throw new RangeError(
|
15172
|
+
`The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time`
|
15173
|
+
);
|
15174
|
+
}
|
15175
|
+
} else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) {
|
15176
|
+
throw new RangeError(
|
15177
|
+
`The format string mustn't contain \`${token}\` and any other token at the same time`
|
15178
|
+
);
|
15179
|
+
}
|
15180
|
+
usedTokens.push({ token: firstCharacter, fullToken: token });
|
15181
|
+
const parseResult = parser.run(
|
15182
|
+
dateStr,
|
15183
|
+
token,
|
15184
|
+
locale2.match,
|
15185
|
+
subFnOptions
|
15186
|
+
);
|
15187
|
+
if (!parseResult) {
|
15188
|
+
return constructFrom(referenceDate, NaN);
|
15189
|
+
}
|
15190
|
+
setters.push(parseResult.setter);
|
15191
|
+
dateStr = parseResult.rest;
|
15192
|
+
} else {
|
15193
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
15194
|
+
throw new RangeError(
|
15195
|
+
"Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
|
15196
|
+
);
|
15197
|
+
}
|
15198
|
+
if (token === "''") {
|
15199
|
+
token = "'";
|
15200
|
+
} else if (firstCharacter === "'") {
|
15201
|
+
token = cleanEscapedString(token);
|
15202
|
+
}
|
15203
|
+
if (dateStr.indexOf(token) === 0) {
|
15204
|
+
dateStr = dateStr.slice(token.length);
|
15205
|
+
} else {
|
15206
|
+
return constructFrom(referenceDate, NaN);
|
15207
|
+
}
|
15208
|
+
}
|
15209
|
+
}
|
15210
|
+
if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) {
|
15211
|
+
return constructFrom(referenceDate, NaN);
|
15212
|
+
}
|
15213
|
+
const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a2, b2) => b2 - a2).filter((priority, index2, array2) => array2.indexOf(priority) === index2).map(
|
15214
|
+
(priority) => setters.filter((setter) => setter.priority === priority).sort((a2, b2) => b2.subPriority - a2.subPriority)
|
15215
|
+
).map((setterArray) => setterArray[0]);
|
15216
|
+
let date2 = toDate(referenceDate);
|
15217
|
+
if (isNaN(date2.getTime())) {
|
15218
|
+
return constructFrom(referenceDate, NaN);
|
15219
|
+
}
|
15220
|
+
const flags = {};
|
15221
|
+
for (const setter of uniquePrioritySetters) {
|
15222
|
+
if (!setter.validate(date2, subFnOptions)) {
|
15223
|
+
return constructFrom(referenceDate, NaN);
|
15224
|
+
}
|
15225
|
+
const result = setter.set(date2, flags, subFnOptions);
|
15226
|
+
if (Array.isArray(result)) {
|
15227
|
+
date2 = result[0];
|
15228
|
+
Object.assign(flags, result[1]);
|
15229
|
+
} else {
|
15230
|
+
date2 = result;
|
15231
|
+
}
|
15232
|
+
}
|
15233
|
+
return constructFrom(referenceDate, date2);
|
15234
|
+
}
|
15235
|
+
function cleanEscapedString(input) {
|
15236
|
+
return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
|
13473
15237
|
}
|
13474
15238
|
function isSameMonth(dateLeft, dateRight) {
|
13475
15239
|
const _dateLeft = toDate(dateLeft);
|
@@ -13484,6 +15248,184 @@ function isSameYear(dateLeft, dateRight) {
|
|
13484
15248
|
function subDays(date2, amount) {
|
13485
15249
|
return addDays(date2, -amount);
|
13486
15250
|
}
|
15251
|
+
function parseISO(argument, options) {
|
15252
|
+
const additionalDigits = 2;
|
15253
|
+
const dateStrings = splitDateString(argument);
|
15254
|
+
let date2;
|
15255
|
+
if (dateStrings.date) {
|
15256
|
+
const parseYearResult = parseYear$1(dateStrings.date, additionalDigits);
|
15257
|
+
date2 = parseDate(parseYearResult.restDateString, parseYearResult.year);
|
15258
|
+
}
|
15259
|
+
if (!date2 || isNaN(date2.getTime())) {
|
15260
|
+
return /* @__PURE__ */ new Date(NaN);
|
15261
|
+
}
|
15262
|
+
const timestamp = date2.getTime();
|
15263
|
+
let time2 = 0;
|
15264
|
+
let offset2;
|
15265
|
+
if (dateStrings.time) {
|
15266
|
+
time2 = parseTime(dateStrings.time);
|
15267
|
+
if (isNaN(time2)) {
|
15268
|
+
return /* @__PURE__ */ new Date(NaN);
|
15269
|
+
}
|
15270
|
+
}
|
15271
|
+
if (dateStrings.timezone) {
|
15272
|
+
offset2 = parseTimezone(dateStrings.timezone);
|
15273
|
+
if (isNaN(offset2)) {
|
15274
|
+
return /* @__PURE__ */ new Date(NaN);
|
15275
|
+
}
|
15276
|
+
} else {
|
15277
|
+
const dirtyDate = new Date(timestamp + time2);
|
15278
|
+
const result = /* @__PURE__ */ new Date(0);
|
15279
|
+
result.setFullYear(
|
15280
|
+
dirtyDate.getUTCFullYear(),
|
15281
|
+
dirtyDate.getUTCMonth(),
|
15282
|
+
dirtyDate.getUTCDate()
|
15283
|
+
);
|
15284
|
+
result.setHours(
|
15285
|
+
dirtyDate.getUTCHours(),
|
15286
|
+
dirtyDate.getUTCMinutes(),
|
15287
|
+
dirtyDate.getUTCSeconds(),
|
15288
|
+
dirtyDate.getUTCMilliseconds()
|
15289
|
+
);
|
15290
|
+
return result;
|
15291
|
+
}
|
15292
|
+
return new Date(timestamp + time2 + offset2);
|
15293
|
+
}
|
15294
|
+
const patterns = {
|
15295
|
+
dateTimeDelimiter: /[T ]/,
|
15296
|
+
timeZoneDelimiter: /[Z ]/i,
|
15297
|
+
timezone: /([Z+-].*)$/
|
15298
|
+
};
|
15299
|
+
const dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
|
15300
|
+
const timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
|
15301
|
+
const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
15302
|
+
function splitDateString(dateString) {
|
15303
|
+
const dateStrings = {};
|
15304
|
+
const array2 = dateString.split(patterns.dateTimeDelimiter);
|
15305
|
+
let timeString;
|
15306
|
+
if (array2.length > 2) {
|
15307
|
+
return dateStrings;
|
15308
|
+
}
|
15309
|
+
if (/:/.test(array2[0])) {
|
15310
|
+
timeString = array2[0];
|
15311
|
+
} else {
|
15312
|
+
dateStrings.date = array2[0];
|
15313
|
+
timeString = array2[1];
|
15314
|
+
if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
|
15315
|
+
dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
|
15316
|
+
timeString = dateString.substr(
|
15317
|
+
dateStrings.date.length,
|
15318
|
+
dateString.length
|
15319
|
+
);
|
15320
|
+
}
|
15321
|
+
}
|
15322
|
+
if (timeString) {
|
15323
|
+
const token = patterns.timezone.exec(timeString);
|
15324
|
+
if (token) {
|
15325
|
+
dateStrings.time = timeString.replace(token[1], "");
|
15326
|
+
dateStrings.timezone = token[1];
|
15327
|
+
} else {
|
15328
|
+
dateStrings.time = timeString;
|
15329
|
+
}
|
15330
|
+
}
|
15331
|
+
return dateStrings;
|
15332
|
+
}
|
15333
|
+
function parseYear$1(dateString, additionalDigits) {
|
15334
|
+
const regex = new RegExp(
|
15335
|
+
"^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
|
15336
|
+
);
|
15337
|
+
const captures = dateString.match(regex);
|
15338
|
+
if (!captures) return { year: NaN, restDateString: "" };
|
15339
|
+
const year = captures[1] ? parseInt(captures[1]) : null;
|
15340
|
+
const century = captures[2] ? parseInt(captures[2]) : null;
|
15341
|
+
return {
|
15342
|
+
year: century === null ? year : century * 100,
|
15343
|
+
restDateString: dateString.slice((captures[1] || captures[2]).length)
|
15344
|
+
};
|
15345
|
+
}
|
15346
|
+
function parseDate(dateString, year) {
|
15347
|
+
if (year === null) return /* @__PURE__ */ new Date(NaN);
|
15348
|
+
const captures = dateString.match(dateRegex);
|
15349
|
+
if (!captures) return /* @__PURE__ */ new Date(NaN);
|
15350
|
+
const isWeekDate = !!captures[4];
|
15351
|
+
const dayOfYear = parseDateUnit(captures[1]);
|
15352
|
+
const month = parseDateUnit(captures[2]) - 1;
|
15353
|
+
const day = parseDateUnit(captures[3]);
|
15354
|
+
const week = parseDateUnit(captures[4]);
|
15355
|
+
const dayOfWeek = parseDateUnit(captures[5]) - 1;
|
15356
|
+
if (isWeekDate) {
|
15357
|
+
if (!validateWeekDate(year, week, dayOfWeek)) {
|
15358
|
+
return /* @__PURE__ */ new Date(NaN);
|
15359
|
+
}
|
15360
|
+
return dayOfISOWeekYear(year, week, dayOfWeek);
|
15361
|
+
} else {
|
15362
|
+
const date2 = /* @__PURE__ */ new Date(0);
|
15363
|
+
if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
|
15364
|
+
return /* @__PURE__ */ new Date(NaN);
|
15365
|
+
}
|
15366
|
+
date2.setUTCFullYear(year, month, Math.max(dayOfYear, day));
|
15367
|
+
return date2;
|
15368
|
+
}
|
15369
|
+
}
|
15370
|
+
function parseDateUnit(value) {
|
15371
|
+
return value ? parseInt(value) : 1;
|
15372
|
+
}
|
15373
|
+
function parseTime(timeString) {
|
15374
|
+
const captures = timeString.match(timeRegex);
|
15375
|
+
if (!captures) return NaN;
|
15376
|
+
const hours = parseTimeUnit(captures[1]);
|
15377
|
+
const minutes = parseTimeUnit(captures[2]);
|
15378
|
+
const seconds = parseTimeUnit(captures[3]);
|
15379
|
+
if (!validateTime(hours, minutes, seconds)) {
|
15380
|
+
return NaN;
|
15381
|
+
}
|
15382
|
+
return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
|
15383
|
+
}
|
15384
|
+
function parseTimeUnit(value) {
|
15385
|
+
return value && parseFloat(value.replace(",", ".")) || 0;
|
15386
|
+
}
|
15387
|
+
function parseTimezone(timezoneString) {
|
15388
|
+
if (timezoneString === "Z") return 0;
|
15389
|
+
const captures = timezoneString.match(timezoneRegex);
|
15390
|
+
if (!captures) return 0;
|
15391
|
+
const sign2 = captures[1] === "+" ? -1 : 1;
|
15392
|
+
const hours = parseInt(captures[2]);
|
15393
|
+
const minutes = captures[3] && parseInt(captures[3]) || 0;
|
15394
|
+
if (!validateTimezone(hours, minutes)) {
|
15395
|
+
return NaN;
|
15396
|
+
}
|
15397
|
+
return sign2 * (hours * millisecondsInHour + minutes * millisecondsInMinute);
|
15398
|
+
}
|
15399
|
+
function dayOfISOWeekYear(isoWeekYear, week, day) {
|
15400
|
+
const date2 = /* @__PURE__ */ new Date(0);
|
15401
|
+
date2.setUTCFullYear(isoWeekYear, 0, 4);
|
15402
|
+
const fourthOfJanuaryDay = date2.getUTCDay() || 7;
|
15403
|
+
const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
|
15404
|
+
date2.setUTCDate(date2.getUTCDate() + diff);
|
15405
|
+
return date2;
|
15406
|
+
}
|
15407
|
+
const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
15408
|
+
function isLeapYearIndex(year) {
|
15409
|
+
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
15410
|
+
}
|
15411
|
+
function validateDate(year, month, date2) {
|
15412
|
+
return month >= 0 && month <= 11 && date2 >= 1 && date2 <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
|
15413
|
+
}
|
15414
|
+
function validateDayOfYearDate(year, dayOfYear) {
|
15415
|
+
return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
|
15416
|
+
}
|
15417
|
+
function validateWeekDate(_year, week, day) {
|
15418
|
+
return week >= 1 && week <= 53 && day >= 0 && day <= 6;
|
15419
|
+
}
|
15420
|
+
function validateTime(hours, minutes, seconds) {
|
15421
|
+
if (hours === 24) {
|
15422
|
+
return minutes === 0 && seconds === 0;
|
15423
|
+
}
|
15424
|
+
return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
|
15425
|
+
}
|
15426
|
+
function validateTimezone(_hours, minutes) {
|
15427
|
+
return minutes >= 0 && minutes <= 59;
|
15428
|
+
}
|
13487
15429
|
function setMonth(date2, month) {
|
13488
15430
|
const _date = toDate(date2);
|
13489
15431
|
const year = _date.getFullYear();
|
@@ -16439,7 +18381,7 @@ const filterData = (data, value = "") => {
|
|
16439
18381
|
if (value === "" || value === null) {
|
16440
18382
|
return data;
|
16441
18383
|
}
|
16442
|
-
const
|
18384
|
+
const filteredOptions = [];
|
16443
18385
|
const shouldFilterOption = (option) => {
|
16444
18386
|
if (option.disabled) {
|
16445
18387
|
return false;
|
@@ -16449,13 +18391,22 @@ const filterData = (data, value = "") => {
|
|
16449
18391
|
data.forEach((option) => {
|
16450
18392
|
if (shouldFilterOption(option)) {
|
16451
18393
|
const parents = getOptionParents(data, option.path);
|
16452
|
-
|
18394
|
+
const index2 = option.text.toString().toLocaleLowerCase().indexOf(value.toString().toLocaleLowerCase());
|
18395
|
+
filteredOptions.push({ value: option.value, score: index2 });
|
16453
18396
|
if (parents !== null) {
|
16454
|
-
parents.forEach((option2) =>
|
18397
|
+
parents.forEach((option2) => filteredOptions.push({ value: option2 == null ? void 0 : option2.value }));
|
16455
18398
|
}
|
16456
18399
|
}
|
16457
18400
|
});
|
16458
|
-
return data.filter(({ value: value2 }) =>
|
18401
|
+
return data.filter(({ value: value2 }) => filteredOptions.find((x2) => x2.value === value2)).toSorted((a2, b2) => {
|
18402
|
+
var _a, _b;
|
18403
|
+
const scoreA = (_a = filteredOptions.find((x2) => x2.value === a2.value)) == null ? void 0 : _a.score;
|
18404
|
+
const scoreB = (_b = filteredOptions.find((x2) => x2.value === b2.value)) == null ? void 0 : _b.score;
|
18405
|
+
if (scoreA !== void 0 && scoreB !== void 0) {
|
18406
|
+
return scoreA - scoreB;
|
18407
|
+
}
|
18408
|
+
return 0;
|
18409
|
+
});
|
16459
18410
|
};
|
16460
18411
|
const debouncer = debounce$1((f2) => f2(), 200);
|
16461
18412
|
const convertToInputValue = (value) => String(value ?? "");
|
@@ -16580,6 +18531,9 @@ const useCombobox = (props, ref) => {
|
|
16580
18531
|
};
|
16581
18532
|
const handleInputKeyDown = (event) => {
|
16582
18533
|
event.persist();
|
18534
|
+
if (isElementInsideTable3OrReport(event.currentTarget) && (event.key === "ArrowUp" || event.key === "ArrowDown") && open) {
|
18535
|
+
event.stopPropagation();
|
18536
|
+
}
|
16583
18537
|
if (!event.ctrlKey && !event.metaKey) {
|
16584
18538
|
switch (event.key) {
|
16585
18539
|
case "Backspace": {
|
@@ -16883,11 +18837,12 @@ const useDatepicker = ({ defaultValue: _, calendar: calendar2, onBlur, onChange,
|
|
16883
18837
|
);
|
16884
18838
|
const formattedValue = valueAsDate ? format$1(valueAsDate) || "" : "";
|
16885
18839
|
event.target.value = formattedValue;
|
18840
|
+
const isEmpty = !event.target.value.trim();
|
16886
18841
|
if (onChange) {
|
16887
|
-
event.detail = valueAsDate;
|
18842
|
+
event.detail = !isEmpty ? valueAsDate : null;
|
16888
18843
|
onChange(event);
|
16889
18844
|
} else {
|
16890
|
-
setInternalValue(formattedValue);
|
18845
|
+
setInternalValue(!isEmpty ? formattedValue : "");
|
16891
18846
|
}
|
16892
18847
|
if (onBlur) {
|
16893
18848
|
onBlur(event);
|
@@ -32760,6 +34715,121 @@ var TableFilterComparator = /* @__PURE__ */ ((TableFilterComparator2) => {
|
|
32760
34715
|
TableFilterComparator2[TableFilterComparator2["IsNoneOf"] = 15] = "IsNoneOf";
|
32761
34716
|
return TableFilterComparator2;
|
32762
34717
|
})(TableFilterComparator || {});
|
34718
|
+
class DataType {
|
34719
|
+
}
|
34720
|
+
const localeNumberSeparators = /* @__PURE__ */ new Map();
|
34721
|
+
class NumericDataType extends DataType {
|
34722
|
+
static format(value, locale2, options) {
|
34723
|
+
const localisedValue = new Intl.NumberFormat(locale2, options).format(value);
|
34724
|
+
return localisedValue.replace(/[\u00A0\u202F]/g, " ");
|
34725
|
+
}
|
34726
|
+
static parse(value, locale2) {
|
34727
|
+
if (value === void 0 || value === null || typeof value !== "string") {
|
34728
|
+
return void 0;
|
34729
|
+
}
|
34730
|
+
if (value === "Infinity" || value === "-Infinity") {
|
34731
|
+
return Number(value);
|
34732
|
+
}
|
34733
|
+
let sanitizedValue = value.replaceAll(" ", "").replace(/[^0-9.,-]+/g, "");
|
34734
|
+
if (!sanitizedValue.length) {
|
34735
|
+
return void 0;
|
34736
|
+
}
|
34737
|
+
const decimalSeparator = this.getSeparator(locale2);
|
34738
|
+
if (decimalSeparator === ",") {
|
34739
|
+
sanitizedValue = sanitizedValue.replaceAll(".", "").replace(",", ".");
|
34740
|
+
} else {
|
34741
|
+
sanitizedValue = sanitizedValue.replaceAll(",", "");
|
34742
|
+
}
|
34743
|
+
const output = Number(sanitizedValue);
|
34744
|
+
if (isNaN(output)) {
|
34745
|
+
return void 0;
|
34746
|
+
}
|
34747
|
+
return output;
|
34748
|
+
}
|
34749
|
+
static getSeparator(locale2) {
|
34750
|
+
var _a;
|
34751
|
+
if (localeNumberSeparators.has(locale2)) {
|
34752
|
+
return localeNumberSeparators.get(locale2);
|
34753
|
+
}
|
34754
|
+
const decimalSeparator = ((_a = new Intl.NumberFormat(locale2).formatToParts(1.1).find((part) => part.type === "decimal")) == null ? void 0 : _a.value) ?? ".";
|
34755
|
+
localeNumberSeparators.set(locale2, decimalSeparator);
|
34756
|
+
return decimalSeparator;
|
34757
|
+
}
|
34758
|
+
}
|
34759
|
+
const localeDateMasks = /* @__PURE__ */ new Map();
|
34760
|
+
class DateTimeDataType extends DataType {
|
34761
|
+
static format(value, locale2, options) {
|
34762
|
+
let date2;
|
34763
|
+
if (typeof value === "string") {
|
34764
|
+
date2 = new Date(value);
|
34765
|
+
} else if (value instanceof Date) {
|
34766
|
+
date2 = value;
|
34767
|
+
} else {
|
34768
|
+
return "";
|
34769
|
+
}
|
34770
|
+
if (isNaN(date2.getTime())) {
|
34771
|
+
return "";
|
34772
|
+
}
|
34773
|
+
return new Intl.DateTimeFormat(locale2, options).format(date2).replace(/[\u00A0\u202F]/g, " ");
|
34774
|
+
}
|
34775
|
+
static parse(value, locale2) {
|
34776
|
+
if (value === void 0 || value === null || typeof value !== "string") {
|
34777
|
+
return void 0;
|
34778
|
+
}
|
34779
|
+
const sanitizedValue = value == null ? void 0 : value.trim();
|
34780
|
+
if (!(sanitizedValue == null ? void 0 : sanitizedValue.length)) {
|
34781
|
+
return void 0;
|
34782
|
+
}
|
34783
|
+
const setHoursToMidday = (date2) => {
|
34784
|
+
date2.setHours(12 - date2.getTimezoneOffset() / 60);
|
34785
|
+
};
|
34786
|
+
try {
|
34787
|
+
const date2 = parseISO(sanitizedValue);
|
34788
|
+
if (isValid(date2)) {
|
34789
|
+
const timeRegex2 = /^\d{2}:\d{2}(?::\d{2}\.\d+|:\d{2})?(?:Z)?$/;
|
34790
|
+
const time2 = sanitizedValue.split("T")[1];
|
34791
|
+
if (!time2 || !timeRegex2.test(time2)) {
|
34792
|
+
setHoursToMidday(date2);
|
34793
|
+
}
|
34794
|
+
return date2;
|
34795
|
+
}
|
34796
|
+
} catch {
|
34797
|
+
}
|
34798
|
+
const mask = this.getMask(locale2);
|
34799
|
+
if (mask) {
|
34800
|
+
try {
|
34801
|
+
const date2 = parse$2(sanitizedValue, mask, /* @__PURE__ */ new Date());
|
34802
|
+
if (isValid(date2)) {
|
34803
|
+
setHoursToMidday(date2);
|
34804
|
+
return date2;
|
34805
|
+
}
|
34806
|
+
} catch {
|
34807
|
+
}
|
34808
|
+
}
|
34809
|
+
return void 0;
|
34810
|
+
}
|
34811
|
+
static getMask(locale2) {
|
34812
|
+
if (localeDateMasks.has(locale2)) {
|
34813
|
+
return localeDateMasks.get(locale2);
|
34814
|
+
}
|
34815
|
+
const parts = new Intl.DateTimeFormat(locale2).formatToParts(/* @__PURE__ */ new Date());
|
34816
|
+
const mask = parts.reduce((mask2, part) => {
|
34817
|
+
switch (part.type) {
|
34818
|
+
case "literal":
|
34819
|
+
return mask2 + part.value;
|
34820
|
+
case "day":
|
34821
|
+
return mask2 + "dd";
|
34822
|
+
case "month":
|
34823
|
+
return mask2 + "MM";
|
34824
|
+
case "year":
|
34825
|
+
return mask2 + "yyyy";
|
34826
|
+
}
|
34827
|
+
return mask2;
|
34828
|
+
}, "");
|
34829
|
+
localeDateMasks.set(locale2, mask);
|
34830
|
+
return mask;
|
34831
|
+
}
|
34832
|
+
}
|
32763
34833
|
const dataTypes = {
|
32764
34834
|
auto: {
|
32765
34835
|
sortingFn: "auto",
|
@@ -32824,15 +34894,13 @@ function createDatetimeDataType(defaultOptions2) {
|
|
32824
34894
|
TableFilterComparator.IsEmpty,
|
32825
34895
|
TableFilterComparator.IsNotEmpty
|
32826
34896
|
],
|
32827
|
-
getDisplayValue: (value,
|
32828
|
-
var _a;
|
34897
|
+
getDisplayValue: (value, _, options) => {
|
32829
34898
|
if (value === void 0) {
|
32830
34899
|
return "";
|
32831
34900
|
}
|
32832
|
-
return
|
32833
|
-
|
32834
|
-
|
32835
|
-
}
|
34901
|
+
return DateTimeDataType.format(value, options == null ? void 0 : options.localization.locale, defaultOptions2);
|
34902
|
+
},
|
34903
|
+
parse: (value, locale2) => DateTimeDataType.parse(value, locale2)
|
32836
34904
|
};
|
32837
34905
|
}
|
32838
34906
|
function createNumberDataType(align, defaultOptions2) {
|
@@ -32840,6 +34908,8 @@ function createNumberDataType(align, defaultOptions2) {
|
|
32840
34908
|
align,
|
32841
34909
|
sortingFn: "basic",
|
32842
34910
|
filterComparators: [
|
34911
|
+
TableFilterComparator.Contains,
|
34912
|
+
TableFilterComparator.DoesNotContain,
|
32843
34913
|
TableFilterComparator.IsEqualTo,
|
32844
34914
|
TableFilterComparator.IsNotEqualTo,
|
32845
34915
|
TableFilterComparator.IsGreaterThan,
|
@@ -32851,10 +34921,6 @@ function createNumberDataType(align, defaultOptions2) {
|
|
32851
34921
|
TableFilterComparator.IsNotEmpty
|
32852
34922
|
],
|
32853
34923
|
getDisplayValue: (value, row, options) => {
|
32854
|
-
var _a, _b;
|
32855
|
-
if (value === void 0) {
|
32856
|
-
return "";
|
32857
|
-
}
|
32858
34924
|
const dataTypeOptions = typeof (options == null ? void 0 : options.dataTypeOptions) === "function" ? options == null ? void 0 : options.dataTypeOptions(row) : options == null ? void 0 : options.dataTypeOptions;
|
32859
34925
|
const numberFormatOptions = {
|
32860
34926
|
// format
|
@@ -32870,20 +34936,14 @@ function createNumberDataType(align, defaultOptions2) {
|
|
32870
34936
|
numberFormatOptions.currency = dataTypeOptions.currency;
|
32871
34937
|
numberFormatOptions.currencyDisplay = "code";
|
32872
34938
|
}
|
32873
|
-
|
32874
|
-
|
32875
|
-
return localisedValue;
|
32876
|
-
}
|
32877
|
-
let localisedValueWithoutThousandsSeperator = new Intl.NumberFormat((_b = options == null ? void 0 : options.localization) == null ? void 0 : _b.locale, {
|
34939
|
+
const localisedValue = NumericDataType.format(value, options == null ? void 0 : options.localization.locale, numberFormatOptions);
|
34940
|
+
const localisedValueWithoutThousandsSeperator = NumericDataType.format(value, options == null ? void 0 : options.localization.locale, {
|
32878
34941
|
...numberFormatOptions,
|
32879
34942
|
useGrouping: false
|
32880
|
-
})
|
32881
|
-
if (numberFormatOptions.style === "percent" || numberFormatOptions.style === "currency") {
|
32882
|
-
localisedValue = localisedValue.replace(/\u00A0/g, " ");
|
32883
|
-
localisedValueWithoutThousandsSeperator = localisedValueWithoutThousandsSeperator.replace(/\u00A0/g, " ");
|
32884
|
-
}
|
34943
|
+
});
|
32885
34944
|
return [localisedValue, localisedValueWithoutThousandsSeperator];
|
32886
|
-
}
|
34945
|
+
},
|
34946
|
+
parse: (value, locale2) => NumericDataType.parse(value, locale2)
|
32887
34947
|
};
|
32888
34948
|
}
|
32889
34949
|
function getDataTypeProperties(dataType) {
|
@@ -32901,103 +34961,121 @@ function getSortingFn(dataType, customFnOrBuiltIn) {
|
|
32901
34961
|
const toLowerCase = (value) => String(value ?? "").toLocaleLowerCase();
|
32902
34962
|
const isWeakContains = (left, right) => toLowerCase(left).includes(toLowerCase(right));
|
32903
34963
|
const isWeakEqual = (left, right) => toLowerCase(left) === toLowerCase(right);
|
32904
|
-
function columnFilterFn(
|
34964
|
+
function columnFilterFn(row, cellValue, meta, filter2, localization) {
|
32905
34965
|
try {
|
34966
|
+
const query = filter2.value;
|
34967
|
+
const { dataType, dataTypeOptions } = meta ?? {};
|
32906
34968
|
if (filter2.comparator === TableFilterComparator.IsEmpty || filter2.comparator === TableFilterComparator.IsNotEmpty) {
|
32907
|
-
const isEmpty =
|
34969
|
+
const isEmpty = cellValue === void 0 || cellValue === null || cellValue === "";
|
32908
34970
|
return filter2.comparator === TableFilterComparator.IsEmpty ? isEmpty : !isEmpty;
|
32909
34971
|
}
|
32910
|
-
if (
|
34972
|
+
if (query === void 0 || query === null || query === "") {
|
32911
34973
|
return true;
|
32912
34974
|
}
|
32913
|
-
const
|
34975
|
+
const evaluate = (matcher) => {
|
34976
|
+
return isMatched(query, cellValue, row, dataType, dataTypeOptions, localization, matcher);
|
34977
|
+
};
|
34978
|
+
const isDateColumn = dataType === "date" || dataType === "datetime";
|
34979
|
+
const valueAsDate = new Date(cellValue);
|
34980
|
+
const isNumberColumn = dataType === "number" || dataType === "amount";
|
34981
|
+
const compareNumbers2 = (fn) => {
|
34982
|
+
const input = typeof query === "number" ? query : NumericDataType.parse(query, localization.locale);
|
34983
|
+
const value = cellValue;
|
34984
|
+
if (input === void 0) {
|
34985
|
+
return false;
|
34986
|
+
}
|
34987
|
+
return fn(input, value);
|
34988
|
+
};
|
32914
34989
|
switch (filter2.comparator) {
|
32915
34990
|
case TableFilterComparator.Contains:
|
32916
|
-
return isWeakContains
|
34991
|
+
return evaluate(isWeakContains);
|
32917
34992
|
case TableFilterComparator.DoesNotContain:
|
32918
|
-
return !isWeakContains
|
34993
|
+
return !evaluate(isWeakContains);
|
32919
34994
|
case TableFilterComparator.IsEqualTo: {
|
32920
|
-
if (
|
32921
|
-
return
|
32922
|
-
} else if (
|
32923
|
-
return
|
34995
|
+
if (dataType === "boolean") {
|
34996
|
+
return cellValue === query;
|
34997
|
+
} else if (isDateColumn) {
|
34998
|
+
return isWeakEqual$1(query, valueAsDate);
|
32924
34999
|
}
|
32925
|
-
return isWeakEqual
|
35000
|
+
return evaluate(isWeakEqual);
|
32926
35001
|
}
|
32927
35002
|
case TableFilterComparator.IsNotEqualTo: {
|
32928
|
-
if (
|
32929
|
-
return
|
32930
|
-
} else if (
|
32931
|
-
return
|
35003
|
+
if (dataType === "boolean") {
|
35004
|
+
return cellValue !== query;
|
35005
|
+
} else if (isDateColumn) {
|
35006
|
+
return !isWeakEqual$1(query, valueAsDate);
|
32932
35007
|
}
|
32933
|
-
return !isWeakEqual
|
35008
|
+
return !evaluate(isWeakEqual);
|
32934
35009
|
}
|
32935
35010
|
case TableFilterComparator.IsGreaterThan: {
|
32936
|
-
if (
|
32937
|
-
return
|
32938
|
-
} else {
|
32939
|
-
|
32940
|
-
return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber > filter2.value;
|
35011
|
+
if (isDateColumn) {
|
35012
|
+
return query.getTime() < valueAsDate.getTime();
|
35013
|
+
} else if (isNumberColumn) {
|
35014
|
+
return compareNumbers2((q, v2) => q < v2);
|
32941
35015
|
}
|
35016
|
+
return false;
|
32942
35017
|
}
|
32943
35018
|
case TableFilterComparator.IsLessThan: {
|
32944
|
-
if (
|
32945
|
-
return
|
32946
|
-
} else {
|
32947
|
-
|
32948
|
-
return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber < filter2.value;
|
35019
|
+
if (isDateColumn) {
|
35020
|
+
return query.getTime() > valueAsDate.getTime();
|
35021
|
+
} else if (isNumberColumn) {
|
35022
|
+
return compareNumbers2((q, v2) => q > v2);
|
32949
35023
|
}
|
35024
|
+
return false;
|
32950
35025
|
}
|
32951
35026
|
case TableFilterComparator.IsLessThanOrEqualTo: {
|
32952
|
-
if (
|
32953
|
-
return
|
32954
|
-
} else {
|
32955
|
-
|
32956
|
-
return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber <= filter2.value;
|
35027
|
+
if (isDateColumn) {
|
35028
|
+
return query.getTime() > valueAsDate.getTime() || isWeakEqual$1(valueAsDate, query);
|
35029
|
+
} else if (isNumberColumn) {
|
35030
|
+
return compareNumbers2((q, v2) => q >= v2);
|
32957
35031
|
}
|
35032
|
+
return false;
|
32958
35033
|
}
|
32959
35034
|
case TableFilterComparator.IsGreaterThanOrEqualTo: {
|
32960
|
-
if (
|
32961
|
-
return
|
32962
|
-
} else {
|
32963
|
-
|
32964
|
-
return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber >= filter2.value;
|
35035
|
+
if (isDateColumn) {
|
35036
|
+
return query.getTime() < valueAsDate.getTime() || isWeakEqual$1(valueAsDate, query);
|
35037
|
+
} else if (isNumberColumn) {
|
35038
|
+
return compareNumbers2((q, v2) => q <= v2);
|
32965
35039
|
}
|
35040
|
+
return false;
|
32966
35041
|
}
|
32967
35042
|
case TableFilterComparator.IsBetween: {
|
32968
|
-
const [fromValue, toValue2] =
|
32969
|
-
if (
|
32970
|
-
if (
|
35043
|
+
const [fromValue, toValue2] = query;
|
35044
|
+
if (isDateColumn) {
|
35045
|
+
if (fromValue !== void 0 && valueAsDate.getTime() < fromValue.getTime()) {
|
32971
35046
|
return false;
|
32972
|
-
} else if (
|
35047
|
+
} else if (toValue2 !== void 0 && valueAsDate.getTime() > toValue2.getTime()) {
|
32973
35048
|
return false;
|
32974
35049
|
}
|
32975
35050
|
return true;
|
32976
|
-
} else {
|
32977
|
-
|
32978
|
-
if (isNaN(valueAsNumber)) {
|
35051
|
+
} else if (isNumberColumn) {
|
35052
|
+
if (fromValue !== void 0 && cellValue < fromValue) {
|
32979
35053
|
return false;
|
32980
|
-
}
|
32981
|
-
if (fromValue !== void 0 && valueAsNumber < fromValue) {
|
32982
|
-
return false;
|
32983
|
-
} else if (toValue2 !== void 0 && valueAsNumber > toValue2) {
|
35054
|
+
} else if (toValue2 !== void 0 && cellValue > toValue2) {
|
32984
35055
|
return false;
|
32985
35056
|
}
|
32986
35057
|
return true;
|
32987
35058
|
}
|
35059
|
+
return false;
|
32988
35060
|
}
|
32989
35061
|
case TableFilterComparator.HasAnyOf:
|
32990
|
-
return Array.isArray(
|
35062
|
+
return Array.isArray(query) && Array.isArray(cellValue) ? query.some((item) => cellValue.includes(item)) : false;
|
32991
35063
|
case TableFilterComparator.HasNoneOf:
|
32992
|
-
return Array.isArray(
|
35064
|
+
return Array.isArray(query) && Array.isArray(cellValue) ? query.every((item) => cellValue.includes(item) === false) : false;
|
32993
35065
|
case TableFilterComparator.HasAllOf:
|
32994
|
-
return Array.isArray(
|
32995
|
-
case TableFilterComparator.IsOneOf:
|
32996
|
-
if (!Array.isArray(
|
32997
|
-
|
32998
|
-
|
32999
|
-
|
33000
|
-
|
35066
|
+
return Array.isArray(query) && Array.isArray(cellValue) ? query.filter((v2) => cellValue.includes(v2)).length === query.length : false;
|
35067
|
+
case TableFilterComparator.IsOneOf: {
|
35068
|
+
if (!Array.isArray(query)) {
|
35069
|
+
return false;
|
35070
|
+
}
|
35071
|
+
return query.some((v2) => isWeakEqual(String(cellValue), v2));
|
35072
|
+
}
|
35073
|
+
case TableFilterComparator.IsNoneOf: {
|
35074
|
+
if (!Array.isArray(query)) {
|
35075
|
+
return false;
|
35076
|
+
}
|
35077
|
+
return query.every((v2) => !isWeakEqual(String(cellValue), v2));
|
35078
|
+
}
|
33001
35079
|
}
|
33002
35080
|
return false;
|
33003
35081
|
} catch (e3) {
|
@@ -33008,12 +35086,12 @@ function columnFilterFn(value, filter2) {
|
|
33008
35086
|
const flattenCellValue = (cellValue) => {
|
33009
35087
|
return typeof cellValue === "object" ? Object.values(cellValue).map(flattenCellValue) : cellValue;
|
33010
35088
|
};
|
33011
|
-
function isMatched(
|
35089
|
+
function isMatched(query, cellValue, rowValue, dataType, dataTypeOptions, localization, matcher = isWeakContains) {
|
33012
35090
|
if (typeof cellValue === "object") {
|
33013
|
-
return flattenCellValue(cellValue).flat(Infinity).find((y2) =>
|
35091
|
+
return flattenCellValue(cellValue).flat(Infinity).find((y2) => matcher(y2, query));
|
33014
35092
|
} else {
|
33015
35093
|
const cellValueAsString = String(cellValue ?? "");
|
33016
|
-
if (cellValueAsString !== void 0 &&
|
35094
|
+
if (cellValueAsString !== void 0 && matcher(cellValueAsString, query)) {
|
33017
35095
|
return true;
|
33018
35096
|
} else {
|
33019
35097
|
const dataTypeProperties = getDataTypeProperties(dataType);
|
@@ -33023,12 +35101,14 @@ function isMatched(searchQuery, cellValue, rowValue, dataType, dataTypeOptions,
|
|
33023
35101
|
localization
|
33024
35102
|
});
|
33025
35103
|
if (Array.isArray(cellDisplayValue)) {
|
33026
|
-
|
33027
|
-
|
33028
|
-
|
33029
|
-
|
33030
|
-
|
33031
|
-
|
35104
|
+
return cellDisplayValue.some((cdv) => matcher(cdv, query));
|
35105
|
+
} else if (cellDisplayValue !== void 0 && isWeakContains(cellDisplayValue, query)) {
|
35106
|
+
return true;
|
35107
|
+
}
|
35108
|
+
}
|
35109
|
+
if (typeof query !== typeof cellValue && dataTypeProperties.parse) {
|
35110
|
+
const parsedQuery = dataTypeProperties.parse(query, localization.locale);
|
35111
|
+
if (parsedQuery !== void 0 && matcher(cellValue, parsedQuery)) {
|
33032
35112
|
return true;
|
33033
35113
|
}
|
33034
35114
|
}
|
@@ -33474,7 +35554,11 @@ function configureReactTableOptions(options, props, localization) {
|
|
33474
35554
|
else {
|
33475
35555
|
tableOptions.getFilteredRowModel = getFilteredRowModel();
|
33476
35556
|
tableOptions.filterFns = {
|
33477
|
-
tacoFilter: (row, columnId, filter2) =>
|
35557
|
+
tacoFilter: (row, columnId, filter2) => {
|
35558
|
+
var _a;
|
35559
|
+
const meta = (_a = row._getAllCellsByColumnId()[columnId]) == null ? void 0 : _a.column.columnDef.meta;
|
35560
|
+
return columnFilterFn(row.original, row.getValue(columnId), meta, filter2, localization);
|
35561
|
+
}
|
33478
35562
|
};
|
33479
35563
|
}
|
33480
35564
|
}
|
@@ -33990,8 +36074,10 @@ function useTableRowSelection(isEnabled = false) {
|
|
33990
36074
|
lastSelectedRowIndex
|
33991
36075
|
};
|
33992
36076
|
}
|
33993
|
-
function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false) {
|
33994
|
-
const [enableGlobalFilter, _setEnableGlobalFilter] = React.useState(
|
36077
|
+
function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false, _experimentalDataLoader2 = false) {
|
36078
|
+
const [enableGlobalFilter, _setEnableGlobalFilter] = React.useState(
|
36079
|
+
_experimentalDataLoader2 || defaultEnableGlobalFilter
|
36080
|
+
);
|
33995
36081
|
function setEnableGlobalFilter(enabled, instance) {
|
33996
36082
|
_setEnableGlobalFilter(enabled);
|
33997
36083
|
const currentFilter = instance.getState().globalFilter;
|
@@ -34566,7 +36652,12 @@ function useTableManager(props, ref, meta, internalColumns) {
|
|
34566
36652
|
const rowGroups = useTableRowGroups(props.rowActionsForGroup);
|
34567
36653
|
const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
|
34568
36654
|
const rowSelection = useTableRowSelection(!!options.enableRowSelection);
|
34569
|
-
const search = useTableSearch(
|
36655
|
+
const search = useTableSearch(
|
36656
|
+
options.enableSearch,
|
36657
|
+
props.onChangeSearch,
|
36658
|
+
settings.excludeUnmatchedRecordsInSearch,
|
36659
|
+
props._experimentalDataLoader2
|
36660
|
+
);
|
34570
36661
|
const server = useTableServerLoading(
|
34571
36662
|
length,
|
34572
36663
|
data,
|
@@ -34832,10 +36923,11 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex, localShortcuts
|
|
34832
36923
|
const handleKeyDown = (event) => {
|
34833
36924
|
var _a;
|
34834
36925
|
const trigger = event.target;
|
34835
|
-
if (
|
36926
|
+
if (isElementInsideExternalRelatedOverlay(trigger, tableRef)) {
|
34836
36927
|
return;
|
34837
36928
|
}
|
34838
|
-
tableMeta.
|
36929
|
+
const reachableRows = tableMeta.length + table.getBottomRows().length;
|
36930
|
+
tableMeta.rowActive.handleKeyDown(event, reachableRows, scrollToIndex);
|
34839
36931
|
tableMeta.rowSelection.handleKeyDown(event, table);
|
34840
36932
|
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
34841
36933
|
tableMeta.rowClick.handleKeyDown(event, (_a = rows[tableMeta.rowActive.rowActiveIndex]) == null ? void 0 : _a.original);
|
@@ -35869,9 +37961,7 @@ function Actions(props) {
|
|
35869
37961
|
const visibleActions = actions.map((action) => action(data, rowId, tableMeta.rowActions.handlers["cleanup"], table)).filter((action) => !!action);
|
35870
37962
|
const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
|
35871
37963
|
const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
|
35872
|
-
const className = clsx(
|
35873
|
-
"flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden"
|
35874
|
-
);
|
37964
|
+
const className = clsx("flex justify-end text-right bg-[inherit] print:hidden");
|
35875
37965
|
return /* @__PURE__ */ React.createElement("span", { className }, actionsOnRow.map((button, index2) => {
|
35876
37966
|
const tooltip = String(button.props.tooltip ?? button.props["aria-label"] ?? "");
|
35877
37967
|
return React.cloneElement(button, {
|
@@ -35928,7 +38018,8 @@ const renderer$3 = {
|
|
35928
38018
|
'print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky right-0',
|
35929
38019
|
'group-[[data-row-active="true"][data-selected="false"]]/row:text-grey-200',
|
35930
38020
|
'group-[[data-row-selected="true"]]/row:text-blue-100',
|
35931
|
-
'group-[[data-row-selected="false"]:hover]/row:text-grey-100'
|
38021
|
+
'group-[[data-row-selected="false"]:hover]/row:text-grey-100',
|
38022
|
+
"shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]"
|
35932
38023
|
),
|
35933
38024
|
// TODO: remove when table3 is migrated, this satisfies the legacy table3 type
|
35934
38025
|
enableSearch: false,
|
@@ -36426,7 +38517,7 @@ function DisplayCell(props) {
|
|
36426
38517
|
} else {
|
36427
38518
|
content = typeof cell.column.columnDef.cell === "function" ? cell.column.columnDef.cell(cell.getContext()) : cell.getValue();
|
36428
38519
|
}
|
36429
|
-
return /* @__PURE__ */ React.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content);
|
38520
|
+
return /* @__PURE__ */ React.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content ?? columnMeta.emptyState);
|
36430
38521
|
}
|
36431
38522
|
const MemoedDisplayCell = React.memo(function MemoedDisplayCell2(props) {
|
36432
38523
|
const { cellRef, children, isTruncated, ...cellAttributes } = props;
|
@@ -36980,7 +39071,20 @@ function useAugmentedFocusManager() {
|
|
36980
39071
|
const focusManager = $9bf71ea28793e738$export$10c5169755ce7bd7();
|
36981
39072
|
const focusPrevious = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
|
36982
39073
|
const focusNext = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
|
36983
|
-
const focusFirst = () =>
|
39074
|
+
const focusFirst = () => {
|
39075
|
+
return focusManager == null ? void 0 : focusManager.focusFirst({
|
39076
|
+
...FOCUS_MANAGER_OPTIONS_TAB,
|
39077
|
+
accept: (element) => {
|
39078
|
+
if (!FOCUS_MANAGER_OPTIONS_TAB.accept(element)) {
|
39079
|
+
return false;
|
39080
|
+
}
|
39081
|
+
if (element.closest('[data-taco="cell-control"]')) {
|
39082
|
+
return true;
|
39083
|
+
}
|
39084
|
+
return false;
|
39085
|
+
}
|
39086
|
+
});
|
39087
|
+
};
|
36984
39088
|
const focusLast = () => focusManager == null ? void 0 : focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
|
36985
39089
|
return {
|
36986
39090
|
focusPrevious,
|
@@ -37000,7 +39104,8 @@ function Body(props) {
|
|
37000
39104
|
}
|
37001
39105
|
if (tableMeta.rowActive.rowActiveIndex !== void 0) {
|
37002
39106
|
const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;
|
37003
|
-
const
|
39107
|
+
const reachableRows = tableMeta.length + table.getBottomRows().length;
|
39108
|
+
const isLastRow = tableMeta.rowActive.rowActiveIndex === reachableRows - 1;
|
37004
39109
|
if (event.key === "Tab" || enableHorizontalArrowKeyNavigation && (event.key === "ArrowLeft" || event.key === "ArrowRight")) {
|
37005
39110
|
if (event.key === "Tab" && !hasFocusableElement(event.target.closest("tr[data-row-id]"))) {
|
37006
39111
|
return;
|
@@ -37443,7 +39548,7 @@ function Search$1(props) {
|
|
37443
39548
|
tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);
|
37444
39549
|
scrollTo2(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);
|
37445
39550
|
};
|
37446
|
-
const settings = /* @__PURE__ */ React.createElement(
|
39551
|
+
const settings = tableMeta.server._experimentalDataLoader2 ? void 0 : /* @__PURE__ */ React.createElement(
|
37447
39552
|
Switch$1,
|
37448
39553
|
{
|
37449
39554
|
label: texts.table.search.excludeUnmatchedResults,
|
@@ -42353,6 +44458,9 @@ const Search = React.forwardRef(function ListboxSearch(props, ref) {
|
|
42353
44458
|
if (event.key === " ") {
|
42354
44459
|
return;
|
42355
44460
|
}
|
44461
|
+
if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && event.currentTarget.value.length) {
|
44462
|
+
event.stopPropagation();
|
44463
|
+
}
|
42356
44464
|
if (isAriaSelectionKey(event) || event.key === "ArrowDown" || event.key === "ArrowUp") {
|
42357
44465
|
event.preventDefault();
|
42358
44466
|
(_a = listboxRef == null ? void 0 : listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
|
@@ -42616,14 +44724,28 @@ const Select22 = React.forwardRef(function Select222(props, ref) {
|
|
42616
44724
|
}
|
42617
44725
|
(_a = listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
|
42618
44726
|
};
|
42619
|
-
const shouldFocusNextRef = React.useRef(
|
44727
|
+
const shouldFocusNextRef = React.useRef(void 0);
|
44728
|
+
React.useEffect(() => {
|
44729
|
+
const handleKeyDown2 = (event) => {
|
44730
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
44731
|
+
shouldFocusNextRef.current = event.key === "ArrowLeft" ? -1 : 1;
|
44732
|
+
setOpen(false);
|
44733
|
+
}
|
44734
|
+
};
|
44735
|
+
if (isElementInsideTable3OrReport(internalRef.current)) {
|
44736
|
+
document.addEventListener("keydown", handleKeyDown2);
|
44737
|
+
}
|
44738
|
+
return () => {
|
44739
|
+
document.removeEventListener("keydown", handleKeyDown2);
|
44740
|
+
};
|
44741
|
+
}, []);
|
42620
44742
|
const handleListboxKeyDown = (event) => {
|
42621
44743
|
if (isAriaDirectionKey(event)) {
|
42622
44744
|
setShouldPauseHoverState(true);
|
42623
44745
|
return;
|
42624
44746
|
}
|
42625
44747
|
if (event.key === "Tab") {
|
42626
|
-
shouldFocusNextRef.current =
|
44748
|
+
shouldFocusNextRef.current = event.shiftKey ? -1 : 1;
|
42627
44749
|
setOpen(false);
|
42628
44750
|
return;
|
42629
44751
|
}
|
@@ -42634,11 +44756,11 @@ const Select22 = React.forwardRef(function Select222(props, ref) {
|
|
42634
44756
|
};
|
42635
44757
|
const handleCloseAutoFocus = (event) => {
|
42636
44758
|
var _a, _b;
|
42637
|
-
if (shouldFocusNextRef.current) {
|
44759
|
+
if (shouldFocusNextRef.current !== void 0) {
|
42638
44760
|
event.preventDefault();
|
42639
|
-
shouldFocusNextRef.current = false;
|
42640
44761
|
(_a = otherProps.onBlur) == null ? void 0 : _a.call(otherProps, event);
|
42641
|
-
(_b = getNextFocussableElement(internalRef.current)) == null ? void 0 : _b.focus();
|
44762
|
+
(_b = getNextFocussableElement(internalRef.current, shouldFocusNextRef.current)) == null ? void 0 : _b.focus();
|
44763
|
+
shouldFocusNextRef.current = void 0;
|
42642
44764
|
return;
|
42643
44765
|
}
|
42644
44766
|
};
|
@@ -43039,8 +45161,8 @@ function FilterComparator(props) {
|
|
43039
45161
|
return /* @__PURE__ */ React.createElement(Select22, { ...attributes, className: "!w-32 flex-shrink-0", disabled: !column, onChange: handleChange, value }, validComparators.map((comparator) => /* @__PURE__ */ React.createElement(Select22.Option, { key: comparator, value: comparator }, getComparatorText(comparator, texts, column))));
|
43040
45162
|
}
|
43041
45163
|
function getComparatorText(comparator, texts, column) {
|
43042
|
-
var _a, _b;
|
43043
|
-
const isDate2 = ((
|
45164
|
+
var _a, _b, _c;
|
45165
|
+
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";
|
43044
45166
|
switch (comparator) {
|
43045
45167
|
case TableFilterComparator.Contains:
|
43046
45168
|
return texts.table.filters.comparators.contains;
|
@@ -51664,7 +53786,7 @@ function willRowMove(cell, change, rowIndex, localization) {
|
|
51664
53786
|
const { table } = cell.getContext();
|
51665
53787
|
if (willRowMoveAfterSearch(cell, change, table, localization)) {
|
51666
53788
|
return "search";
|
51667
|
-
} else if (willRowMoveAfterFilter(cell, change)) {
|
53789
|
+
} else if (willRowMoveAfterFilter(cell, change, localization)) {
|
51668
53790
|
return "filter";
|
51669
53791
|
} else if (willRowMoveAfterSorting(cell, change, rowIndex)) {
|
51670
53792
|
return "sorting";
|
@@ -51679,11 +53801,17 @@ function willRowMoveAfterSearch(cell, change, table, localization) {
|
|
51679
53801
|
const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };
|
51680
53802
|
return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);
|
51681
53803
|
}
|
51682
|
-
function willRowMoveAfterFilter(cell, change) {
|
53804
|
+
function willRowMoveAfterFilter(cell, change, localization) {
|
51683
53805
|
if (!cell.column.getIsFiltered()) {
|
51684
53806
|
return false;
|
51685
53807
|
}
|
51686
|
-
return !columnFilterFn(
|
53808
|
+
return !columnFilterFn(
|
53809
|
+
cell.row.original,
|
53810
|
+
change,
|
53811
|
+
cell.column.columnDef.meta,
|
53812
|
+
cell.column.getFilterValue(),
|
53813
|
+
localization
|
53814
|
+
);
|
51687
53815
|
}
|
51688
53816
|
function willRowMoveAfterSorting(cell, change, rowIndex) {
|
51689
53817
|
var _a;
|
@@ -51979,8 +54107,8 @@ function requireIsBuffer() {
|
|
51979
54107
|
var freeExports = exports2 && !exports2.nodeType && exports2;
|
51980
54108
|
var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
|
51981
54109
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
51982
|
-
var
|
51983
|
-
var nativeIsBuffer =
|
54110
|
+
var Buffer2 = moduleExports ? root.Buffer : void 0;
|
54111
|
+
var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
|
51984
54112
|
var isBuffer2 = nativeIsBuffer || stubFalse;
|
51985
54113
|
module2.exports = isBuffer2;
|
51986
54114
|
})(isBuffer, isBuffer.exports);
|
@@ -52259,7 +54387,7 @@ function require_cloneBuffer() {
|
|
52259
54387
|
var freeExports = exports2 && !exports2.nodeType && exports2;
|
52260
54388
|
var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
|
52261
54389
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
52262
|
-
var
|
54390
|
+
var Buffer2 = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
|
52263
54391
|
function cloneBuffer(buffer, isDeep) {
|
52264
54392
|
if (isDeep) {
|
52265
54393
|
return buffer.slice();
|
@@ -53110,17 +55238,18 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53110
55238
|
async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
|
53111
55239
|
var _a;
|
53112
55240
|
const changes = nextValue !== void 0 ? { ...state.changes.rows[cell.row.id], [cell.column.id]: nextValue } : { ...state.changes.rows[cell.row.id] };
|
55241
|
+
const original = cell.row.original;
|
53113
55242
|
if (!Object.keys(changes).length) {
|
53114
55243
|
return;
|
53115
55244
|
}
|
53116
55245
|
let updatesForOtherCells = {};
|
53117
55246
|
if (typeof handleChange === "function" && shouldRunUpdaters) {
|
53118
55247
|
const previousRowValue = {
|
53119
|
-
...
|
55248
|
+
...original
|
53120
55249
|
//...getRowChangeset(updatersRef.current[cell.row.id], rowIdentityAccessor),
|
53121
55250
|
};
|
53122
55251
|
const nextRowValue = {
|
53123
|
-
...
|
55252
|
+
...original,
|
53124
55253
|
...changes
|
53125
55254
|
};
|
53126
55255
|
updatesForOtherCells = await handleChange(
|
@@ -53134,8 +55263,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53134
55263
|
const nextMoveReasons = { ...state.changes.moveReasons[cell.row.id] };
|
53135
55264
|
const nextCellErrors = { ...(_a = state.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
|
53136
55265
|
let validationErrors = {};
|
53137
|
-
if (validator && Object.keys(nextChanges).length &&
|
53138
|
-
const nextRowValue = { ...
|
55266
|
+
if (validator && Object.keys(nextChanges).length && original) {
|
55267
|
+
const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
|
53139
55268
|
validationErrors = await validator(nextRowValue) ?? {};
|
53140
55269
|
}
|
53141
55270
|
const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
|
@@ -53164,7 +55293,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
|
|
53164
55293
|
cellErrors: nextCellErrors,
|
53165
55294
|
index: rowIndex,
|
53166
55295
|
moveReasons: nextMoveReasons,
|
53167
|
-
value: nextChanges
|
55296
|
+
value: nextChanges,
|
55297
|
+
original
|
53168
55298
|
}
|
53169
55299
|
});
|
53170
55300
|
}
|
@@ -53574,6 +55704,7 @@ function EditingControlCell(props) {
|
|
53574
55704
|
const type = columnMeta.control ?? "input";
|
53575
55705
|
const handleFocus = useEditingCellAutofocus(props);
|
53576
55706
|
const value = cell.getValue();
|
55707
|
+
const rowChanges = tableMeta.editing.getRowValue(cell.row.id);
|
53577
55708
|
const hasNonTextControl = React.useMemo(() => {
|
53578
55709
|
var _a;
|
53579
55710
|
return typeof type === "function" && !!((_a = cellRef.current) == null ? void 0 : _a.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
|
@@ -53589,32 +55720,18 @@ function EditingControlCell(props) {
|
|
53589
55720
|
},
|
53590
55721
|
[hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]
|
53591
55722
|
);
|
53592
|
-
const blur = React.useCallback(
|
53593
|
-
function blur2() {
|
53594
|
-
requestAnimationFrame(() => {
|
53595
|
-
tableMeta.editing.toggleDetailedMode(false);
|
53596
|
-
tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
|
53597
|
-
});
|
53598
|
-
},
|
53599
|
-
[hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]
|
53600
|
-
);
|
53601
55723
|
const handleBlur = React.useCallback(
|
53602
55724
|
(event) => {
|
53603
55725
|
if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
|
53604
55726
|
return;
|
53605
55727
|
}
|
53606
|
-
|
55728
|
+
requestAnimationFrame(() => {
|
55729
|
+
tableMeta.editing.toggleDetailedMode(false);
|
55730
|
+
tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
|
55731
|
+
});
|
53607
55732
|
},
|
53608
|
-
[
|
55733
|
+
[hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
|
53609
55734
|
);
|
53610
|
-
React.useEffect(() => {
|
53611
|
-
const ref = cellRef.current;
|
53612
|
-
return () => {
|
53613
|
-
if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {
|
53614
|
-
blur();
|
53615
|
-
}
|
53616
|
-
};
|
53617
|
-
}, []);
|
53618
55735
|
const error = tableMeta.editing.getCellError(cell);
|
53619
55736
|
const controlProps = {
|
53620
55737
|
dataType: columnMeta.dataType,
|
@@ -54171,16 +56288,15 @@ function CreateNewRow(props) {
|
|
54171
56288
|
} else {
|
54172
56289
|
tooltip = /* @__PURE__ */ React.createElement(Shortcut, { keys: shortcut2 });
|
54173
56290
|
}
|
54174
|
-
const className = clsx("group/row
|
56291
|
+
const className = clsx("group/row !sticky z-[21]", {
|
54175
56292
|
"bottom-10": tableMeta.footer.isEnabled,
|
54176
|
-
"bottom-0": !tableMeta.footer.isEnabled
|
54177
|
-
"border-b": !isScrolled
|
56293
|
+
"bottom-0": !tableMeta.footer.isEnabled
|
54178
56294
|
});
|
54179
|
-
return /* @__PURE__ */ React.createElement("tr", { "data-row-create": true, className, tabIndex: -1 }, /* @__PURE__ */ React.createElement("td", { className: "!bg-grey-50 col-span-full !
|
56295
|
+
return /* @__PURE__ */ React.createElement("tr", { "data-row-create": true, className, tabIndex: -1 }, /* @__PURE__ */ React.createElement("td", { className: "!bg-grey-50 col-span-full !px-1" }, /* @__PURE__ */ React.createElement(
|
54180
56296
|
Button$4,
|
54181
56297
|
{
|
54182
56298
|
appearance: "transparent",
|
54183
|
-
className: "group-hover:bg-grey-200 sticky left-[4px]",
|
56299
|
+
className: "group-hover:bg-grey-200 sticky left-[4px] font-bold",
|
54184
56300
|
disabled: isDisabled,
|
54185
56301
|
onClick: handleCreate,
|
54186
56302
|
ref: buttonRef,
|
@@ -54194,10 +56310,14 @@ function CreateNewRow(props) {
|
|
54194
56310
|
function TemporaryRow(props) {
|
54195
56311
|
const { createRowButtonRef, isScrolled, table, tableMeta, tableRef } = props;
|
54196
56312
|
const handleKeyDown = async (event) => {
|
54197
|
-
var _a
|
56313
|
+
var _a;
|
56314
|
+
const target = event.target;
|
56315
|
+
if (isAriaDirectionKey(event) && isElementInsideExternalRelatedOverlay(target, tableRef)) {
|
56316
|
+
return;
|
56317
|
+
}
|
54198
56318
|
if (event.key === "ArrowDown") {
|
54199
56319
|
event.preventDefault();
|
54200
|
-
if (!isElementTriggeredFromContainer(
|
56320
|
+
if (!isElementTriggeredFromContainer(target, event.currentTarget)) {
|
54201
56321
|
const saved = await tableMeta.editing.saveChanges(table);
|
54202
56322
|
if (saved) {
|
54203
56323
|
(_a = createRowButtonRef.current) == null ? void 0 : _a.focus();
|
@@ -54206,28 +56326,15 @@ function TemporaryRow(props) {
|
|
54206
56326
|
} else if (event.key === "ArrowUp") {
|
54207
56327
|
event.preventDefault();
|
54208
56328
|
event.stopPropagation();
|
56329
|
+
const lastIndex = tableMeta.length - 1;
|
56330
|
+
tableMeta.rowActive.setRowActiveIndex(lastIndex);
|
54209
56331
|
if (tableRef.current) {
|
54210
|
-
|
54211
|
-
|
54212
|
-
|
54213
|
-
|
54214
|
-
const newRowHeight = event.currentTarget.getBoundingClientRect().height;
|
54215
|
-
const visibleHeight = tableRef.current.clientHeight - footerHeight - newRowHeight;
|
54216
|
-
const tableTopOffset = tableRef.current.getBoundingClientRect().top;
|
54217
|
-
let nextRowIndex;
|
54218
|
-
for (let index2 = availableRows.length - 1; index2 >= 0; index2--) {
|
54219
|
-
const rowRect = availableRows[index2].getBoundingClientRect();
|
54220
|
-
const topPlusHalfRow = rowRect.top + rowRect.height / 2;
|
54221
|
-
if (topPlusHalfRow - tableTopOffset <= visibleHeight) {
|
54222
|
-
nextRowIndex = index2;
|
54223
|
-
break;
|
56332
|
+
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
56333
|
+
requestAnimationFrame(() => {
|
56334
|
+
if (tableRef.current) {
|
56335
|
+
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
54224
56336
|
}
|
54225
|
-
}
|
54226
|
-
if (nextRowIndex) {
|
54227
|
-
tableMeta.rowActive.setRowActiveIndex(
|
54228
|
-
Number(availableRows[nextRowIndex < 0 ? 0 : nextRowIndex].getAttribute("data-row-index"))
|
54229
|
-
);
|
54230
|
-
}
|
56337
|
+
});
|
54231
56338
|
}
|
54232
56339
|
}
|
54233
56340
|
};
|
@@ -54242,10 +56349,9 @@ function TemporaryRow(props) {
|
|
54242
56349
|
}
|
54243
56350
|
}
|
54244
56351
|
};
|
54245
|
-
const className = clsx("group/row border-grey-300 !sticky z-[22] print:hidden", {
|
54246
|
-
"bottom-[calc(5rem_+
|
54247
|
-
"bottom-[calc(2.5rem_+
|
54248
|
-
"border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0": isScrolled
|
56352
|
+
const className = clsx("group/row border-grey-300 !sticky z-[22] print:hidden border-t-2", {
|
56353
|
+
"bottom-[calc(5rem_+_5px)] data-[row-editing-move]:bottom-[calc(5rem_+_5px)]": tableMeta.footer.isEnabled,
|
56354
|
+
"bottom-[calc(2.5rem_+_5px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_5px)]": !tableMeta.footer.isEnabled
|
54249
56355
|
});
|
54250
56356
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, table.getBottomRows().map((row) => /* @__PURE__ */ React.createElement(
|
54251
56357
|
Row$2,
|
@@ -59148,9 +61254,9 @@ _defineProperty$J(ReactFloater, "propTypes", { autoOpen: PropTypes.bool, callbac
|
|
59148
61254
|
return !props.component;
|
59149
61255
|
}), 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 }) });
|
59150
61256
|
_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 } });
|
59151
|
-
var
|
59152
|
-
var
|
59153
|
-
var
|
61257
|
+
var __defProp2 = Object.defineProperty;
|
61258
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
61259
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
59154
61260
|
var ACTIONS = {
|
59155
61261
|
INIT: "init",
|
59156
61262
|
START: "start",
|
@@ -59853,15 +61959,15 @@ var defaultState = {
|
|
59853
61959
|
var validKeys = objectKeys(omit(defaultState, "controlled", "size"));
|
59854
61960
|
var Store = class {
|
59855
61961
|
constructor(options) {
|
59856
|
-
|
59857
|
-
|
59858
|
-
|
59859
|
-
|
59860
|
-
|
59861
|
-
|
61962
|
+
__publicField2(this, "beaconPopper");
|
61963
|
+
__publicField2(this, "tooltipPopper");
|
61964
|
+
__publicField2(this, "data", /* @__PURE__ */ new Map());
|
61965
|
+
__publicField2(this, "listener");
|
61966
|
+
__publicField2(this, "store", /* @__PURE__ */ new Map());
|
61967
|
+
__publicField2(this, "addListener", (listener) => {
|
59862
61968
|
this.listener = listener;
|
59863
61969
|
});
|
59864
|
-
|
61970
|
+
__publicField2(this, "setSteps", (steps3) => {
|
59865
61971
|
const { size: size2, status } = this.getState();
|
59866
61972
|
const state = {
|
59867
61973
|
size: steps3.length,
|
@@ -59873,24 +61979,24 @@ var Store = class {
|
|
59873
61979
|
}
|
59874
61980
|
this.setState(state);
|
59875
61981
|
});
|
59876
|
-
|
61982
|
+
__publicField2(this, "getPopper", (name) => {
|
59877
61983
|
if (name === "beacon") {
|
59878
61984
|
return this.beaconPopper;
|
59879
61985
|
}
|
59880
61986
|
return this.tooltipPopper;
|
59881
61987
|
});
|
59882
|
-
|
61988
|
+
__publicField2(this, "setPopper", (name, popper) => {
|
59883
61989
|
if (name === "beacon") {
|
59884
61990
|
this.beaconPopper = popper;
|
59885
61991
|
} else {
|
59886
61992
|
this.tooltipPopper = popper;
|
59887
61993
|
}
|
59888
61994
|
});
|
59889
|
-
|
61995
|
+
__publicField2(this, "cleanupPoppers", () => {
|
59890
61996
|
this.beaconPopper = null;
|
59891
61997
|
this.tooltipPopper = null;
|
59892
61998
|
});
|
59893
|
-
|
61999
|
+
__publicField2(this, "close", (origin = null) => {
|
59894
62000
|
const { index: index2, status } = this.getState();
|
59895
62001
|
if (status !== STATUS.RUNNING) {
|
59896
62002
|
return;
|
@@ -59899,7 +62005,7 @@ var Store = class {
|
|
59899
62005
|
...this.getNextState({ action: ACTIONS.CLOSE, index: index2 + 1, origin })
|
59900
62006
|
});
|
59901
62007
|
});
|
59902
|
-
|
62008
|
+
__publicField2(this, "go", (nextIndex) => {
|
59903
62009
|
const { controlled, status } = this.getState();
|
59904
62010
|
if (controlled || status !== STATUS.RUNNING) {
|
59905
62011
|
return;
|
@@ -59910,15 +62016,15 @@ var Store = class {
|
|
59910
62016
|
status: step ? status : STATUS.FINISHED
|
59911
62017
|
});
|
59912
62018
|
});
|
59913
|
-
|
59914
|
-
|
62019
|
+
__publicField2(this, "info", () => this.getState());
|
62020
|
+
__publicField2(this, "next", () => {
|
59915
62021
|
const { index: index2, status } = this.getState();
|
59916
62022
|
if (status !== STATUS.RUNNING) {
|
59917
62023
|
return;
|
59918
62024
|
}
|
59919
62025
|
this.setState(this.getNextState({ action: ACTIONS.NEXT, index: index2 + 1 }));
|
59920
62026
|
});
|
59921
|
-
|
62027
|
+
__publicField2(this, "open", () => {
|
59922
62028
|
const { status } = this.getState();
|
59923
62029
|
if (status !== STATUS.RUNNING) {
|
59924
62030
|
return;
|
@@ -59927,7 +62033,7 @@ var Store = class {
|
|
59927
62033
|
...this.getNextState({ action: ACTIONS.UPDATE, lifecycle: LIFECYCLE.TOOLTIP })
|
59928
62034
|
});
|
59929
62035
|
});
|
59930
|
-
|
62036
|
+
__publicField2(this, "prev", () => {
|
59931
62037
|
const { index: index2, status } = this.getState();
|
59932
62038
|
if (status !== STATUS.RUNNING) {
|
59933
62039
|
return;
|
@@ -59936,7 +62042,7 @@ var Store = class {
|
|
59936
62042
|
...this.getNextState({ action: ACTIONS.PREV, index: index2 - 1 })
|
59937
62043
|
});
|
59938
62044
|
});
|
59939
|
-
|
62045
|
+
__publicField2(this, "reset", (restart = false) => {
|
59940
62046
|
const { controlled } = this.getState();
|
59941
62047
|
if (controlled) {
|
59942
62048
|
return;
|
@@ -59946,7 +62052,7 @@ var Store = class {
|
|
59946
62052
|
status: restart ? STATUS.RUNNING : STATUS.READY
|
59947
62053
|
});
|
59948
62054
|
});
|
59949
|
-
|
62055
|
+
__publicField2(this, "skip", () => {
|
59950
62056
|
const { status } = this.getState();
|
59951
62057
|
if (status !== STATUS.RUNNING) {
|
59952
62058
|
return;
|
@@ -59957,7 +62063,7 @@ var Store = class {
|
|
59957
62063
|
status: STATUS.SKIPPED
|
59958
62064
|
});
|
59959
62065
|
});
|
59960
|
-
|
62066
|
+
__publicField2(this, "start", (nextIndex) => {
|
59961
62067
|
const { index: index2, size: size2 } = this.getState();
|
59962
62068
|
this.setState({
|
59963
62069
|
...this.getNextState(
|
@@ -59970,7 +62076,7 @@ var Store = class {
|
|
59970
62076
|
status: size2 ? STATUS.RUNNING : STATUS.WAITING
|
59971
62077
|
});
|
59972
62078
|
});
|
59973
|
-
|
62079
|
+
__publicField2(this, "stop", (advance = false) => {
|
59974
62080
|
const { index: index2, status } = this.getState();
|
59975
62081
|
if ([STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {
|
59976
62082
|
return;
|
@@ -59980,7 +62086,7 @@ var Store = class {
|
|
59980
62086
|
status: STATUS.PAUSED
|
59981
62087
|
});
|
59982
62088
|
});
|
59983
|
-
|
62089
|
+
__publicField2(this, "update", (state) => {
|
59984
62090
|
var _a, _b;
|
59985
62091
|
if (!hasValidKeys(state, validKeys)) {
|
59986
62092
|
throw new Error(`State is not valid. Valid keys: ${validKeys.join(", ")}`);
|
@@ -60111,16 +62217,16 @@ var Spotlight_default = JoyrideSpotlight;
|
|
60111
62217
|
var JoyrideOverlay = class extends React__namespace.Component {
|
60112
62218
|
constructor() {
|
60113
62219
|
super(...arguments);
|
60114
|
-
|
60115
|
-
|
60116
|
-
|
60117
|
-
|
60118
|
-
|
62220
|
+
__publicField2(this, "isActive", false);
|
62221
|
+
__publicField2(this, "resizeTimeout");
|
62222
|
+
__publicField2(this, "scrollTimeout");
|
62223
|
+
__publicField2(this, "scrollParent");
|
62224
|
+
__publicField2(this, "state", {
|
60119
62225
|
isScrolling: false,
|
60120
62226
|
mouseOverSpotlight: false,
|
60121
62227
|
showSpotlight: true
|
60122
62228
|
});
|
60123
|
-
|
62229
|
+
__publicField2(this, "hideSpotlight", () => {
|
60124
62230
|
const { continuous: continuous2, disableOverlay, lifecycle } = this.props;
|
60125
62231
|
const hiddenLifecycles = [
|
60126
62232
|
LIFECYCLE.INIT,
|
@@ -60130,7 +62236,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
|
|
60130
62236
|
];
|
60131
62237
|
return disableOverlay || (continuous2 ? hiddenLifecycles.includes(lifecycle) : lifecycle !== LIFECYCLE.TOOLTIP);
|
60132
62238
|
});
|
60133
|
-
|
62239
|
+
__publicField2(this, "handleMouseMove", (event) => {
|
60134
62240
|
const { mouseOverSpotlight } = this.state;
|
60135
62241
|
const { height, left, position, top, width } = this.spotlightStyles;
|
60136
62242
|
const offsetY = position === "fixed" ? event.clientY : event.pageY;
|
@@ -60142,7 +62248,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
|
|
60142
62248
|
this.updateState({ mouseOverSpotlight: inSpotlight });
|
60143
62249
|
}
|
60144
62250
|
});
|
60145
|
-
|
62251
|
+
__publicField2(this, "handleScroll", () => {
|
60146
62252
|
const { target } = this.props;
|
60147
62253
|
const element = getElement(target);
|
60148
62254
|
if (this.scrollParent !== document) {
|
@@ -60158,7 +62264,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
|
|
60158
62264
|
this.updateState({});
|
60159
62265
|
}
|
60160
62266
|
});
|
60161
|
-
|
62267
|
+
__publicField2(this, "handleResize", () => {
|
60162
62268
|
clearTimeout(this.resizeTimeout);
|
60163
62269
|
this.resizeTimeout = window.setTimeout(() => {
|
60164
62270
|
if (!this.isActive) {
|
@@ -60293,7 +62399,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
|
|
60293
62399
|
var JoyridePortal = class extends React__namespace.Component {
|
60294
62400
|
constructor() {
|
60295
62401
|
super(...arguments);
|
60296
|
-
|
62402
|
+
__publicField2(this, "node", null);
|
60297
62403
|
}
|
60298
62404
|
componentDidMount() {
|
60299
62405
|
const { id: id2 } = this.props;
|
@@ -60355,29 +62461,29 @@ var JoyridePortal = class extends React__namespace.Component {
|
|
60355
62461
|
};
|
60356
62462
|
var Scope = class {
|
60357
62463
|
constructor(element, options) {
|
60358
|
-
|
60359
|
-
|
60360
|
-
|
62464
|
+
__publicField2(this, "element");
|
62465
|
+
__publicField2(this, "options");
|
62466
|
+
__publicField2(this, "canBeTabbed", (element2) => {
|
60361
62467
|
const { tabIndex } = element2;
|
60362
62468
|
if (tabIndex === null || tabIndex < 0) {
|
60363
62469
|
return false;
|
60364
62470
|
}
|
60365
62471
|
return this.canHaveFocus(element2);
|
60366
62472
|
});
|
60367
|
-
|
62473
|
+
__publicField2(this, "canHaveFocus", (element2) => {
|
60368
62474
|
const validTabNodes = /input|select|textarea|button|object/;
|
60369
62475
|
const nodeName = element2.nodeName.toLowerCase();
|
60370
62476
|
const isValid2 = validTabNodes.test(nodeName) && !element2.getAttribute("disabled") || nodeName === "a" && !!element2.getAttribute("href");
|
60371
62477
|
return isValid2 && this.isVisible(element2);
|
60372
62478
|
});
|
60373
|
-
|
60374
|
-
|
62479
|
+
__publicField2(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed));
|
62480
|
+
__publicField2(this, "handleKeyDown", (event) => {
|
60375
62481
|
const { code = "Tab" } = this.options;
|
60376
62482
|
if (event.code === code) {
|
60377
62483
|
this.interceptTab(event);
|
60378
62484
|
}
|
60379
62485
|
});
|
60380
|
-
|
62486
|
+
__publicField2(this, "interceptTab", (event) => {
|
60381
62487
|
event.preventDefault();
|
60382
62488
|
const elements = this.findValidTabElements();
|
60383
62489
|
const { shiftKey } = event;
|
@@ -60394,7 +62500,7 @@ var Scope = class {
|
|
60394
62500
|
}
|
60395
62501
|
elements[x2].focus();
|
60396
62502
|
});
|
60397
|
-
|
62503
|
+
__publicField2(this, "isHidden", (element2) => {
|
60398
62504
|
const noSize = element2.offsetWidth <= 0 && element2.offsetHeight <= 0;
|
60399
62505
|
const style = window.getComputedStyle(element2);
|
60400
62506
|
if (noSize && !element2.innerHTML) {
|
@@ -60402,7 +62508,7 @@ var Scope = class {
|
|
60402
62508
|
}
|
60403
62509
|
return noSize && style.getPropertyValue("overflow") !== "visible" || style.getPropertyValue("display") === "none";
|
60404
62510
|
});
|
60405
|
-
|
62511
|
+
__publicField2(this, "isVisible", (element2) => {
|
60406
62512
|
let parentElement = element2;
|
60407
62513
|
while (parentElement) {
|
60408
62514
|
if (parentElement instanceof HTMLElement) {
|
@@ -60417,16 +62523,16 @@ var Scope = class {
|
|
60417
62523
|
}
|
60418
62524
|
return true;
|
60419
62525
|
});
|
60420
|
-
|
62526
|
+
__publicField2(this, "removeScope", () => {
|
60421
62527
|
window.removeEventListener("keydown", this.handleKeyDown);
|
60422
62528
|
});
|
60423
|
-
|
62529
|
+
__publicField2(this, "checkFocus", (target) => {
|
60424
62530
|
if (document.activeElement !== target) {
|
60425
62531
|
target.focus();
|
60426
62532
|
window.requestAnimationFrame(() => this.checkFocus(target));
|
60427
62533
|
}
|
60428
62534
|
});
|
60429
|
-
|
62535
|
+
__publicField2(this, "setFocus", () => {
|
60430
62536
|
const { selector } = this.options;
|
60431
62537
|
if (!selector) {
|
60432
62538
|
return;
|
@@ -60448,8 +62554,8 @@ var Scope = class {
|
|
60448
62554
|
var JoyrideBeacon = class extends React__namespace.Component {
|
60449
62555
|
constructor(props) {
|
60450
62556
|
super(props);
|
60451
|
-
|
60452
|
-
|
62557
|
+
__publicField2(this, "beacon", null);
|
62558
|
+
__publicField2(this, "setBeaconRef", (c2) => {
|
60453
62559
|
this.beacon = c2;
|
60454
62560
|
});
|
60455
62561
|
if (props.beaconComponent) {
|
@@ -60631,17 +62737,17 @@ var Container_default = JoyrideTooltipContainer;
|
|
60631
62737
|
var JoyrideTooltip = class extends React__namespace.Component {
|
60632
62738
|
constructor() {
|
60633
62739
|
super(...arguments);
|
60634
|
-
|
62740
|
+
__publicField2(this, "handleClickBack", (event) => {
|
60635
62741
|
event.preventDefault();
|
60636
62742
|
const { helpers } = this.props;
|
60637
62743
|
helpers.prev();
|
60638
62744
|
});
|
60639
|
-
|
62745
|
+
__publicField2(this, "handleClickClose", (event) => {
|
60640
62746
|
event.preventDefault();
|
60641
62747
|
const { helpers } = this.props;
|
60642
62748
|
helpers.close("button_close");
|
60643
62749
|
});
|
60644
|
-
|
62750
|
+
__publicField2(this, "handleClickPrimary", (event) => {
|
60645
62751
|
event.preventDefault();
|
60646
62752
|
const { continuous: continuous2, helpers } = this.props;
|
60647
62753
|
if (!continuous2) {
|
@@ -60650,12 +62756,12 @@ var JoyrideTooltip = class extends React__namespace.Component {
|
|
60650
62756
|
}
|
60651
62757
|
helpers.next();
|
60652
62758
|
});
|
60653
|
-
|
62759
|
+
__publicField2(this, "handleClickSkip", (event) => {
|
60654
62760
|
event.preventDefault();
|
60655
62761
|
const { helpers } = this.props;
|
60656
62762
|
helpers.skip();
|
60657
62763
|
});
|
60658
|
-
|
62764
|
+
__publicField2(this, "getElementsProps", () => {
|
60659
62765
|
const { continuous: continuous2, index: index2, isLastStep, setTooltipRef, size: size2, step } = this.props;
|
60660
62766
|
const { back, close, last: last2, next, nextLabelWithProgress, skip } = step.locale;
|
60661
62767
|
const backText = getReactNodeText(back);
|
@@ -60757,19 +62863,19 @@ var JoyrideTooltip = class extends React__namespace.Component {
|
|
60757
62863
|
var JoyrideStep = class extends React__namespace.Component {
|
60758
62864
|
constructor() {
|
60759
62865
|
super(...arguments);
|
60760
|
-
|
60761
|
-
|
60762
|
-
|
62866
|
+
__publicField2(this, "scope", null);
|
62867
|
+
__publicField2(this, "tooltip", null);
|
62868
|
+
__publicField2(this, "handleClickHoverBeacon", (event) => {
|
60763
62869
|
const { step, store } = this.props;
|
60764
62870
|
if (event.type === "mouseenter" && step.event !== "hover") {
|
60765
62871
|
return;
|
60766
62872
|
}
|
60767
62873
|
store.update({ lifecycle: LIFECYCLE.TOOLTIP });
|
60768
62874
|
});
|
60769
|
-
|
62875
|
+
__publicField2(this, "setTooltipRef", (element) => {
|
60770
62876
|
this.tooltip = element;
|
60771
62877
|
});
|
60772
|
-
|
62878
|
+
__publicField2(this, "setPopper", (popper, type) => {
|
60773
62879
|
var _a;
|
60774
62880
|
const { action, lifecycle, step, store } = this.props;
|
60775
62881
|
if (type === "wrapper") {
|
@@ -60787,7 +62893,7 @@ var JoyrideStep = class extends React__namespace.Component {
|
|
60787
62893
|
step.floaterProps.getPopper(popper, type);
|
60788
62894
|
}
|
60789
62895
|
});
|
60790
|
-
|
62896
|
+
__publicField2(this, "renderTooltip", (renderProps) => {
|
60791
62897
|
const { continuous: continuous2, helpers, index: index2, size: size2, step } = this.props;
|
60792
62898
|
return /* @__PURE__ */ React__namespace.createElement(
|
60793
62899
|
JoyrideTooltip,
|
@@ -60959,15 +63065,15 @@ var JoyrideStep = class extends React__namespace.Component {
|
|
60959
63065
|
var Joyride = class extends React__namespace.Component {
|
60960
63066
|
constructor(props) {
|
60961
63067
|
super(props);
|
60962
|
-
|
60963
|
-
|
60964
|
-
|
63068
|
+
__publicField2(this, "helpers");
|
63069
|
+
__publicField2(this, "store");
|
63070
|
+
__publicField2(this, "callback", (data) => {
|
60965
63071
|
const { callback } = this.props;
|
60966
63072
|
if (src_default.function(callback)) {
|
60967
63073
|
callback(data);
|
60968
63074
|
}
|
60969
63075
|
});
|
60970
|
-
|
63076
|
+
__publicField2(this, "handleKeyboard", (event) => {
|
60971
63077
|
const { index: index2, lifecycle } = this.state;
|
60972
63078
|
const { steps: steps2 } = this.props;
|
60973
63079
|
const step = steps2[index2];
|
@@ -60977,7 +63083,7 @@ var Joyride = class extends React__namespace.Component {
|
|
60977
63083
|
}
|
60978
63084
|
}
|
60979
63085
|
});
|
60980
|
-
|
63086
|
+
__publicField2(this, "handleClickOverlay", () => {
|
60981
63087
|
const { index: index2 } = this.state;
|
60982
63088
|
const { steps: steps2 } = this.props;
|
60983
63089
|
const step = getMergedStep(this.props, steps2[index2]);
|
@@ -60985,7 +63091,7 @@ var Joyride = class extends React__namespace.Component {
|
|
60985
63091
|
this.helpers.close("overlay");
|
60986
63092
|
}
|
60987
63093
|
});
|
60988
|
-
|
63094
|
+
__publicField2(this, "syncState", (state) => {
|
60989
63095
|
this.setState(state);
|
60990
63096
|
});
|
60991
63097
|
const { debug: debug2, getHelpers, run = true, stepIndex } = props;
|
@@ -61235,7 +63341,7 @@ var Joyride = class extends React__namespace.Component {
|
|
61235
63341
|
return /* @__PURE__ */ React__namespace.createElement("div", { className: "react-joyride" }, content.step, content.overlay);
|
61236
63342
|
}
|
61237
63343
|
};
|
61238
|
-
|
63344
|
+
__publicField2(Joyride, "defaultProps", defaultProps$4);
|
61239
63345
|
var components_default = Joyride;
|
61240
63346
|
const Tooltip$2 = ({
|
61241
63347
|
continuous: continuous2,
|
@@ -86217,7 +88323,7 @@ function getDataKey(sorting, filters, hiddenColumns, search) {
|
|
86217
88323
|
function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_PAGE_SIZE$1 }) {
|
86218
88324
|
const { pageSize } = options;
|
86219
88325
|
const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
|
86220
|
-
const length = React.useRef(0);
|
88326
|
+
const length = React.useRef(void 0);
|
86221
88327
|
const [data, setData] = React.useState({ rows: [], pages: [], cache: {}, lastFetchedPage: void 0 });
|
86222
88328
|
const _pendingPageRequests = React.useRef({});
|
86223
88329
|
const _lastUsedSorting = React.useRef([]);
|