@vizzly/dashboard 0.15.0-dev-6114a3b52b10e59a48578b0bad33d5be5e0d850d → 0.15.0-dev-825e222034d95127ba57aec3c08d7617ffa39237
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 +73 -88
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +73 -88
- package/dist/shared-logic/src/Component/types.d.ts +1 -1
- package/dist/shared-logic/src/DataTable/VisualFormat/upcast.d.ts +2 -0
- package/dist/shared-ui/src/base/ListView/ListView.d.ts +1 -1
- package/dist/shared-ui/src/components/DataTable/DataTableRow.d.ts +1 -1
- package/dist/shared-ui/src/components/DataTable/DataTableTR.d.ts +1 -2
- package/dist/shared-ui/src/components/DataTable/VisualFormatCell.d.ts +4 -2
- package/dist/shared-ui/src/library/StylePanel/VisualFormatSection.d.ts +1 -1
- package/package.json +1 -1
package/dist/dashboard.esm.js
CHANGED
|
@@ -7224,7 +7224,10 @@ var attributesSchema$a = function attributesSchema(config) {
|
|
|
7224
7224
|
subsetDimension: Joi.string().required().description('The ID of the field in the data set to drill down by.')
|
|
7225
7225
|
})).description('Drilldown configuration for a pivot table.'),
|
|
7226
7226
|
summarizeKPIs: Joi["boolean"]()["default"](false).description('Enable/disable KPI summarisation above column headers.'),
|
|
7227
|
-
visualFormatColumns: Joi.array().items(Joi.
|
|
7227
|
+
visualFormatColumns: Joi.array().items(Joi.object({
|
|
7228
|
+
field: Joi.string(),
|
|
7229
|
+
"function": Joi.string()
|
|
7230
|
+
}))["default"]([]).description('Array of metrics to display as horizontal bars.'),
|
|
7228
7231
|
results: Joi.array().items(Joi.object({
|
|
7229
7232
|
content: Joi.array().required(),
|
|
7230
7233
|
fields: Joi.array().items(Joi.object({
|
|
@@ -7243,17 +7246,27 @@ var attributesSchema$a = function attributesSchema(config) {
|
|
|
7243
7246
|
|
|
7244
7247
|
var setAttributes$a = (function (config) {
|
|
7245
7248
|
return function (dataTable, partial) {
|
|
7246
|
-
var _partial$
|
|
7249
|
+
var _partial$measure;
|
|
7247
7250
|
var newAttributes = setAttributes(dataTable, partial, attributesSchema$a(config));
|
|
7248
|
-
var
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7251
|
+
var numOfMeasuresInDataTable = dataTable.measure.length;
|
|
7252
|
+
var numOfMeasuresInPartial = (_partial$measure = partial.measure) == null ? void 0 : _partial$measure.length;
|
|
7253
|
+
var hasRemovedMetrics = numOfMeasuresInPartial === undefined ? false : numOfMeasuresInDataTable > numOfMeasuresInPartial;
|
|
7254
|
+
if (hasRemovedMetrics) {
|
|
7255
|
+
var removedMetrics = dataTable.measure.filter(function (metric) {
|
|
7256
|
+
var _partial$measure2;
|
|
7257
|
+
return !((_partial$measure2 = partial.measure) != null && _partial$measure2.some(function (partialMetric) {
|
|
7258
|
+
return partialMetric.field === metric.field && partialMetric["function"] === metric["function"];
|
|
7259
|
+
}));
|
|
7260
|
+
});
|
|
7261
|
+
newAttributes.visualFormatColumns = (dataTable.visualFormatColumns || []).filter(function (column) {
|
|
7262
|
+
var isColumnUsingRemovedMetric = removedMetrics.some(function (removedMetric) {
|
|
7263
|
+
var fieldId = column.field;
|
|
7264
|
+
var aggregateFunction = column["function"];
|
|
7265
|
+
return removedMetric.field === fieldId && removedMetric["function"] === aggregateFunction;
|
|
7266
|
+
});
|
|
7267
|
+
return !isColumnUsingRemovedMetric;
|
|
7268
|
+
});
|
|
7269
|
+
}
|
|
7257
7270
|
newAttributes = removeUnusedOrderFieldsFromTimeSeriesComponent(newAttributes);
|
|
7258
7271
|
return newAttributes;
|
|
7259
7272
|
};
|
|
@@ -7374,6 +7387,13 @@ var CONSTANTS$a = {
|
|
|
7374
7387
|
}
|
|
7375
7388
|
};
|
|
7376
7389
|
|
|
7390
|
+
function filterOutOldVisualFormatContract(visualFormat) {
|
|
7391
|
+
var withoutOldContract = visualFormat.filter(function (measure) {
|
|
7392
|
+
return typeof measure !== 'string';
|
|
7393
|
+
});
|
|
7394
|
+
return withoutOldContract;
|
|
7395
|
+
}
|
|
7396
|
+
|
|
7377
7397
|
// Get the dimensions for a particular pivot.
|
|
7378
7398
|
var dimensionsForPivot = function dimensionsForPivot(dimension, pivot) {
|
|
7379
7399
|
return dimension.filter(function (d) {
|
|
@@ -7427,7 +7447,7 @@ var DataTable = function DataTable(config) {
|
|
|
7427
7447
|
tags: (_dumped$tags = dumped.tags) != null ? _dumped$tags : [],
|
|
7428
7448
|
hiddenFields: (_dumped$hiddenFields = dumped.hiddenFields) != null ? _dumped$hiddenFields : [],
|
|
7429
7449
|
summarizeKPIs: (_dumped$summarizeKPIs = dumped.summarizeKPIs) != null ? _dumped$summarizeKPIs : false,
|
|
7430
|
-
visualFormatColumns: (_dumped$visualFormatC = dumped.visualFormatColumns) != null ? _dumped$visualFormatC : []
|
|
7450
|
+
visualFormatColumns: filterOutOldVisualFormatContract((_dumped$visualFormatC = dumped.visualFormatColumns) != null ? _dumped$visualFormatC : [])
|
|
7431
7451
|
};
|
|
7432
7452
|
},
|
|
7433
7453
|
setAttributes: setAttributes$a(config),
|
|
@@ -54216,11 +54236,13 @@ var calculatePercentage = function calculatePercentage(value, max) {
|
|
|
54216
54236
|
var VisualFormatCell = function VisualFormatCell(_ref) {
|
|
54217
54237
|
var value = _ref.value,
|
|
54218
54238
|
displayValue = _ref.displayValue,
|
|
54219
|
-
|
|
54239
|
+
column = _ref.column,
|
|
54220
54240
|
visualFormatColumns = _ref.visualFormatColumns,
|
|
54221
54241
|
columnValues = _ref.columnValues,
|
|
54222
54242
|
conditionalFormattingColor = _ref.conditionalFormattingColor;
|
|
54223
|
-
var shouldShowHorizontalBar = visualFormatColumns.
|
|
54243
|
+
var shouldShowHorizontalBar = visualFormatColumns.some(function (vf) {
|
|
54244
|
+
return vf.field === column.fieldId && vf["function"] === column["function"];
|
|
54245
|
+
});
|
|
54224
54246
|
var numericValue = Number(value);
|
|
54225
54247
|
var isNumeric = !isNaN(numericValue);
|
|
54226
54248
|
if (!shouldShowHorizontalBar && !isNumeric) {
|
|
@@ -54231,7 +54253,7 @@ var VisualFormatCell = function VisualFormatCell(_ref) {
|
|
|
54231
54253
|
if (isNumeric) {
|
|
54232
54254
|
var actualMax = Math.max.apply(Math, columnValues);
|
|
54233
54255
|
var percentage = calculatePercentage(numericValue, actualMax);
|
|
54234
|
-
var barColor = conditionalFormattingColor
|
|
54256
|
+
var barColor = conditionalFormattingColor != null ? conditionalFormattingColor : '#4caf50';
|
|
54235
54257
|
return jsxs("div", {
|
|
54236
54258
|
style: {
|
|
54237
54259
|
display: 'flex',
|
|
@@ -54265,20 +54287,20 @@ var VisualFormatCell = function VisualFormatCell(_ref) {
|
|
|
54265
54287
|
} : {
|
|
54266
54288
|
name: "1qyjf6m-VisualFormatCell",
|
|
54267
54289
|
styles: "cursor:pointer;transition:width 0.3s ease;label:VisualFormatCell;",
|
|
54268
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
54290
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlZpc3VhbEZvcm1hdENlbGwudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWlFeUIiLCJmaWxlIjoiVmlzdWFsRm9ybWF0Q2VsbC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9jc3MnO1xuaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IFRhYmxlQ29udGVudCB9IGZyb20gJ3NoYXJlZC1sb2dpYy9zcmMvRGF0YVRhYmxlL3R5cGVzJztcbmltcG9ydCAqIGFzIERhdHVtS2V5IGZyb20gJ3NoYXJlZC1sb2dpYy9zcmMvRGF0dW1LZXknO1xuaW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uICAgICAgICAgICAgICBrZXk9eydiYXJSZWN0S2V5J31cbiAgICAgICAgICAgICAgeD17MH1cbiAgICAgICAgICAgICAgeT17Mn1cbiAgICAgICAgICAgICAgd2lkdGg9e2Ake01hdGgubWF4KDQsIChwZXJjZW50YWdlIC8gMTAwKSAqIDEwMCl9JWB9XG4gICAgICAgICAgICAgIGhlaWdodD1cIjE2XCJcbiAgICAgICAgICAgICAgZmlsbD17YmFyQ29sb3J9XG4gICAgICAgICAgICAgIHJ4PXsyfVxuICAgICAgICAgICAgICBjbGFzc05hbWU9e2Nzcyh7XG4gICAgICAgICAgICAgICAgY3Vyc29yOiAncG9pbnRlcicsXG4gICAgICAgICAgICAgICAgdHJhbnNpdGlvbjogJ3dpZHRoIDAuM3MgZWFzZScsXG4gICAgICAgICAgICAgIH0pfVxuICAgICAgICAgICAgLz5cbiAgICAgICAgICA8L3N2Zz5cbiAgICAgICAgKX1cbiAgICAgICAgPHNwYW5cbiAgICAgICAgICBzdHlsZT17e1xuICAgICAgICAgICAgZm9udFNpemU6ICcwLjgxMjVyZW0nLFxuICAgICAgICAgICAgbWluV2lkdGg6ICdmaXQtY29udGVudCcsXG4gICAgICAgICAgICB3aGl0ZVNwYWNlOiAnbm93cmFwJyxcbiAgICAgICAgICAgIGZvbnRXZWlnaHQ6ICdub3JtYWwnLFxuICAgICAgICAgICAgbWFyZ2luTGVmdDogJ2F1dG8nLFxuICAgICAgICAgICAgZmxleFNocmluazogMCxcbiAgICAgICAgICB9fVxuICAgICAgICA+XG4gICAgICAgICAge2Rpc3BsYXlWYWx1ZSA/PyB2YWx1ZX1cbiAgICAgICAgPC9zcGFuPlxuICAgICAgPC9kaXY+XG4gICAgKTtcbiAgfVxuXG4gIHJldHVybiA8c3Bhbj57ZGlzcGxheVZhbHVlIHx8IHZhbHVlfTwvc3Bhbj47XG59O1xuIl19 */",
|
|
54269
54291
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$b
|
|
54270
54292
|
})
|
|
54271
54293
|
}, 'barRectKey')]
|
|
54272
|
-
}),
|
|
54294
|
+
}), jsx("span", {
|
|
54273
54295
|
style: {
|
|
54274
54296
|
fontSize: '0.8125rem',
|
|
54275
54297
|
minWidth: 'fit-content',
|
|
54276
54298
|
whiteSpace: 'nowrap',
|
|
54277
|
-
fontWeight:
|
|
54299
|
+
fontWeight: 'normal',
|
|
54278
54300
|
marginLeft: 'auto',
|
|
54279
54301
|
flexShrink: 0
|
|
54280
54302
|
},
|
|
54281
|
-
children:
|
|
54303
|
+
children: displayValue != null ? displayValue : value
|
|
54282
54304
|
})]
|
|
54283
54305
|
});
|
|
54284
54306
|
}
|
|
@@ -54329,18 +54351,11 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
54329
54351
|
var component = props.renderTableCell(rowIndex, cellIndex, cell.value, field.datumKey);
|
|
54330
54352
|
var shouldApplyVisualFormat = false;
|
|
54331
54353
|
if (props.visualFormatColumns && field.dataType === 'number') {
|
|
54332
|
-
|
|
54333
|
-
|
|
54334
|
-
|
|
54335
|
-
|
|
54336
|
-
|
|
54337
|
-
})
|
|
54338
|
-
};
|
|
54339
|
-
});
|
|
54340
|
-
shouldApplyVisualFormat = groupedValues.some(function (group) {
|
|
54341
|
-
return group.splitValues.every(function (value) {
|
|
54342
|
-
return field.datumKey && field.datumKey.includes(value) || field.id && field.id.includes(value);
|
|
54343
|
-
});
|
|
54354
|
+
shouldApplyVisualFormat = props.visualFormatColumns.some(function (group) {
|
|
54355
|
+
var isSameField = parse(field.datumKey).fieldId === group.field;
|
|
54356
|
+
var isCustomMetric = group["function"] === 'none';
|
|
54357
|
+
var isSameAggregateFunction = parse(field.datumKey)["function"] === group["function"];
|
|
54358
|
+
return isSameField && (isCustomMetric || isSameAggregateFunction);
|
|
54344
54359
|
});
|
|
54345
54360
|
}
|
|
54346
54361
|
var columnWidth = buildColumnWidth(field.datumKey, props == null ? void 0 : props.sizing, props == null ? void 0 : props.defaultColumnWidth, props == null ? void 0 : props.alternativeColumnSizing);
|
|
@@ -54362,7 +54377,7 @@ var DataTableTR = function DataTableTR(props) {
|
|
|
54362
54377
|
cellContent = jsx(VisualFormatCell, {
|
|
54363
54378
|
value: cell.value,
|
|
54364
54379
|
displayValue: cell.displayValue,
|
|
54365
|
-
|
|
54380
|
+
column: parse(field.datumKey),
|
|
54366
54381
|
visualFormatColumns: props.visualFormatColumns || [],
|
|
54367
54382
|
columnValues: columnValues,
|
|
54368
54383
|
conditionalFormattingColor: conditionalFormattingColor
|
|
@@ -55098,7 +55113,7 @@ var DataTableView = function DataTableView(props) {
|
|
|
55098
55113
|
children: groupingHeading.content
|
|
55099
55114
|
}, groupingHeading + "_" + headerIndex);
|
|
55100
55115
|
})
|
|
55101
|
-
}), props.summarizeKPIs &&
|
|
55116
|
+
}), props.summarizeKPIs && dimensionXFields.length > 0 && jsx(KPISummaryHeader, {
|
|
55102
55117
|
tableRepresentation: tableRepresentation,
|
|
55103
55118
|
numberFormat: props.numberFormat,
|
|
55104
55119
|
numberFormatOptions: props.numberFormatOptions,
|
|
@@ -67485,55 +67500,17 @@ var WaterfallColorsSection = function WaterfallColorsSection(props) {
|
|
|
67485
67500
|
};
|
|
67486
67501
|
|
|
67487
67502
|
var VisualFormatSection = function VisualFormatSection(props) {
|
|
67488
|
-
var _props$attributes$dim;
|
|
67489
67503
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
67490
67504
|
textOverride = _useDashboardBehaviou.textOverride,
|
|
67491
|
-
mode = _useDashboardBehaviou.mode
|
|
67492
|
-
|
|
67493
|
-
var editor = useEditor();
|
|
67494
|
-
var dashboardBehaviour = useDashboardBehaviourContext();
|
|
67495
|
-
var kpiSummaryQuery = _extends({}, props.attributes, {
|
|
67496
|
-
dimension: ((_props$attributes$dim = props.attributes.dimension) == null ? void 0 : _props$attributes$dim.filter(function (dim) {
|
|
67497
|
-
return dim.pivot === 'y';
|
|
67498
|
-
})) || [],
|
|
67499
|
-
measure: [],
|
|
67500
|
-
limit: undefined,
|
|
67501
|
-
offset: undefined
|
|
67502
|
-
});
|
|
67503
|
-
var _useQueryEffect = useQueryEffect(kpiSummaryQuery, (editor == null ? void 0 : editor.runQueriesCallback) || function () {
|
|
67504
|
-
return Promise.resolve([]);
|
|
67505
|
-
}, {
|
|
67506
|
-
localFilters: (editor == null ? void 0 : editor.component.localFilters) || [],
|
|
67507
|
-
globalFilters: []
|
|
67508
|
-
}, props.dataSet, undefined, dashboardBehaviour.variables),
|
|
67509
|
-
results = _useQueryEffect.results;
|
|
67510
|
-
var yDimensionsChanged = function yDimensionsChanged() {
|
|
67511
|
-
var _props$attributes$dim2;
|
|
67512
|
-
var currentYDimensions = ((_props$attributes$dim2 = props.attributes.dimension) == null ? void 0 : _props$attributes$dim2.filter(function (dim) {
|
|
67513
|
-
return dim.pivot === 'y';
|
|
67514
|
-
})) || [];
|
|
67515
|
-
var deepEqual = function deepEqual(a, b) {
|
|
67516
|
-
if (a.length !== b.length) return false;
|
|
67517
|
-
return a.every(function (item, index) {
|
|
67518
|
-
var _b$index, _b$index2, _b$index3;
|
|
67519
|
-
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);
|
|
67520
|
-
});
|
|
67521
|
-
};
|
|
67522
|
-
var hasChanged = deepEqual(currentYDimensions, previousYDimensionsRef.current);
|
|
67523
|
-
if (hasChanged) previousYDimensionsRef.current = currentYDimensions;
|
|
67524
|
-
return hasChanged;
|
|
67525
|
-
};
|
|
67526
|
-
useEffect(function () {
|
|
67527
|
-
var _props$attributes$vis;
|
|
67528
|
-
if (yDimensionsChanged() && (((_props$attributes$vis = props.attributes.visualFormatColumns) == null ? void 0 : _props$attributes$vis.length) || 0) > 0) {
|
|
67529
|
-
props.setAttributes({
|
|
67530
|
-
visualFormatColumns: []
|
|
67531
|
-
});
|
|
67532
|
-
}
|
|
67533
|
-
}, [props.attributes.dimension]);
|
|
67505
|
+
mode = _useDashboardBehaviou.mode,
|
|
67506
|
+
queryEngineConfig = _useDashboardBehaviou.queryEngineConfig;
|
|
67534
67507
|
var handleColumnAdd = function handleColumnAdd(field) {
|
|
67535
|
-
var
|
|
67536
|
-
|
|
67508
|
+
var _props$attributes$vis;
|
|
67509
|
+
var currentColumns = (_props$attributes$vis = props.attributes.visualFormatColumns) != null ? _props$attributes$vis : [];
|
|
67510
|
+
var alreadyExists = currentColumns.some(function (col) {
|
|
67511
|
+
return col.field === field.field && col["function"] === field["function"];
|
|
67512
|
+
});
|
|
67513
|
+
if (!alreadyExists) {
|
|
67537
67514
|
var newColumns = [].concat(currentColumns, [field]);
|
|
67538
67515
|
props.setAttributes({
|
|
67539
67516
|
visualFormatColumns: newColumns
|
|
@@ -67553,18 +67530,26 @@ var VisualFormatSection = function VisualFormatSection(props) {
|
|
|
67553
67530
|
visualFormatColumns: newColumns
|
|
67554
67531
|
});
|
|
67555
67532
|
};
|
|
67556
|
-
var
|
|
67557
|
-
|
|
67558
|
-
|
|
67533
|
+
var availableFields = props.attributes.measure.map(function (measure) {
|
|
67534
|
+
var _aggregateFunction$va;
|
|
67535
|
+
var field = findField(props.dataSet, measure.field);
|
|
67536
|
+
var options = supportedAggregateOptions(field, queryEngineConfig.supportedAggregates);
|
|
67537
|
+
var aggregateFunction = options.find(function (opt) {
|
|
67538
|
+
return opt.value === measure["function"];
|
|
67539
|
+
});
|
|
67540
|
+
var isCustomMetric = (aggregateFunction == null ? void 0 : aggregateFunction.label) === undefined;
|
|
67559
67541
|
return {
|
|
67560
|
-
title:
|
|
67561
|
-
icon: '
|
|
67562
|
-
value:
|
|
67542
|
+
title: isCustomMetric ? "" + field.publicName : field.publicName + " ( " + (aggregateFunction == null ? void 0 : aggregateFunction.label) + " )",
|
|
67543
|
+
icon: 'number',
|
|
67544
|
+
value: {
|
|
67545
|
+
field: field.id,
|
|
67546
|
+
"function": (_aggregateFunction$va = aggregateFunction == null ? void 0 : aggregateFunction.value) != null ? _aggregateFunction$va : 'none'
|
|
67547
|
+
}
|
|
67563
67548
|
};
|
|
67564
67549
|
});
|
|
67565
|
-
var selectedItems = (props.attributes.visualFormatColumns || []).map(function (
|
|
67550
|
+
var selectedItems = (props.attributes.visualFormatColumns || []).map(function (visualFormat) {
|
|
67566
67551
|
var field = availableFields.find(function (f) {
|
|
67567
|
-
return f.
|
|
67552
|
+
return f.value.field === visualFormat.field;
|
|
67568
67553
|
});
|
|
67569
67554
|
return field || null;
|
|
67570
67555
|
}).filter(function (item) {
|
|
@@ -67591,7 +67576,7 @@ var VisualFormatSection = function VisualFormatSection(props) {
|
|
|
67591
67576
|
fontStyle: 'italic',
|
|
67592
67577
|
margin: '1rem 0'
|
|
67593
67578
|
},
|
|
67594
|
-
children: textOverride('visual_format.no_columns', 'No
|
|
67579
|
+
children: textOverride('visual_format.no_columns', 'No metrics available')
|
|
67595
67580
|
})]
|
|
67596
67581
|
});
|
|
67597
67582
|
};
|
|
@@ -394,7 +394,7 @@ export declare namespace Component {
|
|
|
394
394
|
export type DataTableAttributes = BaseAttributes & Omit<BaseQueryAttributes, 'timeDimension'> & TableAttributes & {
|
|
395
395
|
type: 'dataTable';
|
|
396
396
|
summarizeKPIs?: boolean;
|
|
397
|
-
visualFormatColumns?:
|
|
397
|
+
visualFormatColumns?: QueryAttributes.Measure[];
|
|
398
398
|
protectedFields?: ProtectedFields;
|
|
399
399
|
/**
|
|
400
400
|
* @deprecated
|
|
@@ -33,7 +33,7 @@ export declare type DataTableRowProps = {
|
|
|
33
33
|
cellStyles: React.CSSProperties;
|
|
34
34
|
setShowMore: React.Dispatch<React.SetStateAction<string | null>>;
|
|
35
35
|
queriesAreChanging?: boolean;
|
|
36
|
-
visualFormatColumns?:
|
|
36
|
+
visualFormatColumns?: QueryAttributes.Measure[];
|
|
37
37
|
rowSpan: (number | undefined)[];
|
|
38
38
|
};
|
|
39
39
|
export declare const DataTableRow: FunctionComponent<DataTableRowProps & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
-
import { DataTableRowProps } from './DataTableRow';
|
|
3
2
|
import { TableRepresentation } from '../../../../shared-logic/src/DataTable/types';
|
|
3
|
+
import { DataTableRowProps } from './DataTableRow';
|
|
4
4
|
export declare const DataTableTR: FunctionComponent<DataTableRowProps & {
|
|
5
5
|
drilldownAction?: {
|
|
6
6
|
onExpanded: (rowIndex?: number) => void;
|
|
@@ -10,6 +10,5 @@ export declare const DataTableTR: FunctionComponent<DataTableRowProps & {
|
|
|
10
10
|
subsetTableRepresentation?: TableRepresentation;
|
|
11
11
|
onViewClick: (rowIndex: number, cellIndex: number, value: string | number, datumKey: string) => void;
|
|
12
12
|
renderTableCell: (rowIndex: number, cellIndex: number, value: string | number, datumKey: string) => ReactNode | string;
|
|
13
|
-
visualFormatColumns?: string[];
|
|
14
13
|
rowSpan: (number | undefined)[];
|
|
15
14
|
}>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TableContent } from '../../../../shared-logic/src/DataTable/types';
|
|
3
|
+
import * as DatumKey from '../../../../shared-logic/src/DatumKey';
|
|
4
|
+
import { QueryAttributes } from '../../../../shared-logic/src/QueryAttributes/types';
|
|
3
5
|
interface VisualFormatCellProps {
|
|
4
6
|
value: TableContent['value'];
|
|
5
7
|
displayValue: TableContent['displayValue'];
|
|
6
|
-
|
|
7
|
-
visualFormatColumns:
|
|
8
|
+
column: DatumKey.ParsedDatumKey;
|
|
9
|
+
visualFormatColumns: QueryAttributes.Measure[];
|
|
8
10
|
columnValues: number[];
|
|
9
11
|
conditionalFormattingColor?: string;
|
|
10
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
|
-
import { VizzlyComponents } from '../../types';
|
|
3
2
|
import { VisualFormatSection as VisualFormatSectionType } from '../../../../shared-logic/src/FormatPanelConfig/types';
|
|
3
|
+
import { VizzlyComponents } from '../../types';
|
|
4
4
|
declare type VisualFormatSectionProps = VizzlyComponents.ComponentOverrides.Props.SectionProps<VisualFormatSectionType> & VizzlyComponents.EditorSectionProps<any>;
|
|
5
5
|
export declare const VisualFormatSection: FunctionComponent<VisualFormatSectionProps>;
|
|
6
6
|
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-825e222034d95127ba57aec3c08d7617ffa39237",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "./dist/dashboard/src/index.d.ts",
|
|
7
7
|
"module": "./dist/dashboard.esm.js",
|