Files
nebula.js/apis/supernova/src/handler/utils/handler-helper.js
Donya MashaallahPoor 7603c9b0fd refactor: add hypercube generic functions - part01 (#1716)
* chore: add hypercube generic functions - part01
2025-04-22 10:17:40 +02:00

33 lines
866 B
JavaScript

// eslint-disable-next-line import/no-relative-packages
import getValue from '../../../../conversion/src/utils';
export const getFieldById = (fields, id) => fields.find((field) => field.qDef?.cId === id) || null;
export const setFieldProperties = (hcFieldProperties) => {
if (!hcFieldProperties) {
return [];
}
const updatedProperties = [...hcFieldProperties];
return updatedProperties.map((field) => {
if (field.qDef?.autoSort && field.autoSort !== undefined) {
return {
...field,
qDef: {
...field.qDef,
autoSort: field.autoSort,
},
autoSort: undefined,
};
}
return field;
});
};
export const getHyperCube = (layout, path) => {
if (!layout) {
return undefined;
}
return path && getValue(layout, path) ? getValue(layout, path).qHyperCube : layout.qHyperCube;
};