@box/metadata-view 1.23.0 → 1.24.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 +53 -54
- package/dist/esm/lib/components/metadata-table/hooks/useInfiniteScrollTableItems.js +19 -19
- package/dist/esm/lib/components/metadata-table/metadata-table.js +72 -88
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +152 -136
- package/dist/esm/lib/components/metadata-table/table-renderer.js +18 -16
- package/dist/styles/index.css +1 -1
- package/dist/types/lib/components/metadata-table/hooks/useInfiniteScrollTableItems.d.ts +1 -1
- package/dist/types/lib/components/metadata-table/table-body/table-body-with-data.d.ts +2 -1
- package/dist/types/lib/components/metadata-table/table-renderer.d.ts +2 -1
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -1,96 +1,95 @@
|
|
|
1
|
-
import { Row as
|
|
2
|
-
import
|
|
3
|
-
import { ItemTypeIcon as
|
|
4
|
-
import
|
|
5
|
-
import { I as
|
|
6
|
-
import { THUMBNAIL_LIST_VIEW_HEIGHTS as
|
|
1
|
+
import { Row as S, Cell as s, Text as i, ActionCell as q } from "@box/blueprint-web";
|
|
2
|
+
import f from "lodash/get";
|
|
3
|
+
import { ItemTypeIcon as I } from "@box/item-icon";
|
|
4
|
+
import E from "clsx";
|
|
5
|
+
import { I as n } from "./types.js";
|
|
6
|
+
import { THUMBNAIL_LIST_VIEW_HEIGHTS as H } from "../esm/lib/components/constants.js";
|
|
7
7
|
import { jsxs as b, jsx as e } from "react/jsx-runtime";
|
|
8
|
-
import { ItemActionMenu as
|
|
9
|
-
import '../styles/index.css';const
|
|
10
|
-
tableHeaderActionsWrapper:
|
|
11
|
-
tableHeaderActions:
|
|
12
|
-
tableRow:
|
|
13
|
-
selectAllCheckbox:
|
|
14
|
-
tableNameCell:
|
|
15
|
-
tableNameCellTitle:
|
|
8
|
+
import { ItemActionMenu as y } from "../esm/lib/components/item-action-menu/item-action-menu.js";
|
|
9
|
+
import '../styles/index.css';const R = "_tableHeaderActionsWrapper_gffqj_1", w = "_tableHeaderActions_gffqj_1", k = "_tableRow_gffqj_33", U = "_selectAllCheckbox_gffqj_42", B = "_tableNameCell_gffqj_47", W = "_tableNameCellTitle_gffqj_53", M = "_hasSubtitle_gffqj_57", $ = "_tableNameCellText_gffqj_62", v = "_tableNameCellIconInline_gffqj_67", O = "_iconCell_gffqj_71", t = {
|
|
10
|
+
tableHeaderActionsWrapper: R,
|
|
11
|
+
tableHeaderActions: w,
|
|
12
|
+
tableRow: k,
|
|
13
|
+
selectAllCheckbox: U,
|
|
14
|
+
tableNameCell: B,
|
|
15
|
+
tableNameCellTitle: W,
|
|
16
16
|
hasSubtitle: M,
|
|
17
17
|
tableNameCellText: $,
|
|
18
18
|
tableNameCellIconInline: v,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
columns: T,
|
|
19
|
+
iconCell: O
|
|
20
|
+
}, Y = ({
|
|
21
|
+
areSelectionCheckboxesDisabled: C,
|
|
22
|
+
columns: h,
|
|
24
23
|
iconColumnVariant: a,
|
|
25
24
|
item: l,
|
|
26
25
|
itemActionMenuProps: _,
|
|
27
26
|
onTableRowClick: p,
|
|
28
|
-
shouldRenderActionColumn:
|
|
27
|
+
shouldRenderActionColumn: T,
|
|
29
28
|
zoomLevel: x = 0
|
|
30
|
-
}) => /* @__PURE__ */ b(
|
|
29
|
+
}) => /* @__PURE__ */ b(S, {
|
|
31
30
|
className: t.tableRow,
|
|
32
31
|
id: l.id,
|
|
33
32
|
onAction: () => p(l),
|
|
34
|
-
children: [a ===
|
|
33
|
+
children: [a === n.COLUMN ? /* @__PURE__ */ e(s, {
|
|
35
34
|
style: {
|
|
36
|
-
height:
|
|
35
|
+
height: H[x]
|
|
37
36
|
},
|
|
38
|
-
children: /* @__PURE__ */ e(
|
|
37
|
+
children: /* @__PURE__ */ e(I, {
|
|
39
38
|
className: t.iconCell,
|
|
40
39
|
item: l
|
|
41
40
|
})
|
|
42
|
-
}, `item-type-icon-${l.id}`) : null,
|
|
41
|
+
}, `item-type-icon-${l.id}`) : null, h.map((c) => {
|
|
43
42
|
const {
|
|
44
43
|
cellRenderer: d,
|
|
45
|
-
id:
|
|
46
|
-
isItemMetadata:
|
|
47
|
-
subtitle:
|
|
48
|
-
textValue:
|
|
49
|
-
type:
|
|
50
|
-
} = c,
|
|
44
|
+
id: o,
|
|
45
|
+
isItemMetadata: u,
|
|
46
|
+
subtitle: g,
|
|
47
|
+
textValue: j,
|
|
48
|
+
type: A
|
|
49
|
+
} = c, r = `${j}-${l.id}`;
|
|
51
50
|
if (d)
|
|
52
|
-
return /* @__PURE__ */ e(
|
|
51
|
+
return /* @__PURE__ */ e(s, {
|
|
53
52
|
children: d(l, c)
|
|
54
|
-
},
|
|
55
|
-
const L =
|
|
56
|
-
if (
|
|
57
|
-
return /* @__PURE__ */ e(
|
|
53
|
+
}, r);
|
|
54
|
+
const L = u ? o.split(".")[1] : o, m = f(l, L);
|
|
55
|
+
if (o === "name" && (a === n.INLINE || a === n.INLINE_SUBTITLE))
|
|
56
|
+
return /* @__PURE__ */ e(s, {
|
|
58
57
|
children: /* @__PURE__ */ b("div", {
|
|
59
58
|
className: t.tableNameCell,
|
|
60
|
-
children: [/* @__PURE__ */ e(
|
|
59
|
+
children: [/* @__PURE__ */ e(I, {
|
|
61
60
|
item: l
|
|
62
61
|
}), /* @__PURE__ */ b("div", {
|
|
63
|
-
className:
|
|
64
|
-
[t.hasSubtitle]: a ===
|
|
62
|
+
className: E(t.tableNameCellTitle, {
|
|
63
|
+
[t.hasSubtitle]: a === n.INLINE_SUBTITLE
|
|
65
64
|
}),
|
|
66
|
-
children: [/* @__PURE__ */ e(
|
|
65
|
+
children: [/* @__PURE__ */ e(i, {
|
|
67
66
|
as: "span",
|
|
68
67
|
className: t.tableNameCellText,
|
|
69
68
|
children: m
|
|
70
|
-
}), a ===
|
|
69
|
+
}), a === n.INLINE_SUBTITLE ? /* @__PURE__ */ e(i, {
|
|
71
70
|
as: "span",
|
|
72
71
|
className: t.tableNameCellText,
|
|
73
72
|
color: "textOnLightSecondary",
|
|
74
|
-
children:
|
|
73
|
+
children: g
|
|
75
74
|
}) : null]
|
|
76
75
|
})]
|
|
77
76
|
})
|
|
78
|
-
},
|
|
79
|
-
if (
|
|
80
|
-
const N =
|
|
81
|
-
return /* @__PURE__ */ e(
|
|
77
|
+
}, r);
|
|
78
|
+
if (A === "multiSelect") {
|
|
79
|
+
const N = f(l, o);
|
|
80
|
+
return /* @__PURE__ */ e(s, {
|
|
82
81
|
children: N ? N.join(" ") : ""
|
|
83
|
-
},
|
|
82
|
+
}, r);
|
|
84
83
|
}
|
|
85
|
-
return /* @__PURE__ */ e(
|
|
86
|
-
children: /* @__PURE__ */ e(
|
|
84
|
+
return /* @__PURE__ */ e(s, {
|
|
85
|
+
children: /* @__PURE__ */ e(i, {
|
|
87
86
|
as: "span",
|
|
88
87
|
children: m
|
|
89
88
|
})
|
|
90
|
-
},
|
|
91
|
-
}),
|
|
92
|
-
isCheckboxDisabled:
|
|
93
|
-
children: (c) => _ ? /* @__PURE__ */ e(
|
|
89
|
+
}, r);
|
|
90
|
+
}), T && /* @__PURE__ */ e(q, {
|
|
91
|
+
isCheckboxDisabled: C,
|
|
92
|
+
children: (c) => _ ? /* @__PURE__ */ e(y, {
|
|
94
93
|
..._,
|
|
95
94
|
item: l,
|
|
96
95
|
onOpenChange: c
|
|
@@ -98,6 +97,6 @@ import '../styles/index.css';const k = "_tableHeaderActionsWrapper_1a999_1", U =
|
|
|
98
97
|
})]
|
|
99
98
|
}, l.id);
|
|
100
99
|
export {
|
|
101
|
-
|
|
100
|
+
Y as T,
|
|
102
101
|
t as s
|
|
103
102
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useVirtualizer as S } from "@tanstack/react-virtual";
|
|
2
|
+
import { useRef as h, useMemo as z, useEffect as T } from "react";
|
|
3
3
|
import { Size14 as p } from "@box/blueprint-web-assets/tokens/px-tokens";
|
|
4
|
-
const
|
|
5
|
-
items:
|
|
6
|
-
hasNextPage:
|
|
4
|
+
const b = parseInt(p, 10), _ = ({
|
|
5
|
+
items: t,
|
|
6
|
+
hasNextPage: e = !1,
|
|
7
7
|
isLoading: r = !1,
|
|
8
|
-
parentRef:
|
|
9
|
-
approximateRowHeight:
|
|
8
|
+
parentRef: l,
|
|
9
|
+
approximateRowHeight: a = b,
|
|
10
10
|
onGetNextPage: o,
|
|
11
11
|
placeholderRowsCount: c = 20
|
|
12
12
|
}) => {
|
|
13
|
-
const s = h(0), f =
|
|
13
|
+
const s = h(0), f = z(() => t.length + (r || e ? c : 0), [t, e, r, c]), u = S({
|
|
14
14
|
count: f,
|
|
15
|
-
getScrollElement: () =>
|
|
15
|
+
getScrollElement: () => l.current,
|
|
16
16
|
getItemKey: (I) => {
|
|
17
17
|
var m;
|
|
18
|
-
return ((m =
|
|
18
|
+
return ((m = t[I]) == null ? void 0 : m.id) || `table-item-${I}`;
|
|
19
19
|
},
|
|
20
|
-
estimateSize: () =>
|
|
21
|
-
}),
|
|
20
|
+
estimateSize: () => a
|
|
21
|
+
}), n = u.getVirtualItems();
|
|
22
22
|
T(() => {
|
|
23
|
-
s.current =
|
|
24
|
-
}, [
|
|
25
|
-
const i =
|
|
26
|
-
return !r &&
|
|
27
|
-
|
|
28
|
-
virtualItemsToDisplay:
|
|
23
|
+
s.current = t.length;
|
|
24
|
+
}, [t.length]), (t.length === 0 || t.length > 0 && s.current === 0) && l.current && (l.current.scrollTop = 0);
|
|
25
|
+
const i = n[n.length - 1], g = !!i && i.index >= t.length - 1;
|
|
26
|
+
return !r && g && e && o && o(), {
|
|
27
|
+
totalVirtualSize: u.getTotalSize(),
|
|
28
|
+
virtualItemsToDisplay: n
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
_ as useInfiniteScrollTableItems
|
|
33
33
|
};
|
|
@@ -1,144 +1,128 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import { Text as
|
|
4
|
-
import
|
|
5
|
-
import { useInfiniteScrollTableItems as
|
|
6
|
-
import { TableRenderer as
|
|
7
|
-
import { I as
|
|
8
|
-
import { THUMBNAIL_WIDTHS as
|
|
9
|
-
import { s } from "../../../../chunks/index.js";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { jsx as
|
|
1
|
+
import { useRef as v } from "react";
|
|
2
|
+
import { useIntl as B } from "react-intl";
|
|
3
|
+
import { Text as O, ListCheckbox as Z, DataTableWrapper as _, TableHeader as q, Column as E } 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 J } from "../../../../chunks/types.js";
|
|
8
|
+
import { THUMBNAIL_WIDTHS as K } from "../constants.js";
|
|
9
|
+
import { s as i } from "../../../../chunks/index.js";
|
|
10
|
+
import { getShouldRenderActionColumn as Q } from "./actionColumn.js";
|
|
11
|
+
import X from "./messages.js";
|
|
12
|
+
import { jsx as t, jsxs as Y } from "react/jsx-runtime";
|
|
13
13
|
import "./table-body/inline-editing-cell/inline-editing-cell.js";
|
|
14
|
-
const
|
|
14
|
+
const me = ({
|
|
15
15
|
areSelectionCheckboxesDisabled: n = !1,
|
|
16
16
|
columns: m,
|
|
17
|
-
hasNextPage:
|
|
17
|
+
hasNextPage: b = !1,
|
|
18
18
|
iconColumnVariant: d,
|
|
19
|
-
isInfiniteScrollEnabled:
|
|
20
|
-
isLoading:
|
|
19
|
+
isInfiniteScrollEnabled: T = !1,
|
|
20
|
+
isLoading: s = !1,
|
|
21
21
|
isSelectAllEnabled: W,
|
|
22
|
-
itemActionMenuProps:
|
|
22
|
+
itemActionMenuProps: x,
|
|
23
23
|
items: c,
|
|
24
|
-
maxActionColumnWidth:
|
|
25
|
-
minActionColumnWidth:
|
|
24
|
+
maxActionColumnWidth: A,
|
|
25
|
+
minActionColumnWidth: w,
|
|
26
26
|
onGetNextPage: C,
|
|
27
|
-
onInlineEditChange:
|
|
28
|
-
onTableRowClick:
|
|
29
|
-
placeholderRowsCount:
|
|
27
|
+
onInlineEditChange: S,
|
|
28
|
+
onTableRowClick: N = F,
|
|
29
|
+
placeholderRowsCount: g,
|
|
30
30
|
zoomLevel: a,
|
|
31
31
|
...l
|
|
32
32
|
}) => {
|
|
33
|
-
var H;
|
|
34
33
|
const {
|
|
35
34
|
formatMessage: f
|
|
36
|
-
} =
|
|
37
|
-
virtualItemsToDisplay:
|
|
38
|
-
|
|
39
|
-
} =
|
|
35
|
+
} = B(), p = v(null), {
|
|
36
|
+
virtualItemsToDisplay: y,
|
|
37
|
+
totalVirtualSize: D
|
|
38
|
+
} = G({
|
|
40
39
|
items: c,
|
|
41
|
-
hasNextPage:
|
|
42
|
-
isLoading:
|
|
40
|
+
hasNextPage: b,
|
|
41
|
+
isLoading: s,
|
|
43
42
|
parentRef: p,
|
|
44
43
|
onGetNextPage: C,
|
|
45
|
-
placeholderRowsCount:
|
|
46
|
-
}), r = [],
|
|
47
|
-
if (d ===
|
|
48
|
-
a = a ||
|
|
49
|
-
const
|
|
44
|
+
placeholderRowsCount: g
|
|
45
|
+
}), r = [], M = 0;
|
|
46
|
+
if (d === J.COLUMN) {
|
|
47
|
+
a = a || M;
|
|
48
|
+
const e = parseInt(K[a], 10) + 24;
|
|
50
49
|
r.push({
|
|
51
50
|
id: "item-type-icon",
|
|
52
51
|
isRowHeader: !1,
|
|
53
52
|
hideHeader: !1,
|
|
54
|
-
minWidth:
|
|
55
|
-
maxWidth:
|
|
53
|
+
minWidth: e,
|
|
54
|
+
maxWidth: e
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
|
-
const
|
|
57
|
+
const j = m.map((e) => {
|
|
59
58
|
const {
|
|
60
|
-
id:
|
|
61
|
-
isRowHeader:
|
|
62
|
-
headerRenderer:
|
|
59
|
+
id: h,
|
|
60
|
+
isRowHeader: V,
|
|
61
|
+
headerRenderer: H,
|
|
63
62
|
textValue: o,
|
|
64
|
-
type:
|
|
65
|
-
...
|
|
66
|
-
} =
|
|
63
|
+
type: I,
|
|
64
|
+
...k
|
|
65
|
+
} = e;
|
|
67
66
|
return {
|
|
68
|
-
...
|
|
69
|
-
children:
|
|
67
|
+
...k,
|
|
68
|
+
children: H ? H(o, e) : /* @__PURE__ */ t(O, {
|
|
70
69
|
as: "span",
|
|
71
70
|
children: o
|
|
72
71
|
}),
|
|
73
|
-
isRowHeader:
|
|
74
|
-
id:
|
|
72
|
+
isRowHeader: h === "name" || V,
|
|
73
|
+
id: h,
|
|
75
74
|
textValue: o,
|
|
76
|
-
allowsSorting:
|
|
75
|
+
allowsSorting: I !== "multiSelect" && I !== "enum"
|
|
77
76
|
};
|
|
78
77
|
});
|
|
79
|
-
r.push(...
|
|
78
|
+
r.push(...j), Q(l) && r.push({
|
|
80
79
|
id: "actions",
|
|
81
|
-
className:
|
|
82
|
-
children: /* @__PURE__ */
|
|
83
|
-
className:
|
|
84
|
-
children: [l.HeaderActions, W ? /* @__PURE__ */
|
|
85
|
-
"aria-label": f(
|
|
86
|
-
className:
|
|
87
|
-
isDisabled:
|
|
80
|
+
className: i.tableHeaderActions,
|
|
81
|
+
children: /* @__PURE__ */ Y("div", {
|
|
82
|
+
className: i.tableHeaderActionsWrapper,
|
|
83
|
+
children: [l.HeaderActions, W ? /* @__PURE__ */ t(Z, {
|
|
84
|
+
"aria-label": f(X.selectAll),
|
|
85
|
+
className: i.selectAllCheckbox,
|
|
86
|
+
isDisabled: s || n
|
|
88
87
|
}) : null]
|
|
89
88
|
}),
|
|
90
89
|
isRowHeader: !1,
|
|
91
90
|
hideHeader: !1,
|
|
92
91
|
allowsSorting: !1,
|
|
93
|
-
maxWidth:
|
|
94
|
-
minWidth:
|
|
92
|
+
maxWidth: A,
|
|
93
|
+
minWidth: w
|
|
95
94
|
});
|
|
96
|
-
const
|
|
95
|
+
const U = /* @__PURE__ */ t(q, {
|
|
97
96
|
columns: r,
|
|
98
|
-
children: (
|
|
99
|
-
...
|
|
97
|
+
children: (e) => /* @__PURE__ */ t(E, {
|
|
98
|
+
...e
|
|
100
99
|
})
|
|
101
100
|
}), u = {
|
|
102
101
|
columnCount: r.length,
|
|
103
102
|
columns: m,
|
|
104
103
|
formatMessage: f,
|
|
105
104
|
iconColumnVariant: d,
|
|
106
|
-
isLoading:
|
|
105
|
+
isLoading: s,
|
|
107
106
|
areSelectionCheckboxesDisabled: n,
|
|
108
|
-
itemActionMenuProps:
|
|
107
|
+
itemActionMenuProps: x,
|
|
109
108
|
items: c,
|
|
110
|
-
onInlineEditChange:
|
|
111
|
-
onTableRowClick:
|
|
112
|
-
tableHeader:
|
|
109
|
+
onInlineEditChange: S,
|
|
110
|
+
onTableRowClick: N,
|
|
111
|
+
tableHeader: U,
|
|
113
112
|
tableProps: l,
|
|
114
113
|
zoomLevel: a
|
|
115
114
|
};
|
|
116
|
-
return
|
|
115
|
+
return T ? /* @__PURE__ */ t(_, {
|
|
117
116
|
ref: p,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
width: "100%",
|
|
123
|
-
height: v() + K
|
|
124
|
-
},
|
|
125
|
-
children: /* @__PURE__ */ e(I, {
|
|
126
|
-
...u,
|
|
127
|
-
style: {
|
|
128
|
-
position: "absolute",
|
|
129
|
-
top: 0,
|
|
130
|
-
left: 0,
|
|
131
|
-
width: "100%",
|
|
132
|
-
transform: `translateY(${((H = h[0]) == null ? void 0 : H.start) || 0}px)`,
|
|
133
|
-
tableLayout: "fixed"
|
|
134
|
-
},
|
|
135
|
-
virtualItems: h
|
|
136
|
-
})
|
|
117
|
+
children: /* @__PURE__ */ t(R, {
|
|
118
|
+
...u,
|
|
119
|
+
totalVirtualSize: D,
|
|
120
|
+
virtualItems: y
|
|
137
121
|
})
|
|
138
|
-
}) : /* @__PURE__ */
|
|
122
|
+
}) : /* @__PURE__ */ t(R, {
|
|
139
123
|
...u
|
|
140
124
|
});
|
|
141
125
|
};
|
|
142
126
|
export {
|
|
143
|
-
|
|
127
|
+
me as MetadataTable
|
|
144
128
|
};
|
|
@@ -1,196 +1,212 @@
|
|
|
1
|
-
import { TableBody as
|
|
2
|
-
import { ItemTypeIcon as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { I as
|
|
7
|
-
import { THUMBNAIL_LIST_VIEW_HEIGHTS as
|
|
8
|
-
import { s as
|
|
9
|
-
import {
|
|
10
|
-
import { InlineEditingCell as
|
|
11
|
-
import { ItemActionMenu as
|
|
12
|
-
import { GhostTableRow as
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
},
|
|
1
|
+
import { TableBody as x, Row as y, Cell as f, ActionCell as _, Text as $ } from "@box/blueprint-web";
|
|
2
|
+
import { ItemTypeIcon as E } from "@box/item-icon";
|
|
3
|
+
import D from "clsx";
|
|
4
|
+
import L from "lodash/get";
|
|
5
|
+
import h from "react";
|
|
6
|
+
import { I as p } from "../../../../../chunks/types.js";
|
|
7
|
+
import { THUMBNAIL_LIST_VIEW_HEIGHTS as U } from "../../constants.js";
|
|
8
|
+
import { s as c, T as k } from "../../../../../chunks/index.js";
|
|
9
|
+
import { jsxs as C, jsx as t } from "react/jsx-runtime";
|
|
10
|
+
import { InlineEditingCell as W } from "./inline-editing-cell/inline-editing-cell.js";
|
|
11
|
+
import { ItemActionMenu as j } from "../../item-action-menu/item-action-menu.js";
|
|
12
|
+
import { GhostTableRow as G } from "./ghost-table-row/ghost-table-row.js";
|
|
13
|
+
const S = (e, n, l) => {
|
|
14
|
+
const o = l ? n.split(".")[1] : n;
|
|
15
|
+
return L(e, o);
|
|
16
|
+
}, H = /* @__PURE__ */ h.memo(({
|
|
17
17
|
column: e,
|
|
18
|
-
iconColumnVariant:
|
|
19
|
-
item:
|
|
18
|
+
iconColumnVariant: n,
|
|
19
|
+
item: l
|
|
20
20
|
}) => {
|
|
21
21
|
const {
|
|
22
|
-
id:
|
|
23
|
-
isItemMetadata:
|
|
24
|
-
subtitle:
|
|
25
|
-
textValue:
|
|
26
|
-
} = e, i = `${
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
className:
|
|
30
|
-
children: [/* @__PURE__ */
|
|
31
|
-
className:
|
|
32
|
-
item:
|
|
33
|
-
}), /* @__PURE__ */
|
|
34
|
-
className:
|
|
35
|
-
[
|
|
22
|
+
id: o,
|
|
23
|
+
isItemMetadata: a,
|
|
24
|
+
subtitle: d,
|
|
25
|
+
textValue: m
|
|
26
|
+
} = e, i = `${m}-${l.id}`;
|
|
27
|
+
return /* @__PURE__ */ t(f, {
|
|
28
|
+
children: /* @__PURE__ */ C("div", {
|
|
29
|
+
className: c.tableNameCell,
|
|
30
|
+
children: [/* @__PURE__ */ t(E, {
|
|
31
|
+
className: c.tableNameCellIconInline,
|
|
32
|
+
item: l
|
|
33
|
+
}), /* @__PURE__ */ C("div", {
|
|
34
|
+
className: D(c.tableNameCellTitle, {
|
|
35
|
+
[c.hasSubtitle]: n === p.INLINE_SUBTITLE
|
|
36
36
|
}),
|
|
37
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ t($, {
|
|
38
38
|
as: "span",
|
|
39
|
-
className:
|
|
40
|
-
children:
|
|
41
|
-
}),
|
|
39
|
+
className: c.tableNameCellText,
|
|
40
|
+
children: S(l, o, a)
|
|
41
|
+
}), n === p.INLINE_SUBTITLE && /* @__PURE__ */ t($, {
|
|
42
42
|
as: "span",
|
|
43
|
-
className:
|
|
43
|
+
className: c.tableNameCellText,
|
|
44
44
|
color: "textOnLightSecondary",
|
|
45
|
-
children:
|
|
45
|
+
children: d
|
|
46
46
|
})]
|
|
47
47
|
})]
|
|
48
48
|
})
|
|
49
49
|
}, i);
|
|
50
|
-
}),
|
|
50
|
+
}), A = /* @__PURE__ */ h.memo(({
|
|
51
51
|
column: e,
|
|
52
|
-
item:
|
|
52
|
+
item: n
|
|
53
53
|
}) => {
|
|
54
|
-
var
|
|
55
|
-
const
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
children: (
|
|
58
|
-
},
|
|
59
|
-
}),
|
|
54
|
+
var o;
|
|
55
|
+
const l = `${e.textValue}-${n.id}`;
|
|
56
|
+
return /* @__PURE__ */ t(f, {
|
|
57
|
+
children: (o = e.cellRenderer) == null ? void 0 : o.call(e, n, e)
|
|
58
|
+
}, l);
|
|
59
|
+
}), F = /* @__PURE__ */ h.memo(({
|
|
60
60
|
column: e,
|
|
61
|
-
item:
|
|
61
|
+
item: n
|
|
62
62
|
}) => {
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
children:
|
|
66
|
-
},
|
|
67
|
-
}),
|
|
63
|
+
const l = `${e.textValue}-${n.id}`, o = L(n, e.id);
|
|
64
|
+
return o ? /* @__PURE__ */ t(f, {
|
|
65
|
+
children: o.join(" ")
|
|
66
|
+
}, l) : /* @__PURE__ */ t(f, {}, l);
|
|
67
|
+
}), K = /* @__PURE__ */ h.memo(({
|
|
68
68
|
column: e,
|
|
69
|
-
item:
|
|
69
|
+
item: n
|
|
70
70
|
}) => {
|
|
71
71
|
const {
|
|
72
|
-
id:
|
|
73
|
-
isItemMetadata:
|
|
74
|
-
textValue:
|
|
75
|
-
} = e,
|
|
76
|
-
return /* @__PURE__ */
|
|
77
|
-
children: /* @__PURE__ */
|
|
72
|
+
id: l,
|
|
73
|
+
isItemMetadata: o,
|
|
74
|
+
textValue: a
|
|
75
|
+
} = e, d = `${a}-${n.id}`;
|
|
76
|
+
return /* @__PURE__ */ t(f, {
|
|
77
|
+
children: /* @__PURE__ */ t($, {
|
|
78
78
|
as: "span",
|
|
79
|
-
children:
|
|
79
|
+
children: S(n, l, o)
|
|
80
80
|
})
|
|
81
|
-
},
|
|
82
|
-
}),
|
|
81
|
+
}, d);
|
|
82
|
+
}), q = /* @__PURE__ */ h.memo(({
|
|
83
83
|
column: e,
|
|
84
|
-
iconColumnVariant:
|
|
85
|
-
item:
|
|
86
|
-
onInlineEditChange:
|
|
84
|
+
iconColumnVariant: n,
|
|
85
|
+
item: l,
|
|
86
|
+
onInlineEditChange: o
|
|
87
87
|
}) => {
|
|
88
88
|
const {
|
|
89
|
-
cellRenderer:
|
|
90
|
-
id:
|
|
91
|
-
isInlineEditingEnabled:
|
|
89
|
+
cellRenderer: a,
|
|
90
|
+
id: d,
|
|
91
|
+
isInlineEditingEnabled: m,
|
|
92
92
|
type: i
|
|
93
|
-
} = e,
|
|
94
|
-
return
|
|
93
|
+
} = e, N = d === "item.name" && (n === p.INLINE || n === p.INLINE_SUBTITLE);
|
|
94
|
+
return a ? /* @__PURE__ */ t(A, {
|
|
95
95
|
column: e,
|
|
96
|
-
item:
|
|
97
|
-
}) :
|
|
96
|
+
item: l
|
|
97
|
+
}) : N ? /* @__PURE__ */ t(H, {
|
|
98
98
|
column: e,
|
|
99
|
-
iconColumnVariant:
|
|
100
|
-
item:
|
|
101
|
-
}) :
|
|
99
|
+
iconColumnVariant: n,
|
|
100
|
+
item: l
|
|
101
|
+
}) : m && (i === "multiSelect" || i === "enum") ? /* @__PURE__ */ t(W, {
|
|
102
102
|
column: e,
|
|
103
|
-
item:
|
|
104
|
-
onInlineEditChange:
|
|
105
|
-
}, `${e.id}-${
|
|
103
|
+
item: l,
|
|
104
|
+
onInlineEditChange: o
|
|
105
|
+
}, `${e.id}-${l.id}`) : i === "multiSelect" ? /* @__PURE__ */ t(F, {
|
|
106
106
|
column: e,
|
|
107
|
-
item:
|
|
108
|
-
}) : /* @__PURE__ */
|
|
107
|
+
item: l
|
|
108
|
+
}) : /* @__PURE__ */ t(K, {
|
|
109
109
|
column: e,
|
|
110
|
-
item:
|
|
110
|
+
item: l
|
|
111
111
|
});
|
|
112
|
-
}),
|
|
112
|
+
}), J = /* @__PURE__ */ h.memo(({
|
|
113
113
|
item: e,
|
|
114
|
-
zoomLevel:
|
|
115
|
-
}) => /* @__PURE__ */
|
|
114
|
+
zoomLevel: n
|
|
115
|
+
}) => /* @__PURE__ */ t(f, {
|
|
116
116
|
style: {
|
|
117
|
-
height:
|
|
117
|
+
height: U[n]
|
|
118
118
|
},
|
|
119
|
-
children: /* @__PURE__ */
|
|
120
|
-
className:
|
|
119
|
+
children: /* @__PURE__ */ t(E, {
|
|
120
|
+
className: c.iconCell,
|
|
121
121
|
item: e
|
|
122
122
|
})
|
|
123
|
-
}, `item-type-icon-${e.id}`)),
|
|
123
|
+
}, `item-type-icon-${e.id}`)), Q = /* @__PURE__ */ h.memo(({
|
|
124
124
|
item: e,
|
|
125
|
-
itemActionMenuProps:
|
|
126
|
-
isCheckboxDisabled:
|
|
127
|
-
}) => /* @__PURE__ */
|
|
128
|
-
isCheckboxDisabled:
|
|
129
|
-
children: (
|
|
130
|
-
...
|
|
125
|
+
itemActionMenuProps: n,
|
|
126
|
+
isCheckboxDisabled: l
|
|
127
|
+
}) => /* @__PURE__ */ t(_, {
|
|
128
|
+
isCheckboxDisabled: l,
|
|
129
|
+
children: (o) => n ? /* @__PURE__ */ t(j, {
|
|
130
|
+
...n,
|
|
131
131
|
item: e,
|
|
132
|
-
onOpenChange:
|
|
132
|
+
onOpenChange: o
|
|
133
133
|
}) : null
|
|
134
|
-
})),
|
|
134
|
+
})), re = ({
|
|
135
135
|
areSelectionCheckboxesDisabled: e,
|
|
136
|
-
columnCount:
|
|
137
|
-
columns:
|
|
138
|
-
iconColumnVariant:
|
|
139
|
-
items:
|
|
140
|
-
itemActionMenuProps:
|
|
141
|
-
onInlineEditChange:
|
|
136
|
+
columnCount: n,
|
|
137
|
+
columns: l,
|
|
138
|
+
iconColumnVariant: o,
|
|
139
|
+
items: a,
|
|
140
|
+
itemActionMenuProps: d,
|
|
141
|
+
onInlineEditChange: m,
|
|
142
142
|
onTableRowClick: i,
|
|
143
|
-
shouldRenderActionColumn:
|
|
144
|
-
virtualItems:
|
|
145
|
-
|
|
143
|
+
shouldRenderActionColumn: N,
|
|
144
|
+
virtualItems: I,
|
|
145
|
+
totalVirtualSize: w,
|
|
146
|
+
zoomLevel: b
|
|
146
147
|
}) => {
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
149
|
-
const s = (
|
|
150
|
-
columnLength:
|
|
151
|
-
rowKey: `ghost-${
|
|
152
|
-
}),
|
|
148
|
+
const B = o === p.COLUMN;
|
|
149
|
+
if (I) {
|
|
150
|
+
const s = (r) => /* @__PURE__ */ t(G, {
|
|
151
|
+
columnLength: n || 0,
|
|
152
|
+
rowKey: `ghost-${r}`
|
|
153
|
+
}), T = (r) => /* @__PURE__ */ t(k, {
|
|
153
154
|
areSelectionCheckboxesDisabled: e,
|
|
154
|
-
columns:
|
|
155
|
-
iconColumnVariant:
|
|
156
|
-
item:
|
|
157
|
-
itemActionMenuProps:
|
|
155
|
+
columns: l,
|
|
156
|
+
iconColumnVariant: o,
|
|
157
|
+
item: r,
|
|
158
|
+
itemActionMenuProps: d,
|
|
158
159
|
onTableRowClick: i,
|
|
159
|
-
shouldRenderActionColumn:
|
|
160
|
-
zoomLevel:
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
shouldRenderActionColumn: N,
|
|
161
|
+
zoomLevel: b
|
|
162
|
+
}), R = () => {
|
|
163
|
+
const r = I[0];
|
|
164
|
+
return (r == null ? void 0 : r.start) || 0;
|
|
165
|
+
}, M = () => {
|
|
166
|
+
const r = I[I.length - 1], O = (r == null ? void 0 : r.end) || 0;
|
|
167
|
+
return Math.max((w || 0) - O, 0);
|
|
168
|
+
}, u = R(), g = M();
|
|
169
|
+
return /* @__PURE__ */ C(x, {
|
|
170
|
+
children: [!!u && /* @__PURE__ */ t(y, {
|
|
171
|
+
isDisabled: !0,
|
|
172
|
+
style: {
|
|
173
|
+
height: `${u}px`
|
|
174
|
+
}
|
|
175
|
+
}), I.map(({
|
|
176
|
+
index: r
|
|
177
|
+
}) => r >= a.length ? s(r) : T(a[r])), !!g && /* @__PURE__ */ t(y, {
|
|
178
|
+
isDisabled: !0,
|
|
179
|
+
style: {
|
|
180
|
+
height: `${g}px`
|
|
181
|
+
}
|
|
182
|
+
})]
|
|
167
183
|
});
|
|
168
184
|
}
|
|
169
|
-
return /* @__PURE__ */
|
|
170
|
-
items:
|
|
185
|
+
return /* @__PURE__ */ t(x, {
|
|
186
|
+
items: a.map((s) => ({
|
|
171
187
|
key: s.id,
|
|
172
188
|
...s
|
|
173
189
|
})),
|
|
174
|
-
children: (s) => /* @__PURE__ */
|
|
175
|
-
className:
|
|
190
|
+
children: (s) => /* @__PURE__ */ C(y, {
|
|
191
|
+
className: c.tableRow,
|
|
176
192
|
id: s.id,
|
|
177
193
|
onAction: () => i(s),
|
|
178
|
-
children: [
|
|
194
|
+
children: [B && /* @__PURE__ */ t(J, {
|
|
179
195
|
item: s,
|
|
180
|
-
zoomLevel:
|
|
181
|
-
}),
|
|
182
|
-
column:
|
|
183
|
-
iconColumnVariant:
|
|
196
|
+
zoomLevel: b
|
|
197
|
+
}), l.map((T) => /* @__PURE__ */ t(q, {
|
|
198
|
+
column: T,
|
|
199
|
+
iconColumnVariant: o,
|
|
184
200
|
item: s,
|
|
185
|
-
onInlineEditChange:
|
|
186
|
-
}, `${
|
|
201
|
+
onInlineEditChange: m
|
|
202
|
+
}, `${T.textValue}-${s.id}`)), N && /* @__PURE__ */ t(Q, {
|
|
187
203
|
isCheckboxDisabled: e,
|
|
188
204
|
item: s,
|
|
189
|
-
itemActionMenuProps:
|
|
205
|
+
itemActionMenuProps: d
|
|
190
206
|
})]
|
|
191
207
|
}, s.id)
|
|
192
208
|
});
|
|
193
209
|
};
|
|
194
210
|
export {
|
|
195
|
-
|
|
211
|
+
re as default
|
|
196
212
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Table as
|
|
2
|
-
import { I as
|
|
3
|
-
import { GhostTableBody as
|
|
4
|
-
import
|
|
5
|
-
import y from "./messages.js";
|
|
1
|
+
import { Table as B } from "@box/blueprint-web";
|
|
2
|
+
import { I as R } 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";
|
|
6
5
|
import { getShouldRenderActionColumn as A } from "./actionColumn.js";
|
|
7
|
-
import
|
|
8
|
-
|
|
6
|
+
import G from "./messages.js";
|
|
7
|
+
import { jsxs as V, jsx as c } from "react/jsx-runtime";
|
|
8
|
+
const W = ({
|
|
9
9
|
columnCount: s,
|
|
10
10
|
columns: e,
|
|
11
11
|
formatMessage: u,
|
|
@@ -20,20 +20,21 @@ const U = ({
|
|
|
20
20
|
tableHeader: a,
|
|
21
21
|
tableProps: l,
|
|
22
22
|
virtualItems: o,
|
|
23
|
-
|
|
23
|
+
totalVirtualSize: b,
|
|
24
|
+
zoomLevel: T
|
|
24
25
|
}) => {
|
|
25
26
|
const m = A(l), i = s || (() => {
|
|
26
27
|
let n = e.length;
|
|
27
|
-
return t ===
|
|
28
|
-
})(),
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
"aria-label": u(
|
|
28
|
+
return t === R.COLUMN && (n += 1), m && (n += 1), n;
|
|
29
|
+
})(), x = r && !(o != null && o.length);
|
|
30
|
+
return /* @__PURE__ */ V(B, {
|
|
31
|
+
"aria-label": u(G.listView),
|
|
31
32
|
selectionBehavior: "toggle",
|
|
32
33
|
style: p,
|
|
33
34
|
...l,
|
|
34
|
-
children: [a,
|
|
35
|
+
children: [a, x ? /* @__PURE__ */ c(j, {
|
|
35
36
|
columnLength: i
|
|
36
|
-
}) : /* @__PURE__ */ c(
|
|
37
|
+
}) : /* @__PURE__ */ c(y, {
|
|
37
38
|
areSelectionCheckboxesDisabled: h,
|
|
38
39
|
columnCount: i,
|
|
39
40
|
columns: e,
|
|
@@ -44,11 +45,12 @@ const U = ({
|
|
|
44
45
|
onInlineEditChange: g,
|
|
45
46
|
onTableRowClick: d,
|
|
46
47
|
shouldRenderActionColumn: m,
|
|
48
|
+
totalVirtualSize: b,
|
|
47
49
|
virtualItems: o,
|
|
48
|
-
zoomLevel:
|
|
50
|
+
zoomLevel: T
|
|
49
51
|
})]
|
|
50
52
|
});
|
|
51
53
|
};
|
|
52
54
|
export {
|
|
53
|
-
|
|
55
|
+
W as TableRenderer
|
|
54
56
|
};
|
package/dist/styles/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._tableHeaderActionsWrapper_gffqj_1{position:absolute;top:0;right:var(--size-4);bottom:0;display:flex;gap:var(--space-2);align-items:center;justify-content:center;padding:0 var(--space-2);background:var(--item-background);margin-block:var(--space-2)}._tableHeaderActionsWrapper_gffqj_1:before{position:absolute;left:0;z-index:0;display:block;width:0;height:50%;box-shadow:-.25rem 0 .625rem .625rem var(--item-background);content:""}._tableHeaderActions_gffqj_1{position:sticky;right:0;width:var(--size-6);padding:0}._tableRow_gffqj_33:after{height:100%!important}._tableRow_gffqj_33[aria-selected=true]:after{height:100%!important}._selectAllCheckbox_gffqj_42 svg{transform:none!important}._tableNameCell_gffqj_47{display:flex;gap:var(--space-3);align-items:center}._tableNameCellTitle_gffqj_53{overflow:hidden;text-overflow:ellipsis}._tableNameCellTitle_gffqj_53._hasSubtitle_gffqj_57{display:flex;flex-direction:column}._tableNameCellText_gffqj_62{overflow:hidden;text-overflow:ellipsis}._tableNameCellIconInline_gffqj_67{flex-shrink:0}._iconCell_gffqj_71{width:100%!important;height:100%!important}
|
|
@@ -9,7 +9,7 @@ type UseInfiniteScrollTableItemsProps = {
|
|
|
9
9
|
placeholderRowsCount?: number;
|
|
10
10
|
};
|
|
11
11
|
export declare const useInfiniteScrollTableItems: ({ items, hasNextPage, isLoading, parentRef, approximateRowHeight, onGetNextPage, placeholderRowsCount, }: UseInfiniteScrollTableItemsProps) => {
|
|
12
|
-
|
|
12
|
+
totalVirtualSize: number;
|
|
13
13
|
virtualItemsToDisplay: import('@tanstack/virtual-core').VirtualItem[];
|
|
14
14
|
};
|
|
15
15
|
export {};
|
|
@@ -7,6 +7,7 @@ import { InlineEditingCellProps } from './inline-editing-cell';
|
|
|
7
7
|
interface TableBodyWithDataProps extends Omit<MetadataTableProps, keyof TableProps>, Pick<InlineEditingCellProps, 'onInlineEditChange'> {
|
|
8
8
|
columnCount?: number;
|
|
9
9
|
shouldRenderActionColumn?: boolean;
|
|
10
|
+
totalVirtualSize?: number;
|
|
10
11
|
virtualItems?: VirtualItem[];
|
|
11
12
|
}
|
|
12
13
|
type CellProps = {
|
|
@@ -15,5 +16,5 @@ type CellProps = {
|
|
|
15
16
|
iconColumnVariant: IconColumnVariant;
|
|
16
17
|
};
|
|
17
18
|
export type DataCellProps = CellProps & Pick<InlineEditingCellProps, 'onInlineEditChange'>;
|
|
18
|
-
declare const TableBodyWithData: ({ areSelectionCheckboxesDisabled, columnCount, columns, iconColumnVariant, items, itemActionMenuProps, onInlineEditChange, onTableRowClick, shouldRenderActionColumn, virtualItems, zoomLevel, }: TableBodyWithDataProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const TableBodyWithData: ({ areSelectionCheckboxesDisabled, columnCount, columns, iconColumnVariant, items, itemActionMenuProps, onInlineEditChange, onTableRowClick, shouldRenderActionColumn, virtualItems, totalVirtualSize, zoomLevel, }: TableBodyWithDataProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export default TableBodyWithData;
|
|
@@ -18,6 +18,7 @@ export interface TableRendererProps extends Pick<InlineEditingCellProps, 'onInli
|
|
|
18
18
|
tableHeader: React.ReactNode;
|
|
19
19
|
tableProps: TableProps;
|
|
20
20
|
virtualItems?: VirtualItem[];
|
|
21
|
+
totalVirtualSize?: number;
|
|
21
22
|
zoomLevel?: number;
|
|
22
23
|
}
|
|
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;
|
|
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;
|