@webiny/app-aco 6.4.5 → 6.6.0-alpha.0
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/components/Actions/DeleteFolder/DeleteFolder.js +1 -1
- package/components/Actions/DeleteFolder/DeleteFolder.js.map +1 -1
- package/components/AdvancedSearch/domain/Filter.d.ts +1 -1
- package/components/AdvancedSearch/domain/FilterRepositoryFactory.d.ts +2 -2
- package/components/AdvancedSearch/domain/FilterRepositoryFactory.js.map +1 -1
- package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.d.ts +2 -2
- package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js +9 -10
- package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js.map +1 -1
- package/components/AdvancedSearch/gateways/filters.gql.d.ts +5 -5
- package/components/AdvancedSearch/gateways/filters.gql.js +5 -6
- package/components/AdvancedSearch/gateways/filters.gql.js.map +1 -1
- package/components/AdvancedSearch/useFilterRepository.js +7 -2
- package/components/AdvancedSearch/useFilterRepository.js.map +1 -1
- package/components/Table/cells/CellAuthor.d.ts +2 -0
- package/components/Table/cells/CellAuthor.js +10 -0
- package/components/Table/cells/CellAuthor.js.map +1 -0
- package/components/Table/cells/CellCreated.d.ts +2 -0
- package/components/Table/cells/CellCreated.js +13 -0
- package/components/Table/cells/CellCreated.js.map +1 -0
- package/components/Table/cells/CellModified.d.ts +2 -0
- package/components/Table/cells/CellModified.js +13 -0
- package/components/Table/cells/CellModified.js.map +1 -0
- package/components/Table/cells/index.d.ts +3 -0
- package/components/Table/cells/index.js +3 -0
- package/components/Table/createTableData.d.ts +7 -5
- package/components/Table/createTableData.js +22 -7
- package/components/Table/createTableData.js.map +1 -1
- package/components/Table/index.d.ts +2 -2
- package/components/Table/index.js +2 -2
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/config/AcoConfig.d.ts +8 -12
- package/config/advanced-search/FieldRenderer.d.ts +3 -1
- package/config/folder/Action.d.ts +1 -1
- package/config/folder/index.d.ts +3 -2
- package/config/index.d.ts +0 -1
- package/config/index.js +0 -1
- package/config/record/Action.d.ts +1 -1
- package/config/record/index.d.ts +1 -1
- package/config/table/Column.d.ts +8 -39
- package/config/table/Column.js +4 -67
- package/config/table/Column.js.map +1 -1
- package/config/table/Sorting.d.ts +2 -11
- package/config/table/Sorting.js +1 -28
- package/config/table/index.d.ts +5 -9
- package/contexts/index.d.ts +0 -3
- package/contexts/index.js +0 -3
- package/dialogs/DialogSetPermissions/graphql.d.ts +1 -1
- package/dialogs/DialogSetPermissions/graphql.js +1 -2
- package/dialogs/DialogSetPermissions/graphql.js.map +1 -1
- package/dialogs/useCreateDialog.js +2 -2
- package/dialogs/useCreateDialog.js.map +1 -1
- package/dialogs/useEditDialog.js +2 -2
- package/dialogs/useEditDialog.js.map +1 -1
- package/dialogs/useSetPermissionsDialog.js +16 -4
- package/dialogs/useSetPermissionsDialog.js.map +1 -1
- package/domain/folder/Folder.d.ts +2 -1
- package/domain/folder/Folder.js.map +1 -1
- package/features/folders/createFolder/CreateFolderGqlGateway.d.ts +3 -3
- package/features/folders/createFolder/CreateFolderGqlGateway.js +15 -16
- package/features/folders/createFolder/CreateFolderGqlGateway.js.map +1 -1
- package/features/folders/deleteFolder/DeleteFolderGqlGateway.d.ts +3 -3
- package/features/folders/deleteFolder/DeleteFolderGqlGateway.js +5 -6
- package/features/folders/deleteFolder/DeleteFolderGqlGateway.js.map +1 -1
- package/features/folders/folderModelProvider/FolderModelProvider.js +29 -31
- package/features/folders/folderModelProvider/FolderModelProvider.js.map +1 -1
- package/features/folders/folderModelProvider/GetFolderModelGqlGateway.d.ts +3 -3
- package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js +5 -7
- package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js.map +1 -1
- package/features/folders/getFolder/GetFolderGqlGateway.d.ts +3 -3
- package/features/folders/getFolder/GetFolderGqlGateway.js +5 -7
- package/features/folders/getFolder/GetFolderGqlGateway.js.map +1 -1
- package/features/folders/getFolderExtensionsFields/GetFolderExtensionsFieldsUseCase.d.ts +3 -3
- package/features/folders/getFolderExtensionsFields/useFolderExtensionsFields.d.ts +3 -3
- package/features/folders/listFolders/ListFoldersGqlGateway.d.ts +1 -1
- package/features/folders/listFolders/ListFoldersGqlGateway.js +1 -2
- package/features/folders/listFolders/ListFoldersGqlGateway.js.map +1 -1
- package/features/folders/listFolders/useListFolders.d.ts +1 -1
- package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.d.ts +3 -3
- package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js +5 -7
- package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js.map +1 -1
- package/features/folders/listFoldersByParentIds/useListFoldersByParentIds.d.ts +2 -2
- package/features/folders/loadFolderHierarchy/useLoadFolderHierarchy.d.ts +2 -2
- package/features/folders/updateFolder/UpdateFolderGqlGateway.d.ts +3 -3
- package/features/folders/updateFolder/UpdateFolderGqlGateway.js +5 -6
- package/features/folders/updateFolder/UpdateFolderGqlGateway.js.map +1 -1
- package/hooks/index.d.ts +0 -6
- package/hooks/index.js +0 -6
- package/index.d.ts +3 -2
- package/index.js +2 -2
- package/package.json +16 -23
- package/presentation/folderTree/FolderTreePresenter.js +8 -8
- package/presentation/folderTree/FolderTreePresenter.js.map +1 -1
- package/presentation/folderTree/FolderTreePresenter.test.js +4 -2
- package/presentation/folderTree/FolderTreePresenter.test.js.map +1 -1
- package/table.types.d.ts +2 -9
- package/types.d.ts +5 -26
- package/types.js.map +1 -1
- package/components/Extensions/Extensions.d.ts +0 -2
- package/components/Extensions/Extensions.js +0 -30
- package/components/Extensions/Extensions.js.map +0 -1
- package/components/Extensions/index.d.ts +0 -1
- package/components/Extensions/index.js +0 -1
- package/config/folder/createFolderFieldDecoratorFactory.d.ts +0 -13
- package/config/folder/createFolderFieldDecoratorFactory.js +0 -17
- package/config/folder/createFolderFieldDecoratorFactory.js.map +0 -1
- package/config/table/Sorting.js.map +0 -1
- package/contexts/acoList.d.ts +0 -49
- package/contexts/acoList.js +0 -303
- package/contexts/acoList.js.map +0 -1
- package/contexts/app.d.ts +0 -33
- package/contexts/app.js +0 -47
- package/contexts/app.js.map +0 -1
- package/contexts/folders.d.ts +0 -12
- package/contexts/folders.js +0 -32
- package/contexts/folders.js.map +0 -1
- package/contexts/navigateFolder.d.ts +0 -17
- package/contexts/navigateFolder.js +0 -54
- package/contexts/navigateFolder.js.map +0 -1
- package/contexts/records.d.ts +0 -31
- package/contexts/records.js +0 -316
- package/contexts/records.js.map +0 -1
- package/exports/admin/aco.d.ts +0 -2
- package/exports/admin/aco.js +0 -2
- package/graphql/app.gql.d.ts +0 -17
- package/graphql/app.gql.js +0 -22
- package/graphql/app.gql.js.map +0 -1
- package/graphql/records/common.d.ts +0 -4
- package/graphql/records/common.js +0 -57
- package/graphql/records/common.js.map +0 -1
- package/graphql/records/getRecord.d.ts +0 -2
- package/graphql/records/getRecord.js +0 -5
- package/graphql/records/getRecord.js.map +0 -1
- package/graphql/records/listRecords.d.ts +0 -2
- package/graphql/records/listRecords.js +0 -26
- package/graphql/records/listRecords.js.map +0 -1
- package/graphql/records/moveRecord.d.ts +0 -2
- package/graphql/records/moveRecord.js +0 -16
- package/graphql/records/moveRecord.js.map +0 -1
- package/graphql/records/types.d.ts +0 -108
- package/graphql/records/types.js +0 -0
- package/graphql/records.gql.d.ts +0 -3
- package/graphql/records.gql.js +0 -3
- package/handlers.d.ts +0 -23
- package/handlers.js +0 -22
- package/handlers.js.map +0 -1
- package/hooks/useAcoApp.d.ts +0 -2
- package/hooks/useAcoApp.js +0 -16
- package/hooks/useAcoApp.js.map +0 -1
- package/hooks/useAcoList.d.ts +0 -3
- package/hooks/useAcoList.js +0 -10
- package/hooks/useAcoList.js.map +0 -1
- package/hooks/useFolderModel.d.ts +0 -2
- package/hooks/useFolderModel.js +0 -16
- package/hooks/useFolderModel.js.map +0 -1
- package/hooks/useFoldersType.d.ts +0 -1
- package/hooks/useFoldersType.js +0 -12
- package/hooks/useFoldersType.js.map +0 -1
- package/hooks/useNavigateFolder.d.ts +0 -2
- package/hooks/useNavigateFolder.js +0 -10
- package/hooks/useNavigateFolder.js.map +0 -1
- package/hooks/useRecords.d.ts +0 -62
- package/hooks/useRecords.js +0 -64
- package/hooks/useRecords.js.map +0 -1
- package/hooks/useTags.d.ts +0 -14
- package/hooks/useTags.js +0 -27
- package/hooks/useTags.js.map +0 -1
- package/sorting.d.ts +0 -9
- package/sorting.js +0 -31
- package/sorting.js.map +0 -1
package/config/table/Column.js
CHANGED
|
@@ -1,71 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Property, useIdGenerator } from "@webiny/react-properties";
|
|
3
|
-
import { createUseTableRow } from "../../components/Table/useTableRow.js";
|
|
4
|
-
const BaseColumn = ({ after, before, cell, className, header, hideable = true, truncate = true, name, path = "", remove = false, resizable = true, size = 100, sortable = false, visible = true })=>{
|
|
5
|
-
const getId = useIdGenerator("tableColumn");
|
|
6
|
-
const placeAfter = void 0 !== after ? getId(after) : void 0;
|
|
7
|
-
const placeBefore = void 0 !== before ? getId(before) : void 0;
|
|
8
|
-
return /*#__PURE__*/ react.createElement(Property, {
|
|
9
|
-
id: "table",
|
|
10
|
-
name: "table"
|
|
11
|
-
}, /*#__PURE__*/ react.createElement(Property, {
|
|
12
|
-
id: getId(name),
|
|
13
|
-
name: "columns",
|
|
14
|
-
remove: remove,
|
|
15
|
-
array: true,
|
|
16
|
-
before: placeBefore,
|
|
17
|
-
after: placeAfter
|
|
18
|
-
}, /*#__PURE__*/ react.createElement(Property, {
|
|
19
|
-
id: getId(name, "name"),
|
|
20
|
-
name: "name",
|
|
21
|
-
value: name
|
|
22
|
-
}), /*#__PURE__*/ react.createElement(Property, {
|
|
23
|
-
id: getId(name, "path"),
|
|
24
|
-
name: "path",
|
|
25
|
-
value: path
|
|
26
|
-
}), /*#__PURE__*/ react.createElement(Property, {
|
|
27
|
-
id: getId(name, "sortable"),
|
|
28
|
-
name: "sortable",
|
|
29
|
-
value: sortable
|
|
30
|
-
}), /*#__PURE__*/ react.createElement(Property, {
|
|
31
|
-
id: getId(name, "resizable"),
|
|
32
|
-
name: "resizable",
|
|
33
|
-
value: resizable
|
|
34
|
-
}), /*#__PURE__*/ react.createElement(Property, {
|
|
35
|
-
id: getId(name, "truncate"),
|
|
36
|
-
name: "truncate",
|
|
37
|
-
value: truncate
|
|
38
|
-
}), /*#__PURE__*/ react.createElement(Property, {
|
|
39
|
-
id: getId(name, "hideable"),
|
|
40
|
-
name: "hideable",
|
|
41
|
-
value: hideable
|
|
42
|
-
}), /*#__PURE__*/ react.createElement(Property, {
|
|
43
|
-
id: getId(name, "size"),
|
|
44
|
-
name: "size",
|
|
45
|
-
value: size
|
|
46
|
-
}), /*#__PURE__*/ react.createElement(Property, {
|
|
47
|
-
id: getId(name, "visible"),
|
|
48
|
-
name: "visible",
|
|
49
|
-
value: visible
|
|
50
|
-
}), header ? /*#__PURE__*/ react.createElement(Property, {
|
|
51
|
-
id: getId(name, "header"),
|
|
52
|
-
name: "header",
|
|
53
|
-
value: header
|
|
54
|
-
}) : null, cell ? /*#__PURE__*/ react.createElement(Property, {
|
|
55
|
-
id: getId(name, "cell"),
|
|
56
|
-
name: "cell",
|
|
57
|
-
value: cell
|
|
58
|
-
}) : null, className ? /*#__PURE__*/ react.createElement(Property, {
|
|
59
|
-
id: getId(name, "className"),
|
|
60
|
-
name: "className",
|
|
61
|
-
value: className
|
|
62
|
-
}) : null));
|
|
63
|
-
};
|
|
1
|
+
import { Column } from "@webiny/app-admin/config/table/Column.js";
|
|
64
2
|
const isFolderRow = (row)=>"FOLDER" === row.$type;
|
|
65
|
-
const
|
|
66
|
-
isFolderRow: isFolderRow
|
|
67
|
-
createUseTableRow: createUseTableRow
|
|
3
|
+
const Column_Column = Object.assign(Column, {
|
|
4
|
+
isFolderRow: isFolderRow
|
|
68
5
|
});
|
|
69
|
-
export { Column };
|
|
6
|
+
export { Column_Column as Column };
|
|
70
7
|
|
|
71
8
|
//# sourceMappingURL=Column.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config/table/Column.js","sources":["../../../src/config/table/Column.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"config/table/Column.js","sources":["../../../src/config/table/Column.tsx"],"sourcesContent":["import { Column as BaseColumn } from \"@webiny/app-admin/config/table/Column.js\";\nimport type { TableRow } from \"~/table.types.js\";\nimport type { FolderTableRow } from \"~/table.types.js\";\n\nexport type { ColumnConfig, ColumnProps } from \"@webiny/app-admin/config/table/Column.js\";\n\nconst isFolderRow = (row: TableRow): row is FolderTableRow => {\n return row.$type === \"FOLDER\";\n};\n\nexport const Column = Object.assign(BaseColumn, { isFolderRow });\n"],"names":["isFolderRow","row","Column","Object","BaseColumn"],"mappings":";AAMA,MAAMA,cAAc,CAACC,MACVA,AAAc,aAAdA,IAAI,KAAK;AAGb,MAAMC,gBAASC,OAAO,MAAM,CAACC,QAAY;IAAEJ,aAAAA;AAAY"}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
field: string;
|
|
4
|
-
order: "asc" | "desc";
|
|
5
|
-
}
|
|
6
|
-
export interface SortingProps {
|
|
7
|
-
name: string;
|
|
8
|
-
field: string;
|
|
9
|
-
order?: "asc" | "desc";
|
|
10
|
-
}
|
|
11
|
-
export declare const Sorting: ({ name, field, order }: SortingProps) => React.JSX.Element;
|
|
1
|
+
export { Sorting } from "@webiny/app-admin/config/table/Sorting.js";
|
|
2
|
+
export type { SortingConfig, SortingProps } from "@webiny/app-admin/config/table/Sorting.js";
|
package/config/table/Sorting.js
CHANGED
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Property, useIdGenerator } from "@webiny/react-properties";
|
|
3
|
-
const Sorting = ({ name, field, order = "desc" })=>{
|
|
4
|
-
const getId = useIdGenerator("tableSorting");
|
|
5
|
-
return /*#__PURE__*/ react.createElement(Property, {
|
|
6
|
-
id: "table",
|
|
7
|
-
name: "table"
|
|
8
|
-
}, /*#__PURE__*/ react.createElement(Property, {
|
|
9
|
-
id: getId(name),
|
|
10
|
-
name: "sorting",
|
|
11
|
-
array: true
|
|
12
|
-
}, /*#__PURE__*/ react.createElement(Property, {
|
|
13
|
-
id: getId(name, "name"),
|
|
14
|
-
name: "name",
|
|
15
|
-
value: name
|
|
16
|
-
}), /*#__PURE__*/ react.createElement(Property, {
|
|
17
|
-
id: getId(name, "field"),
|
|
18
|
-
name: "field",
|
|
19
|
-
value: field
|
|
20
|
-
}), /*#__PURE__*/ react.createElement(Property, {
|
|
21
|
-
id: getId(name, "order"),
|
|
22
|
-
name: "order",
|
|
23
|
-
value: order
|
|
24
|
-
})));
|
|
25
|
-
};
|
|
26
|
-
export { Sorting };
|
|
27
|
-
|
|
28
|
-
//# sourceMappingURL=Sorting.js.map
|
|
1
|
+
export { Sorting } from "@webiny/app-admin/config/table/Sorting.js";
|
package/config/table/index.d.ts
CHANGED
|
@@ -5,14 +5,10 @@ export interface TableConfig {
|
|
|
5
5
|
sorting: SortingConfig[];
|
|
6
6
|
}
|
|
7
7
|
export declare const Table: {
|
|
8
|
-
Column: import("react").FC<import("
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<TUserRow>(): import("../../index.js").TableRowContextData<TBaseRow & {
|
|
13
|
-
data: TUserRow;
|
|
14
|
-
}>;
|
|
15
|
-
};
|
|
8
|
+
Column: import("react").FC<import("@webiny/app-admin/config/table/Column.js").ColumnProps> & {
|
|
9
|
+
createUseTableRow: typeof import("@webiny/app-admin/index.js").createUseTableRow;
|
|
10
|
+
} & {
|
|
11
|
+
isFolderRow: (row: import("@webiny/app-admin/index.js").TableRow) => row is import("../../table.types.js").FolderTableRow;
|
|
16
12
|
};
|
|
17
|
-
Sorting: ({ name, field, order }: import("
|
|
13
|
+
Sorting: ({ name, field, order }: import("@webiny/app-admin/config/table/Sorting.js").SortingProps) => React.JSX.Element;
|
|
18
14
|
};
|
package/contexts/index.d.ts
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export { AcoAppProvider as AcoProvider, type AcoAppProviderProps } from "../contexts/app.js";
|
|
2
1
|
export { FolderProvider, type FolderContext } from "./folder.js";
|
|
3
|
-
export { NavigateFolderProvider, type NavigateFolderContext, type NavigateFolderProviderProps } from "./navigateFolder.js";
|
|
4
|
-
export { SearchRecordsProvider, type SearchRecordsContext, type ListRecordsParams } from "./records.js";
|
package/contexts/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS
|
|
1
|
+
export declare const LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS = "\n query ListFolderLevelPermissionsTargets {\n aco {\n listFolderLevelPermissionsTargets {\n data {\n id\n type\n target\n name\n meta\n }\n error {\n code\n data\n message\n }\n }\n }\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialogs/DialogSetPermissions/graphql.js","sources":["../../../src/dialogs/DialogSetPermissions/graphql.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"dialogs/DialogSetPermissions/graphql.js","sources":["../../../src/dialogs/DialogSetPermissions/graphql.ts"],"sourcesContent":["export const LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS = /* GraphQL */ `\n query ListFolderLevelPermissionsTargets {\n aco {\n listFolderLevelPermissionsTargets {\n data {\n id\n type\n target\n name\n meta\n }\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n"],"names":["LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS"],"mappings":"AAAO,MAAMA,wCAAsD,CAAC;;;;;;;;;;;;;;;;;;;AAmBpE,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { Grid, Input } from "@webiny/admin-ui";
|
|
|
4
4
|
import { useDialogs, useSnackbar } from "@webiny/app-admin";
|
|
5
5
|
import { Bind, useForm } from "@webiny/form";
|
|
6
6
|
import { validation } from "@webiny/validation";
|
|
7
|
-
import {
|
|
7
|
+
import { FolderTree } from "../components/index.js";
|
|
8
8
|
import { ROOT_FOLDER } from "../constants.js";
|
|
9
9
|
import { useCreateFolder } from "../features/folders/createFolder/index.js";
|
|
10
10
|
import { ParentFolderField } from "./ParentFolderField.js";
|
|
@@ -52,7 +52,7 @@ const FormComponent = ({ currentParentId = null })=>{
|
|
|
52
52
|
setParentId(folder.id);
|
|
53
53
|
onChange(folder.id === ROOT_FOLDER ? null : folder.id);
|
|
54
54
|
}
|
|
55
|
-
})))))
|
|
55
|
+
}))))));
|
|
56
56
|
};
|
|
57
57
|
const useCreateDialog = ()=>{
|
|
58
58
|
const dialogs = useDialogs();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialogs/useCreateDialog.js","sources":["../../src/dialogs/useCreateDialog.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport slugify from \"slugify\";\nimport { Grid, Input } from \"@webiny/admin-ui\";\nimport { useDialogs, useSnackbar } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { Bind, useForm } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport {
|
|
1
|
+
{"version":3,"file":"dialogs/useCreateDialog.js","sources":["../../src/dialogs/useCreateDialog.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport slugify from \"slugify\";\nimport { Grid, Input } from \"@webiny/admin-ui\";\nimport { useDialogs, useSnackbar } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { Bind, useForm } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { FolderTree } from \"~/components/index.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { useCreateFolder } from \"~/features/folders/createFolder/index.js\";\nimport { ParentFolderField } from \"./ParentFolderField.js\";\n\ninterface ShowDialogParams {\n currentParentId?: string | null;\n}\n\ninterface UseCreateDialogResponse {\n showDialog: (params?: ShowDialogParams) => void;\n}\n\ninterface FormComponentProps {\n currentParentId?: string | null;\n}\n\nconst FormComponent = ({ currentParentId = null }: FormComponentProps) => {\n const [parentId, setParentId] = useState<string | null>(currentParentId);\n const form = useForm();\n\n const generateSlug = () => {\n if (form.data.slug || !form.data.title) {\n return;\n }\n\n // We want to update slug only when the folder is first being created.\n form.setValue(\n \"slug\",\n slugify(form.data.title, {\n replacement: \"-\",\n lower: true,\n remove: /[*#?<>_{}[\\]+~.()'\"!:;@]/g,\n trim: false\n })\n );\n };\n\n return (\n <>\n <Grid>\n <Grid.Column span={12}>\n <Bind name={\"title\"} validators={validation.create(\"required\")}>\n {bind => (\n <Input\n {...bind}\n label={\"Title\"}\n onBlur={generateSlug}\n size={\"lg\"}\n required\n autoFocus={true}\n />\n )}\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name={\"slug\"} validators={validation.create(\"required,slug\")}>\n <Input label={\"Slug\"} size={\"lg\"} required />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <ParentFolderField>\n <Bind name={\"parentId\"} defaultValue={parentId}>\n {({ onChange }) => (\n <FolderTree\n focusedFolderId={parentId || ROOT_FOLDER}\n onFolderClick={folder => {\n setParentId(folder.id);\n onChange(folder.id === ROOT_FOLDER ? null : folder.id);\n }}\n />\n )}\n </Bind>\n </ParentFolderField>\n </Grid.Column>\n </Grid>\n </>\n );\n};\n\nexport const useCreateDialog = (): UseCreateDialogResponse => {\n const dialogs = useDialogs();\n const { createFolder } = useCreateFolder();\n const { showSnackbar } = useSnackbar();\n\n const onAccept = useCallback(async (data: FolderDto) => {\n try {\n await createFolder({\n ...data,\n parentId: data.parentId === ROOT_FOLDER ? null : data.parentId\n });\n showSnackbar(\"Folder created successfully!\");\n } catch (error) {\n showSnackbar(error.message);\n }\n }, []);\n\n const showDialog = (params?: ShowDialogParams) => {\n const { currentParentId = null } = params ?? {};\n\n dialogs.showDialog({\n title: \"Create a new folder\",\n content: <FormComponent currentParentId={currentParentId} />,\n acceptLabel: \"Create folder\",\n cancelLabel: \"Cancel\",\n loadingLabel: \"Creating folder...\",\n /**\n * We need to cast as there are no generics to pass for the onAccept function.\n */\n onAccept: onAccept as (data: GenericFormData) => Promise<void>\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["FormComponent","currentParentId","parentId","setParentId","useState","form","useForm","generateSlug","slugify","Grid","Bind","validation","bind","Input","ParentFolderField","onChange","FolderTree","ROOT_FOLDER","folder","useCreateDialog","dialogs","useDialogs","createFolder","useCreateFolder","showSnackbar","useSnackbar","onAccept","useCallback","data","error","showDialog","params"],"mappings":";;;;;;;;;;AAyBA,MAAMA,gBAAgB,CAAC,EAAEC,kBAAkB,IAAI,EAAsB;IACjE,MAAM,CAACC,UAAUC,YAAY,GAAGC,SAAwBH;IACxD,MAAMI,OAAOC;IAEb,MAAMC,eAAe;QACjB,IAAIF,KAAK,IAAI,CAAC,IAAI,IAAI,CAACA,KAAK,IAAI,CAAC,KAAK,EAClC;QAIJA,KAAK,QAAQ,CACT,QACAG,QAAQH,KAAK,IAAI,CAAC,KAAK,EAAE;YACrB,aAAa;YACb,OAAO;YACP,QAAQ;YACR,MAAM;QACV;IAER;IAEA,OAAO,WAAP,GACI,wDACI,oBAACI,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QAAC,MAAM;QAAS,YAAYC,WAAW,MAAM,CAAC;OAC9CC,CAAAA,OAAAA,WAAAA,GACG,oBAACC,OAAKA;YACD,GAAGD,IAAI;YACR,OAAO;YACP,QAAQL;YACR,MAAM;YACN;YACA,WAAW;4BAK3B,oBAACE,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QAAC,MAAM;QAAQ,YAAYC,WAAW,MAAM,CAAC;qBAC9C,oBAACE,OAAKA;QAAC,OAAO;QAAQ,MAAM;QAAM;wBAG1C,oBAACJ,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACK,mBAAiBA,MAAAA,WAAAA,GACd,oBAACJ,MAAIA;QAAC,MAAM;QAAY,cAAcR;OACjC,CAAC,EAAEa,QAAQ,EAAE,iBACV,oBAACC,YAAUA;YACP,iBAAiBd,YAAYe;YAC7B,eAAeC,CAAAA;gBACXf,YAAYe,OAAO,EAAE;gBACrBH,SAASG,OAAO,EAAE,KAAKD,cAAc,OAAOC,OAAO,EAAE;YACzD;;AASpC;AAEO,MAAMC,kBAAkB;IAC3B,MAAMC,UAAUC;IAChB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IACzB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IAEzB,MAAMC,WAAWC,YAAY,OAAOC;QAChC,IAAI;YACA,MAAMN,aAAa;gBACf,GAAGM,IAAI;gBACP,UAAUA,KAAK,QAAQ,KAAKX,cAAc,OAAOW,KAAK,QAAQ;YAClE;YACAJ,aAAa;QACjB,EAAE,OAAOK,OAAO;YACZL,aAAaK,MAAM,OAAO;QAC9B;IACJ,GAAG,EAAE;IAEL,MAAMC,aAAa,CAACC;QAChB,MAAM,EAAE9B,kBAAkB,IAAI,EAAE,GAAG8B,UAAU,CAAC;QAE9CX,QAAQ,UAAU,CAAC;YACf,OAAO;YACP,SAAS,WAAT,GAAS,oBAACpB,eAAaA;gBAAC,iBAAiBC;;YACzC,aAAa;YACb,aAAa;YACb,cAAc;YAId,UAAUyB;QACd;IACJ;IAEA,OAAO;QACHI;IACJ;AACJ"}
|
package/dialogs/useEditDialog.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Grid, Input } from "@webiny/admin-ui";
|
|
|
3
3
|
import { useDialogs, useSnackbar } from "@webiny/app-admin";
|
|
4
4
|
import { Bind } from "@webiny/form";
|
|
5
5
|
import { validation } from "@webiny/validation";
|
|
6
|
-
import {
|
|
6
|
+
import { FolderTree } from "../components/index.js";
|
|
7
7
|
import { ROOT_FOLDER } from "../constants.js";
|
|
8
8
|
import { useUpdateFolder } from "../features/folders/updateFolder/index.js";
|
|
9
9
|
import { ParentFolderField } from "./ParentFolderField.js";
|
|
@@ -49,7 +49,7 @@ const FormComponent = ({ folder })=>{
|
|
|
49
49
|
onChange(folder.id === ROOT_FOLDER ? null : folder.id);
|
|
50
50
|
},
|
|
51
51
|
enableCreate: true
|
|
52
|
-
})))))
|
|
52
|
+
}))))));
|
|
53
53
|
};
|
|
54
54
|
const useEditDialog = ()=>{
|
|
55
55
|
const dialog = useDialogs();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialogs/useEditDialog.js","sources":["../../src/dialogs/useEditDialog.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport { Grid, Input } from \"@webiny/admin-ui\";\nimport { useSnackbar, useDialogs } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport {
|
|
1
|
+
{"version":3,"file":"dialogs/useEditDialog.js","sources":["../../src/dialogs/useEditDialog.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport { Grid, Input } from \"@webiny/admin-ui\";\nimport { useSnackbar, useDialogs } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { FolderTree } from \"~/components/index.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { useUpdateFolder } from \"~/features/folders/updateFolder/index.js\";\nimport { ParentFolderField } from \"./ParentFolderField.js\";\n\ninterface ShowDialogParams {\n folder: FolderDto;\n}\n\ninterface UseEditDialogResponse {\n showDialog: (params: ShowDialogParams) => void;\n}\n\ninterface FormComponentProps {\n folder: FolderDto;\n}\n\nconst FormComponent = ({ folder }: FormComponentProps) => {\n const [parentId, setParentId] = useState<string | null>(folder.parentId);\n\n return (\n <>\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name={\"title\"}\n defaultValue={folder.title}\n validators={[validation.create(\"required\")]}\n >\n <Input label={\"Title\"} size={\"lg\"} required autoFocus />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name={\"slug\"}\n defaultValue={folder.slug}\n validators={[validation.create(\"required,slug\")]}\n >\n <Input label={\"Slug\"} size={\"lg\"} required />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <ParentFolderField>\n <Bind name={\"parentId\"} defaultValue={parentId}>\n {({ onChange }) => (\n <FolderTree\n focusedFolderId={parentId || ROOT_FOLDER}\n hiddenFolderIds={[folder.id]}\n onFolderClick={folder => {\n setParentId(folder.id);\n onChange(folder.id === ROOT_FOLDER ? null : folder.id);\n }}\n enableCreate={true}\n />\n )}\n </Bind>\n </ParentFolderField>\n </Grid.Column>\n </Grid>\n </>\n );\n};\n\nexport const useEditDialog = (): UseEditDialogResponse => {\n const dialog = useDialogs();\n const { updateFolder } = useUpdateFolder();\n const { showSnackbar } = useSnackbar();\n\n const onAccept = useCallback(async (folder: FolderDto, data: GenericFormData) => {\n try {\n await updateFolder({\n ...folder,\n ...data\n });\n showSnackbar(`The folder \"${data.title}\" was updated successfully!`);\n } catch (error) {\n showSnackbar(error.message);\n }\n }, []);\n\n const showDialog = ({ folder }: ShowDialogParams) => {\n dialog.showDialog({\n title: \"Edit folder\",\n content: <FormComponent folder={folder} />,\n formData: folder,\n acceptLabel: \"Edit folder\",\n cancelLabel: \"Cancel\",\n loadingLabel: \"Editing folder...\",\n onAccept: (data: GenericFormData) => onAccept(folder, data)\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["FormComponent","folder","parentId","setParentId","useState","Grid","Bind","validation","Input","ParentFolderField","onChange","FolderTree","ROOT_FOLDER","useEditDialog","dialog","useDialogs","updateFolder","useUpdateFolder","showSnackbar","useSnackbar","onAccept","useCallback","data","error","showDialog"],"mappings":";;;;;;;;;AAwBA,MAAMA,gBAAgB,CAAC,EAAEC,MAAM,EAAsB;IACjD,MAAM,CAACC,UAAUC,YAAY,GAAGC,SAAwBH,OAAO,QAAQ;IAEvE,OAAO,WAAP,GACI,wDACI,oBAACI,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QACD,MAAM;QACN,cAAcL,OAAO,KAAK;QAC1B,YAAY;YAACM,WAAW,MAAM,CAAC;SAAY;qBAE3C,oBAACC,OAAKA;QAAC,OAAO;QAAS,MAAM;QAAM;QAAS;wBAGpD,oBAACH,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QACD,MAAM;QACN,cAAcL,OAAO,IAAI;QACzB,YAAY;YAACM,WAAW,MAAM,CAAC;SAAiB;qBAEhD,oBAACC,OAAKA;QAAC,OAAO;QAAQ,MAAM;QAAM;wBAG1C,oBAACH,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACI,mBAAiBA,MAAAA,WAAAA,GACd,oBAACH,MAAIA;QAAC,MAAM;QAAY,cAAcJ;OACjC,CAAC,EAAEQ,QAAQ,EAAE,iBACV,oBAACC,YAAUA;YACP,iBAAiBT,YAAYU;YAC7B,iBAAiB;gBAACX,OAAO,EAAE;aAAC;YAC5B,eAAeA,CAAAA;gBACXE,YAAYF,OAAO,EAAE;gBACrBS,SAAST,OAAO,EAAE,KAAKW,cAAc,OAAOX,OAAO,EAAE;YACzD;YACA,cAAc;;AASlD;AAEO,MAAMY,gBAAgB;IACzB,MAAMC,SAASC;IACf,MAAM,EAAEC,YAAY,EAAE,GAAGC;IACzB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IAEzB,MAAMC,WAAWC,YAAY,OAAOpB,QAAmBqB;QACnD,IAAI;YACA,MAAMN,aAAa;gBACf,GAAGf,MAAM;gBACT,GAAGqB,IAAI;YACX;YACAJ,aAAa,CAAC,YAAY,EAAEI,KAAK,KAAK,CAAC,2BAA2B,CAAC;QACvE,EAAE,OAAOC,OAAO;YACZL,aAAaK,MAAM,OAAO;QAC9B;IACJ,GAAG,EAAE;IAEL,MAAMC,aAAa,CAAC,EAAEvB,MAAM,EAAoB;QAC5Ca,OAAO,UAAU,CAAC;YACd,OAAO;YACP,SAAS,WAAT,GAAS,oBAACd,eAAaA;gBAAC,QAAQC;;YAChC,UAAUA;YACV,aAAa;YACb,aAAa;YACb,cAAc;YACd,UAAU,CAACqB,OAA0BF,SAASnB,QAAQqB;QAC1D;IACJ;IAEA,OAAO;QACHE;IACJ;AACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import react, { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import {
|
|
1
|
+
import react, { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { useContainer } from "@webiny/app";
|
|
3
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
|
|
3
4
|
import { Grid } from "@webiny/admin-ui";
|
|
4
5
|
import { useDialogs, useSnackbar } from "@webiny/app-admin";
|
|
5
6
|
import { useBind } from "@webiny/form";
|
|
@@ -9,8 +10,19 @@ import { UsersTeamsSelection } from "./DialogSetPermissions/UsersTeamsSelection.
|
|
|
9
10
|
import { LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS } from "./DialogSetPermissions/graphql.js";
|
|
10
11
|
const FormComponent = ({ folder })=>{
|
|
11
12
|
const [permissions, setPermissions] = useState(folder.permissions || []);
|
|
12
|
-
const
|
|
13
|
-
const
|
|
13
|
+
const container = useContainer();
|
|
14
|
+
const client = useMemo(()=>container.resolve(MainGraphQLClient), [
|
|
15
|
+
container
|
|
16
|
+
]);
|
|
17
|
+
const [targetsList, setTargetsList] = useState([]);
|
|
18
|
+
useEffect(()=>{
|
|
19
|
+
client.execute({
|
|
20
|
+
query: LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS
|
|
21
|
+
}).then((response)=>{
|
|
22
|
+
const data = response.aco.listFolderLevelPermissionsTargets.data;
|
|
23
|
+
setTargetsList(data || []);
|
|
24
|
+
}).catch(console.error);
|
|
25
|
+
}, []);
|
|
14
26
|
const bind = useBind({
|
|
15
27
|
name: "permissions"
|
|
16
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialogs/useSetPermissionsDialog.js","sources":["../../src/dialogs/useSetPermissionsDialog.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"dialogs/useSetPermissionsDialog.js","sources":["../../src/dialogs/useSetPermissionsDialog.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useContainer } from \"@webiny/app\";\nimport { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { Grid } from \"@webiny/admin-ui\";\nimport { useDialogs, useSnackbar } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { useBind } from \"@webiny/form\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { useUpdateFolder } from \"~/features/folders/updateFolder/index.js\";\nimport { UsersTeamsMultiAutocomplete } from \"./DialogSetPermissions/UsersTeamsMultiAutocomplete.js\";\nimport { UsersTeamsSelection } from \"./DialogSetPermissions/UsersTeamsSelection.js\";\nimport { LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS } from \"./DialogSetPermissions/graphql.js\";\nimport type { FolderLevelPermissionsTarget, FolderPermission } from \"~/types.js\";\n\ninterface ShowDialogParams {\n folder: FolderDto;\n}\n\ninterface UseSetPermissionsDialogResponse {\n showDialog: (params: ShowDialogParams) => void;\n}\n\ninterface FormComponentProps {\n folder: FolderDto;\n}\n\ninterface UpdatePermissionCallableParams {\n permission: FolderPermission;\n}\n\ninterface UpdatePermissionCallable {\n (params: UpdatePermissionCallableParams): void;\n}\n\ninterface RemoveUserTeamCallableParams {\n permission: FolderPermission;\n}\n\ninterface RemoveUserTeamCallable {\n (params: RemoveUserTeamCallableParams): void;\n}\n\ninterface ListFolderPermissionsTargetsResponse {\n aco: {\n listFolderLevelPermissionsTargets: {\n data: FolderLevelPermissionsTarget[] | null;\n error: { code: string; data: unknown; message: string } | null;\n };\n };\n}\n\nconst FormComponent = ({ folder }: FormComponentProps) => {\n const [permissions, setPermissions] = useState<FolderPermission[]>(folder.permissions || []);\n const container = useContainer();\n const client = useMemo(() => container.resolve(MainGraphQLClient), [container]);\n const [targetsList, setTargetsList] = useState<FolderLevelPermissionsTarget[]>([]);\n\n useEffect(() => {\n client\n .execute<ListFolderPermissionsTargetsResponse>({\n query: LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS\n })\n .then(response => {\n const data = response.aco.listFolderLevelPermissionsTargets.data;\n setTargetsList(data || []);\n })\n .catch(console.error);\n }, []);\n\n const bind = useBind({\n name: \"permissions\"\n });\n\n useEffect(() => {\n bind.onChange(permissions);\n }, [permissions]);\n\n const addPermission = useCallback(\n (value: FolderPermission[\"target\"][]) => {\n const selectedUserOrTeam = value[value.length - 1];\n const newPermission: FolderPermission = {\n target: selectedUserOrTeam,\n level: \"viewer\"\n };\n\n setPermissions([permissions[0], newPermission, ...permissions.slice(1)]);\n },\n [permissions]\n );\n\n const updatePermission = useCallback<UpdatePermissionCallable>(\n ({ permission: updatedPermission }) => {\n setPermissions(\n permissions.map(permission => {\n if (permission.target === updatedPermission.target) {\n return updatedPermission;\n }\n return permission;\n })\n );\n },\n [permissions]\n );\n\n const removeUserTeam = useCallback<RemoveUserTeamCallable>(\n item => {\n setPermissions(\n permissions.filter(permission => permission.target !== item.permission.target)\n );\n },\n [permissions]\n );\n\n return (\n <Grid>\n <Grid.Column span={12}>\n <UsersTeamsMultiAutocomplete\n options={targetsList}\n value={permissions.map(permission => permission.target)}\n onChange={addPermission}\n />\n </Grid.Column>\n <Grid.Column span={12}>\n <UsersTeamsSelection\n permissions={permissions}\n targetsList={targetsList}\n onRemoveAccess={removeUserTeam}\n onUpdatePermission={updatePermission}\n />\n </Grid.Column>\n </Grid>\n );\n};\n\nexport const useSetPermissionsDialog = (): UseSetPermissionsDialogResponse => {\n const dialogs = useDialogs();\n const { updateFolder } = useUpdateFolder();\n const { showSnackbar } = useSnackbar();\n\n const onAccept = useCallback(async (folder: FolderDto, data: Partial<FolderDto>) => {\n const updateData = { ...folder, ...data };\n\n try {\n await updateFolder(updateData);\n showSnackbar(\"Folder permissions updated successfully!\");\n } catch (error) {\n showSnackbar(error.message);\n }\n }, []);\n\n const showDialog = ({ folder }: ShowDialogParams) => {\n dialogs.showDialog({\n title: `Manage permissions - ${folder.title}`,\n content: <FormComponent folder={folder} />,\n acceptLabel: \"Save\",\n cancelLabel: \"Cancel\",\n loadingLabel: \"Updating permissions...\",\n onAccept: (data: GenericFormData) => onAccept(folder, data)\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["FormComponent","folder","permissions","setPermissions","useState","container","useContainer","client","useMemo","MainGraphQLClient","targetsList","setTargetsList","useEffect","LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS","response","data","console","bind","useBind","addPermission","useCallback","value","selectedUserOrTeam","newPermission","updatePermission","updatedPermission","permission","removeUserTeam","item","Grid","UsersTeamsMultiAutocomplete","UsersTeamsSelection","useSetPermissionsDialog","dialogs","useDialogs","updateFolder","useUpdateFolder","showSnackbar","useSnackbar","onAccept","updateData","error","showDialog"],"mappings":";;;;;;;;;;AAmDA,MAAMA,gBAAgB,CAAC,EAAEC,MAAM,EAAsB;IACjD,MAAM,CAACC,aAAaC,eAAe,GAAGC,SAA6BH,OAAO,WAAW,IAAI,EAAE;IAC3F,MAAMI,YAAYC;IAClB,MAAMC,SAASC,QAAQ,IAAMH,UAAU,OAAO,CAACI,oBAAoB;QAACJ;KAAU;IAC9E,MAAM,CAACK,aAAaC,eAAe,GAAGP,SAAyC,EAAE;IAEjFQ,UAAU;QACNL,OACK,OAAO,CAAuC;YAC3C,OAAOM;QACX,GACC,IAAI,CAACC,CAAAA;YACF,MAAMC,OAAOD,SAAS,GAAG,CAAC,iCAAiC,CAAC,IAAI;YAChEH,eAAeI,QAAQ,EAAE;QAC7B,GACC,KAAK,CAACC,QAAQ,KAAK;IAC5B,GAAG,EAAE;IAEL,MAAMC,OAAOC,QAAQ;QACjB,MAAM;IACV;IAEAN,UAAU;QACNK,KAAK,QAAQ,CAACf;IAClB,GAAG;QAACA;KAAY;IAEhB,MAAMiB,gBAAgBC,YAClB,CAACC;QACG,MAAMC,qBAAqBD,KAAK,CAACA,MAAM,MAAM,GAAG,EAAE;QAClD,MAAME,gBAAkC;YACpC,QAAQD;YACR,OAAO;QACX;QAEAnB,eAAe;YAACD,WAAW,CAAC,EAAE;YAAEqB;eAAkBrB,YAAY,KAAK,CAAC;SAAG;IAC3E,GACA;QAACA;KAAY;IAGjB,MAAMsB,mBAAmBJ,YACrB,CAAC,EAAE,YAAYK,iBAAiB,EAAE;QAC9BtB,eACID,YAAY,GAAG,CAACwB,CAAAA;YACZ,IAAIA,WAAW,MAAM,KAAKD,kBAAkB,MAAM,EAC9C,OAAOA;YAEX,OAAOC;QACX;IAER,GACA;QAACxB;KAAY;IAGjB,MAAMyB,iBAAiBP,YACnBQ,CAAAA;QACIzB,eACID,YAAY,MAAM,CAACwB,CAAAA,aAAcA,WAAW,MAAM,KAAKE,KAAK,UAAU,CAAC,MAAM;IAErF,GACA;QAAC1B;KAAY;IAGjB,OAAO,WAAP,GACI,oBAAC2B,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,6BAA2BA;QACxB,SAASpB;QACT,OAAOR,YAAY,GAAG,CAACwB,CAAAA,aAAcA,WAAW,MAAM;QACtD,UAAUP;uBAGlB,oBAACU,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACE,qBAAmBA;QAChB,aAAa7B;QACb,aAAaQ;QACb,gBAAgBiB;QAChB,oBAAoBH;;AAKxC;AAEO,MAAMQ,0BAA0B;IACnC,MAAMC,UAAUC;IAChB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IACzB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IAEzB,MAAMC,WAAWnB,YAAY,OAAOnB,QAAmBc;QACnD,MAAMyB,aAAa;YAAE,GAAGvC,MAAM;YAAE,GAAGc,IAAI;QAAC;QAExC,IAAI;YACA,MAAMoB,aAAaK;YACnBH,aAAa;QACjB,EAAE,OAAOI,OAAO;YACZJ,aAAaI,MAAM,OAAO;QAC9B;IACJ,GAAG,EAAE;IAEL,MAAMC,aAAa,CAAC,EAAEzC,MAAM,EAAoB;QAC5CgC,QAAQ,UAAU,CAAC;YACf,OAAO,CAAC,qBAAqB,EAAEhC,OAAO,KAAK,EAAE;YAC7C,SAAS,WAAT,GAAS,oBAACD,eAAaA;gBAAC,QAAQC;;YAChC,aAAa;YACb,aAAa;YACb,cAAc;YACd,UAAU,CAACc,OAA0BwB,SAAStC,QAAQc;QAC1D;IACJ;IAEA,OAAO;QACH2B;IACJ;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain/folder/Folder.js","sources":["../../../src/domain/folder/Folder.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"domain/folder/Folder.js","sources":["../../../src/domain/folder/Folder.ts"],"sourcesContent":["import type { FolderPermission } from \"~/types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport type { CmsIdentity } from \"~/types.js\";\n\nexport interface FolderData {\n id?: string;\n title: string;\n slug: string;\n type: string;\n parentId: string | null;\n path?: string;\n permissions: FolderPermission[];\n hasNonInheritedPermissions?: boolean;\n canManagePermissions?: boolean;\n canManageStructure?: boolean;\n canManageContent?: boolean;\n createdBy?: CmsIdentity;\n createdOn?: string;\n savedBy?: CmsIdentity;\n savedOn?: string;\n modifiedBy?: CmsIdentity | null;\n modifiedOn?: string | null;\n extensions?: Record<string, any>;\n}\n\nexport class Folder {\n public id: string;\n public title: string;\n public slug: string;\n public type: string;\n public parentId: string | null;\n public path: string;\n public permissions: FolderPermission[];\n public hasNonInheritedPermissions?: boolean;\n public canManagePermissions?: boolean;\n public canManageStructure?: boolean;\n public canManageContent?: boolean;\n public createdBy?: CmsIdentity;\n public createdOn?: string;\n public savedBy?: CmsIdentity;\n public savedOn?: string;\n public modifiedBy?: CmsIdentity | null;\n public modifiedOn?: string | null;\n public extensions: Record<string, any>;\n\n protected constructor(folder: FolderData) {\n this.id = folder.id ?? \"\";\n this.title = folder.title;\n this.slug = folder.slug;\n this.type = folder.type;\n this.parentId = folder.parentId;\n this.path = folder.path ?? `${ROOT_FOLDER}/${folder.slug}`;\n this.permissions = folder.permissions;\n this.hasNonInheritedPermissions = folder.hasNonInheritedPermissions;\n this.canManagePermissions = folder.canManagePermissions;\n this.canManageStructure = folder.canManageStructure;\n this.canManageContent = folder.canManageContent;\n this.createdBy = folder.createdBy;\n this.createdOn = folder.createdOn;\n this.savedBy = folder.savedBy;\n this.savedOn = folder.savedOn;\n this.modifiedBy = folder.modifiedBy;\n this.modifiedOn = folder.modifiedOn;\n this.extensions = folder.extensions ?? {};\n }\n\n static create(folder: FolderData) {\n return new Folder(folder);\n }\n}\n"],"names":["Folder","folder","ROOT_FOLDER"],"mappings":";AAyBO,MAAMA;IAoBT,YAAsBC,MAAkB,CAAE;QACtC,IAAI,CAAC,EAAE,GAAGA,OAAO,EAAE,IAAI;QACvB,IAAI,CAAC,KAAK,GAAGA,OAAO,KAAK;QACzB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,QAAQ,GAAGA,OAAO,QAAQ;QAC/B,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI,IAAI,GAAGC,YAAY,CAAC,EAAED,OAAO,IAAI,EAAE;QAC1D,IAAI,CAAC,WAAW,GAAGA,OAAO,WAAW;QACrC,IAAI,CAAC,0BAA0B,GAAGA,OAAO,0BAA0B;QACnE,IAAI,CAAC,oBAAoB,GAAGA,OAAO,oBAAoB;QACvD,IAAI,CAAC,kBAAkB,GAAGA,OAAO,kBAAkB;QACnD,IAAI,CAAC,gBAAgB,GAAGA,OAAO,gBAAgB;QAC/C,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;QACjC,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;QACjC,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU,IAAI,CAAC;IAC5C;IAEA,OAAO,OAAOA,MAAkB,EAAE;QAC9B,OAAO,IAAID,OAAOC;IACtB;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
|
|
2
2
|
import type { FolderDto } from "../../../domain/folder/FolderDto.js";
|
|
3
3
|
import { FolderModelProvider } from "../../../features/folders/abstractions.js";
|
|
4
4
|
import type { FolderGatewayDto } from "./abstractions.js";
|
|
@@ -15,11 +15,11 @@ export interface CreateFolderResponse {
|
|
|
15
15
|
export interface CreateFolderVariables {
|
|
16
16
|
data: Omit<FolderDto, "id" | "path" | "createdOn" | "createdBy" | "savedOn" | "savedBy" | "modifiedOn" | "modifiedBy" | "hasNonInheritedPermissions" | "canManageContent" | "canManagePermissions" | "canManageStructure">;
|
|
17
17
|
}
|
|
18
|
-
export declare const CREATE_FOLDER: (FOLDER_FIELDS: string) =>
|
|
18
|
+
export declare const CREATE_FOLDER: (FOLDER_FIELDS: string) => string;
|
|
19
19
|
declare class CreateFolderGqlGatewayImpl implements GatewayAbstraction.Interface {
|
|
20
20
|
private client;
|
|
21
21
|
private folderModelProvider;
|
|
22
|
-
constructor(client:
|
|
22
|
+
constructor(client: MainGraphQLClient.Interface, folderModelProvider: FolderModelProvider.Interface);
|
|
23
23
|
execute(folder: FolderGatewayDto): Promise<FolderDto>;
|
|
24
24
|
}
|
|
25
25
|
export declare const CreateFolderGqlGateway: typeof CreateFolderGqlGatewayImpl & {
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
|
|
1
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
|
|
3
2
|
import { FolderModelProvider } from "../abstractions.js";
|
|
4
3
|
import { CreateFolderGateway } from "./abstractions.js";
|
|
5
|
-
const CREATE_FOLDER = (FOLDER_FIELDS)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
4
|
+
const CREATE_FOLDER = (FOLDER_FIELDS)=>`
|
|
5
|
+
mutation CreateFolder($data: FolderCreateInput!) {
|
|
6
|
+
aco {
|
|
7
|
+
createFolder(data: $data) {
|
|
8
|
+
data ${FOLDER_FIELDS}
|
|
9
|
+
error {
|
|
10
|
+
code
|
|
11
|
+
data
|
|
12
|
+
message
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
|
-
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
19
18
|
class CreateFolderGqlGatewayImpl {
|
|
20
19
|
constructor(client, folderModelProvider){
|
|
21
20
|
this.client = client;
|
|
@@ -23,8 +22,8 @@ class CreateFolderGqlGatewayImpl {
|
|
|
23
22
|
}
|
|
24
23
|
async execute(folder) {
|
|
25
24
|
const fields = await this.folderModelProvider.getGraphQLSelection();
|
|
26
|
-
const
|
|
27
|
-
|
|
25
|
+
const response = await this.client.execute({
|
|
26
|
+
query: CREATE_FOLDER(fields),
|
|
28
27
|
variables: {
|
|
29
28
|
data: {
|
|
30
29
|
...folder
|
|
@@ -40,7 +39,7 @@ class CreateFolderGqlGatewayImpl {
|
|
|
40
39
|
const CreateFolderGqlGateway = CreateFolderGateway.createImplementation({
|
|
41
40
|
implementation: CreateFolderGqlGatewayImpl,
|
|
42
41
|
dependencies: [
|
|
43
|
-
|
|
42
|
+
MainGraphQLClient,
|
|
44
43
|
FolderModelProvider
|
|
45
44
|
]
|
|
46
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/folders/createFolder/CreateFolderGqlGateway.js","sources":["../../../../src/features/folders/createFolder/CreateFolderGqlGateway.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"features/folders/createFolder/CreateFolderGqlGateway.js","sources":["../../../../src/features/folders/createFolder/CreateFolderGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport type { FolderGatewayDto } from \"./abstractions.js\";\nimport { CreateFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface CreateFolderResponse {\n aco: {\n createFolder: {\n data: FolderDto;\n error: AcoError | null;\n };\n };\n}\n\nexport interface CreateFolderVariables {\n data: Omit<\n FolderDto,\n | \"id\"\n | \"path\"\n | \"createdOn\"\n | \"createdBy\"\n | \"savedOn\"\n | \"savedBy\"\n | \"modifiedOn\"\n | \"modifiedBy\"\n | \"hasNonInheritedPermissions\"\n | \"canManageContent\"\n | \"canManagePermissions\"\n | \"canManageStructure\"\n >;\n}\n\nexport const CREATE_FOLDER = (FOLDER_FIELDS: string) => /* GraphQL */ `\n mutation CreateFolder($data: FolderCreateInput!) {\n aco {\n createFolder(data: $data) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass CreateFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: MainGraphQLClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(folder: FolderGatewayDto) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const response = await this.client.execute<CreateFolderResponse, CreateFolderVariables>({\n query: CREATE_FOLDER(fields),\n variables: {\n data: {\n ...folder\n }\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while creating folder.\");\n }\n\n const { data, error } = response.aco.createFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not create folder\");\n }\n\n return data;\n }\n}\n\nexport const CreateFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: CreateFolderGqlGatewayImpl,\n dependencies: [MainGraphQLClient, FolderModelProvider]\n});\n"],"names":["CREATE_FOLDER","FOLDER_FIELDS","CreateFolderGqlGatewayImpl","client","folderModelProvider","folder","fields","response","Error","data","error","CreateFolderGqlGateway","GatewayAbstraction","MainGraphQLClient","FolderModelProvider"],"mappings":";;;AAkCO,MAAMA,gBAAgB,CAACC,gBAAwC,CAAC;;;;qBAIlD,EAAEA,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAMC;IACF,YACYC,MAAmC,EACnCC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,MAAwB,EAAE;QACpC,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACpF,OAAOP,cAAcM;YACrB,WAAW;gBACP,MAAM;oBACF,GAAGD,MAAM;gBACb;YACJ;QACJ;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBV;IAChB,cAAc;QAACW;QAAmBC;KAAoB;AAC1D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
|
|
2
2
|
import { DeleteFolderGateway as GatewayAbstraction } from "./abstractions.js";
|
|
3
3
|
import type { AcoError } from "../../../types.js";
|
|
4
4
|
export interface DeleteFolderVariables {
|
|
@@ -12,10 +12,10 @@ export interface DeleteFolderResponse {
|
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
export declare const DELETE_FOLDER:
|
|
15
|
+
export declare const DELETE_FOLDER = "\n mutation DeleteFolder($id: ID!) {\n aco {\n deleteFolder(id: $id) {\n data\n error {\n code\n data\n message\n }\n }\n }\n }\n";
|
|
16
16
|
declare class DeleteFolderGqlGatewayImpl implements GatewayAbstraction.Interface {
|
|
17
17
|
private client;
|
|
18
|
-
constructor(client:
|
|
18
|
+
constructor(client: MainGraphQLClient.Interface);
|
|
19
19
|
execute(id: string): Promise<void>;
|
|
20
20
|
}
|
|
21
21
|
export declare const DeleteFolderGqlGateway: typeof DeleteFolderGqlGatewayImpl & {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
|
|
1
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
|
|
3
2
|
import { DeleteFolderGateway } from "./abstractions.js";
|
|
4
|
-
const DELETE_FOLDER =
|
|
3
|
+
const DELETE_FOLDER = `
|
|
5
4
|
mutation DeleteFolder($id: ID!) {
|
|
6
5
|
aco {
|
|
7
6
|
deleteFolder(id: $id) {
|
|
@@ -20,8 +19,8 @@ class DeleteFolderGqlGatewayImpl {
|
|
|
20
19
|
this.client = client;
|
|
21
20
|
}
|
|
22
21
|
async execute(id) {
|
|
23
|
-
const
|
|
24
|
-
|
|
22
|
+
const response = await this.client.execute({
|
|
23
|
+
query: DELETE_FOLDER,
|
|
25
24
|
variables: {
|
|
26
25
|
id
|
|
27
26
|
}
|
|
@@ -34,7 +33,7 @@ class DeleteFolderGqlGatewayImpl {
|
|
|
34
33
|
const DeleteFolderGqlGateway = DeleteFolderGateway.createImplementation({
|
|
35
34
|
implementation: DeleteFolderGqlGatewayImpl,
|
|
36
35
|
dependencies: [
|
|
37
|
-
|
|
36
|
+
MainGraphQLClient
|
|
38
37
|
]
|
|
39
38
|
});
|
|
40
39
|
export { DELETE_FOLDER, DeleteFolderGqlGateway };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/folders/deleteFolder/DeleteFolderGqlGateway.js","sources":["../../../../src/features/folders/deleteFolder/DeleteFolderGqlGateway.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"features/folders/deleteFolder/DeleteFolderGqlGateway.js","sources":["../../../../src/features/folders/deleteFolder/DeleteFolderGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { DeleteFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface DeleteFolderVariables {\n id: string;\n}\n\nexport interface DeleteFolderResponse {\n aco: {\n deleteFolder: {\n data: boolean;\n error: AcoError | null;\n };\n };\n}\n\nexport const DELETE_FOLDER = /* GraphQL */ `\n mutation DeleteFolder($id: ID!) {\n aco {\n deleteFolder(id: $id) {\n data\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass DeleteFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute(id: string) {\n const response = await this.client.execute<DeleteFolderResponse, DeleteFolderVariables>({\n query: DELETE_FOLDER,\n variables: {\n id\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while deleting folder\");\n }\n\n const { data, error } = response.aco.deleteFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not delete folder\");\n }\n\n return;\n }\n}\n\nexport const DeleteFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: DeleteFolderGqlGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["DELETE_FOLDER","DeleteFolderGqlGatewayImpl","client","id","response","Error","data","error","DeleteFolderGqlGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAiBO,MAAMA,gBAA8B,CAAC;;;;;;;;;;;;;AAa5C,CAAC;AAED,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,EAAU,EAAE;QACtB,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACpF,OAAOJ;YACP,WAAW;gBACPG;YACJ;QACJ;QAEA,IAAI,CAACC,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;IAI1C;AACJ;AAEO,MAAMC,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBR;IAChB,cAAc;QAACS;KAAkB;AACrC"}
|