@viur/shop-components 0.0.1-dev.58 → 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.
Files changed (86) hide show
  1. package/.editorconfig +16 -0
  2. package/.github/workflows/npm-publish.yml +42 -0
  3. package/.gitmodules +3 -0
  4. package/LICENSE +21 -0
  5. package/README.md +13 -2
  6. package/package.json +19 -32
  7. package/src/components/ShopCart.vue +512 -0
  8. package/src/components/ShopOrderComplete.vue +73 -0
  9. package/src/components/ShopOrderConfirm.vue +291 -0
  10. package/src/components/ShopOrderStepper.vue +264 -0
  11. package/src/components/ShopUserData.vue +232 -0
  12. package/src/components/cart/CartLeaf.vue +277 -0
  13. package/src/components/cart/CartLeafModel.vue +304 -0
  14. package/src/components/cart/CartNode.vue +25 -0
  15. package/src/components/cart/CartTree.vue +54 -0
  16. package/src/components/cart/CartTreeWrapper.vue +73 -0
  17. package/src/components/cart/CartView.vue +723 -0
  18. package/src/components/cart/Discount.vue +91 -0
  19. package/src/components/lib/utils.js +0 -0
  20. package/src/components/order/OrderSidebar.vue +102 -0
  21. package/src/components/order/category/CategoryList.vue +83 -0
  22. package/src/components/order/category/CategoryView.vue +143 -0
  23. package/src/components/order/information/adress/ShippingAdress.vue +143 -0
  24. package/src/components/order/item/ItemCard.vue +168 -0
  25. package/src/components/order/item/ItemView.vue +232 -0
  26. package/src/components/order/process/ConfirmView.vue +312 -0
  27. package/src/components/order/process/ExampleUsage.vue +113 -0
  28. package/src/components/order/process/OrderTabHeader.vue +16 -0
  29. package/src/components/order/process/SelectPaymentProvider.vue +62 -0
  30. package/src/components/order/process/Shipping.vue +46 -0
  31. package/src/components/ui/ShopSummary.vue +145 -0
  32. package/src/components/ui/generic/ArticleList.vue +222 -0
  33. package/src/components/ui/generic/ExamplePagination.vue +236 -0
  34. package/src/components/ui/generic/ShopPriceFormatter.vue +41 -0
  35. package/src/components/ui/generic/alerts/ShopAlert.vue +19 -0
  36. package/src/components/ui/generic/makeData.js +39 -0
  37. package/src/components/ui/stepper/StepperItem.vue +39 -0
  38. package/src/components/ui/stepper/StepperTab.vue +133 -0
  39. package/src/components/ui/stepper/StepperTrigger.vue +35 -0
  40. package/src/components/ui/userdata/AddForm.vue +125 -0
  41. package/src/components/ui/userdata/AddressBox.vue +117 -0
  42. package/src/components/ui/userdata/BaseLayout.vue +94 -0
  43. package/src/components/ui/userdata/CustomBooleanBone.vue +58 -0
  44. package/src/components/ui/userdata/CustomSelectBone.vue +91 -0
  45. package/src/components/ui/userdata/CustomStringBone.vue +71 -0
  46. package/src/components/ui/userdata/DefaultLayout.vue +126 -0
  47. package/src/components/ui/userdata/SelectAddress.vue +21 -0
  48. package/src/components/ui/userdata/multi/ActionBar.vue +38 -0
  49. package/src/components/ui/userdata/multi/CartSelection.vue +42 -0
  50. package/src/main.js +50 -0
  51. package/src/router/index.js +103 -0
  52. package/src/stores/cart.js +336 -0
  53. package/src/style/ignite/.editorconfig +20 -0
  54. package/src/style/ignite/.github/workflows/ignite.yml +64 -0
  55. package/src/style/ignite/.github/workflows/node.yml +30 -0
  56. package/src/style/ignite/.postcssrc.cjs +25 -0
  57. package/src/style/ignite/CHANGELOG.md +244 -0
  58. package/src/style/ignite/LICENSE +21 -0
  59. package/src/style/ignite/README.md +92 -0
  60. package/src/style/ignite/dist/ignite.css +2019 -0
  61. package/src/style/ignite/dist/ignite.min.css +4 -0
  62. package/src/style/ignite/foundation/basic.css +371 -0
  63. package/src/style/ignite/foundation/color.css +323 -0
  64. package/src/style/ignite/foundation/config.css +188 -0
  65. package/src/style/ignite/foundation/grid.css +78 -0
  66. package/src/style/ignite/foundation/mediaqueries.css +71 -0
  67. package/src/style/ignite/foundation/reset.css +261 -0
  68. package/src/style/ignite/ignite.css +29 -0
  69. package/src/style/ignite/ignite.css.map +1 -0
  70. package/src/style/ignite/package-lock.json +5530 -0
  71. package/src/style/ignite/package.json +58 -0
  72. package/src/style/ignite/shoelace.css +19 -0
  73. package/src/style/ignite/themes/dark.css +12 -0
  74. package/src/style/ignite/themes/light.css +11 -0
  75. package/src/style/ignite/utilities/shoelace.css +537 -0
  76. package/src/style/ignite/utilities/utilities.css +24 -0
  77. package/src/views/ViewMissing.vue +20 -0
  78. package/vite.config.js +53 -0
  79. package/dist/CategoryView-Z-tCFNv1.mjs +0 -60
  80. package/dist/ItemCard-CVfih_bz.mjs +0 -64
  81. package/dist/ItemView-cjeQBSTR.mjs +0 -1848
  82. package/dist/ItemView.css +0 -1
  83. package/dist/main-CZfMYx-A.mjs +0 -3167
  84. package/dist/main.css +0 -1
  85. package/dist/viur-shop-components.es.js +0 -10
  86. package/dist/viur-shop-components.umd.js +0 -417
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <div class="viur-shop-address-box">
3
+ <select-address
4
+ v-if="addressSelection"
5
+ :address-list="state.addressList"
6
+ v-model="state.activeAddress"
7
+ >
8
+ </select-address>
9
+ {{state.addressList.length}}
10
+ <br>
11
+ {{cartStore.state.billingAddressList.length}}
12
+ <!-- debugging -->
13
+ <!-- {{ mode === "billing" ? cartStore.state.activeBillingAddress : "" }} -->
14
+ <!-- {{ mode === "billing" ? "" : cartStore.state.activeShippingAddress }} -->
15
+ <!-- <pre>{{ customer }}</pre> -->
16
+ <div class="viur-shop-address-box-preview" v-if="state.address">
17
+ <span>Ausgewählte Adresse :</span>
18
+ <br>
19
+ {{ state.address?.street_name }} {{ state.address?.street_number }}<br />
20
+ {{ state.address?.zip_code }} {{ state.address?.city }}
21
+ <br />
22
+ {{ state.address?.country }}
23
+ <br />
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <script setup>
29
+ import {
30
+ reactive,
31
+ computed,
32
+ onBeforeMount,
33
+ watch,
34
+ onUpdated,
35
+ onUnmounted,
36
+ } from "vue";
37
+ import { useCartStore } from "../../../stores/cart";
38
+ import SelectAddress from "./SelectAddress.vue";
39
+
40
+ const props = defineProps({
41
+ mode: { type: String, default: "billing" },
42
+ addressSelection: { type: Boolean, default: false },
43
+ modelValue: { type: Object },
44
+ });
45
+
46
+ const emit = defineEmits(["update:modelValue"]);
47
+
48
+ const cartStore = useCartStore();
49
+
50
+ const state = reactive({
51
+ addressList: computed(() =>
52
+ props.mode === "billing"
53
+ ? cartStore.state.billingAddressList
54
+ : cartStore.state.shippingAddressList,
55
+ ),
56
+ activeAddress: "",
57
+ address: computed(() => {
58
+ if (!state.activeAddress) return {};
59
+
60
+ return state.addressList.filter(
61
+ (address) => address.key === state.activeAddress,
62
+ )[0];
63
+ }),
64
+ });
65
+
66
+ function getDefaultAddress() {
67
+ if (props.mode === "billing") {
68
+ state.activeAddress = cartStore.state.activeBillingAddress.key
69
+ ? cartStore.state.activeBillingAddress.key
70
+ : "";
71
+ } else {
72
+ state.activeAddress = cartStore.state.activeShippingAddress.key
73
+ ? cartStore.state.activeShippingAddress.key
74
+ : "";
75
+ }
76
+ }
77
+
78
+ watch(
79
+ () => state.address,
80
+ (newAddress) => {
81
+ if (props.mode === "billing") {
82
+ cartStore.state.activeBillingAddress = newAddress;
83
+ } else cartStore.state.activeShippingAddress = newAddress;
84
+ },
85
+ );
86
+
87
+ watch(
88
+ () => cartStore.state.activeBillingAddress,
89
+ (newValue, oldValue) => {
90
+ state.activeAddress = newValue.key;
91
+ },
92
+ );
93
+
94
+ watch(
95
+ () => cartStore.state.activeShippingAddress,
96
+ (newValue, oldValue) => {
97
+ state.activeAddress = newValue.key;
98
+ },
99
+ );
100
+ onBeforeMount(() => {
101
+ getDefaultAddress();
102
+ });
103
+
104
+ onUnmounted(() => {
105
+ state.activeAddress = "";
106
+ });
107
+
108
+ onUpdated(() => {
109
+ getDefaultAddress();
110
+ });
111
+ </script>
112
+
113
+ <style scoped>
114
+ .viur-shop-address-box-preview{
115
+ margin: var(--sl-spacing-medium) 0;
116
+ }
117
+ </style>
@@ -0,0 +1,94 @@
1
+ <template>
2
+ <!-- <div style="width: 100%">
3
+ {{ customer.firstname }} {{ customer.lastname }}<br />
4
+ Phone: {{ customer.phone }} <br />
5
+ E-Mail : {{ customer.name }}<br />
6
+ Debitor: {{ customer.debitornr }}<br />
7
+ </div> -->
8
+
9
+ <slot name="cart-selection"></slot>
10
+
11
+ <div class="viur-shop-cart-address-wrap">
12
+ <div class="viur-shop-cart-address">
13
+ <div class="viur-shop-cart-address-headline">
14
+ {{ $t("skeleton.address.address_type.billing") }}
15
+ <sl-button outline size="small" @click="editBilling">
16
+ <sl-icon name="pencil" slot="prefix"></sl-icon>
17
+ </sl-button>
18
+ </div>
19
+ <slot name="billing-address">
20
+ <address-box :address-selection="true" :mode="'billing'"></address-box>
21
+ </slot>
22
+ </div>
23
+ <slot name="mode-switch"></slot>
24
+ <div class="viur-shop-cart-address" v-if="customAddress">
25
+ <div class="viur-shop-cart-address-headline">
26
+ {{ $t("skeleton.address.address_type.shipping") }}
27
+ <sl-button
28
+ outline
29
+ size="small"
30
+ @click="editShipping"
31
+ v-if="customAddress"
32
+ >
33
+ <sl-icon name="pencil" slot="prefix"></sl-icon>
34
+ </sl-button>
35
+ </div>
36
+ <slot name="shipping-address" v-if="customAddress">
37
+ <address-box
38
+ :address-selection="true && customAddress"
39
+ :mode="'shipping'"
40
+ ></address-box>
41
+ </slot>
42
+ <slot name="shipping-address" v-else>
43
+ <address-box
44
+ :address-selection="true && customAddress"
45
+ :mode="'billing'"
46
+ >
47
+ </address-box>
48
+ </slot>
49
+ </div>
50
+ </div>
51
+ </template>
52
+
53
+ <script setup>
54
+ import { reactive } from "vue";
55
+ import { useCartStore } from "../../../stores/cart";
56
+ import AddressBox from "./AddressBox.vue";
57
+
58
+ const props = defineProps({
59
+ customer: { type: Object, required: true },
60
+ customAddress: { type: Boolean, default: false },
61
+ });
62
+
63
+ const emit = defineEmits(["editBilling", "editShipping"]);
64
+ const state = reactive({ editBilling: false, editShipping: false });
65
+
66
+ function editBilling() {
67
+ state.editBilling = !state.editBilling;
68
+ emit("editBilling", state.editBilling);
69
+ }
70
+
71
+ function editShipping() {
72
+ state.editShipping = !state.editShipping;
73
+ emit("editShipping", state.editShipping);
74
+ }
75
+ </script>
76
+
77
+ <style scoped>
78
+ .viur-shop-cart-address-wrap {
79
+ display: flex;
80
+ flex-direction: column;
81
+ gap: var(--sl-spacing-x-large);
82
+ margin-top: var(--sl-spacing-large);
83
+ }
84
+
85
+ .viur-shop-cart-address-headline {
86
+ display: flex;
87
+ flex-direction: row;
88
+ flex-wrap: nowrap;
89
+ align-items: center;
90
+ justify-content: space-between;
91
+ font-weight: 600;
92
+ margin-bottom: var(--sl-spacing-medium);
93
+ }
94
+ </style>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <sl-checkbox
3
+ class="widget-bone widget-bone-boolean widget-bone-boolean-default"
4
+ :class="([`widget-bone-boolean-${name}`])"
5
+ :disabled="boneState.readonly"
6
+ :checked="state.value"
7
+ @sl-change="changeEvent"
8
+ >
9
+ {{ boneState.bonestructure.descr }}
10
+ </sl-checkbox>
11
+ </template>
12
+
13
+ <script lang="ts">
14
+ //@ts-nocheck
15
+ import { reactive, defineComponent, onMounted, inject, computed } from "vue"
16
+
17
+ export default defineComponent({
18
+ inheritAttrs: false,
19
+ props: {
20
+ name: String,
21
+ value: [Object, String, Number, Boolean, Array],
22
+ index: Number,
23
+ lang: String
24
+ },
25
+ components: {},
26
+ emits: ["change"],
27
+ setup(props, context) {
28
+ const boneState = inject("boneState")
29
+ const state = reactive({
30
+ value: computed(() => {
31
+ return ![false, null, undefined, ""].includes(props.value)
32
+ })
33
+ })
34
+
35
+ function changeEvent(event) {
36
+ context.emit("change", props.name, event.target.checked, props.lang, props.index)
37
+ }
38
+
39
+ onMounted(() => {
40
+ let val = props.value
41
+ if (!val) {
42
+ val = false
43
+ }
44
+ context.emit("change", props.name, val, props.lang, props.index) //init
45
+ })
46
+
47
+ return {
48
+ state,
49
+ boneState,
50
+ changeEvent
51
+ }
52
+ }
53
+ })
54
+ </script>
55
+
56
+ <style scoped>
57
+
58
+ </style>
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <sl-select
3
+ class="widget-bone widget-bone-select widget-bone-select-default"
4
+ :class="([`widget-bone-select-${name}`])"
5
+ :disabled="boneState.readonly"
6
+ :value="state.value"
7
+ hoist
8
+ :multiple="boneState['bonestructure']['multiple']"
9
+ max-options-visible="0"
10
+ clearable
11
+ @sl-change="changeEvent"
12
+ :placeholder="boneState.bonestructure.descr"
13
+ >
14
+ <sl-option
15
+ v-for="value in convertObjToList()"
16
+ :key="value[0]"
17
+ :value="value[0]"
18
+ >
19
+ {{ value[1] }}
20
+ </sl-option>
21
+ </sl-select>
22
+ </template>
23
+
24
+ <script lang="ts">
25
+ //@ts-nocheck
26
+ import { reactive, defineComponent, onMounted, inject, computed } from "vue"
27
+
28
+ export default defineComponent({
29
+ inheritAttrs: false,
30
+ props: {
31
+ name: String,
32
+ value: null,
33
+ index: Number,
34
+ lang: String
35
+ },
36
+ components: {},
37
+ emits: ["change"],
38
+ setup(props, context) {
39
+ const boneState = inject("boneState")
40
+ const state = reactive({
41
+ value: computed(() => {
42
+ let val = props.value
43
+ if (Array.isArray(props.value)) {
44
+ if (boneState["bonestructure"]["values"] instanceof Array) {
45
+ val = val.filter((i) => boneState["bonestructure"]["values"].map((i) => i[0].toString()).includes(i))
46
+ } else
47
+ val = val.filter((i) =>
48
+ Object.keys(boneState["bonestructure"]["values"])
49
+ .map((i) => i.toString())
50
+ .includes(i)
51
+ )
52
+
53
+ return val.map((i) => i.toString())
54
+ }
55
+ return props.value ? props.value.toString() : ""
56
+ })
57
+ })
58
+
59
+ function convertObjToList() {
60
+ if (Array.isArray(boneState["bonestructure"]["values"])) {
61
+ return boneState["bonestructure"]["values"]
62
+ } else {
63
+ let objToList = []
64
+ for (const [key, value] of Object.entries(boneState["bonestructure"]["values"])) {
65
+ objToList.push([key, value])
66
+ }
67
+ return objToList
68
+ }
69
+ }
70
+
71
+ function changeEvent(event) {
72
+ context.emit("change", props.name, event.target.value, props.lang, props.index)
73
+ }
74
+
75
+ onMounted(() => {
76
+ context.emit("change", props.name, state.value, props.lang, props.index) //init
77
+ })
78
+
79
+ return {
80
+ state,
81
+ boneState,
82
+ changeEvent,
83
+ convertObjToList
84
+ }
85
+ }
86
+ })
87
+ </script>
88
+
89
+ <style scoped>
90
+
91
+ </style>
@@ -0,0 +1,71 @@
1
+ <template>
2
+ <sl-input
3
+ ref="stringBone"
4
+ :placeholder="boneState.bonestructure.descr"
5
+ :disabled="boneState.readonly"
6
+ :value="Utils.unescape(value)"
7
+ :required="boneState.bonestructure.required"
8
+ @sl-change="changeEvent"
9
+ @keyup="changeEvent"
10
+ ></sl-input>
11
+ </template>
12
+
13
+ <script lang="ts">
14
+ //@ts-nocheck
15
+ import { reactive, defineComponent, onMounted, inject, computed, watchEffect, ref } from "vue"
16
+ import { useTimeoutFn } from "@vueuse/core"
17
+ import Utils from "@viur/vue-utils//bones/utils"
18
+
19
+ export default defineComponent({
20
+ inheritAttrs: false,
21
+ props: {
22
+ name: String,
23
+ value: [Object, String, Number, Boolean, Array],
24
+ index: Number,
25
+ lang: String,
26
+ autofocus: Boolean
27
+ },
28
+ components: {},
29
+ emits: ["change"],
30
+ setup(props, context) {
31
+ const boneState = inject("boneState")
32
+ const state = reactive({
33
+ value: computed(() => props.value)
34
+ })
35
+
36
+ const stringBone = ref(null)
37
+
38
+ function changeEvent(event) {
39
+ context.emit("change", props.name, event.target.value, props.lang, props.index)
40
+ }
41
+
42
+ watchEffect(() => {
43
+ if (props.autofocus) {
44
+ if (stringBone.value && stringBone.value !== null && stringBone !== null) {
45
+ const { start } = useTimeoutFn(() => {
46
+ stringBone.value.focus()
47
+ }, 600)
48
+
49
+ start()
50
+ }
51
+ }
52
+ })
53
+
54
+ onMounted(() => {
55
+ context.emit("change", props.name, props.value, props.lang, props.index) //init
56
+ })
57
+
58
+ return {
59
+ state,
60
+ Utils,
61
+ boneState,
62
+ changeEvent,
63
+ stringBone
64
+ }
65
+ }
66
+ })
67
+ </script>
68
+
69
+ <style scoped>
70
+
71
+ </style>
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <div class="vi-shop-cart-form-wrap" v-if="Object.keys(formState.structure).length > 0">
3
+ <slot
4
+ boneName="salutation"
5
+ :widget="CustomSelectBone"
6
+ label="hide"
7
+ >
8
+ </slot>
9
+
10
+ <slot boneName="firstname"
11
+ :widget="CustomStringBone"
12
+ label="hide">
13
+ </slot>
14
+
15
+ <slot boneName="lastname"
16
+ :widget="CustomStringBone"
17
+ label="hide">
18
+ </slot>
19
+
20
+ <slot boneName="street_name"
21
+ :widget="CustomStringBone"
22
+ label="hide">
23
+ </slot>
24
+
25
+ <slot boneName="street_number"
26
+ :widget="CustomStringBone"
27
+ label="hide">
28
+ </slot>
29
+
30
+ <slot
31
+ boneName="zip_code"
32
+ :widget="CustomStringBone"
33
+ placeholder="PLZ"
34
+ label="hide"
35
+ >
36
+ </slot>
37
+
38
+ <slot boneName="city"
39
+ :widget="CustomStringBone"
40
+ label="hide">
41
+ </slot>
42
+
43
+
44
+ <slot boneName="country"
45
+ :widget="CustomSelectBone"
46
+ label="hide">
47
+ </slot>
48
+
49
+ <!--<slot boneName="address_type"
50
+ :widget="CustomSelectBone"
51
+ label="hide">
52
+ </slot>-->
53
+
54
+ <slot
55
+ boneName="is_default"
56
+ :widget="CustomBooleanBone"
57
+ label="hide"
58
+ >
59
+ </slot>
60
+
61
+
62
+ </div>
63
+
64
+
65
+ </template>
66
+ <script setup>
67
+ import { inject } from "vue";
68
+ import { getBoneWidget } from "@viur/vue-utils/bones/edit";
69
+ import CustomBooleanBone from "./CustomBooleanBone.vue";
70
+ import CustomStringBone from "./CustomStringBone.vue";
71
+ import CustomSelectBone from "./CustomSelectBone.vue";
72
+ import booleanBone from '@viur/vue-utils/bones/edit/default/booleanBone.vue';
73
+
74
+ const formState = inject("formState");
75
+ const formUpdate = inject("formUpdate");
76
+ </script>
77
+ <style scoped>
78
+
79
+ .vi-shop-cart-form-wrap{
80
+ display: grid;
81
+ grid-template-columns: repeat(4, minmax(0, 1fr));
82
+ gap: var(--sl-spacing-small);
83
+ margin-bottom: var(--sl-spacing-medium);
84
+ }
85
+
86
+ :deep(.bone-wrapper){
87
+ margin: 0;
88
+ }
89
+
90
+ :deep(.wrapper-bone-firstname){
91
+ grid-column: 1 / span 2;
92
+ }
93
+
94
+ :deep(.wrapper-bone-lastname){
95
+ grid-column: 3 / span 2;
96
+ }
97
+
98
+ :deep(.wrapper-bone-street_name){
99
+ grid-column: 1 / span 3;
100
+ }
101
+
102
+ :deep(.wrapper-bone-street_number){
103
+ grid-column: 4 / span 1;
104
+ }
105
+
106
+ :deep(.wrapper-bone-zip_code){
107
+ grid-column: 1 / span 2;
108
+ }
109
+
110
+ :deep(.wrapper-bone-city){
111
+ grid-column: 3 / span 2;
112
+ }
113
+
114
+ :deep(.wrapper-bone-country){
115
+ grid-column: 1 / span 4;
116
+ }
117
+
118
+ :deep(.wrapper-bone-is_default){
119
+ padding: var(--sl-spacing-x-small) 0;
120
+ grid-column: 1 / span 4;
121
+ }
122
+
123
+
124
+
125
+
126
+ </style>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <sl-select
3
+ :value="modelValue"
4
+ @sl-change="emit('update:modelValue', $event.target.value)"
5
+ >
6
+ <sl-option
7
+ v-for="address in addressList"
8
+ :key="address.key"
9
+ :value="address.key"
10
+ >
11
+ {{ address.street_name }} {{ address.street_number }}
12
+ </sl-option>
13
+ </sl-select>
14
+ </template>
15
+ <script setup>
16
+ const props = defineProps({
17
+ addressList: { type: Array, required: true },
18
+ modelValue: { type: String },
19
+ });
20
+ const emit = defineEmits(["update:modelValue"]);
21
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div class="viur-shop-form-btn-wrap">
3
+ <sl-button
4
+ size="medium"
5
+ title="Lieferadresse entfernen"
6
+ @click="removeAddress"
7
+ >
8
+ <sl-icon name="x-lg" slot="prefix"></sl-icon>
9
+ </sl-button>
10
+ <sl-button size="medium" variant="primary" @click="addAddress">
11
+ <sl-icon name="plus-lg" slot="prefix"></sl-icon>
12
+ Lieferadresse hinzufügen
13
+ </sl-button>
14
+ </div>
15
+ </template>
16
+
17
+ <script setup>
18
+ const emit = defineEmits(["onAddressAdd", "onAddressRemove"]);
19
+ function addAddress() {
20
+ emit("onAddressAdd");
21
+ }
22
+
23
+ function removeAddress() {
24
+ emit("onAddressRemove");
25
+ }
26
+ </script>
27
+
28
+ <style scoped>
29
+ .viur-shop-form-btn-wrap {
30
+ display: flex;
31
+ flex-direction: row;
32
+ flex-wrap: nowrap;
33
+ justify-content: space-between;
34
+ width: 100%;
35
+
36
+ margin-top: var(--sl-spacing-medium);
37
+ }
38
+ </style>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <sl-select
3
+ :value="state.selectedCarts"
4
+ multiple="true"
5
+ clearable
6
+ @sl-change="handleSelect"
7
+ @sl-clear="reset"
8
+ >
9
+ <sl-option v-for="cart in carts" :key="cart.key" :value="cart.key">
10
+ {{ cart.name }}
11
+ </sl-option>
12
+ </sl-select>
13
+ </template>
14
+ <script setup>
15
+ import { onBeforeMount, reactive } from "vue";
16
+
17
+ const props = defineProps({
18
+ carts: { type: Array, required: true },
19
+ });
20
+ const emit = defineEmits(["cartSelected", "onReset"]);
21
+
22
+ const state = reactive({
23
+ selectedCarts: [],
24
+ });
25
+
26
+ function handleSelect(e) {
27
+ state.selectedCarts = e.target.value;
28
+ emit("cartSelected", e.target.value);
29
+ }
30
+
31
+ function reset() {
32
+ emit("onReset");
33
+ }
34
+
35
+ onBeforeMount(() => {
36
+ props.carts.forEach((cart) => {
37
+ state.selectedCarts.push(cart.key);
38
+ });
39
+ emit("cartSelected", state.selectedCarts);
40
+ });
41
+ </script>
42
+ <style scoped></style>