@edifice.io/react 2.0.0-develop-rc.25 → 2.0.0-develop-pedago.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/components/AppIcon/AppIcon.d.ts +1 -1
  2. package/dist/components/Badge/Badge.d.ts +1 -1
  3. package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -1
  4. package/dist/components/Breadcrumb/BreadcrumbNav.d.ts +1 -1
  5. package/dist/components/Card/Card.d.ts +1 -1
  6. package/dist/components/Card/CardContext.d.ts +1 -1
  7. package/dist/components/Layout/components/WidgetApps.d.ts +1 -1
  8. package/dist/components/Layout/hooks/useHeader.d.ts +1 -1
  9. package/dist/components/Tree/components/SortableTree.js +23 -28
  10. package/dist/components/Tree/hooks/useTree.d.ts +1 -1
  11. package/dist/components/Tree/hooks/useTree.js +1 -3
  12. package/dist/components/Tree/hooks/useTreeSortable.d.ts +2 -2
  13. package/dist/components/Tree/hooks/useTreeSortable.js +2 -2
  14. package/dist/components/Tree/types/index.d.ts +4 -0
  15. package/dist/components/Tree/utilities/tree-sortable.d.ts +2 -1
  16. package/dist/components/Tree/utilities/tree-sortable.js +16 -0
  17. package/dist/components/Tree/utilities/tree.d.ts +1 -1
  18. package/dist/components/Tree/utilities/tree.js +1 -1
  19. package/dist/components/TreeView/utilities/treeview.d.ts +1 -1
  20. package/dist/components/TreeView/utilities/treeview.js +1 -1
  21. package/dist/hooks/useAvatar/useAvatar.d.ts +1 -1
  22. package/dist/hooks/useAvatar/useAvatar.js +1 -1
  23. package/dist/hooks/useBookmark/useBookmark.d.ts +1 -1
  24. package/dist/hooks/useCantoo/useCantoo.js +1 -1
  25. package/dist/hooks/useConf/useConf.d.ts +1 -1
  26. package/dist/hooks/useConf/useConf.js +1 -1
  27. package/dist/hooks/useConversation/useConversation.js +1 -1
  28. package/dist/hooks/useDirectory/useDirectory.d.ts +1 -1
  29. package/dist/hooks/useDirectory/useDirectory.js +1 -1
  30. package/dist/hooks/useEdificeIcons/useEdificeIcons.d.ts +1 -1
  31. package/dist/hooks/useHasWorkflow/useHasWorkflow.js +1 -1
  32. package/dist/hooks/useHeader/useHeader.d.ts +1 -1
  33. package/dist/hooks/useHeader/useHeader.js +1 -1
  34. package/dist/hooks/useHttpErrorToast/useHttpErrorToast.js +1 -1
  35. package/dist/hooks/useIsAdml/useIsAdml.js +1 -1
  36. package/dist/hooks/useMediaLibrary/useMediaLibrary.d.ts +1 -1
  37. package/dist/hooks/usePreferences/usePreferences.js +1 -1
  38. package/dist/hooks/useResource/useResource.d.ts +1 -1
  39. package/dist/hooks/useResource/useResource.js +1 -1
  40. package/dist/hooks/useResourceSearch/useResourceSearch.d.ts +1 -1
  41. package/dist/hooks/useResourceSearch/useResourceSearch.js +1 -1
  42. package/dist/hooks/useSession/useSession.js +1 -1
  43. package/dist/hooks/useTrashedResource/useTrashedResource.js +1 -1
  44. package/dist/hooks/useUpload/useUpload.d.ts +1 -1
  45. package/dist/hooks/useUpload/useUpload.js +1 -1
  46. package/dist/hooks/useUploadFiles/useUploadFiles.d.ts +1 -1
  47. package/dist/hooks/useUser/useUser.d.ts +1 -1
  48. package/dist/hooks/useWorkspaceFile/useWorkspaceFile.d.ts +1 -1
  49. package/dist/hooks/useWorkspaceFile/useWorkspaceFile.js +1 -1
  50. package/dist/hooks/useWorkspaceSearch/useWorkspaceSearch.d.ts +1 -1
  51. package/dist/hooks/useWorkspaceSearch/useWorkspaceSearch.js +1 -1
  52. package/dist/hooks/useXitiTrackPageLoad/useXitiTrackPageLoad.js +1 -1
  53. package/dist/hooks/useZendeskGuide/useZendeskGuide.js +1 -1
  54. package/dist/index.js +2 -1
  55. package/dist/modules/audience/ReactionChoice.d.ts +1 -1
  56. package/dist/modules/audience/ReactionModal.Card.d.ts +1 -1
  57. package/dist/modules/audience/ReactionModal.d.ts +1 -1
  58. package/dist/modules/audience/ReactionModal.js +1 -1
  59. package/dist/modules/audience/ReactionSummary.d.ts +1 -1
  60. package/dist/modules/audience/ViewsByProfileCard.d.ts +1 -1
  61. package/dist/modules/audience/ViewsModal.d.ts +1 -1
  62. package/dist/modules/audience/hooks/useReactionIcons.d.ts +1 -1
  63. package/dist/modules/audience/hooks/useReactions.d.ts +3 -3
  64. package/dist/modules/audience/hooks/useReactions.js +1 -1
  65. package/dist/modules/audience/hooks/useViews.d.ts +2 -2
  66. package/dist/modules/comments/components/BadgeProfile.d.ts +1 -1
  67. package/dist/modules/comments/components/Comment.d.ts +1 -1
  68. package/dist/modules/comments/hooks/useComments.d.ts +1 -1
  69. package/dist/modules/comments/hooks/useProfileQueries.js +1 -1
  70. package/dist/modules/comments/types.d.ts +1 -1
  71. package/dist/modules/editor/components/Editor/Editor.d.ts +1 -1
  72. package/dist/modules/editor/components/NodeView/ImageNodeView.d.ts +1 -1
  73. package/dist/modules/editor/components/Renderer/MediaRenderer.js +1 -1
  74. package/dist/modules/editor/hooks/useImageModal.d.ts +1 -1
  75. package/dist/modules/editor/hooks/useMediaLibraryEditor.d.ts +1 -1
  76. package/dist/modules/editor/hooks/useSpeechRecognition.js +1 -1
  77. package/dist/modules/editor/hooks/useSpeechSynthetisis.js +1 -1
  78. package/dist/modules/editor/hooks/useTipTapEditor.d.ts +1 -1
  79. package/dist/modules/modals/OnboardingModal/useOnboardingModal.js +1 -1
  80. package/dist/modules/modals/PublishModal/PublishModal.d.ts +1 -1
  81. package/dist/modules/modals/PublishModal/components/ToastSuccess.d.ts +1 -1
  82. package/dist/modules/modals/PublishModal/hooks/usePublishModal.d.ts +1 -1
  83. package/dist/modules/modals/PublishModal/hooks/usePublishModal.js +1 -1
  84. package/dist/modules/modals/ResourceModal/ResourceModal.d.ts +1 -1
  85. package/dist/modules/modals/ResourceModal/ResourceModal.js +1 -1
  86. package/dist/modules/modals/ResourceModal/apps/BlogPublic.d.ts +1 -1
  87. package/dist/modules/modals/ResourceModal/hooks/useSlug.d.ts +1 -1
  88. package/dist/modules/modals/ResourceModal/hooks/useThumb.d.ts +1 -1
  89. package/dist/modules/modals/ResourceModal/hooks/useUpdateMutation.d.ts +1 -1
  90. package/dist/modules/modals/ResourceModal/hooks/useUpdateMutation.js +1 -1
  91. package/dist/modules/modals/ShareModal/ShareBookmarkLine.d.ts +1 -1
  92. package/dist/modules/modals/ShareModal/ShareModal.d.ts +1 -1
  93. package/dist/modules/modals/ShareModal/apps/ShareBlog.d.ts +1 -1
  94. package/dist/modules/modals/ShareModal/apps/ShareBlog.js +1 -1
  95. package/dist/modules/modals/ShareModal/hooks/useSearch.d.ts +1 -1
  96. package/dist/modules/modals/ShareModal/hooks/useSearch.js +1 -1
  97. package/dist/modules/modals/ShareModal/hooks/useShare.d.ts +1 -1
  98. package/dist/modules/modals/ShareModal/hooks/useShare.js +1 -1
  99. package/dist/modules/modals/ShareModal/hooks/useShareBookmark.d.ts +1 -1
  100. package/dist/modules/modals/ShareModal/hooks/useShareBookmark.js +1 -1
  101. package/dist/modules/modals/ShareModal/hooks/useShareMutation.d.ts +1 -1
  102. package/dist/modules/modals/ShareModal/hooks/useShareMutation.js +1 -1
  103. package/dist/modules/modals/ShareModal/utils/hasRight.d.ts +1 -1
  104. package/dist/modules/modals/ShareModal/utils/showShareRightLine.d.ts +1 -1
  105. package/dist/modules/multimedia/AudioRecorder/AudioRecorder.d.ts +1 -1
  106. package/dist/modules/multimedia/AudioRecorder/useAudioRecorder.d.ts +1 -1
  107. package/dist/modules/multimedia/FileCard/FileCard.d.ts +1 -1
  108. package/dist/modules/multimedia/FileCard/FileCard.js +1 -1
  109. package/dist/modules/multimedia/FileCard/FileIcon.d.ts +1 -1
  110. package/dist/modules/multimedia/ImagePicker/ImagePicker.d.ts +1 -1
  111. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +1 -1
  112. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +1 -1
  113. package/dist/modules/multimedia/LinkerCard/LinkerCard.d.ts +1 -1
  114. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +1 -1
  115. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +1 -1
  116. package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +1 -1
  117. package/dist/modules/multimedia/MediaLibrary/innertabs/InternalLink.d.ts +1 -1
  118. package/dist/modules/multimedia/UploadFiles/UploadFiles.d.ts +1 -1
  119. package/dist/modules/multimedia/VideoEmbed/VideoEmbed.js +1 -1
  120. package/dist/modules/multimedia/VideoRecorder/VideoRecorder.d.ts +1 -1
  121. package/dist/modules/multimedia/VideoRecorder/VideoRecorder.js +1 -1
  122. package/dist/modules/multimedia/Workspace/Workspace.d.ts +1 -1
  123. package/dist/modules/widgets/BookmarkedApps/BookmarkedApps.d.ts +1 -1
  124. package/dist/providers/EdificeClientProvider/EdificeClientProvider.context.d.ts +1 -1
  125. package/dist/providers/EdificeClientProvider/EdificeClientProvider.d.ts +1 -1
  126. package/dist/providers/EdificeThemeProvider/EdificeThemeProvider.context.d.ts +1 -1
  127. package/dist/providers/MockedDataProvider/MockedDataProvider.d.ts +1 -1
  128. package/dist/utilities/check-user-rights/check-user-rights.d.ts +1 -1
  129. package/dist/utilities/check-user-rights/check-user-rights.js +1 -1
  130. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- import { IWebApp } from '@edifice.io/ts-client';
1
+ import { IWebApp } from '@edifice.io/client';
2
2
  export type AppIconSize = '24' | '32' | '40' | '48' | '80' | '160';
3
3
  export interface BaseProps {
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { UserProfile } from '@edifice.io/ts-client';
2
+ import { UserProfile } from '@edifice.io/client';
3
3
  export type BadgeRef = HTMLSpanElement;
4
4
  /** Badge variant : notification */
5
5
  export type NotificationBadgeVariant = {
@@ -1,4 +1,4 @@
1
- import { IWebApp } from '@edifice.io/ts-client';
1
+ import { IWebApp } from '@edifice.io/client';
2
2
  export interface BreadcrumbProps {
3
3
  /**
4
4
  * Pass all data about current application
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { IWebApp } from '@edifice.io/ts-client';
2
+ import { IWebApp } from '@edifice.io/client';
3
3
  export interface BreadcrumbNavProps extends React.ComponentPropsWithRef<'nav'> {
4
4
  /**
5
5
  * Pass all data about current application
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { IWebApp } from '@edifice.io/ts-client';
2
+ import { IWebApp } from '@edifice.io/client';
3
3
  export interface CardProps {
4
4
  /**
5
5
  * IWebApp
@@ -1,4 +1,4 @@
1
- import { IWebApp } from '@edifice.io/ts-client';
1
+ import { IWebApp } from '@edifice.io/client';
2
2
  import { CardProps } from './Card';
3
3
  export interface CardContextProps extends Omit<CardProps, 'children' | 'className'> {
4
4
  app?: IWebApp | undefined;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { IWebApp } from '@edifice.io/ts-client';
2
+ import { IWebApp } from '@edifice.io/client';
3
3
  export declare const WidgetAppsFooter: () => import("react/jsx-runtime").JSX.Element;
4
4
  export declare const WidgetAppsBody: ({ bookmarkedApps, }: {
5
5
  bookmarkedApps: IWebApp[];
@@ -1,4 +1,4 @@
1
- import { IUserInfo } from '@edifice.io/ts-client';
1
+ import { IUserInfo } from '@edifice.io/client';
2
2
  export default function useHeader({ user, avatar, }: {
3
3
  user: IUserInfo | undefined;
4
4
  avatar: string;
@@ -10,6 +10,7 @@ import SvgIconFolder from "../../../modules/icons/components/IconFolder.js";
10
10
  import SvgIconRafterRight from "../../../modules/icons/components/IconRafterRight.js";
11
11
  import { useTree } from "../hooks/useTree.js";
12
12
  import { useTreeSortable } from "../hooks/useTreeSortable.js";
13
+ import { flattenNodes } from "../utilities/tree-sortable.js";
13
14
  const SortableTree = ({
14
15
  nodes,
15
16
  selectedNodeId: externalSelectedNodeId,
@@ -25,7 +26,7 @@ const SortableTree = ({
25
26
  expandedNodes,
26
27
  handleItemClick,
27
28
  handleFoldUnfold,
28
- collapseAllNodes
29
+ handleCollapseNode
29
30
  } = useTree({
30
31
  data: nodes,
31
32
  externalSelectedNodeId,
@@ -51,12 +52,12 @@ const SortableTree = ({
51
52
  } = useTreeSortable({
52
53
  nodes,
53
54
  onSortable,
54
- collapseAllNodes
55
- });
56
- return /* @__PURE__ */ jsx("div", { className: "treeview", children: /* @__PURE__ */ jsx("ul", { role: "tree", className: "m-0 p-0", children: /* @__PURE__ */ jsxs(DndContext, { accessibility: {
55
+ handleCollapseNode
56
+ }), newNodes = flattenNodes(items, expandedNodes);
57
+ return /* @__PURE__ */ jsx("div", { className: "treeview", children: /* @__PURE__ */ jsx("div", { role: "tree", className: "m-0 p-0", children: /* @__PURE__ */ jsxs(DndContext, { accessibility: {
57
58
  announcements
58
59
  }, sensors, measuring, onDragStart: handleDragStart, onDragEnd: handleDragEnd, onDragOver: handleDragOver, onDragMove: handleDragMove, children: [
59
- /* @__PURE__ */ jsx(SortableContext, { items: sortedIds, strategy: verticalListSortingStrategy, children: Array.isArray(items) && items.map((node) => /* @__PURE__ */ jsx(TreeNode, { node, showIcon, expandedNodes, selectedNodeId, renderNode, disabled: isDisabled(node.id), onTreeItemClick: handleItemClick, onToggleNode: handleFoldUnfold, depth: node.id === activeId && projected ? projected.depth : 0, indentationWidth, projected }, node.id)) }),
60
+ /* @__PURE__ */ jsx(SortableContext, { items: sortedIds, strategy: verticalListSortingStrategy, children: Array.isArray(items) && newNodes.map((node) => node.parentExpanded ? /* @__PURE__ */ jsx(TreeNode, { node, showIcon, expandedNodes, selectedNodeId, renderNode, disabled: isDisabled(node.id), onTreeItemClick: handleItemClick, onToggleNode: handleFoldUnfold, depth: node.id === activeId && projected ? projected.depth : 0, isChild: node.isChild, indentationWidth, projected }, node.id) : null) }),
60
61
  /* @__PURE__ */ createPortal(/* @__PURE__ */ jsx(DragOverlay, { dropAnimation: dropAnimationConfig, modifiers: indicator ? [adjustTranslate] : void 0, children: activeId && activeItem ? /* @__PURE__ */ jsx(DragOverlayItem, { activeItem }) : null }), document.body)
61
62
  ] }) }) });
62
63
  }, TreeNode = /* @__PURE__ */ forwardRef(({
@@ -69,12 +70,10 @@ const SortableTree = ({
69
70
  indentationWidth,
70
71
  depth,
71
72
  isChild,
72
- projected,
73
73
  renderNode,
74
74
  onTreeItemClick,
75
75
  onToggleNode
76
- }, ref) => {
77
- var _a;
76
+ }) => {
78
77
  const {
79
78
  t
80
79
  } = useTranslation(), selected = selectedNodeId === node.id, expanded = expandedNodes.has(node.id), animateLayoutChanges = ({
@@ -96,37 +95,33 @@ const SortableTree = ({
96
95
  }, treeItemClasses = {
97
96
  action: clsx("action-container d-flex align-items-center gap-8 px-2", {
98
97
  "drag-focus": focused,
99
- "border border-secondary rounded rounded-2 shadow bg-white": isDragging
100
- }),
101
- arrow: clsx({
102
- invisible: !Array.isArray(node.children) || node.children.length === 0
98
+ "border border-secondary rounded rounded-2 shadow bg-white": isDragging,
99
+ display: expanded ? "block" : "none"
103
100
  }),
104
101
  button: clsx("flex-fill d-flex align-items-center text-truncate gap-8", {
105
102
  "py-8": depth === 0,
106
- "py-4": depth === 1
103
+ "py-4": depth === 1,
104
+ "ps-8": isChild
107
105
  })
108
106
  }, handleItemKeyDown = (event) => {
109
107
  (event.code === "Enter" || event.code === "Space") && (event.preventDefault(), event.stopPropagation(), onTreeItemClick == null || onTreeItemClick(node.id));
110
108
  }, handleItemToggleKeyDown = (event) => {
111
109
  (event.code === "Enter" || event.code === "Space") && (event.preventDefault(), event.stopPropagation(), onToggleNode == null || onToggleNode(node.id));
112
- }, spaceGestion = () => isDragging ? isChild ? depth === 1 ? `${indentationWidth * depth}px` : "0px" : `${indentationWidth * depth}px` : null;
110
+ }, spaceGestion = () => isDragging ? isChild ? depth === 1 ? `${indentationWidth * depth}px` : "0px" : `${indentationWidth * depth}px` : isChild ? "20px" : null;
113
111
  return /* @__PURE__ */ jsx("li", { ref: setNodeRef, id: `treeitem-${node.id}`, role: "treeitem", "aria-selected": selected, "aria-expanded": expanded, style: {
114
112
  ...style,
115
113
  marginLeft: spaceGestion()
116
- }, ...listeners, children: /* @__PURE__ */ jsxs("div", { children: [
117
- /* @__PURE__ */ jsxs("div", { className: treeItemClasses.action, children: [
118
- /* @__PURE__ */ jsx("div", { className: treeItemClasses.arrow, tabIndex: 0, role: "button", onClick: () => onToggleNode == null ? void 0 : onToggleNode(node.id), onKeyDown: handleItemToggleKeyDown, "aria-label": t("foldUnfold"), children: /* @__PURE__ */ jsx(SvgIconRafterRight, { width: 16, style: {
119
- transform: expanded ? "rotate(90deg)" : ""
120
- } }) }),
121
- node.children && showIcon ? /* @__PURE__ */ jsx(SvgIconFolder, { title: "folder", width: 20, height: 20 }) : null,
122
- /* @__PURE__ */ jsx("div", { tabIndex: 0, role: "button", className: treeItemClasses.button, onClick: () => onTreeItemClick(node.id), onKeyDown: handleItemKeyDown, children: renderNode ? renderNode({
123
- node,
124
- hasChildren: Array.isArray(node.children) && !!node.children.length,
125
- isChild
126
- }) : /* @__PURE__ */ jsx("div", { className: "text-truncate", children: node.name }) })
127
- ] }),
128
- expanded && node.children && !!node.children.length && /* @__PURE__ */ jsx("ul", { role: "group", children: (_a = node.children) == null ? void 0 : _a.map((node2) => /* @__PURE__ */ jsx(TreeNode, { ref, node: node2, showIcon, selectedNodeId, expandedNodes, onTreeItemClick, onToggleNode, renderNode, indentationWidth, depth: node2.id === (projected == null ? void 0 : projected.activeId) && projected ? projected.depth : 0, isChild: !0, projected }, node2.id)) })
129
- ] }) }, node.id);
114
+ }, ...listeners, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: treeItemClasses.action, children: [
115
+ node.haveChilds && /* @__PURE__ */ jsx("div", { tabIndex: 0, role: "button", onClick: () => onToggleNode == null ? void 0 : onToggleNode(node.id), onKeyDown: handleItemToggleKeyDown, "aria-label": t("foldUnfold"), children: /* @__PURE__ */ jsx(SvgIconRafterRight, { width: 16, style: {
116
+ transform: expanded ? "rotate(90deg)" : ""
117
+ } }) }),
118
+ node.children && showIcon ? /* @__PURE__ */ jsx(SvgIconFolder, { title: "folder", width: 20, height: 20 }) : null,
119
+ /* @__PURE__ */ jsx("div", { tabIndex: 0, role: "button", className: treeItemClasses.button, onClick: () => onTreeItemClick(node.id), onKeyDown: handleItemKeyDown, children: renderNode ? renderNode({
120
+ node,
121
+ hasChildren: Array.isArray(node.children) && !!node.children.length,
122
+ isChild
123
+ }) : /* @__PURE__ */ jsx("div", { className: "text-truncate", children: node.name }) })
124
+ ] }) }) }, node.id);
130
125
  }), DragOverlayItem = /* @__PURE__ */ forwardRef(({
131
126
  activeItem,
132
127
  ...props
@@ -27,5 +27,5 @@ export declare const useTree: ({ data, externalSelectedNodeId, draggedNode, shou
27
27
  draggedNodeId: string | undefined;
28
28
  handleItemClick: (nodeId: string) => void;
29
29
  handleFoldUnfold: (nodeId: string) => void;
30
- collapseAllNodes: () => void;
30
+ handleCollapseNode: (nodeId: string) => void;
31
31
  };
@@ -77,9 +77,7 @@ const useTree = ({
77
77
  draggedNodeId,
78
78
  handleItemClick,
79
79
  handleFoldUnfold,
80
- collapseAllNodes: () => {
81
- setExpandedNodes(/* @__PURE__ */ new Set());
82
- }
80
+ handleCollapseNode
83
81
  };
84
82
  };
85
83
  export {
@@ -1,9 +1,9 @@
1
1
  import { Announcements, DragEndEvent, DragMoveEvent, DragOverEvent, DragStartEvent, MeasuringStrategy, Modifier, UniqueIdentifier } from '@dnd-kit/core';
2
2
  import { FlattenedItem, TreeItem, UpdateTreeData } from '../types';
3
- export declare const useTreeSortable: ({ nodes, onSortable, collapseAllNodes, }: {
3
+ export declare const useTreeSortable: ({ nodes, onSortable, handleCollapseNode, }: {
4
4
  nodes: TreeItem[];
5
5
  onSortable: (updateArray: UpdateTreeData[]) => void;
6
- collapseAllNodes: () => void;
6
+ handleCollapseNode: (nodeId: string) => void;
7
7
  }) => {
8
8
  handleDragStart: (event: DragStartEvent) => void;
9
9
  handleDragMove: ({ delta }: DragMoveEvent) => void;
@@ -6,7 +6,7 @@ import { flattenTree, getProjection, getActiveAndOverNodes, determineNewParentId
6
6
  const useTreeSortable = ({
7
7
  nodes,
8
8
  onSortable,
9
- collapseAllNodes
9
+ handleCollapseNode
10
10
  }) => {
11
11
  const [items, setItems] = useState(() => nodes), [activeId, setActiveId] = useState(null), [overId, setOverId] = useState(null), [offsetLeft, setOffsetLeft] = useState(0), [currentPosition, setCurrentPosition] = useState(null);
12
12
  useEffect(() => {
@@ -28,7 +28,7 @@ const useTreeSortable = ({
28
28
  } = event, {
29
29
  activeNode
30
30
  } = getActiveAndOverNodes(flattenedTree, active.id);
31
- activeNode.parentId || collapseAllNodes(), setActiveId(active.id), setOverId(active.id);
31
+ activeNode.parentId || handleCollapseNode(activeNode.id), setActiveId(active.id), setOverId(active.id);
32
32
  const activeItem2 = flattenedTree.find(({
33
33
  id
34
34
  }) => id === activeId);
@@ -159,6 +159,10 @@ export interface FlattenedItem extends TreeItem {
159
159
  parentId: string | null;
160
160
  depth: number;
161
161
  }
162
+ export interface FlattendedNodes extends TreeItem {
163
+ expandNode: boolean;
164
+ parentExpanded: boolean;
165
+ }
162
166
  export interface TreeViewHandlers {
163
167
  unselect: () => void;
164
168
  select: (nodeId: string) => void;
@@ -1,5 +1,5 @@
1
1
  import { Active, Over, UniqueIdentifier } from '@dnd-kit/core';
2
- import { FlattenedItem, Projected, TreeItem } from '../types';
2
+ import { FlattendedNodes, FlattenedItem, Projected, TreeItem } from '../types';
3
3
  export declare function getDragDepth(offset: number, indentationWidth: number): number;
4
4
  export declare function determineNewParentId(active: Active, over: Over | null, activeNode: FlattenedItem, overNode: FlattenedItem | null, projected: Projected): string | null | undefined;
5
5
  export declare function getActiveAndOverNodes(tree: FlattenedItem[], activeId: UniqueIdentifier, overId?: UniqueIdentifier | undefined): {
@@ -10,6 +10,7 @@ export declare function getActiveAndOverNodes(tree: FlattenedItem[], activeId: U
10
10
  };
11
11
  export declare function getIndicesToUpdate(activeNode: FlattenedItem, activeNodeIndex: number, flattenedTree: FlattenedItem[], projected: Projected): number[];
12
12
  export declare function flattenTree(tree: TreeItem[], parentId: string | null, depth?: number): FlattenedItem[];
13
+ export declare function flattenNodes(nodes: TreeItem[], expandedNodes: Set<string>): FlattendedNodes[];
13
14
  export declare function updateParentIds(flattenedTree: any[], indices: number[], newParentId: string | null | undefined): void;
14
15
  export declare function findItemIndexInTree(tree: any[], itemId: string): number | null;
15
16
  export declare function generateUpdateData(updatedFlattenedTree: FlattenedItem[], tree: TreeItem[]): {
@@ -43,6 +43,21 @@ function flattenTree(tree, parentId, depth = 0) {
43
43
  isVisible: node.isVisible
44
44
  }), node.children && node.children.length > 0 && (acc = acc.concat(flattenTree(node.children, node.id, depth + 1))), acc), []);
45
45
  }
46
+ function flattenNodes(nodes, expandedNodes) {
47
+ const flatten = (nodes2, isChild = !1, parentExpanded = !0) => nodes2.reduce((acc, node) => {
48
+ var _a;
49
+ const isExpanded = expandedNodes.has(node.id) && node.children && node.children.length > 0;
50
+ return acc.push({
51
+ id: node.id,
52
+ name: node.name,
53
+ isChild,
54
+ haveChilds: !!((_a = node.children) != null && _a.length),
55
+ expandNode: isExpanded ?? !1,
56
+ parentExpanded
57
+ }), node.children && isExpanded && (acc = acc.concat(flatten(node.children, !0, isExpanded))), acc;
58
+ }, []);
59
+ return flatten(nodes);
60
+ }
46
61
  function updateParentIds(flattenedTree, indices, newParentId) {
47
62
  indices.forEach((index) => {
48
63
  flattenedTree[index] = {
@@ -134,6 +149,7 @@ export {
134
149
  buildTree,
135
150
  determineNewParentId,
136
151
  findItemIndexInTree,
152
+ flattenNodes,
137
153
  flattenTree,
138
154
  generateUpdateData,
139
155
  getActiveAndOverNodes,
@@ -1,4 +1,4 @@
1
- import { IFolder } from '@edifice.io/ts-client';
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
4
  export declare function addNode(node: TreeItem, { parentId, newFolder }: {
@@ -1,4 +1,4 @@
1
- import "@edifice.io/ts-client";
1
+ import "@edifice.io/client";
2
2
  function findNodeById(data, id) {
3
3
  if (Array.isArray(data))
4
4
  for (const node of data) {
@@ -1,4 +1,4 @@
1
- import { IFolder } from '@edifice.io/ts-client';
1
+ import { IFolder } from '@edifice.io/client';
2
2
  import { TreeData } from '../../../types';
3
3
  export declare function findTreeNode(root: TreeData, predicate: (node: TreeData) => boolean): TreeData | undefined;
4
4
  export declare function findNodeById(data: TreeData | TreeData[], id: string): TreeData | undefined;
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
4
- import { FOLDER } from "@edifice.io/ts-client";
4
+ import { FOLDER } from "@edifice.io/client";
5
5
  function findTreeNode(root, predicate) {
6
6
  if (predicate(root)) return root;
7
7
  if (Array.isArray(root.children))
@@ -1,4 +1,4 @@
1
- import { ID, UserProfile } from '@edifice.io/ts-client';
1
+ import { ID, UserProfile } from '@edifice.io/client';
2
2
  export default function useAvatar(userId: ID, userProfile?: UserProfile[number]): {
3
3
  badge: JSX.Element | null;
4
4
  avatarURL: string;
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { odeServices } from "@edifice.io/ts-client";
2
+ import { odeServices } from "@edifice.io/client";
3
3
  import { useMemo } from "react";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import Badge from "../../components/Badge/Badge.js";
@@ -1,2 +1,2 @@
1
- import { IWebApp } from '@edifice.io/ts-client';
1
+ import { IWebApp } from '@edifice.io/client';
2
2
  export default function useBookmark(): IWebApp[] | undefined;
@@ -1,5 +1,5 @@
1
1
  import { useEffect } from "react";
2
- import { odeServices } from "@edifice.io/ts-client";
2
+ import { odeServices } from "@edifice.io/client";
3
3
  import useHasWorkflow from "../useHasWorkflow/useHasWorkflow.js";
4
4
  function useCantoo() {
5
5
  const hasWorkflow = useHasWorkflow("org.entcore.portal.controllers.PortalController|optionalFeatureCantoo");
@@ -1,4 +1,4 @@
1
- import { App } from '@edifice.io/ts-client';
1
+ import { App } from '@edifice.io/client';
2
2
  export default function useConf({ appCode }: {
3
3
  appCode: App;
4
4
  }): QueryObserverResult<TData, TError>;
@@ -1,4 +1,4 @@
1
- import { odeServices } from "@edifice.io/ts-client";
1
+ import { odeServices } from "@edifice.io/client";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  function useConf({
4
4
  appCode
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from "react";
2
- import { odeServices } from "@edifice.io/ts-client";
2
+ import { odeServices } from "@edifice.io/client";
3
3
  import useHasWorkflow from "../useHasWorkflow/useHasWorkflow.js";
4
4
  const useConversation = () => {
5
5
  const zimbraWorkflow = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|view"), zimbraPreauth = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|preauth"), [messages, setMessages] = useState(0), [msgLink, setMsgLink] = useState(""), queryParams = {
@@ -1,4 +1,4 @@
1
- import { ID } from '@edifice.io/ts-client';
1
+ import { ID } from '@edifice.io/client';
2
2
  declare const useDirectory: () => {
3
3
  getAvatarURL: (userId: ID, type: "user" | "group") => string;
4
4
  getUserbookURL: (userId: ID, type: "user" | "group") => string;
@@ -1,4 +1,4 @@
1
- import { odeServices } from "@edifice.io/ts-client";
1
+ import { odeServices } from "@edifice.io/client";
2
2
  const useDirectory = () => {
3
3
  function getAvatarURL(userId, type) {
4
4
  return odeServices.directory().getAvatarUrl(userId, type);
@@ -1,4 +1,4 @@
1
- import { IWebApp, IWidget } from '@edifice.io/ts-client';
1
+ import { IWebApp, IWidget } from '@edifice.io/client';
2
2
  export default function useEdificeIcons(): {
3
3
  getIconClass: (app: IWebApp | string) => string;
4
4
  getBackgroundIconClass: (app: IWebApp | string) => string;
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from "react";
2
- import { odeServices } from "@edifice.io/ts-client";
2
+ import { odeServices } from "@edifice.io/client";
3
3
  import { useMockedData } from "../../providers/MockedDataProvider/MockedDataProvider.js";
4
4
  function useHasWorkflow(workflow) {
5
5
  const mock = useMockedData(), [state, setState] = useState();
@@ -1,4 +1,4 @@
1
- import { IUserInfo } from '@edifice.io/ts-client';
1
+ import { IUserInfo } from '@edifice.io/client';
2
2
  export default function useHeader({ user, avatar, }: {
3
3
  user: IUserInfo | undefined;
4
4
  avatar: string;
@@ -1,5 +1,5 @@
1
1
  import { useState, useId, useCallback, useMemo } from "react";
2
- import { odeServices } from "@edifice.io/ts-client";
2
+ import { odeServices } from "@edifice.io/client";
3
3
  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";
@@ -1,5 +1,5 @@
1
1
  import React, { useRef, useEffect } from "react";
2
- import { odeServices, LAYER_NAME } from "@edifice.io/ts-client";
2
+ import { odeServices, LAYER_NAME } from "@edifice.io/client";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import useToast from "../useToast/useToast.js";
5
5
  const useHttpErrorToast = (options) => {
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect, useCallback } from "react";
2
- import { odeServices } from "@edifice.io/ts-client";
2
+ import { odeServices } from "@edifice.io/client";
3
3
  function useIsAdml() {
4
4
  const [isAdml, setIsAdml] = useState(!1);
5
5
  useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { WorkspaceElement } from '@edifice.io/ts-client';
1
+ import { WorkspaceElement } from '@edifice.io/client';
2
2
  import { TabsItemProps } from '../../components';
3
3
  import { MediaLibraryRef, MediaLibraryResult } from '../../modules/multimedia';
4
4
  declare const useMediaLibrary: () => {
@@ -1,4 +1,4 @@
1
- import { odeServices } from "@edifice.io/ts-client";
1
+ import { odeServices } from "@edifice.io/client";
2
2
  function usePreferences(name) {
3
3
  return {
4
4
  getPreference: async () => await odeServices.conf().getPreference(name),
@@ -1,3 +1,3 @@
1
- import { IResource } from '@edifice.io/ts-client';
1
+ import { IResource } from '@edifice.io/client';
2
2
  declare const useResource: (application: string, id: string) => IResource;
3
3
  export default useResource;
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from "react";
2
- import { odeServices } from "@edifice.io/ts-client";
2
+ import { odeServices } from "@edifice.io/client";
3
3
  const useResource = (application, id) => {
4
4
  const [resource, setResource] = useState(null);
5
5
  return useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { App, GetContextParameters, ILinkedResource } from '@edifice.io/ts-client';
1
+ import { App, GetContextParameters, ILinkedResource } from '@edifice.io/client';
2
2
  /**
3
3
  * A hook to search for resources produced by applications.
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect, useCallback } from "react";
2
- import { SnipletsService, odeServices } from "@edifice.io/ts-client";
2
+ import { SnipletsService, odeServices } from "@edifice.io/client";
3
3
  const useResourceSearch = (appCode) => {
4
4
  const [resourceApplications, setResourceApplications] = useState([]);
5
5
  useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { odeServices } from "@edifice.io/ts-client";
1
+ import { odeServices } from "@edifice.io/client";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  function useSession() {
4
4
  return useQuery({
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from "react";
2
- import { odeServices } from "@edifice.io/ts-client";
2
+ import { odeServices } from "@edifice.io/client";
3
3
  import { useEdificeClient } from "../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
4
4
  import useUser from "../useUser/useUser.js";
5
5
  const useTrashedResource = (id) => {
@@ -1,4 +1,4 @@
1
- import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/ts-client';
1
+ import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
2
2
  import { Status } from '../../types';
3
3
  declare const useUpload: (visibility?: WorkspaceVisibility, application?: string) => {
4
4
  getUploadStatus: (upload: File | Blob) => Status | undefined;
@@ -1,5 +1,5 @@
1
1
  import { useState, useCallback } from "react";
2
- import { ERROR_CODE, odeServices } from "@edifice.io/ts-client";
2
+ import { ERROR_CODE, odeServices } from "@edifice.io/client";
3
3
  import { getOrGenerateBlobId } from "@edifice.io/utilities";
4
4
  import useBrowserInfo from "../useBrowserInfo/useBrowserInfo.js";
5
5
  import useWorkspaceFile from "../useWorkspaceFile/useWorkspaceFile.js";
@@ -1,4 +1,4 @@
1
- import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/ts-client';
1
+ import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
2
2
  declare const useUploadFiles: ({ handleOnChange, visibility, application, }: {
3
3
  handleOnChange: (uploadedFiles: WorkspaceElement[]) => void;
4
4
  visibility?: WorkspaceVisibility;
@@ -1,4 +1,4 @@
1
- import { IUserDescription, IUserInfo } from '@edifice.io/ts-client';
1
+ import { IUserDescription, IUserInfo } from '@edifice.io/client';
2
2
  export interface useUserProps {
3
3
  user: IUserInfo | undefined;
4
4
  avatar: string;
@@ -1,4 +1,4 @@
1
- import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/ts-client';
1
+ import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
2
2
  declare const useWorkspaceFile: () => {
3
3
  createOrUpdate: ({ alt, uri, blob, legend, parentId, application, visibility, }: {
4
4
  blob: Blob;
@@ -1,4 +1,4 @@
1
- import { odeServices } from "@edifice.io/ts-client";
1
+ import { odeServices } from "@edifice.io/client";
2
2
  const useWorkspaceFile = () => ({
3
3
  createOrUpdate: async ({
4
4
  alt,
@@ -1,4 +1,4 @@
1
- import { ID, Role, WorkspaceElement, WorkspaceSearchFilter } from '@edifice.io/ts-client';
1
+ import { ID, Role, WorkspaceElement, WorkspaceSearchFilter } from '@edifice.io/client';
2
2
  import { TreeData } from '../../types';
3
3
  export type FolderNode = TreeData & {
4
4
  files?: WorkspaceElement[];
@@ -1,5 +1,5 @@
1
1
  import { useReducer, useCallback } from "react";
2
- import { odeServices, DocumentHelper } from "@edifice.io/ts-client";
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
5
  import { useMockedData } from "../../providers/MockedDataProvider/MockedDataProvider.js";
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from "react";
2
- import { odeServices } from "@edifice.io/ts-client";
2
+ import { odeServices } from "@edifice.io/client";
3
3
  import { useEdificeClient } from "../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
4
4
  function useXitiTrackPageLoad() {
5
5
  const [xitiStatus, setXitiStatus] = useState("pending"), {
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from "react";
2
- import { odeServices } from "@edifice.io/ts-client";
2
+ import { odeServices } from "@edifice.io/client";
3
3
  import { useEdificeClient } from "../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
4
4
  import { useEdificeTheme } from "../../providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
5
5
  import useUser from "../useUser/useUser.js";
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ import { default as default70 } from "./components/TextArea/TextArea.js";
79
79
  import { Toolbar } from "./components/Toolbar/Toolbar.js";
80
80
  import { default as default71 } from "./components/Tooltip/Tooltip.js";
81
81
  import { useTreeSortable } from "./components/Tree/hooks/useTreeSortable.js";
82
- import { buildTree, determineNewParentId, findItemIndexInTree, flattenTree, generateUpdateData, getActiveAndOverNodes, getDragDepth, getIndicesToUpdate, getProjection, updateParentIds } from "./components/Tree/utilities/tree-sortable.js";
82
+ import { buildTree, determineNewParentId, findItemIndexInTree, flattenNodes, flattenTree, generateUpdateData, getActiveAndOverNodes, getDragDepth, getIndicesToUpdate, getProjection, updateParentIds } from "./components/Tree/utilities/tree-sortable.js";
83
83
  import { useTreeView } from "./components/TreeView/hooks/useTreeView.js";
84
84
  import { TreeNode } from "./components/TreeView/TreeNode.js";
85
85
  import { TreeNodeFolderWrapper, addNode, arrayUnique, deleteNode, findNodeById, findParentNode, findPathById, findTreeNode, getAncestors, hasChildren, modifyNode, moveNode, updateNode, wrapTreeNode } from "./components/TreeView/utilities/treeview.js";
@@ -173,6 +173,7 @@ export {
173
173
  findParentNode,
174
174
  findPathById,
175
175
  findTreeNode,
176
+ flattenNodes,
176
177
  flattenTree,
177
178
  generateUpdateData,
178
179
  getActiveAndOverNodes,
@@ -1,4 +1,4 @@
1
- import { ReactionSummaryData, ReactionType } from '@edifice.io/ts-client';
1
+ import { ReactionSummaryData, ReactionType } from '@edifice.io/client';
2
2
  export interface ReactionChoiceProps {
3
3
  availableReactions: ReactionType[];
4
4
  summary?: ReactionSummaryData;
@@ -1,4 +1,4 @@
1
- import { ReactionDetailsData } from '@edifice.io/ts-client';
1
+ import { ReactionDetailsData } from '@edifice.io/client';
2
2
  export declare function ReactionModalCard({ reaction, }: {
3
3
  reaction: ReactionDetailsData['userReactions'][number];
4
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { ReactionDetailsData } from '@edifice.io/ts-client';
1
+ import { ReactionDetailsData } from '@edifice.io/client';
2
2
  import { ReactionModalCard } from './ReactionModal.Card';
3
3
  export interface ReactionModalProps {
4
4
  /** Id of resource. */
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { ReactionTypes } from "@edifice.io/ts-client";
2
+ import { ReactionTypes } from "@edifice.io/client";
3
3
  import { StringUtils } from "@edifice.io/utilities";
4
4
  import { useState, useId, useCallback, useMemo, useEffect } from "react";
5
5
  import { createPortal } from "react-dom";