@opencitylabs/formio-custom-components 0.6.11 → 0.7.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/index.js CHANGED
@@ -7899,14 +7899,57 @@ var cr = t.Components.components.field, lr = ({ component: e, current: t, onChan
7899
7899
  render() {
7900
7900
  return super.render(`<div ref="react-${this.id}"></div>`);
7901
7901
  }
7902
- }, dr = e.components.select, fr = class extends dr {
7902
+ }, dr = {
7903
+ type: "select",
7904
+ input: !0,
7905
+ key: "resetValueOn",
7906
+ label: "Reset Value On",
7907
+ weight: 25,
7908
+ tooltip: "Reset the value of this field when the selected field changes.",
7909
+ dataSrc: "custom",
7910
+ valueProperty: "value",
7911
+ data: { custom(e) {
7912
+ let t = [{
7913
+ label: "Any Change",
7914
+ value: "data"
7915
+ }];
7916
+ return e.utils.eachComponent(e.instance.options.editForm.components, function(n, r) {
7917
+ n.key !== e.data.key && t.push({
7918
+ label: n.label || n.key,
7919
+ value: r
7920
+ });
7921
+ }), t;
7922
+ } }
7923
+ };
7924
+ function fr(e) {
7925
+ return class extends e {
7926
+ static schema(...t) {
7927
+ return e.schema({ resetValueOn: "" }, ...t);
7928
+ }
7929
+ checkRefreshOn(e, t = {}) {
7930
+ super.checkRefreshOn(e, t);
7931
+ let { resetValueOn: n } = this.component;
7932
+ !n || !e?.length || e.some((e) => n === "data" ? !0 : e.instance?.path === n || e.path === n) && this.setValue(this.emptyValue);
7933
+ }
7934
+ };
7935
+ }
7936
+ //#endregion
7937
+ //#region src/customComponentFormio/Select/Select.js
7938
+ var pr = e.components.select, mr = class extends fr(pr) {
7939
+ static schema(...e) {
7940
+ return fr(pr).schema(...e);
7941
+ }
7942
+ static editForm(...e) {
7943
+ let t = pr.editForm(...e), n = (t.components?.find((e) => e.key === "tabs"))?.components?.find((e) => e.key === "data");
7944
+ return n?.components && n.components.push(dr), t;
7945
+ }
7903
7946
  attach(e) {
7904
7947
  let t = super.attach(e);
7905
7948
  return (Array.isArray(this.refs.autocompleteInput) ? this.refs.autocompleteInput : [this.refs.autocompleteInput]).forEach((e) => {
7906
7949
  e?.parentNode && e.parentNode.removeChild(e);
7907
7950
  }), t;
7908
7951
  }
7909
- }, pr = {
7952
+ }, hr = {
7910
7953
  pagebreak: _e,
7911
7954
  dynamic_calendar: dt,
7912
7955
  calendar: _t,
@@ -7914,15 +7957,15 @@ var cr = t.Components.components.field, lr = ({ component: e, current: t, onChan
7914
7957
  sdcfile: Yn,
7915
7958
  address_map: ar,
7916
7959
  "list-services": ur,
7917
- select: fr
7960
+ select: mr
7918
7961
  };
7919
- function mr(e) {
7962
+ function gr(e) {
7920
7963
  if (!e || typeof e.addComponent != "function") throw Error("registerFormioComponents requires Formio Components with addComponent(name, component)");
7921
- return Object.entries(pr).forEach(([t, n]) => {
7964
+ return Object.entries(hr).forEach(([t, n]) => {
7922
7965
  e.addComponent(t, n);
7923
- }), pr;
7966
+ }), hr;
7924
7967
  }
7925
7968
  //#endregion
7926
- export { _t as Calendar, Nt as CalendarAdvanced, ar as FormioAddressMap, dt as FormioDynamicCalendar, ur as FormioListServices, _e as FormioPageBreak, Yn as SdcFile, fr as Select, pr as formioCustomComponents, mr as registerFormioComponents };
7969
+ export { _t as Calendar, Nt as CalendarAdvanced, ar as FormioAddressMap, dt as FormioDynamicCalendar, ur as FormioListServices, _e as FormioPageBreak, Yn as SdcFile, mr as Select, hr as formioCustomComponents, gr as registerFormioComponents, dr as resetValueOnEditField, fr as withResetValueOn };
7927
7970
 
7928
7971
  //# sourceMappingURL=index.js.map