@formio/js 5.0.0-dev.5633.3b83d8c → 5.0.0-dev.5634.e1468ca

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.
@@ -356,12 +356,6 @@ declare class Webform extends NestedDataComponent {
356
356
  * @returns {Object}
357
357
  */
358
358
  get submission(): Object;
359
- /**
360
- * @param submission
361
- * @param flags
362
- * @return {void}
363
- */
364
- onSetSubmission(submission: any, flags?: {}): void;
365
359
  /**
366
360
  * Sets a submission and returns the promise when it is ready.
367
361
  * @param submission
@@ -716,17 +716,6 @@ class Webform extends NestedDataComponent_1.default {
716
716
  set submission(submission) {
717
717
  this.setSubmission(submission);
718
718
  }
719
- /**
720
- * @param submission
721
- * @param flags
722
- * @return {void}
723
- */
724
- onSetSubmission(submission, flags = {}) {
725
- this.submissionSet = true;
726
- this.triggerChange(flags);
727
- this.emit('beforeSetSubmission', submission);
728
- this.setValue(submission, flags);
729
- }
730
719
  /**
731
720
  * Sets a submission and returns the promise when it is ready.
732
721
  * @param submission
@@ -739,7 +728,10 @@ class Webform extends NestedDataComponent_1.default {
739
728
  if (resolveFlags) {
740
729
  flags = Object.assign(Object.assign({}, flags), resolveFlags);
741
730
  }
742
- this.onSetSubmission(submission, flags);
731
+ this.submissionSet = true;
732
+ this.triggerChange(flags);
733
+ this.emit('beforeSetSubmission', submission);
734
+ this.setValue(submission, flags);
743
735
  return this.submissionReadyResolve(submission);
744
736
  }, (err) => this.submissionReadyReject(err)).catch((err) => this.submissionReadyReject(err));
745
737
  }
@@ -987,7 +987,12 @@ class WebformBuilder extends Component_1.default {
987
987
  parent.formioComponent.removeChildComponent(component);
988
988
  }
989
989
  if (component.input && componentInstance && componentInstance.parent) {
990
- lodash_1.default.unset(componentInstance._data, componentInstance.key);
990
+ if (Array.isArray(parent.formioComponent.component.defaultValue)) {
991
+ parent.formioComponent.component.defaultValue.forEach(v => lodash_1.default.unset(v, componentInstance.key));
992
+ }
993
+ else if (typeof parent.formioComponent.component.defaultValue === 'object') {
994
+ lodash_1.default.unset(parent.formioComponent.component.defaultValue, componentInstance.key);
995
+ }
991
996
  }
992
997
  const rebuild = parent.formioComponent.rebuild() || Promise.resolve();
993
998
  rebuild.then(() => {
@@ -327,12 +327,10 @@ declare class Component extends Element {
327
327
  */
328
328
  loadRefs(element: HTMLElement, refs: object, referenceAttributeName?: string | undefined): void;
329
329
  setOpenModalElement(template: any): void;
330
- renderModalPreview(ctx: any): any;
331
330
  getModalPreviewTemplate(): any;
332
331
  build(element: any): Promise<void>;
333
332
  get hasModalSaveButton(): boolean;
334
333
  render(children?: string, topLevel?: boolean): any;
335
- createTooltip(tooltipEl: any, settings?: {}): import("tippy.js").Instance<import("tippy.js").Props>[];
336
334
  attachTooltips(toolTipsRefs: any): void;
337
335
  createComponentModal(element: any, modalShouldBeOpened: any, currentValue: any): ComponentModal;
338
336
  attach(element: any): Promise<void>;
@@ -1029,9 +1029,6 @@ class Component extends Element_1.default {
1029
1029
  setOpenModalElement(template) {
1030
1030
  this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
1031
1031
  }
1032
- renderModalPreview(ctx) {
1033
- return this.renderTemplate('modalPreview', ctx || {});
1034
- }
1035
1032
  getModalPreviewTemplate() {
1036
1033
  var _a;
1037
1034
  const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
@@ -1039,7 +1036,7 @@ class Component extends Element_1.default {
1039
1036
  if (this.hasInput && ((_a = this.component.validate) === null || _a === void 0 ? void 0 : _a.required) && !this.isPDFReadOnlyMode) {
1040
1037
  modalLabel = { className: 'field-required' };
1041
1038
  }
1042
- return this.renderModalPreview({
1039
+ return this.renderTemplate('modalPreview', {
1043
1040
  previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
1044
1041
  messages: '',
1045
1042
  labelInfo: modalLabel,
@@ -1077,17 +1074,21 @@ class Component extends Element_1.default {
1077
1074
  }, topLevel);
1078
1075
  }
1079
1076
  }
1080
- createTooltip(tooltipEl, settings = {}) {
1081
- const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
1082
- const tooltipDataTitle = tooltipEl.getAttribute('data-title');
1083
- const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
1084
- .replace(/(?:\r\n|\r|\n)/g, '<br />');
1085
- return (0, tippy_js_1.default)(tooltipEl, Object.assign(Object.assign({ allowHTML: true, trigger: 'mouseenter click focus', placement: 'right', zIndex: 10000, interactive: true }, settings), { content: this.t(this.sanitize(tooltipText), { _userInput: true }) }));
1086
- }
1087
1077
  attachTooltips(toolTipsRefs) {
1088
1078
  toolTipsRefs === null || toolTipsRefs === void 0 ? void 0 : toolTipsRefs.forEach((tooltip, index) => {
1089
1079
  if (tooltip) {
1090
- this.tooltips[index] = this.createTooltip(tooltip);
1080
+ const tooltipAttribute = tooltip.getAttribute('data-tooltip');
1081
+ const tooltipDataTitle = tooltip.getAttribute('data-title');
1082
+ const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
1083
+ .replace(/(?:\r\n|\r|\n)/g, '<br />');
1084
+ this.tooltips[index] = (0, tippy_js_1.default)(tooltip, {
1085
+ allowHTML: true,
1086
+ trigger: 'mouseenter click focus',
1087
+ placement: 'right',
1088
+ zIndex: 10000,
1089
+ interactive: true,
1090
+ content: this.t(this.sanitize(tooltipText), { _userInput: true }),
1091
+ });
1091
1092
  }
1092
1093
  });
1093
1094
  }
@@ -79,7 +79,6 @@ export default class FormComponent extends Component {
79
79
  isHidden(): boolean;
80
80
  setValue(submission: any, flags?: {}): boolean;
81
81
  setSubFormValue(submission: any, flags: any): void;
82
- onSetSubFormValue(submission: any, flags: any): void;
83
82
  areAllComponentsEmpty(data: any): boolean;
84
83
  updateSubFormVisibility(): void;
85
84
  /**
@@ -645,12 +645,9 @@ class FormComponent extends Component_1.default {
645
645
  });
646
646
  }
647
647
  else {
648
- this.onSetSubFormValue(submission, flags);
648
+ this.subForm.setValue(submission, flags);
649
649
  }
650
650
  }
651
- onSetSubFormValue(submission, flags) {
652
- this.subForm.setValue(submission, flags);
653
- }
654
651
  isEmpty(value = this.dataValue) {
655
652
  return value === null || lodash_1.default.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value === null || value === void 0 ? void 0 : value.data) && !(value === null || value === void 0 ? void 0 : value._id));
656
653
  }
@@ -172,7 +172,7 @@ class SignatureComponent extends Input_1.default {
172
172
  return false;
173
173
  }
174
174
  getModalPreviewTemplate() {
175
- return this.renderModalPreview({
175
+ return this.renderTemplate('modalPreview', {
176
176
  previewText: this.dataValue ?
177
177
  `<img src=${this.dataValue} ${this._referenceAttributeName}='openModal' style="width: 100%;height: 100%;" />` :
178
178
  this.t('Click to Sign')
@@ -356,12 +356,6 @@ declare class Webform extends NestedDataComponent {
356
356
  * @returns {Object}
357
357
  */
358
358
  get submission(): Object;
359
- /**
360
- * @param submission
361
- * @param flags
362
- * @return {void}
363
- */
364
- onSetSubmission(submission: any, flags?: {}): void;
365
359
  /**
366
360
  * Sets a submission and returns the promise when it is ready.
367
361
  * @param submission
@@ -714,17 +714,6 @@ export default class Webform extends NestedDataComponent {
714
714
  set submission(submission) {
715
715
  this.setSubmission(submission);
716
716
  }
717
- /**
718
- * @param submission
719
- * @param flags
720
- * @return {void}
721
- */
722
- onSetSubmission(submission, flags = {}) {
723
- this.submissionSet = true;
724
- this.triggerChange(flags);
725
- this.emit('beforeSetSubmission', submission);
726
- this.setValue(submission, flags);
727
- }
728
717
  /**
729
718
  * Sets a submission and returns the promise when it is ready.
730
719
  * @param submission
@@ -743,7 +732,10 @@ export default class Webform extends NestedDataComponent {
743
732
  ...resolveFlags
744
733
  };
745
734
  }
746
- this.onSetSubmission(submission, flags);
735
+ this.submissionSet = true;
736
+ this.triggerChange(flags);
737
+ this.emit('beforeSetSubmission', submission);
738
+ this.setValue(submission, flags);
747
739
  return this.submissionReadyResolve(submission);
748
740
  }, (err) => this.submissionReadyReject(err)).catch((err) => this.submissionReadyReject(err));
749
741
  }
@@ -971,7 +971,12 @@ export default class WebformBuilder extends Component {
971
971
  parent.formioComponent.removeChildComponent(component);
972
972
  }
973
973
  if (component.input && componentInstance && componentInstance.parent) {
974
- _.unset(componentInstance._data, componentInstance.key);
974
+ if (Array.isArray(parent.formioComponent.component.defaultValue)) {
975
+ parent.formioComponent.component.defaultValue.forEach(v => _.unset(v, componentInstance.key));
976
+ }
977
+ else if (typeof parent.formioComponent.component.defaultValue === 'object') {
978
+ _.unset(parent.formioComponent.component.defaultValue, componentInstance.key);
979
+ }
975
980
  }
976
981
  const rebuild = parent.formioComponent.rebuild() || Promise.resolve();
977
982
  rebuild.then(() => {
@@ -327,12 +327,10 @@ declare class Component extends Element {
327
327
  */
328
328
  loadRefs(element: HTMLElement, refs: object, referenceAttributeName?: string | undefined): void;
329
329
  setOpenModalElement(template: any): void;
330
- renderModalPreview(ctx: any): any;
331
330
  getModalPreviewTemplate(): any;
332
331
  build(element: any): Promise<void>;
333
332
  get hasModalSaveButton(): boolean;
334
333
  render(children?: string, topLevel?: boolean): any;
335
- createTooltip(tooltipEl: any, settings?: {}): import("tippy.js").Instance<import("tippy.js").Props>[];
336
334
  attachTooltips(toolTipsRefs: any): void;
337
335
  createComponentModal(element: any, modalShouldBeOpened: any, currentValue: any): ComponentModal;
338
336
  attach(element: any): Promise<void>;
@@ -996,16 +996,13 @@ export default class Component extends Element {
996
996
  setOpenModalElement(template) {
997
997
  this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
998
998
  }
999
- renderModalPreview(ctx) {
1000
- return this.renderTemplate('modalPreview', ctx || {});
1001
- }
1002
999
  getModalPreviewTemplate() {
1003
1000
  const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
1004
1001
  let modalLabel;
1005
1002
  if (this.hasInput && this.component.validate?.required && !this.isPDFReadOnlyMode) {
1006
1003
  modalLabel = { className: 'field-required' };
1007
1004
  }
1008
- return this.renderModalPreview({
1005
+ return this.renderTemplate('modalPreview', {
1009
1006
  previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
1010
1007
  messages: '',
1011
1008
  labelInfo: modalLabel,
@@ -1043,25 +1040,21 @@ export default class Component extends Element {
1043
1040
  }, topLevel);
1044
1041
  }
1045
1042
  }
1046
- createTooltip(tooltipEl, settings = {}) {
1047
- const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
1048
- const tooltipDataTitle = tooltipEl.getAttribute('data-title');
1049
- const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
1050
- .replace(/(?:\r\n|\r|\n)/g, '<br />');
1051
- return tippy(tooltipEl, {
1052
- allowHTML: true,
1053
- trigger: 'mouseenter click focus',
1054
- placement: 'right',
1055
- zIndex: 10000,
1056
- interactive: true,
1057
- ...settings,
1058
- content: this.t(this.sanitize(tooltipText), { _userInput: true }),
1059
- });
1060
- }
1061
1043
  attachTooltips(toolTipsRefs) {
1062
1044
  toolTipsRefs?.forEach((tooltip, index) => {
1063
1045
  if (tooltip) {
1064
- this.tooltips[index] = this.createTooltip(tooltip);
1046
+ const tooltipAttribute = tooltip.getAttribute('data-tooltip');
1047
+ const tooltipDataTitle = tooltip.getAttribute('data-title');
1048
+ const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
1049
+ .replace(/(?:\r\n|\r|\n)/g, '<br />');
1050
+ this.tooltips[index] = tippy(tooltip, {
1051
+ allowHTML: true,
1052
+ trigger: 'mouseenter click focus',
1053
+ placement: 'right',
1054
+ zIndex: 10000,
1055
+ interactive: true,
1056
+ content: this.t(this.sanitize(tooltipText), { _userInput: true }),
1057
+ });
1065
1058
  }
1066
1059
  });
1067
1060
  }
@@ -79,7 +79,6 @@ export default class FormComponent extends Component {
79
79
  isHidden(): boolean;
80
80
  setValue(submission: any, flags?: {}): boolean;
81
81
  setSubFormValue(submission: any, flags: any): void;
82
- onSetSubFormValue(submission: any, flags: any): void;
83
82
  areAllComponentsEmpty(data: any): boolean;
84
83
  updateSubFormVisibility(): void;
85
84
  /**
@@ -635,12 +635,9 @@ export default class FormComponent extends Component {
635
635
  });
636
636
  }
637
637
  else {
638
- this.onSetSubFormValue(submission, flags);
638
+ this.subForm.setValue(submission, flags);
639
639
  }
640
640
  }
641
- onSetSubFormValue(submission, flags) {
642
- this.subForm.setValue(submission, flags);
643
- }
644
641
  isEmpty(value = this.dataValue) {
645
642
  return value === null || _.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value?.data) && !value?._id);
646
643
  }
@@ -169,7 +169,7 @@ export default class SignatureComponent extends Input {
169
169
  return false;
170
170
  }
171
171
  getModalPreviewTemplate() {
172
- return this.renderModalPreview({
172
+ return this.renderTemplate('modalPreview', {
173
173
  previewText: this.dataValue ?
174
174
  `<img src=${this.dataValue} ${this._referenceAttributeName}='openModal' style="width: 100%;height: 100%;" />` :
175
175
  this.t('Click to Sign')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5633.3b83d8c",
3
+ "version": "5.0.0-dev.5634.e1468ca",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {