@box/metadata-view 1.57.7 → 1.58.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.
@@ -15,87 +15,89 @@ import '../styles/metadata-view.css';var y = {
15
15
  container: "_container_1o9go_5",
16
16
  contentContainer: "_contentContainer_1o9go_15"
17
17
  };
18
- function b({ actionBarProps: b, columns: x, tableProps: S, hasError: C, headerProps: w, onRefresh: T, onSelectionChange: E, onViewModeChange: D, selectedKeys: O, initialViewMode: k = e.LIST, paginationProps: A, isLoading: j, isSelectAllEnabled: M = !0, isSelectionEnabled: N, areSelectionCheckboxesDisabled: P, ...F }) {
19
- let [I, L] = h(k), [R, z] = h(void 0), [B, V] = h(0), H = m(null), { headerSelectionProps: U, handleSelectionChange: W, selectionResetKey: G } = d({
20
- headerProps: w,
21
- items: F.items,
22
- selectedKeys: O,
23
- isSelectionEnabled: N,
24
- onSelectionChange: E
25
- }), K = () => {
26
- L((t) => {
18
+ function b({ actionBarProps: b, columns: x, dataTargetPrefix: S, tableProps: C, hasError: w, headerProps: T, onRefresh: E, onSelectionChange: D, onViewModeChange: O, selectedKeys: k, initialViewMode: A = e.LIST, paginationProps: j, isLoading: M, isSelectAllEnabled: N = !0, isSelectionEnabled: P, areSelectionCheckboxesDisabled: F, ...I }) {
19
+ let [L, R] = h(A), [z, B] = h(void 0), [V, H] = h(0), U = m(null), { headerSelectionProps: W, handleSelectionChange: G, selectionResetKey: K } = d({
20
+ headerProps: T,
21
+ items: I.items,
22
+ selectedKeys: k,
23
+ isSelectionEnabled: P,
24
+ onSelectionChange: D
25
+ }), q = () => {
26
+ R((t) => {
27
27
  let n = t === e.LIST ? e.GRID : e.LIST;
28
- return D?.(n), n;
28
+ return O?.(n), n;
29
29
  });
30
- }, q = !j && F.items.length === 0, J = b && b.sortDropdownProps && x.filter((e) => e.type !== "multiSelect" && e.type !== "enum" && e.allowsSorting === !0), { iconColumnVariant: Y } = S || {}, X = Y && Y === t.COLUMN, Z = S?.onSortChange, Q = p(({ column: e, direction: t }) => {
31
- z({
30
+ }, J = !M && I.items.length === 0, Y = b && b.sortDropdownProps && x.filter((e) => e.type !== "multiSelect" && e.type !== "enum" && e.allowsSorting === !0), { iconColumnVariant: X } = C || {}, Z = X && X === t.COLUMN, Q = C?.onSortChange, $ = p(({ column: e, direction: t }) => {
31
+ B({
32
32
  column: e,
33
33
  direction: t
34
- }), Z?.({
34
+ }), Q?.({
35
35
  column: e,
36
36
  direction: t
37
37
  });
38
- }, [Z]), $ = {
39
- ...S,
40
- sortDescriptor: R,
41
- onSortChange: Q
38
+ }, [Q]), ee = {
39
+ ...C,
40
+ sortDescriptor: z,
41
+ onSortChange: $
42
42
  };
43
43
  return /* @__PURE__ */ _(f, { children: /* @__PURE__ */ _("div", {
44
- ref: H,
44
+ ref: U,
45
45
  className: y.container,
46
- children: C ? /* @__PURE__ */ _(u, { onRefresh: T }) : /* @__PURE__ */ v(g, { children: [
47
- w && /* @__PURE__ */ _(c, {
48
- ...w,
49
- ...U
46
+ children: w ? /* @__PURE__ */ _(u, { onRefresh: E }) : /* @__PURE__ */ v(g, { children: [
47
+ T && /* @__PURE__ */ _(c, {
48
+ ...T,
49
+ ...W
50
50
  }),
51
51
  /* @__PURE__ */ _(n, {
52
52
  ...b,
53
- containerRef: H,
54
- isIconColumnEnabled: X,
55
- onSortDescriptorChange: z,
56
- onViewModeClick: K,
57
- onZoomLevelChange: V,
58
- sortableColumns: J,
59
- sortDescriptor: R,
60
- viewMode: I,
61
- zoomLevel: B
53
+ containerRef: U,
54
+ dataTargetPrefix: S,
55
+ isIconColumnEnabled: Z,
56
+ onSortDescriptorChange: B,
57
+ onViewModeClick: q,
58
+ onZoomLevelChange: H,
59
+ sortableColumns: Y,
60
+ sortDescriptor: z,
61
+ viewMode: L,
62
+ zoomLevel: V
62
63
  }),
63
64
  /* @__PURE__ */ _("div", {
64
65
  className: y.contentContainer,
65
66
  children: /* @__PURE__ */ v(s, { children: [
66
67
  /* @__PURE__ */ _(o, {
67
- condition: q,
68
+ condition: J,
68
69
  children: /* @__PURE__ */ _(l, {})
69
70
  }),
70
71
  /* @__PURE__ */ _(o, {
71
- condition: I === e.LIST,
72
+ condition: L === e.LIST,
72
73
  children: /* @__PURE__ */ _(i, {
73
- areSelectionCheckboxesDisabled: P,
74
+ areSelectionCheckboxesDisabled: F,
74
75
  columns: x,
75
- isLoading: j,
76
- isSelectAllEnabled: M,
77
- onSelectionChange: W,
78
- selectedKeys: O,
79
- selectionMode: N ? "multiple" : "none",
80
- zoomLevel: B,
81
- ...F,
82
- ...$
83
- }, G)
76
+ isLoading: M,
77
+ isSelectAllEnabled: N,
78
+ onSelectionChange: G,
79
+ selectedKeys: k,
80
+ selectionMode: P ? "multiple" : "none",
81
+ zoomLevel: V,
82
+ ...I,
83
+ ...ee,
84
+ dataTargetPrefix: S
85
+ }, K)
84
86
  }),
85
87
  /* @__PURE__ */ _(o, {
86
- condition: I === e.GRID,
88
+ condition: L === e.GRID,
87
89
  children: /* @__PURE__ */ _(r, {
88
- areSelectionCheckboxesDisabled: P,
89
- onSelectionChange: W,
90
- selectedKeys: O,
91
- selectionMode: N ? "multiple" : "none",
92
- zoomLevel: B,
93
- ...F
94
- }, G)
90
+ areSelectionCheckboxesDisabled: F,
91
+ onSelectionChange: G,
92
+ selectedKeys: k,
93
+ selectionMode: P ? "multiple" : "none",
94
+ zoomLevel: V,
95
+ ...I
96
+ }, K)
95
97
  })
96
98
  ] })
97
99
  }),
98
- A && /* @__PURE__ */ _(a, { ...A })
100
+ j && /* @__PURE__ */ _(a, { ...j })
99
101
  ] })
100
102
  }) });
101
103
  }
@@ -18,31 +18,32 @@ import '../styles/table-row.css';var f = {
18
18
  tableNameCellText: "_tableNameCellText_1sntd_65",
19
19
  tableNameCellIconInline: "_tableNameCellIconInline_1sntd_70",
20
20
  iconCell: "_iconCell_1sntd_74"
21
- }, p = ({ areSelectionCheckboxesDisabled: p, columns: m, iconColumnVariant: h, item: g, itemActionMenuProps: _, onTableRowClick: v, shouldRenderActionColumn: y, zoomLevel: b = 0 }) => /* @__PURE__ */ c(a, {
22
- className: u(f.tableRow, { [f.isClickable]: v }),
23
- id: g.id,
24
- onAction: () => v?.(g),
21
+ }, p = ({ areSelectionCheckboxesDisabled: p, columns: m, dataTargetPrefix: h, iconColumnVariant: g, item: _, itemActionMenuProps: v, onTableRowClick: y, shouldRenderActionColumn: b, zoomLevel: x = 0 }) => /* @__PURE__ */ c(a, {
22
+ className: u(f.tableRow, { [f.isClickable]: y }),
23
+ "data-target-id": h ? `${h}-itemRow-${_.id}` : void 0,
24
+ id: _.id,
25
+ onAction: () => y?.(_),
25
26
  children: [
26
- h === e.COLUMN ? /* @__PURE__ */ s(i, {
27
- style: { height: n[b] },
27
+ g === e.COLUMN ? /* @__PURE__ */ s(i, {
28
+ style: { height: n[x] },
28
29
  children: /* @__PURE__ */ s(l, {
29
30
  className: f.iconCell,
30
- item: g
31
+ item: _
31
32
  })
32
- }, `item-type-icon-${g.id}`) : null,
33
+ }, `item-type-icon-${_.id}`) : null,
33
34
  m.map((t) => {
34
- let { cellRenderer: n, id: r, isItemMetadata: a, subtitle: p, textValue: m, type: _ } = t, v = `${m}-${g.id}`;
35
- if (n) return /* @__PURE__ */ s(i, { children: n(g, t) }, v);
36
- let y = d(g, a ? r.split(".")[1] : r);
37
- if (r === "name" && (h === e.INLINE || h === e.INLINE_SUBTITLE)) return /* @__PURE__ */ s(i, { children: /* @__PURE__ */ c("div", {
35
+ let { cellRenderer: n, id: r, isItemMetadata: a, subtitle: p, textValue: m, type: h } = t, v = `${m}-${_.id}`;
36
+ if (n) return /* @__PURE__ */ s(i, { children: n(_, t) }, v);
37
+ let y = d(_, a ? r.split(".")[1] : r);
38
+ if (r === "name" && (g === e.INLINE || g === e.INLINE_SUBTITLE)) return /* @__PURE__ */ s(i, { children: /* @__PURE__ */ c("div", {
38
39
  className: f.tableNameCell,
39
- children: [/* @__PURE__ */ s(l, { item: g }), /* @__PURE__ */ c("div", {
40
- className: u(f.tableNameCellTitle, { [f.hasSubtitle]: h === e.INLINE_SUBTITLE }),
40
+ children: [/* @__PURE__ */ s(l, { item: _ }), /* @__PURE__ */ c("div", {
41
+ className: u(f.tableNameCellTitle, { [f.hasSubtitle]: g === e.INLINE_SUBTITLE }),
41
42
  children: [/* @__PURE__ */ s(o, {
42
43
  as: "span",
43
44
  className: f.tableNameCellText,
44
45
  children: y
45
- }), h === e.INLINE_SUBTITLE ? /* @__PURE__ */ s(o, {
46
+ }), g === e.INLINE_SUBTITLE ? /* @__PURE__ */ s(o, {
46
47
  as: "span",
47
48
  className: f.tableNameCellText,
48
49
  color: "textOnLightSecondary",
@@ -50,8 +51,8 @@ import '../styles/table-row.css';var f = {
50
51
  }) : null]
51
52
  })]
52
53
  }) }, v);
53
- if (_ === "multiSelect") {
54
- let e = d(g, r);
54
+ if (h === "multiSelect") {
55
+ let e = d(_, r);
55
56
  return /* @__PURE__ */ s(i, { children: e ? e.join(" ") : "" }, v);
56
57
  }
57
58
  return /* @__PURE__ */ s(i, { children: /* @__PURE__ */ s(o, {
@@ -59,14 +60,14 @@ import '../styles/table-row.css';var f = {
59
60
  children: y
60
61
  }) }, v);
61
62
  }),
62
- y && /* @__PURE__ */ s(r, {
63
+ b && /* @__PURE__ */ s(r, {
63
64
  isCheckboxDisabled: p,
64
- children: (e) => _ ? /* @__PURE__ */ s(t, {
65
- ..._,
66
- item: g,
65
+ children: (e) => v ? /* @__PURE__ */ s(t, {
66
+ ...v,
67
+ item: _,
67
68
  onOpenChange: e
68
69
  }) : null
69
70
  })
70
71
  ]
71
- }, g.id);
72
+ }, _.id);
72
73
  export { f as n, p as t };
@@ -9,24 +9,25 @@ import { useIntl as c } from "react-intl";
9
9
  import { useFormikContext as l } from "formik";
10
10
  import { Filter as u } from "@box/blueprint-web-assets/icons/Line";
11
11
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
12
- var m = ({ containerRef: m, filterGroups: h, onAllFiltersClick: g }) => {
13
- let { formatMessage: _ } = c(), { values: v } = l(), [y, b] = s(!1), x = () => g ? g() : b(!0), S = o(() => Object.values(v.metadata.fields).filter((e) => n(e.value)).length, [v.metadata.fields]);
14
- return /* @__PURE__ */ p(d, { children: [y && /* @__PURE__ */ f(e, {
12
+ var m = ({ containerRef: m, dataTargetPrefix: h, filterGroups: g, onAllFiltersClick: _ }) => {
13
+ let { formatMessage: v } = c(), { values: y } = l(), [b, x] = s(!1), S = () => _ ? _() : x(!0), C = o(() => Object.values(y.metadata.fields).filter((e) => n(e.value)).length, [y.metadata.fields]);
14
+ return /* @__PURE__ */ p(d, { children: [b && /* @__PURE__ */ f(e, {
15
15
  containerRef: m,
16
- filterGroups: h,
17
- getInitialFormValues: () => t(h.flatMap(({ filters: e }) => e)),
18
- isOpen: y,
19
- onIsOpenChange: b
16
+ filterGroups: g,
17
+ getInitialFormValues: () => t(g.flatMap(({ filters: e }) => e)),
18
+ isOpen: b,
19
+ onIsOpenChange: x
20
20
  }), /* @__PURE__ */ p(a.ChipButton, {
21
- onClick: x,
21
+ "data-target-id": h ? `${h}-allFilters` : void 0,
22
+ onClick: S,
22
23
  value: "all-filters-chip-btn",
23
24
  children: [
24
25
  /* @__PURE__ */ f(a.Icon, {
25
26
  className: i.filterChipIcon,
26
27
  icon: u
27
28
  }),
28
- /* @__PURE__ */ f(a.Label, { children: _(r.allFilters) }),
29
- S > 0 ? /* @__PURE__ */ f(a.Status, { children: S.toString() }) : null
29
+ /* @__PURE__ */ f(a.Label, { children: v(r.allFilters) }),
30
+ C > 0 ? /* @__PURE__ */ f(a.Status, { children: C.toString() }) : null
30
31
  ]
31
32
  })] });
32
33
  };
@@ -7,27 +7,28 @@ import { FilterChip as a } from "@box/blueprint-web";
7
7
  import { useMemo as o, useRef as s } from "react";
8
8
  import { Form as c, Formik as l } from "formik";
9
9
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
- var f = ({ predefinedFilterOptions: f, containerRef: p, filterGroups: m = [], initialFilterValues: h, isAllFiltersDisabled: g, onAllFiltersClick: _, onFilterSubmit: v }) => {
11
- let y = i(f), b = ({ metadata: { fields: e } }) => {
12
- v && v(e);
13
- }, x = [...y, ...m], S = x.flatMap(({ filters: e }) => e).sort((e, t) => (e.position ?? 0) - (t.position ?? 0)), C = o(() => e(S, h), [S.map((e) => `${e.id}:${e.fieldType}`).sort().join("|"), h]), w = s(null);
10
+ var f = ({ dataTargetPrefix: f, predefinedFilterOptions: p, containerRef: m, filterGroups: h = [], initialFilterValues: g, isAllFiltersDisabled: _, onAllFiltersClick: v, onFilterSubmit: y }) => {
11
+ let b = i(p), x = ({ metadata: { fields: e } }) => {
12
+ y && y(e);
13
+ }, S = [...b, ...h], C = S.flatMap(({ filters: e }) => e).sort((e, t) => (e.position ?? 0) - (t.position ?? 0)), w = o(() => e(C, g), [C.map((e) => `${e.id}:${e.fieldType}`).sort().join("|"), g]), T = s(null);
14
14
  return /* @__PURE__ */ u(l, {
15
15
  enableReinitialize: !0,
16
- initialValues: C,
17
- onSubmit: b,
16
+ initialValues: w,
17
+ onSubmit: x,
18
18
  children: /* @__PURE__ */ u(c, {
19
- ref: w,
19
+ ref: T,
20
20
  children: /* @__PURE__ */ d(a.Group, {
21
21
  className: t.filterChipGroup,
22
22
  name: "metadata-view-filters",
23
23
  type: "multiple",
24
- children: [g ? null : /* @__PURE__ */ u(n, {
25
- containerRef: p,
26
- filterGroups: x,
27
- onAllFiltersClick: _
28
- }), S.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ u(r, {
24
+ children: [_ ? null : /* @__PURE__ */ u(n, {
25
+ containerRef: m,
26
+ dataTargetPrefix: f,
27
+ filterGroups: S,
28
+ onAllFiltersClick: v
29
+ }), C.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ u(r, {
29
30
  filterOption: e,
30
- formRef: w
31
+ formRef: T
31
32
  }, e.id))]
32
33
  })
33
34
  })
@@ -9,19 +9,19 @@ import { Column as s, DataTableWrapper as c, ListCheckbox as l, TableHeader as u
9
9
  import { useRef as f } from "react";
10
10
  import { useIntl as p } from "react-intl";
11
11
  import { jsx as m, jsxs as h } from "react/jsx-runtime";
12
- var g = ({ areSelectionCheckboxesDisabled: g = !1, columns: _, hasNextPage: v = !1, iconColumnVariant: y, isInfiniteScrollEnabled: b = !1, isLoading: x = !1, isSelectAllEnabled: S, itemActionMenuProps: C, items: w, maxActionColumnWidth: T, minActionColumnWidth: E, onGetNextPage: D, onInlineEditChange: O, onTableRowClick: k, placeholderRowsCount: A, zoomLevel: j, ...M }) => {
13
- let { formatMessage: N } = p(), P = f(null), { virtualItemsToDisplay: F, totalVirtualSize: I } = n({
14
- items: w,
15
- hasNextPage: v,
16
- isLoading: x,
17
- parentRef: P,
18
- onGetNextPage: D,
19
- placeholderRowsCount: A
20
- }), L = [];
21
- if (y === e.COLUMN) {
22
- j ||= 0;
23
- let e = parseInt(t[j], 10) + 24;
24
- L.push({
12
+ var g = ({ areSelectionCheckboxesDisabled: g = !1, columns: _, dataTargetPrefix: v, hasNextPage: y = !1, iconColumnVariant: b, isInfiniteScrollEnabled: x = !1, isLoading: S = !1, isSelectAllEnabled: C, itemActionMenuProps: w, items: T, maxActionColumnWidth: E, minActionColumnWidth: D, onGetNextPage: O, onInlineEditChange: k, onTableRowClick: A, placeholderRowsCount: j, zoomLevel: M, ...N }) => {
13
+ let { formatMessage: P } = p(), F = f(null), { virtualItemsToDisplay: I, totalVirtualSize: L } = n({
14
+ items: T,
15
+ hasNextPage: y,
16
+ isLoading: S,
17
+ parentRef: F,
18
+ onGetNextPage: O,
19
+ placeholderRowsCount: j
20
+ }), R = [];
21
+ if (b === e.COLUMN) {
22
+ M ||= 0;
23
+ let e = parseInt(t[M], 10) + 24;
24
+ R.push({
25
25
  id: "item-type-icon",
26
26
  isRowHeader: !1,
27
27
  hideHeader: !1,
@@ -29,7 +29,7 @@ var g = ({ areSelectionCheckboxesDisabled: g = !1, columns: _, hasNextPage: v =
29
29
  maxWidth: e
30
30
  });
31
31
  }
32
- let R = _.map((e) => {
32
+ let z = _.map((e) => {
33
33
  let { id: t, isRowHeader: n, headerRenderer: r, textValue: i, type: a, allowsSorting: o, ...s } = e, c = a !== "multiSelect" && a !== "enum" && o === !0;
34
34
  return {
35
35
  ...s,
@@ -43,48 +43,49 @@ var g = ({ areSelectionCheckboxesDisabled: g = !1, columns: _, hasNextPage: v =
43
43
  allowsSorting: c
44
44
  };
45
45
  });
46
- L.push(...R), a(M) && L.push({
46
+ R.push(...z), a(N) && R.push({
47
47
  id: "actions",
48
48
  className: i.tableHeaderActions,
49
49
  children: /* @__PURE__ */ h("div", {
50
50
  className: i.tableHeaderActionsWrapper,
51
- children: [M.HeaderActions, S ? /* @__PURE__ */ m(l, {
52
- "aria-label": N(r.selectAll),
51
+ children: [N.HeaderActions, C ? /* @__PURE__ */ m(l, {
52
+ "aria-label": P(r.selectAll),
53
53
  className: i.selectAllCheckbox,
54
- isDisabled: x || g
54
+ isDisabled: S || g
55
55
  }) : null]
56
56
  }),
57
57
  isRowHeader: !1,
58
58
  hideHeader: !1,
59
59
  allowsSorting: !1,
60
- maxWidth: T,
61
- minWidth: E
60
+ maxWidth: E,
61
+ minWidth: D
62
62
  });
63
- let z = /* @__PURE__ */ m(u, {
64
- columns: L,
63
+ let B = /* @__PURE__ */ m(u, {
64
+ columns: R,
65
65
  children: (e) => /* @__PURE__ */ m(s, { ...e })
66
- }), B = {
67
- columnCount: L.length,
66
+ }), V = {
67
+ columnCount: R.length,
68
68
  columns: _,
69
- formatMessage: N,
70
- iconColumnVariant: y,
71
- isLoading: x,
69
+ dataTargetPrefix: v,
70
+ formatMessage: P,
71
+ iconColumnVariant: b,
72
+ isLoading: S,
72
73
  areSelectionCheckboxesDisabled: g,
73
- itemActionMenuProps: C,
74
- items: w,
75
- onInlineEditChange: O,
76
- onTableRowClick: k,
77
- tableHeader: z,
78
- tableProps: M,
79
- zoomLevel: j
74
+ itemActionMenuProps: w,
75
+ items: T,
76
+ onInlineEditChange: k,
77
+ onTableRowClick: A,
78
+ tableHeader: B,
79
+ tableProps: N,
80
+ zoomLevel: M
80
81
  };
81
- return b ? /* @__PURE__ */ m(c, {
82
- ref: P,
82
+ return x ? /* @__PURE__ */ m(c, {
83
+ ref: F,
83
84
  children: /* @__PURE__ */ m(o, {
84
- ...B,
85
- totalVirtualSize: I,
86
- virtualItems: F
85
+ ...V,
86
+ totalVirtualSize: L,
87
+ virtualItems: I
87
88
  })
88
- }) : /* @__PURE__ */ m(o, { ...B });
89
+ }) : /* @__PURE__ */ m(o, { ...V });
89
90
  };
90
91
  export { g as MetadataTable };
@@ -73,61 +73,63 @@ var v = (e, t, n) => _(e, n ? t.split(".")[1] : t), y = /* @__PURE__ */ f.memo((
73
73
  item: e,
74
74
  onOpenChange: r
75
75
  }) : null
76
- })), E = ({ areSelectionCheckboxesDisabled: t, columnCount: n, columns: i, iconColumnVariant: s, items: c, itemActionMenuProps: d, onInlineEditChange: f, onTableRowClick: h, shouldRenderActionColumn: _, virtualItems: v, totalVirtualSize: y, zoomLevel: b }) => {
77
- let x = s === e.COLUMN;
78
- if (v) {
76
+ })), E = ({ areSelectionCheckboxesDisabled: t, columnCount: n, columns: i, dataTargetPrefix: s, iconColumnVariant: c, items: d, itemActionMenuProps: f, onInlineEditChange: h, onTableRowClick: _, shouldRenderActionColumn: v, virtualItems: y, totalVirtualSize: b, zoomLevel: x }) => {
77
+ let S = c === e.COLUMN;
78
+ if (y) {
79
79
  let e = (e) => /* @__PURE__ */ p(r, {
80
80
  columnLength: n || 0,
81
81
  rowKey: `ghost-${e}`
82
82
  }), a = (e) => /* @__PURE__ */ p(o, {
83
83
  areSelectionCheckboxesDisabled: t,
84
84
  columns: i,
85
- iconColumnVariant: s,
85
+ dataTargetPrefix: s,
86
+ iconColumnVariant: c,
86
87
  item: e,
87
- itemActionMenuProps: d,
88
- onTableRowClick: h,
89
- shouldRenderActionColumn: _,
90
- zoomLevel: b
91
- }), f = () => v[0]?.start || 0, g = () => {
92
- let e = v[v.length - 1]?.end || 0;
93
- return Math.max((y || 0) - e, 0);
94
- }, x = f(), S = g();
88
+ itemActionMenuProps: f,
89
+ onTableRowClick: _,
90
+ shouldRenderActionColumn: v,
91
+ zoomLevel: x
92
+ }), h = () => y[0]?.start || 0, g = () => {
93
+ let e = y[y.length - 1]?.end || 0;
94
+ return Math.max((b || 0) - e, 0);
95
+ }, S = h(), C = g();
95
96
  return /* @__PURE__ */ m(u, { children: [
96
- !!x && /* @__PURE__ */ p(l, {
97
- isDisabled: !0,
98
- style: { height: `${x}px` }
99
- }),
100
- v.map(({ index: t }) => t >= c.length ? e(t) : a(c[t])),
101
97
  !!S && /* @__PURE__ */ p(l, {
102
98
  isDisabled: !0,
103
99
  style: { height: `${S}px` }
100
+ }),
101
+ y.map(({ index: t }) => t >= d.length ? e(t) : a(d[t])),
102
+ !!C && /* @__PURE__ */ p(l, {
103
+ isDisabled: !0,
104
+ style: { height: `${C}px` }
104
105
  })
105
106
  ] });
106
107
  }
107
108
  return /* @__PURE__ */ p(u, {
108
- items: c.map((e) => ({
109
+ items: d.map((e) => ({
109
110
  key: e.id,
110
111
  ...e
111
112
  })),
112
113
  children: (e) => /* @__PURE__ */ m(l, {
113
- className: g(a.tableRow, { [a.isClickable]: h }),
114
+ className: g(a.tableRow, { [a.isClickable]: _ }),
115
+ "data-target-id": s ? `${s}-itemRow-${e.id}` : void 0,
114
116
  id: e.id,
115
- onAction: () => h?.(e),
117
+ onAction: () => _?.(e),
116
118
  children: [
117
- x && /* @__PURE__ */ p(w, {
119
+ S && /* @__PURE__ */ p(w, {
118
120
  item: e,
119
- zoomLevel: b
121
+ zoomLevel: x
120
122
  }),
121
123
  i.map((t) => /* @__PURE__ */ p(C, {
122
124
  column: t,
123
- iconColumnVariant: s,
125
+ iconColumnVariant: c,
124
126
  item: e,
125
- onInlineEditChange: f
127
+ onInlineEditChange: h
126
128
  }, `${t.textValue}-${e.id}`)),
127
- _ && /* @__PURE__ */ p(T, {
129
+ v && /* @__PURE__ */ p(T, {
128
130
  isCheckboxDisabled: t,
129
131
  item: e,
130
- itemActionMenuProps: d
132
+ itemActionMenuProps: f
131
133
  })
132
134
  ]
133
135
  }, e.id)
@@ -5,30 +5,31 @@ import r from "./table-body/table-body-with-data.js";
5
5
  import { getShouldRenderActionColumn as i } from "./actionColumn.js";
6
6
  import { Table as a } from "@box/blueprint-web";
7
7
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
- var c = ({ columnCount: c, columns: l, formatMessage: u, iconColumnVariant: d, isLoading: f, areSelectionCheckboxesDisabled: p, itemActionMenuProps: m, items: h, onInlineEditChange: g, onTableRowClick: _, style: v, tableHeader: y, tableProps: b, virtualItems: x, totalVirtualSize: S, zoomLevel: C }) => {
9
- let w = i(b), T = c || (() => {
8
+ var c = ({ columnCount: c, columns: l, dataTargetPrefix: u, formatMessage: d, iconColumnVariant: f, isLoading: p, areSelectionCheckboxesDisabled: m, itemActionMenuProps: h, items: g, onInlineEditChange: _, onTableRowClick: v, style: y, tableHeader: b, tableProps: x, virtualItems: S, totalVirtualSize: C, zoomLevel: w }) => {
9
+ let T = i(x), E = c || (() => {
10
10
  let t = l.length;
11
- return d === e.COLUMN && (t += 1), w && (t += 1), t;
12
- })(), E = f && !x?.length;
11
+ return f === e.COLUMN && (t += 1), T && (t += 1), t;
12
+ })(), D = p && !S?.length;
13
13
  return /* @__PURE__ */ s(a, {
14
- "aria-label": u(n.listView),
14
+ "aria-label": d(n.listView),
15
15
  selectionBehavior: "toggle",
16
- style: v,
17
- ...b,
18
- children: [y, E ? /* @__PURE__ */ o(t, { columnLength: T }) : /* @__PURE__ */ o(r, {
19
- areSelectionCheckboxesDisabled: p,
20
- columnCount: T,
16
+ style: y,
17
+ ...x,
18
+ children: [b, D ? /* @__PURE__ */ o(t, { columnLength: E }) : /* @__PURE__ */ o(r, {
19
+ areSelectionCheckboxesDisabled: m,
20
+ columnCount: E,
21
21
  columns: l,
22
- iconColumnVariant: d,
23
- isLoading: f,
24
- itemActionMenuProps: m,
25
- items: h,
26
- onInlineEditChange: g,
27
- onTableRowClick: _,
28
- shouldRenderActionColumn: w,
29
- totalVirtualSize: S,
30
- virtualItems: x,
31
- zoomLevel: C
22
+ dataTargetPrefix: u,
23
+ iconColumnVariant: f,
24
+ isLoading: p,
25
+ itemActionMenuProps: h,
26
+ items: g,
27
+ onInlineEditChange: _,
28
+ onTableRowClick: v,
29
+ shouldRenderActionColumn: T,
30
+ totalVirtualSize: C,
31
+ virtualItems: S,
32
+ zoomLevel: w
32
33
  })]
33
34
  });
34
35
  };
@@ -1,8 +1,9 @@
1
1
  import { FilterGroup } from './types';
2
2
  type AllFiltersChipProps = {
3
3
  containerRef?: React.RefObject<HTMLElement>;
4
+ dataTargetPrefix?: string;
4
5
  filterGroups: Array<FilterGroup>;
5
6
  onAllFiltersClick?: () => void;
6
7
  };
7
- declare const AllFiltersChip: ({ containerRef, filterGroups, onAllFiltersClick }: AllFiltersChipProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const AllFiltersChip: ({ containerRef, dataTargetPrefix, filterGroups, onAllFiltersClick }: AllFiltersChipProps) => import("react/jsx-runtime").JSX.Element;
8
9
  export default AllFiltersChip;
@@ -1,6 +1,7 @@
1
1
  import { PredefinedFilterOptions } from './predefinedFilters/types';
2
2
  import { FilterGroup, FilterValues, InitialFilterValues } from './types';
3
3
  export interface FilterRowProps {
4
+ dataTargetPrefix?: string;
4
5
  predefinedFilterOptions?: Partial<PredefinedFilterOptions>;
5
6
  containerRef?: React.RefObject<HTMLElement>;
6
7
  filterGroups?: Array<FilterGroup>;
@@ -9,4 +10,4 @@ export interface FilterRowProps {
9
10
  onAllFiltersClick?: () => void;
10
11
  onFilterSubmit?: (fields: FilterValues) => void;
11
12
  }
12
- export declare const FilterRow: ({ predefinedFilterOptions, containerRef, filterGroups: customFilterGroups, initialFilterValues: customFilterValues, isAllFiltersDisabled, onAllFiltersClick, onFilterSubmit, }: FilterRowProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const FilterRow: ({ dataTargetPrefix, predefinedFilterOptions, containerRef, filterGroups: customFilterGroups, initialFilterValues: customFilterValues, isAllFiltersDisabled, onAllFiltersClick, onFilterSubmit, }: FilterRowProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,6 +5,7 @@ import { InlineEditingCellProps } from './table-body/inline-editing-cell';
5
5
  export interface MetadataTableProps extends TableProps, MetadataProps, Pick<InlineEditingCellProps, 'onInlineEditChange'> {
6
6
  areSelectionCheckboxesDisabled?: boolean;
7
7
  columns: Column[];
8
+ dataTargetPrefix?: string;
8
9
  hasNextPage?: boolean;
9
10
  HeaderActions?: React.ReactElement;
10
11
  iconColumnVariant?: IconColumnVariant;
@@ -17,4 +18,4 @@ export interface MetadataTableProps extends TableProps, MetadataProps, Pick<Inli
17
18
  placeholderRowsCount?: number;
18
19
  zoomLevel?: number;
19
20
  }
20
- export declare const MetadataTable: ({ areSelectionCheckboxesDisabled, columns, hasNextPage, iconColumnVariant, isInfiniteScrollEnabled, isLoading, isSelectAllEnabled, itemActionMenuProps, items, maxActionColumnWidth, minActionColumnWidth, onGetNextPage, onInlineEditChange, onTableRowClick, placeholderRowsCount, zoomLevel, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const MetadataTable: ({ areSelectionCheckboxesDisabled, columns, dataTargetPrefix, hasNextPage, iconColumnVariant, isInfiniteScrollEnabled, isLoading, isSelectAllEnabled, itemActionMenuProps, items, maxActionColumnWidth, minActionColumnWidth, onGetNextPage, onInlineEditChange, onTableRowClick, placeholderRowsCount, zoomLevel, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
@@ -16,5 +16,5 @@ type CellProps = {
16
16
  iconColumnVariant: IconColumnVariant;
17
17
  };
18
18
  export type DataCellProps = CellProps & Pick<InlineEditingCellProps, 'onInlineEditChange'>;
19
- declare const TableBodyWithData: ({ areSelectionCheckboxesDisabled, columnCount, columns, iconColumnVariant, items, itemActionMenuProps, onInlineEditChange, onTableRowClick, shouldRenderActionColumn, virtualItems, totalVirtualSize, zoomLevel, }: TableBodyWithDataProps) => import("react/jsx-runtime").JSX.Element;
19
+ declare const TableBodyWithData: ({ areSelectionCheckboxesDisabled, columnCount, columns, dataTargetPrefix, iconColumnVariant, items, itemActionMenuProps, onInlineEditChange, onTableRowClick, shouldRenderActionColumn, virtualItems, totalVirtualSize, zoomLevel, }: TableBodyWithDataProps) => import("react/jsx-runtime").JSX.Element;
20
20
  export default TableBodyWithData;
@@ -3,6 +3,7 @@ import { MetadataTableProps } from '../../metadata-table';
3
3
  export interface TableRowProps {
4
4
  areSelectionCheckboxesDisabled?: MetadataTableProps['areSelectionCheckboxesDisabled'];
5
5
  columns: MetadataTableProps['columns'];
6
+ dataTargetPrefix?: MetadataTableProps['dataTargetPrefix'];
6
7
  iconColumnVariant: MetadataTableProps['iconColumnVariant'];
7
8
  item: Item;
8
9
  itemActionMenuProps: MetadataTableProps['itemActionMenuProps'];
@@ -10,4 +11,4 @@ export interface TableRowProps {
10
11
  shouldRenderActionColumn?: boolean;
11
12
  zoomLevel?: number;
12
13
  }
13
- export declare const TableRow: ({ areSelectionCheckboxesDisabled, columns, iconColumnVariant, item, itemActionMenuProps, onTableRowClick, shouldRenderActionColumn, zoomLevel, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const TableRow: ({ areSelectionCheckboxesDisabled, columns, dataTargetPrefix, iconColumnVariant, item, itemActionMenuProps, onTableRowClick, shouldRenderActionColumn, zoomLevel, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
@@ -7,6 +7,7 @@ import { InlineEditingCellProps } from './table-body/inline-editing-cell';
7
7
  export interface TableRendererProps extends Pick<InlineEditingCellProps, 'onInlineEditChange'> {
8
8
  columns: Column[];
9
9
  columnCount?: number;
10
+ dataTargetPrefix?: string;
10
11
  formatMessage: ReturnType<typeof useIntl>['formatMessage'];
11
12
  iconColumnVariant?: IconColumnVariant;
12
13
  isLoading?: boolean;
@@ -21,4 +22,4 @@ export interface TableRendererProps extends Pick<InlineEditingCellProps, 'onInli
21
22
  totalVirtualSize?: number;
22
23
  zoomLevel?: number;
23
24
  }
24
- export declare const TableRenderer: ({ columnCount: passedColumnCount, columns, formatMessage, iconColumnVariant, isLoading, areSelectionCheckboxesDisabled, itemActionMenuProps, items, onInlineEditChange, onTableRowClick, style, tableHeader, tableProps, virtualItems, totalVirtualSize, zoomLevel, }: TableRendererProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const TableRenderer: ({ columnCount: passedColumnCount, columns, dataTargetPrefix, formatMessage, iconColumnVariant, isLoading, areSelectionCheckboxesDisabled, itemActionMenuProps, items, onInlineEditChange, onTableRowClick, style, tableHeader, tableProps, virtualItems, totalVirtualSize, zoomLevel, }: TableRendererProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import { MetadataViewProps } from './types';
2
- export declare function MetadataView({ actionBarProps, columns, tableProps, hasError, headerProps, onRefresh, onSelectionChange, onViewModeChange, selectedKeys, initialViewMode, paginationProps, isLoading, isSelectAllEnabled, isSelectionEnabled, areSelectionCheckboxesDisabled, ...rest }: MetadataViewProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function MetadataView({ actionBarProps, columns, dataTargetPrefix, tableProps, hasError, headerProps, onRefresh, onSelectionChange, onViewModeChange, selectedKeys, initialViewMode, paginationProps, isLoading, isSelectAllEnabled, isSelectionEnabled, areSelectionCheckboxesDisabled, ...rest }: MetadataViewProps): import("react/jsx-runtime").JSX.Element;
3
3
  export default MetadataView;
@@ -60,7 +60,8 @@ export declare enum ViewMode {
60
60
  LIST = "list"
61
61
  }
62
62
  export interface MetadataViewProps extends MetadataProps {
63
- actionBarProps?: Omit<ActionBarProps, 'onViewModeClick' | 'onZoomLevelChange' | 'viewMode'>;
63
+ actionBarProps?: Omit<ActionBarProps, 'dataTargetPrefix' | 'onViewModeClick' | 'onZoomLevelChange' | 'viewMode'>;
64
+ dataTargetPrefix?: string;
64
65
  columns: Column[];
65
66
  hasError?: boolean;
66
67
  initialViewMode?: ViewMode;
@@ -71,7 +72,7 @@ export interface MetadataViewProps extends MetadataProps {
71
72
  isSelectAllEnabled?: boolean;
72
73
  isSelectionEnabled?: boolean;
73
74
  areSelectionCheckboxesDisabled?: boolean;
74
- tableProps?: Omit<MetadataTableProps, 'columns' | 'isSelectAllEnabled' | 'items' | 'itemActionMenuProps' | 'onSelectionChange' | 'selectedKeys'>;
75
+ tableProps?: Omit<MetadataTableProps, 'columns' | 'dataTargetPrefix' | 'isSelectAllEnabled' | 'items' | 'itemActionMenuProps' | 'onSelectionChange' | 'selectedKeys'>;
75
76
  paginationProps?: PaginationProps;
76
77
  headerProps?: HeaderProps;
77
78
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "1.57.7",
3
+ "version": "1.58.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
- "@box/blueprint-web": "^14.30.3",
7
- "@box/blueprint-web-assets": "^4.118.1",
8
- "@box/box-item-type-selector": "^1.41.7",
9
- "@box/content-field": "^1.42.7",
10
- "@box/item-icon": "^2.35.7",
11
- "@box/metadata-filter": "^1.83.7",
6
+ "@box/blueprint-web": "^14.30.4",
7
+ "@box/blueprint-web-assets": "^4.118.2",
8
+ "@box/box-item-type-selector": "^1.41.8",
9
+ "@box/content-field": "^1.42.8",
10
+ "@box/item-icon": "^2.35.8",
11
+ "@box/metadata-filter": "^1.83.8",
12
12
  "@box/types": "2.2.1",
13
13
  "@tanstack/react-virtual": "^3.10.8",
14
14
  "formik": "^2.4.5",
@@ -19,14 +19,14 @@
19
19
  "react-intl": "^6.4.2"
20
20
  },
21
21
  "devDependencies": {
22
- "@box/blueprint-web": "^14.30.3",
23
- "@box/blueprint-web-assets": "^4.118.1",
24
- "@box/box-item-type-selector": "^1.41.7",
25
- "@box/content-field": "^1.42.7",
22
+ "@box/blueprint-web": "^14.30.4",
23
+ "@box/blueprint-web-assets": "^4.118.2",
24
+ "@box/box-item-type-selector": "^1.41.8",
25
+ "@box/content-field": "^1.42.8",
26
26
  "@box/eslint-plugin-blueprint": "1.2.1",
27
- "@box/item-icon": "^2.35.7",
28
- "@box/metadata-filter": "^1.83.7",
29
- "@box/storybook-utils": "0.19.5",
27
+ "@box/item-icon": "^2.35.8",
28
+ "@box/metadata-filter": "^1.83.8",
29
+ "@box/storybook-utils": "0.19.6",
30
30
  "@box/types": "2.2.1",
31
31
  "@tanstack/react-virtual": "^3.10.8",
32
32
  "react-intl": "^6.4.2"