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.
Signed| @@ -84,6 +84,7 @@ export const POPUP_RESULT = { | |||
| 84 | * @property {number?} [min] - The minimum value for number inputs | 84 | * @property {number?} [min] - The minimum value for number inputs |
| 85 | * @property {number?} [max] - The maximum value for number inputs | 85 | * @property {number?} [max] - The maximum value for number inputs |
| 86 | * @property {number?} [step] - The step value for number inputs | 86 | * @property {number?} [step] - The step value for number inputs |
| 87 | * @property {boolean?} [disabled=false] - Whether the input should be disabled | ||
| 87 | */ | 88 | */ |
| 88 | 89 | ||
| 89 | /** | 90 | /** |
| @@ -334,6 +335,7 @@ export class Popup { | |||
| 334 | inputElement.type = 'checkbox'; | 335 | inputElement.type = 'checkbox'; |
| 335 | inputElement.id = input.id; | 336 | inputElement.id = input.id; |
| 336 | inputElement.checked = Boolean(input.defaultState ?? false); | 337 | inputElement.checked = Boolean(input.defaultState ?? false); |
| 338 | inputElement.disabled = Boolean(input.disabled ?? false); | ||
| 337 | label.appendChild(inputElement); | 339 | label.appendChild(inputElement); |
| 338 | const labelText = document.createElement('span'); | 340 | const labelText = document.createElement('span'); |
| 339 | labelText.innerText = input.label; | 341 | labelText.innerText = input.label; |
| @@ -359,6 +361,7 @@ export class Popup { | |||
| 359 | inputElement.id = input.id; | 361 | inputElement.id = input.id; |
| 360 | inputElement.value = String(input.defaultState ?? ''); | 362 | inputElement.value = String(input.defaultState ?? ''); |
| 361 | inputElement.placeholder = input.tooltip ?? ''; | 363 | inputElement.placeholder = input.tooltip ?? ''; |
| 364 | inputElement.disabled = Boolean(input.disabled ?? false); | ||
| 362 | setTitleFromTooltip(inputElement, input.tooltip); | 365 | setTitleFromTooltip(inputElement, input.tooltip); |
| 363 | 366 | ||
| 364 | const labelText = document.createElement('span'); | 367 | const labelText = document.createElement('span'); |
| @@ -380,6 +383,7 @@ export class Popup { | |||
| 380 | inputElement.value = String(input.defaultState ?? ''); | 383 | inputElement.value = String(input.defaultState ?? ''); |
| 381 | inputElement.rows = input.rows ?? 1; | 384 | inputElement.rows = input.rows ?? 1; |
| 382 | inputElement.placeholder = input.tooltip ?? ''; | 385 | inputElement.placeholder = input.tooltip ?? ''; |
| 386 | inputElement.disabled = Boolean(input.disabled ?? false); | ||
| 383 | setTitleFromTooltip(inputElement, input.tooltip); | 387 | setTitleFromTooltip(inputElement, input.tooltip); |
| 384 | 388 | ||
| 385 | const labelText = document.createElement('span'); | 389 | const labelText = document.createElement('span'); |
| @@ -404,6 +408,7 @@ export class Popup { | |||
| 404 | inputElement.min = String(input.min ?? ''); | 408 | inputElement.min = String(input.min ?? ''); |
| 405 | inputElement.max = String(input.max ?? ''); | 409 | inputElement.max = String(input.max ?? ''); |
| 406 | inputElement.step = String(input.step ?? ''); | 410 | inputElement.step = String(input.step ?? ''); |
| 411 | inputElement.disabled = Boolean(input.disabled ?? false); | ||
| 407 | setTitleFromTooltip(inputElement, input.tooltip); | 412 | setTitleFromTooltip(inputElement, input.tooltip); |
| 408 | 413 | ||
| 409 | inputElement.addEventListener('change', () => { | 414 | inputElement.addEventListener('change', () => { |