Generates the list of options from which the user can select..
()
| 403 | |
| 404 | /** Generates the list of options from which the user can select.. */ |
| 405 | private _generateOptions(): void { |
| 406 | // Default the interval to 30 minutes. |
| 407 | const interval = this.interval() ?? 30 * 60; |
| 408 | const options = this.options(); |
| 409 | |
| 410 | if (options !== null) { |
| 411 | this._timeOptions = options; |
| 412 | } else { |
| 413 | const input = this._input(); |
| 414 | const adapter = this._dateAdapter; |
| 415 | const timeFormat = this._dateFormats.display.timeInput; |
| 416 | const min = input?.min() || adapter.setTime(adapter.today(), 0, 0, 0); |
| 417 | const max = input?.max() || adapter.setTime(adapter.today(), 23, 59, 0); |
| 418 | const cacheKey = |
| 419 | interval + '/' + adapter.format(min, timeFormat) + '/' + adapter.format(max, timeFormat); |
| 420 | |
| 421 | // Don't re-generate the options if the inputs haven't changed. |
| 422 | if (cacheKey !== this._optionsCacheKey) { |
| 423 | this._optionsCacheKey = cacheKey; |
| 424 | this._timeOptions = generateOptions(adapter, this._dateFormats, min, max, interval); |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * Synchronizes the internal state of the component based on a specific selected date. |