@kato-lee/cdk 14.2.7
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/LICENSE +21 -0
- package/README.md +8 -0
- package/_index.scss +8 -0
- package/a11y/_index.import.scss +2 -0
- package/a11y/_index.scss +102 -0
- package/a11y/index.d.ts +1212 -0
- package/a11y-prebuilt.css +1 -0
- package/accordion/index.d.ts +140 -0
- package/bidi/index.d.ts +80 -0
- package/clipboard/index.d.ts +115 -0
- package/coercion/index.d.ts +67 -0
- package/collections/index.d.ts +374 -0
- package/dialog/index.d.ts +469 -0
- package/drag-drop/index.d.ts +1614 -0
- package/esm2020/a11y/a11y-module.mjs +32 -0
- package/esm2020/a11y/a11y_public_index.mjs +5 -0
- package/esm2020/a11y/aria-describer/aria-describer.mjs +232 -0
- package/esm2020/a11y/aria-describer/aria-reference.mjs +44 -0
- package/esm2020/a11y/fake-event-detection.mjs +31 -0
- package/esm2020/a11y/focus-monitor/focus-monitor.mjs +451 -0
- package/esm2020/a11y/focus-trap/configurable-focus-trap-config.mjs +9 -0
- package/esm2020/a11y/focus-trap/configurable-focus-trap-factory.mjs +53 -0
- package/esm2020/a11y/focus-trap/configurable-focus-trap.mjs +51 -0
- package/esm2020/a11y/focus-trap/event-listener-inert-strategy.mjs +61 -0
- package/esm2020/a11y/focus-trap/focus-trap-inert-strategy.mjs +11 -0
- package/esm2020/a11y/focus-trap/focus-trap-manager.mjs +53 -0
- package/esm2020/a11y/focus-trap/focus-trap.mjs +402 -0
- package/esm2020/a11y/high-contrast-mode/high-contrast-mode-detector.mjs +109 -0
- package/esm2020/a11y/index.mjs +9 -0
- package/esm2020/a11y/input-modality/input-modality-detector.mjs +176 -0
- package/esm2020/a11y/interactivity-checker/interactivity-checker.mjs +238 -0
- package/esm2020/a11y/key-manager/activedescendant-key-manager.mjs +20 -0
- package/esm2020/a11y/key-manager/focus-key-manager.mjs +29 -0
- package/esm2020/a11y/key-manager/list-key-manager.mjs +321 -0
- package/esm2020/a11y/live-announcer/live-announcer-tokens.mjs +19 -0
- package/esm2020/a11y/live-announcer/live-announcer.mjs +178 -0
- package/esm2020/a11y/public-api.mjs +26 -0
- package/esm2020/accordion/accordion-item.mjs +167 -0
- package/esm2020/accordion/accordion-module.mjs +24 -0
- package/esm2020/accordion/accordion.mjs +70 -0
- package/esm2020/accordion/accordion_public_index.mjs +5 -0
- package/esm2020/accordion/index.mjs +9 -0
- package/esm2020/accordion/public-api.mjs +11 -0
- package/esm2020/bidi/bidi-module.mjs +23 -0
- package/esm2020/bidi/bidi_public_index.mjs +5 -0
- package/esm2020/bidi/dir-document-token.mjs +33 -0
- package/esm2020/bidi/dir.mjs +69 -0
- package/esm2020/bidi/directionality.mjs +52 -0
- package/esm2020/bidi/index.mjs +9 -0
- package/esm2020/bidi/public-api.mjs +12 -0
- package/esm2020/clipboard/clipboard-module.mjs +23 -0
- package/esm2020/clipboard/clipboard.mjs +53 -0
- package/esm2020/clipboard/clipboard_public_index.mjs +5 -0
- package/esm2020/clipboard/copy-to-clipboard.mjs +99 -0
- package/esm2020/clipboard/index.mjs +9 -0
- package/esm2020/clipboard/pending-copy.mjs +69 -0
- package/esm2020/clipboard/public-api.mjs +12 -0
- package/esm2020/coercion/array.mjs +11 -0
- package/esm2020/coercion/boolean-property.mjs +12 -0
- package/esm2020/coercion/css-pixel-value.mjs +15 -0
- package/esm2020/coercion/element.mjs +16 -0
- package/esm2020/coercion/index.mjs +9 -0
- package/esm2020/coercion/number-property.mjs +21 -0
- package/esm2020/coercion/public-api.mjs +14 -0
- package/esm2020/coercion/string-array.mjs +38 -0
- package/esm2020/collections/array-data-source.mjs +21 -0
- package/esm2020/collections/collection-viewer.mjs +9 -0
- package/esm2020/collections/collections_public_index.mjs +5 -0
- package/esm2020/collections/data-source.mjs +19 -0
- package/esm2020/collections/dispose-view-repeater-strategy.mjs +47 -0
- package/esm2020/collections/index.mjs +9 -0
- package/esm2020/collections/public-api.mjs +17 -0
- package/esm2020/collections/recycle-view-repeater-strategy.mjs +128 -0
- package/esm2020/collections/selection-model.mjs +216 -0
- package/esm2020/collections/tree-adapter.mjs +9 -0
- package/esm2020/collections/unique-selection-dispatcher.mjs +55 -0
- package/esm2020/collections/view-repeater.mjs +14 -0
- package/esm2020/dialog/dialog-config.mjs +63 -0
- package/esm2020/dialog/dialog-container.mjs +278 -0
- package/esm2020/dialog/dialog-injectors.mjs +26 -0
- package/esm2020/dialog/dialog-module.mjs +42 -0
- package/esm2020/dialog/dialog-ref.mjs +76 -0
- package/esm2020/dialog/dialog.mjs +301 -0
- package/esm2020/dialog/dialog_public_index.mjs +5 -0
- package/esm2020/dialog/index.mjs +9 -0
- package/esm2020/dialog/public-api.mjs +14 -0
- package/esm2020/drag-drop/directives/assertions.mjs +18 -0
- package/esm2020/drag-drop/directives/config.mjs +14 -0
- package/esm2020/drag-drop/directives/drag-handle.mjs +66 -0
- package/esm2020/drag-drop/directives/drag-placeholder.mjs +36 -0
- package/esm2020/drag-drop/directives/drag-preview.mjs +47 -0
- package/esm2020/drag-drop/directives/drag.mjs +487 -0
- package/esm2020/drag-drop/directives/drop-list-group.mjs +53 -0
- package/esm2020/drag-drop/directives/drop-list.mjs +345 -0
- package/esm2020/drag-drop/dom/client-rect.mjs +64 -0
- package/esm2020/drag-drop/dom/clone-node.mjs +65 -0
- package/esm2020/drag-drop/dom/parent-position-tracker.mjs +76 -0
- package/esm2020/drag-drop/dom/styling.mjs +69 -0
- package/esm2020/drag-drop/dom/transition-duration.mjs +36 -0
- package/esm2020/drag-drop/drag-drop-module.mjs +57 -0
- package/esm2020/drag-drop/drag-drop-registry.mjs +231 -0
- package/esm2020/drag-drop/drag-drop.mjs +57 -0
- package/esm2020/drag-drop/drag-drop_public_index.mjs +5 -0
- package/esm2020/drag-drop/drag-events.mjs +9 -0
- package/esm2020/drag-drop/drag-parent.mjs +16 -0
- package/esm2020/drag-drop/drag-ref.mjs +1146 -0
- package/esm2020/drag-drop/drag-utils.mjs +60 -0
- package/esm2020/drag-drop/drop-list-ref.mjs +577 -0
- package/esm2020/drag-drop/index.mjs +9 -0
- package/esm2020/drag-drop/public-api.mjs +23 -0
- package/esm2020/drag-drop/sorting/drop-list-sort-strategy.mjs +9 -0
- package/esm2020/drag-drop/sorting/single-axis-sort-strategy.mjs +341 -0
- package/esm2020/index.mjs +9 -0
- package/esm2020/keycodes/index.mjs +9 -0
- package/esm2020/keycodes/keycodes.mjs +127 -0
- package/esm2020/keycodes/keycodes_public_index.mjs +5 -0
- package/esm2020/keycodes/modifiers.mjs +18 -0
- package/esm2020/keycodes/public-api.mjs +10 -0
- package/esm2020/layout/breakpoints-observer.mjs +105 -0
- package/esm2020/layout/breakpoints.mjs +29 -0
- package/esm2020/layout/index.mjs +9 -0
- package/esm2020/layout/layout-module.mjs +19 -0
- package/esm2020/layout/layout_public_index.mjs +5 -0
- package/esm2020/layout/media-matcher.mjs +85 -0
- package/esm2020/layout/public-api.mjs +12 -0
- package/esm2020/listbox/index.mjs +9 -0
- package/esm2020/listbox/listbox-module.mjs +24 -0
- package/esm2020/listbox/listbox.mjs +872 -0
- package/esm2020/listbox/listbox_public_index.mjs +5 -0
- package/esm2020/listbox/public-api.mjs +10 -0
- package/esm2020/menu/context-menu-trigger.mjs +212 -0
- package/esm2020/menu/index.mjs +9 -0
- package/esm2020/menu/menu-aim.mjs +203 -0
- package/esm2020/menu/menu-bar.mjs +133 -0
- package/esm2020/menu/menu-base.mjs +187 -0
- package/esm2020/menu/menu-errors.mjs +22 -0
- package/esm2020/menu/menu-group.mjs +30 -0
- package/esm2020/menu/menu-interface.mjs +11 -0
- package/esm2020/menu/menu-item-checkbox.mjs +49 -0
- package/esm2020/menu/menu-item-radio.mjs +71 -0
- package/esm2020/menu/menu-item-selectable.mjs +42 -0
- package/esm2020/menu/menu-item.mjs +267 -0
- package/esm2020/menu/menu-module.mjs +62 -0
- package/esm2020/menu/menu-stack.mjs +156 -0
- package/esm2020/menu/menu-trigger-base.mjs +107 -0
- package/esm2020/menu/menu-trigger.mjs +291 -0
- package/esm2020/menu/menu.mjs +134 -0
- package/esm2020/menu/menu_public_index.mjs +5 -0
- package/esm2020/menu/pointer-focus-tracker.mjs +51 -0
- package/esm2020/menu/public-api.mjs +24 -0
- package/esm2020/observers/index.mjs +9 -0
- package/esm2020/observers/observe-content.mjs +187 -0
- package/esm2020/observers/observers_public_index.mjs +5 -0
- package/esm2020/observers/public-api.mjs +9 -0
- package/esm2020/overlay/dispatchers/base-overlay-dispatcher.mjs +52 -0
- package/esm2020/overlay/dispatchers/index.mjs +10 -0
- package/esm2020/overlay/dispatchers/overlay-keyboard-dispatcher.mjs +81 -0
- package/esm2020/overlay/dispatchers/overlay-outside-click-dispatcher.mjs +138 -0
- package/esm2020/overlay/fullscreen-overlay-container.mjs +94 -0
- package/esm2020/overlay/index.mjs +9 -0
- package/esm2020/overlay/overlay-config.mjs +45 -0
- package/esm2020/overlay/overlay-container.mjs +81 -0
- package/esm2020/overlay/overlay-directives.mjs +427 -0
- package/esm2020/overlay/overlay-module.mjs +29 -0
- package/esm2020/overlay/overlay-ref.mjs +427 -0
- package/esm2020/overlay/overlay-reference.mjs +9 -0
- package/esm2020/overlay/overlay.mjs +125 -0
- package/esm2020/overlay/overlay_public_index.mjs +5 -0
- package/esm2020/overlay/position/connected-position.mjs +88 -0
- package/esm2020/overlay/position/flexible-connected-position-strategy.mjs +985 -0
- package/esm2020/overlay/position/global-position-strategy.mjs +237 -0
- package/esm2020/overlay/position/overlay-position-builder.mjs +50 -0
- package/esm2020/overlay/position/position-strategy.mjs +9 -0
- package/esm2020/overlay/position/scroll-clip.mjs +40 -0
- package/esm2020/overlay/public-api.mjs +22 -0
- package/esm2020/overlay/scroll/block-scroll-strategy.mjs +80 -0
- package/esm2020/overlay/scroll/close-scroll-strategy.mjs +61 -0
- package/esm2020/overlay/scroll/index.mjs +14 -0
- package/esm2020/overlay/scroll/noop-scroll-strategy.mjs +17 -0
- package/esm2020/overlay/scroll/reposition-scroll-strategy.mjs +61 -0
- package/esm2020/overlay/scroll/scroll-strategy-options.mjs +55 -0
- package/esm2020/overlay/scroll/scroll-strategy.mjs +14 -0
- package/esm2020/platform/features/input-types.mjs +59 -0
- package/esm2020/platform/features/passive-listeners.mjs +36 -0
- package/esm2020/platform/features/scrolling.mjs +85 -0
- package/esm2020/platform/features/shadow-dom.mjs +54 -0
- package/esm2020/platform/features/test-environment.mjs +24 -0
- package/esm2020/platform/index.mjs +9 -0
- package/esm2020/platform/platform-module.mjs +19 -0
- package/esm2020/platform/platform.mjs +85 -0
- package/esm2020/platform/platform_public_index.mjs +5 -0
- package/esm2020/platform/public-api.mjs +15 -0
- package/esm2020/portal/dom-portal-outlet.mjs +158 -0
- package/esm2020/portal/index.mjs +9 -0
- package/esm2020/portal/portal-directives.mjs +246 -0
- package/esm2020/portal/portal-errors.mjs +51 -0
- package/esm2020/portal/portal-injector.mjs +28 -0
- package/esm2020/portal/portal.mjs +188 -0
- package/esm2020/portal/portal_public_index.mjs +5 -0
- package/esm2020/portal/public-api.mjs +12 -0
- package/esm2020/public-api.mjs +9 -0
- package/esm2020/scrolling/fixed-size-virtual-scroll.mjs +217 -0
- package/esm2020/scrolling/index.mjs +9 -0
- package/esm2020/scrolling/public-api.mjs +20 -0
- package/esm2020/scrolling/scroll-dispatcher.mjs +163 -0
- package/esm2020/scrolling/scrollable.mjs +176 -0
- package/esm2020/scrolling/scrolling-module.mjs +67 -0
- package/esm2020/scrolling/scrolling_public_index.mjs +5 -0
- package/esm2020/scrolling/viewport-ruler.mjs +146 -0
- package/esm2020/scrolling/virtual-for-of.mjs +298 -0
- package/esm2020/scrolling/virtual-scroll-repeater.mjs +9 -0
- package/esm2020/scrolling/virtual-scroll-strategy.mjs +11 -0
- package/esm2020/scrolling/virtual-scroll-viewport.mjs +437 -0
- package/esm2020/scrolling/virtual-scrollable-element.mjs +41 -0
- package/esm2020/scrolling/virtual-scrollable-window.mjs +40 -0
- package/esm2020/scrolling/virtual-scrollable.mjs +40 -0
- package/esm2020/stepper/index.mjs +9 -0
- package/esm2020/stepper/public-api.mjs +13 -0
- package/esm2020/stepper/step-header.mjs +30 -0
- package/esm2020/stepper/step-label.mjs +23 -0
- package/esm2020/stepper/stepper-button.mjs +56 -0
- package/esm2020/stepper/stepper-module.mjs +40 -0
- package/esm2020/stepper/stepper.mjs +458 -0
- package/esm2020/stepper/stepper_public_index.mjs +5 -0
- package/esm2020/table/can-stick.mjs +44 -0
- package/esm2020/table/cell.mjs +217 -0
- package/esm2020/table/coalesced-style-scheduler.mjs +91 -0
- package/esm2020/table/index.mjs +9 -0
- package/esm2020/table/public-api.mjs +20 -0
- package/esm2020/table/row.mjs +262 -0
- package/esm2020/table/sticky-position-listener.mjs +11 -0
- package/esm2020/table/sticky-styler.mjs +345 -0
- package/esm2020/table/table-errors.mjs +67 -0
- package/esm2020/table/table-module.mjs +94 -0
- package/esm2020/table/table.mjs +1065 -0
- package/esm2020/table/table_public_index.mjs +5 -0
- package/esm2020/table/text-column.mjs +153 -0
- package/esm2020/table/tokens.mjs +16 -0
- package/esm2020/text-field/autofill.mjs +113 -0
- package/esm2020/text-field/autosize.mjs +309 -0
- package/esm2020/text-field/index.mjs +9 -0
- package/esm2020/text-field/public-api.mjs +11 -0
- package/esm2020/text-field/text-field-module.mjs +24 -0
- package/esm2020/text-field/text-field_public_index.mjs +5 -0
- package/esm2020/tree/control/base-tree-control.mjs +57 -0
- package/esm2020/tree/control/flat-tree-control.mjs +51 -0
- package/esm2020/tree/control/nested-tree-control.mjs +58 -0
- package/esm2020/tree/control/tree-control.mjs +2 -0
- package/esm2020/tree/index.mjs +9 -0
- package/esm2020/tree/nested-node.mjs +112 -0
- package/esm2020/tree/node.mjs +35 -0
- package/esm2020/tree/outlet.mjs +39 -0
- package/esm2020/tree/padding.mjs +131 -0
- package/esm2020/tree/public-api.mjs +20 -0
- package/esm2020/tree/toggle.mjs +50 -0
- package/esm2020/tree/tree-errors.mjs +43 -0
- package/esm2020/tree/tree-module.mjs +49 -0
- package/esm2020/tree/tree.mjs +347 -0
- package/esm2020/tree/tree_public_index.mjs +5 -0
- package/esm2020/version.mjs +11 -0
- package/fesm2015/a11y.mjs +2473 -0
- package/fesm2015/a11y.mjs.map +1 -0
- package/fesm2015/accordion.mjs +414 -0
- package/fesm2015/accordion.mjs.map +1 -0
- package/fesm2015/bidi.mjs +194 -0
- package/fesm2015/bidi.mjs.map +1 -0
- package/fesm2015/cdk.mjs +30 -0
- package/fesm2015/cdk.mjs.map +1 -0
- package/fesm2015/clipboard.mjs +263 -0
- package/fesm2015/clipboard.mjs.map +1 -0
- package/fesm2015/coercion.mjs +132 -0
- package/fesm2015/coercion.mjs.map +1 -0
- package/fesm2015/collections.mjs +519 -0
- package/fesm2015/collections.mjs.map +1 -0
- package/fesm2015/dialog.mjs +1050 -0
- package/fesm2015/dialog.mjs.map +1 -0
- package/fesm2015/drag-drop.mjs +3812 -0
- package/fesm2015/drag-drop.mjs.map +1 -0
- package/fesm2015/keycodes.mjs +167 -0
- package/fesm2015/keycodes.mjs.map +1 -0
- package/fesm2015/layout.mjs +337 -0
- package/fesm2015/layout.mjs.map +1 -0
- package/fesm2015/listbox.mjs +1200 -0
- package/fesm2015/listbox.mjs.map +1 -0
- package/fesm2015/menu.mjs +2719 -0
- package/fesm2015/menu.mjs.map +1 -0
- package/fesm2015/observers.mjs +326 -0
- package/fesm2015/observers.mjs.map +1 -0
- package/fesm2015/overlay.mjs +3137 -0
- package/fesm2015/overlay.mjs.map +1 -0
- package/fesm2015/platform.mjs +385 -0
- package/fesm2015/platform.mjs.map +1 -0
- package/fesm2015/portal.mjs +691 -0
- package/fesm2015/portal.mjs.map +1 -0
- package/fesm2015/scrolling.mjs +1558 -0
- package/fesm2015/scrolling.mjs.map +1 -0
- package/fesm2015/stepper.mjs +989 -0
- package/fesm2015/stepper.mjs.map +1 -0
- package/fesm2015/table.mjs +2356 -0
- package/fesm2015/table.mjs.map +1 -0
- package/fesm2015/testing.mjs +833 -0
- package/fesm2015/testing.mjs.map +1 -0
- package/fesm2015/text-field.mjs +461 -0
- package/fesm2015/text-field.mjs.map +1 -0
- package/fesm2015/tree.mjs +1303 -0
- package/fesm2015/tree.mjs.map +1 -0
- package/fesm2020/a11y.mjs +2476 -0
- package/fesm2020/a11y.mjs.map +1 -0
- package/fesm2020/accordion.mjs +414 -0
- package/fesm2020/accordion.mjs.map +1 -0
- package/fesm2020/bidi.mjs +192 -0
- package/fesm2020/bidi.mjs.map +1 -0
- package/fesm2020/cdk.mjs +30 -0
- package/fesm2020/cdk.mjs.map +1 -0
- package/fesm2020/clipboard.mjs +259 -0
- package/fesm2020/clipboard.mjs.map +1 -0
- package/fesm2020/coercion.mjs +132 -0
- package/fesm2020/coercion.mjs.map +1 -0
- package/fesm2020/collections.mjs +535 -0
- package/fesm2020/collections.mjs.map +1 -0
- package/fesm2020/dialog.mjs +787 -0
- package/fesm2020/dialog.mjs.map +1 -0
- package/fesm2020/drag-drop.mjs +3808 -0
- package/fesm2020/drag-drop.mjs.map +1 -0
- package/fesm2020/keycodes.mjs +167 -0
- package/fesm2020/keycodes.mjs.map +1 -0
- package/fesm2020/layout.mjs +337 -0
- package/fesm2020/layout.mjs.map +1 -0
- package/fesm2020/listbox.mjs +1164 -0
- package/fesm2020/listbox.mjs.map +1 -0
- package/fesm2020/menu.mjs +2615 -0
- package/fesm2020/menu.mjs.map +1 -0
- package/fesm2020/observers.mjs +325 -0
- package/fesm2020/observers.mjs.map +1 -0
- package/fesm2020/overlay.mjs +3145 -0
- package/fesm2020/overlay.mjs.map +1 -0
- package/fesm2020/platform.mjs +383 -0
- package/fesm2020/platform.mjs.map +1 -0
- package/fesm2020/portal.mjs +689 -0
- package/fesm2020/portal.mjs.map +1 -0
- package/fesm2020/scrolling.mjs +1591 -0
- package/fesm2020/scrolling.mjs.map +1 -0
- package/fesm2020/stepper.mjs +985 -0
- package/fesm2020/stepper.mjs.map +1 -0
- package/fesm2020/table.mjs +2348 -0
- package/fesm2020/table.mjs.map +1 -0
- package/fesm2020/testing.mjs +797 -0
- package/fesm2020/testing.mjs.map +1 -0
- package/fesm2020/text-field.mjs +459 -0
- package/fesm2020/text-field.mjs.map +1 -0
- package/fesm2020/tree.mjs +1305 -0
- package/fesm2020/tree.mjs.map +1 -0
- package/index.d.ts +6 -0
- package/keycodes/index.d.ts +249 -0
- package/layout/index.d.ts +90 -0
- package/listbox/index.d.ts +419 -0
- package/menu/index.d.ts +1013 -0
- package/observers/index.d.ts +109 -0
- package/overlay/_index-deprecated.scss +13 -0
- package/overlay/_index.import.scss +13 -0
- package/overlay/_index.scss +152 -0
- package/overlay/index.d.ts +1343 -0
- package/overlay-prebuilt.css +1 -0
- package/package.json +232 -0
- package/platform/index.d.ts +106 -0
- package/portal/index.d.ts +328 -0
- package/scrolling/index.d.ts +849 -0
- package/stepper/index.d.ts +419 -0
- package/table/index.d.ts +1483 -0
- package/text-field/_index.import.scss +2 -0
- package/text-field/_index.scss +89 -0
- package/text-field/index.d.ts +203 -0
- package/text-field-prebuilt.css +1 -0
- package/tree/index.d.ts +593 -0
|
@@ -0,0 +1,985 @@
|
|
|
1
|
+
import { FocusKeyManager } from '@kato-lee/cdk/a11y';
|
|
2
|
+
import * as i1 from '@kato-lee/cdk/bidi';
|
|
3
|
+
import { BidiModule } from '@kato-lee/cdk/bidi';
|
|
4
|
+
import { coerceBooleanProperty, coerceNumberProperty } from '@kato-lee/cdk/coercion';
|
|
5
|
+
import { hasModifierKey, SPACE, ENTER } from '@kato-lee/cdk/keycodes';
|
|
6
|
+
import * as i0 from '@angular/core';
|
|
7
|
+
import {
|
|
8
|
+
Directive,
|
|
9
|
+
InjectionToken,
|
|
10
|
+
EventEmitter,
|
|
11
|
+
forwardRef,
|
|
12
|
+
TemplateRef,
|
|
13
|
+
Component,
|
|
14
|
+
ViewEncapsulation,
|
|
15
|
+
ChangeDetectionStrategy,
|
|
16
|
+
Inject,
|
|
17
|
+
Optional,
|
|
18
|
+
ContentChild,
|
|
19
|
+
ViewChild,
|
|
20
|
+
Input,
|
|
21
|
+
Output,
|
|
22
|
+
QueryList,
|
|
23
|
+
ContentChildren,
|
|
24
|
+
NgModule,
|
|
25
|
+
} from '@angular/core';
|
|
26
|
+
import { _getFocusedElementPierceShadowDom } from '@kato-lee/cdk/platform';
|
|
27
|
+
import { Subject, of } from 'rxjs';
|
|
28
|
+
import { startWith, takeUntil } from 'rxjs/operators';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @license
|
|
32
|
+
* Copyright Google LLC All Rights Reserved.
|
|
33
|
+
*
|
|
34
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
35
|
+
* found in the LICENSE file at https://angular.io/license
|
|
36
|
+
*/
|
|
37
|
+
class CdkStepHeader {
|
|
38
|
+
constructor(_elementRef) {
|
|
39
|
+
this._elementRef = _elementRef;
|
|
40
|
+
}
|
|
41
|
+
/** Focuses the step header. */
|
|
42
|
+
focus() {
|
|
43
|
+
this._elementRef.nativeElement.focus();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
CdkStepHeader.ɵfac = i0.ɵɵngDeclareFactory({
|
|
47
|
+
minVersion: '12.0.0',
|
|
48
|
+
version: '14.2.0',
|
|
49
|
+
ngImport: i0,
|
|
50
|
+
type: CdkStepHeader,
|
|
51
|
+
deps: [{ token: i0.ElementRef }],
|
|
52
|
+
target: i0.ɵɵFactoryTarget.Directive,
|
|
53
|
+
});
|
|
54
|
+
CdkStepHeader.ɵdir = i0.ɵɵngDeclareDirective({
|
|
55
|
+
minVersion: '14.0.0',
|
|
56
|
+
version: '14.2.0',
|
|
57
|
+
type: CdkStepHeader,
|
|
58
|
+
selector: '[cdkStepHeader]',
|
|
59
|
+
host: { attributes: { role: 'tab' } },
|
|
60
|
+
ngImport: i0,
|
|
61
|
+
});
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
63
|
+
minVersion: '12.0.0',
|
|
64
|
+
version: '14.2.0',
|
|
65
|
+
ngImport: i0,
|
|
66
|
+
type: CdkStepHeader,
|
|
67
|
+
decorators: [
|
|
68
|
+
{
|
|
69
|
+
type: Directive,
|
|
70
|
+
args: [
|
|
71
|
+
{
|
|
72
|
+
selector: '[cdkStepHeader]',
|
|
73
|
+
host: {
|
|
74
|
+
role: 'tab',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
ctorParameters: function () {
|
|
81
|
+
return [{ type: i0.ElementRef }];
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @license
|
|
87
|
+
* Copyright Google LLC All Rights Reserved.
|
|
88
|
+
*
|
|
89
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
90
|
+
* found in the LICENSE file at https://angular.io/license
|
|
91
|
+
*/
|
|
92
|
+
class CdkStepLabel {
|
|
93
|
+
constructor(/** @docs-private */ template) {
|
|
94
|
+
this.template = template;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
CdkStepLabel.ɵfac = i0.ɵɵngDeclareFactory({
|
|
98
|
+
minVersion: '12.0.0',
|
|
99
|
+
version: '14.2.0',
|
|
100
|
+
ngImport: i0,
|
|
101
|
+
type: CdkStepLabel,
|
|
102
|
+
deps: [{ token: i0.TemplateRef }],
|
|
103
|
+
target: i0.ɵɵFactoryTarget.Directive,
|
|
104
|
+
});
|
|
105
|
+
CdkStepLabel.ɵdir = i0.ɵɵngDeclareDirective({
|
|
106
|
+
minVersion: '14.0.0',
|
|
107
|
+
version: '14.2.0',
|
|
108
|
+
type: CdkStepLabel,
|
|
109
|
+
selector: '[cdkStepLabel]',
|
|
110
|
+
ngImport: i0,
|
|
111
|
+
});
|
|
112
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
113
|
+
minVersion: '12.0.0',
|
|
114
|
+
version: '14.2.0',
|
|
115
|
+
ngImport: i0,
|
|
116
|
+
type: CdkStepLabel,
|
|
117
|
+
decorators: [
|
|
118
|
+
{
|
|
119
|
+
type: Directive,
|
|
120
|
+
args: [
|
|
121
|
+
{
|
|
122
|
+
selector: '[cdkStepLabel]',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
ctorParameters: function () {
|
|
128
|
+
return [{ type: i0.TemplateRef }];
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @license
|
|
134
|
+
* Copyright Google LLC All Rights Reserved.
|
|
135
|
+
*
|
|
136
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
137
|
+
* found in the LICENSE file at https://angular.io/license
|
|
138
|
+
*/
|
|
139
|
+
/** Used to generate unique ID for each stepper component. */
|
|
140
|
+
let nextId = 0;
|
|
141
|
+
/** Change event emitted on selection changes. */
|
|
142
|
+
class StepperSelectionEvent {}
|
|
143
|
+
/** Enum to represent the different states of the steps. */
|
|
144
|
+
const STEP_STATE = {
|
|
145
|
+
NUMBER: 'number',
|
|
146
|
+
EDIT: 'edit',
|
|
147
|
+
DONE: 'done',
|
|
148
|
+
ERROR: 'error',
|
|
149
|
+
};
|
|
150
|
+
/** InjectionToken that can be used to specify the global stepper options. */
|
|
151
|
+
const STEPPER_GLOBAL_OPTIONS = new InjectionToken('STEPPER_GLOBAL_OPTIONS');
|
|
152
|
+
class CdkStep {
|
|
153
|
+
constructor(_stepper, stepperOptions) {
|
|
154
|
+
this._stepper = _stepper;
|
|
155
|
+
/** Whether user has attempted to move away from the step. */
|
|
156
|
+
this.interacted = false;
|
|
157
|
+
/** Emits when the user has attempted to move away from the step. */
|
|
158
|
+
this.interactedStream = new EventEmitter();
|
|
159
|
+
this._editable = true;
|
|
160
|
+
this._optional = false;
|
|
161
|
+
this._completedOverride = null;
|
|
162
|
+
this._customError = null;
|
|
163
|
+
this._stepperOptions = stepperOptions ? stepperOptions : {};
|
|
164
|
+
this._displayDefaultIndicatorType = this._stepperOptions.displayDefaultIndicatorType !== false;
|
|
165
|
+
}
|
|
166
|
+
/** Whether the user can return to this step once it has been marked as completed. */
|
|
167
|
+
get editable() {
|
|
168
|
+
return this._editable;
|
|
169
|
+
}
|
|
170
|
+
set editable(value) {
|
|
171
|
+
this._editable = coerceBooleanProperty(value);
|
|
172
|
+
}
|
|
173
|
+
/** Whether the completion of step is optional. */
|
|
174
|
+
get optional() {
|
|
175
|
+
return this._optional;
|
|
176
|
+
}
|
|
177
|
+
set optional(value) {
|
|
178
|
+
this._optional = coerceBooleanProperty(value);
|
|
179
|
+
}
|
|
180
|
+
/** Whether step is marked as completed. */
|
|
181
|
+
get completed() {
|
|
182
|
+
return this._completedOverride == null ? this._getDefaultCompleted() : this._completedOverride;
|
|
183
|
+
}
|
|
184
|
+
set completed(value) {
|
|
185
|
+
this._completedOverride = coerceBooleanProperty(value);
|
|
186
|
+
}
|
|
187
|
+
_getDefaultCompleted() {
|
|
188
|
+
return this.stepControl ? this.stepControl.valid && this.interacted : this.interacted;
|
|
189
|
+
}
|
|
190
|
+
/** Whether step has an error. */
|
|
191
|
+
get hasError() {
|
|
192
|
+
return this._customError == null ? this._getDefaultError() : this._customError;
|
|
193
|
+
}
|
|
194
|
+
set hasError(value) {
|
|
195
|
+
this._customError = coerceBooleanProperty(value);
|
|
196
|
+
}
|
|
197
|
+
_getDefaultError() {
|
|
198
|
+
return this.stepControl && this.stepControl.invalid && this.interacted;
|
|
199
|
+
}
|
|
200
|
+
/** Selects this step component. */
|
|
201
|
+
select() {
|
|
202
|
+
this._stepper.selected = this;
|
|
203
|
+
}
|
|
204
|
+
/** Resets the step to its initial state. Note that this includes resetting form data. */
|
|
205
|
+
reset() {
|
|
206
|
+
this.interacted = false;
|
|
207
|
+
if (this._completedOverride != null) {
|
|
208
|
+
this._completedOverride = false;
|
|
209
|
+
}
|
|
210
|
+
if (this._customError != null) {
|
|
211
|
+
this._customError = false;
|
|
212
|
+
}
|
|
213
|
+
if (this.stepControl) {
|
|
214
|
+
this.stepControl.reset();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
ngOnChanges() {
|
|
218
|
+
// Since basically all inputs of the MatStep get proxied through the view down to the
|
|
219
|
+
// underlying MatStepHeader, we have to make sure that change detection runs correctly.
|
|
220
|
+
this._stepper._stateChanged();
|
|
221
|
+
}
|
|
222
|
+
_markAsInteracted() {
|
|
223
|
+
if (!this.interacted) {
|
|
224
|
+
this.interacted = true;
|
|
225
|
+
this.interactedStream.emit(this);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/** Determines whether the error state can be shown. */
|
|
229
|
+
_showError() {
|
|
230
|
+
// We want to show the error state either if the user opted into/out of it using the
|
|
231
|
+
// global options, or if they've explicitly set it through the `hasError` input.
|
|
232
|
+
return this._stepperOptions.showError ?? this._customError != null;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
CdkStep.ɵfac = i0.ɵɵngDeclareFactory({
|
|
236
|
+
minVersion: '12.0.0',
|
|
237
|
+
version: '14.2.0',
|
|
238
|
+
ngImport: i0,
|
|
239
|
+
type: CdkStep,
|
|
240
|
+
deps: [
|
|
241
|
+
{ token: forwardRef(() => CdkStepper) },
|
|
242
|
+
{ token: STEPPER_GLOBAL_OPTIONS, optional: true },
|
|
243
|
+
],
|
|
244
|
+
target: i0.ɵɵFactoryTarget.Component,
|
|
245
|
+
});
|
|
246
|
+
CdkStep.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
247
|
+
minVersion: '14.0.0',
|
|
248
|
+
version: '14.2.0',
|
|
249
|
+
type: CdkStep,
|
|
250
|
+
selector: 'cdk-step',
|
|
251
|
+
inputs: {
|
|
252
|
+
stepControl: 'stepControl',
|
|
253
|
+
label: 'label',
|
|
254
|
+
errorMessage: 'errorMessage',
|
|
255
|
+
ariaLabel: ['aria-label', 'ariaLabel'],
|
|
256
|
+
ariaLabelledby: ['aria-labelledby', 'ariaLabelledby'],
|
|
257
|
+
state: 'state',
|
|
258
|
+
editable: 'editable',
|
|
259
|
+
optional: 'optional',
|
|
260
|
+
completed: 'completed',
|
|
261
|
+
hasError: 'hasError',
|
|
262
|
+
},
|
|
263
|
+
outputs: { interactedStream: 'interacted' },
|
|
264
|
+
queries: [{ propertyName: 'stepLabel', first: true, predicate: CdkStepLabel, descendants: true }],
|
|
265
|
+
viewQueries: [
|
|
266
|
+
{
|
|
267
|
+
propertyName: 'content',
|
|
268
|
+
first: true,
|
|
269
|
+
predicate: TemplateRef,
|
|
270
|
+
descendants: true,
|
|
271
|
+
static: true,
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
exportAs: ['cdkStep'],
|
|
275
|
+
usesOnChanges: true,
|
|
276
|
+
ngImport: i0,
|
|
277
|
+
template: '<ng-template><ng-content></ng-content></ng-template>',
|
|
278
|
+
isInline: true,
|
|
279
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
280
|
+
encapsulation: i0.ViewEncapsulation.None,
|
|
281
|
+
});
|
|
282
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
283
|
+
minVersion: '12.0.0',
|
|
284
|
+
version: '14.2.0',
|
|
285
|
+
ngImport: i0,
|
|
286
|
+
type: CdkStep,
|
|
287
|
+
decorators: [
|
|
288
|
+
{
|
|
289
|
+
type: Component,
|
|
290
|
+
args: [
|
|
291
|
+
{
|
|
292
|
+
selector: 'cdk-step',
|
|
293
|
+
exportAs: 'cdkStep',
|
|
294
|
+
template: '<ng-template><ng-content></ng-content></ng-template>',
|
|
295
|
+
encapsulation: ViewEncapsulation.None,
|
|
296
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
ctorParameters: function () {
|
|
302
|
+
return [
|
|
303
|
+
{
|
|
304
|
+
type: CdkStepper,
|
|
305
|
+
decorators: [
|
|
306
|
+
{
|
|
307
|
+
type: Inject,
|
|
308
|
+
args: [forwardRef(() => CdkStepper)],
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
type: undefined,
|
|
314
|
+
decorators: [
|
|
315
|
+
{
|
|
316
|
+
type: Optional,
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
type: Inject,
|
|
320
|
+
args: [STEPPER_GLOBAL_OPTIONS],
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
},
|
|
324
|
+
];
|
|
325
|
+
},
|
|
326
|
+
propDecorators: {
|
|
327
|
+
stepLabel: [
|
|
328
|
+
{
|
|
329
|
+
type: ContentChild,
|
|
330
|
+
args: [CdkStepLabel],
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
content: [
|
|
334
|
+
{
|
|
335
|
+
type: ViewChild,
|
|
336
|
+
args: [TemplateRef, { static: true }],
|
|
337
|
+
},
|
|
338
|
+
],
|
|
339
|
+
stepControl: [
|
|
340
|
+
{
|
|
341
|
+
type: Input,
|
|
342
|
+
},
|
|
343
|
+
],
|
|
344
|
+
interactedStream: [
|
|
345
|
+
{
|
|
346
|
+
type: Output,
|
|
347
|
+
args: ['interacted'],
|
|
348
|
+
},
|
|
349
|
+
],
|
|
350
|
+
label: [
|
|
351
|
+
{
|
|
352
|
+
type: Input,
|
|
353
|
+
},
|
|
354
|
+
],
|
|
355
|
+
errorMessage: [
|
|
356
|
+
{
|
|
357
|
+
type: Input,
|
|
358
|
+
},
|
|
359
|
+
],
|
|
360
|
+
ariaLabel: [
|
|
361
|
+
{
|
|
362
|
+
type: Input,
|
|
363
|
+
args: ['aria-label'],
|
|
364
|
+
},
|
|
365
|
+
],
|
|
366
|
+
ariaLabelledby: [
|
|
367
|
+
{
|
|
368
|
+
type: Input,
|
|
369
|
+
args: ['aria-labelledby'],
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
state: [
|
|
373
|
+
{
|
|
374
|
+
type: Input,
|
|
375
|
+
},
|
|
376
|
+
],
|
|
377
|
+
editable: [
|
|
378
|
+
{
|
|
379
|
+
type: Input,
|
|
380
|
+
},
|
|
381
|
+
],
|
|
382
|
+
optional: [
|
|
383
|
+
{
|
|
384
|
+
type: Input,
|
|
385
|
+
},
|
|
386
|
+
],
|
|
387
|
+
completed: [
|
|
388
|
+
{
|
|
389
|
+
type: Input,
|
|
390
|
+
},
|
|
391
|
+
],
|
|
392
|
+
hasError: [
|
|
393
|
+
{
|
|
394
|
+
type: Input,
|
|
395
|
+
},
|
|
396
|
+
],
|
|
397
|
+
},
|
|
398
|
+
});
|
|
399
|
+
class CdkStepper {
|
|
400
|
+
constructor(_dir, _changeDetectorRef, _elementRef) {
|
|
401
|
+
this._dir = _dir;
|
|
402
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
403
|
+
this._elementRef = _elementRef;
|
|
404
|
+
/** Emits when the component is destroyed. */
|
|
405
|
+
this._destroyed = new Subject();
|
|
406
|
+
/** Steps that belong to the current stepper, excluding ones from nested steppers. */
|
|
407
|
+
this.steps = new QueryList();
|
|
408
|
+
/** List of step headers sorted based on their DOM order. */
|
|
409
|
+
this._sortedHeaders = new QueryList();
|
|
410
|
+
this._linear = false;
|
|
411
|
+
this._selectedIndex = 0;
|
|
412
|
+
/** Event emitted when the selected step has changed. */
|
|
413
|
+
this.selectionChange = new EventEmitter();
|
|
414
|
+
this._orientation = 'horizontal';
|
|
415
|
+
this._groupId = nextId++;
|
|
416
|
+
}
|
|
417
|
+
/** Whether the validity of previous steps should be checked or not. */
|
|
418
|
+
get linear() {
|
|
419
|
+
return this._linear;
|
|
420
|
+
}
|
|
421
|
+
set linear(value) {
|
|
422
|
+
this._linear = coerceBooleanProperty(value);
|
|
423
|
+
}
|
|
424
|
+
/** The index of the selected step. */
|
|
425
|
+
get selectedIndex() {
|
|
426
|
+
return this._selectedIndex;
|
|
427
|
+
}
|
|
428
|
+
set selectedIndex(index) {
|
|
429
|
+
const newIndex = coerceNumberProperty(index);
|
|
430
|
+
if (this.steps && this._steps) {
|
|
431
|
+
// Ensure that the index can't be out of bounds.
|
|
432
|
+
if (!this._isValidIndex(newIndex) && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
433
|
+
throw Error('cdkStepper: Cannot assign out-of-bounds value to `selectedIndex`.');
|
|
434
|
+
}
|
|
435
|
+
this.selected?._markAsInteracted();
|
|
436
|
+
if (
|
|
437
|
+
this._selectedIndex !== newIndex &&
|
|
438
|
+
!this._anyControlsInvalidOrPending(newIndex) &&
|
|
439
|
+
(newIndex >= this._selectedIndex || this.steps.toArray()[newIndex].editable)
|
|
440
|
+
) {
|
|
441
|
+
this._updateSelectedItemIndex(newIndex);
|
|
442
|
+
}
|
|
443
|
+
} else {
|
|
444
|
+
this._selectedIndex = newIndex;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
/** The step that is selected. */
|
|
448
|
+
get selected() {
|
|
449
|
+
return this.steps ? this.steps.toArray()[this.selectedIndex] : undefined;
|
|
450
|
+
}
|
|
451
|
+
set selected(step) {
|
|
452
|
+
this.selectedIndex = step && this.steps ? this.steps.toArray().indexOf(step) : -1;
|
|
453
|
+
}
|
|
454
|
+
/** Orientation of the stepper. */
|
|
455
|
+
get orientation() {
|
|
456
|
+
return this._orientation;
|
|
457
|
+
}
|
|
458
|
+
set orientation(value) {
|
|
459
|
+
// This is a protected method so that `MatStepper` can hook into it.
|
|
460
|
+
this._orientation = value;
|
|
461
|
+
if (this._keyManager) {
|
|
462
|
+
this._keyManager.withVerticalOrientation(value === 'vertical');
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
ngAfterContentInit() {
|
|
466
|
+
this._steps.changes
|
|
467
|
+
.pipe(startWith(this._steps), takeUntil(this._destroyed))
|
|
468
|
+
.subscribe(steps => {
|
|
469
|
+
this.steps.reset(steps.filter(step => step._stepper === this));
|
|
470
|
+
this.steps.notifyOnChanges();
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
ngAfterViewInit() {
|
|
474
|
+
// If the step headers are defined outside of the `ngFor` that renders the steps, like in the
|
|
475
|
+
// Material stepper, they won't appear in the `QueryList` in the same order as they're
|
|
476
|
+
// rendered in the DOM which will lead to incorrect keyboard navigation. We need to sort
|
|
477
|
+
// them manually to ensure that they're correct. Alternatively, we can change the Material
|
|
478
|
+
// template to inline the headers in the `ngFor`, but that'll result in a lot of
|
|
479
|
+
// code duplication. See #23539.
|
|
480
|
+
this._stepHeader.changes
|
|
481
|
+
.pipe(startWith(this._stepHeader), takeUntil(this._destroyed))
|
|
482
|
+
.subscribe(headers => {
|
|
483
|
+
this._sortedHeaders.reset(
|
|
484
|
+
headers.toArray().sort((a, b) => {
|
|
485
|
+
const documentPosition = a._elementRef.nativeElement.compareDocumentPosition(
|
|
486
|
+
b._elementRef.nativeElement
|
|
487
|
+
);
|
|
488
|
+
// `compareDocumentPosition` returns a bitmask so we have to use a bitwise operator.
|
|
489
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
490
|
+
// tslint:disable-next-line:no-bitwise
|
|
491
|
+
return documentPosition & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
492
|
+
})
|
|
493
|
+
);
|
|
494
|
+
this._sortedHeaders.notifyOnChanges();
|
|
495
|
+
});
|
|
496
|
+
// Note that while the step headers are content children by default, any components that
|
|
497
|
+
// extend this one might have them as view children. We initialize the keyboard handling in
|
|
498
|
+
// AfterViewInit so we're guaranteed for both view and content children to be defined.
|
|
499
|
+
this._keyManager = new FocusKeyManager(this._sortedHeaders)
|
|
500
|
+
.withWrap()
|
|
501
|
+
.withHomeAndEnd()
|
|
502
|
+
.withVerticalOrientation(this._orientation === 'vertical');
|
|
503
|
+
(this._dir ? this._dir.change : of())
|
|
504
|
+
.pipe(startWith(this._layoutDirection()), takeUntil(this._destroyed))
|
|
505
|
+
.subscribe(direction => this._keyManager.withHorizontalOrientation(direction));
|
|
506
|
+
this._keyManager.updateActiveItem(this._selectedIndex);
|
|
507
|
+
// No need to `takeUntil` here, because we're the ones destroying `steps`.
|
|
508
|
+
this.steps.changes.subscribe(() => {
|
|
509
|
+
if (!this.selected) {
|
|
510
|
+
this._selectedIndex = Math.max(this._selectedIndex - 1, 0);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
// The logic which asserts that the selected index is within bounds doesn't run before the
|
|
514
|
+
// steps are initialized, because we don't how many steps there are yet so we may have an
|
|
515
|
+
// invalid index on init. If that's the case, auto-correct to the default so we don't throw.
|
|
516
|
+
if (!this._isValidIndex(this._selectedIndex)) {
|
|
517
|
+
this._selectedIndex = 0;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
ngOnDestroy() {
|
|
521
|
+
this.steps.destroy();
|
|
522
|
+
this._sortedHeaders.destroy();
|
|
523
|
+
this._destroyed.next();
|
|
524
|
+
this._destroyed.complete();
|
|
525
|
+
}
|
|
526
|
+
/** Selects and focuses the next step in list. */
|
|
527
|
+
next() {
|
|
528
|
+
this.selectedIndex = Math.min(this._selectedIndex + 1, this.steps.length - 1);
|
|
529
|
+
}
|
|
530
|
+
/** Selects and focuses the previous step in list. */
|
|
531
|
+
previous() {
|
|
532
|
+
this.selectedIndex = Math.max(this._selectedIndex - 1, 0);
|
|
533
|
+
}
|
|
534
|
+
/** Resets the stepper to its initial state. Note that this includes clearing form data. */
|
|
535
|
+
reset() {
|
|
536
|
+
this._updateSelectedItemIndex(0);
|
|
537
|
+
this.steps.forEach(step => step.reset());
|
|
538
|
+
this._stateChanged();
|
|
539
|
+
}
|
|
540
|
+
/** Returns a unique id for each step label element. */
|
|
541
|
+
_getStepLabelId(i) {
|
|
542
|
+
return `cdk-step-label-${this._groupId}-${i}`;
|
|
543
|
+
}
|
|
544
|
+
/** Returns unique id for each step content element. */
|
|
545
|
+
_getStepContentId(i) {
|
|
546
|
+
return `cdk-step-content-${this._groupId}-${i}`;
|
|
547
|
+
}
|
|
548
|
+
/** Marks the component to be change detected. */
|
|
549
|
+
_stateChanged() {
|
|
550
|
+
this._changeDetectorRef.markForCheck();
|
|
551
|
+
}
|
|
552
|
+
/** Returns position state of the step with the given index. */
|
|
553
|
+
_getAnimationDirection(index) {
|
|
554
|
+
const position = index - this._selectedIndex;
|
|
555
|
+
if (position < 0) {
|
|
556
|
+
return this._layoutDirection() === 'rtl' ? 'next' : 'previous';
|
|
557
|
+
} else if (position > 0) {
|
|
558
|
+
return this._layoutDirection() === 'rtl' ? 'previous' : 'next';
|
|
559
|
+
}
|
|
560
|
+
return 'current';
|
|
561
|
+
}
|
|
562
|
+
/** Returns the type of icon to be displayed. */
|
|
563
|
+
_getIndicatorType(index, state = STEP_STATE.NUMBER) {
|
|
564
|
+
const step = this.steps.toArray()[index];
|
|
565
|
+
const isCurrentStep = this._isCurrentStep(index);
|
|
566
|
+
return step._displayDefaultIndicatorType
|
|
567
|
+
? this._getDefaultIndicatorLogic(step, isCurrentStep)
|
|
568
|
+
: this._getGuidelineLogic(step, isCurrentStep, state);
|
|
569
|
+
}
|
|
570
|
+
_getDefaultIndicatorLogic(step, isCurrentStep) {
|
|
571
|
+
if (step._showError() && step.hasError && !isCurrentStep) {
|
|
572
|
+
return STEP_STATE.ERROR;
|
|
573
|
+
} else if (!step.completed || isCurrentStep) {
|
|
574
|
+
return STEP_STATE.NUMBER;
|
|
575
|
+
} else {
|
|
576
|
+
return step.editable ? STEP_STATE.EDIT : STEP_STATE.DONE;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
_getGuidelineLogic(step, isCurrentStep, state = STEP_STATE.NUMBER) {
|
|
580
|
+
if (step._showError() && step.hasError && !isCurrentStep) {
|
|
581
|
+
return STEP_STATE.ERROR;
|
|
582
|
+
} else if (step.completed && !isCurrentStep) {
|
|
583
|
+
return STEP_STATE.DONE;
|
|
584
|
+
} else if (step.completed && isCurrentStep) {
|
|
585
|
+
return state;
|
|
586
|
+
} else if (step.editable && isCurrentStep) {
|
|
587
|
+
return STEP_STATE.EDIT;
|
|
588
|
+
} else {
|
|
589
|
+
return state;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
_isCurrentStep(index) {
|
|
593
|
+
return this._selectedIndex === index;
|
|
594
|
+
}
|
|
595
|
+
/** Returns the index of the currently-focused step header. */
|
|
596
|
+
_getFocusIndex() {
|
|
597
|
+
return this._keyManager ? this._keyManager.activeItemIndex : this._selectedIndex;
|
|
598
|
+
}
|
|
599
|
+
_updateSelectedItemIndex(newIndex) {
|
|
600
|
+
const stepsArray = this.steps.toArray();
|
|
601
|
+
this.selectionChange.emit({
|
|
602
|
+
selectedIndex: newIndex,
|
|
603
|
+
previouslySelectedIndex: this._selectedIndex,
|
|
604
|
+
selectedStep: stepsArray[newIndex],
|
|
605
|
+
previouslySelectedStep: stepsArray[this._selectedIndex],
|
|
606
|
+
});
|
|
607
|
+
// If focus is inside the stepper, move it to the next header, otherwise it may become
|
|
608
|
+
// lost when the active step content is hidden. We can't be more granular with the check
|
|
609
|
+
// (e.g. checking whether focus is inside the active step), because we don't have a
|
|
610
|
+
// reference to the elements that are rendering out the content.
|
|
611
|
+
this._containsFocus()
|
|
612
|
+
? this._keyManager.setActiveItem(newIndex)
|
|
613
|
+
: this._keyManager.updateActiveItem(newIndex);
|
|
614
|
+
this._selectedIndex = newIndex;
|
|
615
|
+
this._stateChanged();
|
|
616
|
+
}
|
|
617
|
+
_onKeydown(event) {
|
|
618
|
+
const hasModifier = hasModifierKey(event);
|
|
619
|
+
const keyCode = event.keyCode;
|
|
620
|
+
const manager = this._keyManager;
|
|
621
|
+
if (
|
|
622
|
+
manager.activeItemIndex != null &&
|
|
623
|
+
!hasModifier &&
|
|
624
|
+
(keyCode === SPACE || keyCode === ENTER)
|
|
625
|
+
) {
|
|
626
|
+
this.selectedIndex = manager.activeItemIndex;
|
|
627
|
+
event.preventDefault();
|
|
628
|
+
} else {
|
|
629
|
+
manager.onKeydown(event);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
_anyControlsInvalidOrPending(index) {
|
|
633
|
+
if (this._linear && index >= 0) {
|
|
634
|
+
return this.steps
|
|
635
|
+
.toArray()
|
|
636
|
+
.slice(0, index)
|
|
637
|
+
.some(step => {
|
|
638
|
+
const control = step.stepControl;
|
|
639
|
+
const isIncomplete = control
|
|
640
|
+
? control.invalid || control.pending || !step.interacted
|
|
641
|
+
: !step.completed;
|
|
642
|
+
return isIncomplete && !step.optional && !step._completedOverride;
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
return false;
|
|
646
|
+
}
|
|
647
|
+
_layoutDirection() {
|
|
648
|
+
return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
|
|
649
|
+
}
|
|
650
|
+
/** Checks whether the stepper contains the focused element. */
|
|
651
|
+
_containsFocus() {
|
|
652
|
+
const stepperElement = this._elementRef.nativeElement;
|
|
653
|
+
const focusedElement = _getFocusedElementPierceShadowDom();
|
|
654
|
+
return stepperElement === focusedElement || stepperElement.contains(focusedElement);
|
|
655
|
+
}
|
|
656
|
+
/** Checks whether the passed-in index is a valid step index. */
|
|
657
|
+
_isValidIndex(index) {
|
|
658
|
+
return index > -1 && (!this.steps || index < this.steps.length);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
CdkStepper.ɵfac = i0.ɵɵngDeclareFactory({
|
|
662
|
+
minVersion: '12.0.0',
|
|
663
|
+
version: '14.2.0',
|
|
664
|
+
ngImport: i0,
|
|
665
|
+
type: CdkStepper,
|
|
666
|
+
deps: [
|
|
667
|
+
{ token: i1.Directionality, optional: true },
|
|
668
|
+
{ token: i0.ChangeDetectorRef },
|
|
669
|
+
{ token: i0.ElementRef },
|
|
670
|
+
],
|
|
671
|
+
target: i0.ɵɵFactoryTarget.Directive,
|
|
672
|
+
});
|
|
673
|
+
CdkStepper.ɵdir = i0.ɵɵngDeclareDirective({
|
|
674
|
+
minVersion: '14.0.0',
|
|
675
|
+
version: '14.2.0',
|
|
676
|
+
type: CdkStepper,
|
|
677
|
+
selector: '[cdkStepper]',
|
|
678
|
+
inputs: {
|
|
679
|
+
linear: 'linear',
|
|
680
|
+
selectedIndex: 'selectedIndex',
|
|
681
|
+
selected: 'selected',
|
|
682
|
+
orientation: 'orientation',
|
|
683
|
+
},
|
|
684
|
+
outputs: { selectionChange: 'selectionChange' },
|
|
685
|
+
queries: [
|
|
686
|
+
{ propertyName: '_steps', predicate: CdkStep, descendants: true },
|
|
687
|
+
{ propertyName: '_stepHeader', predicate: CdkStepHeader, descendants: true },
|
|
688
|
+
],
|
|
689
|
+
exportAs: ['cdkStepper'],
|
|
690
|
+
ngImport: i0,
|
|
691
|
+
});
|
|
692
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
693
|
+
minVersion: '12.0.0',
|
|
694
|
+
version: '14.2.0',
|
|
695
|
+
ngImport: i0,
|
|
696
|
+
type: CdkStepper,
|
|
697
|
+
decorators: [
|
|
698
|
+
{
|
|
699
|
+
type: Directive,
|
|
700
|
+
args: [
|
|
701
|
+
{
|
|
702
|
+
selector: '[cdkStepper]',
|
|
703
|
+
exportAs: 'cdkStepper',
|
|
704
|
+
},
|
|
705
|
+
],
|
|
706
|
+
},
|
|
707
|
+
],
|
|
708
|
+
ctorParameters: function () {
|
|
709
|
+
return [
|
|
710
|
+
{
|
|
711
|
+
type: i1.Directionality,
|
|
712
|
+
decorators: [
|
|
713
|
+
{
|
|
714
|
+
type: Optional,
|
|
715
|
+
},
|
|
716
|
+
],
|
|
717
|
+
},
|
|
718
|
+
{ type: i0.ChangeDetectorRef },
|
|
719
|
+
{ type: i0.ElementRef },
|
|
720
|
+
];
|
|
721
|
+
},
|
|
722
|
+
propDecorators: {
|
|
723
|
+
_steps: [
|
|
724
|
+
{
|
|
725
|
+
type: ContentChildren,
|
|
726
|
+
args: [CdkStep, { descendants: true }],
|
|
727
|
+
},
|
|
728
|
+
],
|
|
729
|
+
_stepHeader: [
|
|
730
|
+
{
|
|
731
|
+
type: ContentChildren,
|
|
732
|
+
args: [CdkStepHeader, { descendants: true }],
|
|
733
|
+
},
|
|
734
|
+
],
|
|
735
|
+
linear: [
|
|
736
|
+
{
|
|
737
|
+
type: Input,
|
|
738
|
+
},
|
|
739
|
+
],
|
|
740
|
+
selectedIndex: [
|
|
741
|
+
{
|
|
742
|
+
type: Input,
|
|
743
|
+
},
|
|
744
|
+
],
|
|
745
|
+
selected: [
|
|
746
|
+
{
|
|
747
|
+
type: Input,
|
|
748
|
+
},
|
|
749
|
+
],
|
|
750
|
+
selectionChange: [
|
|
751
|
+
{
|
|
752
|
+
type: Output,
|
|
753
|
+
},
|
|
754
|
+
],
|
|
755
|
+
orientation: [
|
|
756
|
+
{
|
|
757
|
+
type: Input,
|
|
758
|
+
},
|
|
759
|
+
],
|
|
760
|
+
},
|
|
761
|
+
});
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* @license
|
|
765
|
+
* Copyright Google LLC All Rights Reserved.
|
|
766
|
+
*
|
|
767
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
768
|
+
* found in the LICENSE file at https://angular.io/license
|
|
769
|
+
*/
|
|
770
|
+
/** Button that moves to the next step in a stepper workflow. */
|
|
771
|
+
class CdkStepperNext {
|
|
772
|
+
constructor(_stepper) {
|
|
773
|
+
this._stepper = _stepper;
|
|
774
|
+
/** Type of the next button. Defaults to "submit" if not specified. */
|
|
775
|
+
this.type = 'submit';
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
CdkStepperNext.ɵfac = i0.ɵɵngDeclareFactory({
|
|
779
|
+
minVersion: '12.0.0',
|
|
780
|
+
version: '14.2.0',
|
|
781
|
+
ngImport: i0,
|
|
782
|
+
type: CdkStepperNext,
|
|
783
|
+
deps: [{ token: CdkStepper }],
|
|
784
|
+
target: i0.ɵɵFactoryTarget.Directive,
|
|
785
|
+
});
|
|
786
|
+
CdkStepperNext.ɵdir = i0.ɵɵngDeclareDirective({
|
|
787
|
+
minVersion: '14.0.0',
|
|
788
|
+
version: '14.2.0',
|
|
789
|
+
type: CdkStepperNext,
|
|
790
|
+
selector: 'button[cdkStepperNext]',
|
|
791
|
+
inputs: { type: 'type' },
|
|
792
|
+
host: { listeners: { click: '_stepper.next()' }, properties: { type: 'type' } },
|
|
793
|
+
ngImport: i0,
|
|
794
|
+
});
|
|
795
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
796
|
+
minVersion: '12.0.0',
|
|
797
|
+
version: '14.2.0',
|
|
798
|
+
ngImport: i0,
|
|
799
|
+
type: CdkStepperNext,
|
|
800
|
+
decorators: [
|
|
801
|
+
{
|
|
802
|
+
type: Directive,
|
|
803
|
+
args: [
|
|
804
|
+
{
|
|
805
|
+
selector: 'button[cdkStepperNext]',
|
|
806
|
+
host: {
|
|
807
|
+
'[type]': 'type',
|
|
808
|
+
'(click)': '_stepper.next()',
|
|
809
|
+
},
|
|
810
|
+
},
|
|
811
|
+
],
|
|
812
|
+
},
|
|
813
|
+
],
|
|
814
|
+
ctorParameters: function () {
|
|
815
|
+
return [{ type: CdkStepper }];
|
|
816
|
+
},
|
|
817
|
+
propDecorators: {
|
|
818
|
+
type: [
|
|
819
|
+
{
|
|
820
|
+
type: Input,
|
|
821
|
+
},
|
|
822
|
+
],
|
|
823
|
+
},
|
|
824
|
+
});
|
|
825
|
+
/** Button that moves to the previous step in a stepper workflow. */
|
|
826
|
+
class CdkStepperPrevious {
|
|
827
|
+
constructor(_stepper) {
|
|
828
|
+
this._stepper = _stepper;
|
|
829
|
+
/** Type of the previous button. Defaults to "button" if not specified. */
|
|
830
|
+
this.type = 'button';
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
CdkStepperPrevious.ɵfac = i0.ɵɵngDeclareFactory({
|
|
834
|
+
minVersion: '12.0.0',
|
|
835
|
+
version: '14.2.0',
|
|
836
|
+
ngImport: i0,
|
|
837
|
+
type: CdkStepperPrevious,
|
|
838
|
+
deps: [{ token: CdkStepper }],
|
|
839
|
+
target: i0.ɵɵFactoryTarget.Directive,
|
|
840
|
+
});
|
|
841
|
+
CdkStepperPrevious.ɵdir = i0.ɵɵngDeclareDirective({
|
|
842
|
+
minVersion: '14.0.0',
|
|
843
|
+
version: '14.2.0',
|
|
844
|
+
type: CdkStepperPrevious,
|
|
845
|
+
selector: 'button[cdkStepperPrevious]',
|
|
846
|
+
inputs: { type: 'type' },
|
|
847
|
+
host: { listeners: { click: '_stepper.previous()' }, properties: { type: 'type' } },
|
|
848
|
+
ngImport: i0,
|
|
849
|
+
});
|
|
850
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
851
|
+
minVersion: '12.0.0',
|
|
852
|
+
version: '14.2.0',
|
|
853
|
+
ngImport: i0,
|
|
854
|
+
type: CdkStepperPrevious,
|
|
855
|
+
decorators: [
|
|
856
|
+
{
|
|
857
|
+
type: Directive,
|
|
858
|
+
args: [
|
|
859
|
+
{
|
|
860
|
+
selector: 'button[cdkStepperPrevious]',
|
|
861
|
+
host: {
|
|
862
|
+
'[type]': 'type',
|
|
863
|
+
'(click)': '_stepper.previous()',
|
|
864
|
+
},
|
|
865
|
+
},
|
|
866
|
+
],
|
|
867
|
+
},
|
|
868
|
+
],
|
|
869
|
+
ctorParameters: function () {
|
|
870
|
+
return [{ type: CdkStepper }];
|
|
871
|
+
},
|
|
872
|
+
propDecorators: {
|
|
873
|
+
type: [
|
|
874
|
+
{
|
|
875
|
+
type: Input,
|
|
876
|
+
},
|
|
877
|
+
],
|
|
878
|
+
},
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* @license
|
|
883
|
+
* Copyright Google LLC All Rights Reserved.
|
|
884
|
+
*
|
|
885
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
886
|
+
* found in the LICENSE file at https://angular.io/license
|
|
887
|
+
*/
|
|
888
|
+
class CdkStepperModule {}
|
|
889
|
+
CdkStepperModule.ɵfac = i0.ɵɵngDeclareFactory({
|
|
890
|
+
minVersion: '12.0.0',
|
|
891
|
+
version: '14.2.0',
|
|
892
|
+
ngImport: i0,
|
|
893
|
+
type: CdkStepperModule,
|
|
894
|
+
deps: [],
|
|
895
|
+
target: i0.ɵɵFactoryTarget.NgModule,
|
|
896
|
+
});
|
|
897
|
+
CdkStepperModule.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
898
|
+
minVersion: '14.0.0',
|
|
899
|
+
version: '14.2.0',
|
|
900
|
+
ngImport: i0,
|
|
901
|
+
type: CdkStepperModule,
|
|
902
|
+
declarations: [
|
|
903
|
+
CdkStep,
|
|
904
|
+
CdkStepper,
|
|
905
|
+
CdkStepHeader,
|
|
906
|
+
CdkStepLabel,
|
|
907
|
+
CdkStepperNext,
|
|
908
|
+
CdkStepperPrevious,
|
|
909
|
+
],
|
|
910
|
+
imports: [BidiModule],
|
|
911
|
+
exports: [CdkStep, CdkStepper, CdkStepHeader, CdkStepLabel, CdkStepperNext, CdkStepperPrevious],
|
|
912
|
+
});
|
|
913
|
+
CdkStepperModule.ɵinj = i0.ɵɵngDeclareInjector({
|
|
914
|
+
minVersion: '12.0.0',
|
|
915
|
+
version: '14.2.0',
|
|
916
|
+
ngImport: i0,
|
|
917
|
+
type: CdkStepperModule,
|
|
918
|
+
imports: [BidiModule],
|
|
919
|
+
});
|
|
920
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
921
|
+
minVersion: '12.0.0',
|
|
922
|
+
version: '14.2.0',
|
|
923
|
+
ngImport: i0,
|
|
924
|
+
type: CdkStepperModule,
|
|
925
|
+
decorators: [
|
|
926
|
+
{
|
|
927
|
+
type: NgModule,
|
|
928
|
+
args: [
|
|
929
|
+
{
|
|
930
|
+
imports: [BidiModule],
|
|
931
|
+
exports: [
|
|
932
|
+
CdkStep,
|
|
933
|
+
CdkStepper,
|
|
934
|
+
CdkStepHeader,
|
|
935
|
+
CdkStepLabel,
|
|
936
|
+
CdkStepperNext,
|
|
937
|
+
CdkStepperPrevious,
|
|
938
|
+
],
|
|
939
|
+
declarations: [
|
|
940
|
+
CdkStep,
|
|
941
|
+
CdkStepper,
|
|
942
|
+
CdkStepHeader,
|
|
943
|
+
CdkStepLabel,
|
|
944
|
+
CdkStepperNext,
|
|
945
|
+
CdkStepperPrevious,
|
|
946
|
+
],
|
|
947
|
+
},
|
|
948
|
+
],
|
|
949
|
+
},
|
|
950
|
+
],
|
|
951
|
+
});
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* @license
|
|
955
|
+
* Copyright Google LLC All Rights Reserved.
|
|
956
|
+
*
|
|
957
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
958
|
+
* found in the LICENSE file at https://angular.io/license
|
|
959
|
+
*/
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* @license
|
|
963
|
+
* Copyright Google LLC All Rights Reserved.
|
|
964
|
+
*
|
|
965
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
966
|
+
* found in the LICENSE file at https://angular.io/license
|
|
967
|
+
*/
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Generated bundle index. Do not edit.
|
|
971
|
+
*/
|
|
972
|
+
|
|
973
|
+
export {
|
|
974
|
+
CdkStep,
|
|
975
|
+
CdkStepHeader,
|
|
976
|
+
CdkStepLabel,
|
|
977
|
+
CdkStepper,
|
|
978
|
+
CdkStepperModule,
|
|
979
|
+
CdkStepperNext,
|
|
980
|
+
CdkStepperPrevious,
|
|
981
|
+
STEPPER_GLOBAL_OPTIONS,
|
|
982
|
+
STEP_STATE,
|
|
983
|
+
StepperSelectionEvent,
|
|
984
|
+
};
|
|
985
|
+
//# sourceMappingURL=stepper.mjs.map
|