diff --git a/client/components/fields/editor/CustomVocabularies.tsx b/client/components/fields/editor/CustomVocabularies.tsx index 0da3eb9a0..39ae1ba2d 100644 --- a/client/components/fields/editor/CustomVocabularies.tsx +++ b/client/components/fields/editor/CustomVocabularies.tsx @@ -6,7 +6,6 @@ import {superdeskApi} from '../../../superdeskApi'; import {IEditorFieldProps, IProfileSchemaTypeList} from '../../../interfaces'; import {Row} from '../../UI/Form'; import {getVocabularyItemFieldTranslated} from '../../../utils/vocabularies'; -import {arrayToTree} from 'superdesk-core/scripts/core/helpers/tree'; import {TreeSelect} from 'superdesk-ui-framework/react'; export interface ICustomVocabulariesProps extends IEditorFieldProps { @@ -61,7 +60,7 @@ class CustomVocabulariesComponent extends React.PureComponent { value={(item.subject ?? []).filter((x) => x.scheme === cv._id)} label={gettext(cv.display_name)} required={required ?? schema?.required} - getOptions={() => arrayToTree( + getOptions={() => superdeskApi.utilities.arrayToTree( cv.items.map((cvItem) => ({ ...cvItem, scheme: cv._id, diff --git a/client/components/planning-editor-standalone/profile.ts b/client/components/planning-editor-standalone/profile.ts index 1b6b6c380..15595cbef 100644 --- a/client/components/planning-editor-standalone/profile.ts +++ b/client/components/planning-editor-standalone/profile.ts @@ -5,16 +5,18 @@ import { ICommonFieldConfig, IContentProfileV2, IDateTimeFieldConfig, + IDropdownConfigManualSource, IDropdownConfigVocabulary, IEditor3Config, IVocabularyItem, } from 'superdesk-api'; -import {superdeskApi} from '../../superdeskApi'; +import {planningApi, superdeskApi} from '../../superdeskApi'; import { IAttachmentsFieldConfig, } from '../../planning-extension/src/authoring-react-fields/planning-attachments/interfaces'; import {getCustomVocabularyFields} from './field-adapters/custom-vocabularies'; import {getPlanningProfileFields} from './profile-fields'; +import {IAgenda} from 'interfaces'; function getTextFieldConfig(options: {id: string; label: string, required: boolean}): IAuthoringFieldV2 { const editor3ConfigWithoutFormatting: IEditor3Config = { @@ -25,7 +27,6 @@ function getTextFieldConfig(options: {id: string; label: string, required: boole singleLine: true, disallowedCharacters: [], showStatistics: false, - width: 100, }; const field: IAuthoringFieldV2 = { @@ -172,7 +173,34 @@ export function getFieldDefinitions(): IFieldDefinitions { return field; }, - } + }, + { + fieldId: 'agendas', + getField: ({id, required}) => { + const fieldConfig: IDropdownConfigManualSource = { + source: 'manual-entry', + options: ((planningApi.redux.store.getState().agenda.agendas ?? []) as Array) + .filter((item) => item.is_enabled) + .map((item) => ({ + id: item._id, + label: item.name, + })), + roundCorners: true, + type: 'text', + multiple: true, + required: required, + }; + + const field: IAuthoringFieldV2 = { + id: id, + name: gettext('Agendas'), + fieldType: 'dropdown', + fieldConfig: fieldConfig, + }; + + return field; + }, + }, ]; result.push(