@vizzly/dashboard 0.14.4-dev-3455fe16fbb312a7c23a46cc2f4bcf62b52bb944 → 0.14.4-dev-452014891c726bda8e71210563e32bb225b30c86
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/charts/src/v2/components/WaterfallChart/Legend.d.ts +3 -1
- package/dist/charts/src/v2/components/WaterfallChart/WaterfallChart.d.ts +3 -1
- package/dist/dashboard/src/contexts/GlobalProvider/useGlobalProvider.d.ts +12 -12
- package/dist/dashboard.cjs.development.js +79 -35
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +79 -35
- package/dist/shared-logic/src/Component/types.d.ts +2 -0
- package/dist/shared-logic/src/ComponentInterface/types/namespaces.types.d.ts +1 -0
- package/dist/shared-logic/src/FormatPanelConfig/types.d.ts +2 -1
- package/dist/shared-ui/src/library/StylePanel/WaterfallColorsSection.d.ts +7 -0
- package/package.json +1 -1
- package/dist/charts/src/v2/components/WaterfallChart/getBarFill.d.ts +0 -5
package/dist/dashboard.esm.js
CHANGED
|
@@ -10009,7 +10009,9 @@ var attributesSchema$h = function attributesSchema(config) {
|
|
|
10009
10009
|
parameters: parametersSchema(config.queryEngineConfig, config.attributesSchemaOptions),
|
|
10010
10010
|
axisTitles: axisTitleSchema(),
|
|
10011
10011
|
headline: headlineSchema(),
|
|
10012
|
-
tags: tagsSchema()
|
|
10012
|
+
tags: tagsSchema(),
|
|
10013
|
+
increaseColor: Joi.string().required(),
|
|
10014
|
+
decreaseColor: Joi.string().required()
|
|
10013
10015
|
}));
|
|
10014
10016
|
};
|
|
10015
10017
|
|
|
@@ -10173,6 +10175,11 @@ var CONSTANTS$j = {
|
|
|
10173
10175
|
type: 'headline',
|
|
10174
10176
|
title: 'Headline',
|
|
10175
10177
|
description: ''
|
|
10178
|
+
},
|
|
10179
|
+
waterfall_colors: {
|
|
10180
|
+
type: 'waterfallColors',
|
|
10181
|
+
title: 'Color selector',
|
|
10182
|
+
description: ''
|
|
10176
10183
|
}
|
|
10177
10184
|
}
|
|
10178
10185
|
};
|
|
@@ -10212,6 +10219,8 @@ var WaterfallChart = function WaterfallChart(config) {
|
|
|
10212
10219
|
axisTitles: dumped.axisTitles,
|
|
10213
10220
|
displaySubject: dumped.displaySubject,
|
|
10214
10221
|
displayTitle: dumped.displayTitle,
|
|
10222
|
+
increaseColor: dumped.increaseColor,
|
|
10223
|
+
decreaseColor: dumped.decreaseColor,
|
|
10215
10224
|
protectedByOrganisation: dumped.protectedByOrganisation,
|
|
10216
10225
|
type: dumped.type,
|
|
10217
10226
|
offset: dumped.offset
|
|
@@ -10246,6 +10255,8 @@ var WaterfallChart = function WaterfallChart(config) {
|
|
|
10246
10255
|
parameters: {},
|
|
10247
10256
|
axisTitles: undefined,
|
|
10248
10257
|
headline: undefined,
|
|
10258
|
+
increaseColor: '#00FF00',
|
|
10259
|
+
decreaseColor: '#FF0000',
|
|
10249
10260
|
tags: [],
|
|
10250
10261
|
approxXAxisLabelCount: 'auto',
|
|
10251
10262
|
approxYAxisLabelCount: 'auto'
|
|
@@ -10300,7 +10311,7 @@ var WaterfallChart = function WaterfallChart(config) {
|
|
|
10300
10311
|
}), namespace(CONSTANTS$j, 'sort'), namespace(CONSTANTS$j, 'filter'), namespace(CONSTANTS$j, 'custom_metrics'), namespace(CONSTANTS$j, 'limit')];
|
|
10301
10312
|
},
|
|
10302
10313
|
formatPanelConfig: function formatPanelConfig() {
|
|
10303
|
-
return [headingConstant(CONSTANTS$j), chartStylesConstant(CONSTANTS$j, false, false), axisLabelsConstants(CONSTANTS$j)];
|
|
10314
|
+
return [headingConstant(CONSTANTS$j), namespace(CONSTANTS$j, 'waterfall_colors'), chartStylesConstant(CONSTANTS$j, false, false), axisLabelsConstants(CONSTANTS$j)];
|
|
10304
10315
|
},
|
|
10305
10316
|
supportedCustomFields: {
|
|
10306
10317
|
percentages: true,
|
|
@@ -49159,30 +49170,6 @@ var BarChartV2 = function BarChartV2(props) {
|
|
|
49159
49170
|
});
|
|
49160
49171
|
};
|
|
49161
49172
|
|
|
49162
|
-
function getBarFill$1(bars, conditionalFormattingRules, barKey, barValues) {
|
|
49163
|
-
var _bars$find;
|
|
49164
|
-
// Default fill color from the corresponding bar
|
|
49165
|
-
var fill = (_bars$find = bars.find(function (chartBar) {
|
|
49166
|
-
return chartBar.yKey === barKey;
|
|
49167
|
-
})) == null ? void 0 : _bars$find.color;
|
|
49168
|
-
|
|
49169
|
-
// Determine the value based on barValues type
|
|
49170
|
-
var value = typeof barValues === 'number' ? barValues : barValues == null ? void 0 : barValues[barKey];
|
|
49171
|
-
if (typeof value === 'number') {
|
|
49172
|
-
for (var _iterator = _createForOfIteratorHelperLoose(conditionalFormattingRules), _step; !(_step = _iterator()).done;) {
|
|
49173
|
-
var rule = _step.value;
|
|
49174
|
-
if (compare({
|
|
49175
|
-
op: rule.operator,
|
|
49176
|
-
value: rule.value
|
|
49177
|
-
}, value)) {
|
|
49178
|
-
fill = rule.color;
|
|
49179
|
-
break;
|
|
49180
|
-
}
|
|
49181
|
-
}
|
|
49182
|
-
}
|
|
49183
|
-
return fill;
|
|
49184
|
-
}
|
|
49185
|
-
|
|
49186
49173
|
var ASSUMED_AVERAGE_CHAR_WIDTH$1 = 8.8;
|
|
49187
49174
|
function calculateWordWidth$1(word, avgCharWidth) {
|
|
49188
49175
|
if (avgCharWidth === void 0) {
|
|
@@ -49364,15 +49351,17 @@ var IconTrendingDown$1 = function IconTrendingDown() {
|
|
|
49364
49351
|
|
|
49365
49352
|
var Legend$2 = function Legend(_ref) {
|
|
49366
49353
|
var showLegend = _ref.showLegend,
|
|
49367
|
-
margin = _ref.margin
|
|
49354
|
+
margin = _ref.margin,
|
|
49355
|
+
increaseColor = _ref.increaseColor,
|
|
49356
|
+
decreaseColor = _ref.decreaseColor;
|
|
49368
49357
|
var items = [{
|
|
49369
|
-
color:
|
|
49358
|
+
color: increaseColor,
|
|
49370
49359
|
yKey: 'increase',
|
|
49371
49360
|
style: {
|
|
49372
49361
|
type: 'bar'
|
|
49373
49362
|
}
|
|
49374
49363
|
}, {
|
|
49375
|
-
color:
|
|
49364
|
+
color: decreaseColor,
|
|
49376
49365
|
yKey: 'decrease',
|
|
49377
49366
|
style: {
|
|
49378
49367
|
type: 'bar'
|
|
@@ -49416,7 +49405,9 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
49416
49405
|
options = _ref.options,
|
|
49417
49406
|
chart = _ref.chart,
|
|
49418
49407
|
steps = _ref.steps,
|
|
49419
|
-
theme = _ref.theme
|
|
49408
|
+
theme = _ref.theme,
|
|
49409
|
+
increaseColor = _ref.increaseColor,
|
|
49410
|
+
decreaseColor = _ref.decreaseColor;
|
|
49420
49411
|
//Waterfall TODO: fix chart for other x types
|
|
49421
49412
|
if (chart.x.scale.dataType === 'date_time' || chart.x.scale.dataType === 'number') {
|
|
49422
49413
|
return null;
|
|
@@ -49665,6 +49656,8 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
49665
49656
|
left: barGroup.x0,
|
|
49666
49657
|
children: barGroup.bars.map(function (bar) {
|
|
49667
49658
|
return jsx(Bar$1, {
|
|
49659
|
+
increaseColor: increaseColor,
|
|
49660
|
+
decreaseColor: decreaseColor,
|
|
49668
49661
|
bar: bar,
|
|
49669
49662
|
barGroup: barGroup,
|
|
49670
49663
|
yScale: yScale,
|
|
@@ -49685,7 +49678,9 @@ var WaterfallChart$2 = function WaterfallChart(_ref) {
|
|
|
49685
49678
|
})]
|
|
49686
49679
|
}), jsx(Legend$2, {
|
|
49687
49680
|
showLegend: options.showLegend,
|
|
49688
|
-
margin: margin
|
|
49681
|
+
margin: margin,
|
|
49682
|
+
increaseColor: increaseColor,
|
|
49683
|
+
decreaseColor: decreaseColor
|
|
49689
49684
|
}), jsx(Tooltip$2, {
|
|
49690
49685
|
showTooltip: tooltipOpen,
|
|
49691
49686
|
tooltipData: tooltipData,
|
|
@@ -49701,7 +49696,9 @@ var Bar$1 = function Bar(_ref4) {
|
|
|
49701
49696
|
var bar = _ref4.bar,
|
|
49702
49697
|
barGroup = _ref4.barGroup,
|
|
49703
49698
|
yScale = _ref4.yScale,
|
|
49704
|
-
formattedChartDataForBarChart = _ref4.formattedChartDataForBarChart
|
|
49699
|
+
formattedChartDataForBarChart = _ref4.formattedChartDataForBarChart,
|
|
49700
|
+
increaseColor = _ref4.increaseColor,
|
|
49701
|
+
decreaseColor = _ref4.decreaseColor;
|
|
49705
49702
|
var step = formattedChartDataForBarChart.steps[barGroup.index];
|
|
49706
49703
|
var y = yScale(Math.max(step.start, step.end));
|
|
49707
49704
|
var barHeight = Math.abs(yScale(step.start) - yScale(step.end));
|
|
@@ -49711,7 +49708,7 @@ var Bar$1 = function Bar(_ref4) {
|
|
|
49711
49708
|
y: y,
|
|
49712
49709
|
width: bar.width,
|
|
49713
49710
|
height: barHeight,
|
|
49714
|
-
fill:
|
|
49711
|
+
fill: bar.value > 0 ? increaseColor : decreaseColor,
|
|
49715
49712
|
rx: 4
|
|
49716
49713
|
}, "bar-group-bar-" + barGroup.index + "-" + bar.index + "-" + bar.value + "-" + bar.key)
|
|
49717
49714
|
});
|
|
@@ -49987,7 +49984,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
49987
49984
|
xAxisPrefix = props.xAxisPrefix,
|
|
49988
49985
|
yAxisFormat = props.yAxisFormat,
|
|
49989
49986
|
yAxisPostfix = props.yAxisPostfix,
|
|
49990
|
-
yAxisPrefix = props.yAxisPrefix
|
|
49987
|
+
yAxisPrefix = props.yAxisPrefix,
|
|
49988
|
+
increaseColor = props.increaseColor,
|
|
49989
|
+
decreaseColor = props.decreaseColor;
|
|
49991
49990
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
49992
49991
|
textOverride = _useDashboardBehaviou.textOverride,
|
|
49993
49992
|
valueAlias = _useDashboardBehaviou.valueAlias,
|
|
@@ -50081,7 +50080,9 @@ var WaterfallChartView = function WaterfallChartView(props) {
|
|
|
50081
50080
|
},
|
|
50082
50081
|
theme: theme == null ? void 0 : theme.charts,
|
|
50083
50082
|
chart: chartRepresentation,
|
|
50084
|
-
steps: steps
|
|
50083
|
+
steps: steps,
|
|
50084
|
+
increaseColor: increaseColor,
|
|
50085
|
+
decreaseColor: decreaseColor
|
|
50085
50086
|
});
|
|
50086
50087
|
}
|
|
50087
50088
|
})
|
|
@@ -60577,6 +60578,47 @@ var RichTextFormatSection = function RichTextFormatSection(props) {
|
|
|
60577
60578
|
});
|
|
60578
60579
|
};
|
|
60579
60580
|
|
|
60581
|
+
var WaterfallColorsSection = function WaterfallColorsSection(props) {
|
|
60582
|
+
var _props$section;
|
|
60583
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
60584
|
+
textOverride = _useDashboardBehaviou.textOverride;
|
|
60585
|
+
if (props.attributes.type != 'waterfallChart') return null;
|
|
60586
|
+
var _props$attributes = props.attributes,
|
|
60587
|
+
increaseColor = _props$attributes.increaseColor,
|
|
60588
|
+
decreaseColor = _props$attributes.decreaseColor;
|
|
60589
|
+
var debouncedSetAttributes = debounce$1(props.setAttributes, 200);
|
|
60590
|
+
return jsx(Section, {
|
|
60591
|
+
title: props == null ? void 0 : props.section.title,
|
|
60592
|
+
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
60593
|
+
children: jsxs(Section.Grid, {
|
|
60594
|
+
columns: 2,
|
|
60595
|
+
children: [jsx("div", {
|
|
60596
|
+
children: jsx(ColorInput, {
|
|
60597
|
+
id: 'waterfall-increase-color',
|
|
60598
|
+
label: textOverride('increase_color', 'Positive value'),
|
|
60599
|
+
currentValue: increaseColor,
|
|
60600
|
+
setColor: function setColor(increaseColor) {
|
|
60601
|
+
return debouncedSetAttributes({
|
|
60602
|
+
increaseColor: increaseColor
|
|
60603
|
+
});
|
|
60604
|
+
}
|
|
60605
|
+
})
|
|
60606
|
+
}), jsx("div", {
|
|
60607
|
+
children: jsx(ColorInput, {
|
|
60608
|
+
id: 'waterfall-decrease-color',
|
|
60609
|
+
label: textOverride('decrease_color', 'Negative value'),
|
|
60610
|
+
currentValue: decreaseColor,
|
|
60611
|
+
setColor: function setColor(decreaseColor) {
|
|
60612
|
+
return debouncedSetAttributes({
|
|
60613
|
+
decreaseColor: decreaseColor
|
|
60614
|
+
});
|
|
60615
|
+
}
|
|
60616
|
+
})
|
|
60617
|
+
})]
|
|
60618
|
+
})
|
|
60619
|
+
});
|
|
60620
|
+
};
|
|
60621
|
+
|
|
60580
60622
|
var FormatPanelFromConfig = function FormatPanelFromConfig(props) {
|
|
60581
60623
|
return jsx(EditorGrid, {
|
|
60582
60624
|
children: props == null ? void 0 : props.formatPanelConfig.map(function (section, i) {
|
|
@@ -60607,6 +60649,8 @@ var FormatPanelFromConfig = function FormatPanelFromConfig(props) {
|
|
|
60607
60649
|
section: section
|
|
60608
60650
|
})), section.type === 'mapColors' && jsx(MapColorsSection, _extends({}, props, {
|
|
60609
60651
|
section: section
|
|
60652
|
+
})), section.type === 'waterfallColors' && jsx(WaterfallColorsSection, _extends({}, props, {
|
|
60653
|
+
section: section
|
|
60610
60654
|
})), section.type === 'conditionalFormatting' && jsx(ConditionalFormattingSection, _extends({}, props, {
|
|
60611
60655
|
section: section
|
|
60612
60656
|
})), section.type === 'goalLine' && jsx(GoalLineSection, _extends({}, props, {
|
|
@@ -417,6 +417,8 @@ export declare namespace Component {
|
|
|
417
417
|
parameters?: Parameters;
|
|
418
418
|
axisTitles?: AxisTitles;
|
|
419
419
|
headline?: Headline;
|
|
420
|
+
increaseColor: string;
|
|
421
|
+
decreaseColor: string;
|
|
420
422
|
};
|
|
421
423
|
export type ViewType = 'areaChart' | 'barChart' | 'basicTable' | 'bubbleChart' | 'comboChart' | 'custom' | 'dataTable' | 'funnelChart' | 'horizontalBarChart' | 'lineChart' | 'lineChartV2' | 'areaChartV2' | 'barChartV2' | 'mercatorMap' | 'pieChart' | 'progress' | 'richText' | 'scatterChart' | 'singleStat' | 'waterfallChart' | 'radarChart';
|
|
422
424
|
export type Attributes = AreaChartAttributes | BarChartAttributes | BasicTableAttributes | BubbleChartAttributes | ComboChartAttributes | CustomViewAttributes | DataTableAttributes | FunnelChartAttributes | HorizontalBarChartAttributes | LineChartAttributes | LineChartV2Attributes | BarChartV2Attributes | AreaChartV2Attributes | MercatorMapAttributes | PieChartAttributes | ProgressAttributes | RichTextAttributes | ScatterChartAttributes | SingleStatAttributes | WaterfallChartAttributes | RadarChartAttributes;
|
|
@@ -106,6 +106,7 @@ export interface FormatPanelNamespaces {
|
|
|
106
106
|
};
|
|
107
107
|
goal_line?: Section<'goalLine'>;
|
|
108
108
|
map_colors?: Section<'mapColors'>;
|
|
109
|
+
waterfall_colors?: Section<'waterfallColors'>;
|
|
109
110
|
headline?: Section<'headline'>;
|
|
110
111
|
trends?: Section<'trends'>;
|
|
111
112
|
prefixes?: Section<'prefixes'>;
|
|
@@ -26,6 +26,7 @@ export declare type AxisLabelsSection = Section<'axisLabels'> & {
|
|
|
26
26
|
export declare type LabelsSection = Section<'statsLabels'> & LabelSection<'statsLabels'>;
|
|
27
27
|
export declare type PrefixSection = Section<'prefixes'>;
|
|
28
28
|
export declare type MapColorsSection = Section<'mapColors'>;
|
|
29
|
+
export declare type WaterfallColorsSection = Section<'waterfallColors'>;
|
|
29
30
|
export declare type HeadlineSection = Section<'headline'>;
|
|
30
31
|
export declare type RichTextFormatSection = Section<'richText'>;
|
|
31
32
|
export interface ConditionalFormattingSection extends Section<'conditionalFormatting'> {
|
|
@@ -41,5 +42,5 @@ export interface ProgressTypeSection<T> extends Omit<Section<T>, 'type'> {
|
|
|
41
42
|
progressType?: Omit<Section<T>, 'type'>;
|
|
42
43
|
}
|
|
43
44
|
export declare type ProgressTypesSection = Section<'progressType'> & ProgressTypeSection<'progressType'>;
|
|
44
|
-
export declare type FormatPanelSection = HeadingSection | FormatSection | ChartStylesSection | PrefixSection | AxisLabelsSection | LabelsSection | MapColorsSection | ConditionalFormattingSection | GoalLineSection | ProgressTypesSection | HeadlineSection | RichTextFormatSection | Section<'trends'>;
|
|
45
|
+
export declare type FormatPanelSection = HeadingSection | FormatSection | ChartStylesSection | PrefixSection | AxisLabelsSection | LabelsSection | MapColorsSection | WaterfallColorsSection | ConditionalFormattingSection | GoalLineSection | ProgressTypesSection | HeadlineSection | RichTextFormatSection | Section<'trends'>;
|
|
45
46
|
export declare type FormatPanelConfig = Array<FormatPanelSection>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { VizzlyComponents } from '../../types';
|
|
3
|
+
import { WaterfallColorsSection as WaterfallColorsSectionType } from '../../../../shared-logic/src/FormatPanelConfig/types';
|
|
4
|
+
import { Component } from '../../../../shared-logic/src/Component/types';
|
|
5
|
+
declare type Props = VizzlyComponents.ComponentOverrides.Props.SectionProps<WaterfallColorsSectionType> & VizzlyComponents.EditorSectionProps<Component.Attributes>;
|
|
6
|
+
export declare const WaterfallColorsSection: FunctionComponent<Props>;
|
|
7
|
+
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.14.4-dev-
|
|
4
|
+
"version": "0.14.4-dev-452014891c726bda8e71210563e32bb225b30c86",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "./dist/dashboard/src/index.d.ts",
|
|
7
7
|
"module": "./dist/dashboard.esm.js",
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ConditionalFormattingRule } from '../../../../../shared-logic/src/ChartsV2/types';
|
|
2
|
-
import { LegendItem } from '../../../../../shared-logic/src/WaterfallChart/types';
|
|
3
|
-
export declare function getBarFill(bars: LegendItem[], conditionalFormattingRules: ConditionalFormattingRule[], barKey: string, barValues?: {
|
|
4
|
-
[keyId: string]: string | number | Date | null;
|
|
5
|
-
} | number): string | undefined;
|