@formio/js 5.1.0-dev.6025.8026a2f → 5.1.0-dev.6026.13f1bfb

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.
@@ -455,7 +455,7 @@ declare class Webform extends NestedDataComponent {
455
455
  */
456
456
  submit(before?: boolean, options?: any): Promise<any>;
457
457
  submitUrl(URL: any, headers: any): void;
458
- triggerCaptcha(components?: null): void;
458
+ triggerCaptcha(): void;
459
459
  _nosubmit: any;
460
460
  get conditions(): any;
461
461
  get variables(): any;
@@ -1534,20 +1534,17 @@ class Webform extends NestedDataComponent_1.default {
1534
1534
  return console.warn(message);
1535
1535
  }
1536
1536
  }
1537
- triggerCaptcha(components = null) {
1537
+ triggerCaptcha() {
1538
1538
  if (!this || !this.components || this.options.preview) {
1539
1539
  return;
1540
1540
  }
1541
1541
  const captchaComponent = [];
1542
- (0, formUtils_1.eachComponent)(components || this.components, (component) => {
1542
+ (0, formUtils_1.eachComponent)(this.components, (component) => {
1543
1543
  if (/^(re)?captcha$/.test(component.type) && component.component.eventType === 'formLoad') {
1544
1544
  captchaComponent.push(component);
1545
1545
  }
1546
1546
  }, true);
1547
1547
  if (captchaComponent.length > 0) {
1548
- if (captchaComponent[0].component.provider === 'google' && components) {
1549
- return;
1550
- }
1551
1548
  if (this.parent) {
1552
1549
  this.parent.subFormReady.then(() => {
1553
1550
  captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
@@ -1556,6 +1553,7 @@ class Webform extends NestedDataComponent_1.default {
1556
1553
  else {
1557
1554
  captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
1558
1555
  }
1556
+ ;
1559
1557
  }
1560
1558
  }
1561
1559
  set nosubmit(value) {
package/lib/cjs/Wizard.js CHANGED
@@ -602,7 +602,6 @@ class Wizard extends Webform_1.default {
602
602
  }
603
603
  this.redraw().then(() => {
604
604
  this.checkData(this.submission.data);
605
- this.triggerCaptcha(this.currentPanel.componets);
606
605
  const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
607
606
  if (this.alert) {
608
607
  this.showErrors(errors, true, true);
@@ -261,10 +261,23 @@ class WizardBuilder extends WebformBuilder_1.default {
261
261
  if (component instanceof WizardBuilder) {
262
262
  return;
263
263
  }
264
+ if (!window.sessionStorage) {
265
+ return console.warn(this.t('sessionStorageSupportError'));
266
+ }
267
+ // If pasting after the Wizard's page, check if a full Wizard page was copied and pass it to addPage method
264
268
  if (this._form.components.find(comp => lodash_1.default.isEqual(component.component, comp))) {
265
- this.addPage(component);
269
+ const data = window.sessionStorage.getItem('formio.clipboard');
270
+ if (data) {
271
+ const schema = JSON.parse(data);
272
+ // If the copied component is not a Wizard's page, do nothing since we can't paste outside the panel in Wizard
273
+ if (schema.type !== 'panel') {
274
+ return;
275
+ }
276
+ this.addPage(schema);
277
+ }
266
278
  }
267
279
  else {
280
+ // If we are not trying to paster after the current Wizard's page, just pass it to the WebformBuilder
268
281
  return super.pasteComponent(component);
269
282
  }
270
283
  }
@@ -455,7 +455,7 @@ declare class Webform extends NestedDataComponent {
455
455
  */
456
456
  submit(before?: boolean, options?: any): Promise<any>;
457
457
  submitUrl(URL: any, headers: any): void;
458
- triggerCaptcha(components?: null): void;
458
+ triggerCaptcha(): void;
459
459
  _nosubmit: any;
460
460
  get conditions(): any;
461
461
  get variables(): any;
@@ -1534,20 +1534,17 @@ export default class Webform extends NestedDataComponent {
1534
1534
  return console.warn(message);
1535
1535
  }
1536
1536
  }
1537
- triggerCaptcha(components = null) {
1537
+ triggerCaptcha() {
1538
1538
  if (!this || !this.components || this.options.preview) {
1539
1539
  return;
1540
1540
  }
1541
1541
  const captchaComponent = [];
1542
- eachComponent(components || this.components, (component) => {
1542
+ eachComponent(this.components, (component) => {
1543
1543
  if (/^(re)?captcha$/.test(component.type) && component.component.eventType === 'formLoad') {
1544
1544
  captchaComponent.push(component);
1545
1545
  }
1546
1546
  }, true);
1547
1547
  if (captchaComponent.length > 0) {
1548
- if (captchaComponent[0].component.provider === 'google' && components) {
1549
- return;
1550
- }
1551
1548
  if (this.parent) {
1552
1549
  this.parent.subFormReady.then(() => {
1553
1550
  captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
@@ -1556,6 +1553,7 @@ export default class Webform extends NestedDataComponent {
1556
1553
  else {
1557
1554
  captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
1558
1555
  }
1556
+ ;
1559
1557
  }
1560
1558
  }
1561
1559
  set nosubmit(value) {
package/lib/mjs/Wizard.js CHANGED
@@ -594,7 +594,6 @@ export default class Wizard extends Webform {
594
594
  }
595
595
  this.redraw().then(() => {
596
596
  this.checkData(this.submission.data);
597
- this.triggerCaptcha(this.currentPanel.componets);
598
597
  const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
599
598
  if (this.alert) {
600
599
  this.showErrors(errors, true, true);
@@ -255,10 +255,23 @@ export default class WizardBuilder extends WebformBuilder {
255
255
  if (component instanceof WizardBuilder) {
256
256
  return;
257
257
  }
258
+ if (!window.sessionStorage) {
259
+ return console.warn(this.t('sessionStorageSupportError'));
260
+ }
261
+ // If pasting after the Wizard's page, check if a full Wizard page was copied and pass it to addPage method
258
262
  if (this._form.components.find(comp => _.isEqual(component.component, comp))) {
259
- this.addPage(component);
263
+ const data = window.sessionStorage.getItem('formio.clipboard');
264
+ if (data) {
265
+ const schema = JSON.parse(data);
266
+ // If the copied component is not a Wizard's page, do nothing since we can't paste outside the panel in Wizard
267
+ if (schema.type !== 'panel') {
268
+ return;
269
+ }
270
+ this.addPage(schema);
271
+ }
260
272
  }
261
273
  else {
274
+ // If we are not trying to paster after the current Wizard's page, just pass it to the WebformBuilder
262
275
  return super.pasteComponent(component);
263
276
  }
264
277
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6025.8026a2f",
3
+ "version": "5.1.0-dev.6026.13f1bfb",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {