間違ったイテレータを修正. 不正なインデックス比較を修正
This commit is contained in:
@@ -318,14 +318,15 @@ namespace DropdownContainer {
|
|||||||
".control-label-text-gaia"
|
".control-label-text-gaia"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
headerCells = Array.from(headerCells);
|
||||||
headerCells.forEach((th, index) => {
|
for (const field of fieldList) {
|
||||||
const label = th.textContent?.trim();
|
const index = headerCells
|
||||||
const field = fieldList.find((f) => f.dropDown.label === label);
|
.map((th) => th.textContent?.trim())
|
||||||
if (field) {
|
.findIndex((label) => label === field.dropDown.label);
|
||||||
|
if (index) {
|
||||||
columnMap.set(index, field);
|
columnMap.set(index, field);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
// columnMapの作成後は変更されないため、その配列バージョンを再構築しません
|
// columnMapの作成後は変更されないため、その配列バージョンを再構築しません
|
||||||
columMapArray = Array.from(columnMap.entries());
|
columMapArray = Array.from(columnMap.entries());
|
||||||
columMapValueArray = Array.from(columnMap.values());
|
columMapValueArray = Array.from(columnMap.values());
|
||||||
@@ -415,10 +416,10 @@ namespace DropdownContainer {
|
|||||||
const selectorChangeHandle = (fieldCode: string, event: Event): void => {
|
const selectorChangeHandle = (fieldCode: string, event: Event): void => {
|
||||||
const select = event.target as HTMLSelectElement;
|
const select = event.target as HTMLSelectElement;
|
||||||
state[fieldCode] = select.value; // 値を状態に同期
|
state[fieldCode] = select.value; // 値を状態に同期
|
||||||
|
const currentLevel = getLevel(fieldCode);
|
||||||
// すべての下位メニューをリセット
|
// すべての下位メニューをリセット
|
||||||
columMapArray
|
columMapArray
|
||||||
.filter(([index, _]) => index >= getLevel(fieldCode) + 1)
|
.filter((_, arrayIndex) => arrayIndex > currentLevel)
|
||||||
.forEach(([_, field]) => {
|
.forEach(([_, field]) => {
|
||||||
const fieldCode = field.dropDown.code;
|
const fieldCode = field.dropDown.code;
|
||||||
updateOptions(fieldCode);
|
updateOptions(fieldCode);
|
||||||
|
|||||||
Reference in New Issue
Block a user