fastapi-rtk 2.2.0 → 2.2.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/core/cjs/Tables/NextGenDataGrid/hooks/useEvent.cjs +7 -1
- package/dist/core/cjs/Wrappers/InfiniteScroll/InfiniteScroll.cjs +2 -1
- package/dist/core/cjs/translations/de.cjs +1 -0
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useEvent.mjs +7 -1
- package/dist/core/esm/Wrappers/InfiniteScroll/InfiniteScroll.mjs +3 -2
- package/dist/core/esm/translations/de.mjs +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useEvent.d.ts +2 -1
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useEvent.test.d.ts +1 -0
- package/dist/core/lib/translations/de.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const utils = require("fastapi-rtk/utils");
|
|
4
4
|
const React = require("react");
|
|
5
|
+
const INTERACTIVE_SELECTOR = 'button, a, input, select, textarea, label, [role="button"]';
|
|
5
6
|
function useEvent(onClickEntry) {
|
|
6
7
|
return React.useMemo(
|
|
7
8
|
() => onClickEntry ? {
|
|
8
9
|
mantineTableBodyRowProps: ({ row }) => ({
|
|
9
|
-
onClick: () =>
|
|
10
|
+
onClick: (event) => {
|
|
11
|
+
if (event.target instanceof Element && event.target.closest(INTERACTIVE_SELECTOR)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
onClickEntry(utils.getItemId(row.original), row.original);
|
|
15
|
+
},
|
|
10
16
|
style: { cursor: "pointer" }
|
|
11
17
|
})
|
|
12
18
|
} : void 0,
|
|
@@ -7,12 +7,13 @@ const hooks = require("@mantine/hooks");
|
|
|
7
7
|
const React = require("react");
|
|
8
8
|
const contexts = require("fastapi-rtk/contexts");
|
|
9
9
|
const InfiniteScroll = (props) => {
|
|
10
|
+
const { t } = contexts.useTranslation();
|
|
10
11
|
const {
|
|
11
12
|
children,
|
|
12
13
|
fetch = true,
|
|
13
14
|
components: {
|
|
14
15
|
Loading = /* @__PURE__ */ jsxRuntime.jsx(core.Center, { children: /* @__PURE__ */ jsxRuntime.jsx(core.Loader, {}) }),
|
|
15
|
-
End = /* @__PURE__ */ jsxRuntime.jsx(core.Center, { children: "End of data" }),
|
|
16
|
+
End = /* @__PURE__ */ jsxRuntime.jsx(core.Center, { children: t("End of data") }),
|
|
16
17
|
FetchWrapper = core.Center
|
|
17
18
|
} = {},
|
|
18
19
|
fetchWrapperProps
|
|
@@ -18,6 +18,7 @@ const de = {
|
|
|
18
18
|
"Are you sure you want to delete this item?": "Sind Sie Sicher, dass Sie das Item löschen wollen?",
|
|
19
19
|
"No filters": "Keine Filter",
|
|
20
20
|
"Advanced Filters": "Erweiterte Filter",
|
|
21
|
+
"End of data": "Ende der Daten",
|
|
21
22
|
// Error titles
|
|
22
23
|
Error: "Fehler",
|
|
23
24
|
"Could not fetch info": "Informationen konnten nicht abgerufen werden",
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { getItemId } from "fastapi-rtk/utils";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
+
const INTERACTIVE_SELECTOR = 'button, a, input, select, textarea, label, [role="button"]';
|
|
3
4
|
function useEvent(onClickEntry) {
|
|
4
5
|
return useMemo(
|
|
5
6
|
() => onClickEntry ? {
|
|
6
7
|
mantineTableBodyRowProps: ({ row }) => ({
|
|
7
|
-
onClick: () =>
|
|
8
|
+
onClick: (event) => {
|
|
9
|
+
if (event.target instanceof Element && event.target.closest(INTERACTIVE_SELECTOR)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
onClickEntry(getItemId(row.original), row.original);
|
|
13
|
+
},
|
|
8
14
|
style: { cursor: "pointer" }
|
|
9
15
|
})
|
|
10
16
|
} : void 0,
|
|
@@ -3,14 +3,15 @@ import { parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
|
3
3
|
import { Center, Loader } from "@mantine/core";
|
|
4
4
|
import { useInViewport } from "@mantine/hooks";
|
|
5
5
|
import { useMemo, useEffect } from "react";
|
|
6
|
-
import { useApi } from "fastapi-rtk/contexts";
|
|
6
|
+
import { useTranslation, useApi } from "fastapi-rtk/contexts";
|
|
7
7
|
const InfiniteScroll = (props) => {
|
|
8
|
+
const { t } = useTranslation();
|
|
8
9
|
const {
|
|
9
10
|
children,
|
|
10
11
|
fetch = true,
|
|
11
12
|
components: {
|
|
12
13
|
Loading = /* @__PURE__ */ jsx(Center, { children: /* @__PURE__ */ jsx(Loader, {}) }),
|
|
13
|
-
End = /* @__PURE__ */ jsx(Center, { children: "End of data" }),
|
|
14
|
+
End = /* @__PURE__ */ jsx(Center, { children: t("End of data") }),
|
|
14
15
|
FetchWrapper = Center
|
|
15
16
|
} = {},
|
|
16
17
|
fetchWrapperProps
|
|
@@ -17,6 +17,7 @@ const de = {
|
|
|
17
17
|
"Are you sure you want to delete this item?": "Sind Sie Sicher, dass Sie das Item löschen wollen?",
|
|
18
18
|
"No filters": "Keine Filter",
|
|
19
19
|
"Advanced Filters": "Erweiterte Filter",
|
|
20
|
+
"End of data": "Ende der Daten",
|
|
20
21
|
// Error titles
|
|
21
22
|
Error: "Fehler",
|
|
22
23
|
"Could not fetch info": "Informationen konnten nicht abgerufen werden",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { MRT_Row, MRT_RowData } from '../../../../../.external/lib/mantine-react-table';
|
|
2
|
+
import { MouseEvent } from 'react';
|
|
2
3
|
import { OnClickEntry } from './types';
|
|
3
4
|
export declare function useEvent(onClickEntry?: OnClickEntry): {
|
|
4
5
|
mantineTableBodyRowProps: ({ row }: {
|
|
5
6
|
row: MRT_Row<MRT_RowData>;
|
|
6
7
|
}) => {
|
|
7
|
-
onClick: () => void;
|
|
8
|
+
onClick: (event: MouseEvent<HTMLTableRowElement>) => void;
|
|
8
9
|
style: {
|
|
9
10
|
cursor: string;
|
|
10
11
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,6 +15,7 @@ declare const de: {
|
|
|
15
15
|
readonly 'Are you sure you want to delete this item?': "Sind Sie Sicher, dass Sie das Item löschen wollen?";
|
|
16
16
|
readonly 'No filters': "Keine Filter";
|
|
17
17
|
readonly 'Advanced Filters': "Erweiterte Filter";
|
|
18
|
+
readonly 'End of data': "Ende der Daten";
|
|
18
19
|
readonly Error: "Fehler";
|
|
19
20
|
readonly 'Could not fetch info': "Informationen konnten nicht abgerufen werden";
|
|
20
21
|
readonly 'Could not fetch list': "Liste konnte nicht abgerufen werden";
|
package/package.json
CHANGED