formeo 5.0.3 → 5.1.0

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.
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 5.0.2
4
+ Version: 5.0.3
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7
 
@@ -6064,7 +6064,7 @@ Author: Draggable https://draggable.io
6064
6064
  var name$1, version$2, type, main, module$1, unpkg, exports$1, files, homepage, repository, author, contributors, bugs, description, keywords, ignore, config, scripts, devDependencies, dependencies, release, commitlint, package_default;
6065
6065
  var init_package = __esmMin((() => {
6066
6066
  name$1 = "formeo";
6067
- version$2 = "5.0.2";
6067
+ version$2 = "5.0.3";
6068
6068
  type = "module";
6069
6069
  main = "dist/formeo.cjs.js";
6070
6070
  module$1 = "dist/formeo.es.js";
@@ -12782,6 +12782,9 @@ Author: Draggable https://draggable.io
12782
12782
  isDOMElement(variable) {
12783
12783
  return variable instanceof window.Element || variable instanceof window.HTMLElement || !!(variable && typeof variable === "object" && variable.nodeType === 1 && typeof variable.nodeName === "string");
12784
12784
  }
12785
+ resolveContainer(container) {
12786
+ return typeof container === "string" ? document.querySelector(container) : container;
12787
+ }
12785
12788
  };
12786
12789
  dom = new DOM();
12787
12790
  }));
@@ -16251,7 +16254,7 @@ Author: Draggable https://draggable.io
16251
16254
  };
16252
16255
  applyOptions = async (controlOptions = {}) => {
16253
16256
  const { container, elements, groupOrder, ...options } = merge(defaultOptions, controlOptions);
16254
- this.container = container;
16257
+ this.container = dom.resolveContainer(container);
16255
16258
  this.groupOrder = unique(groupOrder.concat([
16256
16259
  "common",
16257
16260
  "html",
@@ -17796,7 +17799,7 @@ Author: Draggable https://draggable.io
17796
17799
  config: {},
17797
17800
  events: {},
17798
17801
  actions: {},
17799
- controls: {},
17802
+ controls: { container: null },
17800
17803
  i18n: { location: "https://draggable.github.io/formeo/assets/lang/" },
17801
17804
  onLoad: () => {}
17802
17805
  };
@@ -17837,7 +17840,7 @@ Author: Draggable https://draggable.io
17837
17840
  */
17838
17841
  constructor({ formData, ...options }, userFormData) {
17839
17842
  const { actions: actions$1, events: events$1, debug, config, editorContainer, ...opts } = merge(defaults.editor, options);
17840
- if (editorContainer) this.editorContainer = typeof editorContainer === "string" ? document.querySelector(editorContainer) : editorContainer;
17843
+ if (editorContainer) this.editorContainer = dom.resolveContainer(editorContainer) || null;
17841
17844
  this.opts = opts;
17842
17845
  dom.setOptions = opts;
17843
17846
  components.config = config;
@@ -18034,7 +18037,11 @@ Author: Draggable https://draggable.io
18034
18037
  dom.dir = s.current.dir;
18035
18038
  }
18036
18039
  this.editor = dom.create(elemConfig);
18037
- (this.controls.container || this.editor).appendChild(this.controls.dom);
18040
+ const controlsContainer = this.controls.container || this.editor;
18041
+ if (controlsContainer) {
18042
+ if (controlsContainer !== this.editor) dom.empty(controlsContainer);
18043
+ controlsContainer.appendChild(this.controls.dom);
18044
+ }
18038
18045
  if (this.editorContainer) {
18039
18046
  dom.empty(this.editorContainer);
18040
18047
  this.editorContainer.appendChild(this.editor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "formeo",
3
- "version": "5.0.3",
3
+ "version": "5.1.0",
4
4
  "type": "module",
5
5
  "main": "dist/formeo.cjs.js",
6
6
  "module": "dist/formeo.es.js",