@danikokonn/yarik-frontend-lib 2.0.58-test32 → 2.0.58-test34

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.
@@ -1 +1 @@
1
- {"version":3,"file":"RowContent.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/RowContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,UAAU,eAAe,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;CAAE;IACjD,GAAG,EAAE,CAAC,CAAC;IACP,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAC3C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACxC,gBAAgB,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;IACrC,qBAAqB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACxC;AAUD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,EAAE,EACpC,GAAG,EACH,OAAO,EACP,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,qBAAqB,GACtB,EAAE,eAAe,CAAC,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;CAAE,CAAC,qBAoCtC"}
1
+ {"version":3,"file":"RowContent.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/RowContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,KAAK,EAA2C,MAAM,eAAe,CAAC;AAGxF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,UAAU,eAAe,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;CAAE;IACjD,GAAG,EAAE,CAAC,CAAC;IACP,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAC3C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACxC,gBAAgB,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;IACrC,qBAAqB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACxC;AAUD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,EAAE,EACpC,GAAG,EACH,OAAO,EACP,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,qBAAqB,GACtB,EAAE,eAAe,CAAC,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;CAAE,CAAC,qBA6EtC"}
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { useColorScheme, useMediaQuery, useTheme } from "@mui/material";
2
3
  import TableCell from "@mui/material/TableCell";
3
4
  import { JSONTree } from 'react-json-tree';
4
5
  const hiddenTextStyle = {
@@ -9,6 +10,42 @@ const hiddenTextStyle = {
9
10
  paddingBottom: "0.25rem",
10
11
  };
11
12
  export default function RowContent({ row, columns, onSelectRow, onDoubleClick, controlComponent, controlComponentColSx, }) {
13
+ const theme = useTheme();
14
+ const treeTheme = {
15
+ scheme: 'google',
16
+ author: 'seth wright (http://sethawright.com)',
17
+ base00: theme.palette.background.default, // background
18
+ base01: theme.palette.background.paper, // lighter background
19
+ base02: "#e0e0e0", // selection (можно взять divider)
20
+ base03: theme.palette.text.disabled || "#9e9e9e",
21
+ base04: theme.palette.text.secondary,
22
+ base05: theme.palette.text.primary,
23
+ base06: "#eeeeee",
24
+ 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
33
+ };
34
+ const { mode } = useColorScheme();
35
+ const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
36
+ let invertTheme = false;
37
+ if (mode === "light")
38
+ invertTheme = true;
39
+ else if (mode === "dark")
40
+ invertTheme = false;
41
+ else {
42
+ if (prefersDarkMode) {
43
+ invertTheme = false;
44
+ }
45
+ else {
46
+ invertTheme = true;
47
+ }
48
+ }
12
49
  return (React.createElement(React.Fragment, null,
13
50
  columns.map((col, idx) => (React.createElement(TableCell, { sx: {
14
51
  ...hiddenTextStyle,
@@ -20,7 +57,7 @@ export default function RowContent({ row, columns, onSelectRow, onDoubleClick, c
20
57
  onSelectRow(row.id);
21
58
  }, onDoubleClick: (_) => (onDoubleClick || (() => { }))(row.id) }, col.cellContentComponent
22
59
  ? col.cellContentComponent(row)
23
- : typeof Object(row)[col.name] === "object" && Object(row)[col.name] != null ? (React.createElement(JSONTree, { shouldExpandNodeInitially: () => false, data: Object(row)[col.name] })) : Object(row)[col.name] || "N/A"))),
60
+ : 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"))),
24
61
  controlComponent && (React.createElement(TableCell, { sx: {
25
62
  textAlign: "center",
26
63
  cursor: "default",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danikokonn/yarik-frontend-lib",
3
- "version": "2.0.58-test32",
3
+ "version": "2.0.58-test34",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "author": "",