Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable nested to-many in Workbench #6216

Open
wants to merge 12 commits into
base: issue-6127
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { batchEditText } from '../../localization/batchEdit';
import { commonText } from '../../localization/common';
import { interactionsText } from '../../localization/interactions';
import type { RA,RR } from '../../utils/types';
import type { RA, RR } from '../../utils/types';
import { H2, H3, Ul } from '../Atoms';
import { Button } from '../Atoms/Button';
import { Input, Label } from '../Atoms/Form';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,36 +99,41 @@ export function CatalogNumberFormatSelection({
)
.then((cots) => {
const formattersMap = filterArray(cots).reduce((map, cot) => {
const format = cot.get('catalogNumberFormatName') ?? schema.catalogNumFormatName;
const format =
cot.get('catalogNumberFormatName') ??
schema.catalogNumFormatName;
const cotName = cot.get('name');

if (!map.has(format)) {
map.set(format, {
name: format,
title: format,
isDefault: format === schema.catalogNumFormatName,
cotNames: []
cotNames: [],
});
}

const formatter = map.get(format)!;
map.set(format, {
...formatter,
cotNames: [...formatter.cotNames, cotName]
cotNames: [...formatter.cotNames, cotName],
});
return map;
}, new Map<string, FormatterWithCOTs>());

return Array.from(formattersMap.values(), ({ name, isDefault, cotNames }) => {
const title = queryText.formatInputAs({
commaSeparatedFormats: cotNames.join(', '),
});
return {
name,
title,
isDefault
};
});

return Array.from(
formattersMap.values(),
({ name, isDefault, cotNames }) => {
const title = queryText.formatInputAs({
commaSeparatedFormats: cotNames.join(', '),
});
return {
name,
title,
isDefault,
};
}
);
}),
[]
),
Expand Down Expand Up @@ -165,7 +170,7 @@ function FormatSelect({
readonly onChange: ((formatter: string | undefined) => void) | undefined;
}): JSX.Element | null {
const [formatterSelectIsOpen, setFormatterSelect] = React.useState(false);

const id = useId('formatters-selection');

return availableFormatters === undefined ? (
Expand Down
Loading
Loading