@viur/shop-components 0.0.1-dev.6 → 0.0.1-dev.61
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/old/client/HttpClient.js +111 -0
- package/old/client/ViURShopClient.js +472 -0
- package/old/client/index.js +23 -0
- package/old/client/types.js +10 -0
- package/old/components/ExampleUsage.vue +95 -0
- package/old/components/ShopCart.vue +91 -0
- package/old/components/ShopOrderComplete.vue +73 -0
- package/old/components/ShopOrderConfirm.vue +311 -0
- package/old/components/ShopOrderStepper.vue +352 -0
- package/old/components/ShopPaymentProvider.vue +113 -0
- package/old/components/ShopShippingMethod.vue +52 -0
- package/old/components/ShopSummary.vue +138 -0
- package/old/components/ShopUserData.vue +218 -0
- package/old/components/cart/CartLeaf.vue +277 -0
- package/old/components/cart/CartLeafModel.vue +312 -0
- package/old/components/cart/CartNode.vue +26 -0
- package/old/components/cart/CartTree.vue +67 -0
- package/old/components/cart/CartTreeWrapper.vue +73 -0
- package/old/components/cart/CartView.vue +82 -0
- package/old/components/cart/Discount.vue +91 -0
- package/old/components/generic/loadinghandler.vue +76 -0
- package/old/components/paymentProvider/paypalplus.vue +0 -0
- package/old/components/paymentProvider/prepayment.vue +0 -0
- package/old/components/paymentProvider/unzerPayment.vue +140 -0
- package/old/components/simple/ShopUserData.vue +161 -0
- package/old/components/simple/SimpleDefaultLayout.vue +116 -0
- package/old/components/ui/generic/CardSelector.vue +52 -0
- package/old/components/ui/generic/CartList.vue +69 -0
- package/old/components/ui/generic/ShippingInfo.vue +56 -0
- package/old/components/ui/generic/ShopPriceFormatter.vue +41 -0
- package/old/components/ui/generic/alerts/ShopAlert.vue +30 -0
- package/old/components/ui/payment/PaymentOption.vue +79 -0
- package/old/components/ui/payment/PaymentSelector.vue +158 -0
- package/old/components/ui/stepper/StepperItem.vue +90 -0
- package/old/components/ui/stepper/StepperTab.vue +161 -0
- package/old/components/ui/stepper/StepperTrigger.vue +69 -0
- package/old/components/ui/userdata/AddForm.vue +160 -0
- package/old/components/ui/userdata/AddressBox.vue +137 -0
- package/old/components/ui/userdata/BaseLayout.vue +77 -0
- package/old/components/ui/userdata/CustomBooleanBone.vue +58 -0
- package/old/components/ui/userdata/CustomSelectBone.vue +91 -0
- package/old/components/ui/userdata/CustomStringBone.vue +71 -0
- package/old/components/ui/userdata/DefaultLayout.vue +126 -0
- package/old/components/ui/userdata/SelectAddress.vue +21 -0
- package/old/components/ui/userdata/multi/ActionBar.vue +38 -0
- package/old/components/ui/userdata/multi/CartSelection.vue +42 -0
- package/old/ignite/.editorconfig +20 -0
- package/old/ignite/.github/workflows/ignite.yml +64 -0
- package/old/ignite/.github/workflows/node.yml +30 -0
- package/old/ignite/.postcssrc.cjs +25 -0
- package/old/ignite/CHANGELOG.md +244 -0
- package/old/ignite/LICENSE +21 -0
- package/old/ignite/README.md +92 -0
- package/old/ignite/dist/ignite.css +2019 -0
- package/old/ignite/dist/ignite.min.css +4 -0
- package/old/ignite/foundation/basic.css +371 -0
- package/old/ignite/foundation/color.css +323 -0
- package/old/ignite/foundation/config.css +188 -0
- package/old/ignite/foundation/grid.css +78 -0
- package/old/ignite/foundation/mediaqueries.css +71 -0
- package/old/ignite/foundation/reset.css +261 -0
- package/old/ignite/ignite.css +29 -0
- package/old/ignite/ignite.css.map +1 -0
- package/old/ignite/package-lock.json +5530 -0
- package/old/ignite/package.json +58 -0
- package/old/ignite/shoelace.css +19 -0
- package/old/ignite/themes/dark.css +12 -0
- package/old/ignite/themes/light.css +11 -0
- package/old/ignite/utilities/shoelace.css +537 -0
- package/old/ignite/utilities/utilities.css +24 -0
- package/old/stores/address.js +122 -0
- package/old/stores/cart.js +266 -0
- package/old/stores/message.js +21 -0
- package/old/stores/order.js +202 -0
- package/old/stores/payment.js +79 -0
- package/old/stores/shipping.js +78 -0
- package/package.json +23 -23
- package/src/Shop.vue +212 -0
- package/src/ShopOrderStepper.vue +89 -0
- package/src/ShopSummary.vue +170 -0
- package/src/Steps/ShopCart.vue +60 -0
- package/src/Steps/ShopOrderComplete.vue +24 -0
- package/src/Steps/ShopOrderConfirm.vue +295 -0
- package/src/Steps/ShopPaymentProvider.vue +53 -0
- package/src/Steps/ShopShippingMethod.vue +53 -0
- package/src/Steps/ShopUserDataGuest.vue +78 -0
- package/src/Steps/index.js +15 -0
- package/src/components/AddressForm.vue +84 -0
- package/src/components/AddressFormLayout.vue +107 -0
- package/src/components/CardSelector.vue +68 -0
- package/src/components/CartItem.vue +325 -0
- package/src/components/CartItemSmall.vue +257 -0
- package/src/components/LoadingHandler.vue +76 -0
- package/src/components/PaymentOption.vue +78 -0
- package/src/components/PaymentProviderUnzer.vue +201 -0
- package/src/components/PaymentSelector.vue +55 -0
- package/src/components/ShopAlert.vue +30 -0
- package/src/components/StepperTab.vue +132 -0
- package/src/components/dialogButton.vue +49 -0
- package/src/composables/address.js +95 -0
- package/src/composables/cart.js +132 -0
- package/src/composables/order.js +80 -0
- package/src/composables/payment.js +75 -0
- package/src/composables/shipping.js +32 -0
- package/src/main.js +44 -0
- package/src/shop.js +251 -0
- package/src/translations/de.js +15 -0
- package/src/translations/en.js +5 -0
- package/src/utils.js +49 -0
- package/vite.config.js +51 -0
- package/src/components/cart/CartView.vue +0 -692
- package/src/components/cart/ConfirmView.vue +0 -314
- package/src/components/order/category/CategoryList.vue +0 -83
- package/src/components/order/category/CategoryView.vue +0 -143
- package/src/components/order/information/UserInfoMulti.vue +0 -427
- package/src/components/order/information/UserInformation.vue +0 -332
- package/src/components/order/information/adress/ShippingAdress.vue +0 -143
- package/src/components/order/item/ItemCard.vue +0 -168
- package/src/components/order/item/ItemView.vue +0 -233
- package/src/components/order/process/ExampleUsage.vue +0 -100
- package/src/components/order/process/OrderComplete.vue +0 -41
- package/src/components/order/process/OrderTabHeader.vue +0 -7
- package/src/components/order/process/OrderView.vue +0 -210
- package/src/router/index.js +0 -103
- package/src/stores/cart.js +0 -111
- package/src/views/ViewMissing.vue +0 -20
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-spinner v-if="state.isLoading"></sl-spinner>
|
|
3
|
+
<ViForm
|
|
4
|
+
ref="addForm"
|
|
5
|
+
:module="`${cartStore.state.shopModuleName}/address`"
|
|
6
|
+
action="add"
|
|
7
|
+
:useCategories="false"
|
|
8
|
+
:layout="layout ? layout : DefaultLayout"
|
|
9
|
+
:values="modelValue"
|
|
10
|
+
:skel="
|
|
11
|
+
type === 'billing'
|
|
12
|
+
? addressStore.state.active.billing
|
|
13
|
+
: addressStore.state.active.shipping
|
|
14
|
+
"
|
|
15
|
+
@change="updateValues"
|
|
16
|
+
>
|
|
17
|
+
</ViForm>
|
|
18
|
+
|
|
19
|
+
<!-- BUTTON NUR PLATZHALTER FÜR TESTS -->
|
|
20
|
+
<sl-bar>
|
|
21
|
+
<div slot="left">
|
|
22
|
+
<sl-button
|
|
23
|
+
variant="success"
|
|
24
|
+
@click.stop.prevent="sendForm"
|
|
25
|
+
:loading="state.isSending"
|
|
26
|
+
>
|
|
27
|
+
<sl-icon name="floppy2" slot="prefix"></sl-icon>
|
|
28
|
+
{{
|
|
29
|
+
$t("actions.add").charAt(0).toUpperCase() + $t("actions.add").slice(1)
|
|
30
|
+
}}
|
|
31
|
+
</sl-button>
|
|
32
|
+
</div>
|
|
33
|
+
</sl-bar>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup>
|
|
37
|
+
import { reactive, ref, computed, onMounted } from "vue";
|
|
38
|
+
import ViForm from "@viur/vue-utils/forms/ViForm.vue";
|
|
39
|
+
import DefaultLayout from "./DefaultLayout.vue";
|
|
40
|
+
import { useCartStore } from "../../../stores/cart";
|
|
41
|
+
import { useAddressStore } from "../../../stores/address";
|
|
42
|
+
import { useOrderStore } from "../../../main";
|
|
43
|
+
|
|
44
|
+
const props = defineProps({
|
|
45
|
+
layout: { required: false },
|
|
46
|
+
customer: { type: Object, required: true },
|
|
47
|
+
type: { type: String, default: "billing" },
|
|
48
|
+
modelValue: { type: Object },
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const emit = defineEmits(["update:modelValue", "addSuccess", "valid"]);
|
|
52
|
+
|
|
53
|
+
const cartStore = useCartStore();
|
|
54
|
+
const addressStore = useAddressStore();
|
|
55
|
+
const orderStore = useOrderStore();
|
|
56
|
+
|
|
57
|
+
const addForm = ref(null);
|
|
58
|
+
|
|
59
|
+
const state = reactive({
|
|
60
|
+
isLoading: computed(() => (addForm.value ? addForm.value.loading : true)),
|
|
61
|
+
isSending: false,
|
|
62
|
+
wasSuccess: false,
|
|
63
|
+
user: {},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
function sendForm() {
|
|
67
|
+
const isValid = validate(addForm.value.state.skel);
|
|
68
|
+
|
|
69
|
+
if (isValid) {
|
|
70
|
+
state.isSending = true;
|
|
71
|
+
|
|
72
|
+
addForm.value.sendData().then(async (resp) => {
|
|
73
|
+
let data = await resp.json();
|
|
74
|
+
|
|
75
|
+
state.isSending = false;
|
|
76
|
+
|
|
77
|
+
if (data["action"] === "addSuccess") {
|
|
78
|
+
addForm.value.state.skel = data.values;
|
|
79
|
+
|
|
80
|
+
if (props.type === "billing") {
|
|
81
|
+
addressStore.state.active.billing = addForm.value.state.skel;
|
|
82
|
+
|
|
83
|
+
orderStore.updateParams({
|
|
84
|
+
billing_address_key: addressStore.state.active.billing.key,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if (addressStore.state.clone) {
|
|
88
|
+
cartStore.update({
|
|
89
|
+
key: orderStore.state.currentOrder.cart.dest.key,
|
|
90
|
+
shippingAddress: addressStore.state.active.shipping.key,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
addressStore.state.active.shipping = addForm.value.state.skel;
|
|
95
|
+
|
|
96
|
+
cartStore.update({
|
|
97
|
+
key: orderStore.state.currentOrder.cart.dest.key,
|
|
98
|
+
shippingAddress: addressStore.state.active.shipping.key,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
emit("addSuccess", {
|
|
103
|
+
show: true,
|
|
104
|
+
msg: "Erfolg!",
|
|
105
|
+
variant: "success",
|
|
106
|
+
icon: "check2-circle",
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
emit("valid", true);
|
|
110
|
+
} else {
|
|
111
|
+
emit("valid", false);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// TODO: needs a real validation solution with logics used in backend configuration
|
|
118
|
+
function validate(formData) {
|
|
119
|
+
const structure = addressStore.state.structure;
|
|
120
|
+
let total = 0;
|
|
121
|
+
let valid = 0;
|
|
122
|
+
|
|
123
|
+
// TODO: will be deleted when backend address module is set up properly
|
|
124
|
+
structure.firstname.required = true;
|
|
125
|
+
structure.lastname.required = true;
|
|
126
|
+
structure.street_name.required = true;
|
|
127
|
+
structure.street_number.required = true;
|
|
128
|
+
structure.zip_code.required = true;
|
|
129
|
+
structure.city.required = true;
|
|
130
|
+
structure.country.required = true;
|
|
131
|
+
|
|
132
|
+
for (let key of Object.keys(structure)) {
|
|
133
|
+
if (structure[key].required) {
|
|
134
|
+
total += 1;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
for (let [key, value] of Object.entries(formData)) {
|
|
139
|
+
if (structure[key].required && value) {
|
|
140
|
+
valid += 1;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (valid === total) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function updateValues() {
|
|
152
|
+
emit("update:modelValue", addForm.value.state.skel);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
onMounted(() => {
|
|
156
|
+
addressStore.getStructure();
|
|
157
|
+
});
|
|
158
|
+
</script>
|
|
159
|
+
|
|
160
|
+
<style scoped></style>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="viur-shop-address-box">
|
|
3
|
+
<select-address
|
|
4
|
+
v-if="addressSelection"
|
|
5
|
+
:address-list="state.addressList"
|
|
6
|
+
:modelValue="
|
|
7
|
+
type === 'billing'
|
|
8
|
+
? addressStore.state.active.billing.key
|
|
9
|
+
: addressStore.state.active.shipping.key
|
|
10
|
+
"
|
|
11
|
+
@update:modelValue="handleSelection"
|
|
12
|
+
>
|
|
13
|
+
</select-address>
|
|
14
|
+
|
|
15
|
+
<!-- debugging -->
|
|
16
|
+
<!-- {{ mode === "billing" ? addressStore.state.activeBillingAddress : "" }} -->
|
|
17
|
+
<!-- {{ mode === "billing" ? "" : addressStore.state.activeShippingAddress }} -->
|
|
18
|
+
<!-- <pre>{{ customer }}</pre> -->
|
|
19
|
+
|
|
20
|
+
<div class="viur-shop-address-box-preview" v-if="state.address">
|
|
21
|
+
<span>Ausgewählte Adresse :</span>
|
|
22
|
+
<br />
|
|
23
|
+
{{ state.address?.street_name }} {{ state.address?.street_number }}<br />
|
|
24
|
+
{{ state.address?.zip_code }} {{ state.address?.city }}
|
|
25
|
+
<br />
|
|
26
|
+
{{ state.address?.country }}
|
|
27
|
+
<br />
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup>
|
|
33
|
+
import { reactive, computed, onBeforeMount, watch } from "vue";
|
|
34
|
+
import { useAddressStore } from "../../../stores/address";
|
|
35
|
+
import { useOrderStore } from "../../../stores/order";
|
|
36
|
+
import { useCartStore } from "../../../stores/cart";
|
|
37
|
+
import SelectAddress from "./SelectAddress.vue";
|
|
38
|
+
|
|
39
|
+
const props = defineProps({
|
|
40
|
+
type: { type: String, default: "billing" },
|
|
41
|
+
addressSelection: { type: Boolean, default: false },
|
|
42
|
+
modelValue: { type: Object },
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const emit = defineEmits(["update:modelValue", "valid"]);
|
|
46
|
+
|
|
47
|
+
const addressStore = useAddressStore();
|
|
48
|
+
const orderStore = useOrderStore();
|
|
49
|
+
const cartStore = useCartStore();
|
|
50
|
+
|
|
51
|
+
const state = reactive({
|
|
52
|
+
addressList: computed(() =>
|
|
53
|
+
props.type === "billing"
|
|
54
|
+
? addressStore.getList()
|
|
55
|
+
: addressStore.getList("shipping"),
|
|
56
|
+
),
|
|
57
|
+
address: computed(() => {
|
|
58
|
+
return props.type === "billing"
|
|
59
|
+
? addressStore.state.active.billing
|
|
60
|
+
: addressStore.state.active.shipping;
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
function isValid() {
|
|
65
|
+
if (props.type === "billing") {
|
|
66
|
+
if (addressStore.state.active.billing.key) {
|
|
67
|
+
orderStore.updateParams({
|
|
68
|
+
billing_address_key: addressStore.state.active.billing.key,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (addressStore.state.clone) {
|
|
72
|
+
cartStore.update({
|
|
73
|
+
key: orderStore.state.currentOrder
|
|
74
|
+
? orderStore.state.currentOrder.cart.dest.key
|
|
75
|
+
: cartStore.state.basket.key,
|
|
76
|
+
shippingAddress: addressStore.state.active.shipping.key,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
emit("valid", true);
|
|
81
|
+
} else {
|
|
82
|
+
emit("valid", false);
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
if (addressStore.state.active.shipping.key) {
|
|
86
|
+
cartStore.update({
|
|
87
|
+
key: orderStore.state.currentOrder.cart.dest.key,
|
|
88
|
+
shippingAddress: addressStore.state.active.shipping.key,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
emit("valid", true);
|
|
92
|
+
} else {
|
|
93
|
+
emit("valid", false);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function handleSelection(e) {
|
|
99
|
+
let address = state.addressList.filter((address) => address.key === e);
|
|
100
|
+
|
|
101
|
+
if (props.type === "billing") {
|
|
102
|
+
addressStore.state.active.billing = address[0];
|
|
103
|
+
|
|
104
|
+
orderStore.updateParams({
|
|
105
|
+
billing_address_key: addressStore.state.active.billing.key,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
if (addressStore.state.clone) {
|
|
109
|
+
cartStore.update({
|
|
110
|
+
key: orderStore.state.currentOrder.cart.dest.key,
|
|
111
|
+
shippingAddress: addressStore.state.active.shipping.key,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
emit("valid", true);
|
|
116
|
+
} else {
|
|
117
|
+
addressStore.state.active.shipping = address[0];
|
|
118
|
+
|
|
119
|
+
cartStore.update({
|
|
120
|
+
key: orderStore.state.currentOrder.cart.dest.key,
|
|
121
|
+
shippingAddress: addressStore.state.active.shipping.key,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
emit("valid", true);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
onBeforeMount(() => {
|
|
129
|
+
isValid();
|
|
130
|
+
});
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<style scoped>
|
|
134
|
+
.viur-shop-address-box-preview {
|
|
135
|
+
margin: var(--sl-spacing-medium) 0;
|
|
136
|
+
}
|
|
137
|
+
</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<slot name="billing-address">
|
|
18
|
+
<address-box
|
|
19
|
+
:address-selection="true"
|
|
20
|
+
:type="'billing'"
|
|
21
|
+
@valid="emit('valid', $event)"
|
|
22
|
+
>
|
|
23
|
+
</address-box>
|
|
24
|
+
</slot>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<slot name="mode-switch"></slot>
|
|
28
|
+
|
|
29
|
+
<div class="viur-shop-cart-address" v-if="customAddress">
|
|
30
|
+
<div class="viur-shop-cart-address-headline">
|
|
31
|
+
{{ $t("skeleton.address.address_type.shipping") }}
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<slot name="shipping-address" v-if="customAddress">
|
|
35
|
+
<address-box
|
|
36
|
+
:address-selection="customAddress"
|
|
37
|
+
:type="'shipping'"
|
|
38
|
+
@valid="emit('valid', $event)"
|
|
39
|
+
>
|
|
40
|
+
</address-box>
|
|
41
|
+
</slot>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup>
|
|
47
|
+
import { reactive } from "vue";
|
|
48
|
+
import AddressBox from "./AddressBox.vue";
|
|
49
|
+
|
|
50
|
+
const props = defineProps({
|
|
51
|
+
customer: { type: Object, required: true },
|
|
52
|
+
customAddress: { type: Boolean, default: false },
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const emit = defineEmits(["valid"]);
|
|
56
|
+
|
|
57
|
+
const state = reactive({ });
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<style scoped>
|
|
61
|
+
.viur-shop-cart-address-wrap {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
gap: var(--sl-spacing-x-large);
|
|
65
|
+
margin-top: var(--sl-spacing-large);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.viur-shop-cart-address-headline {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
flex-wrap: nowrap;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: space-between;
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
margin-bottom: var(--sl-spacing-medium);
|
|
76
|
+
}
|
|
77
|
+
</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>
|