@box/metadata-view 0.36.3 → 0.37.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/initial-field-values.js +14 -25
- package/dist/esm/lib/components/filter-row/metadata-filter-chip.js +1 -1
- package/dist/esm/lib/components/filter-row/select-filter-chip.js +43 -43
- package/dist/esm/lib/components/filter-sidepanel/filter-sidepanel.js +46 -44
- package/dist/esm/lib/components/filter-sidepanel/filter.js +69 -36
- package/dist/esm/lib/components/metadata-value/metadata-file-chip.js +15 -13
- package/dist/esm/lib/components/metadata-value/metadata-file-field.js +13 -12
- package/dist/esm/lib/components/metadata-value/metadata-radio-field.js +33 -0
- package/dist/esm/lib/components/metadata-value/metadata-search-field.js +19 -18
- package/dist/types/lib/components/filter-row/initial-field-values.d.ts +2 -1
- package/dist/types/lib/components/filter-row/types.d.ts +1 -0
- package/dist/types/lib/components/filter-sidepanel/filter.d.ts +4 -1
- package/dist/types/lib/components/metadata-value/metadata-radio-field.d.ts +6 -0
- package/dist/types/lib/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
const
|
|
1
|
+
const u = (e) => ({
|
|
2
|
+
key: e,
|
|
3
|
+
id: e
|
|
4
|
+
}), a = ({
|
|
5
|
+
fieldType: e,
|
|
6
|
+
options: t
|
|
7
|
+
}) => ["enum", "multiSelect"].includes(e) ? (t || []).map(u) : [], l = (e) => ({
|
|
2
8
|
metadata: {
|
|
3
|
-
fields:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
a = [""];
|
|
10
|
-
break;
|
|
11
|
-
case "enum":
|
|
12
|
-
case "multiSelect":
|
|
13
|
-
if (e.variant === "file") {
|
|
14
|
-
a = [];
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
e.options && (a = [...e.options]);
|
|
18
|
-
break;
|
|
19
|
-
default:
|
|
20
|
-
a = null;
|
|
21
|
-
}
|
|
22
|
-
return l[e.id] = {
|
|
23
|
-
value: a
|
|
24
|
-
}, l;
|
|
25
|
-
}, {})
|
|
9
|
+
fields: e.reduce((i, n) => (i[n.id] = {
|
|
10
|
+
value: {
|
|
11
|
+
enum: []
|
|
12
|
+
},
|
|
13
|
+
options: a(n)
|
|
14
|
+
}, i), {})
|
|
26
15
|
}
|
|
27
16
|
});
|
|
28
17
|
export {
|
|
29
|
-
|
|
18
|
+
l as getInitialFieldValues
|
|
30
19
|
};
|
|
@@ -17,6 +17,7 @@ const S = ({
|
|
|
17
17
|
variant: c
|
|
18
18
|
} = n, o = `metadata.fields.${e}`;
|
|
19
19
|
switch (r) {
|
|
20
|
+
case "date":
|
|
20
21
|
case "float":
|
|
21
22
|
case "string":
|
|
22
23
|
return /* @__PURE__ */ t(p, {
|
|
@@ -30,7 +31,6 @@ const S = ({
|
|
|
30
31
|
label: i
|
|
31
32
|
})
|
|
32
33
|
}, e);
|
|
33
|
-
case "date":
|
|
34
34
|
case "multiSelect":
|
|
35
35
|
if (c === "file")
|
|
36
36
|
return /* @__PURE__ */ t(u, {
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { DropdownMenu as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import { jsxs as
|
|
7
|
-
const
|
|
8
|
-
fieldNamePrefix:
|
|
9
|
-
formRef:
|
|
10
|
-
icon:
|
|
11
|
-
id:
|
|
12
|
-
name:
|
|
13
|
-
options:
|
|
14
|
-
type:
|
|
1
|
+
import { useState as w } from "react";
|
|
2
|
+
import { useFormikContext as I } from "formik";
|
|
3
|
+
import { DropdownMenu as a, FilterChip as c } from "@box/blueprint-web";
|
|
4
|
+
import { useIntl as O } from "react-intl";
|
|
5
|
+
import y from "./messages.js";
|
|
6
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
7
|
+
const L = ({
|
|
8
|
+
fieldNamePrefix: h,
|
|
9
|
+
formRef: u,
|
|
10
|
+
icon: l,
|
|
11
|
+
id: o,
|
|
12
|
+
name: i,
|
|
13
|
+
options: s,
|
|
14
|
+
type: d
|
|
15
15
|
}) => {
|
|
16
16
|
const {
|
|
17
|
-
formatMessage:
|
|
18
|
-
} =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
formatMessage: p
|
|
18
|
+
} = O(), [f, C] = w(!1), {
|
|
19
|
+
values: g,
|
|
20
|
+
setFieldValue: v,
|
|
21
|
+
submitForm: k
|
|
22
|
+
} = I(), x = g.metadata.fields[o].value.enum, e = new Set(x), F = e.size > 0 ? p(y.chipNameWithCount, {
|
|
23
|
+
name: i,
|
|
24
|
+
count: e.size
|
|
25
|
+
}) : i, b = async (r, n) => {
|
|
26
|
+
d === "enum" ? e.clear() : e.delete(n), r && e.add(n), await v(`${h}.value.enum`, Array.from(e)), k();
|
|
27
27
|
};
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
onOpenChange:
|
|
30
|
-
open:
|
|
31
|
-
children: [/* @__PURE__ */ t(
|
|
28
|
+
return /* @__PURE__ */ m(a.Root, {
|
|
29
|
+
onOpenChange: C,
|
|
30
|
+
open: f,
|
|
31
|
+
children: [/* @__PURE__ */ t(a.Trigger, {
|
|
32
32
|
asChild: !0,
|
|
33
|
-
children: /* @__PURE__ */
|
|
34
|
-
selected:
|
|
35
|
-
value:
|
|
36
|
-
children: [
|
|
37
|
-
icon:
|
|
38
|
-
}), /* @__PURE__ */ t(
|
|
39
|
-
children:
|
|
40
|
-
}), /* @__PURE__ */ t(
|
|
41
|
-
},
|
|
42
|
-
}), /* @__PURE__ */ t(
|
|
43
|
-
container:
|
|
44
|
-
children:
|
|
45
|
-
checked:
|
|
46
|
-
onCheckedChange: (n) =>
|
|
33
|
+
children: /* @__PURE__ */ m(c.TriggerChip, {
|
|
34
|
+
selected: e.size > 0,
|
|
35
|
+
value: o,
|
|
36
|
+
children: [l && /* @__PURE__ */ t(c.Icon, {
|
|
37
|
+
icon: l
|
|
38
|
+
}), /* @__PURE__ */ t(c.Label, {
|
|
39
|
+
children: F
|
|
40
|
+
}), /* @__PURE__ */ t(c.DropdownIndicator, {})]
|
|
41
|
+
}, o)
|
|
42
|
+
}), /* @__PURE__ */ t(a.Content, {
|
|
43
|
+
container: u.current,
|
|
44
|
+
children: s == null ? void 0 : s.map((r) => /* @__PURE__ */ t(a.CheckboxItem, {
|
|
45
|
+
checked: e.has(r),
|
|
46
|
+
onCheckedChange: (n) => b(n, r),
|
|
47
47
|
children: r
|
|
48
48
|
}, r))
|
|
49
49
|
})]
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
L as SelectFilterChip
|
|
54
54
|
};
|
|
@@ -1,72 +1,74 @@
|
|
|
1
|
-
import { SidePanel as t, Accordion as
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import { useFormikContext as
|
|
4
|
-
import
|
|
5
|
-
import { useState as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { jsx as e, jsxs as
|
|
9
|
-
const
|
|
1
|
+
import { SidePanel as t, Accordion as d } from "@box/blueprint-web";
|
|
2
|
+
import { useIntl as x } from "react-intl";
|
|
3
|
+
import { useFormikContext as B } from "formik";
|
|
4
|
+
import R from "lodash/noop";
|
|
5
|
+
import { useState as c } from "react";
|
|
6
|
+
import k from "./filter.js";
|
|
7
|
+
import n from "./messages.js";
|
|
8
|
+
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
9
|
+
const w = ({
|
|
10
10
|
filterGroups: a,
|
|
11
|
-
isOpen:
|
|
12
|
-
onIsOpenChange: i =
|
|
11
|
+
isOpen: p,
|
|
12
|
+
onIsOpenChange: i = R,
|
|
13
13
|
getInitialFormValues: h
|
|
14
14
|
}) => {
|
|
15
15
|
const {
|
|
16
|
-
formatMessage:
|
|
17
|
-
} =
|
|
18
|
-
handleSubmit:
|
|
19
|
-
resetForm:
|
|
20
|
-
values:
|
|
21
|
-
} =
|
|
22
|
-
|
|
16
|
+
formatMessage: r
|
|
17
|
+
} = x(), {
|
|
18
|
+
handleSubmit: f,
|
|
19
|
+
resetForm: s,
|
|
20
|
+
values: C
|
|
21
|
+
} = B(), [F] = c(C), [S, v] = c(null), b = () => {
|
|
22
|
+
s({
|
|
23
23
|
values: h()
|
|
24
24
|
});
|
|
25
|
-
},
|
|
26
|
-
|
|
25
|
+
}, y = (l) => {
|
|
26
|
+
s({
|
|
27
27
|
values: F
|
|
28
|
-
}), i(
|
|
29
|
-
},
|
|
30
|
-
|
|
28
|
+
}), i(l);
|
|
29
|
+
}, g = () => {
|
|
30
|
+
f(), i(!1);
|
|
31
31
|
};
|
|
32
32
|
return /* @__PURE__ */ e(t, {
|
|
33
|
-
onOpenChange:
|
|
34
|
-
open:
|
|
33
|
+
onOpenChange: y,
|
|
34
|
+
open: p,
|
|
35
35
|
variant: "overlay",
|
|
36
36
|
children: /* @__PURE__ */ e(t.Overlay, {
|
|
37
|
-
children: /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ u(t.Content, {
|
|
38
38
|
children: [/* @__PURE__ */ e(t.Header, {
|
|
39
|
-
children:
|
|
39
|
+
children: r(n.filtersHeader)
|
|
40
40
|
}), /* @__PURE__ */ e(t.ScrollableContainer, {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
ref: v,
|
|
42
|
+
children: /* @__PURE__ */ e(d, {
|
|
43
|
+
defaultValue: a.map((l, o) => `item-${o}`),
|
|
43
44
|
type: "multiple",
|
|
44
|
-
children: a.map((
|
|
45
|
-
...
|
|
45
|
+
children: a.map((l, o) => /* @__PURE__ */ e(d.Item, {
|
|
46
|
+
...l.toggleable ? {} : {
|
|
46
47
|
fixed: "true"
|
|
47
48
|
},
|
|
48
|
-
title:
|
|
49
|
-
value: `item-${
|
|
50
|
-
children:
|
|
51
|
-
...
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
title: l.title,
|
|
50
|
+
value: `item-${o}`,
|
|
51
|
+
children: l.filters.map((m) => /* @__PURE__ */ e(k, {
|
|
52
|
+
...m,
|
|
53
|
+
parentRef: S
|
|
54
|
+
}, m.id))
|
|
55
|
+
}, `accordion-item-${l.title || "unnamed"}`))
|
|
54
56
|
})
|
|
55
|
-
}), /* @__PURE__ */
|
|
57
|
+
}), /* @__PURE__ */ u(t.Footer, {
|
|
56
58
|
children: [/* @__PURE__ */ e(t.Footer.SecondaryButton, {
|
|
57
|
-
onClick:
|
|
58
|
-
children:
|
|
59
|
+
onClick: b,
|
|
60
|
+
children: r(n.clearAllButton)
|
|
59
61
|
}), /* @__PURE__ */ e(t.Footer.PrimaryButton, {
|
|
60
|
-
onClick:
|
|
61
|
-
children:
|
|
62
|
+
onClick: g,
|
|
63
|
+
children: r(n.showResultsButton)
|
|
62
64
|
})]
|
|
63
65
|
}), /* @__PURE__ */ e(t.Close, {
|
|
64
|
-
"aria-label":
|
|
66
|
+
"aria-label": r(n.closeAriaLabel)
|
|
65
67
|
})]
|
|
66
68
|
})
|
|
67
69
|
})
|
|
68
70
|
});
|
|
69
71
|
};
|
|
70
72
|
export {
|
|
71
|
-
|
|
73
|
+
w as default
|
|
72
74
|
};
|
|
@@ -1,89 +1,122 @@
|
|
|
1
|
-
import { MetadataStringField as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { MetadataStringField as o, MetadataMultiSelectField as s, MetadataEnumField as f, MetadataDateField as m } from "@box/metadata-filter";
|
|
2
|
+
import { useIntl as c } from "react-intl";
|
|
3
|
+
import { MetadataFileField as F } from "../metadata-value/metadata-file-field.js";
|
|
4
|
+
import { MetadataLocationField as M } from "../metadata-value/metadata-location-field.js";
|
|
5
|
+
import { MetadataSearchField as x } from "../metadata-value/metadata-search-field.js";
|
|
6
|
+
import { MetadataRadioField as S } from "../metadata-value/metadata-radio-field.js";
|
|
5
7
|
import { jsx as t } from "react/jsx-runtime";
|
|
6
|
-
const
|
|
8
|
+
const i = (e) => `metadata.fields.${e}`, b = ({
|
|
7
9
|
id: e,
|
|
8
10
|
name: a,
|
|
9
11
|
placeholder: l,
|
|
10
|
-
variant:
|
|
12
|
+
variant: r
|
|
11
13
|
}) => {
|
|
12
|
-
switch (
|
|
14
|
+
switch (r) {
|
|
13
15
|
case "search":
|
|
14
|
-
return /* @__PURE__ */ t(
|
|
16
|
+
return /* @__PURE__ */ t(x, {
|
|
15
17
|
id: e,
|
|
16
18
|
name: a,
|
|
17
19
|
placeholder: l
|
|
18
20
|
});
|
|
19
21
|
case "default":
|
|
20
22
|
default:
|
|
21
|
-
return /* @__PURE__ */ t(
|
|
22
|
-
fieldNamePrefix:
|
|
23
|
+
return /* @__PURE__ */ t(o, {
|
|
24
|
+
fieldNamePrefix: i(e),
|
|
23
25
|
label: a || ""
|
|
24
26
|
});
|
|
25
27
|
}
|
|
26
|
-
},
|
|
28
|
+
}, g = ({
|
|
27
29
|
id: e,
|
|
28
30
|
name: a,
|
|
29
|
-
variant: l
|
|
31
|
+
variant: l,
|
|
32
|
+
parentRef: r
|
|
30
33
|
}) => {
|
|
31
34
|
switch (l) {
|
|
32
35
|
case "file":
|
|
33
|
-
return /* @__PURE__ */ t(
|
|
36
|
+
return /* @__PURE__ */ t(F, {
|
|
34
37
|
id: e
|
|
35
38
|
});
|
|
36
39
|
case "default":
|
|
37
40
|
default:
|
|
38
|
-
return /* @__PURE__ */ t(
|
|
39
|
-
fieldNamePrefix:
|
|
40
|
-
label: a || ""
|
|
41
|
+
return /* @__PURE__ */ t(s, {
|
|
42
|
+
fieldNamePrefix: i(e),
|
|
43
|
+
label: a || "",
|
|
44
|
+
portalElement: r
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
|
-
},
|
|
47
|
+
}, h = ({
|
|
44
48
|
id: e,
|
|
45
49
|
name: a,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
parentRef: l,
|
|
51
|
+
variant: r,
|
|
52
|
+
renderer: d,
|
|
53
|
+
triggerCallback: n
|
|
49
54
|
}) => {
|
|
50
|
-
|
|
55
|
+
const {
|
|
56
|
+
locale: u
|
|
57
|
+
} = c();
|
|
58
|
+
switch (r) {
|
|
51
59
|
case "file":
|
|
52
|
-
return /* @__PURE__ */ t(
|
|
60
|
+
return /* @__PURE__ */ t(M, {
|
|
61
|
+
id: e,
|
|
62
|
+
renderer: d,
|
|
63
|
+
triggerSetValueCallback: n
|
|
64
|
+
});
|
|
65
|
+
case "radio":
|
|
66
|
+
return /* @__PURE__ */ t(S, {
|
|
53
67
|
id: e,
|
|
54
|
-
|
|
55
|
-
triggerSetValueCallback: f
|
|
68
|
+
name: a
|
|
56
69
|
});
|
|
57
70
|
case "default":
|
|
58
71
|
default:
|
|
59
|
-
return /* @__PURE__ */ t(
|
|
60
|
-
fieldNamePrefix:
|
|
61
|
-
label: a || ""
|
|
72
|
+
return /* @__PURE__ */ t(f, {
|
|
73
|
+
fieldNamePrefix: i(e),
|
|
74
|
+
label: a || "",
|
|
75
|
+
locale: u,
|
|
76
|
+
portalElement: l
|
|
62
77
|
});
|
|
63
78
|
}
|
|
64
|
-
},
|
|
79
|
+
}, P = ({
|
|
80
|
+
id: e,
|
|
81
|
+
customLabels: a,
|
|
82
|
+
variant: l
|
|
83
|
+
}) => {
|
|
84
|
+
const {
|
|
85
|
+
locale: r
|
|
86
|
+
} = c();
|
|
87
|
+
return /* @__PURE__ */ t(m, {
|
|
88
|
+
canUseRelativeDates: l === "relative",
|
|
89
|
+
customFieldLabels: a,
|
|
90
|
+
direction: "vertical",
|
|
91
|
+
fieldNamePrefix: i(e),
|
|
92
|
+
label: "",
|
|
93
|
+
locale: r
|
|
94
|
+
});
|
|
95
|
+
}, R = ({
|
|
65
96
|
...e
|
|
66
97
|
}) => {
|
|
67
98
|
switch (e.fieldType) {
|
|
68
99
|
case "string":
|
|
69
|
-
|
|
100
|
+
case "float":
|
|
101
|
+
return /* @__PURE__ */ t(b, {
|
|
70
102
|
...e
|
|
71
103
|
});
|
|
72
104
|
case "multiSelect":
|
|
73
|
-
return /* @__PURE__ */ t(
|
|
105
|
+
return /* @__PURE__ */ t(g, {
|
|
74
106
|
...e
|
|
75
107
|
});
|
|
76
108
|
case "enum":
|
|
77
|
-
return /* @__PURE__ */ t(
|
|
109
|
+
return /* @__PURE__ */ t(h, {
|
|
78
110
|
...e
|
|
79
111
|
});
|
|
80
|
-
|
|
81
|
-
return /* @__PURE__ */ t(
|
|
82
|
-
|
|
83
|
-
label: e.name || ""
|
|
112
|
+
case "date":
|
|
113
|
+
return /* @__PURE__ */ t(P, {
|
|
114
|
+
...e
|
|
84
115
|
});
|
|
116
|
+
default:
|
|
117
|
+
return null;
|
|
85
118
|
}
|
|
86
119
|
};
|
|
87
120
|
export {
|
|
88
|
-
|
|
121
|
+
R as default
|
|
89
122
|
};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { BoxItemTypeSelectorQuickFilter as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { jsx as
|
|
4
|
-
const
|
|
1
|
+
import { BoxItemTypeSelectorQuickFilter as u } from "@box/box-item-type-selector";
|
|
2
|
+
import { useFormikContext as s } from "formik";
|
|
3
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
4
|
+
const f = ({
|
|
5
5
|
id: e
|
|
6
6
|
}) => {
|
|
7
|
+
var t, l;
|
|
7
8
|
const {
|
|
8
|
-
values:
|
|
9
|
-
setFieldValue:
|
|
10
|
-
submitForm:
|
|
11
|
-
} =
|
|
12
|
-
return /* @__PURE__ */ u
|
|
9
|
+
values: o,
|
|
10
|
+
setFieldValue: a,
|
|
11
|
+
submitForm: m
|
|
12
|
+
} = s(), i = (l = (t = o.metadata.fields[e]) == null ? void 0 : t.value) == null ? void 0 : l.enum;
|
|
13
|
+
return /* @__PURE__ */ p(u, {
|
|
14
|
+
allowAllOptionsSelect: !0,
|
|
13
15
|
applyButtonType: "submit",
|
|
14
|
-
onApply: (
|
|
15
|
-
|
|
16
|
+
onApply: (r) => {
|
|
17
|
+
a(`metadata.fields.${e}.value.enum`, r), m();
|
|
16
18
|
},
|
|
17
|
-
selected:
|
|
19
|
+
selected: i || []
|
|
18
20
|
});
|
|
19
21
|
};
|
|
20
22
|
export {
|
|
21
|
-
|
|
23
|
+
f as MetadataFileChip
|
|
22
24
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { BoxItemTypeSelector as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { jsx as
|
|
4
|
-
const
|
|
1
|
+
import { BoxItemTypeSelector as i } from "@box/box-item-type-selector";
|
|
2
|
+
import { useFormikContext as n } from "formik";
|
|
3
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
4
|
+
const f = ({
|
|
5
5
|
id: e
|
|
6
6
|
}) => {
|
|
7
|
+
var t, o;
|
|
7
8
|
const {
|
|
8
|
-
values:
|
|
9
|
-
setFieldValue:
|
|
10
|
-
} =
|
|
11
|
-
return /* @__PURE__ */ i
|
|
12
|
-
onSelectionChange: (
|
|
13
|
-
|
|
9
|
+
values: a,
|
|
10
|
+
setFieldValue: l
|
|
11
|
+
} = n(), m = (o = (t = a.metadata.fields[e]) == null ? void 0 : t.value) == null ? void 0 : o.enum;
|
|
12
|
+
return /* @__PURE__ */ s(i, {
|
|
13
|
+
onSelectionChange: (r) => {
|
|
14
|
+
l(`metadata.fields.${e}.value.enum`, r);
|
|
14
15
|
},
|
|
15
|
-
selected:
|
|
16
|
+
selected: m || []
|
|
16
17
|
});
|
|
17
18
|
};
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
+
f as MetadataFileField
|
|
20
21
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useFormikContext as f } from "formik";
|
|
2
|
+
import { Radio as t } from "@box/blueprint-web";
|
|
3
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
4
|
+
const x = ({
|
|
5
|
+
id: a,
|
|
6
|
+
name: l
|
|
7
|
+
}) => {
|
|
8
|
+
var i, r, n, u;
|
|
9
|
+
const {
|
|
10
|
+
values: d,
|
|
11
|
+
setFieldValue: m
|
|
12
|
+
} = f(), s = (n = (r = (i = d.metadata.fields[a]) == null ? void 0 : i.value) == null ? void 0 : r.enum) == null ? void 0 : n[0], p = ((u = d.metadata.fields[a]) == null ? void 0 : u.options) || [];
|
|
13
|
+
return /* @__PURE__ */ o(t.Legend, {
|
|
14
|
+
header: l,
|
|
15
|
+
children: /* @__PURE__ */ o(t.Group, {
|
|
16
|
+
loop: !0,
|
|
17
|
+
name: l,
|
|
18
|
+
onValueChange: (e) => {
|
|
19
|
+
m(`metadata.fields.${a}.value.enum[0]`, e);
|
|
20
|
+
},
|
|
21
|
+
value: s,
|
|
22
|
+
children: p.map(({
|
|
23
|
+
key: e
|
|
24
|
+
}) => /* @__PURE__ */ o(t.Item, {
|
|
25
|
+
label: e,
|
|
26
|
+
value: e
|
|
27
|
+
}, e))
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
x as MetadataRadioField
|
|
33
|
+
};
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { SearchInput as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import
|
|
5
|
-
import { jsx as
|
|
6
|
-
const
|
|
1
|
+
import { SearchInput as i } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as c } from "formik";
|
|
3
|
+
import { useIntl as f } from "react-intl";
|
|
4
|
+
import l from "./messages.js";
|
|
5
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
6
|
+
const g = ({
|
|
7
7
|
id: e,
|
|
8
|
-
name:
|
|
9
|
-
placeholder:
|
|
8
|
+
name: n,
|
|
9
|
+
placeholder: m
|
|
10
10
|
}) => {
|
|
11
|
+
var o, s;
|
|
11
12
|
const {
|
|
12
13
|
formatMessage: t
|
|
13
|
-
} =
|
|
14
|
-
values:
|
|
14
|
+
} = f(), {
|
|
15
|
+
values: u,
|
|
15
16
|
setFieldValue: r
|
|
16
|
-
} =
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
} = c(), a = (s = (o = u.metadata.fields[e]) == null ? void 0 : o.value) == null ? void 0 : s.enum;
|
|
18
|
+
return /* @__PURE__ */ h(i.Controlled, {
|
|
18
19
|
id: e,
|
|
19
|
-
name:
|
|
20
|
-
onChange: (
|
|
20
|
+
name: n,
|
|
21
|
+
onChange: (p) => r(`metadata.fields.${e}.value.enum[0]`, p.target.value),
|
|
21
22
|
onClearInput: () => r(`metadata.fields.${e}.value.enum`, []),
|
|
22
|
-
placeholder:
|
|
23
|
-
searchInputAriaLabel: t(
|
|
24
|
-
searchInputClearAriaLabel: t(
|
|
23
|
+
placeholder: m,
|
|
24
|
+
searchInputAriaLabel: t(l.searchInputAriaLabel),
|
|
25
|
+
searchInputClearAriaLabel: t(l.searchInputClearAriaLabel),
|
|
25
26
|
value: (a == null ? void 0 : a[0]) || ""
|
|
26
27
|
});
|
|
27
28
|
};
|
|
28
29
|
export {
|
|
29
|
-
|
|
30
|
+
g as MetadataSearchField
|
|
30
31
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { MetadataFormFieldValue } from '@box/metadata-filter';
|
|
1
|
+
import { MetadataTemplateFieldOption, MetadataFormFieldValue } from '@box/metadata-filter';
|
|
2
2
|
import { FilterOption } from './types';
|
|
3
3
|
export declare const getInitialFieldValues: (filterOptions: FilterOption[]) => {
|
|
4
4
|
metadata: {
|
|
5
5
|
fields: Record<string, {
|
|
6
6
|
value: MetadataFormFieldValue;
|
|
7
|
+
options?: Array<MetadataTemplateFieldOption>;
|
|
7
8
|
}>;
|
|
8
9
|
};
|
|
9
10
|
};
|
|
@@ -6,6 +6,7 @@ export interface FilterGroup {
|
|
|
6
6
|
toggleable: boolean;
|
|
7
7
|
}
|
|
8
8
|
export interface FilterOption {
|
|
9
|
+
customLabels?: string[];
|
|
9
10
|
fieldType: MetadataFieldType;
|
|
10
11
|
icon?: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, 'ref'> & React.RefAttributes<SVGSVGElement>>;
|
|
11
12
|
id: string;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { FilterOption } from '../filter-row/types';
|
|
2
|
-
|
|
2
|
+
interface FilterProps extends FilterOption {
|
|
3
|
+
parentRef: HTMLElement;
|
|
4
|
+
}
|
|
5
|
+
declare const Filter: ({ ...props }: FilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
6
|
export default Filter;
|
|
@@ -2,7 +2,7 @@ import { ColumnProps } from '@box/blueprint-web';
|
|
|
2
2
|
import { Item } from '@box/types';
|
|
3
3
|
import { ItemActionMenuProps } from './components/item-action-menu';
|
|
4
4
|
export type MetadataFieldType = 'date' | 'enum' | 'float' | 'multiSelect' | 'string';
|
|
5
|
-
export type FilterVariant = 'default' | 'search' | 'file';
|
|
5
|
+
export type FilterVariant = 'default' | 'search' | 'file' | 'radio' | 'relative';
|
|
6
6
|
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;
|