fui-material 2.7.2 → 2.7.4
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/f-ui-kit.es.js +79 -1331
- package/dist/f-ui-kit.es.js.map +1 -1
- package/dist/f-ui-kit.umd.js +2 -2
- package/dist/f-ui-kit.umd.js.map +1 -1
- package/dist/types/context/LibraryProvider.d.ts +1 -1
- package/dist/types/hooks/index.d.ts +3 -3
- package/dist/types/hooks/useFApiMutation/index.d.ts +1 -0
- package/dist/types/hooks/{useApiMutation/useApiMutation.d.ts → useFApiMutation/useFApiMutation.d.ts} +4 -4
- package/dist/types/hooks/useFApiQuery/index.d.ts +1 -0
- package/dist/types/hooks/{useApiQuery/useApiQuery.d.ts → useFApiQuery/useFApiQuery.d.ts} +4 -4
- package/dist/types/hooks/useFManualApiQuery/index.d.ts +1 -0
- package/dist/types/hooks/{useManualApiQuery/useManualApiQuery.d.ts → useFManualApiQuery/useFManualApiQuery.d.ts} +7 -7
- package/dist/types/material/FButtonFile/FButtonFile.d.ts +1 -1
- package/dist/types/material/FSelectSearchDb/FSelectSearchDb.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/hooks/useApiMutation/index.d.ts +0 -1
- package/dist/types/hooks/useApiQuery/index.d.ts +0 -1
- package/dist/types/hooks/useManualApiQuery/index.d.ts +0 -1
package/dist/f-ui-kit.es.js
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import './index.css';var __typeError = (msg) => {
|
|
2
|
-
throw TypeError(msg);
|
|
3
|
-
};
|
|
4
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
5
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
8
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
9
|
-
var _focused, _cleanup, _setup, _a, _provider, _providerCalled, _b, _online, _cleanup2, _setup2, _c, _client, _currentQuery, _currentQueryInitialState, _currentResult, _currentResultState, _currentResultOptions, _currentThenable, _selectError, _selectFn, _selectResult, _lastQueryWithDefinedData, _staleTimeoutId, _refetchIntervalId, _currentRefetchInterval, _trackedProps, _QueryObserver_instances, executeFetch_fn, updateStaleTimeout_fn, computeRefetchInterval_fn, updateRefetchInterval_fn, updateTimers_fn, clearStaleTimeout_fn, clearRefetchInterval_fn, updateQuery_fn, notify_fn, _d, _client2, _currentResult2, _currentMutation, _mutateOptions, _MutationObserver_instances, updateResult_fn, notify_fn2, _e;
|
|
10
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
11
|
-
import
|
|
12
|
-
import React__default, { forwardRef, useRef, useState, useEffect, useMemo, useCallback, useLayoutEffect, Fragment as Fragment$1, isValidElement, cloneElement, useDeferredValue, createContext, useContext } from "react";
|
|
2
|
+
import React, { forwardRef, useRef, useState, useEffect, useMemo, useCallback, useLayoutEffect, Fragment as Fragment$1, isValidElement, cloneElement, useDeferredValue, createContext, useContext } from "react";
|
|
13
3
|
import ReactDOM, { createPortal } from "react-dom";
|
|
14
4
|
import JSZip from "jszip";
|
|
15
5
|
import initializeModule from "allorion-exporting-html-to-docx";
|
|
16
6
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
17
7
|
import { initializeModule as initializeModule$1, installFormatCode } from "allorion-exporting-html-to-xlsx";
|
|
18
8
|
import axios from "axios";
|
|
19
|
-
|
|
9
|
+
import { useQueryClient, useMutation, useQuery } from "@tanstack/react-query";
|
|
10
|
+
import './index.css';const btn = "_btn_ch6o3_1";
|
|
20
11
|
const stylesBtn = {
|
|
21
12
|
btn,
|
|
22
13
|
"btn-xs": "_btn-xs_ch6o3_21",
|
|
@@ -78,7 +69,7 @@ const defaultStyles = {
|
|
|
78
69
|
"f-button-file": "_f-button-file_i2hex_1",
|
|
79
70
|
"file-preview-list": "_file-preview-list_i2hex_1"
|
|
80
71
|
};
|
|
81
|
-
const FTrashIcon =
|
|
72
|
+
const FTrashIcon = React.forwardRef(({
|
|
82
73
|
color = "primary",
|
|
83
74
|
size = 32,
|
|
84
75
|
st,
|
|
@@ -239,8 +230,8 @@ const FButtonFile = ({
|
|
|
239
230
|
style,
|
|
240
231
|
id,
|
|
241
232
|
onClick: () => {
|
|
242
|
-
var
|
|
243
|
-
return (
|
|
233
|
+
var _a;
|
|
234
|
+
return (_a = fileRef.current) == null ? void 0 : _a.click();
|
|
244
235
|
},
|
|
245
236
|
children
|
|
246
237
|
}
|
|
@@ -273,7 +264,7 @@ const FButtonFile = ({
|
|
|
273
264
|
const styles$x = {
|
|
274
265
|
"f-text-field": "_f-text-field_200bb_1"
|
|
275
266
|
};
|
|
276
|
-
const FLoadIcon =
|
|
267
|
+
const FLoadIcon = React.forwardRef(({
|
|
277
268
|
size = 30,
|
|
278
269
|
st,
|
|
279
270
|
id,
|
|
@@ -762,7 +753,7 @@ const FTableBody = ({
|
|
|
762
753
|
...props
|
|
763
754
|
}) => {
|
|
764
755
|
const tableBodyRef = useRef(null);
|
|
765
|
-
const flatChildren = useMemo(() =>
|
|
756
|
+
const flatChildren = useMemo(() => React.Children.toArray(children), [children]);
|
|
766
757
|
const totalRows = flatChildren.length;
|
|
767
758
|
const [startIdx, setStartIdx] = useState(0);
|
|
768
759
|
const [rowHeights, setRowHeights] = useState(Array(flatChildren.length).fill(0));
|
|
@@ -793,16 +784,16 @@ const FTableBody = ({
|
|
|
793
784
|
requestAnimationFrame(updateStartIdx);
|
|
794
785
|
}, [updateStartIdx, virtualizationEnabled]);
|
|
795
786
|
useEffect(() => {
|
|
796
|
-
var
|
|
787
|
+
var _a;
|
|
797
788
|
if (!virtualizationEnabled) return;
|
|
798
789
|
const handleResize = () => requestAnimationFrame(updateStartIdx);
|
|
799
790
|
window.addEventListener("resize", handleResize);
|
|
800
|
-
(
|
|
791
|
+
(_a = tableWrapperRef == null ? void 0 : tableWrapperRef.current) == null ? void 0 : _a.addEventListener("scroll", handleScroll);
|
|
801
792
|
handleResize();
|
|
802
793
|
return () => {
|
|
803
|
-
var
|
|
794
|
+
var _a2;
|
|
804
795
|
window.removeEventListener("resize", handleResize);
|
|
805
|
-
(
|
|
796
|
+
(_a2 = tableWrapperRef == null ? void 0 : tableWrapperRef.current) == null ? void 0 : _a2.removeEventListener("scroll", handleScroll);
|
|
806
797
|
};
|
|
807
798
|
}, [handleScroll, updateStartIdx, virtualizationEnabled]);
|
|
808
799
|
useLayoutEffect(() => {
|
|
@@ -842,11 +833,11 @@ const FTableBody = ({
|
|
|
842
833
|
}
|
|
843
834
|
return /* @__PURE__ */ jsxs("tbody", { ref: tableBodyRef, style: st, ...props, className: `${styles$s["f-table-component__table_body"]} ${props.className || ""} ${styles$s[textAlignment]}`, children: [
|
|
844
835
|
virtualizationEnabled && rowHeights.some((h) => h > 0) && /* @__PURE__ */ jsx("tr", { style: { height: topOffset } }),
|
|
845
|
-
visibleItems.map((child, idx) =>
|
|
836
|
+
visibleItems.map((child, idx) => React.isValidElement(child) ? React.cloneElement(child, { "data-row-index": virtualizationEnabled ? startIdx + idx : idx, key: virtualizationEnabled ? startIdx + idx : idx }) : child),
|
|
846
837
|
virtualizationEnabled && rowHeights.some((h) => h > 0) && /* @__PURE__ */ jsx("tr", { style: { height: bottomOffset } })
|
|
847
838
|
] });
|
|
848
839
|
};
|
|
849
|
-
const FTableBody$1 =
|
|
840
|
+
const FTableBody$1 = React.memo(FTableBody);
|
|
850
841
|
const FTable = ({
|
|
851
842
|
st,
|
|
852
843
|
children,
|
|
@@ -891,10 +882,10 @@ const FTable = ({
|
|
|
891
882
|
style: { ...st, tableLayout: layout },
|
|
892
883
|
...props,
|
|
893
884
|
className: `table ${styles$s["f-table-component__table"]} ${styles$s["bordered"]} ${styles$s["bordered-half"]} ${props.className || ""}`,
|
|
894
|
-
children:
|
|
895
|
-
if (
|
|
885
|
+
children: React.Children.map(children, (child) => {
|
|
886
|
+
if (React.isValidElement(child) && child.type === FTableHead) {
|
|
896
887
|
const headProps = child.props;
|
|
897
|
-
return
|
|
888
|
+
return React.cloneElement(
|
|
898
889
|
child,
|
|
899
890
|
{
|
|
900
891
|
...headProps,
|
|
@@ -902,9 +893,9 @@ const FTable = ({
|
|
|
902
893
|
}
|
|
903
894
|
);
|
|
904
895
|
}
|
|
905
|
-
if (
|
|
896
|
+
if (React.isValidElement(child) && child.type === FTableBody$1) {
|
|
906
897
|
const headProps = child.props;
|
|
907
|
-
return
|
|
898
|
+
return React.cloneElement(
|
|
908
899
|
child,
|
|
909
900
|
{
|
|
910
901
|
...headProps,
|
|
@@ -1090,7 +1081,7 @@ const FDialog = ({
|
|
|
1090
1081
|
document.body
|
|
1091
1082
|
);
|
|
1092
1083
|
};
|
|
1093
|
-
const FCloseIcon =
|
|
1084
|
+
const FCloseIcon = React.forwardRef(({
|
|
1094
1085
|
color = "primary",
|
|
1095
1086
|
size = 30,
|
|
1096
1087
|
st,
|
|
@@ -1435,7 +1426,7 @@ const styles$k = {
|
|
|
1435
1426
|
"progress-dot": "_progress-dot_f7bma_172",
|
|
1436
1427
|
active: active$3
|
|
1437
1428
|
};
|
|
1438
|
-
const FArrowIcon =
|
|
1429
|
+
const FArrowIcon = React.forwardRef(({
|
|
1439
1430
|
color = "primary",
|
|
1440
1431
|
size = 30,
|
|
1441
1432
|
st,
|
|
@@ -1977,7 +1968,7 @@ const FSelect = forwardRef(
|
|
|
1977
1968
|
);
|
|
1978
1969
|
}
|
|
1979
1970
|
);
|
|
1980
|
-
const FSelectItem =
|
|
1971
|
+
const FSelectItem = React.forwardRef(({
|
|
1981
1972
|
st,
|
|
1982
1973
|
children,
|
|
1983
1974
|
...props
|
|
@@ -2751,7 +2742,7 @@ const FDropdown = forwardRef(({
|
|
|
2751
2742
|
setIsOpen(false);
|
|
2752
2743
|
};
|
|
2753
2744
|
const renderChildren = () => {
|
|
2754
|
-
return
|
|
2745
|
+
return React.Children.map(children, (child) => {
|
|
2755
2746
|
if (isValidElement(child) && child.type && child.type.displayName === "FDropdownItem") {
|
|
2756
2747
|
return cloneElement(child, {
|
|
2757
2748
|
onClick: handleItemClick(child)
|
|
@@ -3163,15 +3154,15 @@ const FMenuLinks = ({
|
|
|
3163
3154
|
disabled: disabled2 = [],
|
|
3164
3155
|
title: title2
|
|
3165
3156
|
}) => {
|
|
3166
|
-
const enhancedChildren =
|
|
3167
|
-
if (!
|
|
3157
|
+
const enhancedChildren = React.Children.map(children, (child, index) => {
|
|
3158
|
+
if (!React.isValidElement(child)) return child;
|
|
3168
3159
|
const isDisabled = disabled2.includes(index);
|
|
3169
3160
|
const childClass = [
|
|
3170
3161
|
child.props.className,
|
|
3171
3162
|
styles$8.link,
|
|
3172
3163
|
isDisabled && styles$8.disabled
|
|
3173
3164
|
].filter(Boolean).join(" ");
|
|
3174
|
-
return
|
|
3165
|
+
return React.cloneElement(child, {
|
|
3175
3166
|
className: childClass,
|
|
3176
3167
|
...isDisabled && { onClick: (e) => e.preventDefault() }
|
|
3177
3168
|
});
|
|
@@ -3328,43 +3319,43 @@ const FTooltip = ({
|
|
|
3328
3319
|
};
|
|
3329
3320
|
if (!disableHoverListener) {
|
|
3330
3321
|
childProps.onMouseEnter = (e) => {
|
|
3331
|
-
var
|
|
3322
|
+
var _a, _b;
|
|
3332
3323
|
handleOpen();
|
|
3333
|
-
(
|
|
3324
|
+
(_b = (_a = children.props).onMouseEnter) == null ? void 0 : _b.call(_a, e);
|
|
3334
3325
|
};
|
|
3335
3326
|
childProps.onMouseLeave = (e) => {
|
|
3336
|
-
var
|
|
3327
|
+
var _a, _b;
|
|
3337
3328
|
handleClose();
|
|
3338
|
-
(
|
|
3329
|
+
(_b = (_a = children.props).onMouseLeave) == null ? void 0 : _b.call(_a, e);
|
|
3339
3330
|
};
|
|
3340
3331
|
}
|
|
3341
3332
|
if (!disableFocusListener) {
|
|
3342
3333
|
childProps.onFocus = (e) => {
|
|
3343
|
-
var
|
|
3334
|
+
var _a, _b;
|
|
3344
3335
|
handleOpen();
|
|
3345
|
-
(
|
|
3336
|
+
(_b = (_a = children.props).onFocus) == null ? void 0 : _b.call(_a, e);
|
|
3346
3337
|
};
|
|
3347
3338
|
childProps.onBlur = (e) => {
|
|
3348
|
-
var
|
|
3339
|
+
var _a, _b;
|
|
3349
3340
|
handleClose();
|
|
3350
|
-
(
|
|
3341
|
+
(_b = (_a = children.props).onBlur) == null ? void 0 : _b.call(_a, e);
|
|
3351
3342
|
};
|
|
3352
3343
|
}
|
|
3353
3344
|
if (!disableTouchListener) {
|
|
3354
3345
|
childProps.onTouchStart = (e) => {
|
|
3355
|
-
var
|
|
3346
|
+
var _a, _b;
|
|
3356
3347
|
handleOpen();
|
|
3357
|
-
(
|
|
3348
|
+
(_b = (_a = children.props).onTouchStart) == null ? void 0 : _b.call(_a, e);
|
|
3358
3349
|
};
|
|
3359
3350
|
childProps.onTouchEnd = (e) => {
|
|
3360
|
-
var
|
|
3351
|
+
var _a, _b;
|
|
3361
3352
|
handleClose();
|
|
3362
|
-
(
|
|
3353
|
+
(_b = (_a = children.props).onTouchEnd) == null ? void 0 : _b.call(_a, e);
|
|
3363
3354
|
};
|
|
3364
3355
|
}
|
|
3365
3356
|
let wrappedChild;
|
|
3366
3357
|
const childPropsTyped = children.props;
|
|
3367
|
-
if (allowTooltipOnDisabled &&
|
|
3358
|
+
if (allowTooltipOnDisabled && React.isValidElement(children) && (childPropsTyped.disabled || childPropsTyped["aria-disabled"])) {
|
|
3368
3359
|
wrappedChild = /* @__PURE__ */ jsx(
|
|
3369
3360
|
"span",
|
|
3370
3361
|
{
|
|
@@ -3460,8 +3451,8 @@ const FSearchableSelect = forwardRef(
|
|
|
3460
3451
|
}, ref) => {
|
|
3461
3452
|
const options = useMemo(() => {
|
|
3462
3453
|
const results = [];
|
|
3463
|
-
|
|
3464
|
-
if (
|
|
3454
|
+
React.Children.forEach(children, (child) => {
|
|
3455
|
+
if (React.isValidElement(child)) {
|
|
3465
3456
|
const element = child;
|
|
3466
3457
|
const { value: childValue, children: childLabel } = element.props;
|
|
3467
3458
|
const valStr = childValue !== void 0 ? String(childValue) : "";
|
|
@@ -3540,11 +3531,11 @@ const FSearchableSelect = forwardRef(
|
|
|
3540
3531
|
setHighlightedIndex(0);
|
|
3541
3532
|
};
|
|
3542
3533
|
const handleClear = (e) => {
|
|
3543
|
-
var
|
|
3534
|
+
var _a;
|
|
3544
3535
|
e.stopPropagation();
|
|
3545
3536
|
triggerChange("");
|
|
3546
3537
|
setSearchQuery("");
|
|
3547
|
-
(
|
|
3538
|
+
(_a = visibleInputRef.current) == null ? void 0 : _a.focus();
|
|
3548
3539
|
};
|
|
3549
3540
|
useEffect(() => {
|
|
3550
3541
|
const handleClickOutside = (event) => {
|
|
@@ -3563,7 +3554,7 @@ const FSearchableSelect = forwardRef(
|
|
|
3563
3554
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3564
3555
|
}, [restProps.value, options]);
|
|
3565
3556
|
const handleKeyDown = (e) => {
|
|
3566
|
-
var
|
|
3557
|
+
var _a;
|
|
3567
3558
|
if (restOnKeyDown) restOnKeyDown(e);
|
|
3568
3559
|
if (e.key === "ArrowDown") {
|
|
3569
3560
|
e.preventDefault();
|
|
@@ -3582,7 +3573,7 @@ const FSearchableSelect = forwardRef(
|
|
|
3582
3573
|
}
|
|
3583
3574
|
} else if (e.key === "Escape") {
|
|
3584
3575
|
setIsOpen(false);
|
|
3585
|
-
(
|
|
3576
|
+
(_a = visibleInputRef.current) == null ? void 0 : _a.blur();
|
|
3586
3577
|
}
|
|
3587
3578
|
};
|
|
3588
3579
|
const baseStyle = {
|
|
@@ -3736,7 +3727,7 @@ const FSearchableSelect = forwardRef(
|
|
|
3736
3727
|
}
|
|
3737
3728
|
);
|
|
3738
3729
|
FSearchableSelect.displayName = "FSearchableSelect";
|
|
3739
|
-
const FPlusIcon =
|
|
3730
|
+
const FPlusIcon = React.forwardRef(({
|
|
3740
3731
|
color = "primary",
|
|
3741
3732
|
size = 30,
|
|
3742
3733
|
st,
|
|
@@ -3770,7 +3761,7 @@ const FPlusIcon = React__default.forwardRef(({
|
|
|
3770
3761
|
);
|
|
3771
3762
|
});
|
|
3772
3763
|
FPlusIcon.displayName = "FPlusIcon";
|
|
3773
|
-
const FCheckIcon =
|
|
3764
|
+
const FCheckIcon = React.forwardRef(({
|
|
3774
3765
|
color = "primary",
|
|
3775
3766
|
size = 30,
|
|
3776
3767
|
st,
|
|
@@ -3804,7 +3795,7 @@ const FCheckIcon = React__default.forwardRef(({
|
|
|
3804
3795
|
);
|
|
3805
3796
|
});
|
|
3806
3797
|
FCheckIcon.displayName = "FCheckIcon";
|
|
3807
|
-
const FListIcon =
|
|
3798
|
+
const FListIcon = React.forwardRef(({
|
|
3808
3799
|
color = "primary",
|
|
3809
3800
|
size = 30,
|
|
3810
3801
|
st,
|
|
@@ -3844,7 +3835,7 @@ const FListIcon = React__default.forwardRef(({
|
|
|
3844
3835
|
);
|
|
3845
3836
|
});
|
|
3846
3837
|
FListIcon.displayName = "FListIcon";
|
|
3847
|
-
const FPenIcon =
|
|
3838
|
+
const FPenIcon = React.forwardRef(({
|
|
3848
3839
|
color = "primary",
|
|
3849
3840
|
size = 30,
|
|
3850
3841
|
st,
|
|
@@ -3876,7 +3867,7 @@ const FPenIcon = React__default.forwardRef(({
|
|
|
3876
3867
|
);
|
|
3877
3868
|
});
|
|
3878
3869
|
FPenIcon.displayName = "FPenIcon";
|
|
3879
|
-
const FUploadIcon =
|
|
3870
|
+
const FUploadIcon = React.forwardRef(({
|
|
3880
3871
|
color = "primary",
|
|
3881
3872
|
size = 30,
|
|
3882
3873
|
st,
|
|
@@ -3906,7 +3897,7 @@ const FUploadIcon = React__default.forwardRef(({
|
|
|
3906
3897
|
);
|
|
3907
3898
|
});
|
|
3908
3899
|
FUploadIcon.displayName = "FUploadIcon";
|
|
3909
|
-
const FDownloadIcon =
|
|
3900
|
+
const FDownloadIcon = React.forwardRef(({
|
|
3910
3901
|
color = "primary",
|
|
3911
3902
|
size = 30,
|
|
3912
3903
|
st,
|
|
@@ -3936,7 +3927,7 @@ const FDownloadIcon = React__default.forwardRef(({
|
|
|
3936
3927
|
);
|
|
3937
3928
|
});
|
|
3938
3929
|
FDownloadIcon.displayName = "FDownloadIcon";
|
|
3939
|
-
const FCopyAddIcon =
|
|
3930
|
+
const FCopyAddIcon = React.forwardRef(({
|
|
3940
3931
|
color = "primary",
|
|
3941
3932
|
size = 30,
|
|
3942
3933
|
st,
|
|
@@ -3966,7 +3957,7 @@ const FCopyAddIcon = React__default.forwardRef(({
|
|
|
3966
3957
|
);
|
|
3967
3958
|
});
|
|
3968
3959
|
FCopyAddIcon.displayName = "FCopyAddIcon";
|
|
3969
|
-
const FUnlinkIcon =
|
|
3960
|
+
const FUnlinkIcon = React.forwardRef(({
|
|
3970
3961
|
color = "primary",
|
|
3971
3962
|
size = 30,
|
|
3972
3963
|
st,
|
|
@@ -4004,7 +3995,7 @@ const FUnlinkIcon = React__default.forwardRef(({
|
|
|
4004
3995
|
);
|
|
4005
3996
|
});
|
|
4006
3997
|
FUnlinkIcon.displayName = "FUnlinkIcon";
|
|
4007
|
-
const FFilterIcon =
|
|
3998
|
+
const FFilterIcon = React.forwardRef(({
|
|
4008
3999
|
color = "primary",
|
|
4009
4000
|
size = 30,
|
|
4010
4001
|
st,
|
|
@@ -4034,7 +4025,7 @@ const FFilterIcon = React__default.forwardRef(({
|
|
|
4034
4025
|
);
|
|
4035
4026
|
});
|
|
4036
4027
|
FFilterIcon.displayName = "FFilterIcon";
|
|
4037
|
-
const FDocumentIcon =
|
|
4028
|
+
const FDocumentIcon = React.forwardRef(({
|
|
4038
4029
|
color = "primary",
|
|
4039
4030
|
size = 30,
|
|
4040
4031
|
st,
|
|
@@ -4088,7 +4079,7 @@ const FDocumentIcon = React__default.forwardRef(({
|
|
|
4088
4079
|
);
|
|
4089
4080
|
});
|
|
4090
4081
|
FDocumentIcon.displayName = "FDocumentIcon";
|
|
4091
|
-
const FReloadIcon =
|
|
4082
|
+
const FReloadIcon = React.forwardRef(({
|
|
4092
4083
|
color = "primary",
|
|
4093
4084
|
size = 30,
|
|
4094
4085
|
st,
|
|
@@ -4118,7 +4109,7 @@ const FReloadIcon = React__default.forwardRef(({
|
|
|
4118
4109
|
);
|
|
4119
4110
|
});
|
|
4120
4111
|
FReloadIcon.displayName = "FReloadIcon";
|
|
4121
|
-
const FMinusIcon =
|
|
4112
|
+
const FMinusIcon = React.forwardRef(({
|
|
4122
4113
|
color = "primary",
|
|
4123
4114
|
size = 30,
|
|
4124
4115
|
st,
|
|
@@ -4148,7 +4139,7 @@ const FMinusIcon = React__default.forwardRef(({
|
|
|
4148
4139
|
);
|
|
4149
4140
|
});
|
|
4150
4141
|
FMinusIcon.displayName = "FMinusIcon";
|
|
4151
|
-
const FInfoCircleIcon =
|
|
4142
|
+
const FInfoCircleIcon = React.forwardRef(({
|
|
4152
4143
|
color = "primary",
|
|
4153
4144
|
size = 30,
|
|
4154
4145
|
st,
|
|
@@ -4178,7 +4169,7 @@ const FInfoCircleIcon = React__default.forwardRef(({
|
|
|
4178
4169
|
);
|
|
4179
4170
|
});
|
|
4180
4171
|
FInfoCircleIcon.displayName = "FInfoCircleIcon";
|
|
4181
|
-
const FSafeIcon =
|
|
4172
|
+
const FSafeIcon = React.forwardRef(({
|
|
4182
4173
|
color = "primary",
|
|
4183
4174
|
size = 30,
|
|
4184
4175
|
st,
|
|
@@ -4208,7 +4199,7 @@ const FSafeIcon = React__default.forwardRef(({
|
|
|
4208
4199
|
);
|
|
4209
4200
|
});
|
|
4210
4201
|
FSafeIcon.displayName = "FSafeIcon";
|
|
4211
|
-
const FArrowRightCircleIcon =
|
|
4202
|
+
const FArrowRightCircleIcon = React.forwardRef(({
|
|
4212
4203
|
color = "primary",
|
|
4213
4204
|
size = 30,
|
|
4214
4205
|
st,
|
|
@@ -4235,7 +4226,7 @@ const FArrowRightCircleIcon = React__default.forwardRef(({
|
|
|
4235
4226
|
);
|
|
4236
4227
|
});
|
|
4237
4228
|
FArrowRightCircleIcon.displayName = "FArrowRightCircleIcon";
|
|
4238
|
-
const FArrowLeftCircleIcon =
|
|
4229
|
+
const FArrowLeftCircleIcon = React.forwardRef(({
|
|
4239
4230
|
color = "primary",
|
|
4240
4231
|
size = 30,
|
|
4241
4232
|
st,
|
|
@@ -4262,7 +4253,7 @@ const FArrowLeftCircleIcon = React__default.forwardRef(({
|
|
|
4262
4253
|
);
|
|
4263
4254
|
});
|
|
4264
4255
|
FArrowLeftCircleIcon.displayName = "FArrowLeftCircleIcon";
|
|
4265
|
-
const FArrowUpCircleIcon =
|
|
4256
|
+
const FArrowUpCircleIcon = React.forwardRef(({
|
|
4266
4257
|
color = "primary",
|
|
4267
4258
|
size = 30,
|
|
4268
4259
|
st,
|
|
@@ -4289,7 +4280,7 @@ const FArrowUpCircleIcon = React__default.forwardRef(({
|
|
|
4289
4280
|
);
|
|
4290
4281
|
});
|
|
4291
4282
|
FArrowUpCircleIcon.displayName = "FArrowUpCircleIcon";
|
|
4292
|
-
const FArrowDownCircleIcon =
|
|
4283
|
+
const FArrowDownCircleIcon = React.forwardRef(({
|
|
4293
4284
|
color = "primary",
|
|
4294
4285
|
size = 30,
|
|
4295
4286
|
st,
|
|
@@ -7633,10 +7624,10 @@ const fNotification = ({
|
|
|
7633
7624
|
return blockNotification2;
|
|
7634
7625
|
};
|
|
7635
7626
|
const removeEmptyNotificationBlock = () => {
|
|
7636
|
-
var
|
|
7627
|
+
var _a;
|
|
7637
7628
|
const blockNotification2 = document.querySelector("#block-notification");
|
|
7638
7629
|
if (blockNotification2 && blockNotification2.children.length === 0) {
|
|
7639
|
-
(
|
|
7630
|
+
(_a = blockNotification2.parentNode) == null ? void 0 : _a.removeChild(blockNotification2);
|
|
7640
7631
|
}
|
|
7641
7632
|
};
|
|
7642
7633
|
const blockNotification = getOrCreateNotificationBlock();
|
|
@@ -7750,8 +7741,8 @@ const fDownloadFileFromBase64 = (base64String, fileName) => {
|
|
|
7750
7741
|
}
|
|
7751
7742
|
};
|
|
7752
7743
|
const getMimeTypeFromFileName = (fileName) => {
|
|
7753
|
-
var
|
|
7754
|
-
const extension = (
|
|
7744
|
+
var _a;
|
|
7745
|
+
const extension = (_a = fileName.split(".").pop()) == null ? void 0 : _a.toLowerCase();
|
|
7755
7746
|
if (!extension) return void 0;
|
|
7756
7747
|
const mimeTypes = {
|
|
7757
7748
|
txt: "text/plain",
|
|
@@ -7904,7 +7895,7 @@ const useFApi = ({ doNotUseState = false, defaultState = null, getValueByPath =
|
|
|
7904
7895
|
const [loading, setLoading] = useState(false);
|
|
7905
7896
|
const [error2, setError] = useState(null);
|
|
7906
7897
|
const execute = async (config) => {
|
|
7907
|
-
var
|
|
7898
|
+
var _a, _b, _c;
|
|
7908
7899
|
setLoading(true);
|
|
7909
7900
|
setError(null);
|
|
7910
7901
|
try {
|
|
@@ -7928,11 +7919,11 @@ const useFApi = ({ doNotUseState = false, defaultState = null, getValueByPath =
|
|
|
7928
7919
|
}
|
|
7929
7920
|
} catch (error22) {
|
|
7930
7921
|
const err = error22;
|
|
7931
|
-
const errorMessage = ((
|
|
7922
|
+
const errorMessage = ((_b = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || err.message || "Неизвестная ошибка";
|
|
7932
7923
|
fNotification({
|
|
7933
7924
|
variant: "error",
|
|
7934
7925
|
title: "Ошибка",
|
|
7935
|
-
body: `- Произошла ошибка ${(
|
|
7926
|
+
body: `- Произошла ошибка ${(_c = err.response) == null ? void 0 : _c.status}
|
|
7936
7927
|
- ${errorMessage}`,
|
|
7937
7928
|
timeSecClose: 5
|
|
7938
7929
|
});
|
|
@@ -7949,1249 +7940,6 @@ const useFApi = ({ doNotUseState = false, defaultState = null, getValueByPath =
|
|
|
7949
7940
|
};
|
|
7950
7941
|
return { data, loading, error: error2, execute, reset };
|
|
7951
7942
|
};
|
|
7952
|
-
var Subscribable = class {
|
|
7953
|
-
constructor() {
|
|
7954
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
7955
|
-
this.subscribe = this.subscribe.bind(this);
|
|
7956
|
-
}
|
|
7957
|
-
subscribe(listener) {
|
|
7958
|
-
this.listeners.add(listener);
|
|
7959
|
-
this.onSubscribe();
|
|
7960
|
-
return () => {
|
|
7961
|
-
this.listeners.delete(listener);
|
|
7962
|
-
this.onUnsubscribe();
|
|
7963
|
-
};
|
|
7964
|
-
}
|
|
7965
|
-
hasListeners() {
|
|
7966
|
-
return this.listeners.size > 0;
|
|
7967
|
-
}
|
|
7968
|
-
onSubscribe() {
|
|
7969
|
-
}
|
|
7970
|
-
onUnsubscribe() {
|
|
7971
|
-
}
|
|
7972
|
-
};
|
|
7973
|
-
var FocusManager = (_a = class extends Subscribable {
|
|
7974
|
-
constructor() {
|
|
7975
|
-
super();
|
|
7976
|
-
__privateAdd(this, _focused);
|
|
7977
|
-
__privateAdd(this, _cleanup);
|
|
7978
|
-
__privateAdd(this, _setup);
|
|
7979
|
-
__privateSet(this, _setup, (onFocus) => {
|
|
7980
|
-
if (typeof window !== "undefined" && window.addEventListener) {
|
|
7981
|
-
const listener = () => onFocus();
|
|
7982
|
-
window.addEventListener("visibilitychange", listener, false);
|
|
7983
|
-
return () => {
|
|
7984
|
-
window.removeEventListener("visibilitychange", listener);
|
|
7985
|
-
};
|
|
7986
|
-
}
|
|
7987
|
-
return;
|
|
7988
|
-
});
|
|
7989
|
-
}
|
|
7990
|
-
onSubscribe() {
|
|
7991
|
-
if (!__privateGet(this, _cleanup)) {
|
|
7992
|
-
this.setEventListener(__privateGet(this, _setup));
|
|
7993
|
-
}
|
|
7994
|
-
}
|
|
7995
|
-
onUnsubscribe() {
|
|
7996
|
-
var _a2;
|
|
7997
|
-
if (!this.hasListeners()) {
|
|
7998
|
-
(_a2 = __privateGet(this, _cleanup)) == null ? void 0 : _a2.call(this);
|
|
7999
|
-
__privateSet(this, _cleanup, void 0);
|
|
8000
|
-
}
|
|
8001
|
-
}
|
|
8002
|
-
setEventListener(setup) {
|
|
8003
|
-
var _a2;
|
|
8004
|
-
__privateSet(this, _setup, setup);
|
|
8005
|
-
(_a2 = __privateGet(this, _cleanup)) == null ? void 0 : _a2.call(this);
|
|
8006
|
-
__privateSet(this, _cleanup, setup((focused2) => {
|
|
8007
|
-
if (typeof focused2 === "boolean") {
|
|
8008
|
-
this.setFocused(focused2);
|
|
8009
|
-
} else {
|
|
8010
|
-
this.onFocus();
|
|
8011
|
-
}
|
|
8012
|
-
}));
|
|
8013
|
-
}
|
|
8014
|
-
setFocused(focused2) {
|
|
8015
|
-
const changed = __privateGet(this, _focused) !== focused2;
|
|
8016
|
-
if (changed) {
|
|
8017
|
-
__privateSet(this, _focused, focused2);
|
|
8018
|
-
this.onFocus();
|
|
8019
|
-
}
|
|
8020
|
-
}
|
|
8021
|
-
onFocus() {
|
|
8022
|
-
const isFocused = this.isFocused();
|
|
8023
|
-
this.listeners.forEach((listener) => {
|
|
8024
|
-
listener(isFocused);
|
|
8025
|
-
});
|
|
8026
|
-
}
|
|
8027
|
-
isFocused() {
|
|
8028
|
-
var _a2;
|
|
8029
|
-
if (typeof __privateGet(this, _focused) === "boolean") {
|
|
8030
|
-
return __privateGet(this, _focused);
|
|
8031
|
-
}
|
|
8032
|
-
return ((_a2 = globalThis.document) == null ? void 0 : _a2.visibilityState) !== "hidden";
|
|
8033
|
-
}
|
|
8034
|
-
}, _focused = new WeakMap(), _cleanup = new WeakMap(), _setup = new WeakMap(), _a);
|
|
8035
|
-
var focusManager = new FocusManager();
|
|
8036
|
-
var defaultTimeoutProvider = {
|
|
8037
|
-
// We need the wrapper function syntax below instead of direct references to
|
|
8038
|
-
// global setTimeout etc.
|
|
8039
|
-
//
|
|
8040
|
-
// BAD: `setTimeout: setTimeout`
|
|
8041
|
-
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
8042
|
-
//
|
|
8043
|
-
// If we use direct references here, then anything that wants to spy on or
|
|
8044
|
-
// replace the global setTimeout (like tests) won't work since we'll already
|
|
8045
|
-
// have a hard reference to the original implementation at the time when this
|
|
8046
|
-
// file was imported.
|
|
8047
|
-
setTimeout: (callback, delay) => setTimeout(callback, delay),
|
|
8048
|
-
clearTimeout: (timeoutId) => clearTimeout(timeoutId),
|
|
8049
|
-
setInterval: (callback, delay) => setInterval(callback, delay),
|
|
8050
|
-
clearInterval: (intervalId) => clearInterval(intervalId)
|
|
8051
|
-
};
|
|
8052
|
-
var TimeoutManager = (_b = class {
|
|
8053
|
-
constructor() {
|
|
8054
|
-
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
8055
|
-
// type at app boot; and if we leave that type, then any new timer provider
|
|
8056
|
-
// would need to support the default provider's concrete timer ID, which is
|
|
8057
|
-
// infeasible across environments.
|
|
8058
|
-
//
|
|
8059
|
-
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
8060
|
-
// this class is unsafe internally to allow for extension.
|
|
8061
|
-
__privateAdd(this, _provider, defaultTimeoutProvider);
|
|
8062
|
-
__privateAdd(this, _providerCalled, false);
|
|
8063
|
-
}
|
|
8064
|
-
setTimeoutProvider(provider) {
|
|
8065
|
-
if (process.env.NODE_ENV !== "production") {
|
|
8066
|
-
if (__privateGet(this, _providerCalled) && provider !== __privateGet(this, _provider)) {
|
|
8067
|
-
console.error(
|
|
8068
|
-
`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
|
|
8069
|
-
{ previous: __privateGet(this, _provider), provider }
|
|
8070
|
-
);
|
|
8071
|
-
}
|
|
8072
|
-
}
|
|
8073
|
-
__privateSet(this, _provider, provider);
|
|
8074
|
-
if (process.env.NODE_ENV !== "production") {
|
|
8075
|
-
__privateSet(this, _providerCalled, false);
|
|
8076
|
-
}
|
|
8077
|
-
}
|
|
8078
|
-
setTimeout(callback, delay) {
|
|
8079
|
-
if (process.env.NODE_ENV !== "production") {
|
|
8080
|
-
__privateSet(this, _providerCalled, true);
|
|
8081
|
-
}
|
|
8082
|
-
return __privateGet(this, _provider).setTimeout(callback, delay);
|
|
8083
|
-
}
|
|
8084
|
-
clearTimeout(timeoutId) {
|
|
8085
|
-
__privateGet(this, _provider).clearTimeout(timeoutId);
|
|
8086
|
-
}
|
|
8087
|
-
setInterval(callback, delay) {
|
|
8088
|
-
if (process.env.NODE_ENV !== "production") {
|
|
8089
|
-
__privateSet(this, _providerCalled, true);
|
|
8090
|
-
}
|
|
8091
|
-
return __privateGet(this, _provider).setInterval(callback, delay);
|
|
8092
|
-
}
|
|
8093
|
-
clearInterval(intervalId) {
|
|
8094
|
-
__privateGet(this, _provider).clearInterval(intervalId);
|
|
8095
|
-
}
|
|
8096
|
-
}, _provider = new WeakMap(), _providerCalled = new WeakMap(), _b);
|
|
8097
|
-
var timeoutManager = new TimeoutManager();
|
|
8098
|
-
function systemSetTimeoutZero(callback) {
|
|
8099
|
-
setTimeout(callback, 0);
|
|
8100
|
-
}
|
|
8101
|
-
var isServer = typeof window === "undefined" || "Deno" in globalThis;
|
|
8102
|
-
function noop() {
|
|
8103
|
-
}
|
|
8104
|
-
function isValidTimeout(value) {
|
|
8105
|
-
return typeof value === "number" && value >= 0 && value !== Infinity;
|
|
8106
|
-
}
|
|
8107
|
-
function timeUntilStale(updatedAt, staleTime) {
|
|
8108
|
-
return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
|
|
8109
|
-
}
|
|
8110
|
-
function resolveStaleTime(staleTime, query) {
|
|
8111
|
-
return typeof staleTime === "function" ? staleTime(query) : staleTime;
|
|
8112
|
-
}
|
|
8113
|
-
function resolveQueryBoolean(option, query) {
|
|
8114
|
-
return typeof option === "function" ? option(query) : option;
|
|
8115
|
-
}
|
|
8116
|
-
function hashKey(queryKey) {
|
|
8117
|
-
return JSON.stringify(
|
|
8118
|
-
queryKey,
|
|
8119
|
-
(_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
|
|
8120
|
-
result[key] = val[key];
|
|
8121
|
-
return result;
|
|
8122
|
-
}, {}) : val
|
|
8123
|
-
);
|
|
8124
|
-
}
|
|
8125
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
|
8126
|
-
function replaceEqualDeep(a, b, depth = 0) {
|
|
8127
|
-
if (a === b) {
|
|
8128
|
-
return a;
|
|
8129
|
-
}
|
|
8130
|
-
if (depth > 500) return b;
|
|
8131
|
-
const array = isPlainArray(a) && isPlainArray(b);
|
|
8132
|
-
if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
|
|
8133
|
-
const aItems = array ? a : Object.keys(a);
|
|
8134
|
-
const aSize = aItems.length;
|
|
8135
|
-
const bItems = array ? b : Object.keys(b);
|
|
8136
|
-
const bSize = bItems.length;
|
|
8137
|
-
const copy = array ? new Array(bSize) : {};
|
|
8138
|
-
let equalItems = 0;
|
|
8139
|
-
for (let i = 0; i < bSize; i++) {
|
|
8140
|
-
const key = array ? i : bItems[i];
|
|
8141
|
-
const aItem = a[key];
|
|
8142
|
-
const bItem = b[key];
|
|
8143
|
-
if (aItem === bItem) {
|
|
8144
|
-
copy[key] = aItem;
|
|
8145
|
-
if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
|
|
8146
|
-
continue;
|
|
8147
|
-
}
|
|
8148
|
-
if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
|
|
8149
|
-
copy[key] = bItem;
|
|
8150
|
-
continue;
|
|
8151
|
-
}
|
|
8152
|
-
const v = replaceEqualDeep(aItem, bItem, depth + 1);
|
|
8153
|
-
copy[key] = v;
|
|
8154
|
-
if (v === aItem) equalItems++;
|
|
8155
|
-
}
|
|
8156
|
-
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
8157
|
-
}
|
|
8158
|
-
function shallowEqualObjects(a, b) {
|
|
8159
|
-
if (!b || Object.keys(a).length !== Object.keys(b).length) {
|
|
8160
|
-
return false;
|
|
8161
|
-
}
|
|
8162
|
-
for (const key in a) {
|
|
8163
|
-
if (a[key] !== b[key]) {
|
|
8164
|
-
return false;
|
|
8165
|
-
}
|
|
8166
|
-
}
|
|
8167
|
-
return true;
|
|
8168
|
-
}
|
|
8169
|
-
function isPlainArray(value) {
|
|
8170
|
-
return Array.isArray(value) && value.length === Object.keys(value).length;
|
|
8171
|
-
}
|
|
8172
|
-
function isPlainObject(o) {
|
|
8173
|
-
if (!hasObjectPrototype(o)) {
|
|
8174
|
-
return false;
|
|
8175
|
-
}
|
|
8176
|
-
const ctor = o.constructor;
|
|
8177
|
-
if (ctor === void 0) {
|
|
8178
|
-
return true;
|
|
8179
|
-
}
|
|
8180
|
-
const prot = ctor.prototype;
|
|
8181
|
-
if (!hasObjectPrototype(prot)) {
|
|
8182
|
-
return false;
|
|
8183
|
-
}
|
|
8184
|
-
if (!prot.hasOwnProperty("isPrototypeOf")) {
|
|
8185
|
-
return false;
|
|
8186
|
-
}
|
|
8187
|
-
if (Object.getPrototypeOf(o) !== Object.prototype) {
|
|
8188
|
-
return false;
|
|
8189
|
-
}
|
|
8190
|
-
return true;
|
|
8191
|
-
}
|
|
8192
|
-
function hasObjectPrototype(o) {
|
|
8193
|
-
return Object.prototype.toString.call(o) === "[object Object]";
|
|
8194
|
-
}
|
|
8195
|
-
function replaceData(prevData, data, options) {
|
|
8196
|
-
if (typeof options.structuralSharing === "function") {
|
|
8197
|
-
return options.structuralSharing(prevData, data);
|
|
8198
|
-
} else if (options.structuralSharing !== false) {
|
|
8199
|
-
if (process.env.NODE_ENV !== "production") {
|
|
8200
|
-
try {
|
|
8201
|
-
return replaceEqualDeep(prevData, data);
|
|
8202
|
-
} catch (error2) {
|
|
8203
|
-
console.error(
|
|
8204
|
-
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error2}`
|
|
8205
|
-
);
|
|
8206
|
-
throw error2;
|
|
8207
|
-
}
|
|
8208
|
-
}
|
|
8209
|
-
return replaceEqualDeep(prevData, data);
|
|
8210
|
-
}
|
|
8211
|
-
return data;
|
|
8212
|
-
}
|
|
8213
|
-
function shouldThrowError(throwOnError, params) {
|
|
8214
|
-
if (typeof throwOnError === "function") {
|
|
8215
|
-
return throwOnError(...params);
|
|
8216
|
-
}
|
|
8217
|
-
return !!throwOnError;
|
|
8218
|
-
}
|
|
8219
|
-
var environmentManager = /* @__PURE__ */ (() => {
|
|
8220
|
-
let isServerFn = () => isServer;
|
|
8221
|
-
return {
|
|
8222
|
-
/**
|
|
8223
|
-
* Returns whether the current runtime should be treated as a server environment.
|
|
8224
|
-
*/
|
|
8225
|
-
isServer() {
|
|
8226
|
-
return isServerFn();
|
|
8227
|
-
},
|
|
8228
|
-
/**
|
|
8229
|
-
* Overrides the server check globally.
|
|
8230
|
-
*/
|
|
8231
|
-
setIsServer(isServerValue) {
|
|
8232
|
-
isServerFn = isServerValue;
|
|
8233
|
-
}
|
|
8234
|
-
};
|
|
8235
|
-
})();
|
|
8236
|
-
function pendingThenable() {
|
|
8237
|
-
let resolve;
|
|
8238
|
-
let reject;
|
|
8239
|
-
const thenable = new Promise((_resolve, _reject) => {
|
|
8240
|
-
resolve = _resolve;
|
|
8241
|
-
reject = _reject;
|
|
8242
|
-
});
|
|
8243
|
-
thenable.status = "pending";
|
|
8244
|
-
thenable.catch(() => {
|
|
8245
|
-
});
|
|
8246
|
-
function finalize(data) {
|
|
8247
|
-
Object.assign(thenable, data);
|
|
8248
|
-
delete thenable.resolve;
|
|
8249
|
-
delete thenable.reject;
|
|
8250
|
-
}
|
|
8251
|
-
thenable.resolve = (value) => {
|
|
8252
|
-
finalize({
|
|
8253
|
-
status: "fulfilled",
|
|
8254
|
-
value
|
|
8255
|
-
});
|
|
8256
|
-
resolve(value);
|
|
8257
|
-
};
|
|
8258
|
-
thenable.reject = (reason) => {
|
|
8259
|
-
finalize({
|
|
8260
|
-
status: "rejected",
|
|
8261
|
-
reason
|
|
8262
|
-
});
|
|
8263
|
-
reject(reason);
|
|
8264
|
-
};
|
|
8265
|
-
return thenable;
|
|
8266
|
-
}
|
|
8267
|
-
var defaultScheduler = systemSetTimeoutZero;
|
|
8268
|
-
function createNotifyManager() {
|
|
8269
|
-
let queue = [];
|
|
8270
|
-
let transactions = 0;
|
|
8271
|
-
let notifyFn = (callback) => {
|
|
8272
|
-
callback();
|
|
8273
|
-
};
|
|
8274
|
-
let batchNotifyFn = (callback) => {
|
|
8275
|
-
callback();
|
|
8276
|
-
};
|
|
8277
|
-
let scheduleFn = defaultScheduler;
|
|
8278
|
-
const schedule = (callback) => {
|
|
8279
|
-
if (transactions) {
|
|
8280
|
-
queue.push(callback);
|
|
8281
|
-
} else {
|
|
8282
|
-
scheduleFn(() => {
|
|
8283
|
-
notifyFn(callback);
|
|
8284
|
-
});
|
|
8285
|
-
}
|
|
8286
|
-
};
|
|
8287
|
-
const flush = () => {
|
|
8288
|
-
const originalQueue = queue;
|
|
8289
|
-
queue = [];
|
|
8290
|
-
if (originalQueue.length) {
|
|
8291
|
-
scheduleFn(() => {
|
|
8292
|
-
batchNotifyFn(() => {
|
|
8293
|
-
originalQueue.forEach((callback) => {
|
|
8294
|
-
notifyFn(callback);
|
|
8295
|
-
});
|
|
8296
|
-
});
|
|
8297
|
-
});
|
|
8298
|
-
}
|
|
8299
|
-
};
|
|
8300
|
-
return {
|
|
8301
|
-
batch: (callback) => {
|
|
8302
|
-
let result;
|
|
8303
|
-
transactions++;
|
|
8304
|
-
try {
|
|
8305
|
-
result = callback();
|
|
8306
|
-
} finally {
|
|
8307
|
-
transactions--;
|
|
8308
|
-
if (!transactions) {
|
|
8309
|
-
flush();
|
|
8310
|
-
}
|
|
8311
|
-
}
|
|
8312
|
-
return result;
|
|
8313
|
-
},
|
|
8314
|
-
/**
|
|
8315
|
-
* All calls to the wrapped function will be batched.
|
|
8316
|
-
*/
|
|
8317
|
-
batchCalls: (callback) => {
|
|
8318
|
-
return (...args) => {
|
|
8319
|
-
schedule(() => {
|
|
8320
|
-
callback(...args);
|
|
8321
|
-
});
|
|
8322
|
-
};
|
|
8323
|
-
},
|
|
8324
|
-
schedule,
|
|
8325
|
-
/**
|
|
8326
|
-
* Use this method to set a custom notify function.
|
|
8327
|
-
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
8328
|
-
*/
|
|
8329
|
-
setNotifyFunction: (fn) => {
|
|
8330
|
-
notifyFn = fn;
|
|
8331
|
-
},
|
|
8332
|
-
/**
|
|
8333
|
-
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
8334
|
-
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
8335
|
-
*/
|
|
8336
|
-
setBatchNotifyFunction: (fn) => {
|
|
8337
|
-
batchNotifyFn = fn;
|
|
8338
|
-
},
|
|
8339
|
-
setScheduler: (fn) => {
|
|
8340
|
-
scheduleFn = fn;
|
|
8341
|
-
}
|
|
8342
|
-
};
|
|
8343
|
-
}
|
|
8344
|
-
var notifyManager = createNotifyManager();
|
|
8345
|
-
var OnlineManager = (_c = class extends Subscribable {
|
|
8346
|
-
constructor() {
|
|
8347
|
-
super();
|
|
8348
|
-
__privateAdd(this, _online, true);
|
|
8349
|
-
__privateAdd(this, _cleanup2);
|
|
8350
|
-
__privateAdd(this, _setup2);
|
|
8351
|
-
__privateSet(this, _setup2, (onOnline) => {
|
|
8352
|
-
if (typeof window !== "undefined" && window.addEventListener) {
|
|
8353
|
-
const onlineListener = () => onOnline(true);
|
|
8354
|
-
const offlineListener = () => onOnline(false);
|
|
8355
|
-
window.addEventListener("online", onlineListener, false);
|
|
8356
|
-
window.addEventListener("offline", offlineListener, false);
|
|
8357
|
-
return () => {
|
|
8358
|
-
window.removeEventListener("online", onlineListener);
|
|
8359
|
-
window.removeEventListener("offline", offlineListener);
|
|
8360
|
-
};
|
|
8361
|
-
}
|
|
8362
|
-
return;
|
|
8363
|
-
});
|
|
8364
|
-
}
|
|
8365
|
-
onSubscribe() {
|
|
8366
|
-
if (!__privateGet(this, _cleanup2)) {
|
|
8367
|
-
this.setEventListener(__privateGet(this, _setup2));
|
|
8368
|
-
}
|
|
8369
|
-
}
|
|
8370
|
-
onUnsubscribe() {
|
|
8371
|
-
var _a2;
|
|
8372
|
-
if (!this.hasListeners()) {
|
|
8373
|
-
(_a2 = __privateGet(this, _cleanup2)) == null ? void 0 : _a2.call(this);
|
|
8374
|
-
__privateSet(this, _cleanup2, void 0);
|
|
8375
|
-
}
|
|
8376
|
-
}
|
|
8377
|
-
setEventListener(setup) {
|
|
8378
|
-
var _a2;
|
|
8379
|
-
__privateSet(this, _setup2, setup);
|
|
8380
|
-
(_a2 = __privateGet(this, _cleanup2)) == null ? void 0 : _a2.call(this);
|
|
8381
|
-
__privateSet(this, _cleanup2, setup(this.setOnline.bind(this)));
|
|
8382
|
-
}
|
|
8383
|
-
setOnline(online) {
|
|
8384
|
-
const changed = __privateGet(this, _online) !== online;
|
|
8385
|
-
if (changed) {
|
|
8386
|
-
__privateSet(this, _online, online);
|
|
8387
|
-
this.listeners.forEach((listener) => {
|
|
8388
|
-
listener(online);
|
|
8389
|
-
});
|
|
8390
|
-
}
|
|
8391
|
-
}
|
|
8392
|
-
isOnline() {
|
|
8393
|
-
return __privateGet(this, _online);
|
|
8394
|
-
}
|
|
8395
|
-
}, _online = new WeakMap(), _cleanup2 = new WeakMap(), _setup2 = new WeakMap(), _c);
|
|
8396
|
-
var onlineManager = new OnlineManager();
|
|
8397
|
-
function canFetch(networkMode) {
|
|
8398
|
-
return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
|
|
8399
|
-
}
|
|
8400
|
-
function fetchState(data, options) {
|
|
8401
|
-
return {
|
|
8402
|
-
fetchFailureCount: 0,
|
|
8403
|
-
fetchFailureReason: null,
|
|
8404
|
-
fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
|
|
8405
|
-
...data === void 0 && {
|
|
8406
|
-
error: null,
|
|
8407
|
-
status: "pending"
|
|
8408
|
-
}
|
|
8409
|
-
};
|
|
8410
|
-
}
|
|
8411
|
-
var QueryObserver = (_d = class extends Subscribable {
|
|
8412
|
-
constructor(client, options) {
|
|
8413
|
-
super();
|
|
8414
|
-
__privateAdd(this, _QueryObserver_instances);
|
|
8415
|
-
__privateAdd(this, _client);
|
|
8416
|
-
__privateAdd(this, _currentQuery);
|
|
8417
|
-
__privateAdd(this, _currentQueryInitialState);
|
|
8418
|
-
__privateAdd(this, _currentResult);
|
|
8419
|
-
__privateAdd(this, _currentResultState);
|
|
8420
|
-
__privateAdd(this, _currentResultOptions);
|
|
8421
|
-
__privateAdd(this, _currentThenable);
|
|
8422
|
-
__privateAdd(this, _selectError);
|
|
8423
|
-
__privateAdd(this, _selectFn);
|
|
8424
|
-
__privateAdd(this, _selectResult);
|
|
8425
|
-
// This property keeps track of the last query with defined data.
|
|
8426
|
-
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
8427
|
-
__privateAdd(this, _lastQueryWithDefinedData);
|
|
8428
|
-
__privateAdd(this, _staleTimeoutId);
|
|
8429
|
-
__privateAdd(this, _refetchIntervalId);
|
|
8430
|
-
__privateAdd(this, _currentRefetchInterval);
|
|
8431
|
-
__privateAdd(this, _trackedProps, /* @__PURE__ */ new Set());
|
|
8432
|
-
this.options = options;
|
|
8433
|
-
__privateSet(this, _client, client);
|
|
8434
|
-
__privateSet(this, _selectError, null);
|
|
8435
|
-
__privateSet(this, _currentThenable, pendingThenable());
|
|
8436
|
-
this.bindMethods();
|
|
8437
|
-
this.setOptions(options);
|
|
8438
|
-
}
|
|
8439
|
-
bindMethods() {
|
|
8440
|
-
this.refetch = this.refetch.bind(this);
|
|
8441
|
-
}
|
|
8442
|
-
onSubscribe() {
|
|
8443
|
-
if (this.listeners.size === 1) {
|
|
8444
|
-
__privateGet(this, _currentQuery).addObserver(this);
|
|
8445
|
-
if (shouldFetchOnMount(__privateGet(this, _currentQuery), this.options)) {
|
|
8446
|
-
__privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this);
|
|
8447
|
-
} else {
|
|
8448
|
-
this.updateResult();
|
|
8449
|
-
}
|
|
8450
|
-
__privateMethod(this, _QueryObserver_instances, updateTimers_fn).call(this);
|
|
8451
|
-
}
|
|
8452
|
-
}
|
|
8453
|
-
onUnsubscribe() {
|
|
8454
|
-
if (!this.hasListeners()) {
|
|
8455
|
-
this.destroy();
|
|
8456
|
-
}
|
|
8457
|
-
}
|
|
8458
|
-
shouldFetchOnReconnect() {
|
|
8459
|
-
return shouldFetchOn(
|
|
8460
|
-
__privateGet(this, _currentQuery),
|
|
8461
|
-
this.options,
|
|
8462
|
-
this.options.refetchOnReconnect
|
|
8463
|
-
);
|
|
8464
|
-
}
|
|
8465
|
-
shouldFetchOnWindowFocus() {
|
|
8466
|
-
return shouldFetchOn(
|
|
8467
|
-
__privateGet(this, _currentQuery),
|
|
8468
|
-
this.options,
|
|
8469
|
-
this.options.refetchOnWindowFocus
|
|
8470
|
-
);
|
|
8471
|
-
}
|
|
8472
|
-
destroy() {
|
|
8473
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
8474
|
-
__privateMethod(this, _QueryObserver_instances, clearStaleTimeout_fn).call(this);
|
|
8475
|
-
__privateMethod(this, _QueryObserver_instances, clearRefetchInterval_fn).call(this);
|
|
8476
|
-
__privateGet(this, _currentQuery).removeObserver(this);
|
|
8477
|
-
}
|
|
8478
|
-
setOptions(options) {
|
|
8479
|
-
const prevOptions = this.options;
|
|
8480
|
-
const prevQuery = __privateGet(this, _currentQuery);
|
|
8481
|
-
this.options = __privateGet(this, _client).defaultQueryOptions(options);
|
|
8482
|
-
if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveQueryBoolean(this.options.enabled, __privateGet(this, _currentQuery)) !== "boolean") {
|
|
8483
|
-
throw new Error(
|
|
8484
|
-
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
8485
|
-
);
|
|
8486
|
-
}
|
|
8487
|
-
__privateMethod(this, _QueryObserver_instances, updateQuery_fn).call(this);
|
|
8488
|
-
__privateGet(this, _currentQuery).setOptions(this.options);
|
|
8489
|
-
if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
|
|
8490
|
-
__privateGet(this, _client).getQueryCache().notify({
|
|
8491
|
-
type: "observerOptionsUpdated",
|
|
8492
|
-
query: __privateGet(this, _currentQuery),
|
|
8493
|
-
observer: this
|
|
8494
|
-
});
|
|
8495
|
-
}
|
|
8496
|
-
const mounted = this.hasListeners();
|
|
8497
|
-
if (mounted && shouldFetchOptionally(
|
|
8498
|
-
__privateGet(this, _currentQuery),
|
|
8499
|
-
prevQuery,
|
|
8500
|
-
this.options,
|
|
8501
|
-
prevOptions
|
|
8502
|
-
)) {
|
|
8503
|
-
__privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this);
|
|
8504
|
-
}
|
|
8505
|
-
this.updateResult();
|
|
8506
|
-
if (mounted && (__privateGet(this, _currentQuery) !== prevQuery || resolveQueryBoolean(this.options.enabled, __privateGet(this, _currentQuery)) !== resolveQueryBoolean(prevOptions.enabled, __privateGet(this, _currentQuery)) || resolveStaleTime(this.options.staleTime, __privateGet(this, _currentQuery)) !== resolveStaleTime(prevOptions.staleTime, __privateGet(this, _currentQuery)))) {
|
|
8507
|
-
__privateMethod(this, _QueryObserver_instances, updateStaleTimeout_fn).call(this);
|
|
8508
|
-
}
|
|
8509
|
-
const nextRefetchInterval = __privateMethod(this, _QueryObserver_instances, computeRefetchInterval_fn).call(this);
|
|
8510
|
-
if (mounted && (__privateGet(this, _currentQuery) !== prevQuery || resolveQueryBoolean(this.options.enabled, __privateGet(this, _currentQuery)) !== resolveQueryBoolean(prevOptions.enabled, __privateGet(this, _currentQuery)) || nextRefetchInterval !== __privateGet(this, _currentRefetchInterval))) {
|
|
8511
|
-
__privateMethod(this, _QueryObserver_instances, updateRefetchInterval_fn).call(this, nextRefetchInterval);
|
|
8512
|
-
}
|
|
8513
|
-
}
|
|
8514
|
-
getOptimisticResult(options) {
|
|
8515
|
-
const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), options);
|
|
8516
|
-
const result = this.createResult(query, options);
|
|
8517
|
-
if (shouldAssignObserverCurrentProperties(this, result)) {
|
|
8518
|
-
__privateSet(this, _currentResult, result);
|
|
8519
|
-
__privateSet(this, _currentResultOptions, this.options);
|
|
8520
|
-
__privateSet(this, _currentResultState, __privateGet(this, _currentQuery).state);
|
|
8521
|
-
}
|
|
8522
|
-
return result;
|
|
8523
|
-
}
|
|
8524
|
-
getCurrentResult() {
|
|
8525
|
-
return __privateGet(this, _currentResult);
|
|
8526
|
-
}
|
|
8527
|
-
trackResult(result, onPropTracked) {
|
|
8528
|
-
return new Proxy(result, {
|
|
8529
|
-
get: (target, key) => {
|
|
8530
|
-
this.trackProp(key);
|
|
8531
|
-
onPropTracked == null ? void 0 : onPropTracked(key);
|
|
8532
|
-
if (key === "promise") {
|
|
8533
|
-
this.trackProp("data");
|
|
8534
|
-
if (!this.options.experimental_prefetchInRender && __privateGet(this, _currentThenable).status === "pending") {
|
|
8535
|
-
__privateGet(this, _currentThenable).reject(
|
|
8536
|
-
new Error(
|
|
8537
|
-
"experimental_prefetchInRender feature flag is not enabled"
|
|
8538
|
-
)
|
|
8539
|
-
);
|
|
8540
|
-
}
|
|
8541
|
-
}
|
|
8542
|
-
return Reflect.get(target, key);
|
|
8543
|
-
}
|
|
8544
|
-
});
|
|
8545
|
-
}
|
|
8546
|
-
trackProp(key) {
|
|
8547
|
-
__privateGet(this, _trackedProps).add(key);
|
|
8548
|
-
}
|
|
8549
|
-
getCurrentQuery() {
|
|
8550
|
-
return __privateGet(this, _currentQuery);
|
|
8551
|
-
}
|
|
8552
|
-
refetch({ ...options } = {}) {
|
|
8553
|
-
return this.fetch({
|
|
8554
|
-
...options
|
|
8555
|
-
});
|
|
8556
|
-
}
|
|
8557
|
-
fetchOptimistic(options) {
|
|
8558
|
-
const defaultedOptions = __privateGet(this, _client).defaultQueryOptions(options);
|
|
8559
|
-
const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), defaultedOptions);
|
|
8560
|
-
return query.fetch().then(() => this.createResult(query, defaultedOptions));
|
|
8561
|
-
}
|
|
8562
|
-
fetch(fetchOptions) {
|
|
8563
|
-
return __privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this, {
|
|
8564
|
-
...fetchOptions,
|
|
8565
|
-
cancelRefetch: fetchOptions.cancelRefetch ?? true
|
|
8566
|
-
}).then(() => {
|
|
8567
|
-
this.updateResult();
|
|
8568
|
-
return __privateGet(this, _currentResult);
|
|
8569
|
-
});
|
|
8570
|
-
}
|
|
8571
|
-
createResult(query, options) {
|
|
8572
|
-
var _a2;
|
|
8573
|
-
const prevQuery = __privateGet(this, _currentQuery);
|
|
8574
|
-
const prevOptions = this.options;
|
|
8575
|
-
const prevResult = __privateGet(this, _currentResult);
|
|
8576
|
-
const prevResultState = __privateGet(this, _currentResultState);
|
|
8577
|
-
const prevResultOptions = __privateGet(this, _currentResultOptions);
|
|
8578
|
-
const queryChange = query !== prevQuery;
|
|
8579
|
-
const queryInitialState = queryChange ? query.state : __privateGet(this, _currentQueryInitialState);
|
|
8580
|
-
const { state } = query;
|
|
8581
|
-
let newState = { ...state };
|
|
8582
|
-
let isPlaceholderData = false;
|
|
8583
|
-
let data;
|
|
8584
|
-
if (options._optimisticResults) {
|
|
8585
|
-
const mounted = this.hasListeners();
|
|
8586
|
-
const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
|
|
8587
|
-
const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
|
|
8588
|
-
if (fetchOnMount || fetchOptionally) {
|
|
8589
|
-
newState = {
|
|
8590
|
-
...newState,
|
|
8591
|
-
...fetchState(state.data, query.options)
|
|
8592
|
-
};
|
|
8593
|
-
}
|
|
8594
|
-
if (options._optimisticResults === "isRestoring") {
|
|
8595
|
-
newState.fetchStatus = "idle";
|
|
8596
|
-
}
|
|
8597
|
-
}
|
|
8598
|
-
let { error: error2, errorUpdatedAt, status } = newState;
|
|
8599
|
-
data = newState.data;
|
|
8600
|
-
let skipSelect = false;
|
|
8601
|
-
if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
|
|
8602
|
-
let placeholderData;
|
|
8603
|
-
if ((prevResult == null ? void 0 : prevResult.isPlaceholderData) && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {
|
|
8604
|
-
placeholderData = prevResult.data;
|
|
8605
|
-
skipSelect = true;
|
|
8606
|
-
} else {
|
|
8607
|
-
placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
|
|
8608
|
-
(_a2 = __privateGet(this, _lastQueryWithDefinedData)) == null ? void 0 : _a2.state.data,
|
|
8609
|
-
__privateGet(this, _lastQueryWithDefinedData)
|
|
8610
|
-
) : options.placeholderData;
|
|
8611
|
-
}
|
|
8612
|
-
if (placeholderData !== void 0) {
|
|
8613
|
-
status = "success";
|
|
8614
|
-
data = replaceData(
|
|
8615
|
-
prevResult == null ? void 0 : prevResult.data,
|
|
8616
|
-
placeholderData,
|
|
8617
|
-
options
|
|
8618
|
-
);
|
|
8619
|
-
isPlaceholderData = true;
|
|
8620
|
-
}
|
|
8621
|
-
}
|
|
8622
|
-
if (options.select && data !== void 0 && !skipSelect) {
|
|
8623
|
-
if (prevResult && data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === __privateGet(this, _selectFn)) {
|
|
8624
|
-
data = __privateGet(this, _selectResult);
|
|
8625
|
-
} else {
|
|
8626
|
-
try {
|
|
8627
|
-
__privateSet(this, _selectFn, options.select);
|
|
8628
|
-
data = options.select(data);
|
|
8629
|
-
data = replaceData(prevResult == null ? void 0 : prevResult.data, data, options);
|
|
8630
|
-
__privateSet(this, _selectResult, data);
|
|
8631
|
-
__privateSet(this, _selectError, null);
|
|
8632
|
-
} catch (selectError) {
|
|
8633
|
-
__privateSet(this, _selectError, selectError);
|
|
8634
|
-
}
|
|
8635
|
-
}
|
|
8636
|
-
}
|
|
8637
|
-
if (__privateGet(this, _selectError)) {
|
|
8638
|
-
error2 = __privateGet(this, _selectError);
|
|
8639
|
-
data = __privateGet(this, _selectResult);
|
|
8640
|
-
errorUpdatedAt = Date.now();
|
|
8641
|
-
status = "error";
|
|
8642
|
-
}
|
|
8643
|
-
const isFetching = newState.fetchStatus === "fetching";
|
|
8644
|
-
const isPending = status === "pending";
|
|
8645
|
-
const isError = status === "error";
|
|
8646
|
-
const isLoading = isPending && isFetching;
|
|
8647
|
-
const hasData = data !== void 0;
|
|
8648
|
-
const result = {
|
|
8649
|
-
status,
|
|
8650
|
-
fetchStatus: newState.fetchStatus,
|
|
8651
|
-
isPending,
|
|
8652
|
-
isSuccess: status === "success",
|
|
8653
|
-
isError,
|
|
8654
|
-
isInitialLoading: isLoading,
|
|
8655
|
-
isLoading,
|
|
8656
|
-
data,
|
|
8657
|
-
dataUpdatedAt: newState.dataUpdatedAt,
|
|
8658
|
-
error: error2,
|
|
8659
|
-
errorUpdatedAt,
|
|
8660
|
-
failureCount: newState.fetchFailureCount,
|
|
8661
|
-
failureReason: newState.fetchFailureReason,
|
|
8662
|
-
errorUpdateCount: newState.errorUpdateCount,
|
|
8663
|
-
isFetched: query.isFetched(),
|
|
8664
|
-
isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
8665
|
-
isFetching,
|
|
8666
|
-
isRefetching: isFetching && !isPending,
|
|
8667
|
-
isLoadingError: isError && !hasData,
|
|
8668
|
-
isPaused: newState.fetchStatus === "paused",
|
|
8669
|
-
isPlaceholderData,
|
|
8670
|
-
isRefetchError: isError && hasData,
|
|
8671
|
-
isStale: isStale(query, options),
|
|
8672
|
-
refetch: this.refetch,
|
|
8673
|
-
promise: __privateGet(this, _currentThenable),
|
|
8674
|
-
isEnabled: resolveQueryBoolean(options.enabled, query) !== false
|
|
8675
|
-
};
|
|
8676
|
-
const nextResult = result;
|
|
8677
|
-
if (this.options.experimental_prefetchInRender) {
|
|
8678
|
-
const hasResultData = nextResult.data !== void 0;
|
|
8679
|
-
const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
|
|
8680
|
-
const finalizeThenableIfPossible = (thenable) => {
|
|
8681
|
-
if (isErrorWithoutData) {
|
|
8682
|
-
thenable.reject(nextResult.error);
|
|
8683
|
-
} else if (hasResultData) {
|
|
8684
|
-
thenable.resolve(nextResult.data);
|
|
8685
|
-
}
|
|
8686
|
-
};
|
|
8687
|
-
const recreateThenable = () => {
|
|
8688
|
-
const pending = __privateSet(this, _currentThenable, nextResult.promise = pendingThenable());
|
|
8689
|
-
finalizeThenableIfPossible(pending);
|
|
8690
|
-
};
|
|
8691
|
-
const prevThenable = __privateGet(this, _currentThenable);
|
|
8692
|
-
switch (prevThenable.status) {
|
|
8693
|
-
case "pending":
|
|
8694
|
-
if (query.queryHash === prevQuery.queryHash) {
|
|
8695
|
-
finalizeThenableIfPossible(prevThenable);
|
|
8696
|
-
}
|
|
8697
|
-
break;
|
|
8698
|
-
case "fulfilled":
|
|
8699
|
-
if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
|
|
8700
|
-
recreateThenable();
|
|
8701
|
-
}
|
|
8702
|
-
break;
|
|
8703
|
-
case "rejected":
|
|
8704
|
-
if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
|
|
8705
|
-
recreateThenable();
|
|
8706
|
-
}
|
|
8707
|
-
break;
|
|
8708
|
-
}
|
|
8709
|
-
}
|
|
8710
|
-
return nextResult;
|
|
8711
|
-
}
|
|
8712
|
-
updateResult() {
|
|
8713
|
-
const prevResult = __privateGet(this, _currentResult);
|
|
8714
|
-
const nextResult = this.createResult(__privateGet(this, _currentQuery), this.options);
|
|
8715
|
-
__privateSet(this, _currentResultState, __privateGet(this, _currentQuery).state);
|
|
8716
|
-
__privateSet(this, _currentResultOptions, this.options);
|
|
8717
|
-
if (__privateGet(this, _currentResultState).data !== void 0) {
|
|
8718
|
-
__privateSet(this, _lastQueryWithDefinedData, __privateGet(this, _currentQuery));
|
|
8719
|
-
}
|
|
8720
|
-
if (shallowEqualObjects(nextResult, prevResult)) {
|
|
8721
|
-
return;
|
|
8722
|
-
}
|
|
8723
|
-
__privateSet(this, _currentResult, nextResult);
|
|
8724
|
-
const shouldNotifyListeners = () => {
|
|
8725
|
-
if (!prevResult) {
|
|
8726
|
-
return true;
|
|
8727
|
-
}
|
|
8728
|
-
const { notifyOnChangeProps } = this.options;
|
|
8729
|
-
const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
|
|
8730
|
-
if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !__privateGet(this, _trackedProps).size) {
|
|
8731
|
-
return true;
|
|
8732
|
-
}
|
|
8733
|
-
const includedProps = new Set(
|
|
8734
|
-
notifyOnChangePropsValue ?? __privateGet(this, _trackedProps)
|
|
8735
|
-
);
|
|
8736
|
-
if (this.options.throwOnError) {
|
|
8737
|
-
includedProps.add("error");
|
|
8738
|
-
}
|
|
8739
|
-
return Object.keys(__privateGet(this, _currentResult)).some((key) => {
|
|
8740
|
-
const typedKey = key;
|
|
8741
|
-
const changed = __privateGet(this, _currentResult)[typedKey] !== prevResult[typedKey];
|
|
8742
|
-
return changed && includedProps.has(typedKey);
|
|
8743
|
-
});
|
|
8744
|
-
};
|
|
8745
|
-
__privateMethod(this, _QueryObserver_instances, notify_fn).call(this, { listeners: shouldNotifyListeners() });
|
|
8746
|
-
}
|
|
8747
|
-
onQueryUpdate() {
|
|
8748
|
-
this.updateResult();
|
|
8749
|
-
if (this.hasListeners()) {
|
|
8750
|
-
__privateMethod(this, _QueryObserver_instances, updateTimers_fn).call(this);
|
|
8751
|
-
}
|
|
8752
|
-
}
|
|
8753
|
-
}, _client = new WeakMap(), _currentQuery = new WeakMap(), _currentQueryInitialState = new WeakMap(), _currentResult = new WeakMap(), _currentResultState = new WeakMap(), _currentResultOptions = new WeakMap(), _currentThenable = new WeakMap(), _selectError = new WeakMap(), _selectFn = new WeakMap(), _selectResult = new WeakMap(), _lastQueryWithDefinedData = new WeakMap(), _staleTimeoutId = new WeakMap(), _refetchIntervalId = new WeakMap(), _currentRefetchInterval = new WeakMap(), _trackedProps = new WeakMap(), _QueryObserver_instances = new WeakSet(), executeFetch_fn = function(fetchOptions) {
|
|
8754
|
-
__privateMethod(this, _QueryObserver_instances, updateQuery_fn).call(this);
|
|
8755
|
-
let promise = __privateGet(this, _currentQuery).fetch(
|
|
8756
|
-
this.options,
|
|
8757
|
-
fetchOptions
|
|
8758
|
-
);
|
|
8759
|
-
if (!(fetchOptions == null ? void 0 : fetchOptions.throwOnError)) {
|
|
8760
|
-
promise = promise.catch(noop);
|
|
8761
|
-
}
|
|
8762
|
-
return promise;
|
|
8763
|
-
}, updateStaleTimeout_fn = function() {
|
|
8764
|
-
__privateMethod(this, _QueryObserver_instances, clearStaleTimeout_fn).call(this);
|
|
8765
|
-
const staleTime = resolveStaleTime(
|
|
8766
|
-
this.options.staleTime,
|
|
8767
|
-
__privateGet(this, _currentQuery)
|
|
8768
|
-
);
|
|
8769
|
-
if (environmentManager.isServer() || __privateGet(this, _currentResult).isStale || !isValidTimeout(staleTime)) {
|
|
8770
|
-
return;
|
|
8771
|
-
}
|
|
8772
|
-
const time = timeUntilStale(__privateGet(this, _currentResult).dataUpdatedAt, staleTime);
|
|
8773
|
-
const timeout = time + 1;
|
|
8774
|
-
__privateSet(this, _staleTimeoutId, timeoutManager.setTimeout(() => {
|
|
8775
|
-
if (!__privateGet(this, _currentResult).isStale) {
|
|
8776
|
-
this.updateResult();
|
|
8777
|
-
}
|
|
8778
|
-
}, timeout));
|
|
8779
|
-
}, computeRefetchInterval_fn = function() {
|
|
8780
|
-
return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(__privateGet(this, _currentQuery)) : this.options.refetchInterval) ?? false;
|
|
8781
|
-
}, updateRefetchInterval_fn = function(nextInterval) {
|
|
8782
|
-
__privateMethod(this, _QueryObserver_instances, clearRefetchInterval_fn).call(this);
|
|
8783
|
-
__privateSet(this, _currentRefetchInterval, nextInterval);
|
|
8784
|
-
if (environmentManager.isServer() || resolveQueryBoolean(this.options.enabled, __privateGet(this, _currentQuery)) === false || !isValidTimeout(__privateGet(this, _currentRefetchInterval)) || __privateGet(this, _currentRefetchInterval) === 0) {
|
|
8785
|
-
return;
|
|
8786
|
-
}
|
|
8787
|
-
__privateSet(this, _refetchIntervalId, timeoutManager.setInterval(() => {
|
|
8788
|
-
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
8789
|
-
__privateMethod(this, _QueryObserver_instances, executeFetch_fn).call(this);
|
|
8790
|
-
}
|
|
8791
|
-
}, __privateGet(this, _currentRefetchInterval)));
|
|
8792
|
-
}, updateTimers_fn = function() {
|
|
8793
|
-
__privateMethod(this, _QueryObserver_instances, updateStaleTimeout_fn).call(this);
|
|
8794
|
-
__privateMethod(this, _QueryObserver_instances, updateRefetchInterval_fn).call(this, __privateMethod(this, _QueryObserver_instances, computeRefetchInterval_fn).call(this));
|
|
8795
|
-
}, clearStaleTimeout_fn = function() {
|
|
8796
|
-
if (__privateGet(this, _staleTimeoutId) !== void 0) {
|
|
8797
|
-
timeoutManager.clearTimeout(__privateGet(this, _staleTimeoutId));
|
|
8798
|
-
__privateSet(this, _staleTimeoutId, void 0);
|
|
8799
|
-
}
|
|
8800
|
-
}, clearRefetchInterval_fn = function() {
|
|
8801
|
-
if (__privateGet(this, _refetchIntervalId) !== void 0) {
|
|
8802
|
-
timeoutManager.clearInterval(__privateGet(this, _refetchIntervalId));
|
|
8803
|
-
__privateSet(this, _refetchIntervalId, void 0);
|
|
8804
|
-
}
|
|
8805
|
-
}, updateQuery_fn = function() {
|
|
8806
|
-
const query = __privateGet(this, _client).getQueryCache().build(__privateGet(this, _client), this.options);
|
|
8807
|
-
if (query === __privateGet(this, _currentQuery)) {
|
|
8808
|
-
return;
|
|
8809
|
-
}
|
|
8810
|
-
const prevQuery = __privateGet(this, _currentQuery);
|
|
8811
|
-
__privateSet(this, _currentQuery, query);
|
|
8812
|
-
__privateSet(this, _currentQueryInitialState, query.state);
|
|
8813
|
-
if (this.hasListeners()) {
|
|
8814
|
-
prevQuery == null ? void 0 : prevQuery.removeObserver(this);
|
|
8815
|
-
query.addObserver(this);
|
|
8816
|
-
}
|
|
8817
|
-
}, notify_fn = function(notifyOptions) {
|
|
8818
|
-
notifyManager.batch(() => {
|
|
8819
|
-
if (notifyOptions.listeners) {
|
|
8820
|
-
this.listeners.forEach((listener) => {
|
|
8821
|
-
listener(__privateGet(this, _currentResult));
|
|
8822
|
-
});
|
|
8823
|
-
}
|
|
8824
|
-
__privateGet(this, _client).getQueryCache().notify({
|
|
8825
|
-
query: __privateGet(this, _currentQuery),
|
|
8826
|
-
type: "observerResultsUpdated"
|
|
8827
|
-
});
|
|
8828
|
-
});
|
|
8829
|
-
}, _d);
|
|
8830
|
-
function shouldLoadOnMount(query, options) {
|
|
8831
|
-
return resolveQueryBoolean(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && resolveQueryBoolean(options.retryOnMount, query) === false);
|
|
8832
|
-
}
|
|
8833
|
-
function shouldFetchOnMount(query, options) {
|
|
8834
|
-
return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
|
|
8835
|
-
}
|
|
8836
|
-
function shouldFetchOn(query, options, field) {
|
|
8837
|
-
if (resolveQueryBoolean(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
|
|
8838
|
-
const value = typeof field === "function" ? field(query) : field;
|
|
8839
|
-
return value === "always" || value !== false && isStale(query, options);
|
|
8840
|
-
}
|
|
8841
|
-
return false;
|
|
8842
|
-
}
|
|
8843
|
-
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
8844
|
-
return (query !== prevQuery || resolveQueryBoolean(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
|
|
8845
|
-
}
|
|
8846
|
-
function isStale(query, options) {
|
|
8847
|
-
return resolveQueryBoolean(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
|
|
8848
|
-
}
|
|
8849
|
-
function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
8850
|
-
if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
|
|
8851
|
-
return true;
|
|
8852
|
-
}
|
|
8853
|
-
return false;
|
|
8854
|
-
}
|
|
8855
|
-
function getDefaultState() {
|
|
8856
|
-
return {
|
|
8857
|
-
context: void 0,
|
|
8858
|
-
data: void 0,
|
|
8859
|
-
error: null,
|
|
8860
|
-
failureCount: 0,
|
|
8861
|
-
failureReason: null,
|
|
8862
|
-
isPaused: false,
|
|
8863
|
-
status: "idle",
|
|
8864
|
-
variables: void 0,
|
|
8865
|
-
submittedAt: 0
|
|
8866
|
-
};
|
|
8867
|
-
}
|
|
8868
|
-
var MutationObserver = (_e = class extends Subscribable {
|
|
8869
|
-
constructor(client, options) {
|
|
8870
|
-
super();
|
|
8871
|
-
__privateAdd(this, _MutationObserver_instances);
|
|
8872
|
-
__privateAdd(this, _client2);
|
|
8873
|
-
__privateAdd(this, _currentResult2);
|
|
8874
|
-
__privateAdd(this, _currentMutation);
|
|
8875
|
-
__privateAdd(this, _mutateOptions);
|
|
8876
|
-
__privateSet(this, _client2, client);
|
|
8877
|
-
this.setOptions(options);
|
|
8878
|
-
this.bindMethods();
|
|
8879
|
-
__privateMethod(this, _MutationObserver_instances, updateResult_fn).call(this);
|
|
8880
|
-
}
|
|
8881
|
-
bindMethods() {
|
|
8882
|
-
this.mutate = this.mutate.bind(this);
|
|
8883
|
-
this.reset = this.reset.bind(this);
|
|
8884
|
-
}
|
|
8885
|
-
setOptions(options) {
|
|
8886
|
-
var _a2;
|
|
8887
|
-
const prevOptions = this.options;
|
|
8888
|
-
this.options = __privateGet(this, _client2).defaultMutationOptions(options);
|
|
8889
|
-
if (!shallowEqualObjects(this.options, prevOptions)) {
|
|
8890
|
-
__privateGet(this, _client2).getMutationCache().notify({
|
|
8891
|
-
type: "observerOptionsUpdated",
|
|
8892
|
-
mutation: __privateGet(this, _currentMutation),
|
|
8893
|
-
observer: this
|
|
8894
|
-
});
|
|
8895
|
-
}
|
|
8896
|
-
if ((prevOptions == null ? void 0 : prevOptions.mutationKey) && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) {
|
|
8897
|
-
this.reset();
|
|
8898
|
-
} else if (((_a2 = __privateGet(this, _currentMutation)) == null ? void 0 : _a2.state.status) === "pending") {
|
|
8899
|
-
__privateGet(this, _currentMutation).setOptions(this.options);
|
|
8900
|
-
}
|
|
8901
|
-
}
|
|
8902
|
-
onUnsubscribe() {
|
|
8903
|
-
var _a2;
|
|
8904
|
-
if (!this.hasListeners()) {
|
|
8905
|
-
(_a2 = __privateGet(this, _currentMutation)) == null ? void 0 : _a2.removeObserver(this);
|
|
8906
|
-
}
|
|
8907
|
-
}
|
|
8908
|
-
onMutationUpdate(action) {
|
|
8909
|
-
__privateMethod(this, _MutationObserver_instances, updateResult_fn).call(this);
|
|
8910
|
-
__privateMethod(this, _MutationObserver_instances, notify_fn2).call(this, action);
|
|
8911
|
-
}
|
|
8912
|
-
getCurrentResult() {
|
|
8913
|
-
return __privateGet(this, _currentResult2);
|
|
8914
|
-
}
|
|
8915
|
-
reset() {
|
|
8916
|
-
var _a2;
|
|
8917
|
-
(_a2 = __privateGet(this, _currentMutation)) == null ? void 0 : _a2.removeObserver(this);
|
|
8918
|
-
__privateSet(this, _currentMutation, void 0);
|
|
8919
|
-
__privateMethod(this, _MutationObserver_instances, updateResult_fn).call(this);
|
|
8920
|
-
__privateMethod(this, _MutationObserver_instances, notify_fn2).call(this);
|
|
8921
|
-
}
|
|
8922
|
-
mutate(variables, options) {
|
|
8923
|
-
var _a2;
|
|
8924
|
-
__privateSet(this, _mutateOptions, options);
|
|
8925
|
-
(_a2 = __privateGet(this, _currentMutation)) == null ? void 0 : _a2.removeObserver(this);
|
|
8926
|
-
__privateSet(this, _currentMutation, __privateGet(this, _client2).getMutationCache().build(__privateGet(this, _client2), this.options));
|
|
8927
|
-
__privateGet(this, _currentMutation).addObserver(this);
|
|
8928
|
-
return __privateGet(this, _currentMutation).execute(variables);
|
|
8929
|
-
}
|
|
8930
|
-
}, _client2 = new WeakMap(), _currentResult2 = new WeakMap(), _currentMutation = new WeakMap(), _mutateOptions = new WeakMap(), _MutationObserver_instances = new WeakSet(), updateResult_fn = function() {
|
|
8931
|
-
var _a2;
|
|
8932
|
-
const state = ((_a2 = __privateGet(this, _currentMutation)) == null ? void 0 : _a2.state) ?? getDefaultState();
|
|
8933
|
-
__privateSet(this, _currentResult2, {
|
|
8934
|
-
...state,
|
|
8935
|
-
isPending: state.status === "pending",
|
|
8936
|
-
isSuccess: state.status === "success",
|
|
8937
|
-
isError: state.status === "error",
|
|
8938
|
-
isIdle: state.status === "idle",
|
|
8939
|
-
mutate: this.mutate,
|
|
8940
|
-
reset: this.reset
|
|
8941
|
-
});
|
|
8942
|
-
}, notify_fn2 = function(action) {
|
|
8943
|
-
notifyManager.batch(() => {
|
|
8944
|
-
var _a2, _b2, _c2, _d2, _e2, _f, _g, _h;
|
|
8945
|
-
if (__privateGet(this, _mutateOptions) && this.hasListeners()) {
|
|
8946
|
-
const variables = __privateGet(this, _currentResult2).variables;
|
|
8947
|
-
const onMutateResult = __privateGet(this, _currentResult2).context;
|
|
8948
|
-
const context = {
|
|
8949
|
-
client: __privateGet(this, _client2),
|
|
8950
|
-
meta: this.options.meta,
|
|
8951
|
-
mutationKey: this.options.mutationKey
|
|
8952
|
-
};
|
|
8953
|
-
if ((action == null ? void 0 : action.type) === "success") {
|
|
8954
|
-
try {
|
|
8955
|
-
(_b2 = (_a2 = __privateGet(this, _mutateOptions)).onSuccess) == null ? void 0 : _b2.call(
|
|
8956
|
-
_a2,
|
|
8957
|
-
action.data,
|
|
8958
|
-
variables,
|
|
8959
|
-
onMutateResult,
|
|
8960
|
-
context
|
|
8961
|
-
);
|
|
8962
|
-
} catch (e) {
|
|
8963
|
-
void Promise.reject(e);
|
|
8964
|
-
}
|
|
8965
|
-
try {
|
|
8966
|
-
(_d2 = (_c2 = __privateGet(this, _mutateOptions)).onSettled) == null ? void 0 : _d2.call(
|
|
8967
|
-
_c2,
|
|
8968
|
-
action.data,
|
|
8969
|
-
null,
|
|
8970
|
-
variables,
|
|
8971
|
-
onMutateResult,
|
|
8972
|
-
context
|
|
8973
|
-
);
|
|
8974
|
-
} catch (e) {
|
|
8975
|
-
void Promise.reject(e);
|
|
8976
|
-
}
|
|
8977
|
-
} else if ((action == null ? void 0 : action.type) === "error") {
|
|
8978
|
-
try {
|
|
8979
|
-
(_f = (_e2 = __privateGet(this, _mutateOptions)).onError) == null ? void 0 : _f.call(
|
|
8980
|
-
_e2,
|
|
8981
|
-
action.error,
|
|
8982
|
-
variables,
|
|
8983
|
-
onMutateResult,
|
|
8984
|
-
context
|
|
8985
|
-
);
|
|
8986
|
-
} catch (e) {
|
|
8987
|
-
void Promise.reject(e);
|
|
8988
|
-
}
|
|
8989
|
-
try {
|
|
8990
|
-
(_h = (_g = __privateGet(this, _mutateOptions)).onSettled) == null ? void 0 : _h.call(
|
|
8991
|
-
_g,
|
|
8992
|
-
void 0,
|
|
8993
|
-
action.error,
|
|
8994
|
-
variables,
|
|
8995
|
-
onMutateResult,
|
|
8996
|
-
context
|
|
8997
|
-
);
|
|
8998
|
-
} catch (e) {
|
|
8999
|
-
void Promise.reject(e);
|
|
9000
|
-
}
|
|
9001
|
-
}
|
|
9002
|
-
}
|
|
9003
|
-
this.listeners.forEach((listener) => {
|
|
9004
|
-
listener(__privateGet(this, _currentResult2));
|
|
9005
|
-
});
|
|
9006
|
-
});
|
|
9007
|
-
}, _e);
|
|
9008
|
-
var QueryClientContext = React.createContext(
|
|
9009
|
-
void 0
|
|
9010
|
-
);
|
|
9011
|
-
var useQueryClient = (queryClient) => {
|
|
9012
|
-
const client = React.useContext(QueryClientContext);
|
|
9013
|
-
if (!client) {
|
|
9014
|
-
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
9015
|
-
}
|
|
9016
|
-
return client;
|
|
9017
|
-
};
|
|
9018
|
-
var IsRestoringContext = React.createContext(false);
|
|
9019
|
-
var useIsRestoring = () => React.useContext(IsRestoringContext);
|
|
9020
|
-
function createValue() {
|
|
9021
|
-
let isReset = false;
|
|
9022
|
-
return {
|
|
9023
|
-
clearReset: () => {
|
|
9024
|
-
isReset = false;
|
|
9025
|
-
},
|
|
9026
|
-
reset: () => {
|
|
9027
|
-
isReset = true;
|
|
9028
|
-
},
|
|
9029
|
-
isReset: () => {
|
|
9030
|
-
return isReset;
|
|
9031
|
-
}
|
|
9032
|
-
};
|
|
9033
|
-
}
|
|
9034
|
-
var QueryErrorResetBoundaryContext = React.createContext(createValue());
|
|
9035
|
-
var useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext);
|
|
9036
|
-
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
|
|
9037
|
-
const throwOnError = (query == null ? void 0 : query.state.error) && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
|
|
9038
|
-
if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
|
|
9039
|
-
if (!errorResetBoundary.isReset()) {
|
|
9040
|
-
options.retryOnMount = false;
|
|
9041
|
-
}
|
|
9042
|
-
}
|
|
9043
|
-
};
|
|
9044
|
-
var useClearResetErrorBoundary = (errorResetBoundary) => {
|
|
9045
|
-
React.useEffect(() => {
|
|
9046
|
-
errorResetBoundary.clearReset();
|
|
9047
|
-
}, [errorResetBoundary]);
|
|
9048
|
-
};
|
|
9049
|
-
var getHasError = ({
|
|
9050
|
-
result,
|
|
9051
|
-
errorResetBoundary,
|
|
9052
|
-
throwOnError,
|
|
9053
|
-
query,
|
|
9054
|
-
suspense
|
|
9055
|
-
}) => {
|
|
9056
|
-
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
|
|
9057
|
-
};
|
|
9058
|
-
var ensureSuspenseTimers = (defaultedOptions) => {
|
|
9059
|
-
if (defaultedOptions.suspense) {
|
|
9060
|
-
const MIN_SUSPENSE_TIME_MS = 1e3;
|
|
9061
|
-
const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
|
|
9062
|
-
const originalStaleTime = defaultedOptions.staleTime;
|
|
9063
|
-
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
|
|
9064
|
-
if (typeof defaultedOptions.gcTime === "number") {
|
|
9065
|
-
defaultedOptions.gcTime = Math.max(
|
|
9066
|
-
defaultedOptions.gcTime,
|
|
9067
|
-
MIN_SUSPENSE_TIME_MS
|
|
9068
|
-
);
|
|
9069
|
-
}
|
|
9070
|
-
}
|
|
9071
|
-
};
|
|
9072
|
-
var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
|
|
9073
|
-
var shouldSuspend = (defaultedOptions, result) => (defaultedOptions == null ? void 0 : defaultedOptions.suspense) && result.isPending;
|
|
9074
|
-
var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
|
|
9075
|
-
errorResetBoundary.clearReset();
|
|
9076
|
-
});
|
|
9077
|
-
function useBaseQuery(options, Observer, queryClient) {
|
|
9078
|
-
var _a2, _b2, _c2, _d2;
|
|
9079
|
-
if (process.env.NODE_ENV !== "production") {
|
|
9080
|
-
if (typeof options !== "object" || Array.isArray(options)) {
|
|
9081
|
-
throw new Error(
|
|
9082
|
-
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
9083
|
-
);
|
|
9084
|
-
}
|
|
9085
|
-
}
|
|
9086
|
-
const isRestoring = useIsRestoring();
|
|
9087
|
-
const errorResetBoundary = useQueryErrorResetBoundary();
|
|
9088
|
-
const client = useQueryClient();
|
|
9089
|
-
const defaultedOptions = client.defaultQueryOptions(options);
|
|
9090
|
-
(_b2 = (_a2 = client.getDefaultOptions().queries) == null ? void 0 : _a2._experimental_beforeQuery) == null ? void 0 : _b2.call(
|
|
9091
|
-
_a2,
|
|
9092
|
-
defaultedOptions
|
|
9093
|
-
);
|
|
9094
|
-
const query = client.getQueryCache().get(defaultedOptions.queryHash);
|
|
9095
|
-
if (process.env.NODE_ENV !== "production") {
|
|
9096
|
-
if (!defaultedOptions.queryFn) {
|
|
9097
|
-
console.error(
|
|
9098
|
-
`[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
|
|
9099
|
-
);
|
|
9100
|
-
}
|
|
9101
|
-
}
|
|
9102
|
-
const subscribed = options.subscribed !== false;
|
|
9103
|
-
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : subscribed ? "optimistic" : void 0;
|
|
9104
|
-
ensureSuspenseTimers(defaultedOptions);
|
|
9105
|
-
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
|
|
9106
|
-
useClearResetErrorBoundary(errorResetBoundary);
|
|
9107
|
-
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
|
|
9108
|
-
const [observer] = React.useState(
|
|
9109
|
-
() => new Observer(
|
|
9110
|
-
client,
|
|
9111
|
-
defaultedOptions
|
|
9112
|
-
)
|
|
9113
|
-
);
|
|
9114
|
-
const result = observer.getOptimisticResult(defaultedOptions);
|
|
9115
|
-
const shouldSubscribe = !isRestoring && subscribed;
|
|
9116
|
-
React.useSyncExternalStore(
|
|
9117
|
-
React.useCallback(
|
|
9118
|
-
(onStoreChange) => {
|
|
9119
|
-
const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;
|
|
9120
|
-
observer.updateResult();
|
|
9121
|
-
return unsubscribe;
|
|
9122
|
-
},
|
|
9123
|
-
[observer, shouldSubscribe]
|
|
9124
|
-
),
|
|
9125
|
-
() => observer.getCurrentResult(),
|
|
9126
|
-
() => observer.getCurrentResult()
|
|
9127
|
-
);
|
|
9128
|
-
React.useEffect(() => {
|
|
9129
|
-
observer.setOptions(defaultedOptions);
|
|
9130
|
-
}, [defaultedOptions, observer]);
|
|
9131
|
-
if (shouldSuspend(defaultedOptions, result)) {
|
|
9132
|
-
throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
|
|
9133
|
-
}
|
|
9134
|
-
if (getHasError({
|
|
9135
|
-
result,
|
|
9136
|
-
errorResetBoundary,
|
|
9137
|
-
throwOnError: defaultedOptions.throwOnError,
|
|
9138
|
-
query,
|
|
9139
|
-
suspense: defaultedOptions.suspense
|
|
9140
|
-
})) {
|
|
9141
|
-
throw result.error;
|
|
9142
|
-
}
|
|
9143
|
-
(_d2 = (_c2 = client.getDefaultOptions().queries) == null ? void 0 : _c2._experimental_afterQuery) == null ? void 0 : _d2.call(
|
|
9144
|
-
_c2,
|
|
9145
|
-
defaultedOptions,
|
|
9146
|
-
result
|
|
9147
|
-
);
|
|
9148
|
-
if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {
|
|
9149
|
-
const promise = isNewCacheEntry ? (
|
|
9150
|
-
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
9151
|
-
fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
|
|
9152
|
-
) : (
|
|
9153
|
-
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
9154
|
-
query == null ? void 0 : query.promise
|
|
9155
|
-
);
|
|
9156
|
-
promise == null ? void 0 : promise.catch(noop).finally(() => {
|
|
9157
|
-
observer.updateResult();
|
|
9158
|
-
});
|
|
9159
|
-
}
|
|
9160
|
-
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
|
|
9161
|
-
}
|
|
9162
|
-
function useQuery(options, queryClient) {
|
|
9163
|
-
return useBaseQuery(options, QueryObserver);
|
|
9164
|
-
}
|
|
9165
|
-
function useMutation(options, queryClient) {
|
|
9166
|
-
const client = useQueryClient();
|
|
9167
|
-
const [observer] = React.useState(
|
|
9168
|
-
() => new MutationObserver(
|
|
9169
|
-
client,
|
|
9170
|
-
options
|
|
9171
|
-
)
|
|
9172
|
-
);
|
|
9173
|
-
React.useEffect(() => {
|
|
9174
|
-
observer.setOptions(options);
|
|
9175
|
-
}, [observer, options]);
|
|
9176
|
-
const result = React.useSyncExternalStore(
|
|
9177
|
-
React.useCallback(
|
|
9178
|
-
(onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)),
|
|
9179
|
-
[observer]
|
|
9180
|
-
),
|
|
9181
|
-
() => observer.getCurrentResult(),
|
|
9182
|
-
() => observer.getCurrentResult()
|
|
9183
|
-
);
|
|
9184
|
-
const mutate = React.useCallback(
|
|
9185
|
-
(variables, mutateOptions) => {
|
|
9186
|
-
observer.mutate(variables, mutateOptions).catch(noop);
|
|
9187
|
-
},
|
|
9188
|
-
[observer]
|
|
9189
|
-
);
|
|
9190
|
-
if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) {
|
|
9191
|
-
throw result.error;
|
|
9192
|
-
}
|
|
9193
|
-
return { ...result, mutate, mutateAsync: result.mutate };
|
|
9194
|
-
}
|
|
9195
7943
|
const LibraryContext = createContext(null);
|
|
9196
7944
|
const LibraryProvider = ({
|
|
9197
7945
|
children,
|
|
@@ -9206,7 +7954,7 @@ const useLibraryContext = () => {
|
|
|
9206
7954
|
}
|
|
9207
7955
|
return context;
|
|
9208
7956
|
};
|
|
9209
|
-
const
|
|
7957
|
+
const useFApiMutation = (url, config, options) => {
|
|
9210
7958
|
const { apiService } = useLibraryContext();
|
|
9211
7959
|
const queryClient = useQueryClient();
|
|
9212
7960
|
const mutation = useMutation({
|
|
@@ -9233,11 +7981,11 @@ const useApiMutation = (url, config, options) => {
|
|
|
9233
7981
|
},
|
|
9234
7982
|
...options,
|
|
9235
7983
|
onSuccess: (...args) => {
|
|
9236
|
-
var
|
|
7984
|
+
var _a;
|
|
9237
7985
|
if (options == null ? void 0 : options.queryKeyToInvalidate) {
|
|
9238
7986
|
queryClient.invalidateQueries({ queryKey: options.queryKeyToInvalidate });
|
|
9239
7987
|
}
|
|
9240
|
-
(
|
|
7988
|
+
(_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, ...args);
|
|
9241
7989
|
}
|
|
9242
7990
|
});
|
|
9243
7991
|
const customMutate = (data, urlParams, mutateOptions) => {
|
|
@@ -9327,7 +8075,7 @@ function useNotificationEffects(options, state) {
|
|
|
9327
8075
|
}
|
|
9328
8076
|
}, [state.isSuccess, onSuccessNotification, successNotificationTitle, successNotificationBody]);
|
|
9329
8077
|
}
|
|
9330
|
-
const
|
|
8078
|
+
const useFApiQuery = (queryKey, url, config, options) => {
|
|
9331
8079
|
const { apiService } = useLibraryContext();
|
|
9332
8080
|
const {
|
|
9333
8081
|
onErrorNotification = false,
|
|
@@ -9400,7 +8148,7 @@ const useApiQuery = (queryKey, url, config, options) => {
|
|
|
9400
8148
|
}, [query.isLoading, onLoadingLog, loadingNotificationTitle, loadingNotificationBody]);
|
|
9401
8149
|
return query;
|
|
9402
8150
|
};
|
|
9403
|
-
function
|
|
8151
|
+
function useFManualApiQuery(queryKey, url, initialParams, config, options) {
|
|
9404
8152
|
const { apiService } = useLibraryContext();
|
|
9405
8153
|
const queryClient = useQueryClient();
|
|
9406
8154
|
const [params, setParams] = useState(initialParams);
|
|
@@ -9456,7 +8204,7 @@ function useManualApiQuery(queryKey, url, initialParams, config, options) {
|
|
|
9456
8204
|
}, [onErrorNotification, notificationTitle, notificationBody, onErrorLog]);
|
|
9457
8205
|
useEffect(() => {
|
|
9458
8206
|
if (onLoadingLog && query.isFetching) {
|
|
9459
|
-
console.log(`[
|
|
8207
|
+
console.log(`[useFManualApiQuery] Loading: ${url}`);
|
|
9460
8208
|
}
|
|
9461
8209
|
}, [query.isFetching, onLoadingLog, url]);
|
|
9462
8210
|
const run = useCallback(async ({
|
|
@@ -9679,9 +8427,9 @@ export {
|
|
|
9679
8427
|
fNotification,
|
|
9680
8428
|
fNotificationDelete,
|
|
9681
8429
|
fPrompt,
|
|
9682
|
-
useApiMutation,
|
|
9683
|
-
useApiQuery,
|
|
9684
8430
|
useFApi,
|
|
9685
|
-
|
|
8431
|
+
useFApiMutation,
|
|
8432
|
+
useFApiQuery,
|
|
8433
|
+
useFManualApiQuery
|
|
9686
8434
|
};
|
|
9687
8435
|
//# sourceMappingURL=f-ui-kit.es.js.map
|