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
package/dist/version.txt CHANGED
@@ -1 +1 @@
1
- ode-explorer=1.0-SNAPSHOT 09/01/2024 16:06:03
1
+ ode-explorer=1.0-SNAPSHOT 09/01/2024 17:44:25
package/explorer.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/ode-explorer";
@@ -0,0 +1,375 @@
1
+ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect, Suspense, lazy } from "react";
3
+ import { useUser, Button, ActionBar, LoadingScreen } from "@edifice-ui/react";
4
+ import { useTransition, animated } from "@react-spring/web";
5
+ import { useTranslation } from "react-i18next";
6
+ import { odeServices, ACTION } from "edifice-ts-client";
7
+ import { d as useIsTrash, e as useStoreContext, b as useCurrentFolder, f as useResourceIds, g as useSelectedResources, h as useSelectedFolders, i as useFolderIds, j as useRestore, k as useResourceIsTrash, u as useStoreActions, a as useActions, l as useShareResource, m as useUpdateResource } from "./index2.js";
8
+ import "@edifice-ui/icons";
9
+ import "i18next";
10
+ import "zustand";
11
+ import "@tanstack/react-query";
12
+ function useAccessControl({
13
+ roles,
14
+ rights,
15
+ action
16
+ }) {
17
+ const [visible, setVisible] = useState(false);
18
+ const {
19
+ user
20
+ } = useUser();
21
+ const isTrashFolder = useIsTrash();
22
+ useEffect(() => {
23
+ refreshState();
24
+ }, [roles, rights]);
25
+ const checkRights = async function(rights2) {
26
+ const safeRight = rights2 instanceof Array ? rights2 : [rights2];
27
+ if (roles instanceof Array) {
28
+ const can = await odeServices.rights().sessionHasAtLeastOneResourceRight(roles, safeRight);
29
+ setVisible(can);
30
+ } else {
31
+ const can = await odeServices.rights().sessionHasResourceRight(roles, safeRight);
32
+ setVisible(can);
33
+ }
34
+ };
35
+ const checkRightForMultipleResources = async function(rights2) {
36
+ if (roles instanceof Array) {
37
+ const can = await odeServices.rights().sessionHasAtLeastOneResourceRightForEachList(roles, rights2);
38
+ setVisible(can);
39
+ } else {
40
+ const can = await odeServices.rights().sessionHasResourceRightForEachList(roles, rights2);
41
+ setVisible(can);
42
+ }
43
+ };
44
+ const refreshState = async function() {
45
+ var _a, _b, _c;
46
+ if (roles === void 0) {
47
+ setVisible(true);
48
+ return;
49
+ }
50
+ if (isTrashFolder && ((_b = (_a = rights[0]) == null ? void 0 : _a.trashedBy) == null ? void 0 : _b.includes(user == null ? void 0 : user.userId)) && action === "restore" && !((_c = rights[0]) == null ? void 0 : _c.trashed)) {
51
+ setVisible(true);
52
+ return;
53
+ }
54
+ if (rights instanceof Array) {
55
+ if (rights.length > 0) {
56
+ if (typeof rights[0] === "string") {
57
+ await checkRights(rights);
58
+ } else {
59
+ const rightsArray = rights.map((e) => e.rights);
60
+ await checkRightForMultipleResources(rightsArray);
61
+ }
62
+ } else {
63
+ setVisible(false);
64
+ }
65
+ } else {
66
+ if (typeof rights === "string") {
67
+ await checkRights(rights);
68
+ } else {
69
+ await checkRights(rights.rights);
70
+ }
71
+ }
72
+ };
73
+ return {
74
+ visible,
75
+ refreshState
76
+ };
77
+ }
78
+ function useActionBar() {
79
+ const [isActionBarOpen, setIsActionBarOpen] = useState(false);
80
+ const [openedModalName, setOpenedModalName] = useState("void");
81
+ const [clickedAction, setClickedAction] = useState();
82
+ const config = useStoreContext((state) => state.config);
83
+ const currentFolder = useCurrentFolder();
84
+ const resourceIds = useResourceIds();
85
+ const selectedResources = useSelectedResources();
86
+ const selectedFolders = useSelectedFolders();
87
+ const folderIds = useFolderIds();
88
+ const isTrashFolder = useIsTrash();
89
+ const restoreItem = useRestore();
90
+ const isTrashResource = useResourceIsTrash();
91
+ const {
92
+ openResource,
93
+ printSelectedResource,
94
+ openFolder,
95
+ clearSelectedItems,
96
+ clearSelectedIds
97
+ } = useStoreActions();
98
+ const {
99
+ data: actions
100
+ } = useActions();
101
+ useEffect(() => {
102
+ if (resourceIds.length === 0 && folderIds.length === 0) {
103
+ setIsActionBarOpen(false);
104
+ return;
105
+ }
106
+ if (isTrashResource) {
107
+ setIsActionBarOpen(false);
108
+ return;
109
+ }
110
+ setIsActionBarOpen(true);
111
+ }, [resourceIds, folderIds]);
112
+ async function handleClick(action) {
113
+ var _a;
114
+ (_a = document.getElementById("root")) == null ? void 0 : _a.setAttribute("aria-hidden", "true");
115
+ setClickedAction(action);
116
+ switch (action.id) {
117
+ case ACTION.OPEN:
118
+ if (resourceIds.length > 0) {
119
+ return openResource(selectedResources[0]);
120
+ } else {
121
+ return openFolder({
122
+ folder: selectedFolders[0],
123
+ folderId: selectedFolders[0].id
124
+ });
125
+ }
126
+ case ACTION.MOVE:
127
+ return setOpenedModalName("move");
128
+ case ACTION.PRINT:
129
+ return printSelectedResource();
130
+ case ACTION.DELETE:
131
+ return setOpenedModalName("delete");
132
+ case ACTION.RESTORE:
133
+ return await onRestore();
134
+ case ACTION.PUBLISH:
135
+ return setOpenedModalName("publish");
136
+ case ACTION.UPD_PROPS:
137
+ case "edit":
138
+ return onEdit();
139
+ case ACTION.SHARE:
140
+ return setOpenedModalName("share");
141
+ default:
142
+ throw Error(`Unknown action: ${action.id}`);
143
+ }
144
+ }
145
+ function isActivable(action) {
146
+ const all = resourceIds.length + folderIds.length;
147
+ const onlyOneItemSelected = resourceIds.length === 1 || folderIds.length === 1;
148
+ const onlyOneSelected = all === 1;
149
+ const noFolderSelected = folderIds.length === 0;
150
+ switch (action.id) {
151
+ case ACTION.OPEN:
152
+ return onlyOneSelected;
153
+ case ACTION.MANAGE:
154
+ return onlyOneItemSelected;
155
+ case ACTION.PUBLISH:
156
+ return onlyOneItemSelected && noFolderSelected;
157
+ case ACTION.UPD_PROPS:
158
+ return onlyOneItemSelected && noFolderSelected;
159
+ case ACTION.SHARE:
160
+ return noFolderSelected && onlyOneItemSelected;
161
+ case ACTION.PRINT:
162
+ return onlyOneItemSelected && noFolderSelected;
163
+ case "edit":
164
+ return onlyOneSelected;
165
+ default:
166
+ return true;
167
+ }
168
+ }
169
+ const isActivableForTrash = () => true;
170
+ async function onRestore() {
171
+ try {
172
+ if (isTrashFolder) {
173
+ await restoreItem.mutate();
174
+ } else {
175
+ throw new Error("Cannot restore untrashed resources");
176
+ }
177
+ onClearActionBar();
178
+ } catch (e) {
179
+ console.error(e);
180
+ }
181
+ }
182
+ function onClearActionBar() {
183
+ var _a;
184
+ setOpenedModalName("void");
185
+ if (clickedAction == null ? void 0 : clickedAction.id) {
186
+ (_a = document.getElementById(clickedAction == null ? void 0 : clickedAction.id)) == null ? void 0 : _a.focus();
187
+ }
188
+ }
189
+ const onFinish = (modalName) => () => {
190
+ if (openedModalName === modalName) {
191
+ onClearActionBar();
192
+ clearSelectedItems();
193
+ clearSelectedIds();
194
+ }
195
+ };
196
+ const onMoveCancel = onFinish("move");
197
+ const onMoveSuccess = onFinish("move");
198
+ const onDeleteSuccess = onFinish("delete");
199
+ const onDeleteCancel = onFinish("delete");
200
+ const onPublishSuccess = onFinish("publish");
201
+ const onPublishCancel = onFinish("publish");
202
+ const onEditFolderSuccess = onFinish("edit_folder");
203
+ const onEditFolderCancel = onFinish("edit_folder");
204
+ const onEditResourceSuccess = onFinish("edit_resource");
205
+ const onEditResourceCancel = onFinish("edit_resource");
206
+ const onShareResourceSuccess = onFinish("share");
207
+ const onShareResourceCancel = onFinish("share");
208
+ function onEdit() {
209
+ if (resourceIds && resourceIds.length > 0) {
210
+ setOpenedModalName("edit_resource");
211
+ } else {
212
+ setOpenedModalName("edit_folder");
213
+ }
214
+ }
215
+ function overrideLabel(action) {
216
+ if (action.id === "edit" && folderIds.length > 0) {
217
+ return "explorer.rename";
218
+ }
219
+ return `explorer.actions.${action.id}`;
220
+ }
221
+ return {
222
+ onRestore,
223
+ actions: isTrashFolder ? config == null ? void 0 : config.trashActions : actions,
224
+ selectedElement: [...selectedResources, ...selectedFolders],
225
+ currentFolderId: currentFolder == null ? void 0 : currentFolder.id,
226
+ overrideLabel,
227
+ handleClick,
228
+ isActivable: isTrashFolder ? isActivableForTrash : isActivable,
229
+ isActionBarOpen,
230
+ isMoveModalOpen: openedModalName === "move",
231
+ onMoveCancel,
232
+ onMoveSuccess,
233
+ isDeleteModalOpen: openedModalName === "delete",
234
+ onDeleteCancel,
235
+ onDeleteSuccess,
236
+ isPublishModalOpen: openedModalName === "publish",
237
+ onPublishCancel,
238
+ onPublishSuccess,
239
+ isEditFolderOpen: openedModalName === "edit_folder",
240
+ onEditFolderCancel,
241
+ onEditFolderSuccess,
242
+ isEditResourceOpen: openedModalName === "edit_resource",
243
+ onEditResourceCancel,
244
+ onEditResourceSuccess,
245
+ isShareResourceOpen: openedModalName === "share",
246
+ onShareResourceCancel,
247
+ onShareResourceSuccess,
248
+ onClearActionBar
249
+ };
250
+ }
251
+ function AccessControl({
252
+ resourceRights,
253
+ roleExpected,
254
+ action,
255
+ children,
256
+ renderWhenForbidden
257
+ }) {
258
+ const {
259
+ t
260
+ } = useTranslation();
261
+ const {
262
+ overrideLabel
263
+ } = useActionBar();
264
+ const {
265
+ visible
266
+ } = useAccessControl({
267
+ roles: roleExpected,
268
+ rights: resourceRights,
269
+ action: action == null ? void 0 : action.id
270
+ });
271
+ const {
272
+ setResourceActionDisable
273
+ } = useStoreActions();
274
+ const isTrashFolder = useIsTrash();
275
+ if (visible) {
276
+ return /* @__PURE__ */ jsx(Fragment, { children });
277
+ } else if (renderWhenForbidden) {
278
+ return renderWhenForbidden();
279
+ } else if (isTrashFolder && !visible) {
280
+ return /* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", onClick: () => {
281
+ setResourceActionDisable(true);
282
+ }, children: t(overrideLabel(action)) });
283
+ } else {
284
+ return /* @__PURE__ */ jsx(Fragment, {});
285
+ }
286
+ }
287
+ const ShareModal = /* @__PURE__ */ lazy(async () => {
288
+ const module = await import("@edifice-ui/react");
289
+ return {
290
+ default: module.ShareModal
291
+ };
292
+ });
293
+ const PublishModal = /* @__PURE__ */ lazy(async () => {
294
+ const module = await import("@edifice-ui/react");
295
+ return {
296
+ default: module.PublishModal
297
+ };
298
+ });
299
+ const UpdateModal = /* @__PURE__ */ lazy(async () => {
300
+ const module = await import("@edifice-ui/react");
301
+ return {
302
+ default: module.ResourceModal
303
+ };
304
+ });
305
+ const DeleteModal = /* @__PURE__ */ lazy(async () => await import("./DeleteModal.js"));
306
+ const MoveModal = /* @__PURE__ */ lazy(async () => await import("./MoveModal.js"));
307
+ const FolderModal = /* @__PURE__ */ lazy(async () => await import("./FolderModal.js"));
308
+ function ActionBarContainer() {
309
+ const {
310
+ t
311
+ } = useTranslation();
312
+ const {
313
+ actions,
314
+ selectedElement,
315
+ isMoveModalOpen,
316
+ isDeleteModalOpen,
317
+ isPublishModalOpen,
318
+ isActionBarOpen,
319
+ isEditFolderOpen,
320
+ overrideLabel,
321
+ onEditFolderCancel,
322
+ onEditFolderSuccess,
323
+ isEditResourceOpen,
324
+ onEditResourceCancel,
325
+ onEditResourceSuccess,
326
+ isShareResourceOpen,
327
+ onShareResourceCancel,
328
+ onShareResourceSuccess,
329
+ onMoveCancel,
330
+ onMoveSuccess,
331
+ onDeleteCancel,
332
+ onDeleteSuccess,
333
+ onPublishCancel,
334
+ onPublishSuccess,
335
+ isActivable,
336
+ handleClick
337
+ } = useActionBar();
338
+ const selectedResources = useSelectedResources();
339
+ const shareResource = useShareResource();
340
+ const updateResource = useUpdateResource();
341
+ const transition = useTransition(isActionBarOpen, {
342
+ from: {
343
+ opacity: 0,
344
+ transform: "translateY(100%)"
345
+ },
346
+ enter: {
347
+ opacity: 1,
348
+ transform: "translateY(0)"
349
+ },
350
+ leave: {
351
+ opacity: 0,
352
+ transform: "translateY(100%)"
353
+ }
354
+ });
355
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
356
+ transition((style, isActionBarOpen2) => {
357
+ return isActionBarOpen2 && /* @__PURE__ */ jsx(animated.div, { className: "position-fixed bottom-0 start-0 end-0 z-3", style, children: /* @__PURE__ */ jsx(ActionBar, { children: actions == null ? void 0 : actions.filter((action) => action.available && action.target === "actionbar").map((action) => {
358
+ return isActivable(action) && /* @__PURE__ */ jsx(AccessControl, { resourceRights: selectedElement, roleExpected: action.right, action, children: /* @__PURE__ */ jsx(Button, { id: action.id, type: "button", color: "primary", variant: "filled", onClick: () => {
359
+ handleClick(action);
360
+ }, children: t(overrideLabel(action)) }, action.id) }, action.id);
361
+ }) }) });
362
+ }),
363
+ /* @__PURE__ */ jsxs(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: [
364
+ isMoveModalOpen && /* @__PURE__ */ jsx(MoveModal, { isOpen: isMoveModalOpen, onCancel: onMoveCancel, onSuccess: onMoveSuccess }),
365
+ isDeleteModalOpen && /* @__PURE__ */ jsx(DeleteModal, { isOpen: isDeleteModalOpen, onCancel: onDeleteCancel, onSuccess: onDeleteSuccess }),
366
+ isPublishModalOpen && /* @__PURE__ */ jsx(PublishModal, { isOpen: isPublishModalOpen, resource: selectedResources[0], onCancel: onPublishCancel, onSuccess: onPublishSuccess }),
367
+ isEditFolderOpen && /* @__PURE__ */ jsx(FolderModal, { edit: true, isOpen: isEditFolderOpen, onCancel: onEditFolderCancel, onSuccess: onEditFolderSuccess }),
368
+ isEditResourceOpen && /* @__PURE__ */ jsx(UpdateModal, { mode: "update", actions, isOpen: isEditResourceOpen, selectedResource: selectedResources[0], updateResource, onCancel: onEditResourceCancel, onSuccess: onEditResourceSuccess }),
369
+ isShareResourceOpen && /* @__PURE__ */ jsx(ShareModal, { isOpen: isShareResourceOpen, resource: selectedResources[0], updateResource, shareResource, onCancel: onShareResourceCancel, onSuccess: onShareResourceSuccess })
370
+ ] })
371
+ ] });
372
+ }
373
+ export {
374
+ ActionBarContainer as default
375
+ };
@@ -0,0 +1,47 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { Suspense, lazy } from "react";
3
+ import { Plus } from "@edifice-ui/icons";
4
+ import { useToggle, useOdeClient, Button, LoadingScreen } from "@edifice-ui/react";
5
+ import { useTranslation } from "react-i18next";
6
+ import { u as useStoreActions, a as useActions, b as useCurrentFolder, c as useCreateResource } from "./index2.js";
7
+ import "edifice-ts-client";
8
+ import "i18next";
9
+ import "zustand";
10
+ import "@tanstack/react-query";
11
+ const CreateModal = /* @__PURE__ */ lazy(async () => {
12
+ const module = await import("@edifice-ui/react");
13
+ return {
14
+ default: module.ResourceModal
15
+ };
16
+ });
17
+ function AppAction() {
18
+ const [isCreateResourceOpen, toggle] = useToggle();
19
+ const {
20
+ appCode
21
+ } = useOdeClient();
22
+ const {
23
+ t
24
+ } = useTranslation(appCode);
25
+ const {
26
+ clearSelectedItems,
27
+ clearSelectedIds
28
+ } = useStoreActions();
29
+ const {
30
+ data: actions
31
+ } = useActions();
32
+ const canCreate = actions == null ? void 0 : actions.find((action) => action.id === "create");
33
+ const currentFolder = useCurrentFolder();
34
+ const createResource = useCreateResource();
35
+ const handleOnResourceCreate = () => {
36
+ clearSelectedItems();
37
+ clearSelectedIds();
38
+ toggle();
39
+ };
40
+ return canCreate ? /* @__PURE__ */ jsxs(Fragment, { children: [
41
+ /* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", leftIcon: /* @__PURE__ */ jsx(Plus, {}), className: "ms-auto", onClick: handleOnResourceCreate, children: t("explorer.create.title") }),
42
+ /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: isCreateResourceOpen && /* @__PURE__ */ jsx(CreateModal, { mode: "create", actions, currentFolder, createResource, isOpen: isCreateResourceOpen, onSuccess: toggle, onCancel: toggle }) })
43
+ ] }) : null;
44
+ }
45
+ export {
46
+ AppAction as default
47
+ };
@@ -0,0 +1,60 @@
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
+ import { q as useDelete, r as useTrash, d as useIsTrash } from "./index2.js";
6
+ import "react";
7
+ import "@edifice-ui/icons";
8
+ import "edifice-ts-client";
9
+ import "i18next";
10
+ import "zustand";
11
+ import "@tanstack/react-query";
12
+ function useDeleteModal({
13
+ onSuccess
14
+ }) {
15
+ const deleteItem = useDelete();
16
+ const trashItem = useTrash();
17
+ const isTrashFolder = useIsTrash();
18
+ async function onDelete() {
19
+ try {
20
+ if (isTrashFolder) {
21
+ await deleteItem.mutate();
22
+ } else {
23
+ await trashItem.mutate();
24
+ }
25
+ onSuccess == null ? void 0 : onSuccess();
26
+ } catch (e) {
27
+ console.error(e);
28
+ }
29
+ }
30
+ return {
31
+ isTrashFolder,
32
+ onDelete
33
+ };
34
+ }
35
+ function DeleteModal({
36
+ isOpen,
37
+ onSuccess = () => ({}),
38
+ onCancel = () => ({})
39
+ }) {
40
+ const {
41
+ t
42
+ } = useTranslation();
43
+ const {
44
+ isTrashFolder,
45
+ onDelete
46
+ } = useDeleteModal({
47
+ onSuccess
48
+ });
49
+ return /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { isOpen, onModalClose: onCancel, id: "deleteModal", children: [
50
+ /* @__PURE__ */ jsx(Modal.Header, { onModalClose: onCancel, children: t(isTrashFolder ? "explorer.delete.title" : "explorer.trash.title") }),
51
+ /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx("p", { className: "body", children: t(isTrashFolder ? "explorer.delete.subtitle" : "explorer.trash.subtitle") }) }),
52
+ /* @__PURE__ */ jsxs(Modal.Footer, { children: [
53
+ /* @__PURE__ */ jsx(Button, { color: "tertiary", onClick: onCancel, type: "button", variant: "ghost", children: t("explorer.cancel") }),
54
+ /* @__PURE__ */ jsx(Button, { color: "danger", onClick: onDelete, type: "button", variant: "filled", children: t(isTrashFolder ? "explorer.delete" : "explorer.trash") })
55
+ ] })
56
+ ] }), document.getElementById("portal"));
57
+ }
58
+ export {
59
+ DeleteModal as default
60
+ };
@@ -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 ActionResourceDisableModal({
6
+ isOpen,
7
+ onCancel = () => ({})
8
+ }) {
9
+ const {
10
+ t
11
+ } = useTranslation();
12
+ return /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { isOpen, onModalClose: onCancel, id: "trash_action_disable_resource", children: [
13
+ /* @__PURE__ */ jsx(Modal.Header, { onModalClose: () => onCancel(), children: t("explorer.trash.action.modal.title") }),
14
+ /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx("p", { className: "body", children: t("explorer.trash.action.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
+ ActionResourceDisableModal as default
20
+ };
@@ -0,0 +1,53 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useOdeClient, useOdeTheme, usePaths, EmptyScreen } from "@edifice-ui/react";
3
+ import { useTranslation } from "react-i18next";
4
+ import { a as useActions } from "./index2.js";
5
+ import "react";
6
+ import "@edifice-ui/icons";
7
+ import "edifice-ts-client";
8
+ import "i18next";
9
+ import "zustand";
10
+ import "@tanstack/react-query";
11
+ function EmptyScreenApp() {
12
+ const {
13
+ appCode
14
+ } = useOdeClient();
15
+ const {
16
+ theme
17
+ } = useOdeTheme();
18
+ const [imagePath] = usePaths();
19
+ const {
20
+ t
21
+ } = useTranslation();
22
+ const {
23
+ data: actions
24
+ } = useActions();
25
+ const canCreate = actions == null ? void 0 : actions.find((action) => action.id === "create");
26
+ const labelEmptyScreenApp = () => {
27
+ if ((canCreate == null ? void 0 : canCreate.available) && (theme == null ? void 0 : theme.is1d)) {
28
+ return t("explorer.emptyScreen.txt1d.create", {
29
+ ns: appCode
30
+ });
31
+ } else if ((canCreate == null ? void 0 : canCreate.available) && !(theme == null ? void 0 : theme.is1d)) {
32
+ return t("explorer.emptyScreen.txt2d.create", {
33
+ ns: appCode
34
+ });
35
+ } else if (!(canCreate == null ? void 0 : canCreate.available) && (theme == null ? void 0 : theme.is1d)) {
36
+ return t("explorer.emptyScreen.txt1d.consultation", {
37
+ ns: appCode
38
+ });
39
+ } else {
40
+ return t("explorer.emptyScreen.txt2d.consultation", {
41
+ ns: appCode
42
+ });
43
+ }
44
+ };
45
+ return /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: `${imagePath}/emptyscreen/illu-${appCode}.svg`, imageAlt: t("explorer.emptyScreen.app.alt", {
46
+ ns: appCode
47
+ }), title: `${(canCreate == null ? void 0 : canCreate.available) ? t("explorer.emptyScreen.title.create", {
48
+ ns: appCode
49
+ }) : t("explorer.emptyScreen.title.consultation")}`, text: labelEmptyScreenApp() });
50
+ }
51
+ export {
52
+ EmptyScreenApp as default
53
+ };
@@ -0,0 +1,13 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { usePaths, EmptyScreen } from "@edifice-ui/react";
3
+ import { useTranslation } from "react-i18next";
4
+ function EmptyScreenError() {
5
+ const [imagePath] = usePaths();
6
+ const {
7
+ t
8
+ } = useTranslation();
9
+ return /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: `${imagePath}/emptyscreen/illu-error.svg`, imageAlt: t("explorer.emptyScreen.error.alt"), text: "explorer.emptyScreen.error.text" });
10
+ }
11
+ export {
12
+ EmptyScreenError as default
13
+ };
@@ -0,0 +1,20 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { usePaths, useOdeClient, EmptyScreen } from "@edifice-ui/react";
3
+ import { useTranslation } from "react-i18next";
4
+ function EmptyScreenNoContentInFolder() {
5
+ const [imagePath] = usePaths();
6
+ const {
7
+ appCode
8
+ } = useOdeClient();
9
+ const {
10
+ t
11
+ } = useTranslation();
12
+ return /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: `${imagePath}/emptyscreen/illu-no-content-in-folder.svg`, imageAlt: t("explorer.emptyScreen.folder.empty.alt", {
13
+ ns: appCode
14
+ }), text: t("explorer.emptyScreen.label", {
15
+ ns: appCode
16
+ }) });
17
+ }
18
+ export {
19
+ EmptyScreenNoContentInFolder as default
20
+ };
@@ -0,0 +1,20 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useOdeClient, usePaths, EmptyScreen } from "@edifice-ui/react";
3
+ import { useTranslation } from "react-i18next";
4
+ function EmptyScreenSearch() {
5
+ const {
6
+ appCode
7
+ } = useOdeClient();
8
+ const [imagePath] = usePaths();
9
+ const {
10
+ t
11
+ } = useTranslation();
12
+ return /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: `${imagePath}/emptyscreen/illu-search.svg`, imageAlt: t("explorer.emptyScreen.search.alt", {
13
+ ns: appCode
14
+ }), text: t("explorer.emptyScreen.search.text", {
15
+ ns: appCode
16
+ }) });
17
+ }
18
+ export {
19
+ EmptyScreenSearch as default
20
+ };
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useOdeClient, usePaths, EmptyScreen } from "@edifice-ui/react";
3
+ import { useTranslation } from "react-i18next";
4
+ function EmptyScreenTrash() {
5
+ const {
6
+ appCode
7
+ } = useOdeClient();
8
+ const [imagePath] = usePaths();
9
+ const {
10
+ t
11
+ } = useTranslation();
12
+ return /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: `${imagePath}/emptyscreen/illu-trash.svg`, imageAlt: t("explorer.emptyScreen.trash.alt"), title: t("explorer.emptyScreen.trash.title"), text: t("explorer.emptyScreen.trash.empty", {
13
+ ns: appCode
14
+ }) });
15
+ }
16
+ export {
17
+ EmptyScreenTrash as default
18
+ };