@box/metadata-view 1.24.1 → 1.25.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.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import T, { useMemo as j } from "react";
|
|
2
2
|
import { useIntl as y } from "react-intl";
|
|
3
|
-
import { IconButton as
|
|
4
|
-
import { Ellipsis as
|
|
5
|
-
import { V as
|
|
6
|
-
import { getDataTargetId as
|
|
3
|
+
import { IconButton as I, Tooltip as z, DropdownMenu as r, GridList as f } from "@box/blueprint-web";
|
|
4
|
+
import { Ellipsis as W } from "@box/blueprint-web-assets/icons/Fill";
|
|
5
|
+
import { V as h } from "../../../../chunks/types.js";
|
|
6
|
+
import { getDataTargetId as l } from "./identifier.js";
|
|
7
7
|
import $ from "./messages.js";
|
|
8
|
-
import { jsxs as
|
|
9
|
-
import '../../../../styles/item-action-menu.css';const G = "_tableActionBar_akgtp_1", V = "_actionItemIcon_akgtp_6",
|
|
8
|
+
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
9
|
+
import '../../../../styles/item-action-menu.css';const G = "_tableActionBar_akgtp_1", V = "_actionItemIcon_akgtp_6", g = {
|
|
10
10
|
tableActionBar: G,
|
|
11
11
|
actionItemIcon: V
|
|
12
12
|
};
|
|
@@ -18,109 +18,110 @@ function A(c) {
|
|
|
18
18
|
function x({
|
|
19
19
|
item: c,
|
|
20
20
|
label: t,
|
|
21
|
-
onClick:
|
|
22
|
-
icon:
|
|
21
|
+
onClick: m,
|
|
22
|
+
icon: o,
|
|
23
23
|
isDisabled: d
|
|
24
24
|
}) {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
}),
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
"data-target-id":
|
|
30
|
-
disabled:
|
|
31
|
-
onClick:
|
|
32
|
-
children: [/* @__PURE__ */ o
|
|
33
|
-
className:
|
|
25
|
+
const p = A(() => {
|
|
26
|
+
m(c);
|
|
27
|
+
}), s = j(() => (d == null ? void 0 : d(c)) ?? !1, [d, c]);
|
|
28
|
+
return /* @__PURE__ */ i(r.Item, {
|
|
29
|
+
"data-target-id": l(r.Item, t),
|
|
30
|
+
disabled: s,
|
|
31
|
+
onClick: p,
|
|
32
|
+
children: [/* @__PURE__ */ n(o, {
|
|
33
|
+
className: g.actionItemIcon
|
|
34
34
|
}), t]
|
|
35
35
|
}, t);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function O({
|
|
38
38
|
actions: c,
|
|
39
39
|
inlineActions: t,
|
|
40
|
-
isDisabled:
|
|
41
|
-
item:
|
|
40
|
+
isDisabled: m,
|
|
41
|
+
item: o,
|
|
42
42
|
onOpenChange: d,
|
|
43
|
-
subMenuActions:
|
|
44
|
-
subMenuTrigger:
|
|
45
|
-
viewMode:
|
|
43
|
+
subMenuActions: p,
|
|
44
|
+
subMenuTrigger: s,
|
|
45
|
+
viewMode: b = h.LIST
|
|
46
46
|
}) {
|
|
47
47
|
const {
|
|
48
|
-
formatMessage:
|
|
48
|
+
formatMessage: k
|
|
49
49
|
} = y(), {
|
|
50
50
|
label: N,
|
|
51
51
|
icon: _
|
|
52
|
-
} =
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
className:
|
|
55
|
-
children: [
|
|
56
|
-
onClick:
|
|
52
|
+
} = s || {};
|
|
53
|
+
return /* @__PURE__ */ i("div", {
|
|
54
|
+
className: g.tableActionBar,
|
|
55
|
+
children: [b === h.LIST && (t == null ? void 0 : t.map(({
|
|
56
|
+
onClick: a,
|
|
57
57
|
label: e,
|
|
58
|
-
icon:
|
|
58
|
+
icon: M,
|
|
59
59
|
isDisabled: u,
|
|
60
60
|
getTooltipContent: B
|
|
61
61
|
}) => {
|
|
62
|
-
const
|
|
62
|
+
const S = B == null ? void 0 : B(o), L = `${o.id}-${e}`, C = (u == null ? void 0 : u(o)) ?? !1, R = /* @__PURE__ */ n(I, {
|
|
63
|
+
accessibleWhenDisabled: C && !!S || void 0,
|
|
63
64
|
"aria-label": e,
|
|
64
|
-
"data-target-id":
|
|
65
|
-
disabled:
|
|
66
|
-
icon:
|
|
67
|
-
onClick: A(() =>
|
|
65
|
+
"data-target-id": l(I, e),
|
|
66
|
+
disabled: C,
|
|
67
|
+
icon: M,
|
|
68
|
+
onClick: A(() => a(o)),
|
|
68
69
|
size: "large"
|
|
69
70
|
});
|
|
70
|
-
return
|
|
71
|
-
content:
|
|
72
|
-
children:
|
|
73
|
-
}, L) : /* @__PURE__ */
|
|
74
|
-
children:
|
|
71
|
+
return S ? /* @__PURE__ */ n(z, {
|
|
72
|
+
content: S,
|
|
73
|
+
children: R
|
|
74
|
+
}, L) : /* @__PURE__ */ n(T.Fragment, {
|
|
75
|
+
children: R
|
|
75
76
|
}, L);
|
|
76
|
-
})), c ? /* @__PURE__ */
|
|
77
|
+
})), c ? /* @__PURE__ */ i(r.Root, {
|
|
77
78
|
onOpenChange: d,
|
|
78
|
-
children: [/* @__PURE__ */
|
|
79
|
-
children:
|
|
80
|
-
"aria-label":
|
|
81
|
-
"data-target-id":
|
|
82
|
-
disabled:
|
|
83
|
-
icon:
|
|
79
|
+
children: [/* @__PURE__ */ n(r.Trigger, {
|
|
80
|
+
children: b === h.LIST ? /* @__PURE__ */ n(I, {
|
|
81
|
+
"aria-label": k($.actionMenu),
|
|
82
|
+
"data-target-id": l(I, "openActionMenu"),
|
|
83
|
+
disabled: m,
|
|
84
|
+
icon: W,
|
|
84
85
|
size: "large"
|
|
85
|
-
}) : /* @__PURE__ */
|
|
86
|
-
"aria-label":
|
|
87
|
-
"data-target-id":
|
|
88
|
-
disabled:
|
|
89
|
-
icon:
|
|
86
|
+
}) : /* @__PURE__ */ n(f.ActionIconButton, {
|
|
87
|
+
"aria-label": k($.actionMenu),
|
|
88
|
+
"data-target-id": l(f.ActionIconButton, "openActionMenu"),
|
|
89
|
+
disabled: m,
|
|
90
|
+
icon: W
|
|
90
91
|
})
|
|
91
|
-
}), /* @__PURE__ */
|
|
92
|
+
}), /* @__PURE__ */ i(r.Content, {
|
|
92
93
|
align: "start",
|
|
93
|
-
children: [c.map((
|
|
94
|
-
item:
|
|
95
|
-
...
|
|
96
|
-
},
|
|
97
|
-
children: [/* @__PURE__ */
|
|
98
|
-
"data-target-id":
|
|
99
|
-
children: [_ && /* @__PURE__ */
|
|
100
|
-
className:
|
|
94
|
+
children: [c.map((a) => /* @__PURE__ */ n(x, {
|
|
95
|
+
item: o,
|
|
96
|
+
...a
|
|
97
|
+
}, a.label)), p && s && /* @__PURE__ */ i(r.SubMenuRoot, {
|
|
98
|
+
children: [/* @__PURE__ */ i(r.SubMenuTrigger, {
|
|
99
|
+
"data-target-id": l(r.SubMenuTrigger, "openActionSubmenu"),
|
|
100
|
+
children: [_ && /* @__PURE__ */ n(_, {
|
|
101
|
+
className: g.actionItemIcon
|
|
101
102
|
}), N]
|
|
102
|
-
}), /* @__PURE__ */
|
|
103
|
-
children:
|
|
104
|
-
item:
|
|
105
|
-
...
|
|
106
|
-
},
|
|
103
|
+
}), /* @__PURE__ */ n(r.SubMenuContent, {
|
|
104
|
+
children: p.map((a) => /* @__PURE__ */ n(x, {
|
|
105
|
+
item: o,
|
|
106
|
+
...a
|
|
107
|
+
}, a.label))
|
|
107
108
|
})]
|
|
108
109
|
})]
|
|
109
110
|
})]
|
|
110
|
-
}) : null,
|
|
111
|
-
onClick:
|
|
111
|
+
}) : null, b === h.GRID && (t == null ? void 0 : t.map(({
|
|
112
|
+
onClick: a,
|
|
112
113
|
label: e,
|
|
113
|
-
icon:
|
|
114
|
+
icon: M,
|
|
114
115
|
isDisabled: u
|
|
115
|
-
}) => /* @__PURE__ */
|
|
116
|
+
}) => /* @__PURE__ */ n(f.ActionIconButton, {
|
|
116
117
|
"aria-label": e,
|
|
117
|
-
"data-target-id":
|
|
118
|
-
disabled: (u == null ? void 0 : u(
|
|
119
|
-
icon:
|
|
120
|
-
onClick: () =>
|
|
121
|
-
}, `${
|
|
118
|
+
"data-target-id": l(f.ActionIconButton, e),
|
|
119
|
+
disabled: (u == null ? void 0 : u(o)) ?? !1,
|
|
120
|
+
icon: M,
|
|
121
|
+
onClick: () => a(o)
|
|
122
|
+
}, `${o.id}-${e}`)))]
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
export {
|
|
125
|
-
|
|
126
|
+
O as ItemActionMenu
|
|
126
127
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useRef as S, useMemo as h, useEffect as z } from "react";
|
|
2
|
+
import { useVirtualizer as T } from "@tanstack/react-virtual";
|
|
3
3
|
import { Size14 as p } from "@box/blueprint-web-assets/tokens/px-tokens";
|
|
4
4
|
const b = parseInt(p, 10), _ = ({
|
|
5
5
|
items: t,
|
|
@@ -10,7 +10,7 @@ const b = parseInt(p, 10), _ = ({
|
|
|
10
10
|
onGetNextPage: o,
|
|
11
11
|
placeholderRowsCount: c = 20
|
|
12
12
|
}) => {
|
|
13
|
-
const s =
|
|
13
|
+
const s = S(0), f = h(() => t.length + (r || e ? c : 0), [t, e, r, c]), u = T({
|
|
14
14
|
count: f,
|
|
15
15
|
getScrollElement: () => l.current,
|
|
16
16
|
getItemKey: (I) => {
|
|
@@ -19,7 +19,7 @@ const b = parseInt(p, 10), _ = ({
|
|
|
19
19
|
},
|
|
20
20
|
estimateSize: () => a
|
|
21
21
|
}), n = u.getVirtualItems();
|
|
22
|
-
|
|
22
|
+
z(() => {
|
|
23
23
|
s.current = t.length;
|
|
24
24
|
}, [t.length]), (t.length === 0 || t.length > 0 && s.current === 0) && l.current && (l.current.scrollTop = 0);
|
|
25
25
|
const i = n[n.length - 1], g = !!i && i.index >= t.length - 1;
|
|
@@ -10,26 +10,26 @@ import { jsxs as C, jsx as t } from "react/jsx-runtime";
|
|
|
10
10
|
import { InlineEditingCell as W } from "./inline-editing-cell/inline-editing-cell.js";
|
|
11
11
|
import { ItemActionMenu as j } from "../../item-action-menu/item-action-menu.js";
|
|
12
12
|
import { GhostTableRow as G } from "./ghost-table-row/ghost-table-row.js";
|
|
13
|
-
const S = (e, n,
|
|
14
|
-
const
|
|
15
|
-
return L(e,
|
|
13
|
+
const S = (e, n, o) => {
|
|
14
|
+
const l = o ? n.split(".")[1] : n;
|
|
15
|
+
return L(e, l);
|
|
16
16
|
}, H = /* @__PURE__ */ h.memo(({
|
|
17
17
|
column: e,
|
|
18
18
|
iconColumnVariant: n,
|
|
19
|
-
item:
|
|
19
|
+
item: o
|
|
20
20
|
}) => {
|
|
21
21
|
const {
|
|
22
|
-
id:
|
|
22
|
+
id: l,
|
|
23
23
|
isItemMetadata: a,
|
|
24
24
|
subtitle: d,
|
|
25
25
|
textValue: m
|
|
26
|
-
} = e, i = `${m}-${
|
|
26
|
+
} = e, i = `${m}-${o.id}`;
|
|
27
27
|
return /* @__PURE__ */ t(f, {
|
|
28
28
|
children: /* @__PURE__ */ C("div", {
|
|
29
29
|
className: c.tableNameCell,
|
|
30
30
|
children: [/* @__PURE__ */ t(E, {
|
|
31
31
|
className: c.tableNameCellIconInline,
|
|
32
|
-
item:
|
|
32
|
+
item: o
|
|
33
33
|
}), /* @__PURE__ */ C("div", {
|
|
34
34
|
className: D(c.tableNameCellTitle, {
|
|
35
35
|
[c.hasSubtitle]: n === p.INLINE_SUBTITLE
|
|
@@ -37,7 +37,7 @@ const S = (e, n, l) => {
|
|
|
37
37
|
children: [/* @__PURE__ */ t($, {
|
|
38
38
|
as: "span",
|
|
39
39
|
className: c.tableNameCellText,
|
|
40
|
-
children: S(
|
|
40
|
+
children: S(o, l, a)
|
|
41
41
|
}), n === p.INLINE_SUBTITLE && /* @__PURE__ */ t($, {
|
|
42
42
|
as: "span",
|
|
43
43
|
className: c.tableNameCellText,
|
|
@@ -51,39 +51,39 @@ const S = (e, n, l) => {
|
|
|
51
51
|
column: e,
|
|
52
52
|
item: n
|
|
53
53
|
}) => {
|
|
54
|
-
var
|
|
55
|
-
const
|
|
54
|
+
var l;
|
|
55
|
+
const o = `${e.textValue}-${n.id}`;
|
|
56
56
|
return /* @__PURE__ */ t(f, {
|
|
57
|
-
children: (
|
|
58
|
-
},
|
|
57
|
+
children: (l = e.cellRenderer) == null ? void 0 : l.call(e, n, e)
|
|
58
|
+
}, o);
|
|
59
59
|
}), F = /* @__PURE__ */ h.memo(({
|
|
60
60
|
column: e,
|
|
61
61
|
item: n
|
|
62
62
|
}) => {
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
children:
|
|
66
|
-
},
|
|
63
|
+
const o = `${e.textValue}-${n.id}`, l = L(n, e.id);
|
|
64
|
+
return l ? /* @__PURE__ */ t(f, {
|
|
65
|
+
children: l.join(" ")
|
|
66
|
+
}, o) : /* @__PURE__ */ t(f, {}, o);
|
|
67
67
|
}), K = /* @__PURE__ */ h.memo(({
|
|
68
68
|
column: e,
|
|
69
69
|
item: n
|
|
70
70
|
}) => {
|
|
71
71
|
const {
|
|
72
|
-
id:
|
|
73
|
-
isItemMetadata:
|
|
72
|
+
id: o,
|
|
73
|
+
isItemMetadata: l,
|
|
74
74
|
textValue: a
|
|
75
75
|
} = e, d = `${a}-${n.id}`;
|
|
76
76
|
return /* @__PURE__ */ t(f, {
|
|
77
77
|
children: /* @__PURE__ */ t($, {
|
|
78
78
|
as: "span",
|
|
79
|
-
children: S(n,
|
|
79
|
+
children: S(n, o, l)
|
|
80
80
|
})
|
|
81
81
|
}, d);
|
|
82
82
|
}), q = /* @__PURE__ */ h.memo(({
|
|
83
83
|
column: e,
|
|
84
84
|
iconColumnVariant: n,
|
|
85
|
-
item:
|
|
86
|
-
onInlineEditChange:
|
|
85
|
+
item: o,
|
|
86
|
+
onInlineEditChange: l
|
|
87
87
|
}) => {
|
|
88
88
|
const {
|
|
89
89
|
cellRenderer: a,
|
|
@@ -93,21 +93,21 @@ const S = (e, n, l) => {
|
|
|
93
93
|
} = e, N = d === "item.name" && (n === p.INLINE || n === p.INLINE_SUBTITLE);
|
|
94
94
|
return a ? /* @__PURE__ */ t(A, {
|
|
95
95
|
column: e,
|
|
96
|
-
item:
|
|
96
|
+
item: o
|
|
97
97
|
}) : N ? /* @__PURE__ */ t(H, {
|
|
98
98
|
column: e,
|
|
99
99
|
iconColumnVariant: n,
|
|
100
|
-
item:
|
|
100
|
+
item: o
|
|
101
101
|
}) : m && (i === "multiSelect" || i === "enum") ? /* @__PURE__ */ t(W, {
|
|
102
102
|
column: e,
|
|
103
|
-
item:
|
|
104
|
-
onInlineEditChange:
|
|
105
|
-
}, `${e.id}-${
|
|
103
|
+
item: o,
|
|
104
|
+
onInlineEditChange: l
|
|
105
|
+
}, `${e.id}-${o.id}`) : i === "multiSelect" ? /* @__PURE__ */ t(F, {
|
|
106
106
|
column: e,
|
|
107
|
-
item:
|
|
107
|
+
item: o
|
|
108
108
|
}) : /* @__PURE__ */ t(K, {
|
|
109
109
|
column: e,
|
|
110
|
-
item:
|
|
110
|
+
item: o
|
|
111
111
|
});
|
|
112
112
|
}), J = /* @__PURE__ */ h.memo(({
|
|
113
113
|
item: e,
|
|
@@ -123,37 +123,37 @@ const S = (e, n, l) => {
|
|
|
123
123
|
}, `item-type-icon-${e.id}`)), Q = /* @__PURE__ */ h.memo(({
|
|
124
124
|
item: e,
|
|
125
125
|
itemActionMenuProps: n,
|
|
126
|
-
isCheckboxDisabled:
|
|
126
|
+
isCheckboxDisabled: o
|
|
127
127
|
}) => /* @__PURE__ */ t(_, {
|
|
128
|
-
isCheckboxDisabled:
|
|
129
|
-
children: (
|
|
128
|
+
isCheckboxDisabled: o,
|
|
129
|
+
children: (l) => n ? /* @__PURE__ */ t(j, {
|
|
130
130
|
...n,
|
|
131
131
|
item: e,
|
|
132
|
-
onOpenChange:
|
|
132
|
+
onOpenChange: l
|
|
133
133
|
}) : null
|
|
134
134
|
})), re = ({
|
|
135
135
|
areSelectionCheckboxesDisabled: e,
|
|
136
136
|
columnCount: n,
|
|
137
|
-
columns:
|
|
138
|
-
iconColumnVariant:
|
|
137
|
+
columns: o,
|
|
138
|
+
iconColumnVariant: l,
|
|
139
139
|
items: a,
|
|
140
140
|
itemActionMenuProps: d,
|
|
141
141
|
onInlineEditChange: m,
|
|
142
142
|
onTableRowClick: i,
|
|
143
143
|
shouldRenderActionColumn: N,
|
|
144
144
|
virtualItems: I,
|
|
145
|
-
totalVirtualSize:
|
|
145
|
+
totalVirtualSize: B,
|
|
146
146
|
zoomLevel: b
|
|
147
147
|
}) => {
|
|
148
|
-
const
|
|
148
|
+
const w = l === p.COLUMN;
|
|
149
149
|
if (I) {
|
|
150
150
|
const s = (r) => /* @__PURE__ */ t(G, {
|
|
151
151
|
columnLength: n || 0,
|
|
152
152
|
rowKey: `ghost-${r}`
|
|
153
153
|
}), T = (r) => /* @__PURE__ */ t(k, {
|
|
154
154
|
areSelectionCheckboxesDisabled: e,
|
|
155
|
-
columns:
|
|
156
|
-
iconColumnVariant:
|
|
155
|
+
columns: o,
|
|
156
|
+
iconColumnVariant: l,
|
|
157
157
|
item: r,
|
|
158
158
|
itemActionMenuProps: d,
|
|
159
159
|
onTableRowClick: i,
|
|
@@ -164,7 +164,7 @@ const S = (e, n, l) => {
|
|
|
164
164
|
return (r == null ? void 0 : r.start) || 0;
|
|
165
165
|
}, M = () => {
|
|
166
166
|
const r = I[I.length - 1], O = (r == null ? void 0 : r.end) || 0;
|
|
167
|
-
return Math.max((
|
|
167
|
+
return Math.max((B || 0) - O, 0);
|
|
168
168
|
}, u = R(), g = M();
|
|
169
169
|
return /* @__PURE__ */ C(x, {
|
|
170
170
|
children: [!!u && /* @__PURE__ */ t(y, {
|
|
@@ -191,12 +191,12 @@ const S = (e, n, l) => {
|
|
|
191
191
|
className: c.tableRow,
|
|
192
192
|
id: s.id,
|
|
193
193
|
onAction: () => i(s),
|
|
194
|
-
children: [
|
|
194
|
+
children: [w && /* @__PURE__ */ t(J, {
|
|
195
195
|
item: s,
|
|
196
196
|
zoomLevel: b
|
|
197
|
-
}),
|
|
197
|
+
}), o.map((T) => /* @__PURE__ */ t(q, {
|
|
198
198
|
column: T,
|
|
199
|
-
iconColumnVariant:
|
|
199
|
+
iconColumnVariant: l,
|
|
200
200
|
item: s,
|
|
201
201
|
onInlineEditChange: m
|
|
202
202
|
}, `${T.textValue}-${s.id}`)), N && /* @__PURE__ */ t(Q, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-view",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.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.
|
|
21
|
+
"@box/blueprint-web": "^12.103.0",
|
|
22
22
|
"@box/blueprint-web-assets": "^4.85.0",
|
|
23
|
-
"@box/box-item-type-selector": "^1.14.
|
|
23
|
+
"@box/box-item-type-selector": "^1.14.2",
|
|
24
24
|
"@box/eslint-plugin-blueprint": "1.0.5",
|
|
25
|
-
"@box/item-icon": "^2.5.
|
|
26
|
-
"@box/metadata-filter": "^1.52.
|
|
25
|
+
"@box/item-icon": "^2.5.2",
|
|
26
|
+
"@box/metadata-filter": "^1.52.2",
|
|
27
27
|
"@box/storybook-utils": "0.14.22",
|
|
28
28
|
"@box/types": "2.0.0",
|
|
29
29
|
"@tanstack/react-virtual": "^3.10.8",
|