@splunk/visualizations 25.3.3 → 25.3.5
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_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_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 +2 -2
- package/Bar.js +2 -2
- package/Bubble.js +2 -2
- package/ChoroplethSvg.js +5 -4
- package/ChoroplethSvg.js.map +1 -1
- package/Column.js +2 -2
- package/Ellipse.js +2 -2
- package/Events.js +2 -2
- package/FillerGauge.js +2 -2
- package/Image.js +2 -2
- package/Line.js +2 -2
- package/LinkGraph.js +2 -2
- package/Map.config.js +4 -3
- package/Map.config.js.map +1 -1
- package/Map.js +6 -5
- package/Map.js.map +1 -1
- package/Markdown.js +2 -2
- package/MarkerGauge.js +2 -2
- package/ParallelCoordinates.js +2 -2
- package/Pie.js +2 -2
- package/Punchcard.js +2 -2
- package/Rectangle.js +2 -2
- package/Sankey.js +2 -2
- package/Scatter.js +2 -2
- package/SingleValue.js +4 -4
- package/SingleValueIcon.js +4 -4
- package/SingleValueRadial.js +4 -4
- package/Table.config.js +2 -2
- package/Table.config.js.map +1 -1
- package/Table.js +199 -267
- package/Table.js.map +1 -1
- package/common/withDashboardViz.js +2 -2
- package/package.json +11 -9
- 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.5 - 09e60e162",
|
|
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
|
|
@@ -1587,7 +1596,7 @@ var Cover = styled_components_1.default.div.withConfig({
|
|
|
1587
1596
|
componentId: "sc-1gsbnxb-0"
|
|
1588
1597
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1589
1598
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1590
|
-
'data-splunk-visualization-version': "25.3.
|
|
1599
|
+
'data-splunk-visualization-version': "25.3.5 - 09e60e162"
|
|
1591
1600
|
}).withConfig({
|
|
1592
1601
|
displayName: "withEditModeCover__Blocker",
|
|
1593
1602
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -2009,13 +2018,13 @@ var optionsSchema = {
|
|
|
2009
2018
|
}
|
|
2010
2019
|
},
|
|
2011
2020
|
textOverflow: {
|
|
2012
|
-
description: 'Controls how the text should be truncated within a particular column. Valid types include "anywhere", "break-word", "ellipsis".
|
|
2021
|
+
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
2022
|
type: 'string',
|
|
2014
2023
|
pattern: schemaUtils_1.getPattern(consts_1.validTextOverflows),
|
|
2015
2024
|
enum: consts_1.validTextOverflows.concat()
|
|
2016
2025
|
},
|
|
2017
2026
|
width: {
|
|
2018
|
-
description: 'Controls how wide
|
|
2027
|
+
description: 'Controls how wide the column should be displayed.',
|
|
2019
2028
|
type: 'number',
|
|
2020
2029
|
minimum: 30
|
|
2021
2030
|
}
|
|
@@ -2483,11 +2492,9 @@ exports.default = configUtils_1.enhanceConfig(config);
|
|
|
2483
2492
|
|
|
2484
2493
|
var _slicedToArray = __webpack_require__(51);
|
|
2485
2494
|
|
|
2486
|
-
var _defineProperty = __webpack_require__(7);
|
|
2487
|
-
|
|
2488
2495
|
var _taggedTemplateLiteral = __webpack_require__(86);
|
|
2489
2496
|
|
|
2490
|
-
var _templateObject, _templateObject2;
|
|
2497
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
2491
2498
|
|
|
2492
2499
|
var __rest = this && this.__rest || function (s, e) {
|
|
2493
2500
|
var t = {};
|
|
@@ -2505,7 +2512,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
2505
2512
|
Object.defineProperty(exports, "__esModule", {
|
|
2506
2513
|
value: true
|
|
2507
2514
|
});
|
|
2508
|
-
exports.MINIMUM_COLUMN_SIZE = void 0;
|
|
2515
|
+
exports.INITIAL_UNSET_COLUMN_WIDTH = exports.MINIMUM_COLUMN_SIZE = void 0;
|
|
2509
2516
|
|
|
2510
2517
|
var React = __webpack_require__(0);
|
|
2511
2518
|
|
|
@@ -2541,15 +2548,14 @@ var getPagination_1 = __webpack_require__(29);
|
|
|
2541
2548
|
|
|
2542
2549
|
var getSorting_1 = __webpack_require__(28);
|
|
2543
2550
|
|
|
2544
|
-
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2545
|
-
|
|
2546
|
-
var utils_1 = __webpack_require__(467); // debounce was imported this way due to typing
|
|
2551
|
+
var FixedSizeContainer_1 = __webpack_require__(13); // debounce was imported this way due to typing
|
|
2547
2552
|
// eslint-disable-next-line import/order
|
|
2548
2553
|
|
|
2549
2554
|
|
|
2550
|
-
var debounce = __webpack_require__(
|
|
2555
|
+
var debounce = __webpack_require__(467);
|
|
2551
2556
|
|
|
2552
2557
|
exports.MINIMUM_COLUMN_SIZE = 30;
|
|
2558
|
+
exports.INITIAL_UNSET_COLUMN_WIDTH = 90;
|
|
2553
2559
|
var NonVisibleTableHead = styled_components_1.default(Table_1.default.Head).withConfig({
|
|
2554
2560
|
displayName: "PureTable__NonVisibleTableHead",
|
|
2555
2561
|
componentId: "tovzjg-0"
|
|
@@ -2558,9 +2564,16 @@ var FixedTableHead = styled_components_1.default(Table_1.default.Head).withConfi
|
|
|
2558
2564
|
displayName: "PureTable__FixedTableHead",
|
|
2559
2565
|
componentId: "tovzjg-1"
|
|
2560
2566
|
})(["position:sticky;top:0;"]);
|
|
2567
|
+
var TableHeadCell = styled_components_1.default(Table_1.default.HeadCell).withConfig({
|
|
2568
|
+
displayName: "PureTable__TableHeadCell",
|
|
2569
|
+
componentId: "tovzjg-2"
|
|
2570
|
+
})(["div > span{word-break:inherit;word-wrap:inherit;white-space:", ";display:inline;}"], function (_ref) {
|
|
2571
|
+
var textOverflowType = _ref.textOverflowType;
|
|
2572
|
+
return textOverflowType === 'ellipsis' ? 'nowrap' : 'inherit';
|
|
2573
|
+
});
|
|
2561
2574
|
var VizTableContainer = styled_components_1.default.div.withConfig({
|
|
2562
2575
|
displayName: "PureTable__VizTableContainer",
|
|
2563
|
-
componentId: "tovzjg-
|
|
2576
|
+
componentId: "tovzjg-3"
|
|
2564
2577
|
})(["box-sizing:border-box;padding:", ";background-color:", ";display:flex;flex-flow:column nowrap;overflow:hidden;"], pick_1.default({
|
|
2565
2578
|
enterprise: variables_1.default.spacingHalf,
|
|
2566
2579
|
prisma: variables_1.default.spacingSmall
|
|
@@ -2572,18 +2585,18 @@ var PAGINATOR_CONTAINER_HEIGHT = 38;
|
|
|
2572
2585
|
var PAGINATOR_SPACING = 5;
|
|
2573
2586
|
var SUITableContainer = styled_components_1.default.div.withConfig({
|
|
2574
2587
|
displayName: "PureTable__SUITableContainer",
|
|
2575
|
-
componentId: "tovzjg-
|
|
2576
|
-
})(["& *{font-family:", ";font-size:", ";line-height:", ";}box-sizing:border-box;flex-grow:1;overflow:hidden;", ";", ";", " ", "
|
|
2588
|
+
componentId: "tovzjg-4"
|
|
2589
|
+
})(["& *{font-family:", ";font-size:", ";line-height:", ";}box-sizing:border-box;flex-grow:1;overflow:hidden;", ";", ";", " ", " [data-test=\"main-table\"]{", "}"], function (props) {
|
|
2577
2590
|
return props.font;
|
|
2578
2591
|
}, function (props) {
|
|
2579
2592
|
return props.fontSize;
|
|
2580
2593
|
}, function (props) {
|
|
2581
2594
|
return props.lineHeight;
|
|
2582
|
-
}, function (
|
|
2583
|
-
var width =
|
|
2584
|
-
height =
|
|
2585
|
-
isPaging =
|
|
2586
|
-
theme =
|
|
2595
|
+
}, function (_ref2) {
|
|
2596
|
+
var width = _ref2.width,
|
|
2597
|
+
height = _ref2.height,
|
|
2598
|
+
isPaging = _ref2.isPaging,
|
|
2599
|
+
theme = _ref2.theme;
|
|
2587
2600
|
var padding = pick_1.default({
|
|
2588
2601
|
enterprise: variables_1.default.spacingHalf({
|
|
2589
2602
|
theme: theme
|
|
@@ -2599,26 +2612,23 @@ var SUITableContainer = styled_components_1.default.div.withConfig({
|
|
|
2599
2612
|
width: width - paddingOffset,
|
|
2600
2613
|
height: isPaging ? height - PAGINATOR_CONTAINER_HEIGHT - PAGINATOR_SPACING - paddingOffset : height - paddingOffset
|
|
2601
2614
|
});
|
|
2602
|
-
}, function (_ref2) {
|
|
2603
|
-
var isPaging = _ref2.isPaging;
|
|
2604
|
-
return isPaging && "\n margin-bottom: ".concat(PAGINATOR_SPACING, "px;\n ");
|
|
2605
2615
|
}, function (_ref3) {
|
|
2606
|
-
var
|
|
2607
|
-
return
|
|
2616
|
+
var isPaging = _ref3.isPaging;
|
|
2617
|
+
return isPaging && "\n margin-bottom: ".concat(PAGINATOR_SPACING, "px;\n ");
|
|
2608
2618
|
}, function (_ref4) {
|
|
2609
2619
|
var headerStyle = _ref4.headerStyle;
|
|
2610
|
-
return headerStyle && headerStyle.
|
|
2620
|
+
return headerStyle && headerStyle.backgroundColor && styled_components_1.css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & [data-test='head-cell'] {\n background-color: ", ";\n }\n "])), headerStyle.backgroundColor);
|
|
2611
2621
|
}, function (_ref5) {
|
|
2612
|
-
var
|
|
2613
|
-
return
|
|
2622
|
+
var headerStyle = _ref5.headerStyle;
|
|
2623
|
+
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
2624
|
}, function (_ref6) {
|
|
2615
|
-
var
|
|
2616
|
-
return
|
|
2625
|
+
var isFullyFixed = _ref6.isFullyFixed;
|
|
2626
|
+
return isFullyFixed && styled_components_1.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: fit-content;\n min-width: unset;\n "])));
|
|
2617
2627
|
});
|
|
2618
2628
|
SUITableContainer.displayName = 'SUITableContainer';
|
|
2619
2629
|
var PaginatorContainer = styled_components_1.default.div.withConfig({
|
|
2620
2630
|
displayName: "PureTable__PaginatorContainer",
|
|
2621
|
-
componentId: "tovzjg-
|
|
2631
|
+
componentId: "tovzjg-5"
|
|
2622
2632
|
})(["position:relative;text-align:right;height:", "px;"], PAGINATOR_CONTAINER_HEIGHT);
|
|
2623
2633
|
PaginatorContainer.displayName = 'PaginatorContainer'; // allow for early return in case of empty tableBody while still following hook rules
|
|
2624
2634
|
|
|
@@ -2631,7 +2641,8 @@ var withEmptyTableMessage = function withEmptyTableMessage(Viz) {
|
|
|
2631
2641
|
showRowNumbers = props.showRowNumbers,
|
|
2632
2642
|
showInternalFields = props.showInternalFields,
|
|
2633
2643
|
tableFormat = props.tableFormat,
|
|
2634
|
-
columnFormat = props.columnFormat
|
|
2644
|
+
columnFormat = props.columnFormat,
|
|
2645
|
+
paginatorParams = props.paginatorParams;
|
|
2635
2646
|
|
|
2636
2647
|
var _hooks_1$useTable = hooks_1.useTable({
|
|
2637
2648
|
headers: headers,
|
|
@@ -2646,7 +2657,8 @@ var withEmptyTableMessage = function withEmptyTableMessage(Viz) {
|
|
|
2646
2657
|
}), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.data) && {
|
|
2647
2658
|
data: lodash_1.cloneDeep(tableFormat.data)
|
|
2648
2659
|
}),
|
|
2649
|
-
columnFormat: columnFormat
|
|
2660
|
+
columnFormat: columnFormat,
|
|
2661
|
+
paginationOffset: paginatorParams === null || paginatorParams === void 0 ? void 0 : paginatorParams.current
|
|
2650
2662
|
}),
|
|
2651
2663
|
tableHeader = _hooks_1$useTable.tableHeader,
|
|
2652
2664
|
tableBody = _hooks_1$useTable.tableBody;
|
|
@@ -2680,27 +2692,11 @@ var useTableHead = function useTableHead(visibility) {
|
|
|
2680
2692
|
};
|
|
2681
2693
|
|
|
2682
2694
|
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"]);
|
|
2695
|
+
var value = _a.value,
|
|
2696
|
+
props = __rest(_a, ["value"]);
|
|
2689
2697
|
|
|
2690
2698
|
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({
|
|
2699
|
+
return React.createElement(TableHeadCell, Object.assign({
|
|
2704
2700
|
elementRef: cellRef
|
|
2705
2701
|
}, props), value);
|
|
2706
2702
|
};
|
|
@@ -2721,6 +2717,9 @@ var rowHeightMap = {
|
|
|
2721
2717
|
default: '20px',
|
|
2722
2718
|
large: '24px'
|
|
2723
2719
|
};
|
|
2720
|
+
var tableInnerStyle = {
|
|
2721
|
+
height: '100%'
|
|
2722
|
+
};
|
|
2724
2723
|
|
|
2725
2724
|
var PureTable = function PureTable(props) {
|
|
2726
2725
|
var count = props.count,
|
|
@@ -2751,42 +2750,14 @@ var PureTable = function PureTable(props) {
|
|
|
2751
2750
|
columns = _React$useState2[0],
|
|
2752
2751
|
setColumns = _React$useState2[1];
|
|
2753
2752
|
|
|
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
2753
|
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;
|
|
2754
|
+
var containerRefInner = React.useRef(null); // this state avoids unncessary column sorting when column resize ends
|
|
2779
2755
|
|
|
2780
|
-
|
|
2756
|
+
var _React$useState3 = React.useState(false),
|
|
2757
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2758
|
+
isResizing = _React$useState4[0],
|
|
2759
|
+
setResizing = _React$useState4[1];
|
|
2781
2760
|
|
|
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
2761
|
var firstRenderCount = React.useRef(count);
|
|
2791
2762
|
React.useEffect(function () {
|
|
2792
2763
|
if (firstRenderCount.current !== count) {
|
|
@@ -2807,9 +2778,14 @@ var PureTable = function PureTable(props) {
|
|
|
2807
2778
|
}
|
|
2808
2779
|
}, [mode, stringifiedColumnFormat]);
|
|
2809
2780
|
var TableHead = useTableHead(headerVisibility);
|
|
2781
|
+
var tableCellClickHandler = React.useCallback(function (e) {
|
|
2782
|
+
setResizing(false); // The resizing state will be set back to false on any cell click
|
|
2783
|
+
|
|
2784
|
+
return onCellClick ? drilldownHandler(e) : lodash_1.noop;
|
|
2785
|
+
}, [onCellClick, showRowNumbers, tableHeader, tableBody]);
|
|
2810
2786
|
var debouncedDrilldown = debounce(function (e, payload) {
|
|
2811
2787
|
if (window.getSelection().toString() === '') {
|
|
2812
|
-
if (
|
|
2788
|
+
if (typeof onCellClick === 'function') {
|
|
2813
2789
|
onCellClick({
|
|
2814
2790
|
e: e,
|
|
2815
2791
|
payload: payload
|
|
@@ -2817,7 +2793,8 @@ var PureTable = function PureTable(props) {
|
|
|
2817
2793
|
}
|
|
2818
2794
|
}
|
|
2819
2795
|
}, 200);
|
|
2820
|
-
|
|
2796
|
+
|
|
2797
|
+
var drilldownHandler = function drilldownHandler(e) {
|
|
2821
2798
|
var element = e.target;
|
|
2822
2799
|
var row = element.getAttribute('data-row-index');
|
|
2823
2800
|
var col = element.getAttribute('data-col-index');
|
|
@@ -2857,27 +2834,14 @@ var PureTable = function PureTable(props) {
|
|
|
2857
2834
|
});
|
|
2858
2835
|
debouncedDrilldown(e.nativeEvent, payload);
|
|
2859
2836
|
}
|
|
2860
|
-
}
|
|
2837
|
+
};
|
|
2838
|
+
|
|
2861
2839
|
var debouncedOnColumnFormatChange = React.useMemo(function () {
|
|
2862
2840
|
return debounce(function (newFormat) {
|
|
2863
2841
|
onColumnFormatChange(newFormat);
|
|
2864
2842
|
}, 300);
|
|
2865
2843
|
}, [onColumnFormatChange]);
|
|
2866
2844
|
|
|
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
2845
|
var handleEventClick = function handleEventClick(e) {
|
|
2882
2846
|
// Hack to target the resize handlers, since the only button within a HeadCell is the resize handlers
|
|
2883
2847
|
if (e.target.tagName.toLowerCase() === 'button') {
|
|
@@ -2893,21 +2857,42 @@ var PureTable = function PureTable(props) {
|
|
|
2893
2857
|
drilldownHandler(e);
|
|
2894
2858
|
};
|
|
2895
2859
|
|
|
2896
|
-
var
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2860
|
+
var handleResizeColumn = function handleResizeColumn(_event, payload) {
|
|
2861
|
+
setResizing(true);
|
|
2862
|
+
var updatedCF = columns;
|
|
2863
|
+
var field = payload.columnId;
|
|
2864
|
+
updatedCF[field] = Object.assign(Object.assign({}, updatedCF[field]), {
|
|
2865
|
+
width: Math.max(payload.width, exports.MINIMUM_COLUMN_SIZE)
|
|
2866
|
+
});
|
|
2867
|
+
setColumns(Object.assign({}, updatedCF)); // Updates column json in edit mode
|
|
2900
2868
|
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
func(e, additionalParams);
|
|
2905
|
-
};
|
|
2869
|
+
if (mode === 'edit') {
|
|
2870
|
+
debouncedOnColumnFormatChange(updatedCF);
|
|
2871
|
+
}
|
|
2906
2872
|
};
|
|
2907
2873
|
|
|
2908
2874
|
var fontMapped = fontMap[font] || fontMap.proportional;
|
|
2909
2875
|
var fontSizeMapped = fontSizeMap[fontSize] || fontSizeMap.default;
|
|
2910
2876
|
var rowHeightMapped = rowHeightMap[fontSize] || rowHeightMap.default;
|
|
2877
|
+
var tableOuterStyle = React.useMemo(function () {
|
|
2878
|
+
return {
|
|
2879
|
+
height: '100%',
|
|
2880
|
+
cursor: onCellClick ? 'pointer' : 'unset'
|
|
2881
|
+
};
|
|
2882
|
+
}, [onCellClick]);
|
|
2883
|
+
var numberOfHeaders = tableHeader.cells.filter(function (c) {
|
|
2884
|
+
return c.showCell;
|
|
2885
|
+
}).length;
|
|
2886
|
+
var numberOfFixedHeaders = tableHeader.cells.filter(function (c) {
|
|
2887
|
+
return c.showCell;
|
|
2888
|
+
}).filter(function (_ref7) {
|
|
2889
|
+
var value = _ref7.value;
|
|
2890
|
+
|
|
2891
|
+
var _a, _b;
|
|
2892
|
+
|
|
2893
|
+
return ((_a = columns[value]) === null || _a === void 0 ? void 0 : _a.width) && ((_b = columns[value]) === null || _b === void 0 ? void 0 : _b.width) !== 'auto';
|
|
2894
|
+
}).length;
|
|
2895
|
+
var isFullyFixed = numberOfHeaders === numberOfFixedHeaders;
|
|
2911
2896
|
return React.createElement(VizTableContainer, {
|
|
2912
2897
|
backgroundColor: backgroundColor,
|
|
2913
2898
|
ref: containerRef
|
|
@@ -2917,48 +2902,41 @@ var PureTable = function PureTable(props) {
|
|
|
2917
2902
|
height: height,
|
|
2918
2903
|
isPaging: isPaging,
|
|
2919
2904
|
headerStyle: tableHeader.style,
|
|
2920
|
-
widthSet: widthSet,
|
|
2921
2905
|
font: fontMapped,
|
|
2922
2906
|
fontSize: fontSizeMapped,
|
|
2923
|
-
lineHeight: rowHeightMapped
|
|
2907
|
+
lineHeight: rowHeightMapped,
|
|
2908
|
+
isFullyFixed: isFullyFixed
|
|
2924
2909
|
}, React.createElement(Table_1.default, {
|
|
2910
|
+
resizableFillLayout: true,
|
|
2925
2911
|
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,
|
|
2912
|
+
innerStyle: tableInnerStyle,
|
|
2913
|
+
outerStyle: tableOuterStyle,
|
|
2914
|
+
onClick: tableCellClickHandler,
|
|
2934
2915
|
onKeyDown: onCellClick ? handleKeyDown : lodash_1.noop,
|
|
2935
2916
|
onRequestResizeColumn: handleResizeColumn
|
|
2936
2917
|
}, React.createElement(TableHead, null, tableHeader.cells.filter(function (c) {
|
|
2937
2918
|
return c.showCell;
|
|
2938
2919
|
}).map(function (_a) {
|
|
2920
|
+
var _b, _c;
|
|
2921
|
+
|
|
2939
2922
|
var key = _a.key,
|
|
2940
2923
|
value = _a.value,
|
|
2941
2924
|
sortKey = _a.sortKey,
|
|
2942
|
-
|
|
2925
|
+
style = _a.style,
|
|
2926
|
+
rest = __rest(_a, ["key", "value", "sortKey", "style"]);
|
|
2943
2927
|
|
|
2944
2928
|
return React.createElement(HeadCell, Object.assign({
|
|
2945
2929
|
key: key,
|
|
2946
2930
|
columnId: value,
|
|
2947
2931
|
sortDir: sortKey === currentSortKey ? currentSortDir : 'none',
|
|
2948
|
-
width:
|
|
2949
|
-
columns: columns,
|
|
2950
|
-
tempColumns: tempColumns,
|
|
2951
|
-
columnName: value,
|
|
2952
|
-
remainingWidth: remainingWidth,
|
|
2953
|
-
numColumnsWithoutWidth: numColumnsWithoutWidth
|
|
2954
|
-
}),
|
|
2932
|
+
width: (_c = (_b = columns[value]) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : exports.INITIAL_UNSET_COLUMN_WIDTH,
|
|
2955
2933
|
onMouseDown: handleEventClick,
|
|
2956
2934
|
value: value,
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2935
|
+
onSort: isResizing || showRowNumbers && value === '#' ? null : onSort,
|
|
2936
|
+
style: showRowNumbers && value === '#' ? Object.assign(Object.assign({}, style), {
|
|
2937
|
+
cursor: 'auto'
|
|
2938
|
+
}) : style,
|
|
2939
|
+
headerVisibility: headerVisibility
|
|
2962
2940
|
}, Object.assign({
|
|
2963
2941
|
sortKey: sortKey
|
|
2964
2942
|
}, rest)));
|
|
@@ -2968,43 +2946,25 @@ var PureTable = function PureTable(props) {
|
|
|
2968
2946
|
}, row.cells.filter(function (c) {
|
|
2969
2947
|
return c.showCell;
|
|
2970
2948
|
}).map(function (cell) {
|
|
2949
|
+
var _a, _b;
|
|
2950
|
+
|
|
2971
2951
|
return React.createElement(cells_1.SwitchTableCell, {
|
|
2972
2952
|
key: cell.key,
|
|
2973
2953
|
type: cell.cellType
|
|
2974
2954
|
}, React.createElement(cells_1.TextCell, {
|
|
2975
2955
|
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
|
-
})
|
|
2956
|
+
useMouseOverEffect: !!onCellClick
|
|
2984
2957
|
}), React.createElement(cells_1.SparklineCell, {
|
|
2985
2958
|
cell: cell,
|
|
2986
2959
|
useMouseOverEffect: !!onCellClick,
|
|
2987
|
-
width:
|
|
2988
|
-
columns: columns,
|
|
2989
|
-
tempColumns: tempColumns,
|
|
2990
|
-
columnName: cell.header,
|
|
2991
|
-
remainingWidth: remainingWidth,
|
|
2992
|
-
numColumnsWithoutWidth: numColumnsWithoutWidth
|
|
2993
|
-
})
|
|
2960
|
+
width: (_b = (_a = columns[cell.header]) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 'auto'
|
|
2994
2961
|
}), React.createElement(cells_1.ArrayCell, {
|
|
2995
2962
|
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
|
-
})
|
|
2963
|
+
useMouseOverEffect: !!onCellClick
|
|
3004
2964
|
}));
|
|
3005
2965
|
}));
|
|
3006
2966
|
})))), isPaging ? React.createElement(PaginatorContainer, null, React.createElement(Paginator_1.default, Object.assign({
|
|
3007
|
-
onChange:
|
|
2967
|
+
onChange: paginatorOnChange
|
|
3008
2968
|
}, paginatorProps))) : null);
|
|
3009
2969
|
};
|
|
3010
2970
|
|
|
@@ -3144,8 +3104,8 @@ var generateKey = function generateKey() {
|
|
|
3144
3104
|
return "".concat(i, "-").concat(value);
|
|
3145
3105
|
};
|
|
3146
3106
|
|
|
3147
|
-
var getTextOverflowType = function getTextOverflowType(columnFormat, currentColumn
|
|
3148
|
-
return lodash_1.get(columnFormat, "".concat(currentColumn, ".textOverflow"))
|
|
3107
|
+
var getTextOverflowType = function getTextOverflowType(columnFormat, currentColumn) {
|
|
3108
|
+
return lodash_1.get(columnFormat, "".concat(currentColumn, ".textOverflow"));
|
|
3149
3109
|
};
|
|
3150
3110
|
|
|
3151
3111
|
exports.getTextOverflowType = getTextOverflowType;
|
|
@@ -3162,17 +3122,13 @@ var generateHeader = function generateHeader(value, i, columnFormat, showInterna
|
|
|
3162
3122
|
ret.showCell = false;
|
|
3163
3123
|
}
|
|
3164
3124
|
|
|
3165
|
-
var
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
ret.truncate = true;
|
|
3173
|
-
ret.style = textOverflowStyle;
|
|
3174
|
-
}
|
|
3175
|
-
|
|
3125
|
+
var textOverflowType = exports.getTextOverflowType(columnFormat, value);
|
|
3126
|
+
var textOverflowStyle = exports.getOverflowStyles({
|
|
3127
|
+
textOverflow: textOverflowType
|
|
3128
|
+
});
|
|
3129
|
+
ret.truncate = true;
|
|
3130
|
+
ret.textOverflowType = textOverflowType;
|
|
3131
|
+
ret.style = textOverflowStyle;
|
|
3176
3132
|
return ret;
|
|
3177
3133
|
};
|
|
3178
3134
|
|
|
@@ -3373,17 +3329,20 @@ var useTable = function useTable() {
|
|
|
3373
3329
|
_tableArgs$tableForma = tableArgs.tableFormat,
|
|
3374
3330
|
tableFormat = _tableArgs$tableForma === void 0 ? {} : _tableArgs$tableForma,
|
|
3375
3331
|
_tableArgs$columnForm = tableArgs.columnFormat,
|
|
3376
|
-
columnFormat = _tableArgs$columnForm === void 0 ? {} : _tableArgs$columnForm
|
|
3332
|
+
columnFormat = _tableArgs$columnForm === void 0 ? {} : _tableArgs$columnForm,
|
|
3333
|
+
_tableArgs$pagination = tableArgs.paginationOffset,
|
|
3334
|
+
paginationOffset = _tableArgs$pagination === void 0 ? 0 : _tableArgs$pagination;
|
|
3377
3335
|
var longestColumnLength = Math.max.apply(Math, _toConsumableArray(table.map(function (column) {
|
|
3378
3336
|
return column.length;
|
|
3379
3337
|
})));
|
|
3380
3338
|
|
|
3381
3339
|
if (showRowNumbers) {
|
|
3340
|
+
var correctedPaginationOffset = Math.max(0, (paginationOffset - 1) * longestColumnLength);
|
|
3382
3341
|
headers = ['#'].concat(_toConsumableArray(headers));
|
|
3383
3342
|
table = [Array.from({
|
|
3384
3343
|
length: longestColumnLength
|
|
3385
3344
|
}, function (v, i) {
|
|
3386
|
-
return i + 1;
|
|
3345
|
+
return correctedPaginationOffset + i + 1;
|
|
3387
3346
|
})].concat(_toConsumableArray(table));
|
|
3388
3347
|
|
|
3389
3348
|
if (isArray(tableFormat.align)) {
|
|
@@ -3452,8 +3411,6 @@ var useTable = function useTable() {
|
|
|
3452
3411
|
cells: []
|
|
3453
3412
|
};
|
|
3454
3413
|
table.forEach(function (column, i) {
|
|
3455
|
-
var _a;
|
|
3456
|
-
|
|
3457
3414
|
var currentHeader = tableHeader.cells[i];
|
|
3458
3415
|
var value = validValueSelector(getColumnFormatData(columnFormat, currentHeader, currentRow), getTableFormatData(tableFormat, i, currentRow), column[currentRow], '');
|
|
3459
3416
|
var rawValue = column[currentRow];
|
|
@@ -3466,15 +3423,11 @@ var useTable = function useTable() {
|
|
|
3466
3423
|
var sparklineType = getColumnFormatSparklineType(columnFormat, currentHeader, currentRow) || getTableFormatSparklineType(tableFormat, i, currentRow) || 'area';
|
|
3467
3424
|
var key = generateKey(value, "".concat(currentRow, "-").concat(i));
|
|
3468
3425
|
var additionalStyles = {};
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
});
|
|
3475
|
-
additionalStyles = Object.assign(Object.assign({}, additionalStyles), textOverflowStyle);
|
|
3476
|
-
}
|
|
3477
|
-
|
|
3426
|
+
var textOverflowType = exports.getTextOverflowType(columnFormat, currentHeader.value);
|
|
3427
|
+
var textOverflowStyle = exports.getOverflowStyles({
|
|
3428
|
+
textOverflow: textOverflowType
|
|
3429
|
+
});
|
|
3430
|
+
additionalStyles = Object.assign(Object.assign({}, additionalStyles), textOverflowStyle);
|
|
3478
3431
|
var showCell = true;
|
|
3479
3432
|
|
|
3480
3433
|
if (!showInternalFields && currentHeader.value.charAt(0) === '_' && currentHeader.value !== '_time') {
|
|
@@ -3594,19 +3547,23 @@ var React = __webpack_require__(0);
|
|
|
3594
3547
|
|
|
3595
3548
|
var Table_1 = __webpack_require__(97);
|
|
3596
3549
|
|
|
3550
|
+
var noop = function noop() {
|
|
3551
|
+
return undefined;
|
|
3552
|
+
};
|
|
3553
|
+
|
|
3597
3554
|
var TextCell = function TextCell(_ref) {
|
|
3598
3555
|
var cell = _ref.cell,
|
|
3599
|
-
useMouseOverEffect = _ref.useMouseOverEffect
|
|
3600
|
-
|
|
3556
|
+
useMouseOverEffect = _ref.useMouseOverEffect;
|
|
3557
|
+
var cellStyle = React.useMemo(function () {
|
|
3558
|
+
return Object.assign({}, cell.style);
|
|
3559
|
+
}, [cell.style]);
|
|
3601
3560
|
return React.createElement(Table_1.default.Cell, {
|
|
3602
|
-
style:
|
|
3603
|
-
width: width
|
|
3604
|
-
}),
|
|
3561
|
+
style: cellStyle,
|
|
3605
3562
|
align: cell.align,
|
|
3606
3563
|
"data-test-cell-type": "TextCell",
|
|
3607
3564
|
"data-row-index": cell.rowIndex,
|
|
3608
3565
|
"data-col-index": cell.columnIndex,
|
|
3609
|
-
onClick: useMouseOverEffect ?
|
|
3566
|
+
onClick: useMouseOverEffect ? noop : undefined
|
|
3610
3567
|
}, cell.value.toString());
|
|
3611
3568
|
};
|
|
3612
3569
|
|
|
@@ -3630,18 +3587,24 @@ var React = __webpack_require__(0);
|
|
|
3630
3587
|
|
|
3631
3588
|
var Table_1 = __webpack_require__(97);
|
|
3632
3589
|
|
|
3590
|
+
var noop = function noop() {
|
|
3591
|
+
return undefined;
|
|
3592
|
+
};
|
|
3593
|
+
|
|
3633
3594
|
var ArrayCell = function ArrayCell(_ref) {
|
|
3634
3595
|
var cell = _ref.cell,
|
|
3635
|
-
useMouseOverEffect = _ref.useMouseOverEffect
|
|
3636
|
-
|
|
3637
|
-
|
|
3596
|
+
useMouseOverEffect = _ref.useMouseOverEffect;
|
|
3597
|
+
var value = React.useMemo(function () {
|
|
3598
|
+
return Array.isArray(cell.value) ? cell.value : [cell.value];
|
|
3599
|
+
}, [cell.value]);
|
|
3600
|
+
var cellStyle = React.useMemo(function () {
|
|
3601
|
+
return Object.assign({}, cell.style);
|
|
3602
|
+
}, [cell.style]);
|
|
3638
3603
|
return React.createElement(Table_1.default.Cell, {
|
|
3639
|
-
style:
|
|
3640
|
-
width: width
|
|
3641
|
-
}),
|
|
3604
|
+
style: cellStyle,
|
|
3642
3605
|
align: cell.align,
|
|
3643
3606
|
"data-test-cell-type": "ArrayCell",
|
|
3644
|
-
onClick: useMouseOverEffect ?
|
|
3607
|
+
onClick: useMouseOverEffect ? noop : undefined
|
|
3645
3608
|
}, value.map(function (v, i) {
|
|
3646
3609
|
return React.createElement("div", {
|
|
3647
3610
|
key: v.toString(),
|
|
@@ -3690,17 +3653,28 @@ var parseSparklineData = function parseSparklineData(data) {
|
|
|
3690
3653
|
|
|
3691
3654
|
exports.validSparklineTypes = ['line', 'area'];
|
|
3692
3655
|
|
|
3656
|
+
var noop = function noop() {
|
|
3657
|
+
return undefined;
|
|
3658
|
+
};
|
|
3659
|
+
|
|
3660
|
+
var svgStyle = {
|
|
3661
|
+
height: 0
|
|
3662
|
+
};
|
|
3663
|
+
var dummySVG = React.createElement("svg", {
|
|
3664
|
+
style: svgStyle
|
|
3665
|
+
});
|
|
3666
|
+
|
|
3693
3667
|
var SparklineCell = function SparklineCell(_ref) {
|
|
3694
3668
|
var cell = _ref.cell,
|
|
3695
3669
|
useMouseOverEffect = _ref.useMouseOverEffect,
|
|
3696
3670
|
width = _ref.width;
|
|
3697
3671
|
|
|
3698
|
-
var _React$useState = React.useState(
|
|
3672
|
+
var _React$useState = React.useState(),
|
|
3699
3673
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3700
|
-
|
|
3701
|
-
|
|
3674
|
+
cellEl = _React$useState2[0],
|
|
3675
|
+
setEl = _React$useState2[1];
|
|
3702
3676
|
|
|
3703
|
-
var _React$useState3 = React.useState(
|
|
3677
|
+
var _React$useState3 = React.useState(),
|
|
3704
3678
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3705
3679
|
height = _React$useState4[0],
|
|
3706
3680
|
setHeight = _React$useState4[1];
|
|
@@ -3708,41 +3682,43 @@ var SparklineCell = function SparklineCell(_ref) {
|
|
|
3708
3682
|
var data = React.useMemo(function () {
|
|
3709
3683
|
return parseSparklineData(cell.value);
|
|
3710
3684
|
}, [cell.value]);
|
|
3711
|
-
React.
|
|
3712
|
-
setHeight(
|
|
3713
|
-
}, [
|
|
3714
|
-
|
|
3715
|
-
|
|
3685
|
+
React.useLayoutEffect(function () {
|
|
3686
|
+
setHeight(cellEl === null || cellEl === void 0 ? void 0 : cellEl.offsetHeight);
|
|
3687
|
+
}, [cellEl]);
|
|
3688
|
+
var cellStyle = React.useMemo(function () {
|
|
3689
|
+
return Object.assign(Object.assign({}, cell.style), {
|
|
3716
3690
|
padding: 0,
|
|
3717
3691
|
margin: 0,
|
|
3718
3692
|
width: width,
|
|
3719
3693
|
height: "".concat(height, "px")
|
|
3720
|
-
})
|
|
3694
|
+
});
|
|
3695
|
+
}, [cell.style, width, height]);
|
|
3696
|
+
var lineStyle = React.useMemo(function () {
|
|
3697
|
+
return {
|
|
3698
|
+
paddingLeft: "".concat(paddingLeftRight, "px"),
|
|
3699
|
+
paddingTop: "".concat(paddingTopBottom, "px"),
|
|
3700
|
+
width: width === 'auto' ? "".concat((cellEl === null || cellEl === void 0 ? void 0 : cellEl.offsetWidth) - paddingLeftRight * 2, "px") : "".concat(width, "px"),
|
|
3701
|
+
height: "".concat(height - paddingTopBottom * 2, "px")
|
|
3702
|
+
};
|
|
3703
|
+
}, [height, width, cellEl]);
|
|
3704
|
+
return React.createElement(Table_1.default.Cell, {
|
|
3705
|
+
style: cellStyle,
|
|
3721
3706
|
align: cell.align,
|
|
3722
|
-
elementRef:
|
|
3707
|
+
elementRef: setEl,
|
|
3723
3708
|
"data-test-cell-type": "SparklineCell",
|
|
3724
3709
|
"data-row-index": cell.rowIndex,
|
|
3725
3710
|
"data-col-index": cell.columnIndex,
|
|
3726
|
-
onClick: useMouseOverEffect ?
|
|
3711
|
+
onClick: useMouseOverEffect ? noop : undefined
|
|
3727
3712
|
}, 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
|
-
},
|
|
3713
|
+
style: lineStyle,
|
|
3734
3714
|
data: data,
|
|
3735
|
-
width:
|
|
3715
|
+
width: (cellEl === null || cellEl === void 0 ? void 0 : cellEl.offsetWidth) - paddingLeftRight * 2,
|
|
3736
3716
|
height: height - paddingTopBottom * 2,
|
|
3737
3717
|
isArea: cell.sparklineType === 'area',
|
|
3738
3718
|
acceptNull: true,
|
|
3739
3719
|
lineColor: cell.sparklineColor,
|
|
3740
3720
|
fillColor: cell.sparklineAreaColor
|
|
3741
|
-
}) :
|
|
3742
|
-
style: {
|
|
3743
|
-
height: 0
|
|
3744
|
-
}
|
|
3745
|
-
}));
|
|
3721
|
+
}) : dummySVG);
|
|
3746
3722
|
};
|
|
3747
3723
|
|
|
3748
3724
|
exports.SparklineCell = SparklineCell;
|
|
@@ -3751,50 +3727,6 @@ exports.SparklineCell.displayName = 'SparklineCell';
|
|
|
3751
3727
|
/***/ }),
|
|
3752
3728
|
|
|
3753
3729
|
/***/ 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
3730
|
/***/ (function(module, exports) {
|
|
3799
3731
|
|
|
3800
3732
|
module.exports = require("lodash/debounce");
|