@box/metadata-filter 1.31.0 → 1.31.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.
- package/dist/chunks/index.js +54 -48
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.js +39 -37
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field-advanced.js +26 -24
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.js +35 -33
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js +26 -24
- package/dist/esm/lib/components/metadata-filter-fields/is-modified-utils.js +84 -0
- package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.js +64 -60
- package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields.js +58 -48
- package/dist/esm/lib/messages.js +4 -0
- package/dist/esm/lib/metadata-filter.js +50 -46
- package/dist/i18n/bn-IN.js +1 -0
- package/dist/i18n/da-DK.js +1 -0
- package/dist/i18n/de-DE.js +1 -0
- package/dist/i18n/en-AU.js +1 -0
- package/dist/i18n/en-CA.js +1 -0
- package/dist/i18n/en-GB.js +1 -0
- package/dist/i18n/en-US.js +1 -0
- package/dist/i18n/en-US.properties +2 -0
- package/dist/i18n/en-x-pseudo.js +1 -0
- package/dist/i18n/es-419.js +1 -0
- package/dist/i18n/es-ES.js +1 -0
- package/dist/i18n/fi-FI.js +1 -0
- package/dist/i18n/fr-CA.js +1 -0
- package/dist/i18n/fr-FR.js +1 -0
- package/dist/i18n/hi-IN.js +1 -0
- package/dist/i18n/it-IT.js +1 -0
- package/dist/i18n/ja-JP.js +1 -0
- package/dist/i18n/json/src/lib/messages.json +1 -1
- package/dist/i18n/ko-KR.js +1 -0
- package/dist/i18n/nb-NO.js +1 -0
- package/dist/i18n/nl-NL.js +1 -0
- package/dist/i18n/pl-PL.js +1 -0
- package/dist/i18n/pt-BR.js +1 -0
- package/dist/i18n/ru-RU.js +1 -0
- package/dist/i18n/sv-SE.js +1 -0
- package/dist/i18n/tr-TR.js +1 -0
- package/dist/i18n/zh-CN.js +1 -0
- package/dist/i18n/zh-TW.js +1 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field-advanced.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/shared/advanced-filter-select.d.ts +2 -1
- package/dist/types/lib/components/metadata-filter-fields/is-modified-utils.d.ts +3 -0
- package/dist/types/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/metadata-filter-fields.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/types.d.ts +30 -1
- package/dist/types/lib/messages.d.ts +5 -0
- package/dist/types/lib/metadata-filter.d.ts +1 -1
- package/dist/types/lib/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -1,70 +1,76 @@
|
|
|
1
1
|
import { Text as D, Select as c } from "@box/blueprint-web";
|
|
2
|
-
import { Field as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import { jsxs as
|
|
7
|
-
import '../styles/index.css';const z = "
|
|
8
|
-
noAttributesText:
|
|
9
|
-
fieldLabel:
|
|
10
|
-
selectContainer:
|
|
11
|
-
comboboxContainer:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { Field as k } from "formik";
|
|
3
|
+
import { useState as B, useCallback as M } from "react";
|
|
4
|
+
import { useIntl as N } from "react-intl";
|
|
5
|
+
import l from "../esm/lib/messages.js";
|
|
6
|
+
import { jsxs as _, Fragment as $, jsx as e } from "react/jsx-runtime";
|
|
7
|
+
import '../styles/index.css';const q = "_noAttributesText_2lw3u_1", z = "_fieldLabel_2lw3u_5", E = "_selectContainer_2lw3u_10", G = "_comboboxContainer_2lw3u_15", H = "_modifiedIcon_2lw3u_19", d = {
|
|
8
|
+
noAttributesText: q,
|
|
9
|
+
fieldLabel: z,
|
|
10
|
+
selectContainer: E,
|
|
11
|
+
comboboxContainer: G,
|
|
12
|
+
modifiedIcon: H
|
|
13
|
+
}, W = ({
|
|
14
|
+
label: m,
|
|
15
|
+
fieldNamePrefix: i,
|
|
15
16
|
fieldAdvancedFilterOptions: h,
|
|
16
|
-
filterOptionsMap:
|
|
17
|
+
filterOptionsMap: n,
|
|
17
18
|
disableForm: b,
|
|
18
19
|
portalElement: x,
|
|
19
|
-
onAdvancedFilterOptionChange:
|
|
20
|
-
onValueChange:
|
|
21
|
-
defaultValue:
|
|
22
|
-
showLabel:
|
|
23
|
-
advancedFilterFieldName:
|
|
24
|
-
value:
|
|
25
|
-
labelClassName:
|
|
26
|
-
labelAs:
|
|
27
|
-
open:
|
|
28
|
-
onOpenChange:
|
|
20
|
+
onAdvancedFilterOptionChange: s,
|
|
21
|
+
onValueChange: u,
|
|
22
|
+
defaultValue: v = "",
|
|
23
|
+
showLabel: C = !0,
|
|
24
|
+
advancedFilterFieldName: L = `${i}.value.advancedFilterOption`,
|
|
25
|
+
value: r,
|
|
26
|
+
labelClassName: g = d.fieldLabel,
|
|
27
|
+
labelAs: A = "div",
|
|
28
|
+
open: I,
|
|
29
|
+
onOpenChange: w,
|
|
30
|
+
isModified: T
|
|
29
31
|
}) => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
children: [
|
|
35
|
-
as:
|
|
36
|
-
className:
|
|
32
|
+
const a = N(), [F, p] = B(h || v), y = r !== void 0 ? r : F, S = M((t, ...o) => {
|
|
33
|
+
r === void 0 && p(t), s && s(i, t), u(t, ...o);
|
|
34
|
+
}, [i, s, u, r]);
|
|
35
|
+
return /* @__PURE__ */ _($, {
|
|
36
|
+
children: [C && /* @__PURE__ */ _(D, {
|
|
37
|
+
as: A,
|
|
38
|
+
className: g,
|
|
37
39
|
color: "textOnLightDefault",
|
|
38
40
|
variant: "bodyDefaultBold",
|
|
39
|
-
children:
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
children: [m, T && /* @__PURE__ */ e("div", {
|
|
42
|
+
"aria-label": a.formatMessage(l.filterModifiedAriaLabel),
|
|
43
|
+
className: d.modifiedIcon,
|
|
44
|
+
role: "img"
|
|
45
|
+
})]
|
|
46
|
+
}), /* @__PURE__ */ e(k, {
|
|
47
|
+
name: L,
|
|
42
48
|
children: ({
|
|
43
49
|
field: t,
|
|
44
|
-
meta:
|
|
50
|
+
meta: o
|
|
45
51
|
}) => /* @__PURE__ */ e("div", {
|
|
46
|
-
className:
|
|
52
|
+
className: d.selectContainer,
|
|
47
53
|
children: /* @__PURE__ */ e(c, {
|
|
48
54
|
...t,
|
|
49
55
|
"aria-disabled": b,
|
|
50
|
-
"aria-label":
|
|
51
|
-
label:
|
|
56
|
+
"aria-label": a.formatMessage(l.advancedFilterOptionAriaLabel, {
|
|
57
|
+
label: m
|
|
52
58
|
}),
|
|
53
59
|
disabled: b,
|
|
54
|
-
error:
|
|
60
|
+
error: o.touched && o.error ? o.error : void 0,
|
|
55
61
|
hideLabel: !0,
|
|
56
|
-
label:
|
|
57
|
-
onOpenChange:
|
|
62
|
+
label: a.formatMessage(l.selectFilterType),
|
|
63
|
+
onOpenChange: w,
|
|
58
64
|
onValueChange: S,
|
|
59
|
-
open:
|
|
60
|
-
placeholder:
|
|
65
|
+
open: I,
|
|
66
|
+
placeholder: a.formatMessage(l.selectOptionPlaceholder),
|
|
61
67
|
value: y,
|
|
62
68
|
children: /* @__PURE__ */ e(c.Content, {
|
|
63
69
|
container: x,
|
|
64
|
-
children:
|
|
70
|
+
children: n == null ? void 0 : n.map(([f, j]) => /* @__PURE__ */ e(c.Option, {
|
|
65
71
|
text: j,
|
|
66
|
-
value:
|
|
67
|
-
},
|
|
72
|
+
value: f
|
|
73
|
+
}, f))
|
|
68
74
|
})
|
|
69
75
|
})
|
|
70
76
|
})
|
|
@@ -72,6 +78,6 @@ import '../styles/index.css';const z = "_noAttributesText_12d80_1", E = "_fieldL
|
|
|
72
78
|
});
|
|
73
79
|
};
|
|
74
80
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
W as A,
|
|
82
|
+
d as s
|
|
77
83
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { DateI18nProvider as
|
|
2
|
-
import
|
|
3
|
-
import { useFormikContext as
|
|
4
|
-
import { useState as L, useRef as X, useCallback as v, useEffect as
|
|
5
|
-
import { useIntl as
|
|
1
|
+
import { DateI18nProvider as ue, DatePicker as H, TextInput as me } from "@box/blueprint-web";
|
|
2
|
+
import fe from "clsx";
|
|
3
|
+
import { useFormikContext as ve, getIn as pe, Field as b } from "formik";
|
|
4
|
+
import { useState as L, useRef as X, useCallback as v, useEffect as he, useMemo as q } from "react";
|
|
5
|
+
import { useIntl as ge } from "react-intl";
|
|
6
6
|
import { R as s } from "../../../../../../chunks/types.js";
|
|
7
7
|
import { DEFAULT_MAX_DATE as z } from "./constants.js";
|
|
8
8
|
import { getRelativeFromToValues as J, convertToFormikValueRanged as K } from "./date-conversion-utils.js";
|
|
9
9
|
import { s as p } from "../../../../../../chunks/metadata-date-field.module.js";
|
|
10
10
|
import { E as A } from "../../../../../../chunks/types2.js";
|
|
11
|
-
import { useDateValidation as
|
|
12
|
-
import { useIntegerValidation as
|
|
13
|
-
import { processRelativeDaysInput as
|
|
11
|
+
import { useDateValidation as Fe } from "./use-date-validation.js";
|
|
12
|
+
import { useIntegerValidation as De } from "./use-integer-validation.js";
|
|
13
|
+
import { processRelativeDaysInput as Me, getDynamicMaxMinValue as Q } from "./utils.js";
|
|
14
14
|
import i from "../../../../messages.js";
|
|
15
15
|
import { jsx as n, jsxs as W } from "react/jsx-runtime";
|
|
16
|
-
import { A as
|
|
17
|
-
const
|
|
16
|
+
import { A as Te } from "../../../../../../chunks/index.js";
|
|
17
|
+
const $e = ({
|
|
18
18
|
disableForm: h,
|
|
19
19
|
fieldNamePrefix: u,
|
|
20
20
|
label: I,
|
|
@@ -23,21 +23,22 @@ const _e = ({
|
|
|
23
23
|
filterOptionsMap: Y,
|
|
24
24
|
onAdvancedFilterOptionChange: g,
|
|
25
25
|
fieldAdvancedFilterOptions: N,
|
|
26
|
-
hasAccordion: Z
|
|
26
|
+
hasAccordion: Z,
|
|
27
|
+
isModified: ee
|
|
27
28
|
}) => {
|
|
28
29
|
const T = `${u}.value.advancedFilterOption`, m = `${u}.value.relativeDays`, o = `${u}.value.range.gt`, r = `${u}.value.range.lt`, {
|
|
29
30
|
values: E,
|
|
30
31
|
setFieldValue: a,
|
|
31
32
|
setFieldTouched: S
|
|
32
|
-
} =
|
|
33
|
+
} = ve(), {
|
|
33
34
|
validateDates: B,
|
|
34
35
|
fromDatePickerValue: F,
|
|
35
36
|
toDatePickerValue: D,
|
|
36
37
|
fromErrorType: x,
|
|
37
38
|
toErrorType: P
|
|
38
|
-
} =
|
|
39
|
-
validatePositiveInteger:
|
|
40
|
-
} =
|
|
39
|
+
} = Fe(E, o, r, C, !0), {
|
|
40
|
+
validatePositiveInteger: te
|
|
41
|
+
} = De(), l = ge(), [f, ae] = L(N || ""), [U, V] = L(!1), d = pe(E, m), [_, R] = L(s.FROM), y = X(F), O = X(D), $ = {
|
|
41
42
|
clearDatePickerAriaLabel: l.formatMessage(i.clearSelectedDate),
|
|
42
43
|
nextMonthAriaLabel: l.formatMessage(i.switchToNextMonth),
|
|
43
44
|
openCalendarDropdownAriaLabel: l.formatMessage(i.openCalendar),
|
|
@@ -63,35 +64,35 @@ const _e = ({
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
}, [f, d, o, r, a]);
|
|
66
|
-
|
|
67
|
+
he(() => {
|
|
67
68
|
U && (w(), V(!1));
|
|
68
69
|
}, [U, w]);
|
|
69
|
-
const
|
|
70
|
+
const oe = v((e) => {
|
|
70
71
|
const t = e;
|
|
71
|
-
|
|
72
|
+
ae(t), a(T, t), g && g(u, t);
|
|
72
73
|
const c = () => {
|
|
73
74
|
a(m, void 0), a(o, void 0), a(r, void 0);
|
|
74
75
|
}, k = () => {
|
|
75
76
|
a(o, void 0), a(r, void 0);
|
|
76
77
|
};
|
|
77
78
|
["isBlank", "isNotBlank", "selectFilterType"].includes(t) || !t || t === "customRange" ? c() : t === "today" ? (a(m, void 0), V(!0)) : k();
|
|
78
|
-
}, [u, g, a, T, m, o, r]),
|
|
79
|
+
}, [u, g, a, T, m, o, r]), re = v((e) => {
|
|
79
80
|
const {
|
|
80
81
|
valueToStore: t,
|
|
81
82
|
shouldTriggerUpdate: c
|
|
82
|
-
} =
|
|
83
|
+
} = Me(e);
|
|
83
84
|
a(m, t), c && V(!0);
|
|
84
|
-
}, [a, m]),
|
|
85
|
+
}, [a, m]), se = v((e) => {
|
|
85
86
|
const t = K(e, s.FROM);
|
|
86
87
|
y.current = e, a(o, t), R(s.FROM);
|
|
87
|
-
}, [a, o]),
|
|
88
|
+
}, [a, o]), ne = v((e) => {
|
|
88
89
|
const t = K(e, s.TO);
|
|
89
90
|
O.current = e, a(r, t), R(s.TO);
|
|
90
91
|
}, [a, r]), j = v((e) => {
|
|
91
92
|
const t = e === s.FROM ? o : r;
|
|
92
93
|
S(t, !0), R(e);
|
|
93
|
-
}, [S, o, r]),
|
|
94
|
-
className:
|
|
94
|
+
}, [S, o, r]), le = q(() => Q(D, z), [D]), ie = q(() => Q(F), [F]), G = (e, t, c) => !!(t === A.MAX && e === A.OVERLAPPING || e === A.OVERLAPPING && c), ce = ["isBlank", "isNotBlank", "selectFilterType", "today"], de = () => !f || ce.includes(f) ? null : f === "customRange" ? /* @__PURE__ */ W("div", {
|
|
95
|
+
className: fe(p.rangeInputsContainer, p.verticalLayout),
|
|
95
96
|
children: [/* @__PURE__ */ n(b, {
|
|
96
97
|
name: o,
|
|
97
98
|
validate: (e) => B(y.current, O.current, s.FROM),
|
|
@@ -107,9 +108,9 @@ const _e = ({
|
|
|
107
108
|
error: !G(x, P, _ !== s.FROM) && t.error,
|
|
108
109
|
isDisabled: h,
|
|
109
110
|
label: l.formatMessage(i.afterDate),
|
|
110
|
-
maxValue:
|
|
111
|
+
maxValue: le,
|
|
111
112
|
onBlur: () => j(s.FROM),
|
|
112
|
-
onChange:
|
|
113
|
+
onChange: se,
|
|
113
114
|
portalElement: M,
|
|
114
115
|
value: F
|
|
115
116
|
})
|
|
@@ -130,9 +131,9 @@ const _e = ({
|
|
|
130
131
|
isDisabled: h,
|
|
131
132
|
label: l.formatMessage(i.beforeDate),
|
|
132
133
|
maxValue: z,
|
|
133
|
-
minValue:
|
|
134
|
+
minValue: ie,
|
|
134
135
|
onBlur: () => j(s.TO),
|
|
135
|
-
onChange:
|
|
136
|
+
onChange: ne,
|
|
136
137
|
portalElement: M,
|
|
137
138
|
value: D
|
|
138
139
|
})
|
|
@@ -140,46 +141,47 @@ const _e = ({
|
|
|
140
141
|
})]
|
|
141
142
|
}) : /* @__PURE__ */ n(b, {
|
|
142
143
|
name: m,
|
|
143
|
-
validate: (e) =>
|
|
144
|
+
validate: (e) => te((e == null ? void 0 : e.toString()) || ""),
|
|
144
145
|
children: ({
|
|
145
146
|
field: e,
|
|
146
147
|
meta: t
|
|
147
148
|
}) => /* @__PURE__ */ n("div", {
|
|
148
149
|
className: p.daysInputContainer,
|
|
149
|
-
children: /* @__PURE__ */ n(
|
|
150
|
+
children: /* @__PURE__ */ n(me, {
|
|
150
151
|
...e,
|
|
151
152
|
disabled: h,
|
|
152
153
|
error: t.touched && t.error,
|
|
153
154
|
hideLabel: !0,
|
|
154
155
|
label: l.formatMessage(i.relativeDaysSelectLabel),
|
|
155
|
-
onChange: (c) =>
|
|
156
|
+
onChange: (c) => re(c.target.value),
|
|
156
157
|
placeholder: l.formatMessage(i.numberOfDays),
|
|
157
158
|
value: (d == null ? void 0 : d.toString()) || ""
|
|
158
159
|
})
|
|
159
160
|
})
|
|
160
161
|
});
|
|
161
|
-
return /* @__PURE__ */ n(
|
|
162
|
+
return /* @__PURE__ */ n(ue, {
|
|
162
163
|
locale: C,
|
|
163
164
|
children: /* @__PURE__ */ W("div", {
|
|
164
165
|
className: p.advancedDateContainer,
|
|
165
166
|
"data-testid": `${I}-advanced-field`,
|
|
166
|
-
children: [/* @__PURE__ */ n(
|
|
167
|
+
children: [/* @__PURE__ */ n(Te, {
|
|
167
168
|
advancedFilterFieldName: T,
|
|
168
169
|
disableForm: h,
|
|
169
170
|
fieldAdvancedFilterOptions: N,
|
|
170
171
|
fieldNamePrefix: u,
|
|
171
172
|
filterOptionsMap: Y,
|
|
173
|
+
isModified: ee,
|
|
172
174
|
label: I,
|
|
173
175
|
onAdvancedFilterOptionChange: g,
|
|
174
|
-
onValueChange:
|
|
176
|
+
onValueChange: oe,
|
|
175
177
|
portalElement: M,
|
|
176
178
|
showLabel: !Z,
|
|
177
179
|
value: f
|
|
178
|
-
}),
|
|
180
|
+
}), de()]
|
|
179
181
|
})
|
|
180
182
|
});
|
|
181
183
|
};
|
|
182
184
|
export {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
$e as MetadataDateFieldAdvanced,
|
|
186
|
+
$e as default
|
|
185
187
|
};
|
|
@@ -1,67 +1,69 @@
|
|
|
1
1
|
import { TextInput as N } from "@box/blueprint-web";
|
|
2
|
-
import { Field as
|
|
2
|
+
import { Field as k } from "formik";
|
|
3
3
|
import { useState as S, useCallback as F } from "react";
|
|
4
|
-
import { useIntl as
|
|
4
|
+
import { useIntl as G } from "react-intl";
|
|
5
5
|
import u from "../../../../messages.js";
|
|
6
6
|
import { R as d } from "../../../../../../chunks/types.js";
|
|
7
7
|
import { fieldDefaultProps as b } from "../constants.js";
|
|
8
|
-
import { createAdvancedFilterOptionHandler as
|
|
8
|
+
import { createAdvancedFilterOptionHandler as Q, createInputChangeHandler as V } from "./handlers.js";
|
|
9
9
|
import { s as c } from "../../../../../../chunks/metadata-float-field.module.js";
|
|
10
|
-
import { u as
|
|
11
|
-
import { FloatAdvancedFilterOption as
|
|
12
|
-
import { jsx as n, jsxs as A, Fragment as
|
|
13
|
-
import { A as
|
|
14
|
-
const
|
|
10
|
+
import { u as U } from "../../../../../../chunks/use-float-validation.js";
|
|
11
|
+
import { FloatAdvancedFilterOption as q, getInputValues as y, getInputDisplayState as z, FloatInputDisplayState as I } from "./utils.js";
|
|
12
|
+
import { jsx as n, jsxs as A, Fragment as J } from "react/jsx-runtime";
|
|
13
|
+
import { A as K } from "../../../../../../chunks/index.js";
|
|
14
|
+
const ie = ({
|
|
15
15
|
label: m,
|
|
16
16
|
fieldNamePrefix: C,
|
|
17
17
|
disableForm: p,
|
|
18
18
|
onAdvancedFilterOptionChange: h,
|
|
19
19
|
fieldAdvancedFilterOptions: O,
|
|
20
20
|
filterOptionsMap: E,
|
|
21
|
-
hasAccordion: R
|
|
21
|
+
hasAccordion: R,
|
|
22
|
+
isModified: w
|
|
22
23
|
}) => {
|
|
23
|
-
const s =
|
|
24
|
+
const s = G(), o = `${C}.value.enum[0]`, [x, L] = S(d.FROM), [l, M] = S(O || q.EQUALS), {
|
|
24
25
|
validateFloats: f
|
|
25
|
-
} =
|
|
26
|
+
} = U(), D = F((a, t, r, e) => Q(o, h, M)(a, t, r, e), [o, h, M]), H = F((a, t, r) => V(o, l, L, d.FROM)(a, t, r), [o, l]), P = F((a, t, r) => V(o, l, L, d.TO)(a, t, r), [o, l]);
|
|
26
27
|
return /* @__PURE__ */ n("div", {
|
|
27
28
|
className: c.advancedFilterContainer,
|
|
28
29
|
"data-testid": `${m}-field`,
|
|
29
|
-
children: /* @__PURE__ */ n(
|
|
30
|
+
children: /* @__PURE__ */ n(k, {
|
|
30
31
|
name: o,
|
|
31
32
|
validate: (a) => {
|
|
32
33
|
const t = y(a, !0);
|
|
33
|
-
return f(t.from, t.to,
|
|
34
|
+
return f(t.from, t.to, x, !0);
|
|
34
35
|
},
|
|
35
36
|
children: ({
|
|
36
37
|
field: a,
|
|
37
38
|
meta: t,
|
|
38
39
|
form: r
|
|
39
40
|
}) => {
|
|
40
|
-
const e = y(a.value, !0), g =
|
|
41
|
-
return /* @__PURE__ */ A(
|
|
42
|
-
children: [/* @__PURE__ */ n(
|
|
41
|
+
const e = y(a.value, !0), g = z(l), j = g !== I.NONE, T = g === I.SINGLE, v = g === I.BOTH, B = f(e.from, e.to, d.FROM, !0), $ = f(e.from, e.to, d.TO, !0);
|
|
42
|
+
return /* @__PURE__ */ A(J, {
|
|
43
|
+
children: [/* @__PURE__ */ n(K, {
|
|
43
44
|
disableForm: p,
|
|
44
45
|
fieldAdvancedFilterOptions: O,
|
|
45
46
|
fieldNamePrefix: C,
|
|
46
47
|
filterOptionsMap: E,
|
|
48
|
+
isModified: w,
|
|
47
49
|
label: m,
|
|
48
50
|
onAdvancedFilterOptionChange: h,
|
|
49
|
-
onValueChange: (i) =>
|
|
51
|
+
onValueChange: (i) => D(i, e.from, e.to, r),
|
|
50
52
|
showLabel: !R,
|
|
51
53
|
value: l
|
|
52
|
-
}),
|
|
54
|
+
}), j && /* @__PURE__ */ A("div", {
|
|
53
55
|
className: c.rangeInputsContainer,
|
|
54
56
|
children: [(T || v) && /* @__PURE__ */ n("div", {
|
|
55
57
|
className: c.inputContainer,
|
|
56
58
|
children: /* @__PURE__ */ n(N, {
|
|
57
59
|
...b,
|
|
58
60
|
disabled: p,
|
|
59
|
-
error: T ? t.error :
|
|
61
|
+
error: T ? t.error : B,
|
|
60
62
|
hideLabel: !0,
|
|
61
63
|
label: s.formatMessage(u.fieldFromLabel, {
|
|
62
64
|
label: m
|
|
63
65
|
}),
|
|
64
|
-
onChange: (i) =>
|
|
66
|
+
onChange: (i) => H(i.currentTarget.value, e.to, r),
|
|
65
67
|
placeholder: v ? s.formatMessage(u.minValuePlaceholder) : s.formatMessage(u.enterNumberPlaceholder),
|
|
66
68
|
value: e.from
|
|
67
69
|
})
|
|
@@ -70,12 +72,12 @@ const se = ({
|
|
|
70
72
|
children: /* @__PURE__ */ n(N, {
|
|
71
73
|
...b,
|
|
72
74
|
disabled: p,
|
|
73
|
-
error:
|
|
75
|
+
error: $,
|
|
74
76
|
hideLabel: !0,
|
|
75
77
|
label: s.formatMessage(u.fieldToLabel, {
|
|
76
78
|
label: m
|
|
77
79
|
}),
|
|
78
|
-
onChange: (i) =>
|
|
80
|
+
onChange: (i) => P(i.currentTarget.value, e.from, r),
|
|
79
81
|
placeholder: s.formatMessage(u.maxValuePlaceholder),
|
|
80
82
|
value: e.to
|
|
81
83
|
})
|
|
@@ -87,6 +89,6 @@ const se = ({
|
|
|
87
89
|
});
|
|
88
90
|
};
|
|
89
91
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
ie as MetadataFloatFieldAdvanced,
|
|
93
|
+
ie as default
|
|
92
94
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { TooltipProvider as
|
|
2
|
-
import { useFormikContext as
|
|
1
|
+
import { TooltipProvider as P, Combobox as U } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as q, getIn as v, Field as z } from "formik";
|
|
3
3
|
import { useState as f, useCallback as p } from "react";
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import { fieldDefaultProps as
|
|
7
|
-
import { getInitialAdvancedFilterValue as
|
|
8
|
-
import { jsx as a, jsxs as
|
|
9
|
-
import { A as
|
|
10
|
-
const x = (t) => t === "isBlank" || t === "isNotBlank",
|
|
4
|
+
import { useIntl as G } from "react-intl";
|
|
5
|
+
import H from "../../../../messages.js";
|
|
6
|
+
import { fieldDefaultProps as J } from "../constants.js";
|
|
7
|
+
import { getInitialAdvancedFilterValue as K, createFieldValue as k, getInputValue as N } from "./utils.js";
|
|
8
|
+
import { jsx as a, jsxs as Q, Fragment as R } from "react/jsx-runtime";
|
|
9
|
+
import { A as W } from "../../../../../../chunks/index.js";
|
|
10
|
+
const x = (t) => t === "isBlank" || t === "isNotBlank", oe = ({
|
|
11
11
|
label: t,
|
|
12
12
|
fieldNamePrefix: m,
|
|
13
13
|
disableForm: h,
|
|
@@ -16,61 +16,63 @@ const x = (t) => t === "isBlank" || t === "isNotBlank", se = ({
|
|
|
16
16
|
fieldAdvancedFilterOptions: g,
|
|
17
17
|
filterOptionsMap: V,
|
|
18
18
|
portalElement: C,
|
|
19
|
-
hasAccordion: I
|
|
19
|
+
hasAccordion: I,
|
|
20
|
+
isModified: S
|
|
20
21
|
}) => {
|
|
21
22
|
const {
|
|
22
|
-
setFieldValue:
|
|
23
|
-
values:
|
|
24
|
-
} =
|
|
25
|
-
|
|
23
|
+
setFieldValue: w,
|
|
24
|
+
values: L
|
|
25
|
+
} = q(), y = G(), n = `${m}.value.enum`, B = v(L, `${m}.options`, []).map((e) => e == null ? void 0 : e.key).filter((e) => typeof e == "string"), [c, O] = f(K(g, V)), [$, d] = f(!1), [j, b] = f(!1), F = (e, s) => typeof s != "string" ? !1 : s.toLowerCase().includes(e.toLowerCase()), M = p((e, s, o) => {
|
|
26
|
+
O(e), l == null || l(n, e);
|
|
26
27
|
const r = x(e) ? [] : s, i = k(r, e, u);
|
|
27
28
|
o.setFieldValue(n, i);
|
|
28
|
-
}, [n, u, l]),
|
|
29
|
+
}, [n, u, l]), T = p((e) => {
|
|
29
30
|
d(e), e && b(!1);
|
|
30
|
-
}, []),
|
|
31
|
+
}, []), D = p((e) => {
|
|
31
32
|
b(e), e && d(!1);
|
|
32
33
|
}, []);
|
|
33
34
|
return /* @__PURE__ */ a("div", {
|
|
34
35
|
"data-testid": `${t}-field`,
|
|
35
|
-
children: /* @__PURE__ */ a(
|
|
36
|
+
children: /* @__PURE__ */ a(z, {
|
|
36
37
|
name: n,
|
|
37
38
|
children: ({
|
|
38
39
|
field: e,
|
|
39
40
|
form: s
|
|
40
41
|
}) => {
|
|
41
|
-
const o =
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
children: [/* @__PURE__ */ a(
|
|
42
|
+
const o = N(e.value, u);
|
|
43
|
+
return /* @__PURE__ */ Q(R, {
|
|
44
|
+
children: [/* @__PURE__ */ a(W, {
|
|
44
45
|
disableForm: h,
|
|
45
46
|
fieldAdvancedFilterOptions: g,
|
|
46
47
|
fieldNamePrefix: m,
|
|
47
48
|
filterOptionsMap: V,
|
|
49
|
+
isModified: S,
|
|
48
50
|
label: t,
|
|
49
51
|
onAdvancedFilterOptionChange: l,
|
|
50
|
-
onOpenChange:
|
|
51
|
-
onValueChange: (r) =>
|
|
52
|
-
open:
|
|
52
|
+
onOpenChange: D,
|
|
53
|
+
onValueChange: (r) => M(r, o, s),
|
|
54
|
+
open: j,
|
|
53
55
|
portalElement: C,
|
|
54
56
|
showLabel: !I,
|
|
55
57
|
value: c
|
|
56
|
-
}), !x(c) && /* @__PURE__ */ a(
|
|
57
|
-
children: /* @__PURE__ */ a(
|
|
58
|
-
...
|
|
58
|
+
}), !x(c) && /* @__PURE__ */ a(P, {
|
|
59
|
+
children: /* @__PURE__ */ a(U, {
|
|
60
|
+
...J,
|
|
59
61
|
as: "input",
|
|
60
62
|
disabled: h,
|
|
61
|
-
filterFn:
|
|
63
|
+
filterFn: F,
|
|
62
64
|
hideLabel: !0,
|
|
63
65
|
label: t,
|
|
64
66
|
multiselect: !0,
|
|
65
67
|
name: e.name,
|
|
66
|
-
onOpenChange:
|
|
68
|
+
onOpenChange: T,
|
|
67
69
|
onValueChange: (r) => {
|
|
68
70
|
const i = k(r, c, u);
|
|
69
|
-
|
|
71
|
+
w(n, i);
|
|
70
72
|
},
|
|
71
|
-
open:
|
|
72
|
-
options:
|
|
73
|
-
placeholder: !o || o.length === 0 ?
|
|
73
|
+
open: $,
|
|
74
|
+
options: B,
|
|
75
|
+
placeholder: !o || o.length === 0 ? y.formatMessage(H.multiselectPlaceholder) : "",
|
|
74
76
|
portalElement: C,
|
|
75
77
|
value: o
|
|
76
78
|
})
|
|
@@ -81,5 +83,5 @@ const x = (t) => t === "isBlank" || t === "isNotBlank", se = ({
|
|
|
81
83
|
});
|
|
82
84
|
};
|
|
83
85
|
export {
|
|
84
|
-
|
|
86
|
+
oe as MetadataMultiSelectFieldAdvanced
|
|
85
87
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { TextInput as
|
|
2
|
-
import { Field as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
1
|
+
import { TextInput as j } from "@box/blueprint-web";
|
|
2
|
+
import { Field as $ } from "formik";
|
|
3
|
+
import { useState as k, useCallback as n } from "react";
|
|
4
|
+
import { useIntl as y } from "react-intl";
|
|
5
5
|
import x from "../../../../messages.js";
|
|
6
|
-
import { fieldDefaultProps as
|
|
7
|
-
import { getInitialAdvancedFilterValue as
|
|
8
|
-
import { jsx as p, jsxs as
|
|
9
|
-
import { A as
|
|
10
|
-
const
|
|
6
|
+
import { fieldDefaultProps as D } from "../constants.js";
|
|
7
|
+
import { getInitialAdvancedFilterValue as H, createFieldValue as w, getInputValue as N, shouldHideTextInput as P } from "./utils.js";
|
|
8
|
+
import { jsx as p, jsxs as q, Fragment as z } from "react/jsx-runtime";
|
|
9
|
+
import { A as B } from "../../../../../../chunks/index.js";
|
|
10
|
+
const G = ({
|
|
11
11
|
label: s,
|
|
12
12
|
fieldNamePrefix: f,
|
|
13
13
|
disableForm: g,
|
|
@@ -15,39 +15,41 @@ const B = ({
|
|
|
15
15
|
onAdvancedFilterOptionChange: o,
|
|
16
16
|
fieldAdvancedFilterOptions: h,
|
|
17
17
|
filterOptionsMap: I,
|
|
18
|
-
hasAccordion: c
|
|
18
|
+
hasAccordion: c,
|
|
19
|
+
isModified: S
|
|
19
20
|
}) => {
|
|
20
|
-
const i =
|
|
21
|
-
|
|
21
|
+
const i = y(), r = `${f}.value.enum[0]`, [l, L] = k(H(h, I)), M = n((e, m, u) => {
|
|
22
|
+
L(e), o == null || o(r, e);
|
|
22
23
|
const a = w(m, e, t);
|
|
23
24
|
u.setFieldValue(r, a);
|
|
24
|
-
}, [r, t, o]),
|
|
25
|
+
}, [r, t, o]), T = n((e, m) => {
|
|
25
26
|
const u = e.target.value, a = w(u, l, t);
|
|
26
27
|
m.setFieldValue(r, a);
|
|
27
28
|
}, [l, t, r]);
|
|
28
29
|
return /* @__PURE__ */ p("div", {
|
|
29
30
|
"data-testid": `${s}-field`,
|
|
30
|
-
children: /* @__PURE__ */ p(
|
|
31
|
+
children: /* @__PURE__ */ p($, {
|
|
31
32
|
name: r,
|
|
32
33
|
children: ({
|
|
33
34
|
field: e,
|
|
34
35
|
meta: m,
|
|
35
36
|
form: u
|
|
36
37
|
}) => {
|
|
37
|
-
const a =
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
children: [t && /* @__PURE__ */ p(
|
|
38
|
+
const a = N(e.value, t);
|
|
39
|
+
return /* @__PURE__ */ q(z, {
|
|
40
|
+
children: [t && /* @__PURE__ */ p(B, {
|
|
40
41
|
disableForm: g,
|
|
41
42
|
fieldAdvancedFilterOptions: h,
|
|
42
43
|
fieldNamePrefix: f,
|
|
43
44
|
filterOptionsMap: I,
|
|
45
|
+
isModified: S,
|
|
44
46
|
label: s,
|
|
45
47
|
onAdvancedFilterOptionChange: o,
|
|
46
|
-
onValueChange: (V) =>
|
|
48
|
+
onValueChange: (V) => M(V, a, u),
|
|
47
49
|
showLabel: t && !c,
|
|
48
50
|
value: l
|
|
49
|
-
}), !
|
|
50
|
-
...
|
|
51
|
+
}), !P(t, l) && /* @__PURE__ */ p(j, {
|
|
52
|
+
...D,
|
|
51
53
|
...e,
|
|
52
54
|
"aria-label": i.formatMessage(x.enterValueAriaLabel, {
|
|
53
55
|
label: s
|
|
@@ -56,7 +58,7 @@ const B = ({
|
|
|
56
58
|
error: m.error,
|
|
57
59
|
hideLabel: t || c,
|
|
58
60
|
label: s,
|
|
59
|
-
onChange: (V) =>
|
|
61
|
+
onChange: (V) => T(V, u),
|
|
60
62
|
placeholder: i.formatMessage(x.setValuePlaceholder),
|
|
61
63
|
value: a
|
|
62
64
|
})]
|
|
@@ -65,8 +67,8 @@ const B = ({
|
|
|
65
67
|
})
|
|
66
68
|
});
|
|
67
69
|
};
|
|
68
|
-
|
|
70
|
+
G.displayName = "MetadataStringField";
|
|
69
71
|
export {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
G as MetadataStringField,
|
|
73
|
+
G as default
|
|
72
74
|
};
|