@mittwald/flow-react-components 0.1.0-alpha.174 → 0.1.0-alpha.175
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/ListLoaderAsyncResource.js +3 -4
- package/dist/List.js +262 -255
- package/dist/types/components/List/components/Header/FilterPicker/FilterPicker.d.ts +1 -2
- package/dist/types/components/List/components/Header/ListFilter.d.ts +6 -3
- package/dist/types/components/List/components/Header/ListSorting.d.ts +4 -4
- package/dist/types/components/List/components/Header/SortingPickerItem/SortingPickerItem.d.ts +1 -2
- package/dist/types/components/List/components/Items/ListItem/FallbackRenderer.d.ts +1 -2
- package/dist/types/components/List/components/Items/ListItemView.d.ts +6 -4
- package/dist/types/components/List/components/ListLoaderAsync.d.ts +5 -3
- package/dist/types/components/List/components/ListLoaderAsyncResource.d.ts +5 -3
- package/dist/types/components/List/components/ListStaticData.d.ts +6 -3
- package/dist/types/components/List/hooks/useList.d.ts +1 -1
- package/dist/types/components/List/index.d.ts +1 -0
- package/dist/types/components/List/listContext.d.ts +1 -2
- package/dist/types/components/List/model/List.d.ts +3 -3
- package/dist/types/components/List/model/ReactTable.d.ts +1 -1
- package/dist/types/components/List/model/filter/Filter.d.ts +4 -4
- package/dist/types/components/List/model/filter/types.d.ts +8 -6
- package/dist/types/components/List/model/item/Item.d.ts +1 -3
- package/dist/types/components/List/model/item/types.d.ts +3 -5
- package/dist/types/components/List/model/sorting/Sorting.d.ts +2 -1
- package/dist/types/components/List/model/sorting/types.d.ts +1 -1
- package/dist/types/components/List/model/types.d.ts +5 -2
- package/dist/types/components/List/typedList.d.ts +25 -0
- package/dist/types/lib/types/array.d.ts +1 -0
- package/package.json +4 -4
package/dist/List.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import
|
|
7
|
-
import { R as
|
|
3
|
+
var it = Object.defineProperty;
|
|
4
|
+
var nt = (s, t, e) => t in s ? it(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
5
|
+
var r = (s, t, e) => nt(s, typeof t != "symbol" ? t + "" : t, e);
|
|
6
|
+
import i, { createContext as rt, useContext as ot, createElement as lt, useEffect as I, useRef as ct, Suspense as ut } from "react";
|
|
7
|
+
import { R as mt } from "./Render-BdlTa7Qb.js";
|
|
8
8
|
import { a as T, C as j } from "./ContextMenuTrigger-B8ZhwBtd.js";
|
|
9
9
|
import { M as J } from "./MenuItem-DvOltniq.js";
|
|
10
10
|
import { T as y } from "./Text-DMctOg-g.js";
|
|
@@ -14,36 +14,36 @@ import { I as W } from "./IconChevronDown-H4ANoHQh.js";
|
|
|
14
14
|
import { B as p } from "./Button-Dh-FA0K8.js";
|
|
15
15
|
import { useLocalizedStringFormatter as v } from "react-aria";
|
|
16
16
|
import k from "clsx";
|
|
17
|
-
import { I as
|
|
18
|
-
import { getProperty as
|
|
19
|
-
import { useReactTable as
|
|
17
|
+
import { I as dt } from "./IconClose-B9Tmq1hI.js";
|
|
18
|
+
import { getProperty as ht } from "dot-prop";
|
|
19
|
+
import { useReactTable as gt, getCoreRowModel as pt, getSortedRowModel as ft, getFilteredRowModel as bt, getPaginationRowModel as St, getFacetedUniqueValues as yt } from "@tanstack/react-table";
|
|
20
20
|
import Y from "invariant";
|
|
21
|
-
import { useLocalObservable as
|
|
22
|
-
import { autorun as
|
|
21
|
+
import { useLocalObservable as vt } from "mobx-react-lite";
|
|
22
|
+
import { autorun as Ct, runInAction as Et, makeObservable as Lt, observable as z, computed as M, action as L } from "mobx";
|
|
23
23
|
import { getAsyncResource as x } from "@mittwald/react-use-promise";
|
|
24
|
-
import { times as
|
|
24
|
+
import { times as It } from "remeda";
|
|
25
25
|
import { u as $ } from "./useSelector-DpU7_HMO.js";
|
|
26
|
-
import { I as
|
|
27
|
-
import { I as
|
|
28
|
-
import { H as
|
|
26
|
+
import { I as Ft } from "./IllustratedMessage-B3MHD01M.js";
|
|
27
|
+
import { I as wt } from "./IconSearch-BdmeRdRR.js";
|
|
28
|
+
import { H as Tt } from "./Heading-BkHvZG9C.js";
|
|
29
29
|
import { S as G } from "./Skeleton-CKLaTmDR.js";
|
|
30
30
|
import "./propsContext-DzAKlmhS.js";
|
|
31
|
-
import { P as
|
|
31
|
+
import { P as kt } from "./PropsContextProvider-C6Z4XGp6.js";
|
|
32
32
|
import "@react-aria/utils";
|
|
33
|
-
import { d as
|
|
34
|
-
import { I as
|
|
35
|
-
import { TunnelProvider as
|
|
36
|
-
import { L as
|
|
37
|
-
import { g as
|
|
33
|
+
import { d as Bt } from "./dynamic-ClpUSmEt.js";
|
|
34
|
+
import { I as At } from "./IconContextMenu-BbFVCu4A.js";
|
|
35
|
+
import { TunnelProvider as Dt, TunnelExit as O } from "@mittwald/react-tunnel";
|
|
36
|
+
import { L as Nt } from "./Link-BoQ8K6ao.js";
|
|
37
|
+
import { g as Rt } from "./getContainerBreakpointSizeClassName-BrcFDcCY.js";
|
|
38
38
|
import { d as E, a as U } from "./deepFindOfType-6pG0fH7S.js";
|
|
39
|
-
import { ListLoaderAsyncResource as
|
|
40
|
-
import { I as
|
|
39
|
+
import { ListLoaderAsyncResource as Pt, TypedListLoaderAsyncResource as Vt } from "./List/ListLoaderAsyncResource.js";
|
|
40
|
+
import { I as zt } from "./InlineCode-BT-PKxVv.js";
|
|
41
41
|
import "react-children-utilities";
|
|
42
|
-
const Q =
|
|
42
|
+
const Q = rt({}), g = () => ot(Q).list, Mt = () => g().loader.getLoaderInvocationHooks().map((t, e) => /* @__PURE__ */ i.createElement(mt, { key: e }, () => {
|
|
43
43
|
t();
|
|
44
|
-
})),
|
|
44
|
+
})), xt = (s) => {
|
|
45
45
|
const { sorting: t } = s;
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ i.createElement(J, { id: t.id }, t.name);
|
|
47
47
|
}, h = { "de-DE": {
|
|
48
48
|
"list.noResult.heading": "Keine Suchergebnisse gefunden",
|
|
49
49
|
"list.noResult.text": "Deine Suche ergab keine Ergebnisse. Bitte passe die Suchanfrage oder deine Filter an.",
|
|
@@ -64,15 +64,15 @@ const Q = et({}), g = () => at(Q).list, Dt = () => g().loader.getLoaderInvocatio
|
|
|
64
64
|
"list.setSorting": (s) => `Sorting: ${s.property}`,
|
|
65
65
|
"list.showMore": "Show more",
|
|
66
66
|
"list.sorting": "Sorting"
|
|
67
|
-
} },
|
|
67
|
+
} }, F = (s) => {
|
|
68
68
|
const { children: t, locales: e, variables: a } = s;
|
|
69
69
|
return v(e).format(t, a);
|
|
70
|
-
},
|
|
71
|
-
const s = g(), t = s.sorting.map((
|
|
70
|
+
}, $t = () => {
|
|
71
|
+
const s = g(), t = s.sorting.map((n) => /* @__PURE__ */ i.createElement(xt, { sorting: n, key: n.id }));
|
|
72
72
|
if (s.sorting.length === 0)
|
|
73
73
|
return null;
|
|
74
|
-
const e = s.sorting.find((
|
|
75
|
-
|
|
74
|
+
const e = s.sorting.find((n) => n.isSorted()), a = /* @__PURE__ */ i.createElement(y, null, e ? /* @__PURE__ */ i.createElement(
|
|
75
|
+
F,
|
|
76
76
|
{
|
|
77
77
|
locales: h,
|
|
78
78
|
variables: {
|
|
@@ -80,40 +80,40 @@ const Q = et({}), g = () => at(Q).list, Dt = () => g().loader.getLoaderInvocatio
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"list.setSorting"
|
|
83
|
-
) : /* @__PURE__ */
|
|
84
|
-
return /* @__PURE__ */
|
|
83
|
+
) : /* @__PURE__ */ i.createElement(F, { locales: h }, "list.sorting"));
|
|
84
|
+
return /* @__PURE__ */ i.createElement(T, null, /* @__PURE__ */ i.createElement(p, { variant: "soft", size: "s", color: "secondary" }, a, /* @__PURE__ */ i.createElement(W, null)), /* @__PURE__ */ i.createElement(
|
|
85
85
|
j,
|
|
86
86
|
{
|
|
87
87
|
selectionMode: "single",
|
|
88
|
-
selectedKeys: e ? [e.
|
|
89
|
-
onAction: (
|
|
90
|
-
s.getSorting(String(
|
|
88
|
+
selectedKeys: e ? [e.id] : [],
|
|
89
|
+
onAction: (n) => {
|
|
90
|
+
s.getSorting(String(n)).enable();
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
93
|
t
|
|
94
94
|
));
|
|
95
|
-
},
|
|
96
|
-
const { filter: t } = s, e = t.
|
|
97
|
-
t.toggleValue(
|
|
95
|
+
}, Ot = (s) => {
|
|
96
|
+
const { filter: t } = s, { values: e, mode: a, name: n, property: o } = t, c = e.map((l) => /* @__PURE__ */ i.createElement(J, { key: t.getValueId(l), id: String(l) }, String(l))), u = e.filter((l) => t.isValueActive(l)).map((l) => String(l)), d = (l) => {
|
|
97
|
+
t.toggleValue(l);
|
|
98
98
|
};
|
|
99
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ i.createElement(T, null, /* @__PURE__ */ i.createElement(p, { variant: "soft", size: "s", color: "secondary" }, /* @__PURE__ */ i.createElement(y, null, n ?? o), /* @__PURE__ */ i.createElement(W, null)), /* @__PURE__ */ i.createElement(
|
|
100
100
|
j,
|
|
101
101
|
{
|
|
102
|
-
onAction:
|
|
103
|
-
selectionMode: "multiple",
|
|
104
|
-
selectedKeys:
|
|
102
|
+
onAction: d,
|
|
103
|
+
selectionMode: a === "one" ? "single" : "multiple",
|
|
104
|
+
selectedKeys: u
|
|
105
105
|
},
|
|
106
|
-
|
|
106
|
+
c
|
|
107
107
|
));
|
|
108
|
-
},
|
|
109
|
-
header:
|
|
110
|
-
pickerList:
|
|
111
|
-
},
|
|
112
|
-
activeFilters:
|
|
113
|
-
clearButton:
|
|
114
|
-
},
|
|
108
|
+
}, Ut = "flow--list--header", Ht = "flow--list--header--picker-list", H = {
|
|
109
|
+
header: Ut,
|
|
110
|
+
pickerList: Ht
|
|
111
|
+
}, qt = "flow--list--header--active-filters", Kt = "flow--list--header--clear-button", q = {
|
|
112
|
+
activeFilters: qt,
|
|
113
|
+
clearButton: Kt
|
|
114
|
+
}, jt = () => {
|
|
115
115
|
const s = g(), t = s.filters.flatMap(
|
|
116
|
-
(e) => e.values.filter((a) => e.isValueActive(a)).map((a) => /* @__PURE__ */
|
|
116
|
+
(e) => e.values.filter((a) => e.isValueActive(a)).map((a) => /* @__PURE__ */ i.createElement(
|
|
117
117
|
p,
|
|
118
118
|
{
|
|
119
119
|
variant: "soft",
|
|
@@ -121,11 +121,11 @@ const Q = et({}), g = () => at(Q).list, Dt = () => g().loader.getLoaderInvocatio
|
|
|
121
121
|
key: String(a),
|
|
122
122
|
onPress: () => e.deactivateValue(a)
|
|
123
123
|
},
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ i.createElement(y, null, String(a)),
|
|
125
|
+
/* @__PURE__ */ i.createElement(dt, null)
|
|
126
126
|
))
|
|
127
127
|
);
|
|
128
|
-
return t.length <= 0 ? null : /* @__PURE__ */
|
|
128
|
+
return t.length <= 0 ? null : /* @__PURE__ */ i.createElement("div", { className: q.activeFilters }, t, /* @__PURE__ */ i.createElement(
|
|
129
129
|
p,
|
|
130
130
|
{
|
|
131
131
|
className: q.clearButton,
|
|
@@ -133,18 +133,18 @@ const Q = et({}), g = () => at(Q).list, Dt = () => g().loader.getLoaderInvocatio
|
|
|
133
133
|
variant: "plain",
|
|
134
134
|
onPress: () => s.clearFilters()
|
|
135
135
|
},
|
|
136
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ i.createElement(F, { locales: h }, "list.resetAll")
|
|
137
137
|
));
|
|
138
|
-
},
|
|
139
|
-
const { className: t } = s, a = g().filters.map((
|
|
140
|
-
return /* @__PURE__ */
|
|
141
|
-
},
|
|
142
|
-
list:
|
|
138
|
+
}, Jt = (s) => {
|
|
139
|
+
const { className: t } = s, a = g().filters.map((n) => /* @__PURE__ */ i.createElement(Ot, { key: n.property, filter: n }));
|
|
140
|
+
return /* @__PURE__ */ i.createElement("div", { className: k(t, H.header) }, /* @__PURE__ */ i.createElement("div", { className: H.pickerList }, /* @__PURE__ */ i.createElement($t, null), a), /* @__PURE__ */ i.createElement(jt, null));
|
|
141
|
+
}, Wt = "flow--list", Yt = {
|
|
142
|
+
list: Wt
|
|
143
143
|
}, S = class S {
|
|
144
144
|
constructor(t, e, a) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
r(this, "id");
|
|
146
|
+
r(this, "data");
|
|
147
|
+
r(this, "collection");
|
|
148
148
|
this.collection = t, this.id = e, this.data = a;
|
|
149
149
|
}
|
|
150
150
|
render() {
|
|
@@ -154,26 +154,26 @@ const Q = et({}), g = () => at(Q).list, Dt = () => g().loader.getLoaderInvocatio
|
|
|
154
154
|
return new S(t, e.id, e.original);
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
|
-
|
|
158
|
-
let
|
|
157
|
+
r(S, "fallbackRenderItemFn", (t) => lt("pre", void 0, JSON.stringify(t)));
|
|
158
|
+
let w = S;
|
|
159
159
|
class B {
|
|
160
160
|
constructor(t) {
|
|
161
|
-
|
|
161
|
+
r(this, "list");
|
|
162
162
|
this.list = t;
|
|
163
163
|
}
|
|
164
164
|
static useNew(t) {
|
|
165
165
|
return new B(t);
|
|
166
166
|
}
|
|
167
167
|
get entries() {
|
|
168
|
-
return this.list.reactTable.table.getRowModel().rows.map((t) =>
|
|
168
|
+
return this.list.reactTable.table.getRowModel().rows.map((t) => w.fromRow(this, t));
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
class
|
|
171
|
+
class Gt {
|
|
172
172
|
constructor(t, e = {}) {
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
r(this, "batchSize");
|
|
174
|
+
r(this, "list");
|
|
175
175
|
const { batchSize: a = 20 } = e;
|
|
176
|
-
this.list = t, this.batchSize = a, t.filters.forEach((
|
|
176
|
+
this.list = t, this.batchSize = a, t.filters.forEach((n) => n.onFilterUpdated(() => this.reset()));
|
|
177
177
|
}
|
|
178
178
|
get reactTable() {
|
|
179
179
|
return this.list.reactTable.table;
|
|
@@ -217,38 +217,38 @@ class qt {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
const
|
|
221
|
-
class
|
|
220
|
+
const Qt = (s, t) => s === t;
|
|
221
|
+
class Xt {
|
|
222
222
|
constructor(t, e) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
this.list = t, this.property = e.property, this.mode = e.mode ?? "one", this._values = e.values, this.matcher = e.matcher ??
|
|
223
|
+
r(this, "_values");
|
|
224
|
+
r(this, "list");
|
|
225
|
+
r(this, "property");
|
|
226
|
+
r(this, "mode");
|
|
227
|
+
r(this, "matcher");
|
|
228
|
+
r(this, "name");
|
|
229
|
+
r(this, "onFilterUpdateCallbacks", /* @__PURE__ */ new Set());
|
|
230
|
+
this.list = t, this.property = e.property, this.mode = e.mode ?? "one", this._values = e.values, this.matcher = e.matcher ?? Qt, this.name = e.name;
|
|
231
231
|
}
|
|
232
232
|
updateTableColumnDef(t) {
|
|
233
233
|
t.enableColumnFilter = !0, t.filterFn = this.getReactTableFilterFn();
|
|
234
234
|
}
|
|
235
235
|
getReactTableFilterFn() {
|
|
236
236
|
return (t, e, a) => this.checkFilterMatches(
|
|
237
|
-
|
|
237
|
+
ht(t.original, this.property),
|
|
238
238
|
a
|
|
239
239
|
);
|
|
240
240
|
}
|
|
241
241
|
checkFilterMatches(t, e) {
|
|
242
242
|
if (e === null)
|
|
243
243
|
return !0;
|
|
244
|
-
const a = (
|
|
244
|
+
const a = (o) => Array.isArray(o) ? o : [o], n = (o) => this.matcher(o, t);
|
|
245
245
|
if (this.mode === "all")
|
|
246
|
-
return a(e).every(
|
|
246
|
+
return a(e).every(n);
|
|
247
247
|
if (this.mode === "some") {
|
|
248
|
-
const
|
|
249
|
-
return
|
|
248
|
+
const o = a(e);
|
|
249
|
+
return o.length === 0 || o.some(n);
|
|
250
250
|
} else if (this.mode === "one")
|
|
251
|
-
return
|
|
251
|
+
return n(e);
|
|
252
252
|
throw new Error(`Unknown filter mode '${this.mode}'`);
|
|
253
253
|
}
|
|
254
254
|
getTableColumnFilter() {
|
|
@@ -280,12 +280,12 @@ class jt {
|
|
|
280
280
|
activateValue(t) {
|
|
281
281
|
const e = this.getArrayValue();
|
|
282
282
|
let a;
|
|
283
|
-
this.mode === "all" || this.mode === "some" ? a = [...e, t] : a = t, this.list.reactTable.getTableColumn(this.property).setFilterValue(a), this.onFilterUpdateCallbacks.forEach((
|
|
283
|
+
this.mode === "all" || this.mode === "some" ? a = [...e, t] : a = t, this.list.reactTable.getTableColumn(this.property).setFilterValue(a), this.onFilterUpdateCallbacks.forEach((n) => n());
|
|
284
284
|
}
|
|
285
285
|
deactivateValue(t) {
|
|
286
286
|
const e = this.getArrayValue();
|
|
287
287
|
let a;
|
|
288
|
-
this.mode === "all" || this.mode === "some" ? a = e.filter((
|
|
288
|
+
this.mode === "all" || this.mode === "some" ? a = e.filter((n) => n !== t) : a = null, this.list.reactTable.getTableColumn(this.property).setFilterValue(a), this.onFilterUpdateCallbacks.forEach((n) => n());
|
|
289
289
|
}
|
|
290
290
|
clearValues() {
|
|
291
291
|
let t;
|
|
@@ -293,27 +293,27 @@ class jt {
|
|
|
293
293
|
}
|
|
294
294
|
toggleValue(t) {
|
|
295
295
|
const e = this.isValueActive(t), a = this.getArrayValue();
|
|
296
|
-
let
|
|
297
|
-
this.mode === "all" || this.mode === "some" ? e ?
|
|
296
|
+
let n;
|
|
297
|
+
this.mode === "all" || this.mode === "some" ? e ? n = a.filter((o) => o !== t) : n = [...a, t] : n = e ? null : t, this.list.reactTable.getTableColumn(this.property).setFilterValue(n), this.onFilterUpdateCallbacks.forEach((o) => o());
|
|
298
298
|
}
|
|
299
299
|
onFilterUpdated(t) {
|
|
300
300
|
this.onFilterUpdateCallbacks.add(t);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
class
|
|
303
|
+
class Zt {
|
|
304
304
|
constructor(t, e) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
305
|
+
r(this, "list");
|
|
306
|
+
r(this, "property");
|
|
307
|
+
r(this, "name");
|
|
308
|
+
r(this, "direction");
|
|
309
|
+
r(this, "defaultEnabled");
|
|
310
310
|
this.list = t, this.property = e.property, this.name = e.name, this.direction = e.direction ?? "asc", this.defaultEnabled = !!e.defaultEnabled;
|
|
311
311
|
}
|
|
312
312
|
updateTableColumnDef(t) {
|
|
313
313
|
t.enableSorting = !0;
|
|
314
314
|
}
|
|
315
315
|
isSorted() {
|
|
316
|
-
return this.
|
|
316
|
+
return this.getTableColumn().getIsSorted() == this.direction;
|
|
317
317
|
}
|
|
318
318
|
getTableColumn() {
|
|
319
319
|
return this.list.reactTable.getTableColumn(this.property);
|
|
@@ -324,52 +324,55 @@ class Jt {
|
|
|
324
324
|
clear() {
|
|
325
325
|
this.list.reactTable.getTableColumn(this.property).clearSorting();
|
|
326
326
|
}
|
|
327
|
+
get id() {
|
|
328
|
+
return `${this.getTableColumn().id}:${this.direction}`;
|
|
329
|
+
}
|
|
327
330
|
}
|
|
328
|
-
const
|
|
331
|
+
const _t = (s) => I(Ct(s));
|
|
329
332
|
class A {
|
|
330
333
|
constructor(t, e = {}) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
334
|
+
r(this, "list");
|
|
335
|
+
r(this, "table");
|
|
336
|
+
r(this, "tableState");
|
|
337
|
+
r(this, "onTableStateChange", (t) => {
|
|
335
338
|
const e = this.tableState.value;
|
|
336
339
|
if (!e)
|
|
337
340
|
return;
|
|
338
341
|
const a = typeof t == "function" ? t(e) : t;
|
|
339
|
-
|
|
342
|
+
Et(() => {
|
|
340
343
|
this.tableState.value = this.getUpdatedTableState(e, a);
|
|
341
344
|
});
|
|
342
345
|
});
|
|
343
|
-
this.list = t, this.tableState =
|
|
346
|
+
this.list = t, this.tableState = vt(() => ({ value: void 0 })), this.table = this.useReactTable(e);
|
|
344
347
|
}
|
|
345
348
|
static useNew(t, e = {}) {
|
|
346
349
|
return new A(t, e);
|
|
347
350
|
}
|
|
348
351
|
useReactTable(t = {}) {
|
|
349
|
-
const e = this.list.loader.useData(), a = this.list.sorting.filter((
|
|
352
|
+
const e = this.list.loader.useData(), a = this.list.sorting.filter((o) => o.defaultEnabled), n = gt({
|
|
350
353
|
data: e,
|
|
351
354
|
initialState: {
|
|
352
355
|
pagination: {
|
|
353
356
|
pageSize: this.list.batches.batchSize
|
|
354
357
|
},
|
|
355
|
-
sorting: a.map((
|
|
356
|
-
id: String(
|
|
357
|
-
desc:
|
|
358
|
+
sorting: a.map((o) => ({
|
|
359
|
+
id: String(o.property),
|
|
360
|
+
desc: o.direction === "desc"
|
|
358
361
|
}))
|
|
359
362
|
},
|
|
360
363
|
columns: this.getTableColumnDefs(),
|
|
361
|
-
getCoreRowModel:
|
|
362
|
-
getSortedRowModel:
|
|
363
|
-
getFilteredRowModel:
|
|
364
|
-
getPaginationRowModel:
|
|
365
|
-
getFacetedUniqueValues:
|
|
364
|
+
getCoreRowModel: pt(),
|
|
365
|
+
getSortedRowModel: ft(),
|
|
366
|
+
getFilteredRowModel: bt(),
|
|
367
|
+
getPaginationRowModel: St(),
|
|
368
|
+
getFacetedUniqueValues: yt(),
|
|
366
369
|
onStateChange: this.onTableStateChange,
|
|
367
370
|
...t
|
|
368
371
|
});
|
|
369
|
-
return this.useUpdateTableState(
|
|
372
|
+
return this.useUpdateTableState(n), n;
|
|
370
373
|
}
|
|
371
374
|
useUpdateTableState(t) {
|
|
372
|
-
|
|
375
|
+
_t(() => {
|
|
373
376
|
const e = this.tableState.value;
|
|
374
377
|
e ? t.setOptions((a) => ({
|
|
375
378
|
...a,
|
|
@@ -386,16 +389,16 @@ class A {
|
|
|
386
389
|
}
|
|
387
390
|
getTableColumnDefs() {
|
|
388
391
|
const t = /* @__PURE__ */ new Map(), e = (a) => {
|
|
389
|
-
const
|
|
390
|
-
if (
|
|
391
|
-
return
|
|
392
|
-
const
|
|
392
|
+
const n = t.get(a);
|
|
393
|
+
if (n)
|
|
394
|
+
return n;
|
|
395
|
+
const o = {
|
|
393
396
|
id: a,
|
|
394
397
|
accessorKey: a,
|
|
395
398
|
enableSorting: !1,
|
|
396
399
|
enableColumnFilter: !1
|
|
397
400
|
};
|
|
398
|
-
return t.set(a,
|
|
401
|
+
return t.set(a, o), o;
|
|
399
402
|
};
|
|
400
403
|
return this.list.filters.forEach(
|
|
401
404
|
(a) => a.updateTableColumnDef(e(a.property))
|
|
@@ -406,21 +409,21 @@ class A {
|
|
|
406
409
|
}
|
|
407
410
|
class D {
|
|
408
411
|
constructor() {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
dataBatches:
|
|
414
|
-
batchLoadingStates:
|
|
415
|
-
mergedData:
|
|
416
|
-
isLoading:
|
|
417
|
-
reset:
|
|
418
|
-
setDataBatch:
|
|
419
|
-
setBatchLoadingState:
|
|
412
|
+
r(this, "dataBatches", []);
|
|
413
|
+
r(this, "prevDataBatches", []);
|
|
414
|
+
r(this, "batchLoadingStates", ["void"]);
|
|
415
|
+
Lt(this, {
|
|
416
|
+
dataBatches: z.shallow,
|
|
417
|
+
batchLoadingStates: z.shallow,
|
|
418
|
+
mergedData: M,
|
|
419
|
+
isLoading: M,
|
|
420
|
+
reset: L.bound,
|
|
421
|
+
setDataBatch: L.bound,
|
|
422
|
+
setBatchLoadingState: L.bound
|
|
420
423
|
});
|
|
421
424
|
}
|
|
422
425
|
static useNew() {
|
|
423
|
-
return
|
|
426
|
+
return ct(new D()).current;
|
|
424
427
|
}
|
|
425
428
|
reset() {
|
|
426
429
|
this.batchLoadingStates = [], this.dataBatches = [];
|
|
@@ -444,19 +447,19 @@ class D {
|
|
|
444
447
|
return $(() => this.isLoading);
|
|
445
448
|
}
|
|
446
449
|
}
|
|
447
|
-
const
|
|
450
|
+
const te = [];
|
|
448
451
|
class N {
|
|
449
452
|
constructor(t, e = {}) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
453
|
+
r(this, "list");
|
|
454
|
+
r(this, "dataSource");
|
|
455
|
+
r(this, "manualSorting");
|
|
456
|
+
r(this, "manualFiltering");
|
|
457
|
+
r(this, "manualPagination");
|
|
458
|
+
r(this, "loaderState");
|
|
456
459
|
const { source: a } = e;
|
|
457
|
-
this.dataSource = a ?? { staticData:
|
|
458
|
-
const
|
|
459
|
-
this.list = t, this.loaderState = D.useNew(), this.manualPagination =
|
|
460
|
+
this.dataSource = a ?? { staticData: te };
|
|
461
|
+
const n = "manualPagination" in this.dataSource ? this.dataSource.manualPagination : void 0, o = "manualFiltering" in this.dataSource ? this.dataSource.manualFiltering : void 0, c = "manualSorting" in this.dataSource ? this.dataSource.manualSorting : void 0;
|
|
462
|
+
this.list = t, this.loaderState = D.useNew(), this.manualPagination = n ?? !1, this.manualFiltering = o ?? this.manualPagination, this.manualSorting = c ?? this.manualPagination, this.list.filters.forEach((u) => u.onFilterUpdated(() => this.reset()));
|
|
460
463
|
}
|
|
461
464
|
static useNew(t, e = {}) {
|
|
462
465
|
return new N(t, e);
|
|
@@ -474,7 +477,7 @@ class N {
|
|
|
474
477
|
return this.loaderState.useMergedData();
|
|
475
478
|
}
|
|
476
479
|
getLoaderInvocationHooks() {
|
|
477
|
-
return
|
|
480
|
+
return It(this.list.batches.getBatchIndex() + 1, (e) => e).map((e) => () => {
|
|
478
481
|
this.useLoadBatch(e);
|
|
479
482
|
});
|
|
480
483
|
}
|
|
@@ -485,7 +488,7 @@ class N {
|
|
|
485
488
|
}), this.useObserveBatchData(e, t), this.useObserveBatchLoadingState(e, t);
|
|
486
489
|
}
|
|
487
490
|
useObserveBatchLoadingState(t, e) {
|
|
488
|
-
|
|
491
|
+
I(() => (this.loaderState.setBatchLoadingState(
|
|
489
492
|
e,
|
|
490
493
|
t.state.value
|
|
491
494
|
), t.state.observe((a) => {
|
|
@@ -493,12 +496,12 @@ class N {
|
|
|
493
496
|
})), [t, e]);
|
|
494
497
|
}
|
|
495
498
|
useObserveBatchData(t, e) {
|
|
496
|
-
const a = (
|
|
497
|
-
const { data:
|
|
498
|
-
this.loaderState.setDataBatch(e,
|
|
499
|
+
const a = (n) => {
|
|
500
|
+
const { data: o, itemTotalCount: c } = n;
|
|
501
|
+
this.loaderState.setDataBatch(e, o), c !== void 0 && this.list.batches.updateItemTotalCount(c);
|
|
499
502
|
};
|
|
500
|
-
|
|
501
|
-
|
|
503
|
+
I(() => (t.value.value.isSet && a(t.value.value.value), t.value.observe((n) => {
|
|
504
|
+
n.isSet && a(n.value);
|
|
502
505
|
})), [t, e]);
|
|
503
506
|
}
|
|
504
507
|
getDataLoaderOptions(t) {
|
|
@@ -522,34 +525,34 @@ class N {
|
|
|
522
525
|
const e = this.dataSource, a = this.getDataLoaderOptions(t);
|
|
523
526
|
if ("staticData" in e)
|
|
524
527
|
return x(
|
|
525
|
-
async (
|
|
526
|
-
data:
|
|
527
|
-
itemTotalCount:
|
|
528
|
+
async (n) => ({
|
|
529
|
+
data: n,
|
|
530
|
+
itemTotalCount: n.length
|
|
528
531
|
}),
|
|
529
532
|
[e.staticData]
|
|
530
533
|
);
|
|
531
534
|
if ("asyncLoader" in e) {
|
|
532
|
-
const
|
|
533
|
-
return x(
|
|
535
|
+
const n = e.asyncLoader;
|
|
536
|
+
return x(n, [a]);
|
|
534
537
|
}
|
|
535
538
|
if ("asyncResourceFactory" in e) {
|
|
536
|
-
const
|
|
537
|
-
return
|
|
539
|
+
const n = e.asyncResourceFactory;
|
|
540
|
+
return n(a);
|
|
538
541
|
}
|
|
539
542
|
throw new Error("Unknown data source");
|
|
540
543
|
}
|
|
541
544
|
}
|
|
542
|
-
let
|
|
545
|
+
let ee = class X {
|
|
543
546
|
constructor(t) {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const { render: e, filters: a = [], sorting:
|
|
552
|
-
this.render = e, this.items = B.useNew(this), this.filters = a.map((
|
|
547
|
+
r(this, "filters");
|
|
548
|
+
r(this, "sorting");
|
|
549
|
+
r(this, "items");
|
|
550
|
+
r(this, "render");
|
|
551
|
+
r(this, "reactTable");
|
|
552
|
+
r(this, "batches");
|
|
553
|
+
r(this, "loader");
|
|
554
|
+
const { render: e, filters: a = [], sorting: n = [], batchesController: o } = t;
|
|
555
|
+
this.render = e, this.items = B.useNew(this), this.filters = a.map((c) => new Xt(this, c)), this.sorting = n.map((c) => new Zt(this, c)), this.batches = new Gt(this, o), this.loader = N.useNew(this, t.loader), this.reactTable = A.useNew(this, {
|
|
553
556
|
manualFiltering: this.loader.manualFiltering,
|
|
554
557
|
manualPagination: this.loader.manualPagination,
|
|
555
558
|
manualSorting: this.loader.manualSorting
|
|
@@ -562,8 +565,8 @@ let Gt = class X {
|
|
|
562
565
|
return this.filters.some((t) => t.isActive());
|
|
563
566
|
}
|
|
564
567
|
getSorting(t) {
|
|
565
|
-
const e = this.sorting.find((a) => a.
|
|
566
|
-
return Y(!!e, `Could not get Sorting (
|
|
568
|
+
const e = this.sorting.find((a) => a.id === t);
|
|
569
|
+
return Y(!!e, `Could not get Sorting (ID: ${t})`), e;
|
|
567
570
|
}
|
|
568
571
|
clearSorting() {
|
|
569
572
|
return this.sorting.forEach((t) => t.clear());
|
|
@@ -575,51 +578,51 @@ let Gt = class X {
|
|
|
575
578
|
return !this.loader.useIsLoading() && this.items.entries.length === 0;
|
|
576
579
|
}
|
|
577
580
|
};
|
|
578
|
-
const
|
|
579
|
-
itemList:
|
|
580
|
-
isLoading:
|
|
581
|
-
},
|
|
582
|
-
item:
|
|
583
|
-
title:
|
|
584
|
-
topContent:
|
|
585
|
-
content:
|
|
586
|
-
action:
|
|
587
|
-
avatar:
|
|
588
|
-
text:
|
|
589
|
-
heading:
|
|
581
|
+
const ae = "flow--list--items--item-list", se = "flow--list--items--is-loading", K = {
|
|
582
|
+
itemList: ae,
|
|
583
|
+
isLoading: se
|
|
584
|
+
}, ie = "flow--list--items--item", ne = "flow--list--items--title", re = "flow--list--items--top-content", oe = "flow--list--items--content", le = "flow--list--items--action", ce = "flow--list--items--avatar", ue = "flow--list--items--text", me = "flow--list--items--heading", m = {
|
|
585
|
+
item: ie,
|
|
586
|
+
title: ne,
|
|
587
|
+
topContent: re,
|
|
588
|
+
content: oe,
|
|
589
|
+
action: le,
|
|
590
|
+
avatar: ce,
|
|
591
|
+
text: ue,
|
|
592
|
+
heading: me,
|
|
590
593
|
"container-breakpoint-size-xs": "flow--list--items--container-breakpoint-size-xs",
|
|
591
594
|
"container-breakpoint-size-s": "flow--list--items--container-breakpoint-size-s",
|
|
592
595
|
"container-breakpoint-size-m": "flow--list--items--container-breakpoint-size-m",
|
|
593
596
|
"container-breakpoint-size-l": "flow--list--items--container-breakpoint-size-l",
|
|
594
597
|
"container-breakpoint-size-xl": "flow--list--items--container-breakpoint-size-xl"
|
|
595
|
-
},
|
|
598
|
+
}, de = (s) => {
|
|
596
599
|
const { className: t, children: e } = s, a = v(h);
|
|
597
|
-
return /* @__PURE__ */
|
|
600
|
+
return /* @__PURE__ */ i.createElement(T, null, /* @__PURE__ */ i.createElement(
|
|
598
601
|
p,
|
|
599
602
|
{
|
|
600
603
|
variant: "plain",
|
|
601
604
|
className: t,
|
|
602
605
|
"aria-label": a.format("list.options")
|
|
603
606
|
},
|
|
604
|
-
/* @__PURE__ */
|
|
607
|
+
/* @__PURE__ */ i.createElement(At, null)
|
|
605
608
|
), e);
|
|
606
|
-
},
|
|
609
|
+
}, he = (s) => s === "top" ? m.topContent : s === "bottom" ? m.content : m.topContent, Z = (s) => {
|
|
607
610
|
const {
|
|
608
611
|
children: t,
|
|
609
612
|
href: e,
|
|
610
613
|
className: a,
|
|
611
|
-
containerBreakpointSize:
|
|
612
|
-
...
|
|
613
|
-
} = s,
|
|
614
|
+
containerBreakpointSize: n = "m",
|
|
615
|
+
...o
|
|
616
|
+
} = s, c = {
|
|
614
617
|
ContextMenu: {
|
|
615
|
-
wrapWith: /* @__PURE__ */
|
|
618
|
+
wrapWith: /* @__PURE__ */ i.createElement(de, { className: m.action }),
|
|
616
619
|
placement: "bottom end"
|
|
617
620
|
},
|
|
618
621
|
Button: {
|
|
619
622
|
className: m.action
|
|
620
623
|
},
|
|
621
624
|
Content: {
|
|
622
|
-
className:
|
|
625
|
+
className: Bt((l) => he(l.slot)),
|
|
623
626
|
tunnelId: "topContent"
|
|
624
627
|
},
|
|
625
628
|
Avatar: {
|
|
@@ -641,54 +644,38 @@ const Qt = "flow--list--items--item-list", Xt = "flow--list--items--is-loading",
|
|
|
641
644
|
}, u = k(
|
|
642
645
|
m.item,
|
|
643
646
|
a,
|
|
644
|
-
m[
|
|
645
|
-
), d = (
|
|
646
|
-
return /* @__PURE__ */
|
|
647
|
-
}, b = () => /* @__PURE__ */
|
|
648
|
-
const { className: t } = s, e = g(), a = e.loader.useIsLoading(),
|
|
647
|
+
m[Rt(n)]
|
|
648
|
+
), d = (l) => e ? /* @__PURE__ */ i.createElement(Nt, { unstyled: !0, ...o, className: u, href: e }, l.children) : /* @__PURE__ */ i.createElement("div", { className: u }, l.children);
|
|
649
|
+
return /* @__PURE__ */ i.createElement(d, null, /* @__PURE__ */ i.createElement(kt, { props: c }, /* @__PURE__ */ i.createElement(Dt, null, t, /* @__PURE__ */ i.createElement("div", { className: m.title }, /* @__PURE__ */ i.createElement(O, { id: "title" })), /* @__PURE__ */ i.createElement(O, { id: "topContent" }))));
|
|
650
|
+
}, b = () => /* @__PURE__ */ i.createElement(Z, null, /* @__PURE__ */ i.createElement(G, { height: "3rem" })), ge = (s) => {
|
|
651
|
+
const { className: t } = s, e = g(), a = e.loader.useIsLoading(), n = e.loader.useIsInitiallyLoading(), o = e.useIsEmpty(), c = v(h), u = e.items.entries.map((l) => /* @__PURE__ */ i.createElement(ut, { key: l.id }, l.render())), d = k(
|
|
649
652
|
K.itemList,
|
|
650
653
|
t,
|
|
651
654
|
a && K.isLoading
|
|
652
655
|
);
|
|
653
|
-
return
|
|
654
|
-
},
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
return null;
|
|
660
|
-
}
|
|
661
|
-
function de(s) {
|
|
662
|
-
return null;
|
|
663
|
-
}
|
|
664
|
-
function he(s) {
|
|
665
|
-
return null;
|
|
666
|
-
}
|
|
667
|
-
function ge(s) {
|
|
668
|
-
return null;
|
|
669
|
-
}
|
|
670
|
-
const pe = "flow--list--footer", fe = {
|
|
671
|
-
footer: pe
|
|
672
|
-
}, be = (s) => {
|
|
673
|
-
const t = v(h), e = g(), a = e.batches, i = e.isFiltered() && !e.loader.manualFiltering, r = e.loader.useIsInitiallyLoading(), l = e.useIsEmpty(), u = a.getTotalItemsCount() ?? 0, d = a.getFilteredItemsCount() ?? 0, c = a.getVisibleItemsCount() ?? 0;
|
|
674
|
-
if (l)
|
|
656
|
+
return o ? /* @__PURE__ */ i.createElement(Ft, null, /* @__PURE__ */ i.createElement(wt, null), /* @__PURE__ */ i.createElement(Tt, null, c.format("list.noResult.heading")), /* @__PURE__ */ i.createElement(y, null, c.format("list.noResult.text"))) : /* @__PURE__ */ i.createElement("div", { className: d }, n ? pe : u);
|
|
657
|
+
}, pe = /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(b, null), /* @__PURE__ */ i.createElement(b, null), /* @__PURE__ */ i.createElement(b, null), /* @__PURE__ */ i.createElement(b, null), /* @__PURE__ */ i.createElement(b, null)), _ = (s) => null, fe = () => _, tt = (s) => null, be = () => tt, et = (s) => null, Se = () => et, at = (s) => null, ye = () => at, st = (s) => null, ve = () => st, Ce = "flow--list--footer", Ee = {
|
|
658
|
+
footer: Ce
|
|
659
|
+
}, Le = (s) => {
|
|
660
|
+
const t = v(h), e = g(), a = e.batches, n = e.isFiltered() && !e.loader.manualFiltering, o = e.loader.useIsInitiallyLoading(), c = e.useIsEmpty(), u = a.getTotalItemsCount() ?? 0, d = a.getFilteredItemsCount() ?? 0, l = a.getVisibleItemsCount() ?? 0;
|
|
661
|
+
if (c)
|
|
675
662
|
return null;
|
|
676
|
-
const C =
|
|
677
|
-
visibleItemsCount:
|
|
663
|
+
const C = o ? /* @__PURE__ */ i.createElement(G, { width: "200px" }) : n ? t.format("list.paginationInfoFiltered", {
|
|
664
|
+
visibleItemsCount: l,
|
|
678
665
|
filteredItemsCount: d,
|
|
679
666
|
totalItemsCount: u
|
|
680
667
|
}) : t.format("list.paginationInfo", {
|
|
681
|
-
visibleItemsCount:
|
|
668
|
+
visibleItemsCount: l,
|
|
682
669
|
totalItemsCount: u
|
|
683
670
|
});
|
|
684
|
-
return /* @__PURE__ */
|
|
685
|
-
},
|
|
686
|
-
const t = v(h), e = g(), a = e.loader.useIsLoading(),
|
|
687
|
-
return !e.batches.hasNextBatch() && !a ? null : /* @__PURE__ */
|
|
671
|
+
return /* @__PURE__ */ i.createElement(y, { ...s }, C);
|
|
672
|
+
}, Ie = (s) => {
|
|
673
|
+
const t = v(h), e = g(), a = e.loader.useIsLoading(), n = e.loader.useIsInitiallyLoading();
|
|
674
|
+
return !e.batches.hasNextBatch() && !a ? null : /* @__PURE__ */ i.createElement(
|
|
688
675
|
p,
|
|
689
676
|
{
|
|
690
|
-
isPending: a && !
|
|
691
|
-
isDisabled:
|
|
677
|
+
isPending: a && !n,
|
|
678
|
+
isDisabled: n,
|
|
692
679
|
...s,
|
|
693
680
|
onPress: () => e.batches.nextBatch(),
|
|
694
681
|
variant: "plain",
|
|
@@ -696,50 +683,70 @@ const pe = "flow--list--footer", fe = {
|
|
|
696
683
|
},
|
|
697
684
|
t.format("list.showMore")
|
|
698
685
|
);
|
|
699
|
-
},
|
|
700
|
-
function
|
|
701
|
-
var C,
|
|
702
|
-
const { children: t, batchSize: e, ...a } = s,
|
|
686
|
+
}, Fe = () => /* @__PURE__ */ i.createElement("div", { className: Ee.footer }, /* @__PURE__ */ i.createElement(Le, null), /* @__PURE__ */ i.createElement(Ie, null)), we = (s) => /* @__PURE__ */ i.createElement(Z, null, /* @__PURE__ */ i.createElement(zt, null, JSON.stringify(s.data)));
|
|
687
|
+
function Te(s) {
|
|
688
|
+
var C, R, P, V;
|
|
689
|
+
const { children: t, batchSize: e, ...a } = s, n = (C = E(
|
|
690
|
+
t,
|
|
691
|
+
_
|
|
692
|
+
)) == null ? void 0 : C.props, o = (R = E(
|
|
703
693
|
t,
|
|
704
|
-
|
|
705
|
-
)) == null ? void 0 :
|
|
706
|
-
source:
|
|
707
|
-
...
|
|
708
|
-
asyncLoader:
|
|
709
|
-
} :
|
|
710
|
-
...
|
|
711
|
-
asyncResourceFactory:
|
|
712
|
-
} :
|
|
713
|
-
staticData:
|
|
694
|
+
Pt
|
|
695
|
+
)) == null ? void 0 : R.props, c = (P = E(t, st)) == null ? void 0 : P.props, u = {
|
|
696
|
+
source: n ? {
|
|
697
|
+
...n,
|
|
698
|
+
asyncLoader: n.children
|
|
699
|
+
} : o ? {
|
|
700
|
+
...o,
|
|
701
|
+
asyncResourceFactory: o.children
|
|
702
|
+
} : c ? {
|
|
703
|
+
staticData: c.data
|
|
714
704
|
} : void 0
|
|
715
|
-
}, d = (f) => /* @__PURE__ */
|
|
705
|
+
}, d = (f) => /* @__PURE__ */ i.createElement(we, { data: f }), l = ee.useNew({
|
|
716
706
|
loader: u,
|
|
717
|
-
filters: U(t,
|
|
718
|
-
|
|
719
|
-
|
|
707
|
+
filters: U(t, tt).map(
|
|
708
|
+
(f) => f.props
|
|
709
|
+
),
|
|
710
|
+
sorting: U(t, et).map((f) => f.props),
|
|
711
|
+
render: ((V = E(t, at)) == null ? void 0 : V.props.children) ?? d,
|
|
720
712
|
...a,
|
|
721
713
|
batchesController: {
|
|
722
714
|
batchSize: e
|
|
723
715
|
}
|
|
724
716
|
});
|
|
725
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ i.createElement(
|
|
726
718
|
Q.Provider,
|
|
727
719
|
{
|
|
728
720
|
value: {
|
|
729
|
-
list:
|
|
721
|
+
list: l
|
|
730
722
|
}
|
|
731
723
|
},
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
724
|
+
/* @__PURE__ */ i.createElement(Mt, null),
|
|
725
|
+
/* @__PURE__ */ i.createElement("div", { className: Yt.list }, /* @__PURE__ */ i.createElement(Jt, null), /* @__PURE__ */ i.createElement(ge, null), /* @__PURE__ */ i.createElement(Fe, null))
|
|
734
726
|
);
|
|
735
727
|
}
|
|
728
|
+
const ma = () => ({
|
|
729
|
+
List: Te,
|
|
730
|
+
Filter: be(),
|
|
731
|
+
Sorting: Se(),
|
|
732
|
+
ItemView: ye(),
|
|
733
|
+
StaticData: ve(),
|
|
734
|
+
LoaderAsync: fe(),
|
|
735
|
+
LoaderAsyncResource: Vt()
|
|
736
|
+
});
|
|
736
737
|
export {
|
|
737
|
-
|
|
738
|
-
|
|
738
|
+
Te as List,
|
|
739
|
+
tt as ListFilter,
|
|
739
740
|
Z as ListItem,
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
741
|
+
at as ListItemView,
|
|
742
|
+
_ as ListLoaderAsync,
|
|
743
|
+
et as ListSorting,
|
|
744
|
+
st as ListStaticData,
|
|
745
|
+
be as TypedListFilter,
|
|
746
|
+
ye as TypedListItemView,
|
|
747
|
+
fe as TypedListLoaderAsync,
|
|
748
|
+
Se as TypedListSorting,
|
|
749
|
+
ve as TypedListStaticData,
|
|
750
|
+
Te as default,
|
|
751
|
+
ma as typedList
|
|
745
752
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { Filter } from '../../../model/filter/Filter';
|
|
3
|
-
import { AnyData } from '../../../model/item/types';
|
|
4
3
|
|
|
5
4
|
interface Props {
|
|
6
|
-
filter: Filter<
|
|
5
|
+
filter: Filter<never, never, never>;
|
|
7
6
|
}
|
|
8
7
|
export declare const FilterPicker: FC<Props>;
|
|
9
8
|
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { FilterShape } from '../../model/filter/types';
|
|
1
|
+
import { FilterShape, FilterValue } from '../../model/filter/types';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { PropertyName } from '../../model/types';
|
|
2
4
|
|
|
3
|
-
type Props<T> = Omit<FilterShape<T>, "type">;
|
|
4
|
-
export declare
|
|
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 = FilterValue<T, TProp>>(ignoredProps: Props<T, TProp, TMatcherValue>) => null;
|
|
7
|
+
export declare const TypedListFilter: <T>() => <const TProp extends PropertyName<T>, TMatcherValue = FilterValue<T, TProp>>(props: Props<T, TProp, TMatcherValue>) => ReactNode;
|
|
5
8
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SortingShape } from '../../model/sorting/types';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare function ListSorting<T = never>(ignoredProps: Props<T>): null;
|
|
4
|
+
type Props<T> = SortingShape<T>;
|
|
5
|
+
export declare const ListSorting: <T>(ignoredProps: Props<T>) => null;
|
|
6
|
+
export declare const TypedListSorting: <T>() => ComponentType<Props<T>>;
|
|
7
7
|
export {};
|
package/dist/types/components/List/components/Header/SortingPickerItem/SortingPickerItem.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { AnyData } from '../../../model/item/types';
|
|
3
2
|
import { Sorting } from '../../../model/sorting/Sorting';
|
|
4
3
|
|
|
5
4
|
interface Props {
|
|
6
|
-
sorting: Sorting<
|
|
5
|
+
sorting: Sorting<never>;
|
|
7
6
|
}
|
|
8
7
|
export declare const SortingPickerItem: FC<Props>;
|
|
9
8
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { RenderItemFn } from '../../model/item/types';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type Props<T> = {} & {
|
|
4
5
|
children: RenderItemFn<T>;
|
|
5
|
-
}
|
|
6
|
-
export declare
|
|
6
|
+
};
|
|
7
|
+
export declare const ListItemView: <T>(ignoredProps: Props<T>) => null;
|
|
8
|
+
export declare const TypedListItemView: <T>() => ComponentType<Props<T>>;
|
|
7
9
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AsyncDataLoaderShape } from '../model/loading/types';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type Props<T> = Omit<AsyncDataLoaderShape<T>, "asyncLoader"> & {
|
|
4
5
|
children: AsyncDataLoaderShape<T>["asyncLoader"];
|
|
5
|
-
}
|
|
6
|
-
export declare
|
|
6
|
+
};
|
|
7
|
+
export declare const ListLoaderAsync: <T>(ignoredProps: Props<T>) => null;
|
|
8
|
+
export declare const TypedListLoaderAsync: <T>() => ComponentType<Props<T>>;
|
|
7
9
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AsyncResourceFactoryDataLoaderShape } from '../model/loading/types';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type Props<T> = Omit<AsyncResourceFactoryDataLoaderShape<T>, "asyncResourceFactory"> & {
|
|
4
5
|
children: AsyncResourceFactoryDataLoaderShape<T>["asyncResourceFactory"];
|
|
5
|
-
}
|
|
6
|
-
export declare
|
|
6
|
+
};
|
|
7
|
+
export declare const ListLoaderAsyncResource: <T>(ignoredProps: Props<T>) => null;
|
|
8
|
+
export declare const TypedListLoaderAsyncResource: <T>() => ComponentType<Props<T>>;
|
|
7
9
|
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
|
|
3
|
+
type Props<T> = {} & {
|
|
2
4
|
data: T[];
|
|
3
|
-
}
|
|
4
|
-
export declare
|
|
5
|
+
};
|
|
6
|
+
export declare const ListStaticData: <T>(ignoredProps: Props<T>) => null;
|
|
7
|
+
export declare const TypedListStaticData: <T>() => ComponentType<Props<T>>;
|
|
5
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useList: () => import('../model/List').List<
|
|
1
|
+
export declare const useList: () => import('../model/List').List<never>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ItemCollection } from './item/ItemCollection';
|
|
2
2
|
import { BatchesController } from './pagination/BatchesController';
|
|
3
|
-
import { PropertyName, RenderItemFn } from './item/Item';
|
|
4
3
|
import { Filter } from './filter/Filter';
|
|
5
4
|
import { Sorting } from './sorting/Sorting';
|
|
6
5
|
import { default as ReactTable } from './ReactTable';
|
|
7
6
|
import { ListShape } from './types';
|
|
8
7
|
import { IncrementalLoader } from './loading/IncrementalLoader';
|
|
8
|
+
import { RenderItemFn } from './item/types';
|
|
9
9
|
|
|
10
10
|
export declare class List<T> {
|
|
11
|
-
readonly filters: Filter<T>[];
|
|
11
|
+
readonly filters: Filter<T, never, never>[];
|
|
12
12
|
readonly sorting: Sorting<T>[];
|
|
13
13
|
readonly items: ItemCollection<T>;
|
|
14
14
|
readonly render?: RenderItemFn<T>;
|
|
@@ -18,7 +18,7 @@ export declare class List<T> {
|
|
|
18
18
|
private constructor();
|
|
19
19
|
static useNew<T>(shape: ListShape<T>): List<T>;
|
|
20
20
|
isFiltered(): boolean;
|
|
21
|
-
getSorting(
|
|
21
|
+
getSorting(id: string): Sorting<T>;
|
|
22
22
|
clearSorting(): void;
|
|
23
23
|
clearFilters(): void;
|
|
24
24
|
useIsEmpty(): boolean;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Column, ColumnDef, ColumnFilter } from '@tanstack/react-table';
|
|
2
2
|
import { default as List } from '../List';
|
|
3
|
-
import { PropertyName } from '../item/Item';
|
|
4
3
|
import { FilterMatcher, FilterMode, FilterShape } from './types';
|
|
4
|
+
import { PropertyName } from '../types';
|
|
5
5
|
|
|
6
|
-
export declare class Filter<T> {
|
|
6
|
+
export declare class Filter<T, TProp extends PropertyName<T>, TMatchValue> {
|
|
7
7
|
private readonly _values?;
|
|
8
8
|
readonly list: List<T>;
|
|
9
9
|
readonly property: PropertyName<T>;
|
|
10
10
|
readonly mode: FilterMode;
|
|
11
|
-
readonly matcher: FilterMatcher
|
|
11
|
+
readonly matcher: FilterMatcher<T, never, never>;
|
|
12
12
|
readonly name?: string;
|
|
13
13
|
private onFilterUpdateCallbacks;
|
|
14
|
-
constructor(list: List<T>, shape: FilterShape<T>);
|
|
14
|
+
constructor(list: List<T>, shape: FilterShape<T, TProp, TMatchValue>);
|
|
15
15
|
updateTableColumnDef(def: ColumnDef<T>): void;
|
|
16
16
|
private getReactTableFilterFn;
|
|
17
17
|
private checkFilterMatches;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ItemType } from '../../../../lib/types/array';
|
|
2
|
+
import { PropertyName, PropertyValue } from '../types';
|
|
2
3
|
|
|
3
4
|
export type FilterMode = "all" | "some" | "one";
|
|
4
|
-
export type
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
export type FilterValue<T, P> = ItemType<NonNullable<PropertyValue<T, P>>>;
|
|
6
|
+
export type FilterMatcher<T, P, TMatcherValue> = (filterBy: FilterValue<T, P>, filterFrom: TMatcherValue[]) => boolean;
|
|
7
|
+
export interface FilterShape<T, TProp extends PropertyName<T>, TMatcherValue> {
|
|
8
|
+
property: TProp;
|
|
7
9
|
mode?: FilterMode;
|
|
8
|
-
matcher?: FilterMatcher
|
|
9
|
-
values?:
|
|
10
|
+
matcher?: FilterMatcher<T, TProp, TMatcherValue>;
|
|
11
|
+
values?: TMatcherValue[];
|
|
10
12
|
name?: string;
|
|
11
13
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ItemCollection } from './ItemCollection';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Row } from '@tanstack/react-table';
|
|
4
4
|
|
|
5
|
-
export type PropertyName<T> = DeepKeys<T>;
|
|
6
|
-
export type RenderItemFn<T> = (data: T) => ReactNode;
|
|
7
5
|
export declare class Item<T> {
|
|
8
6
|
readonly id: string;
|
|
9
7
|
readonly data: T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Column, ColumnDef, SortDirection } from '@tanstack/react-table';
|
|
2
2
|
import { default as List } from '../List';
|
|
3
|
-
import { PropertyName } from '../item/Item';
|
|
4
3
|
import { SortingShape } from './types';
|
|
4
|
+
import { PropertyName } from '../types';
|
|
5
5
|
|
|
6
6
|
export declare class Sorting<T> {
|
|
7
7
|
readonly list: List<T>;
|
|
@@ -15,4 +15,5 @@ export declare class Sorting<T> {
|
|
|
15
15
|
getTableColumn(): Column<T>;
|
|
16
16
|
enable(): void;
|
|
17
17
|
clear(): void;
|
|
18
|
+
get id(): string;
|
|
18
19
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeepKeys, DeepValue } from '@tanstack/react-table';
|
|
2
2
|
import { SortingShape } from './sorting/types';
|
|
3
3
|
import { BatchesControllerShape } from './pagination/types';
|
|
4
4
|
import { FilterShape } from './filter/types';
|
|
5
5
|
import { IncrementalLoaderShape } from './loading/types';
|
|
6
|
+
import { RenderItemFn } from './item/types';
|
|
6
7
|
|
|
8
|
+
export type PropertyName<T> = never extends T ? string : DeepKeys<T>;
|
|
9
|
+
export type PropertyValue<T, TProp> = DeepValue<T, TProp>;
|
|
7
10
|
export interface ListShape<T> {
|
|
8
11
|
loader?: IncrementalLoaderShape<T>;
|
|
9
12
|
render?: RenderItemFn<T>;
|
|
10
|
-
filters?: FilterShape<T>[];
|
|
13
|
+
filters?: FilterShape<T, never, never>[];
|
|
11
14
|
sorting?: SortingShape<T>[];
|
|
12
15
|
batchesController?: BatchesControllerShape;
|
|
13
16
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as List } from './List';
|
|
2
|
+
|
|
3
|
+
export declare const typedList: <T>() => {
|
|
4
|
+
List: typeof List;
|
|
5
|
+
Filter: <const TProp extends import('./model/types').PropertyName<T>, TMatcherValue = import('../../lib/types/array').ItemType<NonNullable<import('@tanstack/table-core').DeepValue<T, TProp>>>>(props: {
|
|
6
|
+
name?: string;
|
|
7
|
+
property: TProp;
|
|
8
|
+
mode?: import('./model/filter/types').FilterMode;
|
|
9
|
+
values?: TMatcherValue[] | undefined;
|
|
10
|
+
matcher?: import('./model/filter/types').FilterMatcher<T, TProp, TMatcherValue> | undefined;
|
|
11
|
+
}) => import('react').ReactNode;
|
|
12
|
+
Sorting: import('react').ComponentType<import('./model/sorting/types').SortingShape<T>>;
|
|
13
|
+
ItemView: import('react').ComponentType<{
|
|
14
|
+
children: import('./model/item/types').RenderItemFn<T>;
|
|
15
|
+
}>;
|
|
16
|
+
StaticData: import('react').ComponentType<{
|
|
17
|
+
data: T[];
|
|
18
|
+
}>;
|
|
19
|
+
LoaderAsync: import('react').ComponentType<Omit<import('./model/loading/types').AsyncDataLoaderShape<T>, "asyncLoader"> & {
|
|
20
|
+
children: import('./model/loading/types').AsyncDataLoader<T>;
|
|
21
|
+
}>;
|
|
22
|
+
LoaderAsyncResource: import('react').ComponentType<Omit<import('./model/loading/types').AsyncResourceFactoryDataLoaderShape<T>, "asyncResourceFactory"> & {
|
|
23
|
+
children: (options?: import('./model/loading/types').DataLoaderOptions<T> | undefined) => import('@mittwald/react-use-promise').AsyncResource<import('./model/loading/types').DataLoaderResult<T>>;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ItemType<T> = T extends (infer TItem)[] ? TItem : T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.175",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
"dependencies": {
|
|
281
281
|
"@chakra-ui/live-region": "^2.1.0",
|
|
282
282
|
"@internationalized/string-compiler": "^3.2.4",
|
|
283
|
-
"@mittwald/react-tunnel": "^0.1.0-alpha.
|
|
283
|
+
"@mittwald/react-tunnel": "^0.1.0-alpha.175",
|
|
284
284
|
"@mittwald/react-use-promise": "^2.3.13",
|
|
285
285
|
"@react-aria/utils": "^3.24.1",
|
|
286
286
|
"@react-types/shared": "^3.23.1",
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
},
|
|
308
308
|
"devDependencies": {
|
|
309
309
|
"@faker-js/faker": "^8.4.1",
|
|
310
|
-
"@mittwald/flow-design-tokens": "^0.1.0-alpha.
|
|
310
|
+
"@mittwald/flow-design-tokens": "^0.1.0-alpha.175",
|
|
311
311
|
"@mittwald/react-use-promise": "^2.3.13",
|
|
312
312
|
"@nx/storybook": "^19.4.0",
|
|
313
313
|
"@storybook/addon-a11y": "^8.1.11",
|
|
@@ -383,5 +383,5 @@
|
|
|
383
383
|
"optional": true
|
|
384
384
|
}
|
|
385
385
|
},
|
|
386
|
-
"gitHead": "
|
|
386
|
+
"gitHead": "d574568700b63fa336578f7ac2454fdd3add2720"
|
|
387
387
|
}
|