@formio/js 5.0.0-rc.17 → 5.0.0-rc.19

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.
@@ -17,7 +17,7 @@
17
17
  MIT License: http://getify.mit-license.org
18
18
  */
19
19
 
20
- /*! formiojs v5.0.0-rc.17 | https://unpkg.com/formiojs@5.0.0-rc.17/LICENSE.txt */
20
+ /*! formiojs v5.0.0-rc.19 | https://unpkg.com/formiojs@5.0.0-rc.19/LICENSE.txt */
21
21
 
22
22
  /**
23
23
  * @license
@@ -230,7 +230,7 @@ class PDFBuilder extends WebformBuilder_1.default {
230
230
  }
231
231
  lodash_1.default.set(this.webform.form, 'settings.pdf', {
232
232
  id: result.data.file,
233
- src: `${result.data.filesServer}${result.data.path}`,
233
+ src: result.data.filesServer ? `${result.data.filesServer}${result.data.path}` : `${new URL(this.projectUrl).origin}/pdf-proxy${result.data.path}`,
234
234
  nonFillableConversionUsed: autoConversionComponentsAssigned && result.data.formfields.nonFillableConversionUsed
235
235
  });
236
236
  this.emit('pdfUploaded', result.data);
package/lib/cjs/Wizard.js CHANGED
@@ -503,8 +503,8 @@ class Wizard extends Webform_1.default {
503
503
  item.key = item.title;
504
504
  }
505
505
  let page = currentPages[item.key];
506
- const forceShow = this.options.show ? this.options.show[item.key] : false;
507
- const forceHide = this.options.hide ? this.options.hide[item.key] : false;
506
+ const forceShow = this.shouldForceShow(item);
507
+ const forceHide = this.shouldForceHide(item);
508
508
  let isVisible = !page
509
509
  ? (0, utils_1.checkCondition)(item, data, data, this.component, this) && !item.hidden
510
510
  : page.visible;
@@ -184,6 +184,9 @@ declare class Component extends Element {
184
184
  get parentVisible(): any;
185
185
  set parentDisabled(arg: boolean);
186
186
  get parentDisabled(): boolean;
187
+ shouldForceVisibility(component: any, visibility: any): any;
188
+ shouldForceHide(component: any): any;
189
+ shouldForceShow(component: any): any;
187
190
  /**
188
191
  *
189
192
  * @param value {boolean}
@@ -552,12 +552,38 @@ class Component extends Element_1.default {
552
552
  get parentDisabled() {
553
553
  return this._parentDisabled;
554
554
  }
555
+ shouldForceVisibility(component, visibility) {
556
+ if (!this.options[visibility]) {
557
+ return false;
558
+ }
559
+ if (!component) {
560
+ component = this.component;
561
+ }
562
+ if (lodash_1.default.isArray(this.options[visibility])) {
563
+ return this.options[visibility].includes(component.key);
564
+ }
565
+ return this.options[visibility][component.key];
566
+ }
567
+ shouldForceHide(component) {
568
+ return this.shouldForceVisibility(component, 'hide');
569
+ }
570
+ shouldForceShow(component) {
571
+ return this.shouldForceVisibility(component, 'show');
572
+ }
555
573
  /**
556
574
  *
557
575
  * @param value {boolean}
558
576
  */
559
577
  set visible(value) {
560
578
  if (this._visible !== value) {
579
+ // Skip if this component is set to visible and is supposed to be hidden.
580
+ if (value && this.shouldForceHide()) {
581
+ return;
582
+ }
583
+ // Skip if this component is set to hidden and is supposed to be shown.
584
+ if (!value && this.shouldForceShow()) {
585
+ return;
586
+ }
561
587
  this._visible = value;
562
588
  this.clearOnHide();
563
589
  this.redraw();
@@ -572,12 +598,10 @@ class Component extends Element_1.default {
572
598
  if (this.builderMode || this.previewMode || this.options.showHiddenFields) {
573
599
  return true;
574
600
  }
575
- if (this.options.hide &&
576
- this.options.hide[this.component.key]) {
601
+ if (this.shouldForceHide()) {
577
602
  return false;
578
603
  }
579
- if (this.options.show &&
580
- this.options.show[this.component.key]) {
604
+ if (this.shouldForceShow()) {
581
605
  return true;
582
606
  }
583
607
  return this._visible && this._parentVisible;
@@ -50,8 +50,8 @@ class NestedComponent extends Field_1.default {
50
50
  const visibilityChanged = this._visible !== value;
51
51
  this._visible = value;
52
52
  const isVisible = this.visible;
53
- const forceShow = this.options.show && this.options.show[this.component.key];
54
- const forceHide = this.options.hide && this.options.hide[this.component.key];
53
+ const forceShow = this.shouldForceShow();
54
+ const forceHide = this.shouldForceHide();
55
55
  this.components.forEach(component => {
56
56
  // Set the parent visibility first since we may have nested components within nested components
57
57
  // and they need to be able to determine their visibility based on the parent visibility.
@@ -29,7 +29,7 @@ class SignatureComponent extends Input_1.default {
29
29
  group: 'advanced',
30
30
  icon: 'pencil',
31
31
  weight: 120,
32
- documentation: '/userguide/form-building/form-components#signature',
32
+ documentation: '/developers/integrations/esign/esign-integrations#signature-component',
33
33
  schema: SignatureComponent.schema()
34
34
  };
35
35
  }
@@ -224,7 +224,7 @@ export default class PDFBuilder extends WebformBuilder {
224
224
  }
225
225
  _.set(this.webform.form, 'settings.pdf', {
226
226
  id: result.data.file,
227
- src: `${result.data.filesServer}${result.data.path}`,
227
+ src: result.data.filesServer ? `${result.data.filesServer}${result.data.path}` : `${new URL(this.projectUrl).origin}/pdf-proxy${result.data.path}`,
228
228
  nonFillableConversionUsed: autoConversionComponentsAssigned && result.data.formfields.nonFillableConversionUsed
229
229
  });
230
230
  this.emit('pdfUploaded', result.data);
package/lib/mjs/Wizard.js CHANGED
@@ -497,8 +497,8 @@ export default class Wizard extends Webform {
497
497
  item.key = item.title;
498
498
  }
499
499
  let page = currentPages[item.key];
500
- const forceShow = this.options.show ? this.options.show[item.key] : false;
501
- const forceHide = this.options.hide ? this.options.hide[item.key] : false;
500
+ const forceShow = this.shouldForceShow(item);
501
+ const forceHide = this.shouldForceHide(item);
502
502
  let isVisible = !page
503
503
  ? checkCondition(item, data, data, this.component, this) && !item.hidden
504
504
  : page.visible;
@@ -184,6 +184,9 @@ declare class Component extends Element {
184
184
  get parentVisible(): any;
185
185
  set parentDisabled(arg: boolean);
186
186
  get parentDisabled(): boolean;
187
+ shouldForceVisibility(component: any, visibility: any): any;
188
+ shouldForceHide(component: any): any;
189
+ shouldForceShow(component: any): any;
187
190
  /**
188
191
  *
189
192
  * @param value {boolean}
@@ -522,12 +522,38 @@ export default class Component extends Element {
522
522
  get parentDisabled() {
523
523
  return this._parentDisabled;
524
524
  }
525
+ shouldForceVisibility(component, visibility) {
526
+ if (!this.options[visibility]) {
527
+ return false;
528
+ }
529
+ if (!component) {
530
+ component = this.component;
531
+ }
532
+ if (_.isArray(this.options[visibility])) {
533
+ return this.options[visibility].includes(component.key);
534
+ }
535
+ return this.options[visibility][component.key];
536
+ }
537
+ shouldForceHide(component) {
538
+ return this.shouldForceVisibility(component, 'hide');
539
+ }
540
+ shouldForceShow(component) {
541
+ return this.shouldForceVisibility(component, 'show');
542
+ }
525
543
  /**
526
544
  *
527
545
  * @param value {boolean}
528
546
  */
529
547
  set visible(value) {
530
548
  if (this._visible !== value) {
549
+ // Skip if this component is set to visible and is supposed to be hidden.
550
+ if (value && this.shouldForceHide()) {
551
+ return;
552
+ }
553
+ // Skip if this component is set to hidden and is supposed to be shown.
554
+ if (!value && this.shouldForceShow()) {
555
+ return;
556
+ }
531
557
  this._visible = value;
532
558
  this.clearOnHide();
533
559
  this.redraw();
@@ -542,12 +568,10 @@ export default class Component extends Element {
542
568
  if (this.builderMode || this.previewMode || this.options.showHiddenFields) {
543
569
  return true;
544
570
  }
545
- if (this.options.hide &&
546
- this.options.hide[this.component.key]) {
571
+ if (this.shouldForceHide()) {
547
572
  return false;
548
573
  }
549
- if (this.options.show &&
550
- this.options.show[this.component.key]) {
574
+ if (this.shouldForceShow()) {
551
575
  return true;
552
576
  }
553
577
  return this._visible && this._parentVisible;
@@ -46,8 +46,8 @@ export default class NestedComponent extends Field {
46
46
  const visibilityChanged = this._visible !== value;
47
47
  this._visible = value;
48
48
  const isVisible = this.visible;
49
- const forceShow = this.options.show && this.options.show[this.component.key];
50
- const forceHide = this.options.hide && this.options.hide[this.component.key];
49
+ const forceShow = this.shouldForceShow();
50
+ const forceHide = this.shouldForceHide();
51
51
  this.components.forEach(component => {
52
52
  // Set the parent visibility first since we may have nested components within nested components
53
53
  // and they need to be able to determine their visibility based on the parent visibility.
@@ -24,7 +24,7 @@ export default class SignatureComponent extends Input {
24
24
  group: 'advanced',
25
25
  icon: 'pencil',
26
26
  weight: 120,
27
- documentation: '/userguide/form-building/form-components#signature',
27
+ documentation: '/developers/integrations/esign/esign-integrations#signature-component',
28
28
  schema: SignatureComponent.schema()
29
29
  };
30
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.17",
3
+ "version": "5.0.0-rc.19",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -78,12 +78,12 @@
78
78
  "@formio/core": "1.3.0-rc.15",
79
79
  "@formio/text-mask-addons": "^3.8.0-formio.2",
80
80
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
81
- "autocompleter": "^8.0.3",
81
+ "autocompleter": "^8.0.4",
82
82
  "bootstrap": "^5.3.0",
83
83
  "browser-cookies": "^1.2.0",
84
84
  "browser-md5-file": "^1.1.1",
85
- "compare-versions": "^6.0.0-rc.1",
86
- "core-js": "^3.30.2",
85
+ "compare-versions": "^6.0.0-rc.2",
86
+ "core-js": "^3.31.0",
87
87
  "dialog-polyfill": "^0.5.6",
88
88
  "dom-autoscroller": "^2.3.4",
89
89
  "dompurify": "^3.0.3",
@@ -93,7 +93,7 @@
93
93
  "fast-deep-equal": "^3.1.3",
94
94
  "fast-json-patch": "^3.1.1",
95
95
  "fetch-ponyfill": "^7.1.0",
96
- "i18next": "22.5.1",
96
+ "i18next": "23.2.3",
97
97
  "idb": "^7.1.1",
98
98
  "ismobilejs": "^1.1.1",
99
99
  "json-logic-js": "^2.0.2",
@@ -112,8 +112,8 @@
112
112
  "vanilla-picker": "^2.12.1"
113
113
  },
114
114
  "devDependencies": {
115
- "@typescript-eslint/eslint-plugin": "^5.59.8",
116
- "@typescript-eslint/parser": "^5.59.8",
115
+ "@typescript-eslint/eslint-plugin": "^5.60.1",
116
+ "@typescript-eslint/parser": "^5.60.1",
117
117
  "async-limiter": "^2.0.0",
118
118
  "bootstrap-icons": "^1.10.5",
119
119
  "bootswatch": "^5.3.0",
@@ -125,7 +125,7 @@
125
125
  "esdoc": "^1.1.0",
126
126
  "esdoc-ecmascript-proposal-plugin": "^1.0.0",
127
127
  "esdoc-standard-plugin": "^1.0.0",
128
- "eslint": "^8.42.0",
128
+ "eslint": "^8.43.0",
129
129
  "eslint-config-formio": "^1.1.4",
130
130
  "fetch-mock": "^9.11.0",
131
131
  "file-loader": "^6.2.0",
@@ -160,14 +160,14 @@
160
160
  "pretty": "^2.0.0",
161
161
  "pygments-css": "^1.0.0",
162
162
  "raw-loader": "^4.0.2",
163
- "sass": "^1.63.2",
163
+ "sass": "^1.63.6",
164
164
  "shortcut-buttons-flatpickr": "^0.4.0",
165
- "sinon": "^15.1.0",
165
+ "sinon": "^15.2.0",
166
166
  "string-replace-loader": "^3.1.0",
167
- "ts-loader": "^9.4.3",
167
+ "ts-loader": "^9.4.4",
168
168
  "ts-node": "^10.9.1",
169
169
  "typescript": "~5.0.4",
170
- "webpack": "^5.85.0",
170
+ "webpack": "^5.88.1",
171
171
  "webpack-bundle-analyzer": "^4.9.0",
172
172
  "webpack-cli": "^5.1.1",
173
173
  "webpack-node-externals": "^3.0.0",