@box/metadata-view 1.26.1 → 1.28.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 +41 -41
- package/dist/chunks/types.js +3 -3
- package/dist/esm/lib/components/filter-row/initial-field-values.js +12 -13
- package/dist/esm/lib/components/filter-row/metadata-filter-chip.js +1 -0
- package/dist/esm/lib/components/filter-row/predefinedFilters/index.js +2 -2
- package/dist/esm/lib/components/filter-row/select-filter-chip.js +39 -40
- package/dist/esm/lib/components/filter-sidepanel/filter-side-panel.js +36 -36
- package/dist/esm/lib/components/filter-sidepanel/filter.js +7 -4
- package/dist/esm/lib/components/item-action-menu/item-action-menu.js +103 -103
- package/dist/esm/lib/components/metadata-grid/metadata-grid.js +29 -30
- package/dist/esm/lib/components/metadata-table/actionColumn.js +3 -3
- package/dist/esm/lib/components/metadata-table/hooks/useInfiniteScrollTableItems.js +13 -16
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +140 -144
- package/dist/esm/lib/components/metadata-table/table-renderer.js +35 -35
- package/dist/esm/lib/components/metadata-value/metadata-checkbox-field.js +14 -15
- package/dist/esm/lib/components/metadata-value/metadata-file-chip.js +13 -14
- package/dist/esm/lib/components/metadata-value/metadata-file-field.js +12 -13
- package/dist/esm/lib/components/metadata-value/metadata-location-field.js +31 -32
- package/dist/esm/lib/components/metadata-value/metadata-radio-field.js +10 -11
- package/dist/esm/lib/components/metadata-value/metadata-search-field.js +22 -23
- package/dist/esm/lib/components/sort-dropdown/sort-dropdown.js +35 -35
- package/dist/esm/lib/metadata-view.js +59 -59
- package/dist/i18n/en-x-pseudo.js +31 -31
- package/dist/i18n/en-x-pseudo.properties +31 -31
- package/dist/styles/action-bar.css +1 -1
- package/package.json +12 -12
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import { IconButton as
|
|
4
|
-
import { Ellipsis as
|
|
5
|
-
import { V as
|
|
6
|
-
import { getDataTargetId as
|
|
7
|
-
import
|
|
8
|
-
import { jsxs as
|
|
9
|
-
import '../../../../styles/item-action-menu.css';const
|
|
10
|
-
tableActionBar:
|
|
11
|
-
actionItemIcon:
|
|
1
|
+
import x, { useMemo as N } from "react";
|
|
2
|
+
import { useIntl as j } from "react-intl";
|
|
3
|
+
import { IconButton as p, Tooltip as y, DropdownMenu as e, GridList as I } from "@box/blueprint-web";
|
|
4
|
+
import { Ellipsis as T } from "@box/blueprint-web-assets/icons/Fill";
|
|
5
|
+
import { V as b } from "../../../../chunks/types.js";
|
|
6
|
+
import { getDataTargetId as r } from "./identifier.js";
|
|
7
|
+
import _ from "./messages.js";
|
|
8
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
9
|
+
import '../../../../styles/item-action-menu.css';const z = "_tableActionBar_akgtp_1", G = "_actionItemIcon_akgtp_6", A = {
|
|
10
|
+
tableActionBar: z,
|
|
11
|
+
actionItemIcon: G
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
return (
|
|
15
|
-
|
|
13
|
+
function R(a) {
|
|
14
|
+
return (i) => {
|
|
15
|
+
i.stopPropagation(), a();
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
item:
|
|
20
|
-
label:
|
|
21
|
-
onClick:
|
|
22
|
-
icon:
|
|
18
|
+
function L({
|
|
19
|
+
item: a,
|
|
20
|
+
label: i,
|
|
21
|
+
onClick: s,
|
|
22
|
+
icon: n,
|
|
23
23
|
isDisabled: d
|
|
24
24
|
}) {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
}),
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
"data-target-id":
|
|
30
|
-
disabled:
|
|
31
|
-
onClick:
|
|
32
|
-
children: [/* @__PURE__ */ n
|
|
33
|
-
className:
|
|
34
|
-
}),
|
|
35
|
-
},
|
|
25
|
+
const u = R(() => {
|
|
26
|
+
s(a);
|
|
27
|
+
}), m = N(() => d?.(a) ?? !1, [d, a]);
|
|
28
|
+
return /* @__PURE__ */ l(e.Item, {
|
|
29
|
+
"data-target-id": r(e.Item, i),
|
|
30
|
+
disabled: m,
|
|
31
|
+
onClick: u,
|
|
32
|
+
children: [/* @__PURE__ */ t(n, {
|
|
33
|
+
className: A.actionItemIcon
|
|
34
|
+
}), i]
|
|
35
|
+
}, i);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
actions:
|
|
39
|
-
inlineActions:
|
|
40
|
-
isDisabled:
|
|
41
|
-
item:
|
|
37
|
+
function K({
|
|
38
|
+
actions: a,
|
|
39
|
+
inlineActions: i,
|
|
40
|
+
isDisabled: s,
|
|
41
|
+
item: n,
|
|
42
42
|
onOpenChange: d,
|
|
43
|
-
subMenuActions:
|
|
44
|
-
subMenuTrigger:
|
|
45
|
-
viewMode:
|
|
43
|
+
subMenuActions: u,
|
|
44
|
+
subMenuTrigger: m,
|
|
45
|
+
viewMode: g = b.LIST
|
|
46
46
|
}) {
|
|
47
47
|
const {
|
|
48
|
-
formatMessage:
|
|
49
|
-
} =
|
|
50
|
-
label:
|
|
51
|
-
icon:
|
|
52
|
-
} =
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
className:
|
|
55
|
-
children: [
|
|
56
|
-
onClick:
|
|
57
|
-
label:
|
|
58
|
-
icon:
|
|
59
|
-
isDisabled:
|
|
60
|
-
getTooltipContent:
|
|
48
|
+
formatMessage: B
|
|
49
|
+
} = j(), {
|
|
50
|
+
label: W,
|
|
51
|
+
icon: S
|
|
52
|
+
} = m || {};
|
|
53
|
+
return /* @__PURE__ */ l("div", {
|
|
54
|
+
className: A.tableActionBar,
|
|
55
|
+
children: [g === b.LIST && i?.map(({
|
|
56
|
+
onClick: o,
|
|
57
|
+
label: c,
|
|
58
|
+
icon: f,
|
|
59
|
+
isDisabled: h,
|
|
60
|
+
getTooltipContent: $
|
|
61
61
|
}) => {
|
|
62
|
-
const
|
|
63
|
-
accessibleWhenDisabled: C && !!
|
|
64
|
-
"aria-label":
|
|
65
|
-
"data-target-id":
|
|
62
|
+
const M = $?.(n), k = `${n.id}-${c}`, C = h?.(n) ?? !1, D = /* @__PURE__ */ t(p, {
|
|
63
|
+
accessibleWhenDisabled: C && !!M || void 0,
|
|
64
|
+
"aria-label": c,
|
|
65
|
+
"data-target-id": r(p, c),
|
|
66
66
|
disabled: C,
|
|
67
|
-
icon:
|
|
68
|
-
onClick:
|
|
67
|
+
icon: f,
|
|
68
|
+
onClick: R(() => o(n)),
|
|
69
69
|
size: "large"
|
|
70
70
|
});
|
|
71
|
-
return
|
|
72
|
-
content:
|
|
73
|
-
children:
|
|
74
|
-
},
|
|
75
|
-
children:
|
|
76
|
-
},
|
|
77
|
-
})
|
|
71
|
+
return M ? /* @__PURE__ */ t(y, {
|
|
72
|
+
content: M,
|
|
73
|
+
children: D
|
|
74
|
+
}, k) : /* @__PURE__ */ t(x.Fragment, {
|
|
75
|
+
children: D
|
|
76
|
+
}, k);
|
|
77
|
+
}), a ? /* @__PURE__ */ l(e.Root, {
|
|
78
78
|
onOpenChange: d,
|
|
79
|
-
children: [/* @__PURE__ */
|
|
80
|
-
children:
|
|
81
|
-
"aria-label":
|
|
82
|
-
"data-target-id":
|
|
83
|
-
disabled:
|
|
84
|
-
icon:
|
|
79
|
+
children: [/* @__PURE__ */ t(e.Trigger, {
|
|
80
|
+
children: g === b.LIST ? /* @__PURE__ */ t(p, {
|
|
81
|
+
"aria-label": B(_.actionMenu),
|
|
82
|
+
"data-target-id": r(p, "openActionMenu"),
|
|
83
|
+
disabled: s,
|
|
84
|
+
icon: T,
|
|
85
85
|
size: "large"
|
|
86
|
-
}) : /* @__PURE__ */
|
|
87
|
-
"aria-label":
|
|
88
|
-
"data-target-id":
|
|
89
|
-
disabled:
|
|
90
|
-
icon:
|
|
86
|
+
}) : /* @__PURE__ */ t(I.ActionIconButton, {
|
|
87
|
+
"aria-label": B(_.actionMenu),
|
|
88
|
+
"data-target-id": r(I.ActionIconButton, "openActionMenu"),
|
|
89
|
+
disabled: s,
|
|
90
|
+
icon: T
|
|
91
91
|
})
|
|
92
|
-
}), /* @__PURE__ */
|
|
92
|
+
}), /* @__PURE__ */ l(e.Content, {
|
|
93
93
|
align: "start",
|
|
94
|
-
children: [
|
|
95
|
-
item:
|
|
96
|
-
...
|
|
97
|
-
},
|
|
98
|
-
children: [/* @__PURE__ */
|
|
99
|
-
"data-target-id":
|
|
100
|
-
children: [
|
|
101
|
-
className:
|
|
102
|
-
}),
|
|
103
|
-
}), /* @__PURE__ */
|
|
104
|
-
children:
|
|
105
|
-
item:
|
|
106
|
-
...
|
|
107
|
-
},
|
|
94
|
+
children: [a.map((o) => /* @__PURE__ */ t(L, {
|
|
95
|
+
item: n,
|
|
96
|
+
...o
|
|
97
|
+
}, o.label)), u && m && /* @__PURE__ */ l(e.SubMenuRoot, {
|
|
98
|
+
children: [/* @__PURE__ */ l(e.SubMenuTrigger, {
|
|
99
|
+
"data-target-id": r(e.SubMenuTrigger, "openActionSubmenu"),
|
|
100
|
+
children: [S && /* @__PURE__ */ t(S, {
|
|
101
|
+
className: A.actionItemIcon
|
|
102
|
+
}), W]
|
|
103
|
+
}), /* @__PURE__ */ t(e.SubMenuContent, {
|
|
104
|
+
children: u.map((o) => /* @__PURE__ */ t(L, {
|
|
105
|
+
item: n,
|
|
106
|
+
...o
|
|
107
|
+
}, o.label))
|
|
108
108
|
})]
|
|
109
109
|
})]
|
|
110
110
|
})]
|
|
111
|
-
}) : null,
|
|
112
|
-
onClick:
|
|
113
|
-
label:
|
|
114
|
-
icon:
|
|
115
|
-
isDisabled:
|
|
116
|
-
}) => /* @__PURE__ */
|
|
117
|
-
"aria-label":
|
|
118
|
-
"data-target-id":
|
|
119
|
-
disabled: (
|
|
120
|
-
icon:
|
|
121
|
-
onClick: () =>
|
|
122
|
-
}, `${
|
|
111
|
+
}) : null, g === b.GRID && i?.map(({
|
|
112
|
+
onClick: o,
|
|
113
|
+
label: c,
|
|
114
|
+
icon: f,
|
|
115
|
+
isDisabled: h
|
|
116
|
+
}) => /* @__PURE__ */ t(I.ActionIconButton, {
|
|
117
|
+
"aria-label": c,
|
|
118
|
+
"data-target-id": r(I.ActionIconButton, c),
|
|
119
|
+
disabled: h?.(n) ?? !1,
|
|
120
|
+
icon: f,
|
|
121
|
+
onClick: () => o(n)
|
|
122
|
+
}, `${n.id}-${c}`))]
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
export {
|
|
126
|
-
|
|
126
|
+
K as ItemActionMenu
|
|
127
127
|
};
|
|
@@ -1,57 +1,56 @@
|
|
|
1
1
|
import { GridList as i } from "@box/blueprint-web";
|
|
2
|
-
import { ItemTypeIcon as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { V as
|
|
5
|
-
import { THUMBNAIL_GRID_VIEW_SIZES as
|
|
6
|
-
import
|
|
7
|
-
import { jsx as t, jsxs as
|
|
8
|
-
import { ItemActionMenu as
|
|
9
|
-
import '../../../../styles/metadata-grid.css';const
|
|
10
|
-
itemThumbnail:
|
|
11
|
-
},
|
|
2
|
+
import { ItemTypeIcon as u } from "@box/item-icon";
|
|
3
|
+
import { useIntl as I } from "react-intl";
|
|
4
|
+
import { V as h } from "../../../../chunks/types.js";
|
|
5
|
+
import { THUMBNAIL_GRID_VIEW_SIZES as T } from "../constants.js";
|
|
6
|
+
import b from "./messages.js";
|
|
7
|
+
import { jsx as t, jsxs as E } from "react/jsx-runtime";
|
|
8
|
+
import { ItemActionMenu as p } from "../item-action-menu/item-action-menu.js";
|
|
9
|
+
import '../../../../styles/metadata-grid.css';const R = "_itemThumbnail_93ess_1", f = {
|
|
10
|
+
itemThumbnail: R
|
|
11
|
+
}, L = 188, M = 250, A = 8, G = 5, g = (r) => L + M * (A - r) / G, O = ({
|
|
12
12
|
items: r,
|
|
13
13
|
itemActionMenuProps: n,
|
|
14
|
-
zoomLevel:
|
|
15
|
-
areSelectionCheckboxesDisabled:
|
|
16
|
-
...
|
|
14
|
+
zoomLevel: o,
|
|
15
|
+
areSelectionCheckboxesDisabled: l,
|
|
16
|
+
...a
|
|
17
17
|
}) => {
|
|
18
18
|
const {
|
|
19
|
-
formatMessage:
|
|
20
|
-
} =
|
|
19
|
+
formatMessage: c
|
|
20
|
+
} = I();
|
|
21
21
|
return /* @__PURE__ */ t(i, {
|
|
22
|
-
"aria-label":
|
|
22
|
+
"aria-label": c(b.gridView),
|
|
23
23
|
items: r,
|
|
24
24
|
style: {
|
|
25
|
-
gridTemplateColumns: `repeat(auto-fit, minmax(${
|
|
25
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(${g(T[o])}px, 1fr))`
|
|
26
26
|
},
|
|
27
|
-
...
|
|
27
|
+
...a,
|
|
28
28
|
children: (e) => {
|
|
29
|
-
var o, l, a;
|
|
30
29
|
const {
|
|
31
30
|
name: m,
|
|
32
|
-
createdAt:
|
|
33
|
-
} = e, s = "thumbnailURLs" in e ?
|
|
34
|
-
return /* @__PURE__ */
|
|
31
|
+
createdAt: _
|
|
32
|
+
} = e, s = "thumbnailURLs" in e ? e.thumbnailURLs?.large || e.thumbnailURLs?.medium || e.thumbnailURLs?.small : void 0;
|
|
33
|
+
return /* @__PURE__ */ E(i.Item, {
|
|
35
34
|
textValue: m,
|
|
36
35
|
children: [/* @__PURE__ */ t(i.Thumbnail, {
|
|
37
|
-
className:
|
|
36
|
+
className: f.itemThumbnail,
|
|
38
37
|
children: s ? /* @__PURE__ */ t("img", {
|
|
39
38
|
alt: m,
|
|
40
39
|
src: s
|
|
41
|
-
}) : /* @__PURE__ */ t(
|
|
40
|
+
}) : /* @__PURE__ */ t(u, {
|
|
42
41
|
item: e
|
|
43
42
|
})
|
|
44
43
|
}), /* @__PURE__ */ t(i.Header, {
|
|
45
44
|
children: m
|
|
46
45
|
}), /* @__PURE__ */ t(i.Subtitle, {
|
|
47
|
-
children:
|
|
46
|
+
children: _
|
|
48
47
|
}), /* @__PURE__ */ t(i.Actions, {
|
|
49
|
-
isSelectionCheckboxDisabled:
|
|
50
|
-
children: n ? (
|
|
48
|
+
isSelectionCheckboxDisabled: l,
|
|
49
|
+
children: n ? (d) => /* @__PURE__ */ t(p, {
|
|
51
50
|
...n,
|
|
52
51
|
item: e,
|
|
53
|
-
onOpenChange:
|
|
54
|
-
viewMode:
|
|
52
|
+
onOpenChange: d,
|
|
53
|
+
viewMode: h.GRID
|
|
55
54
|
}) : null
|
|
56
55
|
})]
|
|
57
56
|
});
|
|
@@ -59,5 +58,5 @@ import '../../../../styles/metadata-grid.css';const M = "_itemThumbnail_93ess_1"
|
|
|
59
58
|
});
|
|
60
59
|
};
|
|
61
60
|
export {
|
|
62
|
-
|
|
61
|
+
O as MetadataGrid
|
|
63
62
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function e
|
|
2
|
-
return !!
|
|
1
|
+
function n(e) {
|
|
2
|
+
return !!e.HeaderActions || e?.selectionMode && e.selectionMode !== "none";
|
|
3
3
|
}
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
n as getShouldRenderActionColumn
|
|
6
6
|
};
|
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useVirtualizer as
|
|
3
|
-
import { Size14 as
|
|
4
|
-
const
|
|
1
|
+
import { useRef as g, useMemo as S, useEffect as h } from "react";
|
|
2
|
+
import { useVirtualizer as z } from "@tanstack/react-virtual";
|
|
3
|
+
import { Size14 as T } from "@box/blueprint-web-assets/tokens/px-tokens";
|
|
4
|
+
const p = parseInt(T, 10), K = ({
|
|
5
5
|
items: t,
|
|
6
6
|
hasNextPage: e = !1,
|
|
7
7
|
isLoading: r = !1,
|
|
8
8
|
parentRef: l,
|
|
9
|
-
approximateRowHeight:
|
|
9
|
+
approximateRowHeight: m = p,
|
|
10
10
|
onGetNextPage: o,
|
|
11
11
|
placeholderRowsCount: c = 20
|
|
12
12
|
}) => {
|
|
13
|
-
const s =
|
|
14
|
-
count:
|
|
13
|
+
const s = g(0), a = S(() => t.length + (r || e ? c : 0), [t, e, r, c]), u = z({
|
|
14
|
+
count: a,
|
|
15
15
|
getScrollElement: () => l.current,
|
|
16
|
-
getItemKey: (I) => {
|
|
17
|
-
|
|
18
|
-
return ((m = t[I]) == null ? void 0 : m.id) || `table-item-${I}`;
|
|
19
|
-
},
|
|
20
|
-
estimateSize: () => a
|
|
16
|
+
getItemKey: (I) => t[I]?.id || `table-item-${I}`,
|
|
17
|
+
estimateSize: () => m
|
|
21
18
|
}), n = u.getVirtualItems();
|
|
22
|
-
|
|
19
|
+
h(() => {
|
|
23
20
|
s.current = t.length;
|
|
24
21
|
}, [t.length]), (t.length === 0 || t.length > 0 && s.current === 0) && l.current && (l.current.scrollTop = 0);
|
|
25
|
-
const i = n[n.length - 1],
|
|
26
|
-
return !r &&
|
|
22
|
+
const i = n[n.length - 1], f = !!i && i.index >= t.length - 1;
|
|
23
|
+
return !r && f && e && o && o(), {
|
|
27
24
|
totalVirtualSize: u.getTotalSize(),
|
|
28
25
|
virtualItemsToDisplay: n
|
|
29
26
|
};
|
|
30
27
|
};
|
|
31
28
|
export {
|
|
32
|
-
|
|
29
|
+
K as useInfiniteScrollTableItems
|
|
33
30
|
};
|