@box/metadata-view 0.37.2 → 0.39.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 +41 -34
- package/dist/esm/lib/components/filter-row/index.js +3 -2
- package/dist/esm/lib/components/filter-row/initial-field-values.js +16 -12
- 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/filter-row/filter-row.d.ts +8 -4
- package/dist/types/lib/components/filter-row/initial-field-values.d.ts +3 -3
- package/dist/types/lib/components/filter-row/types.d.ts +4 -0
- 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 +3 -1
- package/package.json +1 -1
|
@@ -1,47 +1,53 @@
|
|
|
1
|
-
import { FilterChip as
|
|
1
|
+
import { FilterChip as I } from "@box/blueprint-web";
|
|
2
2
|
import { Formik as S, Form as v } from "formik";
|
|
3
|
-
import { useState as
|
|
4
|
-
import
|
|
5
|
-
import { getInitialFieldValues as
|
|
3
|
+
import { useState as g, useEffect as w, useRef as C } from "react";
|
|
4
|
+
import G from "./all-filters-chip.js";
|
|
5
|
+
import { getInitialFieldValues as R } from "./initial-field-values.js";
|
|
6
6
|
import { MetadataFilterChip as j } from "./metadata-filter-chip.js";
|
|
7
|
-
import { usePredefinedFilter as
|
|
8
|
-
import { s as
|
|
9
|
-
import { jsx as
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import { usePredefinedFilter as x } from "./predefinedFilters/use-predefined-filter.js";
|
|
8
|
+
import { s as V } from "../../../../chunks/form-filter-chip.js";
|
|
9
|
+
import { jsx as l, jsxs as b } from "react/jsx-runtime";
|
|
10
|
+
const p = (s) => Object.entries(s).filter(([r, t]) => {
|
|
11
|
+
var i;
|
|
12
|
+
return ((i = t.value) == null ? void 0 : i.enum) && t.value.enum.length > 0 && t.value.enum[0] !== "";
|
|
13
|
+
}).map(([r]) => r), z = ({
|
|
14
|
+
predefinedFilterOptions: s,
|
|
15
|
+
filterGroups: r = [],
|
|
16
|
+
initialFilterValues: t,
|
|
17
|
+
isAllFiltersDisabled: i,
|
|
18
|
+
onFilterSubmit: o
|
|
15
19
|
}) => {
|
|
16
|
-
const [
|
|
17
|
-
var r;
|
|
18
|
-
return ((r = t.value) == null ? void 0 : r.enum) && t.value.enum.length > 0;
|
|
19
|
-
}, h = ({
|
|
20
|
+
const [a, m] = g([]), f = x(s), F = ({
|
|
20
21
|
metadata: {
|
|
21
22
|
fields: e
|
|
22
23
|
}
|
|
23
24
|
}) => {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
},
|
|
25
|
+
const h = p(e);
|
|
26
|
+
m(h), o && o(e);
|
|
27
|
+
}, n = [...f, ...r], d = n.flatMap(({
|
|
27
28
|
filters: e
|
|
28
|
-
}) => e),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
}) => e), u = R(d, t);
|
|
30
|
+
w(() => {
|
|
31
|
+
const e = p(u.metadata.fields);
|
|
32
|
+
m(e);
|
|
33
|
+
}, []);
|
|
34
|
+
const c = C(null);
|
|
35
|
+
return /* @__PURE__ */ l(S, {
|
|
36
|
+
initialValues: u,
|
|
37
|
+
onSubmit: F,
|
|
38
|
+
children: /* @__PURE__ */ l(v, {
|
|
39
|
+
ref: c,
|
|
40
|
+
children: /* @__PURE__ */ b(I.Group, {
|
|
41
|
+
className: V.filterChipGroup,
|
|
36
42
|
name: "metadata-view-filters",
|
|
37
43
|
type: "multiple",
|
|
38
|
-
children: [
|
|
39
|
-
activeFilterCount:
|
|
40
|
-
filterGroups:
|
|
41
|
-
}),
|
|
44
|
+
children: [i ? null : /* @__PURE__ */ l(G, {
|
|
45
|
+
activeFilterCount: a.length,
|
|
46
|
+
filterGroups: n
|
|
47
|
+
}), d.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ l(j, {
|
|
42
48
|
filterOption: e,
|
|
43
|
-
formRef:
|
|
44
|
-
selected:
|
|
49
|
+
formRef: c,
|
|
50
|
+
selected: a.includes(e.id)
|
|
45
51
|
}, e.id))]
|
|
46
52
|
})
|
|
47
53
|
})
|
|
@@ -49,5 +55,6 @@ const z = ({
|
|
|
49
55
|
};
|
|
50
56
|
export {
|
|
51
57
|
z as FilterRow,
|
|
52
|
-
z as default
|
|
58
|
+
z as default,
|
|
59
|
+
p as getSelectedFilterIds
|
|
53
60
|
};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
const
|
|
2
|
-
key:
|
|
3
|
-
id:
|
|
4
|
-
}),
|
|
5
|
-
fieldType:
|
|
6
|
-
options:
|
|
7
|
-
}) => ["enum", "multiSelect"].includes(
|
|
1
|
+
const r = (t) => ({
|
|
2
|
+
key: t,
|
|
3
|
+
id: t
|
|
4
|
+
}), c = ({
|
|
5
|
+
fieldType: t,
|
|
6
|
+
options: e
|
|
7
|
+
}) => ["enum", "multiSelect"].includes(t) ? (e || []).map(r) : [], l = (t, e) => ({
|
|
8
8
|
metadata: {
|
|
9
|
-
fields:
|
|
10
|
-
|
|
9
|
+
fields: t.reduce((a, n) => {
|
|
10
|
+
var i;
|
|
11
|
+
const u = (i = e == null ? void 0 : e[n.id]) == null ? void 0 : i.value, o = {
|
|
11
12
|
enum: []
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
};
|
|
14
|
+
return a[n.id] = {
|
|
15
|
+
value: u || o,
|
|
16
|
+
options: c(n)
|
|
17
|
+
}, a;
|
|
18
|
+
}, {})
|
|
15
19
|
}
|
|
16
20
|
});
|
|
17
21
|
export {
|
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}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { MetadataTemplateField } from '@box/metadata-filter';
|
|
2
|
-
import { FilterGroup } from './types';
|
|
3
1
|
import { PredefinedFilterOptions } from './predefinedFilters/types';
|
|
2
|
+
import { FilterGroup, FilterValues } from './types';
|
|
4
3
|
export interface FilterRowProps {
|
|
5
4
|
predefinedFilterOptions?: Partial<PredefinedFilterOptions>;
|
|
6
5
|
filterGroups?: Array<FilterGroup>;
|
|
6
|
+
initialFilterValues?: FilterValues;
|
|
7
7
|
isAllFiltersDisabled?: boolean;
|
|
8
|
-
onFilterSubmit?: (fields:
|
|
8
|
+
onFilterSubmit?: (fields: FilterValues) => void;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Extracts selected filter IDs from filter values
|
|
12
|
+
*/
|
|
13
|
+
export declare const getSelectedFilterIds: (fields: FilterValues) => string[];
|
|
14
|
+
export declare const FilterRow: ({ predefinedFilterOptions, filterGroups: customFilterGroups, initialFilterValues: customFilterValues, isAllFiltersDisabled, onFilterSubmit, }: FilterRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
15
|
export default FilterRow;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FilterOption } from './types';
|
|
3
|
-
export declare const getInitialFieldValues: (filterOptions: FilterOption[]) => {
|
|
1
|
+
import { MetadataFormFieldValue, MetadataTemplateFieldOption } from '@box/metadata-filter';
|
|
2
|
+
import { FilterOption, FilterValues } from './types';
|
|
3
|
+
export declare const getInitialFieldValues: (filterOptions: FilterOption[], customFieldValues?: FilterValues) => {
|
|
4
4
|
metadata: {
|
|
5
5
|
fields: Record<string, {
|
|
6
6
|
value: MetadataFormFieldValue;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MetadataFormFieldValue } from '@box/metadata-filter';
|
|
1
2
|
import { ReactNode } from 'react';
|
|
2
3
|
import { FilterVariant, MetadataFieldType } from '../../types';
|
|
3
4
|
export interface FilterGroup {
|
|
@@ -26,3 +27,6 @@ export interface FilterChipProps {
|
|
|
26
27
|
name: string;
|
|
27
28
|
selected: boolean;
|
|
28
29
|
}
|
|
30
|
+
export type FilterValues = Record<string, {
|
|
31
|
+
value: MetadataFormFieldValue;
|
|
32
|
+
}>;
|
|
@@ -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;
|
|
@@ -2,7 +2,7 @@ import { Item } from '@box/types';
|
|
|
2
2
|
import { SortDirection } from 'react-aria-components';
|
|
3
3
|
import { ActionBarProps } from '../components/action-bar/action-bar';
|
|
4
4
|
import { FilterRowProps } from '../components/filter-row/filter-row';
|
|
5
|
-
import { FilterGroup, FilterOption } from '../components/filter-row/types';
|
|
5
|
+
import { FilterGroup, FilterOption, FilterValues } from '../components/filter-row/types';
|
|
6
6
|
import { ItemActionMenuProps } from '../components/item-action-menu/item-action-menu';
|
|
7
7
|
import { MetadataTableProps } from '../components/metadata-table';
|
|
8
8
|
import { PaginationProps } from '../components/pagination/pagination';
|
|
@@ -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[];
|
|
@@ -91,3 +92,4 @@ export type SortArgs = {
|
|
|
91
92
|
direction: SortDirection;
|
|
92
93
|
};
|
|
93
94
|
export declare const defaultSortArgs: SortArgs;
|
|
95
|
+
export declare const mockInitialFilterValues: FilterValues;
|