@box/metadata-filter 1.48.3 → 1.49.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-filter-fields/components/metadata-date-field/metadata-date-field.js +54 -52
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.js +24 -23
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field.js +38 -36
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +25 -24
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js +43 -42
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text as J, DateI18nProvider as K, DatePicker as
|
|
1
|
+
import { Text as J, DateI18nProvider as K, DatePicker as N } from "@box/blueprint-web";
|
|
2
2
|
import { useFormikContext as Q, Field as P } from "formik";
|
|
3
3
|
import { useState as W, useRef as y, useMemo as E } from "react";
|
|
4
4
|
import { useIntl as Y } from "react-intl";
|
|
@@ -8,108 +8,110 @@ import { DEFAULT_MAX_DATE as I } from "./constants.js";
|
|
|
8
8
|
import { convertToFormikValueRanged as $ } from "./date-conversion-utils.js";
|
|
9
9
|
import { MetadataDateFieldRelative as Z } from "./metadata-date-field-relative.js";
|
|
10
10
|
import { s as i } from "../../../../../../chunks/metadata-date-field.module.js";
|
|
11
|
-
import { E as
|
|
11
|
+
import { E as p } from "../../../../../../chunks/types2.js";
|
|
12
12
|
import { useDateValidation as ee } from "./use-date-validation.js";
|
|
13
13
|
import { getDynamicMaxMinValue as B } from "./utils.js";
|
|
14
|
-
import { jsx as t, jsxs as
|
|
14
|
+
import { jsx as t, jsxs as _ } from "react/jsx-runtime";
|
|
15
15
|
const Fe = ({
|
|
16
|
-
canUseRelativeDates:
|
|
16
|
+
canUseRelativeDates: M,
|
|
17
17
|
...s
|
|
18
|
-
}) =>
|
|
18
|
+
}) => M ? /* @__PURE__ */ t(Z, {
|
|
19
19
|
...s
|
|
20
20
|
}) : /* @__PURE__ */ t(ae, {
|
|
21
21
|
...s
|
|
22
22
|
}), ae = ({
|
|
23
|
-
customFieldLabels:
|
|
23
|
+
customFieldLabels: M = [],
|
|
24
24
|
direction: s = "horizontal",
|
|
25
|
-
disableForm:
|
|
26
|
-
fieldNamePrefix:
|
|
27
|
-
label:
|
|
28
|
-
locale:
|
|
29
|
-
portalElement:
|
|
30
|
-
hasAccordion:
|
|
25
|
+
disableForm: D,
|
|
26
|
+
fieldNamePrefix: d,
|
|
27
|
+
label: v,
|
|
28
|
+
locale: T,
|
|
29
|
+
portalElement: O,
|
|
30
|
+
hasAccordion: w
|
|
31
31
|
}) => {
|
|
32
|
-
const [
|
|
33
|
-
values:
|
|
34
|
-
setFieldTouched:
|
|
35
|
-
setFieldValue:
|
|
32
|
+
const [L, h] = W(a.FROM), m = `${d}.value.range.gt`, c = `${d}.value.range.lt`, {
|
|
33
|
+
values: S,
|
|
34
|
+
setFieldTouched: j,
|
|
35
|
+
setFieldValue: R
|
|
36
36
|
} = Q(), {
|
|
37
37
|
validateDates: V,
|
|
38
|
-
fromDatePickerValue:
|
|
39
|
-
toDatePickerValue:
|
|
38
|
+
fromDatePickerValue: u,
|
|
39
|
+
toDatePickerValue: f,
|
|
40
40
|
fromErrorType: b,
|
|
41
|
-
toErrorType:
|
|
42
|
-
} = ee(
|
|
41
|
+
toErrorType: A
|
|
42
|
+
} = ee(S, m, c, T, !0), o = Y(), F = y(u), g = y(f), C = {
|
|
43
43
|
clearDatePickerAriaLabel: o.formatMessage(n.clearSelectedDate),
|
|
44
44
|
nextMonthAriaLabel: o.formatMessage(n.switchToNextMonth),
|
|
45
45
|
openCalendarDropdownAriaLabel: o.formatMessage(n.openCalendar),
|
|
46
46
|
previousMonthAriaLabel: o.formatMessage(n.switchToNextMonth)
|
|
47
|
-
}, [
|
|
47
|
+
}, [G, X] = M, z = (e) => {
|
|
48
48
|
const r = $(e, a.FROM);
|
|
49
|
-
|
|
49
|
+
F.current = e, R(m, r), h(a.FROM);
|
|
50
50
|
}, H = (e) => {
|
|
51
51
|
const r = $(e, a.TO);
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
const r = e === a.FROM ? m :
|
|
55
|
-
|
|
56
|
-
}, U = E(() => B(
|
|
57
|
-
return /* @__PURE__ */
|
|
52
|
+
g.current = e, R(c, r), h(a.TO);
|
|
53
|
+
}, k = (e) => {
|
|
54
|
+
const r = e === a.FROM ? m : c;
|
|
55
|
+
j(r, !0), h(e);
|
|
56
|
+
}, U = E(() => B(f, I), [f]), q = E(() => B(u), [u]), x = (e, r, l) => !!(r === p.MAX && e === p.OVERLAPPING || e === p.OVERLAPPING && l);
|
|
57
|
+
return /* @__PURE__ */ _("div", {
|
|
58
58
|
className: i.container,
|
|
59
|
-
"data-testid": `${
|
|
60
|
-
children: [!
|
|
59
|
+
"data-testid": `${v}-field`,
|
|
60
|
+
children: [!w && /* @__PURE__ */ t(J, {
|
|
61
61
|
as: "span",
|
|
62
62
|
className: i.rangeFieldLabel,
|
|
63
63
|
color: "textOnLightSecondary",
|
|
64
64
|
variant: "bodyDefaultBold",
|
|
65
|
-
children:
|
|
65
|
+
children: v
|
|
66
66
|
}), /* @__PURE__ */ t(K, {
|
|
67
|
-
locale:
|
|
68
|
-
children: /* @__PURE__ */
|
|
67
|
+
locale: T,
|
|
68
|
+
children: /* @__PURE__ */ _("div", {
|
|
69
69
|
className: `${i.rangeInputsContainer} ${s === "vertical" ? i.verticalLayout : ""}`,
|
|
70
70
|
children: [/* @__PURE__ */ t(P, {
|
|
71
71
|
name: m,
|
|
72
|
-
validate: (e) => V(
|
|
72
|
+
validate: (e) => V(F.current, g.current, a.FROM),
|
|
73
73
|
children: ({
|
|
74
74
|
field: e,
|
|
75
75
|
meta: r
|
|
76
76
|
}) => /* @__PURE__ */ t("div", {
|
|
77
77
|
className: i.inputContainer,
|
|
78
|
-
children: /* @__PURE__ */ t(
|
|
78
|
+
children: /* @__PURE__ */ t(N, {
|
|
79
79
|
...e,
|
|
80
|
-
...
|
|
80
|
+
...C,
|
|
81
81
|
calendarAriaLabel: o.formatMessage(n.selectFromDate),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
dataTargetId: `DatePicker-${d}_from`,
|
|
83
|
+
error: x(b, A, L !== a.FROM) ? void 0 : r.error,
|
|
84
|
+
isDisabled: D,
|
|
85
|
+
label: G || o.formatMessage(n.fieldFromLabel),
|
|
85
86
|
maxValue: U,
|
|
86
|
-
onBlur: () =>
|
|
87
|
+
onBlur: () => k(a.FROM),
|
|
87
88
|
onChange: (l) => z(l),
|
|
88
|
-
portalElement:
|
|
89
|
-
value:
|
|
89
|
+
portalElement: O,
|
|
90
|
+
value: u
|
|
90
91
|
})
|
|
91
92
|
})
|
|
92
93
|
}), /* @__PURE__ */ t(P, {
|
|
93
|
-
name:
|
|
94
|
-
validate: (e) => V(
|
|
94
|
+
name: c,
|
|
95
|
+
validate: (e) => V(F.current, g.current, a.TO),
|
|
95
96
|
children: ({
|
|
96
97
|
field: e,
|
|
97
98
|
meta: r
|
|
98
99
|
}) => /* @__PURE__ */ t("div", {
|
|
99
100
|
className: i.inputContainer,
|
|
100
|
-
children: /* @__PURE__ */ t(
|
|
101
|
+
children: /* @__PURE__ */ t(N, {
|
|
101
102
|
...e,
|
|
102
|
-
...
|
|
103
|
+
...C,
|
|
103
104
|
calendarAriaLabel: o.formatMessage(n.selectToDate),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
dataTargetId: `DatePicker-${d}_to`,
|
|
106
|
+
error: x(A, b, L !== a.TO) ? void 0 : r.error,
|
|
107
|
+
isDisabled: D,
|
|
108
|
+
label: X || o.formatMessage(n.fieldToLabel),
|
|
107
109
|
maxValue: I,
|
|
108
110
|
minValue: q,
|
|
109
|
-
onBlur: () =>
|
|
111
|
+
onBlur: () => k(a.TO),
|
|
110
112
|
onChange: (l) => H(l),
|
|
111
|
-
portalElement:
|
|
112
|
-
value:
|
|
113
|
+
portalElement: O,
|
|
114
|
+
value: f
|
|
113
115
|
})
|
|
114
116
|
})
|
|
115
117
|
})]
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Select as l, SELECT_EMPTY_VALUE as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import
|
|
1
|
+
import { Select as l, SELECT_EMPTY_VALUE as o } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as E, getIn as F, Field as M } from "formik";
|
|
3
|
+
import { useIntl as V, FormattedMessage as x } from "react-intl";
|
|
4
|
+
import i from "../../../../messages.js";
|
|
5
5
|
import { jsx as t, jsxs as C } from "react/jsx-runtime";
|
|
6
|
-
const
|
|
7
|
-
disableForm:
|
|
8
|
-
fieldNamePrefix:
|
|
6
|
+
const O = ({
|
|
7
|
+
disableForm: m,
|
|
8
|
+
fieldNamePrefix: s,
|
|
9
9
|
label: d,
|
|
10
10
|
portalElement: h,
|
|
11
11
|
hasAccordion: p,
|
|
@@ -13,35 +13,36 @@ const P = ({
|
|
|
13
13
|
}) => {
|
|
14
14
|
const {
|
|
15
15
|
setFieldValue: c,
|
|
16
|
-
values:
|
|
17
|
-
} =
|
|
16
|
+
values: g
|
|
17
|
+
} = E(), f = V(), r = `${s}.value.enum[0]`, n = F(g, `${s}.options`, []).map(({
|
|
18
18
|
key: a
|
|
19
|
-
}) => a),
|
|
19
|
+
}) => a), u = v || f.formatMessage(i.selectValuePlaceholder);
|
|
20
20
|
return /* @__PURE__ */ t("div", {
|
|
21
21
|
"data-testid": `${d}-field`,
|
|
22
|
-
children: /* @__PURE__ */ t(
|
|
23
|
-
name:
|
|
22
|
+
children: /* @__PURE__ */ t(M, {
|
|
23
|
+
name: r,
|
|
24
24
|
children: ({
|
|
25
25
|
field: a
|
|
26
26
|
}) => /* @__PURE__ */ t(l, {
|
|
27
|
-
|
|
27
|
+
"data-target-id": `Select-${s}`,
|
|
28
|
+
disabled: m,
|
|
28
29
|
hideLabel: p,
|
|
29
30
|
label: d,
|
|
30
31
|
onValueChange: (e) => {
|
|
31
|
-
e ===
|
|
32
|
+
e === o ? c(r, "") : c(r, e);
|
|
32
33
|
},
|
|
33
|
-
placeholder:
|
|
34
|
+
placeholder: u,
|
|
34
35
|
...a,
|
|
35
|
-
value: a.value ===
|
|
36
|
+
value: a.value === o ? "" : a.value,
|
|
36
37
|
children: /* @__PURE__ */ C(l.Content, {
|
|
37
38
|
container: h,
|
|
38
39
|
children: [/* @__PURE__ */ t(l.Option, {
|
|
39
|
-
text:
|
|
40
|
-
value:
|
|
41
|
-
children: /* @__PURE__ */ t(
|
|
42
|
-
...
|
|
40
|
+
text: u,
|
|
41
|
+
value: o,
|
|
42
|
+
children: /* @__PURE__ */ t(x, {
|
|
43
|
+
...i.selectValuePlaceholder
|
|
43
44
|
})
|
|
44
|
-
}),
|
|
45
|
+
}), n == null ? void 0 : n.map((e) => /* @__PURE__ */ t(l.Option, {
|
|
45
46
|
text: e,
|
|
46
47
|
value: e,
|
|
47
48
|
children: e
|
|
@@ -52,6 +53,6 @@ const P = ({
|
|
|
52
53
|
});
|
|
53
54
|
};
|
|
54
55
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
O as MetadataEnumField,
|
|
57
|
+
O as default
|
|
57
58
|
};
|
|
@@ -1,58 +1,59 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { useState as k, useRef as
|
|
1
|
+
import { Text as S, TextInput as y } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as _, getIn as M, Field as E } from "formik";
|
|
3
|
+
import { useState as k, useRef as I } from "react";
|
|
4
4
|
import { useIntl as A } from "react-intl";
|
|
5
|
-
import
|
|
5
|
+
import V from "../../../../messages.js";
|
|
6
6
|
import { R as r } from "../../../../../../chunks/types.js";
|
|
7
|
-
import { fieldDefaultProps as
|
|
8
|
-
import { s as
|
|
7
|
+
import { fieldDefaultProps as $ } from "../constants.js";
|
|
8
|
+
import { s as d } from "../../../../../../chunks/metadata-float-field.module.js";
|
|
9
9
|
import { u as G, E as H } from "../../../../../../chunks/use-float-validation.js";
|
|
10
|
-
import { jsxs as
|
|
11
|
-
const
|
|
10
|
+
import { jsxs as x, jsx as t } from "react/jsx-runtime";
|
|
11
|
+
const Y = ({
|
|
12
12
|
label: n,
|
|
13
|
-
fieldNamePrefix:
|
|
14
|
-
disableForm:
|
|
15
|
-
hasAccordion:
|
|
13
|
+
fieldNamePrefix: s,
|
|
14
|
+
disableForm: p,
|
|
15
|
+
hasAccordion: L
|
|
16
16
|
}) => {
|
|
17
|
-
const
|
|
17
|
+
const f = A(), [h, c] = k(r.FROM), {
|
|
18
18
|
values: g,
|
|
19
19
|
setFieldValue: F,
|
|
20
|
-
setFieldTouched:
|
|
21
|
-
} =
|
|
20
|
+
setFieldTouched: b
|
|
21
|
+
} = _(), l = `${s}.value.range.gt`, i = `${s}.value.range.lt`, B = M(g, l), N = M(g, i), u = I(B), m = I(N), {
|
|
22
22
|
validateFloats: T,
|
|
23
23
|
fromErrorType: O,
|
|
24
24
|
toErrorType: v
|
|
25
25
|
} = G(), j = (e) => {
|
|
26
|
-
|
|
26
|
+
u.current = e, F(l, e), c(r.FROM);
|
|
27
27
|
}, D = (e) => {
|
|
28
|
-
|
|
28
|
+
m.current = e, F(i, e), c(r.TO);
|
|
29
29
|
}, R = (e, o) => {
|
|
30
|
-
|
|
30
|
+
b(e, !0), c(o);
|
|
31
31
|
}, C = (e, o, a) => !!(e === H.OVERLAPPING && a);
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
className:
|
|
32
|
+
return /* @__PURE__ */ x("div", {
|
|
33
|
+
className: d.container,
|
|
34
34
|
"data-testid": `${n}-field`,
|
|
35
|
-
children: [!
|
|
35
|
+
children: [!L && /* @__PURE__ */ t(S, {
|
|
36
36
|
as: "span",
|
|
37
37
|
color: "textOnLightSecondary",
|
|
38
38
|
variant: "bodyDefaultBold",
|
|
39
39
|
children: n
|
|
40
|
-
}), /* @__PURE__ */
|
|
41
|
-
className:
|
|
40
|
+
}), /* @__PURE__ */ x("div", {
|
|
41
|
+
className: d.rangeInputsContainer,
|
|
42
42
|
children: [/* @__PURE__ */ t(E, {
|
|
43
43
|
name: `${l}`,
|
|
44
|
-
validate: () => T(
|
|
44
|
+
validate: () => T(u.current, m.current, r.FROM),
|
|
45
45
|
children: ({
|
|
46
46
|
field: e,
|
|
47
47
|
meta: o
|
|
48
48
|
}) => /* @__PURE__ */ t("div", {
|
|
49
|
-
className:
|
|
49
|
+
className: d.inputContainer,
|
|
50
50
|
children: /* @__PURE__ */ t(y, {
|
|
51
|
-
|
|
51
|
+
...$,
|
|
52
52
|
...e,
|
|
53
|
-
|
|
53
|
+
"data-target-id": `TextInput-${s}_from`,
|
|
54
|
+
disabled: p,
|
|
54
55
|
error: C(O, v, h !== r.FROM) ? void 0 : o.error,
|
|
55
|
-
label:
|
|
56
|
+
label: f.formatMessage(V.fieldFromLabel, {
|
|
56
57
|
label: n
|
|
57
58
|
}),
|
|
58
59
|
onBlur: () => R(l, r.FROM),
|
|
@@ -61,22 +62,23 @@ const Z = ({
|
|
|
61
62
|
})
|
|
62
63
|
})
|
|
63
64
|
}), /* @__PURE__ */ t(E, {
|
|
64
|
-
name: `${
|
|
65
|
-
validate: () => T(
|
|
65
|
+
name: `${i}`,
|
|
66
|
+
validate: () => T(u.current, m.current, r.TO),
|
|
66
67
|
children: ({
|
|
67
68
|
field: e,
|
|
68
69
|
meta: o
|
|
69
70
|
}) => /* @__PURE__ */ t("div", {
|
|
70
|
-
className:
|
|
71
|
+
className: d.inputContainer,
|
|
71
72
|
children: /* @__PURE__ */ t(y, {
|
|
72
|
-
|
|
73
|
+
...$,
|
|
73
74
|
...e,
|
|
74
|
-
|
|
75
|
+
"data-target-id": `TextInput-${s}_to`,
|
|
76
|
+
disabled: p,
|
|
75
77
|
error: C(v, O, h !== r.TO) ? void 0 : o.error,
|
|
76
|
-
label:
|
|
78
|
+
label: f.formatMessage(V.fieldToLabel, {
|
|
77
79
|
label: n
|
|
78
80
|
}),
|
|
79
|
-
onBlur: () => R(
|
|
81
|
+
onBlur: () => R(i, r.TO),
|
|
80
82
|
onChange: (a) => D(a.currentTarget.value),
|
|
81
83
|
placeholder: "0"
|
|
82
84
|
})
|
|
@@ -86,6 +88,6 @@ const Z = ({
|
|
|
86
88
|
});
|
|
87
89
|
};
|
|
88
90
|
export {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
Y as MetadataFloatField,
|
|
92
|
+
Y as default
|
|
91
93
|
};
|
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
import { TooltipProvider as
|
|
2
|
-
import { useFormikContext as
|
|
1
|
+
import { TooltipProvider as f, Combobox as v } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as g, getIn as C, Field as F } from "formik";
|
|
3
3
|
import { useIntl as b } from "react-intl";
|
|
4
|
-
import
|
|
5
|
-
import { fieldDefaultProps as
|
|
4
|
+
import $ from "../../../../messages.js";
|
|
5
|
+
import { fieldDefaultProps as x } from "../constants.js";
|
|
6
6
|
import { jsx as o } from "react/jsx-runtime";
|
|
7
|
-
const
|
|
8
|
-
disableForm:
|
|
9
|
-
fieldNamePrefix:
|
|
10
|
-
label:
|
|
11
|
-
portalElement:
|
|
12
|
-
hasAccordion:
|
|
7
|
+
const k = ({
|
|
8
|
+
disableForm: n,
|
|
9
|
+
fieldNamePrefix: a,
|
|
10
|
+
label: l,
|
|
11
|
+
portalElement: s,
|
|
12
|
+
hasAccordion: i
|
|
13
13
|
}) => {
|
|
14
14
|
const {
|
|
15
15
|
setFieldValue: m,
|
|
16
16
|
values: u
|
|
17
|
-
} =
|
|
17
|
+
} = g(), d = b(), r = `${a}.value.enum`, c = C(u, `${a}.options`, []).map(({
|
|
18
18
|
key: e
|
|
19
19
|
}) => e), p = (e, t) => t.toLowerCase().includes(e.toLowerCase());
|
|
20
20
|
return /* @__PURE__ */ o("div", {
|
|
21
|
-
"data-testid": `${
|
|
22
|
-
children: /* @__PURE__ */ o(
|
|
23
|
-
name:
|
|
21
|
+
"data-testid": `${l}-field`,
|
|
22
|
+
children: /* @__PURE__ */ o(F, {
|
|
23
|
+
name: r,
|
|
24
24
|
children: ({
|
|
25
25
|
field: e
|
|
26
26
|
}) => {
|
|
27
27
|
var t;
|
|
28
|
-
return /* @__PURE__ */ o(
|
|
28
|
+
return /* @__PURE__ */ o(f, {
|
|
29
29
|
children: /* @__PURE__ */ o(v, {
|
|
30
|
-
...
|
|
30
|
+
...x,
|
|
31
31
|
as: "input",
|
|
32
|
-
|
|
32
|
+
"data-target-id": `Combobox-${a}`,
|
|
33
|
+
disabled: n,
|
|
33
34
|
filterFn: p,
|
|
34
|
-
hideLabel:
|
|
35
|
-
label:
|
|
35
|
+
hideLabel: i,
|
|
36
|
+
label: l,
|
|
36
37
|
multiselect: !0,
|
|
37
38
|
name: e.name,
|
|
38
|
-
onValueChange: (
|
|
39
|
+
onValueChange: (h) => m(r, h),
|
|
39
40
|
options: c,
|
|
40
41
|
placeholder: (
|
|
41
42
|
// Empty array must be substituded if there is no value found
|
|
42
43
|
// Otherwise an no placeholder appears despite no selection
|
|
43
|
-
((t = e.value || []) == null ? void 0 : t.length) === 0 ? d.formatMessage(
|
|
44
|
+
((t = e.value || []) == null ? void 0 : t.length) === 0 ? d.formatMessage($.multiselectPlaceholder) : ""
|
|
44
45
|
),
|
|
45
|
-
portalElement:
|
|
46
|
+
portalElement: s,
|
|
46
47
|
value: e.value
|
|
47
48
|
})
|
|
48
49
|
});
|
|
@@ -51,6 +52,6 @@ const j = ({
|
|
|
51
52
|
});
|
|
52
53
|
};
|
|
53
54
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
k as MetadataMultiSelectField,
|
|
56
|
+
k as default
|
|
56
57
|
};
|
|
@@ -1,75 +1,76 @@
|
|
|
1
|
-
import { TextInput as
|
|
1
|
+
import { TextInput as j } from "@box/blueprint-web";
|
|
2
2
|
import { Field as k } from "formik";
|
|
3
|
-
import { useState as y, useCallback as
|
|
3
|
+
import { useState as y, useCallback as x } from "react";
|
|
4
4
|
import { useIntl as D } from "react-intl";
|
|
5
|
-
import
|
|
5
|
+
import i from "../../../../messages.js";
|
|
6
6
|
import { fieldDefaultProps as H } from "../constants.js";
|
|
7
|
-
import { getInitialAdvancedFilterValue as
|
|
8
|
-
import { jsx as p, jsxs as
|
|
9
|
-
import { A as
|
|
10
|
-
const
|
|
11
|
-
label:
|
|
12
|
-
fieldNamePrefix:
|
|
7
|
+
import { getInitialAdvancedFilterValue as q, createFieldValue as w, getInputValue as z, shouldHideTextInput as B } from "./utils.js";
|
|
8
|
+
import { jsx as p, jsxs as G, Fragment as J } from "react/jsx-runtime";
|
|
9
|
+
import { A as K } from "../../../../../../chunks/index.js";
|
|
10
|
+
const N = ({
|
|
11
|
+
label: m,
|
|
12
|
+
fieldNamePrefix: V,
|
|
13
13
|
disableForm: g,
|
|
14
14
|
isAdvancedFilterEnabled: t,
|
|
15
15
|
onAdvancedFilterOptionChange: o,
|
|
16
|
-
fieldAdvancedFilterOptions:
|
|
17
|
-
filterOptionsMap:
|
|
16
|
+
fieldAdvancedFilterOptions: I,
|
|
17
|
+
filterOptionsMap: h,
|
|
18
18
|
hasAccordion: c,
|
|
19
19
|
isModified: S,
|
|
20
|
-
placeholder:
|
|
20
|
+
placeholder: T
|
|
21
21
|
}) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
u.setFieldValue(
|
|
26
|
-
}, [
|
|
27
|
-
const u = e.target.value,
|
|
28
|
-
|
|
29
|
-
}, [l, t,
|
|
22
|
+
const n = D(), a = `${V}.value.enum[0]`, [l, L] = y(q(I, h)), M = x((e, s, u) => {
|
|
23
|
+
L(e), o == null || o(a, e);
|
|
24
|
+
const r = w(s, e, t);
|
|
25
|
+
u.setFieldValue(a, r);
|
|
26
|
+
}, [a, t, o]), $ = x((e, s) => {
|
|
27
|
+
const u = e.target.value, r = w(u, l, t);
|
|
28
|
+
s.setFieldValue(a, r);
|
|
29
|
+
}, [l, t, a]);
|
|
30
30
|
return /* @__PURE__ */ p("div", {
|
|
31
|
-
"data-testid": `${
|
|
31
|
+
"data-testid": `${m}-field`,
|
|
32
32
|
children: /* @__PURE__ */ p(k, {
|
|
33
|
-
name:
|
|
33
|
+
name: a,
|
|
34
34
|
children: ({
|
|
35
35
|
field: e,
|
|
36
|
-
meta:
|
|
36
|
+
meta: s,
|
|
37
37
|
form: u
|
|
38
38
|
}) => {
|
|
39
|
-
const
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
-
children: [t && /* @__PURE__ */ p(
|
|
39
|
+
const r = z(e.value, t);
|
|
40
|
+
return /* @__PURE__ */ G(J, {
|
|
41
|
+
children: [t && /* @__PURE__ */ p(K, {
|
|
42
42
|
disableForm: g,
|
|
43
|
-
fieldAdvancedFilterOptions:
|
|
44
|
-
fieldNamePrefix:
|
|
45
|
-
filterOptionsMap:
|
|
43
|
+
fieldAdvancedFilterOptions: I,
|
|
44
|
+
fieldNamePrefix: V,
|
|
45
|
+
filterOptionsMap: h,
|
|
46
46
|
isModified: S,
|
|
47
|
-
label:
|
|
47
|
+
label: m,
|
|
48
48
|
onAdvancedFilterOptionChange: o,
|
|
49
|
-
onValueChange: (
|
|
49
|
+
onValueChange: (f) => M(f, r, u),
|
|
50
50
|
showLabel: t && !c,
|
|
51
51
|
value: l
|
|
52
|
-
}), !
|
|
52
|
+
}), !B(t, l) && /* @__PURE__ */ p(j, {
|
|
53
53
|
...H,
|
|
54
54
|
...e,
|
|
55
|
-
"aria-label":
|
|
56
|
-
label:
|
|
55
|
+
"aria-label": n.formatMessage(i.enterValueAriaLabel, {
|
|
56
|
+
label: m
|
|
57
57
|
}),
|
|
58
|
+
"data-target-id": `TextInput-${V}`,
|
|
58
59
|
disabled: g,
|
|
59
|
-
error:
|
|
60
|
+
error: s.error,
|
|
60
61
|
hideLabel: t || c,
|
|
61
|
-
label:
|
|
62
|
-
onChange: (
|
|
63
|
-
placeholder:
|
|
64
|
-
value:
|
|
62
|
+
label: m,
|
|
63
|
+
onChange: (f) => $(f, u),
|
|
64
|
+
placeholder: T || n.formatMessage(i.setValuePlaceholder),
|
|
65
|
+
value: r
|
|
65
66
|
})]
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
})
|
|
69
70
|
});
|
|
70
71
|
};
|
|
71
|
-
|
|
72
|
+
N.displayName = "MetadataStringField";
|
|
72
73
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
N as MetadataStringField,
|
|
75
|
+
N as default
|
|
75
76
|
};
|