@box/metadata-view 0.29.3 → 0.30.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/esm/lib/components/filter-row/filter-row.js +8 -8
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +100 -85
- package/dist/esm/lib/metadata-view.js +8 -8
- package/dist/types/lib/test-utils/mock-data.d.ts +1 -0
- package/dist/types/lib/types.d.ts +1 -0
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Formik as
|
|
3
|
-
import {
|
|
1
|
+
import { FilterChip as C } from "@box/blueprint-web";
|
|
2
|
+
import { Formik as S, Form as v } from "formik";
|
|
3
|
+
import { useState as G, useRef as I } from "react";
|
|
4
4
|
import R from "./all-filters-chip.js";
|
|
5
5
|
import { getInitialFieldValues as g } from "./initial-field-values.js";
|
|
6
6
|
import { MetadataFilterChip as j } from "./metadata-filter-chip.js";
|
|
@@ -13,7 +13,7 @@ const z = ({
|
|
|
13
13
|
isAllFiltersDisabled: p,
|
|
14
14
|
onFilterSubmit: l
|
|
15
15
|
}) => {
|
|
16
|
-
const [s, c] =
|
|
16
|
+
const [s, c] = G([]), u = w(n), f = ([e, t]) => {
|
|
17
17
|
var r;
|
|
18
18
|
return ((r = t.value) == null ? void 0 : r.enum) && t.value.enum.length > 0;
|
|
19
19
|
}, h = ({
|
|
@@ -25,13 +25,13 @@ const z = ({
|
|
|
25
25
|
c(t), l && l(e);
|
|
26
26
|
}, o = [...u, ...d], m = o.flatMap(({
|
|
27
27
|
filters: e
|
|
28
|
-
}) => e), F = g(m), a =
|
|
29
|
-
return /* @__PURE__ */ i(
|
|
28
|
+
}) => e), F = g(m), a = I(null);
|
|
29
|
+
return /* @__PURE__ */ i(S, {
|
|
30
30
|
initialValues: F,
|
|
31
31
|
onSubmit: h,
|
|
32
|
-
children: /* @__PURE__ */ i(
|
|
32
|
+
children: /* @__PURE__ */ i(v, {
|
|
33
33
|
ref: a,
|
|
34
|
-
children: /* @__PURE__ */ b(
|
|
34
|
+
children: /* @__PURE__ */ b(C.Group, {
|
|
35
35
|
className: x.filterChipGroup,
|
|
36
36
|
name: "metadata-view-filters",
|
|
37
37
|
type: "multiple",
|
|
@@ -1,167 +1,182 @@
|
|
|
1
|
-
import { TableBody as y, Row as
|
|
1
|
+
import { TableBody as y, Row as E, Cell as d, ActionCell as L, Text as p } from "@box/blueprint-web";
|
|
2
2
|
import { ItemTypeIcon as C } from "@box/item-icon";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import x from "clsx";
|
|
4
|
+
import T from "lodash/get";
|
|
5
|
+
import s from "react";
|
|
6
6
|
import { I as h } from "../../../../../chunks/types.js";
|
|
7
|
-
import { THUMBNAIL_LIST_VIEW_HEIGHTS as
|
|
8
|
-
import
|
|
9
|
-
import { s as
|
|
10
|
-
import { jsx as r, jsxs as
|
|
11
|
-
import { ItemActionMenu as
|
|
12
|
-
const
|
|
7
|
+
import { THUMBNAIL_LIST_VIEW_HEIGHTS as b } from "../../constants.js";
|
|
8
|
+
import g from "./ghost-row/ghost-row.js";
|
|
9
|
+
import { s as f, T as w } from "../../../../../chunks/table-row.js";
|
|
10
|
+
import { jsx as r, jsxs as N } from "react/jsx-runtime";
|
|
11
|
+
import { ItemActionMenu as R } from "../../item-action-menu/item-action-menu.js";
|
|
12
|
+
const S = /* @__PURE__ */ s.memo(({
|
|
13
13
|
item: t,
|
|
14
14
|
column: e,
|
|
15
|
-
iconColumnVariant:
|
|
15
|
+
iconColumnVariant: n
|
|
16
16
|
}) => {
|
|
17
17
|
const {
|
|
18
18
|
id: l,
|
|
19
|
-
subTitle:
|
|
20
|
-
} = e,
|
|
21
|
-
return /* @__PURE__ */ r(
|
|
22
|
-
children: /* @__PURE__ */
|
|
23
|
-
className:
|
|
19
|
+
subTitle: a
|
|
20
|
+
} = e, c = `${e.textValue}-${t.id}`;
|
|
21
|
+
return /* @__PURE__ */ r(d, {
|
|
22
|
+
children: /* @__PURE__ */ N("div", {
|
|
23
|
+
className: f.tableNameCell,
|
|
24
24
|
children: [/* @__PURE__ */ r(C, {
|
|
25
25
|
item: t
|
|
26
|
-
}), /* @__PURE__ */
|
|
27
|
-
className:
|
|
28
|
-
[
|
|
26
|
+
}), /* @__PURE__ */ N("div", {
|
|
27
|
+
className: x({
|
|
28
|
+
[f.tableNameCellSubTitle]: n === h.INLINE_SUBTITLE
|
|
29
29
|
}),
|
|
30
30
|
children: [/* @__PURE__ */ r(p, {
|
|
31
31
|
as: "span",
|
|
32
|
-
children:
|
|
33
|
-
}),
|
|
32
|
+
children: T(t, l)
|
|
33
|
+
}), n === h.INLINE_SUBTITLE && /* @__PURE__ */ r(p, {
|
|
34
34
|
as: "span",
|
|
35
35
|
color: "textOnLightSecondary",
|
|
36
|
-
children:
|
|
36
|
+
children: a
|
|
37
37
|
})]
|
|
38
38
|
})]
|
|
39
39
|
})
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
40
|
+
}, c);
|
|
41
|
+
}), k = /* @__PURE__ */ s.memo(({
|
|
42
42
|
item: t,
|
|
43
43
|
column: e
|
|
44
44
|
}) => {
|
|
45
45
|
var l;
|
|
46
|
-
const
|
|
47
|
-
return /* @__PURE__ */ r(
|
|
46
|
+
const n = `${e.textValue}-${t.id}`;
|
|
47
|
+
return /* @__PURE__ */ r(d, {
|
|
48
48
|
children: (l = e.cellRenderer) == null ? void 0 : l.call(e, t, e)
|
|
49
|
-
},
|
|
50
|
-
}),
|
|
49
|
+
}, n);
|
|
50
|
+
}), B = /* @__PURE__ */ s.memo(({
|
|
51
51
|
item: t,
|
|
52
52
|
column: e
|
|
53
53
|
}) => {
|
|
54
|
-
const
|
|
55
|
-
return l ? /* @__PURE__ */ r(
|
|
54
|
+
const n = `${e.textValue}-${t.id}`, l = T(t, e.id);
|
|
55
|
+
return l ? /* @__PURE__ */ r(d, {
|
|
56
56
|
children: l.join(" ")
|
|
57
|
-
},
|
|
58
|
-
}),
|
|
57
|
+
}, n) : /* @__PURE__ */ r(d, {}, n);
|
|
58
|
+
}), _ = /* @__PURE__ */ s.memo(({
|
|
59
59
|
item: t,
|
|
60
60
|
column: e
|
|
61
61
|
}) => {
|
|
62
|
-
const
|
|
63
|
-
return /* @__PURE__ */ r(
|
|
62
|
+
const n = `${e.textValue}-${t.id}`;
|
|
63
|
+
return /* @__PURE__ */ r(d, {
|
|
64
64
|
children: /* @__PURE__ */ r(p, {
|
|
65
65
|
as: "span",
|
|
66
|
-
children:
|
|
66
|
+
children: T(t, e.id)
|
|
67
67
|
})
|
|
68
|
-
},
|
|
69
|
-
}), U = /* @__PURE__ */
|
|
68
|
+
}, n);
|
|
69
|
+
}), U = /* @__PURE__ */ s.memo(({
|
|
70
|
+
item: t,
|
|
71
|
+
column: e
|
|
72
|
+
}) => {
|
|
73
|
+
const n = `${e.textValue}-${t.id}`;
|
|
74
|
+
return /* @__PURE__ */ r(d, {
|
|
75
|
+
children: /* @__PURE__ */ N(p, {
|
|
76
|
+
as: "span",
|
|
77
|
+
children: [T(t, e.id), " withInlineEditing"]
|
|
78
|
+
})
|
|
79
|
+
}, n);
|
|
80
|
+
}), W = /* @__PURE__ */ s.memo(({
|
|
70
81
|
item: t,
|
|
71
82
|
column: e,
|
|
72
|
-
iconColumnVariant:
|
|
83
|
+
iconColumnVariant: n
|
|
73
84
|
}) => {
|
|
74
85
|
const {
|
|
75
86
|
cellRenderer: l,
|
|
76
|
-
id:
|
|
77
|
-
|
|
87
|
+
id: a,
|
|
88
|
+
isInlineEditingEnabled: c,
|
|
89
|
+
type: I
|
|
78
90
|
} = e;
|
|
79
|
-
return
|
|
91
|
+
return a === "name" && (n === h.INLINE || n === h.INLINE_SUBTITLE) ? /* @__PURE__ */ r(S, {
|
|
92
|
+
column: e,
|
|
93
|
+
iconColumnVariant: n,
|
|
94
|
+
item: t
|
|
95
|
+
}) : l ? /* @__PURE__ */ r(k, {
|
|
80
96
|
column: e,
|
|
81
|
-
iconColumnVariant: o,
|
|
82
97
|
item: t
|
|
83
|
-
}) :
|
|
98
|
+
}) : I === "multiSelect" ? /* @__PURE__ */ r(B, {
|
|
84
99
|
column: e,
|
|
85
100
|
item: t
|
|
86
|
-
}) :
|
|
101
|
+
}) : c && I === "enum" ? /* @__PURE__ */ r(U, {
|
|
87
102
|
column: e,
|
|
88
103
|
item: t
|
|
89
|
-
}) : /* @__PURE__ */ r(
|
|
104
|
+
}) : /* @__PURE__ */ r(_, {
|
|
90
105
|
column: e,
|
|
91
106
|
item: t
|
|
92
107
|
});
|
|
93
|
-
}),
|
|
108
|
+
}), j = /* @__PURE__ */ s.memo(({
|
|
94
109
|
item: t,
|
|
95
110
|
zoomLevel: e
|
|
96
|
-
}) => /* @__PURE__ */ r(
|
|
111
|
+
}) => /* @__PURE__ */ r(d, {
|
|
97
112
|
style: {
|
|
98
|
-
height:
|
|
113
|
+
height: b[e]
|
|
99
114
|
},
|
|
100
115
|
children: /* @__PURE__ */ r(C, {
|
|
101
|
-
className:
|
|
116
|
+
className: f.iconCell,
|
|
102
117
|
item: t
|
|
103
118
|
})
|
|
104
|
-
}, `item-type-icon-${t.id}`)),
|
|
119
|
+
}, `item-type-icon-${t.id}`)), D = /* @__PURE__ */ s.memo(({
|
|
105
120
|
item: t,
|
|
106
121
|
itemActionMenuProps: e
|
|
107
|
-
}) => /* @__PURE__ */ r(
|
|
108
|
-
children: (
|
|
122
|
+
}) => /* @__PURE__ */ r(L, {
|
|
123
|
+
children: (n) => e ? /* @__PURE__ */ r(R, {
|
|
109
124
|
...e,
|
|
110
125
|
item: t,
|
|
111
|
-
onOpenChange:
|
|
126
|
+
onOpenChange: n
|
|
112
127
|
}) : null
|
|
113
|
-
})),
|
|
128
|
+
})), Q = ({
|
|
114
129
|
columns: t,
|
|
115
130
|
iconColumnVariant: e,
|
|
116
|
-
isSelectAllEnabled:
|
|
131
|
+
isSelectAllEnabled: n,
|
|
117
132
|
items: l,
|
|
118
|
-
itemActionMenuProps:
|
|
119
|
-
virtualItems:
|
|
120
|
-
columnCount:
|
|
133
|
+
itemActionMenuProps: a,
|
|
134
|
+
virtualItems: c,
|
|
135
|
+
columnCount: I,
|
|
121
136
|
zoomLevel: u
|
|
122
137
|
}) => {
|
|
123
138
|
const $ = e === h.COLUMN;
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
126
|
-
columnLength:
|
|
127
|
-
rowKey: `ghost-${
|
|
128
|
-
}),
|
|
139
|
+
if (c) {
|
|
140
|
+
const o = (i) => /* @__PURE__ */ r(g, {
|
|
141
|
+
columnLength: I || 0,
|
|
142
|
+
rowKey: `ghost-${i}`
|
|
143
|
+
}), m = (i) => /* @__PURE__ */ r(w, {
|
|
129
144
|
columns: t,
|
|
130
145
|
iconColumnVariant: e,
|
|
131
|
-
isSelectAllEnabled:
|
|
132
|
-
item:
|
|
133
|
-
itemActionMenuProps:
|
|
146
|
+
isSelectAllEnabled: n,
|
|
147
|
+
item: i,
|
|
148
|
+
itemActionMenuProps: a,
|
|
134
149
|
zoomLevel: u
|
|
135
150
|
});
|
|
136
151
|
return /* @__PURE__ */ r(y, {
|
|
137
|
-
items:
|
|
152
|
+
items: c,
|
|
138
153
|
children: ({
|
|
139
|
-
index:
|
|
140
|
-
}) =>
|
|
154
|
+
index: i
|
|
155
|
+
}) => i >= l.length ? o(i) : m(l[i])
|
|
141
156
|
});
|
|
142
157
|
}
|
|
143
158
|
return /* @__PURE__ */ r(y, {
|
|
144
|
-
items: l.map((
|
|
145
|
-
key:
|
|
146
|
-
...
|
|
159
|
+
items: l.map((o) => ({
|
|
160
|
+
key: o.id,
|
|
161
|
+
...o
|
|
147
162
|
})),
|
|
148
|
-
children: (
|
|
149
|
-
className:
|
|
150
|
-
id:
|
|
151
|
-
children: [$ && /* @__PURE__ */ r(
|
|
152
|
-
item:
|
|
163
|
+
children: (o) => /* @__PURE__ */ N(E, {
|
|
164
|
+
className: f.tableRow,
|
|
165
|
+
id: o.id,
|
|
166
|
+
children: [$ && /* @__PURE__ */ r(j, {
|
|
167
|
+
item: o,
|
|
153
168
|
zoomLevel: u
|
|
154
|
-
}), t.map((
|
|
155
|
-
column:
|
|
169
|
+
}), t.map((m) => /* @__PURE__ */ r(W, {
|
|
170
|
+
column: m,
|
|
156
171
|
iconColumnVariant: e,
|
|
157
|
-
item:
|
|
158
|
-
}, `${
|
|
159
|
-
item:
|
|
160
|
-
itemActionMenuProps:
|
|
172
|
+
item: o
|
|
173
|
+
}, `${m.textValue}-${o.id}`)), n && /* @__PURE__ */ r(D, {
|
|
174
|
+
item: o,
|
|
175
|
+
itemActionMenuProps: a
|
|
161
176
|
})]
|
|
162
|
-
},
|
|
177
|
+
}, o.id)
|
|
163
178
|
});
|
|
164
179
|
};
|
|
165
180
|
export {
|
|
166
|
-
|
|
181
|
+
Q as default
|
|
167
182
|
};
|
|
@@ -24,11 +24,11 @@ function W({
|
|
|
24
24
|
isLoading: s,
|
|
25
25
|
...r
|
|
26
26
|
}) {
|
|
27
|
-
const [e, p] = f(S), V = () => {
|
|
27
|
+
const [e, p] = f(S), [a, V] = f(0), w = () => {
|
|
28
28
|
e === o.LIST ? p(o.GRID) : p(o.LIST);
|
|
29
|
-
},
|
|
29
|
+
}, v = !s && r.items.length === 0, y = i && i.sortDropdownProps && c.filter((n) => n.type !== "multiSelect" && n.type !== "enum").map((n) => n.textValue), {
|
|
30
30
|
iconColumnVariant: C
|
|
31
|
-
} = l || {},
|
|
31
|
+
} = l || {}, L = C && C === b.COLUMN;
|
|
32
32
|
return /* @__PURE__ */ t(T, {
|
|
33
33
|
children: /* @__PURE__ */ t("div", {
|
|
34
34
|
className: M.container,
|
|
@@ -37,17 +37,17 @@ function W({
|
|
|
37
37
|
}) : /* @__PURE__ */ h(g, {
|
|
38
38
|
children: [/* @__PURE__ */ t(k, {
|
|
39
39
|
...i,
|
|
40
|
-
isIconColumnEnabled:
|
|
41
|
-
onViewModeClick:
|
|
42
|
-
onZoomLevelChange:
|
|
43
|
-
sortableColumnNames:
|
|
40
|
+
isIconColumnEnabled: L,
|
|
41
|
+
onViewModeClick: w,
|
|
42
|
+
onZoomLevelChange: V,
|
|
43
|
+
sortableColumnNames: y,
|
|
44
44
|
viewMode: e,
|
|
45
45
|
zoomLevel: a
|
|
46
46
|
}), /* @__PURE__ */ t("div", {
|
|
47
47
|
className: M.contentContainer,
|
|
48
48
|
children: /* @__PURE__ */ h(N, {
|
|
49
49
|
children: [/* @__PURE__ */ t(m, {
|
|
50
|
-
condition:
|
|
50
|
+
condition: v,
|
|
51
51
|
children: /* @__PURE__ */ t(D, {})
|
|
52
52
|
}), /* @__PURE__ */ t(m, {
|
|
53
53
|
condition: e === o.LIST,
|
|
@@ -12,6 +12,7 @@ import { Column } from '../types';
|
|
|
12
12
|
export declare const getMockFilterGroups: (filters: FilterOption[]) => Array<FilterGroup>;
|
|
13
13
|
export declare const mockActiveFilterIds: string[];
|
|
14
14
|
export declare const mockColumnData: Column[];
|
|
15
|
+
export declare const mockColumnDataWithInlineEditingEnabled: Column[];
|
|
15
16
|
export declare const mockFilterOptions: FilterOption[];
|
|
16
17
|
export declare const mockFilterOptionsNoSelection: FilterOption[];
|
|
17
18
|
export declare const mockFilterOptionsWithCustomFilterChips: FilterOption[];
|
|
@@ -7,6 +7,7 @@ export interface Column extends Partial<ColumnProps> {
|
|
|
7
7
|
cellRenderer?: (item: Item, column: Column) => React.ReactNode | undefined;
|
|
8
8
|
headerRenderer?: (name: string, column: Column) => React.ReactNode | undefined;
|
|
9
9
|
id: string;
|
|
10
|
+
isInlineEditingEnabled?: boolean;
|
|
10
11
|
subTitle?: string;
|
|
11
12
|
textValue: string | null;
|
|
12
13
|
type: MetadataFieldType | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-view",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^11.12.0",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@box/blueprint-web": "^11.12.0",
|
|
22
22
|
"@box/blueprint-web-assets": "^4.61.3",
|
|
23
|
-
"@box/box-item-type-selector": "^0.61.
|
|
23
|
+
"@box/box-item-type-selector": "^0.61.12",
|
|
24
24
|
"@box/eslint-plugin-blueprint": "*",
|
|
25
|
-
"@box/item-icon": "^0.16.
|
|
26
|
-
"@box/metadata-filter": "^1.16.
|
|
25
|
+
"@box/item-icon": "^0.16.12",
|
|
26
|
+
"@box/metadata-filter": "^1.16.12",
|
|
27
27
|
"@box/storybook-utils": "0.13.16",
|
|
28
28
|
"@box/types": "0.2.1",
|
|
29
29
|
"@tanstack/react-virtual": "^3.10.8",
|