@danikokonn/yarik-frontend-lib 2.0.40 → 2.0.55-test
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/SmartTable/RuleRow.d.ts +22 -0
- package/dist/components/SmartTable/RuleRow.d.ts.map +1 -0
- package/dist/components/SmartTable/RuleRow.js +35 -0
- package/dist/components/SmartTable/SmartTable.js +8 -10
- package/dist/components/SmartTable/SmartTableProps.d.ts +2 -2
- package/dist/components/SmartTable/SmartTableProps.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { TableRowProps } from "@mui/material/TableRow";
|
|
3
|
+
import { Column } from "../../types";
|
|
4
|
+
import { SxProps, Theme } from "@mui/material";
|
|
5
|
+
interface RowProps<T> {
|
|
6
|
+
row: T;
|
|
7
|
+
columns: Column<T>[];
|
|
8
|
+
sx?: SxProps<Theme>;
|
|
9
|
+
selectedRow?: string | null;
|
|
10
|
+
ContentWrapper?({ children, dagId, rowProps, }: {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
dagId: string;
|
|
13
|
+
rowProps: TableRowProps;
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
onDoubleClick?(rowId: string | null): void;
|
|
16
|
+
onSelectRow(rowId: string | null): void;
|
|
17
|
+
controlComponent?(row: T): ReactNode;
|
|
18
|
+
controlComponentColSx?: SxProps<Theme>;
|
|
19
|
+
}
|
|
20
|
+
export default function RuleRow<T>({ row, columns, sx, selectedRow, onSelectRow, onDoubleClick, controlComponent, ContentWrapper, controlComponentColSx, }: RowProps<T>): React.JSX.Element;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=RuleRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuleRow.d.ts","sourceRoot":"","sources":["../../../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"@mui/material/TableCell";
|
|
3
|
+
const hiddenTextStyle = {
|
|
4
|
+
whiteSpace: "nowrap",
|
|
5
|
+
overflow: "hidden",
|
|
6
|
+
textOverflow: "ellipsis",
|
|
7
|
+
paddingTop: "0.25rem",
|
|
8
|
+
paddingBottom: "0.25rem",
|
|
9
|
+
};
|
|
10
|
+
function RowContent({ row, columns, onSelectRow, onDoubleClick, }) {
|
|
11
|
+
return (React.createElement(React.Fragment, null, columns.map((col, idx) => (React.createElement(TableCell, { sx: {
|
|
12
|
+
...hiddenTextStyle,
|
|
13
|
+
...col.colSx,
|
|
14
|
+
}, key: idx, onClick: (_) => {
|
|
15
|
+
const selection = window.getSelection();
|
|
16
|
+
if (selection && selection.toString().length > 0)
|
|
17
|
+
return;
|
|
18
|
+
onSelectRow(Object(row).id);
|
|
19
|
+
}, onDoubleClick: (_) => onDoubleClick(Object(row).id) }, col.cellContentComponent
|
|
20
|
+
? col.cellContentComponent(row)
|
|
21
|
+
: Object(row)[col.name] || "N/A")))));
|
|
22
|
+
}
|
|
23
|
+
export default function RuleRow({ row, columns, sx, selectedRow, onSelectRow, onDoubleClick, controlComponent, ContentWrapper, controlComponentColSx, }) {
|
|
24
|
+
const content = (React.createElement(React.Fragment, null,
|
|
25
|
+
React.createElement(RowContent, { onSelectRow: onSelectRow, onDoubleClick: onDoubleClick || (() => { }), row: row, columns: columns }),
|
|
26
|
+
controlComponent && (React.createElement(TableCell, { sx: {
|
|
27
|
+
textAlign: "center",
|
|
28
|
+
cursor: "default",
|
|
29
|
+
p: 0,
|
|
30
|
+
...controlComponentColSx,
|
|
31
|
+
} }, controlComponent(row)))));
|
|
32
|
+
return ContentWrapper ? (React.createElement(ContentWrapper, { dagId: Object(row).id, rowProps: {
|
|
33
|
+
selected: Object(row).id === selectedRow,
|
|
34
|
+
} }, content)) : (content);
|
|
35
|
+
}
|
|
@@ -21,7 +21,7 @@ import RowContent from "./RowContent";
|
|
|
21
21
|
const Scroller = React.forwardRef((props, ref) => (React.createElement(TableContainer, { component: Paper, ...props, ref: ref, sx: {
|
|
22
22
|
minWidth: Object(props).context.minWidth || "100%",
|
|
23
23
|
flexGrow: 1,
|
|
24
|
-
overflowX: "
|
|
24
|
+
overflowX: "auto",
|
|
25
25
|
} },
|
|
26
26
|
Object(props).children,
|
|
27
27
|
Object(props).context.placeholder)));
|
|
@@ -83,7 +83,7 @@ export default function SmartTable({ rows, columns, pageN, numPages, perPage, lo
|
|
|
83
83
|
...col.colSx,
|
|
84
84
|
} }, col.sortable ? (React.createElement(SortBtn, { field: col.fieldName, order: col.order || "none", onToggleSort: onToggleSort }, col.displayName)) : (col.displayName)))),
|
|
85
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
|
|
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
87
|
hasSearchableColumns ? searchCols() : React.createElement(React.Fragment, null),
|
|
88
88
|
ControlComponent && (React.createElement(TableCell, { sx: { ...controlComponentColSx }, scope: "col" }))))));
|
|
89
89
|
const centerStyle = {
|
|
@@ -142,14 +142,12 @@ export default function SmartTable({ rows, columns, pageN, numPages, perPage, lo
|
|
|
142
142
|
hasGlobalSearch && (React.createElement(Table, { size: "small", className: "rulesTable", stickyHeader: true, sx: { ...tableStyle, minWidth: minWidth || "100%", height: "auto" } },
|
|
143
143
|
React.createElement(TableHeader, null, headerRows[1]))),
|
|
144
144
|
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: (ItemContent), context: tableContext,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// }}
|
|
152
|
-
increaseViewportBy: { top: 800, bottom: 800 } }))),
|
|
145
|
+
React.createElement(TableVirtuoso, { style: { height: "100%" }, totalCount: rows.length, data: rows, components: VirtuosoTableComponents, fixedHeaderContent: fixedHeaderContent, itemContent: (ItemContent), context: tableContext, scrollSeekConfiguration: {
|
|
146
|
+
// «входим» в режим плейсхолдеров при скорости >200px/фрейм
|
|
147
|
+
enter: (velocity) => Math.abs(velocity) > 50,
|
|
148
|
+
// «выходим» обратно, когда скорость опустилась ниже 30px/фрейм
|
|
149
|
+
exit: (velocity) => Math.abs(velocity) < 10,
|
|
150
|
+
}, increaseViewportBy: { top: 800, bottom: 800 } }))),
|
|
153
151
|
React.createElement(Table, { sx: { ...tableStyle, height: "auto", minWidth: minWidth || "100%" } },
|
|
154
152
|
React.createElement(TableFooter, { sx: {
|
|
155
153
|
bottom: "0%",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { Column } from "../../types";
|
|
3
3
|
import { SxProps, TableRowProps, Theme } from "@mui/material";
|
|
4
4
|
export default interface SmartTableProps<T> {
|
|
@@ -17,7 +17,7 @@ export default interface SmartTableProps<T> {
|
|
|
17
17
|
sx?: SxProps<Theme>;
|
|
18
18
|
disablePerPageSelector?: boolean;
|
|
19
19
|
globalSearch?: boolean;
|
|
20
|
-
globalSearchComponent
|
|
20
|
+
globalSearchComponent?: ReactElement;
|
|
21
21
|
ContentWrapper?({ children, dagId, rowProps, }: {
|
|
22
22
|
children?: ReactNode;
|
|
23
23
|
dagId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartTableProps.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/SmartTableProps.ts"],"names":[],"mappings":"AAAA,OAAO,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,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,CAAC,OAAO,WAAW,eAAe,CAAC,CAAC;IACxC,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,cAAc,CAAC,CAAC,EACd,QAAQ,EACR,KAAK,EACL,QAAQ,GACT,EAAE;QACD,QAAQ,CAAC,EAAE,SAAS,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,aAAa,CAAC;KACzB,GAAG,KAAK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