@gen-epix/ui-client-common 4.5.1 → 4.6.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/@types/mui.d.ts +13 -11
- package/dist/_chunks/ApplicationFooter.js +32 -23
- package/dist/_chunks/ApplicationFooter.js.map +1 -1
- package/dist/_chunks/Breadcrumbs.js +1 -2
- package/dist/_chunks/CrudPage.js +221 -226
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/GeoFilter.js +1 -2
- package/dist/_chunks/GeoFilter.js.map +1 -1
- package/dist/_chunks/Notifications.js +1 -2
- package/dist/_chunks/OutageList.js +1 -2
- package/dist/_chunks/OutageList.js.map +1 -1
- package/dist/_chunks/OutageUtil.js +3 -6
- package/dist/_chunks/OutageUtil.js.map +1 -1
- package/dist/_chunks/QueryClientProvider.js +1 -2
- package/dist/_chunks/QueryClientProvider.js.map +1 -1
- package/dist/_chunks/QueryClientService.js +6 -8
- package/dist/_chunks/QueryClientService.js.map +1 -1
- package/dist/_chunks/Reflect.js +1 -2
- package/dist/_chunks/Table.js +5 -10
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/TableUtil.js +2 -4
- package/dist/_chunks/TableUtil.js.map +1 -1
- package/dist/_chunks/TextFilter.js +4 -8
- package/dist/_chunks/TextFilter.js.map +1 -1
- package/dist/_chunks/UserInvitationsAdminPage.js +1 -2
- package/dist/_chunks/UserManagerUtil.js +2 -4
- package/dist/_chunks/UserManagerUtil.js.map +1 -1
- package/dist/_chunks/_baseAssignValue.js +1 -2
- package/dist/_chunks/_baseFlatten.js +1 -2
- package/dist/_chunks/_baseGet.js +1 -2
- package/dist/_chunks/_baseIteratee.js +1 -2
- package/dist/_chunks/_baseUnset.js +1 -2
- package/dist/_chunks/_cacheHas.js +1 -2
- package/dist/_chunks/_setToString.js +1 -2
- package/dist/_chunks/decorate.js +1 -2
- package/dist/_chunks/decorateParam.js +1 -2
- package/dist/_chunks/format.js +27 -54
- package/dist/_chunks/format.js.map +1 -1
- package/dist/_chunks/isArrayLike.js +1 -2
- package/dist/_chunks/isObject.js +1 -2
- package/dist/_chunks/isSymbol.js +1 -2
- package/dist/_chunks/last.js +1 -2
- package/dist/_chunks/middleware.js +2 -3
- package/dist/_chunks/middleware.js.map +1 -1
- package/dist/_chunks/omit.js +1 -2
- package/dist/_chunks/query.js +8 -15
- package/dist/_chunks/query.js.map +1 -1
- package/dist/_chunks/react.js +2 -3
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/rolldown-runtime.js +2 -3
- package/dist/_chunks/tableStore.js +171 -171
- package/dist/_chunks/tableStore.js.map +1 -1
- package/dist/_chunks/toDate.js +8 -14
- package/dist/_chunks/toDate.js.map +1 -1
- package/dist/_chunks/uniq.js +1 -2
- package/dist/_chunks/useColumnsMenu.js +3 -6
- package/dist/_chunks/useColumnsMenu.js.map +1 -1
- package/dist/_chunks/useMutation.js +2 -4
- package/dist/_chunks/useMutation.js.map +1 -1
- package/dist/_chunks/useQueryMemo.js +8 -14
- package/dist/_chunks/useQueryMemo.js.map +1 -1
- package/dist/_chunks/vanilla.js +1 -2
- package/dist/_chunks/vanilla.js.map +1 -1
- package/dist/_chunks/yup.js +2 -4
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/classes/TableEventBus/index.js +1 -2
- package/dist/classes/abstracts/FilterAbstract/index.js +1 -2
- package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
- package/dist/classes/services/AuthenticationService/index.js +0 -1
- package/dist/classes/services/AuthenticationService/index.js.map +1 -1
- package/dist/classes/services/AuthorizationService/index.js +1 -2
- package/dist/classes/services/BackendVersionService/index.js +1 -2
- package/dist/classes/services/BreadcrumbService/index.js +1 -2
- package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
- package/dist/classes/services/EmotionCacheService/index.js +1 -2
- package/dist/classes/services/FeatureFlagsService/index.js +1 -2
- package/dist/classes/services/I18nService/index.js +1 -2
- package/dist/classes/services/InactivityService/index.js +1 -2
- package/dist/classes/services/InactivityService/index.js.map +1 -1
- package/dist/classes/services/LogService/index.js +1 -2
- package/dist/classes/services/NavigationHistoryService/index.js +1 -2
- package/dist/classes/services/NotificationService/index.js +1 -2
- package/dist/classes/services/PageEventBusService/index.js +1 -2
- package/dist/classes/services/RouterService/index.js +1 -2
- package/dist/classes/services/UserSettingsService/index.js +1 -2
- package/dist/components/app/App/index.js +1 -2
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +1 -2
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +1 -2
- package/dist/components/app/AuthenticationWrapper/index.js +1 -2
- package/dist/components/app/AuthorizationWrapper/index.js +1 -2
- package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
- package/dist/components/app/RouterRoot/index.js +1 -2
- package/dist/components/epi/EpiContactDetailsDialog/index.js +1 -2
- package/dist/components/filters/BooleanFilterField/index.js +1 -2
- package/dist/components/filters/DateFilterField/index.js +1 -2
- package/dist/components/filters/GeoFilterField/index.js +1 -2
- package/dist/components/filters/MultiSelectFilterField/index.js +1 -2
- package/dist/components/filters/NumberRangeFilterField/index.js +1 -2
- package/dist/components/filters/TextFilterField/index.js +1 -2
- package/dist/components/ui/ApplicationBar/ApplicationBar.d.ts +4 -0
- package/dist/components/ui/ApplicationBar/ApplicationBarActions.d.ts +5 -0
- package/dist/components/ui/ApplicationBar/ApplicationBarNavigationMenu.d.ts +6 -0
- package/dist/components/ui/ApplicationBar/index.js +109 -95
- package/dist/components/ui/ApplicationBar/index.js.map +1 -1
- package/dist/components/ui/ApplicationFooter/ApplicationFooter.d.ts +3 -0
- package/dist/components/ui/ApplicationFooter/ApplicationFooterLink.d.ts +3 -0
- package/dist/components/ui/ApplicationFooter/ApplicationFooterLinkSection.d.ts +4 -0
- package/dist/components/ui/ConsentDialog/index.js +1 -2
- package/dist/components/ui/GenericErrorMessage/index.js +1 -2
- package/dist/components/ui/LicensesDialog/index.js +1 -2
- package/dist/components/ui/MyPermissionsDialog/index.js +1 -2
- package/dist/components/ui/NavLink/index.js +1 -2
- package/dist/components/ui/OrganizationSwitcherDialog/index.js +1 -2
- package/dist/components/ui/OutagesDialog/index.js +1 -2
- package/dist/components/ui/PageContainer/index.js +1 -2
- package/dist/components/ui/ResponseHandler/index.js +1 -2
- package/dist/components/ui/Sidebar/index.js +1 -2
- package/dist/components/ui/UserFeedbackDialog/index.js +1 -2
- package/dist/components/ui/UserInactivityConfirmation/index.js +1 -2
- package/dist/constants/api.constants.js +1 -2
- package/dist/constants/config.constants.js +1 -2
- package/dist/constants/query.constants.js +1 -2
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +1 -2
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js +1 -2
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +1 -2
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +1 -2
- package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +1 -2
- package/dist/dataHooks/useOrganizationsQuery/index.js +1 -2
- package/dist/dataHooks/useUsersQuery/index.js +1 -2
- package/dist/hoc/withPermissions/index.js +1 -2
- package/dist/hooks/useConfig/index.js +1 -2
- package/dist/hooks/useCreateMutation/index.js +1 -2
- package/dist/hooks/useDeleteMutation/index.js +1 -2
- package/dist/hooks/useEditMutation/index.js +37 -42
- package/dist/hooks/useEditMutation/index.js.map +1 -1
- package/dist/hooks/useEditMutation/useEditMutation.d.ts +1 -2
- package/dist/hooks/useInitializeTableStore/index.js +1 -2
- package/dist/hooks/useItemQuery/index.js +1 -2
- package/dist/hooks/useUpdateBreadcrumb/index.js +1 -2
- package/dist/hooks/useUpdateDocumentTitle/index.js +1 -2
- package/dist/models/admin.models.js +1 -2
- package/dist/models/admin.models.js.map +1 -1
- package/dist/models/table.models.js +1 -2
- package/dist/models/table.models.js.map +1 -1
- package/dist/pages/AcceptInvitationPage/index.js +1 -2
- package/dist/pages/AdminPage/index.js +1 -2
- package/dist/pages/ChooseIdentityProviderPage/index.js +1 -2
- package/dist/pages/ErrorPage/index.js +1 -2
- package/dist/pages/IdentifierIssuersAdminPage/index.js +1 -2
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +1 -2
- package/dist/pages/OrganizationContactsAdminPage/index.js +1 -2
- package/dist/pages/OrganizationSitesAdminPage/index.js +1 -2
- package/dist/pages/OrganizationsAdminPage/index.js +1 -2
- package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
- package/dist/pages/OutagesAdminPage/index.js +1 -2
- package/dist/pages/PostLoginPage/index.js +2 -3
- package/dist/pages/PostLoginPage/index.js.map +1 -1
- package/dist/pages/PostLogoutPage/index.js +1 -2
- package/dist/pages/RouterErrorPage/index.js +1 -2
- package/dist/pages/UsersAdminPage/index.js +1 -2
- package/dist/routes/index.js +1 -2
- package/dist/setup/setup.js +1 -2
- package/dist/stores/oidcStore/index.js +1 -2
- package/dist/stores/outagesStore/index.js +1 -2
- package/dist/theme/demoTheme/index.js +16 -9
- package/dist/theme/demoTheme/index.js.map +1 -1
- package/dist/utils/AxiosUtil/index.js +1 -2
- package/dist/utils/DataHookUtil/index.js +1 -2
- package/dist/utils/DependencyContainerUtil/index.js +0 -1
- package/dist/utils/LoadableUtil/index.js +1 -2
- package/dist/utils/MenuDataUtil/index.js +1 -2
- package/dist/utils/NotificationUtil/index.js +1 -2
- package/dist/utils/StandardConfigUtil/index.js +1 -2
- package/dist/utils/TimeUtil/index.js +1 -2
- package/dist/utils/UserUtil/index.js +1 -2
- package/package.json +25 -29
- package/dist/models/theme.models.d.ts +0 -20
- package/dist/models/theme.models.js +0 -0
package/dist/_chunks/toDate.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region ../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/constructFrom.js
|
|
7
|
-
function s(e, t) {
|
|
8
|
-
return typeof e == "function" ? e(t) : e && typeof e == "object" && o in e ? e[o](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
|
|
1
|
+
var e = 6048e5, t = 864e5, n = 6e4, r = 36e5, i = Symbol.for("constructDateFrom");
|
|
2
|
+
// ../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/constructFrom.js
|
|
3
|
+
function a(e, t) {
|
|
4
|
+
return typeof e == "function" ? e(t) : e && typeof e == "object" && i in e ? e[i](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
|
|
9
5
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return s(t || e, e);
|
|
6
|
+
// ../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/toDate.js
|
|
7
|
+
function o(e, t) {
|
|
8
|
+
return a(t || e, e);
|
|
14
9
|
}
|
|
15
|
-
|
|
16
|
-
export { r as a, i, s as n, t as o, n as r, c as t };
|
|
10
|
+
export { n as a, r as i, a as n, e as o, t as r, o as t };
|
|
17
11
|
|
|
18
12
|
//# sourceMappingURL=toDate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toDate.js","names":["
|
|
1
|
+
{"version":3,"file":"toDate.js","names":["millisecondsInWeek","millisecondsInDay","millisecondsInMinute","millisecondsInHour","constructFromSymbol","constructFrom","date","value","toDate","context","argument"],"sources":["../../../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/constants.js","../../../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/constructFrom.js","../../../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/toDate.js"],"sourcesContent":["/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n","import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate<DateType extends Date>(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n","import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n"],"ignoreList":[0,1,2],"mappings":"AA4EA,IAAaA,IAAqB,QAOrBC,IAAoB,OAOpBC,IAAuB,KAOvBC,IAAqB,MAsHrBC,IAAsB,OAAO,IAAI,mBAAmB;;AClLjE,SAAgBC,EAAc,GAAM,GAAO;CAQzC,OAPI,OAAOC,KAAS,aAAmBA,EAAKC,CAAK,IAE7CD,KAAQ,OAAOA,KAAS,YAAYF,KAAuBE,IACtDA,EAAKF,EAAoB,CAACG,CAAK,IAEpCD,aAAgB,OAAa,IAAIA,EAAK,YAAYC,CAAK,IAEpD,IAAI,KAAKA,CAAK;AACvB;;ACNA,SAAgBC,EAAO,GAAU,GAAS;CAExC,OAAOH,EAAcI,KAAWC,GAAUA,CAAQ;AACpD"}
|
package/dist/_chunks/uniq.js
CHANGED
|
@@ -2,7 +2,7 @@ import { t as e } from "./rolldown-runtime.js";
|
|
|
2
2
|
import { i as t, n, r, t as i } from "./_cacheHas.js";
|
|
3
3
|
import { o as a } from "./_baseGet.js";
|
|
4
4
|
import { n as o } from "./_baseIteratee.js";
|
|
5
|
-
|
|
5
|
+
// ../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/noop.js
|
|
6
6
|
var s = /* @__PURE__ */ e(((e, t) => {
|
|
7
7
|
function n() {}
|
|
8
8
|
t.exports = n;
|
|
@@ -38,7 +38,6 @@ var s = /* @__PURE__ */ e(((e, t) => {
|
|
|
38
38
|
}
|
|
39
39
|
t.exports = r;
|
|
40
40
|
}));
|
|
41
|
-
//#endregion
|
|
42
41
|
export { l as n, s as r, u as t };
|
|
43
42
|
|
|
44
43
|
//# sourceMappingURL=uniq.js.map
|
|
@@ -9,7 +9,7 @@ import u from "@mui/icons-material/CheckBoxOutlined";
|
|
|
9
9
|
import d from "@mui/icons-material/CheckBoxOutlineBlankOutlined";
|
|
10
10
|
import f from "@mui/icons-material/ToggleOffOutlined";
|
|
11
11
|
import p from "@mui/icons-material/ToggleOnOutlined";
|
|
12
|
-
|
|
12
|
+
// ../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_immer@11.2.9_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla/shallow.mjs
|
|
13
13
|
var m = (e) => Symbol.iterator in e, h = (e) => "entries" in e, g = (e, t) => {
|
|
14
14
|
let n = e instanceof Map ? e : new Map(e.entries()), r = t instanceof Map ? t : new Map(t.entries());
|
|
15
15
|
if (n.size !== r.size) return !1;
|
|
@@ -26,8 +26,7 @@ var m = (e) => Symbol.iterator in e, h = (e) => "entries" in e, g = (e, t) => {
|
|
|
26
26
|
function v(e, t) {
|
|
27
27
|
return Object.is(e, t) ? !0 : typeof e != "object" || !e || typeof t != "object" || !t || Object.getPrototypeOf(e) !== Object.getPrototypeOf(t) ? !1 : m(e) && m(t) ? h(e) && h(t) ? g(e, t) : _(e, t) : g({ entries: () => Object.entries(e) }, { entries: () => Object.entries(t) });
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
//#region ../../node_modules/.pnpm/zustand@5.0.15_@types+react@19.3.0_immer@11.1.21_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/react/shallow.mjs
|
|
29
|
+
// ../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_immer@11.2.9_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/react/shallow.mjs
|
|
31
30
|
function y(e) {
|
|
32
31
|
let t = i.useRef(void 0);
|
|
33
32
|
return (n) => {
|
|
@@ -35,8 +34,7 @@ function y(e) {
|
|
|
35
34
|
return v(t.current, r) ? t.current : t.current = r;
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
//#region src/hooks/useColumnsMenu/useColumnsMenu.tsx
|
|
37
|
+
// src/hooks/useColumnsMenu/useColumnsMenu.tsx
|
|
40
38
|
var b = ({ hasCellData: i }) => {
|
|
41
39
|
let m = r(), h = t(m, y((e) => e.emitEvent)), g = t(m, y((e) => e.columns)), _ = t(m, y((e) => e.dataContext)), v = t(m, y((e) => e.getCurrentColumnVisualSettings().filter((e) => e.isVisible).map((e) => e.id))), b = t(m, y((e) => e.columnDimensions)), x = t(m, y((e) => e.isCondensed)), S = t(m, y((e) => e.sortedData)), { t: C } = c(), w = o(() => g.some((e) => e.cellColorGetter), [g]), T = a(() => {
|
|
42
40
|
h("openColumnsEditorDialog", i);
|
|
@@ -154,7 +152,6 @@ var b = ({ hasCellData: i }) => {
|
|
|
154
152
|
E
|
|
155
153
|
]);
|
|
156
154
|
};
|
|
157
|
-
//#endregion
|
|
158
155
|
export { y as n, b as t };
|
|
159
156
|
|
|
160
157
|
//# sourceMappingURL=useColumnsMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColumnsMenu.js","names":["TableUtil","produce","useTableStoreContext","React","IndeterminateCheckBoxIcon","CheckBoxOutlinedIcon","CheckBoxOutlineBlankOutlinedIcon","ToggleOffOutlinedIcon","ToggleOnOutlinedIcon","isIterable","obj","hasIterableEntries","value","compareEntries","mapA","valueA","mapB","valueB","key","compareIterables","iteratorA","iteratorB","nextA","nextB","shallow","useShallow","prev","next","selector","state","useColumnsMenu","tableStore","emitTableEvent","useStore","tableColumns","dataContext","visibleColumnIds","c","columnDimensions","isCondensed","sortedData","useTranslation","isCondensingSupported","useMemo","onColumnsEditorMenuItemClick","useCallback","hasCellData","toggleItem","newVisibleColumnIds","draft","columnId","toggleDimension","areAllVisible","dimensionColumnIds","onHideColumnsWithoutDataClick","onIsCondensedMenuItemClick","items","jsx","x","columnDimension","areSomeVisible","checked","column","t"],"sources":["../../../../node_modules/.pnpm/zustand@5.0.15_@types+react@19.3.0_immer@11.1.21_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla/shallow.mjs","../../../../node_modules/.pnpm/zustand@5.0.15_@types+react@19.3.0_immer@11.1.21_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/react/shallow.mjs","../../src/hooks/useColumnsMenu/useColumnsMenu.tsx"],"sourcesContent":["const isIterable = (obj) => Symbol.iterator in obj;\nconst hasIterableEntries = (value) => (\n // HACK: avoid checking entries type\n \"entries\" in value\n);\nconst compareEntries = (valueA, valueB) => {\n const mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());\n const mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());\n if (mapA.size !== mapB.size) {\n return false;\n }\n for (const [key, value] of mapA) {\n if (!mapB.has(key) || !Object.is(value, mapB.get(key))) {\n return false;\n }\n }\n return true;\n};\nconst compareIterables = (valueA, valueB) => {\n const iteratorA = valueA[Symbol.iterator]();\n const iteratorB = valueB[Symbol.iterator]();\n let nextA = iteratorA.next();\n let nextB = iteratorB.next();\n while (!nextA.done && !nextB.done) {\n if (!Object.is(nextA.value, nextB.value)) {\n return false;\n }\n nextA = iteratorA.next();\n nextB = iteratorB.next();\n }\n return !!nextA.done && !!nextB.done;\n};\nfunction shallow(valueA, valueB) {\n if (Object.is(valueA, valueB)) {\n return true;\n }\n if (typeof valueA !== \"object\" || valueA === null || typeof valueB !== \"object\" || valueB === null) {\n return false;\n }\n if (Object.getPrototypeOf(valueA) !== Object.getPrototypeOf(valueB)) {\n return false;\n }\n if (isIterable(valueA) && isIterable(valueB)) {\n if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {\n return compareEntries(valueA, valueB);\n }\n return compareIterables(valueA, valueB);\n }\n return compareEntries(\n { entries: () => Object.entries(valueA) },\n { entries: () => Object.entries(valueB) }\n );\n}\n\nexport { shallow };\n","import React from 'react';\nimport { shallow } from 'zustand/vanilla/shallow';\n\nfunction useShallow(selector) {\n const prev = React.useRef(void 0);\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n","import { produce } from 'immer';\nimport { useStore } from 'zustand';\nimport { useShallow } from 'zustand/shallow';\nimport CheckBoxOutlinedIcon from '@mui/icons-material/CheckBoxOutlined';\nimport CheckBoxOutlineBlankOutlinedIcon from '@mui/icons-material/CheckBoxOutlineBlankOutlined';\nimport ToggleOffOutlinedIcon from '@mui/icons-material/ToggleOffOutlined';\nimport ToggleOnOutlinedIcon from '@mui/icons-material/ToggleOnOutlined';\nimport IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';\nimport {\n useCallback,\n useMemo,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport type { MenuItemData } from '@gen-epix/ui-core-components/models/nested-menu.models';\n\nimport type { HasCellDataFn } from '../../models/table.models';\nimport { useTableStoreContext } from '../../stores/tableStore';\nimport { TableUtil } from '../../utils/TableUtil';\n\n\nexport type UseColumnsMenuProps<TRowData, TDataContext = null> = {\n readonly hasCellData?: HasCellDataFn<TRowData, TDataContext>;\n};\n\nexport const useColumnsMenu = <TRowData, TDataContext = null>({ hasCellData }: UseColumnsMenuProps<TRowData, TDataContext>): MenuItemData => {\n const tableStore = useTableStoreContext<TRowData, TDataContext>();\n const emitTableEvent = useStore(tableStore, useShallow((state) => state.emitEvent));\n const tableColumns = useStore(tableStore, useShallow((state) => state.columns));\n const dataContext = useStore(tableStore, useShallow((state) => state.dataContext));\n const visibleColumnIds = useStore(tableStore, useShallow((state) => state.getCurrentColumnVisualSettings().filter(c => c.isVisible).map(c => c.id)));\n const columnDimensions = useStore(tableStore, useShallow((state) => state.columnDimensions));\n const isCondensed = useStore(tableStore, useShallow((state) => state.isCondensed));\n const sortedData = useStore(tableStore, useShallow((state) => state.sortedData));\n const { t } = useTranslation();\n\n const isCondensingSupported = useMemo(() => {\n return tableColumns.some(c => c.cellColorGetter);\n }, [tableColumns]);\n\n const onColumnsEditorMenuItemClick = useCallback(() => {\n emitTableEvent('openColumnsEditorDialog', hasCellData);\n }, [emitTableEvent, hasCellData]);\n\n const toggleItem = useCallback((columnId: string): void => {\n const newVisibleColumnIds = produce(visibleColumnIds, (draft) => {\n if (draft.includes(columnId)) {\n return draft.filter(c => c !== columnId);\n }\n draft.push(columnId);\n return draft;\n });\n emitTableEvent('columnVisibilityChange', newVisibleColumnIds);\n }, [emitTableEvent, visibleColumnIds]);\n\n const toggleDimension = useCallback((dimensionColumnIds: string[]): void => {\n const areAllVisible = dimensionColumnIds.every(columnId => visibleColumnIds.includes(columnId));\n const newVisibleColumnIds = produce(visibleColumnIds, (draft) => {\n if (areAllVisible) {\n return draft.filter(c => !dimensionColumnIds.includes(c));\n }\n dimensionColumnIds.forEach((columnId) => {\n if (!draft.includes(columnId)) {\n draft.push(columnId);\n }\n });\n return draft;\n });\n emitTableEvent('columnVisibilityChange', newVisibleColumnIds);\n }, [emitTableEvent, visibleColumnIds]);\n\n const onHideColumnsWithoutDataClick = useCallback(() => {\n emitTableEvent('columnVisibilityChange', TableUtil.getColumnIdsWithData<TRowData, TDataContext>({\n dataContext,\n hasCellData,\n sortedData,\n tableColumns,\n visibleColumnIds,\n }));\n\n }, [emitTableEvent, hasCellData, sortedData, tableColumns, visibleColumnIds, dataContext]);\n\n const onIsCondensedMenuItemClick = useCallback(() => {\n emitTableEvent('condensedChange', !isCondensed);\n }, [emitTableEvent, isCondensed]);\n\n const menuItemData: MenuItemData = useMemo(() => {\n const items: MenuItemData[] = [\n isCondensingSupported ? {\n autoCloseDisabled: true,\n callback: () => onIsCondensedMenuItemClick(),\n checked: isCondensed ? 'true' : 'false',\n divider: true,\n label: t`Condensed`,\n rightIcon: isCondensed ? <ToggleOnOutlinedIcon /> : <ToggleOffOutlinedIcon />,\n } : undefined,\n {\n callback: () => onColumnsEditorMenuItemClick(),\n divider: true,\n label: t`Change order / visibility`,\n },\n {\n autoCloseDisabled: true,\n callback: () => emitTableEvent('reset'),\n label: t`Reset`,\n },\n {\n autoCloseDisabled: true,\n callback: () => {\n emitTableEvent('columnVisibilityChange', [...tableColumns.map(c => c.id)]);\n },\n label: t`Show all`,\n },\n {\n autoCloseDisabled: true,\n callback: () => {\n emitTableEvent('columnVisibilityChange', [...tableColumns.filter(c => c.frozen).map(c => c.id)]);\n },\n label: t`Hide all`,\n },\n {\n autoCloseDisabled: true,\n callback: () => onHideColumnsWithoutDataClick(),\n divider: true,\n label: t`Hide columns without data`,\n },\n ].filter(x => x) as MenuItemData[];\n\n if (columnDimensions) {\n columnDimensions.forEach((columnDimension) => {\n const areAllVisible = columnDimension.columnIds.every(columnId => visibleColumnIds.includes(columnId));\n const areSomeVisible = columnDimension.columnIds.some(columnId => visibleColumnIds.includes(columnId));\n items.push({\n autoCloseDisabled: true,\n callback: () => toggleDimension(columnDimension.columnIds),\n // eslint-disable-next-line no-nested-ternary\n checked: areAllVisible ? 'true' : areSomeVisible ? 'mixed' : 'false',\n items: columnDimension.columnIds.map((columnId) => {\n const checked = visibleColumnIds.includes(columnId);\n return {\n autoCloseDisabled: true,\n callback: () => toggleItem(columnId),\n checked: checked ? 'true' : 'false',\n label: tableColumns.find(c => c.id === columnId)?.headerName ?? '',\n rightIcon: checked ? <CheckBoxOutlinedIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n };\n }),\n label: columnDimension.label,\n // eslint-disable-next-line no-nested-ternary\n rightIcon: areAllVisible ? <CheckBoxOutlinedIcon /> : areSomeVisible ? <IndeterminateCheckBoxIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n });\n });\n } else {\n tableColumns.filter(c => !c.frozen).forEach((column) => {\n const checked = visibleColumnIds.includes(column.id);\n items.push({\n autoCloseDisabled: true,\n callback: () => toggleItem(column.id),\n checked: checked ? 'true' : 'false',\n label: column.headerName,\n rightIcon: checked ? <CheckBoxOutlinedIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n });\n });\n }\n\n return {\n items,\n label: t`Columns`,\n };\n }, [isCondensed, isCondensingSupported, t, columnDimensions, onIsCondensedMenuItemClick, onColumnsEditorMenuItemClick, emitTableEvent, tableColumns, onHideColumnsWithoutDataClick, visibleColumnIds, toggleDimension, toggleItem]);\n\n return menuItemData;\n};\n"],"ignoreList":[0,1],"mappings":";;;;;;;;;;;;AAAA,IAAMS,KAAc,MAAQ,OAAO,YAAYC,GACzCC,KAAsB,MAE1B,aAAaC,GAETC,KAAkB,GAAQ,MAAW;CACzC,IAAMC,IAAOC,aAAkB,MAAMA,IAAS,IAAI,IAAIA,EAAO,QAAQ,CAAC,GAChEC,IAAOC,aAAkB,MAAMA,IAAS,IAAI,IAAIA,EAAO,QAAQ,CAAC;CACtE,IAAIH,EAAK,SAASE,EAAK,MACrB,OAAO;CAET,KAAK,IAAM,CAACE,GAAKN,MAAUE,GACzB,IAAI,CAACE,EAAK,IAAIE,CAAG,KAAK,CAAC,OAAO,GAAGN,GAAOI,EAAK,IAAIE,CAAG,CAAC,GACnD,OAAO;CAGX,OAAO;AACT,GACMC,KAAoB,GAAQ,MAAW;CAC3C,IAAMC,IAAYL,EAAO,OAAO,SAAS,CAAC,GACpCM,IAAYJ,EAAO,OAAO,SAAS,CAAC,GACtCK,IAAQF,EAAU,KAAK,GACvBG,IAAQF,EAAU,KAAK;CAC3B,OAAO,CAACC,EAAM,QAAQ,CAACC,EAAM,OAAM;EACjC,IAAI,CAAC,OAAO,GAAGD,EAAM,OAAOC,EAAM,KAAK,GACrC,OAAO;EAGT,AADA,IAAQH,EAAU,KAAK,GACvB,IAAQC,EAAU,KAAK;CACzB;CACA,OAAO,CAAC,CAACC,EAAM,QAAQ,CAAC,CAACC,EAAM;AACjC;AACA,SAASC,EAAQ,GAAQ,GAAQ;CAgB/B,OAfI,OAAO,GA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;IAEvB,WAA2BF,EAAhBL,IAAiB/C,IAA0BuD,IAAkBxD,IAAgCE,GAA7E,CAAuB,CAAwF;GAC5I,CAAC;EACH,CAAC,IAED4B,EAAa,QAAO,MAAK,CAACG,EAAE,MAAM,CAAC,CAAC,SAAS,MAAW;GACtD,IAAMwB,IAAUzB,EAAiB,SAAS0B,EAAO,EAAE;GACnD,EAAM,KAAK;IACT,mBAAmB;IACnB,gBAAgBf,EAAWe,EAAO,EAAE;IACpC,SAASD,IAAU,SAAS;IAC5B,OAAOC,EAAO;IACd,WAAqBL,EAAVI,IAAWxD,IAA2BC,GAA5B,CAAuB,CAAuC;GACrF,CAAC;EACH,CAAC,GAGI;GACL;GACA,OAAO,CAAC;EACV;CACF,GAAG;EAACiC;EAAaG;EAAuBqB;EAAGzB;EAAkBiB;EAA4BX;EAA8BZ;EAAgBE;EAAcoB;EAA+BlB;EAAkBe;EAAiBJ;CAAU,CAE1N;AACT"}
|
|
1
|
+
{"version":3,"file":"useColumnsMenu.js","names":["TableUtil","produce","useTableStoreContext","React","IndeterminateCheckBoxIcon","CheckBoxOutlinedIcon","CheckBoxOutlineBlankOutlinedIcon","ToggleOffOutlinedIcon","ToggleOnOutlinedIcon","isIterable","obj","hasIterableEntries","value","compareEntries","mapA","valueA","mapB","valueB","key","compareIterables","iteratorA","iteratorB","nextA","nextB","shallow","useShallow","prev","next","selector","state","useColumnsMenu","tableStore","emitTableEvent","useStore","tableColumns","dataContext","visibleColumnIds","c","columnDimensions","isCondensed","sortedData","useTranslation","isCondensingSupported","useMemo","onColumnsEditorMenuItemClick","useCallback","hasCellData","toggleItem","newVisibleColumnIds","draft","columnId","toggleDimension","areAllVisible","dimensionColumnIds","onHideColumnsWithoutDataClick","onIsCondensedMenuItemClick","items","jsx","x","columnDimension","areSomeVisible","checked","column","t"],"sources":["../../../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_immer@11.2.9_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/vanilla/shallow.mjs","../../../../node_modules/.pnpm/zustand@5.0.16_@types+react@19.3.0_immer@11.2.9_react@19.3.1_use-sync-external-store@1.7.0_react@19.3.1_/node_modules/zustand/esm/react/shallow.mjs","../../src/hooks/useColumnsMenu/useColumnsMenu.tsx"],"sourcesContent":["const isIterable = (obj) => Symbol.iterator in obj;\nconst hasIterableEntries = (value) => (\n // HACK: avoid checking entries type\n \"entries\" in value\n);\nconst compareEntries = (valueA, valueB) => {\n const mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());\n const mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());\n if (mapA.size !== mapB.size) {\n return false;\n }\n for (const [key, value] of mapA) {\n if (!mapB.has(key) || !Object.is(value, mapB.get(key))) {\n return false;\n }\n }\n return true;\n};\nconst compareIterables = (valueA, valueB) => {\n const iteratorA = valueA[Symbol.iterator]();\n const iteratorB = valueB[Symbol.iterator]();\n let nextA = iteratorA.next();\n let nextB = iteratorB.next();\n while (!nextA.done && !nextB.done) {\n if (!Object.is(nextA.value, nextB.value)) {\n return false;\n }\n nextA = iteratorA.next();\n nextB = iteratorB.next();\n }\n return !!nextA.done && !!nextB.done;\n};\nfunction shallow(valueA, valueB) {\n if (Object.is(valueA, valueB)) {\n return true;\n }\n if (typeof valueA !== \"object\" || valueA === null || typeof valueB !== \"object\" || valueB === null) {\n return false;\n }\n if (Object.getPrototypeOf(valueA) !== Object.getPrototypeOf(valueB)) {\n return false;\n }\n if (isIterable(valueA) && isIterable(valueB)) {\n if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {\n return compareEntries(valueA, valueB);\n }\n return compareIterables(valueA, valueB);\n }\n return compareEntries(\n { entries: () => Object.entries(valueA) },\n { entries: () => Object.entries(valueB) }\n );\n}\n\nexport { shallow };\n","import React from 'react';\nimport { shallow } from 'zustand/vanilla/shallow';\n\nfunction useShallow(selector) {\n const prev = React.useRef(void 0);\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n","import { produce } from 'immer';\nimport { useStore } from 'zustand';\nimport { useShallow } from 'zustand/shallow';\nimport CheckBoxOutlinedIcon from '@mui/icons-material/CheckBoxOutlined';\nimport CheckBoxOutlineBlankOutlinedIcon from '@mui/icons-material/CheckBoxOutlineBlankOutlined';\nimport ToggleOffOutlinedIcon from '@mui/icons-material/ToggleOffOutlined';\nimport ToggleOnOutlinedIcon from '@mui/icons-material/ToggleOnOutlined';\nimport IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';\nimport {\n useCallback,\n useMemo,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport type { MenuItemData } from '@gen-epix/ui-core-components/models/nested-menu.models';\n\nimport type { HasCellDataFn } from '../../models/table.models';\nimport { useTableStoreContext } from '../../stores/tableStore';\nimport { TableUtil } from '../../utils/TableUtil';\n\n\nexport type UseColumnsMenuProps<TRowData, TDataContext = null> = {\n readonly hasCellData?: HasCellDataFn<TRowData, TDataContext>;\n};\n\nexport const useColumnsMenu = <TRowData, TDataContext = null>({ hasCellData }: UseColumnsMenuProps<TRowData, TDataContext>): MenuItemData => {\n const tableStore = useTableStoreContext<TRowData, TDataContext>();\n const emitTableEvent = useStore(tableStore, useShallow((state) => state.emitEvent));\n const tableColumns = useStore(tableStore, useShallow((state) => state.columns));\n const dataContext = useStore(tableStore, useShallow((state) => state.dataContext));\n const visibleColumnIds = useStore(tableStore, useShallow((state) => state.getCurrentColumnVisualSettings().filter(c => c.isVisible).map(c => c.id)));\n const columnDimensions = useStore(tableStore, useShallow((state) => state.columnDimensions));\n const isCondensed = useStore(tableStore, useShallow((state) => state.isCondensed));\n const sortedData = useStore(tableStore, useShallow((state) => state.sortedData));\n const { t } = useTranslation();\n\n const isCondensingSupported = useMemo(() => {\n return tableColumns.some(c => c.cellColorGetter);\n }, [tableColumns]);\n\n const onColumnsEditorMenuItemClick = useCallback(() => {\n emitTableEvent('openColumnsEditorDialog', hasCellData);\n }, [emitTableEvent, hasCellData]);\n\n const toggleItem = useCallback((columnId: string): void => {\n const newVisibleColumnIds = produce(visibleColumnIds, (draft) => {\n if (draft.includes(columnId)) {\n return draft.filter(c => c !== columnId);\n }\n draft.push(columnId);\n return draft;\n });\n emitTableEvent('columnVisibilityChange', newVisibleColumnIds);\n }, [emitTableEvent, visibleColumnIds]);\n\n const toggleDimension = useCallback((dimensionColumnIds: string[]): void => {\n const areAllVisible = dimensionColumnIds.every(columnId => visibleColumnIds.includes(columnId));\n const newVisibleColumnIds = produce(visibleColumnIds, (draft) => {\n if (areAllVisible) {\n return draft.filter(c => !dimensionColumnIds.includes(c));\n }\n dimensionColumnIds.forEach((columnId) => {\n if (!draft.includes(columnId)) {\n draft.push(columnId);\n }\n });\n return draft;\n });\n emitTableEvent('columnVisibilityChange', newVisibleColumnIds);\n }, [emitTableEvent, visibleColumnIds]);\n\n const onHideColumnsWithoutDataClick = useCallback(() => {\n emitTableEvent('columnVisibilityChange', TableUtil.getColumnIdsWithData<TRowData, TDataContext>({\n dataContext,\n hasCellData,\n sortedData,\n tableColumns,\n visibleColumnIds,\n }));\n\n }, [emitTableEvent, hasCellData, sortedData, tableColumns, visibleColumnIds, dataContext]);\n\n const onIsCondensedMenuItemClick = useCallback(() => {\n emitTableEvent('condensedChange', !isCondensed);\n }, [emitTableEvent, isCondensed]);\n\n const menuItemData: MenuItemData = useMemo(() => {\n const items: MenuItemData[] = [\n isCondensingSupported ? {\n autoCloseDisabled: true,\n callback: () => onIsCondensedMenuItemClick(),\n checked: isCondensed ? 'true' : 'false',\n divider: true,\n label: t`Condensed`,\n rightIcon: isCondensed ? <ToggleOnOutlinedIcon /> : <ToggleOffOutlinedIcon />,\n } : undefined,\n {\n callback: () => onColumnsEditorMenuItemClick(),\n divider: true,\n label: t`Change order / visibility`,\n },\n {\n autoCloseDisabled: true,\n callback: () => emitTableEvent('reset'),\n label: t`Reset`,\n },\n {\n autoCloseDisabled: true,\n callback: () => {\n emitTableEvent('columnVisibilityChange', [...tableColumns.map(c => c.id)]);\n },\n label: t`Show all`,\n },\n {\n autoCloseDisabled: true,\n callback: () => {\n emitTableEvent('columnVisibilityChange', [...tableColumns.filter(c => c.frozen).map(c => c.id)]);\n },\n label: t`Hide all`,\n },\n {\n autoCloseDisabled: true,\n callback: () => onHideColumnsWithoutDataClick(),\n divider: true,\n label: t`Hide columns without data`,\n },\n ].filter(x => x) as MenuItemData[];\n\n if (columnDimensions) {\n columnDimensions.forEach((columnDimension) => {\n const areAllVisible = columnDimension.columnIds.every(columnId => visibleColumnIds.includes(columnId));\n const areSomeVisible = columnDimension.columnIds.some(columnId => visibleColumnIds.includes(columnId));\n items.push({\n autoCloseDisabled: true,\n callback: () => toggleDimension(columnDimension.columnIds),\n // eslint-disable-next-line no-nested-ternary\n checked: areAllVisible ? 'true' : areSomeVisible ? 'mixed' : 'false',\n items: columnDimension.columnIds.map((columnId) => {\n const checked = visibleColumnIds.includes(columnId);\n return {\n autoCloseDisabled: true,\n callback: () => toggleItem(columnId),\n checked: checked ? 'true' : 'false',\n label: tableColumns.find(c => c.id === columnId)?.headerName ?? '',\n rightIcon: checked ? <CheckBoxOutlinedIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n };\n }),\n label: columnDimension.label,\n // eslint-disable-next-line no-nested-ternary\n rightIcon: areAllVisible ? <CheckBoxOutlinedIcon /> : areSomeVisible ? <IndeterminateCheckBoxIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n });\n });\n } else {\n tableColumns.filter(c => !c.frozen).forEach((column) => {\n const checked = visibleColumnIds.includes(column.id);\n items.push({\n autoCloseDisabled: true,\n callback: () => toggleItem(column.id),\n checked: checked ? 'true' : 'false',\n label: column.headerName,\n rightIcon: checked ? <CheckBoxOutlinedIcon /> : <CheckBoxOutlineBlankOutlinedIcon />,\n });\n });\n }\n\n return {\n items,\n label: t`Columns`,\n };\n }, [isCondensed, isCondensingSupported, t, columnDimensions, onIsCondensedMenuItemClick, onColumnsEditorMenuItemClick, emitTableEvent, tableColumns, onHideColumnsWithoutDataClick, visibleColumnIds, toggleDimension, toggleItem]);\n\n return menuItemData;\n};\n"],"ignoreList":[0,1],"mappings":";;;;;;;;;;;;AAAA,IAAMS,KAAc,MAAQ,OAAO,YAAYC,GACzCC,KAAsB,MAE1B,aAAaC,GAETC,KAAkB,GAAQ,MAAW;CACzC,IAAMC,IAAOC,aAAkB,MAAMA,IAAS,IAAI,IAAIA,EAAO,QAAQ,CAAC,GAChEC,IAAOC,aAAkB,MAAMA,IAAS,IAAI,IAAIA,EAAO,QAAQ,CAAC;CACtE,IAAIH,EAAK,SAASE,EAAK,MACrB,OAAO;CAET,KAAK,IAAM,CAACE,GAAKN,MAAUE,GACzB,IAAI,CAACE,EAAK,IAAIE,CAAG,KAAK,CAAC,OAAO,GAAGN,GAAOI,EAAK,IAAIE,CAAG,CAAC,GACnD,OAAO;CAGX,OAAO;AACT,GACMC,KAAoB,GAAQ,MAAW;CAC3C,IAAMC,IAAYL,EAAO,OAAO,SAAS,CAAC,GACpCM,IAAYJ,EAAO,OAAO,SAAS,CAAC,GACtCK,IAAQF,EAAU,KAAK,GACvBG,IAAQF,EAAU,KAAK;CAC3B,OAAO,CAACC,EAAM,QAAQ,CAACC,EAAM,OAAM;EACjC,IAAI,CAAC,OAAO,GAAGD,EAAM,OAAOC,EAAM,KAAK,GACrC,OAAO;EAGT,AADA,IAAQH,EAAU,KAAK,GACvB,IAAQC,EAAU,KAAK;CACzB;CACA,OAAO,CAAC,CAACC,EAAM,QAAQ,CAAC,CAACC,EAAM;AACjC;AACA,SAASC,EAAQ,GAAQ,GAAQ;CAgB/B,OAfI,OAAO,GAAGT,GAAQE,CAAM,IACnB,KAEL,OAAOF,KAAW,aAAYA,KAAmB,OAAOE,KAAW,aAAYA,KAG/E,OAAO,eAAeF,CAAM,MAAM,OAAO,eAAeE,CAAM,IACzD,KAELR,EAAWM,CAAM,KAAKN,EAAWQ,CAAM,IACrCN,EAAmBI,CAAM,KAAKJ,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S0B,EAAO,EAAE;GACnD,EAAM,KAAK;IACT,mBAAmB;IACnB,gBAAgBf,EAAWe,EAAO,EAAE;IACpC,SAASD,IAAU,SAAS;IAC5B,OAAOC,EAAO;IACd,WAAqBL,EAAVI,IAAWxD,IAA2BC,GAA5B,CAAuB,CAAuC;GACrF,CAAC;EACH,CAAC,GAGI;GACL;GACA,OAAO,CAAC;EACV;CACF,GAAG;EAACiC;EAAaG;EAAuBqB;EAAGzB;EAAkBiB;EAA4BX;EAA8BZ;EAAgBE;EAAcoB;EAA+BlB;EAAkBe;EAAiBJ;CAAU,CAE1N;AACT"}
|
|
@@ -2,7 +2,7 @@ import { n as e } from "./QueryClientProvider.js";
|
|
|
2
2
|
import { b as t, c as n, d as r, g as i, o as a, x as o } from "./query.js";
|
|
3
3
|
import { n as s } from "./QueryClientService.js";
|
|
4
4
|
import * as c from "react";
|
|
5
|
-
|
|
5
|
+
// ../../node_modules/.pnpm/@tanstack+query-core@5.105.0/node_modules/@tanstack/query-core/build/modern/mutationObserver.js
|
|
6
6
|
var l = class extends n {
|
|
7
7
|
#e;
|
|
8
8
|
#t = void 0;
|
|
@@ -91,8 +91,7 @@ var l = class extends n {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
-
|
|
95
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.104.2_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useMutation.js
|
|
94
|
+
// ../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useMutation.js
|
|
96
95
|
function u(t, n) {
|
|
97
96
|
let r = e(n), [s] = c.useState(() => new l(r, t));
|
|
98
97
|
c.useEffect(() => {
|
|
@@ -108,7 +107,6 @@ function u(t, n) {
|
|
|
108
107
|
mutateAsync: u.mutate
|
|
109
108
|
};
|
|
110
109
|
}
|
|
111
|
-
//#endregion
|
|
112
110
|
export { u as t };
|
|
113
111
|
|
|
114
112
|
//# sourceMappingURL=useMutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutation.js","names":["React","useQueryClient","shallowEqualObjects","Subscribable","hashKey","noop","notifyManager","shouldThrowError","getDefaultState","React$1","MutationObserver","#client","client","options","#updateResult","prevOptions","#currentMutation","#notify","action","#currentResult","#mutateOptions","variables","state","mutateOptions","onMutateResult","context","useMutation","queryClient","observer","result","onStoreChange","mutate","args"],"sources":["../../../../node_modules/.pnpm/@tanstack+query-core@5.104.2/node_modules/@tanstack/query-core/build/modern/mutationObserver.js","../../../../node_modules/.pnpm/@tanstack+react-query@5.104.2_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useMutation.js"],"sourcesContent":["import { hashKey, shallowEqualObjects } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { getDefaultState } from \"./mutation.js\";\n//#region src/mutationObserver.ts\n/**\n* Observes a single mutation and derives a `MutationObserverResult` from it.\n* A framework hook like `useMutation` creates one `MutationObserver` per hook\n* call, keeps it stable across re-renders, calls `setOptions` when the options\n* passed to the hook change, subscribes to it to re-render on updates, and\n* reads `getCurrentResult()` for the value to return. Calling `mutate()`\n* builds a new underlying `Mutation` in the `MutationCache` and executes it.\n* @example\n* ```ts\n* const observer = new MutationObserver(queryClient, {\n* mutationFn: (variables: { title: string }) => addPost(variables),\n* })\n* ```\n*/\nvar MutationObserver = class extends Subscribable {\n\t#client;\n\t#currentResult = void 0;\n\t#currentMutation;\n\t#mutateOptions;\n\tconstructor(client, options) {\n\t\tsuper();\n\t\tthis.#client = client;\n\t\tthis.setOptions(options);\n\t\tthis.bindMethods();\n\t\tthis.#updateResult();\n\t}\n\t/**\n\t* Binds the methods of the result (`mutate` and `reset`) to the observer, so they keep working when\n\t* destructured from it.\n\t*/\n\tbindMethods() {\n\t\tthis.mutate = this.mutate.bind(this);\n\t\tthis.reset = this.reset.bind(this);\n\t}\n\t/**\n\t* Updates the observer's options.\n\t*\n\t* If the new `mutationKey` differs from the previous one (and both were\n\t* defined), the observer is reset, detaching it from the mutation it was\n\t* observing. Otherwise, if the currently observed mutation is still\n\t* `pending`, its options are updated in place as well.\n\t* @param options - The new mutation observer options. They are defaulted with {@link\n\t* QueryClient#defaultMutationOptions} before being applied.\n\t* @example\n\t* ```ts\n\t* observer.setOptions({\n\t* mutationFn: (variables: { title: string }) => addPost(variables),\n\t* onSuccess: (data) => console.log(data),\n\t* })\n\t* ```\n\t*/\n\tsetOptions(options) {\n\t\tconst prevOptions = this.options;\n\t\tthis.options = this.#client.defaultMutationOptions(options);\n\t\tif (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({\n\t\t\ttype: \"observerOptionsUpdated\",\n\t\t\tmutation: this.#currentMutation,\n\t\t\tobserver: this\n\t\t});\n\t\tif (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset();\n\t\telse if (this.#currentMutation?.state.status === \"pending\") this.#currentMutation.setOptions(this.options);\n\t}\n\tonSubscribe() {\n\t\tif (this.listeners.size === 1 && this.#currentMutation) {\n\t\t\tthis.#currentMutation.addObserver(this);\n\t\t\tthis.#updateResult();\n\t\t}\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) this.#currentMutation?.removeObserver(this);\n\t}\n\t/**\n\t* Updates the observer's result when the observed mutation changes, and notifies its listeners.\n\t* @internal\n\t* @param action - The action that updated the observed mutation, passed on to the observer's\n\t* callbacks.\n\t*/\n\tonMutationUpdate(action) {\n\t\tthis.#updateResult();\n\t\tthis.#notify(action);\n\t}\n\t/**\n\t* Returns the observer's current result, derived from the observed\n\t* mutation's state (or the default, `idle` state if no mutation has been\n\t* built yet, e.g. before the first `mutate()` call or after `reset()`).\n\t* @returns The observer's latest result.\n\t*/\n\tgetCurrentResult() {\n\t\treturn this.#currentResult;\n\t}\n\t/**\n\t* Detaches the observer from the mutation it is currently observing (if\n\t* any) and resets the observed result back to its default, `idle` state.\n\t*\n\t* This does not cancel an in-flight mutation; the mutation itself keeps\n\t* running to completion and its own callbacks still fire, but this\n\t* observer stops reflecting its state and a subsequent `mutate()` call\n\t* will build a brand new mutation.\n\t* @see {@link MutationObserver#mutate}\n\t* @example\n\t* ```ts\n\t* observer.reset()\n\t* ```\n\t*/\n\treset() {\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = void 0;\n\t\tthis.#updateResult();\n\t\tthis.#notify();\n\t}\n\t/**\n\t* Builds a new `Mutation` in the `MutationCache` using the observer's\n\t* current options, detaches this observer from any previously observed\n\t* mutation, attaches it to the new one, and executes it with the given\n\t* variables.\n\t*\n\t* The optional per-call `options` (`onSuccess`/`onError`/`onSettled`) are\n\t* invoked once the mutation settles, in addition to any callbacks defined\n\t* on the observer's own options.\n\t* @param variables - The variables passed to the `mutationFn`.\n\t* @param options - Per-call `onSuccess`, `onError`, and `onSettled` callbacks.\n\t* @returns A promise that resolves with the mutation's data, or rejects with its error.\n\t* @example\n\t* ```ts\n\t* await observer.mutate(\n\t* { title: 'New post' },\n\t* { onSuccess: (data) => console.log(data) },\n\t* )\n\t* ```\n\t*/\n\tmutate(variables, options) {\n\t\tthis.#mutateOptions = options;\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);\n\t\tthis.#currentMutation.addObserver(this);\n\t\treturn this.#currentMutation.execute(variables);\n\t}\n\t#updateResult() {\n\t\tconst state = this.#currentMutation?.state ?? getDefaultState();\n\t\tthis.#currentResult = {\n\t\t\t...state,\n\t\t\tisPending: state.status === \"pending\",\n\t\t\tisSuccess: state.status === \"success\",\n\t\t\tisError: state.status === \"error\",\n\t\t\tisIdle: state.status === \"idle\",\n\t\t\tmutate: this.mutate,\n\t\t\treset: this.reset\n\t\t};\n\t}\n\t#notify(action) {\n\t\tnotifyManager.batch(() => {\n\t\t\tconst mutateOptions = this.#mutateOptions;\n\t\t\tif (mutateOptions && this.hasListeners()) {\n\t\t\t\tconst variables = this.#currentResult.variables;\n\t\t\t\tconst onMutateResult = this.#currentResult.context;\n\t\t\t\tconst context = {\n\t\t\t\t\tclient: this.#client,\n\t\t\t\t\tmeta: this.options.meta,\n\t\t\t\t\tmutationKey: this.options.mutationKey\n\t\t\t\t};\n\t\t\t\tif (action?.type === \"success\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t} else if (action?.type === \"error\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onError?.(action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(this.#currentResult);\n\t\t\t});\n\t\t});\n\t}\n};\n//#endregion\nexport { MutationObserver };\n\n//# sourceMappingURL=mutationObserver.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport * as React from \"react\";\nimport { MutationObserver, noop, notifyManager, shouldThrowError } from \"@tanstack/query-core\";\n//#region src/useMutation.ts\n/**\n* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.\n* `useMutation` is the hook for that.\n* @param options - The {@link UseMutationOptions} to use — everything you can pass to `useMutation`.\n* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n* be used.\n* @returns `mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a second\n* argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to the shared\n* mutation definition. Hook-level callbacks (passed to `options`) fire for every mutation; per-call callbacks\n* fire only for the latest call you've made, and only while the component is still mounted — unmounting before\n* the mutation settles removes the subscription and prevents them from firing.\n* @throws {Error} The mutation error, when `throwOnError` is `true` or returns `true` for it, so that it is\n* thrown to the nearest error boundary.\n* @see {@link mutationOptions} to share these options across multiple `useMutation` call sites, or to look\n* the mutation up elsewhere via its `mutationKey` (e.g. with `useMutationState`).\n* @example\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <button\n* onClick={() =>\n* addMutation.mutate('Item', {\n* onError: (error) => console.error('Failed to add item:', error),\n* })\n* }\n* >\n* Add\n* </button>\n* )\n* }\n* ```\n* @example\n* Rendering the mutation's own state, rather than just firing it off:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <div>\n* {addMutation.isPending ? (\n* 'Adding todo...'\n* ) : (\n* <>\n* {addMutation.isError ? (\n* <div>An error occurred: {addMutation.error.message}</div>\n* ) : null}\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* </>\n* )}\n* </div>\n* )\n* }\n* ```\n* @example\n* Optimistic update via `onMutate`, rolling back on `onError`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onMutate: async (newTodo) => {\n* await queryClient.cancelQueries({ queryKey: ['todos'] })\n* const previousTodos = queryClient.getQueryData<Array<string>>(['todos'])\n*\n* queryClient.setQueryData<Array<string>>(['todos'], (old) => [\n* ...(old ?? []),\n* newTodo,\n* ])\n*\n* // Passed to `onError` as `onMutateResult` if the mutation fails.\n* return { previousTodos }\n* },\n* onError: (_err, _newTodo, onMutateResult) => {\n* queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)\n* },\n* onSettled: () => {\n* queryClient.invalidateQueries({ queryKey: ['todos'] })\n* },\n* })\n*\n* return (\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* )\n* }\n* ```\n* @example\n* Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a\n* promise per call instead, so you can wait for all of them when they succeed:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* try {\n* await Promise.all(todos.map((todo) => addMutation.mutateAsync(todo)))\n* } catch (error) {\n* console.error('Failed to add todos:', error)\n* }\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n* @example\n* If some of the mutations above can fail independently of the others, and you want to know which ones\n* did — rather than losing that information the moment the first one rejects — swap `Promise.all` for\n* `Promise.allSettled`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* const addResults = await Promise.allSettled(\n* todos.map((todo) => addMutation.mutateAsync(todo)),\n* )\n*\n* addResults.forEach((addResult, index) => {\n* if (addResult.status === 'rejected') {\n* console.error(`Failed to add \"${todos[index]}\":`, addResult.reason)\n* }\n* })\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n*/\nfunction useMutation(options, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst [observer] = React.useState(() => new MutationObserver(client, options));\n\tReact.useEffect(() => {\n\t\tobserver.setOptions(options);\n\t}, [observer, options]);\n\tconst result = React.useSyncExternalStore(React.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tconst mutate = React.useCallback((...args) => {\n\t\tobserver.mutate(args[0], args[1]).catch(noop);\n\t}, [observer]);\n\tif (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error;\n\treturn {\n\t\t...result,\n\t\tmutate,\n\t\tmutateAsync: result.mutate\n\t};\n}\n//#endregion\nexport { useMutation };\n\n//# sourceMappingURL=useMutation.js.map"],"ignoreList":[0,1],"mappings":";;;;;AAmBA,IAAIU,IAAmB,cAAcP,EAAa;CACjD;CACA,KAAiB,KAAK;CACtB;CACA;CACA,YAAY,GAAQ,GAAS;EAK5B,AAJA,MAAM,GACN,KAAKQ,KAAUC,GACf,KAAK,WAAWC,CAAO,GACvB,KAAK,YAAY,GACjB,KAAKC,GAAc;CACpB;CAKA,cAAc;EAEb,AADA,KAAK,SAAS,KAAK,OAAO,KAAK,IAAI,GACnC,KAAK,QAAQ,KAAK,MAAM,KAAK,IAAI;CAClC;CAkBA,WAAW,GAAS;EACnB,IAAMC,IAAc,KAAK;EAOzB,AANA,KAAK,UAAU,KAAKJ,GAAQ,uBAAuBE,CAAO,GACrDX,EAAoB,KAAK,SAASa,CAAW,KAAG,KAAKJ,GAAQ,iBAAiB,CAAC,CAAC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,EAAM,aAAa,GAAGgC,MAAS;EAC7C,EAAS,OAAOA,EAAK,IAAIA,EAAK,EAAE,CAAC,CAAC,MAAM3B,CAAI;CAC7C,GAAG,CAACuB,CAAQ,CAAC;CACb,IAAIC,EAAO,SAAStB,EAAiBqB,EAAS,QAAQ,cAAc,CAACC,EAAO,KAAK,CAAC,GAAG,MAAMA,EAAO;CAClG,OAAO;EACN,GAAGA;EACH;EACA,aAAaA,EAAO;CACrB;AACD"}
|
|
1
|
+
{"version":3,"file":"useMutation.js","names":["React","useQueryClient","shallowEqualObjects","Subscribable","hashKey","noop","notifyManager","shouldThrowError","getDefaultState","React$1","MutationObserver","#client","client","options","#updateResult","prevOptions","#currentMutation","#notify","action","#currentResult","#mutateOptions","variables","state","mutateOptions","onMutateResult","context","useMutation","queryClient","observer","result","onStoreChange","mutate","args"],"sources":["../../../../node_modules/.pnpm/@tanstack+query-core@5.105.0/node_modules/@tanstack/query-core/build/modern/mutationObserver.js","../../../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useMutation.js"],"sourcesContent":["import { hashKey, shallowEqualObjects } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { getDefaultState } from \"./mutation.js\";\n//#region src/mutationObserver.ts\n/**\n* Observes a single mutation and derives a `MutationObserverResult` from it.\n* A framework hook like `useMutation` creates one `MutationObserver` per hook\n* call, keeps it stable across re-renders, calls `setOptions` when the options\n* passed to the hook change, subscribes to it to re-render on updates, and\n* reads `getCurrentResult()` for the value to return. Calling `mutate()`\n* builds a new underlying `Mutation` in the `MutationCache` and executes it.\n* @example\n* ```ts\n* const observer = new MutationObserver(queryClient, {\n* mutationFn: (variables: { title: string }) => addPost(variables),\n* })\n* ```\n*/\nvar MutationObserver = class extends Subscribable {\n\t#client;\n\t#currentResult = void 0;\n\t#currentMutation;\n\t#mutateOptions;\n\tconstructor(client, options) {\n\t\tsuper();\n\t\tthis.#client = client;\n\t\tthis.setOptions(options);\n\t\tthis.bindMethods();\n\t\tthis.#updateResult();\n\t}\n\t/**\n\t* Binds the methods of the result (`mutate` and `reset`) to the observer, so they keep working when\n\t* destructured from it.\n\t*/\n\tbindMethods() {\n\t\tthis.mutate = this.mutate.bind(this);\n\t\tthis.reset = this.reset.bind(this);\n\t}\n\t/**\n\t* Updates the observer's options.\n\t*\n\t* If the new `mutationKey` differs from the previous one (and both were\n\t* defined), the observer is reset, detaching it from the mutation it was\n\t* observing. Otherwise, if the currently observed mutation is still\n\t* `pending`, its options are updated in place as well.\n\t* @param options - The new mutation observer options. They are defaulted with {@link\n\t* QueryClient#defaultMutationOptions} before being applied.\n\t* @example\n\t* ```ts\n\t* observer.setOptions({\n\t* mutationFn: (variables: { title: string }) => addPost(variables),\n\t* onSuccess: (data) => console.log(data),\n\t* })\n\t* ```\n\t*/\n\tsetOptions(options) {\n\t\tconst prevOptions = this.options;\n\t\tthis.options = this.#client.defaultMutationOptions(options);\n\t\tif (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({\n\t\t\ttype: \"observerOptionsUpdated\",\n\t\t\tmutation: this.#currentMutation,\n\t\t\tobserver: this\n\t\t});\n\t\tif (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset();\n\t\telse if (this.#currentMutation?.state.status === \"pending\") this.#currentMutation.setOptions(this.options);\n\t}\n\tonSubscribe() {\n\t\tif (this.listeners.size === 1 && this.#currentMutation) {\n\t\t\tthis.#currentMutation.addObserver(this);\n\t\t\tthis.#updateResult();\n\t\t}\n\t}\n\tonUnsubscribe() {\n\t\tif (!this.hasListeners()) this.#currentMutation?.removeObserver(this);\n\t}\n\t/**\n\t* Updates the observer's result when the observed mutation changes, and notifies its listeners.\n\t* @internal\n\t* @param action - The action that updated the observed mutation, passed on to the observer's\n\t* callbacks.\n\t*/\n\tonMutationUpdate(action) {\n\t\tthis.#updateResult();\n\t\tthis.#notify(action);\n\t}\n\t/**\n\t* Returns the observer's current result, derived from the observed\n\t* mutation's state (or the default, `idle` state if no mutation has been\n\t* built yet, e.g. before the first `mutate()` call or after `reset()`).\n\t* @returns The observer's latest result.\n\t*/\n\tgetCurrentResult() {\n\t\treturn this.#currentResult;\n\t}\n\t/**\n\t* Detaches the observer from the mutation it is currently observing (if\n\t* any) and resets the observed result back to its default, `idle` state.\n\t*\n\t* This does not cancel an in-flight mutation; the mutation itself keeps\n\t* running to completion and its own callbacks still fire, but this\n\t* observer stops reflecting its state and a subsequent `mutate()` call\n\t* will build a brand new mutation.\n\t* @see {@link MutationObserver#mutate}\n\t* @example\n\t* ```ts\n\t* observer.reset()\n\t* ```\n\t*/\n\treset() {\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = void 0;\n\t\tthis.#updateResult();\n\t\tthis.#notify();\n\t}\n\t/**\n\t* Builds a new `Mutation` in the `MutationCache` using the observer's\n\t* current options, detaches this observer from any previously observed\n\t* mutation, attaches it to the new one, and executes it with the given\n\t* variables.\n\t*\n\t* The optional per-call `options` (`onSuccess`/`onError`/`onSettled`) are\n\t* invoked once the mutation settles, in addition to any callbacks defined\n\t* on the observer's own options.\n\t* @param variables - The variables passed to the `mutationFn`.\n\t* @param options - Per-call `onSuccess`, `onError`, and `onSettled` callbacks.\n\t* @returns A promise that resolves with the mutation's data, or rejects with its error.\n\t* @example\n\t* ```ts\n\t* await observer.mutate(\n\t* { title: 'New post' },\n\t* { onSuccess: (data) => console.log(data) },\n\t* )\n\t* ```\n\t*/\n\tmutate(variables, options) {\n\t\tthis.#mutateOptions = options;\n\t\tthis.#currentMutation?.removeObserver(this);\n\t\tthis.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);\n\t\tthis.#currentMutation.addObserver(this);\n\t\treturn this.#currentMutation.execute(variables);\n\t}\n\t#updateResult() {\n\t\tconst state = this.#currentMutation?.state ?? getDefaultState();\n\t\tthis.#currentResult = {\n\t\t\t...state,\n\t\t\tisPending: state.status === \"pending\",\n\t\t\tisSuccess: state.status === \"success\",\n\t\t\tisError: state.status === \"error\",\n\t\t\tisIdle: state.status === \"idle\",\n\t\t\tmutate: this.mutate,\n\t\t\treset: this.reset\n\t\t};\n\t}\n\t#notify(action) {\n\t\tnotifyManager.batch(() => {\n\t\t\tconst mutateOptions = this.#mutateOptions;\n\t\t\tif (mutateOptions && this.hasListeners()) {\n\t\t\t\tconst variables = this.#currentResult.variables;\n\t\t\t\tconst onMutateResult = this.#currentResult.context;\n\t\t\t\tconst context = {\n\t\t\t\t\tclient: this.#client,\n\t\t\t\t\tmeta: this.options.meta,\n\t\t\t\t\tmutationKey: this.options.mutationKey\n\t\t\t\t};\n\t\t\t\tif (action?.type === \"success\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t} else if (action?.type === \"error\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onError?.(action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tPromise.reject(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.listeners.forEach((listener) => {\n\t\t\t\tlistener(this.#currentResult);\n\t\t\t});\n\t\t});\n\t}\n};\n//#endregion\nexport { MutationObserver };\n\n//# sourceMappingURL=mutationObserver.js.map","\"use client\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport * as React from \"react\";\nimport { MutationObserver, noop, notifyManager, shouldThrowError } from \"@tanstack/query-core\";\n//#region src/useMutation.ts\n/**\n* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.\n* `useMutation` is the hook for that.\n* @param options - The {@link UseMutationOptions} to use — everything you can pass to `useMutation`.\n* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will\n* be used.\n* @returns `mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a second\n* argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to the shared\n* mutation definition. Hook-level callbacks (passed to `options`) fire for every mutation; per-call callbacks\n* fire only for the latest call you've made, and only while the component is still mounted — unmounting before\n* the mutation settles removes the subscription and prevents them from firing.\n* @throws {Error} The mutation error, when `throwOnError` is `true` or returns `true` for it, so that it is\n* thrown to the nearest error boundary.\n* @see {@link mutationOptions} to share these options across multiple `useMutation` call sites, or to look\n* the mutation up elsewhere via its `mutationKey` (e.g. with `useMutationState`).\n* @example\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <button\n* onClick={() =>\n* addMutation.mutate('Item', {\n* onError: (error) => console.error('Failed to add item:', error),\n* })\n* }\n* >\n* Add\n* </button>\n* )\n* }\n* ```\n* @example\n* Rendering the mutation's own state, rather than just firing it off:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* return (\n* <div>\n* {addMutation.isPending ? (\n* 'Adding todo...'\n* ) : (\n* <>\n* {addMutation.isError ? (\n* <div>An error occurred: {addMutation.error.message}</div>\n* ) : null}\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* </>\n* )}\n* </div>\n* )\n* }\n* ```\n* @example\n* Optimistic update via `onMutate`, rolling back on `onError`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodo() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onMutate: async (newTodo) => {\n* await queryClient.cancelQueries({ queryKey: ['todos'] })\n* const previousTodos = queryClient.getQueryData<Array<string>>(['todos'])\n*\n* queryClient.setQueryData<Array<string>>(['todos'], (old) => [\n* ...(old ?? []),\n* newTodo,\n* ])\n*\n* // Passed to `onError` as `onMutateResult` if the mutation fails.\n* return { previousTodos }\n* },\n* onError: (_err, _newTodo, onMutateResult) => {\n* queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)\n* },\n* onSettled: () => {\n* queryClient.invalidateQueries({ queryKey: ['todos'] })\n* },\n* })\n*\n* return (\n* <button onClick={() => addMutation.mutate('Item')}>Add</button>\n* )\n* }\n* ```\n* @example\n* Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a\n* promise per call instead, so you can wait for all of them when they succeed:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* try {\n* await Promise.all(todos.map((todo) => addMutation.mutateAsync(todo)))\n* } catch (error) {\n* console.error('Failed to add todos:', error)\n* }\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n* @example\n* If some of the mutations above can fail independently of the others, and you want to know which ones\n* did — rather than losing that information the moment the first one rejects — swap `Promise.all` for\n* `Promise.allSettled`:\n* ```tsx\n* import { useMutation, useQueryClient } from '@tanstack/react-query'\n*\n* function AddTodos() {\n* const queryClient = useQueryClient()\n*\n* const addMutation = useMutation({\n* mutationFn: addTodo,\n* onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),\n* })\n*\n* async function handleAddAll(todos: Array<string>) {\n* const addResults = await Promise.allSettled(\n* todos.map((todo) => addMutation.mutateAsync(todo)),\n* )\n*\n* addResults.forEach((addResult, index) => {\n* if (addResult.status === 'rejected') {\n* console.error(`Failed to add \"${todos[index]}\":`, addResult.reason)\n* }\n* })\n* }\n*\n* return (\n* <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>\n* Add all\n* </button>\n* )\n* }\n* ```\n*/\nfunction useMutation(options, queryClient) {\n\tconst client = useQueryClient(queryClient);\n\tconst [observer] = React.useState(() => new MutationObserver(client, options));\n\tReact.useEffect(() => {\n\t\tobserver.setOptions(options);\n\t}, [observer, options]);\n\tconst result = React.useSyncExternalStore(React.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n\tconst mutate = React.useCallback((...args) => {\n\t\tobserver.mutate(args[0], args[1]).catch(noop);\n\t}, [observer]);\n\tif (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error;\n\treturn {\n\t\t...result,\n\t\tmutate,\n\t\tmutateAsync: result.mutate\n\t};\n}\n//#endregion\nexport { useMutation };\n\n//# sourceMappingURL=useMutation.js.map"],"ignoreList":[0,1],"mappings":";;;;;AAmBA,IAAIU,IAAmB,cAAcP,EAAa;CACjD;CACA,KAAiB,KAAK;CACtB;CACA;CACA,YAAY,GAAQ,GAAS;EAK5B,AAJA,MAAM,GACN,KAAKQ,KAAUC,GACf,KAAK,WAAWC,CAAO,GACvB,KAAK,YAAY,GACjB,KAAKC,GAAc;CACpB;CAKA,cAAc;EAEb,AADA,KAAK,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EACrB,EAAS,WAAWA,CAAO;CAC5B,GAAG,CAACe,GAAUf,CAAO,CAAC;CACtB,IAAMgB,IAAS7B,EAAM,qBAAqBA,EAAM,aAAa,MAAkB4B,EAAS,UAAUtB,EAAc,WAAWwB,CAAa,CAAC,GAAG,CAACF,CAAQ,CAAC,SAASA,EAAS,iBAAiB,SAASA,EAAS,iBAAiB,CAAC,GACvNG,IAAS/B,EAAM,aAAa,GAAGgC,MAAS;EAC7C,EAAS,OAAOA,EAAK,IAAIA,EAAK,EAAE,CAAC,CAAC,MAAM3B,CAAI;CAC7C,GAAG,CAACuB,CAAQ,CAAC;CACb,IAAIC,EAAO,SAAStB,EAAiBqB,EAAS,QAAQ,cAAc,CAACC,EAAO,KAAK,CAAC,GAAG,MAAMA,EAAO;CAClG,OAAO;EACN,GAAGA;EACH;EACA,aAAaA,EAAO;CACrB;AACD"}
|
|
@@ -3,7 +3,7 @@ import { C as t, b as n, c as r, g as i, l as a, n as o, o as s, p as c, s as l,
|
|
|
3
3
|
import * as m from "react";
|
|
4
4
|
import { useMemo as h } from "react";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// ../../node_modules/.pnpm/@tanstack+query-core@5.105.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js
|
|
7
7
|
var g = class extends r {
|
|
8
8
|
#e;
|
|
9
9
|
#t = void 0;
|
|
@@ -78,7 +78,7 @@ var g = class extends r {
|
|
|
78
78
|
i.type === "updated" && i.query.queryHash === n.queryHash && n.state.data !== void 0 && (r(), e(this.createResult(n, t)));
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
|
-
return Promise.race([n.fetch().then(() => {
|
|
81
|
+
return Promise.race([n.fetch(t).then(() => {
|
|
82
82
|
let e = this.createResult(n, t);
|
|
83
83
|
return i?.(e), e;
|
|
84
84
|
}).finally(() => {
|
|
@@ -231,12 +231,10 @@ function b(e, t, n, r) {
|
|
|
231
231
|
function x(e, t) {
|
|
232
232
|
return p(t.enabled, e) !== !1 && e.isStaleByTime(p(t.staleTime, e));
|
|
233
233
|
}
|
|
234
|
-
|
|
235
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.104.2_react@19.3.1/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
|
|
234
|
+
// ../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
|
|
236
235
|
var S = m.createContext(!1), C = () => m.useContext(S);
|
|
237
236
|
S.Provider;
|
|
238
|
-
|
|
239
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.104.2_react@19.3.1/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
|
|
237
|
+
// ../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
|
|
240
238
|
function w() {
|
|
241
239
|
let e = !1;
|
|
242
240
|
return {
|
|
@@ -250,7 +248,7 @@ function w() {
|
|
|
250
248
|
};
|
|
251
249
|
}
|
|
252
250
|
var T = m.createContext(w()), E = () => m.useContext(T), D = (e, t, n) => {
|
|
253
|
-
let r = n?.state.error && typeof e.throwOnError == "function" ? f(e.throwOnError, [n.state.error, n]) : e.throwOnError;
|
|
251
|
+
let r = n?.state.status === "error" && typeof e.throwOnError == "function" ? f(e.throwOnError, [n.state.error, n]) : e.throwOnError;
|
|
254
252
|
(e.suspense || r) && (t.isReset() || (e.retryOnMount = !1));
|
|
255
253
|
}, O = (e) => {
|
|
256
254
|
m.useEffect(() => {
|
|
@@ -264,8 +262,7 @@ var T = m.createContext(w()), E = () => m.useContext(T), D = (e, t, n) => {
|
|
|
264
262
|
}, j = (e, t) => e?.suspense && t.isPending, M = (e, t, n) => t.fetchOptimistic(e).catch(() => {
|
|
265
263
|
n.clearReset();
|
|
266
264
|
});
|
|
267
|
-
|
|
268
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.104.2_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
265
|
+
// ../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
269
266
|
function N(t, n, r) {
|
|
270
267
|
if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t))) throw Error("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");
|
|
271
268
|
let a = C(), o = E(), c = e(r), l = c.defaultQueryOptions(t), u = c.getQueryCache().get(l.queryHash);
|
|
@@ -288,13 +285,11 @@ function N(t, n, r) {
|
|
|
288
285
|
})) throw p.error;
|
|
289
286
|
return l.notifyOnChangeProps ? p : f.trackResult(p);
|
|
290
287
|
}
|
|
291
|
-
|
|
292
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.104.2_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useQuery.js
|
|
288
|
+
// ../../node_modules/.pnpm/@tanstack+react-query@5.105.0_@types+react@19.3.0_react@19.3.1/node_modules/@tanstack/react-query/build/modern/useQuery.js
|
|
293
289
|
function P(e, t) {
|
|
294
290
|
return N(e, g, t);
|
|
295
291
|
}
|
|
296
|
-
|
|
297
|
-
//#region src/hooks/useQueryMemo/useQueryMemo.ts
|
|
292
|
+
// src/hooks/useQueryMemo/useQueryMemo.ts
|
|
298
293
|
var F = (e, t) => {
|
|
299
294
|
let n = P(e, t);
|
|
300
295
|
return h(() => n, [
|
|
@@ -323,7 +318,6 @@ var F = (e, t) => {
|
|
|
323
318
|
n.status
|
|
324
319
|
]);
|
|
325
320
|
};
|
|
326
|
-
//#endregion
|
|
327
321
|
export { F as t };
|
|
328
322
|
|
|
329
323
|
//# sourceMappingURL=useQueryMemo.js.map
|