@devgateway/dvz-ui-react 1.6.1 → 1.6.3
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/cjs/common.css +1 -1
- package/dist/cjs/embeddable/chart/Bar.js +1 -1
- package/dist/cjs/embeddable/chart/Line.js +1 -1
- package/dist/cjs/embeddable/chart/Pie.js +1 -1
- package/dist/cjs/embeddable/filter/index.js +1 -1
- package/dist/cjs/embeddable/reducers/data.js +1 -1
- package/dist/cjs/layout/Header.js +2 -2
- package/dist/cjs/styles.css +1 -1
- package/dist/esm/common.css +1 -1
- package/dist/esm/embeddable/chart/Bar.js +401 -359
- package/dist/esm/embeddable/chart/Line.js +126 -122
- package/dist/esm/embeddable/chart/Pie.js +101 -100
- package/dist/esm/embeddable/filter/index.js +1 -1
- package/dist/esm/embeddable/reducers/data.js +78 -78
- package/dist/esm/layout/Header.js +1 -1
- package/dist/esm/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,88 +1,89 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as l, useEffect as
|
|
3
|
-
import { injectIntl as
|
|
4
|
-
import { ResponsivePie as
|
|
5
|
-
import
|
|
1
|
+
import { jsx as r, jsxs as p, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useEffect as M } from "react";
|
|
3
|
+
import { injectIntl as pe } from "react-intl";
|
|
4
|
+
import { ResponsivePie as ue } from "@nivo/pie";
|
|
5
|
+
import fe, { formatContent as ge } from "./Tooltip.js";
|
|
6
6
|
import "@nivo/colors";
|
|
7
7
|
import "d3";
|
|
8
|
-
import { v4 as
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import { v4 as he } from "uuid";
|
|
9
|
+
import be from "../../layout/FlexWrapDetector.js";
|
|
10
|
+
import Le from "../../utils/deviceType.js";
|
|
11
|
+
const $ = Le() === "mobile", xe = ({
|
|
12
|
+
legends: ke,
|
|
12
13
|
marginLeft: j,
|
|
13
14
|
marginTop: x,
|
|
14
15
|
marginRight: w,
|
|
15
16
|
marginBottom: k,
|
|
16
17
|
options: u,
|
|
17
|
-
intl:
|
|
18
|
-
format:
|
|
19
|
-
colors:
|
|
20
|
-
groupMode:
|
|
18
|
+
intl: f,
|
|
19
|
+
format: g,
|
|
20
|
+
colors: ve,
|
|
21
|
+
groupMode: Ce,
|
|
21
22
|
tooltipEnabled: B,
|
|
22
23
|
height: I,
|
|
23
24
|
showLegends: v,
|
|
24
|
-
legendPosition:
|
|
25
|
-
tickRotation:
|
|
26
|
-
tickColor:
|
|
27
|
-
tooltip:
|
|
28
|
-
startAngle:
|
|
29
|
-
endAngle:
|
|
25
|
+
legendPosition: a,
|
|
26
|
+
tickRotation: ye,
|
|
27
|
+
tickColor: Ne,
|
|
28
|
+
tooltip: s,
|
|
29
|
+
startAngle: z,
|
|
30
|
+
endAngle: O,
|
|
30
31
|
legendLabel: C,
|
|
31
32
|
legendCheckBack: y,
|
|
32
|
-
legendLabelBack:
|
|
33
|
-
legendLabelColor:
|
|
34
|
-
centerLabel:
|
|
35
|
-
showArcLabels:
|
|
36
|
-
showArcLinkLabels:
|
|
37
|
-
slicePadding:
|
|
33
|
+
legendLabelBack: V,
|
|
34
|
+
legendLabelColor: R,
|
|
35
|
+
centerLabel: H,
|
|
36
|
+
showArcLabels: E,
|
|
37
|
+
showArcLinkLabels: X,
|
|
38
|
+
slicePadding: Y,
|
|
38
39
|
colorGenerator: N,
|
|
39
|
-
centerLabelFontWeight:
|
|
40
|
-
centerLabelFontSize:
|
|
41
|
-
centerLabelXOffset:
|
|
42
|
-
centerLabelYOffset:
|
|
43
|
-
tooltipEnableMarkdown:
|
|
44
|
-
reverseLegend:
|
|
45
|
-
showPercentage:
|
|
40
|
+
centerLabelFontWeight: q,
|
|
41
|
+
centerLabelFontSize: J,
|
|
42
|
+
centerLabelXOffset: K,
|
|
43
|
+
centerLabelYOffset: Q,
|
|
44
|
+
tooltipEnableMarkdown: U,
|
|
45
|
+
reverseLegend: Z,
|
|
46
|
+
showPercentage: _
|
|
46
47
|
}) => {
|
|
47
|
-
const [c,
|
|
48
|
+
const [c, G] = l([]), [P, ee] = l(s), [o, te] = l(u), [S, re] = l(50), [T, ae] = l(x), [Se, A] = l(0), [D, ne] = l(k), d = o.data.sort((e, t) => e.position && t.position ? e.position - t.position : 0).map((e, t) => ({
|
|
48
49
|
color: N.getColor(e.id, e),
|
|
49
50
|
id: e.id,
|
|
50
51
|
label: e.label
|
|
51
52
|
}));
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
M(() => {
|
|
54
|
+
ee(s), te({
|
|
54
55
|
...u,
|
|
55
|
-
id:
|
|
56
|
+
id: he()
|
|
56
57
|
});
|
|
57
|
-
}, [
|
|
58
|
+
}, [s, u]), M(() => {
|
|
58
59
|
(() => {
|
|
59
60
|
const n = 5 * Math.max(d.length - 5, 0);
|
|
60
|
-
|
|
61
|
+
re(n);
|
|
61
62
|
})();
|
|
62
63
|
}, [d]);
|
|
63
|
-
const
|
|
64
|
+
const oe = {
|
|
64
65
|
bottom: `-${S}px`
|
|
65
|
-
},
|
|
66
|
+
}, le = {
|
|
66
67
|
bottom: `-${S}px`,
|
|
67
68
|
gap: "0px"
|
|
68
|
-
},
|
|
69
|
+
}, ie = (e) => {
|
|
69
70
|
const t = c.slice();
|
|
70
71
|
if (t.indexOf(e) > -1) {
|
|
71
72
|
const n = t.indexOf(e);
|
|
72
73
|
t.splice(n, 1);
|
|
73
74
|
} else
|
|
74
75
|
t.push(e);
|
|
75
|
-
|
|
76
|
+
G(t);
|
|
76
77
|
}, se = (e) => c ? e.filter((t) => c.indexOf(t.id) === -1) : e;
|
|
77
78
|
if (!o || !o.data)
|
|
78
79
|
return null;
|
|
79
|
-
const
|
|
80
|
-
top:
|
|
80
|
+
const ce = {
|
|
81
|
+
top: T,
|
|
81
82
|
right: w,
|
|
82
|
-
bottom:
|
|
83
|
+
bottom: D,
|
|
83
84
|
left: j
|
|
84
|
-
},
|
|
85
|
-
/* @__PURE__ */
|
|
85
|
+
}, W = () => /* @__PURE__ */ r(L, { children: v && C && /* @__PURE__ */ r("div", { className: "legend item", children: /* @__PURE__ */ r("label", { className: "legend-title", children: C }) }) }), F = () => (Z && d.reverse(), /* @__PURE__ */ r(L, { children: v && d.map((e) => /* @__PURE__ */ p("div", { className: "legend item", onClick: () => ie(e.id), children: [
|
|
86
|
+
/* @__PURE__ */ r(
|
|
86
87
|
"input",
|
|
87
88
|
{
|
|
88
89
|
className: "ignore",
|
|
@@ -90,7 +91,7 @@ const be = ({
|
|
|
90
91
|
checked: c.length == 0 || !c.includes(e.id)
|
|
91
92
|
}
|
|
92
93
|
),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ r(
|
|
94
95
|
"span",
|
|
95
96
|
{
|
|
96
97
|
className: y ? "checkmark-with-bg" : "checkmark",
|
|
@@ -99,80 +100,80 @@ const be = ({
|
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ r(
|
|
103
104
|
"label",
|
|
104
105
|
{
|
|
105
106
|
style: {
|
|
106
|
-
backgroundColor:
|
|
107
|
-
color:
|
|
107
|
+
backgroundColor: V == !0 ? e.color : "transparent",
|
|
108
|
+
color: R
|
|
108
109
|
},
|
|
109
110
|
children: e.label
|
|
110
111
|
}
|
|
111
112
|
)
|
|
112
|
-
] })) })),
|
|
113
|
-
const { centerX: t, centerY: n } = e,
|
|
113
|
+
] })) })), de = (e) => {
|
|
114
|
+
const { centerX: t, centerY: n } = e, i = H.split(/[\r\n]/g);
|
|
114
115
|
let m = 0;
|
|
115
116
|
return e.dataWithArc && (m = e.dataWithArc.reduce(
|
|
116
|
-
function(
|
|
117
|
-
return
|
|
117
|
+
function(h, b) {
|
|
118
|
+
return h + b.value;
|
|
118
119
|
},
|
|
119
120
|
0
|
|
120
|
-
)), /* @__PURE__ */
|
|
121
|
+
)), /* @__PURE__ */ r(
|
|
121
122
|
"text",
|
|
122
123
|
{
|
|
123
124
|
x: t,
|
|
124
125
|
y: n,
|
|
125
126
|
textAnchor: "start",
|
|
126
127
|
dominantBaseline: "central",
|
|
127
|
-
children:
|
|
128
|
+
children: i.map((h, b) => /* @__PURE__ */ r(
|
|
128
129
|
"tspan",
|
|
129
130
|
{
|
|
130
|
-
x: t + parseInt(
|
|
131
|
-
y: n + parseInt(
|
|
131
|
+
x: t + parseInt(K),
|
|
132
|
+
y: n + parseInt(Q) + b * 20,
|
|
132
133
|
style: {
|
|
133
|
-
fontSize:
|
|
134
|
-
fontWeight:
|
|
134
|
+
fontSize: J + "px",
|
|
135
|
+
fontWeight: q,
|
|
135
136
|
fill: "#000"
|
|
136
137
|
},
|
|
137
|
-
children:
|
|
138
|
+
children: ge(h, { totalValue: m }, f)
|
|
138
139
|
}
|
|
139
140
|
))
|
|
140
141
|
}
|
|
141
142
|
);
|
|
142
|
-
},
|
|
143
|
+
}, me = (e, t) => {
|
|
143
144
|
if (t) {
|
|
144
|
-
const n = e.reduce((
|
|
145
|
-
return e.map((
|
|
146
|
-
...
|
|
147
|
-
value:
|
|
145
|
+
const n = e.reduce((i, m) => i + m.value, 0);
|
|
146
|
+
return e.map((i) => ({
|
|
147
|
+
...i,
|
|
148
|
+
value: i.value / n * 100
|
|
148
149
|
}));
|
|
149
150
|
}
|
|
150
151
|
return e;
|
|
151
152
|
};
|
|
152
|
-
return /* @__PURE__ */
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
|
|
153
|
+
return /* @__PURE__ */ r("div", { style: { height: I }, className: "pie-chart", children: o && o.data && o.data.length > 0 && /* @__PURE__ */ p(L, { children: [
|
|
154
|
+
/* @__PURE__ */ r(
|
|
155
|
+
ue,
|
|
155
156
|
{
|
|
156
|
-
data: se(
|
|
157
|
-
margin:
|
|
158
|
-
startAngle:
|
|
159
|
-
endAngle:
|
|
157
|
+
data: se(me(o.data, _)),
|
|
158
|
+
margin: ce,
|
|
159
|
+
startAngle: z,
|
|
160
|
+
endAngle: O,
|
|
160
161
|
sortByValue: !0,
|
|
161
162
|
innerRadius: 0.7,
|
|
162
|
-
padAngle:
|
|
163
|
+
padAngle: Y,
|
|
163
164
|
cornerRadius: 3,
|
|
164
165
|
colors: (e) => N.getColor(e.id, e.data),
|
|
165
166
|
borderWidth: 1,
|
|
166
167
|
borderColor: { from: "color", modifiers: [["brighter", "2"]] },
|
|
167
|
-
enableArcLabels:
|
|
168
|
-
enableArcLinkLabels:
|
|
168
|
+
enableArcLabels: E,
|
|
169
|
+
enableArcLinkLabels: X,
|
|
169
170
|
arcLabelsTextColor: "#333333",
|
|
170
171
|
arcLinkLabelsSkipAngle: 5,
|
|
171
172
|
arcLabelsSkipAngle: 15,
|
|
172
173
|
sliceLabelsSkipAngle: 20,
|
|
173
|
-
arcLabel: (e) =>
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
arcLabel: (e) => f.formatNumber(
|
|
175
|
+
g.style === "percent" ? e.value / 100 : e.value,
|
|
176
|
+
g
|
|
176
177
|
),
|
|
177
178
|
radialLabelsSkipAngle: 20,
|
|
178
179
|
radialLabelsTextColor: "#333333",
|
|
@@ -187,7 +188,7 @@ const be = ({
|
|
|
187
188
|
"arcs",
|
|
188
189
|
"arcLabels",
|
|
189
190
|
"legends",
|
|
190
|
-
|
|
191
|
+
de
|
|
191
192
|
],
|
|
192
193
|
animate: !0,
|
|
193
194
|
motionStiffness: 90,
|
|
@@ -199,32 +200,32 @@ const be = ({
|
|
|
199
200
|
const t = e.datum.arc.angleDeg / 360 * 100;
|
|
200
201
|
e.datum.data.variables.valuePercent = t, e.datum.data.variables.category = e.datum.id;
|
|
201
202
|
}
|
|
202
|
-
return B &&
|
|
203
|
-
|
|
203
|
+
return B && s && s.trim().length > 0 ? /* @__PURE__ */ r(
|
|
204
|
+
fe,
|
|
204
205
|
{
|
|
205
|
-
intl:
|
|
206
|
-
format:
|
|
206
|
+
intl: f,
|
|
207
|
+
format: g,
|
|
207
208
|
d: e,
|
|
208
|
-
tooltip:
|
|
209
|
-
tooltipEnableMarkdown:
|
|
209
|
+
tooltip: P,
|
|
210
|
+
tooltipEnableMarkdown: U
|
|
210
211
|
}
|
|
211
212
|
) : null;
|
|
212
213
|
}
|
|
213
214
|
},
|
|
214
215
|
o.id
|
|
215
216
|
),
|
|
216
|
-
(
|
|
217
|
+
(a === "top" || a === "bottom") && /* @__PURE__ */ r(
|
|
217
218
|
"div",
|
|
218
219
|
{
|
|
219
|
-
className: `legends container has-standard-12-font-size ${
|
|
220
|
-
style:
|
|
220
|
+
className: `legends container has-standard-12-font-size ${a}`,
|
|
221
|
+
style: a === "top" ? { marginTop: $ && `${T}px` } : a === "bottom" ? { marginBottom: `${D}px` } : {},
|
|
221
222
|
children: /* @__PURE__ */ p("div", { className: "legend-sections", children: [
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
|
|
223
|
+
/* @__PURE__ */ r("div", { className: "title-section", children: W() }),
|
|
224
|
+
/* @__PURE__ */ r(
|
|
225
|
+
be,
|
|
225
226
|
{
|
|
226
227
|
onWrapChange: (e) => {
|
|
227
|
-
|
|
228
|
+
a === "top" && $ ? (ae(x + e / 2 * 40), A(e)) : (ne(k + e / 2 * 25), A(e));
|
|
228
229
|
},
|
|
229
230
|
className: "legends container has-standard-12-font-size items-section",
|
|
230
231
|
children: F()
|
|
@@ -233,19 +234,19 @@ const be = ({
|
|
|
233
234
|
] })
|
|
234
235
|
}
|
|
235
236
|
),
|
|
236
|
-
(
|
|
237
|
+
(a === "right" || a === "left") && /* @__PURE__ */ p(
|
|
237
238
|
"div",
|
|
238
239
|
{
|
|
239
|
-
className: `legends container has-standard-12-font-size ${
|
|
240
|
-
style:
|
|
240
|
+
className: `legends container has-standard-12-font-size ${a}`,
|
|
241
|
+
style: a === "right" ? oe : le,
|
|
241
242
|
children: [
|
|
242
|
-
|
|
243
|
+
W(),
|
|
243
244
|
F()
|
|
244
245
|
]
|
|
245
246
|
}
|
|
246
247
|
)
|
|
247
248
|
] }) });
|
|
248
|
-
},
|
|
249
|
+
}, Ie = pe(xe);
|
|
249
250
|
export {
|
|
250
|
-
|
|
251
|
+
Ie as default
|
|
251
252
|
};
|
|
@@ -100,7 +100,7 @@ const Q = "multi-select", O = "single-select", de = "NO_DATA", fe = "DEFAULT_VAL
|
|
|
100
100
|
let a = [];
|
|
101
101
|
h === fe ? a = _ ? _.split(",") : [] : h == he ? a = r.length > 0 ? [r[0]] : [] : h == me && (a = r.length > 0 ? [r[r.length - 1]] : []), c({ app: f, group: d, param: u, value: a });
|
|
102
102
|
} else
|
|
103
|
-
c({ app: f, group: d, param: u, value: [r[0]] });
|
|
103
|
+
c({ app: f, group: d, param: u, value: [r[0]], autoApply: A });
|
|
104
104
|
}
|
|
105
105
|
}, []);
|
|
106
106
|
const J = () => {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { getData as w, getCategories as b } from "./data-api.js";
|
|
2
2
|
import * as _ from "immutable";
|
|
3
3
|
import G from "papaparse";
|
|
4
|
-
const d = "LOAD_DATA",
|
|
5
|
-
|
|
6
|
-
}, V = ({ app: r, group: o, mGroup:
|
|
7
|
-
const n = Object.keys(
|
|
4
|
+
const d = "LOAD_DATA", T = "LOAD_DATA_DONE", F = "LOAD_DATA_ERROR", O = "LOAD_CATEGORIES", R = "LOAD_CATEGORIES_DONE", D = "LOAD_CATEGORIES_ERROR", L = "SET_PAGE_MODULE_PROPS", f = "SET_FILTER", m = "SET_INITIAL_FILTER", v = "SET_POSTS_FILTER", P = "SET_INITIAL_POSTS_FILTER", U = "SET_POSTS_PAGINATION", h = "SET_APPLY", C = "CLEAN_FILTER", q = _.Map({ mode: "info" }), N = "SET_MEASURES", x = "CLEAN_MEASURES", J = ({ app: r, group: o }) => (e, s) => {
|
|
5
|
+
e({ type: x, app: r, group: o });
|
|
6
|
+
}, V = ({ app: r, group: o, mGroup: e }) => (s, t) => {
|
|
7
|
+
const n = Object.keys(e.measures).filter((l) => e.measures[l].selected), a = { ...e };
|
|
8
8
|
a[r] = { measures: {} }, n.forEach((l) => {
|
|
9
|
-
a[r].measures[l] = { ...
|
|
10
|
-
}), a[r].format =
|
|
11
|
-
}, Y = ({ app: r, group: o, param:
|
|
12
|
-
n({ type: f, app: r, group: o, param:
|
|
13
|
-
}, $ = ({ app: r, group: o }) => (
|
|
14
|
-
|
|
9
|
+
a[r].measures[l] = { ...e.measures[l] };
|
|
10
|
+
}), a[r].format = e.format, s({ type: N, app: r, group: o, measure: a });
|
|
11
|
+
}, Y = ({ app: r, group: o, param: e, value: s, autoApply: t }) => (n, a) => {
|
|
12
|
+
n({ type: f, app: r, group: o, param: e, value: s, autoApply: t });
|
|
13
|
+
}, $ = ({ app: r, group: o }) => (e, s) => {
|
|
14
|
+
e({ type: C, app: r, group: o });
|
|
15
15
|
const n = s().getIn(["data", "filters", "initial", r, o]);
|
|
16
16
|
if (n) {
|
|
17
17
|
const a = n.entrySeq ? n.entrySeq().toArray() : Object.entries(n);
|
|
18
18
|
for (const [l, i] of a)
|
|
19
|
-
|
|
19
|
+
e({
|
|
20
20
|
type: f,
|
|
21
21
|
app: r,
|
|
22
22
|
group: o,
|
|
@@ -25,13 +25,13 @@ const d = "LOAD_DATA", A = "LOAD_DATA_DONE", O = "LOAD_DATA_ERROR", F = "LOAD_CA
|
|
|
25
25
|
autoApply: !0
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
}, H = ({ app: r, group: o }) => (
|
|
29
|
-
|
|
30
|
-
}, K = ({ app: r, group: o, param:
|
|
31
|
-
|
|
32
|
-
}, Q = (r) => (o,
|
|
33
|
-
const { app: s, params:
|
|
34
|
-
o({ type:
|
|
28
|
+
}, H = ({ app: r, group: o }) => (e, s) => {
|
|
29
|
+
e({ type: h, app: r, group: o });
|
|
30
|
+
}, K = ({ app: r, group: o, param: e, value: s }) => (t, n) => {
|
|
31
|
+
t({ type: m, app: r, group: o, param: e, value: s });
|
|
32
|
+
}, Q = (r) => (o, e) => {
|
|
33
|
+
const { app: s, params: t, dvzProxyDatasetId: n, uniqueStorage: a } = r;
|
|
34
|
+
o({ type: O, params: t, app: s, uniqueStorage: a, dvzProxyDatasetId: n }), b({ app: s, params: t }).then((l) => (l.appliedFilters = t, o({
|
|
35
35
|
type: R,
|
|
36
36
|
app: s,
|
|
37
37
|
data: l,
|
|
@@ -44,81 +44,81 @@ const d = "LOAD_DATA", A = "LOAD_DATA_DONE", O = "LOAD_DATA_ERROR", F = "LOAD_CA
|
|
|
44
44
|
error: l,
|
|
45
45
|
dvzProxyDatasetId: n
|
|
46
46
|
}));
|
|
47
|
-
}, W = ({ app: r, group: o, csv:
|
|
47
|
+
}, W = ({ app: r, group: o, csv: e, store: s, params: t }) => (n, a) => {
|
|
48
48
|
const l = a().get("data").getIn(["filters", r, o]);
|
|
49
|
-
l ?
|
|
50
|
-
const i = G.parse(
|
|
49
|
+
l ? t = { ...t, ...l.toJS() } : t = t || {};
|
|
50
|
+
const i = G.parse(e, { header: !0, dynamicTyping: !0 }), c = i.data.filter((I) => {
|
|
51
51
|
let g = !1;
|
|
52
|
-
return Object.keys(
|
|
53
|
-
const S =
|
|
52
|
+
return Object.keys(t).forEach((y) => {
|
|
53
|
+
const S = t[y];
|
|
54
54
|
if (I[y]) {
|
|
55
|
-
const
|
|
56
|
-
g = S.filter((p) => p && p.toString().trim().toLowerCase() ==
|
|
55
|
+
const A = I[y].toString().trim().toLowerCase();
|
|
56
|
+
g = S.filter((p) => p && p.toString().trim().toLowerCase() == A).length == 0;
|
|
57
57
|
}
|
|
58
58
|
}), !g;
|
|
59
|
-
}), u = { ...i, data: c, appliedFilters:
|
|
60
|
-
n({ type:
|
|
61
|
-
}, X = ({ app: r, group: o, source:
|
|
59
|
+
}), u = { ...i, data: c, appliedFilters: t };
|
|
60
|
+
n({ type: T, app: r, group: o, store: s, data: { count: u.data.length, itemsSize: u.data.length, ...u } });
|
|
61
|
+
}, X = ({ app: r, group: o, source: e, store: s, params: t }) => (n, a) => {
|
|
62
62
|
let l = a().get("data").getIn(["filters", r, o]);
|
|
63
|
-
|
|
63
|
+
t && Object.keys(t).forEach((c) => {
|
|
64
64
|
if (l && l.has(c)) {
|
|
65
|
-
let u =
|
|
65
|
+
let u = t[c], g = l.get(c).filter((y) => u.indexOf(y) > -1);
|
|
66
66
|
l = l.set(c, g);
|
|
67
67
|
}
|
|
68
|
-
}), l && (
|
|
69
|
-
}, Z = ({ data: r }) => (o,
|
|
68
|
+
}), l && (t = { ...t, ...l.toJS() }), n({ type: d, app: r, group: o, params: t, store: s }), w({ app: r, source: e, params: t }).then((i) => (i.appliedFilters = t, n({ type: T, app: r, group: o, store: s, data: i, params: t }))).catch((i) => n({ type: F, app: r, group: o, store: s, error: i }));
|
|
69
|
+
}, Z = ({ data: r }) => (o, e) => {
|
|
70
70
|
o({ type: L, data: r });
|
|
71
71
|
}, k = (r = q, o) => {
|
|
72
72
|
switch (o.type) {
|
|
73
73
|
case d: {
|
|
74
|
-
const { store:
|
|
75
|
-
return r.deleteIn([...
|
|
74
|
+
const { store: e, app: s, group: t, params: n } = o, a = Date.now();
|
|
75
|
+
return r.deleteIn([...e, "error"]).setIn([...e, "loading"], !0).setIn([...e, "time"], a).setIn([...e, "presetFilter"], n);
|
|
76
76
|
}
|
|
77
|
-
case
|
|
78
|
-
const { error:
|
|
79
|
-
return r.setIn([...s, "loading"], !1).setIn([...s, "error"],
|
|
77
|
+
case F: {
|
|
78
|
+
const { error: e, store: s, app: t, group: n } = o;
|
|
79
|
+
return r.setIn([...s, "loading"], !1).setIn([...s, "error"], e).setIn(["filters-settings", t, n, "apply"], null);
|
|
80
80
|
}
|
|
81
|
-
case
|
|
82
|
-
const { data:
|
|
83
|
-
return r.setIn([...n, "loading"], !1).deleteIn([...n, "error"]).setIn([...n, "data"],
|
|
81
|
+
case T: {
|
|
82
|
+
const { data: e, app: s, group: t, store: n } = o;
|
|
83
|
+
return r.setIn([...n, "loading"], !1).deleteIn([...n, "error"]).setIn([...n, "data"], e).setIn(["filters-settings", s, t, "apply"], null);
|
|
84
84
|
}
|
|
85
85
|
case L: {
|
|
86
|
-
const { data:
|
|
87
|
-
return r.setIn(["pageModuleProps"],
|
|
86
|
+
const { data: e } = o;
|
|
87
|
+
return r.setIn(["pageModuleProps"], e);
|
|
88
88
|
}
|
|
89
|
-
case
|
|
90
|
-
const { data:
|
|
91
|
-
return
|
|
89
|
+
case O: {
|
|
90
|
+
const { data: e, app: s, uniqueStorage: t, dvzProxyDatasetId: n } = o, a = ["categories", s];
|
|
91
|
+
return t && a.push(t), n && a.push(n), r.setIn([...a, "loading"], !0).deleteIn([...a, "error"]);
|
|
92
92
|
}
|
|
93
93
|
case R: {
|
|
94
|
-
const { data:
|
|
95
|
-
return n && a.push(n),
|
|
94
|
+
const { data: e, app: s, uniqueStorage: t, dvzProxyDatasetId: n } = o, a = ["categories", s];
|
|
95
|
+
return n && a.push(n), t && a.push(t), r.setIn([...a, "loading"], !1).setIn([...a, "items"], _.fromJS(e));
|
|
96
96
|
}
|
|
97
97
|
case D: {
|
|
98
|
-
const { data:
|
|
99
|
-
return
|
|
98
|
+
const { data: e, app: s, uniqueStorage: t, dvzProxyDatasetId: n } = o, a = ["categories", s];
|
|
99
|
+
return t && a.push(t), n && a.push(n), r.setIn([...a, "loading"], !1).setIn([...a, "error"], e);
|
|
100
100
|
}
|
|
101
101
|
case h: {
|
|
102
|
-
const { app:
|
|
103
|
-
return r.setIn(["filters-settings",
|
|
102
|
+
const { app: e, group: s } = o;
|
|
103
|
+
return r.setIn(["filters-settings", e, s, "apply"], (/* @__PURE__ */ new Date()).getTime());
|
|
104
104
|
}
|
|
105
105
|
case f: {
|
|
106
|
-
const
|
|
107
|
-
return r.setIn(["filters-settings", s,
|
|
106
|
+
const e = Date.now(), { app: s, group: t, param: n, value: a, autoApply: l } = o;
|
|
107
|
+
return r.setIn(["filters-settings", s, t, "autoApply"], l).setIn(["filters", s, t, n], a.length === 0 ? [Number.MIN_SAFE_INTEGER] : a).setIn(["filters-settings", s, t, "apply"], null).setIn(["filters-settings", s, t, "lastUserFilterChange"], e);
|
|
108
108
|
}
|
|
109
109
|
case m: {
|
|
110
|
-
const
|
|
111
|
-
return console.log(n), r.setIn(["filters", "initial", s,
|
|
110
|
+
const e = Date.now(), { app: s, group: t, param: n, value: a, autoApply: l } = o;
|
|
111
|
+
return console.log(n), r.setIn(["filters-settings", s, t, "autoApply"], l).setIn(["filters", "initial", s, t, n], a.length === 0 ? [Number.MIN_SAFE_INTEGER] : a).setIn(["filters", s, t, n], a.length === 0 ? [Number.MIN_SAFE_INTEGER] : a).setIn(["filters-settings", s, t, "lastInitialFilterChange"], e).setIn(["filters-settings", s, t, "lastUserFilterChange"], e);
|
|
112
112
|
}
|
|
113
113
|
case C: {
|
|
114
|
-
const { app:
|
|
115
|
-
return r.setIn(["filters",
|
|
114
|
+
const { app: e, group: s } = o, t = r.getIn(["filters", "initial", e, s]);
|
|
115
|
+
return r.setIn(["filters", e, s], t);
|
|
116
116
|
}
|
|
117
117
|
case P: {
|
|
118
118
|
const {
|
|
119
|
-
group:
|
|
119
|
+
group: e,
|
|
120
120
|
sortFirstBy: s,
|
|
121
|
-
categoryCategory:
|
|
121
|
+
categoryCategory: t,
|
|
122
122
|
countryCategory: n,
|
|
123
123
|
categoryTaxonomy: a,
|
|
124
124
|
countryTaxonomy: l,
|
|
@@ -129,7 +129,7 @@ const d = "LOAD_DATA", A = "LOAD_DATA_DONE", O = "LOAD_DATA_ERROR", F = "LOAD_CA
|
|
|
129
129
|
yearFilter: u,
|
|
130
130
|
categoryFilter: i,
|
|
131
131
|
categoryTaxonomy: a,
|
|
132
|
-
categoryCategory:
|
|
132
|
+
categoryCategory: t,
|
|
133
133
|
countryCategory: n,
|
|
134
134
|
countryFilter: c,
|
|
135
135
|
countryTaxonomy: l,
|
|
@@ -140,13 +140,13 @@ const d = "LOAD_DATA", A = "LOAD_DATA_DONE", O = "LOAD_DATA_ERROR", F = "LOAD_CA
|
|
|
140
140
|
postCategory: null,
|
|
141
141
|
postType: null
|
|
142
142
|
};
|
|
143
|
-
return r.setIn(["posts",
|
|
143
|
+
return r.setIn(["posts", e], g).setIn(["posts", "initialFilters", e], g);
|
|
144
144
|
}
|
|
145
145
|
case v: {
|
|
146
146
|
const {
|
|
147
|
-
group:
|
|
147
|
+
group: e,
|
|
148
148
|
yearFilter: s,
|
|
149
|
-
categoryFilter:
|
|
149
|
+
categoryFilter: t,
|
|
150
150
|
countryFilter: n,
|
|
151
151
|
page: a,
|
|
152
152
|
itemsPerPage: l,
|
|
@@ -156,9 +156,9 @@ const d = "LOAD_DATA", A = "LOAD_DATA_DONE", O = "LOAD_DATA_ERROR", F = "LOAD_CA
|
|
|
156
156
|
taxonomy: I,
|
|
157
157
|
categoryTaxonomy: g,
|
|
158
158
|
countryTaxonomy: y
|
|
159
|
-
} = o, S = r.getIn(["posts",
|
|
159
|
+
} = o, S = r.getIn(["posts", e]) || {}, A = {
|
|
160
160
|
yearFilter: s,
|
|
161
|
-
categoryFilter:
|
|
161
|
+
categoryFilter: t,
|
|
162
162
|
countryFilter: n,
|
|
163
163
|
page: a,
|
|
164
164
|
itemsPerPage: l,
|
|
@@ -170,34 +170,34 @@ const d = "LOAD_DATA", A = "LOAD_DATA_DONE", O = "LOAD_DATA_ERROR", F = "LOAD_CA
|
|
|
170
170
|
categoryTaxonomy: g !== void 0 ? g : S.categoryTaxonomy,
|
|
171
171
|
countryTaxonomy: y !== void 0 ? y : S.countryTaxonomy
|
|
172
172
|
};
|
|
173
|
-
let p = r.setIn(["posts",
|
|
174
|
-
const E = r.getIn(["posts", "initialFilters",
|
|
175
|
-
if ((!E || E && E.yearFilter === null && E.categoryFilter === null && E.countryFilter === null && E.categoryCategory === null) && (Array.isArray(
|
|
176
|
-
const M = { ...
|
|
177
|
-
p = p.setIn(["posts", "initialFilters",
|
|
173
|
+
let p = r.setIn(["posts", e], A);
|
|
174
|
+
const E = r.getIn(["posts", "initialFilters", e]);
|
|
175
|
+
if ((!E || E && E.yearFilter === null && E.categoryFilter === null && E.countryFilter === null && E.categoryCategory === null) && (Array.isArray(t) && t.length > 0 || Array.isArray(n) && n.length > 0 || Array.isArray(s) && s.length > 0)) {
|
|
176
|
+
const M = { ...A };
|
|
177
|
+
p = p.setIn(["posts", "initialFilters", e], M);
|
|
178
178
|
}
|
|
179
179
|
return p;
|
|
180
180
|
}
|
|
181
181
|
case U: {
|
|
182
|
-
const { group:
|
|
183
|
-
return r.setIn(["postsPagination",
|
|
182
|
+
const { group: e, totalPages: s, totalItems: t } = o;
|
|
183
|
+
return r.setIn(["postsPagination", e], { totalPages: s, totalItems: t });
|
|
184
184
|
}
|
|
185
185
|
case N: {
|
|
186
|
-
const { app:
|
|
187
|
-
return r.setIn(["measures",
|
|
186
|
+
const { app: e, group: s, measure: t } = o;
|
|
187
|
+
return r.setIn(["measures", e, s], t);
|
|
188
188
|
}
|
|
189
189
|
case x: {
|
|
190
|
-
const { app:
|
|
191
|
-
return r.deleteIn(["measures",
|
|
190
|
+
const { app: e, group: s, measure: t } = o;
|
|
191
|
+
return r.deleteIn(["measures", e, s]);
|
|
192
192
|
}
|
|
193
193
|
default:
|
|
194
194
|
return r;
|
|
195
195
|
}
|
|
196
|
-
}, tt = ({ group: r, dispatch: o, initialFilters:
|
|
196
|
+
}, tt = ({ group: r, dispatch: o, initialFilters: e }) => {
|
|
197
197
|
o({
|
|
198
198
|
type: P,
|
|
199
199
|
group: r,
|
|
200
|
-
...
|
|
200
|
+
...e,
|
|
201
201
|
reset: !0,
|
|
202
202
|
page: 1
|
|
203
203
|
});
|