@streamscloud/kit 0.16.0 → 0.16.1
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/repository/map-container.svelte.d.ts +1 -0
- package/dist/core/repository/map-container.svelte.js +3 -0
- package/dist/core/repository/repository.svelte.js +3 -0
- package/dist/core/repository/types.d.ts +2 -0
- package/dist/ui/table/cmp.table.svelte +1 -1
- package/dist/ui/table/table-cells/table-checkbox-cell.svelte +1 -1
- package/dist/ui/table/table-headers/table-checkbox-header.svelte +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,8 @@ export type WithId = {
|
|
|
4
4
|
export interface Repository<T extends WithId> {
|
|
5
5
|
items: T[];
|
|
6
6
|
limit?: number;
|
|
7
|
+
/** O(1) membership check by id, backed by the keyed container. */
|
|
8
|
+
has(id: T['id']): boolean;
|
|
7
9
|
add(...item: T[]): void;
|
|
8
10
|
remove(...item: T[]): void;
|
|
9
11
|
set(...item: T[]): void;
|
|
@@ -238,7 +238,7 @@ const getEditorColumnOrDefault = (column, editMode) => {
|
|
|
238
238
|
{/snippet}
|
|
239
239
|
{#each model.items as item, itemIndex (item)}
|
|
240
240
|
{@const editMode = model.editingItem?.id === item.id}
|
|
241
|
-
{@const isSelected =
|
|
241
|
+
{@const isSelected = model.selection.has(item.id)}
|
|
242
242
|
{@const isHighlighted = model.highlightedItemIds.includes(item.id)}
|
|
243
243
|
{@const flushBottom = model.styles?.variant === 'card' && itemIndex === model.items.length - 1}
|
|
244
244
|
{@const zebra = model.styles?.zebra === true && itemIndex % 2 === 1 && !isSelected && !isHighlighted}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" generics="T extends {id: string}">import { Checkbox } from '../../checkbox';
|
|
2
2
|
let { item, selection } = $props();
|
|
3
|
-
const selected = $derived(
|
|
3
|
+
const selected = $derived(selection.has(item.id));
|
|
4
4
|
const disabled = $derived(!selected && !!selection.limit && selection.items.length >= selection.limit);
|
|
5
5
|
const toggle = () => {
|
|
6
6
|
if (selected) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" generics="T extends {id: string}">import { Checkbox } from '../../checkbox';
|
|
2
2
|
import TableHeader from './table-header.svelte';
|
|
3
3
|
let { column } = $props();
|
|
4
|
-
const allSelected = $derived(!!column.data.items.length && column.data.items.every((x) =>
|
|
4
|
+
const allSelected = $derived(!!column.data.items.length && column.data.items.every((x) => column.selection.has(x.id)));
|
|
5
5
|
const canSelectAll = $derived(column.data.items.length > 0 && (!column.selection.limit || column.data.items.length <= column.selection.limit));
|
|
6
6
|
const toggleSelectedAll = () => {
|
|
7
7
|
if (allSelected) {
|