Skip to content

Commit

Permalink
Merge branch 'master' into fix/dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 26, 2023
2 parents b2fa0ac + 7e7ed36 commit 4c79eef
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -40,7 +39,7 @@ const AttributeSelector = (props) => {
<NodeDefIconKey nodeDef={nodeDef} />
{NodeDef.getLabelWithType({ nodeDef, lang, type: nodeDefLabelType })}
</span>
{NodeDefUIProps.getIconByType(nodeDefType)}
{NodeDefUIProps.getIconByNodeDef(nodeDef)}
</button>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -21,6 +22,7 @@ const AttributesSelector = (props) => {
lang,
ancestorSelector,
nodeDefLabelType,
nodeDefUuidsToExclude,
nodeDefUuidEntity,
nodeDefUuidsAttributes,
onToggleAttribute,
Expand Down Expand Up @@ -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) &&
Expand Down Expand Up @@ -95,6 +98,7 @@ const AttributesSelector = (props) => {
ancestorSelector
nodeDefUuidEntity={NodeDef.getUuid(nodeDefAncestor)}
nodeDefUuidsAttributes={nodeDefUuidsAttributes}
nodeDefUuidsToExclude={[NodeDef.getUuid(nodeDefContext)]}
onToggleAttribute={onToggleAttribute}
filterFunction={filterFunction}
filterTypes={filterTypes}
Expand All @@ -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,
Expand All @@ -139,6 +144,7 @@ AttributesSelector.defaultProps = {
filterChainUuids: [],
nodeDefUuidEntity: null,
nodeDefUuidsAttributes: [],
nodeDefUuidsToExclude: [],
showAnalysisAttributes: false,
showAncestors: true,
showAncestorsLabel: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const NodeDefsSelector = (props) => {
showAnalysisAttributes={showAnalysisAttributes}
showAncestors={showAncestors}
showMultipleAttributes={showMultipleAttributes}
showSiblingsInSingleEntities={true}
showSiblingsInSingleEntities
nodeDefLabelType={nodeDefLabelType}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ const NodeDefsSelectorAggregate = (props) => {
nodeDefLabelType={nodeDefLabelType}
nodeDefUuidEntity={nodeDefUuidEntity}
nodeDefUuidsAttributes={dimensions}
showAnalysisAttributes={showAnalysisAttributes}
showAncestorsLabel={false}
showMultipleAttributes={false}
showAnalysisAttributes={showAnalysisAttributes}
showSiblingsInSingleEntities
/>
</ExpansionPanel>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ const getProp = (prop, defaultValue = null) => R.pipe(NodeDef.getType, getPropBy

export const getIconByType = getPropByType('icon')

export const getIconByNodeDef = (nodeDef) => (
<div className="node-def__icon-wrapper">
{NodeDef.isMultiple(nodeDef) && <span title="Multiple">M</span>}
{getIconByType(NodeDef.getType(nodeDef))}
</div>
)

export const getNumberFormat = (nodeDef) =>
NodeDef.isDecimal(nodeDef)
? NumberFormats.decimal({ decimalScale: NodeDef.getMaxNumberDecimalDigits(nodeDef) })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ const DimensionGroup = ({ dimensionGroup }) => {
<p>
<button
type="button"
className={classNames('btn-xs btn-toggle', {
'': !visible,
rotate: visible,
})}
className={classNames('btn-xs btn-toggle', { rotate: visible })}
onClick={() => setVisible(!visible)}
>
<span className={classNames('icon icon-12px icon-play3')} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
.charts_data-selector_dimension {
justify-content: space-between;
display: flex;
flex-direction: row;
align-items: center;
margin: 2px 0px;
.icon-left {
font-size: 12px !important;
}
.icon {
font-size: 12px !important;

.icon-wrapper {
display: flex;
align-items: center;
gap: 4px;

.icon {
font-size: 12px !important;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ import React, { useCallback, useMemo } from 'react'
import { uuidv4 } from '@core/uuid'

import { Dropdown } from '@webapp/components/form'
import * as NodeDefUIProps from '@webapp/components/survey/SurveyForm/nodeDefs/nodeDefUIProps'
import { NodeDefType } from '@openforis/arena-core'

const icons = {
quantitative: <span className="icon-left node_def__icon">1.23</span>,
nominal: (
<span className="icon-left display-flex">
{[0, 1, 2].map((i) => (
<span key={i} className="icon icon-text-color" style={{ margin: '0 -3px' }} />
))}
</span>
),
temporal: <span className="icon icon-clock icon-left" />,
quantitative: NodeDefUIProps.getIconByType(NodeDefType.decimal),
nominal: NodeDefUIProps.getIconByType(NodeDefType.text),
temporal: NodeDefUIProps.getIconByType(NodeDefType.time),
}

const useOptionsAndDefaultValues = ({ block, dimensions }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ const baseDimension = ({ nodeDef, language, nodeDefLabelType }) => ({
name: NodeDef.getName(nodeDef),
value: NodeDef.getName(nodeDef),
label: NodeDef.getLabel(nodeDef, language, nodeDefLabelType),
icon: NodeDefUIProps.getIconByType(NodeDef.getType(nodeDef)),
icon: NodeDefUIProps.getIconByNodeDef(nodeDef),
type: vegaTypes.nominal,
sourceMultiple: NodeDef.isMultiple(nodeDef),
})

const baseParser = ({ nodeDef, language, nodeDefLabelType }) => {
Expand Down

0 comments on commit 4c79eef

Please sign in to comment.