picocrank 1.1.1 → 1.1.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "picocrank",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "A set of zero dependency Vue components built on the Femtocrank global CSS theme.",
|
|
5
5
|
"main": "vite.config.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"@hugeicons/core-free-icons": "^1.0.16",
|
|
20
20
|
"@hugeicons/vue": "^1.0.3",
|
|
21
21
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
22
|
-
"femtocrank": "^2.3.
|
|
22
|
+
"femtocrank": "^2.3.1",
|
|
23
23
|
"unplugin-vue-components": "^29.0.0",
|
|
24
24
|
"vite": "^7.1.3",
|
|
25
|
-
"vue": "^3.5.
|
|
25
|
+
"vue": "^3.5.19",
|
|
26
26
|
"vue-router": "^4.5.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section class = "with-header-and-content">
|
|
3
|
-
<div class = "section-header">
|
|
4
|
-
<
|
|
3
|
+
<div class = "section-header flex-row">
|
|
4
|
+
<div class = "fg1">
|
|
5
|
+
<h2 :title = "subtitle">{{ title }}</h2>
|
|
6
|
+
</div>
|
|
7
|
+
<div role = "toolbar">
|
|
8
|
+
<slot name="toolbar" />
|
|
9
|
+
</div>
|
|
5
10
|
</div>
|
|
6
11
|
<div :class = "padding ? 'section-content padding' : 'section-content'">
|
|
7
12
|
<slot />
|
|
@@ -20,5 +25,9 @@ const props = defineProps({
|
|
|
20
25
|
type: Boolean,
|
|
21
26
|
default: true,
|
|
22
27
|
},
|
|
28
|
+
subtitle: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "",
|
|
31
|
+
},
|
|
23
32
|
});
|
|
24
33
|
</script>
|
|
@@ -151,6 +151,10 @@ defineExpose({
|
|
|
151
151
|
|
|
152
152
|
<style scoped>
|
|
153
153
|
|
|
154
|
+
h2 {
|
|
155
|
+
padding: .75em;
|
|
156
|
+
}
|
|
157
|
+
|
|
154
158
|
.active {
|
|
155
159
|
text-decoration: underline;
|
|
156
160
|
}
|
|
@@ -164,10 +168,8 @@ li {
|
|
|
164
168
|
display: flex;
|
|
165
169
|
align-items: center;
|
|
166
170
|
gap: 0.75rem;
|
|
167
|
-
padding:
|
|
171
|
+
padding: .75em;
|
|
168
172
|
color: #333;
|
|
169
|
-
transition: background-color 0.2s ease;
|
|
170
|
-
border-left: 3px solid transparent;
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
.navigation-links a:hover,
|
package/vue/components/Table.vue
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
<th v-for="(header, index) in visibleHeaders" :key="index" @click="toggleSort(header)" :class="{ sortable: header.sortable }">
|
|
5
5
|
{{ header.label }}
|
|
6
6
|
|
|
7
|
-
<span v-if="header.sortable
|
|
8
|
-
<span v-if="
|
|
9
|
-
|
|
7
|
+
<span v-if="header.sortable" style:= "width: 1.5em; display: inline-block; text-align: center;">
|
|
8
|
+
<span v-if="sortBy === header.key">
|
|
9
|
+
<span v-if="sortDir === 'asc'">▲</span>
|
|
10
|
+
<span v-else-if="sortDir === 'desc'">▼</span>
|
|
11
|
+
</span>
|
|
10
12
|
</span>
|
|
11
13
|
</th>
|
|
12
14
|
</thead>
|
|
@@ -42,7 +44,22 @@
|
|
|
42
44
|
const page = ref(1);
|
|
43
45
|
const pageSize = ref(10);
|
|
44
46
|
|
|
45
|
-
const
|
|
47
|
+
const props = defineProps({
|
|
48
|
+
headers: {
|
|
49
|
+
type: Array,
|
|
50
|
+
default: () => ['id'],
|
|
51
|
+
},
|
|
52
|
+
data: {
|
|
53
|
+
type: Array,
|
|
54
|
+
default: () => [],
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const items = computed(() => {
|
|
59
|
+
const arr = [...props.data];
|
|
60
|
+
|
|
61
|
+
return arr;
|
|
62
|
+
})
|
|
46
63
|
|
|
47
64
|
const sortedItems = computed(() => {
|
|
48
65
|
if (!sortBy.value) return [...items.value];
|
|
@@ -89,18 +106,9 @@
|
|
|
89
106
|
}));
|
|
90
107
|
});
|
|
91
108
|
|
|
92
|
-
const props = defineProps({
|
|
93
|
-
headers: {
|
|
94
|
-
type: Array,
|
|
95
|
-
default: () => ['id'],
|
|
96
|
-
},
|
|
97
|
-
data: {
|
|
98
|
-
type: Array,
|
|
99
|
-
default: () => [],
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
|
|
103
109
|
function toggleSort(header) {
|
|
110
|
+
if (!header.sortable) return;
|
|
111
|
+
|
|
104
112
|
if (sortBy.value === header.key) {
|
|
105
113
|
sortDir.value = sortDir.value === 'asc' ? 'desc' : 'asc';
|
|
106
114
|
} else {
|
|
@@ -110,14 +118,10 @@
|
|
|
110
118
|
|
|
111
119
|
console.log(`Sorting by ${sortBy.value} in ${sortDir.value} order`);
|
|
112
120
|
}
|
|
113
|
-
|
|
114
|
-
onMounted(() => {
|
|
115
|
-
items.value = props.data;
|
|
116
|
-
})
|
|
117
121
|
</script>
|
|
118
122
|
|
|
119
123
|
<style scoped>
|
|
120
|
-
table thead th:hover {
|
|
124
|
+
table thead th.sortable:hover {
|
|
121
125
|
cursor: pointer;
|
|
122
126
|
color: #0366d6;
|
|
123
127
|
}
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Section
|
|
2
|
+
<Section
|
|
3
|
+
title="Table Example"
|
|
4
|
+
subtitle="A simple table with sortable columns and pagination"
|
|
5
|
+
:padding = "false"
|
|
6
|
+
>
|
|
7
|
+
<template #toolbar>
|
|
8
|
+
<button>Add Item</button>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
3
11
|
<Table
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
:data = "data"
|
|
13
|
+
:headers = "headers"
|
|
14
|
+
>
|
|
15
|
+
</Table>
|
|
7
16
|
</Section>
|
|
8
17
|
</template>
|
|
9
18
|
|
|
10
19
|
<script setup>
|
|
11
|
-
import { ref } from 'vue'
|
|
20
|
+
import { ref, onMounted } from 'vue'
|
|
12
21
|
|
|
13
22
|
const headers = ref([
|
|
14
23
|
{ key: "name", label: "Name", sortable: true, hidden: true, linkFunc: getLink },
|
|
15
|
-
{ key: "age", label: "Age", sortable:
|
|
24
|
+
{ key: "age", label: "Age", sortable: false, hidden: false, linkFunc: null },
|
|
16
25
|
{ key: "city", label: "City", sortable: true, hidden: false, link: null },
|
|
17
26
|
])
|
|
18
27
|
|
|
@@ -24,26 +33,30 @@
|
|
|
24
33
|
}
|
|
25
34
|
}
|
|
26
35
|
|
|
27
|
-
const data = [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
const data = ref([])
|
|
37
|
+
|
|
38
|
+
onMounted(() => {
|
|
39
|
+
data.value = [
|
|
40
|
+
{ name: "Alice", age: 30, city: "New York" },
|
|
41
|
+
{ name: "Bob", age: 25, city: "Los Angeles" },
|
|
42
|
+
{ name: "Charlie", age: 35, city: "Chicago" },
|
|
43
|
+
{ name: "David", age: 28, city: "Houston" },
|
|
44
|
+
{ name: "Eve", age: 22, city: "Phoenix" },
|
|
45
|
+
{ name: "Frank", age: 40, city: "Philadelphia" },
|
|
46
|
+
{ name: "Grace", age: 29, city: "San Antonio" },
|
|
47
|
+
{ name: "Hannah", age: 32, city: "San Diego" },
|
|
48
|
+
{ name: "Ian", age: 27, city: "Dallas" },
|
|
49
|
+
{ name: "Jack", age: 31, city: "San Jose" },
|
|
50
|
+
{ name: "Kathy", age: 26, city: "Austin" },
|
|
51
|
+
{ name: "Leo", age: 33, city: "Jacksonville" },
|
|
52
|
+
{ name: "Mia", age: 24, city: "Fort Worth" },
|
|
53
|
+
{ name: "Nina", age: 38, city: "Columbus" },
|
|
54
|
+
{ name: "Oscar", age: 36, city: "Charlotte" },
|
|
55
|
+
{ name: "Paul", age: 34, city: "San Francisco" },
|
|
56
|
+
{ name: "Quinn", age: 23, city: "Indianapolis" },
|
|
57
|
+
{ name: "Rita", age: 37, city: "Seattle" },
|
|
58
|
+
{ name: "Sam", age: 39, city: "Denver" },
|
|
59
|
+
{ name: "Tina", age: 21, city: "Washington D.C." }
|
|
60
|
+
]
|
|
61
|
+
})
|
|
49
62
|
</script>
|