Fix data-setting attributes not being updated on index change (#872)
This commit is contained in:
parent
cdd649ea3d
commit
3b6e3193ae
@ -135,6 +135,7 @@ class ScanInputField {
|
||||
|
||||
set index(value) {
|
||||
this._index = value;
|
||||
this._updateDataSettingTargets();
|
||||
}
|
||||
|
||||
prepare(container, include, exclude) {
|
||||
@ -158,10 +159,7 @@ class ScanInputField {
|
||||
this._eventListeners.on(this._excludeInputField, 'change', this._onExcludeValueChange.bind(this));
|
||||
this._eventListeners.addEventListener(removeButton, 'click', this._onRemoveClick.bind(this));
|
||||
|
||||
for (const typeCheckbox of node.querySelectorAll('.scan-input-settings-checkbox')) {
|
||||
const {property} = typeCheckbox.dataset;
|
||||
typeCheckbox.dataset.setting = `scanning.inputs[${this._index}].${property}`;
|
||||
}
|
||||
this._updateDataSettingTargets();
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
@ -201,4 +199,12 @@ class ScanInputField {
|
||||
const node = this._node.querySelector(`input.scan-input-settings-checkbox[data-property="types.${pointerType}"]`);
|
||||
return node !== null && node.checked;
|
||||
}
|
||||
|
||||
_updateDataSettingTargets() {
|
||||
const index = this._index;
|
||||
for (const typeCheckbox of this._node.querySelectorAll('.scan-input-settings-checkbox')) {
|
||||
const {property} = typeCheckbox.dataset;
|
||||
typeCheckbox.dataset.setting = `scanning.inputs[${index}].${property}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user