ode-explorer 1.5.2 → 1.5.3-develop-rc.202412091521

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.
Files changed (89) hide show
  1. package/dist/EcritureA-Romain-Orne.woff2 +0 -0
  2. package/dist/KGJuneBug.ttf +0 -0
  3. package/dist/OpenDyslexic.woff +0 -0
  4. package/dist/christmas.png +0 -0
  5. package/dist/circus.jpg +0 -0
  6. package/dist/desert.jpg +0 -0
  7. package/dist/hills.svg +360 -0
  8. package/dist/illu-blog.svg +1 -0
  9. package/dist/illu-collaborativewall.svg +1 -0
  10. package/dist/illu-empty-search-blog.svg +25 -0
  11. package/dist/illu-empty-search-blog2.svg +25 -0
  12. package/dist/illu-empty-search-collaborativewall.svg +25 -0
  13. package/dist/illu-empty-search-collaborativewall2.svg +25 -0
  14. package/dist/illu-empty-search-formulaire.svg +27 -0
  15. package/dist/illu-empty-search-formulaire2.svg +27 -0
  16. package/dist/illu-empty-search-forum.svg +25 -0
  17. package/dist/illu-empty-search-forum2.svg +25 -0
  18. package/dist/illu-empty-search-homeworks.svg +25 -0
  19. package/dist/illu-empty-search-homeworks2.svg +25 -0
  20. package/dist/illu-empty-search-wiki.svg +26 -0
  21. package/dist/illu-empty-search-wiki2.svg +26 -0
  22. package/dist/illu-empty-search.svg +62 -0
  23. package/dist/illu-empty-search2.svg +62 -0
  24. package/dist/illu-error.svg +60 -0
  25. package/dist/illu-exercizer.svg +1 -0
  26. package/dist/illu-mindmap.svg +1 -0
  27. package/dist/illu-no-content-in-folder.svg +31 -0
  28. package/dist/illu-pad.svg +1 -0
  29. package/dist/illu-scrapbook.svg +1 -0
  30. package/dist/illu-search.svg +1 -0
  31. package/dist/illu-timeline.svg +1 -0
  32. package/dist/illu-timelinegenerator.svg +1 -0
  33. package/dist/illu-trash.svg +1 -0
  34. package/dist/illu-wiki.svg +15 -0
  35. package/dist/image-library.svg +188 -0
  36. package/dist/image-library2.svg +188 -0
  37. package/dist/image-placeholder.png +0 -0
  38. package/dist/index.html +2 -1
  39. package/dist/index.js +236 -231
  40. package/dist/ocean.jpg +0 -0
  41. package/dist/panda.jpg +0 -0
  42. package/dist/screen-loading.gif +0 -0
  43. package/dist/sparkly.jpg +0 -0
  44. package/dist/style.css +1 -0
  45. package/dist/version.txt +1 -1
  46. package/lib/components/OnboardingModal.d.ts +1 -1
  47. package/lib/config/explorer.d.ts +1 -1
  48. package/lib/features/AccessControl/AccessControl.d.ts +1 -1
  49. package/lib/features/AccessControl/useAccessControl.d.ts +1 -1
  50. package/lib/features/ActionBar/Move/useMoveModal.d.ts +1 -1
  51. package/lib/features/ActionBar/Publish/PublishModal.d.ts +1 -1
  52. package/lib/features/ActionBar/Resource/ResourceModal.d.ts +1 -1
  53. package/lib/features/ActionBar/Share/ShareModal.d.ts +1 -1
  54. package/lib/features/ActionBar/useActionBar.d.ts +2 -2
  55. package/lib/features/List/DraggableCard.d.ts +1 -1
  56. package/lib/features/List/FolderCard.d.ts +2 -2
  57. package/lib/features/List/FoldersList.d.ts +1 -1
  58. package/lib/features/List/ResourceCard.d.ts +2 -2
  59. package/lib/features/List/ResourcesList.d.ts +1 -1
  60. package/lib/index.js +58529 -3
  61. package/lib/services/api/index.d.ts +14 -14
  62. package/lib/services/queries/actions.d.ts +1 -1
  63. package/lib/services/queries/index.d.ts +9 -9
  64. package/lib/services/resource/service.d.ts +1 -1
  65. package/lib/store/index.d.ts +2 -2
  66. package/lib/utils/getChildrenIds.d.ts +1 -1
  67. package/lib/utils/isResourceShared.d.ts +1 -1
  68. package/package.json +4 -5
  69. package/lib/ActionBarContainer.js +0 -312
  70. package/lib/AppAction.js +0 -35
  71. package/lib/DeleteModal.js +0 -46
  72. package/lib/DisableModal.js +0 -20
  73. package/lib/DraggableCard.js +0 -25
  74. package/lib/EmptyScreenApp.js +0 -40
  75. package/lib/EmptyScreenError.js +0 -12
  76. package/lib/EmptyScreenNoContentInFolder.js +0 -18
  77. package/lib/EmptyScreenSearch.js +0 -18
  78. package/lib/EmptyScreenTrash.js +0 -16
  79. package/lib/ExportModal.js +0 -47
  80. package/lib/FolderModal.js +0 -116
  81. package/lib/FoldersList.js +0 -104
  82. package/lib/Library.js +0 -36
  83. package/lib/MoveModal.js +0 -87
  84. package/lib/OnboardingModal.js +0 -5
  85. package/lib/PublishModal.js +0 -5
  86. package/lib/ResourceModal.js +0 -5
  87. package/lib/ResourcesList.js +0 -133
  88. package/lib/TrashModal.js +0 -20
  89. package/lib/index2.js +0 -1531
package/lib/index2.js DELETED
@@ -1,1531 +0,0 @@
1
- import { jsxs as E, Fragment as G, jsx as c } from "react/jsx-runtime";
2
- import { useEffect as $, Suspense as M, lazy as q, useState as le, useRef as Se, Fragment as be } from "react";
3
- import { useSensor as oe, PointerSensor as we, KeyboardSensor as xe, useSensors as Te, DndContext as Ce } from "@dnd-kit/core";
4
- import { snapCenterToCursor as Fe } from "@dnd-kit/modifiers";
5
- import { findNodeById as J, wrapTreeNode as Re, findParentNode as Ne, useToast as L, moveNode as Ee, deleteNode as Pe, useUser as de, useShareMutation as Ae, useUpdateMutation as Qe, useOdeClient as v, addNode as qe, updateNode as Oe, getAncestors as ne, LoadingScreen as U, FormControl as ke, Input as Ue, SearchButton as Me, Dropdown as j, useToggle as Le, useScrollToTop as ve, TreeView as Be, Button as Ke, IconButton as $e, useXitiTrackPageLoad as _e, isActionAvailable as ae, AppHeader as ze, Breadcrumb as je, Grid as te } from "@edifice-ui/react";
6
- import { odeServices as A, FOLDER as N, SORT_ORDER as Ve, ResourceService as ue } from "edifice-ts-client";
7
- import { t as P } from "i18next";
8
- import { createStore as We, useStore as He } from "zustand";
9
- import { useQuery as Ge, queryOptions as Je, useQueryClient as k, useMutation as B, useInfiniteQuery as Xe } from "@tanstack/react-query";
10
- import { useTranslation as _ } from "react-i18next";
11
- import { Filter as Ye, Delete as Ze, Plus as et, ArrowLeft as tt } from "@edifice-ui/icons";
12
- const he = async (e) => {
13
- const t = await A.resource(e.application).searchContext(e);
14
- return {
15
- ...t,
16
- folders: t.folders.filter((s) => !s.trashed)
17
- };
18
- }, st = async ({
19
- searchParams: e,
20
- name: t,
21
- parentId: s
22
- }) => {
23
- const r = {
24
- name: t,
25
- parentId: s,
26
- application: e.application,
27
- type: e.types[0]
28
- };
29
- return await A.resource(e.application).createFolder(r);
30
- }, rt = async ({
31
- folderId: e,
32
- searchParams: t,
33
- parentId: s,
34
- name: r
35
- }) => {
36
- const o = {
37
- folderId: e,
38
- name: r,
39
- parentId: s,
40
- application: t.application,
41
- type: t.types[0]
42
- };
43
- return await A.resource(t.application).updateFolder(o);
44
- }, ot = async ({
45
- searchParams: e,
46
- resourceIds: t,
47
- useAssetIds: s,
48
- folderIds: r
49
- }) => {
50
- const o = {
51
- application: e.application,
52
- resourceType: e.types[0],
53
- resourceIds: t,
54
- folderIds: r
55
- };
56
- return await A.resource(e.application).trashAll(o, s);
57
- }, nt = async ({
58
- searchParams: e,
59
- resourceIds: t,
60
- useAssetIds: s,
61
- folderIds: r
62
- }) => {
63
- const o = {
64
- application: e.application,
65
- resourceType: e.types[0],
66
- resourceIds: t,
67
- folderIds: r
68
- };
69
- return await A.resource(e.application).deleteAll(o, s);
70
- }, at = async ({
71
- searchParams: e,
72
- resourceIds: t,
73
- folderIds: s,
74
- useAssetIds: r
75
- }) => {
76
- const o = {
77
- application: e.application,
78
- resourceType: e.types[0],
79
- resourceIds: t,
80
- folderIds: s
81
- };
82
- return await A.resource(e.application).restoreAll(o, r);
83
- }, ct = async (e, t) => await A.resource(e.application).copy({
84
- application: e.application,
85
- resourceId: t
86
- }), pe = async ({
87
- searchParams: e,
88
- resourceIds: t,
89
- folderId: s,
90
- folderIds: r,
91
- useAssetIds: o
92
- }) => {
93
- const a = {
94
- application: e.application,
95
- folderId: s,
96
- resourceIds: t,
97
- folderIds: r
98
- };
99
- return await A.resource(e.application).moveToFolder(a, o);
100
- }, it = async (e) => await A.rights().sessionHasWorkflowRights(e), lt = ({
101
- searchParams: e,
102
- assetId: t
103
- }) => {
104
- const s = A.resource(e.application).getViewUrl(t);
105
- window.open(s, "_self");
106
- }, dt = ({
107
- searchParams: e,
108
- params: t
109
- }) => A.resource(e.application).create(t), ut = ({
110
- searchParams: e,
111
- assetId: t
112
- }) => {
113
- const s = A.resource(e.application).getPrintUrl(t);
114
- return window.open(s, "_blank");
115
- }, is = ({
116
- searchParams: e,
117
- folderId: t
118
- }) => {
119
- const s = A.resource(e.application).getFormUrl(t);
120
- return window.open(s, "_self");
121
- }, ls = ({
122
- searchParams: e,
123
- assetId: t
124
- }) => {
125
- const s = A.resource(e.application).getEditUrl(t);
126
- return window.open(s, "_self");
127
- }, ds = ({
128
- searchParams: e,
129
- assetId: t
130
- }) => {
131
- const s = A.resource(e.application).getExportUrl(t);
132
- return window.open(s, "_self");
133
- }, fe = {
134
- id: N.DEFAULT,
135
- name: P("explorer.filters.mine"),
136
- section: !0,
137
- children: []
138
- }, ht = {
139
- config: void 0,
140
- searchConfig: {
141
- minLength: 1
142
- },
143
- searchParams: {
144
- filters: {
145
- folder: N.DEFAULT,
146
- owner: void 0,
147
- shared: void 0,
148
- public: void 0
149
- },
150
- orders: {
151
- updatedAt: Ve.DESC
152
- },
153
- application: "",
154
- types: [],
155
- pagination: {
156
- startIdx: 0,
157
- pageSize: 48,
158
- maxIdx: 0
159
- },
160
- trashed: !1
161
- },
162
- treeData: fe,
163
- selectedNodeId: "default",
164
- currentFolder: {
165
- id: "default"
166
- },
167
- selectedFolders: [],
168
- selectedResources: [],
169
- folderIds: [],
170
- resourceIds: [],
171
- resourceIsTrash: !1,
172
- resourceOrFolderIsDraggable: {
173
- isDrag: !1,
174
- elementDrag: void 0
175
- },
176
- elementDragOver: {
177
- isOver: !1,
178
- isTreeview: !1,
179
- canMove: !0,
180
- overId: void 0
181
- },
182
- resourceActionDisable: !1,
183
- status: void 0
184
- }, pt = We()((e, t) => ({
185
- ...ht,
186
- actions: {
187
- setConfig: (s) => e({
188
- config: s
189
- }),
190
- setSearchConfig: (s) => e((r) => ({
191
- searchConfig: {
192
- ...r.searchConfig,
193
- ...s
194
- }
195
- })),
196
- setTreeData: (s) => e(() => ({
197
- treeData: s
198
- })),
199
- setSearchParams: (s) => {
200
- e((r) => {
201
- const {
202
- searchParams: o
203
- } = r;
204
- return o.search !== s.search ? s.search ? {
205
- ...r,
206
- selectedFolders: [],
207
- selectedNodeId: void 0,
208
- selectedResources: [],
209
- currentFolder: void 0,
210
- searchParams: {
211
- ...o,
212
- ...s,
213
- trashed: !1,
214
- filters: {
215
- ...o.filters,
216
- folder: void 0
217
- }
218
- }
219
- } : {
220
- ...r,
221
- selectedFolders: [],
222
- selectedNodeId: "default",
223
- selectedResources: [],
224
- currentFolder: {
225
- id: "default"
226
- },
227
- searchParams: {
228
- ...o,
229
- ...s,
230
- trashed: !1,
231
- filters: {
232
- ...o.filters
233
- }
234
- }
235
- } : {
236
- searchParams: {
237
- ...o,
238
- ...s
239
- }
240
- };
241
- });
242
- },
243
- setSelectedFolders: (s) => e(() => ({
244
- selectedFolders: s
245
- })),
246
- setSelectedResources: (s) => e(() => ({
247
- selectedResources: s
248
- })),
249
- setFolderIds: (s) => e(() => ({
250
- folderIds: s
251
- })),
252
- setResourceIds: (s) => e(() => ({
253
- resourceIds: s
254
- })),
255
- setResourceIsTrash: (s) => e(() => ({
256
- resourceIsTrash: s
257
- })),
258
- setResourceOrFolderIsDraggable: (s) => e(() => ({
259
- resourceOrFolderIsDraggable: s
260
- })),
261
- setElementDragOver: (s) => e(() => ({
262
- elementDragOver: s
263
- })),
264
- setResourceActionDisable: (s) => e(() => ({
265
- resourceActionDisable: s
266
- })),
267
- clearSelectedItems: () => e(() => ({
268
- selectedFolders: [],
269
- selectedResources: []
270
- })),
271
- clearSelectedIds: () => e(() => ({
272
- resourceIds: [],
273
- folderIds: []
274
- })),
275
- openResource: (s) => {
276
- try {
277
- const {
278
- searchParams: r
279
- } = t();
280
- lt({
281
- searchParams: r,
282
- assetId: s.assetId
283
- });
284
- } catch (r) {
285
- console.error("explorer open failed: ", r);
286
- }
287
- },
288
- printSelectedResource: () => {
289
- try {
290
- const {
291
- searchParams: s,
292
- selectedResources: r,
293
- resourceIds: o
294
- } = t();
295
- if (r.length !== 1)
296
- throw new Error("Cannot open more than 1 resource");
297
- const a = r.find((n) => n.id === o[0]);
298
- ut({
299
- searchParams: s,
300
- assetId: a.assetId
301
- });
302
- } catch (s) {
303
- console.error("explorer print failed: ", s);
304
- }
305
- },
306
- openFolder: ({
307
- folderId: s,
308
- folder: r,
309
- queryClient: o
310
- }) => {
311
- const {
312
- searchParams: a
313
- } = t(), n = a.filters.folder, u = s;
314
- n !== s && (t().actions.fetchTreeData(s, o), e((p) => ({
315
- ...p,
316
- // reset selection when changing folder
317
- folderIds: [],
318
- resourceIds: [],
319
- selectedNodeId: u,
320
- currentFolder: r || {
321
- id: s
322
- },
323
- searchParams: {
324
- ...a,
325
- search: void 0,
326
- filters: {
327
- ...a.filters,
328
- folder: s
329
- },
330
- trashed: s === N.BIN
331
- }
332
- })));
333
- },
334
- foldTreeItem: () => e((s) => ({
335
- ...s,
336
- status: "fold"
337
- })),
338
- fetchTreeData: async (s, r) => {
339
- const o = J(t().treeData, s), a = o == null ? void 0 : o.id;
340
- if (Array.isArray(o == null ? void 0 : o.children) && o.children.length) return;
341
- const n = await r.fetchQuery({
342
- queryKey: ["prefetchContext", {
343
- folderId: a,
344
- trashed: !1
345
- }],
346
- queryFn: async () => await he({
347
- ...t().searchParams,
348
- filters: {
349
- ...t().searchParams.filters,
350
- folder: a
351
- }
352
- })
353
- });
354
- t().actions.setTreeData(Re(t().treeData, n == null ? void 0 : n.folders, a || N.DEFAULT));
355
- },
356
- selectTreeItem: (s, r) => {
357
- const {
358
- treeData: o
359
- } = t(), {
360
- openFolder: a,
361
- fetchTreeData: n
362
- } = t().actions, u = J(o, s);
363
- n(s, r), e((p) => ({
364
- ...p,
365
- searchParams: {
366
- ...p.searchParams,
367
- search: void 0
368
- },
369
- status: "select",
370
- selectedResources: []
371
- })), a({
372
- folder: u,
373
- folderId: s
374
- });
375
- },
376
- gotoPreviousFolder: () => {
377
- const {
378
- selectedNodeId: s,
379
- treeData: r,
380
- searchParams: o
381
- } = t(), {
382
- openFolder: a
383
- } = t().actions;
384
- if (o.search && a({
385
- folder: fe,
386
- folderId: N.DEFAULT
387
- }), !s) return;
388
- const n = Ne(r, s);
389
- a({
390
- folder: n,
391
- folderId: (n == null ? void 0 : n.id) || N.DEFAULT
392
- });
393
- },
394
- goToTrash: () => {
395
- e((s) => ({
396
- ...s,
397
- selectedNodeId: void 0,
398
- selectedResources: [],
399
- resourceIds: [],
400
- folderIds: [],
401
- status: "select",
402
- searchParams: {
403
- ...s.searchParams,
404
- search: void 0,
405
- filters: {
406
- folder: N.BIN
407
- },
408
- trashed: !0
409
- },
410
- currentFolder: {
411
- id: N.BIN
412
- }
413
- }));
414
- }
415
- }
416
- }));
417
- function T(e) {
418
- return He(pt, e);
419
- }
420
- const ft = (e) => e.treeData, gt = (e) => e.actions, V = () => T(ft), F = () => T(gt), Q = () => T((e) => e.searchParams), se = () => T((e) => e.selectedNodeId), us = () => T((e) => e.selectedFolders), hs = () => T((e) => e.selectedResources), mt = () => T((e) => e.searchConfig), X = () => T((e) => e.folderIds), Y = () => T((e) => e.resourceIds), Z = () => T((e) => e.selectedResources.map((t) => t.assetId)), ee = () => T((e) => e.selectedResources.filter((t) => t.assetId === t.id)), W = () => T((e) => e.currentFolder), re = () => {
421
- const e = W();
422
- return (e == null ? void 0 : e.id) === N.BIN;
423
- }, yt = () => T((e) => e.resourceIsTrash), ps = () => T((e) => e.resourceOrFolderIsDraggable), It = () => T((e) => e.elementDragOver), Dt = () => T((e) => e.resourceActionDisable), St = () => {
424
- const e = W();
425
- return (e == null ? void 0 : e.id) === "default";
426
- }, bt = () => T((e) => e.status), wt = () => {
427
- const e = Dt(), {
428
- clearSelectedIds: t,
429
- setResourceActionDisable: s,
430
- clearSelectedItems: r
431
- } = F();
432
- return {
433
- isActionDisableModalOpen: e,
434
- onActionDisableCancel: () => {
435
- t(), r(), s(!1);
436
- }
437
- };
438
- }, xt = () => {
439
- const e = yt(), {
440
- clearSelectedIds: t,
441
- setResourceIsTrash: s,
442
- clearSelectedItems: r
443
- } = F();
444
- return {
445
- isTrashedModalOpen: e,
446
- onTrashedCancel: () => {
447
- t(), r(), s(!1);
448
- }
449
- };
450
- }, Tt = 175, Ct = 10, ge = "blog", me = "blog";
451
- class ye extends ue {
452
- getEditUrl() {
453
- throw new Error("Method not implemented.");
454
- }
455
- async create(t) {
456
- const s = t.thumbnail ? await this.getThumbnailPath(t.thumbnail) : "", r = t.public ? "/blog/pub" : "/blog", o = await this.http.post(r, {
457
- title: t.name,
458
- description: t.description,
459
- visibility: t.public ? "PUBLIC" : "OWNER",
460
- thumbnail: s,
461
- trashed: !1,
462
- folder: t.folder,
463
- slug: t.public ? t.slug : "",
464
- "publish-type": t.publishType || "RESTRAINT",
465
- "comment-type": "IMMEDIATE"
466
- });
467
- return this.checkHttpResponse(o), o;
468
- }
469
- async update(t) {
470
- const s = t.thumbnail ? await this.getThumbnailPath(t.thumbnail) : "", r = await this.http.put(`/blog/${t.entId}`, {
471
- trashed: t.trashed,
472
- _id: t.entId,
473
- title: t.name,
474
- thumbnail: s,
475
- description: t.description,
476
- visibility: t.public ? "PUBLIC" : "OWNER",
477
- slug: t.public ? t.slug : "",
478
- "publish-type": t["publish-type"] || "RESTRAINT",
479
- "comment-type": "IMMEDIATE"
480
- });
481
- return this.checkHttpResponse(r), {
482
- thumbnail: s,
483
- entId: t.entId
484
- };
485
- }
486
- getResourceType() {
487
- return me;
488
- }
489
- getApplication() {
490
- return ge;
491
- }
492
- getFormUrl(t) {
493
- return t ? `/blog?folderid=${t}#/edit/new` : "/blog#/edit/new";
494
- }
495
- getViewUrl(t) {
496
- return `/blog/id/${t}`;
497
- }
498
- getPrintUrl(t) {
499
- return `/blog/print/${t}`;
500
- }
501
- }
502
- ue.register({
503
- application: ge,
504
- resourceType: me
505
- }, (e) => new ye(e));
506
- const K = document.querySelector("[data-explorer-config]");
507
- let ce;
508
- function fs() {
509
- var e;
510
- if ((e = K == null ? void 0 : K.dataset) != null && e.explorerConfig) {
511
- const {
512
- explorerConfig: t
513
- } = K.dataset;
514
- try {
515
- const s = JSON.parse(t);
516
- ce = {
517
- ...s,
518
- service: ye,
519
- enableOnboarding: s.enableOnboarding !== void 0 ? s.enableOnboarding : !0
520
- };
521
- } catch (s) {
522
- console.error("[Explorer Config] could not parse app params from root data attributes:", K == null ? void 0 : K.dataset, s);
523
- }
524
- }
525
- return ce;
526
- }
527
- const Ft = (e, t) => {
528
- const s = e.map((o) => o.workflow), r = new Set(s);
529
- return Je({
530
- queryKey: [...r],
531
- queryFn: () => it([...r]),
532
- select: (o) => e.filter((a) => o[a.workflow]).map((a) => ({
533
- ...a,
534
- available: !0
535
- })),
536
- staleTime: 1 / 0,
537
- enabled: !!t
538
- });
539
- }, Rt = (e) => {
540
- const t = T((s) => s.config);
541
- return Ge(Ft(e, t));
542
- }, Nt = () => {
543
- const e = T((n) => n.config), t = Q(), {
544
- filters: s,
545
- trashed: r,
546
- search: o
547
- } = t, a = ["context", {
548
- folderId: s.folder,
549
- filters: s,
550
- trashed: r,
551
- search: o
552
- }];
553
- return Xe({
554
- queryKey: a,
555
- queryFn: async ({
556
- pageParam: n
557
- }) => await he({
558
- ...t,
559
- application: e == null ? void 0 : e.app,
560
- types: e == null ? void 0 : e.types,
561
- pagination: {
562
- ...t.pagination,
563
- startIdx: n
564
- }
565
- }),
566
- staleTime: 5e3,
567
- initialPageParam: 0,
568
- enabled: !!e,
569
- retry: !1,
570
- getNextPageParam: (n) => n.pagination.startIdx + n.pagination.pageSize
571
- });
572
- }, gs = () => {
573
- const e = L(), t = k(), s = Q(), r = V(), o = X(), a = Z(), n = Y(), u = ee().length > 0, p = u ? a : n, {
574
- clearSelectedItems: i,
575
- clearSelectedIds: l,
576
- setTreeData: h,
577
- setSearchParams: d
578
- } = F(), {
579
- filters: f,
580
- trashed: m
581
- } = s, D = ["context", {
582
- folderId: f.folder,
583
- filters: f,
584
- trashed: m
585
- }];
586
- return B({
587
- mutationFn: async () => await ot({
588
- searchParams: s,
589
- folderIds: o,
590
- resourceIds: p,
591
- useAssetIds: u
592
- }),
593
- onError(I) {
594
- typeof I == "string" && e.error(P(I));
595
- },
596
- onSuccess: async (I) => {
597
- if (await t.cancelQueries({
598
- queryKey: D
599
- }), t.getQueryData(D))
600
- return e.success(P("explorer.trash.title")), t.setQueryData(D, (C) => {
601
- var O;
602
- if (C) {
603
- const x = {
604
- ...C,
605
- pages: C == null ? void 0 : C.pages.map((y) => {
606
- var g;
607
- return {
608
- ...y,
609
- folders: y.folders.filter((S) => !o.includes(S.id)),
610
- pagination: {
611
- ...y.pagination,
612
- // @ts-ignore
613
- maxIdx: ((g = y == null ? void 0 : y.pagination) == null ? void 0 : g.maxIdx) - I.resources.length
614
- },
615
- resources: y.resources.filter((S) => u ? !a.includes(S.assetId) : !p.includes(S.id))
616
- };
617
- })
618
- }, b = Pe(r, {
619
- folders: o
620
- });
621
- return h(b), d({
622
- ...s,
623
- pagination: {
624
- ...s.pagination,
625
- // @ts-ignore
626
- maxIdx: ((O = s.pagination) == null ? void 0 : O.maxIdx) - I.resources.length
627
- }
628
- }), x;
629
- }
630
- });
631
- },
632
- onSettled: () => {
633
- i(), l();
634
- }
635
- });
636
- }, ms = () => {
637
- const e = L(), t = k(), s = Q(), r = X(), o = Z(), a = Y(), n = ee().length > 0, u = n ? o : a, {
638
- setFolderIds: p,
639
- setResourceIds: i,
640
- setSelectedResources: l,
641
- setSelectedFolders: h
642
- } = F(), {
643
- filters: d,
644
- trashed: f
645
- } = s, m = ["context", {
646
- folderId: d.folder,
647
- filters: d,
648
- trashed: f
649
- }];
650
- return B({
651
- mutationFn: async () => await at({
652
- searchParams: s,
653
- folderIds: r,
654
- resourceIds: u,
655
- useAssetIds: n
656
- }),
657
- onError(D) {
658
- typeof D == "string" && e.error(P(D));
659
- },
660
- onSuccess: async () => {
661
- if (await t.cancelQueries({
662
- queryKey: m
663
- }), t.getQueryData(m))
664
- return e.success(P("explorer.trash.toast")), t.setQueryData(m, (I) => {
665
- if (I)
666
- return {
667
- ...I,
668
- pages: I == null ? void 0 : I.pages.map((w) => ({
669
- ...w,
670
- folders: w.folders.filter((C) => !r.includes(C.id)),
671
- resources: w.resources.filter((C) => n ? !o.includes(C.assetId) : !u.includes(C.id))
672
- }))
673
- };
674
- });
675
- },
676
- onSettled: () => {
677
- i([]), l([]), p([]), h([]);
678
- }
679
- });
680
- }, ys = () => {
681
- const e = L(), t = k(), s = Q(), r = X(), o = Z(), a = Y(), n = ee().length > 0, u = n ? o : a, {
682
- clearSelectedItems: p,
683
- clearSelectedIds: i
684
- } = F(), {
685
- filters: l,
686
- trashed: h
687
- } = s, d = ["context", {
688
- folderId: l.folder,
689
- filters: l,
690
- trashed: h
691
- }];
692
- return B({
693
- mutationFn: async () => await nt({
694
- searchParams: s,
695
- folderIds: r,
696
- resourceIds: u,
697
- useAssetIds: n
698
- }),
699
- onError(f) {
700
- typeof f == "string" && e.error(P(f));
701
- },
702
- onSuccess: async () => {
703
- if (await t.cancelQueries({
704
- queryKey: d
705
- }), t.getQueryData(d))
706
- return e.success(P("explorer.removed.from.trash")), t.setQueryData(d, (m) => {
707
- if (m)
708
- return {
709
- ...m,
710
- pages: m == null ? void 0 : m.pages.map((I) => ({
711
- ...I,
712
- folders: I.folders.filter((w) => !r.includes(w.id)),
713
- resources: I.resources.filter((w) => n ? !o.includes(w.assetId) : !u.includes(w.id))
714
- }))
715
- };
716
- });
717
- },
718
- onSettled: () => {
719
- p(), i();
720
- }
721
- });
722
- }, Is = () => {
723
- const e = L(), t = Q(), s = k(), {
724
- user: r
725
- } = de(), o = W(), {
726
- filters: a,
727
- trashed: n
728
- } = t, u = "duplicate_start", p = ["context", {
729
- folderId: a.folder,
730
- filters: a,
731
- trashed: n
732
- }];
733
- return B({
734
- mutationFn: async (i) => (e.info(P("duplicate.start"), {
735
- id: u
736
- }), await ct(t, i.assetId)),
737
- onSuccess: async (i, l) => {
738
- e.remove(u), e.success(P("duplicate.done")), await s.cancelQueries({
739
- queryKey: p
740
- });
741
- const h = s.getQueryData(p), d = {
742
- ...l,
743
- name: `${l.name}${P("duplicate.suffix")}`,
744
- assetId: i.duplicateId,
745
- id: i.duplicateId,
746
- creatorId: r == null ? void 0 : r.userId,
747
- creatorName: r == null ? void 0 : r.username,
748
- createdAt: Date.now(),
749
- slug: l.slug || "",
750
- modifiedAt: Date.now(),
751
- modifierId: (r == null ? void 0 : r.userId) || "",
752
- modifierName: (r == null ? void 0 : r.username) || "",
753
- updatedAt: Date.now(),
754
- trashed: !1,
755
- rights: [`creator:${r == null ? void 0 : r.userId}`]
756
- };
757
- h && s.setQueryData(p, (f) => {
758
- if (f)
759
- return {
760
- ...f,
761
- pages: f == null ? void 0 : f.pages.map((m) => ({
762
- ...m,
763
- resources: [d, ...m.resources]
764
- }))
765
- };
766
- }), o.id && o.id !== N.DEFAULT && pe({
767
- searchParams: t,
768
- resourceIds: [i.duplicateId],
769
- folderId: o.id,
770
- folderIds: [],
771
- useAssetIds: !0
772
- });
773
- },
774
- onError: (i) => {
775
- e.remove(u), typeof i == "string" && e.error(`${P("duplicate.error")}: ${i}`);
776
- }
777
- });
778
- }, Et = () => {
779
- const e = L(), t = k(), s = Q(), r = V(), o = X(), a = Z(), n = Y(), u = ee().length > 0, p = u ? a : n, {
780
- clearSelectedIds: i,
781
- clearSelectedItems: l,
782
- setTreeData: h,
783
- setSearchParams: d
784
- } = F(), {
785
- filters: f,
786
- trashed: m
787
- } = s, D = ["context", {
788
- folderId: f.folder,
789
- filters: f,
790
- trashed: m
791
- }];
792
- return B({
793
- mutationFn: async (I) => await pe({
794
- searchParams: s,
795
- folderId: I,
796
- folderIds: o,
797
- resourceIds: p,
798
- useAssetIds: u
799
- }),
800
- onError(I) {
801
- typeof I == "string" && e.error(P(I));
802
- },
803
- onSuccess: async (I, w) => {
804
- if (t.getQueryData(D))
805
- return t.setQueryData(D, (O) => {
806
- var x;
807
- if (O) {
808
- const b = Ee(r, {
809
- destinationId: w,
810
- folders: o
811
- }), y = {
812
- ...O,
813
- pages: O == null ? void 0 : O.pages.map((g) => {
814
- var S;
815
- return {
816
- ...g,
817
- folders: g.folders.filter((R) => !o.includes(R.id)),
818
- pagination: {
819
- ...g.pagination,
820
- // @ts-ignore
821
- maxIdx: ((S = g.pagination) == null ? void 0 : S.maxIdx) - I.resources.length
822
- },
823
- resources: g.resources.filter((R) => u ? !a.includes(R.assetId) : !p.includes(R.id))
824
- };
825
- })
826
- };
827
- return h(b), d({
828
- ...s,
829
- pagination: {
830
- ...s.pagination,
831
- // @ts-ignore
832
- maxIdx: ((x = s.pagination) == null ? void 0 : x.maxIdx) - I.resources.length
833
- }
834
- }), y;
835
- }
836
- });
837
- t.invalidateQueries();
838
- },
839
- onSettled: () => {
840
- l(), i();
841
- }
842
- });
843
- }, Ds = () => {
844
- const e = L(), t = k(), s = Q(), r = V(), {
845
- setTreeData: o
846
- } = F(), {
847
- filters: a,
848
- trashed: n
849
- } = s, u = ["context", {
850
- folderId: a.folder,
851
- filters: a,
852
- trashed: n
853
- }];
854
- return B({
855
- mutationFn: async ({
856
- name: p,
857
- parentId: i
858
- }) => await st({
859
- searchParams: s,
860
- name: p,
861
- parentId: i
862
- }),
863
- onError(p) {
864
- typeof p == "string" && e.error(P(p));
865
- },
866
- onSuccess: async (p, i) => {
867
- await t.cancelQueries({
868
- queryKey: u
869
- });
870
- const l = t.getQueryData(u), h = {
871
- ...p,
872
- parentId: i.parentId,
873
- children: [],
874
- rights: [`creator:${p == null ? void 0 : p.creator_id}`]
875
- };
876
- if (l)
877
- return t.setQueryData(u, (d) => {
878
- if (d) {
879
- const f = {
880
- ...d,
881
- pages: d == null ? void 0 : d.pages.map((D) => ({
882
- ...D,
883
- folders: [...D.folders, h]
884
- }))
885
- }, m = qe(r, {
886
- parentId: i.parentId,
887
- newFolder: h
888
- });
889
- return o(m), f;
890
- }
891
- });
892
- }
893
- });
894
- }, Ss = () => {
895
- const e = L(), t = k(), s = Q(), r = V(), {
896
- setFolderIds: o,
897
- setSelectedFolders: a,
898
- setTreeData: n
899
- } = F(), {
900
- filters: u,
901
- trashed: p
902
- } = s, i = ["context", {
903
- folderId: u.folder,
904
- filters: u,
905
- trashed: p
906
- }];
907
- return B({
908
- mutationFn: async ({
909
- folderId: l,
910
- name: h,
911
- parentId: d
912
- }) => await rt({
913
- searchParams: s,
914
- folderId: l,
915
- parentId: d,
916
- name: h
917
- }),
918
- onError(l) {
919
- typeof l == "string" && e.error(P(l));
920
- },
921
- onSuccess: async (l, h) => {
922
- if (await t.cancelQueries({
923
- queryKey: i
924
- }), t.getQueryData(i))
925
- return t.setQueryData(i, (f) => {
926
- if (f) {
927
- const m = {
928
- ...f,
929
- pages: f == null ? void 0 : f.pages.map((I) => ({
930
- ...I,
931
- folders: I.folders.map((w) => w.id === l.id ? {
932
- ...l,
933
- parentId: h.parentId,
934
- rights: w.rights
935
- } : w)
936
- }))
937
- }, D = Oe(r, {
938
- folderId: h.folderId,
939
- newFolder: l
940
- });
941
- return n(D), m;
942
- }
943
- });
944
- },
945
- onSettled: () => {
946
- o([]), a([]);
947
- }
948
- });
949
- }, bs = (e) => {
950
- const t = k(), s = Q(), {
951
- setResourceIds: r,
952
- setSelectedResources: o
953
- } = F(), {
954
- filters: a,
955
- trashed: n
956
- } = s, u = ["context", {
957
- folderId: a.folder,
958
- filters: a,
959
- trashed: n
960
- }];
961
- return Ae({
962
- application: e,
963
- options: {
964
- onSuccess: async (p, i) => {
965
- if (await t.cancelQueries({
966
- queryKey: u
967
- }), t.getQueryData(u))
968
- return t.setQueryData(u, (h) => {
969
- if (h)
970
- return {
971
- ...h,
972
- pages: h == null ? void 0 : h.pages.map((d) => ({
973
- ...d,
974
- resources: d.resources.map((f) => {
975
- if (f.assetId === (i == null ? void 0 : i.resourceId)) {
976
- let m = [`creator:${f.creatorId}`];
977
- return (i == null ? void 0 : i.rights.length) >= 1 && (m = [...m, ...i.rights.flatMap((D) => D.actions.map((I) => `${D.type}:${D.id}:${I.id}`))]), {
978
- ...f,
979
- rights: m
980
- };
981
- } else
982
- return f;
983
- })
984
- }))
985
- };
986
- });
987
- },
988
- onSettled: () => {
989
- r([]), o([]);
990
- }
991
- }
992
- });
993
- }, ws = (e) => {
994
- const t = k(), s = Q(), {
995
- filters: r,
996
- trashed: o
997
- } = s, a = ["context", {
998
- folderId: r.folder,
999
- filters: r,
1000
- trashed: o
1001
- }];
1002
- return Qe({
1003
- application: e,
1004
- options: {
1005
- onSuccess: async (n, u) => {
1006
- if (await t.cancelQueries({
1007
- queryKey: a
1008
- }), t.getQueryData(a))
1009
- return t.setQueryData(a, (i) => {
1010
- if (i)
1011
- return {
1012
- ...i,
1013
- pages: i == null ? void 0 : i.pages.map((l) => ({
1014
- ...l,
1015
- resources: l.resources.map((h) => {
1016
- if (h.assetId === (u == null ? void 0 : u.entId)) {
1017
- const {
1018
- name: d,
1019
- thumbnail: f,
1020
- public: m,
1021
- description: D,
1022
- slug: I,
1023
- ...w
1024
- } = u;
1025
- return {
1026
- ...h,
1027
- ...w,
1028
- // add any custom field
1029
- name: d,
1030
- thumbnail: typeof f == "string" ? f : URL.createObjectURL(f),
1031
- public: m,
1032
- description: D,
1033
- slug: I
1034
- };
1035
- } else
1036
- return h;
1037
- })
1038
- }))
1039
- };
1040
- });
1041
- }
1042
- }
1043
- });
1044
- }, xs = () => {
1045
- const e = L(), t = k(), s = Q(), {
1046
- user: r
1047
- } = de(), {
1048
- appCode: o
1049
- } = v(), a = ["context", {
1050
- folderId: s.filters.folder,
1051
- filters: s.filters,
1052
- trashed: s.trashed
1053
- }];
1054
- return B({
1055
- mutationFn: async (n) => await dt({
1056
- searchParams: s,
1057
- params: n
1058
- }),
1059
- onError(n) {
1060
- typeof n == "string" && e.error(P(n));
1061
- },
1062
- onSuccess: async (n, u) => {
1063
- var l, h, d;
1064
- await t.cancelQueries({
1065
- queryKey: a
1066
- });
1067
- const p = t.getQueryData(a), i = {
1068
- ...u,
1069
- thumbnail: n.thumbnail || "",
1070
- application: o,
1071
- assetId: n._id || n.entId || "",
1072
- id: n._id || n.entId || "",
1073
- creatorId: r == null ? void 0 : r.userId,
1074
- creatorName: r == null ? void 0 : r.username,
1075
- createdAt: Date.now(),
1076
- slug: u.slug || "",
1077
- modifiedAt: ((l = n.modified) == null ? void 0 : l.$date) || "",
1078
- modifierId: ((h = n.author) == null ? void 0 : h.userId) || "",
1079
- modifierName: ((d = n.author) == null ? void 0 : d.username) || "",
1080
- updatedAt: Date.now(),
1081
- trashed: !1,
1082
- rights: [`creator:${r == null ? void 0 : r.userId}`]
1083
- };
1084
- if (p)
1085
- return t.setQueryData(a, (f) => {
1086
- if (f)
1087
- return {
1088
- ...f,
1089
- pages: f == null ? void 0 : f.pages.map((m) => ({
1090
- ...m,
1091
- resources: [i, ...m.resources]
1092
- }))
1093
- };
1094
- });
1095
- }
1096
- });
1097
- };
1098
- function ie(e, t) {
1099
- var r;
1100
- const s = J(e, t);
1101
- return (r = s == null ? void 0 : s.folder) != null && r.childrenIds ? [...(s == null ? void 0 : s.folder.childrenIds) || [], t] : t === N.BIN ? [N.BIN] : [N.DEFAULT];
1102
- }
1103
- function Pt() {
1104
- const e = k(), t = Et(), s = L(), {
1105
- appCode: r
1106
- } = v(), {
1107
- t: o
1108
- } = _(["common", r]), a = o("explorer.filters.mine", {
1109
- ns: r
1110
- }), {
1111
- setResourceOrFolderIsDraggable: n,
1112
- setElementDragOver: u,
1113
- setResourceIds: p,
1114
- setFolderIds: i,
1115
- fetchTreeData: l
1116
- } = F(), h = V(), f = oe(we, {
1117
- activationConstraint: {
1118
- delay: Tt,
1119
- tolerance: Ct
1120
- }
1121
- }), m = oe(xe), D = Te(f, m), I = (x, b) => {
1122
- var y;
1123
- ((y = x.data.current) == null ? void 0 : y.type) === "resource" ? s.success(/* @__PURE__ */ E(G, { children: [
1124
- o("explorer.dragged.resource"),
1125
- " ",
1126
- /* @__PURE__ */ c("strong", { children: b })
1127
- ] })) : s.success(/* @__PURE__ */ E(G, { children: [
1128
- o("explorer.dragged.folder"),
1129
- " ",
1130
- /* @__PURE__ */ c("strong", { children: b })
1131
- ] }));
1132
- };
1133
- return {
1134
- handleDragEnd: async (x) => {
1135
- const {
1136
- over: b,
1137
- active: y
1138
- } = x, g = b == null ? void 0 : b.data.current, S = y.data.current, R = ne(h, g == null ? void 0 : g.id), z = ie(h, g == null ? void 0 : g.id);
1139
- if ((S == null ? void 0 : S.id) == (g == null ? void 0 : g.id) || R.includes(S == null ? void 0 : S.id) || z.includes(S == null ? void 0 : S.id))
1140
- p([]), i([]);
1141
- else {
1142
- const H = (g == null ? void 0 : g.name) ?? a;
1143
- if (b)
1144
- try {
1145
- await t.mutate(g == null ? void 0 : g.id), I(y, H);
1146
- } catch (De) {
1147
- console.error(De);
1148
- } finally {
1149
- u({
1150
- isOver: !1,
1151
- overId: void 0,
1152
- canMove: !0,
1153
- isTreeview: !1
1154
- });
1155
- }
1156
- }
1157
- n({
1158
- isDrag: !1,
1159
- elementDrag: void 0
1160
- });
1161
- },
1162
- handleDragStart: (x) => {
1163
- const {
1164
- active: b
1165
- } = x, y = b.data.current;
1166
- (y == null ? void 0 : y.type) === "resource" ? p([y == null ? void 0 : y.id]) : (y == null ? void 0 : y.type) === "folder" && i([y == null ? void 0 : y.id]), n({
1167
- isDrag: !0,
1168
- elementDrag: y == null ? void 0 : y.id
1169
- });
1170
- },
1171
- handleDragOver: (x) => {
1172
- const {
1173
- over: b,
1174
- active: y
1175
- } = x, g = b == null ? void 0 : b.data.current, S = y == null ? void 0 : y.data.current, R = ne(h, g == null ? void 0 : g.id), z = ie(h, g == null ? void 0 : g.id);
1176
- if (b) {
1177
- const H = {
1178
- isOver: !0,
1179
- canMove: !1,
1180
- overId: g == null ? void 0 : g.id,
1181
- isTreeview: g == null ? void 0 : g.isTreeview
1182
- };
1183
- (S == null ? void 0 : S.id) === (g == null ? void 0 : g.id) || R.includes(S == null ? void 0 : S.id) || z.includes(S == null ? void 0 : S.id) ? u({
1184
- ...H,
1185
- canMove: !1
1186
- }) : (l(g == null ? void 0 : g.id, e), u({
1187
- ...H,
1188
- canMove: !0
1189
- }));
1190
- } else
1191
- u({
1192
- isOver: !1,
1193
- overId: void 0,
1194
- canMove: !0,
1195
- isTreeview: !1
1196
- });
1197
- },
1198
- sensors: D
1199
- };
1200
- }
1201
- const At = /* @__PURE__ */ q(async () => await import("./EmptyScreenApp.js")), Qt = /* @__PURE__ */ q(async () => await import("./EmptyScreenSearch.js")), qt = /* @__PURE__ */ q(async () => await import("./EmptyScreenError.js")), Ot = /* @__PURE__ */ q(async () => await import("./EmptyScreenNoContentInFolder.js")), kt = /* @__PURE__ */ q(async () => await import("./EmptyScreenTrash.js")), Ut = /* @__PURE__ */ q(async () => await import("./FoldersList.js")), Mt = /* @__PURE__ */ q(async () => await import("./ResourcesList.js")), Lt = () => {
1202
- const e = St(), t = re(), s = se(), r = Q(), o = W(), a = L(), n = k(), {
1203
- appCode: u
1204
- } = v(), {
1205
- t: p
1206
- } = _([u]), {
1207
- setSearchParams: i,
1208
- setSearchConfig: l,
1209
- fetchTreeData: h
1210
- } = F(), {
1211
- data: d,
1212
- isError: f,
1213
- error: m,
1214
- isLoading: D,
1215
- isFetching: I,
1216
- fetchNextPage: w
1217
- } = Nt(), C = (d == null ? void 0 : d.pages[0].folders.length) === 0, O = (d == null ? void 0 : d.pages[0].resources.length) === 0, x = C && O;
1218
- return $(() => {
1219
- var b, y;
1220
- d && ((b = d == null ? void 0 : d.pages[0]) != null && b.searchConfig && l(d.pages[0].searchConfig), !r.search && o.id === "default" && h(o.id, n), i({
1221
- ...r,
1222
- pagination: (y = d == null ? void 0 : d.pages[(d == null ? void 0 : d.pages.length) - 1]) == null ? void 0 : y.pagination
1223
- }));
1224
- }, [d]), $(() => {
1225
- m && typeof m == "string" && a.error(p(m));
1226
- }, [m]), D ? /* @__PURE__ */ c(U, {}) : f ? /* @__PURE__ */ c(M, { fallback: /* @__PURE__ */ c(U, {}), children: /* @__PURE__ */ c(qt, {}) }) : r.search && x ? /* @__PURE__ */ c(M, { fallback: /* @__PURE__ */ c(U, {}), children: /* @__PURE__ */ c(Qt, {}) }) : e && x ? /* @__PURE__ */ c(M, { fallback: /* @__PURE__ */ c(U, {}), children: /* @__PURE__ */ c(At, {}) }) : s && x && !t ? /* @__PURE__ */ c(M, { fallback: /* @__PURE__ */ c(U, {}), children: /* @__PURE__ */ c(Ot, {}) }) : t && (d == null ? void 0 : d.pages[0].resources.length) === 0 ? /* @__PURE__ */ c(M, { fallback: /* @__PURE__ */ c(U, {}), children: /* @__PURE__ */ c(kt, {}) }) : /* @__PURE__ */ E(M, { fallback: /* @__PURE__ */ c(U, {}), children: [
1227
- /* @__PURE__ */ c(Ut, { data: d, isFetching: I }),
1228
- /* @__PURE__ */ c(Mt, { data: d, isFetching: I, fetchNextPage: w })
1229
- ] });
1230
- }, Ie = () => {
1231
- const e = Q(), [t, s] = le(""), r = mt(), o = bt(), a = Se(null), {
1232
- setSearchParams: n
1233
- } = F(), u = (l) => {
1234
- const h = l.target.value;
1235
- s(h.toString());
1236
- }, p = (l) => {
1237
- (l.key === "Enter" || l.key === "Return") && (l.preventDefault(), n({
1238
- search: t || void 0
1239
- }));
1240
- }, i = (l) => {
1241
- l.preventDefault(), n({
1242
- search: t || void 0
1243
- });
1244
- };
1245
- return $(() => {
1246
- const h = t.length == 0 || t.length >= r.minLength ? {
1247
- search: t || void 0
1248
- } : {};
1249
- n({
1250
- ...e,
1251
- ...h
1252
- });
1253
- }, [t, r.minLength]), $(() => {
1254
- o === "select" && s("");
1255
- }, [o]), $(() => {
1256
- s(() => {
1257
- var l;
1258
- return ((l = e.search) == null ? void 0 : l.toString()) ?? "";
1259
- });
1260
- }, [e]), {
1261
- formRef: a,
1262
- inputSearch: t,
1263
- handleInputSearchChange: u,
1264
- handleKeyPress: p,
1265
- handleSearchSubmit: i
1266
- };
1267
- }, vt = () => {
1268
- const {
1269
- appCode: e,
1270
- currentApp: t
1271
- } = v(), {
1272
- t: s
1273
- } = _(), [r, o] = le(""), a = (l) => {
1274
- if (l === "0") {
1275
- o("");
1276
- return;
1277
- }
1278
- o(l);
1279
- }, n = W(), u = Q(), {
1280
- setSearchParams: p
1281
- } = F();
1282
- $(() => {
1283
- const l = () => r.includes("1") ? !0 : void 0, h = () => r.includes("2") ? !0 : void 0, d = () => r.includes("7") ? !0 : void 0;
1284
- p({
1285
- ...u,
1286
- filters: {
1287
- owner: l(),
1288
- public: d(),
1289
- shared: h(),
1290
- folder: n ? n.id : "default"
1291
- }
1292
- });
1293
- }, [n, p, r]);
1294
- const i = [{
1295
- label: s("explorer.filter.all", {
1296
- ns: e
1297
- }),
1298
- value: "0"
1299
- }, {
1300
- label: s("explorer.filter.owner", {
1301
- ns: e
1302
- }),
1303
- value: "1"
1304
- }, {
1305
- label: s("explorer.filter.shared", {
1306
- ns: e
1307
- }),
1308
- value: "2"
1309
- }, ...(t == null ? void 0 : t.displayName) == "exercizer" ? [{
1310
- label: "Exercices interactifs",
1311
- value: "3"
1312
- }] : [], ...(t == null ? void 0 : t.displayName) == "exercizer" ? [{
1313
- label: "Exercices à rendre",
1314
- value: "4"
1315
- }] : [], ...(t == null ? void 0 : t.displayName) == "pages" ? [{
1316
- label: "Projets publics",
1317
- value: "5"
1318
- }] : [], ...(t == null ? void 0 : t.displayName) == "pages" ? [{
1319
- label: "Projets internes",
1320
- value: "6"
1321
- }] : [], ...(t == null ? void 0 : t.displayName) == "blog" ? [{
1322
- label: s("explorer.filter.public", {
1323
- ns: e
1324
- }),
1325
- value: "7"
1326
- }] : []];
1327
- return {
1328
- selectedFilters: r,
1329
- options: i,
1330
- handleOnSelectFilter: a
1331
- };
1332
- }, Bt = () => {
1333
- const {
1334
- appCode: e
1335
- } = v(), {
1336
- t
1337
- } = _(), {
1338
- selectedFilters: s,
1339
- options: r,
1340
- handleOnSelectFilter: o
1341
- } = vt(), {
1342
- formRef: a,
1343
- inputSearch: n,
1344
- handleInputSearchChange: u,
1345
- handleKeyPress: p,
1346
- handleSearchSubmit: i
1347
- } = Ie(), l = s.length > 0 ? s.length : void 0;
1348
- return /* @__PURE__ */ E("form", { noValidate: !0, className: "bg-light p-16 ps-24 ms-n16 ms-lg-n24 me-n16 position-relative d-flex gap-8", ref: a, children: [
1349
- /* @__PURE__ */ E(ke, { id: "search", className: "input-group", children: [
1350
- /* @__PURE__ */ c(Ue, { type: "search", placeholder: t("explorer.label.search", {
1351
- ns: e
1352
- }), size: "lg", noValidationIcon: !0, value: n, onChange: u, onKeyDown: p }),
1353
- /* @__PURE__ */ c(Me, { type: "submit", "aria-label": t("explorer.label.search", {
1354
- ns: e
1355
- }), onClick: i })
1356
- ] }),
1357
- /* @__PURE__ */ E(j, { placement: "bottom-end", children: [
1358
- /* @__PURE__ */ c(j.Trigger, { label: t("explorer.filters"), icon: /* @__PURE__ */ c(Ye, { width: 20 }), variant: "ghost", badgeContent: l }),
1359
- /* @__PURE__ */ c(j.Menu, { children: r.map((h) => h.value === "0" ? /* @__PURE__ */ E(be, { children: [
1360
- /* @__PURE__ */ c(j.RadioItem, { value: h.value, model: s, onChange: () => o(h.value), children: h.label }),
1361
- /* @__PURE__ */ c(j.Separator, {})
1362
- ] }, "0") : /* @__PURE__ */ c(j.RadioItem, { value: h.value, model: s, onChange: () => o(h.value), children: h.label }, h.value)) })
1363
- ] })
1364
- ] });
1365
- }, Kt = ({
1366
- id: e,
1367
- selected: t,
1368
- onSelect: s
1369
- }) => {
1370
- const {
1371
- t: r
1372
- } = _();
1373
- return /* @__PURE__ */ c("div", { className: "treeview", children: /* @__PURE__ */ c("ul", { role: "tree", className: "m-0 p-0", children: /* @__PURE__ */ c("li", { id: e, role: "treeitem", "aria-selected": t, children: /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c("div", { className: "action-container", children: /* @__PURE__ */ c("div", { onClick: s, role: "button", tabIndex: 0, children: /* @__PURE__ */ E("div", { className: "d-flex align-items-center gap-8 py-8 ps-24", children: [
1374
- /* @__PURE__ */ c(Ze, { width: "20", height: "20" }),
1375
- /* @__PURE__ */ c("span", { children: r("explorer.tree.trash") })
1376
- ] }) }) }) }) }) }) });
1377
- }, $t = /* @__PURE__ */ q(async () => await import("./FolderModal.js")), _t = () => {
1378
- const [e, t] = Le(), s = k(), r = V(), o = re(), a = se(), n = It(), u = ve(), p = o ? N.BIN : a, {
1379
- appCode: i
1380
- } = v(), {
1381
- t: l
1382
- } = _(["common", i]), h = {
1383
- ...r,
1384
- name: l("explorer.filters.mine", {
1385
- ns: i
1386
- })
1387
- }, {
1388
- goToTrash: d,
1389
- selectTreeItem: f,
1390
- clearSelectedItems: m,
1391
- clearSelectedIds: D,
1392
- fetchTreeData: I
1393
- } = F(), w = (x) => {
1394
- f(x, s), u();
1395
- }, C = (x) => {
1396
- var g, S;
1397
- const b = J(r, x), y = (g = b == null ? void 0 : b.children) == null ? void 0 : g.some((R) => {
1398
- var z;
1399
- return Array.isArray(R == null ? void 0 : R.children) && ((z = R.children) == null ? void 0 : z.length) > 0;
1400
- });
1401
- (S = b == null ? void 0 : b.children) == null || S.forEach((R) => {
1402
- y || I(R.id, s);
1403
- });
1404
- }, O = () => {
1405
- m(), D(), t();
1406
- };
1407
- return /* @__PURE__ */ E(G, { children: [
1408
- /* @__PURE__ */ c(Be, { data: h, selectedNodeId: p, draggedNode: n != null && n.isTreeview ? n : void 0, onTreeItemClick: w, onTreeItemUnfold: C }),
1409
- /* @__PURE__ */ c(Kt, { id: N.BIN, selected: o, onSelect: d }),
1410
- /* @__PURE__ */ c("div", { className: "d-grid my-16", children: /* @__PURE__ */ c(Ke, { disabled: o, type: "button", color: "primary", variant: "outline", leftIcon: /* @__PURE__ */ c(et, {}), onClick: O, children: l("explorer.folder.new") }) }),
1411
- /* @__PURE__ */ c(M, { fallback: /* @__PURE__ */ c(U, {}), children: e && /* @__PURE__ */ c($t, { edit: !1, isOpen: e, onSuccess: t, onCancel: t }) })
1412
- ] });
1413
- };
1414
- function zt() {
1415
- const {
1416
- appCode: e
1417
- } = v(), {
1418
- gotoPreviousFolder: t
1419
- } = F(), {
1420
- t: s
1421
- } = _(["common", e]), {
1422
- inputSearch: r
1423
- } = Ie(), o = se(), a = re(), n = W(), u = s("explorer.tree.trash"), p = s("explorer.tree.search"), i = s("explorer.filters.mine", {
1424
- ns: e
1425
- }), l = (n == null ? void 0 : n.name) || i;
1426
- return /* @__PURE__ */ c("div", { className: "py-16", children: o && o !== "bin" && o !== "default" && !a ? /* @__PURE__ */ E("div", { className: "d-flex align-items-center gap-8", children: [
1427
- /* @__PURE__ */ c($e, { icon: /* @__PURE__ */ c(tt, {}), variant: "ghost", color: "tertiary", "aria-label": s("back"), className: "ms-n16", onClick: t }),
1428
- /* @__PURE__ */ c("p", { className: "body py-8 text-truncate", children: /* @__PURE__ */ c("strong", { children: l }) })
1429
- ] }) : /* @__PURE__ */ c("h2", { className: "body py-8 fw-bold", children: r.length !== 0 ? p : a ? u : i }) });
1430
- }
1431
- const jt = /* @__PURE__ */ q(async () => await import("./AppAction.js")), Vt = /* @__PURE__ */ q(async () => await import("./Library.js")), Wt = /* @__PURE__ */ q(async () => await import("./ActionBarContainer.js")), Ht = /* @__PURE__ */ q(async () => await import("./DisableModal.js")), Gt = /* @__PURE__ */ q(async () => await import("./TrashModal.js")), Jt = /* @__PURE__ */ q(async () => await import("./OnboardingModal.js")), Ts = ({
1432
- config: e
1433
- }) => {
1434
- const t = Q(), {
1435
- setConfig: s,
1436
- setSearchParams: r
1437
- } = F();
1438
- $(() => {
1439
- s(e || {}), r({
1440
- ...t,
1441
- application: e.app,
1442
- types: e.types
1443
- });
1444
- }, [e]);
1445
- const {
1446
- currentApp: o
1447
- } = v(), {
1448
- data: a
1449
- } = Rt(e.actions), {
1450
- isTrashedModalOpen: n,
1451
- onTrashedCancel: u
1452
- } = xt(), {
1453
- isActionDisableModalOpen: p,
1454
- onActionDisableCancel: i
1455
- } = wt(), {
1456
- handleDragEnd: l,
1457
- handleDragOver: h,
1458
- handleDragStart: d,
1459
- sensors: f
1460
- } = Pt();
1461
- _e();
1462
- const m = ae("publish", a), D = ae("create", a);
1463
- return e && /* @__PURE__ */ E(G, { children: [
1464
- /* @__PURE__ */ c(ze, { render: () => D ? /* @__PURE__ */ c(M, { fallback: /* @__PURE__ */ c(U, {}), children: /* @__PURE__ */ c(jt, {}) }) : null, children: /* @__PURE__ */ c(je, { app: o }) }),
1465
- /* @__PURE__ */ c(te, { className: "flex-grow-1", children: /* @__PURE__ */ E(Ce, { sensors: f, modifiers: [Fe], onDragStart: d, onDragEnd: l, onDragOver: h, children: [
1466
- /* @__PURE__ */ c(te.Col, { sm: "3", lg: "2", xl: "3", className: "border-end pt-16 pe-16 d-none d-lg-block", as: "aside", children: /* @__PURE__ */ E(M, { fallback: /* @__PURE__ */ c(U, {}), children: [
1467
- /* @__PURE__ */ c(_t, {}),
1468
- m && /* @__PURE__ */ c(Vt, {})
1469
- ] }) }),
1470
- /* @__PURE__ */ E(te.Col, { sm: "4", md: "8", lg: "6", xl: "9", children: [
1471
- /* @__PURE__ */ c(Bt, {}),
1472
- /* @__PURE__ */ c(zt, {}),
1473
- /* @__PURE__ */ c(Lt, {})
1474
- ] }),
1475
- /* @__PURE__ */ E(M, { fallback: /* @__PURE__ */ c(U, {}), children: [
1476
- /* @__PURE__ */ c(Wt, {}),
1477
- e.enableOnboarding && /* @__PURE__ */ c(Jt, { id: "showOnboardingTrash", items: [{
1478
- src: "onboarding/illu-trash-menu.svg",
1479
- alt: "explorer.modal.onboarding.trash.screen1.alt",
1480
- text: "explorer.modal.onboarding.trash.screen1.title"
1481
- }, {
1482
- src: "onboarding/illu-trash-notif.svg",
1483
- alt: "explorer.modal.onboarding.trash.screen2.alt",
1484
- text: "explorer.modal.onboarding.trash.screen2.alt"
1485
- }, {
1486
- src: "onboarding/illu-trash-delete.svg",
1487
- alt: "explorer.modal.onboarding.trash.screen3.alt",
1488
- text: "explorer.modal.onboarding.trash.screen3.title"
1489
- }], modalOptions: {
1490
- title: "explorer.modal.onboarding.trash.title",
1491
- prevText: "explorer.modal.onboarding.trash.prev",
1492
- nextText: "explorer.modal.onboarding.trash.next",
1493
- closeText: "explorer.modal.onboarding.trash.close"
1494
- } }),
1495
- n && /* @__PURE__ */ c(Gt, { isOpen: n, onCancel: u }),
1496
- p && /* @__PURE__ */ c(Ht, { isOpen: p, onCancel: i })
1497
- ] })
1498
- ] }) })
1499
- ] });
1500
- };
1501
- export {
1502
- ds as A,
1503
- fs as B,
1504
- Ts as E,
1505
- F as a,
1506
- Rt as b,
1507
- W as c,
1508
- xs as d,
1509
- Q as e,
1510
- re as f,
1511
- is as g,
1512
- Y as h,
1513
- hs as i,
1514
- us as j,
1515
- X as k,
1516
- ms as l,
1517
- yt as m,
1518
- Is as n,
1519
- ps as o,
1520
- ls as p,
1521
- bs as q,
1522
- ws as r,
1523
- It as s,
1524
- Ds as t,
1525
- T as u,
1526
- Ss as v,
1527
- ys as w,
1528
- gs as x,
1529
- Et as y,
1530
- V as z
1531
- };