formeo 2.3.0 → 2.3.1

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: 2.2.2
4
+ Version: 2.3.0
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7
 
@@ -310,6 +310,8 @@ class SmartTooltip {
310
310
  setupEventListeners() {
311
311
  document.addEventListener("mouseover", this.handleMouseOver);
312
312
  document.addEventListener("mouseout", this.handleMouseOut);
313
+ document.addEventListener("touchstart", this.handleMouseOver);
314
+ document.addEventListener("touchend", this.handleMouseOut);
313
315
  document.addEventListener("click", this.handleClick);
314
316
  window.addEventListener("resize", this.handleResize);
315
317
  window.addEventListener("scroll", this.handleScroll, true);
@@ -420,6 +422,8 @@ class SmartTooltip {
420
422
  destroy() {
421
423
  document.removeEventListener("mouseover", this.handleMouseOver);
422
424
  document.removeEventListener("mouseout", this.handleMouseOut);
425
+ document.removeEventListener("touchstart", this.handleMouseOver);
426
+ document.removeEventListener("touchend", this.handleMouseOut);
423
427
  document.removeEventListener("click", this.handleClick);
424
428
  window.removeEventListener("resize", this.handleResize);
425
429
  window.removeEventListener("scroll", this.handleScroll, true);
@@ -430,7 +434,7 @@ if (window !== void 0) {
430
434
  window.SmartTooltip = SmartTooltip;
431
435
  }
432
436
  const name$1 = "formeo";
433
- const version$2 = "2.2.2";
437
+ const version$2 = "2.3.0";
434
438
  const type = "module";
435
439
  const main = "dist/formeo.cjs.js";
436
440
  const module = "dist/formeo.es.js";
@@ -535,7 +539,7 @@ const devDependencies = {
535
539
  const dependencies = {
536
540
  "@draggable/formeo-languages": "^3.1.3",
537
541
  "@draggable/i18n": "^1.0.7",
538
- "@draggable/tooltip": "^1.2.1",
542
+ "@draggable/tooltip": "^1.2.2",
539
543
  lodash: "^4.17.21",
540
544
  sortablejs: "^1.15.3"
541
545
  };
@@ -1966,21 +1970,6 @@ var get_1 = get$1;
1966
1970
  const lodashGet = /* @__PURE__ */ getDefaultExportFromCjs(get_1);
1967
1971
  const get = lodashGet;
1968
1972
  const set = lodashSet;
1969
- const cleanObj = (obj) => {
1970
- const fresh = { ...obj };
1971
- const typeMap = {
1972
- string: () => "",
1973
- boolean: () => false,
1974
- object: (val) => cleanObj(val)
1975
- };
1976
- for (const key of Object.keys(obj)) {
1977
- const valType = typeof obj[key];
1978
- if (typeMap[valType]) {
1979
- fresh[key] = typeMap[valType](obj[key]);
1980
- }
1981
- }
1982
- return fresh;
1983
- };
1984
1973
  const isInt = (n) => Number.isInteger(Number(n));
1985
1974
  const indexOfNode = (node, parent) => {
1986
1975
  const parentElement = parent || node.parentElement;
@@ -5054,11 +5043,8 @@ class Panels {
5054
5043
  action: {
5055
5044
  click: (evt) => {
5056
5045
  const index2 = indexOfNode(evt.target, evt.target.parentElement);
5057
- this.currentPanel = this.panels[index2];
5058
- const labels2 = evt.target.parentElement.childNodes;
5059
- this.nav.refresh(index2);
5060
- dom.removeClasses(labels2, "active-tab");
5061
- evt.target.classList.add("active-tab");
5046
+ this.nav.setTranslateX(index2, false);
5047
+ this.nav.groupChange(index2);
5062
5048
  }
5063
5049
  },
5064
5050
  content: panel.config.label
@@ -5131,17 +5117,18 @@ class Panels {
5131
5117
  const action = {};
5132
5118
  const groupParent = this.currentPanel.parentElement;
5133
5119
  const labelWrap = this.labels.firstChild;
5120
+ const panelTabs = labelWrap.children;
5134
5121
  const siblingGroups = this.currentPanel.parentElement.childNodes;
5135
5122
  this.activePanelIndex = indexOfNode(this.currentPanel, groupParent);
5136
5123
  let offset = { nav: 0, panel: 0 };
5137
5124
  let lastOffset = { ...offset };
5138
5125
  action.groupChange = (newIndex2) => {
5139
- const labels = labelWrap.children;
5140
- dom.removeClasses(siblingGroups, "active-panel");
5141
- dom.removeClasses(labels, "active-tab");
5126
+ this.activePanelIndex = newIndex2;
5142
5127
  this.currentPanel = siblingGroups[newIndex2];
5128
+ dom.removeClasses(siblingGroups, "active-panel");
5129
+ dom.removeClasses(panelTabs, "active-tab");
5143
5130
  this.currentPanel.classList.add("active-panel");
5144
- labels[newIndex2].classList.add("active-tab");
5131
+ panelTabs[newIndex2].classList.add("active-tab");
5145
5132
  return this.currentPanel;
5146
5133
  };
5147
5134
  const getOffset = (index2) => {
@@ -5181,22 +5168,21 @@ class Panels {
5181
5168
  };
5182
5169
  action.refresh = (newIndex2 = this.activePanelIndex) => {
5183
5170
  if (this.activePanelIndex !== newIndex2) {
5184
- this.activePanelIndex = newIndex2;
5185
5171
  action.groupChange(newIndex2);
5186
5172
  }
5187
- action.setTranslateX(this.activePanelIndex);
5173
+ action.setTranslateX(this.activePanelIndex, false);
5188
5174
  this.resizePanels();
5189
5175
  };
5190
5176
  action.nextGroup = () => {
5191
5177
  const newIndex2 = this.activePanelIndex + 1;
5192
5178
  if (newIndex2 !== siblingGroups.length) {
5193
- const curPanel = action.groupChange(newIndex2);
5179
+ const nextPanel = siblingGroups[newIndex2];
5194
5180
  offset = {
5195
5181
  nav: -labelWrap.offsetWidth * newIndex2,
5196
- panel: -curPanel.offsetLeft
5182
+ panel: -nextPanel.offsetLeft
5197
5183
  };
5198
5184
  translateX({ offset });
5199
- this.activePanelIndex++;
5185
+ action.groupChange(newIndex2);
5200
5186
  } else {
5201
5187
  offset = {
5202
5188
  nav: lastOffset.nav - 8,
@@ -5209,13 +5195,13 @@ class Panels {
5209
5195
  action.prevGroup = () => {
5210
5196
  if (this.activePanelIndex !== 0) {
5211
5197
  const newIndex2 = this.activePanelIndex - 1;
5212
- const curPanel = action.groupChange(newIndex2);
5198
+ const prevPanel = siblingGroups[newIndex2];
5213
5199
  offset = {
5214
5200
  nav: -labelWrap.offsetWidth * newIndex2,
5215
- panel: -curPanel.offsetLeft
5201
+ panel: -prevPanel.offsetLeft
5216
5202
  };
5217
5203
  translateX({ offset });
5218
- this.activePanelIndex--;
5204
+ action.groupChange(newIndex2);
5219
5205
  } else {
5220
5206
  offset = {
5221
5207
  nav: 8,
@@ -6042,10 +6028,14 @@ class EditPanel {
6042
6028
  const metaId = this.field.data.meta.id;
6043
6029
  const fieldOptionData = this.field.get("options");
6044
6030
  const type2 = metaId === "select" ? "option" : metaId;
6045
- const newOptionLabel = mi18n.get(`newOptionLabel`, { type: type2 }) || "New Option";
6031
+ const newOptionLabel = mi18n.get("newOptionLabel", { type: type2 }) || "New Option";
6046
6032
  const itemKey = `options.${this.data.length}`;
6047
- const optionTemplate = fieldOptionData.length ? cleanObj(fieldOptionData[fieldOptionData.length - 1]) : {};
6048
- const itemData = { ...optionTemplate, label: newOptionLabel, value: slugify(newOptionLabel) };
6033
+ const lastOptionData = fieldOptionData[fieldOptionData.length - 1];
6034
+ const optionTemplate = fieldOptionData.length ? lastOptionData : {};
6035
+ const itemData = { ...optionTemplate, label: newOptionLabel };
6036
+ if (metaId !== "button") {
6037
+ itemData.value = slugify(newOptionLabel);
6038
+ }
6049
6039
  const newOption = new EditPanelItem({
6050
6040
  key: itemKey,
6051
6041
  data: itemData,
@@ -8581,7 +8571,9 @@ class Column extends Component {
8581
8571
  super("column", { ...DEFAULT_DATA$1(), ...columnData });
8582
8572
  // loops through children and refresh their edit panels
8583
8573
  __publicField(this, "refreshFieldPanels", () => {
8584
- this.children.forEach((field) => field.panels.nav.refresh());
8574
+ for (const field of this.children) {
8575
+ field.panels.nav.refresh();
8576
+ }
8585
8577
  });
8586
8578
  /**
8587
8579
  * Sets a columns width
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 2.2.2
4
+ Version: 2.3.0
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7