diff --git a/scripts/apps/vocabularies/controllers/VocabularyEditController.tsx b/scripts/apps/vocabularies/controllers/VocabularyEditController.tsx index badd5300d3..ed0db373e0 100644 --- a/scripts/apps/vocabularies/controllers/VocabularyEditController.tsx +++ b/scripts/apps/vocabularies/controllers/VocabularyEditController.tsx @@ -226,7 +226,7 @@ export function VocabularyEditController( const fields = getFields(); - $scope.customFieldTypes = Object.keys(fields).map((id) => ({ + $scope.customFieldTypes = Object.keys(fields).filter((id) => fields[id].private !== true).map((id) => ({ id: id, label: fields[id].label, })); diff --git a/scripts/core/superdesk-api.d.ts b/scripts/core/superdesk-api.d.ts index 6c8e7d217f..46c0c1e0d0 100644 --- a/scripts/core/superdesk-api.d.ts +++ b/scripts/core/superdesk-api.d.ts @@ -3359,6 +3359,10 @@ declare module 'superdesk-api' { editorComponent: React.ComponentClass>; previewComponent: React.ComponentType>; + /** + * Allows for the field to be hidden from custom field type config + */ + private?: boolean; /** * Must return `true` if not empty. */ diff --git a/scripts/extensions/broadcasting/src/authoring-fields/subitems/index.tsx b/scripts/extensions/broadcasting/src/authoring-fields/subitems/index.tsx index e76a2771e0..db51b12c17 100644 --- a/scripts/extensions/broadcasting/src/authoring-fields/subitems/index.tsx +++ b/scripts/extensions/broadcasting/src/authoring-fields/subitems/index.tsx @@ -17,15 +17,21 @@ export type ISubitemsValueOperational = Array; export type ISubitemsValueStorage = ISubitemsValueOperational; export type ISubitemsFieldConfig = never; export type ISubitemsUserPreferences = never; +export type ISubItemsFieldType = ICustomFieldType< + ISubitemsValueOperational, + ISubitemsValueStorage, + ISubitemsFieldConfig, + ISubitemsUserPreferences +>; -export function getSubItemsField() -: ICustomFieldType { +export function getSubItemsField(): ISubItemsFieldType { const field: ReturnType = { id: SUBITEMS_FIELD_TYPE, label: gettext('Subitems'), editorComponent: Editor, previewComponent: Preview, + private: true, hasValue: (valueOperational) => valueOperational != null && Object.keys(valueOperational).length > 0, getEmptyValue: () => [],