@webiny/app-aco 6.4.11 → 6.6.0-alpha.1
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/AdvancedSearch.d.ts +2 -2
- package/components/AdvancedSearch/QueryBuilderDrawer/QueryBuilderDrawer.d.ts +2 -2
- 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/FolderTree/List/List.js +6 -14
- package/components/FolderTree/List/List.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/components/Table/TableInner.d.ts +2 -2
- 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/useConfirmMoveFolderDialog.d.ts +0 -1
- package/dialogs/useConfirmMoveFolderDialog.js +2 -3
- package/dialogs/useConfirmMoveFolderDialog.js.map +1 -1
- package/dialogs/useCreateDialog.js +5 -9
- 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/getFolderLevelPermission/GetFolderLevelPermission.test.js +12 -16
- package/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js.map +1 -1
- package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.d.ts +3 -3
- package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.js +5 -5
- package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.js.map +1 -1
- 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 +21 -28
- package/presentation/folderTree/FolderTreePresenter.d.ts +3 -1
- package/presentation/folderTree/FolderTreePresenter.js +15 -23
- package/presentation/folderTree/FolderTreePresenter.js.map +1 -1
- package/presentation/folderTree/FolderTreePresenter.test.js +8 -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/AcoConfig.d.ts
CHANGED
|
@@ -15,28 +15,24 @@ export declare const AcoConfig: (({ priority, children }: import("@webiny/react-
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
Folder: {
|
|
18
|
-
Action:
|
|
18
|
+
Action: typeof import("./folder/Action.js").BaseAction & {
|
|
19
19
|
OptionsMenuItem: (props: import("@webiny/app-admin/index.js").OptionsMenuItemProps) => React.JSX.Element;
|
|
20
20
|
};
|
|
21
|
-
DropConfirmation:
|
|
21
|
+
DropConfirmation: typeof import("./folder/DropConfirmation.js").DropConfirmation;
|
|
22
22
|
};
|
|
23
23
|
Record: {
|
|
24
|
-
Action:
|
|
24
|
+
Action: typeof import("./record/Action.js").BaseAction & {
|
|
25
25
|
OptionsMenuItem: (props: import("@webiny/app-admin/index.js").OptionsMenuItemProps) => React.JSX.Element;
|
|
26
26
|
OptionsMenuLink: (props: import("@webiny/app-admin/index.js").OptionsMenuLinkProps) => React.JSX.Element;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
Table: {
|
|
30
|
-
Column: import("react").FC<import("
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<TUserRow>(): import("../index.js").TableRowContextData<TBaseRow & {
|
|
35
|
-
data: TUserRow;
|
|
36
|
-
}>;
|
|
37
|
-
};
|
|
30
|
+
Column: import("react").FC<import("@webiny/app-admin/config/table/Column.js").ColumnProps> & {
|
|
31
|
+
createUseTableRow: typeof import("@webiny/app-admin/index.js").createUseTableRow;
|
|
32
|
+
} & {
|
|
33
|
+
isFolderRow: (row: import("@webiny/app-admin/index.js").TableRow) => row is import("../table.types.js").FolderTableRow;
|
|
38
34
|
};
|
|
39
|
-
Sorting: ({ name, field, order }: import("
|
|
35
|
+
Sorting: ({ name, field, order }: import("@webiny/app-admin/config/table/Sorting.js").SortingProps) => React.JSX.Element;
|
|
40
36
|
};
|
|
41
37
|
};
|
|
42
38
|
export interface AcoConfig {
|
|
@@ -10,7 +10,9 @@ export interface FieldRendererProps {
|
|
|
10
10
|
element: React.ReactElement;
|
|
11
11
|
type: FieldType;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
declare const BaseFieldRenderer: ({ name, type, element }: FieldRendererProps) => React.JSX.Element;
|
|
14
|
+
export declare const FieldRenderer: typeof BaseFieldRenderer & {
|
|
14
15
|
useInputField: () => import("~/components/AdvancedSearch/useInputField.js").InputFieldContext;
|
|
15
16
|
FieldType: typeof FieldType;
|
|
16
17
|
};
|
|
18
|
+
export {};
|
|
@@ -11,6 +11,6 @@ export interface ActionProps {
|
|
|
11
11
|
after?: string;
|
|
12
12
|
}
|
|
13
13
|
export declare const BaseAction: ({ name, after, before, remove, element }: ActionProps) => React.JSX.Element;
|
|
14
|
-
export declare const Action:
|
|
14
|
+
export declare const Action: typeof BaseAction & {
|
|
15
15
|
OptionsMenuItem: (props: import("@webiny/app-admin").OptionsMenuItemProps) => React.JSX.Element;
|
|
16
16
|
};
|
package/config/folder/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ActionConfig } from "./Action.js";
|
|
2
|
+
import { DropConfirmation } from "./DropConfirmation.js";
|
|
2
3
|
export interface FolderConfig {
|
|
3
4
|
actions: ActionConfig[];
|
|
4
5
|
dropConfirmation: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare const Folder: {
|
|
7
|
-
Action:
|
|
8
|
+
Action: typeof import("./Action.js").BaseAction & {
|
|
8
9
|
OptionsMenuItem: (props: import("@webiny/app-admin/index.js").OptionsMenuItemProps) => React.JSX.Element;
|
|
9
10
|
};
|
|
10
|
-
DropConfirmation:
|
|
11
|
+
DropConfirmation: typeof DropConfirmation;
|
|
11
12
|
};
|
package/config/index.d.ts
CHANGED
package/config/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export interface ActionProps {
|
|
|
11
11
|
after?: string;
|
|
12
12
|
}
|
|
13
13
|
export declare const BaseAction: ({ name, after, before, remove, element }: ActionProps) => React.JSX.Element;
|
|
14
|
-
export declare const Action:
|
|
14
|
+
export declare const Action: typeof BaseAction & {
|
|
15
15
|
OptionsMenuItem: (props: import("@webiny/app-admin").OptionsMenuItemProps) => React.JSX.Element;
|
|
16
16
|
OptionsMenuLink: (props: import("@webiny/app-admin").OptionsMenuLinkProps) => React.JSX.Element;
|
|
17
17
|
};
|
package/config/record/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface RecordConfig {
|
|
|
3
3
|
actions: ActionConfig[];
|
|
4
4
|
}
|
|
5
5
|
export declare const Record: {
|
|
6
|
-
Action:
|
|
6
|
+
Action: typeof import("./Action.js").BaseAction & {
|
|
7
7
|
OptionsMenuItem: (props: import("@webiny/app-admin/index.js").OptionsMenuItemProps) => React.JSX.Element;
|
|
8
8
|
OptionsMenuLink: (props: import("@webiny/app-admin/index.js").OptionsMenuLinkProps) => React.JSX.Element;
|
|
9
9
|
};
|
package/config/table/Column.d.ts
CHANGED
|
@@ -1,40 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
name: string;
|
|
10
|
-
resizable: boolean;
|
|
11
|
-
size: number;
|
|
12
|
-
sortable: boolean;
|
|
13
|
-
truncate: boolean;
|
|
14
|
-
visible: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface ColumnProps {
|
|
17
|
-
after?: string;
|
|
18
|
-
before?: string;
|
|
19
|
-
cell?: string | ReactElement;
|
|
20
|
-
className?: string;
|
|
21
|
-
truncate?: boolean;
|
|
22
|
-
header?: string | ReactElement;
|
|
23
|
-
hideable?: boolean;
|
|
24
|
-
name: string;
|
|
25
|
-
path?: string;
|
|
26
|
-
remove?: boolean;
|
|
27
|
-
resizable?: boolean;
|
|
28
|
-
size?: number;
|
|
29
|
-
sortable?: boolean;
|
|
30
|
-
visible?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export declare const Column: React.FC<ColumnProps> & {
|
|
33
|
-
isFolderRow: (row: TableRow) => row is FolderTableRow;
|
|
34
|
-
createUseTableRow: <TBaseRow = Record<string, any>>() => {
|
|
35
|
-
(): import("~/components/Table/useTableRow.js").TableRowContextData<TBaseRow>;
|
|
36
|
-
<TUserRow>(): import("~/components/Table/useTableRow.js").TableRowContextData<TBaseRow & {
|
|
37
|
-
data: TUserRow;
|
|
38
|
-
}>;
|
|
39
|
-
};
|
|
1
|
+
import type { TableRow } from "../../table.types.js";
|
|
2
|
+
import type { FolderTableRow } from "../../table.types.js";
|
|
3
|
+
export type { ColumnConfig, ColumnProps } from "@webiny/app-admin/config/table/Column.js";
|
|
4
|
+
declare const isFolderRow: (row: TableRow) => row is FolderTableRow;
|
|
5
|
+
export declare const Column: import("react").FC<import("@webiny/app-admin/config/table/Column.js").ColumnProps> & {
|
|
6
|
+
createUseTableRow: typeof import("@webiny/app-admin/components").createUseTableRow;
|
|
7
|
+
} & {
|
|
8
|
+
isFolderRow: typeof isFolderRow;
|
|
40
9
|
};
|
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"}
|
|
@@ -3,7 +3,6 @@ interface ShowDialogParams {
|
|
|
3
3
|
folder: FolderDto;
|
|
4
4
|
targetFolder: FolderDto;
|
|
5
5
|
onAccept: (folder: FolderDto, targetFolder: FolderDto) => Promise<void>;
|
|
6
|
-
onClose?: () => void;
|
|
7
6
|
}
|
|
8
7
|
interface UseConfirmMoveFolderDialogResponse {
|
|
9
8
|
showDialog: (params: ShowDialogParams) => void;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { useDialogs } from "@webiny/app-admin";
|
|
2
2
|
const useConfirmMoveFolderDialog = ()=>{
|
|
3
3
|
const dialogs = useDialogs();
|
|
4
|
-
const showDialog = ({ folder, targetFolder, onAccept
|
|
4
|
+
const showDialog = ({ folder, targetFolder, onAccept })=>{
|
|
5
5
|
dialogs.showDialog({
|
|
6
6
|
title: "Move folder",
|
|
7
7
|
content: `You are about to move the folder "${folder.title}" into "${targetFolder.title}"! Are you sure you want to continue?`,
|
|
8
8
|
acceptLabel: "Move folder",
|
|
9
9
|
cancelLabel: "Cancel",
|
|
10
10
|
loadingLabel: "Moving folder...",
|
|
11
|
-
onAccept: ()=>onAccept(folder, targetFolder)
|
|
12
|
-
onClose
|
|
11
|
+
onAccept: ()=>onAccept(folder, targetFolder)
|
|
13
12
|
});
|
|
14
13
|
};
|
|
15
14
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialogs/useConfirmMoveFolderDialog.js","sources":["../../src/dialogs/useConfirmMoveFolderDialog.tsx"],"sourcesContent":["import { useDialogs } from \"@webiny/app-admin\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\n\ninterface ShowDialogParams {\n folder: FolderDto;\n targetFolder: FolderDto;\n onAccept: (folder: FolderDto, targetFolder: FolderDto) => Promise<void>;\n
|
|
1
|
+
{"version":3,"file":"dialogs/useConfirmMoveFolderDialog.js","sources":["../../src/dialogs/useConfirmMoveFolderDialog.tsx"],"sourcesContent":["import { useDialogs } from \"@webiny/app-admin\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\n\ninterface ShowDialogParams {\n folder: FolderDto;\n targetFolder: FolderDto;\n onAccept: (folder: FolderDto, targetFolder: FolderDto) => Promise<void>;\n}\n\ninterface UseConfirmMoveFolderDialogResponse {\n showDialog: (params: ShowDialogParams) => void;\n}\n\nexport const useConfirmMoveFolderDialog = (): UseConfirmMoveFolderDialogResponse => {\n const dialogs = useDialogs();\n\n const showDialog = ({ folder, targetFolder, onAccept }: ShowDialogParams) => {\n dialogs.showDialog({\n title: \"Move folder\",\n content: `You are about to move the folder \"${folder.title}\" into \"${targetFolder.title}\"! Are you sure you want to continue?`,\n acceptLabel: \"Move folder\",\n cancelLabel: \"Cancel\",\n loadingLabel: \"Moving folder...\",\n onAccept: () => onAccept(folder, targetFolder)\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["useConfirmMoveFolderDialog","dialogs","useDialogs","showDialog","folder","targetFolder","onAccept"],"mappings":";AAaO,MAAMA,6BAA6B;IACtC,MAAMC,UAAUC;IAEhB,MAAMC,aAAa,CAAC,EAAEC,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAoB;QACpEL,QAAQ,UAAU,CAAC;YACf,OAAO;YACP,SAAS,CAAC,kCAAkC,EAAEG,OAAO,KAAK,CAAC,QAAQ,EAAEC,aAAa,KAAK,CAAC,qCAAqC,CAAC;YAC9H,aAAa;YACb,aAAa;YACb,cAAc;YACd,UAAU,IAAMC,SAASF,QAAQC;QACrC;IACJ;IAEA,OAAO;QACHF;IACJ;AACJ"}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import react, { useCallback, useState } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { useStringFormatter } from "@webiny/app-admin/features/stringFormatter/useStringFormatter.js";
|
|
3
3
|
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";
|
|
11
11
|
const FormComponent = ({ currentParentId = null })=>{
|
|
12
12
|
const [parentId, setParentId] = useState(currentParentId);
|
|
13
13
|
const form = useForm();
|
|
14
|
+
const stringFormatter = useStringFormatter();
|
|
14
15
|
const generateSlug = ()=>{
|
|
15
16
|
if (form.data.slug || !form.data.title) return;
|
|
16
|
-
form.setValue("slug", slugify(form.data.title
|
|
17
|
-
replacement: "-",
|
|
18
|
-
lower: true,
|
|
19
|
-
remove: /[*#?<>_{}[\]+~.()'"!:;@]/g,
|
|
20
|
-
trim: false
|
|
21
|
-
}));
|
|
17
|
+
form.setValue("slug", stringFormatter.slugify(form.data.title));
|
|
22
18
|
};
|
|
23
19
|
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
24
20
|
span: 12
|
|
@@ -52,7 +48,7 @@ const FormComponent = ({ currentParentId = null })=>{
|
|
|
52
48
|
setParentId(folder.id);
|
|
53
49
|
onChange(folder.id === ROOT_FOLDER ? null : folder.id);
|
|
54
50
|
}
|
|
55
|
-
})))))
|
|
51
|
+
}))))));
|
|
56
52
|
};
|
|
57
53
|
const useCreateDialog = ()=>{
|
|
58
54
|
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
|
|
1
|
+
{"version":3,"file":"dialogs/useCreateDialog.js","sources":["../../src/dialogs/useCreateDialog.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport { useStringFormatter } from \"@webiny/app-admin/features/stringFormatter/useStringFormatter.js\";\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 const stringFormatter = useStringFormatter();\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(\"slug\", stringFormatter.slugify(form.data.title));\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","stringFormatter","useStringFormatter","generateSlug","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;IACb,MAAMC,kBAAkBC;IAExB,MAAMC,eAAe;QACjB,IAAIJ,KAAK,IAAI,CAAC,IAAI,IAAI,CAACA,KAAK,IAAI,CAAC,KAAK,EAClC;QAIJA,KAAK,QAAQ,CAAC,QAAQE,gBAAgB,OAAO,CAACF,KAAK,IAAI,CAAC,KAAK;IACjE;IAEA,OAAO,WAAP,GACI,wDACI,oBAACK,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,QAAQJ;YACR,MAAM;YACN;YACA,WAAW;4BAK3B,oBAACC,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,cAAcT;OACjC,CAAC,EAAEc,QAAQ,EAAE,iBACV,oBAACC,YAAUA;YACP,iBAAiBf,YAAYgB;YAC7B,eAAeC,CAAAA;gBACXhB,YAAYgB,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,EAAE/B,kBAAkB,IAAI,EAAE,GAAG+B,UAAU,CAAC;QAE9CX,QAAQ,UAAU,CAAC;YACf,OAAO;YACP,SAAS,WAAT,GAAS,oBAACrB,eAAaA;gBAAC,iBAAiBC;;YACzC,aAAa;YACb,aAAa;YACb,cAAc;YAId,UAAU0B;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"}
|