@kayord/ui 0.4.2 → 0.4.4

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.
@@ -11,6 +11,7 @@ export let hideHeader = false;
11
11
  export let noDataMessage = "No Data";
12
12
  export let serverItemCount = void 0;
13
13
  export let rowAction = void 0;
14
+ export let showSelected = true;
14
15
  const { headerRows, pageRows, tableAttrs, tableBodyAttrs, pluginStates, rows, flatColumns } = tableViewModel;
15
16
  const isSortEnabled = pluginStates.sort != void 0;
16
17
  const sortKeys = isSortEnabled ? pluginStates.sort.sortKeys : void 0;
@@ -99,10 +100,10 @@ const getOriginalData = (id) => {
99
100
  </Table.Row>
100
101
  {/if}
101
102
  {#each $pageRows as row (row.id)}
102
- <Subscribe rowAttrs={row.attrs()} let:rowAttrs>
103
+ <Subscribe rowAttrs={row.attrs()} let:rowAttrs rowProps={row.props()} let:rowProps>
103
104
  <Table.Row
104
105
  {...rowAttrs}
105
- data-state={!isSelectEnabled ? false : $selectedDataIds[row.id] && "selected"}
106
+ data-state={isSelectEnabled && rowProps.select.selected ? "selected" : "false"}
106
107
  class={rowAction == undefined ? "" : "hover:cursor-pointer"}
107
108
  on:click={() => (rowAction != undefined ? rowAction(getOriginalData(row.id)) : undefined)}
108
109
  >
@@ -125,10 +126,10 @@ const getOriginalData = (id) => {
125
126
  </span>
126
127
  {/if}
127
128
  </div>
128
- {#if isSelectEnabled}
129
+ {#if isSelectEnabled && showSelected}
129
130
  <div class="flex-1 text-sm text-muted-foreground ml-4">
130
131
  {Object.keys($selectedDataIds).length} of{" "}
131
- {$rows.length} row(s) selected.
132
+ {serverItemCount ?? $rows.length} row(s) selected.
132
133
  </div>
133
134
  {/if}
134
135
  {#if isPagingEnabled}
@@ -10,6 +10,7 @@ declare class __sveltets_Render<T extends RowData> {
10
10
  noDataMessage?: string | undefined;
11
11
  serverItemCount?: number | undefined;
12
12
  rowAction?: ((row: T | undefined) => void) | undefined;
13
+ showSelected?: boolean | undefined;
13
14
  };
14
15
  events(): {} & {
15
16
  [evt: string]: CustomEvent<any>;
@@ -1,5 +1,8 @@
1
1
  <script>import { Checkbox } from "../../ui/checkbox";
2
+ import { cn } from "../../../utils";
3
+ let className = void 0;
4
+ export { className as class };
2
5
  export let checked;
3
6
  </script>
4
7
 
5
- <Checkbox bind:checked={$checked} />
8
+ <Checkbox bind:checked={$checked} class={cn(className)} />
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kayord/ui",
3
3
  "private": false,
4
- "version": "0.4.2",
4
+ "version": "0.4.4",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -1,17 +0,0 @@
1
- import { SvelteComponent } from "svelte";
2
- import type { Writable } from "svelte/store";
3
- declare const __propDef: {
4
- props: {
5
- checked: Writable<boolean>;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {};
11
- };
12
- export type DataTableCheckboxProps = typeof __propDef.props;
13
- export type DataTableCheckboxEvents = typeof __propDef.events;
14
- export type DataTableCheckboxSlots = typeof __propDef.slots;
15
- export default class DataTableCheckbox extends SvelteComponent<DataTableCheckboxProps, DataTableCheckboxEvents, DataTableCheckboxSlots> {
16
- }
17
- export {};