Skip to content

Commit

Permalink
Fixed default selection for treemap
Browse files Browse the repository at this point in the history
Signed-off-by: Mrunal Zambre <[email protected]>
  • Loading branch information
mrunal-z committed Jun 8, 2022
1 parent 9768259 commit 7536d93
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,9 @@ exports[`Config panel component Renders config panel with visualization data 1`]
"isSingleSelection": true,
"mapTo": "parentField",
"name": "Parent Field",
"props": Object {
"isInvalid": false,
},
},
Object {
"component": null,
Expand Down Expand Up @@ -1042,6 +1045,9 @@ exports[`Config panel component Renders config panel with visualization data 1`]
"value": "dice-slice",
},
],
"props": Object {
"isClearable": false,
},
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const ConfigPanel = ({ visualizations, setCurVisId, callback, changeIsVal
useEffect(() => {
setVizConfigs({
...userConfigs,
dataConfig: { ...vizConfigs.dataConfig, ...(userConfigs?.dataConfig ? userConfigs.dataConfig : getDefaultAxisSelected()) },
dataConfig: { ...(userConfigs?.dataConfig ? userConfigs.dataConfig : getDefaultAxisSelected()) },
layoutConfig: userConfigs?.layoutConfig
? hjson.stringify({ ...userConfigs.layoutConfig }, HJSON_STRINGIFY_OPTIONS)
: getDefaultSpec(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export const PanelItem = ({
selectedAxis,
dropdownList,
onSelectChange,
isInvalid,
isSingleSelection = false,
isClearable = true,
}: any) => {
const options = dropdownList.map((item) => {
return {
Expand All @@ -32,7 +34,8 @@ export const PanelItem = ({
placeholder="Select a field"
options={options}
selectedOptions={selectedAxis}
isInvalid={isEmpty(selectedAxis)}
isInvalid={isInvalid ?? isEmpty(selectedAxis)}
isClearable={isClearable}
singleSelection={isSingleSelection}
onChange={onSelectChange}
aria-label="Use aria labels when no actual label is in use"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export const createTreeMapDefinition = (params: BarTypeParams = {}) => ({
isSingleSelection: true,
component: null,
mapTo: 'parentField',
props: {
isInvalid: false,
}
},
{
name: 'Value Field',
Expand Down Expand Up @@ -90,6 +93,9 @@ export const createTreeMapDefinition = (params: BarTypeParams = {}) => ({
{ name: 'Dice Slice', value: 'dice-slice' },
],
defaultState: [{ name: 'Squarify', label: 'Squarify', value: 'squarify' }],
props: {
isClearable: false,
}
},
],
},
Expand Down

0 comments on commit 7536d93

Please sign in to comment.