@memobit/libs 3.28.1 → 3.29.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/dist/components/Auth/ChangePasswordModal/ChangePasswordModal2.js +7 -7
- package/dist/components/Auth/Login/Login2.js +4 -4
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal2.js +6 -6
- package/dist/components/DataView/DataView.CardView.js +84 -84
- package/dist/components/MenuHamburger/MenuHamburger2.js +14 -14
- package/dist/components/PageShell/AppFrame.js +27 -0
- package/dist/components/PageShell/BottomSheet.js +45 -0
- package/dist/components/PageShell/FilterField.css +1 -0
- package/dist/components/PageShell/FilterField2.js +294 -0
- package/dist/components/PageShell/FilterSections.js +86 -0
- package/dist/components/PageShell/PageParts.js +257 -0
- package/dist/components/PageShell/PageShell.css +1 -0
- package/dist/components/PageShell/PageShell2.js +11 -0
- package/dist/components/PageShell/WorkbenchPhone.js +139 -0
- package/dist/components/PageShell/WorkbenchShell.js +154 -0
- package/dist/components/PageShell/filterRules.js +123 -0
- package/dist/components/PageShell/filterValues.js +30 -0
- package/dist/components/PageShell/menuItems.js +9 -0
- package/dist/components/PageShell/shellText.js +39 -0
- package/dist/components/PageShell/useAppFrame.js +6 -0
- package/dist/components/PageShell/usePaging.js +23 -0
- package/dist/components/PageShell/usePruneStaleFilters.js +17 -0
- package/dist/components/PageShell/useSummaryMessages.js +17 -0
- package/dist/components/Pagination/Pagination.css +1 -1
- package/dist/components/Pagination/Pagination2.js +14 -13
- package/dist/components/Popover/Popover2.js +77 -67
- package/dist/components/ScrollToTop/ScrollToTop.css +1 -1
- package/dist/components/ScrollToTop/ScrollToTop2.js +20 -19
- package/dist/contexts/LanguageContext/libMessages.js +55 -7
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/hooks/useAccountMenu.js +6 -6
- package/dist/index.d.ts +299 -0
- package/dist/index.js +235 -213
- package/dist/version.js +1 -1
- package/dist/version.json +4 -4
- package/package.json +147 -147
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Icon as b } from "../Icon/Icon2.js";
|
|
2
|
+
import { libMessages as B } from "../../contexts/LanguageContext/libMessages.js";
|
|
3
|
+
import { useMessages as M } from "../../hooks/useLanguage.js";
|
|
4
|
+
import { Button as C } from "../Button/Button2.js";
|
|
5
|
+
import { InputSearch as j } from "../InputSearch/InputSearch2.js";
|
|
6
|
+
import { useAppFrame as I } from "./useAppFrame.js";
|
|
7
|
+
import { countActiveFilters as L } from "./filterRules.js";
|
|
8
|
+
import { AppliedFilters as P, FilterSections as z } from "./FilterSections.js";
|
|
9
|
+
import { toMenuItems as O } from "./menuItems.js";
|
|
10
|
+
import { getHeadingText as W, getResultLabel as D } from "./shellText.js";
|
|
11
|
+
import { AppMark as V, PageMenu as H, PagePager as R, SortSheetBody as T } from "./PageParts.js";
|
|
12
|
+
import { BottomSheet as k } from "./BottomSheet.js";
|
|
13
|
+
import { useCallback as $, useState as q } from "react";
|
|
14
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
15
|
+
var ne = (i) => {
|
|
16
|
+
const { title: N, counts: c, primaryAction: t, actions: w = [], search: n, sort: o, view: p, filters: s = [], values: h = {}, onFilterChange: _ = () => {
|
|
17
|
+
}, onClearFilters: m, pagination: d, children: S } = i, l = M(B), u = I(), [v, g] = q(null), r = $(() => g(null), []), f = L(s, h), A = D(i, l), y = o?.fields.find((x) => x.value === o.value.field)?.label, F = [W(i, l), y].filter(Boolean).join(" · ");
|
|
18
|
+
return /* @__PURE__ */ a("div", {
|
|
19
|
+
className: [
|
|
20
|
+
"page-shell",
|
|
21
|
+
"page-shell--workbench",
|
|
22
|
+
"page-shell--phone",
|
|
23
|
+
t?.variant ? `page-shell--fab-${t.variant}` : ""
|
|
24
|
+
].filter(Boolean).join(" "),
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ a("header", {
|
|
27
|
+
className: "page-shell__topbar",
|
|
28
|
+
children: [
|
|
29
|
+
u && /* @__PURE__ */ e(V, {
|
|
30
|
+
app: u.app,
|
|
31
|
+
logoOnly: !0
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ e("h1", {
|
|
34
|
+
className: "page-shell__title",
|
|
35
|
+
children: N
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ e("span", { className: "page-shell__spacer" }),
|
|
38
|
+
s.length > 0 && /* @__PURE__ */ a("button", {
|
|
39
|
+
type: "button",
|
|
40
|
+
className: "page-shell__icon-button",
|
|
41
|
+
onClick: () => g("filters"),
|
|
42
|
+
children: [/* @__PURE__ */ e(b, {
|
|
43
|
+
name: "tune",
|
|
44
|
+
size: "md"
|
|
45
|
+
}), f > 0 && /* @__PURE__ */ e("span", {
|
|
46
|
+
className: "page-shell__badge page-shell__badge--corner",
|
|
47
|
+
children: f
|
|
48
|
+
})]
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ e(H, { items: [...O(w), ...u?.menuItems ?? []] })
|
|
51
|
+
]
|
|
52
|
+
}),
|
|
53
|
+
n && /* @__PURE__ */ e("div", {
|
|
54
|
+
className: "page-shell__search-row",
|
|
55
|
+
children: /* @__PURE__ */ e(j, {
|
|
56
|
+
value: n.value,
|
|
57
|
+
placeholder: n.placeholder ?? l.search,
|
|
58
|
+
onChange: n.onChange
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ e(P, {
|
|
62
|
+
filters: s,
|
|
63
|
+
values: h,
|
|
64
|
+
onFilterChange: _,
|
|
65
|
+
onClearFilters: m,
|
|
66
|
+
scroll: !0
|
|
67
|
+
}),
|
|
68
|
+
(o || p || d && d.pageCount > 1) && /* @__PURE__ */ a("div", {
|
|
69
|
+
className: "page-shell__result-row",
|
|
70
|
+
children: [(o || p) && /* @__PURE__ */ a("button", {
|
|
71
|
+
type: "button",
|
|
72
|
+
className: "page-shell__result-line",
|
|
73
|
+
onClick: () => g("sort"),
|
|
74
|
+
children: [/* @__PURE__ */ e("span", { children: F || l.pageSortAndView }), /* @__PURE__ */ e(b, {
|
|
75
|
+
name: "caret-down",
|
|
76
|
+
size: "sm"
|
|
77
|
+
})]
|
|
78
|
+
}), /* @__PURE__ */ e(R, { pagination: d })]
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ e("div", {
|
|
81
|
+
className: "page-shell__content",
|
|
82
|
+
children: S
|
|
83
|
+
}),
|
|
84
|
+
t && /* @__PURE__ */ e("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
className: "page-shell__fab",
|
|
87
|
+
disabled: t.disabled,
|
|
88
|
+
onClick: t.onClick,
|
|
89
|
+
children: /* @__PURE__ */ e(b, {
|
|
90
|
+
name: t.icon ?? "plus",
|
|
91
|
+
size: "lg"
|
|
92
|
+
})
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ e(k, {
|
|
95
|
+
isOpen: v === "filters",
|
|
96
|
+
tall: !0,
|
|
97
|
+
title: l.filters,
|
|
98
|
+
onClose: r,
|
|
99
|
+
end: f > 0 && m ? /* @__PURE__ */ e("button", {
|
|
100
|
+
type: "button",
|
|
101
|
+
className: "page-shell__link",
|
|
102
|
+
onClick: m,
|
|
103
|
+
children: l.pageClearAll
|
|
104
|
+
}) : void 0,
|
|
105
|
+
footer: /* @__PURE__ */ e(C, {
|
|
106
|
+
variant: "info",
|
|
107
|
+
fullWidth: !0,
|
|
108
|
+
disabled: c?.shown === 0,
|
|
109
|
+
onClick: r,
|
|
110
|
+
children: c ? A(c.shown) : l.pageDone
|
|
111
|
+
}),
|
|
112
|
+
children: /* @__PURE__ */ e(z, {
|
|
113
|
+
filters: s,
|
|
114
|
+
values: h,
|
|
115
|
+
context: "sheet",
|
|
116
|
+
onFilterChange: _
|
|
117
|
+
})
|
|
118
|
+
}),
|
|
119
|
+
/* @__PURE__ */ e(k, {
|
|
120
|
+
isOpen: v === "sort",
|
|
121
|
+
title: l.pageSortAndView,
|
|
122
|
+
onClose: r,
|
|
123
|
+
footer: /* @__PURE__ */ e(C, {
|
|
124
|
+
variant: "info",
|
|
125
|
+
fullWidth: !0,
|
|
126
|
+
onClick: r,
|
|
127
|
+
children: l.pageDone
|
|
128
|
+
}),
|
|
129
|
+
children: /* @__PURE__ */ e(T, {
|
|
130
|
+
sort: o,
|
|
131
|
+
view: p
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
]
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
export {
|
|
138
|
+
ne as WorkbenchPhone
|
|
139
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { libMessages as W } from "../../contexts/LanguageContext/libMessages.js";
|
|
2
|
+
import { useMessages as j } from "../../hooks/useLanguage.js";
|
|
3
|
+
import { Button as _ } from "../Button/Button2.js";
|
|
4
|
+
import { InputSearch as B } from "../InputSearch/InputSearch2.js";
|
|
5
|
+
import { useBreakpoint as L } from "../../hooks/useBreakpoint.js";
|
|
6
|
+
import { Drawer as V } from "../Drawer/Drawer2.js";
|
|
7
|
+
import { useAppFrame as H } from "./useAppFrame.js";
|
|
8
|
+
import { countActiveFilters as R } from "./filterRules.js";
|
|
9
|
+
import { AppliedFilters as q, FilterSections as z } from "./FilterSections.js";
|
|
10
|
+
import { toMenuItems as E } from "./menuItems.js";
|
|
11
|
+
import { getHeadingText as G, getResultLabel as J } from "./shellText.js";
|
|
12
|
+
import { ActionButton as u, AppMark as M, PageMenu as x, PagePager as K, SortDropdown as Q, ViewOptions as I, ViewToggle as U } from "./PageParts.js";
|
|
13
|
+
import { WorkbenchPhone as X } from "./WorkbenchPhone.js";
|
|
14
|
+
import { useState as Y } from "react";
|
|
15
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
16
|
+
var de = (o) => {
|
|
17
|
+
const { isMobile: O, isTablet: l } = L(), s = j(W), r = H(), [S, m] = Y(!1);
|
|
18
|
+
if (O) return /* @__PURE__ */ e(X, { ...o });
|
|
19
|
+
const { title: y, counts: f, primaryAction: n, actions: v = [], search: c, sort: N, view: t, filters: p = [], values: d = {}, onFilterChange: b = () => {
|
|
20
|
+
}, onClearFilters: i, pagination: D, children: P } = o, k = G(o, s), T = J(o, s), h = R(p, d), g = p.length > 0, w = r?.menuItems ?? [], C = /* @__PURE__ */ e(z, {
|
|
21
|
+
filters: p,
|
|
22
|
+
values: d,
|
|
23
|
+
context: "panel",
|
|
24
|
+
onFilterChange: b
|
|
25
|
+
}), A = h > 0 && /* @__PURE__ */ e("span", {
|
|
26
|
+
className: "page-shell__badge",
|
|
27
|
+
children: h
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ a("div", {
|
|
30
|
+
className: [
|
|
31
|
+
"page-shell",
|
|
32
|
+
"page-shell--workbench",
|
|
33
|
+
l ? "page-shell--tablet" : "page-shell--desktop"
|
|
34
|
+
].join(" "),
|
|
35
|
+
children: [
|
|
36
|
+
!l && /* @__PURE__ */ a("aside", {
|
|
37
|
+
className: "page-shell__side",
|
|
38
|
+
children: [
|
|
39
|
+
r && /* @__PURE__ */ e(M, { app: r.app }),
|
|
40
|
+
n && /* @__PURE__ */ e(u, {
|
|
41
|
+
action: n,
|
|
42
|
+
fullWidth: !0
|
|
43
|
+
}),
|
|
44
|
+
g && /* @__PURE__ */ a("div", {
|
|
45
|
+
className: "page-shell__side-group",
|
|
46
|
+
children: [/* @__PURE__ */ a("div", {
|
|
47
|
+
className: "page-shell__side-head",
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ e("span", {
|
|
50
|
+
className: "page-shell__group-title",
|
|
51
|
+
children: s.filters
|
|
52
|
+
}),
|
|
53
|
+
A,
|
|
54
|
+
/* @__PURE__ */ e("span", { className: "page-shell__spacer" }),
|
|
55
|
+
h > 0 && i && /* @__PURE__ */ e("button", {
|
|
56
|
+
type: "button",
|
|
57
|
+
className: "page-shell__link",
|
|
58
|
+
onClick: i,
|
|
59
|
+
children: s.pageClearAll
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
}), C]
|
|
63
|
+
}),
|
|
64
|
+
t && /* @__PURE__ */ e(I, { view: t })
|
|
65
|
+
]
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ a("div", {
|
|
68
|
+
className: "page-shell__main",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ a("header", {
|
|
71
|
+
className: "page-shell__toolbar",
|
|
72
|
+
children: [
|
|
73
|
+
l && g && /* @__PURE__ */ a(_, {
|
|
74
|
+
icon: "tune",
|
|
75
|
+
variant: "default",
|
|
76
|
+
onClick: () => m(!0),
|
|
77
|
+
children: [s.filters, A]
|
|
78
|
+
}),
|
|
79
|
+
l && r && /* @__PURE__ */ e(M, {
|
|
80
|
+
app: r.app,
|
|
81
|
+
logoOnly: !0
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ a("div", {
|
|
84
|
+
className: "page-shell__titles",
|
|
85
|
+
children: [/* @__PURE__ */ e("h1", {
|
|
86
|
+
className: "page-shell__title",
|
|
87
|
+
children: y
|
|
88
|
+
}), k && /* @__PURE__ */ e("p", {
|
|
89
|
+
className: "page-shell__heading",
|
|
90
|
+
children: k
|
|
91
|
+
})]
|
|
92
|
+
}),
|
|
93
|
+
l && n && /* @__PURE__ */ e(u, { action: n }),
|
|
94
|
+
l && /* @__PURE__ */ e(x, { items: [...E(v), ...w] }),
|
|
95
|
+
l && /* @__PURE__ */ e("span", { className: "page-shell__break" }),
|
|
96
|
+
c && /* @__PURE__ */ e(B, {
|
|
97
|
+
className: "page-shell__search",
|
|
98
|
+
value: c.value,
|
|
99
|
+
placeholder: c.placeholder ?? s.search,
|
|
100
|
+
onChange: c.onChange
|
|
101
|
+
}),
|
|
102
|
+
N && /* @__PURE__ */ e(Q, { sort: N }),
|
|
103
|
+
l && t && /* @__PURE__ */ e(U, { view: t }),
|
|
104
|
+
!l && v.map((F) => /* @__PURE__ */ e(u, { action: F }, F.id)),
|
|
105
|
+
!l && /* @__PURE__ */ e(x, { items: w })
|
|
106
|
+
]
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ a("div", {
|
|
109
|
+
className: "page-shell__status",
|
|
110
|
+
children: [/* @__PURE__ */ e(q, {
|
|
111
|
+
filters: p,
|
|
112
|
+
values: d,
|
|
113
|
+
onFilterChange: b,
|
|
114
|
+
onClearFilters: i
|
|
115
|
+
}), /* @__PURE__ */ e(K, { pagination: D })]
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ e("div", {
|
|
118
|
+
className: "page-shell__content",
|
|
119
|
+
children: P
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}),
|
|
123
|
+
l && g && /* @__PURE__ */ e(V, {
|
|
124
|
+
isOpen: S,
|
|
125
|
+
onClose: () => m(!1),
|
|
126
|
+
position: "left",
|
|
127
|
+
title: s.filters,
|
|
128
|
+
footer: /* @__PURE__ */ a("div", {
|
|
129
|
+
className: "page-shell__drawer-footer",
|
|
130
|
+
children: [h > 0 && i && /* @__PURE__ */ e(_, {
|
|
131
|
+
variant: "default",
|
|
132
|
+
onClick: i,
|
|
133
|
+
children: s.pageClearAll
|
|
134
|
+
}), f && /* @__PURE__ */ e(_, {
|
|
135
|
+
variant: "info",
|
|
136
|
+
fullWidth: !0,
|
|
137
|
+
onClick: () => m(!1),
|
|
138
|
+
children: T(f.shown)
|
|
139
|
+
})]
|
|
140
|
+
}),
|
|
141
|
+
children: /* @__PURE__ */ a("div", {
|
|
142
|
+
className: "page-shell__drawer-body",
|
|
143
|
+
children: [C, t?.columns && /* @__PURE__ */ e(I, {
|
|
144
|
+
view: t,
|
|
145
|
+
showToggle: !1
|
|
146
|
+
})]
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
export {
|
|
153
|
+
de as WorkbenchShell
|
|
154
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { formatAppDate as b } from "../../helpers/Datetime.js";
|
|
2
|
+
var A = 4, y = 24, $ = 10, k = 8, v = 14, s = (t) => typeof t == "string" || typeof t == "number", u = (t) => Array.isArray(t) ? t.filter(s) : [], d = (t) => s(t) && t !== "" ? t : null, g = (t) => typeof t == "number" ? t : 0, c = (t, n, e) => {
|
|
3
|
+
const [r, i] = u(t);
|
|
4
|
+
return [typeof r == "number" ? r : n, typeof i == "number" ? i : e];
|
|
5
|
+
}, M = (t) => typeof t == "object" && t !== null && !Array.isArray(t), m = (t) => M(t) ? t : { text: "" }, S = (t, n) => t.wordMatch ? [{
|
|
6
|
+
value: "or",
|
|
7
|
+
label: n.anyWord
|
|
8
|
+
}, {
|
|
9
|
+
value: "and",
|
|
10
|
+
label: n.allWords
|
|
11
|
+
}] : t.modes, C = (t) => {
|
|
12
|
+
switch (t.kind) {
|
|
13
|
+
case "multi":
|
|
14
|
+
return [];
|
|
15
|
+
case "rating":
|
|
16
|
+
return 0;
|
|
17
|
+
case "toggle":
|
|
18
|
+
return !1;
|
|
19
|
+
case "text":
|
|
20
|
+
return {
|
|
21
|
+
text: "",
|
|
22
|
+
mode: t.wordMatch ? "or" : t.modes?.[0]?.value
|
|
23
|
+
};
|
|
24
|
+
default:
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}, h = (t, n) => {
|
|
28
|
+
switch (t.kind) {
|
|
29
|
+
case "single":
|
|
30
|
+
case "date":
|
|
31
|
+
return d(n) !== null;
|
|
32
|
+
case "multi":
|
|
33
|
+
return u(n).length > 0;
|
|
34
|
+
case "range": {
|
|
35
|
+
const [e, r] = c(n, t.min, t.max);
|
|
36
|
+
return e > t.min || r < t.max;
|
|
37
|
+
}
|
|
38
|
+
case "rating":
|
|
39
|
+
return g(n) > 0;
|
|
40
|
+
case "toggle":
|
|
41
|
+
return n === !0;
|
|
42
|
+
case "text":
|
|
43
|
+
return m(n).text.trim() !== "";
|
|
44
|
+
}
|
|
45
|
+
}, _ = (t, n) => t.filter((e) => h(e, n[e.id])).length, f = (t, n) => t.find((e) => e.value === n)?.label ?? String(n), w = (t, n) => {
|
|
46
|
+
if (t.kind !== "single" && t.kind !== "multi") return null;
|
|
47
|
+
if (t.control) return t.control;
|
|
48
|
+
const e = t.options.length;
|
|
49
|
+
if (t.kind === "single") {
|
|
50
|
+
if (e > $) return "search-list";
|
|
51
|
+
const r = t.options.reduce((i, a) => i + a.label.length, 3);
|
|
52
|
+
return e <= A && r <= y ? "segmented" : n === "sheet" ? "chips" : "radio";
|
|
53
|
+
}
|
|
54
|
+
return e > v ? "search-list" : e <= k || n === "sheet" ? "chips" : "checklist";
|
|
55
|
+
}, E = (t, n, e) => {
|
|
56
|
+
switch (t.kind) {
|
|
57
|
+
case "single": {
|
|
58
|
+
const r = d(n);
|
|
59
|
+
return r === null ? "" : f(t.options, r);
|
|
60
|
+
}
|
|
61
|
+
case "multi": {
|
|
62
|
+
const r = u(n);
|
|
63
|
+
return r.length === 1 ? f(t.options, r[0]) : e.selectedCount(r.length);
|
|
64
|
+
}
|
|
65
|
+
case "range": {
|
|
66
|
+
const [r, i] = c(n, t.min, t.max), a = t.unit ? ` ${t.unit}` : "";
|
|
67
|
+
return r > t.min && i < t.max ? `${r}–${i}${a}` : r > t.min ? `≥ ${r}${a}` : `≤ ${i}${a}`;
|
|
68
|
+
}
|
|
69
|
+
case "rating":
|
|
70
|
+
return e.ratingAtLeast(g(n));
|
|
71
|
+
case "toggle":
|
|
72
|
+
return t.label;
|
|
73
|
+
case "text": {
|
|
74
|
+
const { text: r, mode: i } = m(n), a = S(t, e), l = a && i !== a[0]?.value ? a.find((o) => o.value === i)?.label : void 0;
|
|
75
|
+
return l ? `“${r.trim()}” · ${l}` : `“${r.trim()}”`;
|
|
76
|
+
}
|
|
77
|
+
case "date": {
|
|
78
|
+
const r = d(n);
|
|
79
|
+
if (r === null) return "";
|
|
80
|
+
const i = b(String(r));
|
|
81
|
+
return t.relation === "until" ? e.dateUntil(i) : e.dateSince(i);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, F = (t, n, e) => t.flatMap((r) => {
|
|
85
|
+
const i = n[r.id];
|
|
86
|
+
if (!h(r, i)) return [];
|
|
87
|
+
if (r.kind === "multi") {
|
|
88
|
+
const l = u(i);
|
|
89
|
+
return l.map((o) => ({
|
|
90
|
+
key: `${r.id}:${o}`,
|
|
91
|
+
filterId: r.id,
|
|
92
|
+
label: f(r.options, o),
|
|
93
|
+
next: l.filter((x) => x !== o)
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
const a = r.kind === "text" ? {
|
|
97
|
+
...m(i),
|
|
98
|
+
text: ""
|
|
99
|
+
} : C(r);
|
|
100
|
+
return [{
|
|
101
|
+
key: r.id,
|
|
102
|
+
filterId: r.id,
|
|
103
|
+
label: E(r, i, e),
|
|
104
|
+
next: a
|
|
105
|
+
}];
|
|
106
|
+
});
|
|
107
|
+
export {
|
|
108
|
+
_ as countActiveFilters,
|
|
109
|
+
C as defaultFilterValue,
|
|
110
|
+
E as filterSummary,
|
|
111
|
+
F as getAppliedFilters,
|
|
112
|
+
S as getTextModes,
|
|
113
|
+
h as isFilterActive,
|
|
114
|
+
s as isScalar,
|
|
115
|
+
M as isTextFilterValue,
|
|
116
|
+
f as optionLabel,
|
|
117
|
+
w as pickControl,
|
|
118
|
+
u as toList,
|
|
119
|
+
g as toNumber,
|
|
120
|
+
c as toRange,
|
|
121
|
+
d as toScalar,
|
|
122
|
+
m as toText
|
|
123
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isTextFilterValue as u, toList as a, toScalar as d } from "./filterRules.js";
|
|
2
|
+
var v = (e, n) => a(e).flatMap((t) => {
|
|
3
|
+
const i = n.find((r) => r === t);
|
|
4
|
+
return i === void 0 ? [] : [i];
|
|
5
|
+
}), g = (e, n) => n.find((t) => t === e), h = (e) => {
|
|
6
|
+
const [n, t] = a(e);
|
|
7
|
+
return typeof n == "number" && typeof t == "number" ? [n, t] : null;
|
|
8
|
+
}, m = (e) => u(e) ? e : null, F = (e, n) => e.flatMap((t) => {
|
|
9
|
+
if (t.kind !== "single" && t.kind !== "multi") return [];
|
|
10
|
+
const i = new Set(t.options.map((l) => l.value)), r = n[t.id];
|
|
11
|
+
if (t.kind === "single") {
|
|
12
|
+
const l = d(r);
|
|
13
|
+
return l !== null && !i.has(l) ? [{
|
|
14
|
+
id: t.id,
|
|
15
|
+
value: null
|
|
16
|
+
}] : [];
|
|
17
|
+
}
|
|
18
|
+
const o = a(r), s = o.filter((l) => i.has(l));
|
|
19
|
+
return s.length === o.length ? [] : [{
|
|
20
|
+
id: t.id,
|
|
21
|
+
value: s
|
|
22
|
+
}];
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
g as asFilterKey,
|
|
26
|
+
v as asFilterKeys,
|
|
27
|
+
h as asFilterRange,
|
|
28
|
+
m as asFilterText,
|
|
29
|
+
F as getStaleFilterChanges
|
|
30
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var t = ({ counts: e, noun: a, heading: l }, r) => [e && a ? r.pageItemCount(e.shown, e.total, a.one, a.other) : void 0, l].filter(Boolean).join(" · "), v = ({ noun: e, resultLabel: a }, l) => a ?? (e ? (r) => l.pageShowItems(r, e.one, e.other) : l.pageShowResults), i = (e, a) => {
|
|
2
|
+
switch (e) {
|
|
3
|
+
case "cards":
|
|
4
|
+
return {
|
|
5
|
+
value: e,
|
|
6
|
+
label: a.viewGrid,
|
|
7
|
+
icon: "grid"
|
|
8
|
+
};
|
|
9
|
+
case "table":
|
|
10
|
+
return {
|
|
11
|
+
value: e,
|
|
12
|
+
label: a.viewTable,
|
|
13
|
+
icon: "table"
|
|
14
|
+
};
|
|
15
|
+
case "gallery":
|
|
16
|
+
return {
|
|
17
|
+
value: e,
|
|
18
|
+
label: a.viewGallery,
|
|
19
|
+
icon: "gallery"
|
|
20
|
+
};
|
|
21
|
+
case "calendar":
|
|
22
|
+
return {
|
|
23
|
+
value: e,
|
|
24
|
+
label: a.pageViewCalendar,
|
|
25
|
+
icon: "calendar"
|
|
26
|
+
};
|
|
27
|
+
case "map":
|
|
28
|
+
return {
|
|
29
|
+
value: e,
|
|
30
|
+
label: a.pageViewMap,
|
|
31
|
+
icon: "map"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}, s = (e, a) => e.map((l) => typeof l == "string" ? i(l, a) : l);
|
|
35
|
+
export {
|
|
36
|
+
t as getHeadingText,
|
|
37
|
+
v as getResultLabel,
|
|
38
|
+
s as resolveViewModes
|
|
39
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useState as s } from "react";
|
|
2
|
+
var h = 20, z = ({ itemCount: i, initialPageSize: o = h, resetOn: r = [] }) => {
|
|
3
|
+
const [c, e] = s(1), [n, p] = s(o), t = JSON.stringify(r), [S, P] = s(t);
|
|
4
|
+
t !== S && (P(t), e(1));
|
|
5
|
+
const a = Math.max(1, Math.ceil(i / n)), g = Math.min(c, a);
|
|
6
|
+
return {
|
|
7
|
+
page: g,
|
|
8
|
+
pageSize: n,
|
|
9
|
+
pageCount: a,
|
|
10
|
+
setPage: e,
|
|
11
|
+
setPageSize: (u) => {
|
|
12
|
+
p(u), e(1);
|
|
13
|
+
},
|
|
14
|
+
pagination: {
|
|
15
|
+
page: g,
|
|
16
|
+
pageCount: a,
|
|
17
|
+
onChange: e
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
z as usePaging
|
|
23
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getStaleFilterChanges as s } from "./filterValues.js";
|
|
2
|
+
import { useEffect as o, useMemo as m, useRef as u } from "react";
|
|
3
|
+
var h = (r, c, { isLoaded: f, onPrune: e }) => {
|
|
4
|
+
const n = u(e), t = m(() => f ? s(r, c) : [], [
|
|
5
|
+
r,
|
|
6
|
+
c,
|
|
7
|
+
f
|
|
8
|
+
]);
|
|
9
|
+
o(() => {
|
|
10
|
+
n.current = e;
|
|
11
|
+
}, [e]), o(() => {
|
|
12
|
+
t.length > 0 && n.current(t);
|
|
13
|
+
}, [t]);
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
h as usePruneStaleFilters
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { libMessages as t } from "../../contexts/LanguageContext/libMessages.js";
|
|
2
|
+
import { useMessages as a } from "../../hooks/useLanguage.js";
|
|
3
|
+
import { useMemo as s } from "react";
|
|
4
|
+
var g = () => {
|
|
5
|
+
const e = a(t);
|
|
6
|
+
return s(() => ({
|
|
7
|
+
selectedCount: e.pageSelectedCount,
|
|
8
|
+
ratingAtLeast: e.pageRatingAtLeast,
|
|
9
|
+
dateSince: e.pageDateSince,
|
|
10
|
+
dateUntil: e.pageDateUntil,
|
|
11
|
+
anyWord: e.pageAnyWord,
|
|
12
|
+
allWords: e.pageAllWords
|
|
13
|
+
}), [e]);
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
g as useSummaryMessages
|
|
17
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.pagination{align-items:center;gap:var(--spacing-12);flex-wrap:wrap;justify-content:space-around;width:100%;display:flex}.pagination__pages{justify-content:center;align-items:center;gap:var(--spacing-8);flex:1;display:flex}.pagination--left .pagination__pages{justify-content:flex-start}.pagination--center .pagination__pages{flex:none;justify-content:center}.pagination--right{flex-direction:row-reverse}.pagination--right .pagination__pages{justify-content:flex-end}.pagination .page-info{color:var(--body-color);font-size:var(--font-size-sm)}.pagination__page-size{align-items:center;gap:var(--spacing-8);font-size:var(--font-size-sm);color:var(--body-color);display:flex}.pagination__page-size .dropdown-container{min-width:120px}@media (width>=769px) and (width<=1024px){.pagination__pages{flex-wrap:wrap}.pagination .page-info{text-align:center;width:100%;margin-top:var(--spacing-8)}}@media (width<=768px){.pagination{flex-direction:column;align-items:stretch}.pagination__pages{flex-wrap:wrap;justify-content:center}.pagination__page-size{justify-content:center}}
|
|
1
|
+
.pagination{align-items:center;gap:var(--spacing-12);flex-wrap:wrap;justify-content:space-around;width:100%;display:flex}.pagination__pages{justify-content:center;align-items:center;gap:var(--spacing-8);flex:1;display:flex}.pagination--left .pagination__pages{justify-content:flex-start}.pagination--center .pagination__pages{flex:none;justify-content:center}.pagination--right{flex-direction:row-reverse}.pagination--right .pagination__pages,.pagination--single{justify-content:flex-end}.pagination .page-info{color:var(--body-color);font-size:var(--font-size-sm)}.pagination__page-size{align-items:center;gap:var(--spacing-8);font-size:var(--font-size-sm);color:var(--body-color);display:flex}.pagination__page-size .dropdown-container{min-width:120px}@media (width>=769px) and (width<=1024px){.pagination__pages{flex-wrap:wrap}.pagination .page-info{text-align:center;width:100%;margin-top:var(--spacing-8)}}@media (width<=768px){.pagination{flex-direction:column;align-items:stretch}.pagination__pages{flex-wrap:wrap;justify-content:center}.pagination__page-size{justify-content:center}.pagination--single .pagination__page-size{justify-content:flex-end}}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import './Pagination.css';
|
|
2
2
|
import { libMessages as y } from "../../contexts/LanguageContext/libMessages.js";
|
|
3
3
|
import { useMessages as L } from "../../hooks/useLanguage.js";
|
|
4
|
-
import { Button as
|
|
4
|
+
import { Button as h } from "../Button/Button2.js";
|
|
5
5
|
import { Dropdown as O } from "../Dropdown/Dropdown2.js";
|
|
6
6
|
import { useBreakpoint as I } from "../../hooks/useBreakpoint.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
import { useCallback as R, useEffect as V, useRef as
|
|
8
|
+
import { useCallback as R, useEffect as V, useRef as $, useState as j } from "react";
|
|
9
9
|
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
10
|
-
var
|
|
11
|
-
const a = L(y), { isAtLeast: l, isMobile: w } = I(), d =
|
|
10
|
+
var C = 120, H = 45, U = 8, G = 4, Y = ({ currentPage: i, totalPages: n, totalItems: u, onPageChange: f, showPagesNumbers: D = !1, pageSizeOptions: o, pageSize: v, onPageSizeChange: b, pageSizeLabel: N, horizontalAlign: k = "left" }) => {
|
|
11
|
+
const a = L(y), { isAtLeast: l, isMobile: w } = I(), d = $(null), [c, A] = j(w ? 0 : 2), p = R(() => {
|
|
12
12
|
const s = d.current, e = s?.parentElement;
|
|
13
13
|
if (!s || !e) return;
|
|
14
14
|
let r = 0;
|
|
15
|
-
for (const x of e.children) x !== s && (r += x.offsetWidth +
|
|
16
|
-
const W = e.clientWidth - r - ((l("desktop") ?
|
|
15
|
+
for (const x of e.children) x !== s && (r += x.offsetWidth + U);
|
|
16
|
+
const W = e.clientWidth - r - ((l("desktop") ? C : H) * 2 + 90 + 90 + 48), B = Math.floor(W / 53), E = Math.min(G, Math.max(0, Math.floor(B / 2)));
|
|
17
17
|
A(E);
|
|
18
18
|
}, [l]);
|
|
19
19
|
V(() => {
|
|
20
20
|
const s = d.current, e = s?.parentElement;
|
|
21
21
|
if (!s || !e) return;
|
|
22
22
|
const r = new ResizeObserver(() => {
|
|
23
|
-
|
|
23
|
+
p();
|
|
24
24
|
});
|
|
25
|
-
return r.observe(s), r.observe(e),
|
|
26
|
-
}, [
|
|
25
|
+
return r.observe(s), r.observe(e), p(), () => r.disconnect();
|
|
26
|
+
}, [p]);
|
|
27
27
|
const M = o && v !== void 0 && b, _ = o?.map((s) => ({
|
|
28
28
|
label: `${s}`,
|
|
29
29
|
value: s
|
|
@@ -33,13 +33,13 @@ var H = 120, U = 45, $ = 8, G = 4, Y = ({ currentPage: i, totalPages: n, totalIt
|
|
|
33
33
|
return i - c > 2 ? e.push(1, "...") : e.push(1), e.push(...s), i + c < n - 1 ? e.push("...", n) : n > 1 && e.push(n), e;
|
|
34
34
|
};
|
|
35
35
|
return u !== void 0 && o?.length && u <= Math.min(...o) || n <= 1 && !M ? null : /* @__PURE__ */ m("div", {
|
|
36
|
-
className: `pagination pagination--${k}`,
|
|
36
|
+
className: `pagination pagination--${k}${n <= 1 ? " pagination--single" : ""}`,
|
|
37
37
|
children: [
|
|
38
38
|
n > 1 && /* @__PURE__ */ m("div", {
|
|
39
39
|
className: "pagination__pages",
|
|
40
40
|
ref: d,
|
|
41
41
|
children: [
|
|
42
|
-
/* @__PURE__ */ t(
|
|
42
|
+
/* @__PURE__ */ t(h, {
|
|
43
43
|
variant: "default",
|
|
44
44
|
borders: "sharp",
|
|
45
45
|
disabled: i === 1,
|
|
@@ -47,14 +47,14 @@ var H = 120, U = 45, $ = 8, G = 4, Y = ({ currentPage: i, totalPages: n, totalIt
|
|
|
47
47
|
onClick: () => f(i - 1),
|
|
48
48
|
children: l("desktop") ? a.previous : ""
|
|
49
49
|
}),
|
|
50
|
-
T().map((s, e) => /* @__PURE__ */ t(
|
|
50
|
+
T().map((s, e) => /* @__PURE__ */ t(h, {
|
|
51
51
|
borders: "sharp",
|
|
52
52
|
variant: s === i ? "warning" : "default",
|
|
53
53
|
disabled: typeof s == "string",
|
|
54
54
|
onClick: () => typeof s == "number" && f(s),
|
|
55
55
|
children: s
|
|
56
56
|
}, e)),
|
|
57
|
-
/* @__PURE__ */ t(
|
|
57
|
+
/* @__PURE__ */ t(h, {
|
|
58
58
|
variant: "default",
|
|
59
59
|
borders: "sharp",
|
|
60
60
|
disabled: i === n,
|
|
@@ -70,6 +70,7 @@ var H = 120, U = 45, $ = 8, G = 4, Y = ({ currentPage: i, totalPages: n, totalIt
|
|
|
70
70
|
name: "pageSize",
|
|
71
71
|
options: _,
|
|
72
72
|
value: v,
|
|
73
|
+
clearable: !1,
|
|
73
74
|
searchable: !1,
|
|
74
75
|
usePortal: !1,
|
|
75
76
|
onChange: (s) => {
|