@edifice.io/react 2.0.0-develop-rc.3 → 2.0.0-develop-rc.7
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 +17 -88
- package/dist/components/ActionBar/ActionBar.d.ts +1 -1
- package/dist/components/ActionBar/ActionBar.js +3 -2
- package/dist/components/ActionBar/index.d.ts +0 -1
- package/dist/components/Alert/Alert.d.ts +1 -1
- package/dist/components/Alert/Alert.js +7 -6
- package/dist/components/Alert/index.d.ts +0 -1
- package/dist/components/AppHeader/AppHeader.d.ts +1 -1
- package/dist/components/AppHeader/AppHeader.js +3 -2
- package/dist/components/AppHeader/index.d.ts +0 -1
- package/dist/components/AppIcon/AppIcon.js +1 -1
- package/dist/components/Attachment/Attachment.d.ts +1 -1
- package/dist/components/Attachment/Attachment.js +3 -2
- package/dist/components/Attachment/index.d.ts +0 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Avatar/Avatar.js +4 -3
- package/dist/components/Avatar/index.d.ts +0 -1
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Badge/Badge.js +3 -2
- package/dist/components/Badge/index.d.ts +0 -1
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +4 -3
- package/dist/components/Button/IconButton.d.ts +1 -1
- package/dist/components/Button/IconButton.js +4 -3
- package/dist/components/Button/SearchButton.d.ts +1 -1
- package/dist/components/Button/SearchButton.js +4 -3
- package/dist/components/Button/index.d.ts +0 -3
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.js +3 -2
- package/dist/components/Card/CardHeader.js +1 -1
- package/dist/components/Card/CardImage.js +1 -1
- package/dist/components/Card/CardUser.js +1 -1
- package/dist/components/Card/index.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.js +3 -2
- package/dist/components/Checkbox/index.d.ts +0 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/components/ColorPicker/ColorPicker.js +5 -4
- package/dist/components/ColorPicker/ColorPickerItem.d.ts +1 -1
- package/dist/components/ColorPicker/ColorPickerItem.js +3 -2
- package/dist/components/ColorPicker/index.d.ts +1 -3
- package/dist/components/Combobox/Combobox.d.ts +1 -1
- package/dist/components/Combobox/Combobox.js +4 -4
- package/dist/components/Combobox/ComboboxTrigger.js +2 -2
- package/dist/components/Combobox/index.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.js +4 -3
- package/dist/components/Dropdown/DropdownCheckboxItem.js +1 -1
- package/dist/components/Dropdown/DropdownRadioItem.js +1 -1
- package/dist/components/Dropdown/index.d.ts +0 -1
- package/dist/components/Dropzone/Dropzone.d.ts +1 -1
- package/dist/components/Dropzone/Dropzone.js +2 -2
- package/dist/components/Dropzone/DropzoneFile.js +1 -1
- package/dist/components/Dropzone/DropzoneImport.js +1 -1
- package/dist/components/Dropzone/index.d.ts +0 -1
- package/dist/components/EmptyScreen/EmptyScreen.d.ts +1 -1
- package/dist/components/EmptyScreen/EmptyScreen.js +4 -3
- package/dist/components/EmptyScreen/index.d.ts +0 -1
- package/dist/components/FileCard/FileCard.d.ts +1 -1
- package/dist/components/FileCard/FileCard.js +4 -3
- package/dist/components/FileCard/index.d.ts +0 -1
- package/dist/components/Form/FormControl.d.ts +1 -1
- package/dist/components/Form/FormControl.js +6 -5
- package/dist/components/Form/FormText.d.ts +1 -1
- package/dist/components/Form/FormText.js +3 -2
- package/dist/components/Form/index.d.ts +1 -2
- package/dist/components/Heading/Heading.d.ts +1 -1
- package/dist/components/Heading/Heading.js +3 -2
- package/dist/components/Heading/index.d.ts +0 -1
- package/dist/components/Image/Image.d.ts +1 -1
- package/dist/components/Image/Image.js +3 -2
- package/dist/components/Image/index.d.ts +0 -1
- package/dist/components/ImagePicker/ImagePicker.js +4 -4
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +3 -2
- package/dist/components/Input/index.d.ts +0 -1
- package/dist/components/Label/Label.d.ts +1 -1
- package/dist/components/Label/Label.js +3 -2
- package/dist/components/Label/index.d.ts +0 -1
- package/dist/components/Loading/Loading.d.ts +1 -1
- package/dist/components/Loading/Loading.js +3 -2
- package/dist/components/Loading/index.d.ts +0 -1
- package/dist/components/LoadingScreen/LoadingScreen.d.ts +1 -1
- package/dist/components/LoadingScreen/LoadingScreen.js +3 -2
- package/dist/components/LoadingScreen/index.d.ts +1 -1
- package/dist/components/Logo/Logo.d.ts +1 -1
- package/dist/components/Logo/Logo.js +3 -2
- package/dist/components/Logo/index.d.ts +0 -1
- package/dist/components/Menu/MenuButton.js +1 -1
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/Modal/Modal.js +3 -2
- package/dist/components/Modal/ModalHeader.js +1 -1
- package/dist/components/Modal/index.d.ts +0 -1
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Radio/Radio.js +3 -2
- package/dist/components/Radio/index.d.ts +0 -1
- package/dist/components/SearchBar/SearchBar.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.js +5 -4
- package/dist/components/SearchBar/index.d.ts +0 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.js +4 -3
- package/dist/components/Select/SelectTrigger.js +1 -1
- package/dist/components/Select/index.d.ts +0 -1
- package/dist/components/Table/TableExplorer.d.ts +1 -1
- package/dist/components/Table/TableExplorer.js +4 -3
- package/dist/components/Table/index.d.ts +0 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/Tabs/Tabs.js +2 -2
- package/dist/components/Tabs/TabsList.js +1 -1
- package/dist/components/Tabs/index.d.ts +0 -1
- package/dist/components/TextArea/TextArea.d.ts +1 -1
- package/dist/components/TextArea/TextArea.js +5 -4
- package/dist/components/TextArea/index.d.ts +0 -1
- package/dist/components/Toolbar/Toolbar.d.ts +1 -1
- package/dist/components/Toolbar/Toolbar.js +7 -6
- package/dist/components/Toolbar/index.d.ts +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +3 -2
- package/dist/components/Tooltip/index.d.ts +0 -1
- package/dist/components/TreeView/TreeView.d.ts +1 -1
- package/dist/components/TreeView/TreeView.js +3 -2
- package/dist/components/TreeView/index.d.ts +0 -1
- package/dist/components/UploadCard/UploadCard.js +6 -6
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.js +3 -2
- package/dist/components/VisuallyHidden/index.d.ts +1 -1
- package/dist/core/useAvatar/useAvatar.js +1 -1
- package/dist/core/useConversation/useConversation.js +2 -2
- package/dist/core/useHasWorkflow/useHasWorkflow.js +1 -1
- package/dist/core/useHeader/useHeader.js +3 -3
- package/dist/core/useLibraryUrl/useLibraryUrl.js +2 -2
- package/dist/core/useMediaLibrary/useMediaLibrary.js +2 -2
- package/dist/core/useOdeIcons/useOdeIcons.d.ts +1 -1
- package/dist/core/useResource/useResource.d.ts +0 -1
- package/dist/core/useTrashedResource/useTrashedResource.js +2 -2
- package/dist/core/useUpload/useUpload.d.ts +4 -5
- package/dist/core/useUpload/useUpload.js +1 -1
- package/dist/core/useUploadFiles/useUploadFiles.d.ts +5 -5
- package/dist/core/useUploadFiles/useUploadFiles.js +3 -3
- package/dist/core/useWorkspaceFile/useWorkspaceFile.d.ts +4 -4
- package/dist/core/useWorkspaceFile/useWorkspaceFile.js +2 -2
- package/dist/core/useWorkspaceSearch/useWorkspaceSearch.d.ts +2 -2
- package/dist/core/useWorkspaceSearch/useWorkspaceSearch.js +1 -1
- package/dist/editor.js +3 -3
- package/dist/hooks/useBrowserInfo/useBrowserInfo.js +1 -1
- package/dist/hooks/useDropdown/useDropdown.d.ts +1 -1
- package/dist/hooks/useDropdown/useDropdown.js +2 -2
- package/dist/hooks/useDropzone/useDropzone.js +2 -2
- package/dist/hooks/useToast/useToast.js +1 -1
- package/dist/index.js +142 -142
- package/dist/modals.js +14 -16
- package/dist/modules/audience/ReactionChoice.js +5 -5
- package/dist/modules/audience/ReactionModal.Card.js +1 -1
- package/dist/modules/audience/ReactionModal.js +4 -5
- package/dist/modules/audience/ReactionSummary.js +3 -3
- package/dist/modules/audience/ViewsCounter.js +3 -3
- package/dist/modules/audience/ViewsModal.js +4 -4
- package/dist/modules/audience/hooks/useReactions.d.ts +3 -5
- package/dist/modules/audience/hooks/useViews.d.ts +3 -3
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +3 -3
- package/dist/modules/editor/components/Editor/Editor.js +4 -4
- package/dist/modules/editor/components/Editor/MathsModal.d.ts +0 -1
- package/dist/modules/editor/components/Editor/MathsModal.js +3 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.DropdownMenu.js +3 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Emoji.js +3 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +4 -4
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.PlusMenu.js +1 -1
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +4 -4
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextSize.js +3 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +3 -3
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +1 -1
- package/dist/modules/editor/components/NodeView/AttachmentNodeView.js +2 -2
- package/dist/modules/editor/components/NodeView/AudioNodeView.js +2 -2
- package/dist/modules/editor/components/NodeView/ImageNodeView.js +2 -2
- package/dist/modules/editor/components/NodeView/LinkerNodeView.js +2 -2
- package/dist/modules/editor/components/NodeView/VideoNodeView.js +2 -2
- package/dist/modules/editor/components/Renderer/AttachmentRenderer.js +2 -2
- package/dist/modules/editor/components/Renderer/LinkerRenderer.js +2 -2
- package/dist/modules/editor/components/Renderer/MediaRenderer.js +2 -2
- package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +1 -1
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js +5 -5
- package/dist/modules/editor/components/Toolbar/TableToolbar.AddMenu.js +2 -2
- package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +4 -4
- package/dist/modules/editor/components/Toolbar/TableToolbar.DelMenu.js +2 -2
- package/dist/modules/editor/components/Toolbar/TableToolbar.d.ts +1 -1
- package/dist/modules/editor/components/Toolbar/TableToolbar.js +6 -6
- package/dist/modules/editor/hooks/useImageModal.d.ts +1 -2
- package/dist/modules/modals/OnboardingModal/OnboardingModal.d.ts +0 -1
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js +5 -5
- package/dist/modules/modals/PublishModal/PublishModal.js +8 -8
- package/dist/modules/modals/PublishModal/components/ActivitiesDropdown.js +1 -1
- package/dist/modules/modals/PublishModal/components/AgeSelect.js +1 -1
- package/dist/modules/modals/PublishModal/components/LangSelect.js +1 -1
- package/dist/modules/modals/PublishModal/components/PublishModalFooter.js +1 -1
- package/dist/modules/modals/PublishModal/components/SubjectsDropdown.js +1 -1
- package/dist/modules/modals/ResourceModal/ResourceModal.d.ts +1 -1
- package/dist/modules/modals/ResourceModal/ResourceModal.js +12 -11
- package/dist/modules/modals/ResourceModal/apps/BlogPublic.d.ts +1 -1
- package/dist/modules/modals/ResourceModal/apps/BlogPublic.js +8 -7
- package/dist/modules/modals/ResourceModal/hooks/useUpdateMutation.d.ts +1 -1
- package/dist/modules/modals/ResourceModal/hooks/useUpdateMutation.js +3 -2
- package/dist/modules/modals/ResourceModal/index.d.ts +3 -3
- package/dist/modules/modals/ShareModal/ShareBookmarkLine.d.ts +1 -1
- package/dist/modules/modals/ShareModal/apps/ShareBlog.d.ts +2 -1
- package/dist/modules/modals/ShareModal/apps/ShareBlog.js +3 -2
- package/dist/modules/modals/ShareModal/hooks/useShare.d.ts +2 -2
- package/dist/modules/modals/ShareModal/hooks/useShareMutation.d.ts +1 -1
- package/dist/modules/modals/ShareModal/hooks/useShareMutation.js +3 -2
- package/dist/modules/modals/ShareModal/index.d.ts +3 -3
- package/dist/modules/modals/ShareModal/utils/hasRight.d.ts +0 -1
- package/dist/modules/modals/ShareModal/utils/showShareRightLine.d.ts +0 -1
- package/dist/modules/multimedia/AudioRecorder/AudioRecorder.js +5 -5
- package/dist/modules/multimedia/Embed/Embed.js +4 -4
- package/dist/modules/multimedia/ImageEditor/components/ImageEditor.js +8 -8
- package/dist/modules/multimedia/ImageEditor/components/ImageEditorToolbar.js +1 -1
- package/dist/modules/multimedia/ImageEditor/hooks/useHistoryTool.js +36 -38
- package/dist/modules/multimedia/ImagePickerWorkspace/ImagePickerWorkspace.js +2 -2
- package/dist/modules/multimedia/Linker/ExternalLinker.js +9 -9
- package/dist/modules/multimedia/Linker/InternalLinker.js +6 -6
- package/dist/modules/multimedia/LinkerCard/LinkerCard.d.ts +1 -1
- package/dist/modules/multimedia/LinkerCard/LinkerCard.js +5 -4
- package/dist/modules/multimedia/LinkerCard/index.d.ts +0 -1
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +5 -5
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +3 -3
- package/dist/modules/multimedia/MediaLibrary/innertabs/InternalLink.js +1 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +1 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +2 -2
- package/dist/modules/multimedia/UploadFiles/UploadFiles.d.ts +1 -1
- package/dist/modules/multimedia/VideoEmbed/VideoEmbed.js +7 -7
- package/dist/modules/multimedia/VideoRecorder/VideoRecorder.js +7 -7
- package/dist/modules/multimedia/Workspace/Workspace.js +10 -10
- package/dist/multimedia.js +18 -18
- package/dist/portal/Header/Header.js +3 -3
- package/dist/portal/Header/NavLink.js +1 -1
- package/dist/portal/Help/Help.d.ts +0 -1
- package/dist/portal/Help/Help.js +1 -1
- package/dist/portal/Help/hooks/useHelp.js +1 -1
- package/dist/portal/Layout/Layout.js +4 -4
- package/dist/portal/SearchEngine/SearchEngine.js +2 -2
- package/dist/utils/fileSize.js +1 -1
- package/dist/widgets/BookmarkedApps/BookmarkedApps.js +2 -2
- package/package.json +19 -28
- package/dist/modules/modals/ShareModal/ShareBookmark.js +0 -22
- package/dist/modules/modals/ShareModal/ShareBookmarkLine.js +0 -42
- package/dist/modules/modals/ShareModal/ShareModal.js +0 -128
- package/dist/modules/modals/ShareModal/hooks/useSearch.js +0 -178
- package/dist/modules/modals/ShareModal/hooks/useShare.js +0 -192
- package/dist/modules/modals/ShareModal/hooks/useShareBookmark.js +0 -67
- package/dist/modules/modals/ShareModal/utils/hasRight.js +0 -4
- package/dist/modules/modals/ShareModal/utils/showShareRightLine.js +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import VisuallyHidden from "../../components/VisuallyHidden/VisuallyHidden.js";
|
|
3
|
+
import { VisuallyHidden } from "../../components/VisuallyHidden/VisuallyHidden.js";
|
|
4
4
|
function NavLink({
|
|
5
5
|
link,
|
|
6
6
|
className,
|
package/dist/portal/Help/Help.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createPortal } from "react-dom";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
|
-
import Modal from "../../components/Modal/Modal.js";
|
|
4
|
+
import { Modal } from "../../components/Modal/Modal.js";
|
|
5
5
|
function Help({
|
|
6
6
|
isHelpOpen,
|
|
7
7
|
setIsHelpOpen,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
import parse, { domToReact, attributesToProps } from "html-react-parser";
|
|
4
|
-
import Button from "../../../components/Button/Button.js";
|
|
5
4
|
import { useOdeClient } from "../../../core/OdeClientProvider/OdeClientProvider.js";
|
|
6
5
|
import { useOdeTheme } from "../../../core/ThemeProvider/ThemeProvider.js";
|
|
6
|
+
import { Button } from "../../../components/Button/Button.js";
|
|
7
7
|
import { Icon } from "../../../components/Icon/Icon.js";
|
|
8
8
|
function useHelp() {
|
|
9
9
|
var _a, _b, _c, _d, _e;
|
|
@@ -2,8 +2,8 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { Toaster } from "react-hot-toast";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import Alert from "../../components/Alert/Alert.js";
|
|
6
|
-
import Button from "../../components/Button/Button.js";
|
|
5
|
+
import { Alert } from "../../components/Alert/Alert.js";
|
|
6
|
+
import { Button } from "../../components/Button/Button.js";
|
|
7
7
|
import useCookiesConsent from "../../core/useCookiesConsent/useCookiesConsent.js";
|
|
8
8
|
import Header from "../Header/Header.js";
|
|
9
9
|
import useZendeskGuide from "../../core/useZendeskGuide/useZendeskGuide.js";
|
|
@@ -36,7 +36,7 @@ const Layout = ({
|
|
|
36
36
|
renderToaster,
|
|
37
37
|
renderCookies
|
|
38
38
|
] });
|
|
39
|
-
}
|
|
39
|
+
};
|
|
40
40
|
export {
|
|
41
|
-
Layout
|
|
41
|
+
Layout as default
|
|
42
42
|
};
|
|
@@ -4,9 +4,9 @@ import { useTranslation } from "react-i18next";
|
|
|
4
4
|
import { NavItem } from "../Header/NavItem.js";
|
|
5
5
|
import useHover from "../../hooks/useHover/useHover.js";
|
|
6
6
|
import { Popover } from "../../components/Popover/Popover.js";
|
|
7
|
-
import FormControl from "../../components/Form/FormControl.js";
|
|
8
|
-
import SearchButton from "../../components/Button/SearchButton.js";
|
|
9
7
|
import { Icon } from "../../components/Icon/Icon.js";
|
|
8
|
+
import { FormControl } from "../../components/Form/FormControl.js";
|
|
9
|
+
import { SearchButton } from "../../components/Button/SearchButton.js";
|
|
10
10
|
const SearchEngine = () => {
|
|
11
11
|
const [searchRef, isSearchHovered] = useHover(), inputRef = useRef(null), popoverSearchId = useId(), {
|
|
12
12
|
t
|
package/dist/utils/fileSize.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const customSize = (bytes, decimalPoint) => {
|
|
2
|
-
if (bytes
|
|
2
|
+
if (bytes === 0) return "0 octets";
|
|
3
3
|
const k = 1e3, dm = decimalPoint, sizes = ["octets", "Ko", "Mo", "Go"], i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
4
4
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
|
|
5
5
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { AppIcon } from "../../components/AppIcon/AppIcon.js";
|
|
3
3
|
const BookmarkedApps = ({
|
|
4
4
|
data
|
|
5
|
-
}) => data.length > 0 ? data.slice(0, 6).map((app, index) => /* @__PURE__ */ jsx("a", { href: app.address, className: "bookmarked-app", children: /* @__PURE__ */ jsx(AppIcon, { app, size: "32" }) }, index)) : /* @__PURE__ */ jsx("div", { className: "text-dark mx-auto", children: /* @__PURE__ */ jsx("a", { href: "/welcome", children: "Sélectionner vos applications favorites" }) })
|
|
5
|
+
}) => data.length > 0 ? data.slice(0, 6).map((app, index) => /* @__PURE__ */ jsx("a", { href: app.address, className: "bookmarked-app", children: /* @__PURE__ */ jsx(AppIcon, { app, size: "32" }) }, index)) : /* @__PURE__ */ jsx("div", { className: "text-dark mx-auto", children: /* @__PURE__ */ jsx("a", { href: "/welcome", children: "Sélectionner vos applications favorites" }) });
|
|
6
6
|
export {
|
|
7
|
-
BookmarkedApps
|
|
7
|
+
BookmarkedApps as default
|
|
8
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.0.0-develop-rc.
|
|
3
|
+
"version": "2.0.0-develop-rc.7",
|
|
4
4
|
"description": "Edifice React Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -47,37 +47,19 @@
|
|
|
47
47
|
"files": [
|
|
48
48
|
"dist"
|
|
49
49
|
],
|
|
50
|
-
"scripts": {
|
|
51
|
-
"build": "vite build",
|
|
52
|
-
"fix": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
53
|
-
"format": "pnpm run format:write && pnpm run format:check",
|
|
54
|
-
"format:check": "npx prettier --check .",
|
|
55
|
-
"format:write": "npx prettier --write .",
|
|
56
|
-
"lint": "eslint \"**/*.{ts,tsx}\"",
|
|
57
|
-
"test": "vitest"
|
|
58
|
-
},
|
|
59
50
|
"dependencies": {
|
|
60
|
-
"@edifice.io/tiptap-extensions": "2.0.0-develop-rc.0",
|
|
61
51
|
"@floating-ui/react": "0.26.0",
|
|
62
52
|
"@pixi/mixin-get-child-by-name": "7.4.2",
|
|
63
53
|
"@pixi/react": "7.1.2",
|
|
64
|
-
"@
|
|
65
|
-
"@tiptap-pro/extension-mathematics": "2.2.1",
|
|
66
|
-
"@tiptap/core": "2.3.0",
|
|
54
|
+
"@storybook/react": "7.6.6",
|
|
67
55
|
"@tiptap/extension-character-count": "2.3.0",
|
|
68
56
|
"@tiptap/extension-color": "2.3.0",
|
|
69
57
|
"@tiptap/extension-focus": "2.3.0",
|
|
70
58
|
"@tiptap/extension-font-family": "2.3.0",
|
|
71
|
-
"@tiptap/extension-heading": "2.3.0",
|
|
72
|
-
"@tiptap/extension-highlight": "2.3.0",
|
|
73
|
-
"@tiptap/extension-image": "2.3.0",
|
|
74
|
-
"@tiptap/extension-link": "2.3.0",
|
|
75
|
-
"@tiptap/extension-list-item": "2.3.0",
|
|
76
59
|
"@tiptap/extension-placeholder": "2.3.0",
|
|
77
60
|
"@tiptap/extension-subscript": "2.3.0",
|
|
78
61
|
"@tiptap/extension-superscript": "2.3.0",
|
|
79
62
|
"@tiptap/extension-table": "2.3.0",
|
|
80
|
-
"@tiptap/extension-table-cell": "2.3.0",
|
|
81
63
|
"@tiptap/extension-table-header": "2.3.0",
|
|
82
64
|
"@tiptap/extension-table-row": "2.3.0",
|
|
83
65
|
"@tiptap/extension-text-align": "2.3.0",
|
|
@@ -93,35 +75,37 @@
|
|
|
93
75
|
"emoji-picker-react": "4.5.2",
|
|
94
76
|
"html-react-parser": "4.2.1",
|
|
95
77
|
"ohash": "1.1.3",
|
|
96
|
-
"pako": "2.1.0",
|
|
97
78
|
"pixi.js": "7.4.2",
|
|
98
79
|
"react-hot-toast": "2.4.1",
|
|
99
80
|
"react-intersection-observer": "9.5.3",
|
|
100
81
|
"react-popper": "2.3.0",
|
|
101
82
|
"react-slugify": "3.0.3",
|
|
102
83
|
"swiper": "10.1.0",
|
|
103
|
-
"ua-parser-js": "1.0.36"
|
|
84
|
+
"ua-parser-js": "1.0.36",
|
|
85
|
+
"@edifice.io/ts-client": "2.0.0-develop-rc.7",
|
|
86
|
+
"@edifice.io/tiptap-extensions": "2.0.0-develop-rc.7"
|
|
104
87
|
},
|
|
105
88
|
"devDependencies": {
|
|
106
89
|
"@babel/plugin-transform-react-pure-annotations": "7.23.3",
|
|
107
|
-
"@edifice.io/icons": "2.0.0-develop-rc.0",
|
|
108
90
|
"@react-spring/web": "9.7.3",
|
|
91
|
+
"@storybook/react": "7.6.6",
|
|
109
92
|
"@tanstack/react-query": "5.8.4",
|
|
110
93
|
"@types/node": "20.8.4",
|
|
111
94
|
"@types/pako": "2.0.3",
|
|
112
95
|
"@types/react": "18.2.28",
|
|
113
96
|
"@types/react-dom": "18.2.13",
|
|
114
97
|
"@types/ua-parser-js": "0.7.37",
|
|
115
|
-
"edifice-ts-client": "2.0.0-develop-rc.0",
|
|
116
98
|
"react": "18.2.0",
|
|
117
99
|
"react-dom": "18.2.0",
|
|
118
100
|
"react-hook-form": "7.49.2",
|
|
119
|
-
"react-i18next": "14.1.0"
|
|
101
|
+
"react-i18next": "14.1.0",
|
|
102
|
+
"@edifice.io/icons": "2.0.0-develop-rc.7"
|
|
120
103
|
},
|
|
121
104
|
"peerDependencies": {
|
|
122
|
-
"@edifice.io/icons": "
|
|
105
|
+
"@edifice.io/icons": "*",
|
|
123
106
|
"@react-spring/web": "9.7.3",
|
|
124
107
|
"@tanstack/react-query": "5.8.4",
|
|
108
|
+
"@tiptap-pro/extension-mathematics": "2.2.1",
|
|
125
109
|
"react": "18.2.0",
|
|
126
110
|
"react-dom": "18.2.0",
|
|
127
111
|
"react-hook-form": "7.49.2",
|
|
@@ -130,5 +114,12 @@
|
|
|
130
114
|
"publishConfig": {
|
|
131
115
|
"access": "public"
|
|
132
116
|
},
|
|
133
|
-
"gitHead": "
|
|
134
|
-
|
|
117
|
+
"gitHead": "3e1c3f5b48505564db1b70aab22063a70336f3b0",
|
|
118
|
+
"scripts": {
|
|
119
|
+
"build": "vite build",
|
|
120
|
+
"format": "pnpm run format:write && pnpm run format:check",
|
|
121
|
+
"format:check": "npx prettier --check .",
|
|
122
|
+
"format:write": "npx prettier --write .",
|
|
123
|
+
"test": "vitest"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import FormControl from "../../../components/Form/FormControl.js";
|
|
4
|
-
import Button from "../../../components/Button/Button.js";
|
|
5
|
-
import { Icon } from "../../../components/Icon/Icon.js";
|
|
6
|
-
const ShareBookmark = ({
|
|
7
|
-
bookmark,
|
|
8
|
-
refBookmark,
|
|
9
|
-
onBookmarkChange,
|
|
10
|
-
onSave
|
|
11
|
-
}) => {
|
|
12
|
-
const {
|
|
13
|
-
t
|
|
14
|
-
} = useTranslation();
|
|
15
|
-
return /* @__PURE__ */ jsx("div", { className: "mt-16", children: /* @__PURE__ */ jsxs(FormControl, { id: "bookmarkName", className: "d-flex flex-wrap align-items-center gap-16", children: [
|
|
16
|
-
/* @__PURE__ */ jsx("div", { className: "flex-fill", children: /* @__PURE__ */ jsx(FormControl.Input, { ref: refBookmark, onChange: onBookmarkChange, placeholder: t("explorer.modal.share.sharebookmark.placeholder"), size: "sm", type: "text" }, bookmark.id) }),
|
|
17
|
-
/* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "ghost", disabled: bookmark.name.length === 0, leftIcon: /* @__PURE__ */ jsx(Icon, { name: "save" }), onClick: onSave, className: "text-nowrap", children: t("explorer.modal.share.sharebookmark.save") })
|
|
18
|
-
] }) });
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
ShareBookmark
|
|
22
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { hasRight } from "./utils/hasRight.js";
|
|
4
|
-
import { showShareRightLine } from "./utils/showShareRightLine.js";
|
|
5
|
-
import Avatar from "../../../components/Avatar/Avatar.js";
|
|
6
|
-
import { Icon } from "../../../components/Icon/Icon.js";
|
|
7
|
-
import Button from "../../../components/Button/Button.js";
|
|
8
|
-
import Checkbox from "../../../components/Checkbox/Checkbox.js";
|
|
9
|
-
import IconButton from "../../../components/Button/IconButton.js";
|
|
10
|
-
const ShareBookmarkLine = ({
|
|
11
|
-
shareRights,
|
|
12
|
-
showBookmark,
|
|
13
|
-
toggleBookmark,
|
|
14
|
-
shareRightActions,
|
|
15
|
-
toggleRight,
|
|
16
|
-
onDeleteRow
|
|
17
|
-
}) => {
|
|
18
|
-
const {
|
|
19
|
-
t
|
|
20
|
-
} = useTranslation();
|
|
21
|
-
return shareRights == null ? void 0 : shareRights.rights.map((shareRight) => showShareRightLine(shareRight, showBookmark) && /* @__PURE__ */ jsxs("tr", { className: shareRight.isBookmarkMember ? "bg-light" : "", children: [
|
|
22
|
-
/* @__PURE__ */ jsxs("td", { children: [
|
|
23
|
-
shareRight.type !== "sharebookmark" && /* @__PURE__ */ jsx(Avatar, { alt: t("explorer.modal.share.avatar.shared.alt"), size: "xs", src: shareRight.avatarUrl, variant: "circle" }),
|
|
24
|
-
shareRight.type === "sharebookmark" && /* @__PURE__ */ jsx(Icon, { name: "bookmark" })
|
|
25
|
-
] }),
|
|
26
|
-
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsxs("div", { className: "d-flex", children: [
|
|
27
|
-
shareRight.type === "sharebookmark" && /* @__PURE__ */ jsx(Button, { color: "tertiary", rightIcon: /* @__PURE__ */ jsx(Icon, { name: "rafter-down", className: "w-16 min-w-0", style: {
|
|
28
|
-
transition: "rotate 0.2s ease-out",
|
|
29
|
-
rotate: showBookmark ? "-180deg" : "0deg"
|
|
30
|
-
} }), type: "button", variant: "ghost", className: "fw-normal ps-0", onClick: toggleBookmark, children: shareRight.displayName }),
|
|
31
|
-
shareRight.type !== "sharebookmark" && shareRight.displayName,
|
|
32
|
-
shareRight.type === "user" && ` (${t(shareRight.profile || "")})`
|
|
33
|
-
] }) }),
|
|
34
|
-
shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsx("td", { style: {
|
|
35
|
-
width: "80px"
|
|
36
|
-
}, className: "text-center text-white", children: /* @__PURE__ */ jsx(Checkbox, { checked: hasRight(shareRight, shareRightAction), onChange: () => toggleRight(shareRight, shareRightAction.id) }) }, shareRightAction.displayName)),
|
|
37
|
-
/* @__PURE__ */ jsx("td", { children: !shareRight.isBookmarkMember && /* @__PURE__ */ jsx(IconButton, { "aria-label": t("close"), color: "tertiary", icon: /* @__PURE__ */ jsx(Icon, { name: "close" }), type: "button", variant: "ghost", title: t("close"), onClick: () => onDeleteRow(shareRight) }) })
|
|
38
|
-
] }, shareRight.id));
|
|
39
|
-
};
|
|
40
|
-
export {
|
|
41
|
-
ShareBookmarkLine
|
|
42
|
-
};
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { ShareBookmark } from "./ShareBookmark.js";
|
|
6
|
-
import { ShareBookmarkLine } from "./ShareBookmarkLine.js";
|
|
7
|
-
import { useSearch } from "./hooks/useSearch.js";
|
|
8
|
-
import useShare from "./hooks/useShare.js";
|
|
9
|
-
import { useShareBookmark } from "./hooks/useShareBookmark.js";
|
|
10
|
-
import Combobox from "../../../components/Combobox/Combobox.js";
|
|
11
|
-
import Modal from "../../../components/Modal/Modal.js";
|
|
12
|
-
import Heading from "../../../components/Heading/Heading.js";
|
|
13
|
-
import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
|
|
14
|
-
import VisuallyHidden from "../../../components/VisuallyHidden/VisuallyHidden.js";
|
|
15
|
-
import Avatar from "../../../components/Avatar/Avatar.js";
|
|
16
|
-
import Checkbox from "../../../components/Checkbox/Checkbox.js";
|
|
17
|
-
import Button from "../../../components/Button/Button.js";
|
|
18
|
-
import { Icon } from "../../../components/Icon/Icon.js";
|
|
19
|
-
import Tooltip from "../../../components/Tooltip/Tooltip.js";
|
|
20
|
-
function ShareResourceModal({
|
|
21
|
-
isOpen,
|
|
22
|
-
shareOptions,
|
|
23
|
-
shareResource,
|
|
24
|
-
children,
|
|
25
|
-
onSuccess,
|
|
26
|
-
onCancel
|
|
27
|
-
}) {
|
|
28
|
-
const {
|
|
29
|
-
resourceId,
|
|
30
|
-
resourceCreatorId,
|
|
31
|
-
resourceRights
|
|
32
|
-
} = shareOptions, [isLoading, setIsLoading] = useState(!0), {
|
|
33
|
-
state: {
|
|
34
|
-
isSharing,
|
|
35
|
-
shareRights,
|
|
36
|
-
shareRightActions
|
|
37
|
-
},
|
|
38
|
-
dispatch: shareDispatch,
|
|
39
|
-
myAvatar,
|
|
40
|
-
currentIsAuthor,
|
|
41
|
-
handleShare,
|
|
42
|
-
toggleRight,
|
|
43
|
-
handleDeleteRow
|
|
44
|
-
} = useShare({
|
|
45
|
-
resourceId,
|
|
46
|
-
resourceCreatorId,
|
|
47
|
-
resourceRights,
|
|
48
|
-
shareResource,
|
|
49
|
-
setIsLoading,
|
|
50
|
-
onSuccess
|
|
51
|
-
}), {
|
|
52
|
-
state: {
|
|
53
|
-
searchResults,
|
|
54
|
-
searchInputValue
|
|
55
|
-
},
|
|
56
|
-
showSearchAdmlHint,
|
|
57
|
-
showSearchLoading,
|
|
58
|
-
showSearchNoResults,
|
|
59
|
-
getSearchMinLength,
|
|
60
|
-
handleSearchInputChange,
|
|
61
|
-
handleSearchResultsChange
|
|
62
|
-
} = useSearch({
|
|
63
|
-
resourceId,
|
|
64
|
-
resourceCreatorId,
|
|
65
|
-
shareRights,
|
|
66
|
-
shareDispatch
|
|
67
|
-
}), {
|
|
68
|
-
refBookmark,
|
|
69
|
-
showBookmark,
|
|
70
|
-
handleBookmarkChange,
|
|
71
|
-
toggleBookmark,
|
|
72
|
-
bookmark,
|
|
73
|
-
handleOnSave,
|
|
74
|
-
showBookmarkInput,
|
|
75
|
-
toggleBookmarkInput
|
|
76
|
-
} = useShareBookmark({
|
|
77
|
-
shareRights,
|
|
78
|
-
shareDispatch
|
|
79
|
-
}), {
|
|
80
|
-
t
|
|
81
|
-
} = useTranslation(), searchPlaceholder = showSearchAdmlHint() ? t("explorer.search.adml.hint") : t("explorer.modal.share.search.placeholder");
|
|
82
|
-
return /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { id: "share_modal", size: "lg", isOpen, onModalClose: onCancel, children: [
|
|
83
|
-
/* @__PURE__ */ jsx(Modal.Header, { onModalClose: onCancel, children: t("share.title") }),
|
|
84
|
-
/* @__PURE__ */ jsxs(Modal.Body, { children: [
|
|
85
|
-
/* @__PURE__ */ jsx(Heading, { headingStyle: "h4", level: "h3", className: "mb-16", children: t("explorer.modal.share.usersWithAccess") }),
|
|
86
|
-
/* @__PURE__ */ jsx("div", { className: "table-responsive", children: isLoading ? /* @__PURE__ */ jsx(LoadingScreen, {}) : /* @__PURE__ */ jsxs("table", { className: "table border align-middle mb-0", children: [
|
|
87
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-secondary", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
88
|
-
/* @__PURE__ */ jsx("th", { scope: "col", className: "w-32", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("explorer.modal.share.avatar.shared.alt") }) }),
|
|
89
|
-
/* @__PURE__ */ jsx("th", { scope: "col", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("explorer.modal.share.search.placeholder") }) }),
|
|
90
|
-
shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsx("th", { scope: "col", className: "text-center text-white", children: t(shareRightAction.displayName) }, shareRightAction.displayName)),
|
|
91
|
-
/* @__PURE__ */ jsx("th", { scope: "col", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("close") }) })
|
|
92
|
-
] }) }),
|
|
93
|
-
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
94
|
-
currentIsAuthor() && /* @__PURE__ */ jsxs("tr", { children: [
|
|
95
|
-
/* @__PURE__ */ jsx("th", { scope: "row", children: /* @__PURE__ */ jsx(Avatar, { alt: t("explorer.modal.share.avatar.me.alt"), size: "xs", src: myAvatar, variant: "circle" }) }),
|
|
96
|
-
/* @__PURE__ */ jsx("td", { children: t("share.me") }),
|
|
97
|
-
shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsx("td", { style: {
|
|
98
|
-
width: "80px"
|
|
99
|
-
}, className: "text-center text-white", children: /* @__PURE__ */ jsx(Checkbox, { checked: !0, disabled: !0 }) }, shareRightAction.displayName)),
|
|
100
|
-
/* @__PURE__ */ jsx("td", {})
|
|
101
|
-
] }),
|
|
102
|
-
/* @__PURE__ */ jsx(ShareBookmarkLine, { showBookmark, shareRightActions, shareRights, onDeleteRow: handleDeleteRow, toggleRight, toggleBookmark })
|
|
103
|
-
] })
|
|
104
|
-
] }) }),
|
|
105
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-16", children: [
|
|
106
|
-
/* @__PURE__ */ jsx(Button, { color: "tertiary", leftIcon: /* @__PURE__ */ jsx(Icon, { name: "bookmark" }), rightIcon: /* @__PURE__ */ jsx(Icon, { name: "rafter-down", className: "w-16 min-w-0", style: {
|
|
107
|
-
transition: "rotate 0.2s ease-out",
|
|
108
|
-
rotate: showBookmarkInput ? "-180deg" : "0deg"
|
|
109
|
-
} }), type: "button", variant: "ghost", className: "fw-normal", onClick: () => toggleBookmarkInput(!showBookmarkInput), children: t("share.save.sharebookmark") }),
|
|
110
|
-
showBookmarkInput && /* @__PURE__ */ jsx(ShareBookmark, { refBookmark, bookmark, onBookmarkChange: handleBookmarkChange, onSave: handleOnSave })
|
|
111
|
-
] }),
|
|
112
|
-
/* @__PURE__ */ jsx("hr", {}),
|
|
113
|
-
/* @__PURE__ */ jsxs(Heading, { headingStyle: "h4", level: "h3", className: "mb-16 d-flex align-items-center", children: [
|
|
114
|
-
/* @__PURE__ */ jsx("div", { className: "me-8", children: t("explorer.modal.share.search") }),
|
|
115
|
-
/* @__PURE__ */ jsx(Tooltip, { message: "Vos favoris de partage s’affichent en priorité dans votre liste lorsque vous recherchez un groupe ou une personne, vous pouvez les retrouver dans l’annuaire.", placement: "top", children: /* @__PURE__ */ jsx(Icon, { name: "info-circle", className: "c-pointer", size: "18" }) })
|
|
116
|
-
] }),
|
|
117
|
-
/* @__PURE__ */ jsx("div", { className: "row", children: /* @__PURE__ */ jsx("div", { className: "col-10", children: /* @__PURE__ */ jsx(Combobox, { value: searchInputValue, placeholder: searchPlaceholder, isLoading: showSearchLoading(), noResult: showSearchNoResults(), options: searchResults, searchMinLength: getSearchMinLength(), onSearchInputChange: handleSearchInputChange, onSearchResultsChange: handleSearchResultsChange }) }) }),
|
|
118
|
-
children
|
|
119
|
-
] }),
|
|
120
|
-
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
121
|
-
/* @__PURE__ */ jsx(Button, { type: "button", color: "tertiary", variant: "ghost", onClick: onCancel, children: t("explorer.cancel") }),
|
|
122
|
-
/* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", isLoading: isSharing, onClick: handleShare, disabled: isSharing, children: t("share") })
|
|
123
|
-
] })
|
|
124
|
-
] }), document.getElementById("portal"));
|
|
125
|
-
}
|
|
126
|
-
export {
|
|
127
|
-
ShareResourceModal as default
|
|
128
|
-
};
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useReducer, useEffect } from "react";
|
|
3
|
-
import { odeServices } from "edifice-ts-client";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
import useDebounce from "../../../../hooks/useDebounce/useDebounce.js";
|
|
6
|
-
import useIsAdml from "../../../../core/useIsAdml/useIsAdml.js";
|
|
7
|
-
import { useOdeClient } from "../../../../core/OdeClientProvider/OdeClientProvider.js";
|
|
8
|
-
import { Icon } from "../../../../components/Icon/Icon.js";
|
|
9
|
-
const initialState = {
|
|
10
|
-
searchInputValue: "",
|
|
11
|
-
searchResults: [],
|
|
12
|
-
searchAPIResults: [],
|
|
13
|
-
isSearching: !1
|
|
14
|
-
};
|
|
15
|
-
function reducer(state, action) {
|
|
16
|
-
switch (action.type) {
|
|
17
|
-
case "onChange":
|
|
18
|
-
return {
|
|
19
|
-
...state,
|
|
20
|
-
searchInputValue: action.payload
|
|
21
|
-
};
|
|
22
|
-
case "isSearching":
|
|
23
|
-
return {
|
|
24
|
-
...state,
|
|
25
|
-
isSearching: action.payload
|
|
26
|
-
};
|
|
27
|
-
case "addResult":
|
|
28
|
-
return {
|
|
29
|
-
...state,
|
|
30
|
-
searchResults: action.payload
|
|
31
|
-
};
|
|
32
|
-
case "addApiResult":
|
|
33
|
-
return {
|
|
34
|
-
...state,
|
|
35
|
-
searchAPIResults: action.payload
|
|
36
|
-
};
|
|
37
|
-
case "updateSearchResult":
|
|
38
|
-
return {
|
|
39
|
-
...state,
|
|
40
|
-
searchResults: action.payload
|
|
41
|
-
};
|
|
42
|
-
case "emptyResult":
|
|
43
|
-
return {
|
|
44
|
-
...state,
|
|
45
|
-
searchResults: action.payload
|
|
46
|
-
};
|
|
47
|
-
default:
|
|
48
|
-
throw new Error("Unhandled action type");
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const defaultActions = [{
|
|
52
|
-
id: "read",
|
|
53
|
-
displayName: "read"
|
|
54
|
-
}, {
|
|
55
|
-
id: "comment",
|
|
56
|
-
displayName: "comment"
|
|
57
|
-
}], useSearch = ({
|
|
58
|
-
resourceId,
|
|
59
|
-
resourceCreatorId,
|
|
60
|
-
shareRights,
|
|
61
|
-
shareDispatch
|
|
62
|
-
}) => {
|
|
63
|
-
const [state, dispatch] = useReducer(reducer, initialState), debouncedSearchInputValue = useDebounce(state.searchInputValue, 500), {
|
|
64
|
-
isAdml
|
|
65
|
-
} = useIsAdml(), {
|
|
66
|
-
appCode
|
|
67
|
-
} = useOdeClient(), {
|
|
68
|
-
t
|
|
69
|
-
} = useTranslation();
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
search(debouncedSearchInputValue);
|
|
72
|
-
}, [debouncedSearchInputValue]);
|
|
73
|
-
const handleSearchInputChange = (event) => {
|
|
74
|
-
const value = event.target.value;
|
|
75
|
-
dispatch({
|
|
76
|
-
type: "onChange",
|
|
77
|
-
payload: value
|
|
78
|
-
});
|
|
79
|
-
}, search = async (debouncedSearchInputValue2) => {
|
|
80
|
-
if (resourceId) {
|
|
81
|
-
if (dispatch({
|
|
82
|
-
type: "isSearching",
|
|
83
|
-
payload: !0
|
|
84
|
-
}), !isAdml && debouncedSearchInputValue2.length >= 1 || isAdml && debouncedSearchInputValue2.length >= 3) {
|
|
85
|
-
const resSearchShareSubjects = await odeServices.share().searchShareSubjects(appCode, resourceId, debouncedSearchInputValue2);
|
|
86
|
-
dispatch({
|
|
87
|
-
type: "addApiResult",
|
|
88
|
-
payload: resSearchShareSubjects
|
|
89
|
-
});
|
|
90
|
-
const adaptedResults = resSearchShareSubjects.filter((right) => !shareRights.rights.find((shareRight) => shareRight.id === right.id)).filter((right) => !(right.type === "user" && right.id === resourceCreatorId)).map((searchResult) => {
|
|
91
|
-
let label = searchResult.displayName;
|
|
92
|
-
return searchResult.type === "user" && searchResult.profile ? label = `${label} (${t(searchResult.profile)})` : searchResult.type === "group" && searchResult.structureName && (label = `${label} (${searchResult.structureName})`), {
|
|
93
|
-
value: searchResult.id,
|
|
94
|
-
label,
|
|
95
|
-
icon: searchResult.type === "sharebookmark" ? /* @__PURE__ */ jsx(Icon, { name: "bookmark" }) : null
|
|
96
|
-
};
|
|
97
|
-
});
|
|
98
|
-
dispatch({
|
|
99
|
-
type: "addResult",
|
|
100
|
-
payload: adaptedResults
|
|
101
|
-
});
|
|
102
|
-
} else
|
|
103
|
-
dispatch({
|
|
104
|
-
type: "emptyResult",
|
|
105
|
-
payload: []
|
|
106
|
-
}), Promise.resolve();
|
|
107
|
-
dispatch({
|
|
108
|
-
type: "isSearching",
|
|
109
|
-
payload: !1
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
return {
|
|
114
|
-
state,
|
|
115
|
-
showSearchAdmlHint: () => isAdml && state.searchInputValue.length < 3,
|
|
116
|
-
showSearchLoading: () => state.isSearching,
|
|
117
|
-
showSearchNoResults: () => !state.isSearching && !isAdml && debouncedSearchInputValue.length > 0 && state.searchResults.length === 0 || !state.isSearching && isAdml && debouncedSearchInputValue.length > 3 && state.searchResults.length === 0,
|
|
118
|
-
getSearchMinLength: () => isAdml ? 3 : 1,
|
|
119
|
-
handleSearchInputChange,
|
|
120
|
-
handleSearchResultsChange: async (model) => {
|
|
121
|
-
const shareSubject = state.searchAPIResults.find((searchAPIResult) => searchAPIResult.id === model[0]);
|
|
122
|
-
if (shareSubject) {
|
|
123
|
-
let rightsToAdd = [];
|
|
124
|
-
if (shareSubject.type === "sharebookmark") {
|
|
125
|
-
const bookmarkRes = await odeServices.directory().getBookMarkById(shareSubject.id);
|
|
126
|
-
rightsToAdd.push({
|
|
127
|
-
...bookmarkRes,
|
|
128
|
-
type: "sharebookmark",
|
|
129
|
-
avatarUrl: "",
|
|
130
|
-
directoryUrl: "",
|
|
131
|
-
actions: defaultActions
|
|
132
|
-
}), bookmarkRes == null || bookmarkRes.users.filter((user) => !shareRights.rights.find((right) => right.id === user.id)).forEach((user) => {
|
|
133
|
-
rightsToAdd.push({
|
|
134
|
-
...user,
|
|
135
|
-
type: "user",
|
|
136
|
-
avatarUrl: "",
|
|
137
|
-
directoryUrl: "",
|
|
138
|
-
actions: defaultActions,
|
|
139
|
-
isBookmarkMember: !0
|
|
140
|
-
});
|
|
141
|
-
}), bookmarkRes.groups.filter((group) => !shareRights.rights.find((right) => right.id === group.id)).forEach((group) => {
|
|
142
|
-
rightsToAdd.push({
|
|
143
|
-
...group,
|
|
144
|
-
type: "group",
|
|
145
|
-
avatarUrl: "",
|
|
146
|
-
directoryUrl: "",
|
|
147
|
-
actions: defaultActions,
|
|
148
|
-
isBookmarkMember: !0
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
} else
|
|
152
|
-
rightsToAdd = [{
|
|
153
|
-
...shareSubject,
|
|
154
|
-
actions: [{
|
|
155
|
-
id: "read",
|
|
156
|
-
displayName: "read"
|
|
157
|
-
}, {
|
|
158
|
-
id: "comment",
|
|
159
|
-
displayName: "comment"
|
|
160
|
-
}]
|
|
161
|
-
}];
|
|
162
|
-
shareDispatch({
|
|
163
|
-
type: "updateShareRights",
|
|
164
|
-
payload: {
|
|
165
|
-
...shareRights,
|
|
166
|
-
rights: [...shareRights.rights, ...rightsToAdd]
|
|
167
|
-
}
|
|
168
|
-
}), dispatch({
|
|
169
|
-
type: "updateSearchResult",
|
|
170
|
-
payload: state.searchResults.filter((result) => result.value !== model[0])
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
export {
|
|
177
|
-
useSearch
|
|
178
|
-
};
|