@box/metadata-filter 1.77.10 → 1.78.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-float-field/utils.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
let t = /* @__PURE__ */ (function(r) {
|
|
2
|
-
return r.EQUALS = "equals", r.GREATER_THAN = "greaterThanOrEqual", r.LESS_THAN = "lessThanOrEqual", r.BETWEEN = "between", r.IS_BLANK = "isBlank", r.IS_NOT_BLANK = "isNotBlank", r;
|
|
2
|
+
return r.EQUALS = "equals", r.IS_NOT = "isNot", r.GREATER_THAN = "greaterThanOrEqual", r.LESS_THAN = "lessThanOrEqual", r.BETWEEN = "between", r.IS_BLANK = "isBlank", r.IS_NOT_BLANK = "isNotBlank", r;
|
|
3
3
|
})({});
|
|
4
|
-
const
|
|
4
|
+
const _ = (r, N) => r && N?.some(([e]) => e === r) ? r : t.EQUALS;
|
|
5
5
|
let E = /* @__PURE__ */ (function(r) {
|
|
6
6
|
return r.BOTH = "both", r.SINGLE = "single", r.NONE = "none", r;
|
|
7
7
|
})({});
|
|
8
|
-
const
|
|
8
|
+
const L = (r) => r === t.IS_BLANK || r === t.IS_NOT_BLANK ? E.NONE : r === t.BETWEEN ? E.BOTH : [t.EQUALS, t.IS_NOT, t.GREATER_THAN, t.LESS_THAN].includes(r) ? E.SINGLE : E.NONE, S = (r) => r.lt && !r.gt ? {
|
|
9
9
|
from: r.lt,
|
|
10
10
|
to: ""
|
|
11
11
|
} : {
|
|
12
12
|
from: r.gt || "",
|
|
13
13
|
to: r.lt || ""
|
|
14
|
-
},
|
|
14
|
+
}, T = (r) => r.advancedFilterOption === t.LESS_THAN ? {
|
|
15
15
|
from: r.value?.range?.lt || "",
|
|
16
16
|
to: ""
|
|
17
17
|
} : {
|
|
18
18
|
from: r.value?.range?.gt || "",
|
|
19
19
|
to: r.value?.range?.lt || ""
|
|
20
|
-
},
|
|
21
|
-
if (!
|
|
20
|
+
}, g = (r) => typeof r == "object" && r !== null, f = (r) => g(r) && "advancedFilterOption" in r && "value" in r && typeof r.advancedFilterOption == "string", B = (r, N) => {
|
|
21
|
+
if (!g(r))
|
|
22
22
|
return {
|
|
23
23
|
from: "",
|
|
24
24
|
to: ""
|
|
25
25
|
};
|
|
26
26
|
const n = r;
|
|
27
|
-
return n.range && !
|
|
27
|
+
return n.range && !N ? S(n.range) : N && f(r) ? T(r) : n.range ? S(n.range) : {
|
|
28
28
|
from: "",
|
|
29
29
|
to: ""
|
|
30
30
|
};
|
|
31
|
-
},
|
|
32
|
-
if (
|
|
31
|
+
}, I = (r, N, n, e) => {
|
|
32
|
+
if (e) {
|
|
33
33
|
if (n === t.IS_BLANK || n === t.IS_NOT_BLANK)
|
|
34
34
|
return {
|
|
35
35
|
value: {
|
|
@@ -38,7 +38,7 @@ const _ = (r) => r === t.IS_BLANK || r === t.IS_NOT_BLANK ? E.NONE : r === t.BET
|
|
|
38
38
|
advancedFilterOption: n
|
|
39
39
|
};
|
|
40
40
|
const s = {};
|
|
41
|
-
return r && (n === t.LESS_THAN ? s.lt = r : s.gt = r),
|
|
41
|
+
return r && (n === t.LESS_THAN ? s.lt = r : s.gt = r), N && n === t.BETWEEN && (s.lt = N), {
|
|
42
42
|
value: {
|
|
43
43
|
range: s
|
|
44
44
|
},
|
|
@@ -46,15 +46,15 @@ const _ = (r) => r === t.IS_BLANK || r === t.IS_NOT_BLANK ? E.NONE : r === t.BET
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
const u = {};
|
|
49
|
-
return r && (u.gt = r),
|
|
49
|
+
return r && (u.gt = r), N && (u.lt = N), {
|
|
50
50
|
range: u
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
export {
|
|
54
54
|
t as FloatAdvancedFilterOption,
|
|
55
55
|
E as FloatInputDisplayState,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
I as createFieldValue,
|
|
57
|
+
_ as getInitialAdvancedFilterValue,
|
|
58
|
+
L as getInputDisplayState,
|
|
59
|
+
B as getInputValues
|
|
60
60
|
};
|
|
@@ -93,7 +93,7 @@ export declare enum FilterKeyTypes {
|
|
|
93
93
|
}
|
|
94
94
|
export type StringFilterKey = FilterKeyTypes.MATCH_EXACTLY | FilterKeyTypes.STARTS_WITH | FilterKeyTypes.CONTAINS | FilterKeyTypes.IS_NOT | FilterKeyTypes.IS_BLANK | FilterKeyTypes.IS_NOT_BLANK;
|
|
95
95
|
export type DateFilterKey = FilterKeyTypes.SELECT_FILTER_TYPE | FilterKeyTypes.TODAY | FilterKeyTypes.NEXT | FilterKeyTypes.PAST | FilterKeyTypes.OLDER_THAN | FilterKeyTypes.CUSTOM_RANGE | FilterKeyTypes.IS_BLANK | FilterKeyTypes.IS_NOT_BLANK;
|
|
96
|
-
export type FloatFilterKey = FilterKeyTypes.EQUALS | FilterKeyTypes.GREATER_THAN_OR_EQUAL | FilterKeyTypes.LESS_THAN_OR_EQUAL | FilterKeyTypes.BETWEEN | FilterKeyTypes.IS_BLANK | FilterKeyTypes.IS_NOT_BLANK;
|
|
96
|
+
export type FloatFilterKey = FilterKeyTypes.EQUALS | FilterKeyTypes.IS_NOT | FilterKeyTypes.GREATER_THAN_OR_EQUAL | FilterKeyTypes.LESS_THAN_OR_EQUAL | FilterKeyTypes.BETWEEN | FilterKeyTypes.IS_BLANK | FilterKeyTypes.IS_NOT_BLANK;
|
|
97
97
|
export type EnumFilterKey = FilterKeyTypes.MATCH_ANY | FilterKeyTypes.IS_NOT | FilterKeyTypes.IS_BLANK | FilterKeyTypes.IS_NOT_BLANK;
|
|
98
98
|
export type MultiSelectFilterKey = FilterKeyTypes.MATCH_ANY | FilterKeyTypes.MATCH_ALL | FilterKeyTypes.IS_NOT_ANY | FilterKeyTypes.IS_BLANK | FilterKeyTypes.IS_NOT_BLANK | FilterKeyTypes.MATCH_EXACTLY;
|
|
99
99
|
export type TaxonomySingleSelectFilterKey = FilterKeyTypes.MATCH_ANY | FilterKeyTypes.IS_NOT | FilterKeyTypes.MATCH_AT_OR_WITHIN | FilterKeyTypes.IS_NOT_AT_OR_WITHIN | FilterKeyTypes.IS_BLANK | FilterKeyTypes.IS_NOT_BLANK;
|