@hortiview/shared-components 2.29.0-alpha.df46fcc5.1 → 2.30.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/CHANGELOG.md +58 -2
- package/GenericTableService-svNuHOet.js +98 -0
- package/assets/AllowedIconButton.css +1 -0
- package/assets/Filter.css +1 -1
- package/assets/GenericTableService.css +1 -0
- package/assets/Modal.css +1 -1
- package/components/AllowedIconButton/AllowedIconButton.js +22 -19
- package/components/ContextMenu/ContextMenu.d.ts +11 -3
- package/components/ContextMenu/ContextMenu.js +97 -87
- package/components/ContextMenu/ContextMenuService.d.ts +8 -0
- package/components/ContextMenu/ContextMenuService.js +19 -0
- package/components/Filter/Filter.js +84 -81
- package/components/FormComponents/FormNumber/CustomTextField.js +1 -1
- package/components/GenericTable/GenericTable.d.ts +6 -1
- package/components/GenericTable/GenericTable.js +2771 -2739
- package/components/GenericTable/GenericTableService.d.ts +5 -1
- package/components/GenericTable/GenericTableService.js +6 -62
- package/components/Iconify/Iconify.js +4 -4
- package/components/Modal/Modal.js +100 -98
- package/package.json +2 -2
- package/types/GenericTable.d.ts +157 -5
- package/types/Permission.d.ts +1 -1
- package/assets/GenericTable.css +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as e, jsxs as B, Fragment as
|
|
2
|
-
import { N as
|
|
3
|
-
import { B as
|
|
1
|
+
import { jsx as e, jsxs as B, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { N as y } from "../../index.es-BIgjyLDa.js";
|
|
3
|
+
import { B as g } from "../../index.es-B9C7vzr4.js";
|
|
4
4
|
import { G as v } from "../../index.es-BE1XL1dD.js";
|
|
5
|
-
import { I as
|
|
6
|
-
import { S as
|
|
7
|
-
import { c as
|
|
5
|
+
import { I as j } from "../../index.es-BwhRJBEH.js";
|
|
6
|
+
import { S as z } from "../../index.es-DCWPAtXu.js";
|
|
7
|
+
import { c as N } from "../../index-_-9ybP20.js";
|
|
8
8
|
import { useState as b } from "react";
|
|
9
|
-
import { Iconify as
|
|
10
|
-
import { u as
|
|
9
|
+
import { Iconify as G } from "../Iconify/Iconify.js";
|
|
10
|
+
import { u as $ } from "../../useBreakpoints-DDrM9Cfx.js";
|
|
11
11
|
import "../../react-tooltip.min-DKaGxvdz.js";
|
|
12
12
|
import "../../orderBy-Ce85KqD6.js";
|
|
13
|
-
import { SearchBar as
|
|
13
|
+
import { SearchBar as H } from "../SearchBar/SearchBar.js";
|
|
14
14
|
import "../../index-CuHybtft.js";
|
|
15
15
|
import "../SharedComponentsPermissionProvider/PermissionContext.js";
|
|
16
16
|
import { Modal as K } from "../Modal/Modal.js";
|
|
@@ -24,90 +24,91 @@ import "../../isString-LDbI4UeI.js";
|
|
|
24
24
|
import "../../omit-DUqu4lDk.js";
|
|
25
25
|
import "../../types/Time.js";
|
|
26
26
|
import "../../react.esm-B3AK8zW1.js";
|
|
27
|
-
import '../../assets/Filter.css';const T = "
|
|
27
|
+
import '../../assets/Filter.css';const T = "_filterButton_1qsua_1", V = "_relativeParent_1qsua_21", E = "_iconColor_1qsua_25", J = "_largeIconFix_1qsua_29", Q = "_filterBadge_1qsua_33", U = "_dense_1qsua_40", X = "_filterModal_1qsua_45", Y = "_borderRadius_1qsua_49", l = {
|
|
28
28
|
filterButton: T,
|
|
29
29
|
relativeParent: V,
|
|
30
30
|
iconColor: E,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
largeIconFix: J,
|
|
32
|
+
filterBadge: Q,
|
|
33
|
+
dense: U,
|
|
34
|
+
filterModal: X,
|
|
35
|
+
borderRadius: Y
|
|
35
36
|
}, yt = ({
|
|
36
37
|
clearFilterText: u,
|
|
37
38
|
closeCallback: d,
|
|
38
39
|
currentFilter: i,
|
|
39
|
-
filterButtonAsIcon:
|
|
40
|
-
filterButtonText:
|
|
40
|
+
filterButtonAsIcon: f = !1,
|
|
41
|
+
filterButtonText: c,
|
|
41
42
|
filterModalTitle: t,
|
|
42
|
-
filters:
|
|
43
|
+
filters: n,
|
|
43
44
|
modalCancelButtonText: m,
|
|
44
45
|
modalConfirmButtonText: h,
|
|
45
46
|
useModal: o = !0,
|
|
46
47
|
selectAllLabel: r,
|
|
47
|
-
filterButtonSize:
|
|
48
|
-
filterButtonClassName:
|
|
49
|
-
"data-testid":
|
|
48
|
+
filterButtonSize: k = "medium",
|
|
49
|
+
filterButtonClassName: I,
|
|
50
|
+
"data-testid": w
|
|
50
51
|
}) => {
|
|
51
|
-
const { isDesktop:
|
|
52
|
-
|
|
53
|
-
p.reduce((
|
|
52
|
+
const { isDesktop: A } = $(), [R, _] = b(!1), [p, x] = b(i), [O, C] = b(0), F = () => {
|
|
53
|
+
_(!1), d(p), C(
|
|
54
|
+
p.reduce((s, { filterValue: a }) => a === void 0 ? s : typeof a == "boolean" ? a ? s + 1 : s : Array.isArray(a) ? s + a.length : typeof a == "string" && a.length ? s + 1 : s, 0)
|
|
54
55
|
);
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
const
|
|
59
|
-
...p.filter((
|
|
60
|
-
|
|
56
|
+
}, P = () => {
|
|
57
|
+
x([]), C(0);
|
|
58
|
+
}, S = (s) => {
|
|
59
|
+
const a = [
|
|
60
|
+
...p.filter((D) => D.id !== s.id),
|
|
61
|
+
s
|
|
61
62
|
];
|
|
62
|
-
|
|
63
|
+
x(a), o || d(a);
|
|
63
64
|
};
|
|
64
|
-
return o ? /* @__PURE__ */ B(
|
|
65
|
+
return o ? /* @__PURE__ */ B(W, { children: [
|
|
65
66
|
/* @__PURE__ */ e(
|
|
66
|
-
|
|
67
|
+
Z,
|
|
67
68
|
{
|
|
68
|
-
filterButtonText:
|
|
69
|
-
filterButtonAsIcon:
|
|
70
|
-
count:
|
|
71
|
-
onClick: () =>
|
|
72
|
-
"data-testid":
|
|
73
|
-
filterButtonSize:
|
|
74
|
-
filterButtonClassName:
|
|
69
|
+
filterButtonText: c,
|
|
70
|
+
filterButtonAsIcon: f,
|
|
71
|
+
count: O,
|
|
72
|
+
onClick: () => _(!0),
|
|
73
|
+
"data-testid": w,
|
|
74
|
+
filterButtonSize: k,
|
|
75
|
+
filterButtonClassName: I
|
|
75
76
|
}
|
|
76
77
|
),
|
|
77
78
|
/* @__PURE__ */ e(
|
|
78
79
|
K,
|
|
79
80
|
{
|
|
80
|
-
open:
|
|
81
|
-
className:
|
|
82
|
-
onClose:
|
|
81
|
+
open: R,
|
|
82
|
+
className: l.filterModal,
|
|
83
|
+
onClose: F,
|
|
83
84
|
title: t,
|
|
84
|
-
modalSize:
|
|
85
|
-
headerActions: /* @__PURE__ */ e(
|
|
85
|
+
modalSize: A ? "small" : "fullscreen",
|
|
86
|
+
headerActions: /* @__PURE__ */ e(g, { "data-testid": "filter-clear-button", variant: "text", onClick: P, children: u }),
|
|
86
87
|
footerSupplemental: /* @__PURE__ */ e(
|
|
87
|
-
|
|
88
|
+
g,
|
|
88
89
|
{
|
|
89
90
|
"data-testid": "filter-cancel-button",
|
|
90
91
|
variant: "outlined",
|
|
91
|
-
onClick: () =>
|
|
92
|
+
onClick: () => _(!1),
|
|
92
93
|
children: m
|
|
93
94
|
}
|
|
94
95
|
),
|
|
95
|
-
actionButton: /* @__PURE__ */ e(
|
|
96
|
-
children: /* @__PURE__ */ e(v, { direction: "vertical", "data-testid": "filter-map-filters", children:
|
|
96
|
+
actionButton: /* @__PURE__ */ e(g, { "data-testid": "filter-confirm-button", variant: "filled", onClick: F, children: h }),
|
|
97
|
+
children: /* @__PURE__ */ e(v, { direction: "vertical", "data-testid": "filter-map-filters", children: q(n, p, S, r) })
|
|
97
98
|
}
|
|
98
99
|
)
|
|
99
|
-
] }) : /* @__PURE__ */ e(v, { secondaryAlign: "center", fullWidth: !0, children:
|
|
100
|
-
},
|
|
101
|
-
h ? /* @__PURE__ */ e(
|
|
100
|
+
] }) : /* @__PURE__ */ e(v, { secondaryAlign: "center", fullWidth: !0, children: q(n, p, S, r, !1) });
|
|
101
|
+
}, q = (u, d, i, f, c = !0) => u.map(({ id: t, title: n, availableOptions: m, icon: h, type: o }) => /* @__PURE__ */ B(v, { fullWidth: !0, secondaryAlign: "center", "data-testid": `filter-${o}-group-${t}`, children: [
|
|
102
|
+
h ? /* @__PURE__ */ e(G, { icon: h, iconSize: "medium" }) : null,
|
|
102
103
|
o === "select" && /* @__PURE__ */ e(
|
|
103
104
|
M,
|
|
104
105
|
{
|
|
105
106
|
"data-testid": `filter-select-${t}`,
|
|
106
|
-
selectAllLabel:
|
|
107
|
-
className: `${
|
|
107
|
+
selectAllLabel: f,
|
|
108
|
+
className: `${c ? void 0 : l.dense} ${l.borderRadius}`,
|
|
108
109
|
variant: "outlined",
|
|
109
110
|
options: m,
|
|
110
|
-
label:
|
|
111
|
+
label: n,
|
|
111
112
|
multiSelect: !0,
|
|
112
113
|
textKey: "text",
|
|
113
114
|
valueKey: "id",
|
|
@@ -117,53 +118,55 @@ import '../../assets/Filter.css';const T = "_filterButton_1qtzn_1", V = "_relati
|
|
|
117
118
|
menuMaxHeight: "300px",
|
|
118
119
|
disabled: t === "location",
|
|
119
120
|
showOptionFilter: !1,
|
|
120
|
-
dense: !
|
|
121
|
-
fixedHeightInput: !
|
|
122
|
-
multiDisplayType:
|
|
121
|
+
dense: !c,
|
|
122
|
+
fixedHeightInput: !c,
|
|
123
|
+
multiDisplayType: c ? "pills" : "text"
|
|
123
124
|
}
|
|
124
125
|
),
|
|
125
126
|
o === "toggle" && /* @__PURE__ */ e(
|
|
126
|
-
|
|
127
|
+
z,
|
|
127
128
|
{
|
|
128
129
|
"data-testid": `filter-switch-${t}`,
|
|
129
|
-
label:
|
|
130
|
+
label: n,
|
|
130
131
|
onChange: (r) => i({ id: t, type: o, filterValue: r }),
|
|
131
132
|
checked: !!d.find((r) => r.id === t)?.filterValue
|
|
132
133
|
}
|
|
133
134
|
),
|
|
134
135
|
o === "search" && /* @__PURE__ */ e(
|
|
135
|
-
|
|
136
|
+
H,
|
|
136
137
|
{
|
|
137
138
|
"data-testid": `filter-search-${t}`,
|
|
138
|
-
placeholder:
|
|
139
|
+
placeholder: n,
|
|
139
140
|
searchTerm: d.find((r) => r.id === t)?.filterValue,
|
|
140
|
-
className:
|
|
141
|
+
className: l.borderRadius,
|
|
141
142
|
setSearchTerm: (r) => i({ id: t, type: o, filterValue: r })
|
|
142
143
|
}
|
|
143
144
|
)
|
|
144
|
-
] }, t)),
|
|
145
|
+
] }, t)), Z = ({
|
|
145
146
|
filterButtonText: u,
|
|
146
147
|
filterButtonAsIcon: d,
|
|
147
148
|
count: i,
|
|
148
|
-
filterButtonSize:
|
|
149
|
-
filterButtonClassName:
|
|
149
|
+
filterButtonSize: f,
|
|
150
|
+
filterButtonClassName: c,
|
|
150
151
|
"data-testid": t,
|
|
151
|
-
onClick:
|
|
152
|
+
onClick: n
|
|
152
153
|
}) => {
|
|
153
|
-
const { isDesktop: m } =
|
|
154
|
+
const { isDesktop: m } = $();
|
|
154
155
|
return d ? /* @__PURE__ */ e(
|
|
155
|
-
|
|
156
|
+
j,
|
|
156
157
|
{
|
|
157
|
-
className:
|
|
158
|
+
className: N(l.iconColor, {
|
|
159
|
+
[l.largeIconFix]: f === "large"
|
|
160
|
+
}),
|
|
158
161
|
"data-testid": t ?? "filter-icon-button",
|
|
159
|
-
icon: "
|
|
160
|
-
onClick:
|
|
161
|
-
iconSize:
|
|
162
|
+
icon: "filter_list",
|
|
163
|
+
onClick: n,
|
|
164
|
+
iconSize: f,
|
|
162
165
|
badge: i !== 0 && /* @__PURE__ */ e(
|
|
163
|
-
|
|
166
|
+
y,
|
|
164
167
|
{
|
|
165
168
|
counter: i,
|
|
166
|
-
className:
|
|
169
|
+
className: l.filterBadge,
|
|
167
170
|
themeColor: "secondary",
|
|
168
171
|
"data-testid": "filter-badge"
|
|
169
172
|
}
|
|
@@ -173,28 +176,28 @@ import '../../assets/Filter.css';const T = "_filterButton_1qtzn_1", V = "_relati
|
|
|
173
176
|
"div",
|
|
174
177
|
{
|
|
175
178
|
"data-testid": t ?? "filter-button-container",
|
|
176
|
-
className:
|
|
179
|
+
className: l.relativeParent,
|
|
177
180
|
style: { height: "100%", width: m ? void 0 : "100%" },
|
|
178
181
|
children: [
|
|
179
182
|
/* @__PURE__ */ e(
|
|
180
|
-
|
|
183
|
+
g,
|
|
181
184
|
{
|
|
182
185
|
"data-testid": "filter-button",
|
|
183
186
|
variant: "outlined",
|
|
184
187
|
themeColor: "primary",
|
|
185
188
|
leadingIcon: "filter_list_alt",
|
|
186
|
-
onClick:
|
|
187
|
-
className:
|
|
189
|
+
onClick: n,
|
|
190
|
+
className: N(c, l.filterButton),
|
|
188
191
|
fullWidth: !m,
|
|
189
|
-
buttonSize:
|
|
192
|
+
buttonSize: f,
|
|
190
193
|
children: u
|
|
191
194
|
}
|
|
192
195
|
),
|
|
193
196
|
i !== 0 && /* @__PURE__ */ e(
|
|
194
|
-
|
|
197
|
+
y,
|
|
195
198
|
{
|
|
196
199
|
counter: i,
|
|
197
|
-
className:
|
|
200
|
+
className: l.filterBadge,
|
|
198
201
|
themeColor: "secondary",
|
|
199
202
|
"data-testid": "filter-badge"
|
|
200
203
|
}
|
|
@@ -14,7 +14,7 @@ import '../../../assets/CustomTextField.css';const c = "_invalid_142hx_1", h = "
|
|
|
14
14
|
trigger: i,
|
|
15
15
|
watch: l
|
|
16
16
|
} = s(), a = l(e.propertyName), d = v(() => {
|
|
17
|
-
if (!(
|
|
17
|
+
if (!(a == null || e.value == null))
|
|
18
18
|
return e.value;
|
|
19
19
|
}, [a, e.value]);
|
|
20
20
|
return /* @__PURE__ */ m(
|
|
@@ -61,6 +61,11 @@ import { TableLayoutProps } from '../../types/GenericTable';
|
|
|
61
61
|
* @param tableLayout layout of the table, can be 'standard' or 'flex'
|
|
62
62
|
* @param isOnline Whether the user is online; shows OfflineView when false.
|
|
63
63
|
* @param offlineViewProps Props forwarded to OfflineView when offline.
|
|
64
|
+
* @param resizableColumns Enables resizing handles for the specified columns. Be aware that sticky columns limit the resizable columns to the first column.
|
|
65
|
+
* @param stickyColumns pin the first and/or last column via CSS while scrolling horizontally; !! When combined with resizableColumns, only the first column can be resized, regardless of the resizableColumns keys. !!
|
|
66
|
+
* @param tableMaxHeight Set a max height in px that the table will be clamped to. Content rows will be scrollable if the whole table exceeds this height.
|
|
67
|
+
* @param noBorder Render the table without borders or the elevation
|
|
68
|
+
* @param disableRowsPerPageSelection Disable the rows per page selection dropdown
|
|
64
69
|
* @returns a table based on a given type and data
|
|
65
70
|
*/
|
|
66
|
-
export declare const GenericTable: <T>({ data, hiddenColumns, order, cellTemplates, tableActions, noContentText, headerTranslation, pagination, getRowActions, customColumnWidth, title, cardTitleColumn, cardSubTitleColumn, pageTranslation, pageOfTranslation, rowsPerPageTranslation, tableActionPosition,
|
|
71
|
+
export declare const GenericTable: <T>({ data, hiddenColumns, order, cellTemplates, tableActions, noContentText, headerTranslation, pagination, getRowActions, customColumnWidth, title, cardTitleColumn, cardSubTitleColumn, pageTranslation, pageOfTranslation, rowsPerPageTranslation, tableActionPosition, tableLayout, isOnline, offlineViewProps, resizableColumns, stickyColumns, tableMaxHeight, noBorder, disableRowsPerPageSelection, }: TableLayoutProps<T>) => import("react").JSX.Element;
|