@edifice.io/react 2.1.0-develop-enabling.0 → 2.1.0-develop-wl.20250204154502
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/README.md +3 -3
- package/dist/components/AppIcon/AppIcon.js +2 -2
- package/dist/components/Attachment/Attachment.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Form/FormContext.js +1 -1
- package/dist/components/Form/FormControl.js +1 -1
- package/dist/components/Layout/components/Header.js +5 -4
- package/dist/components/Layout/components/WidgetApps.js +1 -1
- package/dist/{hooks/useHeader → components/Layout/hooks}/useHeader.js +6 -6
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Tree/components/SortableTree.js +3 -2
- package/dist/components/Tree/types/index.d.ts +1 -0
- package/dist/components/Tree/utilities/tree.d.ts +2 -1
- package/dist/hooks/index.d.ts +1 -5
- package/dist/hooks/useConf/useConf.d.ts +2 -2
- package/dist/hooks/useDropdown/useDropdown.js +1 -1
- package/dist/hooks/useDropzone/useDropzone.js +1 -1
- package/dist/hooks/useHasWorkflow/useHasWorkflow.js +3 -11
- package/dist/hooks/useHttpErrorToast/index.d.ts +1 -0
- package/dist/hooks/useHttpErrorToast/useHttpErrorToast.d.ts +3 -0
- package/dist/hooks/useHttpErrorToast/useHttpErrorToast.js +21 -0
- package/dist/hooks/useSession/useSession.d.ts +2 -1
- package/dist/hooks/useTrapFocus/useTrapFocus.d.ts +1 -1
- package/dist/hooks/useTrapFocus/useTrapFocus.js +3 -2
- package/dist/hooks/useUploadFiles/useUploadFiles.js +1 -1
- package/dist/hooks/useWorkspaceSearch/useWorkspaceSearch.js +3 -11
- package/dist/icons-apps.js +220 -218
- package/dist/index.js +138 -144
- package/dist/modules/audience/ReactionChoice.d.ts +13 -0
- package/dist/modules/audience/ReactionModal.Card.js +4 -4
- package/dist/modules/audience/ReactionModal.d.ts +24 -6
- package/dist/modules/audience/ReactionModal.js +12 -9
- package/dist/modules/audience/ReactionSummary.d.ts +9 -0
- package/dist/modules/audience/ViewsCounter.d.ts +10 -0
- package/dist/modules/audience/ViewsModal.d.ts +13 -1
- package/dist/modules/audience/ViewsModal.js +22 -19
- package/dist/modules/comments/components/Comment.js +10 -7
- package/dist/modules/comments/components/CommentAvatar.js +1 -1
- package/dist/modules/comments/components/DeleteModal.d.ts +7 -0
- package/dist/modules/comments/components/DeleteModal.js +19 -0
- package/dist/modules/comments/context/Context.d.ts +2 -0
- package/dist/modules/comments/hooks/useComments.d.ts +5 -2
- package/dist/modules/comments/hooks/useComments.js +1 -1
- package/dist/modules/comments/hooks/useCommentsContext.d.ts +1 -0
- package/dist/modules/comments/hooks/useProfileQueries.d.ts +4 -1
- package/dist/modules/comments/provider/CommentProvider.js +3 -2
- package/dist/modules/comments/types.d.ts +5 -1
- package/dist/modules/editor/components/Editor/Editor.js +2 -2
- package/dist/modules/editor/components/{Editor → MathsModal}/MathsModal.d.ts +1 -1
- package/dist/modules/editor/components/{Editor → MathsModal}/MathsModal.js +2 -3
- package/dist/modules/editor/components/MathsModal/index.d.ts +1 -0
- package/dist/modules/editor/components/Renderer/AttachmentRenderer.js +12 -7
- package/dist/modules/editor/components/Renderer/AudioRenderer.js +4 -1
- package/dist/modules/editor/components/Renderer/LinkerRenderer.js +1 -1
- package/dist/modules/editor/components/Renderer/MediaRenderer.js +10 -2
- package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useSpeechRecognition.js +2 -0
- package/dist/modules/editor/hooks/useSpeechSynthetisis.js +2 -0
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useTipTapEditor.js +4 -4
- package/dist/modules/icons/components/apps/IconAppointments.d.ts +7 -0
- package/dist/modules/icons/components/apps/IconAppointments.js +12 -0
- package/dist/modules/icons/components/apps/index.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +5 -1
- package/dist/modules/multimedia/UploadCard/UploadCard.js +2 -2
- package/dist/modules/multimedia/index.d.ts +2 -0
- package/dist/multimedia.js +10 -6
- package/dist/providers/MockedProvider/MockedProvider.d.ts +4 -0
- package/dist/providers/MockedProvider/MockedProvider.js +20 -0
- package/dist/providers/index.d.ts +1 -0
- package/package.json +57 -54
- package/dist/hooks/useAvatar/index.d.ts +0 -1
- package/dist/hooks/useAvatar/useAvatar.d.ts +0 -6
- package/dist/hooks/useAvatar/useAvatar.js +0 -30
- package/dist/hooks/useHeader/index.d.ts +0 -1
- package/dist/hooks/useHeader/useHeader.d.ts +0 -5
- package/dist/providers/MockedDataProvider/MockedDataProvider.d.ts +0 -28
- package/dist/providers/MockedDataProvider/MockedDataProvider.js +0 -9
- package/dist/providers/MockedDataProvider/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -52,8 +52,8 @@ src
|
|
|
52
52
|
- Export everything if Component has types & interfaces
|
|
53
53
|
|
|
54
54
|
```jsx
|
|
55
|
-
export { default as Component } from
|
|
56
|
-
export * from
|
|
55
|
+
export { default as Component } from './Component';
|
|
56
|
+
export * from './Component';
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### Component Guideline
|
|
@@ -102,7 +102,7 @@ export interface ButtonProps {
|
|
|
102
102
|
- Import your component inside `index.ts` file.
|
|
103
103
|
|
|
104
104
|
```jsx
|
|
105
|
-
export * from
|
|
105
|
+
export * from './Button';
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
## Dev
|
|
@@ -2,9 +2,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import * as iconsApps from "../../icons-apps.js";
|
|
5
|
+
import useEdificeIcons from "../../hooks/useEdificeIcons/useEdificeIcons.js";
|
|
5
6
|
import SvgIconPlaceholder from "../../modules/icons/components/apps/IconPlaceholder.js";
|
|
6
7
|
import Image from "../Image/Image.js";
|
|
7
|
-
import useEdificeIcons from "../../hooks/useEdificeIcons/useEdificeIcons.js";
|
|
8
8
|
const AppIcon = /* @__PURE__ */ forwardRef(({
|
|
9
9
|
app,
|
|
10
10
|
size = "24",
|
|
@@ -32,7 +32,7 @@ const AppIcon = /* @__PURE__ */ forwardRef(({
|
|
|
32
32
|
...iconSizes,
|
|
33
33
|
...iconVariant,
|
|
34
34
|
...iconFits,
|
|
35
|
-
[`bg-light-${appCode}`]:
|
|
35
|
+
[`bg-light-${appCode}`]: !isContain,
|
|
36
36
|
[`color-app-${appCode}`]: appCode
|
|
37
37
|
}, className), IconComponent = iconsApps[`Icon${appCode.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("")}`] ?? SvgIconPlaceholder;
|
|
38
38
|
if (isIconURL) {
|
|
@@ -6,7 +6,7 @@ const Attachment = /* @__PURE__ */ forwardRef(({
|
|
|
6
6
|
name = "Attachment Name",
|
|
7
7
|
options,
|
|
8
8
|
...restProps
|
|
9
|
-
}, ref) => /* @__PURE__ */ jsxs("div", { ref, className: "attachment px-12 py-8", ...restProps, children: [
|
|
9
|
+
}, ref) => /* @__PURE__ */ jsxs("div", { ref, className: "attachment px-12 py-8", ...restProps, tabIndex: 0, children: [
|
|
10
10
|
/* @__PURE__ */ jsxs(Tooltip, { message: name, className: "filename text-truncate d-flex align-items-center gap-8", children: [
|
|
11
11
|
/* @__PURE__ */ jsx(SvgIconPaperclip, { height: 22, width: 22 }),
|
|
12
12
|
/* @__PURE__ */ jsx("div", { className: "filename text-truncate", children: name })
|
|
@@ -24,7 +24,7 @@ const Button = /* @__PURE__ */ forwardRef(({
|
|
|
24
24
|
"btn-lg": size === "lg",
|
|
25
25
|
"btn-sm": size === "sm"
|
|
26
26
|
}, className);
|
|
27
|
-
return /* @__PURE__ */ jsx("button", { ref, className: classes, type, ...restProps, children: isLoading ? /* @__PURE__ */ jsx(Loading, { isLoading: !0, loadingIcon, loadingPosition, children }) : /* @__PURE__ */ jsxs("span", { children: [
|
|
27
|
+
return /* @__PURE__ */ jsx("button", { ref, "data-testid": "button", className: classes, type, ...restProps, children: isLoading ? /* @__PURE__ */ jsx(Loading, { isLoading: !0, loadingIcon, loadingPosition, children }) : /* @__PURE__ */ jsxs("span", { children: [
|
|
28
28
|
leftIcon,
|
|
29
29
|
children,
|
|
30
30
|
rightIcon
|
|
@@ -2,8 +2,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useMemo } from "react";
|
|
3
3
|
import { Context } from "./FormContext.js";
|
|
4
4
|
import FormText from "./FormText.js";
|
|
5
|
-
import Label from "../Label/Label.js";
|
|
6
5
|
import Input from "../Input/Input.js";
|
|
6
|
+
import Label from "../Label/Label.js";
|
|
7
7
|
const Root = /* @__PURE__ */ forwardRef(({
|
|
8
8
|
children,
|
|
9
9
|
className,
|
|
@@ -4,16 +4,18 @@ import { useTranslation } from "react-i18next";
|
|
|
4
4
|
import { useEdificeClient } from "../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
5
5
|
import { useEdificeTheme } from "../../../providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
|
|
6
6
|
import SvgIconRafterDown from "../../../modules/icons/components/IconRafterDown.js";
|
|
7
|
-
import SvgIconAssistance from "../../../modules/icons/components/apps/IconAssistance.js";
|
|
8
7
|
import SvgIconCommunity from "../../../modules/icons/components/nav/IconCommunity.js";
|
|
9
8
|
import SvgIconDisconnect from "../../../modules/icons/components/nav/IconDisconnect.js";
|
|
10
9
|
import SvgIconHome from "../../../modules/icons/components/nav/IconHome.js";
|
|
11
10
|
import SvgIconMyApps from "../../../modules/icons/components/nav/IconMyApps.js";
|
|
11
|
+
import SvgIconNeoAssistance from "../../../modules/icons/components/nav/IconNeoAssistance.js";
|
|
12
12
|
import SvgIconNeoMessaging from "../../../modules/icons/components/nav/IconNeoMessaging.js";
|
|
13
13
|
import SvgIconNewRelease from "../../../modules/icons/components/nav/IconNewRelease.js";
|
|
14
|
+
import SvgIconOneAssistance from "../../../modules/icons/components/nav/IconOneAssistance.js";
|
|
14
15
|
import SvgIconOneMessaging from "../../../modules/icons/components/nav/IconOneMessaging.js";
|
|
15
16
|
import SvgIconOneProfile from "../../../modules/icons/components/nav/IconOneProfile.js";
|
|
16
17
|
import SvgIconUserbook from "../../../modules/icons/components/nav/IconUserbook.js";
|
|
18
|
+
import useHeader from "../hooks/useHeader.js";
|
|
17
19
|
import Help from "./Help.js";
|
|
18
20
|
import { Navbar } from "./Navbar.js";
|
|
19
21
|
import { NavBarNav } from "./NavbarNav.js";
|
|
@@ -25,7 +27,6 @@ import useConversation from "../../../hooks/useConversation/useConversation.js";
|
|
|
25
27
|
import useUser from "../../../hooks/useUser/useUser.js";
|
|
26
28
|
import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
|
|
27
29
|
import { useHelp } from "../hooks/useHelp.js";
|
|
28
|
-
import useHeader from "../../../hooks/useHeader/useHeader.js";
|
|
29
30
|
import Avatar from "../../Avatar/Avatar.js";
|
|
30
31
|
import Badge from "../../Badge/Badge.js";
|
|
31
32
|
import VisuallyHidden from "../../VisuallyHidden/VisuallyHidden.js";
|
|
@@ -98,7 +99,7 @@ const Header = ({
|
|
|
98
99
|
/* @__PURE__ */ jsxs("button", { className: "nav-link", onClick: () => {
|
|
99
100
|
setIsHelpOpen(!0);
|
|
100
101
|
}, children: [
|
|
101
|
-
/* @__PURE__ */ jsx(
|
|
102
|
+
/* @__PURE__ */ jsx(SvgIconOneAssistance, { className: "icon help" }),
|
|
102
103
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: t("navbar.help") })
|
|
103
104
|
] }),
|
|
104
105
|
/* @__PURE__ */ jsx(Help, { isHelpOpen, setIsHelpOpen, parsedContent, parsedHeadline, error })
|
|
@@ -157,7 +158,7 @@ const Header = ({
|
|
|
157
158
|
/* @__PURE__ */ jsxs("button", { className: "nav-link btn btn-naked", onClick: () => {
|
|
158
159
|
setIsHelpOpen(!0);
|
|
159
160
|
}, children: [
|
|
160
|
-
/* @__PURE__ */ jsx(
|
|
161
|
+
/* @__PURE__ */ jsx(SvgIconNeoAssistance, { color: "#fff" }),
|
|
161
162
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: t("support") })
|
|
162
163
|
] }),
|
|
163
164
|
/* @__PURE__ */ jsx(Help, { isHelpOpen, setIsHelpOpen, parsedContent, parsedHeadline, error })
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useState, useId, useCallback, useMemo } from "react";
|
|
2
2
|
import { odeServices } from "@edifice.io/client";
|
|
3
|
+
import { useHover } from "@uidotdev/usehooks";
|
|
3
4
|
import { useTranslation } from "react-i18next";
|
|
4
|
-
import { useEdificeClient } from "
|
|
5
|
-
import { useEdificeTheme } from "
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import useHasWorkflow from "../useHasWorkflow/useHasWorkflow.js";
|
|
5
|
+
import { useEdificeClient } from "../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
6
|
+
import { useEdificeTheme } from "../../../providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
|
|
7
|
+
import useBookmark from "../../../hooks/useBookmark/useBookmark.js";
|
|
8
|
+
import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
|
|
9
9
|
function useHeader({
|
|
10
10
|
user,
|
|
11
11
|
avatar
|
|
@@ -39,7 +39,7 @@ function useHeader({
|
|
|
39
39
|
isCollapsed,
|
|
40
40
|
toggleCollapsedNav,
|
|
41
41
|
handleLogout
|
|
42
|
-
}), [appsRef, bookmarkedApps, communityWorkflow, conversationWorflow, isAppsHovered, isCollapsed, popoverAppsId, popoverSearchId, searchWorkflow, title, toggleCollapsedNav, userAvatar, userName, welcomeUser]);
|
|
42
|
+
}), [appsRef, bookmarkedApps, communityWorkflow, conversationWorflow, handleLogout, isAppsHovered, isCollapsed, popoverAppsId, popoverSearchId, searchWorkflow, title, toggleCollapsedNav, userAvatar, userName, welcomeUser]);
|
|
43
43
|
}
|
|
44
44
|
export {
|
|
45
45
|
useHeader as default
|
|
@@ -20,7 +20,7 @@ const Root = /* @__PURE__ */ forwardRef((props, ref) => {
|
|
|
20
20
|
scrollable = !1,
|
|
21
21
|
focusId,
|
|
22
22
|
children
|
|
23
|
-
} = props, ariaLabelId = `aria_label_${id}`, ariaDescriptionId = `aria_desc_${id}`, modalRef = useClickOutside(onModalClose), trapRef = useTrapFocus();
|
|
23
|
+
} = props, ariaLabelId = `aria_label_${id}`, ariaDescriptionId = `aria_desc_${id}`, modalRef = useClickOutside(onModalClose), trapRef = useTrapFocus(isOpen);
|
|
24
24
|
useKeyPress(onModalClose, ["Escape"]), useEffect(() => {
|
|
25
25
|
if (isOpen && (document.body.style.overflow = "hidden", focusId)) {
|
|
26
26
|
const elem = document.getElementById(focusId);
|
|
@@ -11,6 +11,7 @@ import SvgIconRafterRight from "../../../modules/icons/components/IconRafterRigh
|
|
|
11
11
|
import { useTree } from "../hooks/useTree.js";
|
|
12
12
|
import { useTreeSortable } from "../hooks/useTreeSortable.js";
|
|
13
13
|
import { flattenNodes } from "../utilities/tree-sortable.js";
|
|
14
|
+
import { mergeRefs } from "../../../utilities/refs/ref.js";
|
|
14
15
|
const SortableTree = ({
|
|
15
16
|
nodes,
|
|
16
17
|
selectedNodeId: externalSelectedNodeId,
|
|
@@ -73,7 +74,7 @@ const SortableTree = ({
|
|
|
73
74
|
renderNode,
|
|
74
75
|
onTreeItemClick,
|
|
75
76
|
onToggleNode
|
|
76
|
-
}) => {
|
|
77
|
+
}, ref) => {
|
|
77
78
|
const {
|
|
78
79
|
t
|
|
79
80
|
} = useTranslation(), selected = selectedNodeId === node.id, expanded = expandedNodes.has(node.id), animateLayoutChanges = ({
|
|
@@ -108,7 +109,7 @@ const SortableTree = ({
|
|
|
108
109
|
}, handleItemToggleKeyDown = (event) => {
|
|
109
110
|
(event.code === "Enter" || event.code === "Space") && (event.preventDefault(), event.stopPropagation(), onToggleNode == null || onToggleNode(node.id));
|
|
110
111
|
}, spaceGestion = () => isDragging ? isChild ? depth === 1 ? `${indentationWidth * depth}px` : "0px" : `${indentationWidth * depth}px` : isChild ? "20px" : null;
|
|
111
|
-
return /* @__PURE__ */ jsx("li", { ref: setNodeRef, id: `treeitem-${node.id}`, role: "treeitem", "aria-selected": selected, "aria-expanded": expanded, style: {
|
|
112
|
+
return /* @__PURE__ */ jsx("li", { ref: mergeRefs(setNodeRef, ref), id: `treeitem-${node.id}`, role: "treeitem", "aria-selected": selected, "aria-expanded": expanded, style: {
|
|
112
113
|
...style,
|
|
113
114
|
marginLeft: spaceGestion()
|
|
114
115
|
}, ...listeners, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: treeItemClasses.action, children: [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IFolder } from '@edifice.io/client';
|
|
2
2
|
import { TreeItem } from '../types';
|
|
3
3
|
export declare function findNodeById(data: TreeItem | TreeItem[], id: string): TreeItem | undefined;
|
|
4
|
+
export declare function getChildrenIds(data: TreeItem[], folderId: string): string[];
|
|
4
5
|
export declare function addNode(node: TreeItem, { parentId, newFolder }: {
|
|
5
6
|
parentId: string;
|
|
6
7
|
newFolder: IFolder;
|
|
@@ -10,7 +11,7 @@ export declare function deleteNode(node: TreeItem, { folders }: {
|
|
|
10
11
|
folders: string[];
|
|
11
12
|
}): TreeItem;
|
|
12
13
|
export declare const findParentNode: (parentNode: TreeItem, childId: string) => TreeItem | undefined;
|
|
13
|
-
export declare function getAncestors(data: TreeItem, folderId: string): string[];
|
|
14
|
+
export declare function getAncestors(data: TreeItem[], folderId: string): string[];
|
|
14
15
|
export declare function hasChildren(folderId: string, data: TreeItem): boolean;
|
|
15
16
|
export declare function modifyNode(data: TreeItem, callback: (node: TreeItem, parent?: TreeItem) => TreeItem | undefined): TreeItem;
|
|
16
17
|
export declare function moveNode(node: TreeItem, { destinationId, folders }: {
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
export * from './useAvatar';
|
|
2
1
|
export * from './useBookmark';
|
|
3
2
|
export * from './useBreakpoint';
|
|
4
3
|
export * from './useBrowserInfo';
|
|
5
4
|
export * from './useCantoo';
|
|
6
5
|
export * from './useCheckable';
|
|
7
6
|
export * from './useClickOutside';
|
|
8
|
-
export * from './useConf';
|
|
9
7
|
export * from './useConversation';
|
|
10
8
|
export * from './useDate';
|
|
11
9
|
export * from './useDebounce';
|
|
@@ -14,16 +12,14 @@ export * from './useDropdown';
|
|
|
14
12
|
export * from './useDropzone';
|
|
15
13
|
export * from './useEdificeIcons';
|
|
16
14
|
export * from './useHasWorkflow';
|
|
17
|
-
export * from './useHeader';
|
|
18
15
|
export * from './useHover';
|
|
16
|
+
export * from './useHttpErrorToast';
|
|
19
17
|
export * from './useImage';
|
|
20
18
|
export * from './useIsAdml';
|
|
21
19
|
export * from './useKeyPress';
|
|
22
20
|
export * from './useLibraryUrl';
|
|
23
21
|
export * from './useMediaLibrary';
|
|
24
|
-
export * from './useResourceSearch';
|
|
25
22
|
export * from './useScrollToTop';
|
|
26
|
-
export * from './useSession';
|
|
27
23
|
export * from './useTitle';
|
|
28
24
|
export * from './useToast';
|
|
29
25
|
export * from './useToggle';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { App } from '@edifice.io/client';
|
|
1
|
+
import { App, IGetConf } from '@edifice.io/client';
|
|
2
2
|
export default function useConf({ appCode }: {
|
|
3
3
|
appCode: App;
|
|
4
|
-
}):
|
|
4
|
+
}): import('../../../node_modules/@tanstack/react-query').UseQueryResult<IGetConf, Error>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useId, useState, useRef, useEffect, useCallback } from "react";
|
|
2
|
-
import { useFloating,
|
|
2
|
+
import { useFloating, offset, size, flip, autoUpdate, useHover, safePolygon } from "@floating-ui/react";
|
|
3
3
|
import { mergeRefs } from "../../utilities/refs/ref.js";
|
|
4
4
|
const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !1) => {
|
|
5
5
|
const id = useId(), [visible, setVisible] = useState(!1), [activeIndex, setActiveIndex] = useState(-1), [isFocused, setIsFocused] = useState(null), {
|
|
@@ -30,7 +30,7 @@ const useDropzone = (props) => {
|
|
|
30
30
|
type: file.type
|
|
31
31
|
})
|
|
32
32
|
));
|
|
33
|
-
props != null && props.forceFilters ? (filesToAdd = applyInputFiltersOn(filesToAdd), filesToAdd && filesToAdd.length && setFiles((prevFiles) => [...prevFiles, ...filesToAdd])) : setFiles((prevFiles) => [...prevFiles, ...files2]);
|
|
33
|
+
filesToAdd.reverse(), props != null && props.forceFilters ? (filesToAdd = applyInputFiltersOn(filesToAdd), filesToAdd && filesToAdd.length && setFiles((prevFiles) => [...prevFiles, ...filesToAdd])) : setFiles((prevFiles) => [...prevFiles, ...files2]);
|
|
34
34
|
}, cleanFiles = () => {
|
|
35
35
|
setFiles([]);
|
|
36
36
|
}, handleOnChange = (event) => {
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { odeServices } from "@edifice.io/client";
|
|
3
|
-
import { useMockedData } from "../../providers/MockedDataProvider/MockedDataProvider.js";
|
|
4
3
|
function useHasWorkflow(workflow) {
|
|
5
|
-
const
|
|
4
|
+
const [state, setState] = useState();
|
|
6
5
|
return useEffect(() => {
|
|
7
6
|
(async () => {
|
|
8
7
|
let response;
|
|
9
|
-
|
|
10
|
-
if (typeof workflow == "string")
|
|
11
|
-
response = await mock.hasWorkflow(workflow);
|
|
12
|
-
else
|
|
13
|
-
throw "not.implemented.yet)";
|
|
14
|
-
else
|
|
15
|
-
typeof workflow == "string" ? response = await odeServices.rights().sessionHasWorkflowRight(workflow) : response = await odeServices.rights().sessionHasWorkflowRights(workflow);
|
|
16
|
-
setState(response);
|
|
8
|
+
typeof workflow == "string" ? response = await odeServices.rights().sessionHasWorkflowRight(workflow) : response = await odeServices.rights().sessionHasWorkflowRights(workflow), setState(response);
|
|
17
9
|
})();
|
|
18
|
-
}, [workflow
|
|
10
|
+
}, [workflow]), state;
|
|
19
11
|
}
|
|
20
12
|
export {
|
|
21
13
|
useHasWorkflow as default
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useHttpErrorToast } from './useHttpErrorToast';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from "react";
|
|
2
|
+
import { odeServices, LAYER_NAME } from "@edifice.io/client";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import useToast from "../useToast/useToast.js";
|
|
5
|
+
const useHttpErrorToast = (options) => {
|
|
6
|
+
const message = useRef(), toast = useToast(), {
|
|
7
|
+
t
|
|
8
|
+
} = useTranslation();
|
|
9
|
+
return useEffect(() => {
|
|
10
|
+
const subscription = odeServices.notify().events().subscribe(LAYER_NAME.TRANSPORT, (event) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
message.current = t(((_b = (_a = event == null ? void 0 : event.data) == null ? void 0 : _a.payload) == null ? void 0 : _b.error) || event.data.response.statusText), toast.error(/* @__PURE__ */ React.createElement("div", {
|
|
13
|
+
children: [message.current]
|
|
14
|
+
}), options);
|
|
15
|
+
});
|
|
16
|
+
return () => subscription.revoke();
|
|
17
|
+
}, [t, toast]), message.current;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
useHttpErrorToast as default
|
|
21
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { IGetSession } from '@edifice.io/client';
|
|
2
|
+
export default function useSession(): import('../../../node_modules/@tanstack/react-query').UseQueryResult<IGetSession, Error>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useTrapFocus(): import('react').MutableRefObject<HTMLElement | null>;
|
|
1
|
+
export default function useTrapFocus(isActive?: boolean): import('react').MutableRefObject<HTMLElement | null>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useRef, useEffect } from "react";
|
|
2
|
-
function useTrapFocus() {
|
|
2
|
+
function useTrapFocus(isActive) {
|
|
3
3
|
const ref = useRef(null), focusableElements = 'button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
4
4
|
return useEffect(() => {
|
|
5
|
+
if (!isActive) return;
|
|
5
6
|
const node = ref.current, firstFocusableElement = node.querySelectorAll(focusableElements)[0], focusableContent = node.querySelectorAll(focusableElements), lastFocusableElement = ref && (focusableContent == null ? void 0 : focusableContent[focusableContent.length - 1]), handleKeydown = (event) => {
|
|
6
7
|
event.key === "Tab" && (event.shiftKey ? document.activeElement === firstFocusableElement && (lastFocusableElement.focus(), event.preventDefault()) : document.activeElement === lastFocusableElement && (firstFocusableElement.focus(), event.preventDefault()));
|
|
7
8
|
};
|
|
@@ -9,7 +10,7 @@ function useTrapFocus() {
|
|
|
9
10
|
return node.addEventListener("keydown", handleKeydown), () => {
|
|
10
11
|
node.removeEventListener("keydown", handleKeydown);
|
|
11
12
|
};
|
|
12
|
-
}, []), ref;
|
|
13
|
+
}, [isActive]), ref;
|
|
13
14
|
}
|
|
14
15
|
export {
|
|
15
16
|
useTrapFocus as default
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect } from "react";
|
|
2
2
|
import { ImageResizer, addTimestampToImageUrl } from "@edifice.io/utilities";
|
|
3
3
|
import { useDropzoneContext } from "../../components/Dropzone/DropzoneContext.js";
|
|
4
|
-
import useUpload from "../useUpload/useUpload.js";
|
|
5
4
|
import useWorkspaceFile from "../useWorkspaceFile/useWorkspaceFile.js";
|
|
5
|
+
import useUpload from "../useUpload/useUpload.js";
|
|
6
6
|
const useUploadFiles = ({
|
|
7
7
|
handleOnChange,
|
|
8
8
|
visibility,
|
|
@@ -2,9 +2,8 @@ import { useReducer, useCallback } from "react";
|
|
|
2
2
|
import { odeServices, DocumentHelper } from "@edifice.io/client";
|
|
3
3
|
import { findNodeById } from "../../components/TreeView/utilities/treeview.js";
|
|
4
4
|
import useHasWorkflow from "../useHasWorkflow/useHasWorkflow.js";
|
|
5
|
-
import { useMockedData } from "../../providers/MockedDataProvider/MockedDataProvider.js";
|
|
6
5
|
function useWorkspaceSearch(rootId, rootName, filter, format) {
|
|
7
|
-
const
|
|
6
|
+
const canListDocs = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|listDocuments"), canListFolders = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|listFolders");
|
|
8
7
|
function treeReducer(state, action) {
|
|
9
8
|
switch (action.type) {
|
|
10
9
|
case "update": {
|
|
@@ -25,15 +24,8 @@ function useWorkspaceSearch(rootId, rootName, filter, format) {
|
|
|
25
24
|
name: rootName,
|
|
26
25
|
section: !0
|
|
27
26
|
}), loadContent = useCallback(async (folderId) => {
|
|
28
|
-
var _a;
|
|
29
27
|
if (canListDocs && canListFolders) {
|
|
30
|
-
const realWorkspaceId = folderId === rootId ? "" : folderId, payload =
|
|
31
|
-
const ret = {
|
|
32
|
-
...result,
|
|
33
|
-
_id: "" + Math.round(Math.random() * 9999)
|
|
34
|
-
};
|
|
35
|
-
return ret.name = result.eType == "folder" ? "folder id=" + ret._id : "file id=" + ret._id, ret;
|
|
36
|
-
}))) : await odeServices.workspace().listDocuments(filter, realWorkspaceId), subfolders = [], files = [];
|
|
28
|
+
const realWorkspaceId = folderId === rootId ? "" : folderId, payload = await odeServices.workspace().listDocuments(filter, realWorkspaceId), subfolders = [], files = [];
|
|
37
29
|
payload.filter((f) => {
|
|
38
30
|
if (!format || f.eType === "folder") return !0;
|
|
39
31
|
const role = DocumentHelper.getRole(f);
|
|
@@ -47,7 +39,7 @@ function useWorkspaceSearch(rootId, rootName, filter, format) {
|
|
|
47
39
|
type: "update"
|
|
48
40
|
});
|
|
49
41
|
}
|
|
50
|
-
}, [canListDocs, canListFolders, rootId,
|
|
42
|
+
}, [canListDocs, canListFolders, rootId, filter, format]);
|
|
51
43
|
return {
|
|
52
44
|
root,
|
|
53
45
|
loadContent
|