@vidispine/vdt-mui 23.4.0-pre.3 → 23.4.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/dist/cjs/collection/CollectionList/CollectionList.js +1 -1
- package/dist/cjs/entity/EntityList/EntityList.js +1 -1
- package/dist/cjs/event/EventList/components/EventListHeader.js +1 -1
- package/dist/cjs/general/AvatarMenu/components/MenuItem.js +1 -1
- package/dist/cjs/general/CompactLabel/CompactLabel.js +1 -1
- package/dist/cjs/general/Form/Form.js +1 -1
- package/dist/cjs/general/MediaIcon/index.js +1 -1
- package/dist/cjs/general/MenuItem/MenuItem.js +1 -1
- package/dist/cjs/general/Sort/components/MenuItem.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/inputs/_components/MenuItem.js +1 -1
- package/dist/cjs/item/ItemList/ItemList.js +1 -1
- package/dist/cjs/metadata/MetadataGroupTreeView/MetadataGroupTreeView.js +1 -1
- package/dist/cjs/upload/UploadDropzone/UploadDropzone.js +1 -0
- package/dist/cjs/upload/UploadDropzone/index.js +1 -0
- package/dist/cjs/upload/UploadFileTree/UploadFileTree.js +1 -0
- package/dist/cjs/upload/UploadFileTree/index.js +1 -0
- package/dist/cjs/upload/UploadFileTreeItem/UploadFileTreeItem.js +1 -0
- package/dist/cjs/upload/UploadFileTreeItem/index.js +1 -0
- package/dist/cjs/upload/UploadListItem/UploadListItem.js +1 -0
- package/dist/cjs/upload/UploadListItem/components/UploadListItemProgress.js +1 -0
- package/dist/cjs/upload/UploadListItem/components/UploadListItemSecondaryAction.js +1 -0
- package/dist/cjs/upload/UploadListItem/components/UploadListItemText.js +1 -0
- package/dist/cjs/upload/UploadListItem/components/UploadListItemThumbnail.js +1 -0
- package/dist/cjs/upload/UploadListItem/index.js +1 -0
- package/dist/es/collection/CollectionList/CollectionList.js +8 -8
- package/dist/es/entity/EntityIcon/EntityIcon.js +10 -10
- package/dist/es/entity/EntityList/EntityList.js +4 -4
- package/dist/es/general/AvatarMenu/components/MenuItem.js +6 -6
- package/dist/es/general/CompactBadge/CompactBadge.js +2 -2
- package/dist/es/general/CompactLabel/CompactLabel.js +3 -3
- package/dist/es/general/Form/Form.js +1 -1
- package/dist/es/general/MediaIcon/index.js +2 -2
- package/dist/es/general/Sort/components/MenuItem.js +4 -4
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +57 -49
- package/dist/es/inputs/_components/MenuItem.js +2 -2
- package/dist/es/item/ItemList/ItemList.js +13 -13
- package/dist/es/metadata/MetadataGroupTreeView/MetadataGroupTreeView.d.ts +3 -3
- package/dist/es/metadata/MetadataGroupTreeView/MetadataGroupTreeView.js +21 -22
- package/dist/es/upload/UploadDropzone/UploadDropzone.d.ts +59 -0
- package/dist/es/upload/UploadDropzone/UploadDropzone.js +111 -0
- package/dist/es/upload/UploadDropzone/index.d.ts +3 -0
- package/dist/es/upload/UploadDropzone/index.js +12 -0
- package/dist/es/upload/UploadFileTree/UploadFileTree.d.ts +35 -0
- package/dist/es/upload/UploadFileTree/UploadFileTree.js +30 -0
- package/dist/es/upload/UploadFileTree/index.d.ts +3 -0
- package/dist/es/upload/UploadFileTree/index.js +12 -0
- package/dist/es/upload/UploadFileTreeItem/UploadFileTreeItem.d.ts +34 -0
- package/dist/es/upload/UploadFileTreeItem/UploadFileTreeItem.js +55 -0
- package/dist/es/upload/UploadFileTreeItem/index.d.ts +3 -0
- package/dist/es/upload/UploadFileTreeItem/index.js +12 -0
- package/dist/es/upload/UploadListItem/UploadListItem.d.ts +48 -0
- package/dist/es/upload/UploadListItem/UploadListItem.js +90 -0
- package/dist/es/upload/UploadListItem/components/UploadListItemProgress.d.ts +7 -0
- package/dist/es/upload/UploadListItem/components/UploadListItemProgress.js +16 -0
- package/dist/es/upload/UploadListItem/components/UploadListItemSecondaryAction.d.ts +9 -0
- package/dist/es/upload/UploadListItem/components/UploadListItemSecondaryAction.js +33 -0
- package/dist/es/upload/UploadListItem/components/UploadListItemText.d.ts +8 -0
- package/dist/es/upload/UploadListItem/components/UploadListItemText.js +30 -0
- package/dist/es/upload/UploadListItem/components/UploadListItemThumbnail.d.ts +6 -0
- package/dist/es/upload/UploadListItem/components/UploadListItemThumbnail.js +52 -0
- package/dist/es/upload/UploadListItem/index.d.ts +3 -0
- package/dist/es/upload/UploadListItem/index.js +12 -0
- package/dist/es/upload/_utils.d.ts +6 -0
- package/dist/es/upload/index.d.ts +4 -0
- package/package.json +18 -15
|
@@ -17,8 +17,8 @@ const q = () => /* @__PURE__ */ m(w, { children: "No items found..." }), A = D(C
|
|
|
17
17
|
}, d = ({
|
|
18
18
|
itemListType: t,
|
|
19
19
|
header: l,
|
|
20
|
-
primary:
|
|
21
|
-
secondary:
|
|
20
|
+
primary: p,
|
|
21
|
+
secondary: u,
|
|
22
22
|
avatarVariant: c,
|
|
23
23
|
dense: f,
|
|
24
24
|
amountLoading: h,
|
|
@@ -27,29 +27,29 @@ const q = () => /* @__PURE__ */ m(w, { children: "No items found..." }), A = D(C
|
|
|
27
27
|
onListItemDelete: L,
|
|
28
28
|
emptySlot: y,
|
|
29
29
|
components: S,
|
|
30
|
-
componentsProps:
|
|
30
|
+
componentsProps: r
|
|
31
31
|
}) => {
|
|
32
32
|
const {
|
|
33
33
|
Root: v,
|
|
34
|
-
ListSubheader:
|
|
35
|
-
ListItem:
|
|
36
|
-
} = S,
|
|
34
|
+
ListSubheader: g,
|
|
35
|
+
ListItem: k
|
|
36
|
+
} = S, M = [...Array(Math.max(h, 0)).keys()].map(() => ({
|
|
37
37
|
key: n()
|
|
38
38
|
})), s = x(() => {
|
|
39
39
|
var o;
|
|
40
|
-
return ((o = t == null ? void 0 : t.item) == null ? void 0 : o.map((
|
|
40
|
+
return ((o = t == null ? void 0 : t.item) == null ? void 0 : o.map((i) => ({
|
|
41
41
|
key: n(),
|
|
42
|
-
itemType:
|
|
42
|
+
itemType: i
|
|
43
43
|
}))) || [];
|
|
44
44
|
}, [t.item]);
|
|
45
|
-
return /* @__PURE__ */ a(v, { dense: f, ...
|
|
46
|
-
/* @__PURE__ */ m(
|
|
45
|
+
return /* @__PURE__ */ a(v, { dense: f, ...r.root, children: [
|
|
46
|
+
/* @__PURE__ */ m(g, { ...r.listSubheader, children: l }),
|
|
47
47
|
/* @__PURE__ */ a(b, { children: [
|
|
48
48
|
!e && s.length === 0 && V(y),
|
|
49
|
-
(e ?
|
|
49
|
+
(e ? M : s).map(({
|
|
50
50
|
key: o,
|
|
51
|
-
itemType:
|
|
52
|
-
}) => /* @__PURE__ */ m(
|
|
51
|
+
itemType: i
|
|
52
|
+
}) => /* @__PURE__ */ m(k, { itemType: i, primary: p, secondary: u, avatarVariant: c, isLoading: e, onClick: I, onDelete: L, ...r.listItem }, o))
|
|
53
53
|
] })
|
|
54
54
|
] });
|
|
55
55
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { MetadataGroupValueType } from '@vidispine/types';
|
|
3
|
-
import { WithOverrideProps } from '../../_types';
|
|
3
|
+
import type { WithOverrideProps, StyledComponent } from '../../_types';
|
|
4
4
|
declare const defaultComponents: {
|
|
5
5
|
Root: any;
|
|
6
|
-
GroupTreeItem: any
|
|
7
|
-
FieldTreeItem: any
|
|
6
|
+
GroupTreeItem: StyledComponent<any>;
|
|
7
|
+
FieldTreeItem: StyledComponent<any>;
|
|
8
8
|
};
|
|
9
9
|
export interface MetadataGroupTreeViewProps extends WithOverrideProps<typeof defaultComponents> {
|
|
10
10
|
/**
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { jsx as t, jsxs as a, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import C from "@mui/
|
|
6
|
-
import { styled as i } from "@mui/material/styles";
|
|
1
|
+
import { jsx as t, jsxs as a, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import b from "@mui/icons-material/esm/ChevronRight";
|
|
3
|
+
import g from "@mui/icons-material/esm/ExpandMore";
|
|
4
|
+
import { styled as o } from "@mui/material/styles";
|
|
5
|
+
import { TreeItem as M, TreeView as C } from "@mui/x-tree-view";
|
|
7
6
|
import { parseFieldList as F } from "@vidispine/vdt-js";
|
|
8
|
-
const m =
|
|
7
|
+
const m = o(M)(() => ({
|
|
9
8
|
userSelect: "all",
|
|
10
9
|
"&:focus, &:hover, &.Mui-selected": {
|
|
11
10
|
"& > .MuiTreeItem-content, .MuiTreeItem-label": {
|
|
@@ -20,10 +19,10 @@ const m = i(g)(() => ({
|
|
|
20
19
|
Root: C,
|
|
21
20
|
GroupTreeItem: m,
|
|
22
21
|
FieldTreeItem: m
|
|
23
|
-
}, s =
|
|
22
|
+
}, s = o("span")(() => ({
|
|
24
23
|
fontWeight: 600,
|
|
25
24
|
fontSize: ".75rem"
|
|
26
|
-
})), S =
|
|
25
|
+
})), S = o("span")(() => ({
|
|
27
26
|
fontSize: ".75rem"
|
|
28
27
|
})), c = ({
|
|
29
28
|
group: n,
|
|
@@ -31,33 +30,33 @@ const m = i(g)(() => ({
|
|
|
31
30
|
componentsProps: r
|
|
32
31
|
}) => {
|
|
33
32
|
const {
|
|
34
|
-
Root:
|
|
35
|
-
GroupTreeItem:
|
|
33
|
+
Root: I,
|
|
34
|
+
GroupTreeItem: p,
|
|
36
35
|
FieldTreeItem: h
|
|
37
|
-
} = f, T = (e = {}) => /* @__PURE__ */ t(h, { nodeId: e.uuid, label: /* @__PURE__ */ a(
|
|
36
|
+
} = f, T = (e = {}) => /* @__PURE__ */ t(h, { nodeId: e.uuid, label: /* @__PURE__ */ a(x, { children: [
|
|
38
37
|
/* @__PURE__ */ t(s, { children: `${e.name}: ` }),
|
|
39
38
|
/* @__PURE__ */ t(S, { children: e.value.join(", ") })
|
|
40
|
-
] }), ...r.fieldTreeItem }, e.uuid),
|
|
41
|
-
var
|
|
42
|
-
return /* @__PURE__ */ a(
|
|
43
|
-
((
|
|
39
|
+
] }), ...r.fieldTreeItem }, e.uuid), d = (e = {}) => {
|
|
40
|
+
var i, u;
|
|
41
|
+
return /* @__PURE__ */ a(p, { nodeId: e.uuid, label: /* @__PURE__ */ t(s, { children: e.name }), ...r.groupTreeItem, children: [
|
|
42
|
+
((i = e.field) == null ? void 0 : i.length) > 0 ? F(e.field, {
|
|
44
43
|
includeFieldAttributes: !0,
|
|
45
44
|
fieldAsList: !0,
|
|
46
45
|
arrayOnSingleValue: !0
|
|
47
|
-
}).map((
|
|
48
|
-
((u = e.group) == null ? void 0 : u.length) > 0 ? e.group.map((
|
|
46
|
+
}).map((l) => T(l)) : null,
|
|
47
|
+
((u = e.group) == null ? void 0 : u.length) > 0 ? e.group.map((l) => d(l)) : null
|
|
49
48
|
] }, e.uuid);
|
|
50
49
|
};
|
|
51
|
-
return /* @__PURE__ */ t(
|
|
50
|
+
return /* @__PURE__ */ t(I, { defaultCollapseIcon: /* @__PURE__ */ t(g, {}), defaultExpanded: [n == null ? void 0 : n.uuid], defaultExpandIcon: /* @__PURE__ */ t(b, {}), sx: {
|
|
52
51
|
maxWidth: 400
|
|
53
|
-
}, ...r.root, children:
|
|
52
|
+
}, ...r.root, children: d(n) });
|
|
54
53
|
};
|
|
55
54
|
c.defaultProps = {
|
|
56
55
|
group: void 0,
|
|
57
56
|
components: v,
|
|
58
57
|
componentsProps: void 0
|
|
59
58
|
};
|
|
60
|
-
const
|
|
59
|
+
const R = c;
|
|
61
60
|
export {
|
|
62
|
-
|
|
61
|
+
R as default
|
|
63
62
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Box as MuiBox, Typography as MuiTypography, LinearProgress as MuiLinearProgress } from '@mui/material';
|
|
3
|
+
import type { StyledComponent, WithOverrideProps } from '../../_types';
|
|
4
|
+
import type { FileRejection, DropEvent, DropzoneOptions } from 'react-dropzone';
|
|
5
|
+
declare const StyledMuiBoxRoot: typeof MuiBox;
|
|
6
|
+
type StyledMuiBoxType = StyledComponent<typeof MuiBox, {
|
|
7
|
+
isDragActive?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
declare const StyledMuiBox: StyledMuiBoxType;
|
|
10
|
+
declare const StyledNativeInput: StyledComponent<typeof MuiBox<'input'>, React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>>;
|
|
11
|
+
declare const StyledMuiLinearProgress: typeof MuiLinearProgress;
|
|
12
|
+
declare const defaultComponents: {
|
|
13
|
+
Root: typeof StyledMuiBoxRoot;
|
|
14
|
+
Box: typeof StyledMuiBox;
|
|
15
|
+
Input: typeof StyledNativeInput;
|
|
16
|
+
Typography: typeof MuiTypography;
|
|
17
|
+
LinearProgress: typeof StyledMuiLinearProgress;
|
|
18
|
+
};
|
|
19
|
+
export interface UploadDropzoneProps extends WithOverrideProps<typeof defaultComponents> {
|
|
20
|
+
/**
|
|
21
|
+
* Text to show inside dropzone
|
|
22
|
+
*/
|
|
23
|
+
text?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Disable the upload
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Options for react-dropzone
|
|
30
|
+
*
|
|
31
|
+
* See <a href="https://react-dropzone.js.org/#src" target="_blank">react-dropzone docs</a> for more info
|
|
32
|
+
*/
|
|
33
|
+
dropzoneOptions?: DropzoneOptions;
|
|
34
|
+
/**
|
|
35
|
+
* Callback when entering dropzone
|
|
36
|
+
*/
|
|
37
|
+
onDragEnter?: React.DragEventHandler;
|
|
38
|
+
/**
|
|
39
|
+
* Callback when leaving dropzone
|
|
40
|
+
*/
|
|
41
|
+
onDragLeave?: React.DragEventHandler;
|
|
42
|
+
/**
|
|
43
|
+
* Callback when file dialog is opened
|
|
44
|
+
*/
|
|
45
|
+
onFileDialogOpen?: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Callback when file dialog is cancelled without adding file
|
|
48
|
+
*/
|
|
49
|
+
onFileDialogCancel?: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Callback when files are added, either by being dropped or selected in file dialog
|
|
52
|
+
*/
|
|
53
|
+
onAdd?: (event: DropEvent, payload: {
|
|
54
|
+
files: File[];
|
|
55
|
+
rejectedFiles: FileRejection[];
|
|
56
|
+
}) => void;
|
|
57
|
+
}
|
|
58
|
+
declare const UploadDropzone: React.FC<UploadDropzoneProps>;
|
|
59
|
+
export default UploadDropzone;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as i, jsxs as F } from "react/jsx-runtime";
|
|
2
|
+
import { useState as R, useCallback as j } from "react";
|
|
3
|
+
import { useDropzone as k } from "react-dropzone";
|
|
4
|
+
import l from "@mui/material/Box";
|
|
5
|
+
import z from "@mui/material/Typography";
|
|
6
|
+
import O from "@mui/material/LinearProgress";
|
|
7
|
+
import { styled as t } from "@mui/material/styles";
|
|
8
|
+
const w = t(l)(({
|
|
9
|
+
theme: o
|
|
10
|
+
}) => ({
|
|
11
|
+
height: "100%",
|
|
12
|
+
cursor: "pointer",
|
|
13
|
+
marginTop: o.spacing(1),
|
|
14
|
+
marginBottom: o.spacing(1),
|
|
15
|
+
transition: "min-height 0.3s"
|
|
16
|
+
})), E = t(l, {
|
|
17
|
+
shouldForwardProp: (o) => o !== "isDragActive"
|
|
18
|
+
})(({
|
|
19
|
+
theme: o,
|
|
20
|
+
isDragActive: e
|
|
21
|
+
}) => ({
|
|
22
|
+
position: "relative",
|
|
23
|
+
height: "100%",
|
|
24
|
+
marginTop: o.spacing(0.5),
|
|
25
|
+
borderWidth: 2,
|
|
26
|
+
borderColor: o.palette.primary.main,
|
|
27
|
+
borderRadius: 3,
|
|
28
|
+
borderStyle: "dotted",
|
|
29
|
+
backgroundColor: e ? "rgba(0,0,0,0.2)" : "rgba(0,0,0,0.05)",
|
|
30
|
+
display: "flex",
|
|
31
|
+
flexDirection: "column",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
justifyContent: "center"
|
|
34
|
+
})), A = t("input")(() => ({})), N = t(z)(({
|
|
35
|
+
theme: o
|
|
36
|
+
}) => ({
|
|
37
|
+
color: o.palette.primary.main,
|
|
38
|
+
marginTop: o.spacing(1),
|
|
39
|
+
marginBottom: o.spacing(1),
|
|
40
|
+
pointerEvents: "none"
|
|
41
|
+
})), U = t(O)(() => ({
|
|
42
|
+
width: "calc(100% - 2px)",
|
|
43
|
+
position: "absolute",
|
|
44
|
+
bottom: 0
|
|
45
|
+
})), W = {
|
|
46
|
+
Root: w,
|
|
47
|
+
Box: E,
|
|
48
|
+
Input: A,
|
|
49
|
+
Typography: N,
|
|
50
|
+
LinearProgress: U
|
|
51
|
+
}, g = ({
|
|
52
|
+
text: o,
|
|
53
|
+
disabled: e,
|
|
54
|
+
dropzoneOptions: c,
|
|
55
|
+
onAdd: n,
|
|
56
|
+
onDragEnter: d,
|
|
57
|
+
onDragLeave: u,
|
|
58
|
+
onFileDialogOpen: s,
|
|
59
|
+
onFileDialogCancel: p,
|
|
60
|
+
components: m,
|
|
61
|
+
componentsProps: r
|
|
62
|
+
}) => {
|
|
63
|
+
const {
|
|
64
|
+
Root: f,
|
|
65
|
+
Box: y,
|
|
66
|
+
Input: h,
|
|
67
|
+
Typography: D,
|
|
68
|
+
LinearProgress: x
|
|
69
|
+
} = m, [v, a] = R(!1), b = j((I, M, P) => {
|
|
70
|
+
a(!1), n && n(P, {
|
|
71
|
+
files: I,
|
|
72
|
+
rejectedFiles: M
|
|
73
|
+
});
|
|
74
|
+
}, [n]), C = () => {
|
|
75
|
+
a(!0), s && s();
|
|
76
|
+
}, B = () => {
|
|
77
|
+
a(!1), p && p();
|
|
78
|
+
}, {
|
|
79
|
+
getRootProps: L,
|
|
80
|
+
getInputProps: S,
|
|
81
|
+
isDragActive: T
|
|
82
|
+
} = k({
|
|
83
|
+
disabled: e,
|
|
84
|
+
onDrop: b,
|
|
85
|
+
onDragEnter: d,
|
|
86
|
+
onDragLeave: u,
|
|
87
|
+
onFileDialogOpen: C,
|
|
88
|
+
onFileDialogCancel: B,
|
|
89
|
+
...c
|
|
90
|
+
});
|
|
91
|
+
return /* @__PURE__ */ i(f, { ...r.root, children: /* @__PURE__ */ F(y, { ...r.box, isDragActive: T, ...L(), children: [
|
|
92
|
+
/* @__PURE__ */ i(h, { ...r.input, ...S() }),
|
|
93
|
+
/* @__PURE__ */ i(D, { ...r.typography, children: o }),
|
|
94
|
+
v && /* @__PURE__ */ i(x, { ...r.linearProgress })
|
|
95
|
+
] }) });
|
|
96
|
+
};
|
|
97
|
+
g.defaultProps = {
|
|
98
|
+
text: "Drop files or click to open",
|
|
99
|
+
dropzoneOptions: {},
|
|
100
|
+
onAdd: void 0,
|
|
101
|
+
onDragEnter: void 0,
|
|
102
|
+
onDragLeave: void 0,
|
|
103
|
+
onFileDialogOpen: void 0,
|
|
104
|
+
onFileDialogCancel: void 0,
|
|
105
|
+
components: W,
|
|
106
|
+
componentsProps: void 0
|
|
107
|
+
};
|
|
108
|
+
const X = g;
|
|
109
|
+
export {
|
|
110
|
+
X as default
|
|
111
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { styled as r } from "@mui/material/styles";
|
|
2
|
+
import m from "./UploadDropzone.js";
|
|
3
|
+
import { withOverrides as s } from "../../_utils/withOverrides.js";
|
|
4
|
+
const o = "UploadFileTree", e = `Vdt${o}`, p = s(e)(m), t = r(p, {
|
|
5
|
+
name: e,
|
|
6
|
+
overridesResolver: (d, n) => n.root
|
|
7
|
+
})(() => ({}));
|
|
8
|
+
t.displayName = o;
|
|
9
|
+
const c = t;
|
|
10
|
+
export {
|
|
11
|
+
c as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TreeView as MuiTreeView } from '@mui/x-tree-view';
|
|
3
|
+
import { WithOverrideProps } from '../../_types';
|
|
4
|
+
import VdtUploadFileTreeItem from '../UploadFileTreeItem';
|
|
5
|
+
declare const defaultComponents: {
|
|
6
|
+
Root: typeof MuiTreeView;
|
|
7
|
+
TreeItem: typeof VdtUploadFileTreeItem;
|
|
8
|
+
};
|
|
9
|
+
export type FileTree = {
|
|
10
|
+
file: File;
|
|
11
|
+
path?: string;
|
|
12
|
+
progress?: {
|
|
13
|
+
totalBytes: number;
|
|
14
|
+
transferredBytes: number;
|
|
15
|
+
};
|
|
16
|
+
files?: Record<string, FileTree>;
|
|
17
|
+
};
|
|
18
|
+
export interface UploadFileTreeProps extends WithOverrideProps<typeof defaultComponents> {
|
|
19
|
+
/**
|
|
20
|
+
* A file tree to display
|
|
21
|
+
*/
|
|
22
|
+
fileTree?: {
|
|
23
|
+
[fileName: string]: FileTree;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Callback when clicking on a file or folder in the tree
|
|
27
|
+
*/
|
|
28
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>, payload: FileTree) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Callback when clicking remove on a node in the tree
|
|
31
|
+
*/
|
|
32
|
+
onRemove?: (event: React.MouseEvent<HTMLButtonElement>, payload: FileTree) => void;
|
|
33
|
+
}
|
|
34
|
+
declare const UploadFileTree: React.FC<UploadFileTreeProps>;
|
|
35
|
+
export default UploadFileTree;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { TreeView as p } from "@mui/x-tree-view";
|
|
3
|
+
import s from "../UploadFileTreeItem/index.js";
|
|
4
|
+
const c = {
|
|
5
|
+
Root: p,
|
|
6
|
+
TreeItem: s
|
|
7
|
+
}, r = ({
|
|
8
|
+
fileTree: e,
|
|
9
|
+
onClick: n,
|
|
10
|
+
onRemove: m,
|
|
11
|
+
components: i,
|
|
12
|
+
componentsProps: o
|
|
13
|
+
}) => {
|
|
14
|
+
const {
|
|
15
|
+
Root: l,
|
|
16
|
+
TreeItem: d
|
|
17
|
+
} = i;
|
|
18
|
+
return e ? /* @__PURE__ */ t(l, { ...o.root, children: /* @__PURE__ */ t(d, { fileTree: e, onClick: n, onRemove: m, ...o.treeItem }) }) : null;
|
|
19
|
+
};
|
|
20
|
+
r.defaultProps = {
|
|
21
|
+
fileTree: {},
|
|
22
|
+
onClick: void 0,
|
|
23
|
+
onRemove: void 0,
|
|
24
|
+
components: c,
|
|
25
|
+
componentsProps: void 0
|
|
26
|
+
};
|
|
27
|
+
const T = r;
|
|
28
|
+
export {
|
|
29
|
+
T as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { styled as r } from "@mui/material/styles";
|
|
2
|
+
import m from "./UploadFileTree.js";
|
|
3
|
+
import { withOverrides as s } from "../../_utils/withOverrides.js";
|
|
4
|
+
const o = "UploadFileTree", e = `Vdt${o}`, p = s(e)(m), t = r(p, {
|
|
5
|
+
name: e,
|
|
6
|
+
overridesResolver: (d, n) => n.root
|
|
7
|
+
})(() => ({}));
|
|
8
|
+
t.displayName = o;
|
|
9
|
+
const c = t;
|
|
10
|
+
export {
|
|
11
|
+
c as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TreeItem as MuiTreeItem } from '@mui/x-tree-view';
|
|
3
|
+
import VdtUploadListItem from '../UploadListItem';
|
|
4
|
+
import type { StyledComponent, WithOverrideProps } from '../../_types';
|
|
5
|
+
declare const StyledMuiTreeItem: StyledComponent<typeof MuiTreeItem>;
|
|
6
|
+
declare const defaultComponents: {
|
|
7
|
+
Root: typeof StyledMuiTreeItem;
|
|
8
|
+
Label: typeof VdtUploadListItem;
|
|
9
|
+
};
|
|
10
|
+
export type FileTree = {
|
|
11
|
+
file: File;
|
|
12
|
+
path?: string;
|
|
13
|
+
progress?: {
|
|
14
|
+
totalBytes: number;
|
|
15
|
+
transferredBytes: number;
|
|
16
|
+
};
|
|
17
|
+
files?: Record<string, FileTree>;
|
|
18
|
+
};
|
|
19
|
+
export interface UploadFileTreeItemProps extends WithOverrideProps<typeof defaultComponents> {
|
|
20
|
+
/**
|
|
21
|
+
* The file tree entity to show
|
|
22
|
+
*/
|
|
23
|
+
fileTree?: Record<string, FileTree>;
|
|
24
|
+
/**
|
|
25
|
+
* Callback when clicking on a file or folder in the tree
|
|
26
|
+
*/
|
|
27
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>, payload: FileTree) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Callback when clicking remove on a node in the tree
|
|
30
|
+
*/
|
|
31
|
+
onRemove?: (event: React.MouseEvent<HTMLButtonElement>, payload: FileTree) => void;
|
|
32
|
+
}
|
|
33
|
+
declare const UploadFileTreeItem: React.FC<UploadFileTreeItemProps>;
|
|
34
|
+
export default UploadFileTreeItem;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as e, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import { styled as I } from "@mui/material/styles";
|
|
3
|
+
import { TreeItem as T } from "@mui/x-tree-view";
|
|
4
|
+
import g from "../UploadListItem/index.js";
|
|
5
|
+
const v = I(T)(({
|
|
6
|
+
theme: o
|
|
7
|
+
}) => ({
|
|
8
|
+
"& .MuiTreeItem-content": {
|
|
9
|
+
padding: 0,
|
|
10
|
+
"&.Mui-selected": {
|
|
11
|
+
backgroundColor: `${o.palette.primary.main}`,
|
|
12
|
+
// nested to get higher importance that default
|
|
13
|
+
"&.Mui-focused": {
|
|
14
|
+
backgroundColor: `${o.palette.primary.main}`
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"& .MuiTreeItem-iconContainer": {
|
|
19
|
+
display: "none !important"
|
|
20
|
+
}
|
|
21
|
+
})), y = {
|
|
22
|
+
Root: v,
|
|
23
|
+
Label: g
|
|
24
|
+
}, d = ({
|
|
25
|
+
fileTree: o,
|
|
26
|
+
onClick: t,
|
|
27
|
+
onRemove: r,
|
|
28
|
+
components: m,
|
|
29
|
+
componentsProps: i
|
|
30
|
+
}) => {
|
|
31
|
+
const {
|
|
32
|
+
Root: s,
|
|
33
|
+
Label: c
|
|
34
|
+
} = m;
|
|
35
|
+
return /* @__PURE__ */ e(b, { children: Object.entries(o).map(([, n]) => {
|
|
36
|
+
const {
|
|
37
|
+
file: u,
|
|
38
|
+
path: l,
|
|
39
|
+
progress: f,
|
|
40
|
+
files: p
|
|
41
|
+
} = n;
|
|
42
|
+
return /* @__PURE__ */ e(s, { nodeId: l, icon: /* @__PURE__ */ e("div", {}), label: /* @__PURE__ */ e(c, { file: u, progress: f, onRemove: r ? (a) => r(a, n) : void 0, onClick: t ? (a) => t(a, n) : void 0, ...i.label }, l), ...i.root, children: Object.keys(p ?? {}).length > 0 && /* @__PURE__ */ e(d, { fileTree: p, onClick: t, onRemove: r, components: m, componentsProps: i }) }, l);
|
|
43
|
+
}) });
|
|
44
|
+
};
|
|
45
|
+
d.defaultProps = {
|
|
46
|
+
fileTree: {},
|
|
47
|
+
onClick: void 0,
|
|
48
|
+
onRemove: void 0,
|
|
49
|
+
components: y,
|
|
50
|
+
componentsProps: void 0
|
|
51
|
+
};
|
|
52
|
+
const k = d;
|
|
53
|
+
export {
|
|
54
|
+
k as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { styled as m } from "@mui/material/styles";
|
|
2
|
+
import n from "./UploadFileTreeItem.js";
|
|
3
|
+
import { withOverrides as s } from "../../_utils/withOverrides.js";
|
|
4
|
+
const e = "UploadFileTreeItem", o = `Vdt${e}`, d = s(o)(n), t = m(d, {
|
|
5
|
+
name: o,
|
|
6
|
+
overridesResolver: (i, r) => r.root
|
|
7
|
+
})({});
|
|
8
|
+
t.displayName = e;
|
|
9
|
+
const c = t;
|
|
10
|
+
export {
|
|
11
|
+
c as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ListItem as MuiListItem } from '@mui/material';
|
|
3
|
+
import { StyledComponent, WithOverrideProps } from '../../_types';
|
|
4
|
+
import VdtUploadListItemSecondaryAction from './components/UploadListItemSecondaryAction';
|
|
5
|
+
import VdtUploadListItemText from './components/UploadListItemText';
|
|
6
|
+
import VdtUploadListItemThumbnail from './components/UploadListItemThumbnail';
|
|
7
|
+
type StyledMuiListItemType = StyledComponent<typeof MuiListItem, {
|
|
8
|
+
isComplete?: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
declare const StyledMuiListItem: StyledMuiListItemType;
|
|
11
|
+
declare const StyledVdtUploadListItemText: typeof VdtUploadListItemText;
|
|
12
|
+
declare const defaultComponents: {
|
|
13
|
+
Root: typeof StyledMuiListItem;
|
|
14
|
+
ListItemThumbnail: typeof VdtUploadListItemThumbnail;
|
|
15
|
+
ListItemText: typeof StyledVdtUploadListItemText;
|
|
16
|
+
ListItemSecondaryAction: typeof VdtUploadListItemSecondaryAction;
|
|
17
|
+
};
|
|
18
|
+
export interface UploadListItemProps extends WithOverrideProps<typeof defaultComponents> {
|
|
19
|
+
/**
|
|
20
|
+
* A file that the item represents
|
|
21
|
+
*/
|
|
22
|
+
file?: Partial<File>;
|
|
23
|
+
/**
|
|
24
|
+
* A progress object
|
|
25
|
+
*/
|
|
26
|
+
progress?: {
|
|
27
|
+
totalBytes: number;
|
|
28
|
+
transferredBytes: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Callback for clicking on the item
|
|
32
|
+
*/
|
|
33
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
34
|
+
/**
|
|
35
|
+
* Callback for clicking on remove
|
|
36
|
+
*/
|
|
37
|
+
onRemove?: React.MouseEventHandler<HTMLButtonElement>;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the item is selected or not
|
|
40
|
+
*/
|
|
41
|
+
selected?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the upload is ongoing or not
|
|
44
|
+
*/
|
|
45
|
+
isUploading?: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare const UploadListItem: React.FC<UploadListItemProps>;
|
|
48
|
+
export default UploadListItem;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsxs as v, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import b from "@mui/material/ListItem";
|
|
3
|
+
import { styled as r, emphasize as g } from "@mui/material/styles";
|
|
4
|
+
import T from "./components/UploadListItemSecondaryAction.js";
|
|
5
|
+
import C from "./components/UploadListItemText.js";
|
|
6
|
+
import U from "./components/UploadListItemThumbnail.js";
|
|
7
|
+
const x = r(b, {
|
|
8
|
+
shouldForwardProp: (o) => typeof o != "string" || !["isComplete", "selected"].includes(o)
|
|
9
|
+
})(({
|
|
10
|
+
isComplete: o,
|
|
11
|
+
selected: t,
|
|
12
|
+
theme: e
|
|
13
|
+
}) => ({
|
|
14
|
+
cursor: o ? "default" : "pointer",
|
|
15
|
+
"&:not(:first-of-type)": {
|
|
16
|
+
marginTop: e.spacing(0.5)
|
|
17
|
+
},
|
|
18
|
+
paddingLeft: 8,
|
|
19
|
+
backgroundColor: g(e.palette.background.paper, 0.05),
|
|
20
|
+
"&:hover": {
|
|
21
|
+
...!t && {
|
|
22
|
+
backgroundColor: e.palette.background.paper
|
|
23
|
+
},
|
|
24
|
+
"& .UploadListItemActions-completeIcon": {
|
|
25
|
+
visibility: "hidden"
|
|
26
|
+
},
|
|
27
|
+
"& .UploadListItemActions-progressIcon": {
|
|
28
|
+
visibility: "hidden"
|
|
29
|
+
},
|
|
30
|
+
"& .UploadListItemActions-deleteIcon": {
|
|
31
|
+
visibility: "visible"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
})), k = r(C)(() => ({
|
|
35
|
+
margin: 4
|
|
36
|
+
})), A = {
|
|
37
|
+
Root: x,
|
|
38
|
+
ListItemThumbnail: U,
|
|
39
|
+
ListItemText: k,
|
|
40
|
+
ListItemSecondaryAction: T
|
|
41
|
+
}, m = ({
|
|
42
|
+
file: o,
|
|
43
|
+
progress: t,
|
|
44
|
+
onClick: e,
|
|
45
|
+
onRemove: l,
|
|
46
|
+
selected: c,
|
|
47
|
+
isUploading: p,
|
|
48
|
+
components: I,
|
|
49
|
+
componentsProps: i
|
|
50
|
+
}) => {
|
|
51
|
+
const {
|
|
52
|
+
Root: f,
|
|
53
|
+
ListItemThumbnail: u,
|
|
54
|
+
ListItemText: L,
|
|
55
|
+
ListItemSecondaryAction: y
|
|
56
|
+
} = I, a = t && t.transferredBytes ? Math.floor(t.transferredBytes / t.totalBytes * 100) : 0, n = a === 100, h = (s) => {
|
|
57
|
+
s.stopPropagation(), l && l(s);
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ v(
|
|
60
|
+
f,
|
|
61
|
+
{
|
|
62
|
+
component: "div",
|
|
63
|
+
isComplete: n,
|
|
64
|
+
onClick: n ? void 0 : (s) => {
|
|
65
|
+
e && e(s);
|
|
66
|
+
},
|
|
67
|
+
selected: c,
|
|
68
|
+
...i.root,
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ d(u, { file: o, ...i.listItemThumbnail }),
|
|
71
|
+
/* @__PURE__ */ d(L, { file: o, showProgress: !!t, progressPercent: a, ...i.listItemText }),
|
|
72
|
+
/* @__PURE__ */ d(y, { progress: t, isComplete: n, onRemove: h, isUploading: p, ...i.listItemSecondaryAction })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
m.defaultProps = {
|
|
78
|
+
file: void 0,
|
|
79
|
+
progress: void 0,
|
|
80
|
+
selected: !1,
|
|
81
|
+
isUploading: !1,
|
|
82
|
+
onClick: void 0,
|
|
83
|
+
onRemove: void 0,
|
|
84
|
+
components: A,
|
|
85
|
+
componentsProps: void 0
|
|
86
|
+
};
|
|
87
|
+
const w = m;
|
|
88
|
+
export {
|
|
89
|
+
w as default
|
|
90
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LinearProgressProps } from '@mui/material';
|
|
3
|
+
interface UploadListItemProgressProps extends LinearProgressProps {
|
|
4
|
+
value: number;
|
|
5
|
+
}
|
|
6
|
+
declare const UploadListItemProgress: React.FC<UploadListItemProgressProps>;
|
|
7
|
+
export default UploadListItemProgress;
|