formeo 5.1.1 → 5.1.3

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.
Files changed (78) hide show
  1. package/README.md +3 -3
  2. package/dist/demo/assets/css/demo.min.css +1 -1
  3. package/dist/demo/assets/css/demo.min.css.gz +0 -0
  4. package/dist/demo/assets/css/formeo.min.css +1 -1
  5. package/dist/demo/assets/js/demo.min.js +55 -55
  6. package/dist/demo/assets/js/demo.min.js.gz +0 -0
  7. package/dist/demo/assets/js/form.min.js +1 -1
  8. package/dist/demo/assets/js/formeo.cjs.js +92 -38
  9. package/dist/demo/assets/js/formeo.es.js +92 -38
  10. package/dist/demo/assets/js/formeo.min.cjs.js +2 -2
  11. package/dist/demo/assets/js/formeo.min.es.js +2 -2
  12. package/dist/demo/assets/js/formeo.min.js +92 -38
  13. package/dist/demo/assets/js/formeo.min.umd.js +2 -2
  14. package/dist/demo/assets/js/formeo.umd.js +92 -38
  15. package/dist/demo/assets/js/html.min.js +1 -1
  16. package/dist/demo/assets/js/layout.min.js +1 -1
  17. package/dist/demo/assets/js/mode-json.min.js +1 -1
  18. package/dist/demo/assets/js/mode-json.min.js.gz +0 -0
  19. package/dist/demo/assets/js/theme-github_light_default.min.js +1 -1
  20. package/dist/demo/index.html +1 -1
  21. package/dist/formeo.cjs.js +92 -38
  22. package/dist/formeo.css +1 -1
  23. package/dist/formeo.es.js +92 -38
  24. package/dist/formeo.min.cjs.js +2 -2
  25. package/dist/formeo.min.css +1 -1
  26. package/dist/formeo.min.es.js +2 -2
  27. package/dist/formeo.min.js +92 -38
  28. package/dist/formeo.min.umd.js +2 -2
  29. package/dist/formeo.umd.js +92 -38
  30. package/package.json +1 -1
  31. package/dist/demo/assets/lang/af-ZA.json +0 -1
  32. package/dist/demo/assets/lang/af-ZA.lang +0 -238
  33. package/dist/demo/assets/lang/ar-TN.json +0 -1
  34. package/dist/demo/assets/lang/ar-TN.lang +0 -238
  35. package/dist/demo/assets/lang/cs-CZ.json +0 -1
  36. package/dist/demo/assets/lang/cs-CZ.lang +0 -238
  37. package/dist/demo/assets/lang/de-DE.json +0 -1
  38. package/dist/demo/assets/lang/de-DE.lang +0 -238
  39. package/dist/demo/assets/lang/en-US.json +0 -1
  40. package/dist/demo/assets/lang/en-US.lang +0 -234
  41. package/dist/demo/assets/lang/es-ES.json +0 -1
  42. package/dist/demo/assets/lang/es-ES.lang +0 -238
  43. package/dist/demo/assets/lang/fa-IR.json +0 -1
  44. package/dist/demo/assets/lang/fa-IR.lang +0 -238
  45. package/dist/demo/assets/lang/fi-FI.json +0 -1
  46. package/dist/demo/assets/lang/fi-FI.lang +0 -238
  47. package/dist/demo/assets/lang/fr-FR.json +0 -1
  48. package/dist/demo/assets/lang/fr-FR.lang +0 -238
  49. package/dist/demo/assets/lang/he-IL.json +0 -1
  50. package/dist/demo/assets/lang/he-IL.lang +0 -238
  51. package/dist/demo/assets/lang/hi-IN.json +0 -1
  52. package/dist/demo/assets/lang/hi-IN.lang +0 -238
  53. package/dist/demo/assets/lang/hu-HU.json +0 -1
  54. package/dist/demo/assets/lang/hu-HU.lang +0 -238
  55. package/dist/demo/assets/lang/it-IT.json +0 -1
  56. package/dist/demo/assets/lang/it-IT.lang +0 -238
  57. package/dist/demo/assets/lang/ja-JP.json +0 -1
  58. package/dist/demo/assets/lang/ja-JP.lang +0 -238
  59. package/dist/demo/assets/lang/nb-NO.json +0 -1
  60. package/dist/demo/assets/lang/nb-NO.lang +0 -238
  61. package/dist/demo/assets/lang/pl-PL.json +0 -1
  62. package/dist/demo/assets/lang/pl-PL.lang +0 -238
  63. package/dist/demo/assets/lang/pt-BR.json +0 -1
  64. package/dist/demo/assets/lang/pt-BR.lang +0 -238
  65. package/dist/demo/assets/lang/pt-PT.json +0 -1
  66. package/dist/demo/assets/lang/pt-PT.lang +0 -238
  67. package/dist/demo/assets/lang/ro-RO.json +0 -1
  68. package/dist/demo/assets/lang/ro-RO.lang +0 -238
  69. package/dist/demo/assets/lang/ru-RU.json +0 -1
  70. package/dist/demo/assets/lang/ru-RU.lang +0 -238
  71. package/dist/demo/assets/lang/th-TH.json +0 -1
  72. package/dist/demo/assets/lang/th-TH.lang +0 -238
  73. package/dist/demo/assets/lang/tr-TR.json +0 -1
  74. package/dist/demo/assets/lang/tr-TR.lang +0 -238
  75. package/dist/demo/assets/lang/zh-CN.json +0 -1
  76. package/dist/demo/assets/lang/zh-CN.lang +0 -238
  77. package/dist/demo/assets/lang/zh-HK.json +0 -1
  78. package/dist/demo/assets/lang/zh-HK.lang +0 -238
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 5.1.0
4
+ Version: 5.1.2
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7
 
@@ -74,7 +74,7 @@ Author: Draggable https://draggable.io
74
74
  allowSelect: "Laat Kies toe",
75
75
  and: "en",
76
76
  attribute: "kenmerk",
77
- attributeNotPermitted: `Attribuut "{attribuut}" is nie toegelaat nie, kies asseblief 'n ander.`,
77
+ attributeNotPermitted: "Attribuut \"{attribuut}\" is nie toegelaat nie, kies asseblief 'n ander.",
78
78
  attributes: "eienskappe",
79
79
  "attrs.class": "klas",
80
80
  "attrs.className": "klas",
@@ -2127,7 +2127,7 @@ Author: Draggable https://draggable.io
2127
2127
  "row.makeInputGroup": "Définir cette ligne comme groupe de saisie.",
2128
2128
  "row.makeInputGroupDesc": "Les groupes de saisie permettent aux usagers de rajouter de multiples champs à la fois.",
2129
2129
  "row.settings.fieldsetWrap": "Entourer le champ d'un élément <fieldset>",
2130
- "row.settings.fieldsetWrap.aria": `Entourer le champ d'un "Fieldset"`,
2130
+ "row.settings.fieldsetWrap.aria": "Entourer le champ d'un \"Fieldset\"",
2131
2131
  save: "Sauvegarder",
2132
2132
  secondary: "Secondaire",
2133
2133
  select: "Sélection",
@@ -2902,7 +2902,7 @@ Author: Draggable https://draggable.io
2902
2902
  allowSelect: "Consenti selezione",
2903
2903
  and: "e",
2904
2904
  attribute: "Attributo",
2905
- attributeNotPermitted: `L'attributo "{attribute}" non è permesso, per favore sceglierne un altro.`,
2905
+ attributeNotPermitted: "L'attributo \"{attribute}\" non è permesso, per favore sceglierne un altro.",
2906
2906
  attributes: "attributi",
2907
2907
  "attrs.class": "Classe",
2908
2908
  "attrs.className": "Classe",
@@ -5711,10 +5711,10 @@ Author: Draggable https://draggable.io
5711
5711
  //#region node_modules/@draggable/formeo-languages/dist/formeo-languages.es.js
5712
5712
  /**
5713
5713
  @draggable/formeo-languages - https://github.com/Draggable/formeo-languages#readme
5714
- Version: 3.4.1
5714
+ Version: 3.5.0
5715
5715
  Author: Kevin Chappell <kevin.b.chappell@gmail.com> (https://kevin-chappell.com)
5716
5716
  */
5717
- var i = e$1["en-US"];
5717
+ var s$1 = e$1["en-US"];
5718
5718
  e$1["es-ES"];
5719
5719
  e$1["fa-IR"];
5720
5720
  e$1["fi-FI"];
@@ -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.1.0";
6067
+ version$2 = "5.1.2";
6068
6068
  type = "module";
6069
6069
  main = "dist/formeo.cjs.js";
6070
6070
  module$1 = "dist/formeo.es.js";
@@ -10070,7 +10070,7 @@ Author: Draggable https://draggable.io
10070
10070
  }, _typeof(o);
10071
10071
  }
10072
10072
  function userAgent(pattern) {
10073
- if (typeof window !== "undefined" && window.navigator) return !!/* @__PURE__ */ navigator.userAgent.match(pattern);
10073
+ if (typeof window !== "undefined" && window.navigator) return !!/*@__PURE__*/ navigator.userAgent.match(pattern);
10074
10074
  }
10075
10075
  function on(el, event, fn) {
10076
10076
  el.addEventListener(event, fn, !IE11OrLess && captureMode);
@@ -16671,7 +16671,9 @@ Author: Draggable https://draggable.io
16671
16671
  }
16672
16672
  const { controlData: { meta: { id: metaId }, ...elementData } } = Controls$1.get(item.id);
16673
16673
  set(elementData, "config.controlId", metaId);
16674
- const controlType = metaId.startsWith("layout-") ? metaId.replace(/^layout-/, "") : "field";
16674
+ const isLayoutControl = metaId.startsWith("layout-");
16675
+ const controlType = isLayoutControl ? metaId.replace(/^layout-/, "") : "field";
16676
+ const componentData = isLayoutControl ? {} : elementData;
16675
16677
  const depth = get({
16676
16678
  stage: {
16677
16679
  row: 0,
@@ -16692,7 +16694,7 @@ Author: Draggable https://draggable.io
16692
16694
  }, `${this.name}.${controlType}`);
16693
16695
  const action = depthMap.get(depth)();
16694
16696
  dom.remove(item);
16695
- return action(elementData, newIndex);
16697
+ return action(componentData, newIndex);
16696
16698
  },
16697
16699
  row: () => {
16698
16700
  return (depthMap.get({
@@ -17900,7 +17902,7 @@ Author: Draggable https://draggable.io
17900
17902
  fetchIcons(this.opts.svgSprite),
17901
17903
  fetchFormeoStyle(this.opts.style),
17902
17904
  s.init({
17903
- preloaded: { "en-US": i },
17905
+ preloaded: { "en-US": s$1 },
17904
17906
  ...this.opts.i18n,
17905
17907
  locale: globalThis.sessionStorage?.getItem(SESSION_LOCALE_KEY)
17906
17908
  })
@@ -18076,20 +18078,56 @@ Author: Draggable https://draggable.io
18076
18078
  };
18077
18079
  var isVisible = (elem) => {
18078
18080
  if (!elem) return false;
18079
- if (elem.hasAttribute("hidden") || elem.parentElement.hasAttribute("hidden")) return false;
18081
+ if (elem.hasAttribute("hidden") || elem.parentElement?.hasAttribute("hidden")) return false;
18080
18082
  const computedStyle = window.getComputedStyle(elem);
18081
18083
  return !(computedStyle.display === "none" || computedStyle.visibility === "hidden" || computedStyle.opacity === "0");
18082
18084
  };
18085
+ var CHECKABLE_INPUT_SELECTOR = "input[type=\"checkbox\"], input[type=\"radio\"]";
18086
+ var CHECKABLE_TYPES = new Set(["checkbox", "radio"]);
18087
+ var tagName$1 = (elem) => elem?.tagName?.toLowerCase();
18088
+ var isCheckableInput = (elem) => tagName$1(elem) === "input" && CHECKABLE_TYPES.has(elem.type);
18089
+ /**
18090
+ * Radio and checkbox fields render as a wrapper holding one input per option, so a
18091
+ * field address resolves to the wrapper rather than to anything carrying a value.
18092
+ * @param {Element} elem
18093
+ * @return {Array<Element>|null} option inputs, or null when elem is not a group
18094
+ */
18095
+ var checkableGroupInputs = (elem) => {
18096
+ if (!elem || isCheckableInput(elem) || typeof elem.querySelectorAll !== "function") return null;
18097
+ const inputs = elem.querySelectorAll(CHECKABLE_INPUT_SELECTOR);
18098
+ return inputs.length ? Array.from(inputs) : null;
18099
+ };
18100
+ var isCheckableGroup = (elem) => Boolean(checkableGroupInputs(elem));
18101
+ /**
18102
+ * Value a condition compares against. Controls that can hold several values at once
18103
+ * yield an array so that a single selection still matches an `equals` comparison.
18104
+ * @param {Element} elem
18105
+ * @return {String|Array<String>|undefined}
18106
+ */
18107
+ var elementValue = (elem) => {
18108
+ if (!elem) return;
18109
+ const groupInputs = checkableGroupInputs(elem);
18110
+ if (groupInputs) {
18111
+ const checkedValues = groupInputs.filter((input) => input.checked).map((input) => input.value);
18112
+ return groupInputs.every((input) => input.type === "radio") ? checkedValues[0] ?? "" : checkedValues;
18113
+ }
18114
+ if (tagName$1(elem) === "select" && elem.multiple) return Array.from(elem.selectedOptions, (option) => option.value);
18115
+ if (isCheckableInput(elem)) return elem.checked ? elem.value : "";
18116
+ return elem.value;
18117
+ };
18118
+ var isChecked = (elem) => {
18119
+ const groupInputs = checkableGroupInputs(elem);
18120
+ return groupInputs ? groupInputs.some((input) => input.checked) : Boolean(elem?.checked);
18121
+ };
18083
18122
  var propertyMap = {
18084
18123
  isChecked: (elem) => {
18085
- return elem.checked;
18124
+ return isChecked(elem);
18086
18125
  },
18087
18126
  isNotChecked: (elem) => {
18088
- return !elem.checked;
18089
- },
18090
- value: (elem) => {
18091
- return elem.value;
18127
+ return !isChecked(elem);
18092
18128
  },
18129
+ value: elementValue,
18130
+ checked: elementValue,
18093
18131
  isVisible: (elem) => {
18094
18132
  return isVisible(elem);
18095
18133
  },
@@ -18106,11 +18144,16 @@ Author: Draggable https://draggable.io
18106
18144
  click: ({ target }) => target.parentElement.remove()
18107
18145
  }
18108
18146
  });
18147
+ var equals = (source, target) => Array.isArray(source) ? source.some((value) => (0, import_isEqual.default)(value, target)) : (0, import_isEqual.default)(source, target);
18148
+ var contains = (source, target) => {
18149
+ if (source == null) return false;
18150
+ return Array.isArray(source) ? source.includes(target) : String(source).includes(target);
18151
+ };
18109
18152
  var comparisonHandlers = {
18110
- equals: import_isEqual.default,
18111
- notEquals: (source, target) => !(0, import_isEqual.default)(source, target),
18112
- contains: (source, target) => source.includes(target),
18113
- notContains: (source, target) => !source.includes(target)
18153
+ equals,
18154
+ notEquals: (source, target) => !equals(source, target),
18155
+ contains,
18156
+ notContains: (source, target) => !contains(source, target)
18114
18157
  };
18115
18158
  var comparisonMap = Object.entries(COMPARISON_OPERATORS).reduce((acc, [key, value]) => {
18116
18159
  acc[value] = comparisonHandlers[key];
@@ -18378,7 +18421,8 @@ Author: Draggable https://draggable.io
18378
18421
  * @return {Array} flattened array of conditions
18379
18422
  */
18380
18423
  handleComponentCondition = (component, ifRest, thenConditions) => {
18381
- if (component.length) {
18424
+ if (!component) return;
18425
+ if (isNodeCollection(component)) {
18382
18426
  for (const elem of component) this.handleComponentCondition(elem, ifRest, thenConditions);
18383
18427
  return;
18384
18428
  }
@@ -18390,23 +18434,25 @@ Author: Draggable https://draggable.io
18390
18434
  if (this.evaluateCondition(ifRest, fakeEvt)) for (const thenCondition of thenConditions) this.execResult(thenCondition, fakeEvt);
18391
18435
  };
18392
18436
  applyConditions = () => {
18393
- for (const { conditions } of Object.values(this.components)) if (conditions) for (const condition of conditions) {
18394
- const { if: ifConditions, then: thenConditions } = condition;
18395
- for (const ifCondition of ifConditions) {
18396
- const { source, target } = ifCondition;
18397
- if (isAddress(source)) {
18398
- const { component, options } = this.getComponent(source);
18399
- const sourceComponent = options || component;
18400
- this.handleComponentCondition(sourceComponent, ifCondition, thenConditions);
18401
- }
18402
- if (isAddress(target)) {
18403
- const { component, options } = this.getComponent(target);
18404
- const targetComponent = options || component;
18405
- this.handleComponentCondition(targetComponent, ifCondition, thenConditions);
18437
+ for (const { conditions } of Object.values(this.components)) {
18438
+ if (!conditions) continue;
18439
+ for (const condition of conditions) {
18440
+ const { if: ifConditions = [], then: thenConditions = [] } = condition;
18441
+ for (const ifCondition of ifConditions) try {
18442
+ this.applyCondition(ifCondition, thenConditions);
18443
+ } catch (err) {
18444
+ console.error("formeo: condition skipped", ifCondition, err);
18406
18445
  }
18407
18446
  }
18408
18447
  }
18409
18448
  };
18449
+ applyCondition = (ifCondition, thenConditions) => {
18450
+ for (const address of [ifCondition.source, ifCondition.target]) {
18451
+ if (!isAddress(address)) continue;
18452
+ const { component, options } = this.getComponent(address);
18453
+ this.handleComponentCondition(options || component, ifCondition, thenConditions);
18454
+ }
18455
+ };
18410
18456
  /**
18411
18457
  * Evaulate conditions
18412
18458
  */
@@ -18428,9 +18474,10 @@ Author: Draggable https://draggable.io
18428
18474
  }
18429
18475
  };
18430
18476
  getComponentProperty = (address, propertyName) => {
18431
- const { component, option } = this.getComponent(address);
18477
+ const { component, option } = this.getComponent(address) || {};
18432
18478
  const elem = option || component;
18433
- return propertyMap[propertyName]?.(elem) || elem[propertyName];
18479
+ if (!elem) return;
18480
+ return propertyMap[propertyName] ? propertyMap[propertyName](elem) : elem[propertyName];
18434
18481
  };
18435
18482
  getComponent = (address) => {
18436
18483
  const result = { component: null };
@@ -18455,7 +18502,14 @@ Author: Draggable https://draggable.io
18455
18502
  return components;
18456
18503
  };
18457
18504
  };
18458
- var listenTypeMap = [["input", (c) => ["textarea", "text"].includes(c.type)], ["change", (c) => ["select"].includes(c.tagName.toLowerCase()) || ["checkbox", "radio"].includes(c.type)]];
18505
+ var isDomNode = (value) => Boolean(value) && typeof value.nodeType === "number";
18506
+ var isNodeCollection = (value) => Boolean(value) && !isDomNode(value) && typeof value.length === "number";
18507
+ var tagName = (component) => component.tagName?.toLowerCase();
18508
+ var listenTypeMap = [
18509
+ ["change", (component) => isCheckableGroup(component)],
18510
+ ["change", (component) => tagName(component) === "select" || ["checkbox", "radio"].includes(component.type)],
18511
+ ["input", (component) => ["input", "textarea"].includes(tagName(component))]
18512
+ ];
18459
18513
  var LISTEN_TYPE_MAP = (component) => {
18460
18514
  const [listenerEvent] = listenTypeMap.find((typeMap) => typeMap[1](component)) || [false];
18461
18515
  return listenerEvent;
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 5.1.0
4
+ Version: 5.1.2
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 5.1.0
4
+ Version: 5.1.2
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 5.1.0
4
+ Version: 5.1.2
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 5.1.0
4
+ Version: 5.1.2
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7
 
@@ -1 +1 @@
1
- <!doctype html><html lang="en" xml:lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="chrome=1"><meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name="description" content="Vanilla Javascript form building module"><meta name="theme-color" content="#232323"><title>Formeo | Drag &amp; Drop Form Creation</title><script type="module" crossorigin src="/formeo/assets/js/demo.min.js"></script><link rel="stylesheet" crossorigin href="/formeo/assets/css/demo.min.css"></head><body><div class="site-wrap"><header id="demo-header"><div class="header-inner"><img id="formeo-logo" src="/formeo/assets/img/formeo-logo.svg" alt="Formeo Logo" width="100"><nav aria-label="Framework navigation"><ul><li><label for="framework-select">Framework:</label> <select name="framework-select" id="framework-select" class="form-control"><option value="vanilla">Vanilla JavaScript</option><option value="angular">Angular</option><option value="react">React</option></select></li><li><label for="locale">Language</label> <select name="locale" id="locale" class="form-control"><option value="af-ZA" dir="ltr">Afrikaans (Suid-Afrika)</option><option value="ar-TN" dir="rtl">العربية (تونس)</option><option value="cs-CZ" dir="ltr">čeština (Česko)</option><option value="de-DE" dir="ltr">Deutsch (Deutschland)</option><option value="en-US" dir="ltr">English</option><option value="es-ES" dir="ltr">español de España</option><option value="fa-IR" dir="rtl">فارسی (ایران)</option><option value="fi-FI" dir="ltr">suomi (Suomi)</option><option value="fr-FR" dir="ltr">français (France)</option><option value="he-IL" dir="rtl">עברית (ישראל)</option><option value="hi-IN" dir="ltr">हिन्दी (भारत)</option><option value="hu-HU" dir="ltr">magyar (Magyarország)</option><option value="it-IT" dir="ltr">italiano (Italia)</option><option value="ja-JP" dir="ltr">日本語 (日本)</option><option value="nb-NO" dir="ltr">norsk bokmål (Norge)</option><option value="pl-PL" dir="ltr">polski (Polska)</option><option value="pt-BR" dir="ltr">português (Brasil)</option><option value="pt-PT" dir="ltr">português europeu</option><option value="ro-RO" dir="ltr">română (România)</option><option value="ru-RU" dir="ltr">русский (Россия)</option><option value="th-TH" dir="ltr">ไทย (ไทย)</option><option value="tr-TR" dir="ltr">Türkçe (Türkiye)</option><option value="zh-CN" dir="ltr">中文(中国)</option><option value="zh-HK" dir="ltr">中文(中國香港特別行政區)</option></select></li><li><label for="control-filter">Control Filter:</label> <input id="control-filter" placeholder="ex. text" class="form-control"></li><li style="float:right">v5.1.0</li></ul></nav></div></header><section id="main_content" class="inner"><div id="framework-container"></div></section><div class="container render-btn-wrap" id="editor-action-buttons"></div><div id="formData-popover" popover><div class="popover-header"><h3>Test formData</h3><div><button type="button" id="format-json">Format</button> <button type="button" id="collapse-json">Collapse</button> <button type="button" id="copy-json">Copy to Clipboard</button></div></div><pre id="formData-editor"></pre><div class="formData-actions"><button popovertarget="formData-popover" popovertargetaction="hide" type="button">Cancel</button> <button id="submit-formData" type="button">Submit</button></div></div><footer id="demo-footer"><nav aria-label="Footer navigation"><ul><li><a href="https://github.com/Draggable/formeo" target="_blank" title="View project on GitHub"><img src="/formeo/assets/img/github.png" width="77" alt="GitHub"></a></li></ul></nav></footer></div></body></html>
1
+ <!doctype html><html lang="en" xml:lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="chrome=1"><meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name="description" content="Vanilla Javascript form building module"><meta name="theme-color" content="#232323"><title>Formeo | Drag &amp; Drop Form Creation</title><script type="module" crossorigin src="/formeo/assets/js/demo.min.js"></script><link rel="stylesheet" crossorigin href="/formeo/assets/css/demo.min.css"></head><body><div class="site-wrap"><header id="demo-header"><div class="header-inner"><img id="formeo-logo" src="/formeo/assets/img/formeo-logo.svg" alt="Formeo Logo" width="100"><nav aria-label="Framework navigation"><ul><li><label for="framework-select">Framework:</label> <select name="framework-select" id="framework-select" class="form-control"><option value="vanilla">Vanilla JavaScript</option><option value="angular">Angular</option><option value="react">React</option></select></li><li><label for="locale">Language</label> <select name="locale" id="locale" class="form-control"><option value="af-ZA" dir="ltr">Afrikaans (Suid-Afrika)</option><option value="ar-TN" dir="rtl">العربية (تونس)</option><option value="cs-CZ" dir="ltr">čeština (Česko)</option><option value="de-DE" dir="ltr">Deutsch (Deutschland)</option><option value="en-US" dir="ltr">English</option><option value="es-ES" dir="ltr">español de España</option><option value="fa-IR" dir="rtl">فارسی (ایران)</option><option value="fi-FI" dir="ltr">suomi (Suomi)</option><option value="fr-FR" dir="ltr">français (France)</option><option value="he-IL" dir="rtl">עברית (ישראל)</option><option value="hi-IN" dir="ltr">हिन्दी (भारत)</option><option value="hu-HU" dir="ltr">magyar (Magyarország)</option><option value="it-IT" dir="ltr">italiano (Italia)</option><option value="ja-JP" dir="ltr">日本語 (日本)</option><option value="nb-NO" dir="ltr">norsk bokmål (Norge)</option><option value="pl-PL" dir="ltr">polski (Polska)</option><option value="pt-BR" dir="ltr">português (Brasil)</option><option value="pt-PT" dir="ltr">português europeu</option><option value="ro-RO" dir="ltr">română (România)</option><option value="ru-RU" dir="ltr">русский (Россия)</option><option value="th-TH" dir="ltr">ไทย (ไทย)</option><option value="tr-TR" dir="ltr">Türkçe (Türkiye)</option><option value="zh-CN" dir="ltr">中文(中国)</option><option value="zh-HK" dir="ltr">中文(中國香港特別行政區)</option></select></li><li><label for="control-filter">Control Filter:</label> <input id="control-filter" placeholder="ex. text" class="form-control"></li><li style="float:right">v5.1.2</li></ul></nav></div></header><section id="main_content" class="inner"><div id="framework-container"></div></section><div class="container render-btn-wrap" id="editor-action-buttons"></div><div id="formData-popover" popover><div class="popover-header"><h3>Test formData</h3><div><button type="button" id="format-json">Format</button> <button type="button" id="collapse-json">Collapse</button> <button type="button" id="copy-json">Copy to Clipboard</button></div></div><pre id="formData-editor"></pre><div class="formData-actions"><button popovertarget="formData-popover" popovertargetaction="hide" type="button">Cancel</button> <button id="submit-formData" type="button">Submit</button></div></div><footer id="demo-footer"><nav aria-label="Footer navigation"><ul><li><a href="https://github.com/Draggable/formeo" target="_blank" title="View project on GitHub"><img src="/formeo/assets/img/github.png" width="77" alt="GitHub"></a></li></ul></nav></footer></div></body></html>
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 5.1.0
4
+ Version: 5.1.2
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7
 
@@ -71,7 +71,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
71
71
  allowSelect: "Laat Kies toe",
72
72
  and: "en",
73
73
  attribute: "kenmerk",
74
- attributeNotPermitted: `Attribuut "{attribuut}" is nie toegelaat nie, kies asseblief 'n ander.`,
74
+ attributeNotPermitted: "Attribuut \"{attribuut}\" is nie toegelaat nie, kies asseblief 'n ander.",
75
75
  attributes: "eienskappe",
76
76
  "attrs.class": "klas",
77
77
  "attrs.className": "klas",
@@ -2124,7 +2124,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
2124
2124
  "row.makeInputGroup": "Définir cette ligne comme groupe de saisie.",
2125
2125
  "row.makeInputGroupDesc": "Les groupes de saisie permettent aux usagers de rajouter de multiples champs à la fois.",
2126
2126
  "row.settings.fieldsetWrap": "Entourer le champ d'un élément &lt;fieldset&gt;",
2127
- "row.settings.fieldsetWrap.aria": `Entourer le champ d'un "Fieldset"`,
2127
+ "row.settings.fieldsetWrap.aria": "Entourer le champ d'un \"Fieldset\"",
2128
2128
  save: "Sauvegarder",
2129
2129
  secondary: "Secondaire",
2130
2130
  select: "Sélection",
@@ -2899,7 +2899,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
2899
2899
  allowSelect: "Consenti selezione",
2900
2900
  and: "e",
2901
2901
  attribute: "Attributo",
2902
- attributeNotPermitted: `L'attributo "{attribute}" non è permesso, per favore sceglierne un altro.`,
2902
+ attributeNotPermitted: "L'attributo \"{attribute}\" non è permesso, per favore sceglierne un altro.",
2903
2903
  attributes: "attributi",
2904
2904
  "attrs.class": "Classe",
2905
2905
  "attrs.className": "Classe",
@@ -5708,10 +5708,10 @@ e$1["de-DE"];
5708
5708
  //#region node_modules/@draggable/formeo-languages/dist/formeo-languages.es.js
5709
5709
  /**
5710
5710
  @draggable/formeo-languages - https://github.com/Draggable/formeo-languages#readme
5711
- Version: 3.4.1
5711
+ Version: 3.5.0
5712
5712
  Author: Kevin Chappell <kevin.b.chappell@gmail.com> (https://kevin-chappell.com)
5713
5713
  */
5714
- var i = e$1["en-US"];
5714
+ var s$1 = e$1["en-US"];
5715
5715
  e$1["es-ES"];
5716
5716
  e$1["fa-IR"];
5717
5717
  e$1["fi-FI"];
@@ -6061,7 +6061,7 @@ if (globalThis !== void 0) globalThis.SmartTooltip = SmartTooltip;
6061
6061
  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;
6062
6062
  var init_package = __esmMin((() => {
6063
6063
  name$1 = "formeo";
6064
- version$2 = "5.1.0";
6064
+ version$2 = "5.1.2";
6065
6065
  type = "module";
6066
6066
  main = "dist/formeo.cjs.js";
6067
6067
  module$1 = "dist/formeo.es.js";
@@ -10067,7 +10067,7 @@ function _typeof(o) {
10067
10067
  }, _typeof(o);
10068
10068
  }
10069
10069
  function userAgent(pattern) {
10070
- if (typeof window !== "undefined" && window.navigator) return !!/* @__PURE__ */ navigator.userAgent.match(pattern);
10070
+ if (typeof window !== "undefined" && window.navigator) return !!/*@__PURE__*/ navigator.userAgent.match(pattern);
10071
10071
  }
10072
10072
  function on(el, event, fn) {
10073
10073
  el.addEventListener(event, fn, !IE11OrLess && captureMode);
@@ -16668,7 +16668,9 @@ var init_component = __esmMin((() => {
16668
16668
  }
16669
16669
  const { controlData: { meta: { id: metaId }, ...elementData } } = Controls$1.get(item.id);
16670
16670
  set(elementData, "config.controlId", metaId);
16671
- const controlType = metaId.startsWith("layout-") ? metaId.replace(/^layout-/, "") : "field";
16671
+ const isLayoutControl = metaId.startsWith("layout-");
16672
+ const controlType = isLayoutControl ? metaId.replace(/^layout-/, "") : "field";
16673
+ const componentData = isLayoutControl ? {} : elementData;
16672
16674
  const depth = get({
16673
16675
  stage: {
16674
16676
  row: 0,
@@ -16689,7 +16691,7 @@ var init_component = __esmMin((() => {
16689
16691
  }, `${this.name}.${controlType}`);
16690
16692
  const action = depthMap.get(depth)();
16691
16693
  dom.remove(item);
16692
- return action(elementData, newIndex);
16694
+ return action(componentData, newIndex);
16693
16695
  },
16694
16696
  row: () => {
16695
16697
  return (depthMap.get({
@@ -17897,7 +17899,7 @@ var FormeoEditor$1 = class {
17897
17899
  fetchIcons(this.opts.svgSprite),
17898
17900
  fetchFormeoStyle(this.opts.style),
17899
17901
  s.init({
17900
- preloaded: { "en-US": i },
17902
+ preloaded: { "en-US": s$1 },
17901
17903
  ...this.opts.i18n,
17902
17904
  locale: globalThis.sessionStorage?.getItem(SESSION_LOCALE_KEY)
17903
17905
  })
@@ -18073,20 +18075,56 @@ var baseId = (id) => {
18073
18075
  };
18074
18076
  var isVisible = (elem) => {
18075
18077
  if (!elem) return false;
18076
- if (elem.hasAttribute("hidden") || elem.parentElement.hasAttribute("hidden")) return false;
18078
+ if (elem.hasAttribute("hidden") || elem.parentElement?.hasAttribute("hidden")) return false;
18077
18079
  const computedStyle = window.getComputedStyle(elem);
18078
18080
  return !(computedStyle.display === "none" || computedStyle.visibility === "hidden" || computedStyle.opacity === "0");
18079
18081
  };
18082
+ var CHECKABLE_INPUT_SELECTOR = "input[type=\"checkbox\"], input[type=\"radio\"]";
18083
+ var CHECKABLE_TYPES = new Set(["checkbox", "radio"]);
18084
+ var tagName$1 = (elem) => elem?.tagName?.toLowerCase();
18085
+ var isCheckableInput = (elem) => tagName$1(elem) === "input" && CHECKABLE_TYPES.has(elem.type);
18086
+ /**
18087
+ * Radio and checkbox fields render as a wrapper holding one input per option, so a
18088
+ * field address resolves to the wrapper rather than to anything carrying a value.
18089
+ * @param {Element} elem
18090
+ * @return {Array<Element>|null} option inputs, or null when elem is not a group
18091
+ */
18092
+ var checkableGroupInputs = (elem) => {
18093
+ if (!elem || isCheckableInput(elem) || typeof elem.querySelectorAll !== "function") return null;
18094
+ const inputs = elem.querySelectorAll(CHECKABLE_INPUT_SELECTOR);
18095
+ return inputs.length ? Array.from(inputs) : null;
18096
+ };
18097
+ var isCheckableGroup = (elem) => Boolean(checkableGroupInputs(elem));
18098
+ /**
18099
+ * Value a condition compares against. Controls that can hold several values at once
18100
+ * yield an array so that a single selection still matches an `equals` comparison.
18101
+ * @param {Element} elem
18102
+ * @return {String|Array<String>|undefined}
18103
+ */
18104
+ var elementValue = (elem) => {
18105
+ if (!elem) return;
18106
+ const groupInputs = checkableGroupInputs(elem);
18107
+ if (groupInputs) {
18108
+ const checkedValues = groupInputs.filter((input) => input.checked).map((input) => input.value);
18109
+ return groupInputs.every((input) => input.type === "radio") ? checkedValues[0] ?? "" : checkedValues;
18110
+ }
18111
+ if (tagName$1(elem) === "select" && elem.multiple) return Array.from(elem.selectedOptions, (option) => option.value);
18112
+ if (isCheckableInput(elem)) return elem.checked ? elem.value : "";
18113
+ return elem.value;
18114
+ };
18115
+ var isChecked = (elem) => {
18116
+ const groupInputs = checkableGroupInputs(elem);
18117
+ return groupInputs ? groupInputs.some((input) => input.checked) : Boolean(elem?.checked);
18118
+ };
18080
18119
  var propertyMap = {
18081
18120
  isChecked: (elem) => {
18082
- return elem.checked;
18121
+ return isChecked(elem);
18083
18122
  },
18084
18123
  isNotChecked: (elem) => {
18085
- return !elem.checked;
18086
- },
18087
- value: (elem) => {
18088
- return elem.value;
18124
+ return !isChecked(elem);
18089
18125
  },
18126
+ value: elementValue,
18127
+ checked: elementValue,
18090
18128
  isVisible: (elem) => {
18091
18129
  return isVisible(elem);
18092
18130
  },
@@ -18103,11 +18141,16 @@ var createRemoveButton = () => dom.btnTemplate({
18103
18141
  click: ({ target }) => target.parentElement.remove()
18104
18142
  }
18105
18143
  });
18144
+ var equals = (source, target) => Array.isArray(source) ? source.some((value) => (0, import_isEqual.default)(value, target)) : (0, import_isEqual.default)(source, target);
18145
+ var contains = (source, target) => {
18146
+ if (source == null) return false;
18147
+ return Array.isArray(source) ? source.includes(target) : String(source).includes(target);
18148
+ };
18106
18149
  var comparisonHandlers = {
18107
- equals: import_isEqual.default,
18108
- notEquals: (source, target) => !(0, import_isEqual.default)(source, target),
18109
- contains: (source, target) => source.includes(target),
18110
- notContains: (source, target) => !source.includes(target)
18150
+ equals,
18151
+ notEquals: (source, target) => !equals(source, target),
18152
+ contains,
18153
+ notContains: (source, target) => !contains(source, target)
18111
18154
  };
18112
18155
  var comparisonMap = Object.entries(COMPARISON_OPERATORS).reduce((acc, [key, value]) => {
18113
18156
  acc[value] = comparisonHandlers[key];
@@ -18375,7 +18418,8 @@ var FormeoRenderer$1 = class {
18375
18418
  * @return {Array} flattened array of conditions
18376
18419
  */
18377
18420
  handleComponentCondition = (component, ifRest, thenConditions) => {
18378
- if (component.length) {
18421
+ if (!component) return;
18422
+ if (isNodeCollection(component)) {
18379
18423
  for (const elem of component) this.handleComponentCondition(elem, ifRest, thenConditions);
18380
18424
  return;
18381
18425
  }
@@ -18387,23 +18431,25 @@ var FormeoRenderer$1 = class {
18387
18431
  if (this.evaluateCondition(ifRest, fakeEvt)) for (const thenCondition of thenConditions) this.execResult(thenCondition, fakeEvt);
18388
18432
  };
18389
18433
  applyConditions = () => {
18390
- for (const { conditions } of Object.values(this.components)) if (conditions) for (const condition of conditions) {
18391
- const { if: ifConditions, then: thenConditions } = condition;
18392
- for (const ifCondition of ifConditions) {
18393
- const { source, target } = ifCondition;
18394
- if (isAddress(source)) {
18395
- const { component, options } = this.getComponent(source);
18396
- const sourceComponent = options || component;
18397
- this.handleComponentCondition(sourceComponent, ifCondition, thenConditions);
18398
- }
18399
- if (isAddress(target)) {
18400
- const { component, options } = this.getComponent(target);
18401
- const targetComponent = options || component;
18402
- this.handleComponentCondition(targetComponent, ifCondition, thenConditions);
18434
+ for (const { conditions } of Object.values(this.components)) {
18435
+ if (!conditions) continue;
18436
+ for (const condition of conditions) {
18437
+ const { if: ifConditions = [], then: thenConditions = [] } = condition;
18438
+ for (const ifCondition of ifConditions) try {
18439
+ this.applyCondition(ifCondition, thenConditions);
18440
+ } catch (err) {
18441
+ console.error("formeo: condition skipped", ifCondition, err);
18403
18442
  }
18404
18443
  }
18405
18444
  }
18406
18445
  };
18446
+ applyCondition = (ifCondition, thenConditions) => {
18447
+ for (const address of [ifCondition.source, ifCondition.target]) {
18448
+ if (!isAddress(address)) continue;
18449
+ const { component, options } = this.getComponent(address);
18450
+ this.handleComponentCondition(options || component, ifCondition, thenConditions);
18451
+ }
18452
+ };
18407
18453
  /**
18408
18454
  * Evaulate conditions
18409
18455
  */
@@ -18425,9 +18471,10 @@ var FormeoRenderer$1 = class {
18425
18471
  }
18426
18472
  };
18427
18473
  getComponentProperty = (address, propertyName) => {
18428
- const { component, option } = this.getComponent(address);
18474
+ const { component, option } = this.getComponent(address) || {};
18429
18475
  const elem = option || component;
18430
- return propertyMap[propertyName]?.(elem) || elem[propertyName];
18476
+ if (!elem) return;
18477
+ return propertyMap[propertyName] ? propertyMap[propertyName](elem) : elem[propertyName];
18431
18478
  };
18432
18479
  getComponent = (address) => {
18433
18480
  const result = { component: null };
@@ -18452,7 +18499,14 @@ var FormeoRenderer$1 = class {
18452
18499
  return components;
18453
18500
  };
18454
18501
  };
18455
- var listenTypeMap = [["input", (c) => ["textarea", "text"].includes(c.type)], ["change", (c) => ["select"].includes(c.tagName.toLowerCase()) || ["checkbox", "radio"].includes(c.type)]];
18502
+ var isDomNode = (value) => Boolean(value) && typeof value.nodeType === "number";
18503
+ var isNodeCollection = (value) => Boolean(value) && !isDomNode(value) && typeof value.length === "number";
18504
+ var tagName = (component) => component.tagName?.toLowerCase();
18505
+ var listenTypeMap = [
18506
+ ["change", (component) => isCheckableGroup(component)],
18507
+ ["change", (component) => tagName(component) === "select" || ["checkbox", "radio"].includes(component.type)],
18508
+ ["input", (component) => ["input", "textarea"].includes(tagName(component))]
18509
+ ];
18456
18510
  var LISTEN_TYPE_MAP = (component) => {
18457
18511
  const [listenerEvent] = listenTypeMap.find((typeMap) => typeMap[1](component)) || [false];
18458
18512
  return listenerEvent;
package/dist/formeo.css CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 5.1.0
4
+ Version: 5.1.2
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7