formeo 3.0.6 → 3.0.8

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.
package/dist/formeo.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 3.0.5
4
+ Version: 3.0.7
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7
 
@@ -434,7 +434,7 @@ if (window !== void 0) {
434
434
  window.SmartTooltip = SmartTooltip;
435
435
  }
436
436
  const name$1 = "formeo";
437
- const version$2 = "3.0.5";
437
+ const version$2 = "3.0.7";
438
438
  const type = "module";
439
439
  const main = "dist/formeo.cjs.js";
440
440
  const module = "dist/formeo.es.js";
@@ -767,6 +767,13 @@ const CONDITION_TEMPLATE = () => ({
767
767
  const UUID_REGEXP = /(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)/gi;
768
768
  const bsColRegExp = /\bcol-\w+-\d+/g;
769
769
  const iconPrefix = "f-i-";
770
+ const DEFAULT_FORMDATA = () => ({
771
+ id: uuid(),
772
+ stages: { [uuid()]: {} },
773
+ rows: {},
774
+ columns: {},
775
+ fields: {}
776
+ });
770
777
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
771
778
  function getDefaultExportFromCjs(x) {
772
779
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -1821,6 +1828,7 @@ function parseData(data = /* @__PURE__ */ Object.create(null)) {
1821
1828
  }
1822
1829
  return data;
1823
1830
  }
1831
+ const cleanFormData = (formData) => formData ? clone$1(parseData(formData)) : DEFAULT_FORMDATA();
1824
1832
  var baseGetTag$1 = _baseGetTag, isObjectLike$1 = isObjectLike_1;
1825
1833
  var symbolTag$1 = "[object Symbol]";
1826
1834
  function isSymbol$3(value) {
@@ -8831,21 +8839,14 @@ const Columns2 = columns;
8831
8839
  const Fields2 = fields;
8832
8840
  const Controls2 = Controls$2;
8833
8841
  const Externals2 = externals;
8834
- const defaultFormData = () => ({
8835
- id: uuid(),
8836
- stages: { [uuid()]: {} },
8837
- rows: {},
8838
- columns: {},
8839
- fields: {}
8840
- });
8841
8842
  const getFormData = (formData, useSessionStorage = false) => {
8842
8843
  if (formData) {
8843
8844
  return clone$1(parseData(formData));
8844
8845
  }
8845
8846
  if (useSessionStorage) {
8846
- return sessionStorage.get(SESSION_FORMDATA_KEY) || defaultFormData();
8847
+ return sessionStorage.get(SESSION_FORMDATA_KEY) || DEFAULT_FORMDATA();
8847
8848
  }
8848
- return defaultFormData();
8849
+ return DEFAULT_FORMDATA();
8849
8850
  };
8850
8851
  class Components extends Data {
8851
8852
  constructor() {
@@ -9712,13 +9713,17 @@ let FormeoEditor$1 = class FormeoEditor {
9712
9713
  this.opts = opts;
9713
9714
  dom.setOptions = opts;
9714
9715
  components.config = config2;
9715
- this.userFormData = userFormData || formData;
9716
+ this.userFormData = cleanFormData(userFormData || formData);
9716
9717
  this.Components = components;
9717
9718
  this.dom = dom;
9718
9719
  events.init({ debug, ...events$1 });
9719
9720
  actions.init({ debug, sessionStorage: opts.sessionStorage, ...actions$1 });
9720
9721
  this.tooltip = new SmartTooltip();
9721
- document.addEventListener("DOMContentLoaded", this.loadResources.bind(this));
9722
+ if (document.readyState === "loading") {
9723
+ document.addEventListener("DOMContentLoaded", this.loadResources.bind(this));
9724
+ } else {
9725
+ this.loadResources();
9726
+ }
9722
9727
  }
9723
9728
  get formData() {
9724
9729
  return this.Components.formData;
@@ -9818,7 +9823,6 @@ let FormeoEditor$1 = class FormeoEditor {
9818
9823
  }
9819
9824
  };
9820
9825
  const RENDER_PREFIX = "f-";
9821
- const cleanFormData = (formData) => formData ? clone$1(parseData(formData)) : {};
9822
9826
  const containerLookup = (container) => typeof container === "string" ? document.querySelector(container) : container;
9823
9827
  const processOptions = ({ editorContainer, renderContainer, formData, ...opts }) => {
9824
9828
  const processedOptions = {
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 3.0.5
4
+ Version: 3.0.7
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7