@equinor/fusion-framework-react-components-bookmark 2.0.1 → 2.0.3
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/CHANGELOG.md +18 -0
- package/README.md +69 -0
- package/dist/esm/components/Bookmark.js +12 -2
- package/dist/esm/components/Bookmark.js.map +1 -1
- package/dist/esm/components/BookmarkProvider.js +16 -0
- package/dist/esm/components/BookmarkProvider.js.map +1 -1
- package/dist/esm/components/create-bookmark/{CreateBookmark.js → CreateBookmarkModal.js} +13 -5
- package/dist/esm/components/create-bookmark/CreateBookmarkModal.js.map +1 -0
- package/dist/esm/components/create-bookmark/index.js +1 -1
- package/dist/esm/components/create-bookmark/index.js.map +1 -1
- package/dist/esm/components/edit-bookmark/AppNameField.js +10 -0
- package/dist/esm/components/edit-bookmark/AppNameField.js.map +1 -0
- package/dist/esm/components/edit-bookmark/{EditBookmark.js → EditBookmarkModal.js} +22 -6
- package/dist/esm/components/edit-bookmark/EditBookmarkModal.js.map +1 -0
- package/dist/esm/components/edit-bookmark/index.js +1 -1
- package/dist/esm/components/edit-bookmark/index.js.map +1 -1
- package/dist/esm/components/filter/{Filter.js → BookmarkFilter.js} +9 -3
- package/dist/esm/components/filter/BookmarkFilter.js.map +1 -0
- package/dist/esm/components/import-bookmark/{ImportBookmark.js → ImportBookmarkModal.js} +13 -1
- package/dist/esm/components/import-bookmark/ImportBookmarkModal.js.map +1 -0
- package/dist/esm/components/import-bookmark/index.js +1 -1
- package/dist/esm/components/import-bookmark/index.js.map +1 -1
- package/dist/esm/components/loading/Loading.js +5 -0
- package/dist/esm/components/loading/Loading.js.map +1 -1
- package/dist/esm/components/messages/Message.js +7 -0
- package/dist/esm/components/messages/Message.js.map +1 -1
- package/dist/esm/components/row/MoreMenu.js +15 -7
- package/dist/esm/components/row/MoreMenu.js.map +1 -1
- package/dist/esm/components/row/Row.js +9 -4
- package/dist/esm/components/row/Row.js.map +1 -1
- package/dist/esm/components/section/Section.js +6 -0
- package/dist/esm/components/section/Section.js.map +1 -1
- package/dist/esm/components/sectionList/SectionList.js +16 -5
- package/dist/esm/components/sectionList/SectionList.js.map +1 -1
- package/dist/esm/components/shared/SharedIcon.js +7 -1
- package/dist/esm/components/shared/SharedIcon.js.map +1 -1
- package/dist/esm/hooks/useBookmarkGrouping.js +23 -10
- package/dist/esm/hooks/useBookmarkGrouping.js.map +1 -1
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/{append-bookmark-to-uri.js → append-bookmark-id-to-url.js} +1 -1
- package/dist/esm/utils/append-bookmark-id-to-url.js.map +1 -0
- package/dist/esm/utils/filter-empty-groups.js +4 -0
- package/dist/esm/utils/filter-empty-groups.js.map +1 -0
- package/dist/esm/utils/sort-by-name.js +2 -0
- package/dist/esm/utils/sort-by-name.js.map +1 -0
- package/dist/esm/utils/to-human-readable.js +6 -0
- package/dist/esm/utils/to-human-readable.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/components/Bookmark.d.ts +6 -1
- package/dist/types/components/BookmarkProvider.d.ts +16 -1
- package/dist/types/components/create-bookmark/CreateBookmarkModal.d.ts +12 -0
- package/dist/types/components/create-bookmark/index.d.ts +1 -1
- package/dist/types/components/edit-bookmark/AppNameField.d.ts +11 -0
- package/dist/types/components/edit-bookmark/EditBookmarkModal.d.ts +14 -0
- package/dist/types/components/edit-bookmark/index.d.ts +1 -1
- package/dist/types/components/filter/BookmarkFilter.d.ts +16 -0
- package/dist/types/components/import-bookmark/ImportBookmarkModal.d.ts +6 -0
- package/dist/types/components/import-bookmark/index.d.ts +1 -1
- package/dist/types/components/loading/Loading.d.ts +6 -1
- package/dist/types/components/messages/Message.d.ts +7 -1
- package/dist/types/components/row/MoreMenu.d.ts +7 -1
- package/dist/types/components/row/Row.d.ts +7 -1
- package/dist/types/components/section/Section.d.ts +7 -1
- package/dist/types/components/sectionList/SectionList.d.ts +7 -1
- package/dist/types/components/shared/SharedIcon.d.ts +7 -1
- package/dist/types/hooks/useBookmarkGrouping.d.ts +6 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/utils/filter-empty-groups.d.ts +5 -0
- package/dist/types/utils/sort-by-name.d.ts +2 -0
- package/dist/types/utils/to-human-readable.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +11 -9
- package/src/__tests__/AppNameField.test.tsx +39 -0
- package/src/components/Bookmark.tsx +12 -5
- package/src/components/BookmarkProvider.tsx +16 -0
- package/src/components/create-bookmark/{CreateBookmark.tsx → CreateBookmarkModal.tsx} +12 -4
- package/src/components/create-bookmark/index.ts +1 -1
- package/src/components/edit-bookmark/AppNameField.tsx +27 -0
- package/src/components/edit-bookmark/{EditBookmark.tsx → EditBookmarkModal.tsx} +28 -7
- package/src/components/edit-bookmark/index.ts +1 -1
- package/src/components/filter/{Filter.tsx → BookmarkFilter.tsx} +11 -5
- package/src/components/import-bookmark/{ImportBookmark.tsx → ImportBookmarkModal.tsx} +12 -0
- package/src/components/import-bookmark/index.ts +1 -1
- package/src/components/loading/Loading.tsx +5 -1
- package/src/components/messages/Message.tsx +7 -0
- package/src/components/row/MoreMenu.tsx +24 -17
- package/src/components/row/Row.tsx +8 -1
- package/src/components/section/Section.tsx +6 -0
- package/src/components/sectionList/SectionList.tsx +16 -5
- package/src/components/shared/SharedIcon.tsx +6 -0
- package/src/hooks/useBookmarkGrouping.ts +29 -18
- package/src/index.ts +10 -0
- package/src/utils/filter-empty-groups.ts +5 -0
- package/src/utils/sort-by-name.ts +4 -0
- package/src/utils/to-human-readable.ts +6 -0
- package/src/version.ts +1 -1
- package/tsconfig.json +1 -1
- package/vitest.config.ts +10 -0
- package/dist/esm/components/create-bookmark/CreateBookmark.js.map +0 -1
- package/dist/esm/components/edit-bookmark/EditBookmark.js.map +0 -1
- package/dist/esm/components/filter/Filter.js.map +0 -1
- package/dist/esm/components/import-bookmark/ImportBookmark.js.map +0 -1
- package/dist/esm/utils/append-bookmark-to-uri.js.map +0 -1
- package/dist/esm/utils/utils.js +0 -9
- package/dist/esm/utils/utils.js.map +0 -1
- package/dist/types/components/create-bookmark/CreateBookmark.d.ts +0 -4
- package/dist/types/components/edit-bookmark/EditBookmark.d.ts +0 -5
- package/dist/types/components/filter/Filter.d.ts +0 -10
- package/dist/types/components/import-bookmark/ImportBookmark.d.ts +0 -1
- package/dist/types/utils/utils.d.ts +0 -7
- package/src/utils/utils.ts +0 -13
- /package/dist/types/utils/{append-bookmark-to-uri.d.ts → append-bookmark-id-to-url.d.ts} +0 -0
- /package/src/utils/{append-bookmark-to-uri.ts → append-bookmark-id-to-url.ts} +0 -0
|
@@ -14,6 +14,11 @@ const Styled = {
|
|
|
14
14
|
`,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Modal that prompts the user to import a bookmark shared via a `bookmarkId` URL parameter.
|
|
19
|
+
*
|
|
20
|
+
* @returns The import bookmark modal
|
|
21
|
+
*/
|
|
17
22
|
export const ImportBookmarkModal = () => {
|
|
18
23
|
const [isOpen, setIsOpen] = useState(false);
|
|
19
24
|
|
|
@@ -21,17 +26,21 @@ export const ImportBookmarkModal = () => {
|
|
|
21
26
|
|
|
22
27
|
// Observe changes to current bookmark and check if it is already in bookmarks or favorites
|
|
23
28
|
const newBookmark$ = useMemo(() => {
|
|
29
|
+
// Without a provider there is no bookmark data source to observe
|
|
24
30
|
if (!provider) {
|
|
25
31
|
return of(null);
|
|
26
32
|
}
|
|
33
|
+
// Watch the current bookmark and resolve whether it should prompt an import
|
|
27
34
|
return provider.currentBookmark$.pipe(
|
|
28
35
|
// filter out null values, not interested in those
|
|
29
36
|
filter((bookmark) => !!bookmark),
|
|
30
37
|
switchMap((bookmark) => {
|
|
31
38
|
const checkBookmark = bookmark && bookmark.createdBy.id !== currentUser?.id;
|
|
39
|
+
// Only prompt to import bookmarks created by someone else
|
|
32
40
|
if (!checkBookmark) {
|
|
33
41
|
return of(null);
|
|
34
42
|
}
|
|
43
|
+
// Resolve to null once the bookmark is already a favorite, otherwise pass it through
|
|
35
44
|
return from(provider.isBookmarkInFavorites(bookmark.id)).pipe(
|
|
36
45
|
map((isFavorite) => (isFavorite ? null : bookmark)),
|
|
37
46
|
);
|
|
@@ -42,6 +51,7 @@ export const ImportBookmarkModal = () => {
|
|
|
42
51
|
const { value: newBookmark } = useObservableState(newBookmark$);
|
|
43
52
|
|
|
44
53
|
useEffect(() => {
|
|
54
|
+
// Open the import dialog whenever a new importable bookmark is detected
|
|
45
55
|
if (newBookmark) {
|
|
46
56
|
setIsOpen(true);
|
|
47
57
|
}
|
|
@@ -49,6 +59,7 @@ export const ImportBookmarkModal = () => {
|
|
|
49
59
|
|
|
50
60
|
const onAddBookmarkFavorite = useCallback(
|
|
51
61
|
(e: React.MouseEvent<HTMLButtonElement>) => {
|
|
62
|
+
// Without a provider we cannot persist the favorite, so bail out
|
|
52
63
|
if (!provider) {
|
|
53
64
|
console.error('Provider not available');
|
|
54
65
|
return;
|
|
@@ -62,6 +73,7 @@ export const ImportBookmarkModal = () => {
|
|
|
62
73
|
[provider],
|
|
63
74
|
);
|
|
64
75
|
|
|
76
|
+
// Nothing to import when there is no candidate bookmark
|
|
65
77
|
if (!newBookmark) {
|
|
66
78
|
return null;
|
|
67
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './ImportBookmarkModal';
|
|
@@ -8,6 +8,7 @@ import { error_outlined, file_description } from '@equinor/eds-icons';
|
|
|
8
8
|
export type PortalMessageType = 'Error' | 'Info' | 'Warning' | 'NoContent';
|
|
9
9
|
|
|
10
10
|
const getMessageType = (type?: PortalMessageType) => {
|
|
11
|
+
// Map each message type to its icon and color; unknown types render nothing
|
|
11
12
|
switch (type) {
|
|
12
13
|
case 'Error':
|
|
13
14
|
return { color: tokens.colors.interactive.danger__resting.hex, icon: error_outlined };
|
|
@@ -51,6 +52,12 @@ type MessageProps = {
|
|
|
51
52
|
readonly color?: string;
|
|
52
53
|
};
|
|
53
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Displays a titled message with an icon matching its type.
|
|
57
|
+
*
|
|
58
|
+
* @param props - The component's props
|
|
59
|
+
* @returns The message
|
|
60
|
+
*/
|
|
54
61
|
export const Message = ({
|
|
55
62
|
title,
|
|
56
63
|
type = 'Info',
|
|
@@ -9,26 +9,33 @@ type MenuProps = {
|
|
|
9
9
|
readonly options: MenuOption[];
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* A dropdown menu of row actions anchored to a reference element.
|
|
14
|
+
*
|
|
15
|
+
* @param props - The component's props
|
|
16
|
+
* @returns The menu
|
|
17
|
+
*/
|
|
12
18
|
export const MoreMenu = ({ pRef, onClose, open, options }: MenuProps) => {
|
|
19
|
+
// Render one menu item per configured row action
|
|
20
|
+
const items = options.map(({ onClick, name, disabled, Icon }) => (
|
|
21
|
+
<Menu.Item
|
|
22
|
+
disabled={disabled}
|
|
23
|
+
onClick={(e) => {
|
|
24
|
+
e.stopPropagation();
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
onClick();
|
|
27
|
+
onClose();
|
|
28
|
+
}}
|
|
29
|
+
key={name}
|
|
30
|
+
>
|
|
31
|
+
{Icon && Icon}
|
|
32
|
+
{name}
|
|
33
|
+
</Menu.Item>
|
|
34
|
+
));
|
|
35
|
+
|
|
13
36
|
return (
|
|
14
37
|
<Menu open={open} anchorEl={pRef.current}>
|
|
15
|
-
{
|
|
16
|
-
<Menu.Item
|
|
17
|
-
disabled={disabled}
|
|
18
|
-
onClick={(e) => {
|
|
19
|
-
e.stopPropagation();
|
|
20
|
-
e.preventDefault();
|
|
21
|
-
onClick();
|
|
22
|
-
onClose();
|
|
23
|
-
}}
|
|
24
|
-
key={name}
|
|
25
|
-
>
|
|
26
|
-
<>
|
|
27
|
-
{Icon && Icon}
|
|
28
|
-
{name}
|
|
29
|
-
</>
|
|
30
|
-
</Menu.Item>
|
|
31
|
-
))}
|
|
38
|
+
{items}
|
|
32
39
|
</Menu>
|
|
33
40
|
);
|
|
34
41
|
};
|
|
@@ -47,6 +47,12 @@ const Styled = {
|
|
|
47
47
|
`,
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* A single bookmark row, with actions and click-to-set-current behavior.
|
|
52
|
+
*
|
|
53
|
+
* @param props - The component's props
|
|
54
|
+
* @returns The row
|
|
55
|
+
*/
|
|
50
56
|
export const Row = ({ name, menuOptions, children, id, menuOpen, onMenuOpen }: RowProps) => {
|
|
51
57
|
const pRef = useRef<HTMLElement | null>(null);
|
|
52
58
|
const { provider } = useBookmarkComponentContext();
|
|
@@ -55,6 +61,7 @@ export const Row = ({ name, menuOptions, children, id, menuOpen, onMenuOpen }: R
|
|
|
55
61
|
(e: React.MouseEvent) => {
|
|
56
62
|
e.preventDefault();
|
|
57
63
|
e.stopPropagation();
|
|
64
|
+
// Only attempt to set the current bookmark when a provider is available
|
|
58
65
|
if (provider) {
|
|
59
66
|
from(provider.setCurrentBookmark(id)).subscribe();
|
|
60
67
|
}
|
|
@@ -64,7 +71,7 @@ export const Row = ({ name, menuOptions, children, id, menuOpen, onMenuOpen }: R
|
|
|
64
71
|
|
|
65
72
|
useOutsideClick(pRef.current, () => onMenuOpen(''));
|
|
66
73
|
|
|
67
|
-
// TODO:
|
|
74
|
+
// TODO(#5093): fix accessibility (keyboard support) for this click handler
|
|
68
75
|
return (
|
|
69
76
|
/* eslint-disable-next-line styled-components-a11y/click-events-have-key-events, styled-components-a11y/no-static-element-interactions*/
|
|
70
77
|
<Styled.ListItem onClick={onListItemClick}>
|
|
@@ -42,6 +42,12 @@ type SectionProps = {
|
|
|
42
42
|
readonly name: string;
|
|
43
43
|
readonly children: ReactNode;
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* A collapsible section with a named header and its contents.
|
|
47
|
+
*
|
|
48
|
+
* @param props - The component's props
|
|
49
|
+
* @returns The section
|
|
50
|
+
*/
|
|
45
51
|
export const Section = ({ children, name }: SectionProps) => {
|
|
46
52
|
const [isExpanded, setIsExpanded] = useState(true);
|
|
47
53
|
|
|
@@ -3,12 +3,14 @@ import type { useBookmarkGrouping } from '../../hooks';
|
|
|
3
3
|
import { type MenuOption, Row } from '../row/Row';
|
|
4
4
|
import { Section } from '../section/Section';
|
|
5
5
|
import { SharedIcon } from '../shared/SharedIcon';
|
|
6
|
-
// TODO
|
|
6
|
+
// TODO(#5094): export from `@equinor/fusion-framework-react-module-bookmark`
|
|
7
7
|
import type { BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
|
|
8
8
|
import { useCurrentUser } from '@equinor/fusion-framework-react/hooks';
|
|
9
9
|
import { useCallback, useState } from 'react';
|
|
10
10
|
import { delete_to_trash, share, edit, close, update } from '@equinor/eds-icons';
|
|
11
|
-
import { filterEmptyGroups
|
|
11
|
+
import { filterEmptyGroups } from '../../utils/filter-empty-groups';
|
|
12
|
+
import { sortByName } from '../../utils/sort-by-name';
|
|
13
|
+
import { toHumanReadable } from '../../utils/to-human-readable';
|
|
12
14
|
import { useBookmarkComponentContext } from '../BookmarkProvider';
|
|
13
15
|
import { from } from 'rxjs';
|
|
14
16
|
|
|
@@ -24,19 +26,26 @@ type SectionListProps = {
|
|
|
24
26
|
readonly bookmarkGroups: ReturnType<typeof useBookmarkGrouping>['bookmarkGroups'];
|
|
25
27
|
};
|
|
26
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Renders bookmark groups as sections of rows with edit/share/delete actions.
|
|
31
|
+
*
|
|
32
|
+
* @param props - The component's props
|
|
33
|
+
* @returns The section list
|
|
34
|
+
*/
|
|
27
35
|
export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
|
|
28
36
|
// const { deleteBookmarkById, updateBookmark, removeBookmarkFavorite } = useBookmark();
|
|
29
37
|
|
|
30
38
|
const { provider, currentApp, showEditBookmark, addBookmarkToClipboard } =
|
|
31
39
|
useBookmarkComponentContext();
|
|
32
40
|
|
|
33
|
-
// TODO
|
|
41
|
+
// TODO(#5095): should be removed when bookmark has property for isOwner
|
|
34
42
|
const user = useCurrentUser();
|
|
35
43
|
|
|
36
44
|
const [isMenuByIdOpen, setIsMenuByIdOpen] = useState('');
|
|
37
45
|
|
|
38
46
|
const createMenuOptions = useCallback(
|
|
39
47
|
(bookmark: BookmarkWithoutData) => {
|
|
48
|
+
// Without a provider there are no actions that can be performed on the bookmark
|
|
40
49
|
if (!provider) return [];
|
|
41
50
|
const appKey = currentApp?.appKey;
|
|
42
51
|
const bookmarkId = bookmark.id;
|
|
@@ -51,6 +60,7 @@ export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
|
|
|
51
60
|
Icon: <Icon name="share" />,
|
|
52
61
|
};
|
|
53
62
|
|
|
63
|
+
// Only the bookmark owner is allowed to edit, update, remove, or share it
|
|
54
64
|
if (isOwner) {
|
|
55
65
|
const ownerOptions = [
|
|
56
66
|
{
|
|
@@ -65,7 +75,7 @@ export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
|
|
|
65
75
|
name: 'Update with current view',
|
|
66
76
|
disabled: appKey !== bookmark.appKey,
|
|
67
77
|
onClick: () => {
|
|
68
|
-
// TODO: add success and failure message
|
|
78
|
+
// TODO(#5089): add success and failure message
|
|
69
79
|
from(
|
|
70
80
|
provider.updateBookmark(bookmark.id, undefined, {
|
|
71
81
|
excludePayloadGeneration: false,
|
|
@@ -85,7 +95,7 @@ export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
|
|
|
85
95
|
name: 'Remove',
|
|
86
96
|
disabled: false,
|
|
87
97
|
onClick: () => {
|
|
88
|
-
// TODO: add success and failure message
|
|
98
|
+
// TODO(#5089): add success and failure message
|
|
89
99
|
from(provider.deleteBookmark(bookmark.id)).subscribe({
|
|
90
100
|
error(err) {
|
|
91
101
|
console.error('Failed to remove bookmark', err);
|
|
@@ -107,6 +117,7 @@ export const SectionList = ({ bookmarkGroups }: SectionListProps) => {
|
|
|
107
117
|
}),
|
|
108
118
|
).subscribe({
|
|
109
119
|
next(value) {
|
|
120
|
+
// Copy the bookmark URL to the clipboard once it becomes shared
|
|
110
121
|
if (value.isShared) {
|
|
111
122
|
addBookmarkToClipboard(value.id);
|
|
112
123
|
}
|
|
@@ -24,6 +24,12 @@ type SharedIconProps = {
|
|
|
24
24
|
readonly createdById: string;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Displays a "shared by" indicator when a bookmark was created by another user.
|
|
29
|
+
*
|
|
30
|
+
* @param props - The component's props
|
|
31
|
+
* @returns The shared icon, or nothing when the current user created the bookmark
|
|
32
|
+
*/
|
|
27
33
|
export const SharedIcon = ({ createdBy, createdById }: SharedIconProps) => {
|
|
28
34
|
const myId = useFramework().modules.auth.account?.localAccountId;
|
|
29
35
|
|
|
@@ -10,6 +10,12 @@ const groupingModes: Record<GroupingKeys, (_item: BookmarkWithoutData) => string
|
|
|
10
10
|
'Group by Context': (item: BookmarkWithoutData) => item?.context?.name ?? 'Unknown',
|
|
11
11
|
} as const;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Hook for grouping and searching bookmarks by app, creator, or context.
|
|
15
|
+
*
|
|
16
|
+
* @param bookmarks - The bookmarks to group and search
|
|
17
|
+
* @returns The grouped bookmarks along with the search text and grouping key state/setters
|
|
18
|
+
*/
|
|
13
19
|
export const useBookmarkGrouping = (bookmarks?: Bookmarks) => {
|
|
14
20
|
const [searchText, setSearchText] = useState<string | null>(null);
|
|
15
21
|
|
|
@@ -33,22 +39,27 @@ const groupBy = <T>(
|
|
|
33
39
|
searchText: string | null,
|
|
34
40
|
field: keyof T,
|
|
35
41
|
) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
42
|
+
// Treat a missing array as an empty one so downstream calls are safe
|
|
43
|
+
const items = array ?? [];
|
|
44
|
+
// Collect the key for every item
|
|
45
|
+
const keys = items.map(getKey);
|
|
46
|
+
// Deduplicate to get the unique set of group keys, preserving first-seen order
|
|
47
|
+
const uniqueKeys = keys.filter((v, i, a) => a.indexOf(v) === i);
|
|
48
|
+
// Build a group entry for each unique key
|
|
49
|
+
const groups = uniqueKeys.map((groupingProperty) => {
|
|
50
|
+
// Only include values in this group whose key matches
|
|
51
|
+
const matchingValues = array.filter((s) => getKey(s) === groupingProperty);
|
|
52
|
+
// Then narrow those matches down by the search-text filter
|
|
53
|
+
const values = matchingValues.filter((s) => {
|
|
54
|
+
const fieldData = s[field];
|
|
55
|
+
// Only apply search-text filtering to string fields
|
|
56
|
+
if (typeof fieldData === 'string' && searchText) {
|
|
57
|
+
return fieldData.includes(searchText);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return true;
|
|
61
|
+
});
|
|
62
|
+
return { groupingProperty, values };
|
|
63
|
+
});
|
|
64
|
+
return groups;
|
|
54
65
|
};
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-built React UI components for bookmark management.
|
|
3
|
+
*
|
|
4
|
+
* Provides the {@link Bookmark} list component and {@link BookmarkProvider}
|
|
5
|
+
* context wrapper with built-in create, edit, and import modals plus filtering controls.
|
|
6
|
+
*
|
|
7
|
+
* For bookmark hooks without UI, see `@equinor/fusion-framework-react-app/bookmark`.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
1
11
|
export { Bookmark } from './components/Bookmark';
|
|
2
12
|
export { BookmarkProvider, useBookmarkComponentContext } from './components/BookmarkProvider';
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '2.0.
|
|
2
|
+
export const version = '2.0.3';
|
package/tsconfig.json
CHANGED
package/vitest.config.ts
ADDED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateBookmark.js","sourceRoot":"","sources":["../../../../src/components/create-bookmark/CreateBookmark.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAoB,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGlF,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO;AACP,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;;;;CAI3C,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,MAAM,EACN,OAAO,GAIR,EAAE,EAAE;IACH,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,2BAA2B,EAAE,CAAC;IAE/D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA4B;QAC5D,IAAI,EAAE,EAAE;QACR,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,aAAa,GAAG,KAAK,EAAE,CAAC;IAE9B,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAChE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,MAAM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AC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;gCAC9B,CAAC,GACD,CACH,IACsB,IACJ,EACvB,KAAC,MAAM,CAAC,OAAO,cACb,MAAC,MAAM,CAAC,OAAO,eACb,KAAC,MAAM,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,EAAC,OAAO,uBAE7C,EACT,KAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE;gCACZ,cAAc,CAAC,KAAK,CAAC,CAAC;4BACxB,CAAC,qBAGM,IACM,GACF,IACH,CACjB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/filter/Filter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,yBAAyB,CAAC;AAG/D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAUvC,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,MAAM,CAAC,GAAG,CAAA;;;;KAIb;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,OAAO,GACa,EAAE,EAAE;IACxB,OAAO,CACL,KAAC,MAAM,IACL,WAAW,EAAC,wBAAwB,EACpC,KAAK,EAAE,UAAU,IAAI,EAAE,EACvB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7E,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ImportBookmark.js","sourceRoot":"","sources":["../../../../src/components/import-bookmark/ImportBookmark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,MAAC,MAAM,CAAC,OAAO,eACb,yDAAiC,WAAW,CAAC,SAAS,CAAC,IAAI,IAAK,EAChE,uDAAmC,IACpB,EACjB,KAAC,MAAM,CAAC,OAAO,cACb,MAAC,MAAM,CAAC,OAAO,eACb,KAAC,MAAM,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,mBAE1E,EACT,KAAC,MAAM,IAAC,KAAK,EAAE,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAC,OAAO,uBAErE,IACM,GACF,IACV,CACV,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"append-bookmark-to-uri.js","sourceRoot":"","sources":["../../../src/utils/append-bookmark-to-uri.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAU,EAAU,EAAE;IAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC,CAAC"}
|
package/dist/esm/utils/utils.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Helpers.. */
|
|
2
|
-
export const filterEmptyGroups = (i) => i.values.length;
|
|
3
|
-
export const sortByName = (a, b) => a.name.localeCompare(b.name);
|
|
4
|
-
// const extractNameFromMail = (mail: string) => mail.split('@')[0].toLowerCase();
|
|
5
|
-
export const toHumanReadable = (val) => val
|
|
6
|
-
.split('-')
|
|
7
|
-
.map((s) => `${s[0].toUpperCase()}${s.slice(1)}`)
|
|
8
|
-
.join(' ');
|
|
9
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAEA,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAwB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAsB,EAAE,CAAsB,EAAE,EAAE,CAC3E,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC/B,kFAAkF;AAElF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE,CAC7C,GAAG;KACA,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;KAChD,IAAI,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { GroupingKeys } from '../../hooks/useBookmarkGrouping';
|
|
2
|
-
type BookmarkFilterProps = {
|
|
3
|
-
readonly searchText: string;
|
|
4
|
-
readonly setSearchText: (newVal: string | null) => void;
|
|
5
|
-
readonly setGroupBy: (groupBy: GroupingKeys) => void;
|
|
6
|
-
readonly groupingModes: string[];
|
|
7
|
-
readonly groupBy: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const BookmarkFilter: ({ searchText, setGroupBy, setSearchText, groupingModes, groupBy, }: BookmarkFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ImportBookmarkModal: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Bookmarks, BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
|
|
2
|
-
/** Helpers.. */
|
|
3
|
-
export declare const filterEmptyGroups: (i: {
|
|
4
|
-
values: Bookmarks;
|
|
5
|
-
}) => number;
|
|
6
|
-
export declare const sortByName: (a: BookmarkWithoutData, b: BookmarkWithoutData) => number;
|
|
7
|
-
export declare const toHumanReadable: (val: string) => string;
|
package/src/utils/utils.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Bookmarks, BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
|
|
2
|
-
|
|
3
|
-
/** Helpers.. */
|
|
4
|
-
export const filterEmptyGroups = (i: { values: Bookmarks }) => i.values.length;
|
|
5
|
-
export const sortByName = (a: BookmarkWithoutData, b: BookmarkWithoutData) =>
|
|
6
|
-
a.name.localeCompare(b.name);
|
|
7
|
-
// const extractNameFromMail = (mail: string) => mail.split('@')[0].toLowerCase();
|
|
8
|
-
|
|
9
|
-
export const toHumanReadable = (val: string) =>
|
|
10
|
-
val
|
|
11
|
-
.split('-')
|
|
12
|
-
.map((s) => `${s[0].toUpperCase()}${s.slice(1)}`)
|
|
13
|
-
.join(' ');
|
|
File without changes
|
|
File without changes
|