@edifice.io/react 2.5.4-develop-b2school-actualites.20251212113049 → 2.5.4-develop-pedago.20251212164024
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/components/AppIcon/index.d.ts +0 -1
- package/dist/components/Flex/Flex.js +1 -1
- package/dist/components/Menu/components/MenuButton.d.ts +0 -2
- package/dist/components/Menu/components/MenuButton.js +4 -13
- package/dist/components/Select/Select.d.ts +2 -6
- package/dist/components/Select/Select.js +4 -10
- package/dist/components/index.d.ts +0 -2
- package/dist/editor.js +36 -40
- package/dist/hooks/index.d.ts +0 -1
- package/dist/icons.js +298 -296
- package/dist/index.js +170 -180
- package/dist/modals.js +6 -8
- package/dist/modules/comments/components/Comment.js +2 -4
- package/dist/modules/comments/components/CommentList.js +1 -1
- package/dist/modules/comments/components/DeleteModal.js +8 -14
- package/dist/modules/editor/components/Editor/index.d.ts +0 -2
- package/dist/modules/editor/components/Renderer/MediaRenderer.js +2 -2
- package/dist/modules/editor/hooks/useResizeMedia.js +3 -3
- package/dist/modules/icons/components/IconThumbDown.d.ts +7 -0
- package/dist/modules/icons/components/IconThumbDown.js +12 -0
- package/dist/modules/icons/components/IconThumbUp.d.ts +7 -0
- package/dist/modules/icons/components/IconThumbUp.js +12 -0
- package/dist/modules/icons/components/index.d.ts +2 -1
- package/dist/modules/modals/ShareModal/ShareBookmark.d.ts +1 -1
- package/dist/modules/modals/ShareModal/ShareBookmark.js +2 -5
- package/dist/modules/modals/ShareModal/ShareModal.d.ts +11 -1
- package/dist/modules/modals/ShareModal/ShareModal.js +105 -13
- package/dist/modules/modals/ShareModal/hooks/useSearch.d.ts +1 -2
- package/dist/modules/modals/ShareModal/hooks/useSearch.js +2 -3
- package/dist/modules/modals/ShareModal/hooks/useShare.d.ts +5 -12
- package/dist/modules/modals/ShareModal/hooks/useShare.js +13 -20
- 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 +1 -3
- package/dist/modules/multimedia/FileCard/FileCard.js +1 -1
- package/dist/modules/multimedia/FileCard/FileIcon.js +1 -1
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +4 -1
- package/dist/style.css +1 -1
- package/dist/utilities/index.d.ts +0 -1
- package/package.json +6 -6
- package/dist/components/Divider/Divider.d.ts +0 -38
- package/dist/components/Divider/Divider.js +0 -11
- package/dist/components/Divider/index.d.ts +0 -2
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +0 -59
- package/dist/components/SegmentedControl/SegmentedControl.js +0 -21
- package/dist/components/SegmentedControl/index.d.ts +0 -2
- package/dist/hooks/useInfiniteScroll/index.d.ts +0 -1
- package/dist/hooks/useInfiniteScroll/useInfiniteScroll.d.ts +0 -33
- package/dist/hooks/useInfiniteScroll/useInfiniteScroll.js +0 -20
- package/dist/modules/editor/components/Editor/EditorPreview.d.ts +0 -14
- package/dist/modules/editor/components/Editor/EditorPreview.js +0 -56
- package/dist/modules/editor/components/Editor/EditorPreviewSkeleton.d.ts +0 -8
- package/dist/modules/editor/components/Editor/EditorPreviewSkeleton.js +0 -24
- package/dist/modules/icons/components/IconClockAlert.d.ts +0 -7
- package/dist/modules/icons/components/IconClockAlert.js +0 -17
- package/dist/modules/modals/ShareModal/ShareResources.d.ts +0 -174
- package/dist/modules/modals/ShareModal/ShareResources.js +0 -137
- package/dist/utilities/react-query/index.d.ts +0 -1
- package/dist/utilities/react-query/react-query-utils.d.ts +0 -21
- package/dist/utilities/react-query/react-query-utils.js +0 -13
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { Segmented } from "antd";
|
|
4
|
-
const SegmentedControl = /* @__PURE__ */ forwardRef(({
|
|
5
|
-
options,
|
|
6
|
-
value,
|
|
7
|
-
onChange,
|
|
8
|
-
...htmlProps
|
|
9
|
-
}, ref) => {
|
|
10
|
-
const antProps = {
|
|
11
|
-
options,
|
|
12
|
-
value,
|
|
13
|
-
onChange,
|
|
14
|
-
ref,
|
|
15
|
-
...htmlProps
|
|
16
|
-
};
|
|
17
|
-
return /* @__PURE__ */ jsx(Segmented, { ...antProps });
|
|
18
|
-
});
|
|
19
|
-
export {
|
|
20
|
-
SegmentedControl as default
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as useInfiniteScroll } from './useInfiniteScroll';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A custom React hook that provides infinite scroll functionality using the Intersection Observer API.
|
|
3
|
-
*
|
|
4
|
-
* This hook returns a ref callback that can be attached to a DOM element (typically at the bottom
|
|
5
|
-
* of a scrollable list). When that element becomes visible in the viewport, the provided callback
|
|
6
|
-
* function is executed, allowing you to load more content.
|
|
7
|
-
*
|
|
8
|
-
* @param params - Configuration object for the infinite scroll hook
|
|
9
|
-
* @param params.callback - Function to execute when the observed element intersects with the viewport
|
|
10
|
-
* @param params.options - Optional Intersection Observer configuration options (defaults to { threshold: 0.1 })
|
|
11
|
-
*
|
|
12
|
-
* @returns A ref callback function that should be attached to the target DOM element
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const loadMoreRef = useInfiniteScroll({
|
|
17
|
-
* // Load more data when the element is visible
|
|
18
|
-
* callback: loadMoreItems,
|
|
19
|
-
* options: { threshold: 0.5 } // Trigger when 50% of element is visible
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* return (
|
|
23
|
-
* <div>
|
|
24
|
-
* {items.map(item => <Item key={item.id} {...item} />)}
|
|
25
|
-
* <div ref={loadMoreRef}>Loading...</div>
|
|
26
|
-
* </div>
|
|
27
|
-
* );
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export default function useInfiniteScroll({ callback, options, }: {
|
|
31
|
-
callback: () => void;
|
|
32
|
-
options?: IntersectionObserverInit;
|
|
33
|
-
}): (node: HTMLElement | null) => void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useRef, useCallback } from "react";
|
|
2
|
-
function useInfiniteScroll({
|
|
3
|
-
callback,
|
|
4
|
-
options = {
|
|
5
|
-
threshold: 0.1
|
|
6
|
-
}
|
|
7
|
-
}) {
|
|
8
|
-
const observerRef = useRef(null);
|
|
9
|
-
return useCallback((node) => {
|
|
10
|
-
if (observerRef.current && (observerRef.current.disconnect(), observerRef.current = null), !node) return;
|
|
11
|
-
const observer = new IntersectionObserver(async (entries) => {
|
|
12
|
-
for (const entry of entries)
|
|
13
|
-
entry.isIntersecting && await callback();
|
|
14
|
-
}, options);
|
|
15
|
-
observer.observe(node), observerRef.current = observer;
|
|
16
|
-
}, [callback, options]);
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
useInfiniteScroll as default
|
|
20
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Editor component properties
|
|
3
|
-
*/
|
|
4
|
-
export interface EditorPreviewProps {
|
|
5
|
-
/** Rich content to render. */
|
|
6
|
-
content: string;
|
|
7
|
-
/** Display with or without a border */
|
|
8
|
-
variant?: 'outline' | 'ghost';
|
|
9
|
-
onDetailClick?: () => void;
|
|
10
|
-
onMediaClick?: () => void;
|
|
11
|
-
maxMediaDisplayed?: number;
|
|
12
|
-
}
|
|
13
|
-
declare const EditorPreview: ({ content, variant, onDetailClick, onMediaClick, maxMediaDisplayed, }: EditorPreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export default EditorPreview;
|
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
@@ -1,24 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { ID, PutShareResponse, RightStringified, ShareRight, 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
|
-
* shareUrls: {
|
|
26
|
-
* getResourceRights: '/api/V1/thread/shares', (get endpoint)
|
|
27
|
-
* saveResourceRights: '/api/V1/thread/shares', (put endpoint)
|
|
28
|
-
* getShareMapping: '/api/V1/rights/sharing'
|
|
29
|
-
* }
|
|
30
|
-
* };
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @example Example related to sharing info resources:
|
|
34
|
-
* ```ts
|
|
35
|
-
* const shareOptions: ShareOptions = {
|
|
36
|
-
* resourceId: '12345',
|
|
37
|
-
* resourceRights: [],
|
|
38
|
-
* resourceCreatorId: 'user-67890',
|
|
39
|
-
* filteredActions: ['read', 'contrib'],
|
|
40
|
-
* shareUrls: {
|
|
41
|
-
* getResourceRights: '/api/V1/info/shares', (get endpoint)
|
|
42
|
-
* saveResourceRights: '/api/V1/info/shares', (put endpoint)
|
|
43
|
-
* getShareMapping: '/api/V1/rights/sharing'
|
|
44
|
-
* }
|
|
45
|
-
* };
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export type ShareOptions = {
|
|
49
|
-
resourceId: ID;
|
|
50
|
-
resourceRights: RightStringified[];
|
|
51
|
-
resourceCreatorId: string;
|
|
52
|
-
filteredActions?: ShareRightActionDisplayName[];
|
|
53
|
-
shareUrls?: ShareUrls;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* React Query mutation result for share operations
|
|
57
|
-
*
|
|
58
|
-
* @typedef {UseMutationResult<PutShareResponse, unknown, {resourceId: string; rights: ShareRight[]}, unknown>} ShareResourceMutation
|
|
59
|
-
*/
|
|
60
|
-
export type ShareResourceMutation = UseMutationResult<PutShareResponse, unknown, {
|
|
61
|
-
resourceId: string;
|
|
62
|
-
rights: ShareRight[];
|
|
63
|
-
}, unknown>;
|
|
64
|
-
/**
|
|
65
|
-
* Props for the ShareResources component
|
|
66
|
-
*
|
|
67
|
-
* @interface ShareResourceProps
|
|
68
|
-
* @property {ShareOptions} shareOptions - Configuration for the resource being shared
|
|
69
|
-
* @property {ShareResourceMutation} [shareResource] - Optional React Query mutation for optimistic UI updates
|
|
70
|
-
* @property {() => void} [onSuccess] - Callback fired after successful share operation
|
|
71
|
-
* @property {(shareRights: ShareRight[], isDirty: boolean) => void} [onChange] - Callback fired when share rights change
|
|
72
|
-
* @property {(isSubmitting: boolean) => void} [onSubmit] - Callback fired when share operation is submitting
|
|
73
|
-
* @property {string} [classNameSearchInput] - Optional CSS class for the search input wrapper (default: 'col-6')
|
|
74
|
-
*/
|
|
75
|
-
interface ShareResourceProps {
|
|
76
|
-
/**
|
|
77
|
-
* Expect resourceId,
|
|
78
|
-
* new rights array (replace shared array),
|
|
79
|
-
* creatorId
|
|
80
|
-
* of a resource */
|
|
81
|
-
shareOptions: ShareOptions;
|
|
82
|
-
/**
|
|
83
|
-
* Use the `shareResource` props when you need to do Optimistic UI
|
|
84
|
-
* otherwise ShareModal handles everything
|
|
85
|
-
* Must use React Query */
|
|
86
|
-
shareResource?: ShareResourceMutation;
|
|
87
|
-
/**
|
|
88
|
-
* onSuccess callback when a resource is successfully shared
|
|
89
|
-
*/
|
|
90
|
-
onSuccess?: () => void;
|
|
91
|
-
/**
|
|
92
|
-
* Callback when share rights change
|
|
93
|
-
*/
|
|
94
|
-
onChange?: (shareRights: ShareRight[], isDirty: boolean) => void;
|
|
95
|
-
/**
|
|
96
|
-
* Callback when ShareResources component is submitting share rights or bookmark changes
|
|
97
|
-
*/
|
|
98
|
-
onSubmit?: (isSubmitting: boolean) => void;
|
|
99
|
-
/**
|
|
100
|
-
* Optional className for the search input wrapper (default: 'col-6')
|
|
101
|
-
*/
|
|
102
|
-
classNameSearchInput?: string;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Ref interface exposed by ShareResources component
|
|
106
|
-
*
|
|
107
|
-
* @interface ShareResourcesRef
|
|
108
|
-
* @property {() => void} handleShare - Method to trigger the share operation
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* ```tsx
|
|
112
|
-
* const ref = useRef<ShareResourcesRef>(null);
|
|
113
|
-
*
|
|
114
|
-
* // Trigger share programmatically
|
|
115
|
-
* ref.current?.handleShare();
|
|
116
|
-
*
|
|
117
|
-
* // Check sharing status
|
|
118
|
-
* const sharing = ref.current?.isSharing();
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
export interface ShareResourcesRef {
|
|
122
|
-
handleShare: (notify?: boolean) => void;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* ShareResources Component
|
|
126
|
-
*
|
|
127
|
-
* A component for managing resource sharing permissions with users and groups.
|
|
128
|
-
* Provides search functionality, bookmark management, and granular rights control.
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* ```tsx
|
|
132
|
-
* import { useRef } from 'react';
|
|
133
|
-
* import ShareResources, { ShareResourcesRef, ShareOptions } from './ShareResources';
|
|
134
|
-
*
|
|
135
|
-
* function MyComponent() {
|
|
136
|
-
* const shareRef = useRef<ShareResourcesRef>(null);
|
|
137
|
-
*
|
|
138
|
-
* const shareOptions: ShareOptions = {
|
|
139
|
-
* resourceId: '123',
|
|
140
|
-
* resourceRights: [],
|
|
141
|
-
* resourceCreatorId: 'user-456',
|
|
142
|
-
* filteredActions: ['read', 'contrib'],
|
|
143
|
-
* urls: {
|
|
144
|
-
* getResourceRights: '/api/share/rights',
|
|
145
|
-
* putResourceRights: '/api/share/update'
|
|
146
|
-
* }
|
|
147
|
-
* };
|
|
148
|
-
*
|
|
149
|
-
* const handleSave = () => {
|
|
150
|
-
* if (shareRef.current) {
|
|
151
|
-
* shareRef.current.handleShare();
|
|
152
|
-
* }
|
|
153
|
-
* };
|
|
154
|
-
*
|
|
155
|
-
* return (
|
|
156
|
-
* <>
|
|
157
|
-
* <ShareResources
|
|
158
|
-
* ref={shareRef}
|
|
159
|
-
* shareOptions={shareOptions}
|
|
160
|
-
* onSuccess={() => console.log('Shared successfully')}
|
|
161
|
-
* onChange={(rights, isDirty) => console.log('Rights changed:', isDirty)}
|
|
162
|
-
* onSubmit={(isSubmitting) => console.log('Submitting share...', isSubmitting)}
|
|
163
|
-
* />
|
|
164
|
-
* <button onClick={handleSave}>Save Changes</button>
|
|
165
|
-
* </>
|
|
166
|
-
* );
|
|
167
|
-
* }
|
|
168
|
-
* ```
|
|
169
|
-
*
|
|
170
|
-
* @component
|
|
171
|
-
* @forwardRef
|
|
172
|
-
*/
|
|
173
|
-
declare const ShareResources: import('react').ForwardRefExoticComponent<ShareResourceProps & import('react').RefAttributes<ShareResourcesRef>>;
|
|
174
|
-
export default ShareResources;
|
|
@@ -1,137 +0,0 @@
|
|
|
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 Heading from "../../../components/Heading/Heading.js";
|
|
13
|
-
import Tooltip from "../../../components/Tooltip/Tooltip.js";
|
|
14
|
-
import Combobox from "../../../components/Combobox/Combobox.js";
|
|
15
|
-
import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
|
|
16
|
-
import VisuallyHidden from "../../../components/VisuallyHidden/VisuallyHidden.js";
|
|
17
|
-
import Avatar from "../../../components/Avatar/Avatar.js";
|
|
18
|
-
import Checkbox from "../../../components/Checkbox/Checkbox.js";
|
|
19
|
-
import Button from "../../../components/Button/Button.js";
|
|
20
|
-
const ShareResources = /* @__PURE__ */ forwardRef(({
|
|
21
|
-
shareOptions,
|
|
22
|
-
shareResource,
|
|
23
|
-
onSuccess = () => {
|
|
24
|
-
},
|
|
25
|
-
onChange = () => {
|
|
26
|
-
},
|
|
27
|
-
onSubmit = () => {
|
|
28
|
-
},
|
|
29
|
-
classNameSearchInput = "col-6"
|
|
30
|
-
}, ref) => {
|
|
31
|
-
const {
|
|
32
|
-
resourceId,
|
|
33
|
-
resourceCreatorId,
|
|
34
|
-
resourceRights,
|
|
35
|
-
filteredActions,
|
|
36
|
-
shareUrls
|
|
37
|
-
} = shareOptions, [isLoading, setIsLoading] = useState(!0), [isSavingBookmark, setIsSavingBookmark] = useState(!1), {
|
|
38
|
-
state: {
|
|
39
|
-
isSharing,
|
|
40
|
-
shareRights,
|
|
41
|
-
shareRightActions
|
|
42
|
-
},
|
|
43
|
-
dispatch: shareDispatch,
|
|
44
|
-
myAvatar,
|
|
45
|
-
currentIsAuthor,
|
|
46
|
-
toggleRight,
|
|
47
|
-
handleShare,
|
|
48
|
-
handleDeleteRow,
|
|
49
|
-
isDirty
|
|
50
|
-
} = useShare({
|
|
51
|
-
resourceId,
|
|
52
|
-
resourceCreatorId,
|
|
53
|
-
resourceRights,
|
|
54
|
-
shareResource,
|
|
55
|
-
setIsLoading,
|
|
56
|
-
onSuccess,
|
|
57
|
-
filteredActions,
|
|
58
|
-
shareUrls
|
|
59
|
-
}), {
|
|
60
|
-
state: {
|
|
61
|
-
searchResults,
|
|
62
|
-
searchInputValue
|
|
63
|
-
},
|
|
64
|
-
showSearchAdmlHint,
|
|
65
|
-
showSearchLoading,
|
|
66
|
-
showSearchNoResults,
|
|
67
|
-
getSearchMinLength,
|
|
68
|
-
handleSearchInputChange,
|
|
69
|
-
handleSearchResultsChange
|
|
70
|
-
} = useSearch({
|
|
71
|
-
resourceId,
|
|
72
|
-
resourceCreatorId,
|
|
73
|
-
shareRights,
|
|
74
|
-
shareDispatch,
|
|
75
|
-
urlResourceRights: shareUrls == null ? void 0 : shareUrls.getResourceRights
|
|
76
|
-
}), {
|
|
77
|
-
refBookmark,
|
|
78
|
-
showBookmark,
|
|
79
|
-
handleBookmarkChange,
|
|
80
|
-
toggleBookmark,
|
|
81
|
-
bookmark,
|
|
82
|
-
handleOnSave,
|
|
83
|
-
showBookmarkInput,
|
|
84
|
-
toggleBookmarkInput
|
|
85
|
-
} = useShareBookmark({
|
|
86
|
-
shareRights,
|
|
87
|
-
shareDispatch
|
|
88
|
-
}), handleOnSaveBookmark = () => (setIsSavingBookmark(!0), handleOnSave().then(() => {
|
|
89
|
-
setIsSavingBookmark(!1);
|
|
90
|
-
}));
|
|
91
|
-
useImperativeHandle(ref, () => ({
|
|
92
|
-
handleShare
|
|
93
|
-
}), [handleShare]), useEffect(() => {
|
|
94
|
-
onChange(shareRights.rights, isDirty);
|
|
95
|
-
}, [isDirty, shareRights.rights, onChange]), useEffect(() => {
|
|
96
|
-
onSubmit(isSavingBookmark || isSharing);
|
|
97
|
-
}, [isSavingBookmark, isSharing, onSubmit]);
|
|
98
|
-
const {
|
|
99
|
-
t
|
|
100
|
-
} = useTranslation(), searchPlaceholder = showSearchAdmlHint() ? t("explorer.search.adml.hint") : t("explorer.modal.share.search.placeholder");
|
|
101
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
102
|
-
/* @__PURE__ */ jsxs(Heading, { headingStyle: "h4", level: "h3", className: "mb-16 d-flex align-items-center", children: [
|
|
103
|
-
/* @__PURE__ */ jsx("div", { className: "me-8", children: t("explorer.modal.share.search") }),
|
|
104
|
-
/* @__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" }) })
|
|
105
|
-
] }),
|
|
106
|
-
/* @__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 }) }) }),
|
|
107
|
-
/* @__PURE__ */ jsx("div", { className: "table-responsive", children: isLoading ? /* @__PURE__ */ jsx(LoadingScreen, {}) : /* @__PURE__ */ jsxs("table", { className: "table border align-middle mb-0 rounded-3", children: [
|
|
108
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-blue-200", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
109
|
-
/* @__PURE__ */ jsx("th", { scope: "col", className: "w-32", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("explorer.modal.share.avatar.shared.alt") }) }),
|
|
110
|
-
/* @__PURE__ */ jsx("th", { scope: "col", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("explorer.modal.share.search.placeholder") }) }),
|
|
111
|
-
shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsx("th", { scope: "col", className: "text-center text-gray-800", children: t(shareRightAction.displayName) }, shareRightAction.displayName)),
|
|
112
|
-
/* @__PURE__ */ jsx("th", { scope: "col", children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("close") }) })
|
|
113
|
-
] }) }),
|
|
114
|
-
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
115
|
-
currentIsAuthor() && /* @__PURE__ */ jsxs("tr", { children: [
|
|
116
|
-
/* @__PURE__ */ jsx("th", { scope: "row", children: /* @__PURE__ */ jsx(Avatar, { alt: t("explorer.modal.share.avatar.me.alt"), size: "xs", src: myAvatar, variant: "circle" }) }),
|
|
117
|
-
/* @__PURE__ */ jsx("td", { children: t("share.me") }),
|
|
118
|
-
shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsx("td", { style: {
|
|
119
|
-
width: "80px"
|
|
120
|
-
}, className: "text-center text-white", children: /* @__PURE__ */ jsx(Checkbox, { checked: !0, disabled: !0 }) }, shareRightAction.displayName)),
|
|
121
|
-
/* @__PURE__ */ jsx("td", {})
|
|
122
|
-
] }),
|
|
123
|
-
/* @__PURE__ */ jsx(ShareBookmarkLine, { showBookmark, shareRightActions, shareRights, onDeleteRow: handleDeleteRow, toggleRight, toggleBookmark })
|
|
124
|
-
] })
|
|
125
|
-
] }) }),
|
|
126
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-16", children: [
|
|
127
|
-
/* @__PURE__ */ jsx(Button, { color: "tertiary", leftIcon: /* @__PURE__ */ jsx(SvgIconBookmark, {}), rightIcon: /* @__PURE__ */ jsx(SvgIconRafterDown, { title: t("show"), className: "w-16 min-w-0", style: {
|
|
128
|
-
transition: "rotate 0.2s ease-out",
|
|
129
|
-
rotate: showBookmarkInput ? "-180deg" : "0deg"
|
|
130
|
-
} }), type: "button", variant: "ghost", className: "fw-normal", onClick: () => toggleBookmarkInput(!showBookmarkInput), children: t("share.save.sharebookmark") }),
|
|
131
|
-
showBookmarkInput && /* @__PURE__ */ jsx(ShareBookmark, { refBookmark, bookmark, onBookmarkChange: handleBookmarkChange, onSave: handleOnSaveBookmark })
|
|
132
|
-
] })
|
|
133
|
-
] });
|
|
134
|
-
});
|
|
135
|
-
export {
|
|
136
|
-
ShareResources as default
|
|
137
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './react-query-utils';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { InvalidateQueryFilters, QueryClient } from '../../node_modules/@tanstack/react-query';
|
|
2
|
-
/**
|
|
3
|
-
* Invalidates queries and resets infinite query data to only contain the first page.
|
|
4
|
-
*
|
|
5
|
-
* This utility function is useful when you want to invalidate a query but also ensure
|
|
6
|
-
* that any infinite query data is reset to show only the first page, removing any
|
|
7
|
-
* previously loaded subsequent pages.
|
|
8
|
-
*
|
|
9
|
-
* @param queryClient - The TanStack Query client instance used to manage queries
|
|
10
|
-
* @param options - The invalidate query filters that specify which queries to invalidate
|
|
11
|
-
* @returns The result of the invalidateQueries operation, or undefined if no queryKey is provided
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Invalidate user queries and reset to first page only
|
|
16
|
-
* invalidateQueriesWithFirstPage(queryClient, {
|
|
17
|
-
* queryKey: ['users']
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function invalidateQueriesWithFirstPage(queryClient: QueryClient, options: InvalidateQueryFilters): Promise<void> | undefined;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
function invalidateQueriesWithFirstPage(queryClient, options) {
|
|
2
|
-
if (options.queryKey)
|
|
3
|
-
return queryClient.setQueriesData({
|
|
4
|
-
queryKey: options.queryKey
|
|
5
|
-
}, (oldData) => oldData != null && oldData.pages ? {
|
|
6
|
-
...oldData,
|
|
7
|
-
pages: [oldData.pages[0]],
|
|
8
|
-
pageParams: [oldData.pageParams[0]]
|
|
9
|
-
} : oldData), queryClient.invalidateQueries(options);
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
invalidateQueriesWithFirstPage
|
|
13
|
-
};
|