@danikokonn/yarik-frontend-lib 2.0.58-test9 → 2.1.0

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.
Files changed (189) hide show
  1. package/README.md +309 -1
  2. package/dist/components/ActionDialog/ActionDialog.d.ts +1 -2
  3. package/dist/components/ActionDialog/ActionDialog.d.ts.map +1 -1
  4. package/dist/components/ActionDialog/ActionDialog.js +8 -19
  5. package/dist/components/ActionDialog/ActionDialogProps.d.ts +1 -3
  6. package/dist/components/ActionDialog/ActionDialogProps.d.ts.map +1 -1
  7. package/dist/components/ActionDialog/index.d.ts +2 -2
  8. package/dist/components/ActionDialog/index.d.ts.map +1 -1
  9. package/dist/components/ActionDialog/index.js +1 -1
  10. package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts +1 -2
  11. package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts.map +1 -1
  12. package/dist/components/ColumnSearchInput/ColumnSearchInput.js +5 -5
  13. package/dist/components/ColumnSearchInput/index.d.ts +2 -2
  14. package/dist/components/ColumnSearchInput/index.d.ts.map +1 -1
  15. package/dist/components/ColumnSearchInput/index.js +1 -1
  16. package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +2 -3
  17. package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  18. package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js +39 -42
  19. package/dist/components/DateTimeRangePicker/index.d.ts +2 -2
  20. package/dist/components/DateTimeRangePicker/index.d.ts.map +1 -1
  21. package/dist/components/DateTimeRangePicker/index.js +1 -1
  22. package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts +1 -0
  23. package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts.map +1 -1
  24. package/dist/components/DatetimeRangeInput/DatetimeRangeInput.js +38 -44
  25. package/dist/components/DatetimeRangeInput/index.d.ts +2 -2
  26. package/dist/components/DatetimeRangeInput/index.d.ts.map +1 -1
  27. package/dist/components/DatetimeRangeInput/index.js +1 -1
  28. package/dist/components/Footer/Footer.d.ts +1 -2
  29. package/dist/components/Footer/Footer.d.ts.map +1 -1
  30. package/dist/components/Footer/Footer.js +5 -13
  31. package/dist/components/Footer/index.d.ts +1 -1
  32. package/dist/components/Footer/index.d.ts.map +1 -1
  33. package/dist/components/Footer/index.js +1 -1
  34. package/dist/components/IpAddressInput/IpAddressInput.d.ts +1 -2
  35. package/dist/components/IpAddressInput/IpAddressInput.d.ts.map +1 -1
  36. package/dist/components/IpAddressInput/IpAddressInput.js +5 -6
  37. package/dist/components/IpAddressInput/index.d.ts +2 -2
  38. package/dist/components/IpAddressInput/index.d.ts.map +1 -1
  39. package/dist/components/IpAddressInput/index.js +1 -1
  40. package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts +1 -2
  41. package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts.map +1 -1
  42. package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.js +3 -2
  43. package/dist/components/IpAddressSwitchableInput/index.d.ts +2 -2
  44. package/dist/components/IpAddressSwitchableInput/index.d.ts.map +1 -1
  45. package/dist/components/IpAddressSwitchableInput/index.js +1 -1
  46. package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.d.ts +1 -2
  47. package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.d.ts.map +1 -1
  48. package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.js +6 -6
  49. package/dist/components/LocalizedDatetimePicker/index.d.ts +2 -2
  50. package/dist/components/LocalizedDatetimePicker/index.d.ts.map +1 -1
  51. package/dist/components/LocalizedDatetimePicker/index.js +1 -1
  52. package/dist/components/Navigation/NavMenu.d.ts +4 -3
  53. package/dist/components/Navigation/NavMenu.d.ts.map +1 -1
  54. package/dist/components/Navigation/NavMenu.js +23 -27
  55. package/dist/components/Navigation/Navigation.d.ts +1 -2
  56. package/dist/components/Navigation/Navigation.d.ts.map +1 -1
  57. package/dist/components/Navigation/Navigation.js +122 -147
  58. package/dist/components/Navigation/NavigationProps.d.ts +2 -1
  59. package/dist/components/Navigation/NavigationProps.d.ts.map +1 -1
  60. package/dist/components/Navigation/index.d.ts +2 -2
  61. package/dist/components/Navigation/index.d.ts.map +1 -1
  62. package/dist/components/Navigation/index.js +1 -1
  63. package/dist/components/NumberRangeInput/NumberRangeInput.d.ts +1 -2
  64. package/dist/components/NumberRangeInput/NumberRangeInput.d.ts.map +1 -1
  65. package/dist/components/NumberRangeInput/NumberRangeInput.js +34 -39
  66. package/dist/components/NumberRangeInput/index.d.ts +2 -2
  67. package/dist/components/NumberRangeInput/index.d.ts.map +1 -1
  68. package/dist/components/NumberRangeInput/index.js +1 -1
  69. package/dist/components/PageWrapper/PageWrapper.d.ts +2 -2
  70. package/dist/components/PageWrapper/PageWrapper.d.ts.map +1 -1
  71. package/dist/components/PageWrapper/PageWrapper.js +11 -14
  72. package/dist/components/PageWrapper/index.d.ts +2 -2
  73. package/dist/components/PageWrapper/index.d.ts.map +1 -1
  74. package/dist/components/PageWrapper/index.js +1 -1
  75. package/dist/components/RichFilterTextField/FilterHistoryMenu.d.ts +1 -2
  76. package/dist/components/RichFilterTextField/FilterHistoryMenu.d.ts.map +1 -1
  77. package/dist/components/RichFilterTextField/FilterHistoryMenu.js +17 -31
  78. package/dist/components/RichFilterTextField/HintOptionsMenu.d.ts +4 -4
  79. package/dist/components/RichFilterTextField/HintOptionsMenu.d.ts.map +1 -1
  80. package/dist/components/RichFilterTextField/HintOptionsMenu.js +8 -10
  81. package/dist/components/RichFilterTextField/RichFilterTextField.d.ts +1 -2
  82. package/dist/components/RichFilterTextField/RichFilterTextField.d.ts.map +1 -1
  83. package/dist/components/RichFilterTextField/RichFilterTextField.js +101 -86
  84. package/dist/components/RichFilterTextField/index.d.ts +2 -2
  85. package/dist/components/RichFilterTextField/index.d.ts.map +1 -1
  86. package/dist/components/RichFilterTextField/index.js +1 -1
  87. package/dist/components/RichFilterTextField/utils.d.ts.map +1 -1
  88. package/dist/components/RichFilterTextField/utils.js +13 -5
  89. package/dist/components/SmartTable/RowContent.d.ts +29 -9
  90. package/dist/components/SmartTable/RowContent.d.ts.map +1 -1
  91. package/dist/components/SmartTable/RowContent.js +59 -20
  92. package/dist/components/SmartTable/SmartTable.d.ts +9 -2
  93. package/dist/components/SmartTable/SmartTable.d.ts.map +1 -1
  94. package/dist/components/SmartTable/SmartTable.js +97 -109
  95. package/dist/components/SmartTable/SmartTableProps.d.ts +20 -10
  96. package/dist/components/SmartTable/SmartTableProps.d.ts.map +1 -1
  97. package/dist/components/SmartTable/TableHeader.d.ts +1 -2
  98. package/dist/components/SmartTable/TableHeader.d.ts.map +1 -1
  99. package/dist/components/SmartTable/TableHeader.js +5 -4
  100. package/dist/components/SmartTable/index.d.ts +2 -2
  101. package/dist/components/SmartTable/index.d.ts.map +1 -1
  102. package/dist/components/SmartTable/index.js +1 -1
  103. package/dist/components/SortBtn/SortBtn.d.ts +1 -2
  104. package/dist/components/SortBtn/SortBtn.d.ts.map +1 -1
  105. package/dist/components/SortBtn/SortBtn.js +3 -2
  106. package/dist/components/SortBtn/index.d.ts +2 -2
  107. package/dist/components/SortBtn/index.d.ts.map +1 -1
  108. package/dist/components/SortBtn/index.js +1 -1
  109. package/dist/components/SubtaskItem/SubtaskItem.d.ts +1 -2
  110. package/dist/components/SubtaskItem/SubtaskItem.d.ts.map +1 -1
  111. package/dist/components/SubtaskItem/SubtaskItem.js +82 -43
  112. package/dist/components/SubtaskItem/SubtaskItemProps.d.ts +1 -1
  113. package/dist/components/SubtaskItem/SubtaskItemProps.d.ts.map +1 -1
  114. package/dist/components/SubtaskItem/index.d.ts +2 -2
  115. package/dist/components/SubtaskItem/index.d.ts.map +1 -1
  116. package/dist/components/SubtaskItem/index.js +1 -1
  117. package/dist/components/TaskLoader/TaskLoader.d.ts +2 -2
  118. package/dist/components/TaskLoader/TaskLoader.d.ts.map +1 -1
  119. package/dist/components/TaskLoader/TaskLoader.js +181 -196
  120. package/dist/components/TaskLoader/TaskLoaderProps.d.ts +1 -0
  121. package/dist/components/TaskLoader/TaskLoaderProps.d.ts.map +1 -1
  122. package/dist/components/TaskLoader/index.d.ts +2 -2
  123. package/dist/components/TaskLoader/index.d.ts.map +1 -1
  124. package/dist/components/TaskLoader/index.js +1 -1
  125. package/dist/components/TaskStateDialog/TaskStateDialog.d.ts +1 -2
  126. package/dist/components/TaskStateDialog/TaskStateDialog.d.ts.map +1 -1
  127. package/dist/components/TaskStateDialog/TaskStateDialog.js +33 -47
  128. package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts +2 -1
  129. package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts.map +1 -1
  130. package/dist/components/TaskStateDialog/index.d.ts +2 -2
  131. package/dist/components/TaskStateDialog/index.d.ts.map +1 -1
  132. package/dist/components/TaskStateDialog/index.js +1 -1
  133. package/dist/components/icons/GenerateAndRunIcon.d.ts +1 -2
  134. package/dist/components/icons/GenerateAndRunIcon.d.ts.map +1 -1
  135. package/dist/components/icons/GenerateAndRunIcon.js +6 -23
  136. package/dist/components/icons/GenerateIcon.d.ts +1 -2
  137. package/dist/components/icons/GenerateIcon.d.ts.map +1 -1
  138. package/dist/components/icons/GenerateIcon.js +6 -21
  139. package/dist/components/icons/IntegerIcon.d.ts +1 -2
  140. package/dist/components/icons/IntegerIcon.d.ts.map +1 -1
  141. package/dist/components/icons/IntegerIcon.js +6 -9
  142. package/dist/components/icons/ProcessingIcon.d.ts +1 -2
  143. package/dist/components/icons/ProcessingIcon.d.ts.map +1 -1
  144. package/dist/components/icons/ProcessingIcon.js +2 -12
  145. package/dist/components/icons/QueueIcon.d.ts +1 -2
  146. package/dist/components/icons/QueueIcon.d.ts.map +1 -1
  147. package/dist/components/icons/QueueIcon.js +6 -9
  148. package/dist/components/icons/RangeIcon.d.ts +1 -2
  149. package/dist/components/icons/RangeIcon.d.ts.map +1 -1
  150. package/dist/components/icons/RangeIcon.js +6 -9
  151. package/dist/components/icons/RunIcon.d.ts +1 -2
  152. package/dist/components/icons/RunIcon.d.ts.map +1 -1
  153. package/dist/components/icons/RunIcon.js +6 -12
  154. package/dist/components/icons/TextModeIcon.d.ts.map +1 -1
  155. package/dist/components/icons/TextModeIcon.js +2 -6
  156. package/dist/components/icons/TreeModeIcon.d.ts.map +1 -1
  157. package/dist/components/icons/TreeModeIcon.js +2 -6
  158. package/dist/components/icons/index.d.ts +1 -1
  159. package/dist/components/icons/index.js +1 -1
  160. package/dist/http.d.ts +2 -2
  161. package/dist/http.d.ts.map +1 -1
  162. package/dist/http.js +4 -29
  163. package/dist/index.d.ts +2 -2
  164. package/dist/index.d.ts.map +1 -1
  165. package/dist/index.js +2 -2
  166. package/dist/providers/AirflowProvider.d.ts +10 -8
  167. package/dist/providers/AirflowProvider.d.ts.map +1 -1
  168. package/dist/providers/AirflowProvider.js +59 -70
  169. package/dist/providers/DagStateProvider.d.ts +8 -6
  170. package/dist/providers/DagStateProvider.d.ts.map +1 -1
  171. package/dist/providers/DagStateProvider.js +105 -98
  172. package/dist/providers/SessionProvider.d.ts +2 -2
  173. package/dist/providers/SessionProvider.d.ts.map +1 -1
  174. package/dist/providers/SessionProvider.js +15 -8
  175. package/dist/providers/SnackBarProvider.d.ts +3 -2
  176. package/dist/providers/SnackBarProvider.d.ts.map +1 -1
  177. package/dist/providers/SnackBarProvider.js +22 -16
  178. package/dist/providers/index.d.ts +4 -4
  179. package/dist/providers/index.d.ts.map +1 -1
  180. package/dist/providers/index.js +4 -4
  181. package/dist/types.d.ts +17 -4
  182. package/dist/types.d.ts.map +1 -1
  183. package/dist/utils.d.ts +3 -3
  184. package/dist/utils.d.ts.map +1 -1
  185. package/dist/utils.js +4 -2
  186. package/package.json +43 -26
  187. package/dist/components/SmartTable/RuleRow.d.ts +0 -22
  188. package/dist/components/SmartTable/RuleRow.d.ts.map +0 -1
  189. package/dist/components/SmartTable/RuleRow.js +0 -35
@@ -1,43 +1,29 @@
1
- import React, { useState } from "react";
2
- import Stack from "@mui/material/Stack";
3
- import IconButton from "@mui/material/IconButton";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import ContentCopy from "@mui/icons-material/ContentCopy";
4
3
  import FilterListIcon from "@mui/icons-material/FilterList";
5
4
  import HistoryIcon from "@mui/icons-material/History";
6
- import ContentCopy from "@mui/icons-material/ContentCopy";
7
5
  import Divider from "@mui/material/Divider";
6
+ import IconButton from "@mui/material/IconButton";
8
7
  import ListItemIcon from "@mui/material/ListItemIcon";
9
8
  import ListItemText from "@mui/material/ListItemText";
10
9
  import Menu from "@mui/material/Menu";
11
10
  import MenuItem from "@mui/material/MenuItem";
11
+ import Stack from "@mui/material/Stack";
12
12
  import Typography from "@mui/material/Typography";
13
+ import { useState } from "react";
13
14
  const FilterHistoryMenu = ({ searchHist, onChange, onCopy, }) => {
14
15
  const [searchHistMenuAnchor, setSearchHistMenuAnchor] = useState(null);
15
- return (React.createElement(React.Fragment, null,
16
- React.createElement(IconButton, { color: "secondary", title: "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0438\u0441\u0442\u043E\u0440\u0438\u044E \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432", disabled: searchHist.length === 0, onClick: (e) => {
17
- setSearchHistMenuAnchor(e.currentTarget);
18
- e.stopPropagation();
19
- } },
20
- React.createElement(FilterListIcon, null)),
21
- React.createElement(Menu, { anchorEl: searchHistMenuAnchor, open: Boolean(searchHistMenuAnchor), onClose: () => setSearchHistMenuAnchor(null), onClick: () => setSearchHistMenuAnchor(null) },
22
- React.createElement(Stack, { direction: "row", spacing: 1, sx: {
23
- px: 2,
24
- py: 1,
25
- alignItems: "center",
26
- } },
27
- React.createElement(HistoryIcon, null),
28
- React.createElement(Typography, { variant: "h5" }, "\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0445 \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432")),
29
- React.createElement(Divider, null),
30
- searchHist.map((el, idx) => (React.createElement(MenuItem, { key: idx + 1, onClick: () => onChange(el, idx), title: el },
31
- React.createElement(ListItemText, { sx: { overflow: "hidden" } },
32
- idx + 1,
33
- ". ",
34
- el),
35
- React.createElement(ListItemIcon, null,
36
- React.createElement(IconButton, { onClick: (e) => {
37
- navigator.clipboard.writeText(el);
38
- e.stopPropagation();
39
- onCopy();
40
- } },
41
- React.createElement(ContentCopy, { fontSize: "small" })))))))));
16
+ return (_jsxs(_Fragment, { children: [_jsx(IconButton, { color: "secondary", title: "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0438\u0441\u0442\u043E\u0440\u0438\u044E \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432", disabled: searchHist.length === 0, onClick: (e) => {
17
+ setSearchHistMenuAnchor(e.currentTarget);
18
+ e.stopPropagation();
19
+ }, children: _jsx(FilterListIcon, {}) }), _jsxs(Menu, { anchorEl: searchHistMenuAnchor, open: Boolean(searchHistMenuAnchor), onClose: () => setSearchHistMenuAnchor(null), onClick: () => setSearchHistMenuAnchor(null), children: [_jsxs(Stack, { direction: "row", spacing: 1, sx: {
20
+ px: 2,
21
+ py: 1,
22
+ alignItems: "center",
23
+ }, children: [_jsx(HistoryIcon, {}), _jsx(Typography, { variant: "h5", children: "\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0445 \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432" })] }), _jsx(Divider, {}), searchHist.map((el, idx) => (_jsxs(MenuItem, { onClick: () => onChange(el, idx), title: el, children: [_jsxs(ListItemText, { sx: { overflow: "hidden" }, children: [idx + 1, ". ", el] }), _jsx(ListItemIcon, { children: _jsx(IconButton, { onClick: (e) => {
24
+ navigator.clipboard.writeText(el);
25
+ e.stopPropagation();
26
+ onCopy();
27
+ }, children: _jsx(ContentCopy, { fontSize: "small" }) }) })] }, idx + 1)))] })] }));
42
28
  };
43
29
  export default FilterHistoryMenu;
@@ -1,12 +1,12 @@
1
- import React, { MutableRefObject } from "react";
1
+ import { RefObject } from "react";
2
2
  declare const HintOptionsMenu: ({ inputAnchor, inputRef, textFieldRef, options, focusIdx, onSelectHint, onClose, }: {
3
3
  inputAnchor: Element;
4
- inputRef: MutableRefObject<HTMLTextAreaElement>;
5
- textFieldRef: MutableRefObject<HTMLDivElement>;
4
+ inputRef: RefObject<HTMLTextAreaElement>;
5
+ textFieldRef: RefObject<HTMLDivElement>;
6
6
  options: Map<string, string | undefined>;
7
7
  focusIdx: number;
8
8
  onSelectHint(hint: string): void;
9
9
  onClose: () => void;
10
- }) => React.JSX.Element;
10
+ }) => import("react/jsx-runtime").JSX.Element;
11
11
  export default HintOptionsMenu;
12
12
  //# sourceMappingURL=HintOptionsMenu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HintOptionsMenu.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/HintOptionsMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,gBAAgB,EAAqB,MAAM,OAAO,CAAC;AAMnE,QAAA,MAAM,eAAe,GAAI,oFAQtB;IACD,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IAChD,YAAY,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC/C,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,sBA6EA,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"HintOptionsMenu.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/HintOptionsMenu.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAErD,QAAA,MAAM,eAAe,GAAI,oFAQtB;IACD,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAC;IACzC,YAAY,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,4CA4EA,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,7 +1,8 @@
1
- import React, { useEffect, useRef } from "react";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import ListItemText from "@mui/material/ListItemText";
2
3
  import Menu from "@mui/material/Menu";
3
4
  import MenuItem from "@mui/material/MenuItem";
4
- import ListItemText from "@mui/material/ListItemText";
5
+ import { useEffect, useRef } from "react";
5
6
  const HintOptionsMenu = ({ inputAnchor, inputRef, textFieldRef, options, focusIdx, onSelectHint, onClose, }) => {
6
7
  const focusRef = useRef(null);
7
8
  useEffect(() => {
@@ -9,15 +10,12 @@ const HintOptionsMenu = ({ inputAnchor, inputRef, textFieldRef, options, focusId
9
10
  return;
10
11
  focusRef.current.scrollIntoView({ behavior: "smooth" });
11
12
  }, [focusRef.current]);
12
- const menuOptions = () => options
13
- ?.entries()
14
- .toArray()
15
- .map((opt, idx) => (React.createElement(MenuItem, { key: idx + 1, onClick: () => onSelectHint(opt[0]), className: focusIdx === idx ? "Mui-focusVisible" : "", ref: focusIdx === idx ? focusRef : null },
16
- React.createElement(ListItemText, { sx: { overflow: "hidden" }, secondary: opt[1], slotProps: {
13
+ const optsArr = Array.from(options?.entries());
14
+ const menuOptions = () => optsArr.map((opt, idx) => (_jsx(MenuItem, { onClick: () => onSelectHint(opt[0]), className: focusIdx === idx ? "Mui-focusVisible" : "", ref: focusIdx === idx ? focusRef : null, children: _jsx(ListItemText, { sx: { overflow: "hidden" }, secondary: opt[1], slotProps: {
17
15
  primary: { variant: "subtitle2" },
18
16
  secondary: { variant: "caption" },
19
- } }, opt[0]))));
20
- return (React.createElement(Menu, { sx: { mt: "5px" }, open: Boolean(inputAnchor), anchorEl: inputAnchor, onClose: (_e, r) => {
17
+ }, children: opt[0] }) }, idx + 1)));
18
+ return (_jsx(Menu, { sx: { mt: "5px" }, open: Boolean(inputAnchor), anchorEl: inputAnchor, onClose: (_e, r) => {
21
19
  if (r === "escapeKeyDown")
22
20
  onClose();
23
21
  }, onClick: onClose, anchorOrigin: {
@@ -45,6 +43,6 @@ const HintOptionsMenu = ({ inputAnchor, inputRef, textFieldRef, options, focusId
45
43
  },
46
44
  },
47
45
  },
48
- }, onFocus: () => inputRef.current.focus(), disableAutoFocus: true, disableEnforceFocus: true, disableRestoreFocus: true }, menuOptions()));
46
+ }, onFocus: () => inputRef.current.focus(), disableAutoFocus: true, disableEnforceFocus: true, disableRestoreFocus: true, children: menuOptions() }));
49
47
  };
50
48
  export default HintOptionsMenu;
@@ -1,5 +1,4 @@
1
- import React from "react";
2
1
  import RichFilterTextFieldProps from "./RichFilterTextFieldProps";
3
- declare const RichFilterTextField: ({ filterExpr, filterExprHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }: RichFilterTextFieldProps) => React.JSX.Element;
2
+ declare const RichFilterTextField: ({ filterExpr, filterExprHist: searchHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }: RichFilterTextFieldProps) => import("react/jsx-runtime").JSX.Element;
4
3
  export default RichFilterTextField;
5
4
  //# sourceMappingURL=RichFilterTextField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichFilterTextField.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/RichFilterTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAUf,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAKlE,QAAA,MAAM,mBAAmB,GAAI,4HAS1B,wBAAwB,sBAyP1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"RichFilterTextField.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/RichFilterTextField.tsx"],"names":[],"mappings":"AAUA,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAGlE,QAAA,MAAM,mBAAmB,GAAI,wIAS1B,wBAAwB,4CAkS1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -1,73 +1,71 @@
1
- import React, { useEffect, useRef, useState, } from "react";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import ClearIcon from "@mui/icons-material/Clear";
3
+ import SearchRoundedIcon from "@mui/icons-material/SearchRounded";
2
4
  import IconButton from "@mui/material/IconButton";
3
5
  import InputAdornment from "@mui/material/InputAdornment";
6
+ import Stack from "@mui/material/Stack";
4
7
  import TextField from "@mui/material/TextField";
5
- import ClearIcon from "@mui/icons-material/Clear";
6
- import SearchRoundedIcon from "@mui/icons-material/SearchRounded";
7
- import HintOptionsMenu from "./HintOptionsMenu";
8
- import { getHints, insertInStrPos } from "./utils";
8
+ import { useRef, useState } from "react";
9
9
  import { useSnackbarContext } from "../../providers";
10
10
  import FilterHistoryMenu from "./FilterHistoryMenu";
11
- import { Stack } from "@mui/material";
12
- const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }) => {
11
+ import HintOptionsMenu from "./HintOptionsMenu";
12
+ import { getHints, insertInStrPos } from "./utils";
13
+ const RichFilterTextField = ({ filterExpr, filterExprHist: searchHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }) => {
13
14
  const { enqueueSnackbar } = useSnackbarContext();
14
15
  const [search, setSearch] = useState(filterExpr);
15
- const instant = _instant ?? true;
16
- const [searchHist, setSearchHist] = useState(filterExprHist);
17
- // const [inputAnchor, setInputAnchor] = useState<HTMLDivElement | null>(null);
18
16
  const [cursorPos, setCursorPos] = useState(null);
19
- // const [currentHintOptions, setCurrentHintOptions] = useState<
20
- // Map<string, string | undefined>
21
- // >(() => new Map());
22
17
  const [focusIdx, setFocusIdx] = useState(0);
23
18
  const inputRef = useRef(null);
24
19
  const textFieldRef = useRef(null);
20
+ const prevFilterExpr = useRef(filterExpr);
21
+ const instant = _instant ?? true;
25
22
  const currentHintOptions = (cursorPos != null
26
23
  ? getHints(search, cursorPos, fields, operators)
27
24
  : null) ?? new Map();
28
25
  const inputAnchor = currentHintOptions?.size > 0 ? textFieldRef.current : null;
29
- useEffect(() => {
30
- if (cursorPos == null)
31
- return;
32
- if (currentHintOptions === getHints(search, cursorPos, fields, operators))
33
- return;
26
+ if (prevFilterExpr.current !== filterExpr && filterExpr !== search) {
27
+ setSearch(filterExpr);
28
+ setCursorPos(null);
34
29
  setFocusIdx(0);
35
- // setInputAnchor(currentHintOptions?.size > 0 ? textFieldRef.current : null);
36
- }, [search, cursorPos]);
37
- useEffect(() => {
38
- if (cursorPos == null)
39
- return;
40
- if (inputRef.current && cursorPos !== inputRef.current.selectionStart) {
41
- inputRef.current.selectionStart = cursorPos;
42
- inputRef.current.selectionEnd = cursorPos;
43
- }
44
- }, [cursorPos]);
45
- // Принудительное изменение состояния, если изменился пропс
46
- // useEffect(() => setSearch(filterExpr), [filterExpr]);
30
+ prevFilterExpr.current = filterExpr;
31
+ }
32
+ if (cursorPos != null &&
33
+ inputRef.current &&
34
+ cursorPos !== inputRef.current.selectionStart) {
35
+ inputRef.current.selectionStart = cursorPos;
36
+ inputRef.current.selectionEnd = cursorPos;
37
+ }
47
38
  const handleChange = (value, _idx) => {
48
39
  setSearch(value);
49
- onChange(value, (v) => setSearchHist(v));
40
+ if (cursorPos &&
41
+ getHints(value, cursorPos, fields, operators) !== currentHintOptions)
42
+ setFocusIdx(0);
43
+ onChange(value);
50
44
  };
51
45
  const insertHint = (hint) => {
52
46
  if (cursorPos == null)
53
47
  return;
54
- if (hint.includes("[")) {
55
- hint = "[]";
56
- }
57
- else if (hint.includes("(")) {
58
- hint = "()";
59
- }
60
- else if (hint.includes("regex")) {
61
- hint = hint.replace("regex", "");
48
+ if ((hint.includes("[") && hint.endsWith("]")) ||
49
+ (hint.includes("(") && hint.endsWith(")")) ||
50
+ ((hint.match(/\//g) || []).length === 2 && hint.endsWith("/"))) {
51
+ hint = hint
52
+ .replace(/\[.*?\]/g, "[]")
53
+ .replace(/\(.*?\)/g, "()")
54
+ .replace(/\/.*?\//g, "//");
62
55
  }
63
56
  const { newSearch, newPos } = insertInStrPos(search, cursorPos, hint, fields);
64
- handleChange(newSearch);
57
+ setSearch(newSearch);
58
+ if (instant)
59
+ onChange(newSearch);
60
+ let newCursorPos = newPos;
65
61
  if (hint.includes("[") || hint.includes("(") || hint.includes("/")) {
66
- setCursorPos(newPos - 1);
67
- }
68
- else {
69
- setCursorPos(newPos);
62
+ newCursorPos--;
70
63
  }
64
+ setCursorPos(newCursorPos);
65
+ if (newCursorPos &&
66
+ getHints(newSearch, newCursorPos, fields, operators) !==
67
+ currentHintOptions)
68
+ setFocusIdx(0);
71
69
  };
72
70
  const handleKeyUp = (e) => {
73
71
  switch (e.code) {
@@ -82,22 +80,28 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
82
80
  case "Enter": {
83
81
  e.preventDefault();
84
82
  if (inputAnchor) {
85
- const focusedHint = currentHintOptions.entries().toArray()[focusIdx][0];
86
- insertHint(focusedHint);
83
+ const focusedHint = Array.from(currentHintOptions.entries())[focusIdx]?.[0];
84
+ if (focusedHint)
85
+ insertHint(focusedHint);
87
86
  }
88
87
  else {
89
- onChange(search, (v) => setSearchHist(v));
88
+ onChange(search);
89
+ inputRef.current?.blur();
90
90
  }
91
91
  break;
92
92
  }
93
93
  case "Escape":
94
94
  case "Tab": {
95
- // setInputAnchor(null);
96
95
  setCursorPos(null);
97
96
  break;
98
97
  }
99
98
  default: {
100
- setCursorPos(inputRef.current?.selectionStart ?? null);
99
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
100
+ setCursorPos(newCursorPos);
101
+ if (newCursorPos &&
102
+ getHints(search, newCursorPos, fields, operators) !==
103
+ currentHintOptions)
104
+ setFocusIdx(0);
101
105
  }
102
106
  }
103
107
  };
@@ -107,7 +111,12 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
107
111
  case "ArrowRight":
108
112
  case "Space":
109
113
  case "Backspace": {
110
- setCursorPos(inputRef.current?.selectionStart ?? null);
114
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
115
+ setCursorPos(newCursorPos);
116
+ if (newCursorPos &&
117
+ getHints(search, newCursorPos, fields, operators) !==
118
+ currentHintOptions)
119
+ setFocusIdx(0);
111
120
  return;
112
121
  }
113
122
  case "ArrowDown": {
@@ -140,50 +149,56 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
140
149
  }
141
150
  case "Escape":
142
151
  case "Tab": {
143
- // setInputAnchor(null);
144
152
  setCursorPos(null);
153
+ setFocusIdx(0);
145
154
  break;
146
155
  }
147
156
  default: {
148
- setCursorPos(inputRef.current?.selectionStart ?? null);
157
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
158
+ setCursorPos(newCursorPos);
159
+ if (newCursorPos &&
160
+ getHints(search, newCursorPos, fields, operators) !==
161
+ currentHintOptions)
162
+ setFocusIdx(0);
149
163
  }
150
164
  }
151
165
  };
152
- return (React.createElement(React.Fragment, null,
153
- React.createElement(TextField, { ref: textFieldRef, inputRef: inputRef, fullWidth: true, size: "small", value: search, title: search, multiline: true, maxRows: 1, onChange: (e) => (instant ? handleChange : setSearch)(e.target.value),
154
- // onClick={(e) => {
155
- // if (e.target !== e.currentTarget) return;
156
- // setCursorPos(inputRef.current?.selectionStart ?? null);
157
- // }}
158
- onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, slotProps: {
159
- htmlInput: {
160
- onClick: (e) => {
161
- if (Object(e).target !== Object(e).currentTarget)
162
- return;
163
- setCursorPos(inputRef.current?.selectionStart ?? null);
166
+ return (_jsxs(_Fragment, { children: [_jsx(TextField, { ref: textFieldRef, inputRef: inputRef, fullWidth: true, size: "small", value: search, title: search, multiline: true, maxRows: 1, onChange: (e) => {
167
+ (instant ? handleChange : setSearch)(e.target.value);
168
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
169
+ setCursorPos(newCursorPos);
170
+ if (newCursorPos &&
171
+ getHints(e.target.value, newCursorPos, fields, operators) !==
172
+ currentHintOptions)
173
+ setFocusIdx(0);
174
+ }, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, slotProps: {
175
+ htmlInput: {
176
+ onClick: (e) => {
177
+ if (Object(e).target !== Object(e).currentTarget)
178
+ return;
179
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
180
+ setCursorPos(newCursorPos);
181
+ if (newCursorPos &&
182
+ getHints(search, newCursorPos, fields, operators) !==
183
+ currentHintOptions)
184
+ setFocusIdx(0);
185
+ },
164
186
  },
165
- },
166
- input: {
167
- startAdornment: (React.createElement(InputAdornment, { position: "start" },
168
- React.createElement(Stack, { direction: "row", sx: { alignItems: "center" } },
169
- !instant && (React.createElement(IconButton, { onClick: (e) => {
170
- onChange(search, (v) => setSearchHist(v));
187
+ input: {
188
+ startAdornment: (_jsx(InputAdornment, { position: "start", children: _jsxs(Stack, { direction: "row", sx: { alignItems: "center" }, children: [!instant && (_jsx(IconButton, { onClick: (e) => {
189
+ onChange(search);
190
+ e.stopPropagation();
191
+ }, title: "\u041F\u043E\u0438\u0441\u043A", children: _jsx(SearchRoundedIcon, {}) })), _jsx(FilterHistoryMenu, { searchHist: searchHist, onChange: onSelectFromHistory || handleChange, onCopy: () => enqueueSnackbar("Предустановка фильтра скопирована в буфер обмена", "default") }), additionalComponents] }) })),
192
+ endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { title: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u044B", disabled: !search, onClick: (e) => {
193
+ handleChange("");
194
+ setCursorPos(null);
195
+ setFocusIdx(0);
171
196
  e.stopPropagation();
172
- }, title: "\u041F\u043E\u0438\u0441\u043A" },
173
- React.createElement(SearchRoundedIcon, null))),
174
- React.createElement(FilterHistoryMenu, { searchHist: searchHist, onChange: onSelectFromHistory || handleChange, onCopy: () => enqueueSnackbar("Предустановка фильтра скопирована в буфер обмена", "default") }),
175
- additionalComponents))),
176
- endAdornment: (React.createElement(InputAdornment, { position: "end" },
177
- React.createElement(IconButton, { title: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u044B", disabled: !search, onClick: (e) => {
178
- handleChange("");
179
- e.stopPropagation();
180
- } },
181
- React.createElement(ClearIcon, null)))),
182
- },
183
- } }),
184
- React.createElement(HintOptionsMenu, { inputAnchor: inputAnchor, inputRef: inputRef, textFieldRef: textFieldRef, options: currentHintOptions, focusIdx: focusIdx, onSelectHint: insertHint, onClose: () => {
185
- // setInputAnchor(null);
186
- setCursorPos(null);
187
- } })));
197
+ }, children: _jsx(ClearIcon, {}) }) })),
198
+ },
199
+ } }), _jsx(HintOptionsMenu, { inputAnchor: inputAnchor, inputRef: inputRef, textFieldRef: textFieldRef, options: currentHintOptions, focusIdx: focusIdx, onSelectHint: insertHint, onClose: () => {
200
+ setCursorPos(null);
201
+ setFocusIdx(0);
202
+ } })] }));
188
203
  };
189
204
  export default RichFilterTextField;
@@ -1,5 +1,5 @@
1
- export { default } from "./RichFilterTextField";
2
1
  export * from "./RichFilterTextField";
3
- export { default as RichFilterTextFieldProps } from "./RichFilterTextFieldProps";
2
+ export { default } from "./RichFilterTextField";
4
3
  export * from "./RichFilterTextFieldProps";
4
+ export { type default as RichFilterTextFieldProps } from "./RichFilterTextFieldProps";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACjF,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,KAAK,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -1,3 +1,3 @@
1
- export { default } from "./RichFilterTextField";
2
1
  export * from "./RichFilterTextField";
2
+ export { default } from "./RichFilterTextField";
3
3
  export * from "./RichFilterTextFieldProps";
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,cAAc,EAEf,MAAM,4BAA4B,CAAC;AAapC,eAAO,MAAM,QAAQ,GACnB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,QAAQ,WAAW,EAAE,EACrB,WAAW,cAAc,EAAE,oCAqE5B,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,MAAM,MAAM,EACZ,QAAQ,WAAW,EAAE;;;CAoFtB,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,cAAc,EAEf,MAAM,4BAA4B,CAAC;AAgBpC,eAAO,MAAM,QAAQ,GACnB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,QAAQ,WAAW,EAAE,EACrB,WAAW,cAAc,EAAE,oCA+E5B,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,MAAM,MAAM,EACZ,QAAQ,WAAW,EAAE;;;CAoFtB,CAAC"}
@@ -1,5 +1,7 @@
1
1
  const getSingleMatch = (token, fields) => {
2
- const matchedFields = fields.filter((v) => v.name.startsWith(token));
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.split(":");
48
- const matchedField = getSingleMatch(`${tokenField}:`, fields);
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 getMapOf(fields.filter((v) => v.name.startsWith(token)));
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, _tokenOperator] = token.split(":");
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
- interface RowContentProps<T> {
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
- columns: Column<T>[];
7
- onDoubleClick?(rowId: string | null): void;
8
- onSelectRow(rowId: string | null): void;
9
- controlComponent?(row: T): ReactNode;
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
- export default function RowContent<T>({ row, columns, onSelectRow, onDoubleClick, controlComponent, controlComponentColSx, }: RowContentProps<T>): React.JSX.Element;
13
- export {};
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,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE/C,UAAU,eAAe,CAAC,CAAC;IACzB,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,CAAC,qBAoCpB"}
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 React from "react";
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
- export default function RowContent({ row, columns, onSelectRow, onDoubleClick, controlComponent, controlComponentColSx, }) {
11
- return (React.createElement(React.Fragment, null,
12
- columns.map((col, idx) => (React.createElement(TableCell, { sx: {
13
- ...hiddenTextStyle,
14
- ...col.colSx,
15
- }, key: idx, onClick: (_) => {
16
- const selection = window.getSelection();
17
- if (selection && selection.toString().length > 0)
18
- return;
19
- onSelectRow(Object(row).id);
20
- }, onDoubleClick: (_) => (onDoubleClick || (() => { }))(Object(row).id) }, col.cellContentComponent
21
- ? col.cellContentComponent(row)
22
- : Object(row)[col.name] || "N/A"))),
23
- controlComponent && (React.createElement(TableCell, { sx: {
24
- textAlign: "center",
25
- cursor: "default",
26
- p: 0,
27
- ...controlComponentColSx,
28
- } }, controlComponent(row)))));
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);