@edifice.io/react 2.6.0-develop-enabling.20260720144517 → 2.6.0-develop-integration.20260722215838
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/homepage.js +12 -10
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useBrowserInfo/useBrowserInfo.js +1 -2
- package/dist/hooks/useNextcloudSearch/index.d.ts +1 -0
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +9 -0
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +48 -0
- package/dist/index.js +152 -146
- package/dist/modules/homepage/components/MessageFlashList/index.d.ts +1 -0
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +25 -0
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +105 -0
- package/dist/modules/multimedia/FileCard/index.d.ts +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +20 -7
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +35 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +2 -0
- package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +24 -0
- package/dist/modules/multimedia/Nextcloud/Nextcloud.js +93 -0
- package/dist/modules/multimedia/Nextcloud/index.d.ts +2 -0
- package/dist/modules/multimedia/index.d.ts +1 -0
- package/dist/multimedia.js +16 -12
- package/package.json +8 -7
package/dist/homepage.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { default as default2 } from "./modules/homepage/components/Header/Header.js";
|
|
2
2
|
import { default as default3 } from "./modules/homepage/components/HomeCard/HomeCard.js";
|
|
3
3
|
import { default as default4 } from "./modules/homepage/components/LastInfos/LastInfos.js";
|
|
4
|
-
import { default as default5 } from "./modules/homepage/components/MessageFlashList/
|
|
5
|
-
import { default as default6 } from "./modules/homepage/components/
|
|
6
|
-
import { default as default7 } from "./modules/homepage/components/Notifications/
|
|
4
|
+
import { default as default5 } from "./modules/homepage/components/MessageFlashList/MessageFlash.js";
|
|
5
|
+
import { default as default6 } from "./modules/homepage/components/MessageFlashList/MessageFlashList.js";
|
|
6
|
+
import { default as default7 } from "./modules/homepage/components/Notifications/NotificationItem.js";
|
|
7
|
+
import { default as default8 } from "./modules/homepage/components/Notifications/NotificationList.js";
|
|
7
8
|
import { NotificationListContainer } from "./modules/homepage/components/Notifications/NotificationListContainer.js";
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
9
|
+
import { default as default9 } from "./modules/homepage/components/SchoolSpace/SchoolSpace.js";
|
|
10
|
+
import { default as default10 } from "./modules/homepage/components/UserSpace/UserSpace.js";
|
|
10
11
|
import { Favorites } from "./modules/homepage/components/Favorites/Favorites.js";
|
|
11
12
|
import { FavoritesContainer } from "./modules/homepage/components/Favorites/FavoritesContainer.js";
|
|
12
13
|
import { LastInfosContainer } from "./modules/homepage/components/LastInfos/LastInfosContainer.js";
|
|
@@ -22,13 +23,14 @@ export {
|
|
|
22
23
|
default4 as LastInfos,
|
|
23
24
|
LastInfosContainer,
|
|
24
25
|
LastInfosList,
|
|
25
|
-
default5 as
|
|
26
|
+
default5 as MessageFlash,
|
|
27
|
+
default6 as MessageFlashList,
|
|
26
28
|
MessageFlashListContainer,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
default7 as NotificationItem,
|
|
30
|
+
default8 as NotificationList,
|
|
29
31
|
NotificationListContainer,
|
|
30
|
-
|
|
32
|
+
default9 as SchoolSpace,
|
|
31
33
|
SchoolSpaceContainer,
|
|
32
|
-
|
|
34
|
+
default10 as UserSpace,
|
|
33
35
|
UserSpaceContainer
|
|
34
36
|
};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from './useIsAdmlcOrAdmc';
|
|
|
22
22
|
export * from './useKeyPress';
|
|
23
23
|
export * from './useLibraryUrl';
|
|
24
24
|
export * from './useMediaLibrary';
|
|
25
|
+
export * from './useNextcloudSearch';
|
|
25
26
|
export * from './usePublicConf';
|
|
26
27
|
export * from './useScreeb';
|
|
27
28
|
export * from './useScrollToTop';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { UAParser } from "ua-parser-js";
|
|
2
2
|
function useBrowserInfo(userAgent) {
|
|
3
|
-
|
|
4
|
-
const uaParser = new UAParser(userAgent), os = uaParser.getOS(), device = uaParser.getDevice(), browser = uaParser.getBrowser(), isIphone = ((_a = device.model) == null ? void 0 : _a.indexOf("iPhone")) != -1, isIpod = ((_b = device.model) == null ? void 0 : _b.indexOf("iPod")) != -1, isIpad = ((_c = device.model) == null ? void 0 : _c.indexOf("iPad")) != -1;
|
|
3
|
+
const uaParser = new UAParser(userAgent), os = uaParser.getOS(), device = uaParser.getDevice(), browser = uaParser.getBrowser(), deviceModel = device.model ?? "", isIphone = deviceModel.includes("iPhone"), isIpod = deviceModel.includes("iPod"), isIpad = deviceModel.includes("iPad");
|
|
5
4
|
return {
|
|
6
5
|
os,
|
|
7
6
|
device,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useNextcloudSearch } from './useNextcloudSearch';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ID, NextcloudDocument } from '@edifice.io/client';
|
|
2
|
+
import { TreeData } from '../../types';
|
|
3
|
+
export type NextcloudFolderNode = TreeData & {
|
|
4
|
+
files?: NextcloudDocument[];
|
|
5
|
+
};
|
|
6
|
+
export default function useNextcloudSearch(rootId: string, rootName: string, userId?: string): {
|
|
7
|
+
root: NextcloudFolderNode;
|
|
8
|
+
loadContent: (folderId?: ID) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useReducer, useCallback } from "react";
|
|
2
|
+
import { odeServices } from "@edifice.io/client";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { findNodeById } from "../../components/TreeView/utilities/treeview.js";
|
|
5
|
+
function useNextcloudSearch(rootId, rootName, userId) {
|
|
6
|
+
function treeReducer(state, action) {
|
|
7
|
+
switch (action.type) {
|
|
8
|
+
case "update": {
|
|
9
|
+
const node = findNodeById(state, action.folderId);
|
|
10
|
+
return node && (node.children = action.subfolders.map((f) => ({
|
|
11
|
+
id: f.path,
|
|
12
|
+
name: f.name
|
|
13
|
+
})), node.files = action.files), {
|
|
14
|
+
...state
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
default:
|
|
18
|
+
throw Error("[useNextcloudSearch] Unknown action type: " + action.type);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const [root, dispatch] = useReducer(treeReducer, {
|
|
22
|
+
id: rootId,
|
|
23
|
+
name: rootName,
|
|
24
|
+
section: !0
|
|
25
|
+
}), queryClient = useQueryClient(), loadContent = useCallback(async (folderId) => {
|
|
26
|
+
if (!userId) return;
|
|
27
|
+
const path = folderId === rootId ? void 0 : folderId, payload = await queryClient.fetchQuery({
|
|
28
|
+
queryKey: ["nextcloud", "documents", userId, path ?? "/"],
|
|
29
|
+
queryFn: () => odeServices.nextcloud().listDocuments(userId, path),
|
|
30
|
+
staleTime: 6e4
|
|
31
|
+
}), subfolders = [], files = [], currentPath = path ?? "/";
|
|
32
|
+
payload.filter((doc) => doc.path !== currentPath).forEach((doc) => {
|
|
33
|
+
doc.isFolder ? subfolders.push(doc) : files.push(doc);
|
|
34
|
+
}), dispatch({
|
|
35
|
+
folderId,
|
|
36
|
+
subfolders,
|
|
37
|
+
files,
|
|
38
|
+
type: "update"
|
|
39
|
+
});
|
|
40
|
+
}, [rootId, userId, queryClient]);
|
|
41
|
+
return {
|
|
42
|
+
root,
|
|
43
|
+
loadContent
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
useNextcloudSearch as default
|
|
48
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -44,79 +44,82 @@ import { default as default42 } from "./components/LogoBeta/LogoBeta.js";
|
|
|
44
44
|
import { default as default43 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
|
|
45
45
|
import { default as default44 } from "./components/MediaViewer/MediaViewer.js";
|
|
46
46
|
import { default as default45 } from "./components/Modal/Modal.js";
|
|
47
|
-
import { default as default46 } from "./modules/
|
|
48
|
-
import { default as default47 } from "./
|
|
49
|
-
import { default as default48 } from "./
|
|
50
|
-
import { default as default49
|
|
51
|
-
import { default as default50 } from "./
|
|
52
|
-
import { default as default51 } from "./components/
|
|
53
|
-
import { default as default52 } from "./
|
|
54
|
-
import { default as default53 } from "./components/
|
|
55
|
-
import { default as default54 } from "./components/
|
|
56
|
-
import { default as default55 } from "./components/
|
|
57
|
-
import { default as default56 } from "./components/
|
|
58
|
-
import { default as default57 } from "./
|
|
59
|
-
import { default as default58 } from "./
|
|
60
|
-
import { default as default59 } from "./modules/modals/ShareModal/
|
|
61
|
-
import { default as default60 } from "./
|
|
62
|
-
import { default as default61 } from "./
|
|
63
|
-
import { default as default62 } from "./components/
|
|
64
|
-
import { default as default63 } from "./components/
|
|
65
|
-
import { default as default64 } from "./components/
|
|
66
|
-
import { default as default65 } from "./components/
|
|
67
|
-
import { default as default66 } from "./components/
|
|
68
|
-
import { default as default67 } from "./components/
|
|
69
|
-
import { default as default68 } from "./components/
|
|
70
|
-
import { default as default69 } from "./components/
|
|
71
|
-
import { default as default70 } from "./
|
|
72
|
-
import { default as default71 } from "./
|
|
73
|
-
import { default as default72 } from "./modules/multimedia/
|
|
74
|
-
import { default as default73 } from "./modules/multimedia/
|
|
75
|
-
import { default as default74 } from "./
|
|
76
|
-
import { default as default75 } from "./modules/multimedia/
|
|
77
|
-
import { default as default76 } from "./
|
|
78
|
-
import { default as default77 } from "./
|
|
79
|
-
import { default as default78 } from "./
|
|
80
|
-
import { default as default79 } from "./hooks/
|
|
81
|
-
import { default as default80 } from "./hooks/
|
|
82
|
-
import { default as default81 } from "./hooks/
|
|
83
|
-
import { default as default82 } from "./hooks/
|
|
84
|
-
import { default as default83 } from "./hooks/
|
|
85
|
-
import { default as default84 } from "./hooks/
|
|
86
|
-
import { default as default85 } from "./hooks/
|
|
87
|
-
import { default as default86 } from "./hooks/
|
|
88
|
-
import { default as default87 } from "./hooks/
|
|
89
|
-
import { default as default88 } from "./hooks/
|
|
90
|
-
import { default as default89 } from "./hooks/
|
|
91
|
-
import { default as default90 } from "./hooks/
|
|
92
|
-
import { default as default91 } from "./hooks/
|
|
93
|
-
import { default as default92 } from "./hooks/
|
|
94
|
-
import { default as default93 } from "./hooks/
|
|
95
|
-
import { default as default94 } from "./hooks/
|
|
96
|
-
import { default as default95 } from "./hooks/
|
|
97
|
-
import { default as default96 } from "./hooks/
|
|
98
|
-
import { default as default97 } from "./hooks/
|
|
99
|
-
import { default as default98 } from "./hooks/
|
|
100
|
-
import { default as default99 } from "./hooks/
|
|
101
|
-
import { default as default100 } from "./hooks/
|
|
102
|
-
import { default as default101 } from "./hooks/
|
|
103
|
-
import { default as default102 } from "./
|
|
104
|
-
import { default as default103 } from "./hooks/
|
|
105
|
-
import { default as default104 } from "./hooks/
|
|
106
|
-
import { default as default105 } from "./hooks/
|
|
107
|
-
import { default as default106 } from "./hooks/
|
|
108
|
-
import { default as default107 } from "./hooks/
|
|
109
|
-
import { default as default108 } from "./hooks/
|
|
110
|
-
import { default as default109 } from "./
|
|
111
|
-
import { default as default110 } from "./hooks/
|
|
112
|
-
import { default as default111 } from "./hooks/
|
|
113
|
-
import { default as default112 } from "./hooks/
|
|
114
|
-
import { default as default113 } from "./hooks/
|
|
115
|
-
import { default as default114 } from "./hooks/
|
|
116
|
-
import {
|
|
117
|
-
import { default as default116 } from "./hooks/
|
|
118
|
-
import { default as default117 } from "./hooks/
|
|
119
|
-
import { default as default118 } from "./hooks/
|
|
47
|
+
import { default as default46 } from "./modules/multimedia/Nextcloud/Nextcloud.js";
|
|
48
|
+
import { default as default47 } from "./modules/multimedia/FileCard/NextcloudFileCard.js";
|
|
49
|
+
import { default as default48 } from "./modules/modals/OnboardingModal/OnboardingModal.js";
|
|
50
|
+
import { default as default49 } from "./components/PageLayout/PageLayout.js";
|
|
51
|
+
import { default as default50 } from "./components/PreventPropagation/PreventPropagation.js";
|
|
52
|
+
import { default as default51, Root } from "./components/PromotionCard/PromotionCard.js";
|
|
53
|
+
import { default as default52 } from "./modules/modals/PublishModal/PublishModal.js";
|
|
54
|
+
import { default as default53 } from "./components/Radio/Radio.js";
|
|
55
|
+
import { default as default54 } from "./components/RadioCard/RadioCard.js";
|
|
56
|
+
import { default as default55 } from "./components/SearchBar/SearchBar.js";
|
|
57
|
+
import { default as default56 } from "./components/Button/SearchButton.js";
|
|
58
|
+
import { default as default57 } from "./components/SegmentedControl/SegmentedControl.js";
|
|
59
|
+
import { default as default58 } from "./components/Select/Select.js";
|
|
60
|
+
import { default as default59 } from "./modules/modals/ShareModal/apps/ShareBlog.js";
|
|
61
|
+
import { default as default60 } from "./modules/modals/ShareModal/ShareModal.js";
|
|
62
|
+
import { default as default61 } from "./modules/modals/ShareModal/ShareResources.js";
|
|
63
|
+
import { default as default62 } from "./components/Tree/components/SortableTree.js";
|
|
64
|
+
import { default as default63 } from "./components/StackedGroup/StackedGroup.js";
|
|
65
|
+
import { default as default64 } from "./components/Stepper/Stepper.js";
|
|
66
|
+
import { default as default65 } from "./components/Switch/Switch.js";
|
|
67
|
+
import { default as default66 } from "./components/Table/components/Table.js";
|
|
68
|
+
import { default as default67 } from "./components/TextArea/TextArea.js";
|
|
69
|
+
import { default as default68 } from "./components/Skeleton/TextSkeleton.js";
|
|
70
|
+
import { default as default69 } from "./components/Tooltip/Tooltip.js";
|
|
71
|
+
import { default as default70 } from "./components/Tree/components/Tree.js";
|
|
72
|
+
import { default as default71 } from "./components/TreeView/TreeView.js";
|
|
73
|
+
import { default as default72 } from "./modules/multimedia/UploadCard/UploadCard.js";
|
|
74
|
+
import { default as default73 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
|
|
75
|
+
import { default as default74 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
|
|
76
|
+
import { default as default75 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
|
|
77
|
+
import { default as default76 } from "./components/VisuallyHidden/VisuallyHidden.js";
|
|
78
|
+
import { default as default77 } from "./modules/multimedia/Workspace/Workspace.js";
|
|
79
|
+
import { default as default78 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
|
|
80
|
+
import { default as default79 } from "./hooks/useBookmark/useBookmark.js";
|
|
81
|
+
import { default as default80 } from "./hooks/useBreakpoint/useBreakpoint.js";
|
|
82
|
+
import { default as default81 } from "./hooks/useBrowserInfo/useBrowserInfo.js";
|
|
83
|
+
import { default as default82 } from "./hooks/useCantoo/useCantoo.js";
|
|
84
|
+
import { default as default83 } from "./hooks/useClickOutside/useClickOutside.js";
|
|
85
|
+
import { default as default84 } from "./hooks/useConversation/useConversation.js";
|
|
86
|
+
import { default as default85 } from "./hooks/useDate/useDate.js";
|
|
87
|
+
import { default as default86 } from "./hooks/useDebounce/useDebounce.js";
|
|
88
|
+
import { default as default87 } from "./hooks/useDirectory/useDirectory.js";
|
|
89
|
+
import { default as default88 } from "./hooks/useDropdown/useDropdown.js";
|
|
90
|
+
import { default as default89 } from "./hooks/useDropzone/useDropzone.js";
|
|
91
|
+
import { default as default90 } from "./hooks/useEdificeIcons/useEdificeIcons.js";
|
|
92
|
+
import { default as default91 } from "./hooks/useHasWorkflow/useHasWorkflow.js";
|
|
93
|
+
import { default as default92 } from "./hooks/useHover/useHover.js";
|
|
94
|
+
import { default as default93 } from "./hooks/useHttpErrorToast/useHttpErrorToast.js";
|
|
95
|
+
import { default as default94 } from "./hooks/useImage/useImage.js";
|
|
96
|
+
import { default as default95 } from "./hooks/useInfiniteScroll/useInfiniteScroll.js";
|
|
97
|
+
import { default as default96 } from "./hooks/useIsAdmc/useIsAdmc.js";
|
|
98
|
+
import { default as default97 } from "./hooks/useIsAdml/useIsAdml.js";
|
|
99
|
+
import { default as default98 } from "./hooks/useIsAdmlcOrAdmc/useIsAdmlcOrAdmc.js";
|
|
100
|
+
import { default as default99 } from "./hooks/useKeyPress/useKeyPress.js";
|
|
101
|
+
import { default as default100 } from "./hooks/useLibraryUrl/useLibraryUrl.js";
|
|
102
|
+
import { default as default101 } from "./hooks/useMediaLibrary/useMediaLibrary.js";
|
|
103
|
+
import { default as default102 } from "./hooks/useNextcloudSearch/useNextcloudSearch.js";
|
|
104
|
+
import { default as default103 } from "./hooks/usePublicConf/usePublicConf.js";
|
|
105
|
+
import { default as default104 } from "./hooks/useScrollToTop/useScrollToTop.js";
|
|
106
|
+
import { default as default105 } from "./modules/modals/ShareModal/hooks/useShareMutation.js";
|
|
107
|
+
import { default as default106 } from "./hooks/useTitle/useTitle.js";
|
|
108
|
+
import { default as default107 } from "./hooks/useToast/useToast.js";
|
|
109
|
+
import { default as default108 } from "./hooks/useToggle/useToggle.js";
|
|
110
|
+
import { default as default109 } from "./hooks/useTrapFocus/useTrapFocus.js";
|
|
111
|
+
import { default as default110 } from "./hooks/useTrashedResource/useTrashedResource.js";
|
|
112
|
+
import { default as default111 } from "./hooks/useUiOverride/useUiOverride.js";
|
|
113
|
+
import { default as default112 } from "./modules/modals/ResourceModal/hooks/useUpdateMutation.js";
|
|
114
|
+
import { default as default113 } from "./hooks/useUpload/useUpload.js";
|
|
115
|
+
import { default as default114 } from "./hooks/useUploadFiles/useUploadFiles.js";
|
|
116
|
+
import { default as default115 } from "./hooks/useUser/useUser.js";
|
|
117
|
+
import { default as default116 } from "./hooks/useWorkspaceFile/useWorkspaceFile.js";
|
|
118
|
+
import { default as default117 } from "./hooks/useWorkspaceFolders/useWorkspaceFolders.js";
|
|
119
|
+
import { WORKSPACE_SHARED_FOLDER_ID, WORKSPACE_USER_FOLDER_ID, default as default118 } from "./hooks/useWorkspaceFolders/useWorkspaceFoldersTree.js";
|
|
120
|
+
import { default as default119 } from "./hooks/useWorkspaceSearch/useWorkspaceSearch.js";
|
|
121
|
+
import { default as default120 } from "./hooks/useXitiTrackPageLoad/useXitiTrackPageLoad.js";
|
|
122
|
+
import { default as default121 } from "./hooks/useZendeskGuide/useZendeskGuide.js";
|
|
120
123
|
import { AccessiblePalette, DefaultPalette } from "./components/ColorPicker/ColorPalette.js";
|
|
121
124
|
import { AntProvider } from "./providers/AntThemeProvider/AntProvider.js";
|
|
122
125
|
import { BetaSwitch } from "./components/BetaSwitch/BetaSwitch.js";
|
|
@@ -225,55 +228,57 @@ export {
|
|
|
225
228
|
Menu,
|
|
226
229
|
MockedProvider,
|
|
227
230
|
default45 as Modal,
|
|
228
|
-
default46 as
|
|
229
|
-
default47 as
|
|
231
|
+
default46 as Nextcloud,
|
|
232
|
+
default47 as NextcloudFileCard,
|
|
233
|
+
default48 as OnboardingModal,
|
|
234
|
+
default49 as PageLayout,
|
|
230
235
|
PageLayoutContext,
|
|
231
236
|
Pagination,
|
|
232
237
|
Popover,
|
|
233
238
|
PopoverBody,
|
|
234
239
|
PopoverFooter,
|
|
235
240
|
PopoverHeader,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
+
default50 as PreventPropagation,
|
|
242
|
+
default51 as PromotionCard,
|
|
243
|
+
default52 as PublishModal,
|
|
244
|
+
default53 as Radio,
|
|
245
|
+
default54 as RadioCard,
|
|
241
246
|
ResourceModal,
|
|
242
247
|
Root,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
248
|
+
default55 as SearchBar,
|
|
249
|
+
default56 as SearchButton,
|
|
250
|
+
default57 as SegmentedControl,
|
|
251
|
+
default58 as Select,
|
|
252
|
+
default59 as ShareBlog,
|
|
253
|
+
default60 as ShareModal,
|
|
254
|
+
default61 as ShareResources,
|
|
255
|
+
default62 as SortableTree,
|
|
256
|
+
default63 as StackedGroup,
|
|
257
|
+
default64 as Stepper,
|
|
258
|
+
default65 as Switch,
|
|
259
|
+
default66 as Table,
|
|
255
260
|
Tabs,
|
|
256
|
-
|
|
257
|
-
|
|
261
|
+
default67 as TextArea,
|
|
262
|
+
default68 as TextSkeleton,
|
|
258
263
|
Toolbar,
|
|
259
|
-
|
|
260
|
-
|
|
264
|
+
default69 as Tooltip,
|
|
265
|
+
default70 as Tree,
|
|
261
266
|
TreeNode,
|
|
262
267
|
TreeNodeFolderWrapper,
|
|
263
|
-
|
|
268
|
+
default71 as TreeView,
|
|
264
269
|
Upload,
|
|
265
|
-
|
|
266
|
-
|
|
270
|
+
default72 as UploadCard,
|
|
271
|
+
default73 as UploadFiles,
|
|
267
272
|
UserRightsList,
|
|
268
273
|
UserSearch,
|
|
269
|
-
|
|
270
|
-
|
|
274
|
+
default74 as VideoEmbed,
|
|
275
|
+
default75 as VideoRecorder,
|
|
271
276
|
VisibleType,
|
|
272
|
-
|
|
277
|
+
default76 as VisuallyHidden,
|
|
273
278
|
WORKSPACE_SHARED_FOLDER_ID,
|
|
274
279
|
WORKSPACE_USER_FOLDER_ID,
|
|
275
|
-
|
|
276
|
-
|
|
280
|
+
default77 as Workspace,
|
|
281
|
+
default78 as WorkspaceFolders,
|
|
277
282
|
addNode,
|
|
278
283
|
arrayUnique,
|
|
279
284
|
buildTree,
|
|
@@ -304,57 +309,58 @@ export {
|
|
|
304
309
|
setRef,
|
|
305
310
|
updateNode,
|
|
306
311
|
updateParentIds,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
312
|
+
default79 as useBookmark,
|
|
313
|
+
default80 as useBreakpoint,
|
|
314
|
+
default81 as useBrowserInfo,
|
|
315
|
+
default82 as useCantoo,
|
|
311
316
|
useCheckable,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
default83 as useClickOutside,
|
|
318
|
+
default84 as useConversation,
|
|
319
|
+
default85 as useDate,
|
|
320
|
+
default86 as useDebounce,
|
|
321
|
+
default87 as useDirectory,
|
|
322
|
+
default88 as useDropdown,
|
|
323
|
+
default89 as useDropzone,
|
|
319
324
|
useDropzoneContext,
|
|
320
325
|
useEdificeClient,
|
|
321
|
-
|
|
326
|
+
default90 as useEdificeIcons,
|
|
322
327
|
useEdificeTheme,
|
|
323
328
|
useFileToAttachment,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
329
|
+
default91 as useHasWorkflow,
|
|
330
|
+
default92 as useHover,
|
|
331
|
+
default93 as useHttpErrorToast,
|
|
332
|
+
default94 as useImage,
|
|
333
|
+
default95 as useInfiniteScroll,
|
|
334
|
+
default96 as useIsAdmc,
|
|
335
|
+
default97 as useIsAdml,
|
|
336
|
+
default98 as useIsAdmlcOrAdmc,
|
|
337
|
+
default99 as useKeyPress,
|
|
338
|
+
default100 as useLibraryUrl,
|
|
339
|
+
default101 as useMediaLibrary,
|
|
340
|
+
default102 as useNextcloudSearch,
|
|
335
341
|
useOverlay,
|
|
336
342
|
usePageLayout,
|
|
337
|
-
|
|
343
|
+
default103 as usePublicConf,
|
|
338
344
|
useScreeb,
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
345
|
+
default104 as useScrollToTop,
|
|
346
|
+
default105 as useShareMutation,
|
|
347
|
+
default106 as useTitle,
|
|
348
|
+
default107 as useToast,
|
|
349
|
+
default108 as useToggle,
|
|
350
|
+
default109 as useTrapFocus,
|
|
351
|
+
default110 as useTrashedResource,
|
|
346
352
|
useTreeSortable,
|
|
347
353
|
useTreeView,
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
354
|
+
default111 as useUiOverride,
|
|
355
|
+
default112 as useUpdateMutation,
|
|
356
|
+
default113 as useUpload,
|
|
357
|
+
default114 as useUploadFiles,
|
|
358
|
+
default115 as useUser,
|
|
359
|
+
default116 as useWorkspaceFile,
|
|
360
|
+
default117 as useWorkspaceFolders,
|
|
361
|
+
default118 as useWorkspaceFoldersTree,
|
|
362
|
+
default119 as useWorkspaceSearch,
|
|
363
|
+
default120 as useXitiTrackPageLoad,
|
|
364
|
+
default121 as useZendeskGuide,
|
|
359
365
|
wrapTreeNode
|
|
360
366
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NextcloudDocument } from '@edifice.io/client';
|
|
3
|
+
import { CardProps } from '../../../components/Card';
|
|
4
|
+
export interface NextcloudFileCardProps extends CardProps {
|
|
5
|
+
doc: NextcloudDocument;
|
|
6
|
+
/**
|
|
7
|
+
* Id of the user who owns the Nextcloud document, used to build the preview URL.
|
|
8
|
+
*/
|
|
9
|
+
userId: string;
|
|
10
|
+
/**
|
|
11
|
+
* Custom icon to override the default based on file type
|
|
12
|
+
* Can be a string or a React node
|
|
13
|
+
*/
|
|
14
|
+
customIcon?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Custom color class to override the default based on file type
|
|
17
|
+
* Example: "bg-purple-300" or any valid CSS class
|
|
18
|
+
*/
|
|
19
|
+
customColor?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const NextcloudFileCard: {
|
|
22
|
+
({ doc, userId, isClickable, isSelectable, isSelected, onClick, className, onSelect, isFocused, app, customIcon, customColor, }: NextcloudFileCardProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
25
|
+
export default NextcloudFileCard;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { DocumentHelper, odeServices } from "@edifice.io/client";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import SvgIconLandscape from "../../icons/components/IconLandscape.js";
|
|
6
|
+
import SvgIconMic from "../../icons/components/IconMic.js";
|
|
7
|
+
import SvgIconTextPage from "../../icons/components/IconTextPage.js";
|
|
8
|
+
import SvgIconVideo from "../../icons/components/IconVideo.js";
|
|
9
|
+
import FileIcon from "./FileIcon.js";
|
|
10
|
+
import useThumbnail from "../../../hooks/useThumbnail/useThumbnail.js";
|
|
11
|
+
import Card from "../../../components/Card/Card.js";
|
|
12
|
+
const NextcloudFileCard = ({
|
|
13
|
+
doc,
|
|
14
|
+
userId,
|
|
15
|
+
isClickable = !0,
|
|
16
|
+
isSelectable = !1,
|
|
17
|
+
isSelected = !1,
|
|
18
|
+
onClick,
|
|
19
|
+
className,
|
|
20
|
+
onSelect,
|
|
21
|
+
isFocused,
|
|
22
|
+
app,
|
|
23
|
+
customIcon,
|
|
24
|
+
customColor
|
|
25
|
+
}) => {
|
|
26
|
+
const ref = useRef(null), type = DocumentHelper.role(doc.contentType, !1);
|
|
27
|
+
function getRoleMap(type2) {
|
|
28
|
+
if (customIcon !== void 0 || customColor !== void 0)
|
|
29
|
+
return {
|
|
30
|
+
icon: customIcon || /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
|
|
31
|
+
color: customColor || "bg-gray-300",
|
|
32
|
+
hasShadow: !1
|
|
33
|
+
};
|
|
34
|
+
const roleMappings = {
|
|
35
|
+
csv: {
|
|
36
|
+
icon: ".CSV",
|
|
37
|
+
color: "bg-orange-200"
|
|
38
|
+
},
|
|
39
|
+
xls: {
|
|
40
|
+
icon: ".XLS",
|
|
41
|
+
color: "bg-green-200"
|
|
42
|
+
},
|
|
43
|
+
doc: {
|
|
44
|
+
icon: ".DOC",
|
|
45
|
+
color: "bg-blue-200"
|
|
46
|
+
},
|
|
47
|
+
txt: {
|
|
48
|
+
icon: ".TXT",
|
|
49
|
+
color: "bg-blue-200"
|
|
50
|
+
},
|
|
51
|
+
pdf: {
|
|
52
|
+
icon: ".PDF",
|
|
53
|
+
color: "bg-red-200"
|
|
54
|
+
},
|
|
55
|
+
audio: {
|
|
56
|
+
icon: /* @__PURE__ */ jsx(SvgIconMic, { width: 22, height: 22 }),
|
|
57
|
+
color: "bg-red-200"
|
|
58
|
+
},
|
|
59
|
+
ppt: {
|
|
60
|
+
icon: ".PPT",
|
|
61
|
+
color: "bg-red-200"
|
|
62
|
+
},
|
|
63
|
+
img: {
|
|
64
|
+
icon: /* @__PURE__ */ jsx(SvgIconLandscape, { width: 22, height: 22 }),
|
|
65
|
+
color: "bg-green-200"
|
|
66
|
+
},
|
|
67
|
+
video: {
|
|
68
|
+
icon: /* @__PURE__ */ jsx(SvgIconVideo, { width: 22, height: 22 }),
|
|
69
|
+
color: "bg-purple-200"
|
|
70
|
+
},
|
|
71
|
+
zip: {
|
|
72
|
+
icon: ".ZIP",
|
|
73
|
+
color: "bg-gray-300"
|
|
74
|
+
},
|
|
75
|
+
md: {
|
|
76
|
+
icon: ".MD",
|
|
77
|
+
color: "bg-blue-200"
|
|
78
|
+
},
|
|
79
|
+
unknown: {
|
|
80
|
+
icon: /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
|
|
81
|
+
color: "bg-gray-300"
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return roleMappings[type2] || roleMappings.unknown;
|
|
85
|
+
}
|
|
86
|
+
const roleMap = getRoleMap(type ?? "unknown"), file = clsx("file position-relative rounded", (roleMap == null ? void 0 : roleMap.color) ?? "bg-yellow-200"), mediaSrc = type === "img" ? odeServices.nextcloud().getFileUrl(userId, doc) : null, hasThumbnail = useThumbnail(mediaSrc, {
|
|
87
|
+
ref
|
|
88
|
+
}), imageStyles = hasThumbnail && {
|
|
89
|
+
backgroundImage: `url(${mediaSrc})`,
|
|
90
|
+
backgroundSize: "cover"
|
|
91
|
+
};
|
|
92
|
+
return /* @__PURE__ */ jsx(Card, { className: clsx("card-file", className), isClickable, isSelectable, isSelected, onClick, app, isFocused, onSelect, children: /* @__PURE__ */ jsxs(Card.Body, { space: "8", children: [
|
|
93
|
+
/* @__PURE__ */ jsx("div", { ref, className: file, style: {
|
|
94
|
+
aspectRatio: "16/10",
|
|
95
|
+
...imageStyles
|
|
96
|
+
}, children: type !== "img" || type === "img" && !hasThumbnail ? /* @__PURE__ */ jsx(FileIcon, { type, roleMap }) : null }),
|
|
97
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
|
|
98
|
+
/* @__PURE__ */ jsx(Card.Text, { children: doc.name }),
|
|
99
|
+
/* @__PURE__ */ jsx(Card.Text, { className: "text-black-50", children: doc == null ? void 0 : doc.ownerDisplayName })
|
|
100
|
+
] })
|
|
101
|
+
] }) });
|
|
102
|
+
};
|
|
103
|
+
export {
|
|
104
|
+
NextcloudFileCard as default
|
|
105
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
|
|
1
|
+
import { NextcloudDocument, WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
|
|
2
2
|
import { TabsItemProps } from '../../../components';
|
|
3
3
|
import { ExternalLinkTabProps } from './innertabs/ExternalLink';
|
|
4
4
|
import { InternalLinkTabProps, InternalLinkTabResult } from './innertabs/InternalLink';
|
|
@@ -54,7 +54,7 @@ export interface MediaLibraryRef {
|
|
|
54
54
|
/**
|
|
55
55
|
* The resulting type depends on the actual selected Tab when modal is closed.
|
|
56
56
|
*/
|
|
57
|
-
export type MediaLibraryResult = WorkspaceElement[] | WorkspaceElement | InternalLinkTabResult | string | /*TODO type des autres résultats ?*/ any;
|
|
57
|
+
export type MediaLibraryResult = WorkspaceElement[] | WorkspaceElement | NextcloudDocument[] | InternalLinkTabResult | string | /*TODO type des autres résultats ?*/ any;
|
|
58
58
|
/**
|
|
59
59
|
* MediaLibrary component properties
|
|
60
60
|
*/
|
|
@@ -12,6 +12,7 @@ import SvgIconSmartphone from "../../icons/components/IconSmartphone.js";
|
|
|
12
12
|
import { InnerTabs } from "./innertabs/index.js";
|
|
13
13
|
import { MediaLibraryContext } from "./MediaLibraryContext.js";
|
|
14
14
|
import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
|
|
15
|
+
import usePublicConf from "../../../hooks/usePublicConf/usePublicConf.js";
|
|
15
16
|
import useHttpErrorToast from "../../../hooks/useHttpErrorToast/useHttpErrorToast.js";
|
|
16
17
|
import Modal from "../../../components/Modal/Modal.js";
|
|
17
18
|
import { Tabs } from "../../../components/Tabs/components/Tabs.js";
|
|
@@ -29,6 +30,8 @@ const orderedTabs = [
|
|
|
29
30
|
// Filesystem browser + drag'n'drop of files
|
|
30
31
|
"workspace",
|
|
31
32
|
// Media browser
|
|
33
|
+
"nextcloud",
|
|
34
|
+
// Nextcloud media browser
|
|
32
35
|
"video-embedder"
|
|
33
36
|
// Link to a hosted video
|
|
34
37
|
], mediaLibraryTypes = {
|
|
@@ -70,7 +73,7 @@ const orderedTabs = [
|
|
|
70
73
|
onCancel,
|
|
71
74
|
onTabChange
|
|
72
75
|
}, ref) => {
|
|
73
|
-
var _a;
|
|
76
|
+
var _a, _b;
|
|
74
77
|
const linkTabProps = useRef(), refModal = useRef(null);
|
|
75
78
|
useImperativeHandle(ref, () => ({
|
|
76
79
|
show,
|
|
@@ -81,7 +84,9 @@ const orderedTabs = [
|
|
|
81
84
|
}));
|
|
82
85
|
const {
|
|
83
86
|
t
|
|
84
|
-
} = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"),
|
|
87
|
+
} = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), nextcloudViewWorkflow = useHasWorkflow("fr.openent.nextcloud.controller.NextcloudController|view"), {
|
|
88
|
+
data: workspacePublicConf
|
|
89
|
+
} = usePublicConf("workspace"), enableNextcloudTab = ((_a = workspacePublicConf == null ? void 0 : workspacePublicConf["folder-service"]) == null ? void 0 : _a.includes("nextcloud")) && nextcloudViewWorkflow, [type, setType] = useState(null);
|
|
85
90
|
useHttpErrorToast({
|
|
86
91
|
active: !!type,
|
|
87
92
|
isDismissible: !0,
|
|
@@ -96,6 +101,14 @@ const orderedTabs = [
|
|
|
96
101
|
availableFor: ["audio", "video", "image", "attachment"],
|
|
97
102
|
isEnable: null
|
|
98
103
|
},
|
|
104
|
+
nextcloud: {
|
|
105
|
+
id: "nextcloud",
|
|
106
|
+
icon: /* @__PURE__ */ jsx(SvgIconGlobe, {}),
|
|
107
|
+
label: t("bbm.nextcloud"),
|
|
108
|
+
content: /* @__PURE__ */ jsx(InnerTabs.Nextcloud, {}),
|
|
109
|
+
availableFor: ["audio", "video", "image", "attachment"],
|
|
110
|
+
isEnable: () => !!enableNextcloudTab
|
|
111
|
+
},
|
|
99
112
|
upload: {
|
|
100
113
|
id: "upload",
|
|
101
114
|
icon: /* @__PURE__ */ jsx(SvgIconSmartphone, {}),
|
|
@@ -177,17 +190,17 @@ const orderedTabs = [
|
|
|
177
190
|
linkTabProps.current = props, "resourceId" in props || "appPrefix" in props || setDefaultTabId("external-link"), setType("hyperlink");
|
|
178
191
|
};
|
|
179
192
|
useEffect(() => {
|
|
180
|
-
var _a2,
|
|
193
|
+
var _a2, _b2;
|
|
181
194
|
const typeKey = type || "none";
|
|
182
|
-
!defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((
|
|
195
|
+
!defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _b2.defaultTab);
|
|
183
196
|
}, [defaultTabId, type]);
|
|
184
|
-
const modalHeader = t(((
|
|
197
|
+
const modalHeader = t(((_b = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _b.title) ?? "bbm"), resetState = () => {
|
|
185
198
|
linkTabProps.current = void 0, setResult(void 0), setResultCounter(void 0), setDefaultTabId(void 0), setPreSuccess(void 0), setDeletionsOnCancel([]);
|
|
186
199
|
}, handleTabChange = (tab) => {
|
|
187
200
|
onTabChange == null || onTabChange(tab, deletionsOnCancel), resetState();
|
|
188
|
-
}, handleOnSuccess = useCallback(() => {
|
|
201
|
+
}, isWorkspaceElementArray = (result2) => Array.isArray(result2) && (result2.length === 0 || "eType" in result2[0]), handleOnSuccess = useCallback(() => {
|
|
189
202
|
const triggerSuccess = async (result2) => {
|
|
190
|
-
result2
|
|
203
|
+
isWorkspaceElementArray(result2) && ["protected", "public"].findIndex((v) => v === visibility) >= 0 && (result2 = await odeServices.workspace().transferDocuments(result2, appCode ?? "media-library", visibility)), onSuccess(result2);
|
|
191
204
|
};
|
|
192
205
|
onSuccessAction ? onSuccessAction().then((result2) => {
|
|
193
206
|
triggerSuccess(result2);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Nextcloud: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { odeServices } from "@edifice.io/client";
|
|
3
|
+
import { useMediaLibraryContext } from "../MediaLibraryContext.js";
|
|
4
|
+
import useUser from "../../../../hooks/useUser/useUser.js";
|
|
5
|
+
import Nextcloud$1 from "../../Nextcloud/Nextcloud.js";
|
|
6
|
+
const Nextcloud = () => {
|
|
7
|
+
const {
|
|
8
|
+
type,
|
|
9
|
+
setResultCounter,
|
|
10
|
+
setResult,
|
|
11
|
+
setPreSuccess,
|
|
12
|
+
multiple
|
|
13
|
+
} = useMediaLibraryContext(), {
|
|
14
|
+
user
|
|
15
|
+
} = useUser();
|
|
16
|
+
function getDocumentRoleFilter() {
|
|
17
|
+
switch (type) {
|
|
18
|
+
case "image":
|
|
19
|
+
return "img";
|
|
20
|
+
case "audio":
|
|
21
|
+
return "audio";
|
|
22
|
+
case "video":
|
|
23
|
+
return "video";
|
|
24
|
+
default:
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function handleSelect(result) {
|
|
29
|
+
setResultCounter(result.length), result.length ? (setResult(result), setPreSuccess(() => () => user != null && user.userId ? odeServices.nextcloud().copyDocumentToWorkspace(user.userId, result.map((doc) => doc.path)) : Promise.resolve([]))) : (setResult(), setPreSuccess(void 0));
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsx(Nextcloud$1, { roles: getDocumentRoleFilter(), onSelect: handleSelect, multiple, className: "border rounded overflow-y-auto" });
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
Nextcloud
|
|
35
|
+
};
|
|
@@ -4,6 +4,7 @@ export declare const InnerTabs: {
|
|
|
4
4
|
Upload: () => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
ExternalLink: ({ link, multiNodeSelected, }: import('./ExternalLink').ExternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
Workspace: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Nextcloud: () => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
InternalLink: ({ target, resourceId, appPrefix, }: import('./InternalLink').InternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
Iframe: () => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
VideoEmbedder: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,6 +2,7 @@ import { Audio } from "./Audio.js";
|
|
|
2
2
|
import { ExternalLink } from "./ExternalLink.js";
|
|
3
3
|
import { Iframe } from "./Iframe.js";
|
|
4
4
|
import { InternalLink } from "./InternalLink.js";
|
|
5
|
+
import { Nextcloud } from "./Nextcloud.js";
|
|
5
6
|
import { Upload } from "./Upload.js";
|
|
6
7
|
import { Video } from "./Video.js";
|
|
7
8
|
import { VideoEmbedder } from "./VideoEmbedder.js";
|
|
@@ -12,6 +13,7 @@ const InnerTabs = {
|
|
|
12
13
|
Upload,
|
|
13
14
|
ExternalLink,
|
|
14
15
|
Workspace,
|
|
16
|
+
Nextcloud,
|
|
15
17
|
InternalLink,
|
|
16
18
|
Iframe,
|
|
17
19
|
VideoEmbedder
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NextcloudDocument, Role } from '@edifice.io/client';
|
|
2
|
+
/**
|
|
3
|
+
* Nextcloud component properties
|
|
4
|
+
*/
|
|
5
|
+
export interface NextcloudProps {
|
|
6
|
+
/**
|
|
7
|
+
* Notify parent when media elements are successfully selected.
|
|
8
|
+
*/
|
|
9
|
+
onSelect: (result: NextcloudDocument[]) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Boolean to know if we can select 1 or many files.
|
|
12
|
+
*/
|
|
13
|
+
multiple?: boolean | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Document roles to filter files by; null (default) shows all roles.
|
|
16
|
+
*/
|
|
17
|
+
roles?: Role | Role[] | null;
|
|
18
|
+
/**
|
|
19
|
+
* Optional class for styling purpose
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
declare const Nextcloud: ({ onSelect, multiple, roles, className, }: NextcloudProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export default Nextcloud;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useEffect, useMemo } from "react";
|
|
3
|
+
import { DocumentHelper } from "@edifice.io/client";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
import { findNodeById } from "../../../components/Tree/utilities/tree.js";
|
|
7
|
+
import SvgIconSortAscendingLetters from "../../icons/components/IconSortAscendingLetters.js";
|
|
8
|
+
import SvgIconSortDescendingLetters from "../../icons/components/IconSortDescendingLetters.js";
|
|
9
|
+
import SvgIconSortTime from "../../icons/components/IconSortTime.js";
|
|
10
|
+
import illuNoContentInFolder from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-no-content-in-folder.svg";
|
|
11
|
+
import useUser from "../../../hooks/useUser/useUser.js";
|
|
12
|
+
import useNextcloudSearch from "../../../hooks/useNextcloudSearch/useNextcloudSearch.js";
|
|
13
|
+
import { Grid } from "../../../components/Grid/Grid.js";
|
|
14
|
+
import Tree from "../../../components/Tree/components/Tree.js";
|
|
15
|
+
import SearchBar from "../../../components/SearchBar/SearchBar.js";
|
|
16
|
+
import Dropdown from "../../../components/Dropdown/Dropdown.js";
|
|
17
|
+
import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
|
|
18
|
+
import NextcloudFileCard from "../FileCard/NextcloudFileCard.js";
|
|
19
|
+
import EmptyScreen from "../../../components/EmptyScreen/EmptyScreen.js";
|
|
20
|
+
const ROOT_ID = "root";
|
|
21
|
+
function compare(a, b) {
|
|
22
|
+
return a ? b ? a.localeCompare(b) : 1 : -1;
|
|
23
|
+
}
|
|
24
|
+
const Nextcloud = ({
|
|
25
|
+
onSelect,
|
|
26
|
+
multiple = !0,
|
|
27
|
+
roles,
|
|
28
|
+
className
|
|
29
|
+
}) => {
|
|
30
|
+
const {
|
|
31
|
+
t
|
|
32
|
+
} = useTranslation(), {
|
|
33
|
+
user
|
|
34
|
+
} = useUser(), {
|
|
35
|
+
root,
|
|
36
|
+
loadContent
|
|
37
|
+
} = useNextcloudSearch(ROOT_ID, t("nextcloud"), user == null ? void 0 : user.userId), [currentNodeId, setCurrentNodeId] = useState(ROOT_ID), treeRoot = root, currentNode = findNodeById(treeRoot, currentNodeId) ?? root, [searchTerm, setSearchTerm] = useState(null), [sortOrder, setSortOrder] = useState(["modified", "desc"]), [selectedDocuments, setSelectedDocuments] = useState([]), handleTreeItemChange = useCallback((nodeId) => {
|
|
38
|
+
setCurrentNodeId(nodeId), loadContent(nodeId);
|
|
39
|
+
}, [loadContent]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
loadContent(ROOT_ID);
|
|
42
|
+
}, [loadContent]);
|
|
43
|
+
const documents = useMemo(() => {
|
|
44
|
+
if (!currentNode.files) return;
|
|
45
|
+
let list = [].concat(currentNode.files);
|
|
46
|
+
searchTerm && (list = list.filter((f) => f.name.indexOf(searchTerm) >= 0)), roles && (list = list.filter((f) => {
|
|
47
|
+
const role = DocumentHelper.role(f.contentType, !1);
|
|
48
|
+
return typeof roles == "string" ? roles === role : Array.isArray(roles) ? roles.includes(role) : !1;
|
|
49
|
+
}));
|
|
50
|
+
const sortFunction = sortOrder[0] === "name" ? sortOrder[1] === "asc" ? (a, b) => compare(a.name, b.name) : (a, b) => compare(b.name, a.name) : (a, b) => compare(b.lastModified, a.lastModified);
|
|
51
|
+
return list.sort(sortFunction);
|
|
52
|
+
}, [root, currentNode, searchTerm, sortOrder, roles]), selectedPaths = useMemo(() => new Set(selectedDocuments.map((d) => d.path)), [selectedDocuments]), handleSearchChange = useCallback((e) => {
|
|
53
|
+
setSearchTerm(e.target.value);
|
|
54
|
+
}, [setSearchTerm]);
|
|
55
|
+
function getSortOrderLabel() {
|
|
56
|
+
return sortOrder[0] === "name" ? sortOrder[1] === "asc" ? t("sort.order.alpha.asc") : t("sort.order.alpha.desc") : t("sort.order.modify.desc");
|
|
57
|
+
}
|
|
58
|
+
function handleSelectDoc(doc) {
|
|
59
|
+
let currentDocuments = [...selectedDocuments];
|
|
60
|
+
multiple ? currentDocuments.includes(doc) ? currentDocuments = currentDocuments.filter((selectedDocument) => selectedDocument.path !== doc.path) : currentDocuments = [...currentDocuments, doc] : currentDocuments = [doc], setSelectedDocuments(currentDocuments), onSelect(currentDocuments);
|
|
61
|
+
}
|
|
62
|
+
const nextcloud = clsx("workspace flex-grow-1 gap-0", className);
|
|
63
|
+
return /* @__PURE__ */ jsxs(Grid, { className: nextcloud, children: [
|
|
64
|
+
/* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "3", xl: "4", className: "workspace-folders p-12 pt-0 gap-12", children: /* @__PURE__ */ jsx("div", { style: {
|
|
65
|
+
position: "sticky",
|
|
66
|
+
top: 0,
|
|
67
|
+
paddingTop: "1.2rem"
|
|
68
|
+
}, children: /* @__PURE__ */ jsx(Tree, { nodes: treeRoot, selectedNodeId: currentNodeId, showIcon: !0, onTreeItemClick: handleTreeItemChange, onTreeItemUnfold: handleTreeItemChange }) }) }),
|
|
69
|
+
/* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "5", xl: "8", children: /* @__PURE__ */ jsxs(Grid, { className: "flex-grow-1 gap-0", children: [
|
|
70
|
+
/* @__PURE__ */ jsxs(Grid.Col, { sm: "4", md: "8", xl: "12", children: [
|
|
71
|
+
/* @__PURE__ */ jsx("div", { className: "workspace-search px-16 py-8 ", children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, className: "gap-16", onChange: handleSearchChange }) }),
|
|
72
|
+
/* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center justify-content-end px-8 py-4", children: [
|
|
73
|
+
/* @__PURE__ */ jsx("small", { className: "text-muted", children: t("workspace.search.order") }),
|
|
74
|
+
/* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
75
|
+
/* @__PURE__ */ jsx(Dropdown.Trigger, { size: "sm", label: getSortOrderLabel(), variant: "ghost" }),
|
|
76
|
+
/* @__PURE__ */ jsxs(Dropdown.Menu, { children: [
|
|
77
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortTime, {}), onClick: () => setSortOrder(["modified", "desc"]), children: t("sort.order.modify.desc") }),
|
|
78
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortAscendingLetters, {}), onClick: () => setSortOrder(["name", "asc"]), children: t("sort.order.alpha.asc") }),
|
|
79
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortDescendingLetters, {}), onClick: () => setSortOrder(["name", "desc"]), children: t("sort.order.alpha.desc") })
|
|
80
|
+
] })
|
|
81
|
+
] })
|
|
82
|
+
] })
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ jsx(Grid.Col, { sm: "4", md: "8", xl: "12", className: "p-8 gap-8", children: documents ? documents.length !== 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-workspace", children: documents.map((doc) => {
|
|
85
|
+
const isSelected = selectedPaths.has(doc.path);
|
|
86
|
+
return /* @__PURE__ */ jsx(NextcloudFileCard, { doc, userId: user.userId, isSelected, onClick: () => handleSelectDoc(doc) }, doc.path);
|
|
87
|
+
}) }) : /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuNoContentInFolder, size: 64, text: t("nextcloud.empty.docSpace") }) : /* @__PURE__ */ jsx(LoadingScreen, {}) })
|
|
88
|
+
] }) })
|
|
89
|
+
] });
|
|
90
|
+
};
|
|
91
|
+
export {
|
|
92
|
+
Nextcloud as default
|
|
93
|
+
};
|
package/dist/multimedia.js
CHANGED
|
@@ -4,12 +4,14 @@ import { default as default4 } from "./modules/multimedia/FileCard/FileCard.js";
|
|
|
4
4
|
import { default as default5 } from "./modules/multimedia/ImageEditor/components/ImageEditor.js";
|
|
5
5
|
import { default as default6 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
|
|
6
6
|
import { default as default7 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
|
|
7
|
-
import { default as default8 } from "./modules/multimedia/
|
|
8
|
-
import { default as default9 } from "./modules/multimedia/
|
|
9
|
-
import { default as default10 } from "./modules/multimedia/
|
|
10
|
-
import { default as default11 } from "./modules/multimedia/
|
|
11
|
-
import { default as default12 } from "./modules/multimedia/
|
|
12
|
-
import { default as default13 } from "./modules/multimedia/
|
|
7
|
+
import { default as default8 } from "./modules/multimedia/Nextcloud/Nextcloud.js";
|
|
8
|
+
import { default as default9 } from "./modules/multimedia/FileCard/NextcloudFileCard.js";
|
|
9
|
+
import { default as default10 } from "./modules/multimedia/UploadCard/UploadCard.js";
|
|
10
|
+
import { default as default11 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
|
|
11
|
+
import { default as default12 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
|
|
12
|
+
import { default as default13 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
|
|
13
|
+
import { default as default14 } from "./modules/multimedia/Workspace/Workspace.js";
|
|
14
|
+
import { default as default15 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
|
|
13
15
|
import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
|
|
14
16
|
import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
|
|
15
17
|
import { Upload } from "./modules/multimedia/MediaLibrary/innertabs/Upload.js";
|
|
@@ -22,11 +24,13 @@ export {
|
|
|
22
24
|
default6 as ImagePicker,
|
|
23
25
|
InternalLinker,
|
|
24
26
|
default7 as MediaLibrary,
|
|
27
|
+
default8 as Nextcloud,
|
|
28
|
+
default9 as NextcloudFileCard,
|
|
25
29
|
Upload,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
default10 as UploadCard,
|
|
31
|
+
default11 as UploadFiles,
|
|
32
|
+
default12 as VideoEmbed,
|
|
33
|
+
default13 as VideoRecorder,
|
|
34
|
+
default14 as Workspace,
|
|
35
|
+
default15 as WorkspaceFolders
|
|
32
36
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.6.0-develop-
|
|
3
|
+
"version": "2.6.0-develop-integration.20260722215838",
|
|
4
4
|
"description": "Edifice React Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -140,9 +140,9 @@
|
|
|
140
140
|
"swiper": "10.1.0",
|
|
141
141
|
"ua-parser-js": "1.0.36",
|
|
142
142
|
"zustand": "4.5.7",
|
|
143
|
-
"@edifice.io/bootstrap": "2.6.0-develop-
|
|
144
|
-
"@edifice.io/
|
|
145
|
-
"@edifice.io/
|
|
143
|
+
"@edifice.io/bootstrap": "2.6.0-develop-integration.20260722215838",
|
|
144
|
+
"@edifice.io/tiptap-extensions": "2.6.0-develop-integration.20260722215838",
|
|
145
|
+
"@edifice.io/utilities": "2.6.0-develop-integration.20260722215838"
|
|
146
146
|
},
|
|
147
147
|
"devDependencies": {
|
|
148
148
|
"@babel/plugin-transform-react-pure-annotations": "7.27.1",
|
|
@@ -173,8 +173,8 @@
|
|
|
173
173
|
"vite": "5.4.14",
|
|
174
174
|
"vite-plugin-dts": "4.5.4",
|
|
175
175
|
"vite-tsconfig-paths": "5.1.4",
|
|
176
|
-
"@edifice.io/client": "2.6.0-develop-
|
|
177
|
-
"@edifice.io/config": "2.6.0-develop-
|
|
176
|
+
"@edifice.io/client": "2.6.0-develop-integration.20260722215838",
|
|
177
|
+
"@edifice.io/config": "2.6.0-develop-integration.20260722215838"
|
|
178
178
|
},
|
|
179
179
|
"peerDependencies": {
|
|
180
180
|
"@react-spring/web": "9.7.5",
|
|
@@ -198,6 +198,7 @@
|
|
|
198
198
|
"format:write": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
199
199
|
"lint": "eslint",
|
|
200
200
|
"test": "vitest",
|
|
201
|
-
"test:watch": "vitest --watch"
|
|
201
|
+
"test:watch": "vitest --watch",
|
|
202
|
+
"test:coverage": "vitest run --coverage"
|
|
202
203
|
}
|
|
203
204
|
}
|