@opencitylabs/formio-custom-components 0.7.4 → 0.7.5
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/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7927,12 +7927,19 @@ function fr(e) {
|
|
|
7927
7927
|
static schema(...t) {
|
|
7928
7928
|
return e.schema({ resetValueOn: [] }, ...t);
|
|
7929
7929
|
}
|
|
7930
|
-
|
|
7931
|
-
super.
|
|
7932
|
-
|
|
7933
|
-
|
|
7930
|
+
attach(e) {
|
|
7931
|
+
let t = super.attach(e), n = this.component?.resetValueOn;
|
|
7932
|
+
if (!n || !this.root) return t;
|
|
7933
|
+
this._resetValueOnHandler && this.root.off("change", this._resetValueOnHandler);
|
|
7934
7934
|
let r = Array.isArray(n) ? n : [n];
|
|
7935
|
-
r.length
|
|
7935
|
+
return r.length ? (this._resetValueOnHandler = (e, t) => {
|
|
7936
|
+
if (this.root?.pristine !== !1) return;
|
|
7937
|
+
let n = t?.changes || (t?.changed ? [t.changed] : []);
|
|
7938
|
+
n.length && n.some((e) => r.some((t) => t === "data" ? !0 : e.instance?.path === t || e.path === t)) && this.setValue(this.emptyValue);
|
|
7939
|
+
}, this.root.on("change", this._resetValueOnHandler), t) : t;
|
|
7940
|
+
}
|
|
7941
|
+
detach() {
|
|
7942
|
+
return this._resetValueOnHandler && this.root && (this.root.off("change", this._resetValueOnHandler), this._resetValueOnHandler = null), super.detach();
|
|
7936
7943
|
}
|
|
7937
7944
|
};
|
|
7938
7945
|
}
|