carbon-addons-iot-react 4.3.6 → 4.4.0
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/es/components/Card/Card.js +18 -5
- package/es/components/CardEditor/CardEditForm/CardEditForm.js +16 -0
- package/es/components/CardEditor/CardEditForm/CardEditFormContent.js +17 -0
- package/es/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItemModal.js +18 -3
- package/es/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItems/DataSeriesFormContent.js +19 -2
- package/es/components/CardEditor/CardEditForm/CommonCardEditFormFields.js +17 -1
- package/es/components/CardEditor/CardEditor.js +16 -0
- package/es/components/DashboardEditor/DashboardEditor.js +19 -1
- package/es/components/DashboardEditor/DashboardEditorCardRenderer.js +4 -2
- package/es/components/ValueCard/Attribute.js +38 -2
- package/es/components/ValueCard/ValueCard.js +15 -3
- package/es/components/ValueCard/ValueContent.js +19 -2
- package/es/constants/CardPropTypes.js +2 -0
- package/es/utils/cardUtilityFunctions.js +16 -1
- package/lib/components/Card/Card.js +17 -4
- package/lib/components/CardEditor/CardEditForm/CardEditForm.js +16 -0
- package/lib/components/CardEditor/CardEditForm/CardEditFormContent.js +17 -0
- package/lib/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItemModal.js +17 -2
- package/lib/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItems/DataSeriesFormContent.js +19 -2
- package/lib/components/CardEditor/CardEditForm/CommonCardEditFormFields.js +17 -1
- package/lib/components/CardEditor/CardEditor.js +16 -0
- package/lib/components/DashboardEditor/DashboardEditor.js +19 -1
- package/lib/components/DashboardEditor/DashboardEditorCardRenderer.js +4 -2
- package/lib/components/ValueCard/Attribute.js +38 -2
- package/lib/components/ValueCard/ValueCard.js +15 -3
- package/lib/components/ValueCard/ValueContent.js +19 -2
- package/lib/constants/CardPropTypes.js +2 -0
- package/lib/utils/cardUtilityFunctions.js +16 -0
- package/package.json +1 -1
- package/umd/carbon-addons-iot-react.js +226 -19
|
@@ -37,7 +37,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
37
37
|
var update__default = /*#__PURE__*/_interopDefault(update);
|
|
38
38
|
|
|
39
39
|
var _excluded = ["style", "children"],
|
|
40
|
-
_excluded2 = ["isSelected", "availableDimensions", "i18n", "onRemove", "onDuplicate", "onCardChange", "setSelectedCardId", "renderIconByName", "onShowImageGallery", "onValidateUploadedImage", "baseClassName", "renderCardPreview", "style"];
|
|
40
|
+
_excluded2 = ["isSelected", "availableDimensions", "i18n", "onRemove", "onDuplicate", "onCardChange", "setSelectedCardId", "renderIconByName", "onShowImageGallery", "onValidateUploadedImage", "baseClassName", "renderCardPreview", "style", "shouldUseTranslatedLabels"];
|
|
41
41
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
42
42
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
43
43
|
|
|
@@ -109,6 +109,7 @@ var DashboardEditorCardRenderer = /*#__PURE__*/React__default.default.memo(funct
|
|
|
109
109
|
baseClassName = _ref2.baseClassName,
|
|
110
110
|
renderCardPreview = _ref2.renderCardPreview,
|
|
111
111
|
style = _ref2.style,
|
|
112
|
+
shouldUseTranslatedLabels = _ref2.shouldUseTranslatedLabels,
|
|
112
113
|
cardConfig = _objectWithoutProperties__default.default(_ref2, _excluded2);
|
|
113
114
|
// We have to keep track of our dynamic hotspots here
|
|
114
115
|
var _useState5 = React.useState([]),
|
|
@@ -142,6 +143,7 @@ var DashboardEditorCardRenderer = /*#__PURE__*/React__default.default.memo(funct
|
|
|
142
143
|
key: cardConfig.id,
|
|
143
144
|
tooltip: cardConfig.description,
|
|
144
145
|
i18n: i18n,
|
|
146
|
+
shouldUseTranslatedLabels: shouldUseTranslatedLabels,
|
|
145
147
|
availableActions: availableActions,
|
|
146
148
|
onCardAction: handleOnCardAction,
|
|
147
149
|
renderIconByName: renderIconByName,
|
|
@@ -154,7 +156,7 @@ var DashboardEditorCardRenderer = /*#__PURE__*/React__default.default.memo(funct
|
|
|
154
156
|
onBrowseClick: cardConfig.type === LayoutConstants.CARD_TYPES.IMAGE && isNil((_cardConfig$content = cardConfig.content) === null || _cardConfig$content === void 0 ? void 0 : _cardConfig$content.src) ? onShowImageGallery : undefined,
|
|
155
157
|
validateUploadedImage: cardConfig.type === LayoutConstants.CARD_TYPES.IMAGE ? onValidateUploadedImage : undefined
|
|
156
158
|
});
|
|
157
|
-
}, [baseClassName, cardConfig, handleOnCardAction, handleOnCardKeyDown, handleOnCardMouseDown, i18n, isSelected, onShowImageGallery, onValidateUploadedImage, renderIconByName, style]);
|
|
159
|
+
}, [baseClassName, cardConfig, handleOnCardAction, handleOnCardKeyDown, handleOnCardMouseDown, i18n, isSelected, onShowImageGallery, onValidateUploadedImage, renderIconByName, shouldUseTranslatedLabels, style]);
|
|
158
160
|
React.useEffect(function () {
|
|
159
161
|
var _cardProps$values;
|
|
160
162
|
var originalDynamicHotspot = (_cardProps$values = cardProps.values) === null || _cardProps$values === void 0 || (_cardProps$values = _cardProps$values.hotspots) === null || _cardProps$values === void 0 ? void 0 : _cardProps$values.find(function (hotspot) {
|
|
@@ -13,6 +13,7 @@ var LayoutConstants = require('../../constants/LayoutConstants.js');
|
|
|
13
13
|
var CardIcon = require('../ImageCard/CardIcon.js');
|
|
14
14
|
var useMatchingThreshold = require('../../hooks/useMatchingThreshold.js');
|
|
15
15
|
var index = require('../Tooltip/index.js');
|
|
16
|
+
var cardUtilityFunctions = require('../../utils/cardUtilityFunctions.js');
|
|
16
17
|
var ValueRenderer = require('./ValueRenderer.js');
|
|
17
18
|
var UnitRenderer = require('./UnitRenderer.js');
|
|
18
19
|
var valueCardUtils = require('./valueCardUtils.js');
|
|
@@ -45,6 +46,9 @@ var propTypes = {
|
|
|
45
46
|
isEditable: PropTypes__default.default.bool,
|
|
46
47
|
layout: PropTypes__default.default.oneOf(Object.values(LayoutConstants.CARD_LAYOUTS)),
|
|
47
48
|
locale: PropTypes__default.default.string,
|
|
49
|
+
/** whether to use translated labels in cards */
|
|
50
|
+
shouldUseTranslatedLabels: PropTypes__default.default.bool,
|
|
51
|
+
i18n: PropTypes__default.default.objectOf(PropTypes__default.default.any),
|
|
48
52
|
renderIconByName: PropTypes__default.default.func,
|
|
49
53
|
/** Optional trend information */
|
|
50
54
|
secondaryValue: PropTypes__default.default.shape({
|
|
@@ -72,6 +76,8 @@ var defaultProps = {
|
|
|
72
76
|
locale: 'en',
|
|
73
77
|
customFormatter: null,
|
|
74
78
|
isEditable: false,
|
|
79
|
+
shouldUseTranslatedLabels: false,
|
|
80
|
+
i18n: {},
|
|
75
81
|
testId: 'attribute',
|
|
76
82
|
onValueClick: null
|
|
77
83
|
};
|
|
@@ -95,6 +101,8 @@ var Attribute = function Attribute(_ref) {
|
|
|
95
101
|
isEditable = _ref.isEditable,
|
|
96
102
|
layout = _ref.layout,
|
|
97
103
|
locale = _ref.locale,
|
|
104
|
+
shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
|
|
105
|
+
i18n = _ref.i18n,
|
|
98
106
|
renderIconByName = _ref.renderIconByName,
|
|
99
107
|
secondaryValue = _ref.secondaryValue,
|
|
100
108
|
value = _ref.value,
|
|
@@ -113,6 +121,9 @@ var Attribute = function Attribute(_ref) {
|
|
|
113
121
|
|
|
114
122
|
// need to reduce the width size to fit multiple attributes when card layout is horizontal
|
|
115
123
|
var attributeWidthPercentage = layout === LayoutConstants.CARD_LAYOUTS.HORIZONTAL ? 100 / attributeCount : 100;
|
|
124
|
+
|
|
125
|
+
// Get translated label if shouldUseTranslatedLabels is true
|
|
126
|
+
var displayLabel = cardUtilityFunctions.getTranslatedLabel(label, shouldUseTranslatedLabels, i18n);
|
|
116
127
|
return /*#__PURE__*/React__default.default.createElement("div", {
|
|
117
128
|
className: classnames__default.default("".concat(BEM_BASE, "-wrapper"), _defineProperty__default.default(_defineProperty__default.default({}, "".concat(BEM_BASE, "-wrapper--vertical"), layout === LayoutConstants.CARD_LAYOUTS.VERTICAL), "".concat(BEM_BASE, "-wrapper--horizontal"), layout === LayoutConstants.CARD_LAYOUTS.HORIZONTAL)),
|
|
118
129
|
style: {
|
|
@@ -132,10 +143,10 @@ var Attribute = function Attribute(_ref) {
|
|
|
132
143
|
}) : null, tooltip ? /*#__PURE__*/React__default.default.createElement(index.Tooltip, {
|
|
133
144
|
direction: "right",
|
|
134
145
|
showIcon: false,
|
|
135
|
-
triggerText:
|
|
146
|
+
triggerText: displayLabel
|
|
136
147
|
}, /*#__PURE__*/React__default.default.createElement("p", null, tooltip)) : /*#__PURE__*/React__default.default.createElement("span", {
|
|
137
148
|
"data-testid": "".concat(testId, "-threshold-label")
|
|
138
|
-
},
|
|
149
|
+
}, displayLabel)), /*#__PURE__*/React__default.default.createElement("div", {
|
|
139
150
|
className: "".concat(BEM_BASE)
|
|
140
151
|
}, /*#__PURE__*/React__default.default.createElement(ValueRenderer, {
|
|
141
152
|
value: value,
|
|
@@ -311,6 +322,31 @@ Attribute.__docgenInfo = {
|
|
|
311
322
|
},
|
|
312
323
|
"required": false
|
|
313
324
|
},
|
|
325
|
+
"shouldUseTranslatedLabels": {
|
|
326
|
+
"defaultValue": {
|
|
327
|
+
"value": "false",
|
|
328
|
+
"computed": false
|
|
329
|
+
},
|
|
330
|
+
"description": "whether to use translated labels in cards",
|
|
331
|
+
"type": {
|
|
332
|
+
"name": "bool"
|
|
333
|
+
},
|
|
334
|
+
"required": false
|
|
335
|
+
},
|
|
336
|
+
"i18n": {
|
|
337
|
+
"defaultValue": {
|
|
338
|
+
"value": "{}",
|
|
339
|
+
"computed": false
|
|
340
|
+
},
|
|
341
|
+
"description": "",
|
|
342
|
+
"type": {
|
|
343
|
+
"name": "objectOf",
|
|
344
|
+
"value": {
|
|
345
|
+
"name": "any"
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"required": false
|
|
349
|
+
},
|
|
314
350
|
"testId": {
|
|
315
351
|
"defaultValue": {
|
|
316
352
|
"value": "'attribute'",
|
|
@@ -30,7 +30,7 @@ var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWith
|
|
|
30
30
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
31
31
|
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
32
32
|
|
|
33
|
-
var _excluded = ["title", "content", "size", "values", "isEditable", "isResizable", "i18n", "dataState", "id", "locale", "customFormatter", "children", "fontSize", "isNumberValueCompact", "testID", "testId", "onAttributeClick", "className"];
|
|
33
|
+
var _excluded = ["title", "content", "size", "values", "isEditable", "isResizable", "i18n", "dataState", "id", "locale", "customFormatter", "children", "fontSize", "isNumberValueCompact", "testID", "testId", "onAttributeClick", "className", "shouldUseTranslatedLabels"];
|
|
34
34
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
35
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
36
36
|
|
|
@@ -59,6 +59,7 @@ var ValueCard = function ValueCard(_ref) {
|
|
|
59
59
|
testId = _ref.testId,
|
|
60
60
|
onAttributeClick = _ref.onAttributeClick,
|
|
61
61
|
className = _ref.className,
|
|
62
|
+
shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
|
|
62
63
|
others = _objectWithoutProperties__default.default(_ref, _excluded);
|
|
63
64
|
var availableActions = _objectSpread({
|
|
64
65
|
expand: false
|
|
@@ -83,6 +84,7 @@ var ValueCard = function ValueCard(_ref) {
|
|
|
83
84
|
isResizable: isResizable,
|
|
84
85
|
resizeHandles: resizeHandles,
|
|
85
86
|
i18n: i18n,
|
|
87
|
+
shouldUseTranslatedLabels: shouldUseTranslatedLabels,
|
|
86
88
|
locale: locale,
|
|
87
89
|
id: id,
|
|
88
90
|
className: classnames__default.default(className, _defineProperty__default.default(_defineProperty__default.default({}, "".concat(valueCardUtils.BASE_CLASS_NAME, "__horizontal"), layout === LayoutConstants.CARD_LAYOUTS.HORIZONTAL), "".concat(valueCardUtils.BASE_CLASS_NAME, "__vertical"), layout === LayoutConstants.CARD_LAYOUTS.VERTICAL))
|
|
@@ -103,7 +105,9 @@ var ValueCard = function ValueCard(_ref) {
|
|
|
103
105
|
values: values,
|
|
104
106
|
isEditable: isEditable,
|
|
105
107
|
fontSize: fontSize,
|
|
106
|
-
isNumberValueCompact: isNumberValueCompact
|
|
108
|
+
isNumberValueCompact: isNumberValueCompact,
|
|
109
|
+
i18n: i18n,
|
|
110
|
+
shouldUseTranslatedLabels: shouldUseTranslatedLabels
|
|
107
111
|
}, others)), resizeHandles);
|
|
108
112
|
};
|
|
109
113
|
ValueCard.propTypes = _objectSpread(_objectSpread({}, CardPropTypes.CardPropTypes), CardPropTypes.ValueContentPropTypes);
|
|
@@ -119,7 +123,8 @@ ValueCard.defaultProps = {
|
|
|
119
123
|
isNumberValueCompact: false,
|
|
120
124
|
// TODO: fix this default in V3, so that cards are unique not inherited from the base Card
|
|
121
125
|
testId: 'Card',
|
|
122
|
-
onAttributeClick: null
|
|
126
|
+
onAttributeClick: null,
|
|
127
|
+
shouldUseTranslatedLabels: false
|
|
123
128
|
};
|
|
124
129
|
ValueCard.__docgenInfo = {
|
|
125
130
|
"description": "This components responsibilities include:\nRendering the attribute groups\nDetermining the layout\ndetermines the data to render",
|
|
@@ -195,6 +200,13 @@ ValueCard.__docgenInfo = {
|
|
|
195
200
|
"computed": false
|
|
196
201
|
},
|
|
197
202
|
"required": false
|
|
203
|
+
},
|
|
204
|
+
"shouldUseTranslatedLabels": {
|
|
205
|
+
"defaultValue": {
|
|
206
|
+
"value": "false",
|
|
207
|
+
"computed": false
|
|
208
|
+
},
|
|
209
|
+
"required": false
|
|
198
210
|
}
|
|
199
211
|
},
|
|
200
212
|
"composes": ["../../constants/CardPropTypes"]
|
|
@@ -30,7 +30,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
30
30
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
31
31
|
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
32
32
|
|
|
33
|
-
var _excluded = ["id", "title", "content", "values", "layout", "dataState", "locale", "isEditable", "customFormatter", "fontSize", "isNumberValueCompact", "testId", "onAttributeClick", "size"];
|
|
33
|
+
var _excluded = ["id", "title", "content", "values", "layout", "dataState", "locale", "isEditable", "shouldUseTranslatedLabels", "customFormatter", "fontSize", "isNumberValueCompact", "testId", "onAttributeClick", "size"];
|
|
34
34
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
35
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
36
36
|
var propTypes = _objectSpread({
|
|
@@ -38,7 +38,9 @@ var propTypes = _objectSpread({
|
|
|
38
38
|
title: PropTypes__default.default.string,
|
|
39
39
|
layout: PropTypes__default.default.oneOf(['HORIZONTAL', 'VERTICAL']),
|
|
40
40
|
locale: PropTypes__default.default.string,
|
|
41
|
-
isEditable: PropTypes__default.default.bool
|
|
41
|
+
isEditable: PropTypes__default.default.bool,
|
|
42
|
+
/** whether to use translated labels in cards */
|
|
43
|
+
shouldUseTranslatedLabels: PropTypes__default.default.bool
|
|
42
44
|
}, CardPropTypes.ValueContentPropTypes);
|
|
43
45
|
var defaultProps = {
|
|
44
46
|
id: 'valueContent-id',
|
|
@@ -46,6 +48,7 @@ var defaultProps = {
|
|
|
46
48
|
layout: 'VERTICAL',
|
|
47
49
|
locale: 'en',
|
|
48
50
|
isEditable: false,
|
|
51
|
+
shouldUseTranslatedLabels: false,
|
|
49
52
|
dataState: null,
|
|
50
53
|
values: null,
|
|
51
54
|
fontSize: valueCardUtils.DEFAULT_FONT_SIZE,
|
|
@@ -64,6 +67,7 @@ var ValueContent = function ValueContent(_ref) {
|
|
|
64
67
|
dataState = _ref.dataState,
|
|
65
68
|
locale = _ref.locale,
|
|
66
69
|
isEditable = _ref.isEditable,
|
|
70
|
+
shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
|
|
67
71
|
customFormatter = _ref.customFormatter,
|
|
68
72
|
fontSize = _ref.fontSize,
|
|
69
73
|
isNumberValueCompact = _ref.isNumberValueCompact,
|
|
@@ -83,6 +87,8 @@ var ValueContent = function ValueContent(_ref) {
|
|
|
83
87
|
locale: locale,
|
|
84
88
|
isEditable: isEditable,
|
|
85
89
|
title: title,
|
|
90
|
+
shouldUseTranslatedLabels: shouldUseTranslatedLabels,
|
|
91
|
+
i18n: others.i18n,
|
|
86
92
|
renderIconByName: others.renderIconByName,
|
|
87
93
|
value: valueCardUtils.determineValue(attribute.dataSourceId, values, attribute.dataFilter),
|
|
88
94
|
secondaryValue: attribute.secondaryValue && _objectSpread(_objectSpread({}, attribute.secondaryValue), {}, {
|
|
@@ -170,6 +176,17 @@ ValueContent.__docgenInfo = {
|
|
|
170
176
|
},
|
|
171
177
|
"required": false
|
|
172
178
|
},
|
|
179
|
+
"shouldUseTranslatedLabels": {
|
|
180
|
+
"defaultValue": {
|
|
181
|
+
"value": "false",
|
|
182
|
+
"computed": false
|
|
183
|
+
},
|
|
184
|
+
"description": "whether to use translated labels in cards",
|
|
185
|
+
"type": {
|
|
186
|
+
"name": "bool"
|
|
187
|
+
},
|
|
188
|
+
"required": false
|
|
189
|
+
},
|
|
173
190
|
"dataState": {
|
|
174
191
|
"defaultValue": {
|
|
175
192
|
"value": "null",
|
|
@@ -172,6 +172,8 @@ var TableCardPropTypes = {
|
|
|
172
172
|
defaultFilterStringPlaceholdText: PropTypes__default.default.string,
|
|
173
173
|
downloadIconDescription: PropTypes__default.default.string
|
|
174
174
|
}),
|
|
175
|
+
/** whether to use translated labels in cards */
|
|
176
|
+
shouldUseTranslatedLabels: PropTypes__default.default.bool,
|
|
175
177
|
cardVariables: PropTypes__default.default.objectOf(PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.func, PropTypes__default.default.number, PropTypes__default.default.bool])),
|
|
176
178
|
/** default date format pattern that follows the dayjs formatting patterns */
|
|
177
179
|
defaultDateFormatPattern: PropTypes__default.default.string
|
|
@@ -6,6 +6,7 @@ var _typeof = require('@babel/runtime/helpers/typeof');
|
|
|
6
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
7
|
var mapValues = require('../packages/react/node_modules/lodash-es/mapValues.js');
|
|
8
8
|
var isNil = require('../packages/react/node_modules/lodash-es/isNil.js');
|
|
9
|
+
var isEmpty = require('../packages/react/node_modules/lodash-es/isEmpty.js');
|
|
9
10
|
require('core-js/modules/es.symbol.js');
|
|
10
11
|
require('core-js/modules/es.array.concat.js');
|
|
11
12
|
require('core-js/modules/es.array.filter.js');
|
|
@@ -584,6 +585,20 @@ var isTimeBasedCard = function isTimeBasedCard(card) {
|
|
|
584
585
|
})) || ((_card$content2 = card.content) === null || _card$content2 === void 0 ? void 0 : _card$content2.type) === LayoutConstants.BAR_CHART_TYPES.SIMPLE && ((_card$content3 = card.content) === null || _card$content3 === void 0 ? void 0 : _card$content3.timeDataSourceId) || ((_card$content4 = card.content) === null || _card$content4 === void 0 ? void 0 : _card$content4.type) === LayoutConstants.BAR_CHART_TYPES.STACKED && ((_card$content5 = card.content) === null || _card$content5 === void 0 ? void 0 : _card$content5.timeDataSourceId);
|
|
585
586
|
};
|
|
586
587
|
|
|
588
|
+
/**
|
|
589
|
+
* Get translated label or title from i18n object, fallback to original if not found
|
|
590
|
+
* @param {string} label - The label or title key to translate
|
|
591
|
+
* @param {boolean} shouldUseTranslatedLabels - Flag to determine if translation should be used
|
|
592
|
+
* @param {Object} i18n - The i18n object containing translations
|
|
593
|
+
* @returns {string} - The translated label or original label if translation not found
|
|
594
|
+
*/
|
|
595
|
+
var getTranslatedLabel = function getTranslatedLabel(label, shouldUseTranslatedLabels, i18n) {
|
|
596
|
+
if (!isEmpty(label) && shouldUseTranslatedLabels && i18n && i18n[label]) {
|
|
597
|
+
return i18n[label];
|
|
598
|
+
}
|
|
599
|
+
return label;
|
|
600
|
+
};
|
|
601
|
+
|
|
587
602
|
exports.chartValueFormatter = chartValueFormatter;
|
|
588
603
|
exports.compareGrains = compareGrains;
|
|
589
604
|
exports.determineCardRange = determineCardRange;
|
|
@@ -594,6 +609,7 @@ exports.findMatchingThresholds = findMatchingThresholds;
|
|
|
594
609
|
exports.formatNumberWithPrecision = formatNumberWithPrecision;
|
|
595
610
|
exports.getCardVariables = getCardVariables;
|
|
596
611
|
exports.getResizeHandles = getResizeHandles;
|
|
612
|
+
exports.getTranslatedLabel = getTranslatedLabel;
|
|
597
613
|
exports.getUpdatedCardSize = getUpdatedCardSize;
|
|
598
614
|
exports.getVariables = getVariables;
|
|
599
615
|
exports.handleCardVariables = handleCardVariables;
|