@memobit/libs 3.8.2 → 3.9.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 +95 -95
- package/dist/components/Icon/Icon2.js +34 -17
- package/dist/components/IconPicker/IconPicker2.js +43 -29
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.json +4 -4
- package/package.json +9 -3
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import './DataView.css';
|
|
2
2
|
import { Icon as X } from "../Icon/Icon2.js";
|
|
3
3
|
import { Button as ft } from "../Button/Button2.js";
|
|
4
|
-
import { Tooltip as
|
|
4
|
+
import { Tooltip as Ae } from "../Tooltip/Tooltip2.js";
|
|
5
5
|
import { Checkbox as re } from "../Checkbox/Checkbox2.js";
|
|
6
6
|
import { useBreakpoint as pt } from "../../hooks/useBreakpoint.js";
|
|
7
7
|
import { Dropdown as vt } from "../Dropdown/Dropdown2.js";
|
|
8
8
|
import { getResultsCount as _t } from "../../helpers/Pagination.js";
|
|
9
9
|
import { EmptyState as oe } from "../EmptyState/EmptyState2.js";
|
|
10
|
-
import { Pagination as
|
|
10
|
+
import { Pagination as Ee } from "../Pagination/Pagination2.js";
|
|
11
11
|
import { TimelineMarkerDot as wt, calculateTimelineMarkers as gt } from "../TimelineMarkers/TimelineMarkers2.js";
|
|
12
|
-
import { CardView as bt, DEFAULT_PAGE_SIZES as
|
|
12
|
+
import { CardView as bt, DEFAULT_PAGE_SIZES as Ge, getColumnLabel as yt, renderCellContent as kt, renderColumnLabel as Ct } from "./DataView.CardView.js";
|
|
13
13
|
import { DataViewColumnSelector as Nt } from "./DataView.ColumnSelector.js";
|
|
14
14
|
import { DataViewMiniSort as St } from "./DataView.MiniSort.js";
|
|
15
15
|
/* empty css */
|
|
16
|
-
import
|
|
16
|
+
import Le, { useMemo as L, useState as P } from "react";
|
|
17
17
|
import { Fragment as Mt, jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
18
18
|
function Pt({ state: h }) {
|
|
19
19
|
return /* @__PURE__ */ t("span", {
|
|
@@ -21,43 +21,43 @@ function Pt({ state: h }) {
|
|
|
21
21
|
children: /* @__PURE__ */ t(X, { name: h === "asc" ? "arrow-up" : h === "desc" ? "arrow-down" : "arrow-bidirectional-vertical" })
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
function Wt({ columns: h, data: I, rowKey:
|
|
25
|
-
const { isMobile:
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
return
|
|
24
|
+
function Wt({ columns: h, data: I, rowKey: Ve, pinnedIds: y, selectable: w = !1, onSelectionChange: xe, selectedIds: le, pageSizeOptions: ce = Ge, initialPageSize: Be = Ge[1], showPageSize: $ = !0, card: Fe, actions: k, actionsWidth: K, timeline: C, onRowClick: R, rowHref: de, rowClassName: he, rowDetail: Ie, empty: N, initialSortKey: Ke = null, initialSortDirection: Re = "asc", sortKey: Z, sortDirection: ue, onSortChange: ze, miniSort: z, showCardSortControls: Ue = !0, desktopView: me = "table", cardMaxWidth: We, className: D, onPageChange: je, onPageSizeChange: fe, currentPage: pe, totalItems: ve, group: o, showResultsCount: Oe = !0, totalCount: Xe, itemNoun: Ze, columnSelector: q }) {
|
|
25
|
+
const { isMobile: _e } = pt(), [qe, Je] = P(Ke), [Qe, Ye] = P(Re), [He, et] = P([]), f = le ?? He, [tt, at] = P(1), nt = pe ?? tt, [T, we] = P(Be), [S, it] = P(() => h.reduce((e, a) => (a.width && (e[a.key] = a.width), e), {})), [ge, st] = P(/* @__PURE__ */ new Set()), be = (e) => {
|
|
26
|
+
st((a) => {
|
|
27
|
+
const s = new Set(a);
|
|
28
|
+
return s.has(e) ? s.delete(e) : s.add(e), s;
|
|
29
29
|
});
|
|
30
|
-
}, M = (e, a) =>
|
|
31
|
-
pe === void 0 && at(e),
|
|
30
|
+
}, M = (e, a) => Ve?.(e, a) ?? a, V = (e) => {
|
|
31
|
+
pe === void 0 && at(e), je?.(e);
|
|
32
32
|
}, p = Z !== void 0 ? Z : qe, v = ue ?? Qe, A = (e, a) => {
|
|
33
|
-
Z === void 0 && Je(e), ue === void 0 && Ye(a),
|
|
33
|
+
Z === void 0 && Je(e), ue === void 0 && Ye(a), ze?.({
|
|
34
34
|
key: e,
|
|
35
35
|
direction: a
|
|
36
36
|
}), V(1);
|
|
37
37
|
}, U = L(() => new Set(y ?? []), [y]), W = L(() => {
|
|
38
38
|
let e = I;
|
|
39
39
|
if (p) {
|
|
40
|
-
const n = h.find((
|
|
40
|
+
const n = h.find((i) => i.key === p);
|
|
41
41
|
if (n) {
|
|
42
|
-
const
|
|
42
|
+
const i = n.sortAccessor || n.accessor || ((m) => {
|
|
43
43
|
const u = m[n.key];
|
|
44
44
|
return typeof u == "string" || typeof u == "number" ? u : "";
|
|
45
45
|
}), r = [...I].sort((m, u) => {
|
|
46
|
-
const _ =
|
|
46
|
+
const _ = i(m), d = i(u);
|
|
47
47
|
return typeof _ == "number" && typeof d == "number" ? _ - d : String(_).localeCompare(String(d));
|
|
48
48
|
});
|
|
49
49
|
e = v === "asc" ? r : r.reverse();
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
if (U.size === 0) return e;
|
|
53
|
-
const a = [],
|
|
54
|
-
if (e.forEach((n,
|
|
55
|
-
U.has(M(n,
|
|
53
|
+
const a = [], s = [];
|
|
54
|
+
if (e.forEach((n, i) => {
|
|
55
|
+
U.has(M(n, i)) ? a.push(n) : s.push(n);
|
|
56
56
|
}), y && y.length > 1 && a.length > 1) {
|
|
57
|
-
const n = new Map(y.map((
|
|
58
|
-
a.sort((
|
|
57
|
+
const n = new Map(y.map((i, r) => [i, r]));
|
|
58
|
+
a.sort((i, r) => (n.get(M(i, 0)) ?? 0) - (n.get(M(r, 0)) ?? 0));
|
|
59
59
|
}
|
|
60
|
-
return [...a, ...
|
|
60
|
+
return [...a, ...s];
|
|
61
61
|
}, [
|
|
62
62
|
h,
|
|
63
63
|
I,
|
|
@@ -69,49 +69,49 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
69
69
|
if (!o || j) return W;
|
|
70
70
|
const e = /* @__PURE__ */ new Map(), a = [];
|
|
71
71
|
W.forEach((n) => {
|
|
72
|
-
const
|
|
73
|
-
r ? r.push(n) : (e.set(
|
|
72
|
+
const i = o.groupBy(n), r = e.get(i);
|
|
73
|
+
r ? r.push(n) : (e.set(i, [n]), a.push(i));
|
|
74
74
|
});
|
|
75
|
-
const
|
|
76
|
-
const
|
|
75
|
+
const s = a.map((n) => {
|
|
76
|
+
const i = e.get(n);
|
|
77
77
|
return {
|
|
78
78
|
key: n,
|
|
79
79
|
label: o.groupLabel(n),
|
|
80
|
-
items:
|
|
81
|
-
totalCount:
|
|
80
|
+
items: i,
|
|
81
|
+
totalCount: i.length
|
|
82
82
|
};
|
|
83
83
|
});
|
|
84
|
-
return o.sortGroups ?
|
|
84
|
+
return o.sortGroups ? s.sort(o.sortGroups) : s.sort((n, i) => n.key === null ? 1 : i.key === null ? -1 : 0), s.flatMap((n) => n.items);
|
|
85
85
|
}, [
|
|
86
86
|
o,
|
|
87
87
|
j,
|
|
88
88
|
W
|
|
89
|
-
]), O = j ? ve : x.length, J = Math.max(1, Math.ceil(O / T)), B = Math.min(nt, J), g = j ? x : x.slice((B - 1) * T, B * T), Q =
|
|
89
|
+
]), O = j ? ve : x.length, J = Math.max(1, Math.ceil(O / T)), B = Math.min(nt, J), g = j ? x : x.slice((B - 1) * T, B * T), Q = Oe ? _t(T, O, Xe ?? O, B, Ze) : null, Y = L(() => {
|
|
90
90
|
if (!o) return null;
|
|
91
91
|
const e = /* @__PURE__ */ new Map();
|
|
92
92
|
return x.forEach((a) => {
|
|
93
|
-
const
|
|
94
|
-
e.set(
|
|
93
|
+
const s = o.groupBy(a);
|
|
94
|
+
e.set(s, (e.get(s) ?? 0) + 1);
|
|
95
95
|
}), e;
|
|
96
96
|
}, [o, x]), H = L(() => {
|
|
97
97
|
if (!o || !Y) return null;
|
|
98
98
|
const e = /* @__PURE__ */ new Map(), a = [];
|
|
99
99
|
g.forEach((n) => {
|
|
100
|
-
const
|
|
101
|
-
r ? r.push(n) : (e.set(
|
|
100
|
+
const i = o.groupBy(n), r = e.get(i);
|
|
101
|
+
r ? r.push(n) : (e.set(i, [n]), a.push(i));
|
|
102
102
|
});
|
|
103
|
-
const
|
|
103
|
+
const s = a.map((n) => ({
|
|
104
104
|
key: n,
|
|
105
105
|
label: o.groupLabel(n),
|
|
106
106
|
items: e.get(n),
|
|
107
107
|
totalCount: Y.get(n) ?? 0
|
|
108
108
|
}));
|
|
109
|
-
return o.sortGroups ?
|
|
109
|
+
return o.sortGroups ? s.sort(o.sortGroups) : s.sort((n, i) => n.key === null ? 1 : i.key === null ? -1 : 0), s;
|
|
110
110
|
}, [
|
|
111
111
|
o,
|
|
112
112
|
Y,
|
|
113
113
|
g
|
|
114
|
-
]),
|
|
114
|
+
]), ye = L(() => {
|
|
115
115
|
if (!C) return /* @__PURE__ */ new Map();
|
|
116
116
|
const e = g.map((a) => ({
|
|
117
117
|
id: C.idAccessor(a),
|
|
@@ -119,40 +119,40 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
119
119
|
}));
|
|
120
120
|
return gt(e, C.granularity);
|
|
121
121
|
}, [g, C]), E = (e) => {
|
|
122
|
-
le === void 0 && et(e),
|
|
122
|
+
le === void 0 && et(e), xe?.(I.filter((a, s) => e.includes(M(a, s))));
|
|
123
123
|
}, rt = (e) => {
|
|
124
124
|
e.sortable && (p === e.key ? A(e.key, v === "asc" ? "desc" : "asc") : A(e.key, "asc"));
|
|
125
125
|
}, ot = (e, a) => {
|
|
126
126
|
e.preventDefault();
|
|
127
|
-
const
|
|
128
|
-
const u = m.clientX -
|
|
129
|
-
|
|
127
|
+
const s = e.clientX, n = S[a] ?? 150, i = (m) => {
|
|
128
|
+
const u = m.clientX - s, _ = h.find((d) => d.key === a)?.minWidth ?? 120;
|
|
129
|
+
it((d) => ({
|
|
130
130
|
...d,
|
|
131
131
|
[a]: Math.max(_, n + u)
|
|
132
132
|
}));
|
|
133
133
|
}, r = () => {
|
|
134
|
-
window.removeEventListener("mousemove",
|
|
134
|
+
window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", r);
|
|
135
135
|
};
|
|
136
|
-
window.addEventListener("mousemove",
|
|
137
|
-
},
|
|
136
|
+
window.addEventListener("mousemove", i), window.addEventListener("mouseup", r);
|
|
137
|
+
}, ke = h.some((e) => e.filter), ee = h.filter((e) => e.sortable), lt = ee.map((e) => ({
|
|
138
138
|
label: yt(e),
|
|
139
139
|
value: e.key
|
|
140
|
-
})), ct = ee.length > 0, te = p ? ee.find((e) => e.key === p) : void 0, dt = z?.align ?? "left",
|
|
140
|
+
})), ct = ee.length > 0, te = p ? ee.find((e) => e.key === p) : void 0, dt = z?.align ?? "left", Ce = (z?.columns ?? z?.column ?? []).length > 0 ? /* @__PURE__ */ t(St, {
|
|
141
141
|
columns: h,
|
|
142
142
|
config: z,
|
|
143
143
|
sortKey: p,
|
|
144
144
|
sortDirection: v,
|
|
145
145
|
onSort: A
|
|
146
|
-
}) : null,
|
|
146
|
+
}) : null, Ne = q && q.options.length > 0 ? /* @__PURE__ */ t(Nt, { config: q }) : null, b = g.map(M), ae = b.filter((e) => f.includes(e)).length, ne = !!w && b.length > 0 && ae === b.length, Se = !!w && ae > 0 && ae < b.length, Me = (e) => {
|
|
147
147
|
E(e ? [...f, ...b.filter((a) => !f.includes(a))] : f.filter((a) => !b.includes(a)));
|
|
148
148
|
}, ht = w && b.length > 0 ? /* @__PURE__ */ c("label", {
|
|
149
149
|
className: "data-view__select-all",
|
|
150
150
|
children: [/* @__PURE__ */ t(re, {
|
|
151
151
|
checked: ne,
|
|
152
|
-
indeterminate:
|
|
153
|
-
onChange:
|
|
152
|
+
indeterminate: Se,
|
|
153
|
+
onChange: Me
|
|
154
154
|
}), /* @__PURE__ */ t("span", { children: ne ? "Clear selection" : `Select these ${b.length}` })]
|
|
155
|
-
}) : null,
|
|
155
|
+
}) : null, Pe = (e) => Q || Ce || Ne || e ? /* @__PURE__ */ c("div", {
|
|
156
156
|
className: `data-view__top-row data-view__top-row--mini-${dt}`,
|
|
157
157
|
children: [
|
|
158
158
|
Q && /* @__PURE__ */ t("div", {
|
|
@@ -160,13 +160,13 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
160
160
|
children: Q
|
|
161
161
|
}),
|
|
162
162
|
e,
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
Ce,
|
|
164
|
+
Ne
|
|
165
165
|
]
|
|
166
|
-
}) : null,
|
|
166
|
+
}) : null, $e = Pe();
|
|
167
167
|
if (me !== "cards" && h.length === 0) return /* @__PURE__ */ c("div", {
|
|
168
168
|
className: `data-view${D ? ` ${D}` : ""}`,
|
|
169
|
-
children: [
|
|
169
|
+
children: [$e, /* @__PURE__ */ t("div", {
|
|
170
170
|
className: "data-view__wrapper data-view__wrapper--empty",
|
|
171
171
|
children: /* @__PURE__ */ t(oe, {
|
|
172
172
|
title: "No columns selected",
|
|
@@ -177,8 +177,8 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
177
177
|
if (me === "cards") return /* @__PURE__ */ c("div", {
|
|
178
178
|
className: `data-view data-view--cards${D ? ` ${D}` : ""}`,
|
|
179
179
|
children: [
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
Pe(ht),
|
|
181
|
+
Ue && ct && /* @__PURE__ */ c("div", {
|
|
182
182
|
className: "data-view__card-sort-bar",
|
|
183
183
|
children: [/* @__PURE__ */ t("div", {
|
|
184
184
|
className: "data-view__card-sort-field",
|
|
@@ -199,7 +199,7 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
199
199
|
A(a, p === a ? v : "asc");
|
|
200
200
|
}
|
|
201
201
|
})
|
|
202
|
-
}), /* @__PURE__ */ t(
|
|
202
|
+
}), /* @__PURE__ */ t(Ae, {
|
|
203
203
|
title: v === "asc" ? "Sort descending" : "Sort ascending",
|
|
204
204
|
children: /* @__PURE__ */ t(ft, {
|
|
205
205
|
className: "data-view__card-sort-direction",
|
|
@@ -212,7 +212,7 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
212
212
|
})
|
|
213
213
|
})]
|
|
214
214
|
}),
|
|
215
|
-
|
|
215
|
+
ke && /* @__PURE__ */ t("div", {
|
|
216
216
|
className: "data-view__filter-bar",
|
|
217
217
|
children: h.filter((e) => e.filter).map((e) => /* @__PURE__ */ t("div", {
|
|
218
218
|
className: "data-view__filter-bar-item",
|
|
@@ -223,7 +223,7 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
223
223
|
data: g,
|
|
224
224
|
columns: h,
|
|
225
225
|
rowKey: M,
|
|
226
|
-
card:
|
|
226
|
+
card: Fe,
|
|
227
227
|
actions: k,
|
|
228
228
|
timeline: C,
|
|
229
229
|
onRowClick: R,
|
|
@@ -233,18 +233,18 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
233
233
|
selectable: w,
|
|
234
234
|
selectedIds: f,
|
|
235
235
|
pinnedIds: y,
|
|
236
|
-
cardMaxWidth:
|
|
237
|
-
isMobile:
|
|
236
|
+
cardMaxWidth: We,
|
|
237
|
+
isMobile: _e,
|
|
238
238
|
groups: H ?? void 0,
|
|
239
239
|
showGroupCount: o?.showCount !== !1,
|
|
240
240
|
collapsible: o?.collapsible,
|
|
241
|
-
collapsedGroups:
|
|
242
|
-
onToggleGroup:
|
|
241
|
+
collapsedGroups: ge,
|
|
242
|
+
onToggleGroup: be,
|
|
243
243
|
onToggleSelect: (e, a) => {
|
|
244
|
-
E(a ? [...f, e] : f.filter((
|
|
244
|
+
E(a ? [...f, e] : f.filter((s) => s !== e));
|
|
245
245
|
}
|
|
246
246
|
}),
|
|
247
|
-
/* @__PURE__ */ t(
|
|
247
|
+
/* @__PURE__ */ t(Ee, {
|
|
248
248
|
currentPage: B,
|
|
249
249
|
totalPages: J,
|
|
250
250
|
totalItems: O,
|
|
@@ -252,13 +252,13 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
252
252
|
pageSizeOptions: $ ? ce : void 0,
|
|
253
253
|
pageSize: $ ? T : void 0,
|
|
254
254
|
onPageSizeChange: $ ? (e) => {
|
|
255
|
-
|
|
255
|
+
we(e), V(1), fe?.(e);
|
|
256
256
|
} : void 0
|
|
257
257
|
})
|
|
258
258
|
]
|
|
259
259
|
});
|
|
260
|
-
const F = h.filter((e) => !e.hideInTable), G = C &&
|
|
261
|
-
|
|
260
|
+
const F = h.filter((e) => !e.hideInTable && !(_e && e.hideInMobile)), G = C && ye.size > 0, De = /* @__PURE__ */ c(Mt, { children: [
|
|
261
|
+
$e,
|
|
262
262
|
/* @__PURE__ */ t("div", {
|
|
263
263
|
className: "data-view__wrapper",
|
|
264
264
|
children: /* @__PURE__ */ c("table", { children: [/* @__PURE__ */ c("thead", { children: [/* @__PURE__ */ c("tr", { children: [
|
|
@@ -267,8 +267,8 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
267
267
|
className: "data-view__checkbox",
|
|
268
268
|
children: /* @__PURE__ */ t(re, {
|
|
269
269
|
checked: ne,
|
|
270
|
-
indeterminate:
|
|
271
|
-
onChange:
|
|
270
|
+
indeterminate: Se,
|
|
271
|
+
onChange: Me
|
|
272
272
|
})
|
|
273
273
|
}),
|
|
274
274
|
F.map((e) => {
|
|
@@ -282,8 +282,8 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
282
282
|
children: [Ct(e), e.sortable && /* @__PURE__ */ t(Pt, { state: p === e.key ? v : "unsorted" })]
|
|
283
283
|
}), /* @__PURE__ */ t("span", {
|
|
284
284
|
className: "data-view__resizer",
|
|
285
|
-
onMouseDown: (
|
|
286
|
-
onClick: (
|
|
285
|
+
onMouseDown: (s) => ot(s, e.key),
|
|
286
|
+
onClick: (s) => s.stopPropagation()
|
|
287
287
|
})]
|
|
288
288
|
}, e.key);
|
|
289
289
|
}),
|
|
@@ -292,7 +292,7 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
292
292
|
style: K ? { width: K } : void 0,
|
|
293
293
|
children: "Actions"
|
|
294
294
|
})
|
|
295
|
-
] }),
|
|
295
|
+
] }), ke && /* @__PURE__ */ c("tr", {
|
|
296
296
|
className: "data-view__filter-row",
|
|
297
297
|
children: [
|
|
298
298
|
G && /* @__PURE__ */ t("td", { className: "data-view__filter-cell data-view__filter-cell--spacer" }),
|
|
@@ -316,8 +316,8 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
316
316
|
secondary: N.secondary
|
|
317
317
|
}) : /* @__PURE__ */ t(oe, { title: "No data available" })
|
|
318
318
|
}) });
|
|
319
|
-
const e = F.length + (G ? 1 : 0) + (w ? 1 : 0) + (k ? 1 : 0), a = o?.showCount !== !1,
|
|
320
|
-
const r = M(n,
|
|
319
|
+
const e = F.length + (G ? 1 : 0) + (w ? 1 : 0) + (k ? 1 : 0), a = o?.showCount !== !1, s = (n, i) => {
|
|
320
|
+
const r = M(n, i), m = f.includes(r), u = U.has(r), _ = ye.get(i), d = de?.(n), Te = !!R || !!d, ut = (l) => {
|
|
321
321
|
if (d && (l.metaKey || l.ctrlKey || l.shiftKey)) {
|
|
322
322
|
window.open(d, "_blank", "noopener,noreferrer");
|
|
323
323
|
return;
|
|
@@ -329,10 +329,10 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
329
329
|
d && window.location.assign(d);
|
|
330
330
|
}, mt = (l) => {
|
|
331
331
|
l.button !== 1 || !d || (l.preventDefault(), window.open(d, "_blank", "noopener,noreferrer"));
|
|
332
|
-
},
|
|
333
|
-
return /* @__PURE__ */ c(
|
|
334
|
-
className: `${m ? "is-selected" : ""} ${
|
|
335
|
-
onClick:
|
|
332
|
+
}, ie = Ie?.(n);
|
|
333
|
+
return /* @__PURE__ */ c(Le.Fragment, { children: [/* @__PURE__ */ c("tr", {
|
|
334
|
+
className: `${m ? "is-selected" : ""} ${Te ? "data-view__row--clickable" : ""} ${u ? "data-view__row--pinned" : ""} ${he?.(n) || ""}`,
|
|
335
|
+
onClick: Te ? ut : void 0,
|
|
336
336
|
onAuxClick: d ? mt : void 0,
|
|
337
337
|
children: [
|
|
338
338
|
G && /* @__PURE__ */ t("td", {
|
|
@@ -344,13 +344,13 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
344
344
|
children: /* @__PURE__ */ t(re, {
|
|
345
345
|
checked: m,
|
|
346
346
|
onChange: (l) => {
|
|
347
|
-
E(l ? [...f, r] : f.filter((
|
|
347
|
+
E(l ? [...f, r] : f.filter((se) => se !== r));
|
|
348
348
|
}
|
|
349
349
|
})
|
|
350
350
|
}),
|
|
351
|
-
F.map((l,
|
|
351
|
+
F.map((l, se) => /* @__PURE__ */ c("td", {
|
|
352
352
|
style: S[l.key] ? { width: S[l.key] } : void 0,
|
|
353
|
-
children: [
|
|
353
|
+
children: [se === 0 && u && /* @__PURE__ */ t(Ae, {
|
|
354
354
|
title: "Pinned",
|
|
355
355
|
children: /* @__PURE__ */ t(X, {
|
|
356
356
|
className: "data-view__pin-indicator",
|
|
@@ -369,35 +369,35 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
369
369
|
})
|
|
370
370
|
})
|
|
371
371
|
]
|
|
372
|
-
}),
|
|
372
|
+
}), ie != null && ie !== !1 && /* @__PURE__ */ t("tr", {
|
|
373
373
|
className: "data-view__row-detail",
|
|
374
374
|
children: /* @__PURE__ */ t("td", {
|
|
375
375
|
colSpan: e,
|
|
376
376
|
onClick: (l) => l.stopPropagation(),
|
|
377
|
-
children:
|
|
377
|
+
children: ie
|
|
378
378
|
})
|
|
379
379
|
})] }, r);
|
|
380
380
|
};
|
|
381
381
|
if (H) {
|
|
382
382
|
let n = 0;
|
|
383
|
-
return H.map((
|
|
383
|
+
return H.map((i) => {
|
|
384
384
|
const r = n;
|
|
385
|
-
n +=
|
|
386
|
-
const m = o?.collapsible &&
|
|
387
|
-
return /* @__PURE__ */ c(
|
|
385
|
+
n += i.items.length;
|
|
386
|
+
const m = o?.collapsible && ge.has(i.key);
|
|
387
|
+
return /* @__PURE__ */ c(Le.Fragment, { children: [/* @__PURE__ */ t("tr", {
|
|
388
388
|
className: `data-view__group-row${o?.collapsible ? " data-view__group-row--collapsible" : ""}`,
|
|
389
|
-
onClick: o?.collapsible ? () =>
|
|
389
|
+
onClick: o?.collapsible ? () => be(i.key) : void 0,
|
|
390
390
|
children: /* @__PURE__ */ c("td", {
|
|
391
391
|
colSpan: e,
|
|
392
392
|
className: "data-view__group-cell",
|
|
393
393
|
children: [
|
|
394
394
|
/* @__PURE__ */ t("span", {
|
|
395
395
|
className: "data-view__group-label",
|
|
396
|
-
children:
|
|
396
|
+
children: i.label
|
|
397
397
|
}),
|
|
398
398
|
a && /* @__PURE__ */ t("span", {
|
|
399
399
|
className: "data-view__group-count",
|
|
400
|
-
children:
|
|
400
|
+
children: i.items.length === i.totalCount ? i.totalCount : `${i.items.length} of ${i.totalCount}`
|
|
401
401
|
}),
|
|
402
402
|
o?.collapsible && /* @__PURE__ */ t(X, {
|
|
403
403
|
className: "data-view__group-chevron",
|
|
@@ -406,13 +406,13 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
406
406
|
})
|
|
407
407
|
]
|
|
408
408
|
})
|
|
409
|
-
}), !m &&
|
|
409
|
+
}), !m && i.items.map((u, _) => s(u, r + _))] }, i.key ?? "__null__");
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
|
-
return g.map((n,
|
|
412
|
+
return g.map((n, i) => s(n, i));
|
|
413
413
|
})() })] })
|
|
414
414
|
}),
|
|
415
|
-
/* @__PURE__ */ t(
|
|
415
|
+
/* @__PURE__ */ t(Ee, {
|
|
416
416
|
currentPage: B,
|
|
417
417
|
totalPages: J,
|
|
418
418
|
totalItems: W.length,
|
|
@@ -420,7 +420,7 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
420
420
|
pageSizeOptions: $ ? ce : void 0,
|
|
421
421
|
pageSize: $ ? T : void 0,
|
|
422
422
|
onPageSizeChange: $ ? (e) => {
|
|
423
|
-
|
|
423
|
+
we(e), V(1), fe?.(e);
|
|
424
424
|
} : void 0
|
|
425
425
|
})
|
|
426
426
|
] });
|
|
@@ -428,8 +428,8 @@ function Wt({ columns: h, data: I, rowKey: Le, pinnedIds: y, selectable: w = !1,
|
|
|
428
428
|
className: `data-view${D ? ` ${D}` : ""}`,
|
|
429
429
|
children: G ? /* @__PURE__ */ c("div", {
|
|
430
430
|
className: "timeline-markers",
|
|
431
|
-
children: [/* @__PURE__ */ t("div", { className: "timeline-markers__track" }),
|
|
432
|
-
}) :
|
|
431
|
+
children: [/* @__PURE__ */ t("div", { className: "timeline-markers__track" }), De]
|
|
432
|
+
}) : De
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
435
|
export {
|
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
import './Icon.css';
|
|
2
2
|
/* empty css */
|
|
3
|
-
import "react";
|
|
4
|
-
import {
|
|
5
|
-
import { jsx as
|
|
6
|
-
var
|
|
3
|
+
import { useEffect as g, useState as I } from "react";
|
|
4
|
+
import { canLoadMoreIcons as n, getIcon as y, loadIcon as N } from "@memobit/icons/map";
|
|
5
|
+
import { jsx as $ } from "react/jsx-runtime";
|
|
6
|
+
var c = /* @__PURE__ */ new Set(), a = (o) => {
|
|
7
|
+
c.has(o) || (c.add(o), console.warn(n ? `[@memobit/libs] No icon named "${o}".` : `[@memobit/libs] No icon named "${o}". If this app trims icons with @memobit/icons/vite, add it to the plugin's \`include\` option or use \`lazy\` — a name that only exists at runtime cannot be found by the source scan.`));
|
|
8
|
+
}, S = ({ className: o = "", fade: l, fadeOnHover: d, name: e, pulse: u, pulseOnHover: f, size: r, spin: p, spinOnHover: h, variant: t }) => {
|
|
7
9
|
const m = [
|
|
8
10
|
"icon",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
].filter(Boolean).join(" "),
|
|
19
|
-
return
|
|
11
|
+
r ? `icon--${r}` : "",
|
|
12
|
+
t && t !== "default" ? `icon--${t}` : "",
|
|
13
|
+
p ? "icon--spin" : "",
|
|
14
|
+
l ? "icon--fade" : "",
|
|
15
|
+
u ? "icon--pulse" : "",
|
|
16
|
+
h ? "icon--spin-hover" : "",
|
|
17
|
+
d ? "icon--fade-hover" : "",
|
|
18
|
+
f ? "icon--pulse-hover" : "",
|
|
19
|
+
o
|
|
20
|
+
].filter(Boolean).join(" "), [, v] = I(null), i = y(e);
|
|
21
|
+
return g(() => {
|
|
22
|
+
if (i !== void 0 || !n) return;
|
|
23
|
+
let s = !0;
|
|
24
|
+
return N(e).then((b) => {
|
|
25
|
+
if (s) {
|
|
26
|
+
if (b === void 0) {
|
|
27
|
+
a(e);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
v(e);
|
|
31
|
+
}
|
|
32
|
+
}, () => {
|
|
33
|
+
}), () => {
|
|
34
|
+
s = !1;
|
|
35
|
+
};
|
|
36
|
+
}, [i, e]), i === void 0 && !n && a(e), /* @__PURE__ */ $("span", {
|
|
20
37
|
className: m,
|
|
21
|
-
children:
|
|
38
|
+
children: i
|
|
22
39
|
});
|
|
23
40
|
};
|
|
24
41
|
export {
|
|
25
|
-
|
|
42
|
+
S as Icon
|
|
26
43
|
};
|
|
@@ -1,54 +1,68 @@
|
|
|
1
1
|
import './IconPicker.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { Tooltip as
|
|
4
|
-
import { InputSearch as
|
|
2
|
+
import { Icon as N } from "../Icon/Icon2.js";
|
|
3
|
+
import { Tooltip as v } from "../Tooltip/Tooltip2.js";
|
|
4
|
+
import { InputSearch as y } from "../InputSearch/InputSearch2.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { useMemo as
|
|
7
|
-
import { iconMap as
|
|
8
|
-
import { jsx as c, jsxs as
|
|
9
|
-
import { iconAliases as
|
|
10
|
-
var
|
|
11
|
-
const [
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
import { useEffect as C, useMemo as h, useState as d } from "react";
|
|
7
|
+
import { canLoadMoreIcons as S, iconMap as b, loadAllIcons as j } from "@memobit/icons/map";
|
|
8
|
+
import { jsx as c, jsxs as A } from "react/jsx-runtime";
|
|
9
|
+
import { iconAliases as L } from "@memobit/icons";
|
|
10
|
+
var T = S ? null : Object.keys(b), q = ({ color: a, emptyLabel: u = "No icons match", icons: o, onChange: f, placeholder: _ = "Search icons...", value: g }) => {
|
|
11
|
+
const [s, k] = d(""), [r, I] = d(T);
|
|
12
|
+
C(() => {
|
|
13
|
+
if (r || o) return;
|
|
14
|
+
let e = !0;
|
|
15
|
+
return j().then((l) => {
|
|
16
|
+
e && I(Object.keys(l));
|
|
17
|
+
}, () => {
|
|
18
|
+
}), () => {
|
|
19
|
+
e = !1;
|
|
20
|
+
};
|
|
21
|
+
}, [r, o]);
|
|
22
|
+
const t = h(() => o ?? r ?? [], [r, o]), p = !o && !r, n = h(() => {
|
|
23
|
+
const e = s.trim().toLowerCase();
|
|
24
|
+
if (!e) return t;
|
|
25
|
+
const l = e.replace(/[\s-]+/g, ""), m = (i) => i.includes(e) || i.replace(/-/g, "").includes(l);
|
|
26
|
+
return t.filter((i) => m(i) || (L[i] ?? []).some(m));
|
|
27
|
+
}, [t, s]);
|
|
28
|
+
return /* @__PURE__ */ A("div", {
|
|
18
29
|
className: "icon-picker",
|
|
19
30
|
children: [
|
|
20
31
|
/* @__PURE__ */ c("div", {
|
|
21
32
|
className: "icon-picker__search",
|
|
22
|
-
children: /* @__PURE__ */ c(
|
|
33
|
+
children: /* @__PURE__ */ c(y, {
|
|
23
34
|
autoFocus: !0,
|
|
24
|
-
onChange:
|
|
25
|
-
placeholder:
|
|
26
|
-
value:
|
|
35
|
+
onChange: k,
|
|
36
|
+
placeholder: _,
|
|
37
|
+
value: s
|
|
27
38
|
})
|
|
28
39
|
}),
|
|
29
40
|
/* @__PURE__ */ c("div", {
|
|
30
41
|
className: "icon-picker__grid",
|
|
31
|
-
children:
|
|
42
|
+
children: p ? /* @__PURE__ */ c("p", {
|
|
32
43
|
className: "icon-picker__empty",
|
|
33
|
-
children:
|
|
34
|
-
}) :
|
|
44
|
+
children: "Loading icons..."
|
|
45
|
+
}) : n.length === 0 ? /* @__PURE__ */ c("p", {
|
|
46
|
+
className: "icon-picker__empty",
|
|
47
|
+
children: u
|
|
48
|
+
}) : n.map((e) => /* @__PURE__ */ c(v, {
|
|
35
49
|
title: e,
|
|
36
50
|
children: /* @__PURE__ */ c("button", {
|
|
37
|
-
className: `icon-picker__icon${
|
|
38
|
-
onClick: () =>
|
|
39
|
-
style:
|
|
51
|
+
className: `icon-picker__icon${g === e ? " is-selected" : ""}`,
|
|
52
|
+
onClick: () => f?.(e),
|
|
53
|
+
style: a ? { color: a } : void 0,
|
|
40
54
|
type: "button",
|
|
41
|
-
children: /* @__PURE__ */ c(
|
|
55
|
+
children: /* @__PURE__ */ c(N, { name: e })
|
|
42
56
|
})
|
|
43
57
|
}, e))
|
|
44
58
|
}),
|
|
45
|
-
/* @__PURE__ */ c("p", {
|
|
59
|
+
!p && /* @__PURE__ */ c("p", {
|
|
46
60
|
className: "icon-picker__count",
|
|
47
|
-
children:
|
|
61
|
+
children: n.length === t.length ? `${t.length} icons` : `${n.length} of ${t.length}`
|
|
48
62
|
})
|
|
49
63
|
]
|
|
50
64
|
});
|
|
51
65
|
};
|
|
52
66
|
export {
|
|
53
|
-
|
|
67
|
+
q as IconPicker
|
|
54
68
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1072,7 +1072,7 @@ export declare interface DataViewColumn<T> {
|
|
|
1072
1072
|
minWidth?: number;
|
|
1073
1073
|
hideInCard?: boolean;
|
|
1074
1074
|
hideInTable?: boolean;
|
|
1075
|
-
/** Hide this column only on mobile breakpoint (not when cards are used on desktop). */
|
|
1075
|
+
/** Hide this column only on mobile breakpoint, in both table and card views (not when cards are used on desktop). */
|
|
1076
1076
|
hideInMobile?: boolean;
|
|
1077
1077
|
}
|
|
1078
1078
|
|
package/dist/version.js
CHANGED
package/dist/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memobit/libs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "React component library powering the Memobit apps — 100+ components, helpers and hooks. Icons ship as @memobit/icons and themes as @memobit/themes. TypeScript-first, ESM-only, React 19.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css}\""
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
|
-
"@memobit/icons": "^1.
|
|
83
|
+
"@memobit/icons": "^1.5.0",
|
|
84
84
|
"@memobit/themes": "^1.0.0",
|
|
85
85
|
"react": "19.3.0",
|
|
86
86
|
"react-dom": "19.3.0",
|
|
@@ -121,6 +121,9 @@
|
|
|
121
121
|
"vite-plugin-static-copy": "4.1.1"
|
|
122
122
|
},
|
|
123
123
|
"overrides": {
|
|
124
|
+
"@rushstack/ts-command-line": {
|
|
125
|
+
"argparse": "2.0.1"
|
|
126
|
+
},
|
|
124
127
|
"brace-expansion@1": "1.1.21",
|
|
125
128
|
"brace-expansion@5": "5.0.12",
|
|
126
129
|
"esbuild": "0.28.2",
|
|
@@ -131,6 +134,9 @@
|
|
|
131
134
|
"nanoid@3": "3.3.18",
|
|
132
135
|
"picomatch@2": "2.3.2",
|
|
133
136
|
"postcss": "8.5.28",
|
|
134
|
-
"source-map-js": "1.2.2"
|
|
137
|
+
"source-map-js": "1.2.2",
|
|
138
|
+
"vite-plugin-static-copy": {
|
|
139
|
+
"chokidar": "5.0.0"
|
|
140
|
+
}
|
|
135
141
|
}
|
|
136
142
|
}
|