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]; });