vuetable-next 1.0.5 → 1.0.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/vuetable-next.d.ts +17 -5
- package/dist/vuetable-next.js +1500 -4236
- package/dist/vuetable-next.js.map +1 -1
- package/dist/vuetable-next.umd.cjs +7 -32
- package/dist/vuetable-next.umd.cjs.map +1 -1
- package/package.json +6 -8
- package/.eslintignore +0 -4
- package/.idea/easycode.ignore +0 -13
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/jsLinters/eslint.xml +0 -6
- package/.idea/material_theme_project_new.xml +0 -13
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/vuetable-next.iml +0 -12
- package/.vscode/extensions.json +0 -3
- package/auto-imports.d.ts +0 -73
- package/demo/vue2/index.ts +0 -6
- package/demo/vue2/index.vue +0 -17
- package/demo/vue3/index.ts +0 -4
- package/demo/vue3/index.vue +0 -12
- package/eslint.config.js +0 -122
- package/index.html +0 -86
- package/public/vite.svg +0 -1
- package/src/assets/vue.svg +0 -1
- package/src/components/Vuetable.vue +0 -1207
- package/src/components/VuetableColGroup.vue +0 -66
- package/src/components/VuetableColGutter.vue +0 -25
- package/src/components/VuetableCssSemanticUI.ts +0 -36
- package/src/components/VuetableFieldCheckbox.vue +0 -87
- package/src/components/VuetableFieldCheckboxMixin.vue +0 -46
- package/src/components/VuetableFieldHandle.vue +0 -41
- package/src/components/VuetableFieldMixin.vue +0 -30
- package/src/components/VuetableFieldSequence.vue +0 -43
- package/src/components/VuetablePagination.vue +0 -119
- package/src/components/VuetablePaginationDropdown.vue +0 -88
- package/src/components/VuetablePaginationInfo.vue +0 -51
- package/src/components/VuetablePaginationInfoMixin.vue +0 -64
- package/src/components/VuetablePaginationMixin.vue +0 -107
- package/src/components/VuetableRowHeader.vue +0 -196
- package/src/components/useVuetablePagination.ts +0 -56
- package/src/components/useVuetablePaginationInfo.ts +0 -40
- package/src/data/fields.ts +0 -102
- package/src/data/lang.ts +0 -4
- package/src/index.ts +0 -57
- package/src/main.ts +0 -398
- package/src/style.css +0 -79
- package/src/vite-env.d.ts +0 -1
- package/test/Vuetable.AJAX.test.ts +0 -291
- package/test/Vuetable.Components.test.ts +0 -27
- package/test/Vuetable.Composable.test.ts +0 -151
- package/test/Vuetable.Computed.test.ts +0 -211
- package/test/Vuetable.Features.test.ts +0 -145
- package/test/Vuetable.FieldsDefinition.test.ts +0 -236
- package/test/Vuetable.HTML.test.ts +0 -16
- package/test/Vuetable.Methods.test.ts +0 -373
- package/test/__snapshots__/Vuetable.Components.test.ts.snap +0 -11
- package/test/__snapshots__/Vuetable.HTML.test.ts.snap +0 -85
- package/tsconfig.app.json +0 -32
- package/tsconfig.json +0 -22
- package/tsconfig.node.json +0 -13
- package/vite.config.ts +0 -52
- package/vitest.config.ts +0 -17
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<colgroup>
|
|
3
|
-
<template v-for="(field, fieldIndex) in vuetable.tableFields">
|
|
4
|
-
<template v-if="field.visible">
|
|
5
|
-
<col
|
|
6
|
-
:key="fieldIndex"
|
|
7
|
-
:style="{width: field.width}"
|
|
8
|
-
:class="columnClass(field, fieldIndex)"/>
|
|
9
|
-
</template>
|
|
10
|
-
</template>
|
|
11
|
-
<col
|
|
12
|
-
v-if="isHeader && vuetable.scrollVisible"
|
|
13
|
-
:style="{ width: vuetable.scrollBarWidth }"
|
|
14
|
-
class="vuetable-col-gutter"/>
|
|
15
|
-
</colgroup>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script setup lang="ts">
|
|
19
|
-
import {
|
|
20
|
-
defineOptions,
|
|
21
|
-
defineProps,
|
|
22
|
-
inject
|
|
23
|
-
} from "vue-demi";
|
|
24
|
-
import type { DefineComponent } from "vue-demi";
|
|
25
|
-
import type Vuetable from "./Vuetable.vue";
|
|
26
|
-
|
|
27
|
-
interface Props {
|
|
28
|
-
isHeader?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface Field {
|
|
32
|
-
name: string | DefineComponent
|
|
33
|
-
sortField: string | null
|
|
34
|
-
title: string | ((str?: any) => string)
|
|
35
|
-
titleClass: string
|
|
36
|
-
dataClass: string
|
|
37
|
-
formatter: (<T>(...args: any[]) => T) | null
|
|
38
|
-
visible: boolean
|
|
39
|
-
width: string
|
|
40
|
-
$_index: number
|
|
41
|
-
[key: string]: unknown
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const vuetable = inject("vuetable") as InstanceType<typeof Vuetable>;
|
|
45
|
-
|
|
46
|
-
defineOptions({
|
|
47
|
-
name: "vuetable-col-group",
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const {
|
|
51
|
-
isHeader = false
|
|
52
|
-
} = defineProps<Props>();
|
|
53
|
-
|
|
54
|
-
function columnClass (field: Field, fieldIndex: number) {
|
|
55
|
-
let fieldName = typeof field.name === "object" && field.name !== null
|
|
56
|
-
? (field.name as DefineComponent).name
|
|
57
|
-
: field.name as string;
|
|
58
|
-
fieldName = fieldName!.replace(vuetable.fieldPrefix as string, "");
|
|
59
|
-
|
|
60
|
-
return [`vuetable-col-${ fieldName }`, field.titleClass, `${ fieldName }-${ fieldIndex }`];
|
|
61
|
-
}
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<style scoped>
|
|
65
|
-
|
|
66
|
-
</style>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<th
|
|
3
|
-
:style="{ width: vuetable.scrollBarWidth }"
|
|
4
|
-
class="vuetable-th-gutter">
|
|
5
|
-
</th>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script setup lang="ts">
|
|
9
|
-
import { defineOptions, inject } from "vue-demi";
|
|
10
|
-
import type Vuetable from "./Vuetable.vue";
|
|
11
|
-
|
|
12
|
-
defineOptions({
|
|
13
|
-
name: "vuetable-th-gutter",
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const vuetable = inject("vuetable") as InstanceType<typeof Vuetable>;
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<style scoped>
|
|
20
|
-
.vuetable-th-gutter {
|
|
21
|
-
padding: 0 !important;
|
|
22
|
-
border-left: none !important;
|
|
23
|
-
border-right: none !important;
|
|
24
|
-
}
|
|
25
|
-
</style>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
table: {
|
|
3
|
-
tableWrapper: "",
|
|
4
|
-
tableHeaderClass: "fixed",
|
|
5
|
-
tableBodyClass: "fixed",
|
|
6
|
-
tableClass: "ui blue selectable unstackable celled table",
|
|
7
|
-
loadingClass: "loading",
|
|
8
|
-
ascendingIcon: "blue chevron up icon",
|
|
9
|
-
descendingIcon: "blue chevron down icon",
|
|
10
|
-
ascendingClass: "sorted-asc",
|
|
11
|
-
descendingClass: "sorted-desc",
|
|
12
|
-
sortableIcon: "grey sort icon",
|
|
13
|
-
handleIcon: "grey sidebar icon",
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
pagination: {
|
|
17
|
-
wrapperClass: "ui right floated pagination menu",
|
|
18
|
-
activeClass: "active large",
|
|
19
|
-
disabledClass: "disabled",
|
|
20
|
-
pageClass: "item",
|
|
21
|
-
linkClass: "icon item",
|
|
22
|
-
paginationClass: "ui bottom attached segment grid",
|
|
23
|
-
paginationInfoClass: "left floated left aligned six wide column",
|
|
24
|
-
dropdownClass: "ui search dropdown",
|
|
25
|
-
icons: {
|
|
26
|
-
first: "angle double left icon",
|
|
27
|
-
prev: "left chevron icon",
|
|
28
|
-
next: "right chevron icon",
|
|
29
|
-
last: "angle double right icon",
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
paginationInfo: {
|
|
34
|
-
infoClass: "left floated left aligned six wide column",
|
|
35
|
-
}
|
|
36
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<th
|
|
3
|
-
v-if="isHeader"
|
|
4
|
-
class="vuetable-th-component-checkbox">
|
|
5
|
-
<input
|
|
6
|
-
:checked="isAllItemsInCurrentPageSelected()"
|
|
7
|
-
type="checkbox"
|
|
8
|
-
@change="toggleAllCheckbox($event)"/>
|
|
9
|
-
</th>
|
|
10
|
-
<td
|
|
11
|
-
v-else
|
|
12
|
-
class="vuetable-td-component-checkbox">
|
|
13
|
-
<input
|
|
14
|
-
ref="checkbox"
|
|
15
|
-
:checked="isSelected(rowData!)"
|
|
16
|
-
type="checkbox"
|
|
17
|
-
@change="toggleCheckbox(rowData!, $event)"/>
|
|
18
|
-
</td>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script setup lang="ts">
|
|
22
|
-
import { type ComponentPublicInstance, defineOptions, defineProps, inject, ref } from "vue-demi";
|
|
23
|
-
import type Vuetable from "./Vuetable.vue";
|
|
24
|
-
|
|
25
|
-
interface Props {
|
|
26
|
-
rowData?: { [key: string]: any }
|
|
27
|
-
rowIndex?: number
|
|
28
|
-
rowField?: { [key: string]: any } | null
|
|
29
|
-
isHeader?: boolean
|
|
30
|
-
title?: string
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
type CustomEvent = Event & { target: { checked: boolean } };
|
|
34
|
-
|
|
35
|
-
defineOptions({
|
|
36
|
-
name: "vuetable-field-checkbox"
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const {
|
|
40
|
-
rowField = null,
|
|
41
|
-
isHeader = false,
|
|
42
|
-
} = defineProps<Props>();
|
|
43
|
-
|
|
44
|
-
const vuetable = inject("vuetable") as InstanceType<typeof Vuetable>;
|
|
45
|
-
|
|
46
|
-
const checkbox = ref<ComponentPublicInstance<HTMLInputElement> | null>(null);
|
|
47
|
-
|
|
48
|
-
function toggleCheckbox (dataItem: { [key: string]: unknown }, event: Event) {
|
|
49
|
-
vuetable.onCheckboxToggled((event as CustomEvent).target.checked, rowField?.name, dataItem);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function toggleAllCheckbox (event: Event) {
|
|
53
|
-
vuetable.onCheckboxToggledAll((event as CustomEvent).target.checked);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function isSelected (rowData: { [key: string]: any }): boolean {
|
|
57
|
-
return vuetable.isSelectedRow(rowData[vuetable.trackBy]);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function isAllItemsInCurrentPageSelected () {
|
|
61
|
-
if (!vuetable.tableData) return;
|
|
62
|
-
|
|
63
|
-
const idColumn = vuetable.trackBy;
|
|
64
|
-
const checkboxEl = checkbox.value?.$el.querySelector("input[type=checkbox]");
|
|
65
|
-
const selected = vuetable.tableData.filter((item: { [key: string]: string }) => vuetable.isSelectedRow(item[idColumn]) );
|
|
66
|
-
|
|
67
|
-
// count == 0, clear the checkbox
|
|
68
|
-
if (selected.length <= 0) {
|
|
69
|
-
checkboxEl.indeterminate = false;
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
// count > 0 and count < perPage, set checkbox state to 'indeterminate'
|
|
73
|
-
else if (selected.length < vuetable.perPage!) {
|
|
74
|
-
checkboxEl.indeterminate = true;
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
// count == perPage, set checkbox state to 'checked'
|
|
78
|
-
else {
|
|
79
|
-
checkboxEl.indeterminate = false;
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
</script>
|
|
84
|
-
|
|
85
|
-
<style scoped>
|
|
86
|
-
|
|
87
|
-
</style>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { defineComponent } from "vue-demi";
|
|
3
|
-
import VuetableFieldMixin from "./VuetableFieldMixin.vue";
|
|
4
|
-
|
|
5
|
-
export default defineComponent({
|
|
6
|
-
mixins: [VuetableFieldMixin],
|
|
7
|
-
|
|
8
|
-
methods: {
|
|
9
|
-
toggleCheckbox(dataItem: any, event: Event & { target: { checked: boolean } }) {
|
|
10
|
-
this.vuetable.onCheckboxToggled(event.target.checked, this.rowField!.name, dataItem);
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
toggleAllCheckbox(event: Event & { target: { checked: boolean } }) {
|
|
14
|
-
this.vuetable.onCheckboxToggledAll(event.target.checked);
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
isSelected(rowData: any) {
|
|
18
|
-
return this.vuetable.isSelectedRow(rowData[this.vuetable.trackBy]);
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
isAllItemsInCurrentPageSelected() {
|
|
22
|
-
if (! this.vuetable.tableData) return;
|
|
23
|
-
|
|
24
|
-
let idColumn = this.vuetable.trackBy;
|
|
25
|
-
let checkbox = this.$el.querySelector("input[type=checkbox]");
|
|
26
|
-
let selected = this.vuetable.tableData.filter((item: any) => this.vuetable.isSelectedRow(item[idColumn]));
|
|
27
|
-
|
|
28
|
-
// count == 0, clear the checkbox
|
|
29
|
-
if (selected.length <= 0) {
|
|
30
|
-
checkbox.indeterminate = false;
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
// count > 0 and count < perPage, set checkbox state to 'indeterminate'
|
|
34
|
-
else if (selected.length < this.vuetable.perPage) {
|
|
35
|
-
checkbox.indeterminate = true;
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
// count == perPage, set checkbox state to 'checked'
|
|
39
|
-
else {
|
|
40
|
-
checkbox.indeterminate = false;
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
</script>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<th v-if="isHeader"
|
|
3
|
-
class="vuetable-th-component-handle"
|
|
4
|
-
v-html="title">
|
|
5
|
-
</th>
|
|
6
|
-
<td v-else
|
|
7
|
-
class="vuetable-td-component-handle"
|
|
8
|
-
v-html="renderIconTag(['handle-icon', css.handleIcon])">
|
|
9
|
-
</td>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script setup lang="ts">
|
|
13
|
-
import { defineOptions, inject, defineProps } from "vue-demi";
|
|
14
|
-
import type Vuetable from "./Vuetable.vue";
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
isHeader?: boolean
|
|
18
|
-
title?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
defineOptions({
|
|
22
|
-
name: "vuetable-field-handle"
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const vuetable = inject("vuetable") as InstanceType<typeof Vuetable>;
|
|
26
|
-
|
|
27
|
-
const {
|
|
28
|
-
isHeader = false,
|
|
29
|
-
title = ""
|
|
30
|
-
} = defineProps<Props>();
|
|
31
|
-
|
|
32
|
-
function renderIconTag (classes: string[], options = "") {
|
|
33
|
-
return typeof(vuetable.css.renderIcon) === "undefined"
|
|
34
|
-
? `<i class="${classes.join(" ")}" ${options}></i>`
|
|
35
|
-
: vuetable.css.renderIcon(classes, options);
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<style scoped>
|
|
40
|
-
|
|
41
|
-
</style>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { defineComponent } from "vue-demi";
|
|
3
|
-
|
|
4
|
-
export default defineComponent({
|
|
5
|
-
props: {
|
|
6
|
-
rowData: {
|
|
7
|
-
type: Object,
|
|
8
|
-
default: null
|
|
9
|
-
},
|
|
10
|
-
rowIndex: {
|
|
11
|
-
type: Number
|
|
12
|
-
},
|
|
13
|
-
rowField: {
|
|
14
|
-
type: Object
|
|
15
|
-
},
|
|
16
|
-
isHeader: {
|
|
17
|
-
type: Boolean,
|
|
18
|
-
default: false
|
|
19
|
-
},
|
|
20
|
-
title: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: ""
|
|
23
|
-
},
|
|
24
|
-
vuetable: {
|
|
25
|
-
type: Object,
|
|
26
|
-
default: null
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
</script>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<th v-if="isHeader"
|
|
3
|
-
class="vuetable-th-component-sequence"
|
|
4
|
-
v-html="title">
|
|
5
|
-
</th>
|
|
6
|
-
<td v-else
|
|
7
|
-
class="vuetable-td-component-sequence"
|
|
8
|
-
v-html="renderSequence()">
|
|
9
|
-
</td>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script setup lang="ts">
|
|
13
|
-
import { defineOptions, defineProps, inject } from "vue-demi";
|
|
14
|
-
import type Vuetable from "./Vuetable.vue";
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
rowIndex?: number
|
|
18
|
-
isHeader?: boolean
|
|
19
|
-
title?: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
defineOptions({
|
|
23
|
-
name: "vuetable-field-sequence"
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const vuetable = inject("vuetable") as InstanceType<typeof Vuetable>;
|
|
27
|
-
|
|
28
|
-
const {
|
|
29
|
-
rowIndex = 0,
|
|
30
|
-
isHeader = false,
|
|
31
|
-
title = "",
|
|
32
|
-
} = defineProps<Props>();
|
|
33
|
-
|
|
34
|
-
function renderSequence () {
|
|
35
|
-
return vuetable.tablePagination
|
|
36
|
-
? vuetable.tablePagination.from + rowIndex
|
|
37
|
-
: 1 + rowIndex;
|
|
38
|
-
}
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<style scoped>
|
|
42
|
-
|
|
43
|
-
</style>
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-show="tablePagination && lastPage > firstPage" :class="$_css.wrapperClass">
|
|
3
|
-
<a :class="['btn-nav', $_css.linkClass, isOnFirstPage ? $_css.disabledClass : '']"
|
|
4
|
-
@click="loadPage(firstPage)">
|
|
5
|
-
<i v-if="$_css.icons.first != ''" :class="[$_css.icons.first]">
|
|
6
|
-
</i>
|
|
7
|
-
<span v-else>
|
|
8
|
-
«
|
|
9
|
-
</span>
|
|
10
|
-
</a>
|
|
11
|
-
<a :class="['btn-nav', $_css.linkClass, isOnFirstPage ? $_css.disabledClass : '']"
|
|
12
|
-
@click="loadPage('prev')">
|
|
13
|
-
<i v-if="$_css.icons.next != ''" :class="[$_css.icons.prev]">
|
|
14
|
-
</i>
|
|
15
|
-
<span v-else>
|
|
16
|
-
‹
|
|
17
|
-
</span>
|
|
18
|
-
</a>
|
|
19
|
-
<template v-if="notEnoughPages">
|
|
20
|
-
<template :key="i" v-for="(n, i) in totalPage">
|
|
21
|
-
<a :class="[$_css.pageClass, isCurrentPage(i+firstPage) ? $_css.activeClass : '']"
|
|
22
|
-
v-html="n"
|
|
23
|
-
@click="loadPage(i+firstPage)">
|
|
24
|
-
</a>
|
|
25
|
-
</template>
|
|
26
|
-
</template>
|
|
27
|
-
<template v-else>
|
|
28
|
-
<template :key="i" v-for="(n, i) in windowSize">
|
|
29
|
-
<a :class="[$_css.pageClass, isCurrentPage(windowStart+i+firstPage-1) ? $_css.activeClass : '']"
|
|
30
|
-
v-html="windowStart+n-1"
|
|
31
|
-
@click="loadPage(windowStart+i+firstPage-1)">
|
|
32
|
-
</a>
|
|
33
|
-
</template>
|
|
34
|
-
</template>
|
|
35
|
-
<a :class="['btn-nav', $_css.linkClass, isOnLastPage ? $_css.disabledClass : '']"
|
|
36
|
-
@click="loadPage('next')">
|
|
37
|
-
<i v-if="$_css.icons.next != ''" :class="[$_css.icons.next]">
|
|
38
|
-
</i>
|
|
39
|
-
<span v-else>
|
|
40
|
-
›
|
|
41
|
-
</span>
|
|
42
|
-
</a>
|
|
43
|
-
<a :class="['btn-nav', $_css.linkClass, isOnLastPage ? $_css.disabledClass : '']"
|
|
44
|
-
@click="loadPage(lastPage)">
|
|
45
|
-
<i v-if="$_css.icons.last != ''" :class="[$_css.icons.last]">
|
|
46
|
-
</i>
|
|
47
|
-
<span v-else>
|
|
48
|
-
»
|
|
49
|
-
</span>
|
|
50
|
-
</a>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
|
|
54
|
-
<script setup lang="ts">
|
|
55
|
-
import { defineEmits, defineProps, reactive, toRef } from "vue-demi";
|
|
56
|
-
import CssSemanticUI from "./VuetableCssSemanticUI.ts";
|
|
57
|
-
import { useVuetablePagination } from "./useVuetablePagination";
|
|
58
|
-
|
|
59
|
-
interface Props {
|
|
60
|
-
css?: { [key: string]: string }
|
|
61
|
-
onEachSide?: number
|
|
62
|
-
firstPage?: number
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const {
|
|
66
|
-
css = {},
|
|
67
|
-
onEachSide = 2,
|
|
68
|
-
firstPage = 1
|
|
69
|
-
} = defineProps<Props>();
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const emit = defineEmits<{
|
|
73
|
-
"vuetable-pagination:change-page": [page: string | number]
|
|
74
|
-
}>();
|
|
75
|
-
|
|
76
|
-
const $_css = reactive({ ...CssSemanticUI.pagination, ...css });
|
|
77
|
-
|
|
78
|
-
const {
|
|
79
|
-
tablePagination,
|
|
80
|
-
totalPage,
|
|
81
|
-
lastPage,
|
|
82
|
-
isOnFirstPage,
|
|
83
|
-
isOnLastPage,
|
|
84
|
-
notEnoughPages,
|
|
85
|
-
windowSize,
|
|
86
|
-
windowStart,
|
|
87
|
-
isCurrentPage,
|
|
88
|
-
setPaginationData,
|
|
89
|
-
resetData
|
|
90
|
-
} = useVuetablePagination(() => onEachSide, () => firstPage);
|
|
91
|
-
|
|
92
|
-
defineExpose({
|
|
93
|
-
tablePagination,
|
|
94
|
-
$_css,
|
|
95
|
-
totalPage,
|
|
96
|
-
lastPage,
|
|
97
|
-
onEachSide: toRef(() => onEachSide),
|
|
98
|
-
firstPage: toRef(() => firstPage),
|
|
99
|
-
isOnFirstPage,
|
|
100
|
-
isOnLastPage,
|
|
101
|
-
notEnoughPages,
|
|
102
|
-
windowSize,
|
|
103
|
-
windowStart,
|
|
104
|
-
loadPage,
|
|
105
|
-
isCurrentPage,
|
|
106
|
-
setPaginationData,
|
|
107
|
-
resetData
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
function loadPage (page: string | number) {
|
|
111
|
-
emit("vuetable-pagination:change-page", page);
|
|
112
|
-
}
|
|
113
|
-
</script>
|
|
114
|
-
|
|
115
|
-
<style>
|
|
116
|
-
.vuetable-pagination {
|
|
117
|
-
background: #f9fafb !important;
|
|
118
|
-
}
|
|
119
|
-
</style>
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="[$_css.wrapperClass]">
|
|
3
|
-
<a :class="[$_css.linkClass, {[$_css.disabledClass] : isOnFirstPage}]"
|
|
4
|
-
@click="loadPage('prev')">
|
|
5
|
-
<i :class="$_css.icons.prev">
|
|
6
|
-
</i>
|
|
7
|
-
</a>
|
|
8
|
-
<select :class="['vuetable-pagination-dropdown', $_css.dropdownClass]" @change="loadPage(($event.target as any).selectedIndex + firstPage)">
|
|
9
|
-
<option :key="n" v-for="(n, i) in totalPage" :class="[$_css.pageClass]" :value="i+firstPage" :selected="isCurrentPage(i+firstPage)">
|
|
10
|
-
{{pageText}} {{n}}
|
|
11
|
-
</option>
|
|
12
|
-
</select>
|
|
13
|
-
<a :class="[$_css.linkClass, {[$_css.disabledClass] : isOnLastPage}]"
|
|
14
|
-
@click="loadPage('next')">
|
|
15
|
-
<i :class="$_css.icons.next">
|
|
16
|
-
</i>
|
|
17
|
-
</a>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script setup lang="ts">
|
|
22
|
-
import { defineEmits, defineProps, reactive } from "vue-demi";
|
|
23
|
-
import mitt from "mitt";
|
|
24
|
-
import CssSemanticUI from "./VuetableCssSemanticUI";
|
|
25
|
-
import { useVuetablePagination } from "./useVuetablePagination.ts";
|
|
26
|
-
|
|
27
|
-
interface Props {
|
|
28
|
-
css: { [key: string]: string }
|
|
29
|
-
pageText?: string;
|
|
30
|
-
onEachSide: number
|
|
31
|
-
firstPage: number
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const {
|
|
35
|
-
css = {},
|
|
36
|
-
pageText = "Page",
|
|
37
|
-
onEachSide = 2,
|
|
38
|
-
firstPage = 1
|
|
39
|
-
} = defineProps<Props>();
|
|
40
|
-
|
|
41
|
-
const emitter = mitt();
|
|
42
|
-
|
|
43
|
-
const emit = defineEmits(["vuetable-pagination:change-page"]);
|
|
44
|
-
|
|
45
|
-
const $_css = reactive({ ...CssSemanticUI.pagination, ...css });
|
|
46
|
-
|
|
47
|
-
const {
|
|
48
|
-
tablePagination,
|
|
49
|
-
totalPage,
|
|
50
|
-
lastPage,
|
|
51
|
-
isOnFirstPage,
|
|
52
|
-
isOnLastPage,
|
|
53
|
-
notEnoughPages,
|
|
54
|
-
windowSize,
|
|
55
|
-
windowStart,
|
|
56
|
-
isCurrentPage,
|
|
57
|
-
setPaginationData,
|
|
58
|
-
resetData
|
|
59
|
-
} = useVuetablePagination(onEachSide, firstPage);
|
|
60
|
-
|
|
61
|
-
defineExpose({
|
|
62
|
-
tablePagination,
|
|
63
|
-
$_css,
|
|
64
|
-
firstPage,
|
|
65
|
-
lastPage,
|
|
66
|
-
onEachSide,
|
|
67
|
-
pageText,
|
|
68
|
-
notEnoughPages,
|
|
69
|
-
windowSize,
|
|
70
|
-
windowStart,
|
|
71
|
-
loadPage,
|
|
72
|
-
isCurrentPage,
|
|
73
|
-
setPaginationData,
|
|
74
|
-
resetData
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
function loadPage (page: string | number) {
|
|
78
|
-
emit("vuetable-pagination:change-page", page);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
emitter.on("vuetable:pagination-data", tablePagination => {
|
|
82
|
-
setPaginationData(tablePagination as any);
|
|
83
|
-
});
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<style scoped>
|
|
87
|
-
|
|
88
|
-
</style>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="['vuetable-pagination-info', $_css.infoClass]"
|
|
3
|
-
v-html="paginationInfo">
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { defineProps, ref, toRef } from "vue-demi";
|
|
9
|
-
import { useVuetablePaginationInfo } from "./useVuetablePaginationInfo.ts";
|
|
10
|
-
import CssSemanticUI from "./VuetableCssSemanticUI.ts";
|
|
11
|
-
|
|
12
|
-
interface Props {
|
|
13
|
-
css?: any;
|
|
14
|
-
infoTemplate?: string;
|
|
15
|
-
noDataTemplate?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
css = {},
|
|
21
|
-
infoTemplate = "Displaying {from} to {to} of {total} items",
|
|
22
|
-
noDataTemplate = "No relevant data"
|
|
23
|
-
} = defineProps<Props>();
|
|
24
|
-
|
|
25
|
-
const {
|
|
26
|
-
tablePagination,
|
|
27
|
-
paginationInfo,
|
|
28
|
-
setPaginationData,
|
|
29
|
-
resetData
|
|
30
|
-
} = useVuetablePaginationInfo(() => noDataTemplate, () => infoTemplate);
|
|
31
|
-
|
|
32
|
-
const $_css = ref({ ...CssSemanticUI.paginationInfo, ...css });
|
|
33
|
-
|
|
34
|
-
defineExpose({
|
|
35
|
-
tablePagination,
|
|
36
|
-
$_css,
|
|
37
|
-
infoTemplate: toRef(() => infoTemplate),
|
|
38
|
-
noDataTemplate: toRef(() => noDataTemplate),
|
|
39
|
-
paginationInfo,
|
|
40
|
-
setPaginationData,
|
|
41
|
-
resetData
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<style>
|
|
47
|
-
.vuetable-pagination-info {
|
|
48
|
-
margin-top: auto;
|
|
49
|
-
margin-bottom: auto;
|
|
50
|
-
}
|
|
51
|
-
</style>
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { defineComponent } from "vue-demi";
|
|
3
|
-
import CssSemanticUI from "./VuetableCssSemanticUI";
|
|
4
|
-
|
|
5
|
-
interface TablePagination {
|
|
6
|
-
from: number;
|
|
7
|
-
to: number;
|
|
8
|
-
total: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface Data {
|
|
12
|
-
tablePagination: TablePagination | null
|
|
13
|
-
customCss: Record<string, any>
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default defineComponent({
|
|
17
|
-
props: {
|
|
18
|
-
css: {
|
|
19
|
-
type: Object,
|
|
20
|
-
default: () => ({})
|
|
21
|
-
},
|
|
22
|
-
infoTemplate: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: "Displaying {from} to {to} of {total} items"
|
|
25
|
-
},
|
|
26
|
-
noDataTemplate: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: "No relevant data"
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
data () {
|
|
32
|
-
return <Data>{
|
|
33
|
-
tablePagination: null,
|
|
34
|
-
customCss: {}
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
computed: {
|
|
38
|
-
paginationInfo () {
|
|
39
|
-
if (this.tablePagination == null || this.tablePagination.total === 0) {
|
|
40
|
-
return this.noDataTemplate;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return this.infoTemplate
|
|
44
|
-
.replace("{from}", `${ this.tablePagination.from || 0 }`)
|
|
45
|
-
.replace("{to}", `${ this.tablePagination.to || 0 }`)
|
|
46
|
-
.replace("{total}", `${ this.tablePagination.total || 0}`);
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
created () {
|
|
50
|
-
this.mergeCss();
|
|
51
|
-
},
|
|
52
|
-
methods: {
|
|
53
|
-
mergeCss () {
|
|
54
|
-
this.customCss = {...CssSemanticUI.paginationInfo, ...this.css};
|
|
55
|
-
},
|
|
56
|
-
setPaginationData (tablePagination: TablePagination) {
|
|
57
|
-
this.tablePagination = tablePagination;
|
|
58
|
-
},
|
|
59
|
-
resetData () {
|
|
60
|
-
this.tablePagination = null;
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
</script>
|