@lavalogic/scoria 0.0.45 → 0.0.47

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 (51) hide show
  1. package/dist/Components/Table/Body/QuickSearchCell.svelte +14 -8
  2. package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +3 -2
  3. package/dist/Components/Table/Body/Rows/TableRow.svelte +55 -17
  4. package/dist/Components/Table/Body/Rows/TableRow.svelte.d.ts +12 -2
  5. package/dist/Components/Table/Body/TableBody.svelte +33 -20
  6. package/dist/Components/Table/Body/TableBody.svelte.d.ts +21 -4
  7. package/dist/Components/Table/Misc/FilterInput.svelte +1 -6
  8. package/dist/Components/Table/Table.svelte +77 -4
  9. package/dist/Components/Table/Types/Columns/Definitions/Accessors/AccessorDef.svelte.d.ts +2 -2
  10. package/dist/Components/Table/Types/Columns/Definitions/Accessors/CheckboxDef.svelte.d.ts +6 -2
  11. package/dist/Components/Table/Types/Columns/Definitions/Accessors/CheckboxDef.svelte.js +8 -0
  12. package/dist/Components/Table/Types/Columns/Definitions/Accessors/DateInputDef.svelte.d.ts +6 -2
  13. package/dist/Components/Table/Types/Columns/Definitions/Accessors/DateInputDef.svelte.js +8 -0
  14. package/dist/Components/Table/Types/Columns/Definitions/Accessors/NumberInputDef.svelte.d.ts +6 -2
  15. package/dist/Components/Table/Types/Columns/Definitions/Accessors/NumberInputDef.svelte.js +8 -0
  16. package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.d.ts +5 -3
  17. package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.js +1 -0
  18. package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.d.ts +7 -2
  19. package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.js +8 -0
  20. package/dist/Components/Table/Types/Columns/Definitions/Accessors/TextInputDef.svelte.d.ts +6 -2
  21. package/dist/Components/Table/Types/Columns/Definitions/Accessors/TextInputDef.svelte.js +8 -0
  22. package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.d.ts +1 -0
  23. package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.js +3 -1
  24. package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +5 -7
  25. package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.js +0 -8
  26. package/dist/Components/Table/Types/Columns/Definitions/Display/AbstractDisplayDef.svelte.d.ts +3 -3
  27. package/dist/Components/Table/Types/Columns/Definitions/Display/BubbleDef.svelte.d.ts +7 -2
  28. package/dist/Components/Table/Types/Columns/Definitions/Display/BubbleDef.svelte.js +8 -0
  29. package/dist/Components/Table/Types/Columns/Definitions/Display/DisplayDef.svelte.d.ts +7 -2
  30. package/dist/Components/Table/Types/Columns/Definitions/Display/DisplayDef.svelte.js +8 -0
  31. package/dist/Components/Table/Types/Columns/Definitions/Display/ProgressBarDef.svelte.d.ts +7 -2
  32. package/dist/Components/Table/Types/Columns/Definitions/Display/ProgressBarDef.svelte.js +8 -0
  33. package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.d.ts +2 -1
  34. package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.js +2 -0
  35. package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.d.ts +2 -1
  36. package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.js +3 -0
  37. package/dist/Components/Table/Types/Columns/Definitions/FilterOnly/FilterOnlyDef.svelte.d.ts +6 -4
  38. package/dist/Components/Table/Types/Columns/Definitions/FilterOnly/FilterOnlyDef.svelte.js +1 -0
  39. package/dist/Components/Table/Types/Columns/Definitions/JSONColumnDefSet.d.ts +11 -0
  40. package/dist/Components/Table/Types/Columns/Definitions/RowSelection/RowSelectionDef.svelte.d.ts +1 -0
  41. package/dist/Components/Table/Types/Columns/Definitions/RowSelection/RowSelectionDef.svelte.js +3 -1
  42. package/dist/Components/Table/Types/Columns/JSONColumnPinningState.d.ts +4 -0
  43. package/dist/Components/Table/Types/Columns/JSONColumnPinningState.js +1 -0
  44. package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +1 -1
  45. package/dist/Components/Table/Types/Context/TableContext.svelte.js +66 -62
  46. package/dist/index.d.ts +0 -1
  47. package/dist/index.js +0 -1
  48. package/dist/scss/_mixins.scss +2 -0
  49. package/package.json +22 -22
  50. package/dist/Components/Table/Types/Columns/ColumnDefPreset.d.ts +0 -11
  51. /package/dist/Components/Table/Types/Columns/{ColumnDefPreset.js → Definitions/JSONColumnDefSet.js} +0 -0
@@ -9,8 +9,16 @@ export class SelectDef extends AccessorDef {
9
9
  this.optional = $derived(props.optional ?? false);
10
10
  this.clearable = $derived(props.clearable ?? true);
11
11
  this.getDisplayValue = $derived(props.getDisplayValue);
12
+ this._filterFn = $state(props.filterFn);
12
13
  }
13
14
  accessorType = AccessorType.Select;
15
+ _filterFn;
16
+ get filterFn() {
17
+ return this._filterFn;
18
+ }
19
+ set filterFn(v) {
20
+ this._filterFn = v;
21
+ }
14
22
  sortingFn;
15
23
  getDisplayValue;
16
24
  optional;
@@ -1,9 +1,13 @@
1
- import type { StringFilterValueType } from '../../../Filtering/FilterFn.js';
1
+ import type { CustomFilterFn } from '../../../Filtering/CustomFilterFn.js';
2
+ import type { FilterFn, StringFilterValueType } from '../../../Filtering/FilterFn.js';
2
3
  import { AccessorDef, type AccessorDefProps } from './AccessorDef.svelte.js';
3
- export interface TextInputDefProps<T extends object> extends AccessorDefProps<T> {
4
+ export interface TextInputDefProps<T extends object> extends AccessorDefProps<T, StringFilterValueType> {
4
5
  filterValueType?: 'String';
5
6
  }
6
7
  export declare class TextInputDef<T extends object> extends AccessorDef<T, StringFilterValueType> {
7
8
  readonly accessorType: "Text";
8
9
  constructor(props: TextInputDefProps<T>);
10
+ private _filterFn;
11
+ get filterFn(): CustomFilterFn | FilterFn<T, StringFilterValueType> | undefined;
12
+ set filterFn(v: CustomFilterFn | FilterFn<T, StringFilterValueType> | undefined);
9
13
  }
@@ -4,5 +4,13 @@ export class TextInputDef extends AccessorDef {
4
4
  accessorType = AccessorType.Text;
5
5
  constructor(props) {
6
6
  super(props);
7
+ this._filterFn = $state(props.filterFn);
8
+ }
9
+ _filterFn;
10
+ get filterFn() {
11
+ return this._filterFn;
12
+ }
13
+ set filterFn(v) {
14
+ this._filterFn = v;
7
15
  }
8
16
  }
@@ -12,4 +12,5 @@ export declare class ActionsDef<T extends object> extends ColumnDef<T> {
12
12
  readonly actions: TableActionButton<T>[];
13
13
  readonly isEnabled?: (item: T, index: number, button: TableActionButton<T>) => boolean | Promise<boolean>;
14
14
  readonly getColourSet?: (item: T, index: number, button: TableActionButton<T>) => ColourSet;
15
+ readonly filterFn: undefined;
15
16
  }
@@ -6,7 +6,8 @@ export class ActionsDef extends ColumnDef {
6
6
  super({
7
7
  id: `actions-${generateUUID()}`,
8
8
  header: 'Actions',
9
- allowSorting: false
9
+ allowSorting: false,
10
+ allowFiltering: false
10
11
  });
11
12
  this.actions = $derived(props.actions);
12
13
  this.isEnabled = $derived(props.isEnabled);
@@ -16,4 +17,5 @@ export class ActionsDef extends ColumnDef {
16
17
  actions;
17
18
  isEnabled; // assumed true if missing
18
19
  getColourSet;
20
+ filterFn = undefined;
19
21
  }
@@ -6,7 +6,7 @@ import { ColumnType } from '../ColumnType.js';
6
6
  import type { AccessorFn } from './AccessorFn.js';
7
7
  import type { ValidationFn } from './ValidationFn.js';
8
8
  import type { FilterValueType } from '../../Filtering/FilterValueType.js';
9
- export interface ColumnDefProps<T extends object> {
9
+ export interface ColumnDefProps<T extends object, FilterFnType = undefined> {
10
10
  id: string;
11
11
  header: string | Snippet;
12
12
  index?: number;
@@ -18,12 +18,12 @@ export interface ColumnDefProps<T extends object> {
18
18
  editable?: boolean;
19
19
  resizable?: boolean;
20
20
  isValid?: ValidationFn<T>;
21
- filterFn?: FilterFn<T, unknown> | CustomFilterFn;
21
+ filterFn?: FilterFn<T, FilterFnType> | CustomFilterFn;
22
22
  filterValueType?: FilterValueType;
23
23
  accessorFn?: AccessorFn<T>;
24
24
  }
25
- export declare abstract class ColumnDef<T extends object, __filterValueType = unknown> {
26
- protected constructor(props: ColumnDefProps<T>);
25
+ export declare abstract class ColumnDef<T extends object, FilterFnType = undefined> {
26
+ protected constructor(props: ColumnDefProps<T, FilterFnType>);
27
27
  readonly id: string;
28
28
  private _index;
29
29
  get index(): number;
@@ -34,9 +34,7 @@ export declare abstract class ColumnDef<T extends object, __filterValueType = un
34
34
  readonly allowFiltering: boolean;
35
35
  readonly isValid: ValidationFn<T> | undefined;
36
36
  readonly accessorFn: AccessorFn<T> | undefined;
37
- private _filterFn;
38
- get filterFn(): FilterFn<T, __filterValueType> | CustomFilterFn | undefined;
39
- set filterFn(v: FilterFn<T, __filterValueType> | CustomFilterFn | undefined);
37
+ abstract filterFn: FilterFn<T, FilterFnType> | CustomFilterFn | undefined;
40
38
  private _minSize;
41
39
  get minSize(): Pixels;
42
40
  set minSize(v: Pixels);
@@ -7,7 +7,6 @@ export class ColumnDef {
7
7
  this.allowFiltering = $derived(props.allowFiltering ?? true);
8
8
  this.allowSorting = $derived(props.allowSorting ?? true);
9
9
  this.isValid = $derived(props.isValid);
10
- this._filterFn = $state(props.filterFn);
11
10
  this.accessorFn = $derived(props.accessorFn);
12
11
  this._minSize = $state(props.minSize ?? 48);
13
12
  this._width = $state(props.width ?? props.minSize ?? 48);
@@ -29,13 +28,6 @@ export class ColumnDef {
29
28
  allowFiltering;
30
29
  isValid;
31
30
  accessorFn;
32
- _filterFn;
33
- get filterFn() {
34
- return this._filterFn;
35
- }
36
- set filterFn(v) {
37
- this._filterFn = v;
38
- }
39
31
  _minSize;
40
32
  get minSize() {
41
33
  return this._minSize;
@@ -7,12 +7,12 @@ export interface DisplayDefModalProps<T extends object> {
7
7
  onclose: () => void;
8
8
  onsubmit: () => void;
9
9
  }
10
- export interface AbstractDisplayDefProps<T extends object> extends ColumnDefProps<T> {
10
+ export interface AbstractDisplayDefProps<T extends object, FilterFnType = undefined> extends ColumnDefProps<T, FilterFnType> {
11
11
  modal?: Component<any, any, any>;
12
12
  }
13
- export declare abstract class AbstractDisplayDef<T extends object> extends ColumnDef<T> {
13
+ export declare abstract class AbstractDisplayDef<T extends object, FilterFnType = undefined> extends ColumnDef<T, FilterFnType> {
14
14
  abstract readonly displayType: DisplayType;
15
- constructor(props: AbstractDisplayDefProps<T>);
15
+ constructor(props: AbstractDisplayDefProps<T, FilterFnType>);
16
16
  readonly columnType: "Display";
17
17
  readonly modal: Component<DisplayDefModalProps<T>, any, any> | undefined;
18
18
  }
@@ -1,10 +1,15 @@
1
1
  import type { BubbleColour } from '../../../../../Bubble.svelte';
2
2
  import { AbstractDisplayDef, type AbstractDisplayDefProps } from './AbstractDisplayDef.svelte.js';
3
- export interface BubbleDefProps<T extends object> extends AbstractDisplayDefProps<T> {
3
+ import type { FilterFn, StringFilterValueType } from '../../../Filtering/FilterFn.js';
4
+ import type { CustomFilterFn } from '../../../Filtering/CustomFilterFn.js';
5
+ export interface BubbleDefProps<T extends object> extends AbstractDisplayDefProps<T, StringFilterValueType> {
4
6
  getColour?: (item: T, index: number, value: string) => BubbleColour | Promise<BubbleColour | null | undefined>;
5
7
  }
6
- export declare class BubbleDef<T extends object> extends AbstractDisplayDef<T> {
8
+ export declare class BubbleDef<T extends object> extends AbstractDisplayDef<T, StringFilterValueType> {
7
9
  readonly displayType: "Bubbles";
8
10
  constructor(props: BubbleDefProps<T>);
11
+ private _filterFn;
12
+ get filterFn(): FilterFn<T, StringFilterValueType> | CustomFilterFn | undefined;
13
+ set filterFn(v: FilterFn<T, StringFilterValueType> | CustomFilterFn | undefined);
9
14
  getColour: ((item: T, index: number, value: string) => BubbleColour | Promise<BubbleColour | null | undefined>) | undefined;
10
15
  }
@@ -5,6 +5,14 @@ export class BubbleDef extends AbstractDisplayDef {
5
5
  constructor(props) {
6
6
  super(props);
7
7
  this.getColour = $derived(props.getColour);
8
+ this._filterFn = $state(props.filterFn);
9
+ }
10
+ _filterFn;
11
+ get filterFn() {
12
+ return this._filterFn;
13
+ }
14
+ set filterFn(v) {
15
+ this._filterFn = v;
8
16
  }
9
17
  getColour;
10
18
  }
@@ -1,8 +1,13 @@
1
1
  import { AbstractDisplayDef, type AbstractDisplayDefProps } from './AbstractDisplayDef.svelte.js';
2
2
  import { DisplayType } from '../../DisplayType.js';
3
- export interface DisplayDefProps<T extends object> extends AbstractDisplayDefProps<T> {
3
+ import type { CustomFilterFn } from '../../../Filtering/CustomFilterFn.js';
4
+ import type { FilterFn } from '../../../Filtering/FilterFn.js';
5
+ export interface DisplayDefProps<T extends object> extends AbstractDisplayDefProps<T, any> {
4
6
  }
5
- export declare class DisplayDef<T extends object> extends AbstractDisplayDef<T> {
7
+ export declare class DisplayDef<T extends object> extends AbstractDisplayDef<T, any> {
6
8
  readonly displayType: DisplayType;
7
9
  constructor(props: DisplayDefProps<T>);
10
+ private _filterFn;
11
+ get filterFn(): CustomFilterFn | FilterFn<T, any> | undefined;
12
+ set filterFn(v: CustomFilterFn | FilterFn<T, any> | undefined);
8
13
  }
@@ -4,5 +4,13 @@ export class DisplayDef extends AbstractDisplayDef {
4
4
  displayType = DisplayType.Normal;
5
5
  constructor(props) {
6
6
  super(props);
7
+ this._filterFn = $state(props.filterFn);
8
+ }
9
+ _filterFn;
10
+ get filterFn() {
11
+ return this._filterFn;
12
+ }
13
+ set filterFn(v) {
14
+ this._filterFn = v;
7
15
  }
8
16
  }
@@ -1,10 +1,15 @@
1
1
  import type { BubbleColour } from '../../../../../Bubble.svelte';
2
2
  import { AbstractDisplayDef, type AbstractDisplayDefProps } from './AbstractDisplayDef.svelte.js';
3
- export interface ProgressBarDefProps<T extends object> extends AbstractDisplayDefProps<T> {
3
+ import type { CustomFilterFn } from '../../../Filtering/CustomFilterFn.js';
4
+ import type { FilterFn, NumberFilterValueType } from '../../../Filtering/FilterFn.js';
5
+ export interface ProgressBarDefProps<T extends object> extends AbstractDisplayDefProps<T, NumberFilterValueType> {
4
6
  getColour: (item: T, index: number, value: [number, number]) => BubbleColour | Promise<BubbleColour> | undefined;
5
7
  }
6
- export declare class ProgressBarDef<T extends object> extends AbstractDisplayDef<T> {
8
+ export declare class ProgressBarDef<T extends object> extends AbstractDisplayDef<T, NumberFilterValueType> {
7
9
  readonly displayType: "Progress";
8
10
  constructor(props: ProgressBarDefProps<T>);
9
11
  readonly getColour: (item: T, index: number, value: [number, number]) => BubbleColour | Promise<BubbleColour> | undefined;
12
+ private _filterFn;
13
+ get filterFn(): FilterFn<T, NumberFilterValueType> | CustomFilterFn | undefined;
14
+ set filterFn(v: FilterFn<T, NumberFilterValueType> | CustomFilterFn | undefined);
10
15
  }
@@ -5,6 +5,14 @@ export class ProgressBarDef extends AbstractDisplayDef {
5
5
  constructor(props) {
6
6
  super(props);
7
7
  this.getColour = $derived(props.getColour);
8
+ this._filterFn = $state(props.filterFn);
8
9
  }
9
10
  getColour;
11
+ _filterFn;
12
+ get filterFn() {
13
+ return this._filterFn;
14
+ }
15
+ set filterFn(v) {
16
+ this._filterFn = v;
17
+ }
10
18
  }
@@ -3,8 +3,9 @@ import type { ValidationFn } from '../ValidationFn.js';
3
3
  export interface ValidityDefProps<T extends object> extends AbstractDisplayDefProps<T> {
4
4
  isValid: ValidationFn<T>;
5
5
  }
6
- export declare class ValidityDef<T extends object> extends AbstractDisplayDef<T> {
6
+ export declare class ValidityDef<T extends object> extends AbstractDisplayDef<T, undefined> {
7
7
  readonly displayType: "Validity";
8
8
  constructor(props: ValidityDefProps<T>);
9
+ readonly filterFn: undefined;
9
10
  readonly isValid: ValidationFn<T>;
10
11
  }
@@ -4,8 +4,10 @@ export class ValidityDef extends AbstractDisplayDef {
4
4
  displayType = DisplayType.Validity;
5
5
  constructor(props) {
6
6
  props.allowSorting = false;
7
+ props.allowFiltering = false;
7
8
  super(props);
8
9
  this.isValid = $derived(props.isValid);
9
10
  }
11
+ filterFn = undefined;
10
12
  isValid;
11
13
  }
@@ -10,9 +10,10 @@ export interface ExpandDefProps<T extends object, R extends object> extends Colu
10
10
  innerTableOptions: TableInitOptions<R>;
11
11
  accessorFn: (item: T, index: number) => R[] | Promise<R[]>;
12
12
  }
13
- export declare class ExpandDef<T extends object, R extends object = object> extends ColumnDef<T> {
13
+ export declare class ExpandDef<T extends object, R extends object = object> extends ColumnDef<T, undefined> {
14
14
  readonly columnType: "Expand";
15
15
  constructor(props: ExpandDefProps<T, R>);
16
+ readonly filterFn: undefined;
16
17
  readonly innerTableName: string;
17
18
  readonly getInnerColumnDefs: (item: T, index: number) => DefsWrapper<R>;
18
19
  readonly headerIcon: IconProps['name'];
@@ -3,6 +3,8 @@ import { ColumnDef } from '../ColumnDef.svelte.js';
3
3
  export class ExpandDef extends ColumnDef {
4
4
  columnType = ColumnType.Expand;
5
5
  constructor(props) {
6
+ props.allowFiltering = false;
7
+ props.allowSorting = false;
6
8
  super(props);
7
9
  this.isEnabled = $derived(props.isEnabled);
8
10
  this.headerIcon = $derived(props.headerIcon);
@@ -10,6 +12,7 @@ export class ExpandDef extends ColumnDef {
10
12
  this.innerTableName = $derived(props.innerTableName);
11
13
  this.innerTableOptions = $derived(props.innerTableOptions);
12
14
  }
15
+ filterFn = undefined;
13
16
  innerTableName;
14
17
  getInnerColumnDefs;
15
18
  headerIcon;
@@ -1,9 +1,11 @@
1
- import type { StringFilterValueType } from '../../../Filtering/FilterFn.js';
1
+ import type { CustomFilterFn } from '../../../Filtering/CustomFilterFn.js';
2
+ import type { FilterFn } from '../../../Filtering/FilterFn.js';
2
3
  import { ColumnType } from '../../ColumnType.js';
3
4
  import { ColumnDef, type ColumnDefProps } from '../ColumnDef.svelte.js';
4
- export interface FilterOnlyDefProps<T extends object> extends ColumnDefProps<T> {
5
+ export interface FilterOnlyDefProps<T extends object, FilterFnType> extends ColumnDefProps<T, FilterFnType> {
5
6
  }
6
- export declare class FilterOnlyDef<T extends object> extends ColumnDef<T, StringFilterValueType> {
7
+ export declare class FilterOnlyDef<T extends object, FilterFnType> extends ColumnDef<T, FilterFnType> {
7
8
  readonly columnType: ColumnType;
8
- constructor(props: FilterOnlyDefProps<T>);
9
+ constructor(props: FilterOnlyDefProps<T, FilterFnType>);
10
+ readonly filterFn: CustomFilterFn | FilterFn<T, FilterFnType> | undefined;
9
11
  }
@@ -5,4 +5,5 @@ export class FilterOnlyDef extends ColumnDef {
5
5
  constructor(props) {
6
6
  super(props);
7
7
  }
8
+ filterFn;
8
9
  }
@@ -0,0 +1,11 @@
1
+ import type { SortingState } from '../../DataRepository/SortingState.js';
2
+ import type { JSONColumnPinningState } from '../JSONColumnPinningState.js';
3
+ import type { VisibilityState } from '../VisibilityState.js';
4
+ import type { ColumnDef } from './ColumnDef.svelte.js';
5
+ export interface JSONColumnDefSet<T extends object> {
6
+ name: string;
7
+ sortingState: SortingState;
8
+ visibilityState: VisibilityState;
9
+ columnPinningState: JSONColumnPinningState;
10
+ columnDefs: Array<ColumnDef<T>>;
11
+ }
@@ -4,4 +4,5 @@ export declare class RowSelectionDef<T extends object> extends ColumnDef<T> {
4
4
  readonly isSelectable: (item: T, index: number) => boolean | Promise<boolean>;
5
5
  readonly columnType: ColumnType;
6
6
  constructor(isSelectable: (item: T, index: number) => boolean | Promise<boolean>);
7
+ readonly filterFn: undefined;
7
8
  }
@@ -8,8 +8,10 @@ export class RowSelectionDef extends ColumnDef {
8
8
  super({
9
9
  id: `is-selectable-${generateUUID()}`,
10
10
  header: 'Row Selected',
11
- allowSorting: false
11
+ allowSorting: false,
12
+ allowFiltering: false
12
13
  });
13
14
  this.isSelectable = isSelectable;
14
15
  }
16
+ filterFn;
15
17
  }
@@ -0,0 +1,4 @@
1
+ export interface JSONColumnPinningState {
2
+ left?: Array<[string, number]>;
3
+ right?: Array<[string, number]>;
4
+ }
@@ -174,7 +174,7 @@ export declare class TableContext<T extends object> {
174
174
  readonly lastPage: number;
175
175
  readonly measureHeaderWidth: (columnDef: ColumnDef<T>) => number;
176
176
  readonly autoResize: (columnDef: ColumnDef<T>) => Promise<void>;
177
- reorderColumn: (dropTarget: HTMLLIElement | HTMLTableCellElement | null) => ColumnDef<T, unknown>[] | undefined;
177
+ reorderColumn: (dropTarget: HTMLLIElement | HTMLTableCellElement | null) => ColumnDef<T, undefined>[] | undefined;
178
178
  copyHighlightedRowsToClipboard: () => Promise<void>;
179
179
  copyDataToClipboard: () => Promise<void>;
180
180
  private _performRowCopy;
@@ -14,8 +14,8 @@ import { DateInputDef } from '../Columns/Definitions/Accessors/DateInputDef.svel
14
14
  import { ProgressBarDef } from '../Columns/Definitions/Display/ProgressBarDef.svelte.js';
15
15
  import { DisplayDef } from '../Columns/Definitions/Display/DisplayDef.svelte.js';
16
16
  import { browser } from '$app/environment';
17
- import { NumberDateFilterMode } from '../Filtering/NumberDateFilterMode.js';
18
- import { FilterValueType } from '../Filtering/FilterValueType.js';
17
+ import { ActionsDef } from '../Columns/Definitions/Actions/ActionsDef.svelte.js';
18
+ import { BubbleDef } from '../Columns/Definitions/Display/BubbleDef.svelte.js';
19
19
  const SORTING_ICON_WIDTH = 24;
20
20
  const InternalSymbol = Symbol();
21
21
  export class TableContext {
@@ -100,7 +100,7 @@ export class TableContext {
100
100
  if (savedPresets) {
101
101
  const presets = JSON.parse(savedPresets);
102
102
  if (presets[0] && areDefsEquivalent(defs, presets[0].columnDefs)) {
103
- return this.reassignDefsToPresets(presets).then(() => presets);
103
+ return this.reassignDefsToPresets(presets).then((p) => p);
104
104
  }
105
105
  }
106
106
  }
@@ -638,10 +638,6 @@ export class TableContext {
638
638
  const rightVisibleCells = $derived([...(this.columnPinning.right?.keys() ?? [])].map(makeCellFromId) ?? []);
639
639
  const centerVisibleCells = $derived(this.columnDefs
640
640
  .filter((it) => {
641
- if (this.columnPinning.left && typeof this.columnPinning.left.has != 'function') {
642
- // eslint-disable-next-line no-debugger
643
- debugger;
644
- }
645
641
  return !(this.columnPinning.left?.has(it.id) || this.columnPinning.right?.has(it.id));
646
642
  })
647
643
  .map(makeRow));
@@ -1557,7 +1553,16 @@ export class TableContext {
1557
1553
  newPresets.push(newPreset);
1558
1554
  }
1559
1555
  this.columnPresets = newPresets;
1560
- const stringified = JSON.stringify(newPresets);
1556
+ const jsonFriendly = newPresets.map((preset) => {
1557
+ return {
1558
+ ...preset,
1559
+ columnPinningState: {
1560
+ left: [...(preset.columnPinningState.left?.entries() ?? [])],
1561
+ right: [...(preset.columnPinningState.right?.entries() ?? [])]
1562
+ }
1563
+ };
1564
+ });
1565
+ const stringified = JSON.stringify(jsonFriendly);
1561
1566
  localStorage.setItem(`${this.userId}-${this.tableName}-presets`, stringified);
1562
1567
  this.setSelectedPreset(newPreset);
1563
1568
  };
@@ -1617,10 +1622,6 @@ export class TableContext {
1617
1622
  const rightVisibleCells = $derived([...(this.columnPinning.right?.keys() ?? [])].map(makeCellFromId) ?? []);
1618
1623
  const centerVisibleCells = $derived(this.columnDefs
1619
1624
  .filter((it) => {
1620
- if (this.columnPinning.left && typeof this.columnPinning.left.has != 'function') {
1621
- // eslint-disable-next-line no-debugger
1622
- debugger;
1623
- }
1624
1625
  return !(this.columnPinning.left?.has(it.id) || this.columnPinning.right?.has(it.id));
1625
1626
  })
1626
1627
  .map(makeRow));
@@ -1846,10 +1847,6 @@ export class TableContext {
1846
1847
  const midDefs = [];
1847
1848
  const rightDefs = [];
1848
1849
  this.columnDefs.forEach((def) => {
1849
- if (this.columnPinning.left && typeof this.columnPinning.left.has != 'function') {
1850
- // eslint-disable-next-line no-debugger
1851
- debugger;
1852
- }
1853
1850
  if (this.columnPinning.left?.has(def.id)) {
1854
1851
  leftDefs.push(def);
1855
1852
  }
@@ -1913,30 +1910,40 @@ export class TableContext {
1913
1910
  def.filterFn = this.dateFilter;
1914
1911
  }
1915
1912
  }
1916
- else if (this.paginationRepo?.paginationType == PaginationType.Local && !def.filterFn) {
1917
- switch (def.filterValueType) {
1918
- case undefined:
1919
- case 'String': {
1920
- def.filterFn = this.stringFilter;
1921
- break;
1922
- }
1923
- case 'Bool': {
1924
- def.filterFn = this.boolFilter;
1925
- break;
1926
- }
1927
- case 'Date': {
1928
- def.filterFn = this.dateFilter;
1929
- break;
1930
- }
1931
- case 'Number': {
1932
- def.filterFn = this.numberFilter;
1933
- break;
1934
- }
1935
- case 'Select': {
1936
- def.filterFn = this.selectFilter;
1937
- break;
1913
+ else if (this.paginationRepo?.paginationType == PaginationType.Local &&
1914
+ !def.filterFn &&
1915
+ def.allowFiltering != false) {
1916
+ if (def instanceof DisplayDef) {
1917
+ switch (def.filterValueType) {
1918
+ case undefined:
1919
+ case 'String': {
1920
+ def.filterFn = this.stringFilter;
1921
+ break;
1922
+ }
1923
+ case 'Bool': {
1924
+ def.filterFn = this.boolFilter;
1925
+ break;
1926
+ }
1927
+ case 'Date': {
1928
+ def.filterFn = this.dateFilter;
1929
+ break;
1930
+ }
1931
+ case 'Number': {
1932
+ def.filterFn = this.numberFilter;
1933
+ break;
1934
+ }
1935
+ case 'Select': {
1936
+ def.filterFn = this.selectFilter;
1937
+ break;
1938
+ }
1938
1939
  }
1939
1940
  }
1941
+ else if (def instanceof BubbleDef) {
1942
+ def.filterFn = this.stringFilter;
1943
+ }
1944
+ else if (def instanceof ProgressBarDef) {
1945
+ def.filterFn = this.numberFilter;
1946
+ }
1940
1947
  }
1941
1948
  return def;
1942
1949
  });
@@ -1981,10 +1988,6 @@ export class TableContext {
1981
1988
  left: new Map(this.columnPinning.left &&
1982
1989
  this.columnDefs
1983
1990
  .filter((col) => {
1984
- if (this.columnPinning.left && typeof this.columnPinning.left.has != 'function') {
1985
- // eslint-disable-next-line no-debugger
1986
- debugger;
1987
- }
1988
1991
  this.columnPinning.left?.has(col.id);
1989
1992
  })
1990
1993
  .map((col, index) => [col.id, index])),
@@ -2021,16 +2024,20 @@ export class TableContext {
2021
2024
  const adjustedDefs = this.columnDefs;
2022
2025
  const asMap = columnDefsToMap(adjustedDefs);
2023
2026
  console.log('reassigning presets');
2024
- presets.forEach((preset) => {
2025
- preset.columnDefs.forEach((def, index) => {
2026
- const realDef = def.columnType == ColumnType.RowSelect || def.columnType == ColumnType.Actions
2027
- ? adjustedDefs.find((it) => it.columnType === def.columnType)
2028
- : asMap.get(def.id);
2029
- if (!realDef) {
2030
- throw new Error('Could not find equivalent column def:', { cause: def });
2031
- }
2032
- preset.columnDefs[index] = realDef;
2033
- });
2027
+ return presets.map((preset) => {
2028
+ return {
2029
+ ...preset,
2030
+ columnPinningState: adaptJSONPinningState(preset.columnPinningState),
2031
+ columnDefs: preset.columnDefs.map((def, index) => {
2032
+ const realDef = def.columnType == ColumnType.RowSelect || def.columnType == ColumnType.Actions
2033
+ ? adjustedDefs.find((it) => it.columnType === def.columnType)
2034
+ : asMap.get(def.id);
2035
+ if (!realDef) {
2036
+ throw new Error('Could not find equivalent column def:', { cause: def });
2037
+ }
2038
+ return (preset.columnDefs[index] = realDef);
2039
+ })
2040
+ };
2034
2041
  });
2035
2042
  }
2036
2043
  }
@@ -2143,11 +2150,6 @@ function generateTableOptions(contextObj) {
2143
2150
  if (!isVisible) {
2144
2151
  return false;
2145
2152
  }
2146
- if (contextObj.columnPinning.left &&
2147
- typeof contextObj.columnPinning.left.has != 'function') {
2148
- // eslint-disable-next-line no-debugger
2149
- debugger;
2150
- }
2151
2153
  return contextObj.columnPinning.left?.has(it.id);
2152
2154
  })
2153
2155
  .map(makeHeader);
@@ -2174,11 +2176,6 @@ function generateTableOptions(contextObj) {
2174
2176
  const centerHeaderGroups = $derived.by(() => {
2175
2177
  const headers = contextObj.columnDefs
2176
2178
  .filter((it) => {
2177
- if (contextObj.columnPinning.left &&
2178
- typeof contextObj.columnPinning.left.has != 'function') {
2179
- // eslint-disable-next-line no-debugger
2180
- debugger;
2181
- }
2182
2179
  return (contextObj.columnVisibility[it.id] != false &&
2183
2180
  !(contextObj.columnPinning.left?.has(it.id) || contextObj.columnPinning.right?.has(it.id)));
2184
2181
  })
@@ -2354,4 +2351,11 @@ function progressSortingFn(id, desc) {
2354
2351
  return 0;
2355
2352
  };
2356
2353
  }
2354
+ function adaptJSONPinningState(state) {
2355
+ //HACK ignore previously broken pinning states
2356
+ return {
2357
+ left: new Map(Array.isArray(state.left) ? state.left : []),
2358
+ right: new Map(Array.isArray(state.right) ? state.right : [])
2359
+ };
2360
+ }
2357
2361
  // #endregion
package/dist/index.d.ts CHANGED
@@ -21,7 +21,6 @@ export { type AccessorFn } from './Components/Table/Types/Columns/Definitions/Ac
21
21
  export { type ColumnDefProps, ColumnDef } from './Components/Table/Types/Columns/Definitions/ColumnDef.svelte.js';
22
22
  export { type ColumnDefSet } from './Components/Table/Types/Columns/Definitions/ColumnDefSet.js';
23
23
  export { type ValidationFn } from './Components/Table/Types/Columns/Definitions/ValidationFn.js';
24
- export { type ColumnDefPreset } from './Components/Table/Types/Columns/ColumnDefPreset.js';
25
24
  export { type ColumnPinningState } from './Components/Table/Types/Columns/ColumnPinningState.js';
26
25
  export { type ColumnSizingState } from './Components/Table/Types/Columns/ColumnSizingState.js';
27
26
  export { ColumnType } from './Components/Table/Types/Columns/ColumnType.js';
package/dist/index.js CHANGED
@@ -26,7 +26,6 @@ export { ColumnDef } from './Components/Table/Types/Columns/Definitions/ColumnDe
26
26
  export {} from './Components/Table/Types/Columns/Definitions/ColumnDefSet.js';
27
27
  export {} from './Components/Table/Types/Columns/Definitions/ValidationFn.js';
28
28
  // Column is not exported
29
- export {} from './Components/Table/Types/Columns/ColumnDefPreset.js';
30
29
  export {} from './Components/Table/Types/Columns/ColumnPinningState.js';
31
30
  export {} from './Components/Table/Types/Columns/ColumnSizingState.js';
32
31
  export { ColumnType } from './Components/Table/Types/Columns/ColumnType.js';
@@ -1782,6 +1782,8 @@
1782
1782
  padding-left: 4px;
1783
1783
  padding-right: 4px;
1784
1784
  gap: 4px;
1785
+ width: 100%;
1786
+ justify-content: space-around;
1785
1787
  }
1786
1788
  td {
1787
1789
  background-color: colours.$ui-blue-1;