formeo 4.0.0 → 4.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.
- package/README.md +2 -2
- package/dist/demo/assets/css/demo.min.css +1 -1
- package/dist/demo/assets/css/demo.min.css.gz +0 -0
- package/dist/demo/assets/css/formeo.min.css +1 -1
- package/dist/demo/assets/js/demo.min.js +2 -2
- package/dist/demo/assets/js/demo.min.js.gz +0 -0
- package/dist/demo/assets/js/formeo.cjs.js +130 -8
- package/dist/demo/assets/js/formeo.es.js +130 -8
- package/dist/demo/assets/js/formeo.min.cjs.js +3 -3
- package/dist/demo/assets/js/formeo.min.es.js +130 -8
- package/dist/demo/assets/js/formeo.min.js +130 -8
- package/dist/demo/assets/js/formeo.min.umd.js +3 -3
- package/dist/demo/assets/js/formeo.umd.js +130 -8
- package/dist/demo/assets/js/index.min.js +1 -1
- package/dist/demo/assets/js/index.min2.js +1 -1
- package/dist/demo/assets/js/index.min3.js +1 -1
- package/dist/demo/assets/js/mode-json.min.js +1 -1
- package/dist/demo/assets/js/mode-json.min.js.gz +0 -0
- package/dist/demo/assets/js/theme-github_light_default.min.js +1 -1
- package/dist/demo/index.html +1 -1
- package/dist/formeo.cjs.js +130 -8
- package/dist/formeo.css +1 -1
- package/dist/formeo.es.js +130 -8
- package/dist/formeo.min.cjs.js +3 -3
- package/dist/formeo.min.css +1 -1
- package/dist/formeo.min.es.js +130 -8
- package/dist/formeo.min.js +130 -8
- package/dist/formeo.min.umd.js +3 -3
- package/dist/formeo.umd.js +130 -8
- package/package.json +2 -2
package/dist/formeo.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
formeo - https://formeo.io
|
|
4
|
-
Version:
|
|
4
|
+
Version: 4.0.0
|
|
5
5
|
Author: Draggable https://draggable.io
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -438,7 +438,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
438
438
|
window.SmartTooltip = SmartTooltip;
|
|
439
439
|
}
|
|
440
440
|
const name$1 = "formeo";
|
|
441
|
-
const version$2 = "
|
|
441
|
+
const version$2 = "4.0.0";
|
|
442
442
|
const type = "module";
|
|
443
443
|
const main = "dist/formeo.cjs.js";
|
|
444
444
|
const module2 = "dist/formeo.es.js";
|
|
@@ -569,7 +569,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
569
569
|
sortablejs: "^1.15.3"
|
|
570
570
|
};
|
|
571
571
|
const release = {
|
|
572
|
-
branch: "
|
|
572
|
+
branch: "main",
|
|
573
573
|
verifyConditions: [
|
|
574
574
|
"@semantic-release/changelog",
|
|
575
575
|
"@semantic-release/npm",
|
|
@@ -5003,7 +5003,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5003
5003
|
}
|
|
5004
5004
|
const _this = this;
|
|
5005
5005
|
const processed = ["children", "content"];
|
|
5006
|
-
const { className, options, dataset,
|
|
5006
|
+
const { className, options, dataset, ...elem } = this.processElemArg(elemArg);
|
|
5007
5007
|
processed.push("tag");
|
|
5008
5008
|
let childType;
|
|
5009
5009
|
const { tag } = elem;
|
|
@@ -7035,7 +7035,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7035
7035
|
}
|
|
7036
7036
|
getPanelDisplay() {
|
|
7037
7037
|
const column = this.panelsWrap;
|
|
7038
|
-
const width = Number.parseInt(dom.getStyle(column, "width"));
|
|
7038
|
+
const width = Number.parseInt(dom.getStyle(column, "width"), 10);
|
|
7039
7039
|
const autoDisplayType = width > 390 ? "tabbed" : "slider";
|
|
7040
7040
|
const isAuto = this.opts.displayType === "auto";
|
|
7041
7041
|
this.panelDisplay = isAuto ? autoDisplayType : this.opts.displayType || defaults$2.displayType;
|
|
@@ -7291,6 +7291,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7291
7291
|
}
|
|
7292
7292
|
const parent = this.parent;
|
|
7293
7293
|
const children = this.children;
|
|
7294
|
+
this.dispatchComponentEvent("onRemove", {
|
|
7295
|
+
path,
|
|
7296
|
+
parent,
|
|
7297
|
+
children: [...children]
|
|
7298
|
+
// copy array since children will be modified
|
|
7299
|
+
});
|
|
7294
7300
|
forEach(children, (child) => child.remove());
|
|
7295
7301
|
this.dom.parentElement.removeChild(this.dom);
|
|
7296
7302
|
remove(components.getAddress(`${parent.name}s.${parent.id}.children`), this.id);
|
|
@@ -7432,6 +7438,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7432
7438
|
if (this.name !== "field") {
|
|
7433
7439
|
this.cloneChildren(newClone);
|
|
7434
7440
|
}
|
|
7441
|
+
this.dispatchComponentEvent("onClone", {
|
|
7442
|
+
original: this,
|
|
7443
|
+
clone: newClone,
|
|
7444
|
+
parent
|
|
7445
|
+
});
|
|
7435
7446
|
return newClone;
|
|
7436
7447
|
});
|
|
7437
7448
|
__publicField(this, "createChildWrap", (children) => dom.create({
|
|
@@ -7503,11 +7514,91 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7503
7514
|
this.address = `${this.name}s.${this.id}`;
|
|
7504
7515
|
this.dataPath = `${this.address}.`;
|
|
7505
7516
|
this.editPanels = /* @__PURE__ */ new Map();
|
|
7517
|
+
this.eventListeners = /* @__PURE__ */ new Map();
|
|
7518
|
+
this.initEventHandlers();
|
|
7519
|
+
}
|
|
7520
|
+
/**
|
|
7521
|
+
* Initialize event handlers based on config
|
|
7522
|
+
*/
|
|
7523
|
+
initEventHandlers() {
|
|
7524
|
+
if (!this.config.events) {
|
|
7525
|
+
return;
|
|
7526
|
+
}
|
|
7527
|
+
Object.entries(this.config.events).forEach(([eventName, handler]) => {
|
|
7528
|
+
this.addEventListener(eventName, handler);
|
|
7529
|
+
});
|
|
7530
|
+
}
|
|
7531
|
+
/**
|
|
7532
|
+
* Add an event listener to this component
|
|
7533
|
+
* @param {string} eventName - Name of the event
|
|
7534
|
+
* @param {function} handler - Event handler function
|
|
7535
|
+
*/
|
|
7536
|
+
addEventListener(eventName, handler) {
|
|
7537
|
+
if (!this.eventListeners.has(eventName)) {
|
|
7538
|
+
this.eventListeners.set(eventName, []);
|
|
7539
|
+
}
|
|
7540
|
+
this.eventListeners.get(eventName).push(handler);
|
|
7541
|
+
}
|
|
7542
|
+
/**
|
|
7543
|
+
* Remove an event listener from this component
|
|
7544
|
+
* @param {string} eventName - Name of the event
|
|
7545
|
+
* @param {function} handler - Event handler function to remove
|
|
7546
|
+
*/
|
|
7547
|
+
removeEventListener(eventName, handler) {
|
|
7548
|
+
var _a;
|
|
7549
|
+
if (!((_a = this.eventListeners) == null ? void 0 : _a.has(eventName))) {
|
|
7550
|
+
return;
|
|
7551
|
+
}
|
|
7552
|
+
const handlers = this.eventListeners.get(eventName);
|
|
7553
|
+
const index2 = handlers.indexOf(handler);
|
|
7554
|
+
if (index2 > -1) {
|
|
7555
|
+
handlers.splice(index2, 1);
|
|
7556
|
+
}
|
|
7557
|
+
}
|
|
7558
|
+
/**
|
|
7559
|
+
* Dispatch a component event to all registered listeners
|
|
7560
|
+
* @param {string} eventName - Name of the event to dispatch
|
|
7561
|
+
* @param {object} eventData - Data to pass to event handlers
|
|
7562
|
+
*/
|
|
7563
|
+
dispatchComponentEvent(eventName, eventData = {}) {
|
|
7564
|
+
var _a;
|
|
7565
|
+
const fullEventData = {
|
|
7566
|
+
component: this,
|
|
7567
|
+
type: eventName,
|
|
7568
|
+
timestamp: Date.now(),
|
|
7569
|
+
...eventData
|
|
7570
|
+
};
|
|
7571
|
+
if ((_a = this.eventListeners) == null ? void 0 : _a.has(eventName)) {
|
|
7572
|
+
this.eventListeners.get(eventName).forEach((handler) => {
|
|
7573
|
+
try {
|
|
7574
|
+
if (typeof handler === "function") {
|
|
7575
|
+
handler(fullEventData);
|
|
7576
|
+
}
|
|
7577
|
+
} catch (error) {
|
|
7578
|
+
console.error(`Error in ${eventName} event handler for ${this.name} ${this.id}:`, error);
|
|
7579
|
+
}
|
|
7580
|
+
});
|
|
7581
|
+
}
|
|
7582
|
+
return fullEventData;
|
|
7583
|
+
}
|
|
7584
|
+
/**
|
|
7585
|
+
* Override Data.set to dispatch component update events
|
|
7586
|
+
*/
|
|
7587
|
+
set(path, newVal) {
|
|
7588
|
+
const oldVal = this.get(path);
|
|
7589
|
+
const result = super.set(path, newVal);
|
|
7590
|
+
if (oldVal !== newVal && this.dom) {
|
|
7591
|
+
this.dispatchComponentEvent("onUpdate", {
|
|
7592
|
+
path,
|
|
7593
|
+
oldValue: oldVal,
|
|
7594
|
+
newValue: newVal
|
|
7595
|
+
});
|
|
7596
|
+
}
|
|
7597
|
+
return result;
|
|
7506
7598
|
}
|
|
7507
7599
|
// mutationHandler = mutations =>
|
|
7508
7600
|
// mutations.map(mutation => {
|
|
7509
|
-
// @todo pull handler form config
|
|
7510
|
-
// see dom.create.onRender for implementation pattern
|
|
7601
|
+
// @todo pull handler form config see dom.create.onRender for implementation pattern
|
|
7511
7602
|
// })
|
|
7512
7603
|
// observe(container) {
|
|
7513
7604
|
// this.observer.disconnect()
|
|
@@ -7710,7 +7801,24 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7710
7801
|
}
|
|
7711
7802
|
const childComponentType = `${childGroup}s`;
|
|
7712
7803
|
const child = components.getAddress(`${childComponentType}.${childId}`) || components[childComponentType].add(childId, data);
|
|
7713
|
-
|
|
7804
|
+
if (index2 >= childWrap.children.length) {
|
|
7805
|
+
childWrap.appendChild(child.dom);
|
|
7806
|
+
} else {
|
|
7807
|
+
childWrap.children[index2].before(child.dom);
|
|
7808
|
+
}
|
|
7809
|
+
this.dispatchComponentEvent("onAddChild", {
|
|
7810
|
+
parent: this,
|
|
7811
|
+
target: child,
|
|
7812
|
+
child,
|
|
7813
|
+
index: index2
|
|
7814
|
+
});
|
|
7815
|
+
child.dispatchComponentEvent("onAdd", {
|
|
7816
|
+
parent: this,
|
|
7817
|
+
target: child,
|
|
7818
|
+
index: index2,
|
|
7819
|
+
addedVia: "addChild"
|
|
7820
|
+
// indicate how the component was added
|
|
7821
|
+
});
|
|
7714
7822
|
(_b = (_a = this.config.events) == null ? void 0 : _a.onAddChild) == null ? void 0 : _b.call(_a, { parent: this, child });
|
|
7715
7823
|
const grandChildren = child.get("children");
|
|
7716
7824
|
if (grandChildren == null ? void 0 : grandChildren.length) {
|
|
@@ -7819,6 +7927,17 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7819
7927
|
}
|
|
7820
7928
|
};
|
|
7821
7929
|
const component = (_a = onAddConditions[fromType]) == null ? void 0 : _a.call(onAddConditions, item, newIndex2);
|
|
7930
|
+
this.dispatchComponentEvent("onAdd", {
|
|
7931
|
+
from,
|
|
7932
|
+
to,
|
|
7933
|
+
item,
|
|
7934
|
+
newIndex: newIndex2,
|
|
7935
|
+
fromType,
|
|
7936
|
+
toType,
|
|
7937
|
+
addedComponent: component,
|
|
7938
|
+
addedVia: "dragDrop"
|
|
7939
|
+
// indicate how the component was added
|
|
7940
|
+
});
|
|
7822
7941
|
defaultOnAdd();
|
|
7823
7942
|
return component;
|
|
7824
7943
|
}
|
|
@@ -7841,6 +7960,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7841
7960
|
* Callback for onRender, executes any defined onRender for component
|
|
7842
7961
|
*/
|
|
7843
7962
|
onRender() {
|
|
7963
|
+
this.dispatchComponentEvent("onRender", {
|
|
7964
|
+
dom: this.dom
|
|
7965
|
+
});
|
|
7844
7966
|
const { events: events2 } = this.config;
|
|
7845
7967
|
if (!events2) {
|
|
7846
7968
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "formeo",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/formeo.cjs.js",
|
|
6
6
|
"module": "dist/formeo.es.js",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"sortablejs": "^1.15.3"
|
|
132
132
|
},
|
|
133
133
|
"release": {
|
|
134
|
-
"branch": "
|
|
134
|
+
"branch": "main",
|
|
135
135
|
"verifyConditions": [
|
|
136
136
|
"@semantic-release/changelog",
|
|
137
137
|
"@semantic-release/npm",
|