@box/metadata-view 1.9.1 → 1.10.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/chunks/index.js +4 -4
- package/dist/esm/lib/components/metadata-table/actionColumn.js +6 -0
- package/dist/esm/lib/components/metadata-table/metadata-table.js +64 -64
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +88 -89
- package/dist/esm/lib/components/metadata-table/table-renderer.js +37 -37
- package/dist/esm/lib/metadata-view.js +55 -54
- package/dist/types/lib/components/metadata-table/actionColumn.d.ts +5 -0
- package/dist/types/lib/components/metadata-table/table-body/table-body-with-data.d.ts +2 -1
- package/dist/types/lib/components/metadata-table/table-body/table-row/table-row.d.ts +3 -3
- package/dist/types/lib/components/metadata-table/table-renderer.d.ts +1 -2
- package/dist/types/lib/metadata-view.d.ts +2 -1
- package/package.json +5 -5
package/dist/chunks/index.js
CHANGED
|
@@ -22,15 +22,15 @@ import '../styles/index.css';const k = "_tableHeaderActionsWrapper_1a999_1", U =
|
|
|
22
22
|
areSelectionCheckboxesDisabled: h,
|
|
23
23
|
columns: T,
|
|
24
24
|
iconColumnVariant: a,
|
|
25
|
-
isSelectAllEnabled: p,
|
|
26
25
|
item: l,
|
|
27
26
|
itemActionMenuProps: _,
|
|
28
|
-
onTableRowClick:
|
|
27
|
+
onTableRowClick: p,
|
|
28
|
+
shouldRenderActionColumn: u,
|
|
29
29
|
zoomLevel: x = 0
|
|
30
30
|
}) => /* @__PURE__ */ b(E, {
|
|
31
31
|
className: t.tableRow,
|
|
32
32
|
id: l.id,
|
|
33
|
-
onAction: () =>
|
|
33
|
+
onAction: () => p(l),
|
|
34
34
|
children: [a === o.COLUMN ? /* @__PURE__ */ e(n, {
|
|
35
35
|
style: {
|
|
36
36
|
height: g[x]
|
|
@@ -88,7 +88,7 @@ import '../styles/index.css';const k = "_tableHeaderActionsWrapper_1a999_1", U =
|
|
|
88
88
|
children: m
|
|
89
89
|
})
|
|
90
90
|
}, i);
|
|
91
|
-
}),
|
|
91
|
+
}), u && /* @__PURE__ */ e(y, {
|
|
92
92
|
isCheckboxDisabled: h,
|
|
93
93
|
children: (c) => _ ? /* @__PURE__ */ e(w, {
|
|
94
94
|
..._,
|
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import { useRef as B } from "react";
|
|
2
2
|
import { useIntl as O } from "react-intl";
|
|
3
|
-
import { Text as
|
|
4
|
-
import
|
|
5
|
-
import { useInfiniteScrollTableItems as
|
|
6
|
-
import { TableRenderer as
|
|
7
|
-
import { I as
|
|
3
|
+
import { Text as U, ListCheckbox as j, TableHeader as k, Column as F } from "@box/blueprint-web";
|
|
4
|
+
import G from "lodash/noop";
|
|
5
|
+
import { useInfiniteScrollTableItems as L } from "./hooks/useInfiniteScrollTableItems.js";
|
|
6
|
+
import { TableRenderer as I } from "./table-renderer.js";
|
|
7
|
+
import { I as P } from "../../../../chunks/types.js";
|
|
8
8
|
import { THUMBNAIL_WIDTHS as V } from "../constants.js";
|
|
9
|
-
import { s } from "../../../../chunks/index.js";
|
|
9
|
+
import { s as l } from "../../../../chunks/index.js";
|
|
10
10
|
import X from "./messages.js";
|
|
11
|
+
import { getShouldRenderActionColumn as Y } from "./actionColumn.js";
|
|
11
12
|
import { jsx as e } from "react/jsx-runtime";
|
|
12
13
|
import "./table-body/inline-editing-cell/inline-editing-cell.js";
|
|
13
|
-
const
|
|
14
|
+
const Z = 40, ie = ({
|
|
14
15
|
areSelectionCheckboxesDisabled: i = !1,
|
|
15
16
|
columns: n,
|
|
16
|
-
hasNextPage:
|
|
17
|
+
hasNextPage: g = !1,
|
|
17
18
|
iconColumnVariant: m,
|
|
18
|
-
isInfiniteScrollEnabled:
|
|
19
|
-
isLoading:
|
|
20
|
-
isSelectAllEnabled:
|
|
21
|
-
itemActionMenuProps:
|
|
22
|
-
items:
|
|
19
|
+
isInfiniteScrollEnabled: w = !1,
|
|
20
|
+
isLoading: s = !1,
|
|
21
|
+
isSelectAllEnabled: x,
|
|
22
|
+
itemActionMenuProps: A,
|
|
23
|
+
items: d,
|
|
23
24
|
onGetNextPage: y,
|
|
24
|
-
onInlineEditChange:
|
|
25
|
-
onTableRowClick:
|
|
26
|
-
placeholderRowsCount:
|
|
25
|
+
onInlineEditChange: C,
|
|
26
|
+
onTableRowClick: W = G,
|
|
27
|
+
placeholderRowsCount: N,
|
|
27
28
|
zoomLevel: a,
|
|
28
|
-
...
|
|
29
|
+
...c
|
|
29
30
|
}) => {
|
|
30
31
|
var H;
|
|
31
32
|
const {
|
|
32
33
|
formatMessage: f
|
|
33
34
|
} = O(), p = B(null), {
|
|
34
|
-
virtualItemsToDisplay:
|
|
35
|
-
getTableHeight:
|
|
36
|
-
} =
|
|
37
|
-
items:
|
|
38
|
-
hasNextPage:
|
|
39
|
-
isLoading:
|
|
35
|
+
virtualItemsToDisplay: u,
|
|
36
|
+
getTableHeight: S
|
|
37
|
+
} = L({
|
|
38
|
+
items: d,
|
|
39
|
+
hasNextPage: g,
|
|
40
|
+
isLoading: s,
|
|
40
41
|
parentRef: p,
|
|
41
42
|
onGetNextPage: y,
|
|
42
|
-
placeholderRowsCount:
|
|
43
|
-
}), r = [],
|
|
44
|
-
if (m ===
|
|
45
|
-
a = a ||
|
|
43
|
+
placeholderRowsCount: N
|
|
44
|
+
}), r = [], _ = 0;
|
|
45
|
+
if (m === P.COLUMN) {
|
|
46
|
+
a = a || _;
|
|
46
47
|
const t = parseInt(V[a], 10) + 24;
|
|
47
48
|
r.push({
|
|
48
49
|
id: "item-type-icon",
|
|
@@ -52,89 +53,88 @@ const Y = 40, le = ({
|
|
|
52
53
|
maxWidth: t
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
|
-
const
|
|
56
|
+
const v = n.map((t) => {
|
|
56
57
|
const {
|
|
57
58
|
id: b,
|
|
58
|
-
isRowHeader:
|
|
59
|
-
headerRenderer:
|
|
59
|
+
isRowHeader: E,
|
|
60
|
+
headerRenderer: R,
|
|
60
61
|
textValue: o,
|
|
61
|
-
type:
|
|
62
|
-
...
|
|
62
|
+
type: T,
|
|
63
|
+
...M
|
|
63
64
|
} = t;
|
|
64
65
|
return {
|
|
65
|
-
...
|
|
66
|
-
children:
|
|
66
|
+
...M,
|
|
67
|
+
children: R ? R(o, t) : /* @__PURE__ */ e(U, {
|
|
67
68
|
as: "span",
|
|
68
69
|
children: o
|
|
69
70
|
}),
|
|
70
|
-
isRowHeader: b === "name" ||
|
|
71
|
+
isRowHeader: b === "name" || E,
|
|
71
72
|
id: b,
|
|
72
73
|
textValue: o,
|
|
73
|
-
allowsSorting:
|
|
74
|
+
allowsSorting: T !== "multiSelect" && T !== "enum"
|
|
74
75
|
};
|
|
75
76
|
});
|
|
76
|
-
r.push(...
|
|
77
|
+
r.push(...v), Y(c) && r.push({
|
|
77
78
|
id: "actions",
|
|
78
|
-
className:
|
|
79
|
+
className: l.tableHeaderActions,
|
|
79
80
|
children: /* @__PURE__ */ e("div", {
|
|
80
|
-
className:
|
|
81
|
-
children: /* @__PURE__ */ e(
|
|
81
|
+
className: l.tableHeaderActionsWrapper,
|
|
82
|
+
children: x ? /* @__PURE__ */ e(j, {
|
|
82
83
|
"aria-label": f(X.selectAll),
|
|
83
|
-
className:
|
|
84
|
-
isDisabled:
|
|
85
|
-
})
|
|
84
|
+
className: l.selectAllCheckbox,
|
|
85
|
+
isDisabled: s || i
|
|
86
|
+
}) : null
|
|
86
87
|
}),
|
|
87
88
|
isRowHeader: !1,
|
|
88
89
|
hideHeader: !1,
|
|
89
90
|
allowsSorting: !1
|
|
90
91
|
});
|
|
91
|
-
const
|
|
92
|
+
const D = /* @__PURE__ */ e(k, {
|
|
92
93
|
columns: r,
|
|
93
|
-
children: (t) => /* @__PURE__ */ e(
|
|
94
|
+
children: (t) => /* @__PURE__ */ e(F, {
|
|
94
95
|
...t
|
|
95
96
|
})
|
|
96
|
-
}),
|
|
97
|
+
}), h = {
|
|
97
98
|
columnCount: r.length,
|
|
98
99
|
columns: n,
|
|
99
100
|
formatMessage: f,
|
|
100
101
|
iconColumnVariant: m,
|
|
101
|
-
isLoading:
|
|
102
|
-
isSelectAllEnabled: d,
|
|
102
|
+
isLoading: s,
|
|
103
103
|
areSelectionCheckboxesDisabled: i,
|
|
104
|
-
itemActionMenuProps:
|
|
105
|
-
items:
|
|
106
|
-
onInlineEditChange:
|
|
107
|
-
onTableRowClick:
|
|
108
|
-
tableHeader:
|
|
109
|
-
tableProps:
|
|
104
|
+
itemActionMenuProps: A,
|
|
105
|
+
items: d,
|
|
106
|
+
onInlineEditChange: C,
|
|
107
|
+
onTableRowClick: W,
|
|
108
|
+
tableHeader: D,
|
|
109
|
+
tableProps: c,
|
|
110
110
|
zoomLevel: a
|
|
111
111
|
};
|
|
112
|
-
return
|
|
112
|
+
return w ? /* @__PURE__ */ e("div", {
|
|
113
113
|
ref: p,
|
|
114
|
-
className:
|
|
114
|
+
className: l.infiniteScrollTableContainerFullHeight,
|
|
115
115
|
children: /* @__PURE__ */ e("div", {
|
|
116
116
|
style: {
|
|
117
117
|
position: "relative",
|
|
118
118
|
width: "100%",
|
|
119
|
-
height:
|
|
119
|
+
height: S() + Z
|
|
120
120
|
},
|
|
121
|
-
children: /* @__PURE__ */ e(
|
|
122
|
-
...
|
|
121
|
+
children: /* @__PURE__ */ e(I, {
|
|
122
|
+
...h,
|
|
123
123
|
style: {
|
|
124
124
|
position: "absolute",
|
|
125
125
|
top: 0,
|
|
126
126
|
left: 0,
|
|
127
127
|
width: "100%",
|
|
128
|
-
transform: `translateY(${((H =
|
|
128
|
+
transform: `translateY(${((H = u[0]) == null ? void 0 : H.start) || 0}px)`,
|
|
129
129
|
tableLayout: "fixed"
|
|
130
130
|
},
|
|
131
|
-
virtualItems:
|
|
131
|
+
virtualItems: u
|
|
132
132
|
})
|
|
133
133
|
})
|
|
134
|
-
}) : /* @__PURE__ */ e(
|
|
135
|
-
...
|
|
134
|
+
}) : /* @__PURE__ */ e(I, {
|
|
135
|
+
...h
|
|
136
136
|
});
|
|
137
137
|
};
|
|
138
138
|
export {
|
|
139
|
-
|
|
139
|
+
ie as MetadataTable
|
|
140
140
|
};
|
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
import { TableBody as $, Row as
|
|
1
|
+
import { TableBody as $, Row as S, Cell as m, ActionCell as g, Text as u } from "@box/blueprint-web";
|
|
2
2
|
import { ItemTypeIcon as b } from "@box/item-icon";
|
|
3
3
|
import R from "clsx";
|
|
4
|
-
import
|
|
4
|
+
import E from "lodash/get";
|
|
5
5
|
import I from "react";
|
|
6
6
|
import { I as N } from "../../../../../chunks/types.js";
|
|
7
7
|
import { THUMBNAIL_LIST_VIEW_HEIGHTS as w } from "../../constants.js";
|
|
8
|
-
import { s as
|
|
9
|
-
import { jsx as
|
|
8
|
+
import { s as d, T as B } from "../../../../../chunks/index.js";
|
|
9
|
+
import { jsx as l, jsxs as T } from "react/jsx-runtime";
|
|
10
10
|
import { InlineEditingCell as _ } from "./inline-editing-cell/inline-editing-cell.js";
|
|
11
11
|
import { ItemActionMenu as M } from "../../item-action-menu/item-action-menu.js";
|
|
12
12
|
import { GhostTableRow as U } from "./ghost-table-row/ghost-table-row.js";
|
|
13
|
-
const
|
|
14
|
-
const n =
|
|
15
|
-
return
|
|
13
|
+
const x = (e, t, r) => {
|
|
14
|
+
const n = r ? t.split(".")[1] : t;
|
|
15
|
+
return E(e, n);
|
|
16
16
|
}, k = /* @__PURE__ */ I.memo(({
|
|
17
17
|
column: e,
|
|
18
18
|
iconColumnVariant: t,
|
|
19
|
-
item:
|
|
19
|
+
item: r
|
|
20
20
|
}) => {
|
|
21
21
|
const {
|
|
22
22
|
id: n,
|
|
23
|
-
isItemMetadata:
|
|
24
|
-
subtitle:
|
|
25
|
-
textValue:
|
|
26
|
-
} = e,
|
|
27
|
-
return /* @__PURE__ */
|
|
23
|
+
isItemMetadata: s,
|
|
24
|
+
subtitle: a,
|
|
25
|
+
textValue: h
|
|
26
|
+
} = e, i = `${h}-${r.id}`;
|
|
27
|
+
return /* @__PURE__ */ l(m, {
|
|
28
28
|
children: /* @__PURE__ */ T("div", {
|
|
29
|
-
className:
|
|
30
|
-
children: [/* @__PURE__ */
|
|
31
|
-
className:
|
|
32
|
-
item:
|
|
29
|
+
className: d.tableNameCell,
|
|
30
|
+
children: [/* @__PURE__ */ l(b, {
|
|
31
|
+
className: d.tableNameCellIconInline,
|
|
32
|
+
item: r
|
|
33
33
|
}), /* @__PURE__ */ T("div", {
|
|
34
|
-
className: R(
|
|
35
|
-
[
|
|
34
|
+
className: R(d.tableNameCellTitle, {
|
|
35
|
+
[d.hasSubtitle]: t === N.INLINE_SUBTITLE
|
|
36
36
|
}),
|
|
37
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ l(u, {
|
|
38
38
|
as: "span",
|
|
39
|
-
className:
|
|
40
|
-
children:
|
|
41
|
-
}), t === N.INLINE_SUBTITLE && /* @__PURE__ */
|
|
39
|
+
className: d.tableNameCellText,
|
|
40
|
+
children: x(r, n, s)
|
|
41
|
+
}), t === N.INLINE_SUBTITLE && /* @__PURE__ */ l(u, {
|
|
42
42
|
as: "span",
|
|
43
|
-
className:
|
|
43
|
+
className: d.tableNameCellText,
|
|
44
44
|
color: "textOnLightSecondary",
|
|
45
|
-
children:
|
|
45
|
+
children: a
|
|
46
46
|
})]
|
|
47
47
|
})]
|
|
48
48
|
})
|
|
49
|
-
},
|
|
49
|
+
}, i);
|
|
50
50
|
}), W = /* @__PURE__ */ I.memo(({
|
|
51
51
|
column: e,
|
|
52
52
|
item: t
|
|
53
53
|
}) => {
|
|
54
54
|
var n;
|
|
55
|
-
const
|
|
56
|
-
return /* @__PURE__ */
|
|
55
|
+
const r = `${e.textValue}-${t.id}`;
|
|
56
|
+
return /* @__PURE__ */ l(m, {
|
|
57
57
|
children: (n = e.cellRenderer) == null ? void 0 : n.call(e, t, e)
|
|
58
|
-
},
|
|
58
|
+
}, r);
|
|
59
59
|
}), j = /* @__PURE__ */ I.memo(({
|
|
60
60
|
column: e,
|
|
61
61
|
item: t
|
|
62
62
|
}) => {
|
|
63
|
-
const
|
|
64
|
-
return n ? /* @__PURE__ */
|
|
63
|
+
const r = `${e.textValue}-${t.id}`, n = E(t, e.id);
|
|
64
|
+
return n ? /* @__PURE__ */ l(m, {
|
|
65
65
|
children: n.join(" ")
|
|
66
|
-
},
|
|
67
|
-
}),
|
|
66
|
+
}, r) : /* @__PURE__ */ l(m, {}, r);
|
|
67
|
+
}), A = /* @__PURE__ */ I.memo(({
|
|
68
68
|
column: e,
|
|
69
69
|
item: t
|
|
70
70
|
}) => {
|
|
71
71
|
const {
|
|
72
|
-
id:
|
|
72
|
+
id: r,
|
|
73
73
|
isItemMetadata: n,
|
|
74
|
-
textValue:
|
|
75
|
-
} = e,
|
|
76
|
-
return /* @__PURE__ */
|
|
77
|
-
children: /* @__PURE__ */
|
|
74
|
+
textValue: s
|
|
75
|
+
} = e, a = `${s}-${t.id}`;
|
|
76
|
+
return /* @__PURE__ */ l(m, {
|
|
77
|
+
children: /* @__PURE__ */ l(u, {
|
|
78
78
|
as: "span",
|
|
79
|
-
children:
|
|
79
|
+
children: x(t, r, n)
|
|
80
80
|
})
|
|
81
|
-
},
|
|
82
|
-
}),
|
|
81
|
+
}, a);
|
|
82
|
+
}), D = /* @__PURE__ */ I.memo(({
|
|
83
83
|
column: e,
|
|
84
84
|
iconColumnVariant: t,
|
|
85
|
-
item:
|
|
85
|
+
item: r,
|
|
86
86
|
onInlineEditChange: n
|
|
87
87
|
}) => {
|
|
88
88
|
const {
|
|
89
|
-
cellRenderer:
|
|
90
|
-
id:
|
|
91
|
-
isInlineEditingEnabled:
|
|
92
|
-
type:
|
|
93
|
-
} = e,
|
|
94
|
-
return
|
|
89
|
+
cellRenderer: s,
|
|
90
|
+
id: a,
|
|
91
|
+
isInlineEditingEnabled: h,
|
|
92
|
+
type: i
|
|
93
|
+
} = e, p = a === "item.name" && (t === N.INLINE || t === N.INLINE_SUBTITLE);
|
|
94
|
+
return s ? /* @__PURE__ */ l(W, {
|
|
95
95
|
column: e,
|
|
96
|
-
item:
|
|
97
|
-
}) :
|
|
96
|
+
item: r
|
|
97
|
+
}) : p ? /* @__PURE__ */ l(k, {
|
|
98
98
|
column: e,
|
|
99
99
|
iconColumnVariant: t,
|
|
100
|
-
item:
|
|
101
|
-
}) :
|
|
100
|
+
item: r
|
|
101
|
+
}) : h && (i === "multiSelect" || i === "enum") ? /* @__PURE__ */ l(_, {
|
|
102
102
|
column: e,
|
|
103
|
-
item:
|
|
103
|
+
item: r,
|
|
104
104
|
onInlineEditChange: n
|
|
105
|
-
}, `${e.id}-${
|
|
105
|
+
}, `${e.id}-${r.id}`) : i === "multiSelect" ? /* @__PURE__ */ l(j, {
|
|
106
106
|
column: e,
|
|
107
|
-
item:
|
|
108
|
-
}) : /* @__PURE__ */
|
|
107
|
+
item: r
|
|
108
|
+
}) : /* @__PURE__ */ l(A, {
|
|
109
109
|
column: e,
|
|
110
|
-
item:
|
|
110
|
+
item: r
|
|
111
111
|
});
|
|
112
|
-
}),
|
|
112
|
+
}), G = /* @__PURE__ */ I.memo(({
|
|
113
113
|
item: e,
|
|
114
114
|
zoomLevel: t
|
|
115
|
-
}) => /* @__PURE__ */
|
|
115
|
+
}) => /* @__PURE__ */ l(m, {
|
|
116
116
|
style: {
|
|
117
117
|
height: w[t]
|
|
118
118
|
},
|
|
119
|
-
children: /* @__PURE__ */
|
|
120
|
-
className:
|
|
119
|
+
children: /* @__PURE__ */ l(b, {
|
|
120
|
+
className: d.iconCell,
|
|
121
121
|
item: e
|
|
122
122
|
})
|
|
123
|
-
}, `item-type-icon-${e.id}`)),
|
|
123
|
+
}, `item-type-icon-${e.id}`)), H = /* @__PURE__ */ I.memo(({
|
|
124
124
|
item: e,
|
|
125
125
|
itemActionMenuProps: t,
|
|
126
|
-
isCheckboxDisabled:
|
|
127
|
-
}) => /* @__PURE__ */
|
|
128
|
-
isCheckboxDisabled:
|
|
129
|
-
children: (n) => t ? /* @__PURE__ */
|
|
126
|
+
isCheckboxDisabled: r
|
|
127
|
+
}) => /* @__PURE__ */ l(g, {
|
|
128
|
+
isCheckboxDisabled: r,
|
|
129
|
+
children: (n) => t ? /* @__PURE__ */ l(M, {
|
|
130
130
|
...t,
|
|
131
131
|
item: e,
|
|
132
132
|
onOpenChange: n
|
|
@@ -134,59 +134,58 @@ const E = (e, t, l) => {
|
|
|
134
134
|
})), P = ({
|
|
135
135
|
areSelectionCheckboxesDisabled: e,
|
|
136
136
|
columnCount: t,
|
|
137
|
-
columns:
|
|
137
|
+
columns: r,
|
|
138
138
|
iconColumnVariant: n,
|
|
139
|
-
isSelectAllEnabled: a,
|
|
140
139
|
items: s,
|
|
141
|
-
itemActionMenuProps:
|
|
142
|
-
onInlineEditChange:
|
|
143
|
-
onTableRowClick:
|
|
140
|
+
itemActionMenuProps: a,
|
|
141
|
+
onInlineEditChange: h,
|
|
142
|
+
onTableRowClick: i,
|
|
143
|
+
shouldRenderActionColumn: p,
|
|
144
144
|
virtualItems: C,
|
|
145
145
|
zoomLevel: y
|
|
146
146
|
}) => {
|
|
147
147
|
const L = n === N.COLUMN;
|
|
148
148
|
if (C) {
|
|
149
|
-
const o = (c) => /* @__PURE__ */
|
|
149
|
+
const o = (c) => /* @__PURE__ */ l(U, {
|
|
150
150
|
columnLength: t || 0,
|
|
151
151
|
rowKey: `ghost-${c}`
|
|
152
|
-
}),
|
|
152
|
+
}), f = (c) => /* @__PURE__ */ l(B, {
|
|
153
153
|
areSelectionCheckboxesDisabled: e,
|
|
154
|
-
columns:
|
|
154
|
+
columns: r,
|
|
155
155
|
iconColumnVariant: n,
|
|
156
|
-
isSelectAllEnabled: a,
|
|
157
156
|
item: c,
|
|
158
|
-
itemActionMenuProps:
|
|
159
|
-
onTableRowClick:
|
|
157
|
+
itemActionMenuProps: a,
|
|
158
|
+
onTableRowClick: i,
|
|
160
159
|
zoomLevel: y
|
|
161
160
|
});
|
|
162
|
-
return /* @__PURE__ */
|
|
161
|
+
return /* @__PURE__ */ l($, {
|
|
163
162
|
items: C,
|
|
164
163
|
children: ({
|
|
165
164
|
index: c
|
|
166
|
-
}) => c >= s.length ? o(c) :
|
|
165
|
+
}) => c >= s.length ? o(c) : f(s[c])
|
|
167
166
|
});
|
|
168
167
|
}
|
|
169
|
-
return /* @__PURE__ */
|
|
168
|
+
return /* @__PURE__ */ l($, {
|
|
170
169
|
items: s.map((o) => ({
|
|
171
170
|
key: o.id,
|
|
172
171
|
...o
|
|
173
172
|
})),
|
|
174
|
-
children: (o) => /* @__PURE__ */ T(
|
|
175
|
-
className:
|
|
173
|
+
children: (o) => /* @__PURE__ */ T(S, {
|
|
174
|
+
className: d.tableRow,
|
|
176
175
|
id: o.id,
|
|
177
|
-
onAction: () =>
|
|
178
|
-
children: [L && /* @__PURE__ */
|
|
176
|
+
onAction: () => i(o),
|
|
177
|
+
children: [L && /* @__PURE__ */ l(G, {
|
|
179
178
|
item: o,
|
|
180
179
|
zoomLevel: y
|
|
181
|
-
}),
|
|
182
|
-
column:
|
|
180
|
+
}), r.map((f) => /* @__PURE__ */ l(D, {
|
|
181
|
+
column: f,
|
|
183
182
|
iconColumnVariant: n,
|
|
184
183
|
item: o,
|
|
185
|
-
onInlineEditChange:
|
|
186
|
-
}, `${
|
|
184
|
+
onInlineEditChange: h
|
|
185
|
+
}, `${f.textValue}-${o.id}`)), p && /* @__PURE__ */ l(H, {
|
|
187
186
|
isCheckboxDisabled: e,
|
|
188
187
|
item: o,
|
|
189
|
-
itemActionMenuProps:
|
|
188
|
+
itemActionMenuProps: a
|
|
190
189
|
})]
|
|
191
190
|
}, o.id)
|
|
192
191
|
});
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { Table as
|
|
2
|
-
import { I as
|
|
3
|
-
import { GhostTableBody as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
1
|
+
import { Table as x } from "@box/blueprint-web";
|
|
2
|
+
import { I as B } from "../../../../chunks/types.js";
|
|
3
|
+
import { GhostTableBody as R } from "./table-body/ghost-table-body.js";
|
|
4
|
+
import j from "./table-body/table-body-with-data.js";
|
|
5
|
+
import y from "./messages.js";
|
|
6
|
+
import { getShouldRenderActionColumn as A } from "./actionColumn.js";
|
|
7
|
+
import { jsxs as G, jsx as c } from "react/jsx-runtime";
|
|
7
8
|
const U = ({
|
|
8
9
|
columnCount: s,
|
|
9
|
-
columns:
|
|
10
|
-
formatMessage:
|
|
11
|
-
iconColumnVariant:
|
|
10
|
+
columns: e,
|
|
11
|
+
formatMessage: u,
|
|
12
|
+
iconColumnVariant: t,
|
|
12
13
|
isLoading: r,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
items: C,
|
|
14
|
+
areSelectionCheckboxesDisabled: h,
|
|
15
|
+
itemActionMenuProps: C,
|
|
16
|
+
items: f,
|
|
17
17
|
onInlineEditChange: g,
|
|
18
|
-
onTableRowClick:
|
|
19
|
-
style:
|
|
18
|
+
onTableRowClick: d,
|
|
19
|
+
style: p,
|
|
20
20
|
tableHeader: a,
|
|
21
|
-
tableProps:
|
|
21
|
+
tableProps: l,
|
|
22
22
|
virtualItems: o,
|
|
23
|
-
zoomLevel:
|
|
23
|
+
zoomLevel: b
|
|
24
24
|
}) => {
|
|
25
|
-
const l = s || (() => {
|
|
26
|
-
let n =
|
|
27
|
-
return
|
|
28
|
-
})(),
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
"aria-label":
|
|
25
|
+
const m = A(l), i = s || (() => {
|
|
26
|
+
let n = e.length;
|
|
27
|
+
return t === B.COLUMN && (n += 1), m && (n += 1), n;
|
|
28
|
+
})(), T = r && !(o != null && o.length);
|
|
29
|
+
return /* @__PURE__ */ G(x, {
|
|
30
|
+
"aria-label": u(y.listView),
|
|
31
31
|
selectionBehavior: "toggle",
|
|
32
|
-
style:
|
|
33
|
-
...
|
|
34
|
-
children: [a,
|
|
35
|
-
columnLength:
|
|
36
|
-
}) : /* @__PURE__ */
|
|
37
|
-
areSelectionCheckboxesDisabled:
|
|
38
|
-
columnCount:
|
|
39
|
-
columns:
|
|
40
|
-
iconColumnVariant:
|
|
32
|
+
style: p,
|
|
33
|
+
...l,
|
|
34
|
+
children: [a, T ? /* @__PURE__ */ c(R, {
|
|
35
|
+
columnLength: i
|
|
36
|
+
}) : /* @__PURE__ */ c(j, {
|
|
37
|
+
areSelectionCheckboxesDisabled: h,
|
|
38
|
+
columnCount: i,
|
|
39
|
+
columns: e,
|
|
40
|
+
iconColumnVariant: t,
|
|
41
41
|
isLoading: r,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
items: C,
|
|
42
|
+
itemActionMenuProps: C,
|
|
43
|
+
items: f,
|
|
45
44
|
onInlineEditChange: g,
|
|
46
|
-
onTableRowClick:
|
|
45
|
+
onTableRowClick: d,
|
|
46
|
+
shouldRenderActionColumn: m,
|
|
47
47
|
virtualItems: o,
|
|
48
|
-
zoomLevel:
|
|
48
|
+
zoomLevel: b
|
|
49
49
|
})]
|
|
50
50
|
});
|
|
51
51
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as
|
|
2
|
-
import { ActionBar as
|
|
1
|
+
import { I as k, V as t } from "../../chunks/types.js";
|
|
2
|
+
import { ActionBar as x } from "./components/action-bar/action-bar.js";
|
|
3
3
|
import "./components/filter-row/filter-row.js";
|
|
4
4
|
import "./components/filter-row/form-filter-chip.js";
|
|
5
5
|
import "./components/filter-row/metadata-filter-chip.js";
|
|
@@ -8,8 +8,8 @@ import "./components/filter-row/predefinedFilters/index.js";
|
|
|
8
8
|
import "./components/filter-sidepanel/filter.js";
|
|
9
9
|
import "./components/filter-sidepanel/filter-side-panel.js";
|
|
10
10
|
import "./components/item-action-menu/item-action-menu.js";
|
|
11
|
-
import { MetadataGrid as
|
|
12
|
-
import { MetadataTable as
|
|
11
|
+
import { MetadataGrid as z } from "./components/metadata-grid/metadata-grid.js";
|
|
12
|
+
import { MetadataTable as A } from "./components/metadata-table/metadata-table.js";
|
|
13
13
|
import "./components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js";
|
|
14
14
|
import "./components/metadata-table/table-renderer.js";
|
|
15
15
|
import "./components/metadata-value/metadata-file-chip.js";
|
|
@@ -17,39 +17,40 @@ import "./components/metadata-value/metadata-file-field.js";
|
|
|
17
17
|
import "./components/metadata-value/metadata-location-field.js";
|
|
18
18
|
import "./components/metadata-value/metadata-radio-field.js";
|
|
19
19
|
import "./components/metadata-value/metadata-search-field.js";
|
|
20
|
-
import { Pagination as
|
|
20
|
+
import { Pagination as F } from "./components/pagination/pagination.js";
|
|
21
21
|
import "./components/pagination/marker-based-pagination.js";
|
|
22
22
|
import "./components/pagination/offset-based-pagination.js";
|
|
23
23
|
import "./components/pagination/pagination-controls.js";
|
|
24
24
|
import "./components/sort-dropdown/sort-dropdown.js";
|
|
25
|
-
import { SwitchCase as
|
|
26
|
-
import { TooltipProvider as
|
|
27
|
-
import { useState as
|
|
28
|
-
import { jsx as o, jsxs as w, Fragment as
|
|
29
|
-
import { ErrorState as
|
|
30
|
-
import
|
|
31
|
-
import '../../styles/metadata-view.css';const
|
|
32
|
-
container:
|
|
33
|
-
contentContainer:
|
|
25
|
+
import { SwitchCase as U, Case as p } from "./components/switch-case/switch-case.js";
|
|
26
|
+
import { TooltipProvider as q } from "@box/blueprint-web";
|
|
27
|
+
import { useState as s, useRef as H, useCallback as J } from "react";
|
|
28
|
+
import { jsx as o, jsxs as w, Fragment as K } from "react/jsx-runtime";
|
|
29
|
+
import { ErrorState as O } from "./components/error-state/error-state.js";
|
|
30
|
+
import Q from "./components/empty-state/empty-state.js";
|
|
31
|
+
import '../../styles/metadata-view.css';const W = "_container_1o9go_5", X = "_contentContainer_1o9go_15", T = {
|
|
32
|
+
container: W,
|
|
33
|
+
contentContainer: X
|
|
34
34
|
};
|
|
35
|
-
function
|
|
35
|
+
function _o({
|
|
36
36
|
actionBarProps: m,
|
|
37
37
|
columns: d,
|
|
38
38
|
tableProps: n,
|
|
39
39
|
hasError: V,
|
|
40
40
|
onRefresh: L,
|
|
41
41
|
initialViewMode: _ = t.LIST,
|
|
42
|
-
paginationProps:
|
|
43
|
-
isLoading:
|
|
44
|
-
|
|
42
|
+
paginationProps: l,
|
|
43
|
+
isLoading: C,
|
|
44
|
+
isSelectAllEnabled: y = !0,
|
|
45
|
+
isSelectionEnabled: f,
|
|
45
46
|
areSelectionCheckboxesDisabled: h,
|
|
46
|
-
...
|
|
47
|
+
...c
|
|
47
48
|
}) {
|
|
48
|
-
const [r, u] =
|
|
49
|
+
const [r, u] = s(_), [M, S] = s(void 0), [a, D] = s(0), g = H(null), R = () => {
|
|
49
50
|
r === t.LIST ? u(t.GRID) : u(t.LIST);
|
|
50
|
-
},
|
|
51
|
+
}, E = !C && c.items.length === 0, G = m && m.sortDropdownProps && d.filter((e) => e.type !== "multiSelect" && e.type !== "enum"), {
|
|
51
52
|
iconColumnVariant: I
|
|
52
|
-
} = n || {},
|
|
53
|
+
} = n || {}, N = I && I === k.COLUMN, i = n == null ? void 0 : n.onSortChange, j = J(({
|
|
53
54
|
column: e,
|
|
54
55
|
direction: v
|
|
55
56
|
}) => {
|
|
@@ -60,65 +61,65 @@ function Lo({
|
|
|
60
61
|
column: e,
|
|
61
62
|
direction: v
|
|
62
63
|
});
|
|
63
|
-
}, [i]),
|
|
64
|
+
}, [i]), Z = {
|
|
64
65
|
...n,
|
|
65
66
|
sortDescriptor: M,
|
|
66
|
-
onSortChange:
|
|
67
|
+
onSortChange: j
|
|
67
68
|
};
|
|
68
|
-
return /* @__PURE__ */ o(
|
|
69
|
+
return /* @__PURE__ */ o(q, {
|
|
69
70
|
children: /* @__PURE__ */ o("div", {
|
|
70
71
|
ref: g,
|
|
71
72
|
className: T.container,
|
|
72
|
-
children: V ? /* @__PURE__ */ o(
|
|
73
|
+
children: V ? /* @__PURE__ */ o(O, {
|
|
73
74
|
onRefresh: L
|
|
74
|
-
}) : /* @__PURE__ */ w(
|
|
75
|
-
children: [/* @__PURE__ */ o(
|
|
75
|
+
}) : /* @__PURE__ */ w(K, {
|
|
76
|
+
children: [/* @__PURE__ */ o(x, {
|
|
76
77
|
...m,
|
|
77
78
|
containerRef: g,
|
|
78
|
-
isIconColumnEnabled:
|
|
79
|
+
isIconColumnEnabled: N,
|
|
79
80
|
onSortDescriptorChange: S,
|
|
80
|
-
onViewModeClick:
|
|
81
|
-
onZoomLevelChange:
|
|
82
|
-
sortableColumns:
|
|
81
|
+
onViewModeClick: R,
|
|
82
|
+
onZoomLevelChange: D,
|
|
83
|
+
sortableColumns: G,
|
|
83
84
|
sortDescriptor: M,
|
|
84
85
|
viewMode: r,
|
|
85
|
-
zoomLevel:
|
|
86
|
+
zoomLevel: a
|
|
86
87
|
}), /* @__PURE__ */ o("div", {
|
|
87
88
|
className: T.contentContainer,
|
|
88
|
-
children: /* @__PURE__ */ w(
|
|
89
|
-
children: [/* @__PURE__ */ o(
|
|
90
|
-
condition:
|
|
91
|
-
children: /* @__PURE__ */ o(
|
|
92
|
-
}), /* @__PURE__ */ o(
|
|
89
|
+
children: /* @__PURE__ */ w(U, {
|
|
90
|
+
children: [/* @__PURE__ */ o(p, {
|
|
91
|
+
condition: E,
|
|
92
|
+
children: /* @__PURE__ */ o(Q, {})
|
|
93
|
+
}), /* @__PURE__ */ o(p, {
|
|
93
94
|
condition: r === t.LIST,
|
|
94
|
-
children: /* @__PURE__ */ o(
|
|
95
|
+
children: /* @__PURE__ */ o(A, {
|
|
95
96
|
areSelectionCheckboxesDisabled: h,
|
|
96
97
|
columns: d,
|
|
97
|
-
isLoading:
|
|
98
|
-
isSelectAllEnabled:
|
|
99
|
-
selectionMode:
|
|
100
|
-
zoomLevel:
|
|
101
|
-
...
|
|
102
|
-
...
|
|
98
|
+
isLoading: C,
|
|
99
|
+
isSelectAllEnabled: y,
|
|
100
|
+
selectionMode: f ? "multiple" : "none",
|
|
101
|
+
zoomLevel: a,
|
|
102
|
+
...c,
|
|
103
|
+
...Z
|
|
103
104
|
})
|
|
104
|
-
}), /* @__PURE__ */ o(
|
|
105
|
+
}), /* @__PURE__ */ o(p, {
|
|
105
106
|
condition: r === t.GRID,
|
|
106
|
-
children: /* @__PURE__ */ o(
|
|
107
|
+
children: /* @__PURE__ */ o(z, {
|
|
107
108
|
areSelectionCheckboxesDisabled: h,
|
|
108
|
-
selectionMode:
|
|
109
|
-
zoomLevel:
|
|
110
|
-
...
|
|
109
|
+
selectionMode: f ? "multiple" : "none",
|
|
110
|
+
zoomLevel: a,
|
|
111
|
+
...c
|
|
111
112
|
})
|
|
112
113
|
})]
|
|
113
114
|
})
|
|
114
|
-
}),
|
|
115
|
-
...
|
|
115
|
+
}), l && /* @__PURE__ */ o(F, {
|
|
116
|
+
...l
|
|
116
117
|
})]
|
|
117
118
|
})
|
|
118
119
|
})
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
122
|
export {
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
_o as MetadataView,
|
|
124
|
+
_o as default
|
|
124
125
|
};
|
|
@@ -6,6 +6,7 @@ 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
8
|
columnCount?: number;
|
|
9
|
+
shouldRenderActionColumn?: boolean;
|
|
9
10
|
virtualItems?: VirtualItem[];
|
|
10
11
|
}
|
|
11
12
|
type CellProps = {
|
|
@@ -14,5 +15,5 @@ type CellProps = {
|
|
|
14
15
|
iconColumnVariant: IconColumnVariant;
|
|
15
16
|
};
|
|
16
17
|
export type DataCellProps = CellProps & Pick<InlineEditingCellProps, 'onInlineEditChange'>;
|
|
17
|
-
declare const TableBodyWithData: ({ areSelectionCheckboxesDisabled, columnCount, columns, iconColumnVariant,
|
|
18
|
+
declare const TableBodyWithData: ({ areSelectionCheckboxesDisabled, columnCount, columns, iconColumnVariant, items, itemActionMenuProps, onInlineEditChange, onTableRowClick, shouldRenderActionColumn, virtualItems, zoomLevel, }: TableBodyWithDataProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export default TableBodyWithData;
|
|
@@ -4,10 +4,10 @@ export interface TableRowProps {
|
|
|
4
4
|
areSelectionCheckboxesDisabled?: MetadataTableProps['areSelectionCheckboxesDisabled'];
|
|
5
5
|
columns: MetadataTableProps['columns'];
|
|
6
6
|
iconColumnVariant: MetadataTableProps['iconColumnVariant'];
|
|
7
|
-
isSelectAllEnabled: MetadataTableProps['isSelectAllEnabled'];
|
|
8
7
|
item: Item;
|
|
9
8
|
itemActionMenuProps: MetadataTableProps['itemActionMenuProps'];
|
|
10
|
-
zoomLevel?: number;
|
|
11
9
|
onTableRowClick: MetadataTableProps['onTableRowClick'];
|
|
10
|
+
shouldRenderActionColumn?: boolean;
|
|
11
|
+
zoomLevel?: number;
|
|
12
12
|
}
|
|
13
|
-
export declare const TableRow: ({ areSelectionCheckboxesDisabled, columns, iconColumnVariant,
|
|
13
|
+
export declare const TableRow: ({ areSelectionCheckboxesDisabled, columns, iconColumnVariant, item, itemActionMenuProps, onTableRowClick, shouldRenderActionColumn, zoomLevel, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,6 @@ export interface TableRendererProps extends Pick<InlineEditingCellProps, 'onInli
|
|
|
10
10
|
formatMessage: ReturnType<typeof useIntl>['formatMessage'];
|
|
11
11
|
iconColumnVariant?: IconColumnVariant;
|
|
12
12
|
isLoading?: boolean;
|
|
13
|
-
isSelectAllEnabled?: boolean;
|
|
14
13
|
areSelectionCheckboxesDisabled?: boolean;
|
|
15
14
|
itemActionMenuProps?: MetadataProps['itemActionMenuProps'];
|
|
16
15
|
items: MetadataProps['items'];
|
|
@@ -21,4 +20,4 @@ export interface TableRendererProps extends Pick<InlineEditingCellProps, 'onInli
|
|
|
21
20
|
virtualItems?: VirtualItem[];
|
|
22
21
|
zoomLevel?: number;
|
|
23
22
|
}
|
|
24
|
-
export declare const TableRenderer: ({ columnCount: passedColumnCount, columns, formatMessage, iconColumnVariant, isLoading,
|
|
23
|
+
export declare const TableRenderer: ({ columnCount: passedColumnCount, columns, formatMessage, iconColumnVariant, isLoading, areSelectionCheckboxesDisabled, itemActionMenuProps, items, onInlineEditChange, onTableRowClick, style, tableHeader, tableProps, virtualItems, zoomLevel, }: TableRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,10 +9,11 @@ export interface MetadataViewProps extends MetadataProps {
|
|
|
9
9
|
onRefresh?: () => void;
|
|
10
10
|
onSelectionChange?: (keys: Selection) => void;
|
|
11
11
|
selectedKeys?: 'all' | Iterable<string | number>;
|
|
12
|
+
isSelectAllEnabled?: boolean;
|
|
12
13
|
isSelectionEnabled?: boolean;
|
|
13
14
|
areSelectionCheckboxesDisabled?: boolean;
|
|
14
15
|
tableProps?: Omit<MetadataTableProps, 'columns' | 'isSelectAllEnabled' | 'items' | 'itemActionMenuProps' | 'onSelectionChange' | 'selectedKeys'>;
|
|
15
16
|
paginationProps?: PaginationProps;
|
|
16
17
|
}
|
|
17
|
-
export declare function MetadataView({ actionBarProps, columns, tableProps, hasError, onRefresh, initialViewMode, paginationProps, isLoading, isSelectionEnabled, areSelectionCheckboxesDisabled, ...rest }: MetadataViewProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function MetadataView({ actionBarProps, columns, tableProps, hasError, onRefresh, initialViewMode, paginationProps, isLoading, isSelectAllEnabled, isSelectionEnabled, areSelectionCheckboxesDisabled, ...rest }: MetadataViewProps): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export default MetadataView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-view",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
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.92.
|
|
21
|
+
"@box/blueprint-web": "^12.92.3",
|
|
22
22
|
"@box/blueprint-web-assets": "^4.76.2",
|
|
23
|
-
"@box/box-item-type-selector": "^1.4.
|
|
23
|
+
"@box/box-item-type-selector": "^1.4.3",
|
|
24
24
|
"@box/eslint-plugin-blueprint": "1.0.5",
|
|
25
|
-
"@box/item-icon": "^1.
|
|
26
|
-
"@box/metadata-filter": "^1.41.
|
|
25
|
+
"@box/item-icon": "^1.6.1",
|
|
26
|
+
"@box/metadata-filter": "^1.41.3",
|
|
27
27
|
"@box/storybook-utils": "0.14.13",
|
|
28
28
|
"@box/types": "1.0.0",
|
|
29
29
|
"@tanstack/react-virtual": "^3.10.8",
|