@vizzly/dashboard 0.15.0-dev-4dcf5f3e42e92939920ea086ff4075b84ebf01f2 → 0.15.0-dev-265f9c3692c37bc38f3628648bf4eccc11e1034c
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/dashboard.esm.js
CHANGED
|
@@ -55646,7 +55646,9 @@ var VisualFormatCell = function VisualFormatCell(_ref) {
|
|
|
55646
55646
|
column = _ref.column,
|
|
55647
55647
|
visualFormatColumns = _ref.visualFormatColumns,
|
|
55648
55648
|
columnValues = _ref.columnValues,
|
|
55649
|
-
conditionalFormattingColor = _ref.conditionalFormattingColor
|
|
55649
|
+
conditionalFormattingColor = _ref.conditionalFormattingColor,
|
|
55650
|
+
labelWidthPx = _ref.labelWidthPx,
|
|
55651
|
+
shouldTruncate = _ref.shouldTruncate;
|
|
55650
55652
|
var shouldShowHorizontalBar = visualFormatColumns.some(function (vf) {
|
|
55651
55653
|
return vf.field === column.fieldId && vf["function"] === column["function"];
|
|
55652
55654
|
});
|
|
@@ -55659,6 +55661,7 @@ var VisualFormatCell = function VisualFormatCell(_ref) {
|
|
|
55659
55661
|
});
|
|
55660
55662
|
}
|
|
55661
55663
|
if (isNumeric) {
|
|
55664
|
+
var _ref2;
|
|
55662
55665
|
var actualMax = Math.max.apply(Math, columnValues);
|
|
55663
55666
|
var percentage = calculatePercentage(numericValue, actualMax);
|
|
55664
55667
|
var barColor = getBarColor(conditionalFormattingColor, theme);
|
|
@@ -55666,18 +55669,22 @@ var VisualFormatCell = function VisualFormatCell(_ref) {
|
|
|
55666
55669
|
style: {
|
|
55667
55670
|
display: 'flex',
|
|
55668
55671
|
alignItems: 'center',
|
|
55669
|
-
gap: '0.
|
|
55672
|
+
gap: '0.5rem',
|
|
55670
55673
|
padding: '2px'
|
|
55671
55674
|
},
|
|
55672
55675
|
children: [jsx("span", {
|
|
55673
55676
|
style: {
|
|
55674
55677
|
fontSize: '0.8125rem',
|
|
55675
|
-
|
|
55678
|
+
width: labelWidthPx + "px",
|
|
55676
55679
|
whiteSpace: 'nowrap',
|
|
55680
|
+
textAlign: 'left',
|
|
55681
|
+
overflow: shouldTruncate ? 'hidden' : undefined,
|
|
55682
|
+
textOverflow: shouldTruncate ? 'ellipsis' : undefined,
|
|
55677
55683
|
fontWeight: 'normal',
|
|
55678
55684
|
marginRight: 'auto',
|
|
55679
55685
|
flexShrink: 0
|
|
55680
55686
|
},
|
|
55687
|
+
title: String((_ref2 = displayValue != null ? displayValue : value) != null ? _ref2 : ''),
|
|
55681
55688
|
children: displayValue != null ? displayValue : value
|
|
55682
55689
|
}), !!value && jsxs("svg", {
|
|
55683
55690
|
width: "100%",
|
|
@@ -55706,7 +55713,7 @@ var VisualFormatCell = function VisualFormatCell(_ref) {
|
|
|
55706
55713
|
} : {
|
|
55707
55714
|
name: "1qyjf6m-VisualFormatCell",
|
|
55708
55715
|
styles: "cursor:pointer;transition:width 0.3s ease;label:VisualFormatCell;",
|
|
55709
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
55716
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlZpc3VhbEZvcm1hdENlbGwudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlGeUIiLCJmaWxlIjoiVmlzdWFsRm9ybWF0Q2VsbC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9jc3MnO1xuaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IFRhYmxlQ29udGVudCB9IGZyb20gJ3NoYXJlZC1sb2dpYy9zcmMvRGF0YVRhYmxlL3R5cGVzJztcbmltcG9ydCAqIGFzIERhdHVtS2V5IGZyb20gJ3NoYXJlZC1sb2dpYy9zcmMvRGF0dW1LZXknO1xuaW1wb3J0IHsgUXVlcnlBdH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cbiAgICAgID5cbiAgICAgICAgPHNwYW5cbiAgICAgICAgICBzdHlsZT17e1xuICAgICAgICAgICAgZm9udFNpemU6ICcwLjgxMjVyZW0nLFxuICAgICAgICAgICAgd2lkdGg6IGAke2xhYmVsV2lkdGhQeH1weGAsXG4gICAgICAgICAgICB3aGl0ZVNwYWNlOiAnbm93cmFwJyxcbiAgICAgICAgICAgIHRleHRBbGlnbjogJ2xlZnQnLFxuICAgICAgICAgICAgb3ZlcmZsb3c6IHNob3VsZFRydW5jYXRlID8gJ2hpZGRlbicgOiB1bmRlZmluZWQsXG4gICAgICAgICAgICB0ZXh0T3ZlcmZsb3c6IHNob3VsZFRydW5jYXRlID8gJ2VsbGlwc2lzJyA6IHVuZGVmaW5lZCxcbiAgICAgICAgICAgIGZvbnRXZWlnaHQ6ICdub3JtYWwnLFxuICAgICAgICAgICAgbWFyZ2luUmlnaHQ6ICdhdXRvJyxcbiAgICAgICAgICAgIGZsZXhTaHJpbms6IDAsXG4gICAgICAgICAgfX1cbiAgICAgICAgICB0aXRsZT17U3RyaW5nKGRpc3BsYXlWYWx1ZSA/PyB2YWx1ZSA/PyAnJyl9XG4gICAgICAgID5cbiAgICAgICAgICB7ZGlzcGxheVZhbHVlID8/IHZhbHVlfVxuICAgICAgICA8L3NwYW4+XG4gICAgICAgIHshIXZhbHVlICYmIChcbiAgICAgICAgICA8c3ZnIHdpZHRoPVwiMTAwJVwiIGhlaWdodD1cIjIwXCIgc3R5bGU9e3sgZmxleDogMSwgbWluV2lkdGg6IDAgfX0+XG4gICAgICAgICAgICA8cmVjdCB4PXswfSB5PXsyfSB3aWR0aD1cIjEwMCVcIiBoZWlnaHQ9XCIxNlwiIGZpbGw9XCIjZTBlMGUwXCIgcng9ezJ9IC8+XG4gICAgICAgICAgICA8cmVjdFxuICAgICAgICAgICAgICBrZXk9eydiYXJSZWN0S2V5J31cbiAgICAgICAgICAgICAgeD17MH1cbiAgICAgICAgICAgICAgeT17Mn1cbiAgICAgICAgICAgICAgd2lkdGg9e2Ake01hdGgubWF4KDQsIChwZXJjZW50YWdlIC8gMTAwKSAqIDEwMCl9JWB9XG4gICAgICAgICAgICAgIGhlaWdodD1cIjE2XCJcbiAgICAgICAgICAgICAgZmlsbD17YmFyQ29sb3J9XG4gICAgICAgICAgICAgIHJ4PXsyfVxuICAgICAgICAgICAgICBjbGFzc05hbWU9e2Nzcyh7XG4gICAgICAgICAgICAgICAgY3Vyc29yOiAncG9pbnRlcicsXG4gICAgICAgICAgICAgICAgdHJhbnNpdGlvbjogJ3dpZHRoIDAuM3MgZWFzZScsXG4gICAgICAgICAgICAgIH0pfVxuICAgICAgICAgICAgLz5cbiAgICAgICAgICA8L3N2Zz5cbiAgICAgICAgKX1cbiAgICAgIDwvZGl2PlxuICAgICk7XG4gIH1cblxuICByZXR1cm4gPHNwYW4+e2Rpc3BsYXlWYWx1ZSB8fCB2YWx1ZX08L3NwYW4+O1xufTtcblxuZnVuY3Rpb24gZ2V0QmFyQ29sb3IoY29uZGl0aW9uYWxGb3JtYXR0aW5nQ29sb3I/OiBzdHJpbmcsIHRoZW1lPzogVml6emx5VGhlbWluZy5CYXNlKSB7XG4gIGlmIChjb25kaXRpb25hbEZvcm1hdHRpbmdDb2xvcikge1xuICAgIHJldHVybiBjb25kaXRpb25hbEZvcm1hdHRpbmdDb2xvcjtcbiAgfVxuXG4gIGlmICh0aGVtZT8uY2hhcnRzPy5jb2xvcnMgJiYgdGhlbWUuY2hhcnRzLmNvbG9ycy5sZW5ndGggPiAwKSB7XG4gICAgcmV0dXJuIHRoZW1lLmNoYXJ0cy5jb2xvcnNbMF07XG4gIH1cblxuICByZXR1cm4gJyM0Y2FmNTAnO1xufVxuIl19 */",
|
|
55710
55717
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$b
|
|
55711
55718
|
})
|
|
55712
55719
|
}, 'barRectKey')]
|
|
@@ -55728,6 +55735,9 @@ function getBarColor(conditionalFormattingColor, theme) {
|
|
|
55728
55735
|
return '#4caf50';
|
|
55729
55736
|
}
|
|
55730
55737
|
|
|
55738
|
+
var VISUAL_FORMAT_LABEL_PX_PER_CHAR = 8;
|
|
55739
|
+
var VISUAL_FORMAT_LABEL_MAX_PX = 180;
|
|
55740
|
+
var VISUAL_FORMAT_LABEL_PADDING_PX = 0;
|
|
55731
55741
|
var DataTableTR = function DataTableTR(props) {
|
|
55732
55742
|
var row = props.row,
|
|
55733
55743
|
rowIndex = props.rowIndex,
|
|
@@ -55743,6 +55753,33 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
55743
55753
|
textOverride = _useDashboardBehaviou.textOverride;
|
|
55744
55754
|
var _useDashboardContext = useDashboardContext(),
|
|
55745
55755
|
generatingPDF = _useDashboardContext.generatingPDF;
|
|
55756
|
+
var labelWidthByColumn = React__default.useMemo(function () {
|
|
55757
|
+
if (!tableRepresentation) return {};
|
|
55758
|
+
var widthMap = {};
|
|
55759
|
+
tableRepresentation.fields.forEach(function (field, cellIndex) {
|
|
55760
|
+
if (field.dataType !== 'number') return;
|
|
55761
|
+
var maxWidth = tableRepresentation.content.reduce(function (currentMaxWidth, row) {
|
|
55762
|
+
var _ref, _cellValue$displayVal;
|
|
55763
|
+
var cellValue = row[cellIndex];
|
|
55764
|
+
var displayValue = (_ref = (_cellValue$displayVal = cellValue == null ? void 0 : cellValue.displayValue) != null ? _cellValue$displayVal : cellValue == null ? void 0 : cellValue.value) != null ? _ref : '';
|
|
55765
|
+
var charCount = String(displayValue).length;
|
|
55766
|
+
var estimatedWidth = charCount * VISUAL_FORMAT_LABEL_PX_PER_CHAR + VISUAL_FORMAT_LABEL_PADDING_PX;
|
|
55767
|
+
return Math.max(currentMaxWidth, estimatedWidth);
|
|
55768
|
+
}, 0);
|
|
55769
|
+
if (maxWidth > VISUAL_FORMAT_LABEL_MAX_PX) {
|
|
55770
|
+
widthMap[cellIndex] = {
|
|
55771
|
+
width: VISUAL_FORMAT_LABEL_MAX_PX,
|
|
55772
|
+
shouldTruncate: true
|
|
55773
|
+
};
|
|
55774
|
+
} else {
|
|
55775
|
+
widthMap[cellIndex] = {
|
|
55776
|
+
width: maxWidth,
|
|
55777
|
+
shouldTruncate: false
|
|
55778
|
+
};
|
|
55779
|
+
}
|
|
55780
|
+
});
|
|
55781
|
+
return widthMap;
|
|
55782
|
+
}, [tableRepresentation]);
|
|
55746
55783
|
return jsx(Fragment, {
|
|
55747
55784
|
children: row.map(function (cell, cellIndex) {
|
|
55748
55785
|
if (tableRepresentation != null && tableRepresentation.fields[cellIndex].hidden) return null;
|
|
@@ -55785,6 +55822,10 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
55785
55822
|
}).filter(function (val) {
|
|
55786
55823
|
return !isNaN(val);
|
|
55787
55824
|
}) : [];
|
|
55825
|
+
var labelWidthData = labelWidthByColumn[cellIndex] || {
|
|
55826
|
+
width: 0,
|
|
55827
|
+
shouldTruncate: false
|
|
55828
|
+
};
|
|
55788
55829
|
var cellContent = component ? jsx(CustomCell, {
|
|
55789
55830
|
component: component
|
|
55790
55831
|
}) : cell.displayValue !== 'undefined' ? cell.displayValue : '';
|
|
@@ -55799,7 +55840,9 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
55799
55840
|
column: parse(field.datumKey),
|
|
55800
55841
|
visualFormatColumns: props.visualFormatColumns || [],
|
|
55801
55842
|
columnValues: columnValues,
|
|
55802
|
-
conditionalFormattingColor: conditionalFormattingColor
|
|
55843
|
+
conditionalFormattingColor: conditionalFormattingColor,
|
|
55844
|
+
labelWidthPx: labelWidthData.width,
|
|
55845
|
+
shouldTruncate: labelWidthData.shouldTruncate
|
|
55803
55846
|
});
|
|
55804
55847
|
}
|
|
55805
55848
|
var isDimensionColumn = findDimension(dimension, field.id, {
|
|
@@ -55858,8 +55901,8 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
55858
55901
|
})
|
|
55859
55902
|
});
|
|
55860
55903
|
};
|
|
55861
|
-
var CustomCell = function CustomCell(
|
|
55862
|
-
var component =
|
|
55904
|
+
var CustomCell = function CustomCell(_ref2) {
|
|
55905
|
+
var component = _ref2.component;
|
|
55863
55906
|
if (typeof component === 'string') {
|
|
55864
55907
|
return jsx("div", {
|
|
55865
55908
|
dangerouslySetInnerHTML: {
|
|
@@ -9,6 +9,8 @@ interface VisualFormatCellProps {
|
|
|
9
9
|
visualFormatColumns: QueryAttributes.Measure[];
|
|
10
10
|
columnValues: number[];
|
|
11
11
|
conditionalFormattingColor?: string;
|
|
12
|
+
labelWidthPx: number;
|
|
13
|
+
shouldTruncate: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare const VisualFormatCell: React.FC<VisualFormatCellProps>;
|
|
14
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizzly/dashboard",
|
|
3
3
|
"author": "james@vizzly.co",
|
|
4
|
-
"version": "0.15.0-dev-
|
|
4
|
+
"version": "0.15.0-dev-265f9c3692c37bc38f3628648bf4eccc11e1034c",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "./dist/dashboard/src/index.d.ts",
|
|
7
7
|
"module": "./dist/dashboard.esm.js",
|