@vizzly/dashboard 0.15.0-dev-d2bab4f67568f04c6c8cdd5854027babfdc4a1a0 → 0.15.0-dev-5340add72ca1772a21000d5cec6eb7dca78ac285
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
|
@@ -5067,9 +5067,7 @@ var SunburstChart = function SunburstChart(config) {
|
|
|
5067
5067
|
},
|
|
5068
5068
|
formatPanelConfig: function formatPanelConfig() {
|
|
5069
5069
|
var _CONSTANTS$format_pan, _CONSTANTS$format_pan2, _CONSTANTS$format_pan3;
|
|
5070
|
-
return [headingConstant(CONSTANTS$4), _extends({}, namespace(CONSTANTS$4, '
|
|
5071
|
-
ruleType: 'backgroundColor'
|
|
5072
|
-
}), _extends({}, namespace(CONSTANTS$4, 'chart_styles'), {
|
|
5070
|
+
return [headingConstant(CONSTANTS$4), _extends({}, namespace(CONSTANTS$4, 'chart_styles'), {
|
|
5073
5071
|
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]
|
|
5074
5072
|
})];
|
|
5075
5073
|
},
|
|
@@ -26114,33 +26112,6 @@ var buildFilterQuery = function buildFilterQuery(dataSet, fieldId, optionsFilter
|
|
|
26114
26112
|
};
|
|
26115
26113
|
};
|
|
26116
26114
|
|
|
26117
|
-
/** Returns a key to be used in an useEffect dependency, that changes if there's any change to a field in a data set. */
|
|
26118
|
-
var watchDataSetFieldChanges = function watchDataSetFieldChanges(dataSet, queryable) {
|
|
26119
|
-
if ('dataSetId' in queryable) {
|
|
26120
|
-
var watchFields = usedFields(queryable).map(function (field) {
|
|
26121
|
-
return field.fieldId;
|
|
26122
|
-
});
|
|
26123
|
-
|
|
26124
|
-
// Custom fields are the only ones that can have their definition changed. So
|
|
26125
|
-
// we only need to watch them.
|
|
26126
|
-
var watchedCustomFields = watchFields.flatMap(function (fieldId) {
|
|
26127
|
-
try {
|
|
26128
|
-
var dataSetField = findField(dataSet, fieldId);
|
|
26129
|
-
if (isCustomField(dataSetField)) return [dataSetField];
|
|
26130
|
-
return [];
|
|
26131
|
-
} catch (err) {
|
|
26132
|
-
if (err instanceof FieldNotFoundInDataSet) {
|
|
26133
|
-
return [];
|
|
26134
|
-
}
|
|
26135
|
-
throw err;
|
|
26136
|
-
}
|
|
26137
|
-
});
|
|
26138
|
-
return JSON.stringify(watchedCustomFields);
|
|
26139
|
-
} else {
|
|
26140
|
-
return '';
|
|
26141
|
-
}
|
|
26142
|
-
};
|
|
26143
|
-
|
|
26144
26115
|
function processPercentageField(dataSetField, processFiltersCallback) {
|
|
26145
26116
|
return [].concat(processFiltersCallback(dataSetField == null ? void 0 : dataSetField.denominatorFilter), processFiltersCallback(dataSetField == null ? void 0 : dataSetField.numeratorFilter));
|
|
26146
26117
|
}
|
|
@@ -26290,6 +26261,33 @@ var useVariablesInDataSet = function useVariablesInDataSet(dataSet, queryable, v
|
|
|
26290
26261
|
};
|
|
26291
26262
|
};
|
|
26292
26263
|
|
|
26264
|
+
/** Returns a key to be used in an useEffect dependency, that changes if there's any change to a field in a data set. */
|
|
26265
|
+
var watchDataSetFieldChanges = function watchDataSetFieldChanges(dataSet, queryable) {
|
|
26266
|
+
if ('dataSetId' in queryable) {
|
|
26267
|
+
var watchFields = usedFields(queryable).map(function (field) {
|
|
26268
|
+
return field.fieldId;
|
|
26269
|
+
});
|
|
26270
|
+
|
|
26271
|
+
// Custom fields are the only ones that can have their definition changed. So
|
|
26272
|
+
// we only need to watch them.
|
|
26273
|
+
var watchedCustomFields = watchFields.flatMap(function (fieldId) {
|
|
26274
|
+
try {
|
|
26275
|
+
var dataSetField = findField(dataSet, fieldId);
|
|
26276
|
+
if (isCustomField(dataSetField)) return [dataSetField];
|
|
26277
|
+
return [];
|
|
26278
|
+
} catch (err) {
|
|
26279
|
+
if (err instanceof FieldNotFoundInDataSet) {
|
|
26280
|
+
return [];
|
|
26281
|
+
}
|
|
26282
|
+
throw err;
|
|
26283
|
+
}
|
|
26284
|
+
});
|
|
26285
|
+
return JSON.stringify(watchedCustomFields);
|
|
26286
|
+
} else {
|
|
26287
|
+
return '';
|
|
26288
|
+
}
|
|
26289
|
+
};
|
|
26290
|
+
|
|
26293
26291
|
// How to make sure the queries run when a field in a data set has been changed.
|
|
26294
26292
|
// need to pass in the data sets here
|
|
26295
26293
|
|
|
@@ -26311,27 +26309,40 @@ var useQueryEffect = function useQueryEffect(queries, runQueriesCallback, filter
|
|
|
26311
26309
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
26312
26310
|
while (1) switch (_context.prev = _context.next) {
|
|
26313
26311
|
case 0:
|
|
26312
|
+
if (shouldFetch(queries, componentType)) {
|
|
26313
|
+
_context.next = 3;
|
|
26314
|
+
break;
|
|
26315
|
+
}
|
|
26316
|
+
setResults([]);
|
|
26317
|
+
return _context.abrupt("return");
|
|
26318
|
+
case 3:
|
|
26314
26319
|
setQueriesAreChanging(true);
|
|
26315
|
-
_context.next =
|
|
26320
|
+
_context.next = 6;
|
|
26316
26321
|
return fetch(queries, runQueriesCallback, abortController.signal, filterConfig);
|
|
26317
|
-
case
|
|
26322
|
+
case 6:
|
|
26318
26323
|
hasResults = _context.sent;
|
|
26319
|
-
if (hasResults) {
|
|
26320
|
-
|
|
26321
|
-
|
|
26322
|
-
// Only set the results if the signal was not aborted...
|
|
26323
|
-
setResults(hasResults);
|
|
26324
|
-
}
|
|
26325
|
-
} else {
|
|
26326
|
-
if (Array.isArray(queries)) {
|
|
26327
|
-
setResults(queries.map(function (_q) {
|
|
26328
|
-
return null;
|
|
26329
|
-
}));
|
|
26330
|
-
} else {
|
|
26331
|
-
setResults([null]);
|
|
26332
|
-
}
|
|
26324
|
+
if (!hasResults) {
|
|
26325
|
+
_context.next = 11;
|
|
26326
|
+
break;
|
|
26333
26327
|
}
|
|
26334
|
-
|
|
26328
|
+
setQueriesAreChanging(false);
|
|
26329
|
+
if (!abortController.signal.aborted) {
|
|
26330
|
+
// Only set the results if the signal was not aborted...
|
|
26331
|
+
setResults(hasResults);
|
|
26332
|
+
}
|
|
26333
|
+
return _context.abrupt("return");
|
|
26334
|
+
case 11:
|
|
26335
|
+
if (!Array.isArray(queries)) {
|
|
26336
|
+
_context.next = 14;
|
|
26337
|
+
break;
|
|
26338
|
+
}
|
|
26339
|
+
setResults(queries.map(function (_q) {
|
|
26340
|
+
return null;
|
|
26341
|
+
}));
|
|
26342
|
+
return _context.abrupt("return");
|
|
26343
|
+
case 14:
|
|
26344
|
+
setResults([null]);
|
|
26345
|
+
case 15:
|
|
26335
26346
|
case "end":
|
|
26336
26347
|
return _context.stop();
|
|
26337
26348
|
}
|
|
@@ -26358,6 +26369,16 @@ var useQueryEffect = function useQueryEffect(queries, runQueriesCallback, filter
|
|
|
26358
26369
|
queriesAreChanging: queriesAreChanging
|
|
26359
26370
|
};
|
|
26360
26371
|
};
|
|
26372
|
+
var shouldFetch = function shouldFetch(queries, componentType) {
|
|
26373
|
+
if (!componentType) {
|
|
26374
|
+
return true;
|
|
26375
|
+
}
|
|
26376
|
+
if (!ALL_COMPONENT_TYPES.includes(componentType)) {
|
|
26377
|
+
return false;
|
|
26378
|
+
}
|
|
26379
|
+
var componentInterface = getComponentInterface(componentType);
|
|
26380
|
+
return componentInterface.isRunnable(queries);
|
|
26381
|
+
};
|
|
26361
26382
|
|
|
26362
26383
|
/** Fetches unique field values for a given field. */
|
|
26363
26384
|
var useUniqueFieldValues = function useUniqueFieldValues(dataSet, fieldId) {
|
|
@@ -37563,112 +37584,54 @@ var ScatterChart$3 = function ScatterChart(props) {
|
|
|
37563
37584
|
}));
|
|
37564
37585
|
};
|
|
37565
37586
|
|
|
37566
|
-
|
|
37567
|
-
|
|
37568
|
-
|
|
37569
|
-
|
|
37570
|
-
|
|
37571
|
-
|
|
37572
|
-
|
|
37573
|
-
|
|
37574
|
-
|
|
37575
|
-
|
|
37576
|
-
|
|
37577
|
-
|
|
37578
|
-
|
|
37579
|
-
|
|
37580
|
-
|
|
37581
|
-
|
|
37582
|
-
|
|
37583
|
-
|
|
37584
|
-
|
|
37585
|
-
|
|
37586
|
-
|
|
37587
|
-
|
|
37588
|
-
|
|
37589
|
-
|
|
37590
|
-
|
|
37591
|
-
|
|
37592
|
-
|
|
37593
|
-
|
|
37594
|
-
|
|
37595
|
-
|
|
37596
|
-
|
|
37597
|
-
|
|
37598
|
-
|
|
37599
|
-
|
|
37600
|
-
|
|
37601
|
-
|
|
37602
|
-
|
|
37603
|
-
|
|
37604
|
-
|
|
37605
|
-
|
|
37606
|
-
|
|
37607
|
-
|
|
37608
|
-
|
|
37609
|
-
|
|
37610
|
-
}, yValues, {
|
|
37611
|
-
xValues: xValues
|
|
37612
|
-
});
|
|
37613
|
-
});
|
|
37614
|
-
var orderedRes = [];
|
|
37615
|
-
var dataPoints = {};
|
|
37616
|
-
duplicateDataPoints.forEach(function (dataPoint) {
|
|
37617
|
-
var current = dataPoints[dataPoint.x];
|
|
37618
|
-
|
|
37619
|
-
// Only add the x data point once if it already exists.
|
|
37620
|
-
if (!dataPoints[dataPoint.x]) {
|
|
37621
|
-
orderedRes.push(dataPoint.x);
|
|
37622
|
-
}
|
|
37623
|
-
dataPoints[dataPoint.x] = _.merge({}, current, dataPoint);
|
|
37624
|
-
});
|
|
37625
|
-
var resultSet = orderedRes.map(function (k) {
|
|
37626
|
-
return dataPoints[k];
|
|
37627
|
-
});
|
|
37628
|
-
return as100PercentResultSet ? to100PercentResultSet$1(resultSet) : resultSet;
|
|
37629
|
-
};
|
|
37630
|
-
var series$1 = function series(query, result, pivotConfig) {
|
|
37631
|
-
var keyValueResult = toKeyValueResults$1(result);
|
|
37632
|
-
var series = {};
|
|
37633
|
-
keyValueResult.forEach(function (dataPoint) {
|
|
37634
|
-
var yValues = [].concat(pivotConfig.y).map(function (k) {
|
|
37635
|
-
return dataPoint[k];
|
|
37636
|
-
});
|
|
37637
|
-
query.measure.forEach(function (measure) {
|
|
37638
|
-
var field = id$2(measure);
|
|
37639
|
-
var key$1 = key(pivotConfig.y, yValues, measure.field, measure["function"]);
|
|
37640
|
-
series[key$1] = {
|
|
37641
|
-
key: key$1,
|
|
37642
|
-
yValues: [].concat(yValues, [field]),
|
|
37643
|
-
name: [].concat(yValues, [field]).join(', ')
|
|
37587
|
+
function buildPieOnViewClick(onViewClick, clickedValue, dataSet, viewId, dimension, timeDimension, runViewClickQuery) {
|
|
37588
|
+
if (onViewClick) {
|
|
37589
|
+
var parsedDatum = parse(clickedValue.key);
|
|
37590
|
+
var objectToReturn = {
|
|
37591
|
+
viewId: viewId != null ? viewId : '',
|
|
37592
|
+
dataSet: {
|
|
37593
|
+
id: dataSet.id,
|
|
37594
|
+
name: dataSet.name,
|
|
37595
|
+
fields: dataSet.fields,
|
|
37596
|
+
description: dataSet.description
|
|
37597
|
+
},
|
|
37598
|
+
clicked: {
|
|
37599
|
+
value: {
|
|
37600
|
+
fieldId: parsedDatum.fieldId,
|
|
37601
|
+
"function": parsedDatum["function"],
|
|
37602
|
+
aggregate: 'none',
|
|
37603
|
+
value: clickedValue.datum[clickedValue.key]
|
|
37604
|
+
}
|
|
37605
|
+
},
|
|
37606
|
+
type: 'pieChart'
|
|
37607
|
+
};
|
|
37608
|
+
onViewClick(objectToReturn, /*#__PURE__*/function () {
|
|
37609
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(queries) {
|
|
37610
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
37611
|
+
while (1) switch (_context.prev = _context.next) {
|
|
37612
|
+
case 0:
|
|
37613
|
+
if (!(queries && runViewClickQuery)) {
|
|
37614
|
+
_context.next = 4;
|
|
37615
|
+
break;
|
|
37616
|
+
}
|
|
37617
|
+
_context.next = 3;
|
|
37618
|
+
return runViewClickQuery(queries, buildClickedOnFieldForQuery(id, parse, dimension, timeDimension, clickedValue));
|
|
37619
|
+
case 3:
|
|
37620
|
+
return _context.abrupt("return", _context.sent);
|
|
37621
|
+
case 4:
|
|
37622
|
+
return _context.abrupt("return", Promise.resolve(null));
|
|
37623
|
+
case 5:
|
|
37624
|
+
case "end":
|
|
37625
|
+
return _context.stop();
|
|
37626
|
+
}
|
|
37627
|
+
}, _callee);
|
|
37628
|
+
}));
|
|
37629
|
+
return function (_x) {
|
|
37630
|
+
return _ref.apply(this, arguments);
|
|
37644
37631
|
};
|
|
37645
|
-
});
|
|
37646
|
-
}
|
|
37647
|
-
|
|
37648
|
-
};
|
|
37649
|
-
var to100PercentResultSet$1 = function to100PercentResultSet(resultSet) {
|
|
37650
|
-
var ignoreKeys = ['x', 'xValues'];
|
|
37651
|
-
return resultSet.map(function (serie) {
|
|
37652
|
-
var newSerie = _extends({}, serie);
|
|
37653
|
-
var total = _.sumBy(Object.entries(newSerie), function (_ref) {
|
|
37654
|
-
var key = _ref[0],
|
|
37655
|
-
value = _ref[1];
|
|
37656
|
-
if (ignoreKeys.includes(key)) return 0;
|
|
37657
|
-
if (_.isNumber(value)) {
|
|
37658
|
-
return value;
|
|
37659
|
-
}
|
|
37660
|
-
return 0;
|
|
37661
|
-
});
|
|
37662
|
-
newSerie = _.mapValues(newSerie, function (value, key) {
|
|
37663
|
-
if (ignoreKeys.includes(key)) return value;
|
|
37664
|
-
if (_.isNumber(value)) {
|
|
37665
|
-
return isPercentageOf(newSerie[key], total);
|
|
37666
|
-
}
|
|
37667
|
-
return value;
|
|
37668
|
-
});
|
|
37669
|
-
return newSerie;
|
|
37670
|
-
});
|
|
37671
|
-
};
|
|
37632
|
+
}());
|
|
37633
|
+
}
|
|
37634
|
+
}
|
|
37672
37635
|
|
|
37673
37636
|
var ComboChart$2 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
37674
37637
|
var forceRerender = useChartForceRerender(ref);
|
|
@@ -38676,54 +38639,112 @@ var RichTextMenu = function RichTextMenu() {
|
|
|
38676
38639
|
// );
|
|
38677
38640
|
};
|
|
38678
38641
|
|
|
38679
|
-
|
|
38680
|
-
|
|
38681
|
-
|
|
38682
|
-
|
|
38683
|
-
|
|
38684
|
-
|
|
38685
|
-
|
|
38686
|
-
|
|
38687
|
-
|
|
38688
|
-
|
|
38689
|
-
|
|
38690
|
-
|
|
38691
|
-
|
|
38692
|
-
|
|
38693
|
-
|
|
38694
|
-
|
|
38695
|
-
|
|
38696
|
-
|
|
38697
|
-
|
|
38698
|
-
type: 'pieChart'
|
|
38699
|
-
};
|
|
38700
|
-
onViewClick(objectToReturn, /*#__PURE__*/function () {
|
|
38701
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(queries) {
|
|
38702
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38703
|
-
while (1) switch (_context.prev = _context.next) {
|
|
38704
|
-
case 0:
|
|
38705
|
-
if (!(queries && runViewClickQuery)) {
|
|
38706
|
-
_context.next = 4;
|
|
38707
|
-
break;
|
|
38708
|
-
}
|
|
38709
|
-
_context.next = 3;
|
|
38710
|
-
return runViewClickQuery(queries, buildClickedOnFieldForQuery(id, parse, dimension, timeDimension, clickedValue));
|
|
38711
|
-
case 3:
|
|
38712
|
-
return _context.abrupt("return", _context.sent);
|
|
38713
|
-
case 4:
|
|
38714
|
-
return _context.abrupt("return", Promise.resolve(null));
|
|
38715
|
-
case 5:
|
|
38716
|
-
case "end":
|
|
38717
|
-
return _context.stop();
|
|
38718
|
-
}
|
|
38719
|
-
}, _callee);
|
|
38720
|
-
}));
|
|
38721
|
-
return function (_x) {
|
|
38722
|
-
return _ref.apply(this, arguments);
|
|
38723
|
-
};
|
|
38724
|
-
}());
|
|
38642
|
+
var toKeyValueResults$1 = function toKeyValueResults(result) {
|
|
38643
|
+
return [].concat(result.content).map(function (row) {
|
|
38644
|
+
return _.reduce(row, function (acc, value, index) {
|
|
38645
|
+
acc[result.fields[index].id] = value;
|
|
38646
|
+
return acc;
|
|
38647
|
+
}, {});
|
|
38648
|
+
});
|
|
38649
|
+
};
|
|
38650
|
+
var getXFields = function getXFields(pivotConfig, query) {
|
|
38651
|
+
var nonTimeDimensionFields = _.reject([].concat(pivotConfig.x), function (field) {
|
|
38652
|
+
var _query$timeDimension;
|
|
38653
|
+
return field == ((_query$timeDimension = query.timeDimension) == null ? void 0 : _query$timeDimension.field);
|
|
38654
|
+
});
|
|
38655
|
+
var xFields = query.timeDimension ? [query.timeDimension.field] : nonTimeDimensionFields;
|
|
38656
|
+
return xFields;
|
|
38657
|
+
};
|
|
38658
|
+
var resultSet$1 = function resultSet(result, pivotConfig, query, as100PercentResultSet, nullReplacement) {
|
|
38659
|
+
if (as100PercentResultSet === void 0) {
|
|
38660
|
+
as100PercentResultSet = false;
|
|
38725
38661
|
}
|
|
38726
|
-
|
|
38662
|
+
var keyValueResult = toKeyValueResults$1(result);
|
|
38663
|
+
var duplicateDataPoints = [].concat(keyValueResult).map(function (row) {
|
|
38664
|
+
// Remove time dimension values from value prefix that allows groupings.
|
|
38665
|
+
var xFields = getXFields(pivotConfig, query);
|
|
38666
|
+
var xValues = xFields.map(function (xField) {
|
|
38667
|
+
return toStringShort(row[xField], nullReplacement);
|
|
38668
|
+
});
|
|
38669
|
+
var yValues = {};
|
|
38670
|
+
var hasMeasures = pivotConfig.y.includes('measures');
|
|
38671
|
+
var yWithoutMeasures = hasMeasures ? [].concat(pivotConfig.y).slice(0, pivotConfig.y.length - 1) : [].concat(pivotConfig.y);
|
|
38672
|
+
var yKeyValues = [].concat(yWithoutMeasures).map(function (k) {
|
|
38673
|
+
return row[k];
|
|
38674
|
+
});
|
|
38675
|
+
query.measure.forEach(function (measure) {
|
|
38676
|
+
var resultFieldId = id$2(measure);
|
|
38677
|
+
var key$1 = key(yWithoutMeasures, yKeyValues, measure.field, measure["function"]);
|
|
38678
|
+
yValues[key$1] = row[resultFieldId];
|
|
38679
|
+
});
|
|
38680
|
+
var dimensionValues = {};
|
|
38681
|
+
xFields.forEach(function (xField) {
|
|
38682
|
+
dimensionValues[xField] = row[xField];
|
|
38683
|
+
});
|
|
38684
|
+
return _extends({}, dimensionValues, {
|
|
38685
|
+
x: xValues.join(', ')
|
|
38686
|
+
}, yValues, {
|
|
38687
|
+
xValues: xValues
|
|
38688
|
+
});
|
|
38689
|
+
});
|
|
38690
|
+
var orderedRes = [];
|
|
38691
|
+
var dataPoints = {};
|
|
38692
|
+
duplicateDataPoints.forEach(function (dataPoint) {
|
|
38693
|
+
var current = dataPoints[dataPoint.x];
|
|
38694
|
+
|
|
38695
|
+
// Only add the x data point once if it already exists.
|
|
38696
|
+
if (!dataPoints[dataPoint.x]) {
|
|
38697
|
+
orderedRes.push(dataPoint.x);
|
|
38698
|
+
}
|
|
38699
|
+
dataPoints[dataPoint.x] = _.merge({}, current, dataPoint);
|
|
38700
|
+
});
|
|
38701
|
+
var resultSet = orderedRes.map(function (k) {
|
|
38702
|
+
return dataPoints[k];
|
|
38703
|
+
});
|
|
38704
|
+
return as100PercentResultSet ? to100PercentResultSet$1(resultSet) : resultSet;
|
|
38705
|
+
};
|
|
38706
|
+
var series$1 = function series(query, result, pivotConfig) {
|
|
38707
|
+
var keyValueResult = toKeyValueResults$1(result);
|
|
38708
|
+
var series = {};
|
|
38709
|
+
keyValueResult.forEach(function (dataPoint) {
|
|
38710
|
+
var yValues = [].concat(pivotConfig.y).map(function (k) {
|
|
38711
|
+
return dataPoint[k];
|
|
38712
|
+
});
|
|
38713
|
+
query.measure.forEach(function (measure) {
|
|
38714
|
+
var field = id$2(measure);
|
|
38715
|
+
var key$1 = key(pivotConfig.y, yValues, measure.field, measure["function"]);
|
|
38716
|
+
series[key$1] = {
|
|
38717
|
+
key: key$1,
|
|
38718
|
+
yValues: [].concat(yValues, [field]),
|
|
38719
|
+
name: [].concat(yValues, [field]).join(', ')
|
|
38720
|
+
};
|
|
38721
|
+
});
|
|
38722
|
+
});
|
|
38723
|
+
return Object.values(series);
|
|
38724
|
+
};
|
|
38725
|
+
var to100PercentResultSet$1 = function to100PercentResultSet(resultSet) {
|
|
38726
|
+
var ignoreKeys = ['x', 'xValues'];
|
|
38727
|
+
return resultSet.map(function (serie) {
|
|
38728
|
+
var newSerie = _extends({}, serie);
|
|
38729
|
+
var total = _.sumBy(Object.entries(newSerie), function (_ref) {
|
|
38730
|
+
var key = _ref[0],
|
|
38731
|
+
value = _ref[1];
|
|
38732
|
+
if (ignoreKeys.includes(key)) return 0;
|
|
38733
|
+
if (_.isNumber(value)) {
|
|
38734
|
+
return value;
|
|
38735
|
+
}
|
|
38736
|
+
return 0;
|
|
38737
|
+
});
|
|
38738
|
+
newSerie = _.mapValues(newSerie, function (value, key) {
|
|
38739
|
+
if (ignoreKeys.includes(key)) return value;
|
|
38740
|
+
if (_.isNumber(value)) {
|
|
38741
|
+
return isPercentageOf(newSerie[key], total);
|
|
38742
|
+
}
|
|
38743
|
+
return value;
|
|
38744
|
+
});
|
|
38745
|
+
return newSerie;
|
|
38746
|
+
});
|
|
38747
|
+
};
|
|
38727
38748
|
|
|
38728
38749
|
var defaultProps$5 = {
|
|
38729
38750
|
type: 'pieChart',
|
|
@@ -53038,9 +53059,11 @@ var SingleStat$2 = function SingleStat(props) {
|
|
|
53038
53059
|
}));
|
|
53039
53060
|
};
|
|
53040
53061
|
|
|
53041
|
-
var
|
|
53042
|
-
var
|
|
53043
|
-
var
|
|
53062
|
+
var convertDataToSunburstData = function convertDataToSunburstData(_ref) {
|
|
53063
|
+
var _selectedMetric$publi, _selectedMetric$publi2;
|
|
53064
|
+
var formattedData = _ref.formattedData,
|
|
53065
|
+
metricAttribute = _ref.metricAttribute,
|
|
53066
|
+
groupingAttributes = _ref.groupingAttributes;
|
|
53044
53067
|
var fieldPublicNameMap = formattedData.fields.reduce(function (acc, field) {
|
|
53045
53068
|
acc[field.fieldId] = field.publicName;
|
|
53046
53069
|
return acc;
|
|
@@ -53052,11 +53075,13 @@ var convertDataToSunburstData = function convertDataToSunburstData(formattedData
|
|
|
53052
53075
|
});
|
|
53053
53076
|
return newItem;
|
|
53054
53077
|
});
|
|
53055
|
-
var selectedMetric =
|
|
53056
|
-
return f["function"]
|
|
53057
|
-
})
|
|
53058
|
-
var
|
|
53059
|
-
return
|
|
53078
|
+
var selectedMetric = formattedData.fields.find(function (f) {
|
|
53079
|
+
return f.fieldId === metricAttribute.field && f["function"] === metricAttribute["function"];
|
|
53080
|
+
});
|
|
53081
|
+
var groupingFields = formattedData.fields.filter(function (f) {
|
|
53082
|
+
return groupingAttributes.some(function (g) {
|
|
53083
|
+
return g.field === f.fieldId && g["function"] === f["function"];
|
|
53084
|
+
});
|
|
53060
53085
|
}).map(function (f) {
|
|
53061
53086
|
return String(f.fieldId);
|
|
53062
53087
|
});
|
|
@@ -53073,7 +53098,7 @@ var convertDataToSunburstData = function convertDataToSunburstData(formattedData
|
|
|
53073
53098
|
var _item$selectedMetric$;
|
|
53074
53099
|
var item = _step.value;
|
|
53075
53100
|
var groupValue = String(item[groupFieldId]);
|
|
53076
|
-
var metricValue = Number((_item$selectedMetric$ = item[selectedMetric.id]) != null ? _item$selectedMetric$ : 0);
|
|
53101
|
+
var metricValue = selectedMetric ? Number((_item$selectedMetric$ = item[selectedMetric.id]) != null ? _item$selectedMetric$ : 0) : 0;
|
|
53077
53102
|
if (uniqueValues.includes(groupValue)) {
|
|
53078
53103
|
result[groupValue] = metricValue;
|
|
53079
53104
|
}
|
|
@@ -53090,13 +53115,13 @@ var convertDataToSunburstData = function convertDataToSunburstData(formattedData
|
|
|
53090
53115
|
if (parentColor === void 0) {
|
|
53091
53116
|
parentColor = '';
|
|
53092
53117
|
}
|
|
53093
|
-
var currentGroupField =
|
|
53118
|
+
var currentGroupField = groupingFields[depth];
|
|
53094
53119
|
var uniqueValues = _.uniqBy(data, currentGroupField).map(function (d) {
|
|
53095
53120
|
return String(d[currentGroupField]);
|
|
53096
53121
|
});
|
|
53097
53122
|
var metricValuesByGroup = calculateMetricValues(data, currentGroupField, uniqueValues);
|
|
53098
53123
|
var publicName = fieldPublicNameMap[currentGroupField];
|
|
53099
|
-
if (depth >=
|
|
53124
|
+
if (depth >= groupingFields.length - 1) {
|
|
53100
53125
|
return uniqueValues.map(function (value, index) {
|
|
53101
53126
|
return {
|
|
53102
53127
|
name: value,
|
|
@@ -53121,9 +53146,9 @@ var convertDataToSunburstData = function convertDataToSunburstData(formattedData
|
|
|
53121
53146
|
});
|
|
53122
53147
|
};
|
|
53123
53148
|
var convertedData = {
|
|
53124
|
-
name: selectedMetric.publicName
|
|
53149
|
+
name: (_selectedMetric$publi = selectedMetric == null ? void 0 : selectedMetric.publicName) != null ? _selectedMetric$publi : '',
|
|
53125
53150
|
children: _buildHierarchy(flattenedData, 0),
|
|
53126
|
-
hierarchy: selectedMetric.publicName
|
|
53151
|
+
hierarchy: (_selectedMetric$publi2 = selectedMetric == null ? void 0 : selectedMetric.publicName) != null ? _selectedMetric$publi2 : '',
|
|
53127
53152
|
parents: [],
|
|
53128
53153
|
color: '#FFFFFF'
|
|
53129
53154
|
};
|
|
@@ -53153,7 +53178,7 @@ function Partition(_ref) {
|
|
|
53153
53178
|
}
|
|
53154
53179
|
|
|
53155
53180
|
var SunburstChartView = function SunburstChartView(props) {
|
|
53156
|
-
var _props$library, _props$attributes$vie;
|
|
53181
|
+
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;
|
|
53157
53182
|
var _useState = React.useState([0, 1]),
|
|
53158
53183
|
xDomain = _useState[0],
|
|
53159
53184
|
setXDomain = _useState[1];
|
|
@@ -53174,11 +53199,16 @@ var SunburstChartView = function SunburstChartView(props) {
|
|
|
53174
53199
|
}),
|
|
53175
53200
|
tooltipLabel = _useState5[0],
|
|
53176
53201
|
setTooltipLabel = _useState5[1];
|
|
53202
|
+
var defaultLabelFormat = '_vizzly_compact';
|
|
53203
|
+
var theme = useTheme();
|
|
53177
53204
|
var xScale = d3Scale.scaleLinear().domain(xDomain).range(xRange);
|
|
53178
53205
|
var yScale = d3Scale.scaleSqrt().domain(yDomain).range(yRange);
|
|
53179
53206
|
var width = props.width * 3 / 6;
|
|
53180
|
-
var
|
|
53181
|
-
var
|
|
53207
|
+
var titleHeight = props.attributes.displayTitle ? 24 : 0;
|
|
53208
|
+
var subjectHeight = props.attributes.displaySubject ? 18 : 0;
|
|
53209
|
+
var height = props.height - titleHeight - subjectHeight;
|
|
53210
|
+
var adjustedHeight = adjustHeight(height * 0.95, props.attributes.legend);
|
|
53211
|
+
var minDimension = Math.min(props.width, height);
|
|
53182
53212
|
var centeredRatio = minDimension / 2.5;
|
|
53183
53213
|
var sunburstChartComponent = getComponentInterface(props.attributes.type);
|
|
53184
53214
|
var headerProps = {
|
|
@@ -53224,7 +53254,11 @@ var SunburstChartView = function SunburstChartView(props) {
|
|
|
53224
53254
|
return null;
|
|
53225
53255
|
}
|
|
53226
53256
|
var formattedData = formatResult(props.result, props.formatResultParams);
|
|
53227
|
-
return convertDataToSunburstData(
|
|
53257
|
+
return convertDataToSunburstData({
|
|
53258
|
+
formattedData: formattedData,
|
|
53259
|
+
metricAttribute: props.attributes.measure[0],
|
|
53260
|
+
groupingAttributes: props.attributes.dimension
|
|
53261
|
+
});
|
|
53228
53262
|
}, [props.attributes, props.result, props.formatResultParams, sunburstChartComponent]);
|
|
53229
53263
|
var root = React.useMemo(function () {
|
|
53230
53264
|
return sunburstData && d3Hierarchy.hierarchy(sunburstData).sum(function (d) {
|
|
@@ -53238,7 +53272,7 @@ var SunburstChartView = function SunburstChartView(props) {
|
|
|
53238
53272
|
var _useTooltip = tooltip$3.useTooltip({
|
|
53239
53273
|
tooltipOpen: false,
|
|
53240
53274
|
tooltipLeft: width / 2,
|
|
53241
|
-
tooltipTop:
|
|
53275
|
+
tooltipTop: adjustedHeight,
|
|
53242
53276
|
tooltipData: 'Move me with your mouse or finger'
|
|
53243
53277
|
}),
|
|
53244
53278
|
showTooltip = _useTooltip.showTooltip,
|
|
@@ -53277,105 +53311,153 @@ var SunburstChartView = function SunburstChartView(props) {
|
|
|
53277
53311
|
tooltipTop: containerY,
|
|
53278
53312
|
tooltipData: JSON.stringify(node.data)
|
|
53279
53313
|
});
|
|
53280
|
-
}, [showTooltip,
|
|
53314
|
+
}, [showTooltip, adjustedHeight, width, root]);
|
|
53281
53315
|
var innerWidth = width - DEFAULT_MARGINS.left - DEFAULT_MARGINS.right;
|
|
53282
|
-
var innerHeight =
|
|
53316
|
+
var innerHeight = adjustedHeight - DEFAULT_MARGINS.top - DEFAULT_MARGINS.bottom;
|
|
53283
53317
|
var centerY = innerHeight / 2;
|
|
53284
53318
|
var centerX = innerWidth / 2;
|
|
53319
|
+
var totalFieldCount = props.attributes.measure.length + props.attributes.dimension.length;
|
|
53285
53320
|
if (!sunburstChartComponent.isRunnable(props.attributes)) {
|
|
53286
53321
|
return jsxRuntime.jsx(QueryUnderConstructionNotice, {
|
|
53287
53322
|
title: "Missing parameters"
|
|
53288
53323
|
});
|
|
53289
53324
|
}
|
|
53290
|
-
if (isLoading(props.result)) return jsxRuntime.jsx(LoadingComponent, {});
|
|
53291
53325
|
if (hasFailed(props.result)) return jsxRuntime.jsx(FailedToLoadDataNotice, {});
|
|
53326
|
+
if (isLoading(props.result) || props.result.fields.length !== totalFieldCount) return jsxRuntime.jsx(LoadingComponent, {});
|
|
53292
53327
|
if (isEmpty(props.result)) return jsxRuntime.jsx(NoResultContentToShowNotice, _extends({}, headerProps));
|
|
53293
|
-
|
|
53294
|
-
|
|
53295
|
-
|
|
53296
|
-
|
|
53297
|
-
|
|
53298
|
-
|
|
53299
|
-
|
|
53300
|
-
|
|
53301
|
-
|
|
53302
|
-
|
|
53303
|
-
|
|
53304
|
-
|
|
53305
|
-
|
|
53306
|
-
|
|
53307
|
-
|
|
53308
|
-
|
|
53309
|
-
|
|
53310
|
-
|
|
53311
|
-
|
|
53312
|
-
|
|
53313
|
-
|
|
53314
|
-
|
|
53328
|
+
var keys = (_root$children$map = root == null || (_root$children = root.children) == null ? void 0 : _root$children.map(function (child) {
|
|
53329
|
+
return child.data.name;
|
|
53330
|
+
})) != null ? _root$children$map : [];
|
|
53331
|
+
var colors = (_root$children$map2 = root == null || (_root$children2 = root.children) == null ? void 0 : _root$children2.map(function (child) {
|
|
53332
|
+
return child.data.color;
|
|
53333
|
+
})) != null ? _root$children$map2 : [];
|
|
53334
|
+
var typeIndex = (_root$children$map3 = root == null || (_root$children3 = root.children) == null ? void 0 : _root$children3.map(function (_, index) {
|
|
53335
|
+
return {
|
|
53336
|
+
index: index,
|
|
53337
|
+
type: 'pie'
|
|
53338
|
+
};
|
|
53339
|
+
})) != null ? _root$children$map3 : [];
|
|
53340
|
+
var showLabel = (theme == null ? void 0 : theme.detail) === 'verbose' && props.attributes.labels !== false || props.attributes.labels;
|
|
53341
|
+
var labelFormat = (_props$attributes$lab = props == null ? void 0 : props.attributes.labelFormat) != null ? _props$attributes$lab : defaultLabelFormat;
|
|
53342
|
+
var formatValue = function formatValue(value) {
|
|
53343
|
+
return convertValueToFormat(toDp(value, 2), props == null ? void 0 : props.numberFormatOptions, labelFormat);
|
|
53344
|
+
};
|
|
53345
|
+
return jsxRuntime.jsx(React.Suspense, {
|
|
53346
|
+
fallback: jsxRuntime.jsx(LoadingComponent, {}),
|
|
53347
|
+
children: jsxRuntime.jsxs(ViewWrapper, {
|
|
53348
|
+
id: props.id,
|
|
53349
|
+
queriesAreChanging: props.queriesAreChanging,
|
|
53350
|
+
children: [jsxRuntime.jsx(ViewHeader, _extends({}, headerProps)), jsxRuntime.jsxs(ChartWrapper, {
|
|
53351
|
+
disabledFeatures: (_props$library2 = props.library) != null ? _props$library2 : false,
|
|
53352
|
+
children: [jsxRuntime.jsx("style", {
|
|
53353
|
+
children: "" + TOOLTIP_ZINDEX
|
|
53354
|
+
}), jsxRuntime.jsx("svg", {
|
|
53355
|
+
width: props.width,
|
|
53356
|
+
height: adjustedHeight,
|
|
53357
|
+
children: jsxRuntime.jsx(Partition, {
|
|
53358
|
+
top: 0,
|
|
53359
|
+
left: centerX + DEFAULT_MARGINS.left,
|
|
53360
|
+
root: root,
|
|
53361
|
+
children: jsxRuntime.jsx(web.Spring, {
|
|
53362
|
+
reset: true,
|
|
53363
|
+
from: {
|
|
53364
|
+
t: 0
|
|
53365
|
+
},
|
|
53366
|
+
to: {
|
|
53367
|
+
t: 1,
|
|
53368
|
+
onFrame: function onFrame(_ref) {
|
|
53369
|
+
var t = _ref.t;
|
|
53370
|
+
return handleUpdate(t, xd, yd, yr);
|
|
53371
|
+
}
|
|
53372
|
+
},
|
|
53373
|
+
config: {
|
|
53374
|
+
mass: 5,
|
|
53375
|
+
tension: 500,
|
|
53376
|
+
friction: 100,
|
|
53377
|
+
precision: 0.00001
|
|
53378
|
+
},
|
|
53379
|
+
children: function children(_ref2) {
|
|
53380
|
+
var t = _ref2.t;
|
|
53381
|
+
return jsxRuntime.jsxs(group.Group, {
|
|
53382
|
+
top: centerY + DEFAULT_MARGINS.top,
|
|
53383
|
+
left: centerX + DEFAULT_MARGINS.left,
|
|
53384
|
+
children: [root && root.descendants().map(function (node, i) {
|
|
53385
|
+
var _arc$centroid = arc.centroid(node),
|
|
53386
|
+
centroidX = _arc$centroid[0],
|
|
53387
|
+
centroidY = _arc$centroid[1];
|
|
53388
|
+
var hasSpaceForLabel = node.x1 - node.x0 >= 0.09;
|
|
53389
|
+
var nodeKey = node.data.name.toLowerCase().replaceAll(' ', '-') + "-" + i;
|
|
53390
|
+
var textColor = pickBestTextColor(node.data.color, ['white', 'black']);
|
|
53391
|
+
var displayLabelCondition = showLabel && hasSpaceForLabel && node.depth > 0;
|
|
53392
|
+
return jsxRuntime.jsxs("g", {
|
|
53393
|
+
children: [jsxRuntime.jsx(web.animated.path, {
|
|
53394
|
+
className: "path",
|
|
53395
|
+
d: t.to(function () {
|
|
53396
|
+
return arc(node);
|
|
53397
|
+
}),
|
|
53398
|
+
stroke: "#FFFFFF",
|
|
53399
|
+
strokeWidth: "2",
|
|
53400
|
+
fill: node.data.color,
|
|
53401
|
+
fillRule: "evenodd",
|
|
53402
|
+
onClick: function onClick() {
|
|
53403
|
+
return handleClick(node);
|
|
53404
|
+
},
|
|
53405
|
+
onMouseOver: function onMouseOver(event) {
|
|
53406
|
+
return handlePointerMove(event, node);
|
|
53407
|
+
},
|
|
53408
|
+
onMouseOut: function onMouseOut() {
|
|
53409
|
+
return hideTooltip();
|
|
53410
|
+
}
|
|
53411
|
+
}, i), displayLabelCondition && jsxRuntime.jsx(web.animated.g, {
|
|
53412
|
+
children: jsxRuntime.jsx("text", {
|
|
53413
|
+
fill: textColor,
|
|
53414
|
+
x: centroidX,
|
|
53415
|
+
y: centroidY,
|
|
53416
|
+
dy: ".33em",
|
|
53417
|
+
fontSize: 9,
|
|
53418
|
+
textAnchor: "middle",
|
|
53419
|
+
pointerEvents: "none",
|
|
53420
|
+
children: formatValue(node.value)
|
|
53421
|
+
})
|
|
53422
|
+
})]
|
|
53423
|
+
}, nodeKey);
|
|
53424
|
+
}), tooltipOpen && jsxRuntime.jsx(TooltipInPortal
|
|
53425
|
+
// style={buildTooltipStyles({ ...props.popOverMenuStyles, old: true })}
|
|
53426
|
+
, {
|
|
53427
|
+
top: tooltipTop,
|
|
53428
|
+
left: tooltipLeft,
|
|
53429
|
+
children: jsxRuntime.jsxs(TooltipWrapper, {
|
|
53430
|
+
sections: 1,
|
|
53431
|
+
children: [jsxRuntime.jsx(TooltipRow, {
|
|
53432
|
+
label: 'Category Name',
|
|
53433
|
+
value: tooltipLabel.categoryName
|
|
53434
|
+
}), tooltipLabel.path !== '' && jsxRuntime.jsx(TooltipRow, {
|
|
53435
|
+
label: 'Hierarchy Path',
|
|
53436
|
+
value: tooltipLabel.path
|
|
53437
|
+
}), jsxRuntime.jsx(TooltipRow, {
|
|
53438
|
+
label: 'Value',
|
|
53439
|
+
value: tooltipLabel.value
|
|
53440
|
+
}), tooltipLabel.percentOfParent !== '' && jsxRuntime.jsx(TooltipRow, {
|
|
53441
|
+
label: '% Of Parent',
|
|
53442
|
+
value: tooltipLabel.percentOfParent
|
|
53443
|
+
}), jsxRuntime.jsx(TooltipRow, {
|
|
53444
|
+
label: '% Of Total',
|
|
53445
|
+
value: tooltipLabel.percentOfTotal
|
|
53446
|
+
})]
|
|
53447
|
+
})
|
|
53448
|
+
}, uuid.v4())]
|
|
53449
|
+
});
|
|
53315
53450
|
}
|
|
53316
|
-
}
|
|
53317
|
-
config: {
|
|
53318
|
-
mass: 5,
|
|
53319
|
-
tension: 500,
|
|
53320
|
-
friction: 100,
|
|
53321
|
-
precision: 0.00001
|
|
53322
|
-
},
|
|
53323
|
-
children: function children(_ref2) {
|
|
53324
|
-
var t = _ref2.t;
|
|
53325
|
-
return jsxRuntime.jsxs(group.Group, {
|
|
53326
|
-
top: centerY + DEFAULT_MARGINS.top,
|
|
53327
|
-
left: centerX + DEFAULT_MARGINS.left,
|
|
53328
|
-
children: [root && root.descendants().map(function (node, i) {
|
|
53329
|
-
return jsxRuntime.jsx(web.animated.path, {
|
|
53330
|
-
className: "path",
|
|
53331
|
-
d: t.to(function () {
|
|
53332
|
-
return arc(node);
|
|
53333
|
-
}),
|
|
53334
|
-
stroke: "#FFFFFF",
|
|
53335
|
-
strokeWidth: "2",
|
|
53336
|
-
fill: node.data.color,
|
|
53337
|
-
fillRule: "evenodd",
|
|
53338
|
-
onClick: function onClick() {
|
|
53339
|
-
return handleClick(node);
|
|
53340
|
-
},
|
|
53341
|
-
onMouseOver: function onMouseOver(event) {
|
|
53342
|
-
return handlePointerMove(event, node);
|
|
53343
|
-
},
|
|
53344
|
-
onMouseOut: function onMouseOut() {
|
|
53345
|
-
return hideTooltip();
|
|
53346
|
-
}
|
|
53347
|
-
}, i);
|
|
53348
|
-
}), tooltipOpen && jsxRuntime.jsx(TooltipInPortal
|
|
53349
|
-
// style={buildTooltipStyles({ ...props.popOverMenuStyles, old: true })}
|
|
53350
|
-
, {
|
|
53351
|
-
top: tooltipTop,
|
|
53352
|
-
left: tooltipLeft,
|
|
53353
|
-
children: jsxRuntime.jsxs(TooltipWrapper, {
|
|
53354
|
-
sections: 1,
|
|
53355
|
-
children: [jsxRuntime.jsx(TooltipRow, {
|
|
53356
|
-
label: 'Category Name',
|
|
53357
|
-
value: tooltipLabel.categoryName
|
|
53358
|
-
}), tooltipLabel.path !== '' && jsxRuntime.jsx(TooltipRow, {
|
|
53359
|
-
label: 'Hierarchy Path',
|
|
53360
|
-
value: tooltipLabel.path
|
|
53361
|
-
}), jsxRuntime.jsx(TooltipRow, {
|
|
53362
|
-
label: 'Value',
|
|
53363
|
-
value: tooltipLabel.value
|
|
53364
|
-
}), tooltipLabel.percentOfParent !== '' && jsxRuntime.jsx(TooltipRow, {
|
|
53365
|
-
label: '% Of Parent',
|
|
53366
|
-
value: tooltipLabel.percentOfParent
|
|
53367
|
-
}), jsxRuntime.jsx(TooltipRow, {
|
|
53368
|
-
label: '% Of Total',
|
|
53369
|
-
value: tooltipLabel.percentOfTotal
|
|
53370
|
-
})]
|
|
53371
|
-
})
|
|
53372
|
-
}, uuid.v4())]
|
|
53373
|
-
});
|
|
53374
|
-
}
|
|
53451
|
+
})
|
|
53375
53452
|
})
|
|
53376
|
-
})
|
|
53377
|
-
|
|
53378
|
-
|
|
53453
|
+
}), showLegend(props.attributes.legend, (theme == null ? void 0 : theme.detail) === 'verbose') && jsxRuntime.jsx(Legend, {
|
|
53454
|
+
colors: colors,
|
|
53455
|
+
keys: keys,
|
|
53456
|
+
typeIndex: typeIndex,
|
|
53457
|
+
alignCenter: true
|
|
53458
|
+
})]
|
|
53459
|
+
})]
|
|
53460
|
+
})
|
|
53379
53461
|
});
|
|
53380
53462
|
};
|
|
53381
53463
|
|
|
@@ -53385,7 +53467,8 @@ var SunburstChart$2 = function SunburstChart(props) {
|
|
|
53385
53467
|
localFilters: props.component.localFilters,
|
|
53386
53468
|
globalFilters: props.globalFilters
|
|
53387
53469
|
}, props.dataSet, undefined, props.dashboardBehaviour.variables),
|
|
53388
|
-
results = _useQueryEffect.results
|
|
53470
|
+
results = _useQueryEffect.results,
|
|
53471
|
+
queriesAreChanging = _useQueryEffect.queriesAreChanging;
|
|
53389
53472
|
var params = {
|
|
53390
53473
|
defaultFormats: props.dashboardBehaviour.defaultFormats,
|
|
53391
53474
|
dateTimeFormatOptions: props.dashboardBehaviour.dateTimeFormatOptions,
|
|
@@ -53400,6 +53483,8 @@ var SunburstChart$2 = function SunburstChart(props) {
|
|
|
53400
53483
|
return jsxRuntime.jsx(responsive.ParentSize, {
|
|
53401
53484
|
children: function children(parent) {
|
|
53402
53485
|
return jsxRuntime.jsx(SunburstChartView, {
|
|
53486
|
+
id: props.id,
|
|
53487
|
+
queriesAreChanging: queriesAreChanging,
|
|
53403
53488
|
attributes: attributes,
|
|
53404
53489
|
dataSet: props.dataSet,
|
|
53405
53490
|
localFilters: props.component.localFilters,
|
|
@@ -53407,10 +53492,12 @@ var SunburstChart$2 = function SunburstChart(props) {
|
|
|
53407
53492
|
setPartialAttributes: function setPartialAttributes(changes) {
|
|
53408
53493
|
return props.setPartialAttributes(changes);
|
|
53409
53494
|
},
|
|
53410
|
-
result: results[0],
|
|
53495
|
+
result: results && results[0],
|
|
53411
53496
|
width: parent == null ? void 0 : parent.width,
|
|
53412
53497
|
height: parent == null ? void 0 : parent.height,
|
|
53413
|
-
formatResultParams: params
|
|
53498
|
+
formatResultParams: params,
|
|
53499
|
+
numberFormatOptions: props.dashboardBehaviour.numberFormatOptions,
|
|
53500
|
+
dateTimeFormatOptions: props.dashboardBehaviour.dateTimeFormatOptions
|
|
53414
53501
|
});
|
|
53415
53502
|
}
|
|
53416
53503
|
});
|
|
@@ -62191,51 +62278,6 @@ var DataPropsEditor = function DataPropsEditor() {
|
|
|
62191
62278
|
});
|
|
62192
62279
|
};
|
|
62193
62280
|
|
|
62194
|
-
var HeadingSection = function HeadingSection(_ref) {
|
|
62195
|
-
var _section$subSection;
|
|
62196
|
-
var section = _ref.section,
|
|
62197
|
-
setAttributes = _ref.setAttributes,
|
|
62198
|
-
attributes = _ref.attributes;
|
|
62199
|
-
var handleInputChange = useInputDebounce(setAttributes);
|
|
62200
|
-
return jsxRuntime.jsx(Section, {
|
|
62201
|
-
title: section.title,
|
|
62202
|
-
tooltip: section == null ? void 0 : section.description,
|
|
62203
|
-
children: jsxRuntime.jsx(Section.Grid, {
|
|
62204
|
-
children: section == null || (_section$subSection = section.subSection) == null ? void 0 : _section$subSection.map(function (section, i) {
|
|
62205
|
-
return jsxRuntime.jsxs(React.Fragment, {
|
|
62206
|
-
children: [section.type === 'title' && jsxRuntime.jsx("div", {
|
|
62207
|
-
children: jsxRuntime.jsx(Input, {
|
|
62208
|
-
label: section == null ? void 0 : section.title,
|
|
62209
|
-
"data-testid": "display-title-input",
|
|
62210
|
-
id: "display-title-input",
|
|
62211
|
-
type: "text",
|
|
62212
|
-
onChange: function onChange(input) {
|
|
62213
|
-
return handleInputChange({
|
|
62214
|
-
displayTitle: input.target.value
|
|
62215
|
-
});
|
|
62216
|
-
},
|
|
62217
|
-
defaultValue: attributes.displayTitle
|
|
62218
|
-
})
|
|
62219
|
-
}), section.type === 'subject' && jsxRuntime.jsx("div", {
|
|
62220
|
-
children: jsxRuntime.jsx(Input, {
|
|
62221
|
-
label: section == null ? void 0 : section.title,
|
|
62222
|
-
"data-testid": "display-subject-input",
|
|
62223
|
-
id: "display-subject-input",
|
|
62224
|
-
type: "text",
|
|
62225
|
-
onChange: function onChange(input) {
|
|
62226
|
-
return handleInputChange({
|
|
62227
|
-
displaySubject: input.target.value
|
|
62228
|
-
});
|
|
62229
|
-
},
|
|
62230
|
-
defaultValue: attributes.displaySubject
|
|
62231
|
-
})
|
|
62232
|
-
})]
|
|
62233
|
-
}, i);
|
|
62234
|
-
})
|
|
62235
|
-
})
|
|
62236
|
-
});
|
|
62237
|
-
};
|
|
62238
|
-
|
|
62239
62281
|
var SelectNumberFormat = function SelectNumberFormat(props) {
|
|
62240
62282
|
var _props$label;
|
|
62241
62283
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
@@ -62262,6 +62304,196 @@ var SelectNumberFormat = function SelectNumberFormat(props) {
|
|
|
62262
62304
|
});
|
|
62263
62305
|
};
|
|
62264
62306
|
|
|
62307
|
+
var AxisPreferenceSection = function AxisPreferenceSection(props) {
|
|
62308
|
+
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;
|
|
62309
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
62310
|
+
textOverride = _useDashboardBehaviou.textOverride,
|
|
62311
|
+
dateTimeFormatOptions = _useDashboardBehaviou.dateTimeFormatOptions;
|
|
62312
|
+
var axisOptions = [{
|
|
62313
|
+
label: textOverride('auto', 'Auto'),
|
|
62314
|
+
value: 'auto'
|
|
62315
|
+
}, {
|
|
62316
|
+
label: textOverride('minimal', 'Minimal'),
|
|
62317
|
+
value: 2
|
|
62318
|
+
}, {
|
|
62319
|
+
label: textOverride('None', 'None'),
|
|
62320
|
+
value: 0
|
|
62321
|
+
}];
|
|
62322
|
+
var dateTimeFormatOptionsItems = Object.keys(dateTimeFormatOptions).map(function (key) {
|
|
62323
|
+
var option = dateTimeFormatOptions[key];
|
|
62324
|
+
return {
|
|
62325
|
+
label: option.description,
|
|
62326
|
+
value: key
|
|
62327
|
+
};
|
|
62328
|
+
});
|
|
62329
|
+
var horizontal = props.attributes.type == 'horizontalBarChart';
|
|
62330
|
+
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);
|
|
62331
|
+
var showXAxisDateFormatOptions = !!((_props$attributes4 = props.attributes) != null && _props$attributes4.timeDimension);
|
|
62332
|
+
var _ref = horizontal ? {
|
|
62333
|
+
x: 'y',
|
|
62334
|
+
y: 'x'
|
|
62335
|
+
} : {
|
|
62336
|
+
x: 'x',
|
|
62337
|
+
y: 'y'
|
|
62338
|
+
},
|
|
62339
|
+
x = _ref.x,
|
|
62340
|
+
y = _ref.y;
|
|
62341
|
+
return jsxRuntime.jsx(Section, {
|
|
62342
|
+
title: (_props$section = props.section) == null ? void 0 : _props$section.title,
|
|
62343
|
+
tooltip: (_props$section2 = props.section) == null ? void 0 : _props$section2.description,
|
|
62344
|
+
"data-component": "axis-preference-section",
|
|
62345
|
+
children: jsxRuntime.jsxs(Section.Container, {
|
|
62346
|
+
"data-component": "single-stats-labels",
|
|
62347
|
+
children: [jsxRuntime.jsxs(Section.Panel, {
|
|
62348
|
+
title: (_props$section$y = props.section[y]) == null ? void 0 : _props$section$y.title,
|
|
62349
|
+
children: [jsxRuntime.jsxs(Section.Grid, {
|
|
62350
|
+
columns: 2,
|
|
62351
|
+
children: [jsxRuntime.jsx(TextInput, {
|
|
62352
|
+
label: props.section[y].prefix.title,
|
|
62353
|
+
setText: function setText(yAxisPrefix) {
|
|
62354
|
+
return props.setAttributes({
|
|
62355
|
+
yAxisPrefix: yAxisPrefix
|
|
62356
|
+
});
|
|
62357
|
+
},
|
|
62358
|
+
currentValue: props.attributes.yAxisPrefix,
|
|
62359
|
+
maxLength: 4,
|
|
62360
|
+
id: "axis-" + y + "-prefix"
|
|
62361
|
+
}), jsxRuntime.jsx(TextInput, {
|
|
62362
|
+
label: props.section[y].postfix.title,
|
|
62363
|
+
setText: function setText(yAxisPostfix) {
|
|
62364
|
+
return props.setAttributes({
|
|
62365
|
+
yAxisPostfix: yAxisPostfix
|
|
62366
|
+
});
|
|
62367
|
+
},
|
|
62368
|
+
currentValue: props.attributes.yAxisPostfix,
|
|
62369
|
+
maxLength: 4,
|
|
62370
|
+
id: "axis-" + y + "-postfix"
|
|
62371
|
+
})]
|
|
62372
|
+
}), jsxRuntime.jsxs(Section.Grid, {
|
|
62373
|
+
columns: 2,
|
|
62374
|
+
children: [jsxRuntime.jsx(SelectNumberFormat, {
|
|
62375
|
+
label: (_props$section$y$form = props.section[y].format) == null ? void 0 : _props$section$y$form.title,
|
|
62376
|
+
id: "axis-" + y + "-format",
|
|
62377
|
+
onChange: function onChange(yAxisFormat) {
|
|
62378
|
+
return props.setAttributes({
|
|
62379
|
+
yAxisFormat: yAxisFormat
|
|
62380
|
+
});
|
|
62381
|
+
},
|
|
62382
|
+
currentValue: props.attributes.yAxisFormat,
|
|
62383
|
+
testId: "axis-" + y + "-format"
|
|
62384
|
+
}), jsxRuntime.jsx(FormatSelectInput, {
|
|
62385
|
+
id: "axis-" + y + "-label-count",
|
|
62386
|
+
label: props.section.y.count.title,
|
|
62387
|
+
currentValue: props.attributes.approxYAxisLabelCount,
|
|
62388
|
+
onSelect: function onSelect(approxYAxisLabelCount) {
|
|
62389
|
+
return props.setAttributes({
|
|
62390
|
+
approxYAxisLabelCount: approxYAxisLabelCount
|
|
62391
|
+
});
|
|
62392
|
+
},
|
|
62393
|
+
options: axisOptions
|
|
62394
|
+
})]
|
|
62395
|
+
}), jsxRuntime.jsx(Section.Grid, {
|
|
62396
|
+
children: props.section[y].axisTitle && jsxRuntime.jsx(TextInput, {
|
|
62397
|
+
label: (_props$section$y$axis = props.section[y].axisTitle.title) != null ? _props$section$y$axis : '',
|
|
62398
|
+
setText: function setText(axisTitle) {
|
|
62399
|
+
var _axisTitles;
|
|
62400
|
+
return props.setAttributes({
|
|
62401
|
+
axisTitles: (_axisTitles = {}, _axisTitles[y] = axisTitle, _axisTitles)
|
|
62402
|
+
});
|
|
62403
|
+
},
|
|
62404
|
+
currentValue: (_props$attributes$axi = props.attributes.axisTitles) == null ? void 0 : _props$attributes$axi[y],
|
|
62405
|
+
id: "axis-" + [y] + "-axisTitle"
|
|
62406
|
+
})
|
|
62407
|
+
})]
|
|
62408
|
+
}), jsxRuntime.jsxs(Section.Panel, {
|
|
62409
|
+
title: props.section[x].title,
|
|
62410
|
+
children: [jsxRuntime.jsxs(Section.Grid, {
|
|
62411
|
+
columns: 2,
|
|
62412
|
+
children: [jsxRuntime.jsx(TextInput, {
|
|
62413
|
+
label: props.section[x].prefix.title,
|
|
62414
|
+
setText: function setText(xAxisPrefix) {
|
|
62415
|
+
return props.setAttributes({
|
|
62416
|
+
xAxisPrefix: xAxisPrefix
|
|
62417
|
+
});
|
|
62418
|
+
},
|
|
62419
|
+
currentValue: props.attributes.xAxisPrefix,
|
|
62420
|
+
maxLength: 4,
|
|
62421
|
+
id: "axis-" + x + "-prefix"
|
|
62422
|
+
}), jsxRuntime.jsx(TextInput, {
|
|
62423
|
+
label: props.section[x].postfix.title,
|
|
62424
|
+
setText: function setText(xAxisPostfix) {
|
|
62425
|
+
return props.setAttributes({
|
|
62426
|
+
xAxisPostfix: xAxisPostfix
|
|
62427
|
+
});
|
|
62428
|
+
},
|
|
62429
|
+
currentValue: props.attributes.xAxisPostfix,
|
|
62430
|
+
maxLength: 4,
|
|
62431
|
+
id: "axis-" + x + "-postfix"
|
|
62432
|
+
})]
|
|
62433
|
+
}), jsxRuntime.jsx(Section.Grid, {
|
|
62434
|
+
columns: showXAxisNumberFormatter || showXAxisDateFormatOptions ? 2 : 1,
|
|
62435
|
+
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
62436
|
+
children: [showXAxisNumberFormatter && jsxRuntime.jsx(SelectNumberFormat, {
|
|
62437
|
+
label: (_props$section$x$form = props.section[x].format) == null ? void 0 : _props$section$x$form.title,
|
|
62438
|
+
id: "axis-" + x + "-format",
|
|
62439
|
+
onChange: function onChange(xAxisFormat) {
|
|
62440
|
+
props.setAttributes({
|
|
62441
|
+
xAxisFormat: xAxisFormat
|
|
62442
|
+
});
|
|
62443
|
+
},
|
|
62444
|
+
currentValue: props.attributes.xAxisFormat,
|
|
62445
|
+
testId: "axis-" + y + "-format"
|
|
62446
|
+
}), showXAxisDateFormatOptions ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
62447
|
+
children: [jsxRuntime.jsx(FormatSelectInput, {
|
|
62448
|
+
id: "axis-" + x + "-label-date-format",
|
|
62449
|
+
label: ((_props$section$x = props.section.x) == null || (_props$section$x = _props$section$x.format) == null ? void 0 : _props$section$x.title) || 'Format',
|
|
62450
|
+
currentValue: props.attributes.xAxisFormat,
|
|
62451
|
+
onSelect: function onSelect(xAxisFormat) {
|
|
62452
|
+
return props.setAttributes({
|
|
62453
|
+
xAxisFormat: xAxisFormat
|
|
62454
|
+
});
|
|
62455
|
+
},
|
|
62456
|
+
options: dateTimeFormatOptionsItems
|
|
62457
|
+
}), jsxRuntime.jsx(FormatSelectInput, {
|
|
62458
|
+
id: "axis-" + x + "-label-count",
|
|
62459
|
+
label: props.section.x.count.title,
|
|
62460
|
+
currentValue: props.attributes.approxXAxisLabelCount,
|
|
62461
|
+
onSelect: function onSelect(approxXAxisLabelCount) {
|
|
62462
|
+
return props.setAttributes({
|
|
62463
|
+
approxXAxisLabelCount: approxXAxisLabelCount
|
|
62464
|
+
});
|
|
62465
|
+
},
|
|
62466
|
+
options: axisOptions
|
|
62467
|
+
})]
|
|
62468
|
+
}) : jsxRuntime.jsx(Checkbox, {
|
|
62469
|
+
label: textOverride('hide_labels', 'Hide Labels'),
|
|
62470
|
+
onChange: function onChange(event) {
|
|
62471
|
+
return props.setAttributes({
|
|
62472
|
+
approxXAxisLabelCount: event ? 0 : 'auto'
|
|
62473
|
+
});
|
|
62474
|
+
},
|
|
62475
|
+
id: "hide-labels",
|
|
62476
|
+
currentValue: props.attributes.approxXAxisLabelCount === 0 ? true : false
|
|
62477
|
+
})]
|
|
62478
|
+
})
|
|
62479
|
+
}), jsxRuntime.jsx(Section.Grid, {
|
|
62480
|
+
children: props.section[x].axisTitle && jsxRuntime.jsx(TextInput, {
|
|
62481
|
+
label: (_props$section$x$axis = props.section[x].axisTitle.title) != null ? _props$section$x$axis : '',
|
|
62482
|
+
setText: function setText(axisTitle) {
|
|
62483
|
+
var _axisTitles2;
|
|
62484
|
+
return props.setAttributes({
|
|
62485
|
+
axisTitles: (_axisTitles2 = {}, _axisTitles2[x] = axisTitle, _axisTitles2)
|
|
62486
|
+
});
|
|
62487
|
+
},
|
|
62488
|
+
currentValue: (_props$attributes$axi2 = props.attributes.axisTitles) == null ? void 0 : _props$attributes$axi2[x],
|
|
62489
|
+
id: "axis-" + [x] + "-axisTitle"
|
|
62490
|
+
})
|
|
62491
|
+
})]
|
|
62492
|
+
})]
|
|
62493
|
+
})
|
|
62494
|
+
});
|
|
62495
|
+
};
|
|
62496
|
+
|
|
62265
62497
|
var ChartSettingsSection = function ChartSettingsSection(_ref) {
|
|
62266
62498
|
var section = _ref.section,
|
|
62267
62499
|
attributes = _ref.attributes,
|
|
@@ -62382,196 +62614,6 @@ var ChartSettingsSection = function ChartSettingsSection(_ref) {
|
|
|
62382
62614
|
});
|
|
62383
62615
|
};
|
|
62384
62616
|
|
|
62385
|
-
var AxisPreferenceSection = function AxisPreferenceSection(props) {
|
|
62386
|
-
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;
|
|
62387
|
-
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
62388
|
-
textOverride = _useDashboardBehaviou.textOverride,
|
|
62389
|
-
dateTimeFormatOptions = _useDashboardBehaviou.dateTimeFormatOptions;
|
|
62390
|
-
var axisOptions = [{
|
|
62391
|
-
label: textOverride('auto', 'Auto'),
|
|
62392
|
-
value: 'auto'
|
|
62393
|
-
}, {
|
|
62394
|
-
label: textOverride('minimal', 'Minimal'),
|
|
62395
|
-
value: 2
|
|
62396
|
-
}, {
|
|
62397
|
-
label: textOverride('None', 'None'),
|
|
62398
|
-
value: 0
|
|
62399
|
-
}];
|
|
62400
|
-
var dateTimeFormatOptionsItems = Object.keys(dateTimeFormatOptions).map(function (key) {
|
|
62401
|
-
var option = dateTimeFormatOptions[key];
|
|
62402
|
-
return {
|
|
62403
|
-
label: option.description,
|
|
62404
|
-
value: key
|
|
62405
|
-
};
|
|
62406
|
-
});
|
|
62407
|
-
var horizontal = props.attributes.type == 'horizontalBarChart';
|
|
62408
|
-
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);
|
|
62409
|
-
var showXAxisDateFormatOptions = !!((_props$attributes4 = props.attributes) != null && _props$attributes4.timeDimension);
|
|
62410
|
-
var _ref = horizontal ? {
|
|
62411
|
-
x: 'y',
|
|
62412
|
-
y: 'x'
|
|
62413
|
-
} : {
|
|
62414
|
-
x: 'x',
|
|
62415
|
-
y: 'y'
|
|
62416
|
-
},
|
|
62417
|
-
x = _ref.x,
|
|
62418
|
-
y = _ref.y;
|
|
62419
|
-
return jsxRuntime.jsx(Section, {
|
|
62420
|
-
title: (_props$section = props.section) == null ? void 0 : _props$section.title,
|
|
62421
|
-
tooltip: (_props$section2 = props.section) == null ? void 0 : _props$section2.description,
|
|
62422
|
-
"data-component": "axis-preference-section",
|
|
62423
|
-
children: jsxRuntime.jsxs(Section.Container, {
|
|
62424
|
-
"data-component": "single-stats-labels",
|
|
62425
|
-
children: [jsxRuntime.jsxs(Section.Panel, {
|
|
62426
|
-
title: (_props$section$y = props.section[y]) == null ? void 0 : _props$section$y.title,
|
|
62427
|
-
children: [jsxRuntime.jsxs(Section.Grid, {
|
|
62428
|
-
columns: 2,
|
|
62429
|
-
children: [jsxRuntime.jsx(TextInput, {
|
|
62430
|
-
label: props.section[y].prefix.title,
|
|
62431
|
-
setText: function setText(yAxisPrefix) {
|
|
62432
|
-
return props.setAttributes({
|
|
62433
|
-
yAxisPrefix: yAxisPrefix
|
|
62434
|
-
});
|
|
62435
|
-
},
|
|
62436
|
-
currentValue: props.attributes.yAxisPrefix,
|
|
62437
|
-
maxLength: 4,
|
|
62438
|
-
id: "axis-" + y + "-prefix"
|
|
62439
|
-
}), jsxRuntime.jsx(TextInput, {
|
|
62440
|
-
label: props.section[y].postfix.title,
|
|
62441
|
-
setText: function setText(yAxisPostfix) {
|
|
62442
|
-
return props.setAttributes({
|
|
62443
|
-
yAxisPostfix: yAxisPostfix
|
|
62444
|
-
});
|
|
62445
|
-
},
|
|
62446
|
-
currentValue: props.attributes.yAxisPostfix,
|
|
62447
|
-
maxLength: 4,
|
|
62448
|
-
id: "axis-" + y + "-postfix"
|
|
62449
|
-
})]
|
|
62450
|
-
}), jsxRuntime.jsxs(Section.Grid, {
|
|
62451
|
-
columns: 2,
|
|
62452
|
-
children: [jsxRuntime.jsx(SelectNumberFormat, {
|
|
62453
|
-
label: (_props$section$y$form = props.section[y].format) == null ? void 0 : _props$section$y$form.title,
|
|
62454
|
-
id: "axis-" + y + "-format",
|
|
62455
|
-
onChange: function onChange(yAxisFormat) {
|
|
62456
|
-
return props.setAttributes({
|
|
62457
|
-
yAxisFormat: yAxisFormat
|
|
62458
|
-
});
|
|
62459
|
-
},
|
|
62460
|
-
currentValue: props.attributes.yAxisFormat,
|
|
62461
|
-
testId: "axis-" + y + "-format"
|
|
62462
|
-
}), jsxRuntime.jsx(FormatSelectInput, {
|
|
62463
|
-
id: "axis-" + y + "-label-count",
|
|
62464
|
-
label: props.section.y.count.title,
|
|
62465
|
-
currentValue: props.attributes.approxYAxisLabelCount,
|
|
62466
|
-
onSelect: function onSelect(approxYAxisLabelCount) {
|
|
62467
|
-
return props.setAttributes({
|
|
62468
|
-
approxYAxisLabelCount: approxYAxisLabelCount
|
|
62469
|
-
});
|
|
62470
|
-
},
|
|
62471
|
-
options: axisOptions
|
|
62472
|
-
})]
|
|
62473
|
-
}), jsxRuntime.jsx(Section.Grid, {
|
|
62474
|
-
children: props.section[y].axisTitle && jsxRuntime.jsx(TextInput, {
|
|
62475
|
-
label: (_props$section$y$axis = props.section[y].axisTitle.title) != null ? _props$section$y$axis : '',
|
|
62476
|
-
setText: function setText(axisTitle) {
|
|
62477
|
-
var _axisTitles;
|
|
62478
|
-
return props.setAttributes({
|
|
62479
|
-
axisTitles: (_axisTitles = {}, _axisTitles[y] = axisTitle, _axisTitles)
|
|
62480
|
-
});
|
|
62481
|
-
},
|
|
62482
|
-
currentValue: (_props$attributes$axi = props.attributes.axisTitles) == null ? void 0 : _props$attributes$axi[y],
|
|
62483
|
-
id: "axis-" + [y] + "-axisTitle"
|
|
62484
|
-
})
|
|
62485
|
-
})]
|
|
62486
|
-
}), jsxRuntime.jsxs(Section.Panel, {
|
|
62487
|
-
title: props.section[x].title,
|
|
62488
|
-
children: [jsxRuntime.jsxs(Section.Grid, {
|
|
62489
|
-
columns: 2,
|
|
62490
|
-
children: [jsxRuntime.jsx(TextInput, {
|
|
62491
|
-
label: props.section[x].prefix.title,
|
|
62492
|
-
setText: function setText(xAxisPrefix) {
|
|
62493
|
-
return props.setAttributes({
|
|
62494
|
-
xAxisPrefix: xAxisPrefix
|
|
62495
|
-
});
|
|
62496
|
-
},
|
|
62497
|
-
currentValue: props.attributes.xAxisPrefix,
|
|
62498
|
-
maxLength: 4,
|
|
62499
|
-
id: "axis-" + x + "-prefix"
|
|
62500
|
-
}), jsxRuntime.jsx(TextInput, {
|
|
62501
|
-
label: props.section[x].postfix.title,
|
|
62502
|
-
setText: function setText(xAxisPostfix) {
|
|
62503
|
-
return props.setAttributes({
|
|
62504
|
-
xAxisPostfix: xAxisPostfix
|
|
62505
|
-
});
|
|
62506
|
-
},
|
|
62507
|
-
currentValue: props.attributes.xAxisPostfix,
|
|
62508
|
-
maxLength: 4,
|
|
62509
|
-
id: "axis-" + x + "-postfix"
|
|
62510
|
-
})]
|
|
62511
|
-
}), jsxRuntime.jsx(Section.Grid, {
|
|
62512
|
-
columns: showXAxisNumberFormatter || showXAxisDateFormatOptions ? 2 : 1,
|
|
62513
|
-
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
62514
|
-
children: [showXAxisNumberFormatter && jsxRuntime.jsx(SelectNumberFormat, {
|
|
62515
|
-
label: (_props$section$x$form = props.section[x].format) == null ? void 0 : _props$section$x$form.title,
|
|
62516
|
-
id: "axis-" + x + "-format",
|
|
62517
|
-
onChange: function onChange(xAxisFormat) {
|
|
62518
|
-
props.setAttributes({
|
|
62519
|
-
xAxisFormat: xAxisFormat
|
|
62520
|
-
});
|
|
62521
|
-
},
|
|
62522
|
-
currentValue: props.attributes.xAxisFormat,
|
|
62523
|
-
testId: "axis-" + y + "-format"
|
|
62524
|
-
}), showXAxisDateFormatOptions ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
62525
|
-
children: [jsxRuntime.jsx(FormatSelectInput, {
|
|
62526
|
-
id: "axis-" + x + "-label-date-format",
|
|
62527
|
-
label: ((_props$section$x = props.section.x) == null || (_props$section$x = _props$section$x.format) == null ? void 0 : _props$section$x.title) || 'Format',
|
|
62528
|
-
currentValue: props.attributes.xAxisFormat,
|
|
62529
|
-
onSelect: function onSelect(xAxisFormat) {
|
|
62530
|
-
return props.setAttributes({
|
|
62531
|
-
xAxisFormat: xAxisFormat
|
|
62532
|
-
});
|
|
62533
|
-
},
|
|
62534
|
-
options: dateTimeFormatOptionsItems
|
|
62535
|
-
}), jsxRuntime.jsx(FormatSelectInput, {
|
|
62536
|
-
id: "axis-" + x + "-label-count",
|
|
62537
|
-
label: props.section.x.count.title,
|
|
62538
|
-
currentValue: props.attributes.approxXAxisLabelCount,
|
|
62539
|
-
onSelect: function onSelect(approxXAxisLabelCount) {
|
|
62540
|
-
return props.setAttributes({
|
|
62541
|
-
approxXAxisLabelCount: approxXAxisLabelCount
|
|
62542
|
-
});
|
|
62543
|
-
},
|
|
62544
|
-
options: axisOptions
|
|
62545
|
-
})]
|
|
62546
|
-
}) : jsxRuntime.jsx(Checkbox, {
|
|
62547
|
-
label: textOverride('hide_labels', 'Hide Labels'),
|
|
62548
|
-
onChange: function onChange(event) {
|
|
62549
|
-
return props.setAttributes({
|
|
62550
|
-
approxXAxisLabelCount: event ? 0 : 'auto'
|
|
62551
|
-
});
|
|
62552
|
-
},
|
|
62553
|
-
id: "hide-labels",
|
|
62554
|
-
currentValue: props.attributes.approxXAxisLabelCount === 0 ? true : false
|
|
62555
|
-
})]
|
|
62556
|
-
})
|
|
62557
|
-
}), jsxRuntime.jsx(Section.Grid, {
|
|
62558
|
-
children: props.section[x].axisTitle && jsxRuntime.jsx(TextInput, {
|
|
62559
|
-
label: (_props$section$x$axis = props.section[x].axisTitle.title) != null ? _props$section$x$axis : '',
|
|
62560
|
-
setText: function setText(axisTitle) {
|
|
62561
|
-
var _axisTitles2;
|
|
62562
|
-
return props.setAttributes({
|
|
62563
|
-
axisTitles: (_axisTitles2 = {}, _axisTitles2[x] = axisTitle, _axisTitles2)
|
|
62564
|
-
});
|
|
62565
|
-
},
|
|
62566
|
-
currentValue: (_props$attributes$axi2 = props.attributes.axisTitles) == null ? void 0 : _props$attributes$axi2[x],
|
|
62567
|
-
id: "axis-" + [x] + "-axisTitle"
|
|
62568
|
-
})
|
|
62569
|
-
})]
|
|
62570
|
-
})]
|
|
62571
|
-
})
|
|
62572
|
-
});
|
|
62573
|
-
};
|
|
62574
|
-
|
|
62575
62617
|
function updateAttributes(fromModal, existingArray, rule) {
|
|
62576
62618
|
var newArray;
|
|
62577
62619
|
if (typeof fromModal === 'object' && fromModal !== null) {
|
|
@@ -62862,72 +62904,195 @@ var FormatSection = function FormatSection(props) {
|
|
|
62862
62904
|
});
|
|
62863
62905
|
};
|
|
62864
62906
|
|
|
62865
|
-
var
|
|
62866
|
-
var _props$
|
|
62867
|
-
var _useDashboardContext = useDashboardContext(),
|
|
62868
|
-
dispatch = _useDashboardContext.dispatch;
|
|
62907
|
+
var GoalLineRules = function GoalLineRules(props) {
|
|
62908
|
+
var _props$goalLines;
|
|
62869
62909
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
62870
62910
|
mode = _useDashboardBehaviou.mode,
|
|
62871
|
-
textOverride = _useDashboardBehaviou.textOverride
|
|
62872
|
-
|
|
62873
|
-
|
|
62874
|
-
|
|
62875
|
-
|
|
62876
|
-
prefixes: [].concat((_props$attributes$pre = props.attributes.prefixes) != null ? _props$attributes$pre : [], [prefix])
|
|
62877
|
-
});
|
|
62878
|
-
}
|
|
62911
|
+
textOverride = _useDashboardBehaviou.textOverride,
|
|
62912
|
+
variables = _useDashboardBehaviou.variables;
|
|
62913
|
+
var _useDashboardContext = useDashboardContext(),
|
|
62914
|
+
dispatch = _useDashboardContext.dispatch;
|
|
62915
|
+
var closeModal = function closeModal() {
|
|
62879
62916
|
dispatch({
|
|
62880
62917
|
type: 'setActiveModal',
|
|
62881
62918
|
payload: {
|
|
62882
|
-
modal: ModalType.
|
|
62919
|
+
modal: ModalType.GoalLines,
|
|
62883
62920
|
attributes: undefined
|
|
62884
62921
|
}
|
|
62885
62922
|
});
|
|
62886
62923
|
};
|
|
62887
|
-
var
|
|
62924
|
+
var handleModalDispatch = function handleModalDispatch(existingRule) {
|
|
62888
62925
|
dispatch({
|
|
62889
62926
|
type: 'setActiveModal',
|
|
62890
62927
|
payload: {
|
|
62891
|
-
modal: ModalType.
|
|
62928
|
+
modal: ModalType.GoalLines,
|
|
62892
62929
|
attributes: {
|
|
62893
62930
|
show: true,
|
|
62894
|
-
onClose:
|
|
62895
|
-
|
|
62896
|
-
|
|
62931
|
+
onClose: function onClose() {
|
|
62932
|
+
return closeModal();
|
|
62933
|
+
},
|
|
62934
|
+
onSave: function onSave(newRule) {
|
|
62935
|
+
var newGoalLineArray = updateAttributes(existingRule != null ? existingRule : true, props.goalLines, newRule);
|
|
62936
|
+
props.onSetGoalLineRules(newGoalLineArray);
|
|
62937
|
+
closeModal();
|
|
62938
|
+
},
|
|
62939
|
+
goalLine: existingRule != null ? existingRule : undefined
|
|
62897
62940
|
}
|
|
62898
62941
|
}
|
|
62899
62942
|
});
|
|
62900
62943
|
};
|
|
62901
|
-
return jsxRuntime.jsx(
|
|
62902
|
-
title: props == null ? void 0 : props.section.title,
|
|
62903
|
-
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
62944
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
62904
62945
|
children: jsxRuntime.jsx(ListView, {
|
|
62905
62946
|
mode: mode,
|
|
62906
|
-
|
|
62907
|
-
var
|
|
62908
|
-
|
|
62909
|
-
|
|
62910
|
-
|
|
62911
|
-
|
|
62947
|
+
onOrderChange: function onOrderChange(index, toIndex) {
|
|
62948
|
+
var newFormattingRules = reOrderItems([].concat(props.goalLines), index, toIndex);
|
|
62949
|
+
props.onSetGoalLineRules(newFormattingRules);
|
|
62950
|
+
},
|
|
62951
|
+
purpose: "goal-lines",
|
|
62952
|
+
items: ((_props$goalLines = props.goalLines) != null ? _props$goalLines : []).map(function (rule, index) {
|
|
62953
|
+
var hasValidVariable = validate(rule.value, variables == null ? void 0 : variables.variables);
|
|
62912
62954
|
return {
|
|
62913
|
-
title:
|
|
62914
|
-
|
|
62915
|
-
|
|
62955
|
+
title: jsxRuntime.jsxs(Flex, {
|
|
62956
|
+
alignItems: "center",
|
|
62957
|
+
gap: "0.25rem",
|
|
62958
|
+
children: [jsxRuntime.jsx(Color.Swatch, {
|
|
62959
|
+
color: rule.color
|
|
62960
|
+
}), jsxRuntime.jsx("span", {
|
|
62961
|
+
dangerouslySetInnerHTML: {
|
|
62962
|
+
__html: textOverride('goal_line_configuration', 'Set to <strong>[[ruleValue]]</strong>', {
|
|
62963
|
+
ruleValue: rule.value
|
|
62964
|
+
})
|
|
62965
|
+
}
|
|
62966
|
+
}), !hasValidVariable && jsxRuntime.jsx("div", {
|
|
62967
|
+
"aria-label": textOverride('goal_line.variable_not_available', 'This variable is not available.'),
|
|
62968
|
+
children: jsxRuntime.jsx(Tooltip, {
|
|
62969
|
+
tooltipContent: function tooltipContent() {
|
|
62970
|
+
return jsxRuntime.jsx(React.Fragment, {
|
|
62971
|
+
children: textOverride('goal_line.variable_not_available', 'This variable is not available.')
|
|
62972
|
+
});
|
|
62973
|
+
},
|
|
62974
|
+
children: jsxRuntime.jsx(ErrorIcon, {})
|
|
62975
|
+
})
|
|
62976
|
+
})]
|
|
62977
|
+
}),
|
|
62978
|
+
onClick: function onClick() {
|
|
62979
|
+
return handleModalDispatch(rule);
|
|
62980
|
+
},
|
|
62981
|
+
id: "goal-line-" + index
|
|
62916
62982
|
};
|
|
62917
62983
|
}),
|
|
62918
62984
|
newItemBtn: {
|
|
62919
|
-
callToAction: textOverride('
|
|
62985
|
+
callToAction: textOverride('add_goal_line', 'Add Goal Line'),
|
|
62920
62986
|
onClick: function onClick() {
|
|
62921
|
-
return
|
|
62987
|
+
return handleModalDispatch();
|
|
62922
62988
|
}
|
|
62923
62989
|
},
|
|
62924
62990
|
onDeleteItem: function onDeleteItem(index) {
|
|
62925
|
-
var _props$
|
|
62926
|
-
var
|
|
62927
|
-
|
|
62991
|
+
var _props$goalLines2;
|
|
62992
|
+
var newRules = [].concat((_props$goalLines2 = props.goalLines) != null ? _props$goalLines2 : []);
|
|
62993
|
+
newRules.splice(index, 1);
|
|
62994
|
+
props.onSetGoalLineRules(newRules);
|
|
62995
|
+
}
|
|
62996
|
+
})
|
|
62997
|
+
});
|
|
62998
|
+
};
|
|
62999
|
+
|
|
63000
|
+
var GoalLineSection = function GoalLineSection(props) {
|
|
63001
|
+
var _props$section;
|
|
63002
|
+
return jsxRuntime.jsx(Section, {
|
|
63003
|
+
title: props == null ? void 0 : props.section.title,
|
|
63004
|
+
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63005
|
+
children: jsxRuntime.jsx(GoalLineRules, {
|
|
63006
|
+
onSetGoalLineRules: function onSetGoalLineRules(goalLines) {
|
|
63007
|
+
return props.setAttributes({
|
|
63008
|
+
goalLines: goalLines
|
|
63009
|
+
});
|
|
63010
|
+
},
|
|
63011
|
+
goalLines: props.attributes.goalLines
|
|
63012
|
+
})
|
|
63013
|
+
});
|
|
63014
|
+
};
|
|
63015
|
+
|
|
63016
|
+
var HeadingSection = function HeadingSection(_ref) {
|
|
63017
|
+
var _section$subSection;
|
|
63018
|
+
var section = _ref.section,
|
|
63019
|
+
setAttributes = _ref.setAttributes,
|
|
63020
|
+
attributes = _ref.attributes;
|
|
63021
|
+
var handleInputChange = useInputDebounce(setAttributes);
|
|
63022
|
+
return jsxRuntime.jsx(Section, {
|
|
63023
|
+
title: section.title,
|
|
63024
|
+
tooltip: section == null ? void 0 : section.description,
|
|
63025
|
+
children: jsxRuntime.jsx(Section.Grid, {
|
|
63026
|
+
children: section == null || (_section$subSection = section.subSection) == null ? void 0 : _section$subSection.map(function (section, i) {
|
|
63027
|
+
return jsxRuntime.jsxs(React.Fragment, {
|
|
63028
|
+
children: [section.type === 'title' && jsxRuntime.jsx("div", {
|
|
63029
|
+
children: jsxRuntime.jsx(Input, {
|
|
63030
|
+
label: section == null ? void 0 : section.title,
|
|
63031
|
+
"data-testid": "display-title-input",
|
|
63032
|
+
id: "display-title-input",
|
|
63033
|
+
type: "text",
|
|
63034
|
+
onChange: function onChange(input) {
|
|
63035
|
+
return handleInputChange({
|
|
63036
|
+
displayTitle: input.target.value
|
|
63037
|
+
});
|
|
63038
|
+
},
|
|
63039
|
+
defaultValue: attributes.displayTitle
|
|
63040
|
+
})
|
|
63041
|
+
}), section.type === 'subject' && jsxRuntime.jsx("div", {
|
|
63042
|
+
children: jsxRuntime.jsx(Input, {
|
|
63043
|
+
label: section == null ? void 0 : section.title,
|
|
63044
|
+
"data-testid": "display-subject-input",
|
|
63045
|
+
id: "display-subject-input",
|
|
63046
|
+
type: "text",
|
|
63047
|
+
onChange: function onChange(input) {
|
|
63048
|
+
return handleInputChange({
|
|
63049
|
+
displaySubject: input.target.value
|
|
63050
|
+
});
|
|
63051
|
+
},
|
|
63052
|
+
defaultValue: attributes.displaySubject
|
|
63053
|
+
})
|
|
63054
|
+
})]
|
|
63055
|
+
}, i);
|
|
63056
|
+
})
|
|
63057
|
+
})
|
|
63058
|
+
});
|
|
63059
|
+
};
|
|
63060
|
+
|
|
63061
|
+
var HeadlineSection = function HeadlineSection(props) {
|
|
63062
|
+
var _props$section, _props$attributes$hea, _props$attributes$hea2;
|
|
63063
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63064
|
+
textOverride = _useDashboardBehaviou.textOverride;
|
|
63065
|
+
if (props.dataSet.preAggregated) return null;
|
|
63066
|
+
if (!canHaveHeadline(props.attributes.order, props.attributes.timeDimension)) return null;
|
|
63067
|
+
var options = function () {
|
|
63068
|
+
var builtOptions = [{
|
|
63069
|
+
label: textOverride('none', 'None'),
|
|
63070
|
+
value: null
|
|
63071
|
+
}, {
|
|
63072
|
+
label: textOverride('current', 'Current'),
|
|
63073
|
+
value: 'current'
|
|
63074
|
+
}];
|
|
63075
|
+
return builtOptions;
|
|
63076
|
+
}();
|
|
63077
|
+
return jsxRuntime.jsx(Section, {
|
|
63078
|
+
title: props == null ? void 0 : props.section.title,
|
|
63079
|
+
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63080
|
+
children: jsxRuntime.jsx(Select$2, {
|
|
63081
|
+
id: "headline-options",
|
|
63082
|
+
label: textOverride('options', 'Options'),
|
|
63083
|
+
labelHidden: true,
|
|
63084
|
+
onChange: function onChange(value) {
|
|
62928
63085
|
props.setAttributes({
|
|
62929
|
-
|
|
63086
|
+
headline: {
|
|
63087
|
+
func: value
|
|
63088
|
+
}
|
|
62930
63089
|
});
|
|
63090
|
+
},
|
|
63091
|
+
options: options,
|
|
63092
|
+
selected: (_props$attributes$hea = (_props$attributes$hea2 = props.attributes.headline) == null ? void 0 : _props$attributes$hea2.func) != null ? _props$attributes$hea : null,
|
|
63093
|
+
textOverride: textOverride,
|
|
63094
|
+
onClick: function onClick() {
|
|
63095
|
+
safeScrollBy('bottom', 'editor-panel');
|
|
62931
63096
|
}
|
|
62932
63097
|
})
|
|
62933
63098
|
});
|
|
@@ -62998,6 +63163,124 @@ var MapColorsSection = function MapColorsSection(props) {
|
|
|
62998
63163
|
});
|
|
62999
63164
|
};
|
|
63000
63165
|
|
|
63166
|
+
var PrefixesSection = function PrefixesSection(props) {
|
|
63167
|
+
var _props$section, _props$attributes$pre2;
|
|
63168
|
+
var _useDashboardContext = useDashboardContext(),
|
|
63169
|
+
dispatch = _useDashboardContext.dispatch;
|
|
63170
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63171
|
+
mode = _useDashboardBehaviou.mode,
|
|
63172
|
+
textOverride = _useDashboardBehaviou.textOverride;
|
|
63173
|
+
var handleSavePrefix = function handleSavePrefix(prefix) {
|
|
63174
|
+
if (prefix) {
|
|
63175
|
+
var _props$attributes$pre;
|
|
63176
|
+
props.setAttributes({
|
|
63177
|
+
prefixes: [].concat((_props$attributes$pre = props.attributes.prefixes) != null ? _props$attributes$pre : [], [prefix])
|
|
63178
|
+
});
|
|
63179
|
+
}
|
|
63180
|
+
dispatch({
|
|
63181
|
+
type: 'setActiveModal',
|
|
63182
|
+
payload: {
|
|
63183
|
+
modal: ModalType.Prefix,
|
|
63184
|
+
attributes: undefined
|
|
63185
|
+
}
|
|
63186
|
+
});
|
|
63187
|
+
};
|
|
63188
|
+
var handleOpen = function handleOpen() {
|
|
63189
|
+
dispatch({
|
|
63190
|
+
type: 'setActiveModal',
|
|
63191
|
+
payload: {
|
|
63192
|
+
modal: ModalType.Prefix,
|
|
63193
|
+
attributes: {
|
|
63194
|
+
show: true,
|
|
63195
|
+
onClose: handleSavePrefix,
|
|
63196
|
+
measures: props.attributes.measure,
|
|
63197
|
+
dataSet: props.dataSet
|
|
63198
|
+
}
|
|
63199
|
+
}
|
|
63200
|
+
});
|
|
63201
|
+
};
|
|
63202
|
+
return jsxRuntime.jsx(Section, {
|
|
63203
|
+
title: props == null ? void 0 : props.section.title,
|
|
63204
|
+
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63205
|
+
children: jsxRuntime.jsx(ListView, {
|
|
63206
|
+
mode: mode,
|
|
63207
|
+
items: ((_props$attributes$pre2 = props.attributes.prefixes) != null ? _props$attributes$pre2 : []).map(function (prefix, index) {
|
|
63208
|
+
var _Field$getQueryFieldI = getQueryFieldIdFromResultFieldId(prefix.field, props.queryEngineConfig),
|
|
63209
|
+
queryFieldId = _Field$getQueryFieldI.fieldId,
|
|
63210
|
+
func = _Field$getQueryFieldI["function"];
|
|
63211
|
+
var dataSetField = findField(props.dataSet, queryFieldId);
|
|
63212
|
+
var title = "" + dataSetField.publicName + (func != 'none' ? " (" + props.queryEngineConfig.supportedAggregates[func].publicName + ")" : '');
|
|
63213
|
+
return {
|
|
63214
|
+
title: title,
|
|
63215
|
+
subtext: prefix.prefix,
|
|
63216
|
+
id: "prefix-" + index
|
|
63217
|
+
};
|
|
63218
|
+
}),
|
|
63219
|
+
newItemBtn: {
|
|
63220
|
+
callToAction: textOverride('add_prefix', 'Add Prefix'),
|
|
63221
|
+
onClick: function onClick() {
|
|
63222
|
+
return handleOpen();
|
|
63223
|
+
}
|
|
63224
|
+
},
|
|
63225
|
+
onDeleteItem: function onDeleteItem(index) {
|
|
63226
|
+
var _props$attributes$pre3;
|
|
63227
|
+
var newPrefixes = [].concat((_props$attributes$pre3 = props.attributes.prefixes) != null ? _props$attributes$pre3 : []);
|
|
63228
|
+
newPrefixes.splice(index, 1);
|
|
63229
|
+
props.setAttributes({
|
|
63230
|
+
prefixes: newPrefixes
|
|
63231
|
+
});
|
|
63232
|
+
}
|
|
63233
|
+
})
|
|
63234
|
+
});
|
|
63235
|
+
};
|
|
63236
|
+
|
|
63237
|
+
var ProgressTypeSection = function ProgressTypeSection(props) {
|
|
63238
|
+
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63239
|
+
textOverride = _useDashboardBehaviou.textOverride;
|
|
63240
|
+
return jsxRuntime.jsx(Section, {
|
|
63241
|
+
title: textOverride('type', 'Type'),
|
|
63242
|
+
children: jsxRuntime.jsxs(Section.Grid, {
|
|
63243
|
+
children: [props.attributes.goals.length === 0 && jsxRuntime.jsx(Alert, {
|
|
63244
|
+
type: "info",
|
|
63245
|
+
title: textOverride('progress.goals_need to be set', 'Goals need to be set')
|
|
63246
|
+
}), jsxRuntime.jsx(OpacityOverlay, {
|
|
63247
|
+
enabled: props.attributes.goals.length === 0,
|
|
63248
|
+
children: jsxRuntime.jsx(FormatSelectInput, {
|
|
63249
|
+
options: [{
|
|
63250
|
+
value: ProgressType.Linear,
|
|
63251
|
+
label: textOverride('linear', 'Linear')
|
|
63252
|
+
}, {
|
|
63253
|
+
value: ProgressType.Circular,
|
|
63254
|
+
label: textOverride('circular', 'Circular')
|
|
63255
|
+
}],
|
|
63256
|
+
currentValue: defaultProgressType(props.attributes.progressType),
|
|
63257
|
+
onSelect: function onSelect(progressType) {
|
|
63258
|
+
var newProgressType = props.attributes.progressType.map(function (obj) {
|
|
63259
|
+
return _extends({}, obj, {
|
|
63260
|
+
value: progressType
|
|
63261
|
+
});
|
|
63262
|
+
});
|
|
63263
|
+
props.setAttributes({
|
|
63264
|
+
progressType: newProgressType
|
|
63265
|
+
});
|
|
63266
|
+
},
|
|
63267
|
+
label: textOverride('type', 'Type'),
|
|
63268
|
+
labelHidden: true
|
|
63269
|
+
})
|
|
63270
|
+
})]
|
|
63271
|
+
})
|
|
63272
|
+
});
|
|
63273
|
+
};
|
|
63274
|
+
|
|
63275
|
+
var RichTextFormatSection = function RichTextFormatSection(props) {
|
|
63276
|
+
var _props$section;
|
|
63277
|
+
return jsxRuntime.jsx(Section, {
|
|
63278
|
+
title: props == null ? void 0 : props.section.title,
|
|
63279
|
+
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63280
|
+
children: jsxRuntime.jsx(RichTextMenu, {})
|
|
63281
|
+
});
|
|
63282
|
+
};
|
|
63283
|
+
|
|
63001
63284
|
var StatsLabelsSection = function StatsLabelsSection(props) {
|
|
63002
63285
|
var _props$section, _props$section2;
|
|
63003
63286
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
@@ -63080,202 +63363,6 @@ var StatsLabelsSection = function StatsLabelsSection(props) {
|
|
|
63080
63363
|
});
|
|
63081
63364
|
};
|
|
63082
63365
|
|
|
63083
|
-
var GoalLineRules = function GoalLineRules(props) {
|
|
63084
|
-
var _props$goalLines;
|
|
63085
|
-
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63086
|
-
mode = _useDashboardBehaviou.mode,
|
|
63087
|
-
textOverride = _useDashboardBehaviou.textOverride,
|
|
63088
|
-
variables = _useDashboardBehaviou.variables;
|
|
63089
|
-
var _useDashboardContext = useDashboardContext(),
|
|
63090
|
-
dispatch = _useDashboardContext.dispatch;
|
|
63091
|
-
var closeModal = function closeModal() {
|
|
63092
|
-
dispatch({
|
|
63093
|
-
type: 'setActiveModal',
|
|
63094
|
-
payload: {
|
|
63095
|
-
modal: ModalType.GoalLines,
|
|
63096
|
-
attributes: undefined
|
|
63097
|
-
}
|
|
63098
|
-
});
|
|
63099
|
-
};
|
|
63100
|
-
var handleModalDispatch = function handleModalDispatch(existingRule) {
|
|
63101
|
-
dispatch({
|
|
63102
|
-
type: 'setActiveModal',
|
|
63103
|
-
payload: {
|
|
63104
|
-
modal: ModalType.GoalLines,
|
|
63105
|
-
attributes: {
|
|
63106
|
-
show: true,
|
|
63107
|
-
onClose: function onClose() {
|
|
63108
|
-
return closeModal();
|
|
63109
|
-
},
|
|
63110
|
-
onSave: function onSave(newRule) {
|
|
63111
|
-
var newGoalLineArray = updateAttributes(existingRule != null ? existingRule : true, props.goalLines, newRule);
|
|
63112
|
-
props.onSetGoalLineRules(newGoalLineArray);
|
|
63113
|
-
closeModal();
|
|
63114
|
-
},
|
|
63115
|
-
goalLine: existingRule != null ? existingRule : undefined
|
|
63116
|
-
}
|
|
63117
|
-
}
|
|
63118
|
-
});
|
|
63119
|
-
};
|
|
63120
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
63121
|
-
children: jsxRuntime.jsx(ListView, {
|
|
63122
|
-
mode: mode,
|
|
63123
|
-
onOrderChange: function onOrderChange(index, toIndex) {
|
|
63124
|
-
var newFormattingRules = reOrderItems([].concat(props.goalLines), index, toIndex);
|
|
63125
|
-
props.onSetGoalLineRules(newFormattingRules);
|
|
63126
|
-
},
|
|
63127
|
-
purpose: "goal-lines",
|
|
63128
|
-
items: ((_props$goalLines = props.goalLines) != null ? _props$goalLines : []).map(function (rule, index) {
|
|
63129
|
-
var hasValidVariable = validate(rule.value, variables == null ? void 0 : variables.variables);
|
|
63130
|
-
return {
|
|
63131
|
-
title: jsxRuntime.jsxs(Flex, {
|
|
63132
|
-
alignItems: "center",
|
|
63133
|
-
gap: "0.25rem",
|
|
63134
|
-
children: [jsxRuntime.jsx(Color.Swatch, {
|
|
63135
|
-
color: rule.color
|
|
63136
|
-
}), jsxRuntime.jsx("span", {
|
|
63137
|
-
dangerouslySetInnerHTML: {
|
|
63138
|
-
__html: textOverride('goal_line_configuration', 'Set to <strong>[[ruleValue]]</strong>', {
|
|
63139
|
-
ruleValue: rule.value
|
|
63140
|
-
})
|
|
63141
|
-
}
|
|
63142
|
-
}), !hasValidVariable && jsxRuntime.jsx("div", {
|
|
63143
|
-
"aria-label": textOverride('goal_line.variable_not_available', 'This variable is not available.'),
|
|
63144
|
-
children: jsxRuntime.jsx(Tooltip, {
|
|
63145
|
-
tooltipContent: function tooltipContent() {
|
|
63146
|
-
return jsxRuntime.jsx(React.Fragment, {
|
|
63147
|
-
children: textOverride('goal_line.variable_not_available', 'This variable is not available.')
|
|
63148
|
-
});
|
|
63149
|
-
},
|
|
63150
|
-
children: jsxRuntime.jsx(ErrorIcon, {})
|
|
63151
|
-
})
|
|
63152
|
-
})]
|
|
63153
|
-
}),
|
|
63154
|
-
onClick: function onClick() {
|
|
63155
|
-
return handleModalDispatch(rule);
|
|
63156
|
-
},
|
|
63157
|
-
id: "goal-line-" + index
|
|
63158
|
-
};
|
|
63159
|
-
}),
|
|
63160
|
-
newItemBtn: {
|
|
63161
|
-
callToAction: textOverride('add_goal_line', 'Add Goal Line'),
|
|
63162
|
-
onClick: function onClick() {
|
|
63163
|
-
return handleModalDispatch();
|
|
63164
|
-
}
|
|
63165
|
-
},
|
|
63166
|
-
onDeleteItem: function onDeleteItem(index) {
|
|
63167
|
-
var _props$goalLines2;
|
|
63168
|
-
var newRules = [].concat((_props$goalLines2 = props.goalLines) != null ? _props$goalLines2 : []);
|
|
63169
|
-
newRules.splice(index, 1);
|
|
63170
|
-
props.onSetGoalLineRules(newRules);
|
|
63171
|
-
}
|
|
63172
|
-
})
|
|
63173
|
-
});
|
|
63174
|
-
};
|
|
63175
|
-
|
|
63176
|
-
var GoalLineSection = function GoalLineSection(props) {
|
|
63177
|
-
var _props$section;
|
|
63178
|
-
return jsxRuntime.jsx(Section, {
|
|
63179
|
-
title: props == null ? void 0 : props.section.title,
|
|
63180
|
-
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63181
|
-
children: jsxRuntime.jsx(GoalLineRules, {
|
|
63182
|
-
onSetGoalLineRules: function onSetGoalLineRules(goalLines) {
|
|
63183
|
-
return props.setAttributes({
|
|
63184
|
-
goalLines: goalLines
|
|
63185
|
-
});
|
|
63186
|
-
},
|
|
63187
|
-
goalLines: props.attributes.goalLines
|
|
63188
|
-
})
|
|
63189
|
-
});
|
|
63190
|
-
};
|
|
63191
|
-
|
|
63192
|
-
var ProgressTypeSection = function ProgressTypeSection(props) {
|
|
63193
|
-
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63194
|
-
textOverride = _useDashboardBehaviou.textOverride;
|
|
63195
|
-
return jsxRuntime.jsx(Section, {
|
|
63196
|
-
title: textOverride('type', 'Type'),
|
|
63197
|
-
children: jsxRuntime.jsxs(Section.Grid, {
|
|
63198
|
-
children: [props.attributes.goals.length === 0 && jsxRuntime.jsx(Alert, {
|
|
63199
|
-
type: "info",
|
|
63200
|
-
title: textOverride('progress.goals_need to be set', 'Goals need to be set')
|
|
63201
|
-
}), jsxRuntime.jsx(OpacityOverlay, {
|
|
63202
|
-
enabled: props.attributes.goals.length === 0,
|
|
63203
|
-
children: jsxRuntime.jsx(FormatSelectInput, {
|
|
63204
|
-
options: [{
|
|
63205
|
-
value: ProgressType.Linear,
|
|
63206
|
-
label: textOverride('linear', 'Linear')
|
|
63207
|
-
}, {
|
|
63208
|
-
value: ProgressType.Circular,
|
|
63209
|
-
label: textOverride('circular', 'Circular')
|
|
63210
|
-
}],
|
|
63211
|
-
currentValue: defaultProgressType(props.attributes.progressType),
|
|
63212
|
-
onSelect: function onSelect(progressType) {
|
|
63213
|
-
var newProgressType = props.attributes.progressType.map(function (obj) {
|
|
63214
|
-
return _extends({}, obj, {
|
|
63215
|
-
value: progressType
|
|
63216
|
-
});
|
|
63217
|
-
});
|
|
63218
|
-
props.setAttributes({
|
|
63219
|
-
progressType: newProgressType
|
|
63220
|
-
});
|
|
63221
|
-
},
|
|
63222
|
-
label: textOverride('type', 'Type'),
|
|
63223
|
-
labelHidden: true
|
|
63224
|
-
})
|
|
63225
|
-
})]
|
|
63226
|
-
})
|
|
63227
|
-
});
|
|
63228
|
-
};
|
|
63229
|
-
|
|
63230
|
-
var HeadlineSection = function HeadlineSection(props) {
|
|
63231
|
-
var _props$section, _props$attributes$hea, _props$attributes$hea2;
|
|
63232
|
-
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|
|
63233
|
-
textOverride = _useDashboardBehaviou.textOverride;
|
|
63234
|
-
if (props.dataSet.preAggregated) return null;
|
|
63235
|
-
if (!canHaveHeadline(props.attributes.order, props.attributes.timeDimension)) return null;
|
|
63236
|
-
var options = function () {
|
|
63237
|
-
var builtOptions = [{
|
|
63238
|
-
label: textOverride('none', 'None'),
|
|
63239
|
-
value: null
|
|
63240
|
-
}, {
|
|
63241
|
-
label: textOverride('current', 'Current'),
|
|
63242
|
-
value: 'current'
|
|
63243
|
-
}];
|
|
63244
|
-
return builtOptions;
|
|
63245
|
-
}();
|
|
63246
|
-
return jsxRuntime.jsx(Section, {
|
|
63247
|
-
title: props == null ? void 0 : props.section.title,
|
|
63248
|
-
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63249
|
-
children: jsxRuntime.jsx(Select$2, {
|
|
63250
|
-
id: "headline-options",
|
|
63251
|
-
label: textOverride('options', 'Options'),
|
|
63252
|
-
labelHidden: true,
|
|
63253
|
-
onChange: function onChange(value) {
|
|
63254
|
-
props.setAttributes({
|
|
63255
|
-
headline: {
|
|
63256
|
-
func: value
|
|
63257
|
-
}
|
|
63258
|
-
});
|
|
63259
|
-
},
|
|
63260
|
-
options: options,
|
|
63261
|
-
selected: (_props$attributes$hea = (_props$attributes$hea2 = props.attributes.headline) == null ? void 0 : _props$attributes$hea2.func) != null ? _props$attributes$hea : null,
|
|
63262
|
-
textOverride: textOverride,
|
|
63263
|
-
onClick: function onClick() {
|
|
63264
|
-
safeScrollBy('bottom', 'editor-panel');
|
|
63265
|
-
}
|
|
63266
|
-
})
|
|
63267
|
-
});
|
|
63268
|
-
};
|
|
63269
|
-
|
|
63270
|
-
var RichTextFormatSection = function RichTextFormatSection(props) {
|
|
63271
|
-
var _props$section;
|
|
63272
|
-
return jsxRuntime.jsx(Section, {
|
|
63273
|
-
title: props == null ? void 0 : props.section.title,
|
|
63274
|
-
tooltip: props == null || (_props$section = props.section) == null ? void 0 : _props$section.description,
|
|
63275
|
-
children: jsxRuntime.jsx(RichTextMenu, {})
|
|
63276
|
-
});
|
|
63277
|
-
};
|
|
63278
|
-
|
|
63279
63366
|
var WaterfallColorsSection = function WaterfallColorsSection(props) {
|
|
63280
63367
|
var _props$section;
|
|
63281
63368
|
var _useDashboardBehaviou = useDashboardBehaviourContext(),
|