@hortiview/shared-components 0.0.8648 → 0.0.8913
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,92 +1,97 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Datepicker as
|
|
3
|
-
import { g as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { useFormContext as
|
|
6
|
-
import { s as
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
return new Date(
|
|
1
|
+
import { jsx as s, jsxs as Y } from "react/jsx-runtime";
|
|
2
|
+
import { Datepicker as M, Divider as U, Padding as b, Button as j } from "@element/react-components";
|
|
3
|
+
import { g as H } from "../../../get-UxX31Aph.js";
|
|
4
|
+
import { useMemo as a, useState as Q } from "react";
|
|
5
|
+
import { useFormContext as $, Controller as B } from "react-hook-form";
|
|
6
|
+
import { s as d } from "../../../formDatePicker.module-BV3ma_7y.js";
|
|
7
|
+
const f = (e) => {
|
|
8
|
+
const i = new Date(e), D = i.getUTCDate(), g = i.getUTCMonth(), m = i.getUTCFullYear();
|
|
9
|
+
return new Date(m, g, D);
|
|
10
10
|
}, G = ({
|
|
11
|
-
propertyName:
|
|
12
|
-
label:
|
|
13
|
-
closeLabel:
|
|
14
|
-
className:
|
|
15
|
-
minRangeYear:
|
|
16
|
-
maxRangeYear:
|
|
17
|
-
locale:
|
|
18
|
-
rules:
|
|
19
|
-
...
|
|
11
|
+
propertyName: e,
|
|
12
|
+
label: i,
|
|
13
|
+
closeLabel: D,
|
|
14
|
+
className: g,
|
|
15
|
+
minRangeYear: m,
|
|
16
|
+
maxRangeYear: S,
|
|
17
|
+
locale: p,
|
|
18
|
+
rules: c,
|
|
19
|
+
...P
|
|
20
20
|
}) => {
|
|
21
21
|
const {
|
|
22
|
-
control:
|
|
23
|
-
formState: { errors:
|
|
24
|
-
} =
|
|
25
|
-
() =>
|
|
26
|
-
[
|
|
27
|
-
),
|
|
28
|
-
() =>
|
|
29
|
-
[
|
|
30
|
-
),
|
|
31
|
-
() => (/* @__PURE__ */ new Date()).getFullYear() - (
|
|
32
|
-
[
|
|
33
|
-
),
|
|
34
|
-
() => (/* @__PURE__ */ new Date()).getFullYear() + (
|
|
35
|
-
[
|
|
36
|
-
),
|
|
37
|
-
() => !
|
|
38
|
-
[
|
|
39
|
-
),
|
|
40
|
-
valid: !
|
|
41
|
-
helperTextPersistent:
|
|
22
|
+
control: T,
|
|
23
|
+
formState: { errors: n, isValidating: C }
|
|
24
|
+
} = $(), h = a(
|
|
25
|
+
() => c?.required?.value,
|
|
26
|
+
[c]
|
|
27
|
+
), k = a(
|
|
28
|
+
() => c?.required?.message,
|
|
29
|
+
[c]
|
|
30
|
+
), O = a(
|
|
31
|
+
() => (/* @__PURE__ */ new Date()).getFullYear() - (m ?? 95),
|
|
32
|
+
[m]
|
|
33
|
+
), v = a(
|
|
34
|
+
() => (/* @__PURE__ */ new Date()).getFullYear() + (S ?? 15),
|
|
35
|
+
[S]
|
|
36
|
+
), u = a(
|
|
37
|
+
() => !C && H(n, e) !== void 0,
|
|
38
|
+
[n, e, C]
|
|
39
|
+
), w = a(() => ({
|
|
40
|
+
valid: !u,
|
|
41
|
+
helperTextPersistent: u || h,
|
|
42
42
|
helperText: (() => {
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
return
|
|
43
|
+
if (n && n[e]) {
|
|
44
|
+
const o = n[e]?.message;
|
|
45
|
+
return o || "Invalid input";
|
|
46
46
|
}
|
|
47
|
-
return
|
|
47
|
+
return k;
|
|
48
48
|
})(),
|
|
49
|
-
className: `${
|
|
50
|
-
}), [
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
|
|
49
|
+
className: `${d.fromPickerText} ${u ? d.invalid : ""}`
|
|
50
|
+
}), [n, k, e, h, u]), [F, x] = Q(!1);
|
|
51
|
+
return /* @__PURE__ */ s(
|
|
52
|
+
B,
|
|
53
53
|
{
|
|
54
|
-
name:
|
|
55
|
-
rules:
|
|
56
|
-
control:
|
|
57
|
-
render: ({ field: { ref:
|
|
58
|
-
|
|
54
|
+
name: e,
|
|
55
|
+
rules: c,
|
|
56
|
+
control: T,
|
|
57
|
+
render: ({ field: { ref: I, onChange: o, value: l, ...q } }) => /* @__PURE__ */ s("div", { className: d.datePickerContainer, children: /* @__PURE__ */ s(
|
|
58
|
+
M,
|
|
59
59
|
{
|
|
60
|
-
...
|
|
61
|
-
...
|
|
62
|
-
className:
|
|
63
|
-
value:
|
|
60
|
+
...P,
|
|
61
|
+
...q,
|
|
62
|
+
className: g ?? "",
|
|
63
|
+
value: l,
|
|
64
64
|
variant: "outlined",
|
|
65
|
-
label:
|
|
66
|
-
format: (
|
|
65
|
+
label: i,
|
|
66
|
+
format: (t) => t ? f(t.toISOString()).toLocaleDateString(p ?? "en") : "",
|
|
67
67
|
disableClearing: !0,
|
|
68
|
-
trailingContent: /* @__PURE__ */ Y("div", { className:
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
68
|
+
trailingContent: /* @__PURE__ */ Y("div", { className: d.trailingContent, children: [
|
|
69
|
+
/* @__PURE__ */ s(U, {}),
|
|
70
|
+
/* @__PURE__ */ s(b, { variant: "dense", children: /* @__PURE__ */ s(j, { label: D, variant: "text", onClick: () => x(!1) }) })
|
|
71
71
|
] }),
|
|
72
72
|
onClick: () => {
|
|
73
|
-
|
|
73
|
+
x(!0);
|
|
74
74
|
},
|
|
75
|
-
onSelect: (
|
|
76
|
-
|
|
75
|
+
onSelect: (t) => {
|
|
76
|
+
const r = f(t.toISOString());
|
|
77
|
+
o(r), x(!1);
|
|
77
78
|
},
|
|
78
|
-
onSelectMonth: (
|
|
79
|
-
|
|
79
|
+
onSelectMonth: (t) => {
|
|
80
|
+
const r = f(t.toISOString());
|
|
81
|
+
l && (r.setDate(l.getDate()), o(r));
|
|
80
82
|
},
|
|
81
|
-
onSelectYear: (
|
|
82
|
-
|
|
83
|
+
onSelectYear: (t) => {
|
|
84
|
+
if (l) {
|
|
85
|
+
const r = f(t.toISOString());
|
|
86
|
+
r.setDate(l.getDate()), o(r);
|
|
87
|
+
}
|
|
83
88
|
},
|
|
84
89
|
hoisted: !0,
|
|
85
|
-
calendarProps: { hoisted: !0, className:
|
|
86
|
-
minQuickSelectYear:
|
|
87
|
-
maxQuickSelectYear:
|
|
90
|
+
calendarProps: { hoisted: !0, className: d.datePickerCalendar },
|
|
91
|
+
minQuickSelectYear: O,
|
|
92
|
+
maxQuickSelectYear: v,
|
|
88
93
|
readOnly: !0,
|
|
89
|
-
textfieldProps:
|
|
94
|
+
textfieldProps: w,
|
|
90
95
|
alwaysOpen: F
|
|
91
96
|
}
|
|
92
97
|
) })
|
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.8913",
|
|
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>",
|