@devgateway/dvz-ui-react 1.7.4 → 1.7.6

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