@invopop/popui 0.1.4-beta.40 → 0.1.4-beta.42

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.
@@ -46,12 +46,13 @@
46
46
 
47
47
  <div
48
48
  class="overflow-hidden transition-all duration-300 ease-in-out relative rounded-md"
49
- style={expanded ? 'width: 12rem;' : 'width: 2.5rem;'}
49
+ class:w-[280px]={expanded}
50
+ class:w-10={!expanded}
50
51
  use:clickOutside
51
52
  onclick_outside={handleClickOutside}
52
53
  >
53
54
  <div
54
- class="w-48 transition-opacity duration-200 absolute left-0 top-0"
55
+ class="w-[280px] transition-opacity duration-200 absolute left-0 top-0"
55
56
  class:opacity-0={!expanded}
56
57
  class:opacity-100={expanded}
57
58
  class:pointer-events-none={!expanded}
@@ -93,6 +93,16 @@
93
93
  value = val
94
94
  onSelect?.(value)
95
95
  }
96
+
97
+ export const open = () => {
98
+ if (!isOpen) {
99
+ selectDropdown?.toggle()
100
+ }
101
+ }
102
+
103
+ export const toggle = () => {
104
+ selectDropdown?.toggle()
105
+ }
96
106
  </script>
97
107
 
98
108
  {#snippet label()}
@@ -1,4 +1,7 @@
1
1
  import type { DropdownSelectProps } from './types.ts';
2
- declare const DropdownSelect: import("svelte").Component<DropdownSelectProps, {}, "value">;
2
+ declare const DropdownSelect: import("svelte").Component<DropdownSelectProps, {
3
+ open: () => void;
4
+ toggle: () => void;
5
+ }, "value">;
3
6
  type DropdownSelect = ReturnType<typeof DropdownSelect>;
4
7
  export default DropdownSelect;
@@ -5,11 +5,13 @@
5
5
  let { value, config }: { value: string; config?: UuidCellConfig } = $props()
6
6
  </script>
7
7
 
8
- <ButtonUuidCopy
9
- uuid={value}
10
- prefixLength={config?.prefixLength}
11
- suffixLength={config?.suffixLength}
12
- full={config?.full}
13
- disabled={config?.disabled}
14
- oncopied={config?.onCopy}
15
- />
8
+ <div class="relative z-0">
9
+ <ButtonUuidCopy
10
+ uuid={value}
11
+ prefixLength={config?.prefixLength}
12
+ suffixLength={config?.suffixLength}
13
+ full={config?.full}
14
+ disabled={config?.disabled}
15
+ oncopied={config?.onCopy}
16
+ />
17
+ </div>
@@ -15,6 +15,7 @@ export function createColumns(columns) {
15
15
  enableSorting: col.enableSorting ?? true,
16
16
  enableHiding: col.enableHiding ?? true,
17
17
  enableResizing: col.enableResizing ?? true,
18
+ disableColumnFilter: col.disableColumnFilter ?? false,
18
19
  size: col.size,
19
20
  minSize: col.minSize,
20
21
  maxSize: col.maxSize,
@@ -1,7 +1,8 @@
1
1
  import type { Component, Snippet } from 'svelte';
2
- import type { StatusType, AnyProp, TableAction, EmptyStateProps } from '../types.js';
2
+ import type { StatusType, AnyProp, TableAction, EmptyStateProps, TableSortBy } from '../types.js';
3
3
  import type { IconSource } from '@steeze-ui/svelte-icon';
4
4
  import type { Table } from '@tanstack/table-core';
5
+ import type { RenderComponentConfig, RenderSnippetConfig } from './render-helpers.js';
5
6
  export type CellType = 'text' | 'boolean' | 'tag' | 'date' | 'currency' | 'uuid' | 'custom';
6
7
  export interface TextCellConfig {
7
8
  className?: string;
@@ -34,19 +35,32 @@ export interface UuidCellConfig {
34
35
  onCopy?: (value: string) => void;
35
36
  }
36
37
  export type CellConfig = TextCellConfig | BooleanCellConfig | TagCellConfig | DateCellConfig | CurrencyCellConfig | UuidCellConfig;
38
+ export interface DataTableColumnMeta {
39
+ filterType?: string;
40
+ filterIcon?: IconSource;
41
+ filterLabel?: string;
42
+ dbField?: string;
43
+ filterOptions?: Array<{
44
+ value: string;
45
+ label: string;
46
+ [key: string]: any;
47
+ }>;
48
+ }
37
49
  export interface DataTableColumn<TData> {
38
50
  id: string;
39
51
  accessorKey?: keyof TData;
40
52
  header?: string;
41
53
  cellType?: CellType;
42
54
  cellConfig?: CellConfig;
43
- cell?: Snippet<[TData]> | ((value: any, row: TData) => Snippet | Component | string);
55
+ cell?: Snippet<[TData]> | ((value: any, row: TData) => Snippet | Component | string | RenderComponentConfig<any> | RenderSnippetConfig<any>);
44
56
  enableSorting?: boolean;
45
57
  enableHiding?: boolean;
46
58
  enableResizing?: boolean;
59
+ disableColumnFilter?: boolean;
47
60
  size?: number;
48
61
  minSize?: number;
49
62
  maxSize?: number;
63
+ meta?: DataTableColumnMeta;
50
64
  }
51
65
  export interface DataTableProps<TData> {
52
66
  data: TData[];
@@ -61,7 +75,7 @@ export interface DataTableProps<TData> {
61
75
  initialPageSize?: number;
62
76
  initialPage?: number;
63
77
  initialSortColumn?: string;
64
- initialSortDirection?: 'asc' | 'desc';
78
+ initialSortDirection?: TableSortBy;
65
79
  initialFrozenColumns?: string[];
66
80
  initialColumnOrder?: string[];
67
81
  pageSizeOptions?: number[];
@@ -77,7 +91,7 @@ export interface DataTableProps<TData> {
77
91
  rowCount?: number;
78
92
  onPageChange?: (pageIndex: number) => void;
79
93
  onPageSizeChange?: (pageSize: number) => void;
80
- onSortingChange?: (columnId: string, direction: 'asc' | 'desc') => void;
94
+ onSortingChange?: (columnId: string, direction: TableSortBy) => void;
81
95
  onFilterChange?: (columnId: string) => void;
82
96
  onFreezeChange?: (columnId: string) => void;
83
97
  onColumnResize?: (columnSizes: Record<string, number>) => void;
package/dist/types.d.ts CHANGED
@@ -662,3 +662,4 @@ export interface UuidCopyProps {
662
662
  onCopied?: (uuid: string) => void;
663
663
  onLinkClick?: (uuid: string) => void;
664
664
  }
665
+ export type { DataTableColumn, DataTableProps, CellType, TextCellConfig, BooleanCellConfig, TagCellConfig, DateCellConfig, CurrencyCellConfig, CellConfig } from './data-table/data-table-types.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.4-beta.40",
4
+ "version": "0.1.4-beta.42",
5
5
  "repository": {
6
6
  "url": "https://github.com/invopop/popui"
7
7
  },