@devtable/dashboard 13.27.10 → 13.27.12

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.
@@ -6126,7 +6126,7 @@ class vl {
6126
6126
  }), this.instanceRegistry.clear(), this.factoryRegistry.clear();
6127
6127
  }
6128
6128
  }
6129
- const gp = "13.27.10", Cw = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6129
+ const gp = "13.27.12", Cw = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6130
6130
  __proto__: null,
6131
6131
  version: gp
6132
6132
  }, Symbol.toStringTag, { value: "Module" }));
@@ -27487,13 +27487,13 @@ const V$ = ({
27487
27487
  const s = lt(), a = !!t.options_query_id, {
27488
27488
  state: o,
27489
27489
  error: l
27490
- } = s.getDataStuffByID(t.options_query_id), c = o === "loading", d = t.min_width ? t.min_width : "200px", u = a ? c : !1, h = (p) => i(p, !1);
27490
+ } = s.getDataStuffByID(t.options_query_id), c = o === "loading", d = t.min_width ? t.min_width : "200px", u = a ? c : !1, h = T(() => t.initialSelection(n), [n, t.initialSelection]), p = (m) => i(m, !1);
27491
27491
  return /* @__PURE__ */ r.jsx(q$, { label: e, options: t.options, style: {
27492
27492
  minWidth: "160px",
27493
27493
  width: d,
27494
27494
  maxWidth: u ? d : "unset",
27495
27495
  borderColor: "#e9ecef"
27496
- }, disabled: u, value: n, onChange: h, errorMessage: l, required: t.required });
27496
+ }, disabled: u, value: [...h], onChange: p, errorMessage: l, required: t.required });
27497
27497
  }), W$ = pe(({
27498
27498
  label: e,
27499
27499
  description: t,
@@ -28655,6 +28655,14 @@ const gP = x.model("FilterDateRangeConfigMeta", {
28655
28655
  return !!e.options_query_id;
28656
28656
  }
28657
28657
  })).views((e) => ({
28658
+ get optionsLoading() {
28659
+ if (!e.usingQuery)
28660
+ return !1;
28661
+ const {
28662
+ state: t
28663
+ } = e.contentModel.getDataStuffByID(e.options_query_id);
28664
+ return t === "loading";
28665
+ },
28658
28666
  get options() {
28659
28667
  if (!e.usingQuery)
28660
28668
  return e.static_options;
@@ -28705,8 +28713,12 @@ const gP = x.model("FilterDateRangeConfigMeta", {
28705
28713
  default_selection_count: l
28706
28714
  });
28707
28715
  },
28708
- get default_selection() {
28709
- return e.usingQuery ? e.options.slice(0, e.default_selection_count).map((t) => t.value) : e.filter.formattedDefaultValue;
28716
+ get defaultSelection() {
28717
+ const t = e.filter.formattedDefaultValue;
28718
+ return Array.isArray(t) && t.length > 0 || !e.usingQuery ? t : e.options.slice(0, e.default_selection_count).map((n) => n.value);
28719
+ },
28720
+ initialSelection(t) {
28721
+ return t || this.defaultSelection;
28710
28722
  },
28711
28723
  truthy(t) {
28712
28724
  return Array.isArray(t) && t.length > 0;
@@ -28719,12 +28731,14 @@ const gP = x.model("FilterDateRangeConfigMeta", {
28719
28731
  e.min_width = t;
28720
28732
  },
28721
28733
  setDefaultSelection() {
28722
- const t = ft(e).content.filters, n = et(e).key, i = new Set(e.options.map((a) => a.value)), s = (t.values[n] ?? []).filter((a) => i.has(a));
28723
- s.length > 0 ? t.setValueByKey(n, s) : t.setValueByKey(n, e.default_selection);
28734
+ if (e.optionsLoading)
28735
+ return;
28736
+ const t = ft(e).content.filters, n = et(e).key, i = new Set(e.options.map((o) => o.value)), a = (t.values[n] ?? []).filter((o) => i.has(o));
28737
+ a.length > 0 ? (console.debug(`setting filter[${e.filter.key}] to validValues: `, JSON.stringify(a)), t.setValueByKey(n, a)) : (console.debug(`setting filter[${e.filter.key}] to default: `, JSON.stringify(e.defaultSelection)), t.setValueByKey(n, e.defaultSelection));
28724
28738
  }
28725
28739
  })).actions((e) => ({
28726
28740
  afterCreate() {
28727
- dn(e, Bt(() => Qn(e.default_selection), e.setDefaultSelection, {
28741
+ dn(e, Bt(() => Qn(e.defaultSelection), e.setDefaultSelection, {
28728
28742
  fireImmediately: !0,
28729
28743
  delay: 0
28730
28744
  }));
@@ -29818,13 +29832,13 @@ const _x = x.model("FiltersRenderModel", {
29818
29832
  }
29819
29833
  })).actions((e) => ({
29820
29834
  setValues(t) {
29821
- e.values = t;
29835
+ console.debug("setting filter values: ", JSON.stringify(t)), e.values = t;
29822
29836
  },
29823
29837
  patchValues(t) {
29824
29838
  e.values = C.defaults({}, t, e.values);
29825
29839
  },
29826
29840
  setValueByKey(t, n) {
29827
- e.values = {
29841
+ console.debug(`setting filter[${t}] to value: `, JSON.stringify(n)), e.values = {
29828
29842
  ...e.values,
29829
29843
  [t]: n
29830
29844
  };