@acorex/core 21.0.3-next.9 → 21.1.0-next.1
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, InjectionToken, inject, NgModule, DOCUMENT, isDevMode } from '@angular/core';
|
|
2
|
+
import { Injectable, runInInjectionContext, InjectionToken, inject, input, signal, effect, ChangeDetectionStrategy, Component, NgModule, DOCUMENT, isDevMode } from '@angular/core';
|
|
3
|
+
import { NgComponentOutlet } from '@angular/common';
|
|
3
4
|
import * as i2 from '@acorex/core/validation';
|
|
4
5
|
import { AXValidationService, AXValidationRegistryService, AXValidationModule } from '@acorex/core/validation';
|
|
5
6
|
import * as i1 from '@acorex/core/format';
|
|
@@ -57,6 +58,38 @@ function formatFileSizeBytes(bytes) {
|
|
|
57
58
|
return `${value.toFixed(digits)} ${units[i]}`;
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
/** Metadata key for catalog usage context. */
|
|
62
|
+
const AX_FILE_TYPE_METADATA_PURPOSE = 'purpose';
|
|
63
|
+
|
|
64
|
+
const CONVERSATION_NAME_PREFIX = 'conversation-';
|
|
65
|
+
function getFileTypePurposes(type) {
|
|
66
|
+
const raw = type.metadata?.[AX_FILE_TYPE_METADATA_PURPOSE];
|
|
67
|
+
if (Array.isArray(raw)) {
|
|
68
|
+
const values = raw.filter((entry) => typeof entry === 'string' && entry.trim().length > 0);
|
|
69
|
+
if (values.length) {
|
|
70
|
+
return values;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (type.name.startsWith(CONVERSATION_NAME_PREFIX)) {
|
|
74
|
+
return ['conversation'];
|
|
75
|
+
}
|
|
76
|
+
return ['system'];
|
|
77
|
+
}
|
|
78
|
+
function fileTypeMatchesPurpose(type, purpose) {
|
|
79
|
+
const allowed = Array.isArray(purpose) ? purpose : [purpose];
|
|
80
|
+
return getFileTypePurposes(type).some((entry) => allowed.includes(entry));
|
|
81
|
+
}
|
|
82
|
+
function filterFileTypesByPurpose(types, purpose) {
|
|
83
|
+
if (!purpose) {
|
|
84
|
+
return types;
|
|
85
|
+
}
|
|
86
|
+
return types.filter((type) => fileTypeMatchesPurpose(type, purpose));
|
|
87
|
+
}
|
|
88
|
+
function createFileTypeMetadata(purpose) {
|
|
89
|
+
const values = (Array.isArray(purpose) ? purpose : [purpose]).filter((entry) => typeof entry === 'string' && entry.trim().length > 0);
|
|
90
|
+
return { [AX_FILE_TYPE_METADATA_PURPOSE]: values };
|
|
91
|
+
}
|
|
92
|
+
|
|
60
93
|
/** Resolves clipboard/plain text from a copy result. */
|
|
61
94
|
function resolveFileCopyText(result) {
|
|
62
95
|
if (result == null) {
|
|
@@ -70,18 +103,6 @@ function resolveFileCopyText(result) {
|
|
|
70
103
|
return trimmed && trimmed.length > 0 ? trimmed : null;
|
|
71
104
|
}
|
|
72
105
|
|
|
73
|
-
/** Contributes {@link AXFileType} entries (multi provider). */
|
|
74
|
-
class AXFileTypeInfoProvider {
|
|
75
|
-
}
|
|
76
|
-
const AX_FILE_TYPE_INFO_PROVIDER = new InjectionToken('AX_FILE_TYPE_INFO_PROVIDER');
|
|
77
|
-
function provideFileTypeInfoProvider(provider) {
|
|
78
|
-
return {
|
|
79
|
-
provide: AX_FILE_TYPE_INFO_PROVIDER,
|
|
80
|
-
useClass: provider,
|
|
81
|
-
multi: true,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
106
|
/** Merges type-level validations with extension overrides (extension wins per field). */
|
|
86
107
|
function mergeFileValidations(base, override) {
|
|
87
108
|
if (!override) {
|
|
@@ -94,7 +115,7 @@ function mergeFileValidations(base, override) {
|
|
|
94
115
|
rules: override.rules ?? base.rules,
|
|
95
116
|
};
|
|
96
117
|
}
|
|
97
|
-
/** Resolved validations for a type + optional extension. */
|
|
118
|
+
/** Resolved validations for a type + optional extension entry. */
|
|
98
119
|
function resolveFileValidations(type, extension) {
|
|
99
120
|
return mergeFileValidations(type.validations ?? {}, extension?.validations);
|
|
100
121
|
}
|
|
@@ -120,13 +141,196 @@ function getFileExtension(fileName) {
|
|
|
120
141
|
const parts = fileName.trim().split('.');
|
|
121
142
|
return parts.length > 1 ? (parts.pop()?.toLowerCase() ?? '') : '';
|
|
122
143
|
}
|
|
144
|
+
|
|
145
|
+
/** Resolves a {@link AXFileTypeComponent} to an Angular component type. */
|
|
146
|
+
async function resolveFileTypeComponentType(component) {
|
|
147
|
+
if (isLazyFileTypeComponentLoader(component)) {
|
|
148
|
+
return component();
|
|
149
|
+
}
|
|
150
|
+
return component;
|
|
151
|
+
}
|
|
152
|
+
/** Whether `value` is a lazy loader rather than an Angular component class. */
|
|
153
|
+
function isLazyFileTypeComponentLoader(value) {
|
|
154
|
+
return typeof value === 'function' && !('ɵcmp' in value);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Matches a MIME type against a catalog pattern (`image/*`, exact type, …). */
|
|
158
|
+
function matchesFileMime(mime, pattern) {
|
|
159
|
+
const normalizedMime = mime.trim().toLowerCase();
|
|
160
|
+
const normalizedPattern = pattern.trim().toLowerCase();
|
|
161
|
+
if (!normalizedPattern || normalizedPattern === '*/*' || normalizedPattern === '*') {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
if (normalizedPattern.endsWith('/*')) {
|
|
165
|
+
const category = normalizedPattern.slice(0, -2);
|
|
166
|
+
return normalizedMime.startsWith(`${category}/`) || (normalizedMime === '' && category === 'application');
|
|
167
|
+
}
|
|
168
|
+
return normalizedMime === normalizedPattern;
|
|
169
|
+
}
|
|
170
|
+
/** Finds an extension entry by its `name` (without dot). */
|
|
171
|
+
function findFileTypeExtensionByName(type, extensionName) {
|
|
172
|
+
const ext = extensionName.replace(/^\./, '').trim().toLowerCase();
|
|
173
|
+
if (!ext || !type.extensions?.length) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
return type.extensions.find((entry) => entry.name.toLowerCase() === ext);
|
|
177
|
+
}
|
|
178
|
+
/** Finds an extension entry whose validations include the given MIME type. */
|
|
179
|
+
function findFileTypeExtensionForMime(type, mimeType) {
|
|
180
|
+
const mime = mimeType.trim().toLowerCase();
|
|
181
|
+
if (!mime || !type.extensions?.length) {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
return type.extensions.find((entry) => entry.validations?.mimeTypes?.some((pattern) => matchesFileMime(mime, pattern)));
|
|
185
|
+
}
|
|
123
186
|
/** Matching extension entry for a file within a type, if any. */
|
|
124
187
|
function findFileTypeExtension(file, type) {
|
|
125
|
-
|
|
126
|
-
|
|
188
|
+
return resolveFileTypeExtension(type, { file });
|
|
189
|
+
}
|
|
190
|
+
/** Resolves the best-matching extension entry for a file or hint. */
|
|
191
|
+
function resolveFileTypeExtension(type, hint) {
|
|
192
|
+
if (!hint) {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
if (hint.file) {
|
|
196
|
+
const byFileName = findFileTypeExtensionByName(type, getFileExtension(hint.file.name));
|
|
197
|
+
if (byFileName) {
|
|
198
|
+
return byFileName;
|
|
199
|
+
}
|
|
200
|
+
if (hint.file.type) {
|
|
201
|
+
const byFileMime = findFileTypeExtensionForMime(type, hint.file.type);
|
|
202
|
+
if (byFileMime) {
|
|
203
|
+
return byFileMime;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (hint.extensionName) {
|
|
208
|
+
const byName = findFileTypeExtensionByName(type, hint.extensionName);
|
|
209
|
+
if (byName) {
|
|
210
|
+
return byName;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (hint.mimeType) {
|
|
214
|
+
return findFileTypeExtensionForMime(type, hint.mimeType);
|
|
215
|
+
}
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
function resolveFileTypeCopy(type, extension) {
|
|
219
|
+
return extension?.copy ?? type.copy;
|
|
220
|
+
}
|
|
221
|
+
function resolveFileTypeOpen(type, extension) {
|
|
222
|
+
return extension?.open ?? type.open;
|
|
223
|
+
}
|
|
224
|
+
function resolveFileTypeComponent(type, extension) {
|
|
225
|
+
return extension?.component ?? type.component;
|
|
226
|
+
}
|
|
227
|
+
/** Loads the resolved view component (extension override first). */
|
|
228
|
+
async function loadFileTypeComponent(type, extension) {
|
|
229
|
+
const component = resolveFileTypeComponent(type, extension);
|
|
230
|
+
if (!component) {
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
return resolveFileTypeComponentType(component);
|
|
234
|
+
}
|
|
235
|
+
function resolveFileTypePaste(type, extension) {
|
|
236
|
+
return extension?.paste ?? type.paste;
|
|
237
|
+
}
|
|
238
|
+
function resolveFileTypeUtility(type, extension, name) {
|
|
239
|
+
const fromExtension = extension?.utilities?.[name];
|
|
240
|
+
if (fromExtension) {
|
|
241
|
+
return fromExtension;
|
|
242
|
+
}
|
|
243
|
+
return type.utilities?.[name];
|
|
244
|
+
}
|
|
245
|
+
/** Runs `copy` from extension first, then parent type. */
|
|
246
|
+
async function runFileTypeCopy(type, payload, extension) {
|
|
247
|
+
const copy = resolveFileTypeCopy(type, extension);
|
|
248
|
+
if (!copy) {
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
return copy(payload);
|
|
252
|
+
}
|
|
253
|
+
/** Runs a utility from extension first, then parent type. */
|
|
254
|
+
function runFileTypeUtility(type, ctx, extension, name, ...args) {
|
|
255
|
+
const utility = resolveFileTypeUtility(type, extension, name);
|
|
256
|
+
if (!utility) {
|
|
127
257
|
return undefined;
|
|
128
258
|
}
|
|
129
|
-
return
|
|
259
|
+
return utility(ctx, ...args);
|
|
260
|
+
}
|
|
261
|
+
/** Runs a catalog utility with optional file-based extension resolution. */
|
|
262
|
+
function runFileTypeUtilityForFile(type, ctx, file, name, ...args) {
|
|
263
|
+
const extension = file ? findFileTypeExtension(file, type) : undefined;
|
|
264
|
+
return runFileTypeUtility(type, ctx, extension, name, ...args);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** Runs `open` from extension first, then parent type, in the caller's injection context. */
|
|
268
|
+
function runFileTypeOpen(type, ctx, payload, extension) {
|
|
269
|
+
const open = resolveFileTypeOpen(type, extension);
|
|
270
|
+
if (!open) {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
return runInInjectionContext(ctx.injector, () => open(ctx, payload));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
|
|
278
|
+
* Builds an {@link AXFileType} with optional typed handlers and view component.
|
|
279
|
+
|
|
280
|
+
*
|
|
281
|
+
|
|
282
|
+
* @example
|
|
283
|
+
|
|
284
|
+
* ```ts
|
|
285
|
+
|
|
286
|
+
* export const imageFileType = defineFileType<ImagePayload>({
|
|
287
|
+
|
|
288
|
+
* name: 'image',
|
|
289
|
+
|
|
290
|
+
* copy: (p) => p.caption ?? p.url,
|
|
291
|
+
|
|
292
|
+
* component: () => import('./image-viewer.component').then(m => m.ImageViewerComponent),
|
|
293
|
+
|
|
294
|
+
* });
|
|
295
|
+
|
|
296
|
+
* ```
|
|
297
|
+
|
|
298
|
+
*/
|
|
299
|
+
function defineFileType(config) {
|
|
300
|
+
const { copy, open, ...rest } = config;
|
|
301
|
+
return {
|
|
302
|
+
...rest,
|
|
303
|
+
...(copy ? { copy: copy } : {}),
|
|
304
|
+
...(open ? { open: open } : {}),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** Contributes {@link AXFileType} entries (multi provider). */
|
|
309
|
+
class AXFileTypeInfoProvider {
|
|
310
|
+
}
|
|
311
|
+
const AX_FILE_TYPE_INFO_PROVIDER = new InjectionToken('AX_FILE_TYPE_INFO_PROVIDER');
|
|
312
|
+
function provideFileTypeInfoProvider(provider) {
|
|
313
|
+
return {
|
|
314
|
+
provide: AX_FILE_TYPE_INFO_PROVIDER,
|
|
315
|
+
useClass: provider,
|
|
316
|
+
multi: true,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** Registers static file types via the existing {@link AXFileTypeInfoProvider} multi-token. */
|
|
321
|
+
function provideFileTypes(types) {
|
|
322
|
+
class AXStaticFileTypeProvider extends AXFileTypeInfoProvider {
|
|
323
|
+
items() {
|
|
324
|
+
const value = typeof types === 'function' ? types() : types;
|
|
325
|
+
return Promise.resolve(value);
|
|
326
|
+
}
|
|
327
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXStaticFileTypeProvider, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
328
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXStaticFileTypeProvider }); }
|
|
329
|
+
}
|
|
330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXStaticFileTypeProvider, decorators: [{
|
|
331
|
+
type: Injectable
|
|
332
|
+
}] });
|
|
333
|
+
return provideFileTypeInfoProvider(AXStaticFileTypeProvider);
|
|
130
334
|
}
|
|
131
335
|
|
|
132
336
|
/** Maps {@link AXFileValidations} to executable validation entries. */
|
|
@@ -229,13 +433,32 @@ class AXFileTypeRegistryService {
|
|
|
229
433
|
this.cache = [...byName.values()];
|
|
230
434
|
return this.cache;
|
|
231
435
|
}
|
|
232
|
-
async getTypes() {
|
|
233
|
-
|
|
436
|
+
async getTypes(query) {
|
|
437
|
+
const types = await this.resolveTypes();
|
|
438
|
+
return filterFileTypesByPurpose(types, query?.purpose);
|
|
234
439
|
}
|
|
235
440
|
async get(name) {
|
|
236
441
|
const types = await this.resolveTypes();
|
|
237
442
|
return types.find((t) => t.name === name);
|
|
238
443
|
}
|
|
444
|
+
/** Resolved view component ref for a catalog entry (optional extension hint). */
|
|
445
|
+
async getComponent(name, hint) {
|
|
446
|
+
const type = await this.get(name);
|
|
447
|
+
if (!type) {
|
|
448
|
+
return undefined;
|
|
449
|
+
}
|
|
450
|
+
const extension = hint ? resolveFileTypeExtension(type, hint) : undefined;
|
|
451
|
+
return resolveFileTypeComponent(type, extension);
|
|
452
|
+
}
|
|
453
|
+
/** Loads the view component for a catalog entry. */
|
|
454
|
+
async loadComponent(name, hint) {
|
|
455
|
+
const type = await this.get(name);
|
|
456
|
+
if (!type) {
|
|
457
|
+
return undefined;
|
|
458
|
+
}
|
|
459
|
+
const extension = hint ? resolveFileTypeExtension(type, hint) : undefined;
|
|
460
|
+
return loadFileTypeComponent(type, extension);
|
|
461
|
+
}
|
|
239
462
|
async accept(typeNames) {
|
|
240
463
|
const names = typeNames ? (Array.isArray(typeNames) ? typeNames : [typeNames]) : undefined;
|
|
241
464
|
const types = await this.resolveTypes();
|
|
@@ -264,7 +487,7 @@ class AXFileTypeRegistryService {
|
|
|
264
487
|
if (!patterns.length) {
|
|
265
488
|
return false;
|
|
266
489
|
}
|
|
267
|
-
return patterns.some((pattern) =>
|
|
490
|
+
return patterns.some((pattern) => matchesFileMime(mime, pattern));
|
|
268
491
|
});
|
|
269
492
|
}
|
|
270
493
|
async validate(file, typeName) {
|
|
@@ -308,16 +531,6 @@ class AXFileTypeRegistryService {
|
|
|
308
531
|
}
|
|
309
532
|
return { accepted, rejected };
|
|
310
533
|
}
|
|
311
|
-
matchesMime(mime, pattern) {
|
|
312
|
-
if (!pattern || pattern === '*/*' || pattern === '*') {
|
|
313
|
-
return true;
|
|
314
|
-
}
|
|
315
|
-
if (pattern.endsWith('/*')) {
|
|
316
|
-
const category = pattern.slice(0, -2);
|
|
317
|
-
return mime.startsWith(`${category}/`) || (mime === '' && category === 'application');
|
|
318
|
-
}
|
|
319
|
-
return mime === pattern;
|
|
320
|
-
}
|
|
321
534
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXFileTypeRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
322
535
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXFileTypeRegistryService, providedIn: 'root' }); }
|
|
323
536
|
}
|
|
@@ -326,9 +539,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
326
539
|
args: [{ providedIn: 'root' }]
|
|
327
540
|
}] });
|
|
328
541
|
|
|
542
|
+
class AXFileTypeRendererOutletComponent {
|
|
543
|
+
constructor() {
|
|
544
|
+
this.registry = inject(AXFileTypeRegistryService);
|
|
545
|
+
/** Catalog name (e.g. `image`, `conversation-image`). */
|
|
546
|
+
this.fileType = input.required(...(ngDevMode ? [{ debugName: "fileType" }] : /* istanbul ignore next */ []));
|
|
547
|
+
/** Payload passed to the file-type view component. */
|
|
548
|
+
this.payload = input.required(...(ngDevMode ? [{ debugName: "payload" }] : /* istanbul ignore next */ []));
|
|
549
|
+
/** Optional extension / MIME hint for extension-level renderer overrides. */
|
|
550
|
+
this.extensionHint = input(...(ngDevMode ? [undefined, { debugName: "extensionHint" }] : /* istanbul ignore next */ []));
|
|
551
|
+
/** Extra inputs merged with `payload` (e.g. `message` in conversation). */
|
|
552
|
+
this.inputs = input({}, ...(ngDevMode ? [{ debugName: "inputs" }] : /* istanbul ignore next */ []));
|
|
553
|
+
this.resolvedComponent = signal(null, ...(ngDevMode ? [{ debugName: "resolvedComponent" }] : /* istanbul ignore next */ []));
|
|
554
|
+
this.loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
555
|
+
this.mergedInputs = signal({}, ...(ngDevMode ? [{ debugName: "mergedInputs" }] : /* istanbul ignore next */ []));
|
|
556
|
+
effect(() => {
|
|
557
|
+
const name = this.fileType();
|
|
558
|
+
const payload = this.payload();
|
|
559
|
+
const hint = this.extensionHint();
|
|
560
|
+
const extra = this.inputs();
|
|
561
|
+
this.mergedInputs.set({ payload, ...extra });
|
|
562
|
+
this.loading.set(true);
|
|
563
|
+
this.resolvedComponent.set(null);
|
|
564
|
+
void this.registry.loadComponent(name, hint).then((component) => {
|
|
565
|
+
this.resolvedComponent.set(component ?? null);
|
|
566
|
+
this.loading.set(false);
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXFileTypeRendererOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
571
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXFileTypeRendererOutletComponent, isStandalone: true, selector: "ax-file-type-renderer", inputs: { fileType: { classPropertyName: "fileType", publicName: "fileType", isSignal: true, isRequired: true, transformFunction: null }, payload: { classPropertyName: "payload", publicName: "payload", isSignal: true, isRequired: true, transformFunction: null }, extensionHint: { classPropertyName: "extensionHint", publicName: "extensionHint", isSignal: true, isRequired: false, transformFunction: null }, inputs: { classPropertyName: "inputs", publicName: "inputs", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
572
|
+
@if (resolvedComponent(); as component) {
|
|
573
|
+
<ng-container *ngComponentOutlet="component; inputs: mergedInputs()" />
|
|
574
|
+
} @else if (loading()) {
|
|
575
|
+
<span class="ax-file-type-renderer__loading" aria-hidden="true"></span>
|
|
576
|
+
}
|
|
577
|
+
`, isInline: true, styles: [":host{display:contents}.ax-file-type-renderer__loading{display:inline-block;min-height:1rem;min-width:1rem}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
578
|
+
}
|
|
579
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXFileTypeRendererOutletComponent, decorators: [{
|
|
580
|
+
type: Component,
|
|
581
|
+
args: [{ selector: 'ax-file-type-renderer', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgComponentOutlet], template: `
|
|
582
|
+
@if (resolvedComponent(); as component) {
|
|
583
|
+
<ng-container *ngComponentOutlet="component; inputs: mergedInputs()" />
|
|
584
|
+
} @else if (loading()) {
|
|
585
|
+
<span class="ax-file-type-renderer__loading" aria-hidden="true"></span>
|
|
586
|
+
}
|
|
587
|
+
`, styles: [":host{display:contents}.ax-file-type-renderer__loading{display:inline-block;min-height:1rem;min-width:1rem}\n"] }]
|
|
588
|
+
}], ctorParameters: () => [], propDecorators: { fileType: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileType", required: true }] }], payload: [{ type: i0.Input, args: [{ isSignal: true, alias: "payload", required: true }] }], extensionHint: [{ type: i0.Input, args: [{ isSignal: true, alias: "extensionHint", required: false }] }], inputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputs", required: false }] }] } });
|
|
589
|
+
|
|
329
590
|
const MB$4 = 1024 * 1024;
|
|
330
591
|
const AX_AUDIO_FILE_TYPE = {
|
|
331
592
|
name: 'audio',
|
|
593
|
+
metadata: createFileTypeMetadata('system'),
|
|
332
594
|
title: 'Audio',
|
|
333
595
|
icon: 'fa-light fa-music ax-text-amber-500',
|
|
334
596
|
validations: {
|
|
@@ -358,6 +620,7 @@ const MB$3 = 1024 * 1024;
|
|
|
358
620
|
/** Extension-only: no type `validations` — only listed extensions are allowed. */
|
|
359
621
|
const AX_DOCUMENT_FILE_TYPE = {
|
|
360
622
|
name: 'document',
|
|
623
|
+
metadata: createFileTypeMetadata('system'),
|
|
361
624
|
title: 'Document',
|
|
362
625
|
icon: 'fa-light fa-file-lines ax-text-red-500',
|
|
363
626
|
extensions: [{ name: 'pdf', title: 'PDF', validations: { mimeTypes: ['application/pdf'], maxSize: 5 * MB$3 } }],
|
|
@@ -376,6 +639,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
376
639
|
const MB$2 = 1024 * 1024;
|
|
377
640
|
const AX_FILE_FILE_TYPE = {
|
|
378
641
|
name: 'file',
|
|
642
|
+
metadata: createFileTypeMetadata('system'),
|
|
379
643
|
title: 'File',
|
|
380
644
|
icon: 'fa-light fa-file ax-text-neutral-500',
|
|
381
645
|
validations: {
|
|
@@ -405,6 +669,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
405
669
|
const MB$1 = 1024 * 1024;
|
|
406
670
|
const AX_IMAGE_FILE_TYPE = {
|
|
407
671
|
name: 'image',
|
|
672
|
+
metadata: createFileTypeMetadata('system'),
|
|
408
673
|
title: 'Image',
|
|
409
674
|
icon: 'fa-light fa-image ax-text-purple-500',
|
|
410
675
|
validations: {
|
|
@@ -435,6 +700,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
435
700
|
const MB = 1024 * 1024;
|
|
436
701
|
const AX_VIDEO_FILE_TYPE = {
|
|
437
702
|
name: 'video',
|
|
703
|
+
metadata: createFileTypeMetadata('system'),
|
|
438
704
|
title: 'Video',
|
|
439
705
|
icon: 'fa-light fa-video ax-text-blue-500',
|
|
440
706
|
validations: {
|
|
@@ -736,5 +1002,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
736
1002
|
* Generated bundle index. Do not edit.
|
|
737
1003
|
*/
|
|
738
1004
|
|
|
739
|
-
export { AXAudioFileTypeProvider, AXDocumentFileTypeProvider, AXFileFileTypeProvider, AXFileMaxSizeValidationRule, AXFileMimeTypeValidationRule, AXFileMinSizeValidationRule, AXFileModule, AXFileService, AXFileSizeFormatter, AXFileTypeInfoProvider, AXFileTypeRegistryService, AXImageFileTypeProvider, AXVideoFileTypeProvider, AX_AUDIO_FILE_TYPE, AX_BUILTIN_FILE_TYPE_PROVIDERS, AX_DOCUMENT_FILE_TYPE, AX_FILE_FILE_TYPE, AX_FILE_TYPE_INFO_PROVIDER, AX_FILE_VALIDATION_RULES, AX_IMAGE_FILE_TYPE, AX_VIDEO_FILE_TYPE, fileValidationsToRules, findFileTypeExtension, formatFileSizeBytes, getFileExtension, isEmptyFileValidations, isExtensionsOnlyType, mergeFileValidations, provideBuiltinFileTypeProviders, provideDefaultFileTypeProviders, provideFileTypeInfoProvider, provideFileTypeSystem, provideFileValidationRules, resolveFileCopyText, resolveFileValidations, validateFileAgainstType, validateFileWithValidations };
|
|
1005
|
+
export { AXAudioFileTypeProvider, AXDocumentFileTypeProvider, AXFileFileTypeProvider, AXFileMaxSizeValidationRule, AXFileMimeTypeValidationRule, AXFileMinSizeValidationRule, AXFileModule, AXFileService, AXFileSizeFormatter, AXFileTypeInfoProvider, AXFileTypeRegistryService, AXFileTypeRendererOutletComponent, AXImageFileTypeProvider, AXVideoFileTypeProvider, AX_AUDIO_FILE_TYPE, AX_BUILTIN_FILE_TYPE_PROVIDERS, AX_DOCUMENT_FILE_TYPE, AX_FILE_FILE_TYPE, AX_FILE_TYPE_INFO_PROVIDER, AX_FILE_TYPE_METADATA_PURPOSE, AX_FILE_VALIDATION_RULES, AX_IMAGE_FILE_TYPE, AX_VIDEO_FILE_TYPE, createFileTypeMetadata, defineFileType, fileTypeMatchesPurpose, fileValidationsToRules, filterFileTypesByPurpose, findFileTypeExtension, findFileTypeExtensionByName, findFileTypeExtensionForMime, formatFileSizeBytes, getFileExtension, getFileTypePurposes, isEmptyFileValidations, isExtensionsOnlyType, isLazyFileTypeComponentLoader, loadFileTypeComponent, matchesFileMime, mergeFileValidations, provideBuiltinFileTypeProviders, provideDefaultFileTypeProviders, provideFileTypeInfoProvider, provideFileTypeSystem, provideFileTypes, provideFileValidationRules, resolveFileCopyText, resolveFileTypeComponent, resolveFileTypeComponentType, resolveFileTypeCopy, resolveFileTypeExtension, resolveFileTypeOpen, resolveFileTypePaste, resolveFileTypeUtility, resolveFileValidations, runFileTypeCopy, runFileTypeOpen, runFileTypeUtility, runFileTypeUtilityForFile, validateFileAgainstType, validateFileWithValidations };
|
|
740
1006
|
//# sourceMappingURL=acorex-core-file.mjs.map
|