@perses-dev/components 0.54.0-beta.0 → 0.54.0-beta.1
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/ContentWithLegend/ContentWithLegend.js +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
- package/dist/FormEditor/FormActions.d.ts +1 -1
- package/dist/FormEditor/FormActions.d.ts.map +1 -1
- package/dist/FormEditor/FormActions.js.map +1 -1
- package/dist/FormatControls/FormatControls.d.ts +1 -1
- package/dist/FormatControls/FormatControls.d.ts.map +1 -1
- package/dist/FormatControls/FormatControls.js +1 -1
- package/dist/FormatControls/FormatControls.js.map +1 -1
- package/dist/FormatControls/UnitSelector.d.ts +1 -1
- package/dist/FormatControls/UnitSelector.d.ts.map +1 -1
- package/dist/FormatControls/UnitSelector.js +1 -1
- package/dist/FormatControls/UnitSelector.js.map +1 -1
- package/dist/Legend/Legend.js +1 -1
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/legend-model.d.ts +1 -1
- package/dist/Legend/legend-model.d.ts.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/Table/Table.d.ts +1 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +26 -6
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableToolbar.d.ts +34 -0
- package/dist/Table/TableToolbar.d.ts.map +1 -0
- package/dist/Table/TableToolbar.js +127 -0
- package/dist/Table/TableToolbar.js.map +1 -0
- package/dist/Table/VirtualizedTable.d.ts +3 -1
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +128 -117
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js +5 -1
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.d.ts +12 -0
- package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -0
- package/dist/Table/hooks/useFuzzySearch.js +43 -0
- package/dist/Table/hooks/useFuzzySearch.js.map +1 -0
- package/dist/Table/model/table-model.d.ts +37 -3
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +1 -2
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +2 -2
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +1 -2
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TransformsEditor/TransformEditor.d.ts +1 -1
- package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.d.ts +1 -1
- package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +2 -2
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -2
- package/dist/cjs/FormatControls/FormatControls.js +4 -4
- package/dist/cjs/FormatControls/UnitSelector.js +3 -3
- package/dist/cjs/Legend/Legend.js +2 -2
- package/dist/cjs/Table/Table.js +24 -4
- package/dist/cjs/Table/TableToolbar.js +140 -0
- package/dist/cjs/Table/VirtualizedTable.js +126 -115
- package/dist/cjs/Table/VirtualizedTableContainer.js +5 -1
- package/dist/cjs/Table/hooks/useFuzzySearch.js +48 -0
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +2 -3
- package/dist/cjs/TransformsEditor/TransformEditorContainer.js +2 -2
- package/dist/cjs/model/action.js +43 -0
- package/dist/cjs/model/bits.js +113 -0
- package/dist/cjs/model/bytes.js +115 -0
- package/dist/cjs/model/constants.js +23 -0
- package/dist/cjs/model/currency.js +126 -0
- package/dist/cjs/model/date.js +297 -0
- package/dist/cjs/model/decimal.js +72 -0
- package/dist/cjs/model/formatterCache.js +120 -0
- package/dist/cjs/model/index.js +16 -0
- package/dist/cjs/model/legend.js +101 -0
- package/dist/cjs/model/percent.js +82 -0
- package/dist/cjs/model/temperature.js +72 -0
- package/dist/cjs/model/thresholds.js +16 -0
- package/dist/cjs/model/throughput.js +161 -0
- package/dist/cjs/model/time.js +178 -0
- package/dist/cjs/model/transforms.js +29 -0
- package/dist/cjs/model/types.js +16 -0
- package/dist/cjs/model/units.js +186 -0
- package/dist/cjs/model/utils.js +48 -0
- package/dist/cjs/utils/axis.js +5 -5
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/request-interpolation.js +49 -0
- package/dist/model/action.d.ts +4 -0
- package/dist/model/action.d.ts.map +1 -0
- package/dist/model/action.js +27 -0
- package/dist/model/action.js.map +1 -0
- package/dist/model/bits.d.ts +12 -0
- package/dist/model/bits.d.ts.map +1 -0
- package/dist/model/bits.js +89 -0
- package/dist/model/bits.js.map +1 -0
- package/dist/model/bytes.d.ts +12 -0
- package/dist/model/bytes.d.ts.map +1 -0
- package/dist/model/bytes.js +91 -0
- package/dist/model/bytes.js.map +1 -0
- package/dist/model/constants.d.ts +2 -0
- package/dist/model/constants.d.ts.map +1 -0
- package/dist/model/constants.js +15 -0
- package/dist/model/constants.js.map +1 -0
- package/dist/model/currency.d.ts +11 -0
- package/dist/model/currency.d.ts.map +1 -0
- package/dist/model/currency.js +107 -0
- package/dist/model/currency.js.map +1 -0
- package/dist/model/date.d.ts +28 -0
- package/dist/model/date.d.ts.map +1 -0
- package/dist/model/date.js +278 -0
- package/dist/model/date.js.map +1 -0
- package/dist/model/decimal.d.ts +12 -0
- package/dist/model/decimal.d.ts.map +1 -0
- package/dist/model/decimal.js +53 -0
- package/dist/model/decimal.js.map +1 -0
- package/dist/model/formatterCache.d.ts +11 -0
- package/dist/model/formatterCache.d.ts.map +1 -0
- package/dist/model/formatterCache.js +104 -0
- package/dist/model/formatterCache.js.map +1 -0
- package/dist/model/index.d.ts +16 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +16 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +19 -0
- package/dist/model/legend.d.ts.map +1 -0
- package/dist/model/legend.js +61 -0
- package/dist/model/legend.js.map +1 -0
- package/dist/model/percent.d.ts +11 -0
- package/dist/model/percent.d.ts.map +1 -0
- package/dist/model/percent.js +63 -0
- package/dist/model/percent.js.map +1 -0
- package/dist/model/temperature.d.ts +11 -0
- package/dist/model/temperature.d.ts.map +1 -0
- package/dist/model/temperature.js +53 -0
- package/dist/model/temperature.js.map +1 -0
- package/dist/model/theme.d.ts +1 -1
- package/dist/model/theme.d.ts.map +1 -1
- package/dist/model/theme.js.map +1 -1
- package/dist/model/thresholds.d.ts +16 -0
- package/dist/model/thresholds.d.ts.map +1 -0
- package/dist/model/thresholds.js +15 -0
- package/dist/model/thresholds.js.map +1 -0
- package/dist/model/throughput.d.ts +12 -0
- package/dist/model/throughput.d.ts.map +1 -0
- package/dist/model/throughput.js +142 -0
- package/dist/model/throughput.js.map +1 -0
- package/dist/model/time.d.ts +23 -0
- package/dist/model/time.d.ts.map +1 -0
- package/dist/model/time.js +158 -0
- package/dist/model/time.js.map +1 -0
- package/dist/model/transforms.d.ts +43 -0
- package/dist/model/transforms.d.ts.map +1 -0
- package/dist/model/transforms.js +22 -0
- package/dist/model/transforms.js.map +1 -0
- package/dist/model/types.d.ts +56 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +15 -0
- package/dist/model/types.js.map +1 -0
- package/dist/model/units.d.ts +105 -0
- package/dist/model/units.d.ts.map +1 -0
- package/dist/model/units.js +132 -0
- package/dist/model/units.js.map +1 -0
- package/dist/model/utils.d.ts +4 -0
- package/dist/model/utils.d.ts.map +1 -0
- package/dist/model/utils.js +32 -0
- package/dist/model/utils.js.map +1 -0
- package/dist/utils/axis.d.ts +1 -1
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js +1 -1
- package/dist/utils/axis.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/request-interpolation.d.ts +6 -0
- package/dist/utils/request-interpolation.d.ts.map +1 -0
- package/dist/utils/request-interpolation.js +33 -0
- package/dist/utils/request-interpolation.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "TableToolbar", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return TableToolbar;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _react = require("react");
|
|
26
|
+
const _Magnify = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Magnify"));
|
|
27
|
+
const _Close = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Close"));
|
|
28
|
+
const _ViewColumn = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ViewColumn"));
|
|
29
|
+
const _controls = require("../controls");
|
|
30
|
+
function _interop_require_default(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function TableToolbar({ isSearchEnabled, globalFilter, onGlobalFilterChange, isColumnFilterEnabled, columns, width, columnFilterMenuMaxHeight = 400 }) {
|
|
36
|
+
const [colMenuAnchor, setColMenuAnchor] = (0, _react.useState)(null);
|
|
37
|
+
const colMenuOpen = Boolean(colMenuAnchor);
|
|
38
|
+
const [searchResetKey, setSearchResetKey] = (0, _react.useState)(0);
|
|
39
|
+
const handleSearchClear = (0, _react.useCallback)(()=>{
|
|
40
|
+
onGlobalFilterChange('');
|
|
41
|
+
setSearchResetKey((prev)=>prev + 1);
|
|
42
|
+
}, [
|
|
43
|
+
onGlobalFilterChange
|
|
44
|
+
]);
|
|
45
|
+
if (!isSearchEnabled && !isColumnFilterEnabled) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
49
|
+
direction: "row",
|
|
50
|
+
gap: 1,
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
justifyContent: "flex-end",
|
|
53
|
+
width: width,
|
|
54
|
+
padding: "0.5rem",
|
|
55
|
+
sx: {
|
|
56
|
+
backgroundColor: (theme)=>theme.palette.background.default
|
|
57
|
+
},
|
|
58
|
+
children: [
|
|
59
|
+
isSearchEnabled && /*#__PURE__*/ (0, _jsxruntime.jsx)(_controls.TextField, {
|
|
60
|
+
placeholder: "Search...",
|
|
61
|
+
value: globalFilter,
|
|
62
|
+
onChange: onGlobalFilterChange,
|
|
63
|
+
variant: "standard",
|
|
64
|
+
slotProps: {
|
|
65
|
+
htmlInput: {
|
|
66
|
+
'aria-label': 'search table'
|
|
67
|
+
},
|
|
68
|
+
input: {
|
|
69
|
+
startAdornment: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputAdornment, {
|
|
70
|
+
position: "start",
|
|
71
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Magnify.default, {
|
|
72
|
+
fontSize: "small"
|
|
73
|
+
})
|
|
74
|
+
}),
|
|
75
|
+
endAdornment: globalFilter !== '' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputAdornment, {
|
|
76
|
+
position: "end",
|
|
77
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
78
|
+
onClick: handleSearchClear,
|
|
79
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Close.default, {
|
|
80
|
+
fontSize: "small"
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
sx: {
|
|
87
|
+
flexGrow: 1
|
|
88
|
+
}
|
|
89
|
+
}, searchResetKey),
|
|
90
|
+
isColumnFilterEnabled && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
91
|
+
children: [
|
|
92
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
93
|
+
onClick: (e)=>setColMenuAnchor(e.currentTarget),
|
|
94
|
+
"aria-haspopup": "listbox",
|
|
95
|
+
"aria-expanded": colMenuOpen,
|
|
96
|
+
color: "info",
|
|
97
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ViewColumn.default, {})
|
|
98
|
+
}),
|
|
99
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Menu, {
|
|
100
|
+
anchorEl: colMenuAnchor,
|
|
101
|
+
open: colMenuOpen,
|
|
102
|
+
onClose: ()=>setColMenuAnchor(null),
|
|
103
|
+
slotProps: {
|
|
104
|
+
list: {
|
|
105
|
+
dense: true
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
sx: {
|
|
109
|
+
maxHeight: columnFilterMenuMaxHeight
|
|
110
|
+
},
|
|
111
|
+
children: columns.map((column)=>{
|
|
112
|
+
const header = column.columnDef.header;
|
|
113
|
+
const label = typeof header === 'string' ? header : column.id;
|
|
114
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.MenuItem, {
|
|
115
|
+
disabled: !column.getCanHide(),
|
|
116
|
+
onClick: column.getCanHide() ? column.getToggleVisibilityHandler() : undefined,
|
|
117
|
+
dense: true,
|
|
118
|
+
children: [
|
|
119
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
|
|
120
|
+
checked: column.getIsVisible(),
|
|
121
|
+
disabled: !column.getCanHide(),
|
|
122
|
+
size: "small",
|
|
123
|
+
disableRipple: true,
|
|
124
|
+
sx: {
|
|
125
|
+
p: 0,
|
|
126
|
+
mr: 1
|
|
127
|
+
}
|
|
128
|
+
}),
|
|
129
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ListItemText, {
|
|
130
|
+
primary: label
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}, column.id);
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
@@ -25,6 +25,7 @@ const _reacttable = require("@tanstack/react-table");
|
|
|
25
25
|
const _material = require("@mui/material");
|
|
26
26
|
const _reactvirtuoso = require("react-virtuoso");
|
|
27
27
|
const _react = require("react");
|
|
28
|
+
const _TableToolbar = require("./TableToolbar");
|
|
28
29
|
const _TableRow = require("./TableRow");
|
|
29
30
|
const _TableBody = require("./TableBody");
|
|
30
31
|
const _InnerTable = require("./InnerTable");
|
|
@@ -34,7 +35,7 @@ const _TableCell = require("./TableCell");
|
|
|
34
35
|
const _VirtualizedTableContainer = require("./VirtualizedTableContainer");
|
|
35
36
|
const _useVirtualizedTableKeyboardNav = require("./hooks/useVirtualizedTableKeyboardNav");
|
|
36
37
|
const _TableFoot = require("./TableFoot");
|
|
37
|
-
function VirtualizedTable({ width, height, density, defaultColumnWidth, defaultColumnHeight, onRowClick, onRowMouseOver, onRowMouseOut, rows, columns, headers, cellConfigs, pagination, onPaginationChange, rowCount }) {
|
|
38
|
+
function VirtualizedTable({ width, height, density, defaultColumnWidth, defaultColumnHeight, onRowClick, onRowMouseOver, onRowMouseOut, rows, columns, headers, cellConfigs, pagination, onPaginationChange, rowCount, toolbarConfig }) {
|
|
38
39
|
const virtuosoRef = (0, _react.useRef)(null);
|
|
39
40
|
// Use a ref for these values because they are only needed for keyboard
|
|
40
41
|
// focus interactions and setting them on state will lead to a significant
|
|
@@ -122,129 +123,139 @@ function VirtualizedTable({ width, height, density, defaultColumnWidth, defaultC
|
|
|
122
123
|
pageSize: parseInt(event.target.value, 10)
|
|
123
124
|
});
|
|
124
125
|
};
|
|
125
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
126
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
127
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
128
|
+
style: {
|
|
129
|
+
width,
|
|
130
|
+
height,
|
|
131
|
+
display: 'flex',
|
|
132
|
+
flexDirection: 'column'
|
|
133
|
+
},
|
|
134
|
+
children: [
|
|
135
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_TableToolbar.TableToolbar, {
|
|
136
|
+
...toolbarConfig,
|
|
137
|
+
width: width
|
|
138
|
+
}),
|
|
139
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactvirtuoso.TableVirtuoso, {
|
|
140
|
+
ref: virtuosoRef,
|
|
141
|
+
totalCount: rows.length,
|
|
142
|
+
components: VirtuosoTableComponents,
|
|
143
|
+
// Note: this value is impacted by overscan. See this issue if overscan
|
|
144
|
+
// is added.
|
|
145
|
+
// https://github.com/petyosi/react-virtuoso/issues/118#issuecomment-642156138
|
|
146
|
+
rangeChanged: setVisibleRange,
|
|
147
|
+
fixedHeaderContent: ()=>{
|
|
148
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
149
|
+
children: headers.map((headerGroup)=>{
|
|
150
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableRow.TableRow, {
|
|
151
|
+
density: density,
|
|
152
|
+
children: headerGroup.headers.map((header, i, headers)=>{
|
|
153
|
+
const column = header.column;
|
|
154
|
+
const position = {
|
|
155
|
+
row: 0,
|
|
156
|
+
column: i
|
|
157
|
+
};
|
|
158
|
+
const isSorted = column.getIsSorted();
|
|
159
|
+
const nextSorting = column.getNextSortingOrder();
|
|
160
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableHeaderCell.TableHeaderCell, {
|
|
161
|
+
onSort: column.getCanSort() ? column.getToggleSortingHandler() : undefined,
|
|
162
|
+
sortDirection: typeof isSorted === 'string' ? isSorted : undefined,
|
|
163
|
+
nextSortDirection: typeof nextSorting === 'string' ? nextSorting : undefined,
|
|
164
|
+
width: column.getSize() || defaultColumnWidth,
|
|
165
|
+
defaultColumnHeight: defaultColumnHeight,
|
|
166
|
+
align: column.columnDef.meta?.align,
|
|
167
|
+
variant: "head",
|
|
168
|
+
density: density,
|
|
169
|
+
description: column.columnDef.meta?.headerDescription,
|
|
170
|
+
focusState: getFocusState(position),
|
|
171
|
+
onFocusTrigger: ()=>keyboardNav.onCellFocus(position),
|
|
172
|
+
isFirstColumn: i === 0,
|
|
173
|
+
isLastColumn: i === headers.length - 1,
|
|
174
|
+
children: (0, _reacttable.flexRender)(column.columnDef.header, header.getContext())
|
|
175
|
+
}, header.id);
|
|
176
|
+
})
|
|
177
|
+
}, headerGroup.id);
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
fixedFooterContent: pagination ? ()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableRow, {
|
|
182
|
+
sx: {
|
|
183
|
+
backgroundColor: (theme)=>theme.palette.background.default
|
|
184
|
+
},
|
|
185
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TablePagination, {
|
|
186
|
+
colSpan: columns.length,
|
|
187
|
+
count: rowCount,
|
|
188
|
+
page: pagination.pageIndex,
|
|
189
|
+
rowsPerPage: pagination.pageSize,
|
|
190
|
+
onPageChange: handleChangePage,
|
|
191
|
+
onRowsPerPageChange: handleChangeRowsPerPage
|
|
192
|
+
})
|
|
193
|
+
}) : undefined,
|
|
194
|
+
itemContent: (index)=>{
|
|
195
|
+
const row = rows[index];
|
|
196
|
+
if (!row) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
200
|
+
children: row.getVisibleCells().map((cell, i, cells)=>{
|
|
145
201
|
const position = {
|
|
146
|
-
row:
|
|
202
|
+
row: index + 1,
|
|
147
203
|
column: i
|
|
148
204
|
};
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
205
|
+
const cellContext = cell.getContext();
|
|
206
|
+
const cellConfig = cellConfigs?.[cellContext.cell.id];
|
|
207
|
+
const cellRenderFn = cell.column.columnDef.cell;
|
|
208
|
+
const cellContent = typeof cellRenderFn === 'function' ? cellRenderFn(cellContext) : null;
|
|
209
|
+
/*
|
|
210
|
+
IMPORTANT:
|
|
211
|
+
If Variables exist in the link, they should have been translated by the plugin already. (Being developed at the moment)
|
|
212
|
+
Components have no access to any context (Which is intentional and correct)
|
|
213
|
+
We may want to add parameters to a link from neighboring cells in the future as well.
|
|
214
|
+
If this is the case, the value of the neighboring cells should be read from here and be replaced. (Bing discussed at the moment, not decided yet)
|
|
215
|
+
*/ const cellDescriptionDef = cell.column.columnDef.meta?.cellDescription;
|
|
216
|
+
let description = undefined;
|
|
217
|
+
if (typeof cellDescriptionDef === 'function') {
|
|
218
|
+
// If the cell description is a function, set the value using
|
|
219
|
+
// the function.
|
|
220
|
+
description = cellDescriptionDef(cellContext);
|
|
221
|
+
} else if (cellDescriptionDef && typeof cellContent === 'string') {
|
|
222
|
+
// If the cell description is `true` AND the cell content is
|
|
223
|
+
// a string (and thus viable as a `title` attribute), use the
|
|
224
|
+
// cell content.
|
|
225
|
+
description = cellContent;
|
|
226
|
+
}
|
|
227
|
+
/* this has been specifically added for the data link,
|
|
228
|
+
therefore, non string and numeric values should be excluded
|
|
229
|
+
*/ const adjacentCellsValuesMap = Object.entries(row.original)?.filter(([_, value])=>[
|
|
230
|
+
'string',
|
|
231
|
+
'number'
|
|
232
|
+
].includes(typeof value)).reduce((acc, [key, value])=>({
|
|
233
|
+
...acc,
|
|
234
|
+
[key]: String(value)
|
|
235
|
+
}), {});
|
|
236
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableCell.TableCell, {
|
|
237
|
+
"data-testid": cell.id,
|
|
238
|
+
title: description || cellConfig?.text || cellContent,
|
|
239
|
+
width: cell.column.getSize() || defaultColumnWidth,
|
|
156
240
|
defaultColumnHeight: defaultColumnHeight,
|
|
157
|
-
align: column.columnDef.meta?.align,
|
|
158
|
-
variant: "head",
|
|
241
|
+
align: cell.column.columnDef.meta?.align,
|
|
159
242
|
density: density,
|
|
160
|
-
description: column.columnDef.meta?.headerDescription,
|
|
161
243
|
focusState: getFocusState(position),
|
|
162
244
|
onFocusTrigger: ()=>keyboardNav.onCellFocus(position),
|
|
163
245
|
isFirstColumn: i === 0,
|
|
164
|
-
isLastColumn: i ===
|
|
165
|
-
|
|
166
|
-
|
|
246
|
+
isLastColumn: i === cells.length - 1,
|
|
247
|
+
description: description,
|
|
248
|
+
color: cellConfig?.textColor ?? undefined,
|
|
249
|
+
backgroundColor: cellConfig?.backgroundColor ?? undefined,
|
|
250
|
+
dataLink: cell.column.columnDef.meta?.dataLink,
|
|
251
|
+
adjacentCellsValuesMap: adjacentCellsValuesMap,
|
|
252
|
+
children: cellConfig?.text || cellContent
|
|
253
|
+
}, cell.id);
|
|
167
254
|
})
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
fixedFooterContent: pagination ? ()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableRow, {
|
|
173
|
-
sx: {
|
|
174
|
-
backgroundColor: (theme)=>theme.palette.background.default
|
|
175
|
-
},
|
|
176
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TablePagination, {
|
|
177
|
-
colSpan: columns.length,
|
|
178
|
-
count: rowCount,
|
|
179
|
-
page: pagination.pageIndex,
|
|
180
|
-
rowsPerPage: pagination.pageSize,
|
|
181
|
-
onPageChange: handleChangePage,
|
|
182
|
-
onRowsPerPageChange: handleChangeRowsPerPage
|
|
183
|
-
})
|
|
184
|
-
}) : undefined,
|
|
185
|
-
itemContent: (index)=>{
|
|
186
|
-
const row = rows[index];
|
|
187
|
-
if (!row) {
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
190
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
191
|
-
children: row.getVisibleCells().map((cell, i, cells)=>{
|
|
192
|
-
const position = {
|
|
193
|
-
row: index + 1,
|
|
194
|
-
column: i
|
|
195
|
-
};
|
|
196
|
-
const cellContext = cell.getContext();
|
|
197
|
-
const cellConfig = cellConfigs?.[cellContext.cell.id];
|
|
198
|
-
const cellRenderFn = cell.column.columnDef.cell;
|
|
199
|
-
const cellContent = typeof cellRenderFn === 'function' ? cellRenderFn(cellContext) : null;
|
|
200
|
-
/*
|
|
201
|
-
IMPORTANT:
|
|
202
|
-
If Variables exist in the link, they should have been translated by the plugin already. (Being developed at the moment)
|
|
203
|
-
Components have no access to any context (Which is intentional and correct)
|
|
204
|
-
We may want to add parameters to a link from neighboring cells in the future as well.
|
|
205
|
-
If this is the case, the value of the neighboring cells should be read from here and be replaced. (Bing discussed at the moment, not decided yet)
|
|
206
|
-
*/ const cellDescriptionDef = cell.column.columnDef.meta?.cellDescription;
|
|
207
|
-
let description = undefined;
|
|
208
|
-
if (typeof cellDescriptionDef === 'function') {
|
|
209
|
-
// If the cell description is a function, set the value using
|
|
210
|
-
// the function.
|
|
211
|
-
description = cellDescriptionDef(cellContext);
|
|
212
|
-
} else if (cellDescriptionDef && typeof cellContent === 'string') {
|
|
213
|
-
// If the cell description is `true` AND the cell content is
|
|
214
|
-
// a string (and thus viable as a `title` attribute), use the
|
|
215
|
-
// cell content.
|
|
216
|
-
description = cellContent;
|
|
217
|
-
}
|
|
218
|
-
/* this has been specifically added for the data link,
|
|
219
|
-
therefore, non string and numeric values should be excluded
|
|
220
|
-
*/ const adjacentCellsValuesMap = Object.entries(row.original)?.filter(([_, value])=>[
|
|
221
|
-
'string',
|
|
222
|
-
'number'
|
|
223
|
-
].includes(typeof value)).reduce((acc, [key, value])=>({
|
|
224
|
-
...acc,
|
|
225
|
-
[key]: String(value)
|
|
226
|
-
}), {});
|
|
227
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableCell.TableCell, {
|
|
228
|
-
"data-testid": cell.id,
|
|
229
|
-
title: description || cellConfig?.text || cellContent,
|
|
230
|
-
width: cell.column.getSize() || defaultColumnWidth,
|
|
231
|
-
defaultColumnHeight: defaultColumnHeight,
|
|
232
|
-
align: cell.column.columnDef.meta?.align,
|
|
233
|
-
density: density,
|
|
234
|
-
focusState: getFocusState(position),
|
|
235
|
-
onFocusTrigger: ()=>keyboardNav.onCellFocus(position),
|
|
236
|
-
isFirstColumn: i === 0,
|
|
237
|
-
isLastColumn: i === cells.length - 1,
|
|
238
|
-
description: description,
|
|
239
|
-
color: cellConfig?.textColor ?? undefined,
|
|
240
|
-
backgroundColor: cellConfig?.backgroundColor ?? undefined,
|
|
241
|
-
dataLink: cell.column.columnDef.meta?.dataLink,
|
|
242
|
-
adjacentCellsValuesMap: adjacentCellsValuesMap,
|
|
243
|
-
children: cellConfig?.text || cellContent
|
|
244
|
-
}, cell.id);
|
|
245
|
-
})
|
|
246
|
-
});
|
|
247
|
-
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
]
|
|
248
259
|
})
|
|
249
260
|
});
|
|
250
261
|
}
|
|
@@ -23,10 +23,14 @@ Object.defineProperty(exports, "VirtualizedTableContainer", {
|
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
25
|
const _react = require("react");
|
|
26
|
+
const _combinesx = require("../utils/combine-sx");
|
|
26
27
|
const VirtualizedTableContainer = /*#__PURE__*/ (0, _react.forwardRef)(function VirtualizedTableContainer(props, ref) {
|
|
27
28
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableContainer, {
|
|
28
29
|
...props,
|
|
29
30
|
tabIndex: -1,
|
|
30
|
-
ref: ref
|
|
31
|
+
ref: ref,
|
|
32
|
+
sx: (0, _combinesx.combineSx)({
|
|
33
|
+
flexGrow: 1
|
|
34
|
+
}, props.sx)
|
|
31
35
|
});
|
|
32
36
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "useFuzzySearch", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return useFuzzySearch;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _reacttable = require("@tanstack/react-table");
|
|
24
|
+
const _matchsorterutils = require("@tanstack/match-sorter-utils");
|
|
25
|
+
const _react = require("react");
|
|
26
|
+
const fuzzyFilter = (row, columnId, value, addMeta)=>{
|
|
27
|
+
const itemRank = (0, _matchsorterutils.rankItem)(row.getValue(columnId), value);
|
|
28
|
+
addMeta({
|
|
29
|
+
itemRank
|
|
30
|
+
});
|
|
31
|
+
return itemRank.passed;
|
|
32
|
+
};
|
|
33
|
+
function useFuzzySearch(isSearchEnabled) {
|
|
34
|
+
const [globalFilter, setGlobalFilter] = (0, _react.useState)('');
|
|
35
|
+
return {
|
|
36
|
+
globalFilter,
|
|
37
|
+
setGlobalFilter,
|
|
38
|
+
fuzzySearchOptions: {
|
|
39
|
+
filterFns: {
|
|
40
|
+
fuzzy: fuzzyFilter
|
|
41
|
+
},
|
|
42
|
+
globalFilterFn: isSearchEnabled ? 'fuzzy' : undefined,
|
|
43
|
+
getFilteredRowModel: isSearchEnabled ? (0, _reacttable.getFilteredRowModel)() : undefined,
|
|
44
|
+
filterFromLeafRows: isSearchEnabled,
|
|
45
|
+
onGlobalFilterChange: setGlobalFilter
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -46,7 +46,6 @@ _export(exports, {
|
|
|
46
46
|
return legacyCheckforNearbySeries;
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
const _core = require("@perses-dev/core");
|
|
50
49
|
const _model = require("../model");
|
|
51
50
|
const _utils = require("../utils");
|
|
52
51
|
const _tooltipmodel = require("./tooltip-model");
|
|
@@ -197,7 +196,7 @@ cursorPixelY) {
|
|
|
197
196
|
seriesIndex: seriesIdx
|
|
198
197
|
});
|
|
199
198
|
}
|
|
200
|
-
const formattedY = (0,
|
|
199
|
+
const formattedY = (0, _model.formatValue)(yValue, seriesFormat);
|
|
201
200
|
currentNearbySeriesData.push({
|
|
202
201
|
seriesIdx: seriesIdx,
|
|
203
202
|
datumIdx: datumIdx,
|
|
@@ -266,7 +265,7 @@ function legacyCheckforNearbySeries(data, pointInGrid, yBuffer, chart, format) {
|
|
|
266
265
|
}
|
|
267
266
|
// determine whether to convert timestamp to ms, see: https://stackoverflow.com/a/23982005/17575201
|
|
268
267
|
const xValueMilliSeconds = xValue > 99999999999 ? xValue : xValue * 1000;
|
|
269
|
-
const formattedY = (0,
|
|
268
|
+
const formattedY = (0, _model.formatValue)(yValue, format);
|
|
270
269
|
currentNearbySeriesData.push({
|
|
271
270
|
seriesIdx: seriesIdx,
|
|
272
271
|
datumIdx: datumIdx,
|
|
@@ -27,7 +27,7 @@ const _ChevronDown = /*#__PURE__*/ _interop_require_default(require("mdi-materia
|
|
|
27
27
|
const _EyeOffOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/EyeOffOutline"));
|
|
28
28
|
const _EyeOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/EyeOutline"));
|
|
29
29
|
const _DeleteOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DeleteOutline"));
|
|
30
|
-
const
|
|
30
|
+
const _model = require("../model");
|
|
31
31
|
const _TransformEditor = require("./TransformEditor");
|
|
32
32
|
function _interop_require_default(obj) {
|
|
33
33
|
return obj && obj.__esModule ? obj : {
|
|
@@ -73,7 +73,7 @@ function TransformEditorContainer({ index, value, isCollapsed, onChange, onColla
|
|
|
73
73
|
},
|
|
74
74
|
children: value.kind ? /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
|
|
75
75
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("strong", {
|
|
76
|
-
children:
|
|
76
|
+
children: _model.TRANSFORM_TEXT[value.kind]
|
|
77
77
|
})
|
|
78
78
|
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)("strong", {
|
|
79
79
|
children: "Select a transformation kind"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get getSubmitText () {
|
|
25
|
+
return getSubmitText;
|
|
26
|
+
},
|
|
27
|
+
get getTitleAction () {
|
|
28
|
+
return getTitleAction;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
function getTitleAction(action, isDraft) {
|
|
32
|
+
if (action === 'read') return 'View';
|
|
33
|
+
if (isDraft && action === 'create') return 'Add';
|
|
34
|
+
if (!isDraft && action === 'create') return 'Create';
|
|
35
|
+
if (action === 'update') return 'Edit';
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
38
|
+
function getSubmitText(action, isDraft) {
|
|
39
|
+
if (isDraft && action === 'create') return 'Add';
|
|
40
|
+
if (isDraft && action === 'update') return 'Apply';
|
|
41
|
+
if (!isDraft) return 'Save';
|
|
42
|
+
return '';
|
|
43
|
+
}
|