@streamscloud/kit 0.2.11 → 0.2.13
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.
- package/dist/core/local-storage/index.d.ts +1 -0
- package/dist/core/local-storage/index.js +1 -0
- package/dist/core/local-storage/local-storage-item.d.ts +10 -0
- package/dist/core/local-storage/local-storage-item.js +27 -0
- package/dist/styles/_responsive.scss +48 -0
- package/dist/ui/button/cmp.button.svelte +2 -2
- package/dist/ui/button/cmp.button.svelte.d.ts +2 -2
- package/dist/ui/button/cmp.options-button.svelte +2 -2
- package/dist/ui/button/resources/button-base.svelte +3 -3
- package/dist/ui/button/resources/button-theme.svelte +2 -2
- package/dist/ui/dropdown/cmp.dropdown.svelte +8 -3
- package/dist/ui/icon-text/cmp.icon-text.svelte +2 -2
- package/dist/ui/icon-text/cmp.icon-text.svelte.d.ts +2 -0
- package/dist/ui/page-toolbar/cmp.reorderable-toggle-list.svelte +160 -0
- package/dist/ui/page-toolbar/cmp.reorderable-toggle-list.svelte.d.ts +20 -0
- package/dist/ui/page-toolbar/cmp.toolbar-button-item.svelte +34 -0
- package/dist/ui/page-toolbar/cmp.toolbar-button-item.svelte.d.ts +18 -0
- package/dist/ui/page-toolbar/cmp.toolbar-checkbox-item.svelte +21 -0
- package/dist/ui/page-toolbar/cmp.toolbar-checkbox-item.svelte.d.ts +12 -0
- package/dist/ui/page-toolbar/cmp.toolbar-dropdown.svelte +29 -0
- package/dist/ui/page-toolbar/cmp.toolbar-dropdown.svelte.d.ts +17 -0
- package/dist/ui/page-toolbar/cmp.toolbar-panel.svelte +58 -0
- package/dist/ui/page-toolbar/cmp.toolbar-panel.svelte.d.ts +19 -0
- package/dist/ui/page-toolbar/cmp.toolbar-search-input.svelte +49 -0
- package/dist/ui/page-toolbar/cmp.toolbar-search-input.svelte.d.ts +20 -0
- package/dist/ui/page-toolbar/cmp.toolbar-segmented-control.svelte +40 -0
- package/dist/ui/page-toolbar/cmp.toolbar-segmented-control.svelte.d.ts +39 -0
- package/dist/ui/page-toolbar/cmp.toolbar-switch-item.svelte +51 -0
- package/dist/ui/page-toolbar/cmp.toolbar-switch-item.svelte.d.ts +43 -0
- package/dist/ui/page-toolbar/cmp.toolbar-toggle-item.svelte +45 -0
- package/dist/ui/page-toolbar/cmp.toolbar-toggle-item.svelte.d.ts +19 -0
- package/dist/ui/page-toolbar/index.d.ts +10 -0
- package/dist/ui/page-toolbar/index.js +9 -0
- package/dist/ui/page-toolbar/types.d.ts +6 -0
- package/dist/ui/page-toolbar/types.js +1 -0
- package/dist/ui/player/carousel/cmp.carousel.svelte +20 -11
- package/dist/ui/player/carousel/cmp.carousel.svelte.d.ts +4 -0
- package/dist/ui/seek-bar/cmp.seek-bar.svelte +5 -3
- package/dist/ui/segmented-control/cmp.segmented-control.svelte +97 -0
- package/dist/ui/segmented-control/cmp.segmented-control.svelte.d.ts +52 -0
- package/dist/ui/segmented-control/index.d.ts +1 -0
- package/dist/ui/segmented-control/index.js +1 -0
- package/dist/ui/table/cmp.table.svelte +5 -3
- package/dist/ui/table/index.d.ts +1 -1
- package/dist/ui/table/table-cells/table-text-cell.svelte +2 -2
- package/dist/ui/table/table-columns-manager/cmp.table-columns-manager.svelte +77 -38
- package/dist/ui/table/table-columns-manager/cmp.table-columns-manager.svelte.d.ts +16 -6
- package/dist/ui/table/table-columns-manager/table-columns-manager-localization.d.ts +4 -0
- package/dist/ui/table/table-columns-manager/table-columns-manager-localization.js +19 -0
- package/dist/ui/table/table-group-actions/cmp.table-group-actions.svelte +3 -1
- package/dist/ui/table/table-group-actions/table-group-actions-localization.d.ts +3 -0
- package/dist/ui/table/table-group-actions/table-group-actions-localization.js +12 -0
- package/dist/ui/table/table-headers/table-header-sortable-localization.d.ts +7 -0
- package/dist/ui/table/table-headers/table-header-sortable-localization.js +40 -0
- package/dist/ui/table/table-headers/table-header-sortable.svelte +7 -5
- package/dist/ui/table/table-localization.d.ts +6 -0
- package/dist/ui/table/table-localization.js +33 -0
- package/dist/ui/table/table-model.svelte.d.ts +1 -0
- package/dist/ui/table/table-model.svelte.js +3 -0
- package/dist/ui/table/types.d.ts +5 -0
- package/package.json +13 -1
package/dist/ui/table/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as Table } from './cmp.table.svelte';
|
|
2
2
|
export { default as TableColumnsManager } from './table-columns-manager/cmp.table-columns-manager.svelte';
|
|
3
3
|
export { default as TableGroupActions } from './table-group-actions/cmp.table-group-actions.svelte';
|
|
4
|
-
export type { TableColumnSortDirection, TableColumnType, TableImageColumnFormat, TableItemAction, TableTextColumnFormat, TableOrderByState, PageQuery, IAnyTableColumn } from './types';
|
|
4
|
+
export type { ColumnsConfig, TableColumnSortDirection, TableColumnType, TableImageColumnFormat, TableItemAction, TableTextColumnFormat, TableOrderByState, PageQuery, IAnyTableColumn } from './types';
|
|
5
5
|
export type { TableGroupAction } from './table-group-actions/types.svelte';
|
|
6
6
|
export { TableModel } from './table-model.svelte';
|
|
7
7
|
export { pickDirectionFromOrderByState, generatePagination } from './service';
|
|
@@ -19,14 +19,14 @@ const fmt = (d, options) => new Intl.DateTimeFormat(undefined, options).format(d
|
|
|
19
19
|
{#if column.maxLines === 'single-line-no-trim'}
|
|
20
20
|
<span class="table-text-cell__single-line-no-trim">{HtmlHelper.stripHtml(value)}</span>
|
|
21
21
|
{:else}
|
|
22
|
-
<LineClamp maxLines={column.maxLines ||
|
|
22
|
+
<LineClamp maxLines={column.maxLines || 1}>
|
|
23
23
|
{@html HtmlHelper.sanitizeHtml(value)}
|
|
24
24
|
</LineClamp>
|
|
25
25
|
{/if}
|
|
26
26
|
{:else if column.maxLines === 'single-line-no-trim'}
|
|
27
27
|
<span class="table-text-cell__single-line-no-trim">{value}</span>
|
|
28
28
|
{:else}
|
|
29
|
-
<LineClamp maxLines={column.maxLines ||
|
|
29
|
+
<LineClamp maxLines={column.maxLines || 1}>{value}</LineClamp>
|
|
30
30
|
{/if}
|
|
31
31
|
</span>
|
|
32
32
|
|
|
@@ -1,40 +1,103 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends {id: string}">import {
|
|
1
|
+
<script lang="ts" generics="T extends {id: string}">import { LocalStorageItem } from '../../../core/local-storage';
|
|
2
|
+
import { Button } from '../../button';
|
|
2
3
|
import { Dropdown } from '../../dropdown';
|
|
3
4
|
import { IconText } from '../../icon-text';
|
|
4
|
-
import {
|
|
5
|
+
import { ReorderableToggleList } from '../../page-toolbar';
|
|
6
|
+
import { TableColumnsManagerLocalization } from './table-columns-manager-localization';
|
|
5
7
|
import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
|
|
6
8
|
import IconColumnTwo from '@fluentui/svg-icons/icons/text_column_two_20_regular.svg?raw';
|
|
7
|
-
|
|
9
|
+
import { untrack } from 'svelte';
|
|
10
|
+
let { model, localStorageKey, on } = $props();
|
|
11
|
+
const localization = new TableColumnsManagerLocalization();
|
|
12
|
+
const storage = $derived(localStorageKey ? LocalStorageItem.of(localStorageKey) : null);
|
|
13
|
+
const hideableColumns = $derived(model.columns.filter((c) => c.hideable));
|
|
14
|
+
const items = $derived(hideableColumns.map((col) => ({
|
|
15
|
+
id: String(col.id),
|
|
16
|
+
label: col.title,
|
|
17
|
+
enabled: !col.hidden
|
|
18
|
+
})));
|
|
19
|
+
// Load from localStorage once columns are available
|
|
20
|
+
let initialized = false;
|
|
21
|
+
$effect(() => {
|
|
22
|
+
const columns = hideableColumns;
|
|
23
|
+
if (!storage || columns.length === 0 || initialized) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
initialized = true;
|
|
27
|
+
const saved = storage.get();
|
|
28
|
+
if (!saved || !Array.isArray(saved)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
untrack(() => {
|
|
32
|
+
applyConfig(saved);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
/** Apply a columns config. Updates column visibility and order on the model, persists to localStorage. */
|
|
36
|
+
export const applyConfig = (config) => {
|
|
37
|
+
const configMap = new Map(config.map((c) => [c.id, c]));
|
|
38
|
+
for (const col of model.columns) {
|
|
39
|
+
if (col.hideable) {
|
|
40
|
+
const cfg = configMap.get(String(col.id));
|
|
41
|
+
if (cfg) {
|
|
42
|
+
col.hidden = cfg.hidden;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
reorderHideableColumns(config.map((c) => c.id));
|
|
47
|
+
if (storage) {
|
|
48
|
+
storage.set(config);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const reorderHideableColumns = (orderedIds) => {
|
|
52
|
+
const columns = model.columns;
|
|
53
|
+
const hideable = columns.filter((c) => c.hideable);
|
|
54
|
+
const hideableMap = new Map(hideable.map((c) => [String(c.id), c]));
|
|
55
|
+
const orderedSet = new Set(orderedIds);
|
|
56
|
+
const reordered = [];
|
|
57
|
+
for (const id of orderedIds) {
|
|
58
|
+
const col = hideableMap.get(id);
|
|
59
|
+
if (col) {
|
|
60
|
+
reordered.push(col);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const col of hideable) {
|
|
64
|
+
if (!orderedSet.has(String(col.id))) {
|
|
65
|
+
reordered.push(col);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let idx = 0;
|
|
69
|
+
model.setResolvedColumns(columns.map((col) => (col.hideable ? reordered[idx++] : col)));
|
|
70
|
+
};
|
|
71
|
+
const handleChange = (updatedItems) => {
|
|
72
|
+
const config = updatedItems.map((i) => ({ id: i.id, hidden: !i.enabled }));
|
|
73
|
+
applyConfig(config);
|
|
74
|
+
on?.change?.(config);
|
|
75
|
+
};
|
|
8
76
|
</script>
|
|
9
77
|
|
|
10
|
-
<Dropdown position="bottom-
|
|
78
|
+
<Dropdown position="bottom-start" keepDropdownOpen>
|
|
11
79
|
{#snippet trigger()}
|
|
12
80
|
<Button variant="standard" size="small">
|
|
13
|
-
<IconText icon={IconColumnTwo} iconColor="blue" secondaryIcon={IconChevronDown}>
|
|
81
|
+
<IconText icon={IconColumnTwo} iconColor="blue" secondaryIcon={IconChevronDown}>{localization.columns}</IconText>
|
|
14
82
|
</Button>
|
|
15
83
|
{/snippet}
|
|
16
84
|
<div class="columns-manager">
|
|
17
|
-
<div class="columns-manager__title">
|
|
85
|
+
<div class="columns-manager__title">{localization.selectColumns}</div>
|
|
18
86
|
<div class="columns-manager__body">
|
|
19
|
-
{
|
|
20
|
-
<div class="columns-manager__item">
|
|
21
|
-
<div class="columns-manager__label">{column.title}</div>
|
|
22
|
-
<Toggle isOn={!column.hidden} on={{ change: (value) => (column.hidden = !value) }} />
|
|
23
|
-
</div>
|
|
24
|
-
{/each}
|
|
87
|
+
<ReorderableToggleList items={items} on={{ change: handleChange }} />
|
|
25
88
|
</div>
|
|
26
89
|
</div>
|
|
27
90
|
</Dropdown>
|
|
28
91
|
|
|
29
92
|
<!--
|
|
30
93
|
@component
|
|
31
|
-
Column visibility manager for tables. Shows a dropdown with
|
|
94
|
+
Column visibility and order manager for tables. Shows a dropdown with a reorderable toggle list for each hideable column.
|
|
95
|
+
Supports optional localStorage persistence of column order and visibility.
|
|
32
96
|
|
|
33
97
|
### CSS Custom Properties
|
|
34
98
|
| Property | Description | Default |
|
|
35
99
|
|---|---|---|
|
|
36
100
|
| `--sc-kit--table-columns-manager--title--color` | Title text color | `var(--sc-color--text-primary, light-dark(black, white))` |
|
|
37
|
-
| `--sc-kit--table-columns-manager--label--color` | Column label text color | `var(--sc-color--text-primary, light-dark(black, white))` |
|
|
38
101
|
-->
|
|
39
102
|
|
|
40
103
|
<style>.columns-manager {
|
|
@@ -42,10 +105,6 @@ Column visibility manager for tables. Shows a dropdown with toggles for each hid
|
|
|
42
105
|
--sc-kit--table-columns-manager--title--color,
|
|
43
106
|
var(--sc-color--text-primary, light-dark(#000000, #ffffff))
|
|
44
107
|
);
|
|
45
|
-
--_columns-manager--label--color: var(
|
|
46
|
-
--sc-kit--table-columns-manager--label--color,
|
|
47
|
-
var(--sc-color--text-primary, light-dark(#000000, #ffffff))
|
|
48
|
-
);
|
|
49
108
|
width: 21.875rem;
|
|
50
109
|
padding: 1.5rem;
|
|
51
110
|
}
|
|
@@ -61,24 +120,4 @@ Column visibility manager for tables. Shows a dropdown with toggles for each hid
|
|
|
61
120
|
flex-direction: column;
|
|
62
121
|
gap: 1rem;
|
|
63
122
|
padding-block: 0.5rem;
|
|
64
|
-
}
|
|
65
|
-
.columns-manager__item {
|
|
66
|
-
display: flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
justify-content: space-between;
|
|
69
|
-
gap: 0.5rem;
|
|
70
|
-
padding: 0.25rem 0.5rem;
|
|
71
|
-
--sc-kit--toggle--switch--height: 1.125rem;
|
|
72
|
-
--sc-kit--toggle--switch--width: 2.3125rem;
|
|
73
|
-
}
|
|
74
|
-
.columns-manager__label {
|
|
75
|
-
font-size: 0.875rem;
|
|
76
|
-
font-weight: 400;
|
|
77
|
-
line-height: 1.25rem;
|
|
78
|
-
color: var(--_columns-manager--label--color);
|
|
79
|
-
min-width: 0;
|
|
80
|
-
text-overflow: ellipsis;
|
|
81
|
-
max-width: 100%;
|
|
82
|
-
white-space: nowrap;
|
|
83
|
-
overflow: hidden;
|
|
84
123
|
}</style>
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TableModel } from '..';
|
|
2
|
+
import type { ColumnsConfig } from '../types';
|
|
2
3
|
declare function $$render<T extends {
|
|
3
4
|
id: string;
|
|
4
5
|
}>(): {
|
|
5
6
|
props: {
|
|
6
|
-
|
|
7
|
+
model: TableModel<T>;
|
|
8
|
+
/** localStorage key for persisting column order and visibility */
|
|
9
|
+
localStorageKey?: string;
|
|
10
|
+
on?: {
|
|
11
|
+
change?: (config: ColumnsConfig) => void;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
exports: {
|
|
15
|
+
/** Apply a columns config. Updates column visibility and order on the model, persists to localStorage. */ applyConfig: (config: ColumnsConfig) => void;
|
|
7
16
|
};
|
|
8
|
-
exports: {};
|
|
9
17
|
bindings: "";
|
|
10
18
|
slots: {};
|
|
11
19
|
events: {};
|
|
@@ -17,7 +25,9 @@ declare class __sveltets_Render<T extends {
|
|
|
17
25
|
events(): ReturnType<typeof $$render<T>>['events'];
|
|
18
26
|
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
19
27
|
bindings(): "";
|
|
20
|
-
exports(): {
|
|
28
|
+
exports(): {
|
|
29
|
+
/** Apply a columns config. Updates column visibility and order on the model, persists to localStorage. */ applyConfig: (config: ColumnsConfig) => void;
|
|
30
|
+
};
|
|
21
31
|
}
|
|
22
32
|
interface $$IsomorphicComponent {
|
|
23
33
|
new <T extends {
|
|
@@ -31,13 +41,13 @@ interface $$IsomorphicComponent {
|
|
|
31
41
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
32
42
|
}
|
|
33
43
|
/**
|
|
34
|
-
* Column visibility manager for tables. Shows a dropdown with
|
|
44
|
+
* Column visibility and order manager for tables. Shows a dropdown with a reorderable toggle list for each hideable column.
|
|
45
|
+
* Supports optional localStorage persistence of column order and visibility.
|
|
35
46
|
*
|
|
36
47
|
* ### CSS Custom Properties
|
|
37
48
|
* | Property | Description | Default |
|
|
38
49
|
* |---|---|---|
|
|
39
50
|
* | `--sc-kit--table-columns-manager--title--color` | Title text color | `var(--sc-color--text-primary, light-dark(black, white))` |
|
|
40
|
-
* | `--sc-kit--table-columns-manager--label--color` | Column label text color | `var(--sc-color--text-primary, light-dark(black, white))` |
|
|
41
51
|
*/
|
|
42
52
|
declare const Cmp: $$IsomorphicComponent;
|
|
43
53
|
type Cmp<T extends {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AppLocale } from '../../../core/locale';
|
|
2
|
+
export class TableColumnsManagerLocalization {
|
|
3
|
+
get columns() {
|
|
4
|
+
return loc.columns[AppLocale.current];
|
|
5
|
+
}
|
|
6
|
+
get selectColumns() {
|
|
7
|
+
return loc.selectColumns[AppLocale.current];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const loc = {
|
|
11
|
+
columns: {
|
|
12
|
+
en: 'Columns',
|
|
13
|
+
no: 'Kolonner'
|
|
14
|
+
},
|
|
15
|
+
selectColumns: {
|
|
16
|
+
en: 'Select Columns',
|
|
17
|
+
no: 'Velg kolonner'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts" generics="T extends {id: string}">import { Button } from '../../button';
|
|
2
2
|
import { Dropdown, DropdownItem } from '../../dropdown';
|
|
3
3
|
import { IconText } from '../../icon-text';
|
|
4
|
+
import { TableGroupActionsLocalization } from './table-group-actions-localization';
|
|
4
5
|
import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
|
|
5
6
|
let { groupActions, selection } = $props();
|
|
7
|
+
const localization = new TableGroupActionsLocalization();
|
|
6
8
|
const isActionVisible = (action, items) => {
|
|
7
9
|
return action.visibilityFactory ? action.visibilityFactory(items) : true;
|
|
8
10
|
};
|
|
@@ -16,7 +18,7 @@ const singleGroupAction = $derived(availableGroupActions[0]);
|
|
|
16
18
|
<Dropdown position="bottom-end">
|
|
17
19
|
{#snippet trigger()}
|
|
18
20
|
<Button variant="standard" size="small">
|
|
19
|
-
<IconText icon={IconChevronDown} iconPosition="right">
|
|
21
|
+
<IconText icon={IconChevronDown} iconPosition="right">{localization.actions}</IconText>
|
|
20
22
|
</Button>
|
|
21
23
|
{/snippet}
|
|
22
24
|
{#each groupActions as action (action)}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AppLocale } from '../../../core/locale';
|
|
2
|
+
export class TableHeaderSortableLocalization {
|
|
3
|
+
get orderBy() {
|
|
4
|
+
return loc.orderBy[AppLocale.current];
|
|
5
|
+
}
|
|
6
|
+
get newestFirst() {
|
|
7
|
+
return loc.newestFirst[AppLocale.current];
|
|
8
|
+
}
|
|
9
|
+
get oldestFirst() {
|
|
10
|
+
return loc.oldestFirst[AppLocale.current];
|
|
11
|
+
}
|
|
12
|
+
get ascending() {
|
|
13
|
+
return loc.ascending[AppLocale.current];
|
|
14
|
+
}
|
|
15
|
+
get descending() {
|
|
16
|
+
return loc.descending[AppLocale.current];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const loc = {
|
|
20
|
+
orderBy: {
|
|
21
|
+
en: 'Order by:',
|
|
22
|
+
no: 'Sorter etter:'
|
|
23
|
+
},
|
|
24
|
+
newestFirst: {
|
|
25
|
+
en: 'Newest first',
|
|
26
|
+
no: 'Nyeste først'
|
|
27
|
+
},
|
|
28
|
+
oldestFirst: {
|
|
29
|
+
en: 'Oldest first',
|
|
30
|
+
no: 'Eldste først'
|
|
31
|
+
},
|
|
32
|
+
ascending: {
|
|
33
|
+
en: 'A → Z',
|
|
34
|
+
no: 'A → Å'
|
|
35
|
+
},
|
|
36
|
+
descending: {
|
|
37
|
+
en: 'Z → A',
|
|
38
|
+
no: 'Å → A'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<script lang="ts">import { Checkbox } from '../../checkbox';
|
|
2
2
|
import { Dropdown } from '../../dropdown';
|
|
3
3
|
import { Icon } from '../../icon';
|
|
4
|
+
import { TableHeaderSortableLocalization } from './table-header-sortable-localization';
|
|
4
5
|
import TableHeader from './table-header.svelte';
|
|
5
6
|
import IconCaretDownFilled from '@fluentui/svg-icons/icons/caret_down_16_filled.svg?raw';
|
|
6
7
|
import {} from 'svelte';
|
|
7
8
|
let { column, on, children } = $props();
|
|
9
|
+
const localization = new TableHeaderSortableLocalization();
|
|
8
10
|
const changeSort = (direction) => {
|
|
9
11
|
if (column.sortDirection === direction) {
|
|
10
12
|
direction = 'none';
|
|
@@ -30,23 +32,23 @@ const changeSort = (direction) => {
|
|
|
30
32
|
{/snippet}
|
|
31
33
|
|
|
32
34
|
<div class="th-sortable__dropdown">
|
|
33
|
-
<div class="th-sortable__dropdown-title">
|
|
35
|
+
<div class="th-sortable__dropdown-title">{localization.orderBy}</div>
|
|
34
36
|
{#if column.type === 'by'}
|
|
35
37
|
<div class="th-sortable__dropdown-option">
|
|
36
|
-
|
|
38
|
+
{localization.newestFirst}
|
|
37
39
|
<Checkbox checked={column.sortDirection === 'desc'} on={{ change: () => changeSort('desc') }} />
|
|
38
40
|
</div>
|
|
39
41
|
<div class="th-sortable__dropdown-option">
|
|
40
|
-
|
|
42
|
+
{localization.oldestFirst}
|
|
41
43
|
<Checkbox checked={column.sortDirection === 'asc'} on={{ change: () => changeSort('asc') }} />
|
|
42
44
|
</div>
|
|
43
45
|
{:else}
|
|
44
46
|
<div class="th-sortable__dropdown-option">
|
|
45
|
-
|
|
47
|
+
{localization.ascending}
|
|
46
48
|
<Checkbox checked={column.sortDirection === 'asc'} on={{ change: () => changeSort('asc') }} />
|
|
47
49
|
</div>
|
|
48
50
|
<div class="th-sortable__dropdown-option">
|
|
49
|
-
|
|
51
|
+
{localization.descending}
|
|
50
52
|
<Checkbox checked={column.sortDirection === 'desc'} on={{ change: () => changeSort('desc') }} />
|
|
51
53
|
</div>
|
|
52
54
|
{/if}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AppLocale } from '../../core/locale';
|
|
2
|
+
export class TableLocalization {
|
|
3
|
+
get noItemsFoundTitle() {
|
|
4
|
+
return loc.noItemsFoundTitle[AppLocale.current];
|
|
5
|
+
}
|
|
6
|
+
get noItemsFoundBody() {
|
|
7
|
+
return loc.noItemsFoundBody[AppLocale.current];
|
|
8
|
+
}
|
|
9
|
+
get save() {
|
|
10
|
+
return loc.save[AppLocale.current];
|
|
11
|
+
}
|
|
12
|
+
get cancel() {
|
|
13
|
+
return loc.cancel[AppLocale.current];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const loc = {
|
|
17
|
+
noItemsFoundTitle: {
|
|
18
|
+
en: 'No Items <span>Found</span>',
|
|
19
|
+
no: 'Ingen elementer <span>funnet</span>'
|
|
20
|
+
},
|
|
21
|
+
noItemsFoundBody: {
|
|
22
|
+
en: 'No data found. Create one to get started',
|
|
23
|
+
no: 'Ingen data funnet. Opprett en for å komme i gang'
|
|
24
|
+
},
|
|
25
|
+
save: {
|
|
26
|
+
en: 'Save',
|
|
27
|
+
no: 'Lagre'
|
|
28
|
+
},
|
|
29
|
+
cancel: {
|
|
30
|
+
en: 'Cancel',
|
|
31
|
+
no: 'Avbryt'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -36,6 +36,7 @@ export declare class TableModel<T extends WithId> {
|
|
|
36
36
|
set columns(value: IAnyTableColumn<T>[]);
|
|
37
37
|
set editingItem(value: T | null);
|
|
38
38
|
set highlightedItemIds(value: string[]);
|
|
39
|
+
setResolvedColumns: (columns: ResolvedColumn<T>[]) => void;
|
|
39
40
|
private reconcileColumns;
|
|
40
41
|
private mapColumn;
|
|
41
42
|
}
|
|
@@ -97,6 +97,9 @@ export class TableModel {
|
|
|
97
97
|
set highlightedItemIds(value) {
|
|
98
98
|
this._highlightedItemIds = value;
|
|
99
99
|
}
|
|
100
|
+
setResolvedColumns = (columns) => {
|
|
101
|
+
this._columns = columns;
|
|
102
|
+
};
|
|
100
103
|
reconcileColumns = (newDefs) => {
|
|
101
104
|
// Save state from current columns
|
|
102
105
|
const stateMap = new Map();
|
package/dist/ui/table/types.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ export interface ITableSelectColumn<T, K extends keyof T> extends ITableColumn<T
|
|
|
101
101
|
export interface ITableTextColumn<T> extends ITableColumn<T> {
|
|
102
102
|
type: 'text';
|
|
103
103
|
format?: TableTextColumnFormat | null;
|
|
104
|
+
/** @default 1 */
|
|
104
105
|
maxLines?: number | 'single-line-no-trim' | null;
|
|
105
106
|
valueFactory?: ((item: T) => string) | null;
|
|
106
107
|
editorColumn?: IEditorColumn<T> | null;
|
|
@@ -141,4 +142,8 @@ export type SelectionSettings<T extends WithId> = {
|
|
|
141
142
|
repository?: Repository<T>;
|
|
142
143
|
};
|
|
143
144
|
export type TableColumnSortDirection = 'none' | 'asc' | 'desc';
|
|
145
|
+
export type ColumnsConfig = Array<{
|
|
146
|
+
id: string;
|
|
147
|
+
hidden: boolean;
|
|
148
|
+
}>;
|
|
144
149
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamscloud/kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"author": "StreamsCloud",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,6 +53,10 @@
|
|
|
53
53
|
"types": "./dist/core/i18n/index.d.ts",
|
|
54
54
|
"svelte": "./dist/core/i18n/index.js"
|
|
55
55
|
},
|
|
56
|
+
"./core/local-storage": {
|
|
57
|
+
"types": "./dist/core/local-storage/index.d.ts",
|
|
58
|
+
"svelte": "./dist/core/local-storage/index.js"
|
|
59
|
+
},
|
|
56
60
|
"./core/locale": {
|
|
57
61
|
"types": "./dist/core/locale/index.d.ts",
|
|
58
62
|
"svelte": "./dist/core/locale/index.js"
|
|
@@ -181,6 +185,10 @@
|
|
|
181
185
|
"types": "./dist/ui/media-viewer-dialog/index.d.ts",
|
|
182
186
|
"svelte": "./dist/ui/media-viewer-dialog/index.js"
|
|
183
187
|
},
|
|
188
|
+
"./ui/page-toolbar": {
|
|
189
|
+
"types": "./dist/ui/page-toolbar/index.d.ts",
|
|
190
|
+
"svelte": "./dist/ui/page-toolbar/index.js"
|
|
191
|
+
},
|
|
184
192
|
"./ui/player/buttons": {
|
|
185
193
|
"types": "./dist/ui/player/buttons/index.d.ts",
|
|
186
194
|
"svelte": "./dist/ui/player/buttons/index.js"
|
|
@@ -213,6 +221,10 @@
|
|
|
213
221
|
"types": "./dist/ui/seek-bar/index.d.ts",
|
|
214
222
|
"svelte": "./dist/ui/seek-bar/index.js"
|
|
215
223
|
},
|
|
224
|
+
"./ui/segmented-control": {
|
|
225
|
+
"types": "./dist/ui/segmented-control/index.d.ts",
|
|
226
|
+
"svelte": "./dist/ui/segmented-control/index.js"
|
|
227
|
+
},
|
|
216
228
|
"./ui/selects": {
|
|
217
229
|
"types": "./dist/ui/selects/index.d.ts",
|
|
218
230
|
"svelte": "./dist/ui/selects/index.js"
|