ng-primitives 0.32.0 → 0.33.0
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/dialog/dialog/dialog.service.d.ts +1 -0
- package/fesm2022/ng-primitives-dialog.mjs +9 -10
- package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/ng-primitives-file-upload.mjs +168 -68
- package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
- package/file-upload/file-dropzone/file-dropzone-state.d.ts +31 -0
- package/file-upload/file-dropzone/file-dropzone.d.ts +50 -0
- package/file-upload/file-upload/file-upload-state.d.ts +15 -7
- package/file-upload/file-upload/file-upload.d.ts +6 -17
- package/file-upload/index.d.ts +2 -0
- package/package.json +9 -9
|
@@ -9,6 +9,7 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
* https://github.com/angular/components/blob/main/src/cdk/dialog/dialog.ts
|
|
10
10
|
*/
|
|
11
11
|
export declare class NgpDialogManager implements OnDestroy {
|
|
12
|
+
private readonly applicationRef;
|
|
12
13
|
private readonly overlay;
|
|
13
14
|
private readonly defaultOptions;
|
|
14
15
|
private readonly parentDialogManager;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, input, Directive, HostListener, isDevMode, TemplateRef, Injector, Injectable,
|
|
2
|
+
import { InjectionToken, inject, input, Directive, HostListener, ApplicationRef, ViewContainerRef, isDevMode, TemplateRef, Injector, Injectable, ElementRef, booleanAttribute, 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';
|
|
@@ -232,6 +232,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
|
|
|
232
232
|
*/
|
|
233
233
|
class NgpDialogManager {
|
|
234
234
|
constructor() {
|
|
235
|
+
this.applicationRef = inject(ApplicationRef);
|
|
235
236
|
this.overlay = inject(Overlay);
|
|
236
237
|
this.defaultOptions = injectDialogConfig();
|
|
237
238
|
this.parentDialogManager = inject(NgpDialogManager, {
|
|
@@ -268,8 +269,13 @@ class NgpDialogManager {
|
|
|
268
269
|
* Opens a modal dialog containing the given template.
|
|
269
270
|
*/
|
|
270
271
|
open(templateRefOrComponentType, config) {
|
|
272
|
+
// this is not ideal, but there is a case where a dialog trigger is within an overlay (e.g. menu),
|
|
273
|
+
// which may be removed before the dialog is closed. This is not desired, so we need to access a view container ref
|
|
274
|
+
// that is not within the overlay. To solve this we use the view container ref of the root component.
|
|
275
|
+
// Could this have any unintended side effects? For example, the dialog would not be closed during route changes?
|
|
276
|
+
const viewContainerRef = this.applicationRef.components[0].injector.get(ViewContainerRef);
|
|
271
277
|
const defaults = this.defaultOptions;
|
|
272
|
-
config = { ...defaults, ...config };
|
|
278
|
+
config = { ...defaults, viewContainerRef, ...config };
|
|
273
279
|
config.id = config.id ?? uniqueId('ngp-dialog');
|
|
274
280
|
if (config.id && this.getDialogById(config.id) && isDevMode()) {
|
|
275
281
|
throw Error(`Dialog with id "${config.id}" exists already. The dialog id must be unique.`);
|
|
@@ -451,14 +457,7 @@ class NgpDialogTrigger {
|
|
|
451
457
|
this.dialogRef = null;
|
|
452
458
|
}
|
|
453
459
|
launch() {
|
|
454
|
-
|
|
455
|
-
// which may be removed before the dialog is closed. This is not desired, so we need to access a view container ref
|
|
456
|
-
// that is not within the overlay. To solve this we use the view container ref of the root component.
|
|
457
|
-
// Could this have any unintended side effects? For example, the dialog would not be closed during route changes?
|
|
458
|
-
const viewContainerRef = this.applicationRef.components[0].injector.get(ViewContainerRef);
|
|
459
|
-
this.dialogRef = this.dialogManager.open(this.template(), {
|
|
460
|
-
viewContainerRef,
|
|
461
|
-
});
|
|
460
|
+
this.dialogRef = this.dialogManager.open(this.template());
|
|
462
461
|
this.dialogRef.closed.subscribe(focusOrigin => {
|
|
463
462
|
this.dialogRef = null;
|
|
464
463
|
// Focus the trigger element after the dialog closes.
|
|
@@ -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-token.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-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-overlay/dialog-overlay.ts","../../../../packages/ng-primitives/dialog/src/dialog-title/dialog-title-token.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-token.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 data?: T;\n}\n\nexport const defaultDialogConfig: NgpDialogConfig = {\n role: 'dialog',\n modal: true,\n closeOnNavigation: 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>('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(NgpDialogStateToken);\n\n/**\n * The Dialog state registration function.\n */\nexport const dialogState = createState(NgpDialogStateToken);\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogDescription } from './dialog-description';\n\nexport const NgpDialogDescriptionToken = new InjectionToken<NgpDialogDescription>(\n 'NgpDialogDescriptionToken',\n);\n\n/**\n * Inject the DialogDescription directive instance\n */\nexport function injectDialogDescription(): NgpDialogDescription {\n return inject(NgpDialogDescriptionToken);\n}\n","import { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialogState } from '../dialog/dialog-state';\nimport { NgpDialogDescriptionToken } from './dialog-description-token';\n\n@Directive({\n selector: '[ngpDialogDescription]',\n exportAs: 'ngpDialogDescription',\n providers: [{ provide: NgpDialogDescriptionToken, useExisting: 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> {\n /** Whether the user is allowed to close the dialog. */\n disableClose: boolean | undefined;\n\n /** Emits when the dialog has been closed. */\n readonly closed = new Subject<FocusOrigin | null>();\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\n this.keydownEvents.subscribe(event => {\n if (event.key === 'Escape' && !this.disableClose && !hasModifierKey(event)) {\n event.preventDefault();\n this.close('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(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 ?? null);\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>(): NgpDialogRef<T> {\n return inject<NgpDialogRef<T>>(NgpDialogRef);\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogOverlay } from './dialog-overlay';\n\nexport const NgpDialogOverlayToken = new InjectionToken<NgpDialogOverlay>('NgpDialogOverlayToken');\n\n/**\n * Inject the DialogOverlay directive instance\n */\nexport function injectDialogOverlay(): NgpDialogOverlay {\n return inject(NgpDialogOverlayToken);\n}\n","import { Directive, HostListener } from '@angular/core';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { injectDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogOverlayToken } from './dialog-overlay-token';\n\n@Directive({\n selector: '[ngpDialogOverlay]',\n exportAs: 'ngpDialogOverlay',\n providers: [{ provide: NgpDialogOverlayToken, useExisting: NgpDialogOverlay }],\n hostDirectives: [NgpExitAnimation],\n})\nexport class NgpDialogOverlay {\n /** Access the dialog ref. */\n private readonly dialogRef = injectDialogRef();\n\n @HostListener('click')\n protected close(): void {\n this.dialogRef.close();\n }\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogTitle } from './dialog-title';\n\nexport const NgpDialogTitleToken = new InjectionToken<NgpDialogTitle>('NgpDialogTitleToken');\n\n/**\n * Inject the DialogTitle directive instance\n */\nexport function injectDialogTitle(): NgpDialogTitle {\n return inject(NgpDialogTitleToken);\n}\n","import { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialogState } from '../dialog/dialog-state';\nimport { NgpDialogTitleToken } from './dialog-title-token';\n\n@Directive({\n selector: '[ngpDialogTitle]',\n exportAs: 'ngpDialogTitle',\n providers: [{ provide: NgpDialogTitleToken, useExisting: 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 { Overlay, OverlayConfig, OverlayContainer, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal, ComponentType, TemplatePortal } from '@angular/cdk/portal';\nimport {\n Injectable,\n Injector,\n OnDestroy,\n StaticProvider,\n TemplateRef,\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 overlay = inject(Overlay);\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(\n templateRefOrComponentType: TemplateRef<NgpDialogContext> | ComponentType<any>,\n config?: NgpDialogConfig,\n ): NgpDialogRef {\n const defaults = this.defaultOptions;\n config = { ...defaults, ...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(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 = {\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);\n dialogRef.closed.subscribe(() => this.removeOpenDialog(dialogRef, true));\n this.afterOpened.next(dialogRef);\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 });\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(\n config: NgpDialogConfig,\n dialogRef: NgpDialogRef,\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 {\n $implicit: NgpDialogRef;\n close: () => void;\n}\n\nexport function injectDialogManager(): NgpDialogManager {\n return inject(NgpDialogManager);\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogTrigger } from './dialog-trigger';\n\nexport const NgpDialogTriggerToken = new InjectionToken<NgpDialogTrigger>('NgpDialogTriggerToken');\n\n/**\n * Inject the DialogTrigger directive instance\n */\nexport function injectDialogTrigger(): NgpDialogTrigger {\n return inject(NgpDialogTriggerToken);\n}\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport {\n ApplicationRef,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\nimport { NgpDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogContext, NgpDialogManager } from '../dialog/dialog.service';\nimport { NgpDialogTriggerToken } from './dialog-trigger-token';\n\n@Directive({\n selector: '[ngpDialogTrigger]',\n exportAs: 'ngpDialogTrigger',\n providers: [{ provide: NgpDialogTriggerToken, useExisting: NgpDialogTrigger }],\n})\nexport class NgpDialogTrigger {\n /** Access the dialog manager. */\n private readonly dialogManager = inject(NgpDialogManager);\n\n /** Access the application ref. */\n private readonly applicationRef = inject(ApplicationRef);\n\n /** Access the focus monitor. */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /** Access the element ref. */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** The template to launch. */\n readonly template = input.required<TemplateRef<NgpDialogContext>>({\n alias: 'ngpDialogTrigger',\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 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 = this.applicationRef.components[0].injector.get(ViewContainerRef);\n\n this.dialogRef = this.dialogManager.open(this.template(), {\n viewContainerRef,\n });\n\n this.dialogRef.closed.subscribe(focusOrigin => {\n this.dialogRef = null;\n // Focus the trigger element after the dialog closes.\n this.focusMonitor.focusVia(this.elementRef.nativeElement, focusOrigin);\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> implements OnDestroy {\n private readonly config = injectDialogConfig();\n\n /** Access the dialog ref */\n private readonly dialogRef = injectDialogRef<T>();\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>(this);\n\n ngOnDestroy(): void {\n this.close();\n }\n\n /** Close the dialog. */\n close(): void {\n this.dialogRef.close();\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":";;;;;;;;;;;;;;;AAkCO,MAAM,mBAAmB,GAAoB;AAClD,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,iBAAiB,EAAE,IAAI;CACxB;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,mBA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A,WAAA,EAAA,cAAA,EAAA,iBAAA,EAAA,eAAA,EAAA,sBAAA,EAAA,0BAAA,EAAA,uBAAA,EAAA,2BAAA,EAAA,EAAA,EAAA,SAAA,EAAA,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;8BAyCW,OAAO,EAAA,CAAA;sBADhB,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-token.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-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-overlay/dialog-overlay.ts","../../../../packages/ng-primitives/dialog/src/dialog-title/dialog-title-token.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-token.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 data?: T;\n}\n\nexport const defaultDialogConfig: NgpDialogConfig = {\n role: 'dialog',\n modal: true,\n closeOnNavigation: 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>('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(NgpDialogStateToken);\n\n/**\n * The Dialog state registration function.\n */\nexport const dialogState = createState(NgpDialogStateToken);\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogDescription } from './dialog-description';\n\nexport const NgpDialogDescriptionToken = new InjectionToken<NgpDialogDescription>(\n 'NgpDialogDescriptionToken',\n);\n\n/**\n * Inject the DialogDescription directive instance\n */\nexport function injectDialogDescription(): NgpDialogDescription {\n return inject(NgpDialogDescriptionToken);\n}\n","import { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialogState } from '../dialog/dialog-state';\nimport { NgpDialogDescriptionToken } from './dialog-description-token';\n\n@Directive({\n selector: '[ngpDialogDescription]',\n exportAs: 'ngpDialogDescription',\n providers: [{ provide: NgpDialogDescriptionToken, useExisting: 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> {\n /** Whether the user is allowed to close the dialog. */\n disableClose: boolean | undefined;\n\n /** Emits when the dialog has been closed. */\n readonly closed = new Subject<FocusOrigin | null>();\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\n this.keydownEvents.subscribe(event => {\n if (event.key === 'Escape' && !this.disableClose && !hasModifierKey(event)) {\n event.preventDefault();\n this.close('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(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 ?? null);\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>(): NgpDialogRef<T> {\n return inject<NgpDialogRef<T>>(NgpDialogRef);\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogOverlay } from './dialog-overlay';\n\nexport const NgpDialogOverlayToken = new InjectionToken<NgpDialogOverlay>('NgpDialogOverlayToken');\n\n/**\n * Inject the DialogOverlay directive instance\n */\nexport function injectDialogOverlay(): NgpDialogOverlay {\n return inject(NgpDialogOverlayToken);\n}\n","import { Directive, HostListener } from '@angular/core';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { injectDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogOverlayToken } from './dialog-overlay-token';\n\n@Directive({\n selector: '[ngpDialogOverlay]',\n exportAs: 'ngpDialogOverlay',\n providers: [{ provide: NgpDialogOverlayToken, useExisting: NgpDialogOverlay }],\n hostDirectives: [NgpExitAnimation],\n})\nexport class NgpDialogOverlay {\n /** Access the dialog ref. */\n private readonly dialogRef = injectDialogRef();\n\n @HostListener('click')\n protected close(): void {\n this.dialogRef.close();\n }\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogTitle } from './dialog-title';\n\nexport const NgpDialogTitleToken = new InjectionToken<NgpDialogTitle>('NgpDialogTitleToken');\n\n/**\n * Inject the DialogTitle directive instance\n */\nexport function injectDialogTitle(): NgpDialogTitle {\n return inject(NgpDialogTitleToken);\n}\n","import { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialogState } from '../dialog/dialog-state';\nimport { NgpDialogTitleToken } from './dialog-title-token';\n\n@Directive({\n selector: '[ngpDialogTitle]',\n exportAs: 'ngpDialogTitle',\n providers: [{ provide: NgpDialogTitleToken, useExisting: 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 { Overlay, OverlayConfig, OverlayContainer, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal, ComponentType, TemplatePortal } from '@angular/cdk/portal';\nimport {\n ApplicationRef,\n Injectable,\n Injector,\n OnDestroy,\n StaticProvider,\n TemplateRef,\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 overlay = inject(Overlay);\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(\n templateRefOrComponentType: TemplateRef<NgpDialogContext> | ComponentType<any>,\n config?: NgpDialogConfig,\n ): NgpDialogRef {\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 = this.applicationRef.components[0].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(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 = {\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);\n dialogRef.closed.subscribe(() => this.removeOpenDialog(dialogRef, true));\n this.afterOpened.next(dialogRef);\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 });\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(\n config: NgpDialogConfig,\n dialogRef: NgpDialogRef,\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 {\n $implicit: NgpDialogRef;\n close: () => void;\n}\n\nexport function injectDialogManager(): NgpDialogManager {\n return inject(NgpDialogManager);\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogTrigger } from './dialog-trigger';\n\nexport const NgpDialogTriggerToken = new InjectionToken<NgpDialogTrigger>('NgpDialogTriggerToken');\n\n/**\n * Inject the DialogTrigger directive instance\n */\nexport function injectDialogTrigger(): NgpDialogTrigger {\n return inject(NgpDialogTriggerToken);\n}\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport {\n ApplicationRef,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n TemplateRef,\n} from '@angular/core';\nimport { NgpDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogContext, NgpDialogManager } from '../dialog/dialog.service';\nimport { NgpDialogTriggerToken } from './dialog-trigger-token';\n\n@Directive({\n selector: '[ngpDialogTrigger]',\n exportAs: 'ngpDialogTrigger',\n providers: [{ provide: NgpDialogTriggerToken, useExisting: NgpDialogTrigger }],\n})\nexport class NgpDialogTrigger {\n /** Access the dialog manager. */\n private readonly dialogManager = inject(NgpDialogManager);\n\n /** Access the application ref. */\n private readonly applicationRef = inject(ApplicationRef);\n\n /** Access the focus monitor. */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /** Access the element ref. */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** The template to launch. */\n readonly template = input.required<TemplateRef<NgpDialogContext>>({\n alias: 'ngpDialogTrigger',\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\n this.dialogRef.closed.subscribe(focusOrigin => {\n this.dialogRef = null;\n // Focus the trigger element after the dialog closes.\n this.focusMonitor.focusVia(this.elementRef.nativeElement, focusOrigin);\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> implements OnDestroy {\n private readonly config = injectDialogConfig();\n\n /** Access the dialog ref */\n private readonly dialogRef = injectDialogRef<T>();\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>(this);\n\n ngOnDestroy(): void {\n this.close();\n }\n\n /** Close the dialog. */\n close(): void {\n this.dialogRef.close();\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":";;;;;;;;;;;;;;;AAkCO,MAAM,mBAAmB,GAAoB;AAClD,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,iBAAiB,EAAE,IAAI;CACxB;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;;ACtDA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAC,mBAAmB;AAExE;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;MCvB9C,yBAAyB,GAAG,IAAI,cAAc,CACzD,2BAA2B;AAG7B;;AAEG;SACa,uBAA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AAA,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;8BAyCW,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;AC9DnC;;AAEG;;;;"}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import { coerceStringArray } from '@angular/cdk/coercion';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, ElementRef, input, booleanAttribute, output, signal, Directive, HostListener } from '@angular/core';
|
|
4
|
-
import
|
|
5
|
-
import { NgpHover, NgpFocusVisible, NgpPress } from 'ng-primitives/interactions';
|
|
4
|
+
import { setupHover, setupInteractions, explicitEffect } from 'ng-primitives/internal';
|
|
6
5
|
import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
|
-
* The state token for the
|
|
8
|
+
* The state token for the FileDropzone primitive.
|
|
10
9
|
*/
|
|
11
|
-
const
|
|
10
|
+
const NgpFileDropzoneStateToken = createStateToken('FileDropzone');
|
|
12
11
|
/**
|
|
13
|
-
* Provides the
|
|
12
|
+
* Provides the FileDropzone state.
|
|
14
13
|
*/
|
|
15
|
-
const
|
|
14
|
+
const provideFileDropzoneState = createStateProvider(NgpFileDropzoneStateToken);
|
|
16
15
|
/**
|
|
17
|
-
* Injects the
|
|
16
|
+
* Injects the FileDropzone state.
|
|
18
17
|
*/
|
|
19
|
-
const
|
|
18
|
+
const injectFileDropzoneState = createStateInjector(NgpFileDropzoneStateToken);
|
|
20
19
|
/**
|
|
21
|
-
* The
|
|
20
|
+
* The FileDropzone state registration function.
|
|
22
21
|
*/
|
|
23
|
-
const
|
|
22
|
+
const fileDropzoneState = createState(NgpFileDropzoneStateToken);
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
|
-
*
|
|
25
|
+
* Capture files dropped on the element.
|
|
27
26
|
*/
|
|
28
|
-
class
|
|
27
|
+
class NgpFileDropzone {
|
|
29
28
|
constructor() {
|
|
30
29
|
/**
|
|
31
30
|
* Access the host element.
|
|
@@ -35,85 +34,54 @@ class NgpFileUpload {
|
|
|
35
34
|
* The accepted file types.
|
|
36
35
|
*/
|
|
37
36
|
this.fileTypes = input(undefined, {
|
|
38
|
-
alias: '
|
|
37
|
+
alias: 'ngpFileDropzoneFileTypes',
|
|
39
38
|
transform: coerceStringArray,
|
|
40
39
|
});
|
|
41
40
|
/**
|
|
42
41
|
* Whether to allow multiple files to be selected.
|
|
43
42
|
*/
|
|
44
43
|
this.multiple = input(false, {
|
|
45
|
-
alias: '
|
|
44
|
+
alias: 'ngpFileDropzoneMultiple',
|
|
46
45
|
transform: booleanAttribute,
|
|
47
46
|
});
|
|
48
47
|
/**
|
|
49
48
|
* Whether to allow the user to select directories.
|
|
50
49
|
*/
|
|
51
50
|
this.directory = input(false, {
|
|
52
|
-
alias: '
|
|
53
|
-
transform: booleanAttribute,
|
|
54
|
-
});
|
|
55
|
-
/**
|
|
56
|
-
* Whether drag-and-drop is enabled.
|
|
57
|
-
*/
|
|
58
|
-
this.dragAndDrop = input(true, {
|
|
59
|
-
alias: 'ngpFileUploadDragDrop',
|
|
51
|
+
alias: 'ngpFileDropzoneDirectory',
|
|
60
52
|
transform: booleanAttribute,
|
|
61
53
|
});
|
|
62
54
|
/**
|
|
63
55
|
* Whether the file upload is disabled.
|
|
64
56
|
*/
|
|
65
57
|
this.disabled = input(false, {
|
|
66
|
-
alias: '
|
|
58
|
+
alias: 'ngpFileDropzoneDisabled',
|
|
67
59
|
transform: booleanAttribute,
|
|
68
60
|
});
|
|
69
61
|
/**
|
|
70
62
|
* Emits when the user selects files.
|
|
71
63
|
*/
|
|
72
64
|
this.selected = output({
|
|
73
|
-
alias: '
|
|
74
|
-
});
|
|
75
|
-
/**
|
|
76
|
-
* Emits when the user selects files.
|
|
77
|
-
*/
|
|
78
|
-
this.canceled = output({
|
|
79
|
-
alias: 'ngpFileUploadCanceled',
|
|
65
|
+
alias: 'ngpFileDropzoneSelected',
|
|
80
66
|
});
|
|
81
67
|
/**
|
|
82
68
|
* Emits when the user drags a file over the file upload.
|
|
83
69
|
*/
|
|
84
70
|
this.dragOver = output({
|
|
85
|
-
alias: '
|
|
71
|
+
alias: 'ngpFileDropzoneDragOver',
|
|
86
72
|
});
|
|
87
73
|
/**
|
|
88
74
|
* Whether the user is currently dragging a file over the file upload.
|
|
89
75
|
*/
|
|
90
76
|
this.isDragOver = signal(false);
|
|
91
|
-
/**
|
|
92
|
-
* Store the file input element.
|
|
93
|
-
*/
|
|
94
|
-
this.input = document.createElement('input');
|
|
95
77
|
/**
|
|
96
78
|
* The file upload state.
|
|
97
79
|
*/
|
|
98
|
-
this.state =
|
|
99
|
-
this.
|
|
100
|
-
this.input.addEventListener('change', () => this.selected.emit(this.input.files));
|
|
101
|
-
this.input.addEventListener('cancel', () => this.canceled.emit());
|
|
102
|
-
}
|
|
103
|
-
showFileDialog() {
|
|
104
|
-
if (this.state.disabled()) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const fileTypes = this.state.fileTypes()?.join(',');
|
|
108
|
-
if (fileTypes) {
|
|
109
|
-
this.input.accept = fileTypes;
|
|
110
|
-
}
|
|
111
|
-
this.input.multiple = this.state.multiple();
|
|
112
|
-
this.input.webkitdirectory = this.state.directory();
|
|
113
|
-
this.input.click();
|
|
80
|
+
this.state = fileDropzoneState(this);
|
|
81
|
+
setupHover({ disabled: this.state.disabled });
|
|
114
82
|
}
|
|
115
83
|
onDragEnter(event) {
|
|
116
|
-
if (this.state.disabled()
|
|
84
|
+
if (this.state.disabled()) {
|
|
117
85
|
return;
|
|
118
86
|
}
|
|
119
87
|
event.preventDefault();
|
|
@@ -122,7 +90,7 @@ class NgpFileUpload {
|
|
|
122
90
|
this.dragOver.emit(true);
|
|
123
91
|
}
|
|
124
92
|
onDragOver(event) {
|
|
125
|
-
if (this.state.disabled()
|
|
93
|
+
if (this.state.disabled()) {
|
|
126
94
|
return;
|
|
127
95
|
}
|
|
128
96
|
event.stopPropagation();
|
|
@@ -130,7 +98,7 @@ class NgpFileUpload {
|
|
|
130
98
|
this.isDragOver.set(true);
|
|
131
99
|
}
|
|
132
100
|
onDragLeave(event) {
|
|
133
|
-
if (this.state.disabled() || !this.
|
|
101
|
+
if (this.state.disabled() || !this.isDragOver()) {
|
|
134
102
|
return;
|
|
135
103
|
}
|
|
136
104
|
// if the element we are dragging over is a child of the file upload, ignore the event
|
|
@@ -143,7 +111,7 @@ class NgpFileUpload {
|
|
|
143
111
|
this.dragOver.emit(false);
|
|
144
112
|
}
|
|
145
113
|
onDrop(event) {
|
|
146
|
-
if (this.state.disabled()
|
|
114
|
+
if (this.state.disabled()) {
|
|
147
115
|
return;
|
|
148
116
|
}
|
|
149
117
|
event.preventDefault();
|
|
@@ -153,25 +121,21 @@ class NgpFileUpload {
|
|
|
153
121
|
this.selected.emit(event.dataTransfer.files);
|
|
154
122
|
}
|
|
155
123
|
}
|
|
156
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type:
|
|
157
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type:
|
|
124
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpFileDropzone, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
125
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpFileDropzone, isStandalone: true, selector: "[ngpFileDropzone]", inputs: { fileTypes: { classPropertyName: "fileTypes", publicName: "ngpFileDropzoneFileTypes", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "ngpFileDropzoneMultiple", isSignal: true, isRequired: false, transformFunction: null }, directory: { classPropertyName: "directory", publicName: "ngpFileDropzoneDirectory", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFileDropzoneDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "ngpFileDropzoneSelected", dragOver: "ngpFileDropzoneDragOver" }, host: { listeners: { "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "attr.data-dragover": "isDragOver() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null" } }, providers: [provideFileDropzoneState()], exportAs: ["ngpFileDropzone"], ngImport: i0 }); }
|
|
158
126
|
}
|
|
159
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type:
|
|
127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpFileDropzone, decorators: [{
|
|
160
128
|
type: Directive,
|
|
161
129
|
args: [{
|
|
162
|
-
selector: '[
|
|
163
|
-
exportAs: '
|
|
164
|
-
providers: [
|
|
130
|
+
selector: '[ngpFileDropzone]',
|
|
131
|
+
exportAs: 'ngpFileDropzone',
|
|
132
|
+
providers: [provideFileDropzoneState()],
|
|
165
133
|
host: {
|
|
166
|
-
'[attr.data-disabled]': 'state.disabled() ? "" : null',
|
|
167
134
|
'[attr.data-dragover]': 'isDragOver() ? "" : null',
|
|
135
|
+
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
168
136
|
},
|
|
169
|
-
hostDirectives: [NgpHover, NgpFocusVisible, NgpPress],
|
|
170
137
|
}]
|
|
171
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
172
|
-
type: HostListener,
|
|
173
|
-
args: ['click']
|
|
174
|
-
}], onDragEnter: [{
|
|
138
|
+
}], ctorParameters: () => [], propDecorators: { onDragEnter: [{
|
|
175
139
|
type: HostListener,
|
|
176
140
|
args: ['dragenter', ['$event']]
|
|
177
141
|
}], onDragOver: [{
|
|
@@ -185,9 +149,145 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
|
|
|
185
149
|
args: ['drop', ['$event']]
|
|
186
150
|
}] } });
|
|
187
151
|
|
|
152
|
+
/**
|
|
153
|
+
* The state token for the FileUpload primitive.
|
|
154
|
+
*/
|
|
155
|
+
const NgpFileUploadStateToken = createStateToken('FileUpload');
|
|
156
|
+
/**
|
|
157
|
+
* Provides the FileUpload state.
|
|
158
|
+
*/
|
|
159
|
+
const provideFileUploadState = createStateProvider(NgpFileUploadStateToken);
|
|
160
|
+
/**
|
|
161
|
+
* Injects the FileUpload state.
|
|
162
|
+
*/
|
|
163
|
+
const injectFileUploadState = createStateInjector(NgpFileUploadStateToken);
|
|
164
|
+
/**
|
|
165
|
+
* The FileUpload state registration function.
|
|
166
|
+
*/
|
|
167
|
+
const fileUploadState = createState(NgpFileUploadStateToken);
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* A directive that allows you to turn any element into a file upload trigger.
|
|
171
|
+
*/
|
|
172
|
+
class NgpFileUpload {
|
|
173
|
+
constructor() {
|
|
174
|
+
/**
|
|
175
|
+
* Access the dropzone state.
|
|
176
|
+
*/
|
|
177
|
+
this.dropzone = injectFileDropzoneState();
|
|
178
|
+
/**
|
|
179
|
+
* The accepted file types.
|
|
180
|
+
*/
|
|
181
|
+
this.fileTypes = input(undefined, {
|
|
182
|
+
alias: 'ngpFileUploadFileTypes',
|
|
183
|
+
transform: coerceStringArray,
|
|
184
|
+
});
|
|
185
|
+
/**
|
|
186
|
+
* Whether to allow multiple files to be selected.
|
|
187
|
+
*/
|
|
188
|
+
this.multiple = input(false, {
|
|
189
|
+
alias: 'ngpFileUploadMultiple',
|
|
190
|
+
transform: booleanAttribute,
|
|
191
|
+
});
|
|
192
|
+
/**
|
|
193
|
+
* Whether to allow the user to select directories.
|
|
194
|
+
*/
|
|
195
|
+
this.directory = input(false, {
|
|
196
|
+
alias: 'ngpFileUploadDirectory',
|
|
197
|
+
transform: booleanAttribute,
|
|
198
|
+
});
|
|
199
|
+
/**
|
|
200
|
+
* Whether drag-and-drop is enabled.
|
|
201
|
+
*/
|
|
202
|
+
this.dragAndDrop = input(true, {
|
|
203
|
+
alias: 'ngpFileUploadDragDrop',
|
|
204
|
+
transform: booleanAttribute,
|
|
205
|
+
});
|
|
206
|
+
/**
|
|
207
|
+
* Whether the file upload is disabled.
|
|
208
|
+
*/
|
|
209
|
+
this.disabled = input(false, {
|
|
210
|
+
alias: 'ngpFileUploadDisabled',
|
|
211
|
+
transform: booleanAttribute,
|
|
212
|
+
});
|
|
213
|
+
/**
|
|
214
|
+
* Emits when the user selects files.
|
|
215
|
+
*/
|
|
216
|
+
this.selected = output({
|
|
217
|
+
alias: 'ngpFileUploadSelected',
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* Emits when the user cancels the file upload.
|
|
221
|
+
* This is emitted when the user clicks the cancel button in the file upload dialog.
|
|
222
|
+
*/
|
|
223
|
+
this.canceled = output({
|
|
224
|
+
alias: 'ngpFileUploadCanceled',
|
|
225
|
+
});
|
|
226
|
+
/**
|
|
227
|
+
* Store the file input element.
|
|
228
|
+
*/
|
|
229
|
+
this.input = document.createElement('input');
|
|
230
|
+
/**
|
|
231
|
+
* The file upload state.
|
|
232
|
+
*/
|
|
233
|
+
this.state = fileUploadState(this);
|
|
234
|
+
this.input.type = 'file';
|
|
235
|
+
this.input.addEventListener('change', () => this.selected.emit(this.input.files));
|
|
236
|
+
this.input.addEventListener('cancel', () => this.canceled.emit());
|
|
237
|
+
setupInteractions({ disabled: this.state.disabled });
|
|
238
|
+
// sync the disabled and dragAndDrop state with the dropzone
|
|
239
|
+
explicitEffect([this.state.disabled, this.state.dragAndDrop], ([disabled, dragAndDrop]) => {
|
|
240
|
+
this.dropzone().disabled.set(disabled || !dragAndDrop);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
showFileDialog() {
|
|
244
|
+
if (this.state.disabled()) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const fileTypes = this.state.fileTypes()?.join(',');
|
|
248
|
+
if (fileTypes) {
|
|
249
|
+
this.input.accept = fileTypes;
|
|
250
|
+
}
|
|
251
|
+
this.input.multiple = this.state.multiple();
|
|
252
|
+
this.input.webkitdirectory = this.state.directory();
|
|
253
|
+
this.input.click();
|
|
254
|
+
}
|
|
255
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpFileUpload, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
256
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpFileUpload, isStandalone: true, selector: "[ngpFileUpload]", inputs: { fileTypes: { classPropertyName: "fileTypes", publicName: "ngpFileUploadFileTypes", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "ngpFileUploadMultiple", isSignal: true, isRequired: false, transformFunction: null }, directory: { classPropertyName: "directory", publicName: "ngpFileUploadDirectory", isSignal: true, isRequired: false, transformFunction: null }, dragAndDrop: { classPropertyName: "dragAndDrop", publicName: "ngpFileUploadDragDrop", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFileUploadDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "ngpFileUploadSelected", canceled: "ngpFileUploadCanceled" }, host: { listeners: { "click": "showFileDialog()" }, properties: { "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideFileUploadState()], exportAs: ["ngpFileUpload"], hostDirectives: [{ directive: NgpFileDropzone, inputs: ["ngpFileDropzoneFileTypes", "ngpFileUploadFileTypes", "ngpFileDropzoneMultiple", "ngpFileUploadMultiple", "ngpFileDropzoneDirectory", "ngpFileUploadDirectory", "ngpFileDropzoneDisabled", "ngpFileUploadDisabled"], outputs: ["ngpFileDropzoneSelected", "ngpFileUploadSelected", "ngpFileDropzoneDragOver", "ngpFileUploadDragOver"] }], ngImport: i0 }); }
|
|
257
|
+
}
|
|
258
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpFileUpload, decorators: [{
|
|
259
|
+
type: Directive,
|
|
260
|
+
args: [{
|
|
261
|
+
selector: '[ngpFileUpload]',
|
|
262
|
+
exportAs: 'ngpFileUpload',
|
|
263
|
+
providers: [provideFileUploadState()],
|
|
264
|
+
host: {
|
|
265
|
+
'[attr.data-disabled]': 'state.disabled() ? "" : null',
|
|
266
|
+
},
|
|
267
|
+
hostDirectives: [
|
|
268
|
+
{
|
|
269
|
+
directive: NgpFileDropzone,
|
|
270
|
+
inputs: [
|
|
271
|
+
'ngpFileDropzoneFileTypes:ngpFileUploadFileTypes',
|
|
272
|
+
'ngpFileDropzoneMultiple:ngpFileUploadMultiple',
|
|
273
|
+
'ngpFileDropzoneDirectory:ngpFileUploadDirectory',
|
|
274
|
+
'ngpFileDropzoneDisabled:ngpFileUploadDisabled',
|
|
275
|
+
],
|
|
276
|
+
outputs: [
|
|
277
|
+
'ngpFileDropzoneSelected:ngpFileUploadSelected',
|
|
278
|
+
'ngpFileDropzoneDragOver:ngpFileUploadDragOver',
|
|
279
|
+
],
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
}]
|
|
283
|
+
}], ctorParameters: () => [], propDecorators: { showFileDialog: [{
|
|
284
|
+
type: HostListener,
|
|
285
|
+
args: ['click']
|
|
286
|
+
}] } });
|
|
287
|
+
|
|
188
288
|
/**
|
|
189
289
|
* Generated bundle index. Do not edit.
|
|
190
290
|
*/
|
|
191
291
|
|
|
192
|
-
export { NgpFileUpload, injectFileUploadState, provideFileUploadState };
|
|
292
|
+
export { NgpFileDropzone, NgpFileUpload, injectFileDropzoneState, injectFileUploadState, provideFileDropzoneState, provideFileUploadState };
|
|
193
293
|
//# 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-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":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFileUpload } from './file-upload';\n\n/**\n * The state token for the FileUpload primitive.\n */\nexport const NgpFileUploadStateToken = createStateToken<NgpFileUpload>('FileUpload');\n\n/**\n * Provides the FileUpload state.\n */\nexport const provideFileUploadState = createStateProvider(NgpFileUploadStateToken);\n\n/**\n * Injects the FileUpload state.\n */\nexport const injectFileUploadState = createStateInjector(NgpFileUploadStateToken);\n\n/**\n * The FileUpload state registration function.\n */\nexport const fileUploadState = createState(NgpFileUploadStateToken);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { NgpFocusVisible, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { fileUploadState, 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 host: {\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '[attr.data-dragover]': 'isDragOver() ? \"\" : null',\n },\n hostDirectives: [NgpHover, NgpFocusVisible, NgpPress],\n})\nexport class NgpFileUpload {\n /**\n * Access the host element.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The accepted file types.\n */\n readonly fileTypes = input<string[] | undefined, string>(undefined, {\n alias: 'ngpFileUploadFileTypes',\n transform: coerceStringArray,\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 selects files.\n */\n readonly canceled = output<void>({\n alias: 'ngpFileUploadCanceled',\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 /**\n * Whether the user is currently dragging a file over the file upload.\n */\n protected readonly isDragOver = signal<boolean>(false);\n\n /**\n * Store the file input element.\n */\n private input: HTMLInputElement = document.createElement('input');\n\n /**\n * The file upload state.\n */\n protected readonly state = fileUploadState<NgpFileUpload>(this);\n\n constructor() {\n this.input.type = 'file';\n this.input.addEventListener('change', () => this.selected.emit(this.input.files));\n this.input.addEventListener('cancel', () => this.canceled.emit());\n }\n\n @HostListener('click')\n protected showFileDialog(): void {\n if (this.state.disabled()) {\n return;\n }\n\n const fileTypes = this.state.fileTypes()?.join(',');\n\n if (fileTypes) {\n this.input.accept = fileTypes;\n }\n\n this.input.multiple = this.state.multiple();\n this.input.webkitdirectory = this.state.directory();\n this.input.click();\n }\n\n @HostListener('dragenter', ['$event'])\n protected onDragEnter(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(true);\n this.dragOver.emit(true);\n }\n\n @HostListener('dragover', ['$event'])\n protected onDragOver(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n this.isDragOver.set(true);\n }\n\n @HostListener('dragleave', ['$event'])\n protected onDragLeave(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop() || !this.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 (this.elementRef.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n }\n\n @HostListener('drop', ['$event'])\n protected onDrop(event: DragEvent): void {\n if (this.state.disabled() || !this.state.dragAndDrop()) {\n return;\n }\n\n event.preventDefault();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n\n if (event.dataTransfer?.files) {\n this.selected.emit(event.dataTransfer.files);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,uBAAuB,GAAG,gBAAgB,CAAgB,YAAY,CAAC;AAEpF;;AAEG;MACU,sBAAsB,GAAG,mBAAmB,CAAC,uBAAuB;AAEjF;;AAE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a3B,UAAU,EAAA,CAAA;sBADnB,YAAY;uBAAC,UAAU,EAAE,CAAC,QAAQ,CAAC;gBAY1B,WAAW,EAAA,CAAA;sBADpB,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;gBAkB3B,MAAM,EAAA,CAAA;sBADf,YAAY;uBAAC,MAAM,EAAE,CAAC,QAAQ,CAAC;;;AC5KlC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-file-upload.mjs","sources":["../../../../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":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFileDropzone } from './file-dropzone';\n\n/**\n * The state token for the FileDropzone primitive.\n */\nexport const NgpFileDropzoneStateToken = createStateToken<NgpFileDropzone>('FileDropzone');\n\n/**\n * Provides the FileDropzone state.\n */\nexport const provideFileDropzoneState = createStateProvider(NgpFileDropzoneStateToken);\n\n/**\n * Injects the FileDropzone state.\n */\nexport const injectFileDropzoneState = createStateInjector(NgpFileDropzoneStateToken);\n\n/**\n * The FileDropzone state registration function.\n */\nexport const fileDropzoneState = createState(NgpFileDropzoneStateToken);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { setupHover } from 'ng-primitives/internal';\nimport { fileDropzoneState, 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 host: {\n '[attr.data-dragover]': 'isDragOver() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n },\n})\nexport class NgpFileDropzone {\n /**\n * Access the host element.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The accepted file types.\n */\n readonly fileTypes = input<string[] | undefined, string>(undefined, {\n alias: 'ngpFileDropzoneFileTypes',\n transform: coerceStringArray,\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 the user drags a file over the file upload.\n */\n readonly dragOver = output<boolean>({\n alias: 'ngpFileDropzoneDragOver',\n });\n\n /**\n * Whether the user is currently dragging a file over the file upload.\n */\n protected readonly isDragOver = signal<boolean>(false);\n\n /**\n * The file upload state.\n */\n private readonly state = fileDropzoneState<NgpFileDropzone>(this);\n\n constructor() {\n setupHover({ disabled: this.state.disabled });\n }\n\n @HostListener('dragenter', ['$event'])\n protected onDragEnter(event: DragEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(true);\n this.dragOver.emit(true);\n }\n\n @HostListener('dragover', ['$event'])\n protected onDragOver(event: DragEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n this.isDragOver.set(true);\n }\n\n @HostListener('dragleave', ['$event'])\n protected onDragLeave(event: DragEvent): void {\n if (this.state.disabled() || !this.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 (this.elementRef.nativeElement.contains(event.relatedTarget as Node)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n }\n\n @HostListener('drop', ['$event'])\n protected onDrop(event: DragEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n event.preventDefault();\n this.isDragOver.set(false);\n this.dragOver.emit(false);\n\n if (event.dataTransfer?.files) {\n this.selected.emit(event.dataTransfer.files);\n }\n }\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFileUpload } from './file-upload';\n\n/**\n * The state token for the FileUpload primitive.\n */\nexport const NgpFileUploadStateToken = createStateToken<NgpFileUpload>('FileUpload');\n\n/**\n * Provides the FileUpload state.\n */\nexport const provideFileUploadState = createStateProvider(NgpFileUploadStateToken);\n\n/**\n * Injects the FileUpload state.\n */\nexport const injectFileUploadState = createStateInjector(NgpFileUploadStateToken);\n\n/**\n * The FileUpload state registration function.\n */\nexport const fileUploadState = createState(NgpFileUploadStateToken);\n","import { BooleanInput, coerceStringArray } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, HostListener, input, output } from '@angular/core';\nimport { explicitEffect, setupInteractions } from 'ng-primitives/internal';\nimport { NgpFileDropzone } from '../file-dropzone/file-dropzone';\nimport { injectFileDropzoneState } from '../file-dropzone/file-dropzone-state';\nimport { fileUploadState, 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 host: {\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n hostDirectives: [\n {\n directive: NgpFileDropzone,\n inputs: [\n 'ngpFileDropzoneFileTypes:ngpFileUploadFileTypes',\n 'ngpFileDropzoneMultiple:ngpFileUploadMultiple',\n 'ngpFileDropzoneDirectory:ngpFileUploadDirectory',\n 'ngpFileDropzoneDisabled:ngpFileUploadDisabled',\n ],\n outputs: [\n 'ngpFileDropzoneSelected:ngpFileUploadSelected',\n 'ngpFileDropzoneDragOver:ngpFileUploadDragOver',\n ],\n },\n ],\n})\nexport class NgpFileUpload {\n /**\n * Access the dropzone state.\n */\n private readonly dropzone = injectFileDropzoneState();\n\n /**\n * The accepted file types.\n */\n readonly fileTypes = input<string[] | undefined, string>(undefined, {\n alias: 'ngpFileUploadFileTypes',\n transform: coerceStringArray,\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 cancels the file upload.\n * This is emitted when the user clicks the cancel button in the file upload dialog.\n */\n readonly canceled = output<void>({\n alias: 'ngpFileUploadCanceled',\n });\n\n /**\n * Store the file input element.\n */\n private input: HTMLInputElement = document.createElement('input');\n\n /**\n * The file upload state.\n */\n protected readonly state = fileUploadState<NgpFileUpload>(this);\n\n constructor() {\n this.input.type = 'file';\n this.input.addEventListener('change', () => this.selected.emit(this.input.files));\n this.input.addEventListener('cancel', () => this.canceled.emit());\n\n setupInteractions({ disabled: this.state.disabled });\n\n // sync the disabled and dragAndDrop state with the dropzone\n explicitEffect([this.state.disabled, this.state.dragAndDrop], ([disabled, dragAndDrop]) => {\n this.dropzone().disabled.set(disabled || !dragAndDrop);\n });\n }\n\n @HostListener('click')\n protected showFileDialog(): void {\n if (this.state.disabled()) {\n return;\n }\n\n const fileTypes = this.state.fileTypes()?.join(',');\n\n if (fileTypes) {\n this.input.accept = fileTypes;\n }\n\n this.input.multiple = this.state.multiple();\n this.input.webkitdirectory = this.state.directory();\n this.input.click();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.NgpFileDropzone"],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,yBAAyB,GAAG,gBAAgB,CAAkB,cAAc,CAAC;AAE1F;;AAEG;MACU,wBAAwB,GAAG,mBAAmB,CAAC,yBAAyB;AAErF;;AAEG;MACU,uBAAuB,GAAG,mBAAmB,CAAC,yBAAyB;AAEpF;;AAEG;AACI,MAAM,iBAAiB,GAAG,WAAW,CAAC,yBAAyB,CAAC;;ACZvE;;AAEG;MAUU,eAAe,CAAA;AA8D1B,IAAA,WAAA,GAAA;AA7DA;;AAEG;AACc,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAA0B,UAAU,CAAC;AAEzE;;AAEG;AACM,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAA+B,SAAS,EAAE;AAClE,YAAA,KAAK,EAAE,0BAA0B;AACjC,YAAA,SAAS,EAAE,iBAAiB;AAC7B,SAAA,CAAC;AAEF;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AACtD,YAAA,KAAK,EAAE,yBAAyB;AAChC,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;AACM,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAwB,KAAK,EAAE;AACvD,YAAA,KAAK,EAAE,0BAA0B;AACjC,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;AACM,QAAA,IA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D;gCACjD,+CAA+C;gCAC/C,iDAAiD;gCACjD,+CAA+C;AAChD,6BAAA;AACD,4BAAA,OAAO,EAAE;gCACP,+CAA+C;gCAC/C,+CAA+C;AAChD,6BAAA;AACF,yBAAA;AACF,qBAAA;AACF,iBAAA;wDAsFW,cAAc,EAAA,CAAA;sBADvB,YAAY;uBAAC,OAAO;;;ACrHvB;;AAEG;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { NgpFileDropzone } from './file-dropzone';
|
|
2
|
+
/**
|
|
3
|
+
* The state token for the FileDropzone primitive.
|
|
4
|
+
*/
|
|
5
|
+
export declare const NgpFileDropzoneStateToken: import("@angular/core").InjectionToken<NgpFileDropzone>;
|
|
6
|
+
/**
|
|
7
|
+
* Provides the FileDropzone state.
|
|
8
|
+
*/
|
|
9
|
+
export declare const provideFileDropzoneState: () => import("@angular/core").FactoryProvider;
|
|
10
|
+
/**
|
|
11
|
+
* Injects the FileDropzone state.
|
|
12
|
+
*/
|
|
13
|
+
export declare const injectFileDropzoneState: <U = {
|
|
14
|
+
readonly elementRef: import("@angular/core").ElementRef<HTMLElement>;
|
|
15
|
+
readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string>;
|
|
16
|
+
readonly multiple: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
17
|
+
readonly directory: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
18
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
19
|
+
readonly selected: import("@angular/core").OutputEmitterRef<FileList | null>;
|
|
20
|
+
readonly dragOver: import("@angular/core").OutputEmitterRef<boolean>;
|
|
21
|
+
readonly isDragOver: import("@angular/core").WritableSignal<boolean>;
|
|
22
|
+
readonly state: import("ng-primitives/state").CreatedState<NgpFileDropzone>;
|
|
23
|
+
onDragEnter: (event: DragEvent) => void;
|
|
24
|
+
onDragOver: (event: DragEvent) => void;
|
|
25
|
+
onDragLeave: (event: DragEvent) => void;
|
|
26
|
+
onDrop: (event: DragEvent) => void;
|
|
27
|
+
}>() => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
28
|
+
/**
|
|
29
|
+
* The FileDropzone state registration function.
|
|
30
|
+
*/
|
|
31
|
+
export declare const fileDropzoneState: <U>(state: U) => import("ng-primitives/state").CreatedState<U>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { BooleanInput } from '@angular/cdk/coercion';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Capture files dropped on the element.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NgpFileDropzone {
|
|
7
|
+
/**
|
|
8
|
+
* Access the host element.
|
|
9
|
+
*/
|
|
10
|
+
private readonly elementRef;
|
|
11
|
+
/**
|
|
12
|
+
* The accepted file types.
|
|
13
|
+
*/
|
|
14
|
+
readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Whether to allow multiple files to be selected.
|
|
17
|
+
*/
|
|
18
|
+
readonly multiple: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to allow the user to select directories.
|
|
21
|
+
*/
|
|
22
|
+
readonly directory: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the file upload is disabled.
|
|
25
|
+
*/
|
|
26
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
27
|
+
/**
|
|
28
|
+
* Emits when the user selects files.
|
|
29
|
+
*/
|
|
30
|
+
readonly selected: import("@angular/core").OutputEmitterRef<FileList | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Emits when the user drags a file over the file upload.
|
|
33
|
+
*/
|
|
34
|
+
readonly dragOver: import("@angular/core").OutputEmitterRef<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the user is currently dragging a file over the file upload.
|
|
37
|
+
*/
|
|
38
|
+
protected readonly isDragOver: import("@angular/core").WritableSignal<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* The file upload state.
|
|
41
|
+
*/
|
|
42
|
+
private readonly state;
|
|
43
|
+
constructor();
|
|
44
|
+
protected onDragEnter(event: DragEvent): void;
|
|
45
|
+
protected onDragOver(event: DragEvent): void;
|
|
46
|
+
protected onDragLeave(event: DragEvent): void;
|
|
47
|
+
protected onDrop(event: DragEvent): void;
|
|
48
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgpFileDropzone, never>;
|
|
49
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpFileDropzone, "[ngpFileDropzone]", ["ngpFileDropzone"], { "fileTypes": { "alias": "ngpFileDropzoneFileTypes"; "required": false; "isSignal": true; }; "multiple": { "alias": "ngpFileDropzoneMultiple"; "required": false; "isSignal": true; }; "directory": { "alias": "ngpFileDropzoneDirectory"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpFileDropzoneDisabled"; "required": false; "isSignal": true; }; }, { "selected": "ngpFileDropzoneSelected"; "dragOver": "ngpFileDropzoneDragOver"; }, never, never, true, never>;
|
|
50
|
+
}
|
|
@@ -11,7 +11,21 @@ export declare const provideFileUploadState: () => import("@angular/core").Facto
|
|
|
11
11
|
* Injects the FileUpload state.
|
|
12
12
|
*/
|
|
13
13
|
export declare const injectFileUploadState: <U = {
|
|
14
|
-
readonly
|
|
14
|
+
readonly dropzone: import("@angular/core").Signal<import("ng-primitives/state").State<{
|
|
15
|
+
readonly elementRef: any;
|
|
16
|
+
readonly fileTypes: any;
|
|
17
|
+
readonly multiple: any;
|
|
18
|
+
readonly directory: any;
|
|
19
|
+
readonly disabled: any;
|
|
20
|
+
readonly selected: any;
|
|
21
|
+
readonly dragOver: any;
|
|
22
|
+
readonly isDragOver: any;
|
|
23
|
+
readonly state: any;
|
|
24
|
+
onDragEnter: any;
|
|
25
|
+
onDragOver: any;
|
|
26
|
+
onDragLeave: any;
|
|
27
|
+
onDrop: any;
|
|
28
|
+
}>>;
|
|
15
29
|
readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string>;
|
|
16
30
|
readonly multiple: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
17
31
|
readonly directory: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
@@ -19,15 +33,9 @@ export declare const injectFileUploadState: <U = {
|
|
|
19
33
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
20
34
|
readonly selected: import("@angular/core").OutputEmitterRef<FileList | null>;
|
|
21
35
|
readonly canceled: import("@angular/core").OutputEmitterRef<void>;
|
|
22
|
-
readonly dragOver: import("@angular/core").OutputEmitterRef<boolean>;
|
|
23
|
-
readonly isDragOver: import("@angular/core").WritableSignal<boolean>;
|
|
24
36
|
input: HTMLInputElement;
|
|
25
37
|
readonly state: import("ng-primitives/state").CreatedState<NgpFileUpload>;
|
|
26
38
|
showFileDialog: () => void;
|
|
27
|
-
onDragEnter: (event: DragEvent) => void;
|
|
28
|
-
onDragOver: (event: DragEvent) => void;
|
|
29
|
-
onDragLeave: (event: DragEvent) => void;
|
|
30
|
-
onDrop: (event: DragEvent) => void;
|
|
31
39
|
}>() => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
32
40
|
/**
|
|
33
41
|
* The FileUpload state registration function.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { BooleanInput } from '@angular/cdk/coercion';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
-
import * as i1 from "
|
|
3
|
+
import * as i1 from "../file-dropzone/file-dropzone";
|
|
4
4
|
/**
|
|
5
5
|
* A directive that allows you to turn any element into a file upload trigger.
|
|
6
6
|
*/
|
|
7
7
|
export declare class NgpFileUpload {
|
|
8
8
|
/**
|
|
9
|
-
* Access the
|
|
9
|
+
* Access the dropzone state.
|
|
10
10
|
*/
|
|
11
|
-
private readonly
|
|
11
|
+
private readonly dropzone;
|
|
12
12
|
/**
|
|
13
13
|
* The accepted file types.
|
|
14
14
|
*/
|
|
@@ -34,17 +34,10 @@ export declare class NgpFileUpload {
|
|
|
34
34
|
*/
|
|
35
35
|
readonly selected: import("@angular/core").OutputEmitterRef<FileList | null>;
|
|
36
36
|
/**
|
|
37
|
-
* Emits when the user
|
|
37
|
+
* Emits when the user cancels the file upload.
|
|
38
|
+
* This is emitted when the user clicks the cancel button in the file upload dialog.
|
|
38
39
|
*/
|
|
39
40
|
readonly canceled: import("@angular/core").OutputEmitterRef<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Emits when the user drags a file over the file upload.
|
|
42
|
-
*/
|
|
43
|
-
readonly dragOver: import("@angular/core").OutputEmitterRef<boolean>;
|
|
44
|
-
/**
|
|
45
|
-
* Whether the user is currently dragging a file over the file upload.
|
|
46
|
-
*/
|
|
47
|
-
protected readonly isDragOver: import("@angular/core").WritableSignal<boolean>;
|
|
48
41
|
/**
|
|
49
42
|
* Store the file input element.
|
|
50
43
|
*/
|
|
@@ -55,10 +48,6 @@ export declare class NgpFileUpload {
|
|
|
55
48
|
protected readonly state: import("ng-primitives/state").CreatedState<NgpFileUpload>;
|
|
56
49
|
constructor();
|
|
57
50
|
protected showFileDialog(): void;
|
|
58
|
-
protected onDragEnter(event: DragEvent): void;
|
|
59
|
-
protected onDragOver(event: DragEvent): void;
|
|
60
|
-
protected onDragLeave(event: DragEvent): void;
|
|
61
|
-
protected onDrop(event: DragEvent): void;
|
|
62
51
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgpFileUpload, never>;
|
|
63
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpFileUpload, "[ngpFileUpload]", ["ngpFileUpload"], { "fileTypes": { "alias": "ngpFileUploadFileTypes"; "required": false; "isSignal": true; }; "multiple": { "alias": "ngpFileUploadMultiple"; "required": false; "isSignal": true; }; "directory": { "alias": "ngpFileUploadDirectory"; "required": false; "isSignal": true; }; "dragAndDrop": { "alias": "ngpFileUploadDragDrop"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpFileUploadDisabled"; "required": false; "isSignal": true; }; }, { "selected": "ngpFileUploadSelected"; "canceled": "ngpFileUploadCanceled";
|
|
52
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpFileUpload, "[ngpFileUpload]", ["ngpFileUpload"], { "fileTypes": { "alias": "ngpFileUploadFileTypes"; "required": false; "isSignal": true; }; "multiple": { "alias": "ngpFileUploadMultiple"; "required": false; "isSignal": true; }; "directory": { "alias": "ngpFileUploadDirectory"; "required": false; "isSignal": true; }; "dragAndDrop": { "alias": "ngpFileUploadDragDrop"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpFileUploadDisabled"; "required": false; "isSignal": true; }; }, { "selected": "ngpFileUploadSelected"; "canceled": "ngpFileUploadCanceled"; }, never, never, true, [{ directive: typeof i1.NgpFileDropzone; inputs: { "ngpFileDropzoneFileTypes": "ngpFileUploadFileTypes"; "ngpFileDropzoneMultiple": "ngpFileUploadMultiple"; "ngpFileDropzoneDirectory": "ngpFileUploadDirectory"; "ngpFileDropzoneDisabled": "ngpFileUploadDisabled"; }; outputs: { "ngpFileDropzoneSelected": "ngpFileUploadSelected"; "ngpFileDropzoneDragOver": "ngpFileUploadDragOver"; }; }]>;
|
|
64
53
|
}
|
package/file-upload/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
export { NgpFileDropzone } from './file-dropzone/file-dropzone';
|
|
2
|
+
export { injectFileDropzoneState, provideFileDropzoneState, } from './file-dropzone/file-dropzone-state';
|
|
1
3
|
export { NgpFileUpload } from './file-upload/file-upload';
|
|
2
4
|
export { injectFileUploadState, provideFileUploadState } from './file-upload/file-upload-state';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ng-primitives",
|
|
3
3
|
"description": "Angular Primitives is a low-level headless UI component library with a focus on accessibility, customization, and developer experience. ",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.33.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"angular",
|
|
8
8
|
"primitives",
|
|
@@ -83,26 +83,26 @@
|
|
|
83
83
|
"types": "./checkbox/index.d.ts",
|
|
84
84
|
"default": "./fesm2022/ng-primitives-checkbox.mjs"
|
|
85
85
|
},
|
|
86
|
-
"./common": {
|
|
87
|
-
"types": "./common/index.d.ts",
|
|
88
|
-
"default": "./fesm2022/ng-primitives-common.mjs"
|
|
89
|
-
},
|
|
90
86
|
"./date-picker": {
|
|
91
87
|
"types": "./date-picker/index.d.ts",
|
|
92
88
|
"default": "./fesm2022/ng-primitives-date-picker.mjs"
|
|
93
89
|
},
|
|
90
|
+
"./common": {
|
|
91
|
+
"types": "./common/index.d.ts",
|
|
92
|
+
"default": "./fesm2022/ng-primitives-common.mjs"
|
|
93
|
+
},
|
|
94
94
|
"./date-time": {
|
|
95
95
|
"types": "./date-time/index.d.ts",
|
|
96
96
|
"default": "./fesm2022/ng-primitives-date-time.mjs"
|
|
97
97
|
},
|
|
98
|
-
"./dialog": {
|
|
99
|
-
"types": "./dialog/index.d.ts",
|
|
100
|
-
"default": "./fesm2022/ng-primitives-dialog.mjs"
|
|
101
|
-
},
|
|
102
98
|
"./date-time-luxon": {
|
|
103
99
|
"types": "./date-time-luxon/index.d.ts",
|
|
104
100
|
"default": "./fesm2022/ng-primitives-date-time-luxon.mjs"
|
|
105
101
|
},
|
|
102
|
+
"./dialog": {
|
|
103
|
+
"types": "./dialog/index.d.ts",
|
|
104
|
+
"default": "./fesm2022/ng-primitives-dialog.mjs"
|
|
105
|
+
},
|
|
106
106
|
"./file-upload": {
|
|
107
107
|
"types": "./file-upload/index.d.ts",
|
|
108
108
|
"default": "./fesm2022/ng-primitives-file-upload.mjs"
|