@casinogate/ui 1.10.4 → 1.10.6
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/components/data-table/components/data-table.svelte.js +4 -2
- package/dist/components/data-table/index.d.ts +2 -2
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/data-table/styles.js +5 -1
- package/dist/components/data-table/utils/index.d.ts +2 -1
- package/dist/components/data-table/utils/index.js +2 -1
- package/dist/components/data-table/utils/row-models.d.ts +3 -1
- package/dist/components/data-table/utils/row-models.js +3 -1
- package/dist/components/data-table/utils/{use-sort-sate.svelte.d.ts → use-sort-state.svelte.d.ts} +2 -0
- package/dist/components/data-table/utils/{use-sort-sate.svelte.js → use-sort-state.svelte.js} +10 -1
- package/dist/components/data-table/utils/use-visibility-state.svelte.d.ts +14 -0
- package/dist/components/data-table/utils/use-visibility-state.svelte.js +29 -0
- package/package.json +1 -1
|
@@ -28,8 +28,10 @@ export class DataTableRootState {
|
|
|
28
28
|
const colSizes = {};
|
|
29
29
|
for (let i = 0; i < headers.length; i++) {
|
|
30
30
|
const header = headers[i];
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
if (!header)
|
|
32
|
+
continue;
|
|
33
|
+
colSizes[`--header-${header?.id}-size`] = header.getSize();
|
|
34
|
+
colSizes[`--col-${header?.column.id}-size`] = header.column.getSize();
|
|
33
35
|
}
|
|
34
36
|
return colSizes;
|
|
35
37
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as DataTablePrimitive from './exports-primitive.js';
|
|
2
2
|
export * from './exports.js';
|
|
3
|
-
export type { ColumnSizingState, ExpandedState, ExpandedStateList, GroupingState, PaginationState, RowSelectionState, SortingState, TableState, Updater, } from '@tanstack/table-core';
|
|
3
|
+
export type { ColumnOrderState, ColumnPinningState, ColumnSizingState, ExpandedState, ExpandedStateList, GroupingState, PaginationState, RowSelectionState, SortingState, TableState, Updater, VisibilityState, } from '@tanstack/table-core';
|
|
4
4
|
export { createTable } from './models/index.js';
|
|
5
5
|
export type { ColumnDef, DataTableBodyProps, DataTableCellProps, DataTableHeaderProps, DataTableHeadProps, DataTableProps, DataTableResizeHandlerProps, DataTableRootProps, DataTableRowProps, DataTableSortButtonProps, DataTableTableProps, RowData, } from './types.js';
|
|
6
|
-
export
|
|
6
|
+
export * from './utils/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * as DataTablePrimitive from './exports-primitive.js';
|
|
2
2
|
export * from './exports.js';
|
|
3
3
|
export { createTable } from './models/index.js';
|
|
4
|
-
export
|
|
4
|
+
export * from './utils/index.js';
|
|
@@ -28,7 +28,11 @@ export const dataTableVariants = tv({
|
|
|
28
28
|
'cgui:data-[direction=asc]:[&_[data-direction=asc]]:text-icon-regular',
|
|
29
29
|
'cgui:data-[direction=desc]:[&_[data-direction=desc]]:text-icon-regular',
|
|
30
30
|
],
|
|
31
|
-
cell: [
|
|
31
|
+
cell: [
|
|
32
|
+
'cgui:whitespace-nowrap cgui:bg-clip-padding cgui:p-2',
|
|
33
|
+
'cgui:font-normal cgui:align-middle',
|
|
34
|
+
'cgui:truncate',
|
|
35
|
+
],
|
|
32
36
|
resizeHandler: [
|
|
33
37
|
'cgui:absolute cgui:hidden cgui:top-0 cgui:right-0 cgui:w-1.5 cgui:h-full',
|
|
34
38
|
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
@@ -2,4 +2,5 @@ export { usePaginationState } from './pagination-state.svelte.js';
|
|
|
2
2
|
export { useResizeState } from './resize-state.svelte.js';
|
|
3
3
|
export { rowModels } from './row-models.js';
|
|
4
4
|
export { useRowSelectionState } from './row-selection-state.svelte.js';
|
|
5
|
-
export { useSortState } from './use-sort-
|
|
5
|
+
export { useSortState } from './use-sort-state.svelte.js';
|
|
6
|
+
export { useVisibilityState } from './use-visibility-state.svelte.js';
|
|
@@ -2,4 +2,5 @@ export { usePaginationState } from './pagination-state.svelte.js';
|
|
|
2
2
|
export { useResizeState } from './resize-state.svelte.js';
|
|
3
3
|
export { rowModels } from './row-models.js';
|
|
4
4
|
export { useRowSelectionState } from './row-selection-state.svelte.js';
|
|
5
|
-
export { useSortState } from './use-sort-
|
|
5
|
+
export { useSortState } from './use-sort-state.svelte.js';
|
|
6
|
+
export { useVisibilityState } from './use-visibility-state.svelte.js';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/table-core';
|
|
1
|
+
import { getCoreRowModel, getExpandedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/table-core';
|
|
2
2
|
export declare const rowModels: {
|
|
3
3
|
coreRowModel: typeof getCoreRowModel;
|
|
4
4
|
paginationRowModel: typeof getPaginationRowModel;
|
|
5
5
|
sortedRowModel: typeof getSortedRowModel;
|
|
6
6
|
filteredRowModel: typeof getFilteredRowModel;
|
|
7
|
+
expandedRowModel: typeof getExpandedRowModel;
|
|
8
|
+
groupedRowModel: typeof getGroupedRowModel;
|
|
7
9
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/table-core';
|
|
1
|
+
import { getCoreRowModel, getExpandedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, } from '@tanstack/table-core';
|
|
2
2
|
export const rowModels = {
|
|
3
3
|
coreRowModel: getCoreRowModel,
|
|
4
4
|
paginationRowModel: getPaginationRowModel,
|
|
5
5
|
sortedRowModel: getSortedRowModel,
|
|
6
6
|
filteredRowModel: getFilteredRowModel,
|
|
7
|
+
expandedRowModel: getExpandedRowModel,
|
|
8
|
+
groupedRowModel: getGroupedRowModel,
|
|
7
9
|
};
|
package/dist/components/data-table/utils/{use-sort-sate.svelte.js → use-sort-state.svelte.js}
RENAMED
|
@@ -16,8 +16,17 @@ class SortState {
|
|
|
16
16
|
}
|
|
17
17
|
this.current = newSort;
|
|
18
18
|
this.#onValueChange(newSort);
|
|
19
|
-
console.log(newSort);
|
|
20
19
|
};
|
|
20
|
+
get dir() {
|
|
21
|
+
if (!this.#current?.[0])
|
|
22
|
+
return null;
|
|
23
|
+
return this.#current?.[0]?.desc ? 'desc' : 'asc';
|
|
24
|
+
}
|
|
25
|
+
get field() {
|
|
26
|
+
if (!this.#current?.[0])
|
|
27
|
+
return null;
|
|
28
|
+
return this.#current?.[0]?.id;
|
|
29
|
+
}
|
|
21
30
|
get current() {
|
|
22
31
|
return this.#current;
|
|
23
32
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OnChangeFn, VisibilityState as VisibilityStateType } from '@tanstack/table-core';
|
|
2
|
+
type Opts = {
|
|
3
|
+
defaultValue?: () => VisibilityStateType;
|
|
4
|
+
onValueChange?: (value: VisibilityStateType) => void;
|
|
5
|
+
};
|
|
6
|
+
declare class VisibilityState {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(opts?: Opts);
|
|
9
|
+
updater: OnChangeFn<VisibilityStateType>;
|
|
10
|
+
get current(): VisibilityStateType;
|
|
11
|
+
set current(value: VisibilityStateType);
|
|
12
|
+
}
|
|
13
|
+
export declare const useVisibilityState: (opts?: Opts) => VisibilityState;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { noop } from '../../../internal/utils/common.js';
|
|
2
|
+
class VisibilityState {
|
|
3
|
+
#current;
|
|
4
|
+
#onValueChange;
|
|
5
|
+
constructor(opts) {
|
|
6
|
+
this.#current = $state(opts?.defaultValue?.() ?? {});
|
|
7
|
+
this.#onValueChange = opts?.onValueChange ?? noop;
|
|
8
|
+
}
|
|
9
|
+
updater = (updater) => {
|
|
10
|
+
let newVisibility;
|
|
11
|
+
if (updater instanceof Function) {
|
|
12
|
+
newVisibility = updater(this.#current);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
newVisibility = updater;
|
|
16
|
+
}
|
|
17
|
+
this.current = newVisibility;
|
|
18
|
+
this.#onValueChange(newVisibility);
|
|
19
|
+
};
|
|
20
|
+
get current() {
|
|
21
|
+
return this.#current;
|
|
22
|
+
}
|
|
23
|
+
set current(value) {
|
|
24
|
+
this.#current = value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export const useVisibilityState = (opts) => {
|
|
28
|
+
return new VisibilityState(opts);
|
|
29
|
+
};
|