@formio/js 5.1.2-rc.1 → 5.1.2-rc.3

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.
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
22
22
 
23
- /*! formiojs v5.1.2-rc.1 | https://unpkg.com/formiojs@5.1.2-rc.1/LICENSE.txt */
23
+ /*! formiojs v5.1.2-rc.3 | https://unpkg.com/formiojs@5.1.2-rc.3/LICENSE.txt */
24
24
 
25
25
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
26
26
 
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
22
22
 
23
- /*! formiojs v5.1.2-rc.1 | https://unpkg.com/formiojs@5.1.2-rc.1/LICENSE.txt */
23
+ /*! formiojs v5.1.2-rc.3 | https://unpkg.com/formiojs@5.1.2-rc.3/LICENSE.txt */
24
24
 
25
25
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
26
26
 
package/lib/cjs/Embed.js CHANGED
@@ -418,7 +418,7 @@ Formio.formioReady = new Promise((ready, reject) => {
418
418
  _a._formioReady = ready;
419
419
  _a._formioReadyReject = reject;
420
420
  });
421
- Formio.version = '5.1.2-rc.1';
421
+ Formio.version = '5.1.2-rc.3';
422
422
  // Create a report.
423
423
  Formio.Report = {
424
424
  create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
package/lib/cjs/Formio.js CHANGED
@@ -11,7 +11,7 @@ const CDN_1 = __importDefault(require("./CDN"));
11
11
  const providers_1 = __importDefault(require("./providers"));
12
12
  sdk_1.Formio.cdn = new CDN_1.default();
13
13
  sdk_1.Formio.Providers = providers_1.default;
14
- sdk_1.Formio.version = '5.1.2-rc.1';
14
+ sdk_1.Formio.version = '5.1.2-rc.3';
15
15
  CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
16
16
  const isNil = (val) => val === null || val === undefined;
17
17
  sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -2866,7 +2866,8 @@ class Component extends Element_1.default {
2866
2866
  if ((this.options.readOnly && !this.options.pdf && !this.component.calculateValue) ||
2867
2867
  !(this.component.calculateValue || this.component.calculateValueVariable) ||
2868
2868
  (this.options.server && !this.component.calculateServer) ||
2869
- (flags.dataSourceInitialLoading && allowOverride)) {
2869
+ (flags.dataSourceInitialLoading && allowOverride) ||
2870
+ (this.options.readOnly && this.options.pdf && allowOverride && lodash_1.default.get(this.root, 'submission._id', false))) {
2870
2871
  return false;
2871
2872
  }
2872
2873
  const dataValue = this.dataValue;
@@ -145,7 +145,7 @@ export default class FileComponent extends Field {
145
145
  }[]>;
146
146
  updateProgress(fileInfo: any, progressEvent: any): void;
147
147
  getMultipartOptions(fileToSync: any): any;
148
- uploadFile(fileToSync: any): Promise<any>;
148
+ uploadFile(fileToSync: any): any;
149
149
  upload(): Promise<void | {
150
150
  fileToSync: never;
151
151
  fileInfo: any;
@@ -898,16 +898,17 @@ class FileComponent extends Field_1.default {
898
898
  } }) : false;
899
899
  }
900
900
  uploadFile(fileToSync) {
901
- return __awaiter(this, void 0, void 0, function* () {
902
- return yield this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
903
- // Progress callback
904
- this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => { },
905
- // Abort upload callback
906
- (abort) => this.abortUploads.push({
907
- id: fileToSync.id,
908
- abort,
909
- }), this.getMultipartOptions(fileToSync));
910
- });
901
+ const filePromise = this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
902
+ // Progress callback
903
+ this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
904
+ this.emit('fileUploadingStart', filePromise);
905
+ },
906
+ // Abort upload callback
907
+ (abort) => this.abortUploads.push({
908
+ id: fileToSync.id,
909
+ abort,
910
+ }), this.getMultipartOptions(fileToSync));
911
+ return filePromise;
911
912
  }
912
913
  upload() {
913
914
  return __awaiter(this, void 0, void 0, function* () {
@@ -915,6 +916,7 @@ class FileComponent extends Field_1.default {
915
916
  return Promise.resolve();
916
917
  }
917
918
  return yield Promise.all(this.filesToSync.filesToUpload.map((fileToSync) => __awaiter(this, void 0, void 0, function* () {
919
+ let filePromise = null;
918
920
  let fileInfo = null;
919
921
  try {
920
922
  if (fileToSync.isValidationError) {
@@ -923,11 +925,13 @@ class FileComponent extends Field_1.default {
923
925
  fileInfo,
924
926
  };
925
927
  }
926
- fileInfo = yield this.uploadFile(fileToSync);
928
+ filePromise = this.uploadFile(fileToSync);
929
+ fileInfo = yield filePromise;
927
930
  fileToSync.status = 'success';
928
931
  fileToSync.message = this.t('Succefully uploaded');
929
932
  fileInfo.originalName = fileToSync.originalName;
930
933
  fileInfo.hash = fileToSync.hash;
934
+ this.emit('fileUploadingEnd', filePromise);
931
935
  }
932
936
  catch (response) {
933
937
  fileToSync.status = 'error';
@@ -937,6 +941,7 @@ class FileComponent extends Field_1.default {
937
941
  : response.type === 'abort'
938
942
  ? this.t('Request was aborted')
939
943
  : response.toString();
944
+ this.emit('fileUploadingEnd', filePromise);
940
945
  this.emit('fileUploadError', {
941
946
  fileToSync,
942
947
  response,
package/lib/mjs/Embed.js CHANGED
@@ -14,7 +14,7 @@ export class Formio {
14
14
  Formio._formioReady = ready;
15
15
  Formio._formioReadyReject = reject;
16
16
  });
17
- static version = '5.1.2-rc.1';
17
+ static version = '5.1.2-rc.3';
18
18
  static setLicense(license, norecurse = false) {
19
19
  Formio.license = license;
20
20
  if (!norecurse && Formio.FormioClass) {
package/lib/mjs/Formio.js CHANGED
@@ -4,7 +4,7 @@ import CDN from './CDN';
4
4
  import Providers from './providers';
5
5
  FormioCore.cdn = new CDN();
6
6
  FormioCore.Providers = Providers;
7
- FormioCore.version = '5.1.2-rc.1';
7
+ FormioCore.version = '5.1.2-rc.3';
8
8
  CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
9
9
  const isNil = (val) => val === null || val === undefined;
10
10
  FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -2845,7 +2845,8 @@ export default class Component extends Element {
2845
2845
  if ((this.options.readOnly && !this.options.pdf && !this.component.calculateValue) ||
2846
2846
  !(this.component.calculateValue || this.component.calculateValueVariable) ||
2847
2847
  (this.options.server && !this.component.calculateServer) ||
2848
- (flags.dataSourceInitialLoading && allowOverride)) {
2848
+ (flags.dataSourceInitialLoading && allowOverride) ||
2849
+ (this.options.readOnly && this.options.pdf && allowOverride && _.get(this.root, 'submission._id', false))) {
2849
2850
  return false;
2850
2851
  }
2851
2852
  const dataValue = this.dataValue;
@@ -145,7 +145,7 @@ export default class FileComponent extends Field {
145
145
  }[]>;
146
146
  updateProgress(fileInfo: any, progressEvent: any): void;
147
147
  getMultipartOptions(fileToSync: any): any;
148
- uploadFile(fileToSync: any): Promise<any>;
148
+ uploadFile(fileToSync: any): any;
149
149
  upload(): Promise<void | {
150
150
  fileToSync: never;
151
151
  fileInfo: any;
@@ -896,21 +896,25 @@ export default class FileComponent extends Field {
896
896
  },
897
897
  } : false;
898
898
  }
899
- async uploadFile(fileToSync) {
900
- return await this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
899
+ uploadFile(fileToSync) {
900
+ const filePromise = this.fileService.uploadFile(fileToSync.storage, fileToSync.file, fileToSync.name, fileToSync.dir,
901
901
  // Progress callback
902
- this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => { },
902
+ this.updateProgress.bind(this, fileToSync), fileToSync.url, fileToSync.options, fileToSync.fileKey, fileToSync.groupPermissions, fileToSync.groupResourceId, () => {
903
+ this.emit('fileUploadingStart', filePromise);
904
+ },
903
905
  // Abort upload callback
904
906
  (abort) => this.abortUploads.push({
905
907
  id: fileToSync.id,
906
908
  abort,
907
909
  }), this.getMultipartOptions(fileToSync));
910
+ return filePromise;
908
911
  }
909
912
  async upload() {
910
913
  if (!this.filesToSync.filesToUpload.length) {
911
914
  return Promise.resolve();
912
915
  }
913
916
  return await Promise.all(this.filesToSync.filesToUpload.map(async (fileToSync) => {
917
+ let filePromise = null;
914
918
  let fileInfo = null;
915
919
  try {
916
920
  if (fileToSync.isValidationError) {
@@ -919,11 +923,13 @@ export default class FileComponent extends Field {
919
923
  fileInfo,
920
924
  };
921
925
  }
922
- fileInfo = await this.uploadFile(fileToSync);
926
+ filePromise = this.uploadFile(fileToSync);
927
+ fileInfo = await filePromise;
923
928
  fileToSync.status = 'success';
924
929
  fileToSync.message = this.t('Succefully uploaded');
925
930
  fileInfo.originalName = fileToSync.originalName;
926
931
  fileInfo.hash = fileToSync.hash;
932
+ this.emit('fileUploadingEnd', filePromise);
927
933
  }
928
934
  catch (response) {
929
935
  fileToSync.status = 'error';
@@ -933,6 +939,7 @@ export default class FileComponent extends Field {
933
939
  : response.type === 'abort'
934
940
  ? this.t('Request was aborted')
935
941
  : response.toString();
942
+ this.emit('fileUploadingEnd', filePromise);
936
943
  this.emit('fileUploadError', {
937
944
  fileToSync,
938
945
  response,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.2-rc.1",
3
+ "version": "5.1.2-rc.3",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -79,7 +79,7 @@
79
79
  },
80
80
  "homepage": "https://github.com/formio/formio.js#readme",
81
81
  "dependencies": {
82
- "@formio/bootstrap": "3.1.1-rc.1",
82
+ "@formio/bootstrap": "3.1.1-rc.2",
83
83
  "@formio/choices.js": "^10.2.1",
84
84
  "@formio/core": "2.4.1-rc.3",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.4",