@perses-dev/components 0.39.0 → 0.40.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/BarChart/BarChart.d.ts +2 -2
- package/dist/BarChart/BarChart.d.ts.map +1 -1
- package/dist/BarChart/BarChart.js +8 -8
- package/dist/BarChart/BarChart.js.map +1 -1
- package/dist/BarChart/index.js.map +1 -1
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/ContentWithLegend/index.js.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js +19 -19
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +6 -22
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
- package/dist/DateTimeRangePicker/index.js.map +1 -1
- package/dist/DateTimeRangePicker/utils.js.map +1 -1
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/Dialog/index.js.map +1 -1
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/Drawer/index.js.map +1 -1
- package/dist/EChart/EChart.js +2 -2
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/EChart/index.js.map +1 -1
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/ErrorBoundary.js.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
- package/dist/FontSizeSelector/index.js.map +1 -1
- package/dist/FormatControls/FormatControls.d.ts +9 -0
- package/dist/FormatControls/FormatControls.d.ts.map +1 -0
- package/dist/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +26 -26
- package/dist/FormatControls/FormatControls.js.map +1 -0
- package/dist/FormatControls/index.d.ts +2 -0
- package/dist/FormatControls/index.d.ts.map +1 -0
- package/dist/{UnitSelector → FormatControls}/index.js +1 -1
- package/dist/FormatControls/index.js.map +1 -0
- package/dist/GaugeChart/GaugeChart.d.ts +3 -3
- package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
- package/dist/GaugeChart/GaugeChart.js +11 -11
- package/dist/GaugeChart/GaugeChart.js.map +1 -1
- package/dist/GaugeChart/index.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/InfoTooltip/index.js.map +1 -1
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.js +3 -3
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.js +2 -2
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/index.js.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LineChart/LineChart.d.ts +2 -2
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +12 -12
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/LineChart/index.js.map +1 -1
- package/dist/ModeSelector/ModeSelector.js.map +1 -1
- package/dist/ModeSelector/index.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/OptionsEditorLayout/index.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/RefreshIntervalPicker/index.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +2 -2
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/SettingsAutocomplete/index.js.map +1 -1
- package/dist/SortSelector/SortSelector.js.map +1 -1
- package/dist/SortSelector/index.js.map +1 -1
- package/dist/StatChart/StatChart.d.ts +2 -2
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +7 -7
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/StatChart/calculateFontSize.js +4 -4
- package/dist/StatChart/calculateFontSize.js.map +1 -1
- package/dist/StatChart/index.js.map +1 -1
- package/dist/Table/InnerTable.js.map +1 -1
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableCell.js +2 -2
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableHead.js.map +1 -1
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/VirtualizedTable.js +6 -6
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +20 -20
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/model/table-model.js +9 -9
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdColorPicker.js +1 -1
- package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +17 -17
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/ThresholdsEditor/index.js.map +1 -1
- package/dist/TimeChart/TimeChart.d.ts +2 -2
- package/dist/TimeChart/TimeChart.d.ts.map +1 -1
- package/dist/TimeChart/TimeChart.js +12 -12
- package/dist/TimeChart/TimeChart.js.map +1 -1
- package/dist/TimeChart/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.js +7 -7
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +2 -2
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +4 -4
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +6 -6
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +7 -7
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +29 -29
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +3 -3
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/cjs/BarChart/BarChart.js +17 -15
- package/dist/cjs/BarChart/index.js +10 -8
- package/dist/cjs/ColorPicker/ColorPicker.js +15 -13
- package/dist/cjs/ColorPicker/index.js +10 -8
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +12 -10
- package/dist/cjs/ContentWithLegend/index.js +10 -8
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +27 -23
- package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +29 -43
- package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +12 -10
- package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +13 -11
- package/dist/cjs/DateTimeRangePicker/index.js +12 -10
- package/dist/cjs/DateTimeRangePicker/utils.js +9 -5
- package/dist/cjs/Dialog/Dialog.js +15 -13
- package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +11 -9
- package/dist/cjs/Dialog/index.js +11 -9
- package/dist/cjs/Drawer/Drawer.js +5 -3
- package/dist/cjs/Drawer/index.js +10 -8
- package/dist/cjs/EChart/EChart.js +12 -10
- package/dist/cjs/EChart/index.js +10 -8
- package/dist/cjs/ErrorAlert.js +5 -3
- package/dist/cjs/ErrorBoundary.js +4 -2
- package/dist/cjs/FontSizeSelector/FontSizeSelector.js +8 -6
- package/dist/cjs/FontSizeSelector/index.js +10 -8
- package/dist/cjs/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +38 -36
- package/dist/cjs/{UnitSelector → FormatControls}/index.js +10 -8
- package/dist/cjs/GaugeChart/GaugeChart.js +22 -18
- package/dist/cjs/GaugeChart/index.js +10 -8
- package/dist/cjs/InfoTooltip/InfoTooltip.js +13 -11
- package/dist/cjs/InfoTooltip/index.js +10 -8
- package/dist/cjs/JSONEditor.js +10 -8
- package/dist/cjs/Legend/CompactLegend.js +9 -7
- package/dist/cjs/Legend/Legend.js +15 -13
- package/dist/cjs/Legend/LegendColorBadge.js +7 -5
- package/dist/cjs/Legend/ListLegend.js +10 -8
- package/dist/cjs/Legend/ListLegendItem.js +12 -10
- package/dist/cjs/Legend/TableLegend.js +7 -5
- package/dist/cjs/Legend/index.js +11 -9
- package/dist/cjs/Legend/legend-model.js +3 -1
- package/dist/cjs/LineChart/LineChart.js +24 -22
- package/dist/cjs/LineChart/index.js +10 -8
- package/dist/cjs/ModeSelector/ModeSelector.js +8 -6
- package/dist/cjs/ModeSelector/index.js +10 -8
- package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +6 -4
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +16 -14
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +5 -3
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +11 -9
- package/dist/cjs/OptionsEditorLayout/index.js +13 -11
- package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +8 -6
- package/dist/cjs/RefreshIntervalPicker/index.js +10 -8
- package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +12 -10
- package/dist/cjs/SettingsAutocomplete/index.js +10 -8
- package/dist/cjs/SortSelector/SortSelector.js +8 -6
- package/dist/cjs/SortSelector/index.js +10 -8
- package/dist/cjs/StatChart/StatChart.js +20 -18
- package/dist/cjs/StatChart/calculateFontSize.js +9 -7
- package/dist/cjs/StatChart/index.js +10 -8
- package/dist/cjs/Table/InnerTable.js +5 -3
- package/dist/cjs/Table/Table.js +15 -13
- package/dist/cjs/Table/TableBody.js +5 -3
- package/dist/cjs/Table/TableCell.js +10 -8
- package/dist/cjs/Table/TableCheckbox.js +5 -3
- package/dist/cjs/Table/TableHead.js +5 -3
- package/dist/cjs/Table/TableHeaderCell.js +8 -6
- package/dist/cjs/Table/TableRow.js +5 -3
- package/dist/cjs/Table/VirtualizedTable.js +32 -30
- package/dist/cjs/Table/VirtualizedTableContainer.js +5 -3
- package/dist/cjs/Table/hooks/useTableKeyboardNav.js +3 -1
- package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +23 -21
- package/dist/cjs/Table/index.js +14 -10
- package/dist/cjs/Table/model/table-model.js +15 -11
- package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +15 -13
- package/dist/cjs/ThresholdsEditor/ThresholdInput.js +14 -12
- package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +44 -42
- package/dist/cjs/ThresholdsEditor/index.js +10 -8
- package/dist/cjs/TimeChart/TimeChart.js +31 -29
- package/dist/cjs/TimeChart/index.js +10 -8
- package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +28 -26
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +17 -15
- package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +15 -13
- package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +5 -3
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +22 -20
- package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +7 -5
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +34 -32
- package/dist/cjs/TimeSeriesTooltip/index.js +19 -17
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +56 -38
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +51 -17
- package/dist/cjs/TimeSeriesTooltip/utils.js +17 -13
- package/dist/cjs/YAxisLabel.js +6 -4
- package/dist/cjs/context/ChartsProvider.js +16 -8
- package/dist/cjs/context/SnackbarProvider.js +6 -2
- package/dist/cjs/context/TimeZoneProvider.js +13 -7
- package/dist/cjs/context/index.js +12 -10
- package/dist/cjs/index.js +41 -39
- package/dist/cjs/model/graph.js +9 -3
- package/dist/cjs/model/index.js +12 -10
- package/dist/cjs/test/index.js +10 -8
- package/dist/cjs/test/render.js +7 -5
- package/dist/cjs/test-utils/index.js +10 -8
- package/dist/cjs/test-utils/theme.js +6 -2
- package/dist/cjs/theme/component-overrides/alert.js +3 -1
- package/dist/cjs/theme/component-overrides/paper.js +3 -1
- package/dist/cjs/theme/index.js +10 -8
- package/dist/cjs/theme/palette/background.js +6 -2
- package/dist/cjs/theme/palette/colors/blue.js +3 -1
- package/dist/cjs/theme/palette/colors/common.js +6 -2
- package/dist/cjs/theme/palette/colors/green.js +3 -1
- package/dist/cjs/theme/palette/colors/grey.js +3 -1
- package/dist/cjs/theme/palette/colors/index.js +17 -15
- package/dist/cjs/theme/palette/colors/orange.js +3 -1
- package/dist/cjs/theme/palette/colors/purple.js +3 -1
- package/dist/cjs/theme/palette/colors/red.js +3 -1
- package/dist/cjs/theme/palette/error.js +3 -1
- package/dist/cjs/theme/palette/grey.js +3 -1
- package/dist/cjs/theme/palette/index.js +10 -8
- package/dist/cjs/theme/palette/palette-options.js +3 -1
- package/dist/cjs/theme/palette/primary.js +3 -1
- package/dist/cjs/theme/palette/secondary.js +3 -1
- package/dist/cjs/theme/palette/success.js +3 -1
- package/dist/cjs/theme/palette/text.js +3 -1
- package/dist/cjs/theme/palette/warning.js +3 -1
- package/dist/cjs/theme/theme.js +5 -3
- package/dist/cjs/theme/typography.js +3 -1
- package/dist/cjs/utils/axis.js +8 -4
- package/dist/cjs/utils/chart-actions.js +26 -10
- package/dist/cjs/utils/combine-sx.js +3 -1
- package/dist/cjs/utils/component-ids.js +3 -1
- package/dist/cjs/utils/format.js +16 -8
- package/dist/cjs/utils/index.js +15 -13
- package/dist/cjs/utils/mathjs.js +3 -1
- package/dist/cjs/utils/theme-gen.js +12 -10
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/context/SnackbarProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/graph.js.map +1 -1
- package/dist/model/index.js.map +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/theme.js.map +1 -1
- package/dist/theme/component-overrides/alert.js.map +1 -1
- package/dist/theme/component-overrides/paper.js.map +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/palette/background.d.ts.map +1 -1
- package/dist/theme/palette/background.js +3 -1
- package/dist/theme/palette/background.js.map +1 -1
- package/dist/theme/palette/colors/blue.js.map +1 -1
- package/dist/theme/palette/colors/common.js.map +1 -1
- package/dist/theme/palette/colors/green.js.map +1 -1
- package/dist/theme/palette/colors/grey.js.map +1 -1
- package/dist/theme/palette/colors/index.js.map +1 -1
- package/dist/theme/palette/colors/orange.js.map +1 -1
- package/dist/theme/palette/colors/purple.js.map +1 -1
- package/dist/theme/palette/colors/red.js.map +1 -1
- package/dist/theme/palette/error.js.map +1 -1
- package/dist/theme/palette/grey.js.map +1 -1
- package/dist/theme/palette/index.js.map +1 -1
- package/dist/theme/palette/palette-options.js.map +1 -1
- package/dist/theme/palette/primary.js.map +1 -1
- package/dist/theme/palette/secondary.js.map +1 -1
- package/dist/theme/palette/success.js.map +1 -1
- package/dist/theme/palette/text.js.map +1 -1
- package/dist/theme/palette/warning.js.map +1 -1
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/typography.js.map +1 -1
- package/dist/utils/axis.d.ts +2 -2
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js.map +1 -1
- package/dist/utils/chart-actions.js +2 -2
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/combine-sx.js.map +1 -1
- package/dist/utils/component-ids.js.map +1 -1
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mathjs.js.map +1 -1
- package/dist/utils/theme-gen.js +7 -7
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +7 -6
- package/dist/UnitSelector/UnitSelector.d.ts +0 -9
- package/dist/UnitSelector/UnitSelector.d.ts.map +0 -1
- package/dist/UnitSelector/UnitSelector.js.map +0 -1
- package/dist/UnitSelector/index.d.ts +0 -2
- package/dist/UnitSelector/index.d.ts.map +0 -1
- package/dist/UnitSelector/index.js.map +0 -1
|
@@ -16,21 +16,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "StatChart", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return StatChart;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _react = require("react");
|
|
23
25
|
const _core = require("@perses-dev/core");
|
|
24
26
|
const _material = require("@mui/material");
|
|
25
|
-
const _merge = /*#__PURE__*/
|
|
27
|
+
const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
|
|
26
28
|
const _core1 = require("echarts/core");
|
|
27
29
|
const _charts = require("echarts/charts");
|
|
28
30
|
const _components = require("echarts/components");
|
|
29
31
|
const _renderers = require("echarts/renderers");
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
+
const _ChartsProvider = require("../context/ChartsProvider");
|
|
33
|
+
const _EChart = require("../EChart");
|
|
32
34
|
const _calculateFontSize = require("./calculateFontSize");
|
|
33
|
-
function
|
|
35
|
+
function _interop_require_default(obj) {
|
|
34
36
|
return obj && obj.__esModule ? obj : {
|
|
35
37
|
default: obj
|
|
36
38
|
};
|
|
@@ -48,20 +50,20 @@ const SERIES_NAME_MAX_FONT_SIZE = 30;
|
|
|
48
50
|
const SERIES_NAME_FONT_WEIGHT = 400;
|
|
49
51
|
const VALUE_FONT_WEIGHT = 700;
|
|
50
52
|
function StatChart(props) {
|
|
51
|
-
var
|
|
52
|
-
const { width , height , data ,
|
|
53
|
-
const chartsTheme = (0,
|
|
53
|
+
var _data_seriesData, _data_seriesData1;
|
|
54
|
+
const { width , height , data , format , color , sparkline , showSeriesName , valueFontSize } = props;
|
|
55
|
+
const chartsTheme = (0, _ChartsProvider.useChartsTheme)();
|
|
54
56
|
let formattedValue = '';
|
|
55
57
|
if (data.calculatedValue === null) {
|
|
56
58
|
formattedValue = 'null';
|
|
57
59
|
} else if (typeof data.calculatedValue === 'number') {
|
|
58
|
-
formattedValue = (0, _core.formatValue)(data.calculatedValue,
|
|
60
|
+
formattedValue = (0, _core.formatValue)(data.calculatedValue, format);
|
|
59
61
|
}
|
|
60
62
|
const containerPadding = chartsTheme.container.padding.default;
|
|
61
|
-
var
|
|
63
|
+
var _data_seriesData_name;
|
|
62
64
|
// calculate series name font size and height
|
|
63
65
|
let seriesNameFontSize = (0, _calculateFontSize.useOptimalFontSize)({
|
|
64
|
-
text: (
|
|
66
|
+
text: (_data_seriesData_name = data === null || data === void 0 ? void 0 : (_data_seriesData = data.seriesData) === null || _data_seriesData === void 0 ? void 0 : _data_seriesData.name) !== null && _data_seriesData_name !== void 0 ? _data_seriesData_name : '',
|
|
65
67
|
fontWeight: SERIES_NAME_FONT_WEIGHT,
|
|
66
68
|
width,
|
|
67
69
|
height: height * 0.125,
|
|
@@ -126,7 +128,7 @@ function StatChart(props) {
|
|
|
126
128
|
show: false,
|
|
127
129
|
min: (value)=>{
|
|
128
130
|
if (value.min >= 0 && value.min <= 1) {
|
|
129
|
-
// helps with
|
|
131
|
+
// helps with percent-decimal units, or datasets that return 0 or 1 booleans
|
|
130
132
|
return 0;
|
|
131
133
|
}
|
|
132
134
|
return value.min;
|
|
@@ -150,26 +152,26 @@ function StatChart(props) {
|
|
|
150
152
|
justifyContent: textAlignment,
|
|
151
153
|
alignItems: textAlignment
|
|
152
154
|
};
|
|
153
|
-
return /*#__PURE__*/ (0,
|
|
155
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
154
156
|
sx: {
|
|
155
157
|
height: '100%',
|
|
156
158
|
width: '100%',
|
|
157
159
|
...textStyles
|
|
158
160
|
},
|
|
159
161
|
children: [
|
|
160
|
-
showSeriesName && /*#__PURE__*/ (0,
|
|
162
|
+
showSeriesName && /*#__PURE__*/ (0, _jsxruntime.jsx)(SeriesName, {
|
|
161
163
|
padding: containerPadding,
|
|
162
164
|
fontSize: seriesNameFontSize,
|
|
163
|
-
children: (
|
|
165
|
+
children: (_data_seriesData1 = data.seriesData) === null || _data_seriesData1 === void 0 ? void 0 : _data_seriesData1.name
|
|
164
166
|
}),
|
|
165
|
-
/*#__PURE__*/ (0,
|
|
167
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(Value, {
|
|
166
168
|
variant: "h3",
|
|
167
169
|
color: color,
|
|
168
170
|
fontSize: optimalValueFontSize,
|
|
169
171
|
padding: containerPadding,
|
|
170
172
|
children: formattedValue
|
|
171
173
|
}),
|
|
172
|
-
sparkline !== undefined && /*#__PURE__*/ (0,
|
|
174
|
+
sparkline !== undefined && /*#__PURE__*/ (0, _jsxruntime.jsx)(_EChart.EChart, {
|
|
173
175
|
sx: {
|
|
174
176
|
width: '100%',
|
|
175
177
|
height: height - seriesNameHeight - valueFontHeight
|
|
@@ -16,9 +16,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "useOptimalFontSize", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return useOptimalFontSize;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _ChartsProvider = require("../context/ChartsProvider");
|
|
22
24
|
let canvasContext;
|
|
23
25
|
function getGlobalCanvasContext() {
|
|
24
26
|
if (!canvasContext) {
|
|
@@ -31,16 +33,16 @@ function getGlobalCanvasContext() {
|
|
|
31
33
|
}
|
|
32
34
|
function useOptimalFontSize({ text , fontWeight , width , height , lineHeight , maxSize , fontSizeOverride }) {
|
|
33
35
|
const ctx = getGlobalCanvasContext();
|
|
34
|
-
const { echartsTheme } = (0,
|
|
36
|
+
const { echartsTheme } = (0, _ChartsProvider.useChartsTheme)();
|
|
35
37
|
// if user has selected a font size in the settings, use it instead of calculating the optimal size
|
|
36
38
|
if (fontSizeOverride !== undefined) {
|
|
37
39
|
return Number(fontSizeOverride);
|
|
38
40
|
}
|
|
39
41
|
const textStyle = echartsTheme.textStyle;
|
|
40
|
-
var
|
|
41
|
-
const fontSize = (
|
|
42
|
-
var
|
|
43
|
-
const fontFamily = (
|
|
42
|
+
var _Number;
|
|
43
|
+
const fontSize = (_Number = Number(textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize)) !== null && _Number !== void 0 ? _Number : 12;
|
|
44
|
+
var _textStyle_fontFamily;
|
|
45
|
+
const fontFamily = (_textStyle_fontFamily = textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontFamily) !== null && _textStyle_fontFamily !== void 0 ? _textStyle_fontFamily : 'Lato';
|
|
44
46
|
// set the font on the canvas context
|
|
45
47
|
const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
46
48
|
ctx.font = fontStyle;
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./StatChart"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
@@ -16,9 +16,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "InnerTable", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return InnerTable;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _react = require("react");
|
|
24
26
|
const StyledMuiTable = (0, _material.styled)(_material.Table)(({ theme })=>({
|
|
@@ -32,7 +34,7 @@ const TABLE_DENSITY_CONFIG = {
|
|
|
32
34
|
standard: 'medium'
|
|
33
35
|
};
|
|
34
36
|
const InnerTable = /*#__PURE__*/ (0, _react.forwardRef)(function InnerTable({ density , ...otherProps }, ref) {
|
|
35
|
-
return /*#__PURE__*/ (0,
|
|
37
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(StyledMuiTable, {
|
|
36
38
|
...otherProps,
|
|
37
39
|
tabIndex: -1,
|
|
38
40
|
size: TABLE_DENSITY_CONFIG[density],
|
package/dist/cjs/Table/Table.js
CHANGED
|
@@ -16,15 +16,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "Table", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return Table;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _reacttable = require("@tanstack/react-table");
|
|
23
25
|
const _material = require("@mui/material");
|
|
24
26
|
const _react = require("react");
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
27
|
+
const _VirtualizedTable = require("./VirtualizedTable");
|
|
28
|
+
const _TableCheckbox = require("./TableCheckbox");
|
|
29
|
+
const _tablemodel = require("./model/table-model");
|
|
28
30
|
const DEFAULT_GET_ROW_ID = (data, index)=>{
|
|
29
31
|
return `${index}`;
|
|
30
32
|
};
|
|
@@ -76,7 +78,7 @@ function Table({ data , columns , density ='standard' , checkboxSelection , onRo
|
|
|
76
78
|
id: 'checkboxRowSelect',
|
|
77
79
|
size: 28,
|
|
78
80
|
header: ({ table })=>{
|
|
79
|
-
return /*#__PURE__*/ (0,
|
|
81
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableCheckbox.TableCheckbox, {
|
|
80
82
|
checked: table.getIsAllRowsSelected(),
|
|
81
83
|
indeterminate: table.getIsSomeRowsSelected(),
|
|
82
84
|
onChange: table.getToggleAllRowsSelectedHandler(),
|
|
@@ -85,7 +87,7 @@ function Table({ data , columns , density ='standard' , checkboxSelection , onRo
|
|
|
85
87
|
});
|
|
86
88
|
},
|
|
87
89
|
cell: ({ row , table })=>{
|
|
88
|
-
return /*#__PURE__*/ (0,
|
|
90
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableCheckbox.TableCheckbox, {
|
|
89
91
|
checked: row.getIsSelected(),
|
|
90
92
|
indeterminate: row.getIsSomeSelected(),
|
|
91
93
|
onChange: (e)=>{
|
|
@@ -104,7 +106,7 @@ function Table({ data , columns , density ='standard' , checkboxSelection , onRo
|
|
|
104
106
|
handleCheckboxChange
|
|
105
107
|
]);
|
|
106
108
|
const tableColumns = (0, _react.useMemo)(()=>{
|
|
107
|
-
const initTableColumns = (0,
|
|
109
|
+
const initTableColumns = (0, _tablemodel.persesColumnsToTanstackColumns)(columns);
|
|
108
110
|
if (checkboxSelection) {
|
|
109
111
|
initTableColumns.unshift(checkboxColumn);
|
|
110
112
|
}
|
|
@@ -114,12 +116,12 @@ function Table({ data , columns , density ='standard' , checkboxSelection , onRo
|
|
|
114
116
|
checkboxSelection,
|
|
115
117
|
columns
|
|
116
118
|
]);
|
|
117
|
-
const table = (0,
|
|
119
|
+
const table = (0, _reacttable.useReactTable)({
|
|
118
120
|
data,
|
|
119
121
|
columns: tableColumns,
|
|
120
122
|
getRowId,
|
|
121
|
-
getCoreRowModel: (0,
|
|
122
|
-
getSortedRowModel: (0,
|
|
123
|
+
getCoreRowModel: (0, _reacttable.getCoreRowModel)(),
|
|
124
|
+
getSortedRowModel: (0, _reacttable.getSortedRowModel)(),
|
|
123
125
|
enableRowSelection: !!checkboxSelection,
|
|
124
126
|
onRowSelectionChange: handleRowSelectionChange,
|
|
125
127
|
onSortingChange: handleSortingChange,
|
|
@@ -139,7 +141,7 @@ function Table({ data , columns , density ='standard' , checkboxSelection , onRo
|
|
|
139
141
|
handleRowSelectionEvent,
|
|
140
142
|
table
|
|
141
143
|
]);
|
|
142
|
-
return /*#__PURE__*/ (0,
|
|
144
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_VirtualizedTable.VirtualizedTable, {
|
|
143
145
|
...otherProps,
|
|
144
146
|
density: density,
|
|
145
147
|
onRowClick: handleRowClick,
|
|
@@ -16,13 +16,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "TableBody", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return TableBody;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _react = require("react");
|
|
24
26
|
const TableBody = /*#__PURE__*/ (0, _react.forwardRef)(function TableBody(props, ref) {
|
|
25
|
-
return /*#__PURE__*/ (0,
|
|
27
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
|
|
26
28
|
...props,
|
|
27
29
|
ref: ref
|
|
28
30
|
});
|
|
@@ -16,12 +16,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "TableCell", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return TableCell;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _react = require("react");
|
|
24
|
-
const
|
|
26
|
+
const _tablemodel = require("./model/table-model");
|
|
25
27
|
const StyledMuiTableCell = (0, _material.styled)(_material.TableCell)(({ theme })=>({
|
|
26
28
|
padding: 0,
|
|
27
29
|
backgroundColor: 'inherit',
|
|
@@ -49,9 +51,9 @@ function TableCell({ children , density , variant , width , focusState ='none' ,
|
|
|
49
51
|
focusState
|
|
50
52
|
]);
|
|
51
53
|
const handleFocus = (e)=>{
|
|
52
|
-
var
|
|
54
|
+
var _e_currentTarget;
|
|
53
55
|
// From https://zellwk.com/blog/keyboard-focusable-elements/
|
|
54
|
-
const nestedFocusTarget = (
|
|
56
|
+
const nestedFocusTarget = (_e_currentTarget = e.currentTarget) === null || _e_currentTarget === void 0 ? void 0 : _e_currentTarget.querySelector('a[href], button, input, textarea, select, details,[role="button"]');
|
|
55
57
|
if (nestedFocusTarget) {
|
|
56
58
|
// If the cell has a focusable child, focus it instead. Mostly used for
|
|
57
59
|
// checkbox cells, but could have other uses.
|
|
@@ -66,7 +68,7 @@ function TableCell({ children , density , variant , width , focusState ='none' ,
|
|
|
66
68
|
// tabindex and focuses to the right cell.
|
|
67
69
|
onFocusTrigger === null || onFocusTrigger === void 0 ? void 0 : onFocusTrigger(e);
|
|
68
70
|
};
|
|
69
|
-
return /*#__PURE__*/ (0,
|
|
71
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(StyledMuiTableCell, {
|
|
70
72
|
...otherProps,
|
|
71
73
|
// Modify the tab index based on the currently focused cell. It's important
|
|
72
74
|
// to avoid having tabindex 0 on everything because it essentially traps
|
|
@@ -81,9 +83,9 @@ function TableCell({ children , density , variant , width , focusState ='none' ,
|
|
|
81
83
|
borderBottom: isHeader ? (theme)=>`solid 1px ${theme.palette.grey[100]}` : `solid 1px ${theme.palette.grey[50]}`
|
|
82
84
|
},
|
|
83
85
|
ref: elRef,
|
|
84
|
-
children: /*#__PURE__*/ (0,
|
|
86
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
85
87
|
sx: {
|
|
86
|
-
...(0,
|
|
88
|
+
...(0, _tablemodel.getTableCellLayout)(theme, density, {
|
|
87
89
|
isLastColumn,
|
|
88
90
|
isFirstColumn
|
|
89
91
|
}),
|
|
@@ -16,13 +16,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "TableCheckbox", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return TableCheckbox;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
function TableCheckbox({ color , density , ...otherProps }) {
|
|
24
26
|
const isCompact = density === 'compact';
|
|
25
|
-
return /*#__PURE__*/ (0,
|
|
27
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
|
|
26
28
|
size: isCompact ? 'small' : 'medium',
|
|
27
29
|
...otherProps,
|
|
28
30
|
// Disable ripple and set background color below because of some issues
|
|
@@ -16,13 +16,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "TableHead", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return TableHead;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _react = require("react");
|
|
24
26
|
const TableHead = /*#__PURE__*/ (0, _react.forwardRef)(function TableHead(props, ref) {
|
|
25
|
-
return /*#__PURE__*/ (0,
|
|
27
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableHead, {
|
|
26
28
|
...props,
|
|
27
29
|
ref: ref
|
|
28
30
|
});
|
|
@@ -16,14 +16,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "TableHeaderCell", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return TableHeaderCell;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
|
-
const
|
|
25
|
+
const _TableCell = require("./TableCell");
|
|
24
26
|
function TableHeaderCell({ onSort , sortDirection , nextSortDirection , children , ...cellProps }) {
|
|
25
27
|
const showSortLabel = !!onSort;
|
|
26
|
-
const headerText = /*#__PURE__*/ (0,
|
|
28
|
+
const headerText = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
27
29
|
noWrap: true,
|
|
28
30
|
variant: "inherit",
|
|
29
31
|
component: "div",
|
|
@@ -32,9 +34,9 @@ function TableHeaderCell({ onSort , sortDirection , nextSortDirection , children
|
|
|
32
34
|
});
|
|
33
35
|
const isActive = !!sortDirection;
|
|
34
36
|
const direction = isActive ? sortDirection : nextSortDirection;
|
|
35
|
-
return /*#__PURE__*/ (0,
|
|
37
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableCell.TableCell, {
|
|
36
38
|
...cellProps,
|
|
37
|
-
children: showSortLabel ? /*#__PURE__*/ (0,
|
|
39
|
+
children: showSortLabel ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableSortLabel, {
|
|
38
40
|
onClick: onSort,
|
|
39
41
|
direction: direction,
|
|
40
42
|
active: isActive,
|
|
@@ -16,13 +16,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "TableRow", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return TableRow;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _react = require("react");
|
|
24
26
|
const TableRow = /*#__PURE__*/ (0, _react.forwardRef)(function TableRow(props, ref) {
|
|
25
|
-
return /*#__PURE__*/ (0,
|
|
27
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableRow, {
|
|
26
28
|
...props,
|
|
27
29
|
ref: ref,
|
|
28
30
|
sx: {
|
|
@@ -16,20 +16,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "VirtualizedTable", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return VirtualizedTable;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _reacttable = require("@tanstack/react-table");
|
|
23
25
|
const _material = require("@mui/material");
|
|
24
|
-
const
|
|
26
|
+
const _reactvirtuoso = require("react-virtuoso");
|
|
25
27
|
const _react = require("react");
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
28
|
+
const _TableRow = require("./TableRow");
|
|
29
|
+
const _TableBody = require("./TableBody");
|
|
30
|
+
const _InnerTable = require("./InnerTable");
|
|
31
|
+
const _TableHead = require("./TableHead");
|
|
32
|
+
const _TableHeaderCell = require("./TableHeaderCell");
|
|
33
|
+
const _TableCell = require("./TableCell");
|
|
34
|
+
const _VirtualizedTableContainer = require("./VirtualizedTableContainer");
|
|
33
35
|
const _useVirtualizedTableKeyboardNav = require("./hooks/useVirtualizedTableKeyboardNav");
|
|
34
36
|
function VirtualizedTable({ width , height , density , onRowClick , onRowMouseOver , onRowMouseOut , rows , columns , headers }) {
|
|
35
37
|
const virtuosoRef = (0, _react.useRef)(null);
|
|
@@ -58,16 +60,16 @@ function VirtualizedTable({ width , height , density , onRowClick , onRowMouseOv
|
|
|
58
60
|
};
|
|
59
61
|
const VirtuosoTableComponents = (0, _react.useMemo)(()=>{
|
|
60
62
|
return {
|
|
61
|
-
Scroller:
|
|
63
|
+
Scroller: _VirtualizedTableContainer.VirtualizedTableContainer,
|
|
62
64
|
Table: (props)=>{
|
|
63
|
-
return /*#__PURE__*/ (0,
|
|
65
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_InnerTable.InnerTable, {
|
|
64
66
|
...props,
|
|
65
67
|
width: width,
|
|
66
68
|
density: density,
|
|
67
69
|
onKeyDown: keyboardNav.onTableKeyDown
|
|
68
70
|
});
|
|
69
71
|
},
|
|
70
|
-
TableHead:
|
|
72
|
+
TableHead: _TableHead.TableHead,
|
|
71
73
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
72
74
|
TableRow: ({ item , ...props })=>{
|
|
73
75
|
const index = props['data-index'];
|
|
@@ -79,7 +81,7 @@ function VirtualizedTable({ width , height , density , onRowClick , onRowMouseOv
|
|
|
79
81
|
id: row.id,
|
|
80
82
|
index: row.index
|
|
81
83
|
};
|
|
82
|
-
return /*#__PURE__*/ (0,
|
|
84
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableRow.TableRow, {
|
|
83
85
|
...props,
|
|
84
86
|
onClick: (e)=>onRowClick(e, row.id),
|
|
85
87
|
density: density,
|
|
@@ -91,7 +93,7 @@ function VirtualizedTable({ width , height , density , onRowClick , onRowMouseOv
|
|
|
91
93
|
}
|
|
92
94
|
});
|
|
93
95
|
},
|
|
94
|
-
TableBody:
|
|
96
|
+
TableBody: _TableBody.TableBody
|
|
95
97
|
};
|
|
96
98
|
}, [
|
|
97
99
|
density,
|
|
@@ -102,12 +104,12 @@ function VirtualizedTable({ width , height , density , onRowClick , onRowMouseOv
|
|
|
102
104
|
rows,
|
|
103
105
|
width
|
|
104
106
|
]);
|
|
105
|
-
return /*#__PURE__*/ (0,
|
|
107
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
106
108
|
sx: {
|
|
107
109
|
width,
|
|
108
110
|
height
|
|
109
111
|
},
|
|
110
|
-
children: /*#__PURE__*/ (0,
|
|
112
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactvirtuoso.TableVirtuoso, {
|
|
111
113
|
ref: virtuosoRef,
|
|
112
114
|
totalCount: rows.length,
|
|
113
115
|
components: VirtuosoTableComponents,
|
|
@@ -116,12 +118,12 @@ function VirtualizedTable({ width , height , density , onRowClick , onRowMouseOv
|
|
|
116
118
|
// https://github.com/petyosi/react-virtuoso/issues/118#issuecomment-642156138
|
|
117
119
|
rangeChanged: setVisibleRange,
|
|
118
120
|
fixedHeaderContent: ()=>{
|
|
119
|
-
return /*#__PURE__*/ (0,
|
|
121
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
120
122
|
children: headers.map((headerGroup)=>{
|
|
121
|
-
return /*#__PURE__*/ (0,
|
|
123
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableRow.TableRow, {
|
|
122
124
|
density: density,
|
|
123
125
|
children: headerGroup.headers.map((header, i, headers)=>{
|
|
124
|
-
var
|
|
126
|
+
var _column_columnDef_meta, _column_columnDef_meta1;
|
|
125
127
|
const column = header.column;
|
|
126
128
|
const position = {
|
|
127
129
|
row: 0,
|
|
@@ -129,20 +131,20 @@ function VirtualizedTable({ width , height , density , onRowClick , onRowMouseOv
|
|
|
129
131
|
};
|
|
130
132
|
const isSorted = column.getIsSorted();
|
|
131
133
|
const nextSorting = column.getNextSortingOrder();
|
|
132
|
-
return /*#__PURE__*/ (0,
|
|
134
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableHeaderCell.TableHeaderCell, {
|
|
133
135
|
onSort: column.getCanSort() ? column.getToggleSortingHandler() : undefined,
|
|
134
136
|
sortDirection: typeof isSorted === 'string' ? isSorted : undefined,
|
|
135
137
|
nextSortDirection: typeof nextSorting === 'string' ? nextSorting : undefined,
|
|
136
138
|
width: column.getSize() || 'auto',
|
|
137
|
-
align: (
|
|
139
|
+
align: (_column_columnDef_meta = column.columnDef.meta) === null || _column_columnDef_meta === void 0 ? void 0 : _column_columnDef_meta.align,
|
|
138
140
|
variant: "head",
|
|
139
141
|
density: density,
|
|
140
|
-
description: (
|
|
142
|
+
description: (_column_columnDef_meta1 = column.columnDef.meta) === null || _column_columnDef_meta1 === void 0 ? void 0 : _column_columnDef_meta1.headerDescription,
|
|
141
143
|
focusState: getFocusState(position),
|
|
142
144
|
onFocusTrigger: ()=>keyboardNav.onCellFocus(position),
|
|
143
145
|
isFirstColumn: i === 0,
|
|
144
146
|
isLastColumn: i === headers.length - 1,
|
|
145
|
-
children: (0,
|
|
147
|
+
children: (0, _reacttable.flexRender)(column.columnDef.header, header.getContext())
|
|
146
148
|
}, header.id);
|
|
147
149
|
})
|
|
148
150
|
}, headerGroup.id);
|
|
@@ -154,9 +156,9 @@ function VirtualizedTable({ width , height , density , onRowClick , onRowMouseOv
|
|
|
154
156
|
if (!row) {
|
|
155
157
|
return null;
|
|
156
158
|
}
|
|
157
|
-
return /*#__PURE__*/ (0,
|
|
159
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
158
160
|
children: row.getVisibleCells().map((cell, i, cells)=>{
|
|
159
|
-
var
|
|
161
|
+
var _cell_column_columnDef_meta, _cell_column_columnDef_meta1;
|
|
160
162
|
const position = {
|
|
161
163
|
// Add 1 to the row index because the header is row 0
|
|
162
164
|
row: index + 1,
|
|
@@ -165,7 +167,7 @@ function VirtualizedTable({ width , height , density , onRowClick , onRowMouseOv
|
|
|
165
167
|
const cellContext = cell.getContext();
|
|
166
168
|
const cellRenderFn = cell.column.columnDef.cell;
|
|
167
169
|
const cellContent = typeof cellRenderFn == 'function' ? cellRenderFn(cellContext) : null;
|
|
168
|
-
const cellDescriptionDef = (
|
|
170
|
+
const cellDescriptionDef = (_cell_column_columnDef_meta = cell.column.columnDef.meta) === null || _cell_column_columnDef_meta === void 0 ? void 0 : _cell_column_columnDef_meta.cellDescription;
|
|
169
171
|
let description = undefined;
|
|
170
172
|
if (typeof cellDescriptionDef === 'function') {
|
|
171
173
|
// If the cell description is a function, set the value using
|
|
@@ -177,9 +179,9 @@ function VirtualizedTable({ width , height , density , onRowClick , onRowMouseOv
|
|
|
177
179
|
// cell content.
|
|
178
180
|
description = cellContent;
|
|
179
181
|
}
|
|
180
|
-
return /*#__PURE__*/ (0,
|
|
182
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TableCell.TableCell, {
|
|
181
183
|
width: cell.column.getSize() || 'auto',
|
|
182
|
-
align: (
|
|
184
|
+
align: (_cell_column_columnDef_meta1 = cell.column.columnDef.meta) === null || _cell_column_columnDef_meta1 === void 0 ? void 0 : _cell_column_columnDef_meta1.align,
|
|
183
185
|
density: density,
|
|
184
186
|
focusState: getFocusState(position),
|
|
185
187
|
onFocusTrigger: ()=>keyboardNav.onCellFocus(position),
|
|
@@ -16,13 +16,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "VirtualizedTableContainer", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return VirtualizedTableContainer;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _react = require("react");
|
|
24
26
|
const VirtualizedTableContainer = /*#__PURE__*/ (0, _react.forwardRef)(function VirtualizedTableContainer(props, ref) {
|
|
25
|
-
return /*#__PURE__*/ (0,
|
|
27
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableContainer, {
|
|
26
28
|
...props,
|
|
27
29
|
tabIndex: -1,
|
|
28
30
|
ref: ref
|
|
@@ -16,7 +16,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "useTableKeyboardNav", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return useTableKeyboardNav;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
const _react = require("react");
|
|
22
24
|
const DEFAULT_ACTIVE_CELL = {
|