carbon-addons-iot-react 2.151.0-next.2 → 2.151.0-next.5
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/CHANGELOG.md +49 -0
- package/css/carbon-addons-iot-react.css +396 -0
- package/css/carbon-addons-iot-react.css.map +1 -1
- package/es/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItemModal.js +26 -97
- package/es/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItems/DataSeriesFormContent.js +4 -4
- package/es/components/CardEditor/CardEditForm/CardEditFormItems/TableCardFormItems/TableCardFormContent.js +4 -4
- package/es/components/CardEditor/CardEditForm/CommonCardEditFormFields.js +2 -1
- package/es/components/CardEditor/CardEditor.js +12 -29
- package/es/components/DashboardEditor/DashboardEditor.js +3 -1
- package/es/components/DashboardEditor/editorUtils.js +5 -19
- package/es/components/HotspotEditorModal/HotspotEditorDataSourceTab/HotspotEditorDataSourceTab.js +4 -4
- package/es/components/TimePicker/ListSpinner.js +537 -0
- package/es/components/TimePicker/TimePickerDropdown.js +847 -0
- package/es/index.js +1 -0
- package/lib/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItemModal.js +26 -97
- package/lib/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItems/DataSeriesFormContent.js +4 -4
- package/lib/components/CardEditor/CardEditForm/CardEditFormItems/TableCardFormItems/TableCardFormContent.js +4 -4
- package/lib/components/CardEditor/CardEditForm/CommonCardEditFormFields.js +2 -1
- package/lib/components/CardEditor/CardEditor.js +12 -29
- package/lib/components/DashboardEditor/DashboardEditor.js +3 -1
- package/lib/components/DashboardEditor/editorUtils.js +5 -19
- package/lib/components/HotspotEditorModal/HotspotEditorDataSourceTab/HotspotEditorDataSourceTab.js +4 -4
- package/lib/components/TimePicker/ListSpinner.js +550 -0
- package/lib/components/TimePicker/TimePickerDropdown.js +862 -0
- package/lib/css/carbon-addons-iot-react.css +396 -0
- package/lib/css/carbon-addons-iot-react.css.map +1 -1
- package/lib/index.js +2 -0
- package/lib/scss/components/TimePicker/_time-picker-dropdown.scss +285 -0
- package/lib/scss/components/TimePicker/list-spinner.scss +86 -0
- package/lib/scss/styles.scss +2 -0
- package/package.json +2 -2
- package/scss/components/TimePicker/_time-picker-dropdown.scss +285 -0
- package/scss/components/TimePicker/list-spinner.scss +86 -0
- package/scss/styles.scss +2 -0
- package/umd/carbon-addons-iot-react.js +2153 -907
|
@@ -73,11 +73,6 @@ var propTypes = {
|
|
|
73
73
|
text: PropTypes.string
|
|
74
74
|
})),
|
|
75
75
|
aggregationMethod: PropTypes.string,
|
|
76
|
-
downSampleMethods: PropTypes.arrayOf(PropTypes.shape({
|
|
77
|
-
id: PropTypes.string,
|
|
78
|
-
text: PropTypes.string
|
|
79
|
-
})),
|
|
80
|
-
downSampleMethod: PropTypes.string,
|
|
81
76
|
grain: PropTypes.string,
|
|
82
77
|
label: PropTypes.string,
|
|
83
78
|
dataItemId: PropTypes.string,
|
|
@@ -163,9 +158,7 @@ var defaultProps = {
|
|
|
163
158
|
dataItemSource: 'Data item source',
|
|
164
159
|
primaryButtonLabelText: 'Save',
|
|
165
160
|
secondaryButtonLabelText: 'Cancel',
|
|
166
|
-
decimalPlacesLabel: 'Decimal places'
|
|
167
|
-
downSampleMethod: 'Downsample method',
|
|
168
|
-
downSampleMethodHelperText: 'Select an aggregation to be used to reduce the sampling rate of a large time-series data.'
|
|
161
|
+
decimalPlacesLabel: 'Decimal places'
|
|
169
162
|
},
|
|
170
163
|
editDataSeries: [],
|
|
171
164
|
showEditor: false,
|
|
@@ -218,7 +211,7 @@ var DATAITEM_COLORS_OPTIONS = [{
|
|
|
218
211
|
}];
|
|
219
212
|
|
|
220
213
|
var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
221
|
-
var _content$columns, _validDataItems$find, _validDataItems$find2
|
|
214
|
+
var _content$columns, _validDataItems$find, _validDataItems$find2;
|
|
222
215
|
|
|
223
216
|
var cardConfig = _ref.cardConfig,
|
|
224
217
|
isSummaryDashboard = _ref.isSummaryDashboard,
|
|
@@ -293,19 +286,15 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
|
293
286
|
var dataSourceId = _ref2.dataSourceId;
|
|
294
287
|
return dataSourceId === editDataItem.dataSourceId;
|
|
295
288
|
})) === null || _validDataItems$find === void 0 ? void 0 : _validDataItems$find.aggregationMethod;
|
|
296
|
-
var
|
|
289
|
+
var initialGrain = validDataItems === null || validDataItems === void 0 ? void 0 : (_validDataItems$find2 = validDataItems.find(function (_ref3) {
|
|
297
290
|
var dataSourceId = _ref3.dataSourceId;
|
|
298
291
|
return dataSourceId === editDataItem.dataSourceId;
|
|
299
|
-
})) === null || _validDataItems$find2 === void 0 ? void 0 : _validDataItems$find2.
|
|
300
|
-
var initialGrain = validDataItems === null || validDataItems === void 0 ? void 0 : (_validDataItems$find3 = validDataItems.find(function (_ref4) {
|
|
301
|
-
var dataSourceId = _ref4.dataSourceId;
|
|
302
|
-
return dataSourceId === editDataItem.dataSourceId;
|
|
303
|
-
})) === null || _validDataItems$find3 === void 0 ? void 0 : _validDataItems$find3.grain;
|
|
292
|
+
})) === null || _validDataItems$find2 === void 0 ? void 0 : _validDataItems$find2.grain;
|
|
304
293
|
var selectedDimensionFilter = editDataItem.dataFilter ? Object.keys(editDataItem.dataFilter)[0] : '';
|
|
305
294
|
var DataEditorContent = useMemo(function () {
|
|
306
|
-
var _editDataItem$aggrega, _editDataItem$aggrega2, _editDataItem$precisi, _editDataItem$precisi2, _classnames, _availableDimensions
|
|
295
|
+
var _editDataItem$aggrega, _editDataItem$aggrega2, _editDataItem$precisi, _editDataItem$precisi2, _classnames, _availableDimensions$;
|
|
307
296
|
|
|
308
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, (editDataItem === null || editDataItem === void 0 ? void 0 : editDataItem.type) !== 'DIMENSION' && (editDataItem === null || editDataItem === void 0 ? void 0 : editDataItem.type) !== 'TIMESTAMP' &&
|
|
297
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, (editDataItem === null || editDataItem === void 0 ? void 0 : editDataItem.type) !== 'DIMENSION' && (editDataItem === null || editDataItem === void 0 ? void 0 : editDataItem.type) !== 'TIMESTAMP' && /*#__PURE__*/React__default.createElement("div", {
|
|
309
298
|
className: "".concat(baseClassName, "--input-group")
|
|
310
299
|
}, !initialAggregation || !isSummaryDashboard ?
|
|
311
300
|
/*#__PURE__*/
|
|
@@ -328,10 +317,10 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
|
328
317
|
},
|
|
329
318
|
titleText: mergedI18n.aggregationMethod,
|
|
330
319
|
light: true,
|
|
331
|
-
onChange: function onChange(
|
|
320
|
+
onChange: function onChange(_ref4) {
|
|
332
321
|
var _availableGrains$;
|
|
333
322
|
|
|
334
|
-
var selectedItem =
|
|
323
|
+
var selectedItem = _ref4.selectedItem;
|
|
335
324
|
setEditDataItem(omit.apply(void 0, [_objectSpread(_objectSpread({}, editDataItem), {}, {
|
|
336
325
|
aggregationMethod: selectedItem.id
|
|
337
326
|
}, isTimeBasedCard && selectedItem.id !== 'none' && !editDataItem.grain ? {
|
|
@@ -344,7 +333,7 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
|
344
333
|
className: "".concat(baseClassName, "--input-group--item-half-label")
|
|
345
334
|
}, mergedI18n.aggregationMethod), /*#__PURE__*/React__default.createElement("span", {
|
|
346
335
|
className: "".concat(baseClassName, "--input-group--item-half-content")
|
|
347
|
-
}, "".concat(editDataItem.aggregationMethod ? editDataItem.aggregationMethod[0].toUpperCase() : '').concat(((_editDataItem$aggrega2 = editDataItem.aggregationMethod) === null || _editDataItem$aggrega2 === void 0 ? void 0 : _editDataItem$aggrega2.slice(1)) || ''))), isTimeBasedCard && editDataItem.aggregationMethod && editDataItem.aggregationMethod !== 'none' && /*#__PURE__*/React__default.createElement("div", {
|
|
336
|
+
}, "".concat(editDataItem.aggregationMethod ? editDataItem.aggregationMethod[0].toUpperCase() : '').concat(((_editDataItem$aggrega2 = editDataItem.aggregationMethod) === null || _editDataItem$aggrega2 === void 0 ? void 0 : _editDataItem$aggrega2.slice(1)) || ''))), isTimeBasedCard && editDataItem.aggregationMethod && editDataItem.aggregationMethod !== 'none' && !(editDataItem !== null && editDataItem !== void 0 && editDataItem.hasStreamingMetricEnabled) && /*#__PURE__*/React__default.createElement("div", {
|
|
348
337
|
className: "".concat(baseClassName, "--input-group--item-half")
|
|
349
338
|
}, /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
350
339
|
id: "".concat(id, "_grain-selector"),
|
|
@@ -362,8 +351,8 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
|
362
351
|
}) || availableGrains[0],
|
|
363
352
|
titleText: mergedI18n.grain,
|
|
364
353
|
light: true,
|
|
365
|
-
onChange: function onChange(
|
|
366
|
-
var selectedItem =
|
|
354
|
+
onChange: function onChange(_ref5) {
|
|
355
|
+
var selectedItem = _ref5.selectedItem;
|
|
367
356
|
setEditDataItem(_objectSpread(_objectSpread({}, editDataItem), {}, {
|
|
368
357
|
grain: selectedItem.id
|
|
369
358
|
}));
|
|
@@ -392,12 +381,12 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
|
392
381
|
id: "".concat(id, "_color-dropdown"),
|
|
393
382
|
label: "",
|
|
394
383
|
titleText: type === CARD_TYPES.TIMESERIES ? mergedI18n.dataItemEditorLineColor : mergedI18n.dataItemEditorBarColor,
|
|
395
|
-
selectedColor: DATAITEM_COLORS_OPTIONS.find(function (
|
|
396
|
-
var carbonColor =
|
|
384
|
+
selectedColor: DATAITEM_COLORS_OPTIONS.find(function (_ref6) {
|
|
385
|
+
var carbonColor = _ref6.carbonColor;
|
|
397
386
|
return carbonColor === editDataItem.color;
|
|
398
387
|
}),
|
|
399
|
-
onChange: function onChange(
|
|
400
|
-
var color =
|
|
388
|
+
onChange: function onChange(_ref7) {
|
|
389
|
+
var color = _ref7.color;
|
|
401
390
|
return setEditDataItem(_objectSpread(_objectSpread({}, editDataItem), {}, {
|
|
402
391
|
color: color.carbonColor
|
|
403
392
|
}));
|
|
@@ -427,8 +416,8 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
|
427
416
|
items: [mergedI18n.notSet, '0', '1', '2', '3', '4'],
|
|
428
417
|
light: true,
|
|
429
418
|
selectedItem: ((_editDataItem$precisi = editDataItem.precision) === null || _editDataItem$precisi === void 0 ? void 0 : _editDataItem$precisi.toString()) || mergedI18n.notSet,
|
|
430
|
-
onChange: function onChange(
|
|
431
|
-
var selectedItem =
|
|
419
|
+
onChange: function onChange(_ref8) {
|
|
420
|
+
var selectedItem = _ref8.selectedItem;
|
|
432
421
|
var isSet = selectedItem !== mergedI18n.notSet;
|
|
433
422
|
|
|
434
423
|
if (isSet) {
|
|
@@ -464,8 +453,8 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
|
464
453
|
items: [mergedI18n.notSet, '0', '1', '2', '3', '4'],
|
|
465
454
|
light: true,
|
|
466
455
|
selectedItem: ((_editDataItem$precisi2 = editDataItem.precision) === null || _editDataItem$precisi2 === void 0 ? void 0 : _editDataItem$precisi2.toString()) || mergedI18n.notSet,
|
|
467
|
-
onChange: function onChange(
|
|
468
|
-
var selectedItem =
|
|
456
|
+
onChange: function onChange(_ref9) {
|
|
457
|
+
var selectedItem = _ref9.selectedItem;
|
|
469
458
|
var isSet = selectedItem !== mergedI18n.notSet;
|
|
470
459
|
|
|
471
460
|
if (isSet) {
|
|
@@ -491,8 +480,8 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
|
491
480
|
items: [mergedI18n.none].concat(_toConsumableArray(Object.keys(availableDimensions))),
|
|
492
481
|
light: true,
|
|
493
482
|
selectedItem: selectedDimensionFilter || mergedI18n.none,
|
|
494
|
-
onChange: function onChange(
|
|
495
|
-
var selectedItem =
|
|
483
|
+
onChange: function onChange(_ref10) {
|
|
484
|
+
var selectedItem = _ref10.selectedItem;
|
|
496
485
|
|
|
497
486
|
if (selectedItem !== mergedI18n.none) {
|
|
498
487
|
var dataFilter = _defineProperty({}, selectedItem, availableDimensions[selectedItem].sort()[0]);
|
|
@@ -517,8 +506,8 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
|
517
506
|
return item === null || item === void 0 ? void 0 : item.toString();
|
|
518
507
|
},
|
|
519
508
|
selectedItem: editDataItem.dataFilter ? editDataItem.dataFilter[selectedDimensionFilter] : undefined,
|
|
520
|
-
onChange: function onChange(
|
|
521
|
-
var selectedItem =
|
|
509
|
+
onChange: function onChange(_ref11) {
|
|
510
|
+
var selectedItem = _ref11.selectedItem;
|
|
522
511
|
|
|
523
512
|
var dataFilter = _defineProperty({}, selectedDimensionFilter, selectedItem);
|
|
524
513
|
|
|
@@ -546,47 +535,8 @@ var DataSeriesFormItemModal = function DataSeriesFormItemModal(_ref) {
|
|
|
546
535
|
thresholds: thresholds
|
|
547
536
|
}));
|
|
548
537
|
}
|
|
549
|
-
})
|
|
550
|
-
|
|
551
|
-
// Downsample methods are only alowed on Timeseries card.
|
|
552
|
-
React__default.createElement("div", {
|
|
553
|
-
className: "".concat(baseClassName, "--input-group")
|
|
554
|
-
}, !initialDownSample || !isSummaryDashboard ?
|
|
555
|
-
/*#__PURE__*/
|
|
556
|
-
// selector should only be use-able in an instance dash or if there is no initial aggregation
|
|
557
|
-
React__default.createElement("div", {
|
|
558
|
-
className: "".concat(baseClassName, "--input-group--item-half")
|
|
559
|
-
}, /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
560
|
-
id: "".concat(id, "_downSample-method"),
|
|
561
|
-
label: "",
|
|
562
|
-
direction: "bottom",
|
|
563
|
-
itemToString: function itemToString(item) {
|
|
564
|
-
return item.text;
|
|
565
|
-
},
|
|
566
|
-
items: editDataItem.downSampleMethods || [],
|
|
567
|
-
selectedItem: ((_editDataItem$downSam = editDataItem.downSampleMethods) === null || _editDataItem$downSam === void 0 ? void 0 : _editDataItem$downSam.find(function (method) {
|
|
568
|
-
return method.id === editDataItem.downSampleMethod;
|
|
569
|
-
})) || {
|
|
570
|
-
id: 'none',
|
|
571
|
-
text: mergedI18n.none
|
|
572
|
-
},
|
|
573
|
-
titleText: mergedI18n.downSampleMethod,
|
|
574
|
-
helperText: mergedI18n.downSampleMethodHelperText,
|
|
575
|
-
light: true,
|
|
576
|
-
onChange: function onChange(_ref13) {
|
|
577
|
-
var selectedItem = _ref13.selectedItem;
|
|
578
|
-
setEditDataItem(_objectSpread(_objectSpread({}, editDataItem), {}, {
|
|
579
|
-
downSampleMethod: selectedItem.id
|
|
580
|
-
}));
|
|
581
|
-
}
|
|
582
|
-
})) : /*#__PURE__*/React__default.createElement("div", {
|
|
583
|
-
className: "".concat(baseClassName, "--input-group--item-half")
|
|
584
|
-
}, /*#__PURE__*/React__default.createElement(FormLabel, {
|
|
585
|
-
className: "".concat(baseClassName, "--input-group--item-half-label")
|
|
586
|
-
}, mergedI18n.downSampleMethod), /*#__PURE__*/React__default.createElement("span", {
|
|
587
|
-
className: "".concat(baseClassName, "--input-group--item-half-content")
|
|
588
|
-
}, "".concat(editDataItem.downSampleMethod ? editDataItem.downSampleMethod[0].toUpperCase() : '').concat(((_editDataItem$downSam2 = editDataItem.downSampleMethod) === null || _editDataItem$downSam2 === void 0 ? void 0 : _editDataItem$downSam2.slice(1)) || '')))));
|
|
589
|
-
}, [availableDimensions, availableGrains, baseClassName, cardConfig, editDataItem, handleTranslation, id, initialAggregation, initialGrain, isSummaryDashboard, isTimeBasedCard, mergedI18n, selectedDimensionFilter, setEditDataItem, type, initialDownSample]);
|
|
538
|
+
}));
|
|
539
|
+
}, [availableDimensions, availableGrains, baseClassName, cardConfig, editDataItem, handleTranslation, id, initialAggregation, initialGrain, isSummaryDashboard, isTimeBasedCard, mergedI18n, selectedDimensionFilter, setEditDataItem, type]);
|
|
590
540
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showEditor && /*#__PURE__*/React__default.createElement("div", {
|
|
591
541
|
className: "".concat(baseClassName, "--modal-wrapper")
|
|
592
542
|
}, /*#__PURE__*/React__default.createElement(ComposedModal, {
|
|
@@ -736,7 +686,7 @@ DataSeriesFormItemModal.__docgenInfo = {
|
|
|
736
686
|
},
|
|
737
687
|
"i18n": {
|
|
738
688
|
"defaultValue": {
|
|
739
|
-
"value": "{\n dataItemEditorDataSeriesTitle: 'Customize data series',\n dataItemEditorValueCardTitle: 'Edit data',\n dataItemEditorDataItemLabel: 'Label',\n dataItemEditorLegendColor: 'Legend color',\n dataItemEditorSectionTitle: 'Data series',\n selectDataItems: 'Select data items',\n dataItem: 'Data item',\n edit: 'Edit',\n example: 'Example',\n notSet: 'Not set',\n none: 'None',\n dataItemEditorDataItemCustomLabel: 'Custom label',\n dataItemEditorDataItemHelperText: (dataItemSource, dataItemId) =>\n `${dataItemSource}: ${dataItemId}`,\n dataItemEditorDataItemUnit: 'Unit',\n dataItemEditorDataItemFilter: 'Data filter',\n dataItemEditorDataItemThresholds: 'Thresholds',\n dataItemEditorDataItemAddThreshold: 'Add threshold',\n dataItemEditorBarColor: 'Bar color',\n dataItemEditorLineColor: 'Line color',\n source: 'Source data item',\n aggregationMethod: 'Aggregation method',\n grain: 'Grain',\n hourlyLabel: 'Hourly',\n dailyLabel: 'Daily',\n weeklyLabel: 'Weekly',\n monthlyLabel: 'Monthly',\n yearlyLabel: 'Yearly',\n dataItemSource: 'Data item source',\n primaryButtonLabelText: 'Save',\n secondaryButtonLabelText: 'Cancel',\n decimalPlacesLabel: 'Decimal places',\n
|
|
689
|
+
"value": "{\n dataItemEditorDataSeriesTitle: 'Customize data series',\n dataItemEditorValueCardTitle: 'Edit data',\n dataItemEditorDataItemLabel: 'Label',\n dataItemEditorLegendColor: 'Legend color',\n dataItemEditorSectionTitle: 'Data series',\n selectDataItems: 'Select data items',\n dataItem: 'Data item',\n edit: 'Edit',\n example: 'Example',\n notSet: 'Not set',\n none: 'None',\n dataItemEditorDataItemCustomLabel: 'Custom label',\n dataItemEditorDataItemHelperText: (dataItemSource, dataItemId) =>\n `${dataItemSource}: ${dataItemId}`,\n dataItemEditorDataItemUnit: 'Unit',\n dataItemEditorDataItemFilter: 'Data filter',\n dataItemEditorDataItemThresholds: 'Thresholds',\n dataItemEditorDataItemAddThreshold: 'Add threshold',\n dataItemEditorBarColor: 'Bar color',\n dataItemEditorLineColor: 'Line color',\n source: 'Source data item',\n aggregationMethod: 'Aggregation method',\n grain: 'Grain',\n hourlyLabel: 'Hourly',\n dailyLabel: 'Daily',\n weeklyLabel: 'Weekly',\n monthlyLabel: 'Monthly',\n yearlyLabel: 'Yearly',\n dataItemSource: 'Data item source',\n primaryButtonLabelText: 'Save',\n secondaryButtonLabelText: 'Cancel',\n decimalPlacesLabel: 'Decimal places',\n}",
|
|
740
690
|
"computed": false
|
|
741
691
|
},
|
|
742
692
|
"type": {
|
|
@@ -922,27 +872,6 @@ DataSeriesFormItemModal.__docgenInfo = {
|
|
|
922
872
|
"name": "string",
|
|
923
873
|
"required": false
|
|
924
874
|
},
|
|
925
|
-
"downSampleMethods": {
|
|
926
|
-
"name": "arrayOf",
|
|
927
|
-
"value": {
|
|
928
|
-
"name": "shape",
|
|
929
|
-
"value": {
|
|
930
|
-
"id": {
|
|
931
|
-
"name": "string",
|
|
932
|
-
"required": false
|
|
933
|
-
},
|
|
934
|
-
"text": {
|
|
935
|
-
"name": "string",
|
|
936
|
-
"required": false
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
},
|
|
940
|
-
"required": false
|
|
941
|
-
},
|
|
942
|
-
"downSampleMethod": {
|
|
943
|
-
"name": "string",
|
|
944
|
-
"required": false
|
|
945
|
-
},
|
|
946
875
|
"grain": {
|
|
947
876
|
"name": "string",
|
|
948
877
|
"required": false
|
|
@@ -309,7 +309,7 @@ var DataSeriesFormItem = function DataSeriesFormItem(_ref2) {
|
|
|
309
309
|
}, [cardConfig, dataSection, _onChange, setSelectedDataItems, validDataItems]);
|
|
310
310
|
var handleEditButton = useCallback( /*#__PURE__*/function () {
|
|
311
311
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(dataItem, i) {
|
|
312
|
-
var dataItemWithMetaData, colorIndex,
|
|
312
|
+
var dataItemWithMetaData, colorIndex, aggregationMethods;
|
|
313
313
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
314
314
|
while (1) {
|
|
315
315
|
switch (_context.prev = _context.next) {
|
|
@@ -329,10 +329,10 @@ var DataSeriesFormItem = function DataSeriesFormItem(_ref2) {
|
|
|
329
329
|
return onEditDataItem(cardConfig, dataItem, dataItemWithMetaData);
|
|
330
330
|
|
|
331
331
|
case 5:
|
|
332
|
-
|
|
332
|
+
aggregationMethods = _context.sent;
|
|
333
333
|
|
|
334
|
-
if (!isEmpty(
|
|
335
|
-
dataItemWithMetaData.
|
|
334
|
+
if (!isEmpty(aggregationMethods)) {
|
|
335
|
+
dataItemWithMetaData.aggregationMethods = aggregationMethods;
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
case 7:
|
|
@@ -302,7 +302,7 @@ var TableCardFormContent = function TableCardFormContent(_ref) {
|
|
|
302
302
|
}, [cardConfig, dataSection, _onChange, removedDataItems, setSelectedDataItems]);
|
|
303
303
|
var handleEditButton = useCallback( /*#__PURE__*/function () {
|
|
304
304
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(dataItem) {
|
|
305
|
-
var dataItemWithMetaData,
|
|
305
|
+
var dataItemWithMetaData, aggregationMethods;
|
|
306
306
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
307
307
|
while (1) {
|
|
308
308
|
switch (_context.prev = _context.next) {
|
|
@@ -321,10 +321,10 @@ var TableCardFormContent = function TableCardFormContent(_ref) {
|
|
|
321
321
|
return onEditDataItem(cardConfig, dataItem, dataItemWithMetaData);
|
|
322
322
|
|
|
323
323
|
case 4:
|
|
324
|
-
|
|
324
|
+
aggregationMethods = _context.sent;
|
|
325
325
|
|
|
326
|
-
if (!isEmpty(
|
|
327
|
-
dataItemWithMetaData.
|
|
326
|
+
if (!isEmpty(aggregationMethods)) {
|
|
327
|
+
dataItemWithMetaData.aggregationMethods = aggregationMethods;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
case 6:
|
|
@@ -3,6 +3,7 @@ import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
|
3
3
|
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
4
4
|
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
5
5
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
6
|
+
import isEmpty from '../../../node_modules/lodash-es/isEmpty.js';
|
|
6
7
|
import 'core-js/modules/es.array.concat.js';
|
|
7
8
|
import 'core-js/modules/es.symbol.js';
|
|
8
9
|
import 'core-js/modules/es.symbol.description.js';
|
|
@@ -209,7 +210,7 @@ var CommonCardEditFormFields = function CommonCardEditFormFields(_ref) {
|
|
|
209
210
|
}));
|
|
210
211
|
},
|
|
211
212
|
titleText: mergedI18n.size
|
|
212
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
213
|
+
})), isEmpty(validTimeRangeOptions) ? null : /*#__PURE__*/React__default.createElement("div", {
|
|
213
214
|
className: "".concat(baseClassName, "--input")
|
|
214
215
|
}, /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
215
216
|
key: "card_".concat(id),
|
|
@@ -25,7 +25,6 @@ import { DASHBOARD_EDITOR_CARD_TYPES, CARD_TYPES } from '../../constants/LayoutC
|
|
|
25
25
|
import CardCodeEditor from '../CardCodeEditor/CardCodeEditor.js';
|
|
26
26
|
import Button from '../Button/Button.js';
|
|
27
27
|
import { settings } from '../../constants/Settings.js';
|
|
28
|
-
import deprecate from '../../internal/deprecate.js';
|
|
29
28
|
import CardGalleryList from './CardGalleryList/CardGalleryList.js';
|
|
30
29
|
import CardEditForm from './CardEditForm/CardEditForm.js';
|
|
31
30
|
|
|
@@ -152,9 +151,6 @@ var propTypes = {
|
|
|
152
151
|
}),
|
|
153
152
|
currentBreakpoint: PropTypes.string,
|
|
154
153
|
isSummaryDashboard: PropTypes.bool,
|
|
155
|
-
// TODO: remove deprecated testID in v3
|
|
156
|
-
// eslint-disable-next-line react/require-default-props
|
|
157
|
-
testID: deprecate(PropTypes.string, "The 'testID' prop has been deprecated. Please use 'testId' instead."),
|
|
158
154
|
|
|
159
155
|
/** Id that can be used for testing */
|
|
160
156
|
testId: PropTypes.string,
|
|
@@ -243,19 +239,19 @@ var hideCardPropertiesForEditor = function hideCardPropertiesForEditor(card) {
|
|
|
243
239
|
|
|
244
240
|
if ((_card$content = card.content) !== null && _card$content !== void 0 && _card$content.attributes) {
|
|
245
241
|
attributes = card.content.attributes.map(function (attribute) {
|
|
246
|
-
return omit(attribute, ['aggregationMethods', 'grain'
|
|
242
|
+
return omit(attribute, ['aggregationMethods', 'grain']);
|
|
247
243
|
});
|
|
248
244
|
}
|
|
249
245
|
|
|
250
246
|
if ((_card$content2 = card.content) !== null && _card$content2 !== void 0 && _card$content2.series) {
|
|
251
247
|
series = card.content.series.map(function (attribute) {
|
|
252
|
-
return omit(attribute, ['aggregationMethods', 'grain'
|
|
248
|
+
return omit(attribute, ['aggregationMethods', 'grain']);
|
|
253
249
|
});
|
|
254
250
|
}
|
|
255
251
|
|
|
256
252
|
if ((_card$content3 = card.content) !== null && _card$content3 !== void 0 && _card$content3.columns) {
|
|
257
253
|
columns = card.content.columns.map(function (column) {
|
|
258
|
-
return omit(column, ['aggregationMethods', 'grain'
|
|
254
|
+
return omit(column, ['aggregationMethods', 'grain']);
|
|
259
255
|
});
|
|
260
256
|
} // Need to exclued content for custom cards because the card's JSX element lives on it in this case
|
|
261
257
|
|
|
@@ -347,7 +343,6 @@ var CardEditor = function CardEditor(_ref) {
|
|
|
347
343
|
icons = _ref.icons,
|
|
348
344
|
i18n = _ref.i18n,
|
|
349
345
|
currentBreakpoint = _ref.currentBreakpoint,
|
|
350
|
-
testID = _ref.testID,
|
|
351
346
|
testId = _ref.testId,
|
|
352
347
|
dataSeriesItemLinks = _ref.dataSeriesItemLinks,
|
|
353
348
|
onFetchDynamicDemoHotspots = _ref.onFetchDynamicDemoHotspots,
|
|
@@ -382,9 +377,8 @@ var CardEditor = function CardEditor(_ref) {
|
|
|
382
377
|
return onRenderCardEditForm && cardConfig ? onRenderCardEditForm(cardConfig) : cardConfig;
|
|
383
378
|
}, [cardConfig, onRenderCardEditForm]);
|
|
384
379
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
385
|
-
className: baseClassName
|
|
386
|
-
|
|
387
|
-
"data-testid": testID || testId
|
|
380
|
+
className: baseClassName,
|
|
381
|
+
"data-testid": testId
|
|
388
382
|
}, showGallery ? /*#__PURE__*/React__default.createElement("div", {
|
|
389
383
|
className: "".concat(baseClassName, "--header")
|
|
390
384
|
}, /*#__PURE__*/React__default.createElement("h2", {
|
|
@@ -395,9 +389,8 @@ var CardEditor = function CardEditor(_ref) {
|
|
|
395
389
|
icons: icons,
|
|
396
390
|
onAddCard: onAddCard,
|
|
397
391
|
supportedCardTypes: supportedCardTypes,
|
|
398
|
-
i18n: mergedI18n
|
|
399
|
-
,
|
|
400
|
-
testId: "".concat(testID || testId, "-card-gallery-list")
|
|
392
|
+
i18n: mergedI18n,
|
|
393
|
+
testId: "".concat(testId, "-card-gallery-list")
|
|
401
394
|
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showJsonEditor ? /*#__PURE__*/React__default.createElement(CardCodeEditor, {
|
|
402
395
|
onSubmit: function onSubmit(card, setError) {
|
|
403
396
|
return handleSubmit(card, cardConfig.id, setError, onValidateCardJson, onChange, setShowJsonEditor);
|
|
@@ -423,7 +416,7 @@ var CardEditor = function CardEditor(_ref) {
|
|
|
423
416
|
}))), showGallery ? null : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
424
417
|
className: "".concat(baseClassName, "--footer")
|
|
425
418
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
426
|
-
testId: "".concat(
|
|
419
|
+
testId: "".concat(testId, "-open-editor-button"),
|
|
427
420
|
kind: "ghost",
|
|
428
421
|
size: "small",
|
|
429
422
|
renderIcon: Code16,
|
|
@@ -438,9 +431,8 @@ var CardEditor = function CardEditor(_ref) {
|
|
|
438
431
|
kind: "ghost",
|
|
439
432
|
size: "small",
|
|
440
433
|
renderIcon: Apps16,
|
|
441
|
-
onClick: onShowGallery
|
|
442
|
-
|
|
443
|
-
|
|
434
|
+
onClick: onShowGallery,
|
|
435
|
+
testId: "".concat(testId, "-add-card-button")
|
|
444
436
|
}, mergedI18n.addCardButton))), isSummaryDashboard ? /*#__PURE__*/React__default.createElement("div", {
|
|
445
437
|
className: "".concat(baseClassName, "--footer")
|
|
446
438
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
@@ -449,9 +441,8 @@ var CardEditor = function CardEditor(_ref) {
|
|
|
449
441
|
size: "small",
|
|
450
442
|
renderIcon: Data_116,
|
|
451
443
|
onClick: onEditDataItems,
|
|
452
|
-
iconDescription: mergedI18n.editDataItems
|
|
453
|
-
|
|
454
|
-
|
|
444
|
+
iconDescription: mergedI18n.editDataItems,
|
|
445
|
+
testId: "".concat(testId, "-edit-button")
|
|
455
446
|
}, mergedI18n.editDataItems)) : null);
|
|
456
447
|
};
|
|
457
448
|
|
|
@@ -834,14 +825,6 @@ CardEditor.__docgenInfo = {
|
|
|
834
825
|
},
|
|
835
826
|
"required": true,
|
|
836
827
|
"description": "Callback function when card is added from list"
|
|
837
|
-
},
|
|
838
|
-
"testID": {
|
|
839
|
-
"type": {
|
|
840
|
-
"name": "custom",
|
|
841
|
-
"raw": "deprecate(\n PropTypes.string,\n `The 'testID' prop has been deprecated. Please use 'testId' instead.`\n)"
|
|
842
|
-
},
|
|
843
|
-
"required": false,
|
|
844
|
-
"description": ""
|
|
845
828
|
}
|
|
846
829
|
}
|
|
847
830
|
};
|
|
@@ -349,6 +349,8 @@ var propTypes = {
|
|
|
349
349
|
isCardResizable: PropTypes.bool,
|
|
350
350
|
onEditDataItems: PropTypes.func,
|
|
351
351
|
testId: PropTypes.string,
|
|
352
|
+
|
|
353
|
+
/** handles V2 dataItem */
|
|
352
354
|
onEditDataItem: PropTypes.func
|
|
353
355
|
};
|
|
354
356
|
var defaultProps = {
|
|
@@ -1881,7 +1883,7 @@ DashboardEditor.__docgenInfo = {
|
|
|
1881
1883
|
"name": "func"
|
|
1882
1884
|
},
|
|
1883
1885
|
"required": false,
|
|
1884
|
-
"description": ""
|
|
1886
|
+
"description": "handles V2 dataItem"
|
|
1885
1887
|
}
|
|
1886
1888
|
}
|
|
1887
1889
|
};
|
|
@@ -63,22 +63,12 @@ var DataItemsPropTypes = PropTypes.arrayOf(PropTypes.shape({
|
|
|
63
63
|
id: PropTypes.string,
|
|
64
64
|
text: PropTypes.string
|
|
65
65
|
})),
|
|
66
|
-
downSampleMethod: PropTypes.string,
|
|
67
|
-
downSampleMethods: PropTypes.arrayOf(PropTypes.shape({
|
|
68
|
-
id: PropTypes.string,
|
|
69
|
-
text: PropTypes.string
|
|
70
|
-
})),
|
|
71
66
|
|
|
72
67
|
/** Grain is needed in summary dashboard editors */
|
|
73
68
|
grain: PropTypes.string,
|
|
74
69
|
// Used for streming dataItems
|
|
75
70
|
hasStreamingMetricEnabled: PropTypes.bool
|
|
76
|
-
}));
|
|
77
|
-
// export const Version = {
|
|
78
|
-
// V1: 'V1',
|
|
79
|
-
// V2: 'V2',
|
|
80
|
-
// };
|
|
81
|
-
|
|
71
|
+
}));
|
|
82
72
|
/**
|
|
83
73
|
* Returns a duplicate card configuration
|
|
84
74
|
* @param {Object} cardConfig, card JSON configuration
|
|
@@ -477,8 +467,7 @@ var formatSeries = function formatSeries(selectedItems, cardConfig) {
|
|
|
477
467
|
var unEditedLabel = _ref.label,
|
|
478
468
|
dataItemId = _ref.dataItemId,
|
|
479
469
|
dataSourceId = _ref.dataSourceId,
|
|
480
|
-
aggregationMethod = _ref.aggregationMethod
|
|
481
|
-
downSampleMethod = _ref.downSampleMethod;
|
|
470
|
+
aggregationMethod = _ref.aggregationMethod;
|
|
482
471
|
var colorIndex = (removedItemsCountRef.current + i) % DATAITEM_COLORS_OPTIONS.length;
|
|
483
472
|
var currentItem = cardSeries === null || cardSeries === void 0 ? void 0 : cardSeries.find(function (dataItem) {
|
|
484
473
|
return dataItem.dataSourceId === dataSourceId;
|
|
@@ -490,8 +479,7 @@ var formatSeries = function formatSeries(selectedItems, cardConfig) {
|
|
|
490
479
|
dataSourceId: dataSourceId,
|
|
491
480
|
label: label,
|
|
492
481
|
aggregationMethod: aggregationMethod,
|
|
493
|
-
color: color
|
|
494
|
-
downSampleMethod: downSampleMethod
|
|
482
|
+
color: color
|
|
495
483
|
});
|
|
496
484
|
});
|
|
497
485
|
return series;
|
|
@@ -510,8 +498,7 @@ var formatAttributes = function formatAttributes(selectedItems, cardConfig) {
|
|
|
510
498
|
var unEditedLabel = _ref2.label,
|
|
511
499
|
dataItemId = _ref2.dataItemId,
|
|
512
500
|
dataSourceId = _ref2.dataSourceId,
|
|
513
|
-
aggregationMethod = _ref2.aggregationMethod
|
|
514
|
-
downSampleMethod = _ref2.downSampleMethod;
|
|
501
|
+
aggregationMethod = _ref2.aggregationMethod;
|
|
515
502
|
var currentItem = currentCardAttributes === null || currentCardAttributes === void 0 ? void 0 : currentCardAttributes.find(function (dataItem) {
|
|
516
503
|
return dataItem.dataSourceId === dataSourceId;
|
|
517
504
|
}); // Need to default the label to reflect the default aggregator if there isn't one set
|
|
@@ -521,8 +508,7 @@ var formatAttributes = function formatAttributes(selectedItems, cardConfig) {
|
|
|
521
508
|
dataItemId: dataItemId,
|
|
522
509
|
dataSourceId: dataSourceId,
|
|
523
510
|
label: label,
|
|
524
|
-
aggregationMethod: aggregationMethod
|
|
525
|
-
downSampleMethod: downSampleMethod
|
|
511
|
+
aggregationMethod: aggregationMethod
|
|
526
512
|
});
|
|
527
513
|
});
|
|
528
514
|
return attributes;
|
package/es/components/HotspotEditorModal/HotspotEditorDataSourceTab/HotspotEditorDataSourceTab.js
CHANGED
|
@@ -191,7 +191,7 @@ var HotspotEditorDataSourceTab = function HotspotEditorDataSourceTab(_ref2) {
|
|
|
191
191
|
});
|
|
192
192
|
var handleEditButton = useCallback( /*#__PURE__*/function () {
|
|
193
193
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(dataItem) {
|
|
194
|
-
var dataItemWithMetaData,
|
|
194
|
+
var dataItemWithMetaData, aggregationMethods;
|
|
195
195
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
196
196
|
while (1) {
|
|
197
197
|
switch (_context.prev = _context.next) {
|
|
@@ -210,10 +210,10 @@ var HotspotEditorDataSourceTab = function HotspotEditorDataSourceTab(_ref2) {
|
|
|
210
210
|
return onEditDataItem(cardConfig, dataItem, dataItemWithMetaData);
|
|
211
211
|
|
|
212
212
|
case 4:
|
|
213
|
-
|
|
213
|
+
aggregationMethods = _context.sent;
|
|
214
214
|
|
|
215
|
-
if (!isEmpty(
|
|
216
|
-
dataItemWithMetaData.
|
|
215
|
+
if (!isEmpty(aggregationMethods)) {
|
|
216
|
+
dataItemWithMetaData.aggregationMethods = aggregationMethods;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
case 6:
|