@viur/shop-components 0.0.1-dev.6 → 0.0.1-dev.60
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/.editorconfig +16 -0
- package/.github/workflows/npm-publish.yml +42 -0
- package/.gitmodules +3 -0
- package/LICENSE +21 -0
- package/README.md +13 -2
- package/package.json +25 -23
- package/src/components/ShopCart.vue +512 -0
- package/src/components/ShopOrderComplete.vue +73 -0
- package/src/components/ShopOrderConfirm.vue +291 -0
- package/src/components/ShopOrderStepper.vue +264 -0
- package/src/components/ShopUserData.vue +232 -0
- package/src/components/cart/CartLeaf.vue +277 -0
- package/src/components/cart/CartLeafModel.vue +304 -0
- package/src/components/cart/CartNode.vue +25 -0
- package/src/components/cart/CartTree.vue +54 -0
- package/src/components/cart/CartTreeWrapper.vue +73 -0
- package/src/components/cart/CartView.vue +205 -174
- package/src/components/cart/Discount.vue +91 -0
- package/src/components/lib/utils.js +0 -0
- package/src/components/order/OrderSidebar.vue +102 -0
- package/src/components/order/item/ItemView.vue +0 -1
- package/src/components/{cart → order/process}/ConfirmView.vue +94 -96
- package/src/components/order/process/ExampleUsage.vue +79 -66
- package/src/components/order/process/OrderTabHeader.vue +10 -1
- package/src/components/order/process/SelectPaymentProvider.vue +62 -0
- package/src/components/order/process/Shipping.vue +46 -0
- package/src/components/ui/ShopSummary.vue +145 -0
- package/src/components/ui/generic/ArticleList.vue +222 -0
- package/src/components/ui/generic/ExamplePagination.vue +236 -0
- package/src/components/ui/generic/ShopPriceFormatter.vue +41 -0
- package/src/components/ui/generic/alerts/ShopAlert.vue +19 -0
- package/src/components/ui/generic/makeData.js +39 -0
- package/src/components/ui/stepper/StepperItem.vue +39 -0
- package/src/components/ui/stepper/StepperTab.vue +133 -0
- package/src/components/ui/stepper/StepperTrigger.vue +35 -0
- package/src/components/ui/userdata/AddForm.vue +125 -0
- package/src/components/ui/userdata/AddressBox.vue +117 -0
- package/src/components/ui/userdata/BaseLayout.vue +94 -0
- package/src/components/ui/userdata/CustomBooleanBone.vue +58 -0
- package/src/components/ui/userdata/CustomSelectBone.vue +91 -0
- package/src/components/ui/userdata/CustomStringBone.vue +71 -0
- package/src/components/ui/userdata/DefaultLayout.vue +126 -0
- package/src/components/ui/userdata/SelectAddress.vue +21 -0
- package/src/components/ui/userdata/multi/ActionBar.vue +38 -0
- package/src/components/ui/userdata/multi/CartSelection.vue +42 -0
- package/src/main.js +50 -0
- package/src/router/index.js +1 -1
- package/src/stores/cart.js +267 -42
- package/src/style/ignite/.editorconfig +20 -0
- package/src/style/ignite/.github/workflows/ignite.yml +64 -0
- package/src/style/ignite/.github/workflows/node.yml +30 -0
- package/src/style/ignite/.postcssrc.cjs +25 -0
- package/src/style/ignite/CHANGELOG.md +244 -0
- package/src/style/ignite/LICENSE +21 -0
- package/src/style/ignite/README.md +92 -0
- package/src/style/ignite/dist/ignite.css +2019 -0
- package/src/style/ignite/dist/ignite.min.css +4 -0
- package/src/style/ignite/foundation/basic.css +371 -0
- package/src/style/ignite/foundation/color.css +323 -0
- package/src/style/ignite/foundation/config.css +188 -0
- package/src/style/ignite/foundation/grid.css +78 -0
- package/src/style/ignite/foundation/mediaqueries.css +71 -0
- package/src/style/ignite/foundation/reset.css +261 -0
- package/src/style/ignite/ignite.css +29 -0
- package/src/style/ignite/ignite.css.map +1 -0
- package/src/style/ignite/package-lock.json +5530 -0
- package/src/style/ignite/package.json +58 -0
- package/src/style/ignite/shoelace.css +19 -0
- package/src/style/ignite/themes/dark.css +12 -0
- package/src/style/ignite/themes/light.css +11 -0
- package/src/style/ignite/utilities/shoelace.css +537 -0
- package/src/style/ignite/utilities/utilities.css +24 -0
- package/vite.config.js +53 -0
- package/src/components/order/information/UserInfoMulti.vue +0 -427
- package/src/components/order/information/UserInformation.vue +0 -332
- package/src/components/order/process/OrderComplete.vue +0 -41
- package/src/components/order/process/OrderView.vue +0 -210
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
,
|
|
2
|
+
<template>
|
|
3
|
+
<h2 class="viur-shop-cart-sidebar-headline headline">Zusammenfassung</h2>
|
|
4
|
+
<br />
|
|
5
|
+
<div class="viur-shop-cart-sidebar-info-line">
|
|
6
|
+
<span>Zwischensumme</span>
|
|
7
|
+
|
|
8
|
+
<sl-format-number
|
|
9
|
+
lang="de"
|
|
10
|
+
type="currency"
|
|
11
|
+
currency="EUR"
|
|
12
|
+
:value="state.node?.total"
|
|
13
|
+
>
|
|
14
|
+
</sl-format-number>
|
|
15
|
+
<br />
|
|
16
|
+
</div>
|
|
17
|
+
<div class="viur-shop-cart-sidebar-info-line">
|
|
18
|
+
<span>Rabatt</span>
|
|
19
|
+
|
|
20
|
+
<sl-format-number
|
|
21
|
+
lang="de"
|
|
22
|
+
type="currency"
|
|
23
|
+
currency="EUR"
|
|
24
|
+
:value="state.node?.discount ? state.node.discount : 0"
|
|
25
|
+
>
|
|
26
|
+
</sl-format-number>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="viur-shop-cart-sidebar-info-line">
|
|
29
|
+
<Shipping ref="shipping">
|
|
30
|
+
<template #custom v-if="customShippingComponent">
|
|
31
|
+
<component :is="customShippingComponent"></component>
|
|
32
|
+
</template>
|
|
33
|
+
</Shipping>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="viur-shop-cart-sidebar-info-line total">
|
|
36
|
+
<span>Gesamt:</span>
|
|
37
|
+
<sl-format-number
|
|
38
|
+
lang="de"
|
|
39
|
+
type="currency"
|
|
40
|
+
currency="EUR"
|
|
41
|
+
:value="totalPrice"
|
|
42
|
+
>
|
|
43
|
+
</sl-format-number>
|
|
44
|
+
<!-- TODO: Some project needs "VAT included" here -->
|
|
45
|
+
</div>
|
|
46
|
+
<slot name="action-buttons">
|
|
47
|
+
HIER KANN DEIN BUTTON REIN
|
|
48
|
+
<div class="viur-shop-cart-sidebar-btn-wrap">
|
|
49
|
+
<!-- TODO: Placement of discount? -->
|
|
50
|
+
<div class="viur-shop-discount-wrap" v-if="showDiscount">
|
|
51
|
+
<Discount></Discount>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<sl-button variant="primary" size="medium"> Jetzt Bestellen</sl-button>
|
|
55
|
+
<sl-button size="medium" variant="info">
|
|
56
|
+
<sl-icon name="paypal" slot="prefix"></sl-icon>
|
|
57
|
+
Paypal
|
|
58
|
+
</sl-button>
|
|
59
|
+
</div>
|
|
60
|
+
<!-- TODO: Delivery time estimate: slot -->
|
|
61
|
+
</slot>
|
|
62
|
+
<slot name="custom"></slot>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script setup>
|
|
66
|
+
import Discount from "../cart/Discount.vue";
|
|
67
|
+
import Shipping from "../order/process/Shipping.vue";
|
|
68
|
+
import { computed, onBeforeMount, reactive, ref } from "vue";
|
|
69
|
+
import { useCartStore } from "../../stores/cart";
|
|
70
|
+
|
|
71
|
+
const cartStore = useCartStore();
|
|
72
|
+
|
|
73
|
+
const shipping = ref(null);
|
|
74
|
+
const props = defineProps({
|
|
75
|
+
showDiscount: {type: Boolean, default: true},
|
|
76
|
+
customShippingComponent:{type:Object,default:undefined},
|
|
77
|
+
});
|
|
78
|
+
console.log("csc",props.customShippingComponent)
|
|
79
|
+
const state=reactive({
|
|
80
|
+
node:{}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const totalPrice = computed(() => {
|
|
84
|
+
if (state.node?.shipping) {
|
|
85
|
+
return (
|
|
86
|
+
state.node.total +
|
|
87
|
+
state.node?.shipping?.dest.shipping_cost -
|
|
88
|
+
state.node.discount
|
|
89
|
+
);
|
|
90
|
+
} else {
|
|
91
|
+
// use shippingprice formbasket
|
|
92
|
+
console.log(cartStore.state.basket);
|
|
93
|
+
|
|
94
|
+
if (cartStore.state.basket.length === 1) {
|
|
95
|
+
return (
|
|
96
|
+
state.node?.total +
|
|
97
|
+
cartStore.state.basket.shipping?.dest.shipping_cost -
|
|
98
|
+
state.node.discount
|
|
99
|
+
);
|
|
100
|
+
} else {
|
|
101
|
+
return state.node.total + 0 - state.node.discount; //kein shipping
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
onBeforeMount(async () => {
|
|
106
|
+
await cartStore.init();
|
|
107
|
+
state.node = cartStore.state.basketRootNode;
|
|
108
|
+
console.log("get node",state.node)
|
|
109
|
+
})
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<style>
|
|
113
|
+
.viur-shop-cart-sidebar-info-line {
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: row;
|
|
116
|
+
flex-wrap: nowrap;
|
|
117
|
+
margin: var(--sl-spacing-2x-small) 0;
|
|
118
|
+
|
|
119
|
+
&.total {
|
|
120
|
+
font-weight: 600;
|
|
121
|
+
border-top: 1px solid var(--sl-color-neutral-300);
|
|
122
|
+
border-bottom: 1px solid var(--sl-color-neutral-300);
|
|
123
|
+
padding: var(--sl-spacing-x-small) 0;
|
|
124
|
+
margin: var(--sl-spacing-small) 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
span {
|
|
128
|
+
margin-right: auto;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.viur-shop-cart-sidebar-btn-wrap {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
margin-top: var(--sl-spacing-large);
|
|
136
|
+
|
|
137
|
+
sl-button {
|
|
138
|
+
margin-bottom: var(--sl-spacing-x-small);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.viur-shop-cart-sidebar-headline {
|
|
143
|
+
margin: 0 0 var(--sl-spacing-large) 0;
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
FlexRender,
|
|
4
|
+
createColumnHelper,
|
|
5
|
+
getCoreRowModel,
|
|
6
|
+
getExpandedRowModel,
|
|
7
|
+
useVueTable,
|
|
8
|
+
type ExpandedState,
|
|
9
|
+
type Row,
|
|
10
|
+
} from '@tanstack/vue-table'
|
|
11
|
+
import { Text, h, ref } from 'vue'
|
|
12
|
+
type Person = {
|
|
13
|
+
firstName: string
|
|
14
|
+
lastName: string
|
|
15
|
+
age: number
|
|
16
|
+
visits: number
|
|
17
|
+
status: string
|
|
18
|
+
progress: number
|
|
19
|
+
}
|
|
20
|
+
const defaultData: Person[] = [
|
|
21
|
+
{
|
|
22
|
+
firstName: 'tanner',
|
|
23
|
+
lastName: 'linsley',
|
|
24
|
+
age: 24,
|
|
25
|
+
visits: 100,
|
|
26
|
+
status: 'In Relationship',
|
|
27
|
+
progress: 50,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
firstName: 'tandy',
|
|
31
|
+
lastName: 'miller',
|
|
32
|
+
age: 40,
|
|
33
|
+
visits: 40,
|
|
34
|
+
status: 'Single',
|
|
35
|
+
progress: 80,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
firstName: 'joe',
|
|
39
|
+
lastName: 'dirte',
|
|
40
|
+
age: 45,
|
|
41
|
+
visits: 20,
|
|
42
|
+
status: 'Complicated',
|
|
43
|
+
progress: 10,
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
const columnHelper = createColumnHelper<Person>()
|
|
47
|
+
function renderExpanded(row: Row<Person>) {
|
|
48
|
+
if (!row.getCanExpand()) {
|
|
49
|
+
return h(Text, '🔵')
|
|
50
|
+
}
|
|
51
|
+
return h(
|
|
52
|
+
'button',
|
|
53
|
+
{
|
|
54
|
+
onClick: row.getToggleExpandedHandler(),
|
|
55
|
+
style: { cursor: 'pointer' },
|
|
56
|
+
},
|
|
57
|
+
row.getIsExpanded() ? '👇' : '👉'
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
const columns = [
|
|
61
|
+
columnHelper.group({
|
|
62
|
+
header: 'Name',
|
|
63
|
+
footer: props => props.column.id,
|
|
64
|
+
columns: [
|
|
65
|
+
columnHelper.display({
|
|
66
|
+
id: 'expander',
|
|
67
|
+
header: () => null,
|
|
68
|
+
cell: ({ row }) => renderExpanded(row),
|
|
69
|
+
}),
|
|
70
|
+
columnHelper.accessor('firstName', {
|
|
71
|
+
footer: props => props.column.id,
|
|
72
|
+
}),
|
|
73
|
+
columnHelper.accessor(row => row.lastName, {
|
|
74
|
+
id: 'lastName',
|
|
75
|
+
cell: info => info.getValue(),
|
|
76
|
+
header: () => 'Last Name',
|
|
77
|
+
footer: props => props.column.id,
|
|
78
|
+
}),
|
|
79
|
+
],
|
|
80
|
+
}),
|
|
81
|
+
columnHelper.group({
|
|
82
|
+
header: 'Info',
|
|
83
|
+
footer: props => props.column.id,
|
|
84
|
+
columns: [
|
|
85
|
+
columnHelper.accessor('age', {
|
|
86
|
+
header: () => 'Age',
|
|
87
|
+
footer: props => props.column.id,
|
|
88
|
+
}),
|
|
89
|
+
columnHelper.group({
|
|
90
|
+
header: 'More Info',
|
|
91
|
+
columns: [
|
|
92
|
+
columnHelper.accessor('visits', {
|
|
93
|
+
header: () => 'Visits',
|
|
94
|
+
footer: props => props.column.id,
|
|
95
|
+
}),
|
|
96
|
+
columnHelper.accessor('status', {
|
|
97
|
+
header: 'Status',
|
|
98
|
+
footer: props => props.column.id,
|
|
99
|
+
}),
|
|
100
|
+
columnHelper.accessor('progress', {
|
|
101
|
+
header: 'Profile Progress',
|
|
102
|
+
footer: props => props.column.id,
|
|
103
|
+
}),
|
|
104
|
+
],
|
|
105
|
+
}),
|
|
106
|
+
],
|
|
107
|
+
}),
|
|
108
|
+
]
|
|
109
|
+
const data = ref(defaultData)
|
|
110
|
+
const expanded = ref<ExpandedState>({})
|
|
111
|
+
const rerender = () => {
|
|
112
|
+
data.value = defaultData
|
|
113
|
+
}
|
|
114
|
+
const table = useVueTable({
|
|
115
|
+
get data() {
|
|
116
|
+
return data.value
|
|
117
|
+
},
|
|
118
|
+
state: {
|
|
119
|
+
get expanded() {
|
|
120
|
+
return expanded.value
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
columns,
|
|
124
|
+
getRowCanExpand: () => true,
|
|
125
|
+
getCoreRowModel: getCoreRowModel(),
|
|
126
|
+
getExpandedRowModel: getExpandedRowModel(),
|
|
127
|
+
onExpandedChange: updaterOrValue => {
|
|
128
|
+
expanded.value =
|
|
129
|
+
typeof updaterOrValue === 'function'
|
|
130
|
+
? updaterOrValue(expanded.value)
|
|
131
|
+
: updaterOrValue
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<template>
|
|
137
|
+
<div class="p-2">
|
|
138
|
+
<table>
|
|
139
|
+
<thead>
|
|
140
|
+
<tr
|
|
141
|
+
v-for="headerGroup in table.getHeaderGroups()"
|
|
142
|
+
:key="headerGroup.id"
|
|
143
|
+
>
|
|
144
|
+
<th
|
|
145
|
+
v-for="header in headerGroup.headers"
|
|
146
|
+
:key="header.id"
|
|
147
|
+
:colSpan="header.colSpan"
|
|
148
|
+
>
|
|
149
|
+
<FlexRender
|
|
150
|
+
v-if="!header.isPlaceholder"
|
|
151
|
+
:render="header.column.columnDef.header"
|
|
152
|
+
:props="header.getContext()"
|
|
153
|
+
/>
|
|
154
|
+
</th>
|
|
155
|
+
</tr>
|
|
156
|
+
</thead>
|
|
157
|
+
<tbody>
|
|
158
|
+
<template v-for="row in table.getRowModel().rows" :key="row.id">
|
|
159
|
+
<tr>
|
|
160
|
+
<td v-for="cell in row.getVisibleCells()" :key="cell.id">
|
|
161
|
+
<FlexRender
|
|
162
|
+
:render="cell.column.columnDef.cell"
|
|
163
|
+
:props="cell.getContext()"
|
|
164
|
+
/>
|
|
165
|
+
</td>
|
|
166
|
+
</tr>
|
|
167
|
+
<tr v-if="row.getIsExpanded()">
|
|
168
|
+
<td :colspan="row.getAllCells().length">
|
|
169
|
+
<pre :style="{ fontSize: '10px' }">
|
|
170
|
+
<code>{{ JSON.stringify(row.original, null, 2) }}</code>
|
|
171
|
+
</pre>
|
|
172
|
+
</td>
|
|
173
|
+
</tr>
|
|
174
|
+
</template>
|
|
175
|
+
</tbody>
|
|
176
|
+
<tfoot>
|
|
177
|
+
<tr
|
|
178
|
+
v-for="footerGroup in table.getFooterGroups()"
|
|
179
|
+
:key="footerGroup.id"
|
|
180
|
+
>
|
|
181
|
+
<th
|
|
182
|
+
v-for="header in footerGroup.headers"
|
|
183
|
+
:key="header.id"
|
|
184
|
+
:colSpan="header.colSpan"
|
|
185
|
+
>
|
|
186
|
+
<FlexRender
|
|
187
|
+
v-if="!header.isPlaceholder"
|
|
188
|
+
:render="header.column.columnDef.footer"
|
|
189
|
+
:props="header.getContext()"
|
|
190
|
+
/>
|
|
191
|
+
</th>
|
|
192
|
+
</tr>
|
|
193
|
+
</tfoot>
|
|
194
|
+
</table>
|
|
195
|
+
<div class="h-4" />
|
|
196
|
+
<button @click="rerender" class="border p-2">Rerender</button>
|
|
197
|
+
</div>
|
|
198
|
+
</template>
|
|
199
|
+
|
|
200
|
+
<style>
|
|
201
|
+
html {
|
|
202
|
+
font-family: sans-serif;
|
|
203
|
+
font-size: 14px;
|
|
204
|
+
}
|
|
205
|
+
table {
|
|
206
|
+
border: 1px solid lightgray;
|
|
207
|
+
}
|
|
208
|
+
tbody {
|
|
209
|
+
border-bottom: 1px solid lightgray;
|
|
210
|
+
}
|
|
211
|
+
th {
|
|
212
|
+
border-bottom: 1px solid lightgray;
|
|
213
|
+
border-right: 1px solid lightgray;
|
|
214
|
+
padding: 2px 4px;
|
|
215
|
+
}
|
|
216
|
+
tfoot {
|
|
217
|
+
color: gray;
|
|
218
|
+
}
|
|
219
|
+
tfoot th {
|
|
220
|
+
font-weight: normal;
|
|
221
|
+
}
|
|
222
|
+
</style>
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// ! JUST FOR DEVELOPMENT WILL BE DELETED AFTER FINISHED
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
FlexRender,
|
|
6
|
+
getCoreRowModel,
|
|
7
|
+
getPaginationRowModel,
|
|
8
|
+
useVueTable,
|
|
9
|
+
createColumnHelper,
|
|
10
|
+
} from "@tanstack/vue-table";
|
|
11
|
+
import { ref } from "vue";
|
|
12
|
+
import { makeData, Person } from "./makeData";
|
|
13
|
+
|
|
14
|
+
const INITIAL_PAGE_INDEX = 0;
|
|
15
|
+
|
|
16
|
+
const defaultData = makeData(100);
|
|
17
|
+
const columnHelper = createColumnHelper<Person>();
|
|
18
|
+
const goToPageNumber = ref(INITIAL_PAGE_INDEX + 1);
|
|
19
|
+
const pageSizes = [10, 20, 30, 40, 50];
|
|
20
|
+
const data = ref(defaultData);
|
|
21
|
+
|
|
22
|
+
const columns = [
|
|
23
|
+
columnHelper.group({
|
|
24
|
+
header: "Name",
|
|
25
|
+
footer: (props) => props.column.id,
|
|
26
|
+
columns: [
|
|
27
|
+
columnHelper.accessor("firstName", {
|
|
28
|
+
cell: (info) => info.getValue(),
|
|
29
|
+
footer: (props) => props.column.id,
|
|
30
|
+
}),
|
|
31
|
+
columnHelper.accessor((row) => row.lastName, {
|
|
32
|
+
id: "lastName",
|
|
33
|
+
cell: (info) => info.getValue(),
|
|
34
|
+
header: () => "Last Name",
|
|
35
|
+
footer: (props) => props.column.id,
|
|
36
|
+
}),
|
|
37
|
+
],
|
|
38
|
+
}),
|
|
39
|
+
columnHelper.group({
|
|
40
|
+
header: "Info",
|
|
41
|
+
footer: (props) => props.column.id,
|
|
42
|
+
columns: [
|
|
43
|
+
columnHelper.accessor("age", {
|
|
44
|
+
header: () => "Age",
|
|
45
|
+
footer: (props) => props.column.id,
|
|
46
|
+
}),
|
|
47
|
+
columnHelper.group({
|
|
48
|
+
header: "More Info",
|
|
49
|
+
columns: [
|
|
50
|
+
columnHelper.accessor("visits", {
|
|
51
|
+
header: () => "Visits",
|
|
52
|
+
footer: (props) => props.column.id,
|
|
53
|
+
}),
|
|
54
|
+
columnHelper.accessor("status", {
|
|
55
|
+
header: "Status",
|
|
56
|
+
footer: (props) => props.column.id,
|
|
57
|
+
}),
|
|
58
|
+
columnHelper.accessor("progress", {
|
|
59
|
+
header: "Profile Progress",
|
|
60
|
+
footer: (props) => props.column.id,
|
|
61
|
+
}),
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
}),
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const table = useVueTable({
|
|
69
|
+
get data() {
|
|
70
|
+
return data.value;
|
|
71
|
+
},
|
|
72
|
+
columns,
|
|
73
|
+
getCoreRowModel: getCoreRowModel(),
|
|
74
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
function rerender() {
|
|
78
|
+
data.value = defaultData;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function handleGoToPage(e: any) {
|
|
82
|
+
const page = e.target.value ? Number(e.target.value) - 1 : 0;
|
|
83
|
+
goToPageNumber.value = page + 1;
|
|
84
|
+
table.setPageIndex(page);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function handlePageSizeChange(e: any) {
|
|
88
|
+
table.setPageSize(Number(e.target.value));
|
|
89
|
+
}
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<template>
|
|
93
|
+
<div class="p-2">
|
|
94
|
+
<table>
|
|
95
|
+
<thead>
|
|
96
|
+
<tr
|
|
97
|
+
v-for="headerGroup in table.getHeaderGroups()"
|
|
98
|
+
:key="headerGroup.id"
|
|
99
|
+
>
|
|
100
|
+
<th
|
|
101
|
+
v-for="header in headerGroup.headers"
|
|
102
|
+
:key="header.id"
|
|
103
|
+
:colSpan="header.colSpan"
|
|
104
|
+
>
|
|
105
|
+
<FlexRender
|
|
106
|
+
v-if="!header.isPlaceholder"
|
|
107
|
+
:render="header.column.columnDef.header"
|
|
108
|
+
:props="header.getContext()"
|
|
109
|
+
/>
|
|
110
|
+
</th>
|
|
111
|
+
</tr>
|
|
112
|
+
</thead>
|
|
113
|
+
<tbody>
|
|
114
|
+
<tr v-for="row in table.getRowModel().rows" :key="row.id">
|
|
115
|
+
<td v-for="cell in row.getVisibleCells()" :key="cell.id">
|
|
116
|
+
<FlexRender
|
|
117
|
+
:render="cell.column.columnDef.cell"
|
|
118
|
+
:props="cell.getContext()"
|
|
119
|
+
/>
|
|
120
|
+
</td>
|
|
121
|
+
</tr>
|
|
122
|
+
</tbody>
|
|
123
|
+
<tfoot>
|
|
124
|
+
<tr
|
|
125
|
+
v-for="footerGroup in table.getFooterGroups()"
|
|
126
|
+
:key="footerGroup.id"
|
|
127
|
+
>
|
|
128
|
+
<th
|
|
129
|
+
v-for="header in footerGroup.headers"
|
|
130
|
+
:key="header.id"
|
|
131
|
+
:colSpan="header.colSpan"
|
|
132
|
+
>
|
|
133
|
+
<FlexRender
|
|
134
|
+
v-if="!header.isPlaceholder"
|
|
135
|
+
:render="header.column.columnDef.footer"
|
|
136
|
+
:props="header.getContext()"
|
|
137
|
+
/>
|
|
138
|
+
</th>
|
|
139
|
+
</tr>
|
|
140
|
+
</tfoot>
|
|
141
|
+
</table>
|
|
142
|
+
<div>
|
|
143
|
+
<div class="flex items-center gap-2">
|
|
144
|
+
<button
|
|
145
|
+
class="border rounded p-1"
|
|
146
|
+
@click="() => table.setPageIndex(0)"
|
|
147
|
+
:disabled="!table.getCanPreviousPage()"
|
|
148
|
+
>
|
|
149
|
+
«
|
|
150
|
+
</button>
|
|
151
|
+
<button
|
|
152
|
+
class="border rounded p-1"
|
|
153
|
+
@click="() => table.previousPage()"
|
|
154
|
+
:disabled="!table.getCanPreviousPage()"
|
|
155
|
+
>
|
|
156
|
+
‹
|
|
157
|
+
</button>
|
|
158
|
+
<button
|
|
159
|
+
class="border rounded p-1"
|
|
160
|
+
@click="() => table.nextPage()"
|
|
161
|
+
:disabled="!table.getCanNextPage()"
|
|
162
|
+
>
|
|
163
|
+
›
|
|
164
|
+
</button>
|
|
165
|
+
<button
|
|
166
|
+
class="border rounded p-1"
|
|
167
|
+
@click="() => table.setPageIndex(table.getPageCount() - 1)"
|
|
168
|
+
:disabled="!table.getCanNextPage()"
|
|
169
|
+
>
|
|
170
|
+
»
|
|
171
|
+
</button>
|
|
172
|
+
<span class="flex items-center gap-1">
|
|
173
|
+
<div>Page</div>
|
|
174
|
+
<strong>
|
|
175
|
+
{{ table.getState().pagination.pageIndex + 1 }} of
|
|
176
|
+
{{ table.getPageCount() }}
|
|
177
|
+
</strong>
|
|
178
|
+
</span>
|
|
179
|
+
<span class="flex items-center gap-1">
|
|
180
|
+
| Go to page:
|
|
181
|
+
<input
|
|
182
|
+
type="number"
|
|
183
|
+
:value="goToPageNumber"
|
|
184
|
+
@change="handleGoToPage"
|
|
185
|
+
class="border p-1 rounded w-16"
|
|
186
|
+
/>
|
|
187
|
+
</span>
|
|
188
|
+
<select
|
|
189
|
+
:value="table.getState().pagination.pageSize"
|
|
190
|
+
@change="handlePageSizeChange"
|
|
191
|
+
>
|
|
192
|
+
<option
|
|
193
|
+
:key="pageSize"
|
|
194
|
+
:value="pageSize"
|
|
195
|
+
v-for="pageSize in pageSizes"
|
|
196
|
+
>
|
|
197
|
+
Show {{ pageSize }}
|
|
198
|
+
</option>
|
|
199
|
+
</select>
|
|
200
|
+
</div>
|
|
201
|
+
<div>{{ table.getRowModel().rows.length }} Rows</div>
|
|
202
|
+
<pre>{{ JSON.stringify(table.getState().pagination, null, 2) }}</pre>
|
|
203
|
+
</div>
|
|
204
|
+
<div class="h-2" />
|
|
205
|
+
<button @click="rerender" class="border p-2">Rerender</button>
|
|
206
|
+
</div>
|
|
207
|
+
</template>
|
|
208
|
+
|
|
209
|
+
<style>
|
|
210
|
+
html {
|
|
211
|
+
font-family: sans-serif;
|
|
212
|
+
font-size: 14px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
table {
|
|
216
|
+
border: 1px solid lightgray;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
tbody {
|
|
220
|
+
border-bottom: 1px solid lightgray;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
th {
|
|
224
|
+
border-bottom: 1px solid lightgray;
|
|
225
|
+
border-right: 1px solid lightgray;
|
|
226
|
+
padding: 2px 4px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
tfoot {
|
|
230
|
+
color: gray;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
tfoot th {
|
|
234
|
+
font-weight: normal;
|
|
235
|
+
}
|
|
236
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- TODO: at a very later point -->
|
|
3
|
+
<div class="price-wrap">
|
|
4
|
+
<sl-format-number
|
|
5
|
+
class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--unitprice"
|
|
6
|
+
lang="de"
|
|
7
|
+
type="currency"
|
|
8
|
+
currency="EUR"
|
|
9
|
+
:value="price.retail"
|
|
10
|
+
>
|
|
11
|
+
</sl-format-number>
|
|
12
|
+
<sl-format-number
|
|
13
|
+
class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--unitprice"
|
|
14
|
+
lang="de"
|
|
15
|
+
type="currency"
|
|
16
|
+
currency="EUR"
|
|
17
|
+
:value="price.recommended"
|
|
18
|
+
>
|
|
19
|
+
</sl-format-number>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup>
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
price: {
|
|
26
|
+
type: Object,
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
function priceGetter() {
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<style scoped>
|
|
37
|
+
.price-wrap {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-alert :variant="variant" open closable duration="3000" @sl-hide="onHide">
|
|
3
|
+
<sl-icon slot="icon" :name="iconName"></sl-icon>
|
|
4
|
+
<slot name="alertMsg">ALERT!</slot>
|
|
5
|
+
</sl-alert>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup>
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
variant: { type: String, default: "primary" },
|
|
11
|
+
iconName: { type: String, default: "info-circle" },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const emit = defineEmits(["onHide"]);
|
|
15
|
+
|
|
16
|
+
function onHide() {
|
|
17
|
+
emit("onHide");
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// ! JUST FOR DEVELOPMENT WILL BE DELETED AFTER FINISHED
|
|
2
|
+
import { faker } from '@faker-js/faker'
|
|
3
|
+
|
|
4
|
+
const range = (len) => {
|
|
5
|
+
const arr = []
|
|
6
|
+
for (let i = 0; i < len; i++) {
|
|
7
|
+
arr.push(i)
|
|
8
|
+
}
|
|
9
|
+
return arr
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const newPerson = () => {
|
|
13
|
+
return {
|
|
14
|
+
firstName: faker.person.firstName(),
|
|
15
|
+
lastName: faker.person.lastName(),
|
|
16
|
+
age: faker.number.int(40),
|
|
17
|
+
visits: faker.number.int(1000),
|
|
18
|
+
progress: faker.number.int(100),
|
|
19
|
+
status: faker.helpers.shuffle([
|
|
20
|
+
'relationship',
|
|
21
|
+
'complicated',
|
|
22
|
+
'single',
|
|
23
|
+
]),
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function makeData(...lens) {
|
|
28
|
+
const makeDataLevel = (depth = 0) => {
|
|
29
|
+
const len = lens[depth]
|
|
30
|
+
return range(len).map(() => {
|
|
31
|
+
return {
|
|
32
|
+
...newPerson(),
|
|
33
|
+
subRows: lens[depth + 1] ? makeDataLevel(depth + 1) : undefined,
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return makeDataLevel()
|
|
39
|
+
}
|