@hortiview/shared-components 0.0.7515 → 0.0.7544
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/components/Filter/Filter.js +97 -81
- package/dist/components/Filter/Filter.test.js +29 -15
- package/dist/components/FormComponents/FormSelect/FormSelect.d.ts +1 -1
- package/dist/components/FormComponents/FormSelect/FormSelect.js +31 -31
- package/dist/components/GenericTable/GenericTable.js +1 -1
- package/dist/types/Filter.d.ts +34 -10
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { Group as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { s as
|
|
5
|
-
import { u as
|
|
1
|
+
import { jsx as t, jsxs as B, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { Group as y, Modal as T, Button as h, Select as W, Switch as j, IconButton as z, NotificationBadge as b } from "@element/react-components";
|
|
3
|
+
import { useState as v } from "react";
|
|
4
|
+
import { s as c } from "../../genericTable.module-Dk3yy2S3.js";
|
|
5
|
+
import { u as A } from "../../useBreakpoints-BNeVhjjZ.js";
|
|
6
6
|
import "../../alertBanner.module-HneYdVzN.js";
|
|
7
7
|
import { I as H } from "../../Iconify-CY9lZjFd.js";
|
|
8
8
|
import "../../react-tooltip.min-BzHiZW8k.js";
|
|
@@ -11,7 +11,7 @@ import "../../isArray-Ca4KR8TK.js";
|
|
|
11
11
|
import "../../_baseToString-BNXOi2Mf.js";
|
|
12
12
|
import "../../_equalByTag-DJhSpgVG.js";
|
|
13
13
|
import "../../iconify.module-C89oaw5b.js";
|
|
14
|
-
import "
|
|
14
|
+
import { SearchBar as K } from "../SearchBar/SearchBar.js";
|
|
15
15
|
import "../../listArea.module-CGpHPOji.js";
|
|
16
16
|
import "../../verticalDivider.module-C3_GL-fH.js";
|
|
17
17
|
import "../../baseView.module-ve87u_d0.js";
|
|
@@ -31,123 +31,139 @@ import "react-hook-form";
|
|
|
31
31
|
import "../../formDatePicker.module-BV3ma_7y.js";
|
|
32
32
|
import "../../formSelect.module-C18N-SsT.js";
|
|
33
33
|
import "../../formText.module-C0by6_DK.js";
|
|
34
|
-
const
|
|
35
|
-
clearFilterText:
|
|
36
|
-
closeCallback:
|
|
37
|
-
currentFilter:
|
|
38
|
-
filterButtonAsIcon:
|
|
39
|
-
filterButtonText:
|
|
40
|
-
filterModalTitle:
|
|
41
|
-
filters:
|
|
42
|
-
modalCancelButtonText:
|
|
43
|
-
modalConfirmButtonText:
|
|
44
|
-
useModal:
|
|
34
|
+
const Bt = ({
|
|
35
|
+
clearFilterText: m,
|
|
36
|
+
closeCallback: a,
|
|
37
|
+
currentFilter: i,
|
|
38
|
+
filterButtonAsIcon: n = !1,
|
|
39
|
+
filterButtonText: r,
|
|
40
|
+
filterModalTitle: p,
|
|
41
|
+
filters: d,
|
|
42
|
+
modalCancelButtonText: u,
|
|
43
|
+
modalConfirmButtonText: s,
|
|
44
|
+
useModal: e = !0
|
|
45
45
|
}) => {
|
|
46
|
-
const { isDesktop:
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const { isDesktop: N } = A(), [w, g] = v(!1), [f, C] = v(i), [O, x] = v(0), S = () => {
|
|
47
|
+
g(!1), a(f), x(
|
|
48
|
+
f.reduce((l, { filterValue: o }) => o === void 0 ? l : typeof o == "boolean" ? o ? l + 1 : l : Array.isArray(o) ? l + o.length : typeof o == "string" && o.length ? l + 1 : l, 0)
|
|
49
49
|
);
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
const
|
|
54
|
-
...
|
|
55
|
-
|
|
50
|
+
}, _ = () => {
|
|
51
|
+
C([]), x(0);
|
|
52
|
+
}, F = (l) => {
|
|
53
|
+
const o = [
|
|
54
|
+
...f.filter((D) => D.id !== l.id),
|
|
55
|
+
l
|
|
56
56
|
];
|
|
57
|
-
|
|
57
|
+
C(o), e || a(o);
|
|
58
58
|
};
|
|
59
|
-
return
|
|
59
|
+
return e ? /* @__PURE__ */ B(I, { children: [
|
|
60
60
|
/* @__PURE__ */ t(
|
|
61
|
-
|
|
61
|
+
G,
|
|
62
62
|
{
|
|
63
|
-
filterButtonText:
|
|
64
|
-
filterButtonAsIcon:
|
|
65
|
-
count:
|
|
66
|
-
onClick: () =>
|
|
63
|
+
filterButtonText: r,
|
|
64
|
+
filterButtonAsIcon: n,
|
|
65
|
+
count: O,
|
|
66
|
+
onClick: () => g(!0)
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
69
|
/* @__PURE__ */ t(
|
|
70
|
-
|
|
70
|
+
T,
|
|
71
71
|
{
|
|
72
|
-
open:
|
|
73
|
-
onClose:
|
|
74
|
-
title:
|
|
75
|
-
modalSize:
|
|
76
|
-
headerActions: /* @__PURE__ */ t(
|
|
77
|
-
dismissiveButton: /* @__PURE__ */ t(
|
|
78
|
-
primaryButton: /* @__PURE__ */ t(
|
|
79
|
-
children: /* @__PURE__ */ t(
|
|
72
|
+
open: w,
|
|
73
|
+
onClose: S,
|
|
74
|
+
title: p,
|
|
75
|
+
modalSize: N ? "small" : "fullscreen",
|
|
76
|
+
headerActions: /* @__PURE__ */ t(h, { variant: "text", onClick: _, children: m }),
|
|
77
|
+
dismissiveButton: /* @__PURE__ */ t(h, { variant: "outlined", onClick: () => g(!1), children: u }),
|
|
78
|
+
primaryButton: /* @__PURE__ */ t(h, { variant: "filled", onClick: S, children: s }),
|
|
79
|
+
children: /* @__PURE__ */ t(y, { direction: "vertical", children: k(d, f, F) })
|
|
80
80
|
}
|
|
81
81
|
)
|
|
82
|
-
] }) : /* @__PURE__ */ t(
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
/* @__PURE__ */ t(
|
|
86
|
-
|
|
82
|
+
] }) : /* @__PURE__ */ t(y, { secondaryAlign: "center", fullWidth: !0, children: k(d, f, F, !1) });
|
|
83
|
+
}, k = (m, a, i, n = !0) => m.map(({ id: r, title: p, availableOptions: d, icon: u, type: s }) => /* @__PURE__ */ B(y, { fullWidth: !0, secondaryAlign: "center", children: [
|
|
84
|
+
u ? /* @__PURE__ */ t(H, { icon: u, iconSize: "medium" }) : null,
|
|
85
|
+
s === "select" && /* @__PURE__ */ t(
|
|
86
|
+
W,
|
|
87
87
|
{
|
|
88
|
-
className:
|
|
88
|
+
className: n ? void 0 : c.dense,
|
|
89
89
|
variant: "outlined",
|
|
90
|
-
options:
|
|
91
|
-
label:
|
|
90
|
+
options: d,
|
|
91
|
+
label: p,
|
|
92
92
|
multiSelect: !0,
|
|
93
93
|
textKey: "text",
|
|
94
94
|
valueKey: "id",
|
|
95
|
-
value:
|
|
96
|
-
onChange: (
|
|
95
|
+
value: a.find((e) => e.id === r)?.filterValue ?? [],
|
|
96
|
+
onChange: (e) => i({ id: r, type: s, filterValue: e }),
|
|
97
97
|
hoisted: !0,
|
|
98
98
|
menuMaxHeight: "300px",
|
|
99
|
-
disabled:
|
|
99
|
+
disabled: r === "location",
|
|
100
100
|
showOptionFilter: !1,
|
|
101
|
-
dense: !
|
|
102
|
-
fixedHeightInput: !
|
|
103
|
-
multiDisplayType:
|
|
101
|
+
dense: !n,
|
|
102
|
+
fixedHeightInput: !n,
|
|
103
|
+
multiDisplayType: n ? "pills" : "text"
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
s === "toggle" && /* @__PURE__ */ t(
|
|
107
|
+
j,
|
|
108
|
+
{
|
|
109
|
+
label: p,
|
|
110
|
+
onChange: (e) => i({ id: r, type: s, filterValue: e }),
|
|
111
|
+
checked: !!a.find((e) => e.id === r)?.filterValue
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
s === "search" && /* @__PURE__ */ t(
|
|
115
|
+
K,
|
|
116
|
+
{
|
|
117
|
+
placeholder: p,
|
|
118
|
+
searchTerm: a.find((e) => e.id === r)?.filterValue,
|
|
119
|
+
setSearchTerm: (e) => i({ id: r, type: s, filterValue: e })
|
|
104
120
|
}
|
|
105
121
|
)
|
|
106
|
-
] },
|
|
107
|
-
filterButtonText:
|
|
108
|
-
filterButtonAsIcon:
|
|
109
|
-
count:
|
|
110
|
-
onClick:
|
|
122
|
+
] }, r)), G = ({
|
|
123
|
+
filterButtonText: m,
|
|
124
|
+
filterButtonAsIcon: a,
|
|
125
|
+
count: i,
|
|
126
|
+
onClick: n
|
|
111
127
|
}) => {
|
|
112
|
-
const { isDesktop:
|
|
113
|
-
return
|
|
128
|
+
const { isDesktop: r } = A();
|
|
129
|
+
return a ? /* @__PURE__ */ t(
|
|
114
130
|
z,
|
|
115
131
|
{
|
|
116
132
|
icon: "filter_list_alt",
|
|
117
|
-
onClick:
|
|
118
|
-
badge:
|
|
119
|
-
|
|
133
|
+
onClick: n,
|
|
134
|
+
badge: i !== 0 && /* @__PURE__ */ t(
|
|
135
|
+
b,
|
|
120
136
|
{
|
|
121
|
-
counter:
|
|
122
|
-
className:
|
|
137
|
+
counter: i,
|
|
138
|
+
className: c.filterBadge,
|
|
123
139
|
themeColor: "secondary",
|
|
124
140
|
"data-testid": "filter-badge"
|
|
125
141
|
}
|
|
126
142
|
)
|
|
127
143
|
}
|
|
128
|
-
) : /* @__PURE__ */
|
|
144
|
+
) : /* @__PURE__ */ B(
|
|
129
145
|
"div",
|
|
130
146
|
{
|
|
131
|
-
className:
|
|
132
|
-
style: { height: "100%", width:
|
|
147
|
+
className: c.relativeParent,
|
|
148
|
+
style: { height: "100%", width: r ? void 0 : "100%" },
|
|
133
149
|
children: [
|
|
134
150
|
/* @__PURE__ */ t(
|
|
135
|
-
|
|
151
|
+
h,
|
|
136
152
|
{
|
|
137
153
|
variant: "outlined",
|
|
138
154
|
themeColor: "primary",
|
|
139
155
|
leadingIcon: "filter_list_alt",
|
|
140
|
-
onClick:
|
|
141
|
-
className:
|
|
142
|
-
fullWidth: !
|
|
143
|
-
children:
|
|
156
|
+
onClick: n,
|
|
157
|
+
className: c.filterButton,
|
|
158
|
+
fullWidth: !r,
|
|
159
|
+
children: m
|
|
144
160
|
}
|
|
145
161
|
),
|
|
146
|
-
|
|
147
|
-
|
|
162
|
+
i !== 0 && /* @__PURE__ */ t(
|
|
163
|
+
b,
|
|
148
164
|
{
|
|
149
|
-
counter:
|
|
150
|
-
className:
|
|
165
|
+
counter: i,
|
|
166
|
+
className: c.filterBadge,
|
|
151
167
|
themeColor: "secondary",
|
|
152
168
|
"data-testid": "filter-badge"
|
|
153
169
|
}
|
|
@@ -157,5 +173,5 @@ const vt = ({
|
|
|
157
173
|
);
|
|
158
174
|
};
|
|
159
175
|
export {
|
|
160
|
-
|
|
176
|
+
Bt as Filter
|
|
161
177
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { a, s as t, f as
|
|
3
|
-
import { a as
|
|
2
|
+
import { a, s as t, f as c, t as u, w as d } from "../../react.esm-Dy4VzU4L.js";
|
|
3
|
+
import { a as s } from "../../useBreakpoints-BNeVhjjZ.js";
|
|
4
4
|
import { Filter as T } from "./Filter.js";
|
|
5
|
-
import { v as
|
|
6
|
-
const o =
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { v as x, b as f, d as y, t as B, g as e } from "../../vi.JYQecGiw-BbUbJcT8.js";
|
|
6
|
+
const o = x.fn();
|
|
7
|
+
f(() => {
|
|
8
|
+
x.spyOn(s, "useBreakpoints").mockReturnValue({
|
|
9
9
|
isDesktop: !0,
|
|
10
10
|
isMobile: !1,
|
|
11
11
|
isTablet: !1,
|
|
12
12
|
isDesktopNavbar: !1
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
|
-
|
|
15
|
+
y("Filter", () => {
|
|
16
16
|
const l = [
|
|
17
17
|
{
|
|
18
18
|
id: "1",
|
|
19
19
|
title: "Filter 1",
|
|
20
|
+
type: "select",
|
|
20
21
|
icon: "farm",
|
|
21
22
|
availableOptions: [
|
|
22
23
|
{ id: "1", text: "Option 1" },
|
|
@@ -26,14 +27,25 @@ f("Filter", () => {
|
|
|
26
27
|
{
|
|
27
28
|
id: "2",
|
|
28
29
|
title: "Filter 2",
|
|
30
|
+
type: "select",
|
|
29
31
|
availableOptions: [
|
|
30
32
|
{ id: "3", text: "Option 3" },
|
|
31
33
|
{ id: "4", text: "Option 4" }
|
|
32
34
|
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "3",
|
|
38
|
+
title: "Filter Toggle",
|
|
39
|
+
type: "toggle"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "4",
|
|
43
|
+
title: "Filter Search",
|
|
44
|
+
type: "search"
|
|
33
45
|
}
|
|
34
46
|
], n = [
|
|
35
|
-
{ id: "1",
|
|
36
|
-
{ id: "2",
|
|
47
|
+
{ id: "1", filterValue: [{ id: "1", text: "Option 1" }], type: "select" },
|
|
48
|
+
{ id: "2", filterValue: [{ id: "3", text: "Option 3" }], type: "select" }
|
|
37
49
|
];
|
|
38
50
|
B("should render filter", () => {
|
|
39
51
|
a(
|
|
@@ -50,9 +62,11 @@ f("Filter", () => {
|
|
|
50
62
|
clearFilterText: "clearFilterText"
|
|
51
63
|
}
|
|
52
64
|
)
|
|
53
|
-
), e(t.getByText("filterButtonText")).toBeInTheDocument(), e(t.getByText("filterModalTitle")).toBeInTheDocument(), e(t.getByText("modalCancelButtonText")).toBeInTheDocument(), e(t.getByText("modalConfirmButtonText")).toBeInTheDocument(), e(t.getByText("clearFilterText")).toBeInTheDocument(), e(t.getByText("Filter 1")).toBeInTheDocument(), e(t.getByText("Filter 2")).toBeInTheDocument(), e(t.getByText("Option 1")).toBeInTheDocument(), e(t.getByText("Option 3")).toBeInTheDocument(), e(t.getByTestId("farm")).toBeInTheDocument();
|
|
54
|
-
const i = t.getByRole("
|
|
55
|
-
|
|
65
|
+
), e(t.getByText("filterButtonText")).toBeInTheDocument(), e(t.getByText("filterModalTitle")).toBeInTheDocument(), e(t.getByText("modalCancelButtonText")).toBeInTheDocument(), e(t.getByText("modalConfirmButtonText")).toBeInTheDocument(), e(t.getByText("clearFilterText")).toBeInTheDocument(), e(t.getByText("Filter 1")).toBeInTheDocument(), e(t.getByText("Filter 2")).toBeInTheDocument(), e(t.getByText("Option 1")).toBeInTheDocument(), e(t.getByText("Option 3")).toBeInTheDocument(), e(t.getByTestId("farm")).toBeInTheDocument(), e(t.getByText("Filter Toggle")).toBeInTheDocument();
|
|
66
|
+
const i = t.getByRole("textbox");
|
|
67
|
+
e(i.getAttribute("placeholder")).toBe("Filter Search");
|
|
68
|
+
const m = t.getByRole("button", { name: "modalConfirmButtonText" });
|
|
69
|
+
c.click(m), u.act(() => {
|
|
56
70
|
e(o).toHaveBeenCalledTimes(1), e(t.getByText("2")).toBeInTheDocument();
|
|
57
71
|
});
|
|
58
72
|
}), B("should clear filter", () => {
|
|
@@ -72,7 +86,7 @@ f("Filter", () => {
|
|
|
72
86
|
)
|
|
73
87
|
);
|
|
74
88
|
const i = t.getByText("clearFilterText");
|
|
75
|
-
|
|
89
|
+
c.click(i), u.act(() => {
|
|
76
90
|
e(o).toHaveBeenCalledTimes(1), e(t.queryByTestId("filter-badge")).not.toBeInTheDocument();
|
|
77
91
|
});
|
|
78
92
|
}), B("should close filter", () => {
|
|
@@ -92,9 +106,9 @@ f("Filter", () => {
|
|
|
92
106
|
)
|
|
93
107
|
);
|
|
94
108
|
const i = t.getByRole("button", { name: "modalCancelButtonText" });
|
|
95
|
-
|
|
109
|
+
c.click(i), u.act(() => {
|
|
96
110
|
e(o).toHaveBeenCalledTimes(1), e(t.queryByTestId("filter-badge")).not.toBeInTheDocument();
|
|
97
|
-
}),
|
|
111
|
+
}), d(() => {
|
|
98
112
|
e(t.queryByText("filterModalTitle")).not.toBeInTheDocument(), e(t.queryByText("modalCancelButtonText")).not.toBeInTheDocument(), e(t.queryByText("modalConfirmButtonText")).not.toBeInTheDocument(), e(t.queryByText("clearFilterText")).not.toBeInTheDocument();
|
|
99
113
|
});
|
|
100
114
|
}), B("should render as icon button ", () => {
|
|
@@ -4,7 +4,7 @@ import { FieldPath, FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
|
4
4
|
/**
|
|
5
5
|
* a generic FormSelector property type. the generic T represents the interface, which is used in the form, like {@link CreateOrganizationDto}
|
|
6
6
|
*/
|
|
7
|
-
type FormSelectProps<T extends FieldValues> = Omit<SelectProps, 'className' | 'clearable' | 'disabled' | 'helperText' | 'helperTextPersistent' | 'hidden' | 'hoisted' | 'label' | 'menuMaxHeight' | 'multi' | 'multiSelect' | 'noOptionsMessage' | '
|
|
7
|
+
type FormSelectProps<T extends FieldValues> = Omit<SelectProps, 'className' | 'clearable' | 'disabled' | 'helperText' | 'helperTextPersistent' | 'hidden' | 'hoisted' | 'label' | 'menuMaxHeight' | 'multi' | 'multiSelect' | 'noOptionsMessage' | 'options' | 'searchable' | 'textKey' | 'valid' | 'value' | 'valueKey' | 'variant'> & {
|
|
8
8
|
/** the name of the property in the form */
|
|
9
9
|
propertyName: Path<T>;
|
|
10
10
|
/** the label of the select */
|
|
@@ -3,25 +3,25 @@ import { Select as k } from "@element/react-components";
|
|
|
3
3
|
import { g as h } from "../../../get-UxX31Aph.js";
|
|
4
4
|
import { i as z } from "../../../isArray-Ca4KR8TK.js";
|
|
5
5
|
import { useMemo as S } from "react";
|
|
6
|
-
import { useFormContext as B, Controller as
|
|
6
|
+
import { useFormContext as B, Controller as C } from "react-hook-form";
|
|
7
7
|
import { H as G } from "../../../react-tooltip.min-BzHiZW8k.js";
|
|
8
8
|
import { SelectTooltipText as J } from "./SelectTooltipText.js";
|
|
9
|
-
import { s as
|
|
9
|
+
import { s as a } from "../../../formSelect.module-C18N-SsT.js";
|
|
10
10
|
const N = ({
|
|
11
11
|
propertyName: r,
|
|
12
12
|
label: d,
|
|
13
|
-
options:
|
|
14
|
-
multi:
|
|
13
|
+
options: n,
|
|
14
|
+
multi: m = !1,
|
|
15
15
|
disabled: F = !1,
|
|
16
16
|
hoisted: I = !1,
|
|
17
17
|
hidden: $ = !1,
|
|
18
18
|
valueKey: i = "value",
|
|
19
19
|
textKey: T = "text",
|
|
20
20
|
clearable: j = !1,
|
|
21
|
-
searchable:
|
|
22
|
-
noOptionsMessage:
|
|
23
|
-
rules:
|
|
24
|
-
...
|
|
21
|
+
searchable: v = !0,
|
|
22
|
+
noOptionsMessage: w = "",
|
|
23
|
+
rules: o,
|
|
24
|
+
...l
|
|
25
25
|
}) => {
|
|
26
26
|
const {
|
|
27
27
|
control: p,
|
|
@@ -29,12 +29,12 @@ const N = ({
|
|
|
29
29
|
} = B(), c = S(
|
|
30
30
|
() => !H && h(s, r) !== void 0,
|
|
31
31
|
[s, r, H]
|
|
32
|
-
),
|
|
33
|
-
() =>
|
|
34
|
-
[
|
|
32
|
+
), A = S(
|
|
33
|
+
() => o?.required?.value,
|
|
34
|
+
[o]
|
|
35
35
|
), D = S(
|
|
36
|
-
() =>
|
|
37
|
-
[
|
|
36
|
+
() => o?.required?.message,
|
|
37
|
+
[o]
|
|
38
38
|
), E = () => {
|
|
39
39
|
if (s && s[r]) {
|
|
40
40
|
const u = s[r]?.message;
|
|
@@ -42,33 +42,33 @@ const N = ({
|
|
|
42
42
|
}
|
|
43
43
|
return D;
|
|
44
44
|
};
|
|
45
|
-
return $ ? /* @__PURE__ */ e(
|
|
46
|
-
|
|
45
|
+
return $ ? /* @__PURE__ */ e(C, { name: r, control: p, render: () => /* @__PURE__ */ e(M, {}) }) : /* @__PURE__ */ e("div", { className: a.formSelectContainer, "data-tooltip-id": d, children: /* @__PURE__ */ e(
|
|
46
|
+
C,
|
|
47
47
|
{
|
|
48
48
|
name: r,
|
|
49
|
-
rules:
|
|
49
|
+
rules: o,
|
|
50
50
|
control: p,
|
|
51
51
|
render: ({ field: { ref: u, onChange: x, value: q, ...O } }) => {
|
|
52
|
-
let g =
|
|
53
|
-
z(
|
|
54
|
-
const f =
|
|
52
|
+
let g = n;
|
|
53
|
+
z(n) && h(n[0], "options") !== void 0 && (g = n.flatMap((t) => h(t, "options") ?? []));
|
|
54
|
+
const f = m ? g?.filter(
|
|
55
55
|
(t) => q?.includes(t[i])
|
|
56
|
-
) : g?.find((t) => t[i] === q), P =
|
|
56
|
+
) : g?.find((t) => t[i] === q), P = m && l.multiDisplayType === "text" && l.fixedHeightInput;
|
|
57
57
|
return /* @__PURE__ */ b(M, { children: [
|
|
58
58
|
/* @__PURE__ */ e(
|
|
59
59
|
k,
|
|
60
60
|
{
|
|
61
61
|
...O,
|
|
62
|
-
...
|
|
62
|
+
...l,
|
|
63
63
|
value: f ?? [],
|
|
64
64
|
label: d,
|
|
65
65
|
variant: "outlined",
|
|
66
66
|
helperText: E(),
|
|
67
|
-
helperTextPersistent:
|
|
68
|
-
options:
|
|
67
|
+
helperTextPersistent: A || c,
|
|
68
|
+
options: n,
|
|
69
69
|
valid: !c,
|
|
70
|
-
multiSelect:
|
|
71
|
-
className: `${
|
|
70
|
+
multiSelect: m,
|
|
71
|
+
className: `${a.formSelect} ${c ? a.invalid : ""} ${P ? a.multiText : ""}`,
|
|
72
72
|
disabled: F,
|
|
73
73
|
valueKey: i,
|
|
74
74
|
textKey: T,
|
|
@@ -77,15 +77,15 @@ const N = ({
|
|
|
77
77
|
x(t);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
80
|
+
if (m) {
|
|
81
81
|
x(t.map((V) => V[i]));
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
x(t[i]);
|
|
84
|
+
x(t[i]), l?.onChange?.(t);
|
|
85
85
|
},
|
|
86
86
|
hoisted: I,
|
|
87
|
-
noOptionsMessage:
|
|
88
|
-
searchable:
|
|
87
|
+
noOptionsMessage: w,
|
|
88
|
+
searchable: v,
|
|
89
89
|
clearable: j,
|
|
90
90
|
menuMaxHeight: "15rem"
|
|
91
91
|
}
|
|
@@ -97,8 +97,8 @@ const N = ({
|
|
|
97
97
|
noArrow: !0,
|
|
98
98
|
place: "bottom",
|
|
99
99
|
delayShow: 420,
|
|
100
|
-
className:
|
|
101
|
-
hidden: !f || f.length === 0 || !
|
|
100
|
+
className: a.tooltip,
|
|
101
|
+
hidden: !f || f.length === 0 || !l.fixedHeightInput,
|
|
102
102
|
children: /* @__PURE__ */ e(J, { value: f, textKey: T, valueKey: i })
|
|
103
103
|
}
|
|
104
104
|
)
|
package/dist/types/Filter.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
+
type FilterDataCommon = {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
};
|
|
6
|
+
type FilterDataType = {
|
|
7
|
+
type: 'select';
|
|
8
|
+
/**
|
|
9
|
+
* Available options for the filter
|
|
10
|
+
*/
|
|
11
|
+
availableOptions: FilterOption[];
|
|
12
|
+
} | {
|
|
13
|
+
type: 'toggle';
|
|
14
|
+
availableOptions?: never;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'search';
|
|
17
|
+
availableOptions?: never;
|
|
18
|
+
};
|
|
1
19
|
/**
|
|
2
20
|
* Filter data type
|
|
3
21
|
* @param id - filter id (unique)
|
|
4
22
|
* @param title - filter title
|
|
5
23
|
* @param availableOptions - available options for the filter
|
|
6
24
|
*/
|
|
7
|
-
export type FilterData =
|
|
8
|
-
id: string;
|
|
9
|
-
title: string;
|
|
10
|
-
icon?: string;
|
|
11
|
-
availableOptions: FilterOption[];
|
|
12
|
-
};
|
|
25
|
+
export type FilterData = FilterDataCommon & FilterDataType;
|
|
13
26
|
/**
|
|
14
27
|
* Filter option data type
|
|
15
28
|
* @param id - option id (unique)
|
|
@@ -21,12 +34,23 @@ export type FilterOption = {
|
|
|
21
34
|
text: string;
|
|
22
35
|
icon?: string;
|
|
23
36
|
};
|
|
37
|
+
type FilterSelectionCommon = {
|
|
38
|
+
id: string;
|
|
39
|
+
};
|
|
40
|
+
type FilterSelectionType = {
|
|
41
|
+
type: 'select';
|
|
42
|
+
filterValue: FilterOption[];
|
|
43
|
+
} | {
|
|
44
|
+
type: 'toggle';
|
|
45
|
+
filterValue: boolean;
|
|
46
|
+
} | {
|
|
47
|
+
type: 'search';
|
|
48
|
+
filterValue: string | undefined;
|
|
49
|
+
};
|
|
24
50
|
/**
|
|
25
51
|
* Filter selection data type
|
|
26
52
|
* @param id - filter id (unique)
|
|
27
53
|
* @param selectedOptions - selected options of the filter (multiple)
|
|
28
54
|
*/
|
|
29
|
-
export type FilterSelection =
|
|
30
|
-
|
|
31
|
-
selectedOptions: FilterOption[];
|
|
32
|
-
};
|
|
55
|
+
export type FilterSelection = FilterSelectionCommon & FilterSelectionType;
|
|
56
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortiview/shared-components",
|
|
3
3
|
"description": "This is a shared component library. It should used in the HortiView platform and its modules.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7544",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
|
|
7
7
|
"author": "Falk Menge <falk.menge.ext@bayer.com>",
|