@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.
Files changed (26) hide show
  1. package/dist/List/ListLoaderAsyncResource.js +3 -4
  2. package/dist/List.js +262 -255
  3. package/dist/types/components/List/components/Header/FilterPicker/FilterPicker.d.ts +1 -2
  4. package/dist/types/components/List/components/Header/ListFilter.d.ts +6 -3
  5. package/dist/types/components/List/components/Header/ListSorting.d.ts +4 -4
  6. package/dist/types/components/List/components/Header/SortingPickerItem/SortingPickerItem.d.ts +1 -2
  7. package/dist/types/components/List/components/Items/ListItem/FallbackRenderer.d.ts +1 -2
  8. package/dist/types/components/List/components/Items/ListItemView.d.ts +6 -4
  9. package/dist/types/components/List/components/ListLoaderAsync.d.ts +5 -3
  10. package/dist/types/components/List/components/ListLoaderAsyncResource.d.ts +5 -3
  11. package/dist/types/components/List/components/ListStaticData.d.ts +6 -3
  12. package/dist/types/components/List/hooks/useList.d.ts +1 -1
  13. package/dist/types/components/List/index.d.ts +1 -0
  14. package/dist/types/components/List/listContext.d.ts +1 -2
  15. package/dist/types/components/List/model/List.d.ts +3 -3
  16. package/dist/types/components/List/model/ReactTable.d.ts +1 -1
  17. package/dist/types/components/List/model/filter/Filter.d.ts +4 -4
  18. package/dist/types/components/List/model/filter/types.d.ts +8 -6
  19. package/dist/types/components/List/model/item/Item.d.ts +1 -3
  20. package/dist/types/components/List/model/item/types.d.ts +3 -5
  21. package/dist/types/components/List/model/sorting/Sorting.d.ts +2 -1
  22. package/dist/types/components/List/model/sorting/types.d.ts +1 -1
  23. package/dist/types/components/List/model/types.d.ts +5 -2
  24. package/dist/types/components/List/typedList.d.ts +25 -0
  25. package/dist/types/lib/types/array.d.ts +1 -0
  26. package/package.json +4 -4
@@ -1,8 +1,7 @@
1
1
  "use client"
2
2
  /* */
3
- function e(r) {
4
- return null;
5
- }
3
+ const e = (o) => null, s = () => e;
6
4
  export {
7
- e as ListLoaderAsyncResource
5
+ e as ListLoaderAsyncResource,
6
+ s as TypedListLoaderAsyncResource
8
7
  };
package/dist/List.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use client"
2
2
  /* */
3
- var _ = Object.defineProperty;
4
- var tt = (s, t, e) => t in s ? _(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
5
- var o = (s, t, e) => tt(s, typeof t != "symbol" ? t + "" : t, e);
6
- import n, { createContext as et, useContext as at, createElement as st, useEffect as F, useRef as nt, Suspense as it } from "react";
7
- import { R as rt } from "./Render-BdlTa7Qb.js";
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 ot } from "./IconClose-B9Tmq1hI.js";
18
- import { getProperty as lt } from "dot-prop";
19
- import { useReactTable as ct, getCoreRowModel as ut, getSortedRowModel as mt, getFilteredRowModel as dt, getPaginationRowModel as ht, getFacetedUniqueValues as gt } from "@tanstack/react-table";
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 pt } from "mobx-react-lite";
22
- import { autorun as ft, runInAction as bt, makeObservable as St, observable as M, computed as V, action as I } from "mobx";
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 yt } from "remeda";
24
+ import { times as It } from "remeda";
25
25
  import { u as $ } from "./useSelector-DpU7_HMO.js";
26
- import { I as vt } from "./IllustratedMessage-B3MHD01M.js";
27
- import { I as Ct } from "./IconSearch-BdmeRdRR.js";
28
- import { H as Et } from "./Heading-BkHvZG9C.js";
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 It } from "./PropsContextProvider-C6Z4XGp6.js";
31
+ import { P as kt } from "./PropsContextProvider-C6Z4XGp6.js";
32
32
  import "@react-aria/utils";
33
- import { d as Ft } from "./dynamic-ClpUSmEt.js";
34
- import { I as wt } from "./IconContextMenu-BbFVCu4A.js";
35
- import { TunnelProvider as Lt, TunnelExit as O } from "@mittwald/react-tunnel";
36
- import { L as Tt } from "./Link-BoQ8K6ao.js";
37
- import { g as kt } from "./getContainerBreakpointSizeClassName-BrcFDcCY.js";
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 Bt } from "./List/ListLoaderAsyncResource.js";
40
- import { I as At } from "./InlineCode-BT-PKxVv.js";
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 = et({}), g = () => at(Q).list, Dt = () => g().loader.getLoaderInvocationHooks().map((t, e) => /* @__PURE__ */ n.createElement(rt, { key: e }, () => {
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
- })), Nt = (s) => {
44
+ })), xt = (s) => {
45
45
  const { sorting: t } = s;
46
- return /* @__PURE__ */ n.createElement(J, { id: t.getTableColumn().id }, t.name);
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
- } }, w = (s) => {
67
+ } }, F = (s) => {
68
68
  const { children: t, locales: e, variables: a } = s;
69
69
  return v(e).format(t, a);
70
- }, Pt = () => {
71
- const s = g(), t = s.sorting.map((i) => /* @__PURE__ */ n.createElement(Nt, { sorting: i, key: i.getTableColumn().id }));
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((i) => i.isSorted()), a = /* @__PURE__ */ n.createElement(y, null, e ? /* @__PURE__ */ n.createElement(
75
- w,
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__ */ n.createElement(w, { locales: h }, "list.sorting"));
84
- return /* @__PURE__ */ n.createElement(T, null, /* @__PURE__ */ n.createElement(p, { variant: "soft", size: "s", color: "secondary" }, a, /* @__PURE__ */ n.createElement(W, null)), /* @__PURE__ */ n.createElement(
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.property] : [],
89
- onAction: (i) => {
90
- s.getSorting(String(i)).enable();
88
+ selectedKeys: e ? [e.id] : [],
89
+ onAction: (n) => {
90
+ s.getSorting(String(n)).enable();
91
91
  }
92
92
  },
93
93
  t
94
94
  ));
95
- }, Rt = (s) => {
96
- const { filter: t } = s, e = t.values.map((r) => /* @__PURE__ */ n.createElement(J, { key: t.getValueId(r), id: String(r) }, String(r))), a = t.values.filter((r) => t.isValueActive(r)).map((r) => String(r)), i = (r) => {
97
- t.toggleValue(r);
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__ */ n.createElement(T, null, /* @__PURE__ */ n.createElement(p, { variant: "soft", size: "s", color: "secondary" }, /* @__PURE__ */ n.createElement(y, null, t.name ?? t.property), /* @__PURE__ */ n.createElement(W, null)), /* @__PURE__ */ n.createElement(
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: i,
103
- selectionMode: "multiple",
104
- selectedKeys: a
102
+ onAction: d,
103
+ selectionMode: a === "one" ? "single" : "multiple",
104
+ selectedKeys: u
105
105
  },
106
- e
106
+ c
107
107
  ));
108
- }, zt = "flow--list--header", Mt = "flow--list--header--picker-list", H = {
109
- header: zt,
110
- pickerList: Mt
111
- }, Vt = "flow--list--header--active-filters", xt = "flow--list--header--clear-button", q = {
112
- activeFilters: Vt,
113
- clearButton: xt
114
- }, $t = () => {
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__ */ n.createElement(
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__ */ n.createElement(y, null, String(a)),
125
- /* @__PURE__ */ n.createElement(ot, null)
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__ */ n.createElement("div", { className: q.activeFilters }, t, /* @__PURE__ */ n.createElement(
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__ */ n.createElement(w, { locales: h }, "list.resetAll")
136
+ /* @__PURE__ */ i.createElement(F, { locales: h }, "list.resetAll")
137
137
  ));
138
- }, Ot = (s) => {
139
- const { className: t } = s, a = g().filters.map((i) => /* @__PURE__ */ n.createElement(Rt, { key: i.property, filter: i }));
140
- return /* @__PURE__ */ n.createElement("div", { className: k(t, H.header) }, /* @__PURE__ */ n.createElement("div", { className: H.pickerList }, /* @__PURE__ */ n.createElement(Pt, null), a), /* @__PURE__ */ n.createElement($t, null));
141
- }, Ut = "flow--list", Ht = {
142
- list: Ut
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
- o(this, "id");
146
- o(this, "data");
147
- o(this, "collection");
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
- o(S, "fallbackRenderItemFn", (t) => st("pre", void 0, JSON.stringify(t)));
158
- let L = S;
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
- o(this, "list");
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) => L.fromRow(this, t));
168
+ return this.list.reactTable.table.getRowModel().rows.map((t) => w.fromRow(this, t));
169
169
  }
170
170
  }
171
- class qt {
171
+ class Gt {
172
172
  constructor(t, e = {}) {
173
- o(this, "batchSize");
174
- o(this, "list");
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((i) => i.onFilterUpdated(() => this.reset()));
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 Kt = (s, t) => s === t;
221
- class jt {
220
+ const Qt = (s, t) => s === t;
221
+ class Xt {
222
222
  constructor(t, e) {
223
- o(this, "_values");
224
- o(this, "list");
225
- o(this, "property");
226
- o(this, "mode");
227
- o(this, "matcher");
228
- o(this, "name");
229
- o(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 ?? Kt, this.name = e.name;
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
- lt(t.original, this.property),
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 = (r) => Array.isArray(r) ? r : [r], i = (r) => this.matcher(r, t);
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(i);
246
+ return a(e).every(n);
247
247
  if (this.mode === "some") {
248
- const r = a(e);
249
- return r.length === 0 || r.some(i);
248
+ const o = a(e);
249
+ return o.length === 0 || o.some(n);
250
250
  } else if (this.mode === "one")
251
- return i(e);
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((i) => i());
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((i) => i !== t) : a = null, this.list.reactTable.getTableColumn(this.property).setFilterValue(a), this.onFilterUpdateCallbacks.forEach((i) => i());
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 i;
297
- this.mode === "all" || this.mode === "some" ? e ? i = a.filter((r) => r !== t) : i = [...a, t] : i = e ? null : t, this.list.reactTable.getTableColumn(this.property).setFilterValue(i), this.onFilterUpdateCallbacks.forEach((r) => r());
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 Jt {
303
+ class Zt {
304
304
  constructor(t, e) {
305
- o(this, "list");
306
- o(this, "property");
307
- o(this, "name");
308
- o(this, "direction");
309
- o(this, "defaultEnabled");
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.list.reactTable.getTableColumn(this.property).getIsSorted() !== !1;
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 Wt = (s) => F(ft(s));
331
+ const _t = (s) => I(Ct(s));
329
332
  class A {
330
333
  constructor(t, e = {}) {
331
- o(this, "list");
332
- o(this, "table");
333
- o(this, "tableState");
334
- o(this, "onTableStateChange", (t) => {
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
- bt(() => {
342
+ Et(() => {
340
343
  this.tableState.value = this.getUpdatedTableState(e, a);
341
344
  });
342
345
  });
343
- this.list = t, this.tableState = pt(() => ({ value: void 0 })), this.table = this.useReactTable(e);
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((r) => r.defaultEnabled), i = ct({
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((r) => ({
356
- id: String(r.property),
357
- desc: r.direction === "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: ut(),
362
- getSortedRowModel: mt(),
363
- getFilteredRowModel: dt(),
364
- getPaginationRowModel: ht(),
365
- getFacetedUniqueValues: gt(),
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(i), i;
372
+ return this.useUpdateTableState(n), n;
370
373
  }
371
374
  useUpdateTableState(t) {
372
- Wt(() => {
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 i = t.get(a);
390
- if (i)
391
- return i;
392
- const r = {
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, r), r;
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
- o(this, "dataBatches", []);
410
- o(this, "prevDataBatches", []);
411
- o(this, "batchLoadingStates", ["void"]);
412
- St(this, {
413
- dataBatches: M.shallow,
414
- batchLoadingStates: M.shallow,
415
- mergedData: V,
416
- isLoading: V,
417
- reset: I.bound,
418
- setDataBatch: I.bound,
419
- setBatchLoadingState: I.bound
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 nt(new D()).current;
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 Yt = [];
450
+ const te = [];
448
451
  class N {
449
452
  constructor(t, e = {}) {
450
- o(this, "list");
451
- o(this, "dataSource");
452
- o(this, "manualSorting");
453
- o(this, "manualFiltering");
454
- o(this, "manualPagination");
455
- o(this, "loaderState");
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: Yt };
458
- const i = "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;
459
- this.list = t, this.loaderState = D.useNew(), this.manualPagination = i ?? !1, this.manualFiltering = r ?? this.manualPagination, this.manualSorting = l ?? this.manualPagination, this.list.filters.forEach((u) => u.onFilterUpdated(() => this.reset()));
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 yt(this.list.batches.getBatchIndex() + 1, (e) => e).map((e) => () => {
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
- F(() => (this.loaderState.setBatchLoadingState(
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 = (i) => {
497
- const { data: r, itemTotalCount: l } = i;
498
- this.loaderState.setDataBatch(e, r), l !== void 0 && this.list.batches.updateItemTotalCount(l);
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
- F(() => (t.value.value.isSet && a(t.value.value.value), t.value.observe((i) => {
501
- i.isSet && a(i.value);
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 (i) => ({
526
- data: i,
527
- itemTotalCount: i.length
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 i = e.asyncLoader;
533
- return x(i, [a]);
535
+ const n = e.asyncLoader;
536
+ return x(n, [a]);
534
537
  }
535
538
  if ("asyncResourceFactory" in e) {
536
- const i = e.asyncResourceFactory;
537
- return i(a);
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 Gt = class X {
545
+ let ee = class X {
543
546
  constructor(t) {
544
- o(this, "filters");
545
- o(this, "sorting");
546
- o(this, "items");
547
- o(this, "render");
548
- o(this, "reactTable");
549
- o(this, "batches");
550
- o(this, "loader");
551
- const { render: e, filters: a = [], sorting: i = [], batchesController: r } = t;
552
- this.render = e, this.items = B.useNew(this), this.filters = a.map((l) => new jt(this, l)), this.sorting = i.map((l) => new Jt(this, l)), this.batches = new qt(this, r), this.loader = N.useNew(this, t.loader), this.reactTable = A.useNew(this, {
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.property === t);
566
- return Y(!!e, `Could not get Sorting (property: ${t})`), e;
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 Qt = "flow--list--items--item-list", Xt = "flow--list--items--is-loading", K = {
579
- itemList: Qt,
580
- isLoading: Xt
581
- }, Zt = "flow--list--items--item", _t = "flow--list--items--title", te = "flow--list--items--top-content", ee = "flow--list--items--content", ae = "flow--list--items--action", se = "flow--list--items--avatar", ne = "flow--list--items--text", ie = "flow--list--items--heading", m = {
582
- item: Zt,
583
- title: _t,
584
- topContent: te,
585
- content: ee,
586
- action: ae,
587
- avatar: se,
588
- text: ne,
589
- heading: ie,
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
- }, re = (s) => {
598
+ }, de = (s) => {
596
599
  const { className: t, children: e } = s, a = v(h);
597
- return /* @__PURE__ */ n.createElement(T, null, /* @__PURE__ */ n.createElement(
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__ */ n.createElement(wt, null)
607
+ /* @__PURE__ */ i.createElement(At, null)
605
608
  ), e);
606
- }, oe = (s) => s === "top" ? m.topContent : s === "bottom" ? m.content : m.topContent, Z = (s) => {
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: i = "m",
612
- ...r
613
- } = s, l = {
614
+ containerBreakpointSize: n = "m",
615
+ ...o
616
+ } = s, c = {
614
617
  ContextMenu: {
615
- wrapWith: /* @__PURE__ */ n.createElement(re, { className: m.action }),
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: Ft((c) => oe(c.slot)),
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[kt(i)]
645
- ), d = (c) => e ? /* @__PURE__ */ n.createElement(Tt, { unstyled: !0, ...r, className: u, href: e }, c.children) : /* @__PURE__ */ n.createElement("div", { className: u }, c.children);
646
- return /* @__PURE__ */ n.createElement(d, null, /* @__PURE__ */ n.createElement(It, { props: l }, /* @__PURE__ */ n.createElement(Lt, null, t, /* @__PURE__ */ n.createElement("div", { className: m.title }, /* @__PURE__ */ n.createElement(O, { id: "title" })), /* @__PURE__ */ n.createElement(O, { id: "topContent" }))));
647
- }, b = () => /* @__PURE__ */ n.createElement(Z, null, /* @__PURE__ */ n.createElement(G, { height: "3rem" })), le = (s) => {
648
- const { className: t } = s, e = g(), a = e.loader.useIsLoading(), i = e.loader.useIsInitiallyLoading(), r = e.useIsEmpty(), l = v(h), u = e.items.entries.map((c) => /* @__PURE__ */ n.createElement(it, { key: c.id }, c.render())), d = k(
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 r ? /* @__PURE__ */ n.createElement(vt, null, /* @__PURE__ */ n.createElement(Ct, null), /* @__PURE__ */ n.createElement(Et, null, l.format("list.noResult.heading")), /* @__PURE__ */ n.createElement(y, null, l.format("list.noResult.text"))) : /* @__PURE__ */ n.createElement("div", { className: d }, i ? ce : u);
654
- }, ce = /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(b, null), /* @__PURE__ */ n.createElement(b, null), /* @__PURE__ */ n.createElement(b, null), /* @__PURE__ */ n.createElement(b, null), /* @__PURE__ */ n.createElement(b, null));
655
- function ue(s) {
656
- return null;
657
- }
658
- function me(s) {
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 = r ? /* @__PURE__ */ n.createElement(G, { width: "200px" }) : i ? t.format("list.paginationInfoFiltered", {
677
- visibleItemsCount: c,
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: c,
668
+ visibleItemsCount: l,
682
669
  totalItemsCount: u
683
670
  });
684
- return /* @__PURE__ */ n.createElement(y, { ...s }, C);
685
- }, Se = (s) => {
686
- const t = v(h), e = g(), a = e.loader.useIsLoading(), i = e.loader.useIsInitiallyLoading();
687
- return !e.batches.hasNextBatch() && !a ? null : /* @__PURE__ */ n.createElement(
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 && !i,
691
- isDisabled: i,
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
- }, ye = () => /* @__PURE__ */ n.createElement("div", { className: fe.footer }, /* @__PURE__ */ n.createElement(be, null), /* @__PURE__ */ n.createElement(Se, null)), ve = (s) => /* @__PURE__ */ n.createElement(Z, null, /* @__PURE__ */ n.createElement(At, null, JSON.stringify(s.data)));
700
- function na(s) {
701
- var C, P, R, z;
702
- const { children: t, batchSize: e, ...a } = s, i = (C = E(t, ue)) == null ? void 0 : C.props, r = (P = E(
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
- Bt
705
- )) == null ? void 0 : P.props, l = (R = E(t, ge)) == null ? void 0 : R.props, u = {
706
- source: i ? {
707
- ...i,
708
- asyncLoader: i.children
709
- } : r ? {
710
- ...r,
711
- asyncResourceFactory: r.children
712
- } : l ? {
713
- staticData: l.data
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__ */ n.createElement(ve, { data: f }), c = Gt.useNew({
705
+ }, d = (f) => /* @__PURE__ */ i.createElement(we, { data: f }), l = ee.useNew({
716
706
  loader: u,
717
- filters: U(t, me).map((f) => f.props),
718
- sorting: U(t, de).map((f) => f.props),
719
- render: ((z = E(t, he)) == null ? void 0 : z.props.children) ?? d,
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__ */ n.createElement(
717
+ return /* @__PURE__ */ i.createElement(
726
718
  Q.Provider,
727
719
  {
728
720
  value: {
729
- list: c
721
+ list: l
730
722
  }
731
723
  },
732
- /* @__PURE__ */ n.createElement(Dt, null),
733
- /* @__PURE__ */ n.createElement("div", { className: Ht.list }, /* @__PURE__ */ n.createElement(Ot, null), /* @__PURE__ */ n.createElement(le, null), /* @__PURE__ */ n.createElement(ye, null))
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
- na as List,
738
- me as ListFilter,
738
+ Te as List,
739
+ tt as ListFilter,
739
740
  Z as ListItem,
740
- he as ListItemView,
741
- ue as ListLoaderAsync,
742
- de as ListSorting,
743
- ge as ListStaticData,
744
- na as default
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<AnyData>;
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 function ListFilter<T = never>(ignoredProps: Props<T>): null;
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
- interface Props<T> extends SortingShape<T> {
4
- defaultEnabled?: boolean;
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 {};
@@ -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<AnyData>;
5
+ sorting: Sorting<never>;
7
6
  }
8
7
  export declare const SortingPickerItem: FC<Props>;
9
8
  export {};
@@ -1,8 +1,7 @@
1
- import { AnyData } from '../../../model/item/types';
2
1
  import { FC } from 'react';
3
2
 
4
3
  interface Props {
5
- data: AnyData;
4
+ data: unknown;
6
5
  }
7
6
  export declare const FallbackRenderer: FC<Props>;
8
7
  export {};
@@ -1,7 +1,9 @@
1
- import { RenderItemFn } from '../../model/item/Item';
1
+ import { ComponentType } from 'react';
2
+ import { RenderItemFn } from '../../model/item/types';
2
3
 
3
- interface Props<T> {
4
+ type Props<T> = {} & {
4
5
  children: RenderItemFn<T>;
5
- }
6
- export declare function ListItemView<T = never>(ignoredProps: Props<T>): null;
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
- interface Props<T> extends Omit<AsyncDataLoaderShape<T>, "asyncLoader"> {
4
+ type Props<T> = Omit<AsyncDataLoaderShape<T>, "asyncLoader"> & {
4
5
  children: AsyncDataLoaderShape<T>["asyncLoader"];
5
- }
6
- export declare function ListLoaderAsync<T = never>(ignoredProps: Props<T>): null;
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
- interface Props<T> extends Omit<AsyncResourceFactoryDataLoaderShape<T>, "asyncResourceFactory"> {
4
+ type Props<T> = Omit<AsyncResourceFactoryDataLoaderShape<T>, "asyncResourceFactory"> & {
4
5
  children: AsyncResourceFactoryDataLoaderShape<T>["asyncResourceFactory"];
5
- }
6
- export declare function ListLoaderAsyncResource<T = never>(ignoredProps: Props<T>): null;
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
- interface Props<T> {
1
+ import { ComponentType } from 'react';
2
+
3
+ type Props<T> = {} & {
2
4
  data: T[];
3
- }
4
- export declare function ListStaticData<T = never>(ignoredProps: Props<T>): null;
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<any>;
1
+ export declare const useList: () => import('../model/List').List<never>;
@@ -1,6 +1,7 @@
1
1
  import { List } from './List';
2
2
 
3
3
  export * from './List';
4
+ export * from './typedList';
4
5
  export * from './components/Header/ListFilter';
5
6
  export * from './components/Header/ListSorting';
6
7
  export * from './components/Items/ListItemView';
@@ -1,8 +1,7 @@
1
1
  import { default as List } from './model/List';
2
- import { AnyData } from './model/item/types';
3
2
 
4
3
  interface ListContext {
5
- list: List<AnyData>;
4
+ list: List<never>;
6
5
  }
7
6
  export declare const listContext: import('react').Context<ListContext>;
8
7
  export {};
@@ -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(property: PropertyName<T>): Sorting<T>;
21
+ getSorting(id: string): Sorting<T>;
22
22
  clearSorting(): void;
23
23
  clearFilters(): void;
24
24
  useIsEmpty(): boolean;
@@ -1,6 +1,6 @@
1
1
  import { Column, Table, TableOptions } from '@tanstack/react-table';
2
2
  import { default as List } from './List';
3
- import { PropertyName } from './item/Item';
3
+ import { PropertyName } from './types';
4
4
 
5
5
  export declare class ReactTable<T> {
6
6
  readonly list: List<T>;
@@ -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 { PropertyName } from '../item/Item';
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 FilterMatcher = (filterValue: unknown, property: unknown) => boolean;
5
- export interface FilterShape<T> {
6
- property: PropertyName<T>;
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?: unknown[];
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 { DeepKeys, Row } from '@tanstack/react-table';
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,5 +1,3 @@
1
- export type AnyData = any;
2
- export interface ListDataLoaderResult<T> {
3
- data: T[];
4
- itemTotalCount?: number;
5
- }
1
+ import { ReactNode } from 'react';
2
+
3
+ export type RenderItemFn<T> = (data: T) => ReactNode;
@@ -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,5 +1,5 @@
1
- import { PropertyName } from '../item/Item';
2
1
  import { SortDirection } from '@tanstack/react-table';
2
+ import { PropertyName } from '../types';
3
3
 
4
4
  export interface SortingShape<T> {
5
5
  property: PropertyName<T>;
@@ -1,13 +1,16 @@
1
- import { PropertyName, RenderItemFn } from './item/Item';
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.174",
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.174",
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.174",
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": "a01190a29db57d0b2f281d51434ce100a0bb210e"
386
+ "gitHead": "d574568700b63fa336578f7ac2454fdd3add2720"
387
387
  }