formeo 2.3.1 → 3.0.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.
package/dist/formeo.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 2.3.0
4
+ Version: 2.3.1
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 = "2.3.0";
437
+ const version$2 = "2.3.1";
438
438
  const type = "module";
439
439
  const main = "dist/formeo.cjs.js";
440
440
  const module = "dist/formeo.es.js";
@@ -501,6 +501,7 @@ const scripts = {
501
501
  "build:lib": "vite build --config vite.config.lib.mjs",
502
502
  build: "npm-run-all -p build:icons build:demo",
503
503
  prebuild: "npm run build:lib",
504
+ postbuild: "npm run generate:jsonSchema",
504
505
  "build:demo": "vite build --mode demo",
505
506
  "build:demo:watch": "vite build --mode demo --watch",
506
507
  "build:icons": "node ./tools/generate-sprite",
@@ -515,7 +516,8 @@ const scripts = {
515
516
  "travis-deploy-once": "travis-deploy-once --pro",
516
517
  prepush: "npm test",
517
518
  prepare: "lefthook install",
518
- postmerge: "lefthook install"
519
+ postmerge: "lefthook install",
520
+ "generate:jsonSchema": "node --experimental-strip-types --no-warnings ./tools/generate-json-schema.ts"
519
521
  };
520
522
  const devDependencies = {
521
523
  "@biomejs/biome": "^1.9.3",
@@ -526,7 +528,7 @@ const devDependencies = {
526
528
  "@semantic-release/npm": "^12.0.1",
527
529
  jsdom: "^25.0.1",
528
530
  lefthook: "^1.7.18",
529
- "npm-run-all": "^4.1.5",
531
+ "npm-run-all": "^2.1.0",
530
532
  "sass-embedded": "^1.80.1",
531
533
  "semantic-release": "^24.1.2",
532
534
  "svg-sprite": "^2.0.4",
@@ -534,7 +536,9 @@ const devDependencies = {
534
536
  "vite-plugin-banner": "^0.8.0",
535
537
  "vite-plugin-compression": "^0.5.1",
536
538
  "vite-plugin-html": "^3.2.2",
537
- "vite-plugin-static-copy": "^2.0.0"
539
+ "vite-plugin-static-copy": "^2.0.0",
540
+ zod: "^3.23.8",
541
+ "zod-to-json-schema": "^3.23.5"
538
542
  };
539
543
  const dependencies = {
540
544
  "@draggable/formeo-languages": "^3.1.3",
@@ -7438,7 +7442,7 @@ class ButtonControl extends Control {
7438
7442
  options: [
7439
7443
  {
7440
7444
  label: mi18n.get("button"),
7441
- type: ["button", "submit", "reset"].map((buttonType, index2) => ({
7445
+ type: ["button", "submit", "reset"].map((buttonType) => ({
7442
7446
  label: buttonType,
7443
7447
  type: buttonType
7444
7448
  })),
@@ -8575,16 +8579,24 @@ class Column extends Component {
8575
8579
  field.panels.nav.refresh();
8576
8580
  }
8577
8581
  });
8582
+ /**
8583
+ * Sets the width data and style for the column
8584
+ * @param {string} width - The width value to be set for the column
8585
+ * @returns {void}
8586
+ */
8587
+ __publicField(this, "setDomWidth", (width) => {
8588
+ this.dom.dataset.colWidth = width;
8589
+ this.dom.style.width = width;
8590
+ });
8578
8591
  /**
8579
8592
  * Sets a columns width
8580
8593
  * @param {String} width percent or pixel
8581
8594
  */
8582
8595
  __publicField(this, "setWidth", (width) => {
8583
- this.dom.dataset.colWidth = width;
8584
- this.dom.style.width = width;
8596
+ this.setDomWidth(width);
8585
8597
  return this.set("config.width", width);
8586
8598
  });
8587
- const children = this.createChildWrap();
8599
+ const childWrap = this.createChildWrap();
8588
8600
  this.dom = dom.create({
8589
8601
  tag: "li",
8590
8602
  className: [COLUMN_CLASSNAME, "empty"],
@@ -8597,17 +8609,17 @@ class Column extends Component {
8597
8609
  this.getActionButtons(),
8598
8610
  DOM_CONFIGS.editWindow(),
8599
8611
  DOM_CONFIGS.resizeHandle(new ResizeColumn()),
8600
- children
8612
+ childWrap
8601
8613
  ]
8602
8614
  });
8603
- this.processConfig(this.dom);
8615
+ this.processConfig();
8604
8616
  events.columnResized = new window.CustomEvent("columnResized", {
8605
8617
  detail: {
8606
8618
  column: this.dom,
8607
8619
  instance: this
8608
8620
  }
8609
8621
  });
8610
- Sortable.create(children, {
8622
+ Sortable.create(childWrap, {
8611
8623
  animation: 150,
8612
8624
  fallbackClass: "field-moving",
8613
8625
  forceFallback: true,
@@ -8636,11 +8648,10 @@ class Column extends Component {
8636
8648
  * Process column configuration data
8637
8649
  * @param {Object} column
8638
8650
  */
8639
- processConfig(column) {
8651
+ processConfig() {
8640
8652
  const columnWidth = helpers.get(this.data, "config.width");
8641
8653
  if (columnWidth) {
8642
- column.dataset.colWidth = columnWidth;
8643
- column.style.width = columnWidth;
8654
+ this.setDomWidth(columnWidth);
8644
8655
  }
8645
8656
  }
8646
8657
  }
@@ -8691,6 +8702,23 @@ let Fields$1 = class Fields extends ComponentData {
8691
8702
  }
8692
8703
  return found;
8693
8704
  });
8705
+ __publicField(this, "getData", () => {
8706
+ return Object.entries(this.data).reduce((acc, [key, val]) => {
8707
+ const { conditions, ...data } = (val == null ? void 0 : val.getData()) || val;
8708
+ if (conditions == null ? void 0 : conditions.length) {
8709
+ let hasConditions = true;
8710
+ if (conditions.length === 1) {
8711
+ const [firstCondition] = conditions;
8712
+ hasConditions = Boolean(firstCondition.if[0].source && firstCondition.then[0].target);
8713
+ }
8714
+ if (hasConditions) {
8715
+ data.conditions = conditions;
8716
+ }
8717
+ }
8718
+ acc[key] = data;
8719
+ return acc;
8720
+ }, {});
8721
+ });
8694
8722
  this.config = { all: DEFAULT_CONFIG };
8695
8723
  }
8696
8724
  Component(data) {
@@ -8769,7 +8797,10 @@ class Components extends Data {
8769
8797
  }, acculumator);
8770
8798
  }
8771
8799
  get json() {
8772
- return window.JSON.stringify(this.formData);
8800
+ return window.JSON.stringify({
8801
+ $schema: `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/formData_schema.json`,
8802
+ ...this.formData
8803
+ });
8773
8804
  }
8774
8805
  get formData() {
8775
8806
  return {
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 2.3.0
4
+ Version: 2.3.1
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7