@opencitylabs/formio-custom-components 0.7.9 → 0.8.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
@@ -6806,7 +6806,7 @@ var Jn = ({ component: e, current: t, onChange: n, i18next: o }) => {
6806
6806
  return t.conditionallyHidden() || t.visible === !1 ? null : /* @__PURE__ */ i(r, { children: p ? /* @__PURE__ */ a("div", { children: [/* @__PURE__ */ a("label", {
6807
6807
  className: "col-form-label floating-label",
6808
6808
  htmlFor: `${e.id}-${e.key}`,
6809
- children: [e.label, e.validate.required && /* @__PURE__ */ i("span", { className: "text-danger" })]
6809
+ children: [o.t(e.label), e.validate.required && /* @__PURE__ */ i("span", { className: "text-danger" })]
6810
6810
  }), /* @__PURE__ */ a("ul", {
6811
6811
  className: "upload-file-list",
6812
6812
  children: [c.map((e, t) => /* @__PURE__ */ a("li", {
@@ -6844,7 +6844,7 @@ var Jn = ({ component: e, current: t, onChange: n, i18next: o }) => {
6844
6844
  htmlFor: `${e.id}-${e.key}`,
6845
6845
  title: e.tooltip || void 0,
6846
6846
  children: [
6847
- e.label,
6847
+ o.t(e.label),
6848
6848
  e.validate.required && /* @__PURE__ */ i("span", { className: "text-danger" }),
6849
6849
  e.tooltip && /* @__PURE__ */ i("i", {
6850
6850
  tabIndex: 0,
@@ -7956,13 +7956,30 @@ function fr(e) {
7956
7956
  }
7957
7957
  //#endregion
7958
7958
  //#region src/customComponentFormio/Select/Select.js
7959
- var pr = e.components.select, mr = class extends fr(pr) {
7959
+ var pr = e.components.select, mr = {
7960
+ type: "checkbox",
7961
+ input: !0,
7962
+ key: "cacheValues",
7963
+ label: "Cache Values",
7964
+ weight: 26,
7965
+ tooltip: "Cache the fetched values to avoid repeated API calls on every re-render.",
7966
+ defaultValue: !1,
7967
+ conditional: { json: { "===": [{ var: "data.dataSrc" }, "custom"] } }
7968
+ }, hr = class e extends fr(pr) {
7969
+ static _dataCache = /* @__PURE__ */ new Map();
7960
7970
  static schema(...e) {
7961
7971
  return fr(pr).schema(...e);
7962
7972
  }
7963
7973
  static editForm(...e) {
7964
7974
  let t = pr.editForm(...e), n = (t.components?.find((e) => e.key === "tabs"))?.components?.find((e) => e.key === "data");
7965
- return n?.components && n.components.push(dr), t;
7975
+ return n?.components && n.components.push(dr, mr), t;
7976
+ }
7977
+ getCustomItems() {
7978
+ if (!this.component.cacheValues) return super.getCustomItems();
7979
+ let t = this.i18next?.language || "default", n = `${this.component.data?.custom || ""}::${t}`;
7980
+ if (e._dataCache.has(n)) return this.asyncValues = !0, Promise.resolve(e._dataCache.get(n));
7981
+ let r = super.getCustomItems();
7982
+ return r instanceof Promise ? r.then((t) => (e._dataCache.set(n, t), t)) : (e._dataCache.set(n, r), r);
7966
7983
  }
7967
7984
  choicesOptions() {
7968
7985
  let e = this.component.customOptions;
@@ -7992,7 +8009,7 @@ var pr = e.components.select, mr = class extends fr(pr) {
7992
8009
  e?.parentNode && e.parentNode.removeChild(e);
7993
8010
  }), t;
7994
8011
  }
7995
- }, hr = {
8012
+ }, gr = {
7996
8013
  pagebreak: _e,
7997
8014
  dynamic_calendar: dt,
7998
8015
  calendar: _t,
@@ -8000,15 +8017,15 @@ var pr = e.components.select, mr = class extends fr(pr) {
8000
8017
  sdcfile: Yn,
8001
8018
  address_map: ar,
8002
8019
  "list-services": ur,
8003
- select: mr
8020
+ select: hr
8004
8021
  };
8005
- function gr(e) {
8022
+ function _r(e) {
8006
8023
  if (!e || typeof e.addComponent != "function") throw Error("registerFormioComponents requires Formio Components with addComponent(name, component)");
8007
- return Object.entries(hr).forEach(([t, n]) => {
8024
+ return Object.entries(gr).forEach(([t, n]) => {
8008
8025
  e.addComponent(t, n);
8009
- }), hr;
8026
+ }), gr;
8010
8027
  }
8011
8028
  //#endregion
8012
- 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 };
8029
+ export { _t as Calendar, Nt as CalendarAdvanced, ar as FormioAddressMap, dt as FormioDynamicCalendar, ur as FormioListServices, _e as FormioPageBreak, Yn as SdcFile, hr as Select, gr as formioCustomComponents, _r as registerFormioComponents, dr as resetValueOnEditField, fr as withResetValueOn };
8013
8030
 
8014
8031
  //# sourceMappingURL=index.js.map