vueye-table 2.0.0-alpha.1 → 2.0.0-alpha.10
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/LICENSE +14 -13
- package/README.md +89 -41
- package/dist/components/core/VueyeTable/VueyeTable.vue.d.ts +49 -20
- package/dist/components/core/VueyeTable/api.d.ts +14 -0
- package/dist/components/core/VueyeTable/{VueyeBody → components/VueyeBody}/VueyeBody.vue.d.ts +16 -16
- package/dist/components/core/VueyeTable/components/VueyeBody/api.d.ts +7 -0
- package/dist/components/core/VueyeTable/components/VueyeBody/index.d.ts +2 -0
- package/dist/components/core/VueyeTable/components/VueyeDropdown/api.d.ts +20 -0
- package/dist/components/core/VueyeTable/components/VueyeDropdown/index.d.ts +4 -0
- package/dist/components/core/VueyeTable/{VueyeHead → components/VueyeHead}/VueyeHead.vue.d.ts +3 -3
- package/dist/components/core/VueyeTable/{VueyePagination → components/VueyePagination}/VueyePagination.vue.d.ts +19 -18
- package/dist/components/core/VueyeTable/components/VueyePagination/api.d.ts +12 -0
- package/dist/components/core/VueyeTable/components/VueyePagination/index.d.ts +2 -0
- package/dist/components/core/VueyeTable/components/index.d.ts +4 -0
- package/dist/components/core/VueyeTable/composables/index.d.ts +3 -0
- package/dist/components/core/VueyeTable/composables/usePagination.d.ts +11 -0
- package/dist/components/core/VueyeTable/types/Column.d.ts +11 -6
- package/dist/components/core/VueyeTable/types/Utils.d.ts +16 -0
- package/dist/components/core/VueyeTable/utils/header.d.ts +3 -1
- package/dist/components/core/VueyeTable/utils/humanize.d.ts +1 -0
- package/dist/components/core/VueyeTable/utils/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/vueye-table.js +352 -375
- package/dist/vueye-table.umd.cjs +1 -1
- package/package.json +89 -98
- package/dist/components/core/VueyeTable/VSelect.d.ts +0 -15
- package/dist/components/core/VueyeTable/VueyeBody/index.d.ts +0 -2
- package/dist/components/core/VueyeTable/VueyePagination/index.d.ts +0 -6
- package/dist/components/core/VueyeTable/composables/props/PaginationProps.d.ts +0 -5
- package/dist/components/core/VueyeTable/util-components/VueyeDropdown.vue.d.ts +0 -53
- package/dist/data/product.d.ts +0 -18
- package/dist/data/user.d.ts +0 -22
- package/dist/types.d.ts +0 -8
- /package/dist/components/core/VueyeTable/{VueyeHead → components/VueyeHead}/index.d.ts +0 -0
package/LICENSE
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2023 radix-vue
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
the Software without restriction, including without limitation the rights
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
the Software, and to permit persons to whom the Software is
|
|
10
|
-
subject to the following conditions:
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
11
|
|
|
12
12
|
The above copyright notice and this permission notice shall be included in all
|
|
13
13
|
copies or substantial portions of the Software.
|
|
14
14
|
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,41 +1,89 @@
|
|
|
1
|
-
# Vueye
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
# Vueye Table
|
|
2
|
+
|
|
3
|
+
Vueye Table is a Vue 3 component for displaying data in a table.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install vueye-table
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<VueyeTable
|
|
16
|
+
:data="data"
|
|
17
|
+
:columnHeaders="columnHeaders"
|
|
18
|
+
:itemValue="itemValue"
|
|
19
|
+
:perPage="perPage"
|
|
20
|
+
:currentPage="currentPage"
|
|
21
|
+
:perPageOptions="perPageOptions"
|
|
22
|
+
:loading="loading"
|
|
23
|
+
:selected="selected"
|
|
24
|
+
:selectMode="selectMode"
|
|
25
|
+
:caption="caption"
|
|
26
|
+
:summary="summary"
|
|
27
|
+
@update:loading="updateLoading"
|
|
28
|
+
@update:selected="updateSelected"
|
|
29
|
+
>
|
|
30
|
+
<template #headerCellContent.name="props">
|
|
31
|
+
{{ props.columnHeader.name }}
|
|
32
|
+
</template>
|
|
33
|
+
<template #itemCellContent.name="props">
|
|
34
|
+
{{ props.item.name }}
|
|
35
|
+
</template>
|
|
36
|
+
</VueyeTable>
|
|
37
|
+
</template>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### VueyeTableProps
|
|
41
|
+
|
|
42
|
+
| Prop Name | Type | Default Value | Description |
|
|
43
|
+
| --- | --- | --- | --- |
|
|
44
|
+
| data | TData[] | [] | An array of data for the table. |
|
|
45
|
+
| columnHeaders | TColumn[] or a function returning an array | [] | An array of column headers for the table. |
|
|
46
|
+
| itemValue | string | 'id' | The property name used as a unique identifier for each item. |
|
|
47
|
+
| perPage | number | 10 | The number of items displayed per page. |
|
|
48
|
+
| currentPage | number | 1 | The current page number. |
|
|
49
|
+
| perPageOptions | number[] or a function returning an array | [5, 10, 20, 30] | An array of options for the number of items per page. |
|
|
50
|
+
| loading | boolean | false | Indicates whether the table is in a loading state. |
|
|
51
|
+
| selected | TData[], Row[], or null | null | An array of selected items or rows. |
|
|
52
|
+
| selectMode | 'page' or 'all' | 'all' | The mode for selecting items: 'page' or 'all'. |
|
|
53
|
+
| caption | string | '' | The table's caption. |
|
|
54
|
+
| summary | string | '' | The table's summary. |
|
|
55
|
+
|
|
56
|
+
### VueyeTableEmits
|
|
57
|
+
|
|
58
|
+
| Emit Name | Parameters | Description |
|
|
59
|
+
| --------------- | -------------- | ------------------------------------- |
|
|
60
|
+
| update:loading | value: boolean | Emits when the loading state changes. |
|
|
61
|
+
| update:selected | value: T[] | Emits when the selected items change. |
|
|
62
|
+
|
|
63
|
+
### PaginationEmits
|
|
64
|
+
|
|
65
|
+
| Emit Name | Parameters | Description |
|
|
66
|
+
| ------------------ | ------------- | ------------------------------------------------ |
|
|
67
|
+
| update:currentPage | value: number | Emits when the current page changes. |
|
|
68
|
+
| update:perPage | value: number | Emits when the number of items per page changes. |
|
|
69
|
+
|
|
70
|
+
### SlotHeader
|
|
71
|
+
|
|
72
|
+
The SlotHeader component defines various slots for customizing the table header.
|
|
73
|
+
|
|
74
|
+
- `headerCell.<ColumnKey>`: Slot for customizing the content of a specific column header.
|
|
75
|
+
- `headerCellContent.<ColumnKey>`: Slot for customizing the content within a specific column header cell.
|
|
76
|
+
- `headers`: Slot for customizing the entire table header, containing all column headers.
|
|
77
|
+
- `checkbox`: Slot for customizing the checkbox used for selecting all items.
|
|
78
|
+
|
|
79
|
+
### SlotRow
|
|
80
|
+
|
|
81
|
+
The SlotRow component defines various slots for customizing the table rows.
|
|
82
|
+
|
|
83
|
+
- `itemCell.<ItemKey>`: Slot for customizing the content of a specific item cell within a row.
|
|
84
|
+
- `itemCellContent.<ItemKey>`: Slot for customizing the content within a specific item cell.
|
|
85
|
+
- `rows`: Slot for customizing the entire table rows, containing all rows.
|
|
86
|
+
- `row`: Slot for customizing a specific row.
|
|
87
|
+
- `checkbox`: Slot for customizing the checkbox used for selecting a specific row.
|
|
88
|
+
|
|
89
|
+
You can use these Markdown tables to document the props, emits, and slot definitions for the data table and pagination components in your Vue 3 project.
|
|
@@ -1,35 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
itemValue?: TItemValue;
|
|
5
|
-
columnHeaders: ColumnHeaderBase<Record<string, unknown>>[];
|
|
1
|
+
import type { ColumnHeader } from './types';
|
|
2
|
+
declare const _default: <TData extends Record<string, unknown>, TColumn extends ColumnHeader>(__VLS_props: {
|
|
3
|
+
caption?: string | undefined;
|
|
6
4
|
data: TData[];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
summary?: string | undefined;
|
|
6
|
+
columnHeaders?: TColumn[] | undefined;
|
|
7
|
+
itemValue?: string | undefined;
|
|
8
|
+
perPage?: number | undefined;
|
|
9
|
+
currentPage?: number | undefined;
|
|
10
|
+
perPageOptions?: number[] | undefined;
|
|
11
|
+
loading?: boolean | undefined;
|
|
12
|
+
selectable?: boolean | undefined;
|
|
13
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: {
|
|
16
14
|
attrs: any;
|
|
17
|
-
slots:
|
|
15
|
+
slots: Readonly<import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
16
|
+
caption: () => any;
|
|
17
|
+
summary: () => any;
|
|
18
|
+
}>;
|
|
18
19
|
emit: any;
|
|
19
|
-
},
|
|
20
|
-
props:
|
|
20
|
+
} | undefined, __VLS_expose?: ((exposed: {}) => void) | undefined, __VLS_setup?: Promise<{
|
|
21
|
+
props: {
|
|
22
|
+
caption?: string | undefined;
|
|
23
|
+
data: TData[];
|
|
24
|
+
summary?: string | undefined;
|
|
25
|
+
columnHeaders?: TColumn[] | undefined;
|
|
26
|
+
itemValue?: string | undefined;
|
|
27
|
+
perPage?: number | undefined;
|
|
28
|
+
currentPage?: number | undefined;
|
|
29
|
+
perPageOptions?: number[] | undefined;
|
|
30
|
+
loading?: boolean | undefined;
|
|
31
|
+
selectable?: boolean | undefined;
|
|
32
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
21
33
|
expose(exposed: {}): void;
|
|
22
34
|
attrs: any;
|
|
23
|
-
slots:
|
|
35
|
+
slots: Readonly<import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
36
|
+
caption: () => any;
|
|
37
|
+
summary: () => any;
|
|
38
|
+
}>;
|
|
24
39
|
emit: any;
|
|
25
40
|
}>) => globalThis.VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
26
41
|
[key: string]: any;
|
|
27
42
|
}> & {
|
|
28
43
|
__ctx?: {
|
|
29
|
-
props:
|
|
44
|
+
props: {
|
|
45
|
+
caption?: string | undefined;
|
|
46
|
+
data: TData[];
|
|
47
|
+
summary?: string | undefined;
|
|
48
|
+
columnHeaders?: TColumn[] | undefined;
|
|
49
|
+
itemValue?: string | undefined;
|
|
50
|
+
perPage?: number | undefined;
|
|
51
|
+
currentPage?: number | undefined;
|
|
52
|
+
perPageOptions?: number[] | undefined;
|
|
53
|
+
loading?: boolean | undefined;
|
|
54
|
+
selectable?: boolean | undefined;
|
|
55
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
30
56
|
expose(exposed: {}): void;
|
|
31
57
|
attrs: any;
|
|
32
|
-
slots:
|
|
58
|
+
slots: Readonly<import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
59
|
+
caption: () => any;
|
|
60
|
+
summary: () => any;
|
|
61
|
+
}>;
|
|
33
62
|
emit: any;
|
|
34
63
|
} | undefined;
|
|
35
64
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InferDefaults } from './types';
|
|
2
|
+
export type VueyeTableProps<TColumn = any, TData = any> = {
|
|
3
|
+
data: TData[];
|
|
4
|
+
columnHeaders?: TColumn[];
|
|
5
|
+
itemValue?: string;
|
|
6
|
+
perPage?: number;
|
|
7
|
+
currentPage?: number;
|
|
8
|
+
perPageOptions?: number[];
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
selectable?: boolean;
|
|
11
|
+
caption?: string;
|
|
12
|
+
summary?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const VueyeTablePropsDefaults: InferDefaults<VueyeTableProps>;
|
package/dist/components/core/VueyeTable/{VueyeBody → components/VueyeBody}/VueyeBody.vue.d.ts
RENAMED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BodyProps } from './api';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
3
|
+
itemValue: {
|
|
4
|
+
type: globalThis.PropType<string>;
|
|
5
|
+
required: true;
|
|
6
|
+
default: (string | ((props: BodyProps) => string)) | undefined;
|
|
7
|
+
};
|
|
3
8
|
loading: {
|
|
4
9
|
type: globalThis.PropType<boolean>;
|
|
5
10
|
required: true;
|
|
6
|
-
default: boolean;
|
|
11
|
+
default: (boolean | ((props: BodyProps) => boolean)) | undefined;
|
|
7
12
|
};
|
|
8
13
|
bodyRows: {
|
|
9
|
-
type: globalThis.PropType<Row[]>;
|
|
14
|
+
type: globalThis.PropType<import("../..").Row[]>;
|
|
10
15
|
required: true;
|
|
11
|
-
default: () =>
|
|
16
|
+
default: ((props: BodyProps) => import("../..").Row[]) | undefined;
|
|
12
17
|
};
|
|
18
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<globalThis.ExtractPropTypes<{
|
|
13
19
|
itemValue: {
|
|
14
20
|
type: globalThis.PropType<string>;
|
|
15
21
|
required: true;
|
|
16
|
-
default: string;
|
|
22
|
+
default: (string | ((props: BodyProps) => string)) | undefined;
|
|
17
23
|
};
|
|
18
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
24
|
loading: {
|
|
20
25
|
type: globalThis.PropType<boolean>;
|
|
21
26
|
required: true;
|
|
22
|
-
default: boolean;
|
|
27
|
+
default: (boolean | ((props: BodyProps) => boolean)) | undefined;
|
|
23
28
|
};
|
|
24
29
|
bodyRows: {
|
|
25
|
-
type: globalThis.PropType<Row[]>;
|
|
26
|
-
required: true;
|
|
27
|
-
default: () => never[];
|
|
28
|
-
};
|
|
29
|
-
itemValue: {
|
|
30
|
-
type: globalThis.PropType<string>;
|
|
30
|
+
type: globalThis.PropType<import("../..").Row[]>;
|
|
31
31
|
required: true;
|
|
32
|
-
default:
|
|
32
|
+
default: ((props: BodyProps) => import("../..").Row[]) | undefined;
|
|
33
33
|
};
|
|
34
34
|
}>>, {
|
|
35
|
-
loading: boolean;
|
|
36
|
-
bodyRows: Row[];
|
|
37
35
|
itemValue: string;
|
|
36
|
+
loading: boolean;
|
|
37
|
+
bodyRows: import("../..").Row[];
|
|
38
38
|
}, {}>, {
|
|
39
39
|
default?(_: {
|
|
40
40
|
cell: any;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type OptionValue = string | number | boolean | object | symbol;
|
|
2
|
+
interface Option {
|
|
3
|
+
content: OptionValue;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export type DropdownProps = {
|
|
7
|
+
options: Option[];
|
|
8
|
+
modelValue: string | number;
|
|
9
|
+
label: string;
|
|
10
|
+
defaultValue?: Option;
|
|
11
|
+
};
|
|
12
|
+
export declare const dropdownPropsDefaults: {
|
|
13
|
+
options: () => never[];
|
|
14
|
+
modelValue: string;
|
|
15
|
+
label: string;
|
|
16
|
+
};
|
|
17
|
+
export type DropdownEmits = {
|
|
18
|
+
(event: 'update:modelValue', value: OptionValue): void;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
package/dist/components/core/VueyeTable/{VueyeHead → components/VueyeHead}/VueyeHead.vue.d.ts
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ColumnHeader
|
|
1
|
+
import type { ColumnHeader } from '../../types';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
3
3
|
columnHeaders: {
|
|
4
4
|
type: globalThis.PropType<ColumnHeader[][]>;
|
|
5
5
|
required: true;
|
|
6
6
|
default: () => never[];
|
|
7
7
|
};
|
|
8
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<
|
|
8
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<globalThis.ExtractPropTypes<{
|
|
9
9
|
columnHeaders: {
|
|
10
10
|
type: globalThis.PropType<ColumnHeader[][]>;
|
|
11
11
|
required: true;
|
|
@@ -13,7 +13,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
13
13
|
};
|
|
14
14
|
}>>, {
|
|
15
15
|
columnHeaders: ColumnHeader[][];
|
|
16
|
-
}, {}>,
|
|
16
|
+
}, {}>, Readonly<import("../../types").SlotHeaderCell<Record<string, string>> & import("../../types").SlotHeaderCellContent<Record<string, string>>>>;
|
|
17
17
|
export default _default;
|
|
18
18
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
19
19
|
new (): {
|
|
@@ -1,47 +1,48 @@
|
|
|
1
|
+
import { PaginationProps } from './api';
|
|
1
2
|
declare const _default: import("vue").DefineComponent<{
|
|
2
3
|
perPage: {
|
|
3
4
|
type: globalThis.PropType<number>;
|
|
4
5
|
required: true;
|
|
5
|
-
default: number;
|
|
6
|
+
default: (number | ((props: PaginationProps) => number)) | undefined;
|
|
6
7
|
};
|
|
7
8
|
currentPage: {
|
|
8
9
|
type: globalThis.PropType<number>;
|
|
9
10
|
required: true;
|
|
10
|
-
default: number;
|
|
11
|
-
};
|
|
12
|
-
total: {
|
|
13
|
-
type: globalThis.PropType<number>;
|
|
14
|
-
required: true;
|
|
15
|
-
default: number;
|
|
11
|
+
default: (number | ((props: PaginationProps) => number)) | undefined;
|
|
16
12
|
};
|
|
17
13
|
perPageOptions: {
|
|
18
14
|
type: globalThis.PropType<number[]>;
|
|
19
15
|
required: true;
|
|
20
|
-
default: () => number[];
|
|
16
|
+
default: ((props: PaginationProps) => number[]) | undefined;
|
|
17
|
+
};
|
|
18
|
+
total: {
|
|
19
|
+
type: globalThis.PropType<number>;
|
|
20
|
+
required: true;
|
|
21
|
+
default: (number | ((props: PaginationProps) => number)) | undefined;
|
|
21
22
|
};
|
|
22
23
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
24
|
"update:currentPage": (value: number) => void;
|
|
24
25
|
"update:perPage": (value: number) => void;
|
|
25
|
-
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<
|
|
26
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<globalThis.ExtractPropTypes<{
|
|
26
27
|
perPage: {
|
|
27
28
|
type: globalThis.PropType<number>;
|
|
28
29
|
required: true;
|
|
29
|
-
default: number;
|
|
30
|
+
default: (number | ((props: PaginationProps) => number)) | undefined;
|
|
30
31
|
};
|
|
31
32
|
currentPage: {
|
|
32
33
|
type: globalThis.PropType<number>;
|
|
33
34
|
required: true;
|
|
34
|
-
default: number;
|
|
35
|
-
};
|
|
36
|
-
total: {
|
|
37
|
-
type: globalThis.PropType<number>;
|
|
38
|
-
required: true;
|
|
39
|
-
default: number;
|
|
35
|
+
default: (number | ((props: PaginationProps) => number)) | undefined;
|
|
40
36
|
};
|
|
41
37
|
perPageOptions: {
|
|
42
38
|
type: globalThis.PropType<number[]>;
|
|
43
39
|
required: true;
|
|
44
|
-
default: () => number[];
|
|
40
|
+
default: ((props: PaginationProps) => number[]) | undefined;
|
|
41
|
+
};
|
|
42
|
+
total: {
|
|
43
|
+
type: globalThis.PropType<number>;
|
|
44
|
+
required: true;
|
|
45
|
+
default: (number | ((props: PaginationProps) => number)) | undefined;
|
|
45
46
|
};
|
|
46
47
|
}>> & {
|
|
47
48
|
"onUpdate:currentPage"?: ((value: number) => any) | undefined;
|
|
@@ -49,7 +50,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
49
50
|
}, {
|
|
50
51
|
perPage: number;
|
|
51
52
|
currentPage: number;
|
|
52
|
-
total: number;
|
|
53
53
|
perPageOptions: number[];
|
|
54
|
+
total: number;
|
|
54
55
|
}, {}>;
|
|
55
56
|
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InferDefaults } from '../../types';
|
|
2
|
+
export interface PaginationProps {
|
|
3
|
+
perPage: number;
|
|
4
|
+
currentPage: number;
|
|
5
|
+
total: number;
|
|
6
|
+
perPageOptions: number[];
|
|
7
|
+
}
|
|
8
|
+
export interface PaginationEmits {
|
|
9
|
+
(event: 'update:currentPage', value: number): void;
|
|
10
|
+
(event: 'update:perPage', value: number): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const paginationPropsDefaults: InferDefaults<PaginationProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function usePagination(props?: {
|
|
2
|
+
perPage?: number;
|
|
3
|
+
currentPage?: number;
|
|
4
|
+
}): {
|
|
5
|
+
pagination: globalThis.Ref<{
|
|
6
|
+
perPage: number;
|
|
7
|
+
currentPage: number;
|
|
8
|
+
}>;
|
|
9
|
+
updateCurrentPage: (page: number) => void;
|
|
10
|
+
updatePerPage: (perPage: number) => void;
|
|
11
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeepKeys } from './Utils';
|
|
1
2
|
export type SortOrder = 'ascending' | 'descending' | null;
|
|
2
3
|
export type FiltrableColumnHeaderBase = {
|
|
3
4
|
filterable?: boolean;
|
|
@@ -22,7 +23,7 @@ export type SortableColumnHeader = SortableColumnHeaderBase & {
|
|
|
22
23
|
defaultSortOrder?: SortOrder;
|
|
23
24
|
};
|
|
24
25
|
export type ColumnHeaderBase<TData extends Record<string, unknown>> = FiltrableColumnHeaderBase & SortableColumnHeaderBase & {
|
|
25
|
-
key:
|
|
26
|
+
key: string;
|
|
26
27
|
label: string;
|
|
27
28
|
children?: ColumnHeaderBase<TData>[];
|
|
28
29
|
align?: 'left' | 'center' | 'right';
|
|
@@ -34,17 +35,21 @@ export type ColumnHeaderBase<TData extends Record<string, unknown>> = FiltrableC
|
|
|
34
35
|
resizable?: boolean;
|
|
35
36
|
showOverflowTooltip?: boolean;
|
|
36
37
|
};
|
|
37
|
-
export type ColumnHeader = ColumnHeaderBase<{
|
|
38
|
-
id: any;
|
|
39
|
-
}> & FiltrableColumnHeader & SortableColumnHeader & {
|
|
38
|
+
export type ColumnHeader = ColumnHeaderBase<Record<string, never>> & {
|
|
40
39
|
rowSpan?: number;
|
|
41
40
|
colSpan?: number;
|
|
42
41
|
width?: string;
|
|
43
42
|
minWidth?: string;
|
|
44
43
|
scope?: string;
|
|
45
44
|
};
|
|
46
|
-
export type
|
|
47
|
-
[
|
|
45
|
+
export type SlotHeaderCell<T> = {
|
|
46
|
+
[K in DeepKeys<T> as K extends string ? `headerCell.${K}` : never]: (props: {
|
|
48
47
|
headerCell: ColumnHeader;
|
|
49
48
|
}) => any;
|
|
50
49
|
};
|
|
50
|
+
export type SlotHeaderCellContent<T> = {
|
|
51
|
+
[K in DeepKeys<T> as K extends string ? `headerCellContent.${K}` : never]: (props: {
|
|
52
|
+
headerCellContent: ColumnHeader;
|
|
53
|
+
}) => any;
|
|
54
|
+
};
|
|
55
|
+
export type SlotHeader<T> = SlotHeaderCell<T> & SlotHeaderCellContent<T>;
|
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
export type DeepKeys<T> = T extends object ? {
|
|
2
2
|
[K in keyof T]: K | DeepKeys<T[K]>;
|
|
3
3
|
}[keyof T] : never;
|
|
4
|
+
export type Prefix<T extends object, P extends string> = {
|
|
5
|
+
[key in keyof T as `${P}${string & key}`]: T[key];
|
|
6
|
+
};
|
|
7
|
+
export type DeepKeyValues<T extends readonly object[]> = {
|
|
8
|
+
[K in keyof T]: T[K] extends {
|
|
9
|
+
key: infer U;
|
|
10
|
+
} ? U extends string ? T[K] extends {
|
|
11
|
+
children: infer C;
|
|
12
|
+
} ? C extends readonly object[] ? U | DeepKeyValues<C> : never : U : never : never;
|
|
13
|
+
}[number];
|
|
14
|
+
type NativeType = null | number | string | boolean | symbol;
|
|
15
|
+
type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
|
|
16
|
+
export type InferDefaults<T> = {
|
|
17
|
+
[K in keyof T]?: InferDefault<T, T[K]>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -2,4 +2,6 @@ import { ColumnHeader } from '../types';
|
|
|
2
2
|
export declare function depthCount(headers: ColumnHeader[]): number;
|
|
3
3
|
export declare function leafCount(headers: ColumnHeader[]): number;
|
|
4
4
|
export declare function flatHeadersToRows(headers: ColumnHeader[], depth: number, rows?: ColumnHeader[][], currentRow?: number, level?: number): ColumnHeader[][];
|
|
5
|
-
export declare function getHeaderKeys(headers:
|
|
5
|
+
export declare function getHeaderKeys<T extends ColumnHeader>(headers: T[], keysPath?: string, keys?: string[]): string[];
|
|
6
|
+
export declare function defineColumnHeaders(headers: any[]): ColumnHeader[];
|
|
7
|
+
export declare function generateColumns<T>(dataItem: T): ColumnHeader[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function humanize(key: string): string;
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.dropdown__wrapper{position:relative}.dropdown__trigger{display:flex;align-items:center}.dropdown__trigger>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.dropdown__trigger{border-radius:.375rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(124 205 253 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity));padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity));--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.dropdown__trigger:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity));--tw-ring-offset-width: 2px }:is([dir=rtl] .dropdown__trigger)>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 1 }:is(.dark .dropdown__trigger){--tw-border-opacity: 1;border-color:rgb(11 69 111 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(11 69 111 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(248 250 252 / var(--tw-text-opacity))}.dropdown__menu{position:absolute;bottom:100%;right:0;z-index:45;margin-top:.5rem;width:14rem;transform-origin:top right;border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity));--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(0 0 0 / var(--tw-ring-opacity));--tw-ring-opacity: .05 }.dropdown__menu:focus{outline:2px solid transparent;outline-offset:2px}:is(.dark .dropdown__menu){--tw-bg-opacity: 1;background-color:rgb(8 44 73 / var(--tw-bg-opacity))}.dropdown__menu__item{display:block;width:100%;padding:.5rem 1rem;text-align:left;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}.dropdown__menu__item:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.dropdown__menu__item:focus{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px}:is(.dark .dropdown__menu__item){--tw-text-opacity: 1;color:rgb(248 250 252 / var(--tw-text-opacity))}:is(.dark .dropdown__menu__item:hover){--tw-bg-opacity: 1;background-color:rgb(11 69 111 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.dropdown__menu__item--selected{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}:is(.dark .dropdown__menu__item--selected){--tw-bg-opacity: 1;background-color:rgb(11 69 111 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.dropdown__overlay{position:fixed;right:0;bottom:0;top:0;left:0;z-index:40;cursor:default;background-color:transparent}.pagination__wrapper{display:flex;align-items:center;-moz-column-gap:.75rem;column-gap:.75rem}.pagination__details{font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}:is(.dark .pagination__details){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.pagination__btn-list{display:flex}.pagination__btn{display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-width:1px;--tw-border-opacity: 1;border-color:rgb(186 227 253 / var(--tw-border-opacity));background-color:transparent;padding:.5rem}.pagination__btn:focus{--tw-border-opacity: 1;border-color:rgb(12 147 223 / var(--tw-border-opacity));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.pagination__btn:disabled{cursor:not-allowed;opacity:.5}:is(.dark .pagination__btn){--tw-border-opacity: 1;border-color:rgb(6 83 134 / var(--tw-border-opacity))}.pagination__btn--current{--tw-bg-opacity: 1;background-color:rgb(186 227 253 / var(--tw-bg-opacity))}:is(.dark .pagination__btn--current){--tw-bg-opacity: 1;background-color:rgb(6 83 134 / var(--tw-bg-opacity))}table{min-width:800px;border-collapse:collapse;border-radius:.25rem!important;border-width:1px;--tw-border-opacity: 1;border-color:rgb(55 179 249 / var(--tw-border-opacity));font-size:.875rem;line-height:1.25rem;letter-spacing:.025em}th{border-width:1px;--tw-border-opacity: 1;border-color:rgb(55 179 249 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(224 241 254 / var(--tw-bg-opacity));padding:.5rem 1rem}:is(.dark th){--tw-border-opacity: 1;border-color:rgb(6 83 134 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(8 44 73 / var(--tw-bg-opacity))}td{border-width:1px;--tw-border-opacity: 1;border-color:rgb(55 179 249 / var(--tw-border-opacity));padding:.5rem 1rem}:is(.dark td){--tw-border-opacity: 1;border-color:rgb(6 83 134 / var(--tw-border-opacity))}table{text-align:center}tr:nth-child(2n) td{--tw-bg-opacity: 1;background-color:rgb(224 241 254 / var(--tw-bg-opacity))}:is(.dark tr:nth-child(2n) td){--tw-bg-opacity: 1;background-color:rgb(8 44 73 / var(--tw-bg-opacity))}tr:nth-child(odd) td{--tw-bg-opacity: 1;background-color:rgb(240 248 255 / var(--tw-bg-opacity))}:is(.dark tr:nth-child(odd) td){--tw-bg-opacity: 1;background-color:rgb(11 69 111 / var(--tw-bg-opacity))}caption{padding:.5rem}.table__wrapper{display:flex;width:-moz-max-content;width:max-content;flex-direction:column}.table__pagination{margin-top:1rem;align-self:flex-end}
|