@box/metadata-view 1.1.0 → 1.2.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/dist/chunks/index.js +37 -35
- package/dist/esm/lib/components/metadata-table/metadata-table.js +65 -62
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +106 -103
- package/dist/esm/lib/components/metadata-table/table-renderer.js +38 -36
- package/dist/types/lib/components/metadata-table/metadata-table.d.ts +6 -4
- package/dist/types/lib/components/metadata-table/table-body/table-body-with-data.d.ts +2 -2
- package/dist/types/lib/components/metadata-table/table-body/table-row/table-row.d.ts +4 -3
- package/dist/types/lib/components/metadata-table/table-renderer.d.ts +8 -6
- package/package.json +5 -5
package/dist/chunks/index.js
CHANGED
|
@@ -1,51 +1,53 @@
|
|
|
1
|
-
import { Row as
|
|
1
|
+
import { Row as E, Cell as n, Text as r, ActionCell as y } from "@box/blueprint-web";
|
|
2
2
|
import I from "lodash/get";
|
|
3
3
|
import { ItemTypeIcon as C } from "@box/item-icon";
|
|
4
|
-
import
|
|
4
|
+
import R from "clsx";
|
|
5
5
|
import { I as o } from "./types.js";
|
|
6
|
-
import { THUMBNAIL_LIST_VIEW_HEIGHTS as
|
|
6
|
+
import { THUMBNAIL_LIST_VIEW_HEIGHTS as g } from "../esm/lib/components/constants.js";
|
|
7
7
|
import { jsxs as b, jsx as e } from "react/jsx-runtime";
|
|
8
|
-
import { ItemActionMenu as
|
|
9
|
-
import '../styles/index.css';const
|
|
10
|
-
tableHeaderActionsWrapper:
|
|
11
|
-
tableHeaderActions:
|
|
12
|
-
tableRow:
|
|
13
|
-
selectAllCheckbox:
|
|
14
|
-
tableNameCell:
|
|
15
|
-
tableNameCellTitle:
|
|
16
|
-
hasSubtitle:
|
|
17
|
-
tableNameCellText:
|
|
18
|
-
tableNameCellIconInline:
|
|
19
|
-
infiniteScrollTableContainerFullHeight:
|
|
20
|
-
iconCell:
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
columns:
|
|
8
|
+
import { ItemActionMenu as w } from "../esm/lib/components/item-action-menu/item-action-menu.js";
|
|
9
|
+
import '../styles/index.css';const k = "_tableHeaderActionsWrapper_1a999_1", U = "_tableHeaderActions_1a999_1", B = "_tableRow_1a999_33", W = "_selectAllCheckbox_1a999_42", j = "_tableNameCell_1a999_47", F = "_tableNameCellTitle_1a999_53", M = "_hasSubtitle_1a999_57", $ = "_tableNameCellText_1a999_62", v = "_tableNameCellIconInline_1a999_67", O = "_infiniteScrollTableContainerFullHeight_1a999_71", D = "_iconCell_1a999_77", t = {
|
|
10
|
+
tableHeaderActionsWrapper: k,
|
|
11
|
+
tableHeaderActions: U,
|
|
12
|
+
tableRow: B,
|
|
13
|
+
selectAllCheckbox: W,
|
|
14
|
+
tableNameCell: j,
|
|
15
|
+
tableNameCellTitle: F,
|
|
16
|
+
hasSubtitle: M,
|
|
17
|
+
tableNameCellText: $,
|
|
18
|
+
tableNameCellIconInline: v,
|
|
19
|
+
infiniteScrollTableContainerFullHeight: O,
|
|
20
|
+
iconCell: D
|
|
21
|
+
}, Z = ({
|
|
22
|
+
areSelectionCheckboxesDisabled: h,
|
|
23
|
+
columns: T,
|
|
24
24
|
iconColumnVariant: a,
|
|
25
|
-
isSelectAllEnabled:
|
|
25
|
+
isSelectAllEnabled: p,
|
|
26
|
+
item: l,
|
|
26
27
|
itemActionMenuProps: _,
|
|
27
|
-
|
|
28
|
-
zoomLevel:
|
|
29
|
-
}) => /* @__PURE__ */ b(
|
|
28
|
+
onTableRowClick: u,
|
|
29
|
+
zoomLevel: x = 0
|
|
30
|
+
}) => /* @__PURE__ */ b(E, {
|
|
30
31
|
className: t.tableRow,
|
|
31
32
|
id: l.id,
|
|
33
|
+
onAction: () => u(l),
|
|
32
34
|
children: [a === o.COLUMN ? /* @__PURE__ */ e(n, {
|
|
33
35
|
style: {
|
|
34
|
-
height:
|
|
36
|
+
height: g[x]
|
|
35
37
|
},
|
|
36
38
|
children: /* @__PURE__ */ e(C, {
|
|
37
39
|
className: t.iconCell,
|
|
38
40
|
item: l
|
|
39
41
|
})
|
|
40
|
-
}, `item-type-icon-${l.id}`) : null,
|
|
42
|
+
}, `item-type-icon-${l.id}`) : null, T.map((c) => {
|
|
41
43
|
const {
|
|
42
44
|
cellRenderer: d,
|
|
43
45
|
id: s,
|
|
44
|
-
isItemMetadata:
|
|
45
|
-
subtitle:
|
|
46
|
-
textValue:
|
|
46
|
+
isItemMetadata: f,
|
|
47
|
+
subtitle: S,
|
|
48
|
+
textValue: A,
|
|
47
49
|
type: H
|
|
48
|
-
} = c, i = `${
|
|
50
|
+
} = c, i = `${A}-${l.id}`, L = f ? s.split(".")[1] : s, m = I(l, L);
|
|
49
51
|
if (s === "name" && (a === o.INLINE || a === o.INLINE_SUBTITLE))
|
|
50
52
|
return /* @__PURE__ */ e(n, {
|
|
51
53
|
children: /* @__PURE__ */ b("div", {
|
|
@@ -53,7 +55,7 @@ import '../styles/index.css';const w = "_tableHeaderActionsWrapper_1a999_1", k =
|
|
|
53
55
|
children: [/* @__PURE__ */ e(C, {
|
|
54
56
|
item: l
|
|
55
57
|
}), /* @__PURE__ */ b("div", {
|
|
56
|
-
className:
|
|
58
|
+
className: R(t.tableNameCellTitle, {
|
|
57
59
|
[t.hasSubtitle]: a === o.INLINE_SUBTITLE
|
|
58
60
|
}),
|
|
59
61
|
children: [/* @__PURE__ */ e(r, {
|
|
@@ -64,7 +66,7 @@ import '../styles/index.css';const w = "_tableHeaderActionsWrapper_1a999_1", k =
|
|
|
64
66
|
as: "span",
|
|
65
67
|
className: t.tableNameCellText,
|
|
66
68
|
color: "textOnLightSecondary",
|
|
67
|
-
children:
|
|
69
|
+
children: S
|
|
68
70
|
}) : null]
|
|
69
71
|
})]
|
|
70
72
|
})
|
|
@@ -85,9 +87,9 @@ import '../styles/index.css';const w = "_tableHeaderActionsWrapper_1a999_1", k =
|
|
|
85
87
|
children: m
|
|
86
88
|
})
|
|
87
89
|
}, i);
|
|
88
|
-
}),
|
|
89
|
-
isCheckboxDisabled:
|
|
90
|
-
children: (c) => _ ? /* @__PURE__ */ e(
|
|
90
|
+
}), p && /* @__PURE__ */ e(y, {
|
|
91
|
+
isCheckboxDisabled: h,
|
|
92
|
+
children: (c) => _ ? /* @__PURE__ */ e(w, {
|
|
91
93
|
..._,
|
|
92
94
|
item: l,
|
|
93
95
|
onOpenChange: c
|
|
@@ -95,6 +97,6 @@ import '../styles/index.css';const w = "_tableHeaderActionsWrapper_1a999_1", k =
|
|
|
95
97
|
})]
|
|
96
98
|
}, l.id);
|
|
97
99
|
export {
|
|
98
|
-
|
|
100
|
+
Z as T,
|
|
99
101
|
t as s
|
|
100
102
|
};
|
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import { Text as
|
|
4
|
-
import
|
|
1
|
+
import { useRef as B } from "react";
|
|
2
|
+
import { useIntl as O } from "react-intl";
|
|
3
|
+
import { Text as P, ListCheckbox as U, TableHeader as j, Column as k } from "@box/blueprint-web";
|
|
4
|
+
import F from "lodash/noop";
|
|
5
|
+
import { useInfiniteScrollTableItems as G } from "./hooks/useInfiniteScrollTableItems.js";
|
|
5
6
|
import { TableRenderer as R } from "./table-renderer.js";
|
|
6
|
-
import { I as
|
|
7
|
-
import { THUMBNAIL_WIDTHS as
|
|
7
|
+
import { I as L } from "../../../../chunks/types.js";
|
|
8
|
+
import { THUMBNAIL_WIDTHS as V } from "../constants.js";
|
|
8
9
|
import { s } from "../../../../chunks/index.js";
|
|
9
|
-
import
|
|
10
|
+
import X from "./messages.js";
|
|
10
11
|
import { jsx as e } from "react/jsx-runtime";
|
|
11
12
|
import "./table-body/inline-editing-cell/inline-editing-cell.js";
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
items: d,
|
|
18
|
-
itemActionMenuProps: w,
|
|
13
|
+
const Y = 40, le = ({
|
|
14
|
+
areSelectionCheckboxesDisabled: i = !1,
|
|
15
|
+
columns: n,
|
|
16
|
+
hasNextPage: w = !1,
|
|
17
|
+
iconColumnVariant: m,
|
|
19
18
|
isInfiniteScrollEnabled: x = !1,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
isLoading: l = !1,
|
|
20
|
+
isSelectAllEnabled: d,
|
|
21
|
+
itemActionMenuProps: g,
|
|
22
|
+
items: c,
|
|
23
|
+
onGetNextPage: y,
|
|
24
|
+
onInlineEditChange: W,
|
|
25
|
+
onTableRowClick: A = F,
|
|
26
|
+
placeholderRowsCount: C,
|
|
27
|
+
zoomLevel: a,
|
|
28
|
+
...N
|
|
27
29
|
}) => {
|
|
28
30
|
var H;
|
|
29
31
|
const {
|
|
30
32
|
formatMessage: f
|
|
31
|
-
} =
|
|
33
|
+
} = O(), p = B(null), {
|
|
32
34
|
virtualItemsToDisplay: h,
|
|
33
|
-
getTableHeight:
|
|
34
|
-
} =
|
|
35
|
-
items:
|
|
36
|
-
hasNextPage:
|
|
35
|
+
getTableHeight: _
|
|
36
|
+
} = G({
|
|
37
|
+
items: c,
|
|
38
|
+
hasNextPage: w,
|
|
37
39
|
isLoading: l,
|
|
38
40
|
parentRef: p,
|
|
39
|
-
onGetNextPage:
|
|
40
|
-
placeholderRowsCount:
|
|
41
|
-
}),
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
const t = parseInt(
|
|
45
|
-
|
|
41
|
+
onGetNextPage: y,
|
|
42
|
+
placeholderRowsCount: C
|
|
43
|
+
}), r = [], v = 0;
|
|
44
|
+
if (m === L.COLUMN) {
|
|
45
|
+
a = a || v;
|
|
46
|
+
const t = parseInt(V[a], 10) + 24;
|
|
47
|
+
r.push({
|
|
46
48
|
id: "item-type-icon",
|
|
47
49
|
isRowHeader: !1,
|
|
48
50
|
hideHeader: !1,
|
|
@@ -50,61 +52,62 @@ const V = 40, ae = ({
|
|
|
50
52
|
maxWidth: t
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
|
-
const
|
|
55
|
+
const D = n.map((t) => {
|
|
54
56
|
const {
|
|
55
57
|
id: b,
|
|
56
|
-
isRowHeader:
|
|
58
|
+
isRowHeader: S,
|
|
57
59
|
headerRenderer: T,
|
|
58
|
-
textValue:
|
|
60
|
+
textValue: o,
|
|
59
61
|
type: I,
|
|
60
|
-
...
|
|
62
|
+
...E
|
|
61
63
|
} = t;
|
|
62
64
|
return {
|
|
63
|
-
...
|
|
64
|
-
children: T ? T(
|
|
65
|
+
...E,
|
|
66
|
+
children: T ? T(o, t) : /* @__PURE__ */ e(P, {
|
|
65
67
|
as: "span",
|
|
66
|
-
children:
|
|
68
|
+
children: o
|
|
67
69
|
}),
|
|
68
|
-
isRowHeader: b === "name" ||
|
|
70
|
+
isRowHeader: b === "name" || S,
|
|
69
71
|
id: b,
|
|
70
|
-
textValue:
|
|
72
|
+
textValue: o,
|
|
71
73
|
allowsSorting: I !== "multiSelect" && I !== "enum"
|
|
72
74
|
};
|
|
73
75
|
});
|
|
74
|
-
|
|
76
|
+
r.push(...D), d && r.push({
|
|
75
77
|
id: "actions",
|
|
76
78
|
className: s.tableHeaderActions,
|
|
77
79
|
children: /* @__PURE__ */ e("div", {
|
|
78
80
|
className: s.tableHeaderActionsWrapper,
|
|
79
|
-
children: /* @__PURE__ */ e(
|
|
80
|
-
"aria-label": f(
|
|
81
|
+
children: /* @__PURE__ */ e(U, {
|
|
82
|
+
"aria-label": f(X.selectAll),
|
|
81
83
|
className: s.selectAllCheckbox,
|
|
82
|
-
isDisabled: l ||
|
|
84
|
+
isDisabled: l || i
|
|
83
85
|
})
|
|
84
86
|
}),
|
|
85
87
|
isRowHeader: !1,
|
|
86
88
|
hideHeader: !1,
|
|
87
89
|
allowsSorting: !1
|
|
88
90
|
});
|
|
89
|
-
const
|
|
90
|
-
columns:
|
|
91
|
-
children: (t) => /* @__PURE__ */ e(
|
|
91
|
+
const M = /* @__PURE__ */ e(j, {
|
|
92
|
+
columns: r,
|
|
93
|
+
children: (t) => /* @__PURE__ */ e(k, {
|
|
92
94
|
...t
|
|
93
95
|
})
|
|
94
96
|
}), u = {
|
|
95
|
-
columnCount:
|
|
96
|
-
columns:
|
|
97
|
+
columnCount: r.length,
|
|
98
|
+
columns: n,
|
|
97
99
|
formatMessage: f,
|
|
98
|
-
iconColumnVariant:
|
|
100
|
+
iconColumnVariant: m,
|
|
99
101
|
isLoading: l,
|
|
100
|
-
isSelectAllEnabled:
|
|
101
|
-
areSelectionCheckboxesDisabled:
|
|
102
|
-
itemActionMenuProps:
|
|
103
|
-
items:
|
|
104
|
-
onInlineEditChange:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
isSelectAllEnabled: d,
|
|
103
|
+
areSelectionCheckboxesDisabled: i,
|
|
104
|
+
itemActionMenuProps: g,
|
|
105
|
+
items: c,
|
|
106
|
+
onInlineEditChange: W,
|
|
107
|
+
onTableRowClick: A,
|
|
108
|
+
tableHeader: M,
|
|
109
|
+
tableProps: N,
|
|
110
|
+
zoomLevel: a
|
|
108
111
|
};
|
|
109
112
|
return x ? /* @__PURE__ */ e("div", {
|
|
110
113
|
ref: p,
|
|
@@ -113,7 +116,7 @@ const V = 40, ae = ({
|
|
|
113
116
|
style: {
|
|
114
117
|
position: "relative",
|
|
115
118
|
width: "100%",
|
|
116
|
-
height:
|
|
119
|
+
height: _() + Y
|
|
117
120
|
},
|
|
118
121
|
children: /* @__PURE__ */ e(R, {
|
|
119
122
|
...u,
|
|
@@ -133,5 +136,5 @@ const V = 40, ae = ({
|
|
|
133
136
|
});
|
|
134
137
|
};
|
|
135
138
|
export {
|
|
136
|
-
|
|
139
|
+
le as MetadataTable
|
|
137
140
|
};
|
|
@@ -1,193 +1,196 @@
|
|
|
1
|
-
import { TableBody as
|
|
2
|
-
import { ItemTypeIcon as
|
|
1
|
+
import { TableBody as $, Row as g, Cell as h, ActionCell as S, Text as u } from "@box/blueprint-web";
|
|
2
|
+
import { ItemTypeIcon as b } from "@box/item-icon";
|
|
3
3
|
import R from "clsx";
|
|
4
|
-
import
|
|
4
|
+
import x from "lodash/get";
|
|
5
5
|
import I from "react";
|
|
6
6
|
import { I as N } from "../../../../../chunks/types.js";
|
|
7
|
-
import { THUMBNAIL_LIST_VIEW_HEIGHTS as
|
|
8
|
-
import { s as i, T as
|
|
7
|
+
import { THUMBNAIL_LIST_VIEW_HEIGHTS as w } from "../../constants.js";
|
|
8
|
+
import { s as i, T as B } from "../../../../../chunks/index.js";
|
|
9
9
|
import { jsx as l, jsxs as T } from "react/jsx-runtime";
|
|
10
|
-
import { InlineEditingCell as
|
|
11
|
-
import { ItemActionMenu as
|
|
12
|
-
import { GhostTableRow as
|
|
13
|
-
const
|
|
14
|
-
const n = r ?
|
|
15
|
-
return
|
|
16
|
-
},
|
|
17
|
-
item: t,
|
|
10
|
+
import { InlineEditingCell as _ } from "./inline-editing-cell/inline-editing-cell.js";
|
|
11
|
+
import { ItemActionMenu as M } from "../../item-action-menu/item-action-menu.js";
|
|
12
|
+
import { GhostTableRow as U } from "./ghost-table-row/ghost-table-row.js";
|
|
13
|
+
const E = (e, t, r) => {
|
|
14
|
+
const n = r ? t.split(".")[1] : t;
|
|
15
|
+
return x(e, n);
|
|
16
|
+
}, W = /* @__PURE__ */ I.memo(({
|
|
18
17
|
column: e,
|
|
19
|
-
iconColumnVariant:
|
|
18
|
+
iconColumnVariant: t,
|
|
19
|
+
item: r
|
|
20
20
|
}) => {
|
|
21
21
|
const {
|
|
22
22
|
id: n,
|
|
23
|
-
isItemMetadata:
|
|
24
|
-
subtitle:
|
|
23
|
+
isItemMetadata: a,
|
|
24
|
+
subtitle: s,
|
|
25
25
|
textValue: m
|
|
26
|
-
} = e, d = `${m}-${
|
|
26
|
+
} = e, d = `${m}-${r.id}`;
|
|
27
27
|
return /* @__PURE__ */ l(h, {
|
|
28
28
|
children: /* @__PURE__ */ T("div", {
|
|
29
29
|
className: i.tableNameCell,
|
|
30
|
-
children: [/* @__PURE__ */ l(
|
|
30
|
+
children: [/* @__PURE__ */ l(b, {
|
|
31
31
|
className: i.tableNameCellIconInline,
|
|
32
|
-
item:
|
|
32
|
+
item: r
|
|
33
33
|
}), /* @__PURE__ */ T("div", {
|
|
34
34
|
className: R(i.tableNameCellTitle, {
|
|
35
|
-
[i.hasSubtitle]:
|
|
35
|
+
[i.hasSubtitle]: t === N.INLINE_SUBTITLE
|
|
36
36
|
}),
|
|
37
37
|
children: [/* @__PURE__ */ l(u, {
|
|
38
38
|
as: "span",
|
|
39
39
|
className: i.tableNameCellText,
|
|
40
|
-
children:
|
|
41
|
-
}),
|
|
40
|
+
children: E(r, n, a)
|
|
41
|
+
}), t === N.INLINE_SUBTITLE && /* @__PURE__ */ l(u, {
|
|
42
42
|
as: "span",
|
|
43
43
|
className: i.tableNameCellText,
|
|
44
44
|
color: "textOnLightSecondary",
|
|
45
|
-
children:
|
|
45
|
+
children: s
|
|
46
46
|
})]
|
|
47
47
|
})]
|
|
48
48
|
})
|
|
49
49
|
}, d);
|
|
50
|
-
}),
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
}), k = /* @__PURE__ */ I.memo(({
|
|
51
|
+
column: e,
|
|
52
|
+
item: t
|
|
53
53
|
}) => {
|
|
54
54
|
var n;
|
|
55
55
|
const r = `${e.textValue}-${t.id}`;
|
|
56
56
|
return /* @__PURE__ */ l(h, {
|
|
57
57
|
children: (n = e.cellRenderer) == null ? void 0 : n.call(e, t, e)
|
|
58
58
|
}, r);
|
|
59
|
-
}),
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
}), j = /* @__PURE__ */ I.memo(({
|
|
60
|
+
column: e,
|
|
61
|
+
item: t
|
|
62
62
|
}) => {
|
|
63
|
-
const r = `${e.textValue}-${t.id}`, n =
|
|
63
|
+
const r = `${e.textValue}-${t.id}`, n = x(t, e.id);
|
|
64
64
|
return n ? /* @__PURE__ */ l(h, {
|
|
65
65
|
children: n.join(" ")
|
|
66
66
|
}, r) : /* @__PURE__ */ l(h, {}, r);
|
|
67
|
-
}),
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
}), D = /* @__PURE__ */ I.memo(({
|
|
68
|
+
column: e,
|
|
69
|
+
item: t
|
|
70
70
|
}) => {
|
|
71
71
|
const {
|
|
72
72
|
id: r,
|
|
73
73
|
isItemMetadata: n,
|
|
74
|
-
textValue:
|
|
75
|
-
} = e,
|
|
74
|
+
textValue: a
|
|
75
|
+
} = e, s = `${a}-${t.id}`;
|
|
76
76
|
return /* @__PURE__ */ l(h, {
|
|
77
77
|
children: /* @__PURE__ */ l(u, {
|
|
78
78
|
as: "span",
|
|
79
|
-
children:
|
|
79
|
+
children: E(t, r, n)
|
|
80
80
|
})
|
|
81
|
-
},
|
|
82
|
-
}),
|
|
83
|
-
item: t,
|
|
81
|
+
}, s);
|
|
82
|
+
}), G = /* @__PURE__ */ I.memo(({
|
|
84
83
|
column: e,
|
|
85
|
-
iconColumnVariant:
|
|
84
|
+
iconColumnVariant: t,
|
|
85
|
+
item: r,
|
|
86
86
|
onInlineEditChange: n
|
|
87
87
|
}) => {
|
|
88
88
|
const {
|
|
89
|
-
cellRenderer:
|
|
90
|
-
id:
|
|
89
|
+
cellRenderer: a,
|
|
90
|
+
id: s,
|
|
91
91
|
isInlineEditingEnabled: m,
|
|
92
92
|
type: d
|
|
93
93
|
} = e;
|
|
94
|
-
return
|
|
94
|
+
return s === "item.name" && (t === N.INLINE || t === N.INLINE_SUBTITLE) ? /* @__PURE__ */ l(W, {
|
|
95
95
|
column: e,
|
|
96
|
-
iconColumnVariant:
|
|
97
|
-
item:
|
|
98
|
-
}) :
|
|
96
|
+
iconColumnVariant: t,
|
|
97
|
+
item: r
|
|
98
|
+
}) : a ? /* @__PURE__ */ l(k, {
|
|
99
99
|
column: e,
|
|
100
|
-
item:
|
|
101
|
-
}) : m && (d === "multiSelect" || d === "enum") ? /* @__PURE__ */ l(
|
|
100
|
+
item: r
|
|
101
|
+
}) : m && (d === "multiSelect" || d === "enum") ? /* @__PURE__ */ l(_, {
|
|
102
102
|
column: e,
|
|
103
|
-
item:
|
|
103
|
+
item: r,
|
|
104
104
|
onInlineEditChange: n
|
|
105
|
-
}, `${e.id}-${
|
|
105
|
+
}, `${e.id}-${r.id}`) : d === "multiSelect" ? /* @__PURE__ */ l(j, {
|
|
106
106
|
column: e,
|
|
107
|
-
item:
|
|
108
|
-
}) : /* @__PURE__ */ l(
|
|
107
|
+
item: r
|
|
108
|
+
}) : /* @__PURE__ */ l(D, {
|
|
109
109
|
column: e,
|
|
110
|
-
item:
|
|
110
|
+
item: r
|
|
111
111
|
});
|
|
112
|
-
}),
|
|
113
|
-
item:
|
|
114
|
-
zoomLevel:
|
|
112
|
+
}), H = /* @__PURE__ */ I.memo(({
|
|
113
|
+
item: e,
|
|
114
|
+
zoomLevel: t
|
|
115
115
|
}) => /* @__PURE__ */ l(h, {
|
|
116
116
|
style: {
|
|
117
|
-
height:
|
|
117
|
+
height: w[t]
|
|
118
118
|
},
|
|
119
|
-
children: /* @__PURE__ */ l(
|
|
119
|
+
children: /* @__PURE__ */ l(b, {
|
|
120
120
|
className: i.iconCell,
|
|
121
|
-
item:
|
|
121
|
+
item: e
|
|
122
122
|
})
|
|
123
|
-
}, `item-type-icon-${
|
|
124
|
-
item:
|
|
125
|
-
itemActionMenuProps:
|
|
123
|
+
}, `item-type-icon-${e.id}`)), A = /* @__PURE__ */ I.memo(({
|
|
124
|
+
item: e,
|
|
125
|
+
itemActionMenuProps: t,
|
|
126
126
|
isCheckboxDisabled: r
|
|
127
|
-
}) => /* @__PURE__ */ l(
|
|
127
|
+
}) => /* @__PURE__ */ l(S, {
|
|
128
128
|
isCheckboxDisabled: r,
|
|
129
|
-
children: (n) =>
|
|
130
|
-
...
|
|
131
|
-
item:
|
|
129
|
+
children: (n) => t ? /* @__PURE__ */ l(M, {
|
|
130
|
+
...t,
|
|
131
|
+
item: e,
|
|
132
132
|
onOpenChange: n
|
|
133
133
|
}) : null
|
|
134
|
-
})),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
134
|
+
})), P = ({
|
|
135
|
+
areSelectionCheckboxesDisabled: e,
|
|
136
|
+
columnCount: t,
|
|
137
|
+
columns: r,
|
|
138
|
+
iconColumnVariant: n,
|
|
139
|
+
isSelectAllEnabled: a,
|
|
140
|
+
items: s,
|
|
141
|
+
itemActionMenuProps: m,
|
|
142
|
+
onInlineEditChange: d,
|
|
143
|
+
onTableRowClick: p,
|
|
144
|
+
virtualItems: C,
|
|
145
|
+
zoomLevel: y
|
|
145
146
|
}) => {
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
const o = (c) => /* @__PURE__ */ l(
|
|
149
|
-
columnLength:
|
|
147
|
+
const L = n === N.COLUMN;
|
|
148
|
+
if (C) {
|
|
149
|
+
const o = (c) => /* @__PURE__ */ l(U, {
|
|
150
|
+
columnLength: t || 0,
|
|
150
151
|
rowKey: `ghost-${c}`
|
|
151
|
-
}), f = (c) => /* @__PURE__ */ l(
|
|
152
|
-
areSelectionCheckboxesDisabled:
|
|
153
|
-
columns:
|
|
154
|
-
iconColumnVariant:
|
|
155
|
-
isSelectAllEnabled:
|
|
152
|
+
}), f = (c) => /* @__PURE__ */ l(B, {
|
|
153
|
+
areSelectionCheckboxesDisabled: e,
|
|
154
|
+
columns: r,
|
|
155
|
+
iconColumnVariant: n,
|
|
156
|
+
isSelectAllEnabled: a,
|
|
156
157
|
item: c,
|
|
157
|
-
itemActionMenuProps:
|
|
158
|
-
|
|
158
|
+
itemActionMenuProps: m,
|
|
159
|
+
onTableRowClick: p,
|
|
160
|
+
zoomLevel: y
|
|
159
161
|
});
|
|
160
|
-
return /* @__PURE__ */ l(
|
|
161
|
-
items:
|
|
162
|
+
return /* @__PURE__ */ l($, {
|
|
163
|
+
items: C,
|
|
162
164
|
children: ({
|
|
163
165
|
index: c
|
|
164
|
-
}) => c >=
|
|
166
|
+
}) => c >= s.length ? o(c) : f(s[c])
|
|
165
167
|
});
|
|
166
168
|
}
|
|
167
|
-
return /* @__PURE__ */ l(
|
|
168
|
-
items:
|
|
169
|
+
return /* @__PURE__ */ l($, {
|
|
170
|
+
items: s.map((o) => ({
|
|
169
171
|
key: o.id,
|
|
170
172
|
...o
|
|
171
173
|
})),
|
|
172
|
-
children: (o) => /* @__PURE__ */ T(
|
|
174
|
+
children: (o) => /* @__PURE__ */ T(g, {
|
|
173
175
|
className: i.tableRow,
|
|
174
176
|
id: o.id,
|
|
175
|
-
|
|
177
|
+
onAction: () => p(o),
|
|
178
|
+
children: [L && /* @__PURE__ */ l(H, {
|
|
176
179
|
item: o,
|
|
177
|
-
zoomLevel:
|
|
178
|
-
}),
|
|
180
|
+
zoomLevel: y
|
|
181
|
+
}), r.map((f) => /* @__PURE__ */ l(G, {
|
|
179
182
|
column: f,
|
|
180
|
-
iconColumnVariant:
|
|
183
|
+
iconColumnVariant: n,
|
|
181
184
|
item: o,
|
|
182
|
-
onInlineEditChange:
|
|
183
|
-
}, `${f.textValue}-${o.id}`)),
|
|
184
|
-
isCheckboxDisabled:
|
|
185
|
+
onInlineEditChange: d
|
|
186
|
+
}, `${f.textValue}-${o.id}`)), a && /* @__PURE__ */ l(A, {
|
|
187
|
+
isCheckboxDisabled: e,
|
|
185
188
|
item: o,
|
|
186
|
-
itemActionMenuProps:
|
|
189
|
+
itemActionMenuProps: m
|
|
187
190
|
})]
|
|
188
191
|
}, o.id)
|
|
189
192
|
});
|
|
190
193
|
};
|
|
191
194
|
export {
|
|
192
|
-
|
|
195
|
+
P as default
|
|
193
196
|
};
|
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
import { Table as
|
|
2
|
-
import { I as
|
|
3
|
-
import { GhostTableBody as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { jsxs as
|
|
7
|
-
const
|
|
8
|
-
|
|
1
|
+
import { Table as B } from "@box/blueprint-web";
|
|
2
|
+
import { I as d } from "../../../../chunks/types.js";
|
|
3
|
+
import { GhostTableBody as j } from "./table-body/ghost-table-body.js";
|
|
4
|
+
import y from "./table-body/table-body-with-data.js";
|
|
5
|
+
import G from "./messages.js";
|
|
6
|
+
import { jsxs as V, jsx as i } from "react/jsx-runtime";
|
|
7
|
+
const U = ({
|
|
8
|
+
columnCount: s,
|
|
9
9
|
columns: t,
|
|
10
|
+
formatMessage: c,
|
|
10
11
|
iconColumnVariant: e,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
isLoading: r,
|
|
13
|
+
isSelectAllEnabled: m,
|
|
14
|
+
areSelectionCheckboxesDisabled: f,
|
|
15
|
+
itemActionMenuProps: h,
|
|
16
|
+
items: C,
|
|
17
|
+
onInlineEditChange: g,
|
|
18
|
+
onTableRowClick: p,
|
|
19
|
+
style: u,
|
|
20
|
+
tableHeader: a,
|
|
21
|
+
tableProps: b,
|
|
18
22
|
virtualItems: o,
|
|
19
|
-
|
|
20
|
-
columnCount: u,
|
|
21
|
-
zoomLevel: a,
|
|
22
|
-
onInlineEditChange: b
|
|
23
|
+
zoomLevel: T
|
|
23
24
|
}) => {
|
|
24
|
-
const l =
|
|
25
|
+
const l = s || (() => {
|
|
25
26
|
let n = t.length;
|
|
26
|
-
return e ===
|
|
27
|
-
})(),
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
"aria-label":
|
|
27
|
+
return e === d.COLUMN && (n += 1), m && (n += 1), n;
|
|
28
|
+
})(), x = r && !(o != null && o.length);
|
|
29
|
+
return /* @__PURE__ */ V(B, {
|
|
30
|
+
"aria-label": c(G.listView),
|
|
30
31
|
selectionBehavior: "toggle",
|
|
31
|
-
style:
|
|
32
|
-
...
|
|
33
|
-
children: [
|
|
32
|
+
style: u,
|
|
33
|
+
...b,
|
|
34
|
+
children: [a, x ? /* @__PURE__ */ i(j, {
|
|
34
35
|
columnLength: l
|
|
35
|
-
}) : /* @__PURE__ */ i(
|
|
36
|
-
areSelectionCheckboxesDisabled:
|
|
36
|
+
}) : /* @__PURE__ */ i(y, {
|
|
37
|
+
areSelectionCheckboxesDisabled: f,
|
|
37
38
|
columnCount: l,
|
|
38
39
|
columns: t,
|
|
39
40
|
iconColumnVariant: e,
|
|
40
|
-
isLoading:
|
|
41
|
-
isSelectAllEnabled:
|
|
42
|
-
itemActionMenuProps:
|
|
43
|
-
items:
|
|
44
|
-
onInlineEditChange:
|
|
41
|
+
isLoading: r,
|
|
42
|
+
isSelectAllEnabled: m,
|
|
43
|
+
itemActionMenuProps: h,
|
|
44
|
+
items: C,
|
|
45
|
+
onInlineEditChange: g,
|
|
46
|
+
onTableRowClick: p,
|
|
45
47
|
virtualItems: o,
|
|
46
|
-
zoomLevel:
|
|
48
|
+
zoomLevel: T
|
|
47
49
|
})]
|
|
48
50
|
});
|
|
49
51
|
};
|
|
50
52
|
export {
|
|
51
|
-
|
|
53
|
+
U as TableRenderer
|
|
52
54
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { TableProps } from '@box/blueprint-web';
|
|
2
|
+
import { Item } from '@box/types';
|
|
2
3
|
import { IconColumnVariant, Column, MetadataProps } from '../../types';
|
|
3
4
|
import { InlineEditingCellProps } from './table-body/inline-editing-cell';
|
|
4
5
|
export interface MetadataTableProps extends TableProps, MetadataProps, Pick<InlineEditingCellProps, 'onInlineEditChange'> {
|
|
6
|
+
areSelectionCheckboxesDisabled?: boolean;
|
|
5
7
|
columns: Column[];
|
|
8
|
+
hasNextPage?: boolean;
|
|
6
9
|
iconColumnVariant?: IconColumnVariant;
|
|
7
|
-
isSelectAllEnabled?: boolean;
|
|
8
|
-
areSelectionCheckboxesDisabled?: boolean;
|
|
9
10
|
isInfiniteScrollEnabled?: boolean;
|
|
10
|
-
|
|
11
|
+
isSelectAllEnabled?: boolean;
|
|
11
12
|
onGetNextPage?: () => void;
|
|
13
|
+
onTableRowClick?: (item: Item) => void;
|
|
12
14
|
placeholderRowsCount?: number;
|
|
13
15
|
zoomLevel?: number;
|
|
14
16
|
}
|
|
15
|
-
export declare const MetadataTable: ({ columns,
|
|
17
|
+
export declare const MetadataTable: ({ areSelectionCheckboxesDisabled, columns, hasNextPage, iconColumnVariant, isInfiniteScrollEnabled, isLoading, isSelectAllEnabled, itemActionMenuProps, items, onGetNextPage, onInlineEditChange, onTableRowClick, placeholderRowsCount, zoomLevel, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,8 +5,8 @@ import { IconColumnVariant, Column } from '../../../types';
|
|
|
5
5
|
import { MetadataTableProps } from '../metadata-table';
|
|
6
6
|
import { InlineEditingCellProps } from './inline-editing-cell';
|
|
7
7
|
interface TableBodyWithDataProps extends Omit<MetadataTableProps, keyof TableProps>, Pick<InlineEditingCellProps, 'onInlineEditChange'> {
|
|
8
|
-
virtualItems?: VirtualItem[];
|
|
9
8
|
columnCount?: number;
|
|
9
|
+
virtualItems?: VirtualItem[];
|
|
10
10
|
}
|
|
11
11
|
type CellProps = {
|
|
12
12
|
item: Item;
|
|
@@ -14,5 +14,5 @@ type CellProps = {
|
|
|
14
14
|
iconColumnVariant: IconColumnVariant;
|
|
15
15
|
};
|
|
16
16
|
export type DataCellProps = CellProps & Pick<InlineEditingCellProps, 'onInlineEditChange'>;
|
|
17
|
-
declare const TableBodyWithData: ({ columns, iconColumnVariant, isSelectAllEnabled, items, itemActionMenuProps,
|
|
17
|
+
declare const TableBodyWithData: ({ areSelectionCheckboxesDisabled, columnCount, columns, iconColumnVariant, isSelectAllEnabled, items, itemActionMenuProps, onInlineEditChange, onTableRowClick, virtualItems, zoomLevel, }: TableBodyWithDataProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export default TableBodyWithData;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Item } from '@box/types';
|
|
2
2
|
import { MetadataTableProps } from '../../metadata-table';
|
|
3
3
|
export interface TableRowProps {
|
|
4
|
-
|
|
4
|
+
areSelectionCheckboxesDisabled?: MetadataTableProps['areSelectionCheckboxesDisabled'];
|
|
5
5
|
columns: MetadataTableProps['columns'];
|
|
6
6
|
iconColumnVariant: MetadataTableProps['iconColumnVariant'];
|
|
7
7
|
isSelectAllEnabled: MetadataTableProps['isSelectAllEnabled'];
|
|
8
|
+
item: Item;
|
|
8
9
|
itemActionMenuProps: MetadataTableProps['itemActionMenuProps'];
|
|
9
|
-
areSelectionCheckboxesDisabled?: MetadataTableProps['areSelectionCheckboxesDisabled'];
|
|
10
10
|
zoomLevel?: number;
|
|
11
|
+
onTableRowClick: MetadataTableProps['onTableRowClick'];
|
|
11
12
|
}
|
|
12
|
-
export declare const TableRow: ({
|
|
13
|
+
export declare const TableRow: ({ areSelectionCheckboxesDisabled, columns, iconColumnVariant, isSelectAllEnabled, item, itemActionMenuProps, onTableRowClick, zoomLevel, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { VirtualItem } from '@tanstack/react-virtual';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { TableProps } from '@box/blueprint-web';
|
|
4
|
+
import { Item } from '@box/types';
|
|
4
5
|
import { IconColumnVariant, Column, MetadataProps } from '../../types';
|
|
5
6
|
import { InlineEditingCellProps } from './table-body/inline-editing-cell';
|
|
6
7
|
export interface TableRendererProps extends Pick<InlineEditingCellProps, 'onInlineEditChange'> {
|
|
7
|
-
tableHeader: React.ReactNode;
|
|
8
8
|
columns: Column[];
|
|
9
|
+
columnCount?: number;
|
|
10
|
+
formatMessage: ReturnType<typeof useIntl>['formatMessage'];
|
|
9
11
|
iconColumnVariant?: IconColumnVariant;
|
|
12
|
+
isLoading?: boolean;
|
|
10
13
|
isSelectAllEnabled?: boolean;
|
|
11
14
|
areSelectionCheckboxesDisabled?: boolean;
|
|
12
15
|
itemActionMenuProps?: MetadataProps['itemActionMenuProps'];
|
|
13
16
|
items: MetadataProps['items'];
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
onTableRowClick: (item: Item) => void;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
tableHeader: React.ReactNode;
|
|
16
20
|
tableProps: TableProps;
|
|
17
21
|
virtualItems?: VirtualItem[];
|
|
18
|
-
style?: React.CSSProperties;
|
|
19
|
-
columnCount?: number;
|
|
20
22
|
zoomLevel?: number;
|
|
21
23
|
}
|
|
22
|
-
export declare const TableRenderer: ({
|
|
24
|
+
export declare const TableRenderer: ({ columnCount: passedColumnCount, columns, formatMessage, iconColumnVariant, isLoading, isSelectAllEnabled, areSelectionCheckboxesDisabled, itemActionMenuProps, items, onInlineEditChange, onTableRowClick, style, tableHeader, tableProps, virtualItems, zoomLevel, }: TableRendererProps) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-view",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^12.76.2",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"react-intl": "^6.4.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@box/blueprint-web": "^12.
|
|
21
|
+
"@box/blueprint-web": "^12.82.0",
|
|
22
22
|
"@box/blueprint-web-assets": "^4.71.0",
|
|
23
|
-
"@box/box-item-type-selector": "^0.77.
|
|
23
|
+
"@box/box-item-type-selector": "^0.77.1",
|
|
24
24
|
"@box/eslint-plugin-blueprint": "1.0.5",
|
|
25
|
-
"@box/item-icon": "^1.1.
|
|
26
|
-
"@box/metadata-filter": "^1.37.
|
|
25
|
+
"@box/item-icon": "^1.1.1",
|
|
26
|
+
"@box/metadata-filter": "^1.37.1",
|
|
27
27
|
"@box/storybook-utils": "0.14.7",
|
|
28
28
|
"@box/types": "0.2.1",
|
|
29
29
|
"@tanstack/react-virtual": "^3.10.8",
|