@angular/cdk-experimental 20.2.0-next.0 → 20.2.0-next.2
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/accordion/index.d.ts +3 -3
- package/{accordion.d-MvKtoWUK.d.ts → accordion.d-CC6dGMlv.d.ts} +2 -2
- package/{expansion.d-BvIuKvYU.d.ts → expansion.d-Zkcf-XJU.d.ts} +1 -1
- package/fesm2022/{accordion-CN4PcmAh.mjs → accordion-D9JoxtzT.mjs} +2 -2
- package/fesm2022/accordion-D9JoxtzT.mjs.map +1 -0
- package/fesm2022/accordion.mjs +14 -14
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/cdk-experimental.mjs +1 -1
- package/fesm2022/cdk-experimental.mjs.map +1 -1
- package/fesm2022/column-resize.mjs +53 -53
- package/fesm2022/column-resize.mjs.map +1 -1
- package/fesm2022/combobox.mjs +10 -10
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/deferred-content.mjs +6 -6
- package/fesm2022/deferred-content.mjs.map +1 -1
- package/fesm2022/expansion-C9iQLHOG.mjs.map +1 -1
- package/fesm2022/{list-focus-BXQdAA3i.mjs → list-focus-Czul8jzR.mjs} +18 -18
- package/fesm2022/list-focus-Czul8jzR.mjs.map +1 -0
- package/fesm2022/list-selection-C41ApAbt.mjs.map +1 -1
- package/fesm2022/list-typeahead-DIIbNJrP.mjs.map +1 -1
- package/fesm2022/listbox.mjs +10 -10
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/{option-D44ECQK6.mjs → option-CgeKz9_Q.mjs} +19 -19
- package/fesm2022/option-CgeKz9_Q.mjs.map +1 -0
- package/fesm2022/polyfill-CXksG4af.mjs.map +1 -1
- package/fesm2022/popover-edit.mjs +43 -43
- package/fesm2022/popover-edit.mjs.map +1 -1
- package/fesm2022/{radio-button-BiqPDreS.mjs → radio-button-92xc4w-A.mjs} +2 -2
- package/fesm2022/radio-button-92xc4w-A.mjs.map +1 -0
- package/fesm2022/radio-group.mjs +8 -8
- package/fesm2022/radio-group.mjs.map +1 -1
- package/fesm2022/scrolling.mjs +7 -7
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/selection.mjs +19 -19
- package/fesm2022/selection.mjs.map +1 -1
- package/fesm2022/table-scroll-container.mjs +7 -7
- package/fesm2022/table-scroll-container.mjs.map +1 -1
- package/fesm2022/{tabs-DvjCdS14.mjs → tabs-hMdwtXv2.mjs} +2 -2
- package/fesm2022/tabs-hMdwtXv2.mjs.map +1 -0
- package/fesm2022/tabs.mjs +17 -17
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/tree.mjs +31 -31
- package/fesm2022/tree.mjs.map +1 -1
- package/fesm2022/ui-patterns.mjs +6 -6
- package/fesm2022/ui-patterns.mjs.map +1 -1
- package/{list-selection.d-zyz_XRbe.d.ts → list-selection.d-fbAPr_N_.d.ts} +1 -1
- package/{list-typeahead.d-DvIIfjfu.d.ts → list-typeahead.d-ljh3nJ9y.d.ts} +1 -1
- package/listbox/index.d.ts +6 -6
- package/{listbox.d-Ck8-1BdR.d.ts → listbox.d-Ckp1is82.d.ts} +3 -3
- package/package.json +2 -2
- package/{list-navigation.d-tcweHm4g.d.ts → pointer-event-manager.d-BqSm9Jh5.d.ts} +80 -80
- package/radio-group/index.d.ts +3 -3
- package/{radio-group.d-B6Ntu9oI.d.ts → radio-group.d-CFC0aKQM.d.ts} +2 -2
- package/tabs/index.d.ts +4 -4
- package/{tabs.d-BGC0Izc3.d.ts → tabs.d-Db8oTrMB.d.ts} +3 -3
- package/tree/index.d.ts +4 -4
- package/ui-patterns/index.d.ts +8 -8
- package/fesm2022/accordion-CN4PcmAh.mjs.map +0 -1
- package/fesm2022/list-focus-BXQdAA3i.mjs.map +0 -1
- package/fesm2022/option-D44ECQK6.mjs.map +0 -1
- package/fesm2022/radio-button-BiqPDreS.mjs.map +0 -1
- package/fesm2022/tabs-DvjCdS14.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/combobox/combobox.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/combobox/combobox-popup.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/combobox/combobox-module.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 */\nimport {Directionality} from '@angular/cdk/bidi';\nimport {BooleanInput, coerceArray, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {DOWN_ARROW, ENTER, ESCAPE, TAB} from '@angular/cdk/keycodes';\nimport {\n ConnectedPosition,\n createBlockScrollStrategy,\n createFlexibleConnectedPositionStrategy,\n createOverlayRef,\n FlexibleConnectedPositionStrategy,\n OverlayConfig,\n OverlayRef,\n} from '@angular/cdk/overlay';\nimport {_getEventTarget} from '@angular/cdk/platform';\nimport {TemplatePortal} from '@angular/cdk/portal';\n\nimport {\n ChangeDetectorRef,\n Directive,\n ElementRef,\n EventEmitter,\n HOST_TAG_NAME,\n InjectionToken,\n Injector,\n Input,\n OnDestroy,\n Output,\n TemplateRef,\n ViewContainerRef,\n inject,\n DOCUMENT,\n} from '@angular/core';\n\nexport type AriaHasPopupValue = 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';\nexport type OpenAction = 'focus' | 'click' | 'downKey' | 'toggle';\nexport type OpenActionInput = OpenAction | OpenAction[] | string | null | undefined;\n\nconst allowedOpenActions = ['focus', 'click', 'downKey', 'toggle'];\n\nexport const CDK_COMBOBOX = new InjectionToken<CdkCombobox>('CDK_COMBOBOX');\n\n@Directive({\n selector: '[cdkCombobox]',\n exportAs: 'cdkCombobox',\n host: {\n 'role': 'combobox',\n 'class': 'cdk-combobox',\n '(click)': '_handleInteractions(\"click\")',\n '(focus)': '_handleInteractions(\"focus\")',\n '(keydown)': '_keydown($event)',\n '(document:click)': '_attemptClose($event)',\n '[attr.aria-disabled]': 'disabled',\n '[attr.aria-owns]': 'contentId',\n '[attr.aria-haspopup]': 'contentType',\n '[attr.aria-expanded]': 'isOpen()',\n '[attr.tabindex]': '_getTabIndex()',\n },\n providers: [{provide: CDK_COMBOBOX, useExisting: CdkCombobox}],\n})\nexport class CdkCombobox<T = unknown> implements OnDestroy {\n private readonly _tagName = inject(HOST_TAG_NAME);\n private readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n protected readonly _viewContainerRef = inject(ViewContainerRef);\n private readonly _injector = inject(Injector);\n private readonly _doc = inject(DOCUMENT);\n private readonly _directionality = inject(Directionality, {optional: true});\n private _changeDetectorRef = inject(ChangeDetectorRef);\n private _overlayRef: OverlayRef;\n private _panelPortal: TemplatePortal;\n\n @Input('cdkComboboxTriggerFor')\n _panelTemplateRef: TemplateRef<unknown>;\n\n @Input()\n value: T | T[];\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: BooleanInput) {\n this._disabled = coerceBooleanProperty(value);\n }\n private _disabled: boolean = false;\n\n @Input()\n get openActions(): OpenAction[] {\n return this._openActions;\n }\n set openActions(action: OpenActionInput) {\n this._openActions = this._coerceOpenActionProperty(action);\n }\n private _openActions: OpenAction[] = ['click'];\n\n /** Whether the textContent is automatically updated upon change of the combobox value. */\n @Input()\n get autoSetText(): boolean {\n return this._autoSetText;\n }\n set autoSetText(value: BooleanInput) {\n this._autoSetText = coerceBooleanProperty(value);\n }\n private _autoSetText: boolean = true;\n\n @Output('comboboxPanelOpened') readonly opened: EventEmitter<void> = new EventEmitter<void>();\n @Output('comboboxPanelClosed') readonly closed: EventEmitter<void> = new EventEmitter<void>();\n @Output('panelValueChanged') readonly panelValueChanged: EventEmitter<T[]> = new EventEmitter<\n T[]\n >();\n\n contentId: string = '';\n contentType: AriaHasPopupValue;\n\n ngOnDestroy() {\n if (this._overlayRef) {\n this._overlayRef.dispose();\n }\n\n this.opened.complete();\n this.closed.complete();\n this.panelValueChanged.complete();\n }\n\n _keydown(event: KeyboardEvent) {\n const {keyCode} = event;\n\n if (keyCode === DOWN_ARROW) {\n if (this.isOpen()) {\n // TODO: instead of using a focus function, potentially use cdk/a11y focus trapping\n this._doc.getElementById(this.contentId)?.focus();\n } else if (this._openActions.indexOf('downKey') !== -1) {\n this.open();\n }\n } else if (keyCode === ENTER) {\n if (this._openActions.indexOf('toggle') !== -1) {\n this.toggle();\n } else if (this._openActions.indexOf('click') !== -1) {\n this.open();\n }\n } else if (keyCode === ESCAPE) {\n event.preventDefault();\n this.close();\n } else if (keyCode === TAB) {\n this.close();\n }\n }\n\n /** Handles click or focus interactions. */\n _handleInteractions(interaction: OpenAction) {\n if (interaction === 'click') {\n if (this._openActions.indexOf('toggle') !== -1) {\n this.toggle();\n } else if (this._openActions.indexOf('click') !== -1) {\n this.open();\n }\n } else if (interaction === 'focus') {\n if (this._openActions.indexOf('focus') !== -1) {\n this.open();\n }\n }\n }\n\n /** Given a click in the document, determines if the click was inside a combobox. */\n _attemptClose(event: MouseEvent) {\n if (this.isOpen()) {\n let target = _getEventTarget(event);\n while (target instanceof Element) {\n if (target.className.indexOf('cdk-combobox') !== -1) {\n return;\n }\n target = target.parentElement;\n }\n }\n\n this.close();\n }\n\n /** Toggles the open state of the panel. */\n toggle() {\n if (this.hasPanel()) {\n this.isOpen() ? this.close() : this.open();\n }\n }\n\n /** If the combobox is closed and not disabled, opens the panel. */\n open() {\n if (!this.isOpen() && !this.disabled) {\n this.opened.next();\n this._overlayRef =\n this._overlayRef || createOverlayRef(this._injector, this._getOverlayConfig());\n this._overlayRef.attach(this._getPanelContent());\n this._changeDetectorRef.markForCheck();\n if (!this._isTextTrigger()) {\n // TODO: instead of using a focus function, potentially use cdk/a11y focus trapping\n this._doc.getElementById(this.contentId)?.focus();\n }\n }\n }\n\n /** If the combobox is open and not disabled, closes the panel. */\n close() {\n if (this.isOpen() && !this.disabled) {\n this.closed.next();\n this._overlayRef.detach();\n this._changeDetectorRef.markForCheck();\n }\n }\n\n /** Returns true if panel is currently opened. */\n isOpen(): boolean {\n return this._overlayRef ? this._overlayRef.hasAttached() : false;\n }\n\n /** Returns true if combobox has a child panel. */\n hasPanel(): boolean {\n return !!this._panelTemplateRef;\n }\n\n _getTabIndex(): string | null {\n return this.disabled ? null : '0';\n }\n\n private _setComboboxValue(value: T | T[]) {\n const valueChanged = this.value !== value;\n this.value = value;\n\n if (valueChanged) {\n this.panelValueChanged.emit(coerceArray(value));\n if (this._autoSetText) {\n this._setTextContent(value);\n }\n }\n }\n\n updateAndClose(value: T | T[]) {\n this._setComboboxValue(value);\n this.close();\n }\n\n private _setTextContent(content: T | T[]) {\n const contentArray = coerceArray(content);\n this._elementRef.nativeElement.textContent = contentArray.join(' ');\n }\n\n private _isTextTrigger() {\n // TODO: Should check if the trigger is contenteditable.\n const tagName = this._tagName.toLowerCase();\n return tagName === 'input' || tagName === 'textarea';\n }\n\n private _getOverlayConfig() {\n return new OverlayConfig({\n positionStrategy: this._getOverlayPositionStrategy(),\n scrollStrategy: createBlockScrollStrategy(this._injector),\n direction: this._directionality || undefined,\n });\n }\n\n private _getOverlayPositionStrategy(): FlexibleConnectedPositionStrategy {\n return createFlexibleConnectedPositionStrategy(this._injector, this._elementRef).withPositions(\n this._getOverlayPositions(),\n );\n }\n\n private _getOverlayPositions(): ConnectedPosition[] {\n return [\n {originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top'},\n {originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom'},\n {originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top'},\n {originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom'},\n ];\n }\n\n private _getPanelInjector() {\n return this._injector;\n }\n\n private _getPanelContent() {\n const hasPanelChanged = this._panelTemplateRef !== this._panelPortal?.templateRef;\n if (this._panelTemplateRef && (!this._panelPortal || hasPanelChanged)) {\n this._panelPortal = new TemplatePortal(\n this._panelTemplateRef,\n this._viewContainerRef,\n undefined,\n this._getPanelInjector(),\n );\n }\n\n return this._panelPortal;\n }\n\n private _coerceOpenActionProperty(input: OpenActionInput): OpenAction[] {\n let actions = typeof input === 'string' ? input.trim().split(/[ ,]+/) : input;\n if (\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n actions?.some(a => allowedOpenActions.indexOf(a) === -1)\n ) {\n throw Error(`${input} is not a support open action for CdkCombobox`);\n }\n return actions as OpenAction[];\n }\n\n /** Registers the content's id and the content type with the panel. */\n _registerContent(contentId: string, contentType: AriaHasPopupValue) {\n if (\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n contentType !== 'listbox' &&\n contentType !== 'dialog'\n ) {\n throw Error('CdkComboboxPanel currently only supports listbox or dialog content.');\n }\n this.contentId = contentId;\n this.contentType = contentType;\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 {Directive, ElementRef, Input, OnInit, inject} from '@angular/core';\nimport {_IdGenerator} from '@angular/cdk/a11y';\nimport {AriaHasPopupValue, CDK_COMBOBOX, CdkCombobox} from './combobox';\n\n@Directive({\n selector: '[cdkComboboxPopup]',\n exportAs: 'cdkComboboxPopup',\n host: {\n 'class': 'cdk-combobox-popup',\n '[attr.role]': 'role',\n '[id]': 'id',\n 'tabindex': '-1',\n '(focus)': 'focusFirstElement()',\n },\n})\nexport class CdkComboboxPopup<T = unknown> implements OnInit {\n private readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly _combobox = inject<CdkCombobox>(CDK_COMBOBOX);\n\n @Input()\n get role(): AriaHasPopupValue {\n return this._role;\n }\n set role(value: AriaHasPopupValue) {\n this._role = value;\n }\n private _role: AriaHasPopupValue = 'dialog';\n\n @Input()\n get firstFocus(): HTMLElement {\n return this._firstFocusElement;\n }\n set firstFocus(id: HTMLElement) {\n this._firstFocusElement = id;\n }\n private _firstFocusElement: HTMLElement;\n\n @Input() id: string = inject(_IdGenerator).getId('cdk-combobox-popup-');\n\n ngOnInit() {\n this.registerWithPanel();\n }\n\n registerWithPanel(): void {\n this._combobox._registerContent(this.id, this._role);\n }\n\n focusFirstElement() {\n if (this._firstFocusElement) {\n this._firstFocusElement.focus();\n } else {\n this._elementRef.nativeElement.focus();\n }\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 {NgModule} from '@angular/core';\nimport {OverlayModule} from '@angular/cdk/overlay';\nimport {CdkCombobox} from './combobox';\nimport {CdkComboboxPopup} from './combobox-popup';\n\nconst EXPORTED_DECLARATIONS = [CdkCombobox, CdkComboboxPopup];\n@NgModule({\n imports: [OverlayModule, ...EXPORTED_DECLARATIONS],\n exports: EXPORTED_DECLARATIONS,\n})\nexport class CdkComboboxModule {}\n"],"names":[],"mappings":";;;;;;;;;;AA2CA,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;MAErD,YAAY,GAAG,IAAI,cAAc,CAAc,cAAc;MAoB7D,WAAW,CAAA;AACL,IAAA,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC;AAChC,IAAA,WAAW,GAAG,MAAM,CAA0B,UAAU,CAAC;AACvD,IAAA,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAC9C,IAAA,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC5B,IAAA,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC;IACvB,eAAe,GAAG,MAAM,CAAC,cAAc,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;AACnE,IAAA,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC9C,IAAA,WAAW;AACX,IAAA,YAAY;AAGpB,IAAA,iBAAiB;AAGjB,IAAA,KAAK;AAEL,IAA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A,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,eAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,YAHlB,aAAa,CAAA,EAAA,CAAA;;kGAGZ,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,aAAa,EAAE,GAAG,qBAAqB,CAAC;AAClD,oBAAA,OAAO,EAAE,qBAAqB;AAC/B,iBAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"combobox.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/combobox/combobox.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/combobox/combobox-popup.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/combobox/combobox-module.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 */\nimport {Directionality} from '@angular/cdk/bidi';\nimport {BooleanInput, coerceArray, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {DOWN_ARROW, ENTER, ESCAPE, TAB} from '@angular/cdk/keycodes';\nimport {\n ConnectedPosition,\n createBlockScrollStrategy,\n createFlexibleConnectedPositionStrategy,\n createOverlayRef,\n FlexibleConnectedPositionStrategy,\n OverlayConfig,\n OverlayRef,\n} from '@angular/cdk/overlay';\nimport {_getEventTarget} from '@angular/cdk/platform';\nimport {TemplatePortal} from '@angular/cdk/portal';\n\nimport {\n ChangeDetectorRef,\n Directive,\n ElementRef,\n EventEmitter,\n HOST_TAG_NAME,\n InjectionToken,\n Injector,\n Input,\n OnDestroy,\n Output,\n TemplateRef,\n ViewContainerRef,\n inject,\n DOCUMENT,\n} from '@angular/core';\n\nexport type AriaHasPopupValue = 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';\nexport type OpenAction = 'focus' | 'click' | 'downKey' | 'toggle';\nexport type OpenActionInput = OpenAction | OpenAction[] | string | null | undefined;\n\nconst allowedOpenActions = ['focus', 'click', 'downKey', 'toggle'];\n\nexport const CDK_COMBOBOX = new InjectionToken<CdkCombobox>('CDK_COMBOBOX');\n\n@Directive({\n selector: '[cdkCombobox]',\n exportAs: 'cdkCombobox',\n host: {\n 'role': 'combobox',\n 'class': 'cdk-combobox',\n '(click)': '_handleInteractions(\"click\")',\n '(focus)': '_handleInteractions(\"focus\")',\n '(keydown)': '_keydown($event)',\n '(document:click)': '_attemptClose($event)',\n '[attr.aria-disabled]': 'disabled',\n '[attr.aria-owns]': 'contentId',\n '[attr.aria-haspopup]': 'contentType',\n '[attr.aria-expanded]': 'isOpen()',\n '[attr.tabindex]': '_getTabIndex()',\n },\n providers: [{provide: CDK_COMBOBOX, useExisting: CdkCombobox}],\n})\nexport class CdkCombobox<T = unknown> implements OnDestroy {\n private readonly _tagName = inject(HOST_TAG_NAME);\n private readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n protected readonly _viewContainerRef = inject(ViewContainerRef);\n private readonly _injector = inject(Injector);\n private readonly _doc = inject(DOCUMENT);\n private readonly _directionality = inject(Directionality, {optional: true});\n private _changeDetectorRef = inject(ChangeDetectorRef);\n private _overlayRef: OverlayRef;\n private _panelPortal: TemplatePortal;\n\n @Input('cdkComboboxTriggerFor')\n _panelTemplateRef: TemplateRef<unknown>;\n\n @Input()\n value: T | T[];\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: BooleanInput) {\n this._disabled = coerceBooleanProperty(value);\n }\n private _disabled: boolean = false;\n\n @Input()\n get openActions(): OpenAction[] {\n return this._openActions;\n }\n set openActions(action: OpenActionInput) {\n this._openActions = this._coerceOpenActionProperty(action);\n }\n private _openActions: OpenAction[] = ['click'];\n\n /** Whether the textContent is automatically updated upon change of the combobox value. */\n @Input()\n get autoSetText(): boolean {\n return this._autoSetText;\n }\n set autoSetText(value: BooleanInput) {\n this._autoSetText = coerceBooleanProperty(value);\n }\n private _autoSetText: boolean = true;\n\n @Output('comboboxPanelOpened') readonly opened: EventEmitter<void> = new EventEmitter<void>();\n @Output('comboboxPanelClosed') readonly closed: EventEmitter<void> = new EventEmitter<void>();\n @Output('panelValueChanged') readonly panelValueChanged: EventEmitter<T[]> = new EventEmitter<\n T[]\n >();\n\n contentId: string = '';\n contentType: AriaHasPopupValue;\n\n ngOnDestroy() {\n if (this._overlayRef) {\n this._overlayRef.dispose();\n }\n\n this.opened.complete();\n this.closed.complete();\n this.panelValueChanged.complete();\n }\n\n _keydown(event: KeyboardEvent) {\n const {keyCode} = event;\n\n if (keyCode === DOWN_ARROW) {\n if (this.isOpen()) {\n // TODO: instead of using a focus function, potentially use cdk/a11y focus trapping\n this._doc.getElementById(this.contentId)?.focus();\n } else if (this._openActions.indexOf('downKey') !== -1) {\n this.open();\n }\n } else if (keyCode === ENTER) {\n if (this._openActions.indexOf('toggle') !== -1) {\n this.toggle();\n } else if (this._openActions.indexOf('click') !== -1) {\n this.open();\n }\n } else if (keyCode === ESCAPE) {\n event.preventDefault();\n this.close();\n } else if (keyCode === TAB) {\n this.close();\n }\n }\n\n /** Handles click or focus interactions. */\n _handleInteractions(interaction: OpenAction) {\n if (interaction === 'click') {\n if (this._openActions.indexOf('toggle') !== -1) {\n this.toggle();\n } else if (this._openActions.indexOf('click') !== -1) {\n this.open();\n }\n } else if (interaction === 'focus') {\n if (this._openActions.indexOf('focus') !== -1) {\n this.open();\n }\n }\n }\n\n /** Given a click in the document, determines if the click was inside a combobox. */\n _attemptClose(event: MouseEvent) {\n if (this.isOpen()) {\n let target = _getEventTarget(event);\n while (target instanceof Element) {\n if (target.className.indexOf('cdk-combobox') !== -1) {\n return;\n }\n target = target.parentElement;\n }\n }\n\n this.close();\n }\n\n /** Toggles the open state of the panel. */\n toggle() {\n if (this.hasPanel()) {\n this.isOpen() ? this.close() : this.open();\n }\n }\n\n /** If the combobox is closed and not disabled, opens the panel. */\n open() {\n if (!this.isOpen() && !this.disabled) {\n this.opened.next();\n this._overlayRef =\n this._overlayRef || createOverlayRef(this._injector, this._getOverlayConfig());\n this._overlayRef.attach(this._getPanelContent());\n this._changeDetectorRef.markForCheck();\n if (!this._isTextTrigger()) {\n // TODO: instead of using a focus function, potentially use cdk/a11y focus trapping\n this._doc.getElementById(this.contentId)?.focus();\n }\n }\n }\n\n /** If the combobox is open and not disabled, closes the panel. */\n close() {\n if (this.isOpen() && !this.disabled) {\n this.closed.next();\n this._overlayRef.detach();\n this._changeDetectorRef.markForCheck();\n }\n }\n\n /** Returns true if panel is currently opened. */\n isOpen(): boolean {\n return this._overlayRef ? this._overlayRef.hasAttached() : false;\n }\n\n /** Returns true if combobox has a child panel. */\n hasPanel(): boolean {\n return !!this._panelTemplateRef;\n }\n\n _getTabIndex(): string | null {\n return this.disabled ? null : '0';\n }\n\n private _setComboboxValue(value: T | T[]) {\n const valueChanged = this.value !== value;\n this.value = value;\n\n if (valueChanged) {\n this.panelValueChanged.emit(coerceArray(value));\n if (this._autoSetText) {\n this._setTextContent(value);\n }\n }\n }\n\n updateAndClose(value: T | T[]) {\n this._setComboboxValue(value);\n this.close();\n }\n\n private _setTextContent(content: T | T[]) {\n const contentArray = coerceArray(content);\n this._elementRef.nativeElement.textContent = contentArray.join(' ');\n }\n\n private _isTextTrigger() {\n // TODO: Should check if the trigger is contenteditable.\n const tagName = this._tagName.toLowerCase();\n return tagName === 'input' || tagName === 'textarea';\n }\n\n private _getOverlayConfig() {\n return new OverlayConfig({\n positionStrategy: this._getOverlayPositionStrategy(),\n scrollStrategy: createBlockScrollStrategy(this._injector),\n direction: this._directionality || undefined,\n });\n }\n\n private _getOverlayPositionStrategy(): FlexibleConnectedPositionStrategy {\n return createFlexibleConnectedPositionStrategy(this._injector, this._elementRef).withPositions(\n this._getOverlayPositions(),\n );\n }\n\n private _getOverlayPositions(): ConnectedPosition[] {\n return [\n {originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top'},\n {originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom'},\n {originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top'},\n {originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom'},\n ];\n }\n\n private _getPanelInjector() {\n return this._injector;\n }\n\n private _getPanelContent() {\n const hasPanelChanged = this._panelTemplateRef !== this._panelPortal?.templateRef;\n if (this._panelTemplateRef && (!this._panelPortal || hasPanelChanged)) {\n this._panelPortal = new TemplatePortal(\n this._panelTemplateRef,\n this._viewContainerRef,\n undefined,\n this._getPanelInjector(),\n );\n }\n\n return this._panelPortal;\n }\n\n private _coerceOpenActionProperty(input: OpenActionInput): OpenAction[] {\n let actions = typeof input === 'string' ? input.trim().split(/[ ,]+/) : input;\n if (\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n actions?.some(a => allowedOpenActions.indexOf(a) === -1)\n ) {\n throw Error(`${input} is not a support open action for CdkCombobox`);\n }\n return actions as OpenAction[];\n }\n\n /** Registers the content's id and the content type with the panel. */\n _registerContent(contentId: string, contentType: AriaHasPopupValue) {\n if (\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n contentType !== 'listbox' &&\n contentType !== 'dialog'\n ) {\n throw Error('CdkComboboxPanel currently only supports listbox or dialog content.');\n }\n this.contentId = contentId;\n this.contentType = contentType;\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 {Directive, ElementRef, Input, OnInit, inject} from '@angular/core';\nimport {_IdGenerator} from '@angular/cdk/a11y';\nimport {AriaHasPopupValue, CDK_COMBOBOX, CdkCombobox} from './combobox';\n\n@Directive({\n selector: '[cdkComboboxPopup]',\n exportAs: 'cdkComboboxPopup',\n host: {\n 'class': 'cdk-combobox-popup',\n '[attr.role]': 'role',\n '[id]': 'id',\n 'tabindex': '-1',\n '(focus)': 'focusFirstElement()',\n },\n})\nexport class CdkComboboxPopup<T = unknown> implements OnInit {\n private readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly _combobox = inject<CdkCombobox>(CDK_COMBOBOX);\n\n @Input()\n get role(): AriaHasPopupValue {\n return this._role;\n }\n set role(value: AriaHasPopupValue) {\n this._role = value;\n }\n private _role: AriaHasPopupValue = 'dialog';\n\n @Input()\n get firstFocus(): HTMLElement {\n return this._firstFocusElement;\n }\n set firstFocus(id: HTMLElement) {\n this._firstFocusElement = id;\n }\n private _firstFocusElement: HTMLElement;\n\n @Input() id: string = inject(_IdGenerator).getId('cdk-combobox-popup-');\n\n ngOnInit() {\n this.registerWithPanel();\n }\n\n registerWithPanel(): void {\n this._combobox._registerContent(this.id, this._role);\n }\n\n focusFirstElement() {\n if (this._firstFocusElement) {\n this._firstFocusElement.focus();\n } else {\n this._elementRef.nativeElement.focus();\n }\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 {NgModule} from '@angular/core';\nimport {OverlayModule} from '@angular/cdk/overlay';\nimport {CdkCombobox} from './combobox';\nimport {CdkComboboxPopup} from './combobox-popup';\n\nconst EXPORTED_DECLARATIONS = [CdkCombobox, CdkComboboxPopup];\n@NgModule({\n imports: [OverlayModule, ...EXPORTED_DECLARATIONS],\n exports: EXPORTED_DECLARATIONS,\n})\nexport class CdkComboboxModule {}\n"],"names":[],"mappings":";;;;;;;;;;AA2CA,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;MAErD,YAAY,GAAG,IAAI,cAAc,CAAc,cAAc;MAoB7D,WAAW,CAAA;AACL,IAAA,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC;AAChC,IAAA,WAAW,GAAG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UG,UAAU,EAAA,CAAA;sBADb;gBASQ,EAAE,EAAA,CAAA;sBAAV;;;AChCH,MAAM,qBAAqB,GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAC;MAKhD,iBAAiB,CAAA;8GAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;+GAAjB,iBAAiB,EAAA,OAAA,EAAA,CAHlB,aAAa,EAFM,WAAW,EAAE,gBAAgB,CAAA,EAAA,OAAA,EAAA,CAA7B,WAAW,EAAE,gBAAgB,CAAA,EAAA,CAAA;AAK/C,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,eAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,YAHlB,aAAa,CAAA,EAAA,CAAA;;kGAGZ,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,aAAa,EAAE,GAAG,qBAAqB,CAAC;AAClD,oBAAA,OAAO,EAAE,qBAAqB;AAC/B,iBAAA;;;;;"}
|
|
@@ -7,10 +7,10 @@ import { signal, input, Directive, inject, TemplateRef, ViewContainerRef, effect
|
|
|
7
7
|
class DeferredContentAware {
|
|
8
8
|
contentVisible = signal(false, ...(ngDevMode ? [{ debugName: "contentVisible" }] : []));
|
|
9
9
|
preserveContent = input(false, ...(ngDevMode ? [{ debugName: "preserveContent" }] : []));
|
|
10
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
11
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.
|
|
10
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.1", ngImport: i0, type: DeferredContentAware, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
11
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.1", type: DeferredContentAware, isStandalone: true, inputs: { preserveContent: { classPropertyName: "preserveContent", publicName: "preserveContent", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
12
12
|
}
|
|
13
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
13
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.1", ngImport: i0, type: DeferredContentAware, decorators: [{
|
|
14
14
|
type: Directive
|
|
15
15
|
}] });
|
|
16
16
|
/**
|
|
@@ -49,10 +49,10 @@ class DeferredContent {
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
53
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.
|
|
52
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.1", ngImport: i0, type: DeferredContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
53
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.1", type: DeferredContent, isStandalone: true, ngImport: i0 });
|
|
54
54
|
}
|
|
55
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.1", ngImport: i0, type: DeferredContent, decorators: [{
|
|
56
56
|
type: Directive
|
|
57
57
|
}], ctorParameters: () => [] });
|
|
58
58
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deferred-content.mjs","sources":["../../../../../
|
|
1
|
+
{"version":3,"file":"deferred-content.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/deferred-content/deferred-content.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 Directive,\n effect,\n inject,\n input,\n TemplateRef,\n signal,\n ViewContainerRef,\n} from '@angular/core';\n\n/**\n * A container directive controls the visibility of its content.\n */\n@Directive()\nexport class DeferredContentAware {\n contentVisible = signal(false);\n readonly preserveContent = input(false);\n}\n\n/**\n * DeferredContent loads/unloads the content based on the visibility.\n * The visibilty signal is sent from a parent directive implements\n * DeferredContentAware.\n *\n * Use this directive as a host directive. For example:\n *\n * ```ts\n * @Directive({\n * selector: 'ng-template[cdkAccordionContent]',\n * hostDirectives: [DeferredContent],\n * })\n * class CdkAccordionContent {}\n * ```\n */\n@Directive()\nexport class DeferredContent {\n private readonly _deferredContentAware = inject(DeferredContentAware);\n private readonly _templateRef = inject(TemplateRef);\n private readonly _viewContainerRef = inject(ViewContainerRef);\n private _isRendered = false;\n\n constructor() {\n effect(() => {\n if (\n this._deferredContentAware.preserveContent() ||\n this._deferredContentAware.contentVisible()\n ) {\n if (this._isRendered) return;\n this._viewContainerRef.clear();\n this._viewContainerRef.createEmbeddedView(this._templateRef);\n this._isRendered = true;\n } else {\n this._viewContainerRef.clear();\n this._isRendered = false;\n }\n });\n }\n}\n"],"names":[],"mappings":";;;AAkBA;;AAEG;MAEU,oBAAoB,CAAA;AAC/B,IAAA,cAAc,GAAG,MAAM,CAAC,KAAK,0DAAC;AACrB,IAAA,eAAe,GAAG,KAAK,CAAC,KAAK,2DAAC;8GAF5B,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;kGAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,eAAA,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.mjs","sources":["../../../../../
|
|
1
|
+
{"version":3,"file":"expansion-C9iQLHOG.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/expansion/expansion.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 */\nimport {computed} from '@angular/core';\nimport {SignalLike, WritableSignalLike} from '../signal-like/signal-like';\n\n/** Represents an item that can be expanded or collapsed. */\nexport interface ExpansionItem {\n /** Whether the item is expandable. */\n expandable: SignalLike<boolean>;\n\n /** Used to uniquely identify an expansion item. */\n expansionId: SignalLike<string>;\n\n /** Whether the expansion is disabled. */\n disabled: SignalLike<boolean>;\n}\n\nexport interface ExpansionControl extends ExpansionItem {}\n/**\n * Controls a single item's expansion state and interactions,\n * delegating actual state changes to an Expansion manager.\n */\nexport class ExpansionControl {\n /** Whether this specific item is currently expanded. Derived from the Expansion manager. */\n readonly isExpanded = computed(() => this.inputs.expansionManager.isExpanded(this));\n\n /** Whether this item can be expanded. */\n readonly isExpandable = computed(() => this.inputs.expansionManager.isExpandable(this));\n\n constructor(readonly inputs: ExpansionItem & {expansionManager: ListExpansion}) {\n this.expansionId = inputs.expansionId;\n this.expandable = inputs.expandable;\n this.disabled = inputs.disabled;\n }\n\n /** Requests the Expansopn manager to open this item. */\n open() {\n this.inputs.expansionManager.open(this);\n }\n\n /** Requests the Expansion manager to close this item. */\n close() {\n this.inputs.expansionManager.close(this);\n }\n\n /** Requests the Expansion manager to toggle this item. */\n toggle() {\n this.inputs.expansionManager.toggle(this);\n }\n}\n\n/** Represents the required inputs for an expansion behavior. */\nexport interface ListExpansionInputs {\n /** Whether multiple items can be expanded at once. */\n multiExpandable: SignalLike<boolean>;\n\n /** An array of ids of the currently expanded items. */\n expandedIds: WritableSignalLike<string[]>;\n\n /** An array of expansion items. */\n items: SignalLike<ExpansionItem[]>;\n\n /** Whether all expansions are disabled. */\n disabled: SignalLike<boolean>;\n}\n\n/** Manages the expansion state of a list of items. */\nexport class ListExpansion {\n /** A signal holding an array of ids of the currently expanded items. */\n expandedIds: WritableSignalLike<string[]>;\n\n constructor(readonly inputs: ListExpansionInputs) {\n this.expandedIds = inputs.expandedIds;\n }\n\n /** Opens the specified item. */\n open(item: ExpansionItem) {\n if (!this.isExpandable(item)) return;\n if (this.isExpanded(item)) return;\n if (!this.inputs.multiExpandable()) {\n this.closeAll();\n }\n this.expandedIds.update(ids => ids.concat(item.expansionId()));\n }\n\n /** Closes the specified item. */\n close(item: ExpansionItem) {\n if (this.isExpandable(item)) {\n this.expandedIds.update(ids => ids.filter(id => id !== item.expansionId()));\n }\n }\n\n /** Toggles the expansion state of the specified item. */\n toggle(item: ExpansionItem) {\n this.expandedIds().includes(item.expansionId()) ? this.close(item) : this.open(item);\n }\n\n /** Opens all focusable items in the list. */\n openAll() {\n if (this.inputs.multiExpandable()) {\n for (const item of this.inputs.items()) {\n this.open(item);\n }\n }\n }\n\n /** Closes all focusable items in the list. */\n closeAll() {\n for (const item of this.inputs.items()) {\n this.close(item);\n }\n }\n\n /** Checks whether the specified item is expandable / collapsible. */\n isExpandable(item: ExpansionItem) {\n return !this.inputs.disabled() && !item.disabled() && item.expandable();\n }\n\n /** Checks whether the specified item is currently expanded. */\n isExpanded(item: ExpansionItem): boolean {\n return this.expandedIds().includes(item.expansionId());\n }\n}\n"],"names":[],"mappings":";;AAuBA;;;AAGG;MACU,gBAAgB,CAAA;AAON,IAAA,MAAA;;AALZ,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;;AAG1E,IAAA,YAAY,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AAEvF,IAAA,WAAA,CAAqB,MAAyD,EAAA;QAAz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AAE,IAAI,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;;;;AAK/E,IAAA,MAAM,CAAC,IAAmB,EAAA;AACxB,QAAA,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;;;IAItF,OAAO,GAAA;AACL,QAAA,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE;YACjC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE;AACtC,gBAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;IAMrB,QAAQ,GAAA;QACN,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE;AACtC,YAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;;;;AAKpB,IAAA,YAAY,CAAC,IAAmB,EAAA;AAC9B,QAAA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE;;;AAIzE,IAAA,UAAU,CAAC,IAAmB,EAAA;AAC5B,QAAA,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;;AAEzD;;;;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { signal, computed } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
/** Bit flag representation of the possible modifier keys that can be present on an event. */
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})(
|
|
4
|
+
var Modifier;
|
|
5
|
+
(function (Modifier) {
|
|
6
|
+
Modifier[Modifier["None"] = 0] = "None";
|
|
7
|
+
Modifier[Modifier["Ctrl"] = 1] = "Ctrl";
|
|
8
|
+
Modifier[Modifier["Shift"] = 2] = "Shift";
|
|
9
|
+
Modifier[Modifier["Alt"] = 4] = "Alt";
|
|
10
|
+
Modifier[Modifier["Meta"] = 8] = "Meta";
|
|
11
|
+
Modifier["Any"] = "Any";
|
|
12
|
+
})(Modifier || (Modifier = {}));
|
|
13
13
|
/**
|
|
14
14
|
* Abstract base class for all event managers.
|
|
15
15
|
*
|
|
@@ -35,10 +35,10 @@ class EventManager {
|
|
|
35
35
|
}
|
|
36
36
|
/** Gets bit flag representation of the modifier keys present on the given event. */
|
|
37
37
|
function getModifiers(event) {
|
|
38
|
-
return ((+event.ctrlKey &&
|
|
39
|
-
(+event.shiftKey &&
|
|
40
|
-
(+event.altKey &&
|
|
41
|
-
(+event.metaKey &&
|
|
38
|
+
return ((+event.ctrlKey && Modifier.Ctrl) |
|
|
39
|
+
(+event.shiftKey && Modifier.Shift) |
|
|
40
|
+
(+event.altKey && Modifier.Alt) |
|
|
41
|
+
(+event.metaKey && Modifier.Meta));
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Checks if the given event has modifiers that are an exact match for any of the given modifier
|
|
@@ -47,7 +47,7 @@ function getModifiers(event) {
|
|
|
47
47
|
function hasModifiers(event, modifiers) {
|
|
48
48
|
const eventModifiers = getModifiers(event);
|
|
49
49
|
const modifiersList = Array.isArray(modifiers) ? modifiers : [modifiers];
|
|
50
|
-
if (modifiersList.includes(
|
|
50
|
+
if (modifiersList.includes(Modifier.Any)) {
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
53
|
return modifiersList.some(modifiers => eventModifiers === modifiers);
|
|
@@ -74,7 +74,7 @@ class KeyboardEventManager extends EventManager {
|
|
|
74
74
|
_normalizeInputs(...args) {
|
|
75
75
|
const key = args.length === 3 ? args[1] : args[0];
|
|
76
76
|
const handler = args.length === 3 ? args[2] : args[1];
|
|
77
|
-
const modifiers = args.length === 3 ? args[0] :
|
|
77
|
+
const modifiers = args.length === 3 ? args[0] : Modifier.None;
|
|
78
78
|
return {
|
|
79
79
|
key: key,
|
|
80
80
|
handler: handler,
|
|
@@ -134,7 +134,7 @@ class PointerEventManager extends EventManager {
|
|
|
134
134
|
}
|
|
135
135
|
return {
|
|
136
136
|
button: MouseButton.Main,
|
|
137
|
-
modifiers:
|
|
137
|
+
modifiers: Modifier.None,
|
|
138
138
|
handler: args[0],
|
|
139
139
|
};
|
|
140
140
|
}
|
|
@@ -254,5 +254,5 @@ class ListFocus {
|
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
export { KeyboardEventManager as K, ListFocus as L,
|
|
258
|
-
//# sourceMappingURL=list-focus-
|
|
257
|
+
export { KeyboardEventManager as K, ListFocus as L, Modifier as M, PointerEventManager as P, ListNavigation as a };
|
|
258
|
+
//# sourceMappingURL=list-focus-Czul8jzR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-focus-Czul8jzR.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/event-manager.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/keyboard-event-manager.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/pointer-event-manager.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/list-navigation/list-navigation.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/list-focus/list-focus.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\n/**\n * An event that supports modifier keys.\n *\n * Matches the native KeyboardEvent, MouseEvent, and TouchEvent.\n */\nexport interface EventWithModifiers extends Event {\n ctrlKey: boolean;\n shiftKey: boolean;\n altKey: boolean;\n metaKey: boolean;\n}\n\n/**\n * Options that are applicable to all event handlers.\n *\n * This library has not yet had a need for stopPropagationImmediate.\n */\nexport interface EventHandlerOptions {\n stopPropagation: boolean;\n preventDefault: boolean;\n}\n\n/** A basic event handler. */\nexport type EventHandler<T extends Event> = (event: T) => void;\n\n/** A function that determines whether an event is to be handled. */\nexport type EventMatcher<T extends Event> = (event: T) => boolean;\n\n/** A config that specifies how to handle a particular event. */\nexport interface EventHandlerConfig<T extends Event> extends EventHandlerOptions {\n matcher: EventMatcher<T>;\n handler: EventHandler<T>;\n}\n\n/** Bit flag representation of the possible modifier keys that can be present on an event. */\nexport enum Modifier {\n None = 0,\n Ctrl = 0b1,\n Shift = 0b10,\n Alt = 0b100,\n Meta = 0b1000,\n Any = 'Any',\n}\n\nexport type ModifierInputs = Modifier | Modifier[];\n\n/**\n * Abstract base class for all event managers.\n *\n * Event managers are designed to normalize how event handlers are authored and create a safety net\n * for common event handling gotchas like remembering to call preventDefault or stopPropagation.\n */\nexport abstract class EventManager<T extends Event> {\n protected configs: EventHandlerConfig<T>[] = [];\n abstract options: EventHandlerOptions;\n\n /** Runs the handlers that match with the given event. */\n handle(event: T): void {\n for (const config of this.configs) {\n if (config.matcher(event)) {\n config.handler(event);\n\n if (config.preventDefault) {\n event.preventDefault();\n }\n\n if (config.stopPropagation) {\n event.stopPropagation();\n }\n }\n }\n }\n\n /** Configures the event manager to handle specific events. (See subclasses for more). */\n abstract on(...args: [...unknown[]]): this;\n}\n\n/** Gets bit flag representation of the modifier keys present on the given event. */\nexport function getModifiers(event: EventWithModifiers): number {\n return (\n (+event.ctrlKey && Modifier.Ctrl) |\n (+event.shiftKey && Modifier.Shift) |\n (+event.altKey && Modifier.Alt) |\n (+event.metaKey && Modifier.Meta)\n );\n}\n\n/**\n * Checks if the given event has modifiers that are an exact match for any of the given modifier\n * flag combinations.\n */\nexport function hasModifiers(event: EventWithModifiers, modifiers: ModifierInputs): boolean {\n const eventModifiers = getModifiers(event);\n const modifiersList = Array.isArray(modifiers) ? modifiers : [modifiers];\n\n if (modifiersList.includes(Modifier.Any)) {\n return true;\n }\n\n return modifiersList.some(modifiers => eventModifiers === modifiers);\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 {SignalLike} from '../signal-like/signal-like';\nimport {\n EventHandler,\n EventHandlerOptions,\n EventManager,\n hasModifiers,\n ModifierInputs,\n Modifier,\n} from './event-manager';\n\n/**\n * Used to represent a keycode.\n *\n * This is used to match whether an events keycode should be handled. The ability to match using a\n * string, SignalLike, or Regexp gives us more flexibility when authoring event handlers.\n */\ntype KeyCode = string | SignalLike<string> | RegExp;\n\n/**\n * An event manager that is specialized for handling keyboard events. By default this manager stops\n * propagation and prevents default on all events it handles.\n */\nexport class KeyboardEventManager<T extends KeyboardEvent> extends EventManager<T> {\n options: EventHandlerOptions = {\n preventDefault: true,\n stopPropagation: true,\n };\n\n /** Configures this event manager to handle events with a specific key and no modifiers. */\n on(key: KeyCode, handler: EventHandler<T>): this;\n\n /** Configures this event manager to handle events with a specific modifer and key combination. */\n on(modifiers: ModifierInputs, key: KeyCode, handler: EventHandler<T>): this;\n\n on(...args: any[]) {\n const {modifiers, key, handler} = this._normalizeInputs(...args);\n\n this.configs.push({\n handler: handler,\n matcher: event => this._isMatch(event, key, modifiers),\n ...this.options,\n });\n\n return this;\n }\n\n private _normalizeInputs(...args: any[]) {\n const key = args.length === 3 ? args[1] : args[0];\n const handler = args.length === 3 ? args[2] : args[1];\n const modifiers = args.length === 3 ? args[0] : Modifier.None;\n\n return {\n key: key as KeyCode,\n handler: handler as EventHandler<T>,\n modifiers: modifiers as ModifierInputs,\n };\n }\n\n private _isMatch(event: T, key: KeyCode, modifiers: ModifierInputs) {\n if (!hasModifiers(event, modifiers)) {\n return false;\n }\n\n if (key instanceof RegExp) {\n return key.test(event.key);\n }\n\n const keyStr = typeof key === 'string' ? key : key();\n return keyStr.toLowerCase() === event.key.toLowerCase();\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 EventHandler,\n EventHandlerOptions,\n EventManager,\n hasModifiers,\n ModifierInputs,\n Modifier,\n} from './event-manager';\n\n/**\n * The different mouse buttons that may appear on a pointer event.\n */\nexport enum MouseButton {\n Main = 0,\n Auxiliary = 1,\n Secondary = 2,\n}\n\n/** An event manager that is specialized for handling pointer events. */\nexport class PointerEventManager<T extends PointerEvent> extends EventManager<T> {\n options: EventHandlerOptions = {\n preventDefault: false,\n stopPropagation: false,\n };\n\n /**\n * Configures this event manager to handle events with a specific modifer and mouse button\n * combination.\n */\n on(button: MouseButton, modifiers: ModifierInputs, handler: EventHandler<T>): this;\n\n /**\n * Configures this event manager to handle events with a specific mouse button and no modifiers.\n */\n on(modifiers: ModifierInputs, handler: EventHandler<T>): this;\n\n /**\n * Configures this event manager to handle events with the main mouse button and no modifiers.\n *\n * @param handler The handler function\n * @param options Options for whether to stop propagation or prevent default.\n */\n on(handler: EventHandler<T>): this;\n\n on(...args: any[]) {\n const {button, handler, modifiers} = this._normalizeInputs(...args);\n\n this.configs.push({\n handler,\n matcher: event => this._isMatch(event, button, modifiers),\n ...this.options,\n });\n return this;\n }\n\n private _normalizeInputs(...args: any[]) {\n if (args.length === 3) {\n return {\n button: args[0] as MouseButton,\n modifiers: args[1] as ModifierInputs,\n handler: args[2] as EventHandler<T>,\n };\n }\n\n if (typeof args[0] === 'number' && typeof args[1] === 'function') {\n return {\n button: MouseButton.Main,\n modifiers: args[0] as ModifierInputs,\n handler: args[1] as EventHandler<T>,\n };\n }\n\n return {\n button: MouseButton.Main,\n modifiers: Modifier.None,\n handler: args[0] as EventHandler<T>,\n };\n }\n\n _isMatch(event: PointerEvent, button: MouseButton, modifiers: ModifierInputs) {\n return button === (event.button ?? 0) && hasModifiers(event, modifiers);\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 {SignalLike} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\n\n/** Represents an item in a collection, such as a listbox option, than can be navigated to. */\nexport interface ListNavigationItem extends ListFocusItem {}\n\n/** Represents the required inputs for a collection that has navigable items. */\nexport interface ListNavigationInputs<T extends ListNavigationItem> extends ListFocusInputs<T> {\n /** Whether focus should wrap when navigating. */\n wrap: SignalLike<boolean>;\n\n /** Whether the list is vertically or horizontally oriented. */\n orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** The direction that text is read based on the users locale. */\n textDirection: SignalLike<'rtl' | 'ltr'>;\n}\n\n/** Controls navigation for a list of items. */\nexport class ListNavigation<T extends ListNavigationItem> {\n constructor(readonly inputs: ListNavigationInputs<T> & {focusManager: ListFocus<T>}) {}\n\n /** Navigates to the given item. */\n goto(item?: T): boolean {\n return item ? this.inputs.focusManager.focus(item) : false;\n }\n\n /** Navigates to the next item in the list. */\n next(): boolean {\n return this._advance(1);\n }\n\n /** Navigates to the previous item in the list. */\n prev(): boolean {\n return this._advance(-1);\n }\n\n /** Navigates to the first item in the list. */\n first(): boolean {\n const item = this.inputs.items().find(i => this.inputs.focusManager.isFocusable(i));\n return item ? this.goto(item) : false;\n }\n\n /** Navigates to the last item in the list. */\n last(): boolean {\n const items = this.inputs.items();\n for (let i = items.length - 1; i >= 0; i--) {\n if (this.inputs.focusManager.isFocusable(items[i])) {\n return this.goto(items[i]);\n }\n }\n return false;\n }\n\n /** Advances to the next or previous focusable item in the list based on the given delta. */\n private _advance(delta: 1 | -1): boolean {\n const items = this.inputs.items();\n const itemCount = items.length;\n const startIndex = this.inputs.activeIndex();\n const step = (i: number) =>\n this.inputs.wrap() ? (i + delta + itemCount) % itemCount : i + delta;\n\n // If wrapping is enabled, this loop ultimately terminates when `i` gets back to `startIndex`\n // in the case that all options are disabled. If wrapping is disabled, the loop terminates\n // when the index goes out of bounds.\n for (let i = step(startIndex); i !== startIndex && i < itemCount && i >= 0; i = step(i)) {\n if (this.inputs.focusManager.isFocusable(items[i])) {\n return this.goto(items[i]);\n }\n }\n\n return false;\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 {computed, signal} from '@angular/core';\nimport {SignalLike, WritableSignalLike} from '../signal-like/signal-like';\n\n/** Represents an item in a collection, such as a listbox option, than may receive focus. */\nexport interface ListFocusItem {\n /** A unique identifier for the item. */\n id: SignalLike<string>;\n\n /** The html element that should receive focus. */\n element: SignalLike<HTMLElement>;\n\n /** Whether an item is disabled. */\n disabled: SignalLike<boolean>;\n}\n\n/** Represents the required inputs for a collection that contains focusable items. */\nexport interface ListFocusInputs<T extends ListFocusItem> {\n /** The focus strategy used by the list. */\n focusMode: SignalLike<'roving' | 'activedescendant'>;\n\n /** Whether the list is disabled. */\n disabled: SignalLike<boolean>;\n\n /** The items in the list. */\n items: SignalLike<T[]>;\n\n /** The index of the current active item. */\n activeIndex: WritableSignalLike<number>;\n\n /** Whether disabled items in the list should be skipped when navigating. */\n skipDisabled: SignalLike<boolean>;\n}\n\n/** Controls focus for a list of items. */\nexport class ListFocus<T extends ListFocusItem> {\n /** The last index that was active. */\n prevActiveIndex = signal(0);\n\n /** The current active item. */\n activeItem = computed(() => this.inputs.items()[this.inputs.activeIndex()]);\n\n constructor(readonly inputs: ListFocusInputs<T>) {}\n\n /** Whether the list is in a disabled state. */\n isListDisabled(): boolean {\n return this.inputs.disabled() || this.inputs.items().every(i => i.disabled());\n }\n\n /** The id of the current active item. */\n getActiveDescendant(): string | undefined {\n if (this.isListDisabled()) {\n return undefined;\n }\n if (this.inputs.focusMode() === 'roving') {\n return undefined;\n }\n return this.inputs.items()[this.inputs.activeIndex()].id();\n }\n\n /** The tabindex for the list. */\n getListTabindex(): -1 | 0 {\n if (this.isListDisabled()) {\n return 0;\n }\n return this.inputs.focusMode() === 'activedescendant' ? 0 : -1;\n }\n\n /** Returns the tabindex for the given item. */\n getItemTabindex(item: T): -1 | 0 {\n if (this.isListDisabled()) {\n return -1;\n }\n if (this.inputs.focusMode() === 'activedescendant') {\n return -1;\n }\n return this.activeItem() === item ? 0 : -1;\n }\n\n /** Moves focus to the given item if it is focusable. */\n focus(item: T): boolean {\n if (this.isListDisabled() || !this.isFocusable(item)) {\n return false;\n }\n\n this.prevActiveIndex.set(this.inputs.activeIndex());\n const index = this.inputs.items().indexOf(item);\n this.inputs.activeIndex.set(index);\n\n if (this.inputs.focusMode() === 'roving') {\n item.element().focus();\n }\n\n return true;\n }\n\n /** Returns true if the given item can be navigated to. */\n isFocusable(item: T): boolean {\n return !item.disabled() || !this.inputs.skipDisabled();\n }\n}\n"],"names":[],"mappings":";;AA0CA;IACY;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ;AACR,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAU;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAY;AACZ,IAAA,QAAA,CAAA,QAAA,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,GAAA,KAAW;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAa;AACb,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACb,CAAC,EAPW,QAAQ,KAAR,QAAQ,GAOnB,EAAA,CAAA,CAAA;AAID;;;;;AAKG;MAC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;AAI5C,IAAA,KAAK,CAAC,IAAO,EAAA;AACX,QAAA,IAAI,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;AACpD,YAAA,OAAO,KAAK;;AAGd,QAAA,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;AACnD,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC;QAElC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,QAAQ,EAAE;AACxC,YAAA,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE;;AAGxB,QAAA,OAAO,IAAI;;;AAIb,IAAA,WAAW,CAAC,IAAO,EAAA;AACjB,QAAA,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;;AAEzD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-selection-C41ApAbt.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/list-selection/list-selection.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 {computed, signal} from '@angular/core';\nimport {SignalLike, WritableSignalLike} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\n\n/** Represents an item in a collection, such as a listbox option, than can be selected. */\nexport interface ListSelectionItem<V> extends ListFocusItem {\n /** The value of the item. */\n value: SignalLike<V>;\n}\n\n/** Represents the required inputs for a collection that contains selectable items. */\nexport interface ListSelectionInputs<T extends ListSelectionItem<V>, V> extends ListFocusInputs<T> {\n /** Whether multiple items in the list can be selected at once. */\n multi: SignalLike<boolean>;\n\n /** The current value of the list selection. */\n value: WritableSignalLike<V[]>;\n\n /** The selection strategy used by the list. */\n selectionMode: SignalLike<'follow' | 'explicit'>;\n}\n\n/** Controls selection for a list of items. */\nexport class ListSelection<T extends ListSelectionItem<V>, V> {\n /** The start index to use for range selection. */\n rangeStartIndex = signal<number>(0);\n\n /** The end index to use for range selection. */\n rangeEndIndex = signal<number>(0);\n\n /** The currently selected items. */\n selectedItems = computed(() =>\n this.inputs.items().filter(item => this.inputs.value().includes(item.value())),\n );\n\n constructor(readonly inputs: ListSelectionInputs<T, V> & {focusManager: ListFocus<T>}) {}\n\n /** Selects the item at the current active index. */\n select(item?: ListSelectionItem<V>, opts = {anchor: true}) {\n item = item ?? (this.inputs.focusManager.activeItem() as ListSelectionItem<V>);\n\n if (item.disabled() || this.inputs.value().includes(item.value())) {\n return;\n }\n\n if (!this.inputs.multi()) {\n this.deselectAll();\n }\n\n const index = this.inputs.items().findIndex(i => i === item);\n if (opts.anchor) {\n this.beginRangeSelection(index);\n }\n this.inputs.value.update(values => values.concat(item.value()));\n }\n\n /** Deselects the item at the current active index. */\n deselect(item?: T) {\n item = item ?? this.inputs.focusManager.activeItem();\n\n if (!item.disabled()) {\n this.inputs.value.update(values => values.filter(value => value !== item.value()));\n }\n }\n\n /** Toggles the item at the current active index. */\n toggle() {\n const item = this.inputs.focusManager.activeItem();\n this.inputs.value().includes(item.value()) ? this.deselect() : this.select();\n }\n\n /** Toggles only the item at the current active index. */\n toggleOne() {\n const item = this.inputs.focusManager.activeItem();\n this.inputs.value().includes(item.value()) ? this.deselect() : this.selectOne();\n }\n\n /** Selects all items in the list. */\n selectAll() {\n if (!this.inputs.multi()) {\n return; // Should we log a warning?\n }\n\n for (const item of this.inputs.items()) {\n this.select(item, {anchor: false});\n }\n\n this.beginRangeSelection();\n }\n\n /** Deselects all items in the list. */\n deselectAll() {\n for (const item of this.inputs.items()) {\n this.deselect(item);\n }\n }\n\n /**\n * Selects all items in the list or deselects all\n * items in the list if all items are already selected.\n */\n toggleAll() {\n const selectableValues = this.inputs\n .items()\n .filter(i => !i.disabled())\n .map(i => i.value());\n\n selectableValues.every(i => this.inputs.value().includes(i))\n ? this.deselectAll()\n : this.selectAll();\n }\n\n /** Sets the selection to only the current active item. */\n selectOne() {\n if (this.inputs.focusManager.activeItem().disabled()) {\n return;\n }\n\n this.deselectAll();\n\n if (this.inputs.value().length > 0 && !this.inputs.multi()) {\n return;\n }\n\n this.select();\n }\n\n /**\n * Selects all items in the list up to the anchor item.\n *\n * Deselects all items that were previously within the\n * selected range that are now outside of the selected range\n */\n selectRange(opts = {anchor: true}) {\n const isStartOfRange = this.inputs.focusManager.prevActiveIndex() === this.rangeStartIndex();\n\n if (isStartOfRange && opts.anchor) {\n this.beginRangeSelection(this.inputs.focusManager.prevActiveIndex());\n }\n\n const itemsInRange = this._getItemsFromIndex(this.rangeStartIndex());\n const itemsOutOfRange = this._getItemsFromIndex(this.rangeEndIndex()).filter(\n i => !itemsInRange.includes(i),\n );\n\n for (const item of itemsOutOfRange) {\n this.deselect(item);\n }\n\n for (const item of itemsInRange) {\n this.select(item, {anchor: false});\n }\n\n if (itemsInRange.length) {\n const item = itemsInRange.pop();\n const index = this.inputs.items().findIndex(i => i === item);\n this.rangeEndIndex.set(index);\n }\n }\n\n /** Marks the given index as the start of a range selection. */\n beginRangeSelection(index: number = this.inputs.activeIndex()) {\n this.rangeStartIndex.set(index);\n this.rangeEndIndex.set(index);\n }\n\n /** Returns the items in the list starting from the given index. */\n private _getItemsFromIndex(index: number) {\n if (index === -1) {\n return [];\n }\n\n const upper = Math.max(this.inputs.activeIndex(), index);\n const lower = Math.min(this.inputs.activeIndex(), index);\n\n const items = [];\n for (let i = lower; i <= upper; i++) {\n items.push(this.inputs.items()[i]);\n }\n\n if (this.inputs.activeIndex() < index) {\n return items.reverse();\n }\n\n return items;\n }\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AA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;;QAGpC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,KAAK,EAAE;AACrC,YAAA,OAAO,KAAK,CAAC,OAAO,EAAE;;AAGxB,QAAA,OAAO,KAAK;;AAEf;;;;"}
|
|
1
|
+
{"version":3,"file":"list-selection-C41ApAbt.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/list-selection/list-selection.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 {computed, signal} from '@angular/core';\nimport {SignalLike, WritableSignalLike} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\n\n/** Represents an item in a collection, such as a listbox option, than can be selected. */\nexport interface ListSelectionItem<V> extends ListFocusItem {\n /** The value of the item. */\n value: SignalLike<V>;\n}\n\n/** Represents the required inputs for a collection that contains selectable items. */\nexport interface ListSelectionInputs<T extends ListSelectionItem<V>, V> extends ListFocusInputs<T> {\n /** Whether multiple items in the list can be selected at once. */\n multi: SignalLike<boolean>;\n\n /** The current value of the list selection. */\n value: WritableSignalLike<V[]>;\n\n /** The selection strategy used by the list. */\n selectionMode: SignalLike<'follow' | 'explicit'>;\n}\n\n/** Controls selection for a list of items. */\nexport class ListSelection<T extends ListSelectionItem<V>, V> {\n /** The start index to use for range selection. */\n rangeStartIndex = signal<number>(0);\n\n /** The end index to use for range selection. */\n rangeEndIndex = signal<number>(0);\n\n /** The currently selected items. */\n selectedItems = computed(() =>\n this.inputs.items().filter(item => this.inputs.value().includes(item.value())),\n );\n\n constructor(readonly inputs: ListSelectionInputs<T, V> & {focusManager: ListFocus<T>}) {}\n\n /** Selects the item at the current active index. */\n select(item?: ListSelectionItem<V>, opts = {anchor: true}) {\n item = item ?? (this.inputs.focusManager.activeItem() as ListSelectionItem<V>);\n\n if (item.disabled() || this.inputs.value().includes(item.value())) {\n return;\n }\n\n if (!this.inputs.multi()) {\n this.deselectAll();\n }\n\n const index = this.inputs.items().findIndex(i => i === item);\n if (opts.anchor) {\n this.beginRangeSelection(index);\n }\n this.inputs.value.update(values => values.concat(item.value()));\n }\n\n /** Deselects the item at the current active index. */\n deselect(item?: T) {\n item = item ?? this.inputs.focusManager.activeItem();\n\n if (!item.disabled()) {\n this.inputs.value.update(values => values.filter(value => value !== item.value()));\n }\n }\n\n /** Toggles the item at the current active index. */\n toggle() {\n const item = this.inputs.focusManager.activeItem();\n this.inputs.value().includes(item.value()) ? this.deselect() : this.select();\n }\n\n /** Toggles only the item at the current active index. */\n toggleOne() {\n const item = this.inputs.focusManager.activeItem();\n this.inputs.value().includes(item.value()) ? this.deselect() : this.selectOne();\n }\n\n /** Selects all items in the list. */\n selectAll() {\n if (!this.inputs.multi()) {\n return; // Should we log a warning?\n }\n\n for (const item of this.inputs.items()) {\n this.select(item, {anchor: false});\n }\n\n this.beginRangeSelection();\n }\n\n /** Deselects all items in the list. */\n deselectAll() {\n for (const item of this.inputs.items()) {\n this.deselect(item);\n }\n }\n\n /**\n * Selects all items in the list or deselects all\n * items in the list if all items are already selected.\n */\n toggleAll() {\n const selectableValues = this.inputs\n .items()\n .filter(i => !i.disabled())\n .map(i => i.value());\n\n selectableValues.every(i => this.inputs.value().includes(i))\n ? this.deselectAll()\n : this.selectAll();\n }\n\n /** Sets the selection to only the current active item. */\n selectOne() {\n if (this.inputs.focusManager.activeItem().disabled()) {\n return;\n }\n\n this.deselectAll();\n\n if (this.inputs.value().length > 0 && !this.inputs.multi()) {\n return;\n }\n\n this.select();\n }\n\n /**\n * Selects all items in the list up to the anchor item.\n *\n * Deselects all items that were previously within the\n * selected range that are now outside of the selected range\n */\n selectRange(opts = {anchor: true}) {\n const isStartOfRange = this.inputs.focusManager.prevActiveIndex() === this.rangeStartIndex();\n\n if (isStartOfRange && opts.anchor) {\n this.beginRangeSelection(this.inputs.focusManager.prevActiveIndex());\n }\n\n const itemsInRange = this._getItemsFromIndex(this.rangeStartIndex());\n const itemsOutOfRange = this._getItemsFromIndex(this.rangeEndIndex()).filter(\n i => !itemsInRange.includes(i),\n );\n\n for (const item of itemsOutOfRange) {\n this.deselect(item);\n }\n\n for (const item of itemsInRange) {\n this.select(item, {anchor: false});\n }\n\n if (itemsInRange.length) {\n const item = itemsInRange.pop();\n const index = this.inputs.items().findIndex(i => i === item);\n this.rangeEndIndex.set(index);\n }\n }\n\n /** Marks the given index as the start of a range selection. */\n beginRangeSelection(index: number = this.inputs.activeIndex()) {\n this.rangeStartIndex.set(index);\n this.rangeEndIndex.set(index);\n }\n\n /** Returns the items in the list starting from the given index. */\n private _getItemsFromIndex(index: number) {\n if (index === -1) {\n return [];\n }\n\n const upper = Math.max(this.inputs.activeIndex(), index);\n const lower = Math.min(this.inputs.activeIndex(), index);\n\n const items = [];\n for (let i = lower; i <= upper; i++) {\n items.push(this.inputs.items()[i]);\n }\n\n if (this.inputs.activeIndex() < index) {\n return items.reverse();\n }\n\n return items;\n }\n}\n"],"names":[],"mappings":";;AA8BA;MACa,aAAa,CAAA;AAYH,IAAA,MAAA;;AAVrB,IAAA,eAAe,GAAG,MAAM,CAAS,CAAC,CAAC;;AAGnC,IAAA,aAAa,GAAG,MAAM,CAAS,CAAC,CAAC;;AAGjC,IAAA,aAAa,GAAG,QAAQ,CAAC,MACvB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAC/E;AAED,IAAA,WAAA,CAAqB,MAAgE,EAAA;QAAhE,IAAM,CAAA,MAAA,GAAN,MAAM;;;IAG3B,MAAM,CAAC,IAA2B,EAAE,IAA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IAAI,CAAC;AAC5D,YAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC;;;;AAKjC,IAAA,mBAAmB,CAAC,KAAgB,GAAA,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAA;AAC3D,QAAA,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC;AAC/B,QAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC;;;AAIvB,IAAA,kBAAkB,CAAC,KAAa,EAAA;AACtC,QAAA,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;AAChB,YAAA,OAAO,EAAE;;AAGX,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC;AACxD,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC;QAExD,MAAM,KAAK,GAAG,EAAE;AAChB,QAAA,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,EAAE,EAAE;AACnC,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;;QAGpC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,KAAK,EAAE;AACrC,YAAA,OAAO,KAAK,CAAC,OAAO,EAAE;;AAGxB,QAAA,OAAO,KAAK;;AAEf;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-typeahead-DIIbNJrP.mjs","sources":["../../../../../
|
|
1
|
+
{"version":3,"file":"list-typeahead-DIIbNJrP.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/list-typeahead/list-typeahead.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 {computed, signal} from '@angular/core';\nimport {SignalLike} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\n\n/**\n * Represents an item in a collection, such as a listbox option, than can be navigated to by\n * typeahead.\n */\nexport interface ListTypeaheadItem extends ListFocusItem {\n /** The text used by the typeahead search. */\n searchTerm: SignalLike<string>;\n}\n\n/**\n * Represents the required inputs for a collection that contains items that can be navigated to by\n * typeahead.\n */\nexport interface ListTypeaheadInputs<T extends ListTypeaheadItem> extends ListFocusInputs<T> {\n /** The amount of time before the typeahead search is reset. */\n typeaheadDelay: SignalLike<number>;\n}\n\n/** Controls typeahead for a list of items. */\nexport class ListTypeahead<T extends ListTypeaheadItem> {\n /** A reference to the timeout for resetting the typeahead search. */\n timeout?: ReturnType<typeof setTimeout> | undefined;\n\n /** The focus controller of the parent list. */\n focusManager: ListFocus<T>;\n\n /** Whether the user is actively typing a typeahead search query. */\n isTyping = computed(() => this._query().length > 0);\n\n /** Keeps track of the characters that typeahead search is being called with. */\n private _query = signal('');\n\n /** The index where that the typeahead search was initiated from. */\n private _startIndex = signal<number | undefined>(undefined);\n\n constructor(readonly inputs: ListTypeaheadInputs<T> & {focusManager: ListFocus<T>}) {\n this.focusManager = inputs.focusManager;\n }\n\n /** Performs a typeahead search, appending the given character to the search string. */\n search(char: string): boolean {\n if (char.length !== 1) {\n return false;\n }\n\n if (!this.isTyping() && char === ' ') {\n return false;\n }\n\n if (this._startIndex() === undefined) {\n this._startIndex.set(this.focusManager.inputs.activeIndex());\n }\n\n clearTimeout(this.timeout);\n this._query.update(q => q + char.toLowerCase());\n const item = this._getItem();\n\n if (item) {\n this.focusManager.focus(item);\n }\n\n this.timeout = setTimeout(() => {\n this._query.set('');\n this._startIndex.set(undefined);\n }, this.inputs.typeaheadDelay() * 1000);\n\n return true;\n }\n\n /**\n * Returns the first item whose search term matches the\n * current query starting from the the current anchor index.\n */\n private _getItem() {\n let items = this.focusManager.inputs.items();\n const after = items.slice(this._startIndex()! + 1);\n const before = items.slice(0, this._startIndex()!);\n items = after.concat(before);\n items.push(this.inputs.items()[this._startIndex()!]);\n\n const focusableItems = [];\n for (const item of items) {\n if (this.focusManager.isFocusable(item)) {\n focusableItems.push(item);\n }\n }\n\n return focusableItems.find(i => i.searchTerm().toLowerCase().startsWith(this._query()));\n }\n}\n"],"names":[],"mappings":";;AA8BA;MACa,aAAa,CAAA;AAgBH,IAAA,MAAA;;AAdrB,IAAA,OAAO;;AAGP,IAAA,YAAY;;AAGZ,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;;AAG3C,IAAA,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;;AAGnB,IAAA,WAAW,GAAG,MAAM,CAAqB,SAAS,CAAC;AAE3D,IAAA,WAAA,CAAqB,MAA6D,EAAA;QAA7D,IAAM,CAAA,MAAA,GAAN,MAAM;AACzB,QAAA,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY;;;AAIzC,IAAA,MAAM,CAAC,IAAY,EAAA;AACjB,QAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACrB,YAAA,OAAO,KAAK;;QAGd,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,KAAK,GAAG,EAAE;AACpC,YAAA,OAAO,KAAK;;AAGd,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;AACpC,YAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;;AAG9D,QAAA,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC;AAC1B,QAAA,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,G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CAAC,MAAM,EAAE,CAAC,CAAC;;AAE1F;;;;"}
|
package/fesm2022/listbox.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import { inject, contentChildren, computed, input, booleanAttribute, model, sign
|
|
|
3
3
|
import { Directionality } from '@angular/cdk/bidi';
|
|
4
4
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { _IdGenerator } from '@angular/cdk/a11y';
|
|
6
|
-
import { L as ListboxPattern, O as OptionPattern } from './option-
|
|
7
|
-
import './list-focus-BXQdAA3i.mjs';
|
|
6
|
+
import { L as ListboxPattern, O as OptionPattern } from './option-CgeKz9_Q.mjs';
|
|
8
7
|
import './list-selection-C41ApAbt.mjs';
|
|
9
8
|
import './list-typeahead-DIIbNJrP.mjs';
|
|
9
|
+
import './list-focus-Czul8jzR.mjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A listbox container.
|
|
@@ -80,10 +80,10 @@ class CdkListbox {
|
|
|
80
80
|
onFocus() {
|
|
81
81
|
this._hasFocused.set(true);
|
|
82
82
|
}
|
|
83
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
84
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.2.0-next.
|
|
83
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.1", ngImport: i0, type: CdkListbox, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
84
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.2.0-next.1", type: CdkListbox, isStandalone: true, selector: "[cdkListbox]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, multi: { classPropertyName: "multi", publicName: "multi", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null }, skipDisabled: { classPropertyName: "skipDisabled", publicName: "skipDisabled", isSignal: true, isRequired: false, transformFunction: null }, focusMode: { classPropertyName: "focusMode", publicName: "focusMode", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, typeaheadDelay: { classPropertyName: "typeaheadDelay", publicName: "typeaheadDelay", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "listbox" }, listeners: { "keydown": "pattern.onKeydown($event)", "pointerdown": "pattern.onPointerdown($event)", "focusin": "onFocus()" }, properties: { "attr.tabindex": "pattern.tabindex()", "attr.aria-readonly": "pattern.readonly()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-orientation": "pattern.orientation()", "attr.aria-multiselectable": "pattern.multi()", "attr.aria-activedescendant": "pattern.activedescendant()" }, classAttribute: "cdk-listbox" }, queries: [{ propertyName: "_cdkOptions", predicate: CdkOption, descendants: true, isSignal: true }], exportAs: ["cdkListbox"], ngImport: i0 });
|
|
85
85
|
}
|
|
86
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
86
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.1", ngImport: i0, type: CdkListbox, decorators: [{
|
|
87
87
|
type: Directive,
|
|
88
88
|
args: [{
|
|
89
89
|
selector: '[cdkListbox]',
|
|
@@ -114,8 +114,6 @@ class CdkOption {
|
|
|
114
114
|
// TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.
|
|
115
115
|
/** A unique identifier for the option. */
|
|
116
116
|
id = computed(() => this._generatedId, ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
117
|
-
/** The value of the option. */
|
|
118
|
-
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
119
117
|
// TODO(wagnermaciel): See if we want to change how we handle this since textContent is not
|
|
120
118
|
// reactive. See https://github.com/angular/components/pull/30495#discussion_r1961260216.
|
|
121
119
|
/** The text used by the typeahead search. */
|
|
@@ -124,6 +122,8 @@ class CdkOption {
|
|
|
124
122
|
listbox = computed(() => this._cdkListbox.pattern, ...(ngDevMode ? [{ debugName: "listbox" }] : []));
|
|
125
123
|
/** A reference to the option element to be focused on navigation. */
|
|
126
124
|
element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
|
|
125
|
+
/** The value of the option. */
|
|
126
|
+
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
127
127
|
/** Whether an item is disabled. */
|
|
128
128
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
129
129
|
/** The text used by the typeahead search. */
|
|
@@ -137,10 +137,10 @@ class CdkOption {
|
|
|
137
137
|
element: this.element,
|
|
138
138
|
searchTerm: this.searchTerm,
|
|
139
139
|
});
|
|
140
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
141
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.
|
|
140
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.1", ngImport: i0, type: CdkOption, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
141
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.1", type: CdkOption, isStandalone: true, selector: "[cdkOption]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "option" }, properties: { "class.cdk-active": "pattern.active()", "attr.id": "pattern.id()", "attr.tabindex": "pattern.tabindex()", "attr.aria-selected": "pattern.selected()", "attr.aria-disabled": "pattern.disabled()" }, classAttribute: "cdk-option" }, exportAs: ["cdkOption"], ngImport: i0 });
|
|
142
142
|
}
|
|
143
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.1", ngImport: i0, type: CdkOption, decorators: [{
|
|
144
144
|
type: Directive,
|
|
145
145
|
args: [{
|
|
146
146
|
selector: '[cdkOption]',
|
package/fesm2022/listbox.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listbox.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/listbox/listbox.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 afterRenderEffect,\n booleanAttribute,\n computed,\n contentChildren,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n signal,\n} from '@angular/core';\nimport {ListboxPattern, OptionPattern} from '../ui-patterns';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {_IdGenerator} from '@angular/cdk/a11y';\n\n/**\n * A listbox container.\n *\n * Listboxes are used to display a list of items for a user to select from. The CdkListbox is meant\n * to be used in conjunction with CdkOption as follows:\n *\n * ```html\n * <ul cdkListbox>\n * <li [value]=\"1\" cdkOption>Item 1</li>\n * <li [value]=\"2\" cdkOption>Item 2</li>\n * <li [value]=\"3\" cdkOption>Item 3</li>\n * </ul>\n * ```\n */\n@Directive({\n selector: '[cdkListbox]',\n exportAs: 'cdkListbox',\n host: {\n 'role': 'listbox',\n 'class': 'cdk-listbox',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-readonly]': 'pattern.readonly()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-orientation]': 'pattern.orientation()',\n '[attr.aria-multiselectable]': 'pattern.multi()',\n '[attr.aria-activedescendant]': 'pattern.activedescendant()',\n '(keydown)': 'pattern.onKeydown($event)',\n '(pointerdown)': 'pattern.onPointerdown($event)',\n '(focusin)': 'onFocus()',\n },\n})\nexport class CdkListbox<V> {\n /** The directionality (LTR / RTL) context for the application (or a subtree of it). */\n private readonly _directionality = inject(Directionality);\n\n /** The CdkOptions nested inside of the CdkListbox. */\n private readonly _cdkOptions = contentChildren(CdkOption, {descendants: true});\n\n /** A signal wrapper for directionality. */\n protected textDirection = toSignal(this._directionality.change, {\n initialValue: this._directionality.value,\n });\n\n /** The Option UIPatterns of the child CdkOptions. */\n protected items = computed(() => this._cdkOptions().map(option => option.pattern));\n\n /** Whether the list is vertically or horizontally oriented. */\n orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /** Whether multiple items in the list can be selected at once. */\n multi = input(false, {transform: booleanAttribute});\n\n /** Whether focus should wrap when navigating. */\n wrap = input(true, {transform: booleanAttribute});\n\n /** Whether disabled items in the list should be skipped when navigating. */\n skipDisabled = input(true, {transform: booleanAttribute});\n\n /** The focus strategy used by the list. */\n focusMode = input<'roving' | 'activedescendant'>('roving');\n\n /** The selection strategy used by the list. */\n selectionMode = input<'follow' | 'explicit'>('follow');\n\n /** The amount of time before the typeahead search is reset. */\n typeaheadDelay = input<number>(0.5); // Picked arbitrarily.\n\n /** Whether the listbox is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** Whether the listbox is readonly. */\n readonly = input(false, {transform: booleanAttribute});\n\n /** The values of the current selected items. */\n value = model<V[]>([]);\n\n /** The Listbox UIPattern. */\n pattern: ListboxPattern<V> = new ListboxPattern<V>({\n ...this,\n items: this.items,\n activeIndex: signal(0), // TODO: Use linkedSignal to ensure this doesn't get fked up.\n textDirection: this.textDirection,\n });\n\n /** Whether the listbox has received focus yet. */\n private _hasFocused = signal(false);\n\n constructor() {\n afterRenderEffect(() => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const violations = this.pattern.validate();\n for (const violation of violations) {\n console.error(violation);\n }\n }\n });\n\n afterRenderEffect(() => {\n if (!this._hasFocused()) {\n this.pattern.setDefaultState();\n }\n });\n }\n\n onFocus() {\n this._hasFocused.set(true);\n }\n}\n\n/** A selectable option in a CdkListbox. */\n@Directive({\n selector: '[cdkOption]',\n exportAs: 'cdkOption',\n host: {\n 'role': 'option',\n 'class': 'cdk-option',\n '[class.cdk-active]': 'pattern.active()',\n '[attr.id]': 'pattern.id()',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-selected]': 'pattern.selected()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n },\n})\nexport class CdkOption<V> {\n /** A reference to the option element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent CdkListbox. */\n private readonly _cdkListbox = inject(CdkListbox);\n\n /** A unique identifier for the option. */\n private readonly _generatedId = inject(_IdGenerator).getId('cdk-option-');\n\n // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.\n /** A unique identifier for the option. */\n protected id = computed(() => this._generatedId);\n\n /** The value of the option. */\n protected value = input.required<V>();\n\n // TODO(wagnermaciel): See if we want to change how we handle this since textContent is not\n // reactive. See https://github.com/angular/components/pull/30495#discussion_r1961260216.\n /** The text used by the typeahead search. */\n protected searchTerm = computed(() => this.label() ?? this.element().textContent);\n\n /** The parent Listbox UIPattern. */\n protected listbox = computed(() => this._cdkListbox.pattern);\n\n /** A reference to the option element to be focused on navigation. */\n protected element = computed(() => this._elementRef.nativeElement);\n\n /** Whether an item is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** The text used by the typeahead search. */\n label = input<string>();\n\n /** The Option UIPattern. */\n pattern = new OptionP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BAAoB;AAC5C,wBAAA,sBAAsB,EAAE,oBAAoB;AAC7C,qBAAA;AACF,iBAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"listbox.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/listbox/listbox.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 afterRenderEffect,\n booleanAttribute,\n computed,\n contentChildren,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n signal,\n} from '@angular/core';\nimport {ListboxPattern, OptionPattern} from '../ui-patterns';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {_IdGenerator} from '@angular/cdk/a11y';\n\n/**\n * A listbox container.\n *\n * Listboxes are used to display a list of items for a user to select from. The CdkListbox is meant\n * to be used in conjunction with CdkOption as follows:\n *\n * ```html\n * <ul cdkListbox>\n * <li [value]=\"1\" cdkOption>Item 1</li>\n * <li [value]=\"2\" cdkOption>Item 2</li>\n * <li [value]=\"3\" cdkOption>Item 3</li>\n * </ul>\n * ```\n */\n@Directive({\n selector: '[cdkListbox]',\n exportAs: 'cdkListbox',\n host: {\n 'role': 'listbox',\n 'class': 'cdk-listbox',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-readonly]': 'pattern.readonly()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-orientation]': 'pattern.orientation()',\n '[attr.aria-multiselectable]': 'pattern.multi()',\n '[attr.aria-activedescendant]': 'pattern.activedescendant()',\n '(keydown)': 'pattern.onKeydown($event)',\n '(pointerdown)': 'pattern.onPointerdown($event)',\n '(focusin)': 'onFocus()',\n },\n})\nexport class CdkListbox<V> {\n /** The directionality (LTR / RTL) context for the application (or a subtree of it). */\n private readonly _directionality = inject(Directionality);\n\n /** The CdkOptions nested inside of the CdkListbox. */\n private readonly _cdkOptions = contentChildren(CdkOption, {descendants: true});\n\n /** A signal wrapper for directionality. */\n protected textDirection = toSignal(this._directionality.change, {\n initialValue: this._directionality.value,\n });\n\n /** The Option UIPatterns of the child CdkOptions. */\n protected items = computed(() => this._cdkOptions().map(option => option.pattern));\n\n /** Whether the list is vertically or horizontally oriented. */\n orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /** Whether multiple items in the list can be selected at once. */\n multi = input(false, {transform: booleanAttribute});\n\n /** Whether focus should wrap when navigating. */\n wrap = input(true, {transform: booleanAttribute});\n\n /** Whether disabled items in the list should be skipped when navigating. */\n skipDisabled = input(true, {transform: booleanAttribute});\n\n /** The focus strategy used by the list. */\n focusMode = input<'roving' | 'activedescendant'>('roving');\n\n /** The selection strategy used by the list. */\n selectionMode = input<'follow' | 'explicit'>('follow');\n\n /** The amount of time before the typeahead search is reset. */\n typeaheadDelay = input<number>(0.5); // Picked arbitrarily.\n\n /** Whether the listbox is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** Whether the listbox is readonly. */\n readonly = input(false, {transform: booleanAttribute});\n\n /** The values of the current selected items. */\n value = model<V[]>([]);\n\n /** The Listbox UIPattern. */\n pattern: ListboxPattern<V> = new ListboxPattern<V>({\n ...this,\n items: this.items,\n activeIndex: signal(0), // TODO: Use linkedSignal to ensure this doesn't get fked up.\n textDirection: this.textDirection,\n });\n\n /** Whether the listbox has received focus yet. */\n private _hasFocused = signal(false);\n\n constructor() {\n afterRenderEffect(() => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const violations = this.pattern.validate();\n for (const violation of violations) {\n console.error(violation);\n }\n }\n });\n\n afterRenderEffect(() => {\n if (!this._hasFocused()) {\n this.pattern.setDefaultState();\n }\n });\n }\n\n onFocus() {\n this._hasFocused.set(true);\n }\n}\n\n/** A selectable option in a CdkListbox. */\n@Directive({\n selector: '[cdkOption]',\n exportAs: 'cdkOption',\n host: {\n 'role': 'option',\n 'class': 'cdk-option',\n '[class.cdk-active]': 'pattern.active()',\n '[attr.id]': 'pattern.id()',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-selected]': 'pattern.selected()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n },\n})\nexport class CdkOption<V> {\n /** A reference to the option element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent CdkListbox. */\n private readonly _cdkListbox = inject(CdkListbox);\n\n /** A unique identifier for the option. */\n private readonly _generatedId = inject(_IdGenerator).getId('cdk-option-');\n\n // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.\n /** A unique identifier for the option. */\n protected id = computed(() => this._generatedId);\n\n // TODO(wagnermaciel): See if we want to change how we handle this since textContent is not\n // reactive. See https://github.com/angular/components/pull/30495#discussion_r1961260216.\n /** The text used by the typeahead search. */\n protected searchTerm = computed(() => this.label() ?? this.element().textContent);\n\n /** The parent Listbox UIPattern. */\n protected listbox = computed(() => this._cdkListbox.pattern);\n\n /** A reference to the option element to be focused on navigation. */\n protected element = computed(() => this._elementRef.nativeElement);\n\n /** The value of the option. */\n value = input.required<V>();\n\n /** Whether an item is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** The text used by the typeahead search. */\n label = input<string>();\n\n /** The Option UIPattern. */\n pattern = new OptionPattern<V>({\n ...this,\n id: this.id,\n value: this.value,\n listbox: this.listbox,\n element: this.element,\n searchTerm: this.searchTerm,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;AAyBA;;;;;;;;;;;;;AAaG;MAkBU,UAAU,CAAA;;AAEJ,IAAA,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC;;AAGxC,IAAA,WAAW,GAAG,eAAe,CAAC,SAAS,+CAAG,WAAW,EAAE,IAAI,EAAA,CAAA,GAAA,CAAlB,EAAC,WAAW,EAAE,IAAI,EAAC,GAAC;;IAGpE,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;AAC9D,QAAA,YAAY,EAAE,IAAI,CAAC,e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