@mittwald/flow-react-components 0.1.0-alpha.179 → 0.1.0-alpha.180
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/List.js +132 -130
- package/dist/types/components/List/model/filter/Filter.d.ts +1 -1
- package/dist/types/components/List/model/filter/types.d.ts +2 -3
- package/dist/types/components/List/model/types.d.ts +1 -1
- package/dist/types/components/List/setupComponents/ListFilter.d.ts +4 -4
- package/dist/types/components/List/typedList.d.ts +243 -1
- package/dist/types/components/List/typedList.test-types.d.ts +1 -0
- package/package.json +5 -4
package/dist/List.js
CHANGED
|
@@ -7,49 +7,49 @@ import n, { createContext as ht, useContext as gt, createElement as W, useState
|
|
|
7
7
|
import "./propsContext-DzAKlmhS.js";
|
|
8
8
|
import { P as St } from "./PropsContextProvider-C6Z4XGp6.js";
|
|
9
9
|
import "@react-aria/utils";
|
|
10
|
-
import {
|
|
11
|
-
import { d as
|
|
10
|
+
import { unique as vt, times as yt } from "remeda";
|
|
11
|
+
import { d as wt } from "./dynamic-ClpUSmEt.js";
|
|
12
12
|
import { B as f } from "./Button-BRmT11B1.js";
|
|
13
13
|
import "@tabler/icons-react";
|
|
14
14
|
import "./Icon-BCN5qdXA.js";
|
|
15
|
-
import { I as
|
|
15
|
+
import { I as Et } from "./IconContextMenu-Cy6_2TgT.js";
|
|
16
16
|
import { a as x, C as Y } from "./ContextMenuTrigger-DuiGa0Zj.js";
|
|
17
17
|
import { M as Q } from "./MenuItem-Cb7EDu-b.js";
|
|
18
18
|
import { useLocalizedStringFormatter as b } from "react-aria";
|
|
19
|
-
import { TunnelProvider as
|
|
19
|
+
import { TunnelProvider as Ct, TunnelExit as $ } from "@mittwald/react-tunnel";
|
|
20
20
|
import C from "clsx";
|
|
21
|
-
import { g as
|
|
22
|
-
import { f as
|
|
23
|
-
import { R as
|
|
21
|
+
import { g as Ft } from "./getContainerBreakpointSizeClassName-BrcFDcCY.js";
|
|
22
|
+
import { f as Lt } from "./flowComponent-CwV0a4FM.js";
|
|
23
|
+
import { R as Tt } from "./Render-BdlTa7Qb.js";
|
|
24
24
|
import { T as S } from "./Text-SLaOJhzj.js";
|
|
25
25
|
import { I as X } from "./IconChevronDown-d3q78pVs.js";
|
|
26
26
|
import { I as Z } from "./IconClose-9DrWhSP2.js";
|
|
27
|
-
import { T as
|
|
28
|
-
import { autorun as
|
|
27
|
+
import { T as It } from "./TextField-DhdMjRzb.js";
|
|
28
|
+
import { autorun as At, runInAction as kt, makeObservable as Vt, observable as O, computed as H, action as L } from "mobx";
|
|
29
29
|
import "./context-BB3_MApL.js";
|
|
30
|
-
import { u as
|
|
31
|
-
import { getProperty as
|
|
32
|
-
import { useReactTable as
|
|
30
|
+
import { u as xt } from "./useOnChange-C1Quwyuz.js";
|
|
31
|
+
import { getProperty as Pt } from "dot-prop";
|
|
32
|
+
import { useReactTable as Bt, getCoreRowModel as Dt, getSortedRowModel as Nt, getFilteredRowModel as Rt, getPaginationRowModel as zt, getFacetedUniqueValues as Mt } from "@tanstack/react-table";
|
|
33
33
|
import _ from "invariant";
|
|
34
|
-
import { useLocalObservable as
|
|
35
|
-
import { getAsyncResource as
|
|
36
|
-
import { u as
|
|
34
|
+
import { useLocalObservable as Ut } from "mobx-react-lite";
|
|
35
|
+
import { getAsyncResource as q } from "@mittwald/react-use-promise";
|
|
36
|
+
import { u as G } from "./useSelector-DpU7_HMO.js";
|
|
37
37
|
import * as P from "react-aria-components";
|
|
38
|
-
import { I as
|
|
39
|
-
import { I as
|
|
38
|
+
import { I as $t } from "./IllustratedMessage-B3MHD01M.js";
|
|
39
|
+
import { I as Ot } from "./IconSearch-Bxe-heXD.js";
|
|
40
40
|
import { H as tt } from "./Heading-1M1gRZfk.js";
|
|
41
41
|
import { S as I } from "./Skeleton-CgOx_15R.js";
|
|
42
|
-
import { d as y, a as
|
|
43
|
-
import { ListLoaderAsyncResource as
|
|
44
|
-
const Gt = "flow--list--items--item--view", Kt = "flow--list--items--item--view--title",
|
|
42
|
+
import { d as y, a as K } from "./deepFindOfType-6pG0fH7S.js";
|
|
43
|
+
import { ListLoaderAsyncResource as Ht, TypedListLoaderAsyncResource as qt } from "./List/ListLoaderAsyncResource.js";
|
|
44
|
+
const Gt = "flow--list--items--item--view", Kt = "flow--list--items--item--view--title", jt = "flow--list--items--item--view--top-content", Jt = "flow--list--items--item--view--content", Wt = "flow--list--items--item--view--action", Yt = "flow--list--items--item--view--avatar", Qt = "flow--list--items--item--view--text", Xt = "flow--list--items--item--view--heading", d = {
|
|
45
45
|
view: Gt,
|
|
46
46
|
title: Kt,
|
|
47
|
-
topContent:
|
|
48
|
-
content:
|
|
49
|
-
action:
|
|
50
|
-
avatar:
|
|
51
|
-
text:
|
|
52
|
-
heading:
|
|
47
|
+
topContent: jt,
|
|
48
|
+
content: Jt,
|
|
49
|
+
action: Wt,
|
|
50
|
+
avatar: Yt,
|
|
51
|
+
text: Qt,
|
|
52
|
+
heading: Xt,
|
|
53
53
|
"container-breakpoint-size-xs": "flow--list--items--item--view--container-breakpoint-size-xs",
|
|
54
54
|
"container-breakpoint-size-s": "flow--list--items--item--view--container-breakpoint-size-s",
|
|
55
55
|
"container-breakpoint-size-m": "flow--list--items--item--view--container-breakpoint-size-m",
|
|
@@ -75,7 +75,7 @@ const Gt = "flow--list--items--item--view", Kt = "flow--list--items--item--view-
|
|
|
75
75
|
"list.setSorting": (i) => `Sorting: ${i.property}`,
|
|
76
76
|
"list.showMore": "Show more",
|
|
77
77
|
"list.sorting": "Sorting"
|
|
78
|
-
} },
|
|
78
|
+
} }, Zt = (i) => {
|
|
79
79
|
const { className: t, children: e } = i, a = b(g);
|
|
80
80
|
return /* @__PURE__ */ n.createElement(x, null, /* @__PURE__ */ n.createElement(
|
|
81
81
|
f,
|
|
@@ -84,19 +84,19 @@ const Gt = "flow--list--items--item--view", Kt = "flow--list--items--item--view-
|
|
|
84
84
|
className: t,
|
|
85
85
|
"aria-label": a.format("list.options")
|
|
86
86
|
},
|
|
87
|
-
/* @__PURE__ */ n.createElement(
|
|
87
|
+
/* @__PURE__ */ n.createElement(Et, null)
|
|
88
88
|
), e);
|
|
89
|
-
},
|
|
89
|
+
}, _t = (i) => i === "top" ? d.topContent : i === "bottom" ? d.content : d.topContent, et = (i) => {
|
|
90
90
|
const { children: t, className: e, containerBreakpointSize: a = "m" } = i, s = {
|
|
91
91
|
ContextMenu: {
|
|
92
|
-
wrapWith: /* @__PURE__ */ n.createElement(
|
|
92
|
+
wrapWith: /* @__PURE__ */ n.createElement(Zt, { className: d.action }),
|
|
93
93
|
placement: "bottom end"
|
|
94
94
|
},
|
|
95
95
|
Button: {
|
|
96
96
|
className: d.action
|
|
97
97
|
},
|
|
98
98
|
Content: {
|
|
99
|
-
className:
|
|
99
|
+
className: wt((l) => _t(l.slot)),
|
|
100
100
|
tunnelId: "topContent"
|
|
101
101
|
},
|
|
102
102
|
Avatar: {
|
|
@@ -118,19 +118,19 @@ const Gt = "flow--list--items--item--view", Kt = "flow--list--items--item--view-
|
|
|
118
118
|
}, o = C(
|
|
119
119
|
d.view,
|
|
120
120
|
e,
|
|
121
|
-
d[
|
|
121
|
+
d[Ft(a)]
|
|
122
122
|
);
|
|
123
|
-
return /* @__PURE__ */ n.createElement("div", { className: o }, /* @__PURE__ */ n.createElement(St, { props: s }, /* @__PURE__ */ n.createElement(
|
|
124
|
-
}, at = ht({}), h = () => gt(at).list,
|
|
123
|
+
return /* @__PURE__ */ n.createElement("div", { className: o }, /* @__PURE__ */ n.createElement(St, { props: s }, /* @__PURE__ */ n.createElement(Ct, null, t, /* @__PURE__ */ n.createElement("div", { className: d.title }, /* @__PURE__ */ n.createElement($, { id: "title" })), /* @__PURE__ */ n.createElement($, { id: "topContent" }))));
|
|
124
|
+
}, at = ht({}), h = () => gt(at).list, te = () => h().loader.getLoaderInvocationHooks().map((t, e) => /* @__PURE__ */ n.createElement(Tt, { key: e }, () => {
|
|
125
125
|
t();
|
|
126
|
-
})),
|
|
126
|
+
})), ee = (i) => {
|
|
127
127
|
const { sorting: t } = i;
|
|
128
128
|
return /* @__PURE__ */ n.createElement(Q, { id: t.id }, t.name);
|
|
129
129
|
}, A = (i) => {
|
|
130
130
|
const { children: t, locales: e, variables: a } = i;
|
|
131
131
|
return b(e).format(t, a);
|
|
132
|
-
},
|
|
133
|
-
const i = h(), t = i.sorting.map((s) => /* @__PURE__ */ n.createElement(
|
|
132
|
+
}, ae = () => {
|
|
133
|
+
const i = h(), t = i.sorting.map((s) => /* @__PURE__ */ n.createElement(ee, { sorting: s, key: s.id }));
|
|
134
134
|
if (i.sorting.length === 0)
|
|
135
135
|
return null;
|
|
136
136
|
const e = i.sorting.find((s) => s.isSorted()), a = /* @__PURE__ */ n.createElement(S, null, e ? /* @__PURE__ */ n.createElement(
|
|
@@ -154,7 +154,7 @@ const Gt = "flow--list--items--item--view", Kt = "flow--list--items--item--view-
|
|
|
154
154
|
},
|
|
155
155
|
t
|
|
156
156
|
));
|
|
157
|
-
},
|
|
157
|
+
}, se = (i) => {
|
|
158
158
|
const { filter: t } = i, { values: e, mode: a, name: s, property: o } = t, l = e.map((u) => /* @__PURE__ */ n.createElement(Q, { key: t.getValueId(u), id: String(u) }, String(u))), c = e.filter((u) => t.isValueActive(u)).map((u) => String(u)), m = (u) => {
|
|
159
159
|
t.toggleValue(u);
|
|
160
160
|
};
|
|
@@ -167,15 +167,15 @@ const Gt = "flow--list--items--item--view", Kt = "flow--list--items--item--view-
|
|
|
167
167
|
},
|
|
168
168
|
l
|
|
169
169
|
));
|
|
170
|
-
},
|
|
171
|
-
header:
|
|
172
|
-
pickerListAndSearch:
|
|
173
|
-
pickerList:
|
|
174
|
-
searchField:
|
|
175
|
-
},
|
|
176
|
-
activeFilters:
|
|
177
|
-
clearButton:
|
|
178
|
-
},
|
|
170
|
+
}, ie = "flow--list--header", ne = "flow--list--header--picker-list-and-search", re = "flow--list--header--picker-list", oe = "flow--list--header--search-field", w = {
|
|
171
|
+
header: ie,
|
|
172
|
+
pickerListAndSearch: ne,
|
|
173
|
+
pickerList: re,
|
|
174
|
+
searchField: oe
|
|
175
|
+
}, le = "flow--list--header--active-filters", ce = "flow--list--header--active-filters--clear-button", j = {
|
|
176
|
+
activeFilters: le,
|
|
177
|
+
clearButton: ce
|
|
178
|
+
}, ue = () => {
|
|
179
179
|
const i = h(), t = i.filters.flatMap(
|
|
180
180
|
(e) => e.values.filter((a) => e.isValueActive(a)).map((a) => /* @__PURE__ */ n.createElement(
|
|
181
181
|
f,
|
|
@@ -199,9 +199,9 @@ const Gt = "flow--list--items--item--view", Kt = "flow--list--items--item--view-
|
|
|
199
199
|
},
|
|
200
200
|
/* @__PURE__ */ n.createElement(A, { locales: g }, "list.resetAll")
|
|
201
201
|
));
|
|
202
|
-
},
|
|
202
|
+
}, me = (i) => {
|
|
203
203
|
const { className: t, onChange: e, value: a, ...s } = i, o = b(g), [l, c] = pt(a ?? "");
|
|
204
|
-
|
|
204
|
+
xt(a, () => {
|
|
205
205
|
c(a ?? "");
|
|
206
206
|
}, [l]);
|
|
207
207
|
const m = o.format("list.search"), u = () => {
|
|
@@ -210,7 +210,7 @@ const Gt = "flow--list--items--item--view", Kt = "flow--list--items--item--view-
|
|
|
210
210
|
p.key === "Enter" ? l.trim() === "" ? e(void 0) : e(l) : p.key === "Escape" && u();
|
|
211
211
|
};
|
|
212
212
|
return /* @__PURE__ */ n.createElement("div", { className: t }, /* @__PURE__ */ n.createElement(
|
|
213
|
-
|
|
213
|
+
It,
|
|
214
214
|
{
|
|
215
215
|
style: { flexGrow: "1" },
|
|
216
216
|
"aria-label": m,
|
|
@@ -231,21 +231,21 @@ const Gt = "flow--list--items--item--view", Kt = "flow--list--items--item--view-
|
|
|
231
231
|
},
|
|
232
232
|
/* @__PURE__ */ n.createElement(Z, null)
|
|
233
233
|
));
|
|
234
|
-
},
|
|
235
|
-
const { className: t, search: e } = i, a = e.render ??
|
|
234
|
+
}, de = (i) => {
|
|
235
|
+
const { className: t, search: e } = i, a = e.render ?? me;
|
|
236
236
|
return W(a, {
|
|
237
237
|
className: t,
|
|
238
238
|
value: e.value,
|
|
239
239
|
onChange: e.setValue.bind(e),
|
|
240
240
|
...e.textFieldProps
|
|
241
241
|
});
|
|
242
|
-
},
|
|
243
|
-
const { className: t } = i, e = h(), a = e.filters.map((s) => /* @__PURE__ */ n.createElement(
|
|
244
|
-
return /* @__PURE__ */ n.createElement("div", { className: C(t, w.header) }, /* @__PURE__ */ n.createElement("div", { className: w.pickerListAndSearch }, /* @__PURE__ */ n.createElement("div", { className: w.pickerList }, /* @__PURE__ */ n.createElement(
|
|
245
|
-
},
|
|
246
|
-
list:
|
|
242
|
+
}, he = (i) => {
|
|
243
|
+
const { className: t } = i, e = h(), a = e.filters.map((s) => /* @__PURE__ */ n.createElement(se, { key: s.property, filter: s }));
|
|
244
|
+
return /* @__PURE__ */ n.createElement("div", { className: C(t, w.header) }, /* @__PURE__ */ n.createElement("div", { className: w.pickerListAndSearch }, /* @__PURE__ */ n.createElement("div", { className: w.pickerList }, /* @__PURE__ */ n.createElement(ae, null), a), e.search && /* @__PURE__ */ n.createElement(de, { className: w.searchField, search: e.search })), /* @__PURE__ */ n.createElement(ue, null));
|
|
245
|
+
}, ge = "flow--list", pe = {
|
|
246
|
+
list: ge
|
|
247
247
|
};
|
|
248
|
-
let
|
|
248
|
+
let fe = class st {
|
|
249
249
|
constructor(t, e, a) {
|
|
250
250
|
r(this, "id");
|
|
251
251
|
r(this, "data");
|
|
@@ -256,16 +256,16 @@ let pe = class st {
|
|
|
256
256
|
return new st(t, e.id, e.original);
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
|
-
class
|
|
259
|
+
class be {
|
|
260
260
|
constructor(t) {
|
|
261
261
|
r(this, "list");
|
|
262
262
|
this.list = t;
|
|
263
263
|
}
|
|
264
264
|
get entries() {
|
|
265
|
-
return this.list.reactTable.table.getRowModel().rows.map((t) =>
|
|
265
|
+
return this.list.reactTable.table.getRowModel().rows.map((t) => fe.fromRow(this, t));
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
class
|
|
268
|
+
class Se {
|
|
269
269
|
constructor(t, e = {}) {
|
|
270
270
|
r(this, "batchSize");
|
|
271
271
|
r(this, "list");
|
|
@@ -312,8 +312,8 @@ class be {
|
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
const
|
|
316
|
-
class
|
|
315
|
+
const ve = (i, t) => i === t;
|
|
316
|
+
class ye {
|
|
317
317
|
constructor(t, e) {
|
|
318
318
|
r(this, "_values");
|
|
319
319
|
r(this, "list");
|
|
@@ -322,14 +322,14 @@ class ve {
|
|
|
322
322
|
r(this, "matcher");
|
|
323
323
|
r(this, "name");
|
|
324
324
|
r(this, "onFilterUpdateCallbacks", /* @__PURE__ */ new Set());
|
|
325
|
-
this.list = t, this.property = e.property, this.mode = e.mode ?? "one", this._values = e.values, this.matcher = e.matcher ??
|
|
325
|
+
this.list = t, this.property = e.property, this.mode = e.mode ?? "one", this._values = e.values, this.matcher = e.matcher ?? ve, this.name = e.name;
|
|
326
326
|
}
|
|
327
327
|
updateTableColumnDef(t) {
|
|
328
328
|
t.enableColumnFilter = !0, t.filterFn = this.getReactTableFilterFn();
|
|
329
329
|
}
|
|
330
330
|
getReactTableFilterFn() {
|
|
331
331
|
return (t, e, a) => this.checkFilterMatches(
|
|
332
|
-
|
|
332
|
+
Pt(t.original, this.property),
|
|
333
333
|
a
|
|
334
334
|
);
|
|
335
335
|
}
|
|
@@ -360,7 +360,9 @@ class ve {
|
|
|
360
360
|
return `${this.property}@@${String(t)}`;
|
|
361
361
|
}
|
|
362
362
|
get values() {
|
|
363
|
-
return this._values
|
|
363
|
+
return this._values === void 0 && (this._values = vt(
|
|
364
|
+
Array.from(this.getTableColumn().getFacetedUniqueValues().keys()).flatMap((t) => t).filter((t) => t != null)
|
|
365
|
+
)), this._values;
|
|
364
366
|
}
|
|
365
367
|
getArrayValue() {
|
|
366
368
|
const t = this.getValue();
|
|
@@ -395,7 +397,7 @@ class ve {
|
|
|
395
397
|
this.onFilterUpdateCallbacks.add(t);
|
|
396
398
|
}
|
|
397
399
|
}
|
|
398
|
-
class
|
|
400
|
+
class we {
|
|
399
401
|
constructor(t, e) {
|
|
400
402
|
r(this, "list");
|
|
401
403
|
r(this, "property");
|
|
@@ -423,7 +425,7 @@ class ye {
|
|
|
423
425
|
return `${this.getTableColumn().id}:${this.direction}`;
|
|
424
426
|
}
|
|
425
427
|
}
|
|
426
|
-
const
|
|
428
|
+
const Ee = (i) => T(At(i));
|
|
427
429
|
class B {
|
|
428
430
|
constructor(t, e = {}) {
|
|
429
431
|
r(this, "list");
|
|
@@ -434,17 +436,17 @@ class B {
|
|
|
434
436
|
if (!e)
|
|
435
437
|
return;
|
|
436
438
|
const a = typeof t == "function" ? t(e) : t;
|
|
437
|
-
|
|
439
|
+
kt(() => {
|
|
438
440
|
this.tableState.value = this.getUpdatedTableState(e, a);
|
|
439
441
|
});
|
|
440
442
|
});
|
|
441
|
-
this.list = t, this.tableState =
|
|
443
|
+
this.list = t, this.tableState = Ut(() => ({ value: void 0 })), this.table = this.useReactTable(e);
|
|
442
444
|
}
|
|
443
445
|
static useNew(t, e = {}) {
|
|
444
446
|
return new B(t, e);
|
|
445
447
|
}
|
|
446
448
|
useReactTable(t = {}) {
|
|
447
|
-
const e = this.list.loader.useData(), a = this.list.sorting.filter((o) => o.defaultEnabled), s =
|
|
449
|
+
const e = this.list.loader.useData(), a = this.list.sorting.filter((o) => o.defaultEnabled), s = Bt({
|
|
448
450
|
data: e,
|
|
449
451
|
initialState: {
|
|
450
452
|
pagination: {
|
|
@@ -456,11 +458,11 @@ class B {
|
|
|
456
458
|
}))
|
|
457
459
|
},
|
|
458
460
|
columns: this.getTableColumnDefs(),
|
|
459
|
-
getCoreRowModel:
|
|
460
|
-
getSortedRowModel:
|
|
461
|
-
getFilteredRowModel:
|
|
462
|
-
getPaginationRowModel:
|
|
463
|
-
getFacetedUniqueValues:
|
|
461
|
+
getCoreRowModel: Dt(),
|
|
462
|
+
getSortedRowModel: Nt(),
|
|
463
|
+
getFilteredRowModel: Rt(),
|
|
464
|
+
getPaginationRowModel: zt(),
|
|
465
|
+
getFacetedUniqueValues: Mt(),
|
|
464
466
|
onStateChange: this.onTableStateChange,
|
|
465
467
|
globalFilterFn: "auto",
|
|
466
468
|
...t
|
|
@@ -468,7 +470,7 @@ class B {
|
|
|
468
470
|
return this.useUpdateTableState(s), s;
|
|
469
471
|
}
|
|
470
472
|
useUpdateTableState(t) {
|
|
471
|
-
|
|
473
|
+
Ee(() => {
|
|
472
474
|
const e = this.tableState.value;
|
|
473
475
|
e ? t.setOptions((a) => ({
|
|
474
476
|
...a,
|
|
@@ -512,7 +514,7 @@ class D {
|
|
|
512
514
|
r(this, "dataBatches", []);
|
|
513
515
|
r(this, "prevDataBatches", []);
|
|
514
516
|
r(this, "batchLoadingStates", ["void"]);
|
|
515
|
-
|
|
517
|
+
Vt(this, {
|
|
516
518
|
dataBatches: O.shallow,
|
|
517
519
|
batchLoadingStates: O.shallow,
|
|
518
520
|
mergedData: H,
|
|
@@ -538,16 +540,16 @@ class D {
|
|
|
538
540
|
return (this.dataBatches.length === 0 ? this.prevDataBatches : this.dataBatches).flatMap((e) => e);
|
|
539
541
|
}
|
|
540
542
|
useMergedData() {
|
|
541
|
-
return
|
|
543
|
+
return G(() => this.mergedData);
|
|
542
544
|
}
|
|
543
545
|
get isLoading() {
|
|
544
546
|
return this.batchLoadingStates.some((t) => t === "loading" || t === "void");
|
|
545
547
|
}
|
|
546
548
|
useIsLoading() {
|
|
547
|
-
return
|
|
549
|
+
return G(() => this.isLoading);
|
|
548
550
|
}
|
|
549
551
|
}
|
|
550
|
-
const
|
|
552
|
+
const Ce = [];
|
|
551
553
|
class N {
|
|
552
554
|
constructor(t, e = {}) {
|
|
553
555
|
r(this, "list");
|
|
@@ -558,7 +560,7 @@ class N {
|
|
|
558
560
|
r(this, "loaderState");
|
|
559
561
|
var c;
|
|
560
562
|
const { source: a } = e;
|
|
561
|
-
this.dataSource = a ?? { staticData:
|
|
563
|
+
this.dataSource = a ?? { staticData: Ce };
|
|
562
564
|
const s = "manualPagination" in this.dataSource ? this.dataSource.manualPagination : void 0, o = "manualFiltering" in this.dataSource ? this.dataSource.manualFiltering : void 0, l = "manualSorting" in this.dataSource ? this.dataSource.manualSorting : void 0;
|
|
563
565
|
this.list = t, this.loaderState = D.useNew(), this.manualPagination = s ?? !1, this.manualFiltering = o ?? this.manualPagination, this.manualSorting = l ?? this.manualPagination, this.list.filters.forEach((m) => m.onFilterUpdated(() => this.reset())), (c = this.list.search) == null || c.onUpdated(() => this.reset());
|
|
564
566
|
}
|
|
@@ -578,7 +580,7 @@ class N {
|
|
|
578
580
|
return this.loaderState.useMergedData();
|
|
579
581
|
}
|
|
580
582
|
getLoaderInvocationHooks() {
|
|
581
|
-
return
|
|
583
|
+
return yt(this.list.batches.getBatchIndex() + 1, (e) => e).map((e) => () => {
|
|
582
584
|
this.useLoadBatch(e);
|
|
583
585
|
});
|
|
584
586
|
}
|
|
@@ -626,7 +628,7 @@ class N {
|
|
|
626
628
|
getBatchDataAsyncResource(t) {
|
|
627
629
|
const e = this.dataSource, a = this.getDataLoaderOptions(t);
|
|
628
630
|
if ("staticData" in e)
|
|
629
|
-
return
|
|
631
|
+
return q(
|
|
630
632
|
async (s) => ({
|
|
631
633
|
data: s,
|
|
632
634
|
itemTotalCount: s.length
|
|
@@ -635,7 +637,7 @@ class N {
|
|
|
635
637
|
);
|
|
636
638
|
if ("asyncLoader" in e) {
|
|
637
639
|
const s = e.asyncLoader;
|
|
638
|
-
return
|
|
640
|
+
return q(s, [a]);
|
|
639
641
|
}
|
|
640
642
|
if ("asyncResourceFactory" in e) {
|
|
641
643
|
const s = e.asyncResourceFactory;
|
|
@@ -644,7 +646,7 @@ class N {
|
|
|
644
646
|
throw new Error("Unknown data source");
|
|
645
647
|
}
|
|
646
648
|
}
|
|
647
|
-
class
|
|
649
|
+
class Fe {
|
|
648
650
|
constructor(t, e) {
|
|
649
651
|
r(this, "list");
|
|
650
652
|
r(this, "render");
|
|
@@ -684,7 +686,7 @@ const E = class E {
|
|
|
684
686
|
}
|
|
685
687
|
};
|
|
686
688
|
r(E, "fallbackRenderItemFn", (t) => W("pre", void 0, JSON.stringify(t)));
|
|
687
|
-
let k = E,
|
|
689
|
+
let k = E, Le = class it {
|
|
688
690
|
constructor(t) {
|
|
689
691
|
r(this, "filters");
|
|
690
692
|
r(this, "itemView");
|
|
@@ -702,7 +704,7 @@ let k = E, Fe = class it {
|
|
|
702
704
|
batchesController: o,
|
|
703
705
|
hasAction: l
|
|
704
706
|
} = t;
|
|
705
|
-
this.items = new
|
|
707
|
+
this.items = new be(this), this.filters = a.map((c) => new ye(this, c)), this.sorting = s.map((c) => new we(this, c)), this.search = t.search ? new Fe(this, t.search) : void 0, this.itemView = new k(this, e), this.batches = new Se(this, o), this.loader = N.useNew(this, t.loader), this.reactTable = B.useNew(this, {
|
|
706
708
|
manualFiltering: this.loader.manualFiltering,
|
|
707
709
|
manualPagination: this.loader.manualPagination,
|
|
708
710
|
manualSorting: this.loader.manualSorting
|
|
@@ -729,13 +731,13 @@ let k = E, Fe = class it {
|
|
|
729
731
|
return !this.loader.useIsLoading() && this.items.entries.length === 0;
|
|
730
732
|
}
|
|
731
733
|
};
|
|
732
|
-
const
|
|
733
|
-
items:
|
|
734
|
-
isLoading:
|
|
735
|
-
},
|
|
736
|
-
item:
|
|
737
|
-
hasAction:
|
|
738
|
-
},
|
|
734
|
+
const Te = "flow--list--items", Ie = "flow--list--items--is-loading", J = {
|
|
735
|
+
items: Te,
|
|
736
|
+
isLoading: Ie
|
|
737
|
+
}, Ae = "flow--list--items--item", ke = "flow--list--items--item--has-action", V = {
|
|
738
|
+
item: Ae,
|
|
739
|
+
hasAction: ke
|
|
740
|
+
}, Ve = (i) => {
|
|
739
741
|
const { data: t, children: e } = i, a = h(), s = a.itemView, o = s.onAction, l = s.textValue ? s.textValue(t) : void 0, c = o ? () => o(t) : void 0, m = s.href ? s.href(t) : void 0, u = a.hasAction || !!c || !!m, v = C(V.item, u && V.hasAction);
|
|
740
742
|
return /* @__PURE__ */ n.createElement(
|
|
741
743
|
P.GridListItem,
|
|
@@ -747,22 +749,22 @@ const Le = "flow--list--items", Te = "flow--list--items--is-loading", J = {
|
|
|
747
749
|
},
|
|
748
750
|
e ?? s.render(t)
|
|
749
751
|
);
|
|
750
|
-
},
|
|
752
|
+
}, xe = (i) => /* @__PURE__ */ n.createElement(P.GridListItem, { textValue: "-", className: V.item }, i.children), Pe = () => {
|
|
751
753
|
const i = b(g);
|
|
752
|
-
return /* @__PURE__ */ n.createElement(
|
|
753
|
-
},
|
|
754
|
-
const t = h().itemView.fallback ?? /* @__PURE__ */ n.createElement(
|
|
755
|
-
return Array.from(Array(5)).map((e, a) => /* @__PURE__ */ n.createElement(
|
|
756
|
-
},
|
|
757
|
-
const { className: t, ...e } = i, a = h(), s = a.loader.useIsLoading(), o = a.loader.useIsInitiallyLoading(), l = a.useIsEmpty(), c = a.items.entries.map((u) => /* @__PURE__ */ n.createElement(
|
|
754
|
+
return /* @__PURE__ */ n.createElement($t, null, /* @__PURE__ */ n.createElement(Ot, null), /* @__PURE__ */ n.createElement(tt, null, i.format("list.noResult.heading")), /* @__PURE__ */ n.createElement(S, null, i.format("list.noResult.text")));
|
|
755
|
+
}, Be = () => /* @__PURE__ */ n.createElement(et, null, /* @__PURE__ */ n.createElement(tt, null, /* @__PURE__ */ n.createElement(I, { width: "200px" })), /* @__PURE__ */ n.createElement(S, null, /* @__PURE__ */ n.createElement(I, { width: "300px" }))), De = () => {
|
|
756
|
+
const t = h().itemView.fallback ?? /* @__PURE__ */ n.createElement(Be, null);
|
|
757
|
+
return Array.from(Array(5)).map((e, a) => /* @__PURE__ */ n.createElement(xe, { key: a }, bt(t)));
|
|
758
|
+
}, Ne = (i) => {
|
|
759
|
+
const { className: t, ...e } = i, a = h(), s = a.loader.useIsLoading(), o = a.loader.useIsInitiallyLoading(), l = a.useIsEmpty(), c = a.items.entries.map((u) => /* @__PURE__ */ n.createElement(Ve, { key: u.id, data: u.data })), m = C(
|
|
758
760
|
J.items,
|
|
759
761
|
t,
|
|
760
762
|
s && J.isLoading
|
|
761
763
|
);
|
|
762
|
-
return l ? /* @__PURE__ */ n.createElement(
|
|
763
|
-
}, nt = (i) => null,
|
|
764
|
-
footer:
|
|
765
|
-
},
|
|
764
|
+
return l ? /* @__PURE__ */ n.createElement(Pe, null) : /* @__PURE__ */ n.createElement("div", { "aria-hidden": o, "aria-busy": s }, /* @__PURE__ */ n.createElement(P.GridList, { className: m, ...e }, o ? /* @__PURE__ */ n.createElement(De, null) : c));
|
|
765
|
+
}, nt = (i) => null, Re = () => nt, rt = (i) => null, ze = () => rt, ot = (i) => null, Me = () => ot, lt = (i) => null, Ue = () => lt, ct = (i) => null, $e = () => ct, Oe = "flow--list--footer", He = {
|
|
766
|
+
footer: Oe
|
|
767
|
+
}, qe = (i) => {
|
|
766
768
|
const t = b(g), e = h(), a = e.batches, s = e.loader.useIsInitiallyLoading(), o = e.useIsEmpty(), l = a.getTotalItemsCount(), c = a.getVisibleItemsCount();
|
|
767
769
|
if (o)
|
|
768
770
|
return null;
|
|
@@ -785,18 +787,18 @@ const Le = "flow--list--items", Te = "flow--list--items--is-loading", J = {
|
|
|
785
787
|
},
|
|
786
788
|
t.format("list.showMore")
|
|
787
789
|
);
|
|
788
|
-
}, Ke = () => /* @__PURE__ */ n.createElement("div", { className:
|
|
790
|
+
}, Ke = () => /* @__PURE__ */ n.createElement("div", { className: He.footer }, /* @__PURE__ */ n.createElement(qe, null), /* @__PURE__ */ n.createElement(Ge, null));
|
|
789
791
|
function ut(i) {
|
|
790
792
|
return null;
|
|
791
793
|
}
|
|
792
|
-
const
|
|
794
|
+
const je = () => ut, Je = Lt("List", (i) => {
|
|
793
795
|
var p, R, z, M, U;
|
|
794
796
|
const { children: t, batchSize: e, ...a } = i, s = (p = y(
|
|
795
797
|
t,
|
|
796
798
|
nt
|
|
797
799
|
)) == null ? void 0 : p.props, o = (R = y(
|
|
798
800
|
t,
|
|
799
|
-
|
|
801
|
+
Ht
|
|
800
802
|
)) == null ? void 0 : R.props, l = (z = y(t, ct)) == null ? void 0 : z.props, c = {
|
|
801
803
|
source: s ? {
|
|
802
804
|
...s,
|
|
@@ -807,16 +809,16 @@ const qe = () => ut, je = Ft("List", (i) => {
|
|
|
807
809
|
} : l ? {
|
|
808
810
|
staticData: l.data
|
|
809
811
|
} : void 0
|
|
810
|
-
}, m = (M = y(t, ut)) == null ? void 0 : M.props, u = (U = y(t, lt)) == null ? void 0 : U.props, v =
|
|
812
|
+
}, m = (M = y(t, ut)) == null ? void 0 : M.props, u = (U = y(t, lt)) == null ? void 0 : U.props, v = Le.useNew({
|
|
811
813
|
loader: c,
|
|
812
|
-
filters:
|
|
814
|
+
filters: K(t, rt).map(
|
|
813
815
|
(F) => F.props
|
|
814
816
|
),
|
|
815
817
|
search: m ? {
|
|
816
818
|
render: m.children,
|
|
817
819
|
textFieldProps: m
|
|
818
820
|
} : void 0,
|
|
819
|
-
sorting:
|
|
821
|
+
sorting: K(t, ot).map((F) => F.props),
|
|
820
822
|
itemView: u ? {
|
|
821
823
|
...u,
|
|
822
824
|
renderFn: u.children
|
|
@@ -833,32 +835,32 @@ const qe = () => ut, je = Ft("List", (i) => {
|
|
|
833
835
|
list: v
|
|
834
836
|
}
|
|
835
837
|
},
|
|
836
|
-
/* @__PURE__ */ n.createElement(
|
|
837
|
-
/* @__PURE__ */ n.createElement("div", { className:
|
|
838
|
+
/* @__PURE__ */ n.createElement(te, null),
|
|
839
|
+
/* @__PURE__ */ n.createElement("div", { className: pe.list }, /* @__PURE__ */ n.createElement(he, null), /* @__PURE__ */ n.createElement(Ne, { ...a }), /* @__PURE__ */ n.createElement(Ke, null))
|
|
838
840
|
);
|
|
839
|
-
}),
|
|
840
|
-
List:
|
|
841
|
-
Filter:
|
|
842
|
-
Search:
|
|
843
|
-
Sorting:
|
|
844
|
-
Item:
|
|
841
|
+
}), Pa = () => ({
|
|
842
|
+
List: Je,
|
|
843
|
+
Filter: ze(),
|
|
844
|
+
Search: je(),
|
|
845
|
+
Sorting: Me(),
|
|
846
|
+
Item: Ue(),
|
|
845
847
|
ItemView: et,
|
|
846
|
-
StaticData:
|
|
847
|
-
LoaderAsync:
|
|
848
|
-
LoaderAsyncResource:
|
|
848
|
+
StaticData: $e(),
|
|
849
|
+
LoaderAsync: Re(),
|
|
850
|
+
LoaderAsyncResource: qt()
|
|
849
851
|
});
|
|
850
852
|
export {
|
|
851
|
-
|
|
853
|
+
Je as List,
|
|
852
854
|
rt as ListFilter,
|
|
853
855
|
lt as ListItem,
|
|
854
856
|
et as ListItemView,
|
|
855
857
|
nt as ListLoaderAsync,
|
|
856
858
|
ot as ListSorting,
|
|
857
859
|
ct as ListStaticData,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
860
|
+
ze as TypedListFilter,
|
|
861
|
+
Ue as TypedListItem,
|
|
862
|
+
Re as TypedListLoaderAsync,
|
|
863
|
+
Me as TypedListSorting,
|
|
864
|
+
$e as TypedListStaticData,
|
|
865
|
+
Pa as typedList
|
|
864
866
|
};
|
|
@@ -4,7 +4,7 @@ import { FilterMatcher, FilterMode, FilterShape } from './types';
|
|
|
4
4
|
import { PropertyName } from '../types';
|
|
5
5
|
|
|
6
6
|
export declare class Filter<T, TProp extends PropertyName<T>, TMatchValue> {
|
|
7
|
-
private
|
|
7
|
+
private _values?;
|
|
8
8
|
readonly list: List<T>;
|
|
9
9
|
readonly property: PropertyName<T>;
|
|
10
10
|
readonly mode: FilterMode;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ItemType } from '../../../../lib/types/array';
|
|
2
1
|
import { PropertyName, PropertyValue } from '../types';
|
|
2
|
+
import { ItemType } from '../../../../lib/types/array';
|
|
3
3
|
|
|
4
4
|
export type FilterMode = "all" | "some" | "one";
|
|
5
|
-
export type
|
|
6
|
-
export type FilterMatcher<T, P, TMatcherValue> = (filterBy: FilterValue<T, P>, filterFrom: TMatcherValue[]) => boolean;
|
|
5
|
+
export type FilterMatcher<T, P, TMatcherValue> = (filterBy: NonNullable<ItemType<TMatcherValue>>, filterFrom: PropertyValue<T, P>) => boolean;
|
|
7
6
|
export interface FilterShape<T, TProp extends PropertyName<T>, TMatcherValue> {
|
|
8
7
|
property: TProp;
|
|
9
8
|
mode?: FilterMode;
|
|
@@ -6,7 +6,7 @@ import { IncrementalLoaderShape } from './loading/types';
|
|
|
6
6
|
import { SearchShape } from './search/types';
|
|
7
7
|
import { ItemViewShape } from './item/ItemView';
|
|
8
8
|
|
|
9
|
-
export type PropertyName<T> =
|
|
9
|
+
export type PropertyName<T> = DeepKeys<T>;
|
|
10
10
|
export type PropertyValue<T, TProp> = DeepValue<T, TProp>;
|
|
11
11
|
export interface ListShape<T> {
|
|
12
12
|
loader?: IncrementalLoaderShape<T>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FilterShape
|
|
1
|
+
import { FilterShape } from '../model/filter/types';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { PropertyName } from '../model/types';
|
|
3
|
+
import { PropertyName, PropertyValue } from '../model/types';
|
|
4
4
|
|
|
5
5
|
type Props<T, TProp extends PropertyName<T>, TMatcherValue> = Omit<FilterShape<T, TProp, TMatcherValue>, "type">;
|
|
6
|
-
export declare const ListFilter: <T, const TProp extends PropertyName<T> = PropertyName<T>, TMatcherValue =
|
|
7
|
-
export declare const TypedListFilter: <T>() => <const TProp extends PropertyName<T>, TMatcherValue =
|
|
6
|
+
export declare const ListFilter: <T, const TProp extends PropertyName<T> = PropertyName<T>, TMatcherValue = PropertyValue<T, TProp>>(ignoredProps: Props<T, TProp, TMatcherValue>) => null;
|
|
7
|
+
export declare const TypedListFilter: <T>() => <const TProp extends PropertyName<T>, TMatcherValue = PropertyValue<T, TProp>>(props: Props<T, TProp, TMatcherValue>) => ReactNode;
|
|
8
8
|
export {};
|