@opencitylabs/formio-custom-components 0.7.3 → 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 +17 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7902,10 +7902,11 @@ var cr = t.Components.components.field, lr = ({ component: e, current: t, onChan
|
|
|
7902
7902
|
}, dr = {
|
|
7903
7903
|
type: "select",
|
|
7904
7904
|
input: !0,
|
|
7905
|
+
multiple: !0,
|
|
7905
7906
|
key: "resetValueOn",
|
|
7906
7907
|
label: "Reset Value On",
|
|
7907
7908
|
weight: 25,
|
|
7908
|
-
tooltip: "Reset the value of this field when the selected
|
|
7909
|
+
tooltip: "Reset the value of this field when any of the selected fields changes.",
|
|
7909
7910
|
dataSrc: "custom",
|
|
7910
7911
|
valueProperty: "value",
|
|
7911
7912
|
data: { custom(e) {
|
|
@@ -7924,12 +7925,21 @@ var cr = t.Components.components.field, lr = ({ component: e, current: t, onChan
|
|
|
7924
7925
|
function fr(e) {
|
|
7925
7926
|
return class extends e {
|
|
7926
7927
|
static schema(...t) {
|
|
7927
|
-
return e.schema({ resetValueOn:
|
|
7928
|
-
}
|
|
7929
|
-
|
|
7930
|
-
super.
|
|
7931
|
-
|
|
7932
|
-
|
|
7928
|
+
return e.schema({ resetValueOn: [] }, ...t);
|
|
7929
|
+
}
|
|
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
|
+
let r = Array.isArray(n) ? n : [n];
|
|
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();
|
|
7933
7943
|
}
|
|
7934
7944
|
};
|
|
7935
7945
|
}
|