@box/metadata-view 0.37.2 → 0.38.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/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js +27 -22
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +103 -87
- package/dist/styles/inline-editing-cell.css +1 -1
- package/dist/types/lib/components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.d.ts +3 -2
- package/dist/types/lib/test-utils/mock-data.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import { Cell as
|
|
2
|
-
import { CaretDown as
|
|
3
|
-
import
|
|
4
|
-
import { jsx as t, jsxs as
|
|
5
|
-
import '../../../../../../styles/inline-editing-cell.css';const E = "
|
|
1
|
+
import { Cell as f, DropdownMenu as r, Button as h } from "@box/blueprint-web";
|
|
2
|
+
import { CaretDown as C } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import m from "lodash/get";
|
|
4
|
+
import { jsx as t, jsxs as p } from "react/jsx-runtime";
|
|
5
|
+
import '../../../../../../styles/inline-editing-cell.css';const E = "_inlineEditingCell_1iieg_1", w = {
|
|
6
6
|
inlineEditingCell: E
|
|
7
|
-
},
|
|
7
|
+
}, y = ({
|
|
8
8
|
column: n,
|
|
9
|
-
item:
|
|
10
|
-
onInlineEditChange:
|
|
9
|
+
item: l,
|
|
10
|
+
onInlineEditChange: s,
|
|
11
|
+
type: c
|
|
11
12
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
13
|
+
const o = `${n.id}-${l.id}`, d = m(l, n.id) || "--", e = typeof d == "string" ? [d] : d, a = (i) => {
|
|
14
|
+
if (c === "multiSelect") {
|
|
15
|
+
const g = [...e, i];
|
|
16
|
+
s(l, g, n.id);
|
|
17
|
+
}
|
|
18
|
+
c === "enum" && s(l, i, n.id);
|
|
14
19
|
};
|
|
15
|
-
return /* @__PURE__ */ t(
|
|
16
|
-
children: /* @__PURE__ */
|
|
17
|
-
children: [/* @__PURE__ */ t(
|
|
18
|
-
children: /* @__PURE__ */ t(
|
|
19
|
-
className:
|
|
20
|
-
icon:
|
|
20
|
+
return /* @__PURE__ */ t(f, {
|
|
21
|
+
children: /* @__PURE__ */ p(r.Root, {
|
|
22
|
+
children: [/* @__PURE__ */ t(r.Trigger, {
|
|
23
|
+
children: /* @__PURE__ */ t(h, {
|
|
24
|
+
className: w.inlineEditingCell,
|
|
25
|
+
icon: C,
|
|
21
26
|
variant: "secondary",
|
|
22
|
-
children: e
|
|
27
|
+
children: e.join(", ")
|
|
23
28
|
})
|
|
24
|
-
}), /* @__PURE__ */ t(
|
|
29
|
+
}), /* @__PURE__ */ t(r.Content, {
|
|
25
30
|
align: "start",
|
|
26
|
-
children: n.inlineEditingOptions
|
|
31
|
+
children: n.inlineEditingOptions.map((i) => /* @__PURE__ */ t(r.CheckboxItem, {
|
|
27
32
|
checked: e === i || (e == null ? void 0 : e.includes(i)),
|
|
28
|
-
onSelect: () =>
|
|
33
|
+
onSelect: () => a(i),
|
|
29
34
|
children: i
|
|
30
35
|
}, i))
|
|
31
36
|
})]
|
|
32
37
|
})
|
|
33
|
-
},
|
|
38
|
+
}, o);
|
|
34
39
|
};
|
|
35
40
|
export {
|
|
36
|
-
|
|
41
|
+
y as default
|
|
37
42
|
};
|
|
@@ -1,174 +1,190 @@
|
|
|
1
|
-
import { TableBody as
|
|
2
|
-
import { ItemTypeIcon as
|
|
1
|
+
import { TableBody as C, Row as S, Cell as I, ActionCell as b, Text as N } from "@box/blueprint-web";
|
|
2
|
+
import { ItemTypeIcon as L } from "@box/item-icon";
|
|
3
3
|
import x from "clsx";
|
|
4
4
|
import T from "lodash/get";
|
|
5
|
-
import
|
|
5
|
+
import d from "react";
|
|
6
6
|
import { I as h } from "../../../../../chunks/types.js";
|
|
7
7
|
import { THUMBNAIL_LIST_VIEW_HEIGHTS as R } from "../../constants.js";
|
|
8
|
-
import
|
|
9
|
-
import { s as
|
|
8
|
+
import w from "./ghost-row/ghost-row.js";
|
|
9
|
+
import { s as m, T as g } from "../../../../../chunks/table-row.js";
|
|
10
10
|
import { jsx as r, jsxs as u } from "react/jsx-runtime";
|
|
11
|
-
import
|
|
11
|
+
import $ from "./inline-editing-cell/inline-editing-cell.js";
|
|
12
12
|
import { ItemActionMenu as B } from "../../item-action-menu/item-action-menu.js";
|
|
13
|
-
const _ = /* @__PURE__ */
|
|
13
|
+
const _ = /* @__PURE__ */ d.memo(({
|
|
14
14
|
item: t,
|
|
15
15
|
column: e,
|
|
16
|
-
iconColumnVariant:
|
|
16
|
+
iconColumnVariant: l
|
|
17
17
|
}) => {
|
|
18
18
|
const {
|
|
19
19
|
id: o,
|
|
20
|
-
subtitle:
|
|
21
|
-
} = e,
|
|
22
|
-
return /* @__PURE__ */ r(
|
|
20
|
+
subtitle: a
|
|
21
|
+
} = e, c = `${e.textValue}-${t.id}`;
|
|
22
|
+
return /* @__PURE__ */ r(I, {
|
|
23
23
|
children: /* @__PURE__ */ u("div", {
|
|
24
|
-
className:
|
|
25
|
-
children: [/* @__PURE__ */ r(
|
|
24
|
+
className: m.tableNameCell,
|
|
25
|
+
children: [/* @__PURE__ */ r(L, {
|
|
26
26
|
item: t
|
|
27
27
|
}), /* @__PURE__ */ u("div", {
|
|
28
28
|
className: x({
|
|
29
|
-
[
|
|
29
|
+
[m.tableNameCellSubtitle]: l === h.INLINE_SUBTITLE
|
|
30
30
|
}),
|
|
31
31
|
children: [/* @__PURE__ */ r(N, {
|
|
32
32
|
as: "span",
|
|
33
33
|
children: T(t, o)
|
|
34
|
-
}),
|
|
34
|
+
}), l === h.INLINE_SUBTITLE && /* @__PURE__ */ r(N, {
|
|
35
35
|
as: "span",
|
|
36
36
|
color: "textOnLightSecondary",
|
|
37
|
-
children:
|
|
37
|
+
children: a
|
|
38
38
|
})]
|
|
39
39
|
})]
|
|
40
40
|
})
|
|
41
|
-
},
|
|
42
|
-
}), k = /* @__PURE__ */
|
|
41
|
+
}, c);
|
|
42
|
+
}), k = /* @__PURE__ */ d.memo(({
|
|
43
43
|
item: t,
|
|
44
44
|
column: e
|
|
45
45
|
}) => {
|
|
46
46
|
var o;
|
|
47
|
-
const
|
|
48
|
-
return /* @__PURE__ */ r(
|
|
47
|
+
const l = `${e.textValue}-${t.id}`;
|
|
48
|
+
return /* @__PURE__ */ r(I, {
|
|
49
49
|
children: (o = e.cellRenderer) == null ? void 0 : o.call(e, t, e)
|
|
50
|
-
},
|
|
51
|
-
}), U = /* @__PURE__ */
|
|
50
|
+
}, l);
|
|
51
|
+
}), U = /* @__PURE__ */ d.memo(({
|
|
52
52
|
item: t,
|
|
53
53
|
column: e
|
|
54
54
|
}) => {
|
|
55
|
-
const
|
|
56
|
-
return o ? /* @__PURE__ */ r(
|
|
55
|
+
const l = `${e.textValue}-${t.id}`, o = T(t, e.id);
|
|
56
|
+
return o ? /* @__PURE__ */ r(I, {
|
|
57
57
|
children: o.join(" ")
|
|
58
|
-
},
|
|
59
|
-
}), W = /* @__PURE__ */
|
|
58
|
+
}, l) : /* @__PURE__ */ r(I, {}, l);
|
|
59
|
+
}), W = /* @__PURE__ */ d.memo(({
|
|
60
60
|
item: t,
|
|
61
61
|
column: e
|
|
62
62
|
}) => {
|
|
63
|
-
const
|
|
64
|
-
return /* @__PURE__ */ r(
|
|
63
|
+
const l = `${e.textValue}-${t.id}`;
|
|
64
|
+
return /* @__PURE__ */ r(I, {
|
|
65
65
|
children: /* @__PURE__ */ r(N, {
|
|
66
66
|
as: "span",
|
|
67
67
|
children: T(t, e.id)
|
|
68
68
|
})
|
|
69
|
-
},
|
|
70
|
-
}), j = /* @__PURE__ */
|
|
69
|
+
}, l);
|
|
70
|
+
}), j = /* @__PURE__ */ d.memo(({
|
|
71
71
|
item: t,
|
|
72
72
|
column: e,
|
|
73
|
-
iconColumnVariant:
|
|
73
|
+
iconColumnVariant: l,
|
|
74
74
|
onInlineEditChange: o
|
|
75
75
|
}) => {
|
|
76
76
|
const {
|
|
77
|
-
cellRenderer:
|
|
78
|
-
id:
|
|
77
|
+
cellRenderer: a,
|
|
78
|
+
id: c,
|
|
79
79
|
isInlineEditingEnabled: p,
|
|
80
|
-
type:
|
|
80
|
+
type: s
|
|
81
81
|
} = e;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
if (c === "name" && (l === h.INLINE || l === h.INLINE_SUBTITLE))
|
|
83
|
+
return /* @__PURE__ */ r(_, {
|
|
84
|
+
column: e,
|
|
85
|
+
iconColumnVariant: l,
|
|
86
|
+
item: t
|
|
87
|
+
});
|
|
88
|
+
if (a)
|
|
89
|
+
return /* @__PURE__ */ r(k, {
|
|
90
|
+
column: e,
|
|
91
|
+
item: t
|
|
92
|
+
});
|
|
93
|
+
if (p) {
|
|
94
|
+
if (s === "multiSelect")
|
|
95
|
+
return /* @__PURE__ */ r($, {
|
|
96
|
+
column: e,
|
|
97
|
+
item: t,
|
|
98
|
+
onInlineEditChange: o,
|
|
99
|
+
type: s
|
|
100
|
+
});
|
|
101
|
+
if (s === "enum")
|
|
102
|
+
return /* @__PURE__ */ r($, {
|
|
103
|
+
column: e,
|
|
104
|
+
item: t,
|
|
105
|
+
onInlineEditChange: o,
|
|
106
|
+
type: s
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return s === "multiSelect" ? /* @__PURE__ */ r(U, {
|
|
90
110
|
column: e,
|
|
91
111
|
item: t
|
|
92
|
-
}) : p && I === "enum" ? /* @__PURE__ */ r(w, {
|
|
93
|
-
column: e,
|
|
94
|
-
item: t,
|
|
95
|
-
onInlineEditChange: o
|
|
96
112
|
}) : /* @__PURE__ */ r(W, {
|
|
97
113
|
column: e,
|
|
98
114
|
item: t
|
|
99
115
|
});
|
|
100
|
-
}), D = /* @__PURE__ */
|
|
116
|
+
}), D = /* @__PURE__ */ d.memo(({
|
|
101
117
|
item: t,
|
|
102
118
|
zoomLevel: e
|
|
103
|
-
}) => /* @__PURE__ */ r(
|
|
119
|
+
}) => /* @__PURE__ */ r(I, {
|
|
104
120
|
style: {
|
|
105
121
|
height: R[e]
|
|
106
122
|
},
|
|
107
|
-
children: /* @__PURE__ */ r(
|
|
108
|
-
className:
|
|
123
|
+
children: /* @__PURE__ */ r(L, {
|
|
124
|
+
className: m.iconCell,
|
|
109
125
|
item: t
|
|
110
126
|
})
|
|
111
|
-
}, `item-type-icon-${t.id}`)), G = /* @__PURE__ */
|
|
127
|
+
}, `item-type-icon-${t.id}`)), G = /* @__PURE__ */ d.memo(({
|
|
112
128
|
item: t,
|
|
113
129
|
itemActionMenuProps: e
|
|
114
130
|
}) => /* @__PURE__ */ r(b, {
|
|
115
|
-
children: (
|
|
131
|
+
children: (l) => e ? /* @__PURE__ */ r(B, {
|
|
116
132
|
...e,
|
|
117
133
|
item: t,
|
|
118
|
-
onOpenChange:
|
|
134
|
+
onOpenChange: l
|
|
119
135
|
}) : null
|
|
120
136
|
})), Y = ({
|
|
121
137
|
columns: t,
|
|
122
138
|
iconColumnVariant: e,
|
|
123
|
-
isSelectAllEnabled:
|
|
139
|
+
isSelectAllEnabled: l,
|
|
124
140
|
items: o,
|
|
125
|
-
itemActionMenuProps:
|
|
126
|
-
virtualItems:
|
|
141
|
+
itemActionMenuProps: a,
|
|
142
|
+
virtualItems: c,
|
|
127
143
|
columnCount: p,
|
|
128
|
-
zoomLevel:
|
|
129
|
-
onInlineEditChange:
|
|
144
|
+
zoomLevel: s,
|
|
145
|
+
onInlineEditChange: y
|
|
130
146
|
}) => {
|
|
131
147
|
const E = e === h.COLUMN;
|
|
132
|
-
if (
|
|
133
|
-
const
|
|
148
|
+
if (c) {
|
|
149
|
+
const n = (i) => /* @__PURE__ */ r(w, {
|
|
134
150
|
columnLength: p || 0,
|
|
135
|
-
rowKey: `ghost-${
|
|
136
|
-
}),
|
|
151
|
+
rowKey: `ghost-${i}`
|
|
152
|
+
}), f = (i) => /* @__PURE__ */ r(g, {
|
|
137
153
|
columns: t,
|
|
138
154
|
iconColumnVariant: e,
|
|
139
|
-
isSelectAllEnabled:
|
|
140
|
-
item:
|
|
141
|
-
itemActionMenuProps:
|
|
142
|
-
zoomLevel:
|
|
155
|
+
isSelectAllEnabled: l,
|
|
156
|
+
item: i,
|
|
157
|
+
itemActionMenuProps: a,
|
|
158
|
+
zoomLevel: s
|
|
143
159
|
});
|
|
144
|
-
return /* @__PURE__ */ r(
|
|
145
|
-
items:
|
|
160
|
+
return /* @__PURE__ */ r(C, {
|
|
161
|
+
items: c,
|
|
146
162
|
children: ({
|
|
147
|
-
index:
|
|
148
|
-
}) =>
|
|
163
|
+
index: i
|
|
164
|
+
}) => i >= o.length ? n(i) : f(o[i])
|
|
149
165
|
});
|
|
150
166
|
}
|
|
151
|
-
return /* @__PURE__ */ r(
|
|
152
|
-
items: o.map((
|
|
153
|
-
key:
|
|
154
|
-
...
|
|
167
|
+
return /* @__PURE__ */ r(C, {
|
|
168
|
+
items: o.map((n) => ({
|
|
169
|
+
key: n.id,
|
|
170
|
+
...n
|
|
155
171
|
})),
|
|
156
|
-
children: (
|
|
157
|
-
className:
|
|
158
|
-
id:
|
|
172
|
+
children: (n) => /* @__PURE__ */ u(S, {
|
|
173
|
+
className: m.tableRow,
|
|
174
|
+
id: n.id,
|
|
159
175
|
children: [E && /* @__PURE__ */ r(D, {
|
|
160
|
-
item:
|
|
161
|
-
zoomLevel:
|
|
162
|
-
}), t.map((
|
|
163
|
-
column:
|
|
176
|
+
item: n,
|
|
177
|
+
zoomLevel: s
|
|
178
|
+
}), t.map((f) => /* @__PURE__ */ r(j, {
|
|
179
|
+
column: f,
|
|
164
180
|
iconColumnVariant: e,
|
|
165
|
-
item:
|
|
166
|
-
onInlineEditChange:
|
|
167
|
-
}, `${
|
|
168
|
-
item:
|
|
169
|
-
itemActionMenuProps:
|
|
181
|
+
item: n,
|
|
182
|
+
onInlineEditChange: y
|
|
183
|
+
}, `${f.textValue}-${n.id}`)), l && /* @__PURE__ */ r(G, {
|
|
184
|
+
item: n,
|
|
185
|
+
itemActionMenuProps: a
|
|
170
186
|
})]
|
|
171
|
-
},
|
|
187
|
+
}, n.id)
|
|
172
188
|
});
|
|
173
189
|
};
|
|
174
190
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._inlineEditingCell_1iieg_1._inlineEditingCell_1iieg_1._inlineEditingCell_1iieg_1{display:inline-flex;gap:var(--space-2);align-items:center;justify-content:flex-start;width:100%;padding:var(--space-1);font-weight:var(--font-weights-regular);background-color:transparent;border:transparent}._inlineEditingCell_1iieg_1._inlineEditingCell_1iieg_1._inlineEditingCell_1iieg_1:hover{background-color:transparent;border:transparent}._inlineEditingCell_1iieg_1._inlineEditingCell_1iieg_1._inlineEditingCell_1iieg_1>span{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
|
|
@@ -3,7 +3,8 @@ import { Column } from '../../../../types';
|
|
|
3
3
|
interface InlineEditingCellProps {
|
|
4
4
|
column: Column;
|
|
5
5
|
item: Item;
|
|
6
|
-
onInlineEditChange: (item: Item,
|
|
6
|
+
onInlineEditChange: (item: Item, selection: string | string[], columnId: string) => void;
|
|
7
|
+
type: 'multiSelect' | 'enum';
|
|
7
8
|
}
|
|
8
|
-
declare const InlineEditingCell: ({ column, item, onInlineEditChange }: InlineEditingCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const InlineEditingCell: ({ column, item, onInlineEditChange, type }: InlineEditingCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export default InlineEditingCell;
|
|
@@ -13,6 +13,7 @@ export declare const getMockFilterGroups: (filters: FilterOption[]) => Array<Fil
|
|
|
13
13
|
export declare const mockActiveFilterIds: string[];
|
|
14
14
|
export declare const mockColumnData: Column[];
|
|
15
15
|
export declare const mockColumnDataWithInlineEditingEnabled: Column[];
|
|
16
|
+
export declare const mockColumnDataWithInlineEditingEnabledAndMultiSelect: Column[];
|
|
16
17
|
export declare const mockFilterOptions: FilterOption[];
|
|
17
18
|
export declare const mockFilterOptionsNoSelection: FilterOption[];
|
|
18
19
|
export declare const mockFilterOptionsWithCustomFilterChips: FilterOption[];
|