@angular/material 19.0.0-next.9 → 19.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete/_autocomplete-theme.scss +8 -4
- package/autocomplete/index.d.ts +5 -6
- package/badge/_badge-theme.scss +10 -6
- package/badge/index.d.ts +1 -2
- package/bottom-sheet/_bottom-sheet-theme.scss +8 -4
- package/button/_button-theme.scss +10 -6
- package/button/_fab-theme.scss +10 -6
- package/button/_icon-button-theme.scss +8 -4
- package/button/index.d.ts +1 -1
- package/button-toggle/_button-toggle-theme.scss +11 -6
- package/button-toggle/index.d.ts +2 -1
- package/card/_card-theme.scss +8 -4
- package/card/index.d.ts +2 -3
- package/checkbox/_checkbox-theme.scss +10 -6
- package/chips/_chips-theme.scss +10 -6
- package/core/_core-theme.scss +4 -7
- package/core/_core.scss +2 -5
- package/core/m2/_theming.scss +2 -1
- package/core/option/_optgroup-theme.scss +8 -4
- package/core/option/_option-theme.scss +10 -6
- package/core/ripple/_ripple-theme.scss +8 -4
- package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +10 -6
- package/core/theming/_config-validation.scss +4 -4
- package/core/theming/_definition.scss +12 -2
- package/core/theming/_theming.scss +2 -1
- package/core/tokens/_m3-system.scss +55 -39
- package/core/tokens/_m3-tokens.scss +3 -3
- package/core/tokens/_token-definition.scss +4 -3
- package/core/tokens/m2/mat/_badge.scss +1 -1
- package/core/tokens/m2/mat/_datepicker.scss +1 -1
- package/core/tokens/m2/mat/_menu.scss +5 -3
- package/core/tokens/m2/mat/_sort.scss +1 -1
- package/core/tokens/m3/mat/_menu.scss +6 -3
- package/core/tokens/m3/mdc/_filled-text-field.scss +9 -11
- package/datepicker/_datepicker-theme.scss +10 -6
- package/datepicker/index.d.ts +36 -37
- package/dialog/_dialog-theme.scss +8 -4
- package/dialog/index.d.ts +1 -0
- package/divider/_divider-theme.scss +8 -4
- package/expansion/_expansion-theme.scss +8 -4
- package/fesm2022/autocomplete/testing.mjs +2 -5
- package/fesm2022/autocomplete/testing.mjs.map +1 -1
- package/fesm2022/autocomplete.mjs +225 -151
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge/testing.mjs +2 -5
- package/fesm2022/badge/testing.mjs.map +1 -1
- package/fesm2022/badge.mjs +45 -36
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet/testing.mjs +1 -1
- package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +79 -57
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button/testing.mjs +2 -2
- package/fesm2022/button/testing.mjs.map +1 -1
- package/fesm2022/button-toggle/testing.mjs +4 -7
- package/fesm2022/button-toggle/testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +84 -47
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +98 -71
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card/testing.mjs +3 -6
- package/fesm2022/card/testing.mjs.map +1 -1
- package/fesm2022/card.mjs +53 -55
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox/testing.mjs +4 -7
- package/fesm2022/checkbox/testing.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +105 -63
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips/testing.mjs +11 -14
- package/fesm2022/chips/testing.mjs.map +1 -1
- package/fesm2022/chips.mjs +317 -268
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core/testing.mjs +5 -11
- package/fesm2022/core/testing.mjs.map +1 -1
- package/fesm2022/core.mjs +237 -187
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker/testing.mjs +13 -22
- package/fesm2022/datepicker/testing.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +821 -568
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog/testing.mjs +15 -9
- package/fesm2022/dialog/testing.mjs.map +1 -1
- package/fesm2022/dialog.mjs +221 -153
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider/testing.mjs +1 -1
- package/fesm2022/divider/testing.mjs.map +1 -1
- package/fesm2022/divider.mjs +9 -11
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion/testing.mjs +7 -10
- package/fesm2022/expansion/testing.mjs.map +1 -1
- package/fesm2022/expansion.mjs +85 -76
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field/testing.mjs +12 -15
- package/fesm2022/form-field/testing.mjs.map +1 -1
- package/fesm2022/form-field.mjs +179 -126
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list/testing.mjs +11 -17
- package/fesm2022/grid-list/testing.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +72 -50
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon/testing.mjs +8 -8
- package/fesm2022/icon/testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +65 -45
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input/testing.mjs +3 -3
- package/fesm2022/input/testing.mjs.map +1 -1
- package/fesm2022/input.mjs +104 -72
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list/testing.mjs +21 -38
- package/fesm2022/list/testing.mjs.map +1 -1
- package/fesm2022/list.mjs +191 -180
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu/testing.mjs +3 -6
- package/fesm2022/menu/testing.mjs.map +1 -1
- package/fesm2022/menu.mjs +178 -168
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator/testing.mjs +10 -13
- package/fesm2022/paginator/testing.mjs.map +1 -1
- package/fesm2022/paginator.mjs +84 -59
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar/testing.mjs +1 -1
- package/fesm2022/progress-bar/testing.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +35 -34
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner/testing.mjs +1 -1
- package/fesm2022/progress-spinner/testing.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +27 -13
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio/testing.mjs +6 -12
- package/fesm2022/radio/testing.mjs.map +1 -1
- package/fesm2022/radio.mjs +123 -88
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select/testing.mjs +6 -9
- package/fesm2022/select/testing.mjs.map +1 -1
- package/fesm2022/select.mjs +220 -182
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav/testing.mjs +6 -6
- package/fesm2022/sidenav/testing.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +132 -119
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle/testing.mjs +3 -6
- package/fesm2022/slide-toggle/testing.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +78 -49
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider/testing.mjs +2 -2
- package/fesm2022/slider/testing.mjs.map +1 -1
- package/fesm2022/slider.mjs +260 -190
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar/testing.mjs +4 -7
- package/fesm2022/snack-bar/testing.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +141 -107
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort/testing.mjs +3 -6
- package/fesm2022/sort/testing.mjs.map +1 -1
- package/fesm2022/sort.mjs +93 -72
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper/testing.mjs +4 -4
- package/fesm2022/stepper/testing.mjs.map +1 -1
- package/fesm2022/stepper.mjs +143 -105
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table/testing.mjs +13 -25
- package/fesm2022/table/testing.mjs.map +1 -1
- package/fesm2022/table.mjs +182 -177
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs/testing.mjs +5 -5
- package/fesm2022/tabs/testing.mjs.map +1 -1
- package/fesm2022/tabs.mjs +326 -247
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker/testing.mjs +7 -16
- package/fesm2022/timepicker/testing.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +157 -153
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar/testing.mjs +2 -5
- package/fesm2022/toolbar/testing.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +25 -15
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip/testing.mjs +6 -9
- package/fesm2022/tooltip/testing.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +96 -72
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree/testing.mjs +3 -6
- package/fesm2022/tree/testing.mjs.map +1 -1
- package/fesm2022/tree.mjs +56 -54
- package/fesm2022/tree.mjs.map +1 -1
- package/form-field/_form-field-theme.scss +9 -5
- package/form-field/index.d.ts +9 -9
- package/grid-list/_grid-list-theme.scss +8 -4
- package/icon/_icon-theme.scss +10 -6
- package/input/_input-theme.scss +8 -4
- package/list/_list-theme.scss +8 -4
- package/list/index.d.ts +20 -21
- package/menu/_menu-theme.scss +8 -4
- package/menu/index.d.ts +15 -17
- package/package.json +2 -2
- package/paginator/_paginator-theme.scss +8 -4
- package/prebuilt-themes/azure-blue.css +1 -1
- package/prebuilt-themes/cyan-orange.css +1 -1
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/magenta-violet.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/prebuilt-themes/rose-red.css +1 -1
- package/progress-bar/_progress-bar-theme.scss +11 -9
- package/progress-spinner/_progress-spinner-theme.scss +11 -9
- package/progress-spinner/index.d.ts +3 -4
- package/radio/_radio-theme.scss +10 -6
- package/radio/index.d.ts +2 -3
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-add/theming/create-custom-theme.js +1 -6
- package/schematics/ng-add/theming/create-custom-theme.mjs +1 -6
- package/schematics/ng-generate/theme-color/index_bundled.js +35 -9
- package/schematics/ng-generate/theme-color/index_bundled.js.map +2 -2
- package/schematics/ng-update/index_bundled.js +6 -1
- package/schematics/ng-update/index_bundled.js.map +1 -1
- package/select/_select-theme.scss +10 -6
- package/select/index.d.ts +7 -7
- package/sidenav/_sidenav-theme.scss +8 -4
- package/slide-toggle/_slide-toggle-theme.scss +10 -6
- package/slider/_slider-theme.scss +10 -6
- package/snack-bar/_snack-bar-theme.scss +10 -6
- package/sort/_sort-theme.scss +8 -4
- package/stepper/_stepper-theme.scss +10 -6
- package/stepper/index.d.ts +14 -15
- package/table/_table-theme.scss +8 -4
- package/tabs/_tabs-theme.scss +10 -6
- package/timepicker/_timepicker-theme.scss +10 -6
- package/toolbar/_toolbar-theme.scss +10 -6
- package/tooltip/_tooltip-theme.scss +8 -4
- package/tooltip/index.d.ts +5 -6
- package/tree/_tree-theme.scss +8 -4
|
@@ -3,11 +3,8 @@ import { MatOptionHarness } from '@angular/material/core/testing';
|
|
|
3
3
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
4
4
|
|
|
5
5
|
class MatTimepickerHarness extends ComponentHarness {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this._documentRootLocator = this.documentRootLocatorFactory();
|
|
9
|
-
}
|
|
10
|
-
static { this.hostSelector = 'mat-timepicker'; }
|
|
6
|
+
_documentRootLocator = this.documentRootLocatorFactory();
|
|
7
|
+
static hostSelector = 'mat-timepicker';
|
|
11
8
|
/**
|
|
12
9
|
* Gets a `HarnessPredicate` that can be used to search for a timepicker with specific
|
|
13
10
|
* attributes.
|
|
@@ -49,11 +46,8 @@ class MatTimepickerHarness extends ComponentHarness {
|
|
|
49
46
|
|
|
50
47
|
/** Harness for interacting with a standard Material timepicker inputs in tests. */
|
|
51
48
|
class MatTimepickerInputHarness extends ComponentHarness {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this._documentRootLocator = this.documentRootLocatorFactory();
|
|
55
|
-
}
|
|
56
|
-
static { this.hostSelector = '.mat-timepicker-input'; }
|
|
49
|
+
_documentRootLocator = this.documentRootLocatorFactory();
|
|
50
|
+
static hostSelector = '.mat-timepicker-input';
|
|
57
51
|
/**
|
|
58
52
|
* Gets a `HarnessPredicate` that can be used to search for a `MatTimepickerInputHarness`
|
|
59
53
|
* that meets certain criteria.
|
|
@@ -156,12 +150,9 @@ class MatTimepickerInputHarness extends ComponentHarness {
|
|
|
156
150
|
|
|
157
151
|
/** Harness for interacting with a standard Material timepicker toggle in tests. */
|
|
158
152
|
class MatTimepickerToggleHarness extends ComponentHarness {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
this._button = this.locatorFor('button');
|
|
163
|
-
}
|
|
164
|
-
static { this.hostSelector = '.mat-timepicker-toggle'; }
|
|
153
|
+
static hostSelector = '.mat-timepicker-toggle';
|
|
154
|
+
/** The clickable button inside the toggle. */
|
|
155
|
+
_button = this.locatorFor('button');
|
|
165
156
|
/**
|
|
166
157
|
* Gets a `HarnessPredicate` that can be used to search for a `MatTimepickerToggleHarness` that
|
|
167
158
|
* meets certain criteria.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/timepicker/testing/timepicker-harness.ts","../../../../../../../src/material/timepicker/testing/timepicker-input-harness.ts","../../../../../../../src/material/timepicker/testing/timepicker-toggle-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n} from '@angular/cdk/testing';\nimport {MatOptionHarness, OptionHarnessFilters} from '@angular/material/core/testing';\nimport {TimepickerHarnessFilters} from './timepicker-harness-filters';\n\nexport class MatTimepickerHarness extends ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory();\n static hostSelector = 'mat-timepicker';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a timepicker with specific\n * attributes.\n * @param options Options for filtering which timepicker instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends MatTimepickerHarness>(\n this: ComponentHarnessConstructor<T>,\n options: TimepickerHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options);\n }\n\n /** Whether the timepicker is open. */\n async isOpen(): Promise<boolean> {\n const selector = await this._getPanelSelector();\n const panel = await this._documentRootLocator.locatorForOptional(selector)();\n return panel !== null;\n }\n\n /** Gets the options inside the timepicker panel. */\n async getOptions(filters?: Omit<OptionHarnessFilters, 'ancestor'>): Promise<MatOptionHarness[]> {\n if (!(await this.isOpen())) {\n throw new Error('Unable to retrieve options for timepicker. Timepicker panel is closed.');\n }\n\n return this._documentRootLocator.locatorForAll(\n MatOptionHarness.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector(),\n } as OptionHarnessFilters),\n )();\n }\n\n /** Selects the first option matching the given filters. */\n async selectOption(filters: OptionHarnessFilters): Promise<void> {\n const options = await this.getOptions(filters);\n if (!options.length) {\n throw Error(`Could not find a mat-option matching ${JSON.stringify(filters)}`);\n }\n await options[0].click();\n }\n\n /** Gets the selector that can be used to find the timepicker's panel. */\n protected async _getPanelSelector(): Promise<string> {\n return `#${await (await this.host()).getAttribute('mat-timepicker-panel-id')}`;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n TestKey,\n} from '@angular/cdk/testing';\nimport {MatTimepickerHarness} from './timepicker-harness';\nimport {\n TimepickerHarnessFilters,\n TimepickerInputHarnessFilters,\n} from './timepicker-harness-filters';\n\n/** Harness for interacting with a standard Material timepicker inputs in tests. */\nexport class MatTimepickerInputHarness extends ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory();\n static hostSelector = '.mat-timepicker-input';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatTimepickerInputHarness`\n * that meets certain criteria.\n * @param options Options for filtering which input instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends MatTimepickerInputHarness>(\n this: ComponentHarnessConstructor<T>,\n options: TimepickerInputHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options)\n .addOption('value', options.value, (harness, value) => {\n return HarnessPredicate.stringMatches(harness.getValue(), value);\n })\n .addOption('placeholder', options.placeholder, (harness, placeholder) => {\n return HarnessPredicate.stringMatches(harness.getPlaceholder(), placeholder);\n });\n }\n\n /** Gets whether the timepicker associated with the input is open. */\n async isTimepickerOpen(): Promise<boolean> {\n const host = await this.host();\n return (await host.getAttribute('aria-expanded')) === 'true';\n }\n\n /** Opens the timepicker associated with the input and returns the timepicker instance. */\n async openTimepicker(): Promise<MatTimepickerHarness> {\n if (!(await this.isDisabled())) {\n const host = await this.host();\n await host.sendKeys(TestKey.DOWN_ARROW);\n }\n\n return this.getTimepicker();\n }\n\n /** Closes the timepicker associated with the input. */\n async closeTimepicker(): Promise<void> {\n await this._documentRootLocator.rootElement.click();\n\n // This is necessary so that we wait for the closing animation.\n await this.forceStabilize();\n }\n\n /**\n * Gets the `MatTimepickerHarness` that is associated with the input.\n * @param filter Optionally filters which timepicker is included.\n */\n async getTimepicker(filter: TimepickerHarnessFilters = {}): Promise<MatTimepickerHarness> {\n const host = await this.host();\n const timepickerId = await host.getAttribute('mat-timepicker-id');\n\n if (!timepickerId) {\n throw Error('Element is not associated with a timepicker');\n }\n\n return this._documentRootLocator.locatorFor(\n MatTimepickerHarness.with({\n ...filter,\n selector: `[mat-timepicker-panel-id=\"${timepickerId}\"]`,\n }),\n )();\n }\n\n /** Whether the input is disabled. */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).getProperty<boolean>('disabled');\n }\n\n /** Whether the input is required. */\n async isRequired(): Promise<boolean> {\n return (await this.host()).getProperty<boolean>('required');\n }\n\n /** Gets the value of the input. */\n async getValue(): Promise<string> {\n // The \"value\" property of the native input is always defined.\n return await (await this.host()).getProperty<string>('value');\n }\n\n /**\n * Sets the value of the input. The value will be set by simulating\n * keypresses that correspond to the given value.\n */\n async setValue(newValue: string): Promise<void> {\n const inputEl = await this.host();\n await inputEl.clear();\n\n // We don't want to send keys for the value if the value is an empty\n // string in order to clear the value. Sending keys with an empty string\n // still results in unnecessary focus events.\n if (newValue) {\n await inputEl.sendKeys(newValue);\n }\n }\n\n /** Gets the placeholder of the input. */\n async getPlaceholder(): Promise<string> {\n return await (await this.host()).getProperty<string>('placeholder');\n }\n\n /**\n * Focuses the input and returns a promise that indicates when the\n * action is complete.\n */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /**\n * Blurs the input and returns a promise that indicates when the\n * action is complete.\n */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the input is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {TimepickerToggleHarnessFilters} from './timepicker-harness-filters';\n\n/** Harness for interacting with a standard Material timepicker toggle in tests. */\nexport class MatTimepickerToggleHarness extends ComponentHarness {\n static hostSelector = '.mat-timepicker-toggle';\n\n /** The clickable button inside the toggle. */\n private _button = this.locatorFor('button');\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatTimepickerToggleHarness` that\n * meets certain criteria.\n * @param options Options for filtering which timepicker toggle instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(\n options: TimepickerToggleHarnessFilters = {},\n ): HarnessPredicate<MatTimepickerToggleHarness> {\n return new HarnessPredicate(MatTimepickerToggleHarness, options);\n }\n\n /** Opens the timepicker associated with the toggle. */\n async openTimepicker(): Promise<void> {\n const isOpen = await this.isTimepickerOpen();\n\n if (!isOpen) {\n const button = await this._button();\n await button.click();\n }\n }\n\n /** Gets whether the timepicker associated with the toggle is open. */\n async isTimepickerOpen(): Promise<boolean> {\n const button = await this._button();\n const ariaExpanded = await button.getAttribute('aria-expanded');\n return ariaExpanded === 'true';\n }\n\n /** Whether the toggle is disabled. */\n async isDisabled(): Promise<boolean> {\n const button = await this._button();\n return coerceBooleanProperty(await button.getAttribute('disabled'));\n }\n}\n"],"names":[],"mappings":";;;;AAgBM,MAAO,oBAAqB,SAAQ,gBAAgB,CAAA;AAA1D,IAAA,WAAA,GAAA;;AACU,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;KAkDlE;aAjDQ,IAAY,CAAA,YAAA,GAAG,gBAAH,CAAoB,EAAA;AAEvC;;;;;AAKG;AACH,IAAA,OAAO,IAAI,CAET,OAAA,GAAoC,EAAE,EAAA;AAEtC,QAAA,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KAC5C;;AAGD,IAAA,MAAM,MAAM,GAAA;AACV,QAAA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;AAChD,QAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7E,OAAO,KAAK,KAAK,IAAI,CAAC;KACvB;;IAGD,MAAM,UAAU,CAAC,OAAgD,EAAA;QAC/D,IAAI,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;AAC1B,YAAA,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;SAC3F;Q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EAAE,EAAE,SAAS,EAAE,CAAC;KACxC;;;ACpIH;AACM,MAAO,0BAA2B,SAAQ,gBAAgB,CAAA;AAAhE,IAAA,WAAA,GAAA;;;AAIU,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;KAoC7C;aAvCQ,IAAY,CAAA,YAAA,GAAG,wBAAH,CAA4B,EAAA;AAK/C;;;;;AAKG;AACH,IAAA,OAAO,IAAI,CACT,OAAA,GAA0C,EAAE,EAAA;AAE5C,QAAA,OAAO,IAAI,gBAAgB,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;KAClE;;AAGD,IAAA,MAAM,cAAc,GAAA;AAClB,QAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAE7C,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;AACpC,YAAA,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;SACtB;KACF;;AAGD,IAAA,MAAM,gBAAgB,GAAA;AACpB,QAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;QAChE,OAAO,YAAY,KAAK,MAAM,CAAC;KAChC;;AAGD,IAAA,MAAM,UAAU,GAAA;AACd,QAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,qBAAqB,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;KACrE;;;;;"}
|
|
1
|
+
{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/timepicker/testing/timepicker-harness.ts","../../../../../../../src/material/timepicker/testing/timepicker-input-harness.ts","../../../../../../../src/material/timepicker/testing/timepicker-toggle-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n} from '@angular/cdk/testing';\nimport {MatOptionHarness, OptionHarnessFilters} from '@angular/material/core/testing';\nimport {TimepickerHarnessFilters} from './timepicker-harness-filters';\n\nexport class MatTimepickerHarness extends ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory();\n static hostSelector = 'mat-timepicker';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a timepicker with specific\n * attributes.\n * @param options Options for filtering which timepicker instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends MatTimepickerHarness>(\n this: ComponentHarnessConstructor<T>,\n options: TimepickerHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options);\n }\n\n /** Whether the timepicker is open. */\n async isOpen(): Promise<boolean> {\n const selector = await this._getPanelSelector();\n const panel = await this._documentRootLocator.locatorForOptional(selector)();\n return panel !== null;\n }\n\n /** Gets the options inside the timepicker panel. */\n async getOptions(filters?: Omit<OptionHarnessFilters, 'ancestor'>): Promise<MatOptionHarness[]> {\n if (!(await this.isOpen())) {\n throw new Error('Unable to retrieve options for timepicker. Timepicker panel is closed.');\n }\n\n return this._documentRootLocator.locatorForAll(\n MatOptionHarness.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector(),\n } as OptionHarnessFilters),\n )();\n }\n\n /** Selects the first option matching the given filters. */\n async selectOption(filters: OptionHarnessFilters): Promise<void> {\n const options = await this.getOptions(filters);\n if (!options.length) {\n throw Error(`Could not find a mat-option matching ${JSON.stringify(filters)}`);\n }\n await options[0].click();\n }\n\n /** Gets the selector that can be used to find the timepicker's panel. */\n protected async _getPanelSelector(): Promise<string> {\n return `#${await (await this.host()).getAttribute('mat-timepicker-panel-id')}`;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n TestKey,\n} from '@angular/cdk/testing';\nimport {MatTimepickerHarness} from './timepicker-harness';\nimport {\n TimepickerHarnessFilters,\n TimepickerInputHarnessFilters,\n} from './timepicker-harness-filters';\n\n/** Harness for interacting with a standard Material timepicker inputs in tests. */\nexport class MatTimepickerInputHarness extends ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory();\n static hostSelector = '.mat-timepicker-input';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatTimepickerInputHarness`\n * that meets certain criteria.\n * @param options Options for filtering which input instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends MatTimepickerInputHarness>(\n this: ComponentHarnessConstructor<T>,\n options: TimepickerInputHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options)\n .addOption('value', options.value, (harness, value) => {\n return HarnessPredicate.stringMatches(harness.getValue(), value);\n })\n .addOption('placeholder', options.placeholder, (harness, placeholder) => {\n return HarnessPredicate.stringMatches(harness.getPlaceholder(), placeholder);\n });\n }\n\n /** Gets whether the timepicker associated with the input is open. */\n async isTimepickerOpen(): Promise<boolean> {\n const host = await this.host();\n return (await host.getAttribute('aria-expanded')) === 'true';\n }\n\n /** Opens the timepicker associated with the input and returns the timepicker instance. */\n async openTimepicker(): Promise<MatTimepickerHarness> {\n if (!(await this.isDisabled())) {\n const host = await this.host();\n await host.sendKeys(TestKey.DOWN_ARROW);\n }\n\n return this.getTimepicker();\n }\n\n /** Closes the timepicker associated with the input. */\n async closeTimepicker(): Promise<void> {\n await this._documentRootLocator.rootElement.click();\n\n // This is necessary so that we wait for the closing animation.\n await this.forceStabilize();\n }\n\n /**\n * Gets the `MatTimepickerHarness` that is associated with the input.\n * @param filter Optionally filters which timepicker is included.\n */\n async getTimepicker(filter: TimepickerHarnessFilters = {}): Promise<MatTimepickerHarness> {\n const host = await this.host();\n const timepickerId = await host.getAttribute('mat-timepicker-id');\n\n if (!timepickerId) {\n throw Error('Element is not associated with a timepicker');\n }\n\n return this._documentRootLocator.locatorFor(\n MatTimepickerHarness.with({\n ...filter,\n selector: `[mat-timepicker-panel-id=\"${timepickerId}\"]`,\n }),\n )();\n }\n\n /** Whether the input is disabled. */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).getProperty<boolean>('disabled');\n }\n\n /** Whether the input is required. */\n async isRequired(): Promise<boolean> {\n return (await this.host()).getProperty<boolean>('required');\n }\n\n /** Gets the value of the input. */\n async getValue(): Promise<string> {\n // The \"value\" property of the native input is always defined.\n return await (await this.host()).getProperty<string>('value');\n }\n\n /**\n * Sets the value of the input. The value will be set by simulating\n * keypresses that correspond to the given value.\n */\n async setValue(newValue: string): Promise<void> {\n const inputEl = await this.host();\n await inputEl.clear();\n\n // We don't want to send keys for the value if the value is an empty\n // string in order to clear the value. Sending keys with an empty string\n // still results in unnecessary focus events.\n if (newValue) {\n await inputEl.sendKeys(newValue);\n }\n }\n\n /** Gets the placeholder of the input. */\n async getPlaceholder(): Promise<string> {\n return await (await this.host()).getProperty<string>('placeholder');\n }\n\n /**\n * Focuses the input and returns a promise that indicates when the\n * action is complete.\n */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /**\n * Blurs the input and returns a promise that indicates when the\n * action is complete.\n */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the input is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {TimepickerToggleHarnessFilters} from './timepicker-harness-filters';\n\n/** Harness for interacting with a standard Material timepicker toggle in tests. */\nexport class MatTimepickerToggleHarness extends ComponentHarness {\n static hostSelector = '.mat-timepicker-toggle';\n\n /** The clickable button inside the toggle. */\n private _button = this.locatorFor('button');\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatTimepickerToggleHarness` that\n * meets certain criteria.\n * @param options Options for filtering which timepicker toggle instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(\n options: TimepickerToggleHarnessFilters = {},\n ): HarnessPredicate<MatTimepickerToggleHarness> {\n return new HarnessPredicate(MatTimepickerToggleHarness, options);\n }\n\n /** Opens the timepicker associated with the toggle. */\n async openTimepicker(): Promise<void> {\n const isOpen = await this.isTimepickerOpen();\n\n if (!isOpen) {\n const button = await this._button();\n await button.click();\n }\n }\n\n /** Gets whether the timepicker associated with the toggle is open. */\n async isTimepickerOpen(): Promise<boolean> {\n const button = await this._button();\n const ariaExpanded = await button.getAttribute('aria-expanded');\n return ariaExpanded === 'true';\n }\n\n /** Whether the toggle is disabled. */\n async isDisabled(): Promise<boolean> {\n const button = await this._button();\n return coerceBooleanProperty(await button.getAttribute('disabled'));\n }\n}\n"],"names":[],"mappings":";;;;AAgBM,MAAO,oBAAqB,SAAQ,gBAAgB,CAAA;AAChD,IAAA,oBAAoB,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;AACjE,IAAA,OAAO,YAAY,GAAG,gBAAgB,CAAC;AAEvC;;;;;AAKG;AACH,IAAA,OAAO,IAAI,CAET,OAAA,GAAoC,EAAE,EAAA;AAEtC,QAAA,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KAC5C;;AAGD,IAAA,MAAM,MAAM,GAAA;AACV,QAAA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;AAChD,QAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7E,OAAO,KAAK,K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7
7
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
8
8
|
import { _getEventTarget } from '@angular/cdk/platform';
|
|
9
9
|
import { TAB, ESCAPE, hasModifierKey, ENTER, DOWN_ARROW, UP_ARROW } from '@angular/cdk/keycodes';
|
|
10
|
-
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
10
|
+
import { ActiveDescendantKeyManager, _IdGenerator } from '@angular/cdk/a11y';
|
|
11
11
|
import { Validators, NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
|
|
12
12
|
import { MAT_FORM_FIELD } from '@angular/material/form-field';
|
|
13
13
|
import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
|
|
@@ -93,69 +93,69 @@ function validateAdapter(adapter, formats) {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
/** Counter used to generate unique IDs. */
|
|
97
|
-
let uniqueId = 0;
|
|
98
96
|
/**
|
|
99
97
|
* Renders out a listbox that can be used to select a time of day.
|
|
100
98
|
* Intended to be used together with `MatTimepickerInput`.
|
|
101
99
|
*/
|
|
102
100
|
class MatTimepicker {
|
|
101
|
+
_overlay = inject(Overlay);
|
|
102
|
+
_dir = inject(Directionality, { optional: true });
|
|
103
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
104
|
+
_injector = inject(Injector);
|
|
105
|
+
_defaultConfig = inject(MAT_TIMEPICKER_CONFIG, { optional: true });
|
|
106
|
+
_dateAdapter = inject(DateAdapter, { optional: true });
|
|
107
|
+
_dateFormats = inject(MAT_DATE_FORMATS, { optional: true });
|
|
108
|
+
_isOpen = signal(false);
|
|
109
|
+
_activeDescendant = signal(null);
|
|
110
|
+
_input;
|
|
111
|
+
_overlayRef = null;
|
|
112
|
+
_portal = null;
|
|
113
|
+
_optionsCacheKey = null;
|
|
114
|
+
_localeChanges;
|
|
115
|
+
_onOpenRender = null;
|
|
116
|
+
_panelTemplate = viewChild.required('panelTemplate');
|
|
117
|
+
_timeOptions = [];
|
|
118
|
+
_options = viewChildren(MatOption);
|
|
119
|
+
_keyManager = new ActiveDescendantKeyManager(this._options, this._injector)
|
|
120
|
+
.withHomeAndEnd(true)
|
|
121
|
+
.withPageUpDown(true)
|
|
122
|
+
.withVerticalOrientation(true);
|
|
123
|
+
/**
|
|
124
|
+
* Interval between each option in the timepicker. The value can either be an amount of
|
|
125
|
+
* seconds (e.g. 90) or a number with a unit (e.g. 45m). Supported units are `s` for seconds,
|
|
126
|
+
* `m` for minutes or `h` for hours.
|
|
127
|
+
*/
|
|
128
|
+
interval = input(parseInterval(this._defaultConfig?.interval || null), { transform: parseInterval });
|
|
129
|
+
/**
|
|
130
|
+
* Array of pre-defined options that the user can select from, as an alternative to using the
|
|
131
|
+
* `interval` input. An error will be thrown if both `options` and `interval` are specified.
|
|
132
|
+
*/
|
|
133
|
+
options = input(null);
|
|
134
|
+
/** Whether the timepicker is open. */
|
|
135
|
+
isOpen = this._isOpen.asReadonly();
|
|
136
|
+
/** Emits when the user selects a time. */
|
|
137
|
+
selected = output();
|
|
138
|
+
/** Emits when the timepicker is opened. */
|
|
139
|
+
opened = output();
|
|
140
|
+
/** Emits when the timepicker is closed. */
|
|
141
|
+
closed = output();
|
|
142
|
+
/** ID of the active descendant option. */
|
|
143
|
+
activeDescendant = this._activeDescendant.asReadonly();
|
|
144
|
+
/** Unique ID of the timepicker's panel */
|
|
145
|
+
panelId = inject(_IdGenerator).getId('mat-timepicker-panel-');
|
|
146
|
+
/** Whether ripples within the timepicker should be disabled. */
|
|
147
|
+
disableRipple = input(this._defaultConfig?.disableRipple ?? false, {
|
|
148
|
+
transform: booleanAttribute,
|
|
149
|
+
});
|
|
150
|
+
/** ARIA label for the timepicker panel. */
|
|
151
|
+
ariaLabel = input(null, {
|
|
152
|
+
alias: 'aria-label',
|
|
153
|
+
});
|
|
154
|
+
/** ID of the label element for the timepicker panel. */
|
|
155
|
+
ariaLabelledby = input(null, {
|
|
156
|
+
alias: 'aria-labelledby',
|
|
157
|
+
});
|
|
103
158
|
constructor() {
|
|
104
|
-
this._overlay = inject(Overlay);
|
|
105
|
-
this._dir = inject(Directionality, { optional: true });
|
|
106
|
-
this._viewContainerRef = inject(ViewContainerRef);
|
|
107
|
-
this._injector = inject(Injector);
|
|
108
|
-
this._defaultConfig = inject(MAT_TIMEPICKER_CONFIG, { optional: true });
|
|
109
|
-
this._dateAdapter = inject(DateAdapter, { optional: true });
|
|
110
|
-
this._dateFormats = inject(MAT_DATE_FORMATS, { optional: true });
|
|
111
|
-
this._isOpen = signal(false);
|
|
112
|
-
this._activeDescendant = signal(null);
|
|
113
|
-
this._overlayRef = null;
|
|
114
|
-
this._portal = null;
|
|
115
|
-
this._optionsCacheKey = null;
|
|
116
|
-
this._onOpenRender = null;
|
|
117
|
-
this._panelTemplate = viewChild.required('panelTemplate');
|
|
118
|
-
this._timeOptions = [];
|
|
119
|
-
this._options = viewChildren(MatOption);
|
|
120
|
-
this._keyManager = new ActiveDescendantKeyManager(this._options, this._injector)
|
|
121
|
-
.withHomeAndEnd(true)
|
|
122
|
-
.withPageUpDown(true)
|
|
123
|
-
.withVerticalOrientation(true);
|
|
124
|
-
/**
|
|
125
|
-
* Interval between each option in the timepicker. The value can either be an amount of
|
|
126
|
-
* seconds (e.g. 90) or a number with a unit (e.g. 45m). Supported units are `s` for seconds,
|
|
127
|
-
* `m` for minutes or `h` for hours.
|
|
128
|
-
*/
|
|
129
|
-
this.interval = input(parseInterval(this._defaultConfig?.interval || null), { transform: parseInterval });
|
|
130
|
-
/**
|
|
131
|
-
* Array of pre-defined options that the user can select from, as an alternative to using the
|
|
132
|
-
* `interval` input. An error will be thrown if both `options` and `interval` are specified.
|
|
133
|
-
*/
|
|
134
|
-
this.options = input(null);
|
|
135
|
-
/** Whether the timepicker is open. */
|
|
136
|
-
this.isOpen = this._isOpen.asReadonly();
|
|
137
|
-
/** Emits when the user selects a time. */
|
|
138
|
-
this.selected = output();
|
|
139
|
-
/** Emits when the timepicker is opened. */
|
|
140
|
-
this.opened = output();
|
|
141
|
-
/** Emits when the timepicker is closed. */
|
|
142
|
-
this.closed = output();
|
|
143
|
-
/** ID of the active descendant option. */
|
|
144
|
-
this.activeDescendant = this._activeDescendant.asReadonly();
|
|
145
|
-
/** Unique ID of the timepicker's panel */
|
|
146
|
-
this.panelId = `mat-timepicker-panel-${uniqueId++}`;
|
|
147
|
-
/** Whether ripples within the timepicker should be disabled. */
|
|
148
|
-
this.disableRipple = input(this._defaultConfig?.disableRipple ?? false, {
|
|
149
|
-
transform: booleanAttribute,
|
|
150
|
-
});
|
|
151
|
-
/** ARIA label for the timepicker panel. */
|
|
152
|
-
this.ariaLabel = input(null, {
|
|
153
|
-
alias: 'aria-label',
|
|
154
|
-
});
|
|
155
|
-
/** ID of the label element for the timepicker panel. */
|
|
156
|
-
this.ariaLabelledby = input(null, {
|
|
157
|
-
alias: 'aria-labelledby',
|
|
158
|
-
});
|
|
159
159
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
160
160
|
validateAdapter(this._dateAdapter, this._dateFormats);
|
|
161
161
|
effect(() => {
|
|
@@ -382,8 +382,8 @@ class MatTimepicker {
|
|
|
382
382
|
}
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
|
-
static
|
|
386
|
-
static
|
|
385
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatTimepicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
386
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.0-rc.0", type: MatTimepicker, isStandalone: true, selector: "mat-timepicker", inputs: { interval: { classPropertyName: "interval", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, disableRipple: { classPropertyName: "disableRipple", publicName: "disableRipple", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected", opened: "opened", closed: "closed" }, providers: [
|
|
387
387
|
{
|
|
388
388
|
provide: MAT_OPTION_PARENT_COMPONENT,
|
|
389
389
|
useExisting: MatTimepicker,
|
|
@@ -399,9 +399,9 @@ class MatTimepicker {
|
|
|
399
399
|
]),
|
|
400
400
|
transition(':leave', [animate('0.075s linear', style({ opacity: 0 }))]),
|
|
401
401
|
]),
|
|
402
|
-
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
402
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
403
403
|
}
|
|
404
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
404
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatTimepicker, decorators: [{
|
|
405
405
|
type: Component,
|
|
406
406
|
args: [{ selector: 'mat-timepicker', exportAs: 'matTimepicker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [MatOption], providers: [
|
|
407
407
|
{
|
|
@@ -434,62 +434,64 @@ function scrollOptionIntoView(option, position) {
|
|
|
434
434
|
* Input that can be used to enter time and connect to a `mat-timepicker`.
|
|
435
435
|
*/
|
|
436
436
|
class MatTimepickerInput {
|
|
437
|
+
_elementRef = inject(ElementRef);
|
|
438
|
+
_document = inject(DOCUMENT);
|
|
439
|
+
_dateAdapter = inject(DateAdapter, { optional: true });
|
|
440
|
+
_dateFormats = inject(MAT_DATE_FORMATS, { optional: true });
|
|
441
|
+
_formField = inject(MAT_FORM_FIELD, { optional: true });
|
|
442
|
+
_onChange;
|
|
443
|
+
_onTouched;
|
|
444
|
+
_validatorOnChange;
|
|
445
|
+
_accessorDisabled = signal(false);
|
|
446
|
+
_localeSubscription;
|
|
447
|
+
_timepickerSubscription;
|
|
448
|
+
_validator;
|
|
449
|
+
_lastValueValid = true;
|
|
450
|
+
_lastValidDate = null;
|
|
451
|
+
/** Value of the `aria-activedescendant` attribute. */
|
|
452
|
+
_ariaActiveDescendant = computed(() => {
|
|
453
|
+
const timepicker = this.timepicker();
|
|
454
|
+
const isOpen = timepicker.isOpen();
|
|
455
|
+
const activeDescendant = timepicker.activeDescendant();
|
|
456
|
+
return isOpen && activeDescendant ? activeDescendant : null;
|
|
457
|
+
});
|
|
458
|
+
/** Value of the `aria-expanded` attribute. */
|
|
459
|
+
_ariaExpanded = computed(() => this.timepicker().isOpen() + '');
|
|
460
|
+
/** Value of the `aria-controls` attribute. */
|
|
461
|
+
_ariaControls = computed(() => {
|
|
462
|
+
const timepicker = this.timepicker();
|
|
463
|
+
return timepicker.isOpen() ? timepicker.panelId : null;
|
|
464
|
+
});
|
|
465
|
+
/** Current value of the input. */
|
|
466
|
+
value = model(null);
|
|
467
|
+
/** Timepicker that the input is associated with. */
|
|
468
|
+
timepicker = input.required({
|
|
469
|
+
alias: 'matTimepicker',
|
|
470
|
+
});
|
|
471
|
+
/**
|
|
472
|
+
* Minimum time that can be selected or typed in. Can be either
|
|
473
|
+
* a date object (only time will be used) or a valid time string.
|
|
474
|
+
*/
|
|
475
|
+
min = input(null, {
|
|
476
|
+
alias: 'matTimepickerMin',
|
|
477
|
+
transform: (value) => this._transformDateInput(value),
|
|
478
|
+
});
|
|
479
|
+
/**
|
|
480
|
+
* Maximum time that can be selected or typed in. Can be either
|
|
481
|
+
* a date object (only time will be used) or a valid time string.
|
|
482
|
+
*/
|
|
483
|
+
max = input(null, {
|
|
484
|
+
alias: 'matTimepickerMax',
|
|
485
|
+
transform: (value) => this._transformDateInput(value),
|
|
486
|
+
});
|
|
487
|
+
/** Whether the input is disabled. */
|
|
488
|
+
disabled = computed(() => this.disabledInput() || this._accessorDisabled());
|
|
489
|
+
/** Whether the input should be disabled through the template. */
|
|
490
|
+
disabledInput = input(false, {
|
|
491
|
+
transform: booleanAttribute,
|
|
492
|
+
alias: 'disabled',
|
|
493
|
+
});
|
|
437
494
|
constructor() {
|
|
438
|
-
this._elementRef = inject(ElementRef);
|
|
439
|
-
this._document = inject(DOCUMENT);
|
|
440
|
-
this._dateAdapter = inject(DateAdapter, { optional: true });
|
|
441
|
-
this._dateFormats = inject(MAT_DATE_FORMATS, { optional: true });
|
|
442
|
-
this._formField = inject(MAT_FORM_FIELD, { optional: true });
|
|
443
|
-
this._accessorDisabled = signal(false);
|
|
444
|
-
this._lastValueValid = false;
|
|
445
|
-
this._lastValidDate = null;
|
|
446
|
-
/** Value of the `aria-activedescendant` attribute. */
|
|
447
|
-
this._ariaActiveDescendant = computed(() => {
|
|
448
|
-
const timepicker = this.timepicker();
|
|
449
|
-
const isOpen = timepicker.isOpen();
|
|
450
|
-
const activeDescendant = timepicker.activeDescendant();
|
|
451
|
-
return isOpen && activeDescendant ? activeDescendant : null;
|
|
452
|
-
});
|
|
453
|
-
/** Value of the `aria-expanded` attribute. */
|
|
454
|
-
this._ariaExpanded = computed(() => this.timepicker().isOpen() + '');
|
|
455
|
-
/** Value of the `aria-controls` attribute. */
|
|
456
|
-
this._ariaControls = computed(() => {
|
|
457
|
-
const timepicker = this.timepicker();
|
|
458
|
-
return timepicker.isOpen() ? timepicker.panelId : null;
|
|
459
|
-
});
|
|
460
|
-
/** Current value of the input. */
|
|
461
|
-
this.value = model(null);
|
|
462
|
-
/** Timepicker that the input is associated with. */
|
|
463
|
-
this.timepicker = input.required({
|
|
464
|
-
alias: 'matTimepicker',
|
|
465
|
-
});
|
|
466
|
-
/**
|
|
467
|
-
* Minimum time that can be selected or typed in. Can be either
|
|
468
|
-
* a date object (only time will be used) or a valid time string.
|
|
469
|
-
*/
|
|
470
|
-
this.min = input(null, {
|
|
471
|
-
alias: 'matTimepickerMin',
|
|
472
|
-
transform: (value) => this._transformDateInput(value),
|
|
473
|
-
});
|
|
474
|
-
/**
|
|
475
|
-
* Maximum time that can be selected or typed in. Can be either
|
|
476
|
-
* a date object (only time will be used) or a valid time string.
|
|
477
|
-
*/
|
|
478
|
-
this.max = input(null, {
|
|
479
|
-
alias: 'matTimepickerMax',
|
|
480
|
-
transform: (value) => this._transformDateInput(value),
|
|
481
|
-
});
|
|
482
|
-
/** Whether the input is disabled. */
|
|
483
|
-
this.disabled = computed(() => this.disabledInput() || this._accessorDisabled());
|
|
484
|
-
/** Whether the input should be disabled through the template. */
|
|
485
|
-
this.disabledInput = input(false, {
|
|
486
|
-
transform: booleanAttribute,
|
|
487
|
-
alias: 'disabled',
|
|
488
|
-
});
|
|
489
|
-
/** Handles clicks on the input or the containing form field. */
|
|
490
|
-
this._handleClick = () => {
|
|
491
|
-
this.timepicker().open();
|
|
492
|
-
};
|
|
493
495
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
494
496
|
validateAdapter(this._dateAdapter, this._dateFormats);
|
|
495
497
|
}
|
|
@@ -565,6 +567,10 @@ class MatTimepickerInput {
|
|
|
565
567
|
_getLabelId() {
|
|
566
568
|
return this._formField?.getLabelId() || null;
|
|
567
569
|
}
|
|
570
|
+
/** Handles clicks on the input or the containing form field. */
|
|
571
|
+
_handleClick = () => {
|
|
572
|
+
this.timepicker().open();
|
|
573
|
+
};
|
|
568
574
|
/** Handles the `input` event. */
|
|
569
575
|
_handleInput(value) {
|
|
570
576
|
const currentValue = this.value();
|
|
@@ -716,8 +722,8 @@ class MatTimepickerInput {
|
|
|
716
722
|
},
|
|
717
723
|
]);
|
|
718
724
|
}
|
|
719
|
-
static
|
|
720
|
-
static
|
|
725
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatTimepickerInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
726
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0-rc.0", type: MatTimepickerInput, isStandalone: true, selector: "input[matTimepicker]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, timepicker: { classPropertyName: "timepicker", publicName: "matTimepicker", isSignal: true, isRequired: true, transformFunction: null }, min: { classPropertyName: "min", publicName: "matTimepickerMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "matTimepickerMax", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "combobox", "type": "text", "aria-haspopup": "listbox" }, listeners: { "blur": "_handleBlur()", "input": "_handleInput($event.target.value)", "keydown": "_handleKeydown($event)" }, properties: { "attr.aria-activedescendant": "_ariaActiveDescendant()", "attr.aria-expanded": "_ariaExpanded()", "attr.aria-controls": "_ariaControls()", "attr.mat-timepicker-id": "timepicker()?.panelId", "disabled": "disabled()" }, classAttribute: "mat-timepicker-input" }, providers: [
|
|
721
727
|
{
|
|
722
728
|
provide: NG_VALUE_ACCESSOR,
|
|
723
729
|
useExisting: MatTimepickerInput,
|
|
@@ -732,9 +738,9 @@ class MatTimepickerInput {
|
|
|
732
738
|
provide: MAT_INPUT_VALUE_ACCESSOR,
|
|
733
739
|
useExisting: MatTimepickerInput,
|
|
734
740
|
},
|
|
735
|
-
], exportAs: ["matTimepickerInput"], ngImport: i0 });
|
|
741
|
+
], exportAs: ["matTimepickerInput"], ngImport: i0 });
|
|
736
742
|
}
|
|
737
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
743
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatTimepickerInput, decorators: [{
|
|
738
744
|
type: Directive,
|
|
739
745
|
args: [{
|
|
740
746
|
selector: 'input[matTimepicker]',
|
|
@@ -774,31 +780,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10",
|
|
|
774
780
|
|
|
775
781
|
/** Button that can be used to open a `mat-timepicker`. */
|
|
776
782
|
class MatTimepickerToggle {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
this.disableRipple = input(this._defaultConfig?.disableRipple ?? false, { transform: booleanAttribute });
|
|
801
|
-
}
|
|
783
|
+
_defaultConfig = inject(MAT_TIMEPICKER_CONFIG, { optional: true });
|
|
784
|
+
_defaultTabIndex = (() => {
|
|
785
|
+
const value = inject(new HostAttributeToken('tabindex'), { optional: true });
|
|
786
|
+
const parsed = Number(value);
|
|
787
|
+
return isNaN(parsed) ? null : parsed;
|
|
788
|
+
})();
|
|
789
|
+
/** Timepicker instance that the button will toggle. */
|
|
790
|
+
timepicker = input.required({
|
|
791
|
+
alias: 'for',
|
|
792
|
+
});
|
|
793
|
+
/** Screen-reader label for the button. */
|
|
794
|
+
ariaLabel = input(undefined, {
|
|
795
|
+
alias: 'aria-label',
|
|
796
|
+
});
|
|
797
|
+
/** Whether the toggle button is disabled. */
|
|
798
|
+
disabled = input(false, {
|
|
799
|
+
transform: booleanAttribute,
|
|
800
|
+
alias: 'disabled',
|
|
801
|
+
});
|
|
802
|
+
/** Tabindex for the toggle. */
|
|
803
|
+
tabIndex = input(this._defaultTabIndex);
|
|
804
|
+
/** Whether ripples on the toggle should be disabled. */
|
|
805
|
+
disableRipple = input(this._defaultConfig?.disableRipple ?? false, { transform: booleanAttribute });
|
|
802
806
|
/** Opens the connected timepicker. */
|
|
803
807
|
_open(event) {
|
|
804
808
|
if (this.timepicker() && !this.disabled()) {
|
|
@@ -806,10 +810,10 @@ class MatTimepickerToggle {
|
|
|
806
810
|
event.stopPropagation();
|
|
807
811
|
}
|
|
808
812
|
}
|
|
809
|
-
static
|
|
810
|
-
static
|
|
813
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatTimepickerToggle, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
814
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.0-rc.0", type: MatTimepickerToggle, isStandalone: true, selector: "mat-timepicker-toggle", inputs: { timepicker: { classPropertyName: "timepicker", publicName: "for", isSignal: true, isRequired: true, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, disableRipple: { classPropertyName: "disableRipple", publicName: "disableRipple", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "_open($event)" }, properties: { "attr.tabindex": "null" }, classAttribute: "mat-timepicker-toggle" }, exportAs: ["matTimepickerToggle"], ngImport: i0, template: "<button\n mat-icon-button\n type=\"button\"\n aria-haspopup=\"listbox\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-expanded]=\"timepicker().isOpen()\"\n [attr.tabindex]=\"disabled() ? -1 : tabIndex()\"\n [disabled]=\"disabled()\"\n [disableRipple]=\"disableRipple()\">\n\n <ng-content select=\"[matTimepickerToggleIcon]\">\n <svg\n class=\"mat-timepicker-toggle-default-icon\"\n height=\"24px\"\n width=\"24px\"\n viewBox=\"0 -960 960 960\"\n fill=\"currentColor\"\n focusable=\"false\"\n aria-hidden=\"true\">\n <path d=\"m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z\"/>\n </svg>\n </ng-content>\n</button>\n", dependencies: [{ kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
811
815
|
}
|
|
812
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
816
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatTimepickerToggle, decorators: [{
|
|
813
817
|
type: Component,
|
|
814
818
|
args: [{ selector: 'mat-timepicker-toggle', host: {
|
|
815
819
|
'class': 'mat-timepicker-toggle',
|
|
@@ -822,11 +826,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10",
|
|
|
822
826
|
}] });
|
|
823
827
|
|
|
824
828
|
class MatTimepickerModule {
|
|
825
|
-
static
|
|
826
|
-
static
|
|
827
|
-
static
|
|
829
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatTimepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
830
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatTimepickerModule, imports: [MatTimepicker, MatTimepickerInput, MatTimepickerToggle], exports: [CdkScrollableModule, MatTimepicker, MatTimepickerInput, MatTimepickerToggle] });
|
|
831
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatTimepickerModule, imports: [MatTimepicker, MatTimepickerToggle, CdkScrollableModule] });
|
|
828
832
|
}
|
|
829
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
833
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: MatTimepickerModule, decorators: [{
|
|
830
834
|
type: NgModule,
|
|
831
835
|
args: [{
|
|
832
836
|
imports: [MatTimepicker, MatTimepickerInput, MatTimepickerToggle],
|