@logora/debate 0.3.87 → 0.3.89
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/assets/components/argument/argument/Argument.module-gLfNRLks.css +1 -0
- package/dist/assets/components/consultation/consultation_box/ConsultationBox.module-BnTr5IaF.css +1 -0
- package/dist/assets/components/input/text_editor/{TextEditor.module-CxuSL3l3.css → TextEditor.module-DePSfOvG.css} +1 -1
- package/dist/assets/components/list/paginated_list/action_bar/ActionBar.module-pxwFC_Y2.css +1 -0
- package/dist/assets/components/proposal/proposal_box/ProposalBox.module-T4ms_LQ7.css +1 -0
- package/dist/assets/components/section/section_box/SectionBox.module-DUeUtdWr.css +1 -0
- package/dist/assets/components/source/context_source_list/ContextSourceList.module-D6X_0dB7.css +1 -0
- package/dist/assets/components/source/source_list_item/SourceListItem.module-mTxHhXPV.css +1 -0
- package/dist/assets/components/summary/summary/Summary.module-DjfmUlkW.css +1 -0
- package/dist/assets/components/summary/summary_box/SummaryBox.module-DQVkA8l7.css +1 -0
- package/dist/assets/components/vote/vote_box/VoteBox.module-CDrqb2SZ.css +1 -0
- package/dist/components/argument/argument/Argument.js +106 -111
- package/dist/components/argument/argument/Argument.module.scss.js +31 -31
- package/dist/components/consultation/consultation_box/ConsultationBox.js +111 -80
- package/dist/components/consultation/consultation_box/ConsultationBox.module.scss.js +29 -31
- package/dist/components/dialog/dropdown/Dropdown.js +28 -35
- package/dist/components/icons/spiegel_icons/index.js +46 -46
- package/dist/components/icons/stern_icons/index.js +70 -100
- package/dist/components/input/argument_input/ArgumentInput.js +197 -201
- package/dist/components/input/select/Select.js +19 -19
- package/dist/components/input/text_editor/TextEditor.js +129 -143
- package/dist/components/input/text_editor/TextEditor.module.scss.js +5 -5
- package/dist/components/input/text_editor/plugins/FocusPlugin.js +8 -12
- package/dist/components/input/text_editor/plugins/SetContentPlugin.js +13 -13
- package/dist/components/input/text_editor/plugins/SetRichContentPlugin.js +10 -10
- package/dist/components/input/text_editor/plugins/ToolbarPlugin.js +72 -70
- package/dist/components/list/paginated_list/PaginatedList.js +125 -131
- package/dist/components/list/paginated_list/action_bar/ActionBar.js +50 -53
- package/dist/components/list/paginated_list/action_bar/ActionBar.module.scss.js +16 -18
- package/dist/components/notification/notification_menu/NotificationMenu.js +22 -23
- package/dist/components/proposal/proposal_box/ProposalBox.js +59 -70
- package/dist/components/proposal/proposal_box/ProposalBox.module.scss.js +10 -14
- package/dist/components/section/section_box/SectionBox.js +10 -10
- package/dist/components/section/section_box/SectionBox.module.scss.js +9 -9
- package/dist/components/source/context_source_box/ContextSourceBox.js +7 -7
- package/dist/components/source/context_source_list/ContextSourceList.js +13 -10
- package/dist/components/source/context_source_list/ContextSourceList.module.scss.js +12 -14
- package/dist/components/source/source_list_item/SourceListItem.js +28 -42
- package/dist/components/source/source_list_item/SourceListItem.module.scss.js +6 -8
- package/dist/components/source/source_modal/SourceModal.js +15 -15
- package/dist/components/summary/summary/Summary.js +63 -41
- package/dist/components/summary/summary/Summary.module.scss.js +6 -10
- package/dist/components/summary/summary_box/SummaryBox.module.scss.js +9 -9
- package/dist/components/vote/vote_box/VoteBox.js +143 -122
- package/dist/components/vote/vote_box/VoteBox.module.scss.js +48 -50
- package/package.json +1 -1
- package/dist/assets/components/argument/argument/Argument.module-QZdPjj_i.css +0 -1
- package/dist/assets/components/consultation/consultation_box/ConsultationBox.module-DjNiVt-p.css +0 -1
- package/dist/assets/components/list/paginated_list/action_bar/ActionBar.module-DvwCbS9k.css +0 -1
- package/dist/assets/components/proposal/proposal_box/ProposalBox.module-Dm8XDnr1.css +0 -1
- package/dist/assets/components/section/section_box/SectionBox.module-qQs4B6bf.css +0 -1
- package/dist/assets/components/source/context_source_list/ContextSourceList.module-DUPbI-wb.css +0 -1
- package/dist/assets/components/source/source_list_item/SourceListItem.module-fm_uHuY4.css +0 -1
- package/dist/assets/components/summary/summary/Summary.module-2bnx3egy.css +0 -1
- package/dist/assets/components/summary/summary_box/SummaryBox.module-Dr9PevSJ.css +0 -1
- package/dist/assets/components/vote/vote_box/VoteBox.module-D5sSSHpi.css +0 -1
- package/dist/components/icons/spiegel_icons/Downvote.js +0 -6
- package/dist/components/icons/spiegel_icons/Upvote.js +0 -6
|
@@ -1,78 +1,80 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { $isListNode as R, ListNode as
|
|
3
|
-
import { useLexicalComposerContext as
|
|
4
|
-
import { $isHeadingNode as q, $createQuoteNode as
|
|
5
|
-
import { $setBlocksType as
|
|
6
|
-
import { $getNearestNodeOfType as
|
|
7
|
-
import
|
|
8
|
-
import { $getSelection as
|
|
9
|
-
import { useRef as
|
|
1
|
+
import { jsxs as _, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { $isListNode as R, ListNode as D, INSERT_ORDERED_LIST_COMMAND as $ } from "@lexical/list";
|
|
3
|
+
import { useLexicalComposerContext as K } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
import { $isHeadingNode as q, $createQuoteNode as F } from "@lexical/rich-text";
|
|
5
|
+
import { $setBlocksType as y } from "@lexical/selection";
|
|
6
|
+
import { $getNearestNodeOfType as P, mergeRegister as U } from "@lexical/utils";
|
|
7
|
+
import o from "classnames";
|
|
8
|
+
import { $getSelection as b, $isRangeSelection as M, SELECTION_CHANGE_COMMAND as j, FORMAT_TEXT_COMMAND as g } from "lexical";
|
|
9
|
+
import { useRef as H, useState as c, useCallback as Q, useEffect as G } from "react";
|
|
10
10
|
import { useIntl as X } from "react-intl";
|
|
11
11
|
import e from "./ToolbarPlugin.module.scss.js";
|
|
12
12
|
import { Icon as s } from "../../../icons/icon/Icon.js";
|
|
13
13
|
import { Button as z } from "../../../action/button/Button.js";
|
|
14
|
-
const
|
|
15
|
-
const n = X(),
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const d =
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
|
|
14
|
+
const ce = (i) => {
|
|
15
|
+
const n = X(), T = 1, [l] = K(), k = H(null), [f, h] = c("paragraph"), [J, C] = c(null), [x, I] = c(!1), [A, S] = c(!1), [E, L] = c(!1), p = i.hideSubmit && i.hideSourceAction && i.disableRichText, u = Q(() => {
|
|
16
|
+
const a = b();
|
|
17
|
+
if (M(a)) {
|
|
18
|
+
const d = a.anchor.getNode(), r = d.getKey() === "root" ? d : d.getTopLevelElementOrThrow(), N = r.getKey();
|
|
19
|
+
if (l.getElementByKey(N) !== null)
|
|
20
|
+
if (C(N), R(r)) {
|
|
21
|
+
const m = P(d, D), O = m ? m.getTag() : r.getTag();
|
|
22
|
+
h(O);
|
|
23
23
|
} else {
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const m = q(r) ? r.getTag() : r.getType();
|
|
25
|
+
h(m);
|
|
26
26
|
}
|
|
27
|
-
I(
|
|
27
|
+
I(a.hasFormat("bold")), S(a.hasFormat("italic")), L(a.hasFormat("underline"));
|
|
28
28
|
}
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
}, [l]);
|
|
30
|
+
G(() => U(
|
|
31
|
+
l.registerUpdateListener(({ editorState: a }) => {
|
|
32
|
+
a.read(() => {
|
|
33
|
+
u();
|
|
34
34
|
});
|
|
35
35
|
}),
|
|
36
|
-
|
|
36
|
+
l.registerCommand(
|
|
37
37
|
j,
|
|
38
|
-
(
|
|
39
|
-
|
|
38
|
+
(a, d) => (u(), !1),
|
|
39
|
+
T
|
|
40
40
|
)
|
|
41
|
-
), [
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
), [l, u]);
|
|
42
|
+
const v = () => {
|
|
43
|
+
l.update(() => {
|
|
44
|
+
const a = b();
|
|
45
|
+
M(a) && y(a, () => $createParagraphNode());
|
|
46
|
+
});
|
|
47
|
+
}, w = () => {
|
|
48
|
+
f !== "number" ? l.dispatchCommand($) : v();
|
|
49
|
+
}, B = () => {
|
|
50
|
+
f !== "quote" && l.update(() => {
|
|
51
|
+
const a = b();
|
|
52
|
+
y(a, () => F());
|
|
51
53
|
});
|
|
52
54
|
};
|
|
53
|
-
return p ? null : /* @__PURE__ */
|
|
55
|
+
return p ? null : /* @__PURE__ */ _(
|
|
54
56
|
"div",
|
|
55
57
|
{
|
|
56
|
-
className:
|
|
57
|
-
[e.toolbarIsActive]: p ? !1 :
|
|
58
|
+
className: o(e.toolbar, {
|
|
59
|
+
[e.toolbarIsActive]: p ? !1 : i.isActive
|
|
58
60
|
}),
|
|
59
|
-
ref:
|
|
61
|
+
ref: k,
|
|
60
62
|
children: [
|
|
61
|
-
|
|
63
|
+
i.isActive ? !i.disableRichText && /* @__PURE__ */ _(
|
|
62
64
|
"div",
|
|
63
65
|
{
|
|
64
|
-
className:
|
|
65
|
-
[e.shortBar]:
|
|
66
|
+
className: o(e.iconToolbar, {
|
|
67
|
+
[e.shortBar]: i.shortBar
|
|
66
68
|
}),
|
|
67
69
|
children: [
|
|
68
70
|
/* @__PURE__ */ t(
|
|
69
71
|
"button",
|
|
70
72
|
{
|
|
71
73
|
onClick: () => {
|
|
72
|
-
|
|
74
|
+
l.dispatchCommand(g, "bold");
|
|
73
75
|
},
|
|
74
76
|
type: "button",
|
|
75
|
-
className:
|
|
77
|
+
className: o(e.toolbarItem, { [e.active]: x }),
|
|
76
78
|
"data-testid": "format-bold",
|
|
77
79
|
"aria-label": n.formatMessage({
|
|
78
80
|
id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
|
|
@@ -84,7 +86,7 @@ const me = (l) => {
|
|
|
84
86
|
name: "bold",
|
|
85
87
|
width: 24,
|
|
86
88
|
height: 24,
|
|
87
|
-
className:
|
|
89
|
+
className: o(e.format, e.bold)
|
|
88
90
|
}
|
|
89
91
|
)
|
|
90
92
|
}
|
|
@@ -93,11 +95,11 @@ const me = (l) => {
|
|
|
93
95
|
"button",
|
|
94
96
|
{
|
|
95
97
|
onClick: () => {
|
|
96
|
-
|
|
98
|
+
l.dispatchCommand(g, "italic");
|
|
97
99
|
},
|
|
98
100
|
type: "button",
|
|
99
|
-
className:
|
|
100
|
-
[e.active]:
|
|
101
|
+
className: o(e.toolbarItem, {
|
|
102
|
+
[e.active]: A
|
|
101
103
|
}),
|
|
102
104
|
"aria-label": n.formatMessage({
|
|
103
105
|
id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
|
|
@@ -109,7 +111,7 @@ const me = (l) => {
|
|
|
109
111
|
name: "italic",
|
|
110
112
|
width: 24,
|
|
111
113
|
height: 24,
|
|
112
|
-
className:
|
|
114
|
+
className: o(e.format, e.italic)
|
|
113
115
|
}
|
|
114
116
|
)
|
|
115
117
|
}
|
|
@@ -118,11 +120,11 @@ const me = (l) => {
|
|
|
118
120
|
"button",
|
|
119
121
|
{
|
|
120
122
|
onClick: () => {
|
|
121
|
-
|
|
123
|
+
l.dispatchCommand(g, "underline");
|
|
122
124
|
},
|
|
123
125
|
type: "button",
|
|
124
|
-
className:
|
|
125
|
-
[e.active]:
|
|
126
|
+
className: o(e.toolbarItem, {
|
|
127
|
+
[e.active]: E
|
|
126
128
|
}),
|
|
127
129
|
"aria-label": n.formatMessage({
|
|
128
130
|
id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
|
|
@@ -134,7 +136,7 @@ const me = (l) => {
|
|
|
134
136
|
name: "underline",
|
|
135
137
|
width: 24,
|
|
136
138
|
height: 24,
|
|
137
|
-
className:
|
|
139
|
+
className: o(e.format, e.underline)
|
|
138
140
|
}
|
|
139
141
|
)
|
|
140
142
|
}
|
|
@@ -142,9 +144,9 @@ const me = (l) => {
|
|
|
142
144
|
/* @__PURE__ */ t(
|
|
143
145
|
"button",
|
|
144
146
|
{
|
|
145
|
-
onClick: () =>
|
|
147
|
+
onClick: () => B(),
|
|
146
148
|
type: "button",
|
|
147
|
-
className:
|
|
149
|
+
className: e.toolbarItem,
|
|
148
150
|
"aria-label": n.formatMessage({
|
|
149
151
|
id: "input.text_editor.plugins.toolbar_plugin.blockquote.aria_label",
|
|
150
152
|
defaultMessage: "Add a blockquote"
|
|
@@ -155,7 +157,7 @@ const me = (l) => {
|
|
|
155
157
|
name: "blockquote",
|
|
156
158
|
width: 24,
|
|
157
159
|
height: 24,
|
|
158
|
-
className:
|
|
160
|
+
className: o(e.format, e.quote)
|
|
159
161
|
}
|
|
160
162
|
)
|
|
161
163
|
}
|
|
@@ -163,9 +165,9 @@ const me = (l) => {
|
|
|
163
165
|
/* @__PURE__ */ t(
|
|
164
166
|
"button",
|
|
165
167
|
{
|
|
166
|
-
onClick: () =>
|
|
168
|
+
onClick: () => w(),
|
|
167
169
|
type: "button",
|
|
168
|
-
className:
|
|
170
|
+
className: e.toolbarItem,
|
|
169
171
|
"aria-label": n.formatMessage({
|
|
170
172
|
id: "input.text_editor.plugins.toolbar_plugin.numbered_list.aria_label",
|
|
171
173
|
defaultMessage: "Insert a numbered list"
|
|
@@ -176,15 +178,15 @@ const me = (l) => {
|
|
|
176
178
|
name: "orderedList",
|
|
177
179
|
width: 24,
|
|
178
180
|
height: 24,
|
|
179
|
-
className:
|
|
181
|
+
className: o(e.format, e.numberedList)
|
|
180
182
|
}
|
|
181
183
|
)
|
|
182
184
|
}
|
|
183
185
|
),
|
|
184
|
-
!
|
|
186
|
+
!i.hideSourceAction && /* @__PURE__ */ t(
|
|
185
187
|
"button",
|
|
186
188
|
{
|
|
187
|
-
onClick:
|
|
189
|
+
onClick: i.onAddSource,
|
|
188
190
|
type: "button",
|
|
189
191
|
className: e.toolbarItem,
|
|
190
192
|
"aria-label": n.formatMessage({
|
|
@@ -197,7 +199,7 @@ const me = (l) => {
|
|
|
197
199
|
name: "link",
|
|
198
200
|
width: 20,
|
|
199
201
|
height: 20,
|
|
200
|
-
className:
|
|
202
|
+
className: o(e.format, e.link)
|
|
201
203
|
}
|
|
202
204
|
)
|
|
203
205
|
}
|
|
@@ -205,13 +207,13 @@ const me = (l) => {
|
|
|
205
207
|
]
|
|
206
208
|
}
|
|
207
209
|
) : null,
|
|
208
|
-
/* @__PURE__ */ t("div", { className: e.actionButton, children:
|
|
210
|
+
/* @__PURE__ */ t("div", { className: e.actionButton, children: i.hideSubmit ? null : /* @__PURE__ */ t(
|
|
209
211
|
z,
|
|
210
212
|
{
|
|
211
213
|
type: "button",
|
|
212
214
|
"data-testid": "submit-button",
|
|
213
|
-
handleClick:
|
|
214
|
-
className:
|
|
215
|
+
handleClick: i.onSubmit,
|
|
216
|
+
className: o(e.inputSubmitActionButton, e.submitAction),
|
|
215
217
|
"aria-label": n.formatMessage({
|
|
216
218
|
id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
|
|
217
219
|
defaultMessage: "Send message"
|
|
@@ -224,5 +226,5 @@ const me = (l) => {
|
|
|
224
226
|
);
|
|
225
227
|
};
|
|
226
228
|
export {
|
|
227
|
-
|
|
229
|
+
ce as ToolbarPlugin
|
|
228
230
|
};
|
|
@@ -1,243 +1,237 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsxs as U, jsx as d, Fragment as Le } from "react/jsx-runtime";
|
|
2
|
+
import je from "@rooks/use-previous";
|
|
3
|
+
import Be from "classnames";
|
|
4
|
+
import Qe, { useState as m, useEffect as g } from "react";
|
|
5
5
|
import { useIntl as Ue } from "react-intl";
|
|
6
6
|
import { useLocation as We } from "react-router";
|
|
7
7
|
import a from "./PaginatedList.module.scss.js";
|
|
8
8
|
import { ActionBar as ze } from "./action_bar/ActionBar.js";
|
|
9
9
|
import { useList as Ge } from "../list_provider/useList.js";
|
|
10
|
-
import { useDataProvider as
|
|
11
|
-
import { useResponsive as
|
|
12
|
-
import { useData as
|
|
13
|
-
import { uniqueBy as
|
|
14
|
-
import { Pagination as
|
|
15
|
-
import { StandardErrorBoundary as
|
|
16
|
-
const
|
|
10
|
+
import { useDataProvider as Pe } from "../../data/data_provider/useDataProvider.js";
|
|
11
|
+
import { useResponsive as Ve } from "../../hooks/use_responsive/useResponsive.js";
|
|
12
|
+
import { useData as Xe } from "../../data/data_provider/useData.js";
|
|
13
|
+
import { uniqueBy as A } from "../../util/unique_by/uniqueBy.js";
|
|
14
|
+
import { Pagination as Ye } from "../pagination/Pagination.js";
|
|
15
|
+
import { StandardErrorBoundary as Ze } from "../../error/standard_error_boundary/StandardErrorBoundary.js";
|
|
16
|
+
const rt = ({
|
|
17
17
|
query: w,
|
|
18
18
|
sortOptions: i,
|
|
19
19
|
sort: N,
|
|
20
20
|
filters: o,
|
|
21
21
|
tagList: ne,
|
|
22
22
|
currentPage: M,
|
|
23
|
-
resource:
|
|
23
|
+
resource: _,
|
|
24
24
|
currentListId: n,
|
|
25
25
|
withToken: ae,
|
|
26
|
-
perPage:
|
|
26
|
+
perPage: h,
|
|
27
27
|
perPageParam: le = "per_page",
|
|
28
28
|
pageParam: ie = "page",
|
|
29
29
|
sortParam: oe = "sort",
|
|
30
30
|
queryParam: me = "query",
|
|
31
|
-
tagParam:
|
|
31
|
+
tagParam: re = "tag_id",
|
|
32
32
|
totalHeaderParam: D = "total",
|
|
33
|
-
onUpdateTotal:
|
|
33
|
+
onUpdateTotal: W,
|
|
34
34
|
onElementsLoad: R,
|
|
35
|
-
transformData:
|
|
36
|
-
uniqueIdKey:
|
|
37
|
-
children:
|
|
35
|
+
transformData: z,
|
|
36
|
+
uniqueIdKey: p = "id",
|
|
37
|
+
children: de,
|
|
38
38
|
resourcePropName: fe,
|
|
39
|
-
loadingComponent:
|
|
39
|
+
loadingComponent: G,
|
|
40
40
|
searchBar: ce = !1,
|
|
41
41
|
title: ue,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
withUrlParams: we = !1,
|
|
55
|
-
onLoadNewPage: Z
|
|
42
|
+
emptyListComponent: P,
|
|
43
|
+
emptyText: V,
|
|
44
|
+
display: X,
|
|
45
|
+
elementsPerLine: Y,
|
|
46
|
+
indexLayout: Ee = !1,
|
|
47
|
+
gap: ge = "1em",
|
|
48
|
+
withPagination: he = !0,
|
|
49
|
+
numberElements: Z,
|
|
50
|
+
countless: pe,
|
|
51
|
+
onElementClick: ve,
|
|
52
|
+
withUrlParams: Se = !1,
|
|
53
|
+
onLoadNewPage: $
|
|
56
54
|
}) => {
|
|
57
|
-
const J = Ue(), t = Ge(), H =
|
|
58
|
-
|
|
59
|
-
), [
|
|
55
|
+
const J = Ue(), t = Ge(), H = Pe(), I = We(), { isMobile: K, isTablet: ye, isDesktop: L } = Ve(), [b, f] = m(!1), [we, Ne] = m(!1), [v, S] = Xe(n, []), [O, Me] = m(
|
|
56
|
+
v?.length || 0
|
|
57
|
+
), [c, j] = m(M || 1), [y, B] = m(w || null), [k, q] = m(null), [Re, ee] = m(null), r = new URLSearchParams(
|
|
60
58
|
typeof window < "u" ? window.location.search : I.search
|
|
61
|
-
),
|
|
59
|
+
), be = () => i && i[0].type === "sort" && i[0].value || N || "", ke = () => {
|
|
62
60
|
let e = {};
|
|
63
61
|
return i && i[0].type === "filter" && (e[i[0].name] = i[0].value), o && (e = Object.assign({}, e, o)), e;
|
|
64
|
-
}, [
|
|
65
|
-
M && M !==
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
for (const e of
|
|
62
|
+
}, [C, F] = m(be()), [Q, T] = m(ke()), te = je(o);
|
|
63
|
+
M && M !== c && j(M), w !== void 0 && w !== y && B(w), N !== void 0 && N !== C && F(N), te && JSON.stringify(o) !== JSON.stringify(te) && JSON.stringify(o) !== JSON.stringify(Q) && T(o), g(() => {
|
|
64
|
+
if (r.get("tagId") && q(Number.parseInt(r.get("tagId"))), r.get("search") && B(r.get("search")), r.get("sort")) {
|
|
65
|
+
F(r.get("sort"));
|
|
66
|
+
for (const e of r.values()) {
|
|
69
67
|
i?.map((s) => {
|
|
70
68
|
s.value === e && ee(s.name);
|
|
71
69
|
});
|
|
72
70
|
break;
|
|
73
71
|
}
|
|
74
72
|
}
|
|
75
|
-
for (const e of
|
|
73
|
+
for (const e of r.keys()) {
|
|
76
74
|
i?.map((s) => {
|
|
77
|
-
s.name === e && (
|
|
75
|
+
s.name === e && (T({
|
|
78
76
|
...o,
|
|
79
77
|
[s.name]: s.value
|
|
80
78
|
}), ee(s.name));
|
|
81
79
|
});
|
|
82
80
|
break;
|
|
83
81
|
}
|
|
84
|
-
}, [I.search]),
|
|
85
|
-
|
|
82
|
+
}, [I.search]), g(() => {
|
|
83
|
+
_ ? (j(1), S([]), f(!0), se(1)) : f(!1);
|
|
86
84
|
}, [
|
|
87
|
-
|
|
85
|
+
C,
|
|
88
86
|
Q,
|
|
89
87
|
y,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
]),
|
|
94
|
-
|
|
95
|
-
}, [
|
|
88
|
+
_,
|
|
89
|
+
k,
|
|
90
|
+
h
|
|
91
|
+
]), g(() => {
|
|
92
|
+
c > 1 && (f(!0), se(c));
|
|
93
|
+
}, [c]), g(() => {
|
|
96
94
|
if (t.addElements && n in t.addElements && t.addElements[n].length > 0) {
|
|
97
|
-
|
|
95
|
+
Te(t.addElements[n]);
|
|
98
96
|
const e = t.addElements;
|
|
99
97
|
delete e[n], t.setAddElements(e);
|
|
100
98
|
}
|
|
101
|
-
}, [t.addElements]),
|
|
102
|
-
if (t.updateElements && n in t.updateElements &&
|
|
103
|
-
|
|
99
|
+
}, [t.addElements]), g(() => {
|
|
100
|
+
if (t.updateElements && n in t.updateElements && t.updateElements[n].length > 0) {
|
|
101
|
+
xe(t.updateElements[n]);
|
|
104
102
|
const e = t.updateElements;
|
|
105
103
|
delete e[n], t.setUpdateElements(e);
|
|
106
104
|
}
|
|
107
|
-
}, [t.updateElements]),
|
|
105
|
+
}, [t.updateElements]), g(() => {
|
|
108
106
|
if (t.removeElements && n in t.removeElements && t.removeElements[n].length > 0) {
|
|
109
|
-
|
|
107
|
+
Ae(t.removeElements[n]);
|
|
110
108
|
const e = t.removeElements;
|
|
111
109
|
delete e[n], t.setRemoveElements(e);
|
|
112
110
|
}
|
|
113
111
|
}, [t.removeElements]);
|
|
114
|
-
const
|
|
115
|
-
e.type === "filter" ? (
|
|
112
|
+
const Ce = (e) => {
|
|
113
|
+
e.type === "filter" ? (F(""), T({
|
|
116
114
|
...o,
|
|
117
115
|
[e.name]: e.value
|
|
118
|
-
})) : (
|
|
119
|
-
},
|
|
120
|
-
typeof
|
|
116
|
+
})) : (F(e.value), T(o ? { ...o } : {}));
|
|
117
|
+
}, Fe = () => {
|
|
118
|
+
typeof $ == "function" && $() !== null || j(c + 1);
|
|
121
119
|
}, se = (e) => {
|
|
122
120
|
const s = ae ? H.getListWithToken : H.getList;
|
|
123
|
-
if ((e - 1) *
|
|
124
|
-
const
|
|
121
|
+
if ((e - 1) * h <= (Z || O) || e === 1) {
|
|
122
|
+
const u = {
|
|
125
123
|
[ie]: e,
|
|
126
|
-
[le]:
|
|
127
|
-
...
|
|
124
|
+
[le]: h,
|
|
125
|
+
...C && !y && { [oe]: C },
|
|
128
126
|
...y && { [me]: y },
|
|
129
|
-
...
|
|
127
|
+
...pe === !0 && { countless: !0 },
|
|
130
128
|
...Q,
|
|
131
|
-
...
|
|
129
|
+
...k && { [re]: k }
|
|
132
130
|
};
|
|
133
|
-
s(
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
Number.parseInt(
|
|
137
|
-
),
|
|
138
|
-
let
|
|
139
|
-
R && R(
|
|
131
|
+
s(_, u).then((l) => {
|
|
132
|
+
const x = l.headers;
|
|
133
|
+
x && D in x && (Me(
|
|
134
|
+
Number.parseInt(x[D || "total"], 10)
|
|
135
|
+
), W && W(x[D || "total"]));
|
|
136
|
+
let E = l?.data?.data;
|
|
137
|
+
R && R(E), z && (E = E.filter(z)), t.addElements && n in t.addElements && t.addElements[n].length > 0 && (E = [...t.addElements[n], E]), _e(E), f(!1);
|
|
140
138
|
}).catch((l) => {
|
|
141
|
-
console.error(l), l?.response?.status !== 404 &&
|
|
139
|
+
console.error(l), l?.response?.status !== 404 && Ne(!0), f(!1);
|
|
142
140
|
});
|
|
143
141
|
} else
|
|
144
|
-
|
|
145
|
-
},
|
|
142
|
+
f(!1);
|
|
143
|
+
}, Te = (e) => {
|
|
146
144
|
S(
|
|
147
|
-
(s) =>
|
|
145
|
+
(s) => A([...e, ...s], p || "id")
|
|
148
146
|
), R && R(e);
|
|
147
|
+
}, xe = (e) => {
|
|
148
|
+
let s = v;
|
|
149
|
+
e.forEach(
|
|
150
|
+
(u) => s = s.map(
|
|
151
|
+
(l) => l.id === u.id ? u : l
|
|
152
|
+
)
|
|
153
|
+
), S(A(s, p || "id"));
|
|
149
154
|
}, Ae = (e) => {
|
|
150
|
-
|
|
151
|
-
let r = s;
|
|
152
|
-
return e.forEach(
|
|
153
|
-
(l) => r = r.map(
|
|
154
|
-
(f) => f.id === l.id ? l : f
|
|
155
|
-
)
|
|
156
|
-
), x(r, v || "id");
|
|
157
|
-
});
|
|
158
|
-
}, De = (e) => {
|
|
159
|
-
const s = e.map((l) => l.id), r = k.filter(
|
|
155
|
+
const s = e.map((l) => l.id), u = v.filter(
|
|
160
156
|
(l) => s.indexOf(l.id) === -1
|
|
161
157
|
);
|
|
162
|
-
S(
|
|
163
|
-
},
|
|
158
|
+
S(A(u, p || "id"));
|
|
159
|
+
}, _e = (e) => {
|
|
164
160
|
S(
|
|
165
|
-
(s) =>
|
|
161
|
+
(s) => A([...s, ...e], p || "id")
|
|
166
162
|
);
|
|
167
|
-
},
|
|
163
|
+
}, De = (e, s) => e !== void 0 ? /* @__PURE__ */ d(
|
|
168
164
|
"li",
|
|
169
165
|
{
|
|
170
166
|
className: a.paginatedListItem,
|
|
171
167
|
"data-testid": "list-item",
|
|
172
|
-
onClick:
|
|
173
|
-
children: /* @__PURE__ */
|
|
168
|
+
onClick: ve,
|
|
169
|
+
children: /* @__PURE__ */ d(Ze, { hideMessage: !0, children: Qe.cloneElement(de, {
|
|
174
170
|
index: s,
|
|
175
171
|
[fe]: e
|
|
176
172
|
}) })
|
|
177
173
|
},
|
|
178
|
-
|
|
179
|
-
) : null,
|
|
180
|
-
if (
|
|
174
|
+
e[p || "id"]
|
|
175
|
+
) : null, Je = (e) => G ? /* @__PURE__ */ d("li", { className: a.paginatedListItem, children: G }, e) : null;
|
|
176
|
+
if (we)
|
|
181
177
|
throw new Error(
|
|
182
178
|
J.formatMessage({
|
|
183
179
|
id: "error.list",
|
|
184
180
|
defaultMessage: "Error when loading content."
|
|
185
181
|
})
|
|
186
182
|
);
|
|
187
|
-
return /* @__PURE__ */
|
|
188
|
-
/* @__PURE__ */
|
|
183
|
+
return /* @__PURE__ */ U("div", { className: a.listContainer, children: [
|
|
184
|
+
/* @__PURE__ */ d(
|
|
189
185
|
ze,
|
|
190
186
|
{
|
|
191
187
|
title: ue,
|
|
192
|
-
subtitle: Ee,
|
|
193
|
-
showDebateConsultationSubtitle: ge,
|
|
194
188
|
sortOptions: i,
|
|
195
|
-
defaultSelectOption:
|
|
189
|
+
defaultSelectOption: Re,
|
|
196
190
|
searchBar: ce,
|
|
197
191
|
tagList: ne,
|
|
198
|
-
activeTagId:
|
|
199
|
-
onSearch: (e) =>
|
|
200
|
-
onSortChange:
|
|
192
|
+
activeTagId: k,
|
|
193
|
+
onSearch: (e) => B(e),
|
|
194
|
+
onSortChange: Ce,
|
|
201
195
|
onTagChange: (e) => q(e),
|
|
202
|
-
withUrlParams:
|
|
196
|
+
withUrlParams: Se
|
|
203
197
|
}
|
|
204
198
|
),
|
|
205
|
-
!b &&
|
|
199
|
+
!b && v.length === 0 ? P ? /* @__PURE__ */ d("div", { className: a.emptyListElement, children: P }) : /* @__PURE__ */ d("div", { className: a.emptyList, children: V || J.formatMessage({
|
|
206
200
|
id: "info.emptyList",
|
|
207
201
|
defaultMessage: "No items for now."
|
|
208
|
-
}) }) : /* @__PURE__ */
|
|
209
|
-
/* @__PURE__ */
|
|
202
|
+
}) }) : /* @__PURE__ */ U(Le, { children: [
|
|
203
|
+
/* @__PURE__ */ U(
|
|
210
204
|
"ul",
|
|
211
205
|
{
|
|
212
|
-
className:
|
|
213
|
-
[a.paginatedListIsTablet]: !K && !
|
|
214
|
-
[a.centeredList]:
|
|
215
|
-
[a.column]:
|
|
216
|
-
[a.twoElementsPerLine]:
|
|
217
|
-
[a.oneElementPerLine]:
|
|
218
|
-
[a.indexLayoutList]:
|
|
219
|
-
[a.listIsDesktop]:
|
|
220
|
-
[a.listIsTablet]:
|
|
206
|
+
className: Be(a.paginatedList, {
|
|
207
|
+
[a.paginatedListIsTablet]: !K && !L,
|
|
208
|
+
[a.centeredList]: X === "column",
|
|
209
|
+
[a.column]: X === "column",
|
|
210
|
+
[a.twoElementsPerLine]: Y === 2,
|
|
211
|
+
[a.oneElementPerLine]: Y === 1,
|
|
212
|
+
[a.indexLayoutList]: Ee,
|
|
213
|
+
[a.listIsDesktop]: L,
|
|
214
|
+
[a.listIsTablet]: ye && !L,
|
|
221
215
|
[a.listIsMobile]: K
|
|
222
216
|
}),
|
|
223
|
-
style: { gap:
|
|
217
|
+
style: { gap: ge },
|
|
224
218
|
children: [
|
|
225
|
-
|
|
226
|
-
b ? Array(
|
|
219
|
+
v.map(De),
|
|
220
|
+
b ? Array(h).fill().map((e, s) => s).map(Je) : null
|
|
227
221
|
]
|
|
228
222
|
}
|
|
229
223
|
),
|
|
230
|
-
!b &&
|
|
231
|
-
|
|
224
|
+
!b && he !== !1 && /* @__PURE__ */ d(
|
|
225
|
+
Ye,
|
|
232
226
|
{
|
|
233
227
|
buttonText: J.formatMessage({
|
|
234
228
|
id: "action.see_more",
|
|
235
229
|
defaultMessage: "See more"
|
|
236
230
|
}),
|
|
237
|
-
currentPage:
|
|
238
|
-
perPage:
|
|
239
|
-
totalElements:
|
|
240
|
-
onLoad:
|
|
231
|
+
currentPage: c,
|
|
232
|
+
perPage: h,
|
|
233
|
+
totalElements: Z || O,
|
|
234
|
+
onLoad: Fe,
|
|
241
235
|
isLoading: b,
|
|
242
236
|
hideLoader: !0,
|
|
243
237
|
"data-tid": "list_read_more"
|
|
@@ -247,5 +241,5 @@ const ft = ({
|
|
|
247
241
|
] });
|
|
248
242
|
};
|
|
249
243
|
export {
|
|
250
|
-
|
|
244
|
+
rt as PaginatedList
|
|
251
245
|
};
|