@perses-dev/components 0.54.0-beta.0 → 0.54.0-beta.2
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 +1 -1
- package/dist/AlignSelector/AlignSelector.js.map +1 -1
- package/dist/ColorPicker/ColorPicker.js +1 -1
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
- 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/Dialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/DragAndDrop/DragAndDropList.js +1 -1
- package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
- package/dist/DragAndDrop/DragButton.js +1 -1
- package/dist/DragAndDrop/DragButton.js.map +1 -1
- package/dist/DragAndDrop/DropIndicator.js +1 -1
- package/dist/DragAndDrop/DropIndicator.js.map +1 -1
- package/dist/Drawer/Drawer.js +1 -1
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/EChart/EChart.js +1 -1
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/ErrorAlert.js +1 -1
- package/dist/ErrorAlert.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 +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 +2 -2
- 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/JSONEditor.js +1 -1
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.js +1 -1
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.js +2 -2
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.js +1 -1
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.js +1 -1
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.js +1 -1
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.d.ts.map +1 -1
- package/dist/Legend/TableLegend.js +18 -4
- package/dist/Legend/TableLegend.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/LinksEditor/LinkEditorForm.js +1 -1
- package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
- package/dist/LinksEditor/LinksEditor.js +1 -1
- package/dist/LinksEditor/LinksEditor.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/Overlay/Overlay.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/SortSelector/SortSelectorButtons.js +1 -1
- package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
- package/dist/Table/InnerTable.js +1 -1
- package/dist/Table/InnerTable.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 +47 -14
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.js +1 -1
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableCell.js +1 -1
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.js +1 -1
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableFoot.js +1 -1
- package/dist/Table/TableFoot.js.map +1 -1
- package/dist/Table/TableHead.js +1 -1
- package/dist/Table/TableHead.js.map +1 -1
- package/dist/Table/TableHeaderCell.d.ts +20 -1
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +56 -24
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/TableRow.js +1 -1
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/TableToolbar.d.ts +46 -0
- package/dist/Table/TableToolbar.d.ts.map +1 -0
- package/dist/Table/TableToolbar.js +138 -0
- package/dist/Table/TableToolbar.js.map +1 -0
- package/dist/Table/VirtualizedTable.d.ts +7 -3
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +157 -123
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js +6 -2
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.d.ts +14 -0
- package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -0
- package/dist/Table/hooks/useFuzzySearch.js +62 -0
- package/dist/Table/hooks/useFuzzySearch.js.map +1 -0
- package/dist/Table/model/table-model.d.ts +78 -4
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +37 -19
- 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 +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 +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js +25 -2
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.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 +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.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/TimeZoneSelector.js +1 -1
- package/dist/TimeZoneSelector.js.map +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.js +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.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 +1 -1
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js +2 -2
- 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 +1 -1
- package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.d.ts +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.d.ts.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
- package/dist/YAxisLabel.js +1 -1
- package/dist/YAxisLabel.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/Legend/TableLegend.js +16 -2
- package/dist/cjs/Table/Table.js +44 -11
- package/dist/cjs/Table/TableHeaderCell.js +54 -22
- package/dist/cjs/Table/TableToolbar.js +151 -0
- package/dist/cjs/Table/VirtualizedTable.js +155 -121
- package/dist/cjs/Table/VirtualizedTableContainer.js +5 -1
- package/dist/cjs/Table/hooks/useFuzzySearch.js +67 -0
- package/dist/cjs/Table/model/table-model.js +43 -19
- package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +23 -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 +17 -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/model/value-mapping.js +16 -0
- package/dist/cjs/theme/typography.js +1 -1
- package/dist/cjs/utils/axis.js +5 -5
- package/dist/cjs/utils/format.js +20 -0
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/request-interpolation.js +49 -0
- package/dist/context/ChartsProvider.js +1 -1
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/context/ItemActionsProvider.js +1 -1
- package/dist/context/ItemActionsProvider.js.map +1 -1
- package/dist/context/SelectionProvider.js +1 -1
- package/dist/context/SelectionProvider.js.map +1 -1
- package/dist/context/SnackbarProvider.js +1 -1
- package/dist/context/SnackbarProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.js +1 -1
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/controls/TextField.js +1 -1
- package/dist/controls/TextField.js.map +1 -1
- 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 +17 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +17 -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/model/value-mapping.d.ts +35 -0
- package/dist/model/value-mapping.d.ts.map +1 -0
- package/dist/model/value-mapping.js +15 -0
- package/dist/model/value-mapping.js.map +1 -0
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/theme/typography.js +1 -1
- package/dist/theme/typography.js.map +1 -1
- 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/format.d.ts +1 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +17 -0
- package/dist/utils/format.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 +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Table/TableBody.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 { TableBody as MuiTableBody, TableBodyProps as MuiTableBodyProps } from '@mui/material';\nimport { forwardRef } from 'react';\n\ntype TableBodyProps = MuiTableBodyProps;\n\nexport const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(function TableBody(props, ref) {\n return <MuiTableBody {...props} ref={ref} />;\n});\n"],"names":["TableBody","MuiTableBody","forwardRef","props","ref"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/Table/TableBody.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 { TableBody as MuiTableBody, TableBodyProps as MuiTableBodyProps } from '@mui/material';\nimport { forwardRef } from 'react';\n\ntype TableBodyProps = MuiTableBodyProps;\n\nexport const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(function TableBody(props, ref) {\n return <MuiTableBody {...props} ref={ref} />;\n});\n"],"names":["TableBody","MuiTableBody","forwardRef","props","ref"],"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;AAEjC,SAASA,aAAaC,YAAY,QAA6C,gBAAgB;AAC/F,SAASC,UAAU,QAAQ,QAAQ;AAInC,OAAO,MAAMF,0BAAYE,WAAoD,SAASF,UAAUG,KAAK,EAAEC,GAAG;IACxG,qBAAO,KAACH;QAAc,GAAGE,KAAK;QAAEC,KAAKA;;AACvC,GAAG"}
|
package/dist/Table/TableCell.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { Box, Link, TableCell as MuiTableCell, styled, useTheme } from '@mui/material';
|
|
15
15
|
import { useEffect, useMemo, useRef } from 'react';
|
|
16
16
|
import { hasDataFieldPatterns, replaceDataFields } from '../utils/data-field-interpolation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Table/TableCell.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 {\n Box,\n Link,\n TableCell as MuiTableCell,\n TableCellProps as MuiTableCellProps,\n styled,\n useTheme,\n} from '@mui/material';\nimport { ReactElement, useEffect, useMemo, useRef } from 'react';\nimport { hasDataFieldPatterns, replaceDataFields } from '../utils/data-field-interpolation';\nimport { DataLink, TableCellAlignment, TableDensity, getTableCellLayout } from './model/table-model';\n\nconst StyledMuiTableCell = styled(MuiTableCell)(({ theme }) => ({\n padding: 0,\n backgroundColor: 'inherit',\n\n '&.MuiTableCell-head': {\n // Important to avoid scrolling behind the header showing through.\n backgroundColor: theme.palette.background.default,\n },\n '&:focus-visible': {\n outline: `solid 1px ${theme.palette.primary.main}`,\n // Move inward a little to avoid getting cut off when focusing on items\n // at the edge of the table.\n outlineOffset: '-1px',\n borderRadius: 0,\n },\n}));\n\nexport interface TableCellProps extends Omit<MuiTableCellProps, 'tabIndex' | 'align'> {\n density: TableDensity;\n defaultColumnHeight?: 'auto' | number;\n\n // These values are used to adjust the spacing for the first/last columns.\n isLastColumn: boolean;\n isFirstColumn: boolean;\n\n align?: TableCellAlignment;\n\n /**\n * Additional information to be displayed when hovering over the cell. This\n * may be the full cell value (e.g. to enable the user to see the full value\n * if it is ellipsized to fit into the space) or some other descriptive text\n * that is useful for the user.\n *\n * The hover behavior is currently managed with the `title` attribute, but this\n * may be changed to a tooltip in the future.\n */\n description?: string;\n\n /**\n * How the cell should behave related to focus.\n * - `trigger-focus`: the cell should be auto-focused when it renders.\n * - `focus-next`: the cell should have tabindex=\"0\", so that it will be\n * focused the next time someone tabs with a keyboard.\n * - `none`: the cell should have tabindex=\"-1\", so it is not focused by\n * keyboard interactions at this time.\n */\n focusState?: 'trigger-focus' | 'focus-next' | 'none';\n onFocusTrigger?: (e: React.MouseEvent<HTMLTableCellElement> | React.KeyboardEvent<HTMLTableCellElement>) => void;\n color?: string;\n backgroundColor?: string;\n dataLink?: DataLink;\n adjacentCellsValuesMap?: Record<string, string>;\n}\n\nexport function TableCell({\n children,\n density,\n variant,\n width,\n defaultColumnHeight,\n focusState = 'none',\n onFocusTrigger,\n isFirstColumn,\n isLastColumn,\n description,\n align,\n color,\n backgroundColor,\n dataLink,\n adjacentCellsValuesMap,\n ...otherProps\n}: TableCellProps): ReactElement {\n const theme = useTheme();\n const elRef = useRef<HTMLTableCellElement>();\n\n const isHeader = variant === 'head';\n\n useEffect(() => {\n if (focusState === 'trigger-focus' && elRef.current) {\n elRef.current.focus();\n }\n }, [focusState]);\n\n const handleFocus: React.FocusEventHandler<HTMLTableCellElement> = (e) => {\n // From https://zellwk.com/blog/keyboard-focusable-elements/\n const nestedFocusTarget = e.currentTarget?.querySelector<HTMLElement>(\n 'a[href], button, input, textarea, select, details,[role=\"button\"]'\n );\n if (nestedFocusTarget) {\n // If the cell has a focusable child, focus it instead. Mostly used for\n // checkbox cells, but could have other uses.\n nestedFocusTarget.focus();\n }\n };\n\n const handleInteractionFocusTrigger: TableCellProps['onFocusTrigger'] = (e) => {\n // We use `onClick` and `onKeyUp` events instead of `onFocus` because of\n // some ordering issues with when the browser calls events and how this\n // plays with the triggering of focus with keyboard interactions.\n // These report that a focus event happened, so we can adjust the current\n // tabindex and focuses to the right cell.\n onFocusTrigger?.(e);\n };\n\n const modifiedDataLink = useMemo((): DataLink | undefined => {\n if (!dataLink) return undefined;\n\n if (adjacentCellsValuesMap && hasDataFieldPatterns(dataLink.url)) {\n const { text } = replaceDataFields(dataLink.url, adjacentCellsValuesMap, { urlEncode: true });\n return { ...dataLink, url: text };\n }\n return dataLink;\n }, [dataLink, adjacentCellsValuesMap]);\n\n return (\n <StyledMuiTableCell\n {...otherProps}\n // Modify the tab index based on the currently focused cell. It's important\n // to avoid having tabindex 0 on everything because it essentially traps\n // a keyboard user in the table until they hit \"tab\" for every single\n // cell.\n tabIndex={focusState !== 'none' ? 0 : -1}\n onFocus={handleFocus}\n onClick={handleInteractionFocusTrigger}\n onKeyUp={handleInteractionFocusTrigger}\n style={{ width: width }}\n sx={{\n position: 'relative',\n borderBottom: isHeader ? `solid 1px ${theme.palette.grey[100]}` : `solid 1px ${theme.palette.grey[50]}`,\n '&:hover #original-cell': {\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex: 10,\n width: 'fit-content',\n minWidth: '100%',\n whiteSpace: 'nowrap',\n overflow: 'visible',\n backgroundColor: `${backgroundColor ?? theme.palette.background.default} !important`,\n outline: `solid 1px ${theme.palette.info.main}`,\n outlineOffset: '-1px',\n },\n }}\n ref={elRef}\n >\n <Box\n id=\"original-cell\"\n sx={{\n ...getTableCellLayout(theme, density, { isHeader, isLastColumn, isFirstColumn, defaultColumnHeight }),\n position: 'relative',\n\n // Text truncation. Currently enforced on all cells. We may control\n // this with a prop on column config in the future.\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n\n // Need to inherit from the MUI cell because this manages some ordering\n // that the `TableSortLabel` uses to determine the location of the icon\n // in headers.\n flexDirection: 'inherit',\n }}\n style={{\n backgroundColor: backgroundColor ?? 'inherit',\n color: color ?? 'inherit',\n }}\n title={description}\n aria-label={description}\n textAlign={align}\n >\n {modifiedDataLink ? (\n <Link\n href={modifiedDataLink.url}\n target={modifiedDataLink.targetBlank ? '_blank' : '_self'}\n rel={modifiedDataLink.targetBlank ? 'noopener noreferrer' : undefined}\n >\n {children}\n </Link>\n ) : (\n children\n )}\n </Box>\n </StyledMuiTableCell>\n );\n}\n"],"names":["Box","Link","TableCell","MuiTableCell","styled","useTheme","useEffect","useMemo","useRef","hasDataFieldPatterns","replaceDataFields","getTableCellLayout","StyledMuiTableCell","theme","padding","backgroundColor","palette","background","default","outline","primary","main","outlineOffset","borderRadius","children","density","variant","width","defaultColumnHeight","focusState","onFocusTrigger","isFirstColumn","isLastColumn","description","align","color","dataLink","adjacentCellsValuesMap","otherProps","elRef","isHeader","current","focus","handleFocus","e","nestedFocusTarget","currentTarget","querySelector","handleInteractionFocusTrigger","modifiedDataLink","undefined","url","text","urlEncode","tabIndex","onFocus","onClick","onKeyUp","style","sx","position","borderBottom","grey","top","left","zIndex","minWidth","whiteSpace","overflow","info","ref","id","textOverflow","flexDirection","title","aria-label","textAlign","href","target","targetBlank","rel"],"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;;AAEjC,SACEA,GAAG,EACHC,IAAI,EACJC,aAAaC,YAAY,EAEzBC,MAAM,EACNC,QAAQ,QACH,gBAAgB;AACvB,SAAuBC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AACjE,SAASC,oBAAoB,EAAEC,iBAAiB,QAAQ,oC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gBACdC,eAAe;YACjB;YACAf,OAAO;gBACL3C,iBAAiBA,mBAAmB;gBACpCoB,OAAOA,SAAS;YAClB;YACAuC,OAAOzC;YACP0C,cAAY1C;YACZ2C,WAAW1C;sBAEVe,iCACC,KAAChD;gBACC4E,MAAM5B,iBAAiBE,GAAG;gBAC1B2B,QAAQ7B,iBAAiB8B,WAAW,GAAG,WAAW;gBAClDC,KAAK/B,iBAAiB8B,WAAW,GAAG,wBAAwB7B;0BAE3D1B;iBAGHA;;;AAKV"}
|
|
1
|
+
{"version":3,"sources":["../../src/Table/TableCell.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 {\n Box,\n Link,\n TableCell as MuiTableCell,\n TableCellProps as MuiTableCellProps,\n styled,\n useTheme,\n} from '@mui/material';\nimport { ReactElement, useEffect, useMemo, useRef } from 'react';\nimport { hasDataFieldPatterns, replaceDataFields } from '../utils/data-field-interpolation';\nimport { DataLink, TableCellAlignment, TableDensity, getTableCellLayout } from './model/table-model';\n\nconst StyledMuiTableCell = styled(MuiTableCell)(({ theme }) => ({\n padding: 0,\n backgroundColor: 'inherit',\n\n '&.MuiTableCell-head': {\n // Important to avoid scrolling behind the header showing through.\n backgroundColor: theme.palette.background.default,\n },\n '&:focus-visible': {\n outline: `solid 1px ${theme.palette.primary.main}`,\n // Move inward a little to avoid getting cut off when focusing on items\n // at the edge of the table.\n outlineOffset: '-1px',\n borderRadius: 0,\n },\n}));\n\nexport interface TableCellProps extends Omit<MuiTableCellProps, 'tabIndex' | 'align'> {\n density: TableDensity;\n defaultColumnHeight?: 'auto' | number;\n\n // These values are used to adjust the spacing for the first/last columns.\n isLastColumn: boolean;\n isFirstColumn: boolean;\n\n align?: TableCellAlignment;\n\n /**\n * Additional information to be displayed when hovering over the cell. This\n * may be the full cell value (e.g. to enable the user to see the full value\n * if it is ellipsized to fit into the space) or some other descriptive text\n * that is useful for the user.\n *\n * The hover behavior is currently managed with the `title` attribute, but this\n * may be changed to a tooltip in the future.\n */\n description?: string;\n\n /**\n * How the cell should behave related to focus.\n * - `trigger-focus`: the cell should be auto-focused when it renders.\n * - `focus-next`: the cell should have tabindex=\"0\", so that it will be\n * focused the next time someone tabs with a keyboard.\n * - `none`: the cell should have tabindex=\"-1\", so it is not focused by\n * keyboard interactions at this time.\n */\n focusState?: 'trigger-focus' | 'focus-next' | 'none';\n onFocusTrigger?: (e: React.MouseEvent<HTMLTableCellElement> | React.KeyboardEvent<HTMLTableCellElement>) => void;\n color?: string;\n backgroundColor?: string;\n dataLink?: DataLink;\n adjacentCellsValuesMap?: Record<string, string>;\n}\n\nexport function TableCell({\n children,\n density,\n variant,\n width,\n defaultColumnHeight,\n focusState = 'none',\n onFocusTrigger,\n isFirstColumn,\n isLastColumn,\n description,\n align,\n color,\n backgroundColor,\n dataLink,\n adjacentCellsValuesMap,\n ...otherProps\n}: TableCellProps): ReactElement {\n const theme = useTheme();\n const elRef = useRef<HTMLTableCellElement>();\n\n const isHeader = variant === 'head';\n\n useEffect(() => {\n if (focusState === 'trigger-focus' && elRef.current) {\n elRef.current.focus();\n }\n }, [focusState]);\n\n const handleFocus: React.FocusEventHandler<HTMLTableCellElement> = (e) => {\n // From https://zellwk.com/blog/keyboard-focusable-elements/\n const nestedFocusTarget = e.currentTarget?.querySelector<HTMLElement>(\n 'a[href], button, input, textarea, select, details,[role=\"button\"]'\n );\n if (nestedFocusTarget) {\n // If the cell has a focusable child, focus it instead. Mostly used for\n // checkbox cells, but could have other uses.\n nestedFocusTarget.focus();\n }\n };\n\n const handleInteractionFocusTrigger: TableCellProps['onFocusTrigger'] = (e) => {\n // We use `onClick` and `onKeyUp` events instead of `onFocus` because of\n // some ordering issues with when the browser calls events and how this\n // plays with the triggering of focus with keyboard interactions.\n // These report that a focus event happened, so we can adjust the current\n // tabindex and focuses to the right cell.\n onFocusTrigger?.(e);\n };\n\n const modifiedDataLink = useMemo((): DataLink | undefined => {\n if (!dataLink) return undefined;\n\n if (adjacentCellsValuesMap && hasDataFieldPatterns(dataLink.url)) {\n const { text } = replaceDataFields(dataLink.url, adjacentCellsValuesMap, { urlEncode: true });\n return { ...dataLink, url: text };\n }\n return dataLink;\n }, [dataLink, adjacentCellsValuesMap]);\n\n return (\n <StyledMuiTableCell\n {...otherProps}\n // Modify the tab index based on the currently focused cell. It's important\n // to avoid having tabindex 0 on everything because it essentially traps\n // a keyboard user in the table until they hit \"tab\" for every single\n // cell.\n tabIndex={focusState !== 'none' ? 0 : -1}\n onFocus={handleFocus}\n onClick={handleInteractionFocusTrigger}\n onKeyUp={handleInteractionFocusTrigger}\n style={{ width: width }}\n sx={{\n position: 'relative',\n borderBottom: isHeader ? `solid 1px ${theme.palette.grey[100]}` : `solid 1px ${theme.palette.grey[50]}`,\n '&:hover #original-cell': {\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex: 10,\n width: 'fit-content',\n minWidth: '100%',\n whiteSpace: 'nowrap',\n overflow: 'visible',\n backgroundColor: `${backgroundColor ?? theme.palette.background.default} !important`,\n outline: `solid 1px ${theme.palette.info.main}`,\n outlineOffset: '-1px',\n },\n }}\n ref={elRef}\n >\n <Box\n id=\"original-cell\"\n sx={{\n ...getTableCellLayout(theme, density, { isHeader, isLastColumn, isFirstColumn, defaultColumnHeight }),\n position: 'relative',\n\n // Text truncation. Currently enforced on all cells. We may control\n // this with a prop on column config in the future.\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n\n // Need to inherit from the MUI cell because this manages some ordering\n // that the `TableSortLabel` uses to determine the location of the icon\n // in headers.\n flexDirection: 'inherit',\n }}\n style={{\n backgroundColor: backgroundColor ?? 'inherit',\n color: color ?? 'inherit',\n }}\n title={description}\n aria-label={description}\n textAlign={align}\n >\n {modifiedDataLink ? (\n <Link\n href={modifiedDataLink.url}\n target={modifiedDataLink.targetBlank ? '_blank' : '_self'}\n rel={modifiedDataLink.targetBlank ? 'noopener noreferrer' : undefined}\n >\n {children}\n </Link>\n ) : (\n children\n )}\n </Box>\n </StyledMuiTableCell>\n );\n}\n"],"names":["Box","Link","TableCell","MuiTableCell","styled","useTheme","useEffect","useMemo","useRef","hasDataFieldPatterns","replaceDataFields","getTableCellLayout","StyledMuiTableCell","theme","padding","backgroundColor","palette","background","default","outline","primary","main","outlineOffset","borderRadius","children","density","variant","width","defaultColumnHeight","focusState","onFocusTrigger","isFirstColumn","isLastColumn","description","align","color","dataLink","adjacentCellsValuesMap","otherProps","elRef","isHeader","current","focus","handleFocus","e","nestedFocusTarget","currentTarget","querySelector","handleInteractionFocusTrigger","modifiedDataLink","undefined","url","text","urlEncode","tabIndex","onFocus","onClick","onKeyUp","style","sx","position","borderBottom","grey","top","left","zIndex","minWidth","whiteSpace","overflow","info","ref","id","textOverflow","flexDirection","title","aria-label","textAlign","href","target","targetBlank","rel"],"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;AAEjC,SACEA,GAAG,EACHC,IAAI,EACJC,aAAaC,YAAY,EAEzBC,MAAM,EACNC,QAAQ,QACH,gBAAgB;AACvB,SAAuBC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AACjE,SAASC,oBAAoB,EAAEC,iBAAiB,QAAQ,oCAAoC;AAC5F,SAAqDC,kBAAkB,QAAQ,sBAAsB;AAErG,MAAMC,qBAAqBR,OAAOD,cAAc,CAAC,EAAEU,KAAK,EAAE,GAAM,CAAA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YACZ2C,WAAW1C;sBAEVe,iCACC,KAAChD;gBACC4E,MAAM5B,iBAAiBE,GAAG;gBAC1B2B,QAAQ7B,iBAAiB8B,WAAW,GAAG,WAAW;gBAClDC,KAAK/B,iBAAiB8B,WAAW,GAAG,wBAAwB7B;0BAE3D1B;iBAGHA;;;AAKV"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { Checkbox, alpha } from '@mui/material';
|
|
15
15
|
export function TableCheckbox({ color, density, ...otherProps }) {
|
|
16
16
|
const isCompact = density === 'compact';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Table/TableCheckbox.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 { Checkbox, CheckboxProps, alpha } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { TableDensity } from './model/table-model';\n\nexport interface TableCheckboxProps extends Pick<CheckboxProps, 'checked' | 'indeterminate' | 'onChange'> {\n color?: string;\n density: TableDensity;\n}\n\nexport function TableCheckbox({ color, density, ...otherProps }: TableCheckboxProps): ReactElement {\n const isCompact = density === 'compact';\n\n return (\n <Checkbox\n size={isCompact ? 'small' : 'medium'}\n {...otherProps}\n // Disable ripple and set background color below because of some issues\n // with re-rendering with the keyboard interactions that causes the ripple\n // animation to stutter.\n focusRipple={false}\n // Tab index is handled by the overall keyboard interactions for the table\n // to avoid trapping a keyboard user in a table by requiring them to tab\n // through every single checkbox.\n tabIndex={-1}\n sx={{\n color: color,\n\n padding: (theme) => theme.spacing(isCompact ? 0.25 : 0.5),\n\n // Centering.\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n\n '&.Mui-checked': {\n color: color,\n },\n\n '&.Mui-focusVisible': {\n background: color ? alpha(color, 0.5) : undefined,\n },\n\n '& .MuiSvgIcon-root': { fontSize: isCompact ? 16 : 18 },\n }}\n />\n );\n}\n"],"names":["Checkbox","alpha","TableCheckbox","color","density","otherProps","isCompact","size","focusRipple","tabIndex","sx","padding","theme","spacing","position","top","left","transform","background","undefined","fontSize"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/Table/TableCheckbox.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 { Checkbox, CheckboxProps, alpha } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { TableDensity } from './model/table-model';\n\nexport interface TableCheckboxProps extends Pick<CheckboxProps, 'checked' | 'indeterminate' | 'onChange'> {\n color?: string;\n density: TableDensity;\n}\n\nexport function TableCheckbox({ color, density, ...otherProps }: TableCheckboxProps): ReactElement {\n const isCompact = density === 'compact';\n\n return (\n <Checkbox\n size={isCompact ? 'small' : 'medium'}\n {...otherProps}\n // Disable ripple and set background color below because of some issues\n // with re-rendering with the keyboard interactions that causes the ripple\n // animation to stutter.\n focusRipple={false}\n // Tab index is handled by the overall keyboard interactions for the table\n // to avoid trapping a keyboard user in a table by requiring them to tab\n // through every single checkbox.\n tabIndex={-1}\n sx={{\n color: color,\n\n padding: (theme) => theme.spacing(isCompact ? 0.25 : 0.5),\n\n // Centering.\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n\n '&.Mui-checked': {\n color: color,\n },\n\n '&.Mui-focusVisible': {\n background: color ? alpha(color, 0.5) : undefined,\n },\n\n '& .MuiSvgIcon-root': { fontSize: isCompact ? 16 : 18 },\n }}\n />\n );\n}\n"],"names":["Checkbox","alpha","TableCheckbox","color","density","otherProps","isCompact","size","focusRipple","tabIndex","sx","padding","theme","spacing","position","top","left","transform","background","undefined","fontSize"],"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;AAEjC,SAASA,QAAQ,EAAiBC,KAAK,QAAQ,gBAAgB;AAS/D,OAAO,SAASC,cAAc,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGC,YAAgC;IACjF,MAAMC,YAAYF,YAAY;IAE9B,qBACE,KAACJ;QACCO,MAAMD,YAAY,UAAU;QAC3B,GAAGD,UAAU;QACd,uEAAuE;QACvE,0EAA0E;QAC1E,wBAAwB;QACxBG,aAAa;QACb,0EAA0E;QAC1E,wEAAwE;QACxE,iCAAiC;QACjCC,UAAU,CAAC;QACXC,IAAI;YACFP,OAAOA;YAEPQ,SAAS,CAACC,QAAUA,MAAMC,OAAO,CAACP,YAAY,OAAO;YAErD,aAAa;YACbQ,UAAU;YACVC,KAAK;YACLC,MAAM;YACNC,WAAW;YAEX,iBAAiB;gBACfd,OAAOA;YACT;YAEA,sBAAsB;gBACpBe,YAAYf,QAAQF,MAAME,OAAO,OAAOgB;YAC1C;YAEA,sBAAsB;gBAAEC,UAAUd,YAAY,KAAK;YAAG;QACxD;;AAGN"}
|
package/dist/Table/TableFoot.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { TableFooter as MuiTableFooter } from '@mui/material';
|
|
15
15
|
import { forwardRef } from 'react';
|
|
16
16
|
export const TableFoot = /*#__PURE__*/ forwardRef(function TableFoot(props, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Table/TableFoot.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 { TableFooter as MuiTableFooter, TableFooterProps as MuiTableFooterProps } from '@mui/material';\nimport { forwardRef } from 'react';\n\nexport const TableFoot = forwardRef<HTMLTableSectionElement, MuiTableFooterProps>(function TableFoot(props, ref) {\n return <MuiTableFooter {...props} ref={ref} />;\n});\n"],"names":["TableFooter","MuiTableFooter","forwardRef","TableFoot","props","ref"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/Table/TableFoot.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 { TableFooter as MuiTableFooter, TableFooterProps as MuiTableFooterProps } from '@mui/material';\nimport { forwardRef } from 'react';\n\nexport const TableFoot = forwardRef<HTMLTableSectionElement, MuiTableFooterProps>(function TableFoot(props, ref) {\n return <MuiTableFooter {...props} ref={ref} />;\n});\n"],"names":["TableFooter","MuiTableFooter","forwardRef","TableFoot","props","ref"],"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;AAEjC,SAASA,eAAeC,cAAc,QAAiD,gBAAgB;AACvG,SAASC,UAAU,QAAQ,QAAQ;AAEnC,OAAO,MAAMC,0BAAYD,WAAyD,SAASC,UAAUC,KAAK,EAAEC,GAAG;IAC7G,qBAAO,KAACJ;QAAgB,GAAGG,KAAK;QAAEC,KAAKA;;AACzC,GAAG"}
|
package/dist/Table/TableHead.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { TableHead as MuiTableHead } from '@mui/material';
|
|
15
15
|
import { forwardRef } from 'react';
|
|
16
16
|
export const TableHead = /*#__PURE__*/ forwardRef(function TableHead(props, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Table/TableHead.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 { TableHead as MuiTableHead, TableHeadProps as MuiTableHeadProps } from '@mui/material';\nimport { forwardRef } from 'react';\n\ntype TableHeadProps = MuiTableHeadProps;\n\nexport const TableHead = forwardRef<HTMLTableSectionElement, TableHeadProps>(function TableHead(props, ref) {\n return <MuiTableHead {...props} ref={ref} />;\n});\n"],"names":["TableHead","MuiTableHead","forwardRef","props","ref"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/Table/TableHead.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 { TableHead as MuiTableHead, TableHeadProps as MuiTableHeadProps } from '@mui/material';\nimport { forwardRef } from 'react';\n\ntype TableHeadProps = MuiTableHeadProps;\n\nexport const TableHead = forwardRef<HTMLTableSectionElement, TableHeadProps>(function TableHead(props, ref) {\n return <MuiTableHead {...props} ref={ref} />;\n});\n"],"names":["TableHead","MuiTableHead","forwardRef","props","ref"],"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;AAEjC,SAASA,aAAaC,YAAY,QAA6C,gBAAgB;AAC/F,SAASC,UAAU,QAAQ,QAAQ;AAInC,OAAO,MAAMF,0BAAYE,WAAoD,SAASF,UAAUG,KAAK,EAAEC,GAAG;IACxG,qBAAO,KAACH;QAAc,GAAGE,KAAK;QAAEC,KAAKA;;AACvC,GAAG"}
|
|
@@ -18,6 +18,25 @@ export interface TableHeaderCellProps extends TableCellProps {
|
|
|
18
18
|
* unsorted.)
|
|
19
19
|
*/
|
|
20
20
|
nextSortDirection?: SortDirection;
|
|
21
|
+
/**
|
|
22
|
+
* Configuration for column resizing interactions.
|
|
23
|
+
* When included, the header will include a resize handle (divider).
|
|
24
|
+
*/
|
|
25
|
+
resizeConfig?: ResizeConfig;
|
|
26
|
+
}
|
|
27
|
+
export interface ResizeConfig {
|
|
28
|
+
/**
|
|
29
|
+
* Handler called when a column resize event is triggered.
|
|
30
|
+
*/
|
|
31
|
+
resizeHandler: (event: unknown) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Handler called when a column reset size event is triggered (double-click on the resize handle).
|
|
34
|
+
*/
|
|
35
|
+
resetSizeHandler: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Indicates whether the column is currently being resized.
|
|
38
|
+
*/
|
|
39
|
+
isResizing: boolean;
|
|
21
40
|
}
|
|
22
|
-
export declare function TableHeaderCell({ onSort, sortDirection, nextSortDirection, children, ...cellProps }: TableHeaderCellProps): ReactElement;
|
|
41
|
+
export declare function TableHeaderCell({ onSort, sortDirection, nextSortDirection, children, resizeConfig, ...cellProps }: TableHeaderCellProps): ReactElement;
|
|
23
42
|
//# sourceMappingURL=TableHeaderCell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableHeaderCell.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAa,cAAc,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAEhD;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"TableHeaderCell.d.ts","sourceRoot":"","sources":["../../src/Table/TableHeaderCell.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAa,cAAc,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAEhD;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,aAAa,CAAC;IAElC;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC;;OAEG;IACH,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAE7B;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,GAAG,SAAS,EACb,EAAE,oBAAoB,GAAG,YAAY,CA6ErC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,10 +11,9 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import {
|
|
14
|
-
import { TableSortLabel, Typography, tableSortLabelClasses } from '@mui/material';
|
|
14
|
+
import { TableSortLabel, Typography, tableSortLabelClasses, Box, Divider } from '@mui/material';
|
|
15
15
|
import { TableCell } from './TableCell';
|
|
16
|
-
export function TableHeaderCell({ onSort, sortDirection, nextSortDirection, children, ...cellProps }) {
|
|
16
|
+
export function TableHeaderCell({ onSort, sortDirection, nextSortDirection, children, resizeConfig, ...cellProps }) {
|
|
17
17
|
const showSortLabel = !!onSort;
|
|
18
18
|
const headerText = /*#__PURE__*/ _jsx(Typography, {
|
|
19
19
|
noWrap: true,
|
|
@@ -24,29 +24,61 @@ export function TableHeaderCell({ onSort, sortDirection, nextSortDirection, chil
|
|
|
24
24
|
});
|
|
25
25
|
const isActive = !!sortDirection;
|
|
26
26
|
const direction = isActive ? sortDirection : nextSortDirection;
|
|
27
|
-
return /*#__PURE__*/
|
|
27
|
+
return /*#__PURE__*/ _jsxs(TableCell, {
|
|
28
28
|
...cellProps,
|
|
29
|
-
children:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
children: [
|
|
30
|
+
showSortLabel ? /*#__PURE__*/ _jsx(TableSortLabel, {
|
|
31
|
+
onClick: onSort,
|
|
32
|
+
direction: direction,
|
|
33
|
+
active: isActive,
|
|
34
|
+
sx: {
|
|
35
|
+
// Overrides a default vertical alignment in the CSS that changes
|
|
36
|
+
// the header vertical rhythm in a way that's inconsistent with
|
|
37
|
+
// non-sorting headers.
|
|
38
|
+
verticalAlign: 'unset',
|
|
39
|
+
// Makes it possible to ellipsize the text if it's too long.
|
|
40
|
+
maxWidth: '100%',
|
|
41
|
+
// Make the arrow visible when focused using the keyboard to assist
|
|
42
|
+
// with a11y.
|
|
43
|
+
'&:focus-visible': {
|
|
44
|
+
[`& .${tableSortLabelClasses.icon}`]: {
|
|
45
|
+
opacity: isActive ? 1 : 0.5
|
|
46
|
+
}
|
|
45
47
|
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
},
|
|
49
|
+
children: headerText
|
|
50
|
+
}) : headerText,
|
|
51
|
+
resizeConfig && /*#__PURE__*/ _jsx(Box, {
|
|
52
|
+
onMouseDown: (e)=>{
|
|
53
|
+
if (e.detail === 2) {
|
|
54
|
+
resizeConfig.resetSizeHandler();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
resizeConfig.resizeHandler(e);
|
|
58
|
+
},
|
|
59
|
+
onTouchStart: resizeConfig.resizeHandler,
|
|
60
|
+
sx: {
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
height: '100%',
|
|
63
|
+
top: 0,
|
|
64
|
+
right: '4px',
|
|
65
|
+
cursor: 'col-resize'
|
|
66
|
+
},
|
|
67
|
+
children: /*#__PURE__*/ _jsx(Divider, {
|
|
68
|
+
flexItem: true,
|
|
69
|
+
orientation: "vertical",
|
|
70
|
+
sx: (theme)=>({
|
|
71
|
+
backgroundColor: resizeConfig.isResizing ? theme.palette.action.active : theme.palette.divider,
|
|
72
|
+
borderRadius: '2px',
|
|
73
|
+
borderWidth: '2px',
|
|
74
|
+
height: '100%',
|
|
75
|
+
touchAction: 'none',
|
|
76
|
+
transform: 'translateX(4px)',
|
|
77
|
+
userSelect: 'none'
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
]
|
|
50
82
|
});
|
|
51
83
|
}
|
|
52
84
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Table/TableHeaderCell.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 { TableSortLabel, Typography, tableSortLabelClasses } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { TableCell, TableCellProps } from './TableCell';\nimport { SortDirection } from './model/table-model';\n\nexport interface TableHeaderCellProps extends TableCellProps {\n /**\n * Handler called when a sort event is triggered.\n * When specified, the header will include sorting interactions and indicators.\n */\n onSort?: ((event: unknown) => void) | undefined;\n\n /**\n * The current direction the header is sorted.\n */\n sortDirection?: SortDirection;\n\n /**\n * The next direction the header will be sorted when another sort action\n * is triggered via click/keyboard. This impacts some UI interactions (e.g.\n * the direction of the sort arrow on hover f the column is currently\n * unsorted.)\n */\n nextSortDirection?: SortDirection;\n}\n\nexport function TableHeaderCell({\n onSort,\n sortDirection,\n nextSortDirection,\n children,\n ...cellProps\n}: TableHeaderCellProps): ReactElement {\n const showSortLabel = !!onSort;\n\n const headerText = (\n <Typography noWrap variant=\"inherit\" component=\"div\" color=\"inherit\">\n {children}\n </Typography>\n );\n\n const isActive = !!sortDirection;\n const direction = isActive ? sortDirection : nextSortDirection;\n\n return (\n <TableCell {...cellProps}>\n {showSortLabel ? (\n <TableSortLabel\n onClick={onSort}\n direction={direction}\n active={isActive}\n sx={{\n // Overrides a default vertical alignment in the CSS that changes\n // the header vertical rhythm in a way that's inconsistent with\n // non-sorting headers.\n verticalAlign: 'unset',\n\n // Makes it possible to ellipsize the text if it's too long.\n maxWidth: '100%',\n\n // Make the arrow visible when focused using the keyboard to assist\n // with a11y.\n '&:focus-visible': {\n [`& .${tableSortLabelClasses.icon}`]: {\n opacity: isActive ? 1 : 0.5,\n },\n },\n }}\n >\n {headerText}\n </TableSortLabel>\n ) : (\n headerText\n )}\n </TableCell>\n );\n}\n"],"names":["TableSortLabel","Typography","tableSortLabelClasses","TableCell","TableHeaderCell","onSort","sortDirection","nextSortDirection","children","cellProps","showSortLabel","headerText","noWrap","variant","component","color","isActive","direction","onClick","active","sx","verticalAlign","maxWidth","icon","opacity"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/Table/TableHeaderCell.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 { TableSortLabel, Typography, tableSortLabelClasses, Box, Divider } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { TableCell, TableCellProps } from './TableCell';\nimport { SortDirection } from './model/table-model';\n\nexport interface TableHeaderCellProps extends TableCellProps {\n /**\n * Handler called when a sort event is triggered.\n * When specified, the header will include sorting interactions and indicators.\n */\n onSort?: ((event: unknown) => void) | undefined;\n\n /**\n * The current direction the header is sorted.\n */\n sortDirection?: SortDirection;\n\n /**\n * The next direction the header will be sorted when another sort action\n * is triggered via click/keyboard. This impacts some UI interactions (e.g.\n * the direction of the sort arrow on hover f the column is currently\n * unsorted.)\n */\n nextSortDirection?: SortDirection;\n\n /**\n * Configuration for column resizing interactions.\n * When included, the header will include a resize handle (divider).\n */\n resizeConfig?: ResizeConfig;\n}\n\nexport interface ResizeConfig {\n /**\n * Handler called when a column resize event is triggered.\n */\n resizeHandler: (event: unknown) => void;\n /**\n * Handler called when a column reset size event is triggered (double-click on the resize handle).\n */\n resetSizeHandler: () => void;\n\n /**\n * Indicates whether the column is currently being resized.\n */\n isResizing: boolean;\n}\n\nexport function TableHeaderCell({\n onSort,\n sortDirection,\n nextSortDirection,\n children,\n resizeConfig,\n ...cellProps\n}: TableHeaderCellProps): ReactElement {\n const showSortLabel = !!onSort;\n\n const headerText = (\n <Typography noWrap variant=\"inherit\" component=\"div\" color=\"inherit\">\n {children}\n </Typography>\n );\n\n const isActive = !!sortDirection;\n const direction = isActive ? sortDirection : nextSortDirection;\n\n return (\n <TableCell {...cellProps}>\n {showSortLabel ? (\n <TableSortLabel\n onClick={onSort}\n direction={direction}\n active={isActive}\n sx={{\n // Overrides a default vertical alignment in the CSS that changes\n // the header vertical rhythm in a way that's inconsistent with\n // non-sorting headers.\n verticalAlign: 'unset',\n\n // Makes it possible to ellipsize the text if it's too long.\n maxWidth: '100%',\n\n // Make the arrow visible when focused using the keyboard to assist\n // with a11y.\n '&:focus-visible': {\n [`& .${tableSortLabelClasses.icon}`]: {\n opacity: isActive ? 1 : 0.5,\n },\n },\n }}\n >\n {headerText}\n </TableSortLabel>\n ) : (\n headerText\n )}\n {resizeConfig && (\n <Box\n onMouseDown={(e) => {\n if (e.detail === 2) {\n resizeConfig.resetSizeHandler();\n return;\n }\n resizeConfig.resizeHandler(e);\n }}\n onTouchStart={resizeConfig.resizeHandler}\n sx={{\n position: 'absolute',\n height: '100%',\n top: 0,\n right: '4px',\n cursor: 'col-resize',\n }}\n >\n <Divider\n flexItem\n orientation=\"vertical\"\n sx={(theme) => ({\n backgroundColor: resizeConfig.isResizing ? theme.palette.action.active : theme.palette.divider,\n borderRadius: '2px',\n borderWidth: '2px',\n height: '100%',\n touchAction: 'none',\n transform: 'translateX(4px)',\n userSelect: 'none',\n })}\n />\n </Box>\n )}\n </TableCell>\n );\n}\n"],"names":["TableSortLabel","Typography","tableSortLabelClasses","Box","Divider","TableCell","TableHeaderCell","onSort","sortDirection","nextSortDirection","children","resizeConfig","cellProps","showSortLabel","headerText","noWrap","variant","component","color","isActive","direction","onClick","active","sx","verticalAlign","maxWidth","icon","opacity","onMouseDown","e","detail","resetSizeHandler","resizeHandler","onTouchStart","position","height","top","right","cursor","flexItem","orientation","theme","backgroundColor","isResizing","palette","action","divider","borderRadius","borderWidth","touchAction","transform","userSelect"],"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;AAEjC,SAASA,cAAc,EAAEC,UAAU,EAAEC,qBAAqB,EAAEC,GAAG,EAAEC,OAAO,QAAQ,gBAAgB;AAEhG,SAASC,SAAS,QAAwB,cAAc;AA8CxD,OAAO,SAASC,gBAAgB,EAC9BC,MAAM,EACNC,aAAa,EACbC,iBAAiB,EACjBC,QAAQ,EACRC,YAAY,EACZ,GAAGC,WACkB;IACrB,MAAMC,gBAAgB,CAAC,CAACN;IAExB,MAAMO,2BACJ,KAACb;QAAWc,MAAM;QAACC,SAAQ;QAAUC,WAAU;QAAMC,OAAM;kBACxDR;;IAIL,MAAMS,WAAW,CAAC,CAACX;IACnB,MAAMY,YAAYD,WAAWX,gBAAgBC;IAE7C,qBACE,MAACJ;QAAW,GAAGO,SAAS;;YACrBC,8BACC,KAACb;gBACCqB,SAASd;gBACTa,WAAWA;gBACXE,QAAQH;gBACRI,IAAI;oBACF,iEAAiE;oBACjE,+DAA+D;oBAC/D,uBAAuB;oBACvBC,eAAe;oBAEf,4DAA4D;oBAC5DC,UAAU;oBAEV,mEAAmE;oBACnE,aAAa;oBACb,mBAAmB;wBACjB,CAAC,CAAC,GAAG,EAAEvB,sBAAsBwB,IAAI,EAAE,CAAC,EAAE;4BACpCC,SAASR,WAAW,IAAI;wBAC1B;oBACF;gBACF;0BAECL;iBAGHA;YAEDH,8BACC,KAACR;gBACCyB,aAAa,CAACC;oBACZ,IAAIA,EAAEC,MAAM,KAAK,GAAG;wBAClBnB,aAAaoB,gBAAgB;wBAC7B;oBACF;oBACApB,aAAaqB,aAAa,CAACH;gBAC7B;gBACAI,cAActB,aAAaqB,aAAa;gBACxCT,IAAI;oBACFW,UAAU;oBACVC,QAAQ;oBACRC,KAAK;oBACLC,OAAO;oBACPC,QAAQ;gBACV;0BAEA,cAAA,KAAClC;oBACCmC,QAAQ;oBACRC,aAAY;oBACZjB,IAAI,CAACkB,QAAW,CAAA;4BACdC,iBAAiB/B,aAAagC,UAAU,GAAGF,MAAMG,OAAO,CAACC,MAAM,CAACvB,MAAM,GAAGmB,MAAMG,OAAO,CAACE,OAAO;4BAC9FC,cAAc;4BACdC,aAAa;4BACbb,QAAQ;4BACRc,aAAa;4BACbC,WAAW;4BACXC,YAAY;wBACd,CAAA;;;;;AAMZ"}
|
package/dist/Table/TableRow.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { TableRow as MuiTableRow, alpha } from '@mui/material';
|
|
15
15
|
import { forwardRef } from 'react';
|
|
16
16
|
export const TableRow = /*#__PURE__*/ forwardRef(function TableRow(props, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Table/TableRow.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 { TableRow as MuiTableRow, TableRowProps as MuiTableRowProps, alpha } from '@mui/material';\nimport { forwardRef } from 'react';\nimport { TableDensity } from './model/table-model';\n\ninterface TableRowProps extends MuiTableRowProps<'div'> {\n density: TableDensity;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(props, ref) {\n return (\n <MuiTableRow\n {...props}\n ref={ref}\n sx={{\n backgroundColor: (theme) => theme.palette.background.default,\n '&:hover': {\n backgroundColor: (theme) => alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),\n },\n }}\n />\n );\n});\n"],"names":["TableRow","MuiTableRow","alpha","forwardRef","props","ref","sx","backgroundColor","theme","palette","background","default","primary","main","action","hoverOpacity"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/Table/TableRow.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 { TableRow as MuiTableRow, TableRowProps as MuiTableRowProps, alpha } from '@mui/material';\nimport { forwardRef } from 'react';\nimport { TableDensity } from './model/table-model';\n\ninterface TableRowProps extends MuiTableRowProps<'div'> {\n density: TableDensity;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(props, ref) {\n return (\n <MuiTableRow\n {...props}\n ref={ref}\n sx={{\n backgroundColor: (theme) => theme.palette.background.default,\n '&:hover': {\n backgroundColor: (theme) => alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),\n },\n }}\n />\n );\n});\n"],"names":["TableRow","MuiTableRow","alpha","forwardRef","props","ref","sx","backgroundColor","theme","palette","background","default","primary","main","action","hoverOpacity"],"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;AAEjC,SAASA,YAAYC,WAAW,EAAqCC,KAAK,QAAQ,gBAAgB;AAClG,SAASC,UAAU,QAAQ,QAAQ;AAOnC,OAAO,MAAMH,yBAAWG,WAA+C,SAASH,SAASI,KAAK,EAAEC,GAAG;IACjG,qBACE,KAACJ;QACE,GAAGG,KAAK;QACTC,KAAKA;QACLC,IAAI;YACFC,iBAAiB,CAACC,QAAUA,MAAMC,OAAO,CAACC,UAAU,CAACC,OAAO;YAC5D,WAAW;gBACTJ,iBAAiB,CAACC,QAAUN,MAAMM,MAAMC,OAAO,CAACG,OAAO,CAACC,IAAI,EAAEL,MAAMC,OAAO,CAACK,MAAM,CAACC,YAAY;YACjG;QACF;;AAGN,GAAG"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Column } from '@tanstack/react-table';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
export interface TableToolbarProps<TableData> {
|
|
4
|
+
/**
|
|
5
|
+
* When `true`, a search input is rendered.
|
|
6
|
+
*/
|
|
7
|
+
isSearchEnabled?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Current value of the global filter / search query.
|
|
10
|
+
*/
|
|
11
|
+
globalFilter: string;
|
|
12
|
+
/**
|
|
13
|
+
* Callback fired when the search query changes.
|
|
14
|
+
*/
|
|
15
|
+
onGlobalFilterChange: (value: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* When `true`, a "Columns" button is rendered that opens a column visibility dropdown.
|
|
18
|
+
*/
|
|
19
|
+
isColumnFilterEnabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* All columns from the table instance, used to build the visibility menu.
|
|
22
|
+
*/
|
|
23
|
+
columns: Array<Column<TableData>>;
|
|
24
|
+
/**
|
|
25
|
+
* The width of the toolbar, used to determine when to switch to a more compact layout.
|
|
26
|
+
*/
|
|
27
|
+
width: number | string;
|
|
28
|
+
/**
|
|
29
|
+
* Max height for the column filter menu.
|
|
30
|
+
*/
|
|
31
|
+
columnFilterMenuMaxHeight?: number | string;
|
|
32
|
+
/**
|
|
33
|
+
* When `true`, an "Expand All" / "Collapse All" toggle button is rendered.
|
|
34
|
+
*/
|
|
35
|
+
isExpandAllEnabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether all rows are currently expanded.
|
|
38
|
+
*/
|
|
39
|
+
isAllExpanded?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Callback to toggle expand/collapse all rows.
|
|
42
|
+
*/
|
|
43
|
+
onExpandAllChange?: (event: unknown) => void;
|
|
44
|
+
}
|
|
45
|
+
export declare function TableToolbar<TableData>({ isSearchEnabled, globalFilter, onGlobalFilterChange, isColumnFilterEnabled, columns, width, columnFilterMenuMaxHeight, isExpandAllEnabled, isAllExpanded, onExpandAllChange, }: TableToolbarProps<TableData>): ReactElement | null;
|
|
46
|
+
//# sourceMappingURL=TableToolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableToolbar.d.ts","sourceRoot":"","sources":["../../src/Table/TableToolbar.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAyB,MAAM,OAAO,CAAC;AAQ5D,MAAM,WAAW,iBAAiB,CAAC,SAAS;IAC1C;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9C;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5C;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,EACtC,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,EACP,KAAK,EACL,yBAA+B,EAC/B,kBAAkB,EAClB,aAAa,EACb,iBAAiB,GAClB,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,YAAY,GAAG,IAAI,CAyGpD"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// Copyright The Perses Authors
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { Checkbox, IconButton, InputAdornment, ListItemText, Menu, MenuItem, Stack, Tooltip } from '@mui/material';
|
|
15
|
+
import { useCallback, useState } from 'react';
|
|
16
|
+
import Magnify from 'mdi-material-ui/Magnify';
|
|
17
|
+
import Close from 'mdi-material-ui/Close';
|
|
18
|
+
import ViewColumn from 'mdi-material-ui/ViewColumn';
|
|
19
|
+
import UnfoldMore from 'mdi-material-ui/UnfoldMoreHorizontal';
|
|
20
|
+
import UnfoldLess from 'mdi-material-ui/UnfoldLessHorizontal';
|
|
21
|
+
import { TextField } from '../controls';
|
|
22
|
+
export function TableToolbar({ isSearchEnabled, globalFilter, onGlobalFilterChange, isColumnFilterEnabled, columns, width, columnFilterMenuMaxHeight = 400, isExpandAllEnabled, isAllExpanded, onExpandAllChange }) {
|
|
23
|
+
const [colMenuAnchor, setColMenuAnchor] = useState(null);
|
|
24
|
+
const colMenuOpen = Boolean(colMenuAnchor);
|
|
25
|
+
const [searchResetKey, setSearchResetKey] = useState(0);
|
|
26
|
+
const handleSearchClear = useCallback(()=>{
|
|
27
|
+
onGlobalFilterChange('');
|
|
28
|
+
setSearchResetKey((prev)=>prev + 1);
|
|
29
|
+
}, [
|
|
30
|
+
onGlobalFilterChange
|
|
31
|
+
]);
|
|
32
|
+
if (!isSearchEnabled && !isColumnFilterEnabled && !isExpandAllEnabled) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
36
|
+
direction: "row",
|
|
37
|
+
gap: 1,
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
justifyContent: "flex-end",
|
|
40
|
+
width: width,
|
|
41
|
+
padding: "0.5rem",
|
|
42
|
+
sx: {
|
|
43
|
+
backgroundColor: (theme)=>theme.palette.background.default
|
|
44
|
+
},
|
|
45
|
+
children: [
|
|
46
|
+
isSearchEnabled && /*#__PURE__*/ _jsx(TextField, {
|
|
47
|
+
placeholder: "Search...",
|
|
48
|
+
value: globalFilter,
|
|
49
|
+
onChange: onGlobalFilterChange,
|
|
50
|
+
variant: "standard",
|
|
51
|
+
slotProps: {
|
|
52
|
+
htmlInput: {
|
|
53
|
+
'aria-label': 'search table'
|
|
54
|
+
},
|
|
55
|
+
input: {
|
|
56
|
+
startAdornment: /*#__PURE__*/ _jsx(InputAdornment, {
|
|
57
|
+
position: "start",
|
|
58
|
+
children: /*#__PURE__*/ _jsx(Magnify, {
|
|
59
|
+
fontSize: "small"
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
endAdornment: globalFilter !== '' && /*#__PURE__*/ _jsx(InputAdornment, {
|
|
63
|
+
position: "end",
|
|
64
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
65
|
+
onClick: handleSearchClear,
|
|
66
|
+
children: /*#__PURE__*/ _jsx(Close, {
|
|
67
|
+
fontSize: "small"
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
sx: {
|
|
74
|
+
flexGrow: 1
|
|
75
|
+
}
|
|
76
|
+
}, searchResetKey),
|
|
77
|
+
isExpandAllEnabled && /*#__PURE__*/ _jsx(Tooltip, {
|
|
78
|
+
title: isAllExpanded ? 'Collapse all' : 'Expand all',
|
|
79
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
80
|
+
onClick: onExpandAllChange,
|
|
81
|
+
color: "info",
|
|
82
|
+
"aria-label": isAllExpanded ? 'collapse all rows' : 'expand all rows',
|
|
83
|
+
children: isAllExpanded ? /*#__PURE__*/ _jsx(UnfoldLess, {}) : /*#__PURE__*/ _jsx(UnfoldMore, {})
|
|
84
|
+
})
|
|
85
|
+
}),
|
|
86
|
+
isColumnFilterEnabled && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
87
|
+
children: [
|
|
88
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
89
|
+
onClick: (e)=>setColMenuAnchor(e.currentTarget),
|
|
90
|
+
"aria-haspopup": "listbox",
|
|
91
|
+
"aria-expanded": colMenuOpen,
|
|
92
|
+
color: "info",
|
|
93
|
+
children: /*#__PURE__*/ _jsx(ViewColumn, {})
|
|
94
|
+
}),
|
|
95
|
+
/*#__PURE__*/ _jsx(Menu, {
|
|
96
|
+
anchorEl: colMenuAnchor,
|
|
97
|
+
open: colMenuOpen,
|
|
98
|
+
onClose: ()=>setColMenuAnchor(null),
|
|
99
|
+
slotProps: {
|
|
100
|
+
list: {
|
|
101
|
+
dense: true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
sx: {
|
|
105
|
+
maxHeight: columnFilterMenuMaxHeight
|
|
106
|
+
},
|
|
107
|
+
children: columns.map((column)=>{
|
|
108
|
+
const header = column.columnDef.header;
|
|
109
|
+
const label = typeof header === 'string' ? header : column.id;
|
|
110
|
+
return /*#__PURE__*/ _jsxs(MenuItem, {
|
|
111
|
+
disabled: !column.getCanHide(),
|
|
112
|
+
onClick: column.getCanHide() ? column.getToggleVisibilityHandler() : undefined,
|
|
113
|
+
dense: true,
|
|
114
|
+
children: [
|
|
115
|
+
/*#__PURE__*/ _jsx(Checkbox, {
|
|
116
|
+
checked: column.getIsVisible(),
|
|
117
|
+
disabled: !column.getCanHide(),
|
|
118
|
+
size: "small",
|
|
119
|
+
disableRipple: true,
|
|
120
|
+
sx: {
|
|
121
|
+
p: 0,
|
|
122
|
+
mr: 1
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
/*#__PURE__*/ _jsx(ListItemText, {
|
|
126
|
+
primary: label
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
}, column.id);
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})
|
|
134
|
+
]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//# sourceMappingURL=TableToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Table/TableToolbar.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 { Checkbox, IconButton, InputAdornment, ListItemText, Menu, MenuItem, Stack, Tooltip } from '@mui/material';\nimport { Column } from '@tanstack/react-table';\nimport { ReactElement, useCallback, useState } from 'react';\nimport Magnify from 'mdi-material-ui/Magnify';\nimport Close from 'mdi-material-ui/Close';\nimport ViewColumn from 'mdi-material-ui/ViewColumn';\nimport UnfoldMore from 'mdi-material-ui/UnfoldMoreHorizontal';\nimport UnfoldLess from 'mdi-material-ui/UnfoldLessHorizontal';\nimport { TextField } from '../controls';\n\nexport interface TableToolbarProps<TableData> {\n /**\n * When `true`, a search input is rendered.\n */\n isSearchEnabled?: boolean;\n\n /**\n * Current value of the global filter / search query.\n */\n globalFilter: string;\n\n /**\n * Callback fired when the search query changes.\n */\n onGlobalFilterChange: (value: string) => void;\n\n /**\n * When `true`, a \"Columns\" button is rendered that opens a column visibility dropdown.\n */\n isColumnFilterEnabled?: boolean;\n\n /**\n * All columns from the table instance, used to build the visibility menu.\n */\n columns: Array<Column<TableData>>;\n /**\n * The width of the toolbar, used to determine when to switch to a more compact layout.\n */\n width: number | string;\n\n /**\n * Max height for the column filter menu.\n */\n columnFilterMenuMaxHeight?: number | string;\n\n /**\n * When `true`, an \"Expand All\" / \"Collapse All\" toggle button is rendered.\n */\n isExpandAllEnabled?: boolean;\n\n /**\n * Whether all rows are currently expanded.\n */\n isAllExpanded?: boolean;\n\n /**\n * Callback to toggle expand/collapse all rows.\n */\n onExpandAllChange?: (event: unknown) => void;\n}\n\nexport function TableToolbar<TableData>({\n isSearchEnabled,\n globalFilter,\n onGlobalFilterChange,\n isColumnFilterEnabled,\n columns,\n width,\n columnFilterMenuMaxHeight = 400,\n isExpandAllEnabled,\n isAllExpanded,\n onExpandAllChange,\n}: TableToolbarProps<TableData>): ReactElement | null {\n const [colMenuAnchor, setColMenuAnchor] = useState<null | HTMLElement>(null);\n const colMenuOpen = Boolean(colMenuAnchor);\n const [searchResetKey, setSearchResetKey] = useState(0);\n\n const handleSearchClear = useCallback(() => {\n onGlobalFilterChange('');\n setSearchResetKey((prev) => prev + 1);\n }, [onGlobalFilterChange]);\n\n if (!isSearchEnabled && !isColumnFilterEnabled && !isExpandAllEnabled) {\n return null;\n }\n\n return (\n <Stack\n direction=\"row\"\n gap={1}\n alignItems=\"center\"\n justifyContent=\"flex-end\"\n width={width}\n padding=\"0.5rem\"\n sx={{ backgroundColor: (theme) => theme.palette.background.default }}\n >\n {isSearchEnabled && (\n <TextField\n key={searchResetKey}\n placeholder=\"Search...\"\n value={globalFilter}\n onChange={onGlobalFilterChange}\n variant=\"standard\"\n slotProps={{\n htmlInput: { 'aria-label': 'search table' },\n input: {\n startAdornment: (\n <InputAdornment position=\"start\">\n <Magnify fontSize=\"small\" />\n </InputAdornment>\n ),\n endAdornment: globalFilter !== '' && (\n <InputAdornment position=\"end\">\n <IconButton onClick={handleSearchClear}>\n <Close fontSize=\"small\" />\n </IconButton>\n </InputAdornment>\n ),\n },\n }}\n sx={{ flexGrow: 1 }}\n />\n )}\n {isExpandAllEnabled && (\n <Tooltip title={isAllExpanded ? 'Collapse all' : 'Expand all'}>\n <IconButton\n onClick={onExpandAllChange}\n color=\"info\"\n aria-label={isAllExpanded ? 'collapse all rows' : 'expand all rows'}\n >\n {isAllExpanded ? <UnfoldLess /> : <UnfoldMore />}\n </IconButton>\n </Tooltip>\n )}\n {isColumnFilterEnabled && (\n <>\n <IconButton\n onClick={(e) => setColMenuAnchor(e.currentTarget)}\n aria-haspopup=\"listbox\"\n aria-expanded={colMenuOpen}\n color=\"info\"\n >\n <ViewColumn />\n </IconButton>\n <Menu\n anchorEl={colMenuAnchor}\n open={colMenuOpen}\n onClose={() => setColMenuAnchor(null)}\n slotProps={{ list: { dense: true } }}\n sx={{ maxHeight: columnFilterMenuMaxHeight }}\n >\n {columns.map((column) => {\n const header = column.columnDef.header;\n const label = typeof header === 'string' ? header : column.id;\n return (\n <MenuItem\n key={column.id}\n disabled={!column.getCanHide()}\n onClick={column.getCanHide() ? column.getToggleVisibilityHandler() : undefined}\n dense\n >\n <Checkbox\n checked={column.getIsVisible()}\n disabled={!column.getCanHide()}\n size=\"small\"\n disableRipple\n sx={{ p: 0, mr: 1 }}\n />\n <ListItemText primary={label} />\n </MenuItem>\n );\n })}\n </Menu>\n </>\n )}\n </Stack>\n );\n}\n"],"names":["Checkbox","IconButton","InputAdornment","ListItemText","Menu","MenuItem","Stack","Tooltip","useCallback","useState","Magnify","Close","ViewColumn","UnfoldMore","UnfoldLess","TextField","TableToolbar","isSearchEnabled","globalFilter","onGlobalFilterChange","isColumnFilterEnabled","columns","width","columnFilterMenuMaxHeight","isExpandAllEnabled","isAllExpanded","onExpandAllChange","colMenuAnchor","setColMenuAnchor","colMenuOpen","Boolean","searchResetKey","setSearchResetKey","handleSearchClear","prev","direction","gap","alignItems","justifyContent","padding","sx","backgroundColor","theme","palette","background","default","placeholder","value","onChange","variant","slotProps","htmlInput","input","startAdornment","position","fontSize","endAdornment","onClick","flexGrow","title","color","aria-label","e","currentTarget","aria-haspopup","aria-expanded","anchorEl","open","onClose","list","dense","maxHeight","map","column","header","columnDef","label","id","disabled","getCanHide","getToggleVisibilityHandler","undefined","checked","getIsVisible","size","disableRipple","p","mr","primary"],"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;AAEjC,SAASA,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
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { Column, HeaderGroup, Row } from '@tanstack/react-table';
|
|
1
|
+
import { Column, ColumnSizingInfoState, ColumnSizingState, HeaderGroup, Row } from '@tanstack/react-table';
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
|
+
import { TableToolbarProps } from './TableToolbar';
|
|
3
4
|
import { TableCellConfigs, TableProps } from './model/table-model';
|
|
4
|
-
export type VirtualizedTableProps<TableData> = Required<Pick<TableProps<TableData>, 'height' | 'width' | 'density' | '
|
|
5
|
+
export type VirtualizedTableProps<TableData> = Required<Pick<TableProps<TableData>, 'height' | 'width' | 'density' | 'defaultColumnHeight' | 'defaultColumnWidth'>> & Pick<TableProps<TableData>, 'onRowMouseOver' | 'onRowMouseOut' | 'pagination' | 'onPaginationChange'> & {
|
|
5
6
|
onRowClick: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, id: string) => void;
|
|
6
7
|
rows: Array<Row<TableData>>;
|
|
7
8
|
columns: Array<Column<TableData, unknown>>;
|
|
8
9
|
headers: Array<HeaderGroup<TableData>>;
|
|
10
|
+
columnSizing: ColumnSizingState;
|
|
11
|
+
columnSizingInfo: ColumnSizingInfoState;
|
|
9
12
|
cellConfigs?: TableCellConfigs;
|
|
10
13
|
rowCount: number;
|
|
14
|
+
toolbarConfig: Pick<TableToolbarProps<TableData>, 'isSearchEnabled' | 'globalFilter' | 'onGlobalFilterChange' | 'isColumnFilterEnabled' | 'columns' | 'columnFilterMenuMaxHeight' | 'isExpandAllEnabled' | 'isAllExpanded' | 'onExpandAllChange'>;
|
|
11
15
|
};
|
|
12
|
-
export declare function VirtualizedTable<TableData>({ width, height, density, defaultColumnWidth, defaultColumnHeight, onRowClick, onRowMouseOver, onRowMouseOut, rows, columns, headers, cellConfigs, pagination, onPaginationChange, rowCount, }: VirtualizedTableProps<TableData>): ReactElement;
|
|
16
|
+
export declare function VirtualizedTable<TableData>({ width, height, density, defaultColumnWidth, defaultColumnHeight, onRowClick, onRowMouseOver, onRowMouseOut, rows, columns, headers, columnSizing, columnSizingInfo, cellConfigs, pagination, onPaginationChange, rowCount, toolbarConfig, }: VirtualizedTableProps<TableData>): ReactElement;
|
|
13
17
|
//# sourceMappingURL=VirtualizedTable.d.ts.map
|