@streamscloud/kit 0.2.41-1778490725788 → 0.2.41-1778520098817

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.
@@ -8,6 +8,10 @@ export type SortableTableColumn = {
8
8
  sortDirection: TableColumnSortDirection;
9
9
  type: TableColumnType;
10
10
  onSort: ((state: TableColumnSortDirection) => Promise<void>) | null;
11
+ sortLabelsOverride?: {
12
+ asc: string;
13
+ desc: string;
14
+ } | null;
11
15
  };
12
16
  export declare class ResolvedColumn<T extends WithId> {
13
17
  readonly def: ColumnDef<T>;
@@ -23,6 +27,10 @@ export declare class ResolvedColumn<T extends WithId> {
23
27
  get centered(): boolean;
24
28
  get fixedCssWidth(): string;
25
29
  get hideable(): boolean;
30
+ get sortLabelsOverride(): {
31
+ asc: string;
32
+ desc: string;
33
+ } | null;
26
34
  get onSort(): ((state: TableColumnSortDirection) => Promise<void>) | null;
27
35
  get onClick(): ((item: T) => Promise<void> | void) | null;
28
36
  }
@@ -42,6 +42,12 @@ export class ResolvedColumn {
42
42
  // Structural columns (checkbox, actions, move-row) have no id — not hideable by default
43
43
  return 'id' in this.def;
44
44
  }
45
+ get sortLabelsOverride() {
46
+ if ('sortLabelsOverride' in this.def) {
47
+ return this.def.sortLabelsOverride ?? null;
48
+ }
49
+ return null;
50
+ }
45
51
  get onSort() {
46
52
  if ('onSort' in this.def) {
47
53
  return this.def.onSort ?? null;
@@ -7,7 +7,7 @@ import { TableColumnsManagerLocalization } from './table-columns-manager-localiz
7
7
  import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
8
8
  import IconColumnTwo from '@fluentui/svg-icons/icons/text_column_two_20_regular.svg?raw';
9
9
  import { untrack } from 'svelte';
10
- let { model, localStorageKey, on } = $props();
10
+ let { model, localStorageKey, trackModelChange, on } = $props();
11
11
  const localization = new TableColumnsManagerLocalization();
12
12
  const storage = $derived(localStorageKey ? LocalStorageItem.of(localStorageKey) : null);
13
13
  const hideableColumns = $derived(model.columns.filter((c) => c.hideable));
@@ -20,7 +20,7 @@ const items = $derived(hideableColumns.map((col) => ({
20
20
  let initialized = false;
21
21
  $effect(() => {
22
22
  const columns = hideableColumns;
23
- if (!storage || columns.length === 0 || initialized) {
23
+ if (!storage || columns.length === 0 || (initialized && !trackModelChange)) {
24
24
  return;
25
25
  }
26
26
  initialized = true;
@@ -7,6 +7,7 @@ declare function $$render<T extends {
7
7
  model: TableModel<T>;
8
8
  /** localStorage key for persisting column order and visibility */
9
9
  localStorageKey?: string;
10
+ trackModelChange?: boolean;
10
11
  on?: {
11
12
  change?: (config: ColumnsConfig) => void;
12
13
  };
@@ -42,6 +42,15 @@ const changeSort = (direction) => {
42
42
  {localization.oldestFirst}
43
43
  <Checkbox checked={column.sortDirection === 'asc'} on={{ change: () => changeSort('asc') }} />
44
44
  </div>
45
+ {:else if column.sortLabelsOverride}
46
+ <div class="th-sortable__dropdown-option">
47
+ {column.sortLabelsOverride.asc}
48
+ <Checkbox checked={column.sortDirection === 'asc'} on={{ change: () => changeSort('asc') }} />
49
+ </div>
50
+ <div class="th-sortable__dropdown-option">
51
+ {column.sortLabelsOverride.desc}
52
+ <Checkbox checked={column.sortDirection === 'desc'} on={{ change: () => changeSort('desc') }} />
53
+ </div>
45
54
  {:else}
46
55
  <div class="th-sortable__dropdown-option">
47
56
  {localization.ascending}
@@ -24,6 +24,10 @@ export interface ITableColumn<T> extends ITableColumnBase {
24
24
  title: string;
25
25
  onSort?: ((state: TableColumnSortDirection) => Promise<void>) | null;
26
26
  sortDirection?: TableColumnSortDirection;
27
+ sortLabelsOverride?: {
28
+ asc: string;
29
+ desc: string;
30
+ };
27
31
  onClick?: ((item: T) => Promise<void> | void) | null;
28
32
  hidden?: boolean;
29
33
  hideable?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.2.41-1778490725788",
3
+ "version": "0.2.41-1778520098817",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",