@danikokonn/yarik-frontend-lib 2.0.55-test → 2.0.55
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/ActionDialog/ActionDialog.d.ts +1 -2
- package/dist/components/ActionDialog/ActionDialog.d.ts.map +1 -1
- package/dist/components/ActionDialog/ActionDialog.js +7 -18
- package/dist/components/ActionDialog/ActionDialogProps.d.ts +1 -1
- package/dist/components/ActionDialog/ActionDialogProps.d.ts.map +1 -1
- package/dist/components/ActionDialog/index.d.ts +2 -2
- package/dist/components/ActionDialog/index.d.ts.map +1 -1
- package/dist/components/ActionDialog/index.js +1 -1
- package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts +1 -2
- package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts.map +1 -1
- package/dist/components/ColumnSearchInput/ColumnSearchInput.js +5 -5
- package/dist/components/ColumnSearchInput/index.d.ts +2 -2
- package/dist/components/ColumnSearchInput/index.d.ts.map +1 -1
- package/dist/components/ColumnSearchInput/index.js +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +2 -3
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js +39 -41
- package/dist/components/DateTimeRangePicker/index.d.ts +2 -2
- package/dist/components/DateTimeRangePicker/index.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/index.js +1 -1
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts +1 -0
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts.map +1 -1
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.js +38 -44
- package/dist/components/DatetimeRangeInput/index.d.ts +2 -2
- package/dist/components/DatetimeRangeInput/index.d.ts.map +1 -1
- package/dist/components/DatetimeRangeInput/index.js +1 -1
- package/dist/components/Footer/Footer.d.ts +1 -2
- package/dist/components/Footer/Footer.d.ts.map +1 -1
- package/dist/components/Footer/Footer.js +5 -13
- package/dist/components/Footer/index.d.ts +1 -1
- package/dist/components/Footer/index.d.ts.map +1 -1
- package/dist/components/Footer/index.js +1 -1
- package/dist/components/IpAddressInput/IpAddressInput.d.ts +1 -2
- package/dist/components/IpAddressInput/IpAddressInput.d.ts.map +1 -1
- package/dist/components/IpAddressInput/IpAddressInput.js +5 -6
- package/dist/components/IpAddressInput/index.d.ts +2 -2
- package/dist/components/IpAddressInput/index.d.ts.map +1 -1
- package/dist/components/IpAddressInput/index.js +1 -1
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts +1 -2
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts.map +1 -1
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.js +3 -2
- package/dist/components/IpAddressSwitchableInput/index.d.ts +2 -2
- package/dist/components/IpAddressSwitchableInput/index.d.ts.map +1 -1
- package/dist/components/IpAddressSwitchableInput/index.js +1 -1
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.d.ts +1 -2
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.d.ts.map +1 -1
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.js +6 -6
- package/dist/components/LocalizedDatetimePicker/index.d.ts +2 -2
- package/dist/components/LocalizedDatetimePicker/index.d.ts.map +1 -1
- package/dist/components/LocalizedDatetimePicker/index.js +1 -1
- package/dist/components/Navigation/NavMenu.d.ts +4 -3
- package/dist/components/Navigation/NavMenu.d.ts.map +1 -1
- package/dist/components/Navigation/NavMenu.js +23 -27
- package/dist/components/Navigation/Navigation.d.ts +1 -2
- package/dist/components/Navigation/Navigation.d.ts.map +1 -1
- package/dist/components/Navigation/Navigation.js +122 -147
- package/dist/components/Navigation/NavigationProps.d.ts +2 -1
- package/dist/components/Navigation/NavigationProps.d.ts.map +1 -1
- package/dist/components/Navigation/index.d.ts +2 -2
- package/dist/components/Navigation/index.d.ts.map +1 -1
- package/dist/components/Navigation/index.js +1 -1
- package/dist/components/NumberRangeInput/NumberRangeInput.d.ts +1 -2
- package/dist/components/NumberRangeInput/NumberRangeInput.d.ts.map +1 -1
- package/dist/components/NumberRangeInput/NumberRangeInput.js +34 -39
- package/dist/components/NumberRangeInput/index.d.ts +2 -2
- package/dist/components/NumberRangeInput/index.d.ts.map +1 -1
- package/dist/components/NumberRangeInput/index.js +1 -1
- package/dist/components/PageWrapper/PageWrapper.d.ts +2 -2
- package/dist/components/PageWrapper/PageWrapper.d.ts.map +1 -1
- package/dist/components/PageWrapper/PageWrapper.js +11 -14
- package/dist/components/PageWrapper/index.d.ts +2 -2
- package/dist/components/PageWrapper/index.d.ts.map +1 -1
- package/dist/components/PageWrapper/index.js +1 -1
- package/dist/components/RichFilterTextField/FilterHistoryMenu.d.ts +1 -2
- package/dist/components/RichFilterTextField/FilterHistoryMenu.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/FilterHistoryMenu.js +17 -31
- package/dist/components/RichFilterTextField/HintOptionsMenu.d.ts +4 -4
- package/dist/components/RichFilterTextField/HintOptionsMenu.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/HintOptionsMenu.js +8 -10
- package/dist/components/RichFilterTextField/RichFilterTextField.d.ts +1 -2
- package/dist/components/RichFilterTextField/RichFilterTextField.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/RichFilterTextField.js +106 -79
- package/dist/components/RichFilterTextField/index.d.ts +2 -2
- package/dist/components/RichFilterTextField/index.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/index.js +1 -1
- package/dist/components/RichFilterTextField/utils.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/utils.js +13 -5
- package/dist/components/SmartTable/RowContent.d.ts +29 -9
- package/dist/components/SmartTable/RowContent.d.ts.map +1 -1
- package/dist/components/SmartTable/RowContent.js +59 -20
- package/dist/components/SmartTable/SmartTable.d.ts +9 -2
- package/dist/components/SmartTable/SmartTable.d.ts.map +1 -1
- package/dist/components/SmartTable/SmartTable.js +97 -109
- package/dist/components/SmartTable/SmartTableProps.d.ts +20 -10
- package/dist/components/SmartTable/SmartTableProps.d.ts.map +1 -1
- package/dist/components/SmartTable/TableHeader.d.ts +1 -2
- package/dist/components/SmartTable/TableHeader.d.ts.map +1 -1
- package/dist/components/SmartTable/TableHeader.js +5 -4
- package/dist/components/SmartTable/index.d.ts +2 -2
- package/dist/components/SmartTable/index.d.ts.map +1 -1
- package/dist/components/SmartTable/index.js +1 -1
- package/dist/components/SortBtn/SortBtn.d.ts +1 -2
- package/dist/components/SortBtn/SortBtn.d.ts.map +1 -1
- package/dist/components/SortBtn/SortBtn.js +3 -2
- package/dist/components/SortBtn/index.d.ts +2 -2
- package/dist/components/SortBtn/index.d.ts.map +1 -1
- package/dist/components/SortBtn/index.js +1 -1
- package/dist/components/SubtaskItem/SubtaskItem.d.ts +1 -2
- package/dist/components/SubtaskItem/SubtaskItem.d.ts.map +1 -1
- package/dist/components/SubtaskItem/SubtaskItem.js +79 -43
- package/dist/components/SubtaskItem/SubtaskItemProps.d.ts +1 -1
- package/dist/components/SubtaskItem/SubtaskItemProps.d.ts.map +1 -1
- package/dist/components/SubtaskItem/index.d.ts +2 -2
- package/dist/components/SubtaskItem/index.d.ts.map +1 -1
- package/dist/components/SubtaskItem/index.js +1 -1
- package/dist/components/TaskLoader/TaskLoader.d.ts +2 -2
- package/dist/components/TaskLoader/TaskLoader.d.ts.map +1 -1
- package/dist/components/TaskLoader/TaskLoader.js +112 -117
- package/dist/components/TaskLoader/TaskLoaderProps.d.ts +1 -0
- package/dist/components/TaskLoader/TaskLoaderProps.d.ts.map +1 -1
- package/dist/components/TaskLoader/index.d.ts +2 -2
- package/dist/components/TaskLoader/index.d.ts.map +1 -1
- package/dist/components/TaskLoader/index.js +1 -1
- package/dist/components/TaskStateDialog/TaskStateDialog.d.ts +1 -2
- package/dist/components/TaskStateDialog/TaskStateDialog.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/TaskStateDialog.js +33 -47
- package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts +2 -1
- package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/index.d.ts +2 -2
- package/dist/components/TaskStateDialog/index.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/index.js +1 -1
- package/dist/components/icons/GenerateAndRunIcon.d.ts +1 -2
- package/dist/components/icons/GenerateAndRunIcon.d.ts.map +1 -1
- package/dist/components/icons/GenerateAndRunIcon.js +6 -23
- package/dist/components/icons/GenerateIcon.d.ts +1 -2
- package/dist/components/icons/GenerateIcon.d.ts.map +1 -1
- package/dist/components/icons/GenerateIcon.js +6 -21
- package/dist/components/icons/IntegerIcon.d.ts +1 -2
- package/dist/components/icons/IntegerIcon.d.ts.map +1 -1
- package/dist/components/icons/IntegerIcon.js +6 -9
- package/dist/components/icons/ProcessingIcon.d.ts +1 -2
- package/dist/components/icons/ProcessingIcon.d.ts.map +1 -1
- package/dist/components/icons/ProcessingIcon.js +2 -12
- package/dist/components/icons/QueueIcon.d.ts +1 -2
- package/dist/components/icons/QueueIcon.d.ts.map +1 -1
- package/dist/components/icons/QueueIcon.js +6 -9
- package/dist/components/icons/RangeIcon.d.ts +1 -2
- package/dist/components/icons/RangeIcon.d.ts.map +1 -1
- package/dist/components/icons/RangeIcon.js +6 -9
- package/dist/components/icons/RunIcon.d.ts +1 -2
- package/dist/components/icons/RunIcon.d.ts.map +1 -1
- package/dist/components/icons/RunIcon.js +6 -12
- package/dist/components/icons/TextModeIcon.d.ts.map +1 -1
- package/dist/components/icons/TextModeIcon.js +2 -6
- package/dist/components/icons/TreeModeIcon.d.ts.map +1 -1
- package/dist/components/icons/TreeModeIcon.js +2 -6
- package/dist/components/icons/index.d.ts +1 -1
- package/dist/components/icons/index.js +1 -1
- package/dist/http.d.ts +2 -2
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +4 -29
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/providers/AirflowProvider.d.ts +5 -4
- package/dist/providers/AirflowProvider.d.ts.map +1 -1
- package/dist/providers/AirflowProvider.js +44 -58
- package/dist/providers/DagStateProvider.d.ts +6 -5
- package/dist/providers/DagStateProvider.d.ts.map +1 -1
- package/dist/providers/DagStateProvider.js +39 -13
- package/dist/providers/SessionProvider.d.ts +3 -1
- package/dist/providers/SessionProvider.d.ts.map +1 -1
- package/dist/providers/SessionProvider.js +14 -7
- package/dist/providers/SnackBarProvider.d.ts +2 -2
- package/dist/providers/SnackBarProvider.d.ts.map +1 -1
- package/dist/providers/SnackBarProvider.js +8 -9
- package/dist/providers/index.d.ts +4 -4
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +4 -4
- package/dist/types.d.ts +17 -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 +30 -21
- 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,5 +1,7 @@
|
|
|
1
1
|
const getSingleMatch = (token, fields) => {
|
|
2
|
-
|
|
2
|
+
if (!token)
|
|
3
|
+
return undefined;
|
|
4
|
+
const matchedFields = fields.filter((v) => v.name.toLowerCase().startsWith(token.toLowerCase()));
|
|
3
5
|
if (matchedFields.length !== 1)
|
|
4
6
|
return undefined;
|
|
5
7
|
return matchedFields[0];
|
|
@@ -44,15 +46,21 @@ export const getHints = (search, cursorPos, fields, operators) => {
|
|
|
44
46
|
if (typeof charAfter === "undefined" || charAfter === " ") {
|
|
45
47
|
const tokensBeforeCursor = search.substring(0, cursorPos).split(" ");
|
|
46
48
|
const token = tokensBeforeCursor[tokensBeforeCursor.length - 1];
|
|
47
|
-
const [tokenField, tokenOperator] = token
|
|
48
|
-
|
|
49
|
+
const [tokenField, tokenOperator] = token
|
|
50
|
+
? token.split(":")
|
|
51
|
+
: [undefined, undefined];
|
|
52
|
+
const matchedField = tokenField
|
|
53
|
+
? getSingleMatch(`${tokenField}:`, fields)
|
|
54
|
+
: undefined;
|
|
49
55
|
const fieldHasValues = Boolean(matchedField?.values);
|
|
50
56
|
const validToken = Boolean(tokenOperator &&
|
|
51
57
|
operators.find((v) => v.name === tokenOperator) != null);
|
|
52
58
|
if (fieldHasValues && validToken) {
|
|
53
59
|
return getMapOf(matchedField?.values || []);
|
|
54
60
|
}
|
|
55
|
-
return
|
|
61
|
+
return token
|
|
62
|
+
? getMapOf(fields.filter((v) => v.name.toLowerCase().startsWith(token.toLowerCase())))
|
|
63
|
+
: new Map();
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
}
|
|
@@ -68,7 +76,7 @@ export const insertInStrPos = (search, cursorPos, hint, fields) => {
|
|
|
68
76
|
const charBefore = search[cursorPos - 1];
|
|
69
77
|
const tokensBeforeCursor = search.substring(0, cursorPos).split(" ");
|
|
70
78
|
const token = tokensBeforeCursor[tokensBeforeCursor.length - 1];
|
|
71
|
-
const [tokenField
|
|
79
|
+
const [tokenField] = token ? token.split(":") : [undefined, undefined];
|
|
72
80
|
const matchedField = getSingleMatch(tokenField, fields);
|
|
73
81
|
switch (charBefore) {
|
|
74
82
|
case " ":
|
|
@@ -1,14 +1,34 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
import { Column } from "../../types";
|
|
3
1
|
import { SxProps, Theme } from "@mui/material";
|
|
4
|
-
|
|
2
|
+
import { ComponentType } from "react";
|
|
3
|
+
import { Column } from "../../types";
|
|
4
|
+
interface RowContentProps<T extends {
|
|
5
|
+
id: string | number;
|
|
6
|
+
} = {
|
|
7
|
+
id: string | number;
|
|
8
|
+
}, P extends {
|
|
9
|
+
row: T;
|
|
10
|
+
} = {
|
|
11
|
+
row: T;
|
|
12
|
+
}, S extends {
|
|
5
13
|
row: T;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
} = {
|
|
15
|
+
row: T;
|
|
16
|
+
}> {
|
|
17
|
+
row: T;
|
|
18
|
+
columns: Column<T, S>[];
|
|
19
|
+
onDoubleClick?(rowId: string | number | null): void;
|
|
20
|
+
onSelectRow(rowId: string | number | null): void;
|
|
21
|
+
ControlComponent?: ComponentType<P>;
|
|
22
|
+
ControlComponentProps?: Omit<P, "row">;
|
|
10
23
|
controlComponentColSx?: SxProps<Theme>;
|
|
11
24
|
}
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
declare function RowContent<T extends {
|
|
26
|
+
id: string | number;
|
|
27
|
+
}, P extends {
|
|
28
|
+
row: T;
|
|
29
|
+
}, S extends {
|
|
30
|
+
row: T;
|
|
31
|
+
}>({ row, columns, onSelectRow, onDoubleClick, ControlComponent, ControlComponentProps, controlComponentColSx, }: RowContentProps<T, P, S>): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
declare const _default: typeof RowContent;
|
|
33
|
+
export default _default;
|
|
14
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,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,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,2CA0F1B;wBAEwC,OAAO,UAAU;AAA1D,wBAA2D"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from "@mui/material";
|
|
2
3
|
import TableCell from "@mui/material/TableCell";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { JSONTree } from "react-json-tree";
|
|
6
|
+
import { prettyDatetime } from "../../utils";
|
|
3
7
|
const hiddenTextStyle = {
|
|
4
8
|
whiteSpace: "nowrap",
|
|
5
9
|
overflow: "hidden",
|
|
@@ -7,23 +11,58 @@ const hiddenTextStyle = {
|
|
|
7
11
|
paddingTop: "0.25rem",
|
|
8
12
|
paddingBottom: "0.25rem",
|
|
9
13
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
function RowContent({ row, columns, onSelectRow, onDoubleClick, ControlComponent, ControlComponentProps, controlComponentColSx, }) {
|
|
15
|
+
const theme = useTheme();
|
|
16
|
+
const treeTheme = {
|
|
17
|
+
scheme: "google",
|
|
18
|
+
author: "seth wright (http://sethawright.com)",
|
|
19
|
+
base00: theme.vars?.palette.background.paper || theme.palette.background.paper, // background
|
|
20
|
+
base01: theme.vars?.palette.background.default ||
|
|
21
|
+
theme.palette.background.default, // lighter background
|
|
22
|
+
base02: "#e0e0e0", // selection (можно взять divider)
|
|
23
|
+
base03: theme.vars?.palette.text.disabled ||
|
|
24
|
+
theme.palette.text.disabled ||
|
|
25
|
+
"#9e9e9e",
|
|
26
|
+
base04: theme.vars?.palette.text.secondary || theme.palette.text.secondary,
|
|
27
|
+
base05: theme.vars?.palette.text.primary || theme.palette.text.primary,
|
|
28
|
+
base06: "#eeeeee",
|
|
29
|
+
base07: "#ffffff",
|
|
30
|
+
base08: theme.vars?.palette.error.main || theme.palette.error.main,
|
|
31
|
+
base09: theme.vars?.palette.warning.main || theme.palette.warning.main,
|
|
32
|
+
base0A: theme.vars?.palette.info.main || theme.palette.info.main,
|
|
33
|
+
base0B: theme.vars?.palette.success.main || theme.palette.success.main,
|
|
34
|
+
base0C: theme.vars?.palette.secondary.main || theme.palette.secondary.main,
|
|
35
|
+
base0D: theme.vars?.palette.primary.main || theme.palette.primary.main,
|
|
36
|
+
base0E: theme.vars?.palette.secondary.main || theme.palette.secondary.main,
|
|
37
|
+
base0F: "#8d6e63", // обычно brown / deprecated
|
|
38
|
+
};
|
|
39
|
+
return (_jsxs(_Fragment, { children: [columns.map((col, idx) => (_jsx(TableCell, { sx: {
|
|
40
|
+
...hiddenTextStyle,
|
|
41
|
+
...col.colSx,
|
|
42
|
+
"& > ul": {
|
|
43
|
+
overflowX: "auto",
|
|
44
|
+
},
|
|
45
|
+
}, onClick: (e) => {
|
|
46
|
+
if (typeof col.onClick !== "undefined") {
|
|
47
|
+
if (e.target === e.currentTarget)
|
|
48
|
+
col.onClick(row);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const selection = window.getSelection();
|
|
52
|
+
if (selection && selection.toString().length > 0)
|
|
53
|
+
return;
|
|
54
|
+
onSelectRow(Object(row).id);
|
|
55
|
+
}
|
|
56
|
+
}, onDoubleClick: typeof onDoubleClick !== "undefined"
|
|
57
|
+
? (_) => onDoubleClick(Object(row).id)
|
|
58
|
+
: undefined, children: col.CellContentComponent ? (_jsx(col.CellContentComponent, { ...{ row, ...col.CellContentComponentProps } })) : typeof Object(row)[col.name] === "object" &&
|
|
59
|
+
Object(row)[col.name] != null ? (_jsx(JSONTree
|
|
60
|
+
/*invertTheme={invertTheme}*/ , {
|
|
61
|
+
/*invertTheme={invertTheme}*/ theme: treeTheme, shouldExpandNodeInitially: () => false, data: Object(row)[col.name] })) : col.type === "datetime" ? (prettyDatetime(Object(row)[col.name])) : (Object(row)[col.name] || "N/A") }, idx))), ControlComponent && (_jsx(TableCell, { sx: {
|
|
62
|
+
textAlign: "center",
|
|
63
|
+
cursor: "default",
|
|
64
|
+
p: 0,
|
|
65
|
+
...controlComponentColSx,
|
|
66
|
+
}, children: _jsx(ControlComponent, { ...{ row, ...ControlComponentProps } }) }))] }));
|
|
29
67
|
}
|
|
68
|
+
export default React.memo(RowContent);
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import SmartTableProps from "./SmartTableProps";
|
|
3
|
-
export default function SmartTable<T
|
|
2
|
+
export default function SmartTable<T extends {
|
|
3
|
+
id: string | number;
|
|
4
|
+
} = {
|
|
5
|
+
id: string | number;
|
|
6
|
+
}, P extends {
|
|
7
|
+
row: T;
|
|
8
|
+
} = {
|
|
9
|
+
row: T;
|
|
10
|
+
}>({ 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>): import("react/jsx-runtime").JSX.Element;
|
|
4
11
|
//# 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":"AAkBA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AA2EhD,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,2CAiUvB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { CircularProgress, Stack, Typography, useTheme } from "@mui/material";
|
|
2
3
|
import FormControl from "@mui/material/FormControl";
|
|
3
4
|
import InputLabel from "@mui/material/InputLabel";
|
|
4
5
|
import MenuItem from "@mui/material/MenuItem";
|
|
@@ -8,59 +9,42 @@ import Select from "@mui/material/Select";
|
|
|
8
9
|
import Table from "@mui/material/Table";
|
|
9
10
|
import TableBody from "@mui/material/TableBody";
|
|
10
11
|
import TableCell from "@mui/material/TableCell";
|
|
12
|
+
import TableContainer from "@mui/material/TableContainer";
|
|
11
13
|
import TableFooter from "@mui/material/TableFooter";
|
|
12
14
|
import TableRow from "@mui/material/TableRow";
|
|
13
|
-
import
|
|
14
|
-
import { useTheme, Stack, CircularProgress, Typography, Skeleton, } from "@mui/material";
|
|
15
|
-
import SortBtn from "../SortBtn/SortBtn";
|
|
16
|
-
import ColumnSearchInput from "../ColumnSearchInput/ColumnSearchInput";
|
|
15
|
+
import React, { Fragment, Suspense, useCallback, useMemo } from "react";
|
|
17
16
|
import { TableVirtuoso } from "react-virtuoso";
|
|
18
|
-
import
|
|
17
|
+
import ColumnSearchInput from "../ColumnSearchInput/ColumnSearchInput";
|
|
18
|
+
import SortBtn from "../SortBtn/SortBtn";
|
|
19
19
|
import RowContent from "./RowContent";
|
|
20
|
-
|
|
21
|
-
const Scroller = React.forwardRef((props, ref) => (
|
|
20
|
+
import TableHeader from "./TableHeader";
|
|
21
|
+
const Scroller = React.forwardRef((props, ref) => (_jsxs(TableContainer, { component: Paper, ...props, ref: ref, sx: {
|
|
22
22
|
minWidth: Object(props).context.minWidth || "100%",
|
|
23
23
|
flexGrow: 1,
|
|
24
24
|
overflowX: "auto",
|
|
25
|
-
} }
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const TableHead =
|
|
29
|
-
// eslint-disable-next-line react/display-name
|
|
30
|
-
React.forwardRef((props, ref) => (React.createElement(TableHeader, { ...props, ref: ref })));
|
|
31
|
-
const TableBodyWrapper =
|
|
32
|
-
// eslint-disable-next-line react/display-name
|
|
33
|
-
React.forwardRef((props, ref) => (React.createElement(TableBody, { ...props, ref: ref })));
|
|
25
|
+
}, children: [Object(props).children, Object(props).context.placeholder] })));
|
|
26
|
+
const TableHead = React.forwardRef((props, ref) => (_jsx(TableHeader, { ...props, ref: ref })));
|
|
27
|
+
const TableBodyWrapper = React.forwardRef((props, ref) => _jsx(TableBody, { ...props, ref: ref }));
|
|
34
28
|
const Row = (props) => {
|
|
35
29
|
const ContentWrapper = Object(props).context.ContentWrapper;
|
|
36
30
|
const selectedRow = Object(props).context.selectedRow;
|
|
37
31
|
const rowStyles = Object(props).context.rowStyles;
|
|
38
32
|
const selectable = Object(props).context.selectable;
|
|
39
|
-
return ContentWrapper ? (
|
|
33
|
+
return ContentWrapper ? (_jsx(ContentWrapper, { rowProps: {
|
|
40
34
|
selected: Object(props).item.id === selectedRow,
|
|
41
35
|
...props,
|
|
42
|
-
}, ...props })) : (
|
|
36
|
+
}, ...props })) : (_jsx(TableRow, { hover: true, sx: {
|
|
43
37
|
height: "3rem",
|
|
44
38
|
overflowY: "hidden",
|
|
45
39
|
...rowStyles,
|
|
46
40
|
cursor: selectable ? "pointer" : "default",
|
|
47
41
|
}, selected: Object(props).item.id === selectedRow, ...props }));
|
|
48
42
|
};
|
|
49
|
-
const TableWrapper = (props) => (
|
|
43
|
+
const TableWrapper = (props) => (_jsx(Table, { ...props, stickyHeader: true, sx: {
|
|
50
44
|
...Object(props).context.tableStyle,
|
|
51
45
|
minWidth: Object(props).context.minWidth || "100%",
|
|
52
46
|
} }));
|
|
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, }) {
|
|
47
|
+
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
48
|
const theme = useTheme();
|
|
65
49
|
const tableStyle = {
|
|
66
50
|
width: columnAutoWidth ? "auto" : "100%",
|
|
@@ -68,24 +52,20 @@ export default function SmartTable({ rows, columns, pageN, numPages, perPage, lo
|
|
|
68
52
|
borderCollapse: "separate",
|
|
69
53
|
borderSpacing: 0,
|
|
70
54
|
};
|
|
71
|
-
|
|
55
|
+
const handleSelectRow = (rowId) => {
|
|
72
56
|
if (selectable && onSelectRow) {
|
|
73
57
|
onSelectRow(rowId);
|
|
74
58
|
}
|
|
75
|
-
}
|
|
59
|
+
};
|
|
76
60
|
const hasSearchableColumns = columns.some((col) => col.searchable);
|
|
77
61
|
const hasGlobalSearch = globalSearch && globalSearchComponent;
|
|
78
|
-
const searchCols = () => columns.map((col, idx) => (
|
|
79
|
-
const headerTitleRow = (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
ControlComponent && (React.createElement(TableCell, { sx: { ...controlComponentColSx }, scope: "col" }))));
|
|
86
|
-
const headerSearchRow = (React.createElement(TableRow, { key: 1 }, globalSearch && globalSearchComponent ? (React.createElement(TableCell, { scope: "col", colSpan: columns.length + 1 }, globalSearchComponent)) : (React.createElement(React.Fragment, null,
|
|
87
|
-
hasSearchableColumns ? searchCols() : React.createElement(React.Fragment, null),
|
|
88
|
-
ControlComponent && (React.createElement(TableCell, { sx: { ...controlComponentColSx }, scope: "col" }))))));
|
|
62
|
+
const searchCols = () => columns.map((col, idx) => (_jsx(TableCell, { scope: "col", sx: { ...col.colSx }, children: col.searchable ? ((col.SearchComponent && (_jsx(col.SearchComponent, { ...col.SearchComponentProps }))) || (_jsx(ColumnSearchInput, { field: col.fieldName, searchStr: col.searchStr, onInputSearch: onInputSearch }))) : (_jsx(_Fragment, {})) }, idx)));
|
|
63
|
+
const headerTitleRow = (_jsxs(TableRow, { children: [columns.map((col, idx) => (_jsx(TableCell, { scope: "col", sx: {
|
|
64
|
+
resize: col.resizable ? "horizontal" : "none",
|
|
65
|
+
overflowX: col.resizable ? "hidden" : "inherit",
|
|
66
|
+
...col.colSx,
|
|
67
|
+
}, children: col.sortable ? (_jsx(SortBtn, { field: col.fieldName, order: col.order || "none", onToggleSort: onToggleSort, children: col.displayName })) : (col.displayName) }, idx))), ControlComponent && (_jsx(TableCell, { sx: { ...controlComponentColSx }, scope: "col" }))] }, 0));
|
|
68
|
+
const headerSearchRow = (_jsx(TableRow, { children: globalSearch && globalSearchComponent ? (_jsx(TableCell, { scope: "col", colSpan: columns.length + 1, children: globalSearchComponent })) : (_jsxs(_Fragment, { children: [hasSearchableColumns ? searchCols() : _jsx(_Fragment, {}), ControlComponent && (_jsx(TableCell, { sx: { ...controlComponentColSx }, scope: "col" }))] })) }, 1));
|
|
89
69
|
const centerStyle = {
|
|
90
70
|
position: "absolute",
|
|
91
71
|
left: "50%",
|
|
@@ -93,39 +73,56 @@ export default function SmartTable({ rows, columns, pageN, numPages, perPage, lo
|
|
|
93
73
|
transform: "translate(-50%, -50%)",
|
|
94
74
|
};
|
|
95
75
|
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
|
-
|
|
76
|
+
const placeholder = useMemo(() => {
|
|
77
|
+
if (error && rows.length === 0) {
|
|
78
|
+
return (_jsx(Typography, { variant: "h6", color: "textSecondary", sx: centerStyle, children: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435" }));
|
|
79
|
+
}
|
|
80
|
+
if (loading) {
|
|
81
|
+
return _jsx(CircularProgress, { sx: centerStyle });
|
|
82
|
+
}
|
|
83
|
+
if (rows.length === 0) {
|
|
84
|
+
return (_jsx(Typography, { variant: "h6", color: "textSecondary", sx: centerStyle, children: "\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E" }));
|
|
85
|
+
}
|
|
86
|
+
return _jsx(_Fragment, {});
|
|
87
|
+
}, [error, loading, rows.length]);
|
|
88
|
+
const fixedHeaderContent = useCallback(() => _jsx(Fragment, { children: hasGlobalSearch ? headerRows[0] : headerRows }), [hasGlobalSearch, headerRows]);
|
|
89
|
+
const tableContext = useMemo(() => ({
|
|
90
|
+
columns,
|
|
91
|
+
minWidth,
|
|
92
|
+
rowStyles,
|
|
93
|
+
selectable,
|
|
94
|
+
tableStyle,
|
|
95
|
+
placeholder,
|
|
96
|
+
selectedRow,
|
|
97
|
+
ContentWrapper,
|
|
98
|
+
ControlComponent,
|
|
99
|
+
ControlComponentProps,
|
|
100
|
+
onRowDoubleClick,
|
|
101
|
+
handleSelectRow,
|
|
102
|
+
}), [
|
|
103
|
+
columns,
|
|
104
|
+
minWidth,
|
|
105
|
+
rowStyles,
|
|
106
|
+
selectable,
|
|
107
|
+
tableStyle,
|
|
108
|
+
placeholder,
|
|
109
|
+
selectedRow,
|
|
110
|
+
ContentWrapper,
|
|
111
|
+
ControlComponent,
|
|
112
|
+
ControlComponentProps,
|
|
113
|
+
onRowDoubleClick,
|
|
114
|
+
handleSelectRow,
|
|
115
|
+
]);
|
|
120
116
|
const VirtuosoTableComponents = {
|
|
121
117
|
Scroller: Scroller,
|
|
122
118
|
Table: TableWrapper,
|
|
123
119
|
TableRow: Row,
|
|
124
120
|
TableHead: TableHead,
|
|
125
121
|
TableBody: TableBodyWrapper,
|
|
126
|
-
ScrollSeekPlaceholder: ScrollSeekPlaceholder,
|
|
122
|
+
// ScrollSeekPlaceholder: ScrollSeekPlaceholder,
|
|
127
123
|
};
|
|
128
|
-
|
|
124
|
+
const itemContent = (_index, row, context) => (_jsx(RowContent, { row: row, columns: context.columns, ControlComponent: context.ControlComponent, ControlComponentProps: context.ControlComponentProps, onDoubleClick: context.onRowDoubleClick, onSelectRow: context.selectable ? context.handleSelectRow : () => { } }, row.id));
|
|
125
|
+
return (_jsxs(Paper, { sx: {
|
|
129
126
|
height: "74vh",
|
|
130
127
|
position: "relative",
|
|
131
128
|
display: "flex",
|
|
@@ -133,43 +130,34 @@ export default function SmartTable({ rows, columns, pageN, numPages, perPage, lo
|
|
|
133
130
|
width: (width && (typeof width === "number" ? `${width}%` : width)) ||
|
|
134
131
|
"100%",
|
|
135
132
|
...sx,
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
onPageSelect(p);
|
|
167
|
-
}, showLastButton: true, showFirstButton: true, color: "primary", sx: { display: { xs: "none", md: "flex" } } }),
|
|
168
|
-
React.createElement(Pagination, { count: numPages, page: pageN, onChange: (_, p) => {
|
|
169
|
-
onPageSelect(p);
|
|
170
|
-
}, siblingCount: 0, boundaryCount: 0, color: "primary", sx: { display: { xs: "flex", md: "none" } } }),
|
|
171
|
-
disablePerPageSelector ? (React.createElement(React.Fragment, null)) : (React.createElement(FormControl, { size: "small" },
|
|
172
|
-
React.createElement(InputLabel, { id: "perPageInputLabel" }, "\u0421\u0442\u0440\u043E\u043A"),
|
|
173
|
-
React.createElement(Select, { label: "\u0421\u0442\u0440\u043E\u043A", labelId: "perPageInputLabel", value: String(perPage), autoWidth: true, onChange: (e) => onChangePerPage &&
|
|
174
|
-
onChangePerPage(Number(e.target.value)), sx: { minWidth: "2rem" } }, (perPageOptions || [5, 10, 15, 20, 25, 50, 100]).map((v, idx) => (React.createElement(MenuItem, { key: idx, value: v }, v)))))))))))));
|
|
133
|
+
}, children: [_jsxs(Stack, { direction: "column", sx: {
|
|
134
|
+
flexGrow: 1,
|
|
135
|
+
overflowX: "auto",
|
|
136
|
+
width: "100%",
|
|
137
|
+
}, children: [hasGlobalSearch && (_jsx(Table, { size: "small", className: "rulesTable", stickyHeader: true, sx: { ...tableStyle, minWidth: minWidth || "100%", height: "auto" }, children: _jsx(TableHeader, { children: headerRows[1] }) })), _jsx(Suspense, { fallback: _jsx(CircularProgress, { sx: { position: "absolute", left: "50%", top: "50%" } }), children: _jsx(TableVirtuoso, { ref: virtuosoRef, style: { height: "100%" }, totalCount: rows.length, data: rows, components: VirtuosoTableComponents, fixedHeaderContent: fixedHeaderContent, itemContent: itemContent, context: tableContext,
|
|
138
|
+
// scrollSeekConfiguration={{
|
|
139
|
+
// // Enter placeholder mode only on truly fast scroll (>150px/frame, ~keyboard=100-120)
|
|
140
|
+
// // This filters out slow mouse drags
|
|
141
|
+
// enter: (velocity) => Math.abs(velocity) > 150,
|
|
142
|
+
// // Exit when user clearly stops (velocity drops below 30)
|
|
143
|
+
// exit: (velocity) => Math.abs(velocity) < 30,
|
|
144
|
+
// }}
|
|
145
|
+
// Render only 150px above/below viewport instead of 800px
|
|
146
|
+
// This dramatically improves keyboard scroll performance
|
|
147
|
+
increaseViewportBy: { top: 200, bottom: 200 } }) })] }), _jsx(Table, { sx: { ...tableStyle, height: "auto", minWidth: minWidth || "100%" }, children: _jsx(TableFooter, { sx: {
|
|
148
|
+
bottom: "0%",
|
|
149
|
+
zIndex: 600,
|
|
150
|
+
position: "sticky",
|
|
151
|
+
backgroundColor: theme.vars?.palette.background.default ||
|
|
152
|
+
theme.palette.background.default,
|
|
153
|
+
}, children: _jsx(TableRow, { children: _jsx(TableCell, { colSpan: 11, children: _jsxs("div", { style: {
|
|
154
|
+
display: "flex",
|
|
155
|
+
justifyContent: "space-between",
|
|
156
|
+
alignItems: "center",
|
|
157
|
+
}, children: [_jsx(Pagination, { count: numPages, page: pageN, onChange: (_, p) => {
|
|
158
|
+
onPageSelect(p);
|
|
159
|
+
}, showLastButton: true, showFirstButton: true, color: "primary", sx: { display: { xs: "none", md: "flex" } } }), _jsx(Pagination, { count: numPages, page: pageN, onChange: (_, p) => {
|
|
160
|
+
onPageSelect(p);
|
|
161
|
+
}, siblingCount: 0, boundaryCount: 0, color: "primary", sx: { display: { xs: "flex", md: "none" } } }), disablePerPageSelector ? (_jsx(_Fragment, {})) : (_jsxs(FormControl, { size: "small", children: [_jsx(InputLabel, { id: "perPageInputLabel", children: "\u0421\u0442\u0440\u043E\u043A" }), _jsx(Select, { label: "\u0421\u0442\u0440\u043E\u043A", labelId: "perPageInputLabel", value: String(perPage), autoWidth: true, onChange: (e) => onChangePerPage &&
|
|
162
|
+
onChangePerPage(Number(e.target.value)), sx: { minWidth: "2rem" }, children: (perPageOptions || [5, 10, 15, 20, 25, 50, 100]).map((v, idx) => (_jsx(MenuItem, { value: v, children: v }, idx))) })] }))] }) }) }) }) })] }));
|
|
175
163
|
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
2
|
-
import { Column } from "../../types";
|
|
3
1
|
import { SxProps, TableRowProps, Theme } from "@mui/material";
|
|
4
|
-
|
|
2
|
+
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { TableVirtuosoHandle } from "react-virtuoso";
|
|
4
|
+
import { Column } from "../../types";
|
|
5
|
+
export default interface SmartTableProps<T extends {
|
|
6
|
+
id: string | number;
|
|
7
|
+
} = {
|
|
8
|
+
id: string | number;
|
|
9
|
+
}, P extends {
|
|
10
|
+
row: T;
|
|
11
|
+
} = {
|
|
12
|
+
row: T;
|
|
13
|
+
}> {
|
|
5
14
|
rows: T[];
|
|
6
15
|
columns: Column<T>[];
|
|
7
16
|
pageN: number;
|
|
@@ -18,13 +27,17 @@ export default interface SmartTableProps<T> {
|
|
|
18
27
|
disablePerPageSelector?: boolean;
|
|
19
28
|
globalSearch?: boolean;
|
|
20
29
|
globalSearchComponent?: ReactElement;
|
|
21
|
-
|
|
30
|
+
error?: boolean;
|
|
31
|
+
perPageOptions?: number[];
|
|
32
|
+
ContentWrapper?: ComponentType<{
|
|
22
33
|
children?: ReactNode;
|
|
23
|
-
dagId: string;
|
|
24
34
|
rowProps: TableRowProps;
|
|
25
|
-
}
|
|
35
|
+
}>;
|
|
36
|
+
ControlComponent?: ComponentType<P>;
|
|
37
|
+
ControlComponentProps?: Omit<P, "row">;
|
|
38
|
+
controlComponentColSx?: SxProps<Theme>;
|
|
39
|
+
virtuosoRef?: React.Ref<TableVirtuosoHandle> | undefined;
|
|
26
40
|
onSelectRow?(rowId: string): void;
|
|
27
|
-
controlComponent?(row: T): ReactNode;
|
|
28
41
|
onRowDoubleClick?(rowId: string | null): void;
|
|
29
42
|
onToggleSort(field: string, order: "asc" | "desc" | "none"): void;
|
|
30
43
|
onInputSearch(options: {
|
|
@@ -33,8 +46,5 @@ export default interface SmartTableProps<T> {
|
|
|
33
46
|
}[]): void;
|
|
34
47
|
onPageSelect(pageN: number): void;
|
|
35
48
|
onChangePerPage?(perPage: number): void;
|
|
36
|
-
controlComponentColSx?: SxProps<Theme>;
|
|
37
|
-
error?: boolean;
|
|
38
|
-
perPageOptions?: number[];
|
|
39
49
|
}
|
|
40
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,
|
|
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,5 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { TableHeadProps } from "@mui/material/TableHead";
|
|
3
|
-
declare const TableHeader: ({ ref, ...props }: TableHeadProps) =>
|
|
2
|
+
declare const TableHeader: ({ ref, ...props }: TableHeadProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
export default TableHeader;
|
|
5
4
|
//# sourceMappingURL=TableHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/TableHeader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/TableHeader.tsx"],"names":[],"mappings":"AACA,OAAkB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEpE,QAAA,MAAM,WAAW,GAAI,mBAAmB,cAAc,4CAiBrD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import TableHead from "@mui/material/TableHead";
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import { useTheme } from "@mui/material";
|
|
3
|
+
import TableHead from "@mui/material/TableHead";
|
|
4
4
|
const TableHeader = ({ ref, ...props }) => {
|
|
5
5
|
const theme = useTheme();
|
|
6
|
-
return (
|
|
6
|
+
return (_jsx(TableHead, { sx: {
|
|
7
7
|
top: "0",
|
|
8
8
|
zIndex: 600,
|
|
9
9
|
position: "sticky",
|
|
10
|
-
backgroundColor: theme.palette.background.default
|
|
10
|
+
backgroundColor: theme.vars?.palette.background.default ||
|
|
11
|
+
theme.palette.background.default,
|
|
11
12
|
}, ...props, ref: ref }));
|
|
12
13
|
};
|
|
13
14
|
export default TableHeader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default } from "./SmartTable";
|
|
2
1
|
export * from "./SmartTable";
|
|
3
|
-
export { default
|
|
2
|
+
export { default } from "./SmartTable";
|
|
4
3
|
export * from "./SmartTableProps";
|
|
4
|
+
export { type default as SmartTableProps } from "./SmartTableProps";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,KAAK,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import SortBtnProps from "./SortBtnProps";
|
|
3
|
-
export default function SortBtn({ children, field, order: _order, onToggleSort, }: SortBtnProps):
|
|
2
|
+
export default function SortBtn({ children, field, order: _order, onToggleSort, }: SortBtnProps): import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
//# sourceMappingURL=SortBtn.d.ts.map
|