@acorex/components 20.1.29 → 20.1.32
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/code-editor/README.md +3 -0
- package/code-editor/index.d.ts +103 -0
- package/comment/index.d.ts +4 -5
- package/conversation/index.d.ts +106 -78
- package/data-pager/index.d.ts +12 -12
- package/data-table/index.d.ts +1 -1
- package/datetime-box/index.d.ts +10 -10
- package/drawer-2/index.d.ts +7 -8
- package/dropdown/index.d.ts +3 -3
- package/fesm2022/acorex-components-accordion.mjs +10 -10
- package/fesm2022/acorex-components-accordion.mjs.map +1 -1
- package/fesm2022/acorex-components-action-sheet.mjs +10 -10
- package/fesm2022/acorex-components-action-sheet.mjs.map +1 -1
- package/fesm2022/acorex-components-alert.mjs +7 -7
- package/fesm2022/acorex-components-alert.mjs.map +1 -1
- package/fesm2022/acorex-components-audio-wave.mjs +7 -7
- package/fesm2022/acorex-components-audio-wave.mjs.map +1 -1
- package/fesm2022/acorex-components-autocomplete.mjs +7 -7
- package/fesm2022/acorex-components-autocomplete.mjs.map +1 -1
- package/fesm2022/acorex-components-avatar.mjs +10 -10
- package/fesm2022/acorex-components-avatar.mjs.map +1 -1
- package/fesm2022/acorex-components-badge.mjs +7 -7
- package/fesm2022/acorex-components-badge.mjs.map +1 -1
- package/fesm2022/acorex-components-bottom-navigation.mjs +10 -10
- package/fesm2022/acorex-components-bottom-navigation.mjs.map +1 -1
- package/fesm2022/acorex-components-breadcrumbs.mjs +10 -10
- package/fesm2022/acorex-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/acorex-components-button-group.mjs +10 -10
- package/fesm2022/acorex-components-button-group.mjs.map +1 -1
- package/fesm2022/acorex-components-button.mjs +13 -13
- package/fesm2022/acorex-components-button.mjs.map +1 -1
- package/fesm2022/acorex-components-calendar.mjs +13 -13
- package/fesm2022/acorex-components-calendar.mjs.map +1 -1
- package/fesm2022/acorex-components-check-box.mjs +7 -7
- package/fesm2022/acorex-components-check-box.mjs.map +1 -1
- package/fesm2022/acorex-components-chips.mjs +7 -7
- package/fesm2022/acorex-components-chips.mjs.map +1 -1
- package/fesm2022/acorex-components-circular-progress.mjs +7 -7
- package/fesm2022/acorex-components-circular-progress.mjs.map +1 -1
- package/fesm2022/acorex-components-code-editor.mjs +591 -0
- package/fesm2022/acorex-components-code-editor.mjs.map +1 -0
- package/fesm2022/acorex-components-collapse.mjs +10 -10
- package/fesm2022/acorex-components-collapse.mjs.map +1 -1
- package/fesm2022/acorex-components-color-box.mjs +7 -7
- package/fesm2022/acorex-components-color-box.mjs.map +1 -1
- package/fesm2022/acorex-components-color-palette.mjs +30 -30
- package/fesm2022/acorex-components-color-palette.mjs.map +1 -1
- package/fesm2022/acorex-components-comment.mjs +36 -36
- package/fesm2022/acorex-components-comment.mjs.map +1 -1
- package/fesm2022/acorex-components-conversation.mjs +119 -87
- package/fesm2022/acorex-components-conversation.mjs.map +1 -1
- package/fesm2022/acorex-components-cron-job.mjs +46 -46
- package/fesm2022/acorex-components-cron-job.mjs.map +1 -1
- package/fesm2022/acorex-components-data-pager.mjs +31 -31
- package/fesm2022/acorex-components-data-pager.mjs.map +1 -1
- package/fesm2022/acorex-components-data-table.mjs +37 -37
- package/fesm2022/acorex-components-data-table.mjs.map +1 -1
- package/fesm2022/acorex-components-datetime-box.mjs +11 -11
- package/fesm2022/acorex-components-datetime-box.mjs.map +1 -1
- package/fesm2022/acorex-components-datetime-input.mjs +7 -7
- package/fesm2022/acorex-components-datetime-input.mjs.map +1 -1
- package/fesm2022/acorex-components-datetime-picker.mjs +7 -7
- package/fesm2022/acorex-components-datetime-picker.mjs.map +1 -1
- package/fesm2022/acorex-components-decorators.mjs +25 -25
- package/fesm2022/acorex-components-decorators.mjs.map +1 -1
- package/fesm2022/acorex-components-dialog.mjs +10 -10
- package/fesm2022/acorex-components-dialog.mjs.map +1 -1
- package/fesm2022/acorex-components-drawer-2.mjs +13 -14
- package/fesm2022/acorex-components-drawer-2.mjs.map +1 -1
- package/fesm2022/acorex-components-drawer.mjs +13 -13
- package/fesm2022/acorex-components-drawer.mjs.map +1 -1
- package/fesm2022/acorex-components-dropdown-button.mjs +7 -7
- package/fesm2022/acorex-components-dropdown-button.mjs.map +1 -1
- package/fesm2022/acorex-components-dropdown.mjs +13 -13
- package/fesm2022/acorex-components-dropdown.mjs.map +1 -1
- package/fesm2022/acorex-components-file-explorer.mjs +25 -25
- package/fesm2022/acorex-components-file-explorer.mjs.map +1 -1
- package/fesm2022/acorex-components-flow-chart.mjs +16 -16
- package/fesm2022/acorex-components-flow-chart.mjs.map +1 -1
- package/fesm2022/acorex-components-form.mjs +16 -16
- package/fesm2022/acorex-components-form.mjs.map +1 -1
- package/fesm2022/acorex-components-grid-layout-builder.mjs +10 -10
- package/fesm2022/acorex-components-grid-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-components-image-editor.mjs +40 -34
- package/fesm2022/acorex-components-image-editor.mjs.map +1 -1
- package/fesm2022/acorex-components-image.mjs +7 -7
- package/fesm2022/acorex-components-image.mjs.map +1 -1
- package/fesm2022/acorex-components-json-viewer.mjs +7 -7
- package/fesm2022/acorex-components-json-viewer.mjs.map +1 -1
- package/fesm2022/acorex-components-kanban.mjs +3 -3
- package/fesm2022/acorex-components-kanban.mjs.map +1 -1
- package/fesm2022/acorex-components-kbd.mjs +6 -6
- package/fesm2022/acorex-components-kbd.mjs.map +1 -1
- package/fesm2022/acorex-components-label.mjs +7 -7
- package/fesm2022/acorex-components-label.mjs.map +1 -1
- package/fesm2022/acorex-components-list.mjs +7 -7
- package/fesm2022/acorex-components-list.mjs.map +1 -1
- package/fesm2022/acorex-components-loading-dialog.mjs +10 -10
- package/fesm2022/acorex-components-loading-dialog.mjs.map +1 -1
- package/fesm2022/acorex-components-loading.mjs +16 -16
- package/fesm2022/acorex-components-loading.mjs.map +1 -1
- package/fesm2022/acorex-components-map.mjs +13 -13
- package/fesm2022/acorex-components-map.mjs.map +1 -1
- package/fesm2022/acorex-components-media-viewer.mjs +34 -34
- package/fesm2022/acorex-components-media-viewer.mjs.map +1 -1
- package/fesm2022/acorex-components-menu.mjs +19 -19
- package/fesm2022/acorex-components-menu.mjs.map +1 -1
- package/fesm2022/{acorex-components-modal-acorex-components-modal-CmzrV-vD.mjs → acorex-components-modal-acorex-components-modal-BdrQgtUV.mjs} +21 -21
- package/fesm2022/{acorex-components-modal-acorex-components-modal-CmzrV-vD.mjs.map → acorex-components-modal-acorex-components-modal-BdrQgtUV.mjs.map} +1 -1
- package/fesm2022/{acorex-components-modal-modal-content.component-CaZfLUuL.mjs → acorex-components-modal-modal-content.component-DTrjX50k.mjs} +24 -8
- package/fesm2022/acorex-components-modal-modal-content.component-DTrjX50k.mjs.map +1 -0
- package/fesm2022/acorex-components-modal.mjs +1 -1
- package/fesm2022/acorex-components-navbar.mjs +7 -7
- package/fesm2022/acorex-components-navbar.mjs.map +1 -1
- package/fesm2022/acorex-components-notification.mjs +10 -10
- package/fesm2022/acorex-components-notification.mjs.map +1 -1
- package/fesm2022/acorex-components-number-box-2.mjs +8 -5
- package/fesm2022/acorex-components-number-box-2.mjs.map +1 -1
- package/fesm2022/acorex-components-number-box.mjs +7 -7
- package/fesm2022/acorex-components-number-box.mjs.map +1 -1
- package/fesm2022/acorex-components-otp.mjs +7 -7
- package/fesm2022/acorex-components-otp.mjs.map +1 -1
- package/fesm2022/acorex-components-page.mjs +10 -10
- package/fesm2022/acorex-components-page.mjs.map +1 -1
- package/fesm2022/acorex-components-paint.mjs +27 -27
- package/fesm2022/acorex-components-paint.mjs.map +1 -1
- package/fesm2022/acorex-components-password-box.mjs +13 -16
- package/fesm2022/acorex-components-password-box.mjs.map +1 -1
- package/fesm2022/acorex-components-pdf-reader.mjs +7 -7
- package/fesm2022/acorex-components-pdf-reader.mjs.map +1 -1
- package/fesm2022/acorex-components-phone-box.mjs +7 -7
- package/fesm2022/acorex-components-phone-box.mjs.map +1 -1
- package/fesm2022/acorex-components-picker.mjs +13 -13
- package/fesm2022/acorex-components-picker.mjs.map +1 -1
- package/fesm2022/acorex-components-popover.mjs +7 -7
- package/fesm2022/acorex-components-popover.mjs.map +1 -1
- package/fesm2022/acorex-components-popup.mjs +10 -10
- package/fesm2022/acorex-components-popup.mjs.map +1 -1
- package/fesm2022/acorex-components-progress-bar.mjs +7 -7
- package/fesm2022/acorex-components-progress-bar.mjs.map +1 -1
- package/fesm2022/acorex-components-qrcode.mjs +7 -7
- package/fesm2022/acorex-components-qrcode.mjs.map +1 -1
- package/fesm2022/acorex-components-query-builder.mjs +7 -7
- package/fesm2022/acorex-components-query-builder.mjs.map +1 -1
- package/fesm2022/acorex-components-radio.mjs +7 -7
- package/fesm2022/acorex-components-radio.mjs.map +1 -1
- package/fesm2022/acorex-components-rail-navigation.mjs +13 -13
- package/fesm2022/acorex-components-rail-navigation.mjs.map +1 -1
- package/fesm2022/acorex-components-range-slider.mjs +11 -7
- package/fesm2022/acorex-components-range-slider.mjs.map +1 -1
- package/fesm2022/acorex-components-rate-picker.mjs +7 -7
- package/fesm2022/acorex-components-rate-picker.mjs.map +1 -1
- package/fesm2022/acorex-components-rest-api-generator.mjs +22 -22
- package/fesm2022/acorex-components-rest-api-generator.mjs.map +1 -1
- package/fesm2022/acorex-components-result.mjs +7 -7
- package/fesm2022/acorex-components-result.mjs.map +1 -1
- package/fesm2022/acorex-components-routing-progress.mjs +7 -7
- package/fesm2022/acorex-components-routing-progress.mjs.map +1 -1
- package/fesm2022/acorex-components-rrule.mjs +6 -6
- package/fesm2022/acorex-components-rrule.mjs.map +1 -1
- package/fesm2022/acorex-components-scheduler.mjs +31 -31
- package/fesm2022/acorex-components-scheduler.mjs.map +1 -1
- package/fesm2022/acorex-components-scss.mjs +4 -4
- package/fesm2022/acorex-components-scss.mjs.map +1 -1
- package/fesm2022/acorex-components-search-box.mjs +7 -7
- package/fesm2022/acorex-components-search-box.mjs.map +1 -1
- package/fesm2022/acorex-components-select-box.mjs +7 -7
- package/fesm2022/acorex-components-select-box.mjs.map +1 -1
- package/fesm2022/acorex-components-selection-list-2.mjs +8 -8
- package/fesm2022/acorex-components-selection-list-2.mjs.map +1 -1
- package/fesm2022/acorex-components-selection-list.mjs +7 -7
- package/fesm2022/acorex-components-selection-list.mjs.map +1 -1
- package/fesm2022/acorex-components-side-menu.mjs +13 -13
- package/fesm2022/acorex-components-side-menu.mjs.map +1 -1
- package/fesm2022/acorex-components-skeleton.mjs +7 -7
- package/fesm2022/acorex-components-skeleton.mjs.map +1 -1
- package/fesm2022/acorex-components-slider.mjs +7 -7
- package/fesm2022/acorex-components-slider.mjs.map +1 -1
- package/fesm2022/acorex-components-sliding-item.mjs +15 -15
- package/fesm2022/acorex-components-sliding-item.mjs.map +1 -1
- package/fesm2022/acorex-components-step-wizard.mjs +13 -13
- package/fesm2022/acorex-components-step-wizard.mjs.map +1 -1
- package/fesm2022/acorex-components-switch.mjs +10 -10
- package/fesm2022/acorex-components-switch.mjs.map +1 -1
- package/fesm2022/acorex-components-tabs.mjs +13 -13
- package/fesm2022/acorex-components-tabs.mjs.map +1 -1
- package/fesm2022/acorex-components-tag-box.mjs +23 -7
- package/fesm2022/acorex-components-tag-box.mjs.map +1 -1
- package/fesm2022/acorex-components-tag.mjs +7 -7
- package/fesm2022/acorex-components-tag.mjs.map +1 -1
- package/fesm2022/acorex-components-text-area.mjs +8 -9
- package/fesm2022/acorex-components-text-area.mjs.map +1 -1
- package/fesm2022/acorex-components-text-box.mjs +10 -10
- package/fesm2022/acorex-components-text-box.mjs.map +1 -1
- package/fesm2022/acorex-components-time-duration.mjs +7 -7
- package/fesm2022/acorex-components-time-duration.mjs.map +1 -1
- package/fesm2022/acorex-components-time-line.mjs +13 -10
- package/fesm2022/acorex-components-time-line.mjs.map +1 -1
- package/fesm2022/acorex-components-toast.mjs +57 -12
- package/fesm2022/acorex-components-toast.mjs.map +1 -1
- package/fesm2022/acorex-components-toolbar.mjs +7 -7
- package/fesm2022/acorex-components-toolbar.mjs.map +1 -1
- package/fesm2022/acorex-components-tooltip.mjs +10 -10
- package/fesm2022/acorex-components-tooltip.mjs.map +1 -1
- package/fesm2022/acorex-components-tree-view.mjs +10 -10
- package/fesm2022/acorex-components-tree-view.mjs.map +1 -1
- package/fesm2022/acorex-components-uploader.mjs +252 -56
- package/fesm2022/acorex-components-uploader.mjs.map +1 -1
- package/fesm2022/acorex-components-video-player.mjs +7 -7
- package/fesm2022/acorex-components-video-player.mjs.map +1 -1
- package/fesm2022/acorex-components-wysiwyg.mjs +31 -31
- package/fesm2022/acorex-components-wysiwyg.mjs.map +1 -1
- package/form/index.d.ts +13 -13
- package/image/index.d.ts +4 -4
- package/image-editor/index.d.ts +10 -4
- package/menu/index.d.ts +6 -6
- package/modal/index.d.ts +1 -0
- package/number-box-2/index.d.ts +1 -1
- package/package.json +40 -16
- package/paint/index.d.ts +5 -5
- package/password-box/index.d.ts +2 -5
- package/phone-box/index.d.ts +7 -8
- package/popover/index.d.ts +1 -1
- package/popup/index.d.ts +2 -2
- package/qrcode/index.d.ts +7 -7
- package/query-builder/index.d.ts +1 -1
- package/range-slider/index.d.ts +13 -13
- package/rate-picker/index.d.ts +4 -4
- package/rest-api-generator/index.d.ts +1 -1
- package/result/index.d.ts +2 -2
- package/search-box/index.d.ts +2 -2
- package/select-box/index.d.ts +2 -2
- package/selection-list-2/index.d.ts +3 -3
- package/side-menu/index.d.ts +9 -9
- package/sliding-item/index.d.ts +4 -5
- package/tag-box/index.d.ts +16 -0
- package/text-area/index.d.ts +1 -2
- package/time-line/index.d.ts +3 -0
- package/toast/index.d.ts +45 -1
- package/uploader/index.d.ts +215 -5
- package/fesm2022/acorex-components-modal-modal-content.component-CaZfLUuL.mjs.map +0 -1
@@ -6,7 +6,7 @@ import { isPlatformBrowser, AsyncPipe, NgClass, CommonModule } from '@angular/co
|
|
6
6
|
import { AXPopupService, AXPopupModule } from '@acorex/components/popup';
|
7
7
|
import { AXFileService, AXFileModule } from '@acorex/core/file';
|
8
8
|
import { sumBy } from 'lodash-es';
|
9
|
-
import { Subject, BehaviorSubject,
|
9
|
+
import { Subject, BehaviorSubject, map } from 'rxjs';
|
10
10
|
import { AXComponent, AXClosableComponent, MXBaseComponent } from '@acorex/cdk/common';
|
11
11
|
import { trigger, state, transition, style, AUTO_STYLE, animate } from '@angular/animations';
|
12
12
|
import { AXProgressBarComponent, AXProgressBarModule } from '@acorex/components/progress-bar';
|
@@ -114,29 +114,67 @@ class AXUploadRequest {
|
|
114
114
|
}
|
115
115
|
}
|
116
116
|
|
117
|
+
/**
|
118
|
+
* Service for managing file uploads with drag-and-drop support, progress tracking, and dialog management.
|
119
|
+
* @category Services
|
120
|
+
*/
|
117
121
|
class AXUploaderService {
|
118
122
|
constructor() {
|
123
|
+
/**
|
124
|
+
* Popup service for showing upload dialogs.
|
125
|
+
* @ignore
|
126
|
+
*/
|
119
127
|
this.popupService = inject(AXPopupService);
|
128
|
+
/**
|
129
|
+
* Translation service for localized text.
|
130
|
+
* @ignore
|
131
|
+
*/
|
120
132
|
this.translateService = inject(AXTranslationService);
|
133
|
+
/**
|
134
|
+
* File service for file operations.
|
135
|
+
* @ignore
|
136
|
+
*/
|
121
137
|
this.fileService = inject(AXFileService);
|
122
|
-
|
138
|
+
/**
|
139
|
+
* Behavior subject for managing upload requests.
|
140
|
+
* @ignore
|
141
|
+
*/
|
142
|
+
this._files$ = new BehaviorSubject([]);
|
143
|
+
/**
|
144
|
+
* Gets the files behavior subject for observing upload requests.
|
145
|
+
*/
|
146
|
+
this.files = this._files$.asObservable();
|
147
|
+
/**
|
148
|
+
* Subject for file upload start events.
|
149
|
+
*/
|
123
150
|
this.onFileUploadStart = new Subject();
|
151
|
+
/**
|
152
|
+
* Subject for file upload complete events.
|
153
|
+
*/
|
124
154
|
this.onFileUploadComplete = new Subject();
|
155
|
+
/**
|
156
|
+
* Subject for all files upload complete events.
|
157
|
+
*/
|
125
158
|
this.onFilesUploadComplete = new Subject();
|
159
|
+
/**
|
160
|
+
* Subject for file upload canceled events.
|
161
|
+
*/
|
126
162
|
this.onFileUploadCanceled = new Subject();
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
get files() {
|
136
|
-
return this.files$;
|
163
|
+
/**
|
164
|
+
* Signal indicating if any upload has determined progress.
|
165
|
+
*/
|
166
|
+
this.isAnyDetermined = computed(() => this._files$.value.some((file) => file.isDetermined()), ...(ngDevMode ? [{ debugName: "isAnyDetermined" }] : []));
|
167
|
+
/**
|
168
|
+
* Observable for total estimated upload time.
|
169
|
+
*/
|
170
|
+
this.totalEstimateTime = this._files$.pipe(map((files) => sumBy(files, (file) => (file.status() === 'inprogress' ? file.estimateTime() : 0))));
|
137
171
|
}
|
172
|
+
/**
|
173
|
+
* Shows the upload dialog with the list of files.
|
174
|
+
* @private
|
175
|
+
*/
|
138
176
|
async showDialog() {
|
139
|
-
const filesCount = this.
|
177
|
+
const filesCount = this._files$.getValue().length;
|
140
178
|
Promise.resolve().then(function () { return uploaderList_component; }).then(async (c) => {
|
141
179
|
this.popupService
|
142
180
|
.open(c.AXUploaderListComponent, {
|
@@ -151,16 +189,27 @@ class AXUploaderService {
|
|
151
189
|
});
|
152
190
|
});
|
153
191
|
}
|
192
|
+
/**
|
193
|
+
* Converts a File object to an AXUploadRequest.
|
194
|
+
* @private
|
195
|
+
*/
|
154
196
|
convertFileToRequest(file) {
|
155
197
|
return new AXUploadRequest(file);
|
156
198
|
}
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
199
|
+
/**
|
200
|
+
* Starts uploading files that are in 'new' status.
|
201
|
+
* @private
|
202
|
+
*/
|
203
|
+
async startUpload() {
|
204
|
+
const newFiles = this._files$.value.filter((c) => c.status() === 'new');
|
205
|
+
for (const file of newFiles) {
|
206
|
+
await this.bindEvents(file);
|
207
|
+
}
|
163
208
|
}
|
209
|
+
/**
|
210
|
+
* Binds event handlers to an upload request.
|
211
|
+
* @private
|
212
|
+
*/
|
164
213
|
async bindEvents(c) {
|
165
214
|
c.onStart.subscribe(() => {
|
166
215
|
this.onFileUploadStart.next({
|
@@ -176,10 +225,11 @@ class AXUploaderService {
|
|
176
225
|
uploadedFile: c,
|
177
226
|
isUserInteraction: false,
|
178
227
|
});
|
179
|
-
|
228
|
+
const isAllDone = this._files$.value.every((f) => f.status() === 'completed' || f.status() === 'canceled' || f.status() === 'failed');
|
229
|
+
if (isAllDone) {
|
180
230
|
this.onFilesUploadComplete.next({
|
181
231
|
component: this,
|
182
|
-
uploadedFiles: this.
|
232
|
+
uploadedFiles: this._files$.value,
|
183
233
|
isUserInteraction: false,
|
184
234
|
});
|
185
235
|
}
|
@@ -192,60 +242,138 @@ class AXUploaderService {
|
|
192
242
|
});
|
193
243
|
});
|
194
244
|
}
|
245
|
+
/**
|
246
|
+
* Opens the file browser dialog and returns selected files as upload requests.
|
247
|
+
* @param options - Configuration options for file selection
|
248
|
+
* @returns Promise that resolves to an array of upload requests
|
249
|
+
*/
|
195
250
|
async browse(options = { multiple: false }) {
|
196
251
|
try {
|
197
252
|
const files = await this.fileService.choose({ multiple: options?.multiple || false, accept: options.accept });
|
198
253
|
if (files.length) {
|
199
254
|
return this.add(files);
|
200
255
|
}
|
201
|
-
return
|
256
|
+
return [];
|
202
257
|
}
|
203
258
|
catch (error) {
|
204
|
-
|
259
|
+
// It's good practice to log the error.
|
260
|
+
console.error('File browse failed:', error);
|
261
|
+
return [];
|
205
262
|
}
|
206
263
|
}
|
264
|
+
/**
|
265
|
+
* Adds files to the upload queue and starts the upload process.
|
266
|
+
* @param files - Files to add to the upload queue
|
267
|
+
* @returns Promise that resolves to an array of upload requests
|
268
|
+
*/
|
207
269
|
async add(files) {
|
208
270
|
const list = Array.from(files).map((f) => this.convertFileToRequest(f));
|
209
|
-
const
|
210
|
-
|
211
|
-
this.files$.next(currentValue);
|
271
|
+
const newFiles = [...this._files$.value, ...list];
|
272
|
+
this._files$.next(newFiles);
|
212
273
|
await this.showDialog();
|
213
274
|
this.startUpload();
|
214
|
-
return
|
275
|
+
return list;
|
215
276
|
}
|
277
|
+
/**
|
278
|
+
* Cancels all pending and in-progress uploads.
|
279
|
+
*/
|
216
280
|
async cancelAll() {
|
217
|
-
await Promise.all(this.
|
281
|
+
await Promise.all(this._files$.value.filter((c) => c.status() !== 'completed').map((c) => c.cancel()));
|
218
282
|
}
|
283
|
+
/**
|
284
|
+
* Clears all completed uploads from the queue.
|
285
|
+
*/
|
219
286
|
clearAll() {
|
220
|
-
this.
|
287
|
+
const remainingFiles = this._files$.value.filter((c) => c.status() === 'inprogress');
|
288
|
+
this._files$.next(remainingFiles);
|
221
289
|
}
|
290
|
+
/**
|
291
|
+
* Removes a specific upload request from the queue.
|
292
|
+
* @param item - The upload request to remove
|
293
|
+
*/
|
222
294
|
remove(item) {
|
223
|
-
|
224
|
-
|
225
|
-
this.files$.next(currentValue);
|
295
|
+
const updatedFiles = this._files$.value.filter((c) => c !== item);
|
296
|
+
this._files$.next(updatedFiles);
|
226
297
|
}
|
227
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
228
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
298
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
299
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderService, providedIn: 'root' }); }
|
229
300
|
}
|
230
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderService, decorators: [{
|
231
302
|
type: Injectable,
|
232
303
|
args: [{ providedIn: 'root' }]
|
233
304
|
}] });
|
234
305
|
|
306
|
+
/**
|
307
|
+
* A directive that provides drag-and-drop and file upload functionality.
|
308
|
+
* When applied to an element, it enables drag-and-drop file uploads and file browsing.
|
309
|
+
* @category Directives
|
310
|
+
*/
|
235
311
|
class AXUploaderZoneDirective {
|
312
|
+
/**
|
313
|
+
* Initializes the directive with event listeners and service subscriptions.
|
314
|
+
*/
|
236
315
|
constructor() {
|
316
|
+
/**
|
317
|
+
* The element reference for the directive host.
|
318
|
+
* @ignore
|
319
|
+
*/
|
237
320
|
this.elementRef = inject(ElementRef);
|
321
|
+
/**
|
322
|
+
* Whether multiple files can be selected.
|
323
|
+
* @defaultValue true
|
324
|
+
*/
|
238
325
|
this.multiple = true;
|
326
|
+
/**
|
327
|
+
* File types that are accepted for upload.
|
328
|
+
* @defaultValue null
|
329
|
+
*/
|
239
330
|
this.accept = null;
|
331
|
+
/**
|
332
|
+
* Change detector reference.
|
333
|
+
* @ignore
|
334
|
+
*/
|
240
335
|
this.cdr = inject(ChangeDetectorRef);
|
336
|
+
/**
|
337
|
+
* Document reference.
|
338
|
+
* @ignore
|
339
|
+
*/
|
241
340
|
this.document = inject(DOCUMENT);
|
341
|
+
/**
|
342
|
+
* Platform ID for browser detection.
|
343
|
+
* @ignore
|
344
|
+
*/
|
242
345
|
this.platformID = inject(PLATFORM_ID);
|
346
|
+
/**
|
347
|
+
* Upload service instance.
|
348
|
+
* @ignore
|
349
|
+
*/
|
243
350
|
this.uploadService = inject(AXUploaderService);
|
351
|
+
/**
|
352
|
+
* Unsubscriber service instance.
|
353
|
+
* @ignore
|
354
|
+
*/
|
244
355
|
this.unsubscriber = inject(AXUnsubscriber);
|
356
|
+
/**
|
357
|
+
* Translation service instance.
|
358
|
+
* @ignore
|
359
|
+
*/
|
245
360
|
this.translateService = inject(AXTranslationService);
|
361
|
+
/**
|
362
|
+
* Emitted when files are changed (added, removed, etc.).
|
363
|
+
*/
|
246
364
|
this.onChanged = new EventEmitter();
|
365
|
+
/**
|
366
|
+
* Emitted when a single file upload is completed.
|
367
|
+
*/
|
247
368
|
this.onFileUploadComplete = new EventEmitter();
|
369
|
+
/**
|
370
|
+
* Emitted when all files upload is completed.
|
371
|
+
*/
|
248
372
|
this.onFilesUploadComplete = new EventEmitter();
|
373
|
+
/**
|
374
|
+
* CSS class for the overlay state.
|
375
|
+
* @ignore
|
376
|
+
*/
|
249
377
|
this.stateClass = 'ax-uploader-overlay-state';
|
250
378
|
this.element = this.elementRef.nativeElement;
|
251
379
|
this.element.style.position = 'relative';
|
@@ -267,6 +395,9 @@ class AXUploaderZoneDirective {
|
|
267
395
|
this.element.addEventListener('drop', this.handleOnDrop.bind(this), true);
|
268
396
|
this.element.addEventListener('dragleave', this.removeZone.bind(this), true);
|
269
397
|
}
|
398
|
+
/**
|
399
|
+
* Cleans up event listeners when the directive is destroyed.
|
400
|
+
*/
|
270
401
|
ngOnDestroy() {
|
271
402
|
this.element.removeEventListener('click', this.browser.bind(this));
|
272
403
|
this.element.removeEventListener('dragenter', this.handleDragEnter.bind(this));
|
@@ -274,11 +405,19 @@ class AXUploaderZoneDirective {
|
|
274
405
|
this.element.removeEventListener('dragover', this.handleDragOver.bind(this));
|
275
406
|
this.element.removeEventListener('dragleave', this.removeZone.bind(this));
|
276
407
|
}
|
408
|
+
/**
|
409
|
+
* Handles drag enter events to show the upload overlay.
|
410
|
+
* @private
|
411
|
+
*/
|
277
412
|
async handleDragEnter(event) {
|
278
413
|
this.createZone();
|
279
414
|
event.preventDefault();
|
280
415
|
event.stopImmediatePropagation();
|
281
416
|
}
|
417
|
+
/**
|
418
|
+
* Handles drop events to process dropped files.
|
419
|
+
* @private
|
420
|
+
*/
|
282
421
|
async handleOnDrop(event) {
|
283
422
|
event.preventDefault();
|
284
423
|
event.stopImmediatePropagation();
|
@@ -291,10 +430,18 @@ class AXUploaderZoneDirective {
|
|
291
430
|
this.removeZone();
|
292
431
|
this.cdr.detectChanges();
|
293
432
|
}
|
433
|
+
/**
|
434
|
+
* Handles drag over events to allow dropping.
|
435
|
+
* @private
|
436
|
+
*/
|
294
437
|
handleDragOver(event) {
|
295
438
|
event.preventDefault();
|
296
439
|
event.stopImmediatePropagation();
|
297
440
|
}
|
441
|
+
/**
|
442
|
+
* Creates the visual overlay for drag and drop feedback.
|
443
|
+
* @private
|
444
|
+
*/
|
298
445
|
async createZone() {
|
299
446
|
if (isPlatformBrowser(this.platformID)) {
|
300
447
|
this.overlayElement = this.document.createElement('div');
|
@@ -309,6 +456,10 @@ class AXUploaderZoneDirective {
|
|
309
456
|
this.element.appendChild(this.overlayElement);
|
310
457
|
}
|
311
458
|
}
|
459
|
+
/**
|
460
|
+
* Removes the visual overlay for drag and drop feedback.
|
461
|
+
* @private
|
462
|
+
*/
|
312
463
|
removeZone() {
|
313
464
|
if (isPlatformBrowser(this.platformID)) {
|
314
465
|
this.element.removeChild(this.document.getElementById('ax-uploader-overlay-state'));
|
@@ -316,6 +467,10 @@ class AXUploaderZoneDirective {
|
|
316
467
|
//console.log(this.overlayElement);
|
317
468
|
}
|
318
469
|
}
|
470
|
+
/**
|
471
|
+
* Opens the file browser dialog and processes selected files.
|
472
|
+
* @returns Promise that resolves when files are processed
|
473
|
+
*/
|
319
474
|
async browser() {
|
320
475
|
const requests = await this.uploadService.browse({ accept: this.accept, multiple: this.multiple });
|
321
476
|
this.onChanged.emit({
|
@@ -324,13 +479,17 @@ class AXUploaderZoneDirective {
|
|
324
479
|
isUserInteraction: true,
|
325
480
|
});
|
326
481
|
}
|
482
|
+
/**
|
483
|
+
* Host binding for CSS class.
|
484
|
+
* @ignore
|
485
|
+
*/
|
327
486
|
get __hostClass() {
|
328
487
|
return `ax-drop-zone`;
|
329
488
|
}
|
330
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
331
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.
|
489
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderZoneDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
490
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.4", type: AXUploaderZoneDirective, isStandalone: true, selector: "[axUploaderZone]", inputs: { multiple: "multiple", accept: "accept" }, outputs: { onChanged: "onChanged", onFileUploadComplete: "onFileUploadComplete", onFilesUploadComplete: "onFilesUploadComplete" }, host: { properties: { "class": "this.__hostClass" } }, providers: [AXUnsubscriber], ngImport: i0 }); }
|
332
491
|
}
|
333
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
492
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderZoneDirective, decorators: [{
|
334
493
|
type: Directive,
|
335
494
|
args: [{
|
336
495
|
selector: '[axUploaderZone]',
|
@@ -351,25 +510,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
|
|
351
510
|
args: ['class']
|
352
511
|
}] } });
|
353
512
|
|
513
|
+
/**
|
514
|
+
* A directive that provides browse functionality for file uploads.
|
515
|
+
* When applied to an element, clicking it will trigger the file browser dialog.
|
516
|
+
* @category Directives
|
517
|
+
*/
|
354
518
|
class AXUploaderBrowseDirective {
|
355
519
|
constructor() {
|
520
|
+
/**
|
521
|
+
* The uploader zone directive instance.
|
522
|
+
* @ignore
|
523
|
+
*/
|
356
524
|
this.uploaderZone = inject(AXUploaderZoneDirective);
|
525
|
+
/**
|
526
|
+
* The element reference for the directive host.
|
527
|
+
* @ignore
|
528
|
+
*/
|
357
529
|
this.elemenrRef = inject((ElementRef));
|
358
530
|
}
|
531
|
+
/**
|
532
|
+
* Initializes the directive by adding click event listener and data attribute.
|
533
|
+
*/
|
359
534
|
ngOnInit() {
|
360
535
|
this.elemenrRef.nativeElement.addEventListener('click', this.handleClick.bind(this));
|
361
536
|
this.elemenrRef.nativeElement.dataset['axUploaderBrowseHandle'] = 'true';
|
362
537
|
}
|
538
|
+
/**
|
539
|
+
* Cleans up the directive by removing event listeners.
|
540
|
+
*/
|
363
541
|
ngOnDestroy() {
|
364
542
|
this.elemenrRef.nativeElement.removeEventListener('click', this.handleClick.bind(this));
|
365
543
|
}
|
544
|
+
/**
|
545
|
+
* Handles the click event to trigger file browser.
|
546
|
+
* @private
|
547
|
+
*/
|
366
548
|
async handleClick() {
|
367
549
|
await this.uploaderZone.browser();
|
368
550
|
}
|
369
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
370
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.
|
551
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderBrowseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
552
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.4", type: AXUploaderBrowseDirective, isStandalone: true, selector: "[axUploaderBrowseHandle]", ngImport: i0 }); }
|
371
553
|
}
|
372
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
554
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderBrowseDirective, decorators: [{
|
373
555
|
type: Directive,
|
374
556
|
args: [{ selector: '[axUploaderBrowseHandle]' }]
|
375
557
|
}] });
|
@@ -380,13 +562,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
|
|
380
562
|
*/
|
381
563
|
class AXUploaderListComponent {
|
382
564
|
constructor() {
|
383
|
-
/**
|
565
|
+
/**
|
566
|
+
* The uploader service instance for managing file uploads.
|
567
|
+
* @ignore
|
568
|
+
*/
|
384
569
|
this.uploadService = inject(AXUploaderService);
|
385
570
|
}
|
386
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
387
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.
|
571
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
572
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.4", type: AXUploaderListComponent, isStandalone: true, selector: "ax-uploader-list", providers: [{ provide: AXComponent, useExisting: AXUploaderListComponent }], ngImport: i0, template: "<!-- @if ((uploadService.totalEstimateTime | async) > 0) { -->\n<div class=\"ax-uploader-progress-status\" [class.ax-hide]=\"(uploadService.totalEstimateTime | async) <= 0\">\n @if (uploadService.isAnyDetermined()) {\n <span>{{ '@acorex:common.status.processing' | translate | async }}</span>\n } @else {\n <div>{{ uploadService.totalEstimateTime | async | format: 'timeleft' | async }}</div>\n }\n <button (click)=\"uploadService.cancelAll()\">{{ '@acorex:common.actions.cancel' | translate | async }}</button>\n</div>\n<!-- } -->\n\n<ul class=\"ax-uploader-list-items\">\n @for (item of uploadService.files | async; track item.name) {\n <li>\n <div class=\"ax-file\">\n <span>{{ item.ext }}</span>\n </div>\n <div class=\"ax-item-container\">\n <div class=\"ax-item-name\" [title]=\"item.name\">{{ item.name }}</div>\n <div class=\"ax-status\">\n @switch (item.status()) {\n @case ('inprogress') {\n <span>{{ item.size | format: 'filesize' | async }}</span> /\n {{\n item.isDetermined()\n ? (item.estimateTime() | format: 'timeleft' | async)\n : ('@acorex:common.status.processing' | translate | async)\n }}\n }\n @case ('failed') {\n <div class=\"ax-state-failed\">\n <span>{{ item.message() }}</span>\n </div>\n }\n @case ('completed') {\n <div class=\"ax-state-completed\">\n <span>{{ '@acorex:common.status.completed' | translate | async }}</span>\n </div>\n }\n }\n </div>\n </div>\n <div class=\"ax-status\">\n @switch (item.status()) {\n @case ('completed') {\n <i class=\"ax-icon ax-icon-solid ax-icon-check-circle ax-state-completed\"></i>\n }\n @case ('canceled') {\n <div>\n <span class=\"ax-state-canceled\">{{ '@acorex:common.actions.canceled' | translate | async }}</span>\n <!-- <i class=\"ax-icon ax-icon-solid ax-icon-redo\" (click)=\"item.redo()\" title=\"{{ 'retry' | translate | async }}\"></i> -->\n </div>\n }\n @case ('failed') {\n <div class=\"ax-state-failed\">\n <span>{{ '@acorex:common.status.failed' | translate | async }}</span>\n <i\n class=\"ax-icon ax-icon-solid ax-icon-redo\"\n (click)=\"item.redo()\"\n title=\"{{ '@acorex:common.actions.retry' | translate | async }}\"\n ></i>\n </div>\n }\n @default {\n <!-- <ax-circular-progress\n [mode]=\"item.isDetermined() ? 'determinate' : 'indeterminate'\"\n [size]=\"22\"\n [stroke]=\"6\"\n [progress]=\"item.isDetermined() ? item.progress() : 60\"\n class=\"ax-show\"\n >\n </ax-circular-progress> -->\n <i\n class=\"ax-icon ax-icon-solid ax-icon-close\"\n (click)=\"item.cancel()\"\n title=\"{{ '@acorex:common.actions.cancel' | translate | async }}\"\n ></i>\n }\n }\n </div>\n </li>\n @let completed = item.status() === 'completed';\n @if (item.status() === 'inprogress' || completed) {\n <div class=\"ax-status-loading\" [class.ax-status-loading-hide]=\"completed\">\n <ax-progress-bar\n [height]=\"4\"\n [mode]=\"completed ? 'determinate' : 'indeterminate'\"\n [progress]=\"completed ? 100 : 60\"\n [color]=\"completed ? 'success' : 'primary'\"\n ></ax-progress-bar>\n </div>\n }\n }\n</ul>\n", styles: ["ax-uploader-list .ax-uploader-progress-status{display:flex;align-items:center;justify-content:space-between;border-bottom-width:1px;border-top-width:1px;border-color:rgba(var(--ax-sys-color-primary-lightest-surface));background-color:rgba(var(--ax-sys-color-primary-lightest-surface));padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;color:rgba(var(--ax-sys-color-on-primary-lightest-surface));transition:.3s ease-out}ax-uploader-list .ax-uploader-progress-status.ax-hide{opacity:0;overflow:hidden;height:0;padding-top:0;padding-bottom:0;transition:.3s ease-out}ax-uploader-list .ax-uploader-list-items{max-height:75vh;width:100%;overflow-y:auto;overflow-x:hidden;gap:.5rem;display:flex;flex-direction:column}ax-uploader-list .ax-uploader-list-items li{display:flex;padding:.5rem 1rem;align-items:center;font-size:.875rem;line-height:1.25rem;gap:1rem;width:100%}ax-uploader-list .ax-uploader-list-items li .ax-item-container{display:flex;flex-direction:column;flex:1;-webkit-user-select:none;user-select:none}ax-uploader-list .ax-uploader-list-items li .ax-item-container .ax-item-name{font-size:.875rem;line-height:1.25rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-block;width:12rem}ax-uploader-list .ax-uploader-list-items li .ax-status{position:relative;color:rgba(var(--ax-sys-color-on-surface),.5)}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-icon{font-size:1.375rem}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-icon-close{cursor:pointer}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-state-canceled span{color:rgba(var(--ax-sys-color-secondary-surface))}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-state-failed{display:flex;align-items:center;gap:.5rem}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-state-failed span{color:rgba(var(--ax-sys-color-danger-surface))}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-state-failed i{cursor:pointer}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-state-completed{color:rgba(var(--ax-sys-color-success-surface))}ax-uploader-list .ax-uploader-list-items li:hover .ax-hide{display:flex!important}ax-uploader-list .ax-uploader-list-items li:hover .ax-show{display:none!important}ax-uploader-list .ax-uploader-list-items li .ax-show{display:flex!important}ax-uploader-list .ax-uploader-list-items li .ax-hide{display:none!important}ax-uploader-list .ax-uploader-list-items .ax-status-loading.ax-status-loading-hide{transition:all 1s linear;opacity:0;overflow:hidden}.ax-file{position:relative;display:flex;align-items:center;justify-content:center;width:1.5rem;aspect-ratio:.7;border-radius:.25rem;color:rgba(var(--ax-sys-color-light-surface));background-color:rgba(var(--ax-sys-color-success-surface))!important}.ax-file>*{position:absolute;bottom:.3rem;font-weight:700;font-size:.65rem;line-height:.65rem}.ax-file:before{content:\"\";position:absolute;top:0;right:0;border-width:0 12px 12px 0;border-color:rgba(var(--ax-sys-color-surface)) rgba(var(--ax-sys-color-surface)) rgba(var(--ax-sys-color-on-surface),.3) rgba(var(--ax-sys-color-on-surface),.3)}\n"], dependencies: [{ kind: "component", type: AXProgressBarComponent, selector: "ax-progress-bar", inputs: ["color", "mode", "progress", "height"], outputs: ["ValueChange", "sizeChange"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: AXTranslatorPipe, name: "translate" }, { kind: "pipe", type: AXFormatPipe, name: "format" }], encapsulation: i0.ViewEncapsulation.None }); }
|
388
573
|
}
|
389
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
574
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderListComponent, decorators: [{
|
390
575
|
type: Component,
|
391
576
|
args: [{ selector: 'ax-uploader-list', encapsulation: ViewEncapsulation.None, imports: [AXProgressBarComponent, AsyncPipe, AXTranslatorPipe, AXFormatPipe], providers: [{ provide: AXComponent, useExisting: AXUploaderListComponent }], template: "<!-- @if ((uploadService.totalEstimateTime | async) > 0) { -->\n<div class=\"ax-uploader-progress-status\" [class.ax-hide]=\"(uploadService.totalEstimateTime | async) <= 0\">\n @if (uploadService.isAnyDetermined()) {\n <span>{{ '@acorex:common.status.processing' | translate | async }}</span>\n } @else {\n <div>{{ uploadService.totalEstimateTime | async | format: 'timeleft' | async }}</div>\n }\n <button (click)=\"uploadService.cancelAll()\">{{ '@acorex:common.actions.cancel' | translate | async }}</button>\n</div>\n<!-- } -->\n\n<ul class=\"ax-uploader-list-items\">\n @for (item of uploadService.files | async; track item.name) {\n <li>\n <div class=\"ax-file\">\n <span>{{ item.ext }}</span>\n </div>\n <div class=\"ax-item-container\">\n <div class=\"ax-item-name\" [title]=\"item.name\">{{ item.name }}</div>\n <div class=\"ax-status\">\n @switch (item.status()) {\n @case ('inprogress') {\n <span>{{ item.size | format: 'filesize' | async }}</span> /\n {{\n item.isDetermined()\n ? (item.estimateTime() | format: 'timeleft' | async)\n : ('@acorex:common.status.processing' | translate | async)\n }}\n }\n @case ('failed') {\n <div class=\"ax-state-failed\">\n <span>{{ item.message() }}</span>\n </div>\n }\n @case ('completed') {\n <div class=\"ax-state-completed\">\n <span>{{ '@acorex:common.status.completed' | translate | async }}</span>\n </div>\n }\n }\n </div>\n </div>\n <div class=\"ax-status\">\n @switch (item.status()) {\n @case ('completed') {\n <i class=\"ax-icon ax-icon-solid ax-icon-check-circle ax-state-completed\"></i>\n }\n @case ('canceled') {\n <div>\n <span class=\"ax-state-canceled\">{{ '@acorex:common.actions.canceled' | translate | async }}</span>\n <!-- <i class=\"ax-icon ax-icon-solid ax-icon-redo\" (click)=\"item.redo()\" title=\"{{ 'retry' | translate | async }}\"></i> -->\n </div>\n }\n @case ('failed') {\n <div class=\"ax-state-failed\">\n <span>{{ '@acorex:common.status.failed' | translate | async }}</span>\n <i\n class=\"ax-icon ax-icon-solid ax-icon-redo\"\n (click)=\"item.redo()\"\n title=\"{{ '@acorex:common.actions.retry' | translate | async }}\"\n ></i>\n </div>\n }\n @default {\n <!-- <ax-circular-progress\n [mode]=\"item.isDetermined() ? 'determinate' : 'indeterminate'\"\n [size]=\"22\"\n [stroke]=\"6\"\n [progress]=\"item.isDetermined() ? item.progress() : 60\"\n class=\"ax-show\"\n >\n </ax-circular-progress> -->\n <i\n class=\"ax-icon ax-icon-solid ax-icon-close\"\n (click)=\"item.cancel()\"\n title=\"{{ '@acorex:common.actions.cancel' | translate | async }}\"\n ></i>\n }\n }\n </div>\n </li>\n @let completed = item.status() === 'completed';\n @if (item.status() === 'inprogress' || completed) {\n <div class=\"ax-status-loading\" [class.ax-status-loading-hide]=\"completed\">\n <ax-progress-bar\n [height]=\"4\"\n [mode]=\"completed ? 'determinate' : 'indeterminate'\"\n [progress]=\"completed ? 100 : 60\"\n [color]=\"completed ? 'success' : 'primary'\"\n ></ax-progress-bar>\n </div>\n }\n }\n</ul>\n", styles: ["ax-uploader-list .ax-uploader-progress-status{display:flex;align-items:center;justify-content:space-between;border-bottom-width:1px;border-top-width:1px;border-color:rgba(var(--ax-sys-color-primary-lightest-surface));background-color:rgba(var(--ax-sys-color-primary-lightest-surface));padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;color:rgba(var(--ax-sys-color-on-primary-lightest-surface));transition:.3s ease-out}ax-uploader-list .ax-uploader-progress-status.ax-hide{opacity:0;overflow:hidden;height:0;padding-top:0;padding-bottom:0;transition:.3s ease-out}ax-uploader-list .ax-uploader-list-items{max-height:75vh;width:100%;overflow-y:auto;overflow-x:hidden;gap:.5rem;display:flex;flex-direction:column}ax-uploader-list .ax-uploader-list-items li{display:flex;padding:.5rem 1rem;align-items:center;font-size:.875rem;line-height:1.25rem;gap:1rem;width:100%}ax-uploader-list .ax-uploader-list-items li .ax-item-container{display:flex;flex-direction:column;flex:1;-webkit-user-select:none;user-select:none}ax-uploader-list .ax-uploader-list-items li .ax-item-container .ax-item-name{font-size:.875rem;line-height:1.25rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-block;width:12rem}ax-uploader-list .ax-uploader-list-items li .ax-status{position:relative;color:rgba(var(--ax-sys-color-on-surface),.5)}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-icon{font-size:1.375rem}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-icon-close{cursor:pointer}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-state-canceled span{color:rgba(var(--ax-sys-color-secondary-surface))}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-state-failed{display:flex;align-items:center;gap:.5rem}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-state-failed span{color:rgba(var(--ax-sys-color-danger-surface))}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-state-failed i{cursor:pointer}ax-uploader-list .ax-uploader-list-items li .ax-status .ax-state-completed{color:rgba(var(--ax-sys-color-success-surface))}ax-uploader-list .ax-uploader-list-items li:hover .ax-hide{display:flex!important}ax-uploader-list .ax-uploader-list-items li:hover .ax-show{display:none!important}ax-uploader-list .ax-uploader-list-items li .ax-show{display:flex!important}ax-uploader-list .ax-uploader-list-items li .ax-hide{display:none!important}ax-uploader-list .ax-uploader-list-items .ax-status-loading.ax-status-loading-hide{transition:all 1s linear;opacity:0;overflow:hidden}.ax-file{position:relative;display:flex;align-items:center;justify-content:center;width:1.5rem;aspect-ratio:.7;border-radius:.25rem;color:rgba(var(--ax-sys-color-light-surface));background-color:rgba(var(--ax-sys-color-success-surface))!important}.ax-file>*{position:absolute;bottom:.3rem;font-weight:700;font-size:.65rem;line-height:.65rem}.ax-file:before{content:\"\";position:absolute;top:0;right:0;border-width:0 12px 12px 0;border-color:rgba(var(--ax-sys-color-surface)) rgba(var(--ax-sys-color-surface)) rgba(var(--ax-sys-color-on-surface),.3) rgba(var(--ax-sys-color-on-surface),.3)}\n"] }]
|
392
577
|
}] });
|
@@ -402,7 +587,10 @@ var uploaderList_component = /*#__PURE__*/Object.freeze({
|
|
402
587
|
*/
|
403
588
|
class AXUploaderDialogContainerComponent {
|
404
589
|
constructor() {
|
405
|
-
/**
|
590
|
+
/**
|
591
|
+
* The parent closable component instance.
|
592
|
+
* @ignore
|
593
|
+
*/
|
406
594
|
this.parent = inject(AXClosableComponent);
|
407
595
|
/**
|
408
596
|
* Indicates whether the component is in a collapsed state.
|
@@ -422,8 +610,8 @@ class AXUploaderDialogContainerComponent {
|
|
422
610
|
toggle() {
|
423
611
|
this.isCollapsed = !this.isCollapsed;
|
424
612
|
}
|
425
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
426
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.
|
613
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderDialogContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
614
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.4", type: AXUploaderDialogContainerComponent, isStandalone: true, selector: "ax-uploader-dialog-container", providers: [{ provide: AXComponent, useExisting: AXUploaderDialogContainerComponent }], ngImport: i0, template: "<div class=\"ax-uploader-list-header\">\n <div>{{ '@acorex:common.actions.uploading' | translate | async }}</div>\n <div>\n <i\n class=\"ax-icon\"\n [ngClass]=\"{ 'ax-icon-chevron-down': !isCollapsed, 'ax-icon-chevron-up': isCollapsed }\"\n (click)=\"toggle()\"\n ></i>\n <i class=\"ax-icon ax-icon-close\" (click)=\"close()\"></i>\n </div>\n</div>\n<div [@collapse]=\"isCollapsed\">\n <ax-uploader-list></ax-uploader-list>\n</div>\n", styles: ["ax-uploader-dialog-container{display:block;background-color:rgba(var(--ax-sys-color-surface));-webkit-border-top-left-radius:.75rem;-webkit-border-top-right-radius:.75rem;-moz-border-radius-topleft:.75rem;-moz-border-radius-topright:.75rem;border-top-left-radius:.75rem;border-top-right-radius:.75rem;overflow:hidden;box-shadow:-1px -1px 10px #00000029;border:1px solid;border-color:rgba(var(--ax-sys-color-border-lightest-surface));outline-color:rgba(var(--ax-sys-color-primary-surface))}ax-uploader-dialog-container .ax-uploader-list-header{display:flex;justify-content:space-between;background-color:rgba(var(--ax-sys-color-surface));padding:.75rem 1rem;font-weight:500;color:rgba(var(--ax-sys-color-surface-fore))}ax-uploader-dialog-container .ax-uploader-list-header .ax-icon{margin-inline-start:.5rem;cursor:pointer}ax-uploader-dialog-container .ax-uploader-list-header .ax-icon:hover{opacity:.75}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: AXUploaderListComponent, selector: "ax-uploader-list" }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: AXTranslatorPipe, name: "translate" }], animations: [
|
427
615
|
trigger('collapse', [
|
428
616
|
state('false', style({ height: AUTO_STYLE, visibility: AUTO_STYLE })),
|
429
617
|
state('true', style({ height: '0', visibility: 'hidden' })),
|
@@ -432,7 +620,7 @@ class AXUploaderDialogContainerComponent {
|
|
432
620
|
]),
|
433
621
|
], encapsulation: i0.ViewEncapsulation.None }); }
|
434
622
|
}
|
435
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
623
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderDialogContainerComponent, decorators: [{
|
436
624
|
type: Component,
|
437
625
|
args: [{ selector: 'ax-uploader-dialog-container', encapsulation: ViewEncapsulation.None, animations: [
|
438
626
|
trigger('collapse', [
|
@@ -451,15 +639,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImpor
|
|
451
639
|
class AXUploaderDropZoneComponent extends MXBaseComponent {
|
452
640
|
constructor() {
|
453
641
|
super(...arguments);
|
642
|
+
/**
|
643
|
+
* Description text for the drop zone.
|
644
|
+
* @defaultValue ''
|
645
|
+
*/
|
454
646
|
this.description = input('', ...(ngDevMode ? [{ debugName: "description" }] : []));
|
455
647
|
}
|
648
|
+
/**
|
649
|
+
* Prevents page refresh on drag and drop operations.
|
650
|
+
* @returns false to prevent default refresh behavior
|
651
|
+
*/
|
456
652
|
preventRefresh() {
|
457
653
|
return false;
|
458
654
|
}
|
459
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
460
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.
|
655
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderDropZoneComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
656
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.4", type: AXUploaderDropZoneComponent, isStandalone: true, selector: "ax-uploader-drop-zone", inputs: { description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: AXComponent, useExisting: AXUploaderDropZoneComponent }], usesInheritance: true, ngImport: i0, template: "<div class=\"ax-uploader-drop-zone-container\">\n <ax-icon class=\"ax-icon ax-icon-upload\"></ax-icon>\n <div class=\"ax-uploader-drop-zone-description\">\n <span>\n {{ '@acorex:uploader.zone.drag' | translate | async }}\n <a href=\"\" (click)=\"preventRefresh()\">\n {{ '@acorex:uploader.zone.choose' | translate | async }}\n </a>\n {{ '@acorex:uploader.zone.to-upload' | translate | async }}\n </span>\n <!-- <p>SVG, PNG, JPG or GIF (MAX. 800x400px)</p> -->\n @if (description()) {\n <p>{{ description() }}</p>\n }\n </div>\n</div>\n", styles: ["ax-uploader-drop-zone{width:100%;height:100%;display:block;cursor:pointer}ax-uploader-drop-zone .ax-uploader-drop-zone-container{display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:.5rem;margin:1rem;padding:1rem;gap:1rem;border:2px dashed;border-color:rgba(var(--ax-sys-color-border-lightest-surface));pointer-events:none}ax-uploader-drop-zone .ax-uploader-drop-zone-container:hover{border-color:rgba(var(--ax-sys-color-primary-surface));background-color:rgba(var(--ax-sys-color-primary-lightest-surface))}ax-uploader-drop-zone .ax-uploader-drop-zone-container ax-icon{font-size:1.875rem;line-height:2.25rem;color:#a3a3a3;width:1.75rem;height:2rem}ax-uploader-drop-zone .ax-uploader-drop-zone-container .ax-uploader-drop-zone-description{display:flex;flex-direction:column;gap:.5rem}ax-uploader-drop-zone .ax-uploader-drop-zone-container .ax-uploader-drop-zone-description a{color:rgba(var(--ax-sys-color-primary-surface))}ax-uploader-drop-zone .ax-uploader-drop-zone-container .ax-uploader-drop-zone-description p{font-size:.875rem;line-height:1.25rem;color:#a3a3a3}\n"], dependencies: [{ kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: AXTranslatorPipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
461
657
|
}
|
462
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
658
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderDropZoneComponent, decorators: [{
|
463
659
|
type: Component,
|
464
660
|
args: [{ selector: 'ax-uploader-drop-zone', encapsulation: ViewEncapsulation.None, imports: [AXDecoratorIconComponent, AsyncPipe, AXTranslatorPipe], providers: [{ provide: AXComponent, useExisting: AXUploaderDropZoneComponent }], template: "<div class=\"ax-uploader-drop-zone-container\">\n <ax-icon class=\"ax-icon ax-icon-upload\"></ax-icon>\n <div class=\"ax-uploader-drop-zone-description\">\n <span>\n {{ '@acorex:uploader.zone.drag' | translate | async }}\n <a href=\"\" (click)=\"preventRefresh()\">\n {{ '@acorex:uploader.zone.choose' | translate | async }}\n </a>\n {{ '@acorex:uploader.zone.to-upload' | translate | async }}\n </span>\n <!-- <p>SVG, PNG, JPG or GIF (MAX. 800x400px)</p> -->\n @if (description()) {\n <p>{{ description() }}</p>\n }\n </div>\n</div>\n", styles: ["ax-uploader-drop-zone{width:100%;height:100%;display:block;cursor:pointer}ax-uploader-drop-zone .ax-uploader-drop-zone-container{display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:.5rem;margin:1rem;padding:1rem;gap:1rem;border:2px dashed;border-color:rgba(var(--ax-sys-color-border-lightest-surface));pointer-events:none}ax-uploader-drop-zone .ax-uploader-drop-zone-container:hover{border-color:rgba(var(--ax-sys-color-primary-surface));background-color:rgba(var(--ax-sys-color-primary-lightest-surface))}ax-uploader-drop-zone .ax-uploader-drop-zone-container ax-icon{font-size:1.875rem;line-height:2.25rem;color:#a3a3a3;width:1.75rem;height:2rem}ax-uploader-drop-zone .ax-uploader-drop-zone-container .ax-uploader-drop-zone-description{display:flex;flex-direction:column;gap:.5rem}ax-uploader-drop-zone .ax-uploader-drop-zone-container .ax-uploader-drop-zone-description a{color:rgba(var(--ax-sys-color-primary-surface))}ax-uploader-drop-zone .ax-uploader-drop-zone-container .ax-uploader-drop-zone-description p{font-size:.875rem;line-height:1.25rem;color:#a3a3a3}\n"] }]
|
465
661
|
}] });
|
@@ -472,8 +668,8 @@ const COMPONENTS = [
|
|
472
668
|
AXUploaderDialogContainerComponent,
|
473
669
|
];
|
474
670
|
class AXUploaderModule {
|
475
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
476
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.
|
671
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
672
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderModule, imports: [CommonModule,
|
477
673
|
AXDecoratorModule,
|
478
674
|
AXButtonModule,
|
479
675
|
AXTranslationModule,
|
@@ -491,7 +687,7 @@ class AXUploaderModule {
|
|
491
687
|
AXUploaderZoneDirective,
|
492
688
|
AXUploaderBrowseDirective,
|
493
689
|
AXUploaderDialogContainerComponent] }); }
|
494
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.
|
690
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderModule, imports: [CommonModule,
|
495
691
|
AXDecoratorModule,
|
496
692
|
AXButtonModule,
|
497
693
|
AXTranslationModule,
|
@@ -504,7 +700,7 @@ class AXUploaderModule {
|
|
504
700
|
AXUploaderListComponent,
|
505
701
|
AXUploaderDialogContainerComponent] }); }
|
506
702
|
}
|
507
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
703
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.4", ngImport: i0, type: AXUploaderModule, decorators: [{
|
508
704
|
type: NgModule,
|
509
705
|
args: [{
|
510
706
|
imports: [
|