@danikokonn/yarik-frontend-lib 2.0.49-test8 → 2.0.49
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/components/Footer/Footer.d.ts.map +1 -1
- package/dist/components/Footer/Footer.js +2 -2
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts.map +1 -1
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.js +1 -1
- package/dist/components/Navigation/NavMenu.d.ts +2 -1
- package/dist/components/Navigation/NavMenu.d.ts.map +1 -1
- package/dist/components/Navigation/NavMenu.js +2 -2
- package/dist/components/Navigation/Navigation.d.ts.map +1 -1
- package/dist/components/Navigation/Navigation.js +4 -4
- package/dist/components/PageWrapper/PageWrapper.d.ts.map +1 -1
- package/dist/components/PageWrapper/PageWrapper.js +4 -3
- package/dist/components/RichFilterTextField/RichFilterTextField.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/RichFilterTextField.js +13 -14
- package/dist/components/SmartTable/RowContent.d.ts +22 -6
- package/dist/components/SmartTable/RowContent.d.ts.map +1 -1
- package/dist/components/SmartTable/RowContent.js +45 -29
- package/dist/components/SmartTable/SmartTable.d.ts +7 -1
- package/dist/components/SmartTable/SmartTable.d.ts.map +1 -1
- package/dist/components/SmartTable/SmartTable.js +60 -49
- package/dist/components/SmartTable/SmartTableProps.d.ts +16 -8
- package/dist/components/SmartTable/SmartTableProps.d.ts.map +1 -1
- package/dist/components/SmartTable/TableHeader.d.ts.map +1 -1
- package/dist/components/SmartTable/TableHeader.js +3 -2
- package/dist/components/SubtaskItem/SubtaskItem.d.ts.map +1 -1
- package/dist/components/SubtaskItem/SubtaskItem.js +57 -11
- package/dist/components/TaskLoader/TaskLoader.d.ts +1 -1
- package/dist/components/TaskLoader/TaskLoader.d.ts.map +1 -1
- package/dist/components/TaskLoader/TaskLoader.js +24 -13
- package/dist/components/TaskLoader/TaskLoaderProps.d.ts +1 -0
- package/dist/components/TaskLoader/TaskLoaderProps.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/TaskStateDialog.d.ts +1 -1
- package/dist/components/TaskStateDialog/TaskStateDialog.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/TaskStateDialog.js +8 -5
- package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts +2 -1
- package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts.map +1 -1
- package/dist/components/icons/GenerateAndRunIcon.d.ts +1 -1
- package/dist/components/icons/GenerateAndRunIcon.d.ts.map +1 -1
- package/dist/components/icons/GenerateAndRunIcon.js +5 -2
- package/dist/components/icons/GenerateIcon.d.ts +1 -1
- package/dist/components/icons/GenerateIcon.d.ts.map +1 -1
- package/dist/components/icons/GenerateIcon.js +5 -2
- package/dist/components/icons/IntegerIcon.d.ts +1 -1
- package/dist/components/icons/IntegerIcon.d.ts.map +1 -1
- package/dist/components/icons/IntegerIcon.js +5 -2
- package/dist/components/icons/QueueIcon.d.ts +1 -1
- package/dist/components/icons/QueueIcon.d.ts.map +1 -1
- package/dist/components/icons/QueueIcon.js +5 -2
- package/dist/components/icons/RangeIcon.d.ts +1 -1
- package/dist/components/icons/RangeIcon.d.ts.map +1 -1
- package/dist/components/icons/RangeIcon.js +5 -2
- package/dist/components/icons/RunIcon.d.ts +1 -1
- package/dist/components/icons/RunIcon.d.ts.map +1 -1
- package/dist/components/icons/RunIcon.js +5 -2
- package/dist/http.d.ts +2 -2
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +4 -29
- package/dist/providers/AirflowProvider.d.ts +5 -4
- package/dist/providers/AirflowProvider.d.ts.map +1 -1
- package/dist/providers/AirflowProvider.js +41 -56
- package/dist/providers/DagStateProvider.d.ts +6 -5
- package/dist/providers/DagStateProvider.d.ts.map +1 -1
- package/dist/providers/DagStateProvider.js +35 -10
- package/dist/providers/SessionProvider.d.ts +3 -1
- package/dist/providers/SessionProvider.d.ts.map +1 -1
- package/dist/providers/SessionProvider.js +10 -4
- package/dist/providers/SnackBarProvider.d.ts +2 -2
- package/dist/providers/SnackBarProvider.d.ts.map +1 -1
- package/dist/providers/SnackBarProvider.js +1 -1
- package/dist/types.d.ts +14 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -2
- package/package.json +10 -5
- package/dist/components/SmartTable/RuleRow.d.ts +0 -22
- package/dist/components/SmartTable/RuleRow.d.ts.map +0 -1
- package/dist/components/SmartTable/RuleRow.js +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../src/components/Footer/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,OAAO,EACP,OAAO,EACP,IAAI,GACL,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../src/components/Footer/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,OAAO,EACP,OAAO,EACP,IAAI,GACL,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,qBAsBA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import Typography from "@mui/material/Typography";
|
|
3
2
|
import { useTheme } from "@mui/material";
|
|
3
|
+
import Typography from "@mui/material/Typography";
|
|
4
4
|
export default function Footer({ version, appName, desc, }) {
|
|
5
5
|
const theme = useTheme();
|
|
6
6
|
return (React.createElement("footer", { style: {
|
|
@@ -9,7 +9,7 @@ export default function Footer({ version, appName, desc, }) {
|
|
|
9
9
|
justifyContent: "space-between",
|
|
10
10
|
alignItems: "center",
|
|
11
11
|
flexWrap: "wrap",
|
|
12
|
-
boxShadow: theme.shadows[5],
|
|
12
|
+
boxShadow: theme.vars?.shadows[5] || theme.shadows[5],
|
|
13
13
|
} },
|
|
14
14
|
React.createElement(Typography, { sx: { marginLeft: "auto", fontSize: "1rem" } },
|
|
15
15
|
"\u00A9",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpAddressSwitchableInput.d.ts","sourceRoot":"","sources":["../../../src/components/IpAddressSwitchableInput/IpAddressSwitchableInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IpAddressSwitchableInput.d.ts","sourceRoot":"","sources":["../../../src/components/IpAddressSwitchableInput/IpAddressSwitchableInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,6BAA6B,MAAM,iCAAiC,CAAC;AAE5E,QAAA,MAAM,wBAAwB,GAAI,aAE/B,6BAA6B,sBAyB/B,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Button } from "@mui/material";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import IpAddressInput from "../IpAddressInput/IpAddressInput";
|
|
3
|
-
import { Button } from "@mui/material";
|
|
4
4
|
const IpAddressSwitchableInput = ({ ...rest }) => {
|
|
5
5
|
const bestMode = /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/.test(rest.value)
|
|
6
6
|
? "6"
|
|
@@ -13,7 +13,8 @@ interface NavMenuProps {
|
|
|
13
13
|
anchorOrigin: PopoverOrigin;
|
|
14
14
|
transformOrigin: PopoverOrigin;
|
|
15
15
|
endIcon: ReactNode;
|
|
16
|
+
withReactRouter?: boolean;
|
|
16
17
|
}
|
|
17
|
-
export default function NavMenu({ name, activeTab, routes, sx, anchorOrigin, transformOrigin, endIcon, }: NavMenuProps): React.JSX.Element;
|
|
18
|
+
export default function NavMenu({ name, activeTab, routes, sx, anchorOrigin, transformOrigin, endIcon, withReactRouter, }: NavMenuProps): React.JSX.Element;
|
|
18
19
|
export {};
|
|
19
20
|
//# sourceMappingURL=NavMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavMenu.d.ts","sourceRoot":"","sources":["../../../src/components/Navigation/NavMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAK/C,OAAO,EAAkB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtE,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,EAAE,CAAC;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACnB,YAAY,EAAE,aAAa,CAAC;IAC5B,eAAe,EAAE,aAAa,CAAC;IAC/B,OAAO,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"NavMenu.d.ts","sourceRoot":"","sources":["../../../src/components/Navigation/NavMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAK/C,OAAO,EAAkB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtE,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,EAAE,CAAC;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACnB,YAAY,EAAE,aAAa,CAAC;IAC5B,eAAe,EAAE,aAAa,CAAC;IAC/B,OAAO,EAAE,SAAS,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC9B,IAAI,EACJ,SAAS,EACT,MAAM,EACN,EAAE,EACF,YAAY,EACZ,eAAe,EACf,OAAO,EACP,eAAe,GAChB,EAAE,YAAY,qBA6Ed"}
|
|
@@ -6,7 +6,7 @@ import Menu from "@mui/material/Menu";
|
|
|
6
6
|
import MenuItem from "@mui/material/MenuItem";
|
|
7
7
|
import { popoverClasses } from "@mui/material/Popover";
|
|
8
8
|
import { Link as RouterLink } from "react-router";
|
|
9
|
-
export default function NavMenu({ name, activeTab, routes, sx, anchorOrigin, transformOrigin, endIcon, }) {
|
|
9
|
+
export default function NavMenu({ name, activeTab, routes, sx, anchorOrigin, transformOrigin, endIcon, withReactRouter, }) {
|
|
10
10
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
11
11
|
let currentlyHovering = false;
|
|
12
12
|
const open = anchorEl != null;
|
|
@@ -38,7 +38,7 @@ export default function NavMenu({ name, activeTab, routes, sx, anchorOrigin, tra
|
|
|
38
38
|
style: { pointerEvents: "auto" },
|
|
39
39
|
},
|
|
40
40
|
}, sx: { [`&.${popoverClasses.root}`]: { pointerEvents: "none" } }, elevation: 0, anchorOrigin: anchorOrigin, transformOrigin: transformOrigin }, routes.map((route, idx) => (React.createElement(MenuItem, { key: idx, disabled: route.url === activeTab, sx: { p: 0 } },
|
|
41
|
-
React.createElement(Link, { component: RouterLink, to: route.url, underline: "none", color: "inherit", sx: { px: "1rem", py: "0.5rem", width: "-webkit-fill-available" }, target: route.targetBlank ? "_blank" : undefined, rel: route.targetBlank ? "noopener noreferrer" : undefined },
|
|
41
|
+
React.createElement(Link, { component: withReactRouter ? RouterLink : "a", to: withReactRouter ? route.url : undefined, href: withReactRouter ? undefined : route.url, underline: "none", color: "inherit", sx: { px: "1rem", py: "0.5rem", width: "-webkit-fill-available" }, target: route.targetBlank ? "_blank" : undefined, rel: route.targetBlank ? "noopener noreferrer" : undefined },
|
|
42
42
|
route.name,
|
|
43
43
|
" ",
|
|
44
44
|
route.targetBlank && (React.createElement(OpenInNewIcon, { fontSize: "small", color: "primary" })))))))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation.d.ts","sourceRoot":"","sources":["../../../src/components/Navigation/Navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AA4BzC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAGhD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,aAAa,EACb,UAAU,EACV,OAAO,EACP,UAAU,EACV,SAAS,EACT,eAAe,GAChB,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"Navigation.d.ts","sourceRoot":"","sources":["../../../src/components/Navigation/Navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AA4BzC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAGhD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,aAAa,EACb,UAAU,EACV,OAAO,EACP,UAAU,EACV,SAAS,EACT,eAAe,GAChB,EAAE,eAAe,qBA8VjB"}
|
|
@@ -23,7 +23,7 @@ import { Button, useColorScheme, useMediaQuery } from "@mui/material";
|
|
|
23
23
|
import { popoverClasses } from "@mui/material/Popover";
|
|
24
24
|
import NavMenu from "./NavMenu";
|
|
25
25
|
export default function Navigation({ additionalControls, username, title, navLinks, logoutPageUrl, defautlUrl, appsUrl, profileUrl, activeTab, withReactRouter, }) {
|
|
26
|
-
const locationRouter = useLocation();
|
|
26
|
+
const locationRouter = withReactRouter ? useLocation() : undefined;
|
|
27
27
|
const { mode, setMode } = useColorScheme();
|
|
28
28
|
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
29
29
|
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
|
@@ -41,11 +41,11 @@ export default function Navigation({ additionalControls, username, title, navLin
|
|
|
41
41
|
const getPages = (sx, anchorOrigin, transformOrigin, endIcon) => {
|
|
42
42
|
return navLinks.map((lnk, idx) => {
|
|
43
43
|
if ("groupName" in lnk) {
|
|
44
|
-
return (React.createElement(NavMenu, { key: idx, name: lnk.groupName, routes: lnk.links, activeTab: withReactRouter ? locationRouter
|
|
44
|
+
return (React.createElement(NavMenu, { key: idx, name: lnk.groupName, routes: lnk.links, activeTab: (withReactRouter ? locationRouter?.pathname : activeTab) || "", sx: sx, anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, endIcon: endIcon, withReactRouter: withReactRouter }));
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
47
|
return (React.createElement(Button, { component: withReactRouter ? RouterLink : "button", disabled: lnk.url ===
|
|
48
|
-
(withReactRouter ? locationRouter
|
|
48
|
+
(withReactRouter ? locationRouter?.pathname : activeTab), to: withReactRouter ? lnk.url : undefined, href: withReactRouter ? undefined : lnk.url, key: idx, sx: sx, color: "inherit", variant: "text" }, lnk.name));
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
};
|
|
@@ -184,7 +184,7 @@ export default function Navigation({ additionalControls, username, title, navLin
|
|
|
184
184
|
React.createElement(ListItemIcon, null,
|
|
185
185
|
React.createElement(HubIcon, { fontSize: "small" })),
|
|
186
186
|
React.createElement(ListItemText, null, "\u041F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F"))),
|
|
187
|
-
React.createElement(MenuItem, { href: logoutPageUrl, component: "a" },
|
|
187
|
+
React.createElement(MenuItem, { to: withReactRouter ? logoutPageUrl : undefined, href: withReactRouter ? undefined : logoutPageUrl, component: withReactRouter ? RouterLink : "a" },
|
|
188
188
|
React.createElement(ListItemIcon, null,
|
|
189
189
|
React.createElement(LogoutIcon, { fontSize: "small" })),
|
|
190
190
|
React.createElement(ListItemText, null, "\u0412\u044B\u0439\u0442\u0438 \u0438\u0437 \u0441\u0438\u0441\u0442\u0435\u043C\u044B"))))))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/PageWrapper/PageWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PageWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/PageWrapper/PageWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,OAAO,EACP,OAAO,EACP,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,gBAAgB,qBAqBlB"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Stack from "@mui/material/Stack";
|
|
3
|
-
import Navigation from "../Navigation/Navigation";
|
|
4
|
-
import Footer from "../Footer/Footer";
|
|
5
3
|
import { useTheme } from "@mui/material";
|
|
4
|
+
import Footer from "../Footer/Footer";
|
|
5
|
+
import Navigation from "../Navigation/Navigation";
|
|
6
6
|
export default function PageWrapper({ children, version, appName, desc, ...props }) {
|
|
7
7
|
const theme = useTheme();
|
|
8
|
-
return (React.createElement(Stack, { direction: "column", bgcolor: theme.palette.background.default
|
|
8
|
+
return (React.createElement(Stack, { direction: "column", bgcolor: theme.vars?.palette.background.default ||
|
|
9
|
+
theme.palette.background.default, sx: {
|
|
9
10
|
justifyContent: "space-between",
|
|
10
11
|
minHeight: "100vh",
|
|
11
12
|
position: "relative",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichFilterTextField.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/RichFilterTextField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RichFilterTextField.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/RichFilterTextField.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAI1E,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAGlE,QAAA,MAAM,mBAAmB,GAAI,wIAS1B,wBAAwB,sBAkS1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ClearIcon from "@mui/icons-material/Clear";
|
|
2
|
+
import SearchRoundedIcon from "@mui/icons-material/SearchRounded";
|
|
2
3
|
import IconButton from "@mui/material/IconButton";
|
|
3
4
|
import InputAdornment from "@mui/material/InputAdornment";
|
|
5
|
+
import Stack from "@mui/material/Stack";
|
|
4
6
|
import TextField from "@mui/material/TextField";
|
|
5
|
-
import
|
|
6
|
-
import SearchRoundedIcon from "@mui/icons-material/SearchRounded";
|
|
7
|
-
import HintOptionsMenu from "./HintOptionsMenu";
|
|
8
|
-
import { getHints, insertInStrPos } from "./utils";
|
|
7
|
+
import React, { useRef, useState } from "react";
|
|
9
8
|
import { useSnackbarContext } from "../../providers";
|
|
10
9
|
import FilterHistoryMenu from "./FilterHistoryMenu";
|
|
11
|
-
import
|
|
10
|
+
import HintOptionsMenu from "./HintOptionsMenu";
|
|
11
|
+
import { getHints, insertInStrPos } from "./utils";
|
|
12
12
|
const RichFilterTextField = ({ filterExpr, filterExprHist: searchHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }) => {
|
|
13
13
|
const { enqueueSnackbar } = useSnackbarContext();
|
|
14
14
|
const [search, setSearch] = useState(filterExpr);
|
|
@@ -44,14 +44,13 @@ const RichFilterTextField = ({ filterExpr, filterExprHist: searchHist, fields, o
|
|
|
44
44
|
const insertHint = (hint) => {
|
|
45
45
|
if (cursorPos == null)
|
|
46
46
|
return;
|
|
47
|
-
if (hint.includes("["))
|
|
48
|
-
hint
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
hint = hint.replace("regex", "");
|
|
47
|
+
if ((hint.includes("[") && hint.endsWith("]")) ||
|
|
48
|
+
(hint.includes("(") && hint.endsWith(")")) ||
|
|
49
|
+
((hint.match(/\//g) || []).length === 2 && hint.endsWith("/"))) {
|
|
50
|
+
hint = hint
|
|
51
|
+
.replace(/\[.*?\]/g, "[]")
|
|
52
|
+
.replace(/\(.*?\)/g, "()")
|
|
53
|
+
.replace(/\/.*?\//g, "//");
|
|
55
54
|
}
|
|
56
55
|
const { newSearch, newPos } = insertInStrPos(search, cursorPos, hint, fields);
|
|
57
56
|
setSearch(newSearch);
|
|
@@ -1,18 +1,34 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
1
|
import { SxProps, Theme } from "@mui/material";
|
|
2
|
+
import React, { ComponentType } from "react";
|
|
3
3
|
import { Column } from "../../types";
|
|
4
4
|
interface RowContentProps<T extends {
|
|
5
5
|
id: string | number;
|
|
6
|
+
} = {
|
|
7
|
+
id: string | number;
|
|
8
|
+
}, P extends {
|
|
9
|
+
row: T;
|
|
10
|
+
} = {
|
|
11
|
+
row: T;
|
|
12
|
+
}, S extends {
|
|
13
|
+
row: T;
|
|
14
|
+
} = {
|
|
15
|
+
row: T;
|
|
6
16
|
}> {
|
|
7
17
|
row: T;
|
|
8
|
-
columns: Column<T>[];
|
|
18
|
+
columns: Column<T, S>[];
|
|
9
19
|
onDoubleClick?(rowId: string | number | null): void;
|
|
10
20
|
onSelectRow(rowId: string | number | null): void;
|
|
11
|
-
|
|
21
|
+
ControlComponent?: ComponentType<P>;
|
|
22
|
+
ControlComponentProps?: Omit<P, "row">;
|
|
12
23
|
controlComponentColSx?: SxProps<Theme>;
|
|
13
24
|
}
|
|
14
|
-
|
|
25
|
+
declare function RowContent<T extends {
|
|
15
26
|
id: string | number;
|
|
16
|
-
}
|
|
17
|
-
|
|
27
|
+
}, P extends {
|
|
28
|
+
row: T;
|
|
29
|
+
}, S extends {
|
|
30
|
+
row: T;
|
|
31
|
+
}>({ row, columns, onSelectRow, onDoubleClick, ControlComponent, ControlComponentProps, controlComponentColSx, }: RowContentProps<T, P, S>): React.JSX.Element;
|
|
32
|
+
declare const _default: typeof RowContent;
|
|
33
|
+
export default _default;
|
|
18
34
|
//# sourceMappingURL=RowContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowContent.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/RowContent.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"RowContent.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/RowContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAEzD,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,UAAU,eAAe,CACvB,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAC3D,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,EACjC,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE;IAEjC,GAAG,EAAE,CAAC,CAAC;IACP,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACpD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACjD,gBAAgB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACpC,qBAAqB,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACxC;AAUD,iBAAS,UAAU,CACjB,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACjC,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,EACpB,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,EACpB,EACA,GAAG,EACH,OAAO,EACP,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EAErB,qBAAqB,GACtB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,qBAwF1B;wBAIwC,OAAO,UAAU;AAA1D,wBAA2D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { useTheme } from "@mui/material";
|
|
3
2
|
import TableCell from "@mui/material/TableCell";
|
|
4
|
-
import
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { JSONTree } from "react-json-tree";
|
|
5
5
|
const hiddenTextStyle = {
|
|
6
6
|
whiteSpace: "nowrap",
|
|
7
7
|
overflow: "hidden",
|
|
@@ -9,47 +9,63 @@ const hiddenTextStyle = {
|
|
|
9
9
|
paddingTop: "0.25rem",
|
|
10
10
|
paddingBottom: "0.25rem",
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
function RowContent({ row, columns, onSelectRow, onDoubleClick, ControlComponent, ControlComponentProps, controlComponentColSx, }) {
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
const treeTheme = {
|
|
15
|
-
scheme:
|
|
16
|
-
author:
|
|
17
|
-
base00: theme.palette.background.paper, // background
|
|
18
|
-
base01: theme.palette.background.default
|
|
15
|
+
scheme: "google",
|
|
16
|
+
author: "seth wright (http://sethawright.com)",
|
|
17
|
+
base00: theme.vars?.palette.background.paper || theme.palette.background.paper, // background
|
|
18
|
+
base01: theme.vars?.palette.background.default ||
|
|
19
|
+
theme.palette.background.default, // lighter background
|
|
19
20
|
base02: "#e0e0e0", // selection (можно взять divider)
|
|
20
|
-
base03: theme.palette.text.disabled ||
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
base03: theme.vars?.palette.text.disabled ||
|
|
22
|
+
theme.palette.text.disabled ||
|
|
23
|
+
"#9e9e9e",
|
|
24
|
+
base04: theme.vars?.palette.text.secondary || theme.palette.text.secondary,
|
|
25
|
+
base05: theme.vars?.palette.text.primary || theme.palette.text.primary,
|
|
23
26
|
base06: "#eeeeee",
|
|
24
27
|
base07: "#ffffff",
|
|
25
|
-
base08: theme.palette.error.main,
|
|
26
|
-
base09: theme.palette.warning.main,
|
|
27
|
-
base0A: theme.palette.info.main,
|
|
28
|
-
base0B: theme.palette.success.main,
|
|
29
|
-
base0C: theme.palette.secondary.main,
|
|
30
|
-
base0D: theme.palette.primary.main,
|
|
31
|
-
base0E: theme.palette.secondary.main,
|
|
32
|
-
base0F: "#8d6e63" // обычно brown / deprecated
|
|
28
|
+
base08: theme.vars?.palette.error.main || theme.palette.error.main,
|
|
29
|
+
base09: theme.vars?.palette.warning.main || theme.palette.warning.main,
|
|
30
|
+
base0A: theme.vars?.palette.info.main || theme.palette.info.main,
|
|
31
|
+
base0B: theme.vars?.palette.success.main || theme.palette.success.main,
|
|
32
|
+
base0C: theme.vars?.palette.secondary.main || theme.palette.secondary.main,
|
|
33
|
+
base0D: theme.vars?.palette.primary.main || theme.palette.primary.main,
|
|
34
|
+
base0E: theme.vars?.palette.secondary.main || theme.palette.secondary.main,
|
|
35
|
+
base0F: "#8d6e63", // обычно brown / deprecated
|
|
33
36
|
};
|
|
34
37
|
return (React.createElement(React.Fragment, null,
|
|
35
38
|
columns.map((col, idx) => (React.createElement(TableCell, { sx: {
|
|
36
39
|
...hiddenTextStyle,
|
|
37
40
|
...col.colSx,
|
|
38
41
|
"& > ul": {
|
|
39
|
-
overflowX: "auto"
|
|
42
|
+
overflowX: "auto",
|
|
43
|
+
},
|
|
44
|
+
}, key: idx, onClick: (e) => {
|
|
45
|
+
if (typeof col.onClick !== "undefined") {
|
|
46
|
+
if (e.target === e.currentTarget)
|
|
47
|
+
col.onClick(row);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const selection = window.getSelection();
|
|
51
|
+
if (selection && selection.toString().length > 0)
|
|
52
|
+
return;
|
|
53
|
+
onSelectRow(Object(row).id);
|
|
40
54
|
}
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
: typeof Object(row)[col.name] === "object" && Object(row)[col.name] != null ? (React.createElement(JSONTree /*invertTheme={invertTheme}*/, { theme: treeTheme, shouldExpandNodeInitially: () => false, data: Object(row)[col.name] })) : Object(row)[col.name] || "N/A"))),
|
|
49
|
-
controlComponent && (React.createElement(TableCell, { sx: {
|
|
55
|
+
}, onDoubleClick: typeof onDoubleClick !== "undefined"
|
|
56
|
+
? (_) => onDoubleClick(Object(row).id)
|
|
57
|
+
: undefined }, col.CellContentComponent ? (React.createElement(col.CellContentComponent, { ...{ row, ...col.CellContentComponentProps } })) : typeof Object(row)[col.name] === "object" &&
|
|
58
|
+
Object(row)[col.name] != null ? (React.createElement(JSONTree
|
|
59
|
+
/*invertTheme={invertTheme}*/ , {
|
|
60
|
+
/*invertTheme={invertTheme}*/ theme: treeTheme, shouldExpandNodeInitially: () => false, data: Object(row)[col.name] })) : (Object(row)[col.name] || "N/A")))),
|
|
61
|
+
ControlComponent && (React.createElement(TableCell, { sx: {
|
|
50
62
|
textAlign: "center",
|
|
51
63
|
cursor: "default",
|
|
52
64
|
p: 0,
|
|
53
65
|
...controlComponentColSx,
|
|
54
|
-
} },
|
|
66
|
+
} },
|
|
67
|
+
React.createElement(ControlComponent, { ...{ row, ...ControlComponentProps } })))));
|
|
55
68
|
}
|
|
69
|
+
// Memoize to prevent re-renders when row/columns/props haven't changed
|
|
70
|
+
// This is critical for scroll performance with heavy cellContentComponent renders
|
|
71
|
+
export default React.memo(RowContent);
|
|
@@ -2,5 +2,11 @@ import React from "react";
|
|
|
2
2
|
import SmartTableProps from "./SmartTableProps";
|
|
3
3
|
export default function SmartTable<T extends {
|
|
4
4
|
id: string | number;
|
|
5
|
-
}
|
|
5
|
+
} = {
|
|
6
|
+
id: string | number;
|
|
7
|
+
}, P extends {
|
|
8
|
+
row: T;
|
|
9
|
+
} = {
|
|
10
|
+
row: T;
|
|
11
|
+
}>({ rows, columns, pageN, numPages, perPage, loading, minWidth, width, rowStyles, selectable, selectedRow, sx, disablePerPageSelector, globalSearch, columnAutoWidth, error, globalSearchComponent, ContentWrapper, ControlComponent, ControlComponentProps, virtuosoRef, controlComponentColSx, perPageOptions, onToggleSort, onInputSearch, onPageSelect, onChangePerPage, onSelectRow, onRowDoubleClick, }: SmartTableProps<T, P>): React.JSX.Element;
|
|
6
12
|
//# sourceMappingURL=SmartTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartTable.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/SmartTable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SmartTable.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/SmartTable.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAgFhD,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAC3D,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,EACjC,EACA,IAAI,EACJ,OAAO,EACP,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,UAAU,EACV,WAAW,EACX,EAAE,EACF,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,KAAK,EACL,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,WAAW,EACX,gBAAgB,GACjB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,qBAiUvB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CircularProgress, Skeleton, Stack, Typography, useTheme, } from "@mui/material";
|
|
1
|
+
import { CircularProgress, Stack, Typography, useTheme } from "@mui/material";
|
|
3
2
|
import FormControl from "@mui/material/FormControl";
|
|
4
3
|
import InputLabel from "@mui/material/InputLabel";
|
|
5
4
|
import MenuItem from "@mui/material/MenuItem";
|
|
@@ -12,6 +11,7 @@ import TableCell from "@mui/material/TableCell";
|
|
|
12
11
|
import TableContainer from "@mui/material/TableContainer";
|
|
13
12
|
import TableFooter from "@mui/material/TableFooter";
|
|
14
13
|
import TableRow from "@mui/material/TableRow";
|
|
14
|
+
import React, { Fragment, Suspense, useCallback, useMemo } from "react";
|
|
15
15
|
import { TableVirtuoso } from "react-virtuoso";
|
|
16
16
|
import ColumnSearchInput from "../ColumnSearchInput/ColumnSearchInput";
|
|
17
17
|
import SortBtn from "../SortBtn/SortBtn";
|
|
@@ -36,7 +36,7 @@ const Row = (props) => {
|
|
|
36
36
|
const selectedRow = Object(props).context.selectedRow;
|
|
37
37
|
const rowStyles = Object(props).context.rowStyles;
|
|
38
38
|
const selectable = Object(props).context.selectable;
|
|
39
|
-
return ContentWrapper ? (React.createElement(ContentWrapper, {
|
|
39
|
+
return ContentWrapper ? (React.createElement(ContentWrapper, { rowProps: {
|
|
40
40
|
selected: Object(props).item.id === selectedRow,
|
|
41
41
|
...props,
|
|
42
42
|
}, ...props })) : (React.createElement(TableRow, { hover: true, sx: {
|
|
@@ -50,17 +50,7 @@ const TableWrapper = (props) => (React.createElement(Table, { ...props, stickyHe
|
|
|
50
50
|
...Object(props).context.tableStyle,
|
|
51
51
|
minWidth: Object(props).context.minWidth || "100%",
|
|
52
52
|
} }));
|
|
53
|
-
|
|
54
|
-
const ScrollSeekPlaceholder = (props) => (
|
|
55
|
-
// eslint-disable-next-line react/prop-types
|
|
56
|
-
React.createElement(TableRow, { sx: { height: Object(props).height } }, Object(props).context.columns.map((col, i) => (React.createElement(TableCell, { sx: {
|
|
57
|
-
paddingTop: "0.25rem",
|
|
58
|
-
paddingBottom: "0.25rem",
|
|
59
|
-
py: 0,
|
|
60
|
-
...col.colSx,
|
|
61
|
-
}, key: i },
|
|
62
|
-
React.createElement(Skeleton, { variant: "rectangular", width: "100%" }))))));
|
|
63
|
-
export default function SmartTable({ rows, columns, pageN, numPages, perPage, loading, minWidth, width, rowStyles, selectable, selectedRow, sx, disablePerPageSelector, globalSearch, columnAutoWidth, error, globalSearchComponent, ContentWrapper, onRowDoubleClick, onSelectRow, controlComponent: ControlComponent, onToggleSort, onInputSearch, onPageSelect, onChangePerPage, controlComponentColSx, perPageOptions, }) {
|
|
53
|
+
export default function SmartTable({ rows, columns, pageN, numPages, perPage, loading, minWidth, width, rowStyles, selectable, selectedRow, sx, disablePerPageSelector, globalSearch, columnAutoWidth, error, globalSearchComponent, ContentWrapper, ControlComponent, ControlComponentProps, virtuosoRef, controlComponentColSx, perPageOptions, onToggleSort, onInputSearch, onPageSelect, onChangePerPage, onSelectRow, onRowDoubleClick, }) {
|
|
64
54
|
const theme = useTheme();
|
|
65
55
|
const tableStyle = {
|
|
66
56
|
width: columnAutoWidth ? "auto" : "100%",
|
|
@@ -68,14 +58,14 @@ export default function SmartTable({ rows, columns, pageN, numPages, perPage, lo
|
|
|
68
58
|
borderCollapse: "separate",
|
|
69
59
|
borderSpacing: 0,
|
|
70
60
|
};
|
|
71
|
-
|
|
61
|
+
const handleSelectRow = (rowId) => {
|
|
72
62
|
if (selectable && onSelectRow) {
|
|
73
63
|
onSelectRow(rowId);
|
|
74
64
|
}
|
|
75
|
-
}
|
|
65
|
+
};
|
|
76
66
|
const hasSearchableColumns = columns.some((col) => col.searchable);
|
|
77
67
|
const hasGlobalSearch = globalSearch && globalSearchComponent;
|
|
78
|
-
const searchCols = () => columns.map((col, idx) => (React.createElement(TableCell, { key: idx, scope: "col", sx: { ...col.colSx } }, col.searchable ? ((col.
|
|
68
|
+
const searchCols = () => columns.map((col, idx) => (React.createElement(TableCell, { key: idx, scope: "col", sx: { ...col.colSx } }, col.searchable ? ((col.SearchComponent && (React.createElement(col.SearchComponent, { ...col.SearchComponentProps }))) || (React.createElement(ColumnSearchInput, { field: col.fieldName, searchStr: col.searchStr, onInputSearch: onInputSearch }))) : (React.createElement(React.Fragment, null)))));
|
|
79
69
|
const headerTitleRow = (React.createElement(TableRow, { key: 0 },
|
|
80
70
|
columns.map((col, idx) => (React.createElement(TableCell, { key: idx, scope: "col", sx: {
|
|
81
71
|
resize: col.resizable ? "horizontal" : "none",
|
|
@@ -93,38 +83,55 @@ export default function SmartTable({ rows, columns, pageN, numPages, perPage, lo
|
|
|
93
83
|
transform: "translate(-50%, -50%)",
|
|
94
84
|
};
|
|
95
85
|
const headerRows = [headerTitleRow, headerSearchRow];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
86
|
+
const placeholder = useMemo(() => {
|
|
87
|
+
if (error && rows.length === 0) {
|
|
88
|
+
return (React.createElement(Typography, { variant: "h6", color: "textSecondary", sx: centerStyle }, "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435"));
|
|
89
|
+
}
|
|
90
|
+
if (loading) {
|
|
91
|
+
return React.createElement(CircularProgress, { sx: centerStyle });
|
|
92
|
+
}
|
|
93
|
+
if (rows.length === 0) {
|
|
94
|
+
return (React.createElement(Typography, { variant: "h6", color: "textSecondary", sx: centerStyle }, "\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E"));
|
|
95
|
+
}
|
|
96
|
+
return React.createElement(React.Fragment, null);
|
|
97
|
+
}, [error, loading, rows.length]);
|
|
98
|
+
const fixedHeaderContent = useCallback(() => React.createElement(Fragment, null, hasGlobalSearch ? headerRows[0] : headerRows), [hasGlobalSearch, headerRows]);
|
|
99
|
+
const tableContext = useMemo(() => ({
|
|
100
|
+
columns,
|
|
101
|
+
minWidth,
|
|
102
|
+
rowStyles,
|
|
103
|
+
selectable,
|
|
104
|
+
tableStyle,
|
|
105
|
+
placeholder,
|
|
106
|
+
selectedRow,
|
|
107
|
+
ContentWrapper,
|
|
108
|
+
ControlComponent,
|
|
109
|
+
ControlComponentProps,
|
|
110
|
+
onRowDoubleClick,
|
|
111
|
+
handleSelectRow,
|
|
112
|
+
}), [
|
|
113
|
+
columns,
|
|
114
|
+
minWidth,
|
|
115
|
+
rowStyles,
|
|
116
|
+
selectable,
|
|
117
|
+
tableStyle,
|
|
118
|
+
placeholder,
|
|
119
|
+
selectedRow,
|
|
120
|
+
ContentWrapper,
|
|
121
|
+
ControlComponent,
|
|
122
|
+
ControlComponentProps,
|
|
123
|
+
onRowDoubleClick,
|
|
124
|
+
handleSelectRow,
|
|
125
|
+
]);
|
|
120
126
|
const VirtuosoTableComponents = {
|
|
121
127
|
Scroller: Scroller,
|
|
122
128
|
Table: TableWrapper,
|
|
123
129
|
TableRow: Row,
|
|
124
130
|
TableHead: TableHead,
|
|
125
131
|
TableBody: TableBodyWrapper,
|
|
126
|
-
ScrollSeekPlaceholder: ScrollSeekPlaceholder,
|
|
132
|
+
// ScrollSeekPlaceholder: ScrollSeekPlaceholder,
|
|
127
133
|
};
|
|
134
|
+
const itemContent = (_index, row, context) => (React.createElement(RowContent, { key: row.id, row: row, columns: context.columns, ControlComponent: context.ControlComponent, ControlComponentProps: context.ControlComponentProps, onDoubleClick: context.onRowDoubleClick, onSelectRow: context.selectable ? context.handleSelectRow : () => { } }));
|
|
128
135
|
return (React.createElement(Paper, { sx: {
|
|
129
136
|
height: "74vh",
|
|
130
137
|
position: "relative",
|
|
@@ -142,20 +149,24 @@ export default function SmartTable({ rows, columns, pageN, numPages, perPage, lo
|
|
|
142
149
|
hasGlobalSearch && (React.createElement(Table, { size: "small", className: "rulesTable", stickyHeader: true, sx: { ...tableStyle, minWidth: minWidth || "100%", height: "auto" } },
|
|
143
150
|
React.createElement(TableHeader, null, headerRows[1]))),
|
|
144
151
|
React.createElement(Suspense, { fallback: React.createElement(CircularProgress, { sx: { position: "absolute", left: "50%", top: "50%" } }) },
|
|
145
|
-
React.createElement(TableVirtuoso, { style: { height: "100%" }, totalCount: rows.length, data: rows, components: VirtuosoTableComponents, fixedHeaderContent: fixedHeaderContent, itemContent:
|
|
152
|
+
React.createElement(TableVirtuoso, { ref: virtuosoRef, style: { height: "100%" }, totalCount: rows.length, data: rows, components: VirtuosoTableComponents, fixedHeaderContent: fixedHeaderContent, itemContent: itemContent, context: tableContext,
|
|
146
153
|
// scrollSeekConfiguration={{
|
|
147
|
-
// //
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
//
|
|
154
|
+
// // Enter placeholder mode only on truly fast scroll (>150px/frame, ~keyboard=100-120)
|
|
155
|
+
// // This filters out slow mouse drags
|
|
156
|
+
// enter: (velocity) => Math.abs(velocity) > 150,
|
|
157
|
+
// // Exit when user clearly stops (velocity drops below 30)
|
|
158
|
+
// exit: (velocity) => Math.abs(velocity) < 30,
|
|
151
159
|
// }}
|
|
152
|
-
|
|
160
|
+
// Render only 150px above/below viewport instead of 800px
|
|
161
|
+
// This dramatically improves keyboard scroll performance
|
|
162
|
+
increaseViewportBy: { top: 200, bottom: 200 } }))),
|
|
153
163
|
React.createElement(Table, { sx: { ...tableStyle, height: "auto", minWidth: minWidth || "100%" } },
|
|
154
164
|
React.createElement(TableFooter, { sx: {
|
|
155
165
|
bottom: "0%",
|
|
156
166
|
zIndex: 600,
|
|
157
167
|
position: "sticky",
|
|
158
|
-
backgroundColor: theme.palette.background.default
|
|
168
|
+
backgroundColor: theme.vars?.palette.background.default ||
|
|
169
|
+
theme.palette.background.default,
|
|
159
170
|
} },
|
|
160
171
|
React.createElement(TableRow, null,
|
|
161
172
|
React.createElement(TableCell, { colSpan: 11 },
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { SxProps, TableRowProps, Theme } from "@mui/material";
|
|
2
|
-
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { TableVirtuosoHandle } from "react-virtuoso";
|
|
3
4
|
import { Column } from "../../types";
|
|
4
5
|
export default interface SmartTableProps<T extends {
|
|
5
6
|
id: string | number;
|
|
7
|
+
} = {
|
|
8
|
+
id: string | number;
|
|
9
|
+
}, P extends {
|
|
10
|
+
row: T;
|
|
11
|
+
} = {
|
|
12
|
+
row: T;
|
|
6
13
|
}> {
|
|
7
14
|
rows: T[];
|
|
8
15
|
columns: Column<T>[];
|
|
@@ -20,13 +27,17 @@ export default interface SmartTableProps<T extends {
|
|
|
20
27
|
disablePerPageSelector?: boolean;
|
|
21
28
|
globalSearch?: boolean;
|
|
22
29
|
globalSearchComponent?: ReactElement;
|
|
23
|
-
|
|
30
|
+
error?: boolean;
|
|
31
|
+
perPageOptions?: number[];
|
|
32
|
+
ContentWrapper?: ComponentType<{
|
|
24
33
|
children?: ReactNode;
|
|
25
|
-
rowId: string | number;
|
|
26
34
|
rowProps: TableRowProps;
|
|
27
|
-
}
|
|
35
|
+
}>;
|
|
36
|
+
ControlComponent?: ComponentType<P>;
|
|
37
|
+
ControlComponentProps?: Omit<P, "row">;
|
|
38
|
+
controlComponentColSx?: SxProps<Theme>;
|
|
39
|
+
virtuosoRef?: React.Ref<TableVirtuosoHandle> | undefined;
|
|
28
40
|
onSelectRow?(rowId: string): void;
|
|
29
|
-
controlComponent?(row: T): ReactNode;
|
|
30
41
|
onRowDoubleClick?(rowId: string | null): void;
|
|
31
42
|
onToggleSort(field: string, order: "asc" | "desc" | "none"): void;
|
|
32
43
|
onInputSearch(options: {
|
|
@@ -35,8 +46,5 @@ export default interface SmartTableProps<T extends {
|
|
|
35
46
|
}[]): void;
|
|
36
47
|
onPageSelect(pageN: number): void;
|
|
37
48
|
onChangePerPage?(perPage: number): void;
|
|
38
|
-
controlComponentColSx?: SxProps<Theme>;
|
|
39
|
-
error?: boolean;
|
|
40
|
-
perPageOptions?: number[];
|
|
41
49
|
}
|
|
42
50
|
//# sourceMappingURL=SmartTableProps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartTableProps.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/SmartTableProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SmartTableProps.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/SmartTableProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,OAAO,WAAW,eAAe,CACtC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAC3D,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE;IAEjC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qBAAqB,CAAC,EAAE,YAAY,CAAC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,aAAa,CAAC;QAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;QACrB,QAAQ,EAAE,aAAa,CAAC;KACzB,CAAC,CAAC;IACH,gBAAgB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACpC,qBAAqB,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;IACzD,WAAW,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,gBAAgB,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAC9C,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAClE,aAAa,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,IAAI,CAAC;IAClE,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,eAAe,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/TableHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/TableHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAkB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEpE,QAAA,MAAM,WAAW,GAAI,mBAAmB,cAAc,sBAiBrD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|