@edifice.io/react 2.5.6 → 2.5.8-develop-b2school.20260122173252
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.js +8 -0
- package/dist/_virtual/common.js +4 -0
- package/dist/_virtual/de_DE.js +4 -0
- package/dist/_virtual/de_DE2.js +4 -0
- package/dist/_virtual/de_DE3.js +4 -0
- package/dist/_virtual/de_DE4.js +4 -0
- package/dist/_virtual/de_DE5.js +4 -0
- package/dist/_virtual/de_DE6.js +4 -0
- package/dist/_virtual/defineProperty.js +4 -0
- package/dist/_virtual/es_ES.js +4 -0
- package/dist/_virtual/es_ES2.js +4 -0
- package/dist/_virtual/es_ES3.js +4 -0
- package/dist/_virtual/es_ES4.js +4 -0
- package/dist/_virtual/es_ES5.js +4 -0
- package/dist/_virtual/es_ES6.js +4 -0
- package/dist/_virtual/fr_FR.js +4 -0
- package/dist/_virtual/fr_FR2.js +4 -0
- package/dist/_virtual/fr_FR3.js +4 -0
- package/dist/_virtual/fr_FR4.js +4 -0
- package/dist/_virtual/fr_FR5.js +4 -0
- package/dist/_virtual/fr_FR6.js +4 -0
- package/dist/_virtual/interopRequireDefault.js +4 -0
- package/dist/_virtual/it_IT.js +4 -0
- package/dist/_virtual/it_IT2.js +4 -0
- package/dist/_virtual/it_IT3.js +4 -0
- package/dist/_virtual/it_IT4.js +4 -0
- package/dist/_virtual/it_IT5.js +4 -0
- package/dist/_virtual/it_IT6.js +4 -0
- package/dist/_virtual/localeData.js +4 -0
- package/dist/_virtual/objectSpread2.js +4 -0
- package/dist/_virtual/pt_PT.js +4 -0
- package/dist/_virtual/pt_PT2.js +4 -0
- package/dist/_virtual/pt_PT3.js +4 -0
- package/dist/_virtual/pt_PT4.js +4 -0
- package/dist/_virtual/pt_PT5.js +4 -0
- package/dist/_virtual/pt_PT6.js +4 -0
- package/dist/_virtual/toPrimitive.js +4 -0
- package/dist/_virtual/toPropertyKey.js +4 -0
- package/dist/_virtual/typeof.js +4 -0
- package/dist/_virtual/weekday.js +4 -0
- package/dist/components/AppIcon/index.d.ts +1 -0
- package/dist/components/Badge/Badge.d.ts +12 -1
- package/dist/components/Badge/Badge.js +15 -2
- package/dist/components/Combobox/Combobox.js +1 -1
- package/dist/components/Combobox/ComboboxTrigger.js +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +57 -0
- package/dist/components/DatePicker/DatePicker.js +38 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/Divider/Divider.d.ts +38 -0
- package/dist/components/Divider/Divider.js +11 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Dropdown/DropdownContext.js +1 -1
- package/dist/components/Flex/Flex.js +1 -1
- package/dist/components/Form/FormContext.js +1 -1
- package/dist/components/Layout/Layout.js +1 -2
- package/dist/components/Menu/components/MenuButton.d.ts +2 -0
- package/dist/components/Menu/components/MenuButton.js +13 -4
- package/dist/components/Modal/Modal.d.ts +4 -0
- package/dist/components/Modal/Modal.js +13 -12
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +59 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +24 -0
- package/dist/components/SegmentedControl/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +6 -2
- package/dist/components/Select/Select.js +10 -4
- package/dist/components/Toolbar/Toolbar.js +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/editor.js +42 -38
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useConversation/useConversation.js +3 -1
- package/dist/hooks/useDropdown/useDropdown.js +1 -1
- package/dist/hooks/useDropzone/useDropzone.d.ts +2 -2
- package/dist/hooks/useDropzone/useDropzone.js +24 -4
- package/dist/hooks/useInfiniteScroll/index.d.ts +1 -0
- package/dist/hooks/useInfiniteScroll/useInfiniteScroll.d.ts +33 -0
- package/dist/hooks/useInfiniteScroll/useInfiniteScroll.js +20 -0
- package/dist/icons.js +302 -298
- package/dist/index.js +230 -212
- package/dist/modals.js +14 -12
- package/dist/modules/comments/components/Comment.js +8 -6
- package/dist/modules/comments/components/CommentDate.js +7 -10
- package/dist/modules/comments/components/CommentDeleted.js +1 -1
- package/dist/modules/comments/components/CommentForm.d.ts +1 -1
- package/dist/modules/comments/components/CommentForm.js +6 -6
- package/dist/modules/comments/components/CommentList.js +1 -1
- package/dist/modules/comments/components/CommentTitle.js +1 -1
- package/dist/modules/comments/components/DeleteModal.js +14 -8
- package/dist/modules/comments/provider/CommentProvider.js +4 -4
- package/dist/modules/comments/types.d.ts +3 -1
- package/dist/modules/editor/components/Editor/Editor.js +1 -1
- package/dist/modules/editor/components/Editor/EditorPreview.d.ts +14 -0
- package/dist/modules/editor/components/Editor/EditorPreview.js +56 -0
- package/dist/modules/editor/components/Editor/EditorPreviewSkeleton.d.ts +8 -0
- package/dist/modules/editor/components/Editor/EditorPreviewSkeleton.js +24 -0
- package/dist/modules/editor/components/Editor/index.d.ts +2 -0
- package/dist/modules/editor/components/Renderer/AttachmentRenderer.js +2 -2
- package/dist/modules/editor/hooks/useMediaLibraryEditor.js +4 -3
- package/dist/modules/editor/hooks/useTipTapEditor.js +4 -4
- package/dist/modules/icons/components/IconClockAlert.d.ts +7 -0
- package/dist/modules/icons/components/IconClockAlert.js +17 -0
- package/dist/modules/icons/components/IconSubmitToValidate.d.ts +7 -0
- package/dist/modules/icons/components/IconSubmitToValidate.js +12 -0
- package/dist/modules/icons/components/index.d.ts +2 -0
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js +5 -5
- package/dist/modules/modals/ResourceModal/ResourceModal.js +1 -2
- package/dist/modules/modals/ShareModal/ShareBookmark.d.ts +1 -1
- package/dist/modules/modals/ShareModal/ShareBookmark.js +6 -3
- package/dist/modules/modals/ShareModal/ShareBookmarkLine.js +4 -4
- package/dist/modules/modals/ShareModal/ShareModal.d.ts +1 -11
- package/dist/modules/modals/ShareModal/ShareModal.js +13 -105
- package/dist/modules/modals/ShareModal/ShareResources.d.ts +187 -0
- package/dist/modules/modals/ShareModal/ShareResources.js +148 -0
- package/dist/modules/modals/ShareModal/hooks/useSearch.d.ts +5 -3
- package/dist/modules/modals/ShareModal/hooks/useSearch.js +12 -16
- package/dist/modules/modals/ShareModal/hooks/useShare.d.ts +12 -5
- package/dist/modules/modals/ShareModal/hooks/useShare.js +20 -13
- package/dist/modules/modals/ShareModal/hooks/useShareBookmark.d.ts +1 -1
- package/dist/modules/modals/ShareModal/hooks/useShareBookmark.js +1 -1
- package/dist/modules/modals/ShareModal/index.d.ts +3 -1
- package/dist/modules/multimedia/Linker/ExternalLinker/ExternalLinker.js +1 -2
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +1 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +1 -1
- package/dist/modules/multimedia/MediaLibrary/index.d.ts +2 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +1 -1
- package/dist/modules/multimedia/index.d.ts +1 -0
- package/dist/multimedia.js +20 -14
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/defineProperty.js +18 -0
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/interopRequireDefault.js +13 -0
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/objectSpread2.js +31 -0
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/toPrimitive.js +20 -0
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/toPropertyKey.js +15 -0
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/typeof.js +16 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/de_DE.js +11 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/es_ES.js +11 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/fr_FR.js +11 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/it_IT.js +11 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/pt_PT.js +11 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/de_DE.js +22 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/es_ES.js +22 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/fr_FR.js +27 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/it_IT.js +20 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/pt_PT.js +45 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/de_DE.js +145 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/es_ES.js +145 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/fr_FR.js +144 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/it_IT.js +156 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/pt_PT.js +158 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/de_DE.js +10 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/es_ES.js +10 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/fr_FR.js +10 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/it_IT.js +10 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/pt_PT.js +10 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/de_DE.js +8 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/es_ES.js +8 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/fr_FR.js +8 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/it_IT.js +8 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/pt_PT.js +8 -0
- package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/localeData.js +82 -0
- package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/weekday.js +19 -0
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/de_DE.js +21 -0
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/es_ES.js +21 -0
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/fr_FR.js +21 -0
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/it_IT.js +21 -0
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/pt_PT.js +21 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/common.js +14 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/de_DE.js +37 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/es_ES.js +37 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/fr_FR.js +38 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/it_IT.js +37 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/pt_PT.js +39 -0
- package/dist/providers/AntThemeProvider/AntProvider.d.ts +2 -2
- package/dist/providers/AntThemeProvider/AntProvider.js +19 -2
- package/dist/providers/AntThemeProvider/antThemeConfig.js +1 -2
- package/dist/style.css +1 -1
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/mime-types/index.d.ts +1 -0
- package/dist/utilities/mime-types/mime-types-utils.d.ts +1 -0
- package/dist/utilities/mime-types/mime-types-utils.js +4 -0
- package/dist/utilities/react-query/index.d.ts +1 -0
- package/dist/utilities/react-query/react-query-utils.d.ts +21 -0
- package/dist/utilities/react-query/react-query-utils.js +13 -0
- package/package.json +8 -7
- package/dist/modules/comments/components/CommentHeader.d.ts +0 -3
- package/dist/modules/comments/components/CommentHeader.js +0 -8
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import
|
|
6
|
-
import SvgIconInfoCircle from "../../icons/components/IconInfoCircle.js";
|
|
7
|
-
import SvgIconRafterDown from "../../icons/components/IconRafterDown.js";
|
|
8
|
-
import { ShareBookmark } from "./ShareBookmark.js";
|
|
9
|
-
import { ShareBookmarkLine } from "./ShareBookmarkLine.js";
|
|
10
|
-
import { useSearch } from "./hooks/useSearch.js";
|
|
11
|
-
import useShare from "./hooks/useShare.js";
|
|
12
|
-
import { useShareBookmark } from "./hooks/useShareBookmark.js";
|
|
5
|
+
import ShareResources from "./ShareResources.js";
|
|
13
6
|
import Modal from "../../../components/Modal/Modal.js";
|
|
14
7
|
import Alert from "../../../components/Alert/Alert.js";
|
|
15
|
-
import Heading from "../../../components/Heading/Heading.js";
|
|
16
|
-
import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
|
|
17
|
-
import VisuallyHidden from "../../../components/VisuallyHidden/VisuallyHidden.js";
|
|
18
|
-
import Avatar from "../../../components/Avatar/Avatar.js";
|
|
19
|
-
import Checkbox from "../../../components/Checkbox/Checkbox.js";
|
|
20
8
|
import Button from "../../../components/Button/Button.js";
|
|
21
|
-
import Tooltip from "../../../components/Tooltip/Tooltip.js";
|
|
22
|
-
import Combobox from "../../../components/Combobox/Combobox.js";
|
|
23
9
|
function ShareResourceModal({
|
|
24
10
|
isOpen,
|
|
25
11
|
shareOptions,
|
|
@@ -28,104 +14,26 @@ function ShareResourceModal({
|
|
|
28
14
|
onSuccess,
|
|
29
15
|
onCancel
|
|
30
16
|
}) {
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = shareOptions, [isLoading, setIsLoading] = useState(!0), {
|
|
36
|
-
state: {
|
|
37
|
-
isSharing,
|
|
38
|
-
shareRights,
|
|
39
|
-
shareRightActions
|
|
40
|
-
},
|
|
41
|
-
dispatch: shareDispatch,
|
|
42
|
-
myAvatar,
|
|
43
|
-
currentIsAuthor,
|
|
44
|
-
handleShare,
|
|
45
|
-
toggleRight,
|
|
46
|
-
handleDeleteRow
|
|
47
|
-
} = useShare({
|
|
48
|
-
resourceId,
|
|
49
|
-
resourceCreatorId,
|
|
50
|
-
resourceRights,
|
|
51
|
-
shareResource,
|
|
52
|
-
setIsLoading,
|
|
53
|
-
onSuccess
|
|
54
|
-
}), {
|
|
55
|
-
state: {
|
|
56
|
-
searchResults,
|
|
57
|
-
searchInputValue
|
|
58
|
-
},
|
|
59
|
-
showSearchAdmlHint,
|
|
60
|
-
showSearchLoading,
|
|
61
|
-
showSearchNoResults,
|
|
62
|
-
getSearchMinLength,
|
|
63
|
-
handleSearchInputChange,
|
|
64
|
-
handleSearchResultsChange
|
|
65
|
-
} = useSearch({
|
|
66
|
-
resourceId,
|
|
67
|
-
resourceCreatorId,
|
|
68
|
-
shareRights,
|
|
69
|
-
shareDispatch
|
|
70
|
-
}), {
|
|
71
|
-
refBookmark,
|
|
72
|
-
showBookmark,
|
|
73
|
-
handleBookmarkChange,
|
|
74
|
-
toggleBookmark,
|
|
75
|
-
bookmark,
|
|
76
|
-
handleOnSave,
|
|
77
|
-
showBookmarkInput,
|
|
78
|
-
toggleBookmarkInput
|
|
79
|
-
} = useShareBookmark({
|
|
80
|
-
shareRights,
|
|
81
|
-
shareDispatch
|
|
82
|
-
}), {
|
|
17
|
+
const refShareResources = useRef(null), handleShare = () => {
|
|
18
|
+
var _a;
|
|
19
|
+
(_a = refShareResources.current) == null || _a.handleShare();
|
|
20
|
+
}, [isSaving, setIsSaving] = useState(!1), {
|
|
83
21
|
t
|
|
84
|
-
} = useTranslation(),
|
|
22
|
+
} = useTranslation(), onSaving = (isSaving2) => {
|
|
23
|
+
setIsSaving(isSaving2);
|
|
24
|
+
};
|
|
85
25
|
return /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { id: "share_modal", size: "lg", isOpen, onModalClose: onCancel, children: [
|
|
86
26
|
/* @__PURE__ */ jsx(Modal.Header, { onModalClose: onCancel, children: t("share.title") }),
|
|
87
27
|
/* @__PURE__ */ jsxs(Modal.Body, { children: [
|
|
88
28
|
/* @__PURE__ */ jsx(Alert, { type: "info", className: "mb-16", children: t("explorer.modal.share.alert.community") }),
|
|
89
|
-
/* @__PURE__ */ jsx(
|
|
90
|
-
/* @__PURE__ */ jsx("div", { className: "table-responsive", children: isLoading ? /* @__PURE__ */ jsx(LoadingScreen, {}) : /* @__PURE__ */ jsxs("table", { className: "table border align-middle mb-0", children: [
|
|
91
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-secondary", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
92
|
-
/* @__PURE__ */ jsx("th", { scope: "col", className: "w-32", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("explorer.modal.share.avatar.shared.alt") }) }),
|
|
93
|
-
/* @__PURE__ */ jsx("th", { scope: "col", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("explorer.modal.share.search.placeholder") }) }),
|
|
94
|
-
shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsx("th", { scope: "col", className: "text-center text-white", children: t(shareRightAction.displayName) }, shareRightAction.displayName)),
|
|
95
|
-
/* @__PURE__ */ jsx("th", { scope: "col", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("close") }) })
|
|
96
|
-
] }) }),
|
|
97
|
-
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
98
|
-
currentIsAuthor() && /* @__PURE__ */ jsxs("tr", { children: [
|
|
99
|
-
/* @__PURE__ */ jsx("th", { scope: "row", children: /* @__PURE__ */ jsx(Avatar, { alt: t("explorer.modal.share.avatar.me.alt"), size: "xs", src: myAvatar, variant: "circle" }) }),
|
|
100
|
-
/* @__PURE__ */ jsx("td", { children: t("share.me") }),
|
|
101
|
-
shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsx("td", { style: {
|
|
102
|
-
width: "80px"
|
|
103
|
-
}, className: "text-center text-white", children: /* @__PURE__ */ jsx(Checkbox, { checked: !0, disabled: !0 }) }, shareRightAction.displayName)),
|
|
104
|
-
/* @__PURE__ */ jsx("td", {})
|
|
105
|
-
] }),
|
|
106
|
-
/* @__PURE__ */ jsx(ShareBookmarkLine, { showBookmark, shareRightActions, shareRights, onDeleteRow: handleDeleteRow, toggleRight, toggleBookmark })
|
|
107
|
-
] })
|
|
108
|
-
] }) }),
|
|
109
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-16", children: [
|
|
110
|
-
/* @__PURE__ */ jsx(Button, { color: "tertiary", leftIcon: /* @__PURE__ */ jsx(SvgIconBookmark, {}), rightIcon: /* @__PURE__ */ jsx(SvgIconRafterDown, { title: t("show"), className: "w-16 min-w-0", style: {
|
|
111
|
-
transition: "rotate 0.2s ease-out",
|
|
112
|
-
rotate: showBookmarkInput ? "-180deg" : "0deg"
|
|
113
|
-
} }), type: "button", variant: "ghost", className: "fw-normal", onClick: () => toggleBookmarkInput(!showBookmarkInput), children: t("share.save.sharebookmark") }),
|
|
114
|
-
showBookmarkInput && /* @__PURE__ */ jsx(ShareBookmark, { refBookmark, bookmark, onBookmarkChange: handleBookmarkChange, onSave: handleOnSave })
|
|
115
|
-
] }),
|
|
116
|
-
/* @__PURE__ */ jsx("hr", {}),
|
|
117
|
-
/* @__PURE__ */ jsxs(Heading, { headingStyle: "h4", level: "h3", className: "mb-16 d-flex align-items-center", children: [
|
|
118
|
-
/* @__PURE__ */ jsx("div", { className: "me-8", children: t("explorer.modal.share.search") }),
|
|
119
|
-
/* @__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(SvgIconInfoCircle, { className: "c-pointer", height: "18" }) })
|
|
120
|
-
] }),
|
|
121
|
-
/* @__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 }) }) }),
|
|
29
|
+
/* @__PURE__ */ jsx(ShareResources, { shareOptions, shareResource, ref: refShareResources, onSuccess, onSubmit: onSaving, classNameSearchInput: "flex-fill" }),
|
|
122
30
|
children
|
|
123
31
|
] }),
|
|
124
32
|
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
125
|
-
/* @__PURE__ */ jsx(Button, { type: "button", color: "tertiary", variant: "ghost", onClick: onCancel, children: t("explorer.cancel") }),
|
|
126
|
-
/* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", isLoading:
|
|
33
|
+
/* @__PURE__ */ jsx(Button, { type: "button", color: "tertiary", variant: "ghost", onClick: onCancel, disabled: isSaving, children: t("explorer.cancel") }),
|
|
34
|
+
/* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", isLoading: isSaving, onClick: handleShare, disabled: isSaving, children: t("share") })
|
|
127
35
|
] })
|
|
128
|
-
] }), document.getElementById("portal"));
|
|
36
|
+
] }), document.getElementById("portal") || document.body);
|
|
129
37
|
}
|
|
130
38
|
export {
|
|
131
39
|
ShareResourceModal as default
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { ID, PutShareResponse, RightStringified, ShareRight, ShareRightAction, ShareRightActionDisplayName, ShareUrls } from '@edifice.io/client';
|
|
2
|
+
import { UseMutationResult } from '../../../node_modules/@tanstack/react-query';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for sharing a resource
|
|
5
|
+
*
|
|
6
|
+
* @typedef {Object} ShareOptions
|
|
7
|
+
* @property {ID} resourceId - Unique identifier of the resource to share
|
|
8
|
+
* @property {RightStringified[]} resourceRights - Current rights assigned to the resource
|
|
9
|
+
* @property {string} resourceCreatorId - User ID of the resource creator
|
|
10
|
+
* @property {ShareRightActionDisplayName[]} [filteredActions] - Optional list of allowed actions to display
|
|
11
|
+
* @property {ShareUrls} [shareUrls] - Optional custom URLs for API endpoints related to sharing operations default endpoints are used if not provided
|
|
12
|
+
* default: {
|
|
13
|
+
* getResourceRights: `/${app}/share/json/${resourceId}?search=`,
|
|
14
|
+
* saveResourceRights: `/${app}/share/resource/${resourceId}`,
|
|
15
|
+
* getShareMapping: `/${app}/rights/sharing`
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* @example Example related to sharing thread resources:
|
|
19
|
+
* ```ts
|
|
20
|
+
* const shareOptions: ShareOptions = {
|
|
21
|
+
* resourceId: '12345',
|
|
22
|
+
* resourceRights: [],
|
|
23
|
+
* resourceCreatorId: 'user-67890',
|
|
24
|
+
* filteredActions: ['read', 'contrib'],
|
|
25
|
+
* defaultActions: [
|
|
26
|
+
* {
|
|
27
|
+
* id: 'read',
|
|
28
|
+
* displayName: 'read',
|
|
29
|
+
* },
|
|
30
|
+
* ],
|
|
31
|
+
* shareUrls: {
|
|
32
|
+
* getResourceRights: '/api/V1/thread/shares', (get endpoint)
|
|
33
|
+
* saveResourceRights: '/api/V1/thread/shares', (put endpoint)
|
|
34
|
+
* getShareMapping: '/api/V1/rights/sharing'
|
|
35
|
+
* }
|
|
36
|
+
* };
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example Example related to sharing info resources:
|
|
40
|
+
* ```ts
|
|
41
|
+
* const shareOptions: ShareOptions = {
|
|
42
|
+
* resourceId: '12345',
|
|
43
|
+
* resourceRights: [],
|
|
44
|
+
* resourceCreatorId: 'user-67890',
|
|
45
|
+
* filteredActions: ['read', 'contrib'],
|
|
46
|
+
* defaultActions: [
|
|
47
|
+
* {
|
|
48
|
+
* id: 'read',
|
|
49
|
+
* displayName: 'read',
|
|
50
|
+
* },
|
|
51
|
+
* ],
|
|
52
|
+
* shareUrls: {
|
|
53
|
+
* getResourceRights: '/api/V1/info/shares', (get endpoint)
|
|
54
|
+
* saveResourceRights: '/api/V1/info/shares', (put endpoint)
|
|
55
|
+
* getShareMapping: '/api/V1/rights/sharing'
|
|
56
|
+
* }
|
|
57
|
+
* };
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export type ShareOptions = {
|
|
61
|
+
resourceId: ID;
|
|
62
|
+
resourceRights: RightStringified[];
|
|
63
|
+
resourceCreatorId: string;
|
|
64
|
+
filteredActions?: ShareRightActionDisplayName[];
|
|
65
|
+
shareUrls?: ShareUrls;
|
|
66
|
+
defaultActions?: ShareRightAction[];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* React Query mutation result for share operations
|
|
70
|
+
*
|
|
71
|
+
* @typedef {UseMutationResult<PutShareResponse, unknown, {resourceId: string; rights: ShareRight[]}, unknown>} ShareResourceMutation
|
|
72
|
+
*/
|
|
73
|
+
export type ShareResourceMutation = UseMutationResult<PutShareResponse, unknown, {
|
|
74
|
+
resourceId: string;
|
|
75
|
+
rights: ShareRight[];
|
|
76
|
+
}, unknown>;
|
|
77
|
+
/**
|
|
78
|
+
* Props for the ShareResources component
|
|
79
|
+
*
|
|
80
|
+
* @interface ShareResourceProps
|
|
81
|
+
* @property {ShareOptions} shareOptions - Configuration for the resource being shared
|
|
82
|
+
* @property {ShareResourceMutation} [shareResource] - Optional React Query mutation for optimistic UI updates
|
|
83
|
+
* @property {() => void} [onSuccess] - Callback fired after successful share operation
|
|
84
|
+
* @property {(shareRights: ShareRight[], isDirty: boolean) => void} [onChange] - Callback fired when share rights change
|
|
85
|
+
* @property {(isSubmitting: boolean) => void} [onSubmit] - Callback fired when share operation is submitting
|
|
86
|
+
* @property {string} [classNameSearchInput] - Optional CSS class for the search input wrapper (default: 'col-6')
|
|
87
|
+
*/
|
|
88
|
+
interface ShareResourceProps {
|
|
89
|
+
/**
|
|
90
|
+
* Expect resourceId,
|
|
91
|
+
* new rights array (replace shared array),
|
|
92
|
+
* creatorId
|
|
93
|
+
* of a resource */
|
|
94
|
+
shareOptions: ShareOptions;
|
|
95
|
+
/**
|
|
96
|
+
* Use the `shareResource` props when you need to do Optimistic UI
|
|
97
|
+
* otherwise ShareModal handles everything
|
|
98
|
+
* Must use React Query */
|
|
99
|
+
shareResource?: ShareResourceMutation;
|
|
100
|
+
/**
|
|
101
|
+
* onSuccess callback when a resource is successfully shared
|
|
102
|
+
*/
|
|
103
|
+
onSuccess?: () => void;
|
|
104
|
+
/**
|
|
105
|
+
* Callback when share rights change
|
|
106
|
+
*/
|
|
107
|
+
onChange?: (shareRights: ShareRight[], isDirty: boolean) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Callback when ShareResources component is submitting share rights or bookmark changes
|
|
110
|
+
*/
|
|
111
|
+
onSubmit?: (isSubmitting: boolean) => void;
|
|
112
|
+
/**
|
|
113
|
+
* Optional className for the search input wrapper (default: 'col-6')
|
|
114
|
+
*/
|
|
115
|
+
classNameSearchInput?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Ref interface exposed by ShareResources component
|
|
119
|
+
*
|
|
120
|
+
* @interface ShareResourcesRef
|
|
121
|
+
* @property {() => void} handleShare - Method to trigger the share operation
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```tsx
|
|
125
|
+
* const ref = useRef<ShareResourcesRef>(null);
|
|
126
|
+
*
|
|
127
|
+
* // Trigger share programmatically
|
|
128
|
+
* ref.current?.handleShare();
|
|
129
|
+
*
|
|
130
|
+
* // Check sharing status
|
|
131
|
+
* const sharing = ref.current?.isSharing();
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
export interface ShareResourcesRef {
|
|
135
|
+
handleShare: (notify?: boolean) => void;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* ShareResources Component
|
|
139
|
+
*
|
|
140
|
+
* A component for managing resource sharing permissions with users and groups.
|
|
141
|
+
* Provides search functionality, bookmark management, and granular rights control.
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```tsx
|
|
145
|
+
* import { useRef } from 'react';
|
|
146
|
+
* import ShareResources, { ShareResourcesRef, ShareOptions } from './ShareResources';
|
|
147
|
+
*
|
|
148
|
+
* function MyComponent() {
|
|
149
|
+
* const shareRef = useRef<ShareResourcesRef>(null);
|
|
150
|
+
*
|
|
151
|
+
* const shareOptions: ShareOptions = {
|
|
152
|
+
* resourceId: '123',
|
|
153
|
+
* resourceRights: [],
|
|
154
|
+
* resourceCreatorId: 'user-456',
|
|
155
|
+
* filteredActions: ['read', 'contrib'],
|
|
156
|
+
* urls: {
|
|
157
|
+
* getResourceRights: '/api/share/rights',
|
|
158
|
+
* putResourceRights: '/api/share/update'
|
|
159
|
+
* }
|
|
160
|
+
* };
|
|
161
|
+
*
|
|
162
|
+
* const handleSave = () => {
|
|
163
|
+
* if (shareRef.current) {
|
|
164
|
+
* shareRef.current.handleShare();
|
|
165
|
+
* }
|
|
166
|
+
* };
|
|
167
|
+
*
|
|
168
|
+
* return (
|
|
169
|
+
* <>
|
|
170
|
+
* <ShareResources
|
|
171
|
+
* ref={shareRef}
|
|
172
|
+
* shareOptions={shareOptions}
|
|
173
|
+
* onSuccess={() => console.log('Shared successfully')}
|
|
174
|
+
* onChange={(rights, isDirty) => console.log('Rights changed:', isDirty)}
|
|
175
|
+
* onSubmit={(isSubmitting) => console.log('Submitting share...', isSubmitting)}
|
|
176
|
+
* />
|
|
177
|
+
* <button onClick={handleSave}>Save Changes</button>
|
|
178
|
+
* </>
|
|
179
|
+
* );
|
|
180
|
+
* }
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* @component
|
|
184
|
+
* @forwardRef
|
|
185
|
+
*/
|
|
186
|
+
declare const ShareResources: import('react').ForwardRefExoticComponent<ShareResourceProps & import('react').RefAttributes<ShareResourcesRef>>;
|
|
187
|
+
export default ShareResources;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useImperativeHandle, useEffect } from "react";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import SvgIconBookmark from "../../icons/components/IconBookmark.js";
|
|
5
|
+
import SvgIconInfoCircle from "../../icons/components/IconInfoCircle.js";
|
|
6
|
+
import SvgIconRafterDown from "../../icons/components/IconRafterDown.js";
|
|
7
|
+
import { ShareBookmark } from "./ShareBookmark.js";
|
|
8
|
+
import { ShareBookmarkLine } from "./ShareBookmarkLine.js";
|
|
9
|
+
import { useSearch } from "./hooks/useSearch.js";
|
|
10
|
+
import useShare from "./hooks/useShare.js";
|
|
11
|
+
import { useShareBookmark } from "./hooks/useShareBookmark.js";
|
|
12
|
+
import useDirectory from "../../../hooks/useDirectory/useDirectory.js";
|
|
13
|
+
import Heading from "../../../components/Heading/Heading.js";
|
|
14
|
+
import Tooltip from "../../../components/Tooltip/Tooltip.js";
|
|
15
|
+
import Combobox from "../../../components/Combobox/Combobox.js";
|
|
16
|
+
import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
|
|
17
|
+
import VisuallyHidden from "../../../components/VisuallyHidden/VisuallyHidden.js";
|
|
18
|
+
import Avatar from "../../../components/Avatar/Avatar.js";
|
|
19
|
+
import Checkbox from "../../../components/Checkbox/Checkbox.js";
|
|
20
|
+
import Button from "../../../components/Button/Button.js";
|
|
21
|
+
const ShareResources = /* @__PURE__ */ forwardRef(({
|
|
22
|
+
shareOptions,
|
|
23
|
+
shareResource,
|
|
24
|
+
onSuccess = () => {
|
|
25
|
+
},
|
|
26
|
+
onChange = () => {
|
|
27
|
+
},
|
|
28
|
+
onSubmit = () => {
|
|
29
|
+
},
|
|
30
|
+
classNameSearchInput = "col-6"
|
|
31
|
+
}, ref) => {
|
|
32
|
+
const {
|
|
33
|
+
resourceId,
|
|
34
|
+
resourceCreatorId,
|
|
35
|
+
resourceRights,
|
|
36
|
+
filteredActions,
|
|
37
|
+
shareUrls,
|
|
38
|
+
defaultActions = [{
|
|
39
|
+
id: "read",
|
|
40
|
+
displayName: "read"
|
|
41
|
+
}, {
|
|
42
|
+
id: "comment",
|
|
43
|
+
displayName: "comment"
|
|
44
|
+
}]
|
|
45
|
+
} = shareOptions, [isLoading, setIsLoading] = useState(!0), [isSavingBookmark, setIsSavingBookmark] = useState(!1), {
|
|
46
|
+
state: {
|
|
47
|
+
isSharing,
|
|
48
|
+
shareRights,
|
|
49
|
+
shareRightActions
|
|
50
|
+
},
|
|
51
|
+
dispatch: shareDispatch,
|
|
52
|
+
myAvatar,
|
|
53
|
+
currentIsAuthor,
|
|
54
|
+
toggleRight,
|
|
55
|
+
handleShare,
|
|
56
|
+
handleDeleteRow,
|
|
57
|
+
isDirty
|
|
58
|
+
} = useShare({
|
|
59
|
+
resourceId,
|
|
60
|
+
resourceCreatorId,
|
|
61
|
+
resourceRights,
|
|
62
|
+
shareResource,
|
|
63
|
+
setIsLoading,
|
|
64
|
+
onSuccess,
|
|
65
|
+
filteredActions,
|
|
66
|
+
shareUrls
|
|
67
|
+
}), {
|
|
68
|
+
state: {
|
|
69
|
+
searchResults,
|
|
70
|
+
searchInputValue
|
|
71
|
+
},
|
|
72
|
+
showSearchAdmlHint,
|
|
73
|
+
showSearchLoading,
|
|
74
|
+
showSearchNoResults,
|
|
75
|
+
getSearchMinLength,
|
|
76
|
+
handleSearchInputChange,
|
|
77
|
+
handleSearchResultsChange
|
|
78
|
+
} = useSearch({
|
|
79
|
+
resourceId,
|
|
80
|
+
resourceCreatorId,
|
|
81
|
+
shareRights,
|
|
82
|
+
shareDispatch,
|
|
83
|
+
urlResourceRights: shareUrls == null ? void 0 : shareUrls.getResourceRights,
|
|
84
|
+
defaultActions
|
|
85
|
+
}), {
|
|
86
|
+
refBookmark,
|
|
87
|
+
showBookmark,
|
|
88
|
+
handleBookmarkChange,
|
|
89
|
+
toggleBookmark,
|
|
90
|
+
bookmark,
|
|
91
|
+
handleOnSave,
|
|
92
|
+
showBookmarkInput,
|
|
93
|
+
toggleBookmarkInput
|
|
94
|
+
} = useShareBookmark({
|
|
95
|
+
shareRights,
|
|
96
|
+
shareDispatch
|
|
97
|
+
}), handleOnSaveBookmark = () => (setIsSavingBookmark(!0), handleOnSave().then(() => {
|
|
98
|
+
setIsSavingBookmark(!1);
|
|
99
|
+
})), {
|
|
100
|
+
getAvatarURL
|
|
101
|
+
} = useDirectory();
|
|
102
|
+
useImperativeHandle(ref, () => ({
|
|
103
|
+
handleShare
|
|
104
|
+
}), [handleShare]), useEffect(() => {
|
|
105
|
+
onChange(shareRights.rights, isDirty);
|
|
106
|
+
}, [isDirty, shareRights.rights, onChange]), useEffect(() => {
|
|
107
|
+
onSubmit(isSavingBookmark || isSharing);
|
|
108
|
+
}, [isSavingBookmark, isSharing, onSubmit]);
|
|
109
|
+
const {
|
|
110
|
+
t
|
|
111
|
+
} = useTranslation(), userIsAuthor = currentIsAuthor(), searchPlaceholder = showSearchAdmlHint() ? t("explorer.search.adml.hint") : t("explorer.modal.share.search.placeholder");
|
|
112
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
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(SvgIconInfoCircle, { className: "c-pointer", height: "18" }) })
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsx("div", { className: "row mb-16", children: /* @__PURE__ */ jsx("div", { className: classNameSearchInput, children: /* @__PURE__ */ jsx(Combobox, { value: searchInputValue, placeholder: searchPlaceholder, isLoading: showSearchLoading(), noResult: showSearchNoResults(), options: searchResults, searchMinLength: getSearchMinLength(), onSearchInputChange: handleSearchInputChange, onSearchResultsChange: handleSearchResultsChange }) }) }),
|
|
118
|
+
/* @__PURE__ */ jsx("div", { className: "table-responsive", children: isLoading ? /* @__PURE__ */ jsx(LoadingScreen, {}) : /* @__PURE__ */ jsxs("table", { className: "table border align-middle mb-0 rounded-3", children: [
|
|
119
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-blue-200", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
120
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: "w-32", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("explorer.modal.share.avatar.shared.alt") }) }),
|
|
121
|
+
/* @__PURE__ */ jsx("th", { scope: "col", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("explorer.modal.share.search.placeholder") }) }),
|
|
122
|
+
shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsx("th", { scope: "col", className: "text-center text-gray-800", children: t(shareRightAction.displayName) }, shareRightAction.displayName)),
|
|
123
|
+
/* @__PURE__ */ jsx("th", { scope: "col", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("close") }) })
|
|
124
|
+
] }) }),
|
|
125
|
+
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
126
|
+
/* @__PURE__ */ jsxs("tr", { children: [
|
|
127
|
+
/* @__PURE__ */ jsx("th", { scope: "row", children: /* @__PURE__ */ jsx(Avatar, { alt: t("explorer.modal.share.avatar.me.alt"), size: "xs", src: userIsAuthor ? myAvatar : getAvatarURL(resourceCreatorId, "user"), variant: "circle" }) }),
|
|
128
|
+
/* @__PURE__ */ jsx("td", { children: t(userIsAuthor ? "share.me" : "share.author") }),
|
|
129
|
+
shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsx("td", { style: {
|
|
130
|
+
width: "80px"
|
|
131
|
+
}, className: "text-center text-white", children: /* @__PURE__ */ jsx(Checkbox, { checked: !0, disabled: !0 }) }, shareRightAction.displayName)),
|
|
132
|
+
/* @__PURE__ */ jsx("td", {})
|
|
133
|
+
] }),
|
|
134
|
+
/* @__PURE__ */ jsx(ShareBookmarkLine, { showBookmark, shareRightActions, shareRights, onDeleteRow: handleDeleteRow, toggleRight, toggleBookmark })
|
|
135
|
+
] })
|
|
136
|
+
] }) }),
|
|
137
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-16", children: [
|
|
138
|
+
/* @__PURE__ */ jsx(Button, { "data-testid": "share-bookmark-show-button", color: "tertiary", leftIcon: /* @__PURE__ */ jsx(SvgIconBookmark, {}), rightIcon: /* @__PURE__ */ jsx(SvgIconRafterDown, { title: t("show"), className: "w-16 min-w-0", style: {
|
|
139
|
+
transition: "rotate 0.2s ease-out",
|
|
140
|
+
rotate: showBookmarkInput ? "-180deg" : "0deg"
|
|
141
|
+
} }), type: "button", variant: "ghost", className: "fw-normal", onClick: () => toggleBookmarkInput(!showBookmarkInput), children: t("share.save.sharebookmark") }),
|
|
142
|
+
showBookmarkInput && /* @__PURE__ */ jsx(ShareBookmark, { refBookmark, bookmark, onBookmarkChange: handleBookmarkChange, onSave: handleOnSaveBookmark })
|
|
143
|
+
] })
|
|
144
|
+
] });
|
|
145
|
+
});
|
|
146
|
+
export {
|
|
147
|
+
ShareResources as default
|
|
148
|
+
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { ChangeEvent, Dispatch } from 'react';
|
|
2
|
-
import { ShareRightWithVisibles, ShareSubject } from '@edifice.io/client';
|
|
2
|
+
import { ShareRightAction, ShareRightWithVisibles, ShareSubject } from '@edifice.io/client';
|
|
3
3
|
import { OptionListItemType } from '../../../../components';
|
|
4
|
-
import { ShareOptions } from '../
|
|
4
|
+
import { ShareOptions } from '../ShareResources';
|
|
5
5
|
import { ShareAction } from './useShare';
|
|
6
|
-
export declare const useSearch: ({ resourceId, resourceCreatorId, shareRights, shareDispatch, }: {
|
|
6
|
+
export declare const useSearch: ({ resourceId, resourceCreatorId, shareRights, shareDispatch, urlResourceRights, defaultActions, }: {
|
|
7
7
|
resourceId: ShareOptions["resourceCreatorId"];
|
|
8
8
|
resourceCreatorId: ShareOptions["resourceCreatorId"];
|
|
9
9
|
shareRights: ShareRightWithVisibles;
|
|
10
10
|
shareDispatch: Dispatch<ShareAction>;
|
|
11
|
+
urlResourceRights?: string;
|
|
12
|
+
defaultActions?: ShareRightAction[];
|
|
11
13
|
}) => {
|
|
12
14
|
state: {
|
|
13
15
|
searchInputValue: string;
|
|
@@ -48,17 +48,19 @@ function reducer(state, action) {
|
|
|
48
48
|
throw new Error("Unhandled action type");
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
const
|
|
52
|
-
id: "read",
|
|
53
|
-
displayName: "read"
|
|
54
|
-
}, {
|
|
55
|
-
id: "comment",
|
|
56
|
-
displayName: "comment"
|
|
57
|
-
}], useSearch = ({
|
|
51
|
+
const useSearch = ({
|
|
58
52
|
resourceId,
|
|
59
53
|
resourceCreatorId,
|
|
60
54
|
shareRights,
|
|
61
|
-
shareDispatch
|
|
55
|
+
shareDispatch,
|
|
56
|
+
urlResourceRights,
|
|
57
|
+
defaultActions = [{
|
|
58
|
+
id: "read",
|
|
59
|
+
displayName: "read"
|
|
60
|
+
}, {
|
|
61
|
+
id: "comment",
|
|
62
|
+
displayName: "comment"
|
|
63
|
+
}]
|
|
62
64
|
}) => {
|
|
63
65
|
const [state, dispatch] = useReducer(reducer, initialState), debouncedSearchInputValue = useDebounce(state.searchInputValue, 500), {
|
|
64
66
|
isAdml
|
|
@@ -82,7 +84,7 @@ const defaultActions = [{
|
|
|
82
84
|
type: "isSearching",
|
|
83
85
|
payload: !0
|
|
84
86
|
}), !isAdml && debouncedSearchInputValue2.length >= 1 || isAdml && debouncedSearchInputValue2.length >= 3) {
|
|
85
|
-
const resSearchShareSubjects = await odeServices.share().searchShareSubjects(appCode, resourceId, debouncedSearchInputValue2);
|
|
87
|
+
const resSearchShareSubjects = await odeServices.share().searchShareSubjects(appCode, resourceId, debouncedSearchInputValue2, urlResourceRights);
|
|
86
88
|
dispatch({
|
|
87
89
|
type: "addApiResult",
|
|
88
90
|
payload: resSearchShareSubjects
|
|
@@ -151,13 +153,7 @@ const defaultActions = [{
|
|
|
151
153
|
} else
|
|
152
154
|
rightsToAdd = [{
|
|
153
155
|
...shareSubject,
|
|
154
|
-
actions:
|
|
155
|
-
id: "read",
|
|
156
|
-
displayName: "read"
|
|
157
|
-
}, {
|
|
158
|
-
id: "comment",
|
|
159
|
-
displayName: "comment"
|
|
160
|
-
}]
|
|
156
|
+
actions: defaultActions
|
|
161
157
|
}];
|
|
162
158
|
shareDispatch({
|
|
163
159
|
type: "updateShareRights",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ShareRight, ShareRightAction, ShareRightActionDisplayName, ShareRightWithVisibles } from '@edifice.io/client';
|
|
2
|
-
import { ShareOptions, ShareResourceMutation } from '../
|
|
1
|
+
import { ShareRight, ShareRightAction, ShareRightActionDisplayName, ShareRightWithVisibles, ShareUrls } from '@edifice.io/client';
|
|
2
|
+
import { ShareOptions, ShareResourceMutation } from '../ShareResources';
|
|
3
3
|
interface UseShareResourceModalProps {
|
|
4
4
|
/**
|
|
5
5
|
* Resource ID (assetId)
|
|
@@ -15,10 +15,15 @@ interface UseShareResourceModalProps {
|
|
|
15
15
|
resourceCreatorId: ShareOptions['resourceCreatorId'];
|
|
16
16
|
shareResource?: ShareResourceMutation;
|
|
17
17
|
onSuccess: () => void;
|
|
18
|
-
setIsLoading
|
|
18
|
+
setIsLoading?: (value: boolean) => void;
|
|
19
|
+
resourceShareRights?: ShareRightWithVisibles;
|
|
20
|
+
resourceShareRightActions?: ShareRightAction[];
|
|
21
|
+
filteredActions?: ShareRightActionDisplayName[];
|
|
22
|
+
shareUrls?: ShareUrls;
|
|
19
23
|
}
|
|
20
24
|
type State = {
|
|
21
25
|
isSharing: boolean;
|
|
26
|
+
isDirty?: boolean;
|
|
22
27
|
shareRights: ShareRightWithVisibles;
|
|
23
28
|
shareRightActions: ShareRightAction[];
|
|
24
29
|
};
|
|
@@ -38,9 +43,10 @@ export type ShareAction = {
|
|
|
38
43
|
type: 'isSharing';
|
|
39
44
|
payload: boolean;
|
|
40
45
|
};
|
|
41
|
-
export default function useShare({ resourceId, resourceRights, resourceCreatorId, shareResource, setIsLoading, onSuccess, }: UseShareResourceModalProps): {
|
|
46
|
+
export default function useShare({ resourceId, resourceRights, resourceCreatorId, shareResource, setIsLoading, onSuccess, filteredActions, shareUrls, }: UseShareResourceModalProps): {
|
|
42
47
|
state: {
|
|
43
48
|
isSharing: boolean;
|
|
49
|
+
isDirty?: boolean;
|
|
44
50
|
shareRights: ShareRightWithVisibles;
|
|
45
51
|
shareRightActions: ShareRightAction[];
|
|
46
52
|
};
|
|
@@ -48,7 +54,8 @@ export default function useShare({ resourceId, resourceRights, resourceCreatorId
|
|
|
48
54
|
currentIsAuthor: () => boolean;
|
|
49
55
|
myAvatar: string;
|
|
50
56
|
handleDeleteRow: (shareRight: ShareRight) => void;
|
|
51
|
-
handleShare: () => Promise<void>;
|
|
57
|
+
handleShare: (notify?: boolean) => Promise<void>;
|
|
52
58
|
toggleRight: (shareRight: ShareRight, actionName: ShareRightActionDisplayName) => void;
|
|
59
|
+
isDirty: boolean;
|
|
53
60
|
};
|
|
54
61
|
export {};
|