mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 17:58:43 -05:00
33 lines
866 B
JavaScript
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;
|
|
};
|