fui-material 2.6.13 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/f-ui-kit.es.js +1625 -70
- 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 +14 -0
- package/dist/types/context/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +3 -0
- package/dist/types/hooks/types.d.ts +13 -0
- package/dist/types/hooks/useApiMutation/index.d.ts +1 -0
- package/dist/types/hooks/useApiMutation/useApiMutation.d.ts +75 -0
- package/dist/types/hooks/useApiQuery/index.d.ts +1 -0
- package/dist/types/hooks/useApiQuery/useApiQuery.d.ts +38 -0
- package/dist/types/hooks/useManualApiQuery/index.d.ts +1 -0
- package/dist/types/hooks/useManualApiQuery/useManualApiQuery.d.ts +65 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +81 -80
package/dist/f-ui-kit.es.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
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;
|
|
1
10
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import React__default, { forwardRef, useRef, useState, useEffect, useMemo, useCallback, useLayoutEffect, Fragment as Fragment$1, isValidElement, cloneElement, useDeferredValue, createContext, useContext } from "react";
|
|
3
13
|
import ReactDOM, { createPortal } from "react-dom";
|
|
4
14
|
import JSZip from "jszip";
|
|
5
15
|
import initializeModule from "allorion-exporting-html-to-docx";
|
|
6
16
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
7
17
|
import { initializeModule as initializeModule$1, installFormatCode } from "allorion-exporting-html-to-xlsx";
|
|
8
18
|
import axios from "axios";
|
|
9
|
-
|
|
19
|
+
const btn = "_btn_ch6o3_1";
|
|
10
20
|
const stylesBtn = {
|
|
11
21
|
btn,
|
|
12
22
|
"btn-xs": "_btn-xs_ch6o3_21",
|
|
@@ -68,7 +78,7 @@ const defaultStyles = {
|
|
|
68
78
|
"f-button-file": "_f-button-file_i2hex_1",
|
|
69
79
|
"file-preview-list": "_file-preview-list_i2hex_1"
|
|
70
80
|
};
|
|
71
|
-
const FTrashIcon =
|
|
81
|
+
const FTrashIcon = React__default.forwardRef(({
|
|
72
82
|
color = "primary",
|
|
73
83
|
size = 32,
|
|
74
84
|
st,
|
|
@@ -229,8 +239,8 @@ const FButtonFile = ({
|
|
|
229
239
|
style,
|
|
230
240
|
id,
|
|
231
241
|
onClick: () => {
|
|
232
|
-
var
|
|
233
|
-
return (
|
|
242
|
+
var _a2;
|
|
243
|
+
return (_a2 = fileRef.current) == null ? void 0 : _a2.click();
|
|
234
244
|
},
|
|
235
245
|
children
|
|
236
246
|
}
|
|
@@ -263,7 +273,7 @@ const FButtonFile = ({
|
|
|
263
273
|
const styles$x = {
|
|
264
274
|
"f-text-field": "_f-text-field_200bb_1"
|
|
265
275
|
};
|
|
266
|
-
const FLoadIcon =
|
|
276
|
+
const FLoadIcon = React__default.forwardRef(({
|
|
267
277
|
size = 30,
|
|
268
278
|
st,
|
|
269
279
|
id,
|
|
@@ -752,7 +762,7 @@ const FTableBody = ({
|
|
|
752
762
|
...props
|
|
753
763
|
}) => {
|
|
754
764
|
const tableBodyRef = useRef(null);
|
|
755
|
-
const flatChildren = useMemo(() =>
|
|
765
|
+
const flatChildren = useMemo(() => React__default.Children.toArray(children), [children]);
|
|
756
766
|
const totalRows = flatChildren.length;
|
|
757
767
|
const [startIdx, setStartIdx] = useState(0);
|
|
758
768
|
const [rowHeights, setRowHeights] = useState(Array(flatChildren.length).fill(0));
|
|
@@ -783,16 +793,16 @@ const FTableBody = ({
|
|
|
783
793
|
requestAnimationFrame(updateStartIdx);
|
|
784
794
|
}, [updateStartIdx, virtualizationEnabled]);
|
|
785
795
|
useEffect(() => {
|
|
786
|
-
var
|
|
796
|
+
var _a2;
|
|
787
797
|
if (!virtualizationEnabled) return;
|
|
788
798
|
const handleResize = () => requestAnimationFrame(updateStartIdx);
|
|
789
799
|
window.addEventListener("resize", handleResize);
|
|
790
|
-
(
|
|
800
|
+
(_a2 = tableWrapperRef == null ? void 0 : tableWrapperRef.current) == null ? void 0 : _a2.addEventListener("scroll", handleScroll);
|
|
791
801
|
handleResize();
|
|
792
802
|
return () => {
|
|
793
|
-
var
|
|
803
|
+
var _a3;
|
|
794
804
|
window.removeEventListener("resize", handleResize);
|
|
795
|
-
(
|
|
805
|
+
(_a3 = tableWrapperRef == null ? void 0 : tableWrapperRef.current) == null ? void 0 : _a3.removeEventListener("scroll", handleScroll);
|
|
796
806
|
};
|
|
797
807
|
}, [handleScroll, updateStartIdx, virtualizationEnabled]);
|
|
798
808
|
useLayoutEffect(() => {
|
|
@@ -832,11 +842,11 @@ const FTableBody = ({
|
|
|
832
842
|
}
|
|
833
843
|
return /* @__PURE__ */ jsxs("tbody", { ref: tableBodyRef, style: st, ...props, className: `${styles$s["f-table-component__table_body"]} ${props.className || ""} ${styles$s[textAlignment]}`, children: [
|
|
834
844
|
virtualizationEnabled && rowHeights.some((h) => h > 0) && /* @__PURE__ */ jsx("tr", { style: { height: topOffset } }),
|
|
835
|
-
visibleItems.map((child, idx) =>
|
|
845
|
+
visibleItems.map((child, idx) => React__default.isValidElement(child) ? React__default.cloneElement(child, { "data-row-index": virtualizationEnabled ? startIdx + idx : idx, key: virtualizationEnabled ? startIdx + idx : idx }) : child),
|
|
836
846
|
virtualizationEnabled && rowHeights.some((h) => h > 0) && /* @__PURE__ */ jsx("tr", { style: { height: bottomOffset } })
|
|
837
847
|
] });
|
|
838
848
|
};
|
|
839
|
-
const FTableBody$1 =
|
|
849
|
+
const FTableBody$1 = React__default.memo(FTableBody);
|
|
840
850
|
const FTable = ({
|
|
841
851
|
st,
|
|
842
852
|
children,
|
|
@@ -881,10 +891,10 @@ const FTable = ({
|
|
|
881
891
|
style: { ...st, tableLayout: layout },
|
|
882
892
|
...props,
|
|
883
893
|
className: `table ${styles$s["f-table-component__table"]} ${styles$s["bordered"]} ${styles$s["bordered-half"]} ${props.className || ""}`,
|
|
884
|
-
children:
|
|
885
|
-
if (
|
|
894
|
+
children: React__default.Children.map(children, (child) => {
|
|
895
|
+
if (React__default.isValidElement(child) && child.type === FTableHead) {
|
|
886
896
|
const headProps = child.props;
|
|
887
|
-
return
|
|
897
|
+
return React__default.cloneElement(
|
|
888
898
|
child,
|
|
889
899
|
{
|
|
890
900
|
...headProps,
|
|
@@ -892,9 +902,9 @@ const FTable = ({
|
|
|
892
902
|
}
|
|
893
903
|
);
|
|
894
904
|
}
|
|
895
|
-
if (
|
|
905
|
+
if (React__default.isValidElement(child) && child.type === FTableBody$1) {
|
|
896
906
|
const headProps = child.props;
|
|
897
|
-
return
|
|
907
|
+
return React__default.cloneElement(
|
|
898
908
|
child,
|
|
899
909
|
{
|
|
900
910
|
...headProps,
|
|
@@ -1080,7 +1090,7 @@ const FDialog = ({
|
|
|
1080
1090
|
document.body
|
|
1081
1091
|
);
|
|
1082
1092
|
};
|
|
1083
|
-
const FCloseIcon =
|
|
1093
|
+
const FCloseIcon = React__default.forwardRef(({
|
|
1084
1094
|
color = "primary",
|
|
1085
1095
|
size = 30,
|
|
1086
1096
|
st,
|
|
@@ -1425,7 +1435,7 @@ const styles$k = {
|
|
|
1425
1435
|
"progress-dot": "_progress-dot_f7bma_172",
|
|
1426
1436
|
active: active$3
|
|
1427
1437
|
};
|
|
1428
|
-
const FArrowIcon =
|
|
1438
|
+
const FArrowIcon = React__default.forwardRef(({
|
|
1429
1439
|
color = "primary",
|
|
1430
1440
|
size = 30,
|
|
1431
1441
|
st,
|
|
@@ -1967,7 +1977,7 @@ const FSelect = forwardRef(
|
|
|
1967
1977
|
);
|
|
1968
1978
|
}
|
|
1969
1979
|
);
|
|
1970
|
-
const FSelectItem =
|
|
1980
|
+
const FSelectItem = React__default.forwardRef(({
|
|
1971
1981
|
st,
|
|
1972
1982
|
children,
|
|
1973
1983
|
...props
|
|
@@ -2741,7 +2751,7 @@ const FDropdown = forwardRef(({
|
|
|
2741
2751
|
setIsOpen(false);
|
|
2742
2752
|
};
|
|
2743
2753
|
const renderChildren = () => {
|
|
2744
|
-
return
|
|
2754
|
+
return React__default.Children.map(children, (child) => {
|
|
2745
2755
|
if (isValidElement(child) && child.type && child.type.displayName === "FDropdownItem") {
|
|
2746
2756
|
return cloneElement(child, {
|
|
2747
2757
|
onClick: handleItemClick(child)
|
|
@@ -3153,15 +3163,15 @@ const FMenuLinks = ({
|
|
|
3153
3163
|
disabled: disabled2 = [],
|
|
3154
3164
|
title: title2
|
|
3155
3165
|
}) => {
|
|
3156
|
-
const enhancedChildren =
|
|
3157
|
-
if (!
|
|
3166
|
+
const enhancedChildren = React__default.Children.map(children, (child, index) => {
|
|
3167
|
+
if (!React__default.isValidElement(child)) return child;
|
|
3158
3168
|
const isDisabled = disabled2.includes(index);
|
|
3159
3169
|
const childClass = [
|
|
3160
3170
|
child.props.className,
|
|
3161
3171
|
styles$8.link,
|
|
3162
3172
|
isDisabled && styles$8.disabled
|
|
3163
3173
|
].filter(Boolean).join(" ");
|
|
3164
|
-
return
|
|
3174
|
+
return React__default.cloneElement(child, {
|
|
3165
3175
|
className: childClass,
|
|
3166
3176
|
...isDisabled && { onClick: (e) => e.preventDefault() }
|
|
3167
3177
|
});
|
|
@@ -3318,43 +3328,43 @@ const FTooltip = ({
|
|
|
3318
3328
|
};
|
|
3319
3329
|
if (!disableHoverListener) {
|
|
3320
3330
|
childProps.onMouseEnter = (e) => {
|
|
3321
|
-
var
|
|
3331
|
+
var _a2, _b2;
|
|
3322
3332
|
handleOpen();
|
|
3323
|
-
(
|
|
3333
|
+
(_b2 = (_a2 = children.props).onMouseEnter) == null ? void 0 : _b2.call(_a2, e);
|
|
3324
3334
|
};
|
|
3325
3335
|
childProps.onMouseLeave = (e) => {
|
|
3326
|
-
var
|
|
3336
|
+
var _a2, _b2;
|
|
3327
3337
|
handleClose();
|
|
3328
|
-
(
|
|
3338
|
+
(_b2 = (_a2 = children.props).onMouseLeave) == null ? void 0 : _b2.call(_a2, e);
|
|
3329
3339
|
};
|
|
3330
3340
|
}
|
|
3331
3341
|
if (!disableFocusListener) {
|
|
3332
3342
|
childProps.onFocus = (e) => {
|
|
3333
|
-
var
|
|
3343
|
+
var _a2, _b2;
|
|
3334
3344
|
handleOpen();
|
|
3335
|
-
(
|
|
3345
|
+
(_b2 = (_a2 = children.props).onFocus) == null ? void 0 : _b2.call(_a2, e);
|
|
3336
3346
|
};
|
|
3337
3347
|
childProps.onBlur = (e) => {
|
|
3338
|
-
var
|
|
3348
|
+
var _a2, _b2;
|
|
3339
3349
|
handleClose();
|
|
3340
|
-
(
|
|
3350
|
+
(_b2 = (_a2 = children.props).onBlur) == null ? void 0 : _b2.call(_a2, e);
|
|
3341
3351
|
};
|
|
3342
3352
|
}
|
|
3343
3353
|
if (!disableTouchListener) {
|
|
3344
3354
|
childProps.onTouchStart = (e) => {
|
|
3345
|
-
var
|
|
3355
|
+
var _a2, _b2;
|
|
3346
3356
|
handleOpen();
|
|
3347
|
-
(
|
|
3357
|
+
(_b2 = (_a2 = children.props).onTouchStart) == null ? void 0 : _b2.call(_a2, e);
|
|
3348
3358
|
};
|
|
3349
3359
|
childProps.onTouchEnd = (e) => {
|
|
3350
|
-
var
|
|
3360
|
+
var _a2, _b2;
|
|
3351
3361
|
handleClose();
|
|
3352
|
-
(
|
|
3362
|
+
(_b2 = (_a2 = children.props).onTouchEnd) == null ? void 0 : _b2.call(_a2, e);
|
|
3353
3363
|
};
|
|
3354
3364
|
}
|
|
3355
3365
|
let wrappedChild;
|
|
3356
3366
|
const childPropsTyped = children.props;
|
|
3357
|
-
if (allowTooltipOnDisabled &&
|
|
3367
|
+
if (allowTooltipOnDisabled && React__default.isValidElement(children) && (childPropsTyped.disabled || childPropsTyped["aria-disabled"])) {
|
|
3358
3368
|
wrappedChild = /* @__PURE__ */ jsx(
|
|
3359
3369
|
"span",
|
|
3360
3370
|
{
|
|
@@ -3450,8 +3460,8 @@ const FSearchableSelect = forwardRef(
|
|
|
3450
3460
|
}, ref) => {
|
|
3451
3461
|
const options = useMemo(() => {
|
|
3452
3462
|
const results = [];
|
|
3453
|
-
|
|
3454
|
-
if (
|
|
3463
|
+
React__default.Children.forEach(children, (child) => {
|
|
3464
|
+
if (React__default.isValidElement(child)) {
|
|
3455
3465
|
const element = child;
|
|
3456
3466
|
const { value: childValue, children: childLabel } = element.props;
|
|
3457
3467
|
const valStr = childValue !== void 0 ? String(childValue) : "";
|
|
@@ -3530,11 +3540,11 @@ const FSearchableSelect = forwardRef(
|
|
|
3530
3540
|
setHighlightedIndex(0);
|
|
3531
3541
|
};
|
|
3532
3542
|
const handleClear = (e) => {
|
|
3533
|
-
var
|
|
3543
|
+
var _a2;
|
|
3534
3544
|
e.stopPropagation();
|
|
3535
3545
|
triggerChange("");
|
|
3536
3546
|
setSearchQuery("");
|
|
3537
|
-
(
|
|
3547
|
+
(_a2 = visibleInputRef.current) == null ? void 0 : _a2.focus();
|
|
3538
3548
|
};
|
|
3539
3549
|
useEffect(() => {
|
|
3540
3550
|
const handleClickOutside = (event) => {
|
|
@@ -3553,7 +3563,7 @@ const FSearchableSelect = forwardRef(
|
|
|
3553
3563
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3554
3564
|
}, [restProps.value, options]);
|
|
3555
3565
|
const handleKeyDown = (e) => {
|
|
3556
|
-
var
|
|
3566
|
+
var _a2;
|
|
3557
3567
|
if (restOnKeyDown) restOnKeyDown(e);
|
|
3558
3568
|
if (e.key === "ArrowDown") {
|
|
3559
3569
|
e.preventDefault();
|
|
@@ -3572,7 +3582,7 @@ const FSearchableSelect = forwardRef(
|
|
|
3572
3582
|
}
|
|
3573
3583
|
} else if (e.key === "Escape") {
|
|
3574
3584
|
setIsOpen(false);
|
|
3575
|
-
(
|
|
3585
|
+
(_a2 = visibleInputRef.current) == null ? void 0 : _a2.blur();
|
|
3576
3586
|
}
|
|
3577
3587
|
};
|
|
3578
3588
|
const baseStyle = {
|
|
@@ -3726,7 +3736,7 @@ const FSearchableSelect = forwardRef(
|
|
|
3726
3736
|
}
|
|
3727
3737
|
);
|
|
3728
3738
|
FSearchableSelect.displayName = "FSearchableSelect";
|
|
3729
|
-
const FPlusIcon =
|
|
3739
|
+
const FPlusIcon = React__default.forwardRef(({
|
|
3730
3740
|
color = "primary",
|
|
3731
3741
|
size = 30,
|
|
3732
3742
|
st,
|
|
@@ -3760,7 +3770,7 @@ const FPlusIcon = React.forwardRef(({
|
|
|
3760
3770
|
);
|
|
3761
3771
|
});
|
|
3762
3772
|
FPlusIcon.displayName = "FPlusIcon";
|
|
3763
|
-
const FCheckIcon =
|
|
3773
|
+
const FCheckIcon = React__default.forwardRef(({
|
|
3764
3774
|
color = "primary",
|
|
3765
3775
|
size = 30,
|
|
3766
3776
|
st,
|
|
@@ -3794,7 +3804,7 @@ const FCheckIcon = React.forwardRef(({
|
|
|
3794
3804
|
);
|
|
3795
3805
|
});
|
|
3796
3806
|
FCheckIcon.displayName = "FCheckIcon";
|
|
3797
|
-
const FListIcon =
|
|
3807
|
+
const FListIcon = React__default.forwardRef(({
|
|
3798
3808
|
color = "primary",
|
|
3799
3809
|
size = 30,
|
|
3800
3810
|
st,
|
|
@@ -3834,7 +3844,7 @@ const FListIcon = React.forwardRef(({
|
|
|
3834
3844
|
);
|
|
3835
3845
|
});
|
|
3836
3846
|
FListIcon.displayName = "FListIcon";
|
|
3837
|
-
const FPenIcon =
|
|
3847
|
+
const FPenIcon = React__default.forwardRef(({
|
|
3838
3848
|
color = "primary",
|
|
3839
3849
|
size = 30,
|
|
3840
3850
|
st,
|
|
@@ -3866,7 +3876,7 @@ const FPenIcon = React.forwardRef(({
|
|
|
3866
3876
|
);
|
|
3867
3877
|
});
|
|
3868
3878
|
FPenIcon.displayName = "FPenIcon";
|
|
3869
|
-
const FUploadIcon =
|
|
3879
|
+
const FUploadIcon = React__default.forwardRef(({
|
|
3870
3880
|
color = "primary",
|
|
3871
3881
|
size = 30,
|
|
3872
3882
|
st,
|
|
@@ -3896,7 +3906,7 @@ const FUploadIcon = React.forwardRef(({
|
|
|
3896
3906
|
);
|
|
3897
3907
|
});
|
|
3898
3908
|
FUploadIcon.displayName = "FUploadIcon";
|
|
3899
|
-
const FDownloadIcon =
|
|
3909
|
+
const FDownloadIcon = React__default.forwardRef(({
|
|
3900
3910
|
color = "primary",
|
|
3901
3911
|
size = 30,
|
|
3902
3912
|
st,
|
|
@@ -3926,7 +3936,7 @@ const FDownloadIcon = React.forwardRef(({
|
|
|
3926
3936
|
);
|
|
3927
3937
|
});
|
|
3928
3938
|
FDownloadIcon.displayName = "FDownloadIcon";
|
|
3929
|
-
const FCopyAddIcon =
|
|
3939
|
+
const FCopyAddIcon = React__default.forwardRef(({
|
|
3930
3940
|
color = "primary",
|
|
3931
3941
|
size = 30,
|
|
3932
3942
|
st,
|
|
@@ -3956,7 +3966,7 @@ const FCopyAddIcon = React.forwardRef(({
|
|
|
3956
3966
|
);
|
|
3957
3967
|
});
|
|
3958
3968
|
FCopyAddIcon.displayName = "FCopyAddIcon";
|
|
3959
|
-
const FUnlinkIcon =
|
|
3969
|
+
const FUnlinkIcon = React__default.forwardRef(({
|
|
3960
3970
|
color = "primary",
|
|
3961
3971
|
size = 30,
|
|
3962
3972
|
st,
|
|
@@ -3994,7 +4004,7 @@ const FUnlinkIcon = React.forwardRef(({
|
|
|
3994
4004
|
);
|
|
3995
4005
|
});
|
|
3996
4006
|
FUnlinkIcon.displayName = "FUnlinkIcon";
|
|
3997
|
-
const FFilterIcon =
|
|
4007
|
+
const FFilterIcon = React__default.forwardRef(({
|
|
3998
4008
|
color = "primary",
|
|
3999
4009
|
size = 30,
|
|
4000
4010
|
st,
|
|
@@ -4024,7 +4034,7 @@ const FFilterIcon = React.forwardRef(({
|
|
|
4024
4034
|
);
|
|
4025
4035
|
});
|
|
4026
4036
|
FFilterIcon.displayName = "FFilterIcon";
|
|
4027
|
-
const FDocumentIcon =
|
|
4037
|
+
const FDocumentIcon = React__default.forwardRef(({
|
|
4028
4038
|
color = "primary",
|
|
4029
4039
|
size = 30,
|
|
4030
4040
|
st,
|
|
@@ -4078,7 +4088,7 @@ const FDocumentIcon = React.forwardRef(({
|
|
|
4078
4088
|
);
|
|
4079
4089
|
});
|
|
4080
4090
|
FDocumentIcon.displayName = "FDocumentIcon";
|
|
4081
|
-
const FReloadIcon =
|
|
4091
|
+
const FReloadIcon = React__default.forwardRef(({
|
|
4082
4092
|
color = "primary",
|
|
4083
4093
|
size = 30,
|
|
4084
4094
|
st,
|
|
@@ -4108,7 +4118,7 @@ const FReloadIcon = React.forwardRef(({
|
|
|
4108
4118
|
);
|
|
4109
4119
|
});
|
|
4110
4120
|
FReloadIcon.displayName = "FReloadIcon";
|
|
4111
|
-
const FMinusIcon =
|
|
4121
|
+
const FMinusIcon = React__default.forwardRef(({
|
|
4112
4122
|
color = "primary",
|
|
4113
4123
|
size = 30,
|
|
4114
4124
|
st,
|
|
@@ -4138,7 +4148,7 @@ const FMinusIcon = React.forwardRef(({
|
|
|
4138
4148
|
);
|
|
4139
4149
|
});
|
|
4140
4150
|
FMinusIcon.displayName = "FMinusIcon";
|
|
4141
|
-
const FInfoCircleIcon =
|
|
4151
|
+
const FInfoCircleIcon = React__default.forwardRef(({
|
|
4142
4152
|
color = "primary",
|
|
4143
4153
|
size = 30,
|
|
4144
4154
|
st,
|
|
@@ -4168,7 +4178,7 @@ const FInfoCircleIcon = React.forwardRef(({
|
|
|
4168
4178
|
);
|
|
4169
4179
|
});
|
|
4170
4180
|
FInfoCircleIcon.displayName = "FInfoCircleIcon";
|
|
4171
|
-
const FSafeIcon =
|
|
4181
|
+
const FSafeIcon = React__default.forwardRef(({
|
|
4172
4182
|
color = "primary",
|
|
4173
4183
|
size = 30,
|
|
4174
4184
|
st,
|
|
@@ -4198,7 +4208,7 @@ const FSafeIcon = React.forwardRef(({
|
|
|
4198
4208
|
);
|
|
4199
4209
|
});
|
|
4200
4210
|
FSafeIcon.displayName = "FSafeIcon";
|
|
4201
|
-
const FArrowRightCircleIcon =
|
|
4211
|
+
const FArrowRightCircleIcon = React__default.forwardRef(({
|
|
4202
4212
|
color = "primary",
|
|
4203
4213
|
size = 30,
|
|
4204
4214
|
st,
|
|
@@ -4225,7 +4235,7 @@ const FArrowRightCircleIcon = React.forwardRef(({
|
|
|
4225
4235
|
);
|
|
4226
4236
|
});
|
|
4227
4237
|
FArrowRightCircleIcon.displayName = "FArrowRightCircleIcon";
|
|
4228
|
-
const FArrowLeftCircleIcon =
|
|
4238
|
+
const FArrowLeftCircleIcon = React__default.forwardRef(({
|
|
4229
4239
|
color = "primary",
|
|
4230
4240
|
size = 30,
|
|
4231
4241
|
st,
|
|
@@ -4252,7 +4262,7 @@ const FArrowLeftCircleIcon = React.forwardRef(({
|
|
|
4252
4262
|
);
|
|
4253
4263
|
});
|
|
4254
4264
|
FArrowLeftCircleIcon.displayName = "FArrowLeftCircleIcon";
|
|
4255
|
-
const FArrowUpCircleIcon =
|
|
4265
|
+
const FArrowUpCircleIcon = React__default.forwardRef(({
|
|
4256
4266
|
color = "primary",
|
|
4257
4267
|
size = 30,
|
|
4258
4268
|
st,
|
|
@@ -4279,7 +4289,7 @@ const FArrowUpCircleIcon = React.forwardRef(({
|
|
|
4279
4289
|
);
|
|
4280
4290
|
});
|
|
4281
4291
|
FArrowUpCircleIcon.displayName = "FArrowUpCircleIcon";
|
|
4282
|
-
const FArrowDownCircleIcon =
|
|
4292
|
+
const FArrowDownCircleIcon = React__default.forwardRef(({
|
|
4283
4293
|
color = "primary",
|
|
4284
4294
|
size = 30,
|
|
4285
4295
|
st,
|
|
@@ -7623,10 +7633,10 @@ const fNotification = ({
|
|
|
7623
7633
|
return blockNotification2;
|
|
7624
7634
|
};
|
|
7625
7635
|
const removeEmptyNotificationBlock = () => {
|
|
7626
|
-
var
|
|
7636
|
+
var _a2;
|
|
7627
7637
|
const blockNotification2 = document.querySelector("#block-notification");
|
|
7628
7638
|
if (blockNotification2 && blockNotification2.children.length === 0) {
|
|
7629
|
-
(
|
|
7639
|
+
(_a2 = blockNotification2.parentNode) == null ? void 0 : _a2.removeChild(blockNotification2);
|
|
7630
7640
|
}
|
|
7631
7641
|
};
|
|
7632
7642
|
const blockNotification = getOrCreateNotificationBlock();
|
|
@@ -7740,8 +7750,8 @@ const fDownloadFileFromBase64 = (base64String, fileName) => {
|
|
|
7740
7750
|
}
|
|
7741
7751
|
};
|
|
7742
7752
|
const getMimeTypeFromFileName = (fileName) => {
|
|
7743
|
-
var
|
|
7744
|
-
const extension = (
|
|
7753
|
+
var _a2;
|
|
7754
|
+
const extension = (_a2 = fileName.split(".").pop()) == null ? void 0 : _a2.toLowerCase();
|
|
7745
7755
|
if (!extension) return void 0;
|
|
7746
7756
|
const mimeTypes = {
|
|
7747
7757
|
txt: "text/plain",
|
|
@@ -7894,7 +7904,7 @@ const useFApi = ({ doNotUseState = false, defaultState = null, getValueByPath =
|
|
|
7894
7904
|
const [loading, setLoading] = useState(false);
|
|
7895
7905
|
const [error2, setError] = useState(null);
|
|
7896
7906
|
const execute = async (config) => {
|
|
7897
|
-
var
|
|
7907
|
+
var _a2, _b2, _c2;
|
|
7898
7908
|
setLoading(true);
|
|
7899
7909
|
setError(null);
|
|
7900
7910
|
try {
|
|
@@ -7918,11 +7928,11 @@ const useFApi = ({ doNotUseState = false, defaultState = null, getValueByPath =
|
|
|
7918
7928
|
}
|
|
7919
7929
|
} catch (error22) {
|
|
7920
7930
|
const err = error22;
|
|
7921
|
-
const errorMessage = ((
|
|
7931
|
+
const errorMessage = ((_b2 = (_a2 = err.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || err.message || "Неизвестная ошибка";
|
|
7922
7932
|
fNotification({
|
|
7923
7933
|
variant: "error",
|
|
7924
7934
|
title: "Ошибка",
|
|
7925
|
-
body: `- Произошла ошибка ${(
|
|
7935
|
+
body: `- Произошла ошибка ${(_c2 = err.response) == null ? void 0 : _c2.status}
|
|
7926
7936
|
- ${errorMessage}`,
|
|
7927
7937
|
timeSecClose: 5
|
|
7928
7938
|
});
|
|
@@ -7939,6 +7949,1547 @@ const useFApi = ({ doNotUseState = false, defaultState = null, getValueByPath =
|
|
|
7939
7949
|
};
|
|
7940
7950
|
return { data, loading, error: error2, execute, reset };
|
|
7941
7951
|
};
|
|
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
|
+
const LibraryContext = createContext(null);
|
|
9196
|
+
const LibraryProvider = ({
|
|
9197
|
+
children,
|
|
9198
|
+
config
|
|
9199
|
+
}) => {
|
|
9200
|
+
return /* @__PURE__ */ jsx(LibraryContext.Provider, { value: config, children });
|
|
9201
|
+
};
|
|
9202
|
+
const useLibraryContext = () => {
|
|
9203
|
+
const context = useContext(LibraryContext);
|
|
9204
|
+
if (!context) {
|
|
9205
|
+
throw new Error("[UIKit/Lib]: Вы должны обернуть приложение в <LibraryProvider config={{ apiService }}>");
|
|
9206
|
+
}
|
|
9207
|
+
return context;
|
|
9208
|
+
};
|
|
9209
|
+
const useApiMutation = (url, config, options) => {
|
|
9210
|
+
const { apiService } = useLibraryContext();
|
|
9211
|
+
const queryClient = useQueryClient();
|
|
9212
|
+
const mutation = useMutation({
|
|
9213
|
+
mutationFn: ({ data, urlParams }) => {
|
|
9214
|
+
let finalUrl = url;
|
|
9215
|
+
if (urlParams) {
|
|
9216
|
+
Object.entries(urlParams).forEach(([key, value]) => {
|
|
9217
|
+
finalUrl = finalUrl.replace(new RegExp(`:${key}\\b`, "g"), String(value));
|
|
9218
|
+
});
|
|
9219
|
+
}
|
|
9220
|
+
const isFormData = data instanceof FormData;
|
|
9221
|
+
const requestConfig = {
|
|
9222
|
+
method: "POST",
|
|
9223
|
+
data,
|
|
9224
|
+
...config
|
|
9225
|
+
};
|
|
9226
|
+
if (isFormData) {
|
|
9227
|
+
requestConfig.headers = {
|
|
9228
|
+
...requestConfig.headers,
|
|
9229
|
+
"Content-Type": void 0
|
|
9230
|
+
};
|
|
9231
|
+
}
|
|
9232
|
+
return apiService.request(finalUrl, requestConfig);
|
|
9233
|
+
},
|
|
9234
|
+
...options,
|
|
9235
|
+
onSuccess: (...args) => {
|
|
9236
|
+
var _a2;
|
|
9237
|
+
if (options == null ? void 0 : options.queryKeyToInvalidate) {
|
|
9238
|
+
queryClient.invalidateQueries({ queryKey: options.queryKeyToInvalidate });
|
|
9239
|
+
}
|
|
9240
|
+
(_a2 = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a2.call(options, ...args);
|
|
9241
|
+
}
|
|
9242
|
+
});
|
|
9243
|
+
const customMutate = (data, urlParams, mutateOptions) => {
|
|
9244
|
+
mutation.mutate({ data, urlParams }, mutateOptions);
|
|
9245
|
+
};
|
|
9246
|
+
const customMutateAsync = (data, urlParams, mutateOptions) => {
|
|
9247
|
+
return mutation.mutateAsync({ data, urlParams }, mutateOptions);
|
|
9248
|
+
};
|
|
9249
|
+
useNotificationEffects(
|
|
9250
|
+
{ ...options || {} },
|
|
9251
|
+
{
|
|
9252
|
+
isError: mutation.isError,
|
|
9253
|
+
isPending: mutation.isPending,
|
|
9254
|
+
isSuccess: mutation.isSuccess,
|
|
9255
|
+
error: mutation.error ?? null
|
|
9256
|
+
}
|
|
9257
|
+
);
|
|
9258
|
+
return {
|
|
9259
|
+
...mutation,
|
|
9260
|
+
mutate: customMutate,
|
|
9261
|
+
mutateAsync: customMutateAsync
|
|
9262
|
+
};
|
|
9263
|
+
};
|
|
9264
|
+
function useNotificationEffects(options, state) {
|
|
9265
|
+
const {
|
|
9266
|
+
onErrorNotification = false,
|
|
9267
|
+
onErrorLog = false,
|
|
9268
|
+
onSuccessNotification = false,
|
|
9269
|
+
notificationTitle = "Ошибка выполнения запроса!",
|
|
9270
|
+
notificationBody = (error2) => (error2 == null ? void 0 : error2.message) || "Неизвестная ошибка",
|
|
9271
|
+
loadingNotificationTitle = "Загрузка",
|
|
9272
|
+
loadingNotificationBody = "Идет загрузка, пожалуйста, подождите...",
|
|
9273
|
+
successNotificationTitle = "Успешно!",
|
|
9274
|
+
successNotificationBody = "Операция выполнена успешно"
|
|
9275
|
+
} = options;
|
|
9276
|
+
const loadingNotificationIdRef = useRef(void 0);
|
|
9277
|
+
useEffect(() => {
|
|
9278
|
+
let isMounted = true;
|
|
9279
|
+
if (state.isPending && !loadingNotificationIdRef.current) {
|
|
9280
|
+
fNotification({
|
|
9281
|
+
variant: "info",
|
|
9282
|
+
title: loadingNotificationTitle,
|
|
9283
|
+
body: loadingNotificationBody
|
|
9284
|
+
}).then((id) => {
|
|
9285
|
+
if (isMounted && state.isPending) {
|
|
9286
|
+
loadingNotificationIdRef.current = id;
|
|
9287
|
+
} else if (id) {
|
|
9288
|
+
fNotificationDelete(id);
|
|
9289
|
+
}
|
|
9290
|
+
});
|
|
9291
|
+
}
|
|
9292
|
+
if (!state.isPending && loadingNotificationIdRef.current) {
|
|
9293
|
+
fNotificationDelete(loadingNotificationIdRef.current);
|
|
9294
|
+
loadingNotificationIdRef.current = void 0;
|
|
9295
|
+
}
|
|
9296
|
+
return () => {
|
|
9297
|
+
isMounted = false;
|
|
9298
|
+
if (loadingNotificationIdRef.current) {
|
|
9299
|
+
fNotificationDelete(loadingNotificationIdRef.current);
|
|
9300
|
+
loadingNotificationIdRef.current = void 0;
|
|
9301
|
+
}
|
|
9302
|
+
};
|
|
9303
|
+
}, [state.isPending, loadingNotificationTitle, loadingNotificationBody]);
|
|
9304
|
+
useEffect(() => {
|
|
9305
|
+
if (state.isError) {
|
|
9306
|
+
if (onErrorNotification) {
|
|
9307
|
+
fNotification({
|
|
9308
|
+
variant: "error",
|
|
9309
|
+
title: notificationTitle,
|
|
9310
|
+
body: notificationBody(state.error ?? null),
|
|
9311
|
+
timeSecClose: 3
|
|
9312
|
+
});
|
|
9313
|
+
}
|
|
9314
|
+
if (onErrorLog && state.error) {
|
|
9315
|
+
console.error(state.error);
|
|
9316
|
+
}
|
|
9317
|
+
}
|
|
9318
|
+
}, [state.isError, state.error, onErrorNotification, onErrorLog, notificationTitle, notificationBody]);
|
|
9319
|
+
useEffect(() => {
|
|
9320
|
+
if (state.isSuccess && onSuccessNotification) {
|
|
9321
|
+
fNotification({
|
|
9322
|
+
variant: "success",
|
|
9323
|
+
title: successNotificationTitle,
|
|
9324
|
+
body: successNotificationBody,
|
|
9325
|
+
timeSecClose: 3
|
|
9326
|
+
});
|
|
9327
|
+
}
|
|
9328
|
+
}, [state.isSuccess, onSuccessNotification, successNotificationTitle, successNotificationBody]);
|
|
9329
|
+
}
|
|
9330
|
+
const useApiQuery = (queryKey, url, config, options) => {
|
|
9331
|
+
const { apiService } = useLibraryContext();
|
|
9332
|
+
const {
|
|
9333
|
+
onErrorNotification = false,
|
|
9334
|
+
onErrorLog = false,
|
|
9335
|
+
onLoadingLog = false,
|
|
9336
|
+
notificationTitle = "Ошибка выполнения запроса!",
|
|
9337
|
+
notificationBody = (error2) => (error2 == null ? void 0 : error2.message) || "Неизвестная ошибка",
|
|
9338
|
+
loadingNotificationTitle = "Загрузка",
|
|
9339
|
+
loadingNotificationBody = "Идет загрузка, пожалуйста, подождите...",
|
|
9340
|
+
...restOptions
|
|
9341
|
+
} = options || {};
|
|
9342
|
+
const method = restOptions.method ?? "GET";
|
|
9343
|
+
const lastKeyElement = queryKey.length > 1 ? queryKey[queryKey.length - 1] : void 0;
|
|
9344
|
+
const paramsOrData = typeof lastKeyElement === "object" && lastKeyElement !== null ? lastKeyElement : void 0;
|
|
9345
|
+
const query = useQuery({
|
|
9346
|
+
queryKey,
|
|
9347
|
+
queryFn: ({ signal }) => apiService.request(url, {
|
|
9348
|
+
method,
|
|
9349
|
+
signal,
|
|
9350
|
+
// Автоматическое отмена зависших запросов при смене ключа
|
|
9351
|
+
...config,
|
|
9352
|
+
...method === "POST" ? { data: paramsOrData } : { params: paramsOrData }
|
|
9353
|
+
}),
|
|
9354
|
+
...restOptions
|
|
9355
|
+
});
|
|
9356
|
+
useEffect(() => {
|
|
9357
|
+
if (query.isError) {
|
|
9358
|
+
if (onErrorNotification) {
|
|
9359
|
+
fNotification({
|
|
9360
|
+
variant: "error",
|
|
9361
|
+
title: notificationTitle,
|
|
9362
|
+
body: notificationBody(query.error ?? null),
|
|
9363
|
+
timeSecClose: 3
|
|
9364
|
+
});
|
|
9365
|
+
}
|
|
9366
|
+
if (onErrorLog && query.error) {
|
|
9367
|
+
console.error(query.error);
|
|
9368
|
+
}
|
|
9369
|
+
}
|
|
9370
|
+
}, [query.isError, query.error, onErrorNotification, onErrorLog, notificationTitle, notificationBody]);
|
|
9371
|
+
const loadingNotificationIdRef = useRef(void 0);
|
|
9372
|
+
useEffect(() => {
|
|
9373
|
+
let isMounted = true;
|
|
9374
|
+
const handleLoadingToast = async () => {
|
|
9375
|
+
if (onLoadingLog && query.isLoading && !loadingNotificationIdRef.current) {
|
|
9376
|
+
const id = await fNotification({
|
|
9377
|
+
variant: "info",
|
|
9378
|
+
title: loadingNotificationTitle,
|
|
9379
|
+
body: loadingNotificationBody
|
|
9380
|
+
});
|
|
9381
|
+
if (isMounted) {
|
|
9382
|
+
loadingNotificationIdRef.current = id;
|
|
9383
|
+
} else if (id) {
|
|
9384
|
+
fNotificationDelete(id);
|
|
9385
|
+
}
|
|
9386
|
+
}
|
|
9387
|
+
};
|
|
9388
|
+
handleLoadingToast();
|
|
9389
|
+
if (!query.isLoading && loadingNotificationIdRef.current) {
|
|
9390
|
+
fNotificationDelete(loadingNotificationIdRef.current);
|
|
9391
|
+
loadingNotificationIdRef.current = void 0;
|
|
9392
|
+
}
|
|
9393
|
+
return () => {
|
|
9394
|
+
isMounted = false;
|
|
9395
|
+
if (loadingNotificationIdRef.current) {
|
|
9396
|
+
fNotificationDelete(loadingNotificationIdRef.current);
|
|
9397
|
+
loadingNotificationIdRef.current = void 0;
|
|
9398
|
+
}
|
|
9399
|
+
};
|
|
9400
|
+
}, [query.isLoading, onLoadingLog, loadingNotificationTitle, loadingNotificationBody]);
|
|
9401
|
+
return query;
|
|
9402
|
+
};
|
|
9403
|
+
function useManualApiQuery(queryKey, url, initialParams, config, options) {
|
|
9404
|
+
const { apiService } = useLibraryContext();
|
|
9405
|
+
const queryClient = useQueryClient();
|
|
9406
|
+
const [params, setParams] = useState(initialParams);
|
|
9407
|
+
const [urlParams, setUrlParams] = useState(options == null ? void 0 : options.urlParams);
|
|
9408
|
+
const [dopUrl, setDopUrl] = useState(void 0);
|
|
9409
|
+
const {
|
|
9410
|
+
onErrorNotification = false,
|
|
9411
|
+
onErrorLog = false,
|
|
9412
|
+
onLoadingLog = false,
|
|
9413
|
+
notificationTitle = "Ошибка выполнения запроса!",
|
|
9414
|
+
notificationBody = (error2) => (error2 == null ? void 0 : error2.message) || "Неизвестная ошибка",
|
|
9415
|
+
...restOptions
|
|
9416
|
+
} = options || {};
|
|
9417
|
+
const method = restOptions.method ?? "GET";
|
|
9418
|
+
const listQueryKey = [queryKey];
|
|
9419
|
+
if (params) listQueryKey.push(params);
|
|
9420
|
+
if (urlParams) listQueryKey.push(urlParams);
|
|
9421
|
+
const fetcher = useCallback((overrideParams, overrideUrlParams, overrideDopUrl, signal) => {
|
|
9422
|
+
const currentParams = overrideParams !== void 0 ? overrideParams : params;
|
|
9423
|
+
const currentUrlParams = overrideUrlParams !== void 0 ? overrideUrlParams : urlParams;
|
|
9424
|
+
const currentDopUrl = overrideDopUrl !== void 0 ? overrideDopUrl : dopUrl;
|
|
9425
|
+
const targetUrl = currentDopUrl !== void 0 ? url + currentDopUrl : url;
|
|
9426
|
+
return apiService.request(targetUrl, {
|
|
9427
|
+
method,
|
|
9428
|
+
signal,
|
|
9429
|
+
...config,
|
|
9430
|
+
...method === "POST" ? {
|
|
9431
|
+
data: currentParams,
|
|
9432
|
+
params: currentUrlParams
|
|
9433
|
+
} : {
|
|
9434
|
+
params: currentUrlParams ? { ...currentParams, ...currentUrlParams } : currentParams
|
|
9435
|
+
}
|
|
9436
|
+
});
|
|
9437
|
+
}, [apiService, params, urlParams, dopUrl, url, method, config]);
|
|
9438
|
+
const query = useQuery({
|
|
9439
|
+
queryKey: listQueryKey,
|
|
9440
|
+
queryFn: ({ signal }) => fetcher(void 0, void 0, void 0, signal),
|
|
9441
|
+
enabled: false,
|
|
9442
|
+
...restOptions
|
|
9443
|
+
});
|
|
9444
|
+
const handleSideErrors = useCallback((error2) => {
|
|
9445
|
+
if (onErrorNotification) {
|
|
9446
|
+
fNotification({
|
|
9447
|
+
variant: "error",
|
|
9448
|
+
title: notificationTitle,
|
|
9449
|
+
body: notificationBody(error2 ?? null),
|
|
9450
|
+
timeSecClose: 3
|
|
9451
|
+
});
|
|
9452
|
+
}
|
|
9453
|
+
if (onErrorLog) {
|
|
9454
|
+
console.error(error2);
|
|
9455
|
+
}
|
|
9456
|
+
}, [onErrorNotification, notificationTitle, notificationBody, onErrorLog]);
|
|
9457
|
+
useEffect(() => {
|
|
9458
|
+
if (onLoadingLog && query.isFetching) {
|
|
9459
|
+
console.log(`[useManualApiQuery] Loading: ${url}`);
|
|
9460
|
+
}
|
|
9461
|
+
}, [query.isFetching, onLoadingLog, url]);
|
|
9462
|
+
const run = useCallback(async ({
|
|
9463
|
+
newParams,
|
|
9464
|
+
newUrlParams,
|
|
9465
|
+
preserveParams = false,
|
|
9466
|
+
dopUrl: newDopUrl,
|
|
9467
|
+
preserveUrlParams = false
|
|
9468
|
+
} = {}) => {
|
|
9469
|
+
const updatedParams = preserveParams && newParams === void 0 ? params : newParams;
|
|
9470
|
+
const updatedUrlParams = newUrlParams === void 0 ? urlParams : preserveUrlParams ? { ...urlParams, ...newUrlParams } : newUrlParams;
|
|
9471
|
+
const updatedDopUrl = newDopUrl !== void 0 ? newDopUrl : dopUrl;
|
|
9472
|
+
setParams(updatedParams);
|
|
9473
|
+
setUrlParams(updatedUrlParams);
|
|
9474
|
+
if (newDopUrl !== void 0) setDopUrl(newDopUrl);
|
|
9475
|
+
const nextQueryKey = [queryKey];
|
|
9476
|
+
if (updatedParams) nextQueryKey.push(updatedParams);
|
|
9477
|
+
if (updatedUrlParams) nextQueryKey.push(updatedUrlParams);
|
|
9478
|
+
try {
|
|
9479
|
+
const result = await queryClient.fetchQuery({
|
|
9480
|
+
queryKey: nextQueryKey,
|
|
9481
|
+
queryFn: ({ signal }) => fetcher(updatedParams, updatedUrlParams, updatedDopUrl, signal),
|
|
9482
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9483
|
+
staleTime: restOptions.staleTime
|
|
9484
|
+
});
|
|
9485
|
+
return result;
|
|
9486
|
+
} catch (error2) {
|
|
9487
|
+
handleSideErrors(error2);
|
|
9488
|
+
throw error2;
|
|
9489
|
+
}
|
|
9490
|
+
}, [params, urlParams, dopUrl, queryKey, fetcher, queryClient, restOptions.staleTime, handleSideErrors]);
|
|
9491
|
+
return { ...query, run, params, urlParams };
|
|
9492
|
+
}
|
|
7942
9493
|
const waterError = "_waterError_10t7p_1";
|
|
7943
9494
|
const scene = "_scene_10t7p_12";
|
|
7944
9495
|
const waves = "_waves_10t7p_18";
|
|
@@ -8110,6 +9661,7 @@ export {
|
|
|
8110
9661
|
FUnlinkIcon,
|
|
8111
9662
|
FUploadIcon,
|
|
8112
9663
|
FWaterErrorBoundaryPage,
|
|
9664
|
+
LibraryProvider,
|
|
8113
9665
|
fAlert,
|
|
8114
9666
|
fBankRound,
|
|
8115
9667
|
fConfirm,
|
|
@@ -8127,6 +9679,9 @@ export {
|
|
|
8127
9679
|
fNotification,
|
|
8128
9680
|
fNotificationDelete,
|
|
8129
9681
|
fPrompt,
|
|
8130
|
-
|
|
9682
|
+
useApiMutation,
|
|
9683
|
+
useApiQuery,
|
|
9684
|
+
useFApi,
|
|
9685
|
+
useManualApiQuery
|
|
8131
9686
|
};
|
|
8132
9687
|
//# sourceMappingURL=f-ui-kit.es.js.map
|