@splunk/visualizations 25.3.4 → 25.3.6
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/.loki/reference/chrome_docker_PureVisualizations_PureMap_custom_base_layer_tile_server.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Events_Events_Multiline_Events.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Single_Value_Single_Value_Major_value_data_null_show_N_A.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_By_Type_Custom.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Default.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Kitchen_Sink.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Right.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Single_Column.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_All_Fixed_Column_Widths_Width_Overflows.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Color_light_blue.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_No_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table_With_No_Click.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Cell_Types.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Gradient.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Override.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width_All_Columns.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width_Middle_Columns.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Count_2.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Header_Colors.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Row_Colors.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_No_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Default.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Extra_Small.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Large.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Monospace.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Proportional.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Font_Small.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number_Adv.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Text_Overflow.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_fixed.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_none.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage_50_no_paginator.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Invalid_Background_Color.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Mixed_Type_Column_With_Null.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Multi_Line_Field.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Multi_Value_Field.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes_Row_Numbers.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_false.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_true_default.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Row_Numbers_true.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Custom.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Width.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparklines_Adv.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Formatting.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Gradient.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Formatting.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Zone_Time_Formatting.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Height.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Percentage.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Px.png +0 -0
- package/Area.js +12 -11
- package/Area.js.map +1 -1
- package/Bar.js +12 -11
- package/Bar.js.map +1 -1
- package/Bubble.js +12 -11
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.js +13 -12
- package/ChoroplethSvg.js.map +1 -1
- package/Column.js +12 -11
- package/Column.js.map +1 -1
- package/Ellipse.js +12 -11
- package/Ellipse.js.map +1 -1
- package/Events.js +16 -13
- package/Events.js.map +1 -1
- package/FillerGauge.js +12 -11
- package/FillerGauge.js.map +1 -1
- package/Image.js +12 -11
- package/Image.js.map +1 -1
- package/Line.js +12 -11
- package/Line.js.map +1 -1
- package/LinkGraph.js +12 -11
- package/LinkGraph.js.map +1 -1
- package/Map.js +12 -11
- package/Map.js.map +1 -1
- package/Markdown.js +12 -11
- package/Markdown.js.map +1 -1
- package/MarkerGauge.js +12 -11
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.js +12 -11
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.js +12 -11
- package/Pie.js.map +1 -1
- package/Punchcard.js +12 -11
- package/Punchcard.js.map +1 -1
- package/Rectangle.js +12 -11
- package/Rectangle.js.map +1 -1
- package/Sankey.js +12 -11
- package/Sankey.js.map +1 -1
- package/Scatter.js +12 -11
- package/Scatter.js.map +1 -1
- package/SingleValue.js +14 -13
- package/SingleValue.js.map +1 -1
- package/SingleValueIcon.js +14 -13
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.js +14 -13
- package/SingleValueRadial.js.map +1 -1
- package/Table.config.js +2 -2
- package/Table.config.js.map +1 -1
- package/Table.js +209 -276
- package/Table.js.map +1 -1
- package/common/withDashboardViz.js +12 -11
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +13 -11
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width_Auto_Expand_First_Column.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width_Auto_Expand_Last_Column.png +0 -0
package/Table.js
CHANGED
|
@@ -221,7 +221,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
221
221
|
|
|
222
222
|
return React.createElement(FixSizeItem, {
|
|
223
223
|
"data-test": "fix-size-item",
|
|
224
|
-
"data-splunk-visualization-version": "25.3.
|
|
224
|
+
"data-splunk-visualization-version": "25.3.6 - 6b2578d73",
|
|
225
225
|
width: width,
|
|
226
226
|
height: height,
|
|
227
227
|
backgroundColor: backgroundColor
|
|
@@ -367,11 +367,20 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
367
367
|
|
|
368
368
|
if (vizProps.onOptionsChange) {
|
|
369
369
|
var handleColumnFormatChange = function handleColumnFormatChange(updatedColumnFormat) {
|
|
370
|
-
var
|
|
370
|
+
var _a, _b;
|
|
371
|
+
|
|
372
|
+
var cloneOfExistingColumnFormat = (_b = Object.assign({}, (_a = vizProps === null || vizProps === void 0 ? void 0 : vizProps.options) === null || _a === void 0 ? void 0 : _a.columnFormat)) !== null && _b !== void 0 ? _b : {};
|
|
371
373
|
var keys = Object.keys(updatedColumnFormat);
|
|
372
374
|
var values = Object.values(updatedColumnFormat);
|
|
373
375
|
keys.forEach(function (key, index) {
|
|
374
|
-
|
|
376
|
+
if (!cloneOfExistingColumnFormat[key]) {
|
|
377
|
+
cloneOfExistingColumnFormat[key] = {};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
var newWidth = lodash_1.get(values[index], 'width');
|
|
381
|
+
cloneOfExistingColumnFormat[key] = Object.assign(Object.assign({}, cloneOfExistingColumnFormat[key]), {
|
|
382
|
+
width: newWidth
|
|
383
|
+
});
|
|
375
384
|
});
|
|
376
385
|
vizProps.onOptionsChange({
|
|
377
386
|
columnFormat: cloneOfExistingColumnFormat
|
|
@@ -1088,15 +1097,16 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1088
1097
|
supports = vizConfig.supports;
|
|
1089
1098
|
var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptions);
|
|
1090
1099
|
|
|
1091
|
-
if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER)
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
+
if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && vizConfig.key !== 'splunk.singlevalue' // For SV missing props msg is not displayed if required props majorValue is missing, instead this will be handled from the component, instead handled within component
|
|
1101
|
+
) {
|
|
1102
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1103
|
+
"data-test": "missing-props-message",
|
|
1104
|
+
width: width,
|
|
1105
|
+
height: height,
|
|
1106
|
+
missingProps: missing,
|
|
1107
|
+
backgroundColor: bgColorFromTheme
|
|
1108
|
+
});
|
|
1109
|
+
} // events
|
|
1100
1110
|
|
|
1101
1111
|
|
|
1102
1112
|
var eventCallbackProps = {};
|
|
@@ -1587,7 +1597,7 @@ var Cover = styled_components_1.default.div.withConfig({
|
|
|
1587
1597
|
componentId: "sc-1gsbnxb-0"
|
|
1588
1598
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1589
1599
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1590
|
-
'data-splunk-visualization-version': "25.3.
|
|
1600
|
+
'data-splunk-visualization-version': "25.3.6 - 6b2578d73"
|
|
1591
1601
|
}).withConfig({
|
|
1592
1602
|
displayName: "withEditModeCover__Blocker",
|
|
1593
1603
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -2009,13 +2019,13 @@ var optionsSchema = {
|
|
|
2009
2019
|
}
|
|
2010
2020
|
},
|
|
2011
2021
|
textOverflow: {
|
|
2012
|
-
description: 'Controls how the text should be truncated within a particular column. Valid types include "anywhere", "break-word", "ellipsis".
|
|
2022
|
+
description: 'Controls how the text should be truncated within a particular column. Valid types include "anywhere", "break-word", "ellipsis". Columns are "break-word" styled by default when "textOverflow" is not configured.',
|
|
2013
2023
|
type: 'string',
|
|
2014
2024
|
pattern: schemaUtils_1.getPattern(consts_1.validTextOverflows),
|
|
2015
2025
|
enum: consts_1.validTextOverflows.concat()
|
|
2016
2026
|
},
|
|
2017
2027
|
width: {
|
|
2018
|
-
description: 'Controls how wide
|
|
2028
|
+
description: 'Controls how wide the column should be displayed.',
|
|
2019
2029
|
type: 'number',
|
|
2020
2030
|
minimum: 30
|
|
2021
2031
|
}
|
|
@@ -2483,11 +2493,9 @@ exports.default = configUtils_1.enhanceConfig(config);
|
|
|
2483
2493
|
|
|
2484
2494
|
var _slicedToArray = __webpack_require__(51);
|
|
2485
2495
|
|
|
2486
|
-
var _defineProperty = __webpack_require__(7);
|
|
2487
|
-
|
|
2488
2496
|
var _taggedTemplateLiteral = __webpack_require__(86);
|
|
2489
2497
|
|
|
2490
|
-
var _templateObject, _templateObject2;
|
|
2498
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
2491
2499
|
|
|
2492
2500
|
var __rest = this && this.__rest || function (s, e) {
|
|
2493
2501
|
var t = {};
|
|
@@ -2505,7 +2513,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
2505
2513
|
Object.defineProperty(exports, "__esModule", {
|
|
2506
2514
|
value: true
|
|
2507
2515
|
});
|
|
2508
|
-
exports.MINIMUM_COLUMN_SIZE = void 0;
|
|
2516
|
+
exports.INITIAL_UNSET_COLUMN_WIDTH = exports.MINIMUM_COLUMN_SIZE = void 0;
|
|
2509
2517
|
|
|
2510
2518
|
var React = __webpack_require__(0);
|
|
2511
2519
|
|
|
@@ -2541,15 +2549,14 @@ var getPagination_1 = __webpack_require__(29);
|
|
|
2541
2549
|
|
|
2542
2550
|
var getSorting_1 = __webpack_require__(28);
|
|
2543
2551
|
|
|
2544
|
-
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2545
|
-
|
|
2546
|
-
var utils_1 = __webpack_require__(467); // debounce was imported this way due to typing
|
|
2552
|
+
var FixedSizeContainer_1 = __webpack_require__(13); // debounce was imported this way due to typing
|
|
2547
2553
|
// eslint-disable-next-line import/order
|
|
2548
2554
|
|
|
2549
2555
|
|
|
2550
|
-
var debounce = __webpack_require__(
|
|
2556
|
+
var debounce = __webpack_require__(467);
|
|
2551
2557
|
|
|
2552
2558
|
exports.MINIMUM_COLUMN_SIZE = 30;
|
|
2559
|
+
exports.INITIAL_UNSET_COLUMN_WIDTH = 90;
|
|
2553
2560
|
var NonVisibleTableHead = styled_components_1.default(Table_1.default.Head).withConfig({
|
|
2554
2561
|
displayName: "PureTable__NonVisibleTableHead",
|
|
2555
2562
|
componentId: "tovzjg-0"
|
|
@@ -2558,9 +2565,16 @@ var FixedTableHead = styled_components_1.default(Table_1.default.Head).withConfi
|
|
|
2558
2565
|
displayName: "PureTable__FixedTableHead",
|
|
2559
2566
|
componentId: "tovzjg-1"
|
|
2560
2567
|
})(["position:sticky;top:0;"]);
|
|
2568
|
+
var TableHeadCell = styled_components_1.default(Table_1.default.HeadCell).withConfig({
|
|
2569
|
+
displayName: "PureTable__TableHeadCell",
|
|
2570
|
+
componentId: "tovzjg-2"
|
|
2571
|
+
})(["div > span{word-break:inherit;word-wrap:inherit;white-space:", ";display:inline;}"], function (_ref) {
|
|
2572
|
+
var textOverflowType = _ref.textOverflowType;
|
|
2573
|
+
return textOverflowType === 'ellipsis' ? 'nowrap' : 'inherit';
|
|
2574
|
+
});
|
|
2561
2575
|
var VizTableContainer = styled_components_1.default.div.withConfig({
|
|
2562
2576
|
displayName: "PureTable__VizTableContainer",
|
|
2563
|
-
componentId: "tovzjg-
|
|
2577
|
+
componentId: "tovzjg-3"
|
|
2564
2578
|
})(["box-sizing:border-box;padding:", ";background-color:", ";display:flex;flex-flow:column nowrap;overflow:hidden;"], pick_1.default({
|
|
2565
2579
|
enterprise: variables_1.default.spacingHalf,
|
|
2566
2580
|
prisma: variables_1.default.spacingSmall
|
|
@@ -2572,18 +2586,18 @@ var PAGINATOR_CONTAINER_HEIGHT = 38;
|
|
|
2572
2586
|
var PAGINATOR_SPACING = 5;
|
|
2573
2587
|
var SUITableContainer = styled_components_1.default.div.withConfig({
|
|
2574
2588
|
displayName: "PureTable__SUITableContainer",
|
|
2575
|
-
componentId: "tovzjg-
|
|
2576
|
-
})(["& *{font-family:", ";font-size:", ";line-height:", ";}box-sizing:border-box;flex-grow:1;overflow:hidden;", ";", ";", " ", "
|
|
2589
|
+
componentId: "tovzjg-4"
|
|
2590
|
+
})(["& *{font-family:", ";font-size:", ";line-height:", ";}box-sizing:border-box;flex-grow:1;overflow:hidden;", ";", ";", " ", " [data-test=\"main-table\"]{", " td{white-space:pre-line;}}"], function (props) {
|
|
2577
2591
|
return props.font;
|
|
2578
2592
|
}, function (props) {
|
|
2579
2593
|
return props.fontSize;
|
|
2580
2594
|
}, function (props) {
|
|
2581
2595
|
return props.lineHeight;
|
|
2582
|
-
}, function (
|
|
2583
|
-
var width =
|
|
2584
|
-
height =
|
|
2585
|
-
isPaging =
|
|
2586
|
-
theme =
|
|
2596
|
+
}, function (_ref2) {
|
|
2597
|
+
var width = _ref2.width,
|
|
2598
|
+
height = _ref2.height,
|
|
2599
|
+
isPaging = _ref2.isPaging,
|
|
2600
|
+
theme = _ref2.theme;
|
|
2587
2601
|
var padding = pick_1.default({
|
|
2588
2602
|
enterprise: variables_1.default.spacingHalf({
|
|
2589
2603
|
theme: theme
|
|
@@ -2599,26 +2613,23 @@ var SUITableContainer = styled_components_1.default.div.withConfig({
|
|
|
2599
2613
|
width: width - paddingOffset,
|
|
2600
2614
|
height: isPaging ? height - PAGINATOR_CONTAINER_HEIGHT - PAGINATOR_SPACING - paddingOffset : height - paddingOffset
|
|
2601
2615
|
});
|
|
2602
|
-
}, function (_ref2) {
|
|
2603
|
-
var isPaging = _ref2.isPaging;
|
|
2604
|
-
return isPaging && "\n margin-bottom: ".concat(PAGINATOR_SPACING, "px;\n ");
|
|
2605
2616
|
}, function (_ref3) {
|
|
2606
|
-
var
|
|
2607
|
-
return
|
|
2617
|
+
var isPaging = _ref3.isPaging;
|
|
2618
|
+
return isPaging && "\n margin-bottom: ".concat(PAGINATOR_SPACING, "px;\n ");
|
|
2608
2619
|
}, function (_ref4) {
|
|
2609
2620
|
var headerStyle = _ref4.headerStyle;
|
|
2610
|
-
return headerStyle && headerStyle.
|
|
2621
|
+
return headerStyle && headerStyle.backgroundColor && styled_components_1.css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & [data-test='head-cell'] {\n background-color: ", ";\n }\n "])), headerStyle.backgroundColor);
|
|
2611
2622
|
}, function (_ref5) {
|
|
2612
|
-
var
|
|
2613
|
-
return
|
|
2623
|
+
var headerStyle = _ref5.headerStyle;
|
|
2624
|
+
return headerStyle && headerStyle.color && styled_components_1.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & [data-test='head-cell'] > div > span {\n color: ", ";\n }\n "])), headerStyle.color);
|
|
2614
2625
|
}, function (_ref6) {
|
|
2615
|
-
var
|
|
2616
|
-
return
|
|
2626
|
+
var isFullyFixed = _ref6.isFullyFixed;
|
|
2627
|
+
return isFullyFixed && styled_components_1.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: fit-content;\n min-width: unset;\n "])));
|
|
2617
2628
|
});
|
|
2618
2629
|
SUITableContainer.displayName = 'SUITableContainer';
|
|
2619
2630
|
var PaginatorContainer = styled_components_1.default.div.withConfig({
|
|
2620
2631
|
displayName: "PureTable__PaginatorContainer",
|
|
2621
|
-
componentId: "tovzjg-
|
|
2632
|
+
componentId: "tovzjg-5"
|
|
2622
2633
|
})(["position:relative;text-align:right;height:", "px;"], PAGINATOR_CONTAINER_HEIGHT);
|
|
2623
2634
|
PaginatorContainer.displayName = 'PaginatorContainer'; // allow for early return in case of empty tableBody while still following hook rules
|
|
2624
2635
|
|
|
@@ -2631,7 +2642,8 @@ var withEmptyTableMessage = function withEmptyTableMessage(Viz) {
|
|
|
2631
2642
|
showRowNumbers = props.showRowNumbers,
|
|
2632
2643
|
showInternalFields = props.showInternalFields,
|
|
2633
2644
|
tableFormat = props.tableFormat,
|
|
2634
|
-
columnFormat = props.columnFormat
|
|
2645
|
+
columnFormat = props.columnFormat,
|
|
2646
|
+
paginatorParams = props.paginatorParams;
|
|
2635
2647
|
|
|
2636
2648
|
var _hooks_1$useTable = hooks_1.useTable({
|
|
2637
2649
|
headers: headers,
|
|
@@ -2646,7 +2658,8 @@ var withEmptyTableMessage = function withEmptyTableMessage(Viz) {
|
|
|
2646
2658
|
}), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.data) && {
|
|
2647
2659
|
data: lodash_1.cloneDeep(tableFormat.data)
|
|
2648
2660
|
}),
|
|
2649
|
-
columnFormat: columnFormat
|
|
2661
|
+
columnFormat: columnFormat,
|
|
2662
|
+
paginationOffset: paginatorParams === null || paginatorParams === void 0 ? void 0 : paginatorParams.current
|
|
2650
2663
|
}),
|
|
2651
2664
|
tableHeader = _hooks_1$useTable.tableHeader,
|
|
2652
2665
|
tableBody = _hooks_1$useTable.tableBody;
|
|
@@ -2680,27 +2693,11 @@ var useTableHead = function useTableHead(visibility) {
|
|
|
2680
2693
|
};
|
|
2681
2694
|
|
|
2682
2695
|
var HeadCell = function HeadCell(_a) {
|
|
2683
|
-
var
|
|
2684
|
-
|
|
2685
|
-
value = _a.value,
|
|
2686
|
-
widthSet = _a.widthSet,
|
|
2687
|
-
headerVisibility = _a.headerVisibility,
|
|
2688
|
-
props = __rest(_a, ["setTempColumnWidth", "setRemainingWidth", "value", "widthSet", "headerVisibility"]);
|
|
2696
|
+
var value = _a.value,
|
|
2697
|
+
props = __rest(_a, ["value"]);
|
|
2689
2698
|
|
|
2690
2699
|
var cellRef = React.useRef(null);
|
|
2691
|
-
React.
|
|
2692
|
-
if (!widthSet && cellRef.current && cellRef.current.clientWidth >= 0 && headerVisibility !== 'none') {
|
|
2693
|
-
setTempColumnWidth(function (columnWidth) {
|
|
2694
|
-
return Object.assign(Object.assign({}, columnWidth), _defineProperty({}, value, {
|
|
2695
|
-
width: cellRef.current.clientWidth
|
|
2696
|
-
}));
|
|
2697
|
-
});
|
|
2698
|
-
setRemainingWidth(function (prevWidth) {
|
|
2699
|
-
return prevWidth + Math.max(props.width ? cellRef.current.clientWidth - props.width : 0, 0);
|
|
2700
|
-
});
|
|
2701
|
-
}
|
|
2702
|
-
});
|
|
2703
|
-
return React.createElement(Table_1.default.HeadCell, Object.assign({
|
|
2700
|
+
return React.createElement(TableHeadCell, Object.assign({
|
|
2704
2701
|
elementRef: cellRef
|
|
2705
2702
|
}, props), value);
|
|
2706
2703
|
};
|
|
@@ -2721,6 +2718,9 @@ var rowHeightMap = {
|
|
|
2721
2718
|
default: '20px',
|
|
2722
2719
|
large: '24px'
|
|
2723
2720
|
};
|
|
2721
|
+
var tableInnerStyle = {
|
|
2722
|
+
height: '100%'
|
|
2723
|
+
};
|
|
2724
2724
|
|
|
2725
2725
|
var PureTable = function PureTable(props) {
|
|
2726
2726
|
var count = props.count,
|
|
@@ -2751,42 +2751,14 @@ var PureTable = function PureTable(props) {
|
|
|
2751
2751
|
columns = _React$useState2[0],
|
|
2752
2752
|
setColumns = _React$useState2[1];
|
|
2753
2753
|
|
|
2754
|
-
var _React$useState3 = React.useState(columnFormat),
|
|
2755
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2756
|
-
tempColumns = _React$useState4[0],
|
|
2757
|
-
setTempColumns = _React$useState4[1];
|
|
2758
|
-
|
|
2759
|
-
var _React$useState5 = React.useState(0),
|
|
2760
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2761
|
-
remainingWidth = _React$useState6[0],
|
|
2762
|
-
setRemainingWidth = _React$useState6[1];
|
|
2763
|
-
|
|
2764
|
-
var numColumnsWithoutWidth = Object.keys(tempColumns).reduce(function (acc, key) {
|
|
2765
|
-
var _a;
|
|
2766
|
-
|
|
2767
|
-
if ((_a = columns[key]) === null || _a === void 0 ? void 0 : _a.width) {
|
|
2768
|
-
return acc;
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
|
-
return acc + 1;
|
|
2772
|
-
}, 0);
|
|
2773
2754
|
var containerRef = React.useRef(null);
|
|
2774
|
-
var containerRefInner = React.useRef(null);
|
|
2775
|
-
var widthRef = React.useRef(0);
|
|
2776
|
-
var widthSet = tableHeader.cells.length === tableHeader.cells.filter(function (_ref7) {
|
|
2777
|
-
var value = _ref7.value,
|
|
2778
|
-
showCell = _ref7.showCell;
|
|
2755
|
+
var containerRefInner = React.useRef(null); // this state avoids unncessary column sorting when column resize ends
|
|
2779
2756
|
|
|
2780
|
-
|
|
2757
|
+
var _React$useState3 = React.useState(false),
|
|
2758
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2759
|
+
isResizing = _React$useState4[0],
|
|
2760
|
+
setResizing = _React$useState4[1];
|
|
2781
2761
|
|
|
2782
|
-
return ((_a = columns[value]) === null || _a === void 0 ? void 0 : _a.width) !== undefined || ((_b = tempColumns[value]) === null || _b === void 0 ? void 0 : _b.width) !== undefined || !showCell;
|
|
2783
|
-
}).length;
|
|
2784
|
-
React.useEffect(function () {
|
|
2785
|
-
if (containerRef.current && containerRef.current.clientWidth !== widthRef.current) {
|
|
2786
|
-
widthRef.current = containerRef.current.clientWidth;
|
|
2787
|
-
recalculateTempColumnWidths();
|
|
2788
|
-
}
|
|
2789
|
-
});
|
|
2790
2762
|
var firstRenderCount = React.useRef(count);
|
|
2791
2763
|
React.useEffect(function () {
|
|
2792
2764
|
if (firstRenderCount.current !== count) {
|
|
@@ -2807,9 +2779,14 @@ var PureTable = function PureTable(props) {
|
|
|
2807
2779
|
}
|
|
2808
2780
|
}, [mode, stringifiedColumnFormat]);
|
|
2809
2781
|
var TableHead = useTableHead(headerVisibility);
|
|
2782
|
+
var tableCellClickHandler = React.useCallback(function (e) {
|
|
2783
|
+
setResizing(false); // The resizing state will be set back to false on any cell click
|
|
2784
|
+
|
|
2785
|
+
return onCellClick ? drilldownHandler(e) : lodash_1.noop;
|
|
2786
|
+
}, [onCellClick, showRowNumbers, tableHeader, tableBody]);
|
|
2810
2787
|
var debouncedDrilldown = debounce(function (e, payload) {
|
|
2811
2788
|
if (window.getSelection().toString() === '') {
|
|
2812
|
-
if (
|
|
2789
|
+
if (typeof onCellClick === 'function') {
|
|
2813
2790
|
onCellClick({
|
|
2814
2791
|
e: e,
|
|
2815
2792
|
payload: payload
|
|
@@ -2817,7 +2794,8 @@ var PureTable = function PureTable(props) {
|
|
|
2817
2794
|
}
|
|
2818
2795
|
}
|
|
2819
2796
|
}, 200);
|
|
2820
|
-
|
|
2797
|
+
|
|
2798
|
+
var drilldownHandler = function drilldownHandler(e) {
|
|
2821
2799
|
var element = e.target;
|
|
2822
2800
|
var row = element.getAttribute('data-row-index');
|
|
2823
2801
|
var col = element.getAttribute('data-col-index');
|
|
@@ -2857,27 +2835,14 @@ var PureTable = function PureTable(props) {
|
|
|
2857
2835
|
});
|
|
2858
2836
|
debouncedDrilldown(e.nativeEvent, payload);
|
|
2859
2837
|
}
|
|
2860
|
-
}
|
|
2838
|
+
};
|
|
2839
|
+
|
|
2861
2840
|
var debouncedOnColumnFormatChange = React.useMemo(function () {
|
|
2862
2841
|
return debounce(function (newFormat) {
|
|
2863
2842
|
onColumnFormatChange(newFormat);
|
|
2864
2843
|
}, 300);
|
|
2865
2844
|
}, [onColumnFormatChange]);
|
|
2866
2845
|
|
|
2867
|
-
var handleResizeColumn = function handleResizeColumn(_event, payload) {
|
|
2868
|
-
var updatedCF = columns;
|
|
2869
|
-
var field = payload.columnId;
|
|
2870
|
-
updatedCF[field] = Object.assign(Object.assign({}, updatedCF[field]), {
|
|
2871
|
-
width: Math.max(payload.width, exports.MINIMUM_COLUMN_SIZE)
|
|
2872
|
-
});
|
|
2873
|
-
setColumns(Object.assign({}, updatedCF));
|
|
2874
|
-
recalculateTempColumnWidths(); // Updates column json in edit mode
|
|
2875
|
-
|
|
2876
|
-
if (mode === 'edit') {
|
|
2877
|
-
debouncedOnColumnFormatChange(updatedCF);
|
|
2878
|
-
}
|
|
2879
|
-
};
|
|
2880
|
-
|
|
2881
2846
|
var handleEventClick = function handleEventClick(e) {
|
|
2882
2847
|
// Hack to target the resize handlers, since the only button within a HeadCell is the resize handlers
|
|
2883
2848
|
if (e.target.tagName.toLowerCase() === 'button') {
|
|
@@ -2893,21 +2858,42 @@ var PureTable = function PureTable(props) {
|
|
|
2893
2858
|
drilldownHandler(e);
|
|
2894
2859
|
};
|
|
2895
2860
|
|
|
2896
|
-
var
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2861
|
+
var handleResizeColumn = function handleResizeColumn(_event, payload) {
|
|
2862
|
+
setResizing(true);
|
|
2863
|
+
var updatedCF = columns;
|
|
2864
|
+
var field = payload.columnId;
|
|
2865
|
+
updatedCF[field] = Object.assign(Object.assign({}, updatedCF[field]), {
|
|
2866
|
+
width: Math.max(payload.width, exports.MINIMUM_COLUMN_SIZE)
|
|
2867
|
+
});
|
|
2868
|
+
setColumns(Object.assign({}, updatedCF)); // Updates column json in edit mode
|
|
2900
2869
|
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
func(e, additionalParams);
|
|
2905
|
-
};
|
|
2870
|
+
if (mode === 'edit') {
|
|
2871
|
+
debouncedOnColumnFormatChange(updatedCF);
|
|
2872
|
+
}
|
|
2906
2873
|
};
|
|
2907
2874
|
|
|
2908
2875
|
var fontMapped = fontMap[font] || fontMap.proportional;
|
|
2909
2876
|
var fontSizeMapped = fontSizeMap[fontSize] || fontSizeMap.default;
|
|
2910
2877
|
var rowHeightMapped = rowHeightMap[fontSize] || rowHeightMap.default;
|
|
2878
|
+
var tableOuterStyle = React.useMemo(function () {
|
|
2879
|
+
return {
|
|
2880
|
+
height: '100%',
|
|
2881
|
+
cursor: onCellClick ? 'pointer' : 'unset'
|
|
2882
|
+
};
|
|
2883
|
+
}, [onCellClick]);
|
|
2884
|
+
var numberOfHeaders = tableHeader.cells.filter(function (c) {
|
|
2885
|
+
return c.showCell;
|
|
2886
|
+
}).length;
|
|
2887
|
+
var numberOfFixedHeaders = tableHeader.cells.filter(function (c) {
|
|
2888
|
+
return c.showCell;
|
|
2889
|
+
}).filter(function (_ref7) {
|
|
2890
|
+
var value = _ref7.value;
|
|
2891
|
+
|
|
2892
|
+
var _a, _b;
|
|
2893
|
+
|
|
2894
|
+
return ((_a = columns[value]) === null || _a === void 0 ? void 0 : _a.width) && ((_b = columns[value]) === null || _b === void 0 ? void 0 : _b.width) !== 'auto';
|
|
2895
|
+
}).length;
|
|
2896
|
+
var isFullyFixed = numberOfHeaders === numberOfFixedHeaders;
|
|
2911
2897
|
return React.createElement(VizTableContainer, {
|
|
2912
2898
|
backgroundColor: backgroundColor,
|
|
2913
2899
|
ref: containerRef
|
|
@@ -2917,48 +2903,41 @@ var PureTable = function PureTable(props) {
|
|
|
2917
2903
|
height: height,
|
|
2918
2904
|
isPaging: isPaging,
|
|
2919
2905
|
headerStyle: tableHeader.style,
|
|
2920
|
-
widthSet: widthSet,
|
|
2921
2906
|
font: fontMapped,
|
|
2922
2907
|
fontSize: fontSizeMapped,
|
|
2923
|
-
lineHeight: rowHeightMapped
|
|
2908
|
+
lineHeight: rowHeightMapped,
|
|
2909
|
+
isFullyFixed: isFullyFixed
|
|
2924
2910
|
}, React.createElement(Table_1.default, {
|
|
2911
|
+
resizableFillLayout: true,
|
|
2925
2912
|
headType: headerVisibility !== 'none' ? 'inline' : undefined,
|
|
2926
|
-
innerStyle:
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
outerStyle: {
|
|
2930
|
-
height: '100%',
|
|
2931
|
-
cursor: onCellClick ? 'pointer' : 'unset'
|
|
2932
|
-
},
|
|
2933
|
-
onClick: onCellClick ? drilldownHandler : lodash_1.noop,
|
|
2913
|
+
innerStyle: tableInnerStyle,
|
|
2914
|
+
outerStyle: tableOuterStyle,
|
|
2915
|
+
onClick: tableCellClickHandler,
|
|
2934
2916
|
onKeyDown: onCellClick ? handleKeyDown : lodash_1.noop,
|
|
2935
2917
|
onRequestResizeColumn: handleResizeColumn
|
|
2936
2918
|
}, React.createElement(TableHead, null, tableHeader.cells.filter(function (c) {
|
|
2937
2919
|
return c.showCell;
|
|
2938
2920
|
}).map(function (_a) {
|
|
2921
|
+
var _b, _c;
|
|
2922
|
+
|
|
2939
2923
|
var key = _a.key,
|
|
2940
2924
|
value = _a.value,
|
|
2941
2925
|
sortKey = _a.sortKey,
|
|
2942
|
-
|
|
2926
|
+
style = _a.style,
|
|
2927
|
+
rest = __rest(_a, ["key", "value", "sortKey", "style"]);
|
|
2943
2928
|
|
|
2944
2929
|
return React.createElement(HeadCell, Object.assign({
|
|
2945
2930
|
key: key,
|
|
2946
2931
|
columnId: value,
|
|
2947
2932
|
sortDir: sortKey === currentSortKey ? currentSortDir : 'none',
|
|
2948
|
-
width:
|
|
2949
|
-
columns: columns,
|
|
2950
|
-
tempColumns: tempColumns,
|
|
2951
|
-
columnName: value,
|
|
2952
|
-
remainingWidth: remainingWidth,
|
|
2953
|
-
numColumnsWithoutWidth: numColumnsWithoutWidth
|
|
2954
|
-
}),
|
|
2933
|
+
width: (_c = (_b = columns[value]) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : exports.INITIAL_UNSET_COLUMN_WIDTH,
|
|
2955
2934
|
onMouseDown: handleEventClick,
|
|
2956
2935
|
value: value,
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2936
|
+
onSort: isResizing || showRowNumbers && value === '#' ? null : onSort,
|
|
2937
|
+
style: showRowNumbers && value === '#' ? Object.assign(Object.assign({}, style), {
|
|
2938
|
+
cursor: 'auto'
|
|
2939
|
+
}) : style,
|
|
2940
|
+
headerVisibility: headerVisibility
|
|
2962
2941
|
}, Object.assign({
|
|
2963
2942
|
sortKey: sortKey
|
|
2964
2943
|
}, rest)));
|
|
@@ -2968,43 +2947,25 @@ var PureTable = function PureTable(props) {
|
|
|
2968
2947
|
}, row.cells.filter(function (c) {
|
|
2969
2948
|
return c.showCell;
|
|
2970
2949
|
}).map(function (cell) {
|
|
2950
|
+
var _a, _b;
|
|
2951
|
+
|
|
2971
2952
|
return React.createElement(cells_1.SwitchTableCell, {
|
|
2972
2953
|
key: cell.key,
|
|
2973
2954
|
type: cell.cellType
|
|
2974
2955
|
}, React.createElement(cells_1.TextCell, {
|
|
2975
2956
|
cell: cell,
|
|
2976
|
-
useMouseOverEffect: !!onCellClick
|
|
2977
|
-
width: utils_1.getColumnWidth({
|
|
2978
|
-
columns: columns,
|
|
2979
|
-
tempColumns: tempColumns,
|
|
2980
|
-
columnName: cell.header,
|
|
2981
|
-
remainingWidth: remainingWidth,
|
|
2982
|
-
numColumnsWithoutWidth: numColumnsWithoutWidth
|
|
2983
|
-
})
|
|
2957
|
+
useMouseOverEffect: !!onCellClick
|
|
2984
2958
|
}), React.createElement(cells_1.SparklineCell, {
|
|
2985
2959
|
cell: cell,
|
|
2986
2960
|
useMouseOverEffect: !!onCellClick,
|
|
2987
|
-
width:
|
|
2988
|
-
columns: columns,
|
|
2989
|
-
tempColumns: tempColumns,
|
|
2990
|
-
columnName: cell.header,
|
|
2991
|
-
remainingWidth: remainingWidth,
|
|
2992
|
-
numColumnsWithoutWidth: numColumnsWithoutWidth
|
|
2993
|
-
})
|
|
2961
|
+
width: (_b = (_a = columns[cell.header]) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 'auto'
|
|
2994
2962
|
}), React.createElement(cells_1.ArrayCell, {
|
|
2995
2963
|
cell: cell,
|
|
2996
|
-
useMouseOverEffect: !!onCellClick
|
|
2997
|
-
width: utils_1.getColumnWidth({
|
|
2998
|
-
columns: columns,
|
|
2999
|
-
tempColumns: tempColumns,
|
|
3000
|
-
columnName: cell.header,
|
|
3001
|
-
remainingWidth: remainingWidth,
|
|
3002
|
-
numColumnsWithoutWidth: numColumnsWithoutWidth
|
|
3003
|
-
})
|
|
2964
|
+
useMouseOverEffect: !!onCellClick
|
|
3004
2965
|
}));
|
|
3005
2966
|
}));
|
|
3006
2967
|
})))), isPaging ? React.createElement(PaginatorContainer, null, React.createElement(Paginator_1.default, Object.assign({
|
|
3007
|
-
onChange:
|
|
2968
|
+
onChange: paginatorOnChange
|
|
3008
2969
|
}, paginatorProps))) : null);
|
|
3009
2970
|
};
|
|
3010
2971
|
|
|
@@ -3144,8 +3105,8 @@ var generateKey = function generateKey() {
|
|
|
3144
3105
|
return "".concat(i, "-").concat(value);
|
|
3145
3106
|
};
|
|
3146
3107
|
|
|
3147
|
-
var getTextOverflowType = function getTextOverflowType(columnFormat, currentColumn
|
|
3148
|
-
return lodash_1.get(columnFormat, "".concat(currentColumn, ".textOverflow"))
|
|
3108
|
+
var getTextOverflowType = function getTextOverflowType(columnFormat, currentColumn) {
|
|
3109
|
+
return lodash_1.get(columnFormat, "".concat(currentColumn, ".textOverflow"));
|
|
3149
3110
|
};
|
|
3150
3111
|
|
|
3151
3112
|
exports.getTextOverflowType = getTextOverflowType;
|
|
@@ -3162,17 +3123,13 @@ var generateHeader = function generateHeader(value, i, columnFormat, showInterna
|
|
|
3162
3123
|
ret.showCell = false;
|
|
3163
3124
|
}
|
|
3164
3125
|
|
|
3165
|
-
var
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
ret.truncate = true;
|
|
3173
|
-
ret.style = textOverflowStyle;
|
|
3174
|
-
}
|
|
3175
|
-
|
|
3126
|
+
var textOverflowType = exports.getTextOverflowType(columnFormat, value);
|
|
3127
|
+
var textOverflowStyle = exports.getOverflowStyles({
|
|
3128
|
+
textOverflow: textOverflowType
|
|
3129
|
+
});
|
|
3130
|
+
ret.truncate = true;
|
|
3131
|
+
ret.textOverflowType = textOverflowType;
|
|
3132
|
+
ret.style = textOverflowStyle;
|
|
3176
3133
|
return ret;
|
|
3177
3134
|
};
|
|
3178
3135
|
|
|
@@ -3373,17 +3330,20 @@ var useTable = function useTable() {
|
|
|
3373
3330
|
_tableArgs$tableForma = tableArgs.tableFormat,
|
|
3374
3331
|
tableFormat = _tableArgs$tableForma === void 0 ? {} : _tableArgs$tableForma,
|
|
3375
3332
|
_tableArgs$columnForm = tableArgs.columnFormat,
|
|
3376
|
-
columnFormat = _tableArgs$columnForm === void 0 ? {} : _tableArgs$columnForm
|
|
3333
|
+
columnFormat = _tableArgs$columnForm === void 0 ? {} : _tableArgs$columnForm,
|
|
3334
|
+
_tableArgs$pagination = tableArgs.paginationOffset,
|
|
3335
|
+
paginationOffset = _tableArgs$pagination === void 0 ? 0 : _tableArgs$pagination;
|
|
3377
3336
|
var longestColumnLength = Math.max.apply(Math, _toConsumableArray(table.map(function (column) {
|
|
3378
3337
|
return column.length;
|
|
3379
3338
|
})));
|
|
3380
3339
|
|
|
3381
3340
|
if (showRowNumbers) {
|
|
3341
|
+
var correctedPaginationOffset = Math.max(0, (paginationOffset - 1) * longestColumnLength);
|
|
3382
3342
|
headers = ['#'].concat(_toConsumableArray(headers));
|
|
3383
3343
|
table = [Array.from({
|
|
3384
3344
|
length: longestColumnLength
|
|
3385
3345
|
}, function (v, i) {
|
|
3386
|
-
return i + 1;
|
|
3346
|
+
return correctedPaginationOffset + i + 1;
|
|
3387
3347
|
})].concat(_toConsumableArray(table));
|
|
3388
3348
|
|
|
3389
3349
|
if (isArray(tableFormat.align)) {
|
|
@@ -3452,8 +3412,6 @@ var useTable = function useTable() {
|
|
|
3452
3412
|
cells: []
|
|
3453
3413
|
};
|
|
3454
3414
|
table.forEach(function (column, i) {
|
|
3455
|
-
var _a;
|
|
3456
|
-
|
|
3457
3415
|
var currentHeader = tableHeader.cells[i];
|
|
3458
3416
|
var value = validValueSelector(getColumnFormatData(columnFormat, currentHeader, currentRow), getTableFormatData(tableFormat, i, currentRow), column[currentRow], '');
|
|
3459
3417
|
var rawValue = column[currentRow];
|
|
@@ -3466,15 +3424,11 @@ var useTable = function useTable() {
|
|
|
3466
3424
|
var sparklineType = getColumnFormatSparklineType(columnFormat, currentHeader, currentRow) || getTableFormatSparklineType(tableFormat, i, currentRow) || 'area';
|
|
3467
3425
|
var key = generateKey(value, "".concat(currentRow, "-").concat(i));
|
|
3468
3426
|
var additionalStyles = {};
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
});
|
|
3475
|
-
additionalStyles = Object.assign(Object.assign({}, additionalStyles), textOverflowStyle);
|
|
3476
|
-
}
|
|
3477
|
-
|
|
3427
|
+
var textOverflowType = exports.getTextOverflowType(columnFormat, currentHeader.value);
|
|
3428
|
+
var textOverflowStyle = exports.getOverflowStyles({
|
|
3429
|
+
textOverflow: textOverflowType
|
|
3430
|
+
});
|
|
3431
|
+
additionalStyles = Object.assign(Object.assign({}, additionalStyles), textOverflowStyle);
|
|
3478
3432
|
var showCell = true;
|
|
3479
3433
|
|
|
3480
3434
|
if (!showInternalFields && currentHeader.value.charAt(0) === '_' && currentHeader.value !== '_time') {
|
|
@@ -3594,19 +3548,23 @@ var React = __webpack_require__(0);
|
|
|
3594
3548
|
|
|
3595
3549
|
var Table_1 = __webpack_require__(97);
|
|
3596
3550
|
|
|
3551
|
+
var noop = function noop() {
|
|
3552
|
+
return undefined;
|
|
3553
|
+
};
|
|
3554
|
+
|
|
3597
3555
|
var TextCell = function TextCell(_ref) {
|
|
3598
3556
|
var cell = _ref.cell,
|
|
3599
|
-
useMouseOverEffect = _ref.useMouseOverEffect
|
|
3600
|
-
|
|
3557
|
+
useMouseOverEffect = _ref.useMouseOverEffect;
|
|
3558
|
+
var cellStyle = React.useMemo(function () {
|
|
3559
|
+
return Object.assign({}, cell.style);
|
|
3560
|
+
}, [cell.style]);
|
|
3601
3561
|
return React.createElement(Table_1.default.Cell, {
|
|
3602
|
-
style:
|
|
3603
|
-
width: width
|
|
3604
|
-
}),
|
|
3562
|
+
style: cellStyle,
|
|
3605
3563
|
align: cell.align,
|
|
3606
3564
|
"data-test-cell-type": "TextCell",
|
|
3607
3565
|
"data-row-index": cell.rowIndex,
|
|
3608
3566
|
"data-col-index": cell.columnIndex,
|
|
3609
|
-
onClick: useMouseOverEffect ?
|
|
3567
|
+
onClick: useMouseOverEffect ? noop : undefined
|
|
3610
3568
|
}, cell.value.toString());
|
|
3611
3569
|
};
|
|
3612
3570
|
|
|
@@ -3630,18 +3588,24 @@ var React = __webpack_require__(0);
|
|
|
3630
3588
|
|
|
3631
3589
|
var Table_1 = __webpack_require__(97);
|
|
3632
3590
|
|
|
3591
|
+
var noop = function noop() {
|
|
3592
|
+
return undefined;
|
|
3593
|
+
};
|
|
3594
|
+
|
|
3633
3595
|
var ArrayCell = function ArrayCell(_ref) {
|
|
3634
3596
|
var cell = _ref.cell,
|
|
3635
|
-
useMouseOverEffect = _ref.useMouseOverEffect
|
|
3636
|
-
|
|
3637
|
-
|
|
3597
|
+
useMouseOverEffect = _ref.useMouseOverEffect;
|
|
3598
|
+
var value = React.useMemo(function () {
|
|
3599
|
+
return Array.isArray(cell.value) ? cell.value : [cell.value];
|
|
3600
|
+
}, [cell.value]);
|
|
3601
|
+
var cellStyle = React.useMemo(function () {
|
|
3602
|
+
return Object.assign({}, cell.style);
|
|
3603
|
+
}, [cell.style]);
|
|
3638
3604
|
return React.createElement(Table_1.default.Cell, {
|
|
3639
|
-
style:
|
|
3640
|
-
width: width
|
|
3641
|
-
}),
|
|
3605
|
+
style: cellStyle,
|
|
3642
3606
|
align: cell.align,
|
|
3643
3607
|
"data-test-cell-type": "ArrayCell",
|
|
3644
|
-
onClick: useMouseOverEffect ?
|
|
3608
|
+
onClick: useMouseOverEffect ? noop : undefined
|
|
3645
3609
|
}, value.map(function (v, i) {
|
|
3646
3610
|
return React.createElement("div", {
|
|
3647
3611
|
key: v.toString(),
|
|
@@ -3690,17 +3654,28 @@ var parseSparklineData = function parseSparklineData(data) {
|
|
|
3690
3654
|
|
|
3691
3655
|
exports.validSparklineTypes = ['line', 'area'];
|
|
3692
3656
|
|
|
3657
|
+
var noop = function noop() {
|
|
3658
|
+
return undefined;
|
|
3659
|
+
};
|
|
3660
|
+
|
|
3661
|
+
var svgStyle = {
|
|
3662
|
+
height: 0
|
|
3663
|
+
};
|
|
3664
|
+
var dummySVG = React.createElement("svg", {
|
|
3665
|
+
style: svgStyle
|
|
3666
|
+
});
|
|
3667
|
+
|
|
3693
3668
|
var SparklineCell = function SparklineCell(_ref) {
|
|
3694
3669
|
var cell = _ref.cell,
|
|
3695
3670
|
useMouseOverEffect = _ref.useMouseOverEffect,
|
|
3696
3671
|
width = _ref.width;
|
|
3697
3672
|
|
|
3698
|
-
var _React$useState = React.useState(
|
|
3673
|
+
var _React$useState = React.useState(),
|
|
3699
3674
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3700
|
-
|
|
3701
|
-
|
|
3675
|
+
cellEl = _React$useState2[0],
|
|
3676
|
+
setEl = _React$useState2[1];
|
|
3702
3677
|
|
|
3703
|
-
var _React$useState3 = React.useState(
|
|
3678
|
+
var _React$useState3 = React.useState(),
|
|
3704
3679
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3705
3680
|
height = _React$useState4[0],
|
|
3706
3681
|
setHeight = _React$useState4[1];
|
|
@@ -3708,41 +3683,43 @@ var SparklineCell = function SparklineCell(_ref) {
|
|
|
3708
3683
|
var data = React.useMemo(function () {
|
|
3709
3684
|
return parseSparklineData(cell.value);
|
|
3710
3685
|
}, [cell.value]);
|
|
3711
|
-
React.
|
|
3712
|
-
setHeight(
|
|
3713
|
-
}, [
|
|
3714
|
-
|
|
3715
|
-
|
|
3686
|
+
React.useLayoutEffect(function () {
|
|
3687
|
+
setHeight(cellEl === null || cellEl === void 0 ? void 0 : cellEl.offsetHeight);
|
|
3688
|
+
}, [cellEl]);
|
|
3689
|
+
var cellStyle = React.useMemo(function () {
|
|
3690
|
+
return Object.assign(Object.assign({}, cell.style), {
|
|
3716
3691
|
padding: 0,
|
|
3717
3692
|
margin: 0,
|
|
3718
3693
|
width: width,
|
|
3719
3694
|
height: "".concat(height, "px")
|
|
3720
|
-
})
|
|
3695
|
+
});
|
|
3696
|
+
}, [cell.style, width, height]);
|
|
3697
|
+
var lineStyle = React.useMemo(function () {
|
|
3698
|
+
return {
|
|
3699
|
+
paddingLeft: "".concat(paddingLeftRight, "px"),
|
|
3700
|
+
paddingTop: "".concat(paddingTopBottom, "px"),
|
|
3701
|
+
width: width === 'auto' ? "".concat((cellEl === null || cellEl === void 0 ? void 0 : cellEl.offsetWidth) - paddingLeftRight * 2, "px") : "".concat(width, "px"),
|
|
3702
|
+
height: "".concat(height - paddingTopBottom * 2, "px")
|
|
3703
|
+
};
|
|
3704
|
+
}, [height, width, cellEl]);
|
|
3705
|
+
return React.createElement(Table_1.default.Cell, {
|
|
3706
|
+
style: cellStyle,
|
|
3721
3707
|
align: cell.align,
|
|
3722
|
-
elementRef:
|
|
3708
|
+
elementRef: setEl,
|
|
3723
3709
|
"data-test-cell-type": "SparklineCell",
|
|
3724
3710
|
"data-row-index": cell.rowIndex,
|
|
3725
3711
|
"data-col-index": cell.columnIndex,
|
|
3726
|
-
onClick: useMouseOverEffect ?
|
|
3712
|
+
onClick: useMouseOverEffect ? noop : undefined
|
|
3727
3713
|
}, height ? React.createElement(Line_1.default, {
|
|
3728
|
-
style:
|
|
3729
|
-
paddingLeft: "".concat(paddingLeftRight, "px"),
|
|
3730
|
-
paddingTop: "".concat(paddingTopBottom, "px"),
|
|
3731
|
-
width: "".concat(cellRef.offsetWidth - paddingLeftRight * 2, "px"),
|
|
3732
|
-
height: "".concat(height - paddingTopBottom * 2, "px")
|
|
3733
|
-
},
|
|
3714
|
+
style: lineStyle,
|
|
3734
3715
|
data: data,
|
|
3735
|
-
width:
|
|
3716
|
+
width: (cellEl === null || cellEl === void 0 ? void 0 : cellEl.offsetWidth) - paddingLeftRight * 2,
|
|
3736
3717
|
height: height - paddingTopBottom * 2,
|
|
3737
3718
|
isArea: cell.sparklineType === 'area',
|
|
3738
3719
|
acceptNull: true,
|
|
3739
3720
|
lineColor: cell.sparklineColor,
|
|
3740
3721
|
fillColor: cell.sparklineAreaColor
|
|
3741
|
-
}) :
|
|
3742
|
-
style: {
|
|
3743
|
-
height: 0
|
|
3744
|
-
}
|
|
3745
|
-
}));
|
|
3722
|
+
}) : dummySVG);
|
|
3746
3723
|
};
|
|
3747
3724
|
|
|
3748
3725
|
exports.SparklineCell = SparklineCell;
|
|
@@ -3751,50 +3728,6 @@ exports.SparklineCell.displayName = 'SparklineCell';
|
|
|
3751
3728
|
/***/ }),
|
|
3752
3729
|
|
|
3753
3730
|
/***/ 467:
|
|
3754
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3755
|
-
|
|
3756
|
-
"use strict";
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3760
|
-
value: true
|
|
3761
|
-
});
|
|
3762
|
-
exports.getColumnWidth = void 0;
|
|
3763
|
-
|
|
3764
|
-
var getColumnWidth = function getColumnWidth(_ref) {
|
|
3765
|
-
var columns = _ref.columns,
|
|
3766
|
-
tempColumns = _ref.tempColumns,
|
|
3767
|
-
columnName = _ref.columnName,
|
|
3768
|
-
remainingWidth = _ref.remainingWidth,
|
|
3769
|
-
numColumnsWithoutWidth = _ref.numColumnsWithoutWidth;
|
|
3770
|
-
|
|
3771
|
-
var _a, _b, _c, _d, _e, _f; // If both columnFormats are undefined return 0
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
if (((_a = columns[columnName]) === null || _a === void 0 ? void 0 : _a.width) === undefined && ((_b = tempColumns[columnName]) === null || _b === void 0 ? void 0 : _b.width) === undefined) {
|
|
3775
|
-
return 0;
|
|
3776
|
-
} // Column width is defined in the dashboard definition
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
if (((_c = columns[columnName]) === null || _c === void 0 ? void 0 : _c.width) !== undefined) {
|
|
3780
|
-
return (_d = columns[columnName]) === null || _d === void 0 ? void 0 : _d.width;
|
|
3781
|
-
} // Some columns in the table have a defined width; distribute remaining width to this column
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
if (numColumnsWithoutWidth !== 0) {
|
|
3785
|
-
// Math.max() was needed because existing tests expected 0 as an outcome so if the calculation is -1 it puts it back up to 0
|
|
3786
|
-
return Math.max(Math.ceil(((_e = tempColumns[columnName]) === null || _e === void 0 ? void 0 : _e.width) + remainingWidth / numColumnsWithoutWidth) - 1, 0);
|
|
3787
|
-
} // No columns have a width in the dashboard definition
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
return (_f = tempColumns[columnName]) === null || _f === void 0 ? void 0 : _f.width;
|
|
3791
|
-
};
|
|
3792
|
-
|
|
3793
|
-
exports.getColumnWidth = getColumnWidth;
|
|
3794
|
-
|
|
3795
|
-
/***/ }),
|
|
3796
|
-
|
|
3797
|
-
/***/ 468:
|
|
3798
3731
|
/***/ (function(module, exports) {
|
|
3799
3732
|
|
|
3800
3733
|
module.exports = require("lodash/debounce");
|