@sis-cc/dotstatsuite-components 13.0.3 → 13.0.4
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.
|
@@ -28,9 +28,10 @@ var _isEmpty3 = _interopRequireDefault(_isEmpty2);
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
30
30
|
var dimensionValueDisplay = exports.dimensionValueDisplay = function dimensionValueDisplay(display) {
|
|
31
|
+
var accessors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
31
32
|
return function (dimensionValue) {
|
|
32
|
-
var id = (0, _get3.default)(dimensionValue, 'id', '');
|
|
33
|
-
var name = (0, _get3.default)(dimensionValue, 'name', '');
|
|
33
|
+
var id = (0, _get3.default)(dimensionValue, accessors.id || 'id', '');
|
|
34
|
+
var name = (0, _get3.default)(dimensionValue, accessors.name || 'name', '');
|
|
34
35
|
switch (display) {
|
|
35
36
|
case 'label':
|
|
36
37
|
return (0, _isEmpty3.default)(name) ? '[' + id + ']' : name;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isEmpty, isNil, get, has, reduce } from 'lodash';
|
|
2
2
|
|
|
3
|
-
export const dimensionValueDisplay = (display) => (dimensionValue) => {
|
|
4
|
-
const id = get(dimensionValue, 'id', '');
|
|
5
|
-
const name = get(dimensionValue, 'name', '');
|
|
3
|
+
export const dimensionValueDisplay = (display, accessors = {}) => (dimensionValue) => {
|
|
4
|
+
const id = get(dimensionValue, accessors.id || 'id', '');
|
|
5
|
+
const name = get(dimensionValue, accessors.name || 'name', '');
|
|
6
6
|
switch(display) {
|
|
7
7
|
case 'label':
|
|
8
8
|
return isEmpty(name) ? `[${id}]` : name;
|