@griddo/ax 10.2.25 → 10.3.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/package.json +2 -2
- package/public/img/icons/excel.png +0 -0
- package/public/img/icons/pdf.png +0 -0
- package/public/img/icons/word.png +0 -0
- package/public/img/icons/zip.png +0 -0
- package/src/GlobalStore.tsx +3 -0
- package/src/__mocks__/store/GenericStore.ts +3 -0
- package/src/__tests__/components/Fields/FileField/FileField.test.tsx +34 -8
- package/src/__tests__/components/Gallery/GalleryPanel/GalleryDragAndDrop/GalleryDragAndDrop.test.tsx +1 -1
- package/src/api/files.tsx +171 -1
- package/src/api/users.tsx +5 -2
- package/src/components/ActionMenu/index.tsx +5 -13
- package/src/components/BackFolder/index.tsx +28 -0
- package/src/components/BackFolder/style.tsx +33 -0
- package/src/components/BulkSelectionOptions/index.tsx +4 -8
- package/src/components/Button/index.tsx +8 -3
- package/src/components/Button/style.tsx +5 -3
- package/src/components/ElementsTooltip/index.tsx +22 -7
- package/src/components/ElementsTooltip/style.tsx +2 -2
- package/src/components/Fields/FileField/index.tsx +7 -7
- package/src/components/Fields/TextField/index.tsx +3 -0
- package/src/components/FileGallery/FolderItem/index.tsx +39 -0
- package/src/components/FileGallery/FolderItem/style.tsx +31 -0
- package/src/components/FileGallery/GalleryPanel/DetailPanel/index.tsx +164 -0
- package/src/components/FileGallery/GalleryPanel/DetailPanel/style.tsx +113 -0
- package/src/components/FileGallery/GalleryPanel/index.tsx +42 -0
- package/src/components/FileGallery/GalleryPanel/style.tsx +7 -0
- package/src/components/FileGallery/GridItem/index.tsx +47 -0
- package/src/components/FileGallery/GridItem/style.tsx +51 -0
- package/src/components/FileGallery/index.tsx +304 -0
- package/src/components/FileGallery/style.tsx +173 -0
- package/src/components/FileGallery/utils.tsx +19 -0
- package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/index.tsx +4 -6
- package/src/components/Icon/components/Back.js +10 -0
- package/src/components/Icon/components/ClosePanel.js +12 -0
- package/src/components/Icon/components/NewFolder.js +10 -0
- package/src/components/Icon/components/OpenPanel.js +12 -0
- package/src/components/Icon/svgs/Back.svg +3 -0
- package/src/components/Icon/svgs/Close_panel.svg +3 -0
- package/src/components/Icon/svgs/New-folder.svg +3 -0
- package/src/components/Icon/svgs/Open_panel.svg +3 -0
- package/src/components/Modal/index.tsx +7 -5
- package/src/components/Modal/style.tsx +6 -6
- package/src/components/ProgressBar/index.tsx +3 -2
- package/src/components/ProgressBar/style.tsx +5 -3
- package/src/components/TableList/index.tsx +3 -2
- package/src/components/TableList/style.tsx +4 -0
- package/src/components/Toast/style.tsx +2 -2
- package/src/components/index.tsx +4 -0
- package/src/containers/FileDrive/actions.tsx +386 -0
- package/src/containers/FileDrive/constants.tsx +24 -0
- package/src/containers/FileDrive/index.tsx +7 -0
- package/src/containers/FileDrive/interfaces.tsx +59 -0
- package/src/containers/FileDrive/reducer.tsx +57 -0
- package/src/containers/FileDrive/utils.tsx +37 -0
- package/src/containers/Gallery/actions.tsx +1 -1
- package/src/containers/Gallery/interfaces.tsx +1 -1
- package/src/helpers/index.tsx +2 -0
- package/src/helpers/objects.tsx +6 -0
- package/src/modules/FileDrive/Breadcrumb/index.tsx +42 -0
- package/src/modules/FileDrive/Breadcrumb/style.tsx +18 -0
- package/src/modules/FileDrive/BulkGridHeader/GridHeader/index.tsx +37 -0
- package/src/modules/FileDrive/BulkGridHeader/GridHeader/style.tsx +19 -0
- package/src/modules/FileDrive/BulkGridHeader/index.tsx +35 -0
- package/src/modules/FileDrive/BulkGridHeader/style.tsx +17 -0
- package/src/modules/FileDrive/BulkListHeader/TableHeader/index.tsx +42 -0
- package/src/modules/FileDrive/BulkListHeader/TableHeader/style.tsx +53 -0
- package/src/modules/FileDrive/BulkListHeader/index.tsx +35 -0
- package/src/modules/FileDrive/BulkListHeader/style.tsx +17 -0
- package/src/modules/FileDrive/FileDragAndDrop/index.tsx +249 -0
- package/src/{components/Fields/FileField → modules/FileDrive}/FileDragAndDrop/style.tsx +50 -9
- package/src/modules/FileDrive/FileModal/DetailPanel/index.tsx +170 -0
- package/src/modules/FileDrive/FileModal/DetailPanel/style.tsx +81 -0
- package/src/modules/FileDrive/FileModal/index.tsx +129 -0
- package/src/modules/FileDrive/FileModal/style.tsx +112 -0
- package/src/modules/FileDrive/FolderItem/index.tsx +180 -0
- package/src/modules/FileDrive/FolderItem/style.tsx +39 -0
- package/src/modules/FileDrive/FolderTree/index.tsx +108 -0
- package/src/modules/FileDrive/FolderTree/style.tsx +69 -0
- package/src/modules/FileDrive/FolderTree/utils.tsx +91 -0
- package/src/modules/FileDrive/GridItem/index.tsx +167 -0
- package/src/modules/FileDrive/GridItem/style.tsx +76 -0
- package/src/modules/FileDrive/ListItem/index.tsx +180 -0
- package/src/modules/FileDrive/ListItem/style.tsx +88 -0
- package/src/modules/FileDrive/atoms.tsx +173 -0
- package/src/modules/FileDrive/helpers.tsx +19 -0
- package/src/modules/FileDrive/index.tsx +670 -0
- package/src/modules/FileDrive/style.tsx +145 -0
- package/src/modules/Sites/SitesList/index.tsx +0 -3
- package/src/routes/multisite.tsx +9 -0
- package/src/routes/site.tsx +9 -0
- package/src/types/index.tsx +63 -0
- package/src/components/Fields/FileField/FileDragAndDrop/index.tsx +0 -188
- package/src/components/Fields/FileField/store.tsx +0 -61
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { IFilesFolder, IFolderTree } from "@ax/types";
|
|
2
|
+
import {
|
|
3
|
+
SET_BREADCRUMB,
|
|
4
|
+
SET_CURRENT_FOLDER,
|
|
5
|
+
SET_CURRENT_FOLDER_CONTENT,
|
|
6
|
+
SET_DISPLAY_MODE,
|
|
7
|
+
SET_FOLDERS_TREE,
|
|
8
|
+
SET_IS_UPLOADING,
|
|
9
|
+
SET_SELECTED_TAB,
|
|
10
|
+
SET_UPLOAD_ERROR,
|
|
11
|
+
SET_UPLOAD_SUCCESS,
|
|
12
|
+
} from "./constants";
|
|
13
|
+
|
|
14
|
+
export interface IFileDriveState {
|
|
15
|
+
currentFolderContent: IFilesFolder | null;
|
|
16
|
+
currentFolderID: number | null;
|
|
17
|
+
breadcrumb: IFolderTree[];
|
|
18
|
+
foldersTree: IFolderTree[];
|
|
19
|
+
isUploading: boolean;
|
|
20
|
+
isSuccess: boolean;
|
|
21
|
+
isError: boolean;
|
|
22
|
+
errorMsg: string;
|
|
23
|
+
displayMode: "grid" | "list";
|
|
24
|
+
selectedTab: "local" | "global";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const initialState: IFileDriveState = {
|
|
28
|
+
currentFolderContent: null,
|
|
29
|
+
currentFolderID: null,
|
|
30
|
+
breadcrumb: [],
|
|
31
|
+
foldersTree: [],
|
|
32
|
+
isUploading: false,
|
|
33
|
+
isSuccess: false,
|
|
34
|
+
isError: false,
|
|
35
|
+
errorMsg: "",
|
|
36
|
+
displayMode: "grid",
|
|
37
|
+
selectedTab: "local",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export function reducer(state = initialState, action: any): IFileDriveState {
|
|
41
|
+
switch (action.type) {
|
|
42
|
+
case SET_CURRENT_FOLDER_CONTENT:
|
|
43
|
+
case SET_CURRENT_FOLDER:
|
|
44
|
+
case SET_FOLDERS_TREE:
|
|
45
|
+
case SET_BREADCRUMB:
|
|
46
|
+
case SET_IS_UPLOADING:
|
|
47
|
+
case SET_UPLOAD_SUCCESS:
|
|
48
|
+
case SET_UPLOAD_ERROR:
|
|
49
|
+
case SET_DISPLAY_MODE:
|
|
50
|
+
case SET_SELECTED_TAB:
|
|
51
|
+
return { ...state, ...action.payload };
|
|
52
|
+
default:
|
|
53
|
+
return state;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { initialState as fileDriveInitialState, reducer as fileDriveReducer };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IFolderTree } from "@ax/types";
|
|
2
|
+
|
|
3
|
+
const getPath = (tree: IFolderTree[], targetID: number): IFolderTree[] | undefined => {
|
|
4
|
+
for(const element of tree){
|
|
5
|
+
if (element.id === targetID) {
|
|
6
|
+
return [element];
|
|
7
|
+
}
|
|
8
|
+
if (element.children.length) {
|
|
9
|
+
const result = getPath(element.children, targetID);
|
|
10
|
+
if (result) {
|
|
11
|
+
result.unshift(element);
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const getNewBreadcrumb = (tree: IFolderTree[], target: number | null) => {
|
|
19
|
+
if(!target) return [];
|
|
20
|
+
|
|
21
|
+
return getPath(tree, target) || [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const updatePropertyById = (id: number, data: IFolderTree[], property: string, value: any) => {
|
|
25
|
+
for (let i = 0; i < data.length; i++) {
|
|
26
|
+
if (data[i].id === id) {
|
|
27
|
+
data[i] = { ...data[i], [property]: value };
|
|
28
|
+
}
|
|
29
|
+
if (data[i].children !== undefined && data[i].children.length > 0) {
|
|
30
|
+
data[i].children = updatePropertyById(id, data[i].children, property, value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { getNewBreadcrumb, updatePropertyById };
|
|
@@ -48,7 +48,7 @@ function setUploadSuccess(isSuccess: boolean): ISetUploadSuccess {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function setUploadError(isError: boolean, errorMsg = ""): ISetUploadError {
|
|
51
|
-
return { type: SET_UPLOAD_ERROR, payload: {
|
|
51
|
+
return { type: SET_UPLOAD_ERROR, payload: { isUploading: false, isError, errorMsg } };
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function getSiteImages(props: IGetSiteImages): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
@@ -35,7 +35,7 @@ export interface ISetUploadSuccess {
|
|
|
35
35
|
|
|
36
36
|
export interface ISetUploadError {
|
|
37
37
|
type: typeof SET_UPLOAD_ERROR;
|
|
38
|
-
payload: {
|
|
38
|
+
payload: { isUploading: boolean, isError: boolean, errorMsg: string };
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export type GalleryActionsCreators = ISetData & ISetIsLoading & ISetIsSaving & ISetIsUploading & ISetUploadSuccess & ISetUploadError;
|
package/src/helpers/index.tsx
CHANGED
package/src/helpers/objects.tsx
CHANGED
|
@@ -110,6 +110,11 @@ const hasProps = (obj: Record<string, unknown>, props: string[]): boolean => {
|
|
|
110
110
|
);
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
+
const encodeData = (data: Record<string, string | number | boolean>): string =>
|
|
114
|
+
Object.entries(data)
|
|
115
|
+
.map((pair) => pair.map(encodeURIComponent).join("="))
|
|
116
|
+
.join("&");
|
|
117
|
+
|
|
113
118
|
export {
|
|
114
119
|
isEmptyObj,
|
|
115
120
|
deepClone,
|
|
@@ -123,4 +128,5 @@ export {
|
|
|
123
128
|
removeEditorIds,
|
|
124
129
|
trimObject,
|
|
125
130
|
hasProps,
|
|
131
|
+
encodeData,
|
|
126
132
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IFolderTree } from "@ax/types";
|
|
3
|
+
|
|
4
|
+
import * as S from "./style";
|
|
5
|
+
|
|
6
|
+
const Breadcrumb = (props: IBreadcrumbProps): JSX.Element => {
|
|
7
|
+
const { breadcrumb, onClick } = props;
|
|
8
|
+
|
|
9
|
+
const handleRootClick = () => onClick(null);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<S.BreadcrumbGroup data-testid="file-breadcrumb">
|
|
13
|
+
<React.Fragment key="root">
|
|
14
|
+
<S.BreadcrumbItem onClick={handleRootClick} isLastItem={false}>
|
|
15
|
+
All Documents
|
|
16
|
+
</S.BreadcrumbItem>
|
|
17
|
+
{"/"}
|
|
18
|
+
</React.Fragment>
|
|
19
|
+
{breadcrumb.slice(0).map((item: IFolderTree, index: number, arr: any) => {
|
|
20
|
+
const { id, name } = item;
|
|
21
|
+
const isLastItem = breadcrumb.length === index + 1;
|
|
22
|
+
const handleClick = () => onClick(id);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<React.Fragment key={`${id}${index}`}>
|
|
26
|
+
<S.BreadcrumbItem onClick={handleClick} isLastItem={isLastItem}>
|
|
27
|
+
{name}
|
|
28
|
+
</S.BreadcrumbItem>
|
|
29
|
+
{index <= arr.length - 2 && "/"}
|
|
30
|
+
</React.Fragment>
|
|
31
|
+
);
|
|
32
|
+
})}
|
|
33
|
+
</S.BreadcrumbGroup>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export interface IBreadcrumbProps {
|
|
38
|
+
breadcrumb: IFolderTree[];
|
|
39
|
+
onClick(folderID: number | null): void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default Breadcrumb;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
const BreadcrumbGroup = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
padding: ${p => `${p.theme.spacing.s} ${p.theme.spacing.m} 0 ${p.theme.spacing.m}`};
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
const BreadcrumbItem = styled.div<{isLastItem: boolean}>`
|
|
11
|
+
${p => p.theme.textStyle.uiM};
|
|
12
|
+
color: ${p => p.isLastItem ? p.theme.color.textMediumEmphasis : p.theme.color.interactive01};
|
|
13
|
+
padding: 0 ${p => p.theme.spacing.xxs};
|
|
14
|
+
cursor: ${p => p.isLastItem ? "default" : "pointer"};
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export { BreadcrumbGroup, BreadcrumbItem }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { CheckField, TableCounter } from "@ax/components";
|
|
4
|
+
|
|
5
|
+
import * as S from "./style";
|
|
6
|
+
|
|
7
|
+
const GridHeader = (props: IProps): JSX.Element => {
|
|
8
|
+
const { selectAllItems, checkState, totalItems } = props;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<S.Header>
|
|
12
|
+
<S.CheckWrapper>
|
|
13
|
+
<CheckField
|
|
14
|
+
key="selectAll"
|
|
15
|
+
name="selectAll"
|
|
16
|
+
value="selectAll"
|
|
17
|
+
onChange={selectAllItems}
|
|
18
|
+
checked={checkState.isAllSelected}
|
|
19
|
+
disabled={false}
|
|
20
|
+
error={false}
|
|
21
|
+
title="Select all documents"
|
|
22
|
+
/>
|
|
23
|
+
</S.CheckWrapper>
|
|
24
|
+
<S.CounterWrapper>
|
|
25
|
+
<TableCounter totalItems={totalItems} />
|
|
26
|
+
</S.CounterWrapper>
|
|
27
|
+
</S.Header>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
interface IProps {
|
|
32
|
+
totalItems: number;
|
|
33
|
+
selectAllItems: () => void;
|
|
34
|
+
checkState: Record<string, boolean>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default GridHeader;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
const Header = styled.div`
|
|
4
|
+
width: 100%;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
margin-left: ${(p) => p.theme.spacing.m};
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
const CheckWrapper = styled.div`
|
|
12
|
+
label {
|
|
13
|
+
margin-bottom: 0;
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const CounterWrapper = styled.div``;
|
|
18
|
+
|
|
19
|
+
export { Header, CheckWrapper, CounterWrapper };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IBulkAction } from "@ax/types";
|
|
3
|
+
|
|
4
|
+
import GridHeader from "./GridHeader";
|
|
5
|
+
|
|
6
|
+
import * as S from "./style";
|
|
7
|
+
|
|
8
|
+
const BulkGridHeader = (props: IBulkHeaderProps): JSX.Element => {
|
|
9
|
+
const { showBulk, checkState, selectItems, selectAllItems, totalItems, bulkActions } = props;
|
|
10
|
+
|
|
11
|
+
return showBulk ? (
|
|
12
|
+
<S.BulkWrapper>
|
|
13
|
+
<S.StyledBulkSelectionOptions
|
|
14
|
+
isScrolling={false}
|
|
15
|
+
checkState={checkState}
|
|
16
|
+
actions={bulkActions}
|
|
17
|
+
selectItems={selectItems}
|
|
18
|
+
totalItems={totalItems}
|
|
19
|
+
/>
|
|
20
|
+
</S.BulkWrapper>
|
|
21
|
+
) : (
|
|
22
|
+
<GridHeader selectAllItems={selectAllItems} checkState={checkState} totalItems={totalItems} />
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export interface IBulkHeaderProps {
|
|
27
|
+
showBulk: boolean;
|
|
28
|
+
checkState: any;
|
|
29
|
+
selectItems: () => void;
|
|
30
|
+
selectAllItems: () => void;
|
|
31
|
+
totalItems: number;
|
|
32
|
+
bulkActions: IBulkAction[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default BulkGridHeader;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { BulkSelectionOptions } from "@ax/components";
|
|
4
|
+
|
|
5
|
+
const BulkWrapper = styled.div`
|
|
6
|
+
width: 100%;
|
|
7
|
+
span {
|
|
8
|
+
margin-left: ${(p) => p.theme.spacing.xs};
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
const StyledBulkSelectionOptions = styled(BulkSelectionOptions)`
|
|
13
|
+
padding: ${(p) => `0 0 0 ${p.theme.spacing.xs}`};
|
|
14
|
+
height: ${(p) => p.theme.spacing.s};
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export { BulkWrapper, StyledBulkSelectionOptions }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { CheckField, TableCounter } from "@ax/components";
|
|
4
|
+
|
|
5
|
+
import * as S from "./style";
|
|
6
|
+
|
|
7
|
+
const TableHeader = (props: IProps): JSX.Element => {
|
|
8
|
+
const { isScrolling, selectAllItems, checkState, totalItems } = props;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<S.TableHeader isScrolling={isScrolling}>
|
|
12
|
+
<S.CheckHeader>
|
|
13
|
+
<CheckField
|
|
14
|
+
key="selectAll"
|
|
15
|
+
name="selectAll"
|
|
16
|
+
value="selectAll"
|
|
17
|
+
onChange={selectAllItems}
|
|
18
|
+
checked={checkState.isAllSelected}
|
|
19
|
+
disabled={false}
|
|
20
|
+
error={false}
|
|
21
|
+
/>
|
|
22
|
+
</S.CheckHeader>
|
|
23
|
+
<S.NameHeader>Name</S.NameHeader>
|
|
24
|
+
<S.TypeHeader>Type</S.TypeHeader>
|
|
25
|
+
<S.SizeHeader>Size</S.SizeHeader>
|
|
26
|
+
<S.UpdatedHeader>Updated</S.UpdatedHeader>
|
|
27
|
+
<S.TagsHeader>Tags</S.TagsHeader>
|
|
28
|
+
<S.CounterHeader>
|
|
29
|
+
<TableCounter totalItems={totalItems} />
|
|
30
|
+
</S.CounterHeader>
|
|
31
|
+
</S.TableHeader>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
interface IProps {
|
|
36
|
+
isScrolling: boolean;
|
|
37
|
+
totalItems: number;
|
|
38
|
+
selectAllItems: () => void;
|
|
39
|
+
checkState: Record<string, boolean>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default TableHeader;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
import { Header } from "@ax/components/TableList/style";
|
|
4
|
+
|
|
5
|
+
const TableHeader = styled.div<{ isScrolling?: boolean }>`
|
|
6
|
+
width: 100%;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
padding-bottom: ${(p) => p.theme.spacing.m};
|
|
10
|
+
border-bottom: ${(p) => (p.isScrolling ? `1px solid ${p.theme.color.uiLine};` : "")};
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
const CheckHeader = styled(Header)`
|
|
14
|
+
padding-right: 0;
|
|
15
|
+
width: 40px;
|
|
16
|
+
label {
|
|
17
|
+
margin-bottom: ${(p) => p.theme.spacing.s};
|
|
18
|
+
}
|
|
19
|
+
> div {
|
|
20
|
+
width: ${(p) => p.theme.spacing.s};
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const NameHeader = styled(Header)`
|
|
25
|
+
flex-grow: 1;
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const TypeHeader = styled(Header)`
|
|
29
|
+
flex: 0 0 80px;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const SizeHeader = styled(Header)`
|
|
34
|
+
flex: 0 0 80px;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const UpdatedHeader = styled(Header)`
|
|
39
|
+
flex: 0 0 120px;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
const TagsHeader = styled(Header)`
|
|
44
|
+
flex: 0 0 300px;
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
const CounterHeader = styled(Header)`
|
|
48
|
+
flex: 0 0 70px;
|
|
49
|
+
justify-content: flex-end;
|
|
50
|
+
padding 0;
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
export { TableHeader, CheckHeader, NameHeader, TypeHeader, SizeHeader, UpdatedHeader, TagsHeader, CounterHeader };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IBulkAction } from "@ax/types";
|
|
3
|
+
|
|
4
|
+
import TableHeader from "./TableHeader";
|
|
5
|
+
|
|
6
|
+
import * as S from "./style";
|
|
7
|
+
|
|
8
|
+
const BulkListHeader = (props: IBulkHeaderProps): JSX.Element => {
|
|
9
|
+
const { showBulk, checkState, selectItems, selectAllItems, totalItems, bulkActions } = props;
|
|
10
|
+
|
|
11
|
+
return showBulk ? (
|
|
12
|
+
<S.BulkWrapper>
|
|
13
|
+
<S.StyledBulkSelectionOptions
|
|
14
|
+
isScrolling={false}
|
|
15
|
+
checkState={checkState}
|
|
16
|
+
actions={bulkActions}
|
|
17
|
+
selectItems={selectItems}
|
|
18
|
+
totalItems={totalItems}
|
|
19
|
+
/>
|
|
20
|
+
</S.BulkWrapper>
|
|
21
|
+
) : (
|
|
22
|
+
<TableHeader isScrolling={false} selectAllItems={selectAllItems} checkState={checkState} totalItems={totalItems} />
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export interface IBulkHeaderProps {
|
|
27
|
+
showBulk: boolean;
|
|
28
|
+
checkState: any;
|
|
29
|
+
selectItems: () => void;
|
|
30
|
+
selectAllItems: () => void;
|
|
31
|
+
totalItems: number;
|
|
32
|
+
bulkActions: IBulkAction[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default BulkListHeader;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { BulkSelectionOptions } from "@ax/components";
|
|
3
|
+
|
|
4
|
+
const BulkWrapper = styled.div`
|
|
5
|
+
width: 100%;
|
|
6
|
+
span {
|
|
7
|
+
margin-left: ${(p) => p.theme.spacing.xs};
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
const StyledBulkSelectionOptions = styled(BulkSelectionOptions)`
|
|
12
|
+
padding: ${(p) => `0 0 ${p.theme.spacing.m} 0`};
|
|
13
|
+
margin-top: ${(p) => `-${p.theme.spacing.xs}`};
|
|
14
|
+
margin-bottom: ${(p) => `-${p.theme.spacing.xs}`};
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export { BulkWrapper, StyledBulkSelectionOptions }
|