@instructure/platform-modules 1.14.0 → 1.15.0
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/adapters/canvasGraphql/normalize.d.ts +1 -0
- package/dist/adapters/canvasGraphql/normalize.d.ts.map +1 -1
- package/dist/adapters/canvasGraphql/queries.d.ts.map +1 -1
- package/dist/adapters/inMemory.d.ts.map +1 -1
- package/dist/chunks/{ModulesProgressBar-B4fXbi-4.js → ModulesProgressBar-DOUI1JeK.js} +785 -769
- package/dist/components/ModuleCard.d.ts.map +1 -1
- package/dist/components/ModulesList.stories.d.ts +1 -1
- package/dist/components/ModulesList.stories.d.ts.map +1 -1
- package/dist/edit/EditModuleCard.d.ts +5 -3
- package/dist/edit/EditModuleCard.d.ts.map +1 -1
- package/dist/edit/EditModuleItemRow.d.ts +2 -1
- package/dist/edit/EditModuleItemRow.d.ts.map +1 -1
- package/dist/edit/ModulesEditView.d.ts.map +1 -1
- package/dist/edit/ModulesEditView.stories.d.ts +3 -2
- package/dist/edit/ModulesEditView.stories.d.ts.map +1 -1
- package/dist/edit/controls/DragHandle.d.ts +12 -0
- package/dist/edit/controls/DragHandle.d.ts.map +1 -0
- package/dist/edit/dnd/EditDndProvider.d.ts +18 -0
- package/dist/edit/dnd/EditDndProvider.d.ts.map +1 -0
- package/dist/edit/dnd/announcements.d.ts +24 -0
- package/dist/edit/dnd/announcements.d.ts.map +1 -0
- package/dist/edit/dnd/ids.d.ts +41 -0
- package/dist/edit/dnd/ids.d.ts.map +1 -0
- package/dist/edit/index.d.ts +2 -0
- package/dist/edit/index.d.ts.map +1 -1
- package/dist/edit.js +610 -328
- package/dist/hooks/useModulesPageData.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/dist/types/domain.d.ts +2 -0
- package/dist/types/domain.d.ts.map +1 -1
- package/dist/types/schemas.d.ts.map +1 -1
- package/locales/en.json +12 -1
- package/package.json +1 -1
package/dist/edit.js
CHANGED
|
@@ -1,125 +1,128 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { jsx as
|
|
5
|
-
import {
|
|
6
|
-
import { Alert as
|
|
7
|
-
import { Heading as
|
|
8
|
-
import { Pagination as
|
|
9
|
-
import { Spinner as
|
|
1
|
+
import { P as fe, a7 as Ie, Q as Me, k as K, aw as ve, i as be, c as ye, u as w, q as Y, y as G, v as Pe, an as ke, ak as Ce, aH as B, A as De, B as V, n as Q, aI as Ae, aJ as Le, z as we, p as Re } from "./chunks/ModulesProgressBar-DOUI1JeK.js";
|
|
2
|
+
import { useQueryClient as Se, useMutation as Ee } from "@tanstack/react-query";
|
|
3
|
+
import { useMemo as T, createContext as Oe, useState as X, useContext as Te, Fragment as J } from "react";
|
|
4
|
+
import { jsx as n, jsxs as v, Fragment as Z } from "react/jsx-runtime";
|
|
5
|
+
import { politeAnnounce as ee, TruncateWithTooltip as Be, getLiveRegion as te } from "@instructure/platform-instui-bindings";
|
|
6
|
+
import { Alert as ne } from "@instructure/ui-alerts/v11_7";
|
|
7
|
+
import { Heading as ie } from "@instructure/ui-heading/v11_7";
|
|
8
|
+
import { Pagination as oe } from "@instructure/ui-pagination/v11_7";
|
|
9
|
+
import { Spinner as re } from "@instructure/ui-spinner/v11_7";
|
|
10
10
|
import { Text as L } from "@instructure/ui-text/v11_7";
|
|
11
|
-
import { View as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
11
|
+
import { View as C } from "@instructure/ui-view/v11_7";
|
|
12
|
+
import { useSensors as Ne, useSensor as $, PointerSensor as qe, KeyboardSensor as xe, DndContext as Fe, DragOverlay as _e, rectIntersection as $e, closestCenter as He } from "@dnd-kit/core";
|
|
13
|
+
import { SortableContext as de, verticalListSortingStrategy as se, useSortable as ze, sortableKeyboardCoordinates as Ue, arrayMove as H } from "@dnd-kit/sortable";
|
|
14
|
+
import { CSS as je } from "@dnd-kit/utilities";
|
|
15
|
+
import { ScreenReaderContent as We } from "@instructure/ui-a11y-content";
|
|
16
|
+
import { IconButton as ae, Button as Ke } from "@instructure/ui-buttons/v11_7";
|
|
14
17
|
import { Flex as b } from "@instructure/ui-flex/v11_7";
|
|
15
|
-
import { CornerDownRightInstUIIcon as
|
|
16
|
-
import { List as
|
|
17
|
-
import { Pill as
|
|
18
|
-
import { Link as
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
return [...e.slice(0,
|
|
22
|
-
},
|
|
23
|
-
const
|
|
24
|
-
return [...e].sort((
|
|
18
|
+
import { IconDragHandleLine as Ye, CornerDownRightInstUIIcon as Ge, IconArrowOpenUpLine as Ve, IconArrowOpenDownLine as Qe, LayersInstUIIcon as Xe, ListChecksInstUIIcon as Je, ClockInstUIIcon as Ze, LockInstUIIcon as et } from "@instructure/ui-icons";
|
|
19
|
+
import { List as tt, ListItem as nt } from "@instructure/ui-list/v11_7";
|
|
20
|
+
import { Pill as it } from "@instructure/ui-pill/v11_7";
|
|
21
|
+
import { Link as ot } from "@instructure/ui-link/v11_7";
|
|
22
|
+
const S = (e) => e.map((t, i) => ({ ...t, position: i + 1 })), E = (e, t, i) => {
|
|
23
|
+
const a = i === void 0 ? e.length : Math.min(Math.max(i - 1, 0), e.length);
|
|
24
|
+
return [...e.slice(0, a), t, ...e.slice(a)];
|
|
25
|
+
}, z = (e, t) => {
|
|
26
|
+
const i = new Map(t.map((a, o) => [a, o]));
|
|
27
|
+
return [...e].sort((a, o) => (i.get(a.id) ?? t.length) - (i.get(o.id) ?? t.length));
|
|
25
28
|
};
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
throw new
|
|
30
|
-
},
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
34
|
-
},
|
|
35
|
-
e.itemsByModuleId[
|
|
36
|
-
},
|
|
29
|
+
function Jt(e, t = {}) {
|
|
30
|
+
const i = (r) => {
|
|
31
|
+
if (r !== e.courseId)
|
|
32
|
+
throw new Ie(e.courseId, r);
|
|
33
|
+
}, a = (r) => {
|
|
34
|
+
const d = e.modules.findIndex((l) => l.id === r);
|
|
35
|
+
if (d === -1) throw new Error(`in-memory adapter has no module ${r}`);
|
|
36
|
+
return d;
|
|
37
|
+
}, o = (r) => e.itemsByModuleId[r] ?? [], u = (r, d) => {
|
|
38
|
+
e.itemsByModuleId[r] = S(d.map((l) => ({ ...l, moduleId: r })));
|
|
39
|
+
}, s = (r) => String(r.reduce((d, l) => Math.max(d, Number(l) || 0), 0) + 1);
|
|
37
40
|
return {
|
|
38
|
-
...
|
|
39
|
-
async createModule({ courseId:
|
|
40
|
-
|
|
41
|
+
...fe(e, t),
|
|
42
|
+
async createModule({ courseId: r, name: d, position: l }) {
|
|
43
|
+
i(r);
|
|
41
44
|
const p = {
|
|
42
|
-
id:
|
|
43
|
-
name:
|
|
45
|
+
id: s(e.modules.map((c) => c.id)),
|
|
46
|
+
name: d,
|
|
44
47
|
position: 0,
|
|
45
48
|
published: !1,
|
|
46
49
|
itemCount: 0,
|
|
47
50
|
prerequisiteModules: [],
|
|
48
51
|
requireSequentialProgress: !1
|
|
49
52
|
};
|
|
50
|
-
return e.modules =
|
|
53
|
+
return e.modules = S(E(e.modules, p, l)), e.itemsByModuleId[p.id] = [], e.modules[a(p.id)];
|
|
51
54
|
},
|
|
52
|
-
async updateModule({ courseId:
|
|
53
|
-
|
|
54
|
-
const { prerequisiteModuleIds: p, position:
|
|
55
|
-
p && (
|
|
56
|
-
id:
|
|
57
|
-
name: e.modules[
|
|
55
|
+
async updateModule({ courseId: r, moduleId: d, patch: l }) {
|
|
56
|
+
i(r);
|
|
57
|
+
const { prerequisiteModuleIds: p, position: c, ...m } = l, M = e.modules[a(d)], f = { ...M, ...m };
|
|
58
|
+
p && (f.prerequisiteModules = p.map((g) => ({
|
|
59
|
+
id: g,
|
|
60
|
+
name: e.modules[a(g)].name
|
|
58
61
|
})));
|
|
59
|
-
const
|
|
60
|
-
return e.modules =
|
|
62
|
+
const I = e.modules.filter((g) => g.id !== d);
|
|
63
|
+
return e.modules = S(E(I, f, c ?? M.position)), e.modules[a(d)];
|
|
61
64
|
},
|
|
62
|
-
async deleteModule({ courseId:
|
|
63
|
-
|
|
65
|
+
async deleteModule({ courseId: r, moduleId: d }) {
|
|
66
|
+
i(r), a(d), e.modules = S(e.modules.filter((l) => l.id !== d)), delete e.itemsByModuleId[d];
|
|
64
67
|
},
|
|
65
|
-
async reorderModules({ courseId:
|
|
66
|
-
|
|
68
|
+
async reorderModules({ courseId: r, moduleIds: d }) {
|
|
69
|
+
i(r), e.modules = S(z(e.modules, d));
|
|
67
70
|
},
|
|
68
|
-
async setModulesPublished({ courseId:
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
71
|
+
async setModulesPublished({ courseId: r, moduleIds: d, published: l, includeItems: p }) {
|
|
72
|
+
i(r);
|
|
73
|
+
const c = new Set(
|
|
74
|
+
d === "all" ? e.modules.map((m) => m.id) : d
|
|
72
75
|
);
|
|
73
76
|
if (e.modules = e.modules.map(
|
|
74
|
-
(m) =>
|
|
77
|
+
(m) => c.has(m.id) ? { ...m, published: l } : m
|
|
75
78
|
), !!p)
|
|
76
|
-
for (const m of
|
|
79
|
+
for (const m of c)
|
|
77
80
|
u(
|
|
78
81
|
m,
|
|
79
|
-
|
|
82
|
+
o(m).map((M) => ({ ...M, published: l }))
|
|
80
83
|
);
|
|
81
84
|
},
|
|
82
|
-
async createModuleItem({ courseId:
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
(
|
|
86
|
-
),
|
|
87
|
-
id:
|
|
88
|
-
moduleId:
|
|
85
|
+
async createModuleItem({ courseId: r, moduleId: d, type: l, title: p, position: c, indent: m = 0, extensions: M }) {
|
|
86
|
+
i(r), a(d);
|
|
87
|
+
const f = Object.values(e.itemsByModuleId).flatMap(
|
|
88
|
+
(g) => g.map((h) => h.id)
|
|
89
|
+
), I = {
|
|
90
|
+
id: s(f),
|
|
91
|
+
moduleId: d,
|
|
89
92
|
title: p,
|
|
90
|
-
type:
|
|
93
|
+
type: l,
|
|
91
94
|
position: 0,
|
|
92
95
|
indent: m,
|
|
93
96
|
published: !1,
|
|
94
|
-
...
|
|
97
|
+
...M ? { extensions: M } : {}
|
|
95
98
|
};
|
|
96
|
-
return u(
|
|
99
|
+
return u(d, E(o(d), I, c)), o(d).find((g) => g.id === I.id);
|
|
97
100
|
},
|
|
98
|
-
async updateModuleItem({ courseId:
|
|
99
|
-
|
|
100
|
-
const { moduleId:
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
if (!
|
|
101
|
+
async updateModuleItem({ courseId: r, moduleId: d, itemId: l, patch: p }) {
|
|
102
|
+
i(r);
|
|
103
|
+
const { moduleId: c = d, position: m, ...M } = p;
|
|
104
|
+
a(c);
|
|
105
|
+
const f = o(d).find((h) => h.id === l);
|
|
106
|
+
if (!f) throw new Error(`in-memory adapter has no item ${l} in module ${d}`);
|
|
104
107
|
u(
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
d,
|
|
109
|
+
o(d).filter((h) => h.id !== l)
|
|
107
110
|
);
|
|
108
|
-
const
|
|
109
|
-
return u(
|
|
111
|
+
const g = m ?? (c !== d ? void 0 : f.position);
|
|
112
|
+
return u(c, E(o(c), { ...f, ...M }, g)), o(c).find((h) => h.id === l);
|
|
110
113
|
},
|
|
111
|
-
async deleteModuleItem({ courseId:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
async deleteModuleItem({ courseId: r, moduleId: d, itemId: l }) {
|
|
115
|
+
i(r), u(
|
|
116
|
+
d,
|
|
117
|
+
o(d).filter((p) => p.id !== l)
|
|
115
118
|
);
|
|
116
119
|
},
|
|
117
|
-
async reorderModuleItems({ courseId:
|
|
118
|
-
|
|
120
|
+
async reorderModuleItems({ courseId: r, moduleId: d, itemIds: l }) {
|
|
121
|
+
i(r), u(d, z(o(d), l));
|
|
119
122
|
}
|
|
120
123
|
};
|
|
121
124
|
}
|
|
122
|
-
const
|
|
125
|
+
const rt = [
|
|
123
126
|
"createModule",
|
|
124
127
|
"updateModule",
|
|
125
128
|
"deleteModule",
|
|
@@ -130,240 +133,492 @@ const Te = [
|
|
|
130
133
|
"deleteModuleItem",
|
|
131
134
|
"reorderModuleItems"
|
|
132
135
|
];
|
|
133
|
-
function A(e,
|
|
134
|
-
return
|
|
135
|
-
mutationFn: (u) => !
|
|
136
|
+
function A(e, t, i, a, o) {
|
|
137
|
+
return Ee({
|
|
138
|
+
mutationFn: (u) => !t[e] || !a ? Promise.reject(new Error(`${e} is not available to this editor`)) : a({ ...u, courseId: i }),
|
|
136
139
|
// Settled, not success: a bulk write that fails partway has still committed part of itself.
|
|
137
|
-
onSettled: (u,
|
|
140
|
+
onSettled: (u, s, r) => o(r)
|
|
138
141
|
});
|
|
139
142
|
}
|
|
140
|
-
function
|
|
141
|
-
const { adapter:
|
|
143
|
+
function Zt(e) {
|
|
144
|
+
const { adapter: t, courseId: i } = e, a = Me({ ...e, view: "teacher" }), o = Se(), { permissions: u } = K(), s = T(
|
|
142
145
|
() => Object.fromEntries(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
typeof
|
|
146
|
+
rt.map((c) => [
|
|
147
|
+
c,
|
|
148
|
+
typeof t[c] == "function" && u[c] !== !1
|
|
146
149
|
])
|
|
147
150
|
),
|
|
148
|
-
[
|
|
149
|
-
),
|
|
150
|
-
|
|
151
|
-
...
|
|
152
|
-
]),
|
|
151
|
+
[t, u]
|
|
152
|
+
), r = () => be(o, i), d = (...c) => Promise.all([
|
|
153
|
+
r(),
|
|
154
|
+
...c.map((m) => ye(o, i, m))
|
|
155
|
+
]), l = (c) => {
|
|
153
156
|
var m;
|
|
154
|
-
return (m =
|
|
157
|
+
return (m = t[c]) == null ? void 0 : m.bind(t);
|
|
155
158
|
}, p = {
|
|
156
|
-
createModule: A("createModule",
|
|
157
|
-
updateModule: A("updateModule",
|
|
158
|
-
deleteModule: A("deleteModule",
|
|
159
|
-
reorderModules: A("reorderModules",
|
|
159
|
+
createModule: A("createModule", s, i, l("createModule"), r),
|
|
160
|
+
updateModule: A("updateModule", s, i, l("updateModule"), r),
|
|
161
|
+
deleteModule: A("deleteModule", s, i, l("deleteModule"), r),
|
|
162
|
+
reorderModules: A("reorderModules", s, i, l("reorderModules"), r),
|
|
160
163
|
setModulesPublished: A(
|
|
161
164
|
"setModulesPublished",
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
({ includeItems:
|
|
165
|
+
s,
|
|
166
|
+
i,
|
|
167
|
+
l("setModulesPublished"),
|
|
168
|
+
({ includeItems: c }) => c ? ve(o, i) : r()
|
|
166
169
|
),
|
|
167
170
|
createModuleItem: A(
|
|
168
171
|
"createModuleItem",
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
({ moduleId:
|
|
172
|
+
s,
|
|
173
|
+
i,
|
|
174
|
+
l("createModuleItem"),
|
|
175
|
+
({ moduleId: c }) => d(c)
|
|
173
176
|
),
|
|
174
177
|
updateModuleItem: A(
|
|
175
178
|
"updateModuleItem",
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
({ moduleId:
|
|
180
|
-
|
|
181
|
-
...m.moduleId && m.moduleId !==
|
|
179
|
+
s,
|
|
180
|
+
i,
|
|
181
|
+
l("updateModuleItem"),
|
|
182
|
+
({ moduleId: c, patch: m }) => d(
|
|
183
|
+
c,
|
|
184
|
+
...m.moduleId && m.moduleId !== c ? [m.moduleId] : []
|
|
182
185
|
)
|
|
183
186
|
),
|
|
184
187
|
deleteModuleItem: A(
|
|
185
188
|
"deleteModuleItem",
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
({ moduleId:
|
|
189
|
+
s,
|
|
190
|
+
i,
|
|
191
|
+
l("deleteModuleItem"),
|
|
192
|
+
({ moduleId: c }) => d(c)
|
|
190
193
|
),
|
|
191
194
|
reorderModuleItems: A(
|
|
192
195
|
"reorderModuleItems",
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
({ moduleId:
|
|
196
|
+
s,
|
|
197
|
+
i,
|
|
198
|
+
l("reorderModuleItems"),
|
|
199
|
+
({ moduleId: c }) => d(c)
|
|
197
200
|
)
|
|
198
201
|
};
|
|
199
|
-
return { ...
|
|
202
|
+
return { ...a, can: s, mutations: p };
|
|
203
|
+
}
|
|
204
|
+
const le = (e) => `module:${e}`, ce = (e) => `item:${e}`, en = (e) => `external:${e}`, dt = (e) => `items:${e}`;
|
|
205
|
+
function D(e) {
|
|
206
|
+
const t = e == null ? void 0 : e.data.current, i = t == null ? void 0 : t.kind;
|
|
207
|
+
return i === "module" || i === "item" || i === "external" ? t : void 0;
|
|
208
|
+
}
|
|
209
|
+
function ue(e) {
|
|
210
|
+
var t;
|
|
211
|
+
return (t = e == null ? void 0 : e.data.current) == null ? void 0 : t.sortable;
|
|
212
|
+
}
|
|
213
|
+
const me = (e, t) => (e == null ? void 0 : e.kind) === "item" && (t == null ? void 0 : t.kind) === "item" && e.moduleId !== t.moduleId, U = (e) => e.top + e.height / 2, q = (e, t) => e !== null && U(e) > U(t.rect);
|
|
214
|
+
function j(e, t) {
|
|
215
|
+
const i = D(t), a = ue(t);
|
|
216
|
+
if (!(!t || !i || !a))
|
|
217
|
+
return i.kind === "item" && me(D(e), i) ? {
|
|
218
|
+
position: a.index + (q(e.rect.current.translated, t) ? 2 : 1),
|
|
219
|
+
count: a.items.length + 1,
|
|
220
|
+
module: i.moduleName
|
|
221
|
+
} : {
|
|
222
|
+
position: a.index + 1,
|
|
223
|
+
count: a.items.length,
|
|
224
|
+
module: i.kind === "item" ? i.moduleName : void 0
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function st(e) {
|
|
228
|
+
const t = (s) => (r) => {
|
|
229
|
+
var l;
|
|
230
|
+
const d = (l = D(r.active)) == null ? void 0 : l.name;
|
|
231
|
+
return d === void 0 ? void 0 : s(d, r);
|
|
232
|
+
}, i = t((s, { active: r, over: d }) => {
|
|
233
|
+
const l = j(r, d);
|
|
234
|
+
if (!l) return e("dragOverNothing", { name: s });
|
|
235
|
+
const { position: p, count: c, module: m } = l;
|
|
236
|
+
return m === void 0 ? e("dragOverPosition", { name: s, position: p, count: c }) : e("dragOverPositionInModule", { name: s, position: p, count: c, module: m });
|
|
237
|
+
});
|
|
238
|
+
let a = !1, o, u;
|
|
239
|
+
return {
|
|
240
|
+
onDragStart: t((s) => (a = !0, e("dragPickedUp", { name: s }))),
|
|
241
|
+
onDragOver: (s) => {
|
|
242
|
+
var d, l;
|
|
243
|
+
const r = a && ((d = s.over) == null ? void 0 : d.id) === s.active.id;
|
|
244
|
+
return a = !1, o = (l = s.over) == null ? void 0 : l.id, u = i(s), r ? void 0 : u;
|
|
245
|
+
},
|
|
246
|
+
// Crossing the middle of an item in another module changes where it lands, but not `over`.
|
|
247
|
+
onDragMove: (s) => {
|
|
248
|
+
if (!s.over || s.over.id !== o) return;
|
|
249
|
+
const r = i(s);
|
|
250
|
+
if (r !== u)
|
|
251
|
+
return u = r, r;
|
|
252
|
+
},
|
|
253
|
+
onDragEnd: t((s, { active: r, over: d }) => {
|
|
254
|
+
const l = j(r, d);
|
|
255
|
+
if (!l) return e("dragDroppedNowhere", { name: s });
|
|
256
|
+
const { position: p, count: c, module: m } = l;
|
|
257
|
+
return m === void 0 ? e("dragDroppedPosition", { name: s, position: p, count: c }) : e("dragDroppedPositionInModule", { name: s, position: p, count: c, module: m });
|
|
258
|
+
}),
|
|
259
|
+
onDragCancel: t((s) => e("dragCanceled", { name: s }))
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function at(e) {
|
|
263
|
+
const t = st(e), i = (a) => (o) => {
|
|
264
|
+
const u = a(o);
|
|
265
|
+
u && ee(u);
|
|
266
|
+
};
|
|
267
|
+
return {
|
|
268
|
+
announcements: {
|
|
269
|
+
onDragStart: i(t.onDragStart),
|
|
270
|
+
onDragOver: i(t.onDragOver),
|
|
271
|
+
onDragMove: i(t.onDragMove),
|
|
272
|
+
onDragEnd: i(t.onDragEnd),
|
|
273
|
+
onDragCancel: i(t.onDragCancel)
|
|
274
|
+
},
|
|
275
|
+
screenReaderInstructions: { draggable: e("dragInstructions") }
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
const ge = Oe(null);
|
|
279
|
+
function lt() {
|
|
280
|
+
return Te(ge);
|
|
281
|
+
}
|
|
282
|
+
function pe(e, t, i) {
|
|
283
|
+
const { t: a } = w(), o = ze({
|
|
284
|
+
id: e,
|
|
285
|
+
data: { ...t },
|
|
286
|
+
disabled: !i,
|
|
287
|
+
attributes: { roleDescription: a("dragRoleDescription") }
|
|
288
|
+
}), u = {
|
|
289
|
+
transform: je.Translate.toString(o.transform),
|
|
290
|
+
transition: o.transition,
|
|
291
|
+
opacity: o.isDragging ? ct : void 0
|
|
292
|
+
};
|
|
293
|
+
return { ...o, style: u };
|
|
294
|
+
}
|
|
295
|
+
const ct = 0.4, ut = (e) => e === "module" ? "module" : "item", mt = (e) => {
|
|
296
|
+
var a;
|
|
297
|
+
const t = ut((a = D(e.active)) == null ? void 0 : a.kind), i = {
|
|
298
|
+
...e,
|
|
299
|
+
droppableContainers: e.droppableContainers.filter(
|
|
300
|
+
(o) => {
|
|
301
|
+
var u;
|
|
302
|
+
return ((u = D(o)) == null ? void 0 : u.kind) === t;
|
|
303
|
+
}
|
|
304
|
+
)
|
|
305
|
+
};
|
|
306
|
+
return t === "item" && $e(i).length === 0 ? [] : He(i);
|
|
307
|
+
}, gt = (e, t) => {
|
|
308
|
+
const { active: i, over: a, collisionRect: o } = t.context, u = ue(a);
|
|
309
|
+
if (a !== null && o !== null && u !== void 0 && u.index === u.items.length - 1 && me(D(i), D(a))) {
|
|
310
|
+
const r = q(o, a);
|
|
311
|
+
if (e.code === "ArrowDown" && !r)
|
|
312
|
+
return e.preventDefault(), { x: a.rect.left, y: a.rect.bottom - o.height / 2 };
|
|
313
|
+
if (e.code === "ArrowUp" && r)
|
|
314
|
+
return e.preventDefault(), { x: a.rect.left, y: a.rect.top };
|
|
315
|
+
}
|
|
316
|
+
return Ue(e, t);
|
|
317
|
+
}, pt = { cursor: "grabbing" };
|
|
318
|
+
function ht({ data: e, children: t }) {
|
|
319
|
+
const { t: i } = w(), { modules: a, getItems: o, can: u, mutations: s } = e, [r, d] = X(null), l = T(() => at(i), [i]), p = Ne(
|
|
320
|
+
$(qe, { activationConstraint: { distance: 8 } }),
|
|
321
|
+
$(xe, { coordinateGetter: gt })
|
|
322
|
+
), c = T(() => a.map((f) => le(f.id)), [a]), m = ({ active: f }) => {
|
|
323
|
+
d(D(f) ?? null);
|
|
324
|
+
}, M = ({ active: f, over: I }) => {
|
|
325
|
+
d(null);
|
|
326
|
+
const g = D(f), h = D(I);
|
|
327
|
+
if (!g || !h || !I) return;
|
|
328
|
+
if (g.kind === "module" && h.kind === "module") {
|
|
329
|
+
if (g.moduleId === h.moduleId) return;
|
|
330
|
+
const k = a.map((y) => y.id);
|
|
331
|
+
s.reorderModules.mutate({
|
|
332
|
+
moduleIds: H(k, k.indexOf(g.moduleId), k.indexOf(h.moduleId))
|
|
333
|
+
});
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (g.kind !== "item" || h.kind !== "item" || g.itemId === h.itemId) return;
|
|
337
|
+
if (g.moduleId === h.moduleId) {
|
|
338
|
+
const k = o(g.moduleId).items.map((y) => y.id);
|
|
339
|
+
s.reorderModuleItems.mutate({
|
|
340
|
+
moduleId: g.moduleId,
|
|
341
|
+
itemIds: H(k, k.indexOf(g.itemId), k.indexOf(h.itemId))
|
|
342
|
+
});
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (!u.updateModuleItem) return;
|
|
346
|
+
const R = q(f.rect.current.translated, I);
|
|
347
|
+
s.updateModuleItem.mutate({
|
|
348
|
+
moduleId: g.moduleId,
|
|
349
|
+
itemId: g.itemId,
|
|
350
|
+
patch: { moduleId: h.moduleId, position: h.position + (R ? 1 : 0) }
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
return /* @__PURE__ */ n(ge.Provider, { value: (r == null ? void 0 : r.kind) ?? null, children: /* @__PURE__ */ v(
|
|
354
|
+
Fe,
|
|
355
|
+
{
|
|
356
|
+
sensors: p,
|
|
357
|
+
collisionDetection: mt,
|
|
358
|
+
accessibility: l,
|
|
359
|
+
onDragStart: m,
|
|
360
|
+
onDragEnd: M,
|
|
361
|
+
onDragCancel: () => d(null),
|
|
362
|
+
children: [
|
|
363
|
+
/* @__PURE__ */ n(de, { items: c, strategy: se, children: t }),
|
|
364
|
+
/* @__PURE__ */ n(_e, { children: r ? /* @__PURE__ */ n("div", { style: pt, children: /* @__PURE__ */ n(
|
|
365
|
+
C,
|
|
366
|
+
{
|
|
367
|
+
as: "div",
|
|
368
|
+
background: "primary",
|
|
369
|
+
borderRadius: "card.sm",
|
|
370
|
+
borderWidth: "small",
|
|
371
|
+
shadow: "topmost",
|
|
372
|
+
padding: "small",
|
|
373
|
+
"data-testid": "edit-drag-overlay",
|
|
374
|
+
children: /* @__PURE__ */ n(L, { weight: "bold", children: r.name })
|
|
375
|
+
}
|
|
376
|
+
) }) : null })
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
) });
|
|
200
380
|
}
|
|
201
|
-
function
|
|
381
|
+
function ft(e) {
|
|
202
382
|
return null;
|
|
203
383
|
}
|
|
204
|
-
function
|
|
384
|
+
function he({
|
|
385
|
+
label: e,
|
|
386
|
+
attributes: t,
|
|
387
|
+
listeners: i,
|
|
388
|
+
activatorRef: a,
|
|
389
|
+
color: o = "primary",
|
|
390
|
+
"data-testid": u
|
|
391
|
+
}) {
|
|
392
|
+
return /* @__PURE__ */ n(
|
|
393
|
+
ae,
|
|
394
|
+
{
|
|
395
|
+
...t,
|
|
396
|
+
...i,
|
|
397
|
+
elementRef: (s) => a(s),
|
|
398
|
+
size: "small",
|
|
399
|
+
withBackground: !1,
|
|
400
|
+
withBorder: !1,
|
|
401
|
+
color: o,
|
|
402
|
+
cursor: "grab",
|
|
403
|
+
screenReaderLabel: e,
|
|
404
|
+
"data-testid": u,
|
|
405
|
+
children: /* @__PURE__ */ n(Ye, {})
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
function N(e) {
|
|
205
410
|
return null;
|
|
206
411
|
}
|
|
207
|
-
function
|
|
412
|
+
function It(e) {
|
|
208
413
|
return null;
|
|
209
414
|
}
|
|
210
|
-
function
|
|
415
|
+
function Mt(e) {
|
|
211
416
|
return null;
|
|
212
417
|
}
|
|
213
|
-
function
|
|
418
|
+
function vt(e) {
|
|
214
419
|
return null;
|
|
215
420
|
}
|
|
216
|
-
function
|
|
421
|
+
function bt(e) {
|
|
217
422
|
return null;
|
|
218
423
|
}
|
|
219
|
-
function
|
|
424
|
+
function yt(e) {
|
|
220
425
|
return null;
|
|
221
426
|
}
|
|
222
|
-
function
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
427
|
+
function Pt({
|
|
428
|
+
item: e,
|
|
429
|
+
module: t,
|
|
430
|
+
today: i,
|
|
431
|
+
canReorder: a
|
|
432
|
+
}) {
|
|
433
|
+
var x, F;
|
|
434
|
+
const { t: o, locale: u, timezone: s } = w(), r = Y(), d = K(), l = G(), p = T(() => Pe(d.itemMeta), [d.itemMeta]), c = e.title || o("itemUntitled"), m = pe(
|
|
435
|
+
ce(e.id),
|
|
436
|
+
{
|
|
437
|
+
kind: "item",
|
|
438
|
+
moduleId: t.id,
|
|
439
|
+
moduleName: t.name,
|
|
440
|
+
itemId: e.id,
|
|
441
|
+
name: c,
|
|
442
|
+
position: e.position
|
|
443
|
+
},
|
|
444
|
+
a
|
|
445
|
+
), M = a ? /* @__PURE__ */ n(b.Item, { children: /* @__PURE__ */ n(
|
|
446
|
+
he,
|
|
447
|
+
{
|
|
448
|
+
label: o("dragHandleLabel", { name: c }),
|
|
449
|
+
attributes: m.attributes,
|
|
450
|
+
listeners: m.listeners,
|
|
451
|
+
activatorRef: m.setActivatorNodeRef,
|
|
452
|
+
"data-testid": `item-drag-handle-${e.id}`
|
|
453
|
+
}
|
|
454
|
+
) }) : null, f = /* @__PURE__ */ v(Z, { children: [
|
|
455
|
+
/* @__PURE__ */ n(bt, { module: t, item: e }),
|
|
456
|
+
/* @__PURE__ */ n(yt, { item: e })
|
|
227
457
|
] });
|
|
228
458
|
if (e.type === "sub_header")
|
|
229
|
-
return /* @__PURE__ */
|
|
230
|
-
|
|
459
|
+
return /* @__PURE__ */ n("div", { ref: m.setNodeRef, style: m.style, children: /* @__PURE__ */ n(
|
|
460
|
+
C,
|
|
231
461
|
{
|
|
232
462
|
as: "div",
|
|
233
463
|
padding: "x-small small",
|
|
234
464
|
borderWidth: "small 0 0 0",
|
|
235
465
|
"data-testid": `edit-item-${e.id}`,
|
|
236
|
-
children: /* @__PURE__ */
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
/* @__PURE__ */
|
|
466
|
+
children: /* @__PURE__ */ v(b, { alignItems: "center", gap: "small", children: [
|
|
467
|
+
M,
|
|
468
|
+
/* @__PURE__ */ v(b.Item, { shouldGrow: !0, shouldShrink: !0, children: [
|
|
469
|
+
/* @__PURE__ */ n(L, { weight: "bold", "data-testid": "edit-item-title", children: c }),
|
|
470
|
+
/* @__PURE__ */ n(N, { name: c })
|
|
240
471
|
] }),
|
|
241
|
-
|
|
472
|
+
f
|
|
242
473
|
] })
|
|
243
474
|
}
|
|
244
475
|
) });
|
|
245
|
-
const
|
|
246
|
-
key:
|
|
247
|
-
node:
|
|
248
|
-
icon:
|
|
249
|
-
})).filter((
|
|
250
|
-
return /* @__PURE__ */
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
|
|
255
|
-
/* @__PURE__ */
|
|
256
|
-
|
|
476
|
+
const I = ke(d.itemTypes, e.type), g = I != null && I.renderIcon ? I.renderIcon({ item: e }) : I == null ? void 0 : I.icon, h = ((F = (x = d.navigation).getItemEditHref) == null ? void 0 : F.call(x, e)) ?? null, R = { item: e, t: o, today: i, locale: u, timezone: s, formatters: r, config: d }, k = p.map((P) => ({
|
|
477
|
+
key: P.key,
|
|
478
|
+
node: P.render(R),
|
|
479
|
+
icon: P.key === Ce ? null : P.renderIcon ? P.renderIcon(R) : P.icon
|
|
480
|
+
})).filter((P) => !B(P.node)), y = /* @__PURE__ */ n(L, { weight: "bold", "data-testid": "edit-item-title", children: c });
|
|
481
|
+
return /* @__PURE__ */ n("div", { ref: m.setNodeRef, style: m.style, children: /* @__PURE__ */ n(C, { as: "div", padding: "small", borderWidth: "small 0 0 0", "data-testid": `edit-item-${e.id}`, children: /* @__PURE__ */ n("div", { style: { paddingInlineStart: `${Math.max(e.indent - 1, 0) * Ae}rem` }, children: /* @__PURE__ */ v(b, { alignItems: "center", gap: "small", children: [
|
|
482
|
+
M,
|
|
483
|
+
e.indent > 0 ? /* @__PURE__ */ n(b.Item, { "data-testid": "edit-item-nest-arrow", children: /* @__PURE__ */ n(Ge, { size: "md", color: "mutedColor" }) }) : null,
|
|
484
|
+
B(g) ? null : /* @__PURE__ */ n(b.Item, { "aria-hidden": "true", children: g }),
|
|
485
|
+
/* @__PURE__ */ v(b.Item, { shouldGrow: !0, shouldShrink: !0, children: [
|
|
486
|
+
h ? /* @__PURE__ */ n(ot, { href: h, forceButtonRole: !1, "data-testid": "edit-item-link", children: y }) : y,
|
|
487
|
+
/* @__PURE__ */ n(N, { name: c }),
|
|
488
|
+
k.length > 0 ? /* @__PURE__ */ n("div", { style: De, children: /* @__PURE__ */ n(
|
|
257
489
|
L,
|
|
258
490
|
{
|
|
259
491
|
size: "small",
|
|
260
492
|
lineHeight: "default",
|
|
261
493
|
color: "secondary",
|
|
262
494
|
"data-testid": "edit-item-meta",
|
|
263
|
-
children:
|
|
264
|
-
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
|
|
267
|
-
|
|
495
|
+
children: k.map((P, _) => /* @__PURE__ */ v(J, { children: [
|
|
496
|
+
_ > 0 ? /* @__PURE__ */ n("span", { style: V, children: " " }) : null,
|
|
497
|
+
/* @__PURE__ */ v("span", { style: _ > 0 ? l : void 0, children: [
|
|
498
|
+
B(P.icon) ? null : /* @__PURE__ */ n("span", { style: Q, "aria-hidden": "true", children: P.icon }),
|
|
499
|
+
P.node
|
|
268
500
|
] })
|
|
269
|
-
] },
|
|
501
|
+
] }, P.key))
|
|
270
502
|
}
|
|
271
503
|
) }) : null
|
|
272
504
|
] }),
|
|
273
|
-
/* @__PURE__ */
|
|
274
|
-
|
|
505
|
+
/* @__PURE__ */ n(b.Item, { children: /* @__PURE__ */ n(it, { "data-testid": "edit-item-requirement", children: e.completionRequirement ? o("itemRequiredTag") : o("itemOptionalTag") }) }),
|
|
506
|
+
f
|
|
275
507
|
] }) }) }) });
|
|
276
508
|
}
|
|
277
|
-
const
|
|
278
|
-
function
|
|
279
|
-
const
|
|
509
|
+
const kt = Le("grey"), W = (e) => `platform-modules-edit-panel-${e}`, O = { size: "sm", color: "onColor" };
|
|
510
|
+
function Ct(e, t, i, a) {
|
|
511
|
+
const o = [
|
|
280
512
|
{
|
|
281
513
|
key: "items",
|
|
282
|
-
icon: /* @__PURE__ */
|
|
283
|
-
text:
|
|
514
|
+
icon: /* @__PURE__ */ n(Xe, { ...O }),
|
|
515
|
+
text: i("moduleItemCount", { count: e.itemCount })
|
|
284
516
|
}
|
|
285
517
|
], u = [];
|
|
286
|
-
e.unlockAt && new Date(e.unlockAt) >
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
count:
|
|
291
|
-
prerequisites:
|
|
518
|
+
e.unlockAt && new Date(e.unlockAt) > t && u.push(a.unlockByline(e.unlockAt, t));
|
|
519
|
+
const s = e.prerequisiteModules.map((d) => d.name.trim()).filter(Boolean);
|
|
520
|
+
s.length === 1 ? u.push(i("lockedByPrerequisiteByline", { name: s[0] })) : s.length > 1 && u.push(
|
|
521
|
+
i("lockedByPrerequisitesByline", {
|
|
522
|
+
count: s.length,
|
|
523
|
+
prerequisites: s.join(", ")
|
|
292
524
|
})
|
|
293
|
-
), u.length > 0 &&
|
|
525
|
+
), u.length > 0 && o.push({ key: "lock", icon: /* @__PURE__ */ n(et, { ...O }), text: u.join(" ") }), e.completionRequirements && e.completionRequirements.length > 0 && o.push({
|
|
294
526
|
key: "requirement",
|
|
295
|
-
icon: /* @__PURE__ */
|
|
296
|
-
text: e.requireSequentialProgress ?
|
|
527
|
+
icon: /* @__PURE__ */ n(Je, { ...O }),
|
|
528
|
+
text: e.requireSequentialProgress ? i("moduleRequirementAllInOrder") : e.requirementCount === 1 ? i("moduleRequirementOne") : i("moduleRequirementAll")
|
|
297
529
|
});
|
|
298
|
-
const
|
|
299
|
-
return
|
|
530
|
+
const r = we(e.items);
|
|
531
|
+
return r !== null && o.push({
|
|
300
532
|
key: "duration",
|
|
301
|
-
icon: /* @__PURE__ */
|
|
302
|
-
text:
|
|
303
|
-
}),
|
|
533
|
+
icon: /* @__PURE__ */ n(Ze, { ...O }),
|
|
534
|
+
text: a.estimatedDurationByline(r)
|
|
535
|
+
}), o;
|
|
304
536
|
}
|
|
305
|
-
function
|
|
537
|
+
function Dt({
|
|
306
538
|
module: e,
|
|
307
|
-
state:
|
|
308
|
-
today:
|
|
539
|
+
state: t,
|
|
540
|
+
today: i,
|
|
541
|
+
canReorder: a
|
|
309
542
|
}) {
|
|
310
|
-
const { t:
|
|
311
|
-
if (
|
|
312
|
-
return /* @__PURE__ */
|
|
313
|
-
|
|
543
|
+
const { t: o } = w();
|
|
544
|
+
if (t.error)
|
|
545
|
+
return /* @__PURE__ */ n(C, { as: "div", padding: "small", children: /* @__PURE__ */ n(
|
|
546
|
+
ne,
|
|
314
547
|
{
|
|
315
548
|
variant: "error",
|
|
316
549
|
margin: "0",
|
|
317
|
-
liveRegion:
|
|
550
|
+
liveRegion: te,
|
|
318
551
|
liveRegionPoliteness: "assertive",
|
|
319
552
|
"data-testid": "edit-items-error",
|
|
320
|
-
children:
|
|
553
|
+
children: o("itemsLoadErrorAlert", { message: t.error.message })
|
|
321
554
|
}
|
|
322
555
|
) });
|
|
323
|
-
if (
|
|
324
|
-
return /* @__PURE__ */
|
|
325
|
-
if (
|
|
326
|
-
return /* @__PURE__ */
|
|
327
|
-
const
|
|
328
|
-
|
|
556
|
+
if (t.isLoading)
|
|
557
|
+
return /* @__PURE__ */ n(C, { as: "div", padding: "small", "data-testid": "edit-items-loading", children: /* @__PURE__ */ n(re, { size: "x-small", renderTitle: o("itemsLoadingSpinnerLabel") }) });
|
|
558
|
+
if (t.items.length === 0)
|
|
559
|
+
return /* @__PURE__ */ n(C, { as: "div", padding: "small", "data-testid": "edit-items-empty", children: /* @__PURE__ */ n(L, { size: "small", color: "secondary", children: o("noItemsEmptyState") }) });
|
|
560
|
+
const u = (s) => {
|
|
561
|
+
s === 1 ? t.goToFirstPage() : s === t.page - 1 ? t.goToPreviousPage() : s === t.page + 1 ? t.goToNextPage() : s === t.pageCount && t.goToLastPage();
|
|
329
562
|
};
|
|
330
|
-
return /* @__PURE__ */
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
|
|
333
|
-
|
|
563
|
+
return /* @__PURE__ */ v(Z, { children: [
|
|
564
|
+
/* @__PURE__ */ n(
|
|
565
|
+
de,
|
|
566
|
+
{
|
|
567
|
+
id: dt(e.id),
|
|
568
|
+
items: t.items.map((s) => ce(s.id)),
|
|
569
|
+
strategy: se,
|
|
570
|
+
children: /* @__PURE__ */ n(tt, { isUnstyled: !0, margin: "none", "data-testid": "edit-items-list", children: t.items.map((s) => /* @__PURE__ */ n(nt, { children: /* @__PURE__ */ n(
|
|
571
|
+
Pt,
|
|
572
|
+
{
|
|
573
|
+
item: s,
|
|
574
|
+
module: e,
|
|
575
|
+
today: i,
|
|
576
|
+
canReorder: a
|
|
577
|
+
}
|
|
578
|
+
) }, s.id)) })
|
|
579
|
+
}
|
|
580
|
+
),
|
|
581
|
+
t.pageCount > 1 ? /* @__PURE__ */ n(
|
|
582
|
+
oe,
|
|
334
583
|
{
|
|
335
584
|
as: "nav",
|
|
336
585
|
variant: "compact",
|
|
337
586
|
withFirstAndLastButton: !0,
|
|
338
587
|
margin: "small",
|
|
339
|
-
label: /* @__PURE__ */
|
|
340
|
-
labelFirst:
|
|
341
|
-
labelPrev:
|
|
342
|
-
labelNext:
|
|
343
|
-
labelLast:
|
|
344
|
-
screenReaderLabelPageButton: (
|
|
345
|
-
ellipsis:
|
|
346
|
-
totalPageNumber:
|
|
347
|
-
currentPage:
|
|
348
|
-
disabled:
|
|
349
|
-
onPageChange:
|
|
588
|
+
label: /* @__PURE__ */ n(We, { children: o("itemsPaginationLabel", { name: e.name }) }),
|
|
589
|
+
labelFirst: o("paginationFirstPage"),
|
|
590
|
+
labelPrev: o("paginationPreviousPage"),
|
|
591
|
+
labelNext: o("paginationNextPage"),
|
|
592
|
+
labelLast: o("paginationLastPage"),
|
|
593
|
+
screenReaderLabelPageButton: (s) => o("paginationPageLabel", { page: s }),
|
|
594
|
+
ellipsis: o("paginationEllipsis"),
|
|
595
|
+
totalPageNumber: t.pageCount,
|
|
596
|
+
currentPage: t.page,
|
|
597
|
+
disabled: t.isRefreshing,
|
|
598
|
+
onPageChange: u,
|
|
350
599
|
"data-testid": "edit-items-pagination"
|
|
351
600
|
}
|
|
352
601
|
) : null
|
|
353
602
|
] });
|
|
354
603
|
}
|
|
355
|
-
function
|
|
604
|
+
function At({
|
|
356
605
|
module: e,
|
|
357
|
-
expanded:
|
|
358
|
-
onToggle:
|
|
359
|
-
itemsState:
|
|
360
|
-
today:
|
|
361
|
-
|
|
606
|
+
expanded: t,
|
|
607
|
+
onToggle: i,
|
|
608
|
+
itemsState: a,
|
|
609
|
+
today: o,
|
|
610
|
+
canReorderModules: u,
|
|
611
|
+
canReorderItems: s,
|
|
612
|
+
headingLevel: r = "h3"
|
|
362
613
|
}) {
|
|
363
|
-
var
|
|
364
|
-
const { t:
|
|
365
|
-
|
|
366
|
-
|
|
614
|
+
var I;
|
|
615
|
+
const { t: d } = w(), l = Y(), p = G(), c = pe(
|
|
616
|
+
le(e.id),
|
|
617
|
+
{ kind: "module", moduleId: e.id, name: e.name },
|
|
618
|
+
u
|
|
619
|
+
), m = ((I = l.moduleLabel(e.position, e)) == null ? void 0 : I.trim()) || null, M = m ? d("moduleNameWithLabel", { label: m, name: e.name }) : e.name, f = Ct(e, o, d, l);
|
|
620
|
+
return /* @__PURE__ */ n("div", { ref: c.setNodeRef, style: c.style, children: /* @__PURE__ */ v(
|
|
621
|
+
C,
|
|
367
622
|
{
|
|
368
623
|
as: "div",
|
|
369
624
|
background: "primary",
|
|
@@ -375,117 +630,138 @@ function $e({
|
|
|
375
630
|
overflowY: "hidden",
|
|
376
631
|
"data-testid": `edit-module-card-${e.id}`,
|
|
377
632
|
children: [
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
-
|
|
633
|
+
/* @__PURE__ */ n(
|
|
634
|
+
C,
|
|
380
635
|
{
|
|
381
636
|
as: "div",
|
|
382
637
|
background: e.published ? "success" : "primary-inverse",
|
|
383
|
-
themeOverride: e.published ? void 0 :
|
|
638
|
+
themeOverride: e.published ? void 0 : kt,
|
|
384
639
|
padding: "small",
|
|
385
640
|
"data-testid": "edit-module-header",
|
|
386
641
|
"data-published": e.published ? "true" : "false",
|
|
387
|
-
children: /* @__PURE__ */
|
|
388
|
-
/* @__PURE__ */
|
|
642
|
+
children: /* @__PURE__ */ v(b, { alignItems: "start", gap: "small", children: [
|
|
643
|
+
u ? /* @__PURE__ */ n(b.Item, { children: /* @__PURE__ */ n(
|
|
389
644
|
he,
|
|
645
|
+
{
|
|
646
|
+
label: d("dragHandleLabel", { name: e.name }),
|
|
647
|
+
attributes: c.attributes,
|
|
648
|
+
listeners: c.listeners,
|
|
649
|
+
activatorRef: c.setActivatorNodeRef,
|
|
650
|
+
color: "primary-inverse",
|
|
651
|
+
"data-testid": `module-drag-handle-${e.id}`
|
|
652
|
+
}
|
|
653
|
+
) }) : null,
|
|
654
|
+
/* @__PURE__ */ n(b.Item, { children: /* @__PURE__ */ n(
|
|
655
|
+
ae,
|
|
390
656
|
{
|
|
391
657
|
size: "small",
|
|
392
658
|
withBackground: !1,
|
|
393
659
|
withBorder: !1,
|
|
394
660
|
color: "primary-inverse",
|
|
395
|
-
screenReaderLabel:
|
|
396
|
-
"aria-expanded":
|
|
397
|
-
"aria-controls":
|
|
398
|
-
onClick: () =>
|
|
661
|
+
screenReaderLabel: t ? d("collapseModule", { name: e.name }) : d("expandModule", { name: e.name }),
|
|
662
|
+
"aria-expanded": t,
|
|
663
|
+
"aria-controls": W(e.id),
|
|
664
|
+
onClick: () => i(e.id),
|
|
399
665
|
"data-testid": `edit-toggle-module-${e.id}`,
|
|
400
|
-
children:
|
|
666
|
+
children: t ? /* @__PURE__ */ n(Ve, {}) : /* @__PURE__ */ n(Qe, {})
|
|
401
667
|
}
|
|
402
668
|
) }),
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
-
|
|
669
|
+
/* @__PURE__ */ v(b.Item, { shouldGrow: !0, shouldShrink: !0, children: [
|
|
670
|
+
/* @__PURE__ */ n(
|
|
671
|
+
ie,
|
|
406
672
|
{
|
|
407
|
-
level:
|
|
673
|
+
level: r,
|
|
408
674
|
variant: "titleCardMini",
|
|
409
675
|
color: "primary-on",
|
|
410
|
-
"aria-label":
|
|
676
|
+
"aria-label": M,
|
|
411
677
|
"data-testid": "edit-module-name",
|
|
412
|
-
children: /* @__PURE__ */
|
|
678
|
+
children: /* @__PURE__ */ n(Be, { linesAllowed: 2, children: M })
|
|
413
679
|
}
|
|
414
680
|
),
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
420
|
-
|
|
681
|
+
/* @__PURE__ */ n(N, { name: e.name }),
|
|
682
|
+
/* @__PURE__ */ n(C, { as: "div", margin: "xx-small 0 0 0", children: /* @__PURE__ */ n(L, { size: "small", color: "primary-on", "data-testid": "edit-module-meta", children: f.map((g, h) => /* @__PURE__ */ v(J, { children: [
|
|
683
|
+
h > 0 ? /* @__PURE__ */ n("span", { style: V, children: " " }) : null,
|
|
684
|
+
/* @__PURE__ */ v("span", { style: h > 0 ? p : void 0, children: [
|
|
685
|
+
/* @__PURE__ */ n("span", { style: Q, "aria-hidden": "true", children: g.icon }),
|
|
686
|
+
g.text
|
|
421
687
|
] })
|
|
422
|
-
] },
|
|
688
|
+
] }, g.key)) }) })
|
|
423
689
|
] }),
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
690
|
+
/* @__PURE__ */ n(ft, { module: e }),
|
|
691
|
+
/* @__PURE__ */ n(vt, { module: e }),
|
|
692
|
+
/* @__PURE__ */ n(It, { module: e }),
|
|
693
|
+
/* @__PURE__ */ n(Mt, { module: e })
|
|
428
694
|
] })
|
|
429
695
|
}
|
|
430
696
|
),
|
|
431
|
-
/* @__PURE__ */
|
|
697
|
+
/* @__PURE__ */ n("div", { id: W(e.id), role: "group", "aria-label": e.name, hidden: !t, children: t ? /* @__PURE__ */ n(
|
|
698
|
+
Dt,
|
|
699
|
+
{
|
|
700
|
+
module: e,
|
|
701
|
+
state: a,
|
|
702
|
+
today: o,
|
|
703
|
+
canReorder: s
|
|
704
|
+
}
|
|
705
|
+
) : null })
|
|
432
706
|
]
|
|
433
707
|
}
|
|
434
|
-
);
|
|
708
|
+
) });
|
|
435
709
|
}
|
|
436
|
-
function
|
|
710
|
+
function Lt({
|
|
437
711
|
data: e,
|
|
438
|
-
today:
|
|
439
|
-
cardHeadingLevel:
|
|
712
|
+
today: t,
|
|
713
|
+
cardHeadingLevel: i
|
|
440
714
|
}) {
|
|
441
|
-
const { modules:
|
|
442
|
-
return /* @__PURE__ */
|
|
443
|
-
|
|
715
|
+
const { modules: a, expandedModuleIds: o, toggleModule: u, getItems: s, can: r } = e, d = lt() === "module";
|
|
716
|
+
return /* @__PURE__ */ n("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, "data-testid": "edit-modules-stack", children: a.map((l) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
717
|
+
At,
|
|
444
718
|
{
|
|
445
|
-
module:
|
|
446
|
-
expanded:
|
|
719
|
+
module: l,
|
|
720
|
+
expanded: !d && o.includes(l.id),
|
|
447
721
|
onToggle: u,
|
|
448
|
-
itemsState:
|
|
449
|
-
today:
|
|
450
|
-
|
|
722
|
+
itemsState: s(l.id),
|
|
723
|
+
today: t,
|
|
724
|
+
canReorderModules: r.reorderModules,
|
|
725
|
+
canReorderItems: r.reorderModuleItems,
|
|
726
|
+
headingLevel: i
|
|
451
727
|
}
|
|
452
|
-
) },
|
|
728
|
+
) }, l.id)) });
|
|
453
729
|
}
|
|
454
|
-
function
|
|
730
|
+
function tn({
|
|
455
731
|
data: e,
|
|
456
|
-
today:
|
|
457
|
-
as:
|
|
458
|
-
headingLevel:
|
|
732
|
+
today: t,
|
|
733
|
+
as: i = "div",
|
|
734
|
+
headingLevel: a = "h2"
|
|
459
735
|
}) {
|
|
460
|
-
const { t:
|
|
736
|
+
const { t: o } = w(), {
|
|
461
737
|
modules: u,
|
|
462
|
-
page:
|
|
463
|
-
pageCount:
|
|
464
|
-
goToFirstPage:
|
|
465
|
-
goToPreviousPage:
|
|
738
|
+
page: s,
|
|
739
|
+
pageCount: r,
|
|
740
|
+
goToFirstPage: d,
|
|
741
|
+
goToPreviousPage: l,
|
|
466
742
|
goToNextPage: p,
|
|
467
|
-
goToLastPage:
|
|
743
|
+
goToLastPage: c,
|
|
468
744
|
isLoading: m,
|
|
469
|
-
isRefreshing:
|
|
470
|
-
error:
|
|
471
|
-
} = e, [
|
|
472
|
-
|
|
745
|
+
isRefreshing: M,
|
|
746
|
+
error: f
|
|
747
|
+
} = e, [I] = X(() => /* @__PURE__ */ new Date()), g = a === "h1" ? "h2" : "h3", h = m || M && u.length === 0, R = u.length === 0 && !h && !f, k = (y) => {
|
|
748
|
+
y === 1 ? d() : y === s - 1 ? l() : y === s + 1 ? p() : y === r && c();
|
|
473
749
|
};
|
|
474
|
-
return /* @__PURE__ */
|
|
475
|
-
|
|
476
|
-
|
|
750
|
+
return /* @__PURE__ */ v(C, { as: i, display: "block", "data-testid": "modules-edit-view", children: [
|
|
751
|
+
f ? /* @__PURE__ */ n(
|
|
752
|
+
ne,
|
|
477
753
|
{
|
|
478
754
|
variant: "error",
|
|
479
755
|
margin: "0 0 small 0",
|
|
480
|
-
liveRegion:
|
|
756
|
+
liveRegion: te,
|
|
481
757
|
liveRegionPoliteness: "assertive",
|
|
482
758
|
"data-testid": "edit-modules-error",
|
|
483
|
-
children:
|
|
759
|
+
children: o("modulesLoadErrorAlert", { message: f.message })
|
|
484
760
|
}
|
|
485
761
|
) : null,
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
762
|
+
h ? /* @__PURE__ */ n(C, { as: "div", padding: "large", textAlign: "center", "data-testid": "edit-modules-loading", children: /* @__PURE__ */ n(re, { renderTitle: o("modulesLoadingSpinnerLabel") }) }) : null,
|
|
763
|
+
R ? /* @__PURE__ */ v(
|
|
764
|
+
C,
|
|
489
765
|
{
|
|
490
766
|
as: "div",
|
|
491
767
|
background: "primary",
|
|
@@ -496,75 +772,81 @@ function ut({
|
|
|
496
772
|
textAlign: "center",
|
|
497
773
|
"data-testid": "edit-modules-empty",
|
|
498
774
|
children: [
|
|
499
|
-
/* @__PURE__ */
|
|
500
|
-
/* @__PURE__ */
|
|
775
|
+
/* @__PURE__ */ n(ie, { level: g, variant: "titleCardLarge", margin: "0 0 x-small 0", children: o("editNoModulesTitle") }),
|
|
776
|
+
/* @__PURE__ */ n(L, { color: "secondary", children: o("editNoModulesDescription") })
|
|
501
777
|
]
|
|
502
778
|
}
|
|
503
779
|
) : null,
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
-
|
|
780
|
+
/* @__PURE__ */ n(ht, { data: e, children: /* @__PURE__ */ n(
|
|
781
|
+
Lt,
|
|
506
782
|
{
|
|
507
783
|
data: e,
|
|
508
|
-
today:
|
|
509
|
-
cardHeadingLevel:
|
|
784
|
+
today: t ?? I,
|
|
785
|
+
cardHeadingLevel: g
|
|
510
786
|
}
|
|
511
|
-
),
|
|
512
|
-
|
|
513
|
-
|
|
787
|
+
) }),
|
|
788
|
+
r > 1 && !h ? /* @__PURE__ */ n(
|
|
789
|
+
oe,
|
|
514
790
|
{
|
|
515
791
|
as: "nav",
|
|
516
792
|
variant: "compact",
|
|
517
793
|
withFirstAndLastButton: !0,
|
|
518
794
|
margin: "small 0 0 0",
|
|
519
|
-
labelFirst:
|
|
520
|
-
labelPrev:
|
|
521
|
-
labelNext:
|
|
522
|
-
labelLast:
|
|
523
|
-
screenReaderLabelPageButton: (
|
|
524
|
-
ellipsis:
|
|
525
|
-
totalPageNumber:
|
|
526
|
-
currentPage:
|
|
527
|
-
disabled:
|
|
528
|
-
onPageChange:
|
|
795
|
+
labelFirst: o("paginationFirstPage"),
|
|
796
|
+
labelPrev: o("paginationPreviousPage"),
|
|
797
|
+
labelNext: o("paginationNextPage"),
|
|
798
|
+
labelLast: o("paginationLastPage"),
|
|
799
|
+
screenReaderLabelPageButton: (y) => o("paginationPageLabel", { page: y }),
|
|
800
|
+
ellipsis: o("paginationEllipsis"),
|
|
801
|
+
totalPageNumber: r,
|
|
802
|
+
currentPage: s,
|
|
803
|
+
disabled: M,
|
|
804
|
+
onPageChange: k,
|
|
529
805
|
"data-testid": "edit-modules-pagination"
|
|
530
806
|
}
|
|
531
807
|
) : null
|
|
532
808
|
] });
|
|
533
809
|
}
|
|
534
|
-
function
|
|
810
|
+
function wt(e) {
|
|
535
811
|
return null;
|
|
536
812
|
}
|
|
537
|
-
function
|
|
813
|
+
function Rt(e) {
|
|
538
814
|
return null;
|
|
539
815
|
}
|
|
540
|
-
function
|
|
816
|
+
function St(e) {
|
|
541
817
|
return null;
|
|
542
818
|
}
|
|
543
|
-
function
|
|
544
|
-
const { t
|
|
545
|
-
|
|
819
|
+
function nn({ data: e }) {
|
|
820
|
+
const { t } = w(), i = Re(), { expandedModuleIds: a, collapseAllModules: o, isPersistingCollapsed: u } = e, s = a.length, r = () => {
|
|
821
|
+
i("collapse-all"), o(), ee(t("modulesCollapsedAnnouncement", { count: s }));
|
|
546
822
|
};
|
|
547
|
-
return /* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
|
|
823
|
+
return /* @__PURE__ */ v(b, { gap: "x-small", wrap: "wrap", justifyItems: "end", "data-testid": "modules-edit-actions", children: [
|
|
824
|
+
/* @__PURE__ */ n(b.Item, { children: /* @__PURE__ */ n(
|
|
825
|
+
Ke,
|
|
550
826
|
{
|
|
551
827
|
size: "small",
|
|
552
|
-
onClick:
|
|
553
|
-
interaction:
|
|
828
|
+
onClick: r,
|
|
829
|
+
interaction: s === 0 || u ? "disabled" : "enabled",
|
|
554
830
|
"data-testid": "edit-collapse-all",
|
|
555
|
-
children:
|
|
831
|
+
children: t("collapseAllModules")
|
|
556
832
|
}
|
|
557
833
|
) }),
|
|
558
|
-
/* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
/* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ n(St, { data: e }),
|
|
835
|
+
/* @__PURE__ */ n(wt, { data: e }),
|
|
836
|
+
/* @__PURE__ */ n(Rt, { data: e })
|
|
561
837
|
] });
|
|
562
838
|
}
|
|
563
839
|
export {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
840
|
+
ht as EditDndProvider,
|
|
841
|
+
At as EditModuleCard,
|
|
842
|
+
Pt as EditModuleItemRow,
|
|
843
|
+
nn as ModulesEditActions,
|
|
844
|
+
tn as ModulesEditView,
|
|
845
|
+
Jt as createInMemoryEditAdapter,
|
|
846
|
+
D as dragDataOf,
|
|
847
|
+
en as externalDragId,
|
|
848
|
+
ce as itemDragId,
|
|
849
|
+
le as moduleDragId,
|
|
850
|
+
lt as useActiveDragKind,
|
|
851
|
+
Zt as useModulesEditData
|
|
570
852
|
};
|