vueye-table 1.4.1 → 2.0.0-alpha.2
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 +20 -0
- package/README.md +31 -202
- package/dist/components/core/VueyeTable/VSelect.d.ts +15 -0
- package/dist/components/core/VueyeTable/VueyeBody/VueyeBody.vue.d.ts +49 -0
- package/dist/components/core/VueyeTable/VueyeBody/index.d.ts +2 -0
- package/dist/components/core/VueyeTable/VueyeHead/VueyeHead.vue.d.ts +22 -0
- package/dist/components/core/VueyeTable/VueyeHead/index.d.ts +2 -0
- package/dist/components/core/VueyeTable/VueyePagination/VueyePagination.vue.d.ts +55 -0
- package/dist/components/core/VueyeTable/VueyePagination/index.d.ts +6 -0
- package/dist/components/core/VueyeTable/VueyeTable.vue.d.ts +78 -0
- package/dist/components/core/VueyeTable/composables/index.d.ts +1 -0
- package/dist/components/core/VueyeTable/composables/props/PaginationProps.d.ts +5 -0
- package/dist/components/core/VueyeTable/composables/useHeaderKeys.d.ts +4 -0
- package/dist/components/core/VueyeTable/index.d.ts +5 -0
- package/dist/components/core/VueyeTable/types/Column.d.ts +55 -0
- package/dist/components/core/VueyeTable/types/Row.d.ts +3 -0
- package/dist/components/core/VueyeTable/types/Utils.d.ts +13 -0
- package/dist/components/core/VueyeTable/types/index.d.ts +3 -0
- package/dist/components/core/VueyeTable/util-components/VueyeDropdown.vue.d.ts +53 -0
- package/dist/components/core/VueyeTable/utils/body.d.ts +4 -0
- package/dist/components/core/VueyeTable/utils/header.d.ts +6 -0
- package/dist/components/core/VueyeTable/utils/index.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/composables/dark.d.ts +2 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/data/product.d.ts +14 -0
- package/dist/data/user.d.ts +22 -0
- package/dist/favicon.ico +0 -0
- package/dist/histoire-setup.d.ts +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +8 -0
- package/dist/vueye-table.js +469 -0
- package/dist/vueye-table.umd.cjs +1 -0
- package/dist/white-logo.ico +0 -0
- package/package.json +105 -62
- package/build/vueye-table.common.js +0 -7473
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Antério Vieira
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
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, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,202 +1,31 @@
|
|
|
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
|
-
npm install vueye-table --save
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Usage
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
<template>
|
|
40
|
-
<div id="app">
|
|
41
|
-
<VueyeTable :data="employees" :columns="columns" title="Employees" filter-by="employee_salary">
|
|
42
|
-
<template v-slot:employee_salary="{item}">
|
|
43
|
-
<b
|
|
44
|
-
v-if="item.employee_salary>100000"
|
|
45
|
-
style="background:#3bb640;color:white"
|
|
46
|
-
>{{item.employee_salary}}</b>
|
|
47
|
-
<b v-else style="background:#ee4422;color:white">{{item.employee_salary}}</b>
|
|
48
|
-
</template>
|
|
49
|
-
<template v-slot:actions="{item}">
|
|
50
|
-
<div class="ve-table-actions">
|
|
51
|
-
<button class="ve-table-btn ve-table-btn-primary" @click="edit(item)">Edit</button>
|
|
52
|
-
<button class="ve-table-btn ve-table-btn-danger" @click="deleteItem(item)">Delete</button>
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
55
|
-
</VueyeTable>
|
|
56
|
-
</div>
|
|
57
|
-
</template>
|
|
58
|
-
|
|
59
|
-
<script>
|
|
60
|
-
import VueyeTable from "./components/VueyeTable.vue";
|
|
61
|
-
import employees from "./assets/employees.json";
|
|
62
|
-
export default {
|
|
63
|
-
name: "App",
|
|
64
|
-
data: () => ({
|
|
65
|
-
employees: employees,
|
|
66
|
-
columns: [
|
|
67
|
-
{
|
|
68
|
-
key: "id",
|
|
69
|
-
label: "ID",
|
|
70
|
-
sortable: true,
|
|
71
|
-
type: "number",
|
|
72
|
-
display: true
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
key: "employee_name",
|
|
76
|
-
label: "Employee Name",
|
|
77
|
-
sortable: true,
|
|
78
|
-
display: true
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
key: "employee_salary",
|
|
82
|
-
label: "Employee Salary",
|
|
83
|
-
display: true,
|
|
84
|
-
sortable: true
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
key: "employee_age",
|
|
88
|
-
label: "Employee Age",
|
|
89
|
-
sortable: true
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
key: "address.city",
|
|
93
|
-
label: "Address",
|
|
94
|
-
display: true,
|
|
95
|
-
sortable: true
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
key: "actions",
|
|
99
|
-
label: "Actions",
|
|
100
|
-
sortable: false,
|
|
101
|
-
display: true
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
selectedRows: []
|
|
105
|
-
}),
|
|
106
|
-
methods: {
|
|
107
|
-
edit(item) {
|
|
108
|
-
//open a dialog to edit the selected item
|
|
109
|
-
//or redirect to another page that contains
|
|
110
|
-
// edit form
|
|
111
|
-
},
|
|
112
|
-
deleteItem(item) {
|
|
113
|
-
this.employees = this.employees.filter(
|
|
114
|
-
employee => employee.id !== item.id
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
components: {
|
|
119
|
-
VueyeTable
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
</script>
|
|
123
|
-
|
|
124
|
-
<style lang="scss">
|
|
125
|
-
#app {
|
|
126
|
-
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
127
|
-
-webkit-font-smoothing: antialiased;
|
|
128
|
-
-moz-osx-font-smoothing: grayscale;
|
|
129
|
-
text-align: center;
|
|
130
|
-
color: #2c3e50;
|
|
131
|
-
display: flex;
|
|
132
|
-
justify-content: center;
|
|
133
|
-
align-items: center;
|
|
134
|
-
padding: 20px;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.ve-table {
|
|
138
|
-
&-actions {
|
|
139
|
-
width: 104px;
|
|
140
|
-
display: flex;
|
|
141
|
-
justify-content: space-around;
|
|
142
|
-
align-items: center;
|
|
143
|
-
}
|
|
144
|
-
&-btn {
|
|
145
|
-
height: 24px;
|
|
146
|
-
min-width: 32px;
|
|
147
|
-
padding: 0 8px;
|
|
148
|
-
text-align: center;
|
|
149
|
-
border-radius: 4px;
|
|
150
|
-
|
|
151
|
-
cursor: pointer;
|
|
152
|
-
justify-content: center;
|
|
153
|
-
outline: none;
|
|
154
|
-
border: none;
|
|
155
|
-
position: relative;
|
|
156
|
-
white-space: nowrap;
|
|
157
|
-
&-primary {
|
|
158
|
-
background: #3844cc;
|
|
159
|
-
color: white;
|
|
160
|
-
}
|
|
161
|
-
&-danger {
|
|
162
|
-
background: #e24e40;
|
|
163
|
-
color: white;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
</style>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
In main.js add `@vue/composition-api` plugin to make work with Vue.js 2 :
|
|
173
|
-
|
|
174
|
-
```js
|
|
175
|
-
import Vue from 'vue';
|
|
176
|
-
import App from './App.vue';
|
|
177
|
-
import VueComp from '@vue/composition-api';
|
|
178
|
-
Vue.config.productionTip = false;
|
|
179
|
-
|
|
180
|
-
Vue.use(VueComp);
|
|
181
|
-
|
|
182
|
-
new Vue({
|
|
183
|
-
render: h => h(App),
|
|
184
|
-
}).$mount('#app');
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Props
|
|
188
|
-
|
|
189
|
-
| Name | Description |
|
|
190
|
-
| --------------- | -------------------------------------------- |
|
|
191
|
-
| title | the data table title |
|
|
192
|
-
| columns | the attributes or columns |
|
|
193
|
-
| data | JS array of object or json content |
|
|
194
|
-
| filter-by | specify the default column for filter |
|
|
195
|
-
| per-page-values | the array of per pages values |
|
|
196
|
-
| per-page | the default per page |
|
|
197
|
-
| select-rows | add checkbox columns in order to select rows |
|
|
198
|
-
| v-model | returns the selected rows |
|
|
199
|
-
| dense | Show table rows in small size |
|
|
200
|
-
| striped | Apply striped style |
|
|
201
|
-
| bordered | make the table bordered |
|
|
202
|
-
| header-display | show/hide the table header |
|
|
1
|
+
# Vueye-table
|
|
2
|
+
|
|
3
|
+
:warning: **This project is still in development.**
|
|
4
|
+
|
|
5
|
+
## Tools and conventions
|
|
6
|
+
|
|
7
|
+
- [x] Eslint
|
|
8
|
+
- [x] Prettier
|
|
9
|
+
- [x] Conventional Commit
|
|
10
|
+
- [x] Pre-commit
|
|
11
|
+
- [x] Lint-staged
|
|
12
|
+
- [x] Semantic-release
|
|
13
|
+
- [x] TypeScript
|
|
14
|
+
|
|
15
|
+
## TODO
|
|
16
|
+
|
|
17
|
+
1. Data Rendering ✅
|
|
18
|
+
2. Sorting
|
|
19
|
+
3. Filtering
|
|
20
|
+
4. Pagination ✅
|
|
21
|
+
5. Selection
|
|
22
|
+
6. Editing
|
|
23
|
+
7. Resizing and Reordering
|
|
24
|
+
8. Row Expansion
|
|
25
|
+
9. Grouping by columns ✅
|
|
26
|
+
10. Exporting
|
|
27
|
+
11. Responsive Design
|
|
28
|
+
12. Customization
|
|
29
|
+
13. Accessibility
|
|
30
|
+
14. ...
|
|
31
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Meta<TData extends Record<TItemValue, unknown>, TItemValue extends string = 'id'> = {
|
|
2
|
+
key: keyof TData;
|
|
3
|
+
label: string;
|
|
4
|
+
children?: Meta<TData, TItemValue>[];
|
|
5
|
+
};
|
|
6
|
+
export type SelectProps<TData extends Record<TItemValue, unknown>, TItemValue extends string = 'id'> = {
|
|
7
|
+
itemValue: TItemValue;
|
|
8
|
+
items: TData[];
|
|
9
|
+
meta: Meta<any>;
|
|
10
|
+
};
|
|
11
|
+
export declare const VSelect: (props: {
|
|
12
|
+
items: any[];
|
|
13
|
+
itemValue: string;
|
|
14
|
+
meta: Meta<any, "id">;
|
|
15
|
+
} & {}) => any;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Row } from '../types';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
3
|
+
loading: {
|
|
4
|
+
type: globalThis.PropType<boolean>;
|
|
5
|
+
required: true;
|
|
6
|
+
default: boolean;
|
|
7
|
+
};
|
|
8
|
+
bodyRows: {
|
|
9
|
+
type: globalThis.PropType<Row[]>;
|
|
10
|
+
required: true;
|
|
11
|
+
default: () => never[];
|
|
12
|
+
};
|
|
13
|
+
itemValue: {
|
|
14
|
+
type: globalThis.PropType<string>;
|
|
15
|
+
required: true;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
|
+
loading: {
|
|
20
|
+
type: globalThis.PropType<boolean>;
|
|
21
|
+
required: true;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
24
|
+
bodyRows: {
|
|
25
|
+
type: globalThis.PropType<Row[]>;
|
|
26
|
+
required: true;
|
|
27
|
+
default: () => never[];
|
|
28
|
+
};
|
|
29
|
+
itemValue: {
|
|
30
|
+
type: globalThis.PropType<string>;
|
|
31
|
+
required: true;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
}>>, {
|
|
35
|
+
loading: boolean;
|
|
36
|
+
bodyRows: Row[];
|
|
37
|
+
itemValue: string;
|
|
38
|
+
}, {}>, {
|
|
39
|
+
default?(_: {
|
|
40
|
+
cell: any;
|
|
41
|
+
key: string;
|
|
42
|
+
}): any;
|
|
43
|
+
}>;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ColumnHeader, SlotHeader } from '../types';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
3
|
+
columnHeaders: {
|
|
4
|
+
type: globalThis.PropType<ColumnHeader[][]>;
|
|
5
|
+
required: true;
|
|
6
|
+
default: () => never[];
|
|
7
|
+
};
|
|
8
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
|
+
columnHeaders: {
|
|
10
|
+
type: globalThis.PropType<ColumnHeader[][]>;
|
|
11
|
+
required: true;
|
|
12
|
+
default: () => never[];
|
|
13
|
+
};
|
|
14
|
+
}>>, {
|
|
15
|
+
columnHeaders: ColumnHeader[][];
|
|
16
|
+
}, {}>, SlotHeader<Record<string, string>>>;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
perPage: {
|
|
3
|
+
type: globalThis.PropType<number>;
|
|
4
|
+
required: true;
|
|
5
|
+
default: number;
|
|
6
|
+
};
|
|
7
|
+
currentPage: {
|
|
8
|
+
type: globalThis.PropType<number>;
|
|
9
|
+
required: true;
|
|
10
|
+
default: number;
|
|
11
|
+
};
|
|
12
|
+
total: {
|
|
13
|
+
type: globalThis.PropType<number>;
|
|
14
|
+
required: true;
|
|
15
|
+
default: number;
|
|
16
|
+
};
|
|
17
|
+
perPageOptions: {
|
|
18
|
+
type: globalThis.PropType<number[]>;
|
|
19
|
+
required: true;
|
|
20
|
+
default: () => number[];
|
|
21
|
+
};
|
|
22
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
|
+
"update:currentPage": (value: number) => void;
|
|
24
|
+
"update:perPage": (value: number) => void;
|
|
25
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
|
+
perPage: {
|
|
27
|
+
type: globalThis.PropType<number>;
|
|
28
|
+
required: true;
|
|
29
|
+
default: number;
|
|
30
|
+
};
|
|
31
|
+
currentPage: {
|
|
32
|
+
type: globalThis.PropType<number>;
|
|
33
|
+
required: true;
|
|
34
|
+
default: number;
|
|
35
|
+
};
|
|
36
|
+
total: {
|
|
37
|
+
type: globalThis.PropType<number>;
|
|
38
|
+
required: true;
|
|
39
|
+
default: number;
|
|
40
|
+
};
|
|
41
|
+
perPageOptions: {
|
|
42
|
+
type: globalThis.PropType<number[]>;
|
|
43
|
+
required: true;
|
|
44
|
+
default: () => number[];
|
|
45
|
+
};
|
|
46
|
+
}>> & {
|
|
47
|
+
"onUpdate:currentPage"?: ((value: number) => any) | undefined;
|
|
48
|
+
"onUpdate:perPage"?: ((value: number) => any) | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
perPage: number;
|
|
51
|
+
currentPage: number;
|
|
52
|
+
total: number;
|
|
53
|
+
perPageOptions: number[];
|
|
54
|
+
}, {}>;
|
|
55
|
+
export default _default;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ColumnHeader } from './types';
|
|
2
|
+
declare const _default: <TData extends Record<string, unknown>, TColumn extends ColumnHeader>(__VLS_props: {
|
|
3
|
+
itemValue?: string | undefined;
|
|
4
|
+
columnHeaders: TColumn[];
|
|
5
|
+
data: TData[];
|
|
6
|
+
perPage?: number | undefined;
|
|
7
|
+
currentPage?: number | undefined;
|
|
8
|
+
perPageOptions?: number[] | undefined;
|
|
9
|
+
loading?: boolean | undefined;
|
|
10
|
+
selectable?: boolean | undefined;
|
|
11
|
+
caption?: string | undefined;
|
|
12
|
+
summary?: string | undefined;
|
|
13
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: Pick<{
|
|
14
|
+
props: {
|
|
15
|
+
itemValue?: string | undefined;
|
|
16
|
+
columnHeaders: TColumn[];
|
|
17
|
+
data: TData[];
|
|
18
|
+
perPage?: number | undefined;
|
|
19
|
+
currentPage?: number | undefined;
|
|
20
|
+
perPageOptions?: number[] | undefined;
|
|
21
|
+
loading?: boolean | undefined;
|
|
22
|
+
selectable?: boolean | undefined;
|
|
23
|
+
caption?: string | undefined;
|
|
24
|
+
summary?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
expose(exposed: {}): void;
|
|
27
|
+
attrs: any;
|
|
28
|
+
slots: import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
29
|
+
caption: () => any;
|
|
30
|
+
summary: () => any;
|
|
31
|
+
};
|
|
32
|
+
emit: any;
|
|
33
|
+
}, "attrs" | "emit" | "slots"> | undefined, __VLS_setup?: Promise<{
|
|
34
|
+
props: {
|
|
35
|
+
itemValue?: string | undefined;
|
|
36
|
+
columnHeaders: TColumn[];
|
|
37
|
+
data: TData[];
|
|
38
|
+
perPage?: number | undefined;
|
|
39
|
+
currentPage?: number | undefined;
|
|
40
|
+
perPageOptions?: number[] | undefined;
|
|
41
|
+
loading?: boolean | undefined;
|
|
42
|
+
selectable?: boolean | undefined;
|
|
43
|
+
caption?: string | undefined;
|
|
44
|
+
summary?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
expose(exposed: {}): void;
|
|
47
|
+
attrs: any;
|
|
48
|
+
slots: import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
49
|
+
caption: () => any;
|
|
50
|
+
summary: () => any;
|
|
51
|
+
};
|
|
52
|
+
emit: any;
|
|
53
|
+
}>) => globalThis.VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}> & {
|
|
56
|
+
__ctx?: {
|
|
57
|
+
props: {
|
|
58
|
+
itemValue?: string | undefined;
|
|
59
|
+
columnHeaders: TColumn[];
|
|
60
|
+
data: TData[];
|
|
61
|
+
perPage?: number | undefined;
|
|
62
|
+
currentPage?: number | undefined;
|
|
63
|
+
perPageOptions?: number[] | undefined;
|
|
64
|
+
loading?: boolean | undefined;
|
|
65
|
+
selectable?: boolean | undefined;
|
|
66
|
+
caption?: string | undefined;
|
|
67
|
+
summary?: string | undefined;
|
|
68
|
+
};
|
|
69
|
+
expose(exposed: {}): void;
|
|
70
|
+
attrs: any;
|
|
71
|
+
slots: import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
72
|
+
caption: () => any;
|
|
73
|
+
summary: () => any;
|
|
74
|
+
};
|
|
75
|
+
emit: any;
|
|
76
|
+
} | undefined;
|
|
77
|
+
};
|
|
78
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useHeaderKeys';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DeepKeys } from './Utils';
|
|
2
|
+
export type SortOrder = 'ascending' | 'descending' | null;
|
|
3
|
+
export type FiltrableColumnHeaderBase = {
|
|
4
|
+
filterable?: boolean;
|
|
5
|
+
filter?: (value: any, filter: any) => boolean;
|
|
6
|
+
};
|
|
7
|
+
export type FiltrableColumnHeader = FiltrableColumnHeaderBase & {
|
|
8
|
+
filterOptions?: any[];
|
|
9
|
+
filterMultiple?: boolean;
|
|
10
|
+
filterMethod?: (value: any, filter: any) => boolean;
|
|
11
|
+
filterRemote?: boolean;
|
|
12
|
+
filterRemoteMethod?: (prop: string, filters: any[]) => Promise<any>;
|
|
13
|
+
};
|
|
14
|
+
export type SortableColumnHeaderBase = {
|
|
15
|
+
sortable?: boolean;
|
|
16
|
+
sortMethod?: (a: any, b: any) => number;
|
|
17
|
+
sortBy?: (row: any) => any;
|
|
18
|
+
};
|
|
19
|
+
export type SortableColumnHeader = SortableColumnHeaderBase & {
|
|
20
|
+
sortOrders?: SortOrder[];
|
|
21
|
+
sortRemote?: boolean;
|
|
22
|
+
sortRemoteMethod?: (prop: string, order: SortOrder) => Promise<any>;
|
|
23
|
+
defaultSortOrder?: SortOrder;
|
|
24
|
+
};
|
|
25
|
+
export type ColumnHeaderBase<TData extends Record<string, unknown>> = FiltrableColumnHeaderBase & SortableColumnHeaderBase & {
|
|
26
|
+
key: string;
|
|
27
|
+
label: string;
|
|
28
|
+
children?: ColumnHeaderBase<TData>[];
|
|
29
|
+
align?: 'left' | 'center' | 'right';
|
|
30
|
+
fixed?: 'left' | 'right';
|
|
31
|
+
formatter?: (value: any, row: any, index: number) => string;
|
|
32
|
+
className?: string;
|
|
33
|
+
labelClassName?: string;
|
|
34
|
+
selectable?: (row: any, index: number) => boolean;
|
|
35
|
+
resizable?: boolean;
|
|
36
|
+
showOverflowTooltip?: boolean;
|
|
37
|
+
};
|
|
38
|
+
export type ColumnHeader = ColumnHeaderBase<{}> & {
|
|
39
|
+
rowSpan?: number;
|
|
40
|
+
colSpan?: number;
|
|
41
|
+
width?: string;
|
|
42
|
+
minWidth?: string;
|
|
43
|
+
scope?: string;
|
|
44
|
+
};
|
|
45
|
+
export type SlotHeaderCell<T> = {
|
|
46
|
+
[K in DeepKeys<T> as K extends string ? `headerCell.${K}` : never]: (props: {
|
|
47
|
+
headerCell: ColumnHeader;
|
|
48
|
+
}) => any;
|
|
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>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type DeepKeys<T> = T extends object ? {
|
|
2
|
+
[K in keyof T]: K | DeepKeys<T[K]>;
|
|
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];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type OptionValue = string | number | boolean | object | symbol;
|
|
2
|
+
interface Option {
|
|
3
|
+
value: OptionValue;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import("vue").DefineComponent<{
|
|
7
|
+
label: {
|
|
8
|
+
type: globalThis.PropType<string>;
|
|
9
|
+
required: true;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
options: {
|
|
13
|
+
type: globalThis.PropType<Option[]>;
|
|
14
|
+
required: true;
|
|
15
|
+
default: () => never[];
|
|
16
|
+
};
|
|
17
|
+
modelValue: {
|
|
18
|
+
type: globalThis.PropType<string | number>;
|
|
19
|
+
required: true;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
defaultValue: {
|
|
23
|
+
type: globalThis.PropType<Option>;
|
|
24
|
+
};
|
|
25
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
+
"update:modelValue": (value: OptionValue) => void;
|
|
27
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
|
+
label: {
|
|
29
|
+
type: globalThis.PropType<string>;
|
|
30
|
+
required: true;
|
|
31
|
+
default: string;
|
|
32
|
+
};
|
|
33
|
+
options: {
|
|
34
|
+
type: globalThis.PropType<Option[]>;
|
|
35
|
+
required: true;
|
|
36
|
+
default: () => never[];
|
|
37
|
+
};
|
|
38
|
+
modelValue: {
|
|
39
|
+
type: globalThis.PropType<string | number>;
|
|
40
|
+
required: true;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
defaultValue: {
|
|
44
|
+
type: globalThis.PropType<Option>;
|
|
45
|
+
};
|
|
46
|
+
}>> & {
|
|
47
|
+
"onUpdate:modelValue"?: ((value: OptionValue) => any) | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
label: string;
|
|
50
|
+
options: Option[];
|
|
51
|
+
modelValue: string | number;
|
|
52
|
+
}, {}>;
|
|
53
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ColumnHeader } from '../types';
|
|
2
|
+
export declare function depthCount(headers: ColumnHeader[]): number;
|
|
3
|
+
export declare function leafCount(headers: ColumnHeader[]): number;
|
|
4
|
+
export declare function flatHeadersToRows(headers: ColumnHeader[], depth: number, rows?: ColumnHeader[][], currentRow?: number, level?: number): ColumnHeader[][];
|
|
5
|
+
export declare function getHeaderKeys<T extends ColumnHeader>(headers: T[], keysPath?: string, keys?: string[]): string[];
|
|
6
|
+
export declare function defineColumnHeaders(headers: any[]): ColumnHeader[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './core/VueyeTable';
|