ode-explorer 1.3.2-dev.202401091605 → 1.3.2-dev.202401091744

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.
Files changed (79) hide show
  1. package/dist/version.txt +1 -1
  2. package/explorer.d.ts +1 -0
  3. package/lib/ActionBarContainer.js +375 -0
  4. package/lib/AppAction.js +47 -0
  5. package/lib/DeleteModal.js +60 -0
  6. package/lib/DisableModal.js +20 -0
  7. package/lib/EmptyScreenApp.js +53 -0
  8. package/lib/EmptyScreenError.js +13 -0
  9. package/lib/EmptyScreenNoContentInFolder.js +20 -0
  10. package/lib/EmptyScreenSearch.js +20 -0
  11. package/lib/EmptyScreenTrash.js +18 -0
  12. package/lib/FolderModal.js +138 -0
  13. package/lib/FoldersList.js +77 -0
  14. package/lib/Library.js +19 -0
  15. package/lib/MoveModal.js +94 -0
  16. package/lib/ResourcesList.js +261 -0
  17. package/lib/TrashModal.js +20 -0
  18. package/lib/app/root/index.d.ts +2 -0
  19. package/lib/components/AppAction/AppAction.d.ts +1 -0
  20. package/lib/components/EmptyScreens/EmptyScreenApp.d.ts +2 -0
  21. package/lib/components/EmptyScreens/EmptyScreenError.d.ts +2 -0
  22. package/lib/components/EmptyScreens/EmptyScreenNoContentInFolder.d.ts +2 -0
  23. package/lib/components/EmptyScreens/EmptyScreenSearch.d.ts +2 -0
  24. package/lib/components/EmptyScreens/EmptyScreenTrash.d.ts +1 -0
  25. package/lib/components/Explorer.d.ts +5 -0
  26. package/lib/components/ExplorerBreadcrumb.d.ts +1 -0
  27. package/lib/components/LoadMore.d.ts +3 -0
  28. package/lib/config/getExplorerConfig.d.ts +11 -0
  29. package/lib/config/index.d.ts +3 -0
  30. package/lib/features/AccessControl/AccessControl.d.ts +12 -0
  31. package/lib/features/AccessControl/useAccessControl.d.ts +14 -0
  32. package/lib/features/ActionBar/ActionBarContainer.d.ts +1 -0
  33. package/lib/features/ActionBar/Delete/DeleteModal.d.ts +8 -0
  34. package/lib/features/ActionBar/Delete/useDeleteModal.d.ts +8 -0
  35. package/lib/features/ActionBar/Disable/DisableModal.d.ts +5 -0
  36. package/lib/features/ActionBar/Disable/useDisableModal.d.ts +4 -0
  37. package/lib/features/ActionBar/Folder/FolderModal.d.ts +9 -0
  38. package/lib/features/ActionBar/Folder/useFolderModal.d.ts +22 -0
  39. package/lib/features/ActionBar/Move/MoveModal.d.ts +8 -0
  40. package/lib/features/ActionBar/Move/useMoveModal.d.ts +12 -0
  41. package/lib/features/ActionBar/Trash/TrashModal.d.ts +5 -0
  42. package/lib/features/ActionBar/Trash/useTrashModal.d.ts +4 -0
  43. package/lib/features/ActionBar/useActionBar.d.ts +30 -0
  44. package/lib/features/List/FolderCard.d.ts +17 -0
  45. package/lib/features/List/FoldersList.d.ts +7 -0
  46. package/lib/features/List/List.d.ts +1 -0
  47. package/lib/features/List/ResourceCard.d.ts +22 -0
  48. package/lib/features/List/ResourcesList.d.ts +8 -0
  49. package/lib/features/SearchForm/SearchForm.d.ts +1 -0
  50. package/lib/features/SearchForm/useSearchForm.d.ts +8 -0
  51. package/lib/features/SearchForm/useSelectedFilters.d.ts +8 -0
  52. package/lib/features/SideBar/Library/Library.d.ts +2 -0
  53. package/lib/features/SideBar/TrashButton.d.ts +7 -0
  54. package/lib/features/SideBar/TreeViewContainer.d.ts +1 -0
  55. package/lib/i18n.d.ts +2 -0
  56. package/lib/index.d.ts +1 -0
  57. package/lib/index.js +13 -0
  58. package/lib/index2.js +1867 -0
  59. package/lib/main.d.ts +0 -0
  60. package/lib/services/api/index.d.ts +129 -0
  61. package/lib/store/index.d.ts +98 -0
  62. package/lib/style.css +410 -0
  63. package/lib/utils/TreeNodeFolderWrapper.d.ts +12 -0
  64. package/lib/utils/addNode.d.ts +6 -0
  65. package/lib/utils/arrayUnique.d.ts +1 -0
  66. package/lib/utils/capitalizeFirstLetter.d.ts +1 -0
  67. package/lib/utils/deleteNode.d.ts +4 -0
  68. package/lib/utils/findNodeById.d.ts +2 -0
  69. package/lib/utils/fullTextSearch.d.ts +1 -0
  70. package/lib/utils/getAncestors.d.ts +2 -0
  71. package/lib/utils/getAppParams.d.ts +10 -0
  72. package/lib/utils/hasChildren.d.ts +2 -0
  73. package/lib/utils/isResourceShared.d.ts +2 -0
  74. package/lib/utils/modifyNode.d.ts +2 -0
  75. package/lib/utils/moveNode.d.ts +5 -0
  76. package/lib/utils/scrollToTop.d.ts +1 -0
  77. package/lib/utils/updateNode.d.ts +6 -0
  78. package/lib/utils/wrapTreeNode.d.ts +3 -0
  79. package/package.json +33 -3
@@ -0,0 +1,138 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useId, useEffect } from "react";
3
+ import { Modal, FormControl, Label, Input, Button } from "@edifice-ui/react";
4
+ import { createPortal } from "react-dom";
5
+ import { useTranslation } from "react-i18next";
6
+ import { FOLDER } from "edifice-ts-client";
7
+ import { useForm } from "react-hook-form";
8
+ import { h as useSelectedFolders, b as useCurrentFolder, o as useCreateFolder, p as useUpdatefolder } from "./index2.js";
9
+ import "@edifice-ui/icons";
10
+ import "i18next";
11
+ import "zustand";
12
+ import "@tanstack/react-query";
13
+ function useFolderModal({
14
+ edit,
15
+ onSuccess,
16
+ onClose
17
+ }) {
18
+ var _a;
19
+ const selectedFolders = useSelectedFolders();
20
+ const currentFolder = useCurrentFolder();
21
+ const createFolder = useCreateFolder();
22
+ const updatefolder = useUpdatefolder();
23
+ const name = edit ? (_a = selectedFolders[0]) == null ? void 0 : _a.name : void 0;
24
+ const {
25
+ reset,
26
+ register,
27
+ handleSubmit,
28
+ setFocus,
29
+ formState: {
30
+ errors,
31
+ isSubmitting,
32
+ isDirty,
33
+ isValid
34
+ }
35
+ } = useForm({
36
+ mode: "onChange",
37
+ values: {
38
+ name: name || ""
39
+ }
40
+ });
41
+ const id = useId();
42
+ const onSubmit = async function({
43
+ name: name2
44
+ }) {
45
+ var _a2;
46
+ try {
47
+ if (edit) {
48
+ const parentId = (_a2 = selectedFolders[0]) == null ? void 0 : _a2.parentId;
49
+ const folder = selectedFolders[0];
50
+ const folderId = folder.id;
51
+ await updatefolder.mutate({
52
+ folderId,
53
+ parentId,
54
+ name: name2
55
+ });
56
+ reset();
57
+ onSuccess == null ? void 0 : onSuccess();
58
+ } else {
59
+ const parentId = (currentFolder == null ? void 0 : currentFolder.id) || FOLDER.DEFAULT;
60
+ await createFolder.mutate({
61
+ name: name2,
62
+ parentId
63
+ });
64
+ reset();
65
+ onSuccess == null ? void 0 : onSuccess();
66
+ }
67
+ } catch (e) {
68
+ console.error(e);
69
+ }
70
+ };
71
+ function onCancel() {
72
+ reset();
73
+ onClose();
74
+ }
75
+ const formId = `createModal_${id}`;
76
+ return {
77
+ formId,
78
+ errors,
79
+ isSubmitting,
80
+ isDirty,
81
+ isValid,
82
+ register,
83
+ setFocus,
84
+ handleSubmit,
85
+ onCancel,
86
+ onSubmit
87
+ };
88
+ }
89
+ function FolderModal({
90
+ isOpen,
91
+ edit,
92
+ onSuccess,
93
+ onCancel: onClose
94
+ }) {
95
+ const {
96
+ t
97
+ } = useTranslation();
98
+ const {
99
+ isDirty,
100
+ isValid,
101
+ isSubmitting,
102
+ formId,
103
+ onSubmit,
104
+ onCancel,
105
+ handleSubmit,
106
+ register,
107
+ setFocus
108
+ } = useFolderModal({
109
+ edit,
110
+ onSuccess,
111
+ onClose
112
+ });
113
+ useEffect(() => {
114
+ if (isOpen) {
115
+ setFocus("name");
116
+ }
117
+ }, [isOpen, setFocus]);
118
+ return isOpen ? /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { isOpen, onModalClose: onCancel, id: "modal_" + formId, children: [
119
+ /* @__PURE__ */ jsx(Modal.Header, { onModalClose: onCancel, children: t(edit ? "explorer.rename.folder" : "explorer.create.folder") }),
120
+ /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx("form", { id: formId, onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ jsxs(FormControl, { id: "nameFolder", isRequired: true, children: [
121
+ /* @__PURE__ */ jsx(Label, { children: t("explorer.create.folder.name") }),
122
+ /* @__PURE__ */ jsx(Input, { type: "text", ...register("name", {
123
+ required: true,
124
+ pattern: {
125
+ value: /[^ ]/,
126
+ message: "invalid title"
127
+ }
128
+ }), placeholder: t("explorer.create.folder.name"), size: "md", "aria-required": true })
129
+ ] }) }) }),
130
+ /* @__PURE__ */ jsxs(Modal.Footer, { children: [
131
+ /* @__PURE__ */ jsx(Button, { color: "tertiary", onClick: onCancel, type: "button", variant: "ghost", children: t("explorer.cancel") }),
132
+ /* @__PURE__ */ jsx(Button, { form: formId, type: "submit", color: "primary", variant: "filled", disabled: !isDirty || !isValid || isSubmitting, children: t(edit ? "explorer.rename" : "explorer.create") })
133
+ ] })
134
+ ] }), document.getElementById("portal")) : null;
135
+ }
136
+ export {
137
+ FolderModal as default
138
+ };
@@ -0,0 +1,77 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Card, useOdeClient, useScrollToTop } from "@edifice-ui/react";
3
+ import { useSpring, animated } from "@react-spring/web";
4
+ import { Files } from "@edifice-ui/icons";
5
+ import { h as useSelectedFolders, i as useFolderIds, u as useStoreActions } from "./index2.js";
6
+ import "react";
7
+ import "react-i18next";
8
+ import "edifice-ts-client";
9
+ import "i18next";
10
+ import "zustand";
11
+ import "@tanstack/react-query";
12
+ const FolderCard = ({
13
+ app,
14
+ name,
15
+ isSelected = false,
16
+ isSelectable = true,
17
+ onClick,
18
+ onSelect
19
+ }) => {
20
+ return /* @__PURE__ */ jsx(Card, { app, isSelectable, isSelected, onClick, onSelect, children: (appCode) => /* @__PURE__ */ jsxs(Card.Body, { children: [
21
+ /* @__PURE__ */ jsx(Files, { width: "48", height: "48", className: `color-app-${appCode}` }),
22
+ /* @__PURE__ */ jsx(Card.Title, { children: name })
23
+ ] }) });
24
+ };
25
+ FolderCard.displayName = "FolderCard";
26
+ const FoldersList = ({
27
+ data
28
+ }) => {
29
+ var _a, _b;
30
+ const {
31
+ currentApp
32
+ } = useOdeClient();
33
+ const selectedFolders = useSelectedFolders();
34
+ const folderIds = useFolderIds();
35
+ const {
36
+ setSelectedFolders,
37
+ setFolderIds,
38
+ openFolder
39
+ } = useStoreActions();
40
+ function toggleSelect(folder) {
41
+ if (folderIds.includes(folder.id)) {
42
+ setFolderIds(folderIds.filter((selectedFolder) => selectedFolder !== folder.id));
43
+ setSelectedFolders(selectedFolders.filter((selectedFolder) => selectedFolder.id !== folder.id));
44
+ } else {
45
+ setFolderIds([...folderIds, folder.id]);
46
+ setSelectedFolders([...selectedFolders, folder]);
47
+ }
48
+ }
49
+ const springs = useSpring({
50
+ from: {
51
+ opacity: 0
52
+ },
53
+ to: {
54
+ opacity: 1
55
+ }
56
+ });
57
+ const scrollToTop = useScrollToTop();
58
+ return ((_a = data == null ? void 0 : data.pages[0]) == null ? void 0 : _a.folders.length) ? /* @__PURE__ */ jsx(animated.ul, { className: "grid ps-0 list-unstyled mb-24", children: (_b = data == null ? void 0 : data.pages[0]) == null ? void 0 : _b.folders.map((folder) => {
59
+ const {
60
+ id,
61
+ name
62
+ } = folder;
63
+ return /* @__PURE__ */ jsx(animated.li, { className: "g-col-4 z-1", style: {
64
+ position: "relative",
65
+ ...springs
66
+ }, children: /* @__PURE__ */ jsx(FolderCard, { name, app: currentApp, isSelected: folderIds.includes(folder.id), onClick: () => {
67
+ scrollToTop();
68
+ openFolder({
69
+ folder,
70
+ folderId: folder.id
71
+ });
72
+ }, onSelect: () => toggleSelect(folder) }) }, id);
73
+ }) }) : null;
74
+ };
75
+ export {
76
+ FoldersList as default
77
+ };
package/lib/Library.js ADDED
@@ -0,0 +1,19 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useOdeTheme, useLibraryUrl, usePaths, Library as Library$1 } from "@edifice-ui/react";
3
+ import { useTranslation } from "react-i18next";
4
+ const Library = () => {
5
+ const {
6
+ t
7
+ } = useTranslation();
8
+ const {
9
+ theme
10
+ } = useOdeTheme();
11
+ const {
12
+ libraryUrl
13
+ } = useLibraryUrl();
14
+ const [imagePath] = usePaths();
15
+ return /* @__PURE__ */ jsx(Library$1, { src: `${imagePath}/${theme == null ? void 0 : theme.bootstrapVersion}/image-library.svg`, url: libraryUrl, alt: t("explorer.libray.img.alt"), text: t("explorer.libray.title"), textButton: t("explorer.libray.btn") });
16
+ };
17
+ export {
18
+ Library as default
19
+ };
@@ -0,0 +1,94 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Modal, TreeView, Button } from "@edifice-ui/react";
3
+ import { createPortal } from "react-dom";
4
+ import { useTranslation } from "react-i18next";
5
+ import { useState } from "react";
6
+ import { useQueryClient } from "@tanstack/react-query";
7
+ import { s as useMoveItem, h as useSelectedFolders, g as useSelectedResources, u as useStoreActions, t as useTreeData } from "./index2.js";
8
+ import "@edifice-ui/icons";
9
+ import "edifice-ts-client";
10
+ import "i18next";
11
+ import "zustand";
12
+ function useMoveModal({
13
+ onSuccess
14
+ }) {
15
+ const [selectedFolder, setSelectedFolder] = useState();
16
+ const moveItem = useMoveItem();
17
+ const selectedFolders = useSelectedFolders();
18
+ const selectedResources = useSelectedResources();
19
+ const {
20
+ foldTreeItem,
21
+ unfoldTreeItem
22
+ } = useStoreActions();
23
+ const queryclient = useQueryClient();
24
+ async function onMove() {
25
+ try {
26
+ if (!selectedFolder)
27
+ throw new Error("explorer.move.selection.empty");
28
+ await moveItem.mutate(selectedFolder);
29
+ await (onSuccess == null ? void 0 : onSuccess());
30
+ } catch (e) {
31
+ console.error(e);
32
+ }
33
+ }
34
+ const canMove = (destination) => {
35
+ var _a;
36
+ for (const selectedFolder2 of selectedFolders) {
37
+ if (destination === selectedFolder2.id || destination === selectedFolder2.parentId) {
38
+ return false;
39
+ }
40
+ }
41
+ for (const selectedResource of selectedResources) {
42
+ if (destination === ((selectedResource == null ? void 0 : selectedResource.folderIds) && selectedResource.folderIds[0]) || ((_a = selectedResource == null ? void 0 : selectedResource.folderIds) == null ? void 0 : _a.length) === 0 && destination === "default") {
43
+ return false;
44
+ }
45
+ }
46
+ return true;
47
+ };
48
+ return {
49
+ disableSubmit: !selectedFolder,
50
+ handleTreeItemSelect: (folderId) => {
51
+ if (canMove(folderId)) {
52
+ setSelectedFolder(folderId);
53
+ } else {
54
+ setSelectedFolder(void 0);
55
+ }
56
+ },
57
+ handleTreeItemFold: foldTreeItem,
58
+ handleTreeItemUnfold: async (folderId) => await unfoldTreeItem(folderId, queryclient),
59
+ onMove: () => {
60
+ onMove();
61
+ }
62
+ };
63
+ }
64
+ function MoveModal({
65
+ isOpen,
66
+ onSuccess,
67
+ onCancel
68
+ }) {
69
+ const {
70
+ t
71
+ } = useTranslation();
72
+ const {
73
+ handleTreeItemFold,
74
+ handleTreeItemSelect,
75
+ handleTreeItemUnfold,
76
+ onMove,
77
+ disableSubmit
78
+ } = useMoveModal({
79
+ onSuccess
80
+ });
81
+ const treeData = useTreeData();
82
+ return /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { isOpen, onModalClose: onCancel, id: "moveModal", children: [
83
+ /* @__PURE__ */ jsx(Modal.Header, { onModalClose: onCancel, children: t("explorer.move.title") }),
84
+ /* @__PURE__ */ jsx(Modal.Subtitle, { children: t("explorer.move.subtitle") }),
85
+ /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx(TreeView, { data: treeData, onTreeItemSelect: handleTreeItemSelect, onTreeItemFold: handleTreeItemFold, onTreeItemUnfold: handleTreeItemUnfold }) }),
86
+ /* @__PURE__ */ jsxs(Modal.Footer, { children: [
87
+ /* @__PURE__ */ jsx(Button, { color: "tertiary", onClick: onCancel, type: "button", variant: "ghost", children: t("explorer.cancel") }),
88
+ /* @__PURE__ */ jsx(Button, { color: "primary", onClick: onMove, type: "button", variant: "filled", disabled: disableSubmit, children: t("explorer.move") })
89
+ ] })
90
+ ] }), document.getElementById("portal"));
91
+ }
92
+ export {
93
+ MoveModal as default
94
+ };
@@ -0,0 +1,261 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import React, { useCallback } from "react";
3
+ import { Card, Image, AppIcon, Avatar, Tooltip, useOdeClient, Button } from "@edifice-ui/react";
4
+ import { useSpring, animated } from "@react-spring/web";
5
+ import clsx from "clsx";
6
+ import { useTranslation } from "react-i18next";
7
+ import { Users, Globe } from "@edifice-ui/icons";
8
+ import { OneProfile } from "@edifice-ui/icons/nav";
9
+ import require$$0 from "dayjs";
10
+ import { n as useSearchParams, f as useResourceIds, g as useSelectedResources, u as useStoreActions, d as useIsTrash } from "./index2.js";
11
+ import "edifice-ts-client";
12
+ import "i18next";
13
+ import "zustand";
14
+ import "@tanstack/react-query";
15
+ const ResourceCard = ({
16
+ app,
17
+ resource,
18
+ time,
19
+ isSelected = false,
20
+ isSelectable = true,
21
+ onClick,
22
+ onSelect
23
+ }) => {
24
+ const avatar = `/userbook/avatar/${resource == null ? void 0 : resource.creatorId}`;
25
+ function isResourceShared(resource2) {
26
+ const {
27
+ rights,
28
+ creatorId
29
+ } = resource2 || {};
30
+ const filteredRights = rights.filter((right) => !right.includes(creatorId));
31
+ return filteredRights.length >= 1;
32
+ }
33
+ const isShared = isResourceShared(resource);
34
+ const isPublic = resource == null ? void 0 : resource.public;
35
+ const {
36
+ t
37
+ } = useTranslation();
38
+ return /* @__PURE__ */ jsx(Card, { app, isSelected, isSelectable, onClick, onSelect, children: (appCode) => /* @__PURE__ */ jsxs(Fragment, { children: [
39
+ /* @__PURE__ */ jsxs(Card.Body, { children: [
40
+ /* @__PURE__ */ jsx("div", { className: "card-image medium", children: (resource == null ? void 0 : resource.thumbnail) ? /* @__PURE__ */ jsx(Image, { alt: "", src: resource == null ? void 0 : resource.thumbnail, objectFit: "cover", className: "h-full" }) : /* @__PURE__ */ jsx(AppIcon, { app, iconFit: "ratio", size: "80", variant: "rounded" }) }),
41
+ /* @__PURE__ */ jsxs("div", { className: "text-truncate", children: [
42
+ /* @__PURE__ */ jsx(Card.Title, { children: resource == null ? void 0 : resource.name }),
43
+ /* @__PURE__ */ jsx(Card.Text, { children: /* @__PURE__ */ jsx("em", { children: time }) })
44
+ ] })
45
+ ] }),
46
+ /* @__PURE__ */ jsxs(Card.Footer, { children: [
47
+ /* @__PURE__ */ jsxs("div", { className: "d-inline-flex align-items-center gap-8 text-truncate", children: [
48
+ avatar ? /* @__PURE__ */ jsx(Avatar, { alt: (resource == null ? void 0 : resource.creatorName) || "", size: "xs", src: avatar, variant: "circle", width: "24", height: "24" }) : /* @__PURE__ */ jsx(OneProfile, {}),
49
+ /* @__PURE__ */ jsx(Card.Text, { children: resource == null ? void 0 : resource.creatorName })
50
+ ] }),
51
+ /* @__PURE__ */ jsxs("div", { className: "d-inline-flex align-items-center gap-8", children: [
52
+ isShared && /* @__PURE__ */ jsx(Tooltip, { message: t("tooltip.shared", {
53
+ ns: appCode
54
+ }), placement: "top", children: /* @__PURE__ */ jsx(Users, { width: 16, height: 16 }) }),
55
+ isPublic && /* @__PURE__ */ jsx(Tooltip, { message: t("tooltip.public", {
56
+ ns: appCode
57
+ }), placement: "top", children: /* @__PURE__ */ jsx(Globe, { width: 16, height: 16 }) })
58
+ ] })
59
+ ] })
60
+ ] }) });
61
+ };
62
+ ResourceCard.displayName = "ResourceCard";
63
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
64
+ function getDefaultExportFromCjs(x) {
65
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
66
+ }
67
+ var relativeTime$1 = { exports: {} };
68
+ (function(module, exports) {
69
+ !function(r, e) {
70
+ module.exports = e();
71
+ }(commonjsGlobal, function() {
72
+ return function(r, e, t) {
73
+ r = r || {};
74
+ var n = e.prototype, o = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
75
+ function i(r2, e2, t2, o2) {
76
+ return n.fromToBase(r2, e2, t2, o2);
77
+ }
78
+ t.en.relativeTime = o, n.fromToBase = function(e2, n2, i2, d2, u) {
79
+ for (var f, a, s, l = i2.$locale().relativeTime || o, h = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m = h.length, c = 0; c < m; c += 1) {
80
+ var y = h[c];
81
+ y.d && (f = d2 ? t(e2).diff(i2, y.d, true) : i2.diff(e2, y.d, true));
82
+ var p = (r.rounding || Math.round)(Math.abs(f));
83
+ if (s = f > 0, p <= y.r || !y.r) {
84
+ p <= 1 && c > 0 && (y = h[c - 1]);
85
+ var v = l[y.l];
86
+ u && (p = u("" + p)), a = "string" == typeof v ? v.replace("%d", p) : v(p, n2, y.l, s);
87
+ break;
88
+ }
89
+ }
90
+ if (n2)
91
+ return a;
92
+ var M = s ? l.future : l.past;
93
+ return "function" == typeof M ? M(a) : M.replace("%s", a);
94
+ }, n.to = function(r2, e2) {
95
+ return i(r2, e2, this, true);
96
+ }, n.from = function(r2, e2) {
97
+ return i(r2, e2, this);
98
+ };
99
+ var d = function(r2) {
100
+ return r2.$u ? t.utc() : t();
101
+ };
102
+ n.toNow = function(r2) {
103
+ return this.to(d(this), r2);
104
+ }, n.fromNow = function(r2) {
105
+ return this.from(d(this), r2);
106
+ };
107
+ };
108
+ });
109
+ })(relativeTime$1);
110
+ var relativeTimeExports = relativeTime$1.exports;
111
+ const relativeTime = /* @__PURE__ */ getDefaultExportFromCjs(relativeTimeExports);
112
+ var de = { exports: {} };
113
+ (function(module, exports) {
114
+ !function(e, n) {
115
+ module.exports = n(require$$0);
116
+ }(commonjsGlobal, function(e) {
117
+ function n(e2) {
118
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
119
+ }
120
+ var t = n(e), a = { s: "ein paar Sekunden", m: ["eine Minute", "einer Minute"], mm: "%d Minuten", h: ["eine Stunde", "einer Stunde"], hh: "%d Stunden", d: ["ein Tag", "einem Tag"], dd: ["%d Tage", "%d Tagen"], M: ["ein Monat", "einem Monat"], MM: ["%d Monate", "%d Monaten"], y: ["ein Jahr", "einem Jahr"], yy: ["%d Jahre", "%d Jahren"] };
121
+ function i(e2, n2, t2) {
122
+ var i2 = a[t2];
123
+ return Array.isArray(i2) && (i2 = i2[n2 ? 0 : 1]), i2.replace("%d", e2);
124
+ }
125
+ var r = { name: "de", weekdays: "Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"), weekdaysShort: "So._Mo._Di._Mi._Do._Fr._Sa.".split("_"), weekdaysMin: "So_Mo_Di_Mi_Do_Fr_Sa".split("_"), months: "Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"), monthsShort: "Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sept._Okt._Nov._Dez.".split("_"), ordinal: function(e2) {
126
+ return e2 + ".";
127
+ }, weekStart: 1, yearStart: 4, formats: { LTS: "HH:mm:ss", LT: "HH:mm", L: "DD.MM.YYYY", LL: "D. MMMM YYYY", LLL: "D. MMMM YYYY HH:mm", LLLL: "dddd, D. MMMM YYYY HH:mm" }, relativeTime: { future: "in %s", past: "vor %s", s: i, m: i, mm: i, h: i, hh: i, d: i, dd: i, M: i, MM: i, y: i, yy: i } };
128
+ return t.default.locale(r, null, true), r;
129
+ });
130
+ })(de);
131
+ var es = { exports: {} };
132
+ (function(module, exports) {
133
+ !function(e, o) {
134
+ module.exports = o(require$$0);
135
+ }(commonjsGlobal, function(e) {
136
+ function o(e2) {
137
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
138
+ }
139
+ var s = o(e), d = { name: "es", monthsShort: "ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"), weekdays: "domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"), weekdaysShort: "dom._lun._mar._mié._jue._vie._sáb.".split("_"), weekdaysMin: "do_lu_ma_mi_ju_vi_sá".split("_"), months: "enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"), weekStart: 1, formats: { LT: "H:mm", LTS: "H:mm:ss", L: "DD/MM/YYYY", LL: "D [de] MMMM [de] YYYY", LLL: "D [de] MMMM [de] YYYY H:mm", LLLL: "dddd, D [de] MMMM [de] YYYY H:mm" }, relativeTime: { future: "en %s", past: "hace %s", s: "unos segundos", m: "un minuto", mm: "%d minutos", h: "una hora", hh: "%d horas", d: "un día", dd: "%d días", M: "un mes", MM: "%d meses", y: "un año", yy: "%d años" }, ordinal: function(e2) {
140
+ return e2 + "º";
141
+ } };
142
+ return s.default.locale(d, null, true), d;
143
+ });
144
+ })(es);
145
+ var pt = { exports: {} };
146
+ (function(module, exports) {
147
+ !function(e, a) {
148
+ module.exports = a(require$$0);
149
+ }(commonjsGlobal, function(e) {
150
+ function a(e2) {
151
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
152
+ }
153
+ var o = a(e), t = { name: "pt", weekdays: "domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"), weekdaysShort: "dom_seg_ter_qua_qui_sex_sab".split("_"), weekdaysMin: "Do_2ª_3ª_4ª_5ª_6ª_Sa".split("_"), months: "janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"), monthsShort: "jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"), ordinal: function(e2) {
154
+ return e2 + "º";
155
+ }, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "DD/MM/YYYY", LL: "D [de] MMMM [de] YYYY", LLL: "D [de] MMMM [de] YYYY [às] HH:mm", LLLL: "dddd, D [de] MMMM [de] YYYY [às] HH:mm" }, relativeTime: { future: "em %s", past: "há %s", s: "alguns segundos", m: "um minuto", mm: "%d minutos", h: "uma hora", hh: "%d horas", d: "um dia", dd: "%d dias", M: "um mês", MM: "%d meses", y: "um ano", yy: "%d anos" } };
156
+ return o.default.locale(t, null, true), t;
157
+ });
158
+ })(pt);
159
+ var fr = { exports: {} };
160
+ (function(module, exports) {
161
+ !function(e, n) {
162
+ module.exports = n(require$$0);
163
+ }(commonjsGlobal, function(e) {
164
+ function n(e2) {
165
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
166
+ }
167
+ var t = n(e), i = { name: "fr", weekdays: "dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"), weekdaysShort: "dim._lun._mar._mer._jeu._ven._sam.".split("_"), weekdaysMin: "di_lu_ma_me_je_ve_sa".split("_"), months: "janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"), monthsShort: "janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"), weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "DD/MM/YYYY", LL: "D MMMM YYYY", LLL: "D MMMM YYYY HH:mm", LLLL: "dddd D MMMM YYYY HH:mm" }, relativeTime: { future: "dans %s", past: "il y a %s", s: "quelques secondes", m: "une minute", mm: "%d minutes", h: "une heure", hh: "%d heures", d: "un jour", dd: "%d jours", M: "un mois", MM: "%d mois", y: "un an", yy: "%d ans" }, ordinal: function(e2) {
168
+ return "" + e2 + (1 === e2 ? "er" : "");
169
+ } };
170
+ return t.default.locale(i, null, true), i;
171
+ });
172
+ })(fr);
173
+ var it = { exports: {} };
174
+ (function(module, exports) {
175
+ !function(e, o) {
176
+ module.exports = o(require$$0);
177
+ }(commonjsGlobal, function(e) {
178
+ function o(e2) {
179
+ return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
180
+ }
181
+ var t = o(e), n = { name: "it", weekdays: "domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"), weekdaysShort: "dom_lun_mar_mer_gio_ven_sab".split("_"), weekdaysMin: "do_lu_ma_me_gi_ve_sa".split("_"), months: "gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"), weekStart: 1, monthsShort: "gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"), formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "DD/MM/YYYY", LL: "D MMMM YYYY", LLL: "D MMMM YYYY HH:mm", LLLL: "dddd D MMMM YYYY HH:mm" }, relativeTime: { future: "tra %s", past: "%s fa", s: "qualche secondo", m: "un minuto", mm: "%d minuti", h: "un' ora", hh: "%d ore", d: "un giorno", dd: "%d giorni", M: "un mese", MM: "%d mesi", y: "un anno", yy: "%d anni" }, ordinal: function(e2) {
182
+ return e2 + "º";
183
+ } };
184
+ return t.default.locale(n, null, true), n;
185
+ });
186
+ })(it);
187
+ require$$0.extend(relativeTime);
188
+ const ResourcesList = ({
189
+ data,
190
+ fetchNextPage
191
+ }) => {
192
+ const {
193
+ currentApp,
194
+ currentLanguage
195
+ } = useOdeClient();
196
+ const {
197
+ t
198
+ } = useTranslation();
199
+ const searchParams = useSearchParams();
200
+ const resourceIds = useResourceIds();
201
+ const selectedResources = useSelectedResources();
202
+ const {
203
+ setSelectedResources,
204
+ setResourceIds,
205
+ openResource,
206
+ setResourceIsTrash
207
+ } = useStoreActions();
208
+ const isTrashFolder = useIsTrash();
209
+ const springs = useSpring({
210
+ from: {
211
+ opacity: 0
212
+ },
213
+ to: {
214
+ opacity: 1
215
+ }
216
+ });
217
+ const currentMaxIdx = searchParams.pagination.startIdx + searchParams.pagination.pageSize;
218
+ const hasMoreResources = currentMaxIdx < (searchParams.pagination.maxIdx || 0);
219
+ const handleNextPage = useCallback(() => {
220
+ fetchNextPage();
221
+ }, []);
222
+ const clickOnResource = (resource) => {
223
+ if (isTrashFolder) {
224
+ setResourceIsTrash(true);
225
+ setResourceIds([resource.id]);
226
+ setSelectedResources([resource]);
227
+ } else {
228
+ openResource(resource);
229
+ }
230
+ };
231
+ async function toggleSelect(resource) {
232
+ if (resourceIds.includes(resource.id)) {
233
+ setResourceIds(resourceIds.filter((selectedResource) => selectedResource !== resource.id));
234
+ setSelectedResources(selectedResources.filter((selectedResource) => selectedResource.id !== resource.id));
235
+ return;
236
+ }
237
+ setResourceIds([...resourceIds, resource.id]);
238
+ setSelectedResources([...selectedResources, resource]);
239
+ }
240
+ const classes = clsx("grid ps-0 list-unstyled");
241
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [
242
+ /* @__PURE__ */ jsx(animated.ul, { className: classes, children: data == null ? void 0 : data.pages.map((page, index) => (
243
+ // eslint-disable-next-line react/no-array-index-key
244
+ /* @__PURE__ */ jsx(React.Fragment, { children: page.resources.map((resource) => {
245
+ const {
246
+ id,
247
+ updatedAt
248
+ } = resource;
249
+ const time = require$$0(updatedAt).locale(currentLanguage).fromNow();
250
+ return /* @__PURE__ */ jsx(animated.li, { className: "g-col-4 z-1", style: {
251
+ position: "relative",
252
+ ...springs
253
+ }, children: /* @__PURE__ */ jsx(ResourceCard, { app: currentApp, resource, time, isSelectable: true, isSelected: resourceIds.includes(resource.id), onClick: () => clickOnResource(resource), onSelect: () => toggleSelect(resource) }) }, id);
254
+ }) }, index)
255
+ )) }),
256
+ hasMoreResources && /* @__PURE__ */ jsx("div", { className: "d-grid gap-2 col-4 mx-auto my-24", children: /* @__PURE__ */ jsx(Button, { type: "button", color: "secondary", variant: "filled", onClick: handleNextPage, children: t("explorer.see.more") }) })
257
+ ] });
258
+ };
259
+ export {
260
+ ResourcesList as default
261
+ };
@@ -0,0 +1,20 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Modal, Button } from "@edifice-ui/react";
3
+ import { createPortal } from "react-dom";
4
+ import { useTranslation } from "react-i18next";
5
+ function TrashedResourceModal({
6
+ isOpen,
7
+ onCancel = () => ({})
8
+ }) {
9
+ const {
10
+ t
11
+ } = useTranslation();
12
+ return /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { isOpen, onModalClose: onCancel, id: "trash_resource", children: [
13
+ /* @__PURE__ */ jsx(Modal.Header, { onModalClose: () => onCancel(), children: t("explorer.trash.modal.title") }),
14
+ /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx("p", { className: "body", children: t("explorer.trash.modal.text") }) }),
15
+ /* @__PURE__ */ jsx(Modal.Footer, { children: /* @__PURE__ */ jsx(Button, { color: "primary", onClick: onCancel, type: "button", variant: "outline", children: t("close") }) })
16
+ ] }), document.getElementById("portal"));
17
+ }
18
+ export {
19
+ TrashedResourceModal as default
20
+ };
@@ -0,0 +1,2 @@
1
+ declare function Root(): import("react/jsx-runtime").JSX.Element;
2
+ export default Root;
@@ -0,0 +1 @@
1
+ export default function AppAction(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function EmptyScreenApp(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function EmptyScreenError(): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function EmptyScreenNoContentInFolder(): JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function EmptyScreenSearch(): JSX.Element;
@@ -0,0 +1 @@
1
+ export default function EmptyScreenTrash(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { AppParams } from "../utils/getAppParams";
2
+ declare const Explorer: ({ config }: {
3
+ config: AppParams;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default Explorer;
@@ -0,0 +1 @@
1
+ export declare function ExplorerBreadcrumb(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const LoadMore: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLButtonElement>>;
3
+ export default LoadMore;
@@ -0,0 +1,11 @@
1
+ import { type App, type ResourceType, type IAction, type IFilter, type IOrder } from "edifice-ts-client";
2
+ export interface AppParams {
3
+ app: App;
4
+ types: ResourceType[];
5
+ filters: IFilter[];
6
+ orders: IOrder[];
7
+ actions: IAction[];
8
+ trashActions: IAction[];
9
+ libraryAppFilter?: string;
10
+ }
11
+ export declare function getExplorerConfig(): AppParams;