@hortiview/shared-components 0.0.8648 → 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 B, Fragment as I } from "react/jsx-runtime";
2
- import { Group as y, Button as h, Select as T, Switch as W, IconButton as j, NotificationBadge as b } from "@element/react-components";
3
- import { useState as v } from "react";
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 z } from "../../Iconify-CY9lZjFd.js";
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 H } from "../SearchBar/SearchBar.js";
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 K } from "../Modal/Modal.js";
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 St = ({
38
- clearFilterText: m,
39
- closeCallback: a,
40
- currentFilter: i,
41
- filterButtonAsIcon: n = !1,
42
- filterButtonText: r,
43
- filterModalTitle: p,
44
- filters: d,
45
- modalCancelButtonText: u,
46
- modalConfirmButtonText: s,
47
- useModal: e = !0
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: N } = A(), [w, g] = v(!1), [f, C] = v(i), [O, x] = v(0), S = () => {
50
- g(!1), a(f), x(
51
- 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)
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
- C([]), x(0);
55
- }, F = (l) => {
54
+ }, D = () => {
55
+ x([]), S(0);
56
+ }, k = (a) => {
56
57
  const o = [
57
- ...f.filter((D) => D.id !== l.id),
58
- l
58
+ ...d.filter((I) => I.id !== a.id),
59
+ a
59
60
  ];
60
- C(o), e || a(o);
61
+ x(o), l || s(o);
61
62
  };
62
- return e ? /* @__PURE__ */ B(I, { children: [
63
+ return l ? /* @__PURE__ */ C(T, { children: [
63
64
  /* @__PURE__ */ t(
64
- G,
65
+ P,
65
66
  {
66
- filterButtonText: r,
67
- filterButtonAsIcon: n,
68
- count: O,
69
- onClick: () => g(!0)
67
+ filterButtonText: n,
68
+ filterButtonAsIcon: m,
69
+ count: _,
70
+ onClick: () => v(!0)
70
71
  }
71
72
  ),
72
73
  /* @__PURE__ */ t(
73
- K,
74
+ G,
74
75
  {
75
- open: w,
76
- onClose: S,
77
- title: p,
78
- modalSize: N ? "small" : "fullscreen",
79
- headerActions: /* @__PURE__ */ t(h, { variant: "text", onClick: _, children: m }),
80
- dismissiveButton: /* @__PURE__ */ t(h, { variant: "outlined", onClick: () => g(!1), children: u }),
81
- primaryButton: /* @__PURE__ */ t(h, { variant: "filled", onClick: S, children: s }),
82
- children: /* @__PURE__ */ t(y, { direction: "vertical", children: k(d, f, F) })
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(y, { secondaryAlign: "center", fullWidth: !0, children: k(d, f, F, !1) });
86
- }, 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: [
87
- u ? /* @__PURE__ */ t(z, { icon: u, iconSize: "medium" }) : null,
88
- s === "select" && /* @__PURE__ */ t(
89
- T,
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: d,
95
+ options: g,
94
96
  label: p,
95
97
  multiSelect: !0,
96
98
  textKey: "text",
97
99
  valueKey: "id",
98
- value: a.find((e) => e.id === r)?.filterValue ?? [],
99
- onChange: (e) => i({ id: r, type: s, filterValue: e }),
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: r === "location",
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
- s === "toggle" && /* @__PURE__ */ t(
110
- W,
111
+ l === "toggle" && /* @__PURE__ */ t(
112
+ j,
111
113
  {
112
114
  label: p,
113
- onChange: (e) => i({ id: r, type: s, filterValue: e }),
114
- checked: !!a.find((e) => e.id === r)?.filterValue
115
+ onChange: (r) => e({ id: i, type: l, filterValue: r }),
116
+ checked: !!s.find((r) => r.id === i)?.filterValue
115
117
  }
116
118
  ),
117
- s === "search" && /* @__PURE__ */ t(
118
- H,
119
+ l === "search" && /* @__PURE__ */ t(
120
+ K,
119
121
  {
120
122
  placeholder: p,
121
- searchTerm: a.find((e) => e.id === r)?.filterValue,
122
- setSearchTerm: (e) => i({ id: r, type: s, filterValue: e })
123
+ searchTerm: s.find((r) => r.id === i)?.filterValue,
124
+ setSearchTerm: (r) => e({ id: i, type: l, filterValue: r })
123
125
  }
124
126
  )
125
- ] }, r)), G = ({
126
- filterButtonText: m,
127
- filterButtonAsIcon: a,
128
- count: i,
129
- onClick: n
127
+ ] }, i)), P = ({
128
+ filterButtonText: f,
129
+ filterButtonAsIcon: s,
130
+ count: e,
131
+ onClick: m
130
132
  }) => {
131
- const { isDesktop: r } = A();
132
- return a ? /* @__PURE__ */ t(
133
- j,
133
+ const { isDesktop: n } = A();
134
+ return s ? /* @__PURE__ */ t(
135
+ z,
134
136
  {
135
137
  icon: "filter_list_alt",
136
- onClick: n,
137
- badge: i !== 0 && /* @__PURE__ */ t(
138
- b,
138
+ onClick: m,
139
+ badge: e !== 0 && /* @__PURE__ */ t(
140
+ N,
139
141
  {
140
- counter: i,
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__ */ B(
149
+ ) : /* @__PURE__ */ C(
148
150
  "div",
149
151
  {
150
152
  className: c.relativeParent,
151
- style: { height: "100%", width: r ? void 0 : "100%" },
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: n,
161
+ onClick: m,
160
162
  className: c.filterButton,
161
- fullWidth: !r,
162
- children: m
163
+ fullWidth: !n,
164
+ children: f
163
165
  }
164
166
  ),
165
- i !== 0 && /* @__PURE__ */ t(
166
- b,
167
+ e !== 0 && /* @__PURE__ */ t(
168
+ N,
167
169
  {
168
- counter: i,
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
- St as Filter
181
+ Ft as Filter
180
182
  };
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.8648",
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>",