Skip to content

Commit

Permalink
fix(metadata): editor did not allow some metadata properties to be ad…
Browse files Browse the repository at this point in the history
…ded (Fixes #165 )
  • Loading branch information
danielweck committed Aug 1, 2023
1 parent e05a6bf commit 1541d1a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/renderer/components/MetaDataEditorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ class MetaDataEditorModal extends React.Component {
const doMultipleSelect = (mdObj.allowedValues && isAccessModeSufficient) ? mdObj : null;
const doSingleSelect = (mdObj.allowedValues && !isAccessModeSufficient) ? mdObj : null;

// for doSingleSelect (mdObj.allowedValues && !isAccessModeSufficient)
const renderSingleSelect = () => {
const doSingleSelectCustom = isConformsTo;

Expand All @@ -628,15 +629,17 @@ class MetaDataEditorModal extends React.Component {

value={mdObj}

options={mdObj.allowedValues.map(allowedValue => {
options={mdObj.allowedValues ? mdObj.allowedValues.map(allowedValue => {
return {
content: allowedValue,
index: mdObj.index,
};
})}
}) : undefined}

getOptionSelected={
(option, value) => {
// console.log("getOptionSelected 1", JSON.stringify(option, null, 4));
// console.log("getOptionSelected 2", JSON.stringify(value, null, 4));
return value.content === option.content;
}
}
Expand Down Expand Up @@ -745,7 +748,7 @@ class MetaDataEditorModal extends React.Component {
label={mdObj.name} variant="outlined" />
}

freeSolo={doSingleSelectCustom}
freeSolo={/* !mdObj.allowedValues || */ doSingleSelectCustom}
disableClearable={false}
includeInputInList={false}
disableListWrap={true}
Expand All @@ -759,6 +762,7 @@ class MetaDataEditorModal extends React.Component {
/>);
};

// for doMultipleSelect (mdObj.allowedValues && isAccessModeSufficient)
const renderMultipleSelect = () => {
// return <></>;
// data-name={mdObj.name}
Expand Down Expand Up @@ -890,6 +894,7 @@ class MetaDataEditorModal extends React.Component {
/>);
};

// for all but doSingleSelect and doMultipleSelect ((mdObj.allowedValues && isAccessModeSufficient) and (mdObj.allowedValues && !isAccessModeSufficient))
const renderBasicInput = () => {
// data-mdindex={mdObj.index}
// inputProps={{"data-mdindex": `${mdObj.index}`}}
Expand Down Expand Up @@ -1100,7 +1105,7 @@ class MetaDataEditorModal extends React.Component {
});
}}>
{
a11yMeta.filter((name) => (name in A11Y_META) && !A11Y_META[name].discouraged).map((a, i) => {
a11yMeta.filter((name) => !(name in A11Y_META) || !A11Y_META[name].discouraged).map((a, i) => {
return <MenuItem key={`select_option_${i}`} value={a}>{a}</MenuItem>;
})
}
Expand Down

0 comments on commit 1541d1a

Please sign in to comment.