@danikokonn/yarik-frontend-lib 2.0.3-3.legacy.test8 → 2.0.4-9.test4

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 (107) hide show
  1. package/dist/components/ActionDialog/ActionDialog.d.ts +19 -0
  2. package/dist/components/ActionDialog/ActionDialog.d.ts.map +1 -1
  3. package/dist/components/ActionDialog/ActionDialog.js +19 -0
  4. package/dist/components/ActionDialog/ActionDialogProps.d.ts +15 -0
  5. package/dist/components/ActionDialog/ActionDialogProps.d.ts.map +1 -1
  6. package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts +12 -0
  7. package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts.map +1 -1
  8. package/dist/components/ColumnSearchInput/ColumnSearchInput.js +12 -0
  9. package/dist/components/ColumnSearchInput/ColumnSearchInputProps.d.ts +9 -0
  10. package/dist/components/ColumnSearchInput/ColumnSearchInputProps.d.ts.map +1 -1
  11. package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -1
  12. package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  13. package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js +3 -3
  14. package/dist/components/DateTimeRangePicker/DateTimeRangePickerProps.d.ts +1 -0
  15. package/dist/components/DateTimeRangePicker/DateTimeRangePickerProps.d.ts.map +1 -1
  16. package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts +21 -2
  17. package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts.map +1 -1
  18. package/dist/components/DatetimeRangeInput/DatetimeRangeInput.js +22 -3
  19. package/dist/components/DatetimeRangeInput/DatetimeRangeInputProps.d.ts +30 -0
  20. package/dist/components/DatetimeRangeInput/DatetimeRangeInputProps.d.ts.map +1 -1
  21. package/dist/components/Footer/Footer.d.ts.map +1 -1
  22. package/dist/components/Footer/Footer.js +2 -2
  23. package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts.map +1 -1
  24. package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.js +1 -1
  25. package/dist/components/Navigation/NavMenu.d.ts +3 -2
  26. package/dist/components/Navigation/NavMenu.d.ts.map +1 -1
  27. package/dist/components/Navigation/NavMenu.js +4 -3
  28. package/dist/components/Navigation/Navigation.d.ts +1 -1
  29. package/dist/components/Navigation/Navigation.d.ts.map +1 -1
  30. package/dist/components/Navigation/Navigation.js +15 -12
  31. package/dist/components/Navigation/NavigationProps.d.ts +2 -1
  32. package/dist/components/Navigation/NavigationProps.d.ts.map +1 -1
  33. package/dist/components/PageWrapper/PageWrapper.d.ts.map +1 -1
  34. package/dist/components/PageWrapper/PageWrapper.js +4 -3
  35. package/dist/components/RichFilterTextField/RichFilterTextField.d.ts +1 -1
  36. package/dist/components/RichFilterTextField/RichFilterTextField.d.ts.map +1 -1
  37. package/dist/components/RichFilterTextField/RichFilterTextField.js +104 -88
  38. package/dist/components/RichFilterTextField/RichFilterTextFieldProps.d.ts +4 -0
  39. package/dist/components/RichFilterTextField/RichFilterTextFieldProps.d.ts.map +1 -1
  40. package/dist/components/RichFilterTextField/utils.d.ts.map +1 -1
  41. package/dist/components/RichFilterTextField/utils.js +2 -2
  42. package/dist/components/SmartTable/RowContent.d.ts +22 -6
  43. package/dist/components/SmartTable/RowContent.d.ts.map +1 -1
  44. package/dist/components/SmartTable/RowContent.js +45 -29
  45. package/dist/components/SmartTable/SmartTable.d.ts +9 -1
  46. package/dist/components/SmartTable/SmartTable.d.ts.map +1 -1
  47. package/dist/components/SmartTable/SmartTable.js +117 -38
  48. package/dist/components/SmartTable/SmartTableProps.d.ts +21 -9
  49. package/dist/components/SmartTable/SmartTableProps.d.ts.map +1 -1
  50. package/dist/components/SmartTable/TableHeader.d.ts.map +1 -1
  51. package/dist/components/SmartTable/TableHeader.js +3 -2
  52. package/dist/components/SortBtn/SortBtn.d.ts.map +1 -1
  53. package/dist/components/SortBtn/SortBtn.js +2 -1
  54. package/dist/components/SubtaskItem/SubtaskItem.d.ts.map +1 -1
  55. package/dist/components/SubtaskItem/SubtaskItem.js +37 -7
  56. package/dist/components/TaskLoader/TaskLoader.d.ts +1 -1
  57. package/dist/components/TaskLoader/TaskLoader.d.ts.map +1 -1
  58. package/dist/components/TaskLoader/TaskLoader.js +24 -13
  59. package/dist/components/TaskLoader/TaskLoaderProps.d.ts +1 -0
  60. package/dist/components/TaskLoader/TaskLoaderProps.d.ts.map +1 -1
  61. package/dist/components/TaskStateDialog/TaskStateDialog.d.ts +1 -1
  62. package/dist/components/TaskStateDialog/TaskStateDialog.d.ts.map +1 -1
  63. package/dist/components/TaskStateDialog/TaskStateDialog.js +8 -5
  64. package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts +2 -1
  65. package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts.map +1 -1
  66. package/dist/components/icons/GenerateAndRunIcon.d.ts +1 -1
  67. package/dist/components/icons/GenerateAndRunIcon.d.ts.map +1 -1
  68. package/dist/components/icons/GenerateAndRunIcon.js +5 -2
  69. package/dist/components/icons/GenerateIcon.d.ts +1 -1
  70. package/dist/components/icons/GenerateIcon.d.ts.map +1 -1
  71. package/dist/components/icons/GenerateIcon.js +5 -2
  72. package/dist/components/icons/IntegerIcon.d.ts +1 -1
  73. package/dist/components/icons/IntegerIcon.d.ts.map +1 -1
  74. package/dist/components/icons/IntegerIcon.js +5 -2
  75. package/dist/components/icons/QueueIcon.d.ts +1 -1
  76. package/dist/components/icons/QueueIcon.d.ts.map +1 -1
  77. package/dist/components/icons/QueueIcon.js +5 -2
  78. package/dist/components/icons/RangeIcon.d.ts +1 -1
  79. package/dist/components/icons/RangeIcon.d.ts.map +1 -1
  80. package/dist/components/icons/RangeIcon.js +5 -2
  81. package/dist/components/icons/RunIcon.d.ts +1 -1
  82. package/dist/components/icons/RunIcon.d.ts.map +1 -1
  83. package/dist/components/icons/RunIcon.js +5 -2
  84. package/dist/http.d.ts +2 -2
  85. package/dist/http.d.ts.map +1 -1
  86. package/dist/http.js +4 -29
  87. package/dist/providers/AirflowProvider.d.ts +5 -4
  88. package/dist/providers/AirflowProvider.d.ts.map +1 -1
  89. package/dist/providers/AirflowProvider.js +41 -55
  90. package/dist/providers/DagStateProvider.d.ts +6 -5
  91. package/dist/providers/DagStateProvider.d.ts.map +1 -1
  92. package/dist/providers/DagStateProvider.js +35 -10
  93. package/dist/providers/SessionProvider.d.ts +3 -1
  94. package/dist/providers/SessionProvider.d.ts.map +1 -1
  95. package/dist/providers/SessionProvider.js +10 -4
  96. package/dist/providers/SnackBarProvider.d.ts +2 -2
  97. package/dist/providers/SnackBarProvider.d.ts.map +1 -1
  98. package/dist/providers/SnackBarProvider.js +1 -1
  99. package/dist/types.d.ts +17 -4
  100. package/dist/types.d.ts.map +1 -1
  101. package/dist/utils.d.ts +3 -3
  102. package/dist/utils.d.ts.map +1 -1
  103. package/dist/utils.js +3 -2
  104. package/package.json +27 -19
  105. package/dist/components/SmartTable/RuleRow.d.ts +0 -22
  106. package/dist/components/SmartTable/RuleRow.d.ts.map +0 -1
  107. package/dist/components/SmartTable/RuleRow.js +0 -40
@@ -1,74 +1,70 @@
1
- import React, { useEffect, useRef, useState, } from "react";
2
- import Stack from "@mui/material/Stack";
1
+ import ClearIcon from "@mui/icons-material/Clear";
2
+ import SearchRoundedIcon from "@mui/icons-material/SearchRounded";
3
3
  import IconButton from "@mui/material/IconButton";
4
4
  import InputAdornment from "@mui/material/InputAdornment";
5
+ import Stack from "@mui/material/Stack";
5
6
  import TextField from "@mui/material/TextField";
6
- import ClearIcon from "@mui/icons-material/Clear";
7
- import FilterListIcon from "@mui/icons-material/FilterList";
8
- import HistoryIcon from "@mui/icons-material/History";
9
- import ContentCopy from "@mui/icons-material/ContentCopy";
10
- import Divider from "@mui/material/Divider";
11
- import ListItemIcon from "@mui/material/ListItemIcon";
12
- import ListItemText from "@mui/material/ListItemText";
13
- import Menu from "@mui/material/Menu";
14
- import MenuItem from "@mui/material/MenuItem";
15
- import Typography from "@mui/material/Typography";
7
+ import React, { useRef, useState } from "react";
8
+ import { useSnackbarContext } from "../../providers";
9
+ import FilterHistoryMenu from "./FilterHistoryMenu";
16
10
  import HintOptionsMenu from "./HintOptionsMenu";
17
11
  import { getHints, insertInStrPos } from "./utils";
18
- import { useSnackbarContext } from "../../providers";
19
- import { useDebounce } from "../../utils";
20
- const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, onChange, }) => {
12
+ const RichFilterTextField = ({ filterExpr, filterExprHist: searchHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }) => {
21
13
  const { enqueueSnackbar } = useSnackbarContext();
22
14
  const [search, setSearch] = useState(filterExpr);
23
- const [searchHist, setSearchHist] = useState(filterExprHist);
24
- const [searchHistMenuAnchor, setSearchHistMenuAnchor] = useState(null);
25
- const [inputAnchor, setInputAnchor] = useState(null);
26
15
  const [cursorPos, setCursorPos] = useState(null);
27
- const [currentHintOptions, setCurrentHintOptions] = useState(() => new Map());
28
16
  const [focusIdx, setFocusIdx] = useState(0);
29
17
  const inputRef = useRef(null);
30
18
  const textFieldRef = useRef(null);
31
- const updateHints = useDebounce(() => {
32
- if (cursorPos == null)
33
- return;
34
- const hints = getHints(search, cursorPos, fields, operators);
35
- setCurrentHintOptions(hints);
19
+ const prevFilterExpr = useRef(filterExpr);
20
+ const instant = _instant ?? true;
21
+ const currentHintOptions = (cursorPos != null
22
+ ? getHints(search, cursorPos, fields, operators)
23
+ : null) ?? new Map();
24
+ const inputAnchor = currentHintOptions?.size > 0 ? textFieldRef.current : null;
25
+ if (prevFilterExpr.current !== filterExpr && filterExpr !== search) {
26
+ setSearch(filterExpr);
27
+ setCursorPos(null);
36
28
  setFocusIdx(0);
37
- setInputAnchor(hints?.size > 0 ? textFieldRef.current : null);
38
- }, 20);
39
- useEffect(() => {
40
- if (cursorPos == null)
41
- return;
42
- if (inputRef.current && cursorPos !== inputRef.current.selectionStart) {
43
- inputRef.current.selectionStart = cursorPos;
44
- inputRef.current.selectionEnd = cursorPos;
45
- }
46
- updateHints();
47
- }, [cursorPos]);
48
- const handleChange = (value) => {
29
+ prevFilterExpr.current = filterExpr;
30
+ }
31
+ if (cursorPos != null &&
32
+ inputRef.current &&
33
+ cursorPos !== inputRef.current.selectionStart) {
34
+ inputRef.current.selectionStart = cursorPos;
35
+ inputRef.current.selectionEnd = cursorPos;
36
+ }
37
+ const handleChange = (value, _idx) => {
49
38
  setSearch(value);
50
- onChange(value, (v) => setSearchHist(v));
39
+ if (cursorPos &&
40
+ getHints(value, cursorPos, fields, operators) !== currentHintOptions)
41
+ setFocusIdx(0);
42
+ onChange(value /*(v: unknown) => setSearchHist(v as string[])*/);
51
43
  };
52
44
  const insertHint = (hint) => {
53
45
  if (cursorPos == null)
54
46
  return;
55
- if (hint.includes("[")) {
56
- hint = "[]";
57
- }
58
- else if (hint.includes("(")) {
59
- hint = "()";
60
- }
61
- else if (hint.includes("regex")) {
62
- hint = hint.replace("regex", "");
47
+ if ((hint.includes("[") && hint.endsWith("]")) ||
48
+ (hint.includes("(") && hint.endsWith(")")) ||
49
+ ((hint.match(/\//g) || []).length === 2 && hint.endsWith("/"))) {
50
+ hint = hint
51
+ .replace(/\[.*?\]/g, "[]")
52
+ .replace(/\(.*?\)/g, "()")
53
+ .replace(/\/.*?\//g, "//");
63
54
  }
64
55
  const { newSearch, newPos } = insertInStrPos(search, cursorPos, hint, fields);
65
- handleChange(newSearch);
56
+ setSearch(newSearch);
57
+ if (instant)
58
+ onChange(newSearch);
59
+ let newCursorPos = newPos;
66
60
  if (hint.includes("[") || hint.includes("(") || hint.includes("/")) {
67
- setCursorPos(newPos - 1);
68
- }
69
- else {
70
- setCursorPos(newPos);
61
+ newCursorPos--;
71
62
  }
63
+ setCursorPos(newCursorPos);
64
+ if (newCursorPos &&
65
+ getHints(newSearch, newCursorPos, fields, operators) !==
66
+ currentHintOptions)
67
+ setFocusIdx(0);
72
68
  };
73
69
  const handleKeyUp = (e) => {
74
70
  switch (e.code) {
@@ -86,16 +82,24 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, on
86
82
  const focusedHint = currentHintOptions.entries().toArray()[focusIdx][0];
87
83
  insertHint(focusedHint);
88
84
  }
85
+ else {
86
+ onChange(search);
87
+ inputRef.current?.blur();
88
+ }
89
89
  break;
90
90
  }
91
91
  case "Escape":
92
92
  case "Tab": {
93
- setInputAnchor(null);
94
93
  setCursorPos(null);
95
94
  break;
96
95
  }
97
96
  default: {
98
- setCursorPos(inputRef.current?.selectionStart ?? null);
97
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
98
+ setCursorPos(newCursorPos);
99
+ if (newCursorPos &&
100
+ getHints(search, newCursorPos, fields, operators) !==
101
+ currentHintOptions)
102
+ setFocusIdx(0);
99
103
  }
100
104
  }
101
105
  };
@@ -105,8 +109,12 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, on
105
109
  case "ArrowRight":
106
110
  case "Space":
107
111
  case "Backspace": {
108
- setInputAnchor(null);
109
- setCursorPos(inputRef.current?.selectionStart ?? null);
112
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
113
+ setCursorPos(newCursorPos);
114
+ if (newCursorPos &&
115
+ getHints(search, newCursorPos, fields, operators) !==
116
+ currentHintOptions)
117
+ setFocusIdx(0);
110
118
  return;
111
119
  }
112
120
  case "ArrowDown": {
@@ -139,57 +147,65 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, on
139
147
  }
140
148
  case "Escape":
141
149
  case "Tab": {
142
- setInputAnchor(null);
143
150
  setCursorPos(null);
151
+ setFocusIdx(0);
144
152
  break;
145
153
  }
146
154
  default: {
147
- setCursorPos(inputRef.current?.selectionStart ?? null);
155
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
156
+ setCursorPos(newCursorPos);
157
+ if (newCursorPos &&
158
+ getHints(search, newCursorPos, fields, operators) !==
159
+ currentHintOptions)
160
+ setFocusIdx(0);
148
161
  }
149
162
  }
150
163
  };
151
164
  return (React.createElement(React.Fragment, null,
152
- React.createElement(TextField, { ref: textFieldRef, inputRef: inputRef, fullWidth: true, size: "small", value: search, title: search, multiline: true, maxRows: 1, onChange: (e) => handleChange(e.target.value), onClick: () => setCursorPos(inputRef.current?.selectionStart ?? null), onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, slotProps: {
165
+ React.createElement(TextField, { ref: textFieldRef, inputRef: inputRef, fullWidth: true, size: "small", value: search, title: search, multiline: true, maxRows: 1, onChange: (e) => {
166
+ (instant ? handleChange : setSearch)(e.target.value);
167
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
168
+ setCursorPos(newCursorPos);
169
+ if (newCursorPos &&
170
+ getHints(e.target.value, newCursorPos, fields, operators) !==
171
+ currentHintOptions)
172
+ setFocusIdx(0);
173
+ }, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, slotProps: {
174
+ htmlInput: {
175
+ onClick: (e) => {
176
+ if (Object(e).target !== Object(e).currentTarget)
177
+ return;
178
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
179
+ setCursorPos(newCursorPos);
180
+ if (newCursorPos &&
181
+ getHints(search, newCursorPos, fields, operators) !==
182
+ currentHintOptions)
183
+ setFocusIdx(0);
184
+ },
185
+ },
153
186
  input: {
187
+ startAdornment: (React.createElement(InputAdornment, { position: "start" },
188
+ React.createElement(Stack, { direction: "row", sx: { alignItems: "center" } },
189
+ !instant && (React.createElement(IconButton, { onClick: (e) => {
190
+ onChange(search);
191
+ e.stopPropagation();
192
+ }, title: "\u041F\u043E\u0438\u0441\u043A" },
193
+ React.createElement(SearchRoundedIcon, null))),
194
+ React.createElement(FilterHistoryMenu, { searchHist: searchHist, onChange: onSelectFromHistory || handleChange, onCopy: () => enqueueSnackbar("Предустановка фильтра скопирована в буфер обмена", "default") }),
195
+ additionalComponents))),
154
196
  endAdornment: (React.createElement(InputAdornment, { position: "end" },
155
197
  React.createElement(IconButton, { title: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u044B", disabled: !search, onClick: (e) => {
156
- setSearch("");
157
- onChange("", (v) => setSearchHist(v));
198
+ handleChange("");
199
+ setCursorPos(null);
200
+ setFocusIdx(0);
158
201
  e.stopPropagation();
159
202
  } },
160
203
  React.createElement(ClearIcon, null)))),
161
- startAdornment: (React.createElement(InputAdornment, { position: "start" },
162
- 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) => {
163
- setSearchHistMenuAnchor(e.currentTarget);
164
- e.stopPropagation();
165
- } },
166
- React.createElement(FilterListIcon, null)))),
167
204
  },
168
205
  } }),
169
206
  React.createElement(HintOptionsMenu, { inputAnchor: inputAnchor, inputRef: inputRef, textFieldRef: textFieldRef, options: currentHintOptions, focusIdx: focusIdx, onSelectHint: insertHint, onClose: () => {
170
- setInputAnchor(null);
171
207
  setCursorPos(null);
172
- } }),
173
- React.createElement(Menu, { anchorEl: searchHistMenuAnchor, open: Boolean(searchHistMenuAnchor), onClose: () => setSearchHistMenuAnchor(null), onClick: () => setSearchHistMenuAnchor(null) },
174
- React.createElement(Stack, { direction: "row", spacing: 1, sx: {
175
- px: 2,
176
- py: 1,
177
- alignItems: "center",
178
- } },
179
- React.createElement(HistoryIcon, null),
180
- 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")),
181
- React.createElement(Divider, null),
182
- searchHist.map((el, idx) => (React.createElement(MenuItem, { key: idx + 1, onClick: () => handleChange(el), title: el },
183
- React.createElement(ListItemText, { sx: { overflow: "hidden" } },
184
- idx + 1,
185
- ". ",
186
- el),
187
- React.createElement(ListItemIcon, null,
188
- React.createElement(IconButton, { onClick: (e) => {
189
- navigator.clipboard.writeText(el);
190
- e.stopPropagation();
191
- enqueueSnackbar("Предустановка фильтра скопирована в буфер обмена", "default");
192
- } },
193
- React.createElement(ContentCopy, { fontSize: "small" })))))))));
208
+ setFocusIdx(0);
209
+ } })));
194
210
  };
195
211
  export default RichFilterTextField;
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  export interface FilterField {
2
3
  /**
3
4
  * Название поля. Используется при подстановке. Должно оканчиваться двоеточием
@@ -62,6 +63,9 @@ export default interface RichFilterTextFieldProps {
62
63
  * Список операторов фильтрации
63
64
  */
64
65
  operators: FilterOperator[];
66
+ instant?: boolean;
67
+ additionalComponents?: React.JSX.Element[];
65
68
  onChange(value: string, onSuccess?: (v: unknown) => void): void;
69
+ onSelectFromHistory?(value: string, idx: number): void;
66
70
  }
67
71
  //# sourceMappingURL=RichFilterTextFieldProps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichFilterTextFieldProps.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/RichFilterTextFieldProps.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC9C;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,wBAAwB;IAC/C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;OAEG;IACH,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB;;OAEG;IACH,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAAC;CACjE"}
1
+ {"version":3,"file":"RichFilterTextFieldProps.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/RichFilterTextFieldProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC9C;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,wBAAwB;IAC/C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;OAEG;IACH,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB;;OAEG;IACH,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAAC;IAChE,mBAAmB,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACxD"}
@@ -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;AAepC,eAAO,MAAM,QAAQ,GACnB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,QAAQ,WAAW,EAAE,EACrB,WAAW,cAAc,EAAE,oCAyE5B,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,MAAM,MAAM,EACZ,QAAQ,WAAW,EAAE;;;CAoFtB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  const getSingleMatch = (token, fields) => {
2
- const matchedFields = fields.filter((v) => v.name.startsWith(token));
2
+ const matchedFields = fields.filter((v) => v.name.toLowerCase().startsWith(token.toLowerCase()));
3
3
  if (matchedFields.length !== 1)
4
4
  return undefined;
5
5
  return matchedFields[0];
@@ -52,7 +52,7 @@ export const getHints = (search, cursorPos, fields, operators) => {
52
52
  if (fieldHasValues && validToken) {
53
53
  return getMapOf(matchedField?.values || []);
54
54
  }
55
- return getMapOf(fields.filter((v) => v.name.startsWith(token)));
55
+ return getMapOf(fields.filter((v) => v.name.toLowerCase().startsWith(token.toLowerCase())));
56
56
  }
57
57
  }
58
58
  }
@@ -1,18 +1,34 @@
1
- import React, { ReactNode } from "react";
2
1
  import { SxProps, Theme } from "@mui/material";
2
+ import React, { ComponentType } from "react";
3
3
  import { Column } from "../../types";
4
4
  interface RowContentProps<T extends {
5
5
  id: string | number;
6
+ } = {
7
+ id: string | number;
8
+ }, P extends {
9
+ row: T;
10
+ } = {
11
+ row: T;
12
+ }, S extends {
13
+ row: T;
14
+ } = {
15
+ row: T;
6
16
  }> {
7
17
  row: T;
8
- columns: Column<T>[];
18
+ columns: Column<T, S>[];
9
19
  onDoubleClick?(rowId: string | number | null): void;
10
20
  onSelectRow(rowId: string | number | null): void;
11
- controlComponent?(row: T): ReactNode;
21
+ ControlComponent?: ComponentType<P>;
22
+ ControlComponentProps?: Omit<P, "row">;
12
23
  controlComponentColSx?: SxProps<Theme>;
13
24
  }
14
- export default function RowContent<T>({ row, columns, onSelectRow, onDoubleClick, controlComponent, controlComponentColSx, }: RowContentProps<T & {
25
+ declare function RowContent<T extends {
15
26
  id: string | number;
16
- }>): React.JSX.Element;
17
- export {};
27
+ }, P extends {
28
+ row: T;
29
+ }, S extends {
30
+ row: T;
31
+ }>({ row, columns, onSelectRow, onDoubleClick, ControlComponent, ControlComponentProps, controlComponentColSx, }: RowContentProps<T, P, S>): React.JSX.Element;
32
+ declare const _default: typeof RowContent;
33
+ export default _default;
18
34
  //# sourceMappingURL=RowContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RowContent.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/RowContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAGzD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,UAAU,eAAe,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CAAE;IAC1D,GAAG,EAAE,CAAC,CAAC;IACP,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,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,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,GAAG,MAAM,CAAC;CAAE,CAAC,qBAiE/C"}
1
+ {"version":3,"file":"RowContent.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/RowContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAEzD,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,UAAU,eAAe,CACvB,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAC3D,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,EACjC,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE;IAEjC,GAAG,EAAE,CAAC,CAAC;IACP,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACpD,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACjD,gBAAgB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACpC,qBAAqB,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACxC;AAUD,iBAAS,UAAU,CACjB,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACjC,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,EACpB,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,EACpB,EACA,GAAG,EACH,OAAO,EACP,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EAErB,qBAAqB,GACtB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,qBAwF1B;wBAIwC,OAAO,UAAU;AAA1D,wBAA2D"}
@@ -1,7 +1,7 @@
1
- import React from "react";
2
1
  import { useTheme } from "@mui/material";
3
2
  import TableCell from "@mui/material/TableCell";
4
- import { JSONTree } from 'react-json-tree';
3
+ import React from "react";
4
+ import { JSONTree } from "react-json-tree";
5
5
  const hiddenTextStyle = {
6
6
  whiteSpace: "nowrap",
7
7
  overflow: "hidden",
@@ -9,47 +9,63 @@ const hiddenTextStyle = {
9
9
  paddingTop: "0.25rem",
10
10
  paddingBottom: "0.25rem",
11
11
  };
12
- export default function RowContent({ row, columns, onSelectRow, onDoubleClick, controlComponent, controlComponentColSx, }) {
12
+ function RowContent({ row, columns, onSelectRow, onDoubleClick, ControlComponent, ControlComponentProps, controlComponentColSx, }) {
13
13
  const theme = useTheme();
14
14
  const treeTheme = {
15
- scheme: 'google',
16
- author: 'seth wright (http://sethawright.com)',
17
- base00: theme.palette.background.paper, // background
18
- base01: theme.palette.background.default, // lighter background
15
+ scheme: "google",
16
+ author: "seth wright (http://sethawright.com)",
17
+ base00: theme.vars?.palette.background.paper || theme.palette.background.paper, // background
18
+ base01: theme.vars?.palette.background.default ||
19
+ theme.palette.background.default, // lighter background
19
20
  base02: "#e0e0e0", // selection (можно взять divider)
20
- base03: theme.palette.text.disabled || "#9e9e9e",
21
- base04: theme.palette.text.secondary,
22
- base05: theme.palette.text.primary,
21
+ base03: theme.vars?.palette.text.disabled ||
22
+ theme.palette.text.disabled ||
23
+ "#9e9e9e",
24
+ base04: theme.vars?.palette.text.secondary || theme.palette.text.secondary,
25
+ base05: theme.vars?.palette.text.primary || theme.palette.text.primary,
23
26
  base06: "#eeeeee",
24
27
  base07: "#ffffff",
25
- base08: theme.palette.error.main,
26
- base09: theme.palette.warning.main,
27
- base0A: theme.palette.info.main,
28
- base0B: theme.palette.success.main,
29
- base0C: theme.palette.secondary.main,
30
- base0D: theme.palette.primary.main,
31
- base0E: theme.palette.secondary.main,
32
- base0F: "#8d6e63" // обычно brown / deprecated
28
+ base08: theme.vars?.palette.error.main || theme.palette.error.main,
29
+ base09: theme.vars?.palette.warning.main || theme.palette.warning.main,
30
+ base0A: theme.vars?.palette.info.main || theme.palette.info.main,
31
+ base0B: theme.vars?.palette.success.main || theme.palette.success.main,
32
+ base0C: theme.vars?.palette.secondary.main || theme.palette.secondary.main,
33
+ base0D: theme.vars?.palette.primary.main || theme.palette.primary.main,
34
+ base0E: theme.vars?.palette.secondary.main || theme.palette.secondary.main,
35
+ base0F: "#8d6e63", // обычно brown / deprecated
33
36
  };
34
37
  return (React.createElement(React.Fragment, null,
35
38
  columns.map((col, idx) => (React.createElement(TableCell, { sx: {
36
39
  ...hiddenTextStyle,
37
40
  ...col.colSx,
38
41
  "& > ul": {
39
- overflowX: "auto"
42
+ overflowX: "auto",
43
+ },
44
+ }, key: idx, onClick: (e) => {
45
+ if (typeof col.onClick !== "undefined") {
46
+ if (e.target === e.currentTarget)
47
+ col.onClick(row);
48
+ }
49
+ else {
50
+ const selection = window.getSelection();
51
+ if (selection && selection.toString().length > 0)
52
+ return;
53
+ onSelectRow(Object(row).id);
40
54
  }
41
- }, key: idx, onClick: (_) => {
42
- const selection = window.getSelection();
43
- if (selection && selection.toString().length > 0)
44
- return;
45
- onSelectRow(row.id);
46
- }, onDoubleClick: (_) => (onDoubleClick || (() => { }))(row.id) }, col.cellContentComponent
47
- ? col.cellContentComponent(row)
48
- : typeof Object(row)[col.name] === "object" && Object(row)[col.name] != null ? (React.createElement(JSONTree /*invertTheme={invertTheme}*/, { theme: treeTheme, shouldExpandNodeInitially: () => false, data: Object(row)[col.name] })) : Object(row)[col.name] || "N/A"))),
49
- controlComponent && (React.createElement(TableCell, { sx: {
55
+ }, onDoubleClick: typeof onDoubleClick !== "undefined"
56
+ ? (_) => onDoubleClick(Object(row).id)
57
+ : undefined }, col.CellContentComponent ? (React.createElement(col.CellContentComponent, { ...{ row, ...col.CellContentComponentProps } })) : typeof Object(row)[col.name] === "object" &&
58
+ Object(row)[col.name] != null ? (React.createElement(JSONTree
59
+ /*invertTheme={invertTheme}*/ , {
60
+ /*invertTheme={invertTheme}*/ theme: treeTheme, shouldExpandNodeInitially: () => false, data: Object(row)[col.name] })) : (Object(row)[col.name] || "N/A")))),
61
+ ControlComponent && (React.createElement(TableCell, { sx: {
50
62
  textAlign: "center",
51
63
  cursor: "default",
52
64
  p: 0,
53
65
  ...controlComponentColSx,
54
- } }, controlComponent(row)))));
66
+ } },
67
+ React.createElement(ControlComponent, { ...{ row, ...ControlComponentProps } })))));
55
68
  }
69
+ // Memoize to prevent re-renders when row/columns/props haven't changed
70
+ // This is critical for scroll performance with heavy cellContentComponent renders
71
+ export default React.memo(RowContent);
@@ -1,4 +1,12 @@
1
1
  import React from "react";
2
2
  import SmartTableProps from "./SmartTableProps";
3
- export default function SmartTable<T>({ rows, columns, pageN, numPages, perPage, loading, minWidth, width, rowStyles, selectable, selectedRow, sx, disablePerPageSelector, globalSearch, columnAutoWidth, globalSearchComponent, ContentWrapper, onRowDoubleClick, onSelectRow, controlComponent: ControlComponent, onToggleSort, onInputSearch, onPageSelect, onChangePerPage, controlComponentColSx, }: SmartTableProps<T>): React.JSX.Element;
3
+ export default function SmartTable<T extends {
4
+ id: string | number;
5
+ } = {
6
+ id: string | number;
7
+ }, P extends {
8
+ row: T;
9
+ } = {
10
+ row: T;
11
+ }>({ rows, columns, pageN, numPages, perPage, loading, minWidth, width, rowStyles, selectable, selectedRow, sx, disablePerPageSelector, globalSearch, columnAutoWidth, error, globalSearchComponent, ContentWrapper, ControlComponent, ControlComponentProps, virtuosoRef, controlComponentColSx, perPageOptions, onToggleSort, onInputSearch, onPageSelect, onChangePerPage, onSelectRow, onRowDoubleClick, }: SmartTableProps<T, P>): React.JSX.Element;
4
12
  //# sourceMappingURL=SmartTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SmartTable.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/SmartTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAC;AAiBxD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAMhD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,EAAE,EACpC,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,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,qBAAqB,GACtB,EAAE,eAAe,CAAC,CAAC,CAAC,qBAgQpB"}
1
+ {"version":3,"file":"SmartTable.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/SmartTable.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAgFhD,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAC3D,CAAC,SAAS;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,CAAC,CAAA;CAAE,EACjC,EACA,IAAI,EACJ,OAAO,EACP,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,UAAU,EACV,WAAW,EACX,EAAE,EACF,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,KAAK,EACL,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,WAAW,EACX,gBAAgB,GACjB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,qBAiUvB"}