From d3c022ec8b5f3d8ba0cf18c3291576e4e6391ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yamanqui=20Garc=C3=ADa=20Rosales?= Date: Thu, 18 Sep 2025 09:31:03 -0700 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73693=20Google?= =?UTF-8?q?-Apps-Script:=20Added=20MultiSelect=20to=20SelectionInput=20by?= =?UTF-8?q?=20@YamanquiChacala?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yamanqui GarcĂ­a Rosales --- .../google-apps-script.card-service.d.ts | 83 +++++++++++++++---- .../test/google-apps-script-tests.ts | 7 ++ 2 files changed, 74 insertions(+), 16 deletions(-) diff --git a/types/google-apps-script/google-apps-script.card-service.d.ts b/types/google-apps-script/google-apps-script.card-service.d.ts index c92a555a7902be..8605aaa27c94e4 100644 --- a/types/google-apps-script/google-apps-script.card-service.d.ts +++ b/types/google-apps-script/google-apps-script.card-service.d.ts @@ -640,27 +640,78 @@ declare namespace GoogleAppsScript { /** * An input field that allows choosing between a set of predefined options. * - * var checkboxGroup = CardService.newSelectionInput() - * .setType(CardService.SelectionInputType.CHECK_BOX) - * .setTitle("A group of checkboxes. Multiple selections are allowed.") - * .setFieldName("checkbox_field") - * .addItem("checkbox one title", "checkbox_one_value", false) - * .addItem("checkbox two title", "checkbox_two_value", true) - * .addItem("checkbox three title", "checkbox_three_value", false) - * .setOnChangeAction(CardService.newAction() - * .setFunctionName("handleCheckboxChange")); + * const checkboxGroup = + * CardService.newSelectionInput() + * .setType(CardService.SelectionInputType.CHECK_BOX) + * .setTitle('A group of checkboxes. Multiple selections are allowed.') + * .setFieldName('checkbox_field') + * .addItem('checkbox one title', 'checkbox_one_value', false) + * .addItem('checkbox two title', 'checkbox_two_value', true) + * .addItem('checkbox three title', 'checkbox_three_value', true) + * .setOnChangeAction( + * CardService.newAction().setFunctionName('handleCheckboxChange'), + * ); * - * var radioGroup = CardService.newSelectionInput() - * .setType(CardService.SelectionInputType.RADIO_BUTTON) - * .setTitle("A group of radio buttons. Only a single selection is allowed.") - * .setFieldName("checkbox_field") - * .addItem("radio button one title", "radio_one_value", true) - * .addItem("radio button two title", "radio_two_value", true) - * .addItem("radio button three title", "radio_three_value", false); + * const radioGroup = + * CardService.newSelectionInput() + * .setType(CardService.SelectionInputType.RADIO_BUTTON) + * .setTitle( + * 'A group of radio buttons. Only a single selection is allowed.') + * .setFieldName('checkbox_field') + * .addItem('radio button one title', 'radio_one_value', true) + * .addItem('radio button two title', 'radio_two_value', false) + * .addItem('radio button three title', 'radio_three_value', false); + * + * const multiSelect = + * CardService.newSelectionInput() + * .setType(CardService.SelectionInputType.MULTI_SELECT) + * .setFieldName('multiselect') + * .setTitle('A multi select input example.') + * .addMultiSelectItem( + * 'Contact 1', + * 'contact-1', + * false, + * 'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png', + * 'Contact one description', + * ) + * .addMultiSelectItem( + * 'Contact 2', + * 'contact-2', + * false, + * 'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png', + * 'Contact two description', + * ) + * .addMultiSelectItem( + * 'Contact 3', + * 'contact-3', + * false, + * 'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png', + * 'Contact three description', + * ) + * .addMultiSelectItem( + * 'Contact 4', + * 'contact-4', + * false, + * 'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png', + * 'Contact four description', + * ) + * .addMultiSelectItem( + * 'Contact 5', + * 'contact-5', + * false, + * 'https://www.gstatic.com/images/branding/product/2x/contacts_48dp.png', + * 'Contact five description', + * ) + * .setMultiSelectMaxSelectedItems(3) + * .setMultiSelectMinQueryLength(1); */ interface SelectionInput { addItem(text: any, value: any, selected: boolean): SelectionInput; + addMultiSelectItem(text: string, value: string, selected: boolean, startIconUri: string, bottomText: string): SelectionInput; + setExternalDataSource(action: Action): SelectionInput; setFieldName(fieldName: string): SelectionInput; + setMultiSelectMaxSelectedItems(maxSelectedItems: Integer): SelectionInput; + setMultiSelectMinQueryLength(queryLength: Integer): SelectionInput setOnChangeAction(action: Action): SelectionInput; setTitle(title: string): SelectionInput; setType(type: SelectionInputType): SelectionInput; diff --git a/types/google-apps-script/test/google-apps-script-tests.ts b/types/google-apps-script/test/google-apps-script-tests.ts index 2845b61797ae34..98ce90c9987d11 100644 --- a/types/google-apps-script/test/google-apps-script-tests.ts +++ b/types/google-apps-script/test/google-apps-script-tests.ts @@ -643,6 +643,13 @@ CardService.newOpenLink().setOnClose(CardService.OnClose.RELOAD_ADD_ON); // $Exp // Class CardService.SelectionInput // https://developers.google.com/apps-script/reference/card-service/selection-input CardService.newSelectionInput(); // $ExpectType SelectionInput +CardService.newSelectionInput().addItem('', '', true); // $ExpectType SelectionInput +CardService.newSelectionInput().addMultiSelectItem('', '', false, '', ''); // $ExpectType SelectionInput +CardService.newSelectionInput().setFieldName(''); // $ExpectType SelectionInput +CardService.newSelectionInput().setMultiSelectMaxSelectedItems(5); // $ExpectType SelectionInput +CardService.newSelectionInput().setMultiSelectMinQueryLength(1); // $ExpectType SelectionInput +CardService.newSelectionInput().setTitle(''); // $ExpectType SelectionInput +CardService.newSelectionInput().setType(CardService.SelectionInputType.CHECK_BOX); // $ExpectType SelectionInput // Enum SelectionInputType // https://developers.google.com/apps-script/reference/card-service/selection-input-type From 0dc068dd5bc10cfcafa641f3ea4b19ece245ccdb Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Thu, 18 Sep 2025 16:31:43 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A4=96=20dprint=20fmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../google-apps-script.card-service.d.ts | 12 +++++++++--- .../test/google-apps-script-tests.ts | 8 ++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/types/google-apps-script/google-apps-script.card-service.d.ts b/types/google-apps-script/google-apps-script.card-service.d.ts index 8605aaa27c94e4..b387e51390e15f 100644 --- a/types/google-apps-script/google-apps-script.card-service.d.ts +++ b/types/google-apps-script/google-apps-script.card-service.d.ts @@ -661,7 +661,7 @@ declare namespace GoogleAppsScript { * .addItem('radio button one title', 'radio_one_value', true) * .addItem('radio button two title', 'radio_two_value', false) * .addItem('radio button three title', 'radio_three_value', false); - * + * * const multiSelect = * CardService.newSelectionInput() * .setType(CardService.SelectionInputType.MULTI_SELECT) @@ -707,11 +707,17 @@ declare namespace GoogleAppsScript { */ interface SelectionInput { addItem(text: any, value: any, selected: boolean): SelectionInput; - addMultiSelectItem(text: string, value: string, selected: boolean, startIconUri: string, bottomText: string): SelectionInput; + addMultiSelectItem( + text: string, + value: string, + selected: boolean, + startIconUri: string, + bottomText: string, + ): SelectionInput; setExternalDataSource(action: Action): SelectionInput; setFieldName(fieldName: string): SelectionInput; setMultiSelectMaxSelectedItems(maxSelectedItems: Integer): SelectionInput; - setMultiSelectMinQueryLength(queryLength: Integer): SelectionInput + setMultiSelectMinQueryLength(queryLength: Integer): SelectionInput; setOnChangeAction(action: Action): SelectionInput; setTitle(title: string): SelectionInput; setType(type: SelectionInputType): SelectionInput; diff --git a/types/google-apps-script/test/google-apps-script-tests.ts b/types/google-apps-script/test/google-apps-script-tests.ts index 98ce90c9987d11..ace09b17bd0f95 100644 --- a/types/google-apps-script/test/google-apps-script-tests.ts +++ b/types/google-apps-script/test/google-apps-script-tests.ts @@ -643,12 +643,12 @@ CardService.newOpenLink().setOnClose(CardService.OnClose.RELOAD_ADD_ON); // $Exp // Class CardService.SelectionInput // https://developers.google.com/apps-script/reference/card-service/selection-input CardService.newSelectionInput(); // $ExpectType SelectionInput -CardService.newSelectionInput().addItem('', '', true); // $ExpectType SelectionInput -CardService.newSelectionInput().addMultiSelectItem('', '', false, '', ''); // $ExpectType SelectionInput -CardService.newSelectionInput().setFieldName(''); // $ExpectType SelectionInput +CardService.newSelectionInput().addItem("", "", true); // $ExpectType SelectionInput +CardService.newSelectionInput().addMultiSelectItem("", "", false, "", ""); // $ExpectType SelectionInput +CardService.newSelectionInput().setFieldName(""); // $ExpectType SelectionInput CardService.newSelectionInput().setMultiSelectMaxSelectedItems(5); // $ExpectType SelectionInput CardService.newSelectionInput().setMultiSelectMinQueryLength(1); // $ExpectType SelectionInput -CardService.newSelectionInput().setTitle(''); // $ExpectType SelectionInput +CardService.newSelectionInput().setTitle(""); // $ExpectType SelectionInput CardService.newSelectionInput().setType(CardService.SelectionInputType.CHECK_BOX); // $ExpectType SelectionInput // Enum SelectionInputType