@r2digisolutions/ui 0.24.9 → 0.24.10

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.
@@ -48,7 +48,7 @@
48
48
  const ACTION_W = 56;
49
49
  const EXPAND_W = 40;
50
50
 
51
- const manager = new DataTableManager<T>(options);
51
+ const manager = new DataTableManager<T>(() => options);
52
52
 
53
53
  let filterValues = $state<Record<string, any>>({});
54
54
  let container: HTMLDivElement | null = $state(null);
@@ -11,7 +11,7 @@ export declare class DataTableManager<T extends {
11
11
  forcedHidden: SvelteSet<string>;
12
12
  expanded: SvelteSet<any>;
13
13
  lastWidth: number | null;
14
- constructor(opts: TDataTableTableOptions<T>);
14
+ constructor(options: () => TDataTableTableOptions<T>);
15
15
  setMeasuredWidths(map: Record<string, number>): void;
16
16
  get columns(): import("./types.js").TDataTableColumnDef<T>[];
17
17
  getColumn(id: string): import("./types.js").TDataTableColumnDef<T>;
@@ -1,5 +1,6 @@
1
1
  import { SvelteSet } from 'svelte/reactivity';
2
2
  import { normalize, defaultAccessor, compareValues, applyFilterOp } from './utils.js';
3
+ import { untrack } from 'svelte';
3
4
  export class DataTableManager {
4
5
  options = $state({
5
6
  perPage: 10,
@@ -30,7 +31,8 @@ export class DataTableManager {
30
31
  forcedHidden = new SvelteSet();
31
32
  expanded = new SvelteSet();
32
33
  lastWidth = $state(null);
33
- constructor(opts) {
34
+ constructor(options) {
35
+ const opts = options();
34
36
  const columns = normalize(opts.columns);
35
37
  this.options = ({
36
38
  ...opts,
@@ -44,6 +46,17 @@ export class DataTableManager {
44
46
  filters: opts.initialFilters ?? [],
45
47
  visibleColumns: columns.map((c) => c.id),
46
48
  });
49
+ $effect(() => {
50
+ const new_options = options();
51
+ untrack(() => {
52
+ const columns = normalize(new_options.columns);
53
+ this.options = {
54
+ ...new_options,
55
+ columns
56
+ };
57
+ this.load();
58
+ });
59
+ });
47
60
  }
48
61
  setMeasuredWidths(map) {
49
62
  this.measured = map;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/ui",
3
- "version": "0.24.9",
3
+ "version": "0.24.10",
4
4
  "private": false,
5
5
  "packageManager": "bun@1.2.23",
6
6
  "publishConfig": {