@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.
@@ -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: u,
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: () => u(l),
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
- }), p && /* @__PURE__ */ e(y, {
91
+ }), u && /* @__PURE__ */ e(y, {
92
92
  isCheckboxDisabled: h,
93
93
  children: (c) => _ ? /* @__PURE__ */ e(w, {
94
94
  ..._,
@@ -0,0 +1,6 @@
1
+ function e(n) {
2
+ return (n == null ? void 0 : n.selectionMode) && n.selectionMode !== "none";
3
+ }
4
+ export {
5
+ e as getShouldRenderActionColumn
6
+ };
@@ -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 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";
6
- import { TableRenderer as R } from "./table-renderer.js";
7
- import { I as L } from "../../../../chunks/types.js";
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 Y = 40, le = ({
14
+ const Z = 40, ie = ({
14
15
  areSelectionCheckboxesDisabled: i = !1,
15
16
  columns: n,
16
- hasNextPage: w = !1,
17
+ hasNextPage: g = !1,
17
18
  iconColumnVariant: m,
18
- isInfiniteScrollEnabled: x = !1,
19
- isLoading: l = !1,
20
- isSelectAllEnabled: d,
21
- itemActionMenuProps: g,
22
- items: c,
19
+ isInfiniteScrollEnabled: w = !1,
20
+ isLoading: s = !1,
21
+ isSelectAllEnabled: x,
22
+ itemActionMenuProps: A,
23
+ items: d,
23
24
  onGetNextPage: y,
24
- onInlineEditChange: W,
25
- onTableRowClick: A = F,
26
- placeholderRowsCount: C,
25
+ onInlineEditChange: C,
26
+ onTableRowClick: W = G,
27
+ placeholderRowsCount: N,
27
28
  zoomLevel: a,
28
- ...N
29
+ ...c
29
30
  }) => {
30
31
  var H;
31
32
  const {
32
33
  formatMessage: f
33
34
  } = O(), p = B(null), {
34
- virtualItemsToDisplay: h,
35
- getTableHeight: _
36
- } = G({
37
- items: c,
38
- hasNextPage: w,
39
- isLoading: l,
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: C
43
- }), r = [], v = 0;
44
- if (m === L.COLUMN) {
45
- a = a || v;
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 D = n.map((t) => {
56
+ const v = n.map((t) => {
56
57
  const {
57
58
  id: b,
58
- isRowHeader: S,
59
- headerRenderer: T,
59
+ isRowHeader: E,
60
+ headerRenderer: R,
60
61
  textValue: o,
61
- type: I,
62
- ...E
62
+ type: T,
63
+ ...M
63
64
  } = t;
64
65
  return {
65
- ...E,
66
- children: T ? T(o, t) : /* @__PURE__ */ e(P, {
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" || S,
71
+ isRowHeader: b === "name" || E,
71
72
  id: b,
72
73
  textValue: o,
73
- allowsSorting: I !== "multiSelect" && I !== "enum"
74
+ allowsSorting: T !== "multiSelect" && T !== "enum"
74
75
  };
75
76
  });
76
- r.push(...D), d && r.push({
77
+ r.push(...v), Y(c) && r.push({
77
78
  id: "actions",
78
- className: s.tableHeaderActions,
79
+ className: l.tableHeaderActions,
79
80
  children: /* @__PURE__ */ e("div", {
80
- className: s.tableHeaderActionsWrapper,
81
- children: /* @__PURE__ */ e(U, {
81
+ className: l.tableHeaderActionsWrapper,
82
+ children: x ? /* @__PURE__ */ e(j, {
82
83
  "aria-label": f(X.selectAll),
83
- className: s.selectAllCheckbox,
84
- isDisabled: l || i
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 M = /* @__PURE__ */ e(j, {
92
+ const D = /* @__PURE__ */ e(k, {
92
93
  columns: r,
93
- children: (t) => /* @__PURE__ */ e(k, {
94
+ children: (t) => /* @__PURE__ */ e(F, {
94
95
  ...t
95
96
  })
96
- }), u = {
97
+ }), h = {
97
98
  columnCount: r.length,
98
99
  columns: n,
99
100
  formatMessage: f,
100
101
  iconColumnVariant: m,
101
- isLoading: l,
102
- isSelectAllEnabled: d,
102
+ isLoading: s,
103
103
  areSelectionCheckboxesDisabled: i,
104
- itemActionMenuProps: g,
105
- items: c,
106
- onInlineEditChange: W,
107
- onTableRowClick: A,
108
- tableHeader: M,
109
- tableProps: N,
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 x ? /* @__PURE__ */ e("div", {
112
+ return w ? /* @__PURE__ */ e("div", {
113
113
  ref: p,
114
- className: s.infiniteScrollTableContainerFullHeight,
114
+ className: l.infiniteScrollTableContainerFullHeight,
115
115
  children: /* @__PURE__ */ e("div", {
116
116
  style: {
117
117
  position: "relative",
118
118
  width: "100%",
119
- height: _() + Y
119
+ height: S() + Z
120
120
  },
121
- children: /* @__PURE__ */ e(R, {
122
- ...u,
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 = h[0]) == null ? void 0 : H.start) || 0}px)`,
128
+ transform: `translateY(${((H = u[0]) == null ? void 0 : H.start) || 0}px)`,
129
129
  tableLayout: "fixed"
130
130
  },
131
- virtualItems: h
131
+ virtualItems: u
132
132
  })
133
133
  })
134
- }) : /* @__PURE__ */ e(R, {
135
- ...u
134
+ }) : /* @__PURE__ */ e(I, {
135
+ ...h
136
136
  });
137
137
  };
138
138
  export {
139
- le as MetadataTable
139
+ ie as MetadataTable
140
140
  };
@@ -1,132 +1,132 @@
1
- import { TableBody as $, Row as g, Cell as h, ActionCell as S, Text as u } from "@box/blueprint-web";
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 x from "lodash/get";
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 i, T as B } from "../../../../../chunks/index.js";
9
- import { jsx as r, jsxs as T } from "react/jsx-runtime";
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 E = (e, t, l) => {
14
- const n = l ? t.split(".")[1] : t;
15
- return x(e, n);
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: l
19
+ item: r
20
20
  }) => {
21
21
  const {
22
22
  id: n,
23
- isItemMetadata: a,
24
- subtitle: s,
25
- textValue: m
26
- } = e, d = `${m}-${l.id}`;
27
- return /* @__PURE__ */ r(h, {
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: i.tableNameCell,
30
- children: [/* @__PURE__ */ r(b, {
31
- className: i.tableNameCellIconInline,
32
- item: l
29
+ className: d.tableNameCell,
30
+ children: [/* @__PURE__ */ l(b, {
31
+ className: d.tableNameCellIconInline,
32
+ item: r
33
33
  }), /* @__PURE__ */ T("div", {
34
- className: R(i.tableNameCellTitle, {
35
- [i.hasSubtitle]: t === N.INLINE_SUBTITLE
34
+ className: R(d.tableNameCellTitle, {
35
+ [d.hasSubtitle]: t === N.INLINE_SUBTITLE
36
36
  }),
37
- children: [/* @__PURE__ */ r(u, {
37
+ children: [/* @__PURE__ */ l(u, {
38
38
  as: "span",
39
- className: i.tableNameCellText,
40
- children: E(l, n, a)
41
- }), t === N.INLINE_SUBTITLE && /* @__PURE__ */ r(u, {
39
+ className: d.tableNameCellText,
40
+ children: x(r, n, s)
41
+ }), t === N.INLINE_SUBTITLE && /* @__PURE__ */ l(u, {
42
42
  as: "span",
43
- className: i.tableNameCellText,
43
+ className: d.tableNameCellText,
44
44
  color: "textOnLightSecondary",
45
- children: s
45
+ children: a
46
46
  })]
47
47
  })]
48
48
  })
49
- }, d);
49
+ }, i);
50
50
  }), W = /* @__PURE__ */ I.memo(({
51
51
  column: e,
52
52
  item: t
53
53
  }) => {
54
54
  var n;
55
- const l = `${e.textValue}-${t.id}`;
56
- return /* @__PURE__ */ r(h, {
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
- }, l);
58
+ }, r);
59
59
  }), j = /* @__PURE__ */ I.memo(({
60
60
  column: e,
61
61
  item: t
62
62
  }) => {
63
- const l = `${e.textValue}-${t.id}`, n = x(t, e.id);
64
- return n ? /* @__PURE__ */ r(h, {
63
+ const r = `${e.textValue}-${t.id}`, n = E(t, e.id);
64
+ return n ? /* @__PURE__ */ l(m, {
65
65
  children: n.join(" ")
66
- }, l) : /* @__PURE__ */ r(h, {}, l);
67
- }), D = /* @__PURE__ */ I.memo(({
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: l,
72
+ id: r,
73
73
  isItemMetadata: n,
74
- textValue: a
75
- } = e, s = `${a}-${t.id}`;
76
- return /* @__PURE__ */ r(h, {
77
- children: /* @__PURE__ */ r(u, {
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: E(t, l, n)
79
+ children: x(t, r, n)
80
80
  })
81
- }, s);
82
- }), G = /* @__PURE__ */ I.memo(({
81
+ }, a);
82
+ }), D = /* @__PURE__ */ I.memo(({
83
83
  column: e,
84
84
  iconColumnVariant: t,
85
- item: l,
85
+ item: r,
86
86
  onInlineEditChange: n
87
87
  }) => {
88
88
  const {
89
- cellRenderer: a,
90
- id: s,
91
- isInlineEditingEnabled: m,
92
- type: d
93
- } = e, f = s === "item.name" && (t === N.INLINE || t === N.INLINE_SUBTITLE);
94
- return a ? /* @__PURE__ */ r(W, {
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: l
97
- }) : f ? /* @__PURE__ */ r(k, {
96
+ item: r
97
+ }) : p ? /* @__PURE__ */ l(k, {
98
98
  column: e,
99
99
  iconColumnVariant: t,
100
- item: l
101
- }) : m && (d === "multiSelect" || d === "enum") ? /* @__PURE__ */ r(_, {
100
+ item: r
101
+ }) : h && (i === "multiSelect" || i === "enum") ? /* @__PURE__ */ l(_, {
102
102
  column: e,
103
- item: l,
103
+ item: r,
104
104
  onInlineEditChange: n
105
- }, `${e.id}-${l.id}`) : d === "multiSelect" ? /* @__PURE__ */ r(j, {
105
+ }, `${e.id}-${r.id}`) : i === "multiSelect" ? /* @__PURE__ */ l(j, {
106
106
  column: e,
107
- item: l
108
- }) : /* @__PURE__ */ r(D, {
107
+ item: r
108
+ }) : /* @__PURE__ */ l(A, {
109
109
  column: e,
110
- item: l
110
+ item: r
111
111
  });
112
- }), H = /* @__PURE__ */ I.memo(({
112
+ }), G = /* @__PURE__ */ I.memo(({
113
113
  item: e,
114
114
  zoomLevel: t
115
- }) => /* @__PURE__ */ r(h, {
115
+ }) => /* @__PURE__ */ l(m, {
116
116
  style: {
117
117
  height: w[t]
118
118
  },
119
- children: /* @__PURE__ */ r(b, {
120
- className: i.iconCell,
119
+ children: /* @__PURE__ */ l(b, {
120
+ className: d.iconCell,
121
121
  item: e
122
122
  })
123
- }, `item-type-icon-${e.id}`)), A = /* @__PURE__ */ I.memo(({
123
+ }, `item-type-icon-${e.id}`)), H = /* @__PURE__ */ I.memo(({
124
124
  item: e,
125
125
  itemActionMenuProps: t,
126
- isCheckboxDisabled: l
127
- }) => /* @__PURE__ */ r(S, {
128
- isCheckboxDisabled: l,
129
- children: (n) => t ? /* @__PURE__ */ r(M, {
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: l,
137
+ columns: r,
138
138
  iconColumnVariant: n,
139
- isSelectAllEnabled: a,
140
139
  items: s,
141
- itemActionMenuProps: m,
142
- onInlineEditChange: d,
143
- onTableRowClick: f,
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__ */ r(U, {
149
+ const o = (c) => /* @__PURE__ */ l(U, {
150
150
  columnLength: t || 0,
151
151
  rowKey: `ghost-${c}`
152
- }), p = (c) => /* @__PURE__ */ r(B, {
152
+ }), f = (c) => /* @__PURE__ */ l(B, {
153
153
  areSelectionCheckboxesDisabled: e,
154
- columns: l,
154
+ columns: r,
155
155
  iconColumnVariant: n,
156
- isSelectAllEnabled: a,
157
156
  item: c,
158
- itemActionMenuProps: m,
159
- onTableRowClick: f,
157
+ itemActionMenuProps: a,
158
+ onTableRowClick: i,
160
159
  zoomLevel: y
161
160
  });
162
- return /* @__PURE__ */ r($, {
161
+ return /* @__PURE__ */ l($, {
163
162
  items: C,
164
163
  children: ({
165
164
  index: c
166
- }) => c >= s.length ? o(c) : p(s[c])
165
+ }) => c >= s.length ? o(c) : f(s[c])
167
166
  });
168
167
  }
169
- return /* @__PURE__ */ r($, {
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(g, {
175
- className: i.tableRow,
173
+ children: (o) => /* @__PURE__ */ T(S, {
174
+ className: d.tableRow,
176
175
  id: o.id,
177
- onAction: () => f(o),
178
- children: [L && /* @__PURE__ */ r(H, {
176
+ onAction: () => i(o),
177
+ children: [L && /* @__PURE__ */ l(G, {
179
178
  item: o,
180
179
  zoomLevel: y
181
- }), l.map((p) => /* @__PURE__ */ r(G, {
182
- column: p,
180
+ }), r.map((f) => /* @__PURE__ */ l(D, {
181
+ column: f,
183
182
  iconColumnVariant: n,
184
183
  item: o,
185
- onInlineEditChange: d
186
- }, `${p.textValue}-${o.id}`)), a && /* @__PURE__ */ r(A, {
184
+ onInlineEditChange: h
185
+ }, `${f.textValue}-${o.id}`)), p && /* @__PURE__ */ l(H, {
187
186
  isCheckboxDisabled: e,
188
187
  item: o,
189
- itemActionMenuProps: m
188
+ itemActionMenuProps: a
190
189
  })]
191
190
  }, o.id)
192
191
  });
@@ -1,51 +1,51 @@
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";
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: t,
10
- formatMessage: c,
11
- iconColumnVariant: e,
10
+ columns: e,
11
+ formatMessage: u,
12
+ iconColumnVariant: t,
12
13
  isLoading: r,
13
- isSelectAllEnabled: m,
14
- areSelectionCheckboxesDisabled: f,
15
- itemActionMenuProps: h,
16
- items: C,
14
+ areSelectionCheckboxesDisabled: h,
15
+ itemActionMenuProps: C,
16
+ items: f,
17
17
  onInlineEditChange: g,
18
- onTableRowClick: p,
19
- style: u,
18
+ onTableRowClick: d,
19
+ style: p,
20
20
  tableHeader: a,
21
- tableProps: b,
21
+ tableProps: l,
22
22
  virtualItems: o,
23
- zoomLevel: T
23
+ zoomLevel: b
24
24
  }) => {
25
- const l = s || (() => {
26
- let n = t.length;
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),
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: u,
33
- ...b,
34
- children: [a, x ? /* @__PURE__ */ i(j, {
35
- columnLength: l
36
- }) : /* @__PURE__ */ i(y, {
37
- areSelectionCheckboxesDisabled: f,
38
- columnCount: l,
39
- columns: t,
40
- iconColumnVariant: e,
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
- isSelectAllEnabled: m,
43
- itemActionMenuProps: h,
44
- items: C,
42
+ itemActionMenuProps: C,
43
+ items: f,
45
44
  onInlineEditChange: g,
46
- onTableRowClick: p,
45
+ onTableRowClick: d,
46
+ shouldRenderActionColumn: m,
47
47
  virtualItems: o,
48
- zoomLevel: T
48
+ zoomLevel: b
49
49
  })]
50
50
  });
51
51
  };
@@ -1,5 +1,5 @@
1
- import { I as A, V as t } from "../../chunks/types.js";
2
- import { ActionBar as Z } from "./components/action-bar/action-bar.js";
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 k } from "./components/metadata-grid/metadata-grid.js";
12
- import { MetadataTable as x } from "./components/metadata-table/metadata-table.js";
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 z } from "./components/pagination/pagination.js";
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 F, Case as s } from "./components/switch-case/switch-case.js";
26
- import { TooltipProvider as U } from "@box/blueprint-web";
27
- import { useState as l, useRef as q, useCallback as H } from "react";
28
- import { jsx as o, jsxs as w, Fragment as J } from "react/jsx-runtime";
29
- import { ErrorState as K } from "./components/error-state/error-state.js";
30
- import O from "./components/empty-state/empty-state.js";
31
- import '../../styles/metadata-view.css';const Q = "_container_1o9go_5", W = "_contentContainer_1o9go_15", T = {
32
- container: Q,
33
- contentContainer: W
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 Lo({
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: C,
43
- isLoading: f,
44
- isSelectionEnabled: c,
42
+ paginationProps: l,
43
+ isLoading: C,
44
+ isSelectAllEnabled: y = !0,
45
+ isSelectionEnabled: f,
45
46
  areSelectionCheckboxesDisabled: h,
46
- ...a
47
+ ...c
47
48
  }) {
48
- const [r, u] = l(_), [M, S] = l(void 0), [p, y] = l(0), g = q(null), D = () => {
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
- }, R = !f && a.items.length === 0, E = m && m.sortDropdownProps && d.filter((e) => e.type !== "multiSelect" && e.type !== "enum"), {
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 || {}, G = I && I === A.COLUMN, i = n == null ? void 0 : n.onSortChange, N = H(({
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]), j = {
64
+ }, [i]), Z = {
64
65
  ...n,
65
66
  sortDescriptor: M,
66
- onSortChange: N
67
+ onSortChange: j
67
68
  };
68
- return /* @__PURE__ */ o(U, {
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(K, {
73
+ children: V ? /* @__PURE__ */ o(O, {
73
74
  onRefresh: L
74
- }) : /* @__PURE__ */ w(J, {
75
- children: [/* @__PURE__ */ o(Z, {
75
+ }) : /* @__PURE__ */ w(K, {
76
+ children: [/* @__PURE__ */ o(x, {
76
77
  ...m,
77
78
  containerRef: g,
78
- isIconColumnEnabled: G,
79
+ isIconColumnEnabled: N,
79
80
  onSortDescriptorChange: S,
80
- onViewModeClick: D,
81
- onZoomLevelChange: y,
82
- sortableColumns: E,
81
+ onViewModeClick: R,
82
+ onZoomLevelChange: D,
83
+ sortableColumns: G,
83
84
  sortDescriptor: M,
84
85
  viewMode: r,
85
- zoomLevel: p
86
+ zoomLevel: a
86
87
  }), /* @__PURE__ */ o("div", {
87
88
  className: T.contentContainer,
88
- children: /* @__PURE__ */ w(F, {
89
- children: [/* @__PURE__ */ o(s, {
90
- condition: R,
91
- children: /* @__PURE__ */ o(O, {})
92
- }), /* @__PURE__ */ o(s, {
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(x, {
95
+ children: /* @__PURE__ */ o(A, {
95
96
  areSelectionCheckboxesDisabled: h,
96
97
  columns: d,
97
- isLoading: f,
98
- isSelectAllEnabled: c,
99
- selectionMode: c ? "multiple" : "none",
100
- zoomLevel: p,
101
- ...a,
102
- ...j
98
+ isLoading: C,
99
+ isSelectAllEnabled: y,
100
+ selectionMode: f ? "multiple" : "none",
101
+ zoomLevel: a,
102
+ ...c,
103
+ ...Z
103
104
  })
104
- }), /* @__PURE__ */ o(s, {
105
+ }), /* @__PURE__ */ o(p, {
105
106
  condition: r === t.GRID,
106
- children: /* @__PURE__ */ o(k, {
107
+ children: /* @__PURE__ */ o(z, {
107
108
  areSelectionCheckboxesDisabled: h,
108
- selectionMode: c ? "multiple" : "none",
109
- zoomLevel: p,
110
- ...a
109
+ selectionMode: f ? "multiple" : "none",
110
+ zoomLevel: a,
111
+ ...c
111
112
  })
112
113
  })]
113
114
  })
114
- }), C && /* @__PURE__ */ o(z, {
115
- ...C
115
+ }), l && /* @__PURE__ */ o(F, {
116
+ ...l
116
117
  })]
117
118
  })
118
119
  })
119
120
  });
120
121
  }
121
122
  export {
122
- Lo as MetadataView,
123
- Lo as default
123
+ _o as MetadataView,
124
+ _o as default
124
125
  };
@@ -0,0 +1,5 @@
1
+ interface TableProps {
2
+ selectionMode?: string;
3
+ }
4
+ export declare function getShouldRenderActionColumn(tableProps: TableProps): boolean;
5
+ export {};
@@ -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, isSelectAllEnabled, items, itemActionMenuProps, onInlineEditChange, onTableRowClick, virtualItems, zoomLevel, }: TableBodyWithDataProps) => import("react/jsx-runtime").JSX.Element;
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, isSelectAllEnabled, item, itemActionMenuProps, onTableRowClick, zoomLevel, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
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, isSelectAllEnabled, areSelectionCheckboxesDisabled, itemActionMenuProps, items, onInlineEditChange, onTableRowClick, style, tableHeader, tableProps, virtualItems, zoomLevel, }: TableRendererProps) => import("react/jsx-runtime").JSX.Element;
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.9.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.1",
21
+ "@box/blueprint-web": "^12.92.3",
22
22
  "@box/blueprint-web-assets": "^4.76.2",
23
- "@box/box-item-type-selector": "^1.4.1",
23
+ "@box/box-item-type-selector": "^1.4.3",
24
24
  "@box/eslint-plugin-blueprint": "1.0.5",
25
- "@box/item-icon": "^1.5.1",
26
- "@box/metadata-filter": "^1.41.1",
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",