@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.
@@ -1,37 +1,42 @@
1
- import { Cell as c, DropdownMenu as l, Button as a } from "@box/blueprint-web";
2
- import { CaretDown as g } from "@box/blueprint-web-assets/icons/Fill";
3
- import h from "lodash/get";
4
- import { jsx as t, jsxs as C } from "react/jsx-runtime";
5
- import '../../../../../../styles/inline-editing-cell.css';const E = "_inlineEditingCell_1xsiq_1", p = {
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
- }, I = ({
7
+ }, y = ({
8
8
  column: n,
9
- item: d,
10
- onInlineEditChange: r
9
+ item: l,
10
+ onInlineEditChange: s,
11
+ type: c
11
12
  }) => {
12
- const s = `${n.id}-${d.id}`, e = h(d, n.id) || "--", o = (i, f) => {
13
- r(d, i, n.id);
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(c, {
16
- children: /* @__PURE__ */ C(l.Root, {
17
- children: [/* @__PURE__ */ t(l.Trigger, {
18
- children: /* @__PURE__ */ t(a, {
19
- className: p.inlineEditingCell,
20
- icon: g,
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(l.Content, {
29
+ }), /* @__PURE__ */ t(r.Content, {
25
30
  align: "start",
26
- children: n.inlineEditingOptions && n.inlineEditingOptions.map((i) => /* @__PURE__ */ t(l.CheckboxItem, {
31
+ children: n.inlineEditingOptions.map((i) => /* @__PURE__ */ t(r.CheckboxItem, {
27
32
  checked: e === i || (e == null ? void 0 : e.includes(i)),
28
- onSelect: () => o(i, n.id),
33
+ onSelect: () => a(i),
29
34
  children: i
30
35
  }, i))
31
36
  })]
32
37
  })
33
- }, s);
38
+ }, o);
34
39
  };
35
40
  export {
36
- I as default
41
+ y as default
37
42
  };
@@ -1,174 +1,190 @@
1
- import { TableBody as y, Row as L, Cell as c, ActionCell as b, Text as N } from "@box/blueprint-web";
2
- import { ItemTypeIcon as $ } from "@box/item-icon";
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 i from "react";
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 S from "./ghost-row/ghost-row.js";
9
- import { s as f, T as g } from "../../../../../chunks/table-row.js";
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 w from "./inline-editing-cell/inline-editing-cell.js";
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__ */ i.memo(({
13
+ const _ = /* @__PURE__ */ d.memo(({
14
14
  item: t,
15
15
  column: e,
16
- iconColumnVariant: n
16
+ iconColumnVariant: l
17
17
  }) => {
18
18
  const {
19
19
  id: o,
20
- subtitle: d
21
- } = e, a = `${e.textValue}-${t.id}`;
22
- return /* @__PURE__ */ r(c, {
20
+ subtitle: a
21
+ } = e, c = `${e.textValue}-${t.id}`;
22
+ return /* @__PURE__ */ r(I, {
23
23
  children: /* @__PURE__ */ u("div", {
24
- className: f.tableNameCell,
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
- [f.tableNameCellSubtitle]: n === h.INLINE_SUBTITLE
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
- }), n === h.INLINE_SUBTITLE && /* @__PURE__ */ r(N, {
34
+ }), l === h.INLINE_SUBTITLE && /* @__PURE__ */ r(N, {
35
35
  as: "span",
36
36
  color: "textOnLightSecondary",
37
- children: d
37
+ children: a
38
38
  })]
39
39
  })]
40
40
  })
41
- }, a);
42
- }), k = /* @__PURE__ */ i.memo(({
41
+ }, c);
42
+ }), k = /* @__PURE__ */ d.memo(({
43
43
  item: t,
44
44
  column: e
45
45
  }) => {
46
46
  var o;
47
- const n = `${e.textValue}-${t.id}`;
48
- return /* @__PURE__ */ r(c, {
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
- }, n);
51
- }), U = /* @__PURE__ */ i.memo(({
50
+ }, l);
51
+ }), U = /* @__PURE__ */ d.memo(({
52
52
  item: t,
53
53
  column: e
54
54
  }) => {
55
- const n = `${e.textValue}-${t.id}`, o = T(t, e.id);
56
- return o ? /* @__PURE__ */ r(c, {
55
+ const l = `${e.textValue}-${t.id}`, o = T(t, e.id);
56
+ return o ? /* @__PURE__ */ r(I, {
57
57
  children: o.join(" ")
58
- }, n) : /* @__PURE__ */ r(c, {}, n);
59
- }), W = /* @__PURE__ */ i.memo(({
58
+ }, l) : /* @__PURE__ */ r(I, {}, l);
59
+ }), W = /* @__PURE__ */ d.memo(({
60
60
  item: t,
61
61
  column: e
62
62
  }) => {
63
- const n = `${e.textValue}-${t.id}`;
64
- return /* @__PURE__ */ r(c, {
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
- }, n);
70
- }), j = /* @__PURE__ */ i.memo(({
69
+ }, l);
70
+ }), j = /* @__PURE__ */ d.memo(({
71
71
  item: t,
72
72
  column: e,
73
- iconColumnVariant: n,
73
+ iconColumnVariant: l,
74
74
  onInlineEditChange: o
75
75
  }) => {
76
76
  const {
77
- cellRenderer: d,
78
- id: a,
77
+ cellRenderer: a,
78
+ id: c,
79
79
  isInlineEditingEnabled: p,
80
- type: I
80
+ type: s
81
81
  } = e;
82
- return a === "name" && (n === h.INLINE || n === h.INLINE_SUBTITLE) ? /* @__PURE__ */ r(_, {
83
- column: e,
84
- iconColumnVariant: n,
85
- item: t
86
- }) : d ? /* @__PURE__ */ r(k, {
87
- column: e,
88
- item: t
89
- }) : I === "multiSelect" ? /* @__PURE__ */ r(U, {
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__ */ i.memo(({
116
+ }), D = /* @__PURE__ */ d.memo(({
101
117
  item: t,
102
118
  zoomLevel: e
103
- }) => /* @__PURE__ */ r(c, {
119
+ }) => /* @__PURE__ */ r(I, {
104
120
  style: {
105
121
  height: R[e]
106
122
  },
107
- children: /* @__PURE__ */ r($, {
108
- className: f.iconCell,
123
+ children: /* @__PURE__ */ r(L, {
124
+ className: m.iconCell,
109
125
  item: t
110
126
  })
111
- }, `item-type-icon-${t.id}`)), G = /* @__PURE__ */ i.memo(({
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: (n) => e ? /* @__PURE__ */ r(B, {
131
+ children: (l) => e ? /* @__PURE__ */ r(B, {
116
132
  ...e,
117
133
  item: t,
118
- onOpenChange: n
134
+ onOpenChange: l
119
135
  }) : null
120
136
  })), Y = ({
121
137
  columns: t,
122
138
  iconColumnVariant: e,
123
- isSelectAllEnabled: n,
139
+ isSelectAllEnabled: l,
124
140
  items: o,
125
- itemActionMenuProps: d,
126
- virtualItems: a,
141
+ itemActionMenuProps: a,
142
+ virtualItems: c,
127
143
  columnCount: p,
128
- zoomLevel: I,
129
- onInlineEditChange: C
144
+ zoomLevel: s,
145
+ onInlineEditChange: y
130
146
  }) => {
131
147
  const E = e === h.COLUMN;
132
- if (a) {
133
- const l = (s) => /* @__PURE__ */ r(S, {
148
+ if (c) {
149
+ const n = (i) => /* @__PURE__ */ r(w, {
134
150
  columnLength: p || 0,
135
- rowKey: `ghost-${s}`
136
- }), m = (s) => /* @__PURE__ */ r(g, {
151
+ rowKey: `ghost-${i}`
152
+ }), f = (i) => /* @__PURE__ */ r(g, {
137
153
  columns: t,
138
154
  iconColumnVariant: e,
139
- isSelectAllEnabled: n,
140
- item: s,
141
- itemActionMenuProps: d,
142
- zoomLevel: I
155
+ isSelectAllEnabled: l,
156
+ item: i,
157
+ itemActionMenuProps: a,
158
+ zoomLevel: s
143
159
  });
144
- return /* @__PURE__ */ r(y, {
145
- items: a,
160
+ return /* @__PURE__ */ r(C, {
161
+ items: c,
146
162
  children: ({
147
- index: s
148
- }) => s >= o.length ? l(s) : m(o[s])
163
+ index: i
164
+ }) => i >= o.length ? n(i) : f(o[i])
149
165
  });
150
166
  }
151
- return /* @__PURE__ */ r(y, {
152
- items: o.map((l) => ({
153
- key: l.id,
154
- ...l
167
+ return /* @__PURE__ */ r(C, {
168
+ items: o.map((n) => ({
169
+ key: n.id,
170
+ ...n
155
171
  })),
156
- children: (l) => /* @__PURE__ */ u(L, {
157
- className: f.tableRow,
158
- id: l.id,
172
+ children: (n) => /* @__PURE__ */ u(S, {
173
+ className: m.tableRow,
174
+ id: n.id,
159
175
  children: [E && /* @__PURE__ */ r(D, {
160
- item: l,
161
- zoomLevel: I
162
- }), t.map((m) => /* @__PURE__ */ r(j, {
163
- column: m,
176
+ item: n,
177
+ zoomLevel: s
178
+ }), t.map((f) => /* @__PURE__ */ r(j, {
179
+ column: f,
164
180
  iconColumnVariant: e,
165
- item: l,
166
- onInlineEditChange: C
167
- }, `${m.textValue}-${l.id}`)), n && /* @__PURE__ */ r(G, {
168
- item: l,
169
- itemActionMenuProps: d
181
+ item: n,
182
+ onInlineEditChange: y
183
+ }, `${f.textValue}-${n.id}`)), l && /* @__PURE__ */ r(G, {
184
+ item: n,
185
+ itemActionMenuProps: a
170
186
  })]
171
- }, l.id)
187
+ }, n.id)
172
188
  });
173
189
  };
174
190
  export {
@@ -1 +1 @@
1
- ._inlineEditingCell_1xsiq_1._inlineEditingCell_1xsiq_1._inlineEditingCell_1xsiq_1{display:inline-flex;gap:var(--space-2);align-items:center;padding:var(--space-1);font-weight:var(--font-weights-regular);background-color:transparent;border:transparent}._inlineEditingCell_1xsiq_1._inlineEditingCell_1xsiq_1._inlineEditingCell_1xsiq_1:hover{background-color:transparent;border:transparent}
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, value: string, columnId: string) => void;
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[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "0.37.2",
3
+ "version": "0.38.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^11.12.0",