@box/metadata-view 0.29.4 → 0.30.1

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,6 +1,6 @@
1
- import { useState as C, useRef as S } from "react";
2
- import { Formik as v, Form as G } from "formik";
3
- import { FilterChip as I } from "@box/blueprint-web";
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] = C([]), u = w(n), f = ([e, t]) => {
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 = S(null);
29
- return /* @__PURE__ */ i(v, {
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(G, {
32
+ children: /* @__PURE__ */ i(v, {
33
33
  ref: a,
34
- children: /* @__PURE__ */ b(I.Group, {
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 L, Cell as a, ActionCell as x, Text as p } from "@box/blueprint-web";
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 R from "clsx";
4
- import N from "lodash/get";
5
- import d from "react";
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 S } from "../../constants.js";
8
- import b from "./ghost-row/ghost-row.js";
9
- import { s as m, T as w } from "../../../../../chunks/table-row.js";
10
- import { jsx as r, jsxs as f } from "react/jsx-runtime";
11
- import { ItemActionMenu as E } from "../../item-action-menu/item-action-menu.js";
12
- const g = /* @__PURE__ */ d.memo(({
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: o
15
+ iconColumnVariant: n
16
16
  }) => {
17
17
  const {
18
18
  id: l,
19
- subTitle: c
20
- } = e, i = `${e.textValue}-${t.id}`;
21
- return /* @__PURE__ */ r(a, {
22
- children: /* @__PURE__ */ f("div", {
23
- className: m.tableNameCell,
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__ */ f("div", {
27
- className: R({
28
- [m.tableNameCellSubTitle]: o === h.INLINE_SUBTITLE
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: N(t, l)
33
- }), o === h.INLINE_SUBTITLE && /* @__PURE__ */ r(p, {
32
+ children: T(t, l)
33
+ }), n === h.INLINE_SUBTITLE && /* @__PURE__ */ r(p, {
34
34
  as: "span",
35
35
  color: "textOnLightSecondary",
36
- children: c
36
+ children: a
37
37
  })]
38
38
  })]
39
39
  })
40
- }, i);
41
- }), B = /* @__PURE__ */ d.memo(({
40
+ }, c);
41
+ }), k = /* @__PURE__ */ s.memo(({
42
42
  item: t,
43
43
  column: e
44
44
  }) => {
45
45
  var l;
46
- const o = `${e.textValue}-${t.id}`;
47
- return /* @__PURE__ */ r(a, {
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
- }, o);
50
- }), _ = /* @__PURE__ */ d.memo(({
49
+ }, n);
50
+ }), B = /* @__PURE__ */ s.memo(({
51
51
  item: t,
52
52
  column: e
53
53
  }) => {
54
- const o = `${e.textValue}-${t.id}`, l = N(t, e.id);
55
- return l ? /* @__PURE__ */ r(a, {
54
+ const n = `${e.textValue}-${t.id}`, l = T(t, e.id);
55
+ return l ? /* @__PURE__ */ r(d, {
56
56
  children: l.join(" ")
57
- }, o) : /* @__PURE__ */ r(a, {}, o);
58
- }), k = /* @__PURE__ */ d.memo(({
57
+ }, n) : /* @__PURE__ */ r(d, {}, n);
58
+ }), _ = /* @__PURE__ */ s.memo(({
59
59
  item: t,
60
60
  column: e
61
61
  }) => {
62
- const o = `${e.textValue}-${t.id}`;
63
- return /* @__PURE__ */ r(a, {
62
+ const n = `${e.textValue}-${t.id}`;
63
+ return /* @__PURE__ */ r(d, {
64
64
  children: /* @__PURE__ */ r(p, {
65
65
  as: "span",
66
- children: N(t, e.id)
66
+ children: T(t, e.id)
67
67
  })
68
- }, o);
69
- }), U = /* @__PURE__ */ d.memo(({
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: o
83
+ iconColumnVariant: n
73
84
  }) => {
74
85
  const {
75
86
  cellRenderer: l,
76
- id: c,
77
- type: i
87
+ id: a,
88
+ isInlineEditingEnabled: c,
89
+ type: I
78
90
  } = e;
79
- return c === "name" && (o === h.INLINE || o === h.INLINE_SUBTITLE) ? /* @__PURE__ */ r(g, {
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
- }) : l ? /* @__PURE__ */ r(B, {
98
+ }) : I === "multiSelect" ? /* @__PURE__ */ r(B, {
84
99
  column: e,
85
100
  item: t
86
- }) : i === "multiSelect" ? /* @__PURE__ */ r(_, {
101
+ }) : c && I === "enum" ? /* @__PURE__ */ r(U, {
87
102
  column: e,
88
103
  item: t
89
- }) : /* @__PURE__ */ r(k, {
104
+ }) : /* @__PURE__ */ r(_, {
90
105
  column: e,
91
106
  item: t
92
107
  });
93
- }), W = /* @__PURE__ */ d.memo(({
108
+ }), j = /* @__PURE__ */ s.memo(({
94
109
  item: t,
95
110
  zoomLevel: e
96
- }) => /* @__PURE__ */ r(a, {
111
+ }) => /* @__PURE__ */ r(d, {
97
112
  style: {
98
- height: S[e]
113
+ height: b[e]
99
114
  },
100
115
  children: /* @__PURE__ */ r(C, {
101
- className: m.iconCell,
116
+ className: f.iconCell,
102
117
  item: t
103
118
  })
104
- }, `item-type-icon-${t.id}`)), j = /* @__PURE__ */ d.memo(({
119
+ }, `item-type-icon-${t.id}`)), D = /* @__PURE__ */ s.memo(({
105
120
  item: t,
106
121
  itemActionMenuProps: e
107
- }) => /* @__PURE__ */ r(x, {
108
- children: (o) => e ? /* @__PURE__ */ r(E, {
122
+ }) => /* @__PURE__ */ r(L, {
123
+ children: (n) => e ? /* @__PURE__ */ r(R, {
109
124
  ...e,
110
125
  item: t,
111
- onOpenChange: o
126
+ onOpenChange: n
112
127
  }) : null
113
- })), J = ({
128
+ })), Q = ({
114
129
  columns: t,
115
130
  iconColumnVariant: e,
116
- isSelectAllEnabled: o,
131
+ isSelectAllEnabled: n,
117
132
  items: l,
118
- itemActionMenuProps: c,
119
- virtualItems: i,
120
- columnCount: T,
133
+ itemActionMenuProps: a,
134
+ virtualItems: c,
135
+ columnCount: I,
121
136
  zoomLevel: u
122
137
  }) => {
123
138
  const $ = e === h.COLUMN;
124
- if (i) {
125
- const n = (s) => /* @__PURE__ */ r(b, {
126
- columnLength: T || 0,
127
- rowKey: `ghost-${s}`
128
- }), I = (s) => /* @__PURE__ */ r(w, {
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: o,
132
- item: s,
133
- itemActionMenuProps: c,
146
+ isSelectAllEnabled: n,
147
+ item: i,
148
+ itemActionMenuProps: a,
134
149
  zoomLevel: u
135
150
  });
136
151
  return /* @__PURE__ */ r(y, {
137
- items: i,
152
+ items: c,
138
153
  children: ({
139
- index: s
140
- }) => s >= l.length ? n(s) : I(l[s])
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((n) => ({
145
- key: n.id,
146
- ...n
159
+ items: l.map((o) => ({
160
+ key: o.id,
161
+ ...o
147
162
  })),
148
- children: (n) => /* @__PURE__ */ f(L, {
149
- className: m.tableRow,
150
- id: n.id,
151
- children: [$ && /* @__PURE__ */ r(W, {
152
- item: n,
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((I) => /* @__PURE__ */ r(U, {
155
- column: I,
169
+ }), t.map((m) => /* @__PURE__ */ r(W, {
170
+ column: m,
156
171
  iconColumnVariant: e,
157
- item: n
158
- }, `${I.textValue}-${n.id}`)), o && /* @__PURE__ */ r(j, {
159
- item: n,
160
- itemActionMenuProps: c
172
+ item: o
173
+ }, `${m.textValue}-${o.id}`)), n && /* @__PURE__ */ r(D, {
174
+ item: o,
175
+ itemActionMenuProps: a
161
176
  })]
162
- }, n.id)
177
+ }, o.id)
163
178
  });
164
179
  };
165
180
  export {
166
- J as default
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
- }, w = !s && r.items.length === 0, v = i && i.sortDropdownProps && c.filter((n) => n.type !== "multiSelect" && n.type !== "enum").map((n) => n.textValue), {
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 || {}, y = C && C === b.COLUMN, [a, L] = f(0);
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: y,
41
- onViewModeClick: V,
42
- onZoomLevelChange: L,
43
- sortableColumnNames: v,
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: w,
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.29.4",
3
+ "version": "0.30.1",
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.12",
23
+ "@box/box-item-type-selector": "^0.61.13",
24
24
  "@box/eslint-plugin-blueprint": "*",
25
- "@box/item-icon": "^0.16.12",
26
- "@box/metadata-filter": "^1.16.12",
25
+ "@box/item-icon": "^0.16.13",
26
+ "@box/metadata-filter": "^1.16.13",
27
27
  "@box/storybook-utils": "0.13.16",
28
28
  "@box/types": "0.2.1",
29
29
  "@tanstack/react-virtual": "^3.10.8",