Add disabled property support to all popup input types (#5441) Adds optional `disabled` boolean property to PopupInputConfiguration JSDoc and implements it across all input types (checkbox, text, textarea, number). When set to true, the input element will be rendered in a disabled state.

6a325d2b222b466184e30b5a7348229dad2bbac1

Wolfsblvt <wolfsblvt@gmail.com>

Signed
1 files changed, +5 -0Ignore whitespace
public/scripts/popup.js+5 -0
@@ -84,6 +84,7 @@ export const POPUP_RESULT = {
8484 * @property {number?} [min] - The minimum value for number inputs
8585 * @property {number?} [max] - The maximum value for number inputs
8686 * @property {number?} [step] - The step value for number inputs
87+ * @property {boolean?} [disabled=false] - Whether the input should be disabled
8788 */
8889
8990/**
@@ -334,6 +335,7 @@ export class Popup {
334335 inputElement.type = 'checkbox';
335336 inputElement.id = input.id;
336337 inputElement.checked = Boolean(input.defaultState ?? false);
338+ inputElement.disabled = Boolean(input.disabled ?? false);
337339 label.appendChild(inputElement);
338340 const labelText = document.createElement('span');
339341 labelText.innerText = input.label;
@@ -359,6 +361,7 @@ export class Popup {
359361 inputElement.id = input.id;
360362 inputElement.value = String(input.defaultState ?? '');
361363 inputElement.placeholder = input.tooltip ?? '';
364+ inputElement.disabled = Boolean(input.disabled ?? false);
362365 setTitleFromTooltip(inputElement, input.tooltip);
363366
364367 const labelText = document.createElement('span');
@@ -380,6 +383,7 @@ export class Popup {
380383 inputElement.value = String(input.defaultState ?? '');
381384 inputElement.rows = input.rows ?? 1;
382385 inputElement.placeholder = input.tooltip ?? '';
386+ inputElement.disabled = Boolean(input.disabled ?? false);
383387 setTitleFromTooltip(inputElement, input.tooltip);
384388
385389 const labelText = document.createElement('span');
@@ -404,6 +408,7 @@ export class Popup {
404408 inputElement.min = String(input.min ?? '');
405409 inputElement.max = String(input.max ?? '');
406410 inputElement.step = String(input.step ?? '');
411+ inputElement.disabled = Boolean(input.disabled ?? false);
407412 setTitleFromTooltip(inputElement, input.tooltip);
408413
409414 inputElement.addEventListener('change', () => {