@devgateway/dvz-ui-react 1.7.3 → 1.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.
@@ -1,57 +1,58 @@
1
- import { Config as h } from "../../conf/index.js";
2
- import { get as y } from "../../api/commons.js";
3
- function f(n) {
4
- return JSON.parse(JSON.stringify(n));
1
+ import { Config as C } from "../../conf/index.js";
2
+ import { get as O } from "../../api/commons.js";
3
+ function g(e) {
4
+ return JSON.parse(JSON.stringify(e));
5
5
  }
6
- const p = process.env.VITE_REACT_APP_API_ROOT || h.REACT_APP_API_ROOT || null, C = typeof window < "u" ? window.location.origin : "", g = {}, l = {}, q = 3 * 60 * 1e3;
7
- function P(n) {
8
- return Object.keys(n).map((t) => encodeURIComponent(t) + "=" + encodeURIComponent(n[t])).join("&");
6
+ const u = process.env.VITE_REACT_APP_API_ROOT || C.REACT_APP_API_ROOT || null, T = typeof window < "u" ? window.location.origin : "", d = {}, l = {}, E = 3 * 60 * 1e3;
7
+ function $(e) {
8
+ return Object.keys(e).map((t) => encodeURIComponent(t) + "=" + encodeURIComponent(e[t])).join("&");
9
9
  }
10
- function $(n, t = !1) {
11
- const e = n, r = Date.now();
12
- if (l[e] && r - l[e].timestamp < q)
13
- return Promise.resolve(f(l[e].data));
14
- if (g[e])
15
- return g[e].then(f);
16
- const u = y(n, {}, t).then((c) => (l[e] = { data: c, timestamp: Date.now() }, t ? { data: f(c), meta: l[e].meta } : f(c))).finally(() => {
17
- delete g[e];
10
+ function h(e, t = !1) {
11
+ const n = e, o = Date.now();
12
+ if (l[n] && o - l[n].timestamp < E)
13
+ return Promise.resolve(g(l[n].data));
14
+ if (d[n])
15
+ return d[n].then(g);
16
+ const f = O(e, {}, t).then((a) => (l[n] = { data: a, timestamp: Date.now() }, t ? { data: g(a), meta: l[n].meta } : g(a))).finally(() => {
17
+ delete d[n];
18
18
  });
19
- return g[e] = u, u;
19
+ return d[n] = f, f;
20
20
  }
21
- const j = ({ app: n, params: t }) => {
22
- const e = `${p || C}/api/${n}/categories${t ? "?" + P(t) : ""}`;
23
- return $(e);
24
- }, D = ({ app: n, type: t, params: e }) => {
25
- const r = `${p || ""}/api/${n}/categories/${t}${e ? "?" + P(e) : ""}`;
26
- return console.log("categories==>", r), $(r);
27
- }, b = ({ source: n, app: t, params: e }) => {
28
- const r = `${p || C}/api/${t}/stats/${n}${e ? "?" + P(e) : ""}`;
29
- return $(r);
30
- }, k = ({ postType: n, taxonomy: t, category: e, taxonomyFilters: r, before: u, perPage: c, page: O, locale: T, after: m, ordering: _, orderingDirection: R }) => {
31
- const w = `${h.REACT_APP_WP_API}/wp/v2/${n}`, o = new URLSearchParams(), d = /* @__PURE__ */ new Map(), S = (s, i) => {
21
+ const k = ({ app: e, params: t }) => {
22
+ const n = `${u || T}/api/${e}/categories${t ? "?" + $(t) : ""}`;
23
+ return h(n);
24
+ }, V = ({ app: e, type: t, params: n }) => {
25
+ const o = `${u || ""}/api/${e}/categories/${t}${n ? "?" + $(n) : ""}`;
26
+ return h(o);
27
+ }, J = ({ source: e, app: t, params: n }) => {
28
+ const o = `${u || T}/api/${t}/stats/${e}${n ? "?" + $(n) : ""}`;
29
+ return h(o);
30
+ }, L = ({ postType: e, taxonomy: t, category: n, taxonomyFilters: o, before: f, perPage: a, page: _, locale: R, after: m, ordering: I, orderingDirection: q, wpApiBase: p }) => {
31
+ const S = p != null && p !== "" ? p : C.REACT_APP_WP_API;
32
+ console.log("Using API base:", S);
33
+ const U = `${S}/wp/v2/${e}`, r = new URLSearchParams(), P = /* @__PURE__ */ new Map(), A = (s, i) => {
32
34
  if (!s || i == null) return;
33
- const a = d.get(s) || [];
34
- Array.isArray(i) ? i.forEach((A) => {
35
- A != null && a.push(String(A));
36
- }) : a.push(String(i)), d.set(s, a);
35
+ const c = P.get(s) || [];
36
+ Array.isArray(i) ? i.forEach((y) => {
37
+ y != null && c.push(String(y));
38
+ }) : c.push(String(i)), P.set(s, c);
37
39
  };
38
- r && r instanceof Map && r.forEach((s, i) => {
39
- S(i, s);
40
- }), t && e != null && S(t, e), d.forEach((s, i) => {
41
- const a = Array.from(new Set(s));
42
- a.length !== 0 && o.set(i, a.join(","));
43
- }), u && o.append("before", u.toISOString()), c && o.append("per_page", c.toString()), o.append("page", O.toString()), o.append("locale", T), m && o.append("after", m.toISOString()), o.append("orderby", _), o.append("order", R);
44
- const I = o.toString().replace(/%2C/g, ",");
45
- return y(`${w}?${I}`, {
40
+ o && o instanceof Map && o.forEach((s, i) => {
41
+ A(i, s);
42
+ }), t && n != null && A(t, n), P.forEach((s, i) => {
43
+ const c = Array.from(new Set(s));
44
+ c.length !== 0 && r.set(i, c.join(","));
45
+ }), f && r.append("before", f.toISOString()), a && r.append("per_page", a.toString()), r.append("page", _.toString()), r.append("locale", R), m && r.append("after", m.toISOString()), r.append("orderby", I), r.append("order", q);
46
+ const w = r.toString().replace(/%2C/g, ",");
47
+ return O(`${U}?${w}`, {
46
48
  headers: {
47
49
  "Content-Type": "application/json"
48
- },
49
- credentials: "include"
50
+ }
50
51
  }, !0);
51
52
  };
52
53
  export {
53
- j as getCategories,
54
- D as getCategory,
55
- k as getCustomPosts,
56
- b as getData
54
+ k as getCategories,
55
+ V as getCategory,
56
+ L as getCustomPosts,
57
+ J as getData
57
58
  };
@@ -1,61 +1,61 @@
1
- import { getData as q, getCategory as J, getCategories as j } from "./data-api.js";
2
- import * as m from "immutable";
3
- import H from "papaparse";
4
- const y = "LOAD_DATA", T = "LOAD_DATA_DONE", D = "LOAD_DATA_ERROR", R = "LOAD_CATEGORIES", L = "LOAD_CATEGORIES_DONE", O = "LOAD_CATEGORIES_ERROR", F = "SET_PAGE_MODULE_PROPS", h = "RELOAD_CHILD_FILTER_ITEMS", N = "SET_FILTER", V = "SET_FILTERS", C = "SET_INITIAL_FILTER", P = "SET_APPLY", w = "CLEAN_FILTER", M = "UNSET_FILTER", Y = m.Map({ mode: "info" }), v = "SET_MEASURES", U = "CLEAN_MEASURES", K = ({ app: r, group: a }) => (s, e) => {
5
- s({ type: U, app: r, group: a });
6
- }, Q = ({ app: r, group: a, mGroup: s }) => (e, t) => {
7
- const o = Object.keys(s.measures).filter((l) => s.measures[l].selected), n = { ...s };
8
- n[r] = { measures: {} }, o.forEach((l) => {
9
- n[r].measures[l] = { ...s.measures[l] };
10
- }), n[r].format = s.format, e({ type: v, app: r, group: a, measure: n });
11
- }, W = ({ app: r, type: a, group: s, param: e, autoApply: t, params: o, parentParam: n, parentType: l, parentSelectedItems: i, uniqueStorage: g, dvzProxyDatasetId: p }) => (c, I) => {
1
+ import { getData as J, getCategory as j, getCategories as H } from "./data-api.js";
2
+ import * as A from "immutable";
3
+ import V from "papaparse";
4
+ const y = "LOAD_DATA", m = "LOAD_DATA_DONE", O = "LOAD_DATA_ERROR", R = "LOAD_CATEGORIES", L = "LOAD_CATEGORIES_DONE", D = "LOAD_CATEGORIES_ERROR", F = "SET_PAGE_MODULE_PROPS", h = "RELOAD_CHILD_FILTER_ITEMS", N = "SET_FILTER", Y = "SET_FILTERS", P = "SET_INITIAL_FILTER", C = "SET_APPLY", w = "CLEAN_FILTER", M = "UNSET_FILTER", $ = A.Map({ mode: "info" }), v = "SET_MEASURES", U = "CLEAN_MEASURES", B = "SET_POSTS_PAGINATION", K = "SET_POSTS_FILTER", b = "SET_INITIAL_POSTS_FILTER", X = ({ app: r, group: n }) => (s, e) => {
5
+ s({ type: U, app: r, group: n });
6
+ }, Z = ({ app: r, group: n, mGroup: s }) => (e, t) => {
7
+ const o = Object.keys(s.measures).filter((l) => s.measures[l].selected), a = { ...s };
8
+ a[r] = { measures: {} }, o.forEach((l) => {
9
+ a[r].measures[l] = { ...s.measures[l] };
10
+ }), a[r].format = s.format, e({ type: v, app: r, group: n, measure: a });
11
+ }, k = ({ app: r, type: n, group: s, param: e, autoApply: t, params: o, parentParam: a, parentType: l, parentSelectedItems: p, uniqueStorage: g, dvzProxyDatasetId: i }) => (c, I) => {
12
12
  const E = { ...o };
13
- E[n] = i, J({ app: r, params: E, type: a }).then(
13
+ E[a] = p, j({ app: r, params: E, type: n }).then(
14
14
  (f) => {
15
15
  c({
16
16
  type: h,
17
- filterType: a,
17
+ filterType: n,
18
18
  parentType: l,
19
19
  param: e,
20
20
  app: r,
21
21
  group: s,
22
22
  data: f,
23
23
  uniqueStorage: g,
24
- dvzProxyDatasetId: p,
24
+ dvzProxyDatasetId: i,
25
25
  autoApply: t
26
26
  });
27
27
  }
28
28
  );
29
- }, X = (r) => (a, s) => {
30
- const { app: e, group: t, param: o, value: n, autoApply: l, parent: i } = r;
31
- console.log("set filters"), a({ type: N, app: e, group: t, param: o, value: n, autoApply: l, parent: i });
32
- }, Z = ({ app: r, group: a }) => (s, e) => {
33
- s({ type: w, app: r, group: a });
34
- }, k = ({ app: r, group: a, param: s, parent: e }) => (t, o) => {
35
- t({ type: M, app: r, group: a, param: s, parent: e });
36
- }, ee = ({ app: r, group: a }) => (s, e) => {
37
- s({ type: P, app: r, group: a });
38
- }, te = ({ app: r, group: a, param: s, value: e }) => (t, o) => {
39
- t({ type: C, app: r, group: a, param: s, value: e });
40
- }, se = (r) => (a, s) => {
41
- const { app: e, params: t, dvzProxyDatasetId: o, uniqueStorage: n } = r;
42
- a({ type: R, params: t, app: e, uniqueStorage: n, dvzProxyDatasetId: o }), j({ app: e, params: t }).then((l) => (l.appliedFilters = t, a({
29
+ }, ee = (r) => (n, s) => {
30
+ const { app: e, group: t, param: o, value: a, autoApply: l, parent: p } = r;
31
+ console.log("set filters"), n({ type: N, app: e, group: t, param: o, value: a, autoApply: l, parent: p });
32
+ }, te = ({ app: r, group: n }) => (s, e) => {
33
+ s({ type: w, app: r, group: n });
34
+ }, se = ({ app: r, group: n, param: s, parent: e }) => (t, o) => {
35
+ t({ type: M, app: r, group: n, param: s, parent: e });
36
+ }, re = ({ app: r, group: n }) => (s, e) => {
37
+ s({ type: C, app: r, group: n });
38
+ }, ne = ({ app: r, group: n, param: s, value: e }) => (t, o) => {
39
+ t({ type: P, app: r, group: n, param: s, value: e });
40
+ }, ae = (r) => (n, s) => {
41
+ const { app: e, params: t, dvzProxyDatasetId: o, uniqueStorage: a } = r;
42
+ n({ type: R, params: t, app: e, uniqueStorage: a, dvzProxyDatasetId: o }), H({ app: e, params: t }).then((l) => (l.appliedFilters = t, n({
43
43
  type: L,
44
44
  app: e,
45
45
  data: l,
46
- uniqueStorage: n,
46
+ uniqueStorage: a,
47
47
  dvzProxyDatasetId: o
48
- }))).catch((l) => a({
49
- type: O,
48
+ }))).catch((l) => n({
49
+ type: D,
50
50
  app: e,
51
- uniqueStorage: n,
51
+ uniqueStorage: a,
52
52
  error: l,
53
53
  dvzProxyDatasetId: o
54
54
  }));
55
- }, re = ({ app: r, group: a, csv: s, store: e, params: t }) => (o, n) => {
56
- const l = n().get("data").getIn(["filters", r, a]);
55
+ }, oe = ({ app: r, group: n, csv: s, store: e, params: t }) => (o, a) => {
56
+ const l = a().get("data").getIn(["filters", r, n]);
57
57
  l ? t = { ...t, ...l.toJS() } : t = t || {};
58
- const i = H.parse(s, { header: !0, dynamicTyping: !0 }), g = i.data.filter((c) => {
58
+ const p = V.parse(s, { header: !0, dynamicTyping: !0 }), g = p.data.filter((c) => {
59
59
  let I = !1;
60
60
  return Object.keys(t).forEach((E) => {
61
61
  const f = t[E];
@@ -64,95 +64,107 @@ const y = "LOAD_DATA", T = "LOAD_DATA_DONE", D = "LOAD_DATA_ERROR", R = "LOAD_CA
64
64
  I = f.filter((_) => _ && _.toString().trim().toLowerCase() == S).length == 0;
65
65
  }
66
66
  }), !I;
67
- }), p = { ...i, data: g, appliedFilters: t };
68
- o({ type: T, app: r, group: a, store: e, data: { count: p.data.length, itemsSize: p.data.length, ...p } });
69
- }, ne = (r) => (a, s) => {
70
- const { app: e, group: t, source: o, store: n, params: l, parent: i } = r;
67
+ }), i = { ...p, data: g, appliedFilters: t };
68
+ o({ type: m, app: r, group: n, store: e, data: { count: i.data.length, itemsSize: i.data.length, ...i } });
69
+ }, le = (r) => (n, s) => {
70
+ const { app: e, group: t, source: o, store: a, params: l, parent: p } = r;
71
71
  let g = s().get("data").getIn(["filters", e, t]);
72
- i && l && Object.keys(l).forEach((I) => {
72
+ p && l && Object.keys(l).forEach((I) => {
73
73
  if (g && g.has(I)) {
74
74
  let E = l[I], S = g.get(I).filter((_) => E.indexOf(_) > -1);
75
75
  g = g.set(I, S);
76
76
  }
77
77
  });
78
- let p = { ...l };
79
- g && (p = { ...p, ...g.toJS() }), a({ type: y, app: e, group: t, params: p, store: n }), q({ app: e, source: o, params: p }).then((c) => (c.appliedFilters = p, a({ type: T, app: e, group: t, store: n, data: c, params: p }))).catch((c) => a({ type: D, app: e, group: t, store: n, error: c }));
80
- }, ae = ({ data: r }) => (a, s) => {
81
- a({ type: F, data: r });
82
- }, oe = (r = Y, a) => {
83
- switch (a.type) {
78
+ let i = { ...l };
79
+ g && (i = { ...i, ...g.toJS() }), n({ type: y, app: e, group: t, params: i, store: a }), J({ app: e, source: o, params: i }).then((c) => (c.appliedFilters = i, n({ type: m, app: e, group: t, store: a, data: c, params: i }))).catch((c) => n({ type: O, app: e, group: t, store: a, error: c }));
80
+ }, pe = ({ data: r }) => (n, s) => {
81
+ n({ type: F, data: r });
82
+ }, ie = (r = $, n) => {
83
+ switch (n.type) {
84
84
  case y: {
85
- const { store: s, app: e, group: t, params: o } = a, n = Date.now();
86
- return r.deleteIn([...s, "error"]).setIn([...s, "loading"], !0).setIn([...s, "time"], n).setIn([...s, "presetFilter"], o);
85
+ const { store: s, app: e, group: t, params: o } = n, a = Date.now();
86
+ return r.deleteIn([...s, "error"]).setIn([...s, "loading"], !0).setIn([...s, "time"], a).setIn([...s, "presetFilter"], o);
87
87
  }
88
- case D: {
89
- const { error: s, store: e, app: t, group: o } = a;
88
+ case O: {
89
+ const { error: s, store: e, app: t, group: o } = n;
90
90
  return r.setIn([...e, "loading"], !1).setIn([...e, "error"], s).setIn(["filters-settings", t, o, "apply"], null);
91
91
  }
92
- case T: {
93
- const { data: s, app: e, group: t, store: o } = a;
92
+ case m: {
93
+ const { data: s, app: e, group: t, store: o } = n;
94
94
  return r.setIn([...o, "loading"], !1).deleteIn([...o, "error"]).setIn([...o, "data"], s).setIn(["filters-settings", e, t, "apply"], null);
95
95
  }
96
96
  case F: {
97
- const { data: s } = a;
97
+ const { data: s } = n;
98
98
  return r.setIn(["pageModuleProps"], s);
99
99
  }
100
100
  case R: {
101
- const { data: s, app: e, uniqueStorage: t, dvzProxyDatasetId: o } = a, n = ["categories", e];
102
- return t && n.push(t), o && n.push(o), r.setIn([...n, "loading"], !0).deleteIn([...n, "error"]);
101
+ const { data: s, app: e, uniqueStorage: t, dvzProxyDatasetId: o } = n, a = ["categories", e];
102
+ return t && a.push(t), o && a.push(o), r.setIn([...a, "loading"], !0).deleteIn([...a, "error"]);
103
103
  }
104
104
  case L: {
105
- const { data: s, app: e, uniqueStorage: t, dvzProxyDatasetId: o } = a, n = ["categories", e];
106
- return o && n.push(o), t && n.push(t), r.setIn([...n, "loading"], !1).setIn([...n, "items"], m.fromJS(s));
105
+ const { data: s, app: e, uniqueStorage: t, dvzProxyDatasetId: o } = n, a = ["categories", e];
106
+ return o && a.push(o), t && a.push(t), r.setIn([...a, "loading"], !1).setIn([...a, "items"], A.fromJS(s));
107
107
  }
108
- case O: {
109
- const { data: s, app: e, uniqueStorage: t, dvzProxyDatasetId: o } = a, n = ["categories", e];
110
- return t && n.push(t), o && n.push(o), r.setIn([...n, "loading"], !1).setIn([...n, "error"], s);
108
+ case D: {
109
+ const { data: s, app: e, uniqueStorage: t, dvzProxyDatasetId: o } = n, a = ["categories", e];
110
+ return t && a.push(t), o && a.push(o), r.setIn([...a, "loading"], !1).setIn([...a, "error"], s);
111
111
  }
112
- case P: {
113
- const { app: s, group: e } = a;
112
+ case C: {
113
+ const { app: s, group: e } = n;
114
114
  return r.setIn(["filters-settings", s, e, "apply"], (/* @__PURE__ */ new Date()).getTime());
115
115
  }
116
116
  case N: {
117
- const s = Date.now(), { app: e, group: t, param: o, value: n, autoApply: l, parent: i } = a;
118
- return r.setIn(["filters-settings", e, t, "autoApply"], l).setIn(["filters", e, t, o], n.length === 0 ? [Number.MIN_SAFE_INTEGER] : n).setIn(["filters-settings", e, t, "apply"], null).setIn(["filters-settings", e, t, "lastUserFilterChange"], s).setIn(["filters-settings", e, t, "parent"], i || null);
117
+ const s = Date.now(), { app: e, group: t, param: o, value: a, autoApply: l, parent: p } = n;
118
+ return r.setIn(["filters-settings", e, t, "autoApply"], l).setIn(["filters", e, t, o], a.length === 0 ? [Number.MIN_SAFE_INTEGER] : a).setIn(["filters-settings", e, t, "apply"], null).setIn(["filters-settings", e, t, "lastUserFilterChange"], s).setIn(["filters-settings", e, t, "parent"], p || null);
119
119
  }
120
- case V: {
121
- const s = Date.now(), { app: e, group: t, filters: o, autoApply: n } = a;
122
- return r.setIn(["filters-settings", e, t, "autoApply"], n).setIn(["filters", e, t, param], value.length === 0 ? [Number.MIN_SAFE_INTEGER] : value).setIn(["filters-settings", e, t, "apply"], null).setIn(["filters-settings", e, t, "lastUserFilterChange"], s);
120
+ case Y: {
121
+ const s = Date.now(), { app: e, group: t, filters: o, autoApply: a } = n;
122
+ return r.setIn(["filters-settings", e, t, "autoApply"], a).setIn(["filters", e, t, param], value.length === 0 ? [Number.MIN_SAFE_INTEGER] : value).setIn(["filters-settings", e, t, "apply"], null).setIn(["filters-settings", e, t, "lastUserFilterChange"], s);
123
123
  }
124
124
  case h: {
125
- const { data: s, app: e, group: t, param: o, uniqueStorage: n, dvzProxyDatasetId: l, filterType: i, parentType: g, autoApply: p } = a, c = Date.now(), I = ["categories", e];
126
- l && I.push(l), n && I.push(n);
127
- const E = s.filter((u) => u.type == i), S = r.getIn([...I, "items"]).filter((u) => u.get("type") == i).get(0).get("items").map((u) => u.value), b = r.getIn([...I, "items"]).filter((u) => u.get("type") != i).push(m.Map(E[0])), x = r.getIn(["filters", e, t, o]), d = s[0].items.map((u) => u.value), G = x.filter((u) => d.indexOf(u) > -1), z = d.filter((u) => S.indexOf(u) == -1), A = Array.from(/* @__PURE__ */ new Set([...G, ...z]));
128
- return r.setIn([...I, "items"], b).setIn(["filters", e, t, o], Array.from(A)).setIn(["filters-settings", e, t, "autoApply"], p).setIn(["filters", e, t, o], A.length === 0 ? [Number.MIN_SAFE_INTEGER] : A).setIn(["filters-settings", e, t, "apply"], null).setIn(["filters-settings", e, t, "lastUserFilterChange"], c);
125
+ const { data: s, app: e, group: t, param: o, uniqueStorage: a, dvzProxyDatasetId: l, filterType: p, parentType: g, autoApply: i } = n, c = Date.now(), I = ["categories", e];
126
+ l && I.push(l), a && I.push(a);
127
+ const E = s.filter((u) => u.type == p), S = r.getIn([...I, "items"]).filter((u) => u.get("type") == p).get(0).get("items").map((u) => u.value), G = r.getIn([...I, "items"]).filter((u) => u.get("type") != p).push(A.Map(E[0])), x = r.getIn(["filters", e, t, o]), d = s[0].items.map((u) => u.value), z = x.filter((u) => d.indexOf(u) > -1), q = d.filter((u) => S.indexOf(u) == -1), T = Array.from(/* @__PURE__ */ new Set([...z, ...q]));
128
+ return r.setIn([...I, "items"], G).setIn(["filters", e, t, o], Array.from(T)).setIn(["filters-settings", e, t, "autoApply"], i).setIn(["filters", e, t, o], T.length === 0 ? [Number.MIN_SAFE_INTEGER] : T).setIn(["filters-settings", e, t, "apply"], null).setIn(["filters-settings", e, t, "lastUserFilterChange"], c);
129
129
  }
130
- case C: {
131
- const s = Date.now(), { app: e, group: t, param: o, value: n } = a;
132
- return r.setIn(["filters", "initial", e, t, o], n.length === 0 ? [Number.MIN_SAFE_INTEGER] : n).setIn(["filters", e, t, o], n.length === 0 ? [Number.MIN_SAFE_INTEGER] : n).setIn(["filters-settings", e, t, "lastInitialFilterChange"], s).setIn(["filters-settings", e, t, "lastUserFilterChange"], s);
130
+ case P: {
131
+ const s = Date.now(), { app: e, group: t, param: o, value: a } = n;
132
+ return r.setIn(["filters", "initial", e, t, o], a.length === 0 ? [Number.MIN_SAFE_INTEGER] : a).setIn(["filters", e, t, o], a.length === 0 ? [Number.MIN_SAFE_INTEGER] : a).setIn(["filters-settings", e, t, "lastInitialFilterChange"], s).setIn(["filters-settings", e, t, "lastUserFilterChange"], s);
133
133
  }
134
134
  case M: {
135
- const s = Date.now(), { app: e, group: t, param: o, parent: n } = a;
136
- return r.deleteIn(["filters", e, t, o]).setIn(["filters-settings", e, t, "lastUserFilterChange"], s).setIn(["filters-settings", e, t, "parent"], n || null);
135
+ const s = Date.now(), { app: e, group: t, param: o, parent: a } = n;
136
+ return r.deleteIn(["filters", e, t, o]).setIn(["filters-settings", e, t, "lastUserFilterChange"], s).setIn(["filters-settings", e, t, "parent"], a || null);
137
137
  }
138
138
  case w: {
139
- const { app: s, group: e } = a, t = r.getIn(["filters", "initial", s, e]);
139
+ const { app: s, group: e } = n, t = r.getIn(["filters", "initial", s, e]);
140
140
  return r.setIn(["filters", s, e], t);
141
141
  }
142
142
  case v: {
143
- const { app: s, group: e, measure: t } = a;
143
+ const { app: s, group: e, measure: t } = n;
144
144
  return r.setIn(["measures", s, e], t);
145
145
  }
146
146
  case U: {
147
- const { app: s, group: e, measure: t } = a;
147
+ const { app: s, group: e, measure: t } = n;
148
148
  return r.deleteIn(["measures", s, e]);
149
149
  }
150
+ case B: {
151
+ const { group: s, totalPages: e, totalItems: t } = n;
152
+ return r.setIn(["postsPagination", s], { totalPages: e, totalItems: t });
153
+ }
154
+ case K: {
155
+ const { type: s, group: e, ...t } = n;
156
+ return r.setIn(["posts", e], t);
157
+ }
158
+ case b: {
159
+ const { type: s, group: e, ...t } = n;
160
+ return r.setIn(["posts", e], t).setIn(["posts", "initialFilters", e], t);
161
+ }
150
162
  default:
151
163
  return r;
152
164
  }
153
- }, le = ({ group: r, dispatch: a, initialFilters: s }) => {
154
- a({
155
- type: SET_INITIAL_POSTS_FILTER,
165
+ }, Ie = ({ group: r, dispatch: n, initialFilters: s }) => {
166
+ n({
167
+ type: b,
156
168
  group: r,
157
169
  ...s,
158
170
  reset: !0,
@@ -160,18 +172,18 @@ const y = "LOAD_DATA", T = "LOAD_DATA_DONE", D = "LOAD_DATA_ERROR", R = "LOAD_CA
160
172
  });
161
173
  };
162
174
  export {
163
- ee as applyFilter,
164
- Z as cleanFilter,
165
- K as cleanMeasures,
166
- le as clearPostsFilter,
167
- oe as default,
168
- se as getCategories,
169
- ne as getData,
170
- W as loadFilterItems,
171
- re as setData,
172
- X as setFilter,
173
- te as setInitialFilters,
174
- Q as setMeasures,
175
- ae as setPageModuleProps,
176
- k as unsetFilter
175
+ re as applyFilter,
176
+ te as cleanFilter,
177
+ X as cleanMeasures,
178
+ Ie as clearPostsFilter,
179
+ ie as default,
180
+ ae as getCategories,
181
+ le as getData,
182
+ k as loadFilterItems,
183
+ oe as setData,
184
+ ee as setFilter,
185
+ ne as setInitialFilters,
186
+ Z as setMeasures,
187
+ pe as setPageModuleProps,
188
+ se as unsetFilter
177
189
  };
@@ -1,6 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  interface NoDataProps {
3
3
  noDataMsg?: string;
4
+ clearFilterMsg?: string;
4
5
  editing?: boolean;
5
6
  group: string;
6
7
  }
@@ -14,6 +14,10 @@ interface FilteredPostsProps extends WrappedComponentProps {
14
14
  "data-sort-first-by": number | string;
15
15
  "data-sorting-type": string;
16
16
  "data-sorting-taxonomy": string;
17
+ "data-wordpress-source-type"?: string;
18
+ "data-wordpress-source"?: string;
19
+ "data-no-data-msg"?: string;
20
+ "data-clear-filter-msg"?: string;
17
21
  editing?: boolean;
18
22
  }
19
23
  declare const _default: React.FC<import('react-intl').WithIntlProps<FilteredPostsProps>> & {
@@ -6,4 +6,5 @@ declare function getStartDateAndEndDateFromYear(year: number): {
6
6
  endDate: Date;
7
7
  };
8
8
  declare function getYearsToDisplay(): Promise<unknown>;
9
- export { getStartDateAndEndDateFromYear, getYearsToDisplay };
9
+ declare function resolveWpApiBase(wordpressSourceType: string | undefined, wordpressSource: string | undefined): Promise<string | null>;
10
+ export { getStartDateAndEndDateFromYear, getYearsToDisplay, resolveWpApiBase };
@@ -4,6 +4,7 @@ interface CategoricalFilterProps extends PostFilterDropdownProps {
4
4
  taxonomies?: any[] | null;
5
5
  type?: string;
6
6
  categories?: any[] | null;
7
+ wpApiBase?: string;
7
8
  }
8
9
  declare const CategoricalFilter: (props: CategoricalFilterProps) => React.JSX.Element;
9
10
  export default CategoricalFilter;
@@ -21,6 +21,8 @@ interface PostsFilterProps {
21
21
  "data-type"?: string;
22
22
  "data-sort-first-by"?: string;
23
23
  "data-default-values"?: string;
24
+ "data-wordpress-source-type"?: string;
25
+ "data-wordpress-source"?: string;
24
26
  editing?: boolean;
25
27
  }
26
28
  declare const PostsFilter: (props: PostsFilterProps) => React.JSX.Element;
@@ -12,7 +12,7 @@ export function getData({ source, app, params }: {
12
12
  app: any;
13
13
  params: any;
14
14
  }): any;
15
- export function getCustomPosts({ postType, taxonomy, category, taxonomyFilters, before, perPage, page, locale, after, ordering, orderingDirection }: {
15
+ export function getCustomPosts({ postType, taxonomy, category, taxonomyFilters, before, perPage, page, locale, after, ordering, orderingDirection, wpApiBase }: {
16
16
  postType: any;
17
17
  taxonomy: any;
18
18
  category: any;
@@ -24,4 +24,5 @@ export function getCustomPosts({ postType, taxonomy, category, taxonomyFilters,
24
24
  after: any;
25
25
  ordering: any;
26
26
  orderingDirection: any;
27
+ wpApiBase: any;
27
28
  }): Promise<unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",