@box/metadata-view 0.9.0 → 0.11.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/esm/lib/components/item-action-menu/index.js +4 -0
- package/dist/esm/lib/components/item-action-menu/item-action-menu.js +65 -59
- package/dist/esm/lib/components/metadata-table/index.js +4 -0
- package/dist/esm/lib/components/metadata-table/metadata-table.js +50 -70
- package/dist/esm/lib/components/metadata-table/table-body/ghost-table-body.js +27 -0
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +42 -0
- package/dist/esm/lib/metadata-view.js +6 -6
- package/dist/types/lib/components/item-action-menu/index.d.ts +1 -0
- package/dist/types/lib/components/item-action-menu/item-action-menu.d.ts +3 -2
- package/dist/types/lib/components/metadata-table/index.d.ts +2 -0
- package/dist/types/lib/components/metadata-table/metadata-table.d.ts +3 -2
- package/dist/types/lib/components/metadata-table/table-body/ghost-table-body.d.ts +6 -0
- package/dist/types/lib/components/metadata-table/table-body/table-body-with-data.d.ts +4 -0
- package/dist/types/lib/metadata-view.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,78 +1,84 @@
|
|
|
1
|
-
import { useIntl as
|
|
2
|
-
import {
|
|
3
|
-
import { Ellipsis as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import '../../../../styles/item-action-menu.css';const
|
|
7
|
-
tableActionBar:
|
|
8
|
-
actionItemIcon:
|
|
1
|
+
import { useIntl as M } from "react-intl";
|
|
2
|
+
import { IconButton as p, DropdownMenu as t } from "@box/blueprint-web";
|
|
3
|
+
import { Ellipsis as _ } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
|
+
import k from "./messages.js";
|
|
5
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
6
|
+
import '../../../../styles/item-action-menu.css';const B = "_tableActionBar_akgtp_1", C = "_actionItemIcon_akgtp_6", m = {
|
|
7
|
+
tableActionBar: B,
|
|
8
|
+
actionItemIcon: C
|
|
9
9
|
};
|
|
10
|
-
function
|
|
11
|
-
item:
|
|
12
|
-
label:
|
|
13
|
-
onClick:
|
|
14
|
-
icon:
|
|
10
|
+
function b({
|
|
11
|
+
item: c,
|
|
12
|
+
label: o,
|
|
13
|
+
onClick: l,
|
|
14
|
+
icon: r
|
|
15
15
|
}) {
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const i = () => {
|
|
17
|
+
l(c);
|
|
18
18
|
};
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
onClick:
|
|
21
|
-
children: [/* @__PURE__ */
|
|
22
|
-
className:
|
|
23
|
-
}),
|
|
24
|
-
},
|
|
19
|
+
return /* @__PURE__ */ a(t.Item, {
|
|
20
|
+
onClick: i,
|
|
21
|
+
children: [/* @__PURE__ */ e(r, {
|
|
22
|
+
className: m.actionItemIcon
|
|
23
|
+
}), o]
|
|
24
|
+
}, o);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
actions:
|
|
28
|
-
|
|
26
|
+
function R({
|
|
27
|
+
actions: c,
|
|
28
|
+
inlineActions: o,
|
|
29
|
+
isDisabled: l,
|
|
29
30
|
item: r,
|
|
30
|
-
onOpenChange:
|
|
31
|
-
subMenuActions:
|
|
32
|
-
subMenuTrigger:
|
|
31
|
+
onOpenChange: i,
|
|
32
|
+
subMenuActions: s,
|
|
33
|
+
subMenuTrigger: u
|
|
33
34
|
}) {
|
|
34
35
|
const {
|
|
35
|
-
formatMessage:
|
|
36
|
-
} =
|
|
37
|
-
label:
|
|
38
|
-
icon:
|
|
39
|
-
} =
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
-
className:
|
|
42
|
-
children:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
formatMessage: g
|
|
37
|
+
} = M(), {
|
|
38
|
+
label: h,
|
|
39
|
+
icon: I
|
|
40
|
+
} = u || {};
|
|
41
|
+
return /* @__PURE__ */ a("div", {
|
|
42
|
+
className: m.tableActionBar,
|
|
43
|
+
children: [o == null ? void 0 : o.map(({
|
|
44
|
+
onClick: n,
|
|
45
|
+
label: d,
|
|
46
|
+
icon: f
|
|
47
|
+
}) => /* @__PURE__ */ e(p, {
|
|
48
|
+
"aria-label": d,
|
|
49
|
+
icon: f,
|
|
50
|
+
onClick: () => n(r),
|
|
51
|
+
size: "large"
|
|
52
|
+
}, `${r.id}-${d}`)), c ? /* @__PURE__ */ a(t.Root, {
|
|
53
|
+
onOpenChange: i,
|
|
54
|
+
children: [/* @__PURE__ */ e(t.Trigger, {
|
|
55
|
+
children: /* @__PURE__ */ e(p, {
|
|
56
|
+
"aria-label": g(k.actionMenu),
|
|
57
|
+
disabled: l,
|
|
58
|
+
icon: _,
|
|
49
59
|
size: "large"
|
|
50
60
|
})
|
|
51
|
-
}), /* @__PURE__ */
|
|
61
|
+
}), /* @__PURE__ */ a(t.Content, {
|
|
52
62
|
align: "start",
|
|
53
|
-
children: [
|
|
54
|
-
...e
|
|
55
|
-
}) => /* @__PURE__ */ n(I, {
|
|
63
|
+
children: [c.map((n) => /* @__PURE__ */ e(b, {
|
|
56
64
|
item: r,
|
|
57
|
-
...
|
|
58
|
-
},
|
|
59
|
-
children: [/* @__PURE__ */
|
|
60
|
-
children: [
|
|
61
|
-
className:
|
|
62
|
-
}),
|
|
63
|
-
}), /* @__PURE__ */
|
|
64
|
-
children:
|
|
65
|
-
...e
|
|
66
|
-
}) => /* @__PURE__ */ n(I, {
|
|
65
|
+
...n
|
|
66
|
+
}, n.label)), s && u && /* @__PURE__ */ a(t.SubMenuRoot, {
|
|
67
|
+
children: [/* @__PURE__ */ a(t.SubMenuTrigger, {
|
|
68
|
+
children: [I && /* @__PURE__ */ e(I, {
|
|
69
|
+
className: m.actionItemIcon
|
|
70
|
+
}), h]
|
|
71
|
+
}), /* @__PURE__ */ e(t.SubMenuContent, {
|
|
72
|
+
children: s.map((n) => /* @__PURE__ */ e(b, {
|
|
67
73
|
item: r,
|
|
68
|
-
...
|
|
69
|
-
},
|
|
74
|
+
...n
|
|
75
|
+
}, n.label))
|
|
70
76
|
})]
|
|
71
77
|
})]
|
|
72
78
|
})]
|
|
73
|
-
})
|
|
79
|
+
}) : null]
|
|
74
80
|
});
|
|
75
81
|
}
|
|
76
82
|
export {
|
|
77
|
-
|
|
83
|
+
R as ItemActionMenu
|
|
78
84
|
};
|
|
@@ -1,95 +1,75 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { jsx as
|
|
7
|
-
import '../../../../styles/metadata-table.css';const
|
|
8
|
-
tableHeaderActionsWrapper:
|
|
9
|
-
tableHeaderActions:
|
|
10
|
-
selectAllCheckbox:
|
|
11
|
-
},
|
|
12
|
-
columns:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { Text as A, ListCheckbox as H, Table as x, TableHeader as u, Column as _ } from "@box/blueprint-web";
|
|
2
|
+
import { useIntl as g } from "react-intl";
|
|
3
|
+
import y from "./table-body/ghost-table-body.js";
|
|
4
|
+
import C from "./table-body/table-body-with-data.js";
|
|
5
|
+
import h from "./messages.js";
|
|
6
|
+
import { jsx as e, jsxs as T } from "react/jsx-runtime";
|
|
7
|
+
import '../../../../styles/metadata-table.css';const k = "_tableHeaderActionsWrapper_hf6y3_1", W = "_tableHeaderActions_hf6y3_1", w = "_selectAllCheckbox_hf6y3_33", s = {
|
|
8
|
+
tableHeaderActionsWrapper: k,
|
|
9
|
+
tableHeaderActions: W,
|
|
10
|
+
selectAllCheckbox: w
|
|
11
|
+
}, D = ({
|
|
12
|
+
columns: r,
|
|
13
|
+
isLoading: o,
|
|
14
|
+
isSelectAllEnabled: c,
|
|
15
|
+
items: m,
|
|
16
|
+
itemActionMenuProps: b,
|
|
17
|
+
...p
|
|
17
18
|
}) => {
|
|
18
19
|
const {
|
|
19
|
-
formatMessage:
|
|
20
|
-
} =
|
|
20
|
+
formatMessage: i
|
|
21
|
+
} = g(), l = r.map((a) => {
|
|
21
22
|
const {
|
|
22
|
-
id:
|
|
23
|
-
headerRenderer:
|
|
23
|
+
id: n,
|
|
24
|
+
headerRenderer: d,
|
|
24
25
|
textValue: t,
|
|
25
|
-
...
|
|
26
|
-
} =
|
|
26
|
+
...f
|
|
27
|
+
} = a;
|
|
27
28
|
return {
|
|
28
|
-
children:
|
|
29
|
+
children: d ? d(t, a) : /* @__PURE__ */ e(A, {
|
|
29
30
|
as: "span",
|
|
30
31
|
children: t
|
|
31
32
|
}),
|
|
32
|
-
isRowHeader:
|
|
33
|
-
id:
|
|
33
|
+
isRowHeader: n === "name",
|
|
34
|
+
id: n,
|
|
34
35
|
textValue: t,
|
|
35
|
-
...
|
|
36
|
+
...f
|
|
36
37
|
};
|
|
37
38
|
});
|
|
38
|
-
return
|
|
39
|
+
return c && l.push({
|
|
39
40
|
id: "actions",
|
|
40
|
-
className:
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
className:
|
|
43
|
-
children: /* @__PURE__ */
|
|
44
|
-
"aria-label":
|
|
45
|
-
className:
|
|
41
|
+
className: s.tableHeaderActions,
|
|
42
|
+
children: /* @__PURE__ */ e("div", {
|
|
43
|
+
className: s.tableHeaderActionsWrapper,
|
|
44
|
+
children: /* @__PURE__ */ e(H, {
|
|
45
|
+
"aria-label": i(h.selectAll),
|
|
46
|
+
className: s.selectAllCheckbox,
|
|
47
|
+
isDisabled: o
|
|
46
48
|
})
|
|
47
49
|
}),
|
|
48
50
|
isRowHeader: !1,
|
|
49
51
|
hideHeader: !1,
|
|
50
52
|
allowsSorting: !1
|
|
51
|
-
}), /* @__PURE__ */
|
|
52
|
-
"aria-label":
|
|
53
|
+
}), /* @__PURE__ */ T(x, {
|
|
54
|
+
"aria-label": i(h.listView),
|
|
53
55
|
selectionBehavior: "toggle",
|
|
54
56
|
selectionMode: "multiple",
|
|
55
|
-
...
|
|
56
|
-
children: [/* @__PURE__ */
|
|
57
|
-
columns:
|
|
58
|
-
children: (
|
|
59
|
-
...
|
|
57
|
+
...p,
|
|
58
|
+
children: [/* @__PURE__ */ e(u, {
|
|
59
|
+
columns: l,
|
|
60
|
+
children: (a) => /* @__PURE__ */ e(_, {
|
|
61
|
+
...a
|
|
60
62
|
})
|
|
61
|
-
}), /* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
children: [c.map((a) => {
|
|
69
|
-
const {
|
|
70
|
-
cellRenderer: r,
|
|
71
|
-
id: t,
|
|
72
|
-
textValue: s
|
|
73
|
-
} = a, p = `${s}-${e.id}`;
|
|
74
|
-
return r ? /* @__PURE__ */ l(b, {
|
|
75
|
-
children: r(e, a)
|
|
76
|
-
}, p) : /* @__PURE__ */ l(b, {
|
|
77
|
-
children: /* @__PURE__ */ l(m, {
|
|
78
|
-
as: "span",
|
|
79
|
-
children: R(e, t)
|
|
80
|
-
})
|
|
81
|
-
}, p);
|
|
82
|
-
}), n && /* @__PURE__ */ l(w, {
|
|
83
|
-
children: (a) => i ? /* @__PURE__ */ l(N, {
|
|
84
|
-
...i,
|
|
85
|
-
item: e,
|
|
86
|
-
onOpenChange: a
|
|
87
|
-
}) : null
|
|
88
|
-
})]
|
|
89
|
-
}, e.id)
|
|
63
|
+
}), o ? /* @__PURE__ */ e(y, {
|
|
64
|
+
columnLength: l.length
|
|
65
|
+
}) : /* @__PURE__ */ e(C, {
|
|
66
|
+
columns: r,
|
|
67
|
+
isSelectAllEnabled: c ?? !1,
|
|
68
|
+
itemActionMenuProps: b,
|
|
69
|
+
items: m
|
|
90
70
|
})]
|
|
91
71
|
});
|
|
92
72
|
};
|
|
93
73
|
export {
|
|
94
|
-
|
|
74
|
+
D as default
|
|
95
75
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TableBody as a, Row as h, Cell as n, Ghost as m } from "@box/blueprint-web";
|
|
2
|
+
import { Size5 as d } from "@box/blueprint-web-assets/tokens/tokens";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
const s = 20, g = ({
|
|
5
|
+
columnLength: o,
|
|
6
|
+
rowLength: l = s
|
|
7
|
+
}) => /* @__PURE__ */ r(a, {
|
|
8
|
+
items: Array.from({
|
|
9
|
+
length: l
|
|
10
|
+
}, (e, t) => ({
|
|
11
|
+
key: t
|
|
12
|
+
})),
|
|
13
|
+
children: (e) => /* @__PURE__ */ r(h, {
|
|
14
|
+
children: Array.from({
|
|
15
|
+
length: o
|
|
16
|
+
}, (t, i) => /* @__PURE__ */ r(n, {
|
|
17
|
+
children: /* @__PURE__ */ r(m, {
|
|
18
|
+
height: d,
|
|
19
|
+
variant: "rectangle",
|
|
20
|
+
width: "100%"
|
|
21
|
+
})
|
|
22
|
+
}, i))
|
|
23
|
+
}, e.key)
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
g as default
|
|
27
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { TableBody as h, Row as m, Cell as t, Text as p, ActionCell as f } from "@box/blueprint-web";
|
|
2
|
+
import x from "lodash/get";
|
|
3
|
+
import { ItemActionMenu as y } from "../../item-action-menu/item-action-menu.js";
|
|
4
|
+
import { jsx as e, jsxs as T } from "react/jsx-runtime";
|
|
5
|
+
const C = ({
|
|
6
|
+
columns: i,
|
|
7
|
+
isSelectAllEnabled: a,
|
|
8
|
+
items: c,
|
|
9
|
+
itemActionMenuProps: n
|
|
10
|
+
}) => /* @__PURE__ */ e(h, {
|
|
11
|
+
items: c.map((r) => ({
|
|
12
|
+
key: r.id,
|
|
13
|
+
...r
|
|
14
|
+
})),
|
|
15
|
+
children: (r) => /* @__PURE__ */ T(m, {
|
|
16
|
+
id: r.id,
|
|
17
|
+
children: [i.map((l) => {
|
|
18
|
+
const {
|
|
19
|
+
cellRenderer: d,
|
|
20
|
+
id: s,
|
|
21
|
+
textValue: u
|
|
22
|
+
} = l, o = `${u}-${r.id}`;
|
|
23
|
+
return d ? /* @__PURE__ */ e(t, {
|
|
24
|
+
children: d(r, l)
|
|
25
|
+
}, o) : /* @__PURE__ */ e(t, {
|
|
26
|
+
children: /* @__PURE__ */ e(p, {
|
|
27
|
+
as: "span",
|
|
28
|
+
children: x(r, s)
|
|
29
|
+
})
|
|
30
|
+
}, o);
|
|
31
|
+
}), a && /* @__PURE__ */ e(f, {
|
|
32
|
+
children: (l) => n ? /* @__PURE__ */ e(y, {
|
|
33
|
+
...n,
|
|
34
|
+
item: r,
|
|
35
|
+
onOpenChange: l
|
|
36
|
+
}) : null
|
|
37
|
+
})]
|
|
38
|
+
}, r.id)
|
|
39
|
+
});
|
|
40
|
+
export {
|
|
41
|
+
C as default
|
|
42
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import r from "./components/filter-row/filter-row.js";
|
|
2
|
-
import e from "./components/
|
|
3
|
-
import i from "
|
|
4
|
-
import
|
|
2
|
+
import e from "./components/pagination/pagination.js";
|
|
3
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
4
|
+
import m from "./components/metadata-table/metadata-table.js";
|
|
5
5
|
import '../../styles/metadata-view.css';const n = {};
|
|
6
6
|
function d({
|
|
7
7
|
filterRowProps: a,
|
|
8
8
|
metadataTableProps: o
|
|
9
9
|
}) {
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ i("div", {
|
|
11
11
|
className: n.container,
|
|
12
12
|
children: [/* @__PURE__ */ t(r, {
|
|
13
13
|
...a
|
|
14
|
-
}), /* @__PURE__ */ t(
|
|
14
|
+
}), /* @__PURE__ */ t(m, {
|
|
15
15
|
...o
|
|
16
|
-
}), /* @__PURE__ */ t(
|
|
16
|
+
}), /* @__PURE__ */ t(e, {})]
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
export {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './item-action-menu';
|
|
@@ -6,7 +6,8 @@ export interface ItemAction {
|
|
|
6
6
|
icon: FunctionComponent<PropsWithChildren<SVGProps<SVGSVGElement>>>;
|
|
7
7
|
}
|
|
8
8
|
export interface ItemActionMenuProps {
|
|
9
|
-
actions
|
|
9
|
+
actions?: ItemAction[];
|
|
10
|
+
inlineActions?: ItemAction[];
|
|
10
11
|
isDisabled?: boolean;
|
|
11
12
|
item: Item;
|
|
12
13
|
onOpenChange: (open: boolean) => void;
|
|
@@ -16,4 +17,4 @@ export interface ItemActionMenuProps {
|
|
|
16
17
|
icon: FunctionComponent<PropsWithChildren<SVGProps<SVGSVGElement>>>;
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
export declare function ItemActionMenu({ actions, isDisabled, item, onOpenChange, subMenuActions, subMenuTrigger, }: ItemActionMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function ItemActionMenu({ actions, inlineActions, isDisabled, item, onOpenChange, subMenuActions, subMenuTrigger, }: ItemActionMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { TableProps } from '@box/blueprint-web';
|
|
2
2
|
import { Item } from '@box/types';
|
|
3
|
-
import { ItemActionMenuProps } from '../item-action-menu
|
|
3
|
+
import { ItemActionMenuProps } from '../item-action-menu';
|
|
4
4
|
import { Column } from '../../types';
|
|
5
5
|
export interface MetadataTableProps extends TableProps {
|
|
6
6
|
columns: Column[];
|
|
7
|
+
isLoading?: boolean;
|
|
7
8
|
isSelectAllEnabled?: boolean;
|
|
8
9
|
items: Item[];
|
|
9
10
|
itemActionMenuProps?: Omit<ItemActionMenuProps, 'item' | 'onOpenChange'>;
|
|
10
11
|
}
|
|
11
|
-
declare const MetadataTable: ({ columns, isSelectAllEnabled, items, itemActionMenuProps, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare const MetadataTable: ({ columns, isLoading, isSelectAllEnabled, items, itemActionMenuProps, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export default MetadataTable;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TableProps } from '@box/blueprint-web';
|
|
2
|
+
import { MetadataTableProps } from '../metadata-table';
|
|
3
|
+
declare const TableBodyWithData: ({ columns, isSelectAllEnabled, items, itemActionMenuProps, }: Omit<MetadataTableProps, keyof TableProps>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default TableBodyWithData;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MetadataTableProps } from './components/metadata-table
|
|
1
|
+
import { MetadataTableProps } from './components/metadata-table';
|
|
2
2
|
import { FilterRowProps } from './components/filter-row/types';
|
|
3
3
|
export interface MetadataViewProps {
|
|
4
4
|
filterRowProps: FilterRowProps;
|