@opencitylabs/formio-custom-components 0.6.11 → 0.7.1

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,63 @@ 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
+ attach(e) {
7930
+ let t = super.attach(e);
7931
+ return this.root && (this.root.initialized ? this._resetValueOnReady = !0 : this.root.on("initialized", () => {
7932
+ this._resetValueOnReady = !0;
7933
+ })), t;
7934
+ }
7935
+ checkRefreshOn(e, t = {}) {
7936
+ super.checkRefreshOn(e, t);
7937
+ let { resetValueOn: n } = this.component;
7938
+ !n || !e?.length || this._resetValueOnReady && e.some((e) => n === "data" ? !0 : e.instance?.path === n || e.path === n) && this.setValue(this.emptyValue);
7939
+ }
7940
+ };
7941
+ }
7942
+ //#endregion
7943
+ //#region src/customComponentFormio/Select/Select.js
7944
+ var pr = e.components.select, mr = class extends fr(pr) {
7945
+ static schema(...e) {
7946
+ return fr(pr).schema(...e);
7947
+ }
7948
+ static editForm(...e) {
7949
+ let t = pr.editForm(...e), n = (t.components?.find((e) => e.key === "tabs"))?.components?.find((e) => e.key === "data");
7950
+ return n?.components && n.components.push(dr), t;
7951
+ }
7903
7952
  attach(e) {
7904
7953
  let t = super.attach(e);
7905
7954
  return (Array.isArray(this.refs.autocompleteInput) ? this.refs.autocompleteInput : [this.refs.autocompleteInput]).forEach((e) => {
7906
7955
  e?.parentNode && e.parentNode.removeChild(e);
7907
7956
  }), t;
7908
7957
  }
7909
- }, pr = {
7958
+ }, hr = {
7910
7959
  pagebreak: _e,
7911
7960
  dynamic_calendar: dt,
7912
7961
  calendar: _t,
@@ -7914,15 +7963,15 @@ var cr = t.Components.components.field, lr = ({ component: e, current: t, onChan
7914
7963
  sdcfile: Yn,
7915
7964
  address_map: ar,
7916
7965
  "list-services": ur,
7917
- select: fr
7966
+ select: mr
7918
7967
  };
7919
- function mr(e) {
7968
+ function gr(e) {
7920
7969
  if (!e || typeof e.addComponent != "function") throw Error("registerFormioComponents requires Formio Components with addComponent(name, component)");
7921
- return Object.entries(pr).forEach(([t, n]) => {
7970
+ return Object.entries(hr).forEach(([t, n]) => {
7922
7971
  e.addComponent(t, n);
7923
- }), pr;
7972
+ }), hr;
7924
7973
  }
7925
7974
  //#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 };
7975
+ 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
7976
 
7928
7977
  //# sourceMappingURL=index.js.map