@vizzly/dashboard 0.15.0-dev-81db07dadb372ce812c6f6e25eba40a1c153bb5c → 0.15.0-dev-f6507ed8045dad10d9fb36c61aa24ece44161d7f
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.cjs.development.js +669 -109
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +672 -109
- package/dist/shared-logic/src/Component/types.d.ts +2 -0
- package/dist/shared-logic/src/ComponentInterface/types/namespaces.types.d.ts +2 -0
- package/dist/shared-logic/src/FormatPanelConfig/types.d.ts +3 -1
- package/dist/shared-ui/src/base/Table/Table.d.ts +2 -0
- package/dist/shared-ui/src/base/Table/TableComponents.d.ts +2 -0
- package/dist/shared-ui/src/components/DataTable/DataTableRow.d.ts +2 -0
- package/dist/shared-ui/src/components/DataTable/DataTableTR.d.ts +2 -0
- package/dist/shared-ui/src/components/DataTable/DataTableView.d.ts +8 -0
- package/dist/shared-ui/src/components/DataTable/KPISummaryHeader.d.ts +17 -0
- package/dist/shared-ui/src/components/DataTable/VisualFormatCell.d.ts +12 -0
- package/dist/shared-ui/src/components/DataTable/getPivotTableGroupTitles.d.ts +1 -1
- package/dist/shared-ui/src/contexts/GlobalProvider/useGlobalProvider.d.ts +12 -12
- package/dist/shared-ui/src/library/StylePanel/KPISummarisationSection.d.ts +5 -0
- package/dist/shared-ui/src/library/StylePanel/VisualFormatSection.d.ts +6 -0
- package/package.json +1 -1
|
@@ -5270,6 +5270,16 @@ var CONSTANTS$4 = {
|
|
|
5270
5270
|
type: 'conditionalFormatting',
|
|
5271
5271
|
title: 'Conditional Formatting',
|
|
5272
5272
|
description: ''
|
|
5273
|
+
},
|
|
5274
|
+
visual_format: {
|
|
5275
|
+
type: 'visualFormat',
|
|
5276
|
+
title: 'Visual Format',
|
|
5277
|
+
description: 'Configure how group columns are visually represented'
|
|
5278
|
+
},
|
|
5279
|
+
kpi_summarisation: {
|
|
5280
|
+
type: 'kpiSummarisation',
|
|
5281
|
+
title: '',
|
|
5282
|
+
description: 'Show aggregate statistics above column headers'
|
|
5273
5283
|
}
|
|
5274
5284
|
}
|
|
5275
5285
|
};
|
|
@@ -5379,7 +5389,7 @@ var BasicTable = function BasicTable(config) {
|
|
|
5379
5389
|
subSection: [(_CONSTANTS$format_pan = CONSTANTS$4.format_panel.format) == null ? void 0 : _CONSTANTS$format_pan.subSectionDefinition.time]
|
|
5380
5390
|
}), namespace(CONSTANTS$4, 'prefixes'), _extends({}, namespace(CONSTANTS$4, 'conditional_formatting'), {
|
|
5381
5391
|
ruleType: 'backgroundColor'
|
|
5382
|
-
})];
|
|
5392
|
+
}), namespace(CONSTANTS$4, 'visual_format'), namespace(CONSTANTS$4, 'kpi_summarisation')];
|
|
5383
5393
|
},
|
|
5384
5394
|
supportedCustomFields: {
|
|
5385
5395
|
percentages: false,
|
|
@@ -7107,13 +7117,38 @@ var attributesSchema$a = function attributesSchema(config) {
|
|
|
7107
7117
|
hiddenFields: Joi.array().items(Joi.string()),
|
|
7108
7118
|
tableDrilldown: Joi.array().items(Joi.object({
|
|
7109
7119
|
subsetDimension: Joi.string().required().description('The ID of the field in the data set to drill down by.')
|
|
7110
|
-
})).description('Drilldown configuration for a pivot table.')
|
|
7120
|
+
})).description('Drilldown configuration for a pivot table.'),
|
|
7121
|
+
summarizeKPIs: Joi["boolean"]()["default"](false).description('Enable/disable KPI summarisation above column headers.'),
|
|
7122
|
+
visualFormatColumns: Joi.array().items(Joi.string().min(1))["default"]([]).sparse(false).description('Array of column names to display as horizontal bars.'),
|
|
7123
|
+
results: Joi.array().items(Joi.object({
|
|
7124
|
+
content: Joi.array().required(),
|
|
7125
|
+
fields: Joi.array().items(Joi.object({
|
|
7126
|
+
id: Joi.string().required(),
|
|
7127
|
+
publicName: Joi.string().required(),
|
|
7128
|
+
dataType: Joi.string().required(),
|
|
7129
|
+
hidden: Joi["boolean"](),
|
|
7130
|
+
fieldId: Joi.string().required(),
|
|
7131
|
+
"function": Joi.string().required(),
|
|
7132
|
+
outputDataType: Joi.string().required()
|
|
7133
|
+
}).unknown(true)).required(),
|
|
7134
|
+
hasMoreResults: Joi.alternatives([Joi["boolean"](), Joi.valid(null)])
|
|
7135
|
+
}).unknown(true)).description('Query results data structure containing fields and content.')
|
|
7111
7136
|
}));
|
|
7112
7137
|
};
|
|
7113
7138
|
|
|
7114
7139
|
var setAttributes$a = (function (config) {
|
|
7115
7140
|
return function (dataTable, partial) {
|
|
7141
|
+
var _partial$dimension;
|
|
7116
7142
|
var newAttributes = setAttributes(dataTable, partial, attributesSchema$a(config));
|
|
7143
|
+
var numOfColumnsInDataTable = dataTable.dimension.filter(function (d) {
|
|
7144
|
+
return d.pivot === 'y';
|
|
7145
|
+
}).length;
|
|
7146
|
+
var numOfColumnsInPartial = (_partial$dimension = partial.dimension) == null ? void 0 : _partial$dimension.filter(function (d) {
|
|
7147
|
+
return d.pivot === 'y';
|
|
7148
|
+
}).length;
|
|
7149
|
+
var dimensionColumnsHasChanged = numOfColumnsInPartial === undefined ? false : numOfColumnsInDataTable !== numOfColumnsInPartial;
|
|
7150
|
+
var shouldRemoveVisualFormatColumns = dimensionColumnsHasChanged && !partial.visualFormatColumns;
|
|
7151
|
+
if (shouldRemoveVisualFormatColumns) newAttributes.visualFormatColumns = [];
|
|
7117
7152
|
newAttributes = removeUnusedOrderFieldsFromTimeSeriesComponent(newAttributes);
|
|
7118
7153
|
return newAttributes;
|
|
7119
7154
|
};
|
|
@@ -7198,6 +7233,16 @@ var CONSTANTS$a = {
|
|
|
7198
7233
|
}
|
|
7199
7234
|
}
|
|
7200
7235
|
},
|
|
7236
|
+
kpi_summarisation: {
|
|
7237
|
+
type: 'kpiSummarisation',
|
|
7238
|
+
title: '',
|
|
7239
|
+
description: 'Show aggregate statistics above each column.'
|
|
7240
|
+
},
|
|
7241
|
+
visual_format: {
|
|
7242
|
+
type: 'visualFormat',
|
|
7243
|
+
title: 'Visual Format',
|
|
7244
|
+
description: 'Configure how the group column is displayed visually.'
|
|
7245
|
+
},
|
|
7201
7246
|
format: {
|
|
7202
7247
|
type: 'format',
|
|
7203
7248
|
title: 'Format',
|
|
@@ -7249,7 +7294,7 @@ var DataTable = function DataTable(config) {
|
|
|
7249
7294
|
return hydrated;
|
|
7250
7295
|
},
|
|
7251
7296
|
load: function load(dumped) {
|
|
7252
|
-
var _dumped$tags, _dumped$hiddenFields;
|
|
7297
|
+
var _dumped$tags, _dumped$hiddenFields, _dumped$summarizeKPIs, _dumped$visualFormatC;
|
|
7253
7298
|
return {
|
|
7254
7299
|
type: dumped.type,
|
|
7255
7300
|
measure: upcastMeasure(dumped.measure),
|
|
@@ -7275,7 +7320,9 @@ var DataTable = function DataTable(config) {
|
|
|
7275
7320
|
sizing: dumped.sizing,
|
|
7276
7321
|
tableDrilldown: upcastTableDrilldown(dumped.tableDrilldown),
|
|
7277
7322
|
tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
|
|
7278
|
-
hiddenFields: (_dumped$hiddenFields = dumped.hiddenFields) != null ? _dumped$hiddenFields : []
|
|
7323
|
+
hiddenFields: (_dumped$hiddenFields = dumped.hiddenFields) != null ? _dumped$hiddenFields : [],
|
|
7324
|
+
summarizeKPIs: (_dumped$summarizeKPIs = dumped.summarizeKPIs) != null ? _dumped$summarizeKPIs : false,
|
|
7325
|
+
visualFormatColumns: (_dumped$visualFormatC = dumped.visualFormatColumns) != null ? _dumped$visualFormatC : []
|
|
7279
7326
|
};
|
|
7280
7327
|
},
|
|
7281
7328
|
setAttributes: setAttributes$a(config),
|
|
@@ -7305,7 +7352,9 @@ var DataTable = function DataTable(config) {
|
|
|
7305
7352
|
sizing: {},
|
|
7306
7353
|
tableDrilldown: [],
|
|
7307
7354
|
tags: [],
|
|
7308
|
-
hiddenFields: []
|
|
7355
|
+
hiddenFields: [],
|
|
7356
|
+
summarizeKPIs: false,
|
|
7357
|
+
visualFormatColumns: []
|
|
7309
7358
|
}, overrides);
|
|
7310
7359
|
},
|
|
7311
7360
|
schema: attributesSchema$a(config),
|
|
@@ -7369,12 +7418,8 @@ var DataTable = function DataTable(config) {
|
|
|
7369
7418
|
return dimensionsForPivot(attrs.dimension, 'x');
|
|
7370
7419
|
},
|
|
7371
7420
|
testId: 'add-dimension'
|
|
7372
|
-
}),
|
|
7373
|
-
|
|
7374
|
-
maxOptions: 1,
|
|
7375
|
-
property: 'tableDrilldown'
|
|
7376
|
-
}
|
|
7377
|
-
}), _extends({}, namespace(CONSTANTS$a, 'field_metrics'), {
|
|
7421
|
+
}), // { ...namespace<'drilldown'>(CONSTANTS, 'drilldown'), options: { maxOptions: 1, property: 'tableDrilldown' } },
|
|
7422
|
+
_extends({}, namespace(CONSTANTS$a, 'field_metrics'), {
|
|
7378
7423
|
fieldFilterOptions: {
|
|
7379
7424
|
forComponent: 'dataTable'
|
|
7380
7425
|
},
|
|
@@ -7393,7 +7438,7 @@ var DataTable = function DataTable(config) {
|
|
|
7393
7438
|
},
|
|
7394
7439
|
formatPanelConfig: function formatPanelConfig() {
|
|
7395
7440
|
var _CONSTANTS$format_pan;
|
|
7396
|
-
return [headingConstant(CONSTANTS$a), _extends({}, namespace(CONSTANTS$a, 'format'), {
|
|
7441
|
+
return [headingConstant(CONSTANTS$a), namespace(CONSTANTS$a, 'kpi_summarisation'), namespace(CONSTANTS$a, 'visual_format'), _extends({}, namespace(CONSTANTS$a, 'format'), {
|
|
7397
7442
|
subSection: [(_CONSTANTS$format_pan = CONSTANTS$a.format_panel.format) == null ? void 0 : _CONSTANTS$format_pan.subSectionDefinition.time]
|
|
7398
7443
|
}), namespace(CONSTANTS$a, 'prefixes'), _extends({}, namespace(CONSTANTS$a, 'conditional_formatting'), {
|
|
7399
7444
|
ruleType: 'backgroundColor'
|
|
@@ -52102,7 +52147,9 @@ var defaultProps$7 = {
|
|
|
52102
52147
|
numberFormat: {},
|
|
52103
52148
|
sizing: {},
|
|
52104
52149
|
tableDrilldown: [],
|
|
52105
|
-
tags: []
|
|
52150
|
+
tags: [],
|
|
52151
|
+
summarizeKPIs: false,
|
|
52152
|
+
visualFormatColumns: []
|
|
52106
52153
|
};
|
|
52107
52154
|
|
|
52108
52155
|
function hasPrevious(offset) {
|
|
@@ -52226,6 +52273,11 @@ var thGroupRow = function thGroupRow(themedStyles) {
|
|
|
52226
52273
|
2: {
|
|
52227
52274
|
background: themedStyles == null || (_themedStyles$th11 = themedStyles.th) == null || (_themedStyles$th11 = _themedStyles$th11.level) == null ? void 0 : _themedStyles$th11[2].background
|
|
52228
52275
|
}
|
|
52276
|
+
},
|
|
52277
|
+
alignTop: {
|
|
52278
|
+
"true": {
|
|
52279
|
+
verticalAlign: 'top'
|
|
52280
|
+
}
|
|
52229
52281
|
}
|
|
52230
52282
|
}
|
|
52231
52283
|
}));
|
|
@@ -52626,7 +52678,8 @@ var TH = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
52626
52678
|
}));
|
|
52627
52679
|
} else if (props.scope === 'row') {
|
|
52628
52680
|
return tableStyles.thGroupRow(theme == null ? void 0 : theme.tables)(_extends({}, styleOptions, {
|
|
52629
|
-
deadSpace: props != null && props.deadSpace ? 'true' : undefined
|
|
52681
|
+
deadSpace: props != null && props.deadSpace ? 'true' : undefined,
|
|
52682
|
+
alignTop: true
|
|
52630
52683
|
}));
|
|
52631
52684
|
} else {
|
|
52632
52685
|
var _theme$tables2;
|
|
@@ -52652,6 +52705,7 @@ var TH = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
52652
52705
|
"data-clickenabled": clickEnabled ? 'true' : 'false',
|
|
52653
52706
|
onClick: props == null ? void 0 : props.onClick,
|
|
52654
52707
|
onKeyDown: handleRowClick,
|
|
52708
|
+
rowSpan: props.rowSpan,
|
|
52655
52709
|
children: [(props == null ? void 0 : props.dragSettings) && jsxRuntime.jsx(TableColumnResizer, _extends({}, props == null ? void 0 : props.dragSettings)), jsxRuntime.jsx("div", {
|
|
52656
52710
|
style: props.columnStyles,
|
|
52657
52711
|
className: styles({
|
|
@@ -52802,8 +52856,8 @@ var TR = function TR(props) {
|
|
|
52802
52856
|
return jsxRuntime.jsx("tr", {
|
|
52803
52857
|
"data-themeapi": props.odd ? 'tables.body.odd' : 'tables.body.even',
|
|
52804
52858
|
className: "" + tableStyles.tr(theme == null ? void 0 : theme.tables)({
|
|
52805
|
-
odd: props.odd &&
|
|
52806
|
-
even: props.even &&
|
|
52859
|
+
odd: props.odd && props.hover,
|
|
52860
|
+
even: props.even && props.hover
|
|
52807
52861
|
}),
|
|
52808
52862
|
"data-chipposition": "top.left",
|
|
52809
52863
|
"aria-expanded": props.expanded === true ? 'true' : (props == null ? void 0 : props.expanded) === false ? 'false' : undefined,
|
|
@@ -53217,7 +53271,8 @@ var button$4 = /*#__PURE__*/buildStyleOverrides({
|
|
|
53217
53271
|
height: '1.25rem',
|
|
53218
53272
|
width: '1.25rem',
|
|
53219
53273
|
'&:disabled': {
|
|
53220
|
-
opacity: 0.4
|
|
53274
|
+
opacity: 0.4,
|
|
53275
|
+
cursor: 'default'
|
|
53221
53276
|
}
|
|
53222
53277
|
});
|
|
53223
53278
|
var text$2 = /*#__PURE__*/buildStyleOverrides({
|
|
@@ -53253,8 +53308,8 @@ var Pagination = function Pagination(props) {
|
|
|
53253
53308
|
|
|
53254
53309
|
var getNumberFormat = function getNumberFormat(id, exportNames) {
|
|
53255
53310
|
if (exportNames[id]) return exportNames[id];
|
|
53256
|
-
if (isDatumKey(id)) return exportNames[toFieldId(id)];
|
|
53257
|
-
return
|
|
53311
|
+
if (isDatumKey(id) && exportNames[toFieldId(id)]) return exportNames[toFieldId(id)];
|
|
53312
|
+
return '_vizzly_compact';
|
|
53258
53313
|
};
|
|
53259
53314
|
|
|
53260
53315
|
/**
|
|
@@ -53367,34 +53422,6 @@ var findPrefix = function findPrefix(prefixes, resultField) {
|
|
|
53367
53422
|
})) == null ? void 0 : _prefixes$find.prefix;
|
|
53368
53423
|
};
|
|
53369
53424
|
|
|
53370
|
-
var consolidateTableHeadings = function consolidateTableHeadings(titles) {
|
|
53371
|
-
var result = [];
|
|
53372
|
-
var _loop = function _loop() {
|
|
53373
|
-
var content = _step.value;
|
|
53374
|
-
var existingCell = result.find(function (c) {
|
|
53375
|
-
return c.content === content.formatted;
|
|
53376
|
-
});
|
|
53377
|
-
if (existingCell) {
|
|
53378
|
-
existingCell.colSpan += 1;
|
|
53379
|
-
} else {
|
|
53380
|
-
result.push({
|
|
53381
|
-
content: content.formatted,
|
|
53382
|
-
colSpan: 1,
|
|
53383
|
-
unformatted: content.unformatted
|
|
53384
|
-
});
|
|
53385
|
-
}
|
|
53386
|
-
};
|
|
53387
|
-
for (var _iterator = _createForOfIteratorHelperLoose(titles), _step; !(_step = _iterator()).done;) {
|
|
53388
|
-
_loop();
|
|
53389
|
-
}
|
|
53390
|
-
return result;
|
|
53391
|
-
};
|
|
53392
|
-
function processValues(parsedDatumKey, formatter) {
|
|
53393
|
-
return parsedDatumKey.dimensionValues.map(function (value, valueIndex) {
|
|
53394
|
-
var fieldId = parsedDatumKey.dimensionKeys[valueIndex];
|
|
53395
|
-
return formatter(value, fieldId);
|
|
53396
|
-
}).join(', ');
|
|
53397
|
-
}
|
|
53398
53425
|
var getPivotTableGroupTitles = function getPivotTableGroupTitles(result, dimension, tableRepresentationFields, dateTimeFormatOptions, supportedTimeTruncFunctions) {
|
|
53399
53426
|
var show = _.some(dimension, function (d) {
|
|
53400
53427
|
return d.pivot == 'y';
|
|
@@ -53445,6 +53472,34 @@ var formatYAxisGroupValue = function formatYAxisGroupValue(result, resultFieldId
|
|
|
53445
53472
|
return "" + value;
|
|
53446
53473
|
}
|
|
53447
53474
|
};
|
|
53475
|
+
var consolidateTableHeadings = function consolidateTableHeadings(titles) {
|
|
53476
|
+
var result = [];
|
|
53477
|
+
var _loop = function _loop() {
|
|
53478
|
+
var content = _step.value;
|
|
53479
|
+
var existingCell = result.find(function (c) {
|
|
53480
|
+
return c.content === content.formatted;
|
|
53481
|
+
});
|
|
53482
|
+
if (existingCell) {
|
|
53483
|
+
existingCell.colSpan += 1;
|
|
53484
|
+
} else {
|
|
53485
|
+
result.push({
|
|
53486
|
+
content: content.formatted,
|
|
53487
|
+
colSpan: 1,
|
|
53488
|
+
unformatted: content.unformatted
|
|
53489
|
+
});
|
|
53490
|
+
}
|
|
53491
|
+
};
|
|
53492
|
+
for (var _iterator = _createForOfIteratorHelperLoose(titles), _step; !(_step = _iterator()).done;) {
|
|
53493
|
+
_loop();
|
|
53494
|
+
}
|
|
53495
|
+
return result;
|
|
53496
|
+
};
|
|
53497
|
+
function processValues(parsedDatumKey, formatter) {
|
|
53498
|
+
return parsedDatumKey.dimensionValues.map(function (value, valueIndex) {
|
|
53499
|
+
var fieldId = parsedDatumKey.dimensionKeys[valueIndex];
|
|
53500
|
+
return formatter(value, fieldId);
|
|
53501
|
+
}).join(', ');
|
|
53502
|
+
}
|
|
53448
53503
|
|
|
53449
53504
|
var getExportName = function getExportName(id, exportNames) {
|
|
53450
53505
|
if (exportNames[id]) return exportNames[id];
|
|
@@ -53681,6 +53736,83 @@ function getFormattedByRule(_ref) {
|
|
|
53681
53736
|
return {};
|
|
53682
53737
|
}
|
|
53683
53738
|
|
|
53739
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__$b() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
53740
|
+
var calculatePercentage = function calculatePercentage(value, max) {
|
|
53741
|
+
if (max === 0) return 0;
|
|
53742
|
+
if (value < 0) return 0;
|
|
53743
|
+
return value / max * 100;
|
|
53744
|
+
};
|
|
53745
|
+
var VisualFormatCell = function VisualFormatCell(_ref) {
|
|
53746
|
+
var value = _ref.value,
|
|
53747
|
+
displayValue = _ref.displayValue,
|
|
53748
|
+
columnName = _ref.columnName,
|
|
53749
|
+
visualFormatColumns = _ref.visualFormatColumns,
|
|
53750
|
+
columnValues = _ref.columnValues,
|
|
53751
|
+
conditionalFormattingColor = _ref.conditionalFormattingColor;
|
|
53752
|
+
var shouldShowHorizontalBar = visualFormatColumns.includes(columnName);
|
|
53753
|
+
var numericValue = Number(value);
|
|
53754
|
+
var isNumeric = !isNaN(numericValue);
|
|
53755
|
+
if (!shouldShowHorizontalBar && !isNumeric) {
|
|
53756
|
+
return jsxRuntime.jsx("span", {
|
|
53757
|
+
children: displayValue || value
|
|
53758
|
+
});
|
|
53759
|
+
}
|
|
53760
|
+
if (isNumeric) {
|
|
53761
|
+
var actualMax = Math.max.apply(Math, columnValues);
|
|
53762
|
+
var percentage = calculatePercentage(numericValue, actualMax);
|
|
53763
|
+
var barColor = conditionalFormattingColor || (shouldShowHorizontalBar ? '#2196f3' : '#4caf50');
|
|
53764
|
+
return jsxRuntime.jsxs("div", {
|
|
53765
|
+
style: {
|
|
53766
|
+
display: 'flex',
|
|
53767
|
+
alignItems: 'center',
|
|
53768
|
+
gap: '0.5rem',
|
|
53769
|
+
padding: '2px'
|
|
53770
|
+
},
|
|
53771
|
+
children: [!!value && jsxRuntime.jsxs("svg", {
|
|
53772
|
+
width: "70%",
|
|
53773
|
+
height: "20",
|
|
53774
|
+
style: {
|
|
53775
|
+
flexShrink: 0
|
|
53776
|
+
},
|
|
53777
|
+
children: [jsxRuntime.jsx("rect", {
|
|
53778
|
+
x: 0,
|
|
53779
|
+
y: 2,
|
|
53780
|
+
width: "100%",
|
|
53781
|
+
height: "16",
|
|
53782
|
+
fill: "#e0e0e0",
|
|
53783
|
+
rx: 2
|
|
53784
|
+
}), jsxRuntime.jsx("rect", {
|
|
53785
|
+
x: 0,
|
|
53786
|
+
y: 2,
|
|
53787
|
+
width: Math.max(4, percentage / 100 * 100) + "%",
|
|
53788
|
+
height: "16",
|
|
53789
|
+
fill: barColor,
|
|
53790
|
+
rx: 2,
|
|
53791
|
+
className: /*#__PURE__*/css$1.css( {
|
|
53792
|
+
name: "1qyjf6m-VisualFormatCell",
|
|
53793
|
+
styles: "cursor:pointer;transition:width 0.3s ease;label:VisualFormatCell;",
|
|
53794
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlZpc3VhbEZvcm1hdENlbGwudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZEeUIiLCJmaWxlIjoiVmlzdWFsRm9ybWF0Q2VsbC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgVGFibGVDb250ZW50IH0gZnJvbSAnc2hhcmVkLWxvZ2ljL3NyYy9EYXRhVGFibGUvdHlwZXMnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vY3NzJztcblxuaW50ZXJmYWNlIFZpc3VhbEZvcm1hdENlbGxQcm9wcyB7XG4gIHZhbHVlOiBUYWJsZUNvbnRlbnRbJ3ZhbHVlJ107XG4gIGRpc3BsYXlWYWx1ZTogVGFibGVDb250ZW50WydkaXNwbGF5VmFsdWUnXTtcbiAgY29sdW1uTmFtZTogc3RyaW5nO1xuICB2aXN1YWxGb3JtYXRDb2x1bW5zOiBzdHJpbmdbXTtcbiAgY29sdW1uVmFsdWVzOiBudW1iZXJbXTtcbiAgY29uZGl0aW9uYWxGb3JtYXR0aW5nQ29sb3I/OiBzdHJpbmc7XG59XG5cbmNvbnN0IGNhbGN1bGF0ZVBlcmNlbnRhZ2UgPSAodmFsdWU6IG51bWJlciwgbWF4OiBudW1iZXIpOiBudW1iZXIgPT4ge1xuICBpZiAobWF4ID09PSAwKSByZXR1cm4gMDtcbiAgaWYgKHZhbHVlIDwgMCkgcmV0dXJuIDA7XG4gIHJldHVybiAodmFsdWUgLyBtYXgpICogMTAwO1xufTtcblxuZXhwb3J0IGNvbnN0IFZpc3VhbEZvcm1hdENlbGw6IFJlYWN0LkZDPFZpc3VhbEZvcm1hdENlbGxQcm9wcz4gPSAoe1xuICB2YWx1ZSxcbiAgZGlzcGxheVZhbHVlLFxuICBjb2x1bW5OYW1lLFxuICB2aXN1YWxGb3JtYXRDb2x1bW5zLFxuICBjb2x1bW5WYWx1ZXMsXG4gIGNvbmRpdGlvbmFsRm9ybWF0dGluZ0NvbG9yLFxufSkgPT4ge1xuICBjb25zdCBzaG91bGRTaG93SG9yaXpvbnRhbEJhciA9IHZpc3VhbEZvcm1hdENvbHVtbnMuaW5jbHVkZXMoY29sdW1uTmFtZSk7XG5cbiAgY29uc3QgbnVtZXJpY1ZhbHVlID0gTnVtYmVyKHZhbHVlKTtcbiAgY29uc3QgaXNOdW1lcmljID0gIWlzTmFOKG51bWVyaWNWYWx1ZSk7XG5cbiAgaWYgKCFzaG91bGRTaG93SG9yaXpvbnRhbEJhciAmJiAhaXNOdW1lcmljKSB7XG4gICAgcmV0dXJuIDxzcGFuPntkaXNwbGF5VmFsdWUgfHwgdmFsdWV9PC9zcGFuPjtcbiAgfVxuXG4gIGlmIChpc051bWVyaWMpIHtcbiAgICBjb25zdCBhY3R1YWxNYXggPSBNYXRoLm1heCguLi5jb2x1bW5WYWx1ZXMpO1xuICAgIGNvbnN0IHBlcmNlbnRhZ2UgPSBjYWxjdWxhdGVQZXJjZW50YWdlKG51bWVyaWNWYWx1ZSwgYWN0dWFsTWF4KTtcbiAgICBjb25zdCBiYXJDb2xvciA9IGNvbmRpdGlvbmFsRm9ybWF0dGluZ0NvbG9yIHx8IChzaG91bGRTaG93SG9yaXpvbnRhbEJhciA/ICcjMjE5NmYzJyA6ICcjNGNhZjUwJyk7XG5cbiAgICByZXR1cm4gKFxuICAgICAgPGRpdlxuICAgICAgICBzdHlsZT17e1xuICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcbiAgICAgICAgICBhbGlnbkl0ZW1zOiAnY2VudGVyJyxcbiAgICAgICAgICBnYXA6ICcwLjVyZW0nLFxuICAgICAgICAgIHBhZGRpbmc6ICcycHgnLFxuICAgICAgICB9fVxuICAgICAgPlxuICAgICAgICB7ISF2YWx1ZSAmJiAoXG4gICAgICAgICAgPHN2ZyB3aWR0aD1cIjcwJVwiIGhlaWdodD1cIjIwXCIgc3R5bGU9e3sgZmxleFNocmluazogMCB9fT5cbiAgICAgICAgICAgIDxyZWN0IHg9ezB9IHk9ezJ9IHdpZHRoPVwiMTAwJVwiIGhlaWdodD1cIjE2XCIgZmlsbD1cIiNlMGUwZTBcIiByeD17Mn0gLz5cbiAgICAgICAgICAgIDxyZWN0XG4gICAgICAgICAgICAgIGtleT17J2JhclJlY3RLZXknfVxuICAgICAgICAgICAgICB4PXswfVxuICAgICAgICAgICAgICB5PXsyfVxuICAgICAgICAgICAgICB3aWR0aD17YCR7TWF0aC5tYXgoNCwgKHBlcmNlbnRhZ2UgLyAxMDApICogMTAwKX0lYH1cbiAgICAgICAgICAgICAgaGVpZ2h0PVwiMTZcIlxuICAgICAgICAgICAgICBmaWxsPXtiYXJDb2xvcn1cbiAgICAgICAgICAgICAgcng9ezJ9XG4gICAgICAgICAgICAgIGNsYXNzTmFtZT17Y3NzKHtcbiAgICAgICAgICAgICAgICBjdXJzb3I6ICdwb2ludGVyJyxcbiAgICAgICAgICAgICAgICB0cmFuc2l0aW9uOiAnd2lkdGggMC4zcyBlYXNlJyxcbiAgICAgICAgICAgICAgfSl9XG4gICAgICAgICAgICAvPlxuICAgICAgICAgIDwvc3ZnPlxuICAgICAgICApfVxuICAgICAgICA8c3BhblxuICAgICAgICAgIHN0eWxlPXt7XG4gICAgICAgICAgICBmb250U2l6ZTogJzAuODEyNXJlbScsXG4gICAgICAgICAgICBtaW5XaWR0aDogJ2ZpdC1jb250ZW50JyxcbiAgICAgICAgICAgIHdoaXRlU3BhY2U6ICdub3dyYXAnLFxuICAgICAgICAgICAgZm9udFdlaWdodDogc2hvdWxkU2hvd0hvcml6b250YWxCYXIgPyAnYm9sZCcgOiAnbm9ybWFsJyxcbiAgICAgICAgICAgIG1hcmdpbkxlZnQ6ICdhdXRvJyxcbiAgICAgICAgICAgIGZsZXhTaHJpbms6IDAsXG4gICAgICAgICAgfX1cbiAgICAgICAgPlxuICAgICAgICAgIHtkaXNwbGF5VmFsdWUgfHwgdmFsdWV9IHtzaG91bGRTaG93SG9yaXpvbnRhbEJhciA/ICfimIUnIDogJyd9XG4gICAgICAgIDwvc3Bhbj5cbiAgICAgIDwvZGl2PlxuICAgICk7XG4gIH1cblxuICByZXR1cm4gPHNwYW4+e2Rpc3BsYXlWYWx1ZSB8fCB2YWx1ZX08L3NwYW4+O1xufTtcbiJdfQ== */",
|
|
53795
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$b
|
|
53796
|
+
})
|
|
53797
|
+
}, 'barRectKey')]
|
|
53798
|
+
}), jsxRuntime.jsxs("span", {
|
|
53799
|
+
style: {
|
|
53800
|
+
fontSize: '0.8125rem',
|
|
53801
|
+
minWidth: 'fit-content',
|
|
53802
|
+
whiteSpace: 'nowrap',
|
|
53803
|
+
fontWeight: shouldShowHorizontalBar ? 'bold' : 'normal',
|
|
53804
|
+
marginLeft: 'auto',
|
|
53805
|
+
flexShrink: 0
|
|
53806
|
+
},
|
|
53807
|
+
children: [displayValue || value, " ", shouldShowHorizontalBar ? '★' : '']
|
|
53808
|
+
})]
|
|
53809
|
+
});
|
|
53810
|
+
}
|
|
53811
|
+
return jsxRuntime.jsx("span", {
|
|
53812
|
+
children: displayValue || value
|
|
53813
|
+
});
|
|
53814
|
+
};
|
|
53815
|
+
|
|
53684
53816
|
var DataTableTR = function DataTableTR(props) {
|
|
53685
53817
|
var row = props.row,
|
|
53686
53818
|
rowIndex = props.rowIndex,
|
|
@@ -53689,7 +53821,8 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
53689
53821
|
conditionalFormattingRules = props.conditionalFormattingRules,
|
|
53690
53822
|
dataSet = props.dataSet,
|
|
53691
53823
|
protectedFields = props.protectedFields,
|
|
53692
|
-
drilldownAction = props.drilldownAction
|
|
53824
|
+
drilldownAction = props.drilldownAction,
|
|
53825
|
+
rowSpan = props.rowSpan;
|
|
53693
53826
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
53694
53827
|
queryEngineConfig = _useDashboardBehaviou.queryEngineConfig,
|
|
53695
53828
|
textOverride = _useDashboardBehaviou.textOverride;
|
|
@@ -53701,8 +53834,8 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
53701
53834
|
if (tableRepresentation == null) return null;
|
|
53702
53835
|
var field = tableRepresentation.fields[cellIndex];
|
|
53703
53836
|
var canShowArrow = props.drilldown.length > 0 && cellIndex === 0;
|
|
53704
|
-
var width = buildColumnWidth(field.datumKey, props == null ? void 0 : props.sizing, props == null ? void 0 : props.defaultColumnWidth, props == null ? void 0 : props.alternativeColumnSizing);
|
|
53705
53837
|
var conditionalStyled;
|
|
53838
|
+
var conditionalFormattingToApply;
|
|
53706
53839
|
if (isDatumKey(field.datumKey)) {
|
|
53707
53840
|
var datum = parse(field.datumKey);
|
|
53708
53841
|
var dataPoint = {};
|
|
@@ -53714,18 +53847,61 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
53714
53847
|
datum.dimensionKeys.forEach(function (key, i) {
|
|
53715
53848
|
dataPoint[key] = datum.dimensionValues[i];
|
|
53716
53849
|
});
|
|
53717
|
-
|
|
53850
|
+
conditionalFormattingToApply = applyConditionFormattingRules(dimension, conditionalFormattingRules, dataPoint, field.datumKey, dataSet);
|
|
53718
53851
|
if (conditionalFormattingToApply) {
|
|
53719
53852
|
conditionalStyled = getFormattedByRule(conditionalFormattingToApply);
|
|
53720
53853
|
}
|
|
53721
53854
|
}
|
|
53722
53855
|
var component = props.renderTableCell(rowIndex, cellIndex, cell.value, field.datumKey);
|
|
53723
|
-
|
|
53856
|
+
var shouldApplyVisualFormat = false;
|
|
53857
|
+
if (props.visualFormatColumns && field.dataType === 'number') {
|
|
53858
|
+
var groupedValues = props.visualFormatColumns.map(function (column) {
|
|
53859
|
+
return {
|
|
53860
|
+
originalValue: column,
|
|
53861
|
+
splitValues: column.split(',').map(function (val) {
|
|
53862
|
+
return val.trim();
|
|
53863
|
+
})
|
|
53864
|
+
};
|
|
53865
|
+
});
|
|
53866
|
+
shouldApplyVisualFormat = groupedValues.some(function (group) {
|
|
53867
|
+
return group.splitValues.every(function (value) {
|
|
53868
|
+
return field.datumKey && field.datumKey.includes(value) || field.id && field.id.includes(value);
|
|
53869
|
+
});
|
|
53870
|
+
});
|
|
53871
|
+
}
|
|
53872
|
+
var columnWidth = buildColumnWidth(field.datumKey, props == null ? void 0 : props.sizing, props == null ? void 0 : props.defaultColumnWidth, props == null ? void 0 : props.alternativeColumnSizing);
|
|
53873
|
+
var width = shouldApplyVisualFormat ? columnWidth * 1.5 : columnWidth;
|
|
53874
|
+
var columnValues = shouldApplyVisualFormat ? tableRepresentation.content.map(function (row) {
|
|
53875
|
+
var _row$cellIndex;
|
|
53876
|
+
return Number((_row$cellIndex = row[cellIndex]) == null ? void 0 : _row$cellIndex.value);
|
|
53877
|
+
}).filter(function (val) {
|
|
53878
|
+
return !isNaN(val);
|
|
53879
|
+
}) : [];
|
|
53880
|
+
var cellContent = component ? jsxRuntime.jsx(CustomCell, {
|
|
53881
|
+
component: component
|
|
53882
|
+
}) : cell.displayValue !== 'undefined' ? cell.displayValue : '';
|
|
53883
|
+
if (shouldApplyVisualFormat) {
|
|
53884
|
+
var conditionalFormattingColor;
|
|
53885
|
+
if (conditionalFormattingToApply && conditionalFormattingToApply.type === 'backgroundColor') {
|
|
53886
|
+
conditionalFormattingColor = conditionalFormattingToApply.value;
|
|
53887
|
+
}
|
|
53888
|
+
cellContent = jsxRuntime.jsx(VisualFormatCell, {
|
|
53889
|
+
value: cell.value,
|
|
53890
|
+
displayValue: cell.displayValue,
|
|
53891
|
+
columnName: field.datumKey || field.id,
|
|
53892
|
+
visualFormatColumns: props.visualFormatColumns || [],
|
|
53893
|
+
columnValues: columnValues,
|
|
53894
|
+
conditionalFormattingColor: conditionalFormattingColor
|
|
53895
|
+
});
|
|
53896
|
+
}
|
|
53897
|
+
var isDimensionColumn = findDimension(dimension, field.id, {
|
|
53724
53898
|
supportedAggregates: queryEngineConfig.supportedAggregates,
|
|
53725
53899
|
supportedTimeTruncFunctions: queryEngineConfig.supportedTimeTruncFunctions,
|
|
53726
53900
|
supportedTransformationFunctions: undefined
|
|
53727
|
-
})
|
|
53901
|
+
});
|
|
53902
|
+
if (isDimensionColumn) {
|
|
53728
53903
|
var _props$level;
|
|
53904
|
+
if (rowSpan[cellIndex] === undefined) return null;
|
|
53729
53905
|
return jsxRuntime.jsx(Table.TH, {
|
|
53730
53906
|
first: cellIndex === 0,
|
|
53731
53907
|
last: cellIndex + 1 === row.length,
|
|
@@ -53743,9 +53919,11 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
53743
53919
|
label: "" + cell.displayValue
|
|
53744
53920
|
} : undefined,
|
|
53745
53921
|
level: (_props$level = props == null ? void 0 : props.level) != null ? _props$level : undefined,
|
|
53746
|
-
|
|
53747
|
-
|
|
53748
|
-
|
|
53922
|
+
rowSpan: rowSpan[cellIndex],
|
|
53923
|
+
cellStyles: {
|
|
53924
|
+
borderBottom: '1px solid #c3c6ca'
|
|
53925
|
+
},
|
|
53926
|
+
children: cellContent
|
|
53749
53927
|
}, "table_row_" + rowIndex + "_cell_" + cellIndex);
|
|
53750
53928
|
}
|
|
53751
53929
|
return jsxRuntime.jsx(Table.TD, {
|
|
@@ -53757,7 +53935,7 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
53757
53935
|
align: field.dataType == 'number' ? 'alignRight' : 'alignLeft',
|
|
53758
53936
|
clickEnabled: hasProtectedFields(protectedFields),
|
|
53759
53937
|
simple: generatingPDF,
|
|
53760
|
-
style: _extends({}, props == null ? void 0 : props.cellStyles, conditionalStyled ? conditionalStyled : {}, {
|
|
53938
|
+
style: _extends({}, props == null ? void 0 : props.cellStyles, conditionalStyled && !shouldApplyVisualFormat ? conditionalStyled : {}, {
|
|
53761
53939
|
width: width,
|
|
53762
53940
|
maxWidth: width,
|
|
53763
53941
|
minWidth: width
|
|
@@ -53766,10 +53944,8 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
53766
53944
|
return props == null ? void 0 : props.setShowMore(cell.displayValue);
|
|
53767
53945
|
},
|
|
53768
53946
|
showMoreLabel: textOverride('table_settings.show_more', 'Show more'),
|
|
53769
|
-
customRender: !!component,
|
|
53770
|
-
children:
|
|
53771
|
-
component: component
|
|
53772
|
-
}) : cell.displayValue !== undefined ? cell.displayValue : ''
|
|
53947
|
+
customRender: !!component || shouldApplyVisualFormat,
|
|
53948
|
+
children: cellContent
|
|
53773
53949
|
}, "table_row_" + rowIndex + "_cell_" + cellIndex + "_" + JSON.stringify(cell.displayValue) + "}");
|
|
53774
53950
|
})
|
|
53775
53951
|
});
|
|
@@ -53843,6 +54019,7 @@ var DataTableRow = function DataTableRow(props) {
|
|
|
53843
54019
|
even: rowIndex % 2 === 0,
|
|
53844
54020
|
level: drilldown ? 1 : undefined,
|
|
53845
54021
|
expanded: drilldown ? expanded : undefined,
|
|
54022
|
+
hover: false,
|
|
53846
54023
|
children: jsxRuntime.jsx(DataTableTR, _extends({}, props, {
|
|
53847
54024
|
drilldownAction: hasDrilldown ? {
|
|
53848
54025
|
onExpanded: handleOnExpand,
|
|
@@ -54177,6 +54354,115 @@ var buildConditionalFormattingBoundaries = function buildConditionalFormattingBo
|
|
|
54177
54354
|
return conditionalFormattingBoundaries;
|
|
54178
54355
|
};
|
|
54179
54356
|
|
|
54357
|
+
var KPISummaryHeader = function KPISummaryHeader(_ref) {
|
|
54358
|
+
var tableRepresentation = _ref.tableRepresentation,
|
|
54359
|
+
KPIResults = _ref.KPIResults,
|
|
54360
|
+
dimensionXFields = _ref.dimensionXFields;
|
|
54361
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
54362
|
+
textOverride = _useDashboardBehaviou.textOverride;
|
|
54363
|
+
var _useDashboardContext = useDashboardContext(),
|
|
54364
|
+
generatingPDF = _useDashboardContext.generatingPDF;
|
|
54365
|
+
var cellStyles = {
|
|
54366
|
+
backgroundColor: '#f8f9fa',
|
|
54367
|
+
fontWeight: 'bold',
|
|
54368
|
+
padding: '8px',
|
|
54369
|
+
fontSize: '0.8125rem',
|
|
54370
|
+
borderBottom: '1px solid #c3c6ca',
|
|
54371
|
+
borderRight: '1px solid #c3c6ca'
|
|
54372
|
+
};
|
|
54373
|
+
var summaryDataFields = tableRepresentation.fields.slice(dimensionXFields.length);
|
|
54374
|
+
var occurrencesMap = new Map();
|
|
54375
|
+
var KPISummaryValues = summaryDataFields.map(function (field) {
|
|
54376
|
+
var datumKey = parse(field.datumKey);
|
|
54377
|
+
var value = KPIResults == null ? void 0 : KPIResults.content.find(function (result) {
|
|
54378
|
+
return areAllStringsInArray(result.filter(function (item) {
|
|
54379
|
+
return typeof item !== 'number';
|
|
54380
|
+
}), datumKey.dimensionValues);
|
|
54381
|
+
});
|
|
54382
|
+
if (!value) return undefined;
|
|
54383
|
+
var occurrenceKey = value.filter(function (item) {
|
|
54384
|
+
return typeof item !== 'number';
|
|
54385
|
+
}).join('|');
|
|
54386
|
+
var offSet = (value.filter(function (item) {
|
|
54387
|
+
return typeof item !== 'number';
|
|
54388
|
+
}).length || 1) - 1;
|
|
54389
|
+
if (occurrencesMap.has(occurrenceKey)) {
|
|
54390
|
+
var occurrences = occurrencesMap.get(occurrenceKey) || 0;
|
|
54391
|
+
occurrencesMap.set(occurrenceKey, occurrences + 1);
|
|
54392
|
+
return value[offSet + occurrences + 1];
|
|
54393
|
+
}
|
|
54394
|
+
occurrencesMap.set(occurrenceKey, 1);
|
|
54395
|
+
return value[offSet + 1];
|
|
54396
|
+
});
|
|
54397
|
+
return jsxRuntime.jsxs(Table.HeadTR, {
|
|
54398
|
+
children: [jsxRuntime.jsx(Table.TH, {
|
|
54399
|
+
cellStyles: cellStyles,
|
|
54400
|
+
simple: generatingPDF,
|
|
54401
|
+
colSpan: dimensionXFields.length,
|
|
54402
|
+
children: textOverride('data_table.kpi_summary', 'KPI Summary')
|
|
54403
|
+
}, "kpi-label"), summaryDataFields.map(function (field, fieldIndex) {
|
|
54404
|
+
if (field.hidden) return null;
|
|
54405
|
+
var KPIValue = KPISummaryValues ? KPISummaryValues[fieldIndex] : 0;
|
|
54406
|
+
var isCustomMetric = field["function"] === 'none';
|
|
54407
|
+
return jsxRuntime.jsx(Table.TH, {
|
|
54408
|
+
cellStyles: cellStyles,
|
|
54409
|
+
simple: generatingPDF,
|
|
54410
|
+
children: jsxRuntime.jsxs("div", {
|
|
54411
|
+
style: {
|
|
54412
|
+
display: 'flex',
|
|
54413
|
+
alignItems: 'center',
|
|
54414
|
+
fontSize: '0.8125rem',
|
|
54415
|
+
gap: '3px'
|
|
54416
|
+
},
|
|
54417
|
+
children: [!isCustomMetric && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
54418
|
+
children: [jsxRuntime.jsx("div", {
|
|
54419
|
+
style: {
|
|
54420
|
+
fontWeight: 'bold'
|
|
54421
|
+
},
|
|
54422
|
+
children: textOverride("aggregate." + field["function"], field["function"])
|
|
54423
|
+
}), jsxRuntime.jsx("span", {
|
|
54424
|
+
children: "\u2022"
|
|
54425
|
+
})]
|
|
54426
|
+
}), jsxRuntime.jsx("div", {
|
|
54427
|
+
style: {
|
|
54428
|
+
textTransform: 'uppercase'
|
|
54429
|
+
},
|
|
54430
|
+
children: formatKPIValue(KPIValue, field.dataType)
|
|
54431
|
+
})]
|
|
54432
|
+
})
|
|
54433
|
+
}, "kpi-" + fieldIndex);
|
|
54434
|
+
})]
|
|
54435
|
+
});
|
|
54436
|
+
};
|
|
54437
|
+
var formatKPIValue = function formatKPIValue(value, dataType) {
|
|
54438
|
+
if (value === undefined || isNaN(value)) {
|
|
54439
|
+
return '-';
|
|
54440
|
+
}
|
|
54441
|
+
var Billion = 1000000000;
|
|
54442
|
+
var Million = 1000000;
|
|
54443
|
+
var Thousand = 1000;
|
|
54444
|
+
if (dataType === 'number') {
|
|
54445
|
+
if (Math.abs(value) >= Billion) {
|
|
54446
|
+
return (value / Billion).toFixed(2) + 'B';
|
|
54447
|
+
} else if (Math.abs(value) >= Million) {
|
|
54448
|
+
return (value / Million).toFixed(2) + 'M';
|
|
54449
|
+
} else if (Math.abs(value) >= 1000) {
|
|
54450
|
+
return (value / Thousand).toFixed(2) + 'K';
|
|
54451
|
+
} else {
|
|
54452
|
+
return value.toLocaleString(undefined, {
|
|
54453
|
+
minimumFractionDigits: 0,
|
|
54454
|
+
maximumFractionDigits: 2
|
|
54455
|
+
});
|
|
54456
|
+
}
|
|
54457
|
+
}
|
|
54458
|
+
return value.toString();
|
|
54459
|
+
};
|
|
54460
|
+
function areAllStringsInArray(stringsToCheck, targetArray) {
|
|
54461
|
+
return stringsToCheck.every(function (str) {
|
|
54462
|
+
return targetArray.includes(str);
|
|
54463
|
+
});
|
|
54464
|
+
}
|
|
54465
|
+
|
|
54180
54466
|
var DataTableView = function DataTableView(props) {
|
|
54181
54467
|
var _props$library, _props$viewId, _props$result, _props$result2, _props$result3, _props$result4, _props$library2;
|
|
54182
54468
|
var headerProps = {
|
|
@@ -54193,6 +54479,11 @@ var DataTableView = function DataTableView(props) {
|
|
|
54193
54479
|
setPartialAttributes: props.setPartialAttributes
|
|
54194
54480
|
};
|
|
54195
54481
|
var sizing = props.sizing;
|
|
54482
|
+
var _ref = props.pivotTablePagination || {},
|
|
54483
|
+
_ref$paginationStartI = _ref.paginationStartIndex,
|
|
54484
|
+
paginationStartIndex = _ref$paginationStartI === void 0 ? 0 : _ref$paginationStartI,
|
|
54485
|
+
_ref$paginationEndInd = _ref.paginationEndIndex,
|
|
54486
|
+
paginationEndIndex = _ref$paginationEndInd === void 0 ? 0 : _ref$paginationEndInd;
|
|
54196
54487
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
54197
54488
|
labelFormat = _useDashboardBehaviou.labelFormat,
|
|
54198
54489
|
textOverride = _useDashboardBehaviou.textOverride,
|
|
@@ -54203,8 +54494,6 @@ var DataTableView = function DataTableView(props) {
|
|
|
54203
54494
|
tableRef = _useWidth[0],
|
|
54204
54495
|
tableWidth = _useWidth[1];
|
|
54205
54496
|
var defaultColumnWidth = buildDefaultColumnWidth(tableWidth, (((_props$result = props.result) == null ? void 0 : _props$result.fields) || []).length);
|
|
54206
|
-
|
|
54207
|
-
// const alternativeColumnSizing = useResizingColumn();
|
|
54208
54497
|
var alternativeColumnSizing = {};
|
|
54209
54498
|
var handleResizedColumn = function handleResizedColumn(options) {
|
|
54210
54499
|
var _extends2;
|
|
@@ -54245,25 +54534,26 @@ var DataTableView = function DataTableView(props) {
|
|
|
54245
54534
|
valueAlias: valueAlias
|
|
54246
54535
|
});
|
|
54247
54536
|
}, [props.measure, props.xMeasure, props.yMeasure, props.result, props.dateTimeFormat, props.numberFormat, props.prefixes, props.dateTimeFormatOptions, props.numberFormatOptions, props.supportedAggregates, props.supportedTimeTruncFunctions, props == null ? void 0 : props.dimension]);
|
|
54248
|
-
var hidePaginations = ((_props$result2 = props.result) != null && _props$result2.content ? (_props$result3 = props.result) == null ? void 0 : _props$result3.content.length : 0) > (tableRepresentation ? tableRepresentation.content.length : 0);
|
|
54537
|
+
var hidePaginations = props.pivotTablePagination ? props.pivotTablePagination.totalRows <= props.pivotTablePagination.pageSize : ((_props$result2 = props.result) != null && _props$result2.content ? (_props$result3 = props.result) == null ? void 0 : _props$result3.content.length : 0) > (tableRepresentation ? tableRepresentation.content.length : 0);
|
|
54538
|
+
var isPivotTable = props.pivotTablePagination !== undefined;
|
|
54249
54539
|
var TableFooter = React.useMemo(function () {
|
|
54250
|
-
var _props$offset, _props$
|
|
54251
|
-
|
|
54252
|
-
|
|
54253
|
-
|
|
54254
|
-
|
|
54255
|
-
|
|
54256
|
-
|
|
54257
|
-
|
|
54258
|
-
|
|
54259
|
-
|
|
54260
|
-
|
|
54261
|
-
|
|
54262
|
-
|
|
54263
|
-
|
|
54264
|
-
|
|
54540
|
+
var _props$offset, _props$limit, _props$offset2;
|
|
54541
|
+
if (!props.result || hidePaginations || tableRepresentation === null) return null;
|
|
54542
|
+
var isNextDisabled = isPivotTable ? paginationEndIndex >= tableRepresentation.content.length : !hasNext({
|
|
54543
|
+
offset: (_props$offset = props.offset) != null ? _props$offset : 0,
|
|
54544
|
+
limit: (_props$limit = props.limit) != null ? _props$limit : 0,
|
|
54545
|
+
total: tableRepresentation ? tableRepresentation.content.length : 0
|
|
54546
|
+
});
|
|
54547
|
+
return jsxRuntime.jsx(Pagination, {
|
|
54548
|
+
offset: props == null ? void 0 : props.offset,
|
|
54549
|
+
limit: props == null ? void 0 : props.limit,
|
|
54550
|
+
onNext: props == null ? void 0 : props.onNext,
|
|
54551
|
+
onPrevious: props == null ? void 0 : props.onPrevious,
|
|
54552
|
+
previousDisabled: !hasPrevious((_props$offset2 = props.offset) != null ? _props$offset2 : 0),
|
|
54553
|
+
nextDisabled: isNextDisabled,
|
|
54554
|
+
textOverride: textOverride
|
|
54265
54555
|
});
|
|
54266
|
-
}, [props.offset, props.limit, props.onPrevious, props.onNext, (_props$result4 = props.result) == null ? void 0 : _props$result4.content.length, hidePaginations]);
|
|
54556
|
+
}, [props.offset, props.limit, props.onPrevious, props.onNext, (_props$result4 = props.result) == null ? void 0 : _props$result4.content.length, hidePaginations, tableRepresentation, isPivotTable, paginationEndIndex, textOverride]);
|
|
54267
54557
|
var lastPivotColumnId = React.useMemo(function () {
|
|
54268
54558
|
if (!tableRepresentation) return null;
|
|
54269
54559
|
return getLastPivotColumn(tableRepresentation, props.dimension, props.supportedAggregates, props.supportedTimeTruncFunctions);
|
|
@@ -54297,6 +54587,13 @@ var DataTableView = function DataTableView(props) {
|
|
|
54297
54587
|
var handleTableRender = function handleTableRender(rowIndex, cellIndex, value, fieldV2, additionalAttributes) {
|
|
54298
54588
|
return buildTableCell(props, cellIndex, rowIndex, value, fieldV2, additionalAttributes);
|
|
54299
54589
|
};
|
|
54590
|
+
var dimensionXFields = props.dimension.filter(function (dim) {
|
|
54591
|
+
return dim.pivot === 'x';
|
|
54592
|
+
}).map(function (dim) {
|
|
54593
|
+
return dim.field;
|
|
54594
|
+
}) || [];
|
|
54595
|
+
var tableBodyData = isPivotTable ? tableRepresentation.content.slice(paginationStartIndex, paginationEndIndex) : tableRepresentation.content;
|
|
54596
|
+
var spanRowMatrix = createSpanRowMatrix(tableBodyData);
|
|
54300
54597
|
return jsxRuntime.jsxs(ViewWrapper, {
|
|
54301
54598
|
queriesAreChanging: props.queriesAreChanging,
|
|
54302
54599
|
id: props.id,
|
|
@@ -54323,6 +54620,14 @@ var DataTableView = function DataTableView(props) {
|
|
|
54323
54620
|
children: groupingHeading.content
|
|
54324
54621
|
}, groupingHeading + "_" + headerIndex);
|
|
54325
54622
|
})
|
|
54623
|
+
}), props.summarizeKPIs && jsxRuntime.jsx(KPISummaryHeader, {
|
|
54624
|
+
tableRepresentation: tableRepresentation,
|
|
54625
|
+
numberFormat: props.numberFormat,
|
|
54626
|
+
numberFormatOptions: props.numberFormatOptions,
|
|
54627
|
+
supportedAggregates: props.supportedAggregates,
|
|
54628
|
+
supportedTimeTruncFunctions: props.supportedTimeTruncFunctions,
|
|
54629
|
+
KPIResults: props.KPIResults,
|
|
54630
|
+
dimensionXFields: dimensionXFields
|
|
54326
54631
|
}), jsxRuntime.jsx(Table.HeadTR, {
|
|
54327
54632
|
children: tableRepresentation.fields.map(function (field, headerIndex) {
|
|
54328
54633
|
if (field.hidden) return null;
|
|
@@ -54369,7 +54674,7 @@ var DataTableView = function DataTableView(props) {
|
|
|
54369
54674
|
})
|
|
54370
54675
|
})]
|
|
54371
54676
|
}), jsxRuntime.jsx(Table.Body, {
|
|
54372
|
-
children:
|
|
54677
|
+
children: tableBodyData.map(function (row, rowIndex) {
|
|
54373
54678
|
return jsxRuntime.jsx(DataTableRow, {
|
|
54374
54679
|
protectedFields: props == null ? void 0 : props.protectedFields,
|
|
54375
54680
|
dataSet: props == null ? void 0 : props.dataSet,
|
|
@@ -54384,10 +54689,12 @@ var DataTableView = function DataTableView(props) {
|
|
|
54384
54689
|
handleOnChange: handleOnChange,
|
|
54385
54690
|
handleTableCellRender: handleTableRender,
|
|
54386
54691
|
cellStyles: cellStyles,
|
|
54692
|
+
rowSpan: spanRowMatrix[rowIndex],
|
|
54387
54693
|
setShowMore: setShowMore,
|
|
54388
54694
|
drilldown: props.tableDrilldown,
|
|
54389
54695
|
drilldownInputProps: props == null ? void 0 : props.drilldownInputProps,
|
|
54390
|
-
queriesAreChanging: props.queriesAreChanging
|
|
54696
|
+
queriesAreChanging: props.queriesAreChanging,
|
|
54697
|
+
visualFormatColumns: props.visualFormatColumns
|
|
54391
54698
|
}, rowIndex);
|
|
54392
54699
|
})
|
|
54393
54700
|
})]
|
|
@@ -54406,33 +54713,148 @@ var DataTableView$1 = (function (props) {
|
|
|
54406
54713
|
return jsxRuntime.jsx(DataTableView, _extends({}, props));
|
|
54407
54714
|
});
|
|
54408
54715
|
|
|
54716
|
+
/**
|
|
54717
|
+
* Creates a matrix that tracks row span counts for each row in a table representation.
|
|
54718
|
+
* Groups consecutive rows with identical pivot groups and calculates how many rows each group spans.
|
|
54719
|
+
*
|
|
54720
|
+
* @param tableRepresentationContent - The 2D array representing table content
|
|
54721
|
+
* @returns A matrix where each cell contains the row span count for that position, or undefined if not a span start
|
|
54722
|
+
*/
|
|
54723
|
+
function createSpanRowMatrix(tableRepresentationContent) {
|
|
54724
|
+
var spanRowMatrix = [];
|
|
54725
|
+
var numRows = tableRepresentationContent.length;
|
|
54726
|
+
if (numRows === 0) return spanRowMatrix;
|
|
54727
|
+
var numCols = tableRepresentationContent[0].length;
|
|
54728
|
+
for (var i = 0; i < numRows; i++) {
|
|
54729
|
+
spanRowMatrix[i] = new Array(numCols).fill(undefined);
|
|
54730
|
+
}
|
|
54731
|
+
for (var col = 0; col < numCols; col++) {
|
|
54732
|
+
var pivotRow = 0;
|
|
54733
|
+
var spanCount = 0;
|
|
54734
|
+
var pivotGroup = createPivotGroup(tableRepresentationContent[pivotRow], col);
|
|
54735
|
+
for (var row = 0; row < numRows; row++) {
|
|
54736
|
+
if (createPivotGroup(tableRepresentationContent[row], col) === pivotGroup) {
|
|
54737
|
+
spanCount++;
|
|
54738
|
+
} else {
|
|
54739
|
+
spanRowMatrix[pivotRow][col] = spanCount;
|
|
54740
|
+
spanCount = 1;
|
|
54741
|
+
pivotRow = row;
|
|
54742
|
+
pivotGroup = createPivotGroup(tableRepresentationContent[pivotRow], col);
|
|
54743
|
+
}
|
|
54744
|
+
}
|
|
54745
|
+
spanRowMatrix[pivotRow][col] = spanCount;
|
|
54746
|
+
}
|
|
54747
|
+
return spanRowMatrix;
|
|
54748
|
+
}
|
|
54749
|
+
function createPivotGroup(row, col) {
|
|
54750
|
+
var result = '';
|
|
54751
|
+
for (var colIndex = 0; colIndex <= col; colIndex++) {
|
|
54752
|
+
var _row$colIndex;
|
|
54753
|
+
result += ((_row$colIndex = row[colIndex]) == null ? void 0 : _row$colIndex.displayValue) + ',';
|
|
54754
|
+
}
|
|
54755
|
+
return result;
|
|
54756
|
+
}
|
|
54757
|
+
|
|
54409
54758
|
var DataTable$2 = function DataTable(props) {
|
|
54759
|
+
var _attributes$timeDimen, _attributes$timeDimen2;
|
|
54410
54760
|
var _props$component = props.component,
|
|
54411
54761
|
attributes = _props$component.attributes,
|
|
54412
54762
|
localFilters = _props$component.localFilters;
|
|
54413
|
-
var
|
|
54763
|
+
var isPivotTable = attributes.dimension.some(function (dim) {
|
|
54764
|
+
return dim.pivot === 'y';
|
|
54765
|
+
});
|
|
54766
|
+
var attributesWithSortedDimension = _extends({}, attributes, {
|
|
54767
|
+
dimension: [].concat(attributes.dimension.filter(function (dim) {
|
|
54768
|
+
return dim.pivot !== 'y';
|
|
54769
|
+
}), attributes.dimension.filter(function (dim) {
|
|
54770
|
+
return dim.pivot === 'y';
|
|
54771
|
+
}))
|
|
54772
|
+
});
|
|
54773
|
+
var queryAttributes = isPivotTable ? _extends({}, attributesWithSortedDimension, {
|
|
54774
|
+
limit: 30000,
|
|
54775
|
+
offset: undefined
|
|
54776
|
+
}) : attributes;
|
|
54777
|
+
var kpiSummaryQuery = _extends({}, attributes, {
|
|
54778
|
+
limit: undefined,
|
|
54779
|
+
offset: undefined,
|
|
54780
|
+
dimension: attributes.dimension.filter(function (dim) {
|
|
54781
|
+
return dim.pivot === 'y';
|
|
54782
|
+
})
|
|
54783
|
+
});
|
|
54784
|
+
var queries = [_extends({}, queryAttributes, {
|
|
54785
|
+
timeDimension: (_attributes$timeDimen = attributes.timeDimension) != null ? _attributes$timeDimen : null
|
|
54786
|
+
}), _extends({}, kpiSummaryQuery, {
|
|
54787
|
+
timeDimension: (_attributes$timeDimen2 = attributes.timeDimension) != null ? _attributes$timeDimen2 : null
|
|
54788
|
+
})];
|
|
54789
|
+
var _useQueryEffect = useQueryEffect(queries, props.runQueriesCallback, {
|
|
54414
54790
|
localFilters: localFilters,
|
|
54415
54791
|
globalFilters: props.globalFilters
|
|
54416
54792
|
}, props.dataSet, undefined, props.dashboardBehaviour.variables),
|
|
54417
|
-
|
|
54418
|
-
|
|
54793
|
+
results = _useQueryEffect.results,
|
|
54794
|
+
queriesAreChanging = _useQueryEffect.queriesAreChanging;
|
|
54795
|
+
var KPIResults = results[1];
|
|
54796
|
+
var _useState = React.useState(0),
|
|
54797
|
+
page = _useState[0],
|
|
54798
|
+
setPage = _useState[1];
|
|
54799
|
+
React.useEffect(function () {
|
|
54800
|
+
setPage(0);
|
|
54801
|
+
}, [attributes.dimension, attributes.measure, localFilters, props.globalFilters]);
|
|
54802
|
+
var pageSize = attributes.limit || 10;
|
|
54803
|
+
var _useMemo = React.useMemo(function () {
|
|
54804
|
+
if (!isPivotTable || !results[0]) {
|
|
54805
|
+
return {
|
|
54806
|
+
paginatedResult: results[0],
|
|
54807
|
+
totalPivotRows: 0,
|
|
54808
|
+
paginationStartIndex: 0,
|
|
54809
|
+
paginationEndIndex: 0
|
|
54810
|
+
};
|
|
54811
|
+
}
|
|
54812
|
+
var fullResult = results[0];
|
|
54813
|
+
var totalRows = fullResult.content.length;
|
|
54814
|
+
var startGroupIndex = page * pageSize;
|
|
54815
|
+
var endGroupIndex = Math.min(startGroupIndex + pageSize, totalRows);
|
|
54816
|
+
return {
|
|
54817
|
+
paginatedResult: _extends({}, fullResult, {
|
|
54818
|
+
content: fullResult.content.slice(startGroupIndex, endGroupIndex)
|
|
54819
|
+
}),
|
|
54820
|
+
totalPivotRows: totalRows,
|
|
54821
|
+
paginationStartIndex: startGroupIndex,
|
|
54822
|
+
paginationEndIndex: endGroupIndex
|
|
54823
|
+
};
|
|
54824
|
+
}, [isPivotTable, results, page, pageSize]),
|
|
54825
|
+
paginationStartIndex = _useMemo.paginationStartIndex,
|
|
54826
|
+
paginationEndIndex = _useMemo.paginationEndIndex,
|
|
54827
|
+
totalPivotRows = _useMemo.totalPivotRows;
|
|
54828
|
+
var totalPages = isPivotTable ? Math.ceil(totalPivotRows / pageSize) : 1;
|
|
54419
54829
|
var onNext = function onNext() {
|
|
54420
|
-
|
|
54421
|
-
|
|
54422
|
-
|
|
54423
|
-
|
|
54424
|
-
|
|
54425
|
-
|
|
54426
|
-
|
|
54427
|
-
|
|
54428
|
-
|
|
54830
|
+
if (isPivotTable) {
|
|
54831
|
+
if (page < totalPages - 1) {
|
|
54832
|
+
setPage(page + 1);
|
|
54833
|
+
}
|
|
54834
|
+
} else {
|
|
54835
|
+
var _attributes$limit, _attributes$offset, _results$0$content$le, _results$;
|
|
54836
|
+
if (!hasNext({
|
|
54837
|
+
limit: (_attributes$limit = attributes.limit) != null ? _attributes$limit : 0,
|
|
54838
|
+
offset: (_attributes$offset = attributes.offset) != null ? _attributes$offset : 0,
|
|
54839
|
+
total: (_results$0$content$le = (_results$ = results[0]) == null ? void 0 : _results$.content.length) != null ? _results$0$content$le : 0
|
|
54840
|
+
})) return;
|
|
54841
|
+
props.updateComponentAttributes(_extends({}, attributes, {
|
|
54842
|
+
offset: nextOffset(attributes.offset, attributes.limit)
|
|
54843
|
+
}));
|
|
54844
|
+
}
|
|
54429
54845
|
};
|
|
54430
54846
|
var onPrevious = function onPrevious() {
|
|
54431
|
-
|
|
54432
|
-
|
|
54433
|
-
|
|
54434
|
-
|
|
54435
|
-
}
|
|
54847
|
+
if (isPivotTable) {
|
|
54848
|
+
if (page > 0) {
|
|
54849
|
+
setPage(page - 1);
|
|
54850
|
+
}
|
|
54851
|
+
} else {
|
|
54852
|
+
var _attributes$offset2;
|
|
54853
|
+
if (!hasPrevious((_attributes$offset2 = attributes.offset) != null ? _attributes$offset2 : 0)) return;
|
|
54854
|
+
props.updateComponentAttributes(_extends({}, attributes, {
|
|
54855
|
+
offset: previousOffset(attributes.offset, attributes.limit)
|
|
54856
|
+
}));
|
|
54857
|
+
}
|
|
54436
54858
|
};
|
|
54437
54859
|
var onOrder = function onOrder(_ref) {
|
|
54438
54860
|
var fieldId = _ref.fieldId,
|
|
@@ -54442,15 +54864,11 @@ var DataTable$2 = function DataTable(props) {
|
|
|
54442
54864
|
var currentFieldIndex = currentOrder.findIndex(function (o) {
|
|
54443
54865
|
return o.field === fieldId && o["function"] == func;
|
|
54444
54866
|
});
|
|
54445
|
-
|
|
54446
|
-
// Unset the direction -> remove it from the order
|
|
54447
54867
|
if (direction === null) {
|
|
54448
54868
|
currentOrder.splice(currentFieldIndex, 1);
|
|
54449
54869
|
} else if (currentFieldIndex > -1) {
|
|
54450
|
-
// if the current field already has an ordering rule -> update the direction
|
|
54451
54870
|
currentOrder[currentFieldIndex].direction = direction;
|
|
54452
54871
|
} else {
|
|
54453
|
-
// add a new order
|
|
54454
54872
|
currentOrder.push({
|
|
54455
54873
|
field: fieldId,
|
|
54456
54874
|
direction: direction,
|
|
@@ -54470,7 +54888,7 @@ var DataTable$2 = function DataTable(props) {
|
|
|
54470
54888
|
var onSetNumberFormat = function onSetNumberFormat(fieldId, numberFormatId) {
|
|
54471
54889
|
var newNumberformats = _extends({}, attributes.numberFormat);
|
|
54472
54890
|
if (!numberFormatId) {
|
|
54473
|
-
|
|
54891
|
+
newNumberformats[fieldId] = 'none';
|
|
54474
54892
|
} else {
|
|
54475
54893
|
newNumberformats[fieldId] = numberFormatId;
|
|
54476
54894
|
}
|
|
@@ -54484,13 +54902,9 @@ var DataTable$2 = function DataTable(props) {
|
|
|
54484
54902
|
}));
|
|
54485
54903
|
};
|
|
54486
54904
|
var result = results[0];
|
|
54487
|
-
|
|
54488
|
-
// If the result doesn't match the query, then wait by returning null
|
|
54489
54905
|
if (result && result.fields.length != attributes.dimension.length + attributes.measure.length) {
|
|
54490
54906
|
return null;
|
|
54491
54907
|
}
|
|
54492
|
-
|
|
54493
|
-
// Only show the table when the right result fields have been returned...
|
|
54494
54908
|
var requiredMeasureIds = attributes.measure.map(function (m) {
|
|
54495
54909
|
return id$2(m);
|
|
54496
54910
|
});
|
|
@@ -54504,7 +54918,11 @@ var DataTable$2 = function DataTable(props) {
|
|
|
54504
54918
|
return requiredDimensions.includes(field.id) || requiredMeasureIds.includes(field.id);
|
|
54505
54919
|
});
|
|
54506
54920
|
if (!show) return null;
|
|
54507
|
-
|
|
54921
|
+
var effectiveAttributes = isPivotTable ? _extends({}, attributes, {
|
|
54922
|
+
offset: page * pageSize,
|
|
54923
|
+
limit: pageSize
|
|
54924
|
+
}) : attributes;
|
|
54925
|
+
return jsxRuntime.jsx(DataTableView$1, _extends({}, effectiveAttributes, {
|
|
54508
54926
|
dataSet: props.dataSet,
|
|
54509
54927
|
onSetExportName: onSetExportName,
|
|
54510
54928
|
id: props.id,
|
|
@@ -54532,7 +54950,14 @@ var DataTable$2 = function DataTable(props) {
|
|
|
54532
54950
|
runQueriesCallback: props.runQueriesCallback,
|
|
54533
54951
|
globalFilters: props.globalFilters
|
|
54534
54952
|
},
|
|
54535
|
-
defaultFormats: props.dashboardBehaviour.defaultFormats
|
|
54953
|
+
defaultFormats: props.dashboardBehaviour.defaultFormats,
|
|
54954
|
+
KPIResults: KPIResults,
|
|
54955
|
+
pivotTablePagination: isPivotTable ? {
|
|
54956
|
+
totalRows: totalPivotRows,
|
|
54957
|
+
pageSize: pageSize,
|
|
54958
|
+
paginationStartIndex: paginationStartIndex,
|
|
54959
|
+
paginationEndIndex: paginationEndIndex
|
|
54960
|
+
} : undefined
|
|
54536
54961
|
}));
|
|
54537
54962
|
};
|
|
54538
54963
|
|
|
@@ -66503,6 +66928,137 @@ var WaterfallColorsSection = function WaterfallColorsSection(props) {
|
|
|
66503
66928
|
});
|
|
66504
66929
|
};
|
|
66505
66930
|
|
|
66931
|
+
var VisualFormatSection = function VisualFormatSection(props) {
|
|
66932
|
+
var _props$attributes$dim;
|
|
66933
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
66934
|
+
textOverride = _useDashboardBehaviou.textOverride,
|
|
66935
|
+
mode = _useDashboardBehaviou.mode;
|
|
66936
|
+
var previousYDimensionsRef = React.useRef([]);
|
|
66937
|
+
var editor = useEditor();
|
|
66938
|
+
var dashboardBehaviour = useDashboardBehaviourContext();
|
|
66939
|
+
var kpiSummaryQuery = _extends({}, props.attributes, {
|
|
66940
|
+
dimension: ((_props$attributes$dim = props.attributes.dimension) == null ? void 0 : _props$attributes$dim.filter(function (dim) {
|
|
66941
|
+
return dim.pivot === 'y';
|
|
66942
|
+
})) || [],
|
|
66943
|
+
measure: [],
|
|
66944
|
+
limit: undefined,
|
|
66945
|
+
offset: undefined
|
|
66946
|
+
});
|
|
66947
|
+
var _useQueryEffect = useQueryEffect(kpiSummaryQuery, (editor == null ? void 0 : editor.runQueriesCallback) || function () {
|
|
66948
|
+
return Promise.resolve([]);
|
|
66949
|
+
}, {
|
|
66950
|
+
localFilters: (editor == null ? void 0 : editor.component.localFilters) || [],
|
|
66951
|
+
globalFilters: []
|
|
66952
|
+
}, props.dataSet, undefined, dashboardBehaviour.variables),
|
|
66953
|
+
results = _useQueryEffect.results;
|
|
66954
|
+
var yDimensionsChanged = function yDimensionsChanged() {
|
|
66955
|
+
var _props$attributes$dim2;
|
|
66956
|
+
var currentYDimensions = ((_props$attributes$dim2 = props.attributes.dimension) == null ? void 0 : _props$attributes$dim2.filter(function (dim) {
|
|
66957
|
+
return dim.pivot === 'y';
|
|
66958
|
+
})) || [];
|
|
66959
|
+
var deepEqual = function deepEqual(a, b) {
|
|
66960
|
+
if (a.length !== b.length) return false;
|
|
66961
|
+
return a.every(function (item, index) {
|
|
66962
|
+
var _b$index, _b$index2, _b$index3;
|
|
66963
|
+
return item.field === ((_b$index = b[index]) == null ? void 0 : _b$index.field) && item["function"] === ((_b$index2 = b[index]) == null ? void 0 : _b$index2["function"]) && item.pivot === ((_b$index3 = b[index]) == null ? void 0 : _b$index3.pivot);
|
|
66964
|
+
});
|
|
66965
|
+
};
|
|
66966
|
+
var hasChanged = deepEqual(currentYDimensions, previousYDimensionsRef.current);
|
|
66967
|
+
if (hasChanged) previousYDimensionsRef.current = currentYDimensions;
|
|
66968
|
+
return hasChanged;
|
|
66969
|
+
};
|
|
66970
|
+
React.useEffect(function () {
|
|
66971
|
+
var _props$attributes$vis;
|
|
66972
|
+
if (yDimensionsChanged() && (((_props$attributes$vis = props.attributes.visualFormatColumns) == null ? void 0 : _props$attributes$vis.length) || 0) > 0) {
|
|
66973
|
+
props.setAttributes({
|
|
66974
|
+
visualFormatColumns: []
|
|
66975
|
+
});
|
|
66976
|
+
}
|
|
66977
|
+
}, [props.attributes.dimension]);
|
|
66978
|
+
var handleColumnAdd = function handleColumnAdd(field) {
|
|
66979
|
+
var currentColumns = props.attributes.visualFormatColumns || [];
|
|
66980
|
+
if (field && !currentColumns.includes(field)) {
|
|
66981
|
+
var newColumns = [].concat(currentColumns, [field]);
|
|
66982
|
+
props.setAttributes({
|
|
66983
|
+
visualFormatColumns: newColumns
|
|
66984
|
+
});
|
|
66985
|
+
} else {
|
|
66986
|
+
console.warn('Field is invalid or already exists:', field);
|
|
66987
|
+
}
|
|
66988
|
+
};
|
|
66989
|
+
var handleColumnRemove = function handleColumnRemove(itemIndex) {
|
|
66990
|
+
var currentColumns = props.attributes.visualFormatColumns || [];
|
|
66991
|
+
var newColumns = currentColumns.filter(function (_, index) {
|
|
66992
|
+
return index !== itemIndex;
|
|
66993
|
+
}).filter(function (item) {
|
|
66994
|
+
return item !== undefined && item !== null;
|
|
66995
|
+
});
|
|
66996
|
+
props.setAttributes({
|
|
66997
|
+
visualFormatColumns: newColumns
|
|
66998
|
+
});
|
|
66999
|
+
};
|
|
67000
|
+
var firstResult = results == null ? void 0 : results[0];
|
|
67001
|
+
var uniqueFirstValues = (firstResult == null ? void 0 : firstResult.content) || [];
|
|
67002
|
+
var availableFields = uniqueFirstValues.map(function (value) {
|
|
67003
|
+
return {
|
|
67004
|
+
title: value.join(', '),
|
|
67005
|
+
icon: 'string',
|
|
67006
|
+
value: value.join(', ')
|
|
67007
|
+
};
|
|
67008
|
+
});
|
|
67009
|
+
var selectedItems = (props.attributes.visualFormatColumns || []).map(function (columnId) {
|
|
67010
|
+
var field = availableFields.find(function (f) {
|
|
67011
|
+
return f.title === columnId;
|
|
67012
|
+
});
|
|
67013
|
+
return field || null;
|
|
67014
|
+
}).filter(function (item) {
|
|
67015
|
+
return item !== null;
|
|
67016
|
+
});
|
|
67017
|
+
return jsxRuntime.jsxs(Section, {
|
|
67018
|
+
title: props.section.title,
|
|
67019
|
+
children: [jsxRuntime.jsx(ListView, {
|
|
67020
|
+
mode: mode,
|
|
67021
|
+
onDeleteItem: handleColumnRemove,
|
|
67022
|
+
items: selectedItems,
|
|
67023
|
+
newItem: {
|
|
67024
|
+
callToAction: textOverride('visual_format.add_column', 'Add column'),
|
|
67025
|
+
onNew: handleColumnAdd,
|
|
67026
|
+
initValues: availableFields,
|
|
67027
|
+
hide: availableFields.length === 0
|
|
67028
|
+
},
|
|
67029
|
+
purpose: "visualFormat",
|
|
67030
|
+
testId: "visual-format-columns"
|
|
67031
|
+
}), availableFields.length === 0 && jsxRuntime.jsx("p", {
|
|
67032
|
+
style: {
|
|
67033
|
+
color: '#9ca3af',
|
|
67034
|
+
fontSize: '0.875rem',
|
|
67035
|
+
fontStyle: 'italic',
|
|
67036
|
+
margin: '1rem 0'
|
|
67037
|
+
},
|
|
67038
|
+
children: textOverride('visual_format.no_columns', 'No numeric columns available')
|
|
67039
|
+
})]
|
|
67040
|
+
});
|
|
67041
|
+
};
|
|
67042
|
+
|
|
67043
|
+
var KPISummarisationSection = function KPISummarisationSection(props) {
|
|
67044
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
67045
|
+
textOverride = _useDashboardBehaviou.textOverride;
|
|
67046
|
+
return jsxRuntime.jsx(Section, {
|
|
67047
|
+
title: props.section.title,
|
|
67048
|
+
children: jsxRuntime.jsx(Section.Grid, {
|
|
67049
|
+
children: jsxRuntime.jsx(Checkbox, {
|
|
67050
|
+
label: textOverride('kpi_summarisation.enable', 'Summarize KPIs'),
|
|
67051
|
+
currentValue: props.attributes.summarizeKPIs || false,
|
|
67052
|
+
onChange: function onChange(checked) {
|
|
67053
|
+
props.setAttributes({
|
|
67054
|
+
summarizeKPIs: checked
|
|
67055
|
+
});
|
|
67056
|
+
}
|
|
67057
|
+
})
|
|
67058
|
+
})
|
|
67059
|
+
});
|
|
67060
|
+
};
|
|
67061
|
+
|
|
66506
67062
|
var QuadrantSection = function QuadrantSection(props) {
|
|
66507
67063
|
var _props$attributes$qua, _props$attributes$qua2, _props$section;
|
|
66508
67064
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
@@ -66640,6 +67196,10 @@ var FormatPanelFromConfig = function FormatPanelFromConfig(props) {
|
|
|
66640
67196
|
section: section
|
|
66641
67197
|
})), section.type === 'richText' && jsxRuntime.jsx(RichTextFormatSection, _extends({}, props, {
|
|
66642
67198
|
section: section
|
|
67199
|
+
})), section.type === 'visualFormat' && jsxRuntime.jsx(VisualFormatSection, _extends({}, props, {
|
|
67200
|
+
section: section
|
|
67201
|
+
})), section.type === 'kpiSummarisation' && jsxRuntime.jsx(KPISummarisationSection, _extends({}, props, {
|
|
67202
|
+
section: section
|
|
66643
67203
|
})), section.type == 'trends' && jsxRuntime.jsx(TrendsSection, _extends({}, props, {
|
|
66644
67204
|
section: section
|
|
66645
67205
|
}))]
|