@aeris-ui/core 22.0.0-alpha.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/LICENSE +21 -0
- package/README.md +189 -0
- package/fesm2022/aeris-ui-core-accordion.mjs +412 -0
- package/fesm2022/aeris-ui-core-accordion.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-animate-on-scroll.mjs +107 -0
- package/fesm2022/aeris-ui-core-animate-on-scroll.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-auto-complete.mjs +754 -0
- package/fesm2022/aeris-ui-core-auto-complete.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-auto-focus.mjs +63 -0
- package/fesm2022/aeris-ui-core-auto-focus.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-avatar.mjs +133 -0
- package/fesm2022/aeris-ui-core-avatar.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-badge.mjs +163 -0
- package/fesm2022/aeris-ui-core-badge.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-block-ui.mjs +139 -0
- package/fesm2022/aeris-ui-core-block-ui.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-breadcrumb.mjs +433 -0
- package/fesm2022/aeris-ui-core-breadcrumb.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-button-group.mjs +39 -0
- package/fesm2022/aeris-ui-core-button-group.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-button.mjs +246 -0
- package/fesm2022/aeris-ui-core-button.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-card.mjs +134 -0
- package/fesm2022/aeris-ui-core-card.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-carousel.mjs +542 -0
- package/fesm2022/aeris-ui-core-carousel.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-cascade-select.mjs +673 -0
- package/fesm2022/aeris-ui-core-cascade-select.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-chart.mjs +296 -0
- package/fesm2022/aeris-ui-core-chart.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-checkbox.mjs +220 -0
- package/fesm2022/aeris-ui-core-checkbox.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-chip.mjs +200 -0
- package/fesm2022/aeris-ui-core-chip.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-class-names.mjs +67 -0
- package/fesm2022/aeris-ui-core-class-names.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-color-picker.mjs +1192 -0
- package/fesm2022/aeris-ui-core-color-picker.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-compare.mjs +508 -0
- package/fesm2022/aeris-ui-core-compare.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-confirm-dialog.mjs +818 -0
- package/fesm2022/aeris-ui-core-confirm-dialog.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-confirm-popup.mjs +1010 -0
- package/fesm2022/aeris-ui-core-confirm-popup.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-context-menu.mjs +720 -0
- package/fesm2022/aeris-ui-core-context-menu.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-date-picker.mjs +1471 -0
- package/fesm2022/aeris-ui-core-date-picker.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-dialog.mjs +574 -0
- package/fesm2022/aeris-ui-core-dialog.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-divider.mjs +51 -0
- package/fesm2022/aeris-ui-core-divider.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-drawer.mjs +549 -0
- package/fesm2022/aeris-ui-core-drawer.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-dynamic-dialog.mjs +333 -0
- package/fesm2022/aeris-ui-core-dynamic-dialog.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-editor.mjs +1548 -0
- package/fesm2022/aeris-ui-core-editor.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-file-upload.mjs +965 -0
- package/fesm2022/aeris-ui-core-file-upload.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-filter-service.mjs +304 -0
- package/fesm2022/aeris-ui-core-filter-service.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-fluid.mjs +23 -0
- package/fesm2022/aeris-ui-core-fluid.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-focus-trap.mjs +185 -0
- package/fesm2022/aeris-ui-core-focus-trap.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-galleria.mjs +1657 -0
- package/fesm2022/aeris-ui-core-galleria.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-glass.mjs +35 -0
- package/fesm2022/aeris-ui-core-glass.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-icon-field.mjs +113 -0
- package/fesm2022/aeris-ui-core-icon-field.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-inplace.mjs +243 -0
- package/fesm2022/aeris-ui-core-inplace.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-input-group.mjs +110 -0
- package/fesm2022/aeris-ui-core-input-group.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-input-mask.mjs +343 -0
- package/fesm2022/aeris-ui-core-input-mask.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-input-number.mjs +497 -0
- package/fesm2022/aeris-ui-core-input-number.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-input-otp.mjs +361 -0
- package/fesm2022/aeris-ui-core-input-otp.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-input-text.mjs +226 -0
- package/fesm2022/aeris-ui-core-input-text.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-key-filter.mjs +208 -0
- package/fesm2022/aeris-ui-core-key-filter.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-mega-menu.mjs +835 -0
- package/fesm2022/aeris-ui-core-mega-menu.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-menu.mjs +796 -0
- package/fesm2022/aeris-ui-core-menu.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-menubar.mjs +729 -0
- package/fesm2022/aeris-ui-core-menubar.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-message.mjs +225 -0
- package/fesm2022/aeris-ui-core-message.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-meter-group.mjs +377 -0
- package/fesm2022/aeris-ui-core-meter-group.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-multi-select.mjs +1033 -0
- package/fesm2022/aeris-ui-core-multi-select.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-order-list.mjs +351 -0
- package/fesm2022/aeris-ui-core-order-list.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-organization-chart.mjs +382 -0
- package/fesm2022/aeris-ui-core-organization-chart.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-paginator.mjs +254 -0
- package/fesm2022/aeris-ui-core-paginator.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-panel.mjs +352 -0
- package/fesm2022/aeris-ui-core-panel.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-password.mjs +479 -0
- package/fesm2022/aeris-ui-core-password.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-pick-list.mjs +939 -0
- package/fesm2022/aeris-ui-core-pick-list.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-popover.mjs +535 -0
- package/fesm2022/aeris-ui-core-popover.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-progress-bar.mjs +260 -0
- package/fesm2022/aeris-ui-core-progress-bar.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-progress-spinner.mjs +218 -0
- package/fesm2022/aeris-ui-core-progress-spinner.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-radio-button.mjs +194 -0
- package/fesm2022/aeris-ui-core-radio-button.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-rating.mjs +385 -0
- package/fesm2022/aeris-ui-core-rating.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-scroll-panel.mjs +211 -0
- package/fesm2022/aeris-ui-core-scroll-panel.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-scroll-top.mjs +94 -0
- package/fesm2022/aeris-ui-core-scroll-top.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-select.mjs +1134 -0
- package/fesm2022/aeris-ui-core-select.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-skeleton.mjs +47 -0
- package/fesm2022/aeris-ui-core-skeleton.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-slider.mjs +724 -0
- package/fesm2022/aeris-ui-core-slider.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-speed-dial.mjs +589 -0
- package/fesm2022/aeris-ui-core-speed-dial.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-split-button.mjs +532 -0
- package/fesm2022/aeris-ui-core-split-button.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-splitter.mjs +488 -0
- package/fesm2022/aeris-ui-core-splitter.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-stepper.mjs +437 -0
- package/fesm2022/aeris-ui-core-stepper.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-style-class.mjs +344 -0
- package/fesm2022/aeris-ui-core-style-class.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-table.mjs +1580 -0
- package/fesm2022/aeris-ui-core-table.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tabs.mjs +438 -0
- package/fesm2022/aeris-ui-core-tabs.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-textarea.mjs +349 -0
- package/fesm2022/aeris-ui-core-textarea.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-theme-builder.mjs +1565 -0
- package/fesm2022/aeris-ui-core-theme-builder.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-theming.mjs +150 -0
- package/fesm2022/aeris-ui-core-theming.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tiered-menu.mjs +718 -0
- package/fesm2022/aeris-ui-core-tiered-menu.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-timeline.mjs +278 -0
- package/fesm2022/aeris-ui-core-timeline.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-toast.mjs +422 -0
- package/fesm2022/aeris-ui-core-toast.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-toggle-switch.mjs +202 -0
- package/fesm2022/aeris-ui-core-toggle-switch.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-toolbar.mjs +136 -0
- package/fesm2022/aeris-ui-core-toolbar.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tooltip.mjs +365 -0
- package/fesm2022/aeris-ui-core-tooltip.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tree-select.mjs +995 -0
- package/fesm2022/aeris-ui-core-tree-select.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tree-table.mjs +1600 -0
- package/fesm2022/aeris-ui-core-tree-table.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tree.mjs +962 -0
- package/fesm2022/aeris-ui-core-tree.mjs.map +1 -0
- package/fesm2022/aeris-ui-core.mjs +360 -0
- package/fesm2022/aeris-ui-core.mjs.map +1 -0
- package/package.json +432 -0
- package/schematics/aeris-setup.schema.json +52 -0
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/schema.json +64 -0
- package/schematics/runtime/package.json +3 -0
- package/schematics/runtime/schematics/ng-add/index.js +13 -0
- package/schematics/runtime/schematics/ng-add/index.js.map +1 -0
- package/schematics/runtime/schematics/ng-add/options.js +338 -0
- package/schematics/runtime/schematics/ng-add/options.js.map +1 -0
- package/schematics/runtime/schematics/ng-add/schema.js +3 -0
- package/schematics/runtime/schematics/ng-add/schema.js.map +1 -0
- package/schematics/runtime/schematics/ng-add/workspace.js +273 -0
- package/schematics/runtime/schematics/ng-add/workspace.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-color-derivation.js +12 -0
- package/schematics/runtime/theme-builder/aeris-color-derivation.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-color.js +263 -0
- package/schematics/runtime/theme-builder/aeris-color.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-contrast.js +245 -0
- package/schematics/runtime/theme-builder/aeris-contrast.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-foundation.js +47 -0
- package/schematics/runtime/theme-builder/aeris-foundation.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-semantic-tones.js +121 -0
- package/schematics/runtime/theme-builder/aeris-semantic-tones.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-theme-generator.js +238 -0
- package/schematics/runtime/theme-builder/aeris-theme-generator.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-theme-resolver.js +101 -0
- package/schematics/runtime/theme-builder/aeris-theme-resolver.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-theme-tokens.js +82 -0
- package/schematics/runtime/theme-builder/aeris-theme-tokens.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-theme-validation.js +183 -0
- package/schematics/runtime/theme-builder/aeris-theme-validation.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-theme.js +322 -0
- package/schematics/runtime/theme-builder/aeris-theme.js.map +1 -0
- package/schematics/runtime/theme-builder/public-api.js +17 -0
- package/schematics/runtime/theme-builder/public-api.js.map +1 -0
- package/styles/_index.scss +1 -0
- package/styles/_tokens.scss +13 -0
- package/styles/aeris.css +555 -0
- package/styles/controls.css +169 -0
- package/tools/aeris-theme.mjs +149 -0
- package/tools/aeris-theme.schema.json +143 -0
- package/types/aeris-ui-core-accordion.d.ts +101 -0
- package/types/aeris-ui-core-animate-on-scroll.d.ts +34 -0
- package/types/aeris-ui-core-auto-complete.d.ts +154 -0
- package/types/aeris-ui-core-auto-focus.d.ts +17 -0
- package/types/aeris-ui-core-avatar.d.ts +44 -0
- package/types/aeris-ui-core-badge.d.ts +48 -0
- package/types/aeris-ui-core-block-ui.d.ts +28 -0
- package/types/aeris-ui-core-breadcrumb.d.ts +104 -0
- package/types/aeris-ui-core-button-group.d.ts +17 -0
- package/types/aeris-ui-core-button.d.ts +71 -0
- package/types/aeris-ui-core-card.d.ts +43 -0
- package/types/aeris-ui-core-carousel.d.ts +126 -0
- package/types/aeris-ui-core-cascade-select.d.ts +130 -0
- package/types/aeris-ui-core-chart.d.ts +92 -0
- package/types/aeris-ui-core-checkbox.d.ts +55 -0
- package/types/aeris-ui-core-chip.d.ts +56 -0
- package/types/aeris-ui-core-class-names.d.ts +21 -0
- package/types/aeris-ui-core-color-picker.d.ts +149 -0
- package/types/aeris-ui-core-compare.d.ts +109 -0
- package/types/aeris-ui-core-confirm-dialog.d.ts +263 -0
- package/types/aeris-ui-core-confirm-popup.d.ts +281 -0
- package/types/aeris-ui-core-context-menu.d.ts +156 -0
- package/types/aeris-ui-core-date-picker.d.ts +226 -0
- package/types/aeris-ui-core-dialog.d.ts +124 -0
- package/types/aeris-ui-core-divider.d.ts +21 -0
- package/types/aeris-ui-core-drawer.d.ts +119 -0
- package/types/aeris-ui-core-dynamic-dialog.d.ts +148 -0
- package/types/aeris-ui-core-editor.d.ts +130 -0
- package/types/aeris-ui-core-file-upload.d.ts +199 -0
- package/types/aeris-ui-core-filter-service.d.ts +54 -0
- package/types/aeris-ui-core-fluid.d.ts +10 -0
- package/types/aeris-ui-core-focus-trap.d.ts +32 -0
- package/types/aeris-ui-core-galleria.d.ts +273 -0
- package/types/aeris-ui-core-glass.d.ts +17 -0
- package/types/aeris-ui-core-icon-field.d.ts +36 -0
- package/types/aeris-ui-core-inplace.d.ts +68 -0
- package/types/aeris-ui-core-input-group.d.ts +38 -0
- package/types/aeris-ui-core-input-mask.d.ts +73 -0
- package/types/aeris-ui-core-input-number.d.ts +87 -0
- package/types/aeris-ui-core-input-otp.d.ts +88 -0
- package/types/aeris-ui-core-input-text.d.ts +63 -0
- package/types/aeris-ui-core-key-filter.d.ts +41 -0
- package/types/aeris-ui-core-mega-menu.d.ts +130 -0
- package/types/aeris-ui-core-menu.d.ts +182 -0
- package/types/aeris-ui-core-menubar.d.ts +145 -0
- package/types/aeris-ui-core-message.d.ts +65 -0
- package/types/aeris-ui-core-meter-group.d.ts +100 -0
- package/types/aeris-ui-core-multi-select.d.ts +193 -0
- package/types/aeris-ui-core-order-list.d.ts +73 -0
- package/types/aeris-ui-core-organization-chart.d.ts +85 -0
- package/types/aeris-ui-core-paginator.d.ts +39 -0
- package/types/aeris-ui-core-panel.d.ts +85 -0
- package/types/aeris-ui-core-password.d.ts +110 -0
- package/types/aeris-ui-core-pick-list.d.ts +193 -0
- package/types/aeris-ui-core-popover.d.ts +112 -0
- package/types/aeris-ui-core-progress-bar.d.ts +81 -0
- package/types/aeris-ui-core-progress-spinner.d.ts +51 -0
- package/types/aeris-ui-core-radio-button.d.ts +51 -0
- package/types/aeris-ui-core-rating.d.ts +80 -0
- package/types/aeris-ui-core-scroll-panel.d.ts +66 -0
- package/types/aeris-ui-core-scroll-top.d.ts +29 -0
- package/types/aeris-ui-core-select.d.ts +223 -0
- package/types/aeris-ui-core-skeleton.d.ts +18 -0
- package/types/aeris-ui-core-slider.d.ts +117 -0
- package/types/aeris-ui-core-speed-dial.d.ts +119 -0
- package/types/aeris-ui-core-split-button.d.ts +122 -0
- package/types/aeris-ui-core-splitter.d.ts +113 -0
- package/types/aeris-ui-core-stepper.d.ts +99 -0
- package/types/aeris-ui-core-style-class.d.ts +73 -0
- package/types/aeris-ui-core-table.d.ts +333 -0
- package/types/aeris-ui-core-tabs.d.ts +82 -0
- package/types/aeris-ui-core-textarea.d.ts +80 -0
- package/types/aeris-ui-core-theme-builder.d.ts +499 -0
- package/types/aeris-ui-core-theming.d.ts +47 -0
- package/types/aeris-ui-core-tiered-menu.d.ts +152 -0
- package/types/aeris-ui-core-timeline.d.ts +80 -0
- package/types/aeris-ui-core-toast.d.ts +127 -0
- package/types/aeris-ui-core-toggle-switch.d.ts +52 -0
- package/types/aeris-ui-core-toolbar.d.ts +47 -0
- package/types/aeris-ui-core-tooltip.d.ts +92 -0
- package/types/aeris-ui-core-tree-select.d.ts +187 -0
- package/types/aeris-ui-core-tree-table.d.ts +311 -0
- package/types/aeris-ui-core-tree.d.ts +179 -0
- package/types/aeris-ui-core.d.ts +85 -0
|
@@ -0,0 +1,965 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, TemplateRef, Directive, viewChild, DestroyRef, contentChild, signal, model, input, booleanAttribute, numberAttribute, output, computed, effect, Component } from '@angular/core';
|
|
4
|
+
|
|
5
|
+
class AerisFileUploadToolbarTemplate {
|
|
6
|
+
template = inject(TemplateRef);
|
|
7
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadToolbarTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
8
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: AerisFileUploadToolbarTemplate, isStandalone: true, selector: "ng-template[aerisFileUploadToolbar]", ngImport: i0 });
|
|
9
|
+
}
|
|
10
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadToolbarTemplate, decorators: [{
|
|
11
|
+
type: Directive,
|
|
12
|
+
args: [{ selector: 'ng-template[aerisFileUploadToolbar]' }]
|
|
13
|
+
}] });
|
|
14
|
+
class AerisFileUploadContentTemplate {
|
|
15
|
+
template = inject(TemplateRef);
|
|
16
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadContentTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
17
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: AerisFileUploadContentTemplate, isStandalone: true, selector: "ng-template[aerisFileUploadContent]", ngImport: i0 });
|
|
18
|
+
}
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadContentTemplate, decorators: [{
|
|
20
|
+
type: Directive,
|
|
21
|
+
args: [{ selector: 'ng-template[aerisFileUploadContent]' }]
|
|
22
|
+
}] });
|
|
23
|
+
class AerisFileUploadFileTemplate {
|
|
24
|
+
template = inject(TemplateRef);
|
|
25
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadFileTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
26
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: AerisFileUploadFileTemplate, isStandalone: true, selector: "ng-template[aerisFileUploadFile]", ngImport: i0 });
|
|
27
|
+
}
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadFileTemplate, decorators: [{
|
|
29
|
+
type: Directive,
|
|
30
|
+
args: [{ selector: 'ng-template[aerisFileUploadFile]' }]
|
|
31
|
+
}] });
|
|
32
|
+
class AerisFileUploadEmptyTemplate {
|
|
33
|
+
template = inject(TemplateRef);
|
|
34
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadEmptyTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
35
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: AerisFileUploadEmptyTemplate, isStandalone: true, selector: "ng-template[aerisFileUploadEmpty]", ngImport: i0 });
|
|
36
|
+
}
|
|
37
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadEmptyTemplate, decorators: [{
|
|
38
|
+
type: Directive,
|
|
39
|
+
args: [{ selector: 'ng-template[aerisFileUploadEmpty]' }]
|
|
40
|
+
}] });
|
|
41
|
+
class AerisFileUploadChooseIconTemplate {
|
|
42
|
+
template = inject(TemplateRef);
|
|
43
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadChooseIconTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
44
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: AerisFileUploadChooseIconTemplate, isStandalone: true, selector: "ng-template[aerisFileUploadChooseIcon]", ngImport: i0 });
|
|
45
|
+
}
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadChooseIconTemplate, decorators: [{
|
|
47
|
+
type: Directive,
|
|
48
|
+
args: [{ selector: 'ng-template[aerisFileUploadChooseIcon]' }]
|
|
49
|
+
}] });
|
|
50
|
+
class AerisFileUploadUploadIconTemplate {
|
|
51
|
+
template = inject(TemplateRef);
|
|
52
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadUploadIconTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
53
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: AerisFileUploadUploadIconTemplate, isStandalone: true, selector: "ng-template[aerisFileUploadUploadIcon]", ngImport: i0 });
|
|
54
|
+
}
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadUploadIconTemplate, decorators: [{
|
|
56
|
+
type: Directive,
|
|
57
|
+
args: [{ selector: 'ng-template[aerisFileUploadUploadIcon]' }]
|
|
58
|
+
}] });
|
|
59
|
+
class AerisFileUploadClearIconTemplate {
|
|
60
|
+
template = inject(TemplateRef);
|
|
61
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadClearIconTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
62
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: AerisFileUploadClearIconTemplate, isStandalone: true, selector: "ng-template[aerisFileUploadClearIcon]", ngImport: i0 });
|
|
63
|
+
}
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUploadClearIconTemplate, decorators: [{
|
|
65
|
+
type: Directive,
|
|
66
|
+
args: [{ selector: 'ng-template[aerisFileUploadClearIcon]' }]
|
|
67
|
+
}] });
|
|
68
|
+
const SAFE_IMAGE_PREVIEW_TYPES = new Set([
|
|
69
|
+
'image/avif',
|
|
70
|
+
'image/bmp',
|
|
71
|
+
'image/gif',
|
|
72
|
+
'image/jpeg',
|
|
73
|
+
'image/png',
|
|
74
|
+
'image/vnd.microsoft.icon',
|
|
75
|
+
'image/webp',
|
|
76
|
+
'image/x-icon',
|
|
77
|
+
]);
|
|
78
|
+
const DEFAULT_MAX_PREVIEW_FILE_SIZE = 10 * 1024 * 1024;
|
|
79
|
+
let nextFileUploadId = 0;
|
|
80
|
+
class AerisFileUpload {
|
|
81
|
+
fileInput = viewChild('fileInput', /* @ts-ignore */
|
|
82
|
+
...(ngDevMode ? [{ debugName: "fileInput" }] : /* istanbul ignore next */ []));
|
|
83
|
+
destroyRef = inject(DestroyRef);
|
|
84
|
+
toolbarTemplate = contentChild(AerisFileUploadToolbarTemplate, /* @ts-ignore */
|
|
85
|
+
...(ngDevMode ? [{ debugName: "toolbarTemplate" }] : /* istanbul ignore next */ []));
|
|
86
|
+
contentTemplate = contentChild(AerisFileUploadContentTemplate, /* @ts-ignore */
|
|
87
|
+
...(ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
|
|
88
|
+
fileTemplate = contentChild(AerisFileUploadFileTemplate, /* @ts-ignore */
|
|
89
|
+
...(ngDevMode ? [{ debugName: "fileTemplate" }] : /* istanbul ignore next */ []));
|
|
90
|
+
emptyTemplate = contentChild(AerisFileUploadEmptyTemplate, /* @ts-ignore */
|
|
91
|
+
...(ngDevMode ? [{ debugName: "emptyTemplate" }] : /* istanbul ignore next */ []));
|
|
92
|
+
chooseIconTemplate = contentChild(AerisFileUploadChooseIconTemplate, /* @ts-ignore */
|
|
93
|
+
...(ngDevMode ? [{ debugName: "chooseIconTemplate" }] : /* istanbul ignore next */ []));
|
|
94
|
+
uploadIconTemplate = contentChild(AerisFileUploadUploadIconTemplate, /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "uploadIconTemplate" }] : /* istanbul ignore next */ []));
|
|
96
|
+
clearIconTemplate = contentChild(AerisFileUploadClearIconTemplate, /* @ts-ignore */
|
|
97
|
+
...(ngDevMode ? [{ debugName: "clearIconTemplate" }] : /* istanbul ignore next */ []));
|
|
98
|
+
generatedId = `aeris-file-upload-${++nextFileUploadId}`;
|
|
99
|
+
dragDepth = 0;
|
|
100
|
+
items = signal([], /* @ts-ignore */
|
|
101
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
102
|
+
rejections = signal([], /* @ts-ignore */
|
|
103
|
+
...(ngDevMode ? [{ debugName: "rejections" }] : /* istanbul ignore next */ []));
|
|
104
|
+
dragActive = signal(false, /* @ts-ignore */
|
|
105
|
+
...(ngDevMode ? [{ debugName: "dragActive" }] : /* istanbul ignore next */ []));
|
|
106
|
+
dragRejected = signal(false, /* @ts-ignore */
|
|
107
|
+
...(ngDevMode ? [{ debugName: "dragRejected" }] : /* istanbul ignore next */ []));
|
|
108
|
+
files = model([], /* @ts-ignore */
|
|
109
|
+
...(ngDevMode ? [{ debugName: "files" }] : /* istanbul ignore next */ []));
|
|
110
|
+
mode = input('advanced', /* @ts-ignore */
|
|
111
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
112
|
+
multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
113
|
+
accept = input('', /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []));
|
|
115
|
+
minFileSize = input(0, { ...(ngDevMode ? { debugName: "minFileSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
116
|
+
maxFileSize = input(0, { ...(ngDevMode ? { debugName: "maxFileSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
117
|
+
maxPreviewFileSize = input(DEFAULT_MAX_PREVIEW_FILE_SIZE, { ...(ngDevMode ? { debugName: "maxPreviewFileSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
118
|
+
maxFiles = input(0, { ...(ngDevMode ? { debugName: "maxFiles" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
119
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
120
|
+
autoUpload = input(false, { ...(ngDevMode ? { debugName: "autoUpload" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
121
|
+
customUpload = input(false, { ...(ngDevMode ? { debugName: "customUpload" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
122
|
+
dragDrop = input(true, { ...(ngDevMode ? { debugName: "dragDrop" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
123
|
+
imagePreview = input(false, { ...(ngDevMode ? { debugName: "imagePreview" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
124
|
+
showFileList = input(true, { ...(ngDevMode ? { debugName: "showFileList" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
125
|
+
showProgress = input(true, { ...(ngDevMode ? { debugName: "showProgress" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
126
|
+
showSize = input(true, { ...(ngDevMode ? { debugName: "showSize" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
127
|
+
showUploadButton = input(true, { ...(ngDevMode ? { debugName: "showUploadButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
128
|
+
showClearButton = input(true, { ...(ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
129
|
+
chooseLabel = input('Choose', /* @ts-ignore */
|
|
130
|
+
...(ngDevMode ? [{ debugName: "chooseLabel" }] : /* istanbul ignore next */ []));
|
|
131
|
+
uploadLabel = input('Upload', /* @ts-ignore */
|
|
132
|
+
...(ngDevMode ? [{ debugName: "uploadLabel" }] : /* istanbul ignore next */ []));
|
|
133
|
+
clearLabel = input('Clear', /* @ts-ignore */
|
|
134
|
+
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
135
|
+
dropLabel = input('Drop files or click to browse', /* @ts-ignore */
|
|
136
|
+
...(ngDevMode ? [{ debugName: "dropLabel" }] : /* istanbul ignore next */ []));
|
|
137
|
+
emptyLabel = input('No files selected.', /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []));
|
|
139
|
+
helperText = input('', /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "helperText" }] : /* istanbul ignore next */ []));
|
|
141
|
+
name = input('', /* @ts-ignore */
|
|
142
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
143
|
+
inputId = input(`${this.generatedId}-input`, /* @ts-ignore */
|
|
144
|
+
...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
145
|
+
inputAriaLabel = input('Choose files', /* @ts-ignore */
|
|
146
|
+
...(ngDevMode ? [{ debugName: "inputAriaLabel" }] : /* istanbul ignore next */ []));
|
|
147
|
+
fileListAriaLabel = input('Selected files', /* @ts-ignore */
|
|
148
|
+
...(ngDevMode ? [{ debugName: "fileListAriaLabel" }] : /* istanbul ignore next */ []));
|
|
149
|
+
removeAriaLabel = input('Remove file', /* @ts-ignore */
|
|
150
|
+
...(ngDevMode ? [{ debugName: "removeAriaLabel" }] : /* istanbul ignore next */ []));
|
|
151
|
+
invalidFileTypeMessage = input('File type is not allowed.', /* @ts-ignore */
|
|
152
|
+
...(ngDevMode ? [{ debugName: "invalidFileTypeMessage" }] : /* istanbul ignore next */ []));
|
|
153
|
+
invalidMinFileSizeMessage = input('File is smaller than the minimum size.', /* @ts-ignore */
|
|
154
|
+
...(ngDevMode ? [{ debugName: "invalidMinFileSizeMessage" }] : /* istanbul ignore next */ []));
|
|
155
|
+
invalidMaxFileSizeMessage = input('File exceeds the maximum size.', /* @ts-ignore */
|
|
156
|
+
...(ngDevMode ? [{ debugName: "invalidMaxFileSizeMessage" }] : /* istanbul ignore next */ []));
|
|
157
|
+
invalidFileLimitMessage = input('Too many files selected.', /* @ts-ignore */
|
|
158
|
+
...(ngDevMode ? [{ debugName: "invalidFileLimitMessage" }] : /* istanbul ignore next */ []));
|
|
159
|
+
selected = output();
|
|
160
|
+
removed = output();
|
|
161
|
+
cleared = output();
|
|
162
|
+
uploadRequested = output();
|
|
163
|
+
validationFailed = output();
|
|
164
|
+
labelId = computed(() => `${this.generatedId}-label`, /* @ts-ignore */
|
|
165
|
+
...(ngDevMode ? [{ debugName: "labelId" }] : /* istanbul ignore next */ []));
|
|
166
|
+
helpId = computed(() => `${this.generatedId}-help`, /* @ts-ignore */
|
|
167
|
+
...(ngDevMode ? [{ debugName: "helpId" }] : /* istanbul ignore next */ []));
|
|
168
|
+
descriptionIds = computed(() => this.resolvedHelpText() ? this.helpId() : null, /* @ts-ignore */
|
|
169
|
+
...(ngDevMode ? [{ debugName: "descriptionIds" }] : /* istanbul ignore next */ []));
|
|
170
|
+
canClear = computed(() => !this.disabled() && this.items().length > 0, /* @ts-ignore */
|
|
171
|
+
...(ngDevMode ? [{ debugName: "canClear" }] : /* istanbul ignore next */ []));
|
|
172
|
+
canUpload = computed(() => !this.disabled() && this.items().some((item) => item.status === 'ready'), /* @ts-ignore */
|
|
173
|
+
...(ngDevMode ? [{ debugName: "canUpload" }] : /* istanbul ignore next */ []));
|
|
174
|
+
summaryText = computed(() => {
|
|
175
|
+
const count = this.items().length;
|
|
176
|
+
if (count === 0)
|
|
177
|
+
return 'No file chosen';
|
|
178
|
+
if (count === 1)
|
|
179
|
+
return this.items()[0]?.name ?? '1 file selected';
|
|
180
|
+
return `${count} files selected`;
|
|
181
|
+
}, /* @ts-ignore */
|
|
182
|
+
...(ngDevMode ? [{ debugName: "summaryText" }] : /* istanbul ignore next */ []));
|
|
183
|
+
resolvedHelpText = computed(() => {
|
|
184
|
+
const custom = this.helperText();
|
|
185
|
+
if (custom)
|
|
186
|
+
return custom;
|
|
187
|
+
const parts = [];
|
|
188
|
+
if (this.accept())
|
|
189
|
+
parts.push(`Accepted: ${this.accept()}`);
|
|
190
|
+
if (this.maxFileSize() > 0)
|
|
191
|
+
parts.push(`Up to ${this.formatSize(this.maxFileSize())} each`);
|
|
192
|
+
if (this.maxFiles() > 0)
|
|
193
|
+
parts.push(`Maximum ${this.maxFiles()} files`);
|
|
194
|
+
return parts.join(' · ') || 'Use the choose button or drop files here.';
|
|
195
|
+
}, /* @ts-ignore */
|
|
196
|
+
...(ngDevMode ? [{ debugName: "resolvedHelpText" }] : /* istanbul ignore next */ []));
|
|
197
|
+
templateContext = computed(() => ({
|
|
198
|
+
$implicit: this.items(),
|
|
199
|
+
files: this.items(),
|
|
200
|
+
component: this,
|
|
201
|
+
choose: (event) => this.choose(event ?? null),
|
|
202
|
+
upload: (event) => this.upload(event ?? null),
|
|
203
|
+
clear: (event) => this.clear(event ?? null),
|
|
204
|
+
}), /* @ts-ignore */
|
|
205
|
+
...(ngDevMode ? [{ debugName: "templateContext" }] : /* istanbul ignore next */ []));
|
|
206
|
+
fileContexts = computed(() => {
|
|
207
|
+
const contexts = {};
|
|
208
|
+
for (const item of this.items()) {
|
|
209
|
+
contexts[item.id] = {
|
|
210
|
+
$implicit: item,
|
|
211
|
+
file: item,
|
|
212
|
+
component: this,
|
|
213
|
+
remove: (event) => this.remove(item.file, event ?? null),
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
return contexts;
|
|
217
|
+
}, /* @ts-ignore */
|
|
218
|
+
...(ngDevMode ? [{ debugName: "fileContexts" }] : /* istanbul ignore next */ []));
|
|
219
|
+
constructor() {
|
|
220
|
+
this.destroyRef.onDestroy(() => this.revokeItems(this.items()));
|
|
221
|
+
effect(() => {
|
|
222
|
+
const nextFiles = this.files();
|
|
223
|
+
this.items.update((current) => this.reconcileItems(current, nextFiles));
|
|
224
|
+
});
|
|
225
|
+
effect(() => {
|
|
226
|
+
if (!this.disabled())
|
|
227
|
+
return;
|
|
228
|
+
this.dragActive.set(false);
|
|
229
|
+
this.dragRejected.set(false);
|
|
230
|
+
this.dragDepth = 0;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
choose(originalEvent = null) {
|
|
234
|
+
if (this.disabled())
|
|
235
|
+
return;
|
|
236
|
+
originalEvent?.preventDefault();
|
|
237
|
+
const input = this.fileInput()?.nativeElement;
|
|
238
|
+
if (!input)
|
|
239
|
+
return;
|
|
240
|
+
input.value = '';
|
|
241
|
+
input.click();
|
|
242
|
+
}
|
|
243
|
+
upload(originalEvent = null) {
|
|
244
|
+
if (!this.canUpload())
|
|
245
|
+
return;
|
|
246
|
+
const uploadItems = this.items().filter((item) => item.status === 'ready');
|
|
247
|
+
const uploadFiles = uploadItems.map((item) => item.file);
|
|
248
|
+
this.updateItems(uploadFiles, { status: 'uploading', progress: 0, error: '' });
|
|
249
|
+
const event = {
|
|
250
|
+
originalEvent,
|
|
251
|
+
files: uploadFiles,
|
|
252
|
+
items: uploadItems,
|
|
253
|
+
setProgress: (file, progress) => this.setProgress(file, progress),
|
|
254
|
+
complete: (files = uploadFiles) => this.markUploaded(files),
|
|
255
|
+
error: (message = 'Upload failed.', files = uploadFiles) => this.markError(files, message),
|
|
256
|
+
};
|
|
257
|
+
this.uploadRequested.emit(event);
|
|
258
|
+
if (!this.customUpload()) {
|
|
259
|
+
this.markUploaded(uploadFiles);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
clear(originalEvent = null, reason = 'api') {
|
|
263
|
+
const current = this.items();
|
|
264
|
+
if (current.length === 0)
|
|
265
|
+
return;
|
|
266
|
+
this.revokeItems(current);
|
|
267
|
+
this.items.set([]);
|
|
268
|
+
this.files.set([]);
|
|
269
|
+
this.rejections.set([]);
|
|
270
|
+
this.resetInput();
|
|
271
|
+
this.cleared.emit({ originalEvent, files: current.map((item) => item.file), reason });
|
|
272
|
+
}
|
|
273
|
+
remove(file, originalEvent = null) {
|
|
274
|
+
const item = this.items().find((candidate) => candidate.file === file);
|
|
275
|
+
if (!item)
|
|
276
|
+
return;
|
|
277
|
+
this.revokeItems([item]);
|
|
278
|
+
this.items.update((items) => items.filter((candidate) => candidate.file !== file));
|
|
279
|
+
this.files.update((files) => files.filter((candidate) => candidate !== file));
|
|
280
|
+
this.removed.emit({ originalEvent, file, item });
|
|
281
|
+
}
|
|
282
|
+
setProgress(file, progress) {
|
|
283
|
+
this.updateItems([file], {
|
|
284
|
+
status: 'uploading',
|
|
285
|
+
progress: this.clampProgress(progress),
|
|
286
|
+
error: '',
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
markUploaded(files = this.files()) {
|
|
290
|
+
this.updateItems(files, { status: 'uploaded', progress: 100, error: '' });
|
|
291
|
+
}
|
|
292
|
+
markError(files = this.files(), message = 'Upload failed.') {
|
|
293
|
+
this.updateItems(files, { status: 'error', error: message });
|
|
294
|
+
}
|
|
295
|
+
handleFileInput(event) {
|
|
296
|
+
const input = event.target;
|
|
297
|
+
this.addFiles(input?.files, event);
|
|
298
|
+
}
|
|
299
|
+
handleDragEnter(event) {
|
|
300
|
+
if (!this.canReceiveDrop())
|
|
301
|
+
return;
|
|
302
|
+
event.preventDefault();
|
|
303
|
+
this.dragDepth += 1;
|
|
304
|
+
this.dragActive.set(true);
|
|
305
|
+
this.dragRejected.set(!this.hasAllowedDragItems(event.dataTransfer));
|
|
306
|
+
}
|
|
307
|
+
handleDragOver(event) {
|
|
308
|
+
if (!this.canReceiveDrop())
|
|
309
|
+
return;
|
|
310
|
+
event.preventDefault();
|
|
311
|
+
if (event.dataTransfer)
|
|
312
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
313
|
+
this.dragActive.set(true);
|
|
314
|
+
this.dragRejected.set(!this.hasAllowedDragItems(event.dataTransfer));
|
|
315
|
+
}
|
|
316
|
+
handleDragLeave(event) {
|
|
317
|
+
if (!this.canReceiveDrop())
|
|
318
|
+
return;
|
|
319
|
+
event.preventDefault();
|
|
320
|
+
this.dragDepth = Math.max(0, this.dragDepth - 1);
|
|
321
|
+
if (this.dragDepth > 0)
|
|
322
|
+
return;
|
|
323
|
+
this.dragActive.set(false);
|
|
324
|
+
this.dragRejected.set(false);
|
|
325
|
+
}
|
|
326
|
+
handleDrop(event) {
|
|
327
|
+
if (!this.canReceiveDrop())
|
|
328
|
+
return;
|
|
329
|
+
event.preventDefault();
|
|
330
|
+
this.dragDepth = 0;
|
|
331
|
+
this.dragActive.set(false);
|
|
332
|
+
this.dragRejected.set(false);
|
|
333
|
+
this.addFiles(event.dataTransfer?.files, event);
|
|
334
|
+
}
|
|
335
|
+
canReceiveDrop() {
|
|
336
|
+
return !this.disabled() && this.dragDrop();
|
|
337
|
+
}
|
|
338
|
+
addFiles(fileList, originalEvent) {
|
|
339
|
+
if (this.disabled() || !fileList)
|
|
340
|
+
return;
|
|
341
|
+
const incoming = Array.from(fileList);
|
|
342
|
+
const accepted = [];
|
|
343
|
+
const rejected = [];
|
|
344
|
+
const existingCount = this.multiple() ? this.files().length : 0;
|
|
345
|
+
const maxFiles = this.maxFiles();
|
|
346
|
+
for (const file of incoming) {
|
|
347
|
+
const rejection = this.validateFile(file, existingCount + accepted.length, maxFiles);
|
|
348
|
+
if (rejection) {
|
|
349
|
+
rejected.push(rejection);
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
accepted.push(file);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
const nextAccepted = this.multiple() ? accepted : accepted.slice(0, 1);
|
|
356
|
+
const nextFiles = this.multiple() ? [...this.files(), ...nextAccepted] : nextAccepted;
|
|
357
|
+
this.files.set(nextFiles);
|
|
358
|
+
this.items.update((current) => this.reconcileItems(current, nextFiles));
|
|
359
|
+
this.rejections.set(rejected);
|
|
360
|
+
this.selected.emit({
|
|
361
|
+
originalEvent,
|
|
362
|
+
files: incoming,
|
|
363
|
+
acceptedFiles: nextAccepted,
|
|
364
|
+
rejectedFiles: rejected,
|
|
365
|
+
});
|
|
366
|
+
if (rejected.length > 0)
|
|
367
|
+
this.validationFailed.emit(rejected);
|
|
368
|
+
this.resetInput();
|
|
369
|
+
if (this.autoUpload() && nextAccepted.length > 0) {
|
|
370
|
+
queueMicrotask(() => this.upload(originalEvent));
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
validateFile(file, nextIndex, maxFiles) {
|
|
374
|
+
if (maxFiles > 0 && nextIndex >= maxFiles) {
|
|
375
|
+
return this.reject(file, 'limit', this.invalidFileLimitMessage());
|
|
376
|
+
}
|
|
377
|
+
if (!this.acceptsType(file)) {
|
|
378
|
+
return this.reject(file, 'type', this.invalidFileTypeMessage());
|
|
379
|
+
}
|
|
380
|
+
if (this.minFileSize() > 0 && file.size < this.minFileSize()) {
|
|
381
|
+
return this.reject(file, 'size-min', this.invalidMinFileSizeMessage());
|
|
382
|
+
}
|
|
383
|
+
if (this.maxFileSize() > 0 && file.size > this.maxFileSize()) {
|
|
384
|
+
return this.reject(file, 'size-max', this.invalidMaxFileSizeMessage());
|
|
385
|
+
}
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
reject(file, reason, message) {
|
|
389
|
+
return { file, reason, message: `${file.name}: ${message}` };
|
|
390
|
+
}
|
|
391
|
+
acceptsType(file) {
|
|
392
|
+
const accept = this.accept()
|
|
393
|
+
.split(',')
|
|
394
|
+
.map((item) => item.trim().toLowerCase())
|
|
395
|
+
.filter(Boolean);
|
|
396
|
+
if (accept.length === 0)
|
|
397
|
+
return true;
|
|
398
|
+
const name = file.name.toLowerCase();
|
|
399
|
+
const type = file.type.toLowerCase();
|
|
400
|
+
return accept.some((entry) => {
|
|
401
|
+
if (entry.startsWith('.'))
|
|
402
|
+
return name.endsWith(entry);
|
|
403
|
+
if (entry.endsWith('/*'))
|
|
404
|
+
return type.startsWith(entry.slice(0, -1));
|
|
405
|
+
return type === entry;
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
hasAllowedDragItems(dataTransfer) {
|
|
409
|
+
const items = Array.from(dataTransfer?.items ?? []);
|
|
410
|
+
if (items.length === 0)
|
|
411
|
+
return true;
|
|
412
|
+
return items.some((item) => item.kind === 'file');
|
|
413
|
+
}
|
|
414
|
+
reconcileItems(current, files) {
|
|
415
|
+
const next = files.map((file) => {
|
|
416
|
+
const existing = current.find((item) => item.file === file);
|
|
417
|
+
return existing ?? this.createItem(file);
|
|
418
|
+
});
|
|
419
|
+
this.revokeItems(current.filter((item) => !files.includes(item.file)));
|
|
420
|
+
return next;
|
|
421
|
+
}
|
|
422
|
+
createItem(file) {
|
|
423
|
+
const image = this.isSafePreviewImage(file);
|
|
424
|
+
const preview = image && this.imagePreview()
|
|
425
|
+
? this.createObjectUrl(file)
|
|
426
|
+
: { url: '', created: false };
|
|
427
|
+
return {
|
|
428
|
+
id: `${this.generatedId}-file-${globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`}`,
|
|
429
|
+
file,
|
|
430
|
+
name: file.name,
|
|
431
|
+
size: file.size,
|
|
432
|
+
type: file.type,
|
|
433
|
+
displaySize: this.formatSize(file.size),
|
|
434
|
+
status: 'ready',
|
|
435
|
+
progress: 0,
|
|
436
|
+
previewUrl: preview.url,
|
|
437
|
+
objectUrlCreated: preview.created,
|
|
438
|
+
error: '',
|
|
439
|
+
image,
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
createObjectUrl(file) {
|
|
443
|
+
if (typeof URL === 'undefined' || typeof URL.createObjectURL !== 'function') {
|
|
444
|
+
return { url: '', created: false };
|
|
445
|
+
}
|
|
446
|
+
return { url: URL.createObjectURL(file), created: true };
|
|
447
|
+
}
|
|
448
|
+
isSafePreviewImage(file) {
|
|
449
|
+
if (!SAFE_IMAGE_PREVIEW_TYPES.has(file.type.toLowerCase()))
|
|
450
|
+
return false;
|
|
451
|
+
const limit = this.maxPreviewFileSize();
|
|
452
|
+
return limit <= 0 || file.size <= limit;
|
|
453
|
+
}
|
|
454
|
+
revokeItems(items) {
|
|
455
|
+
if (typeof URL === 'undefined' || typeof URL.revokeObjectURL !== 'function')
|
|
456
|
+
return;
|
|
457
|
+
for (const item of items) {
|
|
458
|
+
if (item.objectUrlCreated && item.previewUrl)
|
|
459
|
+
URL.revokeObjectURL(item.previewUrl);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
updateItems(files, patch) {
|
|
463
|
+
const targets = new Set(files);
|
|
464
|
+
this.items.update((items) => items.map((item) => targets.has(item.file) ? { ...item, ...patch } : item));
|
|
465
|
+
}
|
|
466
|
+
clampProgress(progress) {
|
|
467
|
+
if (!Number.isFinite(progress))
|
|
468
|
+
return 0;
|
|
469
|
+
return Math.min(100, Math.max(0, Math.round(progress)));
|
|
470
|
+
}
|
|
471
|
+
resetInput() {
|
|
472
|
+
const input = this.fileInput()?.nativeElement;
|
|
473
|
+
if (input)
|
|
474
|
+
input.value = '';
|
|
475
|
+
}
|
|
476
|
+
formatSize(bytes) {
|
|
477
|
+
if (bytes < 1024)
|
|
478
|
+
return `${bytes} B`;
|
|
479
|
+
const kilobytes = bytes / 1024;
|
|
480
|
+
if (kilobytes < 1024)
|
|
481
|
+
return `${kilobytes.toFixed(kilobytes >= 10 ? 0 : 1)} KB`;
|
|
482
|
+
const megabytes = kilobytes / 1024;
|
|
483
|
+
return `${megabytes.toFixed(megabytes >= 10 ? 0 : 1)} MB`;
|
|
484
|
+
}
|
|
485
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUpload, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
486
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AerisFileUpload, isStandalone: true, selector: "aeris-file-upload", inputs: { files: { classPropertyName: "files", publicName: "files", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, minFileSize: { classPropertyName: "minFileSize", publicName: "minFileSize", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, maxPreviewFileSize: { classPropertyName: "maxPreviewFileSize", publicName: "maxPreviewFileSize", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, autoUpload: { classPropertyName: "autoUpload", publicName: "autoUpload", isSignal: true, isRequired: false, transformFunction: null }, customUpload: { classPropertyName: "customUpload", publicName: "customUpload", isSignal: true, isRequired: false, transformFunction: null }, dragDrop: { classPropertyName: "dragDrop", publicName: "dragDrop", isSignal: true, isRequired: false, transformFunction: null }, imagePreview: { classPropertyName: "imagePreview", publicName: "imagePreview", isSignal: true, isRequired: false, transformFunction: null }, showFileList: { classPropertyName: "showFileList", publicName: "showFileList", isSignal: true, isRequired: false, transformFunction: null }, showProgress: { classPropertyName: "showProgress", publicName: "showProgress", isSignal: true, isRequired: false, transformFunction: null }, showSize: { classPropertyName: "showSize", publicName: "showSize", isSignal: true, isRequired: false, transformFunction: null }, showUploadButton: { classPropertyName: "showUploadButton", publicName: "showUploadButton", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, chooseLabel: { classPropertyName: "chooseLabel", publicName: "chooseLabel", isSignal: true, isRequired: false, transformFunction: null }, uploadLabel: { classPropertyName: "uploadLabel", publicName: "uploadLabel", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, dropLabel: { classPropertyName: "dropLabel", publicName: "dropLabel", isSignal: true, isRequired: false, transformFunction: null }, emptyLabel: { classPropertyName: "emptyLabel", publicName: "emptyLabel", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, inputAriaLabel: { classPropertyName: "inputAriaLabel", publicName: "inputAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, fileListAriaLabel: { classPropertyName: "fileListAriaLabel", publicName: "fileListAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, removeAriaLabel: { classPropertyName: "removeAriaLabel", publicName: "removeAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, invalidFileTypeMessage: { classPropertyName: "invalidFileTypeMessage", publicName: "invalidFileTypeMessage", isSignal: true, isRequired: false, transformFunction: null }, invalidMinFileSizeMessage: { classPropertyName: "invalidMinFileSizeMessage", publicName: "invalidMinFileSizeMessage", isSignal: true, isRequired: false, transformFunction: null }, invalidMaxFileSizeMessage: { classPropertyName: "invalidMaxFileSizeMessage", publicName: "invalidMaxFileSizeMessage", isSignal: true, isRequired: false, transformFunction: null }, invalidFileLimitMessage: { classPropertyName: "invalidFileLimitMessage", publicName: "invalidFileLimitMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { files: "filesChange", selected: "selected", removed: "removed", cleared: "cleared", uploadRequested: "uploadRequested", validationFailed: "validationFailed" }, host: { properties: { "attr.data-mode": "mode()", "attr.data-disabled": "disabled() || null", "attr.data-drag-active": "dragActive() || null" }, classAttribute: "aeris-file-upload" }, queries: [{ propertyName: "toolbarTemplate", first: true, predicate: AerisFileUploadToolbarTemplate, descendants: true, isSignal: true }, { propertyName: "contentTemplate", first: true, predicate: AerisFileUploadContentTemplate, descendants: true, isSignal: true }, { propertyName: "fileTemplate", first: true, predicate: AerisFileUploadFileTemplate, descendants: true, isSignal: true }, { propertyName: "emptyTemplate", first: true, predicate: AerisFileUploadEmptyTemplate, descendants: true, isSignal: true }, { propertyName: "chooseIconTemplate", first: true, predicate: AerisFileUploadChooseIconTemplate, descendants: true, isSignal: true }, { propertyName: "uploadIconTemplate", first: true, predicate: AerisFileUploadUploadIconTemplate, descendants: true, isSignal: true }, { propertyName: "clearIconTemplate", first: true, predicate: AerisFileUploadClearIconTemplate, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
487
|
+
<input
|
|
488
|
+
#fileInput
|
|
489
|
+
class="aeris-file-upload__input"
|
|
490
|
+
type="file"
|
|
491
|
+
[id]="inputId()"
|
|
492
|
+
[attr.name]="name() || null"
|
|
493
|
+
[attr.accept]="accept() || null"
|
|
494
|
+
[attr.multiple]="multiple() ? '' : null"
|
|
495
|
+
[disabled]="disabled()"
|
|
496
|
+
[attr.aria-label]="inputAriaLabel()"
|
|
497
|
+
(change)="handleFileInput($event)"
|
|
498
|
+
/>
|
|
499
|
+
|
|
500
|
+
@if (mode() === 'basic') {
|
|
501
|
+
<div class="aeris-file-upload__basic">
|
|
502
|
+
<button
|
|
503
|
+
type="button"
|
|
504
|
+
class="aeris-file-upload__button aeris-file-upload__button--primary"
|
|
505
|
+
[disabled]="disabled()"
|
|
506
|
+
(click)="choose($event)"
|
|
507
|
+
>
|
|
508
|
+
<span class="aeris-file-upload__button-icon" aria-hidden="true">
|
|
509
|
+
@if (chooseIconTemplate(); as icon) {
|
|
510
|
+
<ng-container
|
|
511
|
+
[ngTemplateOutlet]="icon.template"
|
|
512
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
513
|
+
/>
|
|
514
|
+
} @else {
|
|
515
|
+
<span class="aeris-file-upload__icon aeris-file-upload__icon--choose"></span>
|
|
516
|
+
}
|
|
517
|
+
</span>
|
|
518
|
+
{{ chooseLabel() }}
|
|
519
|
+
</button>
|
|
520
|
+
<span class="aeris-file-upload__summary" aria-live="polite">{{ summaryText() }}</span>
|
|
521
|
+
@if (showUploadButton()) {
|
|
522
|
+
<button
|
|
523
|
+
type="button"
|
|
524
|
+
class="aeris-file-upload__button"
|
|
525
|
+
[disabled]="!canUpload()"
|
|
526
|
+
(click)="upload($event)"
|
|
527
|
+
>
|
|
528
|
+
{{ uploadLabel() }}
|
|
529
|
+
</button>
|
|
530
|
+
}
|
|
531
|
+
</div>
|
|
532
|
+
} @else {
|
|
533
|
+
<section
|
|
534
|
+
class="aeris-file-upload__surface"
|
|
535
|
+
[attr.aria-labelledby]="labelId()"
|
|
536
|
+
[attr.aria-describedby]="descriptionIds()"
|
|
537
|
+
>
|
|
538
|
+
<div class="aeris-file-upload__toolbar">
|
|
539
|
+
@if (toolbarTemplate(); as toolbar) {
|
|
540
|
+
<ng-container
|
|
541
|
+
[ngTemplateOutlet]="toolbar.template"
|
|
542
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
543
|
+
/>
|
|
544
|
+
} @else {
|
|
545
|
+
<div class="aeris-file-upload__actions">
|
|
546
|
+
<button
|
|
547
|
+
type="button"
|
|
548
|
+
class="aeris-file-upload__button aeris-file-upload__button--primary"
|
|
549
|
+
[disabled]="disabled()"
|
|
550
|
+
(click)="choose($event)"
|
|
551
|
+
>
|
|
552
|
+
<span class="aeris-file-upload__button-icon" aria-hidden="true">
|
|
553
|
+
@if (chooseIconTemplate(); as icon) {
|
|
554
|
+
<ng-container
|
|
555
|
+
[ngTemplateOutlet]="icon.template"
|
|
556
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
557
|
+
/>
|
|
558
|
+
} @else {
|
|
559
|
+
<span class="aeris-file-upload__icon aeris-file-upload__icon--choose"></span>
|
|
560
|
+
}
|
|
561
|
+
</span>
|
|
562
|
+
{{ chooseLabel() }}
|
|
563
|
+
</button>
|
|
564
|
+
|
|
565
|
+
@if (showUploadButton()) {
|
|
566
|
+
<button
|
|
567
|
+
type="button"
|
|
568
|
+
class="aeris-file-upload__button"
|
|
569
|
+
[disabled]="!canUpload()"
|
|
570
|
+
(click)="upload($event)"
|
|
571
|
+
>
|
|
572
|
+
<span class="aeris-file-upload__button-icon" aria-hidden="true">
|
|
573
|
+
@if (uploadIconTemplate(); as icon) {
|
|
574
|
+
<ng-container
|
|
575
|
+
[ngTemplateOutlet]="icon.template"
|
|
576
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
577
|
+
/>
|
|
578
|
+
} @else {
|
|
579
|
+
<span class="aeris-file-upload__icon aeris-file-upload__icon--upload"></span>
|
|
580
|
+
}
|
|
581
|
+
</span>
|
|
582
|
+
{{ uploadLabel() }}
|
|
583
|
+
</button>
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
@if (showClearButton()) {
|
|
587
|
+
<button
|
|
588
|
+
type="button"
|
|
589
|
+
class="aeris-file-upload__button"
|
|
590
|
+
[disabled]="!canClear()"
|
|
591
|
+
(click)="clear($event, 'clear-button')"
|
|
592
|
+
>
|
|
593
|
+
<span class="aeris-file-upload__button-icon" aria-hidden="true">
|
|
594
|
+
@if (clearIconTemplate(); as icon) {
|
|
595
|
+
<ng-container
|
|
596
|
+
[ngTemplateOutlet]="icon.template"
|
|
597
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
598
|
+
/>
|
|
599
|
+
} @else {
|
|
600
|
+
<span class="aeris-file-upload__icon aeris-file-upload__icon--clear"></span>
|
|
601
|
+
}
|
|
602
|
+
</span>
|
|
603
|
+
{{ clearLabel() }}
|
|
604
|
+
</button>
|
|
605
|
+
}
|
|
606
|
+
</div>
|
|
607
|
+
}
|
|
608
|
+
<span class="aeris-file-upload__summary" aria-live="polite">{{ summaryText() }}</span>
|
|
609
|
+
</div>
|
|
610
|
+
|
|
611
|
+
@if (contentTemplate(); as content) {
|
|
612
|
+
<div class="aeris-file-upload__content">
|
|
613
|
+
<ng-container
|
|
614
|
+
[ngTemplateOutlet]="content.template"
|
|
615
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
616
|
+
/>
|
|
617
|
+
</div>
|
|
618
|
+
} @else {
|
|
619
|
+
<button
|
|
620
|
+
type="button"
|
|
621
|
+
class="aeris-file-upload__dropzone"
|
|
622
|
+
[disabled]="disabled() || !dragDrop()"
|
|
623
|
+
[attr.data-active]="dragActive() || null"
|
|
624
|
+
[attr.data-reject]="dragRejected() || null"
|
|
625
|
+
(click)="choose($event)"
|
|
626
|
+
(dragenter)="handleDragEnter($event)"
|
|
627
|
+
(dragover)="handleDragOver($event)"
|
|
628
|
+
(dragleave)="handleDragLeave($event)"
|
|
629
|
+
(drop)="handleDrop($event)"
|
|
630
|
+
>
|
|
631
|
+
<span class="aeris-file-upload__drop-icon" aria-hidden="true"></span>
|
|
632
|
+
<span [id]="labelId()" class="aeris-file-upload__drop-title">{{ dropLabel() }}</span>
|
|
633
|
+
<span [id]="helpId()" class="aeris-file-upload__drop-help">{{ resolvedHelpText() }}</span>
|
|
634
|
+
</button>
|
|
635
|
+
|
|
636
|
+
@if (showFileList()) {
|
|
637
|
+
<div class="aeris-file-upload__list" role="list" [attr.aria-label]="fileListAriaLabel()">
|
|
638
|
+
@for (item of items(); track item.id) {
|
|
639
|
+
@if (fileTemplate(); as fileTemplateRef) {
|
|
640
|
+
<ng-container
|
|
641
|
+
[ngTemplateOutlet]="fileTemplateRef.template"
|
|
642
|
+
[ngTemplateOutletContext]="fileContexts()[item.id]"
|
|
643
|
+
/>
|
|
644
|
+
} @else {
|
|
645
|
+
<article class="aeris-file-upload__file" role="listitem" [attr.data-status]="item.status">
|
|
646
|
+
@if (imagePreview() && item.image && item.previewUrl) {
|
|
647
|
+
<img class="aeris-file-upload__preview" [src]="item.previewUrl" [alt]="'Preview of ' + item.name" />
|
|
648
|
+
} @else {
|
|
649
|
+
<span class="aeris-file-upload__file-icon" aria-hidden="true"></span>
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
<div class="aeris-file-upload__file-body">
|
|
653
|
+
<div class="aeris-file-upload__file-heading">
|
|
654
|
+
<span class="aeris-file-upload__file-name">{{ item.name }}</span>
|
|
655
|
+
@if (showSize()) {
|
|
656
|
+
<span class="aeris-file-upload__file-size">{{ item.displaySize }}</span>
|
|
657
|
+
}
|
|
658
|
+
</div>
|
|
659
|
+
@if (item.error) {
|
|
660
|
+
<p class="aeris-file-upload__file-error">{{ item.error }}</p>
|
|
661
|
+
}
|
|
662
|
+
@if (showProgress() && item.status === 'uploading') {
|
|
663
|
+
<div
|
|
664
|
+
class="aeris-file-upload__progress"
|
|
665
|
+
role="progressbar"
|
|
666
|
+
[attr.aria-label]="'Upload progress for ' + item.name"
|
|
667
|
+
aria-valuemin="0"
|
|
668
|
+
aria-valuemax="100"
|
|
669
|
+
[attr.aria-valuenow]="item.progress"
|
|
670
|
+
>
|
|
671
|
+
<span [style.width.%]="item.progress"></span>
|
|
672
|
+
</div>
|
|
673
|
+
}
|
|
674
|
+
</div>
|
|
675
|
+
|
|
676
|
+
<button
|
|
677
|
+
type="button"
|
|
678
|
+
class="aeris-file-upload__remove"
|
|
679
|
+
[attr.aria-label]="removeAriaLabel() + ' ' + item.name"
|
|
680
|
+
[disabled]="disabled() || item.status === 'uploading'"
|
|
681
|
+
(click)="remove(item.file, $event)"
|
|
682
|
+
>
|
|
683
|
+
<span aria-hidden="true"></span>
|
|
684
|
+
</button>
|
|
685
|
+
</article>
|
|
686
|
+
}
|
|
687
|
+
} @empty {
|
|
688
|
+
<div class="aeris-file-upload__empty">
|
|
689
|
+
@if (emptyTemplate(); as emptyTemplateRef) {
|
|
690
|
+
<ng-container
|
|
691
|
+
[ngTemplateOutlet]="emptyTemplateRef.template"
|
|
692
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
693
|
+
/>
|
|
694
|
+
} @else {
|
|
695
|
+
{{ emptyLabel() }}
|
|
696
|
+
}
|
|
697
|
+
</div>
|
|
698
|
+
}
|
|
699
|
+
</div>
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
@if (rejections().length > 0) {
|
|
704
|
+
<div class="aeris-file-upload__errors" role="alert" aria-live="assertive">
|
|
705
|
+
@for (rejection of rejections(); track rejection.file.name + rejection.reason) {
|
|
706
|
+
<p>{{ rejection.message }}</p>
|
|
707
|
+
}
|
|
708
|
+
</div>
|
|
709
|
+
}
|
|
710
|
+
</section>
|
|
711
|
+
}
|
|
712
|
+
`, isInline: true, styles: [":host{display:block;color:var(--aeris-file-upload-text, var(--aeris-text, #222222))}.aeris-file-upload__input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;border:0;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap}.aeris-file-upload__surface,.aeris-file-upload__basic{border:1px solid var(--aeris-file-upload-border, var(--aeris-border, #d9ddcf));border-radius:var(--aeris-file-upload-radius, var(--aeris-radius-lg, .875rem));background:var(--aeris-file-upload-background, var(--aeris-surface, #fff));box-shadow:var(--aeris-file-upload-shadow, 0 1px 2px rgba(20, 24, 18, .05))}.aeris-file-upload__basic{display:flex;flex-wrap:wrap;align-items:center;gap:.625rem;padding:var(--aeris-file-upload-basic-padding, .75rem)}.aeris-file-upload__toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.75rem;padding:var(--aeris-file-upload-toolbar-padding, .875rem);border-bottom:1px solid var(--aeris-file-upload-border, var(--aeris-border, #d9ddcf))}.aeris-file-upload__actions{display:flex;flex-wrap:wrap;gap:.5rem}.aeris-file-upload__button{min-height:var(--aeris-file-upload-button-height, 2.375rem);display:inline-flex;align-items:center;justify-content:center;gap:.45rem;padding:.5rem .875rem;border:1px solid var(--aeris-file-upload-button-border, var(--aeris-border, #d9ddcf));border-radius:var(--aeris-file-upload-button-radius, var(--aeris-radius-md, .625rem));background:var(--aeris-file-upload-button-background, var(--aeris-surface, #fff));color:var(--aeris-file-upload-button-text, var(--aeris-text, #222222));font:inherit;font-size:.875rem;font-weight:750;cursor:pointer;transition:border-color .16s ease,background .16s ease,color .16s ease,transform .16s ease}.aeris-file-upload__button--primary{border-color:transparent;background:var(--aeris-file-upload-primary-background, var(--aeris-primary, #6f8f3d));color:var(--aeris-file-upload-primary-text, var(--aeris-primary-contrast, #fff))}.aeris-file-upload__button:hover:not(:disabled){border-color:var(--aeris-file-upload-button-hover-border, var(--aeris-primary, #6f8f3d));background:var(--aeris-file-upload-button-hover-background, var(--aeris-surface-2, #f6f7f2))}.aeris-file-upload__button--primary:hover:not(:disabled){background:var(--aeris-file-upload-primary-hover-background, var(--aeris-primary-strong, var(--aeris-primary, #6f8f3d)));color:var(--aeris-file-upload-primary-text, var(--aeris-primary-contrast, #fff))}.aeris-file-upload__button:focus-visible,.aeris-file-upload__dropzone:focus-visible,.aeris-file-upload__remove:focus-visible{outline:2px solid var(--aeris-file-upload-focus, var(--aeris-focus, #7ca64f));outline-offset:2px}.aeris-file-upload__button:disabled,.aeris-file-upload__dropzone:disabled,.aeris-file-upload__remove:disabled{opacity:.56;cursor:not-allowed}.aeris-file-upload__button-icon{display:inline-flex;width:1rem;height:1rem;align-items:center;justify-content:center}.aeris-file-upload__summary{color:var(--aeris-file-upload-muted-text, var(--aeris-text-3, #6f7667));font-size:.8125rem;font-weight:650}.aeris-file-upload__dropzone{width:calc(100% - 1.75rem);min-height:var(--aeris-file-upload-dropzone-min-height, 10rem);display:grid;place-items:center;gap:.45rem;margin:.875rem;padding:1.5rem;border:1px dashed var(--aeris-file-upload-dropzone-border, var(--aeris-border-strong, var(--aeris-border, #d9ddcf)));border-radius:var(--aeris-file-upload-dropzone-radius, var(--aeris-radius-lg, .875rem));background:linear-gradient(135deg,color-mix(in srgb,var(--aeris-primary, #6f8f3d) 6%,transparent),transparent),var(--aeris-file-upload-dropzone-background, var(--aeris-surface-2, #f6f7f2));color:inherit;font:inherit;text-align:center;cursor:pointer;transition:border-color .16s ease,background .16s ease,transform .16s ease}.aeris-file-upload__dropzone[data-active=true]{border-color:var(--aeris-file-upload-dropzone-active-border, var(--aeris-primary, #6f8f3d));background:linear-gradient(135deg,color-mix(in srgb,var(--aeris-primary, #6f8f3d) 14%,transparent),transparent),var(--aeris-file-upload-dropzone-active-background, var(--aeris-surface, #fff));transform:translateY(-1px)}.aeris-file-upload__dropzone[data-reject=true]{border-color:var(--aeris-danger, #c81e2a)}.aeris-file-upload__drop-title{font-size:.975rem;font-weight:800}.aeris-file-upload__drop-help,.aeris-file-upload__empty,.aeris-file-upload__file-size{color:var(--aeris-file-upload-muted-text, var(--aeris-text-3, #6f7667));font-size:.8125rem}.aeris-file-upload__list{display:grid;gap:.625rem;padding:0 .875rem .875rem}.aeris-file-upload__file{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;min-width:0;padding:.75rem;border:1px solid var(--aeris-file-upload-file-border, var(--aeris-border, #d9ddcf));border-radius:var(--aeris-file-upload-file-radius, var(--aeris-radius-md, .625rem));background:var(--aeris-file-upload-file-background, var(--aeris-surface, #fff))}.aeris-file-upload__file[data-status=uploaded]{border-color:color-mix(in srgb,var(--aeris-success, #4f8f54) 34%,var(--aeris-border, #d9ddcf))}.aeris-file-upload__file[data-status=error]{border-color:color-mix(in srgb,var(--aeris-danger, #c81e2a) 42%,var(--aeris-border, #d9ddcf))}.aeris-file-upload__preview,.aeris-file-upload__file-icon{width:3rem;height:3rem;border-radius:var(--aeris-radius-md, .625rem)}.aeris-file-upload__preview{display:block;object-fit:cover;background:var(--aeris-surface-2, #f6f7f2)}.aeris-file-upload__file-icon{position:relative;display:inline-grid;place-items:center;border:1px solid var(--aeris-file-upload-border, var(--aeris-border, #d9ddcf));background:var(--aeris-surface-2, #f6f7f2)}.aeris-file-upload__file-icon:before{width:1.2rem;height:1.45rem;border:2px solid currentColor;border-radius:.18rem;color:var(--aeris-text-3, #6f7667);content:\"\"}.aeris-file-upload__file-body{min-width:0;display:grid;gap:.35rem}.aeris-file-upload__file-heading{min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:.45rem .75rem}.aeris-file-upload__file-name{min-width:0;overflow:hidden;color:var(--aeris-file-upload-text, var(--aeris-text, #222222));font-weight:800;text-overflow:ellipsis;white-space:nowrap}.aeris-file-upload__file-error{margin:0;color:var(--aeris-danger-text, #a31722);font-size:.8125rem}.aeris-file-upload__progress{height:.45rem;overflow:hidden;border-radius:999px;background:color-mix(in srgb,var(--aeris-primary, #6f8f3d) 14%,transparent)}.aeris-file-upload__progress span{display:block;height:100%;border-radius:inherit;background:var(--aeris-file-upload-progress-background, var(--aeris-primary, #6f8f3d));transition:width .18s ease}.aeris-file-upload__remove{position:relative;width:2rem;height:2rem;display:inline-grid;place-items:center;border:1px solid transparent;border-radius:999px;background:transparent;color:var(--aeris-text-3, #6f7667);cursor:pointer}.aeris-file-upload__remove:hover:not(:disabled){border-color:var(--aeris-file-upload-border, var(--aeris-border, #d9ddcf));background:var(--aeris-surface-2, #f6f7f2);color:var(--aeris-danger-text, #a31722)}.aeris-file-upload__remove span{width:var(--aeris-icon-size, 1rem);height:var(--aeris-icon-size, 1rem);display:block;background:currentColor;-webkit-mask:var(--aeris-icon-close) center/100% 100% no-repeat;mask:var(--aeris-icon-close) center/100% 100% no-repeat}.aeris-file-upload__errors{display:grid;gap:.25rem;margin:0 .875rem .875rem;padding:.75rem;border:1px solid color-mix(in srgb,var(--aeris-danger, #c81e2a) 36%,transparent);border-radius:var(--aeris-radius-md, .625rem);background:color-mix(in srgb,var(--aeris-danger, #c81e2a) 8%,transparent);color:var(--aeris-danger-text, #a31722);font-size:.8125rem}.aeris-file-upload__errors p{margin:0}.aeris-file-upload__empty{padding:.75rem;text-align:center}.aeris-file-upload__icon,.aeris-file-upload__drop-icon{display:inline-block;flex:0 0 auto;background:currentColor;color:currentColor}.aeris-file-upload__icon--choose,.aeris-file-upload__icon--upload{width:var(--aeris-icon-size, 1rem);height:var(--aeris-icon-size, 1rem)}.aeris-file-upload__icon--choose{-webkit-mask:var(--aeris-icon-plus) center/100% 100% no-repeat;mask:var(--aeris-icon-plus) center/100% 100% no-repeat}.aeris-file-upload__icon--upload{-webkit-mask:var(--aeris-icon-upload) center/100% 100% no-repeat;mask:var(--aeris-icon-upload) center/100% 100% no-repeat}.aeris-file-upload__icon--clear{width:var(--aeris-icon-size, 1rem);height:var(--aeris-icon-size, 1rem);-webkit-mask:var(--aeris-icon-close) center/100% 100% no-repeat;mask:var(--aeris-icon-close) center/100% 100% no-repeat}.aeris-file-upload__drop-icon{width:2rem;height:2rem;color:var(--aeris-primary, #6f8f3d);-webkit-mask:var(--aeris-icon-upload) center/100% 100% no-repeat;mask:var(--aeris-icon-upload) center/100% 100% no-repeat}@media(max-width:40rem){.aeris-file-upload__toolbar,.aeris-file-upload__actions,.aeris-file-upload__basic{align-items:stretch}.aeris-file-upload__toolbar,.aeris-file-upload__actions{flex-direction:column}.aeris-file-upload__button,.aeris-file-upload__summary{width:100%}.aeris-file-upload__file{grid-template-columns:minmax(0,1fr) auto}.aeris-file-upload__preview,.aeris-file-upload__file-icon{display:none}}@media(prefers-reduced-motion:reduce){.aeris-file-upload__button,.aeris-file-upload__dropzone,.aeris-file-upload__progress span{transition:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
713
|
+
}
|
|
714
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisFileUpload, decorators: [{
|
|
715
|
+
type: Component,
|
|
716
|
+
args: [{ selector: 'aeris-file-upload', imports: [NgTemplateOutlet], template: `
|
|
717
|
+
<input
|
|
718
|
+
#fileInput
|
|
719
|
+
class="aeris-file-upload__input"
|
|
720
|
+
type="file"
|
|
721
|
+
[id]="inputId()"
|
|
722
|
+
[attr.name]="name() || null"
|
|
723
|
+
[attr.accept]="accept() || null"
|
|
724
|
+
[attr.multiple]="multiple() ? '' : null"
|
|
725
|
+
[disabled]="disabled()"
|
|
726
|
+
[attr.aria-label]="inputAriaLabel()"
|
|
727
|
+
(change)="handleFileInput($event)"
|
|
728
|
+
/>
|
|
729
|
+
|
|
730
|
+
@if (mode() === 'basic') {
|
|
731
|
+
<div class="aeris-file-upload__basic">
|
|
732
|
+
<button
|
|
733
|
+
type="button"
|
|
734
|
+
class="aeris-file-upload__button aeris-file-upload__button--primary"
|
|
735
|
+
[disabled]="disabled()"
|
|
736
|
+
(click)="choose($event)"
|
|
737
|
+
>
|
|
738
|
+
<span class="aeris-file-upload__button-icon" aria-hidden="true">
|
|
739
|
+
@if (chooseIconTemplate(); as icon) {
|
|
740
|
+
<ng-container
|
|
741
|
+
[ngTemplateOutlet]="icon.template"
|
|
742
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
743
|
+
/>
|
|
744
|
+
} @else {
|
|
745
|
+
<span class="aeris-file-upload__icon aeris-file-upload__icon--choose"></span>
|
|
746
|
+
}
|
|
747
|
+
</span>
|
|
748
|
+
{{ chooseLabel() }}
|
|
749
|
+
</button>
|
|
750
|
+
<span class="aeris-file-upload__summary" aria-live="polite">{{ summaryText() }}</span>
|
|
751
|
+
@if (showUploadButton()) {
|
|
752
|
+
<button
|
|
753
|
+
type="button"
|
|
754
|
+
class="aeris-file-upload__button"
|
|
755
|
+
[disabled]="!canUpload()"
|
|
756
|
+
(click)="upload($event)"
|
|
757
|
+
>
|
|
758
|
+
{{ uploadLabel() }}
|
|
759
|
+
</button>
|
|
760
|
+
}
|
|
761
|
+
</div>
|
|
762
|
+
} @else {
|
|
763
|
+
<section
|
|
764
|
+
class="aeris-file-upload__surface"
|
|
765
|
+
[attr.aria-labelledby]="labelId()"
|
|
766
|
+
[attr.aria-describedby]="descriptionIds()"
|
|
767
|
+
>
|
|
768
|
+
<div class="aeris-file-upload__toolbar">
|
|
769
|
+
@if (toolbarTemplate(); as toolbar) {
|
|
770
|
+
<ng-container
|
|
771
|
+
[ngTemplateOutlet]="toolbar.template"
|
|
772
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
773
|
+
/>
|
|
774
|
+
} @else {
|
|
775
|
+
<div class="aeris-file-upload__actions">
|
|
776
|
+
<button
|
|
777
|
+
type="button"
|
|
778
|
+
class="aeris-file-upload__button aeris-file-upload__button--primary"
|
|
779
|
+
[disabled]="disabled()"
|
|
780
|
+
(click)="choose($event)"
|
|
781
|
+
>
|
|
782
|
+
<span class="aeris-file-upload__button-icon" aria-hidden="true">
|
|
783
|
+
@if (chooseIconTemplate(); as icon) {
|
|
784
|
+
<ng-container
|
|
785
|
+
[ngTemplateOutlet]="icon.template"
|
|
786
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
787
|
+
/>
|
|
788
|
+
} @else {
|
|
789
|
+
<span class="aeris-file-upload__icon aeris-file-upload__icon--choose"></span>
|
|
790
|
+
}
|
|
791
|
+
</span>
|
|
792
|
+
{{ chooseLabel() }}
|
|
793
|
+
</button>
|
|
794
|
+
|
|
795
|
+
@if (showUploadButton()) {
|
|
796
|
+
<button
|
|
797
|
+
type="button"
|
|
798
|
+
class="aeris-file-upload__button"
|
|
799
|
+
[disabled]="!canUpload()"
|
|
800
|
+
(click)="upload($event)"
|
|
801
|
+
>
|
|
802
|
+
<span class="aeris-file-upload__button-icon" aria-hidden="true">
|
|
803
|
+
@if (uploadIconTemplate(); as icon) {
|
|
804
|
+
<ng-container
|
|
805
|
+
[ngTemplateOutlet]="icon.template"
|
|
806
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
807
|
+
/>
|
|
808
|
+
} @else {
|
|
809
|
+
<span class="aeris-file-upload__icon aeris-file-upload__icon--upload"></span>
|
|
810
|
+
}
|
|
811
|
+
</span>
|
|
812
|
+
{{ uploadLabel() }}
|
|
813
|
+
</button>
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
@if (showClearButton()) {
|
|
817
|
+
<button
|
|
818
|
+
type="button"
|
|
819
|
+
class="aeris-file-upload__button"
|
|
820
|
+
[disabled]="!canClear()"
|
|
821
|
+
(click)="clear($event, 'clear-button')"
|
|
822
|
+
>
|
|
823
|
+
<span class="aeris-file-upload__button-icon" aria-hidden="true">
|
|
824
|
+
@if (clearIconTemplate(); as icon) {
|
|
825
|
+
<ng-container
|
|
826
|
+
[ngTemplateOutlet]="icon.template"
|
|
827
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
828
|
+
/>
|
|
829
|
+
} @else {
|
|
830
|
+
<span class="aeris-file-upload__icon aeris-file-upload__icon--clear"></span>
|
|
831
|
+
}
|
|
832
|
+
</span>
|
|
833
|
+
{{ clearLabel() }}
|
|
834
|
+
</button>
|
|
835
|
+
}
|
|
836
|
+
</div>
|
|
837
|
+
}
|
|
838
|
+
<span class="aeris-file-upload__summary" aria-live="polite">{{ summaryText() }}</span>
|
|
839
|
+
</div>
|
|
840
|
+
|
|
841
|
+
@if (contentTemplate(); as content) {
|
|
842
|
+
<div class="aeris-file-upload__content">
|
|
843
|
+
<ng-container
|
|
844
|
+
[ngTemplateOutlet]="content.template"
|
|
845
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
846
|
+
/>
|
|
847
|
+
</div>
|
|
848
|
+
} @else {
|
|
849
|
+
<button
|
|
850
|
+
type="button"
|
|
851
|
+
class="aeris-file-upload__dropzone"
|
|
852
|
+
[disabled]="disabled() || !dragDrop()"
|
|
853
|
+
[attr.data-active]="dragActive() || null"
|
|
854
|
+
[attr.data-reject]="dragRejected() || null"
|
|
855
|
+
(click)="choose($event)"
|
|
856
|
+
(dragenter)="handleDragEnter($event)"
|
|
857
|
+
(dragover)="handleDragOver($event)"
|
|
858
|
+
(dragleave)="handleDragLeave($event)"
|
|
859
|
+
(drop)="handleDrop($event)"
|
|
860
|
+
>
|
|
861
|
+
<span class="aeris-file-upload__drop-icon" aria-hidden="true"></span>
|
|
862
|
+
<span [id]="labelId()" class="aeris-file-upload__drop-title">{{ dropLabel() }}</span>
|
|
863
|
+
<span [id]="helpId()" class="aeris-file-upload__drop-help">{{ resolvedHelpText() }}</span>
|
|
864
|
+
</button>
|
|
865
|
+
|
|
866
|
+
@if (showFileList()) {
|
|
867
|
+
<div class="aeris-file-upload__list" role="list" [attr.aria-label]="fileListAriaLabel()">
|
|
868
|
+
@for (item of items(); track item.id) {
|
|
869
|
+
@if (fileTemplate(); as fileTemplateRef) {
|
|
870
|
+
<ng-container
|
|
871
|
+
[ngTemplateOutlet]="fileTemplateRef.template"
|
|
872
|
+
[ngTemplateOutletContext]="fileContexts()[item.id]"
|
|
873
|
+
/>
|
|
874
|
+
} @else {
|
|
875
|
+
<article class="aeris-file-upload__file" role="listitem" [attr.data-status]="item.status">
|
|
876
|
+
@if (imagePreview() && item.image && item.previewUrl) {
|
|
877
|
+
<img class="aeris-file-upload__preview" [src]="item.previewUrl" [alt]="'Preview of ' + item.name" />
|
|
878
|
+
} @else {
|
|
879
|
+
<span class="aeris-file-upload__file-icon" aria-hidden="true"></span>
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
<div class="aeris-file-upload__file-body">
|
|
883
|
+
<div class="aeris-file-upload__file-heading">
|
|
884
|
+
<span class="aeris-file-upload__file-name">{{ item.name }}</span>
|
|
885
|
+
@if (showSize()) {
|
|
886
|
+
<span class="aeris-file-upload__file-size">{{ item.displaySize }}</span>
|
|
887
|
+
}
|
|
888
|
+
</div>
|
|
889
|
+
@if (item.error) {
|
|
890
|
+
<p class="aeris-file-upload__file-error">{{ item.error }}</p>
|
|
891
|
+
}
|
|
892
|
+
@if (showProgress() && item.status === 'uploading') {
|
|
893
|
+
<div
|
|
894
|
+
class="aeris-file-upload__progress"
|
|
895
|
+
role="progressbar"
|
|
896
|
+
[attr.aria-label]="'Upload progress for ' + item.name"
|
|
897
|
+
aria-valuemin="0"
|
|
898
|
+
aria-valuemax="100"
|
|
899
|
+
[attr.aria-valuenow]="item.progress"
|
|
900
|
+
>
|
|
901
|
+
<span [style.width.%]="item.progress"></span>
|
|
902
|
+
</div>
|
|
903
|
+
}
|
|
904
|
+
</div>
|
|
905
|
+
|
|
906
|
+
<button
|
|
907
|
+
type="button"
|
|
908
|
+
class="aeris-file-upload__remove"
|
|
909
|
+
[attr.aria-label]="removeAriaLabel() + ' ' + item.name"
|
|
910
|
+
[disabled]="disabled() || item.status === 'uploading'"
|
|
911
|
+
(click)="remove(item.file, $event)"
|
|
912
|
+
>
|
|
913
|
+
<span aria-hidden="true"></span>
|
|
914
|
+
</button>
|
|
915
|
+
</article>
|
|
916
|
+
}
|
|
917
|
+
} @empty {
|
|
918
|
+
<div class="aeris-file-upload__empty">
|
|
919
|
+
@if (emptyTemplate(); as emptyTemplateRef) {
|
|
920
|
+
<ng-container
|
|
921
|
+
[ngTemplateOutlet]="emptyTemplateRef.template"
|
|
922
|
+
[ngTemplateOutletContext]="templateContext()"
|
|
923
|
+
/>
|
|
924
|
+
} @else {
|
|
925
|
+
{{ emptyLabel() }}
|
|
926
|
+
}
|
|
927
|
+
</div>
|
|
928
|
+
}
|
|
929
|
+
</div>
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
@if (rejections().length > 0) {
|
|
934
|
+
<div class="aeris-file-upload__errors" role="alert" aria-live="assertive">
|
|
935
|
+
@for (rejection of rejections(); track rejection.file.name + rejection.reason) {
|
|
936
|
+
<p>{{ rejection.message }}</p>
|
|
937
|
+
}
|
|
938
|
+
</div>
|
|
939
|
+
}
|
|
940
|
+
</section>
|
|
941
|
+
}
|
|
942
|
+
`, host: {
|
|
943
|
+
class: 'aeris-file-upload',
|
|
944
|
+
'[attr.data-mode]': 'mode()',
|
|
945
|
+
'[attr.data-disabled]': 'disabled() || null',
|
|
946
|
+
'[attr.data-drag-active]': 'dragActive() || null',
|
|
947
|
+
}, styles: [":host{display:block;color:var(--aeris-file-upload-text, var(--aeris-text, #222222))}.aeris-file-upload__input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;border:0;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap}.aeris-file-upload__surface,.aeris-file-upload__basic{border:1px solid var(--aeris-file-upload-border, var(--aeris-border, #d9ddcf));border-radius:var(--aeris-file-upload-radius, var(--aeris-radius-lg, .875rem));background:var(--aeris-file-upload-background, var(--aeris-surface, #fff));box-shadow:var(--aeris-file-upload-shadow, 0 1px 2px rgba(20, 24, 18, .05))}.aeris-file-upload__basic{display:flex;flex-wrap:wrap;align-items:center;gap:.625rem;padding:var(--aeris-file-upload-basic-padding, .75rem)}.aeris-file-upload__toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.75rem;padding:var(--aeris-file-upload-toolbar-padding, .875rem);border-bottom:1px solid var(--aeris-file-upload-border, var(--aeris-border, #d9ddcf))}.aeris-file-upload__actions{display:flex;flex-wrap:wrap;gap:.5rem}.aeris-file-upload__button{min-height:var(--aeris-file-upload-button-height, 2.375rem);display:inline-flex;align-items:center;justify-content:center;gap:.45rem;padding:.5rem .875rem;border:1px solid var(--aeris-file-upload-button-border, var(--aeris-border, #d9ddcf));border-radius:var(--aeris-file-upload-button-radius, var(--aeris-radius-md, .625rem));background:var(--aeris-file-upload-button-background, var(--aeris-surface, #fff));color:var(--aeris-file-upload-button-text, var(--aeris-text, #222222));font:inherit;font-size:.875rem;font-weight:750;cursor:pointer;transition:border-color .16s ease,background .16s ease,color .16s ease,transform .16s ease}.aeris-file-upload__button--primary{border-color:transparent;background:var(--aeris-file-upload-primary-background, var(--aeris-primary, #6f8f3d));color:var(--aeris-file-upload-primary-text, var(--aeris-primary-contrast, #fff))}.aeris-file-upload__button:hover:not(:disabled){border-color:var(--aeris-file-upload-button-hover-border, var(--aeris-primary, #6f8f3d));background:var(--aeris-file-upload-button-hover-background, var(--aeris-surface-2, #f6f7f2))}.aeris-file-upload__button--primary:hover:not(:disabled){background:var(--aeris-file-upload-primary-hover-background, var(--aeris-primary-strong, var(--aeris-primary, #6f8f3d)));color:var(--aeris-file-upload-primary-text, var(--aeris-primary-contrast, #fff))}.aeris-file-upload__button:focus-visible,.aeris-file-upload__dropzone:focus-visible,.aeris-file-upload__remove:focus-visible{outline:2px solid var(--aeris-file-upload-focus, var(--aeris-focus, #7ca64f));outline-offset:2px}.aeris-file-upload__button:disabled,.aeris-file-upload__dropzone:disabled,.aeris-file-upload__remove:disabled{opacity:.56;cursor:not-allowed}.aeris-file-upload__button-icon{display:inline-flex;width:1rem;height:1rem;align-items:center;justify-content:center}.aeris-file-upload__summary{color:var(--aeris-file-upload-muted-text, var(--aeris-text-3, #6f7667));font-size:.8125rem;font-weight:650}.aeris-file-upload__dropzone{width:calc(100% - 1.75rem);min-height:var(--aeris-file-upload-dropzone-min-height, 10rem);display:grid;place-items:center;gap:.45rem;margin:.875rem;padding:1.5rem;border:1px dashed var(--aeris-file-upload-dropzone-border, var(--aeris-border-strong, var(--aeris-border, #d9ddcf)));border-radius:var(--aeris-file-upload-dropzone-radius, var(--aeris-radius-lg, .875rem));background:linear-gradient(135deg,color-mix(in srgb,var(--aeris-primary, #6f8f3d) 6%,transparent),transparent),var(--aeris-file-upload-dropzone-background, var(--aeris-surface-2, #f6f7f2));color:inherit;font:inherit;text-align:center;cursor:pointer;transition:border-color .16s ease,background .16s ease,transform .16s ease}.aeris-file-upload__dropzone[data-active=true]{border-color:var(--aeris-file-upload-dropzone-active-border, var(--aeris-primary, #6f8f3d));background:linear-gradient(135deg,color-mix(in srgb,var(--aeris-primary, #6f8f3d) 14%,transparent),transparent),var(--aeris-file-upload-dropzone-active-background, var(--aeris-surface, #fff));transform:translateY(-1px)}.aeris-file-upload__dropzone[data-reject=true]{border-color:var(--aeris-danger, #c81e2a)}.aeris-file-upload__drop-title{font-size:.975rem;font-weight:800}.aeris-file-upload__drop-help,.aeris-file-upload__empty,.aeris-file-upload__file-size{color:var(--aeris-file-upload-muted-text, var(--aeris-text-3, #6f7667));font-size:.8125rem}.aeris-file-upload__list{display:grid;gap:.625rem;padding:0 .875rem .875rem}.aeris-file-upload__file{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;min-width:0;padding:.75rem;border:1px solid var(--aeris-file-upload-file-border, var(--aeris-border, #d9ddcf));border-radius:var(--aeris-file-upload-file-radius, var(--aeris-radius-md, .625rem));background:var(--aeris-file-upload-file-background, var(--aeris-surface, #fff))}.aeris-file-upload__file[data-status=uploaded]{border-color:color-mix(in srgb,var(--aeris-success, #4f8f54) 34%,var(--aeris-border, #d9ddcf))}.aeris-file-upload__file[data-status=error]{border-color:color-mix(in srgb,var(--aeris-danger, #c81e2a) 42%,var(--aeris-border, #d9ddcf))}.aeris-file-upload__preview,.aeris-file-upload__file-icon{width:3rem;height:3rem;border-radius:var(--aeris-radius-md, .625rem)}.aeris-file-upload__preview{display:block;object-fit:cover;background:var(--aeris-surface-2, #f6f7f2)}.aeris-file-upload__file-icon{position:relative;display:inline-grid;place-items:center;border:1px solid var(--aeris-file-upload-border, var(--aeris-border, #d9ddcf));background:var(--aeris-surface-2, #f6f7f2)}.aeris-file-upload__file-icon:before{width:1.2rem;height:1.45rem;border:2px solid currentColor;border-radius:.18rem;color:var(--aeris-text-3, #6f7667);content:\"\"}.aeris-file-upload__file-body{min-width:0;display:grid;gap:.35rem}.aeris-file-upload__file-heading{min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:.45rem .75rem}.aeris-file-upload__file-name{min-width:0;overflow:hidden;color:var(--aeris-file-upload-text, var(--aeris-text, #222222));font-weight:800;text-overflow:ellipsis;white-space:nowrap}.aeris-file-upload__file-error{margin:0;color:var(--aeris-danger-text, #a31722);font-size:.8125rem}.aeris-file-upload__progress{height:.45rem;overflow:hidden;border-radius:999px;background:color-mix(in srgb,var(--aeris-primary, #6f8f3d) 14%,transparent)}.aeris-file-upload__progress span{display:block;height:100%;border-radius:inherit;background:var(--aeris-file-upload-progress-background, var(--aeris-primary, #6f8f3d));transition:width .18s ease}.aeris-file-upload__remove{position:relative;width:2rem;height:2rem;display:inline-grid;place-items:center;border:1px solid transparent;border-radius:999px;background:transparent;color:var(--aeris-text-3, #6f7667);cursor:pointer}.aeris-file-upload__remove:hover:not(:disabled){border-color:var(--aeris-file-upload-border, var(--aeris-border, #d9ddcf));background:var(--aeris-surface-2, #f6f7f2);color:var(--aeris-danger-text, #a31722)}.aeris-file-upload__remove span{width:var(--aeris-icon-size, 1rem);height:var(--aeris-icon-size, 1rem);display:block;background:currentColor;-webkit-mask:var(--aeris-icon-close) center/100% 100% no-repeat;mask:var(--aeris-icon-close) center/100% 100% no-repeat}.aeris-file-upload__errors{display:grid;gap:.25rem;margin:0 .875rem .875rem;padding:.75rem;border:1px solid color-mix(in srgb,var(--aeris-danger, #c81e2a) 36%,transparent);border-radius:var(--aeris-radius-md, .625rem);background:color-mix(in srgb,var(--aeris-danger, #c81e2a) 8%,transparent);color:var(--aeris-danger-text, #a31722);font-size:.8125rem}.aeris-file-upload__errors p{margin:0}.aeris-file-upload__empty{padding:.75rem;text-align:center}.aeris-file-upload__icon,.aeris-file-upload__drop-icon{display:inline-block;flex:0 0 auto;background:currentColor;color:currentColor}.aeris-file-upload__icon--choose,.aeris-file-upload__icon--upload{width:var(--aeris-icon-size, 1rem);height:var(--aeris-icon-size, 1rem)}.aeris-file-upload__icon--choose{-webkit-mask:var(--aeris-icon-plus) center/100% 100% no-repeat;mask:var(--aeris-icon-plus) center/100% 100% no-repeat}.aeris-file-upload__icon--upload{-webkit-mask:var(--aeris-icon-upload) center/100% 100% no-repeat;mask:var(--aeris-icon-upload) center/100% 100% no-repeat}.aeris-file-upload__icon--clear{width:var(--aeris-icon-size, 1rem);height:var(--aeris-icon-size, 1rem);-webkit-mask:var(--aeris-icon-close) center/100% 100% no-repeat;mask:var(--aeris-icon-close) center/100% 100% no-repeat}.aeris-file-upload__drop-icon{width:2rem;height:2rem;color:var(--aeris-primary, #6f8f3d);-webkit-mask:var(--aeris-icon-upload) center/100% 100% no-repeat;mask:var(--aeris-icon-upload) center/100% 100% no-repeat}@media(max-width:40rem){.aeris-file-upload__toolbar,.aeris-file-upload__actions,.aeris-file-upload__basic{align-items:stretch}.aeris-file-upload__toolbar,.aeris-file-upload__actions{flex-direction:column}.aeris-file-upload__button,.aeris-file-upload__summary{width:100%}.aeris-file-upload__file{grid-template-columns:minmax(0,1fr) auto}.aeris-file-upload__preview,.aeris-file-upload__file-icon{display:none}}@media(prefers-reduced-motion:reduce){.aeris-file-upload__button,.aeris-file-upload__dropzone,.aeris-file-upload__progress span{transition:none}}\n"] }]
|
|
948
|
+
}], ctorParameters: () => [], propDecorators: { fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }], toolbarTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => AerisFileUploadToolbarTemplate), { isSignal: true }] }], contentTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => AerisFileUploadContentTemplate), { isSignal: true }] }], fileTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => AerisFileUploadFileTemplate), { isSignal: true }] }], emptyTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => AerisFileUploadEmptyTemplate), { isSignal: true }] }], chooseIconTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => AerisFileUploadChooseIconTemplate), { isSignal: true }] }], uploadIconTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => AerisFileUploadUploadIconTemplate), { isSignal: true }] }], clearIconTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => AerisFileUploadClearIconTemplate), { isSignal: true }] }], files: [{ type: i0.Input, args: [{ isSignal: true, alias: "files", required: false }] }, { type: i0.Output, args: ["filesChange"] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], minFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "minFileSize", required: false }] }], maxFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFileSize", required: false }] }], maxPreviewFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxPreviewFileSize", required: false }] }], maxFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFiles", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], autoUpload: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoUpload", required: false }] }], customUpload: [{ type: i0.Input, args: [{ isSignal: true, alias: "customUpload", required: false }] }], dragDrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragDrop", required: false }] }], imagePreview: [{ type: i0.Input, args: [{ isSignal: true, alias: "imagePreview", required: false }] }], showFileList: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFileList", required: false }] }], showProgress: [{ type: i0.Input, args: [{ isSignal: true, alias: "showProgress", required: false }] }], showSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSize", required: false }] }], showUploadButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showUploadButton", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], chooseLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "chooseLabel", required: false }] }], uploadLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "uploadLabel", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], dropLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropLabel", required: false }] }], emptyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyLabel", required: false }] }], helperText: [{ type: i0.Input, args: [{ isSignal: true, alias: "helperText", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], inputAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputAriaLabel", required: false }] }], fileListAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileListAriaLabel", required: false }] }], removeAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeAriaLabel", required: false }] }], invalidFileTypeMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalidFileTypeMessage", required: false }] }], invalidMinFileSizeMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalidMinFileSizeMessage", required: false }] }], invalidMaxFileSizeMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalidMaxFileSizeMessage", required: false }] }], invalidFileLimitMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalidFileLimitMessage", required: false }] }], selected: [{ type: i0.Output, args: ["selected"] }], removed: [{ type: i0.Output, args: ["removed"] }], cleared: [{ type: i0.Output, args: ["cleared"] }], uploadRequested: [{ type: i0.Output, args: ["uploadRequested"] }], validationFailed: [{ type: i0.Output, args: ["validationFailed"] }] } });
|
|
949
|
+
const AerisFileUploadModule = [
|
|
950
|
+
AerisFileUpload,
|
|
951
|
+
AerisFileUploadToolbarTemplate,
|
|
952
|
+
AerisFileUploadContentTemplate,
|
|
953
|
+
AerisFileUploadFileTemplate,
|
|
954
|
+
AerisFileUploadEmptyTemplate,
|
|
955
|
+
AerisFileUploadChooseIconTemplate,
|
|
956
|
+
AerisFileUploadUploadIconTemplate,
|
|
957
|
+
AerisFileUploadClearIconTemplate,
|
|
958
|
+
];
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Generated bundle index. Do not edit.
|
|
962
|
+
*/
|
|
963
|
+
|
|
964
|
+
export { AerisFileUpload, AerisFileUploadChooseIconTemplate, AerisFileUploadClearIconTemplate, AerisFileUploadContentTemplate, AerisFileUploadEmptyTemplate, AerisFileUploadFileTemplate, AerisFileUploadModule, AerisFileUploadToolbarTemplate, AerisFileUploadUploadIconTemplate };
|
|
965
|
+
//# sourceMappingURL=aeris-ui-core-file-upload.mjs.map
|