fastapi-rtk 0.1.25 → 0.1.27
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/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/infiniteQueryBehavior.cjs +12 -10
- package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/query.cjs +41 -22
- package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/queryClient.cjs +1 -1
- package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/queryObserver.cjs +1 -1
- package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/utils.cjs +2 -1
- package/dist/.external/cjs/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/errorBoundaryUtils.cjs +1 -1
- package/dist/.external/cjs/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/suspense.cjs +3 -2
- package/dist/.external/cjs/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/useBaseQuery.cjs +3 -3
- package/dist/.external/cjs/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/useQuery.cjs +1 -1
- package/dist/.external/cjs/lodash@4.17.21/lodash/lodash.cjs +5 -5
- package/dist/.external/cjs/lodash@4.17.21/lodash/toFinite.cjs +1 -1
- package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/infiniteQueryBehavior.mjs +12 -10
- package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/query.mjs +42 -23
- package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/queryClient.mjs +1 -1
- package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/queryObserver.mjs +1 -1
- package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/utils.mjs +2 -1
- package/dist/.external/esm/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/errorBoundaryUtils.mjs +1 -1
- package/dist/.external/esm/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/suspense.mjs +3 -2
- package/dist/.external/esm/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/useBaseQuery.mjs +3 -3
- package/dist/.external/esm/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/useQuery.mjs +1 -1
- package/dist/.external/esm/lodash@4.17.21/lodash/lodash.mjs +5 -5
- package/dist/.external/esm/lodash@4.17.21/lodash/toFinite.mjs +1 -1
- package/dist/.external/esm/{mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.7_@mantine_dates@7.17.7_@mantine_hooks@7._dm3meh6s7t7wwl37at3cedg6gm → mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._ll5dfnmvjphm4bajaxt6oy7mty}/mantine-react-table/dist/index.esm.mjs +1 -1
- package/dist/core/cjs/Tables/DataGrid/Toolbar/Filter/FilterMenu.cjs +1 -1
- package/dist/core/cjs/Tables/NextGenDataGrid/NextGenDataGrid.cjs +6 -4
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.cjs +3 -5
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilterInput/ColumnHeaderFilterInput.cjs +4 -18
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/FilterMenuButton.cjs +35 -71
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/FilterModeDescription.cjs +1 -1
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/HeaderAdvancedFiltersMenuButton.cjs +58 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/useColumns.cjs +12 -4
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useToolbar/basicToolbars.cjs +11 -5
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useToolbar/useToolbar.cjs +3 -2
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/FASTAPI_RTK_ToolbarAlertBanner.cjs +1 -1
- package/dist/core/cjs/Wrappers/ApiProvider/Contexts/ApiContext.cjs +1 -1
- package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideApi.cjs +14 -19
- package/dist/core/cjs/Wrappers/InfiniteScroll/InfiniteScroll.cjs +12 -11
- package/dist/core/cjs/Wrappers/Provider/Provider.cjs +3 -3
- package/dist/core/cjs/Wrappers/Provider/hooks/useProvideAuth.cjs +2 -2
- package/dist/core/cjs/Wrappers/Provider/hooks/useProvideInfo.cjs +1 -1
- package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideApi.cjs +14 -19
- package/dist/core/cjs/fab-react-toolkit-patch/auth/hooks/useProvideAuth.cjs +2 -2
- package/dist/core/cjs/fab-react-toolkit-patch/auth/hooks/useProvideInfo.cjs +1 -1
- package/dist/core/esm/Tables/DataGrid/Toolbar/Filter/FilterMenu.mjs +1 -1
- package/dist/core/esm/Tables/NextGenDataGrid/NextGenDataGrid.mjs +6 -4
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.mjs +3 -5
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilterInput/ColumnHeaderFilterInput.mjs +4 -18
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/FilterMenuButton.mjs +39 -75
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/FilterModeDescription.mjs +1 -1
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/HeaderAdvancedFiltersMenuButton.mjs +58 -0
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/useColumns.mjs +13 -5
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useToolbar/basicToolbars.mjs +11 -5
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useToolbar/useToolbar.mjs +3 -2
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/FASTAPI_RTK_ToolbarAlertBanner.mjs +1 -1
- package/dist/core/esm/Wrappers/ApiProvider/Contexts/ApiContext.mjs +1 -1
- package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideApi.mjs +14 -19
- package/dist/core/esm/Wrappers/InfiniteScroll/InfiniteScroll.mjs +12 -11
- package/dist/core/esm/Wrappers/Provider/Provider.mjs +3 -3
- package/dist/core/esm/Wrappers/Provider/hooks/useProvideAuth.mjs +2 -2
- package/dist/core/esm/Wrappers/Provider/hooks/useProvideInfo.mjs +1 -1
- package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideApi.mjs +14 -19
- package/dist/core/esm/fab-react-toolkit-patch/auth/hooks/useProvideAuth.mjs +2 -2
- package/dist/core/esm/fab-react-toolkit-patch/auth/hooks/useProvideInfo.mjs +1 -1
- package/dist/core/lib/Tables/NextGenDataGrid/NextGenDataGrid.d.ts +7 -7
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.d.ts +1 -2
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/FilterMenuButton.d.ts +1 -10
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/HeaderAdvancedFiltersMenuButton.d.ts +4 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/useColumns.d.ts +1 -1
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useToolbar/useToolbar.d.ts +1 -1
- package/dist/core/lib/Wrappers/ApiProvider/ApiProvider.d.ts +55 -13
- package/dist/core/lib/Wrappers/ApiProvider/Contexts/ApiContext.d.ts +2 -1
- package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideApi.d.ts +1 -1
- package/dist/core/lib/Wrappers/InfiniteScroll/InfiniteScroll.d.ts +29 -0
- package/dist/core/lib/Wrappers/Provider/Provider.d.ts +4 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideApi.d.ts +1 -1
- package/dist/core/lib/hooks/api/useApi.d.ts +1 -0
- package/dist/core/styles.css +0 -1
- package/dist/hooks/cjs/useSyncValues/useSyncValues.cjs +5 -8
- package/dist/hooks/esm/useSyncValues/useSyncValues.mjs +5 -8
- package/dist/hooks/lib/useSyncValues/useSyncValues.d.ts +1 -1
- package/package.json +1 -1
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/FilterMenu.cjs +0 -17
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/FilterMenu.mjs +0 -17
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/FilterMenu.d.ts +0 -9
- /package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/focusManager.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/mutation.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/mutationCache.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/notifyManager.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/onlineManager.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/queryCache.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/removable.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/retryer.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/subscribable.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/thenable.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/IsRestoringProvider.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/QueryClientProvider.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/QueryErrorResetBoundary.cjs +0 -0
- /package/dist/.external/cjs/{mantine-form-yup-resolver@2.0.0_@mantine_form@7.17.7_yup@1.6.1 → mantine-form-yup-resolver@2.0.0_@mantine_form@7.17.8_yup@1.6.1}/mantine-form-yup-resolver/dist/esm/index.cjs +0 -0
- /package/dist/.external/cjs/{mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.7_@mantine_dates@7.17.7_@mantine_hooks@7._dm3meh6s7t7wwl37at3cedg6gm → mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._ll5dfnmvjphm4bajaxt6oy7mty}/mantine-react-table/dist/index.esm.cjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/focusManager.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/mutation.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/mutationCache.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/notifyManager.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/onlineManager.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/queryCache.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/removable.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/retryer.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/subscribable.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.77.2 → @tanstack_query-core@5.80.6}/@tanstack/query-core/build/modern/thenable.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/IsRestoringProvider.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/QueryClientProvider.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.77.2_react@18.3.1 → @tanstack_react-query@5.80.6_react@18.3.1}/@tanstack/react-query/build/modern/QueryErrorResetBoundary.mjs +0 -0
- /package/dist/.external/esm/{mantine-form-yup-resolver@2.0.0_@mantine_form@7.17.7_yup@1.6.1 → mantine-form-yup-resolver@2.0.0_@mantine_form@7.17.8_yup@1.6.1}/mantine-form-yup-resolver/dist/esm/index.mjs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const useQuery = require("../../../../../.external/cjs/@tanstack_react-query@5.
|
|
3
|
+
const useQuery = require("../../../../../.external/cjs/@tanstack_react-query@5.80.6_react@18.3.1/@tanstack/react-query/build/modern/useQuery.cjs");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const authFetch = require("../utils/authFetch.cjs");
|
|
6
6
|
function useFabProvideInfo(baseUrl, auth) {
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useProps, Box, Flex, ActionIcon, Divider, Text, ScrollArea, Button, Group } from "@mantine/core";
|
|
3
3
|
import { useForm } from "@mantine/form";
|
|
4
4
|
import { randomId } from "@mantine/hooks";
|
|
5
|
-
import { yupResolver } from "../../../../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@7.17.
|
|
5
|
+
import { yupResolver } from "../../../../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@7.17.8_yup@1.6.1/mantine-form-yup-resolver/dist/esm/index.mjs";
|
|
6
6
|
import { useEffect } from "react";
|
|
7
7
|
import { object as create$3, array as create$2, mixed as create$8, string as create$6 } from "../../../../../../.external/esm/yup@1.6.1/yup/index.esm.mjs";
|
|
8
8
|
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
@@ -3,7 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { deepMerge, getItemId } from "fastapi-rtk/utils";
|
|
5
5
|
import { useProps, Box } from "@mantine/core";
|
|
6
|
-
import { useMantineReactTable, MantineReactTable } from "../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.
|
|
6
|
+
import { useMantineReactTable, MantineReactTable } from "../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._ll5dfnmvjphm4bajaxt6oy7mty/mantine-react-table/dist/index.esm.mjs";
|
|
7
7
|
import { forwardRef, useMemo, useEffect } from "react";
|
|
8
8
|
import { AddDialog } from "../../ActionIcons/Add/AddDialog.mjs";
|
|
9
9
|
import { EditDialog } from "../../ActionIcons/Edit/EditDialog.mjs";
|
|
@@ -51,6 +51,7 @@ const NextGenDataGrid = forwardRef((props, ref) => {
|
|
|
51
51
|
toolbar = {},
|
|
52
52
|
//! Temporary add {} until we remove deprecated props
|
|
53
53
|
textFilterSeparator = ";",
|
|
54
|
+
enableAdvancedFilters,
|
|
54
55
|
wrapperProps,
|
|
55
56
|
// Deprecated props
|
|
56
57
|
bodySeparator,
|
|
@@ -134,11 +135,11 @@ const NextGenDataGrid = forwardRef((props, ref) => {
|
|
|
134
135
|
const dataProps = useData();
|
|
135
136
|
const sortingProps = useSorting();
|
|
136
137
|
const paginationProps = usePagination(hidePagination);
|
|
137
|
-
const columnsProps = useColumns(columnProps, header, body, textFilterSeparator);
|
|
138
|
+
const columnsProps = useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters);
|
|
138
139
|
const sizeProps = useSize(withBorder);
|
|
139
140
|
const actionsProps = useActions(hideActions, (_a = getProps(body, specialKey.actions)) == null ? void 0 : _a.component);
|
|
140
141
|
const globalFilterProps = useGlobalFilter();
|
|
141
|
-
const toolbarProps = useToolbar(toolbar, quickFilters, hideToolbar);
|
|
142
|
+
const toolbarProps = useToolbar(toolbar, quickFilters, hideToolbar, enableAdvancedFilters);
|
|
142
143
|
const eventProps = useEvent(onClickEntry);
|
|
143
144
|
const checkboxProps = useCheckbox(onSelectCheckbox, bulkActions);
|
|
144
145
|
const filterProps = useFilters();
|
|
@@ -146,7 +147,7 @@ const NextGenDataGrid = forwardRef((props, ref) => {
|
|
|
146
147
|
const mrtProps = useMemo(
|
|
147
148
|
() => deepMerge(
|
|
148
149
|
baseProps,
|
|
149
|
-
{ mantinePaperProps: { ref }, getRowId: getItemId },
|
|
150
|
+
{ mantinePaperProps: { ref }, getRowId: getItemId, enableColumnFilters: !enableAdvancedFilters },
|
|
150
151
|
columnsProps,
|
|
151
152
|
dataProps,
|
|
152
153
|
sortingProps,
|
|
@@ -163,6 +164,7 @@ const NextGenDataGrid = forwardRef((props, ref) => {
|
|
|
163
164
|
),
|
|
164
165
|
[
|
|
165
166
|
ref,
|
|
167
|
+
enableAdvancedFilters,
|
|
166
168
|
columnsProps,
|
|
167
169
|
dataProps,
|
|
168
170
|
sortingProps,
|
|
@@ -4,13 +4,13 @@ import { useMemo } from "react";
|
|
|
4
4
|
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
5
5
|
import { useAuth } from "../../../../hooks/auth/useAuth.mjs";
|
|
6
6
|
import { fromFilterFnToFilter } from "../../utils.mjs";
|
|
7
|
+
import { BasicFilters } from "./BasicFilters.mjs";
|
|
7
8
|
import { ColumnHeaderFilterInput } from "./ColumnHeaderFilterInput/ColumnHeaderFilterInput.mjs";
|
|
8
9
|
import { FilterMenuButton } from "./FilterMenuButton.mjs";
|
|
9
10
|
import { FilterModeDescription } from "./FilterModeDescription.mjs";
|
|
10
11
|
const ColumnHeaderFilter = ({
|
|
11
12
|
children,
|
|
12
13
|
enableFilterModes,
|
|
13
|
-
enableAdvancedFilters,
|
|
14
14
|
filters,
|
|
15
15
|
filterFn,
|
|
16
16
|
filterProps,
|
|
@@ -59,13 +59,11 @@ const ColumnHeaderFilter = ({
|
|
|
59
59
|
FilterMenuButton,
|
|
60
60
|
{
|
|
61
61
|
table,
|
|
62
|
-
column,
|
|
63
|
-
opr,
|
|
64
62
|
filters,
|
|
65
|
-
enableAdvancedFilters,
|
|
66
63
|
filterMenu,
|
|
67
64
|
actionIconProps,
|
|
68
|
-
functionProps
|
|
65
|
+
functionProps,
|
|
66
|
+
children: /* @__PURE__ */ jsx(BasicFilters, { filters, col: column.id, opr, table })
|
|
69
67
|
}
|
|
70
68
|
)
|
|
71
69
|
] }),
|
|
@@ -52,22 +52,9 @@ function ColumnHeaderFilterInput({
|
|
|
52
52
|
const field = useField({ mode: "controlled" });
|
|
53
53
|
useSyncValues(
|
|
54
54
|
[
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
log: (value) => console.log(`Field value changed to: ${value}`)
|
|
59
|
-
},
|
|
60
|
-
...filterState ? [
|
|
61
|
-
{
|
|
62
|
-
...filterState,
|
|
63
|
-
log: (value) => console.log(`filterState value changed to: ${value}`)
|
|
64
|
-
}
|
|
65
|
-
] : [],
|
|
66
|
-
{
|
|
67
|
-
value: column.getFilterValue(),
|
|
68
|
-
onChange: column.setFilterValue,
|
|
69
|
-
log: (value) => console.log(`Column filter value changed to: ${value}`)
|
|
70
|
-
},
|
|
55
|
+
{ value: field.getValue(), onChange: field.getInputProps().onChange },
|
|
56
|
+
{ value: column.getFilterValue(), onChange: column.setFilterValue },
|
|
57
|
+
...filterState ? [filterState] : [],
|
|
71
58
|
...updateQueryParams ? [
|
|
72
59
|
{
|
|
73
60
|
value: (_b = (_a = queryParams == null ? void 0 : queryParams.filters) == null ? void 0 : _a.find((qpFilter) => qpFilter.id === column.id)) == null ? void 0 : _b.value,
|
|
@@ -91,8 +78,7 @@ function ColumnHeaderFilterInput({
|
|
|
91
78
|
}
|
|
92
79
|
return { ...prev, filters: newFilters };
|
|
93
80
|
});
|
|
94
|
-
}
|
|
95
|
-
log: (value) => console.log(`Query Params filter value changed to: ${value}`)
|
|
81
|
+
}
|
|
96
82
|
}
|
|
97
83
|
] : []
|
|
98
84
|
],
|
|
@@ -1,69 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { forwardRef, cloneElement
|
|
5
|
-
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Menu, ActionIcon, Tooltip } from "@mantine/core";
|
|
3
|
+
import { useDisclosure } from "@mantine/hooks";
|
|
4
|
+
import { forwardRef, cloneElement } from "react";
|
|
6
5
|
import { FallbackWrapper } from "../../FallbackWrapper.mjs";
|
|
7
|
-
import { FilterMenu } from "./FilterMenu.mjs";
|
|
8
6
|
import IconFilterCog from "../../../../../../.external/esm/@tabler_icons-react@3.18.0_react@18.3.1/@tabler/icons-react/dist/esm/icons/IconFilterCog.mjs";
|
|
9
|
-
const FilterMenuButton = (
|
|
10
|
-
table,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
disabled: !(filters == null ? void 0 : filters.length),
|
|
45
|
-
indicator: existingFilters.length,
|
|
46
|
-
actionIconProps,
|
|
47
|
-
onClick: toggle
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
children: filterMenu
|
|
51
|
-
}
|
|
52
|
-
) }),
|
|
53
|
-
/* @__PURE__ */ jsx(Menu.Dropdown, { children: /* @__PURE__ */ jsx(
|
|
54
|
-
FilterMenu,
|
|
55
|
-
{
|
|
56
|
-
enableAdvancedFilters,
|
|
57
|
-
mode,
|
|
58
|
-
setMode,
|
|
59
|
-
col: column.id,
|
|
60
|
-
opr,
|
|
61
|
-
filters,
|
|
62
|
-
table
|
|
63
|
-
}
|
|
64
|
-
) })
|
|
65
|
-
] });
|
|
66
|
-
};
|
|
7
|
+
const FilterMenuButton = forwardRef(
|
|
8
|
+
({ table, filters, filterMenu, filterIconWrapperProps, actionIconProps, functionProps, children }, ref) => {
|
|
9
|
+
const [opened, { toggle }] = useDisclosure();
|
|
10
|
+
return /* @__PURE__ */ jsxs(Menu, { opened, closeOnClickOutside: true, onChange: toggle, children: [
|
|
11
|
+
/* @__PURE__ */ jsx(Menu.Target, { ref, children: /* @__PURE__ */ jsx(
|
|
12
|
+
FallbackWrapper,
|
|
13
|
+
{
|
|
14
|
+
fallback: filters.length ? /* @__PURE__ */ jsx(
|
|
15
|
+
FilterIconWrapper,
|
|
16
|
+
{
|
|
17
|
+
label: table.options.localization.changeFilterMode,
|
|
18
|
+
position: "bottom-start",
|
|
19
|
+
withArrow: true,
|
|
20
|
+
arrowPosition: "side",
|
|
21
|
+
...filterIconWrapperProps,
|
|
22
|
+
children: /* @__PURE__ */ jsx(ActionIcon, { ...actionIconProps, onClick: toggle, children: /* @__PURE__ */ jsx(IconFilterCog, {}) })
|
|
23
|
+
}
|
|
24
|
+
) : null,
|
|
25
|
+
functionProps: {
|
|
26
|
+
...functionProps,
|
|
27
|
+
componentProps: {
|
|
28
|
+
label: table.options.localization.changeFilterMode,
|
|
29
|
+
disabled: !(filters == null ? void 0 : filters.length),
|
|
30
|
+
actionIconProps,
|
|
31
|
+
onClick: toggle
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
children: filterMenu
|
|
35
|
+
}
|
|
36
|
+
) }),
|
|
37
|
+
/* @__PURE__ */ jsx(Menu.Dropdown, { children })
|
|
38
|
+
] });
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
FilterMenuButton.displayName = "FilterMenuButton";
|
|
67
42
|
const FilterIconWrapper = forwardRef(({ label, disabled, children, ...props }, ref) => {
|
|
68
43
|
if (disabled) {
|
|
69
44
|
return cloneElement(children, { ref });
|
|
@@ -71,17 +46,6 @@ const FilterIconWrapper = forwardRef(({ label, disabled, children, ...props }, r
|
|
|
71
46
|
return /* @__PURE__ */ jsx(Tooltip, { label, ...props, children: cloneElement(children, { ref }) });
|
|
72
47
|
});
|
|
73
48
|
FilterIconWrapper.displayName = "FilterIconWrapper";
|
|
74
|
-
const FilterIndicatorWrapper = forwardRef(({ indicator, children, ...props }, ref) => {
|
|
75
|
-
const { height, ref: elementRef } = useElementSize();
|
|
76
|
-
const combinedRefs = useMergedRef(ref, elementRef);
|
|
77
|
-
if (!indicator) {
|
|
78
|
-
return cloneElement(children, { ref: combinedRefs });
|
|
79
|
-
}
|
|
80
|
-
const heightOffset = 2;
|
|
81
|
-
//! This is the height offset between the button from ActionIcon and the icon itself
|
|
82
|
-
return /* @__PURE__ */ jsx(Indicator, { zIndex: 20, size: 16, label: indicator, styles: { root: { height: height + heightOffset } }, ...props, children: cloneElement(children, { ref: combinedRefs }) });
|
|
83
|
-
});
|
|
84
|
-
FilterIndicatorWrapper.displayName = "FilterIndicatorWrapper";
|
|
85
49
|
export {
|
|
86
50
|
FilterMenuButton
|
|
87
51
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Input } from "@mantine/core";
|
|
3
|
-
import { localizedFilterOption } from "../../../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.
|
|
3
|
+
import { localizedFilterOption } from "../../../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._ll5dfnmvjphm4bajaxt6oy7mty/mantine-react-table/dist/index.esm.mjs";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { FallbackWrapper } from "../../FallbackWrapper.mjs";
|
|
6
6
|
import { getProps } from "../../utils.mjs";
|
package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/HeaderAdvancedFiltersMenuButton.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Center, Tooltip, Badge } from "@mantine/core";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
5
|
+
import { useAuth } from "../../../../hooks/auth/useAuth.mjs";
|
|
6
|
+
import { AdvancedFilters } from "./AdvancedFilters.mjs";
|
|
7
|
+
import { FilterMenuButton } from "./FilterMenuButton.mjs";
|
|
8
|
+
const HeaderAdvancedFiltersMenuButton = ({ filters, mrtProps }) => {
|
|
9
|
+
const { table, column } = mrtProps;
|
|
10
|
+
const api = useApi();
|
|
11
|
+
const auth = useAuth();
|
|
12
|
+
const functionProps = useMemo(() => ({ api, auth, mrtProps }), [api, auth, mrtProps]);
|
|
13
|
+
const actionIconProps = useMemo(() => {
|
|
14
|
+
const props = { variant: "subtle", size: "xs" };
|
|
15
|
+
const disabled = !(filters == null ? void 0 : filters.length);
|
|
16
|
+
if (disabled) {
|
|
17
|
+
props.disabled = true;
|
|
18
|
+
props.c = "gray";
|
|
19
|
+
}
|
|
20
|
+
return props;
|
|
21
|
+
}, [filters == null ? void 0 : filters.length]);
|
|
22
|
+
const { queryParams } = useApi();
|
|
23
|
+
const existingFilters = useMemo(
|
|
24
|
+
() => (queryParams == null ? void 0 : queryParams.filters.filter((filter) => filter.id !== column.id && filter.col === column.id).map((filter) => ({ ...filter }))) || [],
|
|
25
|
+
[queryParams, column.id]
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ jsx(Center, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
|
|
28
|
+
Tooltip,
|
|
29
|
+
{
|
|
30
|
+
label: /* @__PURE__ */ jsx(Badge, { size: "xs", circle: true, children: existingFilters.length }),
|
|
31
|
+
position: "top",
|
|
32
|
+
color: "transparent",
|
|
33
|
+
p: 0,
|
|
34
|
+
offset: { mainAxis: -8, crossAxis: 8 },
|
|
35
|
+
opened: true,
|
|
36
|
+
disabled: !existingFilters.length,
|
|
37
|
+
children: /* @__PURE__ */ jsx(
|
|
38
|
+
FilterMenuButton,
|
|
39
|
+
{
|
|
40
|
+
table,
|
|
41
|
+
filters,
|
|
42
|
+
filterIconWrapperProps: {
|
|
43
|
+
label: table.options.localization.advancedFilters ?? "Advanced Filters",
|
|
44
|
+
position: "top",
|
|
45
|
+
withArrow: false,
|
|
46
|
+
openDelay: 1e3
|
|
47
|
+
},
|
|
48
|
+
actionIconProps,
|
|
49
|
+
functionProps,
|
|
50
|
+
children: /* @__PURE__ */ jsx(AdvancedFilters, { col: column.id })
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
) });
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
HeaderAdvancedFiltersMenuButton
|
|
58
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getValue, parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
3
|
+
import { Flex } from "@mantine/core";
|
|
3
4
|
import { useMap, useSetState } from "@mantine/hooks";
|
|
4
5
|
import { useEffect, useMemo } from "react";
|
|
5
6
|
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
@@ -7,7 +8,8 @@ import { useAuth } from "../../../../hooks/auth/useAuth.mjs";
|
|
|
7
8
|
import { getProps, fromFilterToFilterFn } from "../../utils.mjs";
|
|
8
9
|
import { Body } from "./Body.mjs";
|
|
9
10
|
import { ColumnHeaderFilter } from "./ColumnHeaderFilter.mjs";
|
|
10
|
-
|
|
11
|
+
import { HeaderAdvancedFiltersMenuButton } from "./HeaderAdvancedFiltersMenuButton.mjs";
|
|
12
|
+
function useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters) {
|
|
11
13
|
const { path, info, data, specialKey } = useApi();
|
|
12
14
|
const api = useApi();
|
|
13
15
|
const auth = useAuth();
|
|
@@ -25,7 +27,6 @@ function useColumns(columnProps, header, body, textFilterSeparator) {
|
|
|
25
27
|
const {
|
|
26
28
|
component,
|
|
27
29
|
enableFilterModes,
|
|
28
|
-
enableAdvancedFilters,
|
|
29
30
|
filterComponent,
|
|
30
31
|
filterProps,
|
|
31
32
|
filterState,
|
|
@@ -45,12 +46,18 @@ function useColumns(columnProps, header, body, textFilterSeparator) {
|
|
|
45
46
|
accessorKey: col,
|
|
46
47
|
accessorFn: (row) => getValue(row, col),
|
|
47
48
|
header: (_g = data == null ? void 0 : data.label_columns) == null ? void 0 : _g[col],
|
|
49
|
+
Header: enableAdvancedFilters ? (props) => {
|
|
50
|
+
var _a2, _b2;
|
|
51
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: "2px", style: { placeItems: "center" }, children: [
|
|
52
|
+
((_a2 = getProps(columnProps, specialKey.all, col)) == null ? void 0 : _a2.header) ?? ((_b2 = data == null ? void 0 : data.label_columns) == null ? void 0 : _b2[col]),
|
|
53
|
+
/* @__PURE__ */ jsx(HeaderAdvancedFiltersMenuButton, { filters, mrtProps: props })
|
|
54
|
+
] });
|
|
55
|
+
} : void 0,
|
|
48
56
|
filterTooltipValueFn: (value) => idValueMap.get(`${data == null ? void 0 : data.path}-${col}-${value}`) ?? value,
|
|
49
|
-
Filter: (props) => /* @__PURE__ */ jsx(
|
|
57
|
+
Filter: (props) => enableAdvancedFilters ? null : /* @__PURE__ */ jsx(
|
|
50
58
|
ColumnHeaderFilter,
|
|
51
59
|
{
|
|
52
60
|
enableFilterModes,
|
|
53
|
-
enableAdvancedFilters,
|
|
54
61
|
filters,
|
|
55
62
|
filterFn,
|
|
56
63
|
filterProps,
|
|
@@ -83,6 +90,7 @@ function useColumns(columnProps, header, body, textFilterSeparator) {
|
|
|
83
90
|
api,
|
|
84
91
|
auth,
|
|
85
92
|
idValueMap,
|
|
93
|
+
enableAdvancedFilters,
|
|
86
94
|
body,
|
|
87
95
|
textFilterSeparator
|
|
88
96
|
]
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { MRT_ToggleFullScreenButton, MRT_ToggleDensePaddingButton, MRT_ShowHideColumnsButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton } from "../../../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.
|
|
2
|
+
import { MRT_ToggleFullScreenButton, MRT_ToggleDensePaddingButton, MRT_ShowHideColumnsButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton } from "../../../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._ll5dfnmvjphm4bajaxt6oy7mty/mantine-react-table/dist/index.esm.mjs";
|
|
3
3
|
import { Add } from "../../../../ActionIcons/Add/Add.mjs";
|
|
4
4
|
import { Download } from "../../../../ActionIcons/Download/Download.mjs";
|
|
5
5
|
import { Refresh } from "../../../../ActionIcons/Refresh/Refresh.mjs";
|
|
6
6
|
function getBasicToolbars(table, rules) {
|
|
7
|
-
|
|
7
|
+
const toolbars = {
|
|
8
8
|
toggleGlobalFilter: /* @__PURE__ */ jsx(MRT_ToggleGlobalFilterButton, { table, disabled: false }, "basic-toggleGlobalFilter"),
|
|
9
9
|
filter: /* @__PURE__ */ jsx(MRT_ToggleFiltersButton, { table }, "basic-filter"),
|
|
10
10
|
refresh: /* @__PURE__ */ jsx(Refresh, { tooltipProps: { label: table.options.localization.refresh } }, "basic-refresh"),
|
|
11
|
-
add:
|
|
12
|
-
download:
|
|
13
|
-
// upload:
|
|
11
|
+
add: /* @__PURE__ */ jsx(Add, { tooltipProps: { label: table.options.localization.add } }, "basic-add"),
|
|
12
|
+
download: /* @__PURE__ */ jsx(Download, { tooltipProps: { label: table.options.localization.download } }, "basic-download"),
|
|
13
|
+
// upload: <Upload key="basic-upload" tooltipProps={{ label: table.options.localization.upload }} />, //! Disabled until further notice
|
|
14
14
|
showHideColumns: /* @__PURE__ */ jsx(MRT_ShowHideColumnsButton, { table }, "basic-showHideColumns"),
|
|
15
15
|
toggleDensePadding: /* @__PURE__ */ jsx(MRT_ToggleDensePaddingButton, { table }, "basic-toggleDensePadding"),
|
|
16
16
|
toggleFullScreen: /* @__PURE__ */ jsx(MRT_ToggleFullScreenButton, { table }, "basic-toggleFullScreen")
|
|
17
17
|
};
|
|
18
|
+
Object.entries(rules).forEach(([key, value]) => {
|
|
19
|
+
if (!value) {
|
|
20
|
+
toolbars[key] = null;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return toolbars;
|
|
18
24
|
}
|
|
19
25
|
export {
|
|
20
26
|
getBasicToolbars
|
|
@@ -23,7 +23,7 @@ function renderCustomizedToolbars(customizer, basicToolbarsObj, functionProps, c
|
|
|
23
23
|
});
|
|
24
24
|
return /* @__PURE__ */ jsx(Flex, { gap: "0.125rem", align: "center", children: toolbars });
|
|
25
25
|
}
|
|
26
|
-
function useToolbar(toolbar = {}, quickFilters, hideToolbar) {
|
|
26
|
+
function useToolbar(toolbar = {}, quickFilters, hideToolbar, enableAdvancedFilters) {
|
|
27
27
|
const { info, queryParams, setQueryParams } = useApi();
|
|
28
28
|
const api = useApi();
|
|
29
29
|
const auth = useAuth();
|
|
@@ -58,6 +58,7 @@ function useToolbar(toolbar = {}, quickFilters, hideToolbar) {
|
|
|
58
58
|
mrtProps: { table }
|
|
59
59
|
};
|
|
60
60
|
const rules = {
|
|
61
|
+
filter: !enableAdvancedFilters,
|
|
61
62
|
add: info == null ? void 0 : info.permissions.includes("can_post"),
|
|
62
63
|
download: info == null ? void 0 : info.permissions.includes("can_download"),
|
|
63
64
|
upload: info == null ? void 0 : info.permissions.includes("can_upload")
|
|
@@ -65,7 +66,7 @@ function useToolbar(toolbar = {}, quickFilters, hideToolbar) {
|
|
|
65
66
|
const basicToolbarsObj = getBasicToolbars(table, rules);
|
|
66
67
|
return renderCustomizedToolbars(customizer, basicToolbarsObj, functionProps, custom);
|
|
67
68
|
},
|
|
68
|
-
[api, auth, custom, customizer, info == null ? void 0 : info.permissions]
|
|
69
|
+
[api, auth, custom, customizer, enableAdvancedFilters, info == null ? void 0 : info.permissions]
|
|
69
70
|
);
|
|
70
71
|
return {
|
|
71
72
|
renderToolbarInternalActions,
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { parseFromValuesOrFunc, getValueOrDefault } from "fastapi-rtk/utils";
|
|
3
3
|
import { Flex, Button, Group, Badge, ActionIcon, Stack } from "@mantine/core";
|
|
4
4
|
import { clsx } from "../../../../../../.external/esm/clsx@2.1.1/clsx/dist/clsx.mjs";
|
|
5
|
-
import { getMRT_SelectAllHandler, MRT_SelectCheckbox } from "../../../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.
|
|
5
|
+
import { getMRT_SelectAllHandler, MRT_SelectCheckbox } from "../../../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._ll5dfnmvjphm4bajaxt6oy7mty/mantine-react-table/dist/index.esm.mjs";
|
|
6
6
|
import { useMemo, Fragment } from "react";
|
|
7
7
|
import classes from "./FASTAPI_RTK_ToolbarAlertBanner.module.css.mjs";
|
|
8
8
|
const FASTAPI_RTK_ToolbarAlertBanner = ({ alertBanner, table, ...rest }) => {
|
|
@@ -2,7 +2,7 @@ import { createContext } from "react";
|
|
|
2
2
|
const ApiContext = createContext({
|
|
3
3
|
path: "",
|
|
4
4
|
/**
|
|
5
|
-
* @type {{count: number, description_columns: Record<string, string>, ids: number[] | string[], label_columns: Record<string, string>, list_columns: string[], list_title: string, order_columns: string[], result: Record<string, any>[], path: string} | null}
|
|
5
|
+
* @type {{count: number, description_columns: Record<string, string>, ids: number[] | string[], label_columns: Record<string, string>, list_columns: string[], list_title: string, order_columns: string[], result: Record<string, any>[], path: string, queryParams: Record<string, any>} | null}
|
|
6
6
|
*/
|
|
7
7
|
data: null,
|
|
8
8
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
2
2
|
import { getItemId, urlJoin } from "fastapi-rtk/utils";
|
|
3
3
|
import { useDidUpdate, useSetState } from "@mantine/hooks";
|
|
4
|
-
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.
|
|
4
|
+
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.80.6_react@18.3.1/@tanstack/react-query/build/modern/useQuery.mjs";
|
|
5
5
|
import { createItem } from "../utils/api/createItem.mjs";
|
|
6
6
|
import { deleteItem } from "../utils/api/deleteItem.mjs";
|
|
7
7
|
import { downloadItems } from "../utils/api/downloadItems.mjs";
|
|
@@ -13,7 +13,7 @@ import { uploadItems } from "../utils/api/uploadItems.mjs";
|
|
|
13
13
|
import { convertId } from "../utils/convertId.mjs";
|
|
14
14
|
import { convertInfo } from "../utils/convertInfo.mjs";
|
|
15
15
|
import { createQueryParams } from "../utils/createQueryParams.mjs";
|
|
16
|
-
import { keepPreviousData } from "../../../../../.external/esm/@tanstack_query-core@5.
|
|
16
|
+
import { keepPreviousData } from "../../../../../.external/esm/@tanstack_query-core@5.80.6/@tanstack/query-core/build/modern/utils.mjs";
|
|
17
17
|
function useProvideApi({
|
|
18
18
|
path,
|
|
19
19
|
initialQueryParams,
|
|
@@ -110,7 +110,8 @@ function useProvideApi({
|
|
|
110
110
|
queryFn: ({ signal }) => memoizedQueryParams ? getItems(urlJoin(memoizedQueryParamsPathRef.current, "/"), memoizedQueryParams, signal).then((data2) => ({
|
|
111
111
|
...data2,
|
|
112
112
|
result: data2.result.map((item, index) => ({ ...item, id: data2.ids[index] })),
|
|
113
|
-
path: memoizedQueryParamsPathRef.current
|
|
113
|
+
path: memoizedQueryParamsPathRef.current,
|
|
114
|
+
queryParams: memoizedQueryParams
|
|
114
115
|
})) : null,
|
|
115
116
|
placeholderData: clearDataOnRefetch ? null : keepPreviousData,
|
|
116
117
|
retry: false,
|
|
@@ -230,16 +231,8 @@ function useProvideApi({
|
|
|
230
231
|
const [streaming, setStreaming] = useSetState({
|
|
231
232
|
data: {},
|
|
232
233
|
isEnd: false,
|
|
233
|
-
fetch: () => null
|
|
234
|
+
fetch: streamingMode ? () => setQueryParamsCallback({ page: 0, streaming: true }) : () => null
|
|
234
235
|
});
|
|
235
|
-
useEffect(() => {
|
|
236
|
-
if (!streamingMode) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
setStreaming({
|
|
240
|
-
fetch: () => setQueryParamsCallback({ page: 0, streaming: true })
|
|
241
|
-
});
|
|
242
|
-
}, [setQueryParamsCallback, setStreaming, streamingMode]);
|
|
243
236
|
useEffect(() => {
|
|
244
237
|
if (!streamingMode) {
|
|
245
238
|
return;
|
|
@@ -248,19 +241,21 @@ function useProvideApi({
|
|
|
248
241
|
return;
|
|
249
242
|
}
|
|
250
243
|
setStreaming((prev) => {
|
|
251
|
-
|
|
244
|
+
var _a;
|
|
252
245
|
const newStreaming = { isEnd: false };
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
246
|
+
const currentPage = Object.keys(prev.data).length;
|
|
247
|
+
const nextPage = ((_a = data.queryParams) == null ? void 0 : _a.page) ?? 0;
|
|
248
|
+
if (nextPage < currentPage) {
|
|
249
|
+
newStreaming.data = {};
|
|
256
250
|
} else {
|
|
257
|
-
newStreaming.data = { ...prev.data
|
|
251
|
+
newStreaming.data = { ...prev.data };
|
|
258
252
|
}
|
|
259
|
-
|
|
253
|
+
newStreaming.data[nextPage] = data.result;
|
|
254
|
+
if (data.result.length < data.queryParams.page_size) {
|
|
260
255
|
newStreaming.isEnd = true;
|
|
261
256
|
newStreaming.fetch = () => null;
|
|
262
257
|
} else {
|
|
263
|
-
newStreaming.fetch = () => setQueryParamsCallback({ page:
|
|
258
|
+
newStreaming.fetch = () => setQueryParamsCallback({ page: nextPage + 1, streaming: true });
|
|
264
259
|
}
|
|
265
260
|
return newStreaming;
|
|
266
261
|
});
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
2
3
|
import { Center, Loader } from "@mantine/core";
|
|
3
4
|
import { useInViewport } from "@mantine/hooks";
|
|
4
5
|
import { useMemo, useEffect } from "react";
|
|
5
6
|
import { useApi } from "../../hooks/api/useApi.mjs";
|
|
6
|
-
|
|
7
|
+
const InfiniteScroll = ({
|
|
7
8
|
children,
|
|
8
9
|
fetch = true,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
components: {
|
|
11
|
+
Loading = /* @__PURE__ */ jsx(Center, { children: /* @__PURE__ */ jsx(Loader, {}) }),
|
|
12
|
+
End = /* @__PURE__ */ jsx(Center, { children: "End of data" }),
|
|
13
|
+
FetchWrapper = Center
|
|
14
|
+
} = {},
|
|
12
15
|
fetchWrapperProps
|
|
13
|
-
}) {
|
|
16
|
+
}) => {
|
|
14
17
|
const { streaming, loading } = useApi();
|
|
15
18
|
const { ref, inViewport } = useInViewport();
|
|
16
19
|
const items = useMemo(() => Object.values(streaming.data).flat(), [streaming.data]);
|
|
17
|
-
const Children = useMemo(() => typeof children === "function" ? children(items) : children, [children, items]);
|
|
18
20
|
useEffect(() => {
|
|
19
21
|
if (inViewport && fetch) {
|
|
20
22
|
streaming.fetch();
|
|
21
23
|
}
|
|
22
|
-
}, [inViewport]);
|
|
24
|
+
}, [fetch, inViewport]);
|
|
23
25
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
-
|
|
25
|
-
loading && Loading,
|
|
26
|
+
parseFromValuesOrFunc(children, { items, loading }),
|
|
26
27
|
streaming.isEnd && End,
|
|
27
|
-
/* @__PURE__ */ jsx(FetchWrapper, { ref, id: "IS-load-trigger", mih: "1%", ...fetchWrapperProps })
|
|
28
|
+
loading ? Loading : /* @__PURE__ */ jsx(FetchWrapper, { ref, id: "IS-load-trigger", mih: "1%", ...fetchWrapperProps })
|
|
28
29
|
] });
|
|
29
|
-
}
|
|
30
|
+
};
|
|
30
31
|
export {
|
|
31
32
|
InfiniteScroll
|
|
32
33
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useProxy } from "fastapi-rtk/zustand";
|
|
3
|
-
import { QueryClient } from "../../../../.external/esm/@tanstack_query-core@5.
|
|
4
|
-
import { QueryClientProvider } from "../../../../.external/esm/@tanstack_react-query@5.
|
|
3
|
+
import { QueryClient } from "../../../../.external/esm/@tanstack_query-core@5.80.6/@tanstack/query-core/build/modern/queryClient.mjs";
|
|
4
|
+
import { QueryClientProvider } from "../../../../.external/esm/@tanstack_react-query@5.80.6_react@18.3.1/@tanstack/react-query/build/modern/QueryClientProvider.mjs";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { useFabProvideAuth } from "../../fab-react-toolkit-patch/auth/hooks/useProvideAuth.mjs";
|
|
7
7
|
import { useFabProvideInfo } from "../../fab-react-toolkit-patch/auth/hooks/useProvideInfo.mjs";
|
|
@@ -31,7 +31,7 @@ function InnerProvider(props) {
|
|
|
31
31
|
return /* @__PURE__ */ jsx(AuthContext.Provider, { value: authProxy, children: /* @__PURE__ */ jsx(InfoContext.Provider, { value: infoProxy, children }) });
|
|
32
32
|
}
|
|
33
33
|
const Provider = (props) => {
|
|
34
|
-
const [queryClient] = useState(() => new QueryClient());
|
|
34
|
+
const [queryClient] = useState(() => new QueryClient(props.queryClientProps));
|
|
35
35
|
return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(InnerProvider, { ...props }) });
|
|
36
36
|
};
|
|
37
37
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.
|
|
2
|
-
import { useQueryClient } from "../../../../../.external/esm/@tanstack_react-query@5.
|
|
1
|
+
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.80.6_react@18.3.1/@tanstack/react-query/build/modern/useQuery.mjs";
|
|
2
|
+
import { useQueryClient } from "../../../../../.external/esm/@tanstack_react-query@5.80.6_react@18.3.1/@tanstack/react-query/build/modern/QueryClientProvider.mjs";
|
|
3
3
|
import { useState, useCallback } from "react";
|
|
4
4
|
import { authSignin, authSignout, authResetPassword, authOAuthSignin } from "../utils/authFetch.mjs";
|
|
5
5
|
import { getUser, updateUser } from "../utils/userCRUD.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.
|
|
1
|
+
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.80.6_react@18.3.1/@tanstack/react-query/build/modern/useQuery.mjs";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import { authInfo } from "../utils/authFetch.mjs";
|
|
4
4
|
function useProvideInfo(baseUrl, auth) {
|