@edifice.io/react 2.5.5 → 2.5.6-develop.20260116103750
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.js +35 -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/Flex/Flex.js +1 -1
- package/dist/components/Layout/components/Header.js +6 -1
- package/dist/components/Menu/components/MenuButton.d.ts +2 -0
- package/dist/components/Menu/components/MenuButton.js +13 -4
- 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/index.d.ts +3 -0
- package/dist/editor.js +40 -36
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useDropzone/useDropzone.d.ts +2 -2
- package/dist/hooks/useDropzone/useDropzone.js +20 -5
- 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 +188 -170
- package/dist/modals.js +8 -6
- package/dist/modules/comments/components/Comment.js +4 -2
- package/dist/modules/comments/components/CommentList.js +1 -1
- package/dist/modules/comments/components/DeleteModal.js +14 -8
- 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/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/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 +145 -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/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 +14 -8
- 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/style.css +1 -1
- package/dist/utilities/index.d.ts +1 -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
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { getThumbnail } from "@edifice.io/utilities";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
import Image from "../../../../components/Image/Image.js";
|
|
7
|
+
const EditorPreview = ({
|
|
8
|
+
content,
|
|
9
|
+
variant = "outline",
|
|
10
|
+
onDetailClick,
|
|
11
|
+
onMediaClick,
|
|
12
|
+
maxMediaDisplayed = 3
|
|
13
|
+
}) => {
|
|
14
|
+
const {
|
|
15
|
+
t
|
|
16
|
+
} = useTranslation(), [summaryContent, setSummaryContent] = useState(""), [medias, setMedias] = useState([]), borderClass = clsx(variant === "outline" && "border rounded-3 py-12 px-16"), hasMediaCallback = onDetailClick || onMediaClick, handleMediaClick = (e) => {
|
|
17
|
+
onMediaClick && (e.stopPropagation(), onMediaClick());
|
|
18
|
+
};
|
|
19
|
+
return useEffect(() => {
|
|
20
|
+
const contentHTML = content;
|
|
21
|
+
if (contentHTML) {
|
|
22
|
+
const doc = new DOMParser().parseFromString(contentHTML, "text/html"), mediaElements = Array.from(doc.querySelectorAll("img, video, iframe, audio, embed"));
|
|
23
|
+
setMedias(mediaElements.filter((el) => el.tagName.toLowerCase() === "img").map((el) => {
|
|
24
|
+
const image = el;
|
|
25
|
+
return image.src ? {
|
|
26
|
+
url: getThumbnail(image.src, 0, 300),
|
|
27
|
+
alt: image.alt
|
|
28
|
+
} : {
|
|
29
|
+
url: "",
|
|
30
|
+
alt: ""
|
|
31
|
+
};
|
|
32
|
+
})), mediaElements.forEach((el) => {
|
|
33
|
+
var _a;
|
|
34
|
+
return (_a = el.parentNode) == null ? void 0 : _a.removeChild(el);
|
|
35
|
+
}), setSummaryContent(doc.body.textContent || "");
|
|
36
|
+
}
|
|
37
|
+
}, [content]), /* @__PURE__ */ jsxs("div", { className: borderClass, "data-testid": "editor-preview", onClick: onDetailClick, tabIndex: onDetailClick ? -1 : void 0, role: onDetailClick ? "button" : void 0, children: [
|
|
38
|
+
/* @__PURE__ */ jsx("div", { className: "flex-fill text-truncate text-truncate-2 post-preview-content overflow-hidden", style: {
|
|
39
|
+
overflowWrap: "anywhere"
|
|
40
|
+
}, children: summaryContent }),
|
|
41
|
+
/* @__PURE__ */ jsx("div", { onClick: handleMediaClick, tabIndex: hasMediaCallback ? -1 : void 0, role: hasMediaCallback ? "button" : void 0, className: "d-flex align-items-center justify-content-center gap-24 px-32 pt-16", children: medias.slice(0, maxMediaDisplayed).map((media, index) => /* @__PURE__ */ jsxs("div", { className: clsx("position-relative col-12 col-md-4 ", {
|
|
42
|
+
"d-none d-md-block": index >= 1
|
|
43
|
+
}), children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Image, { alt: media.alt, objectFit: "cover", ratio: "16", className: "rounded", loading: "lazy", src: media.url, sizes: "" }),
|
|
45
|
+
(index === 0 || index === 2) && medias.length - (index + 1) > 0 && /* @__PURE__ */ jsx("div", { className: clsx("position-absolute top-0 bottom-0 start-0 end-0 d-flex justify-content-center align-items-center rounded text-light bg-dark bg-opacity-50", {
|
|
46
|
+
"d-flex d-md-none": index === 0,
|
|
47
|
+
"d-none d-md-flex": index === 2
|
|
48
|
+
}), children: t("editor.preview.moreMedia", {
|
|
49
|
+
mediaCount: medias.length - (index + 1)
|
|
50
|
+
}) })
|
|
51
|
+
] }, media.url)) })
|
|
52
|
+
] });
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
EditorPreview as default
|
|
56
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor component properties
|
|
3
|
+
*/
|
|
4
|
+
export interface EditorPreviewSkeletonProps {
|
|
5
|
+
variant?: 'outline' | 'ghost';
|
|
6
|
+
}
|
|
7
|
+
declare const EditorPreview: ({ variant }: EditorPreviewSkeletonProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default EditorPreview;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import TextSkeleton from "../../../../components/Skeleton/TextSkeleton.js";
|
|
4
|
+
import Image from "../../../../components/Image/Image.js";
|
|
5
|
+
const EditorPreview = ({
|
|
6
|
+
variant = "outline"
|
|
7
|
+
}) => {
|
|
8
|
+
const borderClass = clsx(variant === "outline" && "border rounded-3"), contentClass = clsx("mt-16", variant === "outline" && "my-12 mx-16");
|
|
9
|
+
return /* @__PURE__ */ jsx("div", { className: borderClass, "data-testid": "editor-preview", children: /* @__PURE__ */ jsxs("div", { className: contentClass, children: [
|
|
10
|
+
/* @__PURE__ */ jsx(TextSkeleton, { className: "col-12" }),
|
|
11
|
+
/* @__PURE__ */ jsx(TextSkeleton, { className: "col-12" }),
|
|
12
|
+
/* @__PURE__ */ jsxs("div", { className: "d-flex justify-content-center gap-24 px-32 pt-16", children: [
|
|
13
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
14
|
+
maxWidth: "150px"
|
|
15
|
+
}, className: "col-12 col-md-4", children: /* @__PURE__ */ jsx(Image, { alt: "", objectFit: "cover", ratio: "16", className: "rounded placeholder", src: "", sizes: "" }) }),
|
|
16
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
17
|
+
maxWidth: "150px"
|
|
18
|
+
}, className: "col-12 col-md-4", children: /* @__PURE__ */ jsx(Image, { alt: "", objectFit: "cover", ratio: "16", className: "rounded placeholder", src: "", sizes: "" }) })
|
|
19
|
+
] })
|
|
20
|
+
] }) });
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
EditorPreview as default
|
|
24
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export * from './Editor';
|
|
2
2
|
export { default as Editor } from './Editor';
|
|
3
|
+
export { default as EditorPreview } from './EditorPreview';
|
|
4
|
+
export { default as EditorPreviewSkeleton } from './EditorPreviewSkeleton';
|
|
3
5
|
export { default as EditorSkeleton } from './EditorSkeleton';
|
|
@@ -31,8 +31,8 @@ const AttachmentRenderer = (props) => {
|
|
|
31
31
|
}, "data-drag-handle": !0, children: [
|
|
32
32
|
/* @__PURE__ */ jsx("p", { className: "m-12 mt-0", children: t("tiptap.attachments.bloc") }),
|
|
33
33
|
/* @__PURE__ */ jsx(Grid, { children: attachmentArrayAttrs == null ? void 0 : attachmentArrayAttrs.map((attachment, index) => /* @__PURE__ */ jsx(Grid.Col, { sm: "6", children: /* @__PURE__ */ jsx(Attachment, { name: attachment.name, options: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
-
/* @__PURE__ */ jsx("a", { href: attachment.href, download: !0, children: /* @__PURE__ */ jsx(IconButton, { "aria-label": t("tiptap.attachments.download"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDownload, {}), variant: "ghost" }) }),
|
|
35
|
-
editable && /* @__PURE__ */ jsx(IconButton, { "aria-label": t("tiptap.attachments.delete"), color: "danger", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDelete, {}), variant: "ghost", onClick: () => handleDelete(index, attachment.
|
|
34
|
+
/* @__PURE__ */ jsx("a", { href: attachment.href, "data-document-id": attachment.dataDocumentId, "data-content-type": attachment.dataContentType, download: !0, children: /* @__PURE__ */ jsx(IconButton, { "aria-label": t("tiptap.attachments.download"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDownload, {}), variant: "ghost" }) }),
|
|
35
|
+
editable && /* @__PURE__ */ jsx(IconButton, { "aria-label": t("tiptap.attachments.delete"), color: "danger", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDelete, {}), variant: "ghost", onClick: () => handleDelete(index, attachment.dataDocumentId) })
|
|
36
36
|
] }) }) }, index)) })
|
|
37
37
|
] }) });
|
|
38
38
|
};
|
|
@@ -5,6 +5,7 @@ const useMediaLibraryEditor = (editor) => {
|
|
|
5
5
|
const {
|
|
6
6
|
remove
|
|
7
7
|
} = useWorkspaceFile(), appendResult = useCallback((type, result) => {
|
|
8
|
+
var _a;
|
|
8
9
|
if (!(!type || !editor))
|
|
9
10
|
switch (type) {
|
|
10
11
|
case "image": {
|
|
@@ -48,7 +49,7 @@ const useMediaLibraryEditor = (editor) => {
|
|
|
48
49
|
let innerHtml = "";
|
|
49
50
|
for (let i = 0; i < result.length; i++) {
|
|
50
51
|
const link = result[i];
|
|
51
|
-
innerHtml += `<a href="/workspace/${link.public ? "pub/" : ""}document/${link._id}">${link.name}
|
|
52
|
+
innerHtml += `<a href="/workspace/${link.public ? "pub/" : ""}document/${link._id}" data-content-type="${(_a = link.metadata) == null ? void 0 : _a["content-type"]}">${link.name}
|
|
52
53
|
</a>`;
|
|
53
54
|
}
|
|
54
55
|
const richContent = `<div class="attachments">
|
|
@@ -80,7 +81,7 @@ const useMediaLibraryEditor = (editor) => {
|
|
|
80
81
|
};
|
|
81
82
|
if (Array.isArray(resourceTabResult.resources))
|
|
82
83
|
resourceTabResult.resources.forEach((link) => {
|
|
83
|
-
var
|
|
84
|
+
var _a2;
|
|
84
85
|
editor.state.selection.empty && insertAndSelectText(link.name), editor == null || editor.commands.setLink({
|
|
85
86
|
href: link.path,
|
|
86
87
|
target: resourceTabResult.target ?? null
|
|
@@ -89,7 +90,7 @@ const useMediaLibraryEditor = (editor) => {
|
|
|
89
90
|
editor.commands.setTextSelection({
|
|
90
91
|
from: newPosition,
|
|
91
92
|
to: newPosition
|
|
92
|
-
}), resourceTabResult != null && resourceTabResult.resources && ((
|
|
93
|
+
}), resourceTabResult != null && resourceTabResult.resources && ((_a2 = resourceTabResult == null ? void 0 : resourceTabResult.resources) == null ? void 0 : _a2.length) > 1 && editor.commands.enter();
|
|
93
94
|
});
|
|
94
95
|
else {
|
|
95
96
|
const {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
titleId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SvgIconClockAlert: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SvgIconClockAlert;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const SvgIconClockAlert = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
+
/* @__PURE__ */ jsxs("g", { fill: "currentColor", clipPath: "url(#icon-clock-alert_svg__a)", children: [
|
|
9
|
+
/* @__PURE__ */ jsx("path", { d: "M0 10.075C0 4.51 4.51 0 10.075 0c4.573 0 8.431 3.046 9.663 7.217a1 1 0 0 1-1.918.566A8.075 8.075 0 1 0 7.783 17.82a1 1 0 0 1-.566 1.918C3.046 18.506 0 14.648 0 10.075" }),
|
|
10
|
+
/* @__PURE__ */ jsx("path", { d: "M10.075 4.108a1 1 0 0 1 1 1v5.43a1 1 0 0 1-.357.767L7.83 13.728a1 1 0 1 1-1.286-1.532l2.53-2.123V5.108a1 1 0 0 1 1-1M17 13.3a1 1 0 0 1 1 1v2.2a1 1 0 1 1-2 0v-2.2a1 1 0 0 1 1-1M17 18.4a1 1 0 1 0 0 2h.006a1 1 0 1 0 0-2z" }),
|
|
11
|
+
/* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M17 10a7 7 0 1 0 0 14 7 7 0 0 0 0-14m-5 7a5 5 0 1 1 10 0 5 5 0 0 1-10 0", clipRule: "evenodd" })
|
|
12
|
+
] }),
|
|
13
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "icon-clock-alert_svg__a", children: /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })
|
|
14
|
+
] });
|
|
15
|
+
export {
|
|
16
|
+
SvgIconClockAlert as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
interface SVGRProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
titleId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const SvgIconSubmitToValidate: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SvgIconSubmitToValidate;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const SvgIconSubmitToValidate = ({
|
|
3
|
+
title,
|
|
4
|
+
titleId,
|
|
5
|
+
...props
|
|
6
|
+
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
+
/* @__PURE__ */ jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M10.844 7.9a1 1 0 0 0-.085 1.41c.366.417.998.463 1.412.1l4.18-3.656a.99.99 0 0 0 .337-.762 1.01 1.01 0 0 0-.363-.757L12.019.632a1 1 0 0 0-1.408.118 1 1 0 0 0 .134 1.41l2.2 1.84h-.939c-5.617-.067-9.838 4.478-9.905 9.887-.05 4.03 2.374 7.51 5.865 9.091a1 1 0 0 0 .825-1.822c-2.815-1.274-4.73-4.058-4.69-7.244C4.156 9.521 7.554 5.945 11.988 6h1.028zm10.785.822a1 1 0 0 1 .148 1.407l-6.875 8.5a1 1 0 0 1-1.572-.022l-3.125-4.09a1 1 0 0 1 1.59-1.215l2.352 3.08 6.076-7.51a1 1 0 0 1 1.406-.15", clipRule: "evenodd" })
|
|
9
|
+
] });
|
|
10
|
+
export {
|
|
11
|
+
SvgIconSubmitToValidate as default
|
|
12
|
+
};
|
|
@@ -24,6 +24,7 @@ export { default as IconCantoo } from './IconCantoo';
|
|
|
24
24
|
export { default as IconCenter } from './IconCenter';
|
|
25
25
|
export { default as IconCheck } from './IconCheck';
|
|
26
26
|
export { default as IconChecklist } from './IconChecklist';
|
|
27
|
+
export { default as IconClockAlert } from './IconClockAlert';
|
|
27
28
|
export { default as IconClock } from './IconClock';
|
|
28
29
|
export { default as IconCloseFullScreen } from './IconCloseFullScreen';
|
|
29
30
|
export { default as IconClose } from './IconClose';
|
|
@@ -134,6 +135,7 @@ export { default as IconSplitCells } from './IconSplitCells';
|
|
|
134
135
|
export { default as IconSquareRoot } from './IconSquareRoot';
|
|
135
136
|
export { default as IconStarFull } from './IconStarFull';
|
|
136
137
|
export { default as IconStar } from './IconStar';
|
|
138
|
+
export { default as IconSubmitToValidate } from './IconSubmitToValidate';
|
|
137
139
|
export { default as IconSubscript } from './IconSubscript';
|
|
138
140
|
export { default as IconSuccessFill } from './IconSuccessFill';
|
|
139
141
|
export { default as IconSuccessOutline } from './IconSuccessOutline';
|
|
@@ -4,5 +4,5 @@ export declare const ShareBookmark: ({ bookmark, refBookmark, onBookmarkChange,
|
|
|
4
4
|
bookmark: BookmarkProps;
|
|
5
5
|
refBookmark: Ref<HTMLInputElement>;
|
|
6
6
|
onBookmarkChange: () => void;
|
|
7
|
-
onSave: () => void
|
|
7
|
+
onSave: () => Promise<void>;
|
|
8
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import { useTranslation } from "react-i18next";
|
|
3
4
|
import SvgIconSave from "../../icons/components/IconSave.js";
|
|
4
5
|
import FormControl from "../../../components/Form/FormControl.js";
|
|
@@ -11,10 +12,12 @@ const ShareBookmark = ({
|
|
|
11
12
|
}) => {
|
|
12
13
|
const {
|
|
13
14
|
t
|
|
14
|
-
} = useTranslation()
|
|
15
|
+
} = useTranslation(), [isSaving, setIsSaving] = useState(!1), handleSaveClick = async () => {
|
|
16
|
+
setIsSaving(!0), await onSave(), setIsSaving(!1);
|
|
17
|
+
};
|
|
15
18
|
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(SvgIconSave, {}), onClick:
|
|
19
|
+
/* @__PURE__ */ jsx("div", { className: "flex-fill", children: /* @__PURE__ */ jsx(FormControl.Input, { "data-testid": "share-bookmark-name-input", ref: refBookmark, onChange: onBookmarkChange, placeholder: t("explorer.modal.share.sharebookmark.placeholder"), size: "sm", type: "text" }, bookmark.id) }),
|
|
20
|
+
/* @__PURE__ */ jsx(Button, { "data-testid": "share-bookmark-save-button", type: "button", color: "primary", variant: "ghost", disabled: bookmark.name.length === 0 || isSaving, leftIcon: /* @__PURE__ */ jsx(SvgIconSave, {}), onClick: handleSaveClick, className: "text-nowrap", isLoading: isSaving, children: t("explorer.modal.share.sharebookmark.save") })
|
|
18
21
|
] }) });
|
|
19
22
|
};
|
|
20
23
|
export {
|
|
@@ -4,10 +4,10 @@ import SvgIconBookmark from "../../icons/components/IconBookmark.js";
|
|
|
4
4
|
import SvgIconClose from "../../icons/components/IconClose.js";
|
|
5
5
|
import SvgIconRafterDown from "../../icons/components/IconRafterDown.js";
|
|
6
6
|
import SvgIconUsers from "../../icons/components/IconUsers.js";
|
|
7
|
-
import { hasRight } from "./utils/hasRight.js";
|
|
8
|
-
import { showShareRightLine } from "./utils/showShareRightLine.js";
|
|
9
7
|
import { useShareRightDisabled } from "./hooks/useShareRightDisabled.js";
|
|
10
8
|
import { useShareRightVisible } from "./hooks/useShareRightVisible.js";
|
|
9
|
+
import { hasRight } from "./utils/hasRight.js";
|
|
10
|
+
import { showShareRightLine } from "./utils/showShareRightLine.js";
|
|
11
11
|
import Avatar from "../../../components/Avatar/Avatar.js";
|
|
12
12
|
import Button from "../../../components/Button/Button.js";
|
|
13
13
|
import Checkbox from "../../../components/Checkbox/Checkbox.js";
|
|
@@ -45,8 +45,8 @@ const ShareBookmarkLine = ({
|
|
|
45
45
|
] }) }),
|
|
46
46
|
shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsx("td", { style: {
|
|
47
47
|
width: "80px"
|
|
48
|
-
}, className: "text-center text-white", children: /* @__PURE__ */ jsx(Checkbox, { checked: hasRight(shareRight, shareRightAction), onChange: () => toggleRight(shareRight, shareRightAction.id), disabled: isDisabled }) }, shareRightAction.displayName)),
|
|
49
|
-
/* @__PURE__ */ jsx("td", { children: !shareRight.isBookmarkMember && !isDisabled && /* @__PURE__ */ jsx(IconButton, { "aria-label": t("close"), color: "tertiary", icon: /* @__PURE__ */ jsx(SvgIconClose, {}), type: "button", variant: "ghost", title: t("close"), onClick: () => onDeleteRow(shareRight) }) })
|
|
48
|
+
}, className: "text-center text-white", children: /* @__PURE__ */ jsx(Checkbox, { checked: hasRight(shareRight, shareRightAction), onChange: () => toggleRight(shareRight, shareRightAction.id), disabled: isDisabled, "data-testid": `share-right-${shareRightAction.id}-checkbox` }) }, shareRightAction.displayName)),
|
|
49
|
+
/* @__PURE__ */ jsx("td", { children: !shareRight.isBookmarkMember && !isDisabled && /* @__PURE__ */ jsx(IconButton, { "data-testid": "share-right-close-button", "aria-label": t("close"), color: "tertiary", icon: /* @__PURE__ */ jsx(SvgIconClose, {}), type: "button", variant: "ghost", title: t("close"), onClick: () => onDeleteRow(shareRight) }) })
|
|
50
50
|
] }, shareRight.id) : null;
|
|
51
51
|
});
|
|
52
52
|
};
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { UseMutationResult } from '../../../node_modules/@tanstack/react-query';
|
|
4
|
-
export type ShareOptions = {
|
|
5
|
-
resourceId: ID;
|
|
6
|
-
resourceRights: RightStringified[];
|
|
7
|
-
resourceCreatorId: string;
|
|
8
|
-
};
|
|
9
|
-
export type ShareResourceMutation = UseMutationResult<PutShareResponse, unknown, {
|
|
10
|
-
resourceId: string;
|
|
11
|
-
rights: ShareRight[];
|
|
12
|
-
}, unknown>;
|
|
2
|
+
import { ShareOptions, ShareResourceMutation } from './ShareResources';
|
|
13
3
|
interface ShareResourceModalProps {
|
|
14
4
|
/** Handle open/close state */
|
|
15
5
|
isOpen: boolean;
|
|
@@ -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;
|