diff --git a/module-legacy/instance_skel_types.d.ts b/module-legacy/instance_skel_types.d.ts index 5de2039993..e103de0247 100644 --- a/module-legacy/instance_skel_types.d.ts +++ b/module-legacy/instance_skel_types.d.ts @@ -115,11 +115,12 @@ export type SomeCompanionInputField = | CompanionInputFieldTextWithVariablesInput | CompanionInputFieldDropdown | CompanionInputFieldMultiDropdown + | CompanionInputFieldMultiselect | CompanionInputFieldNumber | CompanionInputFieldCheckbox export interface CompanionInputField { id: string - type: 'text' | 'textinput' | 'textwithvariables' | 'dropdown' | 'colorpicker' | 'number' | 'checkbox' + type: 'text' | 'textinput' | 'textwithvariables' | 'dropdown' | 'colorpicker' | 'number' | 'checkbox' | 'multiselect' label: string tooltip?: string isVisible?: (options: any /*CompanionActionEvent | CompanionFeedbackEvent*/) => boolean // TODO - this varies based on where it is used, and in this current structure is not possible to type without breaking every module @@ -152,6 +153,7 @@ export interface CompanionInputFieldDropdown extends CompanionInputFieldDropdown regex?: string } export interface CompanionInputFieldMultiDropdown extends CompanionInputFieldDropdownBase { + type: 'dropdown' multiple: true default: ConfigValue[] @@ -172,6 +174,23 @@ export interface CompanionInputFieldDropdownBase extends CompanionInputField { /** The minimum number of entries the dropdown must have before it allows searching */ minChoicesForSearch?: number } + +export interface CompanionInputFieldMultiselect extends CompanionInputFieldDropdownBase { + type: 'multiselect' + default: ConfigValue[] + + required?: boolean + + choices: DropdownChoice[] + + /** The minimum number of selected values */ + minSelection?: number + /** The maximum number of selected values */ + maxSelection?: number + + /** The minimum number of entries the dropdown must have before it allows searching */ + minChoicesForSearch?: number +} export interface CompanionInputFieldCheckbox extends CompanionInputField { type: 'checkbox' default: boolean diff --git a/module-legacy/src/fakeSystem.ts b/module-legacy/src/fakeSystem.ts index 4fab6b273f..f388130226 100644 --- a/module-legacy/src/fakeSystem.ts +++ b/module-legacy/src/fakeSystem.ts @@ -121,7 +121,8 @@ export function convertInputField(input: SomeCompanionInputField): Complete>({ ...convertInputFieldBase(input), type: 'multidropdown',