@acorex/core 21.0.2-next.22 → 21.0.2-next.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/acorex-core-components.mjs +3 -3
- package/fesm2022/acorex-core-components.mjs.map +1 -1
- package/fesm2022/acorex-core-config.mjs +3 -3
- package/fesm2022/acorex-core-config.mjs.map +1 -1
- package/fesm2022/acorex-core-constants.mjs.map +1 -1
- package/fesm2022/acorex-core-date-time.mjs +25 -25
- package/fesm2022/acorex-core-date-time.mjs.map +1 -1
- package/fesm2022/acorex-core-events.mjs +3 -3
- package/fesm2022/acorex-core-events.mjs.map +1 -1
- package/fesm2022/acorex-core-file.mjs +685 -92
- package/fesm2022/acorex-core-file.mjs.map +1 -1
- package/fesm2022/acorex-core-format.mjs +19 -19
- package/fesm2022/acorex-core-format.mjs.map +1 -1
- package/fesm2022/acorex-core-full-screen.mjs +3 -3
- package/fesm2022/acorex-core-full-screen.mjs.map +1 -1
- package/fesm2022/acorex-core-icon.mjs +3 -3
- package/fesm2022/acorex-core-icon.mjs.map +1 -1
- package/fesm2022/acorex-core-image.mjs +3 -3
- package/fesm2022/acorex-core-image.mjs.map +1 -1
- package/fesm2022/acorex-core-locale.mjs +10 -10
- package/fesm2022/acorex-core-locale.mjs.map +1 -1
- package/fesm2022/acorex-core-memoize.mjs.map +1 -1
- package/fesm2022/acorex-core-network.mjs +3 -3
- package/fesm2022/acorex-core-network.mjs.map +1 -1
- package/fesm2022/acorex-core-pipes.mjs +3 -3
- package/fesm2022/acorex-core-pipes.mjs.map +1 -1
- package/fesm2022/acorex-core-platform.mjs +4 -4
- package/fesm2022/acorex-core-platform.mjs.map +1 -1
- package/fesm2022/acorex-core-storage.mjs +9 -9
- package/fesm2022/acorex-core-storage.mjs.map +1 -1
- package/fesm2022/acorex-core-translation.mjs +16 -16
- package/fesm2022/acorex-core-translation.mjs.map +1 -1
- package/fesm2022/acorex-core-utils.mjs +4 -6
- package/fesm2022/acorex-core-utils.mjs.map +1 -1
- package/fesm2022/acorex-core-validation.mjs +40 -40
- package/fesm2022/acorex-core-validation.mjs.map +1 -1
- package/fesm2022/acorex-core-z-index.mjs +3 -3
- package/fesm2022/acorex-core-z-index.mjs.map +1 -1
- package/fesm2022/acorex-core.mjs.map +1 -1
- package/file/index.d.ts +321 -0
- package/{types/acorex-core-format.d.ts → format/index.d.ts} +2 -2
- package/package.json +23 -23
- package/{types/acorex-core-utils.d.ts → utils/index.d.ts} +2 -10
- package/{types/acorex-core-validation.d.ts → validation/index.d.ts} +10 -10
- package/types/acorex-core-file.d.ts +0 -85
- /package/{types/acorex-core-components.d.ts → components/index.d.ts} +0 -0
- /package/{types/acorex-core-config.d.ts → config/index.d.ts} +0 -0
- /package/{types/acorex-core-constants.d.ts → constants/index.d.ts} +0 -0
- /package/{types/acorex-core-date-time.d.ts → date-time/index.d.ts} +0 -0
- /package/{types/acorex-core-events.d.ts → events/index.d.ts} +0 -0
- /package/{types/acorex-core-full-screen.d.ts → full-screen/index.d.ts} +0 -0
- /package/{types/acorex-core-icon.d.ts → icon/index.d.ts} +0 -0
- /package/{types/acorex-core-image.d.ts → image/index.d.ts} +0 -0
- /package/{types/acorex-core.d.ts → index.d.ts} +0 -0
- /package/{types/acorex-core-locale.d.ts → locale/index.d.ts} +0 -0
- /package/{types/acorex-core-memoize.d.ts → memoize/index.d.ts} +0 -0
- /package/{types/acorex-core-network.d.ts → network/index.d.ts} +0 -0
- /package/{types/acorex-core-pipes.d.ts → pipes/index.d.ts} +0 -0
- /package/{types/acorex-core-platform.d.ts → platform/index.d.ts} +0 -0
- /package/{types/acorex-core-storage.d.ts → storage/index.d.ts} +0 -0
- /package/{types/acorex-core-translation.d.ts → translation/index.d.ts} +0 -0
- /package/{types/acorex-core-z-index.d.ts → z-index/index.d.ts} +0 -0
package/file/index.d.ts
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import * as i1 from '@acorex/core/format';
|
|
2
|
+
import { AXFormatOptions, AXFormatter } from '@acorex/core/format';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { InjectionToken, Type, Provider, ModuleWithProviders } from '@angular/core';
|
|
5
|
+
import * as i2 from '@acorex/core/validation';
|
|
6
|
+
import { AXValidationRuleOptions, AXValidationRuleResult, AXValidationService, AXValidationRule } from '@acorex/core/validation';
|
|
7
|
+
|
|
8
|
+
interface AXFileSizeFormatterOptions extends AXFormatOptions {
|
|
9
|
+
format: string;
|
|
10
|
+
}
|
|
11
|
+
declare module '@acorex/core/format' {
|
|
12
|
+
interface AXFormatOptionsMap {
|
|
13
|
+
filesize: AXFileSizeFormatterOptions;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
declare class AXFileSizeFormatter implements AXFormatter {
|
|
17
|
+
/**
|
|
18
|
+
* Gets the name of the formatter.
|
|
19
|
+
*
|
|
20
|
+
* @returns string - The formatter name 'filesize'
|
|
21
|
+
*/
|
|
22
|
+
get name(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Formats a file size value to human-readable format.
|
|
25
|
+
*
|
|
26
|
+
* @param value - The file size in bytes
|
|
27
|
+
* @returns string - The formatted file size string (e.g., '1.5 MB')
|
|
28
|
+
*/
|
|
29
|
+
format(value: number): string;
|
|
30
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileSizeFormatter, never>;
|
|
31
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXFileSizeFormatter>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Human-readable file size (binary units, e.g. `41.5 MB`). */
|
|
35
|
+
declare function formatFileSizeBytes(bytes: number): string;
|
|
36
|
+
|
|
37
|
+
/** Generic rule executed via {@link AXValidationService}. */
|
|
38
|
+
interface AXFileValidationRule {
|
|
39
|
+
rule: string;
|
|
40
|
+
options?: AXValidationRuleOptions;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Common file constraints shared by {@link AXFileType} and {@link AXFileTypeExtension}.
|
|
44
|
+
* Extension `validations` are partial and override the parent type field-by-field.
|
|
45
|
+
*/
|
|
46
|
+
interface AXFileValidations {
|
|
47
|
+
mimeTypes?: string[];
|
|
48
|
+
minSize?: number;
|
|
49
|
+
maxSize?: number;
|
|
50
|
+
rules?: AXFileValidationRule[];
|
|
51
|
+
}
|
|
52
|
+
/** Extension entry; `validations` override the parent {@link AXFileType.validations}. */
|
|
53
|
+
interface AXFileTypeExtension {
|
|
54
|
+
name: string;
|
|
55
|
+
title?: string;
|
|
56
|
+
icon?: string;
|
|
57
|
+
validations?: Partial<AXFileValidations>;
|
|
58
|
+
}
|
|
59
|
+
/** Context passed to {@link AXFileType.utilities} handlers. */
|
|
60
|
+
interface AXFileTypeUtilitiesContext {
|
|
61
|
+
readAsDataUrl: (file: File | Blob) => Promise<string>;
|
|
62
|
+
/** Angular `PLATFORM_ID` or similar for browser-only APIs. */
|
|
63
|
+
platformId: object;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Named utility handler. Each file type only registers the keys it supports
|
|
67
|
+
* (e.g. image: `preview`; video: `preview`, `duration`).
|
|
68
|
+
*/
|
|
69
|
+
type AXFileTypeUtility = (ctx: AXFileTypeUtilitiesContext, ...args: unknown[]) => Promise<unknown> | unknown;
|
|
70
|
+
/**
|
|
71
|
+
* Logical file category (image, video, …).
|
|
72
|
+
*
|
|
73
|
+
* - With type `validations` set: any file matching those rules is allowed; `extensions` only override when matched.
|
|
74
|
+
* - With empty / omitted `validations` and `extensions` listed: only those extensions are allowed.
|
|
75
|
+
*/
|
|
76
|
+
interface AXFileType {
|
|
77
|
+
name: string;
|
|
78
|
+
title?: string;
|
|
79
|
+
icon?: string;
|
|
80
|
+
validations?: AXFileValidations;
|
|
81
|
+
extensions?: AXFileTypeExtension[];
|
|
82
|
+
/** Named helpers; only define keys this type supports. */
|
|
83
|
+
utilities?: Record<string, AXFileTypeUtility>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Well-known utility keys (optional per {@link AXFileType}). */
|
|
87
|
+
declare const AX_FILE_TYPE_UTILITY: {
|
|
88
|
+
readonly preview: "preview";
|
|
89
|
+
readonly duration: "duration";
|
|
90
|
+
readonly formatSize: "formatSize";
|
|
91
|
+
readonly formatDuration: "formatDuration";
|
|
92
|
+
readonly createLocalPreviewUrl: "createLocalPreviewUrl";
|
|
93
|
+
/** Resolves catalog name for mixed file-picker rows. */
|
|
94
|
+
readonly pickerCatalog: "pickerCatalog";
|
|
95
|
+
};
|
|
96
|
+
type AXFileTypeUtilityName = (typeof AX_FILE_TYPE_UTILITY)[keyof typeof AX_FILE_TYPE_UTILITY];
|
|
97
|
+
declare function createFileTypeUtilitiesContext(readAsDataUrl: (file: File | Blob) => Promise<string>, platformId: object): AXFileTypeUtilitiesContext;
|
|
98
|
+
declare function hasFileTypeUtility(fileType: AXFileType | undefined, name: string): fileType is AXFileType & {
|
|
99
|
+
utilities: Record<string, AXFileTypeUtility>;
|
|
100
|
+
};
|
|
101
|
+
declare function runFileTypeUtility<T>(fileType: AXFileType | undefined, name: string, ctx: AXFileTypeUtilitiesContext, ...args: unknown[]): Promise<T | undefined>;
|
|
102
|
+
declare function runFileTypeUtilitySync<T>(fileType: AXFileType | undefined, name: string, ctx: AXFileTypeUtilitiesContext, ...args: unknown[]): T | undefined;
|
|
103
|
+
|
|
104
|
+
/** Contributes {@link AXFileType} entries (multi provider). */
|
|
105
|
+
declare abstract class AXFileTypeInfoProvider {
|
|
106
|
+
abstract items(): Promise<AXFileType[]>;
|
|
107
|
+
}
|
|
108
|
+
declare const AX_FILE_TYPE_INFO_PROVIDER: InjectionToken<AXFileTypeInfoProvider[]>;
|
|
109
|
+
declare function provideFileTypeInfoProvider(provider: Type<AXFileTypeInfoProvider>): Provider;
|
|
110
|
+
|
|
111
|
+
declare class AXFileTypeRegistryService {
|
|
112
|
+
private readonly validation;
|
|
113
|
+
private readonly providers;
|
|
114
|
+
private readonly registeredTypes;
|
|
115
|
+
private cache;
|
|
116
|
+
/** Registers or replaces catalog entries (e.g. from feature bootstrap). */
|
|
117
|
+
registerTypes(types: AXFileType[]): void;
|
|
118
|
+
invalidateCache(): void;
|
|
119
|
+
private resolveTypes;
|
|
120
|
+
getTypes(): Promise<AXFileType[]>;
|
|
121
|
+
get(name: string): Promise<AXFileType | undefined>;
|
|
122
|
+
accept(typeNames?: string | string[]): Promise<string>;
|
|
123
|
+
matchType(file: File): Promise<AXFileType | undefined>;
|
|
124
|
+
validate(file: File, typeName: string): Promise<AXValidationRuleResult[]>;
|
|
125
|
+
validateAgainstTypes(file: File, typeNames: string | string[]): Promise<AXValidationRuleResult[]>;
|
|
126
|
+
validateMany(files: File[], typeNames: string | string[]): Promise<{
|
|
127
|
+
accepted: File[];
|
|
128
|
+
rejected: {
|
|
129
|
+
file: File;
|
|
130
|
+
errors: AXValidationRuleResult[];
|
|
131
|
+
}[];
|
|
132
|
+
}>;
|
|
133
|
+
private matchesMime;
|
|
134
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileTypeRegistryService, never>;
|
|
135
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXFileTypeRegistryService>;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Merges type-level validations with extension overrides (extension wins per field). */
|
|
139
|
+
declare function mergeFileValidations(base: AXFileValidations, override?: Partial<AXFileValidations>): AXFileValidations;
|
|
140
|
+
/** Resolved validations for a type + optional extension. */
|
|
141
|
+
declare function resolveFileValidations(type: AXFileType, extension?: AXFileTypeExtension): AXFileValidations;
|
|
142
|
+
/** True when no mime/size/rules are defined on the type. */
|
|
143
|
+
declare function isEmptyFileValidations(validations?: AXFileValidations): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Extension-only mode: empty type `validations` and a non-empty `extensions` list.
|
|
146
|
+
* Files must match a listed extension; rules come from that extension entry.
|
|
147
|
+
*/
|
|
148
|
+
declare function isExtensionsOnlyType(type: AXFileType): boolean;
|
|
149
|
+
/** File extension from name (lowercase, no dot). */
|
|
150
|
+
declare function getFileExtension(fileName: string): string;
|
|
151
|
+
/** Matching extension entry for a file within a type, if any. */
|
|
152
|
+
declare function findFileTypeExtension(file: File, type: AXFileType): AXFileTypeExtension | undefined;
|
|
153
|
+
|
|
154
|
+
/** Maps {@link AXFileValidations} to executable validation entries. */
|
|
155
|
+
declare function fileValidationsToRules(validations: AXFileValidations): AXFileValidationRule[];
|
|
156
|
+
/** Failed validation results; empty array means the file is valid. */
|
|
157
|
+
declare function validateFileWithValidations(validation: AXValidationService, file: File, validations: AXFileValidations): Promise<AXValidationRuleResult[]>;
|
|
158
|
+
/** Validates a file against a type; extension rules override when the file name matches. */
|
|
159
|
+
declare function validateFileAgainstType(validation: AXValidationService, file: File, type: AXFileType, extension?: AXFileTypeExtension): Promise<AXValidationRuleResult[]>;
|
|
160
|
+
|
|
161
|
+
declare const AX_AUDIO_FILE_TYPE: AXFileType;
|
|
162
|
+
declare class AXAudioFileTypeProvider extends AXFileTypeInfoProvider {
|
|
163
|
+
items(): Promise<AXFileType[]>;
|
|
164
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXAudioFileTypeProvider, never>;
|
|
165
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXAudioFileTypeProvider>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** Extension-only: no type `validations` — only listed extensions are allowed. */
|
|
169
|
+
declare const AX_DOCUMENT_FILE_TYPE: AXFileType;
|
|
170
|
+
declare class AXDocumentFileTypeProvider extends AXFileTypeInfoProvider {
|
|
171
|
+
items(): Promise<AXFileType[]>;
|
|
172
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXDocumentFileTypeProvider, never>;
|
|
173
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXDocumentFileTypeProvider>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare const AX_FILE_FILE_TYPE: AXFileType;
|
|
177
|
+
declare class AXFileFileTypeProvider extends AXFileTypeInfoProvider {
|
|
178
|
+
items(): Promise<AXFileType[]>;
|
|
179
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileFileTypeProvider, never>;
|
|
180
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXFileFileTypeProvider>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare const AX_IMAGE_FILE_TYPE: AXFileType;
|
|
184
|
+
declare class AXImageFileTypeProvider extends AXFileTypeInfoProvider {
|
|
185
|
+
items(): Promise<AXFileType[]>;
|
|
186
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXImageFileTypeProvider, never>;
|
|
187
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXImageFileTypeProvider>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
declare const AX_VIDEO_FILE_TYPE: AXFileType;
|
|
191
|
+
declare class AXVideoFileTypeProvider extends AXFileTypeInfoProvider {
|
|
192
|
+
items(): Promise<AXFileType[]>;
|
|
193
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXVideoFileTypeProvider, never>;
|
|
194
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXVideoFileTypeProvider>;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Built-in file type provider classes (one logical type per provider). */
|
|
198
|
+
declare const AX_BUILTIN_FILE_TYPE_PROVIDERS: readonly [typeof AXImageFileTypeProvider, typeof AXVideoFileTypeProvider, typeof AXAudioFileTypeProvider, typeof AXFileFileTypeProvider, typeof AXDocumentFileTypeProvider];
|
|
199
|
+
/** Registers all built-in file type providers (image, video, audio, file, document). */
|
|
200
|
+
declare function provideBuiltinFileTypeProviders(): Provider[];
|
|
201
|
+
/** @deprecated Use {@link provideBuiltinFileTypeProviders}. */
|
|
202
|
+
declare const provideDefaultFileTypeProviders: typeof provideBuiltinFileTypeProviders;
|
|
203
|
+
|
|
204
|
+
interface AXFileMimeTypeValidationRuleOptions extends AXValidationRuleOptions {
|
|
205
|
+
/** MIME patterns, e.g. `image/*`, `image/png`. */
|
|
206
|
+
allowed: string[];
|
|
207
|
+
}
|
|
208
|
+
declare module '@acorex/core/validation' {
|
|
209
|
+
interface AXValidationRuleOptionsMap {
|
|
210
|
+
fileMimeType: AXFileMimeTypeValidationRuleOptions;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
declare class AXFileMimeTypeValidationRule implements AXValidationRule {
|
|
214
|
+
get name(): string;
|
|
215
|
+
validate(value: File | Blob, options: AXFileMimeTypeValidationRuleOptions): Promise<AXValidationRuleResult>;
|
|
216
|
+
private matchesMime;
|
|
217
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileMimeTypeValidationRule, never>;
|
|
218
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXFileMimeTypeValidationRule>;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface AXFileMinSizeValidationRuleOptions extends AXValidationRuleOptions {
|
|
222
|
+
/** Minimum size in bytes. */
|
|
223
|
+
minSize: number;
|
|
224
|
+
}
|
|
225
|
+
declare module '@acorex/core/validation' {
|
|
226
|
+
interface AXValidationRuleOptionsMap {
|
|
227
|
+
fileMinSize: AXFileMinSizeValidationRuleOptions;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
declare class AXFileMinSizeValidationRule implements AXValidationRule {
|
|
231
|
+
get name(): string;
|
|
232
|
+
validate(value: File | Blob, options: AXFileMinSizeValidationRuleOptions): Promise<AXValidationRuleResult>;
|
|
233
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileMinSizeValidationRule, never>;
|
|
234
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXFileMinSizeValidationRule>;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface AXFileMaxSizeValidationRuleOptions extends AXValidationRuleOptions {
|
|
238
|
+
/** Maximum size in bytes. */
|
|
239
|
+
maxSize: number;
|
|
240
|
+
}
|
|
241
|
+
declare module '@acorex/core/validation' {
|
|
242
|
+
interface AXValidationRuleOptionsMap {
|
|
243
|
+
fileMaxSize: AXFileMaxSizeValidationRuleOptions;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
declare class AXFileMaxSizeValidationRule implements AXValidationRule {
|
|
247
|
+
get name(): string;
|
|
248
|
+
validate(value: File | Blob, options: AXFileMaxSizeValidationRuleOptions): Promise<AXValidationRuleResult>;
|
|
249
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileMaxSizeValidationRule, never>;
|
|
250
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXFileMaxSizeValidationRule>;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Validation rule classes to register with {@link AXValidationModule}. */
|
|
254
|
+
declare const AX_FILE_VALIDATION_RULES: readonly [typeof AXFileMimeTypeValidationRule, typeof AXFileMinSizeValidationRule, typeof AXFileMaxSizeValidationRule];
|
|
255
|
+
/** Registers file validation rules with {@link AXValidationRegistryService}. */
|
|
256
|
+
declare function provideFileValidationRules(): Provider;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Registers validation rules and optional built-in file type providers.
|
|
260
|
+
* {@link AXFileTypeRegistryService} and {@link AXFileService} are `providedIn: 'root'`.
|
|
261
|
+
*/
|
|
262
|
+
declare function provideFileTypeSystem(): Provider[];
|
|
263
|
+
|
|
264
|
+
interface AXFileModuleConfig {
|
|
265
|
+
fileTypeProviders?: Provider[];
|
|
266
|
+
includeDefaultFileTypes?: boolean;
|
|
267
|
+
}
|
|
268
|
+
declare class AXFileModule {
|
|
269
|
+
static forRoot(config?: AXFileModuleConfig): ModuleWithProviders<AXFileModule>;
|
|
270
|
+
static forChild(config?: AXFileModuleConfig): ModuleWithProviders<AXFileModule>;
|
|
271
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileModule, never>;
|
|
272
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AXFileModule, never, [typeof i1.AXFormatModule, typeof i2.AXValidationModule], never>;
|
|
273
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<AXFileModule>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
interface AXFileChooseOptions {
|
|
277
|
+
/** Logical type name(s) from {@link AXFileTypeRegistryService}. When set, files are validated against the catalog. */
|
|
278
|
+
fileType?: string | string[];
|
|
279
|
+
accept?: string;
|
|
280
|
+
multiple?: boolean;
|
|
281
|
+
}
|
|
282
|
+
declare class AXFileService {
|
|
283
|
+
private readonly document;
|
|
284
|
+
private readonly fileTypes;
|
|
285
|
+
getFileTypes(): Promise<AXFileType[]>;
|
|
286
|
+
getFileType(name: string): Promise<AXFileType | undefined>;
|
|
287
|
+
getAcceptAttribute(fileType?: string | string[]): Promise<string>;
|
|
288
|
+
matchFileType(file: File): Promise<AXFileType | undefined>;
|
|
289
|
+
validate(file: File, fileType: string | string[]): Promise<AXValidationRuleResult[]>;
|
|
290
|
+
validateMany(files: File[], fileType: string | string[]): Promise<{
|
|
291
|
+
accepted: File[];
|
|
292
|
+
rejected: {
|
|
293
|
+
file: File;
|
|
294
|
+
errors: AXValidationRuleResult[];
|
|
295
|
+
}[];
|
|
296
|
+
}>;
|
|
297
|
+
/**
|
|
298
|
+
* Opens a file selection dialog.
|
|
299
|
+
* With `fileType`, returns files that pass catalog validation (`accept` defaults from the catalog).
|
|
300
|
+
* Without `fileType`, returns all selected files (legacy `accept` / `multiple` only).
|
|
301
|
+
*/
|
|
302
|
+
chooseValidated(options: AXFileChooseOptions): Promise<{
|
|
303
|
+
accepted: File[];
|
|
304
|
+
rejected: {
|
|
305
|
+
file: File;
|
|
306
|
+
errors: AXValidationRuleResult[];
|
|
307
|
+
}[];
|
|
308
|
+
}>;
|
|
309
|
+
choose(options: AXFileChooseOptions): Promise<File[]>;
|
|
310
|
+
blobToBase64(blob: Blob): Promise<string>;
|
|
311
|
+
getSize(file: File | Blob | string): number | false;
|
|
312
|
+
isBase64(base64: string): boolean;
|
|
313
|
+
getBase64Size(base64: string): number;
|
|
314
|
+
private resolveChooseOptions;
|
|
315
|
+
private openFileDialog;
|
|
316
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileService, never>;
|
|
317
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AXFileService>;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
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_TYPE_UTILITY, AX_FILE_VALIDATION_RULES, AX_IMAGE_FILE_TYPE, AX_VIDEO_FILE_TYPE, createFileTypeUtilitiesContext, fileValidationsToRules, findFileTypeExtension, formatFileSizeBytes, getFileExtension, hasFileTypeUtility, isEmptyFileValidations, isExtensionsOnlyType, mergeFileValidations, provideBuiltinFileTypeProviders, provideDefaultFileTypeProviders, provideFileTypeInfoProvider, provideFileTypeSystem, provideFileValidationRules, resolveFileValidations, runFileTypeUtility, runFileTypeUtilitySync, validateFileAgainstType, validateFileWithValidations };
|
|
321
|
+
export type { AXFileChooseOptions, AXFileMaxSizeValidationRuleOptions, AXFileMimeTypeValidationRuleOptions, AXFileMinSizeValidationRuleOptions, AXFileModuleConfig, AXFileSizeFormatterOptions, AXFileType, AXFileTypeExtension, AXFileTypeUtilitiesContext, AXFileTypeUtility, AXFileTypeUtilityName, AXFileValidationRule, AXFileValidations };
|
|
@@ -142,7 +142,7 @@ interface AXNumberFormatterOptions extends AXFormatOptions {
|
|
|
142
142
|
zeroPadLength?: number;
|
|
143
143
|
locale?: string;
|
|
144
144
|
}
|
|
145
|
-
declare module "./
|
|
145
|
+
declare module "./index" {
|
|
146
146
|
interface AXFormatOptionsMap {
|
|
147
147
|
number: AXNumberFormatterOptions;
|
|
148
148
|
}
|
|
@@ -159,7 +159,7 @@ declare class AXNumberFormatter implements AXFormatter {
|
|
|
159
159
|
interface AXStringFormatterOptions extends AXFormatOptions {
|
|
160
160
|
[key: string]: any;
|
|
161
161
|
}
|
|
162
|
-
declare module "./
|
|
162
|
+
declare module "./index" {
|
|
163
163
|
interface AXFormatOptionsMap {
|
|
164
164
|
string: AXStringFormatterOptions;
|
|
165
165
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acorex/core",
|
|
3
|
-
"version": "21.0.2-next.
|
|
3
|
+
"version": "21.0.2-next.24",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"lodash-es": ">=4.17.21",
|
|
6
6
|
"memoizee": ">=0.4.15",
|
|
@@ -13,93 +13,93 @@
|
|
|
13
13
|
},
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"module": "fesm2022/acorex-core.mjs",
|
|
16
|
-
"typings": "
|
|
16
|
+
"typings": "index.d.ts",
|
|
17
17
|
"exports": {
|
|
18
18
|
"./package.json": {
|
|
19
19
|
"default": "./package.json"
|
|
20
20
|
},
|
|
21
21
|
".": {
|
|
22
|
-
"types": "./
|
|
22
|
+
"types": "./index.d.ts",
|
|
23
23
|
"default": "./fesm2022/acorex-core.mjs"
|
|
24
24
|
},
|
|
25
25
|
"./components": {
|
|
26
|
-
"types": "./
|
|
26
|
+
"types": "./components/index.d.ts",
|
|
27
27
|
"default": "./fesm2022/acorex-core-components.mjs"
|
|
28
28
|
},
|
|
29
29
|
"./config": {
|
|
30
|
-
"types": "./
|
|
30
|
+
"types": "./config/index.d.ts",
|
|
31
31
|
"default": "./fesm2022/acorex-core-config.mjs"
|
|
32
32
|
},
|
|
33
33
|
"./constants": {
|
|
34
|
-
"types": "./
|
|
34
|
+
"types": "./constants/index.d.ts",
|
|
35
35
|
"default": "./fesm2022/acorex-core-constants.mjs"
|
|
36
36
|
},
|
|
37
37
|
"./date-time": {
|
|
38
|
-
"types": "./
|
|
38
|
+
"types": "./date-time/index.d.ts",
|
|
39
39
|
"default": "./fesm2022/acorex-core-date-time.mjs"
|
|
40
40
|
},
|
|
41
41
|
"./events": {
|
|
42
|
-
"types": "./
|
|
42
|
+
"types": "./events/index.d.ts",
|
|
43
43
|
"default": "./fesm2022/acorex-core-events.mjs"
|
|
44
44
|
},
|
|
45
45
|
"./file": {
|
|
46
|
-
"types": "./
|
|
46
|
+
"types": "./file/index.d.ts",
|
|
47
47
|
"default": "./fesm2022/acorex-core-file.mjs"
|
|
48
48
|
},
|
|
49
49
|
"./format": {
|
|
50
|
-
"types": "./
|
|
50
|
+
"types": "./format/index.d.ts",
|
|
51
51
|
"default": "./fesm2022/acorex-core-format.mjs"
|
|
52
52
|
},
|
|
53
53
|
"./full-screen": {
|
|
54
|
-
"types": "./
|
|
54
|
+
"types": "./full-screen/index.d.ts",
|
|
55
55
|
"default": "./fesm2022/acorex-core-full-screen.mjs"
|
|
56
56
|
},
|
|
57
57
|
"./icon": {
|
|
58
|
-
"types": "./
|
|
58
|
+
"types": "./icon/index.d.ts",
|
|
59
59
|
"default": "./fesm2022/acorex-core-icon.mjs"
|
|
60
60
|
},
|
|
61
61
|
"./image": {
|
|
62
|
-
"types": "./
|
|
62
|
+
"types": "./image/index.d.ts",
|
|
63
63
|
"default": "./fesm2022/acorex-core-image.mjs"
|
|
64
64
|
},
|
|
65
65
|
"./locale": {
|
|
66
|
-
"types": "./
|
|
66
|
+
"types": "./locale/index.d.ts",
|
|
67
67
|
"default": "./fesm2022/acorex-core-locale.mjs"
|
|
68
68
|
},
|
|
69
69
|
"./memoize": {
|
|
70
|
-
"types": "./
|
|
70
|
+
"types": "./memoize/index.d.ts",
|
|
71
71
|
"default": "./fesm2022/acorex-core-memoize.mjs"
|
|
72
72
|
},
|
|
73
73
|
"./network": {
|
|
74
|
-
"types": "./
|
|
74
|
+
"types": "./network/index.d.ts",
|
|
75
75
|
"default": "./fesm2022/acorex-core-network.mjs"
|
|
76
76
|
},
|
|
77
77
|
"./pipes": {
|
|
78
|
-
"types": "./
|
|
78
|
+
"types": "./pipes/index.d.ts",
|
|
79
79
|
"default": "./fesm2022/acorex-core-pipes.mjs"
|
|
80
80
|
},
|
|
81
81
|
"./platform": {
|
|
82
|
-
"types": "./
|
|
82
|
+
"types": "./platform/index.d.ts",
|
|
83
83
|
"default": "./fesm2022/acorex-core-platform.mjs"
|
|
84
84
|
},
|
|
85
85
|
"./storage": {
|
|
86
|
-
"types": "./
|
|
86
|
+
"types": "./storage/index.d.ts",
|
|
87
87
|
"default": "./fesm2022/acorex-core-storage.mjs"
|
|
88
88
|
},
|
|
89
89
|
"./translation": {
|
|
90
|
-
"types": "./
|
|
90
|
+
"types": "./translation/index.d.ts",
|
|
91
91
|
"default": "./fesm2022/acorex-core-translation.mjs"
|
|
92
92
|
},
|
|
93
93
|
"./utils": {
|
|
94
|
-
"types": "./
|
|
94
|
+
"types": "./utils/index.d.ts",
|
|
95
95
|
"default": "./fesm2022/acorex-core-utils.mjs"
|
|
96
96
|
},
|
|
97
97
|
"./validation": {
|
|
98
|
-
"types": "./
|
|
98
|
+
"types": "./validation/index.d.ts",
|
|
99
99
|
"default": "./fesm2022/acorex-core-validation.mjs"
|
|
100
100
|
},
|
|
101
101
|
"./z-index": {
|
|
102
|
-
"types": "./
|
|
102
|
+
"types": "./z-index/index.d.ts",
|
|
103
103
|
"default": "./fesm2022/acorex-core-z-index.mjs"
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -83,14 +83,6 @@ declare function debounceAsync<T extends (...args: any[]) => Promise<any>>(fn: T
|
|
|
83
83
|
*/
|
|
84
84
|
declare function fallbackChain<T>(tasks: Array<() => Promise<T>>): Promise<T>;
|
|
85
85
|
|
|
86
|
-
/** ACoreX layout size classes applied on a host or container. */
|
|
87
|
-
declare const AX_SIZE_CLASSES: readonly ["ax-xs", "ax-sm", "ax-md", "ax-lg", "ax-xl"];
|
|
88
|
-
type AXSizeClass = (typeof AX_SIZE_CLASSES)[number];
|
|
89
|
-
/** Resolved ACoreX size: the DOM node that carries the token and the token itself. */
|
|
90
|
-
interface AXClosestAxSizeMatch {
|
|
91
|
-
element: HTMLElement;
|
|
92
|
-
sizeClass: AXSizeClass;
|
|
93
|
-
}
|
|
94
86
|
declare class AXHtmlUtil {
|
|
95
87
|
static focusElement(element: HTMLElement): HTMLElement;
|
|
96
88
|
static blurElement(element: HTMLElement): HTMLElement;
|
|
@@ -122,5 +114,5 @@ declare function getWordBoundsAtPosition(str: string, position: number): {
|
|
|
122
114
|
end: number;
|
|
123
115
|
};
|
|
124
116
|
|
|
125
|
-
export { AXAutoUnsubscriber, AXColorUtil, AXDrawingUtil, AXHtmlUtil, AXUnsubscriber,
|
|
126
|
-
export type { AXBoundingClientRect,
|
|
117
|
+
export { AXAutoUnsubscriber, AXColorUtil, AXDrawingUtil, AXHtmlUtil, AXUnsubscriber, debounceAsync, delay, fallbackChain, getWordBoundsAtPosition, pollUntil, pollUntilAbortable, retryUntil, throttleAsync, waitFor };
|
|
118
|
+
export type { AXBoundingClientRect, AXColorFormat, AXColorMode, AXPoint };
|
|
@@ -34,7 +34,7 @@ type AXCallbackValidation<T> = (value: T, options?: AXCallbackValidationRuleOpti
|
|
|
34
34
|
interface AXCallbackValidationRuleOptions<T> extends AXValidationRuleOptions {
|
|
35
35
|
validate: AXCallbackValidation<T>;
|
|
36
36
|
}
|
|
37
|
-
declare module "./
|
|
37
|
+
declare module "./index" {
|
|
38
38
|
interface AXValidationRuleOptionsMap {
|
|
39
39
|
callback: AXCallbackValidationRuleOptions<unknown>;
|
|
40
40
|
}
|
|
@@ -49,7 +49,7 @@ declare class AXCallbackValidationRule<T> implements AXValidationRule {
|
|
|
49
49
|
interface AXRegexValidationRuleOptions extends AXValidationRuleOptions {
|
|
50
50
|
pattern: string | RegExp;
|
|
51
51
|
}
|
|
52
|
-
declare module "./
|
|
52
|
+
declare module "./index" {
|
|
53
53
|
interface AXValidationRuleOptionsMap {
|
|
54
54
|
regex: AXRegexValidationRuleOptions;
|
|
55
55
|
}
|
|
@@ -64,7 +64,7 @@ declare class AXRegexValidationRule implements AXValidationRule {
|
|
|
64
64
|
|
|
65
65
|
interface AXRequiredValidationRuleOptions extends AXValidationRuleOptions {
|
|
66
66
|
}
|
|
67
|
-
declare module "./
|
|
67
|
+
declare module "./index" {
|
|
68
68
|
interface AXValidationRuleOptionsMap {
|
|
69
69
|
required: AXRequiredValidationRuleOptions;
|
|
70
70
|
}
|
|
@@ -81,7 +81,7 @@ interface AXLengthValidationRuleOptions extends AXValidationRuleOptions {
|
|
|
81
81
|
min: number;
|
|
82
82
|
max: number;
|
|
83
83
|
}
|
|
84
|
-
declare module "./
|
|
84
|
+
declare module "./index" {
|
|
85
85
|
interface AXValidationRuleOptionsMap {
|
|
86
86
|
length: AXLengthValidationRuleOptions;
|
|
87
87
|
}
|
|
@@ -96,7 +96,7 @@ declare class AXLengthValidationRule implements AXValidationRule {
|
|
|
96
96
|
interface AXMaxLengthValidationRuleOptions extends AXValidationRuleOptions {
|
|
97
97
|
value: number;
|
|
98
98
|
}
|
|
99
|
-
declare module "./
|
|
99
|
+
declare module "./index" {
|
|
100
100
|
interface AXValidationRuleOptionsMap {
|
|
101
101
|
maxLength: AXMaxLengthValidationRuleOptions;
|
|
102
102
|
}
|
|
@@ -111,7 +111,7 @@ declare class AXMaxLengthValidationRule implements AXValidationRule {
|
|
|
111
111
|
interface AXMinLengthValidationRuleOptions extends AXValidationRuleOptions {
|
|
112
112
|
value: number;
|
|
113
113
|
}
|
|
114
|
-
declare module "./
|
|
114
|
+
declare module "./index" {
|
|
115
115
|
interface AXValidationRuleOptionsMap {
|
|
116
116
|
minLength: AXMinLengthValidationRuleOptions;
|
|
117
117
|
}
|
|
@@ -128,7 +128,7 @@ interface AXBetweenValidationRuleOptions<T = number | Date> extends AXValidation
|
|
|
128
128
|
upperValue: T;
|
|
129
129
|
inclusive?: boolean;
|
|
130
130
|
}
|
|
131
|
-
declare module "./
|
|
131
|
+
declare module "./index" {
|
|
132
132
|
interface AXValidationRuleOptionsMap {
|
|
133
133
|
between: AXBetweenValidationRuleOptions;
|
|
134
134
|
}
|
|
@@ -144,7 +144,7 @@ interface AXEqualValidationRuleOptions extends AXValidationRuleOptions {
|
|
|
144
144
|
value: any;
|
|
145
145
|
not?: boolean;
|
|
146
146
|
}
|
|
147
|
-
declare module "./
|
|
147
|
+
declare module "./index" {
|
|
148
148
|
interface AXValidationRuleOptionsMap {
|
|
149
149
|
equal: AXEqualValidationRuleOptions;
|
|
150
150
|
}
|
|
@@ -160,7 +160,7 @@ interface AXGreaterThanValidationRuleOptions extends AXValidationRuleOptions {
|
|
|
160
160
|
value: number;
|
|
161
161
|
inclusive?: boolean;
|
|
162
162
|
}
|
|
163
|
-
declare module "./
|
|
163
|
+
declare module "./index" {
|
|
164
164
|
interface AXValidationRuleOptionsMap {
|
|
165
165
|
greaterThan: AXGreaterThanValidationRuleOptions;
|
|
166
166
|
}
|
|
@@ -176,7 +176,7 @@ interface AXLessThanValidationRuleOptions extends AXValidationRuleOptions {
|
|
|
176
176
|
value: number;
|
|
177
177
|
inclusive?: boolean;
|
|
178
178
|
}
|
|
179
|
-
declare module "./
|
|
179
|
+
declare module "./index" {
|
|
180
180
|
interface AXValidationRuleOptionsMap {
|
|
181
181
|
lessThan: AXLessThanValidationRuleOptions;
|
|
182
182
|
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import * as i1 from '@acorex/core/format';
|
|
2
|
-
import { AXFormatOptions, AXFormatter } from '@acorex/core/format';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
|
|
5
|
-
interface AXFileSizeFormatterOptions extends AXFormatOptions {
|
|
6
|
-
format: string;
|
|
7
|
-
}
|
|
8
|
-
declare module '@acorex/core/format' {
|
|
9
|
-
interface AXFormatOptionsMap {
|
|
10
|
-
filesize: AXFileSizeFormatterOptions;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
declare class AXFileSizeFormatter implements AXFormatter {
|
|
14
|
-
/**
|
|
15
|
-
* Gets the name of the formatter.
|
|
16
|
-
*
|
|
17
|
-
* @returns string - The formatter name 'filesize'
|
|
18
|
-
*/
|
|
19
|
-
get name(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Formats a file size value to human-readable format.
|
|
22
|
-
*
|
|
23
|
-
* @param value - The file size in bytes
|
|
24
|
-
* @returns string - The formatted file size string (e.g., '1.5 MB')
|
|
25
|
-
*/
|
|
26
|
-
format(value: number): string;
|
|
27
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileSizeFormatter, never>;
|
|
28
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AXFileSizeFormatter>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
declare class AXFileModule {
|
|
32
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileModule, never>;
|
|
33
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<AXFileModule, never, [typeof i1.AXFormatModule], never>;
|
|
34
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<AXFileModule>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
declare class AXFileService {
|
|
38
|
-
private document;
|
|
39
|
-
private platformID;
|
|
40
|
-
/**
|
|
41
|
-
* Opens a file selection dialog and returns the selected files.
|
|
42
|
-
*
|
|
43
|
-
* @param options - Optional configuration for file selection
|
|
44
|
-
* @param options.accept - File types to accept (e.g., 'image/*', '.pdf')
|
|
45
|
-
* @param options.multiple - Whether to allow multiple file selection
|
|
46
|
-
* @returns Promise<File[]> - Promise that resolves with the selected files
|
|
47
|
-
*/
|
|
48
|
-
choose(options?: {
|
|
49
|
-
accept?: string;
|
|
50
|
-
multiple?: boolean;
|
|
51
|
-
}): Promise<File[]>;
|
|
52
|
-
/**
|
|
53
|
-
* Gets the size of a file, blob, or base64 string.
|
|
54
|
-
*
|
|
55
|
-
* @param file - The file, blob, or base64 string to get size for
|
|
56
|
-
* @returns number | false - The size in bytes or false if not a base64 string
|
|
57
|
-
*/
|
|
58
|
-
blobToBase64: (blob: Blob) => Promise<string>;
|
|
59
|
-
/**
|
|
60
|
-
* Gets the size of a file, blob, or base64 string.
|
|
61
|
-
*
|
|
62
|
-
* @param file - The file, blob, or base64 string to get size for
|
|
63
|
-
* @returns number | false - The size in bytes or false if not a base64 string
|
|
64
|
-
*/
|
|
65
|
-
getSize(file: File | Blob | string): number | false;
|
|
66
|
-
/**
|
|
67
|
-
* Checks if a string is a valid base64 string.
|
|
68
|
-
*
|
|
69
|
-
* @param base64 - The string to check
|
|
70
|
-
* @returns boolean - True if the string is a valid base64 string
|
|
71
|
-
*/
|
|
72
|
-
isBase64(base64: string): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Gets the size of a base64 string in bytes.
|
|
75
|
-
*
|
|
76
|
-
* @param base64 - The base64 string to get size for
|
|
77
|
-
* @returns number - The size in bytes
|
|
78
|
-
*/
|
|
79
|
-
getBase64Size(base64: string): number;
|
|
80
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AXFileService, never>;
|
|
81
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AXFileService>;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export { AXFileModule, AXFileService, AXFileSizeFormatter };
|
|
85
|
-
export type { AXFileSizeFormatterOptions };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|