From 20ca47c0048a58f9341d2b35082206af62268f83 Mon Sep 17 00:00:00 2001 From: Mouriya Date: Fri, 13 Sep 2024 15:17:16 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=91=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E5=A4=B1=E6=95=97=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/actions/cascading-dropdown-selectors.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugin/kintone-addins/src/actions/cascading-dropdown-selectors.ts b/plugin/kintone-addins/src/actions/cascading-dropdown-selectors.ts index 5820eef..ea84ae1 100644 --- a/plugin/kintone-addins/src/actions/cascading-dropdown-selectors.ts +++ b/plugin/kintone-addins/src/actions/cascading-dropdown-selectors.ts @@ -121,8 +121,8 @@ namespace DropDownConfig { value: fieldData.value, index: fieldCodeToIndexMap.get(fieldCode), })) - .filter((item) => item.index !== undefined) - .sort((a, b) => a.index - b.index) + .filter((item) => item.index !== undefined || item.index !== null) + .sort((a, b) => a.index! - b.index!) ) .forEach((recordArray) => { recordArray.forEach((item, i, array) => { @@ -133,7 +133,7 @@ namespace DropDownConfig { if (index === 0) { tempDictionary["0_TOP"].add(v); } else { - const previousItem = array[index - 1]; + const previousItem = array[index! - 1]; const previousKey = `${previousItem.index}_${previousItem.value}`; tempDictionary[previousKey] = tempDictionary[previousKey] || new Set(); @@ -250,7 +250,7 @@ export class CascadingDropDownAction implements IAction { DropdownContainer.addSaveBtnEvent( pageType === "app" ? tableElement - : document.getElementById("appForm-gaia") + : document.getElementById("appForm-gaia")! ); DropdownContainer.render(tableElement); } @@ -371,9 +371,7 @@ namespace DropdownContainer { ): void => { let select; if (!initSelect) { - select = selects - .get(fieldCode) - .querySelector("select"); + select = selects.get(fieldCode)?.querySelector("select"); if (!select) { console.error( `フィールド ${fieldCode} のドロップダウンメニュー要素が見つかりません` @@ -383,7 +381,7 @@ namespace DropdownContainer { } } else { select = initSelect; - state[fieldCode] = value; + state[fieldCode] = value!; } const field = fieldList.find((f) => f.dropDown.code === fieldCode); @@ -421,7 +419,7 @@ namespace DropdownContainer { const fieldCode = field.dropDown.code; updateOptions(fieldCode); ( - selects.get(fieldCode).previousElementSibling as HTMLInputElement + selects.get(fieldCode)?.previousElementSibling as HTMLInputElement ).value = ""; delete state[fieldCode]; });