@formio/js 5.1.0-dev.6025.8026a2f → 5.1.0-dev.6026.929ea40

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);
@@ -46,5 +46,6 @@ export default class WizardBuilder extends WebformBuilder {
46
46
  components: any[];
47
47
  };
48
48
  pasteComponent(component: any): void;
49
+ copyComponent(component: any): void;
49
50
  }
50
51
  import WebformBuilder from './WebformBuilder';
@@ -261,12 +261,27 @@ class WizardBuilder extends WebformBuilder_1.default {
261
261
  if (component instanceof WizardBuilder) {
262
262
  return;
263
263
  }
264
- if (this._form.components.find(comp => lodash_1.default.isEqual(component.component, comp))) {
265
- this.addPage(component);
264
+ if (!window.sessionStorage) {
265
+ return console.warn(this.t('sessionStorageSupportError'));
266
+ }
267
+ const isWizardPageCopied = window.sessionStorage.getItem('formio.isWizardPageCopied') === 'true' ? true : false;
268
+ if (isWizardPageCopied) {
269
+ const data = window.sessionStorage.getItem('formio.clipboard');
270
+ if (data) {
271
+ const schema = JSON.parse(data);
272
+ this.addPage(schema);
273
+ }
266
274
  }
267
275
  else {
268
276
  return super.pasteComponent(component);
269
277
  }
270
278
  }
279
+ copyComponent(component) {
280
+ super.copyComponent(component);
281
+ if (window.sessionStorage) {
282
+ const isWizardPageCopied = this._form.components.indexOf(comp => lodash_1.default.isEqual(component.component, comp)) !== -1;
283
+ window.sessionStorage.setItem('formio.isWizardPageCopied', isWizardPageCopied.toString());
284
+ }
285
+ }
271
286
  }
272
287
  exports.default = WizardBuilder;
@@ -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);
@@ -46,5 +46,6 @@ export default class WizardBuilder extends WebformBuilder {
46
46
  components: any[];
47
47
  };
48
48
  pasteComponent(component: any): void;
49
+ copyComponent(component: any): void;
49
50
  }
50
51
  import WebformBuilder from './WebformBuilder';
@@ -255,11 +255,26 @@ export default class WizardBuilder extends WebformBuilder {
255
255
  if (component instanceof WizardBuilder) {
256
256
  return;
257
257
  }
258
- if (this._form.components.find(comp => _.isEqual(component.component, comp))) {
259
- this.addPage(component);
258
+ if (!window.sessionStorage) {
259
+ return console.warn(this.t('sessionStorageSupportError'));
260
+ }
261
+ const isWizardPageCopied = window.sessionStorage.getItem('formio.isWizardPageCopied') === 'true' ? true : false;
262
+ if (isWizardPageCopied) {
263
+ const data = window.sessionStorage.getItem('formio.clipboard');
264
+ if (data) {
265
+ const schema = JSON.parse(data);
266
+ this.addPage(schema);
267
+ }
260
268
  }
261
269
  else {
262
270
  return super.pasteComponent(component);
263
271
  }
264
272
  }
273
+ copyComponent(component) {
274
+ super.copyComponent(component);
275
+ if (window.sessionStorage) {
276
+ const isWizardPageCopied = this._form.components.indexOf(comp => _.isEqual(component.component, comp)) !== -1;
277
+ window.sessionStorage.setItem('formio.isWizardPageCopied', isWizardPageCopied.toString());
278
+ }
279
+ }
265
280
  }
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.929ea40",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {