@mittwald/flow-react-components 0.1.0-alpha.121 → 0.1.0-alpha.122
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 +236 -218
- package/dist/Skeleton-D97e6aVe.js +14 -0
- package/dist/Skeleton.js +3 -11
- package/dist/styles.css +1 -1
- package/dist/types/components/List/components/Items/ItemSkeleton/ItemSkeleton.d.ts +3 -0
- package/dist/types/components/List/model/List.d.ts +1 -0
- package/dist/types/components/List/model/loading/IncrementalLoader.d.ts +3 -0
- package/package.json +4 -4
package/dist/List.js
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var o = (
|
|
6
|
-
import s, { createContext as
|
|
7
|
-
import { C as
|
|
8
|
-
import { M as
|
|
9
|
-
import * as
|
|
10
|
-
import { MenuTrigger as
|
|
11
|
-
import { T as
|
|
3
|
+
var Z = Object.defineProperty;
|
|
4
|
+
var _ = (i, t, e) => t in i ? Z(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
5
|
+
var o = (i, t, e) => (_(i, typeof t != "symbol" ? t + "" : t, e), e);
|
|
6
|
+
import s, { createContext as tt, useContext as et, createElement as at, useEffect as v, useRef as st, Suspense as nt } from "react";
|
|
7
|
+
import { C as H } from "./ContextMenu-BGfJXwpB.js";
|
|
8
|
+
import { M as q, d as it } from "./MenuItem-CzSUuXS-.js";
|
|
9
|
+
import * as K from "react-aria-components";
|
|
10
|
+
import { MenuTrigger as rt } from "react-aria-components";
|
|
11
|
+
import { T as S } from "./Text-DXApO_Re.js";
|
|
12
12
|
import "@tabler/icons-react";
|
|
13
13
|
import "./Icon-DhFv_0k_.js";
|
|
14
|
-
import { I as
|
|
14
|
+
import { I as j } from "./IconChevronDown-gLJKgegq.js";
|
|
15
15
|
import { B as g } from "./Button-BGCNzfmU.js";
|
|
16
|
-
import { useMessageFormatter as
|
|
17
|
-
import
|
|
18
|
-
import { I as
|
|
19
|
-
import { getProperty as
|
|
20
|
-
import { useReactTable as
|
|
21
|
-
import
|
|
22
|
-
import { useLocalObservable as
|
|
23
|
-
import { autorun as
|
|
24
|
-
import { getAsyncResource as
|
|
25
|
-
import { times as
|
|
26
|
-
import { u as
|
|
16
|
+
import { useMessageFormatter as J, useLocalizedStringFormatter as I } from "react-aria";
|
|
17
|
+
import W from "clsx";
|
|
18
|
+
import { I as ot } from "./IconClose-BEe9M79E.js";
|
|
19
|
+
import { getProperty as lt } from "dot-prop";
|
|
20
|
+
import { useReactTable as ct, getCoreRowModel as ut, getSortedRowModel as mt, getFilteredRowModel as dt, getPaginationRowModel as ht, getFacetedUniqueValues as gt } from "@tanstack/react-table";
|
|
21
|
+
import Y from "invariant";
|
|
22
|
+
import { useLocalObservable as pt } from "mobx-react-lite";
|
|
23
|
+
import { autorun as ft, runInAction as bt, makeObservable as St, observable as P, computed as R, action as E } from "mobx";
|
|
24
|
+
import { getAsyncResource as M } from "@mittwald/react-use-promise";
|
|
25
|
+
import { times as yt } from "remeda";
|
|
26
|
+
import { u as V } from "./useSelector-DpU7_HMO.js";
|
|
27
27
|
import "./propsContext-CauylOgH.js";
|
|
28
|
-
import { P as
|
|
28
|
+
import { P as Ct } from "./PropsContextProvider-DZvwqHLP.js";
|
|
29
29
|
import "@react-aria/utils";
|
|
30
|
-
import { d as
|
|
31
|
-
import { W as
|
|
32
|
-
import { L as
|
|
33
|
-
import { I as
|
|
34
|
-
import { TunnelProvider as
|
|
35
|
-
import { I as
|
|
36
|
-
import { I as
|
|
37
|
-
import { H as
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
|
|
30
|
+
import { d as Et } from "./dynamic-ClpUSmEt.js";
|
|
31
|
+
import { W as vt } from "./Wrap-DGT1h1o3.js";
|
|
32
|
+
import { L as Ft } from "./Link-BK57CeBv.js";
|
|
33
|
+
import { I as It } from "./IconContextMenu-B9OI5d_u.js";
|
|
34
|
+
import { TunnelProvider as Tt, TunnelExit as x } from "@mittwald/react-tunnel";
|
|
35
|
+
import { I as wt } from "./IllustratedMessage-D1xVzeZO.js";
|
|
36
|
+
import { I as Lt } from "./IconSearch-BO1yNi13.js";
|
|
37
|
+
import { H as Bt } from "./Heading-CYit9Nf-.js";
|
|
38
|
+
import { S as kt } from "./Skeleton-D97e6aVe.js";
|
|
39
|
+
import { d as C, a as z } from "./deepFindOfType-6pG0fH7S.js";
|
|
40
|
+
import { I as At } from "./InlineCode-BV2i5uN0.js";
|
|
41
|
+
import { ListLoaderAsyncResource as Dt } from "./List/ListLoaderAsyncResource.js";
|
|
42
|
+
const G = tt({}), h = () => et(G).list, Nt = (i) => /* @__PURE__ */ s.createElement(s.Fragment, null, i.children()), Pt = () => h().loader.getLoaderInvocationHooks().map((t, e) => /* @__PURE__ */ s.createElement(Nt, { key: e }, () => {
|
|
42
43
|
t();
|
|
43
|
-
})),
|
|
44
|
-
const { sorting: t } =
|
|
45
|
-
return /* @__PURE__ */ s.createElement(
|
|
44
|
+
})), Rt = (i) => {
|
|
45
|
+
const { sorting: t } = i;
|
|
46
|
+
return /* @__PURE__ */ s.createElement(q, { id: t.getTableColumn().id }, t.name);
|
|
46
47
|
}, d = {
|
|
47
48
|
"de-DE": {
|
|
48
49
|
"list.noResult.heading": "Keine Suchergebnisse gefunden",
|
|
@@ -66,15 +67,15 @@ const W = Z({}), h = () => _(W).list, At = (r) => /* @__PURE__ */ s.createElemen
|
|
|
66
67
|
"list.showMore": "Show more",
|
|
67
68
|
"list.sorting": "Sorting"
|
|
68
69
|
}
|
|
69
|
-
},
|
|
70
|
-
const { children: t, locales: e, variables: a } =
|
|
71
|
-
return
|
|
72
|
-
},
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
70
|
+
}, F = (i) => {
|
|
71
|
+
const { children: t, locales: e, variables: a } = i;
|
|
72
|
+
return J(e)(t, a);
|
|
73
|
+
}, Mt = () => {
|
|
74
|
+
const i = h(), t = i.sorting.map((n) => /* @__PURE__ */ s.createElement(Rt, { sorting: n, key: n.getTableColumn().id }));
|
|
75
|
+
if (i.sorting.length === 0)
|
|
75
76
|
return null;
|
|
76
|
-
const e =
|
|
77
|
-
|
|
77
|
+
const e = i.sorting.find((n) => n.isSorted()), a = /* @__PURE__ */ s.createElement(S, null, e ? /* @__PURE__ */ s.createElement(
|
|
78
|
+
F,
|
|
78
79
|
{
|
|
79
80
|
locales: d,
|
|
80
81
|
variables: {
|
|
@@ -82,24 +83,24 @@ const W = Z({}), h = () => _(W).list, At = (r) => /* @__PURE__ */ s.createElemen
|
|
|
82
83
|
}
|
|
83
84
|
},
|
|
84
85
|
"list.setSorting"
|
|
85
|
-
) : /* @__PURE__ */ s.createElement(
|
|
86
|
-
return /* @__PURE__ */ s.createElement(
|
|
87
|
-
|
|
86
|
+
) : /* @__PURE__ */ s.createElement(F, { locales: d }, "list.sorting"));
|
|
87
|
+
return /* @__PURE__ */ s.createElement(K.MenuTrigger, null, /* @__PURE__ */ s.createElement(g, { variant: "soft", size: "s", color: "secondary" }, a, /* @__PURE__ */ s.createElement(j, null)), /* @__PURE__ */ s.createElement(
|
|
88
|
+
H,
|
|
88
89
|
{
|
|
89
90
|
selectionMode: "single",
|
|
90
91
|
selectedKeys: e ? [e.property] : [],
|
|
91
92
|
onAction: (n) => {
|
|
92
|
-
|
|
93
|
+
i.getSorting(String(n)).enable();
|
|
93
94
|
}
|
|
94
95
|
},
|
|
95
96
|
t
|
|
96
97
|
));
|
|
97
|
-
},
|
|
98
|
-
const { filter: t } =
|
|
99
|
-
t.toggleValue(
|
|
98
|
+
}, Vt = (i) => {
|
|
99
|
+
const { filter: t } = i, e = t.values.map((r) => /* @__PURE__ */ s.createElement(q, { key: t.getValueId(r), id: String(r) }, String(r))), a = t.values.filter((r) => t.isValueActive(r)).map((r) => String(r)), n = (r) => {
|
|
100
|
+
t.toggleValue(r);
|
|
100
101
|
};
|
|
101
|
-
return /* @__PURE__ */ s.createElement(
|
|
102
|
-
|
|
102
|
+
return /* @__PURE__ */ s.createElement(K.MenuTrigger, null, /* @__PURE__ */ s.createElement(g, { variant: "soft", size: "s", color: "secondary" }, /* @__PURE__ */ s.createElement(S, null, t.name ?? t.property), /* @__PURE__ */ s.createElement(j, null)), /* @__PURE__ */ s.createElement(
|
|
103
|
+
H,
|
|
103
104
|
{
|
|
104
105
|
onAction: n,
|
|
105
106
|
selectionMode: "multiple",
|
|
@@ -107,14 +108,14 @@ const W = Z({}), h = () => _(W).list, At = (r) => /* @__PURE__ */ s.createElemen
|
|
|
107
108
|
},
|
|
108
109
|
e
|
|
109
110
|
));
|
|
110
|
-
},
|
|
111
|
-
header:
|
|
112
|
-
pickerList:
|
|
113
|
-
},
|
|
114
|
-
activeFilters:
|
|
115
|
-
clearButton:
|
|
116
|
-
},
|
|
117
|
-
const
|
|
111
|
+
}, xt = "flow--list--header", zt = "flow--list--header--picker-list", O = {
|
|
112
|
+
header: xt,
|
|
113
|
+
pickerList: zt
|
|
114
|
+
}, Ot = "flow--list--header--active-filters", Ut = "flow--list--header--clear-button", U = {
|
|
115
|
+
activeFilters: Ot,
|
|
116
|
+
clearButton: Ut
|
|
117
|
+
}, $t = () => {
|
|
118
|
+
const i = h(), t = i.filters.flatMap(
|
|
118
119
|
(e) => e.values.filter((a) => e.isValueActive(a)).map((a) => /* @__PURE__ */ s.createElement(
|
|
119
120
|
g,
|
|
120
121
|
{
|
|
@@ -123,28 +124,28 @@ const W = Z({}), h = () => _(W).list, At = (r) => /* @__PURE__ */ s.createElemen
|
|
|
123
124
|
key: String(a),
|
|
124
125
|
onPress: () => e.deactivateValue(a)
|
|
125
126
|
},
|
|
126
|
-
/* @__PURE__ */ s.createElement(
|
|
127
|
-
/* @__PURE__ */ s.createElement(
|
|
127
|
+
/* @__PURE__ */ s.createElement(S, null, String(a)),
|
|
128
|
+
/* @__PURE__ */ s.createElement(ot, null)
|
|
128
129
|
))
|
|
129
130
|
);
|
|
130
|
-
return t.length <= 0 ? null : /* @__PURE__ */ s.createElement("div", { className:
|
|
131
|
+
return t.length <= 0 ? null : /* @__PURE__ */ s.createElement("div", { className: U.activeFilters }, t, /* @__PURE__ */ s.createElement(
|
|
131
132
|
g,
|
|
132
133
|
{
|
|
133
|
-
className:
|
|
134
|
+
className: U.clearButton,
|
|
134
135
|
size: "s",
|
|
135
136
|
variant: "plain",
|
|
136
|
-
onPress: () =>
|
|
137
|
+
onPress: () => i.clearFilters()
|
|
137
138
|
},
|
|
138
|
-
/* @__PURE__ */ s.createElement(
|
|
139
|
+
/* @__PURE__ */ s.createElement(F, { locales: d }, "list.resetAll")
|
|
139
140
|
));
|
|
140
|
-
},
|
|
141
|
-
const { className: t } =
|
|
142
|
-
return /* @__PURE__ */ s.createElement("div", { className:
|
|
143
|
-
},
|
|
144
|
-
list:
|
|
141
|
+
}, Ht = (i) => {
|
|
142
|
+
const { className: t } = i, a = h().filters.map((n) => /* @__PURE__ */ s.createElement(Vt, { key: n.property, filter: n }));
|
|
143
|
+
return /* @__PURE__ */ s.createElement("div", { className: W(t, O.header) }, /* @__PURE__ */ s.createElement("div", { className: O.pickerList }, /* @__PURE__ */ s.createElement(Mt, null), a), /* @__PURE__ */ s.createElement($t, null));
|
|
144
|
+
}, qt = "flow--list", Kt = {
|
|
145
|
+
list: qt
|
|
145
146
|
};
|
|
146
147
|
var m;
|
|
147
|
-
let
|
|
148
|
+
let jt = (m = class {
|
|
148
149
|
constructor(t, e, a) {
|
|
149
150
|
o(this, "id");
|
|
150
151
|
o(this, "data");
|
|
@@ -157,20 +158,20 @@ let Ht = (m = class {
|
|
|
157
158
|
static fromRow(t, e) {
|
|
158
159
|
return new m(t, e.id, e.original);
|
|
159
160
|
}
|
|
160
|
-
}, o(m, "fallbackRenderItemFn", (t) =>
|
|
161
|
-
class
|
|
161
|
+
}, o(m, "fallbackRenderItemFn", (t) => at("pre", void 0, JSON.stringify(t))), m);
|
|
162
|
+
class T {
|
|
162
163
|
constructor(t) {
|
|
163
164
|
o(this, "list");
|
|
164
165
|
this.list = t;
|
|
165
166
|
}
|
|
166
167
|
static useNew(t) {
|
|
167
|
-
return new
|
|
168
|
+
return new T(t);
|
|
168
169
|
}
|
|
169
170
|
get entries() {
|
|
170
|
-
return this.list.reactTable.table.getRowModel().rows.map((t) =>
|
|
171
|
+
return this.list.reactTable.table.getRowModel().rows.map((t) => jt.fromRow(this, t));
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
|
-
class
|
|
174
|
+
class Jt {
|
|
174
175
|
constructor(t, e = {}) {
|
|
175
176
|
o(this, "batchSize");
|
|
176
177
|
o(this, "list");
|
|
@@ -219,8 +220,8 @@ class qt {
|
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
|
-
const
|
|
223
|
-
class
|
|
223
|
+
const Wt = (i, t) => i === t;
|
|
224
|
+
class Yt {
|
|
224
225
|
constructor(t, e) {
|
|
225
226
|
o(this, "_values");
|
|
226
227
|
o(this, "list");
|
|
@@ -229,26 +230,26 @@ class jt {
|
|
|
229
230
|
o(this, "matcher");
|
|
230
231
|
o(this, "name");
|
|
231
232
|
o(this, "onFilterUpdateCallbacks", /* @__PURE__ */ new Set());
|
|
232
|
-
this.list = t, this.property = e.property, this.mode = e.mode ?? "one", this._values = e.values, this.matcher = e.matcher ??
|
|
233
|
+
this.list = t, this.property = e.property, this.mode = e.mode ?? "one", this._values = e.values, this.matcher = e.matcher ?? Wt, this.name = e.name;
|
|
233
234
|
}
|
|
234
235
|
updateTableColumnDef(t) {
|
|
235
236
|
t.enableColumnFilter = !0, t.filterFn = this.getReactTableFilterFn();
|
|
236
237
|
}
|
|
237
238
|
getReactTableFilterFn() {
|
|
238
239
|
return (t, e, a) => this.checkFilterMatches(
|
|
239
|
-
|
|
240
|
+
lt(t.original, this.property),
|
|
240
241
|
a
|
|
241
242
|
);
|
|
242
243
|
}
|
|
243
244
|
checkFilterMatches(t, e) {
|
|
244
245
|
if (e === null)
|
|
245
246
|
return !0;
|
|
246
|
-
const a = (
|
|
247
|
+
const a = (r) => Array.isArray(r) ? r : [r], n = (r) => this.matcher(r, t);
|
|
247
248
|
if (this.mode === "all")
|
|
248
249
|
return a(e).every(n);
|
|
249
250
|
if (this.mode === "some") {
|
|
250
|
-
const
|
|
251
|
-
return
|
|
251
|
+
const r = a(e);
|
|
252
|
+
return r.length === 0 || r.some(n);
|
|
252
253
|
} else if (this.mode === "one")
|
|
253
254
|
return n(e);
|
|
254
255
|
throw new Error(`Unknown filter mode '${this.mode}'`);
|
|
@@ -296,13 +297,13 @@ class jt {
|
|
|
296
297
|
toggleValue(t) {
|
|
297
298
|
const e = this.isValueActive(t), a = this.getArrayValue();
|
|
298
299
|
let n;
|
|
299
|
-
this.mode === "all" || this.mode === "some" ? e ? n = a.filter((
|
|
300
|
+
this.mode === "all" || this.mode === "some" ? e ? n = a.filter((r) => r !== t) : n = [...a, t] : n = e ? null : t, this.list.reactTable.getTableColumn(this.property).setFilterValue(n), this.onFilterUpdateCallbacks.forEach((r) => r());
|
|
300
301
|
}
|
|
301
302
|
onFilterUpdated(t) {
|
|
302
303
|
this.onFilterUpdateCallbacks.add(t);
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
|
-
class
|
|
306
|
+
class Gt {
|
|
306
307
|
constructor(t, e) {
|
|
307
308
|
o(this, "list");
|
|
308
309
|
o(this, "property");
|
|
@@ -327,8 +328,8 @@ class Jt {
|
|
|
327
328
|
this.list.reactTable.getTableColumn(this.property).clearSorting();
|
|
328
329
|
}
|
|
329
330
|
}
|
|
330
|
-
const
|
|
331
|
-
class
|
|
331
|
+
const Qt = (i) => v(ft(i));
|
|
332
|
+
class w {
|
|
332
333
|
constructor(t, e = {}) {
|
|
333
334
|
o(this, "list");
|
|
334
335
|
o(this, "table");
|
|
@@ -338,40 +339,40 @@ class T {
|
|
|
338
339
|
if (!e)
|
|
339
340
|
return;
|
|
340
341
|
const a = typeof t == "function" ? t(e) : t;
|
|
341
|
-
|
|
342
|
+
bt(() => {
|
|
342
343
|
this.tableState.value = this.getUpdatedTableState(e, a);
|
|
343
344
|
});
|
|
344
345
|
});
|
|
345
|
-
this.list = t, this.tableState =
|
|
346
|
+
this.list = t, this.tableState = pt(() => ({ value: void 0 })), this.table = this.useReactTable(e);
|
|
346
347
|
}
|
|
347
348
|
static useNew(t, e = {}) {
|
|
348
|
-
return new
|
|
349
|
+
return new w(t, e);
|
|
349
350
|
}
|
|
350
351
|
useReactTable(t = {}) {
|
|
351
|
-
const e = this.list.loader.useData(), a = this.list.sorting.filter((
|
|
352
|
+
const e = this.list.loader.useData(), a = this.list.sorting.filter((r) => r.defaultEnabled), n = ct({
|
|
352
353
|
data: e,
|
|
353
354
|
initialState: {
|
|
354
355
|
pagination: {
|
|
355
356
|
pageSize: this.list.batches.batchSize
|
|
356
357
|
},
|
|
357
|
-
sorting: a.map((
|
|
358
|
-
id: String(
|
|
359
|
-
desc:
|
|
358
|
+
sorting: a.map((r) => ({
|
|
359
|
+
id: String(r.property),
|
|
360
|
+
desc: r.direction === "desc"
|
|
360
361
|
}))
|
|
361
362
|
},
|
|
362
363
|
columns: this.getTableColumnDefs(),
|
|
363
|
-
getCoreRowModel:
|
|
364
|
-
getSortedRowModel:
|
|
365
|
-
getFilteredRowModel:
|
|
366
|
-
getPaginationRowModel:
|
|
367
|
-
getFacetedUniqueValues:
|
|
364
|
+
getCoreRowModel: ut(),
|
|
365
|
+
getSortedRowModel: mt(),
|
|
366
|
+
getFilteredRowModel: dt(),
|
|
367
|
+
getPaginationRowModel: ht(),
|
|
368
|
+
getFacetedUniqueValues: gt(),
|
|
368
369
|
onStateChange: this.onTableStateChange,
|
|
369
370
|
...t
|
|
370
371
|
});
|
|
371
372
|
return this.useUpdateTableState(n), n;
|
|
372
373
|
}
|
|
373
374
|
useUpdateTableState(t) {
|
|
374
|
-
|
|
375
|
+
Qt(() => {
|
|
375
376
|
const e = this.tableState.value;
|
|
376
377
|
e ? t.setOptions((a) => ({
|
|
377
378
|
...a,
|
|
@@ -384,20 +385,20 @@ class T {
|
|
|
384
385
|
}
|
|
385
386
|
getTableColumn(t) {
|
|
386
387
|
const e = this.table.getColumn(t);
|
|
387
|
-
return
|
|
388
|
+
return Y(!!e, `Column #${t} is not defined`), e;
|
|
388
389
|
}
|
|
389
390
|
getTableColumnDefs() {
|
|
390
391
|
const t = /* @__PURE__ */ new Map(), e = (a) => {
|
|
391
392
|
const n = t.get(a);
|
|
392
393
|
if (n)
|
|
393
394
|
return n;
|
|
394
|
-
const
|
|
395
|
+
const r = {
|
|
395
396
|
id: a,
|
|
396
397
|
accessorKey: a,
|
|
397
398
|
enableSorting: !1,
|
|
398
399
|
enableColumnFilter: !1
|
|
399
400
|
};
|
|
400
|
-
return t.set(a,
|
|
401
|
+
return t.set(a, r), r;
|
|
401
402
|
};
|
|
402
403
|
return this.list.filters.forEach(
|
|
403
404
|
(a) => a.updateTableColumnDef(e(a.property))
|
|
@@ -406,23 +407,23 @@ class T {
|
|
|
406
407
|
), Array.from(t.values());
|
|
407
408
|
}
|
|
408
409
|
}
|
|
409
|
-
class
|
|
410
|
+
class L {
|
|
410
411
|
constructor() {
|
|
411
412
|
o(this, "dataBatches", []);
|
|
412
413
|
o(this, "prevDataBatches", []);
|
|
413
|
-
o(this, "batchLoadingStates", []);
|
|
414
|
-
|
|
415
|
-
dataBatches:
|
|
416
|
-
batchLoadingStates:
|
|
417
|
-
mergedData:
|
|
418
|
-
isLoading:
|
|
419
|
-
reset:
|
|
420
|
-
setDataBatch:
|
|
421
|
-
setBatchLoadingState:
|
|
414
|
+
o(this, "batchLoadingStates", ["void"]);
|
|
415
|
+
St(this, {
|
|
416
|
+
dataBatches: P.shallow,
|
|
417
|
+
batchLoadingStates: P.shallow,
|
|
418
|
+
mergedData: R,
|
|
419
|
+
isLoading: R,
|
|
420
|
+
reset: E.bound,
|
|
421
|
+
setDataBatch: E.bound,
|
|
422
|
+
setBatchLoadingState: E.bound
|
|
422
423
|
});
|
|
423
424
|
}
|
|
424
425
|
static useNew() {
|
|
425
|
-
return
|
|
426
|
+
return st(new L()).current;
|
|
426
427
|
}
|
|
427
428
|
reset() {
|
|
428
429
|
this.batchLoadingStates = [], this.dataBatches = [];
|
|
@@ -437,17 +438,17 @@ class w {
|
|
|
437
438
|
return (this.dataBatches.length === 0 ? this.prevDataBatches : this.dataBatches).flatMap((e) => e);
|
|
438
439
|
}
|
|
439
440
|
useMergedData() {
|
|
440
|
-
return
|
|
441
|
+
return V(() => this.mergedData);
|
|
441
442
|
}
|
|
442
443
|
get isLoading() {
|
|
443
|
-
return this.batchLoadingStates.some((t) => t === "loading");
|
|
444
|
+
return this.batchLoadingStates.some((t) => t === "loading" || t === "void");
|
|
444
445
|
}
|
|
445
446
|
useIsLoading() {
|
|
446
|
-
return
|
|
447
|
+
return V(() => this.isLoading);
|
|
447
448
|
}
|
|
448
449
|
}
|
|
449
|
-
const
|
|
450
|
-
class
|
|
450
|
+
const Xt = [];
|
|
451
|
+
class B {
|
|
451
452
|
constructor(t, e = {}) {
|
|
452
453
|
o(this, "list");
|
|
453
454
|
o(this, "dataSource");
|
|
@@ -456,12 +457,12 @@ class I {
|
|
|
456
457
|
o(this, "manualPagination");
|
|
457
458
|
o(this, "loaderState");
|
|
458
459
|
const { source: a } = e;
|
|
459
|
-
this.dataSource = a ?? { staticData:
|
|
460
|
-
const n = "manualPagination" in this.dataSource ? this.dataSource.manualPagination : void 0,
|
|
461
|
-
this.list = t, this.loaderState =
|
|
460
|
+
this.dataSource = a ?? { staticData: Xt };
|
|
461
|
+
const n = "manualPagination" in this.dataSource ? this.dataSource.manualPagination : void 0, r = "manualFiltering" in this.dataSource ? this.dataSource.manualFiltering : void 0, l = "manualSorting" in this.dataSource ? this.dataSource.manualSorting : void 0;
|
|
462
|
+
this.list = t, this.loaderState = L.useNew(), this.manualPagination = n ?? !1, this.manualFiltering = r ?? this.manualPagination, this.manualSorting = l ?? this.manualPagination, this.list.filters.forEach((u) => u.onFilterUpdated(() => this.reset()));
|
|
462
463
|
}
|
|
463
464
|
static useNew(t, e = {}) {
|
|
464
|
-
return new
|
|
465
|
+
return new B(t, e);
|
|
465
466
|
}
|
|
466
467
|
reset() {
|
|
467
468
|
this.loaderState.reset();
|
|
@@ -469,29 +470,41 @@ class I {
|
|
|
469
470
|
useIsLoading() {
|
|
470
471
|
return this.loaderState.useIsLoading();
|
|
471
472
|
}
|
|
473
|
+
useIsInitiallyLoading() {
|
|
474
|
+
return this.useIsLoading() && this.list.batches.getBatchIndex() === 0;
|
|
475
|
+
}
|
|
472
476
|
useData() {
|
|
473
477
|
return this.loaderState.useMergedData();
|
|
474
478
|
}
|
|
475
479
|
getLoaderInvocationHooks() {
|
|
476
|
-
return
|
|
480
|
+
return yt(this.list.batches.getBatchIndex() + 1, (e) => e).map((e) => () => {
|
|
477
481
|
this.useLoadBatch(e);
|
|
478
482
|
});
|
|
479
483
|
}
|
|
480
484
|
useLoadBatch(t) {
|
|
481
|
-
const e = this.getBatchDataAsyncResource(t)
|
|
485
|
+
const e = this.getBatchDataAsyncResource(t);
|
|
486
|
+
e.use({
|
|
482
487
|
useSuspense: !1
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
488
|
+
}), this.useObserveBatchData(e, t), this.useObserveBatchLoadingState(e, t);
|
|
489
|
+
}
|
|
490
|
+
useObserveBatchLoadingState(t, e) {
|
|
491
|
+
v(() => (this.loaderState.setBatchLoadingState(
|
|
492
|
+
e,
|
|
493
|
+
t.state.value
|
|
494
|
+
), t.state.observe((a) => {
|
|
495
|
+
this.loaderState.setBatchLoadingState(e, a);
|
|
496
|
+
})), [t, e]);
|
|
497
|
+
}
|
|
498
|
+
useObserveBatchData(t, e) {
|
|
499
|
+
v(
|
|
500
|
+
() => t.value.observe((a) => {
|
|
501
|
+
if (!a.isSet)
|
|
502
|
+
return;
|
|
503
|
+
const { data: n, itemTotalCount: r } = a.value;
|
|
504
|
+
this.loaderState.setDataBatch(e, n), r !== void 0 && this.list.batches.updateItemTotalCount(r);
|
|
505
|
+
}),
|
|
506
|
+
[t, e]
|
|
507
|
+
);
|
|
495
508
|
}
|
|
496
509
|
getDataLoaderOptions(t) {
|
|
497
510
|
return {
|
|
@@ -514,7 +527,7 @@ class I {
|
|
|
514
527
|
const e = this.dataSource, a = this.getDataLoaderOptions(t);
|
|
515
528
|
if ("staticData" in e) {
|
|
516
529
|
const n = e.staticData;
|
|
517
|
-
return
|
|
530
|
+
return M(
|
|
518
531
|
async () => ({
|
|
519
532
|
data: n,
|
|
520
533
|
itemTotalCount: n.length
|
|
@@ -524,7 +537,7 @@ class I {
|
|
|
524
537
|
}
|
|
525
538
|
if ("asyncLoader" in e) {
|
|
526
539
|
const n = e.asyncLoader;
|
|
527
|
-
return
|
|
540
|
+
return M(n, [a]);
|
|
528
541
|
}
|
|
529
542
|
if ("asyncResourceFactory" in e) {
|
|
530
543
|
const n = e.asyncResourceFactory;
|
|
@@ -533,7 +546,7 @@ class I {
|
|
|
533
546
|
throw new Error("Unknown data source");
|
|
534
547
|
}
|
|
535
548
|
}
|
|
536
|
-
let
|
|
549
|
+
let Zt = class Q {
|
|
537
550
|
constructor(t) {
|
|
538
551
|
o(this, "filters");
|
|
539
552
|
o(this, "sorting");
|
|
@@ -542,22 +555,22 @@ let Gt = class Y {
|
|
|
542
555
|
o(this, "reactTable");
|
|
543
556
|
o(this, "batches");
|
|
544
557
|
o(this, "loader");
|
|
545
|
-
const { render: e, filters: a = [], sorting: n = [], batchesController:
|
|
546
|
-
this.render = e, this.items =
|
|
558
|
+
const { render: e, filters: a = [], sorting: n = [], batchesController: r } = t;
|
|
559
|
+
this.render = e, this.items = T.useNew(this), this.filters = a.map((l) => new Yt(this, l)), this.sorting = n.map((l) => new Gt(this, l)), this.batches = new Jt(this, r), this.loader = B.useNew(this, t.loader), this.reactTable = w.useNew(this, {
|
|
547
560
|
manualFiltering: this.loader.manualFiltering,
|
|
548
561
|
manualPagination: this.loader.manualPagination,
|
|
549
562
|
manualSorting: this.loader.manualSorting
|
|
550
563
|
});
|
|
551
564
|
}
|
|
552
565
|
static useNew(t) {
|
|
553
|
-
return new
|
|
566
|
+
return new Q(t);
|
|
554
567
|
}
|
|
555
568
|
isFiltered() {
|
|
556
569
|
return this.filters.some((t) => t.isActive());
|
|
557
570
|
}
|
|
558
571
|
getSorting(t) {
|
|
559
572
|
const e = this.sorting.find((a) => a.property === t);
|
|
560
|
-
return
|
|
573
|
+
return Y(!!e, `Could not get Sorting (property: ${t})`), e;
|
|
561
574
|
}
|
|
562
575
|
clearSorting() {
|
|
563
576
|
return this.sorting.forEach((t) => t.clear());
|
|
@@ -565,41 +578,44 @@ let Gt = class Y {
|
|
|
565
578
|
clearFilters() {
|
|
566
579
|
return this.filters.forEach((t) => t.clearValues());
|
|
567
580
|
}
|
|
581
|
+
useIsEmpty() {
|
|
582
|
+
return !this.loader.useIsLoading() && this.items.entries.length === 0;
|
|
583
|
+
}
|
|
568
584
|
};
|
|
569
|
-
const
|
|
570
|
-
itemList:
|
|
571
|
-
isLoading:
|
|
572
|
-
},
|
|
573
|
-
item:
|
|
574
|
-
title:
|
|
575
|
-
topContent:
|
|
576
|
-
content:
|
|
577
|
-
action:
|
|
578
|
-
avatar:
|
|
579
|
-
text:
|
|
580
|
-
statusBadge:
|
|
581
|
-
heading:
|
|
582
|
-
},
|
|
583
|
-
const { className: t, children: e } =
|
|
584
|
-
return /* @__PURE__ */ s.createElement(
|
|
585
|
+
const _t = "flow--list--items--item-list", te = "flow--list--items--is-loading", $ = {
|
|
586
|
+
itemList: _t,
|
|
587
|
+
isLoading: te
|
|
588
|
+
}, ee = "flow--list--items--item", ae = "flow--list--items--title", se = "flow--list--items--top-content", ne = "flow--list--items--content", ie = "flow--list--items--action", re = "flow--list--items--avatar", oe = "flow--list--items--text", le = "flow--list--items--status-badge", ce = "flow--list--items--heading", c = {
|
|
589
|
+
item: ee,
|
|
590
|
+
title: ae,
|
|
591
|
+
topContent: se,
|
|
592
|
+
content: ne,
|
|
593
|
+
action: ie,
|
|
594
|
+
avatar: re,
|
|
595
|
+
text: oe,
|
|
596
|
+
statusBadge: le,
|
|
597
|
+
heading: ce
|
|
598
|
+
}, ue = (i) => {
|
|
599
|
+
const { className: t, children: e } = i, a = I(d);
|
|
600
|
+
return /* @__PURE__ */ s.createElement(rt, null, /* @__PURE__ */ s.createElement(
|
|
585
601
|
g,
|
|
586
602
|
{
|
|
587
603
|
variant: "plain",
|
|
588
604
|
className: t,
|
|
589
605
|
"aria-label": a.format("list.options")
|
|
590
606
|
},
|
|
591
|
-
/* @__PURE__ */ s.createElement(
|
|
607
|
+
/* @__PURE__ */ s.createElement(It, null)
|
|
592
608
|
), e);
|
|
593
|
-
},
|
|
594
|
-
const { children: t } =
|
|
609
|
+
}, me = (i) => i === "top" ? c.topContent : i === "bottom" ? c.content : c.topContent, X = (i) => {
|
|
610
|
+
const { children: t } = i, e = it(t, Ft), a = {
|
|
595
611
|
ContextMenu: {
|
|
596
|
-
render: (
|
|
612
|
+
render: (r, l) => /* @__PURE__ */ s.createElement(ue, { className: c.action }, /* @__PURE__ */ s.createElement(r, { ...l, placement: "bottom end" }))
|
|
597
613
|
},
|
|
598
614
|
Button: {
|
|
599
615
|
className: c.action
|
|
600
616
|
},
|
|
601
617
|
Content: {
|
|
602
|
-
className:
|
|
618
|
+
className: Et((r) => me(r.slot)),
|
|
603
619
|
tunnelId: "topContent"
|
|
604
620
|
},
|
|
605
621
|
Avatar: {
|
|
@@ -627,101 +643,103 @@ const Qt = "flow--list--items--item-list", Xt = "flow--list--items--is-loading",
|
|
|
627
643
|
...a
|
|
628
644
|
}
|
|
629
645
|
};
|
|
630
|
-
return /* @__PURE__ */ s.createElement(
|
|
631
|
-
},
|
|
632
|
-
|
|
633
|
-
|
|
646
|
+
return /* @__PURE__ */ s.createElement(vt, { if: !e }, /* @__PURE__ */ s.createElement("div", { className: c.item }, /* @__PURE__ */ s.createElement(Ct, { props: n }, /* @__PURE__ */ s.createElement(Tt, null, t, /* @__PURE__ */ s.createElement("div", { className: c.title }, /* @__PURE__ */ s.createElement(x, { id: "title" })), /* @__PURE__ */ s.createElement(x, { id: "topContent" })))));
|
|
647
|
+
}, de = (i) => /* @__PURE__ */ s.createElement(At, null, JSON.stringify(i.data)), he = "flow--list--items--item-skeleton", ge = {
|
|
648
|
+
itemSkeleton: he
|
|
649
|
+
}, b = () => /* @__PURE__ */ s.createElement(X, null, /* @__PURE__ */ s.createElement(kt, { className: ge.itemSkeleton })), pe = (i) => {
|
|
650
|
+
const { className: t } = i, e = h(), a = e.loader.useIsLoading(), n = e.loader.useIsInitiallyLoading(), r = e.useIsEmpty(), l = I(d), u = e.items.entries.map((y) => /* @__PURE__ */ s.createElement(X, { key: y.id }, /* @__PURE__ */ s.createElement(nt, null, y.render()))), p = W(
|
|
651
|
+
$.itemList,
|
|
634
652
|
t,
|
|
635
|
-
a &&
|
|
653
|
+
a && $.isLoading
|
|
636
654
|
);
|
|
637
|
-
return /* @__PURE__ */ s.createElement(
|
|
638
|
-
};
|
|
639
|
-
function
|
|
655
|
+
return r ? /* @__PURE__ */ s.createElement(wt, null, /* @__PURE__ */ s.createElement(Lt, null), /* @__PURE__ */ s.createElement(Bt, null, l.format("list.noResult.heading")), /* @__PURE__ */ s.createElement(S, null, l.format("list.noResult.text"))) : /* @__PURE__ */ s.createElement("div", { className: p }, n ? fe : u);
|
|
656
|
+
}, fe = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(b, null), /* @__PURE__ */ s.createElement(b, null), /* @__PURE__ */ s.createElement(b, null), /* @__PURE__ */ s.createElement(b, null), /* @__PURE__ */ s.createElement(b, null));
|
|
657
|
+
function be(i) {
|
|
640
658
|
return null;
|
|
641
659
|
}
|
|
642
|
-
function
|
|
660
|
+
function Se(i) {
|
|
643
661
|
return null;
|
|
644
662
|
}
|
|
645
|
-
function
|
|
663
|
+
function ye(i) {
|
|
646
664
|
return null;
|
|
647
665
|
}
|
|
648
|
-
function
|
|
666
|
+
function Ce(i) {
|
|
649
667
|
return null;
|
|
650
668
|
}
|
|
651
|
-
function
|
|
669
|
+
function Ee(i) {
|
|
652
670
|
return null;
|
|
653
671
|
}
|
|
654
|
-
const
|
|
655
|
-
footer:
|
|
656
|
-
},
|
|
657
|
-
const t =
|
|
658
|
-
if (
|
|
672
|
+
const ve = "flow--list--footer", Fe = {
|
|
673
|
+
footer: ve
|
|
674
|
+
}, Ie = (i) => {
|
|
675
|
+
const t = J(d), e = h(), a = e.batches, n = e.isFiltered() && !e.loader.manualFiltering, r = a.getTotalItemsCount(), l = a.getFilteredItemsCount(), u = a.getVisibleItemsCount();
|
|
676
|
+
if (r === 0)
|
|
659
677
|
return null;
|
|
660
|
-
const
|
|
678
|
+
const p = n ? t("list.paginationInfoFiltered", {
|
|
661
679
|
visibleItemsCount: u,
|
|
662
680
|
filteredItemsCount: l,
|
|
663
|
-
totalItemsCount:
|
|
681
|
+
totalItemsCount: r
|
|
664
682
|
}) : t("list.paginationInfo", {
|
|
665
683
|
visibleItemsCount: u,
|
|
666
|
-
totalItemsCount:
|
|
684
|
+
totalItemsCount: r
|
|
667
685
|
});
|
|
668
|
-
return /* @__PURE__ */ s.createElement(
|
|
669
|
-
},
|
|
670
|
-
const t =
|
|
671
|
-
return
|
|
686
|
+
return /* @__PURE__ */ s.createElement(S, { ...i }, p);
|
|
687
|
+
}, Te = (i) => {
|
|
688
|
+
const t = I(d), e = h(), a = e.loader.useIsLoading(), n = e.loader.useIsInitiallyLoading(), l = e.batches.hasNextBatch();
|
|
689
|
+
return n || !l && !a ? null : /* @__PURE__ */ s.createElement(
|
|
672
690
|
g,
|
|
673
691
|
{
|
|
674
692
|
isPending: a,
|
|
675
|
-
...
|
|
693
|
+
...i,
|
|
676
694
|
onPress: () => e.batches.nextBatch(),
|
|
677
695
|
variant: "plain",
|
|
678
696
|
size: "s"
|
|
679
697
|
},
|
|
680
698
|
t.format("list.showMore")
|
|
681
|
-
)
|
|
682
|
-
},
|
|
683
|
-
function
|
|
684
|
-
var
|
|
685
|
-
const { children: t, batchSize: e, ...a } =
|
|
699
|
+
);
|
|
700
|
+
}, we = () => /* @__PURE__ */ s.createElement("div", { className: Fe.footer }, /* @__PURE__ */ s.createElement(Ie, null), /* @__PURE__ */ s.createElement(Te, null));
|
|
701
|
+
function ca(i) {
|
|
702
|
+
var k, A, D, N;
|
|
703
|
+
const { children: t, batchSize: e, ...a } = i, n = (k = C(t, be)) == null ? void 0 : k.props, r = (A = C(
|
|
686
704
|
t,
|
|
687
|
-
|
|
688
|
-
)) == null ? void 0 :
|
|
705
|
+
Dt
|
|
706
|
+
)) == null ? void 0 : A.props, l = (D = C(t, Ee)) == null ? void 0 : D.props, u = {
|
|
689
707
|
source: n ? {
|
|
690
708
|
...n,
|
|
691
709
|
asyncLoader: n.children
|
|
692
|
-
} :
|
|
693
|
-
...
|
|
694
|
-
asyncResourceFactory:
|
|
710
|
+
} : r ? {
|
|
711
|
+
...r,
|
|
712
|
+
asyncResourceFactory: r.children
|
|
695
713
|
} : l ? {
|
|
696
714
|
staticData: l.data
|
|
697
715
|
} : void 0
|
|
698
|
-
},
|
|
716
|
+
}, p = (f) => /* @__PURE__ */ s.createElement(de, { data: f }), y = Zt.useNew({
|
|
699
717
|
loader: u,
|
|
700
|
-
filters:
|
|
701
|
-
sorting:
|
|
702
|
-
render: ((
|
|
718
|
+
filters: z(t, Se).map((f) => f.props),
|
|
719
|
+
sorting: z(t, ye).map((f) => f.props),
|
|
720
|
+
render: ((N = C(t, Ce)) == null ? void 0 : N.props.children) ?? p,
|
|
703
721
|
...a,
|
|
704
722
|
batchesController: {
|
|
705
723
|
batchSize: e
|
|
706
724
|
}
|
|
707
725
|
});
|
|
708
726
|
return /* @__PURE__ */ s.createElement(
|
|
709
|
-
|
|
727
|
+
G.Provider,
|
|
710
728
|
{
|
|
711
729
|
value: {
|
|
712
|
-
list:
|
|
730
|
+
list: y
|
|
713
731
|
}
|
|
714
732
|
},
|
|
715
|
-
/* @__PURE__ */ s.createElement(
|
|
716
|
-
/* @__PURE__ */ s.createElement("div", { className:
|
|
733
|
+
/* @__PURE__ */ s.createElement(Pt, null),
|
|
734
|
+
/* @__PURE__ */ s.createElement("div", { className: Kt.list }, /* @__PURE__ */ s.createElement(Ht, null), /* @__PURE__ */ s.createElement(pe, null), /* @__PURE__ */ s.createElement(we, null))
|
|
717
735
|
);
|
|
718
736
|
}
|
|
719
737
|
export {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
738
|
+
ca as List,
|
|
739
|
+
Se as ListFilter,
|
|
740
|
+
Ce as ListItemView,
|
|
741
|
+
be as ListLoaderAsync,
|
|
742
|
+
ye as ListSorting,
|
|
743
|
+
Ee as ListStaticData,
|
|
744
|
+
ca as default
|
|
727
745
|
};
|