ng-primitives 0.99.3 → 0.99.5
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/fesm2022/ng-primitives-dialog.mjs +2 -1
- package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/ng-primitives-file-upload.mjs +3 -2
- package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
- package/fesm2022/ng-primitives-interactions.mjs +2 -2
- package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
- package/fesm2022/ng-primitives-internal.mjs +2 -2
- package/fesm2022/ng-primitives-internal.mjs.map +1 -1
- package/fesm2022/ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-portal.mjs +2 -1
- package/fesm2022/ng-primitives-portal.mjs.map +1 -1
- package/fesm2022/ng-primitives-progress.mjs +1 -1
- package/fesm2022/ng-primitives-toggle-group.mjs +1 -1
- package/fesm2022/ng-primitives-toolbar.mjs +1 -1
- package/file-upload/index.d.ts +165 -1
- package/menu/index.d.ts +1 -1
- package/package.json +1 -1
- package/progress/index.d.ts +107 -2
- package/toggle-group/index.d.ts +51 -2
- package/toolbar/index.d.ts +28 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, input, Directive, booleanAttribute, HostListener, ApplicationRef,
|
|
2
|
+
import { InjectionToken, inject, input, Directive, booleanAttribute, HostListener, ApplicationRef, ViewContainerRef, isDevMode, TemplateRef, Injector, Injectable, output, signal } from '@angular/core';
|
|
3
3
|
import { uniqueId, onChange } from 'ng-primitives/utils';
|
|
4
4
|
import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
|
|
5
5
|
import * as i1 from 'ng-primitives/internal';
|
|
@@ -9,6 +9,7 @@ import { Subject, defer } from 'rxjs';
|
|
|
9
9
|
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
10
10
|
import { Overlay, OverlayContainer, OverlayConfig } from '@angular/cdk/overlay';
|
|
11
11
|
import { TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
|
|
12
|
+
import { DOCUMENT } from '@angular/common';
|
|
12
13
|
import { startWith } from 'rxjs/operators';
|
|
13
14
|
import * as i1$1 from 'ng-primitives/focus-trap';
|
|
14
15
|
import { NgpFocusTrap } from 'ng-primitives/focus-trap';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-dialog.mjs","sources":["../../../../packages/ng-primitives/dialog/src/config/dialog-config.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog-state.ts","../../../../packages/ng-primitives/dialog/src/dialog-description/dialog-description.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog-ref.ts","../../../../packages/ng-primitives/dialog/src/dialog-overlay/dialog-overlay.ts","../../../../packages/ng-primitives/dialog/src/dialog-title/dialog-title.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog.service.ts","../../../../packages/ng-primitives/dialog/src/dialog-trigger/dialog-trigger.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog.ts","../../../../packages/ng-primitives/dialog/src/ng-primitives-dialog.ts"],"sourcesContent":["import { ScrollStrategy } from '@angular/cdk/overlay';\nimport { InjectionToken, Injector, Provider, ViewContainerRef, inject } from '@angular/core';\n\n/** Valid ARIA roles for a dialog. */\nexport type NgpDialogRole = 'dialog' | 'alertdialog';\n\nexport interface NgpDialogConfig<T = any> {\n /** The view container to attach the dialog to. */\n viewContainerRef?: ViewContainerRef;\n\n /** The injector to use for the dialog. Defaults to the view container's injector.*/\n injector?: Injector;\n\n /** ID for the dialog. If omitted, a unique one will be generated. */\n id?: string;\n\n /** The role of the dialog. */\n role?: NgpDialogRole;\n\n /** Whether this is a modal dialog. Used to set the `aria-modal` attribute. */\n modal?: boolean;\n\n /** Scroll strategy to be used for the dialog. This determines how the dialog responds to scrolling underneath the panel element. */\n scrollStrategy?: ScrollStrategy;\n\n /**\n * Whether the dialog should close when the user navigates backwards or forwards through browser\n * history.\n */\n closeOnNavigation?: boolean;\n\n /** Whether the dialog should close when the user presses the escape key. */\n closeOnEscape?: boolean;\n\n /** Whether the dialog should close when the user click the overlay. */\n closeOnClick?: boolean;\n\n data?: T;\n}\n\nexport const defaultDialogConfig: NgpDialogConfig = {\n role: 'dialog',\n modal: true,\n closeOnNavigation: true,\n closeOnEscape: true,\n closeOnClick: true,\n};\n\nexport const NgpDialogConfigToken = new InjectionToken<NgpDialogConfig>('NgpDialogConfigToken');\n\n/**\n * Provide the default Dialog configuration\n * @param config The Dialog configuration\n * @returns The provider\n */\nexport function provideDialogConfig(config: Partial<NgpDialogConfig>): Provider[] {\n return [\n {\n provide: NgpDialogConfigToken,\n useValue: { ...defaultDialogConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Dialog configuration\n * @returns The global Dialog configuration\n */\nexport function injectDialogConfig(): NgpDialogConfig {\n return inject(NgpDialogConfigToken, { optional: true }) ?? defaultDialogConfig;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpDialog } from './dialog';\n\n/**\n * The state token for the Dialog primitive.\n */\nexport const NgpDialogStateToken = createStateToken<NgpDialog<any, any>>('Dialog');\n\n/**\n * Provides the Dialog state.\n */\nexport const provideDialogState = createStateProvider(NgpDialogStateToken);\n\n/**\n * Injects the Dialog state.\n */\nexport const injectDialogState = createStateInjector<NgpDialog>(NgpDialogStateToken);\n\n/**\n * The Dialog state registration function.\n */\nexport const dialogState = createState(NgpDialogStateToken);\n","import { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialogState } from '../dialog/dialog-state';\n\n@Directive({\n selector: '[ngpDialogDescription]',\n exportAs: 'ngpDialogDescription',\n host: {\n '[id]': 'id()',\n },\n})\nexport class NgpDialogDescription implements OnDestroy {\n /** Access the dialog */\n private readonly dialog = injectDialogState();\n\n /** The id of the descriptions. */\n readonly id = input<string>(uniqueId('ngp-dialog-description'));\n\n constructor() {\n onChange(this.id, (id, prevId) => {\n if (prevId) {\n this.dialog().removeDescribedBy(prevId);\n }\n\n if (id) {\n this.dialog().setDescribedBy(id);\n }\n });\n }\n\n ngOnDestroy(): void {\n this.dialog().removeDescribedBy(this.id());\n }\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { hasModifierKey } from '@angular/cdk/keycodes';\nimport { OverlayRef } from '@angular/cdk/overlay';\nimport { inject, Injector } from '@angular/core';\nimport { NgpExitAnimationManager } from 'ng-primitives/internal';\nimport { Observable, Subject, Subscription } from 'rxjs';\nimport { NgpDialogConfig } from '../config/dialog-config';\n\n/**\n * Reference to a dialog opened via the Dialog service.\n */\nexport class NgpDialogRef<T = unknown, R = unknown> {\n /** Whether the user is allowed to close the dialog. */\n disableClose: boolean | undefined;\n\n /** Whether the escape key is allowed to close the dialog. */\n closeOnEscape: boolean | undefined;\n\n /** Emits when the dialog has been closed. */\n readonly closed = new Subject<{ focusOrigin?: FocusOrigin; result?: R }>();\n\n /** Emits when on keyboard events within the dialog. */\n readonly keydownEvents: Observable<KeyboardEvent>;\n\n /** Emits on pointer events that happen outside of the dialog. */\n readonly outsidePointerEvents: Observable<MouseEvent>;\n\n /** Data passed from the dialog opener. */\n readonly data?: T;\n\n /** Unique ID for the dialog. */\n readonly id: string;\n\n /** Subscription to external detachments of the dialog. */\n private detachSubscription: Subscription;\n\n /** @internal Store the injector */\n injector: Injector | undefined;\n\n /** Whether the dialog is closing. */\n private closing = false;\n\n constructor(\n readonly overlayRef: OverlayRef,\n readonly config: NgpDialogConfig<T>,\n ) {\n this.data = config.data;\n this.keydownEvents = overlayRef.keydownEvents();\n this.outsidePointerEvents = overlayRef.outsidePointerEvents();\n this.id = config.id!; // By the time the dialog is created we are guaranteed to have an ID.\n this.closeOnEscape = config.closeOnEscape ?? true;\n\n this.keydownEvents.subscribe(event => {\n if (\n event.key === 'Escape' &&\n !this.disableClose &&\n this.closeOnEscape !== false &&\n !hasModifierKey(event)\n ) {\n event.preventDefault();\n this.close(undefined, 'keyboard');\n }\n });\n\n this.detachSubscription = overlayRef.detachments().subscribe(() => this.close());\n }\n\n /**\n * Close the dialog.\n * @param result Optional result to return to the dialog opener.\n * @param options Additional options to customize the closing behavior.\n */\n async close(result?: R, focusOrigin?: FocusOrigin): Promise<void> {\n // If the dialog is already closed, do nothing.\n if (this.closing) {\n return;\n }\n\n this.closing = true;\n\n const exitAnimationManager = this.injector?.get(NgpExitAnimationManager, undefined, {\n optional: true,\n });\n if (exitAnimationManager) {\n await exitAnimationManager.exit();\n }\n\n this.overlayRef.dispose();\n this.detachSubscription.unsubscribe();\n this.closed.next({ focusOrigin, result });\n this.closed.complete();\n }\n\n /** Updates the position of the dialog based on the current position strategy. */\n updatePosition(): this {\n this.overlayRef.updatePosition();\n return this;\n }\n}\n\nexport function injectDialogRef<T = unknown, R = unknown>(): NgpDialogRef<T, R> {\n return inject<NgpDialogRef<T, R>>(NgpDialogRef);\n}\n","import { booleanAttribute, Directive, HostListener, input } from '@angular/core';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { injectDialogRef } from '../dialog/dialog-ref';\n\n@Directive({\n selector: '[ngpDialogOverlay]',\n exportAs: 'ngpDialogOverlay',\n hostDirectives: [NgpExitAnimation],\n})\nexport class NgpDialogOverlay {\n /** Access the global configuration */\n private readonly config = injectDialogConfig();\n\n /** Access the dialog ref. */\n private readonly dialogRef = injectDialogRef();\n\n /**\n * Whether the dialog should close on backdrop click.\n * @default `true`\n */\n readonly closeOnClick = input(this.config.closeOnClick, {\n alias: 'ngpDialogOverlayCloseOnClick',\n transform: booleanAttribute,\n });\n\n @HostListener('click')\n protected close(): void {\n if (this.closeOnClick() && !this.dialogRef.disableClose) {\n this.dialogRef.close(undefined, 'mouse');\n }\n }\n}\n","import { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialogState } from '../dialog/dialog-state';\n\n@Directive({\n selector: '[ngpDialogTitle]',\n exportAs: 'ngpDialogTitle',\n host: {\n '[id]': 'id()',\n },\n})\nexport class NgpDialogTitle implements OnDestroy {\n /** Access the dialog. */\n private readonly dialog = injectDialogState();\n\n /** The id of the title. */\n readonly id = input<string>(uniqueId('ngp-dialog-title'));\n\n constructor() {\n onChange(this.id, (id, prevId) => {\n if (prevId) {\n this.dialog().removeLabelledBy(prevId);\n }\n\n if (id) {\n this.dialog().setLabelledBy(id);\n }\n });\n }\n\n ngOnDestroy(): void {\n this.dialog().removeLabelledBy(this.id());\n }\n}\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport { Overlay, OverlayConfig, OverlayContainer, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';\nimport {\n ApplicationRef,\n DOCUMENT,\n Injectable,\n Injector,\n OnDestroy,\n StaticProvider,\n TemplateRef,\n Type,\n ViewContainerRef,\n inject,\n isDevMode,\n} from '@angular/core';\nimport { NgpExitAnimationManager } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { Observable, Subject, defer } from 'rxjs';\nimport { startWith } from 'rxjs/operators';\nimport { NgpDialogConfig, injectDialogConfig } from '../config/dialog-config';\nimport { NgpDialogRef } from './dialog-ref';\n\n/**\n * This is based on the Angular CDK Dialog service.\n * https://github.com/angular/components/blob/main/src/cdk/dialog/dialog.ts\n */\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NgpDialogManager implements OnDestroy {\n private readonly applicationRef = inject(ApplicationRef);\n private readonly document = inject<Document>(DOCUMENT);\n private readonly overlay = inject(Overlay);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly defaultOptions = injectDialogConfig();\n private readonly parentDialogManager = inject(NgpDialogManager, {\n optional: true,\n skipSelf: true,\n });\n private readonly overlayContainer = inject(OverlayContainer);\n private readonly scrollStrategy: ScrollStrategy =\n this.defaultOptions.scrollStrategy ?? this.overlay.scrollStrategies.block();\n\n private openDialogsAtThisLevel: NgpDialogRef[] = [];\n private readonly afterAllClosedAtThisLevel = new Subject<void>();\n private readonly afterOpenedAtThisLevel = new Subject<NgpDialogRef>();\n private ariaHiddenElements = new Map<Element, string | null>();\n\n /** Keeps track of the currently-open dialogs. */\n get openDialogs(): readonly NgpDialogRef[] {\n return this.parentDialogManager\n ? this.parentDialogManager.openDialogs\n : this.openDialogsAtThisLevel;\n }\n\n /** Stream that emits when a dialog has been opened. */\n get afterOpened(): Subject<NgpDialogRef> {\n return this.parentDialogManager\n ? this.parentDialogManager.afterOpened\n : this.afterOpenedAtThisLevel;\n }\n\n /**\n * Stream that emits when all open dialog have finished closing.\n * Will emit on subscribe if there are no open dialogs to begin with.\n */\n readonly afterAllClosed: Observable<void> = defer(() =>\n this.openDialogs.length\n ? this.getAfterAllClosed()\n : this.getAfterAllClosed().pipe(startWith(undefined)),\n );\n\n /**\n * Opens a modal dialog containing the given template.\n */\n open<T, R>(\n templateRefOrComponentType: TemplateRef<NgpDialogContext<T, R>> | Type<unknown>,\n config?: NgpDialogConfig<T>,\n ): NgpDialogRef<T, R> {\n // store the current active element so we can focus it after the dialog is closed\n const activeElement = this.document.activeElement;\n\n // this is not ideal, but there is a case where a dialog trigger is within an overlay (e.g. menu),\n // which may be removed before the dialog is closed. This is not desired, so we need to access a view container ref\n // that is not within the overlay. To solve this we use the view container ref of the root component.\n // Could this have any unintended side effects? For example, the dialog would not be closed during route changes?\n const viewContainerRef =\n this.applicationRef.components[0]?.injector.get(ViewContainerRef) ??\n config?.viewContainerRef ??\n config?.injector?.get(ViewContainerRef);\n\n const defaults = this.defaultOptions;\n config = { ...defaults, viewContainerRef, ...config };\n config.id = config.id ?? uniqueId('ngp-dialog');\n\n if (config.id && this.getDialogById(config.id) && isDevMode()) {\n throw Error(`Dialog with id \"${config.id}\" exists already. The dialog id must be unique.`);\n }\n\n const overlayConfig = this.getOverlayConfig(config);\n const overlayRef = this.overlay.create(overlayConfig);\n const dialogRef = new NgpDialogRef<T, R>(overlayRef, config);\n const injector = this.createInjector(config, dialogRef, undefined);\n\n // store the injector in the dialog ref - this is so we can access the exit animation manager\n dialogRef.injector = injector;\n\n const context: NgpDialogContext<T, R> = {\n $implicit: dialogRef,\n close: dialogRef.close.bind(dialogRef),\n };\n\n if (templateRefOrComponentType instanceof TemplateRef) {\n overlayRef.attach(\n new TemplatePortal(templateRefOrComponentType, config.viewContainerRef!, context, injector),\n );\n } else {\n overlayRef.attach(\n new ComponentPortal(templateRefOrComponentType, config.viewContainerRef!, injector),\n );\n }\n\n // If this is the first dialog that we're opening, hide all the non-overlay content.\n if (!this.openDialogs.length) {\n this.hideNonDialogContentFromAssistiveTechnology();\n }\n\n (this.openDialogs as NgpDialogRef[]).push(dialogRef as NgpDialogRef<any, any>);\n this.afterOpened.next(dialogRef as NgpDialogRef<any, any>);\n\n dialogRef.closed.subscribe(closeResult => {\n this.removeOpenDialog(dialogRef as NgpDialogRef<any, any>, true);\n // Focus the trigger element after the dialog closes.\n if (activeElement instanceof HTMLElement && this.document.body.contains(activeElement)) {\n // Its not great that we are relying on an internal API here, but we need to in order to\n // try and best determine the focus origin when it is programmatically closed by the user.\n this.focusMonitor.focusVia(\n activeElement,\n closeResult.focusOrigin ?? (this.focusMonitor as any)._lastFocusOrigin,\n );\n }\n });\n\n return dialogRef;\n }\n\n /**\n * Closes all of the currently-open dialogs.\n */\n closeAll(): void {\n reverseForEach(this.openDialogs, dialog => dialog.close());\n }\n\n /**\n * Finds an open dialog by its id.\n * @param id ID to use when looking up the dialog.\n */\n getDialogById(id: string): NgpDialogRef | undefined {\n return this.openDialogs.find(dialog => dialog.id === id);\n }\n\n ngOnDestroy(): void {\n // Make one pass over all the dialogs that need to be untracked, but should not be closed. We\n // want to stop tracking the open dialog even if it hasn't been closed, because the tracking\n // determines when `aria-hidden` is removed from elements outside the dialog.\n reverseForEach(this.openDialogsAtThisLevel, dialog => {\n // Check for `false` specifically since we want `undefined` to be interpreted as `true`.\n this.removeOpenDialog(dialog, false);\n });\n\n // Make a second pass and close the remaining dialogs. We do this second pass in order to\n // correctly dispatch the `afterAllClosed` event in case we have a mixed array of dialogs\n // that should be closed and dialogs that should not.\n reverseForEach(this.openDialogsAtThisLevel, dialog => dialog.close());\n\n this.afterAllClosedAtThisLevel.complete();\n this.afterOpenedAtThisLevel.complete();\n this.openDialogsAtThisLevel = [];\n }\n\n /**\n * Creates an overlay config from a dialog config.\n */\n private getOverlayConfig(config: NgpDialogConfig): OverlayConfig {\n const state = new OverlayConfig({\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: config.scrollStrategy || this.scrollStrategy,\n hasBackdrop: false,\n disposeOnNavigation: config.closeOnNavigation,\n // required for v21 - the CDK launches overlays using the popover api which means any other overlays\n // such as select dropdowns, or tooltips will appear behind the dialog, regardless of z-index\n // this disables the use of popovers\n usePopover: false,\n } as any);\n\n return state;\n }\n\n /**\n * Creates a custom injector to be used inside the dialog. This allows a component loaded inside\n * of a dialog to close itself and, optionally, to return a value.\n */\n private createInjector<T, R>(\n config: NgpDialogConfig<T>,\n dialogRef: NgpDialogRef<T, R>,\n fallbackInjector: Injector | undefined,\n ): Injector {\n const userInjector = config.injector || config.viewContainerRef?.injector;\n const providers: StaticProvider[] = [\n { provide: NgpDialogRef, useValue: dialogRef },\n { provide: NgpExitAnimationManager, useClass: NgpExitAnimationManager },\n ];\n\n return Injector.create({ parent: userInjector || fallbackInjector, providers });\n }\n\n /**\n * Removes a dialog from the array of open dialogs.\n */\n private removeOpenDialog(dialogRef: NgpDialogRef, emitEvent: boolean) {\n const index = this.openDialogs.indexOf(dialogRef);\n\n if (index > -1) {\n (this.openDialogs as NgpDialogRef[]).splice(index, 1);\n\n // If all the dialogs were closed, remove/restore the `aria-hidden`\n // to a the siblings and emit to the `afterAllClosed` stream.\n if (!this.openDialogs.length) {\n this.ariaHiddenElements.forEach((previousValue, element) => {\n if (previousValue) {\n element.setAttribute('aria-hidden', previousValue);\n } else {\n element.removeAttribute('aria-hidden');\n }\n });\n\n this.ariaHiddenElements.clear();\n\n if (emitEvent) {\n this.getAfterAllClosed().next();\n }\n }\n }\n }\n\n /** Hides all of the content that isn't an overlay from assistive technology. */\n private hideNonDialogContentFromAssistiveTechnology() {\n const overlayContainer = this.overlayContainer.getContainerElement();\n\n // Ensure that the overlay container is attached to the DOM.\n if (overlayContainer.parentElement) {\n const siblings = overlayContainer.parentElement.children;\n\n for (let i = siblings.length - 1; i > -1; i--) {\n const sibling = siblings[i];\n\n if (\n sibling !== overlayContainer &&\n sibling.nodeName !== 'SCRIPT' &&\n sibling.nodeName !== 'STYLE' &&\n !sibling.hasAttribute('aria-live')\n ) {\n this.ariaHiddenElements.set(sibling, sibling.getAttribute('aria-hidden'));\n sibling.setAttribute('aria-hidden', 'true');\n }\n }\n }\n }\n\n private getAfterAllClosed(): Subject<void> {\n const parent = this.parentDialogManager;\n return parent ? parent.getAfterAllClosed() : this.afterAllClosedAtThisLevel;\n }\n}\n\n/**\n * Executes a callback against all elements in an array while iterating in reverse.\n * Useful if the array is being modified as it is being iterated.\n */\nfunction reverseForEach<T>(items: T[] | readonly T[], callback: (current: T) => void) {\n let i = items.length;\n\n while (i--) {\n callback(items[i]);\n }\n}\n\nexport interface NgpDialogContext<T = unknown, R = unknown> {\n $implicit: NgpDialogRef<T, R>;\n close: (result?: R) => void;\n}\n\nexport function injectDialogManager(): NgpDialogManager {\n return inject(NgpDialogManager);\n}\n","import { Directive, HostListener, inject, input, output, TemplateRef } from '@angular/core';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { NgpDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogContext, NgpDialogManager } from '../dialog/dialog.service';\n\n@Directive({\n selector: '[ngpDialogTrigger]',\n exportAs: 'ngpDialogTrigger',\n})\nexport class NgpDialogTrigger<T = unknown> {\n /** Access the global configuration */\n private readonly config = injectDialogConfig();\n\n /** Access the dialog manager. */\n private readonly dialogManager = inject(NgpDialogManager);\n\n /** The template to launch. */\n readonly template = input.required<TemplateRef<NgpDialogContext>>({\n alias: 'ngpDialogTrigger',\n });\n\n /** Emits whenever the dialog is closed with the given result. */\n readonly closed = output<T>({ alias: 'ngpDialogTriggerClosed' });\n\n /**\n * Whether the dialog should close on escape.\n * @default `true`\n */\n readonly closeOnEscape = input(this.config.closeOnEscape, {\n alias: 'ngpDialogTriggerCloseOnEscape',\n });\n\n /**\n * Store the dialog ref.\n * @internal\n */\n private dialogRef: NgpDialogRef | null = null;\n\n @HostListener('click')\n protected launch(): void {\n this.dialogRef = this.dialogManager.open(this.template(), {\n closeOnEscape: this.closeOnEscape(),\n });\n this.dialogRef.closed.subscribe(({ result }) => {\n this.closed.emit(result as T);\n return (this.dialogRef = null);\n });\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, HostListener, input, OnDestroy, signal } from '@angular/core';\nimport { NgpFocusTrap } from 'ng-primitives/focus-trap';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { injectDialogRef } from './dialog-ref';\nimport { dialogState, provideDialogState } from './dialog-state';\n\n@Directive({\n selector: '[ngpDialog]',\n exportAs: 'ngpDialog',\n providers: [provideDialogState()],\n hostDirectives: [NgpFocusTrap, NgpExitAnimation],\n host: {\n tabindex: '-1',\n '[id]': 'state.id()',\n '[attr.role]': 'state.role()',\n '[attr.aria-modal]': 'state.modal()',\n '[attr.aria-labelledby]': 'labelledBy().join(\" \")',\n '[attr.aria-describedby]': 'describedBy().join(\" \")',\n },\n})\nexport class NgpDialog<T = unknown, R = unknown> implements OnDestroy {\n private readonly config = injectDialogConfig();\n\n /** Access the dialog ref */\n private readonly dialogRef = injectDialogRef<T, R>();\n\n /** The id of the dialog */\n readonly id = input<string>(uniqueId('ngp-dialog'));\n\n /** The dialog role. */\n readonly role = input(this.config.role, {\n alias: 'ngpDialogRole',\n });\n\n /** Whether the dialog is a modal. */\n readonly modal = input<boolean, BooleanInput>(this.config.modal ?? false, {\n alias: 'ngpDialogModal',\n transform: booleanAttribute,\n });\n\n /** The labelledby ids */\n protected readonly labelledBy = signal<string[]>([]);\n\n /** The describedby ids */\n protected readonly describedBy = signal<string[]>([]);\n\n /** The dialog state */\n protected readonly state = dialogState<NgpDialog<T, R>>(this);\n\n ngOnDestroy(): void {\n this.close();\n }\n\n /** Close the dialog. */\n close(result?: R): void {\n this.dialogRef.close(result);\n }\n\n /** Stop click events from propagating to the overlay */\n @HostListener('click', ['$event'])\n protected onClick(event: Event): void {\n event.stopPropagation();\n }\n\n /** @internal register a labelledby id */\n setLabelledBy(id: string): void {\n this.labelledBy.update(ids => [...ids, id]);\n }\n\n /** @internal register a describedby id */\n setDescribedBy(id: string): void {\n this.describedBy.update(ids => [...ids, id]);\n }\n\n /** @internal remove a labelledby id */\n removeLabelledBy(id: string): void {\n this.labelledBy.update(ids => ids.filter(i => i !== id));\n }\n\n /** @internal remove a describedby id */\n removeDescribedBy(id: string): void {\n this.describedBy.update(ids => ids.filter(i => i !== id));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i2"],"mappings":";;;;;;;;;;;;;;;AAwCO,MAAM,mBAAmB,GAAoB;AAClD,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,iBAAiB,EAAE,IAAI;AACvB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,YAAY,EAAE,IAAI;CACnB;AAEM,MAAM,oBAAoB,GAAG,IAAI,cAAc,CAAkB,sBAAsB,CAAC;AAE/F;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,MAAgC,EAAA;IAClE,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,oBAAoB;AAC7B,YAAA,QAAQ,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,MAAM,EAAE;AAChD,SAAA;KACF;AACH;AAEA;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,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,iBAAA,EAAA,EAAA,UAAA,EAAA,EAAA,IAAA,EAAA,YAAA,EAAA,WAAA,EAAA,cAAA,EAAA,iBAAA,EAAA,eAAA,EAAA,sBAAA,EAAA,0BAAA,EAAA,uBAAA,EAAA,2BAAA,EAAA,EAAA,EAAA,SAAA,EAXT,CAAC,kBAAkB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAAA,IAAA,CAAA,YAAA,EAAA,EAAA,EAAA,SAAA,EAAAC,EAAA,CAAA,gBAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAWtB,SAAS,EAAA,UAAA,EAAA,CAAA;kBAdrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,kBAAkB,EAAE,CAAC;AACjC,oBAAA,cAAc,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;AAChD,oBAAA,IAAI,EAAE;AACJ,wBAAA,QAAQ,EAAE,IAAI;AACd,wBAAA,MAAM,EAAE,YAAY;AACpB,wBAAA,aAAa,EAAE,cAAc;AAC7B,wBAAA,mBAAmB,EAAE,eAAe;AACpC,wBAAA,wBAAwB,EAAE,wBAAwB;AAClD,wBAAA,yBAAyB,EAAE,yBAAyB;AACrD,qBAAA;AACF,iBAAA;;sBAwCE,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;AC9DnC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-dialog.mjs","sources":["../../../../packages/ng-primitives/dialog/src/config/dialog-config.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog-state.ts","../../../../packages/ng-primitives/dialog/src/dialog-description/dialog-description.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog-ref.ts","../../../../packages/ng-primitives/dialog/src/dialog-overlay/dialog-overlay.ts","../../../../packages/ng-primitives/dialog/src/dialog-title/dialog-title.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog.service.ts","../../../../packages/ng-primitives/dialog/src/dialog-trigger/dialog-trigger.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog.ts","../../../../packages/ng-primitives/dialog/src/ng-primitives-dialog.ts"],"sourcesContent":["import { ScrollStrategy } from '@angular/cdk/overlay';\nimport { InjectionToken, Injector, Provider, ViewContainerRef, inject } from '@angular/core';\n\n/** Valid ARIA roles for a dialog. */\nexport type NgpDialogRole = 'dialog' | 'alertdialog';\n\nexport interface NgpDialogConfig<T = any> {\n /** The view container to attach the dialog to. */\n viewContainerRef?: ViewContainerRef;\n\n /** The injector to use for the dialog. Defaults to the view container's injector.*/\n injector?: Injector;\n\n /** ID for the dialog. If omitted, a unique one will be generated. */\n id?: string;\n\n /** The role of the dialog. */\n role?: NgpDialogRole;\n\n /** Whether this is a modal dialog. Used to set the `aria-modal` attribute. */\n modal?: boolean;\n\n /** Scroll strategy to be used for the dialog. This determines how the dialog responds to scrolling underneath the panel element. */\n scrollStrategy?: ScrollStrategy;\n\n /**\n * Whether the dialog should close when the user navigates backwards or forwards through browser\n * history.\n */\n closeOnNavigation?: boolean;\n\n /** Whether the dialog should close when the user presses the escape key. */\n closeOnEscape?: boolean;\n\n /** Whether the dialog should close when the user click the overlay. */\n closeOnClick?: boolean;\n\n data?: T;\n}\n\nexport const defaultDialogConfig: NgpDialogConfig = {\n role: 'dialog',\n modal: true,\n closeOnNavigation: true,\n closeOnEscape: true,\n closeOnClick: true,\n};\n\nexport const NgpDialogConfigToken = new InjectionToken<NgpDialogConfig>('NgpDialogConfigToken');\n\n/**\n * Provide the default Dialog configuration\n * @param config The Dialog configuration\n * @returns The provider\n */\nexport function provideDialogConfig(config: Partial<NgpDialogConfig>): Provider[] {\n return [\n {\n provide: NgpDialogConfigToken,\n useValue: { ...defaultDialogConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Dialog configuration\n * @returns The global Dialog configuration\n */\nexport function injectDialogConfig(): NgpDialogConfig {\n return inject(NgpDialogConfigToken, { optional: true }) ?? defaultDialogConfig;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpDialog } from './dialog';\n\n/**\n * The state token for the Dialog primitive.\n */\nexport const NgpDialogStateToken = createStateToken<NgpDialog<any, any>>('Dialog');\n\n/**\n * Provides the Dialog state.\n */\nexport const provideDialogState = createStateProvider(NgpDialogStateToken);\n\n/**\n * Injects the Dialog state.\n */\nexport const injectDialogState = createStateInjector<NgpDialog>(NgpDialogStateToken);\n\n/**\n * The Dialog state registration function.\n */\nexport const dialogState = createState(NgpDialogStateToken);\n","import { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialogState } from '../dialog/dialog-state';\n\n@Directive({\n selector: '[ngpDialogDescription]',\n exportAs: 'ngpDialogDescription',\n host: {\n '[id]': 'id()',\n },\n})\nexport class NgpDialogDescription implements OnDestroy {\n /** Access the dialog */\n private readonly dialog = injectDialogState();\n\n /** The id of the descriptions. */\n readonly id = input<string>(uniqueId('ngp-dialog-description'));\n\n constructor() {\n onChange(this.id, (id, prevId) => {\n if (prevId) {\n this.dialog().removeDescribedBy(prevId);\n }\n\n if (id) {\n this.dialog().setDescribedBy(id);\n }\n });\n }\n\n ngOnDestroy(): void {\n this.dialog().removeDescribedBy(this.id());\n }\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { hasModifierKey } from '@angular/cdk/keycodes';\nimport { OverlayRef } from '@angular/cdk/overlay';\nimport { inject, Injector } from '@angular/core';\nimport { NgpExitAnimationManager } from 'ng-primitives/internal';\nimport { Observable, Subject, Subscription } from 'rxjs';\nimport { NgpDialogConfig } from '../config/dialog-config';\n\n/**\n * Reference to a dialog opened via the Dialog service.\n */\nexport class NgpDialogRef<T = unknown, R = unknown> {\n /** Whether the user is allowed to close the dialog. */\n disableClose: boolean | undefined;\n\n /** Whether the escape key is allowed to close the dialog. */\n closeOnEscape: boolean | undefined;\n\n /** Emits when the dialog has been closed. */\n readonly closed = new Subject<{ focusOrigin?: FocusOrigin; result?: R }>();\n\n /** Emits when on keyboard events within the dialog. */\n readonly keydownEvents: Observable<KeyboardEvent>;\n\n /** Emits on pointer events that happen outside of the dialog. */\n readonly outsidePointerEvents: Observable<MouseEvent>;\n\n /** Data passed from the dialog opener. */\n readonly data?: T;\n\n /** Unique ID for the dialog. */\n readonly id: string;\n\n /** Subscription to external detachments of the dialog. */\n private detachSubscription: Subscription;\n\n /** @internal Store the injector */\n injector: Injector | undefined;\n\n /** Whether the dialog is closing. */\n private closing = false;\n\n constructor(\n readonly overlayRef: OverlayRef,\n readonly config: NgpDialogConfig<T>,\n ) {\n this.data = config.data;\n this.keydownEvents = overlayRef.keydownEvents();\n this.outsidePointerEvents = overlayRef.outsidePointerEvents();\n this.id = config.id!; // By the time the dialog is created we are guaranteed to have an ID.\n this.closeOnEscape = config.closeOnEscape ?? true;\n\n this.keydownEvents.subscribe(event => {\n if (\n event.key === 'Escape' &&\n !this.disableClose &&\n this.closeOnEscape !== false &&\n !hasModifierKey(event)\n ) {\n event.preventDefault();\n this.close(undefined, 'keyboard');\n }\n });\n\n this.detachSubscription = overlayRef.detachments().subscribe(() => this.close());\n }\n\n /**\n * Close the dialog.\n * @param result Optional result to return to the dialog opener.\n * @param options Additional options to customize the closing behavior.\n */\n async close(result?: R, focusOrigin?: FocusOrigin): Promise<void> {\n // If the dialog is already closed, do nothing.\n if (this.closing) {\n return;\n }\n\n this.closing = true;\n\n const exitAnimationManager = this.injector?.get(NgpExitAnimationManager, undefined, {\n optional: true,\n });\n if (exitAnimationManager) {\n await exitAnimationManager.exit();\n }\n\n this.overlayRef.dispose();\n this.detachSubscription.unsubscribe();\n this.closed.next({ focusOrigin, result });\n this.closed.complete();\n }\n\n /** Updates the position of the dialog based on the current position strategy. */\n updatePosition(): this {\n this.overlayRef.updatePosition();\n return this;\n }\n}\n\nexport function injectDialogRef<T = unknown, R = unknown>(): NgpDialogRef<T, R> {\n return inject<NgpDialogRef<T, R>>(NgpDialogRef);\n}\n","import { booleanAttribute, Directive, HostListener, input } from '@angular/core';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { injectDialogRef } from '../dialog/dialog-ref';\n\n@Directive({\n selector: '[ngpDialogOverlay]',\n exportAs: 'ngpDialogOverlay',\n hostDirectives: [NgpExitAnimation],\n})\nexport class NgpDialogOverlay {\n /** Access the global configuration */\n private readonly config = injectDialogConfig();\n\n /** Access the dialog ref. */\n private readonly dialogRef = injectDialogRef();\n\n /**\n * Whether the dialog should close on backdrop click.\n * @default `true`\n */\n readonly closeOnClick = input(this.config.closeOnClick, {\n alias: 'ngpDialogOverlayCloseOnClick',\n transform: booleanAttribute,\n });\n\n @HostListener('click')\n protected close(): void {\n if (this.closeOnClick() && !this.dialogRef.disableClose) {\n this.dialogRef.close(undefined, 'mouse');\n }\n }\n}\n","import { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialogState } from '../dialog/dialog-state';\n\n@Directive({\n selector: '[ngpDialogTitle]',\n exportAs: 'ngpDialogTitle',\n host: {\n '[id]': 'id()',\n },\n})\nexport class NgpDialogTitle implements OnDestroy {\n /** Access the dialog. */\n private readonly dialog = injectDialogState();\n\n /** The id of the title. */\n readonly id = input<string>(uniqueId('ngp-dialog-title'));\n\n constructor() {\n onChange(this.id, (id, prevId) => {\n if (prevId) {\n this.dialog().removeLabelledBy(prevId);\n }\n\n if (id) {\n this.dialog().setLabelledBy(id);\n }\n });\n }\n\n ngOnDestroy(): void {\n this.dialog().removeLabelledBy(this.id());\n }\n}\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport { Overlay, OverlayConfig, OverlayContainer, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT } from '@angular/common';\nimport {\n ApplicationRef,\n Injectable,\n Injector,\n OnDestroy,\n StaticProvider,\n TemplateRef,\n Type,\n ViewContainerRef,\n inject,\n isDevMode,\n} from '@angular/core';\nimport { NgpExitAnimationManager } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { Observable, Subject, defer } from 'rxjs';\nimport { startWith } from 'rxjs/operators';\nimport { NgpDialogConfig, injectDialogConfig } from '../config/dialog-config';\nimport { NgpDialogRef } from './dialog-ref';\n\n/**\n * This is based on the Angular CDK Dialog service.\n * https://github.com/angular/components/blob/main/src/cdk/dialog/dialog.ts\n */\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NgpDialogManager implements OnDestroy {\n private readonly applicationRef = inject(ApplicationRef);\n private readonly document = inject<Document>(DOCUMENT);\n private readonly overlay = inject(Overlay);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly defaultOptions = injectDialogConfig();\n private readonly parentDialogManager = inject(NgpDialogManager, {\n optional: true,\n skipSelf: true,\n });\n private readonly overlayContainer = inject(OverlayContainer);\n private readonly scrollStrategy: ScrollStrategy =\n this.defaultOptions.scrollStrategy ?? this.overlay.scrollStrategies.block();\n\n private openDialogsAtThisLevel: NgpDialogRef[] = [];\n private readonly afterAllClosedAtThisLevel = new Subject<void>();\n private readonly afterOpenedAtThisLevel = new Subject<NgpDialogRef>();\n private ariaHiddenElements = new Map<Element, string | null>();\n\n /** Keeps track of the currently-open dialogs. */\n get openDialogs(): readonly NgpDialogRef[] {\n return this.parentDialogManager\n ? this.parentDialogManager.openDialogs\n : this.openDialogsAtThisLevel;\n }\n\n /** Stream that emits when a dialog has been opened. */\n get afterOpened(): Subject<NgpDialogRef> {\n return this.parentDialogManager\n ? this.parentDialogManager.afterOpened\n : this.afterOpenedAtThisLevel;\n }\n\n /**\n * Stream that emits when all open dialog have finished closing.\n * Will emit on subscribe if there are no open dialogs to begin with.\n */\n readonly afterAllClosed: Observable<void> = defer(() =>\n this.openDialogs.length\n ? this.getAfterAllClosed()\n : this.getAfterAllClosed().pipe(startWith(undefined)),\n );\n\n /**\n * Opens a modal dialog containing the given template.\n */\n open<T, R>(\n templateRefOrComponentType: TemplateRef<NgpDialogContext<T, R>> | Type<unknown>,\n config?: NgpDialogConfig<T>,\n ): NgpDialogRef<T, R> {\n // store the current active element so we can focus it after the dialog is closed\n const activeElement = this.document.activeElement;\n\n // this is not ideal, but there is a case where a dialog trigger is within an overlay (e.g. menu),\n // which may be removed before the dialog is closed. This is not desired, so we need to access a view container ref\n // that is not within the overlay. To solve this we use the view container ref of the root component.\n // Could this have any unintended side effects? For example, the dialog would not be closed during route changes?\n const viewContainerRef =\n this.applicationRef.components[0]?.injector.get(ViewContainerRef) ??\n config?.viewContainerRef ??\n config?.injector?.get(ViewContainerRef);\n\n const defaults = this.defaultOptions;\n config = { ...defaults, viewContainerRef, ...config };\n config.id = config.id ?? uniqueId('ngp-dialog');\n\n if (config.id && this.getDialogById(config.id) && isDevMode()) {\n throw Error(`Dialog with id \"${config.id}\" exists already. The dialog id must be unique.`);\n }\n\n const overlayConfig = this.getOverlayConfig(config);\n const overlayRef = this.overlay.create(overlayConfig);\n const dialogRef = new NgpDialogRef<T, R>(overlayRef, config);\n const injector = this.createInjector(config, dialogRef, undefined);\n\n // store the injector in the dialog ref - this is so we can access the exit animation manager\n dialogRef.injector = injector;\n\n const context: NgpDialogContext<T, R> = {\n $implicit: dialogRef,\n close: dialogRef.close.bind(dialogRef),\n };\n\n if (templateRefOrComponentType instanceof TemplateRef) {\n overlayRef.attach(\n new TemplatePortal(templateRefOrComponentType, config.viewContainerRef!, context, injector),\n );\n } else {\n overlayRef.attach(\n new ComponentPortal(templateRefOrComponentType, config.viewContainerRef!, injector),\n );\n }\n\n // If this is the first dialog that we're opening, hide all the non-overlay content.\n if (!this.openDialogs.length) {\n this.hideNonDialogContentFromAssistiveTechnology();\n }\n\n (this.openDialogs as NgpDialogRef[]).push(dialogRef as NgpDialogRef<any, any>);\n this.afterOpened.next(dialogRef as NgpDialogRef<any, any>);\n\n dialogRef.closed.subscribe(closeResult => {\n this.removeOpenDialog(dialogRef as NgpDialogRef<any, any>, true);\n // Focus the trigger element after the dialog closes.\n if (activeElement instanceof HTMLElement && this.document.body.contains(activeElement)) {\n // Its not great that we are relying on an internal API here, but we need to in order to\n // try and best determine the focus origin when it is programmatically closed by the user.\n this.focusMonitor.focusVia(\n activeElement,\n closeResult.focusOrigin ?? (this.focusMonitor as any)._lastFocusOrigin,\n );\n }\n });\n\n return dialogRef;\n }\n\n /**\n * Closes all of the currently-open dialogs.\n */\n closeAll(): void {\n reverseForEach(this.openDialogs, dialog => dialog.close());\n }\n\n /**\n * Finds an open dialog by its id.\n * @param id ID to use when looking up the dialog.\n */\n getDialogById(id: string): NgpDialogRef | undefined {\n return this.openDialogs.find(dialog => dialog.id === id);\n }\n\n ngOnDestroy(): void {\n // Make one pass over all the dialogs that need to be untracked, but should not be closed. We\n // want to stop tracking the open dialog even if it hasn't been closed, because the tracking\n // determines when `aria-hidden` is removed from elements outside the dialog.\n reverseForEach(this.openDialogsAtThisLevel, dialog => {\n // Check for `false` specifically since we want `undefined` to be interpreted as `true`.\n this.removeOpenDialog(dialog, false);\n });\n\n // Make a second pass and close the remaining dialogs. We do this second pass in order to\n // correctly dispatch the `afterAllClosed` event in case we have a mixed array of dialogs\n // that should be closed and dialogs that should not.\n reverseForEach(this.openDialogsAtThisLevel, dialog => dialog.close());\n\n this.afterAllClosedAtThisLevel.complete();\n this.afterOpenedAtThisLevel.complete();\n this.openDialogsAtThisLevel = [];\n }\n\n /**\n * Creates an overlay config from a dialog config.\n */\n private getOverlayConfig(config: NgpDialogConfig): OverlayConfig {\n const state = new OverlayConfig({\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: config.scrollStrategy || this.scrollStrategy,\n hasBackdrop: false,\n disposeOnNavigation: config.closeOnNavigation,\n // required for v21 - the CDK launches overlays using the popover api which means any other overlays\n // such as select dropdowns, or tooltips will appear behind the dialog, regardless of z-index\n // this disables the use of popovers\n usePopover: false,\n } as any);\n\n return state;\n }\n\n /**\n * Creates a custom injector to be used inside the dialog. This allows a component loaded inside\n * of a dialog to close itself and, optionally, to return a value.\n */\n private createInjector<T, R>(\n config: NgpDialogConfig<T>,\n dialogRef: NgpDialogRef<T, R>,\n fallbackInjector: Injector | undefined,\n ): Injector {\n const userInjector = config.injector || config.viewContainerRef?.injector;\n const providers: StaticProvider[] = [\n { provide: NgpDialogRef, useValue: dialogRef },\n { provide: NgpExitAnimationManager, useClass: NgpExitAnimationManager },\n ];\n\n return Injector.create({ parent: userInjector || fallbackInjector, providers });\n }\n\n /**\n * Removes a dialog from the array of open dialogs.\n */\n private removeOpenDialog(dialogRef: NgpDialogRef, emitEvent: boolean) {\n const index = this.openDialogs.indexOf(dialogRef);\n\n if (index > -1) {\n (this.openDialogs as NgpDialogRef[]).splice(index, 1);\n\n // If all the dialogs were closed, remove/restore the `aria-hidden`\n // to a the siblings and emit to the `afterAllClosed` stream.\n if (!this.openDialogs.length) {\n this.ariaHiddenElements.forEach((previousValue, element) => {\n if (previousValue) {\n element.setAttribute('aria-hidden', previousValue);\n } else {\n element.removeAttribute('aria-hidden');\n }\n });\n\n this.ariaHiddenElements.clear();\n\n if (emitEvent) {\n this.getAfterAllClosed().next();\n }\n }\n }\n }\n\n /** Hides all of the content that isn't an overlay from assistive technology. */\n private hideNonDialogContentFromAssistiveTechnology() {\n const overlayContainer = this.overlayContainer.getContainerElement();\n\n // Ensure that the overlay container is attached to the DOM.\n if (overlayContainer.parentElement) {\n const siblings = overlayContainer.parentElement.children;\n\n for (let i = siblings.length - 1; i > -1; i--) {\n const sibling = siblings[i];\n\n if (\n sibling !== overlayContainer &&\n sibling.nodeName !== 'SCRIPT' &&\n sibling.nodeName !== 'STYLE' &&\n !sibling.hasAttribute('aria-live')\n ) {\n this.ariaHiddenElements.set(sibling, sibling.getAttribute('aria-hidden'));\n sibling.setAttribute('aria-hidden', 'true');\n }\n }\n }\n }\n\n private getAfterAllClosed(): Subject<void> {\n const parent = this.parentDialogManager;\n return parent ? parent.getAfterAllClosed() : this.afterAllClosedAtThisLevel;\n }\n}\n\n/**\n * Executes a callback against all elements in an array while iterating in reverse.\n * Useful if the array is being modified as it is being iterated.\n */\nfunction reverseForEach<T>(items: T[] | readonly T[], callback: (current: T) => void) {\n let i = items.length;\n\n while (i--) {\n callback(items[i]);\n }\n}\n\nexport interface NgpDialogContext<T = unknown, R = unknown> {\n $implicit: NgpDialogRef<T, R>;\n close: (result?: R) => void;\n}\n\nexport function injectDialogManager(): NgpDialogManager {\n return inject(NgpDialogManager);\n}\n","import { Directive, HostListener, inject, input, output, TemplateRef } from '@angular/core';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { NgpDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogContext, NgpDialogManager } from '../dialog/dialog.service';\n\n@Directive({\n selector: '[ngpDialogTrigger]',\n exportAs: 'ngpDialogTrigger',\n})\nexport class NgpDialogTrigger<T = unknown> {\n /** Access the global configuration */\n private readonly config = injectDialogConfig();\n\n /** Access the dialog manager. */\n private readonly dialogManager = inject(NgpDialogManager);\n\n /** The template to launch. */\n readonly template = input.required<TemplateRef<NgpDialogContext>>({\n alias: 'ngpDialogTrigger',\n });\n\n /** Emits whenever the dialog is closed with the given result. */\n readonly closed = output<T>({ alias: 'ngpDialogTriggerClosed' });\n\n /**\n * Whether the dialog should close on escape.\n * @default `true`\n */\n readonly closeOnEscape = input(this.config.closeOnEscape, {\n alias: 'ngpDialogTriggerCloseOnEscape',\n });\n\n /**\n * Store the dialog ref.\n * @internal\n */\n private dialogRef: NgpDialogRef | null = null;\n\n @HostListener('click')\n protected launch(): void {\n this.dialogRef = this.dialogManager.open(this.template(), {\n closeOnEscape: this.closeOnEscape(),\n });\n this.dialogRef.closed.subscribe(({ result }) => {\n this.closed.emit(result as T);\n return (this.dialogRef = null);\n });\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, HostListener, input, OnDestroy, signal } from '@angular/core';\nimport { NgpFocusTrap } from 'ng-primitives/focus-trap';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { injectDialogRef } from './dialog-ref';\nimport { dialogState, provideDialogState } from './dialog-state';\n\n@Directive({\n selector: '[ngpDialog]',\n exportAs: 'ngpDialog',\n providers: [provideDialogState()],\n hostDirectives: [NgpFocusTrap, NgpExitAnimation],\n host: {\n tabindex: '-1',\n '[id]': 'state.id()',\n '[attr.role]': 'state.role()',\n '[attr.aria-modal]': 'state.modal()',\n '[attr.aria-labelledby]': 'labelledBy().join(\" \")',\n '[attr.aria-describedby]': 'describedBy().join(\" \")',\n },\n})\nexport class NgpDialog<T = unknown, R = unknown> implements OnDestroy {\n private readonly config = injectDialogConfig();\n\n /** Access the dialog ref */\n private readonly dialogRef = injectDialogRef<T, R>();\n\n /** The id of the dialog */\n readonly id = input<string>(uniqueId('ngp-dialog'));\n\n /** The dialog role. */\n readonly role = input(this.config.role, {\n alias: 'ngpDialogRole',\n });\n\n /** Whether the dialog is a modal. */\n readonly modal = input<boolean, BooleanInput>(this.config.modal ?? false, {\n alias: 'ngpDialogModal',\n transform: booleanAttribute,\n });\n\n /** The labelledby ids */\n protected readonly labelledBy = signal<string[]>([]);\n\n /** The describedby ids */\n protected readonly describedBy = signal<string[]>([]);\n\n /** The dialog state */\n protected readonly state = dialogState<NgpDialog<T, R>>(this);\n\n ngOnDestroy(): void {\n this.close();\n }\n\n /** Close the dialog. */\n close(result?: R): void {\n this.dialogRef.close(result);\n }\n\n /** Stop click events from propagating to the overlay */\n @HostListener('click', ['$event'])\n protected onClick(event: Event): void {\n event.stopPropagation();\n }\n\n /** @internal register a labelledby id */\n setLabelledBy(id: string): void {\n this.labelledBy.update(ids => [...ids, id]);\n }\n\n /** @internal register a describedby id */\n setDescribedBy(id: string): void {\n this.describedBy.update(ids => [...ids, id]);\n }\n\n /** @internal remove a labelledby id */\n removeLabelledBy(id: string): void {\n this.labelledBy.update(ids => ids.filter(i => i !== id));\n }\n\n /** @internal remove a describedby id */\n removeDescribedBy(id: string): void {\n this.describedBy.update(ids => ids.filter(i => i !== id));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i2"],"mappings":";;;;;;;;;;;;;;;;AAwCO,MAAM,mBAAmB,GAAoB;AAClD,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,iBAAiB,EAAE,IAAI;AACvB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,YAAY,EAAE,IAAI;CACnB;AAEM,MAAM,oBAAoB,GAAG,IAAI,cAAc,CAAkB,sBAAsB,CAAC;AAE/F;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,MAAgC,EAAA;IAClE,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,oBAAoB;AAC7B,YAAA,QAAQ,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,MAAM,EAAE;AAChD,SAAA;KACF;AACH;AAEA;;;AAGG;SACa,kBAAkB,GAAA;AAChC,IAAA,OAAO,MAAM,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,mBAAmB;AAChF;;AC9DA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAsB,QAAQ,CAAC;AAElF;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAY,mBAAmB;AAEnF;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;MCf9C,oBAAoB,CAAA;AAO/B,IAAA,WAAA,GAAA;;QAL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A,EAAA,EAAA,CAAA,CAAA;;2FAWtB,SAAS,EAAA,UAAA,EAAA,CAAA;kBAdrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,kBAAkB,EAAE,CAAC;AACjC,oBAAA,cAAc,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;AAChD,oBAAA,IAAI,EAAE;AACJ,wBAAA,QAAQ,EAAE,IAAI;AACd,wBAAA,MAAM,EAAE,YAAY;AACpB,wBAAA,aAAa,EAAE,cAAc;AAC7B,wBAAA,mBAAmB,EAAE,eAAe;AACpC,wBAAA,wBAAwB,EAAE,wBAAwB;AAClD,wBAAA,yBAAyB,EAAE,yBAAyB;AACrD,qBAAA;AACF,iBAAA;;sBAwCE,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;AC9DnC;;AAEG;;;;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { coerceStringArray } from '@angular/cdk/coercion';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { signal, input, booleanAttribute, output, Directive, inject
|
|
3
|
+
import { signal, input, booleanAttribute, output, Directive, inject } from '@angular/core';
|
|
4
4
|
import { ngpHover, ngpInteractions } from 'ng-primitives/interactions';
|
|
5
5
|
import { injectElementRef } from 'ng-primitives/internal';
|
|
6
6
|
import { createPrimitive, controlled, emitter, dataBinding, listener, deprecatedSetter } from 'ng-primitives/state';
|
|
7
|
+
import { DOCUMENT } from '@angular/common';
|
|
7
8
|
|
|
8
9
|
function fileDropFilter(fileList, acceptedTypes, multiple) {
|
|
9
10
|
const validFiles = Array.from(fileList).filter(file => isFileTypeAccepted(file, acceptedTypes));
|
|
@@ -426,5 +427,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
426
427
|
* Generated bundle index. Do not edit.
|
|
427
428
|
*/
|
|
428
429
|
|
|
429
|
-
export { NgpFileDropzone, NgpFileUpload, injectFileDropzoneState, injectFileUploadState, provideFileDropzoneState, provideFileUploadState };
|
|
430
|
+
export { NgpFileDropzone, NgpFileUpload, injectFileDropzoneState, injectFileUploadState, ngpFileDropzone, ngpFileUpload, provideFileDropzoneState, provideFileUploadState };
|
|
430
431
|
//# sourceMappingURL=ng-primitives-file-upload.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-file-upload.mjs","sources":["../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-drop-filter.ts","../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-dropzone-state.ts","../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-dropzone.ts","../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload-state.ts","../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload.ts","../../../../packages/ng-primitives/file-upload/src/ng-primitives-file-upload.ts"],"sourcesContent":["export function fileDropFilter(\n fileList: FileList,\n acceptedTypes: string[] | undefined,\n multiple: boolean,\n) {\n const validFiles = Array.from(fileList).filter(file => isFileTypeAccepted(file, acceptedTypes));\n\n const limitedFiles = multiple ? validFiles : validFiles.slice(0, 1);\n\n return limitedFiles.length > 0 ? filesToFileList(limitedFiles) : null;\n}\n\nexport function isFileTypeAccepted(file: File, acceptedTypes: string[] | undefined) {\n // allow all file types if no types are specified\n if (!acceptedTypes || acceptedTypes.length === 0) return true;\n\n const mimeType = file.type;\n const fileName = file.name.toLowerCase();\n\n return acceptedTypes.some(type => {\n type = type.toLowerCase();\n\n if (type.startsWith('.')) {\n return fileName.endsWith(type);\n }\n\n if (type.endsWith('/*')) {\n const baseType = type.replace('/*', '');\n return mimeType.startsWith(baseType);\n }\n\n return mimeType === type;\n });\n}\n\nfunction filesToFileList(files: File[]): FileList {\n const dataTransfer = new DataTransfer();\n files.forEach(file => dataTransfer.items.add(file));\n return dataTransfer.files;\n}\n","import { Signal, signal } from '@angular/core';\nimport { ngpHover } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n controlled,\n createPrimitive,\n dataBinding,\n deprecatedSetter,\n emitter,\n listener,\n} from 'ng-primitives/state';\nimport { Observable } from 'rxjs';\nimport { fileDropFilter } from './file-drop-filter';\n\n/**\n * The state for the NgpFileDropzone directive.\n */\nexport interface NgpFileDropzoneState {\n /**\n * Whether the file dropzone is disabled.\n */\n readonly disabled: Signal<boolean | undefined>;\n /**\n * Whether the user is currently dragging over the element.\n */\n readonly isDragOver: Signal<boolean>;\n /**\n * Observable that emits when files are selected.\n */\n readonly selected: Observable<FileList | null>;\n /**\n * Observable that emits when files are rejected.\n */\n readonly rejected: Observable<void>;\n /**\n * Observable that emits when drag over state changes.\n */\n readonly dragOver: Observable<boolean>;\n\n /**\n * Set the accepted file types.\n */\n readonly fileTypes: Signal<string[] | undefined>;\n /**\n * Whether multiple files can be selected.\n */\n readonly multiple: Signal<boolean | undefined>;\n /**\n * Whether directories can be selected.\n */\n readonly directory: Signal<boolean | undefined>;\n\n /**\n * Set the disabled state.\n */\n setDisabled(value: boolean): void;\n}\n\n/**\n * The props for the NgpFileDropzone state.\n */\nexport interface NgpFileDropzoneProps {\n /**\n * The accepted file types.\n */\n readonly fileTypes?: Signal<string[] | undefined>;\n /**\n * Whether multiple files can be selected.\n */\n readonly multiple?: Signal<boolean>;\n /**\n * Whether directories can be selected.\n */\n readonly directory?: Signal<boolean>;\n /**\n * Whether the file dropzone is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Callback when files are selected.\n */\n readonly onSelected?: (files: FileList | null) => void;\n /**\n * Callback when files are rejected.\n */\n readonly onRejected?: () => void;\n /**\n * Callback when drag over state changes.\n */\n readonly onDragOver?: (isDragOver: boolean) => void;\n}\n\nexport const [\n NgpFileDropzoneStateToken,\n ngpFileDropzone,\n injectFileDropzoneState,\n provideFileDropzoneState,\n] = createPrimitive(\n 'NgpFileDropzone',\n ({\n fileTypes = signal<string[] | undefined>(undefined),\n multiple = signal<boolean>(false),\n directory = signal<boolean>(false),\n disabled: _disabled = signal<boolean>(false),\n onSelected,\n onRejected,\n onDragOver,\n }: NgpFileDropzoneProps) => {\n const element = injectElementRef();\n const isDragOverState = signal(false);\n\n // Controlled properties\n const disabled = controlled(_disabled);\n\n // Create observables\n const selected = emitter<FileList | null>();\n const rejected = emitter<void>();\n const dragOver = emitter<boolean>();\n\n // Host bindings\n dataBinding(element, 'data-dragover', () => (isDragOverState() ? '' : null));\n dataBinding(element, 'data-disabled', () => (disabled?.() ? '' : null));\n\n // Setup hover interaction\n ngpHover({ disabled });\n\n function onDragEnter(event: DragEvent): void {\n if (disabled?.()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n isDragOverState.set(true);\n dragOver.emit(true);\n onDragOver?.(true);\n }\n\n function onDragOverHandler(event: DragEvent): void {\n if (disabled?.()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n isDragOverState.set(true);\n }\n\n function onDragLeave(event: DragEvent): void {\n if (disabled?.() || !isDragOverState()) {\n return;\n }\n\n // if the element we are dragging over is a child of the file dropzone, ignore the event\n if (element.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n isDragOverState.set(false);\n dragOver.emit(false);\n onDragOver?.(false);\n }\n\n function onDrop(event: DragEvent): void {\n if (disabled?.()) {\n return;\n }\n\n event.preventDefault();\n isDragOverState.set(false);\n dragOver.emit(false);\n onDragOver?.(false);\n\n const fileList = event.dataTransfer?.files;\n if (fileList) {\n const filteredFiles = fileDropFilter(fileList, fileTypes?.(), multiple?.() ?? false);\n\n if (filteredFiles) {\n selected.emit(filteredFiles);\n onSelected?.(filteredFiles);\n } else {\n rejected.emit();\n onRejected?.();\n }\n }\n }\n\n // Event listeners\n listener(element, 'dragenter', onDragEnter);\n listener(element, 'dragover', onDragOverHandler);\n listener(element, 'dragleave', onDragLeave);\n listener(element, 'drop', onDrop);\n\n function setDisabled(value: boolean): void {\n disabled?.set(value);\n }\n\n return {\n disabled: deprecatedSetter(disabled, 'setDisabled'),\n fileTypes,\n multiple,\n directory,\n isDragOver: isDragOverState,\n selected: selected.asObservable(),\n rejected: rejected.asObservable(),\n dragOver: dragOver.asObservable(),\n setDisabled,\n } satisfies NgpFileDropzoneState;\n },\n);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { ngpFileDropzone, provideFileDropzoneState } from './file-dropzone-state';\n\n/**\n * Capture files dropped on the element.\n */\n@Directive({\n selector: '[ngpFileDropzone]',\n exportAs: 'ngpFileDropzone',\n providers: [provideFileDropzoneState()],\n})\nexport class NgpFileDropzone {\n /**\n * The accepted file types. This can be an array of strings or a comma-separated string.\n * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).\n */\n readonly fileTypes = input<string[], string | string[]>(undefined, {\n alias: 'ngpFileDropzoneFileTypes',\n transform: types => coerceStringArray(types, ','),\n });\n\n /**\n * Whether to allow multiple files to be selected.\n */\n readonly multiple = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneMultiple',\n transform: booleanAttribute,\n });\n\n /**\n * Whether to allow the user to select directories.\n */\n readonly directory = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneDirectory',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly selected = output<FileList | null>({\n alias: 'ngpFileDropzoneSelected',\n });\n\n /**\n * Emits when uploaded files are rejected because they do not match the allowed {@link fileTypes}.\n */\n readonly rejected = output<void>({\n alias: 'ngpFileDropzoneRejected',\n });\n\n /**\n * Emits when the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileDropzoneDragOver',\n });\n\n private readonly state = ngpFileDropzone({\n fileTypes: this.fileTypes,\n multiple: this.multiple,\n directory: this.directory,\n disabled: this.disabled,\n onSelected: files => this.selected.emit(files),\n onRejected: () => this.rejected.emit(),\n onDragOver: isDragOver => this.dragOver.emit(isDragOver),\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n readonly isDragOver = this.state.isDragOver;\n}\n","import { DOCUMENT, inject, Signal, signal } from '@angular/core';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, dataBinding, emitter, listener } from 'ng-primitives/state';\nimport { Observable } from 'rxjs';\nimport { fileDropFilter } from '../file-dropzone/file-drop-filter';\n\n/**\n * The state for the NgpFileUpload directive.\n */\nexport interface NgpFileUploadState {\n /**\n * Whether the user is currently dragging over the element.\n */\n readonly isDragOver: Signal<boolean>;\n /**\n * Observable that emits when files are selected.\n */\n readonly selected: Observable<FileList | null>;\n /**\n * Observable that emits when file selection is canceled.\n */\n readonly canceled: Observable<void>;\n /**\n * Observable that emits when files are rejected.\n */\n readonly rejected: Observable<void>;\n /**\n * Observable that emits when drag over state changes.\n */\n readonly dragOver: Observable<boolean>;\n /**\n * Show the file dialog.\n */\n showFileDialog(): void;\n}\n\n/**\n * The props for the NgpFileUpload state.\n */\nexport interface NgpFileUploadProps {\n /**\n * The accepted file types.\n */\n readonly fileTypes?: Signal<string[] | undefined>;\n /**\n * Whether multiple files can be selected.\n */\n readonly multiple?: Signal<boolean>;\n /**\n * Whether directories can be selected.\n */\n readonly directory?: Signal<boolean>;\n /**\n * Whether drag and drop is enabled.\n */\n readonly dragAndDrop?: Signal<boolean>;\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Callback when files are selected.\n */\n readonly onSelected?: (files: FileList | null) => void;\n /**\n * Callback when file selection is canceled.\n */\n readonly onCanceled?: () => void;\n /**\n * Callback when files are rejected.\n */\n readonly onRejected?: () => void;\n /**\n * Callback when drag over state changes.\n */\n readonly onDragOver?: (isDragOver: boolean) => void;\n}\n\nexport const [\n NgpFileUploadStateToken,\n ngpFileUpload,\n injectFileUploadState,\n provideFileUploadState,\n] = createPrimitive(\n 'NgpFileUpload',\n ({\n fileTypes,\n multiple,\n directory,\n dragAndDrop,\n disabled,\n onSelected,\n onCanceled,\n onRejected,\n onDragOver,\n }: NgpFileUploadProps) => {\n const element = injectElementRef();\n const document = inject(DOCUMENT);\n\n const isDragOver = signal(false);\n\n // Create observables\n const selected = emitter<FileList | null>();\n const canceled = emitter<void>();\n const rejected = emitter<void>();\n const dragOver = emitter<boolean>();\n\n // Host bindings\n dataBinding(element, 'data-disabled', () => (disabled?.() ? '' : null));\n dataBinding(element, 'data-dragover', () => (isDragOver() ? '' : null));\n\n // Setup interactions\n ngpInteractions({\n hover: true,\n press: true,\n focusVisible: true,\n disabled,\n });\n\n // Create file input\n const input: HTMLInputElement = document.createElement('input');\n input.type = 'file';\n input.style.display = 'none';\n\n input.addEventListener('change', () => {\n const files = input.files;\n selected.emit(files);\n onSelected?.(files);\n input.value = '';\n });\n\n input.addEventListener('cancel', () => {\n canceled.emit();\n onCanceled?.();\n });\n\n function showFileDialog(): void {\n if (disabled?.()) {\n return;\n }\n\n const fileTypesValue = fileTypes?.()?.join(',');\n if (fileTypesValue) {\n input.accept = fileTypesValue;\n }\n\n input.multiple = multiple?.() ?? false;\n input.webkitdirectory = directory?.() ?? false;\n input.click();\n }\n\n function onDragEnter(event: DragEvent): void {\n if (disabled?.() || !dragAndDrop?.()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n isDragOver.set(true);\n dragOver.emit(true);\n onDragOver?.(true);\n }\n\n function onDragOverHandler(event: DragEvent): void {\n if (disabled?.() || !dragAndDrop?.()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n isDragOver.set(true);\n }\n\n function onDragLeave(event: DragEvent): void {\n if (disabled?.() || !dragAndDrop?.() || !isDragOver()) {\n return;\n }\n\n // if the element we are dragging over is a child of the file upload, ignore the event\n if (element.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n isDragOver.set(false);\n dragOver.emit(false);\n onDragOver?.(false);\n }\n\n function onDrop(event: DragEvent): void {\n if (disabled?.() || !dragAndDrop?.()) {\n return;\n }\n\n event.preventDefault();\n isDragOver.set(false);\n dragOver.emit(false);\n onDragOver?.(false);\n\n const fileList = event.dataTransfer?.files;\n if (fileList) {\n const filteredFiles = fileDropFilter(fileList, fileTypes?.(), multiple?.() ?? false);\n\n if (filteredFiles) {\n selected.emit(filteredFiles);\n onSelected?.(filteredFiles);\n } else {\n rejected.emit();\n onRejected?.();\n }\n }\n }\n\n // Event listeners\n listener(element, 'click', showFileDialog);\n listener(element, 'dragenter', onDragEnter);\n listener(element, 'dragover', onDragOverHandler);\n listener(element, 'dragleave', onDragLeave);\n listener(element, 'drop', onDrop);\n\n return {\n isDragOver,\n selected: selected.asObservable(),\n canceled: canceled.asObservable(),\n rejected: rejected.asObservable(),\n dragOver: dragOver.asObservable(),\n showFileDialog,\n } satisfies NgpFileUploadState;\n },\n);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { ngpFileUpload, provideFileUploadState } from './file-upload-state';\n\n/**\n * A directive that allows you to turn any element into a file upload trigger.\n */\n@Directive({\n selector: '[ngpFileUpload]',\n exportAs: 'ngpFileUpload',\n providers: [provideFileUploadState()],\n})\nexport class NgpFileUpload {\n /**\n * The accepted file types. This can be an array of strings or a comma-separated string.\n * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).\n */\n readonly fileTypes = input<string[], string | string[]>(undefined, {\n alias: 'ngpFileUploadFileTypes',\n transform: types => coerceStringArray(types, ','),\n });\n\n /**\n * Whether to allow multiple files to be selected.\n */\n readonly multiple = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadMultiple',\n transform: booleanAttribute,\n });\n\n /**\n * Whether to allow the user to select directories.\n */\n readonly directory = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDirectory',\n transform: booleanAttribute,\n });\n\n /**\n * Whether drag-and-drop is enabled.\n */\n readonly dragAndDrop = input<boolean, BooleanInput>(true, {\n alias: 'ngpFileUploadDragDrop',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly selected = output<FileList | null>({\n alias: 'ngpFileUploadSelected',\n });\n\n /**\n * Emits when the user cancel the file selection.\n */\n readonly canceled = output<void>({\n alias: 'ngpFileUploadCanceled',\n });\n\n /**\n * Emits when uploaded files are rejected because they do not match the allowed {@link fileTypes}.\n */\n readonly rejected = output<void>({\n alias: 'ngpFileUploadRejected',\n });\n\n /**\n * Emits when the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileUploadDragOver',\n });\n\n private readonly state = ngpFileUpload({\n fileTypes: this.fileTypes,\n multiple: this.multiple,\n directory: this.directory,\n dragAndDrop: this.dragAndDrop,\n disabled: this.disabled,\n onSelected: files => this.selected.emit(files),\n onCanceled: () => this.canceled.emit(),\n onRejected: () => this.rejected.emit(),\n onDragOver: isDragOver => this.dragOver.emit(isDragOver),\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n readonly isDragOver = this.state.isDragOver;\n\n /**\n * Show the file dialog.\n */\n showFileDialog(): void {\n this.state.showFileDialog();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;SAAgB,cAAc,CAC5B,QAAkB,EAClB,aAAmC,EACnC,QAAiB,EAAA;IAEjB,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,kBAAkB,CA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AAQ,EAAE,iBAAiB;AAC3B,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE,CAAC,sBAAsB,EAAE,CAAC;AACtC,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-file-upload.mjs","sources":["../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-drop-filter.ts","../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-dropzone-state.ts","../../../../packages/ng-primitives/file-upload/src/file-dropzone/file-dropzone.ts","../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload-state.ts","../../../../packages/ng-primitives/file-upload/src/file-upload/file-upload.ts","../../../../packages/ng-primitives/file-upload/src/ng-primitives-file-upload.ts"],"sourcesContent":["export function fileDropFilter(\n fileList: FileList,\n acceptedTypes: string[] | undefined,\n multiple: boolean,\n) {\n const validFiles = Array.from(fileList).filter(file => isFileTypeAccepted(file, acceptedTypes));\n\n const limitedFiles = multiple ? validFiles : validFiles.slice(0, 1);\n\n return limitedFiles.length > 0 ? filesToFileList(limitedFiles) : null;\n}\n\nexport function isFileTypeAccepted(file: File, acceptedTypes: string[] | undefined) {\n // allow all file types if no types are specified\n if (!acceptedTypes || acceptedTypes.length === 0) return true;\n\n const mimeType = file.type;\n const fileName = file.name.toLowerCase();\n\n return acceptedTypes.some(type => {\n type = type.toLowerCase();\n\n if (type.startsWith('.')) {\n return fileName.endsWith(type);\n }\n\n if (type.endsWith('/*')) {\n const baseType = type.replace('/*', '');\n return mimeType.startsWith(baseType);\n }\n\n return mimeType === type;\n });\n}\n\nfunction filesToFileList(files: File[]): FileList {\n const dataTransfer = new DataTransfer();\n files.forEach(file => dataTransfer.items.add(file));\n return dataTransfer.files;\n}\n","import { Signal, signal } from '@angular/core';\nimport { ngpHover } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n controlled,\n createPrimitive,\n dataBinding,\n deprecatedSetter,\n emitter,\n listener,\n} from 'ng-primitives/state';\nimport { Observable } from 'rxjs';\nimport { fileDropFilter } from './file-drop-filter';\n\n/**\n * The state for the NgpFileDropzone directive.\n */\nexport interface NgpFileDropzoneState {\n /**\n * Whether the file dropzone is disabled.\n */\n readonly disabled: Signal<boolean | undefined>;\n /**\n * Whether the user is currently dragging over the element.\n */\n readonly isDragOver: Signal<boolean>;\n /**\n * Observable that emits when files are selected.\n */\n readonly selected: Observable<FileList | null>;\n /**\n * Observable that emits when files are rejected.\n */\n readonly rejected: Observable<void>;\n /**\n * Observable that emits when drag over state changes.\n */\n readonly dragOver: Observable<boolean>;\n\n /**\n * Set the accepted file types.\n */\n readonly fileTypes: Signal<string[] | undefined>;\n /**\n * Whether multiple files can be selected.\n */\n readonly multiple: Signal<boolean | undefined>;\n /**\n * Whether directories can be selected.\n */\n readonly directory: Signal<boolean | undefined>;\n\n /**\n * Set the disabled state.\n */\n setDisabled(value: boolean): void;\n}\n\n/**\n * The props for the NgpFileDropzone state.\n */\nexport interface NgpFileDropzoneProps {\n /**\n * The accepted file types.\n */\n readonly fileTypes?: Signal<string[] | undefined>;\n /**\n * Whether multiple files can be selected.\n */\n readonly multiple?: Signal<boolean>;\n /**\n * Whether directories can be selected.\n */\n readonly directory?: Signal<boolean>;\n /**\n * Whether the file dropzone is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Callback when files are selected.\n */\n readonly onSelected?: (files: FileList | null) => void;\n /**\n * Callback when files are rejected.\n */\n readonly onRejected?: () => void;\n /**\n * Callback when drag over state changes.\n */\n readonly onDragOver?: (isDragOver: boolean) => void;\n}\n\nexport const [\n NgpFileDropzoneStateToken,\n ngpFileDropzone,\n injectFileDropzoneState,\n provideFileDropzoneState,\n] = createPrimitive(\n 'NgpFileDropzone',\n ({\n fileTypes = signal<string[] | undefined>(undefined),\n multiple = signal<boolean>(false),\n directory = signal<boolean>(false),\n disabled: _disabled = signal<boolean>(false),\n onSelected,\n onRejected,\n onDragOver,\n }: NgpFileDropzoneProps) => {\n const element = injectElementRef();\n const isDragOverState = signal(false);\n\n // Controlled properties\n const disabled = controlled(_disabled);\n\n // Create observables\n const selected = emitter<FileList | null>();\n const rejected = emitter<void>();\n const dragOver = emitter<boolean>();\n\n // Host bindings\n dataBinding(element, 'data-dragover', () => (isDragOverState() ? '' : null));\n dataBinding(element, 'data-disabled', () => (disabled?.() ? '' : null));\n\n // Setup hover interaction\n ngpHover({ disabled });\n\n function onDragEnter(event: DragEvent): void {\n if (disabled?.()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n isDragOverState.set(true);\n dragOver.emit(true);\n onDragOver?.(true);\n }\n\n function onDragOverHandler(event: DragEvent): void {\n if (disabled?.()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n isDragOverState.set(true);\n }\n\n function onDragLeave(event: DragEvent): void {\n if (disabled?.() || !isDragOverState()) {\n return;\n }\n\n // if the element we are dragging over is a child of the file dropzone, ignore the event\n if (element.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n isDragOverState.set(false);\n dragOver.emit(false);\n onDragOver?.(false);\n }\n\n function onDrop(event: DragEvent): void {\n if (disabled?.()) {\n return;\n }\n\n event.preventDefault();\n isDragOverState.set(false);\n dragOver.emit(false);\n onDragOver?.(false);\n\n const fileList = event.dataTransfer?.files;\n if (fileList) {\n const filteredFiles = fileDropFilter(fileList, fileTypes?.(), multiple?.() ?? false);\n\n if (filteredFiles) {\n selected.emit(filteredFiles);\n onSelected?.(filteredFiles);\n } else {\n rejected.emit();\n onRejected?.();\n }\n }\n }\n\n // Event listeners\n listener(element, 'dragenter', onDragEnter);\n listener(element, 'dragover', onDragOverHandler);\n listener(element, 'dragleave', onDragLeave);\n listener(element, 'drop', onDrop);\n\n function setDisabled(value: boolean): void {\n disabled?.set(value);\n }\n\n return {\n disabled: deprecatedSetter(disabled, 'setDisabled'),\n fileTypes,\n multiple,\n directory,\n isDragOver: isDragOverState,\n selected: selected.asObservable(),\n rejected: rejected.asObservable(),\n dragOver: dragOver.asObservable(),\n setDisabled,\n } satisfies NgpFileDropzoneState;\n },\n);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { ngpFileDropzone, provideFileDropzoneState } from './file-dropzone-state';\n\n/**\n * Capture files dropped on the element.\n */\n@Directive({\n selector: '[ngpFileDropzone]',\n exportAs: 'ngpFileDropzone',\n providers: [provideFileDropzoneState()],\n})\nexport class NgpFileDropzone {\n /**\n * The accepted file types. This can be an array of strings or a comma-separated string.\n * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).\n */\n readonly fileTypes = input<string[], string | string[]>(undefined, {\n alias: 'ngpFileDropzoneFileTypes',\n transform: types => coerceStringArray(types, ','),\n });\n\n /**\n * Whether to allow multiple files to be selected.\n */\n readonly multiple = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneMultiple',\n transform: booleanAttribute,\n });\n\n /**\n * Whether to allow the user to select directories.\n */\n readonly directory = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneDirectory',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileDropzoneDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly selected = output<FileList | null>({\n alias: 'ngpFileDropzoneSelected',\n });\n\n /**\n * Emits when uploaded files are rejected because they do not match the allowed {@link fileTypes}.\n */\n readonly rejected = output<void>({\n alias: 'ngpFileDropzoneRejected',\n });\n\n /**\n * Emits when the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileDropzoneDragOver',\n });\n\n private readonly state = ngpFileDropzone({\n fileTypes: this.fileTypes,\n multiple: this.multiple,\n directory: this.directory,\n disabled: this.disabled,\n onSelected: files => this.selected.emit(files),\n onRejected: () => this.rejected.emit(),\n onDragOver: isDragOver => this.dragOver.emit(isDragOver),\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n readonly isDragOver = this.state.isDragOver;\n}\n","import { DOCUMENT } from '@angular/common';\nimport { inject, Signal, signal } from '@angular/core';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, dataBinding, emitter, listener } from 'ng-primitives/state';\nimport { Observable } from 'rxjs';\nimport { fileDropFilter } from '../file-dropzone/file-drop-filter';\n\n/**\n * The state for the NgpFileUpload directive.\n */\nexport interface NgpFileUploadState {\n /**\n * Whether the user is currently dragging over the element.\n */\n readonly isDragOver: Signal<boolean>;\n /**\n * Observable that emits when files are selected.\n */\n readonly selected: Observable<FileList | null>;\n /**\n * Observable that emits when file selection is canceled.\n */\n readonly canceled: Observable<void>;\n /**\n * Observable that emits when files are rejected.\n */\n readonly rejected: Observable<void>;\n /**\n * Observable that emits when drag over state changes.\n */\n readonly dragOver: Observable<boolean>;\n /**\n * Show the file dialog.\n */\n showFileDialog(): void;\n}\n\n/**\n * The props for the NgpFileUpload state.\n */\nexport interface NgpFileUploadProps {\n /**\n * The accepted file types.\n */\n readonly fileTypes?: Signal<string[] | undefined>;\n /**\n * Whether multiple files can be selected.\n */\n readonly multiple?: Signal<boolean>;\n /**\n * Whether directories can be selected.\n */\n readonly directory?: Signal<boolean>;\n /**\n * Whether drag and drop is enabled.\n */\n readonly dragAndDrop?: Signal<boolean>;\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Callback when files are selected.\n */\n readonly onSelected?: (files: FileList | null) => void;\n /**\n * Callback when file selection is canceled.\n */\n readonly onCanceled?: () => void;\n /**\n * Callback when files are rejected.\n */\n readonly onRejected?: () => void;\n /**\n * Callback when drag over state changes.\n */\n readonly onDragOver?: (isDragOver: boolean) => void;\n}\n\nexport const [\n NgpFileUploadStateToken,\n ngpFileUpload,\n injectFileUploadState,\n provideFileUploadState,\n] = createPrimitive(\n 'NgpFileUpload',\n ({\n fileTypes,\n multiple,\n directory,\n dragAndDrop,\n disabled,\n onSelected,\n onCanceled,\n onRejected,\n onDragOver,\n }: NgpFileUploadProps) => {\n const element = injectElementRef();\n const document = inject(DOCUMENT);\n\n const isDragOver = signal(false);\n\n // Create observables\n const selected = emitter<FileList | null>();\n const canceled = emitter<void>();\n const rejected = emitter<void>();\n const dragOver = emitter<boolean>();\n\n // Host bindings\n dataBinding(element, 'data-disabled', () => (disabled?.() ? '' : null));\n dataBinding(element, 'data-dragover', () => (isDragOver() ? '' : null));\n\n // Setup interactions\n ngpInteractions({\n hover: true,\n press: true,\n focusVisible: true,\n disabled,\n });\n\n // Create file input\n const input: HTMLInputElement = document.createElement('input');\n input.type = 'file';\n input.style.display = 'none';\n\n input.addEventListener('change', () => {\n const files = input.files;\n selected.emit(files);\n onSelected?.(files);\n input.value = '';\n });\n\n input.addEventListener('cancel', () => {\n canceled.emit();\n onCanceled?.();\n });\n\n function showFileDialog(): void {\n if (disabled?.()) {\n return;\n }\n\n const fileTypesValue = fileTypes?.()?.join(',');\n if (fileTypesValue) {\n input.accept = fileTypesValue;\n }\n\n input.multiple = multiple?.() ?? false;\n input.webkitdirectory = directory?.() ?? false;\n input.click();\n }\n\n function onDragEnter(event: DragEvent): void {\n if (disabled?.() || !dragAndDrop?.()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n isDragOver.set(true);\n dragOver.emit(true);\n onDragOver?.(true);\n }\n\n function onDragOverHandler(event: DragEvent): void {\n if (disabled?.() || !dragAndDrop?.()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n isDragOver.set(true);\n }\n\n function onDragLeave(event: DragEvent): void {\n if (disabled?.() || !dragAndDrop?.() || !isDragOver()) {\n return;\n }\n\n // if the element we are dragging over is a child of the file upload, ignore the event\n if (element.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n isDragOver.set(false);\n dragOver.emit(false);\n onDragOver?.(false);\n }\n\n function onDrop(event: DragEvent): void {\n if (disabled?.() || !dragAndDrop?.()) {\n return;\n }\n\n event.preventDefault();\n isDragOver.set(false);\n dragOver.emit(false);\n onDragOver?.(false);\n\n const fileList = event.dataTransfer?.files;\n if (fileList) {\n const filteredFiles = fileDropFilter(fileList, fileTypes?.(), multiple?.() ?? false);\n\n if (filteredFiles) {\n selected.emit(filteredFiles);\n onSelected?.(filteredFiles);\n } else {\n rejected.emit();\n onRejected?.();\n }\n }\n }\n\n // Event listeners\n listener(element, 'click', showFileDialog);\n listener(element, 'dragenter', onDragEnter);\n listener(element, 'dragover', onDragOverHandler);\n listener(element, 'dragleave', onDragLeave);\n listener(element, 'drop', onDrop);\n\n return {\n isDragOver,\n selected: selected.asObservable(),\n canceled: canceled.asObservable(),\n rejected: rejected.asObservable(),\n dragOver: dragOver.asObservable(),\n showFileDialog,\n } satisfies NgpFileUploadState;\n },\n);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { ngpFileUpload, provideFileUploadState } from './file-upload-state';\n\n/**\n * A directive that allows you to turn any element into a file upload trigger.\n */\n@Directive({\n selector: '[ngpFileUpload]',\n exportAs: 'ngpFileUpload',\n providers: [provideFileUploadState()],\n})\nexport class NgpFileUpload {\n /**\n * The accepted file types. This can be an array of strings or a comma-separated string.\n * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).\n */\n readonly fileTypes = input<string[], string | string[]>(undefined, {\n alias: 'ngpFileUploadFileTypes',\n transform: types => coerceStringArray(types, ','),\n });\n\n /**\n * Whether to allow multiple files to be selected.\n */\n readonly multiple = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadMultiple',\n transform: booleanAttribute,\n });\n\n /**\n * Whether to allow the user to select directories.\n */\n readonly directory = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDirectory',\n transform: booleanAttribute,\n });\n\n /**\n * Whether drag-and-drop is enabled.\n */\n readonly dragAndDrop = input<boolean, BooleanInput>(true, {\n alias: 'ngpFileUploadDragDrop',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the file upload is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFileUploadDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the user selects files.\n */\n readonly selected = output<FileList | null>({\n alias: 'ngpFileUploadSelected',\n });\n\n /**\n * Emits when the user cancel the file selection.\n */\n readonly canceled = output<void>({\n alias: 'ngpFileUploadCanceled',\n });\n\n /**\n * Emits when uploaded files are rejected because they do not match the allowed {@link fileTypes}.\n */\n readonly rejected = output<void>({\n alias: 'ngpFileUploadRejected',\n });\n\n /**\n * Emits when the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileUploadDragOver',\n });\n\n private readonly state = ngpFileUpload({\n fileTypes: this.fileTypes,\n multiple: this.multiple,\n directory: this.directory,\n dragAndDrop: this.dragAndDrop,\n disabled: this.disabled,\n onSelected: files => this.selected.emit(files),\n onCanceled: () => this.canceled.emit(),\n onRejected: () => this.rejected.emit(),\n onDragOver: isDragOver => this.dragOver.emit(isDragOver),\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n readonly isDragOver = this.state.isDragOver;\n\n /**\n * Show the file dialog.\n */\n showFileDialog(): void {\n this.state.showFileDialog();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;SAAgB,cAAc,CAC5B,QAAkB,EAClB,aAAmC,EACnC,QAAiB,EAAA;IAEjB,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;AAE/F,IAAA,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAA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;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, signal, ElementRef, Renderer2,
|
|
2
|
+
import { InjectionToken, inject, signal, ElementRef, Renderer2, PLATFORM_ID, Injectable, Injector, input, booleanAttribute, output, Directive, HostListener } from '@angular/core';
|
|
3
3
|
import { onDomRemoval, injectElementRef } from 'ng-primitives/internal';
|
|
4
4
|
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
5
5
|
import { safeTakeUntilDestroyed, onBooleanChange, injectDisposables } from 'ng-primitives/utils';
|
|
6
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
6
|
+
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
7
7
|
import { listener, dataBinding } from 'ng-primitives/state';
|
|
8
8
|
|
|
9
9
|
const defaultInteractionsConfig = {
|