@perses-dev/components 0.55.1 → 0.56.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/AlignSelector/AlignSelector.js +115 -25
- package/dist/AlignSelector/AlignSelector.js.map +1 -1
- package/dist/CodeEditor/CodeEditor.d.ts +19 -0
- package/dist/CodeEditor/CodeEditor.d.ts.map +1 -0
- package/dist/CodeEditor/CodeEditor.js +122 -0
- package/dist/CodeEditor/CodeEditor.js.map +1 -0
- package/dist/ColorPicker/ColorPicker.js +153 -61
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js +147 -52
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js +144 -41
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/DensitySelector/DensitySelector.js +53 -20
- package/dist/DensitySelector/DensitySelector.js.map +1 -1
- package/dist/Dialog/Dialog.d.ts +3 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +202 -49
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js +79 -27
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/DragAndDrop/DragAndDropList.js +184 -113
- package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
- package/dist/DragAndDrop/DragButton.js +131 -52
- package/dist/DragAndDrop/DragButton.js.map +1 -1
- package/dist/DragAndDrop/DropIndicator.js +51 -26
- package/dist/DragAndDrop/DropIndicator.js.map +1 -1
- package/dist/Drawer/Drawer.js +75 -15
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/EChart/EChart.js +179 -90
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/ErrorAlert.js +14 -4
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js +463 -190
- package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.js +82 -50
- package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
- package/dist/FormEditor/FormActions.js +88 -14
- package/dist/FormEditor/FormActions.js.map +1 -1
- package/dist/FormatControls/FormatControls.js +246 -99
- package/dist/FormatControls/FormatControls.js.map +1 -1
- package/dist/FormatControls/UnitSelector.js +90 -25
- package/dist/FormatControls/UnitSelector.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js +105 -42
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/JSONEditor.d.ts +2 -6
- package/dist/JSONEditor.d.ts.map +1 -1
- package/dist/JSONEditor.js +24 -37
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.js +77 -27
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.js +184 -82
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.js +54 -9
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.js +46 -16
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.js +184 -48
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.d.ts.map +1 -1
- package/dist/Legend/TableLegend.js +90 -48
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/legend-model.d.ts +2 -2
- package/dist/Legend/legend-model.d.ts.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LinksEditor/LinkEditorForm.js +148 -67
- package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
- package/dist/ModeSelector/ModeSelector.js +61 -19
- package/dist/ModeSelector/ModeSelector.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js +20 -9
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +130 -54
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +17 -6
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +76 -28
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/Overlay/Overlay.js +71 -27
- package/dist/Overlay/Overlay.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +96 -38
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/RepeatGrid/RepeatGrid.js +117 -45
- package/dist/RepeatGrid/RepeatGrid.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +99 -38
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/SortSelector/SortSelector.js +51 -18
- package/dist/SortSelector/SortSelector.js.map +1 -1
- package/dist/SortSelector/SortSelectorButtons.js +109 -25
- package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
- package/dist/Table/InnerTable.js +46 -15
- package/dist/Table/InnerTable.js.map +1 -1
- package/dist/Table/Table.d.ts +3 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +410 -158
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.js +15 -4
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableCell.js +294 -107
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.js +101 -32
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableFoot.js +15 -4
- package/dist/Table/TableFoot.js.map +1 -1
- package/dist/Table/TableHead.js +15 -4
- package/dist/Table/TableHead.js.map +1 -1
- package/dist/Table/TableHeaderCell.js +119 -62
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/TableRow.js +33 -9
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/TableToolbar.d.ts +5 -4
- package/dist/Table/TableToolbar.d.ts.map +1 -1
- package/dist/Table/TableToolbar.js +172 -100
- package/dist/Table/TableToolbar.js.map +1 -1
- package/dist/Table/VirtualizedTable.d.ts +11 -11
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +442 -204
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js +27 -7
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.d.ts +6 -5
- package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.js +57 -32
- package/dist/Table/hooks/useFuzzySearch.js.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js +115 -74
- package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +86 -69
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +44 -15
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +33 -1
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +137 -47
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +341 -174
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js +368 -162
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js +580 -210
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +189 -65
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +168 -78
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js +38 -11
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +229 -72
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js +73 -27
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +221 -121
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +44 -38
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeZoneSelector.js +131 -36
- package/dist/TimeZoneSelector.js.map +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.js +18 -7
- package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/TransformsEditor/TransformEditor.js +830 -334
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js +252 -90
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.js +170 -59
- package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js +800 -322
- package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js +218 -91
- package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
- package/dist/YAMLEditor/YAMLEditor.d.ts +12 -0
- package/dist/YAMLEditor/YAMLEditor.d.ts.map +1 -0
- package/dist/YAMLEditor/YAMLEditor.js +41 -0
- package/dist/YAMLEditor/YAMLEditor.js.map +1 -0
- package/dist/YAMLEditor/index.d.ts +2 -0
- package/dist/YAMLEditor/index.d.ts.map +1 -0
- package/dist/YAMLEditor/index.js +15 -0
- package/dist/YAMLEditor/index.js.map +1 -0
- package/dist/YAMLEditor/yaml-utils.d.ts +11 -0
- package/dist/YAMLEditor/yaml-utils.d.ts.map +1 -0
- package/dist/YAMLEditor/yaml-utils.js +52 -0
- package/dist/YAMLEditor/yaml-utils.js.map +1 -0
- package/dist/YAxisLabel.js +64 -20
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/context/ChartsProvider.js +32 -16
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/context/ItemActionsProvider.js +110 -61
- package/dist/context/ItemActionsProvider.js.map +1 -1
- package/dist/context/SelectionProvider.js +170 -66
- package/dist/context/SelectionProvider.js.map +1 -1
- package/dist/context/SnackbarProvider.js +101 -44
- package/dist/context/SnackbarProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.js +35 -14
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/controls/TextField.js +86 -25
- package/dist/controls/TextField.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/browser-storage.js +64 -34
- package/dist/utils/browser-storage.js.map +1 -1
- package/package.json +15 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/RepeatGrid/RepeatGrid.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { SxProps, Theme } from '@mui/material';\nimport { Box } from '@mui/material';\nimport type { ReactNode } from 'react';\nimport { useMemo } from 'react';\n\nexport interface RepeatGridProps<T> {\n repeatItems: T[];\n maxPer: number;\n gap: number;\n renderItem: (item: T, options: { rowIndex: number; colIndex: number }) => ReactNode;\n containerSx?: SxProps<Theme>;\n rowSx?: SxProps<Theme>;\n}\n\nexport function RepeatGrid<T>({\n repeatItems,\n maxPer,\n gap,\n renderItem,\n containerSx,\n rowSx,\n}: RepeatGridProps<T>): ReactNode {\n const { rows, perRow } = useMemo(() => {\n const perRow = Math.max(1, maxPer);\n const rows: T[][] = [];\n for (let i = 0; i < repeatItems.length; i += perRow) {\n rows.push(repeatItems.slice(i, i + perRow));\n }\n\n return { rows, perRow };\n }, [maxPer, repeatItems]);\n\n return (\n <Box\n sx={[\n { display: 'flex', flexDirection: 'column', width: '100%', height: '100%', gap: `${gap}px` },\n ...(Array.isArray(containerSx) ? containerSx : [containerSx]),\n ]}\n >\n {rows.map((rowItems, rowIndex) => (\n <Box key={rowIndex} sx={[{ display: 'flex', gap: `${gap}px` }, ...(Array.isArray(rowSx) ? rowSx : [rowSx])]}>\n {rowItems.map((item, colIndex) => (\n <Box\n key={`${rowIndex}-${colIndex}`}\n sx={{\n width: `calc((100% - ${gap * (perRow - 1)}px) / ${perRow})`,\n overflow: 'hidden',\n }}\n >\n {renderItem(item, { rowIndex, colIndex })}\n </Box>\n ))}\n </Box>\n ))}\n </Box>\n );\n}\n"],"names":["Box"
|
|
1
|
+
{"version":3,"sources":["../../src/RepeatGrid/RepeatGrid.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { SxProps, Theme } from '@mui/material';\nimport { Box } from '@mui/material';\nimport type { ReactNode } from 'react';\nimport { useMemo } from 'react';\n\nexport interface RepeatGridProps<T> {\n repeatItems: T[];\n maxPer: number;\n gap: number;\n renderItem: (item: T, options: { rowIndex: number; colIndex: number }) => ReactNode;\n containerSx?: SxProps<Theme>;\n rowSx?: SxProps<Theme>;\n}\n\nexport function RepeatGrid<T>({\n repeatItems,\n maxPer,\n gap,\n renderItem,\n containerSx,\n rowSx,\n}: RepeatGridProps<T>): ReactNode {\n const { rows, perRow } = useMemo(() => {\n const perRow = Math.max(1, maxPer);\n const rows: T[][] = [];\n for (let i = 0; i < repeatItems.length; i += perRow) {\n rows.push(repeatItems.slice(i, i + perRow));\n }\n\n return { rows, perRow };\n }, [maxPer, repeatItems]);\n\n return (\n <Box\n sx={[\n { display: 'flex', flexDirection: 'column', width: '100%', height: '100%', gap: `${gap}px` },\n ...(Array.isArray(containerSx) ? containerSx : [containerSx]),\n ]}\n >\n {rows.map((rowItems, rowIndex) => (\n <Box key={rowIndex} sx={[{ display: 'flex', gap: `${gap}px` }, ...(Array.isArray(rowSx) ? rowSx : [rowSx])]}>\n {rowItems.map((item, colIndex) => (\n <Box\n key={`${rowIndex}-${colIndex}`}\n sx={{\n width: `calc((100% - ${gap * (perRow - 1)}px) / ${perRow})`,\n overflow: 'hidden',\n }}\n >\n {renderItem(item, { rowIndex, colIndex })}\n </Box>\n ))}\n </Box>\n ))}\n </Box>\n );\n}\n"],"names":["Box"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAGjC,SAASA,GAAG,QAAQ,gBAAgB;AAapC,OAAO"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { c as _c } from "react-compiler-runtime";
|
|
14
15
|
import { Autocomplete, TextField, Typography, createFilterOptions } from "@mui/material";
|
|
15
16
|
function renderDefaultInput(params) {
|
|
16
17
|
return /*#__PURE__*/ _jsx(TextField, {
|
|
@@ -22,34 +23,55 @@ function renderDefaultInput(params) {
|
|
|
22
23
|
* for settings that require selecting one or more options from a list.
|
|
23
24
|
*
|
|
24
25
|
* **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**
|
|
25
|
-
*/ export function SettingsAutocomplete(
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
*/ export function SettingsAutocomplete(t0) {
|
|
27
|
+
const $ = _c(16);
|
|
28
|
+
let ariaLabelledby;
|
|
29
|
+
let id;
|
|
30
|
+
let options;
|
|
31
|
+
let otherProps;
|
|
32
|
+
let t1;
|
|
33
|
+
if ($[0] !== t0) {
|
|
34
|
+
({ options, renderInput: t1, id, "aria-labelledby": ariaLabelledby, ...otherProps } = t0);
|
|
35
|
+
$[0] = t0;
|
|
36
|
+
$[1] = ariaLabelledby;
|
|
37
|
+
$[2] = id;
|
|
38
|
+
$[3] = options;
|
|
39
|
+
$[4] = otherProps;
|
|
40
|
+
$[5] = t1;
|
|
41
|
+
} else {
|
|
42
|
+
ariaLabelledby = $[1];
|
|
43
|
+
id = $[2];
|
|
44
|
+
options = $[3];
|
|
45
|
+
otherProps = $[4];
|
|
46
|
+
t1 = $[5];
|
|
47
|
+
}
|
|
48
|
+
const renderInput = t1 === undefined ? renderDefaultInput : t1;
|
|
49
|
+
const getOptionLabel = _temp;
|
|
50
|
+
let t2;
|
|
51
|
+
if ($[6] !== ariaLabelledby || $[7] !== id || $[8] !== renderInput) {
|
|
52
|
+
t2 = (params)=>{
|
|
53
|
+
const mergedParams = {
|
|
54
|
+
...params,
|
|
55
|
+
inputProps: {
|
|
56
|
+
...params.inputProps,
|
|
57
|
+
id,
|
|
58
|
+
"aria-labelledby": ariaLabelledby
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return renderInput(mergedParams);
|
|
39
62
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
renderOption: ({ key, ...props }, option)=>{
|
|
63
|
+
$[6] = ariaLabelledby;
|
|
64
|
+
$[7] = id;
|
|
65
|
+
$[8] = renderInput;
|
|
66
|
+
$[9] = t2;
|
|
67
|
+
} else {
|
|
68
|
+
t2 = $[9];
|
|
69
|
+
}
|
|
70
|
+
const handleRenderInput = t2;
|
|
71
|
+
let t3;
|
|
72
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
73
|
+
t3 = (t4, option_2)=>{
|
|
74
|
+
const { key, ...props } = t4;
|
|
53
75
|
return /*#__PURE__*/ _jsx("li", {
|
|
54
76
|
...props,
|
|
55
77
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
@@ -57,26 +79,65 @@ function renderDefaultInput(params) {
|
|
|
57
79
|
/*#__PURE__*/ _jsx(Typography, {
|
|
58
80
|
variant: "body1",
|
|
59
81
|
component: "div",
|
|
60
|
-
children: getOptionLabel(
|
|
82
|
+
children: getOptionLabel(option_2)
|
|
61
83
|
}),
|
|
62
|
-
|
|
84
|
+
option_2.description && /*#__PURE__*/ _jsx(Typography, {
|
|
63
85
|
variant: "body2",
|
|
64
86
|
component: "div",
|
|
65
87
|
sx: {
|
|
66
|
-
color:
|
|
88
|
+
color: _temp4
|
|
67
89
|
},
|
|
68
|
-
children:
|
|
90
|
+
children: option_2.description
|
|
69
91
|
})
|
|
70
92
|
]
|
|
71
93
|
})
|
|
72
94
|
}, key);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
};
|
|
96
|
+
$[10] = t3;
|
|
97
|
+
} else {
|
|
98
|
+
t3 = $[10];
|
|
99
|
+
}
|
|
100
|
+
let t4;
|
|
101
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
102
|
+
t4 = createFilterOptions({
|
|
103
|
+
stringify: (option_3)=>`${getOptionLabel(option_3)} ${option_3.description || ""}`
|
|
104
|
+
});
|
|
105
|
+
$[11] = t4;
|
|
106
|
+
} else {
|
|
107
|
+
t4 = $[11];
|
|
108
|
+
}
|
|
109
|
+
let t5;
|
|
110
|
+
if ($[12] !== handleRenderInput || $[13] !== options || $[14] !== otherProps) {
|
|
111
|
+
t5 = /*#__PURE__*/ _jsx(Autocomplete, {
|
|
112
|
+
isOptionEqualToValue: _temp2,
|
|
113
|
+
getOptionDisabled: _temp3,
|
|
114
|
+
getOptionLabel: getOptionLabel,
|
|
115
|
+
options: options,
|
|
116
|
+
renderInput: handleRenderInput,
|
|
117
|
+
renderOption: t3,
|
|
118
|
+
filterOptions: t4,
|
|
119
|
+
...otherProps
|
|
120
|
+
});
|
|
121
|
+
$[12] = handleRenderInput;
|
|
122
|
+
$[13] = options;
|
|
123
|
+
$[14] = otherProps;
|
|
124
|
+
$[15] = t5;
|
|
125
|
+
} else {
|
|
126
|
+
t5 = $[15];
|
|
127
|
+
}
|
|
128
|
+
return t5;
|
|
129
|
+
}
|
|
130
|
+
function _temp4(theme) {
|
|
131
|
+
return theme.palette.text.secondary;
|
|
132
|
+
}
|
|
133
|
+
function _temp3(option_1) {
|
|
134
|
+
return !!option_1.disabled;
|
|
135
|
+
}
|
|
136
|
+
function _temp2(option_0, value) {
|
|
137
|
+
return option_0.id === value.id;
|
|
138
|
+
}
|
|
139
|
+
function _temp(option) {
|
|
140
|
+
return option.label ?? option.id;
|
|
80
141
|
}
|
|
81
142
|
|
|
82
143
|
//# sourceMappingURL=SettingsAutocomplete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/SettingsAutocomplete/SettingsAutocomplete.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { AutocompleteProps, AutocompleteRenderInputParams, UseAutocompleteProps } from '@mui/material';\nimport { Autocomplete, TextField, Typography, createFilterOptions } from '@mui/material';\nimport type { ReactElement, ReactNode } from 'react';\n\nfunction renderDefaultInput(params: AutocompleteRenderInputParams): ReactElement {\n return <TextField {...params} />;\n}\n\n/**\n * Interface to extend from for `options` when using `SettingsAutocomplete`.\n */\nexport interface SettingsAutocompleteOption {\n /**\n * Unique identifier for the option.\n */\n id: string;\n\n /**\n * Optional value that is presented to the user for each option. If not set,\n * the `id` will be used instead.\n */\n label?: string;\n\n /**\n * Optional description that will be rendered below the `label` to provide the\n * user with additional information about the option.\n */\n description?: ReactNode;\n\n /**\n * When `true`, the option will be disabled.\n */\n disabled?: boolean;\n}\n\nexport interface SettingsAutocompleteProps<\n OptionType extends SettingsAutocompleteOption,\n Multiple extends boolean | undefined,\n DisableClearable extends boolean | undefined,\n // Note that the last `false` in the generic arguments sets the `freeSolo` option to `false`.\n // This component is intended to be used with a discrete list of options, so `freeSolo` never\n // needs to be `true`.\n> extends Omit<AutocompleteProps<OptionType, Multiple, DisableClearable, false>, 'renderInput'> {\n // Modifying this to optional, so we can define a sensible default below that\n // is used in many of the simple cases.\n renderInput?: AutocompleteProps<OptionType, Multiple, DisableClearable, false>['renderInput'];\n}\n\n/**\n * Opinionated autocomplete component useful for providing users with a dropdown\n * for settings that require selecting one or more options from a list.\n *\n * **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**\n */\nexport function SettingsAutocomplete<\n OptionType extends SettingsAutocompleteOption,\n Multiple extends boolean | undefined = false,\n DisableClearable extends boolean | undefined = false,\n>({\n options,\n renderInput = renderDefaultInput,\n id,\n 'aria-labelledby': ariaLabelledby,\n ...otherProps\n}: SettingsAutocompleteProps<OptionType, Multiple, DisableClearable>): ReactElement {\n const getOptionLabel: UseAutocompleteProps<OptionType, undefined, boolean, undefined>['getOptionLabel'] = (\n option,\n ) => {\n return option.label ?? option.id;\n };\n\n // Merge id and aria-labelledby props into the input element for proper accessibility\n // and form association, while still allowing custom renderInput implementations.\n const handleRenderInput: AutocompleteProps<OptionType, Multiple, DisableClearable, false>['renderInput'] = (\n params,\n ) => {\n const mergedParams = {\n ...params,\n inputProps: { ...params.inputProps, id, 'aria-labelledby': ariaLabelledby },\n };\n return renderInput(mergedParams);\n };\n\n // Note: this component currently is not virtualized because it is specific\n // to being used for settings, which generally have a pretty small list of\n // options. If this changes to include values with many options, virtualization\n // should be added using react-virtuoso.\n return (\n <Autocomplete\n isOptionEqualToValue={(option, value) => option.id === value.id}\n getOptionDisabled={(option) => !!option.disabled}\n getOptionLabel={getOptionLabel}\n options={options}\n renderInput={handleRenderInput}\n renderOption={({ key, ...props }, option) => {\n return (\n <li key={key} {...props}>\n <div>\n <Typography variant=\"body1\" component=\"div\">\n {getOptionLabel(option)}\n </Typography>\n {option.description && (\n <Typography variant=\"body2\" component=\"div\" sx={{ color: (theme) => theme.palette.text.secondary }}>\n {option.description}\n </Typography>\n )}\n </div>\n </li>\n );\n }}\n filterOptions={createFilterOptions({\n // Include the label and the description in search.\n stringify: (option) => `${getOptionLabel(option)} ${option.description || ''}`,\n })}\n {...otherProps}\n />\n );\n}\n"],"names":["Autocomplete","TextField","Typography","createFilterOptions","renderDefaultInput","params"
|
|
1
|
+
{"version":3,"sources":["../../src/SettingsAutocomplete/SettingsAutocomplete.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { AutocompleteProps, AutocompleteRenderInputParams, UseAutocompleteProps } from '@mui/material';\nimport { Autocomplete, TextField, Typography, createFilterOptions } from '@mui/material';\nimport type { ReactElement, ReactNode } from 'react';\n\nfunction renderDefaultInput(params: AutocompleteRenderInputParams): ReactElement {\n return <TextField {...params} />;\n}\n\n/**\n * Interface to extend from for `options` when using `SettingsAutocomplete`.\n */\nexport interface SettingsAutocompleteOption {\n /**\n * Unique identifier for the option.\n */\n id: string;\n\n /**\n * Optional value that is presented to the user for each option. If not set,\n * the `id` will be used instead.\n */\n label?: string;\n\n /**\n * Optional description that will be rendered below the `label` to provide the\n * user with additional information about the option.\n */\n description?: ReactNode;\n\n /**\n * When `true`, the option will be disabled.\n */\n disabled?: boolean;\n}\n\nexport interface SettingsAutocompleteProps<\n OptionType extends SettingsAutocompleteOption,\n Multiple extends boolean | undefined,\n DisableClearable extends boolean | undefined,\n // Note that the last `false` in the generic arguments sets the `freeSolo` option to `false`.\n // This component is intended to be used with a discrete list of options, so `freeSolo` never\n // needs to be `true`.\n> extends Omit<AutocompleteProps<OptionType, Multiple, DisableClearable, false>, 'renderInput'> {\n // Modifying this to optional, so we can define a sensible default below that\n // is used in many of the simple cases.\n renderInput?: AutocompleteProps<OptionType, Multiple, DisableClearable, false>['renderInput'];\n}\n\n/**\n * Opinionated autocomplete component useful for providing users with a dropdown\n * for settings that require selecting one or more options from a list.\n *\n * **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**\n */\nexport function SettingsAutocomplete<\n OptionType extends SettingsAutocompleteOption,\n Multiple extends boolean | undefined = false,\n DisableClearable extends boolean | undefined = false,\n>({\n options,\n renderInput = renderDefaultInput,\n id,\n 'aria-labelledby': ariaLabelledby,\n ...otherProps\n}: SettingsAutocompleteProps<OptionType, Multiple, DisableClearable>): ReactElement {\n const getOptionLabel: UseAutocompleteProps<OptionType, undefined, boolean, undefined>['getOptionLabel'] = (\n option,\n ) => {\n return option.label ?? option.id;\n };\n\n // Merge id and aria-labelledby props into the input element for proper accessibility\n // and form association, while still allowing custom renderInput implementations.\n const handleRenderInput: AutocompleteProps<OptionType, Multiple, DisableClearable, false>['renderInput'] = (\n params,\n ) => {\n const mergedParams = {\n ...params,\n inputProps: { ...params.inputProps, id, 'aria-labelledby': ariaLabelledby },\n };\n return renderInput(mergedParams);\n };\n\n // Note: this component currently is not virtualized because it is specific\n // to being used for settings, which generally have a pretty small list of\n // options. If this changes to include values with many options, virtualization\n // should be added using react-virtuoso.\n return (\n <Autocomplete\n isOptionEqualToValue={(option, value) => option.id === value.id}\n getOptionDisabled={(option) => !!option.disabled}\n getOptionLabel={getOptionLabel}\n options={options}\n renderInput={handleRenderInput}\n renderOption={({ key, ...props }, option) => {\n return (\n <li key={key} {...props}>\n <div>\n <Typography variant=\"body1\" component=\"div\">\n {getOptionLabel(option)}\n </Typography>\n {option.description && (\n <Typography variant=\"body2\" component=\"div\" sx={{ color: (theme) => theme.palette.text.secondary }}>\n {option.description}\n </Typography>\n )}\n </div>\n </li>\n );\n }}\n filterOptions={createFilterOptions({\n // Include the label and the description in search.\n stringify: (option) => `${getOptionLabel(option)} ${option.description || ''}`,\n })}\n {...otherProps}\n />\n );\n}\n"],"names":["Autocomplete","TextField","Typography","createFilterOptions","renderDefaultInput","params"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAGjC,SAASA,YAAY,EAAEC,SAAS,EAAEC,UAAU,EAAEC,mBAAmB,QAAQ,gBAAgB;AAGzF,SAASC,mBAAmBC,MAAM;IAChC,qBAAO,KAACJ;QAAW,GAAGI,MAAM;;AAC9B;AA0CA;;;;;CAKC,GACD,OAAO"}
|
|
@@ -11,32 +11,65 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { c as _c } from "react-compiler-runtime";
|
|
14
15
|
import { OptionsEditorControl } from "../OptionsEditorLayout/index.js";
|
|
15
16
|
import { SettingsAutocomplete } from "../SettingsAutocomplete/index.js";
|
|
16
17
|
const SORT_OPTIONS = [
|
|
17
18
|
{
|
|
18
|
-
id:
|
|
19
|
-
label:
|
|
19
|
+
id: "asc",
|
|
20
|
+
label: "Ascending"
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
|
-
id:
|
|
23
|
-
label:
|
|
23
|
+
id: "desc",
|
|
24
|
+
label: "Descending"
|
|
24
25
|
}
|
|
25
26
|
];
|
|
26
|
-
export function SortSelector(
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
export function SortSelector(t0) {
|
|
28
|
+
const $ = _c(7);
|
|
29
|
+
const { onChange, value: t1 } = t0;
|
|
30
|
+
const value = t1 === undefined ? "desc" : t1;
|
|
31
|
+
let t2;
|
|
32
|
+
if ($[0] !== onChange) {
|
|
33
|
+
t2 = (_, t3)=>{
|
|
34
|
+
const { id } = t3;
|
|
35
|
+
onChange(id);
|
|
36
|
+
};
|
|
37
|
+
$[0] = onChange;
|
|
38
|
+
$[1] = t2;
|
|
39
|
+
} else {
|
|
40
|
+
t2 = $[1];
|
|
41
|
+
}
|
|
42
|
+
const handleSortChange = t2;
|
|
43
|
+
let t3;
|
|
44
|
+
if ($[2] !== value) {
|
|
45
|
+
t3 = SORT_OPTIONS.find((o)=>o.id === value);
|
|
46
|
+
$[2] = value;
|
|
47
|
+
$[3] = t3;
|
|
48
|
+
} else {
|
|
49
|
+
t3 = $[3];
|
|
50
|
+
}
|
|
51
|
+
let t4;
|
|
52
|
+
if ($[4] !== handleSortChange || $[5] !== t3) {
|
|
53
|
+
t4 = /*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
54
|
+
label: "Sort",
|
|
55
|
+
control: /*#__PURE__*/ _jsx(SettingsAutocomplete, {
|
|
56
|
+
value: t3,
|
|
57
|
+
options: SORT_OPTIONS,
|
|
58
|
+
getOptionLabel: _temp,
|
|
59
|
+
onChange: handleSortChange,
|
|
60
|
+
disableClearable: true
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
$[4] = handleSortChange;
|
|
64
|
+
$[5] = t3;
|
|
65
|
+
$[6] = t4;
|
|
66
|
+
} else {
|
|
67
|
+
t4 = $[6];
|
|
68
|
+
}
|
|
69
|
+
return t4;
|
|
70
|
+
}
|
|
71
|
+
function _temp(o_0) {
|
|
72
|
+
return o_0.label;
|
|
40
73
|
}
|
|
41
74
|
|
|
42
75
|
//# sourceMappingURL=SortSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/SortSelector/SortSelector.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ReactElement } from 'react';\n\nimport { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst SORT_OPTIONS: Array<{ id: SortOption; label: string }> = [\n { id: 'asc', label: 'Ascending' },\n { id: 'desc', label: 'Descending' },\n];\n\nexport type SortOption = 'asc' | 'desc';\n\nexport interface SortSelectorProps {\n onChange: (sort: SortOption) => void;\n value?: SortOption;\n}\n\nexport function SortSelector({ onChange, value = 'desc' }: SortSelectorProps): ReactElement {\n const handleSortChange = (_: unknown, { id }: { id: SortOption }): void => {\n onChange(id);\n };\n\n return (\n <OptionsEditorControl\n label=\"Sort\"\n control={\n <SettingsAutocomplete\n value={SORT_OPTIONS.find((o) => o.id === value)}\n options={SORT_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleSortChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","SORT_OPTIONS","id","label"
|
|
1
|
+
{"version":3,"sources":["../../src/SortSelector/SortSelector.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ReactElement } from 'react';\n\nimport { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst SORT_OPTIONS: Array<{ id: SortOption; label: string }> = [\n { id: 'asc', label: 'Ascending' },\n { id: 'desc', label: 'Descending' },\n];\n\nexport type SortOption = 'asc' | 'desc';\n\nexport interface SortSelectorProps {\n onChange: (sort: SortOption) => void;\n value?: SortOption;\n}\n\nexport function SortSelector({ onChange, value = 'desc' }: SortSelectorProps): ReactElement {\n const handleSortChange = (_: unknown, { id }: { id: SortOption }): void => {\n onChange(id);\n };\n\n return (\n <OptionsEditorControl\n label=\"Sort\"\n control={\n <SettingsAutocomplete\n value={SORT_OPTIONS.find((o) => o.id === value)}\n options={SORT_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleSortChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","SORT_OPTIONS","id","label"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;;AAIjC,SAASA,oBAAoB,QAAQ,kCAAyB;AAC9D,SAASC,oBAAoB,QAAQ,mCAA0B;AAE/D,MAAMC,eAAyD;IAC7D;QAAEC,IAAI;QAAOC,OAAO;IAAY;IAChC;QAAED,IAAI;QAAQC,OAAO;IAAa;CACnC;AASD,OAAO"}
|
|
@@ -11,32 +11,116 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { c as _c } from "react-compiler-runtime";
|
|
14
15
|
import { Button, ButtonGroup } from "@mui/material";
|
|
15
|
-
export function SortSelectorButtons(
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
...
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
16
|
+
export function SortSelectorButtons(t0) {
|
|
17
|
+
const $ = _c(24);
|
|
18
|
+
let props;
|
|
19
|
+
let t1;
|
|
20
|
+
let value;
|
|
21
|
+
if ($[0] !== t0) {
|
|
22
|
+
const { onChange, value: t2, ...t3 } = t0;
|
|
23
|
+
value = t2;
|
|
24
|
+
props = t3;
|
|
25
|
+
t1 = (sort)=>{
|
|
26
|
+
onChange(sort);
|
|
27
|
+
};
|
|
28
|
+
$[0] = t0;
|
|
29
|
+
$[1] = props;
|
|
30
|
+
$[2] = t1;
|
|
31
|
+
$[3] = value;
|
|
32
|
+
} else {
|
|
33
|
+
props = $[1];
|
|
34
|
+
t1 = $[2];
|
|
35
|
+
value = $[3];
|
|
36
|
+
}
|
|
37
|
+
const handleSortChange = t1;
|
|
38
|
+
let t2;
|
|
39
|
+
if ($[4] !== handleSortChange) {
|
|
40
|
+
t2 = ()=>handleSortChange(undefined);
|
|
41
|
+
$[4] = handleSortChange;
|
|
42
|
+
$[5] = t2;
|
|
43
|
+
} else {
|
|
44
|
+
t2 = $[5];
|
|
45
|
+
}
|
|
46
|
+
const t3 = value === undefined ? "contained" : "outlined";
|
|
47
|
+
let t4;
|
|
48
|
+
if ($[6] !== t2 || $[7] !== t3) {
|
|
49
|
+
t4 = /*#__PURE__*/ _jsx(Button, {
|
|
50
|
+
onClick: t2,
|
|
51
|
+
variant: t3,
|
|
52
|
+
children: "None"
|
|
53
|
+
});
|
|
54
|
+
$[6] = t2;
|
|
55
|
+
$[7] = t3;
|
|
56
|
+
$[8] = t4;
|
|
57
|
+
} else {
|
|
58
|
+
t4 = $[8];
|
|
59
|
+
}
|
|
60
|
+
let t5;
|
|
61
|
+
if ($[9] !== handleSortChange) {
|
|
62
|
+
t5 = ()=>handleSortChange("asc");
|
|
63
|
+
$[9] = handleSortChange;
|
|
64
|
+
$[10] = t5;
|
|
65
|
+
} else {
|
|
66
|
+
t5 = $[10];
|
|
67
|
+
}
|
|
68
|
+
const t6 = value === "asc" ? "contained" : "outlined";
|
|
69
|
+
let t7;
|
|
70
|
+
if ($[11] !== t5 || $[12] !== t6) {
|
|
71
|
+
t7 = /*#__PURE__*/ _jsx(Button, {
|
|
72
|
+
onClick: t5,
|
|
73
|
+
variant: t6,
|
|
74
|
+
children: "Asc"
|
|
75
|
+
});
|
|
76
|
+
$[11] = t5;
|
|
77
|
+
$[12] = t6;
|
|
78
|
+
$[13] = t7;
|
|
79
|
+
} else {
|
|
80
|
+
t7 = $[13];
|
|
81
|
+
}
|
|
82
|
+
let t8;
|
|
83
|
+
if ($[14] !== handleSortChange) {
|
|
84
|
+
t8 = ()=>handleSortChange("desc");
|
|
85
|
+
$[14] = handleSortChange;
|
|
86
|
+
$[15] = t8;
|
|
87
|
+
} else {
|
|
88
|
+
t8 = $[15];
|
|
89
|
+
}
|
|
90
|
+
const t9 = value === "desc" ? "contained" : "outlined";
|
|
91
|
+
let t10;
|
|
92
|
+
if ($[16] !== t8 || $[17] !== t9) {
|
|
93
|
+
t10 = /*#__PURE__*/ _jsx(Button, {
|
|
94
|
+
onClick: t8,
|
|
95
|
+
variant: t9,
|
|
96
|
+
children: "Desc"
|
|
97
|
+
});
|
|
98
|
+
$[16] = t8;
|
|
99
|
+
$[17] = t9;
|
|
100
|
+
$[18] = t10;
|
|
101
|
+
} else {
|
|
102
|
+
t10 = $[18];
|
|
103
|
+
}
|
|
104
|
+
let t11;
|
|
105
|
+
if ($[19] !== props || $[20] !== t10 || $[21] !== t4 || $[22] !== t7) {
|
|
106
|
+
t11 = /*#__PURE__*/ _jsxs(ButtonGroup, {
|
|
107
|
+
"aria-label": "Sort",
|
|
108
|
+
...props,
|
|
109
|
+
children: [
|
|
110
|
+
t4,
|
|
111
|
+
t7,
|
|
112
|
+
t10
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
$[19] = props;
|
|
116
|
+
$[20] = t10;
|
|
117
|
+
$[21] = t4;
|
|
118
|
+
$[22] = t7;
|
|
119
|
+
$[23] = t11;
|
|
120
|
+
} else {
|
|
121
|
+
t11 = $[23];
|
|
122
|
+
}
|
|
123
|
+
return t11;
|
|
40
124
|
}
|
|
41
125
|
|
|
42
126
|
//# sourceMappingURL=SortSelectorButtons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/SortSelector/SortSelectorButtons.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ButtonGroupProps } from '@mui/material';\nimport { Button, ButtonGroup } from '@mui/material';\nimport type { ReactElement } from 'react';\n\nimport type { SortOption } from './SortSelector';\n\nexport interface SortSelectorButtonsProps extends Omit<ButtonGroupProps, 'onChange'> {\n value?: SortOption;\n onChange: (sort?: SortOption) => void;\n}\n\nexport function SortSelectorButtons({ onChange, value, ...props }: SortSelectorButtonsProps): ReactElement {\n const handleSortChange = (sort?: SortOption): void => {\n onChange(sort);\n };\n\n return (\n <ButtonGroup aria-label=\"Sort\" {...props}>\n <Button onClick={() => handleSortChange(undefined)} variant={value === undefined ? 'contained' : 'outlined'}>\n None\n </Button>\n <Button onClick={() => handleSortChange('asc')} variant={value === 'asc' ? 'contained' : 'outlined'}>\n Asc\n </Button>\n <Button onClick={() => handleSortChange('desc')} variant={value === 'desc' ? 'contained' : 'outlined'}>\n Desc\n </Button>\n </ButtonGroup>\n );\n}\n"],"names":["Button","ButtonGroup"
|
|
1
|
+
{"version":3,"sources":["../../src/SortSelector/SortSelectorButtons.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ButtonGroupProps } from '@mui/material';\nimport { Button, ButtonGroup } from '@mui/material';\nimport type { ReactElement } from 'react';\n\nimport type { SortOption } from './SortSelector';\n\nexport interface SortSelectorButtonsProps extends Omit<ButtonGroupProps, 'onChange'> {\n value?: SortOption;\n onChange: (sort?: SortOption) => void;\n}\n\nexport function SortSelectorButtons({ onChange, value, ...props }: SortSelectorButtonsProps): ReactElement {\n const handleSortChange = (sort?: SortOption): void => {\n onChange(sort);\n };\n\n return (\n <ButtonGroup aria-label=\"Sort\" {...props}>\n <Button onClick={() => handleSortChange(undefined)} variant={value === undefined ? 'contained' : 'outlined'}>\n None\n </Button>\n <Button onClick={() => handleSortChange('asc')} variant={value === 'asc' ? 'contained' : 'outlined'}>\n Asc\n </Button>\n <Button onClick={() => handleSortChange('desc')} variant={value === 'desc' ? 'contained' : 'outlined'}>\n Desc\n </Button>\n </ButtonGroup>\n );\n}\n"],"names":["Button","ButtonGroup"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;;AAGjC,SAASA,MAAM,EAAEC,WAAW,QAAQ,gBAAgB;AAUpD,OAAO"}
|
package/dist/Table/InnerTable.js
CHANGED
|
@@ -11,29 +11,60 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { c as _c } from "react-compiler-runtime";
|
|
14
15
|
import { Table as MuiTable, styled } from "@mui/material";
|
|
15
16
|
import { forwardRef } from "react";
|
|
16
17
|
const StyledMuiTable = styled(MuiTable)(({ theme })=>({
|
|
17
18
|
// This value is needed to have a consistent table layout when scrolling.
|
|
18
|
-
tableLayout:
|
|
19
|
-
borderCollapse:
|
|
19
|
+
tableLayout: "fixed",
|
|
20
|
+
borderCollapse: "separate",
|
|
20
21
|
backgroundColor: theme.palette.background.default
|
|
21
22
|
}));
|
|
22
23
|
const TABLE_DENSITY_CONFIG = {
|
|
23
|
-
compact:
|
|
24
|
-
standard:
|
|
25
|
-
comfortable:
|
|
24
|
+
compact: "small",
|
|
25
|
+
standard: "medium",
|
|
26
|
+
comfortable: "medium"
|
|
26
27
|
};
|
|
27
|
-
export const InnerTable = /*#__PURE__*/ forwardRef(function InnerTable(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
28
|
+
export const InnerTable = /*#__PURE__*/ forwardRef(function InnerTable(t0, ref) {
|
|
29
|
+
const $ = _c(8);
|
|
30
|
+
let density;
|
|
31
|
+
let otherProps;
|
|
32
|
+
if ($[0] !== t0) {
|
|
33
|
+
({ density, ...otherProps } = t0);
|
|
34
|
+
$[0] = t0;
|
|
35
|
+
$[1] = density;
|
|
36
|
+
$[2] = otherProps;
|
|
37
|
+
} else {
|
|
38
|
+
density = $[1];
|
|
39
|
+
otherProps = $[2];
|
|
40
|
+
}
|
|
41
|
+
const t1 = TABLE_DENSITY_CONFIG[density];
|
|
42
|
+
let t2;
|
|
43
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
44
|
+
t2 = {
|
|
45
|
+
width: "100%"
|
|
46
|
+
};
|
|
47
|
+
$[3] = t2;
|
|
48
|
+
} else {
|
|
49
|
+
t2 = $[3];
|
|
50
|
+
}
|
|
51
|
+
let t3;
|
|
52
|
+
if ($[4] !== otherProps || $[5] !== ref || $[6] !== t1) {
|
|
53
|
+
t3 = /*#__PURE__*/ _jsx(StyledMuiTable, {
|
|
54
|
+
...otherProps,
|
|
55
|
+
tabIndex: -1,
|
|
56
|
+
size: t1,
|
|
57
|
+
ref: ref,
|
|
58
|
+
sx: t2
|
|
59
|
+
});
|
|
60
|
+
$[4] = otherProps;
|
|
61
|
+
$[5] = ref;
|
|
62
|
+
$[6] = t1;
|
|
63
|
+
$[7] = t3;
|
|
64
|
+
} else {
|
|
65
|
+
t3 = $[7];
|
|
66
|
+
}
|
|
67
|
+
return t3;
|
|
37
68
|
});
|
|
38
69
|
|
|
39
70
|
//# sourceMappingURL=InnerTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Table/InnerTable.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { TableProps as MuiTableProps } from '@mui/material';\nimport { Table as MuiTable, styled } from '@mui/material';\nimport { forwardRef } from 'react';\n\nimport type { TableDensity } from './model/table-model';\n\nconst StyledMuiTable = styled(MuiTable)(({ theme }) => ({\n // This value is needed to have a consistent table layout when scrolling.\n tableLayout: 'fixed',\n borderCollapse: 'separate',\n backgroundColor: theme.palette.background.default,\n}));\n\ntype InnerTableProps = Omit<MuiTableProps, 'size'> & {\n density: TableDensity;\n};\n\nconst TABLE_DENSITY_CONFIG: Record<TableDensity, MuiTableProps['size']> = {\n compact: 'small',\n standard: 'medium',\n comfortable: 'medium',\n};\n\nexport const InnerTable = forwardRef<HTMLTableElement, InnerTableProps>(function InnerTable(\n { density, ...otherProps },\n ref,\n) {\n return (\n <StyledMuiTable\n {...otherProps}\n tabIndex={-1}\n size={TABLE_DENSITY_CONFIG[density]}\n ref={ref}\n sx={{\n width: '100%',\n }}\n />\n );\n});\n"],"names":["Table","MuiTable","styled","forwardRef","StyledMuiTable","theme","tableLayout","borderCollapse","backgroundColor","palette","background","default","TABLE_DENSITY_CONFIG","compact","standard","comfortable","InnerTable"
|
|
1
|
+
{"version":3,"sources":["../../src/Table/InnerTable.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { TableProps as MuiTableProps } from '@mui/material';\nimport { Table as MuiTable, styled } from '@mui/material';\nimport { forwardRef } from 'react';\n\nimport type { TableDensity } from './model/table-model';\n\nconst StyledMuiTable = styled(MuiTable)(({ theme }) => ({\n // This value is needed to have a consistent table layout when scrolling.\n tableLayout: 'fixed',\n borderCollapse: 'separate',\n backgroundColor: theme.palette.background.default,\n}));\n\ntype InnerTableProps = Omit<MuiTableProps, 'size'> & {\n density: TableDensity;\n};\n\nconst TABLE_DENSITY_CONFIG: Record<TableDensity, MuiTableProps['size']> = {\n compact: 'small',\n standard: 'medium',\n comfortable: 'medium',\n};\n\nexport const InnerTable = forwardRef<HTMLTableElement, InnerTableProps>(function InnerTable(\n { density, ...otherProps },\n ref,\n) {\n return (\n <StyledMuiTable\n {...otherProps}\n tabIndex={-1}\n size={TABLE_DENSITY_CONFIG[density]}\n ref={ref}\n sx={{\n width: '100%',\n }}\n />\n );\n});\n"],"names":["Table","MuiTable","styled","forwardRef","StyledMuiTable","theme","tableLayout","borderCollapse","backgroundColor","palette","background","default","TABLE_DENSITY_CONFIG","compact","standard","comfortable","InnerTable"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAGjC,SAASA,SAASC,QAAQ,EAAEC,MAAM,QAAQ,gBAAgB;AAC1D,SAASC,UAAU,QAAQ,QAAQ;AAInC,MAAMC,iBAAiBF,OAAOD,UAAU,CAAC,EAAEI,KAAK,EAAE,GAAM,CAAA;QACtD,yEAAyE;QACzEC,aAAa;QACbC,gBAAgB;QAChBC,iBAAiBH,MAAMI,OAAO,CAACC,UAAU,CAACC,OAAO;IACnD,CAAA;AAMA,MAAMC,uBAAoE;IACxEC,SAAS;IACTC,UAAU;IACVC,aAAa;AACf;AAEA,OAAO,MAAMC,2BAAab,WAA8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAerE"}
|
package/dist/Table/Table.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type { RowData } from '@tanstack/react-table';
|
|
1
2
|
import type { ReactElement } from 'react';
|
|
2
3
|
import type { TableProps } from './model/table-model';
|
|
4
|
+
export type { TableFeatures } from './model/table-model';
|
|
3
5
|
/**
|
|
4
6
|
* Component used to render tabular data in Perses use cases. This component is
|
|
5
7
|
* **not** intended to be a general use data table for use cases unrelated to Perses.
|
|
6
8
|
*
|
|
7
9
|
* **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**
|
|
8
10
|
*/
|
|
9
|
-
export declare function Table<TableData>({ data, columns, cellConfigs, density, defaultColumnWidth, defaultColumnHeight, checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId, rowSelection, sorting, getItemActions, hasItemActions, pagination, onPaginationChange, rowSelectionVariant, getSubRows, hiddenColumns, tableToolbarConfig, columnResizeMode, defaultColumnConfig, ...otherProps }: TableProps<TableData>): ReactElement;
|
|
11
|
+
export declare function Table<TableData extends RowData>({ data, columns, cellConfigs, density, defaultColumnWidth, defaultColumnHeight, checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId, rowSelection, sorting, getItemActions, hasItemActions, pagination, onPaginationChange, rowSelectionVariant, getSubRows, hiddenColumns, tableToolbarConfig, columnResizeMode, defaultColumnConfig, ...otherProps }: TableProps<TableData>): ReactElement;
|
|
10
12
|
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAMV,OAAO,EAIR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,qBAAqB,CAAC;AAErE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAczD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,SAAS,SAAS,OAAO,EAAE,EAC/C,IAAI,EACJ,OAAO,EACP,WAAW,EACX,OAAoB,EACpB,kBAAyC,EACzC,mBAA4B,EAC5B,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,QAA6B,EAC7B,YAAoC,EACpC,OAAyB,EACzB,cAAc,EACd,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,mBAAgC,EAChC,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,gBAA6B,EAC7B,mBAAmB,EACnB,GAAG,UAAU,EACd,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,YAAY,CAiMtC"}
|