@streamscloud/kit 0.2.40 → 0.2.41-1778493250396

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.
@@ -10,7 +10,7 @@ const id = randomString(10);
10
10
  const localization = new DatetimePickerLocalization();
11
11
  let timePartHolder;
12
12
  let showClearButton = $state(false);
13
- let fpInstance = $state(undefined);
13
+ let fpInstance = $state.raw(undefined);
14
14
  let picker;
15
15
  const preprocessInitialValue = (datetime) => {
16
16
  let date = undefined;
@@ -56,6 +56,7 @@ const getDefaultPlaceholder = () => {
56
56
  };
57
57
  const initPicker = (node) => {
58
58
  picker = node;
59
+ applyFlatpickrTheme(AppTheme.isDarkMode);
59
60
  const opts = pickerOptions ?? {};
60
61
  const mode = opts.mode ?? 'datetime';
61
62
  const noValueHandler = opts.noValueHandler ?? 'reset-to-now';
@@ -7,7 +7,7 @@ export const applyFlatpickrTheme = (isDark) => {
7
7
  }
8
8
  if (!styleEl) {
9
9
  styleEl = document.createElement('style');
10
- document.head.appendChild(styleEl);
10
+ document.head.prepend(styleEl);
11
11
  }
12
12
  styleEl.textContent = isDark ? darkTheme : airbnbTheme;
13
13
  };
@@ -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;
@@ -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.40",
3
+ "version": "0.2.41-1778493250396",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",