@memobit/libs 3.35.0 → 4.0.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/DataView/DataView2.js +46 -46
- package/dist/components/PageShell/AppNav.js +38 -27
- package/dist/components/PageShell/FilterField.css +1 -1
- package/dist/components/PageShell/FilterField2.js +243 -190
- package/dist/components/PageShell/FocusShell.js +60 -0
- package/dist/components/PageShell/PageParts.js +176 -155
- package/dist/components/PageShell/PageShell.css +1 -1
- package/dist/components/PageShell/PageShell2.js +11 -6
- package/dist/components/PageShell/WorkbenchPhone.js +75 -65
- package/dist/components/PageShell/WorkbenchShell.js +78 -64
- package/dist/components/PageShell/shellText.js +1 -1
- package/dist/components/PageShell/useConfirmedActions.js +35 -0
- package/dist/components/RouterAppFrame/RouterAppFrame.js +18 -16
- package/dist/components/ThemeSettings/ThemeContext.js +26 -26
- package/dist/components/ThemeSettings/ThemeContextValue.js +2 -1
- package/dist/components/ThemeSettings/getDefaultThemeForApp.js +5 -4
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +60 -9
- package/dist/router.d.ts +11 -2
- package/dist/version.js +1 -1
- package/dist/version.json +4 -4
- package/package.json +2 -2
|
@@ -1,289 +1,342 @@
|
|
|
1
1
|
import './FilterField.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { libMessages as
|
|
4
|
-
import { useMessages as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
2
|
+
import { Icon as Y } from "../Icon/Icon2.js";
|
|
3
|
+
import { libMessages as N } from "../../contexts/LanguageContext/libMessages.js";
|
|
4
|
+
import { useMessages as k } from "../../hooks/useLanguage.js";
|
|
5
|
+
import { Tooltip as W } from "../Tooltip/Tooltip2.js";
|
|
6
|
+
import { formatDate as D } from "../../helpers/Datetime.js";
|
|
7
|
+
import { Chip as j } from "../Chip/Chip2.js";
|
|
8
|
+
import { InputNumber as F } from "../InputNumber/InputNumber2.js";
|
|
9
|
+
import { DatePicker as $ } from "../DatePicker/DatePicker2.js";
|
|
10
|
+
import { InputSearch as C } from "../InputSearch/InputSearch2.js";
|
|
11
|
+
import { Rating as O } from "../Rating/Rating2.js";
|
|
12
|
+
import { ToggleSwitch as U } from "../ToggleSwitch/ToggleSwitch2.js";
|
|
13
|
+
import { RangeSlider as E } from "../RangeSlider/RangeSlider2.js";
|
|
14
|
+
import { getTextModes as B, pickControl as V, toDateRange as q, toList as P, toNumber as Q, toRange as G, toScalar as z, toText as H } from "./filterRules.js";
|
|
13
15
|
/* empty css */
|
|
14
|
-
import { useEffect as
|
|
15
|
-
import { jsx as l, jsxs as
|
|
16
|
-
var
|
|
16
|
+
import { useEffect as J, useState as S } from "react";
|
|
17
|
+
import { Fragment as K, jsx as l, jsxs as f } from "react/jsx-runtime";
|
|
18
|
+
var x = ({ items: e, value: r, onSelect: n }) => /* @__PURE__ */ l("div", {
|
|
17
19
|
className: "filter-field__segmented",
|
|
18
20
|
children: e.map((t) => /* @__PURE__ */ l("button", {
|
|
19
21
|
type: "button",
|
|
20
|
-
className: ["filter-field__segment", t.value ===
|
|
22
|
+
className: ["filter-field__segment", t.value === r ? "filter-field__segment--selected" : ""].filter(Boolean).join(" "),
|
|
21
23
|
onClick: () => n(t.value),
|
|
22
24
|
children: t.label
|
|
23
25
|
}, String(t.value)))
|
|
24
|
-
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
}), I = ({ src: e }) => /* @__PURE__ */ l("img", {
|
|
27
|
+
className: "filter-field__avatar",
|
|
28
|
+
src: e,
|
|
29
|
+
alt: "",
|
|
30
|
+
loading: "lazy"
|
|
31
|
+
}), L = ({ hint: e, children: r }) => e ? /* @__PURE__ */ l(W, {
|
|
32
|
+
title: e,
|
|
33
|
+
children: r
|
|
34
|
+
}) : /* @__PURE__ */ l(K, { children: r }), R = ({ label: e, mark: r, selected: n, count: t, icon: i, imageUrl: s, hint: m, onClick: o }) => /* @__PURE__ */ l(L, {
|
|
35
|
+
hint: m,
|
|
36
|
+
children: /* @__PURE__ */ f("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
className: [
|
|
39
|
+
"filter-field__row",
|
|
40
|
+
n ? "filter-field__row--selected" : "",
|
|
41
|
+
t === 0 && !n ? "filter-field__row--empty" : ""
|
|
42
|
+
].filter(Boolean).join(" "),
|
|
43
|
+
onClick: o,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ l("span", {
|
|
46
|
+
className: `filter-field__mark filter-field__mark--${r}`,
|
|
47
|
+
children: r === "check" && n && /* @__PURE__ */ l(Y, {
|
|
48
|
+
name: "checkmark",
|
|
49
|
+
size: "sm"
|
|
50
|
+
})
|
|
51
|
+
}),
|
|
52
|
+
s ? /* @__PURE__ */ l(I, { src: s }) : i && /* @__PURE__ */ l(Y, {
|
|
53
|
+
name: i,
|
|
37
54
|
size: "sm"
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ l("span", {
|
|
57
|
+
className: "filter-field__row-label",
|
|
58
|
+
children: e
|
|
59
|
+
}),
|
|
60
|
+
t !== void 0 && /* @__PURE__ */ l("span", {
|
|
61
|
+
className: "filter-field__count",
|
|
62
|
+
children: t
|
|
38
63
|
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
className: "filter-field__row-label",
|
|
46
|
-
children: e
|
|
47
|
-
}),
|
|
48
|
-
t !== void 0 && /* @__PURE__ */ l("span", {
|
|
49
|
-
className: "filter-field__count",
|
|
50
|
-
children: t
|
|
51
|
-
})
|
|
52
|
-
]
|
|
53
|
-
}), G = (e, a) => e.includes(a) ? e.filter((n) => n !== a) : [...e, a], J = ({ spec: e, value: a, context: n, onChange: t }) => {
|
|
54
|
-
const r = g(v), [c, d] = y(""), [s, o] = y(!1), f = O(e, n), k = e.kind === "single", b = k ? [$(a)].filter((i) => i !== null) : E(a), h = (i) => b.includes(i.value), S = (i) => {
|
|
55
|
-
if (!k) {
|
|
56
|
-
t(G(b, i.value));
|
|
64
|
+
]
|
|
65
|
+
})
|
|
66
|
+
}), X = (e, r) => e.includes(r) ? e.filter((n) => n !== r) : [...e, r], Z = ({ spec: e, value: r, context: n, onChange: t }) => {
|
|
67
|
+
const i = k(N), [s, m] = S(""), [o, d] = S(!1), v = V(e, n), c = e.kind === "single", h = c ? [z(r)].filter((a) => a !== null) : P(r), _ = (a) => h.includes(a.value), b = (a) => {
|
|
68
|
+
if (!c) {
|
|
69
|
+
t(X(h, a.value));
|
|
57
70
|
return;
|
|
58
71
|
}
|
|
59
|
-
t(
|
|
72
|
+
t(_(a) && v !== "radio" ? null : a.value);
|
|
60
73
|
};
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
74
|
+
if (v === "segmented") {
|
|
75
|
+
const a = [{
|
|
63
76
|
value: null,
|
|
64
|
-
label:
|
|
65
|
-
}, ...e.options.map((
|
|
66
|
-
value:
|
|
67
|
-
label:
|
|
77
|
+
label: i.pageAny
|
|
78
|
+
}, ...e.options.map((u) => ({
|
|
79
|
+
value: u.value,
|
|
80
|
+
label: u.label
|
|
68
81
|
}))];
|
|
69
|
-
return /* @__PURE__ */ l(
|
|
70
|
-
items:
|
|
71
|
-
value:
|
|
72
|
-
onSelect: (
|
|
82
|
+
return /* @__PURE__ */ l(x, {
|
|
83
|
+
items: a,
|
|
84
|
+
value: h[0] ?? null,
|
|
85
|
+
onSelect: (u) => t(u)
|
|
73
86
|
});
|
|
74
87
|
}
|
|
75
|
-
if (
|
|
88
|
+
if (v === "chips") return /* @__PURE__ */ l("div", {
|
|
76
89
|
className: "filter-field__chips",
|
|
77
|
-
children: e.options.map((
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
children: e.options.map((a) => /* @__PURE__ */ l(L, {
|
|
91
|
+
hint: a.hint,
|
|
92
|
+
children: /* @__PURE__ */ l(j, {
|
|
93
|
+
className: a.count === 0 && !_(a) ? "filter-field__chip--empty" : void 0,
|
|
94
|
+
color: a.color,
|
|
95
|
+
count: a.count,
|
|
96
|
+
icon: a.imageUrl ? void 0 : a.icon,
|
|
97
|
+
selected: _(a),
|
|
98
|
+
size: n === "sheet" ? "medium" : "small",
|
|
99
|
+
onClick: () => b(a),
|
|
100
|
+
children: a.imageUrl ? /* @__PURE__ */ f("span", {
|
|
101
|
+
className: "filter-field__chip-label",
|
|
102
|
+
children: [/* @__PURE__ */ l(I, { src: a.imageUrl }), a.label]
|
|
103
|
+
}) : a.label
|
|
104
|
+
})
|
|
105
|
+
}, a.value))
|
|
87
106
|
});
|
|
88
|
-
const
|
|
89
|
-
label:
|
|
90
|
-
mark:
|
|
91
|
-
selected:
|
|
92
|
-
count:
|
|
93
|
-
icon:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
const w = c ? "radio" : "check", y = (a) => /* @__PURE__ */ l(R, {
|
|
108
|
+
label: a.label,
|
|
109
|
+
mark: w,
|
|
110
|
+
selected: _(a),
|
|
111
|
+
count: a.count,
|
|
112
|
+
icon: a.icon,
|
|
113
|
+
imageUrl: a.imageUrl,
|
|
114
|
+
hint: a.hint,
|
|
115
|
+
onClick: () => b(a)
|
|
116
|
+
}, a.value);
|
|
117
|
+
if (v === "search-list") {
|
|
118
|
+
const a = s.trim().toLowerCase(), u = e.options.filter(_), p = e.options.filter((A) => !_(A) && (!a || A.label.toLowerCase().includes(a)));
|
|
119
|
+
return /* @__PURE__ */ f("div", {
|
|
99
120
|
className: "filter-field__stack",
|
|
100
|
-
children: [/* @__PURE__ */ l(
|
|
101
|
-
value:
|
|
102
|
-
placeholder:
|
|
103
|
-
onChange:
|
|
104
|
-
}), /* @__PURE__ */
|
|
121
|
+
children: [/* @__PURE__ */ l(C, {
|
|
122
|
+
value: s,
|
|
123
|
+
placeholder: i.pageSearchOptions(e.label),
|
|
124
|
+
onChange: m
|
|
125
|
+
}), /* @__PURE__ */ f("div", {
|
|
105
126
|
className: "filter-field__options",
|
|
106
127
|
children: [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
p.map(
|
|
110
|
-
|
|
128
|
+
u.map(y),
|
|
129
|
+
u.length > 0 && p.length > 0 && /* @__PURE__ */ l("div", { className: "filter-field__divider" }),
|
|
130
|
+
p.map(y),
|
|
131
|
+
u.length === 0 && p.length === 0 && /* @__PURE__ */ l("span", {
|
|
111
132
|
className: "filter-field__empty",
|
|
112
|
-
children:
|
|
133
|
+
children: i.pageNoMatches
|
|
113
134
|
})
|
|
114
135
|
]
|
|
115
136
|
})]
|
|
116
137
|
});
|
|
117
138
|
}
|
|
118
|
-
if (
|
|
139
|
+
if (v === "radio") return /* @__PURE__ */ f("div", {
|
|
119
140
|
className: "filter-field__rows",
|
|
120
|
-
children: [/* @__PURE__ */ l(
|
|
121
|
-
label:
|
|
141
|
+
children: [/* @__PURE__ */ l(R, {
|
|
142
|
+
label: i.pageAny,
|
|
122
143
|
mark: "radio",
|
|
123
|
-
selected:
|
|
144
|
+
selected: h.length === 0,
|
|
124
145
|
onClick: () => t(null)
|
|
125
|
-
}), e.options.map(
|
|
146
|
+
}), e.options.map(y)]
|
|
126
147
|
});
|
|
127
|
-
const
|
|
128
|
-
return /* @__PURE__ */
|
|
148
|
+
const M = e.options.length > 7, T = M && !o ? e.options.filter((a, u) => u < 6 || _(a)) : e.options;
|
|
149
|
+
return /* @__PURE__ */ f("div", {
|
|
129
150
|
className: "filter-field__stack",
|
|
130
151
|
children: [/* @__PURE__ */ l("div", {
|
|
131
152
|
className: "filter-field__rows",
|
|
132
|
-
children:
|
|
133
|
-
}),
|
|
153
|
+
children: T.map(y)
|
|
154
|
+
}), M && /* @__PURE__ */ l("button", {
|
|
134
155
|
type: "button",
|
|
135
156
|
className: "filter-field__link",
|
|
136
|
-
onClick: () =>
|
|
137
|
-
children:
|
|
157
|
+
onClick: () => d(!o),
|
|
158
|
+
children: o ? i.pageShowFewer : i.pageShowAll(e.options.length)
|
|
138
159
|
})]
|
|
139
160
|
});
|
|
140
|
-
},
|
|
141
|
-
const [t,
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
161
|
+
}, ee = ({ spec: e, value: r, onChange: n }) => {
|
|
162
|
+
const [t, i] = G(r, e.min, e.max), [s, m] = S([t, i]);
|
|
163
|
+
J(() => m([t, i]), [t, i]);
|
|
164
|
+
const o = ([c, h]) => n(c <= e.min && h >= e.max ? null : [c, h]), d = (c, h) => {
|
|
165
|
+
const _ = c === 0 ? e.min : e.max, b = Math.min(Math.max(h ?? _, e.min), e.max), w = c === 0 ? [Math.min(b, s[1]), s[1]] : [s[0], Math.max(b, s[0])];
|
|
166
|
+
m(w), o(w);
|
|
167
|
+
}, v = /* @__PURE__ */ l(E, {
|
|
145
168
|
min: e.min,
|
|
146
169
|
max: e.max,
|
|
147
170
|
step: e.step,
|
|
148
|
-
value:
|
|
149
|
-
showValues: !
|
|
150
|
-
formatValue: (
|
|
151
|
-
onChange:
|
|
152
|
-
onChangeEnd:
|
|
171
|
+
value: s,
|
|
172
|
+
showValues: !e.inputs,
|
|
173
|
+
formatValue: (c) => e.unit ? `${c} ${e.unit}` : String(c),
|
|
174
|
+
onChange: m,
|
|
175
|
+
onChangeEnd: o
|
|
153
176
|
});
|
|
154
|
-
|
|
155
|
-
|
|
177
|
+
return e.inputs ? /* @__PURE__ */ f("div", {
|
|
178
|
+
className: "filter-field__stack",
|
|
179
|
+
children: [v, /* @__PURE__ */ f("div", {
|
|
180
|
+
className: "filter-field__range-inputs",
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ l(F, {
|
|
183
|
+
value: s[0],
|
|
184
|
+
min: e.min,
|
|
185
|
+
max: s[1],
|
|
186
|
+
step: e.step,
|
|
187
|
+
onChange: (c) => d(0, c)
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ l("span", {
|
|
190
|
+
className: "filter-field__range-dash",
|
|
191
|
+
children: "–"
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ l(F, {
|
|
194
|
+
value: s[1],
|
|
195
|
+
min: s[0],
|
|
196
|
+
max: e.max,
|
|
197
|
+
step: e.step,
|
|
198
|
+
onChange: (c) => d(1, c)
|
|
199
|
+
}),
|
|
200
|
+
e.unit && /* @__PURE__ */ l("span", {
|
|
201
|
+
className: "filter-field__count",
|
|
202
|
+
children: e.unit
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
})]
|
|
206
|
+
}) : v;
|
|
207
|
+
}, le = ({ spec: e, value: r, onChange: n }) => {
|
|
208
|
+
const t = k(N), i = Q(r);
|
|
156
209
|
if (e.max <= 5) {
|
|
157
|
-
const
|
|
210
|
+
const s = Array.from({ length: e.max - 1 }, (o, d) => d + 2), m = [{
|
|
158
211
|
value: 0,
|
|
159
212
|
label: t.pageAny
|
|
160
|
-
}, ...
|
|
161
|
-
value:
|
|
162
|
-
label:
|
|
213
|
+
}, ...s.map((o) => ({
|
|
214
|
+
value: o,
|
|
215
|
+
label: o === e.max ? `${o}★` : `${o}★+`
|
|
163
216
|
}))];
|
|
164
|
-
return /* @__PURE__ */ l(
|
|
165
|
-
items:
|
|
166
|
-
value:
|
|
167
|
-
onSelect: (
|
|
217
|
+
return /* @__PURE__ */ l(x, {
|
|
218
|
+
items: m,
|
|
219
|
+
value: i,
|
|
220
|
+
onSelect: (o) => n(typeof o == "number" ? o : 0)
|
|
168
221
|
});
|
|
169
222
|
}
|
|
170
|
-
return /* @__PURE__ */
|
|
223
|
+
return /* @__PURE__ */ f("div", {
|
|
171
224
|
className: "filter-field__rating",
|
|
172
|
-
children: [/* @__PURE__ */ l(
|
|
173
|
-
rating:
|
|
225
|
+
children: [/* @__PURE__ */ l(O, {
|
|
226
|
+
rating: i,
|
|
174
227
|
maxRate: e.max,
|
|
175
228
|
selectable: !0,
|
|
176
|
-
onSelect: (
|
|
177
|
-
}),
|
|
229
|
+
onSelect: (s) => n(s === i ? 0 : s)
|
|
230
|
+
}), i > 0 && /* @__PURE__ */ l("button", {
|
|
178
231
|
type: "button",
|
|
179
232
|
className: "filter-field__link",
|
|
180
233
|
onClick: () => n(0),
|
|
181
234
|
children: t.pageAny
|
|
182
235
|
})]
|
|
183
236
|
});
|
|
184
|
-
},
|
|
185
|
-
const t =
|
|
237
|
+
}, te = ({ spec: e, value: r, onChange: n }) => {
|
|
238
|
+
const t = k(N), { text: i, mode: s } = H(r), m = B(e, {
|
|
186
239
|
anyWord: t.pageAnyWord,
|
|
187
240
|
allWords: t.pageAllWords
|
|
188
|
-
}),
|
|
189
|
-
return /* @__PURE__ */
|
|
241
|
+
}), o = s ?? m?.[0]?.value;
|
|
242
|
+
return /* @__PURE__ */ f("div", {
|
|
190
243
|
className: "filter-field__stack",
|
|
191
|
-
children: [/* @__PURE__ */ l(
|
|
192
|
-
value:
|
|
244
|
+
children: [/* @__PURE__ */ l(C, {
|
|
245
|
+
value: i,
|
|
193
246
|
placeholder: e.placeholder,
|
|
194
|
-
onChange: (
|
|
195
|
-
text:
|
|
196
|
-
mode:
|
|
247
|
+
onChange: (d) => n({
|
|
248
|
+
text: d,
|
|
249
|
+
mode: o
|
|
197
250
|
})
|
|
198
|
-
}),
|
|
199
|
-
items:
|
|
200
|
-
value:
|
|
201
|
-
label:
|
|
251
|
+
}), m && /* @__PURE__ */ l(x, {
|
|
252
|
+
items: m.map((d) => ({
|
|
253
|
+
value: d.value,
|
|
254
|
+
label: d.label
|
|
202
255
|
})),
|
|
203
|
-
value:
|
|
204
|
-
onSelect: (
|
|
205
|
-
text:
|
|
206
|
-
mode:
|
|
256
|
+
value: o ?? null,
|
|
257
|
+
onSelect: (d) => n({
|
|
258
|
+
text: i,
|
|
259
|
+
mode: d === null ? void 0 : String(d)
|
|
207
260
|
})
|
|
208
261
|
})]
|
|
209
262
|
});
|
|
210
|
-
},
|
|
263
|
+
}, g = (e) => {
|
|
211
264
|
if (e === null) return;
|
|
212
|
-
const [
|
|
213
|
-
return
|
|
214
|
-
},
|
|
215
|
-
const t =
|
|
216
|
-
return /* @__PURE__ */ l(
|
|
217
|
-
value:
|
|
218
|
-
minDate:
|
|
219
|
-
maxDate:
|
|
265
|
+
const [r, n, t] = String(e).split("-").map(Number);
|
|
266
|
+
return r && n && t ? new Date(r, n - 1, t) : void 0;
|
|
267
|
+
}, ae = ({ spec: e, value: r, onChange: n }) => {
|
|
268
|
+
const t = k(N);
|
|
269
|
+
return /* @__PURE__ */ l($, {
|
|
270
|
+
value: g(z(r)),
|
|
271
|
+
minDate: g(e.min ?? null),
|
|
272
|
+
maxDate: g(e.max ?? null),
|
|
220
273
|
placeholder: t.selectDate,
|
|
221
274
|
clearable: !0,
|
|
222
|
-
onChange: (
|
|
275
|
+
onChange: (i) => n(i instanceof Date ? D(i, "YYYY-MM-DD") : null)
|
|
223
276
|
});
|
|
224
|
-
},
|
|
225
|
-
const t =
|
|
226
|
-
return /* @__PURE__ */ l(
|
|
277
|
+
}, re = ({ spec: e, value: r, onChange: n }) => {
|
|
278
|
+
const t = k(N), [i, s] = q(r), m = g(i || null), o = g(s || null);
|
|
279
|
+
return /* @__PURE__ */ l($, {
|
|
227
280
|
mode: "range",
|
|
228
|
-
value:
|
|
229
|
-
start:
|
|
230
|
-
end:
|
|
281
|
+
value: m && o ? {
|
|
282
|
+
start: m,
|
|
283
|
+
end: o
|
|
231
284
|
} : void 0,
|
|
232
|
-
minDate:
|
|
233
|
-
maxDate:
|
|
285
|
+
minDate: g(e.min ?? null),
|
|
286
|
+
maxDate: g(e.max ?? null),
|
|
234
287
|
placeholder: t.selectDate,
|
|
235
288
|
clearable: !0,
|
|
236
|
-
onChange: (
|
|
289
|
+
onChange: (d) => n(d && !(d instanceof Date) && !Array.isArray(d) ? [D(d.start, "YYYY-MM-DD"), D(d.end, "YYYY-MM-DD")] : null)
|
|
237
290
|
});
|
|
238
|
-
},
|
|
239
|
-
const
|
|
291
|
+
}, we = ({ spec: e, value: r, context: n, onChange: t }) => {
|
|
292
|
+
const i = `filter-field filter-field--${n}`;
|
|
240
293
|
switch (e.kind) {
|
|
241
294
|
case "single":
|
|
242
295
|
case "multi":
|
|
243
296
|
return /* @__PURE__ */ l("div", {
|
|
244
|
-
className:
|
|
245
|
-
children: /* @__PURE__ */ l(
|
|
297
|
+
className: i,
|
|
298
|
+
children: /* @__PURE__ */ l(Z, {
|
|
246
299
|
spec: e,
|
|
247
|
-
value:
|
|
300
|
+
value: r,
|
|
248
301
|
context: n,
|
|
249
302
|
onChange: t
|
|
250
303
|
})
|
|
251
304
|
});
|
|
252
305
|
case "range":
|
|
253
306
|
return /* @__PURE__ */ l("div", {
|
|
254
|
-
className:
|
|
255
|
-
children: /* @__PURE__ */ l(
|
|
307
|
+
className: i,
|
|
308
|
+
children: /* @__PURE__ */ l(ee, {
|
|
256
309
|
spec: e,
|
|
257
|
-
value:
|
|
310
|
+
value: r,
|
|
258
311
|
onChange: t
|
|
259
312
|
})
|
|
260
313
|
});
|
|
261
314
|
case "rating":
|
|
262
315
|
return /* @__PURE__ */ l("div", {
|
|
263
|
-
className:
|
|
264
|
-
children: /* @__PURE__ */ l(
|
|
316
|
+
className: i,
|
|
317
|
+
children: /* @__PURE__ */ l(le, {
|
|
265
318
|
spec: e,
|
|
266
|
-
value:
|
|
319
|
+
value: r,
|
|
267
320
|
onChange: t
|
|
268
321
|
})
|
|
269
322
|
});
|
|
270
323
|
case "toggle": {
|
|
271
|
-
const
|
|
272
|
-
return /* @__PURE__ */
|
|
273
|
-
className: `${
|
|
324
|
+
const s = r === !0;
|
|
325
|
+
return /* @__PURE__ */ f("div", {
|
|
326
|
+
className: `${i} filter-field__switch-row`,
|
|
274
327
|
children: [
|
|
275
328
|
/* @__PURE__ */ l("button", {
|
|
276
329
|
type: "button",
|
|
277
330
|
className: "filter-field__switch-label",
|
|
278
|
-
onClick: () => t(!
|
|
331
|
+
onClick: () => t(!s),
|
|
279
332
|
children: e.label
|
|
280
333
|
}),
|
|
281
334
|
e.count !== void 0 && /* @__PURE__ */ l("span", {
|
|
282
335
|
className: "filter-field__count",
|
|
283
336
|
children: e.count
|
|
284
337
|
}),
|
|
285
|
-
/* @__PURE__ */ l(
|
|
286
|
-
checked:
|
|
338
|
+
/* @__PURE__ */ l(U, {
|
|
339
|
+
checked: s,
|
|
287
340
|
size: "small",
|
|
288
341
|
showLabels: !1,
|
|
289
342
|
onChange: t
|
|
@@ -293,35 +346,35 @@ var D = ({ items: e, value: a, onSelect: n }) => /* @__PURE__ */ l("div", {
|
|
|
293
346
|
}
|
|
294
347
|
case "text":
|
|
295
348
|
return /* @__PURE__ */ l("div", {
|
|
296
|
-
className:
|
|
297
|
-
children: /* @__PURE__ */ l(
|
|
349
|
+
className: i,
|
|
350
|
+
children: /* @__PURE__ */ l(te, {
|
|
298
351
|
spec: e,
|
|
299
|
-
value:
|
|
352
|
+
value: r,
|
|
300
353
|
onChange: t
|
|
301
354
|
})
|
|
302
355
|
});
|
|
303
356
|
case "date":
|
|
304
357
|
return /* @__PURE__ */ l("div", {
|
|
305
|
-
className:
|
|
306
|
-
children: /* @__PURE__ */ l(
|
|
358
|
+
className: i,
|
|
359
|
+
children: /* @__PURE__ */ l(ae, {
|
|
307
360
|
spec: e,
|
|
308
|
-
value:
|
|
361
|
+
value: r,
|
|
309
362
|
onChange: t
|
|
310
363
|
})
|
|
311
364
|
});
|
|
312
365
|
case "date-range":
|
|
313
366
|
return /* @__PURE__ */ l("div", {
|
|
314
|
-
className:
|
|
315
|
-
children: /* @__PURE__ */ l(
|
|
367
|
+
className: i,
|
|
368
|
+
children: /* @__PURE__ */ l(re, {
|
|
316
369
|
spec: e,
|
|
317
|
-
value:
|
|
370
|
+
value: r,
|
|
318
371
|
onChange: t
|
|
319
372
|
})
|
|
320
373
|
});
|
|
321
374
|
}
|
|
322
375
|
};
|
|
323
376
|
export {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
377
|
+
we as FilterField,
|
|
378
|
+
R as OptionRow,
|
|
379
|
+
x as Segmented
|
|
327
380
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { libMessages as f } from "../../contexts/LanguageContext/libMessages.js";
|
|
2
|
+
import { useMessages as N } from "../../hooks/useLanguage.js";
|
|
3
|
+
import { useBreakpoint as v } from "../../hooks/useBreakpoint.js";
|
|
4
|
+
import { useAppFrame as A } from "./useAppFrame.js";
|
|
5
|
+
import { getButtonActions as M, getMenuItems as b, navToMenuItems as x } from "./menuItems.js";
|
|
6
|
+
import { getHeadingText as I } from "./shellText.js";
|
|
7
|
+
import { ActionButton as c, AppMark as j, PageMenu as k, PageTabsRow as y } from "./PageParts.js";
|
|
8
|
+
import { useConfirmedActions as B } from "./useConfirmedActions.js";
|
|
9
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
10
|
+
var q = (s) => {
|
|
11
|
+
const { title: p, tabs: h, footer: o, children: g } = s, { isMobile: l } = v(), d = N(f), a = A(), { primaryAction: i, actions: n, dialog: u } = B(s.primaryAction, s.actions ?? []), m = I(s, d), _ = [...x(a?.nav ?? []), ...b(n, a?.menuItems ?? [], l)];
|
|
12
|
+
return /* @__PURE__ */ t("div", {
|
|
13
|
+
className: [
|
|
14
|
+
"page-shell",
|
|
15
|
+
"page-shell--focus",
|
|
16
|
+
l ? "page-shell--phone" : "page-shell--desktop"
|
|
17
|
+
].join(" "),
|
|
18
|
+
children: [/* @__PURE__ */ t("div", {
|
|
19
|
+
className: "page-shell__main",
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ t("header", {
|
|
22
|
+
className: "page-shell__toolbar",
|
|
23
|
+
children: [
|
|
24
|
+
a && /* @__PURE__ */ e(j, {
|
|
25
|
+
app: a.app,
|
|
26
|
+
logoOnly: !0
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ t("div", {
|
|
29
|
+
className: "page-shell__titles",
|
|
30
|
+
children: [/* @__PURE__ */ e("h1", {
|
|
31
|
+
className: "page-shell__title",
|
|
32
|
+
children: p
|
|
33
|
+
}), m && /* @__PURE__ */ e("p", {
|
|
34
|
+
className: "page-shell__heading",
|
|
35
|
+
children: m
|
|
36
|
+
})]
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ e("span", { className: "page-shell__spacer" }),
|
|
39
|
+
!l && M(n).map((r) => /* @__PURE__ */ e(c, { action: r }, r.id)),
|
|
40
|
+
i && /* @__PURE__ */ e(c, { action: i }),
|
|
41
|
+
s.status ?? a?.status,
|
|
42
|
+
/* @__PURE__ */ e(k, { items: _ })
|
|
43
|
+
]
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ e(y, { tabs: h }),
|
|
46
|
+
/* @__PURE__ */ e("div", {
|
|
47
|
+
className: "page-shell__content",
|
|
48
|
+
children: g
|
|
49
|
+
}),
|
|
50
|
+
o && /* @__PURE__ */ e("div", {
|
|
51
|
+
className: "page-shell__footer",
|
|
52
|
+
children: o
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
}), u]
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
q as FocusShell
|
|
60
|
+
};
|