this.addButtons(container, element);
}
- get values(): Set<number> {
+ get values(): undefined | number | Set<number> {
+ if (this.#singleFileUpload) {
+ const input = this.#container.querySelector<HTMLInputElement>('input[type="hidden"]');
+ if (input === null) {
+ return undefined;
+ }
+
+ return parseInt(input.value, 10);
+ }
+
return new Set(
Array.from(this.#container.querySelectorAll<HTMLInputElement>('input[type="hidden"]')).map((input) =>
parseInt(input.value, 10),
}
}
-export function getValues(fieldId: string): Set<number> {
+export function getValues(fieldId: string): undefined | number | Set<number> {
const field = _data.get(fieldId);
if (field === undefined) {
throw new Error("Unknown field with id '" + fieldId + "'");
export default class FileProcessor extends Field {
protected _getData(): FormBuilderData {
+ const value = getValues(this._fieldId);
+ if (value === undefined) {
+ return {};
+ }
+
return {
- [this._fieldId]: getValues(this._fieldId),
+ [this._fieldId]: value,
};
}
this.addButtons(container, element);
}
get values() {
+ if (this.#singleFileUpload) {
+ const input = this.#container.querySelector('input[type="hidden"]');
+ if (input === null) {
+ return undefined;
+ }
+ return parseInt(input.value, 10);
+ }
return new Set(Array.from(this.#container.querySelectorAll('input[type="hidden"]')).map((input) => parseInt(input.value, 10)));
}
}
Field_1 = tslib_1.__importDefault(Field_1);
class FileProcessor extends Field_1.default {
_getData() {
+ const value = (0, FileProcessor_1.getValues)(this._fieldId);
+ if (value === undefined) {
+ return {};
+ }
return {
- [this._fieldId]: (0, FileProcessor_1.getValues)(this._fieldId),
+ [this._fieldId]: value,
};
}
_readField() {