vue-chrts 0.0.134 → 0.0.137
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/Area/AreaChart.cjs +7 -0
- package/dist/components/Area/AreaChart.cjs.map +1 -0
- package/dist/components/Area/AreaChart.js +123 -0
- package/dist/components/Area/AreaChart.js.map +1 -0
- package/dist/components/Area/AreaChart.vue.d.ts +36 -0
- package/dist/components/Area/AreaChart2.cjs +2 -0
- package/dist/components/Area/AreaChart2.cjs.map +1 -0
- package/dist/components/Area/AreaChart2.js +5 -0
- package/dist/components/Area/AreaChart2.js.map +1 -0
- package/dist/components/Area/index.d.ts +1 -0
- package/dist/components/AreaStacked/AreaStackedChart.cjs +2 -0
- package/dist/components/AreaStacked/AreaStackedChart.cjs.map +1 -0
- package/dist/components/AreaStacked/AreaStackedChart.js +51 -0
- package/dist/components/AreaStacked/AreaStackedChart.js.map +1 -0
- package/dist/components/AreaStacked/AreaStackedChart.vue.d.ts +18 -0
- package/dist/components/AreaStacked/AreaStackedChart2.cjs +2 -0
- package/dist/components/AreaStacked/AreaStackedChart2.cjs.map +1 -0
- package/dist/components/AreaStacked/AreaStackedChart2.js +5 -0
- package/dist/components/AreaStacked/AreaStackedChart2.js.map +1 -0
- package/{src/components/AreaStacked/index.ts → dist/components/AreaStacked/index.d.ts} +1 -1
- package/dist/components/Bar/index.d.ts +1 -0
- package/dist/components/Crosshair/Crosshair.cjs +2 -0
- package/dist/components/Crosshair/Crosshair.cjs.map +1 -0
- package/dist/components/Crosshair/Crosshair.js +40 -0
- package/dist/components/Crosshair/Crosshair.js.map +1 -0
- package/dist/components/Crosshair/Crosshair.vue.d.ts +38 -0
- package/dist/components/Crosshair/Crosshair2.cjs +2 -0
- package/dist/components/Crosshair/Crosshair2.cjs.map +1 -0
- package/dist/components/Crosshair/Crosshair2.js +5 -0
- package/dist/components/Crosshair/Crosshair2.js.map +1 -0
- package/dist/components/Crosshair/index.d.ts +1 -0
- package/dist/components/Donut/DonutChart.cjs +6 -0
- package/dist/components/Donut/DonutChart.cjs.map +1 -0
- package/dist/components/Donut/DonutChart.js +59 -0
- package/dist/components/Donut/DonutChart.js.map +1 -0
- package/dist/components/Donut/DonutChart.vue.d.ts +31 -0
- package/dist/components/Donut/DonutChart2.cjs +2 -0
- package/dist/components/Donut/DonutChart2.cjs.map +1 -0
- package/dist/components/Donut/DonutChart2.js +5 -0
- package/dist/components/Donut/DonutChart2.js.map +1 -0
- package/dist/components/Donut/index.d.ts +1 -0
- package/dist/components/Line/index.d.ts +1 -0
- package/dist/components/Tooltip.cjs +2 -0
- package/dist/components/Tooltip.cjs.map +1 -0
- package/dist/components/Tooltip.js +21 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/Tooltip.vue.d.ts +14 -0
- package/dist/components/Tooltip2.cjs +2 -0
- package/dist/components/Tooltip2.cjs.map +1 -0
- package/dist/components/Tooltip2.js +5 -0
- package/dist/components/Tooltip2.js.map +1 -0
- package/dist/components.d.ts +4 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/package.json +13 -10
- package/.vscode/extensions.json +0 -3
- package/auto-imports.d.ts +0 -58
- package/components.d.ts +0 -46
- package/image.png +0 -0
- package/index.html +0 -14
- package/index.js +0 -2
- package/src/components/Area/AreaChart.vue +0 -141
- package/src/components/Area/index.ts +0 -1
- package/src/components/AreaStacked/AreaStackedChart.vue +0 -51
- package/src/components/Bar/BarChart.vue +0 -130
- package/src/components/Bar/index.ts +0 -1
- package/src/components/Crosshair/Crosshair.vue +0 -46
- package/src/components/Crosshair/index.ts +0 -1
- package/src/components/Donut/DonutChart.vue +0 -71
- package/src/components/Donut/index.ts +0 -1
- package/src/components/Line/LineChart.vue +0 -94
- package/src/components/Line/index.ts +0 -1
- package/src/components/Tooltip.vue +0 -17
- package/src/components.ts +0 -6
- package/src/index.ts +0 -6
- package/src/shims-vue.d.ts +0 -1
- package/src-demo/AdminTemplate.vue +0 -5
- package/src-demo/App.vue +0 -37
- package/src-demo/AreaChartPage.vue +0 -125
- package/src-demo/BarChartPage.vue +0 -166
- package/src-demo/DashboardTemplate.vue +0 -687
- package/src-demo/Homepage.vue +0 -325
- package/src-demo/LineChartPage.vue +0 -140
- package/src-demo/assets/main.css +0 -34
- package/src-demo/components/Progress/Progress.vue +0 -42
- package/src-demo/components/Progress/index.ts +0 -1
- package/src-demo/components/Status/Status.vue +0 -95
- package/src-demo/components/Status/index.ts +0 -1
- package/src-demo/components/charts.ts +0 -37
- package/src-demo/components/index.ts +0 -49
- package/src-demo/data/AreaChartData.ts +0 -294
- package/src-demo/data/BarChartData.ts +0 -79
- package/src-demo/data/IncomeExpenseData.ts +0 -189
- package/src-demo/data/InvestmentData.ts +0 -352
- package/src-demo/data/RevenueData.ts +0 -58
- package/src-demo/data/VisitorsData.ts +0 -260
- package/src-demo/elements/Button.vue +0 -13
- package/src-demo/elements/Card.vue +0 -17
- package/src-demo/elements/Dropdown.vue +0 -112
- package/src-demo/elements/Logo.vue +0 -8
- package/src-demo/elements/Table.vue +0 -363
- package/src-demo/elements/TopBar.vue +0 -40
- package/src-demo/index.ts +0 -58
- package/tsconfig.json +0 -11
- package/vite.config.ts +0 -63
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref, onMounted, onBeforeUnmount } from "vue";
|
|
3
|
-
|
|
4
|
-
// Props (if needed)
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
initialOption: {
|
|
7
|
-
type: String,
|
|
8
|
-
default: "24 hours",
|
|
9
|
-
},
|
|
10
|
-
optionList: {
|
|
11
|
-
type: Array,
|
|
12
|
-
default: () => ["24 hours", "30 days"],
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// Emits
|
|
17
|
-
const emit = defineEmits(["option-selected"]);
|
|
18
|
-
|
|
19
|
-
// Reactive state
|
|
20
|
-
const isOpen = ref(false);
|
|
21
|
-
const selectedOption = ref(props.initialOption);
|
|
22
|
-
const options = ref(props.optionList);
|
|
23
|
-
|
|
24
|
-
// Methods
|
|
25
|
-
const toggleDropdown = () => {
|
|
26
|
-
isOpen.value = !isOpen.value;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const selectOption = (option) => {
|
|
30
|
-
selectedOption.value = option;
|
|
31
|
-
isOpen.value = false;
|
|
32
|
-
emit("option-selected", option);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const clickOutside = (e) => {
|
|
36
|
-
if (!e.target.closest(".relative")) {
|
|
37
|
-
isOpen.value = false;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Lifecycle hooks
|
|
42
|
-
onMounted(() => {
|
|
43
|
-
document.addEventListener("click", clickOutside);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
onBeforeUnmount(() => {
|
|
47
|
-
document.removeEventListener("click", clickOutside);
|
|
48
|
-
});
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
<template>
|
|
52
|
-
<div class="relative min-w-32 w-auto inline-block">
|
|
53
|
-
<!-- Dropdown Button -->
|
|
54
|
-
<button
|
|
55
|
-
@click="toggleDropdown"
|
|
56
|
-
class="flex items-center justify-between w-full px-4 py-2 text-sm text-white bg-card rounded-md hover:bg-card focus:outline-none ring ring-border"
|
|
57
|
-
>
|
|
58
|
-
<span>{{ selectedOption }}</span>
|
|
59
|
-
<svg
|
|
60
|
-
class="w-4 h-4 ml-2"
|
|
61
|
-
:class="{ 'transform rotate-180': isOpen }"
|
|
62
|
-
fill="none"
|
|
63
|
-
stroke="currentColor"
|
|
64
|
-
viewBox="0 0 24 24"
|
|
65
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
66
|
-
>
|
|
67
|
-
<path
|
|
68
|
-
stroke-linecap="round"
|
|
69
|
-
stroke-linejoin="round"
|
|
70
|
-
stroke-width="2"
|
|
71
|
-
d="M19 9l-7 7-7-7"
|
|
72
|
-
></path>
|
|
73
|
-
</svg>
|
|
74
|
-
</button>
|
|
75
|
-
|
|
76
|
-
<!-- Dropdown Menu -->
|
|
77
|
-
<div
|
|
78
|
-
v-if="isOpen"
|
|
79
|
-
class="absolute z-10 w-full mt-1 bg-card rounded-md shadow-lg ring ring-border"
|
|
80
|
-
>
|
|
81
|
-
<div class="py-1">
|
|
82
|
-
<a
|
|
83
|
-
v-for="(option, index) in options"
|
|
84
|
-
:key="index"
|
|
85
|
-
@click="selectOption(option)"
|
|
86
|
-
class="block px-4 py-2 text-sm text-white hover:bg-background cursor-pointer"
|
|
87
|
-
:class="{ 'bg-card': option === selectedOption }"
|
|
88
|
-
>
|
|
89
|
-
<div class="flex items-center">
|
|
90
|
-
<svg
|
|
91
|
-
v-if="option === selectedOption"
|
|
92
|
-
class="w-4 h-4 mr-2"
|
|
93
|
-
fill="none"
|
|
94
|
-
stroke="currentColor"
|
|
95
|
-
viewBox="0 0 24 24"
|
|
96
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
97
|
-
>
|
|
98
|
-
<path
|
|
99
|
-
stroke-linecap="round"
|
|
100
|
-
stroke-linejoin="round"
|
|
101
|
-
stroke-width="2"
|
|
102
|
-
d="M5 13l4 4L19 7"
|
|
103
|
-
></path>
|
|
104
|
-
</svg>
|
|
105
|
-
<span v-else class="w-4 h-4 mr-2"></span>
|
|
106
|
-
{{ option }}
|
|
107
|
-
</div>
|
|
108
|
-
</a>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
</template>
|
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
// components/TanStackTable.vue
|
|
2
|
-
<script setup lang="ts">
|
|
3
|
-
import {
|
|
4
|
-
FlexRender,
|
|
5
|
-
getCoreRowModel,
|
|
6
|
-
getPaginationRowModel,
|
|
7
|
-
getSortedRowModel,
|
|
8
|
-
getFilteredRowModel,
|
|
9
|
-
useVueTable,
|
|
10
|
-
ColumnDef,
|
|
11
|
-
SortingState,
|
|
12
|
-
PaginationState,
|
|
13
|
-
ColumnFiltersState,
|
|
14
|
-
Row
|
|
15
|
-
} from '@tanstack/vue-table'
|
|
16
|
-
import { computed, ref } from 'vue'
|
|
17
|
-
|
|
18
|
-
// Define the types for the props
|
|
19
|
-
type TableSize = 'sm' | 'md' | 'lg'
|
|
20
|
-
type PaginationPosition = 'top' | 'bottom' | 'both' | 'none'
|
|
21
|
-
|
|
22
|
-
// Define the props with defaults
|
|
23
|
-
const props = withDefaults(defineProps<{
|
|
24
|
-
// Data and columns
|
|
25
|
-
data: any[]
|
|
26
|
-
columns: ColumnDef<any, any>[]
|
|
27
|
-
|
|
28
|
-
// Features
|
|
29
|
-
enableSorting?: boolean
|
|
30
|
-
enableMultiSort?: boolean
|
|
31
|
-
enablePagination?: boolean
|
|
32
|
-
enableFiltering?: boolean
|
|
33
|
-
enableRowSelection?: boolean
|
|
34
|
-
|
|
35
|
-
// Appearance
|
|
36
|
-
tableSize?: TableSize
|
|
37
|
-
striped?: boolean
|
|
38
|
-
hover?: boolean
|
|
39
|
-
bordered?: boolean
|
|
40
|
-
|
|
41
|
-
// Pagination
|
|
42
|
-
paginationPosition?: PaginationPosition
|
|
43
|
-
pageSizeOptions?: any
|
|
44
|
-
initialPageSize?: number
|
|
45
|
-
|
|
46
|
-
// Functions
|
|
47
|
-
onRowClick?: (row: Row<any>) => void
|
|
48
|
-
getRowClass?: (row: Row<any>) => string
|
|
49
|
-
}>(), {
|
|
50
|
-
// Default prop values
|
|
51
|
-
enableSorting: true,
|
|
52
|
-
enableMultiSort: false,
|
|
53
|
-
enablePagination: true,
|
|
54
|
-
enableFiltering: false,
|
|
55
|
-
enableRowSelection: false,
|
|
56
|
-
tableSize: 'md',
|
|
57
|
-
striped: true,
|
|
58
|
-
hover: true,
|
|
59
|
-
bordered: false,
|
|
60
|
-
paginationPosition: 'bottom',
|
|
61
|
-
pageSizeOptions: [10, 20, 50, 100],
|
|
62
|
-
initialPageSize: 10,
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
// Define emits for external state management
|
|
66
|
-
const emit = defineEmits<{
|
|
67
|
-
'update:sorting': [sorting: SortingState]
|
|
68
|
-
'update:pagination': [pagination: PaginationState]
|
|
69
|
-
'update:filters': [filters: ColumnFiltersState]
|
|
70
|
-
'update:selectedRows': [selectedRowIds: Record<string, boolean>]
|
|
71
|
-
'row-click': [row: Row<any>]
|
|
72
|
-
}>()
|
|
73
|
-
|
|
74
|
-
// Internal state
|
|
75
|
-
const sorting = ref<SortingState>([])
|
|
76
|
-
const pagination = ref<PaginationState>({
|
|
77
|
-
pageIndex: 0,
|
|
78
|
-
pageSize: props.initialPageSize,
|
|
79
|
-
})
|
|
80
|
-
const columnFilters = ref<ColumnFiltersState>([])
|
|
81
|
-
const rowSelection = ref<Record<string, boolean>>({})
|
|
82
|
-
const globalFilter = ref('')
|
|
83
|
-
|
|
84
|
-
// Create table instance with options
|
|
85
|
-
const table = useVueTable({
|
|
86
|
-
get data() { return props.data },
|
|
87
|
-
get columns() { return props.columns },
|
|
88
|
-
state: {
|
|
89
|
-
get sorting() { return sorting.value },
|
|
90
|
-
get pagination() { return pagination.value },
|
|
91
|
-
get columnFilters() { return columnFilters.value },
|
|
92
|
-
get rowSelection() { return rowSelection.value },
|
|
93
|
-
get globalFilter() { return globalFilter.value },
|
|
94
|
-
},
|
|
95
|
-
onSortingChange: (updater) => {
|
|
96
|
-
sorting.value = typeof updater === 'function' ? updater(sorting.value) : updater
|
|
97
|
-
emit('update:sorting', sorting.value)
|
|
98
|
-
},
|
|
99
|
-
onPaginationChange: (updater) => {
|
|
100
|
-
pagination.value = typeof updater === 'function' ? updater(pagination.value) : updater
|
|
101
|
-
emit('update:pagination', pagination.value)
|
|
102
|
-
},
|
|
103
|
-
onColumnFiltersChange: (updater) => {
|
|
104
|
-
columnFilters.value = typeof updater === 'function' ? updater(columnFilters.value) : updater
|
|
105
|
-
emit('update:filters', columnFilters.value)
|
|
106
|
-
},
|
|
107
|
-
onRowSelectionChange: (updater) => {
|
|
108
|
-
rowSelection.value = typeof updater === 'function' ? updater(rowSelection.value) : updater
|
|
109
|
-
emit('update:selectedRows', rowSelection.value)
|
|
110
|
-
},
|
|
111
|
-
onGlobalFilterChange: (updater) => {
|
|
112
|
-
globalFilter.value = typeof updater === 'function' ? updater(globalFilter.value) : updater
|
|
113
|
-
},
|
|
114
|
-
getCoreRowModel: getCoreRowModel(),
|
|
115
|
-
getSortedRowModel: getSortedRowModel(),
|
|
116
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
117
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
118
|
-
enableMultiSort: props.enableMultiSort,
|
|
119
|
-
enableSorting: props.enableSorting,
|
|
120
|
-
enableRowSelection: props.enableRowSelection,
|
|
121
|
-
enableFilters: props.enableFiltering,
|
|
122
|
-
manualPagination: !props.enablePagination,
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
// Handle row click events
|
|
126
|
-
const handleRowClick = (row: Row<any>) => {
|
|
127
|
-
if (props.onRowClick) {
|
|
128
|
-
props.onRowClick(row)
|
|
129
|
-
}
|
|
130
|
-
emit('row-click', row)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Computed styles based on size
|
|
134
|
-
const tableSizeClasses = computed(() => {
|
|
135
|
-
switch (props.tableSize) {
|
|
136
|
-
case 'sm':
|
|
137
|
-
return {
|
|
138
|
-
table: 'text-xs',
|
|
139
|
-
cell: 'px-2 py-1',
|
|
140
|
-
pagination: 'text-xs'
|
|
141
|
-
}
|
|
142
|
-
case 'lg':
|
|
143
|
-
return {
|
|
144
|
-
table: 'text-base',
|
|
145
|
-
cell: 'px-6 py-4',
|
|
146
|
-
pagination: 'text-base'
|
|
147
|
-
}
|
|
148
|
-
default: // 'md'
|
|
149
|
-
return {
|
|
150
|
-
table: 'text-sm',
|
|
151
|
-
cell: 'px-4 py-2',
|
|
152
|
-
pagination: 'text-sm'
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
// Computed classes for table styling
|
|
158
|
-
const tableClasses = computed(() => {
|
|
159
|
-
return [
|
|
160
|
-
'min-w-full divide-y divide-neutral-600 border-collapse',
|
|
161
|
-
tableSizeClasses.value.table,
|
|
162
|
-
props.bordered ? 'border border-gray-200' : '',
|
|
163
|
-
]
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
// Row classes
|
|
167
|
-
const getRowClasses = (row: Row<any>) => {
|
|
168
|
-
const classes = [
|
|
169
|
-
'transition-colors',
|
|
170
|
-
props.hover ? 'dark:hover:bg-neutral-900 hover:bg-neutral-100' : '',
|
|
171
|
-
props.striped && row.index % 2 === 1 ? 'bg-neutral' : '',
|
|
172
|
-
props.enableRowSelection && row.getIsSelected() ? 'bg-blue-50 hover:bg-blue-100' : '',
|
|
173
|
-
]
|
|
174
|
-
|
|
175
|
-
if (props.getRowClass) {
|
|
176
|
-
classes.push(props.getRowClass(row))
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return classes.join(' ')
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Cell classes
|
|
183
|
-
const getCellClasses = (isHeader = false) => {
|
|
184
|
-
return [
|
|
185
|
-
tableSizeClasses.value.cell,
|
|
186
|
-
isHeader ? 'font-semibold text-neutral-500 border-b border-border capitalize' : ' text-neutral-600 dark:text-neutral-400',
|
|
187
|
-
props.bordered ? 'border border-border' : '',
|
|
188
|
-
].join(' ')
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// Expose the table instance and key states for external use
|
|
192
|
-
defineExpose({
|
|
193
|
-
tableInstance: table,
|
|
194
|
-
sorting,
|
|
195
|
-
pagination,
|
|
196
|
-
columnFilters,
|
|
197
|
-
rowSelection,
|
|
198
|
-
globalFilter,
|
|
199
|
-
})
|
|
200
|
-
</script>
|
|
201
|
-
|
|
202
|
-
<template>
|
|
203
|
-
<div class="overflow-x-auto w-full">
|
|
204
|
-
<!-- Top Pagination -->
|
|
205
|
-
<div v-if="['top', 'both'].includes(paginationPosition) && enablePagination" class="mb-2">
|
|
206
|
-
<div class="flex justify-between items-center">
|
|
207
|
-
<div class="flex items-center gap-2">
|
|
208
|
-
<span :class="tableSizeClasses.pagination">Rows per page:</span>
|
|
209
|
-
<select
|
|
210
|
-
v-model="pagination.pageSize"
|
|
211
|
-
class="border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500"
|
|
212
|
-
>
|
|
213
|
-
<option v-for="size in pageSizeOptions" :key="size" :value="size">
|
|
214
|
-
{{ size }}
|
|
215
|
-
</option>
|
|
216
|
-
</select>
|
|
217
|
-
</div>
|
|
218
|
-
<div class="flex items-center gap-2">
|
|
219
|
-
<button
|
|
220
|
-
@click="table.previousPage"
|
|
221
|
-
:disabled="!table.getCanPreviousPage()"
|
|
222
|
-
class="px-3 py-1 border border-gray-300 rounded disabled:opacity-50"
|
|
223
|
-
>
|
|
224
|
-
<span class="sr-only">Previous</span>
|
|
225
|
-
<span class="inline-block"><</span>
|
|
226
|
-
</button>
|
|
227
|
-
<span :class="tableSizeClasses.pagination">
|
|
228
|
-
Page {{ table.getState().pagination.pageIndex + 1 }} of {{ table.getPageCount() }}
|
|
229
|
-
</span>
|
|
230
|
-
<button
|
|
231
|
-
@click="table.nextPage"
|
|
232
|
-
:disabled="!table.getCanNextPage()"
|
|
233
|
-
class="px-3 py-1 border border-gray-300 rounded disabled:opacity-50"
|
|
234
|
-
>
|
|
235
|
-
<span class="sr-only">Next</span>
|
|
236
|
-
<span class="inline-block">></span>
|
|
237
|
-
</button>
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
240
|
-
</div>
|
|
241
|
-
|
|
242
|
-
<!-- Global Filter -->
|
|
243
|
-
<div v-if="enableFiltering" class="mb-2">
|
|
244
|
-
<input
|
|
245
|
-
v-model="globalFilter"
|
|
246
|
-
placeholder="Search all columns..."
|
|
247
|
-
class="border border-gray-300 rounded px-3 py-2 w-full max-w-sm"
|
|
248
|
-
/>
|
|
249
|
-
</div>
|
|
250
|
-
|
|
251
|
-
<!-- Table -->
|
|
252
|
-
<table :class="tableClasses">
|
|
253
|
-
<thead>
|
|
254
|
-
<tr v-for="headerGroup in table.getHeaderGroups()" :key="headerGroup.id">
|
|
255
|
-
<th
|
|
256
|
-
v-for="header in headerGroup.headers"
|
|
257
|
-
:key="header.id"
|
|
258
|
-
:class="[
|
|
259
|
-
getCellClasses(true),
|
|
260
|
-
header.column.getCanSort() ? 'cursor-pointer select-none' : '',
|
|
261
|
-
'text-left'
|
|
262
|
-
]"
|
|
263
|
-
@click="header.column.getToggleSortingHandler()"
|
|
264
|
-
>
|
|
265
|
-
<div class="flex items-center gap-1">
|
|
266
|
-
<FlexRender
|
|
267
|
-
v-if="header.isPlaceholder"
|
|
268
|
-
:render="header.column.columnDef.header"
|
|
269
|
-
:props="header.getContext()"
|
|
270
|
-
/>
|
|
271
|
-
|
|
272
|
-
<!-- Column title with sort icons -->
|
|
273
|
-
<div v-else class="flex-1">
|
|
274
|
-
<FlexRender
|
|
275
|
-
:render="header.column.columnDef.header"
|
|
276
|
-
:props="header.getContext()"
|
|
277
|
-
/>
|
|
278
|
-
</div>
|
|
279
|
-
|
|
280
|
-
<!-- Sort indicator -->
|
|
281
|
-
<div class="w-4" v-if="header.column.getCanSort()">
|
|
282
|
-
{{{
|
|
283
|
-
asc: '▲',
|
|
284
|
-
desc: '▼',
|
|
285
|
-
}[header.column.getIsSorted() as string] ?? '⬍'}}
|
|
286
|
-
</div>
|
|
287
|
-
</div>
|
|
288
|
-
</th>
|
|
289
|
-
</tr>
|
|
290
|
-
</thead>
|
|
291
|
-
<tbody class="divide-y divide-border">
|
|
292
|
-
<template v-if="table.getRowModel().rows.length">
|
|
293
|
-
<tr
|
|
294
|
-
v-for="row in table.getRowModel().rows"
|
|
295
|
-
:key="row.id"
|
|
296
|
-
:class="getRowClasses(row)"
|
|
297
|
-
@click="handleRowClick(row)"
|
|
298
|
-
>
|
|
299
|
-
<td
|
|
300
|
-
v-for="cell in row.getVisibleCells()"
|
|
301
|
-
:key="cell.id"
|
|
302
|
-
:class="getCellClasses()"
|
|
303
|
-
>
|
|
304
|
-
<FlexRender
|
|
305
|
-
:render="cell.column.columnDef.cell"
|
|
306
|
-
:props="cell.getContext()"
|
|
307
|
-
/>
|
|
308
|
-
</td>
|
|
309
|
-
</tr>
|
|
310
|
-
</template>
|
|
311
|
-
<template v-else>
|
|
312
|
-
<tr>
|
|
313
|
-
<td
|
|
314
|
-
:colspan="table.getAllColumns().length"
|
|
315
|
-
:class="getCellClasses()"
|
|
316
|
-
class="text-center py-4"
|
|
317
|
-
>
|
|
318
|
-
No results found
|
|
319
|
-
</td>
|
|
320
|
-
</tr>
|
|
321
|
-
</template>
|
|
322
|
-
</tbody>
|
|
323
|
-
</table>
|
|
324
|
-
|
|
325
|
-
<!-- Bottom Pagination -->
|
|
326
|
-
<div v-if="['bottom', 'both'].includes(paginationPosition) && enablePagination" class="mt-2">
|
|
327
|
-
<div class="flex justify-between items-center">
|
|
328
|
-
<div class="flex items-center gap-2">
|
|
329
|
-
<span :class="tableSizeClasses.pagination">Rows per page:</span>
|
|
330
|
-
<select
|
|
331
|
-
v-model="pagination.pageSize"
|
|
332
|
-
class="border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500"
|
|
333
|
-
>
|
|
334
|
-
<option v-for="size in pageSizeOptions" :key="size" :value="size">
|
|
335
|
-
{{ size }}
|
|
336
|
-
</option>
|
|
337
|
-
</select>
|
|
338
|
-
</div>
|
|
339
|
-
<div class="flex items-center gap-2">
|
|
340
|
-
<button
|
|
341
|
-
@click="table.previousPage"
|
|
342
|
-
:disabled="!table.getCanPreviousPage()"
|
|
343
|
-
class="px-3 py-1 border border-gray-300 rounded disabled:opacity-50"
|
|
344
|
-
>
|
|
345
|
-
<span class="sr-only">Previous</span>
|
|
346
|
-
<span class="inline-block"><</span>
|
|
347
|
-
</button>
|
|
348
|
-
<span :class="tableSizeClasses.pagination">
|
|
349
|
-
Page {{ table.getState().pagination.pageIndex + 1 }} of {{ table.getPageCount() }}
|
|
350
|
-
</span>
|
|
351
|
-
<button
|
|
352
|
-
@click="table.nextPage"
|
|
353
|
-
:disabled="!table.getCanNextPage()"
|
|
354
|
-
class="px-3 py-1 border border-gray-300 rounded disabled:opacity-50"
|
|
355
|
-
>
|
|
356
|
-
<span class="sr-only">Next</span>
|
|
357
|
-
<span class="inline-block">></span>
|
|
358
|
-
</button>
|
|
359
|
-
</div>
|
|
360
|
-
</div>
|
|
361
|
-
</div>
|
|
362
|
-
</div>
|
|
363
|
-
</template>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
import Logo from "./Logo.vue";
|
|
4
|
-
|
|
5
|
-
import { useColorMode } from "@vueuse/core";
|
|
6
|
-
const colorMode = useColorMode();
|
|
7
|
-
const isDark = computed(() => colorMode.value === "dark");
|
|
8
|
-
|
|
9
|
-
function setColorMode() {
|
|
10
|
-
colorMode.value = isDark.value ? "light" : "dark";
|
|
11
|
-
}
|
|
12
|
-
</script>
|
|
13
|
-
<template>
|
|
14
|
-
<div class="border-b border-border">
|
|
15
|
-
<div
|
|
16
|
-
class="mx-auto py-4 flex items-center justify-between"
|
|
17
|
-
:class="$route.fullPath === '/admin' ? 'max-w-full px-16' : 'max-w-7xl'"
|
|
18
|
-
>
|
|
19
|
-
<RouterLink to="/">
|
|
20
|
-
<Logo></Logo>
|
|
21
|
-
</RouterLink>
|
|
22
|
-
<svg
|
|
23
|
-
@click="setColorMode"
|
|
24
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
-
viewBox="0 0 16 16"
|
|
26
|
-
fill="currentColor"
|
|
27
|
-
class="size-5 cursor-pointer"
|
|
28
|
-
>
|
|
29
|
-
<path
|
|
30
|
-
v-if="!isDark"
|
|
31
|
-
d="M14.438 10.148c.19-.425-.321-.787-.748-.601A5.5 5.5 0 0 1 6.453 2.31c.186-.427-.176-.938-.6-.748a6.501 6.501 0 1 0 8.585 8.586Z"
|
|
32
|
-
/>
|
|
33
|
-
<path
|
|
34
|
-
v-else
|
|
35
|
-
d="M8 1a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0v-1.5A.75.75 0 0 1 8 1ZM10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM12.95 4.11a.75.75 0 1 0-1.06-1.06l-1.062 1.06a.75.75 0 0 0 1.061 1.062l1.06-1.061ZM15 8a.75.75 0 0 1-.75.75h-1.5a.75.75 0 0 1 0-1.5h1.5A.75.75 0 0 1 15 8ZM11.89 12.95a.75.75 0 0 0 1.06-1.06l-1.06-1.062a.75.75 0 0 0-1.062 1.061l1.061 1.06ZM8 12a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0v-1.5A.75.75 0 0 1 8 12ZM5.172 11.89a.75.75 0 0 0-1.061-1.062L3.05 11.89a.75.75 0 1 0 1.06 1.06l1.06-1.06ZM4 8a.75.75 0 0 1-.75.75h-1.5a.75.75 0 0 1 0-1.5h1.5A.75.75 0 0 1 4 8ZM4.11 5.172A.75.75 0 0 0 5.173 4.11L4.11 3.05a.75.75 0 1 0-1.06 1.06l1.06 1.06Z"
|
|
36
|
-
/>
|
|
37
|
-
</svg>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</template>
|
package/src-demo/index.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { createApp } from 'vue'
|
|
3
|
-
import { createRouter, createWebHistory } from "vue-router";
|
|
4
|
-
|
|
5
|
-
import './assets/main.css'
|
|
6
|
-
|
|
7
|
-
import App from './App.vue'
|
|
8
|
-
|
|
9
|
-
const app = createApp(App)
|
|
10
|
-
|
|
11
|
-
const router = createRouter({
|
|
12
|
-
routes: [
|
|
13
|
-
{
|
|
14
|
-
path: '/',
|
|
15
|
-
name: 'Home',
|
|
16
|
-
component: () => import('./Homepage.vue')
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
path: '/admin',
|
|
20
|
-
name: 'AdminTemplate',
|
|
21
|
-
component: () => import('./AdminTemplate.vue')
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
path: '/dashboard',
|
|
25
|
-
name: 'DashboardTemplate',
|
|
26
|
-
component: () => import('./DashboardTemplate.vue')
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
path: '/area-charts',
|
|
30
|
-
name: 'AreaCharts',
|
|
31
|
-
component: () => import('./AreaChartPage.vue')
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
path: '/line-charts',
|
|
35
|
-
name: 'LineCharts',
|
|
36
|
-
component: () => import('./LineChartPage.vue')
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
path: '/bar-charts',
|
|
40
|
-
name: 'BarCharts',
|
|
41
|
-
component: () => import('./BarChartPage.vue')
|
|
42
|
-
},
|
|
43
|
-
// {
|
|
44
|
-
// path: '/overview',
|
|
45
|
-
// name: 'Overview',
|
|
46
|
-
// component: () => import('./components/Overview.vue') // Replace with your OverviewPage component path
|
|
47
|
-
// }
|
|
48
|
-
],
|
|
49
|
-
history: createWebHistory(),
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
app.use(router);
|
|
53
|
-
|
|
54
|
-
app.mount('#app')
|
|
55
|
-
|
|
56
|
-
export default {
|
|
57
|
-
|
|
58
|
-
}
|
package/tsconfig.json
DELETED
package/vite.config.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'node:path'
|
|
2
|
-
import { UserConfig, defineConfig } from 'vite'
|
|
3
|
-
import vue from "@vitejs/plugin-vue";
|
|
4
|
-
import dts from "vite-plugin-dts";
|
|
5
|
-
import tailwindcss from "@tailwindcss/vite";
|
|
6
|
-
import type { ModuleFormat, OutputOptions } from 'rollup'
|
|
7
|
-
|
|
8
|
-
const outputDefault = (format: ModuleFormat, extension: string): OutputOptions => ({
|
|
9
|
-
// Provide global variables to use in the UMD build
|
|
10
|
-
// for externalized deps
|
|
11
|
-
globals: {
|
|
12
|
-
vue: 'Vue',
|
|
13
|
-
'@unovis/ts': '@unovis/ts',
|
|
14
|
-
'@unovis/vue': '@unovis/vue',
|
|
15
|
-
},
|
|
16
|
-
preserveModules: true,
|
|
17
|
-
preserveModulesRoot: './src',
|
|
18
|
-
format,
|
|
19
|
-
entryFileNames: ({ name }) => {
|
|
20
|
-
return `${name.replace('.vue', '')}.${extension}`
|
|
21
|
-
},
|
|
22
|
-
exports: 'named',
|
|
23
|
-
})
|
|
24
|
-
export default defineConfig(({ command, mode }): UserConfig => {
|
|
25
|
-
if (command === 'build' && mode !== 'gallery') {
|
|
26
|
-
return {
|
|
27
|
-
plugins: [
|
|
28
|
-
vue(),
|
|
29
|
-
dts({
|
|
30
|
-
insertTypesEntry: true,
|
|
31
|
-
include: ['src/**/*.ts', 'src/**/*.vue'],
|
|
32
|
-
}),
|
|
33
|
-
],
|
|
34
|
-
build: {
|
|
35
|
-
emptyOutDir: true,
|
|
36
|
-
lib: {
|
|
37
|
-
name: 'vue-chrts',
|
|
38
|
-
fileName: 'index',
|
|
39
|
-
entry: resolve(__dirname, 'src/index.ts'),
|
|
40
|
-
},
|
|
41
|
-
rollupOptions: {
|
|
42
|
-
// make sure to externalize deps that shouldn't be bundled
|
|
43
|
-
// into your library (Vue)
|
|
44
|
-
external: ['vue', '@unovis/ts', '@unovis/vue'],
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
46
|
-
// @ts-ignore overloaded issue
|
|
47
|
-
output: [outputDefault('cjs', 'cjs'), outputDefault('es', 'js')],
|
|
48
|
-
},
|
|
49
|
-
sourcemap: true,
|
|
50
|
-
},
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
return {
|
|
54
|
-
plugins: [
|
|
55
|
-
vue(),
|
|
56
|
-
tailwindcss()
|
|
57
|
-
],
|
|
58
|
-
build: {
|
|
59
|
-
outDir: 'dist-demo',
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
})
|
|
File without changes
|