@hortiview/shared-components 0.0.8622 → 0.0.8731
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.
|
@@ -10,6 +10,7 @@ type FilterProps = {
|
|
|
10
10
|
filterModalTitle: string;
|
|
11
11
|
filters: FilterData[];
|
|
12
12
|
useModal?: boolean;
|
|
13
|
+
selectAllLabel?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* Filter component that allows the user to filter the data provided
|
|
@@ -26,5 +27,5 @@ type FilterProps = {
|
|
|
26
27
|
* if false the filters will be displayed directly in the page, be aware that the filters will be displayed in a row and there needs to be enough space for them
|
|
27
28
|
* @returns
|
|
28
29
|
*/
|
|
29
|
-
export declare const Filter: ({ clearFilterText, closeCallback, currentFilter, filterButtonAsIcon, filterButtonText, filterModalTitle, filters, modalCancelButtonText, modalConfirmButtonText, useModal, }: FilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const Filter: ({ clearFilterText, closeCallback, currentFilter, filterButtonAsIcon, filterButtonText, filterModalTitle, filters, modalCancelButtonText, modalConfirmButtonText, useModal, selectAllLabel, }: FilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { Group as
|
|
3
|
-
import { useState as
|
|
1
|
+
import { jsx as t, jsxs as C, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import { Group as B, Button as h, Select as W, Switch as j, IconButton as z, NotificationBadge as N } from "@element/react-components";
|
|
3
|
+
import { useState as y } from "react";
|
|
4
4
|
import { s as c } from "../../genericTable.module-Dk3yy2S3.js";
|
|
5
5
|
import { u as A } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
6
6
|
import "../../alertBanner.module-BPiKN0gh.js";
|
|
7
|
-
import { I as
|
|
7
|
+
import { I as H } from "../../Iconify-CY9lZjFd.js";
|
|
8
8
|
import "../../react-tooltip.min-BzHiZW8k.js";
|
|
9
9
|
import "../../overflowTooltip.module-YyRN2MGc.js";
|
|
10
10
|
import "../../basicHeading.module-BYb8xvuk.js";
|
|
@@ -12,7 +12,7 @@ import "../../isArray-Ca4KR8TK.js";
|
|
|
12
12
|
import "../../_baseToString-BNXOi2Mf.js";
|
|
13
13
|
import "../../_equalByTag-DJhSpgVG.js";
|
|
14
14
|
import "../../iconify.module-C89oaw5b.js";
|
|
15
|
-
import { SearchBar as
|
|
15
|
+
import { SearchBar as K } from "../SearchBar/SearchBar.js";
|
|
16
16
|
import "../../listArea.module-BhO_OJ1S.js";
|
|
17
17
|
import "../../verticalDivider.module-C3_GL-fH.js";
|
|
18
18
|
import "../../baseView.module-uWbm_a5f.js";
|
|
@@ -20,7 +20,7 @@ import "../../BlockView.module-BPlNT5uh.js";
|
|
|
20
20
|
import "../../chipCard.module-BjpKuf1b.js";
|
|
21
21
|
import "lodash";
|
|
22
22
|
import "../../contextMenu.module-vNQHb48g.js";
|
|
23
|
-
import { Modal as
|
|
23
|
+
import { Modal as G } from "../Modal/Modal.js";
|
|
24
24
|
import "../../deleteModal.module-Ds3MDzdl.js";
|
|
25
25
|
import "../../disclaimer.module-BZydt-Q_.js";
|
|
26
26
|
import "../../genericCard.module-DrQu86jX.js";
|
|
@@ -34,121 +34,123 @@ import "react-hook-form";
|
|
|
34
34
|
import "../../formDatePicker.module-BV3ma_7y.js";
|
|
35
35
|
import "../../formSelect.module-DMHh1bp8.js";
|
|
36
36
|
import "../../formText.module-C0by6_DK.js";
|
|
37
|
-
const
|
|
38
|
-
clearFilterText:
|
|
39
|
-
closeCallback:
|
|
40
|
-
currentFilter:
|
|
41
|
-
filterButtonAsIcon:
|
|
42
|
-
filterButtonText:
|
|
43
|
-
filterModalTitle:
|
|
44
|
-
filters:
|
|
45
|
-
modalCancelButtonText:
|
|
46
|
-
modalConfirmButtonText:
|
|
47
|
-
useModal:
|
|
37
|
+
const Ft = ({
|
|
38
|
+
clearFilterText: f,
|
|
39
|
+
closeCallback: s,
|
|
40
|
+
currentFilter: e,
|
|
41
|
+
filterButtonAsIcon: m = !1,
|
|
42
|
+
filterButtonText: n,
|
|
43
|
+
filterModalTitle: i,
|
|
44
|
+
filters: p,
|
|
45
|
+
modalCancelButtonText: g,
|
|
46
|
+
modalConfirmButtonText: u,
|
|
47
|
+
useModal: l = !0,
|
|
48
|
+
selectAllLabel: r
|
|
48
49
|
}) => {
|
|
49
|
-
const { isDesktop:
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const { isDesktop: w } = A(), [O, v] = y(!1), [d, x] = y(e), [_, S] = y(0), F = () => {
|
|
51
|
+
v(!1), s(d), S(
|
|
52
|
+
d.reduce((a, { filterValue: o }) => o === void 0 ? a : typeof o == "boolean" ? o ? a + 1 : a : Array.isArray(o) ? a + o.length : typeof o == "string" && o.length ? a + 1 : a, 0)
|
|
52
53
|
);
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
},
|
|
54
|
+
}, D = () => {
|
|
55
|
+
x([]), S(0);
|
|
56
|
+
}, k = (a) => {
|
|
56
57
|
const o = [
|
|
57
|
-
...
|
|
58
|
-
|
|
58
|
+
...d.filter((I) => I.id !== a.id),
|
|
59
|
+
a
|
|
59
60
|
];
|
|
60
|
-
|
|
61
|
+
x(o), l || s(o);
|
|
61
62
|
};
|
|
62
|
-
return
|
|
63
|
+
return l ? /* @__PURE__ */ C(T, { children: [
|
|
63
64
|
/* @__PURE__ */ t(
|
|
64
|
-
|
|
65
|
+
P,
|
|
65
66
|
{
|
|
66
|
-
filterButtonText:
|
|
67
|
-
filterButtonAsIcon:
|
|
68
|
-
count:
|
|
69
|
-
onClick: () =>
|
|
67
|
+
filterButtonText: n,
|
|
68
|
+
filterButtonAsIcon: m,
|
|
69
|
+
count: _,
|
|
70
|
+
onClick: () => v(!0)
|
|
70
71
|
}
|
|
71
72
|
),
|
|
72
73
|
/* @__PURE__ */ t(
|
|
73
|
-
|
|
74
|
+
G,
|
|
74
75
|
{
|
|
75
|
-
open:
|
|
76
|
-
onClose:
|
|
77
|
-
title:
|
|
78
|
-
modalSize:
|
|
79
|
-
headerActions: /* @__PURE__ */ t(h, { variant: "text", onClick:
|
|
80
|
-
dismissiveButton: /* @__PURE__ */ t(h, { variant: "outlined", onClick: () =>
|
|
81
|
-
primaryButton: /* @__PURE__ */ t(h, { variant: "filled", onClick:
|
|
82
|
-
children: /* @__PURE__ */ t(
|
|
76
|
+
open: O,
|
|
77
|
+
onClose: F,
|
|
78
|
+
title: i,
|
|
79
|
+
modalSize: w ? "small" : "fullscreen",
|
|
80
|
+
headerActions: /* @__PURE__ */ t(h, { variant: "text", onClick: D, children: f }),
|
|
81
|
+
dismissiveButton: /* @__PURE__ */ t(h, { variant: "outlined", onClick: () => v(!1), children: g }),
|
|
82
|
+
primaryButton: /* @__PURE__ */ t(h, { variant: "filled", onClick: F, children: u }),
|
|
83
|
+
children: /* @__PURE__ */ t(B, { direction: "vertical", children: b(p, d, k, r) })
|
|
83
84
|
}
|
|
84
85
|
)
|
|
85
|
-
] }) : /* @__PURE__ */ t(
|
|
86
|
-
},
|
|
87
|
-
u ? /* @__PURE__ */ t(
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
] }) : /* @__PURE__ */ t(B, { secondaryAlign: "center", fullWidth: !0, children: b(p, d, k, r, !1) });
|
|
87
|
+
}, b = (f, s, e, m, n = !0) => f.map(({ id: i, title: p, availableOptions: g, icon: u, type: l }) => /* @__PURE__ */ C(B, { fullWidth: !0, secondaryAlign: "center", children: [
|
|
88
|
+
u ? /* @__PURE__ */ t(H, { icon: u, iconSize: "medium" }) : null,
|
|
89
|
+
l === "select" && /* @__PURE__ */ t(
|
|
90
|
+
W,
|
|
90
91
|
{
|
|
92
|
+
selectAllLabel: m,
|
|
91
93
|
className: n ? void 0 : c.dense,
|
|
92
94
|
variant: "outlined",
|
|
93
|
-
options:
|
|
95
|
+
options: g,
|
|
94
96
|
label: p,
|
|
95
97
|
multiSelect: !0,
|
|
96
98
|
textKey: "text",
|
|
97
99
|
valueKey: "id",
|
|
98
|
-
value:
|
|
99
|
-
onChange: (
|
|
100
|
+
value: s.find((r) => r.id === i)?.filterValue ?? [],
|
|
101
|
+
onChange: (r) => e({ id: i, type: l, filterValue: r }),
|
|
100
102
|
hoisted: !0,
|
|
101
103
|
menuMaxHeight: "300px",
|
|
102
|
-
disabled:
|
|
104
|
+
disabled: i === "location",
|
|
103
105
|
showOptionFilter: !1,
|
|
104
106
|
dense: !n,
|
|
105
107
|
fixedHeightInput: !n,
|
|
106
108
|
multiDisplayType: n ? "pills" : "text"
|
|
107
109
|
}
|
|
108
110
|
),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
l === "toggle" && /* @__PURE__ */ t(
|
|
112
|
+
j,
|
|
111
113
|
{
|
|
112
114
|
label: p,
|
|
113
|
-
onChange: (
|
|
114
|
-
checked: !!
|
|
115
|
+
onChange: (r) => e({ id: i, type: l, filterValue: r }),
|
|
116
|
+
checked: !!s.find((r) => r.id === i)?.filterValue
|
|
115
117
|
}
|
|
116
118
|
),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
l === "search" && /* @__PURE__ */ t(
|
|
120
|
+
K,
|
|
119
121
|
{
|
|
120
122
|
placeholder: p,
|
|
121
|
-
searchTerm:
|
|
122
|
-
setSearchTerm: (
|
|
123
|
+
searchTerm: s.find((r) => r.id === i)?.filterValue,
|
|
124
|
+
setSearchTerm: (r) => e({ id: i, type: l, filterValue: r })
|
|
123
125
|
}
|
|
124
126
|
)
|
|
125
|
-
] },
|
|
126
|
-
filterButtonText:
|
|
127
|
-
filterButtonAsIcon:
|
|
128
|
-
count:
|
|
129
|
-
onClick:
|
|
127
|
+
] }, i)), P = ({
|
|
128
|
+
filterButtonText: f,
|
|
129
|
+
filterButtonAsIcon: s,
|
|
130
|
+
count: e,
|
|
131
|
+
onClick: m
|
|
130
132
|
}) => {
|
|
131
|
-
const { isDesktop:
|
|
132
|
-
return
|
|
133
|
-
|
|
133
|
+
const { isDesktop: n } = A();
|
|
134
|
+
return s ? /* @__PURE__ */ t(
|
|
135
|
+
z,
|
|
134
136
|
{
|
|
135
137
|
icon: "filter_list_alt",
|
|
136
|
-
onClick:
|
|
137
|
-
badge:
|
|
138
|
-
|
|
138
|
+
onClick: m,
|
|
139
|
+
badge: e !== 0 && /* @__PURE__ */ t(
|
|
140
|
+
N,
|
|
139
141
|
{
|
|
140
|
-
counter:
|
|
142
|
+
counter: e,
|
|
141
143
|
className: c.filterBadge,
|
|
142
144
|
themeColor: "secondary",
|
|
143
145
|
"data-testid": "filter-badge"
|
|
144
146
|
}
|
|
145
147
|
)
|
|
146
148
|
}
|
|
147
|
-
) : /* @__PURE__ */
|
|
149
|
+
) : /* @__PURE__ */ C(
|
|
148
150
|
"div",
|
|
149
151
|
{
|
|
150
152
|
className: c.relativeParent,
|
|
151
|
-
style: { height: "100%", width:
|
|
153
|
+
style: { height: "100%", width: n ? void 0 : "100%" },
|
|
152
154
|
children: [
|
|
153
155
|
/* @__PURE__ */ t(
|
|
154
156
|
h,
|
|
@@ -156,16 +158,16 @@ const St = ({
|
|
|
156
158
|
variant: "outlined",
|
|
157
159
|
themeColor: "primary",
|
|
158
160
|
leadingIcon: "filter_list_alt",
|
|
159
|
-
onClick:
|
|
161
|
+
onClick: m,
|
|
160
162
|
className: c.filterButton,
|
|
161
|
-
fullWidth: !
|
|
162
|
-
children:
|
|
163
|
+
fullWidth: !n,
|
|
164
|
+
children: f
|
|
163
165
|
}
|
|
164
166
|
),
|
|
165
|
-
|
|
166
|
-
|
|
167
|
+
e !== 0 && /* @__PURE__ */ t(
|
|
168
|
+
N,
|
|
167
169
|
{
|
|
168
|
-
counter:
|
|
170
|
+
counter: e,
|
|
169
171
|
className: c.filterBadge,
|
|
170
172
|
themeColor: "secondary",
|
|
171
173
|
"data-testid": "filter-badge"
|
|
@@ -176,5 +178,5 @@ const St = ({
|
|
|
176
178
|
);
|
|
177
179
|
};
|
|
178
180
|
export {
|
|
179
|
-
|
|
181
|
+
Ft as Filter
|
|
180
182
|
};
|
|
@@ -1,69 +1,65 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Elevation as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { u as
|
|
5
|
-
import { s as
|
|
6
|
-
const
|
|
7
|
-
tabs:
|
|
8
|
-
hasHash:
|
|
9
|
-
hash:
|
|
1
|
+
import { jsx as r, jsxs as m, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { Elevation as b, Group as o, TabBar as y, Tab as I, Padding as N } from "@element/react-components";
|
|
3
|
+
import { useState as $ } from "react";
|
|
4
|
+
import { u as k } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
5
|
+
import { s as n } from "../../HashTabView.module-DUekkiTC.js";
|
|
6
|
+
const w = (a, i) => !i || !a ? 0 : a.findIndex((c) => c.hash === i.replace("#", "")) ?? 0, z = ({
|
|
7
|
+
tabs: a,
|
|
8
|
+
hasHash: i = !0,
|
|
9
|
+
hash: c = "",
|
|
10
10
|
clusterAlign: h = "start",
|
|
11
|
-
hasClusteredTabs:
|
|
11
|
+
hasClusteredTabs: p,
|
|
12
12
|
children: s,
|
|
13
|
-
verticalGap:
|
|
14
|
-
elevation:
|
|
15
|
-
backgroundColor:
|
|
16
|
-
onChange:
|
|
13
|
+
verticalGap: u = "none",
|
|
14
|
+
elevation: g = 0,
|
|
15
|
+
backgroundColor: v = "themeBackground",
|
|
16
|
+
onChange: f
|
|
17
17
|
}) => {
|
|
18
|
-
const [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
p(e);
|
|
22
|
-
}, [i, n, a]);
|
|
23
|
-
const B = (e) => {
|
|
24
|
-
const o = n[e].hash;
|
|
25
|
-
o != null && a && window.history.replaceState(null, "", `#${o}`), p(e), A?.(e);
|
|
18
|
+
const [l, T] = $(w(a, c)), { isDesktop: d } = k(), A = (e) => {
|
|
19
|
+
const t = a[e].hash;
|
|
20
|
+
t != null && i && window.history.replaceState(null, "", `#${t}`), T(e), f?.(e);
|
|
26
21
|
};
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
|
|
22
|
+
return /* @__PURE__ */ r(
|
|
23
|
+
b,
|
|
29
24
|
{
|
|
30
|
-
elevation:
|
|
31
|
-
className: `${
|
|
32
|
-
children: /* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
|
|
25
|
+
elevation: g,
|
|
26
|
+
className: `${n.elevation} ${v === "none" ? "" : n.themeBackground}`,
|
|
27
|
+
children: /* @__PURE__ */ m(o, { direction: "vertical", gap: u, secondaryAlign: "stretch", children: [
|
|
28
|
+
/* @__PURE__ */ m(o, { direction: d ? "horizontal" : "vertical", className: n.tabWrapper, children: [
|
|
29
|
+
/* @__PURE__ */ r(
|
|
30
|
+
y,
|
|
36
31
|
{
|
|
37
|
-
className:
|
|
38
|
-
clustered:
|
|
32
|
+
className: n.tabBar,
|
|
33
|
+
clustered: d ? p : !1,
|
|
39
34
|
clusterAlign: h,
|
|
40
35
|
variant: "surface",
|
|
41
|
-
activeTabIndex:
|
|
42
|
-
onTabActivated:
|
|
43
|
-
children:
|
|
44
|
-
|
|
36
|
+
activeTabIndex: l,
|
|
37
|
+
onTabActivated: A,
|
|
38
|
+
children: a.map((e, t) => /* @__PURE__ */ r(
|
|
39
|
+
I,
|
|
45
40
|
{
|
|
46
41
|
icon: e.leadingIcon,
|
|
47
|
-
className: s ?
|
|
48
|
-
|
|
42
|
+
className: s ? n.tabButton : "",
|
|
43
|
+
active: l === t,
|
|
44
|
+
children: /* @__PURE__ */ m(o, { gap: "dense", children: [
|
|
49
45
|
e.title,
|
|
50
46
|
e.trailingIcon
|
|
51
47
|
] })
|
|
52
48
|
},
|
|
53
|
-
`${
|
|
49
|
+
`${t}_${e.hash}`
|
|
54
50
|
))
|
|
55
51
|
}
|
|
56
52
|
),
|
|
57
|
-
s ? /* @__PURE__ */
|
|
58
|
-
|
|
53
|
+
s ? /* @__PURE__ */ r(
|
|
54
|
+
N,
|
|
59
55
|
{
|
|
60
56
|
variant: "dense",
|
|
61
|
-
className:
|
|
62
|
-
children: /* @__PURE__ */
|
|
57
|
+
className: d ? n.childContainer : n.childContainerPhone,
|
|
58
|
+
children: /* @__PURE__ */ r(o, { gap: "dense", primaryAlign: "center", secondaryAlign: "center", children: s })
|
|
63
59
|
}
|
|
64
|
-
) : /* @__PURE__ */
|
|
60
|
+
) : /* @__PURE__ */ r(B, {})
|
|
65
61
|
] }),
|
|
66
|
-
|
|
62
|
+
a[l]?.component
|
|
67
63
|
] })
|
|
68
64
|
}
|
|
69
65
|
);
|
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.8731",
|
|
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>",
|