dendelion-ui 0.0.28 → 0.0.30
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.
|
@@ -4,6 +4,7 @@ type DeepKey<T> = T extends object ? {
|
|
|
4
4
|
[K in keyof T & string]: K | `${K}.${DeepKey<T[K]>}`;
|
|
5
5
|
}[keyof T & string] : never;
|
|
6
6
|
type DeepValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? DeepValue<T[K], Rest> : never : P extends keyof T ? T[P] : never;
|
|
7
|
+
type ColumnSet<T> = Column<T, DeepKey<T>>[];
|
|
7
8
|
export type TableProps<T> = {
|
|
8
9
|
zebra?: boolean;
|
|
9
10
|
pinRows?: boolean;
|
|
@@ -11,7 +12,7 @@ export type TableProps<T> = {
|
|
|
11
12
|
horizontal?: boolean;
|
|
12
13
|
size?: Size;
|
|
13
14
|
customRowClasses?: string;
|
|
14
|
-
columns:
|
|
15
|
+
columns: ColumnSet<T>;
|
|
15
16
|
dataSource: T[];
|
|
16
17
|
ajax?: (params: object) => Promise<object> | string;
|
|
17
18
|
searchValue?: string;
|
|
@@ -46,5 +47,5 @@ export type ColumnComponent = {
|
|
|
46
47
|
props: any;
|
|
47
48
|
};
|
|
48
49
|
export declare const getValue: <T, K extends DeepKey<T>>(obj: T, keyPath: K) => DeepValue<T, K & string>;
|
|
49
|
-
export declare const defineColumns: <T>() => <K extends DeepKey<T>>(cols: Column<T, K>[]) => Column<T
|
|
50
|
+
export declare const defineColumns: <T>() => <K extends DeepKey<T>>(cols: Column<T, K>[]) => Column<T>[];
|
|
50
51
|
export {};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "dendelion-ui",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "Simpel component library using Tailwind css and DaisyUI",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.30",
|
|
6
6
|
"author": "ThatzOkay",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://github.com/ThatzOkay/DendelionUI#readme",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
<script setup lang="ts" generic="T">
|
|
42
42
|
import { onMounted, ref, watch } from 'vue';
|
|
43
|
-
import {
|
|
43
|
+
import { TableProps } from './interface';
|
|
44
44
|
import classNames from 'classnames';
|
|
45
45
|
import { Size, TableSizeUtils } from '../../types';
|
|
46
46
|
import createFuzzySearch from '@nozbe/microfuzz';
|
|
@@ -15,6 +15,7 @@ type DeepValue<T, P extends string> = P extends `${infer K}.${infer Rest}`
|
|
|
15
15
|
? T[P]
|
|
16
16
|
: never;
|
|
17
17
|
|
|
18
|
+
type ColumnSet<T> = Column<T, DeepKey<T>>[];
|
|
18
19
|
|
|
19
20
|
export type TableProps<T> = {
|
|
20
21
|
zebra?: boolean;
|
|
@@ -23,7 +24,7 @@ export type TableProps<T> = {
|
|
|
23
24
|
horizontal?: boolean;
|
|
24
25
|
size?: Size;
|
|
25
26
|
customRowClasses?: string;
|
|
26
|
-
columns:
|
|
27
|
+
columns: ColumnSet<T>;
|
|
27
28
|
dataSource: T[];
|
|
28
29
|
ajax?: (params: object) => Promise<object> | string;
|
|
29
30
|
searchValue?: string;
|
|
@@ -69,6 +70,6 @@ export const getValue = <T, K extends DeepKey<T>>(obj: T, keyPath: K): DeepValue
|
|
|
69
70
|
.reduce<unknown>((acc, key) => acc && (typeof acc === 'object' ? (acc as Record<string, any>)[key] : acc), obj) as DeepValue<T, K & string>;
|
|
70
71
|
};
|
|
71
72
|
|
|
72
|
-
export const defineColumns = <T>
|
|
73
|
-
|
|
73
|
+
export const defineColumns = <T>() => {
|
|
74
|
+
return <K extends DeepKey<T>>(cols: Column<T, K>[]): Column<T>[] => cols as unknown as Column<T>[];
|
|
74
75
|
}
|