diff --git a/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributeSelector.js b/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributeSelector.js index ccc6be151e..a95c596daf 100644 --- a/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributeSelector.js +++ b/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributeSelector.js @@ -19,7 +19,6 @@ const AttributeSelector = (props) => { const lang = useSurveyPreferredLang() const nodeDefUuid = NodeDef.getUuid(nodeDef) - const nodeDefType = NodeDef.getType(nodeDef) const active = R.includes(nodeDefUuid, nodeDefUuidsAttributes) return ( @@ -40,7 +39,7 @@ const AttributeSelector = (props) => { {NodeDef.getLabelWithType({ nodeDef, lang, type: nodeDefLabelType })} - {NodeDefUIProps.getIconByType(nodeDefType)} + {NodeDefUIProps.getIconByNodeDef(nodeDef)} ) } diff --git a/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributeSelector.scss b/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributeSelector.scss index a91d14947d..70df21cc17 100644 --- a/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributeSelector.scss +++ b/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributeSelector.scss @@ -18,9 +18,14 @@ font-size: 11px !important; } - .node_def__icon { - font-size: 9px; - font-weight: 600; - letter-spacing: 0; + .node-def__icon-wrapper { + display: flex; + gap: 2px; + + .node_def__icon { + font-size: 9px; + font-weight: 600; + letter-spacing: 0; + } } } diff --git a/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributesSelector.js b/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributesSelector.js index a3efa22f7a..d7e2c7fd3a 100644 --- a/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributesSelector.js +++ b/webapp/components/survey/NodeDefsSelector/AttributesSelector/AttributesSelector.js @@ -1,16 +1,17 @@ import './AttributesSelector.scss' import React from 'react' import * as PropTypes from 'prop-types' +import classNames from 'classnames' import * as Survey from '@core/survey/survey' import * as NodeDef from '@core/survey/nodeDef' import { useSurvey, useSurveyCycleKey } from '@webapp/store/survey' +import { useAuthCanUseAnalysis } from '@webapp/store/user' import ExpansionPanel from '@webapp/components/expansionPanel' + import AttributeSelector from './AttributeSelector' -import { useAuthCanUseAnalysis } from '@webapp/store/user' -import classNames from 'classnames' const AttributesSelector = (props) => { const { @@ -21,6 +22,7 @@ const AttributesSelector = (props) => { lang, ancestorSelector, nodeDefLabelType, + nodeDefUuidsToExclude, nodeDefUuidEntity, nodeDefUuidsAttributes, onToggleAttribute, @@ -61,6 +63,7 @@ const AttributesSelector = (props) => { } const isNodeDefVisible = (nodeDef) => + !nodeDefUuidsToExclude.includes(NodeDef.getUuid(nodeDef)) && ((NodeDef.isAttribute(nodeDef) && (showMultipleAttributes || NodeDef.isSingle(nodeDef))) || NodeDef.isEqual(nodeDef)(nodeDefContext)) && NodeDef.getCycles(nodeDef).includes(cycle) && @@ -95,6 +98,7 @@ const AttributesSelector = (props) => { ancestorSelector nodeDefUuidEntity={NodeDef.getUuid(nodeDefAncestor)} nodeDefUuidsAttributes={nodeDefUuidsAttributes} + nodeDefUuidsToExclude={[NodeDef.getUuid(nodeDefContext)]} onToggleAttribute={onToggleAttribute} filterFunction={filterFunction} filterTypes={filterTypes} @@ -121,6 +125,7 @@ AttributesSelector.propTypes = { lang: PropTypes.string.isRequired, nodeDefUuidEntity: PropTypes.string, nodeDefUuidsAttributes: PropTypes.array, + nodeDefUuidsToExclude: PropTypes.array, onToggleAttribute: PropTypes.func.isRequired, showAncestors: PropTypes.bool, showLabel: PropTypes.bool, @@ -139,6 +144,7 @@ AttributesSelector.defaultProps = { filterChainUuids: [], nodeDefUuidEntity: null, nodeDefUuidsAttributes: [], + nodeDefUuidsToExclude: [], showAnalysisAttributes: false, showAncestors: true, showAncestorsLabel: true, diff --git a/webapp/components/survey/NodeDefsSelector/NodeDefsSelector.js b/webapp/components/survey/NodeDefsSelector/NodeDefsSelector.js index 0e20dda18b..4382ba15b4 100644 --- a/webapp/components/survey/NodeDefsSelector/NodeDefsSelector.js +++ b/webapp/components/survey/NodeDefsSelector/NodeDefsSelector.js @@ -106,7 +106,7 @@ const NodeDefsSelector = (props) => { showAnalysisAttributes={showAnalysisAttributes} showAncestors={showAncestors} showMultipleAttributes={showMultipleAttributes} - showSiblingsInSingleEntities={true} + showSiblingsInSingleEntities nodeDefLabelType={nodeDefLabelType} /> )} diff --git a/webapp/components/survey/NodeDefsSelector/NodeDefsSelectorAggregate.js b/webapp/components/survey/NodeDefsSelector/NodeDefsSelectorAggregate.js index 2e6cda2e66..4931532a17 100644 --- a/webapp/components/survey/NodeDefsSelector/NodeDefsSelectorAggregate.js +++ b/webapp/components/survey/NodeDefsSelector/NodeDefsSelectorAggregate.js @@ -98,9 +98,10 @@ const NodeDefsSelectorAggregate = (props) => { nodeDefLabelType={nodeDefLabelType} nodeDefUuidEntity={nodeDefUuidEntity} nodeDefUuidsAttributes={dimensions} + showAnalysisAttributes={showAnalysisAttributes} showAncestorsLabel={false} showMultipleAttributes={false} - showAnalysisAttributes={showAnalysisAttributes} + showSiblingsInSingleEntities /> diff --git a/webapp/components/survey/SurveyForm/nodeDefs/nodeDefUIProps.js b/webapp/components/survey/SurveyForm/nodeDefs/nodeDefUIProps.js index ced4603b07..6e58496786 100644 --- a/webapp/components/survey/SurveyForm/nodeDefs/nodeDefUIProps.js +++ b/webapp/components/survey/SurveyForm/nodeDefs/nodeDefUIProps.js @@ -132,6 +132,13 @@ const getProp = (prop, defaultValue = null) => R.pipe(NodeDef.getType, getPropBy export const getIconByType = getPropByType('icon') +export const getIconByNodeDef = (nodeDef) => ( +
+ {NodeDef.isMultiple(nodeDef) && M} + {getIconByType(NodeDef.getType(nodeDef))} +
+) + export const getNumberFormat = (nodeDef) => NodeDef.isDecimal(nodeDef) ? NumberFormats.decimal({ decimalScale: NodeDef.getMaxNumberDecimalDigits(nodeDef) }) diff --git a/webapp/views/App/views/Data/Charts/components/DataSelector/DataSelector.js b/webapp/views/App/views/Data/Charts/components/DataSelector/DataSelector.js index 9bfc2c52f0..4f79d21fba 100644 --- a/webapp/views/App/views/Data/Charts/components/DataSelector/DataSelector.js +++ b/webapp/views/App/views/Data/Charts/components/DataSelector/DataSelector.js @@ -20,10 +20,7 @@ const DimensionGroup = ({ dimensionGroup }) => {