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