@memobit/libs 3.26.4 → 3.28.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/Banner/Banner2.js +15 -13
- package/dist/components/BoldText/BoldText.js +5 -0
- package/dist/components/Calendar/Calendar2.js +108 -135
- package/dist/components/ColorPicker/ColorPicker.css +1 -1
- package/dist/components/ColorPicker/ColorPicker2.js +114 -114
- package/dist/components/ConfirmDialog/ConfirmDialog2.js +13 -11
- package/dist/components/ConfirmPopover/ConfirmPopover2.js +26 -24
- package/dist/components/ContextMenu/ContextMenu2.js +46 -33
- package/dist/components/ControlPanel/ControlPanel2.js +95 -93
- package/dist/components/ControlPanel/ControlPanelFilter.js +205 -193
- package/dist/components/ControlPanel/ControlPanelOptions.js +190 -185
- package/dist/components/DataView/DataView.CardView.js +83 -81
- package/dist/components/DataView/DataView.ColumnSelector.js +27 -25
- package/dist/components/DataView/DataView.TableView.js +74 -72
- package/dist/components/DataView/DataView2.js +169 -167
- package/dist/components/DatePicker/DatePicker2.js +71 -69
- package/dist/components/Drawer/Drawer2.js +58 -55
- package/dist/components/Dropdown/Dropdown2.js +187 -189
- package/dist/components/InputDate/InputDate2.js +43 -41
- package/dist/components/InputSearch/InputSearch2.js +27 -25
- package/dist/components/MenuBar/MenuBar.css +1 -0
- package/dist/components/MenuBar/MenuBar2.js +46 -0
- package/dist/components/Modal/Modal2.js +49 -47
- package/dist/components/Pagination/Pagination2.js +44 -47
- package/dist/components/ScrollToTop/ScrollToTop2.js +18 -16
- package/dist/components/ThemeSettings/ThemeSettings2.js +131 -123
- package/dist/components/TipsOfTheDay/TipsOfTheDay2.js +16 -12
- package/dist/components/Toast/Toast2.js +38 -33
- package/dist/components/ToolButton/ToolButton.css +1 -0
- package/dist/components/ToolButton/ToolButton2.js +36 -0
- package/dist/components/ToolPalette/ToolPalette.css +1 -0
- package/dist/components/ToolPalette/ToolPalette2.js +83 -0
- package/dist/components/Toolbar/Toolbar2.js +58 -56
- package/dist/contexts/LanguageContext/LanguageContext.context.js +9 -0
- package/dist/contexts/LanguageContext/LanguageContext.js +19 -0
- package/dist/contexts/LanguageContext/libMessages.js +240 -0
- package/dist/helpers/Datetime.js +84 -68
- package/dist/helpers/Language.js +8 -0
- package/dist/helpers/Pagination.js +5 -4
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/hooks/useLanguage.js +16 -0
- package/dist/index.d.ts +133 -6
- package/dist/index.js +417 -399
- package/dist/memobit-icons.json +4 -0
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +1 -1
|
@@ -1,142 +1,151 @@
|
|
|
1
1
|
import { Icon as b } from "../Icon/Icon2.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { libMessages as R } from "../../contexts/LanguageContext/libMessages.js";
|
|
3
|
+
import { useMessages as M } from "../../hooks/useLanguage.js";
|
|
4
|
+
import { Button as j } from "../Button/Button2.js";
|
|
5
|
+
import { Tooltip as A } from "../Tooltip/Tooltip2.js";
|
|
4
6
|
import { Chip as I } from "../Chip/Chip2.js";
|
|
5
|
-
import { InputNumber as
|
|
6
|
-
import { InputText as
|
|
7
|
-
import { DatePicker as
|
|
7
|
+
import { InputNumber as $ } from "../InputNumber/InputNumber2.js";
|
|
8
|
+
import { InputText as U } from "../InputText/InputText2.js";
|
|
9
|
+
import { DatePicker as B } from "../DatePicker/DatePicker2.js";
|
|
8
10
|
import { Dropdown as O } from "../Dropdown/Dropdown2.js";
|
|
9
|
-
import { InputDate as
|
|
10
|
-
import { InputSearch as
|
|
11
|
-
import { Rating as
|
|
12
|
-
import { DEFAULT_DATE_RANGE_PRESETS as
|
|
13
|
-
import { Fragment as
|
|
14
|
-
import { jsx as n, jsxs as
|
|
15
|
-
var
|
|
11
|
+
import { InputDate as Y } from "../InputDate/InputDate2.js";
|
|
12
|
+
import { InputSearch as T } from "../InputSearch/InputSearch2.js";
|
|
13
|
+
import { Rating as z } from "../Rating/Rating2.js";
|
|
14
|
+
import { DEFAULT_DATE_RANGE_PRESETS as G } from "./ControlPanel.types.js";
|
|
15
|
+
import { Fragment as P, useEffect as W, useMemo as L, useRef as q, useState as E } from "react";
|
|
16
|
+
import { jsx as n, jsxs as _ } from "react/jsx-runtime";
|
|
17
|
+
var J = 3, C = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean" ? [] : [e], w = (e) => e.every((r) => typeof r == "number") ? e : e.map(String), y = (e, r) => String(e) === String(r), K = (e, r, o) => e.filter((t) => t !== "" && !r.some((s) => y(s.value, t))).map((t) => ({
|
|
16
18
|
className: "control-panel__filter-option--stale",
|
|
17
|
-
details:
|
|
19
|
+
details: o,
|
|
18
20
|
icon: "warning",
|
|
19
21
|
label: String(t),
|
|
20
22
|
value: t
|
|
21
|
-
})), k = 2,
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
-
},
|
|
25
|
-
const { type:
|
|
23
|
+
})), k = 2, Q = (e) => {
|
|
24
|
+
const r = e.options ?? [];
|
|
25
|
+
return C(e.value).map((o) => r.find((t) => y(t.value, o))?.label ?? String(o));
|
|
26
|
+
}, X = (e, r) => {
|
|
27
|
+
const { type: o, value: t } = e;
|
|
26
28
|
if (t == null || t === "") return;
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
const [
|
|
30
|
-
return
|
|
29
|
+
if (o === "checkbox") return t === !0 ? r.filterOn : void 0;
|
|
30
|
+
if (o === "range") {
|
|
31
|
+
const [i, d] = Array.isArray(t) ? t : [];
|
|
32
|
+
return i === void 0 && d === void 0 ? void 0 : i === void 0 ? `≤ ${d}` : d === void 0 ? `≥ ${i}` : `${i} – ${d}`;
|
|
31
33
|
}
|
|
32
|
-
if (
|
|
33
|
-
const [
|
|
34
|
-
return !
|
|
34
|
+
if (o === "date-range") {
|
|
35
|
+
const [i, d] = Array.isArray(t) ? t : [];
|
|
36
|
+
return !i && !d ? void 0 : i ? d ? `${i} → ${d}` : r.filterFrom(i) : r.filterUntil(d);
|
|
35
37
|
}
|
|
36
|
-
if (
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
41
|
-
},
|
|
42
|
-
const
|
|
38
|
+
if (o === "rating") return typeof t == "number" && t > 0 ? String(t) : void 0;
|
|
39
|
+
if (o === "text" || o === "search" || o === "date" || o === "number") return String(t);
|
|
40
|
+
const s = Q(e);
|
|
41
|
+
if (s.length !== 0)
|
|
42
|
+
return s.length <= k ? s.join(", ") : `${s.slice(0, k).join(", ")} +${s.length - k}`;
|
|
43
|
+
}, ye = ({ filter: e, collapsible: r = !1, onChange: o }) => {
|
|
44
|
+
const t = M(R), s = r && e.type !== "checkbox", [i, d] = E(e.defaultExpanded ?? !1), N = e.summary ?? X(e, t), x = /* @__PURE__ */ _("span", {
|
|
43
45
|
className: `control-panel__filter-title${e.isActive ? " control-panel__filter-title--active" : ""}`,
|
|
44
46
|
children: [
|
|
45
47
|
e.isActive && /* @__PURE__ */ n("span", { className: "control-panel__filter-active-dot" }),
|
|
46
48
|
e.icon && /* @__PURE__ */ n(b, { name: e.icon }),
|
|
47
49
|
e.label
|
|
48
50
|
]
|
|
49
|
-
}),
|
|
51
|
+
}), D = [
|
|
50
52
|
"control-panel__filter",
|
|
51
53
|
e.type === "checkbox" ? "control-panel__filter--checkbox" : "",
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
s ? "control-panel__filter--collapsible" : "",
|
|
55
|
+
s && !i ? "control-panel__filter--collapsed" : ""
|
|
54
56
|
].filter(Boolean).join(" ");
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
className:
|
|
57
|
-
children: [
|
|
57
|
+
return /* @__PURE__ */ _("div", {
|
|
58
|
+
className: D,
|
|
59
|
+
children: [s ? /* @__PURE__ */ _("button", {
|
|
58
60
|
className: "control-panel__filter-toggle",
|
|
59
61
|
type: "button",
|
|
60
|
-
onClick: () =>
|
|
62
|
+
onClick: () => d((a) => !a),
|
|
61
63
|
children: [
|
|
62
|
-
|
|
63
|
-
!
|
|
64
|
+
x,
|
|
65
|
+
!i && N && /* @__PURE__ */ n("span", {
|
|
64
66
|
className: "control-panel__filter-summary",
|
|
65
|
-
children:
|
|
67
|
+
children: N
|
|
66
68
|
}),
|
|
67
69
|
/* @__PURE__ */ n("span", {
|
|
68
70
|
className: "control-panel__filter-caret",
|
|
69
|
-
children: /* @__PURE__ */ n(b, { name:
|
|
71
|
+
children: /* @__PURE__ */ n(b, { name: i ? "caret-up" : "caret-down" })
|
|
70
72
|
})
|
|
71
73
|
]
|
|
72
|
-
}) : e.type !== "checkbox" &&
|
|
74
|
+
}) : e.type !== "checkbox" && x, (!s || i) && /* @__PURE__ */ n(F, {
|
|
73
75
|
filter: e,
|
|
74
|
-
onChange:
|
|
76
|
+
onChange: o
|
|
75
77
|
})]
|
|
76
78
|
});
|
|
77
|
-
},
|
|
78
|
-
const [
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
}, [
|
|
79
|
+
}, Z = ({ placeholder: e, value: r, onChange: o }) => {
|
|
80
|
+
const [t, s] = E(r), i = q(r);
|
|
81
|
+
return W(() => {
|
|
82
|
+
r !== i.current && (i.current = r, s(r));
|
|
83
|
+
}, [r]), /* @__PURE__ */ n(T, {
|
|
82
84
|
className: "control-panel__filter-search",
|
|
83
|
-
onChange: (
|
|
84
|
-
i.current =
|
|
85
|
+
onChange: (d) => {
|
|
86
|
+
i.current = d, s(d), o(d);
|
|
85
87
|
},
|
|
86
88
|
placeholder: e,
|
|
87
|
-
value:
|
|
89
|
+
value: t
|
|
88
90
|
});
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
children: /* @__PURE__ */
|
|
94
|
-
className: "control-panel__filter-radio-
|
|
95
|
-
children:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
91
|
+
}, V = ({ option: e, onRemove: r }) => {
|
|
92
|
+
const o = M(R);
|
|
93
|
+
return /* @__PURE__ */ n(A, {
|
|
94
|
+
title: o.filterStaleHint,
|
|
95
|
+
children: /* @__PURE__ */ n("div", {
|
|
96
|
+
className: "control-panel__filter-radio control-panel__filter-radio--selected control-panel__filter-radio--stale",
|
|
97
|
+
children: /* @__PURE__ */ _("label", {
|
|
98
|
+
className: "control-panel__filter-radio-label",
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ n("input", {
|
|
101
|
+
checked: !0,
|
|
102
|
+
className: "control-panel__filter-radio-input",
|
|
103
|
+
onChange: r,
|
|
104
|
+
type: "checkbox"
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ n(b, {
|
|
107
|
+
className: "control-panel__filter-icon",
|
|
108
|
+
name: "warning"
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ n("span", {
|
|
111
|
+
className: "control-panel__filter-label",
|
|
112
|
+
children: e.label
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ n(b, {
|
|
115
|
+
className: "control-panel__filter-icon",
|
|
116
|
+
name: "clear"
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
})
|
|
115
120
|
})
|
|
116
|
-
})
|
|
117
|
-
}
|
|
118
|
-
const t =
|
|
121
|
+
});
|
|
122
|
+
}, F = ({ filter: e, onChange: r }) => {
|
|
123
|
+
const o = M(R), t = C(e.value), s = e.options ?? [], i = L(() => K(C(e.value), e.options ?? [], o.filterStaleDetails), [
|
|
124
|
+
e.value,
|
|
125
|
+
e.options,
|
|
126
|
+
o.filterStaleDetails
|
|
127
|
+
]), d = L(() => i.length > 0 ? [...i, ...e.options ?? []] : e.options ?? [], [i, e.options]), N = () => r({
|
|
119
128
|
filterId: e.id,
|
|
120
129
|
type: e.type,
|
|
121
130
|
value: null,
|
|
122
131
|
option: null,
|
|
123
132
|
options: []
|
|
124
|
-
}), [
|
|
133
|
+
}), [x, D] = E("");
|
|
125
134
|
if (e.type === "checkbox") return /* @__PURE__ */ n(I, {
|
|
126
135
|
count: e.count,
|
|
127
136
|
selected: e.value === !0,
|
|
128
|
-
onClick: () =>
|
|
137
|
+
onClick: () => r({
|
|
129
138
|
filterId: e.id,
|
|
130
139
|
type: e.type,
|
|
131
140
|
value: e.value !== !0
|
|
132
141
|
}),
|
|
133
142
|
children: e.label
|
|
134
143
|
});
|
|
135
|
-
if (e.type === "date") return /* @__PURE__ */ n(
|
|
144
|
+
if (e.type === "date") return /* @__PURE__ */ n(Y, {
|
|
136
145
|
min: e.minDate,
|
|
137
146
|
max: e.maxDate,
|
|
138
147
|
value: typeof e.value == "string" ? e.value : "",
|
|
139
|
-
onChange: (a) =>
|
|
148
|
+
onChange: (a) => r({
|
|
140
149
|
filterId: e.id,
|
|
141
150
|
type: e.type,
|
|
142
151
|
value: a ?? null
|
|
@@ -144,8 +153,8 @@ var W = 3, w = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
144
153
|
});
|
|
145
154
|
if (e.type === "text") return /* @__PURE__ */ n("div", {
|
|
146
155
|
className: "control-panel__filter-text",
|
|
147
|
-
children: /* @__PURE__ */ n(
|
|
148
|
-
onChange: (a) =>
|
|
156
|
+
children: /* @__PURE__ */ n(U, {
|
|
157
|
+
onChange: (a) => r({
|
|
149
158
|
filterId: e.id,
|
|
150
159
|
type: e.type,
|
|
151
160
|
value: a
|
|
@@ -154,10 +163,10 @@ var W = 3, w = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
154
163
|
value: typeof e.value == "string" ? e.value : ""
|
|
155
164
|
})
|
|
156
165
|
});
|
|
157
|
-
if (e.type === "search") return /* @__PURE__ */ n(
|
|
166
|
+
if (e.type === "search") return /* @__PURE__ */ n(Z, {
|
|
158
167
|
placeholder: e.placeholder,
|
|
159
168
|
value: typeof e.value == "string" ? e.value : "",
|
|
160
|
-
onChange: (a) =>
|
|
169
|
+
onChange: (a) => r({
|
|
161
170
|
filterId: e.id,
|
|
162
171
|
type: e.type,
|
|
163
172
|
value: a
|
|
@@ -165,102 +174,105 @@ var W = 3, w = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
165
174
|
});
|
|
166
175
|
if (e.type === "number") return /* @__PURE__ */ n("div", {
|
|
167
176
|
className: "control-panel__filter-number",
|
|
168
|
-
children: /* @__PURE__ */ n(
|
|
177
|
+
children: /* @__PURE__ */ n($, {
|
|
169
178
|
min: e.min,
|
|
170
179
|
max: e.max,
|
|
171
180
|
step: e.step,
|
|
172
181
|
placeholder: e.placeholder,
|
|
173
182
|
value: typeof e.value == "number" ? e.value : void 0,
|
|
174
|
-
onChange: (a) =>
|
|
183
|
+
onChange: (a) => r({
|
|
175
184
|
filterId: e.id,
|
|
176
185
|
type: e.type,
|
|
177
186
|
value: a ?? null
|
|
178
187
|
})
|
|
179
188
|
})
|
|
180
189
|
});
|
|
181
|
-
if (e.type === "rating") return /* @__PURE__ */ n(
|
|
190
|
+
if (e.type === "rating") return /* @__PURE__ */ n(z, {
|
|
182
191
|
selectable: !0,
|
|
183
192
|
icon: e.ratingIcon ?? "star",
|
|
184
193
|
maxRate: e.maxRate ?? 10,
|
|
185
194
|
rating: typeof e.value == "number" ? e.value : 0,
|
|
186
195
|
variant: e.ratingVariant ?? "warning",
|
|
187
|
-
onSelect: (a) =>
|
|
196
|
+
onSelect: (a) => r({
|
|
188
197
|
filterId: e.id,
|
|
189
198
|
type: e.type,
|
|
190
199
|
value: a
|
|
191
200
|
})
|
|
192
201
|
});
|
|
193
202
|
if (e.type === "range") {
|
|
194
|
-
const a = Array.isArray(e.value) ? e.value : [],
|
|
203
|
+
const a = Array.isArray(e.value) ? e.value : [], p = a[0], l = a[1], v = p !== void 0 && l !== void 0 && p > l, m = (u, h) => r({
|
|
195
204
|
filterId: e.id,
|
|
196
205
|
type: e.type,
|
|
197
|
-
value: [
|
|
206
|
+
value: [u, h]
|
|
198
207
|
});
|
|
199
|
-
return /* @__PURE__ */
|
|
208
|
+
return /* @__PURE__ */ _("div", {
|
|
200
209
|
className: "control-panel__filter-range",
|
|
201
210
|
children: [
|
|
202
|
-
/* @__PURE__ */ n(
|
|
211
|
+
/* @__PURE__ */ n($, {
|
|
203
212
|
min: e.min,
|
|
204
213
|
max: e.max,
|
|
205
214
|
step: e.step,
|
|
206
|
-
placeholder:
|
|
207
|
-
value:
|
|
208
|
-
error:
|
|
209
|
-
onChange: (
|
|
215
|
+
placeholder: o.rangeMin,
|
|
216
|
+
value: p,
|
|
217
|
+
error: v ? o.rangeMinExceedsMax : void 0,
|
|
218
|
+
onChange: (u) => m(u, l)
|
|
210
219
|
}),
|
|
211
220
|
/* @__PURE__ */ n("span", {
|
|
212
221
|
className: "control-panel__filter-range-sep",
|
|
213
222
|
children: "—"
|
|
214
223
|
}),
|
|
215
|
-
/* @__PURE__ */ n(
|
|
224
|
+
/* @__PURE__ */ n($, {
|
|
216
225
|
min: e.min,
|
|
217
226
|
max: e.max,
|
|
218
227
|
step: e.step,
|
|
219
|
-
placeholder:
|
|
220
|
-
value:
|
|
221
|
-
error:
|
|
222
|
-
onChange: (
|
|
228
|
+
placeholder: o.rangeMax,
|
|
229
|
+
value: l,
|
|
230
|
+
error: v ? o.rangeMaxBelowMin : void 0,
|
|
231
|
+
onChange: (u) => m(p, u)
|
|
223
232
|
})
|
|
224
233
|
]
|
|
225
234
|
});
|
|
226
235
|
}
|
|
227
236
|
if (e.type === "date-range") {
|
|
228
|
-
const a = Array.isArray(e.value) ? e.value : [],
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
237
|
+
const a = Array.isArray(e.value) ? e.value : [], p = a[0] || void 0, l = a[1] || void 0, v = e.presets ?? G.map((c) => ({
|
|
238
|
+
...c,
|
|
239
|
+
label: o.datePresetDays(c.days)
|
|
240
|
+
})), m = (c) => {
|
|
241
|
+
if (!c) return;
|
|
242
|
+
const [g, S, H] = c.split("-").map(Number);
|
|
243
|
+
return new Date(g, S - 1, H);
|
|
244
|
+
}, u = (c) => `${c.getFullYear()}-${String(c.getMonth() + 1).padStart(2, "0")}-${String(c.getDate()).padStart(2, "0")}`, h = (c, g) => r({
|
|
233
245
|
filterId: e.id,
|
|
234
246
|
type: e.type,
|
|
235
|
-
value: [
|
|
236
|
-
}),
|
|
237
|
-
const g = e.maxDate ?
|
|
247
|
+
value: [c ?? "", g ?? ""]
|
|
248
|
+
}), f = (c) => {
|
|
249
|
+
const g = e.maxDate ? m(e.maxDate) : /* @__PURE__ */ new Date();
|
|
238
250
|
if (!g) return;
|
|
239
251
|
const S = new Date(g);
|
|
240
|
-
S.setDate(S.getDate() -
|
|
252
|
+
S.setDate(S.getDate() - c), h(u(S), u(g));
|
|
241
253
|
};
|
|
242
|
-
return /* @__PURE__ */
|
|
254
|
+
return /* @__PURE__ */ _("div", {
|
|
243
255
|
className: "control-panel__filter-date-range",
|
|
244
|
-
children: [
|
|
256
|
+
children: [v.length > 0 && /* @__PURE__ */ n("div", {
|
|
245
257
|
className: "control-panel__filter-date-presets",
|
|
246
|
-
children:
|
|
258
|
+
children: v.map((c) => /* @__PURE__ */ n(j, {
|
|
247
259
|
size: "small",
|
|
248
260
|
variant: "default",
|
|
249
|
-
onClick: () =>
|
|
250
|
-
children:
|
|
251
|
-
},
|
|
252
|
-
}), /* @__PURE__ */ n(
|
|
261
|
+
onClick: () => f(c.days),
|
|
262
|
+
children: c.label
|
|
263
|
+
}, c.days))
|
|
264
|
+
}), /* @__PURE__ */ n(B, {
|
|
253
265
|
mode: "range",
|
|
254
|
-
minDate:
|
|
255
|
-
maxDate:
|
|
256
|
-
placeholder: e.placeholder ??
|
|
257
|
-
value:
|
|
258
|
-
start:
|
|
259
|
-
end:
|
|
266
|
+
minDate: m(e.minDate),
|
|
267
|
+
maxDate: m(e.maxDate),
|
|
268
|
+
placeholder: e.placeholder ?? o.selectRange,
|
|
269
|
+
value: p && l ? {
|
|
270
|
+
start: m(p),
|
|
271
|
+
end: m(l)
|
|
260
272
|
} : void 0,
|
|
261
|
-
onChange: (
|
|
262
|
-
if (
|
|
263
|
-
h(
|
|
273
|
+
onChange: (c) => {
|
|
274
|
+
if (c && typeof c == "object" && !Array.isArray(c) && "start" in c) {
|
|
275
|
+
h(u(c.start), u(c.end));
|
|
264
276
|
return;
|
|
265
277
|
}
|
|
266
278
|
h(void 0, void 0);
|
|
@@ -269,23 +281,23 @@ var W = 3, w = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
269
281
|
});
|
|
270
282
|
}
|
|
271
283
|
if (e.type === "dropdown")
|
|
272
|
-
return !e.multiple &&
|
|
284
|
+
return !e.multiple && s.length > 0 && s.length <= J ? /* @__PURE__ */ _("div", {
|
|
273
285
|
className: `control-panel__filter-list ${e.inline ? "control-panel__filter-list--inline" : ""}`,
|
|
274
|
-
children: [
|
|
286
|
+
children: [i.map((a) => /* @__PURE__ */ n(V, {
|
|
275
287
|
option: a,
|
|
276
|
-
onRemove:
|
|
277
|
-
}, `stale-${a.value}`)),
|
|
278
|
-
const
|
|
288
|
+
onRemove: N
|
|
289
|
+
}, `stale-${a.value}`)), s.map((a) => {
|
|
290
|
+
const p = t.some((l) => y(l, a.value));
|
|
279
291
|
return /* @__PURE__ */ n("div", {
|
|
280
|
-
className: `control-panel__filter-radio ${
|
|
281
|
-
children: /* @__PURE__ */
|
|
292
|
+
className: `control-panel__filter-radio ${p ? "control-panel__filter-radio--selected" : ""}`,
|
|
293
|
+
children: /* @__PURE__ */ _("label", {
|
|
282
294
|
className: "control-panel__filter-radio-label",
|
|
283
295
|
children: [
|
|
284
296
|
/* @__PURE__ */ n("input", {
|
|
285
|
-
checked:
|
|
297
|
+
checked: p,
|
|
286
298
|
className: "control-panel__filter-radio-input",
|
|
287
299
|
name: e.id,
|
|
288
|
-
onChange: () =>
|
|
300
|
+
onChange: () => r({
|
|
289
301
|
filterId: e.id,
|
|
290
302
|
type: e.type,
|
|
291
303
|
value: a.value,
|
|
@@ -317,16 +329,16 @@ var W = 3, w = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
317
329
|
multiple: e.multiple,
|
|
318
330
|
name: e.id,
|
|
319
331
|
onChange: (a) => {
|
|
320
|
-
const
|
|
321
|
-
|
|
332
|
+
const p = Array.isArray(a) ? a : a ? [a] : [];
|
|
333
|
+
r({
|
|
322
334
|
filterId: e.id,
|
|
323
335
|
type: e.type,
|
|
324
|
-
value: Array.isArray(a) ?
|
|
336
|
+
value: Array.isArray(a) ? w(a.map((l) => l.value)) : a?.value ?? null,
|
|
325
337
|
option: Array.isArray(a) ? null : a,
|
|
326
|
-
options:
|
|
338
|
+
options: p
|
|
327
339
|
});
|
|
328
340
|
},
|
|
329
|
-
options:
|
|
341
|
+
options: d,
|
|
330
342
|
placeholder: e.placeholder,
|
|
331
343
|
searchable: e.searchable ?? !0,
|
|
332
344
|
selectedCountDisplay: "inline",
|
|
@@ -334,88 +346,88 @@ var W = 3, w = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
334
346
|
value: typeof e.value == "boolean" ? null : e.value
|
|
335
347
|
});
|
|
336
348
|
if (e.type === "chips") {
|
|
337
|
-
const a =
|
|
338
|
-
return /* @__PURE__ */
|
|
349
|
+
const a = x.trim().toLowerCase(), p = e.searchable && a ? s.filter((l) => l.label.toLowerCase().includes(a)) : s;
|
|
350
|
+
return /* @__PURE__ */ _("div", {
|
|
339
351
|
className: "control-panel__filter-chips-wrap",
|
|
340
|
-
children: [e.searchable &&
|
|
352
|
+
children: [e.searchable && s.length > 0 && /* @__PURE__ */ n(T, {
|
|
341
353
|
className: "control-panel__filter-chip-search",
|
|
342
|
-
value:
|
|
343
|
-
onChange:
|
|
344
|
-
placeholder: e.placeholder ??
|
|
345
|
-
}), /* @__PURE__ */
|
|
354
|
+
value: x,
|
|
355
|
+
onChange: D,
|
|
356
|
+
placeholder: e.placeholder ?? o.filterPlaceholder
|
|
357
|
+
}), /* @__PURE__ */ _("div", {
|
|
346
358
|
className: `control-panel__filter-chips${e.inline === !1 ? " control-panel__filter-chips--stacked" : ""}`,
|
|
347
359
|
style: e.maxHeight !== void 0 ? {
|
|
348
360
|
maxHeight: typeof e.maxHeight == "number" ? `${e.maxHeight}px` : e.maxHeight,
|
|
349
361
|
overflowY: "auto"
|
|
350
362
|
} : void 0,
|
|
351
|
-
children: [
|
|
352
|
-
title:
|
|
363
|
+
children: [i.map((l) => /* @__PURE__ */ n(A, {
|
|
364
|
+
title: o.filterStaleHint,
|
|
353
365
|
children: /* @__PURE__ */ n(I, {
|
|
354
366
|
className: "control-panel__filter-chip--stale",
|
|
355
367
|
icon: "warning",
|
|
356
368
|
selected: !0,
|
|
357
369
|
variant: "warning",
|
|
358
370
|
onClick: () => {
|
|
359
|
-
const
|
|
360
|
-
|
|
371
|
+
const v = t.filter((m) => !y(m, l.value));
|
|
372
|
+
r({
|
|
361
373
|
filterId: e.id,
|
|
362
374
|
type: e.type,
|
|
363
|
-
value: e.multiple === !1 ? null :
|
|
375
|
+
value: e.multiple === !1 ? null : w(v),
|
|
364
376
|
option: null,
|
|
365
|
-
options:
|
|
377
|
+
options: s.filter((m) => v.some((u) => y(u, m.value)))
|
|
366
378
|
});
|
|
367
379
|
},
|
|
368
|
-
children:
|
|
380
|
+
children: l.label
|
|
369
381
|
})
|
|
370
|
-
}, `stale-${
|
|
371
|
-
const
|
|
372
|
-
color:
|
|
373
|
-
count:
|
|
374
|
-
disabled:
|
|
375
|
-
icon:
|
|
376
|
-
selected:
|
|
382
|
+
}, `stale-${l.value}`)), p.map((l) => {
|
|
383
|
+
const v = t.some((u) => y(u, l.value)), m = /* @__PURE__ */ _(I, {
|
|
384
|
+
color: l.color,
|
|
385
|
+
count: l.count,
|
|
386
|
+
disabled: l.disabled,
|
|
387
|
+
icon: l.icon,
|
|
388
|
+
selected: v,
|
|
377
389
|
onClick: () => {
|
|
378
|
-
if (
|
|
379
|
-
const
|
|
380
|
-
|
|
390
|
+
if (l.disabled) return;
|
|
391
|
+
const u = e.multiple === !1, h = u ? v ? [] : [l.value] : v ? t.filter((f) => !y(f, l.value)) : [...t, l.value];
|
|
392
|
+
r({
|
|
381
393
|
filterId: e.id,
|
|
382
394
|
type: e.type,
|
|
383
|
-
value:
|
|
384
|
-
option:
|
|
385
|
-
options:
|
|
395
|
+
value: u ? h[0] ?? null : w(h),
|
|
396
|
+
option: l,
|
|
397
|
+
options: s.filter((f) => h.some((c) => y(c, f.value)))
|
|
386
398
|
});
|
|
387
399
|
},
|
|
388
|
-
children: [
|
|
400
|
+
children: [l.imageUrl && /* @__PURE__ */ n("img", {
|
|
389
401
|
className: "control-panel__filter-chip-avatar",
|
|
390
|
-
src:
|
|
402
|
+
src: l.imageUrl,
|
|
391
403
|
alt: ""
|
|
392
|
-
}),
|
|
404
|
+
}), l.label]
|
|
393
405
|
});
|
|
394
|
-
return
|
|
395
|
-
title:
|
|
396
|
-
children:
|
|
397
|
-
},
|
|
406
|
+
return l.tooltip ? /* @__PURE__ */ n(A, {
|
|
407
|
+
title: l.tooltip,
|
|
408
|
+
children: m
|
|
409
|
+
}, l.value) : /* @__PURE__ */ n(P, { children: m }, l.value);
|
|
398
410
|
})]
|
|
399
411
|
})]
|
|
400
412
|
});
|
|
401
413
|
}
|
|
402
|
-
return /* @__PURE__ */
|
|
414
|
+
return /* @__PURE__ */ _("div", {
|
|
403
415
|
className: `control-panel__filter-list ${e.inline ? "control-panel__filter-list--inline" : ""}`,
|
|
404
|
-
children: [
|
|
416
|
+
children: [i.map((a) => /* @__PURE__ */ n(V, {
|
|
405
417
|
option: a,
|
|
406
|
-
onRemove:
|
|
407
|
-
}, `stale-${a.value}`)),
|
|
408
|
-
const
|
|
409
|
-
className: `control-panel__filter-radio ${
|
|
410
|
-
children: /* @__PURE__ */
|
|
418
|
+
onRemove: N
|
|
419
|
+
}, `stale-${a.value}`)), s.map((a) => {
|
|
420
|
+
const p = t.some((v) => y(v, a.value)), l = /* @__PURE__ */ n("div", {
|
|
421
|
+
className: `control-panel__filter-radio ${p ? "control-panel__filter-radio--selected" : ""} ${a.disabled ? "control-panel__filter-radio--disabled" : ""}`,
|
|
422
|
+
children: /* @__PURE__ */ _("label", {
|
|
411
423
|
className: "control-panel__filter-radio-label",
|
|
412
424
|
children: [
|
|
413
425
|
/* @__PURE__ */ n("input", {
|
|
414
|
-
checked:
|
|
426
|
+
checked: p,
|
|
415
427
|
className: "control-panel__filter-radio-input",
|
|
416
428
|
disabled: a.disabled,
|
|
417
429
|
name: e.id,
|
|
418
|
-
onChange: () =>
|
|
430
|
+
onChange: () => r({
|
|
419
431
|
filterId: e.id,
|
|
420
432
|
type: e.type,
|
|
421
433
|
value: a.value,
|
|
@@ -444,13 +456,13 @@ var W = 3, w = (e) => Array.isArray(e) ? e : e == null || typeof e == "boolean"
|
|
|
444
456
|
]
|
|
445
457
|
})
|
|
446
458
|
});
|
|
447
|
-
return a.tooltip ? /* @__PURE__ */ n(
|
|
459
|
+
return a.tooltip ? /* @__PURE__ */ n(A, {
|
|
448
460
|
title: a.tooltip,
|
|
449
|
-
children:
|
|
450
|
-
}, a.value) : /* @__PURE__ */ n(
|
|
461
|
+
children: l
|
|
462
|
+
}, a.value) : /* @__PURE__ */ n(P, { children: l }, a.value);
|
|
451
463
|
})]
|
|
452
464
|
});
|
|
453
465
|
};
|
|
454
466
|
export {
|
|
455
|
-
|
|
467
|
+
ye as ControlPanelFilterItem
|
|
456
468
|
};
|