@aemforms/af-core 0.22.87 → 0.22.88
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/esm/afb-runtime.js +19 -1
- package/esm/types/src/FileObject.d.ts +1 -0
- package/esm/types/src/FileUpload.d.ts +1 -1
- package/lib/FileObject.d.ts +1 -0
- package/lib/FileObject.js +3 -0
- package/lib/FileUpload.d.ts +1 -1
- package/lib/FileUpload.js +1 -1
- package/lib/rules/FunctionRuntime.js +15 -0
- package/package.json +2 -2
package/esm/afb-runtime.js
CHANGED
|
@@ -592,6 +592,9 @@ class FileObject {
|
|
|
592
592
|
get type() {
|
|
593
593
|
return this.mediaType;
|
|
594
594
|
}
|
|
595
|
+
set type(type) {
|
|
596
|
+
this.mediaType = type;
|
|
597
|
+
}
|
|
595
598
|
toJSON() {
|
|
596
599
|
return {
|
|
597
600
|
'name': this.name,
|
|
@@ -2699,6 +2702,21 @@ class FunctionRuntimeImpl {
|
|
|
2699
2702
|
dispatchEvent: (target, eventName, payload) => {
|
|
2700
2703
|
const args = [target, eventName, payload];
|
|
2701
2704
|
return FunctionRuntimeImpl.getInstance().getFunctions().dispatchEvent._func.call(undefined, args, data, interpreter);
|
|
2705
|
+
},
|
|
2706
|
+
getFiles: (qualifiedName) => {
|
|
2707
|
+
const filesMap = {};
|
|
2708
|
+
if (!qualifiedName) {
|
|
2709
|
+
interpreter.globals.form.visit(function callback(f) {
|
|
2710
|
+
if (f.fieldType === 'file-input' && f.value) {
|
|
2711
|
+
filesMap[f.qualifiedName] = f.serialize();
|
|
2712
|
+
}
|
|
2713
|
+
});
|
|
2714
|
+
}
|
|
2715
|
+
const field = interpreter.globals.form.resolveQualifiedName(qualifiedName);
|
|
2716
|
+
if (field?.fieldType === 'file-input' && field?.value) {
|
|
2717
|
+
filesMap[qualifiedName] = field.serialize();
|
|
2718
|
+
}
|
|
2719
|
+
return filesMap;
|
|
2702
2720
|
}
|
|
2703
2721
|
}
|
|
2704
2722
|
};
|
|
@@ -4307,7 +4325,7 @@ class FileUpload extends Field {
|
|
|
4307
4325
|
}
|
|
4308
4326
|
return dataNodeValue;
|
|
4309
4327
|
}
|
|
4310
|
-
async
|
|
4328
|
+
async serialize() {
|
|
4311
4329
|
const val = this._jsonModel.value;
|
|
4312
4330
|
if (val === undefined) {
|
|
4313
4331
|
return null;
|
|
@@ -21,7 +21,7 @@ declare class FileUpload extends Field implements FieldModel {
|
|
|
21
21
|
protected _applyUpdates(propNames: string[], updates: any): any;
|
|
22
22
|
protected getInternalType(): "file" | "file[]";
|
|
23
23
|
protected getDataNodeValue(typedValue: any): any;
|
|
24
|
-
|
|
24
|
+
serialize(): Promise<unknown[] | null>;
|
|
25
25
|
importData(dataModel: DataGroup): void;
|
|
26
26
|
}
|
|
27
27
|
export default FileUpload;
|
package/lib/FileObject.d.ts
CHANGED
package/lib/FileObject.js
CHANGED
package/lib/FileUpload.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ declare class FileUpload extends Field implements FieldModel {
|
|
|
21
21
|
protected _applyUpdates(propNames: string[], updates: any): any;
|
|
22
22
|
protected getInternalType(): "file" | "file[]";
|
|
23
23
|
protected getDataNodeValue(typedValue: any): any;
|
|
24
|
-
|
|
24
|
+
serialize(): Promise<unknown[] | null>;
|
|
25
25
|
importData(dataModel: DataGroup): void;
|
|
26
26
|
}
|
|
27
27
|
export default FileUpload;
|
package/lib/FileUpload.js
CHANGED
|
@@ -238,6 +238,21 @@ class FunctionRuntimeImpl {
|
|
|
238
238
|
dispatchEvent: (target, eventName, payload) => {
|
|
239
239
|
const args = [target, eventName, payload];
|
|
240
240
|
return FunctionRuntimeImpl.getInstance().getFunctions().dispatchEvent._func.call(undefined, args, data, interpreter);
|
|
241
|
+
},
|
|
242
|
+
getFiles: (qualifiedName) => {
|
|
243
|
+
const filesMap = {};
|
|
244
|
+
if (!qualifiedName) {
|
|
245
|
+
interpreter.globals.form.visit(function callback(f) {
|
|
246
|
+
if (f.fieldType === 'file-input' && f.value) {
|
|
247
|
+
filesMap[f.qualifiedName] = f.serialize();
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
const field = interpreter.globals.form.resolveQualifiedName(qualifiedName);
|
|
252
|
+
if ((field === null || field === void 0 ? void 0 : field.fieldType) === 'file-input' && (field === null || field === void 0 ? void 0 : field.value)) {
|
|
253
|
+
filesMap[qualifiedName] = field.serialize();
|
|
254
|
+
}
|
|
255
|
+
return filesMap;
|
|
241
256
|
}
|
|
242
257
|
}
|
|
243
258
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.88",
|
|
4
4
|
"description": "Core Module for Forms Runtime",
|
|
5
5
|
"author": "Adobe Systems",
|
|
6
6
|
"license": "Adobe Proprietary",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@adobe/json-formula": "0.1.50",
|
|
40
|
-
"@aemforms/af-formatters": "^0.22.
|
|
40
|
+
"@aemforms/af-formatters": "^0.22.88"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|