@vizzly/dashboard 0.15.0-dev-6f309335ad30223a136cf38b60f5e283e6f1dd6a → 0.15.0-dev-5e07d50132303e93a31030ec29ea7a18de5d4c24
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 +861 -774
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +861 -774
- package/dist/shared-ui/src/api/useQueryEffect.d.ts +3 -3
- package/dist/shared-ui/src/components/FormatPropsEditor/FormatPanelFromConfig.d.ts +1 -1
- package/dist/shared-ui/src/components/PieChart/PieChartView.d.ts +3 -3
- package/dist/shared-ui/src/components/SunburstChart/SunburstChartView.d.ts +5 -2
- package/dist/shared-ui/src/components/SunburstChart/convertDataToSunburstData.d.ts +8 -2
- package/package.json +1 -1
package/dist/dashboard.esm.js
CHANGED
|
@@ -5058,9 +5058,7 @@ var SunburstChart = function SunburstChart(config) {
|
|
|
5058
5058
|
},
|
|
5059
5059
|
formatPanelConfig: function formatPanelConfig() {
|
|
5060
5060
|
var _CONSTANTS$format_pan, _CONSTANTS$format_pan2, _CONSTANTS$format_pan3;
|
|
5061
|
-
return [headingConstant(CONSTANTS$4), _extends({}, namespace(CONSTANTS$4, '
|
|
5062
|
-
ruleType: 'backgroundColor'
|
|
5063
|
-
}), _extends({}, namespace(CONSTANTS$4, 'chart_styles'), {
|
|
5061
|
+
return [headingConstant(CONSTANTS$4), _extends({}, namespace(CONSTANTS$4, 'chart_styles'), {
|
|
5064
5062
|
subSection: [(_CONSTANTS$format_pan = CONSTANTS$4.format_panel.chart_styles) == null ? void 0 : _CONSTANTS$format_pan.subSectionDefinition.legend, (_CONSTANTS$format_pan2 = CONSTANTS$4.format_panel.chart_styles) == null ? void 0 : _CONSTANTS$format_pan2.subSectionDefinition.labels, (_CONSTANTS$format_pan3 = CONSTANTS$4.format_panel.chart_styles) == null ? void 0 : _CONSTANTS$format_pan3.subSectionDefinition.number_format]
|
|
5065
5063
|
})];
|
|
5066
5064
|
},
|
|
@@ -26142,33 +26140,6 @@ var buildFilterQuery = function buildFilterQuery(dataSet, fieldId, optionsFilter
|
|
|
26142
26140
|
};
|
|
26143
26141
|
};
|
|
26144
26142
|
|
|
26145
|
-
/** Returns a key to be used in an useEffect dependency, that changes if there's any change to a field in a data set. */
|
|
26146
|
-
var watchDataSetFieldChanges = function watchDataSetFieldChanges(dataSet, queryable) {
|
|
26147
|
-
if ('dataSetId' in queryable) {
|
|
26148
|
-
var watchFields = usedFields(queryable).map(function (field) {
|
|
26149
|
-
return field.fieldId;
|
|
26150
|
-
});
|
|
26151
|
-
|
|
26152
|
-
// Custom fields are the only ones that can have their definition changed. So
|
|
26153
|
-
// we only need to watch them.
|
|
26154
|
-
var watchedCustomFields = watchFields.flatMap(function (fieldId) {
|
|
26155
|
-
try {
|
|
26156
|
-
var dataSetField = findField(dataSet, fieldId);
|
|
26157
|
-
if (isCustomField(dataSetField)) return [dataSetField];
|
|
26158
|
-
return [];
|
|
26159
|
-
} catch (err) {
|
|
26160
|
-
if (err instanceof FieldNotFoundInDataSet) {
|
|
26161
|
-
return [];
|
|
26162
|
-
}
|
|
26163
|
-
throw err;
|
|
26164
|
-
}
|
|
26165
|
-
});
|
|
26166
|
-
return JSON.stringify(watchedCustomFields);
|
|
26167
|
-
} else {
|
|
26168
|
-
return '';
|
|
26169
|
-
}
|
|
26170
|
-
};
|
|
26171
|
-
|
|
26172
26143
|
function processPercentageField(dataSetField, processFiltersCallback) {
|
|
26173
26144
|
return [].concat(processFiltersCallback(dataSetField == null ? void 0 : dataSetField.denominatorFilter), processFiltersCallback(dataSetField == null ? void 0 : dataSetField.numeratorFilter));
|
|
26174
26145
|
}
|
|
@@ -26318,6 +26289,33 @@ var useVariablesInDataSet = function useVariablesInDataSet(dataSet, queryable, v
|
|
|
26318
26289
|
};
|
|
26319
26290
|
};
|
|
26320
26291
|
|
|
26292
|
+
/** Returns a key to be used in an useEffect dependency, that changes if there's any change to a field in a data set. */
|
|
26293
|
+
var watchDataSetFieldChanges = function watchDataSetFieldChanges(dataSet, queryable) {
|
|
26294
|
+
if ('dataSetId' in queryable) {
|
|
26295
|
+
var watchFields = usedFields(queryable).map(function (field) {
|
|
26296
|
+
return field.fieldId;
|
|
26297
|
+
});
|
|
26298
|
+
|
|
26299
|
+
// Custom fields are the only ones that can have their definition changed. So
|
|
26300
|
+
// we only need to watch them.
|
|
26301
|
+
var watchedCustomFields = watchFields.flatMap(function (fieldId) {
|
|
26302
|
+
try {
|
|
26303
|
+
var dataSetField = findField(dataSet, fieldId);
|
|
26304
|
+
if (isCustomField(dataSetField)) return [dataSetField];
|
|
26305
|
+
return [];
|
|
26306
|
+
} catch (err) {
|
|
26307
|
+
if (err instanceof FieldNotFoundInDataSet) {
|
|
26308
|
+
return [];
|
|
26309
|
+
}
|
|
26310
|
+
throw err;
|
|
26311
|
+
}
|
|
26312
|
+
});
|
|
26313
|
+
return JSON.stringify(watchedCustomFields);
|
|
26314
|
+
} else {
|
|
26315
|
+
return '';
|
|
26316
|
+
}
|
|
26317
|
+
};
|
|
26318
|
+
|
|
26321
26319
|
// How to make sure the queries run when a field in a data set has been changed.
|
|
26322
26320
|
// need to pass in the data sets here
|
|
26323
26321
|
|
|
@@ -26339,27 +26337,40 @@ var useQueryEffect = function useQueryEffect(queries, runQueriesCallback, filter
|
|
|
26339
26337
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
26340
26338
|
while (1) switch (_context.prev = _context.next) {
|
|
26341
26339
|
case 0:
|
|
26340
|
+
if (shouldFetch(queries, componentType)) {
|
|
26341
|
+
_context.next = 3;
|
|
26342
|
+
break;
|
|
26343
|
+
}
|
|
26344
|
+
setResults([]);
|
|
26345
|
+
return _context.abrupt("return");
|
|
26346
|
+
case 3:
|
|
26342
26347
|
setQueriesAreChanging(true);
|
|
26343
|
-
_context.next =
|
|
26348
|
+
_context.next = 6;
|
|
26344
26349
|
return fetch(queries, runQueriesCallback, abortController.signal, filterConfig);
|
|
26345
|
-
case
|
|
26350
|
+
case 6:
|
|
26346
26351
|
hasResults = _context.sent;
|
|
26347
|
-
if (hasResults) {
|
|
26348
|
-
|
|
26349
|
-
|
|
26350
|
-
// Only set the results if the signal was not aborted...
|
|
26351
|
-
setResults(hasResults);
|
|
26352
|
-
}
|
|
26353
|
-
} else {
|
|
26354
|
-
if (Array.isArray(queries)) {
|
|
26355
|
-
setResults(queries.map(function (_q) {
|
|
26356
|
-
return null;
|
|
26357
|
-
}));
|
|
26358
|
-
} else {
|
|
26359
|
-
setResults([null]);
|
|
26360
|
-
}
|
|
26352
|
+
if (!hasResults) {
|
|
26353
|
+
_context.next = 11;
|
|
26354
|
+
break;
|
|
26361
26355
|
}
|
|
26362
|
-
|
|
26356
|
+
setQueriesAreChanging(false);
|
|
26357
|
+
if (!abortController.signal.aborted) {
|
|
26358
|
+
// Only set the results if the signal was not aborted...
|
|
26359
|
+
setResults(hasResults);
|
|
26360
|
+
}
|
|
26361
|
+
return _context.abrupt("return");
|
|
26362
|
+
case 11:
|
|
26363
|
+
if (!Array.isArray(queries)) {
|
|
26364
|
+
_context.next = 14;
|
|
26365
|
+
break;
|
|
26366
|
+
}
|
|
26367
|
+
setResults(queries.map(function (_q) {
|
|
26368
|
+
return null;
|
|
26369
|
+
}));
|
|
26370
|
+
return _context.abrupt("return");
|
|
26371
|
+
case 14:
|
|
26372
|
+
setResults([null]);
|
|
26373
|
+
case 15:
|
|
26363
26374
|
case "end":
|
|
26364
26375
|
return _context.stop();
|
|
26365
26376
|
}
|
|
@@ -26386,6 +26397,16 @@ var useQueryEffect = function useQueryEffect(queries, runQueriesCallback, filter
|
|
|
26386
26397
|
queriesAreChanging: queriesAreChanging
|
|
26387
26398
|
};
|
|
26388
26399
|
};
|
|
26400
|
+
var shouldFetch = function shouldFetch(queries, componentType) {
|
|
26401
|
+
if (!componentType) {
|
|
26402
|
+
return true;
|
|
26403
|
+
}
|
|
26404
|
+
if (!ALL_COMPONENT_TYPES.includes(componentType)) {
|
|
26405
|
+
return false;
|
|
26406
|
+
}
|
|
26407
|
+
var componentInterface = getComponentInterface(componentType);
|
|
26408
|
+
return componentInterface.isRunnable(queries);
|
|
26409
|
+
};
|
|
26389
26410
|
|
|
26390
26411
|
/** Fetches unique field values for a given field. */
|
|
26391
26412
|
var useUniqueFieldValues = function useUniqueFieldValues(dataSet, fieldId) {
|
|
@@ -37600,112 +37621,54 @@ var ScatterChart$3 = function ScatterChart(props) {
|
|
|
37600
37621
|
}));
|
|
37601
37622
|
};
|
|
37602
37623
|
|
|
37603
|
-
|
|
37604
|
-
|
|
37605
|
-
|
|
37606
|
-
|
|
37607
|
-
|
|
37608
|
-
|
|
37609
|
-
|
|
37610
|
-
|
|
37611
|
-
|
|
37612
|
-
|
|
37613
|
-
|
|
37614
|
-
|
|
37615
|
-
|
|
37616
|
-
|
|
37617
|
-
|
|
37618
|
-
|
|
37619
|
-
|
|
37620
|
-
|
|
37621
|
-
|
|
37622
|
-
|
|
37623
|
-
|
|
37624
|
-
|
|
37625
|
-
|
|
37626
|
-
|
|
37627
|
-
|
|
37628
|
-
|
|
37629
|
-
|
|
37630
|
-
|
|
37631
|
-
|
|
37632
|
-
|
|
37633
|
-
|
|
37634
|
-
|
|
37635
|
-
|
|
37636
|
-
|
|
37637
|
-
|
|
37638
|
-
|
|
37639
|
-
|
|
37640
|
-
|
|
37641
|
-
|
|
37642
|
-
|
|
37643
|
-
|
|
37644
|
-
|
|
37645
|
-
|
|
37646
|
-
|
|
37647
|
-
}, yValues, {
|
|
37648
|
-
xValues: xValues
|
|
37649
|
-
});
|
|
37650
|
-
});
|
|
37651
|
-
var orderedRes = [];
|
|
37652
|
-
var dataPoints = {};
|
|
37653
|
-
duplicateDataPoints.forEach(function (dataPoint) {
|
|
37654
|
-
var current = dataPoints[dataPoint.x];
|
|
37655
|
-
|
|
37656
|
-
// Only add the x data point once if it already exists.
|
|
37657
|
-
if (!dataPoints[dataPoint.x]) {
|
|
37658
|
-
orderedRes.push(dataPoint.x);
|
|
37659
|
-
}
|
|
37660
|
-
dataPoints[dataPoint.x] = merge({}, current, dataPoint);
|
|
37661
|
-
});
|
|
37662
|
-
var resultSet = orderedRes.map(function (k) {
|
|
37663
|
-
return dataPoints[k];
|
|
37664
|
-
});
|
|
37665
|
-
return as100PercentResultSet ? to100PercentResultSet$1(resultSet) : resultSet;
|
|
37666
|
-
};
|
|
37667
|
-
var series$1 = function series(query, result, pivotConfig) {
|
|
37668
|
-
var keyValueResult = toKeyValueResults$1(result);
|
|
37669
|
-
var series = {};
|
|
37670
|
-
keyValueResult.forEach(function (dataPoint) {
|
|
37671
|
-
var yValues = [].concat(pivotConfig.y).map(function (k) {
|
|
37672
|
-
return dataPoint[k];
|
|
37673
|
-
});
|
|
37674
|
-
query.measure.forEach(function (measure) {
|
|
37675
|
-
var field = id$2(measure);
|
|
37676
|
-
var key$1 = key(pivotConfig.y, yValues, measure.field, measure["function"]);
|
|
37677
|
-
series[key$1] = {
|
|
37678
|
-
key: key$1,
|
|
37679
|
-
yValues: [].concat(yValues, [field]),
|
|
37680
|
-
name: [].concat(yValues, [field]).join(', ')
|
|
37624
|
+
function buildPieOnViewClick(onViewClick, clickedValue, dataSet, viewId, dimension, timeDimension, runViewClickQuery) {
|
|
37625
|
+
if (onViewClick) {
|
|
37626
|
+
var parsedDatum = parse(clickedValue.key);
|
|
37627
|
+
var objectToReturn = {
|
|
37628
|
+
viewId: viewId != null ? viewId : '',
|
|
37629
|
+
dataSet: {
|
|
37630
|
+
id: dataSet.id,
|
|
37631
|
+
name: dataSet.name,
|
|
37632
|
+
fields: dataSet.fields,
|
|
37633
|
+
description: dataSet.description
|
|
37634
|
+
},
|
|
37635
|
+
clicked: {
|
|
37636
|
+
value: {
|
|
37637
|
+
fieldId: parsedDatum.fieldId,
|
|
37638
|
+
"function": parsedDatum["function"],
|
|
37639
|
+
aggregate: 'none',
|
|
37640
|
+
value: clickedValue.datum[clickedValue.key]
|
|
37641
|
+
}
|
|
37642
|
+
},
|
|
37643
|
+
type: 'pieChart'
|
|
37644
|
+
};
|
|
37645
|
+
onViewClick(objectToReturn, /*#__PURE__*/function () {
|
|
37646
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(queries) {
|
|
37647
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
37648
|
+
while (1) switch (_context.prev = _context.next) {
|
|
37649
|
+
case 0:
|
|
37650
|
+
if (!(queries && runViewClickQuery)) {
|
|
37651
|
+
_context.next = 4;
|
|
37652
|
+
break;
|
|
37653
|
+
}
|
|
37654
|
+
_context.next = 3;
|
|
37655
|
+
return runViewClickQuery(queries, buildClickedOnFieldForQuery(id, parse, dimension, timeDimension, clickedValue));
|
|
37656
|
+
case 3:
|
|
37657
|
+
return _context.abrupt("return", _context.sent);
|
|
37658
|
+
case 4:
|
|
37659
|
+
return _context.abrupt("return", Promise.resolve(null));
|
|
37660
|
+
case 5:
|
|
37661
|
+
case "end":
|
|
37662
|
+
return _context.stop();
|
|
37663
|
+
}
|
|
37664
|
+
}, _callee);
|
|
37665
|
+
}));
|
|
37666
|
+
return function (_x) {
|
|
37667
|
+
return _ref.apply(this, arguments);
|
|
37681
37668
|
};
|
|
37682
|
-
});
|
|
37683
|
-
}
|
|
37684
|
-
|
|
37685
|
-
};
|
|
37686
|
-
var to100PercentResultSet$1 = function to100PercentResultSet(resultSet) {
|
|
37687
|
-
var ignoreKeys = ['x', 'xValues'];
|
|
37688
|
-
return resultSet.map(function (serie) {
|
|
37689
|
-
var newSerie = _extends({}, serie);
|
|
37690
|
-
var total = sumBy(Object.entries(newSerie), function (_ref) {
|
|
37691
|
-
var key = _ref[0],
|
|
37692
|
-
value = _ref[1];
|
|
37693
|
-
if (ignoreKeys.includes(key)) return 0;
|
|
37694
|
-
if (isNumber(value)) {
|
|
37695
|
-
return value;
|
|
37696
|
-
}
|
|
37697
|
-
return 0;
|
|
37698
|
-
});
|
|
37699
|
-
newSerie = mapValues(newSerie, function (value, key) {
|
|
37700
|
-
if (ignoreKeys.includes(key)) return value;
|
|
37701
|
-
if (isNumber(value)) {
|
|
37702
|
-
return isPercentageOf(newSerie[key], total);
|
|
37703
|
-
}
|
|
37704
|
-
return value;
|
|
37705
|
-
});
|
|
37706
|
-
return newSerie;
|
|
37707
|
-
});
|
|
37708
|
-
};
|
|
37669
|
+
}());
|
|
37670
|
+
}
|
|
37671
|
+
}
|
|
37709
37672
|
|
|
37710
37673
|
var ComboChart$2 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
37711
37674
|
var forceRerender = useChartForceRerender(ref);
|
|
@@ -38713,54 +38676,112 @@ var RichTextMenu = function RichTextMenu() {
|
|
|
38713
38676
|
// );
|
|
38714
38677
|
};
|
|
38715
38678
|
|
|
38716
|
-
|
|
38717
|
-
|
|
38718
|
-
|
|
38719
|
-
|
|
38720
|
-
|
|
38721
|
-
|
|
38722
|
-
|
|
38723
|
-
|
|
38724
|
-
|
|
38725
|
-
|
|
38726
|
-
|
|
38727
|
-
|
|
38728
|
-
|
|
38729
|
-
|
|
38730
|
-
|
|
38731
|
-
|
|
38732
|
-
|
|
38733
|
-
|
|
38734
|
-
|
|
38735
|
-
type: 'pieChart'
|
|
38736
|
-
};
|
|
38737
|
-
onViewClick(objectToReturn, /*#__PURE__*/function () {
|
|
38738
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(queries) {
|
|
38739
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38740
|
-
while (1) switch (_context.prev = _context.next) {
|
|
38741
|
-
case 0:
|
|
38742
|
-
if (!(queries && runViewClickQuery)) {
|
|
38743
|
-
_context.next = 4;
|
|
38744
|
-
break;
|
|
38745
|
-
}
|
|
38746
|
-
_context.next = 3;
|
|
38747
|
-
return runViewClickQuery(queries, buildClickedOnFieldForQuery(id, parse, dimension, timeDimension, clickedValue));
|
|
38748
|
-
case 3:
|
|
38749
|
-
return _context.abrupt("return", _context.sent);
|
|
38750
|
-
case 4:
|
|
38751
|
-
return _context.abrupt("return", Promise.resolve(null));
|
|
38752
|
-
case 5:
|
|
38753
|
-
case "end":
|
|
38754
|
-
return _context.stop();
|
|
38755
|
-
}
|
|
38756
|
-
}, _callee);
|
|
38757
|
-
}));
|
|
38758
|
-
return function (_x) {
|
|
38759
|
-
return _ref.apply(this, arguments);
|
|
38760
|
-
};
|
|
38761
|
-
}());
|
|
38679
|
+
var toKeyValueResults$1 = function toKeyValueResults(result) {
|
|
38680
|
+
return [].concat(result.content).map(function (row) {
|
|
38681
|
+
return reduce(row, function (acc, value, index) {
|
|
38682
|
+
acc[result.fields[index].id] = value;
|
|
38683
|
+
return acc;
|
|
38684
|
+
}, {});
|
|
38685
|
+
});
|
|
38686
|
+
};
|
|
38687
|
+
var getXFields = function getXFields(pivotConfig, query) {
|
|
38688
|
+
var nonTimeDimensionFields = reject([].concat(pivotConfig.x), function (field) {
|
|
38689
|
+
var _query$timeDimension;
|
|
38690
|
+
return field == ((_query$timeDimension = query.timeDimension) == null ? void 0 : _query$timeDimension.field);
|
|
38691
|
+
});
|
|
38692
|
+
var xFields = query.timeDimension ? [query.timeDimension.field] : nonTimeDimensionFields;
|
|
38693
|
+
return xFields;
|
|
38694
|
+
};
|
|
38695
|
+
var resultSet$1 = function resultSet(result, pivotConfig, query, as100PercentResultSet, nullReplacement) {
|
|
38696
|
+
if (as100PercentResultSet === void 0) {
|
|
38697
|
+
as100PercentResultSet = false;
|
|
38762
38698
|
}
|
|
38763
|
-
|
|
38699
|
+
var keyValueResult = toKeyValueResults$1(result);
|
|
38700
|
+
var duplicateDataPoints = [].concat(keyValueResult).map(function (row) {
|
|
38701
|
+
// Remove time dimension values from value prefix that allows groupings.
|
|
38702
|
+
var xFields = getXFields(pivotConfig, query);
|
|
38703
|
+
var xValues = xFields.map(function (xField) {
|
|
38704
|
+
return toStringShort(row[xField], nullReplacement);
|
|
38705
|
+
});
|
|
38706
|
+
var yValues = {};
|
|
38707
|
+
var hasMeasures = pivotConfig.y.includes('measures');
|
|
38708
|
+
var yWithoutMeasures = hasMeasures ? [].concat(pivotConfig.y).slice(0, pivotConfig.y.length - 1) : [].concat(pivotConfig.y);
|
|
38709
|
+
var yKeyValues = [].concat(yWithoutMeasures).map(function (k) {
|
|
38710
|
+
return row[k];
|
|
38711
|
+
});
|
|
38712
|
+
query.measure.forEach(function (measure) {
|
|
38713
|
+
var resultFieldId = id$2(measure);
|
|
38714
|
+
var key$1 = key(yWithoutMeasures, yKeyValues, measure.field, measure["function"]);
|
|
38715
|
+
yValues[key$1] = row[resultFieldId];
|
|
38716
|
+
});
|
|
38717
|
+
var dimensionValues = {};
|
|
38718
|
+
xFields.forEach(function (xField) {
|
|
38719
|
+
dimensionValues[xField] = row[xField];
|
|
38720
|
+
});
|
|
38721
|
+
return _extends({}, dimensionValues, {
|
|
38722
|
+
x: xValues.join(', ')
|
|
38723
|
+
}, yValues, {
|
|
38724
|
+
xValues: xValues
|
|
38725
|
+
});
|
|
38726
|
+
});
|
|
38727
|
+
var orderedRes = [];
|
|
38728
|
+
var dataPoints = {};
|
|
38729
|
+
duplicateDataPoints.forEach(function (dataPoint) {
|
|
38730
|
+
var current = dataPoints[dataPoint.x];
|
|
38731
|
+
|
|
38732
|
+
// Only add the x data point once if it already exists.
|
|
38733
|
+
if (!dataPoints[dataPoint.x]) {
|
|
38734
|
+
orderedRes.push(dataPoint.x);
|
|
38735
|
+
}
|
|
38736
|
+
dataPoints[dataPoint.x] = merge({}, current, dataPoint);
|
|
38737
|
+
});
|
|
38738
|
+
var resultSet = orderedRes.map(function (k) {
|
|
38739
|
+
return dataPoints[k];
|
|
38740
|
+
});
|
|
38741
|
+
return as100PercentResultSet ? to100PercentResultSet$1(resultSet) : resultSet;
|
|
38742
|
+
};
|
|
38743
|
+
var series$1 = function series(query, result, pivotConfig) {
|
|
38744
|
+
var keyValueResult = toKeyValueResults$1(result);
|
|
38745
|
+
var series = {};
|
|
38746
|
+
keyValueResult.forEach(function (dataPoint) {
|
|
38747
|
+
var yValues = [].concat(pivotConfig.y).map(function (k) {
|
|
38748
|
+
return dataPoint[k];
|
|
38749
|
+
});
|
|
38750
|
+
query.measure.forEach(function (measure) {
|
|
38751
|
+
var field = id$2(measure);
|
|
38752
|
+
var key$1 = key(pivotConfig.y, yValues, measure.field, measure["function"]);
|
|
38753
|
+
series[key$1] = {
|
|
38754
|
+
key: key$1,
|
|
38755
|
+
yValues: [].concat(yValues, [field]),
|
|
38756
|
+
name: [].concat(yValues, [field]).join(', ')
|
|
38757
|
+
};
|
|
38758
|
+
});
|
|
38759
|
+
});
|
|
38760
|
+
return Object.values(series);
|
|
38761
|
+
};
|
|
38762
|
+
var to100PercentResultSet$1 = function to100PercentResultSet(resultSet) {
|
|
38763
|
+
var ignoreKeys = ['x', 'xValues'];
|
|
38764
|
+
return resultSet.map(function (serie) {
|
|
38765
|
+
var newSerie = _extends({}, serie);
|
|
38766
|
+
var total = sumBy(Object.entries(newSerie), function (_ref) {
|
|
38767
|
+
var key = _ref[0],
|
|
38768
|
+
value = _ref[1];
|
|
38769
|
+
if (ignoreKeys.includes(key)) return 0;
|
|
38770
|
+
if (isNumber(value)) {
|
|
38771
|
+
return value;
|
|
38772
|
+
}
|
|
38773
|
+
return 0;
|
|
38774
|
+
});
|
|
38775
|
+
newSerie = mapValues(newSerie, function (value, key) {
|
|
38776
|
+
if (ignoreKeys.includes(key)) return value;
|
|
38777
|
+
if (isNumber(value)) {
|
|
38778
|
+
return isPercentageOf(newSerie[key], total);
|
|
38779
|
+
}
|
|
38780
|
+
return value;
|
|
38781
|
+
});
|
|
38782
|
+
return newSerie;
|
|
38783
|
+
});
|
|
38784
|
+
};
|
|
38764
38785
|
|
|
38765
38786
|
var defaultProps$5 = {
|
|
38766
38787
|
type: 'pieChart',
|
|
@@ -53096,9 +53117,11 @@ var SingleStat$2 = function SingleStat(props) {
|
|
|
53096
53117
|
}));
|
|
53097
53118
|
};
|
|
53098
53119
|
|
|
53099
|
-
var
|
|
53100
|
-
var
|
|
53101
|
-
var
|
|
53120
|
+
var convertDataToSunburstData = function convertDataToSunburstData(_ref) {
|
|
53121
|
+
var _selectedMetric$publi, _selectedMetric$publi2;
|
|
53122
|
+
var formattedData = _ref.formattedData,
|
|
53123
|
+
metricAttribute = _ref.metricAttribute,
|
|
53124
|
+
groupingAttributes = _ref.groupingAttributes;
|
|
53102
53125
|
var fieldPublicNameMap = formattedData.fields.reduce(function (acc, field) {
|
|
53103
53126
|
acc[field.fieldId] = field.publicName;
|
|
53104
53127
|
return acc;
|
|
@@ -53110,11 +53133,13 @@ var convertDataToSunburstData = function convertDataToSunburstData(formattedData
|
|
|
53110
53133
|
});
|
|
53111
53134
|
return newItem;
|
|
53112
53135
|
});
|
|
53113
|
-
var selectedMetric =
|
|
53114
|
-
return f["function"]
|
|
53115
|
-
})
|
|
53116
|
-
var
|
|
53117
|
-
return
|
|
53136
|
+
var selectedMetric = formattedData.fields.find(function (f) {
|
|
53137
|
+
return f.fieldId === metricAttribute.field && f["function"] === metricAttribute["function"];
|
|
53138
|
+
});
|
|
53139
|
+
var groupingFields = formattedData.fields.filter(function (f) {
|
|
53140
|
+
return groupingAttributes.some(function (g) {
|
|
53141
|
+
return g.field === f.fieldId && g["function"] === f["function"];
|
|
53142
|
+
});
|
|
53118
53143
|
}).map(function (f) {
|
|
53119
53144
|
return String(f.fieldId);
|
|
53120
53145
|
});
|
|
@@ -53131,7 +53156,7 @@ var convertDataToSunburstData = function convertDataToSunburstData(formattedData
|
|
|
53131
53156
|
var _item$selectedMetric$;
|
|
53132
53157
|
var item = _step.value;
|
|
53133
53158
|
var groupValue = String(item[groupFieldId]);
|
|
53134
|
-
var metricValue = Number((_item$selectedMetric$ = item[selectedMetric.id]) != null ? _item$selectedMetric$ : 0);
|
|
53159
|
+
var metricValue = selectedMetric ? Number((_item$selectedMetric$ = item[selectedMetric.id]) != null ? _item$selectedMetric$ : 0) : 0;
|
|
53135
53160
|
if (uniqueValues.includes(groupValue)) {
|
|
53136
53161
|
result[groupValue] = metricValue;
|
|
53137
53162
|
}
|
|
@@ -53148,13 +53173,13 @@ var convertDataToSunburstData = function convertDataToSunburstData(formattedData
|
|
|
53148
53173
|
if (parentColor === void 0) {
|
|
53149
53174
|
parentColor = '';
|
|
53150
53175
|
}
|
|
53151
|
-
var currentGroupField =
|
|
53176
|
+
var currentGroupField = groupingFields[depth];
|
|
53152
53177
|
var uniqueValues = uniqBy(data, currentGroupField).map(function (d) {
|
|
53153
53178
|
return String(d[currentGroupField]);
|
|
53154
53179
|
});
|
|
53155
53180
|
var metricValuesByGroup = calculateMetricValues(data, currentGroupField, uniqueValues);
|
|
53156
53181
|
var publicName = fieldPublicNameMap[currentGroupField];
|
|
53157
|
-
if (depth >=
|
|
53182
|
+
if (depth >= groupingFields.length - 1) {
|
|
53158
53183
|
return uniqueValues.map(function (value, index) {
|
|
53159
53184
|
return {
|
|
53160
53185
|
name: value,
|
|
@@ -53179,9 +53204,9 @@ var convertDataToSunburstData = function convertDataToSunburstData(formattedData
|
|
|
53179
53204
|
});
|
|
53180
53205
|
};
|
|
53181
53206
|
var convertedData = {
|
|
53182
|
-
name: selectedMetric.publicName
|
|
53207
|
+
name: (_selectedMetric$publi = selectedMetric == null ? void 0 : selectedMetric.publicName) != null ? _selectedMetric$publi : '',
|
|
53183
53208
|
children: _buildHierarchy(flattenedData, 0),
|
|
53184
|
-
hierarchy: selectedMetric.publicName
|
|
53209
|
+
hierarchy: (_selectedMetric$publi2 = selectedMetric == null ? void 0 : selectedMetric.publicName) != null ? _selectedMetric$publi2 : '',
|
|
53185
53210
|
parents: [],
|
|
53186
53211
|
color: '#FFFFFF'
|
|
53187
53212
|
};
|
|
@@ -53211,7 +53236,7 @@ function Partition(_ref) {
|
|
|
53211
53236
|
}
|
|
53212
53237
|
|
|
53213
53238
|
var SunburstChartView = function SunburstChartView(props) {
|
|
53214
|
-
var _props$library, _props$attributes$vie;
|
|
53239
|
+
var _props$library, _props$attributes$vie, _root$children$map, _root$children, _root$children$map2, _root$children2, _root$children$map3, _root$children3, _props$attributes$lab, _props$library2;
|
|
53215
53240
|
var _useState = useState([0, 1]),
|
|
53216
53241
|
xDomain = _useState[0],
|
|
53217
53242
|
setXDomain = _useState[1];
|
|
@@ -53232,11 +53257,16 @@ var SunburstChartView = function SunburstChartView(props) {
|
|
|
53232
53257
|
}),
|
|
53233
53258
|
tooltipLabel = _useState5[0],
|
|
53234
53259
|
setTooltipLabel = _useState5[1];
|
|
53260
|
+
var defaultLabelFormat = '_vizzly_compact';
|
|
53261
|
+
var theme = useTheme();
|
|
53235
53262
|
var xScale = scaleLinear$1().domain(xDomain).range(xRange);
|
|
53236
53263
|
var yScale = scaleSqrt().domain(yDomain).range(yRange);
|
|
53237
53264
|
var width = props.width * 3 / 6;
|
|
53238
|
-
var
|
|
53239
|
-
var
|
|
53265
|
+
var titleHeight = props.attributes.displayTitle ? 24 : 0;
|
|
53266
|
+
var subjectHeight = props.attributes.displaySubject ? 18 : 0;
|
|
53267
|
+
var height = props.height - titleHeight - subjectHeight;
|
|
53268
|
+
var adjustedHeight = adjustHeight(height * 0.95, props.attributes.legend);
|
|
53269
|
+
var minDimension = Math.min(props.width, height);
|
|
53240
53270
|
var centeredRatio = minDimension / 2.5;
|
|
53241
53271
|
var sunburstChartComponent = getComponentInterface(props.attributes.type);
|
|
53242
53272
|
var headerProps = {
|
|
@@ -53282,7 +53312,11 @@ var SunburstChartView = function SunburstChartView(props) {
|
|
|
53282
53312
|
return null;
|
|
53283
53313
|
}
|
|
53284
53314
|
var formattedData = formatResult(props.result, props.formatResultParams);
|
|
53285
|
-
return convertDataToSunburstData(
|
|
53315
|
+
return convertDataToSunburstData({
|
|
53316
|
+
formattedData: formattedData,
|
|
53317
|
+
metricAttribute: props.attributes.measure[0],
|
|
53318
|
+
groupingAttributes: props.attributes.dimension
|
|
53319
|
+
});
|
|
53286
53320
|
}, [props.attributes, props.result, props.formatResultParams, sunburstChartComponent]);
|
|
53287
53321
|
var root = useMemo(function () {
|
|
53288
53322
|
return sunburstData && hierarchy(sunburstData).sum(function (d) {
|
|
@@ -53296,7 +53330,7 @@ var SunburstChartView = function SunburstChartView(props) {
|
|
|
53296
53330
|
var _useTooltip = useTooltip$2({
|
|
53297
53331
|
tooltipOpen: false,
|
|
53298
53332
|
tooltipLeft: width / 2,
|
|
53299
|
-
tooltipTop:
|
|
53333
|
+
tooltipTop: adjustedHeight,
|
|
53300
53334
|
tooltipData: 'Move me with your mouse or finger'
|
|
53301
53335
|
}),
|
|
53302
53336
|
showTooltip = _useTooltip.showTooltip,
|
|
@@ -53335,105 +53369,153 @@ var SunburstChartView = function SunburstChartView(props) {
|
|
|
53335
53369
|
tooltipTop: containerY,
|
|
53336
53370
|
tooltipData: JSON.stringify(node.data)
|
|
53337
53371
|
});
|
|
53338
|
-
}, [showTooltip,
|
|
53372
|
+
}, [showTooltip, adjustedHeight, width, root]);
|
|
53339
53373
|
var innerWidth = width - DEFAULT_MARGINS.left - DEFAULT_MARGINS.right;
|
|
53340
|
-
var innerHeight =
|
|
53374
|
+
var innerHeight = adjustedHeight - DEFAULT_MARGINS.top - DEFAULT_MARGINS.bottom;
|
|
53341
53375
|
var centerY = innerHeight / 2;
|
|
53342
53376
|
var centerX = innerWidth / 2;
|
|
53377
|
+
var totalFieldCount = props.attributes.measure.length + props.attributes.dimension.length;
|
|
53343
53378
|
if (!sunburstChartComponent.isRunnable(props.attributes)) {
|
|
53344
53379
|
return jsx(QueryUnderConstructionNotice, {
|
|
53345
53380
|
title: "Missing parameters"
|
|
53346
53381
|
});
|
|
53347
53382
|
}
|
|
53348
|
-
if (isLoading(props.result)) return jsx(LoadingComponent, {});
|
|
53349
53383
|
if (hasFailed(props.result)) return jsx(FailedToLoadDataNotice, {});
|
|
53384
|
+
if (isLoading(props.result) || props.result.fields.length !== totalFieldCount) return jsx(LoadingComponent, {});
|
|
53350
53385
|
if (isEmpty(props.result)) return jsx(NoResultContentToShowNotice, _extends({}, headerProps));
|
|
53351
|
-
|
|
53352
|
-
|
|
53353
|
-
|
|
53354
|
-
|
|
53355
|
-
|
|
53356
|
-
|
|
53357
|
-
|
|
53358
|
-
|
|
53359
|
-
|
|
53360
|
-
|
|
53361
|
-
|
|
53362
|
-
|
|
53363
|
-
|
|
53364
|
-
|
|
53365
|
-
|
|
53366
|
-
|
|
53367
|
-
|
|
53368
|
-
|
|
53369
|
-
|
|
53370
|
-
|
|
53371
|
-
|
|
53372
|
-
|
|
53386
|
+
var keys = (_root$children$map = root == null || (_root$children = root.children) == null ? void 0 : _root$children.map(function (child) {
|
|
53387
|
+
return child.data.name;
|
|
53388
|
+
})) != null ? _root$children$map : [];
|
|
53389
|
+
var colors = (_root$children$map2 = root == null || (_root$children2 = root.children) == null ? void 0 : _root$children2.map(function (child) {
|
|
53390
|
+
return child.data.color;
|
|
53391
|
+
})) != null ? _root$children$map2 : [];
|
|
53392
|
+
var typeIndex = (_root$children$map3 = root == null || (_root$children3 = root.children) == null ? void 0 : _root$children3.map(function (_, index) {
|
|
53393
|
+
return {
|
|
53394
|
+
index: index,
|
|
53395
|
+
type: 'pie'
|
|
53396
|
+
};
|
|
53397
|
+
})) != null ? _root$children$map3 : [];
|
|
53398
|
+
var showLabel = (theme == null ? void 0 : theme.detail) === 'verbose' && props.attributes.labels !== false || props.attributes.labels;
|
|
53399
|
+
var labelFormat = (_props$attributes$lab = props == null ? void 0 : props.attributes.labelFormat) != null ? _props$attributes$lab : defaultLabelFormat;
|
|
53400
|
+
var formatValue = function formatValue(value) {
|
|
53401
|
+
return convertValueToFormat(toDp(value, 2), props == null ? void 0 : props.numberFormatOptions, labelFormat);
|
|
53402
|
+
};
|
|
53403
|
+
return jsx(Suspense, {
|
|
53404
|
+
fallback: jsx(LoadingComponent, {}),
|
|
53405
|
+
children: jsxs(ViewWrapper, {
|
|
53406
|
+
id: props.id,
|
|
53407
|
+
queriesAreChanging: props.queriesAreChanging,
|
|
53408
|
+
children: [jsx(ViewHeader, _extends({}, headerProps)), jsxs(ChartWrapper, {
|
|
53409
|
+
disabledFeatures: (_props$library2 = props.library) != null ? _props$library2 : false,
|
|
53410
|
+
children: [jsx("style", {
|
|
53411
|
+
children: "" + TOOLTIP_ZINDEX
|
|
53412
|
+
}), jsx("svg", {
|
|
53413
|
+
width: props.width,
|
|
53414
|
+
height: adjustedHeight,
|
|
53415
|
+
children: jsx(Partition, {
|
|
53416
|
+
top: 0,
|
|
53417
|
+
left: centerX + DEFAULT_MARGINS.left,
|
|
53418
|
+
root: root,
|
|
53419
|
+
children: jsx(Spring, {
|
|
53420
|
+
reset: true,
|
|
53421
|
+
from: {
|
|
53422
|
+
t: 0
|
|
53423
|
+
},
|
|
53424
|
+
to: {
|
|
53425
|
+
t: 1,
|
|
53426
|
+
onFrame: function onFrame(_ref) {
|
|
53427
|
+
var t = _ref.t;
|
|
53428
|
+
return handleUpdate(t, xd, yd, yr);
|
|
53429
|
+
}
|
|
53430
|
+
},
|
|
53431
|
+
config: {
|
|
53432
|
+
mass: 5,
|
|
53433
|
+
tension: 500,
|
|
53434
|
+
friction: 100,
|
|
53435
|
+
precision: 0.00001
|
|
53436
|
+
},
|
|
53437
|
+
children: function children(_ref2) {
|
|
53438
|
+
var t = _ref2.t;
|
|
53439
|
+
return jsxs(Group$2, {
|
|
53440
|
+
top: centerY + DEFAULT_MARGINS.top,
|
|
53441
|
+
left: centerX + DEFAULT_MARGINS.left,
|
|
53442
|
+
children: [root && root.descendants().map(function (node, i) {
|
|
53443
|
+
var _arc$centroid = arc$1.centroid(node),
|
|
53444
|
+
centroidX = _arc$centroid[0],
|
|
53445
|
+
centroidY = _arc$centroid[1];
|
|
53446
|
+
var hasSpaceForLabel = node.x1 - node.x0 >= 0.09;
|
|
53447
|
+
var nodeKey = node.data.name.toLowerCase().replaceAll(' ', '-') + "-" + i;
|
|
53448
|
+
var textColor = pickBestTextColor(node.data.color, ['white', 'black']);
|
|
53449
|
+
var displayLabelCondition = showLabel && hasSpaceForLabel && node.depth > 0;
|
|
53450
|
+
return jsxs("g", {
|
|
53451
|
+
children: [jsx(animated.path, {
|
|
53452
|
+
className: "path",
|
|
53453
|
+
d: t.to(function () {
|
|
53454
|
+
return arc$1(node);
|
|
53455
|
+
}),
|
|
53456
|
+
stroke: "#FFFFFF",
|
|
53457
|
+
strokeWidth: "2",
|
|
53458
|
+
fill: node.data.color,
|
|
53459
|
+
fillRule: "evenodd",
|
|
53460
|
+
onClick: function onClick() {
|
|
53461
|
+
return handleClick(node);
|
|
53462
|
+
},
|
|
53463
|
+
onMouseOver: function onMouseOver(event) {
|
|
53464
|
+
return handlePointerMove(event, node);
|
|
53465
|
+
},
|
|
53466
|
+
onMouseOut: function onMouseOut() {
|
|
53467
|
+
return hideTooltip();
|
|
53468
|
+
}
|
|
53469
|
+
}, i), displayLabelCondition && jsx(animated.g, {
|
|
53470
|
+
children: jsx("text", {
|
|
53471
|
+
fill: textColor,
|
|
53472
|
+
x: centroidX,
|
|
53473
|
+
y: centroidY,
|
|
53474
|
+
dy: ".33em",
|
|
53475
|
+
fontSize: 9,
|
|
53476
|
+
textAnchor: "middle",
|
|
53477
|
+
pointerEvents: "none",
|
|
53478
|
+
children: formatValue(node.value)
|
|
53479
|
+
})
|
|
53480
|
+
})]
|
|
53481
|
+
}, nodeKey);
|
|
53482
|
+
}), tooltipOpen && jsx(TooltipInPortal
|
|
53483
|
+
// style={buildTooltipStyles({ ...props.popOverMenuStyles, old: true })}
|
|
53484
|
+
, {
|
|
53485
|
+
top: tooltipTop,
|
|
53486
|
+
left: tooltipLeft,
|
|
53487
|
+
children: jsxs(TooltipWrapper, {
|
|
53488
|
+
sections: 1,
|
|
53489
|
+
children: [jsx(TooltipRow, {
|
|
53490
|
+
label: 'Category Name',
|
|
53491
|
+
value: tooltipLabel.categoryName
|
|
53492
|
+
}), tooltipLabel.path !== '' && jsx(TooltipRow, {
|
|
53493
|
+
label: 'Hierarchy Path',
|
|
53494
|
+
value: tooltipLabel.path
|
|
53495
|
+
}), jsx(TooltipRow, {
|
|
53496
|
+
label: 'Value',
|
|
53497
|
+
value: tooltipLabel.value
|
|
53498
|
+
}), tooltipLabel.percentOfParent !== '' && jsx(TooltipRow, {
|
|
53499
|
+
label: '% Of Parent',
|
|
53500
|
+
value: tooltipLabel.percentOfParent
|
|
53501
|
+
}), jsx(TooltipRow, {
|
|
53502
|
+
label: '% Of Total',
|
|
53503
|
+
value: tooltipLabel.percentOfTotal
|
|
53504
|
+
})]
|
|
53505
|
+
})
|
|
53506
|
+
}, v4())]
|
|
53507
|
+
});
|
|
53373
53508
|
}
|
|
53374
|
-
}
|
|
53375
|
-
config: {
|
|
53376
|
-
mass: 5,
|
|
53377
|
-
tension: 500,
|
|
53378
|
-
friction: 100,
|
|
53379
|
-
precision: 0.00001
|
|
53380
|
-
},
|
|
53381
|
-
children: function children(_ref2) {
|
|
53382
|
-
var t = _ref2.t;
|
|
53383
|
-
return jsxs(Group$2, {
|
|
53384
|
-
top: centerY + DEFAULT_MARGINS.top,
|
|
53385
|
-
left: centerX + DEFAULT_MARGINS.left,
|
|
53386
|
-
children: [root && root.descendants().map(function (node, i) {
|
|
53387
|
-
return jsx(animated.path, {
|
|
53388
|
-
className: "path",
|
|
53389
|
-
d: t.to(function () {
|
|
53390
|
-
return arc$1(node);
|
|
53391
|
-
}),
|
|
53392
|
-
stroke: "#FFFFFF",
|
|
53393
|
-
strokeWidth: "2",
|
|
53394
|
-
fill: node.data.color,
|
|
53395
|
-
fillRule: "evenodd",
|
|
53396
|
-
onClick: function onClick() {
|
|
53397
|
-
return handleClick(node);
|
|
53398
|
-
},
|
|
53399
|
-
onMouseOver: function onMouseOver(event) {
|
|
53400
|
-
return handlePointerMove(event, node);
|
|
53401
|
-
},
|
|
53402
|
-
onMouseOut: function onMouseOut() {
|
|
53403
|
-
return hideTooltip();
|
|
53404
|
-
}
|
|
53405
|
-
}, i);
|
|
53406
|
-
}), tooltipOpen && jsx(TooltipInPortal
|
|
53407
|
-
// style={buildTooltipStyles({ ...props.popOverMenuStyles, old: true })}
|
|
53408
|
-
, {
|
|
53409
|
-
top: tooltipTop,
|
|
53410
|
-
left: tooltipLeft,
|
|
53411
|
-
children: jsxs(TooltipWrapper, {
|
|
53412
|
-
sections: 1,
|
|
53413
|
-
children: [jsx(TooltipRow, {
|
|
53414
|
-
label: 'Category Name',
|
|
53415
|
-
value: tooltipLabel.categoryName
|
|
53416
|
-
}), tooltipLabel.path !== '' && jsx(TooltipRow, {
|
|
53417
|
-
label: 'Hierarchy Path',
|
|
53418
|
-
value: tooltipLabel.path
|
|
53419
|
-
}), jsx(TooltipRow, {
|
|
53420
|
-
label: 'Value',
|
|
53421
|
-
value: tooltipLabel.value
|
|
53422
|
-
}), tooltipLabel.percentOfParent !== '' && jsx(TooltipRow, {
|
|
53423
|
-
label: '% Of Parent',
|
|
53424
|
-
value: tooltipLabel.percentOfParent
|
|
53425
|
-
}), jsx(TooltipRow, {
|
|
53426
|
-
label: '% Of Total',
|
|
53427
|
-
value: tooltipLabel.percentOfTotal
|
|
53428
|
-
})]
|
|
53429
|
-
})
|
|
53430
|
-
}, v4())]
|
|
53431
|
-
});
|
|
53432
|
-
}
|
|
53509
|
+
})
|
|
53433
53510
|
})
|
|
53434
|
-
})
|
|
53435
|
-
|
|
53436
|
-
|
|
53511
|
+
}), showLegend(props.attributes.legend, (theme == null ? void 0 : theme.detail) === 'verbose') && jsx(Legend, {
|
|
53512
|
+
colors: colors,
|
|
53513
|
+
keys: keys,
|
|
53514
|
+
typeIndex: typeIndex,
|
|
53515
|
+
alignCenter: true
|
|
53516
|
+
})]
|
|
53517
|
+
})]
|
|
53518
|
+
})
|
|
53437
53519
|
});
|
|
53438
53520
|
};
|
|
53439
53521
|
|
|
@@ -53443,7 +53525,8 @@ var SunburstChart$2 = function SunburstChart(props) {
|
|
|
53443
53525
|
localFilters: props.component.localFilters,
|
|
53444
53526
|
globalFilters: props.globalFilters
|
|
53445
53527
|
}, props.dataSet, undefined, props.dashboardBehaviour.variables),
|
|
53446
|
-
results = _useQueryEffect.results
|
|
53528
|
+
results = _useQueryEffect.results,
|
|
53529
|
+
queriesAreChanging = _useQueryEffect.queriesAreChanging;
|
|
53447
53530
|
var params = {
|
|
53448
53531
|
defaultFormats: props.dashboardBehaviour.defaultFormats,
|
|
53449
53532
|
dateTimeFormatOptions: props.dashboardBehaviour.dateTimeFormatOptions,
|
|
@@ -53458,6 +53541,8 @@ var SunburstChart$2 = function SunburstChart(props) {
|
|
|
53458
53541
|
return jsx(ParentSize, {
|
|
53459
53542
|
children: function children(parent) {
|
|
53460
53543
|
return jsx(SunburstChartView, {
|
|
53544
|
+
id: props.id,
|
|
53545
|
+
queriesAreChanging: queriesAreChanging,
|
|
53461
53546
|
attributes: attributes,
|
|
53462
53547
|
dataSet: props.dataSet,
|
|
53463
53548
|
localFilters: props.component.localFilters,
|
|
@@ -53465,10 +53550,12 @@ var SunburstChart$2 = function SunburstChart(props) {
|
|
|
53465
53550
|
setPartialAttributes: function setPartialAttributes(changes) {
|
|
53466
53551
|
return props.setPartialAttributes(changes);
|
|
53467
53552
|
},
|
|
53468
|
-
result: results[0],
|
|
53553
|
+
result: results && results[0],
|
|
53469
53554
|
width: parent == null ? void 0 : parent.width,
|
|
53470
53555
|
height: parent == null ? void 0 : parent.height,
|
|
53471
|
-
formatResultParams: params
|
|
53556
|
+
formatResultParams: params,
|
|
53557
|
+
numberFormatOptions: props.dashboardBehaviour.numberFormatOptions,
|
|
53558
|
+
dateTimeFormatOptions: props.dashboardBehaviour.dateTimeFormatOptions
|
|
53472
53559
|
});
|
|
53473
53560
|
}
|
|
53474
53561
|
});
|
|
@@ -62249,51 +62336,6 @@ var DataPropsEditor = function DataPropsEditor() {
|
|
|
62249
62336
|
});
|
|
62250
62337
|
};
|
|
62251
62338
|
|
|
62252
|
-
var HeadingSection = function HeadingSection(_ref) {
|
|
62253
|
-
var _section$subSection;
|
|
62254
|
-
var section = _ref.section,
|
|
62255
|
-
setAttributes = _ref.setAttributes,
|
|
62256
|
-
attributes = _ref.attributes;
|
|
62257
|
-
var handleInputChange = useInputDebounce(setAttributes);
|
|
62258
|
-
return jsx(Section, {
|
|
62259
|
-
title: section.title,
|
|
62260
|
-
tooltip: section == null ? void 0 : section.description,
|
|
62261
|
-
children: jsx(Section.Grid, {
|
|
62262
|
-
children: section == null || (_section$subSection = section.subSection) == null ? void 0 : _section$subSection.map(function (section, i) {
|
|
62263
|
-
return jsxs(Fragment, {
|
|
62264
|
-
children: [section.type === 'title' && jsx("div", {
|
|
62265
|
-
children: jsx(Input, {
|
|
62266
|
-
label: section == null ? void 0 : section.title,
|
|
62267
|
-
"data-testid": "display-title-input",
|
|
62268
|
-
id: "display-title-input",
|
|
62269
|
-
type: "text",
|
|
62270
|
-
onChange: function onChange(input) {
|
|
62271
|
-
return handleInputChange({
|
|
62272
|
-
displayTitle: input.target.value
|
|
62273
|
-
});
|
|
62274
|
-
},
|
|
62275
|
-
defaultValue: attributes.displayTitle
|
|
62276
|
-
})
|
|
62277
|
-
}), section.type === 'subject' && jsx("div", {
|
|
62278
|
-
children: jsx(Input, {
|
|
62279
|
-
label: section == null ? void 0 : section.title,
|
|
62280
|
-
"data-testid": "display-subject-input",
|
|
62281
|
-
id: "display-subject-input",
|
|
62282
|
-
type: "text",
|
|
62283
|
-
onChange: function onChange(input) {
|
|
62284
|
-
return handleInputChange({
|
|
62285
|
-
displaySubject: input.target.value
|
|
62286
|
-
});
|
|
62287
|
-
},
|
|
62288
|
-
defaultValue: attributes.displaySubject
|
|
62289
|
-
})
|
|
62290
|
-
})]
|
|
62291
|
-
}, i);
|
|
62292
|
-
})
|
|
62293
|
-
})
|
|
62294
|
-
});
|
|
62295
|
-
};
|
|
62296
|
-
|
|
62297
62339
|
var SelectNumberFormat = function SelectNumberFormat(props) {
|
|
62298
62340
|
var _props$label;
|
|
62299
62341
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
@@ -62320,6 +62362,196 @@ var SelectNumberFormat = function SelectNumberFormat(props) {
|
|
|
62320
62362
|
});
|
|
62321
62363
|
};
|
|
62322
62364
|
|
|
62365
|
+
var AxisPreferenceSection = function AxisPreferenceSection(props) {
|
|
62366
|
+
var _props$attributes, _props$attributes2, _props$attributes3, _props$attributes4, _props$section, _props$section2, _props$section$y, _props$section$y$form, _props$section$y$axis, _props$attributes$axi, _props$section$x$form, _props$section$x, _props$section$x$axis, _props$attributes$axi2;
|
|
62367
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
62368
|
+
textOverride = _useDashboardBehaviou.textOverride,
|
|
62369
|
+
dateTimeFormatOptions = _useDashboardBehaviou.dateTimeFormatOptions;
|
|
62370
|
+
var axisOptions = [{
|
|
62371
|
+
label: textOverride('auto', 'Auto'),
|
|
62372
|
+
value: 'auto'
|
|
62373
|
+
}, {
|
|
62374
|
+
label: textOverride('minimal', 'Minimal'),
|
|
62375
|
+
value: 2
|
|
62376
|
+
}, {
|
|
62377
|
+
label: textOverride('None', 'None'),
|
|
62378
|
+
value: 0
|
|
62379
|
+
}];
|
|
62380
|
+
var dateTimeFormatOptionsItems = Object.keys(dateTimeFormatOptions).map(function (key) {
|
|
62381
|
+
var option = dateTimeFormatOptions[key];
|
|
62382
|
+
return {
|
|
62383
|
+
label: option.description,
|
|
62384
|
+
value: key
|
|
62385
|
+
};
|
|
62386
|
+
});
|
|
62387
|
+
var horizontal = props.attributes.type == 'horizontalBarChart';
|
|
62388
|
+
var showXAxisNumberFormatter = ((_props$attributes = props.attributes) == null || (_props$attributes = _props$attributes.dimension) == null ? void 0 : _props$attributes.length) > 0 && findField(props.dataSet, (_props$attributes2 = props.attributes) == null || (_props$attributes2 = _props$attributes2.dimension[0]) == null ? void 0 : _props$attributes2.field).dataType === 'number' && !((_props$attributes3 = props.attributes) != null && _props$attributes3.timeDimension);
|
|
62389
|
+
var showXAxisDateFormatOptions = !!((_props$attributes4 = props.attributes) != null && _props$attributes4.timeDimension);
|
|
62390
|
+
var _ref = horizontal ? {
|
|
62391
|
+
x: 'y',
|
|
62392
|
+
y: 'x'
|
|
62393
|
+
} : {
|
|
62394
|
+
x: 'x',
|
|
62395
|
+
y: 'y'
|
|
62396
|
+
},
|
|
62397
|
+
x = _ref.x,
|
|
62398
|
+
y = _ref.y;
|
|
62399
|
+
return jsx(Section, {
|
|
62400
|
+
title: (_props$section = props.section) == null ? void 0 : _props$section.title,
|
|
62401
|
+
tooltip: (_props$section2 = props.section) == null ? void 0 : _props$section2.description,
|
|
62402
|
+
"data-component": "axis-preference-section",
|
|
62403
|
+
children: jsxs(Section.Container, {
|
|
62404
|
+
"data-component": "single-stats-labels",
|
|
62405
|
+
children: [jsxs(Section.Panel, {
|
|
62406
|
+
title: (_props$section$y = props.section[y]) == null ? void 0 : _props$section$y.title,
|
|
62407
|
+
children: [jsxs(Section.Grid, {
|
|
62408
|
+
columns: 2,
|
|
62409
|
+
children: [jsx(TextInput, {
|
|
62410
|
+
label: props.section[y].prefix.title,
|
|
62411
|
+
setText: function setText(yAxisPrefix) {
|
|
62412
|
+
return props.setAttributes({
|
|
62413
|
+
yAxisPrefix: yAxisPrefix
|
|
62414
|
+
});
|
|
62415
|
+
},
|
|
62416
|
+
currentValue: props.attributes.yAxisPrefix,
|
|
62417
|
+
maxLength: 4,
|
|
62418
|
+
id: "axis-" + y + "-prefix"
|
|
62419
|
+
}), jsx(TextInput, {
|
|
62420
|
+
label: props.section[y].postfix.title,
|
|
62421
|
+
setText: function setText(yAxisPostfix) {
|
|
62422
|
+
return props.setAttributes({
|
|
62423
|
+
yAxisPostfix: yAxisPostfix
|
|
62424
|
+
});
|
|
62425
|
+
},
|
|
62426
|
+
currentValue: props.attributes.yAxisPostfix,
|
|
62427
|
+
maxLength: 4,
|
|
62428
|
+
id: "axis-" + y + "-postfix"
|
|
62429
|
+
})]
|
|
62430
|
+
}), jsxs(Section.Grid, {
|
|
62431
|
+
columns: 2,
|
|
62432
|
+
children: [jsx(SelectNumberFormat, {
|
|
62433
|
+
label: (_props$section$y$form = props.section[y].format) == null ? void 0 : _props$section$y$form.title,
|
|
62434
|
+
id: "axis-" + y + "-format",
|
|
62435
|
+
onChange: function onChange(yAxisFormat) {
|
|
62436
|
+
return props.setAttributes({
|
|
62437
|
+
yAxisFormat: yAxisFormat
|
|
62438
|
+
});
|
|
62439
|
+
},
|
|
62440
|
+
currentValue: props.attributes.yAxisFormat,
|
|
62441
|
+
testId: "axis-" + y + "-format"
|
|
62442
|
+
}), jsx(FormatSelectInput, {
|
|
62443
|
+
id: "axis-" + y + "-label-count",
|
|
62444
|
+
label: props.section.y.count.title,
|
|
62445
|
+
currentValue: props.attributes.approxYAxisLabelCount,
|
|
62446
|
+
onSelect: function onSelect(approxYAxisLabelCount) {
|
|
62447
|
+
return props.setAttributes({
|
|
62448
|
+
approxYAxisLabelCount: approxYAxisLabelCount
|
|
62449
|
+
});
|
|
62450
|
+
},
|
|
62451
|
+
options: axisOptions
|
|
62452
|
+
})]
|
|
62453
|
+
}), jsx(Section.Grid, {
|
|
62454
|
+
children: props.section[y].axisTitle && jsx(TextInput, {
|
|
62455
|
+
label: (_props$section$y$axis = props.section[y].axisTitle.title) != null ? _props$section$y$axis : '',
|
|
62456
|
+
setText: function setText(axisTitle) {
|
|
62457
|
+
var _axisTitles;
|
|
62458
|
+
return props.setAttributes({
|
|
62459
|
+
axisTitles: (_axisTitles = {}, _axisTitles[y] = axisTitle, _axisTitles)
|
|
62460
|
+
});
|
|
62461
|
+
},
|
|
62462
|
+
currentValue: (_props$attributes$axi = props.attributes.axisTitles) == null ? void 0 : _props$attributes$axi[y],
|
|
62463
|
+
id: "axis-" + [y] + "-axisTitle"
|
|
62464
|
+
})
|
|
62465
|
+
})]
|
|
62466
|
+
}), jsxs(Section.Panel, {
|
|
62467
|
+
title: props.section[x].title,
|
|
62468
|
+
children: [jsxs(Section.Grid, {
|
|
62469
|
+
columns: 2,
|
|
62470
|
+
children: [jsx(TextInput, {
|
|
62471
|
+
label: props.section[x].prefix.title,
|
|
62472
|
+
setText: function setText(xAxisPrefix) {
|
|
62473
|
+
return props.setAttributes({
|
|
62474
|
+
xAxisPrefix: xAxisPrefix
|
|
62475
|
+
});
|
|
62476
|
+
},
|
|
62477
|
+
currentValue: props.attributes.xAxisPrefix,
|
|
62478
|
+
maxLength: 4,
|
|
62479
|
+
id: "axis-" + x + "-prefix"
|
|
62480
|
+
}), jsx(TextInput, {
|
|
62481
|
+
label: props.section[x].postfix.title,
|
|
62482
|
+
setText: function setText(xAxisPostfix) {
|
|
62483
|
+
return props.setAttributes({
|
|
62484
|
+
xAxisPostfix: xAxisPostfix
|
|
62485
|
+
});
|
|
62486
|
+
},
|
|
62487
|
+
currentValue: props.attributes.xAxisPostfix,
|
|
62488
|
+
maxLength: 4,
|
|
62489
|
+
id: "axis-" + x + "-postfix"
|
|
62490
|
+
})]
|
|
62491
|
+
}), jsx(Section.Grid, {
|
|
62492
|
+
columns: showXAxisNumberFormatter || showXAxisDateFormatOptions ? 2 : 1,
|
|
62493
|
+
children: jsxs(Fragment$1, {
|
|
62494
|
+
children: [showXAxisNumberFormatter && jsx(SelectNumberFormat, {
|
|
62495
|
+
label: (_props$section$x$form = props.section[x].format) == null ? void 0 : _props$section$x$form.title,
|
|
62496
|
+
id: "axis-" + x + "-format",
|
|
62497
|
+
onChange: function onChange(xAxisFormat) {
|
|
62498
|
+
props.setAttributes({
|
|
62499
|
+
xAxisFormat: xAxisFormat
|
|
62500
|
+
});
|
|
62501
|
+
},
|
|
62502
|
+
currentValue: props.attributes.xAxisFormat,
|
|
62503
|
+
testId: "axis-" + y + "-format"
|
|
62504
|
+
}), showXAxisDateFormatOptions ? jsxs(Fragment$1, {
|
|
62505
|
+
children: [jsx(FormatSelectInput, {
|
|
62506
|
+
id: "axis-" + x + "-label-date-format",
|
|
62507
|
+
label: ((_props$section$x = props.section.x) == null || (_props$section$x = _props$section$x.format) == null ? void 0 : _props$section$x.title) || 'Format',
|
|
62508
|
+
currentValue: props.attributes.xAxisFormat,
|
|
62509
|
+
onSelect: function onSelect(xAxisFormat) {
|
|
62510
|
+
return props.setAttributes({
|
|
62511
|
+
xAxisFormat: xAxisFormat
|
|
62512
|
+
});
|
|
62513
|
+
},
|
|
62514
|
+
options: dateTimeFormatOptionsItems
|
|
62515
|
+
}), jsx(FormatSelectInput, {
|
|
62516
|
+
id: "axis-" + x + "-label-count",
|
|
62517
|
+
label: props.section.x.count.title,
|
|
62518
|
+
currentValue: props.attributes.approxXAxisLabelCount,
|
|
62519
|
+
onSelect: function onSelect(approxXAxisLabelCount) {
|
|
62520
|
+
return props.setAttributes({
|
|
62521
|
+
approxXAxisLabelCount: approxXAxisLabelCount
|
|
62522
|
+
});
|
|
62523
|
+
},
|
|
62524
|
+
options: axisOptions
|
|
62525
|
+
})]
|
|
62526
|
+
}) : jsx(Checkbox, {
|
|
62527
|
+
label: textOverride('hide_labels', 'Hide Labels'),
|
|
62528
|
+
onChange: function onChange(event) {
|
|
62529
|
+
return props.setAttributes({
|
|
62530
|
+
approxXAxisLabelCount: event ? 0 : 'auto'
|
|
62531
|
+
});
|
|
62532
|
+
},
|
|
62533
|
+
id: "hide-labels",
|
|
62534
|
+
currentValue: props.attributes.approxXAxisLabelCount === 0 ? true : false
|
|
62535
|
+
})]
|
|
62536
|
+
})
|
|
62537
|
+
}), jsx(Section.Grid, {
|
|
62538
|
+
children: props.section[x].axisTitle && jsx(TextInput, {
|
|
62539
|
+
label: (_props$section$x$axis = props.section[x].axisTitle.title) != null ? _props$section$x$axis : '',
|
|
62540
|
+
setText: function setText(axisTitle) {
|
|
62541
|
+
var _axisTitles2;
|
|
62542
|
+
return props.setAttributes({
|
|
62543
|
+
axisTitles: (_axisTitles2 = {}, _axisTitles2[x] = axisTitle, _axisTitles2)
|
|
62544
|
+
});
|
|
62545
|
+
},
|
|
62546
|
+
currentValue: (_props$attributes$axi2 = props.attributes.axisTitles) == null ? void 0 : _props$attributes$axi2[x],
|
|
62547
|
+
id: "axis-" + [x] + "-axisTitle"
|
|
62548
|
+
})
|
|
62549
|
+
})]
|
|
62550
|
+
})]
|
|
62551
|
+
})
|
|
62552
|
+
});
|
|
62553
|
+
};
|
|
62554
|
+
|
|
62323
62555
|
var ChartSettingsSection = function ChartSettingsSection(_ref) {
|
|
62324
62556
|
var section = _ref.section,
|
|
62325
62557
|
attributes = _ref.attributes,
|
|
@@ -62440,196 +62672,6 @@ var ChartSettingsSection = function ChartSettingsSection(_ref) {
|
|
|
62440
62672
|
});
|
|
62441
62673
|
};
|
|
62442
62674
|
|
|
62443
|
-
var AxisPreferenceSection = function AxisPreferenceSection(props) {
|
|
62444
|
-
var _props$attributes, _props$attributes2, _props$attributes3, _props$attributes4, _props$section, _props$section2, _props$section$y, _props$section$y$form, _props$section$y$axis, _props$attributes$axi, _props$section$x$form, _props$section$x, _props$section$x$axis, _props$attributes$axi2;
|
|
62445
|
-
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
62446
|
-
textOverride = _useDashboardBehaviou.textOverride,
|
|
62447
|
-
dateTimeFormatOptions = _useDashboardBehaviou.dateTimeFormatOptions;
|
|
62448
|
-
var axisOptions = [{
|
|
62449
|
-
label: textOverride('auto', 'Auto'),
|
|
62450
|
-
value: 'auto'
|
|
62451
|
-
}, {
|
|
62452
|
-
label: textOverride('minimal', 'Minimal'),
|
|
62453
|
-
value: 2
|
|
62454
|
-
}, {
|
|
62455
|
-
label: textOverride('None', 'None'),
|
|
62456
|
-
value: 0
|
|
62457
|
-
}];
|
|
62458
|
-
var dateTimeFormatOptionsItems = Object.keys(dateTimeFormatOptions).map(function (key) {
|
|
62459
|
-
var option = dateTimeFormatOptions[key];
|
|
62460
|
-
return {
|
|
62461
|
-
label: option.description,
|
|
62462
|
-
value: key
|
|
62463
|
-
};
|
|
62464
|
-
});
|
|
62465
|
-
var horizontal = props.attributes.type == 'horizontalBarChart';
|
|
62466
|
-
var showXAxisNumberFormatter = ((_props$attributes = props.attributes) == null || (_props$attributes = _props$attributes.dimension) == null ? void 0 : _props$attributes.length) > 0 && findField(props.dataSet, (_props$attributes2 = props.attributes) == null || (_props$attributes2 = _props$attributes2.dimension[0]) == null ? void 0 : _props$attributes2.field).dataType === 'number' && !((_props$attributes3 = props.attributes) != null && _props$attributes3.timeDimension);
|
|
62467
|
-
var showXAxisDateFormatOptions = !!((_props$attributes4 = props.attributes) != null && _props$attributes4.timeDimension);
|
|
62468
|
-
var _ref = horizontal ? {
|
|
62469
|
-
x: 'y',
|
|
62470
|
-
y: 'x'
|
|
62471
|
-
} : {
|
|
62472
|
-
x: 'x',
|
|
62473
|
-
y: 'y'
|
|
62474
|
-
},
|
|
62475
|
-
x = _ref.x,
|
|
62476
|
-
y = _ref.y;
|
|
62477
|
-
return jsx(Section, {
|
|
62478
|
-
title: (_props$section = props.section) == null ? void 0 : _props$section.title,
|
|
62479
|
-
tooltip: (_props$section2 = props.section) == null ? void 0 : _props$section2.description,
|
|
62480
|
-
"data-component": "axis-preference-section",
|
|
62481
|
-
children: jsxs(Section.Container, {
|
|
62482
|
-
"data-component": "single-stats-labels",
|
|
62483
|
-
children: [jsxs(Section.Panel, {
|
|
62484
|
-
title: (_props$section$y = props.section[y]) == null ? void 0 : _props$section$y.title,
|
|
62485
|
-
children: [jsxs(Section.Grid, {
|
|
62486
|
-
columns: 2,
|
|
62487
|
-
children: [jsx(TextInput, {
|
|
62488
|
-
label: props.section[y].prefix.title,
|
|
62489
|
-
setText: function setText(yAxisPrefix) {
|
|
62490
|
-
return props.setAttributes({
|
|
62491
|
-
yAxisPrefix: yAxisPrefix
|
|
62492
|
-
});
|
|
62493
|
-
},
|
|
62494
|
-
currentValue: props.attributes.yAxisPrefix,
|
|
62495
|
-
maxLength: 4,
|
|
62496
|
-
id: "axis-" + y + "-prefix"
|
|
62497
|
-
}), jsx(TextInput, {
|
|
62498
|
-
label: props.section[y].postfix.title,
|
|
62499
|
-
setText: function setText(yAxisPostfix) {
|
|
62500
|
-
return props.setAttributes({
|
|
62501
|
-
yAxisPostfix: yAxisPostfix
|
|
62502
|
-
});
|
|
62503
|
-
},
|
|
62504
|
-
currentValue: props.attributes.yAxisPostfix,
|
|
62505
|
-
maxLength: 4,
|
|
62506
|
-
id: "axis-" + y + "-postfix"
|
|
62507
|
-
})]
|
|
62508
|
-
}), jsxs(Section.Grid, {
|
|
62509
|
-
columns: 2,
|
|
62510
|
-
children: [jsx(SelectNumberFormat, {
|
|
62511
|
-
label: (_props$section$y$form = props.section[y].format) == null ? void 0 : _props$section$y$form.title,
|
|
62512
|
-
id: "axis-" + y + "-format",
|
|
62513
|
-
onChange: function onChange(yAxisFormat) {
|
|
62514
|
-
return props.setAttributes({
|
|
62515
|
-
yAxisFormat: yAxisFormat
|
|
62516
|
-
});
|
|
62517
|
-
},
|
|
62518
|
-
currentValue: props.attributes.yAxisFormat,
|
|
62519
|
-
testId: "axis-" + y + "-format"
|
|
62520
|
-
}), jsx(FormatSelectInput, {
|
|
62521
|
-
id: "axis-" + y + "-label-count",
|
|
62522
|
-
label: props.section.y.count.title,
|
|
62523
|
-
currentValue: props.attributes.approxYAxisLabelCount,
|
|
62524
|
-
onSelect: function onSelect(approxYAxisLabelCount) {
|
|
62525
|
-
return props.setAttributes({
|
|
62526
|
-
approxYAxisLabelCount: approxYAxisLabelCount
|
|
62527
|
-
});
|
|
62528
|
-
},
|
|
62529
|
-
options: axisOptions
|
|
62530
|
-
})]
|
|
62531
|
-
}), jsx(Section.Grid, {
|
|
62532
|
-
children: props.section[y].axisTitle && jsx(TextInput, {
|
|
62533
|
-
label: (_props$section$y$axis = props.section[y].axisTitle.title) != null ? _props$section$y$axis : '',
|
|
62534
|
-
setText: function setText(axisTitle) {
|
|
62535
|
-
var _axisTitles;
|
|
62536
|
-
return props.setAttributes({
|
|
62537
|
-
axisTitles: (_axisTitles = {}, _axisTitles[y] = axisTitle, _axisTitles)
|
|
62538
|
-
});
|
|
62539
|
-
},
|
|
62540
|
-
currentValue: (_props$attributes$axi = props.attributes.axisTitles) == null ? void 0 : _props$attributes$axi[y],
|
|
62541
|
-
id: "axis-" + [y] + "-axisTitle"
|
|
62542
|
-
})
|
|
62543
|
-
})]
|
|
62544
|
-
}), jsxs(Section.Panel, {
|
|
62545
|
-
title: props.section[x].title,
|
|
62546
|
-
children: [jsxs(Section.Grid, {
|
|
62547
|
-
columns: 2,
|
|
62548
|
-
children: [jsx(TextInput, {
|
|
62549
|
-
label: props.section[x].prefix.title,
|
|
62550
|
-
setText: function setText(xAxisPrefix) {
|
|
62551
|
-
return props.setAttributes({
|
|
62552
|
-
xAxisPrefix: xAxisPrefix
|
|
62553
|
-
});
|
|
62554
|
-
},
|
|
62555
|
-
currentValue: props.attributes.xAxisPrefix,
|
|
62556
|
-
maxLength: 4,
|
|
62557
|
-
id: "axis-" + x + "-prefix"
|
|
62558
|
-
}), jsx(TextInput, {
|
|
62559
|
-
label: props.section[x].postfix.title,
|
|
62560
|
-
setText: function setText(xAxisPostfix) {
|
|
62561
|
-
return props.setAttributes({
|
|
62562
|
-
xAxisPostfix: xAxisPostfix
|
|
62563
|
-
});
|
|
62564
|
-
},
|
|
62565
|
-
currentValue: props.attributes.xAxisPostfix,
|
|
62566
|
-
maxLength: 4,
|
|
62567
|
-
id: "axis-" + x + "-postfix"
|
|
62568
|
-
})]
|
|
62569
|
-
}), jsx(Section.Grid, {
|
|
62570
|
-
columns: showXAxisNumberFormatter || showXAxisDateFormatOptions ? 2 : 1,
|
|
62571
|
-
children: jsxs(Fragment$1, {
|
|
62572
|
-
children: [showXAxisNumberFormatter && jsx(SelectNumberFormat, {
|
|
62573
|
-
label: (_props$section$x$form = props.section[x].format) == null ? void 0 : _props$section$x$form.title,
|
|
62574
|
-
id: "axis-" + x + "-format",
|
|
62575
|
-
onChange: function onChange(xAxisFormat) {
|
|
62576
|
-
props.setAttributes({
|
|
62577
|
-
xAxisFormat: xAxisFormat
|
|
62578
|
-
});
|
|
62579
|
-
},
|
|
62580
|
-
currentValue: props.attributes.xAxisFormat,
|
|
62581
|
-
testId: "axis-" + y + "-format"
|
|
62582
|
-
}), showXAxisDateFormatOptions ? jsxs(Fragment$1, {
|
|
62583
|
-
children: [jsx(FormatSelectInput, {
|
|
62584
|
-
id: "axis-" + x + "-label-date-format",
|
|
62585
|
-
label: ((_props$section$x = props.section.x) == null || (_props$section$x = _props$section$x.format) == null ? void 0 : _props$section$x.title) || 'Format',
|
|
62586
|
-
currentValue: props.attributes.xAxisFormat,
|
|
62587
|
-
onSelect: function onSelect(xAxisFormat) {
|
|
62588
|
-
return props.setAttributes({
|
|
62589
|
-
xAxisFormat: xAxisFormat
|
|
62590
|
-
});
|
|
62591
|
-
},
|
|
62592
|
-
options: dateTimeFormatOptionsItems
|
|
62593
|
-
}), jsx(FormatSelectInput, {
|
|
62594
|
-
id: "axis-" + x + "-label-count",
|
|
62595
|
-
label: props.section.x.count.title,
|
|
62596
|
-
currentValue: props.attributes.approxXAxisLabelCount,
|
|
62597
|
-
onSelect: function onSelect(approxXAxisLabelCount) {
|
|
62598
|
-
return props.setAttributes({
|
|
62599
|
-
approxXAxisLabelCount: approxXAxisLabelCount
|
|
62600
|
-
});
|
|
62601
|
-
},
|
|
62602
|
-
options: axisOptions
|
|
62603
|
-
})]
|
|
62604
|
-
}) : jsx(Checkbox, {
|
|
62605
|
-
label: textOverride('hide_labels', 'Hide Labels'),
|
|
62606
|
-
onChange: function onChange(event) {
|
|
62607
|
-
return props.setAttributes({
|
|
62608
|
-
approxXAxisLabelCount: event ? 0 : 'auto'
|
|
62609
|
-
});
|
|
62610
|
-
},
|
|
62611
|
-
id: "hide-labels",
|
|
62612
|
-
currentValue: props.attributes.approxXAxisLabelCount === 0 ? true : false
|
|
62613
|
-
})]
|
|
62614
|
-
})
|
|
62615
|
-
}), jsx(Section.Grid, {
|
|
62616
|
-
children: props.section[x].axisTitle && jsx(TextInput, {
|
|
62617
|
-
label: (_props$section$x$axis = props.section[x].axisTitle.title) != null ? _props$section$x$axis : '',
|
|
62618
|
-
setText: function setText(axisTitle) {
|
|
62619
|
-
var _axisTitles2;
|
|
62620
|
-
return props.setAttributes({
|
|
62621
|
-
axisTitles: (_axisTitles2 = {}, _axisTitles2[x] = axisTitle, _axisTitles2)
|
|
62622
|
-
});
|
|
62623
|
-
},
|
|
62624
|
-
currentValue: (_props$attributes$axi2 = props.attributes.axisTitles) == null ? void 0 : _props$attributes$axi2[x],
|
|
62625
|
-
id: "axis-" + [x] + "-axisTitle"
|
|
62626
|
-
})
|
|
62627
|
-
})]
|
|
62628
|
-
})]
|
|
62629
|
-
})
|
|
62630
|
-
});
|
|
62631
|
-
};
|
|
62632
|
-
|
|
62633
62675
|
function updateAttributes(fromModal, existingArray, rule) {
|
|
62634
62676
|
var newArray;
|
|
62635
62677
|
if (typeof fromModal === 'object' && fromModal !== null) {
|
|
@@ -62920,72 +62962,195 @@ var FormatSection = function FormatSection(props) {
|
|
|
62920
62962
|
});
|
|
62921
62963
|
};
|
|
62922
62964
|
|
|
62923
|
-
var
|
|
62924
|
-
var _props$
|
|
62925
|
-
var _useDashboardContext = useDashboardContext(),
|
|
62926
|
-
dispatch = _useDashboardContext.dispatch;
|
|
62965
|
+
var GoalLineRules = function GoalLineRules(props) {
|
|
62966
|
+
var _props$goalLines;
|
|
62927
62967
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
62928
62968
|
mode = _useDashboardBehaviou.mode,
|
|
62929
|
-
textOverride = _useDashboardBehaviou.textOverride
|
|
62930
|
-
|
|
62931
|
-
|
|
62932
|
-
|
|
62933
|
-
|
|
62934
|
-
prefixes: [].concat((_props$attributes$pre = props.attributes.prefixes) != null ? _props$attributes$pre : [], [prefix])
|
|
62935
|
-
});
|
|
62936
|
-
}
|
|
62969
|
+
textOverride = _useDashboardBehaviou.textOverride,
|
|
62970
|
+
variables = _useDashboardBehaviou.variables;
|
|
62971
|
+
var _useDashboardContext = useDashboardContext(),
|
|
62972
|
+
dispatch = _useDashboardContext.dispatch;
|
|
62973
|
+
var closeModal = function closeModal() {
|
|
62937
62974
|
dispatch({
|
|
62938
62975
|
type: 'setActiveModal',
|
|
62939
62976
|
payload: {
|
|
62940
|
-
modal: ModalType.
|
|
62977
|
+
modal: ModalType.GoalLines,
|
|
62941
62978
|
attributes: undefined
|
|
62942
62979
|
}
|
|
62943
62980
|
});
|
|
62944
62981
|
};
|
|
62945
|
-
var
|
|
62982
|
+
var handleModalDispatch = function handleModalDispatch(existingRule) {
|
|
62946
62983
|
dispatch({
|
|
62947
62984
|
type: 'setActiveModal',
|
|
62948
62985
|
payload: {
|
|
62949
|
-
modal: ModalType.
|
|
62986
|
+
modal: ModalType.GoalLines,
|
|
62950
62987
|
attributes: {
|
|
62951
62988
|
show: true,
|
|
62952
|
-
onClose:
|
|
62953
|
-
|
|
62954
|
-
|
|
62989
|
+
onClose: function onClose() {
|
|
62990
|
+
return closeModal();
|
|
62991
|
+
},
|
|
62992
|
+
onSave: function onSave(newRule) {
|
|
62993
|
+
var newGoalLineArray = updateAttributes(existingRule != null ? existingRule : true, props.goalLines, newRule);
|
|
62994
|
+
props.onSetGoalLineRules(newGoalLineArray);
|
|
62995
|
+
closeModal();
|
|
62996
|
+
},
|
|
62997
|
+
goalLine: existingRule != null ? existingRule : undefined
|
|
62955
62998
|
}
|
|
62956
62999
|
}
|
|
62957
63000
|
});
|
|
62958
63001
|
};
|
|
62959
|
-
return jsx(
|
|
62960
|
-
title: props == null ? void 0 : props.section.title,
|
|
62961
|
-
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63002
|
+
return jsx(Fragment$1, {
|
|
62962
63003
|
children: jsx(ListView, {
|
|
62963
63004
|
mode: mode,
|
|
62964
|
-
|
|
62965
|
-
var
|
|
62966
|
-
|
|
62967
|
-
|
|
62968
|
-
|
|
62969
|
-
|
|
63005
|
+
onOrderChange: function onOrderChange(index, toIndex) {
|
|
63006
|
+
var newFormattingRules = reOrderItems([].concat(props.goalLines), index, toIndex);
|
|
63007
|
+
props.onSetGoalLineRules(newFormattingRules);
|
|
63008
|
+
},
|
|
63009
|
+
purpose: "goal-lines",
|
|
63010
|
+
items: ((_props$goalLines = props.goalLines) != null ? _props$goalLines : []).map(function (rule, index) {
|
|
63011
|
+
var hasValidVariable = validate(rule.value, variables == null ? void 0 : variables.variables);
|
|
62970
63012
|
return {
|
|
62971
|
-
title:
|
|
62972
|
-
|
|
62973
|
-
|
|
63013
|
+
title: jsxs(Flex, {
|
|
63014
|
+
alignItems: "center",
|
|
63015
|
+
gap: "0.25rem",
|
|
63016
|
+
children: [jsx(Color.Swatch, {
|
|
63017
|
+
color: rule.color
|
|
63018
|
+
}), jsx("span", {
|
|
63019
|
+
dangerouslySetInnerHTML: {
|
|
63020
|
+
__html: textOverride('goal_line_configuration', 'Set to <strong>[[ruleValue]]</strong>', {
|
|
63021
|
+
ruleValue: rule.value
|
|
63022
|
+
})
|
|
63023
|
+
}
|
|
63024
|
+
}), !hasValidVariable && jsx("div", {
|
|
63025
|
+
"aria-label": textOverride('goal_line.variable_not_available', 'This variable is not available.'),
|
|
63026
|
+
children: jsx(Tooltip, {
|
|
63027
|
+
tooltipContent: function tooltipContent() {
|
|
63028
|
+
return jsx(Fragment, {
|
|
63029
|
+
children: textOverride('goal_line.variable_not_available', 'This variable is not available.')
|
|
63030
|
+
});
|
|
63031
|
+
},
|
|
63032
|
+
children: jsx(ErrorIcon, {})
|
|
63033
|
+
})
|
|
63034
|
+
})]
|
|
63035
|
+
}),
|
|
63036
|
+
onClick: function onClick() {
|
|
63037
|
+
return handleModalDispatch(rule);
|
|
63038
|
+
},
|
|
63039
|
+
id: "goal-line-" + index
|
|
62974
63040
|
};
|
|
62975
63041
|
}),
|
|
62976
63042
|
newItemBtn: {
|
|
62977
|
-
callToAction: textOverride('
|
|
63043
|
+
callToAction: textOverride('add_goal_line', 'Add Goal Line'),
|
|
62978
63044
|
onClick: function onClick() {
|
|
62979
|
-
return
|
|
63045
|
+
return handleModalDispatch();
|
|
62980
63046
|
}
|
|
62981
63047
|
},
|
|
62982
63048
|
onDeleteItem: function onDeleteItem(index) {
|
|
62983
|
-
var _props$
|
|
62984
|
-
var
|
|
62985
|
-
|
|
63049
|
+
var _props$goalLines2;
|
|
63050
|
+
var newRules = [].concat((_props$goalLines2 = props.goalLines) != null ? _props$goalLines2 : []);
|
|
63051
|
+
newRules.splice(index, 1);
|
|
63052
|
+
props.onSetGoalLineRules(newRules);
|
|
63053
|
+
}
|
|
63054
|
+
})
|
|
63055
|
+
});
|
|
63056
|
+
};
|
|
63057
|
+
|
|
63058
|
+
var GoalLineSection = function GoalLineSection(props) {
|
|
63059
|
+
var _props$section;
|
|
63060
|
+
return jsx(Section, {
|
|
63061
|
+
title: props == null ? void 0 : props.section.title,
|
|
63062
|
+
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63063
|
+
children: jsx(GoalLineRules, {
|
|
63064
|
+
onSetGoalLineRules: function onSetGoalLineRules(goalLines) {
|
|
63065
|
+
return props.setAttributes({
|
|
63066
|
+
goalLines: goalLines
|
|
63067
|
+
});
|
|
63068
|
+
},
|
|
63069
|
+
goalLines: props.attributes.goalLines
|
|
63070
|
+
})
|
|
63071
|
+
});
|
|
63072
|
+
};
|
|
63073
|
+
|
|
63074
|
+
var HeadingSection = function HeadingSection(_ref) {
|
|
63075
|
+
var _section$subSection;
|
|
63076
|
+
var section = _ref.section,
|
|
63077
|
+
setAttributes = _ref.setAttributes,
|
|
63078
|
+
attributes = _ref.attributes;
|
|
63079
|
+
var handleInputChange = useInputDebounce(setAttributes);
|
|
63080
|
+
return jsx(Section, {
|
|
63081
|
+
title: section.title,
|
|
63082
|
+
tooltip: section == null ? void 0 : section.description,
|
|
63083
|
+
children: jsx(Section.Grid, {
|
|
63084
|
+
children: section == null || (_section$subSection = section.subSection) == null ? void 0 : _section$subSection.map(function (section, i) {
|
|
63085
|
+
return jsxs(Fragment, {
|
|
63086
|
+
children: [section.type === 'title' && jsx("div", {
|
|
63087
|
+
children: jsx(Input, {
|
|
63088
|
+
label: section == null ? void 0 : section.title,
|
|
63089
|
+
"data-testid": "display-title-input",
|
|
63090
|
+
id: "display-title-input",
|
|
63091
|
+
type: "text",
|
|
63092
|
+
onChange: function onChange(input) {
|
|
63093
|
+
return handleInputChange({
|
|
63094
|
+
displayTitle: input.target.value
|
|
63095
|
+
});
|
|
63096
|
+
},
|
|
63097
|
+
defaultValue: attributes.displayTitle
|
|
63098
|
+
})
|
|
63099
|
+
}), section.type === 'subject' && jsx("div", {
|
|
63100
|
+
children: jsx(Input, {
|
|
63101
|
+
label: section == null ? void 0 : section.title,
|
|
63102
|
+
"data-testid": "display-subject-input",
|
|
63103
|
+
id: "display-subject-input",
|
|
63104
|
+
type: "text",
|
|
63105
|
+
onChange: function onChange(input) {
|
|
63106
|
+
return handleInputChange({
|
|
63107
|
+
displaySubject: input.target.value
|
|
63108
|
+
});
|
|
63109
|
+
},
|
|
63110
|
+
defaultValue: attributes.displaySubject
|
|
63111
|
+
})
|
|
63112
|
+
})]
|
|
63113
|
+
}, i);
|
|
63114
|
+
})
|
|
63115
|
+
})
|
|
63116
|
+
});
|
|
63117
|
+
};
|
|
63118
|
+
|
|
63119
|
+
var HeadlineSection = function HeadlineSection(props) {
|
|
63120
|
+
var _props$section, _props$attributes$hea, _props$attributes$hea2;
|
|
63121
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63122
|
+
textOverride = _useDashboardBehaviou.textOverride;
|
|
63123
|
+
if (props.dataSet.preAggregated) return null;
|
|
63124
|
+
if (!canHaveHeadline(props.attributes.order, props.attributes.timeDimension)) return null;
|
|
63125
|
+
var options = function () {
|
|
63126
|
+
var builtOptions = [{
|
|
63127
|
+
label: textOverride('none', 'None'),
|
|
63128
|
+
value: null
|
|
63129
|
+
}, {
|
|
63130
|
+
label: textOverride('current', 'Current'),
|
|
63131
|
+
value: 'current'
|
|
63132
|
+
}];
|
|
63133
|
+
return builtOptions;
|
|
63134
|
+
}();
|
|
63135
|
+
return jsx(Section, {
|
|
63136
|
+
title: props == null ? void 0 : props.section.title,
|
|
63137
|
+
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63138
|
+
children: jsx(Select$2, {
|
|
63139
|
+
id: "headline-options",
|
|
63140
|
+
label: textOverride('options', 'Options'),
|
|
63141
|
+
labelHidden: true,
|
|
63142
|
+
onChange: function onChange(value) {
|
|
62986
63143
|
props.setAttributes({
|
|
62987
|
-
|
|
63144
|
+
headline: {
|
|
63145
|
+
func: value
|
|
63146
|
+
}
|
|
62988
63147
|
});
|
|
63148
|
+
},
|
|
63149
|
+
options: options,
|
|
63150
|
+
selected: (_props$attributes$hea = (_props$attributes$hea2 = props.attributes.headline) == null ? void 0 : _props$attributes$hea2.func) != null ? _props$attributes$hea : null,
|
|
63151
|
+
textOverride: textOverride,
|
|
63152
|
+
onClick: function onClick() {
|
|
63153
|
+
safeScrollBy('bottom', 'editor-panel');
|
|
62989
63154
|
}
|
|
62990
63155
|
})
|
|
62991
63156
|
});
|
|
@@ -63056,6 +63221,124 @@ var MapColorsSection = function MapColorsSection(props) {
|
|
|
63056
63221
|
});
|
|
63057
63222
|
};
|
|
63058
63223
|
|
|
63224
|
+
var PrefixesSection = function PrefixesSection(props) {
|
|
63225
|
+
var _props$section, _props$attributes$pre2;
|
|
63226
|
+
var _useDashboardContext = useDashboardContext(),
|
|
63227
|
+
dispatch = _useDashboardContext.dispatch;
|
|
63228
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63229
|
+
mode = _useDashboardBehaviou.mode,
|
|
63230
|
+
textOverride = _useDashboardBehaviou.textOverride;
|
|
63231
|
+
var handleSavePrefix = function handleSavePrefix(prefix) {
|
|
63232
|
+
if (prefix) {
|
|
63233
|
+
var _props$attributes$pre;
|
|
63234
|
+
props.setAttributes({
|
|
63235
|
+
prefixes: [].concat((_props$attributes$pre = props.attributes.prefixes) != null ? _props$attributes$pre : [], [prefix])
|
|
63236
|
+
});
|
|
63237
|
+
}
|
|
63238
|
+
dispatch({
|
|
63239
|
+
type: 'setActiveModal',
|
|
63240
|
+
payload: {
|
|
63241
|
+
modal: ModalType.Prefix,
|
|
63242
|
+
attributes: undefined
|
|
63243
|
+
}
|
|
63244
|
+
});
|
|
63245
|
+
};
|
|
63246
|
+
var handleOpen = function handleOpen() {
|
|
63247
|
+
dispatch({
|
|
63248
|
+
type: 'setActiveModal',
|
|
63249
|
+
payload: {
|
|
63250
|
+
modal: ModalType.Prefix,
|
|
63251
|
+
attributes: {
|
|
63252
|
+
show: true,
|
|
63253
|
+
onClose: handleSavePrefix,
|
|
63254
|
+
measures: props.attributes.measure,
|
|
63255
|
+
dataSet: props.dataSet
|
|
63256
|
+
}
|
|
63257
|
+
}
|
|
63258
|
+
});
|
|
63259
|
+
};
|
|
63260
|
+
return jsx(Section, {
|
|
63261
|
+
title: props == null ? void 0 : props.section.title,
|
|
63262
|
+
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63263
|
+
children: jsx(ListView, {
|
|
63264
|
+
mode: mode,
|
|
63265
|
+
items: ((_props$attributes$pre2 = props.attributes.prefixes) != null ? _props$attributes$pre2 : []).map(function (prefix, index) {
|
|
63266
|
+
var _Field$getQueryFieldI = getQueryFieldIdFromResultFieldId(prefix.field, props.queryEngineConfig),
|
|
63267
|
+
queryFieldId = _Field$getQueryFieldI.fieldId,
|
|
63268
|
+
func = _Field$getQueryFieldI["function"];
|
|
63269
|
+
var dataSetField = findField(props.dataSet, queryFieldId);
|
|
63270
|
+
var title = "" + dataSetField.publicName + (func != 'none' ? " (" + props.queryEngineConfig.supportedAggregates[func].publicName + ")" : '');
|
|
63271
|
+
return {
|
|
63272
|
+
title: title,
|
|
63273
|
+
subtext: prefix.prefix,
|
|
63274
|
+
id: "prefix-" + index
|
|
63275
|
+
};
|
|
63276
|
+
}),
|
|
63277
|
+
newItemBtn: {
|
|
63278
|
+
callToAction: textOverride('add_prefix', 'Add Prefix'),
|
|
63279
|
+
onClick: function onClick() {
|
|
63280
|
+
return handleOpen();
|
|
63281
|
+
}
|
|
63282
|
+
},
|
|
63283
|
+
onDeleteItem: function onDeleteItem(index) {
|
|
63284
|
+
var _props$attributes$pre3;
|
|
63285
|
+
var newPrefixes = [].concat((_props$attributes$pre3 = props.attributes.prefixes) != null ? _props$attributes$pre3 : []);
|
|
63286
|
+
newPrefixes.splice(index, 1);
|
|
63287
|
+
props.setAttributes({
|
|
63288
|
+
prefixes: newPrefixes
|
|
63289
|
+
});
|
|
63290
|
+
}
|
|
63291
|
+
})
|
|
63292
|
+
});
|
|
63293
|
+
};
|
|
63294
|
+
|
|
63295
|
+
var ProgressTypeSection = function ProgressTypeSection(props) {
|
|
63296
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63297
|
+
textOverride = _useDashboardBehaviou.textOverride;
|
|
63298
|
+
return jsx(Section, {
|
|
63299
|
+
title: textOverride('type', 'Type'),
|
|
63300
|
+
children: jsxs(Section.Grid, {
|
|
63301
|
+
children: [props.attributes.goals.length === 0 && jsx(Alert, {
|
|
63302
|
+
type: "info",
|
|
63303
|
+
title: textOverride('progress.goals_need to be set', 'Goals need to be set')
|
|
63304
|
+
}), jsx(OpacityOverlay, {
|
|
63305
|
+
enabled: props.attributes.goals.length === 0,
|
|
63306
|
+
children: jsx(FormatSelectInput, {
|
|
63307
|
+
options: [{
|
|
63308
|
+
value: ProgressType.Linear,
|
|
63309
|
+
label: textOverride('linear', 'Linear')
|
|
63310
|
+
}, {
|
|
63311
|
+
value: ProgressType.Circular,
|
|
63312
|
+
label: textOverride('circular', 'Circular')
|
|
63313
|
+
}],
|
|
63314
|
+
currentValue: defaultProgressType(props.attributes.progressType),
|
|
63315
|
+
onSelect: function onSelect(progressType) {
|
|
63316
|
+
var newProgressType = props.attributes.progressType.map(function (obj) {
|
|
63317
|
+
return _extends({}, obj, {
|
|
63318
|
+
value: progressType
|
|
63319
|
+
});
|
|
63320
|
+
});
|
|
63321
|
+
props.setAttributes({
|
|
63322
|
+
progressType: newProgressType
|
|
63323
|
+
});
|
|
63324
|
+
},
|
|
63325
|
+
label: textOverride('type', 'Type'),
|
|
63326
|
+
labelHidden: true
|
|
63327
|
+
})
|
|
63328
|
+
})]
|
|
63329
|
+
})
|
|
63330
|
+
});
|
|
63331
|
+
};
|
|
63332
|
+
|
|
63333
|
+
var RichTextFormatSection = function RichTextFormatSection(props) {
|
|
63334
|
+
var _props$section;
|
|
63335
|
+
return jsx(Section, {
|
|
63336
|
+
title: props == null ? void 0 : props.section.title,
|
|
63337
|
+
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63338
|
+
children: jsx(RichTextMenu, {})
|
|
63339
|
+
});
|
|
63340
|
+
};
|
|
63341
|
+
|
|
63059
63342
|
var StatsLabelsSection = function StatsLabelsSection(props) {
|
|
63060
63343
|
var _props$section, _props$section2;
|
|
63061
63344
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
@@ -63138,202 +63421,6 @@ var StatsLabelsSection = function StatsLabelsSection(props) {
|
|
|
63138
63421
|
});
|
|
63139
63422
|
};
|
|
63140
63423
|
|
|
63141
|
-
var GoalLineRules = function GoalLineRules(props) {
|
|
63142
|
-
var _props$goalLines;
|
|
63143
|
-
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63144
|
-
mode = _useDashboardBehaviou.mode,
|
|
63145
|
-
textOverride = _useDashboardBehaviou.textOverride,
|
|
63146
|
-
variables = _useDashboardBehaviou.variables;
|
|
63147
|
-
var _useDashboardContext = useDashboardContext(),
|
|
63148
|
-
dispatch = _useDashboardContext.dispatch;
|
|
63149
|
-
var closeModal = function closeModal() {
|
|
63150
|
-
dispatch({
|
|
63151
|
-
type: 'setActiveModal',
|
|
63152
|
-
payload: {
|
|
63153
|
-
modal: ModalType.GoalLines,
|
|
63154
|
-
attributes: undefined
|
|
63155
|
-
}
|
|
63156
|
-
});
|
|
63157
|
-
};
|
|
63158
|
-
var handleModalDispatch = function handleModalDispatch(existingRule) {
|
|
63159
|
-
dispatch({
|
|
63160
|
-
type: 'setActiveModal',
|
|
63161
|
-
payload: {
|
|
63162
|
-
modal: ModalType.GoalLines,
|
|
63163
|
-
attributes: {
|
|
63164
|
-
show: true,
|
|
63165
|
-
onClose: function onClose() {
|
|
63166
|
-
return closeModal();
|
|
63167
|
-
},
|
|
63168
|
-
onSave: function onSave(newRule) {
|
|
63169
|
-
var newGoalLineArray = updateAttributes(existingRule != null ? existingRule : true, props.goalLines, newRule);
|
|
63170
|
-
props.onSetGoalLineRules(newGoalLineArray);
|
|
63171
|
-
closeModal();
|
|
63172
|
-
},
|
|
63173
|
-
goalLine: existingRule != null ? existingRule : undefined
|
|
63174
|
-
}
|
|
63175
|
-
}
|
|
63176
|
-
});
|
|
63177
|
-
};
|
|
63178
|
-
return jsx(Fragment$1, {
|
|
63179
|
-
children: jsx(ListView, {
|
|
63180
|
-
mode: mode,
|
|
63181
|
-
onOrderChange: function onOrderChange(index, toIndex) {
|
|
63182
|
-
var newFormattingRules = reOrderItems([].concat(props.goalLines), index, toIndex);
|
|
63183
|
-
props.onSetGoalLineRules(newFormattingRules);
|
|
63184
|
-
},
|
|
63185
|
-
purpose: "goal-lines",
|
|
63186
|
-
items: ((_props$goalLines = props.goalLines) != null ? _props$goalLines : []).map(function (rule, index) {
|
|
63187
|
-
var hasValidVariable = validate(rule.value, variables == null ? void 0 : variables.variables);
|
|
63188
|
-
return {
|
|
63189
|
-
title: jsxs(Flex, {
|
|
63190
|
-
alignItems: "center",
|
|
63191
|
-
gap: "0.25rem",
|
|
63192
|
-
children: [jsx(Color.Swatch, {
|
|
63193
|
-
color: rule.color
|
|
63194
|
-
}), jsx("span", {
|
|
63195
|
-
dangerouslySetInnerHTML: {
|
|
63196
|
-
__html: textOverride('goal_line_configuration', 'Set to <strong>[[ruleValue]]</strong>', {
|
|
63197
|
-
ruleValue: rule.value
|
|
63198
|
-
})
|
|
63199
|
-
}
|
|
63200
|
-
}), !hasValidVariable && jsx("div", {
|
|
63201
|
-
"aria-label": textOverride('goal_line.variable_not_available', 'This variable is not available.'),
|
|
63202
|
-
children: jsx(Tooltip, {
|
|
63203
|
-
tooltipContent: function tooltipContent() {
|
|
63204
|
-
return jsx(Fragment, {
|
|
63205
|
-
children: textOverride('goal_line.variable_not_available', 'This variable is not available.')
|
|
63206
|
-
});
|
|
63207
|
-
},
|
|
63208
|
-
children: jsx(ErrorIcon, {})
|
|
63209
|
-
})
|
|
63210
|
-
})]
|
|
63211
|
-
}),
|
|
63212
|
-
onClick: function onClick() {
|
|
63213
|
-
return handleModalDispatch(rule);
|
|
63214
|
-
},
|
|
63215
|
-
id: "goal-line-" + index
|
|
63216
|
-
};
|
|
63217
|
-
}),
|
|
63218
|
-
newItemBtn: {
|
|
63219
|
-
callToAction: textOverride('add_goal_line', 'Add Goal Line'),
|
|
63220
|
-
onClick: function onClick() {
|
|
63221
|
-
return handleModalDispatch();
|
|
63222
|
-
}
|
|
63223
|
-
},
|
|
63224
|
-
onDeleteItem: function onDeleteItem(index) {
|
|
63225
|
-
var _props$goalLines2;
|
|
63226
|
-
var newRules = [].concat((_props$goalLines2 = props.goalLines) != null ? _props$goalLines2 : []);
|
|
63227
|
-
newRules.splice(index, 1);
|
|
63228
|
-
props.onSetGoalLineRules(newRules);
|
|
63229
|
-
}
|
|
63230
|
-
})
|
|
63231
|
-
});
|
|
63232
|
-
};
|
|
63233
|
-
|
|
63234
|
-
var GoalLineSection = function GoalLineSection(props) {
|
|
63235
|
-
var _props$section;
|
|
63236
|
-
return jsx(Section, {
|
|
63237
|
-
title: props == null ? void 0 : props.section.title,
|
|
63238
|
-
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63239
|
-
children: jsx(GoalLineRules, {
|
|
63240
|
-
onSetGoalLineRules: function onSetGoalLineRules(goalLines) {
|
|
63241
|
-
return props.setAttributes({
|
|
63242
|
-
goalLines: goalLines
|
|
63243
|
-
});
|
|
63244
|
-
},
|
|
63245
|
-
goalLines: props.attributes.goalLines
|
|
63246
|
-
})
|
|
63247
|
-
});
|
|
63248
|
-
};
|
|
63249
|
-
|
|
63250
|
-
var ProgressTypeSection = function ProgressTypeSection(props) {
|
|
63251
|
-
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63252
|
-
textOverride = _useDashboardBehaviou.textOverride;
|
|
63253
|
-
return jsx(Section, {
|
|
63254
|
-
title: textOverride('type', 'Type'),
|
|
63255
|
-
children: jsxs(Section.Grid, {
|
|
63256
|
-
children: [props.attributes.goals.length === 0 && jsx(Alert, {
|
|
63257
|
-
type: "info",
|
|
63258
|
-
title: textOverride('progress.goals_need to be set', 'Goals need to be set')
|
|
63259
|
-
}), jsx(OpacityOverlay, {
|
|
63260
|
-
enabled: props.attributes.goals.length === 0,
|
|
63261
|
-
children: jsx(FormatSelectInput, {
|
|
63262
|
-
options: [{
|
|
63263
|
-
value: ProgressType.Linear,
|
|
63264
|
-
label: textOverride('linear', 'Linear')
|
|
63265
|
-
}, {
|
|
63266
|
-
value: ProgressType.Circular,
|
|
63267
|
-
label: textOverride('circular', 'Circular')
|
|
63268
|
-
}],
|
|
63269
|
-
currentValue: defaultProgressType(props.attributes.progressType),
|
|
63270
|
-
onSelect: function onSelect(progressType) {
|
|
63271
|
-
var newProgressType = props.attributes.progressType.map(function (obj) {
|
|
63272
|
-
return _extends({}, obj, {
|
|
63273
|
-
value: progressType
|
|
63274
|
-
});
|
|
63275
|
-
});
|
|
63276
|
-
props.setAttributes({
|
|
63277
|
-
progressType: newProgressType
|
|
63278
|
-
});
|
|
63279
|
-
},
|
|
63280
|
-
label: textOverride('type', 'Type'),
|
|
63281
|
-
labelHidden: true
|
|
63282
|
-
})
|
|
63283
|
-
})]
|
|
63284
|
-
})
|
|
63285
|
-
});
|
|
63286
|
-
};
|
|
63287
|
-
|
|
63288
|
-
var HeadlineSection = function HeadlineSection(props) {
|
|
63289
|
-
var _props$section, _props$attributes$hea, _props$attributes$hea2;
|
|
63290
|
-
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63291
|
-
textOverride = _useDashboardBehaviou.textOverride;
|
|
63292
|
-
if (props.dataSet.preAggregated) return null;
|
|
63293
|
-
if (!canHaveHeadline(props.attributes.order, props.attributes.timeDimension)) return null;
|
|
63294
|
-
var options = function () {
|
|
63295
|
-
var builtOptions = [{
|
|
63296
|
-
label: textOverride('none', 'None'),
|
|
63297
|
-
value: null
|
|
63298
|
-
}, {
|
|
63299
|
-
label: textOverride('current', 'Current'),
|
|
63300
|
-
value: 'current'
|
|
63301
|
-
}];
|
|
63302
|
-
return builtOptions;
|
|
63303
|
-
}();
|
|
63304
|
-
return jsx(Section, {
|
|
63305
|
-
title: props == null ? void 0 : props.section.title,
|
|
63306
|
-
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63307
|
-
children: jsx(Select$2, {
|
|
63308
|
-
id: "headline-options",
|
|
63309
|
-
label: textOverride('options', 'Options'),
|
|
63310
|
-
labelHidden: true,
|
|
63311
|
-
onChange: function onChange(value) {
|
|
63312
|
-
props.setAttributes({
|
|
63313
|
-
headline: {
|
|
63314
|
-
func: value
|
|
63315
|
-
}
|
|
63316
|
-
});
|
|
63317
|
-
},
|
|
63318
|
-
options: options,
|
|
63319
|
-
selected: (_props$attributes$hea = (_props$attributes$hea2 = props.attributes.headline) == null ? void 0 : _props$attributes$hea2.func) != null ? _props$attributes$hea : null,
|
|
63320
|
-
textOverride: textOverride,
|
|
63321
|
-
onClick: function onClick() {
|
|
63322
|
-
safeScrollBy('bottom', 'editor-panel');
|
|
63323
|
-
}
|
|
63324
|
-
})
|
|
63325
|
-
});
|
|
63326
|
-
};
|
|
63327
|
-
|
|
63328
|
-
var RichTextFormatSection = function RichTextFormatSection(props) {
|
|
63329
|
-
var _props$section;
|
|
63330
|
-
return jsx(Section, {
|
|
63331
|
-
title: props == null ? void 0 : props.section.title,
|
|
63332
|
-
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63333
|
-
children: jsx(RichTextMenu, {})
|
|
63334
|
-
});
|
|
63335
|
-
};
|
|
63336
|
-
|
|
63337
63424
|
var WaterfallColorsSection = function WaterfallColorsSection(props) {
|
|
63338
63425
|
var _props$section;
|
|
63339
63426
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|